Skip to content

feat(cli): overhaul cli core#617

Draft
sarahxsanders wants to merge 5 commits into
mainfrom
posthog-code/cli-overhaul-core
Draft

feat(cli): overhaul cli core#617
sarahxsanders wants to merge 5 commits into
mainfrom
posthog-code/cli-overhaul-core

Conversation

@sarahxsanders

@sarahxsanders sarahxsanders commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

CLI OVERHAULLLL

context-mill #178 publishes a cli: block per skill and emits the
resolved entries inside skill-menu.json. this PR rewires the wizard
to consume that at runtime instead of baking a snapshot at build time.

three things happening here:

  1. skill-backed subcommands resolve at runtime, no baked manifest
  2. command families live in wizard source; subcommands live in context-mill
  3. audit-3000 is retired

how dispatch works now

every family (wizard audit, wizard migrate, wizard revenue-analytics)
is a yargs command with a [skill] positional and a handler. the handler
is dispatchFamily, which:

  1. checks the wizard-native handler registry first (today: just
    audit web-analytics). runs immediately if matched — no network.
  2. otherwise fetches skill-menu.json, finds the entry where
    parentCommand + command match, and runs the resolved skill.
  3. unknown subcommand → prints the available list and exits 1.

wizard audit with no positional opens the existing family picker,
which fetches at picker-open time and shows native + live entries
together. the recommended leaf from context-mill is pre-highlighted.

adding a new audit subcommand (e.g. wizard audit web-vitals) is now a
context-mill release with a new skill + cli: block. no wizard
release needed.
adding a new family (wizard investigate) is still a
wizard PR. that's the explicit split.

audit-3000

dropped on the wizard side too (context-mill already dropped it). this
removes:

  • src/lib/programs/audit-3000/
  • src/ui/tui/screens/audit-3000/
  • audit3000 entries in program-registry, screen-registry,
    screen-sequences
  • the special "use opus for audit-3000" branch in agent-interface.ts
  • the audit-3000 · area slides deck in the playground

testing

  • pnpm typecheck green
  • pnpm jest (no e2e): 817/817 tests passing across 53 suites
  • programs-cli.test.ts rewritten to mock fetchSkillMenu and assert
    dispatchFamily routing (skill-backed entry, native handler, the
    comprehensive audit all special case)
  • one assertion in family-picker.test.ts flipped to match the new
    reality (auditCommand.children is undefined by design now)
  • program-registry.test.ts updated for the revenue-analytics
    command-name rename (was revenue)

local end-to-end check (pointing at a local context-mill build via
--local-mcp / LOCAL_SKILLS_BASE_URL=http://localhost:8765):

  • wizard audit events resolves audit-events over the wire
  • wizard audit web-analytics runs the native doctor (no network)
  • wizard audit opens the picker with native + live entries
  • wizard audit unknown-thing prints the available list and
    exits non-zero
  • wizard audit with the registry unreachable prints a clear
    error and exits non-zero

Core of the CLI overhaul: adds the ProgramCliSurface type, snapshots
context-mill's cli-manifest.json into a build-time TS module (schema-validated
via ajv in prebuild — a fetched-but-invalid manifest fails the build), adds the
native + skill command factories, the `wizard audit` family with an interactive
picker (recommended leaf pre-highlighted), and the `wizard skill` catalog
(internal role hidden by default). Old single-purpose command entry files are
replaced by manifest-derived commands.

Manifest contract uses context-mill's role/command/skill/internal +
recommended vocabulary (renamed from the earlier surface/public/catalog +
default).

Generated-By: PostHog Code
Task-Id: 4debb1ba-a98a-494f-ba44-29df9fd1d87b
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

@sarahxsanders sarahxsanders changed the title feat(cli): typed surface + manifest snapshot + command migration feat(cli): overhaul cli core Jun 9, 2026
…cute

- flatSkillCommand: graceful fallback when a manifest entry is missing,
  instead of throwing at import (which took down the whole CLI); both flat
  commands now resolve by stable skillId
- command.ts: declare positionals so `skill [name]` parses under
  strictOptions; correct the `recommended` doc comment
- skill: `wizard skill` lists, `wizard skill <name>` runs, `wizard skill
  search <query>` searches; reject unknown skill names
- agentSkillConfig: add a run recipe so `wizard skill <name>` and the narrow
  audit leaves actually run (were silently skipped via skipAgent)
- family-picker: document the argv-bypass on the picker path
- tests: regression guard for the agentSkillConfig run recipe

Generated-By: PostHog Code
Task-Id: b42696d8-ac3c-4cd2-ba12-747a846b8c23
…sive audit

Move the `recommended` flag from `audit all` to `audit-events` so a bare
`wizard audit` pre-highlights the events audit. `audit all` stays a selectable
leaf — dropping it (and the auditConfig/screen cleanup that requires) is
deferred to the multi-select PR.

Mirrors the matching context-mill `cli:` change; the build currently sources
this bootstrap snapshot since context-mill hasn't released the manifest yet.

Generated-By: PostHog Code
Task-Id: b42696d8-ac3c-4cd2-ba12-747a846b8c23
@sarahxsanders sarahxsanders requested a review from a team June 10, 2026 19:48
…ill id

AuditRunScreen picked the slide deck by checking
`session.skillId === 'events-audit'`, but context-mill renamed that skill
to `audit-events` (the bootstrap manifest and the programs-cli dispatch
test both use `audit-events`). The stale check silently fell through to
the comprehensive AUDIT_AREA_SLIDES, so `wizard audit events` showed the
wrong deck. Match the current id.

Generated-By: PostHog Code
Task-Id: 95407a79-1f13-4f1d-a37b-43fe4a62b857
Replaces the build-time CLI manifest snapshot with a runtime resolver
that reads cliEntries from skill-menu.json each invocation. Adding a
skill-backed subcommand is now a context-mill release; no wizard release
needed.

How it fits together:

  - dispatch-family.ts owns the runtime resolution. dispatchFamily(family,
    argv) tries the native handler registry first (today: just
    audit/web-analytics), then fetches skill-menu.json and matches
    parentCommand + command -> skillId. The comprehensive `audit all`
    keeps its specialized auditConfig; everything else runs through the
    generic agent-skill program with the resolved skillId injected.

  - family-command-factory.ts wraps dispatchFamily as a yargs Command
    (name: `<family> [skill]`). interactiveDefault opens the picker with
    native + live entries combined; the recommended leaf is
    pre-highlighted.

  - audit.ts collapses to one factory call. migrate.ts / revenue.ts swap
    flatSkillCommand for nativeCommandFactory now that the config has
    the right command name and skillId. skill.ts fetches the catalog
    at handler time instead of reading a baked snapshot.

Deletions:

  - audit-3000 retired (skill, screens, registry entry, agent-interface
    model branch, playground demo, screen-registry wiring)
  - skill-command-factory.ts + flat-skill-command.ts: the runtime resolver
    replaces both, including the empty-manifest fallback flat-skill-command
    existed to work around
  - cli-manifest.bootstrap.json, cli-manifest.schema.bootstrap.json,
    scripts/generate-cli-manifest.cjs, src/lib/programs/cli-manifest.generated.ts
  - ajv dev-dep; the generate-cli-manifest.cjs step in prebuild; three
    .gitignore lines covering the deleted bootstrap apparatus

Test surface: programs-cli mocks fetchSkillMenu and asserts dispatchFamily
routing (skill-backed, native, comprehensive). family-picker keeps its
auditCommand shape assertion but flipped to "no static children by design".
program-registry catches the revenue-analytics command-name rename.

Co-Authored-By: Claude Opus 4.7 (1M context) <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