opencode-swarm 7.25.0 → 7.25.2
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/README.md +34 -6
- package/dist/cli/index.js +266 -54
- package/dist/evidence/manager.d.ts +8 -0
- package/dist/index.js +579 -249
- package/dist/services/config-doctor.d.ts +33 -0
- package/dist/test-impact/analyzer.d.ts +2 -0
- package/dist/test-impact/history-store.d.ts +7 -0
- package/dist/tools/pre-check-batch.d.ts +1 -1
- package/dist/tools/resolve-working-directory.d.ts +8 -1
- package/dist/tools/update-task-status.d.ts +3 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var package_default;
|
|
|
34
34
|
var init_package = __esm(() => {
|
|
35
35
|
package_default = {
|
|
36
36
|
name: "opencode-swarm",
|
|
37
|
-
version: "7.25.
|
|
37
|
+
version: "7.25.2",
|
|
38
38
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
39
39
|
main: "dist/index.js",
|
|
40
40
|
types: "dist/index.d.ts",
|
|
@@ -19802,13 +19802,47 @@ var init_task_id = __esm(() => {
|
|
|
19802
19802
|
});
|
|
19803
19803
|
|
|
19804
19804
|
// src/evidence/manager.ts
|
|
19805
|
-
import {
|
|
19805
|
+
import {
|
|
19806
|
+
mkdirSync as mkdirSync3,
|
|
19807
|
+
readdirSync as readdirSync3,
|
|
19808
|
+
realpathSync,
|
|
19809
|
+
rmSync,
|
|
19810
|
+
statSync as statSync4
|
|
19811
|
+
} from "fs";
|
|
19806
19812
|
import * as fs4 from "fs/promises";
|
|
19807
19813
|
import * as path7 from "path";
|
|
19808
19814
|
function isValidEvidenceType(type) {
|
|
19809
19815
|
return VALID_EVIDENCE_TYPES.includes(type);
|
|
19810
19816
|
}
|
|
19817
|
+
function validateProjectRoot(directory) {
|
|
19818
|
+
let resolved;
|
|
19819
|
+
try {
|
|
19820
|
+
resolved = realpathSync(directory);
|
|
19821
|
+
} catch {
|
|
19822
|
+
warn(`[evidence] Cannot canonicalize directory "${directory}" \u2014 failing closed`);
|
|
19823
|
+
throw new Error(`Cannot verify project root for "${directory}" \u2014 directory may not exist or is inaccessible`);
|
|
19824
|
+
}
|
|
19825
|
+
let current = resolved;
|
|
19826
|
+
while (true) {
|
|
19827
|
+
const parent = path7.dirname(current);
|
|
19828
|
+
if (parent === current)
|
|
19829
|
+
break;
|
|
19830
|
+
const parentSwarm = path7.join(parent, ".swarm");
|
|
19831
|
+
try {
|
|
19832
|
+
if (statSync4(parentSwarm).isDirectory()) {
|
|
19833
|
+
warn(`[evidence] Rejecting write to subdirectory "${resolved}" \u2014 parent "${parent}" already contains .swarm/`);
|
|
19834
|
+
throw new Error(`Cannot write evidence in "${resolved}" \u2014 parent directory "${parent}" already contains a .swarm/ folder. Evidence must be written to the project root.`);
|
|
19835
|
+
}
|
|
19836
|
+
} catch (error49) {
|
|
19837
|
+
if (error49 instanceof Error && error49.message.startsWith("Cannot write evidence")) {
|
|
19838
|
+
throw error49;
|
|
19839
|
+
}
|
|
19840
|
+
}
|
|
19841
|
+
current = parent;
|
|
19842
|
+
}
|
|
19843
|
+
}
|
|
19811
19844
|
async function saveEvidence(directory, taskId, evidence) {
|
|
19845
|
+
_internals5.validateProjectRoot(directory);
|
|
19812
19846
|
const sanitizedTaskId = sanitizeTaskId2(taskId);
|
|
19813
19847
|
const relativePath = path7.join("evidence", sanitizedTaskId, "evidence.json");
|
|
19814
19848
|
validateSwarmPath(directory, relativePath);
|
|
@@ -20073,7 +20107,8 @@ var init_manager2 = __esm(() => {
|
|
|
20073
20107
|
_internals5 = {
|
|
20074
20108
|
wrapFlatRetrospective,
|
|
20075
20109
|
loadEvidence,
|
|
20076
|
-
listEvidenceTaskIds
|
|
20110
|
+
listEvidenceTaskIds,
|
|
20111
|
+
validateProjectRoot
|
|
20077
20112
|
};
|
|
20078
20113
|
});
|
|
20079
20114
|
|
|
@@ -39933,7 +39968,9 @@ __export(exports_config_doctor, {
|
|
|
39933
39968
|
runConfigDoctorWithFixes: () => runConfigDoctorWithFixes,
|
|
39934
39969
|
runConfigDoctor: () => runConfigDoctor,
|
|
39935
39970
|
restoreFromBackup: () => restoreFromBackup,
|
|
39971
|
+
removeStraySwarmDir: () => removeStraySwarmDir,
|
|
39936
39972
|
getConfigPaths: () => getConfigPaths,
|
|
39973
|
+
detectStraySwarmDirs: () => detectStraySwarmDirs,
|
|
39937
39974
|
createConfigBackup: () => createConfigBackup,
|
|
39938
39975
|
applySafeAutoFixes: () => applySafeAutoFixes
|
|
39939
39976
|
});
|
|
@@ -40549,6 +40586,114 @@ async function runConfigDoctorWithFixes(directory, config3, autoFix = false) {
|
|
|
40549
40586
|
artifactPath
|
|
40550
40587
|
};
|
|
40551
40588
|
}
|
|
40589
|
+
function detectStraySwarmDirs(projectRoot) {
|
|
40590
|
+
const findings = [];
|
|
40591
|
+
const SKIP_DIRS = new Set([
|
|
40592
|
+
"node_modules",
|
|
40593
|
+
".git",
|
|
40594
|
+
"dist",
|
|
40595
|
+
".cache",
|
|
40596
|
+
".next",
|
|
40597
|
+
"coverage",
|
|
40598
|
+
".turbo",
|
|
40599
|
+
".vercel",
|
|
40600
|
+
".terraform",
|
|
40601
|
+
"__pycache__",
|
|
40602
|
+
".tox"
|
|
40603
|
+
]);
|
|
40604
|
+
const MAX_DEPTH = 10;
|
|
40605
|
+
const MAX_CONTENTS_ENTRIES = 20;
|
|
40606
|
+
function walk(dir, depth) {
|
|
40607
|
+
if (depth > MAX_DEPTH)
|
|
40608
|
+
return;
|
|
40609
|
+
let entries;
|
|
40610
|
+
try {
|
|
40611
|
+
entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
40612
|
+
} catch {
|
|
40613
|
+
return;
|
|
40614
|
+
}
|
|
40615
|
+
for (const entry of entries) {
|
|
40616
|
+
if (!entry.isDirectory())
|
|
40617
|
+
continue;
|
|
40618
|
+
const name = entry.name;
|
|
40619
|
+
const fullPath = path23.join(dir, name);
|
|
40620
|
+
if (SKIP_DIRS.has(name))
|
|
40621
|
+
continue;
|
|
40622
|
+
const gitPath = path23.join(fullPath, ".git");
|
|
40623
|
+
try {
|
|
40624
|
+
const gitStat = fs8.statSync(gitPath);
|
|
40625
|
+
if (gitStat.isFile() || gitStat.isDirectory())
|
|
40626
|
+
continue;
|
|
40627
|
+
} catch {}
|
|
40628
|
+
if (name === ".swarm") {
|
|
40629
|
+
const parentDir = path23.dirname(fullPath);
|
|
40630
|
+
if (parentDir === projectRoot)
|
|
40631
|
+
continue;
|
|
40632
|
+
let contents = [];
|
|
40633
|
+
try {
|
|
40634
|
+
contents = fs8.readdirSync(fullPath);
|
|
40635
|
+
} catch {
|
|
40636
|
+
contents = ["<unreadable>"];
|
|
40637
|
+
}
|
|
40638
|
+
findings.push({
|
|
40639
|
+
path: path23.relative(projectRoot, fullPath).replace(/\\/g, "/"),
|
|
40640
|
+
absolutePath: fullPath,
|
|
40641
|
+
contents: contents.slice(0, MAX_CONTENTS_ENTRIES),
|
|
40642
|
+
totalEntries: contents.length
|
|
40643
|
+
});
|
|
40644
|
+
continue;
|
|
40645
|
+
}
|
|
40646
|
+
walk(fullPath, depth + 1);
|
|
40647
|
+
}
|
|
40648
|
+
}
|
|
40649
|
+
walk(projectRoot, 0);
|
|
40650
|
+
return findings;
|
|
40651
|
+
}
|
|
40652
|
+
function removeStraySwarmDir(projectRoot, strayPath) {
|
|
40653
|
+
let canonicalRoot;
|
|
40654
|
+
let canonicalStray;
|
|
40655
|
+
try {
|
|
40656
|
+
canonicalRoot = fs8.realpathSync(projectRoot);
|
|
40657
|
+
canonicalStray = fs8.realpathSync(path23.isAbsolute(strayPath) ? strayPath : path23.resolve(projectRoot, strayPath));
|
|
40658
|
+
} catch (err) {
|
|
40659
|
+
return {
|
|
40660
|
+
success: false,
|
|
40661
|
+
message: `Failed to resolve paths: ${err instanceof Error ? err.message : String(err)}`
|
|
40662
|
+
};
|
|
40663
|
+
}
|
|
40664
|
+
const rootSwarm = path23.join(canonicalRoot, ".swarm");
|
|
40665
|
+
if (canonicalStray === rootSwarm || canonicalStray === canonicalRoot) {
|
|
40666
|
+
return {
|
|
40667
|
+
success: false,
|
|
40668
|
+
message: "Refusing to remove root .swarm/ directory"
|
|
40669
|
+
};
|
|
40670
|
+
}
|
|
40671
|
+
if (!canonicalStray.startsWith(canonicalRoot + path23.sep)) {
|
|
40672
|
+
return {
|
|
40673
|
+
success: false,
|
|
40674
|
+
message: "Path is outside project root \u2014 refusing to remove"
|
|
40675
|
+
};
|
|
40676
|
+
}
|
|
40677
|
+
const normalizedStray = canonicalStray.replace(/\\/g, "/");
|
|
40678
|
+
if (!normalizedStray.endsWith("/.swarm")) {
|
|
40679
|
+
return {
|
|
40680
|
+
success: false,
|
|
40681
|
+
message: "Path is not a .swarm directory \u2014 refusing to remove"
|
|
40682
|
+
};
|
|
40683
|
+
}
|
|
40684
|
+
try {
|
|
40685
|
+
fs8.rmSync(canonicalStray, { recursive: true, force: true });
|
|
40686
|
+
return {
|
|
40687
|
+
success: true,
|
|
40688
|
+
message: `Removed stray .swarm directory: ${canonicalStray}`
|
|
40689
|
+
};
|
|
40690
|
+
} catch (err) {
|
|
40691
|
+
return {
|
|
40692
|
+
success: false,
|
|
40693
|
+
message: `Failed to remove: ${err instanceof Error ? err.message : String(err)}`
|
|
40694
|
+
};
|
|
40695
|
+
}
|
|
40696
|
+
}
|
|
40552
40697
|
var VALID_CONFIG_PATTERNS, DANGEROUS_PATH_SEGMENTS;
|
|
40553
40698
|
var init_config_doctor = __esm(() => {
|
|
40554
40699
|
init_utils();
|
|
@@ -42236,12 +42381,62 @@ async function handleDoctorCommand(directory, args) {
|
|
|
42236
42381
|
const enableAutoFix = args.includes("--fix") || args.includes("-f");
|
|
42237
42382
|
const config3 = loadPluginConfig(directory);
|
|
42238
42383
|
const result = runConfigDoctor(config3, directory);
|
|
42384
|
+
let output;
|
|
42239
42385
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
42240
42386
|
const { runConfigDoctorWithFixes: runConfigDoctorWithFixes2 } = await Promise.resolve().then(() => (init_config_doctor(), exports_config_doctor));
|
|
42241
42387
|
const fixResult = await runConfigDoctorWithFixes2(directory, config3, true);
|
|
42242
|
-
|
|
42388
|
+
output = formatDoctorMarkdown(fixResult.result);
|
|
42389
|
+
} else {
|
|
42390
|
+
output = formatDoctorMarkdown(result);
|
|
42243
42391
|
}
|
|
42244
|
-
|
|
42392
|
+
const strayDirs = detectStraySwarmDirs(directory);
|
|
42393
|
+
if (strayDirs.length > 0) {
|
|
42394
|
+
if (enableAutoFix) {
|
|
42395
|
+
let fixOutput = `
|
|
42396
|
+
---
|
|
42397
|
+
|
|
42398
|
+
## Stray .swarm Directories
|
|
42399
|
+
|
|
42400
|
+
`;
|
|
42401
|
+
let removed = 0;
|
|
42402
|
+
let failed = 0;
|
|
42403
|
+
for (const finding of strayDirs) {
|
|
42404
|
+
const cleanupResult = removeStraySwarmDir(directory, finding.path);
|
|
42405
|
+
if (cleanupResult.success) {
|
|
42406
|
+
removed++;
|
|
42407
|
+
} else {
|
|
42408
|
+
failed++;
|
|
42409
|
+
fixOutput += `- \`${finding.path}\`: ${cleanupResult.message}
|
|
42410
|
+
`;
|
|
42411
|
+
}
|
|
42412
|
+
}
|
|
42413
|
+
fixOutput += `
|
|
42414
|
+
Cleaned up ${removed} stray director${removed === 1 ? "y" : "ies"}.`;
|
|
42415
|
+
if (failed > 0) {
|
|
42416
|
+
fixOutput += ` ${failed} could not be removed.`;
|
|
42417
|
+
}
|
|
42418
|
+
output += fixOutput;
|
|
42419
|
+
} else {
|
|
42420
|
+
output += `
|
|
42421
|
+
---
|
|
42422
|
+
|
|
42423
|
+
## Stray .swarm Directories
|
|
42424
|
+
|
|
42425
|
+
`;
|
|
42426
|
+
output += `Found ${strayDirs.length} stray .swarm director${strayDirs.length === 1 ? "y" : "ies"} in subdirectories:
|
|
42427
|
+
|
|
42428
|
+
`;
|
|
42429
|
+
for (const finding of strayDirs) {
|
|
42430
|
+
const contentsPreview = finding.contents.length > 5 ? `${finding.contents.slice(0, 5).join(", ")}, ...` : finding.contents.join(", ");
|
|
42431
|
+
output += `- \`${finding.path}\` (${finding.totalEntries} entries: ${contentsPreview})
|
|
42432
|
+
`;
|
|
42433
|
+
}
|
|
42434
|
+
output += `
|
|
42435
|
+
These are likely from a prior bug (Issue #922). `;
|
|
42436
|
+
output += "Re-run with `--fix` to auto-clean.\n";
|
|
42437
|
+
}
|
|
42438
|
+
}
|
|
42439
|
+
return output;
|
|
42245
42440
|
}
|
|
42246
42441
|
async function handleDoctorToolsCommand(directory, _args) {
|
|
42247
42442
|
const result = runToolDoctor(directory);
|
|
@@ -46899,6 +47094,10 @@ async function loadImpactMap(cwd, options) {
|
|
|
46899
47094
|
return _internals22.buildImpactMap(cwd);
|
|
46900
47095
|
}
|
|
46901
47096
|
async function saveImpactMap(cwd, impactMap) {
|
|
47097
|
+
if (!path34.isAbsolute(cwd)) {
|
|
47098
|
+
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
47099
|
+
}
|
|
47100
|
+
_internals22.validateProjectRoot(cwd);
|
|
46902
47101
|
const cacheDir2 = path34.join(cwd, ".swarm", "cache");
|
|
46903
47102
|
const cachePath = path34.join(cacheDir2, "impact-map.json");
|
|
46904
47103
|
if (!fs17.existsSync(cacheDir2)) {
|
|
@@ -46991,6 +47190,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
46991
47190
|
}
|
|
46992
47191
|
var IMPORT_REGEX_ES, IMPORT_REGEX_REQUIRE, IMPORT_REGEX_REEXPORT, TS_EXTENSIONS, PYTHON_EXTENSIONS, GO_EXTENSIONS, EXTENSIONS_TO_TRY, goModuleCache, _internals22;
|
|
46993
47192
|
var init_analyzer = __esm(() => {
|
|
47193
|
+
init_manager2();
|
|
46994
47194
|
init_go();
|
|
46995
47195
|
init_python();
|
|
46996
47196
|
IMPORT_REGEX_ES = /import\s+[\s\S]*?\s+from\s+['"]([^'"]+)['"]/g;
|
|
@@ -47002,6 +47202,7 @@ var init_analyzer = __esm(() => {
|
|
|
47002
47202
|
EXTENSIONS_TO_TRY = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
47003
47203
|
goModuleCache = new Map;
|
|
47004
47204
|
_internals22 = {
|
|
47205
|
+
validateProjectRoot,
|
|
47005
47206
|
normalizePath,
|
|
47006
47207
|
isCacheStale,
|
|
47007
47208
|
resolveRelativeImport,
|
|
@@ -47225,7 +47426,13 @@ var FLAKY_THRESHOLD = 0.3, MIN_RUNS_FOR_QUARANTINE = 5, MAX_HISTORY_RUNS = 20;
|
|
|
47225
47426
|
import fs18 from "fs";
|
|
47226
47427
|
import path35 from "path";
|
|
47227
47428
|
function getHistoryPath(workingDir) {
|
|
47228
|
-
|
|
47429
|
+
if (!workingDir) {
|
|
47430
|
+
throw new Error("getHistoryPath requires a working directory \u2014 project root must be provided by the caller");
|
|
47431
|
+
}
|
|
47432
|
+
if (!path35.isAbsolute(workingDir)) {
|
|
47433
|
+
throw new Error(`getHistoryPath requires an absolute project root path, got: "${workingDir}"`);
|
|
47434
|
+
}
|
|
47435
|
+
return path35.join(workingDir, ".swarm", "cache", "test-history.jsonl");
|
|
47229
47436
|
}
|
|
47230
47437
|
function sanitizeErrorMessage(errorMessage) {
|
|
47231
47438
|
if (errorMessage === undefined) {
|
|
@@ -47317,6 +47524,7 @@ function appendTestRun(record3, workingDir) {
|
|
|
47317
47524
|
};
|
|
47318
47525
|
const historyPath = getHistoryPath(workingDir);
|
|
47319
47526
|
const historyDir = path35.dirname(historyPath);
|
|
47527
|
+
_internals23.validateProjectRoot(workingDir);
|
|
47320
47528
|
if (!fs18.existsSync(historyDir)) {
|
|
47321
47529
|
fs18.mkdirSync(historyDir, { recursive: true });
|
|
47322
47530
|
}
|
|
@@ -47388,13 +47596,17 @@ function getAllHistory(workingDir) {
|
|
|
47388
47596
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
47389
47597
|
return records;
|
|
47390
47598
|
}
|
|
47391
|
-
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, DANGEROUS_PROPERTY_NAMES;
|
|
47599
|
+
var MAX_HISTORY_PER_TEST = 20, MAX_ERROR_LENGTH = 500, MAX_STACK_LENGTH = 200, MAX_CHANGED_FILES = 50, DANGEROUS_PROPERTY_NAMES, _internals23;
|
|
47392
47600
|
var init_history_store = __esm(() => {
|
|
47601
|
+
init_manager2();
|
|
47393
47602
|
DANGEROUS_PROPERTY_NAMES = new Set([
|
|
47394
47603
|
"__proto__",
|
|
47395
47604
|
"constructor",
|
|
47396
47605
|
"prototype"
|
|
47397
47606
|
]);
|
|
47607
|
+
_internals23 = {
|
|
47608
|
+
validateProjectRoot
|
|
47609
|
+
};
|
|
47398
47610
|
});
|
|
47399
47611
|
|
|
47400
47612
|
// src/tools/resolve-working-directory.ts
|
|
@@ -47518,7 +47730,7 @@ function readPackageJsonRaw(dir) {
|
|
|
47518
47730
|
}
|
|
47519
47731
|
}
|
|
47520
47732
|
function readPackageJson(dir) {
|
|
47521
|
-
return
|
|
47733
|
+
return _internals24.readPackageJsonRaw(dir);
|
|
47522
47734
|
}
|
|
47523
47735
|
function readPackageJsonTestScript(dir) {
|
|
47524
47736
|
return readPackageJson(dir)?.scripts?.test ?? null;
|
|
@@ -47688,7 +47900,7 @@ function buildTypescriptBackend() {
|
|
|
47688
47900
|
selectEntryPoints: selectEntryPoints3
|
|
47689
47901
|
};
|
|
47690
47902
|
}
|
|
47691
|
-
var PROFILE_ID3 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2,
|
|
47903
|
+
var PROFILE_ID3 = "typescript", IMPORT_REGEX_ES2, IMPORT_REGEX_BARE, IMPORT_REGEX_REQUIRE2, IMPORT_REGEX_DYNAMIC, IMPORT_REGEX_REEXPORT2, _internals24;
|
|
47692
47904
|
var init_typescript = __esm(() => {
|
|
47693
47905
|
init_default_backend();
|
|
47694
47906
|
init_profiles();
|
|
@@ -47697,7 +47909,7 @@ var init_typescript = __esm(() => {
|
|
|
47697
47909
|
IMPORT_REGEX_REQUIRE2 = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
47698
47910
|
IMPORT_REGEX_DYNAMIC = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
|
|
47699
47911
|
IMPORT_REGEX_REEXPORT2 = /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"]([^'"]+)['"]/g;
|
|
47700
|
-
|
|
47912
|
+
_internals24 = {
|
|
47701
47913
|
readPackageJsonRaw,
|
|
47702
47914
|
readPackageJsonTestScript,
|
|
47703
47915
|
frameworkFromScriptsTest
|
|
@@ -47728,7 +47940,7 @@ __export(exports_dispatch, {
|
|
|
47728
47940
|
pickedProfiles: () => pickedProfiles,
|
|
47729
47941
|
pickBackend: () => pickBackend,
|
|
47730
47942
|
clearDispatchCache: () => clearDispatchCache,
|
|
47731
|
-
_internals: () =>
|
|
47943
|
+
_internals: () => _internals25
|
|
47732
47944
|
});
|
|
47733
47945
|
import * as fs21 from "fs";
|
|
47734
47946
|
import * as path38 from "path";
|
|
@@ -47783,7 +47995,7 @@ function findManifestRoot(start) {
|
|
|
47783
47995
|
return start;
|
|
47784
47996
|
}
|
|
47785
47997
|
function evictIfNeeded() {
|
|
47786
|
-
if (cache.size <=
|
|
47998
|
+
if (cache.size <= _internals25.cacheCapacity)
|
|
47787
47999
|
return;
|
|
47788
48000
|
let oldestKey;
|
|
47789
48001
|
let oldestOrder = Infinity;
|
|
@@ -47814,7 +48026,7 @@ async function pickBackend(dir) {
|
|
|
47814
48026
|
evictIfNeeded();
|
|
47815
48027
|
return null;
|
|
47816
48028
|
}
|
|
47817
|
-
const profiles = await
|
|
48029
|
+
const profiles = await _internals25.detectProjectLanguages(root);
|
|
47818
48030
|
if (profiles.length === 0) {
|
|
47819
48031
|
cache.set(cacheKey, {
|
|
47820
48032
|
hash: hash3,
|
|
@@ -47846,12 +48058,12 @@ function clearDispatchCache() {
|
|
|
47846
48058
|
manifestRootCache.clear();
|
|
47847
48059
|
insertCounter = 0;
|
|
47848
48060
|
}
|
|
47849
|
-
var
|
|
48061
|
+
var _internals25, cache, insertCounter = 0, MANIFEST_FILES, _MANIFEST_SET, manifestRootCache;
|
|
47850
48062
|
var init_dispatch = __esm(() => {
|
|
47851
48063
|
init_backends();
|
|
47852
48064
|
init_detector();
|
|
47853
48065
|
init_registry_backend();
|
|
47854
|
-
|
|
48066
|
+
_internals25 = {
|
|
47855
48067
|
detectProjectLanguages,
|
|
47856
48068
|
cacheCapacity: 64
|
|
47857
48069
|
};
|
|
@@ -49049,11 +49261,11 @@ function normalizeHistoryTestFile(testFile, workingDir) {
|
|
|
49049
49261
|
const normalized = testFile.replace(/\\/g, "/");
|
|
49050
49262
|
if (!path39.isAbsolute(testFile))
|
|
49051
49263
|
return normalized;
|
|
49052
|
-
const
|
|
49053
|
-
if (
|
|
49264
|
+
const relative9 = path39.relative(workingDir, testFile);
|
|
49265
|
+
if (relative9.startsWith("..") || path39.isAbsolute(relative9)) {
|
|
49054
49266
|
return normalized;
|
|
49055
49267
|
}
|
|
49056
|
-
return
|
|
49268
|
+
return relative9.replace(/\\/g, "/");
|
|
49057
49269
|
}
|
|
49058
49270
|
function combineAggregateResult(current, next) {
|
|
49059
49271
|
if (current === "fail" || next === "fail")
|
|
@@ -49686,9 +49898,9 @@ function getVersionFileVersion(dir) {
|
|
|
49686
49898
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
49687
49899
|
const startTime = Date.now();
|
|
49688
49900
|
try {
|
|
49689
|
-
const packageVersion =
|
|
49690
|
-
const changelogVersion =
|
|
49691
|
-
const versionFileVersion =
|
|
49901
|
+
const packageVersion = _internals26.getPackageVersion(dir);
|
|
49902
|
+
const changelogVersion = _internals26.getChangelogVersion(dir);
|
|
49903
|
+
const versionFileVersion = _internals26.getVersionFileVersion(dir);
|
|
49692
49904
|
const versions3 = [];
|
|
49693
49905
|
if (packageVersion)
|
|
49694
49906
|
versions3.push(`package.json: ${packageVersion}`);
|
|
@@ -50038,7 +50250,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
50038
50250
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
50039
50251
|
let validatedDir;
|
|
50040
50252
|
try {
|
|
50041
|
-
validatedDir =
|
|
50253
|
+
validatedDir = _internals26.validateDirectoryPath(dir);
|
|
50042
50254
|
} catch (error93) {
|
|
50043
50255
|
return {
|
|
50044
50256
|
id: reportId,
|
|
@@ -50058,7 +50270,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
50058
50270
|
}
|
|
50059
50271
|
let validatedTimeout;
|
|
50060
50272
|
try {
|
|
50061
|
-
validatedTimeout =
|
|
50273
|
+
validatedTimeout = _internals26.validateTimeout(config3?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
50062
50274
|
} catch (error93) {
|
|
50063
50275
|
return {
|
|
50064
50276
|
id: reportId,
|
|
@@ -50099,12 +50311,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
50099
50311
|
});
|
|
50100
50312
|
const checks5 = [];
|
|
50101
50313
|
log("[Preflight] Running lint check...");
|
|
50102
|
-
const lintResult = await
|
|
50314
|
+
const lintResult = await _internals26.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
50103
50315
|
checks5.push(lintResult);
|
|
50104
50316
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
50105
50317
|
if (!cfg.skipTests) {
|
|
50106
50318
|
log("[Preflight] Running tests check...");
|
|
50107
|
-
const testsResult = await
|
|
50319
|
+
const testsResult = await _internals26.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
50108
50320
|
checks5.push(testsResult);
|
|
50109
50321
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
50110
50322
|
} else {
|
|
@@ -50116,7 +50328,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
50116
50328
|
}
|
|
50117
50329
|
if (!cfg.skipSecrets) {
|
|
50118
50330
|
log("[Preflight] Running secrets check...");
|
|
50119
|
-
const secretsResult = await
|
|
50331
|
+
const secretsResult = await _internals26.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
50120
50332
|
checks5.push(secretsResult);
|
|
50121
50333
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
50122
50334
|
} else {
|
|
@@ -50128,7 +50340,7 @@ async function runPreflight(dir, phase, config3) {
|
|
|
50128
50340
|
}
|
|
50129
50341
|
if (!cfg.skipEvidence) {
|
|
50130
50342
|
log("[Preflight] Running evidence check...");
|
|
50131
|
-
const evidenceResult = await
|
|
50343
|
+
const evidenceResult = await _internals26.runEvidenceCheck(validatedDir);
|
|
50132
50344
|
checks5.push(evidenceResult);
|
|
50133
50345
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
50134
50346
|
} else {
|
|
@@ -50139,12 +50351,12 @@ async function runPreflight(dir, phase, config3) {
|
|
|
50139
50351
|
});
|
|
50140
50352
|
}
|
|
50141
50353
|
log("[Preflight] Running requirement coverage check...");
|
|
50142
|
-
const reqCoverageResult = await
|
|
50354
|
+
const reqCoverageResult = await _internals26.runRequirementCoverageCheck(validatedDir, phase);
|
|
50143
50355
|
checks5.push(reqCoverageResult);
|
|
50144
50356
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
50145
50357
|
if (!cfg.skipVersion) {
|
|
50146
50358
|
log("[Preflight] Running version check...");
|
|
50147
|
-
const versionResult = await
|
|
50359
|
+
const versionResult = await _internals26.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
50148
50360
|
checks5.push(versionResult);
|
|
50149
50361
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
50150
50362
|
} else {
|
|
@@ -50207,10 +50419,10 @@ function formatPreflightMarkdown(report) {
|
|
|
50207
50419
|
async function handlePreflightCommand(directory, _args) {
|
|
50208
50420
|
const plan = await loadPlan(directory);
|
|
50209
50421
|
const phase = plan?.current_phase ?? 1;
|
|
50210
|
-
const report = await
|
|
50211
|
-
return
|
|
50422
|
+
const report = await _internals26.runPreflight(directory, phase);
|
|
50423
|
+
return _internals26.formatPreflightMarkdown(report);
|
|
50212
50424
|
}
|
|
50213
|
-
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG,
|
|
50425
|
+
var MIN_CHECK_TIMEOUT_MS = 5000, MAX_CHECK_TIMEOUT_MS = 300000, DEFAULT_CONFIG, _internals26;
|
|
50214
50426
|
var init_preflight_service = __esm(() => {
|
|
50215
50427
|
init_manager2();
|
|
50216
50428
|
init_manager();
|
|
@@ -50227,7 +50439,7 @@ var init_preflight_service = __esm(() => {
|
|
|
50227
50439
|
testScope: "convention",
|
|
50228
50440
|
linter: "biome"
|
|
50229
50441
|
};
|
|
50230
|
-
|
|
50442
|
+
_internals26 = {
|
|
50231
50443
|
runPreflight,
|
|
50232
50444
|
formatPreflightMarkdown,
|
|
50233
50445
|
handlePreflightCommand,
|
|
@@ -51849,7 +52061,7 @@ async function getStatusData(directory, agents) {
|
|
|
51849
52061
|
}
|
|
51850
52062
|
function enrichWithLeanTurbo(status, directory) {
|
|
51851
52063
|
const turboMode = hasActiveTurboMode();
|
|
51852
|
-
const leanActive =
|
|
52064
|
+
const leanActive = _internals27.hasActiveLeanTurbo();
|
|
51853
52065
|
let turboStrategy = "off";
|
|
51854
52066
|
if (leanActive) {
|
|
51855
52067
|
turboStrategy = "lean";
|
|
@@ -51868,7 +52080,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
51868
52080
|
}
|
|
51869
52081
|
}
|
|
51870
52082
|
if (leanSessionID) {
|
|
51871
|
-
const runState =
|
|
52083
|
+
const runState = _internals27.loadLeanTurboRunState(directory, leanSessionID);
|
|
51872
52084
|
if (runState) {
|
|
51873
52085
|
status.leanTurboPhase = runState.phase;
|
|
51874
52086
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -51900,7 +52112,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
51900
52112
|
}
|
|
51901
52113
|
}
|
|
51902
52114
|
}
|
|
51903
|
-
status.fullAutoActive =
|
|
52115
|
+
status.fullAutoActive = _internals27.hasActiveFullAuto();
|
|
51904
52116
|
return status;
|
|
51905
52117
|
}
|
|
51906
52118
|
function formatStatusMarkdown(status) {
|
|
@@ -51982,7 +52194,7 @@ async function handleStatusCommand(directory, agents) {
|
|
|
51982
52194
|
}
|
|
51983
52195
|
return formatStatusMarkdown(statusData);
|
|
51984
52196
|
}
|
|
51985
|
-
var
|
|
52197
|
+
var _internals27;
|
|
51986
52198
|
var init_status_service = __esm(() => {
|
|
51987
52199
|
init_extractors();
|
|
51988
52200
|
init_utils2();
|
|
@@ -51991,7 +52203,7 @@ var init_status_service = __esm(() => {
|
|
|
51991
52203
|
init_state3();
|
|
51992
52204
|
init_compaction_service();
|
|
51993
52205
|
init_context_budget_service();
|
|
51994
|
-
|
|
52206
|
+
_internals27 = {
|
|
51995
52207
|
loadLeanTurboRunState,
|
|
51996
52208
|
hasActiveLeanTurbo,
|
|
51997
52209
|
hasActiveFullAuto
|
|
@@ -52082,7 +52294,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
52082
52294
|
if (arg0 === "on") {
|
|
52083
52295
|
let strategy = "standard";
|
|
52084
52296
|
try {
|
|
52085
|
-
const { config: config3 } =
|
|
52297
|
+
const { config: config3 } = _internals28.loadPluginConfigWithMeta(directory);
|
|
52086
52298
|
if (config3.turbo?.strategy === "lean") {
|
|
52087
52299
|
strategy = "lean";
|
|
52088
52300
|
}
|
|
@@ -52137,7 +52349,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
52137
52349
|
let maxParallelCoders = 4;
|
|
52138
52350
|
let conflictPolicy = "serialize";
|
|
52139
52351
|
try {
|
|
52140
|
-
const { config: config3 } =
|
|
52352
|
+
const { config: config3 } = _internals28.loadPluginConfigWithMeta(directory);
|
|
52141
52353
|
const leanConfig = config3.turbo?.lean;
|
|
52142
52354
|
if (leanConfig) {
|
|
52143
52355
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -52207,13 +52419,13 @@ function buildStatusMessage(session, directory, sessionID) {
|
|
|
52207
52419
|
].join(`
|
|
52208
52420
|
`);
|
|
52209
52421
|
}
|
|
52210
|
-
var
|
|
52422
|
+
var _internals28;
|
|
52211
52423
|
var init_turbo = __esm(() => {
|
|
52212
52424
|
init_config();
|
|
52213
52425
|
init_state();
|
|
52214
52426
|
init_state3();
|
|
52215
52427
|
init_logger();
|
|
52216
|
-
|
|
52428
|
+
_internals28 = {
|
|
52217
52429
|
loadPluginConfigWithMeta
|
|
52218
52430
|
};
|
|
52219
52431
|
});
|
|
@@ -52306,7 +52518,7 @@ function formatCommandNotFound(tokens) {
|
|
|
52306
52518
|
const attemptedCommand = tokens[0] || "";
|
|
52307
52519
|
const MAX_DISPLAY = 100;
|
|
52308
52520
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
52309
|
-
const similar =
|
|
52521
|
+
const similar = _internals29.findSimilarCommands(attemptedCommand);
|
|
52310
52522
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
52311
52523
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
52312
52524
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -52755,7 +52967,7 @@ async function buildSwarmCommandPrompt(args) {
|
|
|
52755
52967
|
activeAgentName,
|
|
52756
52968
|
registeredAgents
|
|
52757
52969
|
} = args;
|
|
52758
|
-
const resolved =
|
|
52970
|
+
const resolved = _internals29.resolveCommand(tokens);
|
|
52759
52971
|
if (!resolved) {
|
|
52760
52972
|
if (tokens.length === 0) {
|
|
52761
52973
|
return buildHelpText();
|
|
@@ -52906,7 +53118,7 @@ function findSimilarCommands(query) {
|
|
|
52906
53118
|
}
|
|
52907
53119
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
52908
53120
|
const cmdLower = cmd.toLowerCase();
|
|
52909
|
-
const fullScore =
|
|
53121
|
+
const fullScore = _internals29.levenshteinDistance(q, cmdLower);
|
|
52910
53122
|
let tokenScore = Infinity;
|
|
52911
53123
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
52912
53124
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -52919,7 +53131,7 @@ function findSimilarCommands(query) {
|
|
|
52919
53131
|
for (const ct of cmdTokens) {
|
|
52920
53132
|
if (ct.length === 0)
|
|
52921
53133
|
continue;
|
|
52922
|
-
const dist =
|
|
53134
|
+
const dist = _internals29.levenshteinDistance(qt, ct);
|
|
52923
53135
|
if (dist < minDist)
|
|
52924
53136
|
minDist = dist;
|
|
52925
53137
|
}
|
|
@@ -52929,7 +53141,7 @@ function findSimilarCommands(query) {
|
|
|
52929
53141
|
}
|
|
52930
53142
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
52931
53143
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
52932
|
-
const dashScore =
|
|
53144
|
+
const dashScore = _internals29.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
52933
53145
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
52934
53146
|
return { cmd, score };
|
|
52935
53147
|
});
|
|
@@ -52961,11 +53173,11 @@ async function handleHelpCommand(ctx) {
|
|
|
52961
53173
|
return buildHelpText2();
|
|
52962
53174
|
}
|
|
52963
53175
|
const tokens = targetCommand.split(/\s+/);
|
|
52964
|
-
const resolved =
|
|
53176
|
+
const resolved = _internals29.resolveCommand(tokens);
|
|
52965
53177
|
if (resolved) {
|
|
52966
|
-
return
|
|
53178
|
+
return _internals29.buildDetailedHelp(resolved.key, resolved.entry);
|
|
52967
53179
|
}
|
|
52968
|
-
const similar =
|
|
53180
|
+
const similar = _internals29.findSimilarCommands(targetCommand);
|
|
52969
53181
|
const { buildHelpText: fullHelp } = await Promise.resolve().then(() => (init_commands(), exports_commands));
|
|
52970
53182
|
if (similar.length > 0) {
|
|
52971
53183
|
return `Command '/swarm ${targetCommand}' not found.
|
|
@@ -53059,7 +53271,7 @@ function resolveCommand(tokens) {
|
|
|
53059
53271
|
}
|
|
53060
53272
|
return null;
|
|
53061
53273
|
}
|
|
53062
|
-
var COMMAND_REGISTRY, VALID_COMMANDS,
|
|
53274
|
+
var COMMAND_REGISTRY, VALID_COMMANDS, _internals29, validation;
|
|
53063
53275
|
var init_registry = __esm(() => {
|
|
53064
53276
|
init_acknowledge_spec_drift();
|
|
53065
53277
|
init_agents();
|
|
@@ -53129,7 +53341,7 @@ var init_registry = __esm(() => {
|
|
|
53129
53341
|
clashesWithNativeCcCommand: "/agents"
|
|
53130
53342
|
},
|
|
53131
53343
|
help: {
|
|
53132
|
-
handler: (ctx) =>
|
|
53344
|
+
handler: (ctx) => _internals29.handleHelpCommand(ctx),
|
|
53133
53345
|
description: "Show help for swarm commands",
|
|
53134
53346
|
category: "core",
|
|
53135
53347
|
args: "[command]",
|
|
@@ -53501,7 +53713,7 @@ Subcommands:
|
|
|
53501
53713
|
}
|
|
53502
53714
|
};
|
|
53503
53715
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
53504
|
-
|
|
53716
|
+
_internals29 = {
|
|
53505
53717
|
handleHelpCommand,
|
|
53506
53718
|
validateAliases,
|
|
53507
53719
|
resolveCommand,
|
|
@@ -53509,7 +53721,7 @@ Subcommands:
|
|
|
53509
53721
|
findSimilarCommands,
|
|
53510
53722
|
buildDetailedHelp
|
|
53511
53723
|
};
|
|
53512
|
-
validation =
|
|
53724
|
+
validation = _internals29.validateAliases();
|
|
53513
53725
|
if (!validation.valid) {
|
|
53514
53726
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
53515
53727
|
${validation.errors.join(`
|