opencode-swarm 7.56.0 → 7.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +326 -247
- package/dist/index.js +1791 -1454
- package/dist/lang/backends/php.d.ts +29 -0
- package/dist/lang/index.d.ts +1 -1
- package/dist/lang/runtime.d.ts +9 -1
- package/dist/sast/semgrep.d.ts +19 -0
- package/dist/tools/repo-graph/builder.d.ts +1 -8
- package/dist/tools/test-runner.d.ts +16 -0
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP backend.
|
|
3
|
+
*
|
|
4
|
+
* Wires the previously-unused Laravel framework detection (DD-C009) into the
|
|
5
|
+
* dispatch layer. Overrides `selectFramework` so a Laravel project surfaces
|
|
6
|
+
* `PROJECT_FRAMEWORK = laravel` in the architect prompt (consumed by
|
|
7
|
+
* `src/agents/project-context.ts`), and exposes the command overlay so the
|
|
8
|
+
* project-context builder can prefer `php artisan test` over the generic
|
|
9
|
+
* PHPUnit/Pest default for Laravel apps.
|
|
10
|
+
*
|
|
11
|
+
* Invariants identical to the other backends — see `go.ts` / `python.ts` for
|
|
12
|
+
* the rationale. `detectLaravelProject` / `getLaravelCommandOverlay` are
|
|
13
|
+
* filesystem-only (no subprocess), so they are safe on the session-init path.
|
|
14
|
+
*/
|
|
15
|
+
import type { FrameworkSelection, LanguageBackend } from '../backend';
|
|
16
|
+
/**
|
|
17
|
+
* Detect Laravel via the multi-signal heuristic (artisan + composer.json
|
|
18
|
+
* require + config/app.php; ≥2 of 3). Returns null for generic Composer PHP
|
|
19
|
+
* projects so the architect's PROJECT_FRAMEWORK stays unresolved.
|
|
20
|
+
*/
|
|
21
|
+
declare function selectFramework(dir: string): Promise<FrameworkSelection | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Build the PHP backend from the registered profile.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildPhpBackend(): LanguageBackend;
|
|
26
|
+
export declare const _internals: {
|
|
27
|
+
selectFramework: typeof selectFramework;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
package/dist/lang/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { _internals as detectorInternals, detectProjectLanguages, getProfileForF
|
|
|
2
2
|
export * from './profiles';
|
|
3
3
|
export type { LanguageDefinition } from './registry';
|
|
4
4
|
export { _internals as registryInternals, getLanguageForExtension, getParserForFile, isSupportedFile, languageDefinitions, listSupportedLanguages, } from './registry';
|
|
5
|
-
export
|
|
5
|
+
export { _internals as runtimeInternals, clearParserCache, getInitializedLanguages, getSupportedLanguages, isGrammarAvailable, loadGrammar, type Parser, parserCache, } from './runtime';
|
package/dist/lang/runtime.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { Parser as ParserType } from 'web-tree-sitter';
|
|
2
2
|
export type Parser = ParserType;
|
|
3
3
|
/**
|
|
4
|
-
* Parser cache to avoid reloading grammars multiple times per session
|
|
4
|
+
* Parser cache to avoid reloading grammars multiple times per session.
|
|
5
|
+
*
|
|
6
|
+
* Callers share a single `Parser` instance per language. This is safe in the
|
|
7
|
+
* single-threaded JS runtime: the only mutation of a cached parser is the
|
|
8
|
+
* one-time `setLanguage` during load (serialized by `inflightLoads` below),
|
|
9
|
+
* and `Parser.parse()` plus the subsequent tree walk run synchronously to
|
|
10
|
+
* completion with no intervening `await`, so two callers cannot interleave on
|
|
11
|
+
* the same instance even under `Promise.all`. (Same single-thread reasoning
|
|
12
|
+
* that makes a separate-parser-per-call rewrite unnecessary here.)
|
|
5
13
|
*/
|
|
6
14
|
export declare const parserCache: Map<string, ParserType>;
|
|
7
15
|
/**
|
package/dist/sast/semgrep.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const _internals: {
|
|
|
40
40
|
runSemgrep: typeof runSemgrep;
|
|
41
41
|
getRulesDirectory: typeof getRulesDirectory;
|
|
42
42
|
hasBundledRules: typeof hasBundledRules;
|
|
43
|
+
executeWithTimeout: typeof executeWithTimeout;
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* Check if Semgrep CLI is available on the system
|
|
@@ -56,6 +57,23 @@ export declare function checkSemgrepAvailable(): Promise<boolean>;
|
|
|
56
57
|
* Reset the Semgrep availability cache (useful for testing)
|
|
57
58
|
*/
|
|
58
59
|
export declare function resetSemgrepCache(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Execute a command with timeout
|
|
62
|
+
* @param command - Command to execute
|
|
63
|
+
* @param args - Command arguments (safe array, no shell injection)
|
|
64
|
+
* @param options - Execution options including timeout
|
|
65
|
+
* @returns Promise resolving to command output
|
|
66
|
+
*/
|
|
67
|
+
declare function executeWithTimeout(command: string, args: string[], options: {
|
|
68
|
+
cwd?: string;
|
|
69
|
+
timeoutMs: number;
|
|
70
|
+
maxOutputBytes?: number;
|
|
71
|
+
}): Promise<{
|
|
72
|
+
stdout: string;
|
|
73
|
+
stderr: string;
|
|
74
|
+
exitCode: number;
|
|
75
|
+
truncated: boolean;
|
|
76
|
+
}>;
|
|
59
77
|
/**
|
|
60
78
|
* Run Semgrep on specified files
|
|
61
79
|
* @param options - Semgrep options
|
|
@@ -74,3 +92,4 @@ export declare function getRulesDirectory(projectRoot?: string): string;
|
|
|
74
92
|
* @returns true if rules directory exists
|
|
75
93
|
*/
|
|
76
94
|
export declare function hasBundledRules(projectRoot?: string): boolean;
|
|
95
|
+
export {};
|
|
@@ -70,14 +70,7 @@ interface ParsedImport {
|
|
|
70
70
|
/** The type of import */
|
|
71
71
|
importType: 'default' | 'named' | 'namespace' | 'require' | 'sideeffect';
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
* Parse imports from file content using the same rules as imports.ts.
|
|
75
|
-
* Handles ES module imports and CommonJS require() statements.
|
|
76
|
-
*
|
|
77
|
-
* @param content - File content to parse
|
|
78
|
-
* @returns Array of parsed imports with specifier and type
|
|
79
|
-
*/
|
|
80
|
-
declare function parseFileImports(content: string): ParsedImport[];
|
|
73
|
+
declare function parseFileImports(rawContent: string): ParsedImport[];
|
|
81
74
|
/**
|
|
82
75
|
* Result of scanning a single file for graph updates.
|
|
83
76
|
*/
|
|
@@ -73,6 +73,22 @@ export interface TestErrorResult {
|
|
|
73
73
|
attempted_scope?: 'graph';
|
|
74
74
|
}
|
|
75
75
|
export type TestResult = TestSuccessResult | TestErrorResult;
|
|
76
|
+
/**
|
|
77
|
+
* Phase 3 dispatch path: detect the test framework via the
|
|
78
|
+
* `LanguageBackend` registry from `src/lang/dispatch.ts`. Currently
|
|
79
|
+
* opt-in via `SWARM_LANG_BACKEND=dispatch`; default remains the legacy
|
|
80
|
+
* `detectTestFramework` switch below. A future Phase 3b will flip the
|
|
81
|
+
* default and the env var becomes `SWARM_LANG_BACKEND=legacy` for
|
|
82
|
+
* one-release rollback.
|
|
83
|
+
*
|
|
84
|
+
* Maps `TestFrameworkSelection.name` (which mirrors the names in each
|
|
85
|
+
* profile's `test.frameworks[*].name`) back to the legacy `TestFramework`
|
|
86
|
+
* union string this function exists to produce. Names not in the
|
|
87
|
+
* union (e.g. PHP's "Pest"/"PHPUnit") collapse to `'none'`, preserving
|
|
88
|
+
* pre-Phase-3 behavior for languages whose tests the legacy path
|
|
89
|
+
* couldn't detect either.
|
|
90
|
+
*/
|
|
91
|
+
export declare const DISPATCH_FRAMEWORK_MAP: Record<string, TestFramework>;
|
|
76
92
|
export declare function detectTestFrameworkViaDispatch(cwd: string): Promise<TestFramework>;
|
|
77
93
|
/**
|
|
78
94
|
* Build a test command via the LanguageBackend dispatch path. Reverse-maps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.56.
|
|
3
|
+
"version": "7.56.1",
|
|
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",
|