opencode-swarm 7.27.1 → 7.27.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 +36 -7
- package/dist/cli/index.js +576 -141
- package/dist/evidence/manager.d.ts +8 -0
- package/dist/index.js +11916 -905
- package/dist/plan/checkpoint.d.ts +0 -10
- package/dist/services/config-doctor.d.ts +33 -0
- package/dist/test-impact/analyzer.d.ts +2 -0
- package/dist/test-impact/failure-classifier.d.ts +1 -1
- package/dist/test-impact/history-store.d.ts +8 -0
- package/dist/tools/pre-check-batch.d.ts +1 -1
- package/dist/tools/resolve-working-directory.d.ts +8 -1
- package/dist/tools/test-runner.d.ts +10 -0
- package/dist/tools/update-task-status.d.ts +3 -2
- package/package.json +2 -2
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checkpoint artifact writer.
|
|
3
|
-
* Writes SWARM_PLAN.md and SWARM_PLAN.json inside .swarm/.
|
|
4
|
-
* Export-only — not a live runtime source of truth.
|
|
5
|
-
* Called on: save_plan, phase completion, /swarm close.
|
|
6
|
-
* NOT called on every task update.
|
|
7
|
-
*/
|
|
8
|
-
import * as fs from 'node:fs';
|
|
9
1
|
import { type Plan } from '../config/plan-schema';
|
|
10
2
|
/**
|
|
11
3
|
* Write SWARM_PLAN.json and SWARM_PLAN.md inside the .swarm/ directory under the project root.
|
|
@@ -34,6 +26,4 @@ export declare function importCheckpoint(directory: string, source?: string): Pr
|
|
|
34
26
|
export declare const _internals: {
|
|
35
27
|
writeCheckpoint: typeof writeCheckpoint;
|
|
36
28
|
importCheckpoint: typeof importCheckpoint;
|
|
37
|
-
existsSyncForCleanup: typeof fs.existsSync;
|
|
38
|
-
unlinkSyncForCleanup: typeof fs.unlinkSync;
|
|
39
29
|
};
|
|
@@ -123,3 +123,36 @@ export declare function runConfigDoctorWithFixes(directory: string, config: Plug
|
|
|
123
123
|
updatedConfigPath: string | null;
|
|
124
124
|
artifactPath: string | null;
|
|
125
125
|
}>;
|
|
126
|
+
/**
|
|
127
|
+
* A stray .swarm directory found below the project root.
|
|
128
|
+
* These are typically created by bugs in prior versions (see Issue #922).
|
|
129
|
+
*/
|
|
130
|
+
export interface StraySwarmFinding {
|
|
131
|
+
/** Relative path from project root (forward-slash normalized) */
|
|
132
|
+
path: string;
|
|
133
|
+
/** Absolute path on disk */
|
|
134
|
+
absolutePath: string;
|
|
135
|
+
/** Contents summary (up to 20 entries) */
|
|
136
|
+
contents: string[];
|
|
137
|
+
/** Total number of entries in the directory */
|
|
138
|
+
totalEntries: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Detect stray .swarm directories in project subdirectories.
|
|
142
|
+
* These are .swarm/ directories that exist below the project root,
|
|
143
|
+
* typically created by bugs in prior versions (see Issue #922).
|
|
144
|
+
*
|
|
145
|
+
* Skips: node_modules/, .git/, dist/, .cache/, .next/, coverage/
|
|
146
|
+
* and common tool/build output directories.
|
|
147
|
+
*/
|
|
148
|
+
export declare function detectStraySwarmDirs(projectRoot: string): StraySwarmFinding[];
|
|
149
|
+
/**
|
|
150
|
+
* Remove a stray .swarm directory.
|
|
151
|
+
* NEVER removes the root .swarm/ directory.
|
|
152
|
+
*
|
|
153
|
+
* @returns `{ success, message }` indicating outcome
|
|
154
|
+
*/
|
|
155
|
+
export declare function removeStraySwarmDir(projectRoot: string, strayPath: string): {
|
|
156
|
+
success: boolean;
|
|
157
|
+
message: string;
|
|
158
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateProjectRoot } from '../evidence/manager.js';
|
|
1
2
|
export interface TestImpactResult {
|
|
2
3
|
impactedTests: string[];
|
|
3
4
|
unrelatedTests: string[];
|
|
@@ -18,6 +19,7 @@ declare function findTestFilesSync(cwd: string): string[];
|
|
|
18
19
|
declare function extractImports(content: string): string[];
|
|
19
20
|
declare function buildImpactMapInternal(cwd: string): Promise<Record<string, string[]>>;
|
|
20
21
|
export declare const _internals: {
|
|
22
|
+
validateProjectRoot: typeof validateProjectRoot;
|
|
21
23
|
normalizePath: typeof normalizePath;
|
|
22
24
|
isCacheStale: typeof isCacheStale;
|
|
23
25
|
resolveRelativeImport: typeof resolveRelativeImport;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TestRunRecord } from './history-store.js';
|
|
2
|
-
export type FailureClassification = 'new_regression' | 'pre_existing' | 'flaky' | '
|
|
2
|
+
export type FailureClassification = 'new_regression' | 'pre_existing' | 'flaky' | 'unknown';
|
|
3
3
|
export interface ClassifiedFailure {
|
|
4
4
|
testFile: string;
|
|
5
5
|
testName: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateProjectRoot } from '../evidence/manager.js';
|
|
1
2
|
export type TestRunResult = 'pass' | 'fail' | 'skip';
|
|
2
3
|
export interface TestRunRecord {
|
|
3
4
|
timestamp: string;
|
|
@@ -10,6 +11,13 @@ export interface TestRunRecord {
|
|
|
10
11
|
stackPrefix?: string;
|
|
11
12
|
changedFiles: string[];
|
|
12
13
|
}
|
|
14
|
+
export declare function batchAppendTestRuns(records: TestRunRecord[], workingDir?: string): void;
|
|
13
15
|
export declare function appendTestRun(record: TestRunRecord, workingDir?: string): void;
|
|
14
16
|
export declare function getTestHistory(testFile: string, workingDir?: string): TestRunRecord[];
|
|
15
17
|
export declare function getAllHistory(workingDir?: string): TestRunRecord[];
|
|
18
|
+
/**
|
|
19
|
+
* DI seam for testability. Contains functions that tests may override.
|
|
20
|
+
*/
|
|
21
|
+
export declare const _internals: {
|
|
22
|
+
validateProjectRoot: typeof validateProjectRoot;
|
|
23
|
+
};
|
|
@@ -79,7 +79,7 @@ export declare function classifySastFindings(findings: SastScanFinding[], change
|
|
|
79
79
|
/**
|
|
80
80
|
* Run all 4 pre-check tools in parallel with concurrency limit
|
|
81
81
|
* @param input - The pre-check batch input
|
|
82
|
-
* @param workspaceDir - Optional workspace directory for traversal validation (
|
|
82
|
+
* @param workspaceDir - Optional workspace directory for traversal validation (injected project root from createSwarmTool, or input.directory)
|
|
83
83
|
*/
|
|
84
84
|
export declare function runPreCheckBatch(input: PreCheckBatchInput, workspaceDir?: string, contextDir?: string): Promise<PreCheckBatchResult>;
|
|
85
85
|
/**
|
|
@@ -19,7 +19,14 @@ export interface ResolveError {
|
|
|
19
19
|
message: string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Resolves and validates a working directory against a fallback (injected project root).
|
|
23
|
+
*
|
|
24
|
+
* NOTE: This function intentionally does NOT use realpathSync for the resolved path
|
|
25
|
+
* to avoid Windows 8.3 short filename issues. Symlink-based subdirectory bypasses
|
|
26
|
+
* through this coarse filter are caught by the write-time validateProjectRoot guard
|
|
27
|
+
* in evidence/manager.ts, which DOES use realpathSync. These two functions form a
|
|
28
|
+
* defense-in-depth pair: resolveWorkingDirectory is the fast entry filter,
|
|
29
|
+
* validateProjectRoot is the authoritative canonical check at write time.
|
|
23
30
|
*
|
|
24
31
|
* Priority: explicit working_directory param > injected directory (from createSwarmTool).
|
|
25
32
|
*
|
|
@@ -32,6 +32,14 @@ export interface TestTotals {
|
|
|
32
32
|
skipped: number;
|
|
33
33
|
total: number;
|
|
34
34
|
}
|
|
35
|
+
export interface ParsedTestCaseResult {
|
|
36
|
+
testFile: string;
|
|
37
|
+
testName: string;
|
|
38
|
+
result: 'pass' | 'fail' | 'skip';
|
|
39
|
+
durationMs: number;
|
|
40
|
+
errorMessage?: string;
|
|
41
|
+
stackPrefix?: string;
|
|
42
|
+
}
|
|
35
43
|
export interface TestSuccessResult {
|
|
36
44
|
success: true;
|
|
37
45
|
framework: TestFramework;
|
|
@@ -42,6 +50,7 @@ export interface TestSuccessResult {
|
|
|
42
50
|
totals: TestTotals;
|
|
43
51
|
coveragePercent?: number;
|
|
44
52
|
rawOutput?: string;
|
|
53
|
+
testCases?: ParsedTestCaseResult[];
|
|
45
54
|
message?: string;
|
|
46
55
|
outcome?: RegressionOutcome;
|
|
47
56
|
}
|
|
@@ -56,6 +65,7 @@ export interface TestErrorResult {
|
|
|
56
65
|
coveragePercent?: number;
|
|
57
66
|
error: string;
|
|
58
67
|
rawOutput?: string;
|
|
68
|
+
testCases?: ParsedTestCaseResult[];
|
|
59
69
|
message?: string;
|
|
60
70
|
outcome?: RegressionOutcome;
|
|
61
71
|
attempted_scope?: 'graph';
|
|
@@ -53,7 +53,7 @@ export interface ReviewerGateResult {
|
|
|
53
53
|
* @param sessionID - Optional session ID to scope Lean Turbo bypass to the current tool-execution context
|
|
54
54
|
* @returns ReviewerGateResult indicating whether the gate is blocked
|
|
55
55
|
*/
|
|
56
|
-
export declare function checkReviewerGate(taskId: string, workingDirectory?: string, stageBParallelEnabled?: boolean, sessionID?: string): ReviewerGateResult;
|
|
56
|
+
export declare function checkReviewerGate(taskId: string, workingDirectory?: string, stageBParallelEnabled?: boolean, sessionID?: string, fallbackDir?: string): ReviewerGateResult;
|
|
57
57
|
/**
|
|
58
58
|
* Wrapper around checkReviewerGate that appends a diff-scope advisory warning.
|
|
59
59
|
* Keeps checkReviewerGate synchronous for backward compatibility.
|
|
@@ -61,9 +61,10 @@ export declare function checkReviewerGate(taskId: string, workingDirectory?: str
|
|
|
61
61
|
* @param taskId - The task ID to check gate state for
|
|
62
62
|
* @param workingDirectory - Optional working directory for plan.json fallback
|
|
63
63
|
* @param sessionID - Optional session ID to scope Lean Turbo bypass to the current tool-execution context
|
|
64
|
+
* @param fallbackDir - Optional fallback directory for resolveWorkingDirectory when workingDirectory is absent
|
|
64
65
|
* @returns ReviewerGateResult with optional scope warning appended to reason
|
|
65
66
|
*/
|
|
66
|
-
export declare function checkReviewerGateWithScope(taskId: string, workingDirectory?: string, sessionID?: string): Promise<ReviewerGateResult>;
|
|
67
|
+
export declare function checkReviewerGateWithScope(taskId: string, workingDirectory?: string, sessionID?: string, fallbackDir?: string): Promise<ReviewerGateResult>;
|
|
67
68
|
/**
|
|
68
69
|
* Recovery mechanism: reconcile task state with delegation history.
|
|
69
70
|
* When task-scoped reviewer/test_engineer delegations occurred but the state
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.27.
|
|
3
|
+
"version": "7.27.2",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"clean": "bun -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
41
|
-
"build": "bun run clean && bun run scripts/copy-grammars.ts && bun build src/index.ts --outdir dist --target node --format esm
|
|
41
|
+
"build": "bun run clean && bun run scripts/copy-grammars.ts && bun build src/index.ts --outdir dist --target node --format esm && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external bash-parser && bun run scripts/copy-grammars.ts --to-dist && tsc --emitDeclarationOnly",
|
|
42
42
|
"typecheck": "tsc --noEmit",
|
|
43
43
|
"test": "bun test",
|
|
44
44
|
"lint": "biome lint .",
|