@swarmcraftai/cli 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/main.cjs +181 -78
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the SwarmCraft CLI are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.9.1
|
|
6
|
+
|
|
7
|
+
- Reads `dependsOn` written as a YAML flow sequence (for example `[uuid-a, uuid-b]`) or wrapped across lines with trailing commas by formatters such as Prettier, which previously failed to parse and blocked `one-shot --preview` and sync. Non-empty `dependsOn` is now written as a YAML block list, which formatters leave intact and 0.8.1 and later clients read.
|
|
8
|
+
- Reads packets with Windows (CRLF) line endings or a UTF-8 byte-order mark, which previously failed with "missing SwarmCraft frontmatter". Packet updates keep the file's existing line endings.
|
|
9
|
+
- Names the unreadable packet when local selection fails, including packets scanned only to resolve prerequisites.
|
|
10
|
+
- Lets one-shot complete packets to Done with the same completion rules sync accepts, so restored or one-shot Done packets sync without missing historical review metadata.
|
|
11
|
+
- Corrects the planning skill's packet guidance: `swarmcraftVersion` is 4, all six sections are top-level `##` headings, and a complete example lists `dependsOn` UUIDs one per line, the same form sync writes. Existing repositories receive it through the normal project guidance upgrade.
|
|
12
|
+
|
|
5
13
|
## 0.9.0
|
|
6
14
|
|
|
7
15
|
- Adds `--delivery direct` for one-shot execution on the current branch without branch/merge prerequisites. Checking, reviewing and commit policy remain independent.
|
package/dist/main.cjs
CHANGED
|
@@ -389,6 +389,8 @@ var require_packetFile = __commonJS({
|
|
|
389
389
|
exports2.normalizeSectionText = normalizeSectionText;
|
|
390
390
|
exports2.previewText = previewText;
|
|
391
391
|
exports2.slugify = slugify;
|
|
392
|
+
exports2.preservePacketLineEndings = preservePacketLineEndings;
|
|
393
|
+
exports2.renderDependsOnFrontmatter = renderDependsOnFrontmatter;
|
|
392
394
|
var node_path_1 = __importDefault(require("node:path"));
|
|
393
395
|
var node_crypto_1 = require("node:crypto");
|
|
394
396
|
var executionMetadata_js_1 = require_executionMetadata();
|
|
@@ -410,12 +412,12 @@ var require_packetFile = __commonJS({
|
|
|
410
412
|
const existingPacket = existingContents ? parsePacketFile5(existingContents) : null;
|
|
411
413
|
const storedSections = existingPacket ? existingPacket.sections : splitStoredTaskNotes(task.notes ?? null);
|
|
412
414
|
const goal = task.summary?.trim() ? task.summary.trim() : "Describe the outcome in one short paragraph.";
|
|
413
|
-
return [
|
|
415
|
+
return preservePacketLineEndings(existingContents ?? "", () => [
|
|
414
416
|
"---",
|
|
415
417
|
"swarmcraftVersion: 4",
|
|
416
418
|
`packetId: ${existingPacket?.frontmatter.packetId ?? legacyPacketUuid(project.id, task.id)}`,
|
|
417
419
|
`recommendedOrder: ${existingPacket?.frontmatter.recommendedOrder ?? task.recommendedOrder}`,
|
|
418
|
-
...existingPacket?.frontmatter.dependsOn !== void 0 ? [
|
|
420
|
+
...existingPacket?.frontmatter.dependsOn !== void 0 ? [renderDependsOnFrontmatter(existingPacket.frontmatter.dependsOn)] : [],
|
|
419
421
|
...existingPacket?.frontmatter.execution !== void 0 ? [`execution: ${JSON.stringify(existingPacket.frontmatter.execution)}`] : [],
|
|
420
422
|
`projectId: ${project.id}`,
|
|
421
423
|
`taskId: ${task.id}`,
|
|
@@ -455,7 +457,7 @@ var require_packetFile = __commonJS({
|
|
|
455
457
|
"",
|
|
456
458
|
storedSections.agentUpdate || "<!-- Short structured summary of what changed, what is blocked, and what still needs review. -->",
|
|
457
459
|
""
|
|
458
|
-
].join("\n");
|
|
460
|
+
].join("\n"));
|
|
459
461
|
}
|
|
460
462
|
function renderProvisionalPacketFile(input) {
|
|
461
463
|
const title = input.title.trim();
|
|
@@ -595,19 +597,21 @@ var require_packetFile = __commonJS({
|
|
|
595
597
|
provisional: null
|
|
596
598
|
});
|
|
597
599
|
}
|
|
598
|
-
function patchPacketFrontmatter(
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
600
|
+
function patchPacketFrontmatter(original, updates) {
|
|
601
|
+
return preservePacketLineEndings(original, (contents) => {
|
|
602
|
+
parsePacketFileDocument(contents);
|
|
603
|
+
const boundary = contents.indexOf("\n---", 4);
|
|
604
|
+
let header = contents.slice(0, boundary);
|
|
605
|
+
for (const [key, value] of Object.entries(updates)) {
|
|
606
|
+
const pattern = new RegExp(`^${key}:[^\\n]*`, "m");
|
|
607
|
+
if (value === null)
|
|
608
|
+
header = header.replace(new RegExp(`^${key}:[^\\n]*\\n?`, "m"), "").trimEnd();
|
|
609
|
+
else
|
|
610
|
+
header = pattern.test(header) ? header.replace(pattern, () => `${key}: ${value}`) : `${header}
|
|
608
611
|
${key}: ${value}`;
|
|
609
|
-
|
|
610
|
-
|
|
612
|
+
}
|
|
613
|
+
return header + contents.slice(boundary);
|
|
614
|
+
});
|
|
611
615
|
}
|
|
612
616
|
function rewritePacketFile(input) {
|
|
613
617
|
let rewritten = rewritePacketFileMetadata2(input.contents, {
|
|
@@ -621,21 +625,21 @@ ${key}: ${value}`;
|
|
|
621
625
|
function markChecklistStageComplete(contents, checklistStage) {
|
|
622
626
|
const heading = checklistSectionHeading(checklistStage);
|
|
623
627
|
const sectionPattern = new RegExp(`(## ${escapeRegExp(heading)}\\n\\n)([\\s\\S]*?)(?=\\n## |$)`);
|
|
624
|
-
return contents.replace(sectionPattern, (_match, prefix, body) => {
|
|
628
|
+
return preservePacketLineEndings(contents, (lf) => lf.replace(sectionPattern, (_match, prefix, body) => {
|
|
625
629
|
const updatedBody = body.split("\n").map((line) => line.replace(/^- \[ \] /, "- [x] ")).join("\n");
|
|
626
630
|
return `${prefix}${updatedBody}`;
|
|
627
|
-
});
|
|
631
|
+
}));
|
|
628
632
|
}
|
|
629
633
|
function appendAgentUpdateLines(contents, lines) {
|
|
630
634
|
if (lines.length === 0) {
|
|
631
635
|
return contents;
|
|
632
636
|
}
|
|
633
637
|
const sectionPattern = /(## Agent Update\n\n)([\s\S]*?)$/;
|
|
634
|
-
return contents.replace(sectionPattern, (_match, prefix, body) => {
|
|
638
|
+
return preservePacketLineEndings(contents, (lf) => lf.replace(sectionPattern, (_match, prefix, body) => {
|
|
635
639
|
const normalizedBody = normalizeSectionText(body);
|
|
636
640
|
return `${prefix}${[normalizedBody, ...lines].filter(Boolean).join("\n")}
|
|
637
641
|
`;
|
|
638
|
-
});
|
|
642
|
+
}));
|
|
639
643
|
}
|
|
640
644
|
function composeTaskNotes2(notes, agentUpdate) {
|
|
641
645
|
const normalizedNotes = normalizeSectionText(notes);
|
|
@@ -746,7 +750,16 @@ ${key}: ${value}`;
|
|
|
746
750
|
function slugify(value) {
|
|
747
751
|
return String(value).normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "packet";
|
|
748
752
|
}
|
|
749
|
-
function
|
|
753
|
+
function preservePacketLineEndings(contents, edit) {
|
|
754
|
+
const result = edit(normalizePacketText(contents));
|
|
755
|
+
const withLineEndings = contents.includes("\r\n") ? result.replace(/\r?\n/g, "\r\n") : result;
|
|
756
|
+
return contents.startsWith("\uFEFF") && !withLineEndings.startsWith("\uFEFF") ? `\uFEFF${withLineEndings}` : withLineEndings;
|
|
757
|
+
}
|
|
758
|
+
function normalizePacketText(contents) {
|
|
759
|
+
return contents.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n");
|
|
760
|
+
}
|
|
761
|
+
function parsePacketFileDocument(original) {
|
|
762
|
+
const contents = normalizePacketText(original);
|
|
750
763
|
const match = contents.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
751
764
|
if (!match) {
|
|
752
765
|
throw new PacketFileContractError2("PACKET_FILE_MALFORMED", "The packet file is missing SwarmCraft frontmatter.");
|
|
@@ -768,6 +781,14 @@ ${key}: ${value}`;
|
|
|
768
781
|
continue;
|
|
769
782
|
const key = line.slice(0, separatorIndex).trim();
|
|
770
783
|
let value = line.slice(separatorIndex + 1).trim();
|
|
784
|
+
const structured = key === "dependsOn" || key === "execution";
|
|
785
|
+
if (structured && !value && /^[[{]/.test(lines[index + 1]?.trim() ?? ""))
|
|
786
|
+
value = lines[++index].trim();
|
|
787
|
+
if (structured && /^[[{]/.test(value)) {
|
|
788
|
+
while (!isBalancedFlow(value) && index + 1 < lines.length)
|
|
789
|
+
value += ` ${lines[++index].trim()}`;
|
|
790
|
+
value = value.replace(/,\s*([\]}])/g, "$1");
|
|
791
|
+
}
|
|
771
792
|
if (key === "dependsOn" && (!value || value.startsWith("#"))) {
|
|
772
793
|
const dependencies = [];
|
|
773
794
|
while (index + 1 < lines.length) {
|
|
@@ -779,13 +800,16 @@ ${key}: ${value}`;
|
|
|
779
800
|
const item = next.match(/^\s*-\s+(.+?)\s*$/);
|
|
780
801
|
if (!item)
|
|
781
802
|
break;
|
|
782
|
-
|
|
783
|
-
dependencies.push(scalar.startsWith("'") && scalar.endsWith("'") ? scalar.slice(1, -1) : parseFrontmatterValue(scalar));
|
|
803
|
+
dependencies.push(parseDependencyScalar(item[1].replace(/\s+#.*$/, "")));
|
|
784
804
|
index++;
|
|
785
805
|
}
|
|
786
806
|
if (!dependencies.length)
|
|
787
807
|
throw new PacketFileContractError2("PACKET_FILE_MALFORMED", "dependsOn must be an array of packet UUIDs; use [] for no prerequisites.");
|
|
788
808
|
value = JSON.stringify(dependencies);
|
|
809
|
+
} else if (key === "dependsOn") {
|
|
810
|
+
const flow = value.replace(/\s+#.*$/, "").match(/^\[(.*)\]$/);
|
|
811
|
+
if (flow)
|
|
812
|
+
value = isJsonArray(flow[0]) ? flow[0] : JSON.stringify(flow[1].trim() ? flow[1].split(",").map(parseDependencyScalar) : []);
|
|
789
813
|
}
|
|
790
814
|
entries[key] = parseFrontmatterValue(value);
|
|
791
815
|
}
|
|
@@ -801,6 +825,23 @@ ${key}: ${value}`;
|
|
|
801
825
|
}
|
|
802
826
|
return value;
|
|
803
827
|
}
|
|
828
|
+
function parseDependencyScalar(raw) {
|
|
829
|
+
const scalar = raw.trim();
|
|
830
|
+
return scalar.startsWith("'") && scalar.endsWith("'") ? scalar.slice(1, -1) : parseFrontmatterValue(scalar);
|
|
831
|
+
}
|
|
832
|
+
function isBalancedFlow(value) {
|
|
833
|
+
return (value.match(/[[{]/g)?.length ?? 0) <= (value.match(/[\]}]/g)?.length ?? 0);
|
|
834
|
+
}
|
|
835
|
+
function renderDependsOnFrontmatter(dependencies) {
|
|
836
|
+
return dependencies.length ? ["dependsOn:", ...dependencies.map((id) => ` - ${id}`)].join("\n") : "dependsOn: []";
|
|
837
|
+
}
|
|
838
|
+
function isJsonArray(value) {
|
|
839
|
+
try {
|
|
840
|
+
return Array.isArray(JSON.parse(value));
|
|
841
|
+
} catch {
|
|
842
|
+
return false;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
804
845
|
function parseNullableFrontmatterValue(value) {
|
|
805
846
|
if (!value || value === "null") {
|
|
806
847
|
return null;
|
|
@@ -1208,7 +1249,8 @@ var require_localPacket = __commonJS({
|
|
|
1208
1249
|
exports2.localPacketId = localPacketId2;
|
|
1209
1250
|
exports2.migrateLocalPacket = migrateLocalPacket2;
|
|
1210
1251
|
exports2.duplicatePacketIds = duplicatePacketIds;
|
|
1211
|
-
exports2.validateLocalPacket =
|
|
1252
|
+
exports2.validateLocalPacket = validateLocalPacket2;
|
|
1253
|
+
exports2.validatePacketCompletion = validatePacketCompletion2;
|
|
1212
1254
|
exports2.reconcilePacketSnapshots = reconcilePacketSnapshots;
|
|
1213
1255
|
exports2.applyPacketSnapshot = applyPacketSnapshot2;
|
|
1214
1256
|
exports2.renderLocalPacket = renderLocalPacket;
|
|
@@ -1238,16 +1280,18 @@ var require_localPacket = __commonJS({
|
|
|
1238
1280
|
const hex = (0, node_crypto_1.createHash)("sha256").update(JSON.stringify([packet.frontmatter.projectId, packet.frontmatter.taskId])).digest("hex");
|
|
1239
1281
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-5${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
|
|
1240
1282
|
}
|
|
1241
|
-
function migrateLocalPacket2(
|
|
1242
|
-
const packet = (0, packetFile_js_1.parsePacketFile)(
|
|
1283
|
+
function migrateLocalPacket2(original) {
|
|
1284
|
+
const packet = (0, packetFile_js_1.parsePacketFile)(original);
|
|
1243
1285
|
if (packet.frontmatter.swarmcraftVersion >= 3)
|
|
1244
|
-
return
|
|
1245
|
-
|
|
1286
|
+
return original;
|
|
1287
|
+
return (0, packetFile_js_1.preservePacketLineEndings)(original, (contents) => {
|
|
1288
|
+
let result = contents.replace(/^swarmcraftVersion: 2$/m, `swarmcraftVersion: 3
|
|
1246
1289
|
packetId: ${localPacketId2(packet)}`);
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1290
|
+
if (packet.frontmatter.provisional || packet.frontmatter.taskId.startsWith("provisional:")) {
|
|
1291
|
+
result = result.replace(/^taskId:.*\n/m, "").replace(/^provisional:.*\n/m, "");
|
|
1292
|
+
}
|
|
1293
|
+
return result;
|
|
1294
|
+
});
|
|
1251
1295
|
}
|
|
1252
1296
|
function duplicatePacketIds(packets) {
|
|
1253
1297
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1260,10 +1304,13 @@ packetId: ${localPacketId2(packet)}`);
|
|
|
1260
1304
|
}
|
|
1261
1305
|
return [...duplicates];
|
|
1262
1306
|
}
|
|
1263
|
-
function
|
|
1307
|
+
function validateLocalPacket2(snapshot) {
|
|
1264
1308
|
if (!snapshot.title.trim() || !snapshot.goal.trim())
|
|
1265
1309
|
throw new packetFile_js_1.PacketFileContractError("PACKET_FILE_MALFORMED", "Packets require a title and goal.");
|
|
1266
1310
|
(0, executionMetadata_js_1.validateExecutionMetadata)(snapshot);
|
|
1311
|
+
}
|
|
1312
|
+
function validatePacketCompletion2(snapshot) {
|
|
1313
|
+
validateLocalPacket2(snapshot);
|
|
1267
1314
|
const required = (stage) => stage === "doing" || snapshot.execution?.[stage] !== "skipped";
|
|
1268
1315
|
const incomplete = (stage) => required(stage) && snapshot[stage].some((item) => !item.completed);
|
|
1269
1316
|
const prior = snapshot.lane === "checking" ? ["doing"] : snapshot.lane === "reviewing" ? ["doing", "checking"] : [];
|
|
@@ -1286,58 +1333,63 @@ packetId: ${localPacketId2(packet)}`);
|
|
|
1286
1333
|
return { snapshot, conflicts };
|
|
1287
1334
|
}
|
|
1288
1335
|
function applyPacketSnapshot2(contents, snapshot, link) {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
const
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
metadata("
|
|
1314
|
-
metadata("
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1336
|
+
return (0, packetFile_js_1.preservePacketLineEndings)(migrateLocalPacket2(contents), (migrated) => {
|
|
1337
|
+
let result = migrated;
|
|
1338
|
+
const before = packetSnapshot3((0, packetFile_js_1.parsePacketFile)(result));
|
|
1339
|
+
const metadata = (key, value, rendered = `${key}: ${value}`) => {
|
|
1340
|
+
const boundary = result.indexOf("\n---", 4);
|
|
1341
|
+
let header = result.slice(0, boundary);
|
|
1342
|
+
const wrapped = key === "dependsOn" || key === "execution" ? `[ ]*(?:\\n[ ]*)?(?:\\[[^\\]]*\\]|\\{[^}]*\\})[^\\n]*|` : "";
|
|
1343
|
+
const block = key === "dependsOn" ? "(?:\\n(?:[ ]*-[ ]+[^\\n]*|[ ]*#[^\\n]*|[ ]*(?=\\n|$)))*" : "";
|
|
1344
|
+
const pattern = new RegExp(`^${key}:(?:${wrapped}.*${block})`, "m");
|
|
1345
|
+
header = pattern.test(header) ? header.replace(pattern, (matched) => {
|
|
1346
|
+
const comments = key === "dependsOn" ? matched.split("\n").slice(1).filter((line) => line.trimStart().startsWith("#")) : [];
|
|
1347
|
+
return [rendered, ...comments].join("\n");
|
|
1348
|
+
}) : `${header}
|
|
1349
|
+
${rendered}`;
|
|
1350
|
+
result = header + result.slice(boundary);
|
|
1351
|
+
};
|
|
1352
|
+
if (snapshot.recommendedOrder !== void 0) {
|
|
1353
|
+
metadata("swarmcraftVersion", "4");
|
|
1354
|
+
metadata("recommendedOrder", String(snapshot.recommendedOrder));
|
|
1355
|
+
}
|
|
1356
|
+
if (snapshot.dependsOn !== void 0)
|
|
1357
|
+
metadata("dependsOn", "", (0, packetFile_js_1.renderDependsOnFrontmatter)(snapshot.dependsOn));
|
|
1358
|
+
if (snapshot.execution !== void 0)
|
|
1359
|
+
metadata("execution", JSON.stringify(snapshot.execution));
|
|
1360
|
+
metadata("title", JSON.stringify(snapshot.title));
|
|
1361
|
+
metadata("lane", snapshot.lane);
|
|
1362
|
+
if (link) {
|
|
1363
|
+
metadata("taskId", link.taskId);
|
|
1364
|
+
metadata("syncRevision", String(link.revision));
|
|
1365
|
+
metadata("lastSyncedAt", link.syncedAt);
|
|
1366
|
+
}
|
|
1367
|
+
const fields = [["goal", "Goal"], ["notes", "Notes"], ["agentUpdate", "Agent Update"], ["doing", "Doing Checklist"], ["checking", "Checking Checklist"], ["reviewing", "Reviewing Checklist"]];
|
|
1368
|
+
for (const [field, heading] of fields) {
|
|
1369
|
+
if (JSON.stringify(before[field]) === JSON.stringify(snapshot[field]))
|
|
1370
|
+
continue;
|
|
1371
|
+
const value = snapshot[field];
|
|
1372
|
+
const body = Array.isArray(value) ? value.map((item) => `- [${item.completed ? "x" : " "}] ${item.body}`).join("\n") : value;
|
|
1373
|
+
const pattern = new RegExp(`^## ${heading}\\s*\\n[\\s\\S]*?(?=^## |$(?![\\s\\S]))`, "m");
|
|
1374
|
+
if (pattern.test(result))
|
|
1375
|
+
result = result.replace(pattern, () => `## ${heading}
|
|
1325
1376
|
|
|
1326
1377
|
${body}
|
|
1327
1378
|
|
|
1328
1379
|
`);
|
|
1329
|
-
|
|
1330
|
-
|
|
1380
|
+
else
|
|
1381
|
+
result += `
|
|
1331
1382
|
## ${heading}
|
|
1332
1383
|
|
|
1333
1384
|
${body}
|
|
1334
1385
|
`;
|
|
1335
|
-
|
|
1336
|
-
|
|
1386
|
+
}
|
|
1387
|
+
return result;
|
|
1388
|
+
});
|
|
1337
1389
|
}
|
|
1338
1390
|
function renderLocalPacket(snapshot, projectId) {
|
|
1339
|
-
|
|
1340
|
-
const fields = ["---", snapshot.recommendedOrder === void 0 ? "swarmcraftVersion: 3" : "swarmcraftVersion: 4", ...snapshot.recommendedOrder === void 0 ? [] : [`recommendedOrder: ${snapshot.recommendedOrder}`], ...snapshot.dependsOn === void 0 ? [] : [
|
|
1391
|
+
validateLocalPacket2(snapshot);
|
|
1392
|
+
const fields = ["---", snapshot.recommendedOrder === void 0 ? "swarmcraftVersion: 3" : "swarmcraftVersion: 4", ...snapshot.recommendedOrder === void 0 ? [] : [`recommendedOrder: ${snapshot.recommendedOrder}`], ...snapshot.dependsOn === void 0 ? [] : [(0, packetFile_js_1.renderDependsOnFrontmatter)(snapshot.dependsOn)], ...snapshot.execution === void 0 ? [] : [`execution: ${JSON.stringify(snapshot.execution)}`], `packetId: ${newPacketId()}`, ...projectId ? [`projectId: ${projectId}`] : [], `title: ${JSON.stringify(snapshot.title)}`, `lane: ${snapshot.lane}`, "---", ""];
|
|
1341
1393
|
for (const [heading, value] of [["Goal", snapshot.goal], ["Doing Checklist", snapshot.doing], ["Checking Checklist", snapshot.checking], ["Reviewing Checklist", snapshot.reviewing], ["Notes", snapshot.notes], ["Agent Update", snapshot.agentUpdate]]) {
|
|
1342
1394
|
fields.push(`## ${heading}`, "", typeof value === "string" ? value : value.map((item) => `- [${item.completed ? "x" : " "}] ${item.body}`).join("\n"), "");
|
|
1343
1395
|
}
|
|
@@ -2051,6 +2103,8 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
2051
2103
|
"",
|
|
2052
2104
|
`Generate packetId once using a UUID generator (for example node -e "console.log(require('node:crypto').randomUUID())"). Preserve it across renames and edits. Include projectId when existing context explicitly binds this repository to the authorised project. Omit projectId when no authorised project binding exists; local work does not require it. Never invent hosted task IDs. Separate copied work needs a new packetId and explicit project binding.`,
|
|
2053
2105
|
"",
|
|
2106
|
+
"All six packet sections must be top-level `##` headings. Do not nest `### Agent Update` under Notes; subheadings such as `### Plan Context` belong within Notes.",
|
|
2107
|
+
"",
|
|
2054
2108
|
"A local packet must include:",
|
|
2055
2109
|
"",
|
|
2056
2110
|
...(0, packet_workflow_1.renderBullets)([
|
|
@@ -2064,10 +2118,54 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
2064
2118
|
"",
|
|
2065
2119
|
"New checklist items start unchecked. As evidence is obtained, complete them and advance lanes locally, even without SwarmCraft, an account, or an extension. Connected packets sync automatically; Sync Packet is only a retry/conflict recovery action. Set swarmcraft.packetSync.enabled to false in VS Code to remain local-only.",
|
|
2066
2120
|
"",
|
|
2121
|
+
"List prerequisites one per line as a YAML list under `dependsOn:`, each line ` - <packet-UUID>`, as in the example below. This is the form SwarmCraft sync writes and editor formatters leave intact. Use `dependsOn: []` only for no prerequisites. Do not write inline arrays such as `[uuid-a, uuid-b]`.",
|
|
2122
|
+
"",
|
|
2123
|
+
"Complete packet example (replace example identities and content; the dependency must identify a real prerequisite packet):",
|
|
2124
|
+
"",
|
|
2125
|
+
"```markdown",
|
|
2126
|
+
"---",
|
|
2127
|
+
"swarmcraftVersion: 4",
|
|
2128
|
+
"packetId: 9827f492-b15b-437b-a94c-9556680fabf1",
|
|
2129
|
+
"recommendedOrder: 2",
|
|
2130
|
+
"dependsOn:",
|
|
2131
|
+
" - 2006de45-e236-4221-970e-5445ed0b3b0b",
|
|
2132
|
+
'title: "Document the agreed workflow"',
|
|
2133
|
+
"lane: todo",
|
|
2134
|
+
"syncRevision: 0",
|
|
2135
|
+
"lastSyncedAt: null",
|
|
2136
|
+
"---",
|
|
2137
|
+
"",
|
|
2138
|
+
"## Goal",
|
|
2139
|
+
"",
|
|
2140
|
+
"Record the agreed workflow and its exceptions.",
|
|
2141
|
+
"",
|
|
2142
|
+
"## Doing Checklist",
|
|
2143
|
+
"",
|
|
2144
|
+
"- [ ] Document the workflow from the agreed requirements.",
|
|
2145
|
+
"",
|
|
2146
|
+
"## Checking Checklist",
|
|
2147
|
+
"",
|
|
2148
|
+
"- [ ] Compare the documented workflow against the requirements.",
|
|
2149
|
+
"",
|
|
2150
|
+
"## Reviewing Checklist",
|
|
2151
|
+
"",
|
|
2152
|
+
"- [ ] Ask the owner to review the workflow.",
|
|
2153
|
+
"",
|
|
2154
|
+
"## Notes",
|
|
2155
|
+
"",
|
|
2156
|
+
"### Plan Context",
|
|
2157
|
+
"",
|
|
2158
|
+
"Link the owning plan and phase here for initiative work.",
|
|
2159
|
+
"",
|
|
2160
|
+
"## Agent Update",
|
|
2161
|
+
"",
|
|
2162
|
+
"Not started.",
|
|
2163
|
+
"```",
|
|
2164
|
+
"",
|
|
2067
2165
|
"Before handing off a local packet, validate that:",
|
|
2068
2166
|
"",
|
|
2069
2167
|
...(0, packet_workflow_1.renderBullets)([
|
|
2070
|
-
"`packetId` is a stable random UUID and `swarmcraftVersion` is `
|
|
2168
|
+
"`packetId` is a stable random UUID and `swarmcraftVersion` is `4`",
|
|
2071
2169
|
"`projectId` is optional; when present it comes from an explicit authorised binding",
|
|
2072
2170
|
"`lane` reflects current work rather than registration status",
|
|
2073
2171
|
"all six required packet sections are present",
|
|
@@ -69513,7 +69611,12 @@ async function selectLocalPackets(root, selectors) {
|
|
|
69513
69611
|
const paths = /* @__PURE__ */ new Map();
|
|
69514
69612
|
for (const name of await discover(root, ".swarmcraft/projects")) {
|
|
69515
69613
|
const contents = await readContainedLocal(root, name);
|
|
69516
|
-
|
|
69614
|
+
let parsed;
|
|
69615
|
+
try {
|
|
69616
|
+
parsed = (0, import_packet_workflow2.parsePacketFile)(contents);
|
|
69617
|
+
} catch (error) {
|
|
69618
|
+
throw new Error(`Unreadable packet ${name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
69619
|
+
}
|
|
69517
69620
|
const id = (0, import_packet_workflow2.localPacketId)(parsed);
|
|
69518
69621
|
if (records.has(id)) throw new Error(`Duplicate packet identity: ${name}`);
|
|
69519
69622
|
records.set(id, { path: name, contents, parsed });
|
|
@@ -69728,7 +69831,7 @@ async function executeLocalRun(manifest, resume) {
|
|
|
69728
69831
|
if (snapshot.lane === "doing" || snapshot.checking.some((item) => !item.completed)) throw new LocalRunBlocked(`Checking requires more work: ${selected.path}`);
|
|
69729
69832
|
}
|
|
69730
69833
|
snapshot.lane = options.reviewing && snapshot.lane !== "done" ? "reviewing" : "done";
|
|
69731
|
-
(0, import_packet_workflow3.
|
|
69834
|
+
(0, import_packet_workflow3.validatePacketCompletion)(snapshot);
|
|
69732
69835
|
if (snapshot.lane === "done") {
|
|
69733
69836
|
const entry = `### One-shot completion (${manifest.runId})
|
|
69734
69837
|
Implementation complete. Checking: ${options.checking ? "completed" : "explicitly skipped"}. Reviewing: ${options.reviewing ? "approved" : "explicitly skipped"}.`;
|
|
@@ -69773,7 +69876,7 @@ var import_packet_workflow10 = __toESM(require_dist(), 1);
|
|
|
69773
69876
|
// package.json
|
|
69774
69877
|
var package_default = {
|
|
69775
69878
|
name: "@swarmcraftai/cli",
|
|
69776
|
-
version: "0.9.
|
|
69879
|
+
version: "0.9.1",
|
|
69777
69880
|
description: "Prepare repositories and run packet-based SwarmCraft agent workflows from the terminal.",
|
|
69778
69881
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
69779
69882
|
type: "module",
|
package/package.json
CHANGED