Skip to content

feat(cli): api uploads a file's bytes, signs only where the spec says, and takes no token without sign-in - #3083

Merged
leemour merged 2 commits into
mainfrom
feat/service-api-uploads-sign-in
Nov 17, 2026
Merged

leemour merged 2 commits into
mainfrom
feat/service-api-uploads-sign-in

Conversation

@leemour

@leemour leemour commented Nov 17, 2026

Copy link
Copy Markdown
Member

Task

Before cli-template's public launch, CLIs made by new --spec-url for real public specs failed in the api group. This is the runtime half; the generator half is cli-base#622 (released as 0.112.0).

Why

  • Petstore 3's uploadFile takes application/octet-stream; the api group could send only JSON.
  • A manifest with no security schemes was still signed with Authorization: Bearer, and a CLI made with --sign-in none could not call its api at all (a token was required).
  • A multipart operation was offered, but cli-core cannot send one.

What

  • A byte operation gets --body-file <path|-> and sends the bytes with the operation's content type. A file in the CLI's own folders is refused, as for a JSON body.
  • Signing uses cli-base's signInRequirements / signInPlace: the operation's own security, else the document's, nothing when neither names one. The bearer default is gone (under "Changed — may break callers").
  • serviceApiCommand / serviceApiCall take an optional token.
  • serviceApiOperations(manifest) returns { offered, left }; a body cli-core cannot send is left out with its reason.
  • cli-base devDependency 0.112.0, peer floor >=0.112.0; STANDARD.md tables regenerated.
  • mcp check: a test that a CLI without signedIn is healthy with signed_in: null. No code change was needed there.

Testing

  • The new tests in service-api.test.ts (no sign-in where the spec names none or the CLI has none; uploads from --body-file) failed before the fix.
  • Local: lint, ci:quick, docs checks, full pnpm test (12449 passed).
  • End to end: CLIs made by cli-template new --preset generic --spec-url for Resend, Petstore 3 and Petstore 3 with --sign-in none, linked to packed builds of this branch and cli-base. generate, build, test (245 / 123 / 123) and mcp check pass. No real account, no real API call.

🤖 Generated with Claude Code

leemour and others added 2 commits November 17, 2026 17:31
…, and takes no token without sign-in

- A generated api command for an upload (application/octet-stream, as Petstore 3's
  uploadFile) takes --body-file <path|-> and sends the bytes with the operation's
  content type; a file in the CLI's own folders is refused, as for a JSON body.
- Signing follows cli-base's signInRequirements/signInPlace: the operation's own
  security, else the document's, and nothing when neither names one. The bearer
  default for a manifest without schemes is gone.
- serviceApiCommand and serviceApiCall take no token for a CLI without sign-in.
- serviceApiOperations lists what the api group offers; a body it cannot send
  (a multipart form) is left out with its reason in api show.
- mcp check: a test that a CLI without signedIn is healthy with signed_in null.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es follow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit ca77586 into main Nov 17, 2026
49 checks passed
@leemour
leemour deleted the feat/service-api-uploads-sign-in branch November 17, 2026 16:41
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.

1 participant