@tekyzinc/gsd-t 2.22.0 → 2.24.6

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.
@@ -117,6 +117,18 @@ GSD-T reads all state files and tells you exactly where you left off.
117
117
  | `/user:gsd-t-version-update-all` | Update GSD-T + all registered projects | Manual |
118
118
  | `/user:gsd-t-triage-and-merge` | Auto-review, merge, and publish GitHub branches | Manual |
119
119
 
120
+ ### Backlog Management
121
+
122
+ | Command | Purpose | Auto |
123
+ |---------|---------|------|
124
+ | `/user:gsd-t-backlog-add` | Capture item, auto-categorize, append to backlog | Manual |
125
+ | `/user:gsd-t-backlog-list` | Filtered, ordered view of backlog items | Manual |
126
+ | `/user:gsd-t-backlog-move` | Reorder items by position (priority) | Manual |
127
+ | `/user:gsd-t-backlog-edit` | Modify backlog entry fields | Manual |
128
+ | `/user:gsd-t-backlog-remove` | Drop item with optional reason | Manual |
129
+ | `/user:gsd-t-backlog-promote` | Refine, classify, launch GSD-T workflow | Manual |
130
+ | `/user:gsd-t-backlog-settings` | Manage types, apps, categories, defaults | Manual |
131
+
120
132
  ---
121
133
 
122
134
  ## Workflow Phases
@@ -1,6 +1,6 @@
1
1
  # Architecture — GSD-T Framework (@tekyzinc/gsd-t)
2
2
 
3
- ## Last Updated: 2026-02-18
3
+ ## Last Updated: 2026-02-18 (Post-M9)
4
4
 
5
5
  ## System Overview
6
6
 
@@ -8,36 +8,100 @@ GSD-T is an npm-distributed methodology framework for Claude Code. It provides s
8
8
 
9
9
  The framework has no runtime — it is consumed entirely by Claude Code's slash command system and the user's shell. The CLI handles installation, updates, and diagnostics. The command files define the workflow methodology that Claude Code follows.
10
10
 
11
+ **Architecture Pattern**: Distributed Markdown Instruction System with CLI Lifecycle Manager. Command files are the "source code" interpreted by Claude Code. The CLI is a lifecycle manager (install/update/init/status/doctor/uninstall). State files persist across sessions as git-tracked Markdown.
12
+
11
13
  ## Components
12
14
 
13
15
  ### CLI Installer (bin/gsd-t.js)
14
16
  - **Purpose**: Install, update, diagnose, and manage GSD-T across projects
15
- - **Location**: `bin/gsd-t.js`
17
+ - **Location**: `bin/gsd-t.js` (1,298 lines, 81 functions, 49 exports)
16
18
  - **Dependencies**: Node.js built-ins only (fs, path, os, child_process, https)
17
19
  - **Subcommands**: install, update, status, doctor, init, uninstall, update-all, register, changelog
20
+ - **Organization**: Configuration → Guard section → Helpers → Heartbeat → Commands → Install/Update → Init → Status → Uninstall → Update-All → Doctor → Register → Update Check → Help → Main dispatch
21
+ - **All functions ≤ 30 lines** (M6 refactoring). Largest: `doRegister()` at 30 lines, `summarize()` at 30 lines.
18
22
 
19
23
  ### Slash Commands (commands/*.md)
20
24
  - **Purpose**: Define the GSD-T methodology as executable workflows for Claude Code
21
25
  - **Location**: `commands/`
22
- - **Count**: 41 (37 GSD-T workflow + 4 utility)
23
- - **Format**: Pure markdown with step-numbered instructions, team mode blocks, and document ripple sections
26
+ - **Count**: 43 (39 GSD-T workflow + 4 utility: gsd, branch, checkin, Claude-md)
27
+ - **Format**: Pure markdown with step-numbered instructions, team mode blocks, document ripple sections, and $ARGUMENTS terminator
24
28
 
25
29
  ### Templates (templates/*.md)
26
30
  - **Purpose**: Starter files for project initialization
27
31
  - **Location**: `templates/`
28
32
  - **Count**: 9 (CLAUDE-global, CLAUDE-project, requirements, architecture, workflows, infrastructure, progress, backlog, backlog-settings)
29
- - **Tokens**: `{Project Name}`, `{Date}`, `{app}` replaced during init
33
+ - **Tokens**: `{Project Name}` and `{Date}` replaced during init via `applyTokens()`
30
34
 
31
- ### Heartbeat System (scripts/gsd-t-heartbeat.js)
32
- - **Purpose**: Real-time event logging via Claude Code hooks
33
- - **Location**: `scripts/gsd-t-heartbeat.js`
34
- - **Output**: `.gsd-t/heartbeat-{session}.jsonl` files
35
+ ### Hook Scripts (scripts/)
36
+ - **gsd-t-heartbeat.js** (181 lines, 6 functions, 5 exports): Real-time event logging via Claude Code hooks. Captures 9 event types as structured JSONL. Input capped at 1MB. Session ID validated. Path traversal protection. Secret scrubbing via `scrubSecrets()`/`scrubUrl()` (M5). Notification message + title scrubbing (M8/M9). EVENT_HANDLERS map pattern (M6). Auto-cleanup after 7 days (SessionStart only, M6).
37
+ - **npm-update-check.js** (43 lines): Background npm registry version checker. Spawned detached by CLI when update cache is stale. Path validation within `~/.claude/` (M5). Symlink check before write (M5). 1MB response limit (M5).
38
+ - **gsd-t-fetch-version.js** (26 lines, NEW in M6): Synchronous npm registry fetch. Called by `fetchVersionSync()` via `execFileSync`. HTTPS-only, 5s timeout, 1MB limit. Silent failure on errors (caller validates).
35
39
 
36
40
  ### Examples (examples/)
37
41
  - **Purpose**: Reference project structure and settings
38
42
  - **Location**: `examples/`
39
43
  - **Contents**: settings.json, .gsd-t/ with sample contracts and domain structure
40
44
 
45
+ ## Data Flow
46
+
47
+ ### Installation Flow
48
+ ```
49
+ npm install @tekyzinc/gsd-t → bin/gsd-t.js install
50
+ ├── Copy commands/*.md → ~/.claude/commands/
51
+ ├── Copy/append templates/CLAUDE-global.md → ~/.claude/CLAUDE.md
52
+ ├── Copy scripts/gsd-t-heartbeat.js → ~/.claude/scripts/
53
+ ├── Configure 9 hooks in ~/.claude/settings.json
54
+ └── Write version to ~/.claude/.gsd-t-version
55
+ ```
56
+
57
+ ### Project Initialization Flow
58
+ ```
59
+ gsd-t init [name] → templates/ → applyTokens()
60
+ ├── → {project}/CLAUDE.md
61
+ ├── → {project}/docs/{requirements,architecture,workflows,infrastructure}.md
62
+ ├── → {project}/.gsd-t/{progress,backlog,backlog-settings}.md
63
+ └── → {project}/.gsd-t/{contracts,domains}/.gitkeep
64
+ ```
65
+
66
+ ### Runtime Command Execution (within Claude Code)
67
+ ```
68
+ User types /user:gsd-t-{command} [args]
69
+ → Claude Code loads ~/.claude/commands/gsd-t-{command}.md
70
+ → Claude interprets step-by-step instructions
71
+ → Reads state files → Executes workflow → Pre-Commit Gate → Updates progress.md
72
+ ```
73
+
74
+ ### Update Check Flow
75
+ ```
76
+ CLI command → Read cache (~/.claude/.gsd-t-update-check)
77
+ ├── Fresh (<1h): Show notice if latest > installed
78
+ ├── No cache: Synchronous fetch → cache → show notice
79
+ └── Stale (>1h): Spawn background scripts/npm-update-check.js
80
+ ```
81
+
82
+ ## Configuration Model
83
+
84
+ Three-tier configuration:
85
+
86
+ | Layer | Location | Purpose |
87
+ |-------|----------|---------|
88
+ | **Global** | `~/.claude/CLAUDE.md` | Framework defaults: autonomy rules, code standards, pre-commit gate |
89
+ | **Project** | `{cwd}/CLAUDE.md` | Project-specific: tech stack, branch guard, conventions, overrides |
90
+ | **State** | `{cwd}/.gsd-t/` | Live state: progress, contracts, domains, backlog, scan results |
91
+
92
+ ## State Files
93
+
94
+ | File | Purpose | Read By | Written By |
95
+ |------|---------|---------|------------|
96
+ | `progress.md` | Master state, version, decision log | All commands | Most commands |
97
+ | `contracts/*.md` | Domain interfaces | execute, integrate, verify | partition |
98
+ | `domains/{name}/scope.md` | File ownership | execute, quick | partition |
99
+ | `domains/{name}/tasks.md` | Task list | execute, status, resume | plan, execute |
100
+ | `backlog.md` | Priority-ordered backlog | backlog-list, status | backlog-add/edit/move/remove |
101
+ | `backlog-settings.md` | Types, apps, categories | backlog-add/edit/settings | backlog-settings, init |
102
+ | `techdebt.md` | Prioritized tech debt | promote-debt, scan | scan |
103
+ | `scan/*.md` | Codebase analysis | scan (synthesis), setup | scan (teammates) |
104
+
41
105
  ## Data Models
42
106
 
43
107
  ### Progress State (.gsd-t/progress.md)
@@ -45,14 +109,14 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
45
109
  |-------|------|-------|
46
110
  | Project | string | Name from CLAUDE.md |
47
111
  | Version | semver | Major.Minor.Patch |
48
- | Status | enum | INITIALIZED, IN_PROGRESS, READY |
112
+ | Status | enum | READY, INITIALIZED, PARTITIONED, DISCUSSED, PLANNED, IMPACT_ANALYZED, EXECUTING, EXECUTED, TESTS_SYNCED, INTEGRATED, VERIFIED, VERIFY_FAILED, COMPLETED |
49
113
  | Current Milestone | string | Active milestone name or "None" |
50
114
  | Decision Log | entries | Timestamped log of all changes |
51
115
 
52
116
  ### Backlog (.gsd-t/backlog.md)
53
117
  | Field | Type | Notes |
54
118
  |-------|------|-------|
55
- | ID | Bn | Sequential backlog item ID |
119
+ | Position | integer | Sequential, 1 = highest priority |
56
120
  | Type | enum | bug, feature, improvement, ux, architecture |
57
121
  | App | string | Target application |
58
122
  | Category | string | Domain/module category |
@@ -61,14 +125,60 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
61
125
  ### Contracts (.gsd-t/contracts/)
62
126
  | Contract | Purpose |
63
127
  |----------|---------|
64
- | command-interface-contract.md | Slash command file format and structure |
65
- | file-format-contract.md | File naming and organization rules |
128
+ | backlog-command-interface.md | Backlog command interface and promote flow |
66
129
  | integration-points.md | How components connect |
67
- | backlog-file-formats.md | Backlog markdown structure |
130
+ | backlog-file-formats.md | Backlog markdown structure (authoritative — duplicate file-format-contract.md deleted in M9) |
68
131
  | domain-structure.md | Domain directory layout |
69
132
  | pre-commit-gate.md | Commit checklist contract |
70
133
  | progress-file-format.md | Progress.md structure |
71
134
  | wave-phase-sequence.md | Phase ordering rules |
135
+ | qa-agent-contract.md | QA agent spawn interface, output per phase, communication protocol |
136
+
137
+ ## Workflow Phase Architecture
138
+
139
+ ```
140
+ PARTITION → DISCUSS → PLAN → IMPACT → EXECUTE → TEST-SYNC → INTEGRATE → VERIFY → COMPLETE
141
+ ```
142
+
143
+ | Phase | Mode | QA Agent | Why |
144
+ |-------|------|----------|-----|
145
+ | Partition | Solo only | YES — test skeletons | Needs full cross-domain context |
146
+ | Discuss | Solo only | No | Always pauses for user input (even Level 3) |
147
+ | Plan | Solo only | YES — acceptance scenarios | Needs full cross-domain context |
148
+ | Impact | Solo only | No | Cross-cutting analysis |
149
+ | Execute | Solo or Team | YES — continuous testing | Tasks within domains are independent |
150
+ | Test-Sync | Solo only | YES — coverage audit | Sequential verification |
151
+ | Integrate | Solo only | YES — boundary tests | Needs to see all seams |
152
+ | Verify | Solo or Team | YES — full audit | Dimensions are independent |
153
+ | Complete | Solo only | YES — final gate | Archival and tagging |
154
+
155
+ ### Wave Orchestrator (Agent-Per-Phase Model)
156
+
157
+ The wave command spawns an independent agent for each phase via the Task tool with `bypassPermissions`. Each phase agent gets a fresh ~200K token context window, eliminating context accumulation and mid-wave compaction. The orchestrator itself stays lightweight (~30KB), reading only `progress.md` and `CLAUDE.md`. State handoff between phases occurs through `.gsd-t/` files.
158
+
159
+ ### QA Agent Integration
160
+
161
+ 10 commands spawn a QA teammate (`commands/gsd-t-qa.md`) for test-driven contract enforcement. QA behavior is phase-dependent: test skeletons during partition, continuous testing during execute, full audit during verify. QA failure blocks phase completion (user override available). Communication protocol: `QA: {PASS|FAIL} — {summary}`.
162
+
163
+ ### Test Suite (test/)
164
+ - **helpers.test.js** (27 tests): Pure helper functions — validateProjectName, applyTokens, isNewerVersion, normalizeEol, etc.
165
+ - **filesystem.test.js** (37 tests): Filesystem helpers + CLI subcommand integration — ensureDir, isSymlink, writeTemplateFile, status/doctor/help outputs
166
+ - **security.test.js** (30 tests): Security functions — scrubSecrets (18), scrubUrl (5), summarize integration (4), hasSymlinkInPath (3)
167
+ - **cli-quality.test.js** (22 tests): M6 refactored functions — buildEvent (10), readProjectDeps (3), readPyContent (2), insertGuardSection (3), readUpdateCache (1), addHeartbeatHook (3)
168
+ - **Runner**: Node.js built-in (`node --test`), zero test dependencies
169
+ - **Total**: 116 tests, all passing
170
+
171
+ ## Security Model
172
+
173
+ - **Zero dependencies**: No supply chain attack surface
174
+ - **Symlink protection**: `isSymlink()` at 15+ write sites + `hasSymlinkInPath()` for parent directory validation (M5)
175
+ - **Secret scrubbing**: `scrubSecrets()` masks passwords/tokens/API keys in heartbeat logs; `scrubUrl()` masks URL query params (M5)
176
+ - **Input validation**: Project names, version strings, session IDs, project paths all validated
177
+ - **Path traversal prevention**: Heartbeat validates session_id regex, resolves paths, verifies containment; npm-update-check validates cache path within `~/.claude/` (M5)
178
+ - **Command injection mitigation**: `execFileSync` with array args (not `execSync`)
179
+ - **Exclusive file creation**: Init uses `{ flag: "wx" }` for atomic create-or-fail
180
+ - **Resource limits**: Heartbeat stdin capped at 1MB, HTTP responses capped at 1MB (M5), 5s/8s timeouts, 7-day file cleanup
181
+ - **Wave security**: `bypassPermissions` mode documented with attack surface analysis and mitigations (M5)
72
182
 
73
183
  ## Design Decisions
74
184
 
@@ -80,3 +190,13 @@ The framework has no runtime — it is consumed entirely by Claude Code's slash
80
190
  | 2026-02-12 | Heartbeat via Claude Code hooks | Non-invasive monitoring, no command file changes needed | Polling, WebSocket |
81
191
  | 2026-02-13 | Semantic router over keyword matching | Better intent detection, fewer misroutes | Regex patterns, ML classifier |
82
192
  | 2026-02-16 | Mandatory Playwright for all projects | Consistent E2E testing, no "we'll add tests later" | Optional testing, Jest-only |
193
+ | 2026-02-16 | Team mode default for scan | Parallel scanning faster, better results | Solo sequential scan |
194
+ | 2026-02-17 | QA Agent as cross-cutting concern | Mandatory test-driven contracts for all code phases | Optional testing, deferred testing |
195
+ | 2026-02-17 | Agent-per-phase wave orchestration | Fresh context window per phase, eliminates compaction | Inline execution (original approach) |
196
+
197
+ ## Known Architecture Concerns
198
+
199
+ 1. **CLI single-file size**: bin/gsd-t.js at 1,298 lines exceeds the 200-line convention, but splitting adds complexity for questionable benefit given zero-dependency constraint. Accepted deviation.
200
+ 2. **Four-file synchronization**: Any command change requires updating README, GSD-T-README, CLAUDE-global template, and gsd-t-help. Manual process — no automated validation.
201
+ 3. **Pre-Commit Gate unenforced**: Mental checklist in CLAUDE.md, not a git hook or CI check.
202
+ 4. **Progress.md Decision Log growth**: Unbounded append-only log. May need periodic archival strategy for long-lived projects.
@@ -1,6 +1,6 @@
1
1
  # Infrastructure — GSD-T Framework (@tekyzinc/gsd-t)
2
2
 
3
- ## Last Updated: 2026-02-18
3
+ ## Last Updated: 2026-02-18 (Scan #5)
4
4
 
5
5
  ## Quick Reference
6
6
 
@@ -12,7 +12,8 @@
12
12
  | Update all projects | `npx @tekyzinc/gsd-t update-all` |
13
13
  | Diagnose issues | `npx @tekyzinc/gsd-t doctor` |
14
14
  | View changelog | `npx @tekyzinc/gsd-t changelog` |
15
- | Publish to npm | `npm publish` |
15
+ | Register project | `npx @tekyzinc/gsd-t register` |
16
+ | Publish to npm | `npm publish` (runs `npm test` automatically via prepublishOnly) |
16
17
 
17
18
  ## Local Development
18
19
 
@@ -29,44 +30,65 @@ node bin/gsd-t.js status
29
30
 
30
31
  ### Testing
31
32
  ```bash
32
- # Test CLI subcommands
33
+ # Run automated test suite (116 tests, zero dependencies)
34
+ npm test
35
+
36
+ # Test CLI subcommands manually
33
37
  node bin/gsd-t.js install
34
38
  node bin/gsd-t.js status
35
39
  node bin/gsd-t.js doctor
36
40
  node bin/gsd-t.js init test-project
37
41
 
38
42
  # Validate command files exist
39
- ls commands/*.md | wc -l # Should be 41
43
+ ls commands/*.md | wc -l # Should be 43
40
44
  ls templates/*.md | wc -l # Should be 9
41
45
  ```
42
46
 
47
+ ### Scripts
48
+ | Script | Purpose |
49
+ |--------|---------|
50
+ | `scripts/gsd-t-heartbeat.js` | Claude Code hook event logger (JSONL output, secret scrubbing) |
51
+ | `scripts/npm-update-check.js` | Background npm registry version checker (path-validated) |
52
+ | `scripts/gsd-t-fetch-version.js` | Synchronous npm registry fetch (5s timeout, 1MB limit) |
53
+
43
54
  ## Distribution
44
55
 
45
56
  ### npm Package
46
57
  - **Registry**: https://www.npmjs.com/package/@tekyzinc/gsd-t
47
58
  - **Publish**: `npm publish` (requires npm login with Tekyz account)
48
59
  - **Version**: Managed in `package.json`, synced to `.gsd-t/progress.md`
60
+ - **Files shipped**: `bin/`, `commands/`, `scripts/`, `templates/`, `examples/`, `docs/`, `CHANGELOG.md`
49
61
 
50
62
  ### Installed Locations
51
63
  | What | Where |
52
64
  |------|-------|
53
- | Slash commands | `~/.claude/commands/` |
65
+ | Slash commands (43 files) | `~/.claude/commands/` |
54
66
  | Global config | `~/.claude/CLAUDE.md` |
55
- | Heartbeat hook | `~/.claude/settings.json` (hooks section) |
56
- | Version cache | `~/.claude/.gsd-t-version` |
57
- | Update cache | `~/.claude/.gsd-t-update-cache` |
67
+ | Heartbeat script | `~/.claude/scripts/gsd-t-heartbeat.js` |
68
+ | Hook configuration | `~/.claude/settings.json` (hooks section) |
69
+ | Version file | `~/.claude/.gsd-t-version` |
70
+ | Update cache | `~/.claude/.gsd-t-update-check` |
58
71
  | Project registry | `~/.claude/.gsd-t-projects` |
59
72
 
60
73
  ## Repository Structure
61
74
 
62
75
  ```
63
76
  get-stuff-done-teams/
64
- ├── bin/gsd-t.js — CLI (zero dependencies)
65
- ├── commands/ — 41 slash command files
77
+ ├── bin/gsd-t.js — CLI installer (~1,300 lines, zero dependencies)
78
+ ├── commands/ — 43 slash command files (39 GSD-T + 4 utility)
79
+ ├── scripts/ — 3 hook/utility scripts
66
80
  ├── templates/ — 9 document templates
67
- ├── scripts/ — Heartbeat hook script
68
81
  ├── examples/ — Reference project structure
69
82
  ├── docs/ — Methodology + living docs
70
83
  ├── .gsd-t/ — GSD-T state (self-managed)
71
84
  └── package.json — npm package config
72
85
  ```
86
+
87
+ ## Security Notes
88
+
89
+ - Zero npm dependencies — no supply chain risk
90
+ - All file writes check for symlinks first
91
+ - Input validation on project names, versions, session IDs, paths
92
+ - Heartbeat stdin capped at 1MB
93
+ - HTTP requests use HTTPS with timeouts
94
+ - Init operations use exclusive file creation (`{ flag: "wx" }`)
@@ -1,21 +1,24 @@
1
1
  # Requirements — GSD-T Framework (@tekyzinc/gsd-t)
2
2
 
3
- ## Last Updated: 2026-02-18
3
+ ## Last Updated: 2026-02-18 (Scan #5)
4
4
 
5
5
  ## Functional Requirements
6
6
 
7
7
  | ID | Requirement | Priority | Status | Tests |
8
8
  |----|-------------|----------|--------|-------|
9
9
  | REQ-001 | CLI installer with install, update, status, doctor, init, uninstall, update-all, register, changelog subcommands | P1 | complete | manual CLI testing |
10
- | REQ-002 | 37 GSD-T workflow slash commands for Claude Code | P1 | complete | validated by use |
11
- | REQ-003 | 4 utility commands (branch, checkin, Claude-md, gsd smart router) | P1 | complete | validated by use |
10
+ | REQ-002 | 39 GSD-T workflow slash commands for Claude Code (incl. QA agent) | P1 | complete | validated by use |
11
+ | REQ-003 | 4 utility commands (gsd smart router, branch, checkin, Claude-md) | P1 | complete | validated by use |
12
12
  | REQ-004 | Backlog management system (7 commands: add, list, move, edit, remove, promote, settings) | P1 | complete | validated by use |
13
13
  | REQ-005 | Contract-driven development with domain partitioning | P1 | complete | validated by use |
14
- | REQ-006 | Wave orchestration (full cycle: partition → plan → execute → test-sync → integrate → verify) | P1 | complete | validated by use |
15
- | REQ-007 | Heartbeat system via Claude Code hooks | P2 | complete | hook scripts installed |
16
- | REQ-008 | Automatic update check against npm registry | P2 | complete | CLI + slash command |
17
- | REQ-009 | Document templates for living docs (9 templates) | P1 | complete | used by gsd-t-init |
14
+ | REQ-006 | Wave orchestration (full cycle: partition → discuss → plan → impact → execute → test-sync → integrate → verify → complete) | P1 | complete | validated by use |
15
+ | REQ-007 | Heartbeat system via Claude Code hooks (9 events, JSONL output, 7-day cleanup) | P2 | complete | hook scripts installed |
16
+ | REQ-008 | Automatic update check against npm registry (1h cache, background refresh) | P2 | complete | CLI + slash command |
17
+ | REQ-009 | Document templates for living docs (9 templates with token replacement) | P1 | complete | used by gsd-t-init |
18
18
  | REQ-010 | Smart router — natural language intent → command routing | P2 | complete | validated by use |
19
+ | REQ-011 | Triage and merge — auto-review, score, merge safe GitHub branches | P2 | complete | validated by use |
20
+ | REQ-012 | QA Agent — test-driven contract enforcement spawned in 10 phases | P1 | complete | validated by use |
21
+ | REQ-013 | Wave orchestrator — agent-per-phase execution with fresh context windows | P1 | complete | validated by use |
19
22
 
20
23
  ## Technical Requirements
21
24
 
@@ -25,19 +28,46 @@
25
28
  | TECH-002 | Node.js >= 16 compatibility | P1 | complete |
26
29
  | TECH-003 | Cross-platform support (macOS, Linux, Windows) | P1 | complete |
27
30
  | TECH-004 | Semantic versioning with git tags | P1 | complete |
28
- | TECH-005 | Pre-Commit Gate enforced on every commit | P1 | complete |
31
+ | TECH-005 | Pre-Commit Gate enforced on every commit | P1 | complete (manual, not automated) |
32
+ | TECH-006 | Symlink protection on all file write operations | P1 | complete |
33
+ | TECH-007 | Input validation on project names, versions, paths, session IDs | P1 | complete |
34
+ | TECH-008 | prepublishOnly gate — `npm test` runs before `npm publish` | P1 | complete (M8) |
29
35
 
30
36
  ## Non-Functional Requirements
31
37
 
32
38
  | ID | Requirement | Metric | Status |
33
39
  |----|-------------|--------|--------|
34
- | NFR-001 | CLI install completes in < 5 seconds | < 5s | complete |
40
+ | NFR-001 | CLI install completes quickly | < 5s | complete |
35
41
  | NFR-002 | No runtime crashes on missing files | graceful fallback | complete |
36
42
  | NFR-003 | Command files are pure markdown (no frontmatter) | 100% compliance | complete |
43
+ | NFR-004 | Heartbeat auto-cleanup prevents unbounded growth | 7-day TTL | complete |
44
+ | NFR-005 | Update check is non-blocking after first run | background process | complete |
37
45
 
38
46
  ## Test Coverage
39
47
 
40
48
  | Requirement | Test File | Test Name | Status |
41
49
  |-------------|-----------|-----------|--------|
42
- | REQ-001 | manual | CLI subcommand testing | passing |
43
- | REQ-002–010 | manual | Workflow validation by use | passing |
50
+ | REQ-001 | test/helpers.test.js, test/filesystem.test.js | CLI subcommand + helper tests | passing (64 tests) |
51
+ | REQ-006 | test/cli-quality.test.js | Wave-related function tests (buildEvent, etc.) | passing (22 tests) |
52
+ | REQ-007 | test/security.test.js | Heartbeat security (scrubSecrets, scrubUrl) | passing (30 tests) |
53
+ | REQ-002–005, 008–013 | manual | Workflow validation by use | passing |
54
+
55
+ **Total automated tests**: 116 across 4 test files (M4, M5, M6). Runner: `node --test` (zero dependencies).
56
+
57
+ ## Gaps Identified
58
+
59
+ ### Open (Scan #5 — 2026-02-18)
60
+ - 10 new LOW items: TD-056 through TD-065 (cosmetic code quality, documentation fixes, contract alignment)
61
+ - See `.gsd-t/techdebt.md` for full list (all LOW severity, no functional issues)
62
+
63
+ ### Resolved (Milestones 3-8, 2026-02-18/19)
64
+ - ~~All scan #4 items (TD-044-TD-055)~~ — RESOLVED (M8)
65
+ - ~~No automated test suite (TD-003)~~ — RESOLVED (116 tests, M4)
66
+ - ~~Command count 42→43 not updated (TD-022)~~ — RESOLVED (M3)
67
+ - ~~QA agent contract missing test-sync (TD-042)~~ — RESOLVED (M3)
68
+ - ~~Wave bypassPermissions not documented (TD-035)~~ — RESOLVED (M5)
69
+ - ~~All 15 scan #3 functions >30 lines (TD-021)~~ — RESOLVED (M6, all 81 functions ≤30 lines)
70
+ - ~~34 fractional step numbers (TD-031)~~ — RESOLVED (M7, all renumbered)
71
+ - ~~Backlog file format drift (TD-014)~~ — RESOLVED
72
+ - ~~Progress.md format drift (TD-015)~~ — RESOLVED
73
+ - ~~7 backlog commands missing from GSD-T-README (TD-016)~~ — RESOLVED
package/docs/workflows.md CHANGED
@@ -1,67 +1,120 @@
1
1
  # Workflows — GSD-T Framework (@tekyzinc/gsd-t)
2
2
 
3
- ## Last Updated: 2026-02-18
3
+ ## Last Updated: 2026-02-18 (Scan #5)
4
4
 
5
5
  ## User Workflows
6
6
 
7
7
  ### Install GSD-T
8
8
  1. Run `npx @tekyzinc/gsd-t install`
9
- 2. CLI copies commands to `~/.claude/commands/`
10
- 3. CLI sets up global CLAUDE.md if missing
11
- 4. CLI installs heartbeat hooks
12
- 5. User starts Claude Code in their project
9
+ 2. CLI copies 43 commands to `~/.claude/commands/`
10
+ 3. CLI sets up global CLAUDE.md if missing (appends with separator if exists)
11
+ 4. CLI installs heartbeat script to `~/.claude/scripts/`
12
+ 5. CLI configures 9 hooks in `~/.claude/settings.json`
13
+ 6. CLI saves version to `~/.claude/.gsd-t-version`
14
+ 7. User starts Claude Code in their project
13
15
 
14
16
  **Entry point**: `npx @tekyzinc/gsd-t install`
15
- **Success**: 41 commands available in Claude Code
17
+ **Success**: 43 commands available in Claude Code
16
18
  **Failure**: CLI reports missing Node.js or permission errors
17
19
 
18
20
  ### Initialize a Project
19
- 1. User runs `/gsd-t-init` in Claude Code
20
- 2. Init creates `.gsd-t/` directory structure
21
- 3. Init creates or updates CLAUDE.md
22
- 4. Init creates `docs/` living documents if missing
23
- 5. Init scans existing codebase if code exists
21
+ 1. User runs `/gsd-t-init [name]` in Claude Code (or `gsd-t init [name]` CLI)
22
+ 2. Init creates `.gsd-t/` directory with progress.md, backlog.md, backlog-settings.md, contracts/, domains/
23
+ 3. Init creates or updates CLAUDE.md (project-level) using template with token replacement
24
+ 4. Init creates `docs/` living documents (requirements, architecture, workflows, infrastructure) if missing
25
+ 5. Init auto-registers project in `~/.claude/.gsd-t-projects`
26
+ 6. All file creation uses `{ flag: "wx" }` — never overwrites existing files
24
27
 
25
- **Entry point**: `/gsd-t-init` slash command
28
+ **Entry point**: `/gsd-t-init` slash command or `gsd-t init` CLI
26
29
  **Success**: Project ready for milestone definition
27
- **Failure**: Reports what couldn't be created
30
+ **Failure**: Reports what couldn't be created (existing files preserved)
28
31
 
29
32
  ### Full Wave Cycle
30
33
  1. User defines milestone via `/gsd-t-milestone`
31
- 2. Partition decomposes into domains + contracts
32
- 3. Plan creates task lists per domain
33
- 4. Execute implements tasks (solo or team)
34
- 5. Test-sync aligns tests with code changes
35
- 6. Integrate wires domains together
36
- 7. Verify runs quality gates
37
- 8. Complete-milestone archives and tags
38
-
39
- **Entry point**: `/gsd-t-wave` or manual phase-by-phase
34
+ 2. **Partition**: Decompose into domains + contracts (file ownership, interfaces)
35
+ 3. **Discuss**: Explore design decisions (always pauses, even Level 3) — SKIPPABLE via structured 3-condition check: single domain, no open questions in Decision Log, all cross-domain contracts exist (M7)
36
+ 4. **Plan**: Create atomic task lists per domain with dependencies
37
+ 5. **Impact**: Analyze downstream effects (PROCEED / CAUTION / BLOCK verdicts)
38
+ 6. **Execute**: Implement tasks (solo or team mode based on domain count)
39
+ 7. **Test-Sync**: Align tests with code changes, verify coverage
40
+ 8. **Integrate**: Wire domains at boundaries, verify contracts honored
41
+ 9. **Verify**: Run 7 quality gate dimensions (functional, contracts, quality, tests, E2E, security, integration)
42
+ 10. **Complete**: Archive to `.gsd-t/milestones/`, bump version, git tag
43
+
44
+ **Entry point**: `/gsd-t-wave` (auto-advances) or manual phase-by-phase
40
45
  **Success**: Milestone completed, version bumped, git tagged
41
- **Failure**: Wave pauses at failing phase, user can fix and resume
46
+ **Failure**: Wave pauses at failing phase; user can fix and resume
47
+
48
+ ### Autonomy Levels
49
+ | Level | Behavior |
50
+ |-------|----------|
51
+ | Level 1 (Supervised) | Pause at each phase for confirmation |
52
+ | Level 2 (Standard) | Pause only at milestones |
53
+ | Level 3 (Full Auto) | Auto-advance; only stop for Destructive Guard, Impact BLOCK, errors after 2 attempts, Discuss |
54
+
55
+ ### Error Recovery (2-Attempt Rule)
56
+ | Failure | Recovery | After 2 Failures |
57
+ |---------|----------|-------------------|
58
+ | Impact BLOCK | Add remediation tasks, re-run | STOP and report |
59
+ | Test failures | Fix and re-run | STOP and report |
60
+ | Verify failure | Remediate and re-verify | STOP and report |
61
+ | Gap analysis gaps | Auto-fix and re-analyze | STOP and report |
42
62
 
43
63
  ## Technical Workflows
44
64
 
45
65
  ### CLI Update Check
46
- 1. CLI reads cached version from `~/.claude/.gsd-t-update-cache`
47
- 2. If cache is older than 1 hour, query npm registry
48
- 3. Compare installed vs. latest using semver
49
- 4. Display update notice if newer version available
66
+ 1. CLI reads cached version from `~/.claude/.gsd-t-update-check` (JSON: `{ latest, timestamp }`)
67
+ 2. If cache is fresh (<1 hour): show notice if cached latest > installed
68
+ 3. If no cache: synchronous fetch to npm registry (8s timeout), cache result
69
+ 4. If cache stale (>1 hour): spawn detached background `scripts/npm-update-check.js`
70
+ 5. Compare versions using `isNewerVersion()` semver comparison
50
71
 
51
- **Trigger**: Every CLI invocation and `/gsd-t-status`
52
- **Frequency**: Cached, actual fetch at most once per hour
72
+ **Trigger**: Every CLI invocation (except install/update/update-all)
73
+ **Also**: `/gsd-t-status` slash command checks independently
53
74
 
54
75
  ### Heartbeat Event Logging
55
- 1. Claude Code hook fires on tool call or notification
56
- 2. `gsd-t-heartbeat.js` appends JSONL event to `.gsd-t/heartbeat-{session}.jsonl`
57
- 3. Events include timestamp, type, and context
76
+ 1. Claude Code hook fires (9 events: SessionStart, PostToolUse, SubagentStart, SubagentStop, TaskCompleted, TeammateIdle, Notification, Stop, SessionEnd)
77
+ 2. `settings.json` hook calls `node ~/.claude/scripts/gsd-t-heartbeat.js`
78
+ 3. Script reads JSON from stdin (capped at 1MB)
79
+ 4. Validates session_id (alphanumeric regex), validates path is absolute and within `.gsd-t/`
80
+ 5. Builds structured event with timestamp, type-specific data (tool summaries, file paths)
81
+ 6. Appends JSONL to `.gsd-t/heartbeat-{session_id}.jsonl`
82
+ 7. Runs cleanup: removes heartbeat files older than 7 days
58
83
 
59
84
  **Trigger**: Claude Code hooks (9 event types)
60
85
  **Frequency**: On every hooked event during a session
61
86
 
87
+ ### Version Bump Rules
88
+ | Context | Change Type | Bump |
89
+ |---------|-------------|------|
90
+ | Complete-milestone | Breaking changes, major rework | Major |
91
+ | Complete-milestone | New features, feature milestones | Minor |
92
+ | Complete-milestone | Bug fixes, cleanup | Patch |
93
+ | Checkin | New features, new commands | Minor |
94
+ | Checkin | Bug fixes, docs, refactors | Patch (default) |
95
+ | Checkin | Breaking changes | Major |
96
+
97
+ Updated in: package.json, .gsd-t/progress.md, CHANGELOG.md, git tag
98
+
99
+ ### Pre-Commit Gate
100
+ Every commit must pass applicable checks:
101
+ 1. Branch guard (correct branch?)
102
+ 2. Contract updates (API, schema, component)
103
+ 3. Scope updates (new files → domain scope.md)
104
+ 4. Documentation updates (requirements, architecture)
105
+ 5. Decision Log entry (timestamped in progress.md)
106
+ 6. Tech debt tracking (discovered/fixed?)
107
+ 7. Test execution (affected tests pass?)
108
+
62
109
  ## Integration Workflows
63
110
 
64
111
  ### npm Publish
65
112
  - **Trigger**: Manual `npm publish` after milestone completion
66
- - **Flow**: Version bumped CHANGELOG updated git tagged → npm publish
113
+ - **Pre-publish gate**: `prepublishOnly: "npm test"` runs 116 tests before publish (M8)
114
+ - **Flow**: Version bumped → CHANGELOG updated → git tagged → `npm publish` → tests run automatically → published
67
115
  - **Verification**: `npx @tekyzinc/gsd-t status` on fresh install
116
+
117
+ ### Update All Projects
118
+ - **Trigger**: `gsd-t update-all` CLI command
119
+ - **Flow**: Global update → iterate registered projects → inject Destructive Action Guard → create CHANGELOG → health check (Playwright, Swagger)
120
+ - **Registry**: `~/.claude/.gsd-t-projects` (newline-separated absolute paths)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tekyzinc/gsd-t",
3
- "version": "2.22.0",
4
- "description": "GSD-T: Contract-Driven Development for Claude Code — 42 slash commands with backlog management, impact analysis, test sync, and milestone archival",
3
+ "version": "2.24.6",
4
+ "description": "GSD-T: Contract-Driven Development for Claude Code — 43 slash commands with backlog management, impact analysis, test sync, and milestone archival",
5
5
  "author": "Tekyz, Inc.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -22,7 +22,8 @@
22
22
  "gsd-t": "bin/gsd-t.js"
23
23
  },
24
24
  "scripts": {
25
- "test": "node --test"
25
+ "test": "node --test",
26
+ "prepublishOnly": "npm test"
26
27
  },
27
28
  "files": [
28
29
  "bin/",
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * GSD-T Fetch Version — Synchronous npm registry version check
5
+ *
6
+ * Fetches the latest version of @tekyzinc/gsd-t from the npm registry
7
+ * and writes it to stdout. Used by checkForUpdates() in bin/gsd-t.js.
8
+ *
9
+ * Bounded to 1MB response to prevent OOM.
10
+ */
11
+
12
+ const https = require("https");
13
+
14
+ const MAX_BODY = 1048576; // 1MB
15
+
16
+ https.get("https://registry.npmjs.org/@tekyzinc/gsd-t/latest", { timeout: 5000 }, (res) => {
17
+ let data = "";
18
+ res.on("data", (chunk) => {
19
+ data += chunk;
20
+ if (data.length > MAX_BODY) { res.destroy(); return; }
21
+ });
22
+ res.on("end", () => {
23
+ try { process.stdout.write(JSON.parse(data).version); } catch { /* ignore */ }
24
+ });
25
+ }).on("error", () => { /* silent */ });