wildcrane 0.11.87 → 0.11.88
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/kanban.mjs +216 -390
- package/package.json +1 -1
package/dist/kanban.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// ai4kanban 0.11.
|
|
2
|
+
// ai4kanban 0.11.88 — built from the CLI's TypeScript sources by cli/scripts/build.mjs.
|
|
3
3
|
// Do not edit: every change belongs in cli/src/, and a build overwrites this file.
|
|
4
4
|
import { createRequire as __ai4kanbanRequire } from 'node:module'
|
|
5
5
|
const require = __ai4kanbanRequire(import.meta.url)
|
|
@@ -594,9 +594,9 @@ function floatSafeRemainder(val, step) {
|
|
|
594
594
|
return 0;
|
|
595
595
|
return ratio - roundedRatio;
|
|
596
596
|
}
|
|
597
|
-
function defineLazy(
|
|
597
|
+
function defineLazy(object2, key, getter) {
|
|
598
598
|
let value = void 0;
|
|
599
|
-
Object.defineProperty(
|
|
599
|
+
Object.defineProperty(object2, key, {
|
|
600
600
|
get() {
|
|
601
601
|
if (value === EVALUATING) {
|
|
602
602
|
return void 0;
|
|
@@ -608,7 +608,7 @@ function defineLazy(object3, key, getter) {
|
|
|
608
608
|
return value;
|
|
609
609
|
},
|
|
610
610
|
set(v) {
|
|
611
|
-
Object.defineProperty(
|
|
611
|
+
Object.defineProperty(object2, key, {
|
|
612
612
|
value: v
|
|
613
613
|
// configurable: true,
|
|
614
614
|
});
|
|
@@ -688,10 +688,10 @@ function mergeDefs(...defs) {
|
|
|
688
688
|
function cloneDef(schema) {
|
|
689
689
|
return mergeDefs(schema._zod.def);
|
|
690
690
|
}
|
|
691
|
-
function getElementAtPath(obj3,
|
|
692
|
-
if (!
|
|
691
|
+
function getElementAtPath(obj3, path87) {
|
|
692
|
+
if (!path87)
|
|
693
693
|
return obj3;
|
|
694
|
-
return
|
|
694
|
+
return path87.reduce((acc, key) => acc?.[key], obj3);
|
|
695
695
|
}
|
|
696
696
|
function promiseAllObject(promisesObj) {
|
|
697
697
|
const keys = Object.keys(promisesObj);
|
|
@@ -950,11 +950,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
950
950
|
}
|
|
951
951
|
return false;
|
|
952
952
|
}
|
|
953
|
-
function prefixIssues(
|
|
953
|
+
function prefixIssues(path87, issues) {
|
|
954
954
|
return issues.map((iss) => {
|
|
955
955
|
var _a3;
|
|
956
956
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
957
|
-
iss.path.unshift(
|
|
957
|
+
iss.path.unshift(path87);
|
|
958
958
|
return iss;
|
|
959
959
|
});
|
|
960
960
|
}
|
|
@@ -1487,16 +1487,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
1489
1489
|
const fieldErrors = { _errors: [] };
|
|
1490
|
-
const processError = (error63,
|
|
1490
|
+
const processError = (error63, path87 = []) => {
|
|
1491
1491
|
for (const issue2 of error63.issues) {
|
|
1492
1492
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1493
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1493
|
+
issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
|
|
1494
1494
|
} else if (issue2.code === "invalid_key") {
|
|
1495
|
-
processError({ issues: issue2.issues }, [...
|
|
1495
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1496
1496
|
} else if (issue2.code === "invalid_element") {
|
|
1497
|
-
processError({ issues: issue2.issues }, [...
|
|
1497
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1498
1498
|
} else {
|
|
1499
|
-
const fullpath = [...
|
|
1499
|
+
const fullpath = [...path87, ...issue2.path];
|
|
1500
1500
|
if (fullpath.length === 0) {
|
|
1501
1501
|
fieldErrors._errors.push(mapper(issue2));
|
|
1502
1502
|
} else {
|
|
@@ -1535,17 +1535,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1535
1535
|
}
|
|
1536
1536
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
1537
1537
|
const result = { errors: [] };
|
|
1538
|
-
const processError = (error63,
|
|
1538
|
+
const processError = (error63, path87 = []) => {
|
|
1539
1539
|
var _a3;
|
|
1540
1540
|
for (const issue2 of error63.issues) {
|
|
1541
1541
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1542
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1542
|
+
issue2.errors.map((issues) => processError({ issues }, [...path87, ...issue2.path]));
|
|
1543
1543
|
} else if (issue2.code === "invalid_key") {
|
|
1544
|
-
processError({ issues: issue2.issues }, [...
|
|
1544
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1545
1545
|
} else if (issue2.code === "invalid_element") {
|
|
1546
|
-
processError({ issues: issue2.issues }, [...
|
|
1546
|
+
processError({ issues: issue2.issues }, [...path87, ...issue2.path]);
|
|
1547
1547
|
} else {
|
|
1548
|
-
const fullpath = [...
|
|
1548
|
+
const fullpath = [...path87, ...issue2.path];
|
|
1549
1549
|
if (fullpath.length === 0) {
|
|
1550
1550
|
result.errors.push(mapper(issue2));
|
|
1551
1551
|
continue;
|
|
@@ -1584,8 +1584,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
1584
1584
|
}
|
|
1585
1585
|
function toDotPath(_path) {
|
|
1586
1586
|
const segs = [];
|
|
1587
|
-
const
|
|
1588
|
-
for (const seg of
|
|
1587
|
+
const path87 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1588
|
+
for (const seg of path87) {
|
|
1589
1589
|
if (typeof seg === "number")
|
|
1590
1590
|
segs.push(`[${seg}]`);
|
|
1591
1591
|
else if (typeof seg === "symbol")
|
|
@@ -16270,8 +16270,8 @@ function foldObjects(members2) {
|
|
|
16270
16270
|
}
|
|
16271
16271
|
const properties = {};
|
|
16272
16272
|
const required2 = /* @__PURE__ */ new Set();
|
|
16273
|
-
for (const
|
|
16274
|
-
for (const key in
|
|
16273
|
+
for (const object2 of objects) {
|
|
16274
|
+
for (const key in object2.properties) {
|
|
16275
16275
|
if (Object.prototype.hasOwnProperty.call(properties, key))
|
|
16276
16276
|
continue;
|
|
16277
16277
|
const parts = [];
|
|
@@ -16285,18 +16285,18 @@ function foldObjects(members2) {
|
|
|
16285
16285
|
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
16286
16286
|
assignProp(properties, key, merged);
|
|
16287
16287
|
}
|
|
16288
|
-
for (const key of
|
|
16288
|
+
for (const key of object2.required ?? [])
|
|
16289
16289
|
required2.add(key);
|
|
16290
16290
|
}
|
|
16291
16291
|
const folded = { type: "object", properties };
|
|
16292
16292
|
if (required2.size)
|
|
16293
16293
|
folded.required = [...required2];
|
|
16294
|
-
if (objects.every((
|
|
16294
|
+
if (objects.every((object2) => object2.additionalProperties === false)) {
|
|
16295
16295
|
folded.additionalProperties = false;
|
|
16296
16296
|
} else {
|
|
16297
16297
|
const constraints = [];
|
|
16298
|
-
for (const
|
|
16299
|
-
const constraint = undeclaredConstraint(
|
|
16298
|
+
for (const object2 of objects) {
|
|
16299
|
+
const constraint = undeclaredConstraint(object2);
|
|
16300
16300
|
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
|
|
16301
16301
|
constraints.push(constraint);
|
|
16302
16302
|
}
|
|
@@ -16692,12 +16692,12 @@ function toJSONSchema(input2, params) {
|
|
|
16692
16692
|
processSchema(schema, ctx2);
|
|
16693
16693
|
}
|
|
16694
16694
|
const schemas = {};
|
|
16695
|
-
const
|
|
16695
|
+
const external = {
|
|
16696
16696
|
registry: registry2,
|
|
16697
16697
|
uri: params?.uri,
|
|
16698
16698
|
defs
|
|
16699
16699
|
};
|
|
16700
|
-
ctx2.external =
|
|
16700
|
+
ctx2.external = external;
|
|
16701
16701
|
for (const entry of registry2._idmap.entries()) {
|
|
16702
16702
|
const [key, schema] = entry;
|
|
16703
16703
|
extractDefs(ctx2, schema);
|
|
@@ -19617,13 +19617,13 @@ function resolveRef(ref, ctx) {
|
|
|
19617
19617
|
if (!ref.startsWith("#")) {
|
|
19618
19618
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19619
19619
|
}
|
|
19620
|
-
const
|
|
19621
|
-
if (
|
|
19620
|
+
const path87 = ref.slice(1).split("/").filter(Boolean);
|
|
19621
|
+
if (path87.length === 0) {
|
|
19622
19622
|
return ctx.rootSchema;
|
|
19623
19623
|
}
|
|
19624
19624
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19625
|
-
if (
|
|
19626
|
-
const key =
|
|
19625
|
+
if (path87[0] === defsKey) {
|
|
19626
|
+
const key = path87[1] === void 0 ? void 0 : decodeJSONPointerSegment(path87[1]);
|
|
19627
19627
|
if (!key || !ctx.defs[key]) {
|
|
19628
19628
|
throw new Error(`Reference not found: ${ref}`);
|
|
19629
19629
|
}
|
|
@@ -22832,7 +22832,7 @@ var init_package = __esm({
|
|
|
22832
22832
|
"package.json"() {
|
|
22833
22833
|
package_default = {
|
|
22834
22834
|
name: "wildcrane",
|
|
22835
|
-
version: "0.11.
|
|
22835
|
+
version: "0.11.88",
|
|
22836
22836
|
akbContract: 29,
|
|
22837
22837
|
description: "WildCrane's `akb` command \u2014 scaffold the Markdown board under docs/kanban/, put an agent on a card, and carry the flows the agent works by.",
|
|
22838
22838
|
keywords: [
|
|
@@ -25249,10 +25249,10 @@ function findRollout(threadId) {
|
|
|
25249
25249
|
}
|
|
25250
25250
|
for (const name of names2) {
|
|
25251
25251
|
if (!name.startsWith("rollout-") || !name.endsWith(tail)) continue;
|
|
25252
|
-
const
|
|
25252
|
+
const path87 = join2(dir, name);
|
|
25253
25253
|
try {
|
|
25254
|
-
const at = statSync2(
|
|
25255
|
-
if (!newest2 || at > newest2.at) newest2 = { path:
|
|
25254
|
+
const at = statSync2(path87).mtimeMs;
|
|
25255
|
+
if (!newest2 || at > newest2.at) newest2 = { path: path87, at };
|
|
25256
25256
|
} catch {
|
|
25257
25257
|
}
|
|
25258
25258
|
}
|
|
@@ -25260,11 +25260,11 @@ function findRollout(threadId) {
|
|
|
25260
25260
|
return newest2?.path;
|
|
25261
25261
|
}
|
|
25262
25262
|
function readCodexRunFacts(threadId) {
|
|
25263
|
-
const
|
|
25264
|
-
if (!
|
|
25263
|
+
const path87 = findRollout(threadId);
|
|
25264
|
+
if (!path87) return void 0;
|
|
25265
25265
|
let raw;
|
|
25266
25266
|
try {
|
|
25267
|
-
raw = readFileSync2(
|
|
25267
|
+
raw = readFileSync2(path87, "utf8");
|
|
25268
25268
|
} catch {
|
|
25269
25269
|
return void 0;
|
|
25270
25270
|
}
|
|
@@ -25390,8 +25390,8 @@ function renderCompleted(item) {
|
|
|
25390
25390
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
25391
25391
|
return changes.map((raw) => {
|
|
25392
25392
|
const change2 = obj2(raw);
|
|
25393
|
-
const
|
|
25394
|
-
return
|
|
25393
|
+
const path87 = str2(change2.path);
|
|
25394
|
+
return path87 ? `\u23FA ${str2(change2.kind) || "change"}(${path87})
|
|
25395
25395
|
` : "";
|
|
25396
25396
|
}).join("");
|
|
25397
25397
|
}
|
|
@@ -25729,10 +25729,10 @@ function readKimiRunFacts(sessionId) {
|
|
|
25729
25729
|
const total = { input: 0, cacheCreation: 0, cacheRead: 0, output: 0 };
|
|
25730
25730
|
let model;
|
|
25731
25731
|
let holding = 0;
|
|
25732
|
-
for (const { path:
|
|
25732
|
+
for (const { path: path87, main } of wireFiles(entry.sessionDir)) {
|
|
25733
25733
|
let raw;
|
|
25734
25734
|
try {
|
|
25735
|
-
raw = readFileSync3(
|
|
25735
|
+
raw = readFileSync3(path87, "utf8");
|
|
25736
25736
|
} catch {
|
|
25737
25737
|
continue;
|
|
25738
25738
|
}
|
|
@@ -26109,8 +26109,8 @@ var init_tail = __esm({
|
|
|
26109
26109
|
import fs22 from "node:fs";
|
|
26110
26110
|
function whereHint(update2, title) {
|
|
26111
26111
|
const locations = Array.isArray(update2.locations) ? update2.locations : [];
|
|
26112
|
-
const
|
|
26113
|
-
return
|
|
26112
|
+
const path87 = str2(obj2(locations[0]).path);
|
|
26113
|
+
return path87 && !title.includes(path87) ? hint(path87) : "";
|
|
26114
26114
|
}
|
|
26115
26115
|
function saidBy(update2) {
|
|
26116
26116
|
const content = Array.isArray(update2.content) ? update2.content : [];
|
|
@@ -27305,7 +27305,7 @@ async function run(io, options, count3) {
|
|
|
27305
27305
|
startupTimer = setTimeout(() => {
|
|
27306
27306
|
if (!started) io.event?.({ kind: "log", data: { text: "[conversation] start_unconfirmed" } });
|
|
27307
27307
|
}, CONVERSATION_MS.start);
|
|
27308
|
-
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text5 }, ...images.map((
|
|
27308
|
+
await bounded(rpc.call("turn/start", { threadId, input: [{ type: "text", text: text5 }, ...images.map((path87) => ({ type: "localImage", path: path87 }))] }), CONVERSATION_MS.start, "Codex turn/start timed out; submission outcome is unknown.").catch((error62) => {
|
|
27309
27309
|
if (!started) throw error62;
|
|
27310
27310
|
});
|
|
27311
27311
|
};
|
|
@@ -29648,18 +29648,18 @@ var init_file_limits = __esm({
|
|
|
29648
29648
|
});
|
|
29649
29649
|
|
|
29650
29650
|
// src/lib/shared/board-files.ts
|
|
29651
|
-
function isBoardPath(
|
|
29652
|
-
if (!
|
|
29653
|
-
if (
|
|
29654
|
-
if (
|
|
29655
|
-
if (
|
|
29656
|
-
if (SETTINGS.includes(
|
|
29657
|
-
if (
|
|
29658
|
-
if (
|
|
29659
|
-
return ROOTS.some((root2) =>
|
|
29660
|
-
}
|
|
29661
|
-
function numberOfCard(
|
|
29662
|
-
const n = ROOT.exec(
|
|
29651
|
+
function isBoardPath(path87) {
|
|
29652
|
+
if (!path87 || path87.length > 500 || path87.startsWith("/") || path87.includes("\\") || path87.includes("\0")) return false;
|
|
29653
|
+
if (path87.split("/").some((part) => !part || part === "." || part === "..")) return false;
|
|
29654
|
+
if (path87 === "todo/README.md" || path87.split("/").includes(".sync")) return false;
|
|
29655
|
+
if (path87.startsWith("studios/")) return true;
|
|
29656
|
+
if (SETTINGS.includes(path87)) return true;
|
|
29657
|
+
if (path87.startsWith("rules/")) return isSettingsPath(path87);
|
|
29658
|
+
if (path87.startsWith("assets/")) return taskOfAssets(path87) !== null;
|
|
29659
|
+
return ROOTS.some((root2) => path87.startsWith(root2)) && path87.endsWith(".md");
|
|
29660
|
+
}
|
|
29661
|
+
function numberOfCard(path87) {
|
|
29662
|
+
const n = ROOT.exec(path87)?.[1] ?? CARD.exec(path87)?.[1];
|
|
29663
29663
|
return n ? Number(n) : null;
|
|
29664
29664
|
}
|
|
29665
29665
|
var ROOTS, SETTINGS, isSettingsPath, CARD, ROOT, assetsFile, taskOfAssets, studioFolder, studioName;
|
|
@@ -29669,11 +29669,11 @@ var init_board_files = __esm({
|
|
|
29669
29669
|
init_file_limits();
|
|
29670
29670
|
ROOTS = ["todo/", ".archive/", "memory/", "studios/", "triage/", "assets/", "rules/"];
|
|
29671
29671
|
SETTINGS = ["modules.md", "config.md"];
|
|
29672
|
-
isSettingsPath = (
|
|
29672
|
+
isSettingsPath = (path87) => SETTINGS.includes(path87) || /^rules\/(?:studios\/[^/]+|proposer|project-writer|dismissal-reviewer|memory-pruner)\.md$/.test(path87);
|
|
29673
29673
|
CARD = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]*\.md$/;
|
|
29674
29674
|
ROOT = /^(?:todo|\.archive)\/(?:[^/]+\/)*(\d+)-[^/]+\/root\.md$/;
|
|
29675
29675
|
assetsFile = (task) => `assets/${task}.json`;
|
|
29676
|
-
taskOfAssets = (
|
|
29676
|
+
taskOfAssets = (path87) => /^assets\/(task_[0-9a-f]+)\.json$/.exec(path87)?.[1] ?? null;
|
|
29677
29677
|
studioFolder = (id2) => id2.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
29678
29678
|
studioName = (id2) => id2.startsWith("wf_builtin_") ? id2.slice("wf_builtin_".length).replace(/_/g, "-") : studioFolder(id2);
|
|
29679
29679
|
}
|
|
@@ -32896,8 +32896,8 @@ var require_utils = __commonJS({
|
|
|
32896
32896
|
}
|
|
32897
32897
|
return ind;
|
|
32898
32898
|
}
|
|
32899
|
-
function removeDotSegments(
|
|
32900
|
-
let input2 =
|
|
32899
|
+
function removeDotSegments(path87) {
|
|
32900
|
+
let input2 = path87;
|
|
32901
32901
|
const output2 = [];
|
|
32902
32902
|
let nextSlash = -1;
|
|
32903
32903
|
let len = 0;
|
|
@@ -32971,11 +32971,11 @@ var require_utils = __commonJS({
|
|
|
32971
32971
|
}
|
|
32972
32972
|
return output2.join("");
|
|
32973
32973
|
}
|
|
32974
|
-
function removeDotSegmentsRelative(
|
|
32975
|
-
if (
|
|
32976
|
-
return removeDotSegments(
|
|
32974
|
+
function removeDotSegmentsRelative(path87) {
|
|
32975
|
+
if (path87 === "" || path87[0] === "/") {
|
|
32976
|
+
return removeDotSegments(path87);
|
|
32977
32977
|
}
|
|
32978
|
-
const segments =
|
|
32978
|
+
const segments = path87.split("/");
|
|
32979
32979
|
const last = segments.length - 1;
|
|
32980
32980
|
const output2 = [];
|
|
32981
32981
|
let trailingDirectory = false;
|
|
@@ -33338,8 +33338,8 @@ var require_schemes = __commonJS({
|
|
|
33338
33338
|
}
|
|
33339
33339
|
if (wsComponent.resourceName) {
|
|
33340
33340
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
33341
|
-
const
|
|
33342
|
-
wsComponent.path =
|
|
33341
|
+
const path87 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
33342
|
+
wsComponent.path = path87 && path87 !== "/" ? path87 : void 0;
|
|
33343
33343
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
33344
33344
|
wsComponent.resourceName = void 0;
|
|
33345
33345
|
}
|
|
@@ -36499,17 +36499,17 @@ var require_visit = __commonJS({
|
|
|
36499
36499
|
visit2.BREAK = BREAK;
|
|
36500
36500
|
visit2.SKIP = SKIP;
|
|
36501
36501
|
visit2.REMOVE = REMOVE;
|
|
36502
|
-
function visit_(key, node2, visitor,
|
|
36503
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
36502
|
+
function visit_(key, node2, visitor, path87) {
|
|
36503
|
+
const ctrl = callVisitor(key, node2, visitor, path87);
|
|
36504
36504
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
36505
|
-
replaceNode(key,
|
|
36506
|
-
return visit_(key, ctrl, visitor,
|
|
36505
|
+
replaceNode(key, path87, ctrl);
|
|
36506
|
+
return visit_(key, ctrl, visitor, path87);
|
|
36507
36507
|
}
|
|
36508
36508
|
if (typeof ctrl !== "symbol") {
|
|
36509
36509
|
if (identity.isCollection(node2)) {
|
|
36510
|
-
|
|
36510
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
36511
36511
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
36512
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
36512
|
+
const ci = visit_(i, node2.items[i], visitor, path87);
|
|
36513
36513
|
if (typeof ci === "number")
|
|
36514
36514
|
i = ci - 1;
|
|
36515
36515
|
else if (ci === BREAK)
|
|
@@ -36520,13 +36520,13 @@ var require_visit = __commonJS({
|
|
|
36520
36520
|
}
|
|
36521
36521
|
}
|
|
36522
36522
|
} else if (identity.isPair(node2)) {
|
|
36523
|
-
|
|
36524
|
-
const ck = visit_("key", node2.key, visitor,
|
|
36523
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
36524
|
+
const ck = visit_("key", node2.key, visitor, path87);
|
|
36525
36525
|
if (ck === BREAK)
|
|
36526
36526
|
return BREAK;
|
|
36527
36527
|
else if (ck === REMOVE)
|
|
36528
36528
|
node2.key = null;
|
|
36529
|
-
const cv = visit_("value", node2.value, visitor,
|
|
36529
|
+
const cv = visit_("value", node2.value, visitor, path87);
|
|
36530
36530
|
if (cv === BREAK)
|
|
36531
36531
|
return BREAK;
|
|
36532
36532
|
else if (cv === REMOVE)
|
|
@@ -36547,17 +36547,17 @@ var require_visit = __commonJS({
|
|
|
36547
36547
|
visitAsync.BREAK = BREAK;
|
|
36548
36548
|
visitAsync.SKIP = SKIP;
|
|
36549
36549
|
visitAsync.REMOVE = REMOVE;
|
|
36550
|
-
async function visitAsync_(key, node2, visitor,
|
|
36551
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
36550
|
+
async function visitAsync_(key, node2, visitor, path87) {
|
|
36551
|
+
const ctrl = await callVisitor(key, node2, visitor, path87);
|
|
36552
36552
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
36553
|
-
replaceNode(key,
|
|
36554
|
-
return visitAsync_(key, ctrl, visitor,
|
|
36553
|
+
replaceNode(key, path87, ctrl);
|
|
36554
|
+
return visitAsync_(key, ctrl, visitor, path87);
|
|
36555
36555
|
}
|
|
36556
36556
|
if (typeof ctrl !== "symbol") {
|
|
36557
36557
|
if (identity.isCollection(node2)) {
|
|
36558
|
-
|
|
36558
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
36559
36559
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
36560
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
36560
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path87);
|
|
36561
36561
|
if (typeof ci === "number")
|
|
36562
36562
|
i = ci - 1;
|
|
36563
36563
|
else if (ci === BREAK)
|
|
@@ -36568,13 +36568,13 @@ var require_visit = __commonJS({
|
|
|
36568
36568
|
}
|
|
36569
36569
|
}
|
|
36570
36570
|
} else if (identity.isPair(node2)) {
|
|
36571
|
-
|
|
36572
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
36571
|
+
path87 = Object.freeze(path87.concat(node2));
|
|
36572
|
+
const ck = await visitAsync_("key", node2.key, visitor, path87);
|
|
36573
36573
|
if (ck === BREAK)
|
|
36574
36574
|
return BREAK;
|
|
36575
36575
|
else if (ck === REMOVE)
|
|
36576
36576
|
node2.key = null;
|
|
36577
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
36577
|
+
const cv = await visitAsync_("value", node2.value, visitor, path87);
|
|
36578
36578
|
if (cv === BREAK)
|
|
36579
36579
|
return BREAK;
|
|
36580
36580
|
else if (cv === REMOVE)
|
|
@@ -36601,23 +36601,23 @@ var require_visit = __commonJS({
|
|
|
36601
36601
|
}
|
|
36602
36602
|
return visitor;
|
|
36603
36603
|
}
|
|
36604
|
-
function callVisitor(key, node2, visitor,
|
|
36604
|
+
function callVisitor(key, node2, visitor, path87) {
|
|
36605
36605
|
if (typeof visitor === "function")
|
|
36606
|
-
return visitor(key, node2,
|
|
36606
|
+
return visitor(key, node2, path87);
|
|
36607
36607
|
if (identity.isMap(node2))
|
|
36608
|
-
return visitor.Map?.(key, node2,
|
|
36608
|
+
return visitor.Map?.(key, node2, path87);
|
|
36609
36609
|
if (identity.isSeq(node2))
|
|
36610
|
-
return visitor.Seq?.(key, node2,
|
|
36610
|
+
return visitor.Seq?.(key, node2, path87);
|
|
36611
36611
|
if (identity.isPair(node2))
|
|
36612
|
-
return visitor.Pair?.(key, node2,
|
|
36612
|
+
return visitor.Pair?.(key, node2, path87);
|
|
36613
36613
|
if (identity.isScalar(node2))
|
|
36614
|
-
return visitor.Scalar?.(key, node2,
|
|
36614
|
+
return visitor.Scalar?.(key, node2, path87);
|
|
36615
36615
|
if (identity.isAlias(node2))
|
|
36616
|
-
return visitor.Alias?.(key, node2,
|
|
36616
|
+
return visitor.Alias?.(key, node2, path87);
|
|
36617
36617
|
return void 0;
|
|
36618
36618
|
}
|
|
36619
|
-
function replaceNode(key,
|
|
36620
|
-
const parent =
|
|
36619
|
+
function replaceNode(key, path87, node2) {
|
|
36620
|
+
const parent = path87[path87.length - 1];
|
|
36621
36621
|
if (identity.isCollection(parent)) {
|
|
36622
36622
|
parent.items[key] = node2;
|
|
36623
36623
|
} else if (identity.isPair(parent)) {
|
|
@@ -37229,10 +37229,10 @@ var require_Collection = __commonJS({
|
|
|
37229
37229
|
var createNode = require_createNode();
|
|
37230
37230
|
var identity = require_identity();
|
|
37231
37231
|
var Node = require_Node();
|
|
37232
|
-
function collectionFromPath(schema,
|
|
37232
|
+
function collectionFromPath(schema, path87, value) {
|
|
37233
37233
|
let v = value;
|
|
37234
|
-
for (let i =
|
|
37235
|
-
const k =
|
|
37234
|
+
for (let i = path87.length - 1; i >= 0; --i) {
|
|
37235
|
+
const k = path87[i];
|
|
37236
37236
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
37237
37237
|
const a = [];
|
|
37238
37238
|
a[k] = v;
|
|
@@ -37251,7 +37251,7 @@ var require_Collection = __commonJS({
|
|
|
37251
37251
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
37252
37252
|
});
|
|
37253
37253
|
}
|
|
37254
|
-
var isEmptyPath = (
|
|
37254
|
+
var isEmptyPath = (path87) => path87 == null || typeof path87 === "object" && !!path87[Symbol.iterator]().next().done;
|
|
37255
37255
|
var Collection = class extends Node.NodeBase {
|
|
37256
37256
|
constructor(type, schema) {
|
|
37257
37257
|
super(type);
|
|
@@ -37281,11 +37281,11 @@ var require_Collection = __commonJS({
|
|
|
37281
37281
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
37282
37282
|
* that already exists in the map.
|
|
37283
37283
|
*/
|
|
37284
|
-
addIn(
|
|
37285
|
-
if (isEmptyPath(
|
|
37284
|
+
addIn(path87, value) {
|
|
37285
|
+
if (isEmptyPath(path87))
|
|
37286
37286
|
this.add(value);
|
|
37287
37287
|
else {
|
|
37288
|
-
const [key, ...rest] =
|
|
37288
|
+
const [key, ...rest] = path87;
|
|
37289
37289
|
const node2 = this.get(key, true);
|
|
37290
37290
|
if (identity.isCollection(node2))
|
|
37291
37291
|
node2.addIn(rest, value);
|
|
@@ -37299,8 +37299,8 @@ var require_Collection = __commonJS({
|
|
|
37299
37299
|
* Removes a value from the collection.
|
|
37300
37300
|
* @returns `true` if the item was found and removed.
|
|
37301
37301
|
*/
|
|
37302
|
-
deleteIn(
|
|
37303
|
-
const [key, ...rest] =
|
|
37302
|
+
deleteIn(path87) {
|
|
37303
|
+
const [key, ...rest] = path87;
|
|
37304
37304
|
if (rest.length === 0)
|
|
37305
37305
|
return this.delete(key);
|
|
37306
37306
|
const node2 = this.get(key, true);
|
|
@@ -37314,8 +37314,8 @@ var require_Collection = __commonJS({
|
|
|
37314
37314
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
37315
37315
|
* `true` (collections are always returned intact).
|
|
37316
37316
|
*/
|
|
37317
|
-
getIn(
|
|
37318
|
-
const [key, ...rest] =
|
|
37317
|
+
getIn(path87, keepScalar) {
|
|
37318
|
+
const [key, ...rest] = path87;
|
|
37319
37319
|
const node2 = this.get(key, true);
|
|
37320
37320
|
if (rest.length === 0)
|
|
37321
37321
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -37333,8 +37333,8 @@ var require_Collection = __commonJS({
|
|
|
37333
37333
|
/**
|
|
37334
37334
|
* Checks if the collection includes a value with the key `key`.
|
|
37335
37335
|
*/
|
|
37336
|
-
hasIn(
|
|
37337
|
-
const [key, ...rest] =
|
|
37336
|
+
hasIn(path87) {
|
|
37337
|
+
const [key, ...rest] = path87;
|
|
37338
37338
|
if (rest.length === 0)
|
|
37339
37339
|
return this.has(key);
|
|
37340
37340
|
const node2 = this.get(key, true);
|
|
@@ -37344,8 +37344,8 @@ var require_Collection = __commonJS({
|
|
|
37344
37344
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
37345
37345
|
* boolean to add/remove the item from the set.
|
|
37346
37346
|
*/
|
|
37347
|
-
setIn(
|
|
37348
|
-
const [key, ...rest] =
|
|
37347
|
+
setIn(path87, value) {
|
|
37348
|
+
const [key, ...rest] = path87;
|
|
37349
37349
|
if (rest.length === 0) {
|
|
37350
37350
|
this.set(key, value);
|
|
37351
37351
|
} else {
|
|
@@ -39860,9 +39860,9 @@ var require_Document = __commonJS({
|
|
|
39860
39860
|
this.contents.add(value);
|
|
39861
39861
|
}
|
|
39862
39862
|
/** Adds a value to the document. */
|
|
39863
|
-
addIn(
|
|
39863
|
+
addIn(path87, value) {
|
|
39864
39864
|
if (assertCollection(this.contents))
|
|
39865
|
-
this.contents.addIn(
|
|
39865
|
+
this.contents.addIn(path87, value);
|
|
39866
39866
|
}
|
|
39867
39867
|
/**
|
|
39868
39868
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -39937,14 +39937,14 @@ var require_Document = __commonJS({
|
|
|
39937
39937
|
* Removes a value from the document.
|
|
39938
39938
|
* @returns `true` if the item was found and removed.
|
|
39939
39939
|
*/
|
|
39940
|
-
deleteIn(
|
|
39941
|
-
if (Collection.isEmptyPath(
|
|
39940
|
+
deleteIn(path87) {
|
|
39941
|
+
if (Collection.isEmptyPath(path87)) {
|
|
39942
39942
|
if (this.contents == null)
|
|
39943
39943
|
return false;
|
|
39944
39944
|
this.contents = null;
|
|
39945
39945
|
return true;
|
|
39946
39946
|
}
|
|
39947
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
39947
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path87) : false;
|
|
39948
39948
|
}
|
|
39949
39949
|
/**
|
|
39950
39950
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -39959,10 +39959,10 @@ var require_Document = __commonJS({
|
|
|
39959
39959
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
39960
39960
|
* `true` (collections are always returned intact).
|
|
39961
39961
|
*/
|
|
39962
|
-
getIn(
|
|
39963
|
-
if (Collection.isEmptyPath(
|
|
39962
|
+
getIn(path87, keepScalar) {
|
|
39963
|
+
if (Collection.isEmptyPath(path87))
|
|
39964
39964
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
39965
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
39965
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path87, keepScalar) : void 0;
|
|
39966
39966
|
}
|
|
39967
39967
|
/**
|
|
39968
39968
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -39973,10 +39973,10 @@ var require_Document = __commonJS({
|
|
|
39973
39973
|
/**
|
|
39974
39974
|
* Checks if the document includes a value at `path`.
|
|
39975
39975
|
*/
|
|
39976
|
-
hasIn(
|
|
39977
|
-
if (Collection.isEmptyPath(
|
|
39976
|
+
hasIn(path87) {
|
|
39977
|
+
if (Collection.isEmptyPath(path87))
|
|
39978
39978
|
return this.contents !== void 0;
|
|
39979
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
39979
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path87) : false;
|
|
39980
39980
|
}
|
|
39981
39981
|
/**
|
|
39982
39982
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -39993,13 +39993,13 @@ var require_Document = __commonJS({
|
|
|
39993
39993
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
39994
39994
|
* boolean to add/remove the item from the set.
|
|
39995
39995
|
*/
|
|
39996
|
-
setIn(
|
|
39997
|
-
if (Collection.isEmptyPath(
|
|
39996
|
+
setIn(path87, value) {
|
|
39997
|
+
if (Collection.isEmptyPath(path87)) {
|
|
39998
39998
|
this.contents = value;
|
|
39999
39999
|
} else if (this.contents == null) {
|
|
40000
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
40000
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path87), value);
|
|
40001
40001
|
} else if (assertCollection(this.contents)) {
|
|
40002
|
-
this.contents.setIn(
|
|
40002
|
+
this.contents.setIn(path87, value);
|
|
40003
40003
|
}
|
|
40004
40004
|
}
|
|
40005
40005
|
/**
|
|
@@ -41960,9 +41960,9 @@ var require_cst_visit = __commonJS({
|
|
|
41960
41960
|
visit2.BREAK = BREAK;
|
|
41961
41961
|
visit2.SKIP = SKIP;
|
|
41962
41962
|
visit2.REMOVE = REMOVE;
|
|
41963
|
-
visit2.itemAtPath = (cst,
|
|
41963
|
+
visit2.itemAtPath = (cst, path87) => {
|
|
41964
41964
|
let item = cst;
|
|
41965
|
-
for (const [field2, index] of
|
|
41965
|
+
for (const [field2, index] of path87) {
|
|
41966
41966
|
const tok = item?.[field2];
|
|
41967
41967
|
if (tok && "items" in tok) {
|
|
41968
41968
|
item = tok.items[index];
|
|
@@ -41971,23 +41971,23 @@ var require_cst_visit = __commonJS({
|
|
|
41971
41971
|
}
|
|
41972
41972
|
return item;
|
|
41973
41973
|
};
|
|
41974
|
-
visit2.parentCollection = (cst,
|
|
41975
|
-
const parent = visit2.itemAtPath(cst,
|
|
41976
|
-
const field2 =
|
|
41974
|
+
visit2.parentCollection = (cst, path87) => {
|
|
41975
|
+
const parent = visit2.itemAtPath(cst, path87.slice(0, -1));
|
|
41976
|
+
const field2 = path87[path87.length - 1][0];
|
|
41977
41977
|
const coll = parent?.[field2];
|
|
41978
41978
|
if (coll && "items" in coll)
|
|
41979
41979
|
return coll;
|
|
41980
41980
|
throw new Error("Parent collection not found");
|
|
41981
41981
|
};
|
|
41982
|
-
function _visit(
|
|
41983
|
-
let ctrl = visitor(item,
|
|
41982
|
+
function _visit(path87, item, visitor) {
|
|
41983
|
+
let ctrl = visitor(item, path87);
|
|
41984
41984
|
if (typeof ctrl === "symbol")
|
|
41985
41985
|
return ctrl;
|
|
41986
41986
|
for (const field2 of ["key", "value"]) {
|
|
41987
41987
|
const token2 = item[field2];
|
|
41988
41988
|
if (token2 && "items" in token2) {
|
|
41989
41989
|
for (let i = 0; i < token2.items.length; ++i) {
|
|
41990
|
-
const ci = _visit(Object.freeze(
|
|
41990
|
+
const ci = _visit(Object.freeze(path87.concat([[field2, i]])), token2.items[i], visitor);
|
|
41991
41991
|
if (typeof ci === "number")
|
|
41992
41992
|
i = ci - 1;
|
|
41993
41993
|
else if (ci === BREAK)
|
|
@@ -41998,10 +41998,10 @@ var require_cst_visit = __commonJS({
|
|
|
41998
41998
|
}
|
|
41999
41999
|
}
|
|
42000
42000
|
if (typeof ctrl === "function" && field2 === "key")
|
|
42001
|
-
ctrl = ctrl(item,
|
|
42001
|
+
ctrl = ctrl(item, path87);
|
|
42002
42002
|
}
|
|
42003
42003
|
}
|
|
42004
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
42004
|
+
return typeof ctrl === "function" ? ctrl(item, path87) : ctrl;
|
|
42005
42005
|
}
|
|
42006
42006
|
exports.visit = visit2;
|
|
42007
42007
|
}
|
|
@@ -43863,7 +43863,7 @@ function landSections(body, previews) {
|
|
|
43863
43863
|
}
|
|
43864
43864
|
function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requireLand = false } = {}) {
|
|
43865
43865
|
const problems = [];
|
|
43866
|
-
const fail = (offset,
|
|
43866
|
+
const fail = (offset, path87, code, message, hint2) => problems.push({ file: from, ...sourcePosition(source2, offset), path: path87, code, message, hint: hint2 });
|
|
43867
43867
|
const result = () => ({ problem: problems.map((p) => `${p.file}:${p.line}:${p.column} ${p.path}: ${p.code} \u2014 ${p.message}. ${p.hint}`).join("\n"), problems });
|
|
43868
43868
|
if (!STUDIO_ID.test(id2)) fail(0, "id", "studio-schema", `Invalid Studio ID ${id2}`, "Use lowercase letters, digits and dashes.");
|
|
43869
43869
|
const front = /^---\r?\n([^]*?)\r?\n---(?:\r?\n|$)/.exec(source2);
|
|
@@ -43934,6 +43934,8 @@ function parseStudioFile(id2, source2, from, { requirePreviewCopy = false, requi
|
|
|
43934
43934
|
...raw.names ? { names: raw.names } : {},
|
|
43935
43935
|
description: raw.description ?? "",
|
|
43936
43936
|
needsArtifact: raw.needsArtifact ?? false,
|
|
43937
|
+
...raw.summaries ? { summaries: raw.summaries } : {},
|
|
43938
|
+
...raw.entrypoints ? { entrypoints: raw.entrypoints } : {},
|
|
43937
43939
|
...raw.icon ? { icon: raw.icon } : {},
|
|
43938
43940
|
previews: parsed.blocks.map((b) => ({ id: b.id, instructions: b.instructions, ...map3[b.id] })),
|
|
43939
43941
|
rules: rules.trim()
|
|
@@ -43968,6 +43970,8 @@ var init_studio_def = __esm({
|
|
|
43968
43970
|
name: { type: "string", minLength: 1, pattern: "\\S" },
|
|
43969
43971
|
names: titles,
|
|
43970
43972
|
description: { type: "string" },
|
|
43973
|
+
summaries: titles,
|
|
43974
|
+
entrypoints: { type: "array", minItems: 1, maxItems: 10, uniqueItems: true, items: { type: "string", pattern: PREVIEW_ID.source } },
|
|
43971
43975
|
needsArtifact: { type: "boolean" },
|
|
43972
43976
|
icon,
|
|
43973
43977
|
previews: { type: "object", propertyNames: { pattern: PREVIEW_ID.source }, additionalProperties: {
|
|
@@ -46347,10 +46351,8 @@ function landedDeliveries(filter = {}) {
|
|
|
46347
46351
|
for (const audit of allAudits()) {
|
|
46348
46352
|
const landing = audit.landing;
|
|
46349
46353
|
if (typeof audit.cardId !== "number" || landing?.status !== "landed" || !landing.commit) continue;
|
|
46350
|
-
const studio = audit.studio?.id || "coding";
|
|
46351
46354
|
if (filter.since !== void 0 && !(landing.at > filter.since)) continue;
|
|
46352
|
-
|
|
46353
|
-
out.push({ cardId: audit.cardId, title: audit.title, studio, at: landing.at, commit: landing.commit });
|
|
46355
|
+
out.push({ cardId: audit.cardId, title: audit.title, studio: audit.studio?.id ?? null, at: landing.at, commit: landing.commit });
|
|
46354
46356
|
}
|
|
46355
46357
|
return out.sort((a, b) => a.at - b.at);
|
|
46356
46358
|
}
|
|
@@ -50102,7 +50104,7 @@ function kindOf2(ext) {
|
|
|
50102
50104
|
if (type.startsWith("image/")) return "image";
|
|
50103
50105
|
return type.startsWith("video/") || type.startsWith("audio/") ? "video" : "asset";
|
|
50104
50106
|
}
|
|
50105
|
-
var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3,
|
|
50107
|
+
var STORYBOARD, STUDIO, ARRANGED, ASSET, isObject2, TAG3, bodySources, TYPES;
|
|
50106
50108
|
var init_references = __esm({
|
|
50107
50109
|
"../artifact-sdk/src/internal/references.ts"() {
|
|
50108
50110
|
"use strict";
|
|
@@ -50112,7 +50114,6 @@ var init_references = __esm({
|
|
|
50112
50114
|
ASSET = ["spritesheet", "asset"];
|
|
50113
50115
|
isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
50114
50116
|
TAG3 = /<(Asset|Mockup|Compare|Storyboard|Studio)\b([^<>]*?)\/>/g;
|
|
50115
|
-
bodyComponentTags = (body) => componentTags(visibleBody(body));
|
|
50116
50117
|
bodySources = (body) => [...new Set(bodyReferences(body).map((r) => r.src))];
|
|
50117
50118
|
TYPES = {
|
|
50118
50119
|
".png": "image/png",
|
|
@@ -50262,14 +50263,6 @@ function splitFileReference(src) {
|
|
|
50262
50263
|
const end2 = src.search(/[?#]/);
|
|
50263
50264
|
return end2 < 0 ? [src, ""] : [src.slice(0, end2), src.slice(end2)];
|
|
50264
50265
|
}
|
|
50265
|
-
function relativeFileReference(src, owner) {
|
|
50266
|
-
const parts = owner.split("/").slice(0, -1);
|
|
50267
|
-
for (const part of src.split("/")) {
|
|
50268
|
-
if (part === ".." && parts.length && parts.at(-1) !== "..") parts.pop();
|
|
50269
|
-
else if (part && part !== ".") parts.push(part);
|
|
50270
|
-
}
|
|
50271
|
-
return parts.join("/");
|
|
50272
|
-
}
|
|
50273
50266
|
var CSS, fileManifest;
|
|
50274
50267
|
var init_file_references = __esm({
|
|
50275
50268
|
"../artifact-sdk/src/internal/file-references.ts"() {
|
|
@@ -50297,14 +50290,14 @@ function collectSources(sources2, card, host2) {
|
|
|
50297
50290
|
const active3 = /* @__PURE__ */ new Set();
|
|
50298
50291
|
const out = [];
|
|
50299
50292
|
const visit2 = (src, types, owner, partial2 = false) => {
|
|
50300
|
-
const [
|
|
50293
|
+
const [path87] = splitFileReference(src);
|
|
50301
50294
|
let resolved;
|
|
50302
50295
|
try {
|
|
50303
|
-
resolved = host2.resolve(
|
|
50296
|
+
resolved = host2.resolve(path87, owner);
|
|
50304
50297
|
} catch (error62) {
|
|
50305
50298
|
if (owner !== card) return { key: null, error: why(error62) };
|
|
50306
50299
|
if (!nodes.has(src)) {
|
|
50307
|
-
const node3 = { key: src, file: null, kind: kindAt(
|
|
50300
|
+
const node3 = { key: src, file: null, kind: kindAt(path87, types), error: why(error62), problems: [], dependencies: /* @__PURE__ */ new Map(), aliases: /* @__PURE__ */ new Set([src]) };
|
|
50308
50301
|
nodes.set(src, node3);
|
|
50309
50302
|
out.push(node3);
|
|
50310
50303
|
}
|
|
@@ -51555,14 +51548,12 @@ function cmdArchived(opts) {
|
|
|
51555
51548
|
const studio = opts.studio === void 0 ? null : knownStudio(opts.studio);
|
|
51556
51549
|
const open4 = boardCardIds();
|
|
51557
51550
|
const files = archivedFiles();
|
|
51558
|
-
const cards = landedDeliveries({ since: since?.getTime()
|
|
51559
|
-
|
|
51560
|
-
|
|
51561
|
-
studio
|
|
51562
|
-
landedAt: formatStamp(new Date(d.at)),
|
|
51563
|
-
|
|
51564
|
-
file: files.has(d.cardId) ? rel(files.get(d.cardId)) : ""
|
|
51565
|
-
}));
|
|
51551
|
+
const cards = landedDeliveries({ since: since?.getTime() }).filter((d) => !open4.has(d.cardId)).flatMap((d) => {
|
|
51552
|
+
const file2 = files.get(d.cardId);
|
|
51553
|
+
const recorded = d.studio ?? (file2 ? parseFrontmatter(fs56.readFileSync(file2, "utf8")).meta?.studio || null : null);
|
|
51554
|
+
if (studio && studio !== recorded) return [];
|
|
51555
|
+
return [{ id: d.cardId, title: d.title, studio: recorded, landedAt: formatStamp(new Date(d.at)), commit: d.commit, file: file2 ? rel(file2) : "" }];
|
|
51556
|
+
});
|
|
51566
51557
|
const result = { cards, since: since ? formatStamp(since) : null, studio };
|
|
51567
51558
|
const scope = [studio ? `on studio \`${studio}\`` : "", since ? `since ${formatStamp(since)}` : ""].filter(Boolean).join(" ");
|
|
51568
51559
|
if (!cards.length) {
|
|
@@ -51573,7 +51564,7 @@ function cmdArchived(opts) {
|
|
|
51573
51564
|
for (const c of cards) {
|
|
51574
51565
|
say("");
|
|
51575
51566
|
say(`#${c.id} ${c.title}${c.file ? ` (${c.file})` : ""}`);
|
|
51576
|
-
say(` ${c.studio} \xB7 landed ${c.landedAt} \xB7 commit ${c.commit}`);
|
|
51567
|
+
say(` ${c.studio ? `${c.studio} \xB7 ` : ""}landed ${c.landedAt} \xB7 commit ${c.commit}`);
|
|
51577
51568
|
}
|
|
51578
51569
|
return result;
|
|
51579
51570
|
}
|
|
@@ -53988,7 +53979,7 @@ var require_command = __commonJS({
|
|
|
53988
53979
|
"node_modules/commander/lib/command.js"(exports) {
|
|
53989
53980
|
var EventEmitter = __require("node:events").EventEmitter;
|
|
53990
53981
|
var childProcess = __require("node:child_process");
|
|
53991
|
-
var
|
|
53982
|
+
var path87 = __require("node:path");
|
|
53992
53983
|
var fs91 = __require("node:fs");
|
|
53993
53984
|
var process2 = __require("node:process");
|
|
53994
53985
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -54988,9 +54979,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
54988
54979
|
let launchWithNode = false;
|
|
54989
54980
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
54990
54981
|
function findFile(baseDir, baseName) {
|
|
54991
|
-
const localBin =
|
|
54982
|
+
const localBin = path87.resolve(baseDir, baseName);
|
|
54992
54983
|
if (fs91.existsSync(localBin)) return localBin;
|
|
54993
|
-
if (sourceExt.includes(
|
|
54984
|
+
if (sourceExt.includes(path87.extname(baseName))) return void 0;
|
|
54994
54985
|
const foundExt = sourceExt.find(
|
|
54995
54986
|
(ext) => fs91.existsSync(`${localBin}${ext}`)
|
|
54996
54987
|
);
|
|
@@ -55008,17 +54999,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55008
54999
|
} catch {
|
|
55009
55000
|
resolvedScriptPath = this._scriptPath;
|
|
55010
55001
|
}
|
|
55011
|
-
executableDir =
|
|
55012
|
-
|
|
55002
|
+
executableDir = path87.resolve(
|
|
55003
|
+
path87.dirname(resolvedScriptPath),
|
|
55013
55004
|
executableDir
|
|
55014
55005
|
);
|
|
55015
55006
|
}
|
|
55016
55007
|
if (executableDir) {
|
|
55017
55008
|
let localFile = findFile(executableDir, executableFile);
|
|
55018
55009
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
55019
|
-
const legacyName =
|
|
55010
|
+
const legacyName = path87.basename(
|
|
55020
55011
|
this._scriptPath,
|
|
55021
|
-
|
|
55012
|
+
path87.extname(this._scriptPath)
|
|
55022
55013
|
);
|
|
55023
55014
|
if (legacyName !== this._name) {
|
|
55024
55015
|
localFile = findFile(
|
|
@@ -55029,7 +55020,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55029
55020
|
}
|
|
55030
55021
|
executableFile = localFile || executableFile;
|
|
55031
55022
|
}
|
|
55032
|
-
launchWithNode = sourceExt.includes(
|
|
55023
|
+
launchWithNode = sourceExt.includes(path87.extname(executableFile));
|
|
55033
55024
|
let proc;
|
|
55034
55025
|
if (process2.platform !== "win32") {
|
|
55035
55026
|
if (launchWithNode) {
|
|
@@ -55876,7 +55867,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55876
55867
|
* @return {Command}
|
|
55877
55868
|
*/
|
|
55878
55869
|
nameFromFilename(filename) {
|
|
55879
|
-
this._name =
|
|
55870
|
+
this._name = path87.basename(filename, path87.extname(filename));
|
|
55880
55871
|
return this;
|
|
55881
55872
|
}
|
|
55882
55873
|
/**
|
|
@@ -55890,9 +55881,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
55890
55881
|
* @param {string} [path]
|
|
55891
55882
|
* @return {(string|null|Command)}
|
|
55892
55883
|
*/
|
|
55893
|
-
executableDir(
|
|
55894
|
-
if (
|
|
55895
|
-
this._executableDir =
|
|
55884
|
+
executableDir(path88) {
|
|
55885
|
+
if (path88 === void 0) return this._executableDir;
|
|
55886
|
+
this._executableDir = path88;
|
|
55896
55887
|
return this;
|
|
55897
55888
|
}
|
|
55898
55889
|
/**
|
|
@@ -57082,8 +57073,8 @@ function prose(box) {
|
|
|
57082
57073
|
if (box.warnings.length) out.warnings = box.warnings;
|
|
57083
57074
|
return out;
|
|
57084
57075
|
}
|
|
57085
|
-
function answer(
|
|
57086
|
-
process.stdout.write(JSON.stringify(
|
|
57076
|
+
function answer(object2) {
|
|
57077
|
+
process.stdout.write(JSON.stringify(object2) + "\n");
|
|
57087
57078
|
}
|
|
57088
57079
|
function report(err, { program: program2, json: json2, box = null }) {
|
|
57089
57080
|
if (!(err instanceof BoardError)) {
|
|
@@ -63425,6 +63416,11 @@ function publicationFiles(dir) {
|
|
|
63425
63416
|
return checked.files;
|
|
63426
63417
|
}
|
|
63427
63418
|
async function publishFolder(dir, route2, body, requestId) {
|
|
63419
|
+
const context = taskReviewContext();
|
|
63420
|
+
const task = workspaceTask();
|
|
63421
|
+
if (task && context && reviewAllows(reviewAuthorization(context.review, context.assigned), "implement")) {
|
|
63422
|
+
body = { ...body, source_task: task };
|
|
63423
|
+
}
|
|
63428
63424
|
const pendingFile = path76.join(dir, ".publication.json");
|
|
63429
63425
|
const hash3 = crypto7.createHash("sha256").update(JSON.stringify({ route: route2, files: body.files, workspace: body.workspace })).digest("hex");
|
|
63430
63426
|
let held4;
|
|
@@ -63577,6 +63573,8 @@ var init_studio3 = __esm({
|
|
|
63577
63573
|
init_board_files();
|
|
63578
63574
|
init_tasks();
|
|
63579
63575
|
init_response();
|
|
63576
|
+
init_env();
|
|
63577
|
+
init_review_plan();
|
|
63580
63578
|
found = (id2) => {
|
|
63581
63579
|
const flow = studioById(id2);
|
|
63582
63580
|
if (!flow) {
|
|
@@ -64695,170 +64693,6 @@ var init_refine2 = __esm({
|
|
|
64695
64693
|
}
|
|
64696
64694
|
});
|
|
64697
64695
|
|
|
64698
|
-
// ../artifact-sdk/src/internal/tags.ts
|
|
64699
|
-
function variantsOf(raw, src) {
|
|
64700
|
-
if (!raw) return [];
|
|
64701
|
-
let parsed;
|
|
64702
|
-
try {
|
|
64703
|
-
parsed = JSON.parse(raw);
|
|
64704
|
-
} catch {
|
|
64705
|
-
return [];
|
|
64706
|
-
}
|
|
64707
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return [];
|
|
64708
|
-
const list3 = Object.entries(parsed).filter((e) => typeof e[1] === "string" && !!e[1]);
|
|
64709
|
-
if (list3.length < 2 || !list3.some(([, s]) => s === src)) return [];
|
|
64710
|
-
return list3.map(([label2, s]) => ({ label: label2, src: s }));
|
|
64711
|
-
}
|
|
64712
|
-
var init_tags = __esm({
|
|
64713
|
-
"../artifact-sdk/src/internal/tags.ts"() {
|
|
64714
|
-
"use strict";
|
|
64715
|
-
}
|
|
64716
|
-
});
|
|
64717
|
-
|
|
64718
|
-
// src/lib/shared/coding-previews.ts
|
|
64719
|
-
var CODING_PREVIEWS;
|
|
64720
|
-
var init_coding_previews = __esm({
|
|
64721
|
-
"src/lib/shared/coding-previews.ts"() {
|
|
64722
|
-
"use strict";
|
|
64723
|
-
CODING_PREVIEWS = {
|
|
64724
|
-
"tech-stack-advisor": "tech-choices",
|
|
64725
|
-
"email-planner": "emails",
|
|
64726
|
-
"ui-designer": "ui-design",
|
|
64727
|
-
"api-designer": "api-docs",
|
|
64728
|
-
"schema-designer": "schema",
|
|
64729
|
-
"prompt-writer": "prompts",
|
|
64730
|
-
"competitor-research": "competitor-research"
|
|
64731
|
-
};
|
|
64732
|
-
}
|
|
64733
|
-
});
|
|
64734
|
-
|
|
64735
|
-
// src/lib/agent/approved-ui.ts
|
|
64736
|
-
import path81 from "node:path";
|
|
64737
|
-
function approvedUiSource(pins, src, owner) {
|
|
64738
|
-
const [ref] = splitFileReference(src);
|
|
64739
|
-
if (artifactId.test(ref)) {
|
|
64740
|
-
const version2 = approvedUiPin(pins, ref).version;
|
|
64741
|
-
const names2 = Object.keys(pins).filter((name) => {
|
|
64742
|
-
const pin = approvedUiPin(pins, name);
|
|
64743
|
-
return pin.artifact === ref && (version2 === void 0 || pin.version === version2);
|
|
64744
|
-
});
|
|
64745
|
-
return names2.find((name) => !artifactId.test(name)) ?? names2[0] ?? ref;
|
|
64746
|
-
}
|
|
64747
|
-
const local = owner && !ref.startsWith(".assets/") ? relativeFileReference(ref, owner) : ref;
|
|
64748
|
-
return [local, src, ref, path81.posix.normalize(local)].find((key) => Object.hasOwn(pins, key)) ?? local;
|
|
64749
|
-
}
|
|
64750
|
-
function approvedUiPin(pins, source2) {
|
|
64751
|
-
return object2(Object.hasOwn(pins, source2) ? pins[source2] : void 0);
|
|
64752
|
-
}
|
|
64753
|
-
function validUiPin(pin) {
|
|
64754
|
-
return !pin.error && pin.status !== "pending" && pin.status !== "failed" && typeof pin.artifact === "string" && artifactId.test(pin.artifact) && typeof pin.version === "number" && Number.isSafeInteger(pin.version) && pin.version > 0;
|
|
64755
|
-
}
|
|
64756
|
-
function approvedUiPreviews(review) {
|
|
64757
|
-
if (reviewAuthorization(review).kind !== "delivery") return [];
|
|
64758
|
-
const result = [];
|
|
64759
|
-
for (const [index, node2] of (review.plan ?? []).entries()) {
|
|
64760
|
-
const stage = review.stages.find((stage2) => stage2.id === node2.id);
|
|
64761
|
-
const snapshot2 = stage?.snapshot;
|
|
64762
|
-
if (node2.kind === "work" || !stage || !snapshot2) continue;
|
|
64763
|
-
const evidence = object2(snapshot2.evidence);
|
|
64764
|
-
const content = object2(evidence.content);
|
|
64765
|
-
const frozenPreviews = Array.isArray(snapshot2.previews) ? snapshot2.previews.filter(isObject2) : [];
|
|
64766
|
-
for (const id2 of node2.previews.filter((id3) => id3 === UI_PREVIEW || historicalUiIds.includes(id3))) {
|
|
64767
|
-
const preview = object2(content[id2]);
|
|
64768
|
-
const body = typeof preview.body === "string" ? preview.body : typeof snapshot2.body === "string" ? parsePreviewBlocks(snapshot2.body).blocks.find((block) => block.id === id2)?.instructions : void 0;
|
|
64769
|
-
if (!body) continue;
|
|
64770
|
-
const pins = { ...object2(evidence.dependencies), ...object2(frozenPreviews.find((preview2) => preview2.id === id2)?.assets), ...object2(evidence.assets) };
|
|
64771
|
-
const files = /* @__PURE__ */ new Map();
|
|
64772
|
-
const add2 = (src, label2, device, required2 = true) => {
|
|
64773
|
-
if (external.test(src)) return;
|
|
64774
|
-
const source2 = approvedUiSource(pins, src);
|
|
64775
|
-
if (!required2 && !Object.hasOwn(pins, source2) && !/\.(?:html?|tsx)$/i.test(source2)) return;
|
|
64776
|
-
const name = label2.trim() || path81.posix.basename(src);
|
|
64777
|
-
const key = JSON.stringify([src, name]);
|
|
64778
|
-
let file2 = files.get(key);
|
|
64779
|
-
if (!file2) {
|
|
64780
|
-
file2 = { src, source: source2, label: name, devices: /* @__PURE__ */ new Set() };
|
|
64781
|
-
files.set(key, file2);
|
|
64782
|
-
}
|
|
64783
|
-
file2.devices.add(device === "mobile" ? "Mobile" : device === "desktop" ? "Desktop" : "Device unspecified");
|
|
64784
|
-
};
|
|
64785
|
-
for (const { name, attrs } of bodyComponentTags(body)) {
|
|
64786
|
-
const label2 = attrs.label ?? "";
|
|
64787
|
-
if (name === "Compare" && attrs.a && attrs.b) {
|
|
64788
|
-
add2(attrs.a, attrs["a-label"] || label2);
|
|
64789
|
-
add2(attrs.b, attrs["b-label"] || label2);
|
|
64790
|
-
} else if (attrs.src) {
|
|
64791
|
-
const variants = variantsOf(attrs.variants, attrs.src);
|
|
64792
|
-
if (variants.length) {
|
|
64793
|
-
for (const variant of variants) add2(variant.src, label2 ? `${label2} (${variant.label})` : variant.label, attrs.device);
|
|
64794
|
-
} else {
|
|
64795
|
-
add2(attrs.src, label2, attrs.device);
|
|
64796
|
-
}
|
|
64797
|
-
}
|
|
64798
|
-
}
|
|
64799
|
-
const listed = new Set([...files.values()].map((file2) => file2.src));
|
|
64800
|
-
for (const src of bodySources(body)) if (!listed.has(src)) add2(src, "", void 0, false);
|
|
64801
|
-
if (files.size) result.push({
|
|
64802
|
-
id: id2,
|
|
64803
|
-
revision: stage.revision,
|
|
64804
|
-
directory: `review-${stage.revision}-${index}/${id2}`,
|
|
64805
|
-
body,
|
|
64806
|
-
pins,
|
|
64807
|
-
files: [...files.values()]
|
|
64808
|
-
});
|
|
64809
|
-
}
|
|
64810
|
-
}
|
|
64811
|
-
return result;
|
|
64812
|
-
}
|
|
64813
|
-
function approvedUiFile(directory, preview, source2) {
|
|
64814
|
-
const parts = path81.posix.normalize(splitFileReference(source2)[0]).split("/");
|
|
64815
|
-
let parents = 0;
|
|
64816
|
-
while (parts[0] === "..") {
|
|
64817
|
-
parts.shift();
|
|
64818
|
-
parents++;
|
|
64819
|
-
}
|
|
64820
|
-
const rendered = /\.tsx$/i.test(parts.at(-1) ?? "");
|
|
64821
|
-
if (rendered) parts[parts.length - 1] = parts.at(-1).replace(/\.tsx$/i, ".html");
|
|
64822
|
-
const safe2 = parts.map((part) => !part || part === "." ? "%00" : part.replace(/[\\:*?"<>|%\x00-\x1f]/g, (char) => `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`));
|
|
64823
|
-
return path81.join(directory, preview.directory, `${rendered ? "rendered" : "files"}-${parents}`, ...safe2);
|
|
64824
|
-
}
|
|
64825
|
-
function approvedUiPrompt(review, directory, includeBody = false) {
|
|
64826
|
-
const previews = approvedUiPreviews(review);
|
|
64827
|
-
if (!previews.length) return "";
|
|
64828
|
-
return [
|
|
64829
|
-
"Approved UI previews",
|
|
64830
|
-
APPROVED_UI_RULE,
|
|
64831
|
-
...previews.flatMap((preview) => [
|
|
64832
|
-
...includeBody ? [preview.body] : [],
|
|
64833
|
-
preview.files.flatMap((file2) => {
|
|
64834
|
-
const pin = approvedUiPin(preview.pins, file2.source);
|
|
64835
|
-
if (!validUiPin(pin)) return [];
|
|
64836
|
-
const ref = directory ? `frozen file: \`${approvedUiFile(directory, preview, file2.source)}\`` : `artifact ${pin.artifact}, version ${pin.version}`;
|
|
64837
|
-
return [`- ${file2.label} \xB7 ${[...file2.devices].join(" / ")} \xB7 Review revision ${preview.revision} \xB7 ${file2.src} \xB7 ${ref}`];
|
|
64838
|
-
}).join("\n")
|
|
64839
|
-
])
|
|
64840
|
-
].join("\n\n");
|
|
64841
|
-
}
|
|
64842
|
-
var APPROVED_UI_DIR_ENV, APPROVED_UI_RULE, UI_PREVIEW, historicalUiIds, object2, artifactId, external;
|
|
64843
|
-
var init_approved_ui = __esm({
|
|
64844
|
-
"src/lib/agent/approved-ui.ts"() {
|
|
64845
|
-
"use strict";
|
|
64846
|
-
init_file_references();
|
|
64847
|
-
init_references();
|
|
64848
|
-
init_tags();
|
|
64849
|
-
init_coding_previews();
|
|
64850
|
-
init_preview_blocks();
|
|
64851
|
-
init_review_plan();
|
|
64852
|
-
APPROVED_UI_DIR_ENV = "AI4KANBAN_APPROVED_UI_DIR";
|
|
64853
|
-
APPROVED_UI_RULE = "Open the approved mockups and follow the Coding Studio delivery requirements for matching the task's intended UI changes.";
|
|
64854
|
-
UI_PREVIEW = "ui-design";
|
|
64855
|
-
historicalUiIds = Object.keys(CODING_PREVIEWS).filter((id2) => id2 !== UI_PREVIEW && CODING_PREVIEWS[id2] === UI_PREVIEW);
|
|
64856
|
-
object2 = (value) => isObject2(value) ? value : {};
|
|
64857
|
-
artifactId = /^art_[a-z0-9]+$/i;
|
|
64858
|
-
external = /^(?:[a-z][\w+.-]*:|\/|#)/i;
|
|
64859
|
-
}
|
|
64860
|
-
});
|
|
64861
|
-
|
|
64862
64696
|
// src/lib/agent/follow.ts
|
|
64863
64697
|
function refineRunsAfter(asks) {
|
|
64864
64698
|
return asks.flatMap((ask2) => {
|
|
@@ -65019,15 +64853,9 @@ async function watchRun(sessionId, resume = startResume, retryBackoff = backoffM
|
|
|
65019
64853
|
const savedPreviews = record2.action === "implement" && process.env[SAVED_PREVIEW_FILE_ENV];
|
|
65020
64854
|
const review = reviewContext?.review;
|
|
65021
64855
|
const boundary = review && reviewBoundary(savedPreviews ? { ...review, stages: review.stages.map((stage) => ({ ...stage, snapshot: null })) } : review, reviewContext.assigned);
|
|
65022
|
-
const
|
|
65023
|
-
const uiDirectory = process.env[APPROVED_UI_DIR_ENV];
|
|
65024
|
-
const approvedUi = review && coding && (!savedPreviews || uiDirectory) ? approvedUiPrompt(review, uiDirectory, !!savedPreviews) : "";
|
|
65025
|
-
const savedPrompt = savedPreviews ? [
|
|
65026
|
-
`Read the saved task Previews and their pinned files in \`${savedPreviews}\`. Use these saved versions for the requirements they cover and verify the delivery against them.`,
|
|
65027
|
-
...coding && !approvedUi && review?.plan?.some((node2) => node2.previews.includes("ui-design")) ? [APPROVED_UI_RULE] : []
|
|
65028
|
-
].join("\n") : "";
|
|
64856
|
+
const savedPrompt = savedPreviews ? `Use the task inputs and pinned files listed in \`${savedPreviews}\`. Follow the task's delivery instructions.` : "";
|
|
65029
64857
|
const retryDiag = record2.retry ? record2.failure ? retryContinuePrompt(record2.failure, record2.retry.attempt, record2.retry.of) : `Previous execution failed: ${record2.retry.reason}. Check existing results before continuing; do not repeat completed operations.` : "";
|
|
65030
|
-
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", retryDiag, conflictPrompt(KANBAN), boundary, basePrompt, resumedStudio, savedPrompt,
|
|
64858
|
+
const prompt = [process.env.AI4KANBAN_SYNC_DIAGNOSTIC ? syncRepairPrompt(process.env.AI4KANBAN_SYNC_DIAGNOSTIC) : "", retryDiag, conflictPrompt(KANBAN), boundary, basePrompt, resumedStudio, savedPrompt, recoveryPrompt2, discardedCardsPrompt(record2.discardedCards)].filter(Boolean).join("\n\n");
|
|
65031
64859
|
const before = markBoard();
|
|
65032
64860
|
const takes = active3.images;
|
|
65033
64861
|
active3.renderer?.setRequiredImages?.(record2.pictures ?? []);
|
|
@@ -65610,8 +65438,6 @@ var STOP_GRACE_MS, STOP_CLOSE_MS, STOP_FINISH_MS, silenceSaid, joinNotes;
|
|
|
65610
65438
|
var init_watch = __esm({
|
|
65611
65439
|
"src/lib/agent/watch.ts"() {
|
|
65612
65440
|
"use strict";
|
|
65613
|
-
init_approved_ui();
|
|
65614
|
-
init_runner();
|
|
65615
65441
|
init_review_plan();
|
|
65616
65442
|
init_env();
|
|
65617
65443
|
init_connection_process();
|
|
@@ -65651,7 +65477,7 @@ var init_watch = __esm({
|
|
|
65651
65477
|
|
|
65652
65478
|
// src/commands/run.ts
|
|
65653
65479
|
import fs83 from "node:fs";
|
|
65654
|
-
import
|
|
65480
|
+
import path81 from "node:path";
|
|
65655
65481
|
async function cmdStartRun(action, args2, opts, program2 = "akb") {
|
|
65656
65482
|
const { req, follow: follow2, print } = readRequest(action, args2, opts);
|
|
65657
65483
|
if (!print && (action === "approve" || action === "implement")) {
|
|
@@ -65877,7 +65703,7 @@ async function cmdSubStart(words, opts) {
|
|
|
65877
65703
|
let prompt = words.join(" ");
|
|
65878
65704
|
if (opts.file) {
|
|
65879
65705
|
try {
|
|
65880
|
-
prompt = fs83.readFileSync(
|
|
65706
|
+
prompt = fs83.readFileSync(path81.resolve(opts.file), "utf8");
|
|
65881
65707
|
} catch {
|
|
65882
65708
|
die(`--file: cannot read ${opts.file}`, { kind: "run-refused" });
|
|
65883
65709
|
}
|
|
@@ -66227,7 +66053,7 @@ var init_config3 = __esm({
|
|
|
66227
66053
|
|
|
66228
66054
|
// src/lib/signals/migrate.ts
|
|
66229
66055
|
import fs84 from "node:fs";
|
|
66230
|
-
import
|
|
66056
|
+
import path82 from "node:path";
|
|
66231
66057
|
function readHandled() {
|
|
66232
66058
|
let text5;
|
|
66233
66059
|
try {
|
|
@@ -66249,7 +66075,7 @@ function readHandled() {
|
|
|
66249
66075
|
}
|
|
66250
66076
|
function lift(from, into) {
|
|
66251
66077
|
fs84.mkdirSync(into, { recursive: true });
|
|
66252
|
-
fs84.renameSync(from,
|
|
66078
|
+
fs84.renameSync(from, path82.join(into, freeName(into, path82.basename(from))));
|
|
66253
66079
|
}
|
|
66254
66080
|
function repoint(dir, from, into) {
|
|
66255
66081
|
let entries2;
|
|
@@ -66260,7 +66086,7 @@ function repoint(dir, from, into) {
|
|
|
66260
66086
|
}
|
|
66261
66087
|
for (const entry of entries2) {
|
|
66262
66088
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
66263
|
-
const file2 =
|
|
66089
|
+
const file2 = path82.join(dir, entry.name);
|
|
66264
66090
|
const text5 = fs84.readFileSync(file2, "utf8");
|
|
66265
66091
|
if (text5.includes(from)) fs84.writeFileSync(file2, text5.split(from).join(into));
|
|
66266
66092
|
}
|
|
@@ -66273,17 +66099,17 @@ function dropIfEmpty(dir) {
|
|
|
66273
66099
|
}
|
|
66274
66100
|
function liftInbox() {
|
|
66275
66101
|
if (!fs84.existsSync(SIGNALS_OLD_INBOX)) return;
|
|
66276
|
-
const oldFiles =
|
|
66102
|
+
const oldFiles = path82.join(SIGNALS_OLD_INBOX, "files");
|
|
66277
66103
|
if (fs84.existsSync(oldFiles)) {
|
|
66278
66104
|
for (const entry of fs84.readdirSync(oldFiles, { withFileTypes: true })) {
|
|
66279
|
-
if (entry.isFile()) lift(
|
|
66105
|
+
if (entry.isFile()) lift(path82.join(oldFiles, entry.name), SIGNALS_FILES);
|
|
66280
66106
|
}
|
|
66281
66107
|
dropIfEmpty(oldFiles);
|
|
66282
66108
|
}
|
|
66283
66109
|
const held4 = new Set(readFolder(TRIAGE).map((signal2) => signal2.sourceId));
|
|
66284
66110
|
for (const entry of fs84.readdirSync(SIGNALS_OLD_INBOX, { withFileTypes: true })) {
|
|
66285
66111
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
66286
|
-
const from =
|
|
66112
|
+
const from = path82.join(SIGNALS_OLD_INBOX, entry.name);
|
|
66287
66113
|
const item = parse3(from);
|
|
66288
66114
|
if (item && held4.has(item.sourceId)) {
|
|
66289
66115
|
fs84.rmSync(from, { force: true });
|
|
@@ -66292,7 +66118,7 @@ function liftInbox() {
|
|
|
66292
66118
|
if (item) held4.add(item.sourceId);
|
|
66293
66119
|
lift(from, TRIAGE);
|
|
66294
66120
|
}
|
|
66295
|
-
const wasAt = asWritten(
|
|
66121
|
+
const wasAt = asWritten(path82.join(SIGNALS_OLD_INBOX, "files"));
|
|
66296
66122
|
const nowAt = asWritten(SIGNALS_FILES);
|
|
66297
66123
|
for (const dir of [TRIAGE, SIGNALS_ARCHIVED, SIGNALS_DISMISSED]) repoint(dir, wasAt, nowAt);
|
|
66298
66124
|
dropIfEmpty(SIGNALS_OLD_INBOX);
|
|
@@ -66318,7 +66144,7 @@ function liftHandled() {
|
|
|
66318
66144
|
"---",
|
|
66319
66145
|
""
|
|
66320
66146
|
];
|
|
66321
|
-
fs84.writeFileSync(
|
|
66147
|
+
fs84.writeFileSync(path82.join(SIGNALS_DISMISSED, name), `${front.join("\n")}
|
|
66322
66148
|
`);
|
|
66323
66149
|
}
|
|
66324
66150
|
fs84.rmSync(SIGNALS_OLD_HANDLED, { force: true });
|
|
@@ -66339,7 +66165,7 @@ var init_migrate = __esm({
|
|
|
66339
66165
|
init_yaml();
|
|
66340
66166
|
init_inbox();
|
|
66341
66167
|
HANDLED_LINE = /^-\s+(.+?)\s+—\s+(.+)$/;
|
|
66342
|
-
asWritten = (dir) => `${rel(dir).split(
|
|
66168
|
+
asWritten = (dir) => `${rel(dir).split(path82.sep).join("/")}/`;
|
|
66343
66169
|
}
|
|
66344
66170
|
});
|
|
66345
66171
|
|
|
@@ -66393,7 +66219,7 @@ var init_identity2 = __esm({
|
|
|
66393
66219
|
|
|
66394
66220
|
// src/lib/signals/add.ts
|
|
66395
66221
|
import fs85 from "node:fs";
|
|
66396
|
-
import
|
|
66222
|
+
import path83 from "node:path";
|
|
66397
66223
|
import { createHash as createHash8 } from "node:crypto";
|
|
66398
66224
|
function linkTitle(url2) {
|
|
66399
66225
|
let at;
|
|
@@ -66406,7 +66232,7 @@ function linkTitle(url2) {
|
|
|
66406
66232
|
return oneLine(where) || url2.slice(0, TITLE_MAX);
|
|
66407
66233
|
}
|
|
66408
66234
|
function asText(file2) {
|
|
66409
|
-
const ext =
|
|
66235
|
+
const ext = path83.extname(file2.name).toLowerCase();
|
|
66410
66236
|
if (!file2.type.startsWith("text/") && file2.type !== "application/json" && !TEXT_EXTENSIONS.has(ext)) return null;
|
|
66411
66237
|
try {
|
|
66412
66238
|
const text5 = new TextDecoder("utf-8", { fatal: true }).decode(file2.data);
|
|
@@ -66416,9 +66242,9 @@ function asText(file2) {
|
|
|
66416
66242
|
}
|
|
66417
66243
|
}
|
|
66418
66244
|
function fileName2(name, data) {
|
|
66419
|
-
const base =
|
|
66420
|
-
const ext =
|
|
66421
|
-
const word =
|
|
66245
|
+
const base = path83.basename(name);
|
|
66246
|
+
const ext = path83.extname(base).toLowerCase().slice(0, 12);
|
|
66247
|
+
const word = path83.basename(base, path83.extname(base)).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "file";
|
|
66422
66248
|
const hash3 = createHash8("sha256").update(data).digest("hex").slice(0, 8);
|
|
66423
66249
|
return `${word}-${hash3}${ext}`;
|
|
66424
66250
|
}
|
|
@@ -66427,9 +66253,9 @@ function addToInbox(drop) {
|
|
|
66427
66253
|
const typed = (drop.text ?? "").trim();
|
|
66428
66254
|
const file2 = drop.file;
|
|
66429
66255
|
if (!typed && !file2) return { ok: false, error: "nothing to add \u2014 paste a link or some text, or drop a file." };
|
|
66430
|
-
if (file2 && file2.data.length === 0) return { ok: false, error: `${
|
|
66256
|
+
if (file2 && file2.data.length === 0) return { ok: false, error: `${path83.basename(file2.name)} is empty.` };
|
|
66431
66257
|
if (file2 && file2.data.length > MAX_BYTES3) {
|
|
66432
|
-
return { ok: false, error: `${
|
|
66258
|
+
return { ok: false, error: `${path83.basename(file2.name)} is over ${MAX_BYTES3 / 1024 / 1024} MB \u2014 too big for the board.` };
|
|
66433
66259
|
}
|
|
66434
66260
|
const read5 = describe3(typed, file2);
|
|
66435
66261
|
const keep2 = read5.keep;
|
|
@@ -66466,7 +66292,7 @@ function describe3(typed, file2) {
|
|
|
66466
66292
|
return only ? [only] : [];
|
|
66467
66293
|
};
|
|
66468
66294
|
if (file2) {
|
|
66469
|
-
const name =
|
|
66295
|
+
const name = path83.basename(file2.name);
|
|
66470
66296
|
const text5 = asText(file2);
|
|
66471
66297
|
const note = typed ? `
|
|
66472
66298
|
|
|
@@ -66478,7 +66304,7 @@ ${typed}` : "";
|
|
|
66478
66304
|
const at = keepAt(file2);
|
|
66479
66305
|
return {
|
|
66480
66306
|
incoming: {
|
|
66481
|
-
title:
|
|
66307
|
+
title: path83.basename(name, path83.extname(name)) || name,
|
|
66482
66308
|
summary: `${name} \u2014 ${boardRel2(at)}${note}`,
|
|
66483
66309
|
...named2
|
|
66484
66310
|
},
|
|
@@ -66516,13 +66342,13 @@ var init_add = __esm({
|
|
|
66516
66342
|
MAX_BYTES3 = 25 * 1024 * 1024;
|
|
66517
66343
|
TITLE_MAX = 120;
|
|
66518
66344
|
TEXT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".text", ".csv", ".json", ".yml", ".yaml", ".log"]);
|
|
66519
|
-
boardRel2 = (file2) => rel(file2).split(
|
|
66345
|
+
boardRel2 = (file2) => rel(file2).split(path83.sep).join("/");
|
|
66520
66346
|
oneLine = (text5) => {
|
|
66521
66347
|
const first = text5.split("\n").find((line) => line.trim()) ?? "";
|
|
66522
66348
|
const clean = first.replace(/^#+\s*/, "").trim();
|
|
66523
66349
|
return clean.length > TITLE_MAX ? `${clean.slice(0, TITLE_MAX - 1).trimEnd()}\u2026` : clean;
|
|
66524
66350
|
};
|
|
66525
|
-
keepAt = (file2) =>
|
|
66351
|
+
keepAt = (file2) => path83.join(SIGNALS_FILES, fileName2(file2.name, file2.data));
|
|
66526
66352
|
}
|
|
66527
66353
|
});
|
|
66528
66354
|
|
|
@@ -66628,7 +66454,7 @@ var init_previews = __esm({
|
|
|
66628
66454
|
|
|
66629
66455
|
// src/commands/studio-preview.ts
|
|
66630
66456
|
import fs87 from "node:fs";
|
|
66631
|
-
import
|
|
66457
|
+
import path84 from "node:path";
|
|
66632
66458
|
import { createHash as createHash9, randomUUID as randomUUID9 } from "node:crypto";
|
|
66633
66459
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
66634
66460
|
function readFolder2(folder2, baseline = false) {
|
|
@@ -66637,7 +66463,7 @@ function readFolder2(folder2, baseline = false) {
|
|
|
66637
66463
|
const scan = (dir) => {
|
|
66638
66464
|
for (const e of fs87.readdirSync(dir, { withFileTypes: true })) {
|
|
66639
66465
|
if (e.name.startsWith(".")) continue;
|
|
66640
|
-
const file2 =
|
|
66466
|
+
const file2 = path84.join(dir, e.name);
|
|
66641
66467
|
if (e.isSymbolicLink()) throw Error(`${file2}: symbolic links are not allowed`);
|
|
66642
66468
|
if (e.isDirectory()) scan(file2);
|
|
66643
66469
|
else {
|
|
@@ -66654,7 +66480,7 @@ function readFolder2(folder2, baseline = false) {
|
|
|
66654
66480
|
return { files, def: checked.def, fingerprint };
|
|
66655
66481
|
}
|
|
66656
66482
|
function unified(before, after2, file2, folder2) {
|
|
66657
|
-
const a =
|
|
66483
|
+
const a = path84.join(folder2, "a"), b = path84.join(folder2, "b");
|
|
66658
66484
|
fs87.writeFileSync(a, before ?? "");
|
|
66659
66485
|
fs87.writeFileSync(b, after2 ?? "");
|
|
66660
66486
|
const result = spawnSync7("git", ["diff", "--no-index", "--text", "--no-ext-diff", "--no-color", "--unified=3", before === null ? "/dev/null" : a, after2 === null ? "/dev/null" : b], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
|
|
@@ -66666,17 +66492,17 @@ ${start < 0 ? "" : lines.slice(start + 2).join("\n")}`;
|
|
|
66666
66492
|
}
|
|
66667
66493
|
async function cmdStudioPreview(id2, opts) {
|
|
66668
66494
|
if (!locate(id2)) die(`no card ${id2}`, "no-such-card");
|
|
66669
|
-
const destination =
|
|
66495
|
+
const destination = path84.join(ASSETS, String(id2), "studio-review"), staging = `${destination}.${randomUUID9()}.tmp`, backup = `${destination}.${randomUUID9()}.previous`;
|
|
66670
66496
|
let moved = false;
|
|
66671
66497
|
try {
|
|
66672
|
-
const draft = readFolder2(
|
|
66498
|
+
const draft = readFolder2(path84.resolve(opts.folder)), base = opts.base === "empty" ? null : readFolder2(path84.resolve(opts.base), true);
|
|
66673
66499
|
const version2 = readVersion2(draft.files), baseVersion = base && readVersion2(base.files);
|
|
66674
66500
|
if (base ? !version2 || !baseVersion || JSON.stringify(version2) !== JSON.stringify(baseVersion) : version2 !== null) throw Error("version.json: existing Studios need matching baseline and draft versions; use --base empty only for a new Studio without version.json");
|
|
66675
66501
|
fs87.mkdirSync(staging, { recursive: true });
|
|
66676
66502
|
const review = { version: 2, base: base && baseVersion ? { ...baseVersion, fingerprint: base.fingerprint } : null, fingerprint: draft.fingerprint, files: [] };
|
|
66677
66503
|
const save3 = (file2, bytes2) => {
|
|
66678
|
-
const target =
|
|
66679
|
-
fs87.mkdirSync(
|
|
66504
|
+
const target = path84.join(staging, file2);
|
|
66505
|
+
fs87.mkdirSync(path84.dirname(target), { recursive: true });
|
|
66680
66506
|
fs87.writeFileSync(target, bytes2);
|
|
66681
66507
|
return file2;
|
|
66682
66508
|
};
|
|
@@ -66685,10 +66511,10 @@ async function cmdStudioPreview(id2, opts) {
|
|
|
66685
66511
|
const before = base?.files[file2] ?? null, after2 = draft.files[file2] ?? null;
|
|
66686
66512
|
review.files.push({ path: file2, before: before === null ? null : save3(`files/${i}/before.txt`, before), after: after2 === null ? null : save3(`files/${i}/after.txt`, after2), ...before !== after2 ? { diff: save3(`files/${i}/change.diff`, unified(before, after2, file2, staging)) } : {} });
|
|
66687
66513
|
}
|
|
66688
|
-
for (const p of ["a", "b"]) fs87.rmSync(
|
|
66514
|
+
for (const p of ["a", "b"]) fs87.rmSync(path84.join(staging, p), { force: true });
|
|
66689
66515
|
if (!parseReview(review)) throw Error("generated review is invalid");
|
|
66690
66516
|
save3("review.json", JSON.stringify(review, null, 2) + "\n");
|
|
66691
|
-
fs87.mkdirSync(
|
|
66517
|
+
fs87.mkdirSync(path84.dirname(destination), { recursive: true });
|
|
66692
66518
|
if (fs87.existsSync(destination)) {
|
|
66693
66519
|
fs87.renameSync(destination, backup);
|
|
66694
66520
|
moved = true;
|
|
@@ -66706,7 +66532,7 @@ ${items}
|
|
|
66706
66532
|
|
|
66707
66533
|
</Set>` : items;
|
|
66708
66534
|
say([tag, files].filter(Boolean).join("\n\n"));
|
|
66709
|
-
return { file:
|
|
66535
|
+
return { file: path84.join(destination, "review.json"), tag, files };
|
|
66710
66536
|
} catch (error62) {
|
|
66711
66537
|
if (moved && !fs87.existsSync(destination)) fs87.renameSync(backup, destination);
|
|
66712
66538
|
if (error62 && typeof error62 === "object" && "kind" in error62) throw error62;
|
|
@@ -67305,7 +67131,7 @@ init_agent2();
|
|
|
67305
67131
|
|
|
67306
67132
|
// src/lib/cli/setup.ts
|
|
67307
67133
|
import fs89 from "node:fs";
|
|
67308
|
-
import
|
|
67134
|
+
import path86 from "node:path";
|
|
67309
67135
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
67310
67136
|
|
|
67311
67137
|
// src/commands/update.ts
|
|
@@ -67314,7 +67140,7 @@ init_config_template();
|
|
|
67314
67140
|
init_io();
|
|
67315
67141
|
init_version();
|
|
67316
67142
|
import fs88 from "node:fs";
|
|
67317
|
-
import
|
|
67143
|
+
import path85 from "node:path";
|
|
67318
67144
|
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
67319
67145
|
var NAME = "wildcrane";
|
|
67320
67146
|
var REPO = "https://github.com/wildcrane-ai/wildcrane";
|
|
@@ -67356,8 +67182,8 @@ async function cmdUpdate2(ctx) {
|
|
|
67356
67182
|
return { updated: ctx.dir, from, to: SKILL_VERSION };
|
|
67357
67183
|
}
|
|
67358
67184
|
async function repairBoard(root2, report3, named2) {
|
|
67359
|
-
const legacy =
|
|
67360
|
-
const kept2 =
|
|
67185
|
+
const legacy = path85.join(root2, "docs", "kanban");
|
|
67186
|
+
const kept2 = path85.join(root2, ".akb", "kanban");
|
|
67361
67187
|
const board2 = named2 ?? (fs88.existsSync(legacy) ? legacy : kept2);
|
|
67362
67188
|
if (!fs88.existsSync(board2)) {
|
|
67363
67189
|
report3.notes.push("\u672A\u627E\u5230\u770B\u677F\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002");
|
|
@@ -67370,7 +67196,7 @@ async function repairBoard(root2, report3, named2) {
|
|
|
67370
67196
|
return true;
|
|
67371
67197
|
}
|
|
67372
67198
|
function checkConfig(board2, report3) {
|
|
67373
|
-
const current = read4(
|
|
67199
|
+
const current = read4(path85.join(board2, "config.md"));
|
|
67374
67200
|
if (!current) return;
|
|
67375
67201
|
const added = missingConfigKeys(current);
|
|
67376
67202
|
if (added.length) {
|
|
@@ -67380,7 +67206,7 @@ function checkConfig(board2, report3) {
|
|
|
67380
67206
|
}
|
|
67381
67207
|
}
|
|
67382
67208
|
function checkModules(board2, report3) {
|
|
67383
|
-
const map3 = read4(
|
|
67209
|
+
const map3 = read4(path85.join(board2, "modules.md"));
|
|
67384
67210
|
if (map3 && map3.includes(UNFILLED)) {
|
|
67385
67211
|
report3.notes.push(
|
|
67386
67212
|
"docs/kanban/modules.md is still blank \u2014 write it from the repo (`akb guide module-map`)"
|
|
@@ -67434,14 +67260,14 @@ function declareSetup(program2, cli) {
|
|
|
67434
67260
|
program2.version(SKILL_VERSION, "-v, --version", "print this version").addHelpText("beforeAll", spelled(cli.program));
|
|
67435
67261
|
const dirOption = (cmd) => cmd.option("--dir <path>", "the project to work on (default: the current folder)").option("--json", "answer as one JSON object instead of prose");
|
|
67436
67262
|
const where = (cmd) => {
|
|
67437
|
-
const dir =
|
|
67263
|
+
const dir = path86.resolve(String(cmd.optsWithGlobals().dir ?? cli.cwd));
|
|
67438
67264
|
if (!fs89.existsSync(dir)) throw new BoardError(`no such folder: ${dir}`, { kind: "no-such-folder", dir });
|
|
67439
67265
|
return dir;
|
|
67440
67266
|
};
|
|
67441
67267
|
dirOption(program2.command("update")).summary("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u68C0\u67E5 CLI \u65B0\u7248\u672C").description("\u4FEE\u590D\u5DF2\u6709\u770B\u677F\u5E76\u63D0\u793A CLI \u5347\u7EA7\u547D\u4EE4\u3002\u6CA1\u6709\u770B\u677F\u65F6\uFF0C\u8BF7\u901A\u8FC7\u63D2\u4EF6\u8FDE\u63A5\u4E91\u7AEF\u9879\u76EE\u3002").action(async function() {
|
|
67442
67268
|
const dir = where(this);
|
|
67443
67269
|
const named2 = this.optsWithGlobals().board ?? process.env.AI4KANBAN_BOARD?.trim();
|
|
67444
|
-
const board2 = named2 ?
|
|
67270
|
+
const board2 = named2 ? path86.resolve(cli.cwd, named2) : null;
|
|
67445
67271
|
await runAction(ctxOf(this, cli.program), {}, () => cmdUpdate2({ dir, program: cli.program, board: board2 }));
|
|
67446
67272
|
});
|
|
67447
67273
|
program2.command("__rules", { hidden: true }).action(function() {
|