gsd-antigravity-kit 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/skills/gsd/SKILL.md +26 -4
- package/.agent/skills/gsd/VERSION +1 -1
- package/.agent/skills/gsd/assets/templates/AI-SPEC.md +246 -0
- package/.agent/skills/gsd/assets/templates/DEBUG.md +7 -2
- package/.agent/skills/gsd/assets/templates/config.json +56 -48
- package/.agent/skills/gsd/assets/templates/research.md +40 -0
- package/.agent/skills/gsd/assets/templates/spec.md +307 -0
- package/.agent/skills/gsd/assets/templates/state.md +8 -0
- package/.agent/skills/gsd/bin/gsd-tools.cjs +212 -11
- package/.agent/skills/gsd/bin/help-manifest.json +8 -2
- package/.agent/skills/gsd/bin/hooks/gsd-check-update-worker.js +108 -0
- package/.agent/skills/gsd/bin/hooks/gsd-check-update.js +14 -89
- package/.agent/skills/gsd/bin/hooks/gsd-context-monitor.js +34 -5
- package/.agent/skills/gsd/bin/hooks/gsd-phase-boundary.sh +1 -0
- package/.agent/skills/gsd/bin/hooks/gsd-prompt-guard.js +1 -1
- package/.agent/skills/gsd/bin/hooks/gsd-read-guard.js +6 -1
- package/.agent/skills/gsd/bin/hooks/gsd-session-state.sh +1 -0
- package/.agent/skills/gsd/bin/hooks/gsd-statusline.js +150 -16
- package/.agent/skills/gsd/bin/hooks/gsd-validate-commit.sh +1 -0
- package/.agent/skills/gsd/bin/hooks/gsd-workflow-guard.js +1 -1
- package/.agent/skills/gsd/bin/lib/audit.cjs +757 -0
- package/.agent/skills/gsd/bin/lib/commands.cjs +17 -7
- package/.agent/skills/gsd/bin/lib/config.cjs +66 -20
- package/.agent/skills/gsd/bin/lib/core.cjs +212 -12
- package/.agent/skills/gsd/bin/lib/frontmatter.cjs +6 -8
- package/.agent/skills/gsd/bin/lib/graphify.cjs +494 -0
- package/.agent/skills/gsd/bin/lib/gsd2-import.cjs +511 -0
- package/.agent/skills/gsd/bin/lib/init.cjs +371 -18
- package/.agent/skills/gsd/bin/lib/intel.cjs +9 -30
- package/.agent/skills/gsd/bin/lib/milestone.cjs +18 -17
- package/.agent/skills/gsd/bin/lib/model-profiles.cjs +1 -0
- package/.agent/skills/gsd/bin/lib/phase.cjs +225 -98
- package/.agent/skills/gsd/bin/lib/profile-output.cjs +17 -5
- package/.agent/skills/gsd/bin/lib/roadmap.cjs +12 -5
- package/.agent/skills/gsd/bin/lib/state.cjs +394 -129
- package/.agent/skills/gsd/bin/lib/template.cjs +8 -4
- package/.agent/skills/gsd/bin/lib/uat.cjs +2 -1
- package/.agent/skills/gsd/bin/lib/verify.cjs +111 -42
- package/.agent/skills/gsd/migration_report.md +2 -2
- package/.agent/skills/gsd/references/agents/gsd-advisor-researcher.md +23 -0
- package/.agent/skills/gsd/references/agents/gsd-ai-researcher.md +133 -0
- package/.agent/skills/gsd/references/agents/gsd-code-fixer.md +11 -10
- package/.agent/skills/gsd/references/agents/gsd-code-reviewer.md +2 -2
- package/.agent/skills/gsd/references/agents/gsd-codebase-mapper.md +13 -2
- package/.agent/skills/gsd/references/agents/gsd-debug-session-manager.md +314 -0
- package/.agent/skills/gsd/references/agents/gsd-debugger.md +147 -76
- package/.agent/skills/gsd/references/agents/gsd-doc-verifier.md +1 -1
- package/.agent/skills/gsd/references/agents/gsd-doc-writer.md +615 -602
- package/.agent/skills/gsd/references/agents/gsd-domain-researcher.md +153 -0
- package/.agent/skills/gsd/references/agents/gsd-eval-auditor.md +175 -0
- package/.agent/skills/gsd/references/agents/gsd-eval-planner.md +154 -0
- package/.agent/skills/gsd/references/agents/gsd-executor.md +108 -38
- package/.agent/skills/gsd/references/agents/gsd-framework-selector.md +160 -0
- package/.agent/skills/gsd/references/agents/gsd-integration-checker.md +454 -443
- package/.agent/skills/gsd/references/agents/gsd-intel-updater.md +40 -20
- package/.agent/skills/gsd/references/agents/gsd-nyquist-auditor.md +187 -176
- package/.agent/skills/gsd/references/agents/gsd-pattern-mapper.md +335 -0
- package/.agent/skills/gsd/references/agents/gsd-phase-researcher.md +112 -13
- package/.agent/skills/gsd/references/agents/gsd-plan-checker.md +104 -10
- package/.agent/skills/gsd/references/agents/gsd-planner.md +125 -167
- package/.agent/skills/gsd/references/agents/gsd-project-researcher.md +25 -2
- package/.agent/skills/gsd/references/agents/gsd-research-synthesizer.md +3 -3
- package/.agent/skills/gsd/references/agents/gsd-roadmapper.md +12 -1
- package/.agent/skills/gsd/references/agents/gsd-security-auditor.md +139 -128
- package/.agent/skills/gsd/references/agents/gsd-ui-auditor.md +3 -3
- package/.agent/skills/gsd/references/agents/gsd-ui-checker.md +11 -2
- package/.agent/skills/gsd/references/agents/gsd-ui-researcher.md +27 -4
- package/.agent/skills/gsd/references/agents/gsd-verifier.md +13 -19
- package/.agent/skills/gsd/references/commands/atomic/add-todo.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/check-todos.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/cleanup.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/do.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/help.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/join-discord.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/note.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/session-report.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/ship.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/stats.md +2 -2
- package/.agent/skills/gsd/references/commands/atomic/thread.md +141 -41
- package/.agent/skills/gsd/references/commands/atomic/undo.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/add-backlog.md +15 -12
- package/.agent/skills/gsd/references/commands/milestone/audit-milestone.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/complete-milestone.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/milestone-summary.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/new-milestone.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/plan-milestone-gaps.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/plant-seed.md +2 -2
- package/.agent/skills/gsd/references/commands/milestone/review-backlog.md +4 -4
- package/.agent/skills/gsd/references/commands/misc/ai-integration-phase.md +38 -0
- package/.agent/skills/gsd/references/commands/misc/audit-fix.md +2 -2
- package/.agent/skills/gsd/references/commands/misc/audit-uat.md +2 -2
- package/.agent/skills/gsd/references/commands/misc/eval-review.md +34 -0
- package/.agent/skills/gsd/references/commands/misc/extract_learnings.md +24 -0
- package/.agent/skills/gsd/references/commands/misc/from-gsd2.md +49 -0
- package/.agent/skills/gsd/references/commands/misc/graphify.md +203 -0
- package/.agent/skills/gsd/references/commands/misc/inbox.md +40 -0
- package/.agent/skills/gsd/references/commands/misc/next.md +5 -3
- package/.agent/skills/gsd/references/commands/misc/progress.md +4 -3
- package/.agent/skills/gsd/references/commands/misc/sketch-wrap-up.md +33 -0
- package/.agent/skills/gsd/references/commands/misc/sketch.md +47 -0
- package/.agent/skills/gsd/references/commands/misc/spec-phase.md +64 -0
- package/.agent/skills/gsd/references/commands/misc/spike-wrap-up.md +33 -0
- package/.agent/skills/gsd/references/commands/misc/spike.md +43 -0
- package/.agent/skills/gsd/references/commands/misc/verify-work.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/add-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/add-tests.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/discuss-phase.md +5 -5
- package/.agent/skills/gsd/references/commands/phase/execute-phase.md +4 -4
- package/.agent/skills/gsd/references/commands/phase/insert-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/list-phase-assumptions.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/plan-phase.md +3 -3
- package/.agent/skills/gsd/references/commands/phase/remove-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/research-phase.md +5 -5
- package/.agent/skills/gsd/references/commands/phase/secure-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/ui-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/ui-review.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/validate-phase.md +2 -2
- package/.agent/skills/gsd/references/commands/phase/workstreams.md +9 -9
- package/.agent/skills/gsd/references/commands/project/analyze-dependencies.md +2 -2
- package/.agent/skills/gsd/references/commands/project/explore.md +2 -2
- package/.agent/skills/gsd/references/commands/project/import.md +2 -2
- package/.agent/skills/gsd/references/commands/project/intel.md +10 -10
- package/.agent/skills/gsd/references/commands/project/list-workspaces.md +2 -2
- package/.agent/skills/gsd/references/commands/project/map-codebase.md +2 -2
- package/.agent/skills/gsd/references/commands/project/new-project.md +2 -2
- package/.agent/skills/gsd/references/commands/project/new-workspace.md +2 -2
- package/.agent/skills/gsd/references/commands/project/remove-workspace.md +2 -2
- package/.agent/skills/gsd/references/commands/project/scan.md +2 -2
- package/.agent/skills/gsd/references/commands/system/autonomous.md +4 -3
- package/.agent/skills/gsd/references/commands/system/code-review-fix.md +3 -3
- package/.agent/skills/gsd/references/commands/system/code-review.md +3 -3
- package/.agent/skills/gsd/references/commands/system/debug.md +177 -100
- package/.agent/skills/gsd/references/commands/system/docs-update.md +2 -2
- package/.agent/skills/gsd/references/commands/system/fast.md +2 -2
- package/.agent/skills/gsd/references/commands/system/forensics.md +2 -2
- package/.agent/skills/gsd/references/commands/system/gsd-tools.md +153 -6
- package/.agent/skills/gsd/references/commands/system/health.md +2 -2
- package/.agent/skills/gsd/references/commands/system/manager.md +3 -3
- package/.agent/skills/gsd/references/commands/system/pause-work.md +2 -2
- package/.agent/skills/gsd/references/commands/system/pr-branch.md +2 -2
- package/.agent/skills/gsd/references/commands/system/profile-user.md +2 -2
- package/.agent/skills/gsd/references/commands/system/quick.md +127 -3
- package/.agent/skills/gsd/references/commands/system/reapply-patches.md +45 -6
- package/.agent/skills/gsd/references/commands/system/resume-work.md +2 -2
- package/.agent/skills/gsd/references/commands/system/review.md +6 -4
- package/.agent/skills/gsd/references/commands/system/set-profile.md +3 -3
- package/.agent/skills/gsd/references/commands/system/settings.md +2 -2
- package/.agent/skills/gsd/references/commands/system/update.md +2 -2
- package/.agent/skills/gsd/references/docs/ai-evals.md +156 -0
- package/.agent/skills/gsd/references/docs/ai-frameworks.md +186 -0
- package/.agent/skills/gsd/references/docs/artifact-types.md +18 -0
- package/.agent/skills/gsd/references/docs/autonomous-smart-discuss.md +277 -0
- package/.agent/skills/gsd/references/docs/checkpoints.md +30 -0
- package/.agent/skills/gsd/references/docs/common-bug-patterns.md +49 -49
- package/.agent/skills/gsd/references/docs/continuation-format.md +11 -7
- package/.agent/skills/gsd/references/docs/debugger-philosophy.md +76 -0
- package/.agent/skills/gsd/references/docs/decimal-phase-calculation.md +64 -64
- package/.agent/skills/gsd/references/docs/executor-examples.md +110 -0
- package/.agent/skills/gsd/references/docs/git-integration.md +4 -4
- package/.agent/skills/gsd/references/docs/git-planning-commit.md +40 -38
- package/.agent/skills/gsd/references/docs/ios-scaffold.md +123 -0
- package/.agent/skills/gsd/references/docs/mandatory-initial-read.md +2 -0
- package/.agent/skills/gsd/references/docs/phase-argument-parsing.md +61 -61
- package/.agent/skills/gsd/references/docs/planner-antipatterns.md +89 -0
- package/.agent/skills/gsd/references/docs/planner-revision.md +87 -87
- package/.agent/skills/gsd/references/docs/planner-source-audit.md +73 -0
- package/.agent/skills/gsd/references/docs/planning-config.md +33 -8
- package/.agent/skills/gsd/references/docs/project-skills-discovery.md +19 -0
- package/.agent/skills/gsd/references/docs/sketch-interactivity.md +41 -0
- package/.agent/skills/gsd/references/docs/sketch-theme-system.md +94 -0
- package/.agent/skills/gsd/references/docs/sketch-tooling.md +45 -0
- package/.agent/skills/gsd/references/docs/sketch-variant-patterns.md +81 -0
- package/.agent/skills/gsd/references/docs/tdd.md +67 -0
- package/.agent/skills/gsd/references/docs/universal-anti-patterns.md +5 -0
- package/.agent/skills/gsd/references/docs/workstream-flag.md +11 -11
- package/.agent/skills/gsd/references/mapping.md +1 -1
- package/.agent/skills/gsd/references/workflows/add-phase.md +112 -112
- package/.agent/skills/gsd/references/workflows/add-tests.md +6 -3
- package/.agent/skills/gsd/references/workflows/add-todo.md +5 -3
- package/.agent/skills/gsd/references/workflows/ai-integration-phase.md +284 -0
- package/.agent/skills/gsd/references/workflows/audit-fix.md +157 -157
- package/.agent/skills/gsd/references/workflows/audit-milestone.md +340 -340
- package/.agent/skills/gsd/references/workflows/audit-uat.md +109 -109
- package/.agent/skills/gsd/references/workflows/autonomous.md +20 -288
- package/.agent/skills/gsd/references/workflows/check-todos.md +4 -2
- package/.agent/skills/gsd/references/workflows/cleanup.md +3 -1
- package/.agent/skills/gsd/references/workflows/code-review-fix.md +497 -497
- package/.agent/skills/gsd/references/workflows/code-review.md +515 -515
- package/.agent/skills/gsd/references/workflows/complete-milestone.md +97 -24
- package/.agent/skills/gsd/references/workflows/diagnose-issues.md +238 -238
- package/.agent/skills/gsd/references/workflows/discovery-phase.md +2 -0
- package/.agent/skills/gsd/references/workflows/discuss-phase-assumptions.md +11 -11
- package/.agent/skills/gsd/references/workflows/discuss-phase.md +143 -19
- package/.agent/skills/gsd/references/workflows/do.md +8 -2
- package/.agent/skills/gsd/references/workflows/docs-update.md +5 -3
- package/.agent/skills/gsd/references/workflows/eval-review.md +155 -0
- package/.agent/skills/gsd/references/workflows/execute-phase.md +338 -54
- package/.agent/skills/gsd/references/workflows/execute-plan.md +80 -104
- package/.agent/skills/gsd/references/workflows/explore.md +3 -1
- package/.agent/skills/gsd/references/workflows/extract_learnings.md +232 -0
- package/.agent/skills/gsd/references/workflows/forensics.md +3 -3
- package/.agent/skills/gsd/references/workflows/health.md +2 -2
- package/.agent/skills/gsd/references/workflows/help.md +59 -1
- package/.agent/skills/gsd/references/workflows/import.md +3 -1
- package/.agent/skills/gsd/references/workflows/inbox.md +387 -384
- package/.agent/skills/gsd/references/workflows/insert-phase.md +130 -130
- package/.agent/skills/gsd/references/workflows/list-workspaces.md +56 -56
- package/.agent/skills/gsd/references/workflows/manager.md +5 -3
- package/.agent/skills/gsd/references/workflows/map-codebase.md +19 -5
- package/.agent/skills/gsd/references/workflows/milestone-summary.md +6 -6
- package/.agent/skills/gsd/references/workflows/new-milestone.md +63 -9
- package/.agent/skills/gsd/references/workflows/new-project.md +126 -22
- package/.agent/skills/gsd/references/workflows/new-workspace.md +6 -4
- package/.agent/skills/gsd/references/workflows/next.md +220 -153
- package/.agent/skills/gsd/references/workflows/note.md +2 -0
- package/.agent/skills/gsd/references/workflows/pause-work.md +11 -7
- package/.agent/skills/gsd/references/workflows/plan-milestone-gaps.md +273 -273
- package/.agent/skills/gsd/references/workflows/plan-phase.md +281 -62
- package/.agent/skills/gsd/references/workflows/plant-seed.md +4 -1
- package/.agent/skills/gsd/references/workflows/pr-branch.md +41 -13
- package/.agent/skills/gsd/references/workflows/profile-user.md +15 -13
- package/.agent/skills/gsd/references/workflows/progress.md +133 -21
- package/.agent/skills/gsd/references/workflows/quick.md +67 -27
- package/.agent/skills/gsd/references/workflows/remove-phase.md +155 -155
- package/.agent/skills/gsd/references/workflows/remove-workspace.md +4 -2
- package/.agent/skills/gsd/references/workflows/research-phase.md +3 -3
- package/.agent/skills/gsd/references/workflows/resume-project.md +3 -3
- package/.agent/skills/gsd/references/workflows/review.md +71 -8
- package/.agent/skills/gsd/references/workflows/scan.md +102 -102
- package/.agent/skills/gsd/references/workflows/secure-phase.md +7 -5
- package/.agent/skills/gsd/references/workflows/settings.md +24 -7
- package/.agent/skills/gsd/references/workflows/ship.md +71 -6
- package/.agent/skills/gsd/references/workflows/sketch-wrap-up.md +283 -0
- package/.agent/skills/gsd/references/workflows/sketch.md +263 -0
- package/.agent/skills/gsd/references/workflows/spec-phase.md +262 -0
- package/.agent/skills/gsd/references/workflows/spike-wrap-up.md +273 -0
- package/.agent/skills/gsd/references/workflows/spike.md +270 -0
- package/.agent/skills/gsd/references/workflows/stats.md +60 -60
- package/.agent/skills/gsd/references/workflows/transition.md +671 -671
- package/.agent/skills/gsd/references/workflows/ui-phase.md +33 -12
- package/.agent/skills/gsd/references/workflows/ui-review.md +6 -4
- package/.agent/skills/gsd/references/workflows/undo.md +3 -1
- package/.agent/skills/gsd/references/workflows/update.md +113 -2
- package/.agent/skills/gsd/references/workflows/validate-phase.md +7 -5
- package/.agent/skills/gsd/references/workflows/verify-phase.md +93 -10
- package/.agent/skills/gsd/references/workflows/verify-work.md +50 -10
- package/.agent/skills/gsd-converter/references/mapping.md +1 -1
- package/.agent/skills/gsd-converter/scripts/convert.py +36 -17
- package/.agent/skills/gsd-converter/scripts/regression_test.py +68 -33
- package/README.md +3 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.37.1",
|
|
3
3
|
"commands": {
|
|
4
4
|
"state": {
|
|
5
5
|
"description": "State operations.",
|
|
@@ -141,6 +141,12 @@
|
|
|
141
141
|
"audit-uat": {
|
|
142
142
|
"description": "Scan all phases for unresolved UAT/verification items"
|
|
143
143
|
},
|
|
144
|
+
"audit-open": {
|
|
145
|
+
"description": "Audit-open operations.",
|
|
146
|
+
"subcommands": {
|
|
147
|
+
"[--json]": "Scan all .planning/ artifact types for unresolved items"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
144
150
|
"intel": {
|
|
145
151
|
"description": "Intel operations.",
|
|
146
152
|
"subcommands": {
|
|
@@ -217,5 +223,5 @@
|
|
|
217
223
|
}
|
|
218
224
|
}
|
|
219
225
|
},
|
|
220
|
-
"tools_usage": "Commands
|
|
226
|
+
"tools_usage": "#### Atomic Commands:\n state load Load project config + state\n state json Output STATE.md frontmatter as JSON\n state update <field> <value> Update a STATE.md field\n state get [section] Get STATE.md content or section\n state patch --field val ... Batch update STATE.md fields\n state begin-phase --phase N --name S --plans C Update STATE.md for new phase start\n state signal-waiting --type T --question Q --options \"A|B\" --phase P Write WAITING.json signal\n state signal-resume Remove WAITING.json signal\n resolve-model <agent-type> Get model for agent based on profile\n find-phase <phase> Find phase directory by number\n commit <message> [--files f1 f2] [--no-verify] Commit planning docs\n commit-to-subrepo <msg> --files f1 f2 Route commits to sub-repos\n verify-summary <path> Verify a SUMMARY.md file\n generate-slug <text> Convert text to URL-safe slug\n current-timestamp [format] Get timestamp (full|date|filename)\n list-todos [area] Count and enumerate pending todos\n verify-path-exists <path> Check file/directory existence\n config-ensure-section Initialize .planning/config.json\n history-digest Aggregate all SUMMARY.md data\n summary-extract <path> [--fields] Extract structured data from SUMMARY.md\n state-snapshot Structured parse of STATE.md\n phase-plan-index <phase> Index plans with waves and status\n websearch <query> Search web via Brave API (if configured)\n[--limit N] [--freshness day|week|month]\n\n#### Phase Operations:\n phase next-decimal <phase> Calculate next decimal phase number\n phase add <description> [--id ID] Append new phase to roadmap + create dir\n phase insert <after> <description> Insert decimal phase after existing\n phase remove <phase> [--force] Remove phase, renumber all subsequent\n phase complete <phase> Mark phase done, update state + roadmap\n\n#### Roadmap Operations:\n roadmap get-phase <phase> Extract phase section from ROADMAP.md\n roadmap analyze Full roadmap parse with disk status\n roadmap update-plan-progress <N> Update progress table row from disk (PLAN vs SUMMARY counts)\n\n#### Requirements Operations:\n requirements mark-complete <ids> Mark requirement IDs as complete in REQUIREMENTS.md\nAccepts: REQ-01,REQ-02 or REQ-01 REQ-02 or [REQ-01, REQ-02]\n\n#### Milestone Operations:\n milestone complete <version> Archive milestone, create MILESTONES.md\n[--name <name>]\n[--archive-phases] Move phase dirs to milestones/vX.Y-phases/\n\n#### Validation:\n validate consistency Check phase numbering, disk/roadmap sync\n validate health [--repair] Check .planning/ integrity, optionally repair\n validate agents Check GSD agent installation status\n\n#### Progress:\n progress [json|table|bar] Render progress in various formats\n\n#### Todos:\n todo complete <filename> Move todo from pending to completed\n\n#### UAT Audit:\n audit-uat Scan all phases for unresolved UAT/verification items\n uat render-checkpoint --file <path> Render the current UAT checkpoint block\n\n#### Open Artifact Audit:\n audit-open [--json] Scan all .planning/ artifact types for unresolved items\n\n#### Intel:\n intel query <term> Query intel files for a term\n intel status Show intel file freshness\n intel update Trigger intel refresh (returns agent spawn hint)\n intel diff Show changed intel entries since last snapshot\n intel snapshot Save current intel state as diff baseline\n intel patch-meta <file> Update _meta.updated_at in an intel file\n intel validate Validate intel file structure\n intel extract-exports <file> Extract exported symbols from a source file\n\n#### Scaffolding:\n scaffold context --phase <N> Create CONTEXT.md template\n scaffold uat --phase <N> Create UAT.md template\n scaffold verification --phase <N> Create VERIFICATION.md template\n scaffold phase-dir --phase <N> Create phase directory\n --name <name>\n\n#### Frontmatter CRUD:\n frontmatter get <file> [--field k] Extract frontmatter as JSON\n frontmatter set <file> --field k Update single frontmatter field\n --value jsonVal\n frontmatter merge <file> Merge JSON into frontmatter\n --data '{json}'\n frontmatter validate <file> Validate required fields\n --schema plan|summary|verification\n\n#### Verification Suite:\n verify plan-structure <file> Check PLAN.md structure + tasks\n verify phase-completeness <phase> Check all plans have summaries\n verify references <file> Check @-refs + paths resolve\n verify commits <h1> [h2] ... Batch verify commit hashes\n verify artifacts <plan-file> Check must_haves.artifacts\n verify key-links <plan-file> Check must_haves.key_links\n verify schema-drift <phase> [--skip] Detect schema file changes without push\n\n#### Template Fill:\n template fill summary --phase N Create pre-filled SUMMARY.md\n[--plan M] [--name \"...\"]\n[--fields '{json}']\n template fill plan --phase N Create pre-filled PLAN.md\n[--plan M] [--type execute|tdd]\n[--wave N] [--fields '{json}']\n template fill verification Create pre-filled VERIFICATION.md\n --phase N [--fields '{json}']\n\n#### State Progression:\n state advance-plan Increment plan counter\n state record-metric --phase N Record execution metrics\n --plan M --duration Xmin\n[--tasks N] [--files N]\n state update-progress Recalculate progress bar\n state add-decision --summary \"...\" Add decision to STATE.md\n[--phase N] [--rationale \"...\"]\n[--summary-file path] [--rationale-file path]\n state add-blocker --text \"...\" Add blocker\n[--text-file path]\n state resolve-blocker --text \"...\" Remove blocker\n state record-session Update session continuity\n --stopped-at \"...\"\n[--resume-file path]\n Compound Commands (workflow-specific initialization):\n init execute-phase <phase> All context for execute-phase workflow\n init plan-phase <phase> All context for plan-phase workflow\n init new-project All context for new-project workflow\n init new-milestone All context for new-milestone workflow\n init quick <description> All context for quick workflow\n init resume All context for resume-project workflow\n init verify-work <phase> All context for verify-work workflow\n init phase-op <phase> Generic phase operation context\n init todos [area] All context for todo workflows\n init milestone-op All context for milestone operations\n init map-codebase All context for map-codebase workflow\n init progress All context for progress workflow\n\n#### Documentation:\n docs-init Project context for docs-update workflow\n\n#### Learnings:\n learnings list List all global learnings (JSON)\n learnings query --tag <tag> Query learnings by tag\n learnings copy Copy from current project's LEARNINGS.md\n learnings prune --older-than <dur> Remove entries older than duration (e.g. 90d)\n learnings delete <id> Delete a learning by ID\n GSD-2 Migration:\n from-gsd2 [--path <dir>] [--force] [--dry-run]\n Import a GSD-2 (.gsd/) project back to GSD v1 (.planning/) format"
|
|
221
227
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
|
+
// Background worker spawned by gsd-check-update.js (SessionStart hook).
|
|
4
|
+
// Checks for GSD updates and stale hooks, writes result to cache file.
|
|
5
|
+
// Receives paths via environment variables set by the parent hook.
|
|
6
|
+
//
|
|
7
|
+
// Using a separate file (rather than node -e '<inline code>') avoids the
|
|
8
|
+
// template-literal regex-escaping problem: regex source is plain JS here.
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execFileSync } = require('child_process');
|
|
15
|
+
|
|
16
|
+
const cacheFile = process.env.GSD_CACHE_FILE;
|
|
17
|
+
const projectVersionFile = process.env.GSD_PROJECT_VERSION_FILE;
|
|
18
|
+
const globalVersionFile = process.env.GSD_GLOBAL_VERSION_FILE;
|
|
19
|
+
|
|
20
|
+
// Compare semver: true if a > b (a is strictly newer than b)
|
|
21
|
+
// Strips pre-release suffixes (e.g. '3-beta.1' → '3') to avoid NaN from Number()
|
|
22
|
+
function isNewer(a, b) {
|
|
23
|
+
const pa = (a || '').split('.').map(s => Number(s.replace(/-.*/, '')) || 0);
|
|
24
|
+
const pb = (b || '').split('.').map(s => Number(s.replace(/-.*/, '')) || 0);
|
|
25
|
+
for (let i = 0; i < 3; i++) {
|
|
26
|
+
if (pa[i] > pb[i]) return true;
|
|
27
|
+
if (pa[i] < pb[i]) return false;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Check project directory first (local install), then global
|
|
33
|
+
let installed = '0.0.0';
|
|
34
|
+
let configDir = '';
|
|
35
|
+
try {
|
|
36
|
+
if (fs.existsSync(projectVersionFile)) {
|
|
37
|
+
installed = fs.readFileSync(projectVersionFile, 'utf8').trim();
|
|
38
|
+
configDir = path.dirname(path.dirname(projectVersionFile));
|
|
39
|
+
} else if (fs.existsSync(globalVersionFile)) {
|
|
40
|
+
installed = fs.readFileSync(globalVersionFile, 'utf8').trim();
|
|
41
|
+
configDir = path.dirname(path.dirname(globalVersionFile));
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {}
|
|
44
|
+
|
|
45
|
+
// Check for stale hooks — compare hook version headers against installed VERSION
|
|
46
|
+
.agent/skills/gsd/bin/hooks/) (#1421)
|
|
47
|
+
// Only check hooks that GSD currently ships — orphaned files from removed features
|
|
48
|
+
// (e.g., gsd-intel-*.js) must be ignored to avoid permanent stale warnings (#1750)
|
|
49
|
+
const MANAGED_HOOKS = [
|
|
50
|
+
'gsd-check-update-worker.js',
|
|
51
|
+
'gsd-check-update.js',
|
|
52
|
+
'gsd-context-monitor.js',
|
|
53
|
+
'gsd-phase-boundary.sh',
|
|
54
|
+
'gsd-prompt-guard.js',
|
|
55
|
+
'gsd-read-guard.js',
|
|
56
|
+
'gsd-read-injection-scanner.js',
|
|
57
|
+
'gsd-session-state.sh',
|
|
58
|
+
'gsd-statusline.js',
|
|
59
|
+
'gsd-validate-commit.sh',
|
|
60
|
+
'gsd-workflow-guard.js',
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
let staleHooks = [];
|
|
64
|
+
if (configDir) {
|
|
65
|
+
const hooksDir = path.join(configDir, 'hooks');
|
|
66
|
+
try {
|
|
67
|
+
if (fs.existsSync(hooksDir)) {
|
|
68
|
+
const hookFiles = fs.readdirSync(hooksDir).filter(f => MANAGED_HOOKS.includes(f));
|
|
69
|
+
for (const hookFile of hookFiles) {
|
|
70
|
+
try {
|
|
71
|
+
const content = fs.readFileSync(path.join(hooksDir, hookFile), 'utf8');
|
|
72
|
+
// Match both JS (//) and bash (#) comment styles
|
|
73
|
+
const versionMatch = content.match(/(?:\/\/|#) gsd-hook-version:\s*(.+)/);
|
|
74
|
+
if (versionMatch) {
|
|
75
|
+
const hookVersion = versionMatch[1].trim();
|
|
76
|
+
if (isNewer(installed, hookVersion) && !hookVersion.includes('{{')) {
|
|
77
|
+
staleHooks.push({ file: hookFile, hookVersion, installedVersion: installed });
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
// No version header at all — definitely stale (pre-version-tracking)
|
|
81
|
+
staleHooks.push({ file: hookFile, hookVersion: 'unknown', installedVersion: installed });
|
|
82
|
+
}
|
|
83
|
+
} catch (e) {}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} catch (e) {}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let latest = null;
|
|
90
|
+
try {
|
|
91
|
+
latest = execFileSync('npm', ['view', 'get-shit-done-cc', 'version'], {
|
|
92
|
+
encoding: 'utf8',
|
|
93
|
+
timeout: 10000,
|
|
94
|
+
windowsHide: true,
|
|
95
|
+
}).trim();
|
|
96
|
+
} catch (e) {}
|
|
97
|
+
|
|
98
|
+
const result = {
|
|
99
|
+
update_available: latest && isNewer(latest, installed),
|
|
100
|
+
installed,
|
|
101
|
+
latest: latest || 'unknown',
|
|
102
|
+
checked: Math.floor(Date.now() / 1000),
|
|
103
|
+
stale_hooks: staleHooks.length > 0 ? staleHooks : undefined,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
if (cacheFile) {
|
|
107
|
+
try { fs.writeFileSync(cacheFile, JSON.stringify(result)); } catch (e) {}
|
|
108
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// gsd-hook-version: 1.
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
3
|
// Check for GSD updates in background, write result to cache
|
|
4
4
|
// Called by SessionStart hook - runs once per session
|
|
5
5
|
|
|
@@ -44,96 +44,21 @@ if (!fs.existsSync(cacheDir)) {
|
|
|
44
44
|
fs.mkdirSync(cacheDir, { recursive: true });
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// Run check in background
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Compare semver: true if a > b (a is strictly newer than b)
|
|
54
|
-
// Strips pre-release suffixes (e.g. '3-beta.1' → '3') to avoid NaN from Number()
|
|
55
|
-
function isNewer(a, b) {
|
|
56
|
-
const pa = (a || '').split('.').map(s => Number(s.replace(/-.*/, '')) || 0);
|
|
57
|
-
const pb = (b || '').split('.').map(s => Number(s.replace(/-.*/, '')) || 0);
|
|
58
|
-
for (let i = 0; i < 3; i++) {
|
|
59
|
-
if (pa[i] > pb[i]) return true;
|
|
60
|
-
if (pa[i] < pb[i]) return false;
|
|
61
|
-
}
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const cacheFile = ${JSON.stringify(cacheFile)};
|
|
66
|
-
const projectVersionFile = ${JSON.stringify(projectVersionFile)};
|
|
67
|
-
const globalVersionFile = ${JSON.stringify(globalVersionFile)};
|
|
68
|
-
|
|
69
|
-
// Check project directory first (local install), then global
|
|
70
|
-
let installed = '0.0.0';
|
|
71
|
-
let configDir = '';
|
|
72
|
-
try {
|
|
73
|
-
if (fs.existsSync(projectVersionFile)) {
|
|
74
|
-
installed = fs.readFileSync(projectVersionFile, 'utf8').trim();
|
|
75
|
-
configDir = path.dirname(path.dirname(projectVersionFile));
|
|
76
|
-
} else if (fs.existsSync(globalVersionFile)) {
|
|
77
|
-
installed = fs.readFileSync(globalVersionFile, 'utf8').trim();
|
|
78
|
-
configDir = path.dirname(path.dirname(globalVersionFile));
|
|
79
|
-
}
|
|
80
|
-
} catch (e) {}
|
|
81
|
-
|
|
82
|
-
// Check for stale hooks — compare hook version headers against installed VERSION
|
|
83
|
-
.agent/skills/gsd/bin/hooks/) (#1421)
|
|
84
|
-
// Only check hooks that GSD currently ships — orphaned files from removed features
|
|
85
|
-
// (e.g., gsd-intel-*.js) must be ignored to avoid permanent stale warnings (#1750)
|
|
86
|
-
const MANAGED_HOOKS = [
|
|
87
|
-
'gsd-check-update.js',
|
|
88
|
-
'gsd-context-monitor.js',
|
|
89
|
-
'gsd-prompt-guard.js',
|
|
90
|
-
'gsd-read-guard.js',
|
|
91
|
-
'gsd-statusline.js',
|
|
92
|
-
'gsd-workflow-guard.js',
|
|
93
|
-
];
|
|
94
|
-
let staleHooks = [];
|
|
95
|
-
if (configDir) {
|
|
96
|
-
const hooksDir = path.join(configDir, 'hooks');
|
|
97
|
-
try {
|
|
98
|
-
if (fs.existsSync(hooksDir)) {
|
|
99
|
-
const hookFiles = fs.readdirSync(hooksDir).filter(f => MANAGED_HOOKS.includes(f));
|
|
100
|
-
for (const hookFile of hookFiles) {
|
|
101
|
-
try {
|
|
102
|
-
const content = fs.readFileSync(path.join(hooksDir, hookFile), 'utf8');
|
|
103
|
-
const versionMatch = content.match(/\\/\\/ gsd-hook-version:\\s*(.+)/);
|
|
104
|
-
if (versionMatch) {
|
|
105
|
-
const hookVersion = versionMatch[1].trim();
|
|
106
|
-
if (isNewer(installed, hookVersion) && !hookVersion.includes('{{')) {
|
|
107
|
-
staleHooks.push({ file: hookFile, hookVersion, installedVersion: installed });
|
|
108
|
-
}
|
|
109
|
-
} else {
|
|
110
|
-
// No version header at all — definitely stale (pre-version-tracking)
|
|
111
|
-
staleHooks.push({ file: hookFile, hookVersion: 'unknown', installedVersion: installed });
|
|
112
|
-
}
|
|
113
|
-
} catch (e) {}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
} catch (e) {}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
let latest = null;
|
|
120
|
-
try {
|
|
121
|
-
latest = execSync('npm view get-shit-done-cc version', { encoding: 'utf8', timeout: 10000, windowsHide: true }).trim();
|
|
122
|
-
} catch (e) {}
|
|
123
|
-
|
|
124
|
-
const result = {
|
|
125
|
-
update_available: latest && isNewer(latest, installed),
|
|
126
|
-
installed,
|
|
127
|
-
latest: latest || 'unknown',
|
|
128
|
-
checked: Math.floor(Date.now() / 1000),
|
|
129
|
-
stale_hooks: staleHooks.length > 0 ? staleHooks : undefined
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
fs.writeFileSync(cacheFile, JSON.stringify(result));
|
|
133
|
-
`], {
|
|
47
|
+
// Run check in background via a dedicated worker script.
|
|
48
|
+
// Spawning a file (rather than node -e '<inline code>') keeps the worker logic
|
|
49
|
+
// in plain JS with no template-literal regex-escaping concerns, and makes the
|
|
50
|
+
// worker independently testable.
|
|
51
|
+
const workerPath = path.join(__dirname, 'gsd-check-update-worker.js');
|
|
52
|
+
const child = spawn(process.execPath, [workerPath], {
|
|
134
53
|
stdio: 'ignore',
|
|
135
54
|
windowsHide: true,
|
|
136
|
-
detached: true // Required on Windows for proper process detachment
|
|
55
|
+
detached: true, // Required on Windows for proper process detachment
|
|
56
|
+
env: {
|
|
57
|
+
...process.env,
|
|
58
|
+
GSD_CACHE_FILE: cacheFile,
|
|
59
|
+
GSD_PROJECT_VERSION_FILE: projectVersionFile,
|
|
60
|
+
GSD_GLOBAL_VERSION_FILE: globalVersionFile,
|
|
61
|
+
},
|
|
137
62
|
});
|
|
138
63
|
|
|
139
64
|
child.unref();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// gsd-hook-version: 1.
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
3
|
// Context Monitor - PostToolUse/AfterTool hook (Gemini uses AfterTool)
|
|
4
4
|
// Reads context metrics from the statusline bridge file and injects
|
|
5
5
|
// warnings when context usage is high. This makes the AGENT aware of
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
const fs = require('fs');
|
|
22
22
|
const os = require('os');
|
|
23
23
|
const path = require('path');
|
|
24
|
+
const { spawn } = require('child_process');
|
|
24
25
|
|
|
25
26
|
const WARNING_THRESHOLD = 35; // remaining_percentage <= 35%
|
|
26
27
|
const CRITICAL_THRESHOLD = 25; // remaining_percentage <= 25%
|
|
@@ -52,17 +53,19 @@ process.stdin.on('end', () => {
|
|
|
52
53
|
process.exit(0);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
// Check if context warnings are disabled via config
|
|
56
|
+
// Check if context warnings are disabled via config.
|
|
57
|
+
// Quick sentinel check: skip config read entirely for non-GSD projects (#P2.5).
|
|
56
58
|
const cwd = data.cwd || process.cwd();
|
|
57
|
-
const
|
|
58
|
-
if (fs.existsSync(
|
|
59
|
+
const planningDir = path.join(cwd, '.planning');
|
|
60
|
+
if (fs.existsSync(planningDir)) {
|
|
59
61
|
try {
|
|
62
|
+
const configPath = path.join(planningDir, 'config.json');
|
|
60
63
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
61
64
|
if (config.hooks?.context_warnings === false) {
|
|
62
65
|
process.exit(0);
|
|
63
66
|
}
|
|
64
67
|
} catch (e) {
|
|
65
|
-
// Ignore config parse errors
|
|
68
|
+
// Ignore config read/parse errors (config may not exist in .planning/)
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
|
|
@@ -126,6 +129,32 @@ process.stdin.on('end', () => {
|
|
|
126
129
|
// Detect if GSD is active (has .planning/STATE.md in working directory)
|
|
127
130
|
const isGsdActive = fs.existsSync(path.join(cwd, '.planning', 'STATE.md'));
|
|
128
131
|
|
|
132
|
+
// On CRITICAL with active GSD project, auto-record session state as a
|
|
133
|
+
// breadcrumb for /gsd-resume-work (#1974). Fire-and-forget subprocess —
|
|
134
|
+
// doesn't block the hook or the agent. Fires ONCE per CRITICAL session,
|
|
135
|
+
// guarded by warnData.criticalRecorded to prevent repeated overwrites
|
|
136
|
+
// of the "crash moment" record on every debounce cycle.
|
|
137
|
+
if (isCritical && isGsdActive && !warnData.criticalRecorded) {
|
|
138
|
+
try {
|
|
139
|
+
// Runtime-agnostic path: this hook lives at <runtime-config>/hooks/
|
|
140
|
+
// and gsd-tools.cjs lives at <runtime-config>/get-shit-done/bin/.
|
|
141
|
+
// Using __dirname makes this work on Antigravity, OpenCode, Gemini,
|
|
142
|
+
// Kilo, etc. without hardcoding ~/.antigravity/.
|
|
143
|
+
const gsdTools = path.join(__dirname, '..', 'get-shit-done', 'bin', 'gsd-tools.cjs');
|
|
144
|
+
// Coerce usedPct to a safe number in case bridge file is malformed
|
|
145
|
+
const safeUsedPct = Number(usedPct) || 0;
|
|
146
|
+
const stoppedAt = `context exhaustion at ${safeUsedPct}% (${new Date().toISOString().split('T')[0]})`;
|
|
147
|
+
spawn(
|
|
148
|
+
process.execPath,
|
|
149
|
+
[gsdTools, 'state', 'record-session', '--stopped-at', stoppedAt],
|
|
150
|
+
{ cwd, detached: true, stdio: 'ignore' }
|
|
151
|
+
).unref();
|
|
152
|
+
warnData.criticalRecorded = true;
|
|
153
|
+
// Persist the sentinel so subsequent debounce cycles don't re-fire
|
|
154
|
+
fs.writeFileSync(warnPath, JSON.stringify(warnData));
|
|
155
|
+
} catch { /* non-critical — don't let state recording break the hook */ }
|
|
156
|
+
}
|
|
157
|
+
|
|
129
158
|
// Build advisory warning message (never use imperative commands that
|
|
130
159
|
// override user preferences — see #884)
|
|
131
160
|
let message;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
+
# gsd-hook-version: 1.37.1
|
|
2
3
|
# gsd-phase-boundary.sh — PostToolUse hook: detect .planning/ file writes
|
|
3
4
|
# Outputs a reminder when planning files are modified outside normal workflow.
|
|
4
5
|
# Uses Node.js for JSON parsing (always available in GSD projects, no jq dependency).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// gsd-hook-version: 1.
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
3
|
// GSD Prompt Injection Guard — PreToolUse hook
|
|
4
4
|
// Scans file content being written to .planning/ for prompt injection patterns.
|
|
5
5
|
// Defense-in-depth: catches injected instructions before they enter agent context.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// gsd-hook-version: 1.
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
3
|
// GSD Read Guard — PreToolUse hook
|
|
4
4
|
// Injects advisory guidance when Write/Edit targets an existing file,
|
|
5
5
|
// reminding the model to Read the file first.
|
|
@@ -36,6 +36,11 @@ process.stdin.on('end', () => {
|
|
|
36
36
|
process.exit(0);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// Antigravity natively enforces read-before-edit — skip the advisory (#1984, #2344)
|
|
40
|
+
if (process.env.ANTIGRAVITY_SESSION_ID || process.env.CLAUDECODE) {
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
|
|
39
44
|
const filePath = data.tool_input?.file_path || '';
|
|
40
45
|
if (!filePath) {
|
|
41
46
|
process.exit(0);
|
|
@@ -1,20 +1,120 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// gsd-hook-version: 1.
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
3
|
// Antigravity Statusline - GSD Edition
|
|
4
|
-
// Shows: model | current task | directory | context usage
|
|
4
|
+
// Shows: model | current task (or GSD state) | directory | context usage
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
|
8
8
|
const os = require('os');
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
// --- GSD state reader -------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Walk up from dir looking for .planning/STATE.md.
|
|
14
|
+
* Returns parsed state object or null.
|
|
15
|
+
*/
|
|
16
|
+
function readGsdState(dir) {
|
|
17
|
+
const home = os.homedir();
|
|
18
|
+
let current = dir;
|
|
19
|
+
for (let i = 0; i < 10; i++) {
|
|
20
|
+
const candidate = path.join(current, '.planning', 'STATE.md');
|
|
21
|
+
if (fs.existsSync(candidate)) {
|
|
22
|
+
try {
|
|
23
|
+
return parseStateMd(fs.readFileSync(candidate, 'utf8'));
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const parent = path.dirname(current);
|
|
29
|
+
if (parent === current || current === home) break;
|
|
30
|
+
current = parent;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Parse STATE.md frontmatter + Phase line from body.
|
|
37
|
+
* Returns { status, milestone, milestoneName, phaseNum, phaseTotal, phaseName }
|
|
38
|
+
*/
|
|
39
|
+
function parseStateMd(content) {
|
|
40
|
+
const state = {};
|
|
41
|
+
|
|
42
|
+
// YAML frontmatter between --- markers
|
|
43
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
44
|
+
if (fmMatch) {
|
|
45
|
+
for (const line of fmMatch[1].split('\n')) {
|
|
46
|
+
const m = line.match(/^(\w+):\s*(.+)/);
|
|
47
|
+
if (!m) continue;
|
|
48
|
+
const [, key, val] = m;
|
|
49
|
+
const v = val.trim().replace(/^["']|["']$/g, '');
|
|
50
|
+
if (key === 'status') state.status = v === 'null' ? null : v;
|
|
51
|
+
if (key === 'milestone') state.milestone = v === 'null' ? null : v;
|
|
52
|
+
if (key === 'milestone_name') state.milestoneName = v === 'null' ? null : v;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Phase: N of M (name) or Phase: none active (...)
|
|
57
|
+
const phaseMatch = content.match(/^Phase:\s*(\d+)\s+of\s+(\d+)(?:\s+\(([^)]+)\))?/m);
|
|
58
|
+
if (phaseMatch) {
|
|
59
|
+
state.phaseNum = phaseMatch[1];
|
|
60
|
+
state.phaseTotal = phaseMatch[2];
|
|
61
|
+
state.phaseName = phaseMatch[3] || null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Fallback: parse Status: from body when frontmatter is absent
|
|
65
|
+
if (!state.status) {
|
|
66
|
+
const bodyStatus = content.match(/^Status:\s*(.+)/m);
|
|
67
|
+
if (bodyStatus) {
|
|
68
|
+
const raw = bodyStatus[1].trim().toLowerCase();
|
|
69
|
+
if (raw.includes('ready to plan') || raw.includes('planning')) state.status = 'planning';
|
|
70
|
+
else if (raw.includes('execut')) state.status = 'executing';
|
|
71
|
+
else if (raw.includes('complet') || raw.includes('archived')) state.status = 'complete';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return state;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Format GSD state into display string.
|
|
80
|
+
* Format: "v1.9 Code Quality · executing · fix-graphiti-deployment (1/5)"
|
|
81
|
+
* Gracefully degrades when parts are missing.
|
|
82
|
+
*/
|
|
83
|
+
function formatGsdState(s) {
|
|
84
|
+
const parts = [];
|
|
85
|
+
|
|
86
|
+
// Milestone: version + name (skip placeholder "milestone")
|
|
87
|
+
if (s.milestone || s.milestoneName) {
|
|
88
|
+
const ver = s.milestone || '';
|
|
89
|
+
const name = (s.milestoneName && s.milestoneName !== 'milestone') ? s.milestoneName : '';
|
|
90
|
+
const ms = [ver, name].filter(Boolean).join(' ');
|
|
91
|
+
if (ms) parts.push(ms);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Status
|
|
95
|
+
if (s.status) parts.push(s.status);
|
|
96
|
+
|
|
97
|
+
// Phase
|
|
98
|
+
if (s.phaseNum && s.phaseTotal) {
|
|
99
|
+
const phase = s.phaseName
|
|
100
|
+
? `${s.phaseName} (${s.phaseNum}/${s.phaseTotal})`
|
|
101
|
+
: `ph ${s.phaseNum}/${s.phaseTotal}`;
|
|
102
|
+
parts.push(phase);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return parts.join(' · ');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// --- stdin ------------------------------------------------------------------
|
|
109
|
+
|
|
110
|
+
function runStatusline() {
|
|
111
|
+
let input = '';
|
|
112
|
+
// Timeout guard: if stdin doesn't close within 3s (e.g. pipe issues on
|
|
113
|
+
// Windows/Git Bash), exit silently instead of hanging. See #775.
|
|
114
|
+
const stdinTimeout = setTimeout(() => process.exit(0), 3000);
|
|
115
|
+
process.stdin.setEncoding('utf8');
|
|
116
|
+
process.stdin.on('data', chunk => input += chunk);
|
|
117
|
+
process.stdin.on('end', () => {
|
|
18
118
|
clearTimeout(stdinTimeout);
|
|
19
119
|
try {
|
|
20
120
|
const data = JSON.parse(input);
|
|
@@ -24,9 +124,15 @@ process.stdin.on('end', () => {
|
|
|
24
124
|
const remaining = data.context_window?.remaining_percentage;
|
|
25
125
|
|
|
26
126
|
// Context window display (shows USED percentage scaled to usable context)
|
|
27
|
-
// Antigravity reserves
|
|
28
|
-
//
|
|
29
|
-
|
|
127
|
+
// Antigravity reserves a buffer for autocompact. By default this is ~16.5%
|
|
128
|
+
// of the total window, but users can override it via ANTIGRAVITY_AUTO_COMPACT_WINDOW
|
|
129
|
+
// (a token count). When the env var is set, compute the buffer % dynamically so
|
|
130
|
+
// the meter correctly reflects early-compaction configurations (#2219).
|
|
131
|
+
const totalCtx = data.context_window?.total_tokens || 1_000_000;
|
|
132
|
+
const acw = parseInt(process.env.ANTIGRAVITY_AUTO_COMPACT_WINDOW || '0', 10);
|
|
133
|
+
const AUTO_COMPACT_BUFFER_PCT = acw > 0
|
|
134
|
+
? Math.min(100, (acw / totalCtx) * 100)
|
|
135
|
+
: 16.5;
|
|
30
136
|
let ctx = '';
|
|
31
137
|
if (remaining != null) {
|
|
32
138
|
// Normalize: subtract buffer from remaining, scale to usable range
|
|
@@ -94,6 +200,9 @@ process.stdin.on('end', () => {
|
|
|
94
200
|
}
|
|
95
201
|
}
|
|
96
202
|
|
|
203
|
+
// GSD state (milestone · status · phase) — shown when no todo task
|
|
204
|
+
const gsdStateStr = task ? '' : formatGsdState(readGsdState(dir) || {});
|
|
205
|
+
|
|
97
206
|
// GSD update available?
|
|
98
207
|
// Check shared cache first (#1421), fall back to runtime-specific cache for
|
|
99
208
|
// backward compatibility with older gsd-check-update.js versions.
|
|
@@ -108,15 +217,34 @@ process.stdin.on('end', () => {
|
|
|
108
217
|
gsdUpdate = '\x1b[33m⬆ /gsd-update\x1b[0m │ ';
|
|
109
218
|
}
|
|
110
219
|
if (cache.stale_hooks && cache.stale_hooks.length > 0) {
|
|
111
|
-
|
|
220
|
+
// If installed version is ahead of npm latest, this is a dev install.
|
|
221
|
+
// Running /gsd-update would downgrade — show a contextual warning instead.
|
|
222
|
+
const isDevInstall = (() => {
|
|
223
|
+
if (!cache.installed || !cache.latest || cache.latest === 'unknown') return false;
|
|
224
|
+
const parseV = v => v.replace(/^v/, '').split('.').map(Number);
|
|
225
|
+
const [ai, bi, ci] = parseV(cache.installed);
|
|
226
|
+
const [an, bn, cn] = parseV(cache.latest);
|
|
227
|
+
return ai > an || (ai === an && bi > bn) || (ai === an && bi === bn && ci > cn);
|
|
228
|
+
})();
|
|
229
|
+
if (isDevInstall) {
|
|
230
|
+
gsdUpdate += '\x1b[33m⚠ dev install — re-run installer to sync hooks\x1b[0m │ ';
|
|
231
|
+
} else {
|
|
232
|
+
gsdUpdate += '\x1b[31m⚠ stale hooks — run /gsd-update\x1b[0m │ ';
|
|
233
|
+
}
|
|
112
234
|
}
|
|
113
235
|
} catch (e) {}
|
|
114
236
|
}
|
|
115
237
|
|
|
116
238
|
// Output
|
|
117
239
|
const dirname = path.basename(dir);
|
|
118
|
-
|
|
119
|
-
|
|
240
|
+
const middle = task
|
|
241
|
+
? `\x1b[1m${task}\x1b[0m`
|
|
242
|
+
: gsdStateStr
|
|
243
|
+
? `\x1b[2m${gsdStateStr}\x1b[0m`
|
|
244
|
+
: null;
|
|
245
|
+
|
|
246
|
+
if (middle) {
|
|
247
|
+
process.stdout.write(`${gsdUpdate}\x1b[2m${model}\x1b[0m │ ${middle} │ \x1b[2m${dirname}\x1b[0m${ctx}`);
|
|
120
248
|
} else {
|
|
121
249
|
process.stdout.write(`${gsdUpdate}\x1b[2m${model}\x1b[0m │ \x1b[2m${dirname}\x1b[0m${ctx}`);
|
|
122
250
|
}
|
|
@@ -124,3 +252,9 @@ process.stdin.on('end', () => {
|
|
|
124
252
|
// Silent fail - don't break statusline on parse errors
|
|
125
253
|
}
|
|
126
254
|
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Export helpers for unit tests. Harmless when run as a script.
|
|
258
|
+
module.exports = { readGsdState, parseStateMd, formatGsdState };
|
|
259
|
+
|
|
260
|
+
if (require.main === module) runStatusline();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// gsd-hook-version: 1.
|
|
2
|
+
// gsd-hook-version: 1.37.1
|
|
3
3
|
// GSD Workflow Guard — PreToolUse hook
|
|
4
4
|
// Detects when Antigravity attempts file edits outside a GSD workflow context
|
|
5
5
|
// (no active /gsd- skill or Task subagent) and injects an advisory warning.
|