opencode-swarm 6.8.1 → 6.9.0
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 +58 -76
- package/dist/agents/architect.d.ts +7 -0
- package/dist/agents/coder.d.ts +2 -0
- package/dist/agents/critic.d.ts +2 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/docs.d.ts +2 -0
- package/dist/agents/explorer.d.ts +2 -0
- package/dist/{src/agents → agents}/reviewer.d.ts +1 -2
- package/dist/agents/sme.d.ts +2 -0
- package/dist/{src/agents/coder.d.ts → agents/test-engineer.d.ts} +1 -2
- package/dist/{src/background → background}/trigger.d.ts +16 -0
- package/dist/build/discovery.d.ts +36 -0
- package/dist/config/evidence-schema.d.ts +1080 -0
- package/dist/config/loader.d.ts +32 -0
- package/dist/{src/config → config}/schema.d.ts +78 -169
- package/dist/{src/evidence → evidence}/manager.d.ts +19 -1
- package/dist/{src/index.d.ts → index.d.ts} +10 -0
- package/dist/index.js +8006 -2149
- package/dist/lang/grammars/tree-sitter-bash.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-c-sharp.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-cpp.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-css.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-go.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-ini.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-java.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-javascript.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-php.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-powershell.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-python.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-regex.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-ruby.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-rust.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-tsx.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-typescript.wasm +0 -0
- package/dist/lang/grammars/tree-sitter.wasm +0 -0
- package/dist/lang/index.d.ts +2 -0
- package/dist/lang/registry.d.ts +24 -0
- package/dist/lang/runtime.d.ts +35 -0
- package/dist/quality/index.d.ts +1 -0
- package/dist/quality/metrics.d.ts +20 -0
- package/dist/sast/rules/c.d.ts +9 -0
- package/dist/sast/rules/csharp.d.ts +9 -0
- package/dist/sast/rules/go.d.ts +9 -0
- package/dist/sast/rules/index.d.ts +72 -0
- package/dist/sast/rules/java.d.ts +9 -0
- package/dist/sast/rules/javascript.d.ts +9 -0
- package/dist/sast/rules/php.d.ts +9 -0
- package/dist/sast/rules/python.d.ts +9 -0
- package/dist/sast/semgrep.d.ts +64 -0
- package/dist/sbom/cyclonedx.d.ts +101 -0
- package/dist/sbom/detectors/dart.d.ts +7 -0
- package/dist/sbom/detectors/dotnet.d.ts +7 -0
- package/dist/sbom/detectors/go.d.ts +7 -0
- package/dist/sbom/detectors/index.d.ts +53 -0
- package/dist/sbom/detectors/java.d.ts +7 -0
- package/dist/sbom/detectors/nodejs.d.ts +7 -0
- package/dist/sbom/detectors/python.d.ts +7 -0
- package/dist/sbom/detectors/rust.d.ts +7 -0
- package/dist/sbom/detectors/swift.d.ts +7 -0
- package/dist/services/config-doctor.test.d.ts +1 -0
- package/dist/{src/state.d.ts → state.d.ts} +0 -5
- package/dist/tools/build-check.d.ts +50 -0
- package/dist/{src/tools → tools}/gitingest.d.ts +1 -2
- package/dist/{src/tools → tools}/index.d.ts +6 -0
- package/dist/tools/placeholder-scan.d.ts +26 -0
- package/dist/tools/quality-budget.d.ts +24 -0
- package/dist/tools/sast-scan.d.ts +52 -0
- package/dist/tools/sbom-generate.d.ts +26 -0
- package/dist/tools/syntax-check.d.ts +35 -0
- package/dist/{src/tools/test-runner/constants.d.ts → tools/test-runner.d.ts} +4 -0
- package/dist/utils/index.d.ts +3 -0
- package/package.json +7 -2
- package/dist/src/agents/architect.d.ts +0 -8
- package/dist/src/agents/critic.d.ts +0 -3
- package/dist/src/agents/designer.d.ts +0 -3
- package/dist/src/agents/docs.d.ts +0 -3
- package/dist/src/agents/explorer.d.ts +0 -3
- package/dist/src/agents/model.d.ts +0 -2
- package/dist/src/agents/sme.d.ts +0 -3
- package/dist/src/agents/test-engineer.d.ts +0 -3
- package/dist/src/config/evidence-schema.d.ts +0 -447
- package/dist/src/config/loader.d.ts +0 -16
- package/dist/src/tools/test-runner/detect.d.ts +0 -2
- package/dist/src/tools/test-runner/discover.d.ts +0 -4
- package/dist/src/tools/test-runner/index.d.ts +0 -6
- package/dist/src/tools/test-runner/run.d.ts +0 -2
- package/dist/src/tools/test-runner/validate.d.ts +0 -2
- package/dist/src/utils/index.d.ts +0 -8
- /package/dist/{src/__tests__ → __tests__}/security-adversarial.test.d.ts +0 -0
- /package/dist/{src/agents → agents}/index.d.ts +0 -0
- /package/dist/{src/agents → agents}/test-engineer.adversarial.test.d.ts +0 -0
- /package/dist/{src/agents → agents}/test-engineer.security.test.d.ts +0 -0
- /package/dist/{src/background → background}/circuit-breaker.d.ts +0 -0
- /package/dist/{src/background → background}/event-bus.d.ts +0 -0
- /package/dist/{src/background → background}/evidence-summary-integration.d.ts +0 -0
- /package/dist/{src/background → background}/index.d.ts +0 -0
- /package/dist/{src/background → background}/manager.d.ts +0 -0
- /package/dist/{src/background → background}/plan-sync-worker.d.ts +0 -0
- /package/dist/{src/background → background}/queue.d.ts +0 -0
- /package/dist/{src/background → background}/status-artifact.d.ts +0 -0
- /package/dist/{src/background → background}/trigger.vulnerability.test.d.ts +0 -0
- /package/dist/{src/background → background}/worker.d.ts +0 -0
- /package/dist/{src/cli → cli}/index.d.ts +0 -0
- /package/dist/{src/commands → commands}/agents.d.ts +0 -0
- /package/dist/{src/commands → commands}/archive.d.ts +0 -0
- /package/dist/{src/commands → commands}/benchmark.d.ts +0 -0
- /package/dist/{src/commands → commands}/command-adapters.security.test.d.ts +0 -0
- /package/dist/{src/commands → commands}/commands.test.d.ts +0 -0
- /package/dist/{src/commands → commands}/config.d.ts +0 -0
- /package/dist/{src/commands → commands}/diagnose.d.ts +0 -0
- /package/dist/{src/commands → commands}/doctor.d.ts +0 -0
- /package/dist/{src/commands → commands}/evidence.d.ts +0 -0
- /package/dist/{src/commands → commands}/export.d.ts +0 -0
- /package/dist/{src/commands → commands}/history.d.ts +0 -0
- /package/dist/{src/commands → commands}/index.d.ts +0 -0
- /package/dist/{src/commands → commands}/plan.d.ts +0 -0
- /package/dist/{src/commands → commands}/preflight.d.ts +0 -0
- /package/dist/{src/commands → commands}/reset.d.ts +0 -0
- /package/dist/{src/commands → commands}/retrieve.d.ts +0 -0
- /package/dist/{src/commands → commands}/status.d.ts +0 -0
- /package/dist/{src/commands → commands}/sync-plan.d.ts +0 -0
- /package/dist/{src/config → config}/constants.d.ts +0 -0
- /package/dist/{src/config → config}/index.d.ts +0 -0
- /package/dist/{src/config → config}/plan-schema.d.ts +0 -0
- /package/dist/{src/evidence → evidence}/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/agent-activity.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/compaction-customizer.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/context-budget.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/context-scoring.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/delegation-gate.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/delegation-tracker.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/extractors.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/guardrails.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/index.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/phase-monitor.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/pipeline-tracker.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/system-enhancer.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/tool-summarizer.d.ts +0 -0
- /package/dist/{src/hooks → hooks}/utils.d.ts +0 -0
- /package/dist/{src/plan → plan}/index.d.ts +0 -0
- /package/dist/{src/plan → plan}/manager.d.ts +0 -0
- /package/dist/{src/services/config-doctor.security.test.d.ts → sast/semgrep.test.d.ts} +0 -0
- /package/dist/{src/services → services}/config-doctor.d.ts +0 -0
- /package/dist/{src/services/config-doctor.test.d.ts → services/config-doctor.security.test.d.ts} +0 -0
- /package/dist/{src/services → services}/decision-drift-analyzer.d.ts +0 -0
- /package/dist/{src/services → services}/diagnose-service.d.ts +0 -0
- /package/dist/{src/services → services}/evidence-service.d.ts +0 -0
- /package/dist/{src/services → services}/evidence-summary-service.d.ts +0 -0
- /package/dist/{src/services → services}/export-service.d.ts +0 -0
- /package/dist/{src/services → services}/history-service.d.ts +0 -0
- /package/dist/{src/services → services}/index.d.ts +0 -0
- /package/dist/{src/services → services}/plan-service.d.ts +0 -0
- /package/dist/{src/services → services}/preflight-integration.d.ts +0 -0
- /package/dist/{src/services → services}/preflight-service.d.ts +0 -0
- /package/dist/{src/services → services}/status-service.d.ts +0 -0
- /package/dist/{src/summaries → summaries}/index.d.ts +0 -0
- /package/dist/{src/summaries → summaries}/manager.d.ts +0 -0
- /package/dist/{src/summaries → summaries}/summarizer.d.ts +0 -0
- /package/dist/{src/tools → tools}/checkpoint.d.ts +0 -0
- /package/dist/{src/tools → tools}/complexity-hotspots.d.ts +0 -0
- /package/dist/{src/tools → tools}/diff.d.ts +0 -0
- /package/dist/{src/tools → tools}/domain-detector.d.ts +0 -0
- /package/dist/{src/tools → tools}/evidence-check.d.ts +0 -0
- /package/dist/{src/tools → tools}/file-extractor.d.ts +0 -0
- /package/dist/{src/tools → tools}/imports.d.ts +0 -0
- /package/dist/{src/tools → tools}/lint.d.ts +0 -0
- /package/dist/{src/tools → tools}/pkg-audit.d.ts +0 -0
- /package/dist/{src/tools → tools}/retrieve-summary.d.ts +0 -0
- /package/dist/{src/tools → tools}/schema-drift.d.ts +0 -0
- /package/dist/{src/tools → tools}/secretscan.d.ts +0 -0
- /package/dist/{src/tools → tools}/symbols.d.ts +0 -0
- /package/dist/{src/tools → tools}/test-runner.security-adversarial.test.d.ts +0 -0
- /package/dist/{src/tools → tools}/todo-extract.d.ts +0 -0
- /package/dist/{src/utils → utils}/errors.d.ts +0 -0
- /package/dist/{src/utils → utils}/logger.d.ts +0 -0
- /package/dist/{src/utils → utils}/merge.d.ts +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Parser } from './runtime';
|
|
2
|
+
export interface LanguageDefinition {
|
|
3
|
+
id: string;
|
|
4
|
+
extensions: string[];
|
|
5
|
+
commentNodes: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const languageDefinitions: LanguageDefinition[];
|
|
8
|
+
export declare function getLanguageForExtension(extension: string): LanguageDefinition | undefined;
|
|
9
|
+
export declare function listSupportedLanguages(): readonly LanguageDefinition[];
|
|
10
|
+
/**
|
|
11
|
+
* Get a parser for a specific file path
|
|
12
|
+
* Determines language from file extension, loads grammar, returns configured parser
|
|
13
|
+
*
|
|
14
|
+
* @param filePath - Absolute or relative path to the file
|
|
15
|
+
* @returns Parser instance or null if language not supported
|
|
16
|
+
*/
|
|
17
|
+
export declare function getParserForFile(filePath: string): Promise<Parser | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a file path has a supported language extension
|
|
20
|
+
*
|
|
21
|
+
* @param filePath - Path to check
|
|
22
|
+
* @returns true if extension is supported
|
|
23
|
+
*/
|
|
24
|
+
export declare function isSupportedFile(filePath: string): boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Parser as ParserType } from 'web-tree-sitter';
|
|
2
|
+
export type Parser = ParserType;
|
|
3
|
+
/**
|
|
4
|
+
* Parser cache to avoid reloading grammars multiple times per session
|
|
5
|
+
*/
|
|
6
|
+
export declare const parserCache: Map<string, ParserType>;
|
|
7
|
+
/**
|
|
8
|
+
* Initialize a parser for the given language
|
|
9
|
+
* Loads WASM from dist/lang/grammars/ (copied during build)
|
|
10
|
+
*
|
|
11
|
+
* @param languageId - Language identifier (e.g., 'javascript', 'python')
|
|
12
|
+
* @returns Configured Parser instance
|
|
13
|
+
* @throws Error if WASM file not found or failed to load
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadGrammar(languageId: string): Promise<ParserType>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a language grammar is available (WASM file exists)
|
|
18
|
+
* Does not load the grammar, just checks existence
|
|
19
|
+
*
|
|
20
|
+
* @param languageId - Language identifier
|
|
21
|
+
* @returns true if grammar is available
|
|
22
|
+
*/
|
|
23
|
+
export declare function isGrammarAvailable(languageId: string): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Clear the parser cache (useful for testing)
|
|
26
|
+
*/
|
|
27
|
+
export declare function clearParserCache(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get list of initialized languages
|
|
30
|
+
*/
|
|
31
|
+
export declare function getInitializedLanguages(): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Get list of supported language IDs
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSupportedLanguages(): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { computeQualityMetrics, type QualityMetrics, type QualityViolation, } from './metrics';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { QualityBudgetConfig } from '../config/schema';
|
|
2
|
+
export interface QualityMetrics {
|
|
3
|
+
complexity_delta: number;
|
|
4
|
+
public_api_delta: number;
|
|
5
|
+
duplication_ratio: number;
|
|
6
|
+
test_to_code_ratio: number;
|
|
7
|
+
files_analyzed: string[];
|
|
8
|
+
thresholds: QualityBudgetConfig;
|
|
9
|
+
violations: QualityViolation[];
|
|
10
|
+
}
|
|
11
|
+
export interface QualityViolation {
|
|
12
|
+
type: 'complexity' | 'api' | 'duplication' | 'test_ratio';
|
|
13
|
+
message: string;
|
|
14
|
+
severity: 'error' | 'warning';
|
|
15
|
+
files: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Compute quality metrics for changed files
|
|
19
|
+
*/
|
|
20
|
+
export declare function computeQualityMetrics(changedFiles: string[], thresholds: QualityBudgetConfig, workingDir: string): Promise<QualityMetrics>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAST Rule Engine - Main entry point
|
|
3
|
+
* Provides rule registration, loading, and execution for static security analysis
|
|
4
|
+
*/
|
|
5
|
+
export interface SastRule {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
9
|
+
languages: string[];
|
|
10
|
+
description: string;
|
|
11
|
+
remediation?: string;
|
|
12
|
+
query?: string;
|
|
13
|
+
pattern?: RegExp;
|
|
14
|
+
validate?: (match: SastMatch, context: SastContext) => boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface SastMatch {
|
|
17
|
+
text: string;
|
|
18
|
+
line: number;
|
|
19
|
+
column: number;
|
|
20
|
+
endLine?: number;
|
|
21
|
+
endColumn?: number;
|
|
22
|
+
captures?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
export interface SastContext {
|
|
25
|
+
filePath: string;
|
|
26
|
+
content: string;
|
|
27
|
+
language: string;
|
|
28
|
+
parser?: any;
|
|
29
|
+
tree?: any;
|
|
30
|
+
}
|
|
31
|
+
export interface SastFinding {
|
|
32
|
+
rule_id: string;
|
|
33
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
34
|
+
message: string;
|
|
35
|
+
location: {
|
|
36
|
+
file: string;
|
|
37
|
+
line: number;
|
|
38
|
+
column?: number;
|
|
39
|
+
};
|
|
40
|
+
remediation?: string;
|
|
41
|
+
excerpt?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get all registered rules
|
|
45
|
+
*/
|
|
46
|
+
export declare function getAllRules(): SastRule[];
|
|
47
|
+
/**
|
|
48
|
+
* Get rules for a specific language
|
|
49
|
+
*/
|
|
50
|
+
export declare function getRulesForLanguage(language: string): SastRule[];
|
|
51
|
+
/**
|
|
52
|
+
* Get rule by ID
|
|
53
|
+
*/
|
|
54
|
+
export declare function getRuleById(id: string): SastRule | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Execute rules synchronously (pattern matching only)
|
|
57
|
+
* This is the primary execution method for offline SAST
|
|
58
|
+
*/
|
|
59
|
+
export declare function executeRulesSync(filePath: string, content: string, language: string): SastFinding[];
|
|
60
|
+
/**
|
|
61
|
+
* Execute rules against a file (async version with tree-sitter support)
|
|
62
|
+
* Falls back to pattern matching if tree-sitter is unavailable
|
|
63
|
+
*/
|
|
64
|
+
export declare function executeRules(filePath: string, content: string, language: string): Promise<SastFinding[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Get statistics about rules
|
|
67
|
+
*/
|
|
68
|
+
export declare function getRuleStats(): {
|
|
69
|
+
total: number;
|
|
70
|
+
bySeverity: Record<string, number>;
|
|
71
|
+
byLanguage: Record<string, number>;
|
|
72
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semgrep Integration for Tier B SAST Enhancement
|
|
3
|
+
* Provides optional Semgrep detection and invocation for advanced static analysis
|
|
4
|
+
*/
|
|
5
|
+
import type { SastFinding } from './rules/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Semgrep CLI options
|
|
8
|
+
*/
|
|
9
|
+
export interface SemgrepOptions {
|
|
10
|
+
/** Files or directories to scan */
|
|
11
|
+
files: string[];
|
|
12
|
+
/** Directory containing Semgrep rules (default: .swarm/semgrep-rules/) */
|
|
13
|
+
rulesDir?: string;
|
|
14
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
/** Working directory for Semgrep execution */
|
|
17
|
+
cwd?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result from Semgrep execution
|
|
21
|
+
*/
|
|
22
|
+
export interface SemgrepResult {
|
|
23
|
+
/** Whether Semgrep is available on the system */
|
|
24
|
+
available: boolean;
|
|
25
|
+
/** Array of security findings from Semgrep */
|
|
26
|
+
findings: SastFinding[];
|
|
27
|
+
/** Error message if Semgrep failed */
|
|
28
|
+
error?: string;
|
|
29
|
+
/** Engine label for the findings */
|
|
30
|
+
engine: 'tier_a' | 'tier_a+tier_b';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if Semgrep CLI is available on the system
|
|
34
|
+
* Uses caching to avoid shelling out on every check
|
|
35
|
+
* @returns true if Semgrep is available, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSemgrepAvailable(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check if Semgrep is available (async version for consistency)
|
|
40
|
+
* @returns Promise resolving to availability status
|
|
41
|
+
*/
|
|
42
|
+
export declare function checkSemgrepAvailable(): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Reset the Semgrep availability cache (useful for testing)
|
|
45
|
+
*/
|
|
46
|
+
export declare function resetSemgrepCache(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Run Semgrep on specified files
|
|
49
|
+
* @param options - Semgrep options
|
|
50
|
+
* @returns Promise resolving to SemgrepResult
|
|
51
|
+
*/
|
|
52
|
+
export declare function runSemgrep(options: SemgrepOptions): Promise<SemgrepResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Get the default rules directory path
|
|
55
|
+
* @param projectRoot - Optional project root directory
|
|
56
|
+
* @returns Absolute path to rules directory
|
|
57
|
+
*/
|
|
58
|
+
export declare function getRulesDirectory(projectRoot?: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Check if bundled rules directory exists
|
|
61
|
+
* @param projectRoot - Optional project root directory
|
|
62
|
+
* @returns true if rules directory exists
|
|
63
|
+
*/
|
|
64
|
+
export declare function hasBundledRules(projectRoot?: string): boolean;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CycloneDX SBOM Emitter
|
|
3
|
+
*
|
|
4
|
+
* Generates CycloneDX BOM format (v1.5 spec)
|
|
5
|
+
*/
|
|
6
|
+
import type { SbomComponent } from './detectors/index.js';
|
|
7
|
+
import { type Ecosystem } from './detectors/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* CycloneDX Component
|
|
10
|
+
* Corresponds to a software dependency
|
|
11
|
+
*/
|
|
12
|
+
export interface CycloneDXComponent {
|
|
13
|
+
/** Component type */
|
|
14
|
+
type: 'library' | 'framework' | 'application';
|
|
15
|
+
/** Package name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Package version */
|
|
18
|
+
version: string;
|
|
19
|
+
/** Package URL (PURL) */
|
|
20
|
+
purl?: string;
|
|
21
|
+
/** License information */
|
|
22
|
+
licenses?: [{
|
|
23
|
+
license: {
|
|
24
|
+
id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
}];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* CycloneDX Metadata
|
|
31
|
+
*/
|
|
32
|
+
export interface CycloneDXMetadata {
|
|
33
|
+
/** ISO 8601 timestamp */
|
|
34
|
+
timestamp: string;
|
|
35
|
+
/** Tools used to create the BOM */
|
|
36
|
+
tools: [
|
|
37
|
+
{
|
|
38
|
+
/** Tool vendor */
|
|
39
|
+
vendor: string;
|
|
40
|
+
/** Tool name */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Tool version */
|
|
43
|
+
version: string;
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* CycloneDX BOM Document
|
|
49
|
+
* Conforms to CycloneDX v1.5 specification
|
|
50
|
+
*/
|
|
51
|
+
export interface CycloneDXBom {
|
|
52
|
+
/** BOM format identifier */
|
|
53
|
+
bomFormat: 'CycloneDX';
|
|
54
|
+
/** CycloneDX specification version */
|
|
55
|
+
specVersion: '1.5';
|
|
56
|
+
/** Incremental BOM version */
|
|
57
|
+
version: number;
|
|
58
|
+
/** BOM metadata */
|
|
59
|
+
metadata: CycloneDXMetadata;
|
|
60
|
+
/** List of components */
|
|
61
|
+
components: CycloneDXComponent[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options for generating CycloneDX BOM
|
|
65
|
+
*/
|
|
66
|
+
export interface CycloneDXOptions {
|
|
67
|
+
/** Custom tool name (default: 'sbom_generate') */
|
|
68
|
+
toolName?: string;
|
|
69
|
+
/** Custom tool version (default: '6.9.0') */
|
|
70
|
+
toolVersion?: string;
|
|
71
|
+
/** BOM version number (default: 1) */
|
|
72
|
+
bomVersion?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generate a CycloneDX BOM from SBOM components
|
|
76
|
+
*
|
|
77
|
+
* @param components - List of SBOM components
|
|
78
|
+
* @param options - Optional configuration
|
|
79
|
+
* @returns CycloneDX BOM object
|
|
80
|
+
*/
|
|
81
|
+
export declare function generateCycloneDX(components: SbomComponent[], options?: CycloneDXOptions): CycloneDXBom;
|
|
82
|
+
/**
|
|
83
|
+
* Serialize a CycloneDX BOM to a JSON string
|
|
84
|
+
*
|
|
85
|
+
* @param bom - CycloneDX BOM object
|
|
86
|
+
* @returns JSON string representation
|
|
87
|
+
*/
|
|
88
|
+
export declare function serializeCycloneDX(bom: CycloneDXBom): string;
|
|
89
|
+
/**
|
|
90
|
+
* Generate PURL for a component based on its ecosystem
|
|
91
|
+
* This is a convenience function that can be used externally
|
|
92
|
+
*
|
|
93
|
+
* @param ecosystem - The package ecosystem
|
|
94
|
+
* @param name - Package name
|
|
95
|
+
* @param version - Package version
|
|
96
|
+
* @param namespace - Optional namespace (for golang, maven, swift)
|
|
97
|
+
* @returns Package URL
|
|
98
|
+
*/
|
|
99
|
+
export declare function generateComponentPurl(ecosystem: Ecosystem, name: string, version: string, namespace?: string): string;
|
|
100
|
+
export type { Ecosystem, SbomComponent } from './detectors/index.js';
|
|
101
|
+
export { generatePurl } from './detectors/index.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SBOM Detector Registry and Common Types
|
|
3
|
+
*
|
|
4
|
+
* Provides detectors for extracting dependency information from
|
|
5
|
+
* manifest and lock files across 8 ecosystems.
|
|
6
|
+
*/
|
|
7
|
+
export interface SbomComponent {
|
|
8
|
+
/** Package name */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Package version */
|
|
11
|
+
version: string;
|
|
12
|
+
/** Component type */
|
|
13
|
+
type: 'library' | 'framework' | 'application';
|
|
14
|
+
/** Package URL (PURL) per SPDX spec */
|
|
15
|
+
purl?: string;
|
|
16
|
+
/** Detected license (best effort) */
|
|
17
|
+
license?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Detector interface for parsing manifest/lock files */
|
|
20
|
+
export interface Detector {
|
|
21
|
+
/** Human-readable detector name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** File glob patterns this detector handles */
|
|
24
|
+
patterns: string[];
|
|
25
|
+
/** Parse a file and extract components */
|
|
26
|
+
detect: (filePath: string, content: string) => SbomComponent[];
|
|
27
|
+
}
|
|
28
|
+
/** Ecosystem identifiers */
|
|
29
|
+
export type Ecosystem = 'npm' | 'pypi' | 'cargo' | 'golang' | 'maven' | 'nuget' | 'swift' | 'pub';
|
|
30
|
+
/** Map of ecosystem to its detectors */
|
|
31
|
+
export interface EcosystemDetector {
|
|
32
|
+
ecosystem: Ecosystem;
|
|
33
|
+
detectors: Detector[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generate a Package URL (PURL) per SPDX specification
|
|
37
|
+
* Format: pkg:<type>/<namespace>/<name>@<version>
|
|
38
|
+
*/
|
|
39
|
+
export declare function generatePurl(ecosystem: Ecosystem, name: string, version: string, namespace?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Detect ecosystem from file path
|
|
42
|
+
*/
|
|
43
|
+
export declare function detectEcosystemFromPath(filePath: string): Ecosystem | null;
|
|
44
|
+
/** All registered detectors */
|
|
45
|
+
export declare const allDetectors: Detector[];
|
|
46
|
+
/**
|
|
47
|
+
* Find detectors matching a file path
|
|
48
|
+
*/
|
|
49
|
+
export declare function findDetectorsForFile(filePath: string): Detector[];
|
|
50
|
+
/**
|
|
51
|
+
* Detect components from a file using appropriate detectors
|
|
52
|
+
*/
|
|
53
|
+
export declare function detectComponents(filePath: string, content: string): SbomComponent[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* chat.message, system-enhancer) to share state like active agents, tool call tracking,
|
|
7
7
|
* and delegation chains.
|
|
8
8
|
*/
|
|
9
|
-
export declare const MAX_DELEGATION_CHAIN_SESSIONS = 1000;
|
|
10
9
|
/**
|
|
11
10
|
* Represents a single tool call entry for tracking purposes
|
|
12
11
|
*/
|
|
@@ -109,10 +108,6 @@ export declare const swarmState: {
|
|
|
109
108
|
* Reset all state to initial values - useful for testing
|
|
110
109
|
*/
|
|
111
110
|
export declare function resetSwarmState(): void;
|
|
112
|
-
/**
|
|
113
|
-
* Ensure toolAggregates stays below the configured cap by evicting the oldest entry.
|
|
114
|
-
*/
|
|
115
|
-
export declare function enforceToolAggregateCapacity(key: string): void;
|
|
116
111
|
/**
|
|
117
112
|
* Start a new agent session with initialized guardrail state.
|
|
118
113
|
* Also removes any stale sessions older than staleDurationMs.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build Check Tool
|
|
3
|
+
*
|
|
4
|
+
* Discovers and runs build commands for various ecosystems in a project directory.
|
|
5
|
+
*/
|
|
6
|
+
import { tool } from '@opencode-ai/plugin';
|
|
7
|
+
import type { EvidenceVerdict } from '../config/evidence-schema';
|
|
8
|
+
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
9
|
+
export declare const MAX_OUTPUT_BYTES: number;
|
|
10
|
+
export declare const MAX_OUTPUT_LINES = 100;
|
|
11
|
+
export interface BuildCheckInput {
|
|
12
|
+
/** Scope: 'changed' or 'all' */
|
|
13
|
+
scope: 'changed' | 'all';
|
|
14
|
+
/** List of changed files when scope is 'changed' */
|
|
15
|
+
changed_files?: string[];
|
|
16
|
+
/** Mode: 'build', 'typecheck', or 'both' (default: 'both') */
|
|
17
|
+
mode?: 'build' | 'typecheck' | 'both';
|
|
18
|
+
}
|
|
19
|
+
export interface BuildRun {
|
|
20
|
+
kind: 'build' | 'typecheck' | 'test';
|
|
21
|
+
command: string;
|
|
22
|
+
cwd: string;
|
|
23
|
+
exit_code: number;
|
|
24
|
+
duration_ms: number;
|
|
25
|
+
stdout_tail: string;
|
|
26
|
+
stderr_tail: string;
|
|
27
|
+
}
|
|
28
|
+
export interface BuildCheckResult {
|
|
29
|
+
verdict: EvidenceVerdict;
|
|
30
|
+
runs: BuildRun[];
|
|
31
|
+
summary: {
|
|
32
|
+
files_scanned: number;
|
|
33
|
+
runs_count: number;
|
|
34
|
+
failed_count: number;
|
|
35
|
+
skipped_reason?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Truncate output to last maxLines lines, but not more than maxBytes
|
|
40
|
+
*/
|
|
41
|
+
export declare function truncateOutput(output: string, maxLines?: number, maxBytes?: number): string;
|
|
42
|
+
/**
|
|
43
|
+
* Parse command to determine its kind
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCommandKind(command: string): 'build' | 'typecheck' | 'test';
|
|
46
|
+
/**
|
|
47
|
+
* Run build check: discover and execute build commands
|
|
48
|
+
*/
|
|
49
|
+
export declare function runBuildCheck(workingDir: string, input: BuildCheckInput): Promise<BuildCheckResult>;
|
|
50
|
+
export declare const build_check: ReturnType<typeof tool>;
|
|
@@ -8,11 +8,10 @@ export interface GitingestArgs {
|
|
|
8
8
|
export declare const GITINGEST_TIMEOUT_MS = 10000;
|
|
9
9
|
export declare const GITINGEST_MAX_RESPONSE_BYTES = 5242880;
|
|
10
10
|
export declare const GITINGEST_MAX_RETRIES = 2;
|
|
11
|
-
export declare const GITINGEST_DEFAULT_ENDPOINT = "https://gitingest.com/api/ingest";
|
|
12
11
|
/**
|
|
13
12
|
* Fetch repository content via gitingest.com API with timeout, size guard, and retry logic
|
|
14
13
|
*/
|
|
15
|
-
export declare function fetchGitingest(args: GitingestArgs
|
|
14
|
+
export declare function fetchGitingest(args: GitingestArgs): Promise<string>;
|
|
16
15
|
/**
|
|
17
16
|
* Gitingest tool for fetching GitHub repository contents
|
|
18
17
|
*/
|