Split CLI surface into @primitivedotdev/cli#66
Conversation
The AGX summarizer runs surfaced a consistent mental-model problem: agents discovered the package via `npx @primitivedotdev/sdk@latest` and then treated `@primitivedotdev/sdk` as a CLI tool. In the most recent run, the agent's generated `package.json` had `esbuild` as the only devDep and `@primitivedotdev/sdk` nowhere, even though the docs showed `createPrimitiveClient` from `@primitivedotdev/sdk/api` in handler examples. The agent classified the SDK as "the CLI" and wrote raw fetch calls in the handler. This split disambiguates: `@primitivedotdev/cli` is a CLI you install once; `@primitivedotdev/sdk` is a library you add to dependencies. Matches the convention across every other dev-tool ecosystem (wrangler vs @cloudflare/workers-types, vercel vs @vercel/node, etc.). cli-node/ is a new package with all CLI source, tests, build config, and Make targets. Depends on @primitivedotdev/sdk@^0.23.0 for runtime types and the API client. Independent pnpm-lock.yaml so cross-package dep changes are explicit, not transitive. sdk-node retains its src/oclif/ snapshot for a deprecation window. bin/run.js prints a one-line stderr banner on every CLI invocation pointing at @primitivedotdev/cli. The shipped CLI surface in sdk-node 0.24.0 is frozen against the 0.23.0 command set; new CLI features land in cli-node only. Banner-only behavior covers the agent-prompt corpus in the wild that still references npx @primitivedotdev/sdk@latest <command>. sdk-go and sdk-python bumped to 0.24.0 lockstep with sdk-node. No functional change in those. Wired into the existing release pipeline: - New .github/workflows/cli-release.yml mirrors node-release.yml; triggers on cli-node/package.json version changes. - .github/workflows/sdk-checks.yml adds a cli job paralleling the node job (matrix on Node 22/24). - Makefile gains cli-install / cli-test / cli-check / cli-build / cli-smoke / cli-coverage and wires them into check / build / release-check / ci. Verified locally: - make node-check: 31 files / 699 tests green; deprecation banner fires in node-smoke. - make cli-check: 10 files / 139 tests green. - make cli-smoke: packed tarball installs and `primitive list-operations` works. - make node-smoke: packed tarball still works; deprecation banner visible on each invocation. - make shared-check: green. - No em dashes, no Conventional Commits prefix, no Co-Authored-By trailer. Follow-ups (separate PRs): - mono-repo docs sweep replacing every `npx @primitivedotdev/sdk@latest` reference in /docs/quickstart, /docs/functions, /docs/cli, and llms.txt with the @primitivedotdev/cli equivalent. - After 2-3 minor releases, delete sdk-node/src/oclif/ and the bin entry; @primitivedotdev/cli becomes the sole CLI surface.
Greptile SummaryThis PR extracts the
Confidence Score: 5/5Safe to merge — the change is primarily an additive extraction with a backward-compatible deprecation shim on the existing SDK bin. The new cli-node workspace is a clean copy of the existing oclif surface with no functional changes to command logic. The sdk-node deprecation path retains the full 0.23.0 command set behind a one-liner stderr banner. CI wiring mirrors existing patterns exactly. SDK_VERSION_RANGE in the scaffolder is correctly pinned to ^0.23.0, matching the CLI's own tested dependency. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "Lockstep scaffolder SDK range with the C..." | Re-trigger Greptile |
Greptile review on PR #66 caught that SDK_VERSION_RANGE in the functions:init scaffolder was pinned to ^0.22.0 while cli-node itself depends on @primitivedotdev/sdk@^0.23.0. Scaffolded projects would get a one-minor-old SDK that the CLI hadn't been built or tested against, opening a silent-break window if 0.22.0 and 0.23.0 differ. Bump the scaffolder range to ^0.23.0 to match cli-node/package.json, update the comment to require lockstep with the CLI's own SDK dep, and add a regression test that reads cli-node/package.json at runtime and asserts the two ranges are byte-equal. Future bumps now have to land in both places or the test fails.
|
Addressed Greptile finding in c53243b. Bumped SDK_VERSION_RANGE in the functions:init scaffolder from ^0.22.0 to ^0.23.0 so it matches cli-node's own @primitivedotdev/sdk dep, and added a regression test that reads cli-node/package.json at runtime and asserts the two ranges are byte-equal. Future bumps now have to land in both places or the test fails. All 140 cli-node tests green; lint and typecheck clean. |
Summary
Move the
primitiveCLI out of@primitivedotdev/sdkinto a new@primitivedotdev/clipackage.The motivation comes from the AGX summarizer runs: agents discover the package via
npx @primitivedotdev/sdk@latest <command>and then treat@primitivedotdev/sdkas a CLI tool. The most recent run's generatedpackage.jsonhadesbuildas the only devDep and@primitivedotdev/sdknowhere, even though the docs showcreatePrimitiveClientfrom@primitivedotdev/sdk/apifor in-handler use. The agent classified the SDK as "the CLI" and wrote raw fetch calls in the handler.This split matches the convention across every dev-tool ecosystem:
wranglervs@cloudflare/workers-types,vercelvs@vercel/node,aws-clivs@aws-sdk/*. CLI = binary you install once. SDK = library you add to dependencies. Two packages, two roles, two install moments. Agents have to engage with both.What changed
cli-node/workspace publishing@primitivedotdev/cliat0.24.0. Contains all oclif command source, tests, and build configs. Depends on@primitivedotdev/sdk@^0.23.0for runtime types and the API client; its ownpnpm-lock.yaml.sdk-node/bumped to0.24.0. Retains the existingsrc/oclif/snapshot for a deprecation window sonpx @primitivedotdev/sdk@latest <command>keeps working for agent prompts in the wild.bin/run.jsprints a one-line stderr banner pointing at@primitivedotdev/clion every invocation.sdk-goandsdk-pythonbumped to0.24.0lockstep with sdk-node. No functional change..github/workflows/cli-release.ymlmirrorsnode-release.yml; triggers oncli-node/package.jsonversion changes..github/workflows/sdk-checks.ymladds aclijob paralleling the existingnodejob (matrix on Node 22/24).Makefilegainscli-install/cli-test/cli-check/cli-build/cli-smoke/cli-coverageand wires them intocheck,build,release-check, andci.RELEASE.mdandCLAUDE.mdupdated with the cli-node release flow.functions:initscaffolder's generated README mentions@primitivedotdev/clias the source of theprimitivebinary.sdk-node/README.mdrewritten to focus on the library and point CLI users at@primitivedotdev/cli.Backward compat
The CLI surface in
sdk-node@0.24.0is frozen against the0.23.0command set. Every invocation prints:Existing scripts and prompts continue to work for 2-3 minor releases. After that, the CLI surface gets deleted from sdk-node entirely (separate PR).
Verified locally
make node-check: 31 files / 699 tests green.make cli-check: 10 files / 139 tests green.make node-smoke: packed sdk-node installs;primitive list-operationsworks; deprecation banner visible on each invocation.make cli-smoke: packed cli-node installs;primitive list-operationsworks.make shared-check: green.Follow-ups (separate PRs)
npx @primitivedotdev/sdk@latestreference in/docs/quickstart,/docs/functions,/docs/cli, andllms.txtwith the@primitivedotdev/cliequivalent.sdk-node/src/oclif/and the bin entry;@primitivedotdev/clibecomes the sole CLI surface.Test plan
CLI Releaseworkflow runs on the version bump incli-node/package.jsonand publishes@primitivedotdev/cli@0.24.0to npm.Node Releaseworkflow runs on the version bump insdk-node/package.jsonand publishes@primitivedotdev/sdk@0.24.0to npm with the deprecation banner.npm install -g @primitivedotdev/cli@0.24.0 && primitive whoamiworks against a real API key.npx @primitivedotdev/sdk@0.24.0 whoamiworks and prints the deprecation banner to stderr.