mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-07 22:16:52 +02:00
0926e4b994
Splits scripts/resolvers/preamble.ts (841 lines, 18 generator functions + composition root) into one file per generator under scripts/resolvers/preamble/. Root preamble.ts becomes a thin composition layer (~80 lines of imports + generatePreamble). Before: scripts/resolvers/preamble.ts 841 lines After: scripts/resolvers/preamble.ts 83 lines scripts/resolvers/preamble/generate-preamble-bash.ts 97 lines scripts/resolvers/preamble/generate-upgrade-check.ts 48 lines scripts/resolvers/preamble/generate-lake-intro.ts 16 lines scripts/resolvers/preamble/generate-telemetry-prompt.ts 37 lines scripts/resolvers/preamble/generate-proactive-prompt.ts 25 lines scripts/resolvers/preamble/generate-routing-injection.ts 49 lines scripts/resolvers/preamble/generate-vendoring-deprecation.ts 36 lines scripts/resolvers/preamble/generate-spawned-session-check.ts 11 lines scripts/resolvers/preamble/generate-ask-user-format.ts 16 lines scripts/resolvers/preamble/generate-completeness-section.ts 19 lines scripts/resolvers/preamble/generate-repo-mode-section.ts 12 lines scripts/resolvers/preamble/generate-test-failure-triage.ts 108 lines scripts/resolvers/preamble/generate-search-before-building.ts 14 lines scripts/resolvers/preamble/generate-completion-status.ts 161 lines scripts/resolvers/preamble/generate-voice-directive.ts 60 lines scripts/resolvers/preamble/generate-context-recovery.ts 51 lines scripts/resolvers/preamble/generate-continuous-checkpoint.ts 48 lines scripts/resolvers/preamble/generate-context-health.ts 31 lines Byte-identity verification (the real gate per Codex correction): - Before refactor: snapshotted 135 generated SKILL.md files via `find -name SKILL.md -type f | grep -v /gstack/` across all hosts. - After refactor: regenerated with `bun run gen:skill-docs --host all` and re-snapshotted. - `diff -r baseline after` returned zero differences and exit 0. The `--host all --dry-run` gate passes too. No template or host behavior changes — purely a code-organization refactor. Test fix: audit-compliance.test.ts's telemetry check previously grepped preamble.ts directly for `_TEL != "off"`. After the refactor that logic lives in preamble/generate-preamble-bash.ts. Test now concatenates all preamble submodule sources before asserting — tracks the semantic contract, not the file layout. Doing the minimum rewrite preserves the test's intent (conditional telemetry) without coupling it to file boundaries. Why now: we were in-session with full context. Codex had downgraded this from mandatory to optional, but the preamble had grown to 841 lines and was getting harder to navigate. User asked "why not?" given the context was hot. Shipping it as a clean bisectable commit while all the prior preamble.ts changes are fresh reduces rebase pain later. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
49 lines
2.0 KiB
TypeScript
49 lines
2.0 KiB
TypeScript
|
|
|
|
export function generateContinuousCheckpoint(): string {
|
|
return `## Continuous Checkpoint Mode
|
|
|
|
If \`CHECKPOINT_MODE\` is \`"continuous"\` (from preamble output): auto-commit work as
|
|
you go with \`WIP:\` prefix so session state survives crashes and context switches.
|
|
|
|
**When to commit (continuous mode only):**
|
|
- After creating a new file (not scratch/temp files)
|
|
- After finishing a function/component/module
|
|
- After fixing a bug that's verified by a passing test
|
|
- Before any long-running operation (install, full build, full test suite)
|
|
|
|
**Commit format** — include structured context in the body:
|
|
|
|
\`\`\`
|
|
WIP: <concise description of what changed>
|
|
|
|
[gstack-context]
|
|
Decisions: <key choices made this step>
|
|
Remaining: <what's left in the logical unit>
|
|
Tried: <failed approaches worth recording> (omit if none)
|
|
Skill: </skill-name-if-running>
|
|
[/gstack-context]
|
|
\`\`\`
|
|
|
|
**Rules:**
|
|
- Stage only files you intentionally changed. NEVER \`git add -A\` in continuous mode.
|
|
- Do NOT commit with known-broken tests. Fix first, then commit. The [gstack-context]
|
|
example values MUST reflect a clean state.
|
|
- Do NOT commit mid-edit. Finish the logical unit.
|
|
- Push ONLY if \`CHECKPOINT_PUSH\` is \`"true"\` (default is false). Pushing WIP commits
|
|
to a shared remote can trigger CI, deploys, and expose secrets — that is why push
|
|
is opt-in, not default.
|
|
- Background discipline — do NOT announce each commit to the user. They can see
|
|
\`git log\` whenever they want.
|
|
|
|
**When \`/checkpoint resume\` runs,** it parses \`[gstack-context]\` blocks from WIP
|
|
commits on the current branch to reconstruct session state. When \`/ship\` runs, it
|
|
filter-squashes WIP commits only (preserving non-WIP commits) via
|
|
\`git rebase --autosquash\` so the PR contains clean bisectable commits.
|
|
|
|
If \`CHECKPOINT_MODE\` is \`"explicit"\` (the default): no auto-commit behavior. Commit
|
|
only when the user explicitly asks, or when a skill workflow (like /ship) runs a
|
|
commit step. Ignore this section entirely.`;
|
|
}
|
|
|