Repository navigation
feat: disableCommands to turn off the mcp and plugin built-ins (#200) - #202
Conversation
A CLI can now leave out the optional `mcp` and `plugin` commands via
`.apijack/settings.json` `disableCommands` or `createCli({ disableCommands })`.
Turning off `mcp` also turns off `plugin`. Unknown entries are dropped with
the standard settings warning.
Updates (`upgrade` and the startup update prompt) now re-run
`plugin install` only when both commands are enabled and the plugin was
installed before. The shared binary checks for updates after loading
project settings so it can apply that rule.
…ps as built-ins `commandGates()` is now the one place that decides whether `mcp` and `plugin` are on; createCli and the shared binary both use it. With a built-in turned off, an API group that shares its name (e.g. a `mcp` tag) was still listed under the core commands and skipped the first-run setup prompt. Help now tells built-ins apart by their Command instances, and `mcp` / `plugin` skip auth only while the built-in exists.
garretpremo
left a comment
There was a problem hiding this comment.
🤖 Automated review by claude — generated by the
review-issueskill. Treat as advisory; a human still owns the merge decision.
All five acceptance criteria from #200 are met. disableCommands is validated in settings.ts, gated in one place (commandGates()), carried from settings.json through bin/apijack.ts into createCli, and documented in CLAUDE.md, AGENTS.md and GEMINI.md. Updates re-run plugin install only when it's on and was installed before, which works because uninstallPlugin removes the marketplace dir. Help now picks out built-ins by their Command instances, so a same-named API group is listed and authed as an API command. I checked out the branch locally: bun test gave 1343 pass / 0 fail, lint had 0 errors, there are no new type errors in the changed files, and CI is green on b979993.
Non-blocking observations
- The update check now runs later in
bin/apijack.ts. It used to be the first thing the binary did. Now it runs after.envloading,loadProjectAuth(),getActiveEnvConfig()andnew URL(env.url). So if.apijack/auth.tsthrows on import, or a saved config URL is malformed, the update prompt never appears. Before, it did, which gave a user a way to update out of a broken release. That's unlikely to matter much, and it's the price of readingsettings.jsonfirst. One side effect is good:APIJACK_SKIP_UPDATEset in a project.envis now honored. - The "running it is an unknown-command error" docs line has a TTY exception. With
mcpoff,mcpdrops out ofskipAuthCommands. So in a TTY with no saved environment,<cli> mcphits the first-run setup prompt before Commander reports the unknown command. Any typo'd command already behaves this way, so this isn't a regression. It's just slightly different from what the docs promise. - The update-path wiring has no test.
shouldReinstallPlugin()andrefreshAfterUpdate()have unit tests. Nothing tests thatregisterUpgradeCommand(..., { reinstallPlugin })andcheckForUpdate(..., { reinstallPlugin })actually pass the flag on, for example thatupgradewithdisableCommands: ['plugin']spawns nothing. The wiring is a one-liner, so the risk is low. - The shipped
skills/write-routine/SKILL.mdtable doesn't mentiondisableCommands. Its.apijack/settings.jsonrow (around line 317) still lists onlycustomCommands.defaults.requiresAuth. The criterion only asks for the agent guides, and those are covered.
Nitpicks
bin/apijack.ts: with the old// 2. Check for updatesblock gone, the step comments jump from// 1.to// 3., and the moved check is labeled// 8b..
garretpremo
left a comment
There was a problem hiding this comment.
🤖 Final review by claude — generated by the
final-reviewskill. CI is green, no blockers, soak window elapsed. Marking approved and merging.
Approved.
Outstanding observations from first-pass review
- The update check now runs later in
bin/apijack.ts. It used to be the first thing the binary did. Now it runs after.envloading,loadProjectAuth(),getActiveEnvConfig()andnew URL(env.url). So if.apijack/auth.tsthrows on import, or a saved config URL is malformed, the update prompt never appears. Before, it did, which gave a user a way to update out of a broken release. That's unlikely to matter much, and it's the price of readingsettings.jsonfirst. One side effect is good:APIJACK_SKIP_UPDATEset in a project.envis now honored. - The "running it is an unknown-command error" docs line has a TTY exception. With
mcpoff,mcpdrops out ofskipAuthCommands. So in a TTY with no saved environment,<cli> mcphits the first-run setup prompt before Commander reports the unknown command. Any typo'd command already behaves this way, so this isn't a regression. It's just slightly different from what the docs promise. - The update-path wiring has no test.
shouldReinstallPlugin()andrefreshAfterUpdate()have unit tests. Nothing tests thatregisterUpgradeCommand(..., { reinstallPlugin })andcheckForUpdate(..., { reinstallPlugin })actually pass the flag on, for example thatupgradewithdisableCommands: ['plugin']spawns nothing. The wiring is a one-liner, so the risk is low. - The shipped
skills/write-routine/SKILL.mdtable doesn't mentiondisableCommands. Its.apijack/settings.jsonrow (around line 317) still lists onlycustomCommands.defaults.requiresAuth. The criterion only asks for the agent guides, and those are covered.
Closes #200
Summary
A CLI can now turn off the optional
mcpandpluginbuilt-ins withdisableCommands, set in.apijack/settings.jsonor passed tocreateCli. After an update,plugin installis re-run only when it still applies.What changes
disableCommandsProjectSettings.disableCommands/CliOptions.disableCommands(DisableableCommand = 'mcp' | 'plugin', exported).mcpandplugin. Unknown entries and non-arrays are dropped with the standard settings warning.commandGates()(src/command-gates.ts) is the one place that decides what's on. Turning offmcpalso turns offplugin.Commandinstances instead of by name. With a built-in off, an API group that shares its name (e.g. amcptag) is listed as an API command and goes through the first-run setup like any other.Updates
src/post-update.ts:shouldReinstallPlugin()andrefreshAfterUpdate()replace the two inlineplugin installre-runs inupgradeandsrc/updater.ts.plugin installis re-run only whenmcpandpluginare on and the plugin was installed before (its marketplace directory exists). Previously it ran unconditionally, including for users who had never installed it.bin/apijack.tsnow checks for updates after loading project settings, so it can apply the same rule.Docs
CLAUDE.md,AGENTS.mdandGEMINI.md. The wiki is updated at release time.Acceptance criteria
{ "disableCommands": ["mcp"] }removesmcpandpluginfrom--help;pluginsstays["plugin"]removes onlypluginplugin installwhen it's off or was never installedTest plan
bun test: 1343 pass, 0 failbun run lint: 0 errorsbunx tsc --noEmit -p .: no new errors (same 9 pre-existing files asdev)tests/settings.test.ts(validation),tests/cli-builder.test.ts(disableCommands: help, unknown command, same-named API group in help and first-run setup),tests/post-update.test.ts,tests/command-gates.test.ts,tests/bin-apijack.integration.test.ts(settings.json reachescreateCliend to end)