opencode-swarm 7.77.3 → 7.77.5
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/.opencode/skills/swarm-pr-feedback/SKILL.md +8 -0
- package/dist/cli/index.js +770 -695
- package/dist/commands/registry.d.ts +109 -0
- package/dist/commands/tool-policy.d.ts +2 -2
- package/dist/index.js +1084 -916
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -52,7 +52,7 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "opencode-swarm",
|
|
55
|
-
version: "7.77.
|
|
55
|
+
version: "7.77.5",
|
|
56
56
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
57
57
|
main: "dist/index.js",
|
|
58
58
|
types: "dist/index.d.ts",
|
|
@@ -504,6 +504,14 @@ async function bunWrite(filePath, data) {
|
|
|
504
504
|
} catch {}
|
|
505
505
|
throw lastError;
|
|
506
506
|
}
|
|
507
|
+
try {
|
|
508
|
+
const dirFd = await fsPromises.open(dir, "r");
|
|
509
|
+
try {
|
|
510
|
+
await dirFd.sync();
|
|
511
|
+
} finally {
|
|
512
|
+
await dirFd.close();
|
|
513
|
+
}
|
|
514
|
+
} catch {}
|
|
507
515
|
const stats = await fsPromises.stat(filePath);
|
|
508
516
|
return stats.size;
|
|
509
517
|
}
|
|
@@ -828,14 +836,23 @@ function validateSwarmPath(directory, filename) {
|
|
|
828
836
|
return resolved;
|
|
829
837
|
}
|
|
830
838
|
async function readSwarmFileAsync(directory, filename) {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
839
|
+
const maxAttempts = 5;
|
|
840
|
+
const retryDelayMs = 10;
|
|
841
|
+
for (let attempt = 0;attempt < maxAttempts; attempt++) {
|
|
842
|
+
try {
|
|
843
|
+
const resolvedPath = _internals.validateSwarmPath(directory, filename);
|
|
844
|
+
const file = bunFile(resolvedPath);
|
|
845
|
+
const content = await file.text();
|
|
846
|
+
return content;
|
|
847
|
+
} catch (err) {
|
|
848
|
+
const isNotFound = err?.code === "ENOENT";
|
|
849
|
+
if (!isNotFound || attempt === maxAttempts - 1) {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
await new Promise((resolve3) => setTimeout(resolve3, retryDelayMs));
|
|
853
|
+
}
|
|
838
854
|
}
|
|
855
|
+
return null;
|
|
839
856
|
}
|
|
840
857
|
var _internals;
|
|
841
858
|
var init_utils2 = __esm(() => {
|
|
@@ -17544,7 +17561,7 @@ var init_tool_metadata = __esm(() => {
|
|
|
17544
17561
|
agents: ["architect"]
|
|
17545
17562
|
},
|
|
17546
17563
|
write_final_council_evidence: {
|
|
17547
|
-
description: "
|
|
17564
|
+
description: "Persist project-scoped final council evidence to .swarm/evidence/final-council.json. PREREQUISITE: dispatch critic, reviewer, sme, test_engineer, and explorer as project-scoped Agent tasks and collect their CouncilMemberVerdict JSON \u2014 this tool synthesizes only. Rejects on insufficient quorum or CONCERNS with unresolved requiredFixes; normalizes verdicts to approved/concerns/rejected. Architect-only.",
|
|
17548
17565
|
agents: ["architect"]
|
|
17549
17566
|
},
|
|
17550
17567
|
skill_generate: {
|
|
@@ -20381,7 +20398,7 @@ GFS4: `);
|
|
|
20381
20398
|
}
|
|
20382
20399
|
function ReadStream$open() {
|
|
20383
20400
|
var that = this;
|
|
20384
|
-
|
|
20401
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
20385
20402
|
if (err) {
|
|
20386
20403
|
if (that.autoClose)
|
|
20387
20404
|
that.destroy();
|
|
@@ -20401,7 +20418,7 @@ GFS4: `);
|
|
|
20401
20418
|
}
|
|
20402
20419
|
function WriteStream$open() {
|
|
20403
20420
|
var that = this;
|
|
20404
|
-
|
|
20421
|
+
open2(that.path, that.flags, that.mode, function(err, fd) {
|
|
20405
20422
|
if (err) {
|
|
20406
20423
|
that.destroy();
|
|
20407
20424
|
that.emit("error", err);
|
|
@@ -20418,8 +20435,8 @@ GFS4: `);
|
|
|
20418
20435
|
return new fs6.WriteStream(path8, options);
|
|
20419
20436
|
}
|
|
20420
20437
|
var fs$open = fs6.open;
|
|
20421
|
-
fs6.open =
|
|
20422
|
-
function
|
|
20438
|
+
fs6.open = open2;
|
|
20439
|
+
function open2(path8, flags, mode, cb) {
|
|
20423
20440
|
if (typeof mode === "function")
|
|
20424
20441
|
cb = mode, mode = null;
|
|
20425
20442
|
return go$open(path8, flags, mode, cb);
|
|
@@ -21571,6 +21588,9 @@ function wrapFlatRetrospective(flatEntry, taskId) {
|
|
|
21571
21588
|
async function loadEvidence(directory, taskId) {
|
|
21572
21589
|
const sanitizedTaskId = sanitizeTaskId2(taskId);
|
|
21573
21590
|
const relativePath = path9.join("evidence", sanitizedTaskId, "evidence.json");
|
|
21591
|
+
if (relativePath.length > 4096) {
|
|
21592
|
+
return { status: "not_found" };
|
|
21593
|
+
}
|
|
21574
21594
|
const evidencePath = validateSwarmPath(directory, relativePath);
|
|
21575
21595
|
const content = await readSwarmFileAsync(directory, relativePath);
|
|
21576
21596
|
if (content === null) {
|
|
@@ -23065,6 +23085,291 @@ var init_stored_input_args = __esm(() => {
|
|
|
23065
23085
|
storedInputArgs = new Map;
|
|
23066
23086
|
});
|
|
23067
23087
|
|
|
23088
|
+
// src/commands/command-dispatch.ts
|
|
23089
|
+
function normalizeSwarmCommandInput(command, argumentText) {
|
|
23090
|
+
if (command !== "swarm" && !command.startsWith("swarm-")) {
|
|
23091
|
+
return { isSwarmCommand: false, tokens: [] };
|
|
23092
|
+
}
|
|
23093
|
+
if (command === "swarm") {
|
|
23094
|
+
return {
|
|
23095
|
+
isSwarmCommand: true,
|
|
23096
|
+
tokens: argumentText.trim().split(/\s+/).filter(Boolean)
|
|
23097
|
+
};
|
|
23098
|
+
}
|
|
23099
|
+
const subcommand = command.slice("swarm-".length);
|
|
23100
|
+
const extraArgs = argumentText.trim().split(/\s+/).filter(Boolean);
|
|
23101
|
+
return {
|
|
23102
|
+
isSwarmCommand: true,
|
|
23103
|
+
tokens: [subcommand, ...extraArgs].filter(Boolean)
|
|
23104
|
+
};
|
|
23105
|
+
}
|
|
23106
|
+
function canonicalCommandKey(resolved) {
|
|
23107
|
+
return resolved.entry.aliasOf ?? resolved.key;
|
|
23108
|
+
}
|
|
23109
|
+
function formatCommandNotFound(tokens) {
|
|
23110
|
+
const attemptedCommand = tokens[0] || "";
|
|
23111
|
+
const MAX_DISPLAY = 100;
|
|
23112
|
+
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
23113
|
+
const similar = _internals11.findSimilarCommands(attemptedCommand);
|
|
23114
|
+
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
23115
|
+
const suggestions = similar.length > 0 ? `Did you mean:
|
|
23116
|
+
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
23117
|
+
`)}` : "";
|
|
23118
|
+
const footer = "Run `/swarm help` for all commands.";
|
|
23119
|
+
return [header, suggestions, footer].filter(Boolean).join(`
|
|
23120
|
+
|
|
23121
|
+
`);
|
|
23122
|
+
}
|
|
23123
|
+
async function executeSwarmCommand(args) {
|
|
23124
|
+
const {
|
|
23125
|
+
directory,
|
|
23126
|
+
agents,
|
|
23127
|
+
sessionID,
|
|
23128
|
+
tokens,
|
|
23129
|
+
packageRoot,
|
|
23130
|
+
buildHelpText,
|
|
23131
|
+
policy
|
|
23132
|
+
} = args;
|
|
23133
|
+
let text;
|
|
23134
|
+
const resolved = resolveCommand(tokens);
|
|
23135
|
+
if (!resolved) {
|
|
23136
|
+
text = tokens.length === 0 && buildHelpText ? buildHelpText() : formatCommandNotFound(tokens);
|
|
23137
|
+
} else {
|
|
23138
|
+
const policyResult = policy?.(resolved) ?? { allowed: true };
|
|
23139
|
+
if (!policyResult.allowed) {
|
|
23140
|
+
text = policyResult.message;
|
|
23141
|
+
} else {
|
|
23142
|
+
try {
|
|
23143
|
+
text = await resolved.entry.handler({
|
|
23144
|
+
directory,
|
|
23145
|
+
args: resolved.remainingArgs,
|
|
23146
|
+
sessionID,
|
|
23147
|
+
agents,
|
|
23148
|
+
packageRoot,
|
|
23149
|
+
source: "chat"
|
|
23150
|
+
});
|
|
23151
|
+
} catch (_err) {
|
|
23152
|
+
const cmdName = tokens[0] || "unknown";
|
|
23153
|
+
const errMsg = _err instanceof Error ? _err.message : String(_err);
|
|
23154
|
+
text = `Error executing /swarm ${cmdName}: ${errMsg}`;
|
|
23155
|
+
}
|
|
23156
|
+
if (resolved.warning) {
|
|
23157
|
+
text = `${resolved.warning}
|
|
23158
|
+
|
|
23159
|
+
${text}`;
|
|
23160
|
+
}
|
|
23161
|
+
}
|
|
23162
|
+
}
|
|
23163
|
+
return {
|
|
23164
|
+
text,
|
|
23165
|
+
resolved: resolved ?? undefined,
|
|
23166
|
+
canonicalKey: resolved ? canonicalCommandKey(resolved) : undefined
|
|
23167
|
+
};
|
|
23168
|
+
}
|
|
23169
|
+
var init_command_dispatch = __esm(() => {
|
|
23170
|
+
init_registry();
|
|
23171
|
+
});
|
|
23172
|
+
|
|
23173
|
+
// src/commands/tool-policy.ts
|
|
23174
|
+
function lazySet(getValues) {
|
|
23175
|
+
let cached2 = null;
|
|
23176
|
+
const ensure = () => {
|
|
23177
|
+
if (cached2 === null)
|
|
23178
|
+
cached2 = new Set(getValues());
|
|
23179
|
+
return cached2;
|
|
23180
|
+
};
|
|
23181
|
+
return new Proxy({}, {
|
|
23182
|
+
get(_target, prop) {
|
|
23183
|
+
const set2 = ensure();
|
|
23184
|
+
const value = Reflect.get(set2, prop);
|
|
23185
|
+
return typeof value === "function" ? value.bind(set2) : value;
|
|
23186
|
+
}
|
|
23187
|
+
});
|
|
23188
|
+
}
|
|
23189
|
+
function lazyArray(getValues) {
|
|
23190
|
+
let cached2 = null;
|
|
23191
|
+
const ensure = () => {
|
|
23192
|
+
if (cached2 === null)
|
|
23193
|
+
cached2 = getValues();
|
|
23194
|
+
return cached2;
|
|
23195
|
+
};
|
|
23196
|
+
return new Proxy([], {
|
|
23197
|
+
get(_target, prop) {
|
|
23198
|
+
const arr = ensure();
|
|
23199
|
+
const value = Reflect.get(arr, prop);
|
|
23200
|
+
return typeof value === "function" ? value.bind(arr) : value;
|
|
23201
|
+
}
|
|
23202
|
+
});
|
|
23203
|
+
}
|
|
23204
|
+
function classifySwarmCommandToolUse(resolved) {
|
|
23205
|
+
const canonicalKey = canonicalCommandKey(resolved);
|
|
23206
|
+
const args = resolved.remainingArgs;
|
|
23207
|
+
if (!SWARM_COMMAND_TOOL_ALLOWLIST.has(canonicalKey)) {
|
|
23208
|
+
if (HUMAN_ONLY_SWARM_COMMANDS.has(canonicalKey)) {
|
|
23209
|
+
return {
|
|
23210
|
+
allowed: false,
|
|
23211
|
+
message: `/swarm ${canonicalKey} is a human-only command. ` + `Present the situation to the user and ask them to run \`/swarm ${canonicalKey}\` themselves ` + `(or \`bunx opencode-swarm run ${canonicalKey}\` from a terminal). ` + `You MUST NOT run it yourself via Bash, swarm_command, or any other tool \u2014 ` + `the runtime guardrail will block such attempts.`
|
|
23212
|
+
};
|
|
23213
|
+
}
|
|
23214
|
+
return {
|
|
23215
|
+
allowed: false,
|
|
23216
|
+
message: `/swarm ${canonicalKey} is not available through the chat tool yet.
|
|
23217
|
+
|
|
23218
|
+
` + `Use the canonical CLI path for now: \`bunx opencode-swarm run ${canonicalKey}\`.
|
|
23219
|
+
` + `Commands with state changes, auto-heal behavior, or subprocesses need confirmation gates before chat-tool support.`
|
|
23220
|
+
};
|
|
23221
|
+
}
|
|
23222
|
+
if (canonicalKey === "config doctor" && args.some((arg) => arg === "--fix" || arg === "-f")) {
|
|
23223
|
+
return {
|
|
23224
|
+
allowed: false,
|
|
23225
|
+
message: "/swarm config doctor --fix is not available through swarm_command. Run the CLI command directly when you intend to modify config files."
|
|
23226
|
+
};
|
|
23227
|
+
}
|
|
23228
|
+
if (NO_ARGS.has(canonicalKey) && args.length > 0) {
|
|
23229
|
+
return {
|
|
23230
|
+
allowed: false,
|
|
23231
|
+
message: `/swarm ${canonicalKey} does not accept arguments through swarm_command.`
|
|
23232
|
+
};
|
|
23233
|
+
}
|
|
23234
|
+
if (canonicalKey === "knowledge") {
|
|
23235
|
+
if (args.length === 0)
|
|
23236
|
+
return { allowed: true };
|
|
23237
|
+
if (args.length === 1 && (args[0] === "list" || args[0] === "unactionable"))
|
|
23238
|
+
return { allowed: true };
|
|
23239
|
+
return {
|
|
23240
|
+
allowed: false,
|
|
23241
|
+
message: "Only `/swarm knowledge`, `/swarm knowledge list`, and `/swarm knowledge unactionable` are available through swarm_command. Knowledge migrate/quarantine/restore/retry-hardening are intentionally excluded."
|
|
23242
|
+
};
|
|
23243
|
+
}
|
|
23244
|
+
if (canonicalKey === "memory") {
|
|
23245
|
+
if (args.length === 0)
|
|
23246
|
+
return { allowed: true };
|
|
23247
|
+
return {
|
|
23248
|
+
allowed: false,
|
|
23249
|
+
message: "Use `/swarm memory status`, `/swarm memory pending`, `/swarm memory recall-log`, `/swarm memory stale`, `/swarm memory export`, or `/swarm memory evaluate --json` through swarm_command. Memory import, migrate, and compact are intentionally excluded from chat-tool execution."
|
|
23250
|
+
};
|
|
23251
|
+
}
|
|
23252
|
+
if (canonicalKey === "memory evaluate") {
|
|
23253
|
+
if (args.length === 0)
|
|
23254
|
+
return { allowed: true };
|
|
23255
|
+
if (args.length === 1 && args[0] === "--json")
|
|
23256
|
+
return { allowed: true };
|
|
23257
|
+
return {
|
|
23258
|
+
allowed: false,
|
|
23259
|
+
message: "Usage through swarm_command: `/swarm memory evaluate --json`. Custom fixture directories are only available through direct user command execution."
|
|
23260
|
+
};
|
|
23261
|
+
}
|
|
23262
|
+
if (canonicalKey === "sdd status") {
|
|
23263
|
+
if (args.length === 0)
|
|
23264
|
+
return { allowed: true };
|
|
23265
|
+
if (args.length === 1 && args[0] === "--json")
|
|
23266
|
+
return { allowed: true };
|
|
23267
|
+
return {
|
|
23268
|
+
allowed: false,
|
|
23269
|
+
message: "Usage through swarm_command: `/swarm sdd status` or `/swarm sdd status --json`."
|
|
23270
|
+
};
|
|
23271
|
+
}
|
|
23272
|
+
if (canonicalKey === "sdd validate") {
|
|
23273
|
+
if (args.length === 0)
|
|
23274
|
+
return { allowed: true };
|
|
23275
|
+
if (args.length === 1 && args[0] === "--json")
|
|
23276
|
+
return { allowed: true };
|
|
23277
|
+
if (args.length === 2 && args[0] === "--change" && /^[A-Za-z0-9_.-]{1,128}$/.test(args[1])) {
|
|
23278
|
+
return { allowed: true };
|
|
23279
|
+
}
|
|
23280
|
+
return {
|
|
23281
|
+
allowed: false,
|
|
23282
|
+
message: "Usage through swarm_command: `/swarm sdd validate`, `/swarm sdd validate --json`, or `/swarm sdd validate --change <id>`."
|
|
23283
|
+
};
|
|
23284
|
+
}
|
|
23285
|
+
if (canonicalKey === "memory pending" || canonicalKey === "memory recall-log" || canonicalKey === "memory stale") {
|
|
23286
|
+
if (args.length === 0)
|
|
23287
|
+
return { allowed: true };
|
|
23288
|
+
if (args.length === 2 && args[0] === "--limit" && /^\d+$/.test(args[1])) {
|
|
23289
|
+
return { allowed: true };
|
|
23290
|
+
}
|
|
23291
|
+
return {
|
|
23292
|
+
allowed: false,
|
|
23293
|
+
message: `Usage through swarm_command: \`/swarm ${canonicalKey}\` or ` + `\`/swarm ${canonicalKey} --limit <n>\`.`
|
|
23294
|
+
};
|
|
23295
|
+
}
|
|
23296
|
+
if (canonicalKey === "retrieve") {
|
|
23297
|
+
if (args.length !== 1 || !SUMMARY_ID_PATTERN.test(args[0])) {
|
|
23298
|
+
return {
|
|
23299
|
+
allowed: false,
|
|
23300
|
+
message: "Usage through swarm_command: `/swarm retrieve <summary-id>` with a single summary ID such as S1."
|
|
23301
|
+
};
|
|
23302
|
+
}
|
|
23303
|
+
}
|
|
23304
|
+
if (canonicalKey === "benchmark") {
|
|
23305
|
+
const allowedFlags = new Set(["--cumulative", "--ci-gate"]);
|
|
23306
|
+
const invalid = args.filter((arg) => !allowedFlags.has(arg));
|
|
23307
|
+
if (invalid.length > 0) {
|
|
23308
|
+
return {
|
|
23309
|
+
allowed: false,
|
|
23310
|
+
message: "Only `--cumulative` and `--ci-gate` are supported for `/swarm benchmark` through swarm_command."
|
|
23311
|
+
};
|
|
23312
|
+
}
|
|
23313
|
+
}
|
|
23314
|
+
if (canonicalKey === "show-plan") {
|
|
23315
|
+
if (args.length > 1 || args[0] && !/^\d+$/.test(args[0])) {
|
|
23316
|
+
return {
|
|
23317
|
+
allowed: false,
|
|
23318
|
+
message: "Usage through swarm_command: `/swarm show-plan` or `/swarm show-plan <phase-number>`."
|
|
23319
|
+
};
|
|
23320
|
+
}
|
|
23321
|
+
}
|
|
23322
|
+
if (canonicalKey === "evidence") {
|
|
23323
|
+
if (args.length > 1 || args[0] && !TASK_ID_PATTERN.test(args[0])) {
|
|
23324
|
+
return {
|
|
23325
|
+
allowed: false,
|
|
23326
|
+
message: "Usage through swarm_command: `/swarm evidence` or `/swarm evidence <task-id>`."
|
|
23327
|
+
};
|
|
23328
|
+
}
|
|
23329
|
+
}
|
|
23330
|
+
if (canonicalKey === "help" && args.length > 2) {
|
|
23331
|
+
return {
|
|
23332
|
+
allowed: false,
|
|
23333
|
+
message: "Usage through swarm_command: `/swarm help` or `/swarm help <command>`."
|
|
23334
|
+
};
|
|
23335
|
+
}
|
|
23336
|
+
return { allowed: true };
|
|
23337
|
+
}
|
|
23338
|
+
function classifySwarmCommandChatFallbackUse(resolved) {
|
|
23339
|
+
const canonicalKey = canonicalCommandKey(resolved);
|
|
23340
|
+
const args = resolved.remainingArgs;
|
|
23341
|
+
if (canonicalKey === "config doctor" && args.some((arg) => arg === "--fix" || arg === "-f")) {
|
|
23342
|
+
return {
|
|
23343
|
+
allowed: false,
|
|
23344
|
+
message: "/swarm config doctor --fix is not available through chat fallback because it can modify configuration files. Run the CLI command directly when you intend to apply fixes."
|
|
23345
|
+
};
|
|
23346
|
+
}
|
|
23347
|
+
if (canonicalKey === "knowledge migrate" || canonicalKey === "knowledge quarantine" || canonicalKey === "knowledge restore" || canonicalKey === "memory import" || canonicalKey === "memory migrate" || canonicalKey === "memory compact" || canonicalKey === "sdd project") {
|
|
23348
|
+
return {
|
|
23349
|
+
allowed: false,
|
|
23350
|
+
message: `/swarm ${canonicalKey} is not available through chat fallback because it mutates .swarm state. ` + "Run the CLI command directly after confirming the intended state change."
|
|
23351
|
+
};
|
|
23352
|
+
}
|
|
23353
|
+
return { allowed: true };
|
|
23354
|
+
}
|
|
23355
|
+
var SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, NO_ARGS, SUMMARY_ID_PATTERN, TASK_ID_PATTERN;
|
|
23356
|
+
var init_tool_policy = __esm(() => {
|
|
23357
|
+
init_command_dispatch();
|
|
23358
|
+
init_registry();
|
|
23359
|
+
SWARM_COMMAND_TOOL_COMMANDS = lazyArray(() => VALID_COMMANDS.filter((cmd) => {
|
|
23360
|
+
const policy = COMMAND_REGISTRY[cmd]?.toolPolicy;
|
|
23361
|
+
return policy === "agent" || policy === "human-only";
|
|
23362
|
+
}).sort());
|
|
23363
|
+
SWARM_COMMAND_TOOL_ALLOWLIST = lazySet(() => VALID_COMMANDS.filter((cmd) => COMMAND_REGISTRY[cmd]?.toolPolicy === "agent"));
|
|
23364
|
+
HUMAN_ONLY_SWARM_COMMANDS = lazySet(() => VALID_COMMANDS.filter((cmd) => {
|
|
23365
|
+
const policy = COMMAND_REGISTRY[cmd]?.toolPolicy;
|
|
23366
|
+
return policy === "human-only" || policy === "restricted";
|
|
23367
|
+
}));
|
|
23368
|
+
NO_ARGS = lazySet(() => VALID_COMMANDS.filter((cmd) => COMMAND_REGISTRY[cmd]?.toolNoArgs === true));
|
|
23369
|
+
SUMMARY_ID_PATTERN = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
23370
|
+
TASK_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,64}$/;
|
|
23371
|
+
});
|
|
23372
|
+
|
|
23068
23373
|
// src/sandbox/executor.ts
|
|
23069
23374
|
var init_executor = () => {};
|
|
23070
23375
|
|
|
@@ -23197,6 +23502,7 @@ var init_helpers = __esm(() => {
|
|
|
23197
23502
|
|
|
23198
23503
|
// src/hooks/guardrails/tool-before.ts
|
|
23199
23504
|
var init_tool_before = __esm(() => {
|
|
23505
|
+
init_tool_policy();
|
|
23200
23506
|
init_constants();
|
|
23201
23507
|
init_schema();
|
|
23202
23508
|
init_executor();
|
|
@@ -37041,7 +37347,7 @@ function resetToRemoteBranch(cwd, options) {
|
|
|
37041
37347
|
const prunedBranches = [];
|
|
37042
37348
|
try {
|
|
37043
37349
|
const currentBranch = getCurrentBranch(cwd);
|
|
37044
|
-
const defaultRemoteBranch =
|
|
37350
|
+
const defaultRemoteBranch = _internals14.detectDefaultRemoteBranch(cwd);
|
|
37045
37351
|
if (!defaultRemoteBranch) {
|
|
37046
37352
|
return {
|
|
37047
37353
|
success: false,
|
|
@@ -37223,7 +37529,7 @@ function resetToRemoteBranch(cwd, options) {
|
|
|
37223
37529
|
function resetToMainAfterMerge(cwd, options) {
|
|
37224
37530
|
const warnings = [];
|
|
37225
37531
|
try {
|
|
37226
|
-
const defaultBranch =
|
|
37532
|
+
const defaultBranch = _internals14.detectDefaultRemoteBranch(cwd);
|
|
37227
37533
|
if (!defaultBranch) {
|
|
37228
37534
|
return {
|
|
37229
37535
|
success: false,
|
|
@@ -37250,7 +37556,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37250
37556
|
}
|
|
37251
37557
|
if (currentBranch === defaultBranch) {
|
|
37252
37558
|
try {
|
|
37253
|
-
const logOutput =
|
|
37559
|
+
const logOutput = _internals14.gitExec(["log", `${targetBranch}..HEAD`, "--oneline"], cwd);
|
|
37254
37560
|
if (logOutput.trim().length > 0) {
|
|
37255
37561
|
return {
|
|
37256
37562
|
success: false,
|
|
@@ -37265,11 +37571,11 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37265
37571
|
} catch {}
|
|
37266
37572
|
} else {
|
|
37267
37573
|
try {
|
|
37268
|
-
|
|
37574
|
+
_internals14.gitExec(["rev-parse", "--abbrev-ref", `${currentBranch}@{upstream}`], cwd);
|
|
37269
37575
|
} catch {
|
|
37270
37576
|
try {
|
|
37271
|
-
const localSha =
|
|
37272
|
-
const remoteSha =
|
|
37577
|
+
const localSha = _internals14.gitExec(["rev-parse", "HEAD"], cwd).trim();
|
|
37578
|
+
const remoteSha = _internals14.gitExec(["rev-parse", targetBranch], cwd).trim();
|
|
37273
37579
|
if (localSha !== remoteSha) {
|
|
37274
37580
|
return {
|
|
37275
37581
|
success: false,
|
|
@@ -37295,7 +37601,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37295
37601
|
}
|
|
37296
37602
|
}
|
|
37297
37603
|
try {
|
|
37298
|
-
|
|
37604
|
+
_internals14.gitExec(["fetch", "--prune", "origin"], cwd);
|
|
37299
37605
|
} catch (err) {
|
|
37300
37606
|
return {
|
|
37301
37607
|
success: false,
|
|
@@ -37311,7 +37617,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37311
37617
|
let switchedBranch = false;
|
|
37312
37618
|
if (currentBranch !== defaultBranch) {
|
|
37313
37619
|
try {
|
|
37314
|
-
|
|
37620
|
+
_internals14.gitExec(["checkout", defaultBranch], cwd);
|
|
37315
37621
|
switchedBranch = true;
|
|
37316
37622
|
} catch (err) {
|
|
37317
37623
|
return {
|
|
@@ -37326,7 +37632,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37326
37632
|
}
|
|
37327
37633
|
}
|
|
37328
37634
|
try {
|
|
37329
|
-
|
|
37635
|
+
_internals14.gitExec(["reset", "--hard", targetBranch], cwd);
|
|
37330
37636
|
} catch (err) {
|
|
37331
37637
|
return {
|
|
37332
37638
|
success: false,
|
|
@@ -37347,7 +37653,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37347
37653
|
while (Date.now() < endTime) {}
|
|
37348
37654
|
}
|
|
37349
37655
|
try {
|
|
37350
|
-
|
|
37656
|
+
_internals14.gitExec(["checkout", "--", "."], cwd);
|
|
37351
37657
|
discardSucceeded = true;
|
|
37352
37658
|
break;
|
|
37353
37659
|
} catch {}
|
|
@@ -37358,18 +37664,18 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37358
37664
|
changesDiscarded = discardSucceeded;
|
|
37359
37665
|
}
|
|
37360
37666
|
try {
|
|
37361
|
-
|
|
37667
|
+
_internals14.gitExec(["clean", "-fd"], cwd);
|
|
37362
37668
|
} catch {
|
|
37363
37669
|
warnings.push("Could not clean untracked files");
|
|
37364
37670
|
}
|
|
37365
37671
|
let branchDeleted = false;
|
|
37366
37672
|
if (switchedBranch && previousBranch !== defaultBranch) {
|
|
37367
37673
|
try {
|
|
37368
|
-
const mergedOutput =
|
|
37674
|
+
const mergedOutput = _internals14.gitExec(["branch", "--merged", defaultBranch], cwd);
|
|
37369
37675
|
const isMerged = mergedOutput.split(`
|
|
37370
37676
|
`).some((line) => line.trim() === previousBranch || line.trim() === `* ${previousBranch}`);
|
|
37371
37677
|
if (isMerged) {
|
|
37372
|
-
|
|
37678
|
+
_internals14.gitExec(["branch", "-d", previousBranch], cwd);
|
|
37373
37679
|
branchDeleted = true;
|
|
37374
37680
|
} else {
|
|
37375
37681
|
warnings.push(`Branch ${previousBranch} is not merged into ${defaultBranch} \u2014 keeping it`);
|
|
@@ -37380,7 +37686,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37380
37686
|
}
|
|
37381
37687
|
if (options?.pruneBranches) {
|
|
37382
37688
|
try {
|
|
37383
|
-
const mergedOutput =
|
|
37689
|
+
const mergedOutput = _internals14.gitExec(["branch", "--merged", defaultBranch], cwd);
|
|
37384
37690
|
const mergedLines = mergedOutput.split(`
|
|
37385
37691
|
`);
|
|
37386
37692
|
for (const line of mergedLines) {
|
|
@@ -37389,7 +37695,7 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37389
37695
|
continue;
|
|
37390
37696
|
}
|
|
37391
37697
|
try {
|
|
37392
|
-
|
|
37698
|
+
_internals14.gitExec(["branch", "-d", trimmedLine], cwd);
|
|
37393
37699
|
} catch {
|
|
37394
37700
|
warnings.push(`Could not prune branch: ${trimmedLine}`);
|
|
37395
37701
|
}
|
|
@@ -37419,10 +37725,10 @@ function resetToMainAfterMerge(cwd, options) {
|
|
|
37419
37725
|
};
|
|
37420
37726
|
}
|
|
37421
37727
|
}
|
|
37422
|
-
var GIT_TIMEOUT_MS2 = 30000,
|
|
37728
|
+
var GIT_TIMEOUT_MS2 = 30000, _internals14;
|
|
37423
37729
|
var init_branch = __esm(() => {
|
|
37424
37730
|
init_logger();
|
|
37425
|
-
|
|
37731
|
+
_internals14 = {
|
|
37426
37732
|
gitExec: gitExec2,
|
|
37427
37733
|
detectDefaultRemoteBranch,
|
|
37428
37734
|
getDefaultBaseBranch,
|
|
@@ -37641,18 +37947,18 @@ async function atomicWriteFile(targetPath, content) {
|
|
|
37641
37947
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
37642
37948
|
try {
|
|
37643
37949
|
await bunWrite(tempPath, content);
|
|
37644
|
-
|
|
37950
|
+
_internals15.renameSync(tempPath, targetPath);
|
|
37645
37951
|
} finally {
|
|
37646
37952
|
try {
|
|
37647
|
-
|
|
37953
|
+
_internals15.unlinkSync(tempPath);
|
|
37648
37954
|
} catch {}
|
|
37649
37955
|
}
|
|
37650
37956
|
}
|
|
37651
|
-
var
|
|
37957
|
+
var _internals15;
|
|
37652
37958
|
var init_task_file = __esm(() => {
|
|
37653
37959
|
init_bun_compat();
|
|
37654
37960
|
init_lock();
|
|
37655
|
-
|
|
37961
|
+
_internals15 = {
|
|
37656
37962
|
renameSync: renameSync6,
|
|
37657
37963
|
unlinkSync: unlinkSync4
|
|
37658
37964
|
};
|
|
@@ -40313,7 +40619,7 @@ async function activateProposal(directory, slug, force = false, options = {}) {
|
|
|
40313
40619
|
try {
|
|
40314
40620
|
await stampSourceEntries(directory, cleanSlug, fm.sourceKnowledgeIds);
|
|
40315
40621
|
try {
|
|
40316
|
-
|
|
40622
|
+
_internals16.unlinkSync(from);
|
|
40317
40623
|
} catch {}
|
|
40318
40624
|
return {
|
|
40319
40625
|
activated: true,
|
|
@@ -40418,7 +40724,7 @@ async function autoApplyProposals(directory, llmDelegate) {
|
|
|
40418
40724
|
}
|
|
40419
40725
|
} else if (verdict === "REJECT") {
|
|
40420
40726
|
try {
|
|
40421
|
-
|
|
40727
|
+
_internals16.unlinkSync(proposal.path);
|
|
40422
40728
|
warn(`[skill-generator] auto-apply rejected proposal "${proposal.slug}"; deleted ${proposal.path}`);
|
|
40423
40729
|
result.rejected.push(proposal.slug);
|
|
40424
40730
|
} catch (delErr) {
|
|
@@ -40528,7 +40834,7 @@ async function regenerateSkill(directory, slug, options = {}) {
|
|
|
40528
40834
|
matchedEntries = all.filter((e) => idSet.has(e.id));
|
|
40529
40835
|
if (matchedEntries.length === idSet.size && idSet.size > 0 && matchedEntries.every((e) => e.status === "archived")) {
|
|
40530
40836
|
try {
|
|
40531
|
-
await
|
|
40837
|
+
await _internals16.retireSkill(directory, cleanSlug, "auto-retire: all source knowledge entries archived at regeneration time");
|
|
40532
40838
|
} catch {}
|
|
40533
40839
|
return {
|
|
40534
40840
|
regenerated: false,
|
|
@@ -40551,7 +40857,7 @@ async function regenerateSkill(directory, slug, options = {}) {
|
|
|
40551
40857
|
const activeEntries = matchedEntries.filter((e) => e.status !== "archived");
|
|
40552
40858
|
if (activeEntries.length === 0) {
|
|
40553
40859
|
try {
|
|
40554
|
-
await
|
|
40860
|
+
await _internals16.retireSkill(directory, cleanSlug, "auto-retire: all matched source knowledge entries archived at regeneration time");
|
|
40555
40861
|
} catch {}
|
|
40556
40862
|
return {
|
|
40557
40863
|
regenerated: false,
|
|
@@ -40668,7 +40974,7 @@ async function regenerateSkill(directory, slug, options = {}) {
|
|
|
40668
40974
|
evaluation
|
|
40669
40975
|
};
|
|
40670
40976
|
}
|
|
40671
|
-
var SLUG_PATTERN2, DEFAULT_SKILL_MIN_CONFIDENCE = 0.7, DEFAULT_SKILL_MIN_CONFIRMATIONS = 2, STRONG_SKILL_OUTCOME_COUNT = 3, MIN_CLUSTER_SIZE = 2, JACCARD_THRESHOLD = 0.5, AUTO_APPLY_BATCH_LIMIT = 5,
|
|
40977
|
+
var SLUG_PATTERN2, DEFAULT_SKILL_MIN_CONFIDENCE = 0.7, DEFAULT_SKILL_MIN_CONFIRMATIONS = 2, STRONG_SKILL_OUTCOME_COUNT = 3, MIN_CLUSTER_SIZE = 2, JACCARD_THRESHOLD = 0.5, AUTO_APPLY_BATCH_LIMIT = 5, _internals16;
|
|
40672
40978
|
var init_skill_generator = __esm(() => {
|
|
40673
40979
|
init_knowledge_events();
|
|
40674
40980
|
init_knowledge_store();
|
|
@@ -40677,7 +40983,7 @@ var init_skill_generator = __esm(() => {
|
|
|
40677
40983
|
init_skill_changelog();
|
|
40678
40984
|
init_skill_evaluator();
|
|
40679
40985
|
SLUG_PATTERN2 = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
40680
|
-
|
|
40986
|
+
_internals16 = {
|
|
40681
40987
|
sanitizeSlug,
|
|
40682
40988
|
isValidSlug: isValidSlug2,
|
|
40683
40989
|
selectCandidateEntries,
|
|
@@ -40900,9 +41206,9 @@ function parseFeedbackMarker(raw) {
|
|
|
40900
41206
|
function readFeedbackAppliedEntryIds(directory) {
|
|
40901
41207
|
const resolved = resolveLogPath(directory);
|
|
40902
41208
|
const processed = new Set;
|
|
40903
|
-
if (!
|
|
41209
|
+
if (!_internals17.existsSync(resolved))
|
|
40904
41210
|
return processed;
|
|
40905
|
-
const raw =
|
|
41211
|
+
const raw = _internals17.readFileSync(resolved, "utf-8");
|
|
40906
41212
|
for (const line of raw.split(`
|
|
40907
41213
|
`)) {
|
|
40908
41214
|
const trimmed = line.trim();
|
|
@@ -40923,15 +41229,15 @@ function appendFeedbackAppliedMarker(directory, processedEntryIds) {
|
|
|
40923
41229
|
return;
|
|
40924
41230
|
const resolved = resolveLogPath(directory);
|
|
40925
41231
|
const dir = path20.dirname(resolved);
|
|
40926
|
-
if (!
|
|
40927
|
-
|
|
41232
|
+
if (!_internals17.existsSync(dir)) {
|
|
41233
|
+
_internals17.mkdirSync(dir, { recursive: true });
|
|
40928
41234
|
}
|
|
40929
41235
|
const marker = {
|
|
40930
41236
|
type: "feedback_applied",
|
|
40931
41237
|
timestamp: new Date().toISOString(),
|
|
40932
41238
|
processedEntryIds: [...new Set(processedEntryIds)]
|
|
40933
41239
|
};
|
|
40934
|
-
|
|
41240
|
+
_internals17.appendFileSync(resolved, `${JSON.stringify(marker)}
|
|
40935
41241
|
`, "utf-8");
|
|
40936
41242
|
}
|
|
40937
41243
|
function appendSkillUsageEntry(directory, entry) {
|
|
@@ -40968,11 +41274,11 @@ function appendSkillUsageEntry(directory, entry) {
|
|
|
40968
41274
|
}
|
|
40969
41275
|
const resolved = validateSwarmPath(directory, "skill-usage.jsonl");
|
|
40970
41276
|
const dir = path20.dirname(resolved);
|
|
40971
|
-
if (!
|
|
40972
|
-
|
|
41277
|
+
if (!_internals17.existsSync(dir)) {
|
|
41278
|
+
_internals17.mkdirSync(dir, { recursive: true });
|
|
40973
41279
|
}
|
|
40974
41280
|
const fullEntry = {
|
|
40975
|
-
id:
|
|
41281
|
+
id: _internals17.generateId(),
|
|
40976
41282
|
skillPath,
|
|
40977
41283
|
agentName,
|
|
40978
41284
|
taskID,
|
|
@@ -40982,21 +41288,21 @@ function appendSkillUsageEntry(directory, entry) {
|
|
|
40982
41288
|
...reviewerNotes !== undefined && { reviewerNotes },
|
|
40983
41289
|
...skillVersion !== undefined && { skillVersion }
|
|
40984
41290
|
};
|
|
40985
|
-
|
|
41291
|
+
_internals17.appendFileSync(resolved, `${JSON.stringify(fullEntry)}
|
|
40986
41292
|
`, "utf-8");
|
|
40987
41293
|
try {
|
|
40988
|
-
const stat5 =
|
|
41294
|
+
const stat5 = _internals17.statSync(resolved);
|
|
40989
41295
|
if (stat5.size > SKILL_USAGE_LOG_ROTATE_BYTES) {
|
|
40990
|
-
|
|
41296
|
+
_internals17.pruneSkillUsageLog(directory, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL);
|
|
40991
41297
|
}
|
|
40992
41298
|
} catch {}
|
|
40993
41299
|
}
|
|
40994
41300
|
function readSkillUsageEntries(directory, options) {
|
|
40995
41301
|
const resolved = resolveLogPath(directory);
|
|
40996
|
-
if (!
|
|
41302
|
+
if (!_internals17.existsSync(resolved)) {
|
|
40997
41303
|
return [];
|
|
40998
41304
|
}
|
|
40999
|
-
const raw =
|
|
41305
|
+
const raw = _internals17.readFileSync(resolved, "utf-8");
|
|
41000
41306
|
const entries = [];
|
|
41001
41307
|
for (const line of raw.split(`
|
|
41002
41308
|
`)) {
|
|
@@ -41035,20 +41341,20 @@ function readSkillUsageEntries(directory, options) {
|
|
|
41035
41341
|
}
|
|
41036
41342
|
function readSkillUsageEntriesTail(directory, filters, maxBytes = TAIL_BYTES_DEFAULT) {
|
|
41037
41343
|
const logPath = resolveLogPath(directory);
|
|
41038
|
-
if (!
|
|
41344
|
+
if (!_internals17.existsSync(logPath))
|
|
41039
41345
|
return [];
|
|
41040
41346
|
try {
|
|
41041
41347
|
const normalizedMaxBytes = Number.isFinite(maxBytes) ? maxBytes : TAIL_BYTES_DEFAULT;
|
|
41042
41348
|
const boundedMaxBytes = Math.min(Math.max(1, normalizedMaxBytes), MAX_TAIL_BYTES);
|
|
41043
|
-
const stat5 =
|
|
41349
|
+
const stat5 = _internals17.statSync(logPath);
|
|
41044
41350
|
const start = Math.max(0, stat5.size - boundedMaxBytes);
|
|
41045
|
-
const fd =
|
|
41351
|
+
const fd = _internals17.openSync(logPath, "r");
|
|
41046
41352
|
try {
|
|
41047
41353
|
const readLen = stat5.size - start;
|
|
41048
41354
|
if (readLen === 0)
|
|
41049
41355
|
return [];
|
|
41050
41356
|
const buf = Buffer.alloc(readLen);
|
|
41051
|
-
|
|
41357
|
+
_internals17.readSync(fd, buf, 0, buf.length, start);
|
|
41052
41358
|
const content = buf.toString("utf-8");
|
|
41053
41359
|
let usable;
|
|
41054
41360
|
if (start > 0) {
|
|
@@ -41075,7 +41381,7 @@ function readSkillUsageEntriesTail(directory, filters, maxBytes = TAIL_BYTES_DEF
|
|
|
41075
41381
|
}
|
|
41076
41382
|
return entries;
|
|
41077
41383
|
} finally {
|
|
41078
|
-
|
|
41384
|
+
_internals17.closeSync(fd);
|
|
41079
41385
|
}
|
|
41080
41386
|
} catch {
|
|
41081
41387
|
return [];
|
|
@@ -41112,7 +41418,7 @@ function computeComplianceByVersion(entries, skillPath) {
|
|
|
41112
41418
|
}
|
|
41113
41419
|
function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
41114
41420
|
const resolved = resolveLogPath(directory);
|
|
41115
|
-
if (!
|
|
41421
|
+
if (!_internals17.existsSync(resolved)) {
|
|
41116
41422
|
return { pruned: 0, remaining: 0 };
|
|
41117
41423
|
}
|
|
41118
41424
|
const allEntries = readSkillUsageEntries(directory);
|
|
@@ -41148,13 +41454,13 @@ function pruneSkillUsageLog(directory, maxEntriesPerSkill = 500) {
|
|
|
41148
41454
|
`).concat(`
|
|
41149
41455
|
`);
|
|
41150
41456
|
try {
|
|
41151
|
-
|
|
41152
|
-
|
|
41457
|
+
_internals17.writeFileSync(tmpPath, content, "utf-8");
|
|
41458
|
+
_internals17.renameSync(tmpPath, resolved);
|
|
41153
41459
|
} catch (writeErr) {
|
|
41154
41460
|
const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
|
|
41155
41461
|
try {
|
|
41156
|
-
if (
|
|
41157
|
-
|
|
41462
|
+
if (_internals17.existsSync(tmpPath)) {
|
|
41463
|
+
_internals17.writeFileSync(tmpPath, "", "utf-8");
|
|
41158
41464
|
}
|
|
41159
41465
|
} catch {}
|
|
41160
41466
|
return { pruned: 0, remaining: allEntries.length, error: msg };
|
|
@@ -41176,10 +41482,10 @@ async function resolveSourceKnowledgeIds(directory, skillPath) {
|
|
|
41176
41482
|
if (!isContained) {
|
|
41177
41483
|
return [];
|
|
41178
41484
|
}
|
|
41179
|
-
if (!
|
|
41485
|
+
if (!_internals17.existsSync(absolute)) {
|
|
41180
41486
|
return [];
|
|
41181
41487
|
}
|
|
41182
|
-
const content =
|
|
41488
|
+
const content = _internals17.readFileSync(absolute, "utf-8");
|
|
41183
41489
|
return parseGeneratedFromKnowledge(content);
|
|
41184
41490
|
} catch (err) {
|
|
41185
41491
|
console.warn("[skill-usage-log] resolveSourceKnowledgeIds failed (fail-open):", err instanceof Error ? err.message : String(err));
|
|
@@ -41279,11 +41585,11 @@ async function applySkillUsageFeedback(directory, options) {
|
|
|
41279
41585
|
}
|
|
41280
41586
|
return { processed, bumps };
|
|
41281
41587
|
}
|
|
41282
|
-
var
|
|
41588
|
+
var _internals17, TAIL_BYTES_DEFAULT, MAX_TAIL_BYTES, SKILL_USAGE_LOG_ROTATE_BYTES, SKILL_USAGE_LOG_MAX_ENTRIES_PER_SKILL = 500, COMPLIANCE_BOOST = 0.05, VIOLATION_DECAY = 0.1;
|
|
41283
41589
|
var init_skill_usage_log = __esm(() => {
|
|
41284
41590
|
init_knowledge_store();
|
|
41285
41591
|
init_utils2();
|
|
41286
|
-
|
|
41592
|
+
_internals17 = {
|
|
41287
41593
|
generateId: () => crypto3.randomUUID(),
|
|
41288
41594
|
appendFileSync: fs9.appendFileSync.bind(fs9),
|
|
41289
41595
|
readFileSync: fs9.readFileSync.bind(fs9),
|
|
@@ -42079,7 +42385,7 @@ function rankSkillsForContext(skills, taskContext, directory) {
|
|
|
42079
42385
|
const results = [];
|
|
42080
42386
|
for (const skillPath of skills) {
|
|
42081
42387
|
const skillEntries = allEntries.filter((e) => e.skillPath === skillPath);
|
|
42082
|
-
const metadata =
|
|
42388
|
+
const metadata = _internals18.readSkillMetadata(skillPath, directory);
|
|
42083
42389
|
const score = computeSkillRelevanceScore(skillPath, taskContext, skillEntries, metadata);
|
|
42084
42390
|
const entriesWithVerdict = skillEntries.filter((e) => e.complianceVerdict !== undefined && e.complianceVerdict !== "not_checked");
|
|
42085
42391
|
const compliantCount = entriesWithVerdict.filter((e) => e.complianceVerdict === "compliant").length;
|
|
@@ -42134,7 +42440,7 @@ function formatSkillIndexWithContext(skills, directory) {
|
|
|
42134
42440
|
} catch {}
|
|
42135
42441
|
if (!hasHistory) {
|
|
42136
42442
|
return skills.map((sp) => {
|
|
42137
|
-
const meta3 =
|
|
42443
|
+
const meta3 = _internals18.readSkillMetadata(sp, directory);
|
|
42138
42444
|
return ` - file:${meta3.path} - ${meta3.name}: ${meta3.description}`;
|
|
42139
42445
|
}).join(`
|
|
42140
42446
|
`);
|
|
@@ -42142,7 +42448,7 @@ function formatSkillIndexWithContext(skills, directory) {
|
|
|
42142
42448
|
const lines = [];
|
|
42143
42449
|
for (const skillPath of skills) {
|
|
42144
42450
|
const stats = getSkillStats(skillPath, directory);
|
|
42145
|
-
const meta3 =
|
|
42451
|
+
const meta3 = _internals18.readSkillMetadata(skillPath, directory);
|
|
42146
42452
|
const compliancePct = Math.round(stats.complianceRate * 100);
|
|
42147
42453
|
const topAgentNames = stats.topAgents.slice(0, 3).map((a) => a.agent).join(", ");
|
|
42148
42454
|
lines.push(` - file:${meta3.path} - ${meta3.name}: ${meta3.description} (used: ${stats.totalUsage}, compliance: ${compliancePct}%)` + (stats.topAgents.length > 0 ? ` \u2192 ${topAgentNames}` : ""));
|
|
@@ -42150,12 +42456,12 @@ function formatSkillIndexWithContext(skills, directory) {
|
|
|
42150
42456
|
return lines.join(`
|
|
42151
42457
|
`);
|
|
42152
42458
|
}
|
|
42153
|
-
var FREQUENCY_CAP = 10, FREQUENCY_WEIGHT = 0.3, COMPLIANCE_WEIGHT = 0.3, RECENCY_WEIGHT = 0.15, TASK_DIVERSITY_WEIGHT = 0.05, CONTEXT_WEIGHT = 0.2, WORKFLOW_BOOST = 0.1, SKILL_TRIGGER_BOOST = 0.3, SKILL_TRIGGER_MIN_LENGTH = 3, MAX_SKILL_TRIGGERS = 20, MAX_SKILL_TRIGGER_LENGTH = 120, WORKFLOW_BOOST_MIN_CONTEXT = 0.05, RECENCY_DECAY_MS, SKILL_FRONTMATTER_READ_BYTES,
|
|
42459
|
+
var FREQUENCY_CAP = 10, FREQUENCY_WEIGHT = 0.3, COMPLIANCE_WEIGHT = 0.3, RECENCY_WEIGHT = 0.15, TASK_DIVERSITY_WEIGHT = 0.05, CONTEXT_WEIGHT = 0.2, WORKFLOW_BOOST = 0.1, SKILL_TRIGGER_BOOST = 0.3, SKILL_TRIGGER_MIN_LENGTH = 3, MAX_SKILL_TRIGGERS = 20, MAX_SKILL_TRIGGER_LENGTH = 120, WORKFLOW_BOOST_MIN_CONTEXT = 0.05, RECENCY_DECAY_MS, SKILL_FRONTMATTER_READ_BYTES, _internals18, MIN_KEYWORD_LENGTH = 3;
|
|
42154
42460
|
var init_skill_scoring = __esm(() => {
|
|
42155
42461
|
init_skill_usage_log();
|
|
42156
42462
|
RECENCY_DECAY_MS = 30 * 24 * 60 * 60 * 1000;
|
|
42157
42463
|
SKILL_FRONTMATTER_READ_BYTES = 16 * 1024;
|
|
42158
|
-
|
|
42464
|
+
_internals18 = {
|
|
42159
42465
|
computeSkillRelevanceScore: null,
|
|
42160
42466
|
rankSkillsForContext: null,
|
|
42161
42467
|
getSkillStats: null,
|
|
@@ -42167,16 +42473,16 @@ var init_skill_scoring = __esm(() => {
|
|
|
42167
42473
|
computeContextMatchScore: null,
|
|
42168
42474
|
computeTriggerMatchBoost: null
|
|
42169
42475
|
};
|
|
42170
|
-
|
|
42171
|
-
|
|
42172
|
-
|
|
42173
|
-
|
|
42174
|
-
|
|
42175
|
-
|
|
42176
|
-
|
|
42177
|
-
|
|
42178
|
-
|
|
42179
|
-
|
|
42476
|
+
_internals18.computeSkillRelevanceScore = computeSkillRelevanceScore;
|
|
42477
|
+
_internals18.rankSkillsForContext = rankSkillsForContext;
|
|
42478
|
+
_internals18.getSkillStats = getSkillStats;
|
|
42479
|
+
_internals18.formatSkillIndexWithContext = formatSkillIndexWithContext;
|
|
42480
|
+
_internals18.parseSkillFrontmatter = parseSkillFrontmatter;
|
|
42481
|
+
_internals18.readSkillMetadata = readSkillMetadata;
|
|
42482
|
+
_internals18.extractSkillName = extractSkillName;
|
|
42483
|
+
_internals18.computeRecencyScore = computeRecencyScore;
|
|
42484
|
+
_internals18.computeContextMatchScore = computeContextMatchScore;
|
|
42485
|
+
_internals18.computeTriggerMatchBoost = computeTriggerMatchBoost;
|
|
42180
42486
|
});
|
|
42181
42487
|
|
|
42182
42488
|
// src/hooks/skill-propagation-gate.ts
|
|
@@ -42281,10 +42587,10 @@ function parseYamlValue(value) {
|
|
|
42281
42587
|
}
|
|
42282
42588
|
function loadRoutingSkills(directory, targetAgent) {
|
|
42283
42589
|
const routingPath = path24.join(directory, ".opencode", "skill-routing.yaml");
|
|
42284
|
-
if (!
|
|
42590
|
+
if (!_internals19.existsSync(routingPath))
|
|
42285
42591
|
return [];
|
|
42286
42592
|
try {
|
|
42287
|
-
const content =
|
|
42593
|
+
const content = _internals19.readFileSync(routingPath, "utf-8");
|
|
42288
42594
|
const config3 = parseSimpleYaml(content);
|
|
42289
42595
|
if (!config3?.routing)
|
|
42290
42596
|
return [];
|
|
@@ -42301,11 +42607,11 @@ function discoverAvailableSkills(directory) {
|
|
|
42301
42607
|
const results = [];
|
|
42302
42608
|
for (const root of SKILL_SEARCH_ROOTS) {
|
|
42303
42609
|
const rootPath = path24.join(directory, root);
|
|
42304
|
-
if (!
|
|
42610
|
+
if (!_internals19.existsSync(rootPath))
|
|
42305
42611
|
continue;
|
|
42306
42612
|
let entries;
|
|
42307
42613
|
try {
|
|
42308
|
-
entries =
|
|
42614
|
+
entries = _internals19.readdirSync(rootPath);
|
|
42309
42615
|
} catch {
|
|
42310
42616
|
continue;
|
|
42311
42617
|
}
|
|
@@ -42313,11 +42619,11 @@ function discoverAvailableSkills(directory) {
|
|
|
42313
42619
|
if (entry.startsWith("."))
|
|
42314
42620
|
continue;
|
|
42315
42621
|
const skillDir = path24.join(rootPath, entry);
|
|
42316
|
-
if (
|
|
42622
|
+
if (_internals19.existsSync(path24.join(skillDir, "retired.marker")))
|
|
42317
42623
|
continue;
|
|
42318
42624
|
const skillFile = path24.join(skillDir, "SKILL.md");
|
|
42319
42625
|
try {
|
|
42320
|
-
if (
|
|
42626
|
+
if (_internals19.statSync(skillDir).isDirectory() && _internals19.existsSync(skillFile)) {
|
|
42321
42627
|
results.push(path24.join(root, entry, "SKILL.md").replace(/\\/g, "/"));
|
|
42322
42628
|
}
|
|
42323
42629
|
} catch (err) {
|
|
@@ -42349,7 +42655,7 @@ function parseDelegationArgs(args) {
|
|
|
42349
42655
|
}
|
|
42350
42656
|
if (!targetAgent)
|
|
42351
42657
|
return null;
|
|
42352
|
-
const skillsField = prompt ?
|
|
42658
|
+
const skillsField = prompt ? _internals19.extractSkillsFieldFromPrompt(prompt) : "";
|
|
42353
42659
|
return { targetAgent, skillsField };
|
|
42354
42660
|
}
|
|
42355
42661
|
function extractSkillsFieldFromPrompt(prompt) {
|
|
@@ -42390,10 +42696,10 @@ function writeWarnEvent(directory, record3) {
|
|
|
42390
42696
|
const filePath = path24.join(directory, ".swarm", "events.jsonl");
|
|
42391
42697
|
try {
|
|
42392
42698
|
const dir = path24.dirname(filePath);
|
|
42393
|
-
if (!
|
|
42394
|
-
|
|
42699
|
+
if (!_internals19.existsSync(dir)) {
|
|
42700
|
+
_internals19.mkdirSync(dir, { recursive: true });
|
|
42395
42701
|
}
|
|
42396
|
-
|
|
42702
|
+
_internals19.appendFileSync(filePath, `${JSON.stringify(record3)}
|
|
42397
42703
|
`, "utf-8");
|
|
42398
42704
|
} catch (err) {
|
|
42399
42705
|
warn(`[skill-propagation-gate] failed to write warning event: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -42444,19 +42750,19 @@ async function skillPropagationGateBefore(directory, input, config3) {
|
|
|
42444
42750
|
const baseAgent = stripKnownSwarmPrefix(agentRaw);
|
|
42445
42751
|
if (baseAgent !== "architect")
|
|
42446
42752
|
return { blocked: false, reason: null, recommendedSkills: undefined };
|
|
42447
|
-
const parsed =
|
|
42753
|
+
const parsed = _internals19.parseDelegationArgs(input.args);
|
|
42448
42754
|
if (!parsed)
|
|
42449
42755
|
return { blocked: false, reason: null, recommendedSkills: undefined };
|
|
42450
42756
|
const targetBase = stripKnownSwarmPrefix(parsed.targetAgent);
|
|
42451
|
-
if (!
|
|
42757
|
+
if (!_internals19.SKILL_CAPABLE_AGENTS.has(targetBase))
|
|
42452
42758
|
return { blocked: false, reason: null, recommendedSkills: undefined };
|
|
42453
42759
|
const sessionID = typeof input.sessionID === "string" ? input.sessionID : "unknown";
|
|
42454
|
-
const availableSkills =
|
|
42760
|
+
const availableSkills = _internals19.discoverAvailableSkills(directory);
|
|
42455
42761
|
const skillsValue = parsed.skillsField.trim();
|
|
42456
42762
|
if (skillsValue && skillsValue.toLowerCase() !== "none") {
|
|
42457
42763
|
const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
|
|
42458
|
-
const taskId =
|
|
42459
|
-
const skillPaths =
|
|
42764
|
+
const taskId = _internals19.extractTaskIdFromPrompt(prompt);
|
|
42765
|
+
const skillPaths = _internals19.parseSkillPaths(skillsValue);
|
|
42460
42766
|
let coderSkillPaths = [];
|
|
42461
42767
|
if (prompt) {
|
|
42462
42768
|
for (const line of prompt.split(`
|
|
@@ -42464,7 +42770,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
|
|
|
42464
42770
|
const trimmed = line.trim();
|
|
42465
42771
|
if (trimmed.startsWith("SKILLS_USED_BY_CODER:")) {
|
|
42466
42772
|
const fieldVal = trimmed.slice("SKILLS_USED_BY_CODER:".length).trim();
|
|
42467
|
-
coderSkillPaths =
|
|
42773
|
+
coderSkillPaths = _internals19.parseSkillPaths(fieldVal);
|
|
42468
42774
|
break;
|
|
42469
42775
|
}
|
|
42470
42776
|
}
|
|
@@ -42472,7 +42778,7 @@ async function skillPropagationGateBefore(directory, input, config3) {
|
|
|
42472
42778
|
const allPaths = [...new Set([...skillPaths, ...coderSkillPaths])];
|
|
42473
42779
|
for (const skillPath of allPaths) {
|
|
42474
42780
|
try {
|
|
42475
|
-
|
|
42781
|
+
_internals19.appendSkillUsageEntry(directory, {
|
|
42476
42782
|
skillPath,
|
|
42477
42783
|
agentName: targetBase,
|
|
42478
42784
|
taskID: taskId,
|
|
@@ -42489,18 +42795,18 @@ async function skillPropagationGateBefore(directory, input, config3) {
|
|
|
42489
42795
|
let scored = [];
|
|
42490
42796
|
if (skillsValue.toLowerCase() !== "none" && availableSkills.length > 0) {
|
|
42491
42797
|
try {
|
|
42492
|
-
const sessionEntries =
|
|
42798
|
+
const sessionEntries = _internals19.readSkillUsageEntriesTail(directory, {
|
|
42493
42799
|
sessionID
|
|
42494
42800
|
});
|
|
42495
|
-
if (sessionEntries.length >
|
|
42801
|
+
if (sessionEntries.length > _internals19.MAX_SCORING_SESSION_ENTRIES) {
|
|
42496
42802
|
scoringSkipped = true;
|
|
42497
|
-
warn(`[skill-propagation-gate] skipping scoring \u2014 tail window has ${sessionEntries.length} session entries (limit: ${
|
|
42803
|
+
warn(`[skill-propagation-gate] skipping scoring \u2014 tail window has ${sessionEntries.length} session entries (limit: ${_internals19.MAX_SCORING_SESSION_ENTRIES})`);
|
|
42498
42804
|
} else {
|
|
42499
42805
|
const prompt = typeof input.args?.prompt === "string" ? String(input.args.prompt) : "";
|
|
42500
42806
|
scored = availableSkills.map((skillPath) => {
|
|
42501
42807
|
const skillEntries = sessionEntries.filter((e) => e.skillPath === skillPath);
|
|
42502
|
-
const metadata =
|
|
42503
|
-
const score =
|
|
42808
|
+
const metadata = _internals19.readSkillMetadata(skillPath, directory);
|
|
42809
|
+
const score = _internals19.computeSkillRelevanceScore(skillPath, prompt, skillEntries, metadata);
|
|
42504
42810
|
return { skillPath, score, usageCount: skillEntries.length };
|
|
42505
42811
|
}).sort((a, b) => b.score - a.score || b.usageCount - a.usageCount);
|
|
42506
42812
|
if (scored.length > 0) {
|
|
@@ -42514,12 +42820,12 @@ async function skillPropagationGateBefore(directory, input, config3) {
|
|
|
42514
42820
|
}
|
|
42515
42821
|
}
|
|
42516
42822
|
try {
|
|
42517
|
-
const routingPaths =
|
|
42823
|
+
const routingPaths = _internals19.loadRoutingSkills(directory, targetBase);
|
|
42518
42824
|
if (routingPaths.length > 0) {
|
|
42519
42825
|
const existingPaths = new Set(scored.map((s) => s.skillPath));
|
|
42520
42826
|
for (const routingPath of routingPaths) {
|
|
42521
42827
|
const routedSkillDir = path24.dirname(path24.join(directory, routingPath));
|
|
42522
|
-
if (
|
|
42828
|
+
if (_internals19.existsSync(path24.join(routedSkillDir, "retired.marker")))
|
|
42523
42829
|
continue;
|
|
42524
42830
|
if (!existingPaths.has(routingPath)) {
|
|
42525
42831
|
scored.push({
|
|
@@ -42545,12 +42851,12 @@ async function skillPropagationGateBefore(directory, input, config3) {
|
|
|
42545
42851
|
} else if (typeof scored !== "undefined" && scored.length > 0) {
|
|
42546
42852
|
skillsForIndex = scored.map((r) => r.skillPath);
|
|
42547
42853
|
}
|
|
42548
|
-
const formattedIndex =
|
|
42854
|
+
const formattedIndex = _internals19.formatSkillIndexWithContext(skillsForIndex, directory);
|
|
42549
42855
|
if (formattedIndex.length > 0) {
|
|
42550
42856
|
const contextPath = path24.join(directory, ".swarm", "context.md");
|
|
42551
42857
|
let existingContent = "";
|
|
42552
|
-
if (
|
|
42553
|
-
existingContent =
|
|
42858
|
+
if (_internals19.existsSync(contextPath)) {
|
|
42859
|
+
existingContent = _internals19.readFileSync(contextPath, "utf-8");
|
|
42554
42860
|
}
|
|
42555
42861
|
const sectionHeader = "## Available Skills";
|
|
42556
42862
|
const newSection = `${sectionHeader}
|
|
@@ -42570,10 +42876,10 @@ ${newSection}`;
|
|
|
42570
42876
|
}
|
|
42571
42877
|
}
|
|
42572
42878
|
const swarmDir = path24.dirname(contextPath);
|
|
42573
|
-
if (!
|
|
42574
|
-
|
|
42879
|
+
if (!_internals19.existsSync(swarmDir)) {
|
|
42880
|
+
_internals19.mkdirSync(swarmDir, { recursive: true });
|
|
42575
42881
|
}
|
|
42576
|
-
|
|
42882
|
+
_internals19.writeFileSync(contextPath, updatedContent, "utf-8");
|
|
42577
42883
|
}
|
|
42578
42884
|
} catch (err) {
|
|
42579
42885
|
warn(`[skill-propagation-gate] failed to write skill index to context.md: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -42599,7 +42905,7 @@ ${newSection}`;
|
|
|
42599
42905
|
});
|
|
42600
42906
|
const warningMsg = `Skill propagation warning: Delegating to ${targetBase} without SKILLS field. ` + `Available skills: ${skillNames.join(", ")}`;
|
|
42601
42907
|
try {
|
|
42602
|
-
|
|
42908
|
+
_internals19.writeWarnEvent(directory, {
|
|
42603
42909
|
type: "skill_propagation_warn",
|
|
42604
42910
|
timestamp: new Date().toISOString(),
|
|
42605
42911
|
tool: toolName,
|
|
@@ -42626,7 +42932,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
|
|
|
42626
42932
|
let dedupKeys = new Set;
|
|
42627
42933
|
let existingEntries = [];
|
|
42628
42934
|
try {
|
|
42629
|
-
existingEntries =
|
|
42935
|
+
existingEntries = _internals19.readSkillUsageEntriesTail(directory, {
|
|
42630
42936
|
sessionID
|
|
42631
42937
|
});
|
|
42632
42938
|
dedupKeys = new Set(existingEntries.map((e, i) => {
|
|
@@ -42664,7 +42970,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
|
|
|
42664
42970
|
}
|
|
42665
42971
|
const coderMatch = trimmed.match(CODER_SKILLS_PATTERN);
|
|
42666
42972
|
if (coderMatch) {
|
|
42667
|
-
const parsed =
|
|
42973
|
+
const parsed = _internals19.parseSkillPaths(coderMatch[1]);
|
|
42668
42974
|
skillPaths.push(...parsed);
|
|
42669
42975
|
}
|
|
42670
42976
|
}
|
|
@@ -42697,7 +43003,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
|
|
|
42697
43003
|
if (isDuplicate(skillPath, "reviewer", resolvedTaskID))
|
|
42698
43004
|
continue;
|
|
42699
43005
|
try {
|
|
42700
|
-
|
|
43006
|
+
_internals19.appendSkillUsageEntry(directory, {
|
|
42701
43007
|
skillPath,
|
|
42702
43008
|
agentName: "reviewer",
|
|
42703
43009
|
taskID: resolvedTaskID,
|
|
@@ -42741,15 +43047,15 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
|
|
|
42741
43047
|
skillsField = trimmed.slice("SKILLS:".length).trim();
|
|
42742
43048
|
}
|
|
42743
43049
|
if (currentTargetAgent && skillsField && skillsField.toLowerCase() !== "none") {
|
|
42744
|
-
const skillPaths =
|
|
42745
|
-
const taskId =
|
|
43050
|
+
const skillPaths = _internals19.parseSkillPaths(skillsField);
|
|
43051
|
+
const taskId = _internals19.extractTaskIdFromPrompt(text);
|
|
42746
43052
|
for (const skillPath of skillPaths) {
|
|
42747
43053
|
if (hadRecordingError)
|
|
42748
43054
|
break;
|
|
42749
43055
|
if (isDuplicate(skillPath, currentTargetAgent, taskId))
|
|
42750
43056
|
continue;
|
|
42751
43057
|
try {
|
|
42752
|
-
|
|
43058
|
+
_internals19.appendSkillUsageEntry(directory, {
|
|
42753
43059
|
skillPath,
|
|
42754
43060
|
agentName: currentTargetAgent,
|
|
42755
43061
|
taskID: taskId,
|
|
@@ -42769,7 +43075,7 @@ async function skillPropagationTransformScan(directory, output, sessionID) {
|
|
|
42769
43075
|
break;
|
|
42770
43076
|
}
|
|
42771
43077
|
}
|
|
42772
|
-
var SKILL_CAPABLE_AGENTS, SKILL_SEARCH_ROOTS, MAX_SCORING_SESSION_ENTRIES = 500,
|
|
43078
|
+
var SKILL_CAPABLE_AGENTS, SKILL_SEARCH_ROOTS, MAX_SCORING_SESSION_ENTRIES = 500, _internals19, COMPLIANCE_PATTERN, CODER_SKILLS_PATTERN, REVIEWER_TASK_PATTERN;
|
|
42773
43079
|
var init_skill_propagation_gate = __esm(() => {
|
|
42774
43080
|
init_schema();
|
|
42775
43081
|
init_logger();
|
|
@@ -42788,7 +43094,7 @@ var init_skill_propagation_gate = __esm(() => {
|
|
|
42788
43094
|
".opencode/skills/generated",
|
|
42789
43095
|
".claude/skills"
|
|
42790
43096
|
];
|
|
42791
|
-
|
|
43097
|
+
_internals19 = {
|
|
42792
43098
|
readdirSync: fs11.readdirSync.bind(fs11),
|
|
42793
43099
|
existsSync: fs11.existsSync.bind(fs11),
|
|
42794
43100
|
statSync: fs11.statSync.bind(fs11),
|
|
@@ -42817,16 +43123,16 @@ var init_skill_propagation_gate = __esm(() => {
|
|
|
42817
43123
|
COMPLIANCE_PATTERN = /SKILL_COMPLIANCE\s*:\s*(COMPLIANT|PARTIAL|VIOLATED)(?:\s*(?:\u2014|-)\s*(.*))?\s*$/i;
|
|
42818
43124
|
CODER_SKILLS_PATTERN = /SKILLS_USED_BY_CODER\s*:\s*(.+)/i;
|
|
42819
43125
|
REVIEWER_TASK_PATTERN = /TASK\s*:\s*(\S+)/i;
|
|
42820
|
-
|
|
42821
|
-
|
|
42822
|
-
|
|
42823
|
-
|
|
42824
|
-
|
|
42825
|
-
|
|
42826
|
-
|
|
42827
|
-
|
|
42828
|
-
|
|
42829
|
-
|
|
43126
|
+
_internals19.skillPropagationGateBefore = skillPropagationGateBefore;
|
|
43127
|
+
_internals19.skillPropagationTransformScan = skillPropagationTransformScan;
|
|
43128
|
+
_internals19.writeWarnEvent = writeWarnEvent;
|
|
43129
|
+
_internals19.discoverAvailableSkills = discoverAvailableSkills;
|
|
43130
|
+
_internals19.parseDelegationArgs = parseDelegationArgs;
|
|
43131
|
+
_internals19.parseSkillPaths = parseSkillPaths;
|
|
43132
|
+
_internals19.extractTaskIdFromPrompt = extractTaskIdFromPrompt;
|
|
43133
|
+
_internals19.extractSkillsFieldFromPrompt = extractSkillsFieldFromPrompt;
|
|
43134
|
+
_internals19.formatSkillIndexWithContext = formatSkillIndexWithContext;
|
|
43135
|
+
_internals19.loadRoutingSkills = loadRoutingSkills;
|
|
42830
43136
|
});
|
|
42831
43137
|
|
|
42832
43138
|
// src/hooks/micro-reflector.ts
|
|
@@ -43427,7 +43733,7 @@ async function curateAndStoreSwarm(lessons, projectName, phaseInfo, directory, c
|
|
|
43427
43733
|
} catch {}
|
|
43428
43734
|
}
|
|
43429
43735
|
if (!options?.skipAutoPromotion) {
|
|
43430
|
-
await
|
|
43736
|
+
await _internals20.runAutoPromotion(directory, config3);
|
|
43431
43737
|
}
|
|
43432
43738
|
return { stored, reinforced, skipped, rejected, quarantined };
|
|
43433
43739
|
}
|
|
@@ -43510,7 +43816,7 @@ function createKnowledgeCuratorHook(directory, config3, options = {}) {
|
|
|
43510
43816
|
recordSeenRetroSection(evidenceKey, evidenceHash, Date.now());
|
|
43511
43817
|
const projectName2 = evidenceData.project_name ?? "unknown";
|
|
43512
43818
|
const phaseNumber2 = typeof evidenceData.phase_number === "number" ? evidenceData.phase_number : 1;
|
|
43513
|
-
await
|
|
43819
|
+
await _internals20.curateAndStoreSwarm(lessons, projectName2, { phase_number: phaseNumber2 }, directory, config3, {
|
|
43514
43820
|
llmDelegate: options.llmDelegateFactory?.(sessionID),
|
|
43515
43821
|
enrichmentQuota: options.enrichmentQuota
|
|
43516
43822
|
});
|
|
@@ -43535,14 +43841,14 @@ function createKnowledgeCuratorHook(directory, config3, options = {}) {
|
|
|
43535
43841
|
const projectName = projectNameMatch ? projectNameMatch[1].trim() : "unknown";
|
|
43536
43842
|
const phaseMatch = /^Phase:\s*(\d+)/m.exec(planContent);
|
|
43537
43843
|
const phaseNumber = phaseMatch ? parseInt(phaseMatch[1], 10) : 1;
|
|
43538
|
-
await
|
|
43844
|
+
await _internals20.curateAndStoreSwarm(normalLessons, projectName, { phase_number: phaseNumber }, directory, config3, {
|
|
43539
43845
|
llmDelegate: options.llmDelegateFactory?.(sessionID),
|
|
43540
43846
|
enrichmentQuota: options.enrichmentQuota
|
|
43541
43847
|
});
|
|
43542
43848
|
};
|
|
43543
43849
|
return safeHook(handler);
|
|
43544
43850
|
}
|
|
43545
|
-
var seenRetroSections, MAX_TRACKED_RETRO_SECTIONS = 500, ENRICHMENT_ALLOWED_FIELDS, ENRICHMENT_LLM_TIMEOUT_MS = 60000, MESO_INSIGHT_BATCH_LIMIT = 20, KNOWLEDGE_CATEGORIES, OUTCOME_PROMOTION_BLOCK = -0.3,
|
|
43851
|
+
var seenRetroSections, MAX_TRACKED_RETRO_SECTIONS = 500, ENRICHMENT_ALLOWED_FIELDS, ENRICHMENT_LLM_TIMEOUT_MS = 60000, MESO_INSIGHT_BATCH_LIMIT = 20, KNOWLEDGE_CATEGORIES, OUTCOME_PROMOTION_BLOCK = -0.3, _internals20;
|
|
43546
43852
|
var init_knowledge_curator = __esm(() => {
|
|
43547
43853
|
init_skill_improver_quota();
|
|
43548
43854
|
init_synonym_map();
|
|
@@ -43575,7 +43881,7 @@ var init_knowledge_curator = __esm(() => {
|
|
|
43575
43881
|
"todo",
|
|
43576
43882
|
"other"
|
|
43577
43883
|
]);
|
|
43578
|
-
|
|
43884
|
+
_internals20 = {
|
|
43579
43885
|
isWriteToEvidenceFile,
|
|
43580
43886
|
curateAndStoreSwarm,
|
|
43581
43887
|
runAutoPromotion,
|
|
@@ -44823,7 +45129,7 @@ async function executeWriteRetro(args, directory) {
|
|
|
44823
45129
|
}, null, 2);
|
|
44824
45130
|
}
|
|
44825
45131
|
}
|
|
44826
|
-
var write_retro,
|
|
45132
|
+
var write_retro, _internals21;
|
|
44827
45133
|
var init_write_retro = __esm(() => {
|
|
44828
45134
|
init_zod();
|
|
44829
45135
|
init_evidence_schema();
|
|
@@ -44870,13 +45176,13 @@ var init_write_retro = __esm(() => {
|
|
|
44870
45176
|
task_id: args.task_id !== undefined ? String(args.task_id) : undefined,
|
|
44871
45177
|
metadata: args.metadata
|
|
44872
45178
|
};
|
|
44873
|
-
return await
|
|
45179
|
+
return await _internals21.executeWriteRetro(writeRetroArgs, directory);
|
|
44874
45180
|
} catch {
|
|
44875
45181
|
return JSON.stringify({ success: false, phase: rawPhase, message: "Invalid arguments" }, null, 2);
|
|
44876
45182
|
}
|
|
44877
45183
|
}
|
|
44878
45184
|
});
|
|
44879
|
-
|
|
45185
|
+
_internals21 = {
|
|
44880
45186
|
executeWriteRetro,
|
|
44881
45187
|
write_retro
|
|
44882
45188
|
};
|
|
@@ -44886,7 +45192,7 @@ var init_write_retro = __esm(() => {
|
|
|
44886
45192
|
var exports_curator_postmortem = {};
|
|
44887
45193
|
__export(exports_curator_postmortem, {
|
|
44888
45194
|
runCuratorPostMortem: () => runCuratorPostMortem,
|
|
44889
|
-
_internals: () =>
|
|
45195
|
+
_internals: () => _internals22
|
|
44890
45196
|
});
|
|
44891
45197
|
import { existsSync as existsSync19, readdirSync as readdirSync6, readFileSync as readFileSync9 } from "fs";
|
|
44892
45198
|
import * as path29 from "path";
|
|
@@ -45240,13 +45546,13 @@ ${llmOutput}`;
|
|
|
45240
45546
|
warnings
|
|
45241
45547
|
};
|
|
45242
45548
|
}
|
|
45243
|
-
var
|
|
45549
|
+
var _internals22;
|
|
45244
45550
|
var init_curator_postmortem = __esm(() => {
|
|
45245
45551
|
init_manager();
|
|
45246
45552
|
init_knowledge_events();
|
|
45247
45553
|
init_knowledge_store();
|
|
45248
45554
|
init_utils2();
|
|
45249
|
-
|
|
45555
|
+
_internals22 = {
|
|
45250
45556
|
collectKnowledgeSummary,
|
|
45251
45557
|
collectRetrospectives,
|
|
45252
45558
|
collectDriftReports,
|
|
@@ -46758,9 +47064,9 @@ async function detectDarkMatter(directory, options) {
|
|
|
46758
47064
|
} catch {
|
|
46759
47065
|
return [];
|
|
46760
47066
|
}
|
|
46761
|
-
const commitMap = await
|
|
46762
|
-
const matrix =
|
|
46763
|
-
const staticEdges = await
|
|
47067
|
+
const commitMap = await _internals23.parseGitLog(directory, maxCommitsToAnalyze);
|
|
47068
|
+
const matrix = _internals23.buildCoChangeMatrix(commitMap, maxFilesPerCommit);
|
|
47069
|
+
const staticEdges = await _internals23.getStaticEdges(directory);
|
|
46764
47070
|
const results = [];
|
|
46765
47071
|
for (const entry of matrix.values()) {
|
|
46766
47072
|
const key = `${entry.fileA}::${entry.fileB}`;
|
|
@@ -46848,7 +47154,7 @@ ${rows}
|
|
|
46848
47154
|
These pairs likely share an architectural concern invisible to static analysis.
|
|
46849
47155
|
Consider adding explicit documentation or extracting the shared concern.`;
|
|
46850
47156
|
}
|
|
46851
|
-
var co_change_analyzer,
|
|
47157
|
+
var co_change_analyzer, _internals23;
|
|
46852
47158
|
var init_co_change_analyzer = __esm(() => {
|
|
46853
47159
|
init_zod();
|
|
46854
47160
|
init_create_tool();
|
|
@@ -46880,11 +47186,11 @@ var init_co_change_analyzer = __esm(() => {
|
|
|
46880
47186
|
npmiThreshold,
|
|
46881
47187
|
maxCommitsToAnalyze
|
|
46882
47188
|
};
|
|
46883
|
-
const pairs = await
|
|
46884
|
-
return
|
|
47189
|
+
const pairs = await _internals23.detectDarkMatter(directory, options);
|
|
47190
|
+
return _internals23.formatDarkMatterOutput(pairs);
|
|
46885
47191
|
}
|
|
46886
47192
|
});
|
|
46887
|
-
|
|
47193
|
+
_internals23 = {
|
|
46888
47194
|
parseGitLog,
|
|
46889
47195
|
buildCoChangeMatrix,
|
|
46890
47196
|
getStaticEdges,
|
|
@@ -46915,7 +47221,7 @@ async function handleDarkMatterCommand(directory, args) {
|
|
|
46915
47221
|
}
|
|
46916
47222
|
let pairs;
|
|
46917
47223
|
try {
|
|
46918
|
-
pairs = await
|
|
47224
|
+
pairs = await _internals23.detectDarkMatter(directory, options);
|
|
46919
47225
|
} catch (err) {
|
|
46920
47226
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
46921
47227
|
return `## Dark Matter Analysis Failed
|
|
@@ -50967,7 +51273,7 @@ function isCommandAvailable(command) {
|
|
|
50967
51273
|
const isWindows = process.platform === "win32";
|
|
50968
51274
|
const cmd = isWindows ? `${command}.exe` : command;
|
|
50969
51275
|
try {
|
|
50970
|
-
const result =
|
|
51276
|
+
const result = _internals24.spawnSyncImpl(isWindows ? ["where", cmd] : ["which", cmd], {
|
|
50971
51277
|
cwd: process.cwd(),
|
|
50972
51278
|
stdin: "ignore",
|
|
50973
51279
|
stdout: "ignore",
|
|
@@ -51117,7 +51423,7 @@ async function discoverBuildCommands(workingDir, options) {
|
|
|
51117
51423
|
const scope = options?.scope ?? "all";
|
|
51118
51424
|
const changedFiles = options?.changedFiles ?? [];
|
|
51119
51425
|
const _filesToCheck = filterByScope(workingDir, scope, changedFiles);
|
|
51120
|
-
const profileResult = await
|
|
51426
|
+
const profileResult = await _internals24.discoverBuildCommandsFromProfiles(workingDir);
|
|
51121
51427
|
const profileCommands = profileResult.commands;
|
|
51122
51428
|
const profileSkipped = profileResult.skipped;
|
|
51123
51429
|
const coveredEcosystems = new Set;
|
|
@@ -51180,7 +51486,7 @@ function clearToolchainCache() {
|
|
|
51180
51486
|
function getEcosystems() {
|
|
51181
51487
|
return ECOSYSTEMS.map((e) => e.ecosystem);
|
|
51182
51488
|
}
|
|
51183
|
-
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000,
|
|
51489
|
+
var ECOSYSTEMS, PROFILE_TO_ECOSYSTEM_NAMES, toolchainCache, IS_COMMAND_AVAILABLE_TIMEOUT_MS = 3000, _internals24, build_discovery;
|
|
51184
51490
|
var init_discovery = __esm(() => {
|
|
51185
51491
|
init_dist();
|
|
51186
51492
|
init_detector();
|
|
@@ -51298,7 +51604,7 @@ var init_discovery = __esm(() => {
|
|
|
51298
51604
|
php: ["php-composer"]
|
|
51299
51605
|
};
|
|
51300
51606
|
toolchainCache = new Map;
|
|
51301
|
-
|
|
51607
|
+
_internals24 = {
|
|
51302
51608
|
isCommandAvailable,
|
|
51303
51609
|
discoverBuildCommandsFromProfiles,
|
|
51304
51610
|
discoverBuildCommands,
|
|
@@ -51577,7 +51883,7 @@ var exports_evidence_summary_service = {};
|
|
|
51577
51883
|
__export(exports_evidence_summary_service, {
|
|
51578
51884
|
isAutoSummaryEnabled: () => isAutoSummaryEnabled,
|
|
51579
51885
|
buildEvidenceSummary: () => buildEvidenceSummary,
|
|
51580
|
-
_internals: () =>
|
|
51886
|
+
_internals: () => _internals25,
|
|
51581
51887
|
REQUIRED_EVIDENCE_TYPES: () => REQUIRED_EVIDENCE_TYPES,
|
|
51582
51888
|
EVIDENCE_SUMMARY_VERSION: () => EVIDENCE_SUMMARY_VERSION
|
|
51583
51889
|
});
|
|
@@ -51615,7 +51921,7 @@ function getTaskStatus(task, bundle) {
|
|
|
51615
51921
|
if (task?.status) {
|
|
51616
51922
|
return task.status;
|
|
51617
51923
|
}
|
|
51618
|
-
const entries =
|
|
51924
|
+
const entries = _internals25.normalizeBundleEntries(bundle);
|
|
51619
51925
|
if (entries.length > 0) {
|
|
51620
51926
|
return "completed";
|
|
51621
51927
|
}
|
|
@@ -51641,7 +51947,7 @@ function evidenceCompleteFromEntries(entries) {
|
|
|
51641
51947
|
};
|
|
51642
51948
|
}
|
|
51643
51949
|
function isEvidenceComplete(bundle) {
|
|
51644
|
-
return evidenceCompleteFromEntries(
|
|
51950
|
+
return evidenceCompleteFromEntries(_internals25.normalizeBundleEntries(bundle));
|
|
51645
51951
|
}
|
|
51646
51952
|
function getTaskBlockers(task, summary, status) {
|
|
51647
51953
|
const blockers = [];
|
|
@@ -51661,9 +51967,9 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
51661
51967
|
const bundle = result.status === "found" ? result.bundle : null;
|
|
51662
51968
|
const gateEvidence = await readDurableGateEvidence(directory, taskId);
|
|
51663
51969
|
const phase = task?.phase ?? 0;
|
|
51664
|
-
const status =
|
|
51665
|
-
const entries = mergeDurableGateEntriesFromEvidence(taskId,
|
|
51666
|
-
let evidenceCheck =
|
|
51970
|
+
const status = _internals25.getTaskStatus(task, bundle);
|
|
51971
|
+
const entries = mergeDurableGateEntriesFromEvidence(taskId, _internals25.normalizeBundleEntries(bundle), gateEvidence);
|
|
51972
|
+
let evidenceCheck = _internals25.evidenceCompleteFromEntries(entries);
|
|
51667
51973
|
if (gateEvidence) {
|
|
51668
51974
|
const gateStatus = getDurableGateEvidenceStatus(gateEvidence);
|
|
51669
51975
|
evidenceCheck = gateStatus.isComplete ? { isComplete: true, missingEvidence: [] } : {
|
|
@@ -51671,7 +51977,7 @@ async function buildTaskSummary(directory, task, taskId) {
|
|
|
51671
51977
|
missingEvidence: gateStatus.missingGates.map((gate) => `gate:${gate}`)
|
|
51672
51978
|
};
|
|
51673
51979
|
}
|
|
51674
|
-
const blockers =
|
|
51980
|
+
const blockers = _internals25.getTaskBlockers(task, evidenceCheck, status);
|
|
51675
51981
|
const hasReview = entries.some((e) => e.type === "review");
|
|
51676
51982
|
const hasTest = entries.some((e) => e.type === "test");
|
|
51677
51983
|
const hasApproval = entries.some((e) => e.type === "approval");
|
|
@@ -51700,12 +52006,12 @@ async function buildPhaseSummary(directory, phase) {
|
|
|
51700
52006
|
const taskSummaries = [];
|
|
51701
52007
|
const _taskMap = new Map(phase.tasks.map((t) => [t.id, t]));
|
|
51702
52008
|
for (const task of phase.tasks) {
|
|
51703
|
-
const summary = await
|
|
52009
|
+
const summary = await _internals25.buildTaskSummary(directory, task, task.id);
|
|
51704
52010
|
taskSummaries.push(summary);
|
|
51705
52011
|
}
|
|
51706
52012
|
const extraTaskIds = taskIds.filter((id) => !phaseTaskIds.has(id));
|
|
51707
52013
|
for (const taskId of extraTaskIds) {
|
|
51708
|
-
const summary = await
|
|
52014
|
+
const summary = await _internals25.buildTaskSummary(directory, undefined, taskId);
|
|
51709
52015
|
if (summary.phase === phase.id) {
|
|
51710
52016
|
taskSummaries.push(summary);
|
|
51711
52017
|
}
|
|
@@ -51806,7 +52112,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
51806
52112
|
let totalTasks = 0;
|
|
51807
52113
|
let completedTasks = 0;
|
|
51808
52114
|
for (const phase of phasesToProcess) {
|
|
51809
|
-
const summary = await
|
|
52115
|
+
const summary = await _internals25.buildPhaseSummary(directory, phase);
|
|
51810
52116
|
phaseSummaries.push(summary);
|
|
51811
52117
|
totalTasks += summary.totalTasks;
|
|
51812
52118
|
completedTasks += summary.completedTasks;
|
|
@@ -51828,7 +52134,7 @@ async function buildEvidenceSummary(directory, currentPhase) {
|
|
|
51828
52134
|
overallBlockers,
|
|
51829
52135
|
summaryText: ""
|
|
51830
52136
|
};
|
|
51831
|
-
artifact.summaryText =
|
|
52137
|
+
artifact.summaryText = _internals25.generateSummaryText(artifact);
|
|
51832
52138
|
log("[EvidenceSummary] Summary built", {
|
|
51833
52139
|
phases: phaseSummaries.length,
|
|
51834
52140
|
totalTasks,
|
|
@@ -51847,7 +52153,7 @@ function isAutoSummaryEnabled(automationConfig) {
|
|
|
51847
52153
|
}
|
|
51848
52154
|
return automationConfig.capabilities?.evidence_auto_summaries === true;
|
|
51849
52155
|
}
|
|
51850
|
-
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0",
|
|
52156
|
+
var VALID_EVIDENCE_TYPES2, REQUIRED_EVIDENCE_TYPES, EVIDENCE_SUMMARY_VERSION = "1.0.0", _internals25;
|
|
51851
52157
|
var init_evidence_summary_service = __esm(() => {
|
|
51852
52158
|
init_gate_bridge();
|
|
51853
52159
|
init_manager2();
|
|
@@ -51862,7 +52168,7 @@ var init_evidence_summary_service = __esm(() => {
|
|
|
51862
52168
|
"retrospective"
|
|
51863
52169
|
]);
|
|
51864
52170
|
REQUIRED_EVIDENCE_TYPES = ["review", "test"];
|
|
51865
|
-
|
|
52171
|
+
_internals25 = {
|
|
51866
52172
|
buildEvidenceSummary,
|
|
51867
52173
|
isAutoSummaryEnabled,
|
|
51868
52174
|
normalizeBundleEntries,
|
|
@@ -51918,7 +52224,7 @@ function getVerdictEmoji(verdict) {
|
|
|
51918
52224
|
return getVerdictIcon(verdict);
|
|
51919
52225
|
}
|
|
51920
52226
|
async function getTaskEvidenceData(directory, taskId) {
|
|
51921
|
-
const result = await
|
|
52227
|
+
const result = await _internals26.loadEvidence(directory, taskId);
|
|
51922
52228
|
if (result.status !== "found") {
|
|
51923
52229
|
return {
|
|
51924
52230
|
hasEvidence: false,
|
|
@@ -51941,13 +52247,13 @@ async function getTaskEvidenceData(directory, taskId) {
|
|
|
51941
52247
|
};
|
|
51942
52248
|
}
|
|
51943
52249
|
async function getEvidenceListData(directory) {
|
|
51944
|
-
const taskIds = await
|
|
52250
|
+
const taskIds = await _internals26.listEvidenceTaskIds(directory);
|
|
51945
52251
|
if (taskIds.length === 0) {
|
|
51946
52252
|
return { hasEvidence: false, tasks: [] };
|
|
51947
52253
|
}
|
|
51948
52254
|
const tasks = [];
|
|
51949
52255
|
for (const taskId of taskIds) {
|
|
51950
|
-
const result = await
|
|
52256
|
+
const result = await _internals26.loadEvidence(directory, taskId);
|
|
51951
52257
|
if (result.status === "found") {
|
|
51952
52258
|
tasks.push({
|
|
51953
52259
|
taskId,
|
|
@@ -52061,10 +52367,10 @@ async function handleEvidenceSummaryCommand(directory) {
|
|
|
52061
52367
|
return lines.join(`
|
|
52062
52368
|
`);
|
|
52063
52369
|
}
|
|
52064
|
-
var
|
|
52370
|
+
var _internals26;
|
|
52065
52371
|
var init_evidence_service = __esm(() => {
|
|
52066
52372
|
init_manager2();
|
|
52067
|
-
|
|
52373
|
+
_internals26 = {
|
|
52068
52374
|
loadEvidence,
|
|
52069
52375
|
listEvidenceTaskIds
|
|
52070
52376
|
};
|
|
@@ -52592,7 +52898,7 @@ function extractCurrentPhaseFromPlan2(plan) {
|
|
|
52592
52898
|
if (!plan) {
|
|
52593
52899
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
52594
52900
|
}
|
|
52595
|
-
if (!
|
|
52901
|
+
if (!_internals27.validatePlanPhases(plan)) {
|
|
52596
52902
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
52597
52903
|
}
|
|
52598
52904
|
let currentPhase = null;
|
|
@@ -52734,9 +53040,9 @@ function extractPhaseMetrics(content) {
|
|
|
52734
53040
|
async function getHandoffData(directory) {
|
|
52735
53041
|
const now = new Date().toISOString();
|
|
52736
53042
|
const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
|
|
52737
|
-
const sessionState =
|
|
53043
|
+
const sessionState = _internals27.parseSessionState(sessionContent);
|
|
52738
53044
|
const plan = await loadPlanJsonOnly(directory);
|
|
52739
|
-
const planInfo =
|
|
53045
|
+
const planInfo = _internals27.extractCurrentPhaseFromPlan(plan);
|
|
52740
53046
|
if (!plan) {
|
|
52741
53047
|
const planMdContent = await readSwarmFileAsync(directory, "plan.md");
|
|
52742
53048
|
if (planMdContent) {
|
|
@@ -52755,8 +53061,8 @@ async function getHandoffData(directory) {
|
|
|
52755
53061
|
}
|
|
52756
53062
|
}
|
|
52757
53063
|
const contextContent = await readSwarmFileAsync(directory, "context.md");
|
|
52758
|
-
const recentDecisions =
|
|
52759
|
-
const rawPhaseMetrics =
|
|
53064
|
+
const recentDecisions = _internals27.extractDecisions(contextContent);
|
|
53065
|
+
const rawPhaseMetrics = _internals27.extractPhaseMetrics(contextContent);
|
|
52760
53066
|
const phaseMetrics = sanitizeString(rawPhaseMetrics, 1000);
|
|
52761
53067
|
let delegationState = null;
|
|
52762
53068
|
if (sessionState?.delegationState) {
|
|
@@ -52920,13 +53226,13 @@ ${lines.join(`
|
|
|
52920
53226
|
`)}
|
|
52921
53227
|
\`\`\``;
|
|
52922
53228
|
}
|
|
52923
|
-
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20,
|
|
53229
|
+
var RTL_OVERRIDE_PATTERN, MAX_TASK_ID_LENGTH = 100, MAX_DECISION_LENGTH = 500, MAX_INCOMPLETE_TASKS = 20, _internals27;
|
|
52924
53230
|
var init_handoff_service = __esm(() => {
|
|
52925
53231
|
init_utils2();
|
|
52926
53232
|
init_manager();
|
|
52927
53233
|
init_utils();
|
|
52928
53234
|
RTL_OVERRIDE_PATTERN = /[\u202e\u202d\u202c\u200f]/g;
|
|
52929
|
-
|
|
53235
|
+
_internals27 = {
|
|
52930
53236
|
getHandoffData,
|
|
52931
53237
|
formatHandoffMarkdown,
|
|
52932
53238
|
formatContinuationPrompt,
|
|
@@ -53069,22 +53375,22 @@ async function writeSnapshot(directory, state) {
|
|
|
53069
53375
|
}
|
|
53070
53376
|
function createSnapshotWriterHook(directory) {
|
|
53071
53377
|
return (_input, _output) => {
|
|
53072
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
53378
|
+
_writeInFlight = _writeInFlight.then(() => _internals28.writeSnapshot(directory, swarmState), () => _internals28.writeSnapshot(directory, swarmState));
|
|
53073
53379
|
return _writeInFlight;
|
|
53074
53380
|
};
|
|
53075
53381
|
}
|
|
53076
53382
|
async function flushPendingSnapshot(directory) {
|
|
53077
|
-
_writeInFlight = _writeInFlight.then(() =>
|
|
53383
|
+
_writeInFlight = _writeInFlight.then(() => _internals28.writeSnapshot(directory, swarmState), () => _internals28.writeSnapshot(directory, swarmState));
|
|
53078
53384
|
await _writeInFlight;
|
|
53079
53385
|
}
|
|
53080
|
-
var _writeInFlight,
|
|
53386
|
+
var _writeInFlight, _internals28;
|
|
53081
53387
|
var init_snapshot_writer = __esm(() => {
|
|
53082
53388
|
init_utils2();
|
|
53083
53389
|
init_state();
|
|
53084
53390
|
init_utils();
|
|
53085
53391
|
init_bun_compat();
|
|
53086
53392
|
_writeInFlight = Promise.resolve();
|
|
53087
|
-
|
|
53393
|
+
_internals28 = {
|
|
53088
53394
|
writeSnapshot,
|
|
53089
53395
|
createSnapshotWriterHook,
|
|
53090
53396
|
flushPendingSnapshot
|
|
@@ -53404,7 +53710,7 @@ function validateAndSanitizeGithubUrl(rawUrl, resource) {
|
|
|
53404
53710
|
}
|
|
53405
53711
|
function detectGitRemote(cwd) {
|
|
53406
53712
|
try {
|
|
53407
|
-
const result =
|
|
53713
|
+
const result = _internals29.spawnSync("git", ["remote", "get-url", "origin"], {
|
|
53408
53714
|
encoding: "utf-8",
|
|
53409
53715
|
stdio: ["ignore", "pipe", "pipe"],
|
|
53410
53716
|
timeout: 5000,
|
|
@@ -53449,7 +53755,7 @@ function parseGitRemoteUrl(remoteUrl) {
|
|
|
53449
53755
|
}
|
|
53450
53756
|
return null;
|
|
53451
53757
|
}
|
|
53452
|
-
var MAX_URL_LEN = 2048, IPV4_PRIVATE, IPV4_LOOPBACK, IPV4_LINK_LOCAL, IPV4_PRIVATE_172, IPV4_PRIVATE_192, IPV4_ZERO_NETWORK, IPV6_LINK_LOCAL, IPV6_UNIQUE_LOCAL,
|
|
53758
|
+
var MAX_URL_LEN = 2048, IPV4_PRIVATE, IPV4_LOOPBACK, IPV4_LINK_LOCAL, IPV4_PRIVATE_172, IPV4_PRIVATE_192, IPV4_ZERO_NETWORK, IPV6_LINK_LOCAL, IPV6_UNIQUE_LOCAL, _internals29;
|
|
53453
53759
|
var init_url_security = __esm(() => {
|
|
53454
53760
|
IPV4_PRIVATE = /^10\./;
|
|
53455
53761
|
IPV4_LOOPBACK = /^127\./;
|
|
@@ -53459,7 +53765,7 @@ var init_url_security = __esm(() => {
|
|
|
53459
53765
|
IPV4_ZERO_NETWORK = /^0\./;
|
|
53460
53766
|
IPV6_LINK_LOCAL = /^fe80:/i;
|
|
53461
53767
|
IPV6_UNIQUE_LOCAL = /^f[cd][0-9a-f]{2}:/i;
|
|
53462
|
-
|
|
53768
|
+
_internals29 = { spawnSync: spawnSync3 };
|
|
53463
53769
|
});
|
|
53464
53770
|
|
|
53465
53771
|
// src/commands/issue.ts
|
|
@@ -53633,9 +53939,9 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
53633
53939
|
skippedReason: "empty-context"
|
|
53634
53940
|
};
|
|
53635
53941
|
}
|
|
53636
|
-
const rawEntries =
|
|
53942
|
+
const rawEntries = _internals30.parseContextMd(contextContent);
|
|
53637
53943
|
if (rawEntries.length === 0) {
|
|
53638
|
-
await
|
|
53944
|
+
await _internals30.writeSentinel(sentinelPath, 0, 0);
|
|
53639
53945
|
return {
|
|
53640
53946
|
migrated: true,
|
|
53641
53947
|
entriesMigrated: 0,
|
|
@@ -53646,10 +53952,10 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
53646
53952
|
const existing = await readKnowledge(knowledgePath);
|
|
53647
53953
|
let migrated = 0;
|
|
53648
53954
|
let dropped = 0;
|
|
53649
|
-
const projectName =
|
|
53955
|
+
const projectName = _internals30.inferProjectName(directory);
|
|
53650
53956
|
for (const raw of rawEntries) {
|
|
53651
53957
|
if (config3.validation_enabled !== false) {
|
|
53652
|
-
const category = raw.categoryHint ??
|
|
53958
|
+
const category = raw.categoryHint ?? _internals30.inferCategoryFromText(raw.text);
|
|
53653
53959
|
const result = validateLesson(raw.text, existing.map((e) => e.lesson), {
|
|
53654
53960
|
category,
|
|
53655
53961
|
scope: "global",
|
|
@@ -53669,8 +53975,8 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
53669
53975
|
const entry = {
|
|
53670
53976
|
id: randomUUID3(),
|
|
53671
53977
|
tier: "swarm",
|
|
53672
|
-
lesson:
|
|
53673
|
-
category: raw.categoryHint ??
|
|
53978
|
+
lesson: _internals30.truncateLesson(raw.text),
|
|
53979
|
+
category: raw.categoryHint ?? _internals30.inferCategoryFromText(raw.text),
|
|
53674
53980
|
tags: [...inferredTags, `migration:${raw.sourceSection}`],
|
|
53675
53981
|
scope: "global",
|
|
53676
53982
|
confidence: 0.3,
|
|
@@ -53693,7 +53999,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
53693
53999
|
if (migrated > 0) {
|
|
53694
54000
|
await rewriteKnowledge(knowledgePath, existing);
|
|
53695
54001
|
}
|
|
53696
|
-
await
|
|
54002
|
+
await _internals30.writeSentinel(sentinelPath, migrated, dropped);
|
|
53697
54003
|
log(`[knowledge-migrator] Migrated ${migrated} entries, dropped ${dropped}`);
|
|
53698
54004
|
return {
|
|
53699
54005
|
migrated: true,
|
|
@@ -53703,7 +54009,7 @@ async function migrateContextToKnowledge(directory, config3) {
|
|
|
53703
54009
|
};
|
|
53704
54010
|
}
|
|
53705
54011
|
async function migrateHiveKnowledgeLegacy(config3) {
|
|
53706
|
-
const legacyHivePath =
|
|
54012
|
+
const legacyHivePath = _internals30.resolveLegacyHiveKnowledgePath();
|
|
53707
54013
|
const canonicalHivePath = resolveHiveKnowledgePath();
|
|
53708
54014
|
const sentinelPath = path41.join(path41.dirname(canonicalHivePath), ".hive-knowledge-migrated");
|
|
53709
54015
|
if (existsSync27(sentinelPath)) {
|
|
@@ -53726,7 +54032,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
53726
54032
|
}
|
|
53727
54033
|
const legacyEntries = await readKnowledge(legacyHivePath);
|
|
53728
54034
|
if (legacyEntries.length === 0) {
|
|
53729
|
-
await
|
|
54035
|
+
await _internals30.writeSentinel(sentinelPath, 0, 0);
|
|
53730
54036
|
return {
|
|
53731
54037
|
migrated: true,
|
|
53732
54038
|
entriesMigrated: 0,
|
|
@@ -53774,7 +54080,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
53774
54080
|
const newHiveEntry = {
|
|
53775
54081
|
id: resolvedId,
|
|
53776
54082
|
tier: "hive",
|
|
53777
|
-
lesson:
|
|
54083
|
+
lesson: _internals30.truncateLesson(lesson),
|
|
53778
54084
|
category,
|
|
53779
54085
|
tags: ["migration:legacy-hive"],
|
|
53780
54086
|
scope: scopeTag,
|
|
@@ -53793,7 +54099,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
53793
54099
|
encounter_score: 1
|
|
53794
54100
|
};
|
|
53795
54101
|
try {
|
|
53796
|
-
await
|
|
54102
|
+
await _internals30.appendKnowledge(canonicalHivePath, newHiveEntry);
|
|
53797
54103
|
existingHiveEntries.push(newHiveEntry);
|
|
53798
54104
|
migrated++;
|
|
53799
54105
|
} catch (appendError) {
|
|
@@ -53809,7 +54115,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
53809
54115
|
dropped++;
|
|
53810
54116
|
}
|
|
53811
54117
|
}
|
|
53812
|
-
await
|
|
54118
|
+
await _internals30.writeSentinel(sentinelPath, migrated, dropped);
|
|
53813
54119
|
log(`[knowledge-migrator] Migrated ${migrated} legacy hive entries, dropped ${dropped}`);
|
|
53814
54120
|
return {
|
|
53815
54121
|
migrated: true,
|
|
@@ -53820,7 +54126,7 @@ async function migrateHiveKnowledgeLegacy(config3) {
|
|
|
53820
54126
|
};
|
|
53821
54127
|
}
|
|
53822
54128
|
function parseContextMd(content) {
|
|
53823
|
-
const sections =
|
|
54129
|
+
const sections = _internals30.splitIntoSections(content);
|
|
53824
54130
|
const entries = [];
|
|
53825
54131
|
const seen = new Set;
|
|
53826
54132
|
const sectionPatterns = [
|
|
@@ -53836,7 +54142,7 @@ function parseContextMd(content) {
|
|
|
53836
54142
|
const match = sectionPatterns.find((sp) => sp.pattern.test(section.heading));
|
|
53837
54143
|
if (!match)
|
|
53838
54144
|
continue;
|
|
53839
|
-
const bullets =
|
|
54145
|
+
const bullets = _internals30.extractBullets(section.body);
|
|
53840
54146
|
for (const bullet of bullets) {
|
|
53841
54147
|
if (bullet.length < 15)
|
|
53842
54148
|
continue;
|
|
@@ -53845,9 +54151,9 @@ function parseContextMd(content) {
|
|
|
53845
54151
|
continue;
|
|
53846
54152
|
seen.add(normalized);
|
|
53847
54153
|
entries.push({
|
|
53848
|
-
text:
|
|
54154
|
+
text: _internals30.truncateLesson(bullet),
|
|
53849
54155
|
sourceSection: match.sourceSection,
|
|
53850
|
-
categoryHint:
|
|
54156
|
+
categoryHint: _internals30.inferCategoryFromText(bullet)
|
|
53851
54157
|
});
|
|
53852
54158
|
}
|
|
53853
54159
|
}
|
|
@@ -53953,12 +54259,12 @@ function resolveLegacyHiveKnowledgePath() {
|
|
|
53953
54259
|
}
|
|
53954
54260
|
return path41.join(dataDir, "hive-knowledge.jsonl");
|
|
53955
54261
|
}
|
|
53956
|
-
var
|
|
54262
|
+
var _internals30;
|
|
53957
54263
|
var init_knowledge_migrator = __esm(() => {
|
|
53958
54264
|
init_logger();
|
|
53959
54265
|
init_knowledge_store();
|
|
53960
54266
|
init_knowledge_validator();
|
|
53961
|
-
|
|
54267
|
+
_internals30 = {
|
|
53962
54268
|
appendKnowledge,
|
|
53963
54269
|
migrateContextToKnowledge,
|
|
53964
54270
|
migrateKnowledgeToExternal,
|
|
@@ -57552,9 +57858,9 @@ var init_memory2 = __esm(() => {
|
|
|
57552
57858
|
|
|
57553
57859
|
// src/services/plan-service.ts
|
|
57554
57860
|
async function getPlanData(directory, phaseArg) {
|
|
57555
|
-
const plan = await
|
|
57861
|
+
const plan = await _internals31.loadPlanJsonOnly(directory);
|
|
57556
57862
|
if (plan) {
|
|
57557
|
-
const fullMarkdown =
|
|
57863
|
+
const fullMarkdown = _internals31.derivePlanMarkdown(plan);
|
|
57558
57864
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
57559
57865
|
return {
|
|
57560
57866
|
hasPlan: true,
|
|
@@ -57597,7 +57903,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
57597
57903
|
isLegacy: false
|
|
57598
57904
|
};
|
|
57599
57905
|
}
|
|
57600
|
-
const planContent = await
|
|
57906
|
+
const planContent = await _internals31.readSwarmFileAsync(directory, "plan.md");
|
|
57601
57907
|
if (!planContent) {
|
|
57602
57908
|
return {
|
|
57603
57909
|
hasPlan: false,
|
|
@@ -57693,11 +57999,11 @@ async function handlePlanCommand(directory, args) {
|
|
|
57693
57999
|
const planData = await getPlanData(directory, phaseArg);
|
|
57694
58000
|
return formatPlanMarkdown(planData);
|
|
57695
58001
|
}
|
|
57696
|
-
var
|
|
58002
|
+
var _internals31;
|
|
57697
58003
|
var init_plan_service = __esm(() => {
|
|
57698
58004
|
init_utils2();
|
|
57699
58005
|
init_manager();
|
|
57700
|
-
|
|
58006
|
+
_internals31 = {
|
|
57701
58007
|
loadPlanJsonOnly,
|
|
57702
58008
|
derivePlanMarkdown,
|
|
57703
58009
|
readSwarmFileAsync
|
|
@@ -58040,7 +58346,7 @@ function formatRelativeTime(epochMs) {
|
|
|
58040
58346
|
return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
58041
58347
|
}
|
|
58042
58348
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
|
|
58043
|
-
const allActive = await
|
|
58349
|
+
const allActive = await _internals32.listActive(directory);
|
|
58044
58350
|
const sessionSubs = allActive.filter((record3) => record3.sessionID === sessionID);
|
|
58045
58351
|
if (sessionSubs.length === 0) {
|
|
58046
58352
|
return "No active PR subscriptions for this session.";
|
|
@@ -58069,10 +58375,10 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID) {
|
|
|
58069
58375
|
return lines.join(`
|
|
58070
58376
|
`);
|
|
58071
58377
|
}
|
|
58072
|
-
var
|
|
58378
|
+
var _internals32;
|
|
58073
58379
|
var init_pr_monitor_status = __esm(() => {
|
|
58074
58380
|
init_pr_subscriptions();
|
|
58075
|
-
|
|
58381
|
+
_internals32 = {
|
|
58076
58382
|
formatRelativeTime,
|
|
58077
58383
|
listActive
|
|
58078
58384
|
};
|
|
@@ -58177,7 +58483,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
58177
58483
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
58178
58484
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
58179
58485
|
try {
|
|
58180
|
-
const config3 =
|
|
58486
|
+
const config3 = _internals33.loadPluginConfig(directory);
|
|
58181
58487
|
const prMonitorConfig = config3.pr_monitor;
|
|
58182
58488
|
if (!prMonitorConfig?.enabled) {
|
|
58183
58489
|
return [
|
|
@@ -58187,7 +58493,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
58187
58493
|
].join(`
|
|
58188
58494
|
`);
|
|
58189
58495
|
}
|
|
58190
|
-
await
|
|
58496
|
+
await _internals33.subscribe(directory, {
|
|
58191
58497
|
sessionID,
|
|
58192
58498
|
prNumber: prInfo.number,
|
|
58193
58499
|
repoFullName,
|
|
@@ -58211,12 +58517,12 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
58211
58517
|
`);
|
|
58212
58518
|
}
|
|
58213
58519
|
}
|
|
58214
|
-
var
|
|
58520
|
+
var _internals33;
|
|
58215
58521
|
var init_pr_subscribe = __esm(() => {
|
|
58216
58522
|
init_pr_subscriptions();
|
|
58217
58523
|
init_loader();
|
|
58218
58524
|
init_pr_ref();
|
|
58219
|
-
|
|
58525
|
+
_internals33 = {
|
|
58220
58526
|
loadPluginConfig,
|
|
58221
58527
|
subscribe
|
|
58222
58528
|
};
|
|
@@ -58240,9 +58546,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
58240
58546
|
`);
|
|
58241
58547
|
}
|
|
58242
58548
|
const refToken = rest[0];
|
|
58243
|
-
const prInfo =
|
|
58549
|
+
const prInfo = _internals34.parsePrRef(refToken, directory);
|
|
58244
58550
|
if (!prInfo) {
|
|
58245
|
-
if (
|
|
58551
|
+
if (_internals34.looksLikePrRef(refToken)) {
|
|
58246
58552
|
return [
|
|
58247
58553
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
58248
58554
|
"",
|
|
@@ -58263,8 +58569,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
58263
58569
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
58264
58570
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
58265
58571
|
try {
|
|
58266
|
-
const correlationId =
|
|
58267
|
-
const result = await
|
|
58572
|
+
const correlationId = _internals34.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
58573
|
+
const result = await _internals34.unsubscribe(directory, correlationId);
|
|
58268
58574
|
if (!result) {
|
|
58269
58575
|
return [
|
|
58270
58576
|
`Not subscribed to ${prUrl}`,
|
|
@@ -58291,11 +58597,11 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
58291
58597
|
`);
|
|
58292
58598
|
}
|
|
58293
58599
|
}
|
|
58294
|
-
var
|
|
58600
|
+
var _internals34;
|
|
58295
58601
|
var init_pr_unsubscribe = __esm(() => {
|
|
58296
58602
|
init_pr_subscriptions();
|
|
58297
58603
|
init_pr_ref();
|
|
58298
|
-
|
|
58604
|
+
_internals34 = {
|
|
58299
58605
|
unsubscribe,
|
|
58300
58606
|
buildCorrelationId,
|
|
58301
58607
|
parsePrRef,
|
|
@@ -58699,7 +59005,7 @@ async function runAdditionalLint(linter, mode, cwd) {
|
|
|
58699
59005
|
};
|
|
58700
59006
|
}
|
|
58701
59007
|
}
|
|
58702
|
-
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint,
|
|
59008
|
+
var MAX_OUTPUT_BYTES = 512000, MAX_COMMAND_LENGTH = 500, lint, _internals35;
|
|
58703
59009
|
var init_lint = __esm(() => {
|
|
58704
59010
|
init_zod();
|
|
58705
59011
|
init_discovery();
|
|
@@ -58731,15 +59037,15 @@ var init_lint = __esm(() => {
|
|
|
58731
59037
|
}
|
|
58732
59038
|
const { mode } = args;
|
|
58733
59039
|
const cwd = directory;
|
|
58734
|
-
const linter = await
|
|
59040
|
+
const linter = await _internals35.detectAvailableLinter(directory);
|
|
58735
59041
|
if (linter) {
|
|
58736
|
-
const result = await
|
|
59042
|
+
const result = await _internals35.runLint(linter, mode, directory);
|
|
58737
59043
|
return JSON.stringify(result, null, 2);
|
|
58738
59044
|
}
|
|
58739
|
-
const additionalLinter =
|
|
59045
|
+
const additionalLinter = _internals35.detectAdditionalLinter(cwd);
|
|
58740
59046
|
if (additionalLinter) {
|
|
58741
59047
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
58742
|
-
const result = await
|
|
59048
|
+
const result = await _internals35.runAdditionalLint(additionalLinter, mode, cwd);
|
|
58743
59049
|
return JSON.stringify(result, null, 2);
|
|
58744
59050
|
}
|
|
58745
59051
|
const errorResult = {
|
|
@@ -58753,7 +59059,7 @@ For Rust: rustup component add clippy`
|
|
|
58753
59059
|
return JSON.stringify(errorResult, null, 2);
|
|
58754
59060
|
}
|
|
58755
59061
|
});
|
|
58756
|
-
|
|
59062
|
+
_internals35 = {
|
|
58757
59063
|
detectAvailableLinter,
|
|
58758
59064
|
runLint,
|
|
58759
59065
|
detectAdditionalLinter,
|
|
@@ -59067,7 +59373,7 @@ function findScannableFiles(dir, excludeExact, excludeGlobs, scanDir, visited, s
|
|
|
59067
59373
|
}
|
|
59068
59374
|
async function runSecretscan(directory) {
|
|
59069
59375
|
try {
|
|
59070
|
-
const result = await
|
|
59376
|
+
const result = await _internals36.secretscan.execute({ directory }, {});
|
|
59071
59377
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
59072
59378
|
return JSON.parse(jsonStr);
|
|
59073
59379
|
} catch (e) {
|
|
@@ -59082,7 +59388,7 @@ async function runSecretscan(directory) {
|
|
|
59082
59388
|
return errorResult;
|
|
59083
59389
|
}
|
|
59084
59390
|
}
|
|
59085
|
-
var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan,
|
|
59391
|
+
var MAX_FILE_PATH_LENGTH = 500, MAX_FILE_SIZE_BYTES, MAX_FILES_SCANNED = 1000, MAX_FINDINGS = 100, MAX_OUTPUT_BYTES2 = 512000, MAX_LINE_LENGTH = 1e4, MAX_CONTENT_BYTES, BINARY_SIGNATURES, BINARY_PREFIX_BYTES = 4, BINARY_NULL_CHECK_BYTES = 8192, BINARY_NULL_THRESHOLD = 0.1, DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_EXTENSIONS, SECRET_PATTERNS2, O_NOFOLLOW, secretscan, _internals36;
|
|
59086
59392
|
var init_secretscan = __esm(() => {
|
|
59087
59393
|
init_zod();
|
|
59088
59394
|
init_path_security();
|
|
@@ -59454,7 +59760,7 @@ var init_secretscan = __esm(() => {
|
|
|
59454
59760
|
}
|
|
59455
59761
|
}
|
|
59456
59762
|
});
|
|
59457
|
-
|
|
59763
|
+
_internals36 = {
|
|
59458
59764
|
secretscan,
|
|
59459
59765
|
runSecretscan
|
|
59460
59766
|
};
|
|
@@ -60046,14 +60352,14 @@ function buildGoBackend() {
|
|
|
60046
60352
|
selectEntryPoints
|
|
60047
60353
|
};
|
|
60048
60354
|
}
|
|
60049
|
-
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE,
|
|
60355
|
+
var PROFILE_ID = "go", IMPORT_REGEX_SINGLE, IMPORT_REGEX_GROUP, IMPORT_REGEX_GROUP_LINE, _internals37;
|
|
60050
60356
|
var init_go = __esm(() => {
|
|
60051
60357
|
init_default_backend();
|
|
60052
60358
|
init_profiles();
|
|
60053
60359
|
IMPORT_REGEX_SINGLE = /^\s*import\s+(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/gm;
|
|
60054
60360
|
IMPORT_REGEX_GROUP = /^\s*import\s*\(([\s\S]*?)\)/gm;
|
|
60055
60361
|
IMPORT_REGEX_GROUP_LINE = /(?:[a-zA-Z_.][a-zA-Z0-9_]*\s+)?"([^"]+)"/g;
|
|
60056
|
-
|
|
60362
|
+
_internals37 = { extractImports };
|
|
60057
60363
|
});
|
|
60058
60364
|
|
|
60059
60365
|
// src/lang/backends/python.ts
|
|
@@ -60165,13 +60471,13 @@ function buildPythonBackend() {
|
|
|
60165
60471
|
selectEntryPoints: selectEntryPoints2
|
|
60166
60472
|
};
|
|
60167
60473
|
}
|
|
60168
|
-
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT,
|
|
60474
|
+
var PROFILE_ID2 = "python", IMPORT_REGEX_FROM_WITH_TARGETS, IMPORT_REGEX_IMPORT, _internals38;
|
|
60169
60475
|
var init_python = __esm(() => {
|
|
60170
60476
|
init_default_backend();
|
|
60171
60477
|
init_profiles();
|
|
60172
60478
|
IMPORT_REGEX_FROM_WITH_TARGETS = /^\s*from\s+(\.*[\w.]*)\s+import\s+(\([^)]*\)|[^\n#]+)/gm;
|
|
60173
60479
|
IMPORT_REGEX_IMPORT = /^\s*import\s+([^\n#]+)/gm;
|
|
60174
|
-
|
|
60480
|
+
_internals38 = { extractImports: extractImports2 };
|
|
60175
60481
|
});
|
|
60176
60482
|
|
|
60177
60483
|
// src/test-impact/analyzer.ts
|
|
@@ -60395,7 +60701,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
60395
60701
|
return;
|
|
60396
60702
|
}
|
|
60397
60703
|
if (PYTHON_EXTENSIONS.has(ext)) {
|
|
60398
|
-
const modules =
|
|
60704
|
+
const modules = _internals38.extractImports(testFile, content);
|
|
60399
60705
|
for (const mod of modules) {
|
|
60400
60706
|
const resolved = resolvePythonImport(testDir, mod);
|
|
60401
60707
|
if (resolved !== null)
|
|
@@ -60404,7 +60710,7 @@ function addImpactEdgesForTestFile(testFile, content, impactMap) {
|
|
|
60404
60710
|
return;
|
|
60405
60711
|
}
|
|
60406
60712
|
if (GO_EXTENSIONS.has(ext)) {
|
|
60407
|
-
const imports =
|
|
60713
|
+
const imports = _internals37.extractImports(testFile, content);
|
|
60408
60714
|
for (const importPath of imports) {
|
|
60409
60715
|
const sourceFiles = resolveGoImport(testDir, importPath);
|
|
60410
60716
|
for (const source of sourceFiles)
|
|
@@ -60431,8 +60737,8 @@ async function buildImpactMapInternal(cwd) {
|
|
|
60431
60737
|
return impactMap;
|
|
60432
60738
|
}
|
|
60433
60739
|
async function buildImpactMap(cwd) {
|
|
60434
|
-
const impactMap = await
|
|
60435
|
-
await
|
|
60740
|
+
const impactMap = await _internals39.buildImpactMapInternal(cwd);
|
|
60741
|
+
await _internals39.saveImpactMap(cwd, impactMap);
|
|
60436
60742
|
return impactMap;
|
|
60437
60743
|
}
|
|
60438
60744
|
async function loadImpactMap(cwd, options) {
|
|
@@ -60446,7 +60752,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
60446
60752
|
const hasValidValues = Object.values(map3).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
60447
60753
|
if (hasValidValues) {
|
|
60448
60754
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
60449
|
-
if (!
|
|
60755
|
+
if (!_internals39.isCacheStale(map3, generatedAt)) {
|
|
60450
60756
|
return map3;
|
|
60451
60757
|
}
|
|
60452
60758
|
if (options?.skipRebuild) {
|
|
@@ -60466,13 +60772,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
60466
60772
|
if (options?.skipRebuild) {
|
|
60467
60773
|
return {};
|
|
60468
60774
|
}
|
|
60469
|
-
return
|
|
60775
|
+
return _internals39.buildImpactMap(cwd);
|
|
60470
60776
|
}
|
|
60471
60777
|
async function saveImpactMap(cwd, impactMap) {
|
|
60472
60778
|
if (!path53.isAbsolute(cwd)) {
|
|
60473
60779
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
60474
60780
|
}
|
|
60475
|
-
|
|
60781
|
+
_internals39.validateProjectRoot(cwd);
|
|
60476
60782
|
const cacheDir2 = path53.join(cwd, ".swarm", "cache");
|
|
60477
60783
|
const cachePath = path53.join(cacheDir2, "impact-map.json");
|
|
60478
60784
|
if (!fs23.existsSync(cacheDir2)) {
|
|
@@ -60496,7 +60802,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
60496
60802
|
};
|
|
60497
60803
|
}
|
|
60498
60804
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
60499
|
-
const impactMap = await
|
|
60805
|
+
const impactMap = await _internals39.loadImpactMap(cwd);
|
|
60500
60806
|
const impactedTestsSet = new Set;
|
|
60501
60807
|
const untestedFiles = [];
|
|
60502
60808
|
let visitedCount = 0;
|
|
@@ -60581,7 +60887,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
60581
60887
|
budgetExceeded
|
|
60582
60888
|
};
|
|
60583
60889
|
}
|
|
60584
|
-
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache,
|
|
60890
|
+
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals39;
|
|
60585
60891
|
var init_analyzer = __esm(() => {
|
|
60586
60892
|
init_manager2();
|
|
60587
60893
|
init_go();
|
|
@@ -60594,7 +60900,7 @@ var init_analyzer = __esm(() => {
|
|
|
60594
60900
|
GO_EXTENSIONS = new Set([".go"]);
|
|
60595
60901
|
EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
60596
60902
|
goModuleCache = new Map;
|
|
60597
|
-
|
|
60903
|
+
_internals39 = {
|
|
60598
60904
|
validateProjectRoot,
|
|
60599
60905
|
normalizePath,
|
|
60600
60906
|
isCacheStale,
|
|
@@ -60977,7 +61283,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
60977
61283
|
}
|
|
60978
61284
|
const historyPath = getHistoryPath(workingDir);
|
|
60979
61285
|
const historyDir = path54.dirname(historyPath);
|
|
60980
|
-
|
|
61286
|
+
_internals40.validateProjectRoot(workingDir);
|
|
60981
61287
|
if (!fs24.existsSync(historyDir)) {
|
|
60982
61288
|
fs24.mkdirSync(historyDir, { recursive: true });
|
|
60983
61289
|
}
|
|
@@ -61100,7 +61406,7 @@ function getAllHistory(workingDir) {
|
|
|
61100
61406
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
61101
61407
|
return records;
|
|
61102
61408
|
}
|
|
61103
|
-
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES,
|
|
61409
|
+
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, HISTORY_WRITE_LOCK_TIMEOUT_MS = 5000, HISTORY_WRITE_LOCK_STALE_MS = 60000, HISTORY_WRITE_LOCK_BACKOFF_MS = 10, DANGEROUS_PROPERTY_NAMES, _internals40;
|
|
61104
61410
|
var init_history_store = __esm(() => {
|
|
61105
61411
|
init_manager2();
|
|
61106
61412
|
DANGEROUS_PROPERTY_NAMES = new Set([
|
|
@@ -61108,7 +61414,7 @@ var init_history_store = __esm(() => {
|
|
|
61108
61414
|
"constructor",
|
|
61109
61415
|
"prototype"
|
|
61110
61416
|
]);
|
|
61111
|
-
|
|
61417
|
+
_internals40 = {
|
|
61112
61418
|
validateProjectRoot
|
|
61113
61419
|
};
|
|
61114
61420
|
});
|
|
@@ -61313,7 +61619,7 @@ function readPackageJsonRaw(dir) {
|
|
|
61313
61619
|
}
|
|
61314
61620
|
}
|
|
61315
61621
|
function readPackageJson(dir) {
|
|
61316
|
-
return
|
|
61622
|
+
return _internals41.readPackageJsonRaw(dir);
|
|
61317
61623
|
}
|
|
61318
61624
|
function readPackageJsonTestScript(dir) {
|
|
61319
61625
|
return readPackageJson(dir)?.scripts?.test ?? null;
|
|
@@ -61483,7 +61789,7 @@ function buildTypescriptBackend() {
|
|
|
61483
61789
|
selectEntryPoints: selectEntryPoints3
|
|
61484
61790
|
};
|
|
61485
61791
|
}
|
|
61486
|
-
var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2,
|
|
61792
|
+
var PROFILE_ID4 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals41;
|
|
61487
61793
|
var init_typescript = __esm(() => {
|
|
61488
61794
|
init_default_backend();
|
|
61489
61795
|
init_profiles();
|
|
@@ -61492,7 +61798,7 @@ var init_typescript = __esm(() => {
|
|
|
61492
61798
|
IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
61493
61799
|
IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
61494
61800
|
IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
|
|
61495
|
-
|
|
61801
|
+
_internals41 = {
|
|
61496
61802
|
readPackageJsonRaw,
|
|
61497
61803
|
readPackageJsonTestScript,
|
|
61498
61804
|
frameworkFromScriptsTest
|
|
@@ -61525,7 +61831,7 @@ __export(exports_dispatch, {
|
|
|
61525
61831
|
pickedProfiles: () => pickedProfiles,
|
|
61526
61832
|
pickBackend: () => pickBackend,
|
|
61527
61833
|
clearDispatchCache: () => clearDispatchCache,
|
|
61528
|
-
_internals: () =>
|
|
61834
|
+
_internals: () => _internals42
|
|
61529
61835
|
});
|
|
61530
61836
|
import * as fs28 from "fs";
|
|
61531
61837
|
import * as path58 from "path";
|
|
@@ -61580,7 +61886,7 @@ function findManifestRoot(start) {
|
|
|
61580
61886
|
return start;
|
|
61581
61887
|
}
|
|
61582
61888
|
function evictIfNeeded() {
|
|
61583
|
-
if (cache.size <=
|
|
61889
|
+
if (cache.size <= _internals42.cacheCapacity)
|
|
61584
61890
|
return;
|
|
61585
61891
|
let oldestKey;
|
|
61586
61892
|
let oldestOrder = Infinity;
|
|
@@ -61611,7 +61917,7 @@ async function pickBackend(dir) {
|
|
|
61611
61917
|
evictIfNeeded();
|
|
61612
61918
|
return null;
|
|
61613
61919
|
}
|
|
61614
|
-
const profiles = await
|
|
61920
|
+
const profiles = await _internals42.detectProjectLanguages(root);
|
|
61615
61921
|
if (profiles.length === 0) {
|
|
61616
61922
|
cache.set(cacheKey, {
|
|
61617
61923
|
hash: hash4,
|
|
@@ -61643,12 +61949,12 @@ function clearDispatchCache() {
|
|
|
61643
61949
|
manifestRootCache.clear();
|
|
61644
61950
|
insertCounter = 0;
|
|
61645
61951
|
}
|
|
61646
|
-
var
|
|
61952
|
+
var _internals42, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
|
|
61647
61953
|
var init_dispatch = __esm(() => {
|
|
61648
61954
|
init_backends();
|
|
61649
61955
|
init_detector();
|
|
61650
61956
|
init_registry_backend();
|
|
61651
|
-
|
|
61957
|
+
_internals42 = {
|
|
61652
61958
|
detectProjectLanguages,
|
|
61653
61959
|
cacheCapacity: 64
|
|
61654
61960
|
};
|
|
@@ -63504,9 +63810,9 @@ function getVersionFileVersion(dir) {
|
|
|
63504
63810
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
63505
63811
|
const startTime = Date.now();
|
|
63506
63812
|
try {
|
|
63507
|
-
const packageVersion =
|
|
63508
|
-
const changelogVersion =
|
|
63509
|
-
const versionFileVersion =
|
|
63813
|
+
const packageVersion = _internals43.getPackageVersion(dir);
|
|
63814
|
+
const changelogVersion = _internals43.getChangelogVersion(dir);
|
|
63815
|
+
const versionFileVersion = _internals43.getVersionFileVersion(dir);
|
|
63510
63816
|
const versions3 = [];
|
|
63511
63817
|
if (packageVersion)
|
|
63512
63818
|
versions3.push(`package.json: ${packageVersion}`);
|
|
@@ -63870,7 +64176,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
63870
64176
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
63871
64177
|
let validatedDir;
|
|
63872
64178
|
try {
|
|
63873
|
-
validatedDir =
|
|
64179
|
+
validatedDir = _internals43.validateDirectoryPath(dir);
|
|
63874
64180
|
} catch (error93) {
|
|
63875
64181
|
return {
|
|
63876
64182
|
id: reportId,
|
|
@@ -63890,7 +64196,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
63890
64196
|
}
|
|
63891
64197
|
let validatedTimeout;
|
|
63892
64198
|
try {
|
|
63893
|
-
validatedTimeout =
|
|
64199
|
+
validatedTimeout = _internals43.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
63894
64200
|
} catch (error93) {
|
|
63895
64201
|
return {
|
|
63896
64202
|
id: reportId,
|
|
@@ -63931,12 +64237,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
63931
64237
|
});
|
|
63932
64238
|
const checks5 = [];
|
|
63933
64239
|
log("[Preflight] Running lint check...");
|
|
63934
|
-
const lintResult = await
|
|
64240
|
+
const lintResult = await _internals43.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
63935
64241
|
checks5.push(lintResult);
|
|
63936
64242
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
63937
64243
|
if (!cfg.skipTests) {
|
|
63938
64244
|
log("[Preflight] Running tests check...");
|
|
63939
|
-
const testsResult = await
|
|
64245
|
+
const testsResult = await _internals43.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
63940
64246
|
checks5.push(testsResult);
|
|
63941
64247
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
63942
64248
|
} else {
|
|
@@ -63948,7 +64254,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
63948
64254
|
}
|
|
63949
64255
|
if (!cfg.skipSecrets) {
|
|
63950
64256
|
log("[Preflight] Running secrets check...");
|
|
63951
|
-
const secretsResult = await
|
|
64257
|
+
const secretsResult = await _internals43.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
63952
64258
|
checks5.push(secretsResult);
|
|
63953
64259
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
63954
64260
|
} else {
|
|
@@ -63960,7 +64266,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
63960
64266
|
}
|
|
63961
64267
|
if (!cfg.skipEvidence) {
|
|
63962
64268
|
log("[Preflight] Running evidence check...");
|
|
63963
|
-
const evidenceResult = await
|
|
64269
|
+
const evidenceResult = await _internals43.runEvidenceCheck(validatedDir);
|
|
63964
64270
|
checks5.push(evidenceResult);
|
|
63965
64271
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
63966
64272
|
} else {
|
|
@@ -63971,12 +64277,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
63971
64277
|
});
|
|
63972
64278
|
}
|
|
63973
64279
|
log("[Preflight] Running requirement coverage check...");
|
|
63974
|
-
const reqCoverageResult = await
|
|
64280
|
+
const reqCoverageResult = await _internals43.runRequirementCoverageCheck(validatedDir, phase);
|
|
63975
64281
|
checks5.push(reqCoverageResult);
|
|
63976
64282
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
63977
64283
|
if (!cfg.skipVersion) {
|
|
63978
64284
|
log("[Preflight] Running version check...");
|
|
63979
|
-
const versionResult = await
|
|
64285
|
+
const versionResult = await _internals43.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
63980
64286
|
checks5.push(versionResult);
|
|
63981
64287
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
63982
64288
|
} else {
|
|
@@ -64039,10 +64345,10 @@ function formatPreflightMarkdown(report) {
|
|
|
64039
64345
|
async function handlePreflightCommand(directory, _args) {
|
|
64040
64346
|
const plan = await loadPlan(directory);
|
|
64041
64347
|
const phase = plan?.current_phase ?? 1;
|
|
64042
|
-
const report = await
|
|
64043
|
-
return
|
|
64348
|
+
const report = await _internals43.runPreflight(directory, phase);
|
|
64349
|
+
return _internals43.formatPreflightMarkdown(report);
|
|
64044
64350
|
}
|
|
64045
|
-
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG,
|
|
64351
|
+
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals43;
|
|
64046
64352
|
var init_preflight_service = __esm(() => {
|
|
64047
64353
|
init_gate_bridge();
|
|
64048
64354
|
init_manager2();
|
|
@@ -64061,7 +64367,7 @@ var init_preflight_service = __esm(() => {
|
|
|
64061
64367
|
testScope: "convention",
|
|
64062
64368
|
linter: "biome"
|
|
64063
64369
|
};
|
|
64064
|
-
|
|
64370
|
+
_internals43 = {
|
|
64065
64371
|
runPreflight,
|
|
64066
64372
|
formatPreflightMarkdown,
|
|
64067
64373
|
handlePreflightCommand,
|
|
@@ -65486,7 +65792,7 @@ async function handleSimulateCommand(directory, args) {
|
|
|
65486
65792
|
}
|
|
65487
65793
|
let darkMatterPairs;
|
|
65488
65794
|
try {
|
|
65489
|
-
darkMatterPairs = await
|
|
65795
|
+
darkMatterPairs = await _internals23.detectDarkMatter(directory, options);
|
|
65490
65796
|
} catch (err) {
|
|
65491
65797
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
65492
65798
|
return `## Simulate Report
|
|
@@ -65856,7 +66162,7 @@ async function getStatusData(directory, agents) {
|
|
|
65856
66162
|
}
|
|
65857
66163
|
function enrichWithLeanTurbo(status, directory) {
|
|
65858
66164
|
const turboMode = hasActiveTurboMode();
|
|
65859
|
-
const leanActive =
|
|
66165
|
+
const leanActive = _internals44.hasActiveLeanTurbo();
|
|
65860
66166
|
let turboStrategy = "off";
|
|
65861
66167
|
if (leanActive) {
|
|
65862
66168
|
turboStrategy = "lean";
|
|
@@ -65875,7 +66181,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
65875
66181
|
}
|
|
65876
66182
|
}
|
|
65877
66183
|
if (leanSessionID) {
|
|
65878
|
-
const runState =
|
|
66184
|
+
const runState = _internals44.loadLeanTurboRunState(directory, leanSessionID);
|
|
65879
66185
|
if (runState) {
|
|
65880
66186
|
status.leanTurboPhase = runState.phase;
|
|
65881
66187
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -65907,7 +66213,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
65907
66213
|
}
|
|
65908
66214
|
}
|
|
65909
66215
|
}
|
|
65910
|
-
status.fullAutoActive =
|
|
66216
|
+
status.fullAutoActive = _internals44.hasActiveFullAuto();
|
|
65911
66217
|
return status;
|
|
65912
66218
|
}
|
|
65913
66219
|
function formatStatusMarkdown(status) {
|
|
@@ -66035,7 +66341,7 @@ async function countProposals(directory) {
|
|
|
66035
66341
|
return 0;
|
|
66036
66342
|
}
|
|
66037
66343
|
}
|
|
66038
|
-
var
|
|
66344
|
+
var _internals44;
|
|
66039
66345
|
var init_status_service = __esm(() => {
|
|
66040
66346
|
init_extractors();
|
|
66041
66347
|
init_knowledge_escalator();
|
|
@@ -66045,7 +66351,7 @@ var init_status_service = __esm(() => {
|
|
|
66045
66351
|
init_state3();
|
|
66046
66352
|
init_compaction_service();
|
|
66047
66353
|
init_context_budget_service();
|
|
66048
|
-
|
|
66354
|
+
_internals44 = {
|
|
66049
66355
|
loadLeanTurboRunState,
|
|
66050
66356
|
hasActiveLeanTurbo,
|
|
66051
66357
|
hasActiveFullAuto
|
|
@@ -66136,7 +66442,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
66136
66442
|
if (arg0 === "on") {
|
|
66137
66443
|
let strategy = "standard";
|
|
66138
66444
|
try {
|
|
66139
|
-
const { config: config3 } =
|
|
66445
|
+
const { config: config3 } = _internals45.loadPluginConfigWithMeta(directory);
|
|
66140
66446
|
if (config3.turbo?.strategy === "lean") {
|
|
66141
66447
|
strategy = "lean";
|
|
66142
66448
|
}
|
|
@@ -66191,7 +66497,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
66191
66497
|
let maxParallelCoders = 4;
|
|
66192
66498
|
let conflictPolicy = "serialize";
|
|
66193
66499
|
try {
|
|
66194
|
-
const { config: config3 } =
|
|
66500
|
+
const { config: config3 } = _internals45.loadPluginConfigWithMeta(directory);
|
|
66195
66501
|
const leanConfig = config3.turbo?.lean;
|
|
66196
66502
|
if (leanConfig) {
|
|
66197
66503
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -66261,13 +66567,13 @@ function buildStatusMessage2(session, directory, sessionID) {
|
|
|
66261
66567
|
].join(`
|
|
66262
66568
|
`);
|
|
66263
66569
|
}
|
|
66264
|
-
var
|
|
66570
|
+
var _internals45;
|
|
66265
66571
|
var init_turbo = __esm(() => {
|
|
66266
66572
|
init_config();
|
|
66267
66573
|
init_state();
|
|
66268
66574
|
init_state3();
|
|
66269
66575
|
init_logger();
|
|
66270
|
-
|
|
66576
|
+
_internals45 = {
|
|
66271
66577
|
loadPluginConfigWithMeta
|
|
66272
66578
|
};
|
|
66273
66579
|
});
|
|
@@ -66333,342 +66639,6 @@ var init_write_retro2 = __esm(() => {
|
|
|
66333
66639
|
init_write_retro();
|
|
66334
66640
|
});
|
|
66335
66641
|
|
|
66336
|
-
// src/commands/command-dispatch.ts
|
|
66337
|
-
function normalizeSwarmCommandInput(command, argumentText) {
|
|
66338
|
-
if (command !== "swarm" && !command.startsWith("swarm-")) {
|
|
66339
|
-
return { isSwarmCommand: false, tokens: [] };
|
|
66340
|
-
}
|
|
66341
|
-
if (command === "swarm") {
|
|
66342
|
-
return {
|
|
66343
|
-
isSwarmCommand: true,
|
|
66344
|
-
tokens: argumentText.trim().split(/\s+/).filter(Boolean)
|
|
66345
|
-
};
|
|
66346
|
-
}
|
|
66347
|
-
const subcommand = command.slice("swarm-".length);
|
|
66348
|
-
const extraArgs = argumentText.trim().split(/\s+/).filter(Boolean);
|
|
66349
|
-
return {
|
|
66350
|
-
isSwarmCommand: true,
|
|
66351
|
-
tokens: [subcommand, ...extraArgs].filter(Boolean)
|
|
66352
|
-
};
|
|
66353
|
-
}
|
|
66354
|
-
function canonicalCommandKey(resolved) {
|
|
66355
|
-
return resolved.entry.aliasOf ?? resolved.key;
|
|
66356
|
-
}
|
|
66357
|
-
function formatCommandNotFound(tokens) {
|
|
66358
|
-
const attemptedCommand = tokens[0] || "";
|
|
66359
|
-
const MAX_DISPLAY = 100;
|
|
66360
|
-
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
66361
|
-
const similar = _internals45.findSimilarCommands(attemptedCommand);
|
|
66362
|
-
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
66363
|
-
const suggestions = similar.length > 0 ? `Did you mean:
|
|
66364
|
-
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
66365
|
-
`)}` : "";
|
|
66366
|
-
const footer = "Run `/swarm help` for all commands.";
|
|
66367
|
-
return [header, suggestions, footer].filter(Boolean).join(`
|
|
66368
|
-
|
|
66369
|
-
`);
|
|
66370
|
-
}
|
|
66371
|
-
async function executeSwarmCommand(args) {
|
|
66372
|
-
const {
|
|
66373
|
-
directory,
|
|
66374
|
-
agents,
|
|
66375
|
-
sessionID,
|
|
66376
|
-
tokens,
|
|
66377
|
-
packageRoot,
|
|
66378
|
-
buildHelpText,
|
|
66379
|
-
policy
|
|
66380
|
-
} = args;
|
|
66381
|
-
let text;
|
|
66382
|
-
const resolved = resolveCommand(tokens);
|
|
66383
|
-
if (!resolved) {
|
|
66384
|
-
text = tokens.length === 0 && buildHelpText ? buildHelpText() : formatCommandNotFound(tokens);
|
|
66385
|
-
} else {
|
|
66386
|
-
const policyResult = policy?.(resolved) ?? { allowed: true };
|
|
66387
|
-
if (!policyResult.allowed) {
|
|
66388
|
-
text = policyResult.message;
|
|
66389
|
-
} else {
|
|
66390
|
-
try {
|
|
66391
|
-
text = await resolved.entry.handler({
|
|
66392
|
-
directory,
|
|
66393
|
-
args: resolved.remainingArgs,
|
|
66394
|
-
sessionID,
|
|
66395
|
-
agents,
|
|
66396
|
-
packageRoot,
|
|
66397
|
-
source: "chat"
|
|
66398
|
-
});
|
|
66399
|
-
} catch (_err) {
|
|
66400
|
-
const cmdName = tokens[0] || "unknown";
|
|
66401
|
-
const errMsg = _err instanceof Error ? _err.message : String(_err);
|
|
66402
|
-
text = `Error executing /swarm ${cmdName}: ${errMsg}`;
|
|
66403
|
-
}
|
|
66404
|
-
if (resolved.warning) {
|
|
66405
|
-
text = `${resolved.warning}
|
|
66406
|
-
|
|
66407
|
-
${text}`;
|
|
66408
|
-
}
|
|
66409
|
-
}
|
|
66410
|
-
}
|
|
66411
|
-
return {
|
|
66412
|
-
text,
|
|
66413
|
-
resolved: resolved ?? undefined,
|
|
66414
|
-
canonicalKey: resolved ? canonicalCommandKey(resolved) : undefined
|
|
66415
|
-
};
|
|
66416
|
-
}
|
|
66417
|
-
var init_command_dispatch = __esm(() => {
|
|
66418
|
-
init_registry();
|
|
66419
|
-
});
|
|
66420
|
-
|
|
66421
|
-
// src/commands/tool-policy.ts
|
|
66422
|
-
function classifySwarmCommandToolUse(resolved) {
|
|
66423
|
-
const canonicalKey = canonicalCommandKey(resolved);
|
|
66424
|
-
const args = resolved.remainingArgs;
|
|
66425
|
-
if (!SWARM_COMMAND_TOOL_ALLOWLIST.has(canonicalKey)) {
|
|
66426
|
-
if (HUMAN_ONLY_SWARM_COMMANDS.has(canonicalKey)) {
|
|
66427
|
-
return {
|
|
66428
|
-
allowed: false,
|
|
66429
|
-
message: `/swarm ${canonicalKey} is a human-only command. ` + `Present the situation to the user and ask them to run \`/swarm ${canonicalKey}\` themselves ` + `(or \`bunx opencode-swarm run ${canonicalKey}\` from a terminal). ` + `You MUST NOT run it yourself via Bash, swarm_command, or any other tool \u2014 ` + `the runtime guardrail will block such attempts.`
|
|
66430
|
-
};
|
|
66431
|
-
}
|
|
66432
|
-
return {
|
|
66433
|
-
allowed: false,
|
|
66434
|
-
message: `/swarm ${canonicalKey} is not available through the chat tool yet.
|
|
66435
|
-
|
|
66436
|
-
` + `Use the canonical CLI path for now: \`bunx opencode-swarm run ${canonicalKey}\`.
|
|
66437
|
-
` + `Commands with state changes, auto-heal behavior, or subprocesses need confirmation gates before chat-tool support.`
|
|
66438
|
-
};
|
|
66439
|
-
}
|
|
66440
|
-
if (canonicalKey === "config doctor" && args.some((arg) => arg === "--fix" || arg === "-f")) {
|
|
66441
|
-
return {
|
|
66442
|
-
allowed: false,
|
|
66443
|
-
message: "/swarm config doctor --fix is not available through swarm_command. Run the CLI command directly when you intend to modify config files."
|
|
66444
|
-
};
|
|
66445
|
-
}
|
|
66446
|
-
if (NO_ARGS.has(canonicalKey) && args.length > 0) {
|
|
66447
|
-
return {
|
|
66448
|
-
allowed: false,
|
|
66449
|
-
message: `/swarm ${canonicalKey} does not accept arguments through swarm_command.`
|
|
66450
|
-
};
|
|
66451
|
-
}
|
|
66452
|
-
if (canonicalKey === "knowledge") {
|
|
66453
|
-
if (args.length === 0)
|
|
66454
|
-
return { allowed: true };
|
|
66455
|
-
if (args.length === 1 && (args[0] === "list" || args[0] === "unactionable"))
|
|
66456
|
-
return { allowed: true };
|
|
66457
|
-
return {
|
|
66458
|
-
allowed: false,
|
|
66459
|
-
message: "Only `/swarm knowledge`, `/swarm knowledge list`, and `/swarm knowledge unactionable` are available through swarm_command. Knowledge migrate/quarantine/restore/retry-hardening are intentionally excluded."
|
|
66460
|
-
};
|
|
66461
|
-
}
|
|
66462
|
-
if (canonicalKey === "memory") {
|
|
66463
|
-
if (args.length === 0)
|
|
66464
|
-
return { allowed: true };
|
|
66465
|
-
return {
|
|
66466
|
-
allowed: false,
|
|
66467
|
-
message: "Use `/swarm memory status`, `/swarm memory pending`, `/swarm memory recall-log`, `/swarm memory stale`, `/swarm memory export`, or `/swarm memory evaluate --json` through swarm_command. Memory import, migrate, and compact are intentionally excluded from chat-tool execution."
|
|
66468
|
-
};
|
|
66469
|
-
}
|
|
66470
|
-
if (canonicalKey === "memory evaluate") {
|
|
66471
|
-
if (args.length === 0)
|
|
66472
|
-
return { allowed: true };
|
|
66473
|
-
if (args.length === 1 && args[0] === "--json")
|
|
66474
|
-
return { allowed: true };
|
|
66475
|
-
return {
|
|
66476
|
-
allowed: false,
|
|
66477
|
-
message: "Usage through swarm_command: `/swarm memory evaluate --json`. Custom fixture directories are only available through direct user command execution."
|
|
66478
|
-
};
|
|
66479
|
-
}
|
|
66480
|
-
if (canonicalKey === "sdd status") {
|
|
66481
|
-
if (args.length === 0)
|
|
66482
|
-
return { allowed: true };
|
|
66483
|
-
if (args.length === 1 && args[0] === "--json")
|
|
66484
|
-
return { allowed: true };
|
|
66485
|
-
return {
|
|
66486
|
-
allowed: false,
|
|
66487
|
-
message: "Usage through swarm_command: `/swarm sdd status` or `/swarm sdd status --json`."
|
|
66488
|
-
};
|
|
66489
|
-
}
|
|
66490
|
-
if (canonicalKey === "sdd validate") {
|
|
66491
|
-
if (args.length === 0)
|
|
66492
|
-
return { allowed: true };
|
|
66493
|
-
if (args.length === 1 && args[0] === "--json")
|
|
66494
|
-
return { allowed: true };
|
|
66495
|
-
if (args.length === 2 && args[0] === "--change" && /^[A-Za-z0-9_.-]{1,128}$/.test(args[1])) {
|
|
66496
|
-
return { allowed: true };
|
|
66497
|
-
}
|
|
66498
|
-
return {
|
|
66499
|
-
allowed: false,
|
|
66500
|
-
message: "Usage through swarm_command: `/swarm sdd validate`, `/swarm sdd validate --json`, or `/swarm sdd validate --change <id>`."
|
|
66501
|
-
};
|
|
66502
|
-
}
|
|
66503
|
-
if (canonicalKey === "memory pending" || canonicalKey === "memory recall-log" || canonicalKey === "memory stale") {
|
|
66504
|
-
if (args.length === 0)
|
|
66505
|
-
return { allowed: true };
|
|
66506
|
-
if (args.length === 2 && args[0] === "--limit" && /^\d+$/.test(args[1])) {
|
|
66507
|
-
return { allowed: true };
|
|
66508
|
-
}
|
|
66509
|
-
return {
|
|
66510
|
-
allowed: false,
|
|
66511
|
-
message: `Usage through swarm_command: \`/swarm ${canonicalKey}\` or ` + `\`/swarm ${canonicalKey} --limit <n>\`.`
|
|
66512
|
-
};
|
|
66513
|
-
}
|
|
66514
|
-
if (canonicalKey === "retrieve") {
|
|
66515
|
-
if (args.length !== 1 || !SUMMARY_ID_PATTERN.test(args[0])) {
|
|
66516
|
-
return {
|
|
66517
|
-
allowed: false,
|
|
66518
|
-
message: "Usage through swarm_command: `/swarm retrieve <summary-id>` with a single summary ID such as S1."
|
|
66519
|
-
};
|
|
66520
|
-
}
|
|
66521
|
-
}
|
|
66522
|
-
if (canonicalKey === "benchmark") {
|
|
66523
|
-
const allowedFlags = new Set(["--cumulative", "--ci-gate"]);
|
|
66524
|
-
const invalid = args.filter((arg) => !allowedFlags.has(arg));
|
|
66525
|
-
if (invalid.length > 0) {
|
|
66526
|
-
return {
|
|
66527
|
-
allowed: false,
|
|
66528
|
-
message: "Only `--cumulative` and `--ci-gate` are supported for `/swarm benchmark` through swarm_command."
|
|
66529
|
-
};
|
|
66530
|
-
}
|
|
66531
|
-
}
|
|
66532
|
-
if (canonicalKey === "show-plan") {
|
|
66533
|
-
if (args.length > 1 || args[0] && !/^\d+$/.test(args[0])) {
|
|
66534
|
-
return {
|
|
66535
|
-
allowed: false,
|
|
66536
|
-
message: "Usage through swarm_command: `/swarm show-plan` or `/swarm show-plan <phase-number>`."
|
|
66537
|
-
};
|
|
66538
|
-
}
|
|
66539
|
-
}
|
|
66540
|
-
if (canonicalKey === "evidence") {
|
|
66541
|
-
if (args.length > 1 || args[0] && !TASK_ID_PATTERN.test(args[0])) {
|
|
66542
|
-
return {
|
|
66543
|
-
allowed: false,
|
|
66544
|
-
message: "Usage through swarm_command: `/swarm evidence` or `/swarm evidence <task-id>`."
|
|
66545
|
-
};
|
|
66546
|
-
}
|
|
66547
|
-
}
|
|
66548
|
-
if (canonicalKey === "help" && args.length > 2) {
|
|
66549
|
-
return {
|
|
66550
|
-
allowed: false,
|
|
66551
|
-
message: "Usage through swarm_command: `/swarm help` or `/swarm help <command>`."
|
|
66552
|
-
};
|
|
66553
|
-
}
|
|
66554
|
-
return { allowed: true };
|
|
66555
|
-
}
|
|
66556
|
-
function classifySwarmCommandChatFallbackUse(resolved) {
|
|
66557
|
-
const canonicalKey = canonicalCommandKey(resolved);
|
|
66558
|
-
const args = resolved.remainingArgs;
|
|
66559
|
-
if (canonicalKey === "config doctor" && args.some((arg) => arg === "--fix" || arg === "-f")) {
|
|
66560
|
-
return {
|
|
66561
|
-
allowed: false,
|
|
66562
|
-
message: "/swarm config doctor --fix is not available through chat fallback because it can modify configuration files. Run the CLI command directly when you intend to apply fixes."
|
|
66563
|
-
};
|
|
66564
|
-
}
|
|
66565
|
-
if (canonicalKey === "knowledge migrate" || canonicalKey === "knowledge quarantine" || canonicalKey === "knowledge restore" || canonicalKey === "memory import" || canonicalKey === "memory migrate" || canonicalKey === "memory compact" || canonicalKey === "sdd project") {
|
|
66566
|
-
return {
|
|
66567
|
-
allowed: false,
|
|
66568
|
-
message: `/swarm ${canonicalKey} is not available through chat fallback because it mutates .swarm state. ` + "Run the CLI command directly after confirming the intended state change."
|
|
66569
|
-
};
|
|
66570
|
-
}
|
|
66571
|
-
return { allowed: true };
|
|
66572
|
-
}
|
|
66573
|
-
var SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, NO_ARGS, SUMMARY_ID_PATTERN, TASK_ID_PATTERN;
|
|
66574
|
-
var init_tool_policy = __esm(() => {
|
|
66575
|
-
init_command_dispatch();
|
|
66576
|
-
SWARM_COMMAND_TOOL_COMMANDS = [
|
|
66577
|
-
"agents",
|
|
66578
|
-
"config",
|
|
66579
|
-
"config doctor",
|
|
66580
|
-
"doctor tools",
|
|
66581
|
-
"status",
|
|
66582
|
-
"show-plan",
|
|
66583
|
-
"help",
|
|
66584
|
-
"history",
|
|
66585
|
-
"evidence",
|
|
66586
|
-
"evidence summary",
|
|
66587
|
-
"retrieve",
|
|
66588
|
-
"diagnose",
|
|
66589
|
-
"preflight",
|
|
66590
|
-
"benchmark",
|
|
66591
|
-
"knowledge",
|
|
66592
|
-
"memory",
|
|
66593
|
-
"memory status",
|
|
66594
|
-
"memory pending",
|
|
66595
|
-
"memory recall-log",
|
|
66596
|
-
"memory compact",
|
|
66597
|
-
"memory stale",
|
|
66598
|
-
"memory export",
|
|
66599
|
-
"memory evaluate",
|
|
66600
|
-
"memory import",
|
|
66601
|
-
"memory migrate",
|
|
66602
|
-
"sdd",
|
|
66603
|
-
"sdd status",
|
|
66604
|
-
"sdd validate",
|
|
66605
|
-
"sdd project",
|
|
66606
|
-
"sync-plan",
|
|
66607
|
-
"export",
|
|
66608
|
-
"auto-proceed"
|
|
66609
|
-
];
|
|
66610
|
-
SWARM_COMMAND_TOOL_ALLOWLIST = new Set([
|
|
66611
|
-
"agents",
|
|
66612
|
-
"config",
|
|
66613
|
-
"config doctor",
|
|
66614
|
-
"doctor tools",
|
|
66615
|
-
"status",
|
|
66616
|
-
"show-plan",
|
|
66617
|
-
"help",
|
|
66618
|
-
"history",
|
|
66619
|
-
"evidence",
|
|
66620
|
-
"evidence summary",
|
|
66621
|
-
"retrieve",
|
|
66622
|
-
"diagnose",
|
|
66623
|
-
"preflight",
|
|
66624
|
-
"benchmark",
|
|
66625
|
-
"knowledge",
|
|
66626
|
-
"memory",
|
|
66627
|
-
"memory status",
|
|
66628
|
-
"memory pending",
|
|
66629
|
-
"memory recall-log",
|
|
66630
|
-
"memory stale",
|
|
66631
|
-
"memory export",
|
|
66632
|
-
"memory evaluate",
|
|
66633
|
-
"sdd",
|
|
66634
|
-
"sdd status",
|
|
66635
|
-
"sdd validate",
|
|
66636
|
-
"sync-plan",
|
|
66637
|
-
"export",
|
|
66638
|
-
"auto-proceed"
|
|
66639
|
-
]);
|
|
66640
|
-
HUMAN_ONLY_SWARM_COMMANDS = new Set([
|
|
66641
|
-
"acknowledge-spec-drift",
|
|
66642
|
-
"reset",
|
|
66643
|
-
"reset-session",
|
|
66644
|
-
"rollback",
|
|
66645
|
-
"checkpoint",
|
|
66646
|
-
"consolidate",
|
|
66647
|
-
"memory import",
|
|
66648
|
-
"memory migrate",
|
|
66649
|
-
"memory compact",
|
|
66650
|
-
"sdd project"
|
|
66651
|
-
]);
|
|
66652
|
-
NO_ARGS = new Set([
|
|
66653
|
-
"agents",
|
|
66654
|
-
"config",
|
|
66655
|
-
"config doctor",
|
|
66656
|
-
"doctor tools",
|
|
66657
|
-
"status",
|
|
66658
|
-
"history",
|
|
66659
|
-
"evidence summary",
|
|
66660
|
-
"diagnose",
|
|
66661
|
-
"preflight",
|
|
66662
|
-
"sync-plan",
|
|
66663
|
-
"export",
|
|
66664
|
-
"memory",
|
|
66665
|
-
"memory status",
|
|
66666
|
-
"memory export"
|
|
66667
|
-
]);
|
|
66668
|
-
SUMMARY_ID_PATTERN = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
66669
|
-
TASK_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,64}$/;
|
|
66670
|
-
});
|
|
66671
|
-
|
|
66672
66642
|
// src/commands/command-names.ts
|
|
66673
66643
|
var COMMAND_NAMES, COMMAND_NAME_SET;
|
|
66674
66644
|
var init_command_names = __esm(() => {
|
|
@@ -66886,7 +66856,7 @@ async function buildSwarmCommandPrompt(args) {
|
|
|
66886
66856
|
packageRoot,
|
|
66887
66857
|
registeredAgents
|
|
66888
66858
|
} = args;
|
|
66889
|
-
const resolved =
|
|
66859
|
+
const resolved = _internals11.resolveCommand(tokens);
|
|
66890
66860
|
if (!resolved) {
|
|
66891
66861
|
if (tokens.length === 0) {
|
|
66892
66862
|
return buildHelpText();
|
|
@@ -67059,7 +67029,7 @@ function findSimilarCommands(query) {
|
|
|
67059
67029
|
}
|
|
67060
67030
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
67061
67031
|
const cmdLower = cmd.toLowerCase();
|
|
67062
|
-
const fullScore =
|
|
67032
|
+
const fullScore = _internals11.levenshteinDistance(q, cmdLower);
|
|
67063
67033
|
let tokenScore = Infinity;
|
|
67064
67034
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
67065
67035
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -67072,7 +67042,7 @@ function findSimilarCommands(query) {
|
|
|
67072
67042
|
for (const ct of cmdTokens) {
|
|
67073
67043
|
if (ct.length === 0)
|
|
67074
67044
|
continue;
|
|
67075
|
-
const dist =
|
|
67045
|
+
const dist = _internals11.levenshteinDistance(qt, ct);
|
|
67076
67046
|
if (dist < minDist)
|
|
67077
67047
|
minDist = dist;
|
|
67078
67048
|
}
|
|
@@ -67082,7 +67052,7 @@ function findSimilarCommands(query) {
|
|
|
67082
67052
|
}
|
|
67083
67053
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
67084
67054
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
67085
|
-
const dashScore =
|
|
67055
|
+
const dashScore = _internals11.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
67086
67056
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
67087
67057
|
return { cmd, score };
|
|
67088
67058
|
});
|
|
@@ -67114,11 +67084,11 @@ async function handleHelpCommand(ctx) {
|
|
|
67114
67084
|
return buildHelpText2();
|
|
67115
67085
|
}
|
|
67116
67086
|
const tokens = targetCommand.split(/\s+/);
|
|
67117
|
-
const resolved =
|
|
67087
|
+
const resolved = _internals11.resolveCommand(tokens);
|
|
67118
67088
|
if (resolved) {
|
|
67119
|
-
return
|
|
67089
|
+
return _internals11.buildDetailedHelp(resolved.key, resolved.entry);
|
|
67120
67090
|
}
|
|
67121
|
-
const similar =
|
|
67091
|
+
const similar = _internals11.findSimilarCommands(targetCommand);
|
|
67122
67092
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
67123
67093
|
if (similar.length > 0) {
|
|
67124
67094
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -67189,6 +67159,18 @@ function validateAliases() {
|
|
|
67189
67159
|
}
|
|
67190
67160
|
return { valid: errors5.length === 0, errors: errors5, warnings };
|
|
67191
67161
|
}
|
|
67162
|
+
function validateToolPolicy() {
|
|
67163
|
+
const warnings = [];
|
|
67164
|
+
for (const [name, entry] of Object.entries(COMMAND_REGISTRY)) {
|
|
67165
|
+
const cmdEntry = entry;
|
|
67166
|
+
if (cmdEntry.aliasOf || cmdEntry.subcommandOf)
|
|
67167
|
+
continue;
|
|
67168
|
+
if (cmdEntry.toolPolicy === undefined) {
|
|
67169
|
+
warnings.push(`Command '${name}' has no toolPolicy field \u2014 it will not be available through the swarm_command tool. Add toolPolicy: 'agent' | 'human-only' | 'restricted' | 'none'.`);
|
|
67170
|
+
}
|
|
67171
|
+
}
|
|
67172
|
+
return { valid: warnings.length === 0, warnings };
|
|
67173
|
+
}
|
|
67192
67174
|
function resolveCommand(tokens) {
|
|
67193
67175
|
if (tokens.length === 0)
|
|
67194
67176
|
return null;
|
|
@@ -67218,7 +67200,7 @@ function resolveCommand(tokens) {
|
|
|
67218
67200
|
}
|
|
67219
67201
|
return null;
|
|
67220
67202
|
}
|
|
67221
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
67203
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals11, validation;
|
|
67222
67204
|
var init_registry = __esm(() => {
|
|
67223
67205
|
init_bundled_skills();
|
|
67224
67206
|
init_acknowledge_spec_drift();
|
|
@@ -67274,19 +67256,23 @@ var init_registry = __esm(() => {
|
|
|
67274
67256
|
handler: (ctx) => handleAcknowledgeSpecDriftCommand(ctx.directory, ctx.args, ctx.source === "cli" ? "cli" : ctx.source === "chat" ? "user" : "unknown"),
|
|
67275
67257
|
description: "Acknowledge that the spec has drifted from the plan and suppress further warnings",
|
|
67276
67258
|
args: "",
|
|
67277
|
-
category: "diagnostics"
|
|
67259
|
+
category: "diagnostics",
|
|
67260
|
+
toolPolicy: "restricted"
|
|
67278
67261
|
},
|
|
67279
67262
|
status: {
|
|
67280
67263
|
handler: (ctx) => handleStatusCommand(ctx.directory, ctx.agents),
|
|
67281
67264
|
description: "Show current swarm state",
|
|
67282
67265
|
category: "core",
|
|
67283
|
-
clashesWithNativeCcCommand: "/status"
|
|
67266
|
+
clashesWithNativeCcCommand: "/status",
|
|
67267
|
+
toolPolicy: "agent",
|
|
67268
|
+
toolNoArgs: true
|
|
67284
67269
|
},
|
|
67285
67270
|
"show-plan": {
|
|
67286
67271
|
handler: (ctx) => handlePlanCommand(ctx.directory, ctx.args),
|
|
67287
67272
|
description: "Show current plan (optionally filter by phase number)",
|
|
67288
67273
|
category: "core",
|
|
67289
|
-
args: "[phase-number]"
|
|
67274
|
+
args: "[phase-number]",
|
|
67275
|
+
toolPolicy: "agent"
|
|
67290
67276
|
},
|
|
67291
67277
|
plan: {
|
|
67292
67278
|
handler: (ctx) => handlePlanCommand(ctx.directory, ctx.args),
|
|
@@ -67300,32 +67286,41 @@ var init_registry = __esm(() => {
|
|
|
67300
67286
|
handler: (ctx) => Promise.resolve(handleAgentsCommand(ctx.agents, undefined)),
|
|
67301
67287
|
description: "List registered agents",
|
|
67302
67288
|
category: "core",
|
|
67303
|
-
clashesWithNativeCcCommand: "/agents"
|
|
67289
|
+
clashesWithNativeCcCommand: "/agents",
|
|
67290
|
+
toolPolicy: "agent",
|
|
67291
|
+
toolNoArgs: true
|
|
67304
67292
|
},
|
|
67305
67293
|
help: {
|
|
67306
|
-
handler: (ctx) =>
|
|
67294
|
+
handler: (ctx) => _internals11.handleHelpCommand(ctx),
|
|
67307
67295
|
description: "Show help for swarm commands",
|
|
67308
67296
|
category: "core",
|
|
67309
67297
|
args: "[command]",
|
|
67310
|
-
details: "Without argument, shows full command listing. With argument, shows detailed help for a specific command."
|
|
67298
|
+
details: "Without argument, shows full command listing. With argument, shows detailed help for a specific command.",
|
|
67299
|
+
toolPolicy: "agent"
|
|
67311
67300
|
},
|
|
67312
67301
|
history: {
|
|
67313
67302
|
handler: (ctx) => handleHistoryCommand(ctx.directory, ctx.args),
|
|
67314
67303
|
description: "Show completed phases summary",
|
|
67315
67304
|
category: "utility",
|
|
67316
|
-
clashesWithNativeCcCommand: "/history"
|
|
67305
|
+
clashesWithNativeCcCommand: "/history",
|
|
67306
|
+
toolPolicy: "agent",
|
|
67307
|
+
toolNoArgs: true
|
|
67317
67308
|
},
|
|
67318
67309
|
config: {
|
|
67319
67310
|
handler: (ctx) => handleConfigCommand(ctx.directory, ctx.args),
|
|
67320
67311
|
description: "Show current resolved configuration",
|
|
67321
67312
|
category: "config",
|
|
67322
|
-
clashesWithNativeCcCommand: "/config"
|
|
67313
|
+
clashesWithNativeCcCommand: "/config",
|
|
67314
|
+
toolPolicy: "agent",
|
|
67315
|
+
toolNoArgs: true
|
|
67323
67316
|
},
|
|
67324
67317
|
"config doctor": {
|
|
67325
67318
|
handler: (ctx) => handleDoctorCommand(ctx.directory, ctx.args),
|
|
67326
67319
|
description: "Run config doctor checks",
|
|
67327
67320
|
subcommandOf: "config",
|
|
67328
|
-
category: "diagnostics"
|
|
67321
|
+
category: "diagnostics",
|
|
67322
|
+
toolPolicy: "agent",
|
|
67323
|
+
toolNoArgs: true
|
|
67329
67324
|
},
|
|
67330
67325
|
"config-doctor": {
|
|
67331
67326
|
handler: (ctx) => handleDoctorCommand(ctx.directory, ctx.args),
|
|
@@ -67338,7 +67333,9 @@ var init_registry = __esm(() => {
|
|
|
67338
67333
|
"doctor tools": {
|
|
67339
67334
|
handler: (ctx) => handleDoctorToolsCommand(ctx.directory, ctx.args),
|
|
67340
67335
|
description: "Run tool registration coherence check",
|
|
67341
|
-
category: "diagnostics"
|
|
67336
|
+
category: "diagnostics",
|
|
67337
|
+
toolPolicy: "agent",
|
|
67338
|
+
toolNoArgs: true
|
|
67342
67339
|
},
|
|
67343
67340
|
"doctor-tools": {
|
|
67344
67341
|
handler: (ctx) => handleDoctorToolsCommand(ctx.directory, ctx.args),
|
|
@@ -67350,7 +67347,9 @@ var init_registry = __esm(() => {
|
|
|
67350
67347
|
diagnose: {
|
|
67351
67348
|
handler: (ctx) => handleDiagnoseCommand(ctx.directory, ctx.args),
|
|
67352
67349
|
description: "Run health check on swarm state",
|
|
67353
|
-
category: "diagnostics"
|
|
67350
|
+
category: "diagnostics",
|
|
67351
|
+
toolPolicy: "agent",
|
|
67352
|
+
toolNoArgs: true
|
|
67354
67353
|
},
|
|
67355
67354
|
diagnosis: {
|
|
67356
67355
|
handler: (ctx) => handleDiagnoseCommand(ctx.directory, ctx.args),
|
|
@@ -67362,26 +67361,32 @@ var init_registry = __esm(() => {
|
|
|
67362
67361
|
preflight: {
|
|
67363
67362
|
handler: (ctx) => handlePreflightCommand(ctx.directory, ctx.args),
|
|
67364
67363
|
description: "Run preflight automation checks",
|
|
67365
|
-
category: "diagnostics"
|
|
67364
|
+
category: "diagnostics",
|
|
67365
|
+
toolPolicy: "agent",
|
|
67366
|
+
toolNoArgs: true
|
|
67366
67367
|
},
|
|
67367
67368
|
"sync-plan": {
|
|
67368
67369
|
handler: (ctx) => handleSyncPlanCommand(ctx.directory, ctx.args),
|
|
67369
67370
|
description: "Ensure plan.json and plan.md are synced",
|
|
67370
67371
|
args: "",
|
|
67371
|
-
category: "config"
|
|
67372
|
+
category: "config",
|
|
67373
|
+
toolPolicy: "agent",
|
|
67374
|
+
toolNoArgs: true
|
|
67372
67375
|
},
|
|
67373
67376
|
benchmark: {
|
|
67374
67377
|
handler: (ctx) => handleBenchmarkCommand(ctx.directory, ctx.args),
|
|
67375
67378
|
description: "Show performance metrics [--cumulative] [--ci-gate]",
|
|
67376
67379
|
args: "--cumulative, --ci-gate",
|
|
67377
|
-
category: "diagnostics"
|
|
67380
|
+
category: "diagnostics",
|
|
67381
|
+
toolPolicy: "agent"
|
|
67378
67382
|
},
|
|
67379
67383
|
learning: {
|
|
67380
67384
|
handler: (ctx) => handleLearningCommand(ctx.directory, ctx.args),
|
|
67381
67385
|
description: "Show learning metrics and violation trends",
|
|
67382
67386
|
args: "--json, --phase <N>",
|
|
67383
67387
|
details: "Computes aggregate learning metrics from knowledge events: violation-rate trends, directive application rates, escalation frequency, per-entry ROI, and never-applied entries. Surfaces a learning summary for the curator digest.",
|
|
67384
|
-
category: "diagnostics"
|
|
67388
|
+
category: "diagnostics",
|
|
67389
|
+
toolPolicy: "agent"
|
|
67385
67390
|
},
|
|
67386
67391
|
export: {
|
|
67387
67392
|
handler: (ctx) => handleExportCommand(ctx.directory, ctx.args),
|
|
@@ -67389,14 +67394,17 @@ var init_registry = __esm(() => {
|
|
|
67389
67394
|
args: "",
|
|
67390
67395
|
details: "Exports the current plan and context as JSON to stdout. Useful for piping to external tools or debugging swarm state.",
|
|
67391
67396
|
category: "utility",
|
|
67392
|
-
clashesWithNativeCcCommand: "/export"
|
|
67397
|
+
clashesWithNativeCcCommand: "/export",
|
|
67398
|
+
toolPolicy: "agent",
|
|
67399
|
+
toolNoArgs: true
|
|
67393
67400
|
},
|
|
67394
67401
|
evidence: {
|
|
67395
67402
|
handler: (ctx) => handleEvidenceCommand(ctx.directory, ctx.args),
|
|
67396
67403
|
description: "Show evidence bundles [taskId]",
|
|
67397
67404
|
args: "<taskId>",
|
|
67398
67405
|
details: 'Displays review results, test verdicts, and other evidence bundles for the given task ID (e.g., "2.1").',
|
|
67399
|
-
category: "utility"
|
|
67406
|
+
category: "utility",
|
|
67407
|
+
toolPolicy: "agent"
|
|
67400
67408
|
},
|
|
67401
67409
|
"evidence summary": {
|
|
67402
67410
|
handler: (ctx) => handleEvidenceSummaryCommand(ctx.directory),
|
|
@@ -67404,7 +67412,9 @@ var init_registry = __esm(() => {
|
|
|
67404
67412
|
subcommandOf: "evidence",
|
|
67405
67413
|
args: "",
|
|
67406
67414
|
details: "Generates a summary showing completion ratio across all tasks, lists blockers, and identifies missing evidence.",
|
|
67407
|
-
category: "utility"
|
|
67415
|
+
category: "utility",
|
|
67416
|
+
toolPolicy: "agent",
|
|
67417
|
+
toolNoArgs: true
|
|
67408
67418
|
},
|
|
67409
67419
|
"evidence-summary": {
|
|
67410
67420
|
handler: (ctx) => handleEvidenceSummaryCommand(ctx.directory),
|
|
@@ -67464,13 +67474,15 @@ var init_registry = __esm(() => {
|
|
|
67464
67474
|
description: "Archive old evidence bundles [--dry-run]",
|
|
67465
67475
|
details: "Archives evidence bundles older than max_age_days (config, default 90) or beyond max_bundles cap (config, default 1000). --dry-run previews which bundles would be archived without deleting them. Applies two-tier retention: age-based first, then count-based on oldest remaining.",
|
|
67466
67476
|
args: "--dry-run",
|
|
67467
|
-
category: "utility"
|
|
67477
|
+
category: "utility",
|
|
67478
|
+
toolPolicy: "none"
|
|
67468
67479
|
},
|
|
67469
67480
|
curate: {
|
|
67470
67481
|
handler: (ctx) => handleCurateCommand(ctx.directory, ctx.args),
|
|
67471
67482
|
description: "Run knowledge curation and hive promotion review",
|
|
67472
67483
|
args: "",
|
|
67473
|
-
category: "utility"
|
|
67484
|
+
category: "utility",
|
|
67485
|
+
toolPolicy: "none"
|
|
67474
67486
|
},
|
|
67475
67487
|
consolidate: {
|
|
67476
67488
|
handler: (ctx) => handleConsolidateCommand(ctx.directory, ctx.args, {
|
|
@@ -67479,13 +67491,15 @@ var init_registry = __esm(() => {
|
|
|
67479
67491
|
description: "Run quota-bounded skill-improver consolidation and stage skill proposals",
|
|
67480
67492
|
details: "Runs the same consolidation pass used by scheduled skill_improver trigger points: queue hardening, skill-improver proposal writing, and optional draft-skill generation. It never auto-activates skills. Use --respect-interval to obey the configured cadence instead of forcing a run.",
|
|
67481
67493
|
args: "--force, --respect-interval, --evaluate",
|
|
67482
|
-
category: "utility"
|
|
67494
|
+
category: "utility",
|
|
67495
|
+
toolPolicy: "restricted"
|
|
67483
67496
|
},
|
|
67484
67497
|
"dark-matter": {
|
|
67485
67498
|
handler: (ctx) => handleDarkMatterCommand(ctx.directory, ctx.args),
|
|
67486
67499
|
description: "Detect hidden file couplings via co-change NPMI analysis",
|
|
67487
67500
|
args: "--threshold <number>, --min-commits <number>",
|
|
67488
|
-
category: "diagnostics"
|
|
67501
|
+
category: "diagnostics",
|
|
67502
|
+
toolPolicy: "none"
|
|
67489
67503
|
},
|
|
67490
67504
|
finalize: {
|
|
67491
67505
|
handler: (ctx) => handleCloseCommand(ctx.directory, ctx.args, {
|
|
@@ -67494,7 +67508,8 @@ var init_registry = __esm(() => {
|
|
|
67494
67508
|
description: "Use /swarm finalize to finalize the swarm project and archive evidence",
|
|
67495
67509
|
details: "Idempotent 4-stage terminal finalization: (1) finalize writes retrospectives for in-progress phases, (2) archive creates timestamped bundle of swarm artifacts and evidence, (3) clean removes active-state files for a clean slate, (4) align performs safe git ff-only to main. Resets agent sessions and delegation chains. Reads .swarm/close-lessons.md for explicit lessons and runs curation. Use --skill-review to run the quota-bounded skill_improver in proposal mode.",
|
|
67496
67510
|
args: "--prune-branches, --skill-review",
|
|
67497
|
-
category: "core"
|
|
67511
|
+
category: "core",
|
|
67512
|
+
toolPolicy: "none"
|
|
67498
67513
|
},
|
|
67499
67514
|
close: {
|
|
67500
67515
|
handler: (ctx) => handleCloseCommand(ctx.directory, ctx.args, {
|
|
@@ -67514,7 +67529,8 @@ var init_registry = __esm(() => {
|
|
|
67514
67529
|
description: "Run the post-mortem agent: project-end synthesis, queue triage, and final curation pass",
|
|
67515
67530
|
details: "Reads .swarm/ evidence (knowledge entries, events, curator digests, proposals, retrospectives, drift reports) and produces a post-mortem report at .swarm/post-mortem-{planId}.md. Idempotent: re-runs skip if report exists unless --force is passed.",
|
|
67516
67531
|
args: "--force",
|
|
67517
|
-
category: "core"
|
|
67532
|
+
category: "core",
|
|
67533
|
+
toolPolicy: "agent"
|
|
67518
67534
|
},
|
|
67519
67535
|
concurrency: {
|
|
67520
67536
|
handler: (ctx) => handleConcurrencyCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
@@ -67531,115 +67547,133 @@ Subcommands:
|
|
|
67531
67547
|
` + ` concurrency reset \u2014 Clear the session concurrency override
|
|
67532
67548
|
` + `
|
|
67533
67549
|
` + "Session-scoped \u2014 resets on new session.",
|
|
67534
|
-
category: "utility"
|
|
67550
|
+
category: "utility",
|
|
67551
|
+
toolPolicy: "none"
|
|
67535
67552
|
},
|
|
67536
67553
|
simulate: {
|
|
67537
67554
|
handler: (ctx) => handleSimulateCommand(ctx.directory, ctx.args),
|
|
67538
67555
|
description: "Dry-run hidden coupling analysis with configurable thresholds",
|
|
67539
67556
|
args: "--threshold <number>, --min-commits <number>",
|
|
67540
|
-
category: "diagnostics"
|
|
67557
|
+
category: "diagnostics",
|
|
67558
|
+
toolPolicy: "none"
|
|
67541
67559
|
},
|
|
67542
67560
|
sdd: {
|
|
67543
67561
|
handler: (ctx) => handleSddCommand(ctx.directory, ctx.args),
|
|
67544
67562
|
description: "Manage OpenSpec-compatible SDD artifacts and effective spec projection",
|
|
67545
67563
|
args: "status|validate|project [--json] [--change <id>] [--dry-run]",
|
|
67546
67564
|
details: "Parent command for spec-driven development artifacts. Use sdd status to inspect .swarm/spec.md plus openspec/ artifacts, sdd validate to validate OpenSpec-compatible deltas, and sdd project to materialize the effective spec into .swarm/spec.md for planning.",
|
|
67547
|
-
category: "utility"
|
|
67565
|
+
category: "utility",
|
|
67566
|
+
toolPolicy: "agent"
|
|
67548
67567
|
},
|
|
67549
67568
|
"sdd status": {
|
|
67550
67569
|
handler: (ctx) => handleSddStatusCommand(ctx.directory, ctx.args),
|
|
67551
67570
|
description: "Show OpenSpec-compatible SDD status and effective spec source",
|
|
67552
67571
|
subcommandOf: "sdd",
|
|
67553
67572
|
args: "[--json]",
|
|
67554
|
-
category: "utility"
|
|
67573
|
+
category: "utility",
|
|
67574
|
+
toolPolicy: "agent"
|
|
67555
67575
|
},
|
|
67556
67576
|
"sdd validate": {
|
|
67557
67577
|
handler: (ctx) => handleSddValidateCommand(ctx.directory, ctx.args),
|
|
67558
67578
|
description: "Validate OpenSpec-compatible artifacts and effective spec projection",
|
|
67559
67579
|
subcommandOf: "sdd",
|
|
67560
67580
|
args: "[--json] [--change <id>]",
|
|
67561
|
-
category: "utility"
|
|
67581
|
+
category: "utility",
|
|
67582
|
+
toolPolicy: "agent"
|
|
67562
67583
|
},
|
|
67563
67584
|
"sdd project": {
|
|
67564
67585
|
handler: (ctx) => handleSddProjectCommand(ctx.directory, ctx.args),
|
|
67565
67586
|
description: "Materialize the OpenSpec-compatible effective spec into .swarm/spec.md",
|
|
67566
67587
|
subcommandOf: "sdd",
|
|
67567
67588
|
args: "[--dry-run] [--json] [--change <id>]",
|
|
67568
|
-
category: "utility"
|
|
67589
|
+
category: "utility",
|
|
67590
|
+
toolPolicy: "human-only"
|
|
67569
67591
|
},
|
|
67570
67592
|
analyze: {
|
|
67571
67593
|
handler: (ctx) => handleAnalyzeCommand(ctx.directory, ctx.args),
|
|
67572
67594
|
description: "Analyze spec.md vs plan.md for requirement coverage gaps",
|
|
67573
67595
|
args: "",
|
|
67574
|
-
category: "agent"
|
|
67596
|
+
category: "agent",
|
|
67597
|
+
toolPolicy: "none"
|
|
67575
67598
|
},
|
|
67576
67599
|
clarify: {
|
|
67577
67600
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleClarifyCommand),
|
|
67578
67601
|
description: "Clarify and refine an existing feature specification",
|
|
67579
67602
|
args: "[description-text]",
|
|
67580
|
-
category: "agent"
|
|
67603
|
+
category: "agent",
|
|
67604
|
+
toolPolicy: "none"
|
|
67581
67605
|
},
|
|
67582
67606
|
specify: {
|
|
67583
67607
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleSpecifyCommand),
|
|
67584
67608
|
description: "Generate or import a feature specification [description]",
|
|
67585
67609
|
args: "[description-text]",
|
|
67586
|
-
category: "agent"
|
|
67610
|
+
category: "agent",
|
|
67611
|
+
toolPolicy: "none"
|
|
67587
67612
|
},
|
|
67588
67613
|
brainstorm: {
|
|
67589
67614
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleBrainstormCommand),
|
|
67590
67615
|
description: "Enter architect MODE: BRAINSTORM \u2014 structured seven-phase planning workflow [topic]",
|
|
67591
67616
|
args: "[topic-text]",
|
|
67592
67617
|
details: "Triggers the architect to run the brainstorm workflow: CONTEXT SCAN, single-question DIALOGUE, APPROACHES, DESIGN SECTIONS, SPEC WRITE + SELF-REVIEW, QA GATE SELECTION, TRANSITION. Use for new plans where requirements need to be drawn out before writing spec.md / plan.md.",
|
|
67593
|
-
category: "agent"
|
|
67618
|
+
category: "agent",
|
|
67619
|
+
toolPolicy: "none"
|
|
67594
67620
|
},
|
|
67595
67621
|
council: {
|
|
67596
67622
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleCouncilCommand),
|
|
67597
67623
|
description: "Enter architect MODE: COUNCIL \u2014 multi-model deliberation [question] [--preset <name>] [--spec-review]",
|
|
67598
67624
|
args: "<question> [--preset <name>] [--spec-review]",
|
|
67599
67625
|
details: "Triggers the architect to convene a three-agent General Council: Generalist (reviewer model), Skeptic (critic model), and Domain Expert (SME model). Use --preset <name> to choose a named member preset from council.general.presets. " + "The architect first runs 1\u20133 targeted web searches and passes a compiled RESEARCH CONTEXT " + "to all three agents before dispatching them in parallel. Agents deliberate using the NSED peer-review protocol (Round 1 independent analysis, Round 2 MAINTAIN/CONCEDE/NUANCE for disagreements). The architect synthesizes the final answer directly from convene_general_council output. --spec-review switches to single-pass advisory mode for spec review. Requires council.general.enabled: true and a search API key in the resolved config: global ~/.config/opencode/opencode-swarm.json, then project .opencode/opencode-swarm.json overrides.",
|
|
67600
|
-
category: "agent"
|
|
67626
|
+
category: "agent",
|
|
67627
|
+
toolPolicy: "none"
|
|
67601
67628
|
},
|
|
67602
67629
|
"pr-review": {
|
|
67603
67630
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handlePrReviewCommand),
|
|
67604
67631
|
description: "Launch deep PR review with multi-lane analysis [url] [--council]",
|
|
67605
67632
|
args: "<pr-url|owner/repo#N|N> [--council]",
|
|
67606
67633
|
details: "Launches a structured PR review: reconstructs PR intent via obligation extraction cascade, runs 6 parallel explorer lanes through the deterministic dispatch_lanes join barrier (correctness, security, dependencies, docs-intent-vs-actual, tests, performance-architecture), validates findings through independent reviewer confirmation, applies critic challenge to HIGH/CRITICAL findings, synthesizes structured report. --council variant fires adversarial multi-model review. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolves against origin remote).",
|
|
67607
|
-
category: "agent"
|
|
67634
|
+
category: "agent",
|
|
67635
|
+
toolPolicy: "none"
|
|
67608
67636
|
},
|
|
67609
67637
|
"pr-feedback": {
|
|
67610
67638
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handlePrFeedbackCommand),
|
|
67611
67639
|
description: "Ingest and close known PR feedback (review comments, CI failures, conflicts) [pr] [instructions]",
|
|
67612
67640
|
args: "[url|owner/repo#N|N] [instructions...]",
|
|
67613
67641
|
details: "Triggers MODE: PR_FEEDBACK \u2014 ingests existing pull-request feedback (review threads, requested changes, CI/check failures, merge conflicts, stale branch state, pasted notes), verifies every claim against source, clusters related problems, fixes confirmed items, validates the branch, and reports closure status for every ledger item. Distinct from /swarm pr-review, which discovers new findings. The PR reference is optional: with none, the architect builds the ledger from the current PR/branch; text after the reference is forwarded as extra instructions. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin).",
|
|
67614
|
-
category: "agent"
|
|
67642
|
+
category: "agent",
|
|
67643
|
+
toolPolicy: "none"
|
|
67615
67644
|
},
|
|
67616
67645
|
"pr subscribe": {
|
|
67617
67646
|
handler: (ctx) => handlePrSubscribeCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
67618
67647
|
description: "Subscribe the current session to PR state-change notifications",
|
|
67619
67648
|
args: "<pr-url|owner/repo#N|N>",
|
|
67620
67649
|
details: "Subscribes the current session to receive advisory notifications for the specified PR. When pr_monitor.enabled is true, the background polling worker will detect CI failures, new comments, merge conflicts, review state changes, and merge/close events. Notifications are delivered as session-scoped advisories with dedup tokens. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin). Requires pr_monitor.enabled: true in config.",
|
|
67621
|
-
category: "agent"
|
|
67650
|
+
category: "agent",
|
|
67651
|
+
toolPolicy: "human-only"
|
|
67622
67652
|
},
|
|
67623
67653
|
"pr unsubscribe": {
|
|
67624
67654
|
handler: (ctx) => handlePrUnsubscribeCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
67625
67655
|
description: "Unsubscribe the current session from PR state-change notifications",
|
|
67626
67656
|
args: "<pr-url|owner/repo#N|N>",
|
|
67627
67657
|
details: "Unsubscribes the current session from receiving advisory notifications for the specified PR. Removes the active subscription record. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin).",
|
|
67628
|
-
category: "agent"
|
|
67658
|
+
category: "agent",
|
|
67659
|
+
toolPolicy: "human-only"
|
|
67629
67660
|
},
|
|
67630
67661
|
"pr status": {
|
|
67631
67662
|
handler: (ctx) => handlePrMonitorStatusCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
67632
67663
|
description: "Show PR monitor subscription status for the current session",
|
|
67633
67664
|
args: "",
|
|
67634
67665
|
details: "Displays all active PR subscriptions for the current session. Shows PR URL, last checked time, watching status, and error count per subscription. Also shows total active subscriptions across all sessions.",
|
|
67635
|
-
category: "agent"
|
|
67666
|
+
category: "agent",
|
|
67667
|
+
toolPolicy: "agent",
|
|
67668
|
+
toolNoArgs: true
|
|
67636
67669
|
},
|
|
67637
67670
|
"deep-dive": {
|
|
67638
67671
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDeepDiveCommand),
|
|
67639
67672
|
description: "Launch deep codebase audit with parallel explorer waves, dual reviewers, and critic challenge [scope]",
|
|
67640
67673
|
args: "<scope> [--profile standard|security|ux|architecture|full] [--max-explorers 1..8] [--json] [--skip-update] [--allow-dirty]",
|
|
67641
67674
|
details: "Runs a read-only deep audit of the specified scope using parallel explorer waves (8-file cap per mission, ~3500 line guardrail), always 2 parallel reviewers for verification, and sequential critic challenge on HIGH/CRITICAL findings. Profiles select explorer lanes: standard (5 lanes), security, ux, architecture, full (all 8 lanes). Emits a structured findings report without mutating source code.",
|
|
67642
|
-
category: "agent"
|
|
67675
|
+
category: "agent",
|
|
67676
|
+
toolPolicy: "none"
|
|
67643
67677
|
},
|
|
67644
67678
|
"deep dive": {
|
|
67645
67679
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDeepDiveCommand),
|
|
@@ -67653,7 +67687,8 @@ Subcommands:
|
|
|
67653
67687
|
description: "Launch a multi-source, fact-checked deep research pass and synthesize a cited report [question]",
|
|
67654
67688
|
args: "<question> [--depth standard|exhaustive] [--max-researchers 1..6] [--rounds 1..4] [--brief]",
|
|
67655
67689
|
details: "Runs the orchestrator-worker deep-research protocol: the architect decomposes the question into subtopics, gathers evidence with web_search and web_fetch across up to N iterative rounds, dispatches parallel sme synthesis workers, verifies every claim against cited sources with dual reviewers, challenges high-stakes claims with the critic, and presents a cited report in chat. Read-only \u2014 does not mutate source code, delegate to coder, or call declare_scope. Requires council.general.enabled and a search API key.",
|
|
67656
|
-
category: "agent"
|
|
67690
|
+
category: "agent",
|
|
67691
|
+
toolPolicy: "none"
|
|
67657
67692
|
},
|
|
67658
67693
|
"deep research": {
|
|
67659
67694
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDeepResearchCommand),
|
|
@@ -67667,7 +67702,8 @@ Subcommands:
|
|
|
67667
67702
|
description: "Launch codebase-review-swarm for a quote-grounded full-repo or large-subsystem audit",
|
|
67668
67703
|
args: "[scope] [--mode phase0|complete|defect|security|correctness|testing|ui|performance|ai-slop|enhancements|custom] [--tracks <list>] [--continue <run-id>] [--json] [--skip-update] [--allow-dirty]",
|
|
67669
67704
|
details: "Runs the codebase-review-swarm workflow: Phase 0 inventory, selected-track depth planning, non-diluting review passes, coverage closure, reviewer validation, critic challenge, and .swarm/review-v8 artifacts. Materializes the bundled skill package if missing, then emits a MODE signal; the architect workflow must not mutate source files.",
|
|
67670
|
-
category: "agent"
|
|
67705
|
+
category: "agent",
|
|
67706
|
+
toolPolicy: "none"
|
|
67671
67707
|
},
|
|
67672
67708
|
"codebase review": {
|
|
67673
67709
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleCodebaseReviewCommand),
|
|
@@ -67681,7 +67717,8 @@ Subcommands:
|
|
|
67681
67717
|
description: "Generate or sync language-agnostic design docs (domain, technical-spec, behavior-spec, reference/) for the project under build [description]",
|
|
67682
67718
|
args: "<description> [--out <dir>] [--lang <name>] [--update]",
|
|
67683
67719
|
details: "Triggers the architect to enter MODE: DESIGN_DOCS \u2014 delegates to the docs_design agent to author/sync docs/domain.md, docs/technical-spec.md, docs/behavior-spec.md, and docs/reference/* (plus reference/traceability.json and design-changelog.md). Normative docs are 100% language-agnostic; all framework-specific material is quarantined under reference/. --update syncs existing docs to current code/spec instead of generating fresh. Requires design_docs.enabled: true.",
|
|
67684
|
-
category: "agent"
|
|
67720
|
+
category: "agent",
|
|
67721
|
+
toolPolicy: "none"
|
|
67685
67722
|
},
|
|
67686
67723
|
"design docs": {
|
|
67687
67724
|
handler: (ctx) => handleModeCommandWithBundledSkills(ctx, handleDesignDocsCommand),
|
|
@@ -67695,21 +67732,24 @@ Subcommands:
|
|
|
67695
67732
|
description: "Ingest a GitHub issue into the swarm workflow [url] [--plan] [--trace] [--no-repro]",
|
|
67696
67733
|
args: "<issue-url|owner/repo#N|N> [--plan] [--trace] [--no-repro]",
|
|
67697
67734
|
details: "Triggers the architect to enter MODE: ISSUE_INGEST \u2014 ingests a GitHub issue, restructures it into a normalized intake note, localizes root cause through hypothesis-driven tracing, and outputs a resolution spec. --plan transitions to plan creation after spec generation. --trace runs the full fix-and-PR workflow (implies --plan). --no-repro skips the reproduction step. Supports full GitHub URL, owner/repo#N shorthand, or bare issue number (resolves against origin remote).",
|
|
67698
|
-
category: "agent"
|
|
67735
|
+
category: "agent",
|
|
67736
|
+
toolPolicy: "none"
|
|
67699
67737
|
},
|
|
67700
67738
|
"qa-gates": {
|
|
67701
67739
|
handler: (ctx) => handleQaGatesCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
67702
67740
|
description: "View or modify QA gate profile for the current plan [enable|override <gate>...]",
|
|
67703
67741
|
args: "[show|enable|override] <gate>...",
|
|
67704
67742
|
details: "show: display spec-level, session-override, and effective QA gates for the current plan. enable: persist gate(s) into the locked-once profile (architect; rejected after critic approval lock). override: session-only ratchet-tighter enable. Valid gates: reviewer, test_engineer, council_mode, sme_enabled, critic_pre_plan, hallucination_guard, sast_enabled, mutation_test, phase_council, drift_check, final_council.",
|
|
67705
|
-
category: "config"
|
|
67743
|
+
category: "config",
|
|
67744
|
+
toolPolicy: "none"
|
|
67706
67745
|
},
|
|
67707
67746
|
promote: {
|
|
67708
67747
|
handler: (ctx) => handlePromoteCommand(ctx.directory, ctx.args),
|
|
67709
67748
|
description: "Manually promote lesson to hive knowledge",
|
|
67710
67749
|
details: "Promotes a lesson directly to hive knowledge (--category flag sets category) or references an existing swarm lesson by ID (--from-swarm). Validates lesson text before promotion. Either direct text or --from-swarm ID is required.",
|
|
67711
67750
|
args: "--category <category>, --from-swarm <lesson-id>, <lesson-text>",
|
|
67712
|
-
category: "utility"
|
|
67751
|
+
category: "utility",
|
|
67752
|
+
toolPolicy: "none"
|
|
67713
67753
|
},
|
|
67714
67754
|
reset: {
|
|
67715
67755
|
handler: (ctx) => handleResetCommand(ctx.directory, ctx.args),
|
|
@@ -67717,35 +67757,40 @@ Subcommands:
|
|
|
67717
67757
|
details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag \u2014 without it, displays a warning and tips to export first.",
|
|
67718
67758
|
args: "--confirm (required)",
|
|
67719
67759
|
category: "utility",
|
|
67720
|
-
clashesWithNativeCcCommand: "/reset"
|
|
67760
|
+
clashesWithNativeCcCommand: "/reset",
|
|
67761
|
+
toolPolicy: "restricted"
|
|
67721
67762
|
},
|
|
67722
67763
|
"reset-session": {
|
|
67723
67764
|
handler: (ctx) => handleResetSessionCommand(ctx.directory, ctx.args),
|
|
67724
67765
|
description: "Clear session state while preserving plan, evidence, and knowledge",
|
|
67725
67766
|
details: "Deletes only .swarm/session/state.json and any other session files. Clears in-memory agent sessions and delegation chains. Preserves plan, evidence, and knowledge for cross-session continuity.",
|
|
67726
67767
|
args: "",
|
|
67727
|
-
category: "utility"
|
|
67768
|
+
category: "utility",
|
|
67769
|
+
toolPolicy: "restricted"
|
|
67728
67770
|
},
|
|
67729
67771
|
rollback: {
|
|
67730
67772
|
handler: (ctx) => handleRollbackCommand(ctx.directory, ctx.args),
|
|
67731
67773
|
description: "Restore swarm state to a checkpoint <phase>",
|
|
67732
67774
|
details: "Restores .swarm/ state by directly overwriting files from a checkpoint directory (checkpoints/phase-<N>). Writes rollback event to events.jsonl. Without phase argument, lists available checkpoints. Partial failures are reported but processing continues.",
|
|
67733
67775
|
args: "<phase-number>",
|
|
67734
|
-
category: "utility"
|
|
67776
|
+
category: "utility",
|
|
67777
|
+
toolPolicy: "restricted"
|
|
67735
67778
|
},
|
|
67736
67779
|
retrieve: {
|
|
67737
67780
|
handler: (ctx) => handleRetrieveCommand(ctx.directory, ctx.args),
|
|
67738
67781
|
description: "Retrieve full output from a summary <id>",
|
|
67739
67782
|
args: "<summary-id>",
|
|
67740
67783
|
details: "Loads the full tool output that was previously summarized (referenced by IDs like S1, S2). Use when you need the complete output instead of the truncated summary.",
|
|
67741
|
-
category: "utility"
|
|
67784
|
+
category: "utility",
|
|
67785
|
+
toolPolicy: "agent"
|
|
67742
67786
|
},
|
|
67743
67787
|
handoff: {
|
|
67744
67788
|
handler: (ctx) => handleHandoffCommand(ctx.directory, ctx.args),
|
|
67745
67789
|
description: "Prepare state for clean model switch (new session)",
|
|
67746
67790
|
args: "",
|
|
67747
67791
|
details: "Generates handoff.md with full session state snapshot, including plan progress, recent decisions, and agent delegation history. Prepended to the next session prompt for seamless model switches.",
|
|
67748
|
-
category: "core"
|
|
67792
|
+
category: "core",
|
|
67793
|
+
toolPolicy: "none"
|
|
67749
67794
|
},
|
|
67750
67795
|
turbo: {
|
|
67751
67796
|
handler: (ctx) => handleTurboCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
@@ -67767,28 +67812,32 @@ Subcommands:
|
|
|
67767
67812
|
` + ` turbo status \u2014 show detailed status including active strategy and lanes
|
|
67768
67813
|
` + `
|
|
67769
67814
|
` + "Session-scoped \u2014 resets on new session.",
|
|
67770
|
-
category: "utility"
|
|
67815
|
+
category: "utility",
|
|
67816
|
+
toolPolicy: "none"
|
|
67771
67817
|
},
|
|
67772
67818
|
"full-auto": {
|
|
67773
67819
|
handler: (ctx) => handleFullAutoCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
67774
67820
|
description: "Toggle Full-Auto Mode for the active session [on [mode]|off|status]",
|
|
67775
67821
|
args: "on [assisted|supervised|strict], off, status",
|
|
67776
67822
|
details: 'First-class toggle for Full-Auto Mode \u2014 autonomous execution with the critic reviewing escalations on your behalf. No config-level enablement is required: "on" activates immediately (unless full_auto.locked is true in config), "off" disarms the run and returns the session to normal interactive operation, "status" reports the durable run state. ' + 'An optional mode after "on" overrides full_auto.mode for this run: assisted (critic consulted only on policy escalations), supervised (default \u2014 risky/high-impact actions reviewed by the critic), strict (ALL plan mutations reviewed by the critic). ' + "While active, the critic answers architect questions and reviews phase boundaries, delegations, and risky actions on your behalf; only ESCALATE_TO_HUMAN verdicts halt the run for your input. The run state is durable (.swarm/full-auto-state.json) and survives restarts; toggle with no argument flips the current state.",
|
|
67777
|
-
category: "utility"
|
|
67823
|
+
category: "utility",
|
|
67824
|
+
toolPolicy: "none"
|
|
67778
67825
|
},
|
|
67779
67826
|
"auto-proceed": {
|
|
67780
67827
|
handler: (ctx) => handleAutoProceedCommand(ctx.directory, ctx.args, ctx.sessionID),
|
|
67781
67828
|
description: "Toggle or set auto-proceed override for the active session",
|
|
67782
67829
|
args: "[on|off]",
|
|
67783
67830
|
category: "config",
|
|
67784
|
-
details: 'Without argument, toggles auto-proceed mode. With "on" or "off", sets the state explicitly.'
|
|
67831
|
+
details: 'Without argument, toggles auto-proceed mode. With "on" or "off", sets the state explicitly.',
|
|
67832
|
+
toolPolicy: "agent"
|
|
67785
67833
|
},
|
|
67786
67834
|
"write-retro": {
|
|
67787
67835
|
handler: (ctx) => handleWriteRetroCommand(ctx.directory, ctx.args),
|
|
67788
67836
|
description: "Write a retrospective evidence bundle for a completed phase <json>",
|
|
67789
67837
|
details: "Writes retrospective evidence bundle to .swarm/evidence/retro-{phase}/evidence.json. Required JSON: phase, summary, task_count, task_complexity, total_tool_calls, coder_revisions, reviewer_rejections, test_failures, security_findings, integration_issues. Optional: lessons_learned (max 5), top_rejection_reasons, task_id, metadata.",
|
|
67790
67838
|
args: "<json: {phase, summary, task_count, task_complexity, ...}>",
|
|
67791
|
-
category: "utility"
|
|
67839
|
+
category: "utility",
|
|
67840
|
+
toolPolicy: "none"
|
|
67792
67841
|
},
|
|
67793
67842
|
"knowledge migrate": {
|
|
67794
67843
|
handler: (ctx) => handleKnowledgeMigrateCommand(ctx.directory, ctx.args),
|
|
@@ -67832,75 +67881,89 @@ Subcommands:
|
|
|
67832
67881
|
knowledge: {
|
|
67833
67882
|
handler: (ctx) => handleKnowledgeListCommand(ctx.directory, ctx.args),
|
|
67834
67883
|
description: "List knowledge entries",
|
|
67835
|
-
category: "utility"
|
|
67884
|
+
category: "utility",
|
|
67885
|
+
toolPolicy: "agent"
|
|
67836
67886
|
},
|
|
67837
67887
|
memory: {
|
|
67838
67888
|
handler: (ctx) => handleMemoryCommand(ctx.directory, ctx.args),
|
|
67839
67889
|
description: "Show Swarm memory commands",
|
|
67840
|
-
category: "utility"
|
|
67890
|
+
category: "utility",
|
|
67891
|
+
toolPolicy: "agent",
|
|
67892
|
+
toolNoArgs: true
|
|
67841
67893
|
},
|
|
67842
67894
|
"memory status": {
|
|
67843
67895
|
handler: (ctx) => handleMemoryStatusCommand(ctx.directory, ctx.args),
|
|
67844
67896
|
description: "Show Swarm memory provider, JSONL, and migration status",
|
|
67845
67897
|
subcommandOf: "memory",
|
|
67846
67898
|
args: "",
|
|
67847
|
-
category: "diagnostics"
|
|
67899
|
+
category: "diagnostics",
|
|
67900
|
+
toolPolicy: "agent",
|
|
67901
|
+
toolNoArgs: true
|
|
67848
67902
|
},
|
|
67849
67903
|
"memory pending": {
|
|
67850
67904
|
handler: (ctx) => handleMemoryPendingCommand(ctx.directory, ctx.args),
|
|
67851
67905
|
description: "Show pending Swarm memory proposals and rejection reasons",
|
|
67852
67906
|
subcommandOf: "memory",
|
|
67853
67907
|
args: "--limit <n>",
|
|
67854
|
-
category: "diagnostics"
|
|
67908
|
+
category: "diagnostics",
|
|
67909
|
+
toolPolicy: "agent"
|
|
67855
67910
|
},
|
|
67856
67911
|
"memory recall-log": {
|
|
67857
67912
|
handler: (ctx) => handleMemoryRecallLogCommand(ctx.directory, ctx.args),
|
|
67858
67913
|
description: "Summarize Swarm memory recall usage",
|
|
67859
67914
|
subcommandOf: "memory",
|
|
67860
67915
|
args: "--limit <n>",
|
|
67861
|
-
category: "diagnostics"
|
|
67916
|
+
category: "diagnostics",
|
|
67917
|
+
toolPolicy: "agent"
|
|
67862
67918
|
},
|
|
67863
67919
|
"memory compact": {
|
|
67864
67920
|
handler: (ctx) => handleMemoryCompactCommand(ctx.directory, ctx.args),
|
|
67865
67921
|
description: "Compact deleted, superseded, and expired scratch memories",
|
|
67866
67922
|
subcommandOf: "memory",
|
|
67867
67923
|
args: "--confirm",
|
|
67868
|
-
category: "utility"
|
|
67924
|
+
category: "utility",
|
|
67925
|
+
toolPolicy: "human-only"
|
|
67869
67926
|
},
|
|
67870
67927
|
"memory stale": {
|
|
67871
67928
|
handler: (ctx) => handleMemoryStaleCommand(ctx.directory, ctx.args),
|
|
67872
67929
|
description: "List stale and low-utility Swarm memories",
|
|
67873
67930
|
subcommandOf: "memory",
|
|
67874
67931
|
args: "--limit <n>",
|
|
67875
|
-
category: "diagnostics"
|
|
67932
|
+
category: "diagnostics",
|
|
67933
|
+
toolPolicy: "agent"
|
|
67876
67934
|
},
|
|
67877
67935
|
"memory export": {
|
|
67878
67936
|
handler: (ctx) => handleMemoryExportCommand(ctx.directory, ctx.args),
|
|
67879
67937
|
description: "Export current Swarm memory to JSONL files",
|
|
67880
67938
|
subcommandOf: "memory",
|
|
67881
67939
|
args: "",
|
|
67882
|
-
category: "utility"
|
|
67940
|
+
category: "utility",
|
|
67941
|
+
toolPolicy: "agent",
|
|
67942
|
+
toolNoArgs: true
|
|
67883
67943
|
},
|
|
67884
67944
|
"memory evaluate": {
|
|
67885
67945
|
handler: (ctx) => handleMemoryEvaluateCommand(ctx.directory, ctx.args),
|
|
67886
67946
|
description: "Run golden Swarm memory recall evaluation fixtures",
|
|
67887
67947
|
subcommandOf: "memory",
|
|
67888
67948
|
args: "--json, --fixtures <directory>",
|
|
67889
|
-
category: "diagnostics"
|
|
67949
|
+
category: "diagnostics",
|
|
67950
|
+
toolPolicy: "agent"
|
|
67890
67951
|
},
|
|
67891
67952
|
"memory import": {
|
|
67892
67953
|
handler: (ctx) => handleMemoryImportCommand(ctx.directory, ctx.args),
|
|
67893
67954
|
description: "Import legacy JSONL memory into SQLite",
|
|
67894
67955
|
subcommandOf: "memory",
|
|
67895
67956
|
args: "",
|
|
67896
|
-
category: "utility"
|
|
67957
|
+
category: "utility",
|
|
67958
|
+
toolPolicy: "human-only"
|
|
67897
67959
|
},
|
|
67898
67960
|
"memory migrate": {
|
|
67899
67961
|
handler: (ctx) => handleMemoryMigrateCommand(ctx.directory, ctx.args),
|
|
67900
67962
|
description: "Run the one-time legacy JSONL to SQLite migration",
|
|
67901
67963
|
subcommandOf: "memory",
|
|
67902
67964
|
args: "",
|
|
67903
|
-
category: "utility"
|
|
67965
|
+
category: "utility",
|
|
67966
|
+
toolPolicy: "human-only"
|
|
67904
67967
|
},
|
|
67905
67968
|
checkpoint: {
|
|
67906
67969
|
handler: (ctx) => handleCheckpointCommand(ctx.directory, ctx.args),
|
|
@@ -67908,19 +67971,21 @@ Subcommands:
|
|
|
67908
67971
|
details: "save: creates named snapshot of current .swarm/ state. restore: soft-resets to checkpoint by overwriting current .swarm/ files. delete: removes named checkpoint. list: shows all checkpoints with timestamps. All subcommands require a label except list.",
|
|
67909
67972
|
args: "<save|restore|delete|list> <label>",
|
|
67910
67973
|
category: "utility",
|
|
67911
|
-
clashesWithNativeCcCommand: "/checkpoint"
|
|
67974
|
+
clashesWithNativeCcCommand: "/checkpoint",
|
|
67975
|
+
toolPolicy: "restricted"
|
|
67912
67976
|
}
|
|
67913
67977
|
};
|
|
67914
67978
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
67915
|
-
|
|
67979
|
+
_internals11 = {
|
|
67916
67980
|
handleHelpCommand,
|
|
67917
67981
|
validateAliases,
|
|
67982
|
+
validateToolPolicy,
|
|
67918
67983
|
resolveCommand,
|
|
67919
67984
|
levenshteinDistance: levenshteinDistance2,
|
|
67920
67985
|
findSimilarCommands,
|
|
67921
67986
|
buildDetailedHelp
|
|
67922
67987
|
};
|
|
67923
|
-
validation =
|
|
67988
|
+
validation = _internals11.validateAliases();
|
|
67924
67989
|
if (!validation.valid) {
|
|
67925
67990
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
67926
67991
|
${validation.errors.join(`
|
|
@@ -67931,6 +67996,16 @@ ${validation.errors.join(`
|
|
|
67931
67996
|
${validation.warnings.join(`
|
|
67932
67997
|
`)}`);
|
|
67933
67998
|
}
|
|
67999
|
+
try {
|
|
68000
|
+
const toolPolicyValidation = _internals11.validateToolPolicy();
|
|
68001
|
+
if (toolPolicyValidation.warnings.length > 0) {
|
|
68002
|
+
console.warn(`COMMAND_REGISTRY toolPolicy warnings:
|
|
68003
|
+
${toolPolicyValidation.warnings.join(`
|
|
68004
|
+
`)}`);
|
|
68005
|
+
}
|
|
68006
|
+
} catch (e) {
|
|
68007
|
+
console.warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
|
|
68008
|
+
}
|
|
67934
68009
|
});
|
|
67935
68010
|
|
|
67936
68011
|
// src/cli/index.ts
|