Repository navigation
Phase P0: moved-command table and --apply helper - #2316
Merged
neuromechanist merged 7 commits intoNov 22, 2026
Merged
neuromechanist merged 7 commits into
neuromechanist merged 7 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2316Version: 🤖 Updated on each push. |
neuromechanist
merged commit Nov 22, 2026
2c72ccc
into
feature/issue-2307-epic-admin-tree
45 of 53 checks passed
This was referenced Nov 22, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scaffolding for the admin command tree restructure (ADR 0135). No command path changes.
src/lib/moved-commands.ts: one table,MOVED_COMMANDS: { oldPath, newPath }[], andregisterMovedCommands(root, rows), which registers each old path as a hidden stub (helpOption(false),allowUnknownOption,allowExcessArguments) that prints one stderr line naming the new path, callsmarkReportedExit()and exits 1. The three ADR 0125 stubs (publish,withdraw,restore) move into the table with their wording unchanged. Later phases append rows only.fleet annex-policywhilefleetstays) register a leaf stub under that group; old paths under a gone group (s3 lockonces3dissolves) share one stub on the gone group, which picks the longest matching row. Registration throws on an old path that is still a live command, a duplicate row, or a gone group with no row of its own.exitIfMovedCommand(program, argv)runs insrc/index.tsright after the tree is built and before the update check, the notices hook and Commander's parse, so a stub wins over the root's-v/--version, prints no update banner and makes no request; before this, the three stubs fetched/noticesbefore failing. The rootpreActionhook also skips/noticesfor a stub (isMovedCommandStub) as a second line.--helpwith its pointer and exit 1 instead of printing an empty help page with exit 0 (the plan's P4 analysis already assumed exit 1).src/lib/apply-flag.ts:addApplyOption(cmd, description, aliases)declares--applyplus hidden--execute,--writeor--fixaliases that setapplyand remove their own key. No command is converted yet.Closes #2308
Part of epic #2307
Test plan
bun run lintandbun run typecheckcleantest/moved-commands.unit.test.ts(61, pure tier: the stand-in is set as the account's storedapiUrl): every table row spawned throughbun run src/index.tswith seven argument shapes (bare, a real call with--execute --yes,--help, junk options,--version 2.0.0,-v,--debug) exits 1, prints exactly the one pointer line, prints nothing on stdout, and sends no request to aBun.servestand-in that records every request (isolatedNEMAR_CONFIG_DIRwith an admin key); each new path answers--helpwith exit 0; nested and gone-group rows checked through a fixture tree with the same root options, and a walk of that tree proving every stub it registers is recognized as one; an outdated CLI (seeded update cache, with a control showing the banner on a live command) still prints only the pointer; the three refusal cases ofregisterMovedCommandstest/apply-flag.unit.test.ts(8): every spelling setsopts.apply, aliases are absent from help and leave no key, an undeclared alias stays an unknown optiontest/admin-restructure.test.tsandtest/help-tiers.unit.test.tspass (99 tests across the four files)/noticesskip fails 12 tests onGET /notices; revertedexitIfMovedCommandcall fails 7 tests (every--version 2.0.0and-vshape, and the banner test); revertedadmin help <old path>gets the pointer for every row and in the fixture tree;admin users show publish,admin approve publish,admin repo publish --helpandadmin users show --query publishreach the live command or Commander's own error, never a pointeradminor a group with a stub child takes a value (the walk skips option tokens only); adding--profile <name>to the root and--as <user>toadminfails both guard tests with the explanatory message; revertedhelpstep fails 7 tests; restoring the old undefined-valued alias key fails 3 apply-flag tests; revertedbun testnot run (runs at epic to dev)