@swarmcraftai/cli 0.8.1 → 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 +17 -0
- package/README.md +8 -0
- package/dist/main.cjs +570 -102
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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
|
+
|
|
13
|
+
## 0.9.0
|
|
14
|
+
|
|
15
|
+
- Adds `--delivery direct` for one-shot execution on the current branch without branch/merge prerequisites. Checking, reviewing and commit policy remain independent.
|
|
16
|
+
- Stops hosted one-shot when Doing evidence is incomplete, including when checking/reviewing are disabled.
|
|
17
|
+
- Updates guidance template set 16 so agents honour the explicit direct-delivery run policy.
|
|
18
|
+
- Adds project guidance template set 15 with merge-request, merge-review and merge-respond skills for Codex, Copilot and Claude. Review records remain owner-controlled.
|
|
19
|
+
- Records developer, source branch and merge target during planning and prepares the working branch when implementation is authorised.
|
|
20
|
+
- Installs new skills through the existing project guidance upgrade path while preserving edited guidance and review history.
|
|
21
|
+
|
|
5
22
|
## 0.8.1
|
|
6
23
|
|
|
7
24
|
- Opens browser sign-in by default, with Google, GitHub, passkey, or password sign-in followed by CLI approval. Use `--no-browser` to open the link yourself or `--method password` for terminal password login; existing credential flags and environment variables remain supported.
|
package/README.md
CHANGED
|
@@ -203,3 +203,11 @@ then repeat without `--check` to apply. Repeat `--packet` for the selected scope
|
|
|
203
203
|
Numeric filename prefixes supply missing order; unresolved order blocks migration.
|
|
204
204
|
Declare reviewed `dependsOn` UUIDs explicitly afterward. The migration does not
|
|
205
205
|
assume legacy tasks are independent and does not rename files.
|
|
206
|
+
|
|
207
|
+
## Direct delivery for one-shot builds
|
|
208
|
+
|
|
209
|
+
Use `--delivery direct` to work in the supplied current branch without requiring a separate source branch, merge target or merge request. It does not create/switch branches, push, merge or deploy. The default is `--delivery branch`, which retains the normal delivery prerequisites. Delivery is independent from checking, reviewing and commit policy.
|
|
210
|
+
|
|
211
|
+
Weekly unattended builds use `--delivery direct --checking off --reviewing off`. Commit preparation before launch. The selected delivery policy is recorded in the run and passed to agents as `SWARMCRAFT_ONE_SHOT_DELIVERY`; resumes retain that policy. Update seeded skills before using the option in an existing target.
|
|
212
|
+
|
|
213
|
+
Doing implementation and its validation remain mandatory. An agent exiting successfully with unfinished Doing items stops the run before later tasks; skipping checking/reviewing never authorises a false Done transition. Inspect the first completed task's files and evidence before leaving a new weekly build unattended.
|
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
|
}
|
|
@@ -1359,6 +1411,30 @@ ${body}
|
|
|
1359
1411
|
}
|
|
1360
1412
|
});
|
|
1361
1413
|
|
|
1414
|
+
// ../../packages/packet-workflow/dist/deliveryPolicy.js
|
|
1415
|
+
var require_deliveryPolicy = __commonJS({
|
|
1416
|
+
"../../packages/packet-workflow/dist/deliveryPolicy.js"(exports2) {
|
|
1417
|
+
"use strict";
|
|
1418
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1419
|
+
exports2.DoingIncompleteError = void 0;
|
|
1420
|
+
exports2.parseDeliveryMode = parseDeliveryMode3;
|
|
1421
|
+
exports2.requireDoingCompletion = requireDoingCompletion2;
|
|
1422
|
+
function parseDeliveryMode3(value = "branch") {
|
|
1423
|
+
if (value !== "branch" && value !== "direct")
|
|
1424
|
+
throw new Error("--delivery must be branch or direct.");
|
|
1425
|
+
return value;
|
|
1426
|
+
}
|
|
1427
|
+
var DoingIncompleteError2 = class extends Error {
|
|
1428
|
+
};
|
|
1429
|
+
exports2.DoingIncompleteError = DoingIncompleteError2;
|
|
1430
|
+
function requireDoingCompletion2(items) {
|
|
1431
|
+
if (items.length === 0 || items.some((item) => !item.completed)) {
|
|
1432
|
+
throw new DoingIncompleteError2("Doing is incomplete: complete and validate every Doing checklist item before advancing. The agent exiting successfully is not task completion.");
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1362
1438
|
// ../../packages/packet-workflow/dist/index.js
|
|
1363
1439
|
var require_dist = __commonJS({
|
|
1364
1440
|
"../../packages/packet-workflow/dist/index.js"(exports2) {
|
|
@@ -1380,6 +1456,7 @@ var require_dist = __commonJS({
|
|
|
1380
1456
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
1381
1457
|
};
|
|
1382
1458
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1459
|
+
exports2.DoingIncompleteError = exports2.requireDoingCompletion = exports2.parseDeliveryMode = void 0;
|
|
1383
1460
|
__exportStar(require_assistantActions(), exports2);
|
|
1384
1461
|
__exportStar(require_agentProviders(), exports2);
|
|
1385
1462
|
__exportStar(require_manifest(), exports2);
|
|
@@ -1388,6 +1465,16 @@ var require_dist = __commonJS({
|
|
|
1388
1465
|
__exportStar(require_workflowContract(), exports2);
|
|
1389
1466
|
__exportStar(require_localPacket(), exports2);
|
|
1390
1467
|
__exportStar(require_executionMetadata(), exports2);
|
|
1468
|
+
var deliveryPolicy_1 = require_deliveryPolicy();
|
|
1469
|
+
Object.defineProperty(exports2, "parseDeliveryMode", { enumerable: true, get: function() {
|
|
1470
|
+
return deliveryPolicy_1.parseDeliveryMode;
|
|
1471
|
+
} });
|
|
1472
|
+
Object.defineProperty(exports2, "requireDoingCompletion", { enumerable: true, get: function() {
|
|
1473
|
+
return deliveryPolicy_1.requireDoingCompletion;
|
|
1474
|
+
} });
|
|
1475
|
+
Object.defineProperty(exports2, "DoingIncompleteError", { enumerable: true, get: function() {
|
|
1476
|
+
return deliveryPolicy_1.DoingIncompleteError;
|
|
1477
|
+
} });
|
|
1391
1478
|
}
|
|
1392
1479
|
});
|
|
1393
1480
|
|
|
@@ -1399,6 +1486,300 @@ var require_projectSeedModels = __commonJS({
|
|
|
1399
1486
|
}
|
|
1400
1487
|
});
|
|
1401
1488
|
|
|
1489
|
+
// ../../packages/repo-seed/dist/templates/merge/contract.js
|
|
1490
|
+
var require_contract = __commonJS({
|
|
1491
|
+
"../../packages/repo-seed/dist/templates/merge/contract.js"(exports2) {
|
|
1492
|
+
"use strict";
|
|
1493
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1494
|
+
exports2.DELIVERY_CONTRACT = exports2.MERGE_CONTRACT = void 0;
|
|
1495
|
+
exports2.MERGE_CONTRACT = `# SwarmCraft Merge Workflow
|
|
1496
|
+
|
|
1497
|
+
## Scope and people
|
|
1498
|
+
|
|
1499
|
+
Use this workflow for integration of a completed initiative, explicitly agreed bounded phase range, one direct packet, or coordinated work across projects. Read repository instructions, the relevant plans/packets, and existing review records. Resolve paths against the customer repository. Never require a hosted board or a particular Git host.
|
|
1500
|
+
|
|
1501
|
+
Name one responsible developer and an accountable human reviewer; record specialist assessors and their remit when needed. Support is proportional to experience and risk. Respect agreed independent supervision; do not substitute self-review. If one human legitimately fills both roles, record that honestly. AI assesses evidence and recommends; only the human decides. Clarify unresolved ownership or authority rather than inventing it, and reuse existing explicit instructions.
|
|
1502
|
+
|
|
1503
|
+
## Delivery and readiness
|
|
1504
|
+
|
|
1505
|
+
Read the initiative's Delivery section or the direct packet's Delivery notes. Verify source branch, merge target, responsible developer, and actual checkout. Resolve missing legacy context with the owner before dependent execution; do not retrofit historical records in bulk. Use one branch per initiative by default, respecting repository conventions. Never submit from the target branch or silently move work between branches.
|
|
1506
|
+
|
|
1507
|
+
Packets own completion, checklists and evidence. Require completed submitted scope under its recorded execution policy and proportionate integration verification. Normal completion includes human task review; V4 one-shot may record explicitly skipped stages. Record which checks/reviews ran and which were skipped. A one-shot waiver is not merge approval. Do not rewrite historical packet approvals or reopen completed packets just to answer merge feedback. Incomplete required scope blocks readiness; an explicitly agreed bounded deliverable names remaining work.
|
|
1508
|
+
|
|
1509
|
+
Inspect source and target changes across affected clients, APIs, data/migrations, security, configuration and deployment boundaries. Existing task results alone do not prove integration. Separate introduced defects from baseline issues. Record commands, results, assessed revisions and unavailable checks honestly; keep secrets and raw sensitive logs out of records. Include practical setup/demo steps and accessible previews, identifying simulations and limitations.
|
|
1510
|
+
|
|
1511
|
+
## Records and rounds
|
|
1512
|
+
|
|
1513
|
+
Create .reviews/<submission-slug>/ only when needed. Prefer the plan slug; for direct work use a stable descriptive slug with packet path and UUID. Disambiguate project collisions and list all participating plans/packets. The developer owns submission.md and response.md; the reviewer owns decisions in review.md. Paths in these records are repository-relative from their directory, for example ../../docs/plans/example-plan.md. Do not seed empty records or treat them as generated files.
|
|
1514
|
+
|
|
1515
|
+
Append numbered rounds; retain all earlier submissions, findings and decisions. Each submission records full implementation commit A, current target baseline T, and merge base B. Capture A before committing submission records as S. A decision-record commit D references A and T, not itself. Report S, D and the merge commit from Git history after they exist. Never invent self-referencing hashes.
|
|
1516
|
+
|
|
1517
|
+
Use stable finding IDs such as R1-F1, severity, evidence/impact, required change versus suggestion, and requested action. Carried findings retain their original IDs. New rounds map every outstanding required finding to actual developer response and verification. Suggestions are optional scope. Developer states include planned, in progress, addressed, needs clarification and deferral proposed. Only the reviewer records resolved, deferred, withdrawn or outstanding. Creating a packet/plan is not a delivered fix. Required findings remain open until the human accepts resolution or explicitly defers/withdraws them; acceptance must not hide unresolved required work.
|
|
1518
|
+
|
|
1519
|
+
## Revision checks
|
|
1520
|
+
|
|
1521
|
+
Verify A, T and B exist and match the claimed history. Before assessment or merge, fetch the resolved remote refs when remote collaboration applies; use the freshly fetched target tip, not a stale local branch. Inspect divergence without resetting, rebasing, or silently merging. Target advancement requires a refreshed submission/baseline and renewed integration assessment before acceptance or merge.
|
|
1522
|
+
|
|
1523
|
+
Inspect EVERY intervening commit after A as well as the aggregate diff. Only commits changing this submission's .reviews/<submission-slug>/ records qualify for the record-only exception. Other review folders, packet records, application files and arbitrary docs do not qualify. Implementation changes later reverted still require resubmission. Verify accepted A remains an ancestor of the source tip, and compare current source/target again immediately before merging. Review-record edits must not falsify or overwrite earlier decisions.
|
|
1524
|
+
|
|
1525
|
+
## Authority and sharing
|
|
1526
|
+
|
|
1527
|
+
| Request | Permitted Git actions |
|
|
1528
|
+
| --- | --- |
|
|
1529
|
+
| Planning or assessment-only | No commit, push or merge |
|
|
1530
|
+
| Draft submission | Prepare records only; no commit or push |
|
|
1531
|
+
| Local-only submission | Commit this submission's records; no push |
|
|
1532
|
+
| Normal submission | Commit this submission's records and non-force push only the source branch to the resolved remote |
|
|
1533
|
+
| Explicit acceptance/rejection | Commit this submission's decision records; no implied push or merge |
|
|
1534
|
+
| Explicit accept and merge | Decision-record commit and local merge for the specified revisions |
|
|
1535
|
+
| Respond | Agreed remediation and evidence; commits only if authorised; no implied push or resubmission |
|
|
1536
|
+
| Respond and resubmit | Necessary scoped fix/response commits, next submission round and normal source-branch push |
|
|
1537
|
+
|
|
1538
|
+
Resolve the human reviewer and remote destination from repository/session context or unambiguous configured upstream/push remote. Ask only if still unresolved. Inspect all worktrees and staged paths; preserve unrelated work and use isolation when needed. Never stage arbitrary implementation to make submission look complete. Missing implementation commits are a readiness gap unless their scoped creation is separately authorised. Do not force-push, push all branches/tags, or push the target under submission authority.
|
|
1539
|
+
|
|
1540
|
+
Verify remote source tip after pushing. Authentication failure, rejection or divergence leaves the submission awaiting sharing. A copy-ready notification names reviewer, outcome, round, source/target, actual checks, focus and an accessible revision-pinned submission reference. A local-only submission is prepared locally, not ready for remote review. Do not invent host URLs or treat localhost previews as remote access. A decision committed in a reviewer\u2019s separate clone is local until shared. Report the decision commit and the agreed handoff mechanism; ask for a source-branch push only if needed and not already authorised, then verify the remote tip. Never claim an unshared decision is available to the developer. Sending messages, creating hosted requests, target pushes, deployment and branch deletion need their own explicit authority.
|
|
1541
|
+
|
|
1542
|
+
## Merge and recovery
|
|
1543
|
+
|
|
1544
|
+
Assessment reports findings without fixing implementation. Human acceptance is distinct from explicit merge authority, and old approval never transfers automatically to new revisions. On rejection retain branch/history and hand findings to merge-respond.
|
|
1545
|
+
|
|
1546
|
+
For an authorised merge use a clean target worktree; never displace or reset another developer's checkout. Verify local target equals accepted T and source matches the accepted history. Prefer a normal --no-ff merge preserving delivery commits unless owner policy specifies otherwise. If conflicts occur, preserve the original work, abort the attempted merge in the isolated clean target worktree, and return to the developer for resolution, verification and resubmission. Do not resolve implementation conflicts under old acceptance.
|
|
1547
|
+
|
|
1548
|
+
Run proportionate integration verification on the merged tree. Report merge commit, actual checks and remaining limitations. Failed checks mean an integrated failure, not a successful handoff; do not automatically revert or deploy. Review records do not change packet lanes or hosted board state and are not authenticated approval enforcement.
|
|
1549
|
+
`;
|
|
1550
|
+
exports2.DELIVERY_CONTRACT = `# Delivery Ownership And Branches
|
|
1551
|
+
|
|
1552
|
+
For an authorised one-shot with \`SWARMCRAFT_ONE_SHOT_DELIVERY=direct\`, work in the supplied current branch/worktree. Do not require a responsible developer, separate source branch, merge target or merge request as a precondition; do not create or switch branches. This explicit run policy overrides branch-delivery prerequisites only. Checking/reviewing and commit policies remain independent, Doing implementation and validation remain mandatory, and push/merge/deployment are not authorised. With delivery absent or \`branch\`, the normal delivery contract applies.
|
|
1553
|
+
|
|
1554
|
+
During planning, record one responsible developer, source branch and merge target in an initiative's Delivery section. Default source to the plan filename stem, adjusted for repository naming conventions. Direct packets use ### Delivery under ## Notes and a bounded branch derived from the task slug. Keep unresolved owner/target explicit; a proposed branch name is intent, not an existing branch. Do not add packet schema fields or mirror lifecycle state in plans.
|
|
1555
|
+
|
|
1556
|
+
Planning alone does not create or switch branches. Before authorised implementation or preparation commits, resolve delivery context, inspect Git status, current branch, other worktrees, the target baseline and any existing source branch. Do not implement on the target branch. Create the source from the resolved target or reuse it only when ownership and scope match. A same-name unrelated branch is a collision, not permission to adopt it. Never reset, force, silently rebase/cherry-pick, or carry unrelated staged/dirty work onto a new branch.
|
|
1557
|
+
|
|
1558
|
+
If another effort occupies this checkout, use a separate worktree. If the plan or packets exist only on a different branch or as uncommitted files, establish an explicit scoped transfer arrangement before dependent work; do not lose them or assume they exist in the new worktree. Ask only for genuinely unresolved context or authority. A branch operation does not authorise commits, push, merge or deployment beyond existing instructions.
|
|
1559
|
+
|
|
1560
|
+
All initiative phases/packets use the recorded source unless an explicit staged/parallel arrangement names branches, dependencies and integration order. Preserve packet paths/UUIDs. Pass the selected worktree to one-shot preview and execution; its clean-start rule still applies. Before resume, verify the recorded run workspace, branch and packet context. Never switch branches in a running/resumed run. A child do/check stage validates context but must not create branches, switch worktrees or launch a nested run. Missing legacy context is resolved before dependent execution, not inferred from a task's done status.
|
|
1561
|
+
|
|
1562
|
+
Interactive do validates this same context before editing. Merge-request consumes it and validates actual refs. A new remediation plan has its own branch and an explicitly authorised integration route back to the submission source. Use existing repository conventions without bulk migration of old plans or packets.
|
|
1563
|
+
`;
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
|
|
1567
|
+
// ../../packages/repo-seed/dist/templates/merge/templates.js
|
|
1568
|
+
var require_templates = __commonJS({
|
|
1569
|
+
"../../packages/repo-seed/dist/templates/merge/templates.js"(exports2) {
|
|
1570
|
+
"use strict";
|
|
1571
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1572
|
+
exports2.MERGE_EXAMPLES = exports2.MESSAGE_TEMPLATE = exports2.RESPONSE_TEMPLATE = exports2.REVIEW_TEMPLATE = exports2.SUBMISSION_TEMPLATE = void 0;
|
|
1573
|
+
exports2.SUBMISSION_TEMPLATE = `# Merge submission: <slug>
|
|
1574
|
+
|
|
1575
|
+
Current round: 1
|
|
1576
|
+
|
|
1577
|
+
## Round 1
|
|
1578
|
+
|
|
1579
|
+
### Scope and revisions
|
|
1580
|
+
|
|
1581
|
+
- Developer: <human>
|
|
1582
|
+
- Reviewer: <human and agreed remit>
|
|
1583
|
+
- Specialist assessment: <person/remit or not required>
|
|
1584
|
+
- Submitted on: <date and timezone>
|
|
1585
|
+
- Plans/packets: <relative links and packet UUIDs>
|
|
1586
|
+
- Scope: <completed initiative/direct packet/agreed bounded deliverable>
|
|
1587
|
+
- Source branch: <branch>
|
|
1588
|
+
- Target branch: <branch>
|
|
1589
|
+
- Implementation commit: <full A before record commit>
|
|
1590
|
+
- Target baseline: <full T>
|
|
1591
|
+
- Merge base: <full B>
|
|
1592
|
+
- Completion policy: <normal or recorded one-shot policy; actual skipped stages>
|
|
1593
|
+
|
|
1594
|
+
### Outcome and verification
|
|
1595
|
+
|
|
1596
|
+
<Problem solved, resulting behaviour, affected boundaries, actual commands/results, integration against target, unavailable checks and linked evidence.>
|
|
1597
|
+
|
|
1598
|
+
### How to review
|
|
1599
|
+
|
|
1600
|
+
<Setup, commands, journeys and expected outcomes. Include accessible preview/prototype location and limitations only when relevant.>
|
|
1601
|
+
|
|
1602
|
+
### Risks and remaining scope
|
|
1603
|
+
|
|
1604
|
+
<Compatibility, migration, security, operations/recovery, agreed deferrals and remaining plan work. Submission does not authorise deployment.>
|
|
1605
|
+
|
|
1606
|
+
### Response to previous review
|
|
1607
|
+
|
|
1608
|
+
<First round: not applicable. Later rounds: link response.md and map every outstanding required finding by original ID to delivered changes/commits, verification and pending reviewer decisions. Do not declare reviewer resolution.>
|
|
1609
|
+
|
|
1610
|
+
<!-- Append subsequent rounds with their own revisions; preserve history. -->
|
|
1611
|
+
`;
|
|
1612
|
+
exports2.REVIEW_TEMPLATE = `# Merge review: <slug>
|
|
1613
|
+
|
|
1614
|
+
Current round: 1
|
|
1615
|
+
|
|
1616
|
+
## Round 1
|
|
1617
|
+
|
|
1618
|
+
- Submission: [Round 1](submission.md#round-1)
|
|
1619
|
+
- Accountable reviewer: <human>
|
|
1620
|
+
- Assessed by: <AI/human; specialist remit if applicable>
|
|
1621
|
+
- Assessment date: <date and timezone>
|
|
1622
|
+
- Implementation commit: <full A>
|
|
1623
|
+
- Target baseline: <full T>
|
|
1624
|
+
- Source tip inspected: <full revision including record-only commits>
|
|
1625
|
+
|
|
1626
|
+
### Findings
|
|
1627
|
+
|
|
1628
|
+
| ID | Severity | Required or suggestion | Evidence and impact | Requested action |
|
|
1629
|
+
| --- | --- | --- | --- | --- |
|
|
1630
|
+
| <R1-F1> | <severity> | <classification> | <path/behaviour> | <action> |
|
|
1631
|
+
|
|
1632
|
+
<Remove placeholder rows; say no findings only after assessment.>
|
|
1633
|
+
|
|
1634
|
+
### Previous findings
|
|
1635
|
+
|
|
1636
|
+
<For later rounds, preserve original IDs and link developer responses. Record assessment separately from actual human dispositions: pending, resolved, deferred, withdrawn or outstanding.>
|
|
1637
|
+
|
|
1638
|
+
### Verification and recommendation
|
|
1639
|
+
|
|
1640
|
+
<Commands/results, assessed boundaries, limitations, and recommendation. A recommendation is not the decision.>
|
|
1641
|
+
|
|
1642
|
+
### Human decision
|
|
1643
|
+
|
|
1644
|
+
- Decision: pending
|
|
1645
|
+
- Decided by: not yet recorded
|
|
1646
|
+
- Decided on: not yet recorded
|
|
1647
|
+
- Applies to implementation: not yet recorded
|
|
1648
|
+
- Applies to target baseline: not yet recorded
|
|
1649
|
+
- Rationale: not yet recorded
|
|
1650
|
+
- Acknowledged limitations: not yet recorded
|
|
1651
|
+
- Merge authority: not granted
|
|
1652
|
+
|
|
1653
|
+
<!-- Record only actual human decisions. Append later rounds without overwriting history. -->
|
|
1654
|
+
`;
|
|
1655
|
+
exports2.RESPONSE_TEMPLATE = `# Merge response: <slug>
|
|
1656
|
+
|
|
1657
|
+
## Response to round <N>
|
|
1658
|
+
|
|
1659
|
+
- Developer: <human>
|
|
1660
|
+
- Review: [Review](review.md#round-N)
|
|
1661
|
+
- Submission: [Submission](submission.md#round-N)
|
|
1662
|
+
- Reviewed implementation: <full A>
|
|
1663
|
+
- Source branch: <branch>
|
|
1664
|
+
- Agreed approach: <instruction/date or pending>
|
|
1665
|
+
|
|
1666
|
+
| Finding ID | Required or suggestion | Route | Developer state | Delivered work | Verification |
|
|
1667
|
+
| --- | --- | --- | --- | --- | --- |
|
|
1668
|
+
| <R1-F1> | <classification> | <direct fix/new packet/new plan> | <planned/in progress/addressed/needs clarification/deferral proposed> | <paths, full commits or explicitly uncommitted work, packet/plan links> | <actual commands/results> |
|
|
1669
|
+
|
|
1670
|
+
### Approach and outstanding decisions
|
|
1671
|
+
|
|
1672
|
+
<Reasons, dependencies, integration route for another branch, clarification/disagreement/deferral requests. Creating records is not delivering fixes; only the reviewer resolves findings.>
|
|
1673
|
+
|
|
1674
|
+
### Handoff
|
|
1675
|
+
|
|
1676
|
+
<Verified changes, limitations, remaining required work, commit status, readiness and next action. Do not push or resubmit unless requested. Preserve earlier rounds.>
|
|
1677
|
+
`;
|
|
1678
|
+
exports2.MESSAGE_TEMPLATE = `Merge review requested: <project/outcome> (round <N>)
|
|
1679
|
+
|
|
1680
|
+
<Reviewer>, <ready for review via the verified shared revision, or prepared locally and awaiting sharing>.
|
|
1681
|
+
|
|
1682
|
+
- Outcome: <one sentence>
|
|
1683
|
+
- Branch: <source> \u2192 <target>
|
|
1684
|
+
- Submission: <verified revision-pinned link or shared repository + record path + full record commit>
|
|
1685
|
+
- Verification: <actual checks and gaps, including skipped AI/human task stages>
|
|
1686
|
+
- Review focus: <important decisions and remaining required findings>
|
|
1687
|
+
- Previous feedback: <addressed findings for resubmission; omit on first round>
|
|
1688
|
+
|
|
1689
|
+
Use swarmcraft-merge-review to assess the submission and record your decision. Authorise merging explicitly when ready.
|
|
1690
|
+
|
|
1691
|
+
<!-- Return filled text in chat; never send automatically or invent remote access. -->
|
|
1692
|
+
`;
|
|
1693
|
+
exports2.MERGE_EXAMPLES = `# Merge Workflow Examples
|
|
1694
|
+
|
|
1695
|
+
These are illustrative walkthroughs, not actual approvals or verification evidence.
|
|
1696
|
+
|
|
1697
|
+
1. A developer finishes the approval-routing initiative on approval-routing-plan targeting main. The packets are done under their recorded policy and integration checks passed. A normal submit request captures A/T/B, writes round 1, commits S and pushes only the source. A draft would stop before commit; local-only would stop before push.
|
|
1698
|
+
2. The reviewer requests assessment only. AI records R1-F1 as a required missing permission check and recommends rejection. Decision stays pending, no commit and no implementation edit. The human then explicitly rejects round 1; that authorises only decision-record commit D.
|
|
1699
|
+
3. The developer requests a direct fix and resubmission. The agent fixes and tests the permission boundary, records evidence against R1-F1 and commits the authorised fix. It preserves the original completed packet. For a larger independent outcome it would create a new packet; architectural changes use a new plan and an agreed branch integration route. Neither record creation nor developer addressed resolves R1-F1.
|
|
1700
|
+
4. The developer resubmits round 2 with new A/T/B and links the response. The reviewer assesses the actual fix and explicitly resolves R1-F1. Acceptance-only records the human decision but does not merge. An explicit accept-and-merge instruction also permits the clean-target merge and its verification, not a target push or deployment.
|
|
1701
|
+
5. If main advances, refresh the submission and integration assessment before accepting or merging. If a source commit changes code and another reverts it, resubmit anyway. A conflict returns to the developer; a failed post-merge check is reported as an integrated failure.
|
|
1702
|
+
6. For one direct packet, use its UUID/path and Delivery notes without creating an initiative. For a bounded phase submission, name remaining phases. For coordinated projects, list every plan/packet and affected contract. One-shot skipped review is disclosed, never described as human approval. An agreed independent supervisor remains required even if one person could otherwise fill both roles.
|
|
1703
|
+
`;
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
|
|
1707
|
+
// ../../packages/repo-seed/dist/templates/renderMerge.js
|
|
1708
|
+
var require_renderMerge = __commonJS({
|
|
1709
|
+
"../../packages/repo-seed/dist/templates/renderMerge.js"(exports2) {
|
|
1710
|
+
"use strict";
|
|
1711
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1712
|
+
exports2.MERGE_SKILLS = void 0;
|
|
1713
|
+
exports2.renderMergeSkill = renderMergeSkill;
|
|
1714
|
+
exports2.renderMergeSeedFiles = renderMergeSeedFiles;
|
|
1715
|
+
var packet_workflow_1 = require_dist();
|
|
1716
|
+
var contract_1 = require_contract();
|
|
1717
|
+
var templates_1 = require_templates();
|
|
1718
|
+
exports2.MERGE_SKILLS = ["merge-request", "merge-review", "merge-respond"];
|
|
1719
|
+
var descriptions = {
|
|
1720
|
+
"merge-request": "Prepare or resubmit a completed SwarmCraft initiative, bounded phase range or direct packet for human merge review, with repository records and verified source-branch sharing.",
|
|
1721
|
+
"merge-review": "Assess a SwarmCraft merge submission, record the human reviewer's decision, and perform an explicitly authorised merge. Separate from packet-level task review.",
|
|
1722
|
+
"merge-respond": "Address SwarmCraft merge-review findings through direct fixes, new packets or a new plan, preserving finding-level evidence for the reviewer. Resubmit only when requested."
|
|
1723
|
+
};
|
|
1724
|
+
var workflows = {
|
|
1725
|
+
"merge-request": `1. Read repository instructions, selected plan/packets, Delivery context and existing submission/review/response rounds. Establish developer, named reviewer, source, target and submission slug. Confirm the bounded scope is complete under its actual packet execution policy and inspect integration evidence. Do not silently commit unfinished work.
|
|
1726
|
+
2. Inspect worktrees, status, staging and remote configuration. Resolve missing/ambiguous reviewer or destination before submission. For remote sharing, fetch source/target refs, inspect divergence and use the current remote target baseline. Do not reset/rebase. Capture full implementation A, target T and merge base B before record commits.
|
|
1727
|
+
3. Adapt [submission template](assets/submission-template.md) into .reviews/<slug>/submission.md. Include outcome, affected boundaries, plan/packet links, actual commands/results, skipped stages, review/demo steps, relevant accessible previews and risks. Use repository-relative links from the record, not skill-install paths.
|
|
1728
|
+
4. For resubmission, append the next numbered round and trace every outstanding required finding by original ID through response.md to delivered changes and actual verification. Preserve prior rounds and human decisions. Label unresolved clarification/deferral requests honestly; never call them resolved or claim readiness with outstanding required work.
|
|
1729
|
+
5. For a normal submit request, commit only this submission's review records on the source branch, preserving unrelated staged work. Draft-only stops before commit; local-only stops before push. A normal submission authorises a non-force push of only that source branch to the resolved destination, not hosted request creation or target push. Verify the actual remote tip after pushing; failures leave sharing incomplete.
|
|
1730
|
+
6. Report A, record commit, target baseline, destination, actual sharing outcome and pending issues. Return filled copy-ready text from [reviewer message](assets/reviewer-message-template.md). Never send it automatically. A reviewer needs an accessible revision-pinned reference or shared repository/path/commit; never invent links.`,
|
|
1731
|
+
"merge-review": `1. Read selected submission round, existing decisions/responses, relevant plan/packets and repository instructions. Identify the accountable human reviewer and any agreed independent/specialist assessment. Verify full A/T/B, source ancestry and EVERY intervening commit under the narrow record-only exception. Refresh remote target when applicable. Changed source or target needs resubmission/reassessment before acceptance or merge.
|
|
1732
|
+
2. Assess the actual implementation and target-side changes against scope, acceptance criteria and integration evidence. Run proportionate checks or state why unavailable. Distinguish baseline issues from introduced defects. Do not silently fix implementation, change packet lanes or rewrite task approvals.
|
|
1733
|
+
3. Adapt [review template](assets/review-template.md) into .reviews/<slug>/review.md. Report stable finding IDs, severity, evidence/impact, required versus suggestion, requested action, verification and limitations. In later rounds inspect response.md and retain original finding IDs. Recommendations and pending dispositions remain separate from human decisions.
|
|
1734
|
+
4. Present review/demo steps and ask for the human decision only if it is not already explicitly given for these revisions. Record the real identity, date, rationale, A/T, acknowledged limitations and explicit dispositions of required findings. Acceptance must not silently waive them. Rejection retains the branch and routes to [merge respond](../swarmcraft-merge-respond/SKILL.md).
|
|
1735
|
+
5. Explicit acceptance/rejection permits committing only this submission's decision records. Assessment-only permits no commit. Acceptance alone never permits merge or push. Report the decision-record commit after it exists. If the developer uses another clone, report how to share that decision through an agreed mechanism; a source-branch push needs explicit authority and remote-tip verification. Do not claim the developer can fetch a local-only decision.
|
|
1736
|
+
6. Only with explicit merge authority for these revisions, recheck source/target, decisions and checks, then merge the reviewed source including review records into a clean target worktree. Prefer --no-ff unless owner policy differs. Preserve other worktrees. Abort a conflicting attempted merge in that clean worktree and return for developer resolution and resubmission; never resolve implementation under stale acceptance.
|
|
1737
|
+
7. Verify the merged tree with appropriate integration checks and report merge commit/results. A failure remains an integrated failure, not success; do not auto-revert. No implied target push, deployment or branch deletion.`,
|
|
1738
|
+
"merge-respond": `1. Read all outstanding required findings across rounds, submission/review/response records, Delivery context and repository instructions. Establish developer, reviewed revision, source branch and worktree status. Preserve stable finding IDs; if missing, request that the reviewer establish them rather than rewriting decisions.
|
|
1739
|
+
2. Recommend a route per finding or related group: direct fix for bounded work; [plan](../swarmcraft-plan/SKILL.md) direct mode for a new focused packet followed by normal do/check/review or an explicitly selected one-shot policy; initiative mode for material architecture or phased scope. Confirm only when the route is not already authorised. Suggestions are optional. New-plan creation does not imply execution or integration authority.
|
|
1740
|
+
3. Adapt [response template](assets/response-template.md) into .reviews/<slug>/response.md. Append round sections and map every outstanding required finding to route, developer state, delivered paths/commits or packet/plan links, and actual checks. Keep completed packet history intact and do not alter reviewer decisions.
|
|
1741
|
+
4. Execute authorised direct fixes and verification, or follow the selected packet/plan workflow. Preserve any required task-review handoff instead of forcing done. A new plan gets its own Delivery branch and an explicit authorised integration route back; work on another branch is not a delivered submission fix.
|
|
1742
|
+
5. Record commands/results and limitations. Commit only with existing scoped authority; include finding IDs in direct-fix commit messages and preserve repository task commit conventions. Identify uncommitted work honestly. Addressed is a developer claim; only the human reviewer resolves, defers or withdraws required findings.
|
|
1743
|
+
6. Stop at the agreed verified handoff or a concrete blocker. No default push, merge, deployment or resubmission. An explicit respond-and-resubmit request authorises necessary scoped fix/response commits and invoking [merge request](../swarmcraft-merge-request/SKILL.md) for the next round and normal source push. Label unresolved work honestly.`
|
|
1744
|
+
};
|
|
1745
|
+
function renderMergeSkill(action) {
|
|
1746
|
+
return `---
|
|
1747
|
+
name: swarmcraft-${action}
|
|
1748
|
+
description: ${JSON.stringify(descriptions[action])}
|
|
1749
|
+
---
|
|
1750
|
+
|
|
1751
|
+
# SwarmCraft ${action.split("-").map((word) => word[0].toUpperCase() + word.slice(1)).join(" ")}
|
|
1752
|
+
|
|
1753
|
+
Read [the merge workflow](references/merge-workflow.md) before acting and [delivery context](references/delivery.md) when resolving branches. Resolve these links from this installed skill; resolve customer records from the selected repository. [Examples](references/examples.md) illustrate rounds and authority when needed.
|
|
1754
|
+
|
|
1755
|
+
${workflows[action]}
|
|
1756
|
+
`;
|
|
1757
|
+
}
|
|
1758
|
+
function renderMergeSeedFiles(provider) {
|
|
1759
|
+
const root = (0, packet_workflow_1.getProviderSkillRoot)(provider);
|
|
1760
|
+
return exports2.MERGE_SKILLS.flatMap((action) => {
|
|
1761
|
+
const directory = `${root}/swarmcraft-${action}`;
|
|
1762
|
+
const resources = {
|
|
1763
|
+
"SKILL.md": renderMergeSkill(action),
|
|
1764
|
+
"references/merge-workflow.md": contract_1.MERGE_CONTRACT,
|
|
1765
|
+
"references/delivery.md": contract_1.DELIVERY_CONTRACT,
|
|
1766
|
+
"references/examples.md": templates_1.MERGE_EXAMPLES,
|
|
1767
|
+
...action === "merge-request" ? { "assets/submission-template.md": templates_1.SUBMISSION_TEMPLATE, "assets/reviewer-message-template.md": templates_1.MESSAGE_TEMPLATE } : action === "merge-review" ? { "assets/review-template.md": templates_1.REVIEW_TEMPLATE } : { "assets/response-template.md": templates_1.RESPONSE_TEMPLATE }
|
|
1768
|
+
};
|
|
1769
|
+
const files = Object.entries(resources).map(([name, contents]) => ({ relativePath: `${directory}/${name}`, contents }));
|
|
1770
|
+
if (provider === "copilot")
|
|
1771
|
+
files.push({ relativePath: `.github/prompts/${action}.prompt.md`, contents: `---
|
|
1772
|
+
description: ${JSON.stringify(descriptions[action])}
|
|
1773
|
+
---
|
|
1774
|
+
|
|
1775
|
+
Follow [swarmcraft-${action}](../skills/swarmcraft-${action}/SKILL.md) for the requested scope.
|
|
1776
|
+
` });
|
|
1777
|
+
return files;
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1402
1783
|
// ../../packages/repo-seed/dist/workspaceTracking.js
|
|
1403
1784
|
var require_workspaceTracking = __commonJS({
|
|
1404
1785
|
"../../packages/repo-seed/dist/workspaceTracking.js"(exports2) {
|
|
@@ -1505,6 +1886,12 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
1505
1886
|
"Preserve packet identity and sync fields unless SwarmCraft tooling rewrites them."
|
|
1506
1887
|
]),
|
|
1507
1888
|
"",
|
|
1889
|
+
"## Delivery And Integration",
|
|
1890
|
+
"",
|
|
1891
|
+
"For an authorised one-shot with `SWARMCRAFT_ONE_SHOT_DELIVERY=direct`, work in the supplied current branch/worktree. Do not require a responsible developer, separate source branch, merge target or merge request as a precondition; do not create or switch branches. This explicit run policy overrides branch-delivery prerequisites only. Checking/reviewing and commit policies remain independent, Doing implementation and validation remain mandatory, and push/merge/deployment are not authorised. With delivery absent or `branch`, the normal delivery contract applies.",
|
|
1892
|
+
"",
|
|
1893
|
+
"Read the linked initiative Delivery section or packet Delivery notes. Before interactive do edits or preparation commits, read `../swarmcraft-plan/references/delivery.md` and verify developer, source branch, merge target and worktree. Resolve missing legacy context; never implement on the target or silently switch branches. One-shot child stages only validate their run context. Completed task review is distinct from integration review: use `swarmcraft-merge-request` only when submission is requested, `swarmcraft-merge-review` for the named human integration decision, and `swarmcraft-merge-respond` for its feedback. Do not change lanes or launch merge work merely because a task completes.",
|
|
1894
|
+
"",
|
|
1508
1895
|
"## One-Shot Execution Policy",
|
|
1509
1896
|
"",
|
|
1510
1897
|
"When a V4 packet contains `execution`, preserve that runner-owned policy. The CLI alone records skipped Checking/Reviewing stages and final completion for an authorised one-shot run. Do not tick skipped items or invent Human Review evidence. Always complete Doing and its implementation validation. An interactive agent without this explicit run policy follows the normal human-review completion rule. Child stages must never launch another plan implementation run.",
|
|
@@ -1632,10 +2019,16 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
1632
2019
|
"Split a reusable design-system extension from consumer adoption when either is independently reviewable or introduces a public API, dependency, ownership, multi-consumer migration, compatibility, rollback, or review boundary. Name affected consumers and migration order."
|
|
1633
2020
|
]),
|
|
1634
2021
|
"",
|
|
2022
|
+
"## Delivery Context",
|
|
2023
|
+
"",
|
|
2024
|
+
"Read `references/delivery.md` for both Direct and Initiative modes. Record one responsible developer, source branch and merge target in the initiative Delivery section or `### Delivery` under direct-packet `## Notes`. Planning records intent without branch mutations. Defaults follow the plan filename stem or direct task slug and repository naming conventions. Keep unresolved identities/targets explicit; resolve them before dependent execution.",
|
|
2025
|
+
"",
|
|
1635
2026
|
"## Implement An Existing Plan Or Packet",
|
|
1636
2027
|
"",
|
|
1637
2028
|
"`action=implement plan=<path> [phase=<anchor>]` or `action=implement packet=<path>` executes an existing scope; Direct and Initiative remain the two planning modes. A request to plan alone never authorises execution. Inspect the accepted plan, packet prerequisites and current repository before launch. Materialize only the explicitly requested scope when needed; preserve already linked packet identities.",
|
|
1638
2029
|
"",
|
|
2030
|
+
"Before preparation commits or launch, follow `references/delivery.md`: inspect branch/worktrees/status, resolve ownership and target, and create or reuse the intended source only within implementation authority. Never implement on the target, adopt an unrelated same-name branch, or transfer unrelated work. Use a separate worktree when needed and explicitly arrange transfer of relevant plan/packet files. Pass that selected worktree as --workspace to preview and execution. A child stage validates context without branch switching or nested execution.",
|
|
2031
|
+
"",
|
|
1639
2032
|
"Read `swarmcraft one-shot --help` and confirm local --plan/--packet, --phase and --preview support before attempting execution. If the installed CLI lacks these capabilities, report the needed CLI upgrade; do not simulate a loop, invent commands or fall back to a hosted project-wide run. Use the repository's selected provider. External-provider local execution needs no SwarmCraft account; Managed AI remains hosted-only.",
|
|
1640
2033
|
"",
|
|
1641
2034
|
"New work needs V4 packets with recommendedOrder and explicit dependsOn UUID arrays. For legacy work, preview a scoped `swarmcraft upgrade --workspace . --ordered-packets --packet <path> --check`, then apply the authorised migration and resolve prerequisite declarations from the reviewed plan. Missing prerequisites are not independence. Never rename legacy packets merely to run them. Commit preparation changes before execution; local one-shot requires a clean starting worktree.",
|
|
@@ -1646,6 +2039,8 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
1646
2039
|
"",
|
|
1647
2040
|
"After inspecting selection and prerequisites, invoke that same command without --preview within the owner's execution authorisation. Use --commit-policy done when task commits are requested. Quote paths as arguments for the target shell. Observe the manifest and process to terminal completion; a successful launch is not completed work. Do not recursively invoke this action from a child do/check stage. If a provider cannot run from the current agent environment, report its real error and an exact terminal command instead of changing providers or credentials.",
|
|
1648
2041
|
"",
|
|
2042
|
+
"Before resume, verify the run workspace, recorded branch and packet Delivery context; do not silently switch a running or resumed workflow. Missing context or a wrong branch blocks dependent execution until resolved.",
|
|
2043
|
+
"",
|
|
1649
2044
|
"Use `swarmcraft status --workspace . --run <id>` and `swarmcraft resume --workspace . --run <id>` for recovery. Scope and policy stay frozen. Inspect changed packets before explicit --accept-packet-changes and interrupted logs before --retry-interrupted; never add those flags automatically to hide uncertainty. Report completed, blocked, review-required and skipped work separately, including commits and actual validation evidence.",
|
|
1650
2045
|
"",
|
|
1651
2046
|
"## Mode Selection",
|
|
@@ -1708,6 +2103,8 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
1708
2103
|
"",
|
|
1709
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.`,
|
|
1710
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
|
+
"",
|
|
1711
2108
|
"A local packet must include:",
|
|
1712
2109
|
"",
|
|
1713
2110
|
...(0, packet_workflow_1.renderBullets)([
|
|
@@ -1721,10 +2118,54 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
1721
2118
|
"",
|
|
1722
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.",
|
|
1723
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
|
+
"",
|
|
1724
2165
|
"Before handing off a local packet, validate that:",
|
|
1725
2166
|
"",
|
|
1726
2167
|
...(0, packet_workflow_1.renderBullets)([
|
|
1727
|
-
"`packetId` is a stable random UUID and `swarmcraftVersion` is `
|
|
2168
|
+
"`packetId` is a stable random UUID and `swarmcraftVersion` is `4`",
|
|
1728
2169
|
"`projectId` is optional; when present it comes from an explicit authorised binding",
|
|
1729
2170
|
"`lane` reflects current work rather than registration status",
|
|
1730
2171
|
"all six required packet sections are present",
|
|
@@ -1759,6 +2200,7 @@ var require_renderAssistantActionSkills = __commonJS({
|
|
|
1759
2200
|
"# SwarmCraft Test",
|
|
1760
2201
|
"",
|
|
1761
2202
|
"Use this skill to improve testing evidence without adding a new workflow lane or silently switching into implementation work.",
|
|
2203
|
+
"Testing evidence can support `swarmcraft-merge-request`; it is not a human merge decision or authority to submit, push or merge.",
|
|
1762
2204
|
"",
|
|
1763
2205
|
"## Required Context",
|
|
1764
2206
|
"",
|
|
@@ -3141,6 +3583,7 @@ var require_renderProjectGuide = __commonJS({
|
|
|
3141
3583
|
"When copied from the VS Code extension, the exact command format follows the workspace's selected AI provider:",
|
|
3142
3584
|
"",
|
|
3143
3585
|
"- Copilot copies `/plan`, `/do`, `/check`, `/review`, and `/test` prompt commands for `.github/prompts`.",
|
|
3586
|
+
"- Project skills also include swarmcraft-merge-request, swarmcraft-merge-review and swarmcraft-merge-respond for repository-owned integration review. They are separate from packet lanes; task Done does not authorise a merge or deployment.",
|
|
3144
3587
|
"- Codex copies `$swarmcraft-plan`, `$swarmcraft-do`, `$swarmcraft-check`, `$swarmcraft-review`, and `$swarmcraft-test` skill invocations for `.agents/skills`.",
|
|
3145
3588
|
"- Copilot can invoke `/prototype`; Codex can invoke `$swarmcraft-prototype` when a collaborative decision prototype is useful.",
|
|
3146
3589
|
"",
|
|
@@ -3975,11 +4418,13 @@ var require_renderPlanning = __commonJS({
|
|
|
3975
4418
|
exports2.renderPlanningSeedFiles = renderPlanningSeedFiles;
|
|
3976
4419
|
exports2.renderPlanContract = renderPlanContract;
|
|
3977
4420
|
exports2.renderInitiativePlanTemplate = renderInitiativePlanTemplate;
|
|
4421
|
+
var contract_1 = require_contract();
|
|
3978
4422
|
var packet_workflow_1 = require_dist();
|
|
3979
4423
|
function renderPlanningSeedFiles(provider) {
|
|
3980
4424
|
const root = `${(0, packet_workflow_1.getProviderSkillRoot)(provider)}/swarmcraft-plan`;
|
|
3981
4425
|
return [
|
|
3982
4426
|
{ relativePath: `${root}/references/plan-contract.md`, contents: renderPlanContract() },
|
|
4427
|
+
{ relativePath: `${root}/references/delivery.md`, contents: contract_1.DELIVERY_CONTRACT },
|
|
3983
4428
|
{ relativePath: `${root}/assets/initiative-plan-template.md`, contents: renderInitiativePlanTemplate() }
|
|
3984
4429
|
];
|
|
3985
4430
|
}
|
|
@@ -4012,6 +4457,10 @@ Read repository instructions and only the discovery documents, code surfaces, ex
|
|
|
4012
4457
|
- Inspect the worktree before writing. Preserve unrelated changes and do not include them in a plan commit.
|
|
4013
4458
|
- Create or update the plan only when requested. Never silently rewrite an existing plan or board-linked packet.
|
|
4014
4459
|
|
|
4460
|
+
## Delivery
|
|
4461
|
+
|
|
4462
|
+
Read [delivery ownership and branches](delivery.md) before recording delivery intent or preparing execution. Include one responsible developer, source branch and merge target in the plan. Planning does not switch branches. Resolve missing legacy context before execution; preserve existing work and conventions.
|
|
4463
|
+
|
|
4015
4464
|
## Required Content
|
|
4016
4465
|
|
|
4017
4466
|
The plan contains an objective, locked decisions, current context, target shape when material, ordered outcome-oriented phases, dependencies, risks, success criteria, review points, assumptions, unresolved questions, and packet links. Each phase states a goal and durable outcome. It does not copy packet checklists or track lanes, ordering, checklist completion, approval state, or board status.
|
|
@@ -4063,6 +4512,12 @@ The planning skill's action=implement hands accepted plan or direct-packet scope
|
|
|
4063
4512
|
|
|
4064
4513
|
<One testable statement of the intended initiative outcome.>
|
|
4065
4514
|
|
|
4515
|
+
## Delivery
|
|
4516
|
+
|
|
4517
|
+
- Developer: <responsible human, or explicitly unresolved>
|
|
4518
|
+
- Source branch: <plan filename stem, respecting repository conventions>
|
|
4519
|
+
- Merge target: <target branch, or explicitly unresolved>
|
|
4520
|
+
|
|
4066
4521
|
## Locked Decisions
|
|
4067
4522
|
|
|
4068
4523
|
- <Decision already made and the boundary it establishes.>
|
|
@@ -4577,6 +5032,7 @@ var require_seedProjectContext = __commonJS({
|
|
|
4577
5032
|
exports2.buildStaticProjectSeedFiles = buildStaticProjectSeedFiles;
|
|
4578
5033
|
exports2.buildDynamicProjectSeedFiles = buildDynamicProjectSeedFiles;
|
|
4579
5034
|
exports2.buildProjectSeedFiles = buildProjectSeedFiles;
|
|
5035
|
+
var renderMerge_1 = require_renderMerge();
|
|
4580
5036
|
var workspaceTracking_1 = require_workspaceTracking();
|
|
4581
5037
|
var packet_workflow_1 = require_dist();
|
|
4582
5038
|
var renderAssistantActionSkills_1 = require_renderAssistantActionSkills();
|
|
@@ -4687,6 +5143,7 @@ var require_seedProjectContext = __commonJS({
|
|
|
4687
5143
|
...packet_workflow_1.SWARMCRAFT_ASSISTANT_ACTIONS.map((action) => ({ relativePath: action.claudeSkillPath, contents: (0, renderAssistantActionSkills_1.renderSwarmCraftActionSkillFile)(action.key) }))
|
|
4688
5144
|
] : provider === "copilot" ? copilotFiles : codexFiles,
|
|
4689
5145
|
...(0, renderPlanning_1.renderPlanningSeedFiles)(provider),
|
|
5146
|
+
...(0, renderMerge_1.renderMergeSeedFiles)(provider),
|
|
4690
5147
|
...(0, renderReports_1.renderReportSeedFiles)(provider),
|
|
4691
5148
|
...(0, renderPrototype_1.renderPrototypeSeedFiles)(provider),
|
|
4692
5149
|
...(0, renderDesign_1.renderDesignSeedFiles)(provider)
|
|
@@ -17156,7 +17613,7 @@ var require_seedProjectFiles = __commonJS({
|
|
|
17156
17613
|
var seedOperationProject_1 = require_seedOperationProject();
|
|
17157
17614
|
exports2.ROOT_AGENTS_FILE_PATH = "AGENTS.md";
|
|
17158
17615
|
exports2.PROJECT_SEED_STATE_PATH = ".swarmcraft/project.seed-state.json";
|
|
17159
|
-
exports2.PROJECT_TEMPLATE_SET_VERSION =
|
|
17616
|
+
exports2.PROJECT_TEMPLATE_SET_VERSION = 16;
|
|
17160
17617
|
async function seedProjectFiles2(project, provider, dependencies, options = {}) {
|
|
17161
17618
|
const desired = [
|
|
17162
17619
|
...classifyFiles((0, seedProjectContext_1.buildDynamicProjectSeedFiles)(project), "dynamic", provider),
|
|
@@ -68444,6 +68901,7 @@ __export(main_exports, {
|
|
|
68444
68901
|
runAuthLogin: () => runAuthLogin
|
|
68445
68902
|
});
|
|
68446
68903
|
module.exports = __toCommonJS(main_exports);
|
|
68904
|
+
var import_packet_workflow9 = __toESM(require_dist(), 1);
|
|
68447
68905
|
|
|
68448
68906
|
// src/browserAuth.ts
|
|
68449
68907
|
var import_node_crypto = require("node:crypto");
|
|
@@ -69001,6 +69459,8 @@ async function buildAgentEnvironment(options, stageEnv) {
|
|
|
69001
69459
|
env2.SWARMCRAFT_DRIVER_AUTO_COMMIT = "true";
|
|
69002
69460
|
env2.SWARMCRAFT_CLI_AUTO_COMMIT = "true";
|
|
69003
69461
|
}
|
|
69462
|
+
env2.SWARMCRAFT_ONE_SHOT_DELIVERY = (0, import_packet_workflow.parseDeliveryMode)(options.delivery);
|
|
69463
|
+
env2.SWARMCRAFT_ONE_SHOT_REVIEWING = options.reviewing ? "on" : "off";
|
|
69004
69464
|
env2.SWARMCRAFT_ONE_SHOT_CHECKING = options.checking ? "on" : "off";
|
|
69005
69465
|
if (!options.agentApiKeyEnvName) return env2;
|
|
69006
69466
|
const envFileValues = options.agentEnvFilePath ? await readEnvFile(options.agentEnvFilePath) : {};
|
|
@@ -69151,7 +69611,12 @@ async function selectLocalPackets(root, selectors) {
|
|
|
69151
69611
|
const paths = /* @__PURE__ */ new Map();
|
|
69152
69612
|
for (const name of await discover(root, ".swarmcraft/projects")) {
|
|
69153
69613
|
const contents = await readContainedLocal(root, name);
|
|
69154
|
-
|
|
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
|
+
}
|
|
69155
69620
|
const id = (0, import_packet_workflow2.localPacketId)(parsed);
|
|
69156
69621
|
if (records.has(id)) throw new Error(`Duplicate packet identity: ${name}`);
|
|
69157
69622
|
records.set(id, { path: name, contents, parsed });
|
|
@@ -69366,7 +69831,7 @@ async function executeLocalRun(manifest, resume) {
|
|
|
69366
69831
|
if (snapshot.lane === "doing" || snapshot.checking.some((item) => !item.completed)) throw new LocalRunBlocked(`Checking requires more work: ${selected.path}`);
|
|
69367
69832
|
}
|
|
69368
69833
|
snapshot.lane = options.reviewing && snapshot.lane !== "done" ? "reviewing" : "done";
|
|
69369
|
-
(0, import_packet_workflow3.
|
|
69834
|
+
(0, import_packet_workflow3.validatePacketCompletion)(snapshot);
|
|
69370
69835
|
if (snapshot.lane === "done") {
|
|
69371
69836
|
const entry = `### One-shot completion (${manifest.runId})
|
|
69372
69837
|
Implementation complete. Checking: ${options.checking ? "completed" : "explicitly skipped"}. Reviewing: ${options.reviewing ? "approved" : "explicitly skipped"}.`;
|
|
@@ -69406,12 +69871,12 @@ Implementation complete. Checking: ${options.checking ? "completed" : "explicitl
|
|
|
69406
69871
|
// src/main.ts
|
|
69407
69872
|
var import_promises15 = require("node:fs/promises");
|
|
69408
69873
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
69409
|
-
var
|
|
69874
|
+
var import_packet_workflow10 = __toESM(require_dist(), 1);
|
|
69410
69875
|
|
|
69411
69876
|
// package.json
|
|
69412
69877
|
var package_default = {
|
|
69413
69878
|
name: "@swarmcraftai/cli",
|
|
69414
|
-
version: "0.
|
|
69879
|
+
version: "0.9.1",
|
|
69415
69880
|
description: "Prepare repositories and run packet-based SwarmCraft agent workflows from the terminal.",
|
|
69416
69881
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
69417
69882
|
type: "module",
|
|
@@ -69609,9 +70074,10 @@ async function seedWorkspace(project, workspacePath, provider) {
|
|
|
69609
70074
|
}
|
|
69610
70075
|
|
|
69611
70076
|
// src/oneShot.ts
|
|
70077
|
+
var import_packet_workflow6 = __toESM(require_dist(), 1);
|
|
69612
70078
|
var import_promises7 = require("node:fs/promises");
|
|
69613
70079
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
69614
|
-
var
|
|
70080
|
+
var import_packet_workflow7 = __toESM(require_dist(), 1);
|
|
69615
70081
|
|
|
69616
70082
|
// src/workflows/one-shot-board-sync.ts
|
|
69617
70083
|
var import_packet_workflow5 = __toESM(require_dist(), 1);
|
|
@@ -69800,10 +70266,10 @@ async function runOneShot(client, accessTokenProvider, options) {
|
|
|
69800
70266
|
});
|
|
69801
70267
|
} catch (failure2) {
|
|
69802
70268
|
if (!(failure2 instanceof ManagedAiCreditsExhaustedError)) {
|
|
69803
|
-
if (options.agentProvider === "claude") {
|
|
69804
|
-
taskOutcome.outcome = "blocked-agent-failure";
|
|
70269
|
+
if (options.agentProvider === "claude" || failure2 instanceof import_packet_workflow6.DoingIncompleteError) {
|
|
70270
|
+
taskOutcome.outcome = failure2 instanceof import_packet_workflow6.DoingIncompleteError ? "blocked-doing-incomplete" : "blocked-agent-failure";
|
|
69805
70271
|
taskOutcome.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
69806
|
-
taskOutcome.elapsedMs = (0,
|
|
70272
|
+
taskOutcome.elapsedMs = (0, import_packet_workflow7.computeElapsedMs)(taskOutcome.startedAt, taskOutcome.finishedAt);
|
|
69807
70273
|
finalizeManifest(manifest);
|
|
69808
70274
|
await persistRunManifest(manifestPath, manifest);
|
|
69809
70275
|
}
|
|
@@ -69815,7 +70281,7 @@ async function runOneShot(client, accessTokenProvider, options) {
|
|
|
69815
70281
|
board = result.board;
|
|
69816
70282
|
taskOutcome.outcome = result.outcome;
|
|
69817
70283
|
taskOutcome.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
69818
|
-
taskOutcome.elapsedMs = (0,
|
|
70284
|
+
taskOutcome.elapsedMs = (0, import_packet_workflow7.computeElapsedMs)(taskOutcome.startedAt, taskOutcome.finishedAt);
|
|
69819
70285
|
printProgress(`Task ${taskIndex + 1}/${selectedTasks.length} finished as ${result.outcome} in ${formatDuration(taskOutcome.elapsedMs)}.`);
|
|
69820
70286
|
if (result.outcome === "done" || result.outcome === "manual-review-required") {
|
|
69821
70287
|
completedTaskIds.add(selectedTask.id);
|
|
@@ -69858,7 +70324,7 @@ function hasRemainingUncompletedTasks(selectedTasks, startIndex, completedTaskId
|
|
|
69858
70324
|
function finalizeManifest(manifest) {
|
|
69859
70325
|
manifest.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
69860
70326
|
manifest.status = resolveManifestStatus(manifest);
|
|
69861
|
-
manifest.durations = (0,
|
|
70327
|
+
manifest.durations = (0, import_packet_workflow7.summarizeWorkflowRunDurations)(manifest);
|
|
69862
70328
|
}
|
|
69863
70329
|
async function processTask(context) {
|
|
69864
70330
|
let currentBoard = context.board;
|
|
@@ -69868,7 +70334,7 @@ async function processTask(context) {
|
|
|
69868
70334
|
currentBoard = await moveBoardTask(context.client, await context.getAccessToken(), context.project.id, currentTask, "doing", context.options.delegation?.id ?? null);
|
|
69869
70335
|
currentTask = requireBoardTask(currentBoard, context.task.id);
|
|
69870
70336
|
}
|
|
69871
|
-
const packetPath = (0,
|
|
70337
|
+
const packetPath = (0, import_packet_workflow7.resolvePacketFilePath)(context.project, currentTask, currentTask.packetLink);
|
|
69872
70338
|
context.taskOutcome.packetPath = packetPath;
|
|
69873
70339
|
await refreshPacketMetadata(context.workspacePath, packetPath, currentTask);
|
|
69874
70340
|
printProgress(`Packet: ${packetPath}`);
|
|
@@ -69877,6 +70343,7 @@ async function processTask(context) {
|
|
|
69877
70343
|
currentBoard = doResult.board;
|
|
69878
70344
|
currentTask = doResult.task;
|
|
69879
70345
|
}
|
|
70346
|
+
(0, import_packet_workflow6.requireDoingCompletion)(currentTask.checklistItems.filter((item) => item.checklistStage === "doing"));
|
|
69880
70347
|
if (!context.options.checking) {
|
|
69881
70348
|
return moveAfterAcceptedChecking(context, currentBoard, currentTask, packetPath);
|
|
69882
70349
|
}
|
|
@@ -69901,7 +70368,7 @@ async function processTask(context) {
|
|
|
69901
70368
|
await refreshPacketMetadata(context.workspacePath, packetPath, currentTask);
|
|
69902
70369
|
continue;
|
|
69903
70370
|
}
|
|
69904
|
-
const accepted = currentTask.workflowState === "reviewing" || currentTask.workflowState === "done" || (0,
|
|
70371
|
+
const accepted = currentTask.workflowState === "reviewing" || currentTask.workflowState === "done" || (0, import_packet_workflow7.allChecklistItemsComplete)(currentTask, "checking");
|
|
69905
70372
|
if (accepted) {
|
|
69906
70373
|
return moveAfterAcceptedChecking(context, currentBoard, currentTask, packetPath);
|
|
69907
70374
|
}
|
|
@@ -69912,7 +70379,7 @@ async function runStageAndSync(context) {
|
|
|
69912
70379
|
if (context.options.maxAgentRequests !== null && context.getAgentRequests() >= context.options.maxAgentRequests) {
|
|
69913
70380
|
throw new Error(`Agent request budget exhausted before ${context.stage} for ${context.task.title}.`);
|
|
69914
70381
|
}
|
|
69915
|
-
const stageCommand = (0,
|
|
70382
|
+
const stageCommand = (0, import_packet_workflow7.buildPacketStageCommand)({
|
|
69916
70383
|
workflowState: context.stage === "do" ? "doing" : "checking",
|
|
69917
70384
|
relativePacketFilePath: context.packetPath,
|
|
69918
70385
|
agentProvider: context.options.agentProvider === "custom" ? "copilot" : context.options.agentProvider === "managed" ? "codex" : context.options.agentProvider
|
|
@@ -69976,7 +70443,7 @@ async function runStageAndSync(context) {
|
|
|
69976
70443
|
if (execution.exitCode !== 0) {
|
|
69977
70444
|
stageOutcome.result = "failed";
|
|
69978
70445
|
stageOutcome.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
69979
|
-
stageOutcome.elapsedMs = (0,
|
|
70446
|
+
stageOutcome.elapsedMs = (0, import_packet_workflow7.computeElapsedMs)(stageOutcome.startedAt, stageOutcome.finishedAt);
|
|
69980
70447
|
await persistRunManifest(context.manifestPath, context.manifest);
|
|
69981
70448
|
printProgress(`${context.stage} stage failed in ${formatDuration(stageOutcome.elapsedMs)}.`);
|
|
69982
70449
|
const failureOutput = `${execution.stderr}
|
|
@@ -70001,7 +70468,7 @@ ${execution.stdout}`;
|
|
|
70001
70468
|
throw new Error(`Agent spend budget exceeded: $${knownSpendUsd.toFixed(4)} > $${context.options.maxAgentSpendUsd.toFixed(4)}.`);
|
|
70002
70469
|
}
|
|
70003
70470
|
stageOutcome.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
70004
|
-
stageOutcome.elapsedMs = (0,
|
|
70471
|
+
stageOutcome.elapsedMs = (0, import_packet_workflow7.computeElapsedMs)(stageOutcome.startedAt, stageOutcome.finishedAt);
|
|
70005
70472
|
stageOutcome.laneAfter = syncResult.task.workflowState;
|
|
70006
70473
|
stageOutcome.syncedChanges = syncResult.syncedChanges;
|
|
70007
70474
|
await persistRunManifest(context.manifestPath, context.manifest);
|
|
@@ -70086,16 +70553,16 @@ function createRunId() {
|
|
|
70086
70553
|
function describeAgentPolicy(options) {
|
|
70087
70554
|
const policyProvider = options.agentProvider === "managed" ? "codex" : options.agentProvider;
|
|
70088
70555
|
return {
|
|
70089
|
-
sandboxMode: (0,
|
|
70556
|
+
sandboxMode: (0, import_packet_workflow7.resolveExternalAgentSandboxMode)({
|
|
70090
70557
|
agentMode: "externalCommand",
|
|
70091
70558
|
agentProvider: policyProvider,
|
|
70092
|
-
agentCommand: options.agentCommand ?? (0,
|
|
70559
|
+
agentCommand: options.agentCommand ?? (0, import_packet_workflow7.resolveExternalAgentProviderDefault)(policyProvider)?.command ?? null,
|
|
70093
70560
|
agentCommandSource: options.agentCommand ? "cli" : "provider-default"
|
|
70094
70561
|
}),
|
|
70095
|
-
approvalPosture: (0,
|
|
70562
|
+
approvalPosture: (0, import_packet_workflow7.resolveExternalAgentApprovalPosture)({
|
|
70096
70563
|
agentMode: "externalCommand",
|
|
70097
70564
|
agentProvider: policyProvider,
|
|
70098
|
-
agentCommand: options.agentCommand ?? (0,
|
|
70565
|
+
agentCommand: options.agentCommand ?? (0, import_packet_workflow7.resolveExternalAgentProviderDefault)(policyProvider)?.command ?? null,
|
|
70099
70566
|
agentCommandSource: options.agentCommand ? "cli" : "provider-default"
|
|
70100
70567
|
})
|
|
70101
70568
|
};
|
|
@@ -70929,7 +71396,7 @@ function parseRunId(rawValue) {
|
|
|
70929
71396
|
}
|
|
70930
71397
|
|
|
70931
71398
|
// src/commands/command-catalog.ts
|
|
70932
|
-
var
|
|
71399
|
+
var import_packet_workflow8 = __toESM(require_dist(), 1);
|
|
70933
71400
|
var COMMANDS = [
|
|
70934
71401
|
{ name: "upgrade", usage: "swarmcraft upgrade --workspace <path> [--check] [--include-completed] [--ordered-packets] [--packet <path>] [--json]", summary: "Upgrade existing project guidance and packets locally without an account; preserves the saved provider (upgrade protocol 1).", implemented: true },
|
|
70935
71402
|
{ name: "operate upgrade", usage: "swarmcraft operate upgrade --workspace <path> [--check] [--json]", summary: "Check or upgrade an existing Operate repository with local Git checkpoints and recovery (upgrade protocol 1).", implemented: true },
|
|
@@ -71009,7 +71476,7 @@ var COMMANDS = [
|
|
|
71009
71476
|
},
|
|
71010
71477
|
{
|
|
71011
71478
|
name: "one-shot",
|
|
71012
|
-
usage: `swarmcraft one-shot (--project <project-id> | --plan <path> | --packet <path>) [--phase <anchor>] [--preview] --workspace <path> --agent-provider ${
|
|
71479
|
+
usage: `swarmcraft one-shot (--project <project-id> | --plan <path> | --packet <path>) [--phase <anchor>] [--preview] --workspace <path> --agent-provider ${import_packet_workflow8.EXTERNAL_AGENT_PROVIDERS.join("|")}|managed [--agent-command <template>] [--delegation <id>] [--run-id <id>] [--delivery branch|direct] [--checking on|off] [--reviewing on|off] [--task <id>] [--task-limit <n|all>] [--max-checking-attempts <n>] [--done-policy stop|auto] [--commit-policy none|done] [--max-agent-requests <n>] [--allow-dirty]`,
|
|
71013
71480
|
summary: "Run the project board packet loop with your own AI or incrementally metered Managed AI.",
|
|
71014
71481
|
implemented: true
|
|
71015
71482
|
},
|
|
@@ -71062,7 +71529,7 @@ var COMMAND_INSTRUCTIONS = {
|
|
|
71062
71529
|
"projects list": { requirements: ["Signed-in session and network."], effects: ["Lists accessible projects. May refresh the local session; optional on-behalf-of access starts an audited delegation."], options: ["--delegation selects existing access; --on-behalf-of requires --delegation-reason."], result: "Prints project ID, state, progress and title; exit 0 on success, 1 on failure.", example: "swarmcraft projects list" },
|
|
71063
71530
|
"delegation start": { requirements: ["Signed-in authorised operator and network."], effects: ["Creates audited, temporary server-side access for the named user."], options: ["--user and --reason required; --support-ticket optional; --expires-in-minutes bounds 5\u2013600 (server default when omitted)."], result: "Prints delegation details; exit 0 on success, 1 on failure.", example: "swarmcraft delegation start --user <user> --reason <reason>" },
|
|
71064
71531
|
"delegation end": { requirements: ["Signed-in authorised operator and network."], effects: ["Revokes the specified server-side delegation; local repo files are untouched."], options: ["--delegation <id> required."], result: "Prints the ended delegation; exit 0 on success, 1 on failure.", example: "swarmcraft delegation end --delegation <id>" },
|
|
71065
|
-
"one-shot": { requirements: ["Hosted mode requires signed-in project access and network. Local --plan/--packet mode needs only Git and the external provider; Managed AI requires hosted mode and credits."], effects: ["Runs agents, changes repository files and board state, and writes run artifacts under .swarmcraft/runs/<run-id>. Managed AI is metered; external providers use their own access.", "This executes delivery, not a guidance upgrade. Commit policy can create local commits; review outputs."], options: ["--workspace and --agent-provider required; choose hosted --project or local --plan / repeatable --packet. Local --phase narrows a plan; --preview resolves selection without execution. Local mode rejects mixed hosted selectors. custom uses --agent-command or SWARMCRAFT_AGENT_COMMAND; managed rejects custom credentials/commands.", "Local defaults: --checking on; --reviewing on; --commit-policy none. Local mode does not accept --done-policy: reviewing on stops for human review; reviewing off permits completion after required stages. --task-limit and --max-checking-attempts are hosted-only.", "Hosted defaults: --checking off; --done-policy auto; --reviewing on only when done-policy is stop; --commit-policy none; --task-limit all; --max-checking-attempts 2.", "--max-agent-requests and --max-agent-spend-usd bound usage; --require-cost-telemetry requires cost evidence. --allow-dirty opts into existing changes.", "The resume command freezes local scope and policy. Its --accept-packet-changes explicitly reconciles owner edits; --retry-interrupted permits retry after inspecting an interrupted stage. Local outcomes exit 0 complete, 2 blocked/review-required, 1 execution error. --run-id selects artifacts; --task selects tasks; --agent-env-file and --agent-api-key-env-name configure external providers; --delegation selects authorised access."], result: "Prints run/task outcomes. Exit 0 means command completion, not that every task succeeded; inspect outcomes. Execution errors exit 1.", example: "swarmcraft one-shot --project <id> --workspace . --agent-provider claude --done-policy stop --max-agent-requests 3" },
|
|
71532
|
+
"one-shot": { requirements: ["Hosted mode requires signed-in project access and network. Local --plan/--packet mode needs only Git and the external provider; Managed AI requires hosted mode and credits."], effects: ["Runs agents, changes repository files and board state, and writes run artifacts under .swarmcraft/runs/<run-id>. Managed AI is metered; external providers use their own access.", "This executes delivery, not a guidance upgrade. Commit policy can create local commits; review outputs."], options: ["--workspace and --agent-provider required; choose hosted --project or local --plan / repeatable --packet. Local --phase narrows a plan; --preview resolves selection without execution. Local mode rejects mixed hosted selectors. custom uses --agent-command or SWARMCRAFT_AGENT_COMMAND; managed rejects custom credentials/commands.", "--delivery branch|direct defaults to branch. Direct runs on the current branch without source/target branch or merge prerequisites; checking and reviewing remain independent. Neither mode pushes or merges automatically.", "Local defaults: --checking on; --reviewing on; --commit-policy none. Local mode does not accept --done-policy: reviewing on stops for human review; reviewing off permits completion after required stages. --task-limit and --max-checking-attempts are hosted-only.", "Hosted defaults: --checking off; --done-policy auto; --reviewing on only when done-policy is stop; --commit-policy none; --task-limit all; --max-checking-attempts 2.", "--max-agent-requests and --max-agent-spend-usd bound usage; --require-cost-telemetry requires cost evidence. --allow-dirty opts into existing changes.", "The resume command freezes local scope and policy. Its --accept-packet-changes explicitly reconciles owner edits; --retry-interrupted permits retry after inspecting an interrupted stage. Local outcomes exit 0 complete, 2 blocked/review-required, 1 execution error. --run-id selects artifacts; --task selects tasks; --agent-env-file and --agent-api-key-env-name configure external providers; --delegation selects authorised access."], result: "Prints run/task outcomes. Exit 0 means command completion, not that every task succeeded; inspect outcomes. Execution errors exit 1.", example: "swarmcraft one-shot --project <id> --workspace . --agent-provider claude --done-policy stop --max-agent-requests 3" },
|
|
71066
71533
|
resume: { requirements: ["Existing run manifest and original provider prerequisites. Hosted runs also require signed-in project access and network."], effects: ["Continues the recorded execution, including agent writes and board updates. Uses the saved run policies."], options: ["--run and --workspace required; --max-agent-requests can extend the request limit. Hosted-only: --allow-dirty and --delegation. Local-only: --accept-packet-changes reconciles inspected owner edits; --retry-interrupted authorizes retry of an inspected interrupted stage. Selection and execution policies remain frozen."], result: "Prints resumed run outcomes; inspect task failures even when command exits 0. Errors exit 1.", example: "swarmcraft resume --run <id> --workspace ." },
|
|
71067
71534
|
status: { requirements: ["Existing local run manifest; no sign-in or API required."], effects: ["Reads the recorded run summary without continuing execution or writing files."], options: ["--run and --workspace required. Delegation is not used for this local read."], result: "Prints local run/task outcomes; exit 0 on success, 1 when unreadable.", example: "swarmcraft status --run <id> --workspace ." },
|
|
71068
71535
|
doctor: { requirements: ["No session required for local checks; an existing session enables an API reachability check."], effects: ["Checks Node, session, optional Git workspace and provider executable. May refresh session or use explicitly requested delegation; does not upgrade guidance."], options: ["--workspace and --agent-provider optional; custom skips provider executable lookup."], result: "Diagnostic text reports missing prerequisites; a completed diagnostic may exit 0 despite reported problems. Read the output.", example: "swarmcraft doctor --workspace . --agent-provider claude" },
|
|
@@ -72332,14 +72799,14 @@ async function runInit(parsed) {
|
|
|
72332
72799
|
printBootstrapSummary(summary);
|
|
72333
72800
|
}
|
|
72334
72801
|
async function runOneShotCommand(parsed) {
|
|
72335
|
-
rejectUnsupportedOptions(parsed, ["api-base-url", "workspace", "agent-provider", "agent-command", "agent-env-file", "agent-api-key-env-name", "project", "plan", "packet", "phase", "preview", "task", "task-limit", "delegation", "checking", "reviewing", "done-policy", "commit-policy", "max-checking-attempts", "max-agent-requests", "max-agent-spend-usd", "require-cost-telemetry", "allow-dirty", "run-id"]);
|
|
72802
|
+
rejectUnsupportedOptions(parsed, ["api-base-url", "workspace", "agent-provider", "agent-command", "agent-env-file", "agent-api-key-env-name", "project", "plan", "packet", "phase", "preview", "task", "task-limit", "delegation", "delivery", "checking", "reviewing", "done-policy", "commit-policy", "max-checking-attempts", "max-agent-requests", "max-agent-spend-usd", "require-cost-telemetry", "allow-dirty", "run-id"]);
|
|
72336
72803
|
if (getOption(parsed, "plan") || getOptions(parsed, "packet").length) {
|
|
72337
72804
|
for (const key of ["api-base-url", "project", "task", "delegation", "task-limit", "done-policy", "max-checking-attempts"]) if (getOption(parsed, key)) throw new Error(`Local selection cannot combine with --${key}.`);
|
|
72338
72805
|
const options2 = { ...parseOneShotOptions(parsed, true), delegation: null };
|
|
72339
72806
|
const selectors = { plan: getOption(parsed, "plan") ?? void 0, phases: getOptions(parsed, "phase"), packets: getOptions(parsed, "packet") };
|
|
72340
72807
|
if (hasFlag(parsed, "preview")) {
|
|
72341
72808
|
const selection = await selectLocalPackets(options2.workspacePath, selectors);
|
|
72342
|
-
console.log(JSON.stringify({ selection, checking: options2.checking, reviewing: options2.reviewing, commitPolicy: options2.commitPolicy, maxAgentRequests: options2.maxAgentRequests }, null, 2));
|
|
72809
|
+
console.log(JSON.stringify({ selection, delivery: options2.delivery, checking: options2.checking, reviewing: options2.reviewing, commitPolicy: options2.commitPolicy, maxAgentRequests: options2.maxAgentRequests }, null, 2));
|
|
72343
72810
|
return 0;
|
|
72344
72811
|
}
|
|
72345
72812
|
const result = await startLocalRun(options2, selectors);
|
|
@@ -72442,7 +72909,7 @@ async function runDoctor(parsed) {
|
|
|
72442
72909
|
}
|
|
72443
72910
|
const provider = getOption(parsed, "agent-provider");
|
|
72444
72911
|
if (provider && provider !== "custom") {
|
|
72445
|
-
const commandName = (0,
|
|
72912
|
+
const commandName = (0, import_packet_workflow10.parseExternalAgentProvider)(provider);
|
|
72446
72913
|
const result = await runProcess(process.platform === "win32" ? "where.exe" : "which", [commandName], process.cwd());
|
|
72447
72914
|
console.log(`${commandName}: ${result.exitCode === 0 ? result.stdout.trim() : "not found"}`);
|
|
72448
72915
|
}
|
|
@@ -72599,7 +73066,7 @@ function printRunSummary(manifest) {
|
|
|
72599
73066
|
}
|
|
72600
73067
|
function parseOneShotOptions(parsed, local = false) {
|
|
72601
73068
|
const providerValue = requireOption(parsed, "agent-provider");
|
|
72602
|
-
const agentProvider = providerValue === "managed" ? "managed" : (0,
|
|
73069
|
+
const agentProvider = providerValue === "managed" ? "managed" : (0, import_packet_workflow10.parseExternalAgentProvider)(providerValue);
|
|
72603
73070
|
if (agentProvider === "managed" && (getOption(parsed, "agent-command") || getOption(parsed, "agent-env-file") || getOption(parsed, "agent-api-key-env-name"))) {
|
|
72604
73071
|
throw new Error("Managed AI does not accept custom commands or provider credentials.");
|
|
72605
73072
|
}
|
|
@@ -72612,6 +73079,7 @@ function parseOneShotOptions(parsed, local = false) {
|
|
|
72612
73079
|
workspacePath: requireOption(parsed, "workspace"),
|
|
72613
73080
|
agentProvider,
|
|
72614
73081
|
agentCommand: getOption(parsed, "agent-command") ?? process.env.SWARMCRAFT_AGENT_COMMAND ?? null,
|
|
73082
|
+
delivery: (0, import_packet_workflow9.parseDeliveryMode)(getOption(parsed, "delivery")),
|
|
72615
73083
|
checking: parseOnOff(getOption(parsed, "checking") ?? (local ? "on" : "off"), "--checking"),
|
|
72616
73084
|
reviewing: explicitReviewing ? parseOnOff(explicitReviewing, "--reviewing") : local || donePolicy === "stop",
|
|
72617
73085
|
maxCheckingAttempts: parsePositiveInteger(getOption(parsed, "max-checking-attempts") ?? "2", "--max-checking-attempts"),
|
package/package.json
CHANGED