Skip to content

feat: add v2 documents commands - #62

Merged
dspangen merged 4 commits into
mainfrom
feat/v2-documents-api
Jun 15, 2026
Merged

feat: add v2 documents commands#62
dspangen merged 4 commits into
mainfrom
feat/v2-documents-api

Conversation

@dspangen

@dspangen dspangen commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds CLI commands for the v2 documents API, which is now GA — refreshed against the latest monorepo spec (no more experimental flags).

The six operations auto-generate from the embedded spec:

Command Operation
omni documents v2-create <model-id> <name> POST /api/v2/documents (create + publish)
omni documents v2-get <identifier> GET /api/v2/documents/{identifier}
omni documents v2-get-draft <identifier> <draft-identifier> GET .../draft/{draftIdentifier}
omni documents v2-patch-draft <identifier> PATCH .../draft (create draft + apply)
omni documents v2-patch-draft-by-identifier <identifier> <draft-identifier> PATCH .../draft/{draftIdentifier}
omni documents v2-publish-draft <identifier> POST .../draft/publish

Since the first cut of this branch, upstream removed the one-shot PATCH /api/v2/documents/{identifier} in favor of the draft flow (patch a draft, then publish) and added the create and publish routes — this refresh tracks that.

Body shorthands promote metadata to flags (--name/--description/--summary, --branch-id on v2-patch-draft; positional <model-id> <name> plus --identifier/--description/--folder-id on v2-create). Heavy nested content (containers, controls, queryPresentations, settings) stays on --body/stdin and round-trips from a v2-get response. The agent-help guide documents the create/read/edit/publish workflow.

Note: the spec is synced from the monorepo branch dan/api-v2-documents-ga (drops the experimental flags upstream) ahead of its merge to main. New body fields on POST/PATCH endpoints don't appear as flags — those endpoints take --body.

Side-effect operations pulled in by the full sync: a new omni ai-eval group (aiEvalPromptSets*), plus aiBranding, aiConversationDetail, aiConversationsList, connectionsDelete, connectionsGet, documentsListDrafts, documentsListFavorites, modelAiAgentActions.

Test plan

  • make build and make test pass
  • omni documents --help shows all six v2 commands (no v2-patch), with GA summaries (no "experimental")
  • omni documents v2-create --help / v2-publish-draft --help show expected args, flags, and examples
  • Embedded spec contains zero experimental markers
  • Optional live verification: omni documents v2-get <identifier> against a real org

🤖 Generated with Claude Code

Sync the OpenAPI spec to pull in the v2 documents API, which is now GA
— no experimental flags. These auto-generate as `omni documents
v2-create`, `v2-get`, `v2-get-draft`, `v2-patch-draft`,
`v2-patch-draft-by-identifier`, and `v2-publish-draft`. Upstream
replaced the one-shot PATCH /api/v2/documents/{identifier} with the
draft flow (patch a draft, then publish it) and added the create and
publish routes. The spec is synced from the monorepo GA branch
(dan/api-v2-documents-ga) ahead of its merge to main.

Add body shorthands promoting metadata fields to flags:
--name/--description/--summary on both draft PATCH commands plus
--branch-id on v2-patch-draft, and positional <model-id> <name> with
--identifier/--description/--folder-id on v2-create. Heavy nested
content (containers, controls, queryPresentations, settings) stays on
--body/stdin and round-trips cleanly from a v2-get response.

Also document the v2 create/read/edit/publish workflow in agent-help.

Side-effect operations pulled in by the full sync: a new `omni ai-eval`
group (aiEvalPromptSets*), plus aiBranding, aiConversationDetail,
aiConversationsList, connectionsDelete, connectionsGet,
documentsListDrafts, documentsListFavorites, modelAiAgentActions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dspangen
dspangen force-pushed the feat/v2-documents-api branch from 708d4f1 to 4841432 Compare June 12, 2026 15:17
@dspangen dspangen changed the title feat: add v2 documents read/patch commands feat: add v2 documents commands Jun 12, 2026
@dspangen
dspangen requested review from lukebowerman and n8agrin June 12, 2026 15:23

@lukebowerman lukebowerman left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not going to pretend to claim that I read the 16,000 lines here, but the small bits that look actually not related to the openAPI appear fine to me.

I'm not familiar with go or this library, so would appreciate if somebody with more experience (probably @n8agrin ) could weigh in here just in case I'm missing something obvious

@jacksweeney5

Copy link
Copy Markdown
Contributor

Claude says (on Jack's behalf): two findings from live-testing this build while migrating the content-builder skill (omni-agent-skills#78):

  1. Draft-command arg order doesn't match the PR description. The table above lists omni documents v2-get-draft <identifier> <draft-identifier>, but the generated commands take the draft identifier first: v2-get-draft <draftIdentifier> <identifier> and v2-patch-draft-by-identifier <draftIdentifier> <identifier> (the generator orders positionals by the spec's parameters array, not the path template). Calling in the documented order returns a 404. Worth either fixing the description or making the generator follow path order so the CLI matches the URL shape.

  2. --body silently ignores all shorthand flags. In applyBodyShorthand, a non-empty --body short-circuits before flag assembly, so --name/--summary/--branch-id etc. are dropped without warning when combined with --body. This bit us in testing: v2-patch-draft <id> --branch-id <uuid> --body '{...}' created a silently-mainline draft (branch: null in list-drafts) instead of a branch-bound one. An error (or warning) when shorthand flags are combined with --body would prevent it.

dspangen and others added 2 commits June 12, 2026 16:28
The v2 document draft routes declare draftIdentifier before identifier
in the spec's parameters array, so generated commands took args in the
reverse of the URL shape (v2-get-draft <draftIdentifier> <identifier>),
404ing for anyone following the documented order. Sort path params by
their position in the path template; only the two draft-by-identifier
commands change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A non-empty --body short-circuited before shorthand assembly, silently
dropping promoted flags like --branch-id — e.g. a draft PATCH meant for
a branch landed on mainline. Fail fast instead, naming the conflicting
flags. Uses Changed() so flag defaults don't false-positive, and covers
the hidden --json-body alias.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dspangen

Copy link
Copy Markdown
Contributor Author
  1. Arg order — the generator now orders positional args by their position in
    the URL path template instead of the spec's parameters array (the draft
    routes declare draftIdentifier first, which is where the swap came from).
    v2-get-draft and v2-patch-draft-by-identifier now take
    <identifier> <draft-identifier>, matching the URL shape and the table in the
    PR description. I scanned the whole spec: these two endpoints were the only
    declaration-order mismatches, so no other command signatures changed — and
    future make sync-spec pulls are now immune to the same quirk. (a810272)

  2. --body + shorthand flags — now a hard error instead of a silent drop:

    $ omni documents v2-patch-draft doc-1 --branch-id b-1 --body '{...}'
    Error: --branch-id cannot be combined with --body; include the field(s) in the JSON body instead

@lukebowerman

Copy link
Copy Markdown

Merged the last of the breaking changes for the V2 API (removing hidden: boolean from filter/control configuration) so with a fresh pull of the OpenAPI spec this should be good-to-go.

Adds the AI Eval runs API surface (tag "AI Eval"), which generates an
omni ai-eval runs-* command set:

- runs-list   GET    /api/v1/ai/eval/runs            (--prompt-set-id required, --archived)
- runs-create POST   /api/v1/ai/eval/runs
- runs-get    GET    /api/v1/ai/eval/runs/{runId}
- runs-archive   DELETE /api/v1/ai/eval/runs/{runId}
- runs-cancel    POST   /api/v1/ai/eval/runs/{runId}/cancel
- runs-unarchive POST   /api/v1/ai/eval/runs/{runId}/unarchive

The full re-sync from exploreomni/omni@main also reorders/reformats the
embedded JSON; no other operations or params were added or removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dspangen
dspangen merged commit e291711 into main Jun 15, 2026
2 checks passed
@dspangen
dspangen deleted the feat/v2-documents-api branch June 15, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants