@wairon/cli 5.1.1-dev.59 → 5.1.1-dev.60
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/dist/cli/index.js +595 -596
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +265 -114
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2497,7 +2497,7 @@ var require_dist = __commonJS({
|
|
|
2497
2497
|
scaffoldPack: () => scaffoldPack2
|
|
2498
2498
|
});
|
|
2499
2499
|
module2.exports = __toCommonJS2(src_exports2);
|
|
2500
|
-
var
|
|
2500
|
+
var path29 = __toESM2(require("path"));
|
|
2501
2501
|
var import_js_yaml3 = require("js-yaml");
|
|
2502
2502
|
var import_js_yaml = require("js-yaml");
|
|
2503
2503
|
var import_crypto = require("crypto");
|
|
@@ -3060,8 +3060,8 @@ var require_dist = __commonJS({
|
|
|
3060
3060
|
function slug(name) {
|
|
3061
3061
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
3062
3062
|
}
|
|
3063
|
-
var
|
|
3064
|
-
var
|
|
3063
|
+
var fs19 = __toESM2(require("fs"));
|
|
3064
|
+
var path30 = __toESM2(require("path"));
|
|
3065
3065
|
var import_fflate = require_node();
|
|
3066
3066
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", ".hg", ".svn"]);
|
|
3067
3067
|
function listEntries(archive) {
|
|
@@ -3099,9 +3099,9 @@ var require_dist = __commonJS({
|
|
|
3099
3099
|
}
|
|
3100
3100
|
function writeTree(destDir, files) {
|
|
3101
3101
|
for (const file of files) {
|
|
3102
|
-
const absolute =
|
|
3103
|
-
|
|
3104
|
-
|
|
3102
|
+
const absolute = path30.join(destDir, file.path);
|
|
3103
|
+
fs19.mkdirSync(path30.dirname(absolute), { recursive: true });
|
|
3104
|
+
fs19.writeFileSync(absolute, file.contents);
|
|
3105
3105
|
}
|
|
3106
3106
|
}
|
|
3107
3107
|
function classifyKind(name, symlinks) {
|
|
@@ -3110,14 +3110,14 @@ var require_dist = __commonJS({
|
|
|
3110
3110
|
return "file";
|
|
3111
3111
|
}
|
|
3112
3112
|
function walkPackDir(root, current2, out) {
|
|
3113
|
-
for (const entry of
|
|
3113
|
+
for (const entry of fs19.readdirSync(current2, { withFileTypes: true })) {
|
|
3114
3114
|
if (entry.isDirectory()) {
|
|
3115
3115
|
if (SKIP_DIRS.has(entry.name)) continue;
|
|
3116
|
-
walkPackDir(root,
|
|
3116
|
+
walkPackDir(root, path30.join(current2, entry.name), out);
|
|
3117
3117
|
} else if (entry.isFile()) {
|
|
3118
|
-
const absolute =
|
|
3119
|
-
const relative22 =
|
|
3120
|
-
out.push({ path: relative22, contents:
|
|
3118
|
+
const absolute = path30.join(current2, entry.name);
|
|
3119
|
+
const relative22 = path30.relative(root, absolute).split(path30.sep).join("/");
|
|
3120
|
+
out.push({ path: relative22, contents: fs19.readFileSync(absolute) });
|
|
3121
3121
|
}
|
|
3122
3122
|
}
|
|
3123
3123
|
}
|
|
@@ -3167,7 +3167,7 @@ var require_dist = __commonJS({
|
|
|
3167
3167
|
function scaffoldPack(request) {
|
|
3168
3168
|
const files = render(request);
|
|
3169
3169
|
writeTree(request.targetDir, files);
|
|
3170
|
-
return files.map((file) =>
|
|
3170
|
+
return files.map((file) => path29.join(request.targetDir, file.path));
|
|
3171
3171
|
}
|
|
3172
3172
|
function buildPack(sourceDir) {
|
|
3173
3173
|
const files = readPackDir(sourceDir);
|
|
@@ -3224,7 +3224,7 @@ var require_dist = __commonJS({
|
|
|
3224
3224
|
}
|
|
3225
3225
|
const manifest = parseManifest(decode(envelope.contents));
|
|
3226
3226
|
verifyIntegrity2(manifest, files);
|
|
3227
|
-
const directory =
|
|
3227
|
+
const directory = path29.resolve(destDir);
|
|
3228
3228
|
writeTree(directory, files);
|
|
3229
3229
|
const result = {
|
|
3230
3230
|
directory,
|
|
@@ -3302,7 +3302,7 @@ var require_dist = __commonJS({
|
|
|
3302
3302
|
}
|
|
3303
3303
|
const manifest = parseTreeManifest(decode(envelope.contents));
|
|
3304
3304
|
verifyTreeIntegrity(manifest, files);
|
|
3305
|
-
const directory =
|
|
3305
|
+
const directory = path29.resolve(destDir);
|
|
3306
3306
|
writeTree(directory, files);
|
|
3307
3307
|
const result = {
|
|
3308
3308
|
destDir: directory,
|
|
@@ -3317,7 +3317,7 @@ var require_dist = __commonJS({
|
|
|
3317
3317
|
return normalized === "." ? ".wai/" : `${normalized}/.wai/`;
|
|
3318
3318
|
}
|
|
3319
3319
|
function normalizeRootPath(relativePath) {
|
|
3320
|
-
const posix2 = relativePath.split(
|
|
3320
|
+
const posix2 = relativePath.split(path29.sep).join("/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
3321
3321
|
return posix2 === "" || posix2 === "." ? "." : posix2;
|
|
3322
3322
|
}
|
|
3323
3323
|
function slugify(projectName) {
|
|
@@ -3628,6 +3628,7 @@ __export(src_exports, {
|
|
|
3628
3628
|
getSubprojectPrefix: () => getSubprojectPrefix,
|
|
3629
3629
|
getSubsystemPath: () => getSubsystemPath,
|
|
3630
3630
|
getTypePath: () => getTypePath,
|
|
3631
|
+
globalGuideFilePath: () => globalGuideFilePath,
|
|
3631
3632
|
globalPacksDir: () => globalPacksDir,
|
|
3632
3633
|
globalPacksEnabled: () => globalPacksEnabled,
|
|
3633
3634
|
globalTemplatesDir: () => globalTemplatesDir,
|
|
@@ -3644,6 +3645,7 @@ __export(src_exports, {
|
|
|
3644
3645
|
importSpecTree: () => importSpecTree,
|
|
3645
3646
|
importSurface: () => importSurface,
|
|
3646
3647
|
ineffectiveDeltaPaths: () => ineffectiveDeltaPaths,
|
|
3648
|
+
injectGuide: () => injectGuide,
|
|
3647
3649
|
inspectChainedRoots: () => inspectChainedRoots,
|
|
3648
3650
|
inspectTreeArchive: () => inspectTreeArchive2,
|
|
3649
3651
|
installPackFromDirectory: () => installPackFromDirectory,
|
|
@@ -3697,6 +3699,7 @@ __export(src_exports, {
|
|
|
3697
3699
|
loadTypeSpec: () => loadTypeSpec,
|
|
3698
3700
|
loadTypeSpecs: () => loadTypeSpecs,
|
|
3699
3701
|
localApprover: () => localApprover,
|
|
3702
|
+
localGuideFilePath: () => localGuideFilePath,
|
|
3700
3703
|
localTypesOf: () => localTypesOf,
|
|
3701
3704
|
logger: () => logger,
|
|
3702
3705
|
makeScopeFilter: () => makeScopeFilter,
|
|
@@ -3739,12 +3742,14 @@ __export(src_exports, {
|
|
|
3739
3742
|
readProjectContext: () => readProjectContext,
|
|
3740
3743
|
readResource: () => readResource,
|
|
3741
3744
|
readSkillResource: () => readSkillResource,
|
|
3745
|
+
readStampVersion: () => readStampVersion,
|
|
3742
3746
|
readYamlFile: () => readYamlFile,
|
|
3743
3747
|
rebaseProjectVariants: () => rebaseProjectVariants,
|
|
3744
3748
|
rebaseReference: () => rebaseReference,
|
|
3745
3749
|
recordProfileSelection: () => recordProfileSelection,
|
|
3746
3750
|
registerExporter: () => registerExporter,
|
|
3747
3751
|
registerPackRef: () => registerPackRef,
|
|
3752
|
+
reinjectLocalGuides: () => reinjectLocalGuides,
|
|
3748
3753
|
removeDomain: () => removeDomain,
|
|
3749
3754
|
removePackSelection: () => removePackSelection,
|
|
3750
3755
|
removeSnapshot: () => removeSnapshot,
|
|
@@ -3822,6 +3827,7 @@ __export(src_exports, {
|
|
|
3822
3827
|
writeJsonFile: () => writeJsonFile,
|
|
3823
3828
|
writeLockRecord: () => writeLockRecord,
|
|
3824
3829
|
writeProjectContext: () => writeProjectContext,
|
|
3830
|
+
writeRootGuideDelegator: () => writeRootGuideDelegator,
|
|
3825
3831
|
writeYamlFile: () => writeYamlFile
|
|
3826
3832
|
});
|
|
3827
3833
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -6400,10 +6406,10 @@ function stepGraph(method) {
|
|
|
6400
6406
|
const s = byNum.get(n);
|
|
6401
6407
|
if (s.type !== "parallel" || s.endStep === void 0 || !s.branches?.length) continue;
|
|
6402
6408
|
const entries = s.branches.map((b) => b.step).sort((a, b) => a - b);
|
|
6403
|
-
const
|
|
6409
|
+
const join18 = fallNext(s.endStep);
|
|
6404
6410
|
for (let i = 0; i < entries.length; i++) {
|
|
6405
6411
|
const armEnd = i + 1 < entries.length ? prevOf(entries[i + 1]) : s.endStep;
|
|
6406
|
-
if (armEnd !== void 0 && armEnd >= entries[i]) armEndJoin.set(armEnd,
|
|
6412
|
+
if (armEnd !== void 0 && armEnd >= entries[i]) armEndJoin.set(armEnd, join18);
|
|
6407
6413
|
}
|
|
6408
6414
|
}
|
|
6409
6415
|
const successorsOf = (n) => {
|
|
@@ -11656,7 +11662,7 @@ function defaultTargetConfig(type) {
|
|
|
11656
11662
|
enabled: true
|
|
11657
11663
|
};
|
|
11658
11664
|
}
|
|
11659
|
-
var WAIRON_VERSION = "5.1.1-dev.
|
|
11665
|
+
var WAIRON_VERSION = "5.1.1-dev.60";
|
|
11660
11666
|
var GITHUB_REPO = "SYW-Apps/Waffle-AIron";
|
|
11661
11667
|
var ARCHITECT_AGENT_ID = "agent-architect";
|
|
11662
11668
|
var ARCHITECT_TEMPLATE_ID = "architect";
|
|
@@ -12363,21 +12369,21 @@ function buildCodeIndex(model) {
|
|
|
12363
12369
|
const declarations = /* @__PURE__ */ new Map();
|
|
12364
12370
|
const anchors = /* @__PURE__ */ new Map();
|
|
12365
12371
|
const findingAnchors = /* @__PURE__ */ new Map();
|
|
12366
|
-
const namesAt = (cache,
|
|
12367
|
-
const cached = cache.get(
|
|
12372
|
+
const namesAt = (cache, path29, make) => {
|
|
12373
|
+
const cached = cache.get(path29);
|
|
12368
12374
|
if (cached) return cached;
|
|
12369
|
-
const f = facts.get(
|
|
12375
|
+
const f = facts.get(path29);
|
|
12370
12376
|
if (!f) return NO_NAMES;
|
|
12371
12377
|
const built = make(f);
|
|
12372
|
-
cache.set(
|
|
12378
|
+
cache.set(path29, built);
|
|
12373
12379
|
return built;
|
|
12374
12380
|
};
|
|
12375
12381
|
const republished = /* @__PURE__ */ new Map();
|
|
12376
|
-
const republishedFrom = (
|
|
12377
|
-
const cached = republished.get(
|
|
12382
|
+
const republishedFrom = (path29) => {
|
|
12383
|
+
const cached = republished.get(path29);
|
|
12378
12384
|
if (cached) return cached;
|
|
12379
|
-
const out = /* @__PURE__ */ new Set([
|
|
12380
|
-
const queue = [
|
|
12385
|
+
const out = /* @__PURE__ */ new Set([path29]);
|
|
12386
|
+
const queue = [path29];
|
|
12381
12387
|
while (queue.length) {
|
|
12382
12388
|
const from = queue.pop();
|
|
12383
12389
|
const f = facts.get(from);
|
|
@@ -12390,7 +12396,7 @@ function buildCodeIndex(model) {
|
|
|
12390
12396
|
}
|
|
12391
12397
|
}
|
|
12392
12398
|
}
|
|
12393
|
-
republished.set(
|
|
12399
|
+
republished.set(path29, out);
|
|
12394
12400
|
return out;
|
|
12395
12401
|
};
|
|
12396
12402
|
const NO_ORIGIN = /* @__PURE__ */ new Set();
|
|
@@ -12399,9 +12405,9 @@ function buildCodeIndex(model) {
|
|
|
12399
12405
|
return to ? republishedFrom(to) : NO_ORIGIN;
|
|
12400
12406
|
};
|
|
12401
12407
|
const scopeOf = (site, from) => {
|
|
12402
|
-
const
|
|
12403
|
-
const f = facts.get(
|
|
12404
|
-
return f?.status === "analyzed" && f.analysisGrade === "exact" ? { path:
|
|
12408
|
+
const path29 = pathKey(site.from ?? from);
|
|
12409
|
+
const f = facts.get(path29);
|
|
12410
|
+
return f?.status === "analyzed" && f.analysisGrade === "exact" ? { path: path29, facts: f } : void 0;
|
|
12405
12411
|
};
|
|
12406
12412
|
const originOf = (site, from) => {
|
|
12407
12413
|
const resolved = scopeOf(site, from);
|
|
@@ -12440,14 +12446,14 @@ function buildCodeIndex(model) {
|
|
|
12440
12446
|
if (site.via) for (const typeName of localTypesOf(f, site.via)) widenThroughType(typeName);
|
|
12441
12447
|
return out;
|
|
12442
12448
|
};
|
|
12443
|
-
const declarationsAt = (
|
|
12449
|
+
const declarationsAt = (path29) => namesAt(declarations, pathKey(path29), (f) => /* @__PURE__ */ new Set([...f.declaredNames, ...f.exportedNames]));
|
|
12444
12450
|
return {
|
|
12445
12451
|
paths,
|
|
12446
12452
|
exactPaths,
|
|
12447
|
-
factsAt: (
|
|
12453
|
+
factsAt: (path29) => facts.get(pathKey(path29)),
|
|
12448
12454
|
declarationsAt,
|
|
12449
|
-
anchorsAt: (
|
|
12450
|
-
findingAnchorsAt: (
|
|
12455
|
+
anchorsAt: (path29) => namesAt(anchors, pathKey(path29), (f) => /* @__PURE__ */ new Set([...f.declaredNames, ...f.exportedNames, ...f.anchoredNames])),
|
|
12456
|
+
findingAnchorsAt: (path29) => namesAt(findingAnchors, pathKey(path29), (f) => new Set(f.anchoredNames)),
|
|
12451
12457
|
originOf,
|
|
12452
12458
|
possibleOriginsOf
|
|
12453
12459
|
};
|
|
@@ -12485,10 +12491,10 @@ function buildRealizationIndex(ctx) {
|
|
|
12485
12491
|
return {
|
|
12486
12492
|
paths,
|
|
12487
12493
|
implementationsOf: (compId) => implsByComponent.get(compId) ?? NONE_IMPL,
|
|
12488
|
-
implementationsAt: (
|
|
12494
|
+
implementationsAt: (path29) => implsByPath.get(pathKey(path29)) ?? NONE_IMPL,
|
|
12489
12495
|
filesOf: (compId) => filesByComponent.get(compId) ?? NONE_PATH,
|
|
12490
12496
|
filesIn: (subsystemId) => filesBySubsystem.get(subsystemId) ?? NONE_PATH,
|
|
12491
|
-
componentsAt: (
|
|
12497
|
+
componentsAt: (path29) => componentsByPath.get(pathKey(path29)) ?? NONE_COMP
|
|
12492
12498
|
};
|
|
12493
12499
|
}
|
|
12494
12500
|
function buildImportGraph(index, universe) {
|
|
@@ -12500,22 +12506,22 @@ function buildImportGraph(index, universe) {
|
|
|
12500
12506
|
if (to && to !== from) into.add(to);
|
|
12501
12507
|
}
|
|
12502
12508
|
};
|
|
12503
|
-
const importsOf = (
|
|
12504
|
-
const cached = imports.get(
|
|
12509
|
+
const importsOf = (path29) => {
|
|
12510
|
+
const cached = imports.get(path29);
|
|
12505
12511
|
if (cached) return cached;
|
|
12506
|
-
const facts = index.factsAt(
|
|
12512
|
+
const facts = index.factsAt(path29);
|
|
12507
12513
|
const out = /* @__PURE__ */ new Set();
|
|
12508
|
-
if (facts?.status === "analyzed") resolveAll(
|
|
12509
|
-
imports.set(
|
|
12514
|
+
if (facts?.status === "analyzed") resolveAll(path29, facts.imports, out);
|
|
12515
|
+
imports.set(path29, out);
|
|
12510
12516
|
return out;
|
|
12511
12517
|
};
|
|
12512
|
-
const tracesOf = (
|
|
12513
|
-
const cached = traces.get(
|
|
12518
|
+
const tracesOf = (path29) => {
|
|
12519
|
+
const cached = traces.get(path29);
|
|
12514
12520
|
if (cached) return cached;
|
|
12515
|
-
const facts = index.factsAt(
|
|
12516
|
-
const out = new Set(importsOf(
|
|
12517
|
-
if (facts?.status === "analyzed") resolveAll(
|
|
12518
|
-
traces.set(
|
|
12521
|
+
const facts = index.factsAt(path29);
|
|
12522
|
+
const out = new Set(importsOf(path29));
|
|
12523
|
+
if (facts?.status === "analyzed") resolveAll(path29, facts.reexports, out);
|
|
12524
|
+
traces.set(path29, out);
|
|
12519
12525
|
return out;
|
|
12520
12526
|
};
|
|
12521
12527
|
return {
|
|
@@ -13826,11 +13832,11 @@ var unconditionalCallCyclesRule = {
|
|
|
13826
13832
|
const memberEdges = keys.flatMap((k) => (adjacency.get(k) ?? []).filter((e) => inScc.has(e.toKey)));
|
|
13827
13833
|
if (memberEdges.length === 0) continue;
|
|
13828
13834
|
const anchor = [...memberEdges].sort((a, b) => byCodeUnit(a.fromKey, b.fromKey) || byCodeUnit(a.impl.id, b.impl.id) || a.stepNumber - b.stepNumber)[0];
|
|
13829
|
-
const
|
|
13835
|
+
const path29 = [...keys].sort(byCodeUnit).join(" \u2192 ");
|
|
13830
13836
|
ctx.addIssue(
|
|
13831
13837
|
"warning",
|
|
13832
13838
|
"UNCONDITIONAL_CALL_CYCLE",
|
|
13833
|
-
`Call cycle with no guard: ${
|
|
13839
|
+
`Call cycle with no guard: ${path29} \u2014 every call edge in this cycle is unavoidable on all paths of its narrative (e.g. step ${anchor.stepNumber} of "${anchor.methodName}" in "${anchor.impl.id}" always calls ${anchor.toLabel}). This recurses without a base case, by construction. Guard at least one edge with a branch/return before the call, or lint.allow with the termination argument.`,
|
|
13834
13840
|
anchor.impl.id,
|
|
13835
13841
|
memberEdges.some((e) => ctx.isImplementationDraft(e.impl))
|
|
13836
13842
|
);
|
|
@@ -16572,11 +16578,11 @@ var hiddenStateRule = {
|
|
|
16572
16578
|
byPath.set(key, list);
|
|
16573
16579
|
}
|
|
16574
16580
|
}
|
|
16575
|
-
for (const
|
|
16576
|
-
const facts = code.factsAt(
|
|
16581
|
+
for (const path29 of code.exactPaths) {
|
|
16582
|
+
const facts = code.factsAt(path29);
|
|
16577
16583
|
const bindings = facts.topLevelMutableBindings ?? [];
|
|
16578
16584
|
if (bindings.length === 0) continue;
|
|
16579
|
-
const mapped = byPath.get(
|
|
16585
|
+
const mapped = byPath.get(path29) ?? [];
|
|
16580
16586
|
if (mapped.length === 0) continue;
|
|
16581
16587
|
if (!mapped.every((m) => isStatelessLogic(m.component))) continue;
|
|
16582
16588
|
const anchor = [...mapped].sort((a, b) => a.impl.id.localeCompare(b.impl.id))[0];
|
|
@@ -16642,7 +16648,7 @@ var dependencyConformanceRule = {
|
|
|
16642
16648
|
}
|
|
16643
16649
|
return false;
|
|
16644
16650
|
};
|
|
16645
|
-
const draftAt = (
|
|
16651
|
+
const draftAt = (path29) => realization.implementationsAt(path29).some((impl) => ctx.isImplementationDraft(impl));
|
|
16646
16652
|
for (const fromPath of mappedPaths) {
|
|
16647
16653
|
const fromComponents = realization.componentsAt(fromPath);
|
|
16648
16654
|
for (const toPath of graph.importsOf(fromPath)) {
|
|
@@ -22052,13 +22058,13 @@ function ineffectiveDeltaPaths(delta, merged, stored) {
|
|
|
22052
22058
|
const isPlain = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
22053
22059
|
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
22054
22060
|
const at = (prefix, key) => prefix ? `${prefix}.${key}` : key;
|
|
22055
|
-
const say = (
|
|
22056
|
-
out.push(`${
|
|
22061
|
+
const say = (path29, why) => {
|
|
22062
|
+
out.push(`${path29} \u2014 ${why}`);
|
|
22057
22063
|
};
|
|
22058
|
-
const walkValue = (d, m, s,
|
|
22064
|
+
const walkValue = (d, m, s, path29, field) => {
|
|
22059
22065
|
if (Array.isArray(d)) {
|
|
22060
22066
|
if (!Array.isArray(m)) {
|
|
22061
|
-
say(
|
|
22067
|
+
say(path29, "the level does not have this field, so the write dropped it");
|
|
22062
22068
|
return;
|
|
22063
22069
|
}
|
|
22064
22070
|
if (field === "narrative" && d.some(carriesEditMarker)) return;
|
|
@@ -22066,32 +22072,32 @@ function ineffectiveDeltaPaths(delta, merged, stored) {
|
|
|
22066
22072
|
if (carriesEditMarker(element)) continue;
|
|
22067
22073
|
const key = reportIdentityOf(field, element);
|
|
22068
22074
|
if (key === null) {
|
|
22069
|
-
if (!same(m, d)) say(
|
|
22070
|
-
else if (same(s, d)) say(
|
|
22075
|
+
if (!same(m, d)) say(path29, "the level does not keep this value, so the write dropped it");
|
|
22076
|
+
else if (same(s, d)) say(path29, "the stored spec already held this value");
|
|
22071
22077
|
return;
|
|
22072
22078
|
}
|
|
22073
22079
|
const mMatch = m.find((i) => reportIdentityOf(field, i) === key);
|
|
22074
22080
|
const sMatch = Array.isArray(s) ? s.find((i) => reportIdentityOf(field, i) === key) : void 0;
|
|
22075
22081
|
if (mMatch === void 0) {
|
|
22076
|
-
say(at(
|
|
22082
|
+
say(at(path29, key), "the write did not store this element");
|
|
22077
22083
|
continue;
|
|
22078
22084
|
}
|
|
22079
|
-
walk2(element, mMatch, sMatch, at(
|
|
22085
|
+
walk2(element, mMatch, sMatch, at(path29, key), field);
|
|
22080
22086
|
}
|
|
22081
22087
|
return;
|
|
22082
22088
|
}
|
|
22083
22089
|
if (isPlain(d)) {
|
|
22084
22090
|
if (!isPlain(m)) {
|
|
22085
|
-
say(
|
|
22091
|
+
say(path29, "the level does not have this field, so the write dropped it");
|
|
22086
22092
|
return;
|
|
22087
22093
|
}
|
|
22088
|
-
walk2(d, m, s,
|
|
22094
|
+
walk2(d, m, s, path29, field);
|
|
22089
22095
|
return;
|
|
22090
22096
|
}
|
|
22091
|
-
if (!same(m, d)) say(
|
|
22092
|
-
else if (same(s, d)) say(
|
|
22097
|
+
if (!same(m, d)) say(path29, "the write did not store it \u2014 the level's schema does not keep this value");
|
|
22098
|
+
else if (same(s, d)) say(path29, "the stored spec already held this value");
|
|
22093
22099
|
};
|
|
22094
|
-
function walk2(d, m, s,
|
|
22100
|
+
function walk2(d, m, s, path29, container) {
|
|
22095
22101
|
for (const [key, value] of Object.entries(d)) {
|
|
22096
22102
|
if (DELTA_VERBS.has(key) || JUMP_LABEL_TWINS.has(key)) continue;
|
|
22097
22103
|
if (key === "label" && LABEL_TWIN_CONTAINERS.has(container)) continue;
|
|
@@ -22101,13 +22107,13 @@ function ineffectiveDeltaPaths(delta, merged, stored) {
|
|
|
22101
22107
|
if (typeof name !== "string") continue;
|
|
22102
22108
|
const had = isPlain(s) && s[name] !== void 0;
|
|
22103
22109
|
const still = isPlain(m) && m[name] !== void 0;
|
|
22104
|
-
if (!had) say(at(
|
|
22105
|
-
else if (still) say(at(
|
|
22110
|
+
if (!had) say(at(path29, name), "unset named a field the stored spec did not have");
|
|
22111
|
+
else if (still) say(at(path29, name), "unset did not remove it");
|
|
22106
22112
|
}
|
|
22107
22113
|
continue;
|
|
22108
22114
|
}
|
|
22109
22115
|
if (value === void 0 || value === null) continue;
|
|
22110
|
-
const here = at(
|
|
22116
|
+
const here = at(path29, key);
|
|
22111
22117
|
const mValue = isPlain(m) ? m[key] : void 0;
|
|
22112
22118
|
const sValue = isPlain(s) ? s[key] : void 0;
|
|
22113
22119
|
if (mValue === void 0) {
|
|
@@ -26341,12 +26347,24 @@ function readResource(resourceId) {
|
|
|
26341
26347
|
return readSkillResource(resourceId);
|
|
26342
26348
|
}
|
|
26343
26349
|
|
|
26350
|
+
// src/utils/ai-guide.ts
|
|
26351
|
+
var fs17 = __toESM(require("fs"));
|
|
26352
|
+
var os4 = __toESM(require("os"));
|
|
26353
|
+
var path22 = __toESM(require("path"));
|
|
26354
|
+
|
|
26344
26355
|
// src/core/stamp.ts
|
|
26345
26356
|
function versionStamp() {
|
|
26346
26357
|
return `<!-- wairon-version: ${WAIRON_VERSION} -->`;
|
|
26347
26358
|
}
|
|
26359
|
+
var STAMP_RE = /<!--\s*wairon-version:\s*([^\s]+)\s*-->/;
|
|
26360
|
+
function readStampVersion(content) {
|
|
26361
|
+
const m = content.match(STAMP_RE);
|
|
26362
|
+
return m ? m[1] : null;
|
|
26363
|
+
}
|
|
26348
26364
|
|
|
26349
26365
|
// src/utils/ai-guide.ts
|
|
26366
|
+
var GUIDE_MARKER_START = "<!-- wairon-guide-start -->";
|
|
26367
|
+
var GUIDE_MARKER_END = "<!-- wairon-guide-end -->";
|
|
26350
26368
|
var GLOBAL_GUIDE_BODY = `## wairon \u2014 Spec-Driven Development (optional)
|
|
26351
26369
|
|
|
26352
26370
|
If \`.wai/specs/\` exists, the wairon SDD workflow is active; otherwise ignore it. wairon does not orchestrate sessions \u2014 it equips yours.
|
|
@@ -26362,6 +26380,133 @@ If \`.wai/specs/\` exists, the wairon SDD workflow is active; otherwise ignore i
|
|
|
26362
26380
|
5. **Design First**: Complete spec and pass \`sdd_validate_tree\` before writing code.
|
|
26363
26381
|
6. **Consistency**: Code must match L3 interfaces and L5 narratives exactly. If the spec is wrong, stop and update the spec.
|
|
26364
26382
|
7. **Subprojects & Namespacing**: If a subsystem uses \`projectPath\` delegation, target its specs using namespaced IDs (e.g. \`subsystem::component\`). Use leading \`::\` to target root (e.g. \`::shared::type\`) and \`super::\` to go up a level (e.g. \`super::sibling\`). wairon automatically resolves the path and strips the prefix on writes.`;
|
|
26383
|
+
var LOCAL_GUIDE_BODY = `## Wairon \u2014 Spec-Driven Development (you are operating inside it)
|
|
26384
|
+
|
|
26385
|
+
This project uses **wairon**. System specs live under \`.wai/specs/\` (L0 System \u2192 L1 Subsystem \u2192 L2 Component \u2192 L3 Interface \u2192 L4 Implementation \u2192 Narrative); agent topology and code are derived from it.
|
|
26386
|
+
|
|
26387
|
+
**Do NOT search files or read agent configs to learn about wairon or SDD. Use the context here and the \`sdd-architect\` skill to start.**
|
|
26388
|
+
|
|
26389
|
+
**Your first move: call the \`sdd_get_status\` MCP tool** (or \`wairon/sdd_get_status\`) to see the spec tree. Do not parse files or run CLI commands manually.
|
|
26390
|
+
|
|
26391
|
+
### How you operate
|
|
26392
|
+
- **To design/modify specs**: Use **\`sdd-architect\`** skill (in \`.claude/skills/\` or \`.gemini/skills/\`).
|
|
26393
|
+
- **Manage specs via MCP tools only**: Use \`sdd_initialize_system\`, \`sdd_add_subsystem\`, \`sdd_add_component\`, \`sdd_define_interface\`, \`sdd_write_narrative\`, \`sdd_add_type\`, \`sdd_get_spec\`, \`sdd_delete_spec\`, \`sdd_validate_tree\`, and \`sdd_get_status\` (namespaced if needed). Do not edit specs manually.
|
|
26394
|
+
- **Subprojects & Namespacing (Chaining)**: If a subsystem defines a \`projectPath\`, its entire \`.wai/\` spec tree is recursively loaded and namespaced with the subsystem ID as a prefix (using \`::\`, e.g. \`billing::invoice::invoice_portal\`). Use the qualified namespaced ID with the parent MCP tools; wairon will resolve the path and strip the prefix automatically.
|
|
26395
|
+
- **Leading \`::\`**: Bypasses the local subsystem prefix to resolve absolute from the system root (e.g. \`::shared::error-type\`).
|
|
26396
|
+
- **\`super::\`**: Goes up one parent subsystem level (e.g. \`super::sibling_comp\`, \`super::super::parent_sibling\`).
|
|
26397
|
+
- **Do not run the \`wairon\` CLI**: Use \`sdd_validate_tree\` and \`sdd_get_status\` instead of CLI commands.
|
|
26398
|
+
- **Handoff to implementation**: Once design is complete and validates cleanly, tell the human: *"The specs are complete and validate. Please run \`wairon lock\` to confirm and freeze them."* No session restart is needed after the lock \u2014 delegate implementation right away via the \`sdd-delegate\` skill.
|
|
26399
|
+
- **To implement code**: Delegate via the \`sdd-delegate\` skill: fetch the component's live brief with the \`sdd_get_agent_brief\` MCP tool (or the \`wairon-agent://\` resource) and spawn a subagent from it. Briefs are composed per call from the current spec tree, so they are always current \u2014 never wait for a restart. Implementations must match L3 interfaces and L5 narratives exactly. Generated agent files under \`.claude/agents/\` are an optional materialized view of the same topology \u2014 the live briefs are canonical.
|
|
26400
|
+
|
|
26401
|
+
### Rules (enforced by \`sdd_validate_tree\`)
|
|
26402
|
+
1. **Design before code**: Complete spec and pass validator before writing source code.
|
|
26403
|
+
2. **Human-in-the-loop**: Ask user approval for each spec layer before proceeding.
|
|
26404
|
+
3. **Spec consistency**: If a 1:1 narrative match is incorrect or conflicts with L0 requirements, escalate a spec revision first. Never ship mismatched code.
|
|
26405
|
+
4. **No persistence shortcuts & strict layers**: A Portal must never depend directly on a Store, Registry, or Adapter. Portal reads MAY go through a Repository/Index facade (passthrough reads need no per-entity Orchestrator ceremony), but a Portal narrative call or dispatch-table binding that reaches a write-effect facade method is an error (\`PORTAL_WRITE_SHORTCUT\`) \u2014 writes always route through an Orchestrator. Held domain state always lives in a dedicated data component, never as fields inside an Orchestrator. Two sanctioned shapes: the RECOMMENDED Repository pattern (owns Store + Registry + Index; consumers depend on the facade), or \u2014 for genuinely simple state \u2014 a deliberately standalone Store (workflow-layer consumers only, acknowledged with a lint.allow reason on the UNOWNED_STORE warning). Never combine Store/Registry/Index roles into one component, and never fold state into a consuming component because a link was refused.
|
|
26406
|
+
|
|
26407
|
+
### Component Vocabulary
|
|
26408
|
+
* **Blocks**: Portal, Orchestrator, Supervisor, Actor, Store, Index, Query, Registry, Adapter, Observer.
|
|
26409
|
+
* **Patterns**: Repository \u2014 the composable pattern that \`owns\` its member blocks: one Store with its Registry, Indexes and Queries, and optionally an Adapter.
|
|
26410
|
+
* **Variants**: \`gateway\`, a Portal that authenticates, authorizes, validates or rate-limits before it dispatches. Logic is an Orchestrator, and \`dependencyClass: pure | read\` bounds what it may depend on (unset = a workflow). Specialist and Gateway are retired stereotypes.
|
|
26411
|
+
* Use \`owns\` for private member containment (exactly one hop) and \`dependsOn\` for collaborators. Never use generic suffixes like "Manager", "Helper", or "Utils".`;
|
|
26412
|
+
function globalGuideFilePath(targetType) {
|
|
26413
|
+
if (targetType === "claude") return path22.join(process.env["CLAUDE_CONFIG_DIR"] || path22.join(os4.homedir(), ".claude"), "CLAUDE.md");
|
|
26414
|
+
if (targetType === "gemini") return path22.join(process.env["GEMINI_CONFIG_DIR"] || path22.join(os4.homedir(), ".gemini"), "GEMINI.md");
|
|
26415
|
+
return null;
|
|
26416
|
+
}
|
|
26417
|
+
function localGuideFilePath(projectRoot, targetType) {
|
|
26418
|
+
if (targetType === "claude") return path22.join(projectRoot, ".claude", "CLAUDE.md");
|
|
26419
|
+
if (targetType === "gemini" || targetType === "agy") return path22.join(projectRoot, ".gemini", "GEMINI.md");
|
|
26420
|
+
return null;
|
|
26421
|
+
}
|
|
26422
|
+
function injectGuide(filePath, scope) {
|
|
26423
|
+
const body = scope === "global" ? GLOBAL_GUIDE_BODY : LOCAL_GUIDE_BODY;
|
|
26424
|
+
const section = `
|
|
26425
|
+
|
|
26426
|
+
${GUIDE_MARKER_START}
|
|
26427
|
+
${versionStamp()}
|
|
26428
|
+
${body}
|
|
26429
|
+
${GUIDE_MARKER_END}
|
|
26430
|
+
`;
|
|
26431
|
+
const existing = fs17.existsSync(filePath) ? fs17.readFileSync(filePath, "utf-8") : "";
|
|
26432
|
+
const stripped = stripGuideSection(existing);
|
|
26433
|
+
const newContent = stripped.trimEnd() + section;
|
|
26434
|
+
fs17.mkdirSync(path22.dirname(filePath), { recursive: true });
|
|
26435
|
+
fs17.writeFileSync(filePath, newContent, "utf-8");
|
|
26436
|
+
}
|
|
26437
|
+
function stripGuideSection(content) {
|
|
26438
|
+
const start = content.indexOf(GUIDE_MARKER_START);
|
|
26439
|
+
const end = content.indexOf(GUIDE_MARKER_END);
|
|
26440
|
+
if (start === -1 || end === -1) return content;
|
|
26441
|
+
return content.slice(0, start) + content.slice(end + GUIDE_MARKER_END.length);
|
|
26442
|
+
}
|
|
26443
|
+
function writeRootGuideDelegator(projectRoot, targetType) {
|
|
26444
|
+
if (targetType === "claude") {
|
|
26445
|
+
const filePath = path22.join(projectRoot, "CLAUDE.md");
|
|
26446
|
+
const content = `@.claude/CLAUDE.md
|
|
26447
|
+
|
|
26448
|
+
# Wairon SDD Project
|
|
26449
|
+
|
|
26450
|
+
This project uses the Wairon Spec-Driven Development (SDD) framework. The imported
|
|
26451
|
+
\`.claude/CLAUDE.md\` above is your complete operating guide \u2014 you already have the
|
|
26452
|
+
full context, so don't search the project to learn how wairon or SDD works.
|
|
26453
|
+
|
|
26454
|
+
To design or modify the system, invoke the **\`sdd-architect\`** skill
|
|
26455
|
+
(in \`.claude/skills/\`). Author and validate specs with the \`sdd_*\` MCP tools;
|
|
26456
|
+
the \`wairon\` CLI is the human developer's tool, not yours.
|
|
26457
|
+
`;
|
|
26458
|
+
fs17.writeFileSync(filePath, content, "utf-8");
|
|
26459
|
+
} else if (targetType === "gemini" || targetType === "agy") {
|
|
26460
|
+
const filePath = path22.join(projectRoot, "GEMINI.md");
|
|
26461
|
+
const content = `# Wairon SDD Project
|
|
26462
|
+
${GUIDE_MARKER_START}
|
|
26463
|
+
${versionStamp()}
|
|
26464
|
+
${LOCAL_GUIDE_BODY}
|
|
26465
|
+
${GUIDE_MARKER_END}
|
|
26466
|
+
`;
|
|
26467
|
+
fs17.writeFileSync(filePath, content, "utf-8");
|
|
26468
|
+
} else if (targetType === "cursor") {
|
|
26469
|
+
const filePath = path22.join(projectRoot, ".cursorrules");
|
|
26470
|
+
const content = `# Wairon SDD Project
|
|
26471
|
+
|
|
26472
|
+
This project uses the Wairon Spec-Driven Development (SDD) framework.
|
|
26473
|
+
|
|
26474
|
+
Refer to the rules in [.cursor/rules/](.cursor/rules/) for full instructions.
|
|
26475
|
+
`;
|
|
26476
|
+
fs17.writeFileSync(filePath, content, "utf-8");
|
|
26477
|
+
} else if (targetType === "copilot") {
|
|
26478
|
+
const filePath = path22.join(projectRoot, ".github", "copilot-instructions.md");
|
|
26479
|
+
fs17.mkdirSync(path22.dirname(filePath), { recursive: true });
|
|
26480
|
+
const content = `# Wairon SDD Project
|
|
26481
|
+
|
|
26482
|
+
This project uses the Wairon Spec-Driven Development (SDD) framework.
|
|
26483
|
+
|
|
26484
|
+
Refer to the prompts in [.github/prompts/](.github/prompts/) for instructions.
|
|
26485
|
+
`;
|
|
26486
|
+
fs17.writeFileSync(filePath, content, "utf-8");
|
|
26487
|
+
} else if (targetType === "codex") {
|
|
26488
|
+
const filePath = path22.join(projectRoot, ".codexrules");
|
|
26489
|
+
const content = `# Wairon SDD Project
|
|
26490
|
+
|
|
26491
|
+
Refer to [.codex/agents/](.codex/agents/) for full instructions.
|
|
26492
|
+
`;
|
|
26493
|
+
fs17.writeFileSync(filePath, content, "utf-8");
|
|
26494
|
+
}
|
|
26495
|
+
}
|
|
26496
|
+
var GUIDE_TARGETS = ["claude", "gemini", "agy", "cursor", "copilot", "codex"];
|
|
26497
|
+
function reinjectLocalGuides(projectRoot, targetTypes) {
|
|
26498
|
+
const written = [];
|
|
26499
|
+
for (const type of targetTypes) {
|
|
26500
|
+
if (!GUIDE_TARGETS.includes(type)) continue;
|
|
26501
|
+
const guidePath = localGuideFilePath(projectRoot, type);
|
|
26502
|
+
if (guidePath) {
|
|
26503
|
+
injectGuide(guidePath, "local");
|
|
26504
|
+
if (!written.includes(guidePath)) written.push(guidePath);
|
|
26505
|
+
}
|
|
26506
|
+
writeRootGuideDelegator(projectRoot, type);
|
|
26507
|
+
}
|
|
26508
|
+
return written;
|
|
26509
|
+
}
|
|
26365
26510
|
|
|
26366
26511
|
// src/core/context.ts
|
|
26367
26512
|
function contextDir(...segments) {
|
|
@@ -26496,8 +26641,8 @@ function syncContextFiles() {
|
|
|
26496
26641
|
}
|
|
26497
26642
|
|
|
26498
26643
|
// src/core/treetransfer.ts
|
|
26499
|
-
var
|
|
26500
|
-
var
|
|
26644
|
+
var fs18 = __toESM(require("fs"));
|
|
26645
|
+
var path23 = __toESM(require("path"));
|
|
26501
26646
|
var sdkPortal = __toESM(require_dist());
|
|
26502
26647
|
var STAGING_PREFIX = ".wai-staging-";
|
|
26503
26648
|
var BACKUP_DIR = ".wai-backups";
|
|
@@ -26523,41 +26668,41 @@ function hasAuthoredSpecs(root) {
|
|
|
26523
26668
|
if (!pathExists(specsDir)) {
|
|
26524
26669
|
return false;
|
|
26525
26670
|
}
|
|
26526
|
-
const systemIndex =
|
|
26671
|
+
const systemIndex = path23.resolve(paths.specsSystem());
|
|
26527
26672
|
for (const file of listFilesRecursive(specsDir, ".yaml")) {
|
|
26528
|
-
if (
|
|
26673
|
+
if (path23.resolve(file) !== systemIndex) {
|
|
26529
26674
|
return true;
|
|
26530
26675
|
}
|
|
26531
26676
|
}
|
|
26532
26677
|
return false;
|
|
26533
26678
|
}
|
|
26534
26679
|
function createStagingDir(destDir) {
|
|
26535
|
-
const root =
|
|
26536
|
-
|
|
26537
|
-
const stagingDir =
|
|
26680
|
+
const root = path23.resolve(destDir);
|
|
26681
|
+
fs18.mkdirSync(root, { recursive: true });
|
|
26682
|
+
const stagingDir = fs18.mkdtempSync(path23.join(root, STAGING_PREFIX));
|
|
26538
26683
|
return stagingDir;
|
|
26539
26684
|
}
|
|
26540
26685
|
function commitStagedTree(stagingDir, destDir, roots, backupExisting) {
|
|
26541
|
-
const root =
|
|
26542
|
-
const backupDir =
|
|
26686
|
+
const root = path23.resolve(destDir);
|
|
26687
|
+
const backupDir = path23.join(root, BACKUP_DIR, timestampSlug());
|
|
26543
26688
|
let backedUp = false;
|
|
26544
26689
|
for (const rootRel of roots) {
|
|
26545
26690
|
const relative9 = rootRel === "." ? "" : rootRel;
|
|
26546
|
-
const stagedSpecDir =
|
|
26547
|
-
if (!
|
|
26548
|
-
const liveSpecDir = liveSpecDirFor(
|
|
26549
|
-
if (backupExisting && liveSpecDir &&
|
|
26550
|
-
const backupTarget =
|
|
26551
|
-
|
|
26552
|
-
|
|
26691
|
+
const stagedSpecDir = path23.join(stagingDir, relative9, ".wai");
|
|
26692
|
+
if (!fs18.existsSync(stagedSpecDir)) continue;
|
|
26693
|
+
const liveSpecDir = liveSpecDirFor(path23.join(root, relative9));
|
|
26694
|
+
if (backupExisting && liveSpecDir && fs18.existsSync(liveSpecDir)) {
|
|
26695
|
+
const backupTarget = path23.join(backupDir, relative9, path23.basename(liveSpecDir));
|
|
26696
|
+
fs18.mkdirSync(path23.dirname(backupTarget), { recursive: true });
|
|
26697
|
+
fs18.renameSync(liveSpecDir, backupTarget);
|
|
26553
26698
|
backedUp = true;
|
|
26554
|
-
} else if (liveSpecDir &&
|
|
26555
|
-
|
|
26699
|
+
} else if (liveSpecDir && fs18.existsSync(liveSpecDir)) {
|
|
26700
|
+
fs18.rmSync(liveSpecDir, { recursive: true, force: true });
|
|
26556
26701
|
}
|
|
26557
|
-
const target =
|
|
26558
|
-
|
|
26559
|
-
if (
|
|
26560
|
-
|
|
26702
|
+
const target = path23.join(root, relative9, ".wai");
|
|
26703
|
+
fs18.mkdirSync(path23.dirname(target), { recursive: true });
|
|
26704
|
+
if (fs18.existsSync(target)) fs18.rmSync(target, { recursive: true, force: true });
|
|
26705
|
+
fs18.renameSync(stagedSpecDir, target);
|
|
26561
26706
|
}
|
|
26562
26707
|
if (backedUp) {
|
|
26563
26708
|
return backupDir;
|
|
@@ -26566,7 +26711,7 @@ function commitStagedTree(stagingDir, destDir, roots, backupExisting) {
|
|
|
26566
26711
|
}
|
|
26567
26712
|
function discardStagingDir(stagingDir) {
|
|
26568
26713
|
try {
|
|
26569
|
-
|
|
26714
|
+
fs18.rmSync(stagingDir, { recursive: true, force: true });
|
|
26570
26715
|
} catch {
|
|
26571
26716
|
}
|
|
26572
26717
|
}
|
|
@@ -26580,7 +26725,7 @@ function exportSpecTree(includeDerived, allowPartial) {
|
|
|
26580
26725
|
const skipped = [...inspection.skipped];
|
|
26581
26726
|
const roots = [{ relativePath: ".", waiDir: aiPathsAt(root).root() }];
|
|
26582
26727
|
for (const rel2 of inspection.roots) {
|
|
26583
|
-
const waiDir = aiPathsAt(
|
|
26728
|
+
const waiDir = aiPathsAt(path23.resolve(root, rel2)).root();
|
|
26584
26729
|
if (pathExists(waiDir)) {
|
|
26585
26730
|
roots.push({ relativePath: rel2, waiDir });
|
|
26586
26731
|
} else {
|
|
@@ -26611,7 +26756,7 @@ function importSpecTree(archive, options) {
|
|
|
26611
26756
|
if (!info.compatible) {
|
|
26612
26757
|
throw new Error("incompatible .waitree archive (format or minimum wairon version)");
|
|
26613
26758
|
}
|
|
26614
|
-
const destDir =
|
|
26759
|
+
const destDir = path23.resolve(options.destDir ?? getProjectRoot());
|
|
26615
26760
|
const occupied = hasSpecTree(destDir);
|
|
26616
26761
|
const authored = hasAuthoredSpecs(destDir);
|
|
26617
26762
|
if (authored && options.replaceExisting !== true) {
|
|
@@ -26642,10 +26787,10 @@ function importSpecTree(archive, options) {
|
|
|
26642
26787
|
return result;
|
|
26643
26788
|
}
|
|
26644
26789
|
function liveSpecDirFor(rootDir) {
|
|
26645
|
-
const modern =
|
|
26646
|
-
if (
|
|
26647
|
-
const legacy =
|
|
26648
|
-
if (
|
|
26790
|
+
const modern = path23.join(rootDir, ".wai");
|
|
26791
|
+
if (fs18.existsSync(modern)) return modern;
|
|
26792
|
+
const legacy = path23.join(rootDir, ".wairon");
|
|
26793
|
+
if (fs18.existsSync(legacy)) return legacy;
|
|
26649
26794
|
return null;
|
|
26650
26795
|
}
|
|
26651
26796
|
function timestampSlug() {
|
|
@@ -26653,10 +26798,10 @@ function timestampSlug() {
|
|
|
26653
26798
|
}
|
|
26654
26799
|
|
|
26655
26800
|
// src/exporters/generate.ts
|
|
26656
|
-
var
|
|
26801
|
+
var path27 = __toESM(require("path"));
|
|
26657
26802
|
|
|
26658
26803
|
// src/exporters/claude.ts
|
|
26659
|
-
var
|
|
26804
|
+
var path24 = __toESM(require("path"));
|
|
26660
26805
|
var MODEL_BY_TIER = {
|
|
26661
26806
|
small: "haiku",
|
|
26662
26807
|
standard: "sonnet",
|
|
@@ -26695,7 +26840,7 @@ var ClaudeExporter = class {
|
|
|
26695
26840
|
outputPath(ctx) {
|
|
26696
26841
|
const { agent, target, projectRoot } = ctx;
|
|
26697
26842
|
const outputDir = "outputDir" in target ? target.outputDir : ".claude/agents";
|
|
26698
|
-
return
|
|
26843
|
+
return path24.resolve(projectRoot, outputDir, `${agent.id.replace(/::/g, "--")}.md`);
|
|
26699
26844
|
}
|
|
26700
26845
|
export(ctx) {
|
|
26701
26846
|
const { agent, renderedInstructions, budget } = ctx;
|
|
@@ -26720,7 +26865,7 @@ var ClaudeExporter = class {
|
|
|
26720
26865
|
};
|
|
26721
26866
|
|
|
26722
26867
|
// src/exporters/custom.ts
|
|
26723
|
-
var
|
|
26868
|
+
var path25 = __toESM(require("path"));
|
|
26724
26869
|
var CustomExporter = class {
|
|
26725
26870
|
constructor() {
|
|
26726
26871
|
this.targetType = "custom";
|
|
@@ -26730,7 +26875,7 @@ var CustomExporter = class {
|
|
|
26730
26875
|
if (!("outputDir" in target)) {
|
|
26731
26876
|
throw new Error("CustomExporter requires target.outputDir");
|
|
26732
26877
|
}
|
|
26733
|
-
return
|
|
26878
|
+
return path25.resolve(projectRoot, target.outputDir, `${agent.id.replace(/::/g, "--")}.md`);
|
|
26734
26879
|
}
|
|
26735
26880
|
export(ctx) {
|
|
26736
26881
|
const { agent, target, renderedInstructions } = ctx;
|
|
@@ -26753,7 +26898,7 @@ var CustomExporter = class {
|
|
|
26753
26898
|
};
|
|
26754
26899
|
|
|
26755
26900
|
// src/exporters/gemini.ts
|
|
26756
|
-
var
|
|
26901
|
+
var path26 = __toESM(require("path"));
|
|
26757
26902
|
var GeminiExporter = class {
|
|
26758
26903
|
constructor() {
|
|
26759
26904
|
this.targetType = "gemini";
|
|
@@ -26761,7 +26906,7 @@ var GeminiExporter = class {
|
|
|
26761
26906
|
outputPath(ctx) {
|
|
26762
26907
|
const { agent, target, projectRoot } = ctx;
|
|
26763
26908
|
const outputDir = "outputDir" in target ? target.outputDir : ".gemini/agents";
|
|
26764
|
-
return
|
|
26909
|
+
return path26.resolve(projectRoot, outputDir, `${agent.id.replace(/::/g, "--")}.yaml`);
|
|
26765
26910
|
}
|
|
26766
26911
|
export(ctx) {
|
|
26767
26912
|
const { agent, renderedInstructions } = ctx;
|
|
@@ -26858,7 +27003,7 @@ function resolveExpectedOutputPaths(agents, projectConfig, projectRoot = getProj
|
|
|
26858
27003
|
const targetConfig = resolveTargetConfig(agentTarget, projectConfig);
|
|
26859
27004
|
if (!targetConfig) continue;
|
|
26860
27005
|
const ctx = { agent, projectRoot, target: targetConfig };
|
|
26861
|
-
expected.add(
|
|
27006
|
+
expected.add(path27.resolve(getExporter(targetConfig).outputPath(ctx)));
|
|
26862
27007
|
}
|
|
26863
27008
|
}
|
|
26864
27009
|
return expected;
|
|
@@ -27005,7 +27150,7 @@ function repairForeignStepFields(apply) {
|
|
|
27005
27150
|
|
|
27006
27151
|
// src/core/approval.ts
|
|
27007
27152
|
var crypto4 = __toESM(require("crypto"));
|
|
27008
|
-
var
|
|
27153
|
+
var path28 = __toESM(require("path"));
|
|
27009
27154
|
function diffSize(d) {
|
|
27010
27155
|
return d.added.length + d.changed.length + d.removed.length;
|
|
27011
27156
|
}
|
|
@@ -27014,12 +27159,12 @@ function digest(content) {
|
|
|
27014
27159
|
return crypto4.createHash("sha256").update(normalized, "utf8").digest("hex");
|
|
27015
27160
|
}
|
|
27016
27161
|
function currentSpecDigests(root = getProjectRoot()) {
|
|
27017
|
-
const mountDirs = loadSubsystemSpecs().filter((s) => s.projectPath && !s.id.includes("::")).map((s) => `${
|
|
27162
|
+
const mountDirs = loadSubsystemSpecs().filter((s) => s.projectPath && !s.id.includes("::")).map((s) => `${path28.resolve(root, s.projectPath).split(path28.sep).join("/")}/`);
|
|
27018
27163
|
const out = {};
|
|
27019
27164
|
for (const [abs, content] of snapshotSpecFiles()) {
|
|
27020
|
-
const normalized =
|
|
27165
|
+
const normalized = path28.resolve(abs).split(path28.sep).join("/");
|
|
27021
27166
|
if (mountDirs.some((dir) => normalized.startsWith(dir))) continue;
|
|
27022
|
-
out[
|
|
27167
|
+
out[path28.relative(root, abs).split(path28.sep).join("/")] = digest(content);
|
|
27023
27168
|
}
|
|
27024
27169
|
return out;
|
|
27025
27170
|
}
|
|
@@ -27077,7 +27222,7 @@ function currentChildPins(mounts, root = getProjectRoot()) {
|
|
|
27077
27222
|
const pins = {};
|
|
27078
27223
|
for (const mount of mounts) {
|
|
27079
27224
|
if (!mount.projectPath || mount.id.includes("::")) continue;
|
|
27080
|
-
const child = readLockRecordAt(
|
|
27225
|
+
const child = readLockRecordAt(path28.resolve(root, mount.projectPath));
|
|
27081
27226
|
if (child) pins[mount.id] = pinOf(child.stateId);
|
|
27082
27227
|
}
|
|
27083
27228
|
return pins;
|
|
@@ -27096,7 +27241,7 @@ function movedChildren(mounts, root = getProjectRoot()) {
|
|
|
27096
27241
|
|
|
27097
27242
|
// src/core/approver.ts
|
|
27098
27243
|
var import_child_process = require("child_process");
|
|
27099
|
-
var
|
|
27244
|
+
var os5 = __toESM(require("os"));
|
|
27100
27245
|
function gitConfig(key) {
|
|
27101
27246
|
try {
|
|
27102
27247
|
const value = (0, import_child_process.execFileSync)("git", ["config", "--get", key], {
|
|
@@ -27112,12 +27257,12 @@ function gitConfig(key) {
|
|
|
27112
27257
|
function machineIdentity() {
|
|
27113
27258
|
let user = "unknown";
|
|
27114
27259
|
try {
|
|
27115
|
-
user =
|
|
27260
|
+
user = os5.userInfo().username || user;
|
|
27116
27261
|
} catch {
|
|
27117
27262
|
}
|
|
27118
27263
|
let host = "";
|
|
27119
27264
|
try {
|
|
27120
|
-
host =
|
|
27265
|
+
host = os5.hostname();
|
|
27121
27266
|
} catch {
|
|
27122
27267
|
}
|
|
27123
27268
|
return { id: host ? `${user}@${host}` : user, source: "os" };
|
|
@@ -27454,6 +27599,7 @@ function loadProjectConfig4() {
|
|
|
27454
27599
|
getSubprojectPrefix,
|
|
27455
27600
|
getSubsystemPath,
|
|
27456
27601
|
getTypePath,
|
|
27602
|
+
globalGuideFilePath,
|
|
27457
27603
|
globalPacksDir,
|
|
27458
27604
|
globalPacksEnabled,
|
|
27459
27605
|
globalTemplatesDir,
|
|
@@ -27470,6 +27616,7 @@ function loadProjectConfig4() {
|
|
|
27470
27616
|
importSpecTree,
|
|
27471
27617
|
importSurface,
|
|
27472
27618
|
ineffectiveDeltaPaths,
|
|
27619
|
+
injectGuide,
|
|
27473
27620
|
inspectChainedRoots,
|
|
27474
27621
|
inspectTreeArchive,
|
|
27475
27622
|
installPackFromDirectory,
|
|
@@ -27523,6 +27670,7 @@ function loadProjectConfig4() {
|
|
|
27523
27670
|
loadTypeSpec,
|
|
27524
27671
|
loadTypeSpecs,
|
|
27525
27672
|
localApprover,
|
|
27673
|
+
localGuideFilePath,
|
|
27526
27674
|
localTypesOf,
|
|
27527
27675
|
logger,
|
|
27528
27676
|
makeScopeFilter,
|
|
@@ -27565,12 +27713,14 @@ function loadProjectConfig4() {
|
|
|
27565
27713
|
readProjectContext,
|
|
27566
27714
|
readResource,
|
|
27567
27715
|
readSkillResource,
|
|
27716
|
+
readStampVersion,
|
|
27568
27717
|
readYamlFile,
|
|
27569
27718
|
rebaseProjectVariants,
|
|
27570
27719
|
rebaseReference,
|
|
27571
27720
|
recordProfileSelection,
|
|
27572
27721
|
registerExporter,
|
|
27573
27722
|
registerPackRef,
|
|
27723
|
+
reinjectLocalGuides,
|
|
27574
27724
|
removeDomain,
|
|
27575
27725
|
removePackSelection,
|
|
27576
27726
|
removeSnapshot,
|
|
@@ -27648,6 +27798,7 @@ function loadProjectConfig4() {
|
|
|
27648
27798
|
writeJsonFile,
|
|
27649
27799
|
writeLockRecord,
|
|
27650
27800
|
writeProjectContext,
|
|
27801
|
+
writeRootGuideDelegator,
|
|
27651
27802
|
writeYamlFile
|
|
27652
27803
|
});
|
|
27653
27804
|
//# sourceMappingURL=index.js.map
|