@tekyzinc/gsd-t 2.74.13 → 3.10.10
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/CHANGELOG.md +165 -0
- package/README.md +117 -1
- package/bin/advisor-integration.js +93 -0
- package/bin/check-headless-sessions.js +140 -0
- package/bin/context-meter-config.cjs +101 -0
- package/bin/context-meter-config.test.cjs +101 -0
- package/bin/gsd-t-unattended-platform.js +381 -0
- package/bin/gsd-t-unattended-safety.js +766 -0
- package/bin/gsd-t-unattended.js +1259 -0
- package/bin/gsd-t.js +723 -19
- package/bin/handoff-lock.js +249 -0
- package/bin/headless-auto-spawn.js +328 -0
- package/bin/model-selector.js +224 -0
- package/bin/runway-estimator.js +242 -0
- package/bin/token-budget.js +96 -89
- package/bin/token-optimizer.js +471 -0
- package/bin/token-telemetry.js +246 -0
- package/commands/gsd-t-audit.md +3 -3
- package/commands/gsd-t-backlog-list.md +38 -0
- package/commands/gsd-t-brainstorm.md +3 -3
- package/commands/gsd-t-complete-milestone.md +24 -0
- package/commands/gsd-t-debug.md +124 -7
- package/commands/gsd-t-discuss.md +10 -3
- package/commands/gsd-t-doc-ripple.md +32 -4
- package/commands/gsd-t-execute.md +107 -52
- package/commands/gsd-t-help.md +22 -0
- package/commands/gsd-t-integrate.md +67 -4
- package/commands/gsd-t-optimization-apply.md +91 -0
- package/commands/gsd-t-optimization-reject.md +94 -0
- package/commands/gsd-t-partition.md +7 -0
- package/commands/gsd-t-pause.md +3 -0
- package/commands/gsd-t-plan.md +10 -3
- package/commands/gsd-t-prd.md +3 -3
- package/commands/gsd-t-quick.md +71 -9
- package/commands/gsd-t-reflect.md +3 -7
- package/commands/gsd-t-resume.md +86 -1
- package/commands/gsd-t-status.md +31 -0
- package/commands/gsd-t-test-sync.md +7 -0
- package/commands/gsd-t-unattended-stop.md +83 -0
- package/commands/gsd-t-unattended-watch.md +290 -0
- package/commands/gsd-t-unattended.md +414 -0
- package/commands/gsd-t-verify.md +12 -5
- package/commands/gsd-t-visualize.md +3 -7
- package/commands/gsd-t-wave.md +82 -18
- package/docs/GSD-T-README.md +69 -0
- package/docs/architecture.md +176 -4
- package/docs/infrastructure.md +221 -0
- package/docs/methodology.md +44 -0
- package/docs/prd-harness-evolution.md +51 -37
- package/docs/requirements.md +95 -0
- package/docs/unattended-windows-caveats.md +245 -0
- package/package.json +2 -2
- package/scripts/context-meter/count-tokens-client.js +221 -0
- package/scripts/context-meter/count-tokens-client.test.js +308 -0
- package/scripts/context-meter/test-injector.js +55 -0
- package/scripts/context-meter/threshold.js +88 -0
- package/scripts/context-meter/threshold.test.js +255 -0
- package/scripts/context-meter/transcript-parser.js +252 -0
- package/scripts/context-meter/transcript-parser.test.js +320 -0
- package/scripts/gsd-t-context-meter.e2e.test.js +415 -0
- package/scripts/gsd-t-context-meter.js +350 -0
- package/scripts/gsd-t-context-meter.test.js +417 -0
- package/scripts/gsd-t-heartbeat.js +2 -2
- package/scripts/gsd-t-statusline.js +23 -8
- package/templates/CLAUDE-global.md +17 -1
- package/templates/CLAUDE-project.md +26 -6
- package/templates/context-meter-config.json +10 -0
- package/templates/prompts/README.md +1 -1
- package/bin/task-counter.cjs +0 -161
package/bin/task-counter.cjs
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* GSD-T Task Counter — Real, deterministic context-burn gate.
|
|
5
|
-
*
|
|
6
|
-
* Replaces the broken CLAUDE_CONTEXT_TOKENS_USED self-check (which never
|
|
7
|
-
* worked because Claude Code does not export those env vars). Instead of
|
|
8
|
-
* trying to read the orchestrator's own token usage, we count completed
|
|
9
|
-
* task subagent spawns. After N tasks the orchestrator MUST checkpoint
|
|
10
|
-
* progress and STOP so the user can /clear and resume cleanly.
|
|
11
|
-
*
|
|
12
|
-
* State lives at .gsd-t/.task-counter (single JSON file). A counter
|
|
13
|
-
* persists across orchestrator runs until a /clear-then-resume cycle
|
|
14
|
-
* resets it via the `reset` command.
|
|
15
|
-
*
|
|
16
|
-
* Threshold defaults are conservative — five tasks per session before
|
|
17
|
-
* stop. Override via:
|
|
18
|
-
* - .gsd-t/task-counter-config.json { "limit": 8 }
|
|
19
|
-
* - env GSD_T_TASK_LIMIT=8
|
|
20
|
-
*
|
|
21
|
-
* Zero external dependencies (Node.js built-ins only).
|
|
22
|
-
*
|
|
23
|
-
* CLI usage (called from command markdown via `node bin/task-counter.cjs`):
|
|
24
|
-
* increment <kind> → bump counter, print JSON status
|
|
25
|
-
* status → print JSON status without bumping
|
|
26
|
-
* reset → clear counter (called after /clear resume)
|
|
27
|
-
* should-stop → exit 0 if okay to spawn, exit 10 if must stop
|
|
28
|
-
*
|
|
29
|
-
* JSON status shape:
|
|
30
|
-
* { count, limit, remaining, should_stop, started_at, last_kind }
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const fs = require("fs");
|
|
34
|
-
const path = require("path");
|
|
35
|
-
|
|
36
|
-
const DEFAULT_LIMIT = 5;
|
|
37
|
-
const STATE_FILE = ".gsd-t/.task-counter";
|
|
38
|
-
const CONFIG_FILE = ".gsd-t/task-counter-config.json";
|
|
39
|
-
|
|
40
|
-
function projectDir() {
|
|
41
|
-
return process.cwd();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function statePath() {
|
|
45
|
-
return path.join(projectDir(), STATE_FILE);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function configPath() {
|
|
49
|
-
return path.join(projectDir(), CONFIG_FILE);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function readLimit() {
|
|
53
|
-
if (process.env.GSD_T_TASK_LIMIT) {
|
|
54
|
-
const n = parseInt(process.env.GSD_T_TASK_LIMIT, 10);
|
|
55
|
-
if (!isNaN(n) && n > 0) return n;
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
const raw = fs.readFileSync(configPath(), "utf8");
|
|
59
|
-
const cfg = JSON.parse(raw);
|
|
60
|
-
if (cfg && typeof cfg.limit === "number" && cfg.limit > 0) return cfg.limit;
|
|
61
|
-
} catch (_) {}
|
|
62
|
-
return DEFAULT_LIMIT;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function readState() {
|
|
66
|
-
try {
|
|
67
|
-
const raw = fs.readFileSync(statePath(), "utf8");
|
|
68
|
-
const s = JSON.parse(raw);
|
|
69
|
-
return {
|
|
70
|
-
count: typeof s.count === "number" ? s.count : 0,
|
|
71
|
-
started_at: s.started_at || null,
|
|
72
|
-
last_kind: s.last_kind || null,
|
|
73
|
-
stopped: !!s.stopped,
|
|
74
|
-
};
|
|
75
|
-
} catch (_) {
|
|
76
|
-
return { count: 0, started_at: null, last_kind: null, stopped: false };
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function writeState(s) {
|
|
81
|
-
const dir = path.dirname(statePath());
|
|
82
|
-
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
83
|
-
fs.writeFileSync(statePath(), JSON.stringify(s, null, 2));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function buildStatus(state, limit) {
|
|
87
|
-
const remaining = Math.max(0, limit - state.count);
|
|
88
|
-
return {
|
|
89
|
-
count: state.count,
|
|
90
|
-
limit,
|
|
91
|
-
remaining,
|
|
92
|
-
should_stop: state.count >= limit || state.stopped,
|
|
93
|
-
started_at: state.started_at,
|
|
94
|
-
last_kind: state.last_kind,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function cmdIncrement(kind) {
|
|
99
|
-
const s = readState();
|
|
100
|
-
s.count += 1;
|
|
101
|
-
s.last_kind = kind || "task";
|
|
102
|
-
if (!s.started_at) s.started_at = new Date().toISOString();
|
|
103
|
-
const limit = readLimit();
|
|
104
|
-
if (s.count >= limit) s.stopped = true;
|
|
105
|
-
writeState(s);
|
|
106
|
-
return buildStatus(s, limit);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function cmdStatus() {
|
|
110
|
-
return buildStatus(readState(), readLimit());
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function cmdReset() {
|
|
114
|
-
writeState({ count: 0, started_at: null, last_kind: null, stopped: false });
|
|
115
|
-
return buildStatus(readState(), readLimit());
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function cmdShouldStop() {
|
|
119
|
-
return buildStatus(readState(), readLimit()).should_stop;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function main() {
|
|
123
|
-
const cmd = process.argv[2];
|
|
124
|
-
const arg = process.argv[3];
|
|
125
|
-
switch (cmd) {
|
|
126
|
-
case "increment": {
|
|
127
|
-
const status = cmdIncrement(arg);
|
|
128
|
-
process.stdout.write(JSON.stringify(status));
|
|
129
|
-
process.exit(status.should_stop ? 10 : 0);
|
|
130
|
-
}
|
|
131
|
-
case "status": {
|
|
132
|
-
process.stdout.write(JSON.stringify(cmdStatus()));
|
|
133
|
-
process.exit(0);
|
|
134
|
-
}
|
|
135
|
-
case "reset": {
|
|
136
|
-
process.stdout.write(JSON.stringify(cmdReset()));
|
|
137
|
-
process.exit(0);
|
|
138
|
-
}
|
|
139
|
-
case "should-stop": {
|
|
140
|
-
process.exit(cmdShouldStop() ? 10 : 0);
|
|
141
|
-
}
|
|
142
|
-
default: {
|
|
143
|
-
process.stderr.write(
|
|
144
|
-
"Usage: task-counter.cjs <increment|status|reset|should-stop> [kind]\n"
|
|
145
|
-
);
|
|
146
|
-
process.exit(2);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (require.main === module) main();
|
|
152
|
-
|
|
153
|
-
module.exports = {
|
|
154
|
-
cmdIncrement,
|
|
155
|
-
cmdStatus,
|
|
156
|
-
cmdReset,
|
|
157
|
-
cmdShouldStop,
|
|
158
|
-
readLimit,
|
|
159
|
-
readState,
|
|
160
|
-
DEFAULT_LIMIT,
|
|
161
|
-
};
|