Context
The default-run bash script lives as a Go string literal (defaultScriptTmpl in cmd/ccsession/main.go, near the bottom of the file at ~line 520-548). As a string literal it cannot be shellchecked, its shell-quoting hazards are documented in scattered Go comments, and it bloats the CLI wiring file.
Task
- Move the script body verbatim into
cmd/ccsession/script.sh and load it with:
//go:embed script.sh
var defaultScriptTmpl string
- Keep the
__CCS_BIND_*__ token-replacement mechanism in buildScript unchanged — the safety model (only config-validated key names are substituted; see internal/config) must not change.
- Move the shell-quoting/injection commentary to the top of
script.sh as shell comments so it lives with the code it protects.
- Verify tests that assert on script content (
grep -rn defaultScriptTmpl cmd/ and check main_test.go) still pass; adjust only import/whitespace-level breakage.
- Optional but preferred: run
shellcheck on a rendered copy (tokens substituted with dummy values) locally and note the result in the PR. Do not add shellcheck to CI in this issue.
Acceptance criteria
go build ./cmd/ccsession produces a binary whose no-arg run behaves identically (manually smoke-test the picker launches and all three modes switch).
- Script bytes are identical pre/post except for relocated comments (compare
buildScript output in a test).
go test ./... passes.
Context
The default-run bash script lives as a Go string literal (
defaultScriptTmplincmd/ccsession/main.go, near the bottom of the file at ~line 520-548). As a string literal it cannot be shellchecked, its shell-quoting hazards are documented in scattered Go comments, and it bloats the CLI wiring file.Task
cmd/ccsession/script.shand load it with:__CCS_BIND_*__token-replacement mechanism inbuildScriptunchanged — the safety model (only config-validated key names are substituted; seeinternal/config) must not change.script.shas shell comments so it lives with the code it protects.grep -rn defaultScriptTmpl cmd/and checkmain_test.go) still pass; adjust only import/whitespace-level breakage.shellcheckon a rendered copy (tokens substituted with dummy values) locally and note the result in the PR. Do not add shellcheck to CI in this issue.Acceptance criteria
go build ./cmd/ccsessionproduces a binary whose no-arg run behaves identically (manually smoke-test the picker launches and all three modes switch).buildScriptoutput in a test).go test ./...passes.