draht-codex 2026.7.30 → 2026.10.4-2

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 (110) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/CHANGELOG.md +81 -0
  3. package/README.md +57 -6
  4. package/agents/debugger.md +12 -1
  5. package/agents/git-committer.md +1 -0
  6. package/agents/implementer.md +11 -2
  7. package/agents/investigator.md +75 -0
  8. package/agents/reviewer.md +7 -0
  9. package/agents/speaker.md +44 -0
  10. package/agents/verifier.md +4 -3
  11. package/bin/draht-tools.cjs +472 -41
  12. package/bin/judge +613 -0
  13. package/cli.mjs +769 -46
  14. package/commands/atomic-commit.md +1 -12
  15. package/commands/create-verification-skill.md +105 -0
  16. package/commands/discuss-phase.md +3 -14
  17. package/commands/execute-phase.md +7 -14
  18. package/commands/fix.md +38 -17
  19. package/commands/grill.md +66 -0
  20. package/commands/init-project.md +5 -15
  21. package/commands/map-codebase.md +1 -13
  22. package/commands/new-project.md +5 -15
  23. package/commands/next-milestone.md +2 -13
  24. package/commands/orchestrate.md +1 -1
  25. package/commands/pause-work.md +1 -8
  26. package/commands/plan-phase.md +3 -11
  27. package/commands/progress.md +0 -8
  28. package/commands/quick.md +3 -11
  29. package/commands/resolve-conflicts.md +72 -0
  30. package/commands/resume-work.md +0 -8
  31. package/commands/review.md +6 -13
  32. package/commands/speak.md +45 -0
  33. package/commands/triage.md +161 -0
  34. package/commands/verify-work.md +6 -13
  35. package/commands/why.md +141 -0
  36. package/graph-archive.mjs +125 -0
  37. package/graph-manifest.mjs +97 -0
  38. package/hooks/hooks.json +39 -0
  39. package/package.json +5 -3
  40. package/scripts/gsd-quality-gate.cjs +3 -3
  41. package/scripts/judge-hook.cjs +42 -0
  42. package/scripts/judge-hook.py +391 -0
  43. package/scripts/judgegates.py +673 -0
  44. package/scripts/judgelib.py +382 -0
  45. package/scripts/speak.cjs +202 -0
  46. package/skills/atomic-commit/SKILL.md +1 -1
  47. package/skills/atomic-commit/command.md +62 -0
  48. package/skills/blast-radius/SKILL.md +56 -0
  49. package/skills/brainstorming/SKILL.md +11 -4
  50. package/skills/cinematic-continuation/SKILL.md +111 -0
  51. package/skills/cinematic-continuation/references/continuity-schema.md +75 -0
  52. package/skills/cinematic-continuation/references/seedance-adapter.md +44 -0
  53. package/skills/cinematic-continuation/references/style-bible.md +223 -0
  54. package/skills/cinematic-continuation/scripts/compile-continuation.mjs +173 -0
  55. package/skills/cinematic-continuation/templates/continuation-spec.json +50 -0
  56. package/skills/create-verification-skill/SKILL.md +14 -0
  57. package/skills/create-verification-skill/command.md +105 -0
  58. package/skills/debugging-workflow/SKILL.md +38 -10
  59. package/skills/discuss-phase/SKILL.md +1 -1
  60. package/skills/discuss-phase/command.md +44 -0
  61. package/skills/draht/SKILL.md +119 -0
  62. package/skills/epistemics/SKILL.md +99 -0
  63. package/skills/execute-phase/SKILL.md +1 -1
  64. package/skills/execute-phase/command.md +170 -0
  65. package/skills/explainers/SKILL.md +65 -0
  66. package/skills/fix/SKILL.md +1 -1
  67. package/skills/fix/command.md +154 -0
  68. package/skills/grill/SKILL.md +14 -0
  69. package/skills/grill/command.md +66 -0
  70. package/skills/gsd-workflow/SKILL.md +2 -0
  71. package/skills/init-project/SKILL.md +1 -1
  72. package/skills/init-project/command.md +57 -0
  73. package/skills/judge/SKILL.md +57 -0
  74. package/skills/map-codebase/SKILL.md +1 -1
  75. package/skills/map-codebase/command.md +61 -0
  76. package/skills/new-project/SKILL.md +1 -1
  77. package/skills/new-project/command.md +64 -0
  78. package/skills/next-milestone/SKILL.md +1 -1
  79. package/skills/next-milestone/command.md +42 -0
  80. package/skills/orchestrate/SKILL.md +1 -1
  81. package/skills/orchestrate/command.md +106 -0
  82. package/skills/orchestrate-loop/SKILL.md +1 -1
  83. package/skills/orchestrate-loop/command.md +100 -0
  84. package/skills/pause-work/SKILL.md +1 -1
  85. package/skills/pause-work/command.md +32 -0
  86. package/skills/plan-phase/SKILL.md +1 -1
  87. package/skills/plan-phase/command.md +140 -0
  88. package/skills/progress/SKILL.md +1 -1
  89. package/skills/progress/command.md +22 -0
  90. package/skills/quick/SKILL.md +1 -1
  91. package/skills/quick/command.md +91 -0
  92. package/skills/resolve-conflicts/SKILL.md +14 -0
  93. package/skills/resolve-conflicts/command.md +72 -0
  94. package/skills/resume-work/SKILL.md +1 -1
  95. package/skills/resume-work/command.md +27 -0
  96. package/skills/review/SKILL.md +1 -1
  97. package/skills/review/command.md +83 -0
  98. package/skills/saga-spawner/SKILL.md +131 -0
  99. package/skills/speak/SKILL.md +14 -0
  100. package/skills/speak/command.md +45 -0
  101. package/skills/tdd-workflow/SKILL.md +2 -0
  102. package/skills/triage/SKILL.md +14 -0
  103. package/skills/triage/command.md +161 -0
  104. package/skills/typescript-discipline/SKILL.md +50 -0
  105. package/skills/typescript-discipline/references/patterns.md +294 -0
  106. package/skills/unslop/SKILL.md +119 -0
  107. package/skills/verify-work/SKILL.md +1 -1
  108. package/skills/verify-work/command.md +117 -0
  109. package/skills/why/SKILL.md +14 -0
  110. package/skills/why/command.md +141 -0
@@ -0,0 +1,125 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import zlib from "node:zlib";
4
+
5
+ const EOCD_SIGNATURE = 0x06054b50;
6
+ const CENTRAL_SIGNATURE = 0x02014b50;
7
+ const LOCAL_SIGNATURE = 0x04034b50;
8
+ const MAX_CENTRAL_BYTES = 4 * 1024 * 1024;
9
+ const MAX_ENTRIES = 16;
10
+
11
+ function crc32(bytes) {
12
+ let crc = 0xffffffff;
13
+ for (const byte of bytes) {
14
+ crc ^= byte;
15
+ for (let bit = 0; bit < 8; bit++) crc = (crc >>> 1) ^ (0xedb88320 & -(crc & 1));
16
+ }
17
+ return (crc ^ 0xffffffff) >>> 0;
18
+ }
19
+
20
+ function safeName(name) {
21
+ return /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*\/?$/.test(name)
22
+ && !name.startsWith("/") && !name.includes("../") && !name.includes("\\") && !/^[A-Za-z]:/.test(name);
23
+ }
24
+
25
+ function locateEocd(zip) {
26
+ const start = Math.max(0, zip.length - 65_557);
27
+ for (let offset = zip.length - 22; offset >= start; offset--) {
28
+ if (zip.readUInt32LE(offset) === EOCD_SIGNATURE && offset + 22 + zip.readUInt16LE(offset + 20) === zip.length) return offset;
29
+ }
30
+ throw new Error("invalid ZIP: end-of-central-directory record not found within the bounded search window");
31
+ }
32
+
33
+ function inspectZip(zip, { binary, binaryBytes, maxUncompressedBytes, maxCompressedBytes }) {
34
+ if (!Number.isSafeInteger(binaryBytes) || binaryBytes <= 0 || !Number.isSafeInteger(maxUncompressedBytes) || maxUncompressedBytes <= 0 || !Number.isSafeInteger(maxCompressedBytes) || maxCompressedBytes <= 0) {
35
+ throw new Error("invalid ZIP extraction byte limits");
36
+ }
37
+ const eocd = locateEocd(zip);
38
+ const disk = zip.readUInt16LE(eocd + 4);
39
+ const centralDisk = zip.readUInt16LE(eocd + 6);
40
+ const diskEntries = zip.readUInt16LE(eocd + 8);
41
+ const entryCount = zip.readUInt16LE(eocd + 10);
42
+ const centralSize = zip.readUInt32LE(eocd + 12);
43
+ const centralOffset = zip.readUInt32LE(eocd + 16);
44
+ if (disk !== 0 || centralDisk !== 0 || diskEntries !== entryCount || entryCount === 0 || entryCount > MAX_ENTRIES || entryCount === 0xffff || centralSize === 0xffffffff || centralOffset === 0xffffffff) throw new Error("unsupported ZIP disk, ZIP64, or entry count");
45
+ if (centralSize > MAX_CENTRAL_BYTES || centralOffset + centralSize !== eocd || centralOffset + centralSize > zip.length) throw new Error("ZIP central directory exceeds its bounded parsing limit");
46
+ const entries = [];
47
+ const names = new Set();
48
+ let offset = centralOffset;
49
+ let totalCompressed = 0;
50
+ let totalUncompressed = 0;
51
+ for (let index = 0; index < entryCount; index++) {
52
+ if (offset + 46 > eocd || zip.readUInt32LE(offset) !== CENTRAL_SIGNATURE) throw new Error("invalid ZIP central directory entry");
53
+ const madeBy = zip.readUInt16LE(offset + 4) >>> 8;
54
+ const flags = zip.readUInt16LE(offset + 8);
55
+ const method = zip.readUInt16LE(offset + 10);
56
+ const crc = zip.readUInt32LE(offset + 16);
57
+ const compressedSize = zip.readUInt32LE(offset + 20);
58
+ const uncompressedSize = zip.readUInt32LE(offset + 24);
59
+ const nameLength = zip.readUInt16LE(offset + 28);
60
+ const extraLength = zip.readUInt16LE(offset + 30);
61
+ const commentLength = zip.readUInt16LE(offset + 32);
62
+ const external = zip.readUInt32LE(offset + 38);
63
+ const localOffset = zip.readUInt32LE(offset + 42);
64
+ const end = offset + 46 + nameLength + extraLength + commentLength;
65
+ if (end > eocd || nameLength === 0 || nameLength > 1024) throw new Error("invalid or oversized ZIP member name");
66
+ const name = zip.subarray(offset + 46, offset + 46 + nameLength).toString("utf8");
67
+ if (!safeName(name)) throw new Error(`unsafe ZIP member path: ${name}`);
68
+ if (names.has(name)) throw new Error(`duplicate ZIP member: ${name}`);
69
+ names.add(name);
70
+ if (flags & 1) throw new Error(`encrypted ZIP member is not allowed: ${name}`);
71
+ if (method !== 0 && method !== 8) throw new Error(`unsupported ZIP compression method for ${name}`);
72
+ const unixMode = madeBy === 3 ? (external >>> 16) & 0xffff : 0;
73
+ const unixType = unixMode & 0xf000;
74
+ const directory = name.endsWith("/");
75
+ if (unixType && unixType !== (directory ? 0x4000 : 0x8000)) throw new Error(`unsafe ZIP link, device, or special member type: ${name}`);
76
+ if (directory && (compressedSize !== 0 || uncompressedSize !== 0)) throw new Error(`invalid ZIP directory member size: ${name}`);
77
+ totalCompressed += compressedSize;
78
+ totalUncompressed += uncompressedSize;
79
+ if (!Number.isSafeInteger(totalCompressed) || totalCompressed > maxCompressedBytes) throw new Error("ZIP aggregate compressed size exceeds byte limit");
80
+ if (!Number.isSafeInteger(totalUncompressed) || totalUncompressed > maxUncompressedBytes) throw new Error("ZIP aggregate uncompressed size exceeds byte limit");
81
+ entries.push({ name, directory, flags, method, crc, compressedSize, uncompressedSize, localOffset });
82
+ offset = end;
83
+ }
84
+ if (offset !== eocd) throw new Error("ZIP central directory has trailing or missing records");
85
+ const expected = new Set(["draht-graph/", `draht-graph/${binary}`, "draht-graph/README.md", "draht-graph/LICENSE"]);
86
+ for (const name of names) if (!expected.has(name)) throw new Error(`unexpected ZIP member: ${name}`);
87
+ for (const name of expected) if (!names.has(name)) throw new Error(`missing ZIP member required by exact payload: ${name}`);
88
+ const binaryEntry = entries.find((entry) => entry.name === `draht-graph/${binary}`);
89
+ if (binaryEntry.uncompressedSize !== binaryBytes) throw new Error("ZIP expected binary size does not match manifest");
90
+ return entries;
91
+ }
92
+
93
+ export function extractGraphZip(archivePath, destDir, options) {
94
+ const zip = fs.readFileSync(archivePath);
95
+ const entries = inspectZip(zip, options);
96
+ fs.mkdirSync(destDir, { recursive: true });
97
+ for (const entry of entries) {
98
+ const outPath = path.join(destDir, ...entry.name.split("/"));
99
+ if (entry.directory) {
100
+ fs.mkdirSync(outPath, { recursive: true });
101
+ continue;
102
+ }
103
+ if (entry.localOffset + 30 > zip.length || zip.readUInt32LE(entry.localOffset) !== LOCAL_SIGNATURE) throw new Error(`invalid ZIP local header for ${entry.name}`);
104
+ const localFlags = zip.readUInt16LE(entry.localOffset + 6);
105
+ const localMethod = zip.readUInt16LE(entry.localOffset + 8);
106
+ const nameLength = zip.readUInt16LE(entry.localOffset + 26);
107
+ const extraLength = zip.readUInt16LE(entry.localOffset + 28);
108
+ const dataStart = entry.localOffset + 30 + nameLength + extraLength;
109
+ const dataEnd = dataStart + entry.compressedSize;
110
+ if ((localFlags & 1) || localMethod !== entry.method || dataEnd > zip.length) throw new Error(`invalid ZIP local member metadata for ${entry.name}`);
111
+ const localName = zip.subarray(entry.localOffset + 30, entry.localOffset + 30 + nameLength).toString("utf8");
112
+ if (localName !== entry.name) throw new Error(`ZIP local/central member name mismatch for ${entry.name}`);
113
+ const compressed = zip.subarray(dataStart, dataEnd);
114
+ let bytes;
115
+ try {
116
+ bytes = entry.method === 0 ? Buffer.from(compressed) : zlib.inflateRawSync(compressed, { maxOutputLength: Math.min(options.maxUncompressedBytes, entry.uncompressedSize + 1) });
117
+ } catch (error) {
118
+ throw new Error(`ZIP member expanded beyond its declared uncompressed size: ${entry.name}`, { cause: error });
119
+ }
120
+ if (bytes.length !== entry.uncompressedSize) throw new Error(`ZIP member uncompressed size mismatch: ${entry.name}`);
121
+ if (crc32(bytes) !== entry.crc) throw new Error(`ZIP member CRC mismatch: ${entry.name}`);
122
+ fs.mkdirSync(path.dirname(outPath), { recursive: true });
123
+ fs.writeFileSync(outPath, bytes, { flag: "wx" });
124
+ }
125
+ }
@@ -0,0 +1,97 @@
1
+ const MANIFEST_SCHEMA_VERSION = 1;
2
+ const SHA256_RE = /^[a-f0-9]{64}$/;
3
+ const COMMIT_RE = /^[a-f0-9]{40}$/;
4
+ const GITHUB_WORKFLOW_BUILD_TYPE = "https://actions.github.io/buildtypes/workflow/v1";
5
+ const RELEASE_WORKFLOW_PATH = ".github/workflows/build-binaries.yml";
6
+
7
+ export const GRAPH_IO_LIMITS = Object.freeze({
8
+ manifestBytes: 1024 * 1024,
9
+ checksumBytes: 1024 * 1024,
10
+ archiveBytes: 128 * 1024 * 1024,
11
+ binaryBytes: 256 * 1024 * 1024,
12
+ decompressedBytes: 258 * 1024 * 1024,
13
+ aggregateDownloadBytes: 130 * 1024 * 1024,
14
+ });
15
+
16
+ const PLATFORM_METADATA = Object.freeze({
17
+ "darwin-arm64": { goos: "darwin", goarch: "arm64", archive: "draht-graph-darwin-arm64.tar.gz", binary: "draht-graph" },
18
+ "darwin-x64": { goos: "darwin", goarch: "amd64", archive: "draht-graph-darwin-x64.tar.gz", binary: "draht-graph" },
19
+ "linux-x64": { goos: "linux", goarch: "amd64", archive: "draht-graph-linux-x64.tar.gz", binary: "draht-graph" },
20
+ "linux-arm64": { goos: "linux", goarch: "arm64", archive: "draht-graph-linux-arm64.tar.gz", binary: "draht-graph" },
21
+ "windows-x64": { goos: "windows", goarch: "amd64", archive: "draht-graph-windows-x64.zip", binary: "draht-graph.exe" },
22
+ });
23
+
24
+ function invalid(detail) {
25
+ throw new Error(`invalid graph release manifest: ${detail}`);
26
+ }
27
+
28
+ export function validateGraphManifest(manifest, { version, tag, platform, commit }) {
29
+ if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) invalid("document must be an object");
30
+ if (manifest.schemaVersion !== MANIFEST_SCHEMA_VERSION) invalid(`schemaVersion must be ${MANIFEST_SCHEMA_VERSION}`);
31
+ if (manifest.name !== "draht-graph") invalid("name must be draht-graph");
32
+ const expectedVersion = version.startsWith("v") ? version.slice(1) : version;
33
+ const expectedTag = tag || `v${expectedVersion}`;
34
+ if (manifest.version !== expectedVersion) invalid(`version must be ${expectedVersion}`);
35
+ if (manifest.tag !== expectedTag) invalid(`tag must be ${expectedTag}`);
36
+ if (typeof manifest.gitCommit !== "string" || !COMMIT_RE.test(manifest.gitCommit)) invalid("gitCommit must be a lowercase 40-character commit SHA");
37
+ if (commit && manifest.gitCommit !== commit) invalid(`gitCommit must be the ${expectedTag} release commit ${commit}`);
38
+ if (!Array.isArray(manifest.artifacts)) invalid("artifacts must be an array");
39
+ const expected = PLATFORM_METADATA[platform];
40
+ if (!expected) invalid(`unsupported platform ${platform}`);
41
+ const entry = manifest.artifacts.find((artifact) => artifact?.platform === platform);
42
+ if (!entry) invalid(`missing artifact for ${platform}`);
43
+ for (const field of ["goos", "goarch", "archive", "binary"]) {
44
+ if (entry[field] !== expected[field]) invalid(`${platform} ${field} must be ${expected[field]}`);
45
+ }
46
+ for (const field of ["archiveSha256", "binarySha256"]) {
47
+ if (typeof entry[field] !== "string" || !SHA256_RE.test(entry[field])) invalid(`${platform} ${field} must be a lowercase SHA-256 digest`);
48
+ }
49
+ for (const field of ["archiveBytes", "binaryBytes"]) {
50
+ if (!Number.isSafeInteger(entry[field]) || entry[field] <= 0) invalid(`${platform} ${field} must be a positive integer`);
51
+ }
52
+ if (entry.archiveBytes > GRAPH_IO_LIMITS.archiveBytes) invalid(`${platform} archiveBytes exceeds the archive size limit`);
53
+ if (entry.binaryBytes > GRAPH_IO_LIMITS.binaryBytes) invalid(`${platform} binaryBytes exceeds the extracted binary size limit`);
54
+ return entry;
55
+ }
56
+
57
+ export function validateGraphChecksums(text, entry, platform) {
58
+ const sums = new Map();
59
+ for (const line of String(text).split(/\r?\n/)) {
60
+ if (!line) continue;
61
+ const match = /^([a-f0-9]{64}) ([A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)?)$/.exec(line);
62
+ if (!match || sums.has(match[2])) throw new Error("invalid graph SHA256SUMS");
63
+ sums.set(match[2], match[1]);
64
+ }
65
+ if (sums.get(entry.archive) !== entry.archiveSha256) throw new Error(`SHA256SUMS is not bound to ${entry.archive}`);
66
+ if (sums.get(`${platform}/${entry.binary}`) !== entry.binarySha256) throw new Error(`SHA256SUMS is not bound to ${platform}/${entry.binary}`);
67
+ }
68
+
69
+ export function validateGraphAttestation(output, { archive, digest, repo, commit, tag }) {
70
+ const repository = `https://github.com/${repo}`;
71
+ const workflowRef = `refs/tags/${tag}`;
72
+ let records;
73
+ try { records = JSON.parse(output); } catch { throw new Error("gh attestation output is not JSON"); }
74
+ if (!Array.isArray(records)) records = [records];
75
+ for (const record of records) {
76
+ const extensions = record?.verificationResult?.signature?.certificate?.extensions;
77
+ if (extensions?.sourceRepositoryURI !== repository || extensions?.sourceRepositoryDigest !== commit || extensions?.runnerEnvironment !== "github-hosted") continue;
78
+ const envelope = record?.attestation?.bundle?.dsseEnvelope;
79
+ if (envelope?.payloadType !== "application/vnd.in-toto+json" || typeof envelope.payload !== "string") continue;
80
+ let statement;
81
+ try { statement = JSON.parse(Buffer.from(envelope.payload, "base64").toString("utf8")); } catch { continue; }
82
+ if (statement?._type !== "https://in-toto.io/Statement/v1" || statement?.predicateType !== "https://slsa.dev/provenance/v1" || !Array.isArray(statement.subject)) continue;
83
+ const subject = statement.subject.find((item) => item?.name === archive && item?.digest?.sha256 === digest);
84
+ const buildDefinition = statement?.predicate?.buildDefinition;
85
+ const workflow = buildDefinition?.externalParameters?.workflow;
86
+ const dependencies = buildDefinition?.resolvedDependencies;
87
+ const source = Array.isArray(dependencies) && dependencies.some((item) =>
88
+ item?.uri === `git+https://github.com/${repo}@${workflowRef}` && item?.digest?.gitCommit === commit);
89
+ const expectedWorkflow = buildDefinition?.buildType === GITHUB_WORKFLOW_BUILD_TYPE
90
+ && workflow?.repository === repository
91
+ && workflow?.path === RELEASE_WORKFLOW_PATH
92
+ && workflow?.ref === workflowRef
93
+ && statement?.predicate?.runDetails?.builder?.id === `${repository}/${RELEASE_WORKFLOW_PATH}@${workflowRef}`;
94
+ if (subject && source && expectedWorkflow) return;
95
+ }
96
+ throw new Error(`gh provenance attestation is not structurally bound to ${archive}, ${repo}, and ${commit}`);
97
+ }
package/hooks/hooks.json CHANGED
@@ -18,6 +18,11 @@
18
18
  {
19
19
  "type": "command",
20
20
  "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/prompt-context.cjs\""
21
+ },
22
+ {
23
+ "type": "command",
24
+ "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/judge-hook.cjs\" UserPromptSubmit",
25
+ "timeout": 10
21
26
  }
22
27
  ]
23
28
  }
@@ -30,6 +35,23 @@
30
35
  "type": "command",
31
36
  "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/post-edit-check.cjs\"",
32
37
  "timeout": 30
38
+ },
39
+ {
40
+ "type": "command",
41
+ "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/judge-hook.cjs\" PostToolUse",
42
+ "timeout": 10
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "PreToolUse": [
48
+ {
49
+ "matcher": "Edit|Write|MultiEdit",
50
+ "hooks": [
51
+ {
52
+ "type": "command",
53
+ "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/judge-hook.cjs\" PreToolUse",
54
+ "timeout": 3600
33
55
  }
34
56
  ]
35
57
  }
@@ -42,6 +64,23 @@
42
64
  "type": "command",
43
65
  "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/stop-quality-gate.cjs\"",
44
66
  "timeout": 180
67
+ },
68
+ {
69
+ "type": "command",
70
+ "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/judge-hook.cjs\" Stop",
71
+ "timeout": 3600
72
+ }
73
+ ]
74
+ }
75
+ ],
76
+ "PermissionRequest": [
77
+ {
78
+ "matcher": "",
79
+ "hooks": [
80
+ {
81
+ "type": "command",
82
+ "command": "node \"${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT}}/scripts/judge-hook.cjs\" PermissionRequest",
83
+ "timeout": 3600
45
84
  }
46
85
  ]
47
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "draht-codex",
3
- "version": "2026.7.30",
3
+ "version": "2026.10.4-2",
4
4
  "description": "Draht GSD, multi-agent, TDD and DDD workflows as a Codex plugin. Install with `npx draht-codex install`.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,8 @@
15
15
  "agents",
16
16
  "skills",
17
17
  "cli.mjs",
18
+ "graph-archive.mjs",
19
+ "graph-manifest.mjs",
18
20
  "README.md",
19
21
  "LICENSE",
20
22
  "CHANGELOG.md"
@@ -22,10 +24,10 @@
22
24
  "scripts": {
23
25
  "sync-tools": "node ../../scripts/sync-draht-tools.mjs",
24
26
  "test": "node cli.mjs --help > /dev/null && node scripts/gsd-pre-execute.cjs --self-check 2>/dev/null || true",
25
- "prepublishOnly": "node ../../scripts/sync-draht-tools.mjs"
27
+ "prepublishOnly": "node ../../scripts/sync-draht-tools.mjs && node ../../scripts/generate-skills-artifacts.mjs --check"
26
28
  },
27
29
  "dependencies": {
28
- "@draht/tools": "2026.7.30"
30
+ "@draht/tools": "2026.10.4-2"
29
31
  },
30
32
  "keywords": [
31
33
  "codex",
@@ -80,9 +80,9 @@ try {
80
80
  execSync(tsCmd, { timeout: 60000, encoding: "utf-8", cwd });
81
81
  } catch (error) {
82
82
  const output = error.stdout || error.stderr || "";
83
- const errorCount = (output.match(/error TS/g) || []).length;
84
- if (errorCount > 0) {
85
- issues.push({ severity: strict ? "error" : "warning", message: `${errorCount} TypeScript error(s)`, details: output.slice(0, 500) });
83
+ const errorLines = output.split("\n").filter((line) => /error TS/.test(line));
84
+ if (errorLines.length > 0) {
85
+ issues.push({ severity: strict ? "error" : "warning", message: `${errorLines.length} TypeScript error(s)`, details: errorLines.join("\n").slice(0, 500) });
86
86
  }
87
87
  }
88
88
 
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bridge from the host's hook runner to the Python judge hook.
4
+ *
5
+ * node judge-hook.cjs PermissionRequest|Stop|UserPromptSubmit (payload on stdin)
6
+ *
7
+ * Every other hook in this plugin is Node, and Node is guaranteed present
8
+ * wherever the host runs; a Python interpreter is not (Windows in particular
9
+ * ships none under the name `python3`). Calling the .py file directly from
10
+ * hooks.json would therefore turn a missing interpreter into an error on every
11
+ * prompt and every finished turn. This shim locates an interpreter instead and,
12
+ * finding none, exits 0 — judge is simply inert, and the host's own permission
13
+ * dialog appears exactly as it did before the plugin was installed.
14
+ *
15
+ * stdio is inherited so the hook payload on stdin and the hook's JSON reply on
16
+ * stdout pass through untouched, and so a PermissionRequest can block for as
17
+ * long as the human takes to swipe.
18
+ */
19
+
20
+ const { spawnSync } = require("node:child_process");
21
+ const path = require("node:path");
22
+
23
+ const event = process.argv[2];
24
+ const script = path.join(__dirname, "judge-hook.py");
25
+
26
+ const candidates = [
27
+ ["python3", [script, event]],
28
+ // Windows: the launcher is the reliable way to reach a Python 3.
29
+ ...(process.platform === "win32" ? [["py", ["-3", script, event]]] : []),
30
+ ["python", [script, event]],
31
+ ];
32
+
33
+ for (const [exe, args] of candidates) {
34
+ const result = spawnSync(exe, args, { stdio: "inherit" });
35
+ if (result.error) {
36
+ if (result.error.code === "ENOENT") continue;
37
+ break;
38
+ }
39
+ process.exit(result.status ?? 0);
40
+ }
41
+
42
+ process.exit(0);