fix(output): make ref pins shell-literal for agent allow-rules

Merged
TH
17h ago
+711-305

Summary

A ref pin this CLI prints is text an agent pastes straight into a shell command, and hosts such as Codex gate those commands with allow-rules whose matchers refuse an unquoted word holding a shell metacharacter. ~ is one, and an EXTENDED_GLOB hazard in zsh. A refused match runs the pasted command in a sandbox that cannot reach the daemon or the device.

The pin is now a plain literal word: @e4-s434592. REF_PIN_SEPARATOR, formatPinnedRef, splitRefGenerationSuffix and splitRecordedRefGenerationSuffix in packages/kernel/src/snapshot.ts own the form; every producer routes through them. The retired ~s spelling is accepted as input only where saved replay scripts and recorded refs are read; live CLI input rejects it. Help text, the skill, website docs, ADR 0014 (amended in place) and CONTEXT.md use the new spelling.

Scope expansion: two readers that split the pin by hand now use the kernel reader, so a token that is only a marker yields no ref body.

Before / after

formatPinnedRef('@e4', 434592) — base @e4~s434592, head @e4-s434592.
splitRefGenerationSuffix('@e4~s3') — base { base: '@e4', generation: 3 }, head null.
splitRecordedRefGenerationSuffix('@e4~s3') — head unchanged from base, so pre-change .ad scripts still replay.

Validation

Head 389c116f86. pnpm install --frozen-lockfile && pnpm build, typecheck, format, lint and check:replay-compat pass. Full vitest --project unit-core: 2144 files, 20975 tests pass. The eager-closure budget test passes: the CLI facade closure stays at 19 modules. No device lane needed — no dispatch, capture or native-execution change.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.