@aionlabsai/aion 0.2.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 +41 -0
- package/dist/agents/base-agent.d.ts +27 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +97 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/developer.d.ts +21 -0
- package/dist/agents/developer.d.ts.map +1 -0
- package/dist/agents/developer.js +51 -0
- package/dist/agents/developer.js.map +1 -0
- package/dist/agents/explain-agent.d.ts +17 -0
- package/dist/agents/explain-agent.d.ts.map +1 -0
- package/dist/agents/explain-agent.js +30 -0
- package/dist/agents/explain-agent.js.map +1 -0
- package/dist/agents/graph-agent.d.ts +21 -0
- package/dist/agents/graph-agent.d.ts.map +1 -0
- package/dist/agents/graph-agent.js +57 -0
- package/dist/agents/graph-agent.js.map +1 -0
- package/dist/agents/investigator.d.ts +21 -0
- package/dist/agents/investigator.d.ts.map +1 -0
- package/dist/agents/investigator.js +48 -0
- package/dist/agents/investigator.js.map +1 -0
- package/dist/agents/planner.d.ts +19 -0
- package/dist/agents/planner.d.ts.map +1 -0
- package/dist/agents/planner.js +43 -0
- package/dist/agents/planner.js.map +1 -0
- package/dist/agents/planner.test.d.ts +2 -0
- package/dist/agents/planner.test.d.ts.map +1 -0
- package/dist/agents/planner.test.js +21 -0
- package/dist/agents/planner.test.js.map +1 -0
- package/dist/agents/qa.d.ts +18 -0
- package/dist/agents/qa.d.ts.map +1 -0
- package/dist/agents/qa.js +44 -0
- package/dist/agents/qa.js.map +1 -0
- package/dist/agents/reviewer.d.ts +19 -0
- package/dist/agents/reviewer.d.ts.map +1 -0
- package/dist/agents/reviewer.js +47 -0
- package/dist/agents/reviewer.js.map +1 -0
- package/dist/agents/scanner.d.ts +19 -0
- package/dist/agents/scanner.d.ts.map +1 -0
- package/dist/agents/scanner.js +30 -0
- package/dist/agents/scanner.js.map +1 -0
- package/dist/agents/synthesizer.d.ts +16 -0
- package/dist/agents/synthesizer.d.ts.map +1 -0
- package/dist/agents/synthesizer.js +97 -0
- package/dist/agents/synthesizer.js.map +1 -0
- package/dist/agents/tests-agent.d.ts +17 -0
- package/dist/agents/tests-agent.d.ts.map +1 -0
- package/dist/agents/tests-agent.js +36 -0
- package/dist/agents/tests-agent.js.map +1 -0
- package/dist/cli/classifier.d.ts +8 -0
- package/dist/cli/classifier.d.ts.map +1 -0
- package/dist/cli/classifier.js +60 -0
- package/dist/cli/classifier.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +3 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +22 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/audit.d.ts +3 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +189 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/churn.d.ts +3 -0
- package/dist/cli/commands/churn.d.ts.map +1 -0
- package/dist/cli/commands/churn.js +76 -0
- package/dist/cli/commands/churn.js.map +1 -0
- package/dist/cli/commands/explain.d.ts +3 -0
- package/dist/cli/commands/explain.d.ts.map +1 -0
- package/dist/cli/commands/explain.js +115 -0
- package/dist/cli/commands/explain.js.map +1 -0
- package/dist/cli/commands/fix.d.ts +3 -0
- package/dist/cli/commands/fix.d.ts.map +1 -0
- package/dist/cli/commands/fix.js +22 -0
- package/dist/cli/commands/fix.js.map +1 -0
- package/dist/cli/commands/graph.d.ts +3 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +311 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/health.d.ts +3 -0
- package/dist/cli/commands/health.d.ts.map +1 -0
- package/dist/cli/commands/health.js +106 -0
- package/dist/cli/commands/health.js.map +1 -0
- package/dist/cli/commands/memory.d.ts +3 -0
- package/dist/cli/commands/memory.d.ts.map +1 -0
- package/dist/cli/commands/memory.js +199 -0
- package/dist/cli/commands/memory.js.map +1 -0
- package/dist/cli/commands/patterns.d.ts +3 -0
- package/dist/cli/commands/patterns.d.ts.map +1 -0
- package/dist/cli/commands/patterns.js +79 -0
- package/dist/cli/commands/patterns.js.map +1 -0
- package/dist/cli/commands/report.d.ts +3 -0
- package/dist/cli/commands/report.d.ts.map +1 -0
- package/dist/cli/commands/report.js +408 -0
- package/dist/cli/commands/report.js.map +1 -0
- package/dist/cli/commands/review.d.ts +3 -0
- package/dist/cli/commands/review.d.ts.map +1 -0
- package/dist/cli/commands/review.js +21 -0
- package/dist/cli/commands/review.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +3 -0
- package/dist/cli/commands/scan.d.ts.map +1 -0
- package/dist/cli/commands/scan.js +129 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/interactive.d.ts +3 -0
- package/dist/cli/interactive.d.ts.map +1 -0
- package/dist/cli/interactive.js +115 -0
- package/dist/cli/interactive.js.map +1 -0
- package/dist/cli/menu.d.ts +2 -0
- package/dist/cli/menu.d.ts.map +1 -0
- package/dist/cli/menu.js +208 -0
- package/dist/cli/menu.js.map +1 -0
- package/dist/cli/runtime-options.d.ts +19 -0
- package/dist/cli/runtime-options.d.ts.map +1 -0
- package/dist/cli/runtime-options.js +56 -0
- package/dist/cli/runtime-options.js.map +1 -0
- package/dist/cli/tui.d.ts +11 -0
- package/dist/cli/tui.d.ts.map +1 -0
- package/dist/cli/tui.js +162 -0
- package/dist/cli/tui.js.map +1 -0
- package/dist/cli/ui/renderer.d.ts +15 -0
- package/dist/cli/ui/renderer.d.ts.map +1 -0
- package/dist/cli/ui/renderer.js +129 -0
- package/dist/cli/ui/renderer.js.map +1 -0
- package/dist/core/cost-tracker.d.ts +26 -0
- package/dist/core/cost-tracker.d.ts.map +1 -0
- package/dist/core/cost-tracker.js +71 -0
- package/dist/core/cost-tracker.js.map +1 -0
- package/dist/core/cost-tracker.test.d.ts +2 -0
- package/dist/core/cost-tracker.test.d.ts.map +1 -0
- package/dist/core/cost-tracker.test.js +36 -0
- package/dist/core/cost-tracker.test.js.map +1 -0
- package/dist/core/orchestrator.d.ts +46 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js +67 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/pipeline-context.d.ts +18 -0
- package/dist/core/pipeline-context.d.ts.map +1 -0
- package/dist/core/pipeline-context.js +30 -0
- package/dist/core/pipeline-context.js.map +1 -0
- package/dist/core/pipelines/analyze-pipeline.d.ts +4 -0
- package/dist/core/pipelines/analyze-pipeline.d.ts.map +1 -0
- package/dist/core/pipelines/analyze-pipeline.js +69 -0
- package/dist/core/pipelines/analyze-pipeline.js.map +1 -0
- package/dist/core/pipelines/audit-fix-pipeline.d.ts +24 -0
- package/dist/core/pipelines/audit-fix-pipeline.d.ts.map +1 -0
- package/dist/core/pipelines/audit-fix-pipeline.js +79 -0
- package/dist/core/pipelines/audit-fix-pipeline.js.map +1 -0
- package/dist/core/pipelines/audit-pipeline.d.ts +33 -0
- package/dist/core/pipelines/audit-pipeline.d.ts.map +1 -0
- package/dist/core/pipelines/audit-pipeline.js +353 -0
- package/dist/core/pipelines/audit-pipeline.js.map +1 -0
- package/dist/core/pipelines/audit-pipeline.test.d.ts +2 -0
- package/dist/core/pipelines/audit-pipeline.test.d.ts.map +1 -0
- package/dist/core/pipelines/audit-pipeline.test.js +135 -0
- package/dist/core/pipelines/audit-pipeline.test.js.map +1 -0
- package/dist/core/pipelines/fix-pipeline.d.ts +9 -0
- package/dist/core/pipelines/fix-pipeline.d.ts.map +1 -0
- package/dist/core/pipelines/fix-pipeline.js +151 -0
- package/dist/core/pipelines/fix-pipeline.js.map +1 -0
- package/dist/core/pipelines/review-pipeline.d.ts +4 -0
- package/dist/core/pipelines/review-pipeline.d.ts.map +1 -0
- package/dist/core/pipelines/review-pipeline.js +65 -0
- package/dist/core/pipelines/review-pipeline.js.map +1 -0
- package/dist/core/repo-context.d.ts +2 -0
- package/dist/core/repo-context.d.ts.map +1 -0
- package/dist/core/repo-context.js +12 -0
- package/dist/core/repo-context.js.map +1 -0
- package/dist/core/repo-context.test.d.ts +2 -0
- package/dist/core/repo-context.test.d.ts.map +1 -0
- package/dist/core/repo-context.test.js +40 -0
- package/dist/core/repo-context.test.js.map +1 -0
- package/dist/core/runtime-policy.d.ts +35 -0
- package/dist/core/runtime-policy.d.ts.map +1 -0
- package/dist/core/runtime-policy.js +37 -0
- package/dist/core/runtime-policy.js.map +1 -0
- package/dist/core/runtime-policy.test.d.ts +2 -0
- package/dist/core/runtime-policy.test.d.ts.map +1 -0
- package/dist/core/runtime-policy.test.js +27 -0
- package/dist/core/runtime-policy.test.js.map +1 -0
- package/dist/core/state-machine.d.ts +17 -0
- package/dist/core/state-machine.d.ts.map +1 -0
- package/dist/core/state-machine.js +45 -0
- package/dist/core/state-machine.js.map +1 -0
- package/dist/core/task.d.ts +29 -0
- package/dist/core/task.d.ts.map +1 -0
- package/dist/core/task.js +2 -0
- package/dist/core/task.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/dist/infra/bm25.d.ts +30 -0
- package/dist/infra/bm25.d.ts.map +1 -0
- package/dist/infra/bm25.js +69 -0
- package/dist/infra/bm25.js.map +1 -0
- package/dist/infra/bm25.test.d.ts +2 -0
- package/dist/infra/bm25.test.d.ts.map +1 -0
- package/dist/infra/bm25.test.js +17 -0
- package/dist/infra/bm25.test.js.map +1 -0
- package/dist/infra/chunker.d.ts +20 -0
- package/dist/infra/chunker.d.ts.map +1 -0
- package/dist/infra/chunker.js +165 -0
- package/dist/infra/chunker.js.map +1 -0
- package/dist/infra/chunker.test.d.ts +2 -0
- package/dist/infra/chunker.test.d.ts.map +1 -0
- package/dist/infra/chunker.test.js +33 -0
- package/dist/infra/chunker.test.js.map +1 -0
- package/dist/infra/code-metrics.d.ts +39 -0
- package/dist/infra/code-metrics.d.ts.map +1 -0
- package/dist/infra/code-metrics.js +222 -0
- package/dist/infra/code-metrics.js.map +1 -0
- package/dist/infra/db/database.d.ts +4 -0
- package/dist/infra/db/database.d.ts.map +1 -0
- package/dist/infra/db/database.js +25 -0
- package/dist/infra/db/database.js.map +1 -0
- package/dist/infra/db/evidence-repo.d.ts +4 -0
- package/dist/infra/db/evidence-repo.d.ts.map +1 -0
- package/dist/infra/db/evidence-repo.js +8 -0
- package/dist/infra/db/evidence-repo.js.map +1 -0
- package/dist/infra/db/migrations.d.ts +2 -0
- package/dist/infra/db/migrations.d.ts.map +1 -0
- package/dist/infra/db/migrations.js +10 -0
- package/dist/infra/db/migrations.js.map +1 -0
- package/dist/infra/db/store.d.ts +12 -0
- package/dist/infra/db/store.d.ts.map +1 -0
- package/dist/infra/db/store.js +73 -0
- package/dist/infra/db/store.js.map +1 -0
- package/dist/infra/db/task-repo.d.ts +8 -0
- package/dist/infra/db/task-repo.d.ts.map +1 -0
- package/dist/infra/db/task-repo.js +19 -0
- package/dist/infra/db/task-repo.js.map +1 -0
- package/dist/infra/dep-graph-python.d.ts +3 -0
- package/dist/infra/dep-graph-python.d.ts.map +1 -0
- package/dist/infra/dep-graph-python.js +154 -0
- package/dist/infra/dep-graph-python.js.map +1 -0
- package/dist/infra/dep-graph.d.ts +20 -0
- package/dist/infra/dep-graph.d.ts.map +1 -0
- package/dist/infra/dep-graph.js +102 -0
- package/dist/infra/dep-graph.js.map +1 -0
- package/dist/infra/embeddings.d.ts +19 -0
- package/dist/infra/embeddings.d.ts.map +1 -0
- package/dist/infra/embeddings.js +110 -0
- package/dist/infra/embeddings.js.map +1 -0
- package/dist/infra/evidence-gate.d.ts +11 -0
- package/dist/infra/evidence-gate.d.ts.map +1 -0
- package/dist/infra/evidence-gate.js +21 -0
- package/dist/infra/evidence-gate.js.map +1 -0
- package/dist/infra/evidence-gate.test.d.ts +2 -0
- package/dist/infra/evidence-gate.test.d.ts.map +1 -0
- package/dist/infra/evidence-gate.test.js +36 -0
- package/dist/infra/evidence-gate.test.js.map +1 -0
- package/dist/infra/git-analysis.d.ts +26 -0
- package/dist/infra/git-analysis.d.ts.map +1 -0
- package/dist/infra/git-analysis.js +102 -0
- package/dist/infra/git-analysis.js.map +1 -0
- package/dist/infra/health-score.d.ts +31 -0
- package/dist/infra/health-score.d.ts.map +1 -0
- package/dist/infra/health-score.js +136 -0
- package/dist/infra/health-score.js.map +1 -0
- package/dist/infra/knowledge.d.ts +15 -0
- package/dist/infra/knowledge.d.ts.map +1 -0
- package/dist/infra/knowledge.js +124 -0
- package/dist/infra/knowledge.js.map +1 -0
- package/dist/infra/lang-detect.d.ts +14 -0
- package/dist/infra/lang-detect.d.ts.map +1 -0
- package/dist/infra/lang-detect.js +135 -0
- package/dist/infra/lang-detect.js.map +1 -0
- package/dist/infra/local-qa.d.ts +6 -0
- package/dist/infra/local-qa.d.ts.map +1 -0
- package/dist/infra/local-qa.js +66 -0
- package/dist/infra/local-qa.js.map +1 -0
- package/dist/infra/pattern-detect.d.ts +30 -0
- package/dist/infra/pattern-detect.d.ts.map +1 -0
- package/dist/infra/pattern-detect.js +250 -0
- package/dist/infra/pattern-detect.js.map +1 -0
- package/dist/infra/persona-presets.d.ts +29 -0
- package/dist/infra/persona-presets.d.ts.map +1 -0
- package/dist/infra/persona-presets.js +110 -0
- package/dist/infra/persona-presets.js.map +1 -0
- package/dist/infra/repo-index.d.ts +50 -0
- package/dist/infra/repo-index.d.ts.map +1 -0
- package/dist/infra/repo-index.js +228 -0
- package/dist/infra/repo-index.js.map +1 -0
- package/dist/infra/repo-index.test.d.ts +2 -0
- package/dist/infra/repo-index.test.d.ts.map +1 -0
- package/dist/infra/repo-index.test.js +53 -0
- package/dist/infra/repo-index.test.js.map +1 -0
- package/dist/infra/repo-query.d.ts +11 -0
- package/dist/infra/repo-query.d.ts.map +1 -0
- package/dist/infra/repo-query.js +67 -0
- package/dist/infra/repo-query.js.map +1 -0
- package/dist/infra/repo-query.test.d.ts +2 -0
- package/dist/infra/repo-query.test.d.ts.map +1 -0
- package/dist/infra/repo-query.test.js +34 -0
- package/dist/infra/repo-query.test.js.map +1 -0
- package/dist/infra/sbom.d.ts +16 -0
- package/dist/infra/sbom.d.ts.map +1 -0
- package/dist/infra/sbom.js +111 -0
- package/dist/infra/sbom.js.map +1 -0
- package/dist/infra/semgrep.d.ts +10 -0
- package/dist/infra/semgrep.d.ts.map +1 -0
- package/dist/infra/semgrep.js +122 -0
- package/dist/infra/semgrep.js.map +1 -0
- package/dist/infra/semgrep.test.d.ts +2 -0
- package/dist/infra/semgrep.test.d.ts.map +1 -0
- package/dist/infra/semgrep.test.js +39 -0
- package/dist/infra/semgrep.test.js.map +1 -0
- package/dist/infra/tmux.d.ts +9 -0
- package/dist/infra/tmux.d.ts.map +1 -0
- package/dist/infra/tmux.js +42 -0
- package/dist/infra/tmux.js.map +1 -0
- package/dist/infra/worktree.d.ts +9 -0
- package/dist/infra/worktree.d.ts.map +1 -0
- package/dist/infra/worktree.js +51 -0
- package/dist/infra/worktree.js.map +1 -0
- package/dist/prompts/developer.d.ts +2 -0
- package/dist/prompts/developer.d.ts.map +1 -0
- package/dist/prompts/developer.js +36 -0
- package/dist/prompts/developer.js.map +1 -0
- package/dist/prompts/explain.d.ts +3 -0
- package/dist/prompts/explain.d.ts.map +1 -0
- package/dist/prompts/explain.js +38 -0
- package/dist/prompts/explain.js.map +1 -0
- package/dist/prompts/investigator.d.ts +3 -0
- package/dist/prompts/investigator.d.ts.map +1 -0
- package/dist/prompts/investigator.js +46 -0
- package/dist/prompts/investigator.js.map +1 -0
- package/dist/prompts/planner.d.ts +2 -0
- package/dist/prompts/planner.d.ts.map +1 -0
- package/dist/prompts/planner.js +37 -0
- package/dist/prompts/planner.js.map +1 -0
- package/dist/prompts/qa.d.ts +2 -0
- package/dist/prompts/qa.d.ts.map +1 -0
- package/dist/prompts/qa.js +37 -0
- package/dist/prompts/qa.js.map +1 -0
- package/dist/prompts/reviewer.d.ts +2 -0
- package/dist/prompts/reviewer.d.ts.map +1 -0
- package/dist/prompts/reviewer.js +36 -0
- package/dist/prompts/reviewer.js.map +1 -0
- package/dist/prompts/scanner-domains-infra.d.ts +48 -0
- package/dist/prompts/scanner-domains-infra.d.ts.map +1 -0
- package/dist/prompts/scanner-domains-infra.js +141 -0
- package/dist/prompts/scanner-domains-infra.js.map +1 -0
- package/dist/prompts/scanner.d.ts +10 -0
- package/dist/prompts/scanner.d.ts.map +1 -0
- package/dist/prompts/scanner.js +185 -0
- package/dist/prompts/scanner.js.map +1 -0
- package/dist/prompts/synthesizer.d.ts +2 -0
- package/dist/prompts/synthesizer.d.ts.map +1 -0
- package/dist/prompts/synthesizer.js +36 -0
- package/dist/prompts/synthesizer.js.map +1 -0
- package/dist/providers/cli-provider.d.ts +16 -0
- package/dist/providers/cli-provider.d.ts.map +1 -0
- package/dist/providers/cli-provider.js +145 -0
- package/dist/providers/cli-provider.js.map +1 -0
- package/dist/providers/openrouter-provider.d.ts +8 -0
- package/dist/providers/openrouter-provider.d.ts.map +1 -0
- package/dist/providers/openrouter-provider.js +86 -0
- package/dist/providers/openrouter-provider.js.map +1 -0
- package/dist/providers/sdk-provider.d.ts +6 -0
- package/dist/providers/sdk-provider.d.ts.map +1 -0
- package/dist/providers/sdk-provider.js +0 -0
- package/dist/providers/sdk-provider.js.map +1 -0
- package/dist/providers/types.d.ts +13 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/schemas/audit.d.ts +278 -0
- package/dist/schemas/audit.d.ts.map +1 -0
- package/dist/schemas/audit.js +37 -0
- package/dist/schemas/audit.js.map +1 -0
- package/dist/schemas/audit.test.d.ts +2 -0
- package/dist/schemas/audit.test.d.ts.map +1 -0
- package/dist/schemas/audit.test.js +41 -0
- package/dist/schemas/audit.test.js.map +1 -0
- package/dist/schemas/evidence.d.ts +48 -0
- package/dist/schemas/evidence.d.ts.map +1 -0
- package/dist/schemas/evidence.js +17 -0
- package/dist/schemas/evidence.js.map +1 -0
- package/dist/schemas/patch.d.ts +25 -0
- package/dist/schemas/patch.d.ts.map +1 -0
- package/dist/schemas/patch.js +10 -0
- package/dist/schemas/patch.js.map +1 -0
- package/dist/schemas/plan.d.ts +69 -0
- package/dist/schemas/plan.d.ts.map +1 -0
- package/dist/schemas/plan.js +17 -0
- package/dist/schemas/plan.js.map +1 -0
- package/dist/schemas/qa.d.ts +28 -0
- package/dist/schemas/qa.d.ts.map +1 -0
- package/dist/schemas/qa.js +11 -0
- package/dist/schemas/qa.js.map +1 -0
- package/dist/schemas/review.d.ts +71 -0
- package/dist/schemas/review.d.ts.map +1 -0
- package/dist/schemas/review.js +16 -0
- package/dist/schemas/review.js.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
2
|
+
const SEMGREP_MAX_BUFFER = 50 * 1024 * 1024;
|
|
3
|
+
function mapSeverity(raw) {
|
|
4
|
+
switch (raw.toUpperCase()) {
|
|
5
|
+
case 'ERROR': return 'critical';
|
|
6
|
+
case 'WARNING': return 'high';
|
|
7
|
+
case 'INFO': return 'medium';
|
|
8
|
+
default: return 'low';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function mapCategory(checkId, meta) {
|
|
12
|
+
const id = (checkId + ' ' + (meta ?? '')).toLowerCase();
|
|
13
|
+
if (/security|injection|xss|sqli|secret|credential|auth|crypto/.test(id))
|
|
14
|
+
return 'security';
|
|
15
|
+
if (/perf|performance|memory|cpu|loop/.test(id))
|
|
16
|
+
return 'performance';
|
|
17
|
+
if (/test|coverage/.test(id))
|
|
18
|
+
return 'testing';
|
|
19
|
+
if (/error|exception|catch|throw/.test(id))
|
|
20
|
+
return 'error-handling';
|
|
21
|
+
if (/type|null|undefined/.test(id))
|
|
22
|
+
return 'types';
|
|
23
|
+
if (/arch|coupling|depend|import/.test(id))
|
|
24
|
+
return 'architecture';
|
|
25
|
+
return 'maintainability';
|
|
26
|
+
}
|
|
27
|
+
function extractJsonObject(text) {
|
|
28
|
+
let start = -1;
|
|
29
|
+
let depth = 0;
|
|
30
|
+
let inString = false;
|
|
31
|
+
let escaped = false;
|
|
32
|
+
for (let i = 0; i < text.length; i++) {
|
|
33
|
+
const ch = text[i];
|
|
34
|
+
if (escaped) {
|
|
35
|
+
escaped = false;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (ch === '\\' && inString) {
|
|
39
|
+
escaped = true;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (ch === '"') {
|
|
43
|
+
inString = !inString;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (inString)
|
|
47
|
+
continue;
|
|
48
|
+
if (ch === '{') {
|
|
49
|
+
if (depth === 0)
|
|
50
|
+
start = i;
|
|
51
|
+
depth++;
|
|
52
|
+
}
|
|
53
|
+
else if (ch === '}') {
|
|
54
|
+
depth--;
|
|
55
|
+
if (depth === 0 && start !== -1)
|
|
56
|
+
return text.slice(start, i + 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
function compact(text, max = 320) {
|
|
62
|
+
const normalized = text.replace(/\s+/g, ' ').trim();
|
|
63
|
+
if (normalized.length <= max)
|
|
64
|
+
return normalized;
|
|
65
|
+
return `${normalized.slice(0, max)}...`;
|
|
66
|
+
}
|
|
67
|
+
export function parseSemgrepOutput(stdout) {
|
|
68
|
+
let raw;
|
|
69
|
+
try {
|
|
70
|
+
raw = JSON.parse(extractJsonObject(stdout) ?? stdout);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return { findings: [], filesScanned: 0, available: true, error: 'failed to parse semgrep output' };
|
|
74
|
+
}
|
|
75
|
+
const findings = (raw.results ?? []).map((r) => ({
|
|
76
|
+
file: r.path,
|
|
77
|
+
line: r.start.line,
|
|
78
|
+
severity: mapSeverity(r.extra.severity),
|
|
79
|
+
category: mapCategory(r.check_id, r.extra.metadata?.category),
|
|
80
|
+
finding: compact(`[${r.check_id}] ${r.extra.message}`),
|
|
81
|
+
recommendation: `Review ${r.path}:${r.start.line} — fix or suppress with \`# nosemgrep\``,
|
|
82
|
+
}));
|
|
83
|
+
const scanned = raw.paths?.scanned?.length ?? new Set(findings.map((f) => f.file)).size;
|
|
84
|
+
return { findings, filesScanned: scanned, available: true };
|
|
85
|
+
}
|
|
86
|
+
export function runSemgrep(cwd) {
|
|
87
|
+
// Check semgrep is available
|
|
88
|
+
const check = spawnSync('semgrep', ['--version'], { encoding: 'utf8', maxBuffer: SEMGREP_MAX_BUFFER });
|
|
89
|
+
if (check.status !== 0) {
|
|
90
|
+
const error = check.stderr?.slice(0, 200) || check.error?.message || 'semgrep not found';
|
|
91
|
+
return { findings: [], filesScanned: 0, available: false, error };
|
|
92
|
+
}
|
|
93
|
+
const result = spawnSync('semgrep', [
|
|
94
|
+
'scan',
|
|
95
|
+
'--config', 'auto',
|
|
96
|
+
'--json',
|
|
97
|
+
'--quiet',
|
|
98
|
+
'--no-rewrite-rule-ids',
|
|
99
|
+
'--timeout', '60',
|
|
100
|
+
'--max-memory', '512',
|
|
101
|
+
'.',
|
|
102
|
+
], {
|
|
103
|
+
cwd,
|
|
104
|
+
encoding: 'utf8',
|
|
105
|
+
timeout: 120_000,
|
|
106
|
+
maxBuffer: SEMGREP_MAX_BUFFER,
|
|
107
|
+
env: process.env,
|
|
108
|
+
});
|
|
109
|
+
if (result.error) {
|
|
110
|
+
return { findings: [], filesScanned: 0, available: true, error: result.error.message };
|
|
111
|
+
}
|
|
112
|
+
if (!result.stdout) {
|
|
113
|
+
return {
|
|
114
|
+
findings: [],
|
|
115
|
+
filesScanned: 0,
|
|
116
|
+
available: true,
|
|
117
|
+
error: result.stderr?.slice(0, 200) || 'no output',
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return parseSemgrepOutput(result.stdout);
|
|
121
|
+
}
|
|
122
|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Y,EAAE,CAAC;YACf,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,WAAW;SACnD,CAAC;IACJ,CAAC;IAED,OAAO,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semgrep.test.d.ts","sourceRoot":"","sources":["../../src/infra/semgrep.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import test from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { parseSemgrepOutput } from './semgrep.js';
|
|
4
|
+
test('parseSemgrepOutput maps findings and scanned paths', () => {
|
|
5
|
+
const result = parseSemgrepOutput(JSON.stringify({
|
|
6
|
+
paths: { scanned: ['src/app.ts', 'src/auth.ts'] },
|
|
7
|
+
results: [{
|
|
8
|
+
check_id: 'typescript.express.security.audit.xss',
|
|
9
|
+
path: 'src/app.ts',
|
|
10
|
+
start: { line: 42 },
|
|
11
|
+
extra: {
|
|
12
|
+
message: 'Potential XSS',
|
|
13
|
+
severity: 'WARNING',
|
|
14
|
+
metadata: { category: 'security' },
|
|
15
|
+
},
|
|
16
|
+
}],
|
|
17
|
+
}));
|
|
18
|
+
assert.equal(result.available, true);
|
|
19
|
+
assert.equal(result.filesScanned, 2);
|
|
20
|
+
assert.equal(result.findings.length, 1);
|
|
21
|
+
assert.equal(result.findings[0]?.severity, 'high');
|
|
22
|
+
assert.equal(result.findings[0]?.category, 'security');
|
|
23
|
+
});
|
|
24
|
+
test('parseSemgrepOutput reports invalid JSON clearly', () => {
|
|
25
|
+
const result = parseSemgrepOutput('{not json');
|
|
26
|
+
assert.equal(result.available, true);
|
|
27
|
+
assert.equal(result.filesScanned, 0);
|
|
28
|
+
assert.equal(result.findings.length, 0);
|
|
29
|
+
assert.equal(result.error, 'failed to parse semgrep output');
|
|
30
|
+
});
|
|
31
|
+
test('parseSemgrepOutput accepts Semgrep status text around JSON', () => {
|
|
32
|
+
const result = parseSemgrepOutput(`Scan Status
|
|
33
|
+
{"paths":{"scanned":["a.py"]},"results":[]}
|
|
34
|
+
Scan Summary`);
|
|
35
|
+
assert.equal(result.available, true);
|
|
36
|
+
assert.equal(result.filesScanned, 1);
|
|
37
|
+
assert.equal(result.findings.length, 0);
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=semgrep.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semgrep.test.js","sourceRoot":"","sources":["../../src/infra/semgrep.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,IAAI,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAC9D,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC;QAC/C,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC,EAAE;QACjD,OAAO,EAAE,CAAC;gBACR,QAAQ,EAAE,uCAAuC;gBACjD,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;gBACnB,KAAK,EAAE;oBACL,OAAO,EAAE,eAAe;oBACxB,QAAQ,EAAE,SAAS;oBACnB,QAAQ,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE;iBACnC;aACF,CAAC;KACH,CAAC,CAAC,CAAC;IAEJ,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AACzD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAE/C,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,gCAAgC,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,4DAA4D,EAAE,GAAG,EAAE;IACtE,MAAM,MAAM,GAAG,kBAAkB,CAAC;;aAEvB,CAAC,CAAC;IAEb,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class TmuxManager {
|
|
2
|
+
readonly available: boolean;
|
|
3
|
+
constructor();
|
|
4
|
+
createSession(sessionName: string): boolean;
|
|
5
|
+
createWindow(sessionName: string, windowName: string): string | null;
|
|
6
|
+
writeToPane(target: string, text: string): void;
|
|
7
|
+
killSession(sessionName: string): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=tmux.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmux.d.ts","sourceRoot":"","sources":["../../src/infra/tmux.ts"],"names":[],"mappings":"AAYA,qBAAa,WAAW;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;;IAM5B,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAM3C,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOpE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ/C,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAIvC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
2
|
+
function tmux(args) {
|
|
3
|
+
const result = spawnSync('tmux', args, { encoding: 'utf8' });
|
|
4
|
+
return { ok: result.status === 0, stdout: result.stdout ?? '' };
|
|
5
|
+
}
|
|
6
|
+
function isTmuxAvailable() {
|
|
7
|
+
const result = spawnSync('which', ['tmux'], { encoding: 'utf8' });
|
|
8
|
+
return result.status === 0;
|
|
9
|
+
}
|
|
10
|
+
export class TmuxManager {
|
|
11
|
+
available;
|
|
12
|
+
constructor() {
|
|
13
|
+
this.available = isTmuxAvailable();
|
|
14
|
+
}
|
|
15
|
+
createSession(sessionName) {
|
|
16
|
+
if (!this.available)
|
|
17
|
+
return false;
|
|
18
|
+
const { ok } = tmux(['new-session', '-d', '-s', sessionName]);
|
|
19
|
+
return ok;
|
|
20
|
+
}
|
|
21
|
+
createWindow(sessionName, windowName) {
|
|
22
|
+
if (!this.available)
|
|
23
|
+
return null;
|
|
24
|
+
const target = `${sessionName}:${windowName}`;
|
|
25
|
+
tmux(['new-window', '-t', sessionName, '-n', windowName]);
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
writeToPane(target, text) {
|
|
29
|
+
if (!this.available)
|
|
30
|
+
return;
|
|
31
|
+
// Send text line by line; each line is a separate send-keys call
|
|
32
|
+
for (const line of text.split('\n')) {
|
|
33
|
+
tmux(['send-keys', '-t', target, line, 'Enter']);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
killSession(sessionName) {
|
|
37
|
+
if (!this.available)
|
|
38
|
+
return;
|
|
39
|
+
tmux(['kill-session', '-t', sessionName]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=tmux.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmux.js","sourceRoot":"","sources":["../../src/infra/tmux.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,SAAS,IAAI,CAAC,IAAc;IAC1B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAC7D,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;AAClE,CAAC;AAED,SAAS,eAAe;IACtB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,WAAW;IACb,SAAS,CAAU;IAE5B;QACE,IAAI,CAAC,SAAS,GAAG,eAAe,EAAE,CAAC;IACrC,CAAC;IAED,aAAa,CAAC,WAAmB;QAC/B,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,KAAK,CAAC;QAClC,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QAC9D,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,YAAY,CAAC,WAAmB,EAAE,UAAkB;QAClD,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QACjC,MAAM,MAAM,GAAG,GAAG,WAAW,IAAI,UAAU,EAAE,CAAC;QAC9C,IAAI,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,MAAc,EAAE,IAAY;QACtC,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;QAC5B,iEAAiE;QACjE,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,WAAW,CAAC,WAAmB;QAC7B,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO;QAC5B,IAAI,CAAC,CAAC,cAAc,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface WorktreeInfo {
|
|
2
|
+
path: string;
|
|
3
|
+
branch: string;
|
|
4
|
+
head: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function createWorktree(cwd: string, agentName: string, taskId: string): string;
|
|
7
|
+
export declare function removeWorktree(cwd: string, agentName: string, taskId: string): void;
|
|
8
|
+
export declare function listWorktrees(cwd: string): WorktreeInfo[];
|
|
9
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/infra/worktree.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAgBD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAYrF;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CASnF;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,CAczD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { spawnSync } from 'child_process';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
function git(cwd, args) {
|
|
5
|
+
const result = spawnSync('git', args, { cwd, encoding: 'utf8' });
|
|
6
|
+
return { ok: result.status === 0, stdout: result.stdout ?? '', stderr: result.stderr ?? '' };
|
|
7
|
+
}
|
|
8
|
+
function assertGit(cwd, args) {
|
|
9
|
+
const result = git(cwd, args);
|
|
10
|
+
if (!result.ok) {
|
|
11
|
+
const details = result.stderr.trim() || result.stdout.trim() || 'unknown git error';
|
|
12
|
+
throw new Error(`git ${args.join(' ')} failed: ${details}`);
|
|
13
|
+
}
|
|
14
|
+
return result.stdout;
|
|
15
|
+
}
|
|
16
|
+
export function createWorktree(cwd, agentName, taskId) {
|
|
17
|
+
const shortId = taskId.slice(0, 8);
|
|
18
|
+
const name = `${agentName}-${shortId}`;
|
|
19
|
+
const worktreePath = join(cwd, '.worktrees', name);
|
|
20
|
+
const branch = `ai/${name}`;
|
|
21
|
+
if (existsSync(worktreePath))
|
|
22
|
+
return worktreePath;
|
|
23
|
+
assertGit(cwd, ['rev-parse', '--verify', 'HEAD']);
|
|
24
|
+
assertGit(cwd, ['worktree', 'add', worktreePath, '-b', branch, 'HEAD']);
|
|
25
|
+
return worktreePath;
|
|
26
|
+
}
|
|
27
|
+
export function removeWorktree(cwd, agentName, taskId) {
|
|
28
|
+
const shortId = taskId.slice(0, 8);
|
|
29
|
+
const name = `${agentName}-${shortId}`;
|
|
30
|
+
const worktreePath = join(cwd, '.worktrees', name);
|
|
31
|
+
if (!existsSync(worktreePath))
|
|
32
|
+
return;
|
|
33
|
+
assertGit(cwd, ['worktree', 'remove', '--force', worktreePath]);
|
|
34
|
+
assertGit(cwd, ['branch', '-D', `ai/${name}`]);
|
|
35
|
+
}
|
|
36
|
+
export function listWorktrees(cwd) {
|
|
37
|
+
const { ok, stdout } = git(cwd, ['worktree', 'list', '--porcelain']);
|
|
38
|
+
if (!ok)
|
|
39
|
+
return [];
|
|
40
|
+
const entries = stdout.trim().split('\n\n');
|
|
41
|
+
return entries
|
|
42
|
+
.filter(Boolean)
|
|
43
|
+
.map((entry) => {
|
|
44
|
+
const lines = entry.split('\n');
|
|
45
|
+
const path = lines[0]?.replace('worktree ', '') ?? '';
|
|
46
|
+
const head = lines[1]?.replace('HEAD ', '') ?? '';
|
|
47
|
+
const branch = lines[2]?.replace('branch refs/heads/', '') ?? '';
|
|
48
|
+
return { path, head, branch };
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../../src/infra/worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAQhC,SAAS,GAAG,CAAC,GAAW,EAAE,IAAc;IACtC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE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O,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;QACjE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"developer.d.ts","sourceRoot":"","sources":["../../src/prompts/developer.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,IAAI,MAAM,CAkC7C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function buildDeveloperPrompt() {
|
|
2
|
+
return `# Role: Developer Agent
|
|
3
|
+
|
|
4
|
+
You are the Developer in a multi-agent AI engineering system.
|
|
5
|
+
|
|
6
|
+
## Allowed Tools
|
|
7
|
+
- Read — to understand the current code
|
|
8
|
+
- Edit, Write — to apply the fix
|
|
9
|
+
- Bash — ONLY to run: git diff HEAD (to capture the final diff)
|
|
10
|
+
- NO test execution, NO build commands
|
|
11
|
+
|
|
12
|
+
## Constraints
|
|
13
|
+
- Apply the MINIMAL fix required — no refactoring, no unrelated changes
|
|
14
|
+
- Do NOT run tests or claim they pass
|
|
15
|
+
- Do NOT claim the fix is verified or the bug is resolved
|
|
16
|
+
- Do NOT make changes outside the files identified in the evidence
|
|
17
|
+
- Do NOT read more than 500 lines from any single file; use focused reads with offset/limit
|
|
18
|
+
|
|
19
|
+
## Fix Steps
|
|
20
|
+
1. Read the affected files to understand current code, capped at 500 lines per file
|
|
21
|
+
2. Apply the targeted fix using Edit or Write
|
|
22
|
+
3. Run: git diff HEAD to capture the diff
|
|
23
|
+
4. Output the patch JSON
|
|
24
|
+
|
|
25
|
+
## Output
|
|
26
|
+
Your final response must be ONLY a valid JSON object — no prose, no markdown fences:
|
|
27
|
+
{
|
|
28
|
+
"filesChanged": string[],
|
|
29
|
+
"diff": string,
|
|
30
|
+
"buildCommand": string,
|
|
31
|
+
"testCommand": string,
|
|
32
|
+
"description": string,
|
|
33
|
+
"risksIntroduced": string[]
|
|
34
|
+
}`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=developer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"developer.js","sourceRoot":"","sources":["../../src/prompts/developer.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCP,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../src/prompts/explain.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAsC5D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function buildExplainPrompt(mode) {
|
|
2
|
+
if (mode === 'explain') {
|
|
3
|
+
return `You are a senior software engineer explaining code to a teammate.
|
|
4
|
+
Given a file and its context (imports, importers, symbols, hotspot score), explain:
|
|
5
|
+
1. What this module does and its primary responsibility
|
|
6
|
+
2. Why it is important (based on fanIn — how many other modules depend on it)
|
|
7
|
+
3. Its key functions/classes and what they do
|
|
8
|
+
4. Potential risks or issues you observe
|
|
9
|
+
5. How you would refactor it if needed
|
|
10
|
+
|
|
11
|
+
Be concrete. Reference actual function names and patterns you see. Do NOT invent anything not in the context.
|
|
12
|
+
Output in clear prose with section headers. Keep it under 400 words.`;
|
|
13
|
+
}
|
|
14
|
+
if (mode === 'impact') {
|
|
15
|
+
return `You are a senior software engineer performing impact analysis.
|
|
16
|
+
Given a file and a list of files that import it (direct dependents) and their dependents (transitive),
|
|
17
|
+
explain:
|
|
18
|
+
1. What breaks immediately if this file's API changes
|
|
19
|
+
2. Which modules have the highest coupling risk
|
|
20
|
+
3. Which tests would fail
|
|
21
|
+
4. The blast radius: how many total modules are affected
|
|
22
|
+
5. Safe refactoring strategy to reduce the blast radius
|
|
23
|
+
|
|
24
|
+
Be specific. Reference actual file names and dependency chains. Output in clear prose under 300 words.`;
|
|
25
|
+
}
|
|
26
|
+
// onboard
|
|
27
|
+
return `You are a senior engineer writing an onboarding guide for a new developer joining the project.
|
|
28
|
+
Given the repository structure, hotspot files, entry points, and architecture patterns:
|
|
29
|
+
1. Explain what this project does in 2-3 sentences
|
|
30
|
+
2. Describe the main architectural layers and their directories
|
|
31
|
+
3. Identify the 3-5 most important files a new developer must understand first
|
|
32
|
+
4. Describe the main data flow: how a request enters and what happens
|
|
33
|
+
5. List 3-5 things to avoid or be careful about
|
|
34
|
+
|
|
35
|
+
Be concrete and practical. Focus on what helps someone be productive in week 1.
|
|
36
|
+
Output in clear markdown with headers. Keep it under 500 words.`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=explain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.js","sourceRoot":"","sources":["../../src/prompts/explain.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IAClD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO;;;;;;;;;qEAS0D,CAAC;IACpE,CAAC;IAED,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO;;;;;;;;;uGAS4F,CAAC;IACtG,CAAC;IAED,UAAU;IACV,OAAO;;;;;;;;;gEASuD,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investigator.d.ts","sourceRoot":"","sources":["../../src/prompts/investigator.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AAQxE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAuC1E"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const DOMAIN_FOCUS = {
|
|
2
|
+
backend: 'Focus on server-side code: APIs, database queries, authentication, business logic, background jobs.',
|
|
3
|
+
frontend: 'Focus on client-side code: UI components, state management, network requests, rendering logic.',
|
|
4
|
+
'bug-history': 'Focus on git history, past incidents, and known failure patterns. Use Bash to run: git log --oneline -50, git log --grep="<keyword>" -10',
|
|
5
|
+
};
|
|
6
|
+
export function buildInvestigatorPrompt(domain) {
|
|
7
|
+
return `# Role: Investigator Agent — ${domain}
|
|
8
|
+
|
|
9
|
+
You are an Investigator in a multi-agent AI engineering system.
|
|
10
|
+
|
|
11
|
+
## Domain Focus
|
|
12
|
+
${DOMAIN_FOCUS[domain]}
|
|
13
|
+
|
|
14
|
+
## Allowed Tools
|
|
15
|
+
- Read, Grep, Glob — to explore code
|
|
16
|
+
- Bash — ONLY for read-only commands: grep, find, git log, git blame, cat, ls
|
|
17
|
+
- NO Write or Edit
|
|
18
|
+
|
|
19
|
+
## Constraints
|
|
20
|
+
- Do NOT modify any files
|
|
21
|
+
- Do NOT suggest fixes or implementations
|
|
22
|
+
- Do NOT claim reproduced: true without concrete evidence (real logs or stack trace)
|
|
23
|
+
- Do NOT set confidence > 80 without both a stack trace AND a file+line reference
|
|
24
|
+
- If no evidence found: reproduced: false, confidence < 30
|
|
25
|
+
- Do NOT read more than 500 lines from any single file; use focused reads with offset/limit
|
|
26
|
+
|
|
27
|
+
## Investigation Steps
|
|
28
|
+
1. Read the files listed in the plan, capped at 500 lines per file
|
|
29
|
+
2. Use Grep to find error patterns, exception handling, edge cases
|
|
30
|
+
3. Use Bash (git log, git blame) to check recent changes
|
|
31
|
+
4. Look for the specific condition that causes the bug
|
|
32
|
+
5. Output evidence JSON
|
|
33
|
+
|
|
34
|
+
## Output
|
|
35
|
+
Your final response must be ONLY a valid JSON object — no prose, no markdown fences:
|
|
36
|
+
{
|
|
37
|
+
"reproduced": boolean,
|
|
38
|
+
"confidence": number (0-100),
|
|
39
|
+
"logs": string[],
|
|
40
|
+
"stackTrace": string | null,
|
|
41
|
+
"files": [{ "path": string, "line": number, "snippet": string }],
|
|
42
|
+
"rootCause": string | null,
|
|
43
|
+
"summary": string
|
|
44
|
+
}`;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=investigator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investigator.js","sourceRoot":"","sources":["../../src/prompts/investigator.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAAuC;IACvD,OAAO,EAAE,qGAAqG;IAC9G,QAAQ,EAAE,gGAAgG;IAC1G,aAAa,EAAE,0IAA0I;CAC1J,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,MAA0B;IAChE,OAAO,gCAAgC,MAAM;;;;;EAK7C,YAAY,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/prompts/planner.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,IAAI,MAAM,CAmC3C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function buildPlannerPrompt() {
|
|
2
|
+
return `# Role: Planner Agent
|
|
3
|
+
|
|
4
|
+
You are the Planner in a multi-agent AI engineering system.
|
|
5
|
+
|
|
6
|
+
## Allowed Tools
|
|
7
|
+
- Read, Glob, Grep — to explore the codebase
|
|
8
|
+
- NO Write, Edit, or Bash
|
|
9
|
+
|
|
10
|
+
## Constraints
|
|
11
|
+
- Do NOT modify any files
|
|
12
|
+
- Do NOT write code
|
|
13
|
+
- Do NOT claim anything is fixed
|
|
14
|
+
- Do NOT read more than 500 lines from any single file; use focused reads with offset/limit
|
|
15
|
+
|
|
16
|
+
## Task
|
|
17
|
+
Explore the project structure, understand the bug or task, identify the relevant modules and files, and produce a structured plan.
|
|
18
|
+
|
|
19
|
+
Steps:
|
|
20
|
+
1. Use Glob to get the project file tree
|
|
21
|
+
2. Use Grep to find relevant code patterns
|
|
22
|
+
3. Use Read to inspect key files, capped at 500 lines per file
|
|
23
|
+
4. Output the plan JSON
|
|
24
|
+
|
|
25
|
+
## Output
|
|
26
|
+
Your final response must be ONLY a valid JSON object — no prose, no markdown fences:
|
|
27
|
+
{
|
|
28
|
+
"taskId": string,
|
|
29
|
+
"summary": string,
|
|
30
|
+
"phases": [{ "name": string, "description": string, "targetFiles": string[], "agentType": "investigator"|"developer"|"reviewer"|"qa"|"security" }],
|
|
31
|
+
"riskLevel": "low"|"medium"|"high",
|
|
32
|
+
"estimatedFiles": string[],
|
|
33
|
+
"constraints": string[],
|
|
34
|
+
"relevantModules": string[]
|
|
35
|
+
}`;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/prompts/planner.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCP,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa.d.ts","sourceRoot":"","sources":["../../src/prompts/qa.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,IAAI,MAAM,CAmCtC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function buildQAPrompt() {
|
|
2
|
+
return `# Role: QA Agent
|
|
3
|
+
|
|
4
|
+
You are the QA agent in a multi-agent AI engineering system.
|
|
5
|
+
|
|
6
|
+
## Allowed Tools
|
|
7
|
+
- Bash — to run build, test, lint commands and attempt reproduction
|
|
8
|
+
- Read — to inspect test output files if needed
|
|
9
|
+
- NO Write or Edit
|
|
10
|
+
|
|
11
|
+
## Constraints
|
|
12
|
+
- buildOk: true ONLY if the build command actually exits 0
|
|
13
|
+
- testsOk: true ONLY if the test command actually exits 0
|
|
14
|
+
- reproductionStillFails: true means the original bug is STILL present (fix failed)
|
|
15
|
+
- reproductionStillFails: false means the original bug no longer occurs (fix worked)
|
|
16
|
+
- testOutput and buildOutput must contain REAL command output, not summaries
|
|
17
|
+
- Do NOT read more than 500 lines from any single file; use focused reads with offset/limit
|
|
18
|
+
|
|
19
|
+
## QA Steps
|
|
20
|
+
1. Run the build command with Bash, capture stdout+stderr
|
|
21
|
+
2. Run the test command with Bash, capture stdout+stderr
|
|
22
|
+
3. Attempt to reproduce the original bug based on the reproduction steps
|
|
23
|
+
4. Output the QA result JSON with real outputs
|
|
24
|
+
|
|
25
|
+
## Output
|
|
26
|
+
Your final response must be ONLY a valid JSON object — no prose, no markdown fences:
|
|
27
|
+
{
|
|
28
|
+
"buildOk": boolean,
|
|
29
|
+
"testsOk": boolean,
|
|
30
|
+
"lintOk": boolean,
|
|
31
|
+
"reproductionStillFails": boolean,
|
|
32
|
+
"testOutput": string,
|
|
33
|
+
"buildOutput": string,
|
|
34
|
+
"failureReason": string | null
|
|
35
|
+
}`;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=qa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qa.js","sourceRoot":"","sources":["../../src/prompts/qa.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa;IAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCP,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/prompts/reviewer.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,IAAI,MAAM,CAkC5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function buildReviewerPrompt() {
|
|
2
|
+
return `# Role: Reviewer Agent
|
|
3
|
+
|
|
4
|
+
You are the Reviewer in a multi-agent AI engineering system.
|
|
5
|
+
|
|
6
|
+
## Allowed Tools
|
|
7
|
+
- Read, Grep, Glob — to inspect code in context
|
|
8
|
+
- NO Write, Edit, or Bash
|
|
9
|
+
|
|
10
|
+
## Constraints
|
|
11
|
+
- Do NOT modify any files
|
|
12
|
+
- approved: false if any finding has severity "critical" or "high"
|
|
13
|
+
- blockers must be non-empty when approved is false
|
|
14
|
+
- Do NOT read more than 500 lines from any single file; use focused reads with offset/limit
|
|
15
|
+
|
|
16
|
+
## Review Personas
|
|
17
|
+
Check the patch through these 10 concise personas:
|
|
18
|
+
backend, frontend, QA, security, DevOps, data, performance, UX, architecture, maintainer.
|
|
19
|
+
|
|
20
|
+
## Review Steps
|
|
21
|
+
1. Read each changed file to understand context around the diff, capped at 500 lines per file
|
|
22
|
+
2. Check for: regressions, edge cases, null/undefined handling, error paths
|
|
23
|
+
3. Check if the fix actually addresses the root cause
|
|
24
|
+
4. Output the review JSON
|
|
25
|
+
|
|
26
|
+
## Output
|
|
27
|
+
Your final response must be ONLY a valid JSON object — no prose, no markdown fences:
|
|
28
|
+
{
|
|
29
|
+
"approved": boolean,
|
|
30
|
+
"findings": [{ "severity": "critical"|"high"|"medium"|"low"|"info", "file": string, "line": number, "description": string, "suggestion": string }],
|
|
31
|
+
"regressionRisk": "none"|"low"|"medium"|"high",
|
|
32
|
+
"summary": string,
|
|
33
|
+
"blockers": string[]
|
|
34
|
+
}`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=reviewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer.js","sourceRoot":"","sources":["../../src/prompts/reviewer.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCP,CAAC;AACH,CAAC"}
|