@hegemonart/get-design-done 1.21.0 → 1.22.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +122 -0
- package/hooks/_hook-emit.js +81 -0
- package/hooks/gdd-bash-guard.js +8 -0
- package/hooks/gdd-decision-injector.js +2 -0
- package/hooks/gdd-protected-paths.js +8 -0
- package/hooks/gdd-trajectory-capture.js +64 -0
- package/hooks/hooks.json +9 -0
- package/package.json +6 -2
- package/scripts/cli/gdd-events.mjs +283 -0
- package/scripts/lib/connection-probe/index.cjs +263 -0
- package/scripts/lib/event-chain.cjs +177 -0
- package/scripts/lib/event-stream/index.ts +20 -0
- package/scripts/lib/event-stream/reader.ts +139 -0
- package/scripts/lib/event-stream/types.ts +155 -1
- package/scripts/lib/event-stream/writer.ts +65 -8
- package/scripts/lib/redact.cjs +122 -0
- package/scripts/lib/trajectory/index.cjs +126 -0
- package/scripts/lib/transports/ws.cjs +179 -0
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
},
|
|
6
6
|
"metadata": {
|
|
7
7
|
"description": "Get Design Done — 5-stage agent-orchestrated design pipeline with 9 connections, handoff-first workflow, bidirectional Figma write-back, 22+ specialized agents, queryable knowledge layer (intel store, dependency analysis, learnings extraction), and a self-improvement loop (reflector, frontmatter + budget feedback, global-skills layer). v1.20.0 ships the SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream, and resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) for rate-limit + 429 + context-overflow recovery. Full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows) and release automation (auto-tag + GitHub Release + release-time smoke test).",
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.22.0"
|
|
9
9
|
},
|
|
10
10
|
"plugins": [
|
|
11
11
|
{
|
|
12
12
|
"name": "get-design-done",
|
|
13
13
|
"source": "./",
|
|
14
14
|
"description": "Agent-orchestrated 5-stage design pipeline: Brief → Explore → Plan → Design → Verify. 22+ specialized agents, 9 connections (Figma, Refero, Preview, Storybook, Chromatic, Figma Writer, Graphify, Pinterest, Claude Design), Claude Design handoff, bidirectional Figma write-back, and a queryable intel store (.design/intel/) for dependency and learnings queries. Standalone commands: style, darkmode, compare, figma-write, graphify, handoff, analyze-dependencies, skill-manifest, extract-learnings. Embeds NNG heuristics, WCAG thresholds, typographic systems, motion framework, and anti-pattern catalog. Ships with a full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows) and release automation. Optimization layer (v1.0.4.1, retroactive): gdd-router + gdd-cache-manager skills, PreToolUse budget-enforcer hook, tier-aware agent frontmatter, lazy checker gates, streaming synthesizer, /gdd:warm-cache + /gdd:optimize commands, and cost telemetry at .design/telemetry/costs.jsonl — targeting 50-70% per-task token-cost reduction with no quality-floor regression. v1.20.0 SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream at .design/telemetry/events.jsonl, resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) with rate-limit + 429 + context-overflow recovery, and TypeScript toolchain.",
|
|
15
|
-
"version": "1.
|
|
15
|
+
"version": "1.22.0",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "hegemonart"
|
|
18
18
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-design-done",
|
|
3
3
|
"short_name": "gdd",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.22.0",
|
|
5
5
|
"description": "Agent-orchestrated 5-stage design pipeline: Brief → Explore → Plan → Design → Verify. 22+ specialized agents, 9 connections (Figma, Refero, Preview, Storybook, Chromatic, Figma Writer, Graphify, Pinterest, Claude Design), handoff-first workflow via Claude Design bundles, bidirectional Figma write-back (annotations, Code Connect), queryable intel store (`.design/intel/`) for O(1) design surface lookups, and self-improvement loop (reflector agent, frontmatter + budget feedback, global-skills layer at `~/.claude/gdd/global-skills/`). Standalone commands: style, darkmode, compare, figma-write, graphify, handoff, analyze-dependencies, skill-manifest, extract-learnings, reflect, apply-reflections. Embeds NNG heuristics, WCAG thresholds, typographic systems, motion framework, and anti-pattern catalog. Ships with a full CI/CD pipeline (Node 22/24 × Linux/macOS/Windows, lint + schema + frontmatter + stale-ref + shellcheck + gitleaks + injection-scan + blocking size-budget) and release automation (auto-tag + GitHub Release + release-time smoke test). Optimization layer (v1.0.4.1, retroactive): gdd-router + gdd-cache-manager skills, PreToolUse budget-enforcer hook, tier-aware agent frontmatter, lazy checker gates, streaming synthesizer, /gdd:warm-cache + /gdd:optimize commands, and cost telemetry at .design/telemetry/costs.jsonl — targeting 50-70% per-task token-cost reduction with no quality-floor regression. v1.20.0 SDK foundation: gdd-state MCP server (11 typed tools), lockfile-safe STATE.md mutations, event stream at .design/telemetry/events.jsonl, resilience primitives (jittered-backoff, rate-guard, error-classifier, iteration-budget) with rate-limit + 429 + context-overflow recovery, and TypeScript toolchain.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "hegemonart",
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,128 @@ All notable changes to get-design-done are documented here. Versions follow [sem
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [1.22.0] — 2026-04-25
|
|
8
|
+
|
|
9
|
+
Phase 22 GDD SDK Observability milestone — the single-typed `BaseEvent` envelope from Phase 20 grows into a queryable, redacted, transport-able observability layer with tail/grep/WebSocket consumers and a causal event chain. 10 plans (22-01 through 22-10), additive — every Phase 20 + Phase 21 consumer keeps working unchanged.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Expanded event-type registry** — 17 new pre-registered subtypes alongside
|
|
14
|
+
the 6 from Phase 20: `wave.started`, `wave.completed`, `blocker.added`,
|
|
15
|
+
`decision.added`, `must_have.added`, `parallelism.verdict`, `cost.update`,
|
|
16
|
+
`rate_limit`, `api.retry`, `compact.boundary`, `mcp.probe`,
|
|
17
|
+
`reflection.proposed`, `connection.status_change`, `tool_call.started`,
|
|
18
|
+
`tool_call.completed`, `agent.spawn`, `agent.outcome`. The envelope
|
|
19
|
+
remains open (`type: string`); the `KnownEvent` union is an additive
|
|
20
|
+
overlay for typed `switch` consumers. Runtime `KNOWN_EVENT_TYPES` list
|
|
21
|
+
exported for the CLI's `list-types` subcommand. (Plan 22-01)
|
|
22
|
+
|
|
23
|
+
- **Secret scrubber** — `scripts/lib/redact.cjs` deep-walks every event
|
|
24
|
+
payload and replaces secret-shaped strings with `[REDACTED:<type>]`
|
|
25
|
+
placeholders. Patterns: `sk-ant-…` (anthropic), `sk_live_…` (stripe),
|
|
26
|
+
`xox[baprs]-…` (slack), `ghp_…` (github_pat), `AKIA…` (aws), generic
|
|
27
|
+
`sk-…`, `eyJ…` JWTs, and full `-----BEGIN/END-----` PEM blocks.
|
|
28
|
+
Wired into `EventWriter.serialize()` so every event hitting disk and
|
|
29
|
+
every bus subscriber sees the scrubbed form — single rule everywhere,
|
|
30
|
+
no escape hatch. (Plan 22-02)
|
|
31
|
+
|
|
32
|
+
- **Per-tool-call trajectory stream** — `.design/telemetry/trajectories/<cycle>.jsonl`
|
|
33
|
+
receives one line per agent tool-use:
|
|
34
|
+
`{ts, agent, tool, args_hash, result_hash, latency_ms, status}`.
|
|
35
|
+
Args + result are sha256-prefix-hashed (16 chars) — line size stays
|
|
36
|
+
bounded; prompt content stays de-identified. Captured by the new
|
|
37
|
+
PostToolUse:Agent hook `hooks/gdd-trajectory-capture.js`. (Plan 22-03)
|
|
38
|
+
|
|
39
|
+
- **Append-only event chain** — `.design/gep/events.jsonl` (gep =
|
|
40
|
+
"GDD Event Provenance"). One line per causal hop: `{event_id,
|
|
41
|
+
parent_event_id, ts, agent, decision_refs, outcome, rollback_reason?}`.
|
|
42
|
+
`appendChainEvent()` auto-generates UUIDs; `walkParents()` traces a
|
|
43
|
+
row up to its root for `/gdd:audit --retroactive`. Cycle-safe; skips
|
|
44
|
+
invalid lines; lives separately from the firehose so audits don't
|
|
45
|
+
scan unrelated rows. (Plan 22-04)
|
|
46
|
+
|
|
47
|
+
- **Typed event reader + aggregator** — `readEvents({path, type,
|
|
48
|
+
predicate, since, until})` returns an async streaming iterator over
|
|
49
|
+
`events.jsonl` (readline + createReadStream — no full-file load,
|
|
50
|
+
GB-scale logs OK). `aggregate()` rolls events up by type, stage,
|
|
51
|
+
cycle, agent + totals (count, error_count, truncated_count). Exposed
|
|
52
|
+
from the public event-stream API. (Plan 22-05)
|
|
53
|
+
|
|
54
|
+
- **CLI transport** — `gdd-events` bin entry, subcommands:
|
|
55
|
+
`tail [--follow]` (250ms-poll follow mode, no native inotify dep);
|
|
56
|
+
`grep <terms…>` with hand-rolled filter language
|
|
57
|
+
(`type=foo`, `payload.x.y=bar`, `!type=baz`, multiple = AND);
|
|
58
|
+
`cat` pretty-print with timestamp+type prefix; `list-types` runtime
|
|
59
|
+
registry dump; `serve` for the WebSocket transport. (Plan 22-06)
|
|
60
|
+
|
|
61
|
+
- **WebSocket transport** — `scripts/lib/transports/ws.cjs` exposes
|
|
62
|
+
`startServer({port, token, tailFrom?, subscribe?})`. Loaded via
|
|
63
|
+
`probeOptional('ws')` — clear install hint when absent. Auth:
|
|
64
|
+
`Authorization: Bearer <token>` on the upgrade; mismatched →
|
|
65
|
+
HTTP 401 close. Tail replay sends `tailFrom`'s contents to new
|
|
66
|
+
clients before subscribing them to the live bus. Fire-and-forget
|
|
67
|
+
delivery; closed sockets dropped silently. `ws@8` declared as
|
|
68
|
+
optional dep. (Plan 22-07)
|
|
69
|
+
|
|
70
|
+
- **Connection probe primitive** — `scripts/lib/connection-probe/`
|
|
71
|
+
exposes `probe({name, cmd, timeout, retries, fallback})` →
|
|
72
|
+
`{status: 'ok'|'degraded'|'down', latency_ms, attempts,
|
|
73
|
+
fallback_used, error?}`. Backoff between retries via
|
|
74
|
+
`jittered-backoff.cjs`. State persisted at
|
|
75
|
+
`.design/telemetry/connection-state.json` (atomic .tmp+rename).
|
|
76
|
+
Status transitions emit `connection.status_change` events through a
|
|
77
|
+
caller-supplied `emit` callback — transitions only, not every probe.
|
|
78
|
+
Replaces ad-hoc bash probe snippets in `connections/`. (Plan 22-08)
|
|
79
|
+
|
|
80
|
+
- **Hook → event-stream wire-in** — new `hooks/_hook-emit.js` shared
|
|
81
|
+
helper wraps `appendEvent()` in try/catch (hooks must NEVER throw on
|
|
82
|
+
telemetry failure). Wired hooks emit `hook.fired` events on every
|
|
83
|
+
decision: `gdd-bash-guard` (allow/block + severity + pattern),
|
|
84
|
+
`gdd-protected-paths` (allow/block + matched glob),
|
|
85
|
+
`gdd-decision-injector` (inject/no-hits + backend label).
|
|
86
|
+
Trajectory-capture (Plan 22-03) already emits via its own path.
|
|
87
|
+
Additive — zero behavior change to existing hook contracts. (Plan 22-09)
|
|
88
|
+
|
|
89
|
+
### Changed
|
|
90
|
+
|
|
91
|
+
- `EventWriter.serialize()` now runs `redact()` on the event before
|
|
92
|
+
JSON-stringifying. Persisted form is the canonical scrubbed form.
|
|
93
|
+
All 27 Phase 20 event-stream tests still pass. (Plan 22-02 wire-in)
|
|
94
|
+
|
|
95
|
+
- `hooks.json` registers a new `PostToolUse:Agent` matcher pointing at
|
|
96
|
+
`gdd-trajectory-capture.js`. The existing `PreToolUse:Agent`
|
|
97
|
+
budget-enforcer is unaffected. (Plan 22-03 registration)
|
|
98
|
+
|
|
99
|
+
### Tests
|
|
100
|
+
|
|
101
|
+
- `tests/event-types-registry.test.ts` — registry expansion (4 tests)
|
|
102
|
+
- `tests/redact.test.cjs` — secret scrubber (12 tests)
|
|
103
|
+
- `tests/event-stream-redact-integration.test.ts` — write-time wire-in (2 tests)
|
|
104
|
+
- `tests/trajectory-capture.test.cjs` — module + hook subprocess (7 tests)
|
|
105
|
+
- `tests/event-chain.test.cjs` — chain + walk + cycle defense (10 tests)
|
|
106
|
+
- `tests/event-reader.test.ts` — reader + aggregator (8 tests)
|
|
107
|
+
- `tests/cli-events.test.cjs` — CLI subcommands + filter language (10 tests)
|
|
108
|
+
- `tests/ws-transport.test.cjs` — WebSocket auth + replay + live (5 + 1 skip)
|
|
109
|
+
- `tests/connection-probe-primitive.test.cjs` — retry + fallback + emit (9 tests)
|
|
110
|
+
- `tests/hook-emit-wire.test.cjs` — bash-guard + protected-paths emission (4 tests)
|
|
111
|
+
- `tests/phase-22-baseline.test.cjs` — Phase 22 regression baseline (12 tests)
|
|
112
|
+
|
|
113
|
+
Total: 84 new tests. All Phase 20/21 tests still green.
|
|
114
|
+
|
|
115
|
+
### Deferred
|
|
116
|
+
|
|
117
|
+
- Grafana / Prometheus exporter (out of scope; code-primitive
|
|
118
|
+
observability shipped first).
|
|
119
|
+
- Event-stream compaction / retention (`events.jsonl` grows unbounded;
|
|
120
|
+
Phase 22.x if needed).
|
|
121
|
+
- Replay-on-subscribe semantics (bus stays live-only; transports that
|
|
122
|
+
want replay read `events.jsonl` directly, then subscribe live).
|
|
123
|
+
- Wire-in for `gdd-mcp-circuit-breaker.js`, `budget-enforcer.ts`,
|
|
124
|
+
`context-exhaustion.ts`, `gdd-read-injection-scanner.ts` — flow is
|
|
125
|
+
more intricate; follow-up phase.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
7
129
|
## [1.21.0] — 2026-04-24
|
|
8
130
|
|
|
9
131
|
Phase 21 GDD SDK Headless milestone — the plugin now runs unchanged on Claude Code, OpenAI Codex CLI, and Gemini CLI, and ships a full `gdd-sdk` CLI that executes the design pipeline without a harness. 12 plans (21-01 through 21-12), 50+ commits, 936 tests.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hooks/_hook-emit.js — shared `hook.fired` emitter for Phase 22 wire-in
|
|
3
|
+
* (Plan 22-09).
|
|
4
|
+
*
|
|
5
|
+
* Hooks must NEVER throw on telemetry failure — a broken event stream
|
|
6
|
+
* cannot block a tool call. This helper wraps appendEvent in try/catch
|
|
7
|
+
* and silently swallows.
|
|
8
|
+
*
|
|
9
|
+
* Why a wrapper instead of importing directly:
|
|
10
|
+
* * Centralizes the try/catch so each hook stays terse.
|
|
11
|
+
* * Loads the .ts event-stream lazily — hooks invoked via plain `node`
|
|
12
|
+
* (no --experimental-strip-types) just no-op on telemetry instead
|
|
13
|
+
* of crashing. The hooks.json registrations vary on whether they
|
|
14
|
+
* pass --experimental-strip-types, and we don't want to forbid
|
|
15
|
+
* plain-node invocation paths.
|
|
16
|
+
* * Single place to add structured event sinks later (e.g. mirror to
|
|
17
|
+
* CLI transport) without touching every hook file.
|
|
18
|
+
*
|
|
19
|
+
* Usage:
|
|
20
|
+
* const { emitHookFired } = require('./_hook-emit.js');
|
|
21
|
+
* // …decision computed…
|
|
22
|
+
* emitHookFired('budget-enforcer', 'allow');
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
'use strict';
|
|
26
|
+
|
|
27
|
+
let cachedAppendEvent = null;
|
|
28
|
+
let resolutionAttempted = false;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Lazy-resolve `appendEvent` — only loads the event-stream module the
|
|
32
|
+
* first time a hook fires. Falls back to a no-op if the module is not
|
|
33
|
+
* loadable in the current runtime (e.g. plain `node` without
|
|
34
|
+
* --experimental-strip-types).
|
|
35
|
+
*
|
|
36
|
+
* @returns {(ev: unknown) => void}
|
|
37
|
+
*/
|
|
38
|
+
function getAppendEvent() {
|
|
39
|
+
if (cachedAppendEvent !== null || resolutionAttempted) {
|
|
40
|
+
return cachedAppendEvent || (() => {});
|
|
41
|
+
}
|
|
42
|
+
resolutionAttempted = true;
|
|
43
|
+
try {
|
|
44
|
+
// event-stream/index.ts requires --experimental-strip-types. Try
|
|
45
|
+
// require()'ing — if Node refuses to parse `.ts`, we silently fall
|
|
46
|
+
// back to no-op.
|
|
47
|
+
// eslint-disable-next-line node/no-missing-require, global-require
|
|
48
|
+
cachedAppendEvent = require('../scripts/lib/event-stream/index.ts').appendEvent;
|
|
49
|
+
return cachedAppendEvent;
|
|
50
|
+
} catch {
|
|
51
|
+
cachedAppendEvent = null;
|
|
52
|
+
return () => {};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Emit a `hook.fired` event. Silent on every failure mode.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} hookName
|
|
60
|
+
* @param {string} decision
|
|
61
|
+
* @param {Record<string, unknown>} [extras] — opaque additional payload fields
|
|
62
|
+
*/
|
|
63
|
+
function emitHookFired(hookName, decision, extras) {
|
|
64
|
+
try {
|
|
65
|
+
const appendEvent = getAppendEvent();
|
|
66
|
+
const payload = { hook: hookName, decision };
|
|
67
|
+
if (extras && typeof extras === 'object') {
|
|
68
|
+
Object.assign(payload, extras);
|
|
69
|
+
}
|
|
70
|
+
appendEvent({
|
|
71
|
+
type: 'hook.fired',
|
|
72
|
+
timestamp: new Date().toISOString(),
|
|
73
|
+
sessionId: process.env.GDD_SESSION_ID || 'hook',
|
|
74
|
+
payload,
|
|
75
|
+
});
|
|
76
|
+
} catch {
|
|
77
|
+
/* hooks must never throw on telemetry */
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = { emitHookFired };
|
package/hooks/gdd-bash-guard.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
const path = require('path');
|
|
17
17
|
const { match } = require(path.join(__dirname, '..', 'scripts', 'lib', 'dangerous-patterns.cjs'));
|
|
18
|
+
const { emitHookFired } = require('./_hook-emit.js'); // Plan 22-09 wire-in
|
|
18
19
|
|
|
19
20
|
async function main() {
|
|
20
21
|
let buf = '';
|
|
@@ -22,11 +23,13 @@ async function main() {
|
|
|
22
23
|
|
|
23
24
|
let payload;
|
|
24
25
|
try { payload = JSON.parse(buf || '{}'); } catch {
|
|
26
|
+
emitHookFired('gdd-bash-guard', 'allow', { reason: 'parse-error' });
|
|
25
27
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
if (payload?.tool_name && payload.tool_name !== 'Bash') {
|
|
32
|
+
emitHookFired('gdd-bash-guard', 'allow', { reason: 'non-bash-tool' });
|
|
30
33
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
@@ -34,6 +37,10 @@ async function main() {
|
|
|
34
37
|
const command = payload?.tool_input?.command ?? '';
|
|
35
38
|
const r = match(command);
|
|
36
39
|
if (r.matched) {
|
|
40
|
+
emitHookFired('gdd-bash-guard', 'block', {
|
|
41
|
+
severity: r.severity,
|
|
42
|
+
pattern: r.pattern,
|
|
43
|
+
});
|
|
37
44
|
process.stdout.write(JSON.stringify({
|
|
38
45
|
continue: false,
|
|
39
46
|
stopReason: `gdd-bash-guard: dangerous command blocked (${r.severity}): ${r.description} [${r.pattern}]`,
|
|
@@ -41,6 +48,7 @@ async function main() {
|
|
|
41
48
|
return;
|
|
42
49
|
}
|
|
43
50
|
|
|
51
|
+
emitHookFired('gdd-bash-guard', 'allow', { reason: 'no-match' });
|
|
44
52
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
45
53
|
}
|
|
46
54
|
|
|
@@ -203,10 +203,12 @@ async function main() {
|
|
|
203
203
|
const backendLabel = BACKEND || (useRgGlobal ? 'ripgrep' : 'node-grep');
|
|
204
204
|
const block = buildRecallBlock(hits, basename, backendLabel);
|
|
205
205
|
if (!block) {
|
|
206
|
+
try { require('./_hook-emit.js').emitHookFired('gdd-decision-injector', 'no-hits', { backend: backendLabel }); } catch { /* swallow */ }
|
|
206
207
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
207
208
|
return;
|
|
208
209
|
}
|
|
209
210
|
|
|
211
|
+
try { require('./_hook-emit.js').emitHookFired('gdd-decision-injector', 'inject', { backend: backendLabel, hit_count: hits.length }); } catch { /* swallow */ }
|
|
210
212
|
process.stdout.write(JSON.stringify({
|
|
211
213
|
continue: true,
|
|
212
214
|
hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: block },
|
|
@@ -98,6 +98,11 @@ async function main() {
|
|
|
98
98
|
: cand.replace(/\\/g, '/');
|
|
99
99
|
const r = matches(rel, protectedPaths);
|
|
100
100
|
if (r.matched) {
|
|
101
|
+
try {
|
|
102
|
+
require('./_hook-emit.js').emitHookFired('gdd-protected-paths', 'block', {
|
|
103
|
+
path: rel, pattern: r.pattern,
|
|
104
|
+
});
|
|
105
|
+
} catch { /* swallow */ }
|
|
101
106
|
process.stdout.write(JSON.stringify({
|
|
102
107
|
continue: false,
|
|
103
108
|
stopReason: `gdd-protected-paths: '${rel}' is a protected path (matched '${r.pattern}'). To override, lift the path from the default glob list or explicitly edit via an approved workflow (e.g., /gdd:update, plan execution).`,
|
|
@@ -106,6 +111,9 @@ async function main() {
|
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
|
|
114
|
+
try {
|
|
115
|
+
require('./_hook-emit.js').emitHookFired('gdd-protected-paths', 'allow');
|
|
116
|
+
} catch { /* swallow */ }
|
|
109
117
|
process.stdout.write(JSON.stringify({ continue: true }));
|
|
110
118
|
}
|
|
111
119
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* gdd-trajectory-capture.js — PostToolUse:Agent hook (Plan 22-03).
|
|
4
|
+
*
|
|
5
|
+
* Reads the standard Claude Code hook JSON from stdin:
|
|
6
|
+
* { tool_name, tool_input, tool_response, session_id, ... }
|
|
7
|
+
*
|
|
8
|
+
* Writes one JSONL line to `.design/telemetry/trajectories/<cycle>.jsonl`
|
|
9
|
+
* via `scripts/lib/trajectory/index.cjs`. Silent-on-failure: telemetry
|
|
10
|
+
* never blocks the parent agent's tool call.
|
|
11
|
+
*
|
|
12
|
+
* Cycle resolution:
|
|
13
|
+
* * env var GDD_CYCLE wins (used by Phase 21 pipeline runner)
|
|
14
|
+
* * fallback: 'current'
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
const { recordCall } = require('../scripts/lib/trajectory/index.cjs');
|
|
20
|
+
|
|
21
|
+
let raw = '';
|
|
22
|
+
process.stdin.setEncoding('utf8');
|
|
23
|
+
process.stdin.on('data', (chunk) => {
|
|
24
|
+
raw += chunk;
|
|
25
|
+
});
|
|
26
|
+
process.stdin.on('end', () => {
|
|
27
|
+
try {
|
|
28
|
+
const input = raw.trim() ? JSON.parse(raw) : {};
|
|
29
|
+
const toolName = input.tool_name || input.toolName || 'unknown';
|
|
30
|
+
const toolInput = input.tool_input ?? input.toolInput ?? null;
|
|
31
|
+
const toolResponse = input.tool_response ?? input.toolResponse ?? null;
|
|
32
|
+
const sessionId = input.session_id ?? input.sessionId ?? null;
|
|
33
|
+
const status =
|
|
34
|
+
toolResponse && typeof toolResponse === 'object' && toolResponse.is_error === true
|
|
35
|
+
? 'error'
|
|
36
|
+
: 'ok';
|
|
37
|
+
const latency = typeof input.latency_ms === 'number' ? input.latency_ms : 0;
|
|
38
|
+
|
|
39
|
+
recordCall({
|
|
40
|
+
cycle: process.env.GDD_CYCLE || 'current',
|
|
41
|
+
session_id: sessionId,
|
|
42
|
+
agent: input.agent || process.env.GDD_AGENT || 'unknown',
|
|
43
|
+
tool: toolName,
|
|
44
|
+
args: toolInput,
|
|
45
|
+
result: toolResponse,
|
|
46
|
+
latency_ms: latency,
|
|
47
|
+
status,
|
|
48
|
+
});
|
|
49
|
+
} catch (err) {
|
|
50
|
+
try {
|
|
51
|
+
process.stderr.write(
|
|
52
|
+
`[gdd-trajectory] hook failed: ${err && err.message ? err.message : String(err)}\n`,
|
|
53
|
+
);
|
|
54
|
+
} catch {
|
|
55
|
+
/* swallow */
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Always emit a non-blocking continue verdict.
|
|
59
|
+
try {
|
|
60
|
+
process.stdout.write(JSON.stringify({ continue: true, suppressOutput: true }));
|
|
61
|
+
} catch {
|
|
62
|
+
/* swallow */
|
|
63
|
+
}
|
|
64
|
+
});
|
package/hooks/hooks.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hegemonart/get-design-done",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"description": "A Claude Code plugin for systematic design improvement",
|
|
5
5
|
"author": "Hegemon",
|
|
6
6
|
"homepage": "https://github.com/hegemonart/get-design-done",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"bin": {
|
|
30
30
|
"get-design-done": "./scripts/install.cjs",
|
|
31
31
|
"gdd-state-mcp": "./scripts/mcp-servers/gdd-state/server.ts",
|
|
32
|
-
"gdd-sdk": "./bin/gdd-sdk"
|
|
32
|
+
"gdd-sdk": "./bin/gdd-sdk",
|
|
33
|
+
"gdd-events": "./scripts/cli/gdd-events.mjs"
|
|
33
34
|
},
|
|
34
35
|
"publishConfig": {
|
|
35
36
|
"access": "public",
|
|
@@ -84,5 +85,8 @@
|
|
|
84
85
|
"dependencies": {
|
|
85
86
|
"@anthropic-ai/claude-agent-sdk": "^0.2.119",
|
|
86
87
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
88
|
+
},
|
|
89
|
+
"optionalDependencies": {
|
|
90
|
+
"ws": "^8.20.0"
|
|
87
91
|
}
|
|
88
92
|
}
|