code-just-the-stack
Run `just` across the current Graphite stack from bottom to top, fixing failures with separate commits, restacking as you go, and submitting when green.
- License 许可
- MIT
- 所属仓库
- nseng-ai/ns
- 最近更新
- 2026-10-02
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- code-just-the-stack
- description
- Run `just` across the current Graphite stack from bottom to top, fixing failures with separate commits, restacking as you go, and submitting when green.
- allowed-tools
- [ "Bash(git status*)", "Bash(git branch*)", "Bash(gt *)", "Bash(just *)", "Bash(ns flow cp*)", "Bash(slot *)", "Read", "Edit", "Write", "Grep", "Glob" ]
- disable-model-invocation
- true
02 资源文件 1
- 参考文档agents/openai.yaml43 B
03 SKILL.md 正文
code-just-the-stack
Run the user-facing just-the-stack workflow: validate the current Graphite stack path from bottom to top with just, fix failures on the branch where they occur, create separate checkpoint-style fix commits, restack descendants as needed, and submit the stack once every branch is green.
Invocation authorizes validating, fixing, restacking, and gt submit --no-interactive for the current stack. It does not authorize guessing across sibling stacks, carrying a dirty worktree, weakening checks, or freeing other occupied slots without confirmation.
Related skills
- Use
code-graphitefor the Graphite navigation mental model. - For
justfailures, follow thecode-just-fixposture: fix root causes; never weaken checks. - For conflict-heavy or ambiguous restacks, use
code-gt-restack-resolveorcode-resolve-merge-conflicts; do not invent conflict policy here. - For separate fix commits, use
ns flow cp; do not hand-roll checkpoint commits or amend/squash unless the user explicitly asks for a different commit mode.
Workflow
For any gt navigation/restack command below: use --no-interactive; if this installed Graphite rejects the flag, retry once without it; stop if Graphite opens or requires an interactive prompt.
-
Preflight
- Run
git status --short. If it is non-empty, stop and ask the user to clean, stash, or checkpoint first. - Record the starting branch with
git branch --show-currentfor the final report. - Confirm Graphite tracking with plumbing such as
gt parent --no-interactive, or by attemptinggt bottom. If Graphite reports the branch is untracked or parentage is unknown, stop and ask the user to track or switch branches; do not rungt trackfor them. - Record the expected stack path once with
ns slot gt exec stack-branches --format json; use it to bound the step-2 branch set and to name every branch in the final report.
- Run
-
Enter the bottom of this stack path
- Run
gt bottomto switch to the branch closest to trunk in the current Graphite stack path. - The branch set is the path reached by repeated
gt upfrom this bottom branch through the Graphite top, inclusive. Do not validate sibling stacks merely because they appear ingt ls.
- Run
-
Validate each branch bottom-to-top
- Record the current branch with
git branch --show-current. - Run
just. - If
justpasses, record that branch as passed. - If
justfails, inspect the failure, edit the root cause, and rerunjustafter each fix. Stop if the fix requires a product/design choice; otherwise continue diagnosing and report any unresolved failure accurately. - When a branch required edits and now passes, run
ns flow cpon that same branch to create a separate checkpoint-style fix commit. Capture the printed commit summary. Ifns flow cprefuses because the worktree is clean, record that no commit was needed; for any other refusal, stop and report stdout/stderr.
- Record the current branch with
-
Restack after every fix commit
- After a fix commit, run
gt restack --no-interactive. - If restack fails because an in-scope branch is checked out in another slot, ask before running
ns slot gt free-stack. Only retry restack after the user authorizes slot freeing. - If restack enters a conflict/rebase state, use
code-gt-restack-resolvefrom the current state. - After restack, verify
git status --shortis clean before continuing.
- After a fix commit, run
-
Move upward
- Run
gt up --no-interactive. - If Graphite reports that you are already at the top of the stack, the loop is complete.
- If Graphite reports ambiguous children or prompts for a choice, stop and ask the user; do not guess a sibling branch.
- Run
-
Submit only after every branch is green
- After the top branch has passed, run
gt submit --no-interactive. - If submit fails because of remote divergence, branch protection, missing metadata, or a Graphite safety refusal, stop and report the exact command/output. Do not force-push, bypass checks, or change submit mode unless the user explicitly instructs you.
- After the top branch has passed, run
Final report
Report a branch-by-branch table or bullets with:
- status for each branch:
passed,fixed,committed,restacked, orblocked; - any
ns flow cpcommit summaries; - the
gt submit --no-interactiveresult and any PR updates Graphite reports; - the current branch at the end;
- unresolved blockers or user decisions needed.
04 同仓库更多 Skills
pr-make-accountable
Interview a PR author to establish shared understanding of intent and design decisions, then co-author the What / Why / Changes PR body with opt-in Requested reviewer focus.
typescript-style
Opinionated style guide for strict, portable TypeScript. Use when writing, designing, or reviewing TypeScript: type design, boundary validation, error handling, module architecture, and review discipline.
typescript-fake-driven-testing
TypeScript fake-driven testing architecture. Use when writing or reviewing TS code with external dependencies, gateway interfaces, real adapters, in-memory fakes, or CLI scenario tests.
ns-typescript
TypeScript overlay for ns-style projects. Use when editing or reviewing TS in this repo: tsconfig baseline, pnpm/Vitest/oxlint/oxfmt/native tsc commands, relative .ts imports, workspace subpath exports, and the exactOptionalPropertyTypes spread idiom. Repo-specific enforcement (test lanes, time seams, style guard) lives in the host repo's AGENTS.md.
ns-typescript-style-tripwire
Invoke the ns TypeScript style Tripwire against a supplied diff or current branch.
skill-management
Manage skills with `npx skills`: add, edit, remove, rename, update, or list skills (local or GitHub), and the nested `skills/<disposition>/.../<name>/` / flat `.agents/skills/` layout conventions.