@hegemonart/get-design-done 1.55.0 → 1.57.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.
Files changed (36) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +90 -0
  4. package/README.md +6 -0
  5. package/SKILL.md +2 -0
  6. package/agents/design-fixer.md +16 -0
  7. package/dist/claude-code/.claude/skills/override/SKILL.md +86 -0
  8. package/dist/claude-code/.claude/skills/state/SKILL.md +106 -0
  9. package/hooks/gdd-decision-injector.js +58 -0
  10. package/hooks/gdd-fact-force.js +434 -0
  11. package/hooks/gdd-risk-gate.js +406 -0
  12. package/hooks/hooks.json +18 -0
  13. package/package.json +1 -1
  14. package/reference/schemas/events.schema.json +61 -1
  15. package/reference/skill-graph.md +3 -1
  16. package/scripts/lib/manifest/skills.json +16 -0
  17. package/scripts/lib/risk/calibration.cjs +385 -0
  18. package/scripts/lib/risk/compute-risk.cjs +229 -0
  19. package/scripts/lib/risk/consumers.cjs +211 -0
  20. package/scripts/lib/risk/override.cjs +87 -0
  21. package/scripts/lib/risk/route.cjs +59 -0
  22. package/scripts/lib/risk/tables.cjs +221 -0
  23. package/scripts/lib/state/migrate-to-sqlite.cjs +664 -0
  24. package/scripts/lib/state/query-surface.cjs +391 -0
  25. package/scripts/lib/state/render-markdown.cjs +717 -0
  26. package/scripts/lib/state/state-backend.cjs +345 -0
  27. package/scripts/lib/state/state-store.cjs +735 -0
  28. package/sdk/cli/index.js +193 -96
  29. package/sdk/dashboard/data/source.cjs +44 -5
  30. package/sdk/mcp/gdd-state/server.js +127 -30
  31. package/sdk/mcp/gdd-state/tools/get.ts +8 -0
  32. package/sdk/state/index.ts +267 -13
  33. package/sdk/state/lockfile.ts +48 -0
  34. package/sdk/state/schema.sql +218 -0
  35. package/skills/override/SKILL.md +86 -0
  36. package/skills/state/SKILL.md +106 -0
package/sdk/cli/index.js CHANGED
@@ -2187,7 +2187,7 @@ var COMMON_FLAGS = Object.freeze([
2187
2187
 
2188
2188
  // sdk/cli/commands/run.ts
2189
2189
  var import_node_fs11 = require("node:fs");
2190
- var import_node_path9 = require("node:path");
2190
+ var import_node_path10 = require("node:path");
2191
2191
 
2192
2192
  // scripts/lib/pipeline-runner/index.ts
2193
2193
  init_event_stream();
@@ -2434,6 +2434,7 @@ function getLogger() {
2434
2434
 
2435
2435
  // sdk/state/index.ts
2436
2436
  var import_node_fs5 = require("node:fs");
2437
+ var import_node_path4 = require("node:path");
2437
2438
 
2438
2439
  // sdk/state/lockfile.ts
2439
2440
  var import_node_fs4 = require("node:fs");
@@ -2587,7 +2588,10 @@ function getErrnoCode(err) {
2587
2588
  return void 0;
2588
2589
  }
2589
2590
  function sleep(ms) {
2590
- return new Promise((resolve11) => setTimeout(resolve11, ms));
2591
+ return new Promise((resolve12) => setTimeout(resolve12, ms));
2592
+ }
2593
+ async function acquireSqliteLock(sqlitePath, opts = {}) {
2594
+ return acquire(sqlitePath, opts);
2591
2595
  }
2592
2596
 
2593
2597
  // sdk/state/parser.ts
@@ -3965,11 +3969,64 @@ function gateFor(from, to) {
3965
3969
  }
3966
3970
 
3967
3971
  // sdk/state/index.ts
3972
+ function _findPackageRoot(startDir) {
3973
+ let dir = (0, import_node_path4.resolve)(startDir);
3974
+ let firstWithPkg = null;
3975
+ for (let i = 0; i < 12; i++) {
3976
+ const pkgPath = (0, import_node_path4.join)(dir, "package.json");
3977
+ if ((0, import_node_fs5.existsSync)(pkgPath)) {
3978
+ try {
3979
+ const pkg = require(pkgPath);
3980
+ if (firstWithPkg === null) firstWithPkg = dir;
3981
+ if (pkg.name === "@hegemonart/get-design-done") return dir;
3982
+ } catch {
3983
+ if (firstWithPkg === null) firstWithPkg = dir;
3984
+ }
3985
+ }
3986
+ const parent = (0, import_node_path4.dirname)(dir);
3987
+ if (parent === dir) break;
3988
+ dir = parent;
3989
+ }
3990
+ return firstWithPkg;
3991
+ }
3992
+ var _backendCache = null;
3993
+ function _loadBackend() {
3994
+ if (_backendCache !== null) return _backendCache === false ? null : _backendCache;
3995
+ try {
3996
+ const pkgRoot = _findPackageRoot(__dirname);
3997
+ if (pkgRoot === null) {
3998
+ _backendCache = false;
3999
+ return null;
4000
+ }
4001
+ const backendPath = (0, import_node_path4.join)(pkgRoot, "scripts", "lib", "state", "state-backend.cjs");
4002
+ if (!(0, import_node_fs5.existsSync)(backendPath)) {
4003
+ _backendCache = false;
4004
+ return null;
4005
+ }
4006
+ _backendCache = require(backendPath);
4007
+ return _backendCache;
4008
+ } catch {
4009
+ _backendCache = false;
4010
+ return null;
4011
+ }
4012
+ }
4013
+ function migrationActive(statePath) {
4014
+ const backend = _loadBackend();
4015
+ if (backend === null || backend.BACKEND !== "sqlite") return false;
4016
+ const sqliteSibling = (0, import_node_path4.join)((0, import_node_path4.dirname)(statePath), "state.sqlite");
4017
+ return (0, import_node_fs5.existsSync)(sqliteSibling);
4018
+ }
3968
4019
  async function read(path) {
3969
4020
  const raw = (0, import_node_fs5.readFileSync)(path, "utf8");
3970
4021
  return parse(raw).state;
3971
4022
  }
3972
4023
  async function mutate(path, fn) {
4024
+ if (migrationActive(path)) {
4025
+ return _mutateSqliteActive(path, fn);
4026
+ }
4027
+ return _mutateMarkdown(path, fn);
4028
+ }
4029
+ async function _mutateMarkdown(path, fn) {
3973
4030
  const release = await acquire(path);
3974
4031
  const tmpPath = `${path}.tmp`;
3975
4032
  try {
@@ -4006,6 +4063,46 @@ async function mutate(path, fn) {
4006
4063
  await release();
4007
4064
  }
4008
4065
  }
4066
+ async function _mutateSqliteActive(path, fn) {
4067
+ const sqlitePath = (0, import_node_path4.join)((0, import_node_path4.dirname)(path), "state.sqlite");
4068
+ const releaseSqliteLock = await acquireSqliteLock(sqlitePath);
4069
+ const release = await acquire(path);
4070
+ const tmpPath = `${path}.tmp`;
4071
+ try {
4072
+ const raw = (0, import_node_fs5.readFileSync)(path, "utf8");
4073
+ const { state, raw_bodies, raw_frontmatter, block_gaps, line_ending } = parse(raw);
4074
+ const clone = structuredClone(state);
4075
+ const next = fn(clone);
4076
+ const out = serialize(next, {
4077
+ raw_frontmatter,
4078
+ raw_bodies,
4079
+ block_gaps,
4080
+ line_ending
4081
+ });
4082
+ (0, import_node_fs5.writeFileSync)(tmpPath, out, "utf8");
4083
+ try {
4084
+ (0, import_node_fs5.renameSync)(tmpPath, path);
4085
+ } catch (err) {
4086
+ const code = typeof err === "object" && err !== null && "code" in err ? err.code : void 0;
4087
+ if (code === "EPERM" || code === "EBUSY") {
4088
+ await new Promise((r) => setTimeout(r, 50));
4089
+ (0, import_node_fs5.renameSync)(tmpPath, path);
4090
+ } else {
4091
+ throw err;
4092
+ }
4093
+ }
4094
+ return next;
4095
+ } catch (err) {
4096
+ try {
4097
+ if ((0, import_node_fs5.existsSync)(tmpPath)) (0, import_node_fs5.unlinkSync)(tmpPath);
4098
+ } catch {
4099
+ }
4100
+ throw err;
4101
+ } finally {
4102
+ await release();
4103
+ await releaseSqliteLock();
4104
+ }
4105
+ }
4009
4106
  async function transition(path, toStage) {
4010
4107
  const beforeMutate = await read(path);
4011
4108
  const from = beforeMutate.position.stage;
@@ -4098,7 +4195,7 @@ function resolveStageOrder(input = {}) {
4098
4195
  }
4099
4196
 
4100
4197
  // scripts/lib/context-engine/index.ts
4101
- var import_node_path4 = require("node:path");
4198
+ var import_node_path5 = require("node:path");
4102
4199
  var import_node_buffer3 = require("node:buffer");
4103
4200
 
4104
4201
  // scripts/lib/context-engine/manifest.ts
@@ -4299,7 +4396,7 @@ function buildContextBundle(stage, opts = {}) {
4299
4396
  const files = [];
4300
4397
  let total_bytes = 0;
4301
4398
  for (const entry of manifest) {
4302
- const absPath = (0, import_node_path4.resolve)(cwd, entry);
4399
+ const absPath = (0, import_node_path5.resolve)(cwd, entry);
4303
4400
  const { present, raw, raw_bytes } = readFileRaw(absPath);
4304
4401
  if (!present) {
4305
4402
  if (strict) {
@@ -4442,7 +4539,7 @@ function isNativeTool(name) {
4442
4539
 
4443
4540
  // scripts/lib/tool-scoping/parse-agent-tools.ts
4444
4541
  var import_node_fs7 = require("node:fs");
4445
- var import_node_path5 = require("node:path");
4542
+ var import_node_path6 = require("node:path");
4446
4543
  function parseAgentTools(agentMdPath) {
4447
4544
  let raw;
4448
4545
  try {
@@ -4458,7 +4555,7 @@ function parseAgentTools(agentMdPath) {
4458
4555
  return extractToolsField(frontmatter);
4459
4556
  }
4460
4557
  function parseAgentToolsByName(name, agentsRoot = "agents") {
4461
- const path = (0, import_node_path5.resolve)(agentsRoot, `${name}.md`);
4558
+ const path = (0, import_node_path6.resolve)(agentsRoot, `${name}.md`);
4462
4559
  return parseAgentTools(path);
4463
4560
  }
4464
4561
  function extractFrontmatter(raw) {
@@ -4881,21 +4978,21 @@ function collapseBlankLines(text) {
4881
4978
  // scripts/lib/session-runner/errors.ts
4882
4979
  var import_node_module2 = require("node:module");
4883
4980
  var import_node_fs8 = require("node:fs");
4884
- var import_node_path6 = require("node:path");
4981
+ var import_node_path7 = require("node:path");
4885
4982
  function findRepoRoot() {
4886
4983
  let dir = process.cwd();
4887
4984
  for (let i = 0; i < 8; i++) {
4888
- if ((0, import_node_fs8.existsSync)((0, import_node_path6.join)(dir, "package.json"))) return dir;
4889
- const parent = (0, import_node_path6.dirname)(dir);
4985
+ if ((0, import_node_fs8.existsSync)((0, import_node_path7.join)(dir, "package.json"))) return dir;
4986
+ const parent = (0, import_node_path7.dirname)(dir);
4890
4987
  if (parent === dir) break;
4891
4988
  dir = parent;
4892
4989
  }
4893
4990
  return process.cwd();
4894
4991
  }
4895
4992
  var REPO_ROOT = findRepoRoot();
4896
- var nodeRequire = (0, import_node_module2.createRequire)((0, import_node_path6.join)(REPO_ROOT, "package.json"));
4993
+ var nodeRequire = (0, import_node_module2.createRequire)((0, import_node_path7.join)(REPO_ROOT, "package.json"));
4897
4994
  var transportClassifier = nodeRequire(
4898
- (0, import_node_path6.resolve)(REPO_ROOT, "sdk/primitives/error-classifier.cjs")
4995
+ (0, import_node_path7.resolve)(REPO_ROOT, "sdk/primitives/error-classifier.cjs")
4899
4996
  );
4900
4997
  function sdkType(err) {
4901
4998
  if (err === null || err === void 0 || typeof err !== "object") return "";
@@ -5133,7 +5230,7 @@ function mapSdkError(err) {
5133
5230
 
5134
5231
  // scripts/lib/session-runner/transcript.ts
5135
5232
  var import_node_fs9 = require("node:fs");
5136
- var import_node_path7 = require("node:path");
5233
+ var import_node_path8 = require("node:path");
5137
5234
  var DEFAULT_SESSION_DIR = ".design/sessions";
5138
5235
  var MAX_LINE_BYTES = 64 * 1024;
5139
5236
  var TRUNCATION_PREVIEW_BYTES = 1024;
@@ -5149,7 +5246,7 @@ var TranscriptWriter = class {
5149
5246
  /** Most recent write error. `null` while healthy. */
5150
5247
  lastError = null;
5151
5248
  constructor(rawPath) {
5152
- this.path = (0, import_node_path7.isAbsolute)(rawPath) ? rawPath : (0, import_node_path7.resolve)(process.cwd(), rawPath);
5249
+ this.path = (0, import_node_path8.isAbsolute)(rawPath) ? rawPath : (0, import_node_path8.resolve)(process.cwd(), rawPath);
5153
5250
  }
5154
5251
  /**
5155
5252
  * Append one chunk. Never throws; I/O failures are recorded on
@@ -5233,13 +5330,13 @@ var TranscriptWriter = class {
5233
5330
  const safeStage = /^[a-z0-9][a-z0-9._-]*$/i.test(stage) ? stage : "custom";
5234
5331
  const dir = baseDir ?? process.env["GDD_SESSION_DIR"] ?? DEFAULT_SESSION_DIR;
5235
5332
  const filename = `${iso}-${safeStage}.jsonl`;
5236
- const full = (0, import_node_path7.join)(dir, filename);
5237
- return (0, import_node_path7.isAbsolute)(full) ? full : (0, import_node_path7.resolve)(process.cwd(), full);
5333
+ const full = (0, import_node_path8.join)(dir, filename);
5334
+ return (0, import_node_path8.isAbsolute)(full) ? full : (0, import_node_path8.resolve)(process.cwd(), full);
5238
5335
  }
5239
5336
  /** Ensure the target directory exists. Memoized per-writer. */
5240
5337
  ensureDirectory() {
5241
5338
  if (this.directoryEnsured) return;
5242
- (0, import_node_fs9.mkdirSync)((0, import_node_path7.dirname)(this.path), { recursive: true });
5339
+ (0, import_node_fs9.mkdirSync)((0, import_node_path8.dirname)(this.path), { recursive: true });
5243
5340
  this.directoryEnsured = true;
5244
5341
  }
5245
5342
  };
@@ -5247,30 +5344,30 @@ var TranscriptWriter = class {
5247
5344
  // scripts/lib/session-runner/index.ts
5248
5345
  var import_node_module3 = require("node:module");
5249
5346
  var import_node_fs10 = require("node:fs");
5250
- var import_node_path8 = require("node:path");
5347
+ var import_node_path9 = require("node:path");
5251
5348
  function _findRepoRoot2() {
5252
5349
  let dir = process.cwd();
5253
5350
  for (let i = 0; i < 8; i++) {
5254
- if ((0, import_node_fs10.existsSync)((0, import_node_path8.join)(dir, "package.json"))) return dir;
5255
- const parent = (0, import_node_path8.dirname)(dir);
5351
+ if ((0, import_node_fs10.existsSync)((0, import_node_path9.join)(dir, "package.json"))) return dir;
5352
+ const parent = (0, import_node_path9.dirname)(dir);
5256
5353
  if (parent === dir) break;
5257
5354
  dir = parent;
5258
5355
  }
5259
5356
  return process.cwd();
5260
5357
  }
5261
5358
  var _REPO_ROOT = _findRepoRoot2();
5262
- var _nodeRequire = (0, import_node_module3.createRequire)((0, import_node_path8.join)(_REPO_ROOT, "package.json"));
5359
+ var _nodeRequire = (0, import_node_module3.createRequire)((0, import_node_path9.join)(_REPO_ROOT, "package.json"));
5263
5360
  var jitteredBackoff = _nodeRequire(
5264
- (0, import_node_path8.resolve)(_REPO_ROOT, "sdk/primitives/jittered-backoff.cjs")
5361
+ (0, import_node_path9.resolve)(_REPO_ROOT, "sdk/primitives/jittered-backoff.cjs")
5265
5362
  );
5266
5363
  var rateGuard = _nodeRequire(
5267
- (0, import_node_path8.resolve)(_REPO_ROOT, "scripts/lib/rate-guard.cjs")
5364
+ (0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/rate-guard.cjs")
5268
5365
  );
5269
5366
  var banditIntegration = _nodeRequire(
5270
- (0, import_node_path8.resolve)(_REPO_ROOT, "scripts/lib/bandit-router/integration.cjs")
5367
+ (0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/bandit-router/integration.cjs")
5271
5368
  );
5272
5369
  var adaptiveModeLib = _nodeRequire(
5273
- (0, import_node_path8.resolve)(_REPO_ROOT, "scripts/lib/adaptive-mode.cjs")
5370
+ (0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/adaptive-mode.cjs")
5274
5371
  );
5275
5372
  var RATE_GUARD_PROVIDER = "anthropic";
5276
5373
  var DEFAULT_MAX_RETRIES = 2;
@@ -5309,7 +5406,7 @@ function loadPeerRegistry() {
5309
5406
  if (_peerRegistryCache !== void 0) return _peerRegistryCache;
5310
5407
  try {
5311
5408
  const mod = _nodeRequire(
5312
- (0, import_node_path8.resolve)(_REPO_ROOT, "scripts/lib/peer-cli/registry.cjs")
5409
+ (0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/peer-cli/registry.cjs")
5313
5410
  );
5314
5411
  if (mod && typeof mod === "object" && typeof mod.dispatch === "function") {
5315
5412
  _peerRegistryCache = mod;
@@ -5936,7 +6033,7 @@ async function loadSdkQuery() {
5936
6033
  return sdk.query;
5937
6034
  }
5938
6035
  function sleep2(ms) {
5939
- return new Promise((resolve11) => setTimeout(resolve11, Math.max(0, ms)));
6036
+ return new Promise((resolve12) => setTimeout(resolve12, Math.max(0, ms)));
5940
6037
  }
5941
6038
  function buildResult(args) {
5942
6039
  const cost = usdCost(args.usage.input, args.usage.output, args.usage.model);
@@ -6632,7 +6729,7 @@ async function runCommand(args, deps = {}) {
6632
6729
  const pipelineRun = deps.pipelineRun ?? run2;
6633
6730
  let overrides = {};
6634
6731
  if (flags["dry-run"] === true) {
6635
- const fixtureDir = typeof flags["fixture"] === "string" && flags["fixture"].length > 0 ? (0, import_node_path9.resolve)(process.cwd(), flags["fixture"]) : cwd;
6732
+ const fixtureDir = typeof flags["fixture"] === "string" && flags["fixture"].length > 0 ? (0, import_node_path10.resolve)(process.cwd(), flags["fixture"]) : cwd;
6636
6733
  try {
6637
6734
  overrides = buildDryRunOverrides(cwd, fixtureDir);
6638
6735
  } catch (err) {
@@ -6687,7 +6784,7 @@ function loadPrompts(stages, flags, cwd) {
6687
6784
  verify: DEFAULT_PROMPTS.verify
6688
6785
  };
6689
6786
  for (const stage of stages) {
6690
- const p = (0, import_node_path9.resolve)(cwd, ".design/prompts", `${stage}.md`);
6787
+ const p = (0, import_node_path10.resolve)(cwd, ".design/prompts", `${stage}.md`);
6691
6788
  try {
6692
6789
  prompts[stage] = (0, import_node_fs11.readFileSync)(p, "utf8");
6693
6790
  } catch {
@@ -6714,7 +6811,7 @@ function loadPrompts(stages, flags, cwd) {
6714
6811
  { stageName }
6715
6812
  );
6716
6813
  }
6717
- const absPath = (0, import_node_path9.resolve)(cwd, filePath);
6814
+ const absPath = (0, import_node_path10.resolve)(cwd, filePath);
6718
6815
  try {
6719
6816
  prompts[stageName] = (0, import_node_fs11.readFileSync)(absPath, "utf8");
6720
6817
  } catch (err) {
@@ -6910,7 +7007,7 @@ function buildDryRunOverrides(cwd, fixtureDir) {
6910
7007
  };
6911
7008
  }
6912
7009
  function loadCannedSession(fixtureDir, stage) {
6913
- const cannedPath = (0, import_node_path9.resolve)(fixtureDir, "expected-outputs", `canned-${stage}.json`);
7010
+ const cannedPath = (0, import_node_path10.resolve)(fixtureDir, "expected-outputs", `canned-${stage}.json`);
6914
7011
  let raw;
6915
7012
  try {
6916
7013
  raw = (0, import_node_fs11.readFileSync)(cannedPath, "utf8");
@@ -6943,8 +7040,8 @@ function loadCannedSession(fixtureDir, stage) {
6943
7040
  function writeDryRunArtifacts(cwd, stage) {
6944
7041
  const artifacts = DRY_RUN_ARTIFACTS[stage];
6945
7042
  for (const { path: relPath, body } of artifacts) {
6946
- const abs = (0, import_node_path9.join)(cwd, relPath);
6947
- const dir = (0, import_node_path9.dirname)(abs);
7043
+ const abs = (0, import_node_path10.join)(cwd, relPath);
7044
+ const dir = (0, import_node_path10.dirname)(abs);
6948
7045
  if (!(0, import_node_fs11.existsSync)(dir)) {
6949
7046
  (0, import_node_fs11.mkdirSync)(dir, { recursive: true });
6950
7047
  }
@@ -6954,10 +7051,10 @@ function writeDryRunArtifacts(cwd, stage) {
6954
7051
 
6955
7052
  // sdk/cli/commands/stage.ts
6956
7053
  var import_node_fs15 = require("node:fs");
6957
- var import_node_path14 = require("node:path");
7054
+ var import_node_path15 = require("node:path");
6958
7055
 
6959
7056
  // scripts/lib/explore-parallel-runner/index.ts
6960
- var import_node_path12 = require("node:path");
7057
+ var import_node_path13 = require("node:path");
6961
7058
  var import_concurrency_tuner = __toESM(require_concurrency_tuner());
6962
7059
  var import_incremental_discover = __toESM(require_incremental_discover());
6963
7060
  var import_stack = __toESM(require_stack());
@@ -6965,7 +7062,7 @@ var import_mapper_spawn = __toESM(require_mapper_spawn());
6965
7062
 
6966
7063
  // scripts/lib/explore-parallel-runner/mappers.ts
6967
7064
  var import_node_fs12 = require("node:fs");
6968
- var import_node_path10 = require("node:path");
7065
+ var import_node_path11 = require("node:path");
6969
7066
  function isParallelismSafe(agentPath) {
6970
7067
  let raw;
6971
7068
  try {
@@ -6990,7 +7087,7 @@ function isParallelismSafe(agentPath) {
6990
7087
  async function spawnMapper(spec, opts) {
6991
7088
  const start = Date.now();
6992
7089
  const agentBaseName = spec.agentPath.replace(/\\/g, "/").split("/").pop()?.replace(/\.md$/i, "") ?? spec.name;
6993
- const agentsRoot = (0, import_node_path10.resolve)(
7090
+ const agentsRoot = (0, import_node_path11.resolve)(
6994
7091
  opts.cwd,
6995
7092
  spec.agentPath.replace(/\\/g, "/").split("/").slice(0, -1).join("/") || "agents"
6996
7093
  );
@@ -7033,7 +7130,7 @@ async function spawnMapper(spec, opts) {
7033
7130
  error: Object.freeze({ code: "RUN_THREW", message })
7034
7131
  });
7035
7132
  }
7036
- const outputFullPath = (0, import_node_path10.resolve)(opts.cwd, spec.outputPath);
7133
+ const outputFullPath = (0, import_node_path11.resolve)(opts.cwd, spec.outputPath);
7037
7134
  let outputExists = false;
7038
7135
  let outputBytes = 0;
7039
7136
  try {
@@ -7115,7 +7212,7 @@ async function spawnMappersParallel(specs, opts) {
7115
7212
 
7116
7213
  // scripts/lib/explore-parallel-runner/synthesizer.ts
7117
7214
  var import_node_fs13 = require("node:fs");
7118
- var import_node_path11 = require("node:path");
7215
+ var import_node_path12 = require("node:path");
7119
7216
  var DEFAULT_POLL_MS = 200;
7120
7217
  var DEFAULT_TIMEOUT_MS = 6e5;
7121
7218
  function probeSize(path) {
@@ -7154,7 +7251,7 @@ async function waitForStableFiles(paths, pollIntervalMs, timeoutMs) {
7154
7251
  }
7155
7252
  function sleep3(ms) {
7156
7253
  if (ms <= 0) return Promise.resolve();
7157
- return new Promise((resolve11) => setTimeout(resolve11, ms));
7254
+ return new Promise((resolve12) => setTimeout(resolve12, ms));
7158
7255
  }
7159
7256
  function composePrompt(args) {
7160
7257
  const readySet = new Set(args.readyPaths);
@@ -7201,11 +7298,11 @@ ${readBlocks.join("\n\n---\n\n")}
7201
7298
  };
7202
7299
  }
7203
7300
  async function synthesizeStreaming(args) {
7204
- const outputPath = (0, import_node_path11.resolve)(args.cwd, ".design/DESIGN-PATTERNS.md");
7301
+ const outputPath = (0, import_node_path12.resolve)(args.cwd, ".design/DESIGN-PATTERNS.md");
7205
7302
  const pollIntervalMs = args.pollIntervalMs ?? DEFAULT_POLL_MS;
7206
7303
  const timeoutMs = args.timeoutMs ?? DEFAULT_TIMEOUT_MS;
7207
7304
  const absPaths = args.mapperOutputPaths.map(
7208
- (p) => (0, import_node_path11.resolve)(args.cwd, p)
7305
+ (p) => (0, import_node_path12.resolve)(args.cwd, p)
7209
7306
  );
7210
7307
  const readyPaths = await waitForStableFiles(
7211
7308
  absPaths,
@@ -7312,7 +7409,7 @@ function composeMapperSpecs(specs, cwd, addendumOpts, logger) {
7312
7409
  const detect = typeof opt.detectStack === "function" ? opt.detectStack : import_stack.detectStack;
7313
7410
  const stack = detect(root);
7314
7411
  let registry = opt.registry;
7315
- const refDir = typeof opt.refDir === "string" ? opt.refDir : (0, import_node_path12.resolve)(cwd, "reference");
7412
+ const refDir = typeof opt.refDir === "string" ? opt.refDir : (0, import_node_path13.resolve)(cwd, "reference");
7316
7413
  if (registry === void 0) {
7317
7414
  try {
7318
7415
  const { loadRegistry } = require_reference_registry();
@@ -7360,7 +7457,7 @@ async function run3(opts) {
7360
7457
  const concurrency = opts.concurrency ?? (0, import_concurrency_tuner.resolveConcurrency)();
7361
7458
  const logger = getLogger().child("explore.runner");
7362
7459
  const { specs } = composeMapperSpecs(baseSpecs, cwd, opts.addendums, logger);
7363
- const outputPath = (0, import_node_path12.resolve)(cwd, ".design/DESIGN-PATTERNS.md");
7460
+ const outputPath = (0, import_node_path13.resolve)(cwd, ".design/DESIGN-PATTERNS.md");
7364
7461
  let batching = void 0;
7365
7462
  if (opts.incremental && opts.incremental.graph !== void 0 && opts.incremental.graph !== null) {
7366
7463
  try {
@@ -7430,7 +7527,7 @@ async function run3(opts) {
7430
7527
  const safeSpecs = [];
7431
7528
  const serialSpecs = [];
7432
7529
  for (const spec of specs) {
7433
- const resolvedAgentPath = (0, import_node_path12.resolve)(cwd, spec.agentPath);
7530
+ const resolvedAgentPath = (0, import_node_path13.resolve)(cwd, spec.agentPath);
7434
7531
  if (isParallelismSafe(resolvedAgentPath)) {
7435
7532
  safeSpecs.push(spec);
7436
7533
  } else {
@@ -7550,7 +7647,7 @@ var import_concurrency_tuner2 = __toESM(require_concurrency_tuner());
7550
7647
 
7551
7648
  // scripts/lib/discuss-parallel-runner/aggregator.ts
7552
7649
  var import_node_fs14 = require("node:fs");
7553
- var import_node_path13 = require("node:path");
7650
+ var import_node_path14 = require("node:path");
7554
7651
  var DEFAULT_AGGREGATOR_INSTRUCTION = [
7555
7652
  "You are the discussion aggregator. Below are N discussant contributions, each",
7556
7653
  "listing questions + concerns from a different angle. Your job:",
@@ -7669,7 +7766,7 @@ function parseAggregatorOutput(finalText, outputPath) {
7669
7766
  const validated = validateAggregatorShape(parsed, finalText);
7670
7767
  const markdown = finalText.slice(0, lastMatch.index).trimEnd() + "\n";
7671
7768
  try {
7672
- (0, import_node_fs14.mkdirSync)((0, import_node_path13.dirname)(outputPath), { recursive: true });
7769
+ (0, import_node_fs14.mkdirSync)((0, import_node_path14.dirname)(outputPath), { recursive: true });
7673
7770
  (0, import_node_fs14.writeFileSync)(outputPath, markdown, "utf8");
7674
7771
  } catch (err) {
7675
7772
  getLogger().error("discuss.aggregator.write_failed", {
@@ -8350,14 +8447,14 @@ async function runDiscussParallel(flags, cwd, stdout, stderr, deps) {
8350
8447
  function loadSingleStagePrompt(stage, flags, cwd) {
8351
8448
  const file = flags["prompt-file"];
8352
8449
  if (typeof file === "string" && file.length > 0) {
8353
- const abs = (0, import_node_path14.resolve)(cwd, file);
8450
+ const abs = (0, import_node_path15.resolve)(cwd, file);
8354
8451
  try {
8355
8452
  return (0, import_node_fs15.readFileSync)(abs, "utf8");
8356
8453
  } catch (err) {
8357
8454
  throw new Error(`cannot read prompt file "${file}": ${errMessage2(err)}`);
8358
8455
  }
8359
8456
  }
8360
- const conv = (0, import_node_path14.resolve)(cwd, ".design/prompts", `${stage}.md`);
8457
+ const conv = (0, import_node_path15.resolve)(cwd, ".design/prompts", `${stage}.md`);
8361
8458
  try {
8362
8459
  return (0, import_node_fs15.readFileSync)(conv, "utf8");
8363
8460
  } catch {
@@ -8367,7 +8464,7 @@ function loadSingleStagePrompt(stage, flags, cwd) {
8367
8464
  function loadExploreSynthesizerPrompt(flags, cwd) {
8368
8465
  const file = flags["synthesizer-prompt-file"];
8369
8466
  if (typeof file === "string" && file.length > 0) {
8370
- const abs = (0, import_node_path14.resolve)(cwd, file);
8467
+ const abs = (0, import_node_path15.resolve)(cwd, file);
8371
8468
  try {
8372
8469
  return (0, import_node_fs15.readFileSync)(abs, "utf8");
8373
8470
  } catch (err) {
@@ -8381,7 +8478,7 @@ function loadExploreSynthesizerPrompt(flags, cwd) {
8381
8478
  function loadOptionalAggregatorPrompt(flags, cwd) {
8382
8479
  const file = flags["aggregator-prompt-file"];
8383
8480
  if (typeof file !== "string" || file.length === 0) return void 0;
8384
- const abs = (0, import_node_path14.resolve)(cwd, file);
8481
+ const abs = (0, import_node_path15.resolve)(cwd, file);
8385
8482
  try {
8386
8483
  return (0, import_node_fs15.readFileSync)(abs, "utf8");
8387
8484
  } catch {
@@ -8395,7 +8492,7 @@ function errMessage2(err) {
8395
8492
 
8396
8493
  // sdk/cli/commands/query.ts
8397
8494
  var import_node_fs16 = require("node:fs");
8398
- var import_node_path15 = require("node:path");
8495
+ var import_node_path16 = require("node:path");
8399
8496
  var QUERY_FLAGS = [
8400
8497
  ...COMMON_FLAGS,
8401
8498
  { name: "tail", type: "number", default: 20 },
@@ -8471,7 +8568,7 @@ Valid: get | stage | position | decisions | must-haves | blockers | status | eve
8471
8568
  return 3;
8472
8569
  }
8473
8570
  const cwd = typeof flags["cwd"] === "string" ? flags["cwd"] : process.cwd();
8474
- const statePath = typeof flags["state-path"] === "string" && flags["state-path"].length > 0 ? (0, import_node_path15.resolve)(cwd, flags["state-path"]) : (0, import_node_path15.resolve)(cwd, ".design", "STATE.md");
8571
+ const statePath = typeof flags["state-path"] === "string" && flags["state-path"].length > 0 ? (0, import_node_path16.resolve)(cwd, flags["state-path"]) : (0, import_node_path16.resolve)(cwd, ".design", "STATE.md");
8475
8572
  if (op === "events") {
8476
8573
  return handleEvents(flags, cwd, stdout, stderr);
8477
8574
  }
@@ -8564,7 +8661,7 @@ function handleCanTransition(args, state, stdout, stderr, flags) {
8564
8661
  return 0;
8565
8662
  }
8566
8663
  function handleEvents(flags, cwd, stdout, stderr) {
8567
- const eventsPath = typeof flags["events-path"] === "string" && flags["events-path"].length > 0 ? (0, import_node_path15.resolve)(cwd, flags["events-path"]) : (0, import_node_path15.resolve)(cwd, ".design", "events.jsonl");
8664
+ const eventsPath = typeof flags["events-path"] === "string" && flags["events-path"].length > 0 ? (0, import_node_path16.resolve)(cwd, flags["events-path"]) : (0, import_node_path16.resolve)(cwd, ".design", "events.jsonl");
8568
8665
  const tail2 = typeof flags["tail"] === "number" ? flags["tail"] : 20;
8569
8666
  if (!Number.isFinite(tail2) || tail2 < 0) {
8570
8667
  stderr.write(`gdd-sdk query events: --tail must be a non-negative integer
@@ -8619,7 +8716,7 @@ function errMessage3(err) {
8619
8716
 
8620
8717
  // sdk/cli/commands/audit.ts
8621
8718
  var import_node_fs17 = require("node:fs");
8622
- var import_node_path16 = require("node:path");
8719
+ var import_node_path17 = require("node:path");
8623
8720
  var AUDIT_FLAGS = [
8624
8721
  ...COMMON_FLAGS,
8625
8722
  { name: "baseline", type: "string" },
@@ -8657,7 +8754,7 @@ async function auditCommand(args, deps = {}) {
8657
8754
  return 3;
8658
8755
  }
8659
8756
  const cwd = typeof flags["cwd"] === "string" ? flags["cwd"] : process.cwd();
8660
- const statePath = typeof flags["state-path"] === "string" && flags["state-path"].length > 0 ? (0, import_node_path16.resolve)(cwd, flags["state-path"]) : (0, import_node_path16.resolve)(cwd, ".design", "STATE.md");
8757
+ const statePath = typeof flags["state-path"] === "string" && flags["state-path"].length > 0 ? (0, import_node_path17.resolve)(cwd, flags["state-path"]) : (0, import_node_path17.resolve)(cwd, ".design", "STATE.md");
8661
8758
  if (!(0, import_node_fs17.existsSync)(statePath)) {
8662
8759
  stderr.write(`gdd-sdk audit: STATE.md not found at ${statePath}
8663
8760
  `);
@@ -8697,7 +8794,7 @@ async function auditCommand(args, deps = {}) {
8697
8794
  const baselineFlag = flags["baseline"];
8698
8795
  if (typeof baselineFlag === "string" && baselineFlag.length > 0) {
8699
8796
  try {
8700
- baselineReport = computeBaselineDrift(state, (0, import_node_path16.resolve)(cwd, baselineFlag));
8797
+ baselineReport = computeBaselineDrift(state, (0, import_node_path17.resolve)(cwd, baselineFlag));
8701
8798
  } catch (err) {
8702
8799
  stderr.write(`gdd-sdk audit: baseline error: ${errMessage4(err)}
8703
8800
  `);
@@ -8725,7 +8822,7 @@ async function auditCommand(args, deps = {}) {
8725
8822
  return overallOk ? 0 : 1;
8726
8823
  }
8727
8824
  function computeBaselineDrift(current, baselineDir) {
8728
- const baselinePath = (0, import_node_path16.resolve)(baselineDir, "STATE.md");
8825
+ const baselinePath = (0, import_node_path17.resolve)(baselineDir, "STATE.md");
8729
8826
  if (!(0, import_node_fs17.existsSync)(baselinePath)) {
8730
8827
  throw new Error(`baseline STATE.md not found at ${baselinePath}`);
8731
8828
  }
@@ -8836,14 +8933,14 @@ function errMessage4(err) {
8836
8933
 
8837
8934
  // scripts/lib/init-runner/index.ts
8838
8935
  var import_node_fs21 = require("node:fs");
8839
- var import_node_path19 = require("node:path");
8936
+ var import_node_path20 = require("node:path");
8840
8937
 
8841
8938
  // scripts/lib/init-runner/researchers.ts
8842
8939
  var import_node_fs19 = require("node:fs");
8843
8940
 
8844
8941
  // scripts/lib/init-runner/scaffold.ts
8845
8942
  var import_node_fs18 = require("node:fs");
8846
- var import_node_path17 = require("node:path");
8943
+ var import_node_path18 = require("node:path");
8847
8944
  var PLUGIN_PACKAGE_NAME = "@hegemonart/get-design-done";
8848
8945
  var MAX_WALKUP_DEPTH = 8;
8849
8946
  function writeStateFromTemplate(args) {
@@ -8852,19 +8949,19 @@ function writeStateFromTemplate(args) {
8852
8949
  const raw = (0, import_node_fs18.readFileSync)(templatePath, "utf8");
8853
8950
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
8854
8951
  const body = raw.includes("{TODAY}") ? raw.split("{TODAY}").join(today) : raw;
8855
- (0, import_node_fs18.mkdirSync)((0, import_node_path17.dirname)(destPath), { recursive: true });
8952
+ (0, import_node_fs18.mkdirSync)((0, import_node_path18.dirname)(destPath), { recursive: true });
8856
8953
  (0, import_node_fs18.writeFileSync)(destPath, body, "utf8");
8857
8954
  return true;
8858
8955
  }
8859
8956
  function backupExistingDesignDir(cwd) {
8860
- const designDir = (0, import_node_path17.resolve)(cwd, ".design");
8957
+ const designDir = (0, import_node_path18.resolve)(cwd, ".design");
8861
8958
  if (!(0, import_node_fs18.existsSync)(designDir)) return null;
8862
8959
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
8863
- let backupDir = (0, import_node_path17.resolve)(cwd, `.design.backup.${stamp}`);
8960
+ let backupDir = (0, import_node_path18.resolve)(cwd, `.design.backup.${stamp}`);
8864
8961
  let suffix = 0;
8865
8962
  while ((0, import_node_fs18.existsSync)(backupDir)) {
8866
8963
  suffix += 1;
8867
- backupDir = (0, import_node_path17.resolve)(cwd, `.design.backup.${stamp}-${suffix}`);
8964
+ backupDir = (0, import_node_path18.resolve)(cwd, `.design.backup.${stamp}-${suffix}`);
8868
8965
  if (suffix > 1e3) {
8869
8966
  throw new Error(`backupExistingDesignDir: could not find a free backup directory after ${suffix} attempts`);
8870
8967
  }
@@ -8883,8 +8980,8 @@ function backupExistingDesignDir(cwd) {
8883
8980
  return backupDir;
8884
8981
  }
8885
8982
  function ensureDesignDirs(cwd) {
8886
- const designDir = (0, import_node_path17.resolve)(cwd, ".design");
8887
- const researchDir = (0, import_node_path17.join)(designDir, "research");
8983
+ const designDir = (0, import_node_path18.resolve)(cwd, ".design");
8984
+ const researchDir = (0, import_node_path18.join)(designDir, "research");
8888
8985
  (0, import_node_fs18.mkdirSync)(designDir, { recursive: true });
8889
8986
  (0, import_node_fs18.mkdirSync)(researchDir, { recursive: true });
8890
8987
  return Object.freeze({ design_dir: designDir, research_dir: researchDir });
@@ -8893,25 +8990,25 @@ function resolveStateTemplatePath() {
8893
8990
  const startCandidates = [];
8894
8991
  const argv1 = process.argv[1];
8895
8992
  if (argv1 !== void 0 && argv1.length > 0 && (0, import_node_fs18.existsSync)(argv1)) {
8896
- startCandidates.push((0, import_node_path17.dirname)((0, import_node_path17.resolve)(argv1)));
8993
+ startCandidates.push((0, import_node_path18.dirname)((0, import_node_path18.resolve)(argv1)));
8897
8994
  }
8898
8995
  startCandidates.push(process.cwd());
8899
8996
  for (const start of startCandidates) {
8900
8997
  let dir = start;
8901
8998
  for (let depth = 0; depth < MAX_WALKUP_DEPTH; depth += 1) {
8902
- const pkgPath = (0, import_node_path17.join)(dir, "package.json");
8999
+ const pkgPath = (0, import_node_path18.join)(dir, "package.json");
8903
9000
  if ((0, import_node_fs18.existsSync)(pkgPath)) {
8904
9001
  try {
8905
9002
  const raw = (0, import_node_fs18.readFileSync)(pkgPath, "utf8");
8906
9003
  const parsed = JSON.parse(raw);
8907
9004
  if (parsed.name === PLUGIN_PACKAGE_NAME) {
8908
- const tpl = (0, import_node_path17.join)(dir, "reference", "STATE-TEMPLATE.md");
9005
+ const tpl = (0, import_node_path18.join)(dir, "reference", "STATE-TEMPLATE.md");
8909
9006
  if ((0, import_node_fs18.existsSync)(tpl)) return tpl;
8910
9007
  }
8911
9008
  } catch {
8912
9009
  }
8913
9010
  }
8914
- const parent = (0, import_node_path17.dirname)(dir);
9011
+ const parent = (0, import_node_path18.dirname)(dir);
8915
9012
  if (parent === dir) break;
8916
9013
  dir = parent;
8917
9014
  }
@@ -9037,7 +9134,7 @@ async function spawnResearchersParallel(specs, opts) {
9037
9134
 
9038
9135
  // scripts/lib/init-runner/synthesizer.ts
9039
9136
  var import_node_fs20 = require("node:fs");
9040
- var import_node_path18 = require("node:path");
9137
+ var import_node_path19 = require("node:path");
9041
9138
  var DEFAULT_SYNTHESIZER_PROMPT = Object.freeze(
9042
9139
  `You are the init-synthesizer. Four researchers have produced these outputs:
9043
9140
 
@@ -9091,7 +9188,7 @@ ${blocks}`;
9091
9188
  return template.split("{{RESEARCH_BLOCKS}}").join(blocks);
9092
9189
  }
9093
9190
  async function spawnSynthesizer(args) {
9094
- const designContextPath = (0, import_node_path18.resolve)(
9191
+ const designContextPath = (0, import_node_path19.resolve)(
9095
9192
  args.cwd,
9096
9193
  ".design",
9097
9194
  "DESIGN-CONTEXT.md"
@@ -9187,8 +9284,8 @@ var DEFAULT_RESEARCHERS = Object.freeze([
9187
9284
  var DEFAULT_CONCURRENCY = 4;
9188
9285
  async function run5(opts) {
9189
9286
  const logger = getLogger();
9190
- const cwd = (0, import_node_path19.resolve)(opts.cwd ?? process.cwd());
9191
- const designDir = (0, import_node_path19.resolve)(cwd, ".design");
9287
+ const cwd = (0, import_node_path20.resolve)(opts.cwd ?? process.cwd());
9288
+ const designDir = (0, import_node_path20.resolve)(cwd, ".design");
9192
9289
  const researchers = opts.researchers ?? DEFAULT_RESEARCHERS;
9193
9290
  logger.info("init.runner.started", {
9194
9291
  cwd,
@@ -9196,7 +9293,7 @@ async function run5(opts) {
9196
9293
  researcher_count: researchers.length,
9197
9294
  force: opts.force === true
9198
9295
  });
9199
- const stateMdPath = (0, import_node_path19.resolve)(designDir, "STATE.md");
9296
+ const stateMdPath = (0, import_node_path20.resolve)(designDir, "STATE.md");
9200
9297
  let backupDir = null;
9201
9298
  if ((0, import_node_fs21.existsSync)(stateMdPath)) {
9202
9299
  if (opts.force !== true) {
@@ -9273,7 +9370,7 @@ async function run5(opts) {
9273
9370
  const synthesizerInputs = successful.map((o) => {
9274
9371
  const spec = specByName.get(o.name);
9275
9372
  if (spec === void 0) return null;
9276
- const absPath = (0, import_node_path19.resolve)(cwd, spec.outputPath);
9373
+ const absPath = (0, import_node_path20.resolve)(cwd, spec.outputPath);
9277
9374
  let content;
9278
9375
  try {
9279
9376
  content = (0, import_node_fs21.readFileSync)(absPath, "utf8");
@@ -9508,7 +9605,7 @@ function errMessage5(err) {
9508
9605
  // sdk/cli/commands/build.ts
9509
9606
  var import_node_child_process = require("node:child_process");
9510
9607
  var import_node_fs22 = require("node:fs");
9511
- var import_node_path20 = require("node:path");
9608
+ var import_node_path21 = require("node:path");
9512
9609
  var BUILD_FLAGS = [
9513
9610
  ...COMMON_FLAGS,
9514
9611
  { name: "harness", type: "string" },
@@ -9529,15 +9626,15 @@ Flags:
9529
9626
  Exit codes: 0 ok \xB7 1 drift (--check) \xB7 3 arg error
9530
9627
  `;
9531
9628
  function findOrchestrator() {
9532
- let dir = (0, import_node_path20.dirname)(process.argv[1] ?? process.cwd());
9629
+ let dir = (0, import_node_path21.dirname)(process.argv[1] ?? process.cwd());
9533
9630
  for (let i = 0; i < 8; i++) {
9534
- const candidate = (0, import_node_path20.join)(dir, "scripts", "build-skills.cjs");
9631
+ const candidate = (0, import_node_path21.join)(dir, "scripts", "build-skills.cjs");
9535
9632
  if ((0, import_node_fs22.existsSync)(candidate)) return candidate;
9536
- const parent = (0, import_node_path20.dirname)(dir);
9633
+ const parent = (0, import_node_path21.dirname)(dir);
9537
9634
  if (parent === dir) break;
9538
9635
  dir = parent;
9539
9636
  }
9540
- const cwdCandidate = (0, import_node_path20.join)(process.cwd(), "scripts", "build-skills.cjs");
9637
+ const cwdCandidate = (0, import_node_path21.join)(process.cwd(), "scripts", "build-skills.cjs");
9541
9638
  return (0, import_node_fs22.existsSync)(cwdCandidate) ? cwdCandidate : null;
9542
9639
  }
9543
9640
  async function buildCommand(parsed, ctx) {
@@ -9587,7 +9684,7 @@ var import_node_child_process2 = require("node:child_process");
9587
9684
  var import_node_module4 = require("node:module");
9588
9685
  var import_node_http = require("node:http");
9589
9686
  var import_node_fs23 = require("node:fs");
9590
- var import_node_path21 = require("node:path");
9687
+ var import_node_path22 = require("node:path");
9591
9688
  var DASHBOARD_FLAGS = [
9592
9689
  ...COMMON_FLAGS,
9593
9690
  { name: "web", type: "boolean", default: false },
@@ -9615,16 +9712,16 @@ Exit codes: 0 ok \xB7 3 arg error / TUI not found \xB7 (TUI exit code forwarded
9615
9712
  function anchorDirs() {
9616
9713
  const out = [];
9617
9714
  const entry = process.argv[1];
9618
- if (typeof entry === "string" && entry.length > 0) out.push((0, import_node_path21.dirname)(entry));
9715
+ if (typeof entry === "string" && entry.length > 0) out.push((0, import_node_path22.dirname)(entry));
9619
9716
  out.push(process.cwd());
9620
9717
  return out;
9621
9718
  }
9622
9719
  function climbToMarker(startDir) {
9623
- const req = (0, import_node_module4.createRequire)((0, import_node_path21.join)(startDir, "noop.js"));
9720
+ const req = (0, import_node_module4.createRequire)((0, import_node_path22.join)(startDir, "noop.js"));
9624
9721
  let dir = startDir;
9625
9722
  let firstWithPkg = null;
9626
9723
  for (let i = 0; i < 12; i++) {
9627
- const pkgPath = (0, import_node_path21.join)(dir, "package.json");
9724
+ const pkgPath = (0, import_node_path22.join)(dir, "package.json");
9628
9725
  if ((0, import_node_fs23.existsSync)(pkgPath)) {
9629
9726
  if (firstWithPkg === null) firstWithPkg = dir;
9630
9727
  try {
@@ -9633,7 +9730,7 @@ function climbToMarker(startDir) {
9633
9730
  } catch {
9634
9731
  }
9635
9732
  }
9636
- const parent = (0, import_node_path21.dirname)(dir);
9733
+ const parent = (0, import_node_path22.dirname)(dir);
9637
9734
  if (parent === dir) break;
9638
9735
  dir = parent;
9639
9736
  }
@@ -9656,8 +9753,8 @@ function findPackageRoot() {
9656
9753
  }
9657
9754
  function requireFromRoot(relPath) {
9658
9755
  const root = findPackageRoot();
9659
- const req = (0, import_node_module4.createRequire)((0, import_node_path21.join)(root, "noop.js"));
9660
- return req((0, import_node_path21.join)(root, relPath));
9756
+ const req = (0, import_node_module4.createRequire)((0, import_node_path22.join)(root, "noop.js"));
9757
+ return req((0, import_node_path22.join)(root, relPath));
9661
9758
  }
9662
9759
  function resolveRoot(deps, flags) {
9663
9760
  if (typeof deps.root === "string" && deps.root.length > 0) return deps.root;
@@ -9667,7 +9764,7 @@ function resolveRoot(deps, flags) {
9667
9764
  return findPackageRoot();
9668
9765
  }
9669
9766
  function loadGraphGraceful(root, stderr) {
9670
- const graphPath = (0, import_node_path21.join)(root, ".design", "context-graph.json");
9767
+ const graphPath = (0, import_node_path22.join)(root, ".design", "context-graph.json");
9671
9768
  try {
9672
9769
  const query = requireFromRoot("scripts/lib/design-context-query.cjs");
9673
9770
  if (typeof query.load === "function") return query.load(graphPath);
@@ -9708,7 +9805,7 @@ function defaultOpenBrowser(url) {
9708
9805
  }
9709
9806
  }
9710
9807
  function serveHtml(html) {
9711
- return new Promise((resolve11, reject) => {
9808
+ return new Promise((resolve12, reject) => {
9712
9809
  const server = (0, import_node_http.createServer)((_req, res) => {
9713
9810
  res.writeHead(200, {
9714
9811
  "content-type": "text/html; charset=utf-8",
@@ -9725,7 +9822,7 @@ function serveHtml(html) {
9725
9822
  return;
9726
9823
  }
9727
9824
  const port = addr.port;
9728
- resolve11({ server, port, url: `http://127.0.0.1:${port}/` });
9825
+ resolve12({ server, port, url: `http://127.0.0.1:${port}/` });
9729
9826
  });
9730
9827
  });
9731
9828
  }
@@ -9756,12 +9853,12 @@ ${DASHBOARD_USAGE}`);
9756
9853
  const root = resolveRoot(deps, flags);
9757
9854
  const html = buildDashboardHtml(root, stderr);
9758
9855
  if (once) {
9759
- const designDir = (0, import_node_path21.join)(root, ".design");
9856
+ const designDir = (0, import_node_path22.join)(root, ".design");
9760
9857
  try {
9761
9858
  (0, import_node_fs23.mkdirSync)(designDir, { recursive: true });
9762
9859
  } catch {
9763
9860
  }
9764
- const outFile = (0, import_node_path21.join)(designDir, "dashboard.html");
9861
+ const outFile = (0, import_node_path22.join)(designDir, "dashboard.html");
9765
9862
  try {
9766
9863
  (0, import_node_fs23.writeFileSync)(outFile, html, "utf8");
9767
9864
  } catch (err) {
@@ -9795,13 +9892,13 @@ ${DASHBOARD_USAGE}`);
9795
9892
  }
9796
9893
  stdout.write("Press Ctrl+C to stop the server.\n");
9797
9894
  }
9798
- await new Promise((resolve11) => {
9895
+ await new Promise((resolve12) => {
9799
9896
  const shutdown = () => {
9800
- served.server.close(() => resolve11());
9897
+ served.server.close(() => resolve12());
9801
9898
  };
9802
9899
  process.once("SIGINT", shutdown);
9803
9900
  process.once("SIGTERM", shutdown);
9804
- served.server.on("close", () => resolve11());
9901
+ served.server.on("close", () => resolve12());
9805
9902
  });
9806
9903
  return 0;
9807
9904
  }
@@ -9809,7 +9906,7 @@ function runTui(deps, _stdout, stderr) {
9809
9906
  let bin = deps.tuiBin;
9810
9907
  if (!bin) {
9811
9908
  const root = findPackageRoot();
9812
- const candidate = (0, import_node_path21.join)(root, "bin", "gdd-dashboard");
9909
+ const candidate = (0, import_node_path22.join)(root, "bin", "gdd-dashboard");
9813
9910
  bin = (0, import_node_fs23.existsSync)(candidate) ? candidate : void 0;
9814
9911
  }
9815
9912
  if (!bin || !(0, import_node_fs23.existsSync)(bin)) {