Files
summercms/.planning/quick/261008-k7s-bootstrap-script-path-hint-per-shell/261008-k7s-SUMMARY.md

4.6 KiB

phase, plan, subsystem, tags, status, requires, provides, affects, tech-stack, key-files, decisions, metrics, actuals, plan_head_before, plan_head_after
phase plan subsystem tags status requires provides affects tech-stack key-files decisions metrics actuals plan_head_before plan_head_after
quick-261008-k7s 01 sunrise (bootstrap script)
bootstrap
shell
path-hint
fish
docs
complete
login-shell-aware PATH hint in modules/sunrise/new.sh
dq_escape double-quote escaping helper (POSIX and fish forms)
scripts/check-phase14.3.sh acceptance grep (unchanged, still matches the bash branch)
added patterns
Test harness pins SHELL= by default because bash fills an unset SHELL from passwd
created modified
modules/sunrise/new.sh
modules/sunrise/script_behavior_test.go
modules/sunrise/sunrise_test.go
modules/sunrise/README.md
docs/setup/installation.md
Hint form is picked by the basename of ${SHELL:-}: fish -> fish_add_path, zsh/bash -> export line naming ~/.zshrc / ~/.bashrc, anything else (empty, unset, unknown) -> byte-identical generic hint
Install dir is escaped per character (no ${//} substitution) so bash 3.2 and 5.2 patsub_replacement behave the same; fish leaves backtick and ! literal
duration completed
~20m 2026-10-08
tokens tasks commits
9000 2 1
8973da5cc1 ddf1178c51

Quick 261008-k7s Plan 01: Bootstrap script PATH hint per login shell Summary

The bootstrap script now reads the login shell from SHELL and ends with fish_add_path "<dir>" for fish, an export PATH="<dir>:$PATH" line naming ~/.zshrc or ~/.bashrc for zsh and bash, or today's exact generic hint for anything else. The directory is escaped for the target shell's double quotes.

What was done

Task 1 (tracer, TDD): per-shell hint in new.sh

  • RED: added the per-shell and metacharacter cases to TestScriptBehavior. The fish, zsh, bash and both metacharacter cases failed against the old script. The generic, unset and on-PATH cases passed, so the generic text is byte-identical.
  • GREEN: added dq_escape above main. It is a per-character loop over ${s:i:1} with a case. It always escapes \, " and $. For shells other than fish it also escapes the backtick and turns ! into "'!'". The hint block now does a case on ${SHELL:-} stripped by ##*/. The single SC2016 disable directive remains the only one in the file. The header comment notes that SHELL only picks the hint form.
  • Harness: SHELL= is placed before h.env so a per-case value wins. The new unsetShell mode runs bash -c 'unset SHELL; . "$0" "$@"'. New helpers: expectLacks, hintDir (a strings.NewReplacer with the same mapping), hint/exportHint/fishHint, expectHintSuffix and metaGobin. The case floor went from 18 to 32.
  • TestBootstrapEndToEnd drops the inherited SHELL, pins SHELL=/bin/bash and also requires (and add it to ~/.bashrc):.
  • Tracer gate: the verify command re-ran green. A manual paste test confirmed that interactive bash, with history expansion on, and fish both recover the exact directory /tmp/go bin\x"y$HOME`id`!z from the printed lines. zsh is not installed on this host. Its double-quote rules match bash for these characters, and the harness covers its output.

Task 2: docs and gates

  • sunrise README: the Overview sentence describes the per-shell hint. A new Features bullet covers the escaping and the literal $PATH. The Configuration intro notes that SHELL only picks the hint form.
  • docs/setup/installation.md: step 3 describes the per-shell hint. The manual PATH section names ~/.bashrc/~/.zshrc and adds a fish sh fence with fish_add_path (go env GOPATH)/bin.
  • Gates: go vet ./..., TestDocsTree, summer docs:build --check ("no problems found"), check-phase14.3.sh --forbidden ("forbidden-surface scan passed") and go test ./... -short -count=1 all passed. scripts/check-phase14.3.sh is unchanged and still contains export PATH="/root/go/bin:$PATH", which matches the bash branch.

Commits

  • ddf1178: feat(sunrise): print the PATH hint for the user's login shell (all five files; no co-author trailer)

Deviations from Plan

None. The plan was executed as written. The optional gated SUMMERCMS_BOOTSTRAP_CHECK=1 end-to-end run (step 4 of Task 2, not part of acceptance) was not run.

Known Stubs

None.

Self-Check: PASSED

  • FOUND: modules/sunrise/new.sh (contains fish_add_path, dq_escape; one shellcheck disable)
  • FOUND: modules/sunrise/script_behavior_test.go (contains "SHELL=")
  • FOUND: modules/sunrise/sunrise_test.go (contains SHELL=/bin/bash)
  • FOUND: modules/sunrise/README.md (contains fish_add_path)
  • FOUND: docs/setup/installation.md (contains fish_add_path (go env GOPATH)/bin)
  • FOUND: commit ddf1178