Skip to content

feat(manifest): defineCli and parseCliConfig, the shape of wirecat.config.ts - #3082

Merged
leemour merged 3 commits into
mainfrom
feat/cli-config
Nov 17, 2026
Merged

leemour merged 3 commits into
mainfrom
feat/cli-config

Conversation

@leemour

@leemour leemour commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Task

cli-template's new --from-config (the source-manifest plan, PR 5) builds a CLI from one file, wirecat.config.ts. That file imports defineCli from @wirecat/cli-core/manifest, which did not exist.

What

  • New export @wirecat/cli-core/manifest: the CliConfig type, defineCli (typed identity function) and parseCliConfig (valibot, strict).
  • A config names the CLI (command, package, environment prefix, service, owner), its API description (openapi/swagger at an https URL), its sign-in (none, token, oauth2-pkce with scopes, scheme, redirect, revokeUrl, authorizeParams, rotating), its category (cli-template's --category values, or other) and, for a crm CLI, its source (CrmManifest).
  • Each error reads wirecat.config: <field>: <message>, reason manifest.invalid. A crm CLI needs its source; any other category may not carry one.

Testing

  • src/manifest/index.test.ts: a valid config, field-named errors, spec.from other than an https URL (a path, //host, a bare https://, other schemes), name rules, source outside crm.
  • Every field is read by cli-template's new --from-config (its PR follows the release); a local description and an identity provider are left out until something reads them.
  • Full suite: 12447 passed; the one failure, src/store/version-24.test.ts, passes alone (load).
  • pnpm typecheck, lint, pnpm docs:check, check:dist pass locally. A fresh review found no blocking bugs; its four findings are applied.

🤖 Generated with Claude Code

…nfig.ts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leemour and others added 2 commits November 17, 2026 17:14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…which the source carries

The kit reads nothing else yet: a local description has no URL to resolve relative servers against, and a CRM
source names its own provider. Either can be added later without breaking a config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit a3b3c7c into main Nov 17, 2026
50 checks passed
@leemour
leemour deleted the feat/cli-config branch November 17, 2026 16:34
leemour added a commit that referenced this pull request Nov 17, 2026
…ter URLs and fields (#3087)

## Task

PR 5b of the source-manifest plan: a CLI built from `wirecat.config.ts`
signs in with a real check of the token. The coordinator also asked for
a fresh review of #3080 and of #3082's changes after its review; this PR
applies what held up.

## What

- **`auth.verify: { operation, id, name? }`** for `token` and
`oauth2-pkce`: the operation that answers whose the token is, and where
its answer holds the account's id and name. cli-template's generated
`session start` checks a token with it (Attio `getV2Self`, Notion's
users/me).
- **`recalledAccount`** is exported from `@wirecat/cli-core/cli`: the
account a profile signed in to, as `session start` remembered it.
cli-template's CRM wiring keys the store by it.
- **From the review:**
- `spec.from`, `auth.revokeUrl` and a relay redirect take an https URL
with a host, without spaces, a user name or password, or a key or token
in its query (these would be committed into the CLI's files);
  - `hooks` takes a `.ts` or `.js` module under `./`, without `..`;
- the schema's output is typed against `CliConfig` (a typed local, not a
bare cast), so the two cannot drift; `parseCliConfig` still returns
`CliConfig`, as cli-template's kit expects (the parity job caught a
first attempt that changed it);
- an unknown field reads "not a field of wirecat.config", a missing one
"missing";
- the changelog says cli-core needs cli-base 0.112.0 or later (since
0.693.0).
- Not taken: a CI check against the peer floor, and cli-template
importing `CLI_CATEGORIES` (follow-ups).

- **From a fresh review of this PR:** secret query names match whole
words (`?design=1`, `?keyword=` pass; `?accessToken=` is refused); a
`#fragment` is refused; `verify.id`/`name` must be dot paths; "missing"
and "not a field" are chosen by the issue's shape, so `scopes:
[undefined]` keeps valibot's words; `./.ts` and `.d.ts` hooks are
refused. Not changed: the typed local catches drift one way only
(comment narrowed); `recalledAccount` joins the profile name into a path
as `rememberAccount` already did; whether every caller checks profile
names is not verified here (a follow-up).

## Testing

- `src/manifest/index.test.ts`: categories, crm with a source, `verify`,
each refused URL, old and missing fields, `hooks` paths.
- `pnpm typecheck`, lint, `docs:check`, `check:dist`, and the full
suite: 12454 passed. The 2 failures, in
`src/services/messages-transcript-words.test.ts`, pass alone (7/7).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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