Recommend /cdd-pre-pr after retrofit (#40), and fix cdd-state/cdd-worktree in non-interactive shells#42
Merged
Conversation
…40) Retrofit writes touch CDD-managed files and doc skeletons and can leave docs inconsistent (e.g. a new skeleton doc shipped with unfilled placeholders). Name /cdd-pre-pr as the recommended step, run from a fresh session in the retrofit worktree, between reviewing the branch and opening the PR — in both install and upgrade mode. Process doc §6 isolation paragraph gets the recommendation; cdd-retrofit.md §3.4 (install next-steps) and §5 (shared summary) name the step in their printed next-steps. Docs/command text only — no roadmap, template, script, or CI change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…shells The self-installing helpers only wired a `source` line into ~/.bashrc, which a stock rc skips for non-interactive shells via its `case $- in *i*` guard. Claude Code's Bash tool is non-interactive, so `cdd-state set …` from the slash commands was silently no-oping in every session — the state record never advanced past what a human ran by hand. Both installers now also drop thin PATH shims into ~/.local/bin (one per public command) that source the helper and dispatch, so the commands resolve in any shell. Interactive shells still prefer the sourced function (functions shadow PATH), preserving cdd-worktree's caller-cwd change. Re-running install is idempotent and regenerates the shims (newest wins). Process-first consistency: process doc §2.8 (worktree install) and §2.13 (cdd-state) plus template/BOOTSTRAP.md now document the shim and why it is load-bearing for the non-interactive case. No template copy of the helpers exists, so this is a single-source change. All CI checks pass (install/resume smoke, prompt-seam, command-drift). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pre-PR reconciliation for the PATH-shim change: - Extend install-smoke-assert.sh to assert the cdd-worktree* and cdd-state shims are written to ~/.local/bin, executable, and resolve+dispatch under a non-interactive PATH-only shell (the case the shims exist for). Satisfies the enforced "tested behaviour" practice for new script behaviour. - Add tools/cdd-state.sh to CI's bash -n and shellcheck sets (it was modified by this branch but not linted in CI), with a scoped SC2016 disable on the intentional single-quoted jq filter. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Started as #40 — make
/cdd-pre-pra recommended step in the retrofit flow, run in the retrofit worktree before opening its PR, so the retrofit's own edits (CDD-managed files, doc skeletons with unfilled placeholders) get the standard reconciliation + review pass.Running that pre-PR pass on this very branch then surfaced a real defect, so the scope was extended to fix it: the shared
cdd-worktreeandcdd-statehelpers didn't resolve in non-interactive shells — the case that matters for Claude Code's Bash tool, where the slash commands runcdd-state set …. A stock~/.bashrcreturns early for non-interactive shells (case $- in *i*), so the marker-guardedsourceline the installer adds never fires there and the functions are undefined — every state write silently no-oped. The fix drops thin PATH shims into~/.local/bin(one per command); interactive shells still prefer the sourced function (functions shadow PATH), which preservescdd-worktree's ability tocdthe caller into the new worktree.Changes
#40 — recommend
/cdd-pre-prafter retrofit.claude/commands/cdd-retrofit.md§3.4 + §5, process doc §6: name/cdd-pre-pras the recommended step, run from a fresh session in the retrofit worktree, between "review the branch" and "open the PR" — both install and upgrade mode. Docs/command text only.Extension — non-interactive shim fix
tools/cdd-worktree.sh,tools/cdd-state.sh: install step now writes executable PATH shims to~/.local/bin, warns (doesn't mutate) when that dir isn't on PATH, regenerates idempotently.doc/knowledge_base/claude-driven-development.md§2.8/§2.13,template/BOOTSTRAP.md: document the shim mechanism and why it is load-bearing for non-interactivecdd-state set.Pre-PR reconciliation (this session)
scripts/install-smoke-assert.shto assert both helpers' shims are written, executable, and resolve+dispatch under a non-interactive PATH-only shell — satisfying the enforced "tested behaviour" practice for new script behaviour. Previouslycdd-state installhad no smoke coverage at all.tools/cdd-state.shto CI'sbash -nandshellchecksets (it was modified here but not linted in CI), with a scopedSC2016disable on the intentional single-quoted jq filter.Verification
All CDD gates green: shellcheck, command-drift, prompt-seam, install-smoke (with new shim assertions), worktree-resume, end-to-end template smoke, demo seed-overlay. The fix was also confirmed live —
cdd-state set checks_passedresolved and ran from Claude Code's non-interactive Bash tool during this pre-PR session.Closes #40
🤖 Generated with Claude Code