Repository navigation
fix(command): restore nested CLI grammar for check/box-list (F-CLI-NEST) - #160
Conversation
Consumes sdk#72's ProvidedCapability.Subcommands to fix two check-charly-selftest-pod bed regressions: `charly check --help` showed a generic out-of-process placeholder instead of the real subcommand grammar, and box.list.boxes vanished from the charly __cli-model MCP reflection. WIP commit — battery + live proof pending. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; syntax check only)
# Conflicts: # charly/cli_model_cmd.go # charly/cli_model_cmd_test.go # charly/plugin_provider_common.go
Matches the sdk gitlink repoint to the merged F-CLI-NEST tip (3ea39b11c6288347800dd6fdc23cd2e861c76ca2); in-tree resolution rides the replace directive, but B2 stages the require for out-of-tree consumers. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; syntax check only)
…mer fix Name the two actual disposable-bed R10 gates (check-sidecar-pod, check-charly-vm) that proved this fix on a fresh rebuild, replacing the stale check-charly-selftest-pod bed-name reference (that bed does not exist on this tree's roster). Both beds PASS at zero warnings, confirming the fresh-rebuild binary in both a pod deploy and a from-scratch pacman VM install. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
pr-validator — APPROVED ✅Change class: Head verified: Checklist (independently re-run/re-derived, not taken from the author's word):
Architecture gate — per-item trace (staged
|
Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)
pr-validator — merge + tag outcome
Verdict: PASS → merged (squash) as Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated) |
…er-cone Merges origin/main (09172e1, PR #160 — restores nested CLI grammar for check/box-list, touching cli_model_cmd.go/main.go/main_freshness.go/ plugin_provider_common.go/provider_command_external.go/candy/plugin-box/ candy/plugin-check) into feat/w9-loader-cone. Clean auto-merge, one real conflict: charly/go.mod's sdk require version (HEAD's v0.2026200.1312 vs main's v0.2026201.542) — resolved to v0.2026201.636, matching the sdk gitlink bump below. None of #160's touched files overlap the W9 retype's surface (layers.go/unified.go/resolved_project_host.go/render_baked_metadata.go). sdk gitlink -> db63ef1 (sdk#75 merged main, tag v0.2026201.636) — the CandyReader agent/terminal-profile accessors this cutover's render_baked_metadata.go fix depends on are now landed upstream, so the previous local-only pin is replaced by the real merged+tagged commit. Verified: task build:binary (2026.201.0620, zero go.work.sum drift); charly go test ./... 114.7s green; gofmt/vet/golangci-lint clean; GOWORK=off go mod verify clean; superproject task cue:gen no-op beyond untouched submodule pointer noise; charly box validate exit 0. candy/plugin-http and candy/plugin-port fakeCC fixture failures reproduced with the identical signature (*fakeCC missing ResolveClusterContext) already tracked as pre-existing/unrelated (task #10's thematic batch) — confirmed untouched by this merge, not fixed here. Assisted-by: Claude Code (Anthropic Claude Sonnet 5; analysed on a live system)
…ft-repair Update-branch recovery after #160 landed mid-validation (09172e1, F-CLI-NEST consumer of sdk#72). Overlap with this cutover: charly/go.mod + the sdk gitlink. Resolved descendant-wins per /charly-internals:git-workflow: sdk gitlink fast-forwards to 9b29e8b (sdk#74, tag v0.2026201.603, descendant of #160's 3ea39b1) and the go.mod require stays at v0.2026201.603. Delta re-gate (non-empty overlap) follows: rebuild + go test/vet/gofmt/golangci-lint + check-builder-vm re-run. Assisted-by: Kimi Code (Moonshot K3; analysed on a live system)
…ne-local scratch paths Repo-configuration validation failed on a pristine clone of main, two build/check inputs silently depended on machine-local scratch state, and the venue builder tarball name was a concurrency hazard. Five fixes, one theme (repo tooling/config hygiene): - .agents/skills developer profile re-synced to the plugins gitlink (v2026.200.1901): committed the 292-link profile incl. the previously untracked charly-automation--agent link, so plugins/setup <kimi|codex> --check developer passes on a fresh clone. - scripts/validate-agent-config.py required terms now pin the current build:binary temp-output + atomic-promote contract (-o ../bin/.charly.next, mv bin/.charly.next bin/charly) instead of the stale -o ../bin/charly. - taskfiles/Cue.yml bootstrap-cue no longer prefers /tmp/cue-rdd/cue (an RDD-spike scratch binary that silently won over the checksum-verified pinned download); sdk/bin/cue fallback + verified download are the only sources (sdk-side residue removed in opencharly/sdk#74). - check-k3s-vm bed kv-charly-version invokes ${CHARLY_BIN} version directly (the /tmp/charly-build probe prefix was never populated on any host). - runVenueHomeArtifactBuilder's venue transfer tarball now carries the host staging dir's unique MkdirTemp suffix (venueBuilderTarName), closing the two-concurrent-same-candy-deploys collision; covered by TestVenueBuilderTarNameUniquePerScope. - sdk gitlink bumped to the merged sdk#74 squash 9b29e8b (tag v0.2026201.603; delta also carries the independently merged sdk#72 F-CLI-NEST); charly/go.mod require bumped to v0.2026201.603. Fresh pr-validator: independently re-ran the full gate (plugins/setup x3, validate-agent-config.py, gate_test.py 35/35, gofmt/go vet/go test, golangci-lint 0 issues, task build:binary + content marker, box validate, cue:gen no-op, edited bootstrap-cue live), corrected the PR's "no bed can exercise the venue naming" claim by running the matching disposable bed itself (charly check run check-builder-vm PASS steps=10/236s on the branch head), recovered the mid-validation landing of #160 via a descendant-wins update-branch merge, and re-ran the non-empty-overlap delta re-gate on the merged tree (full battery + check-builder-vm PASS steps=10/278s) — zero warnings throughout. Assisted-by: Kimi Code (Moonshot K3; fully tested and validated)
…ted file .claude/settings.json's hook wiring is GENERATED by `charly marketplace generate` (candy/plugin-marketplace/emit_hooks.go: mergeSettings drops the plugin-owned hook entries and rebuilds them from the hook entities). Deleting the block from the generated file alone left candy/charly-hooks/charly.yml still declaring `trigger: PreToolUse` on both gates, so the next regeneration would have restored the wiring — the cutover was not durable. Drop `trigger:`/`matcher:` from the pre-commit-gate and pre-push-gate hook entities, adopting the AUX form already used by gitcmd/gate-test: the scripts are still emitted to .claude/hooks/, but no PreToolUse entry is wired. .reasonix/settings.json is hand-maintained (the generator writes .claude/ only), so the other harness keeps its wiring. Verified: regeneration yields settings.json with no hooks key and is idempotent on a second run; both scripts still emitted; .reasonix PreToolUse length still 2. Also corrects the CHANGELOG, which named plugins PR #156 (an unrelated cutover) instead of #160 (merge 3fa8ed9b, this PR's gitlink target), and still claimed the docs-only class and `documentation reviewed` tier that the prior review round rejected. Assisted-by: Claude Code Anthropic Claude Opus 5 (1M context) (fully tested and validated)
Summary of changes
Consumes sdk#72 (F-CLI-NEST, merged as sdk
maincommit3ea39b11c6288347800dd6fdc23cd2e861c76ca2,tag
v0.2026201.542) to fix two pre-existingmainregressions in the out-of-process commandgrammar that were blocking two in-flight cutovers' R10 gates:
charly check --helpprinted a generic "check (out-of-process command plugin) / Arguments:[ ...]" placeholder instead of listing its real subcommands (box/live/feature/run/…).
charly __cli-model(and thereforecharly mcp serve's MCP tool generation) never saw abox.list.boxesleaf, so the MCP tool an agent needs to enumerate boxes vanished with noreplacement.
Root cause: every
class="command"capability's Kong grammar collapses to an opaque single-levelpass-through holder (
*struct{ Args []string }) — true by design since command externalizationbegan (
vm/secrets/mcp/udev/alias), but this silently regressed forcheck(candy/plugin-check) and
box'slistword (candy/plugin-box) when they moved off a static coreKong struct: both used to be real, typed subcommand trees reflected correctly into
charly __cli-modeland Kong's own--help, and lost that fidelity with no replacement.Fix (F-CLI-NEST): a
class="command"capability may now DECLARE a one-level-deep subcommandcatalog over Describe (
sdk.ProvidedCapability.Subcommands). When it does:externalCommandHolderbuilds a REAL nested Kong grammar (a namedcmd:""child per declaredentry, each still ending in its own pass-through Args leaf) instead of the flat holder.
resolveCommandDispatch(charly/provider_command_external.go, replacing the bare table lookupin
main.go) resolves the one extra path token Kong now renders back to the registered dispatchentry + the selected child's name.
buildCLIModel(charly/cli_model_cmd.go) folds declaring capabilities into the reflected CLImodel via a new
declaringCommandHoldershelper, socharly __cli-model(and MCP toolgeneration) sees a
check.live/box.list.boxesleaf per entry.change for
vm/secrets/mcp/udev/alias.candy/plugin-checkderives its catalog via the newsdk.KongSubcommands(&CheckCmd{})reflectionhelper (single source of truth:
CheckCmd's own Kong tags, never hand-duplicated).candy/plugin-boxhand-declares itslistword's catalog (boxes/candies/routes/services/targets/volumes/aliases/tags) —
dispatchListhas no real Kong struct to reflect over.Also fixed in the same cutover (blocking — this cutover's own change breaks it otherwise):
charly/main_freshness.go'sshouldRefuseUnstampedspecial-casedcheckrendering as exactly"check <args>"; F-CLI-NEST makes it render one token deeper ("check run <args>","check box <args>", …), which would have silently disabled the R9 stale-binary refusal gate forcheck run. Fixed to match on the first path token.Concrete edits:
candy/plugin-box/plugin.go— declaresboxListSubcommandson the "list" word's capability.candy/plugin-check/plugin.go— declaressdk.KongSubcommands(&CheckCmd{})on the "check" word.charly/main.go—resolveCommandDispatchreplaces the bareextCmdTable[...]lookup.charly/main_freshness.go—shouldRefuseUnstamped/checkSubcommandIsRunmatch the first pathtoken instead of an exact
"check <args>"compare.charly/plugin_provider_common.go—capMeta.subcmds+declaredSubcommands()carrier method.charly/provider_command_external.go— the nested-holder shape (nestedSubcommandType),commandSubcommandCarrier,resolveCommandDispatch, thedispatchCommand/dispatchInProcCommand/dispatchExternalCommand/externalCommandArgs/externalCommandExecPlansignature threading ofthe resolved subcommand name.
charly/cli_model_cmd.go—declaringCommandHoldersfolds declaring capabilities' holders intothe reflected CLI model built by
sdk.BuildCLIModel(this call itself came frommain'sconcurrent sdk#73 CommandModel/CUE-generated-protocol cutover — merged in, see below).
charly/cli_model_cmd_test.go,charly/main_stamped_test.go,charly/provider_command_external_test.go,charly/provider_command_test.go.sdkgitlink →3ea39b11c6288347800dd6fdc23cd2e861c76ca2(tagv0.2026201.542);charly/go.modrequire bumped to match (in-tree resolution rides thereplacedirective; therequire is staged for out-of-tree consumers per B2).
CHANGELOG/2026.198.2144.md— placeholder CalVer entry (pr-validator finalizes the merge-timeversion).
Merge conflict note (this branch was rebased onto
mainaftermaingained the federatedcontrol-plane cutover,
56b1a6b, which independently added sdk#73's CommandModel/CUE-generatedprotocol pipeline touching the SAME 3 files):
charly/plugin_provider_common.go—capMetastruct field-list conflict. Kept BOTH: thiscutover's
subcmds []sdk.CLISubcommand(proto field 12) andmain'scommandModel *spec.CLIModel/commandModelJSON []byte(proto field 13). The rest ofbuildCapMeta/liftCapabilitiesmerged automatically (disjoint code regions).charly/cli_model_cmd.go—mainrewrotebuildCLIModelto call the newsdk.BuildCLIModel(&modelCLI, "charly", CharlyVersion(), "")(the kong-reflection walk —kongLeafToModelLeaf/kongValueToArg/leafPath/etc — relocated wholesale intosdk, R3,alongside the CommandModel work). Resolved by keeping
main'ssdk.BuildCLIModelcall andfolding this cutover's
declaringCommandHoldersoutput intomodelCLI.Plugins/modelCLI.Box.Pluginsbefore that call; the now-dead local kong-reflection helpers were dropped(confirmed unreferenced elsewhere by
go build ./...succeeding);declaringCommandHoldersitself was kept (main has no equivalent).
charly/cli_model_cmd_test.go— two independent new tests (this cutover'sTestBuildCLIModel_CheckAndBoxList;main'sTestCLIModel_CoversAgentControlPlane) — keptboth, no overlap.
TestBuildCLIModel_CheckAndBoxList+TestCLIModel_CoversAgentControlPlane+TestCommandProviders_ExtractedReachMCPall passingtogether (pasted below).
Change class
charly-or-sdk Go (cross-repo:
sdklands first per B2 — already merged as3ea39b1/v0.2026201.542before this PR was opened; this PR is the charly consumer leg only).How R10-tested — exact gate, commands, and pasted output
bed roster whose kind matches the touched code path, run by the persistent orchestrator session
against a fresh rebuild of this branch.
check-sidecar-pod | pod | ok | 12 steps | 486s— image-build/check-image/deploy-add/config/start/check-live/feature-run/update/feature-run-rebuild/cleanup all PASS. Every
charlyinvocation in the run drives the reworked grammar construction + status/deploy dispatch.
check-charly-vm | vm | ok | 8 steps | 312s— vm-build/vm-create/deploy-add/check-live/update(152s fresh rebuild)/cleanup all PASS. The worktree-built
opencharly-gitwaspacman-installed in a disposable Arch VM and
charly versionran in-guest — a fresh-installproof of the new binary, not just a compile.
charly version= 2026.201.0600at the time of my local proof below; the beds' own fresh rebuild re-derives the stamp from
their own build moment — see each bed's
.check/<bed>/<calver>/summary.yml).task build:binarysucceeded with zerogo.work.sumdrift;charly version→
2026.201.0600; both eval beds above additionally rebuilt fresh as part of their ownupdatestep (the VM bed's rebuild alone took 152s).
--help,real
__cli-modelleaves, real dispatch through the nested holder forbox list boxes/check list) AND the freshness-guard scoping edge (check box <missing-image>still reaches thereal error path, unaffected by the fix) executed live, pasted below.
podman store, resource arbiter, VM/pod lifecycle, or a build lock; it only changes Kong grammar
construction + CLI-model reflection, both process-local and side-effect-free.
Attribution tier
fully tested and validated— both disposable eval beds PASS at zero warnings against a freshrebuild (one a pod deploy, one a from-scratch pacman VM install of the built package), and every
new/changed code path (the nested holder construction,
resolveCommandDispatch, the CLI-modelfold, the freshness-guard scoping fix) executed live against the fresh binary, pasted above.
Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)Harness rulebook compliance
/charly-internals:git-workflow(the WIP-landing sequence + B1/B2 flow)and
/charly-internals:go(source map, sdk generation pipeline, module-verification-by-class)before touching any code or committing.
pkg/archpkgverbump were root-caused before resolving (see conflict note above); full battery(build/test/vet/lint/cue:gen) is at zero warnings, pasted above.
plugin-http/plugin-portfakeCCtest-build failures arepre-existing, same signature, unrelated to this diff (confirmed via standalone
go test), andare already tracked as their own thematic-batch task — not folded into this cutover, not silently
ignored either.
candy/plugin-check's catalog is DERIVED viasdk.KongSubcommandsfromCheckCmd's own Kong tags (never hand-duplicated); the nested-holder-vs-flat-holder logic is oneshared code path (
externalCommandHolder) branching on whether subcommands were declared, not aparallel implementation.
resolveCommandDispatchtwo-step lookup (try full path, then drop the last token) is adocumented, tested algorithm, not an ad-hoc string hack.
touched-function signatures gained a parameter rather than being renamed/removed); the merge
absorbed
main's own unrelated relocation of the kong-reflection helpers intosdk, confirmedcomplete by
go build ./...succeeding (no dangling reference). No transitional/dual-mode pathin the final code.
git status+ inspected submodule diffs before every submodule sync(
pkg/arch,plugins,box/cachyos) and before discarding the stray uncommittedpkg/archpkgverbump (confirmed it was a trivial build byproduct, not in-progress work, beforediscarding).
go test.labels.
task build:binaryrebuilt from this source;charly versionmatches; the VM bed additionally proves a fresh
pacman -Uinstall of the built package worksend-to-end. No new runtime OS dependency introduced.
disposable: truetargets, fresh rebuild, zerowarnings; new test coverage (
TestBuildCLIModel_CheckAndBoxList,TestExternalCommandHolder_DeclaredSubcommands, plus updatedTestCommandProviders_ExtractedReachMCP/TestShouldRefuseUnstamped) would FAIL on pre-fix code(the old assertion literally required
check.boxto be ABSENT — the exact regression this fixes).kong.New) caught a latent Kong tag-vs-name bugbefore shipping (documented in the CHANGELOG); the composition-at-latest-versions risk (this
leg's Go code against
main's concurrently-landed sdk#73 CommandModel work) was proven by thelive coexistence test run above, not a doc read. ADE: N/A (no candy
plan:/description:touched). SDD: N/A (no
.cueschema touched by this leg; sdk#72's own schema change landed andwas proven in its own PR).
finalize) that will squash to one atomic commit on
main; no Phase-2/TODO/deferred work left inthis leg's scope.
core/plugin boundary crossed) — this changes only the HOST-SIDE generic Kong-grammar-construction
PRESENCE, never by a specific command word), consulting each plugin's DECLARED catalog (clause D:
sdk.ProvidedCapability.Subcommands) rather than hardcoding per-command knowledge.disposable: truetargets only.gofmt -lempty,golangci-lint run= 0 issues,go vetclean,
go test ./...green (all pasted above).CHANGELOG/2026.198.2144.mdstaged (placeholder CalVer; pr-validator finalizesthe merge-time version).
Assisted-by: Claude Code (Anthropic Claude Sonnet 5; fully tested and validated)