@tekyzinc/gsd-t 3.29.11 → 4.0.12

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/bin/gsd-t-parallel.cjs +64 -13
  3. package/bin/gsd-t.js +48 -376
  4. package/bin/journey-coverage.cjs +6 -3
  5. package/bin/parallel-cli.cjs +13 -1
  6. package/commands/gsd-t-debug.md +47 -533
  7. package/commands/gsd-t-design-decompose.md +24 -497
  8. package/commands/gsd-t-doc-ripple.md +23 -139
  9. package/commands/gsd-t-execute.md +41 -958
  10. package/commands/gsd-t-help.md +0 -2
  11. package/commands/gsd-t-impact.md +26 -295
  12. package/commands/gsd-t-integrate.md +44 -369
  13. package/commands/gsd-t-milestone.md +25 -124
  14. package/commands/gsd-t-partition.md +28 -539
  15. package/commands/gsd-t-plan.md +26 -472
  16. package/commands/gsd-t-prd.md +25 -311
  17. package/commands/gsd-t-quick.md +1 -1
  18. package/commands/gsd-t-resume.md +0 -33
  19. package/commands/gsd-t-verify.md +52 -569
  20. package/commands/gsd-t-wave.md +41 -430
  21. package/package.json +1 -1
  22. package/scripts/gsd-t-calibration-hook.js +3 -1
  23. package/scripts/hooks/pre-commit-journey-coverage +0 -2
  24. package/scripts/hooks/pre-commit-playwright-gate +0 -2
  25. package/templates/CLAUDE-global.md +43 -173
  26. package/templates/CLAUDE-project.md +118 -104
  27. package/templates/prompts/design-verify-subagent.md +3 -0
  28. package/templates/prompts/qa-subagent.md +3 -0
  29. package/templates/prompts/red-team-subagent.md +5 -2
  30. package/templates/workflows/_lib.js +176 -0
  31. package/templates/workflows/gsd-t-debug.workflow.js +86 -0
  32. package/templates/workflows/gsd-t-execute.workflow.js +206 -0
  33. package/templates/workflows/gsd-t-integrate.workflow.js +71 -0
  34. package/templates/workflows/gsd-t-phase.workflow.js +94 -0
  35. package/templates/workflows/gsd-t-quick.workflow.js +72 -0
  36. package/templates/workflows/gsd-t-verify.workflow.js +348 -0
  37. package/templates/workflows/gsd-t-wave.workflow.js +43 -0
  38. package/bin/check-headless-sessions.js +0 -140
  39. package/bin/context-budget-audit.cjs +0 -447
  40. package/bin/context-meter-config.cjs +0 -101
  41. package/bin/context-meter-config.test.cjs +0 -101
  42. package/bin/event-stream.cjs +0 -205
  43. package/bin/gsd-t-benchmark-orchestrator.js +0 -437
  44. package/bin/gsd-t-capture-lint.cjs +0 -440
  45. package/bin/gsd-t-economics.cjs +0 -315
  46. package/bin/gsd-t-in-session-usage.cjs +0 -213
  47. package/bin/gsd-t-orchestrator-config.cjs +0 -161
  48. package/bin/gsd-t-orchestrator-queue.cjs +0 -180
  49. package/bin/gsd-t-orchestrator-recover.cjs +0 -231
  50. package/bin/gsd-t-orchestrator-worker.cjs +0 -219
  51. package/bin/gsd-t-orchestrator.js +0 -535
  52. package/bin/gsd-t-parallel-probe.cjs +0 -132
  53. package/bin/gsd-t-ratelimit-probe-worker.cjs +0 -237
  54. package/bin/gsd-t-ratelimit-probe.cjs +0 -648
  55. package/bin/gsd-t-report-tokens.cjs +0 -549
  56. package/bin/gsd-t-stream-feed-client.cjs +0 -151
  57. package/bin/gsd-t-token-backfill.cjs +0 -366
  58. package/bin/gsd-t-token-capture.cjs +0 -321
  59. package/bin/gsd-t-token-dashboard.cjs +0 -353
  60. package/bin/gsd-t-token-regenerate-log.cjs +0 -129
  61. package/bin/gsd-t-tool-attribution.cjs +0 -377
  62. package/bin/gsd-t-tool-cost.cjs +0 -195
  63. package/bin/gsd-t-transcript-tee.cjs +0 -246
  64. package/bin/gsd-t-unattended-heartbeat.cjs +0 -188
  65. package/bin/gsd-t-unattended-platform.cjs +0 -551
  66. package/bin/gsd-t-unattended-platform.js +0 -381
  67. package/bin/gsd-t-unattended-safety.cjs +0 -773
  68. package/bin/gsd-t-unattended-safety.js +0 -788
  69. package/bin/gsd-t-unattended.cjs +0 -2109
  70. package/bin/gsd-t-unattended.js +0 -1367
  71. package/bin/gsd-t-worker-dispatch.cjs +0 -211
  72. package/bin/handoff-lock.cjs +0 -249
  73. package/bin/handoff-lock.js +0 -249
  74. package/bin/headless-auto-spawn.cjs +0 -711
  75. package/bin/headless-auto-spawn.js +0 -373
  76. package/bin/headless-exit-codes.cjs +0 -67
  77. package/bin/live-activity-report.cjs +0 -615
  78. package/bin/log-tail.cjs +0 -81
  79. package/bin/m44-proof-measure.cjs +0 -285
  80. package/bin/m46-iter-proof.cjs +0 -149
  81. package/bin/m46-worker-proof.cjs +0 -201
  82. package/bin/m55-substrate-proof.cjs +0 -134
  83. package/bin/metrics-rollup.js +0 -200
  84. package/bin/model-windows.cjs +0 -99
  85. package/bin/model-windows.test.cjs +0 -75
  86. package/bin/parallelism-report.cjs +0 -535
  87. package/bin/runway-estimator.cjs +0 -242
  88. package/bin/spawn-plan-derive.cjs +0 -163
  89. package/bin/spawn-plan-status-updater.cjs +0 -292
  90. package/bin/spawn-plan-writer.cjs +0 -204
  91. package/bin/supervisor-pid-fingerprint.cjs +0 -126
  92. package/bin/token-budget.cjs +0 -265
  93. package/bin/unattended-watch-format.cjs +0 -178
  94. package/bin/watch-progress.js +0 -155
  95. package/commands/gsd-t-unattended-stop.md +0 -85
  96. package/commands/gsd-t-unattended-watch.md +0 -465
  97. package/commands/gsd-t-unattended.md +0 -476
  98. package/commands/gsd-t-visualize.md +0 -116
  99. package/scripts/gsd-t-context-meter.e2e.test.js +0 -364
  100. package/scripts/gsd-t-context-meter.js +0 -341
  101. package/scripts/gsd-t-context-meter.test.js +0 -471
  102. package/scripts/gsd-t-dashboard-server.js +0 -1203
  103. package/scripts/gsd-t-post-commit-spawn-plan.sh +0 -86
  104. package/scripts/gsd-t-transcript.html +0 -1821
  105. package/scripts/hooks/gsd-t-conversation-capture.js +0 -439
  106. package/scripts/hooks/gsd-t-in-session-usage-hook.js +0 -84
  107. package/scripts/spawn-plan-fmt-tokens.cjs +0 -80
  108. package/templates/hooks/post-commit-spawn-plan.sh +0 -85
@@ -1,237 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- /**
5
- * GSD-T Rate-Limit Probe — Single-Worker Child (M55 D3)
6
- *
7
- * Reads a synthetic context fixture from disk, spawns ONE
8
- * `claude -p --dangerously-skip-permissions` child with a
9
- * deterministic small prompt, captures:
10
- * - ttftMs: spawn-start → first non-empty stdout byte
11
- * - totalMs: spawn-start → child exit
12
- * - status429:true iff stderr matches /rate.?limit/i or exit indicates 429
13
- * - retryAfterMs: parsed from stderr `retry-after` hint when present
14
- * - exitCode: child exit code (or null on signal)
15
- *
16
- * Emits exactly ONE NDJSON line on stdout containing the result envelope.
17
- *
18
- * Usage:
19
- * node bin/gsd-t-ratelimit-probe-worker.cjs \
20
- * --fixture <path> --worker-id <id> --cell-workers <N> \
21
- * --cell-context-tokens <T> --run-idx <i> [--prompt-extra <text>] \
22
- * [--cwd <dir>]
23
- *
24
- * Contract: .gsd-t/contracts/ratelimit-map-contract.md v1.0.0 STABLE
25
- *
26
- * The PARENT (sweep runner) is responsible for:
27
- * - flowing this spawn through `bin/gsd-t-token-capture.cjs::captureSpawn`
28
- * - aggregating multiple worker NDJSON lines into a cell summary
29
- * - throwaway worktree management
30
- *
31
- * This file is the per-worker leaf; it does NOT call captureSpawn itself.
32
- *
33
- * Zero external deps (Node built-ins only).
34
- */
35
-
36
- const fs = require('fs');
37
- const path = require('path');
38
- const { spawn } = require('child_process');
39
-
40
- function parseArgs(argv) {
41
- const args = {};
42
- for (let i = 2; i < argv.length; i++) {
43
- const a = argv[i];
44
- if (a.startsWith('--')) {
45
- const key = a.slice(2);
46
- const next = argv[i + 1];
47
- if (next != null && !next.startsWith('--')) {
48
- args[key] = next;
49
- i++;
50
- } else {
51
- args[key] = true;
52
- }
53
- }
54
- }
55
- return args;
56
- }
57
-
58
- const SMALL_PROMPT = 'Reply with only the number 42';
59
- const RATE_LIMIT_RE = /rate.?limit|429|too.?many.?requests/i;
60
- const RETRY_AFTER_MS_RE = /retry-after-ms[:\s]+(\d+)/i;
61
- const RETRY_AFTER_S_RE = /retry-after[:\s]+(\d+)(?!\s*ms)/i;
62
-
63
- function detectRetryAfterMs(stderr) {
64
- const m1 = stderr.match(RETRY_AFTER_MS_RE);
65
- if (m1) return parseInt(m1[1], 10);
66
- const m2 = stderr.match(RETRY_AFTER_S_RE);
67
- if (m2) return parseInt(m2[1], 10) * 1000;
68
- return null;
69
- }
70
-
71
- async function runOneProbe({ fixturePath, cwd, claudeBin, model }) {
72
- let fixtureBody = '';
73
- try {
74
- fixtureBody = fs.readFileSync(fixturePath, 'utf8');
75
- } catch (err) {
76
- return {
77
- ttftMs: null,
78
- totalMs: 0,
79
- status429: false,
80
- retryAfterMs: null,
81
- exitCode: -1,
82
- failedReason: 'fixture-read-failed: ' + (err && err.message || err),
83
- };
84
- }
85
- // Prompt = fixture context + a deterministic micro-question.
86
- // The fixture inflates the input-token side; the model answers tersely.
87
- const prompt = fixtureBody + '\n\n' + SMALL_PROMPT;
88
-
89
- const args = ['-p', '--dangerously-skip-permissions', '--print'];
90
- if (model) {
91
- args.push('--model', model);
92
- }
93
- args.push(prompt);
94
-
95
- return await new Promise((resolve) => {
96
- const t0 = process.hrtime.bigint();
97
- let firstByteAt = null;
98
- let stdout = '';
99
- let stderr = '';
100
- let settled = false;
101
-
102
- let child;
103
- try {
104
- // GSD-T-LINT: skip stream-json (reason: probe measures rate-limit envelope via API result fields stop_reason/is_error/api_error_status — switching to stream-json would require rewriting the 429 classifier from M55 D3, charter prohibits regression)
105
- child = spawn(claudeBin, args, {
106
- cwd: cwd || process.cwd(),
107
- stdio: ['ignore', 'pipe', 'pipe'],
108
- env: { ...process.env },
109
- });
110
- } catch (err) {
111
- resolve({
112
- ttftMs: null,
113
- totalMs: 0,
114
- status429: false,
115
- retryAfterMs: null,
116
- exitCode: -1,
117
- failedReason: 'spawn-threw: ' + (err && err.message || err),
118
- });
119
- return;
120
- }
121
-
122
- child.stdout.on('data', (chunk) => {
123
- if (firstByteAt === null) firstByteAt = process.hrtime.bigint();
124
- stdout += chunk.toString();
125
- });
126
- child.stderr.on('data', (chunk) => {
127
- stderr += chunk.toString();
128
- });
129
-
130
- child.on('error', (err) => {
131
- if (settled) return;
132
- settled = true;
133
- const t1 = process.hrtime.bigint();
134
- resolve({
135
- ttftMs: firstByteAt ? Number(firstByteAt - t0) / 1e6 : null,
136
- totalMs: Number(t1 - t0) / 1e6,
137
- status429: RATE_LIMIT_RE.test(stderr),
138
- retryAfterMs: detectRetryAfterMs(stderr),
139
- exitCode: -1,
140
- failedReason: 'child-error: ' + (err && err.message || err),
141
- });
142
- });
143
-
144
- child.on('exit', (code, signal) => {
145
- if (settled) return;
146
- settled = true;
147
- const t1 = process.hrtime.bigint();
148
- const totalMs = Number(t1 - t0) / 1e6;
149
- const ttftMs = firstByteAt ? Number(firstByteAt - t0) / 1e6 : null;
150
- const is429 = RATE_LIMIT_RE.test(stderr);
151
- let failedReason = null;
152
- if (code !== 0 && !is429) {
153
- failedReason = 'exit-' + code + (signal ? '-' + signal : '') +
154
- (stderr ? ': ' + stderr.slice(0, 200).replace(/\s+/g, ' ').trim() : '');
155
- }
156
- resolve({
157
- ttftMs,
158
- totalMs,
159
- status429: is429,
160
- retryAfterMs: is429 ? detectRetryAfterMs(stderr) : null,
161
- exitCode: code == null ? -1 : code,
162
- failedReason,
163
- });
164
- });
165
-
166
- // Hard timeout per probe: 90s (covers 100k-context worst-case).
167
- setTimeout(() => {
168
- if (settled) return;
169
- try { child.kill('SIGKILL'); } catch (_) {}
170
- }, 90000);
171
- });
172
- }
173
-
174
- async function main() {
175
- const args = parseArgs(process.argv);
176
- const fixturePath = args.fixture;
177
- if (!fixturePath) {
178
- process.stderr.write('ERROR: --fixture <path> required\n');
179
- process.exit(2);
180
- }
181
- const workerId = args['worker-id'] || 'w0';
182
- const cellWorkers = parseInt(args['cell-workers'] || '1', 10);
183
- const cellContextTokens = parseInt(args['cell-context-tokens'] || '0', 10);
184
- const runIdx = parseInt(args['run-idx'] || '0', 10);
185
- const cwd = args.cwd || process.cwd();
186
- const claudeBin = args['claude-bin'] || process.env.GSD_T_CLAUDE_BIN || 'claude';
187
- const model = args.model || process.env.GSD_T_PROBE_MODEL || 'claude-haiku-4-5';
188
-
189
- const probeStart = Date.now();
190
- const result = await runOneProbe({ fixturePath, cwd, claudeBin, model });
191
- const probeEnd = Date.now();
192
-
193
- const envelope = {
194
- workerId,
195
- cellWorkers,
196
- cellContextTokens,
197
- runIdx,
198
- ttftMs: result.ttftMs,
199
- totalMs: result.totalMs,
200
- status429: result.status429,
201
- retryAfterMs: result.retryAfterMs,
202
- exitCode: result.exitCode,
203
- failedReason: result.failedReason,
204
- startedAt: new Date(probeStart).toISOString(),
205
- endedAt: new Date(probeEnd).toISOString(),
206
- model,
207
- fixturePath,
208
- };
209
- process.stdout.write(JSON.stringify(envelope) + '\n');
210
- // Exit 0 even on rate-limit/CLI failure — the parent reads the envelope, not the exit code.
211
- process.exit(0);
212
- }
213
-
214
- if (require.main === module) {
215
- main().catch((err) => {
216
- process.stderr.write('UNCAUGHT: ' + (err && err.stack || err) + '\n');
217
- // Emit a failure envelope so the parent has structured data.
218
- const envelope = {
219
- workerId: 'unknown',
220
- cellWorkers: 0,
221
- cellContextTokens: 0,
222
- runIdx: 0,
223
- ttftMs: null,
224
- totalMs: 0,
225
- status429: false,
226
- retryAfterMs: null,
227
- exitCode: -1,
228
- failedReason: 'uncaught: ' + (err && err.message || String(err)),
229
- startedAt: new Date().toISOString(),
230
- endedAt: new Date().toISOString(),
231
- };
232
- try { process.stdout.write(JSON.stringify(envelope) + '\n'); } catch (_) {}
233
- process.exit(1);
234
- });
235
- }
236
-
237
- module.exports = { runOneProbe, detectRetryAfterMs, RATE_LIMIT_RE };