Files
gstack/scripts/resolvers/preamble/generate-continuous-checkpoint.ts
T
Garry Tan 2eac7009e9 merge: integrate origin/main (v1.1.3.0) — /checkpoint → /context-save + /context-restore rename
Main shipped v1.1.3.0 fixing Claude Code's native /checkpoint alias
shadowing gstack's skill. The old /checkpoint directory is gone,
replaced by context-save/ and context-restore/. Storage path
(~/.gstack/projects/$SLUG/checkpoints/) is unchanged, so existing
saved contexts still load.

Conflicts:
- VERSION / package.json: kept 1.2.0.0 (above main's 1.1.3.0)
- CHANGELOG: preserved 1.2.0.0 at top, inserted 1.1.3.0 below
- scripts/resolvers/preamble.ts: same pattern as prior merges —
  main's side edited the monolithic file inline; I kept the
  submodule composition root intact (main's inline changes don't
  apply to this shape)

Ported my continuous-checkpoint and context-health submodule prose
to reference the new skill names:
- generate-continuous-checkpoint.ts: "/checkpoint resume" →
  "/context-restore"
- generate-context-health.ts: "/checkpoint" → "/context-save"

Also updated user-facing prose in:
- CHANGELOG.md (1.2.0.0 entry): "/checkpoint resume" →
  "/context-restore (formerly /checkpoint resume pre-v1.1.3)"
- README.md Continuous checkpoint section: same rename

Storage paths in generate-context-recovery.ts (`$_PROJ/checkpoints/`)
left untouched — per main's v1.1.3.0 notes, the storage directory
name stays `checkpoints/` to preserve backward-compat with saved files.

Touchfiles.ts auto-merged cleanly — main's context-save-writes-file
and context-restore-loads-latest replaced my old checkpoint-save-resume
entry.

Regenerated SKILL.md files. Ship golden fixtures refreshed. 423 tests
pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 08:41:41 +08:00

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 \`/context-restore\` 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.`;
}