@hegemonart/get-design-done 1.56.0 → 1.57.1
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 +73 -0
- package/README.md +2 -0
- package/SKILL.md +1 -0
- package/dist/claude-code/.claude/skills/state/SKILL.md +106 -0
- package/hooks/budget-enforcer.ts +5 -4
- package/hooks/gdd-fact-force.js +92 -3
- package/hooks/gdd-protected-paths.js +25 -2
- package/hooks/gdd-read-injection-scanner.ts +9 -1
- package/hooks/gdd-risk-gate.js +17 -7
- package/package.json +1 -1
- package/reference/skill-graph.md +2 -1
- package/scripts/lib/design-search.cjs +20 -2
- package/scripts/lib/manifest/skills.json +8 -0
- package/scripts/lib/state/migrate-to-sqlite.cjs +680 -0
- package/scripts/lib/state/query-surface.cjs +403 -0
- package/scripts/lib/state/render-markdown.cjs +729 -0
- package/scripts/lib/state/state-backend.cjs +345 -0
- package/scripts/lib/state/state-store.cjs +766 -0
- package/sdk/cli/index.js +199 -96
- package/sdk/dashboard/data/_pkg-root.cjs +4 -4
- package/sdk/dashboard/data/risk-surface.cjs +54 -19
- package/sdk/dashboard/data/source.cjs +44 -5
- package/sdk/dashboard/tui/index.cjs +28 -2
- package/sdk/mcp/gdd-state/server.js +133 -30
- package/sdk/mcp/gdd-state/tools/get.ts +8 -0
- package/sdk/state/index.ts +277 -13
- package/sdk/state/lockfile.ts +48 -0
- package/sdk/state/schema.sql +218 -0
- 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
|
|
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((
|
|
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,109 @@ 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
|
+
if (!(0, import_node_fs5.existsSync)(sqliteSibling)) return false;
|
|
4018
|
+
try {
|
|
4019
|
+
if ((0, import_node_fs5.statSync)(sqliteSibling).isDirectory()) return false;
|
|
4020
|
+
} catch {
|
|
4021
|
+
return false;
|
|
4022
|
+
}
|
|
4023
|
+
return true;
|
|
4024
|
+
}
|
|
3968
4025
|
async function read(path) {
|
|
3969
4026
|
const raw = (0, import_node_fs5.readFileSync)(path, "utf8");
|
|
3970
4027
|
return parse(raw).state;
|
|
3971
4028
|
}
|
|
3972
4029
|
async function mutate(path, fn) {
|
|
4030
|
+
if (migrationActive(path)) {
|
|
4031
|
+
return _mutateSqliteActive(path, fn);
|
|
4032
|
+
}
|
|
4033
|
+
return _mutateMarkdown(path, fn);
|
|
4034
|
+
}
|
|
4035
|
+
async function _mutateMarkdown(path, fn) {
|
|
4036
|
+
const release = await acquire(path);
|
|
4037
|
+
const tmpPath = `${path}.tmp`;
|
|
4038
|
+
try {
|
|
4039
|
+
const raw = (0, import_node_fs5.readFileSync)(path, "utf8");
|
|
4040
|
+
const { state, raw_bodies, raw_frontmatter, block_gaps, line_ending } = parse(raw);
|
|
4041
|
+
const clone = structuredClone(state);
|
|
4042
|
+
const next = fn(clone);
|
|
4043
|
+
const out = serialize(next, {
|
|
4044
|
+
raw_frontmatter,
|
|
4045
|
+
raw_bodies,
|
|
4046
|
+
block_gaps,
|
|
4047
|
+
line_ending
|
|
4048
|
+
});
|
|
4049
|
+
(0, import_node_fs5.writeFileSync)(tmpPath, out, "utf8");
|
|
4050
|
+
try {
|
|
4051
|
+
(0, import_node_fs5.renameSync)(tmpPath, path);
|
|
4052
|
+
} catch (err) {
|
|
4053
|
+
const code = typeof err === "object" && err !== null && "code" in err ? err.code : void 0;
|
|
4054
|
+
if (code === "EPERM" || code === "EBUSY") {
|
|
4055
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
4056
|
+
(0, import_node_fs5.renameSync)(tmpPath, path);
|
|
4057
|
+
} else {
|
|
4058
|
+
throw err;
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
return next;
|
|
4062
|
+
} catch (err) {
|
|
4063
|
+
try {
|
|
4064
|
+
if ((0, import_node_fs5.existsSync)(tmpPath)) (0, import_node_fs5.unlinkSync)(tmpPath);
|
|
4065
|
+
} catch {
|
|
4066
|
+
}
|
|
4067
|
+
throw err;
|
|
4068
|
+
} finally {
|
|
4069
|
+
await release();
|
|
4070
|
+
}
|
|
4071
|
+
}
|
|
4072
|
+
async function _mutateSqliteActive(path, fn) {
|
|
4073
|
+
const sqlitePath = (0, import_node_path4.join)((0, import_node_path4.dirname)(path), "state.sqlite");
|
|
4074
|
+
const releaseSqliteLock = await acquireSqliteLock(sqlitePath);
|
|
3973
4075
|
const release = await acquire(path);
|
|
3974
4076
|
const tmpPath = `${path}.tmp`;
|
|
3975
4077
|
try {
|
|
@@ -4004,6 +4106,7 @@ async function mutate(path, fn) {
|
|
|
4004
4106
|
throw err;
|
|
4005
4107
|
} finally {
|
|
4006
4108
|
await release();
|
|
4109
|
+
await releaseSqliteLock();
|
|
4007
4110
|
}
|
|
4008
4111
|
}
|
|
4009
4112
|
async function transition(path, toStage) {
|
|
@@ -4098,7 +4201,7 @@ function resolveStageOrder(input = {}) {
|
|
|
4098
4201
|
}
|
|
4099
4202
|
|
|
4100
4203
|
// scripts/lib/context-engine/index.ts
|
|
4101
|
-
var
|
|
4204
|
+
var import_node_path5 = require("node:path");
|
|
4102
4205
|
var import_node_buffer3 = require("node:buffer");
|
|
4103
4206
|
|
|
4104
4207
|
// scripts/lib/context-engine/manifest.ts
|
|
@@ -4299,7 +4402,7 @@ function buildContextBundle(stage, opts = {}) {
|
|
|
4299
4402
|
const files = [];
|
|
4300
4403
|
let total_bytes = 0;
|
|
4301
4404
|
for (const entry of manifest) {
|
|
4302
|
-
const absPath = (0,
|
|
4405
|
+
const absPath = (0, import_node_path5.resolve)(cwd, entry);
|
|
4303
4406
|
const { present, raw, raw_bytes } = readFileRaw(absPath);
|
|
4304
4407
|
if (!present) {
|
|
4305
4408
|
if (strict) {
|
|
@@ -4442,7 +4545,7 @@ function isNativeTool(name) {
|
|
|
4442
4545
|
|
|
4443
4546
|
// scripts/lib/tool-scoping/parse-agent-tools.ts
|
|
4444
4547
|
var import_node_fs7 = require("node:fs");
|
|
4445
|
-
var
|
|
4548
|
+
var import_node_path6 = require("node:path");
|
|
4446
4549
|
function parseAgentTools(agentMdPath) {
|
|
4447
4550
|
let raw;
|
|
4448
4551
|
try {
|
|
@@ -4458,7 +4561,7 @@ function parseAgentTools(agentMdPath) {
|
|
|
4458
4561
|
return extractToolsField(frontmatter);
|
|
4459
4562
|
}
|
|
4460
4563
|
function parseAgentToolsByName(name, agentsRoot = "agents") {
|
|
4461
|
-
const path = (0,
|
|
4564
|
+
const path = (0, import_node_path6.resolve)(agentsRoot, `${name}.md`);
|
|
4462
4565
|
return parseAgentTools(path);
|
|
4463
4566
|
}
|
|
4464
4567
|
function extractFrontmatter(raw) {
|
|
@@ -4881,21 +4984,21 @@ function collapseBlankLines(text) {
|
|
|
4881
4984
|
// scripts/lib/session-runner/errors.ts
|
|
4882
4985
|
var import_node_module2 = require("node:module");
|
|
4883
4986
|
var import_node_fs8 = require("node:fs");
|
|
4884
|
-
var
|
|
4987
|
+
var import_node_path7 = require("node:path");
|
|
4885
4988
|
function findRepoRoot() {
|
|
4886
4989
|
let dir = process.cwd();
|
|
4887
4990
|
for (let i = 0; i < 8; i++) {
|
|
4888
|
-
if ((0, import_node_fs8.existsSync)((0,
|
|
4889
|
-
const parent = (0,
|
|
4991
|
+
if ((0, import_node_fs8.existsSync)((0, import_node_path7.join)(dir, "package.json"))) return dir;
|
|
4992
|
+
const parent = (0, import_node_path7.dirname)(dir);
|
|
4890
4993
|
if (parent === dir) break;
|
|
4891
4994
|
dir = parent;
|
|
4892
4995
|
}
|
|
4893
4996
|
return process.cwd();
|
|
4894
4997
|
}
|
|
4895
4998
|
var REPO_ROOT = findRepoRoot();
|
|
4896
|
-
var nodeRequire = (0, import_node_module2.createRequire)((0,
|
|
4999
|
+
var nodeRequire = (0, import_node_module2.createRequire)((0, import_node_path7.join)(REPO_ROOT, "package.json"));
|
|
4897
5000
|
var transportClassifier = nodeRequire(
|
|
4898
|
-
(0,
|
|
5001
|
+
(0, import_node_path7.resolve)(REPO_ROOT, "sdk/primitives/error-classifier.cjs")
|
|
4899
5002
|
);
|
|
4900
5003
|
function sdkType(err) {
|
|
4901
5004
|
if (err === null || err === void 0 || typeof err !== "object") return "";
|
|
@@ -5133,7 +5236,7 @@ function mapSdkError(err) {
|
|
|
5133
5236
|
|
|
5134
5237
|
// scripts/lib/session-runner/transcript.ts
|
|
5135
5238
|
var import_node_fs9 = require("node:fs");
|
|
5136
|
-
var
|
|
5239
|
+
var import_node_path8 = require("node:path");
|
|
5137
5240
|
var DEFAULT_SESSION_DIR = ".design/sessions";
|
|
5138
5241
|
var MAX_LINE_BYTES = 64 * 1024;
|
|
5139
5242
|
var TRUNCATION_PREVIEW_BYTES = 1024;
|
|
@@ -5149,7 +5252,7 @@ var TranscriptWriter = class {
|
|
|
5149
5252
|
/** Most recent write error. `null` while healthy. */
|
|
5150
5253
|
lastError = null;
|
|
5151
5254
|
constructor(rawPath) {
|
|
5152
|
-
this.path = (0,
|
|
5255
|
+
this.path = (0, import_node_path8.isAbsolute)(rawPath) ? rawPath : (0, import_node_path8.resolve)(process.cwd(), rawPath);
|
|
5153
5256
|
}
|
|
5154
5257
|
/**
|
|
5155
5258
|
* Append one chunk. Never throws; I/O failures are recorded on
|
|
@@ -5233,13 +5336,13 @@ var TranscriptWriter = class {
|
|
|
5233
5336
|
const safeStage = /^[a-z0-9][a-z0-9._-]*$/i.test(stage) ? stage : "custom";
|
|
5234
5337
|
const dir = baseDir ?? process.env["GDD_SESSION_DIR"] ?? DEFAULT_SESSION_DIR;
|
|
5235
5338
|
const filename = `${iso}-${safeStage}.jsonl`;
|
|
5236
|
-
const full = (0,
|
|
5237
|
-
return (0,
|
|
5339
|
+
const full = (0, import_node_path8.join)(dir, filename);
|
|
5340
|
+
return (0, import_node_path8.isAbsolute)(full) ? full : (0, import_node_path8.resolve)(process.cwd(), full);
|
|
5238
5341
|
}
|
|
5239
5342
|
/** Ensure the target directory exists. Memoized per-writer. */
|
|
5240
5343
|
ensureDirectory() {
|
|
5241
5344
|
if (this.directoryEnsured) return;
|
|
5242
|
-
(0, import_node_fs9.mkdirSync)((0,
|
|
5345
|
+
(0, import_node_fs9.mkdirSync)((0, import_node_path8.dirname)(this.path), { recursive: true });
|
|
5243
5346
|
this.directoryEnsured = true;
|
|
5244
5347
|
}
|
|
5245
5348
|
};
|
|
@@ -5247,30 +5350,30 @@ var TranscriptWriter = class {
|
|
|
5247
5350
|
// scripts/lib/session-runner/index.ts
|
|
5248
5351
|
var import_node_module3 = require("node:module");
|
|
5249
5352
|
var import_node_fs10 = require("node:fs");
|
|
5250
|
-
var
|
|
5353
|
+
var import_node_path9 = require("node:path");
|
|
5251
5354
|
function _findRepoRoot2() {
|
|
5252
5355
|
let dir = process.cwd();
|
|
5253
5356
|
for (let i = 0; i < 8; i++) {
|
|
5254
|
-
if ((0, import_node_fs10.existsSync)((0,
|
|
5255
|
-
const parent = (0,
|
|
5357
|
+
if ((0, import_node_fs10.existsSync)((0, import_node_path9.join)(dir, "package.json"))) return dir;
|
|
5358
|
+
const parent = (0, import_node_path9.dirname)(dir);
|
|
5256
5359
|
if (parent === dir) break;
|
|
5257
5360
|
dir = parent;
|
|
5258
5361
|
}
|
|
5259
5362
|
return process.cwd();
|
|
5260
5363
|
}
|
|
5261
5364
|
var _REPO_ROOT = _findRepoRoot2();
|
|
5262
|
-
var _nodeRequire = (0, import_node_module3.createRequire)((0,
|
|
5365
|
+
var _nodeRequire = (0, import_node_module3.createRequire)((0, import_node_path9.join)(_REPO_ROOT, "package.json"));
|
|
5263
5366
|
var jitteredBackoff = _nodeRequire(
|
|
5264
|
-
(0,
|
|
5367
|
+
(0, import_node_path9.resolve)(_REPO_ROOT, "sdk/primitives/jittered-backoff.cjs")
|
|
5265
5368
|
);
|
|
5266
5369
|
var rateGuard = _nodeRequire(
|
|
5267
|
-
(0,
|
|
5370
|
+
(0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/rate-guard.cjs")
|
|
5268
5371
|
);
|
|
5269
5372
|
var banditIntegration = _nodeRequire(
|
|
5270
|
-
(0,
|
|
5373
|
+
(0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/bandit-router/integration.cjs")
|
|
5271
5374
|
);
|
|
5272
5375
|
var adaptiveModeLib = _nodeRequire(
|
|
5273
|
-
(0,
|
|
5376
|
+
(0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/adaptive-mode.cjs")
|
|
5274
5377
|
);
|
|
5275
5378
|
var RATE_GUARD_PROVIDER = "anthropic";
|
|
5276
5379
|
var DEFAULT_MAX_RETRIES = 2;
|
|
@@ -5309,7 +5412,7 @@ function loadPeerRegistry() {
|
|
|
5309
5412
|
if (_peerRegistryCache !== void 0) return _peerRegistryCache;
|
|
5310
5413
|
try {
|
|
5311
5414
|
const mod = _nodeRequire(
|
|
5312
|
-
(0,
|
|
5415
|
+
(0, import_node_path9.resolve)(_REPO_ROOT, "scripts/lib/peer-cli/registry.cjs")
|
|
5313
5416
|
);
|
|
5314
5417
|
if (mod && typeof mod === "object" && typeof mod.dispatch === "function") {
|
|
5315
5418
|
_peerRegistryCache = mod;
|
|
@@ -5936,7 +6039,7 @@ async function loadSdkQuery() {
|
|
|
5936
6039
|
return sdk.query;
|
|
5937
6040
|
}
|
|
5938
6041
|
function sleep2(ms) {
|
|
5939
|
-
return new Promise((
|
|
6042
|
+
return new Promise((resolve12) => setTimeout(resolve12, Math.max(0, ms)));
|
|
5940
6043
|
}
|
|
5941
6044
|
function buildResult(args) {
|
|
5942
6045
|
const cost = usdCost(args.usage.input, args.usage.output, args.usage.model);
|
|
@@ -6632,7 +6735,7 @@ async function runCommand(args, deps = {}) {
|
|
|
6632
6735
|
const pipelineRun = deps.pipelineRun ?? run2;
|
|
6633
6736
|
let overrides = {};
|
|
6634
6737
|
if (flags["dry-run"] === true) {
|
|
6635
|
-
const fixtureDir = typeof flags["fixture"] === "string" && flags["fixture"].length > 0 ? (0,
|
|
6738
|
+
const fixtureDir = typeof flags["fixture"] === "string" && flags["fixture"].length > 0 ? (0, import_node_path10.resolve)(process.cwd(), flags["fixture"]) : cwd;
|
|
6636
6739
|
try {
|
|
6637
6740
|
overrides = buildDryRunOverrides(cwd, fixtureDir);
|
|
6638
6741
|
} catch (err) {
|
|
@@ -6687,7 +6790,7 @@ function loadPrompts(stages, flags, cwd) {
|
|
|
6687
6790
|
verify: DEFAULT_PROMPTS.verify
|
|
6688
6791
|
};
|
|
6689
6792
|
for (const stage of stages) {
|
|
6690
|
-
const p = (0,
|
|
6793
|
+
const p = (0, import_node_path10.resolve)(cwd, ".design/prompts", `${stage}.md`);
|
|
6691
6794
|
try {
|
|
6692
6795
|
prompts[stage] = (0, import_node_fs11.readFileSync)(p, "utf8");
|
|
6693
6796
|
} catch {
|
|
@@ -6714,7 +6817,7 @@ function loadPrompts(stages, flags, cwd) {
|
|
|
6714
6817
|
{ stageName }
|
|
6715
6818
|
);
|
|
6716
6819
|
}
|
|
6717
|
-
const absPath = (0,
|
|
6820
|
+
const absPath = (0, import_node_path10.resolve)(cwd, filePath);
|
|
6718
6821
|
try {
|
|
6719
6822
|
prompts[stageName] = (0, import_node_fs11.readFileSync)(absPath, "utf8");
|
|
6720
6823
|
} catch (err) {
|
|
@@ -6910,7 +7013,7 @@ function buildDryRunOverrides(cwd, fixtureDir) {
|
|
|
6910
7013
|
};
|
|
6911
7014
|
}
|
|
6912
7015
|
function loadCannedSession(fixtureDir, stage) {
|
|
6913
|
-
const cannedPath = (0,
|
|
7016
|
+
const cannedPath = (0, import_node_path10.resolve)(fixtureDir, "expected-outputs", `canned-${stage}.json`);
|
|
6914
7017
|
let raw;
|
|
6915
7018
|
try {
|
|
6916
7019
|
raw = (0, import_node_fs11.readFileSync)(cannedPath, "utf8");
|
|
@@ -6943,8 +7046,8 @@ function loadCannedSession(fixtureDir, stage) {
|
|
|
6943
7046
|
function writeDryRunArtifacts(cwd, stage) {
|
|
6944
7047
|
const artifacts = DRY_RUN_ARTIFACTS[stage];
|
|
6945
7048
|
for (const { path: relPath, body } of artifacts) {
|
|
6946
|
-
const abs = (0,
|
|
6947
|
-
const dir = (0,
|
|
7049
|
+
const abs = (0, import_node_path10.join)(cwd, relPath);
|
|
7050
|
+
const dir = (0, import_node_path10.dirname)(abs);
|
|
6948
7051
|
if (!(0, import_node_fs11.existsSync)(dir)) {
|
|
6949
7052
|
(0, import_node_fs11.mkdirSync)(dir, { recursive: true });
|
|
6950
7053
|
}
|
|
@@ -6954,10 +7057,10 @@ function writeDryRunArtifacts(cwd, stage) {
|
|
|
6954
7057
|
|
|
6955
7058
|
// sdk/cli/commands/stage.ts
|
|
6956
7059
|
var import_node_fs15 = require("node:fs");
|
|
6957
|
-
var
|
|
7060
|
+
var import_node_path15 = require("node:path");
|
|
6958
7061
|
|
|
6959
7062
|
// scripts/lib/explore-parallel-runner/index.ts
|
|
6960
|
-
var
|
|
7063
|
+
var import_node_path13 = require("node:path");
|
|
6961
7064
|
var import_concurrency_tuner = __toESM(require_concurrency_tuner());
|
|
6962
7065
|
var import_incremental_discover = __toESM(require_incremental_discover());
|
|
6963
7066
|
var import_stack = __toESM(require_stack());
|
|
@@ -6965,7 +7068,7 @@ var import_mapper_spawn = __toESM(require_mapper_spawn());
|
|
|
6965
7068
|
|
|
6966
7069
|
// scripts/lib/explore-parallel-runner/mappers.ts
|
|
6967
7070
|
var import_node_fs12 = require("node:fs");
|
|
6968
|
-
var
|
|
7071
|
+
var import_node_path11 = require("node:path");
|
|
6969
7072
|
function isParallelismSafe(agentPath) {
|
|
6970
7073
|
let raw;
|
|
6971
7074
|
try {
|
|
@@ -6990,7 +7093,7 @@ function isParallelismSafe(agentPath) {
|
|
|
6990
7093
|
async function spawnMapper(spec, opts) {
|
|
6991
7094
|
const start = Date.now();
|
|
6992
7095
|
const agentBaseName = spec.agentPath.replace(/\\/g, "/").split("/").pop()?.replace(/\.md$/i, "") ?? spec.name;
|
|
6993
|
-
const agentsRoot = (0,
|
|
7096
|
+
const agentsRoot = (0, import_node_path11.resolve)(
|
|
6994
7097
|
opts.cwd,
|
|
6995
7098
|
spec.agentPath.replace(/\\/g, "/").split("/").slice(0, -1).join("/") || "agents"
|
|
6996
7099
|
);
|
|
@@ -7033,7 +7136,7 @@ async function spawnMapper(spec, opts) {
|
|
|
7033
7136
|
error: Object.freeze({ code: "RUN_THREW", message })
|
|
7034
7137
|
});
|
|
7035
7138
|
}
|
|
7036
|
-
const outputFullPath = (0,
|
|
7139
|
+
const outputFullPath = (0, import_node_path11.resolve)(opts.cwd, spec.outputPath);
|
|
7037
7140
|
let outputExists = false;
|
|
7038
7141
|
let outputBytes = 0;
|
|
7039
7142
|
try {
|
|
@@ -7115,7 +7218,7 @@ async function spawnMappersParallel(specs, opts) {
|
|
|
7115
7218
|
|
|
7116
7219
|
// scripts/lib/explore-parallel-runner/synthesizer.ts
|
|
7117
7220
|
var import_node_fs13 = require("node:fs");
|
|
7118
|
-
var
|
|
7221
|
+
var import_node_path12 = require("node:path");
|
|
7119
7222
|
var DEFAULT_POLL_MS = 200;
|
|
7120
7223
|
var DEFAULT_TIMEOUT_MS = 6e5;
|
|
7121
7224
|
function probeSize(path) {
|
|
@@ -7154,7 +7257,7 @@ async function waitForStableFiles(paths, pollIntervalMs, timeoutMs) {
|
|
|
7154
7257
|
}
|
|
7155
7258
|
function sleep3(ms) {
|
|
7156
7259
|
if (ms <= 0) return Promise.resolve();
|
|
7157
|
-
return new Promise((
|
|
7260
|
+
return new Promise((resolve12) => setTimeout(resolve12, ms));
|
|
7158
7261
|
}
|
|
7159
7262
|
function composePrompt(args) {
|
|
7160
7263
|
const readySet = new Set(args.readyPaths);
|
|
@@ -7201,11 +7304,11 @@ ${readBlocks.join("\n\n---\n\n")}
|
|
|
7201
7304
|
};
|
|
7202
7305
|
}
|
|
7203
7306
|
async function synthesizeStreaming(args) {
|
|
7204
|
-
const outputPath = (0,
|
|
7307
|
+
const outputPath = (0, import_node_path12.resolve)(args.cwd, ".design/DESIGN-PATTERNS.md");
|
|
7205
7308
|
const pollIntervalMs = args.pollIntervalMs ?? DEFAULT_POLL_MS;
|
|
7206
7309
|
const timeoutMs = args.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
7207
7310
|
const absPaths = args.mapperOutputPaths.map(
|
|
7208
|
-
(p) => (0,
|
|
7311
|
+
(p) => (0, import_node_path12.resolve)(args.cwd, p)
|
|
7209
7312
|
);
|
|
7210
7313
|
const readyPaths = await waitForStableFiles(
|
|
7211
7314
|
absPaths,
|
|
@@ -7312,7 +7415,7 @@ function composeMapperSpecs(specs, cwd, addendumOpts, logger) {
|
|
|
7312
7415
|
const detect = typeof opt.detectStack === "function" ? opt.detectStack : import_stack.detectStack;
|
|
7313
7416
|
const stack = detect(root);
|
|
7314
7417
|
let registry = opt.registry;
|
|
7315
|
-
const refDir = typeof opt.refDir === "string" ? opt.refDir : (0,
|
|
7418
|
+
const refDir = typeof opt.refDir === "string" ? opt.refDir : (0, import_node_path13.resolve)(cwd, "reference");
|
|
7316
7419
|
if (registry === void 0) {
|
|
7317
7420
|
try {
|
|
7318
7421
|
const { loadRegistry } = require_reference_registry();
|
|
@@ -7360,7 +7463,7 @@ async function run3(opts) {
|
|
|
7360
7463
|
const concurrency = opts.concurrency ?? (0, import_concurrency_tuner.resolveConcurrency)();
|
|
7361
7464
|
const logger = getLogger().child("explore.runner");
|
|
7362
7465
|
const { specs } = composeMapperSpecs(baseSpecs, cwd, opts.addendums, logger);
|
|
7363
|
-
const outputPath = (0,
|
|
7466
|
+
const outputPath = (0, import_node_path13.resolve)(cwd, ".design/DESIGN-PATTERNS.md");
|
|
7364
7467
|
let batching = void 0;
|
|
7365
7468
|
if (opts.incremental && opts.incremental.graph !== void 0 && opts.incremental.graph !== null) {
|
|
7366
7469
|
try {
|
|
@@ -7430,7 +7533,7 @@ async function run3(opts) {
|
|
|
7430
7533
|
const safeSpecs = [];
|
|
7431
7534
|
const serialSpecs = [];
|
|
7432
7535
|
for (const spec of specs) {
|
|
7433
|
-
const resolvedAgentPath = (0,
|
|
7536
|
+
const resolvedAgentPath = (0, import_node_path13.resolve)(cwd, spec.agentPath);
|
|
7434
7537
|
if (isParallelismSafe(resolvedAgentPath)) {
|
|
7435
7538
|
safeSpecs.push(spec);
|
|
7436
7539
|
} else {
|
|
@@ -7550,7 +7653,7 @@ var import_concurrency_tuner2 = __toESM(require_concurrency_tuner());
|
|
|
7550
7653
|
|
|
7551
7654
|
// scripts/lib/discuss-parallel-runner/aggregator.ts
|
|
7552
7655
|
var import_node_fs14 = require("node:fs");
|
|
7553
|
-
var
|
|
7656
|
+
var import_node_path14 = require("node:path");
|
|
7554
7657
|
var DEFAULT_AGGREGATOR_INSTRUCTION = [
|
|
7555
7658
|
"You are the discussion aggregator. Below are N discussant contributions, each",
|
|
7556
7659
|
"listing questions + concerns from a different angle. Your job:",
|
|
@@ -7669,7 +7772,7 @@ function parseAggregatorOutput(finalText, outputPath) {
|
|
|
7669
7772
|
const validated = validateAggregatorShape(parsed, finalText);
|
|
7670
7773
|
const markdown = finalText.slice(0, lastMatch.index).trimEnd() + "\n";
|
|
7671
7774
|
try {
|
|
7672
|
-
(0, import_node_fs14.mkdirSync)((0,
|
|
7775
|
+
(0, import_node_fs14.mkdirSync)((0, import_node_path14.dirname)(outputPath), { recursive: true });
|
|
7673
7776
|
(0, import_node_fs14.writeFileSync)(outputPath, markdown, "utf8");
|
|
7674
7777
|
} catch (err) {
|
|
7675
7778
|
getLogger().error("discuss.aggregator.write_failed", {
|
|
@@ -8350,14 +8453,14 @@ async function runDiscussParallel(flags, cwd, stdout, stderr, deps) {
|
|
|
8350
8453
|
function loadSingleStagePrompt(stage, flags, cwd) {
|
|
8351
8454
|
const file = flags["prompt-file"];
|
|
8352
8455
|
if (typeof file === "string" && file.length > 0) {
|
|
8353
|
-
const abs = (0,
|
|
8456
|
+
const abs = (0, import_node_path15.resolve)(cwd, file);
|
|
8354
8457
|
try {
|
|
8355
8458
|
return (0, import_node_fs15.readFileSync)(abs, "utf8");
|
|
8356
8459
|
} catch (err) {
|
|
8357
8460
|
throw new Error(`cannot read prompt file "${file}": ${errMessage2(err)}`);
|
|
8358
8461
|
}
|
|
8359
8462
|
}
|
|
8360
|
-
const conv = (0,
|
|
8463
|
+
const conv = (0, import_node_path15.resolve)(cwd, ".design/prompts", `${stage}.md`);
|
|
8361
8464
|
try {
|
|
8362
8465
|
return (0, import_node_fs15.readFileSync)(conv, "utf8");
|
|
8363
8466
|
} catch {
|
|
@@ -8367,7 +8470,7 @@ function loadSingleStagePrompt(stage, flags, cwd) {
|
|
|
8367
8470
|
function loadExploreSynthesizerPrompt(flags, cwd) {
|
|
8368
8471
|
const file = flags["synthesizer-prompt-file"];
|
|
8369
8472
|
if (typeof file === "string" && file.length > 0) {
|
|
8370
|
-
const abs = (0,
|
|
8473
|
+
const abs = (0, import_node_path15.resolve)(cwd, file);
|
|
8371
8474
|
try {
|
|
8372
8475
|
return (0, import_node_fs15.readFileSync)(abs, "utf8");
|
|
8373
8476
|
} catch (err) {
|
|
@@ -8381,7 +8484,7 @@ function loadExploreSynthesizerPrompt(flags, cwd) {
|
|
|
8381
8484
|
function loadOptionalAggregatorPrompt(flags, cwd) {
|
|
8382
8485
|
const file = flags["aggregator-prompt-file"];
|
|
8383
8486
|
if (typeof file !== "string" || file.length === 0) return void 0;
|
|
8384
|
-
const abs = (0,
|
|
8487
|
+
const abs = (0, import_node_path15.resolve)(cwd, file);
|
|
8385
8488
|
try {
|
|
8386
8489
|
return (0, import_node_fs15.readFileSync)(abs, "utf8");
|
|
8387
8490
|
} catch {
|
|
@@ -8395,7 +8498,7 @@ function errMessage2(err) {
|
|
|
8395
8498
|
|
|
8396
8499
|
// sdk/cli/commands/query.ts
|
|
8397
8500
|
var import_node_fs16 = require("node:fs");
|
|
8398
|
-
var
|
|
8501
|
+
var import_node_path16 = require("node:path");
|
|
8399
8502
|
var QUERY_FLAGS = [
|
|
8400
8503
|
...COMMON_FLAGS,
|
|
8401
8504
|
{ name: "tail", type: "number", default: 20 },
|
|
@@ -8471,7 +8574,7 @@ Valid: get | stage | position | decisions | must-haves | blockers | status | eve
|
|
|
8471
8574
|
return 3;
|
|
8472
8575
|
}
|
|
8473
8576
|
const cwd = typeof flags["cwd"] === "string" ? flags["cwd"] : process.cwd();
|
|
8474
|
-
const statePath = typeof flags["state-path"] === "string" && flags["state-path"].length > 0 ? (0,
|
|
8577
|
+
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
8578
|
if (op === "events") {
|
|
8476
8579
|
return handleEvents(flags, cwd, stdout, stderr);
|
|
8477
8580
|
}
|
|
@@ -8564,7 +8667,7 @@ function handleCanTransition(args, state, stdout, stderr, flags) {
|
|
|
8564
8667
|
return 0;
|
|
8565
8668
|
}
|
|
8566
8669
|
function handleEvents(flags, cwd, stdout, stderr) {
|
|
8567
|
-
const eventsPath = typeof flags["events-path"] === "string" && flags["events-path"].length > 0 ? (0,
|
|
8670
|
+
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
8671
|
const tail2 = typeof flags["tail"] === "number" ? flags["tail"] : 20;
|
|
8569
8672
|
if (!Number.isFinite(tail2) || tail2 < 0) {
|
|
8570
8673
|
stderr.write(`gdd-sdk query events: --tail must be a non-negative integer
|
|
@@ -8619,7 +8722,7 @@ function errMessage3(err) {
|
|
|
8619
8722
|
|
|
8620
8723
|
// sdk/cli/commands/audit.ts
|
|
8621
8724
|
var import_node_fs17 = require("node:fs");
|
|
8622
|
-
var
|
|
8725
|
+
var import_node_path17 = require("node:path");
|
|
8623
8726
|
var AUDIT_FLAGS = [
|
|
8624
8727
|
...COMMON_FLAGS,
|
|
8625
8728
|
{ name: "baseline", type: "string" },
|
|
@@ -8657,7 +8760,7 @@ async function auditCommand(args, deps = {}) {
|
|
|
8657
8760
|
return 3;
|
|
8658
8761
|
}
|
|
8659
8762
|
const cwd = typeof flags["cwd"] === "string" ? flags["cwd"] : process.cwd();
|
|
8660
|
-
const statePath = typeof flags["state-path"] === "string" && flags["state-path"].length > 0 ? (0,
|
|
8763
|
+
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
8764
|
if (!(0, import_node_fs17.existsSync)(statePath)) {
|
|
8662
8765
|
stderr.write(`gdd-sdk audit: STATE.md not found at ${statePath}
|
|
8663
8766
|
`);
|
|
@@ -8697,7 +8800,7 @@ async function auditCommand(args, deps = {}) {
|
|
|
8697
8800
|
const baselineFlag = flags["baseline"];
|
|
8698
8801
|
if (typeof baselineFlag === "string" && baselineFlag.length > 0) {
|
|
8699
8802
|
try {
|
|
8700
|
-
baselineReport = computeBaselineDrift(state, (0,
|
|
8803
|
+
baselineReport = computeBaselineDrift(state, (0, import_node_path17.resolve)(cwd, baselineFlag));
|
|
8701
8804
|
} catch (err) {
|
|
8702
8805
|
stderr.write(`gdd-sdk audit: baseline error: ${errMessage4(err)}
|
|
8703
8806
|
`);
|
|
@@ -8725,7 +8828,7 @@ async function auditCommand(args, deps = {}) {
|
|
|
8725
8828
|
return overallOk ? 0 : 1;
|
|
8726
8829
|
}
|
|
8727
8830
|
function computeBaselineDrift(current, baselineDir) {
|
|
8728
|
-
const baselinePath = (0,
|
|
8831
|
+
const baselinePath = (0, import_node_path17.resolve)(baselineDir, "STATE.md");
|
|
8729
8832
|
if (!(0, import_node_fs17.existsSync)(baselinePath)) {
|
|
8730
8833
|
throw new Error(`baseline STATE.md not found at ${baselinePath}`);
|
|
8731
8834
|
}
|
|
@@ -8836,14 +8939,14 @@ function errMessage4(err) {
|
|
|
8836
8939
|
|
|
8837
8940
|
// scripts/lib/init-runner/index.ts
|
|
8838
8941
|
var import_node_fs21 = require("node:fs");
|
|
8839
|
-
var
|
|
8942
|
+
var import_node_path20 = require("node:path");
|
|
8840
8943
|
|
|
8841
8944
|
// scripts/lib/init-runner/researchers.ts
|
|
8842
8945
|
var import_node_fs19 = require("node:fs");
|
|
8843
8946
|
|
|
8844
8947
|
// scripts/lib/init-runner/scaffold.ts
|
|
8845
8948
|
var import_node_fs18 = require("node:fs");
|
|
8846
|
-
var
|
|
8949
|
+
var import_node_path18 = require("node:path");
|
|
8847
8950
|
var PLUGIN_PACKAGE_NAME = "@hegemonart/get-design-done";
|
|
8848
8951
|
var MAX_WALKUP_DEPTH = 8;
|
|
8849
8952
|
function writeStateFromTemplate(args) {
|
|
@@ -8852,19 +8955,19 @@ function writeStateFromTemplate(args) {
|
|
|
8852
8955
|
const raw = (0, import_node_fs18.readFileSync)(templatePath, "utf8");
|
|
8853
8956
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
8854
8957
|
const body = raw.includes("{TODAY}") ? raw.split("{TODAY}").join(today) : raw;
|
|
8855
|
-
(0, import_node_fs18.mkdirSync)((0,
|
|
8958
|
+
(0, import_node_fs18.mkdirSync)((0, import_node_path18.dirname)(destPath), { recursive: true });
|
|
8856
8959
|
(0, import_node_fs18.writeFileSync)(destPath, body, "utf8");
|
|
8857
8960
|
return true;
|
|
8858
8961
|
}
|
|
8859
8962
|
function backupExistingDesignDir(cwd) {
|
|
8860
|
-
const designDir = (0,
|
|
8963
|
+
const designDir = (0, import_node_path18.resolve)(cwd, ".design");
|
|
8861
8964
|
if (!(0, import_node_fs18.existsSync)(designDir)) return null;
|
|
8862
8965
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
8863
|
-
let backupDir = (0,
|
|
8966
|
+
let backupDir = (0, import_node_path18.resolve)(cwd, `.design.backup.${stamp}`);
|
|
8864
8967
|
let suffix = 0;
|
|
8865
8968
|
while ((0, import_node_fs18.existsSync)(backupDir)) {
|
|
8866
8969
|
suffix += 1;
|
|
8867
|
-
backupDir = (0,
|
|
8970
|
+
backupDir = (0, import_node_path18.resolve)(cwd, `.design.backup.${stamp}-${suffix}`);
|
|
8868
8971
|
if (suffix > 1e3) {
|
|
8869
8972
|
throw new Error(`backupExistingDesignDir: could not find a free backup directory after ${suffix} attempts`);
|
|
8870
8973
|
}
|
|
@@ -8883,8 +8986,8 @@ function backupExistingDesignDir(cwd) {
|
|
|
8883
8986
|
return backupDir;
|
|
8884
8987
|
}
|
|
8885
8988
|
function ensureDesignDirs(cwd) {
|
|
8886
|
-
const designDir = (0,
|
|
8887
|
-
const researchDir = (0,
|
|
8989
|
+
const designDir = (0, import_node_path18.resolve)(cwd, ".design");
|
|
8990
|
+
const researchDir = (0, import_node_path18.join)(designDir, "research");
|
|
8888
8991
|
(0, import_node_fs18.mkdirSync)(designDir, { recursive: true });
|
|
8889
8992
|
(0, import_node_fs18.mkdirSync)(researchDir, { recursive: true });
|
|
8890
8993
|
return Object.freeze({ design_dir: designDir, research_dir: researchDir });
|
|
@@ -8893,25 +8996,25 @@ function resolveStateTemplatePath() {
|
|
|
8893
8996
|
const startCandidates = [];
|
|
8894
8997
|
const argv1 = process.argv[1];
|
|
8895
8998
|
if (argv1 !== void 0 && argv1.length > 0 && (0, import_node_fs18.existsSync)(argv1)) {
|
|
8896
|
-
startCandidates.push((0,
|
|
8999
|
+
startCandidates.push((0, import_node_path18.dirname)((0, import_node_path18.resolve)(argv1)));
|
|
8897
9000
|
}
|
|
8898
9001
|
startCandidates.push(process.cwd());
|
|
8899
9002
|
for (const start of startCandidates) {
|
|
8900
9003
|
let dir = start;
|
|
8901
9004
|
for (let depth = 0; depth < MAX_WALKUP_DEPTH; depth += 1) {
|
|
8902
|
-
const pkgPath = (0,
|
|
9005
|
+
const pkgPath = (0, import_node_path18.join)(dir, "package.json");
|
|
8903
9006
|
if ((0, import_node_fs18.existsSync)(pkgPath)) {
|
|
8904
9007
|
try {
|
|
8905
9008
|
const raw = (0, import_node_fs18.readFileSync)(pkgPath, "utf8");
|
|
8906
9009
|
const parsed = JSON.parse(raw);
|
|
8907
9010
|
if (parsed.name === PLUGIN_PACKAGE_NAME) {
|
|
8908
|
-
const tpl = (0,
|
|
9011
|
+
const tpl = (0, import_node_path18.join)(dir, "reference", "STATE-TEMPLATE.md");
|
|
8909
9012
|
if ((0, import_node_fs18.existsSync)(tpl)) return tpl;
|
|
8910
9013
|
}
|
|
8911
9014
|
} catch {
|
|
8912
9015
|
}
|
|
8913
9016
|
}
|
|
8914
|
-
const parent = (0,
|
|
9017
|
+
const parent = (0, import_node_path18.dirname)(dir);
|
|
8915
9018
|
if (parent === dir) break;
|
|
8916
9019
|
dir = parent;
|
|
8917
9020
|
}
|
|
@@ -9037,7 +9140,7 @@ async function spawnResearchersParallel(specs, opts) {
|
|
|
9037
9140
|
|
|
9038
9141
|
// scripts/lib/init-runner/synthesizer.ts
|
|
9039
9142
|
var import_node_fs20 = require("node:fs");
|
|
9040
|
-
var
|
|
9143
|
+
var import_node_path19 = require("node:path");
|
|
9041
9144
|
var DEFAULT_SYNTHESIZER_PROMPT = Object.freeze(
|
|
9042
9145
|
`You are the init-synthesizer. Four researchers have produced these outputs:
|
|
9043
9146
|
|
|
@@ -9091,7 +9194,7 @@ ${blocks}`;
|
|
|
9091
9194
|
return template.split("{{RESEARCH_BLOCKS}}").join(blocks);
|
|
9092
9195
|
}
|
|
9093
9196
|
async function spawnSynthesizer(args) {
|
|
9094
|
-
const designContextPath = (0,
|
|
9197
|
+
const designContextPath = (0, import_node_path19.resolve)(
|
|
9095
9198
|
args.cwd,
|
|
9096
9199
|
".design",
|
|
9097
9200
|
"DESIGN-CONTEXT.md"
|
|
@@ -9187,8 +9290,8 @@ var DEFAULT_RESEARCHERS = Object.freeze([
|
|
|
9187
9290
|
var DEFAULT_CONCURRENCY = 4;
|
|
9188
9291
|
async function run5(opts) {
|
|
9189
9292
|
const logger = getLogger();
|
|
9190
|
-
const cwd = (0,
|
|
9191
|
-
const designDir = (0,
|
|
9293
|
+
const cwd = (0, import_node_path20.resolve)(opts.cwd ?? process.cwd());
|
|
9294
|
+
const designDir = (0, import_node_path20.resolve)(cwd, ".design");
|
|
9192
9295
|
const researchers = opts.researchers ?? DEFAULT_RESEARCHERS;
|
|
9193
9296
|
logger.info("init.runner.started", {
|
|
9194
9297
|
cwd,
|
|
@@ -9196,7 +9299,7 @@ async function run5(opts) {
|
|
|
9196
9299
|
researcher_count: researchers.length,
|
|
9197
9300
|
force: opts.force === true
|
|
9198
9301
|
});
|
|
9199
|
-
const stateMdPath = (0,
|
|
9302
|
+
const stateMdPath = (0, import_node_path20.resolve)(designDir, "STATE.md");
|
|
9200
9303
|
let backupDir = null;
|
|
9201
9304
|
if ((0, import_node_fs21.existsSync)(stateMdPath)) {
|
|
9202
9305
|
if (opts.force !== true) {
|
|
@@ -9273,7 +9376,7 @@ async function run5(opts) {
|
|
|
9273
9376
|
const synthesizerInputs = successful.map((o) => {
|
|
9274
9377
|
const spec = specByName.get(o.name);
|
|
9275
9378
|
if (spec === void 0) return null;
|
|
9276
|
-
const absPath = (0,
|
|
9379
|
+
const absPath = (0, import_node_path20.resolve)(cwd, spec.outputPath);
|
|
9277
9380
|
let content;
|
|
9278
9381
|
try {
|
|
9279
9382
|
content = (0, import_node_fs21.readFileSync)(absPath, "utf8");
|
|
@@ -9508,7 +9611,7 @@ function errMessage5(err) {
|
|
|
9508
9611
|
// sdk/cli/commands/build.ts
|
|
9509
9612
|
var import_node_child_process = require("node:child_process");
|
|
9510
9613
|
var import_node_fs22 = require("node:fs");
|
|
9511
|
-
var
|
|
9614
|
+
var import_node_path21 = require("node:path");
|
|
9512
9615
|
var BUILD_FLAGS = [
|
|
9513
9616
|
...COMMON_FLAGS,
|
|
9514
9617
|
{ name: "harness", type: "string" },
|
|
@@ -9529,15 +9632,15 @@ Flags:
|
|
|
9529
9632
|
Exit codes: 0 ok \xB7 1 drift (--check) \xB7 3 arg error
|
|
9530
9633
|
`;
|
|
9531
9634
|
function findOrchestrator() {
|
|
9532
|
-
let dir = (0,
|
|
9635
|
+
let dir = (0, import_node_path21.dirname)(process.argv[1] ?? process.cwd());
|
|
9533
9636
|
for (let i = 0; i < 8; i++) {
|
|
9534
|
-
const candidate = (0,
|
|
9637
|
+
const candidate = (0, import_node_path21.join)(dir, "scripts", "build-skills.cjs");
|
|
9535
9638
|
if ((0, import_node_fs22.existsSync)(candidate)) return candidate;
|
|
9536
|
-
const parent = (0,
|
|
9639
|
+
const parent = (0, import_node_path21.dirname)(dir);
|
|
9537
9640
|
if (parent === dir) break;
|
|
9538
9641
|
dir = parent;
|
|
9539
9642
|
}
|
|
9540
|
-
const cwdCandidate = (0,
|
|
9643
|
+
const cwdCandidate = (0, import_node_path21.join)(process.cwd(), "scripts", "build-skills.cjs");
|
|
9541
9644
|
return (0, import_node_fs22.existsSync)(cwdCandidate) ? cwdCandidate : null;
|
|
9542
9645
|
}
|
|
9543
9646
|
async function buildCommand(parsed, ctx) {
|
|
@@ -9587,7 +9690,7 @@ var import_node_child_process2 = require("node:child_process");
|
|
|
9587
9690
|
var import_node_module4 = require("node:module");
|
|
9588
9691
|
var import_node_http = require("node:http");
|
|
9589
9692
|
var import_node_fs23 = require("node:fs");
|
|
9590
|
-
var
|
|
9693
|
+
var import_node_path22 = require("node:path");
|
|
9591
9694
|
var DASHBOARD_FLAGS = [
|
|
9592
9695
|
...COMMON_FLAGS,
|
|
9593
9696
|
{ name: "web", type: "boolean", default: false },
|
|
@@ -9615,16 +9718,16 @@ Exit codes: 0 ok \xB7 3 arg error / TUI not found \xB7 (TUI exit code forwarded
|
|
|
9615
9718
|
function anchorDirs() {
|
|
9616
9719
|
const out = [];
|
|
9617
9720
|
const entry = process.argv[1];
|
|
9618
|
-
if (typeof entry === "string" && entry.length > 0) out.push((0,
|
|
9721
|
+
if (typeof entry === "string" && entry.length > 0) out.push((0, import_node_path22.dirname)(entry));
|
|
9619
9722
|
out.push(process.cwd());
|
|
9620
9723
|
return out;
|
|
9621
9724
|
}
|
|
9622
9725
|
function climbToMarker(startDir) {
|
|
9623
|
-
const req = (0, import_node_module4.createRequire)((0,
|
|
9726
|
+
const req = (0, import_node_module4.createRequire)((0, import_node_path22.join)(startDir, "noop.js"));
|
|
9624
9727
|
let dir = startDir;
|
|
9625
9728
|
let firstWithPkg = null;
|
|
9626
9729
|
for (let i = 0; i < 12; i++) {
|
|
9627
|
-
const pkgPath = (0,
|
|
9730
|
+
const pkgPath = (0, import_node_path22.join)(dir, "package.json");
|
|
9628
9731
|
if ((0, import_node_fs23.existsSync)(pkgPath)) {
|
|
9629
9732
|
if (firstWithPkg === null) firstWithPkg = dir;
|
|
9630
9733
|
try {
|
|
@@ -9633,7 +9736,7 @@ function climbToMarker(startDir) {
|
|
|
9633
9736
|
} catch {
|
|
9634
9737
|
}
|
|
9635
9738
|
}
|
|
9636
|
-
const parent = (0,
|
|
9739
|
+
const parent = (0, import_node_path22.dirname)(dir);
|
|
9637
9740
|
if (parent === dir) break;
|
|
9638
9741
|
dir = parent;
|
|
9639
9742
|
}
|
|
@@ -9656,8 +9759,8 @@ function findPackageRoot() {
|
|
|
9656
9759
|
}
|
|
9657
9760
|
function requireFromRoot(relPath) {
|
|
9658
9761
|
const root = findPackageRoot();
|
|
9659
|
-
const req = (0, import_node_module4.createRequire)((0,
|
|
9660
|
-
return req((0,
|
|
9762
|
+
const req = (0, import_node_module4.createRequire)((0, import_node_path22.join)(root, "noop.js"));
|
|
9763
|
+
return req((0, import_node_path22.join)(root, relPath));
|
|
9661
9764
|
}
|
|
9662
9765
|
function resolveRoot(deps, flags) {
|
|
9663
9766
|
if (typeof deps.root === "string" && deps.root.length > 0) return deps.root;
|
|
@@ -9667,7 +9770,7 @@ function resolveRoot(deps, flags) {
|
|
|
9667
9770
|
return findPackageRoot();
|
|
9668
9771
|
}
|
|
9669
9772
|
function loadGraphGraceful(root, stderr) {
|
|
9670
|
-
const graphPath = (0,
|
|
9773
|
+
const graphPath = (0, import_node_path22.join)(root, ".design", "context-graph.json");
|
|
9671
9774
|
try {
|
|
9672
9775
|
const query = requireFromRoot("scripts/lib/design-context-query.cjs");
|
|
9673
9776
|
if (typeof query.load === "function") return query.load(graphPath);
|
|
@@ -9708,7 +9811,7 @@ function defaultOpenBrowser(url) {
|
|
|
9708
9811
|
}
|
|
9709
9812
|
}
|
|
9710
9813
|
function serveHtml(html) {
|
|
9711
|
-
return new Promise((
|
|
9814
|
+
return new Promise((resolve12, reject) => {
|
|
9712
9815
|
const server = (0, import_node_http.createServer)((_req, res) => {
|
|
9713
9816
|
res.writeHead(200, {
|
|
9714
9817
|
"content-type": "text/html; charset=utf-8",
|
|
@@ -9725,7 +9828,7 @@ function serveHtml(html) {
|
|
|
9725
9828
|
return;
|
|
9726
9829
|
}
|
|
9727
9830
|
const port = addr.port;
|
|
9728
|
-
|
|
9831
|
+
resolve12({ server, port, url: `http://127.0.0.1:${port}/` });
|
|
9729
9832
|
});
|
|
9730
9833
|
});
|
|
9731
9834
|
}
|
|
@@ -9756,12 +9859,12 @@ ${DASHBOARD_USAGE}`);
|
|
|
9756
9859
|
const root = resolveRoot(deps, flags);
|
|
9757
9860
|
const html = buildDashboardHtml(root, stderr);
|
|
9758
9861
|
if (once) {
|
|
9759
|
-
const designDir = (0,
|
|
9862
|
+
const designDir = (0, import_node_path22.join)(root, ".design");
|
|
9760
9863
|
try {
|
|
9761
9864
|
(0, import_node_fs23.mkdirSync)(designDir, { recursive: true });
|
|
9762
9865
|
} catch {
|
|
9763
9866
|
}
|
|
9764
|
-
const outFile = (0,
|
|
9867
|
+
const outFile = (0, import_node_path22.join)(designDir, "dashboard.html");
|
|
9765
9868
|
try {
|
|
9766
9869
|
(0, import_node_fs23.writeFileSync)(outFile, html, "utf8");
|
|
9767
9870
|
} catch (err) {
|
|
@@ -9795,13 +9898,13 @@ ${DASHBOARD_USAGE}`);
|
|
|
9795
9898
|
}
|
|
9796
9899
|
stdout.write("Press Ctrl+C to stop the server.\n");
|
|
9797
9900
|
}
|
|
9798
|
-
await new Promise((
|
|
9901
|
+
await new Promise((resolve12) => {
|
|
9799
9902
|
const shutdown = () => {
|
|
9800
|
-
served.server.close(() =>
|
|
9903
|
+
served.server.close(() => resolve12());
|
|
9801
9904
|
};
|
|
9802
9905
|
process.once("SIGINT", shutdown);
|
|
9803
9906
|
process.once("SIGTERM", shutdown);
|
|
9804
|
-
served.server.on("close", () =>
|
|
9907
|
+
served.server.on("close", () => resolve12());
|
|
9805
9908
|
});
|
|
9806
9909
|
return 0;
|
|
9807
9910
|
}
|
|
@@ -9809,7 +9912,7 @@ function runTui(deps, _stdout, stderr) {
|
|
|
9809
9912
|
let bin = deps.tuiBin;
|
|
9810
9913
|
if (!bin) {
|
|
9811
9914
|
const root = findPackageRoot();
|
|
9812
|
-
const candidate = (0,
|
|
9915
|
+
const candidate = (0, import_node_path22.join)(root, "bin", "gdd-dashboard");
|
|
9813
9916
|
bin = (0, import_node_fs23.existsSync)(candidate) ? candidate : void 0;
|
|
9814
9917
|
}
|
|
9815
9918
|
if (!bin || !(0, import_node_fs23.existsSync)(bin)) {
|