terramend 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/LICENSE +661 -0
- package/README.md +145 -0
- package/dist/agents/claude.d.ts +73 -0
- package/dist/agents/claudePretoolGate.d.ts +99 -0
- package/dist/agents/gateServer.d.ts +7 -0
- package/dist/agents/index.d.ts +6 -0
- package/dist/agents/nativeFsDenies.d.ts +28 -0
- package/dist/agents/opencode.d.ts +231 -0
- package/dist/agents/opencodePlugin.d.ts +85 -0
- package/dist/agents/opencodeShared.d.ts +40 -0
- package/dist/agents/postRun.d.ts +132 -0
- package/dist/agents/reviewer.d.ts +38 -0
- package/dist/agents/sessionLabeler.d.ts +97 -0
- package/dist/agents/shared.d.ts +189 -0
- package/dist/agents/subagentModels.d.ts +19 -0
- package/dist/agents/subagentToolGates.d.ts +55 -0
- package/dist/cli.mjs +197426 -0
- package/dist/external.d.ts +227 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +196783 -0
- package/dist/internal/index.d.ts +18 -0
- package/dist/internal.js +1714 -0
- package/dist/lifecycle.d.ts +2 -0
- package/dist/main.d.ts +8 -0
- package/dist/mcp/arkConfig.d.ts +1 -0
- package/dist/mcp/checkSuite.d.ts +25 -0
- package/dist/mcp/checkout.d.ts +77 -0
- package/dist/mcp/comment.d.ts +119 -0
- package/dist/mcp/commitInfo.d.ts +9 -0
- package/dist/mcp/crosswalk.d.ts +105 -0
- package/dist/mcp/dependencies.d.ts +8 -0
- package/dist/mcp/geminiSanitizer.d.ts +28 -0
- package/dist/mcp/git.d.ts +46 -0
- package/dist/mcp/guardrails.d.ts +104 -0
- package/dist/mcp/issue.d.ts +18 -0
- package/dist/mcp/issueComments.d.ts +9 -0
- package/dist/mcp/issueEvents.d.ts +9 -0
- package/dist/mcp/issueInfo.d.ts +9 -0
- package/dist/mcp/labels.d.ts +12 -0
- package/dist/mcp/localContext.d.ts +19 -0
- package/dist/mcp/moduleExtraction.d.ts +71 -0
- package/dist/mcp/moduleTests.d.ts +104 -0
- package/dist/mcp/modules.d.ts +179 -0
- package/dist/mcp/output.d.ts +12 -0
- package/dist/mcp/pathSafety.d.ts +14 -0
- package/dist/mcp/policy.d.ts +48 -0
- package/dist/mcp/pr.d.ts +49 -0
- package/dist/mcp/prInfo.d.ts +9 -0
- package/dist/mcp/providerSchema.d.ts +50 -0
- package/dist/mcp/review.d.ts +199 -0
- package/dist/mcp/reviewComments.d.ts +178 -0
- package/dist/mcp/roots.d.ts +58 -0
- package/dist/mcp/scope.d.ts +15 -0
- package/dist/mcp/selectMode.d.ts +18 -0
- package/dist/mcp/server.d.ts +48 -0
- package/dist/mcp/shared.d.ts +47 -0
- package/dist/mcp/shell.d.ts +37 -0
- package/dist/mcp/staleFix.d.ts +51 -0
- package/dist/mcp/terraform/cost.d.ts +55 -0
- package/dist/mcp/terraform/currency.d.ts +94 -0
- package/dist/mcp/terraform/decisions.d.ts +178 -0
- package/dist/mcp/terraform/findings.d.ts +75 -0
- package/dist/mcp/terraform/plan.d.ts +157 -0
- package/dist/mcp/terraform/scanners.d.ts +131 -0
- package/dist/mcp/terraform/tools.d.ts +63 -0
- package/dist/mcp/terraform/types.d.ts +172 -0
- package/dist/mcp/terraform.d.ts +22 -0
- package/dist/mcp/terratest.d.ts +83 -0
- package/dist/mcp/upload.d.ts +6 -0
- package/dist/models.d.ts +171 -0
- package/dist/modes.d.ts +26 -0
- package/dist/prep/index.d.ts +7 -0
- package/dist/prep/installNodeDependencies.d.ts +2 -0
- package/dist/prep/installPythonDependencies.d.ts +2 -0
- package/dist/prep/types.d.ts +31 -0
- package/dist/reviewQuality.d.ts +64 -0
- package/dist/skills/terraform-best-practices/SKILL.md +369 -0
- package/dist/toolState.d.ts +135 -0
- package/dist/utils/activity.d.ts +40 -0
- package/dist/utils/agent.d.ts +20 -0
- package/dist/utils/agentHangReport.d.ts +38 -0
- package/dist/utils/apiFetch.d.ts +19 -0
- package/dist/utils/apiKeys.d.ts +41 -0
- package/dist/utils/apiUrl.d.ts +20 -0
- package/dist/utils/assets.d.ts +8 -0
- package/dist/utils/billingErrors.d.ts +85 -0
- package/dist/utils/body.d.ts +34 -0
- package/dist/utils/buildTerramendFooter.d.ts +25 -0
- package/dist/utils/byokFallback.d.ts +85 -0
- package/dist/utils/claudeSubscription.d.ts +30 -0
- package/dist/utils/cli.d.ts +10 -0
- package/dist/utils/codexHome.d.ts +29 -0
- package/dist/utils/codexOAuth.d.ts +60 -0
- package/dist/utils/diffCoverage.d.ts +63 -0
- package/dist/utils/errorReport.d.ts +17 -0
- package/dist/utils/exitHandler.d.ts +8 -0
- package/dist/utils/fixDoubleEscapedString.d.ts +1 -0
- package/dist/utils/gitAuth.d.ts +84 -0
- package/dist/utils/gitAuthServer.d.ts +24 -0
- package/dist/utils/github.d.ts +78 -0
- package/dist/utils/globals.d.ts +3 -0
- package/dist/utils/install.d.ts +60 -0
- package/dist/utils/instructions.d.ts +48 -0
- package/dist/utils/leapingComment.d.ts +11 -0
- package/dist/utils/learnings.d.ts +62 -0
- package/dist/utils/learningsTruncate.d.ts +25 -0
- package/dist/utils/lifecycle.d.ts +57 -0
- package/dist/utils/log.d.ts +111 -0
- package/dist/utils/normalizeEnv.d.ts +30 -0
- package/dist/utils/openCodeModels.d.ts +11 -0
- package/dist/utils/overrides.d.ts +40 -0
- package/dist/utils/packageManager.d.ts +49 -0
- package/dist/utils/patchWorkflowRunFields.d.ts +29 -0
- package/dist/utils/payload.d.ts +105 -0
- package/dist/utils/prSummary.d.ts +61 -0
- package/dist/utils/progressComment.d.ts +146 -0
- package/dist/utils/providerErrors.d.ts +31 -0
- package/dist/utils/rangeDiff.d.ts +51 -0
- package/dist/utils/remediationCommand.d.ts +55 -0
- package/dist/utils/retry.d.ts +13 -0
- package/dist/utils/reviewCleanup.d.ts +14 -0
- package/dist/utils/run.d.ts +9 -0
- package/dist/utils/runContext.d.ts +60 -0
- package/dist/utils/runContextData.d.ts +23 -0
- package/dist/utils/runErrorRenderer.d.ts +64 -0
- package/dist/utils/runLifecycle.d.ts +86 -0
- package/dist/utils/runStartupLog.d.ts +15 -0
- package/dist/utils/secrets.d.ts +22 -0
- package/dist/utils/setup.d.ts +90 -0
- package/dist/utils/shell.d.ts +32 -0
- package/dist/utils/skills.d.ts +10 -0
- package/dist/utils/subprocess.d.ts +80 -0
- package/dist/utils/terraformMcp.d.ts +42 -0
- package/dist/utils/time.d.ts +15 -0
- package/dist/utils/timer.d.ts +23 -0
- package/dist/utils/todoTracking.d.ts +16 -0
- package/dist/utils/token.d.ts +39 -0
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/versioning.d.ts +7 -0
- package/dist/utils/vertex.d.ts +16 -0
- package/dist/utils/workflow.d.ts +13 -0
- package/package.json +119 -0
- package/src/agents/claude.test.ts +1016 -0
- package/src/agents/claude.ts +1246 -0
- package/src/agents/claudePretoolGate.test.ts +28 -0
- package/src/agents/claudePretoolGate.ts +173 -0
- package/src/agents/gateServer.test.ts +204 -0
- package/src/agents/gateServer.ts +124 -0
- package/src/agents/index.ts +10 -0
- package/src/agents/nativeFsDenies.ts +82 -0
- package/src/agents/opencode.test.ts +1440 -0
- package/src/agents/opencode.ts +1312 -0
- package/src/agents/opencodePlugin.ts +222 -0
- package/src/agents/opencodeShared.test.ts +34 -0
- package/src/agents/opencodeShared.ts +121 -0
- package/src/agents/postRun.test.ts +549 -0
- package/src/agents/postRun.ts +535 -0
- package/src/agents/reviewer.ts +104 -0
- package/src/agents/sessionLabeler.test.ts +247 -0
- package/src/agents/sessionLabeler.ts +178 -0
- package/src/agents/shared.test.ts +76 -0
- package/src/agents/shared.ts +292 -0
- package/src/agents/subagentModels.test.ts +113 -0
- package/src/agents/subagentModels.ts +40 -0
- package/src/agents/subagentRegistration.test.ts +41 -0
- package/src/agents/subagentToolGates.ts +114 -0
- package/src/cli.test.ts +129 -0
- package/src/cli.ts +105 -0
- package/src/commands/gha.test.ts +192 -0
- package/src/commands/gha.ts +188 -0
- package/src/commands/mcp.ts +122 -0
- package/src/config.ts +1 -0
- package/src/entry.ts +7 -0
- package/src/entryPost.stdlibOnly.test.ts +109 -0
- package/src/entryPost.ts +99 -0
- package/src/external.test.ts +16 -0
- package/src/external.ts +302 -0
- package/src/index.ts +11 -0
- package/src/internal/index.ts +71 -0
- package/src/lifecycle.ts +2 -0
- package/src/main.test.ts +873 -0
- package/src/main.ts +712 -0
- package/src/mcp/__fixtures__/terramend-scratch-pr-49-review-3485940013.json +110 -0
- package/src/mcp/__fixtures__/terramend-scratch-pr-64-review-3531000326.json +14 -0
- package/src/mcp/__fixtures__/terramend-test-repo-pr-1.diff.json +67 -0
- package/src/mcp/__snapshots__/checkout.test.ts.snap +109 -0
- package/src/mcp/__snapshots__/reviewComments.test.ts.snap +71 -0
- package/src/mcp/arkConfig.ts +7 -0
- package/src/mcp/checkSuite.test.ts +245 -0
- package/src/mcp/checkSuite.ts +255 -0
- package/src/mcp/checkout.test.ts +752 -0
- package/src/mcp/checkout.ts +886 -0
- package/src/mcp/comment.test.ts +772 -0
- package/src/mcp/comment.ts +582 -0
- package/src/mcp/commitInfo.test.ts +127 -0
- package/src/mcp/commitInfo.ts +61 -0
- package/src/mcp/crosswalk.test.ts +106 -0
- package/src/mcp/crosswalk.ts +339 -0
- package/src/mcp/dependencies.test.ts +309 -0
- package/src/mcp/dependencies.ts +189 -0
- package/src/mcp/geminiSanitizer.test.ts +287 -0
- package/src/mcp/geminiSanitizer.ts +207 -0
- package/src/mcp/git.test.ts +1083 -0
- package/src/mcp/git.ts +890 -0
- package/src/mcp/guardrails.test.ts +705 -0
- package/src/mcp/guardrails.ts +465 -0
- package/src/mcp/issue.test.ts +113 -0
- package/src/mcp/issue.ts +73 -0
- package/src/mcp/issueComments.test.ts +69 -0
- package/src/mcp/issueComments.ts +48 -0
- package/src/mcp/issueEvents.test.ts +134 -0
- package/src/mcp/issueEvents.ts +100 -0
- package/src/mcp/issueInfo.test.ts +104 -0
- package/src/mcp/issueInfo.ts +72 -0
- package/src/mcp/labels.test.ts +52 -0
- package/src/mcp/labels.ts +34 -0
- package/src/mcp/localContext.ts +28 -0
- package/src/mcp/localServer.test.ts +75 -0
- package/src/mcp/localServer.ts +131 -0
- package/src/mcp/moduleExtraction.test.ts +261 -0
- package/src/mcp/moduleExtraction.ts +313 -0
- package/src/mcp/moduleTests.test.ts +269 -0
- package/src/mcp/moduleTests.ts +421 -0
- package/src/mcp/modules.test.ts +640 -0
- package/src/mcp/modules.ts +696 -0
- package/src/mcp/output.test.ts +96 -0
- package/src/mcp/output.ts +70 -0
- package/src/mcp/pathSafety.test.ts +44 -0
- package/src/mcp/pathSafety.ts +28 -0
- package/src/mcp/policy.test.ts +282 -0
- package/src/mcp/policy.ts +199 -0
- package/src/mcp/pr.test.ts +387 -0
- package/src/mcp/pr.ts +194 -0
- package/src/mcp/prInfo.test.ts +96 -0
- package/src/mcp/prInfo.ts +91 -0
- package/src/mcp/providerSchema.test.ts +85 -0
- package/src/mcp/providerSchema.ts +175 -0
- package/src/mcp/review.test.ts +936 -0
- package/src/mcp/review.ts +923 -0
- package/src/mcp/reviewComments.test.ts +549 -0
- package/src/mcp/reviewComments.ts +896 -0
- package/src/mcp/roots.test.ts +175 -0
- package/src/mcp/roots.ts +217 -0
- package/src/mcp/scope.test.ts +59 -0
- package/src/mcp/scope.ts +65 -0
- package/src/mcp/security.test.ts +720 -0
- package/src/mcp/selectMode.test.ts +210 -0
- package/src/mcp/selectMode.ts +181 -0
- package/src/mcp/server.test.ts +292 -0
- package/src/mcp/server.ts +403 -0
- package/src/mcp/shared.ts +100 -0
- package/src/mcp/shell.test.ts +520 -0
- package/src/mcp/shell.ts +505 -0
- package/src/mcp/staleFix.test.ts +237 -0
- package/src/mcp/staleFix.ts +277 -0
- package/src/mcp/terraform/cost.ts +163 -0
- package/src/mcp/terraform/currency.test.ts +338 -0
- package/src/mcp/terraform/currency.ts +336 -0
- package/src/mcp/terraform/decisions.ts +527 -0
- package/src/mcp/terraform/findings.ts +333 -0
- package/src/mcp/terraform/plan.ts +348 -0
- package/src/mcp/terraform/scanners.ts +809 -0
- package/src/mcp/terraform/tools.test.ts +1071 -0
- package/src/mcp/terraform/tools.ts +908 -0
- package/src/mcp/terraform/types.ts +305 -0
- package/src/mcp/terraform.test.ts +1957 -0
- package/src/mcp/terraform.ts +23 -0
- package/src/mcp/terratest.test.ts +105 -0
- package/src/mcp/terratest.ts +196 -0
- package/src/mcp/toolFiltering.test.ts +85 -0
- package/src/mcp/upload.test.ts +180 -0
- package/src/mcp/upload.ts +112 -0
- package/src/models.test.ts +300 -0
- package/src/models.ts +708 -0
- package/src/modes.test.ts +107 -0
- package/src/modes.ts +880 -0
- package/src/prep/index.ts +43 -0
- package/src/prep/installNodeDependencies.test.ts +298 -0
- package/src/prep/installNodeDependencies.ts +196 -0
- package/src/prep/installPythonDependencies.test.ts +268 -0
- package/src/prep/installPythonDependencies.ts +199 -0
- package/src/prep/types.ts +38 -0
- package/src/reviewQuality.test.ts +63 -0
- package/src/reviewQuality.ts +134 -0
- package/src/runCli.test.ts +214 -0
- package/src/runCli.ts +282 -0
- package/src/skills/terraform-best-practices/SKILL.md +369 -0
- package/src/toolState.test.ts +45 -0
- package/src/toolState.ts +252 -0
- package/src/utils/activity.test.ts +188 -0
- package/src/utils/activity.ts +210 -0
- package/src/utils/agent.test.ts +251 -0
- package/src/utils/agent.ts +139 -0
- package/src/utils/agentHangReport.test.ts +203 -0
- package/src/utils/agentHangReport.ts +170 -0
- package/src/utils/apiFetch.test.ts +115 -0
- package/src/utils/apiFetch.ts +62 -0
- package/src/utils/apiKeys.test.ts +344 -0
- package/src/utils/apiKeys.ts +206 -0
- package/src/utils/apiUrl.test.ts +30 -0
- package/src/utils/apiUrl.ts +59 -0
- package/src/utils/assets.test.ts +153 -0
- package/src/utils/assets.ts +107 -0
- package/src/utils/billingErrors.test.ts +121 -0
- package/src/utils/billingErrors.ts +189 -0
- package/src/utils/body.test.ts +217 -0
- package/src/utils/body.ts +168 -0
- package/src/utils/buildTerramendFooter.test.ts +38 -0
- package/src/utils/buildTerramendFooter.ts +82 -0
- package/src/utils/byokFallback.test.ts +205 -0
- package/src/utils/byokFallback.ts +128 -0
- package/src/utils/claudeSubscription.test.ts +179 -0
- package/src/utils/claudeSubscription.ts +93 -0
- package/src/utils/cli.ts +31 -0
- package/src/utils/codexHome.test.ts +190 -0
- package/src/utils/codexHome.ts +191 -0
- package/src/utils/codexOAuth.ts +147 -0
- package/src/utils/codexRefreshDetect.test.ts +85 -0
- package/src/utils/codexRefreshDetect.ts +35 -0
- package/src/utils/diffCoverage.test.ts +468 -0
- package/src/utils/diffCoverage.ts +404 -0
- package/src/utils/errorReport.test.ts +135 -0
- package/src/utils/errorReport.ts +83 -0
- package/src/utils/exitHandler.ts +35 -0
- package/src/utils/fixDoubleEscapedString.ts +9 -0
- package/src/utils/ghaCore.ts +13 -0
- package/src/utils/gitAuth.test.ts +322 -0
- package/src/utils/gitAuth.ts +263 -0
- package/src/utils/gitAuthServer.test.ts +260 -0
- package/src/utils/gitAuthServer.ts +182 -0
- package/src/utils/github.test.ts +615 -0
- package/src/utils/github.ts +538 -0
- package/src/utils/globals.ts +9 -0
- package/src/utils/humanEditCapture.test.ts +100 -0
- package/src/utils/humanEditCapture.ts +193 -0
- package/src/utils/install.test.ts +768 -0
- package/src/utils/install.ts +492 -0
- package/src/utils/instructions.test.ts +240 -0
- package/src/utils/instructions.ts +543 -0
- package/src/utils/leapingComment.test.ts +51 -0
- package/src/utils/leapingComment.ts +18 -0
- package/src/utils/learnings.test.ts +87 -0
- package/src/utils/learnings.ts +138 -0
- package/src/utils/learningsTocRender.test.ts +116 -0
- package/src/utils/learningsTruncate.test.ts +39 -0
- package/src/utils/learningsTruncate.ts +42 -0
- package/src/utils/lifecycle.test.ts +195 -0
- package/src/utils/lifecycle.ts +198 -0
- package/src/utils/log.test.ts +402 -0
- package/src/utils/log.ts +432 -0
- package/src/utils/normalizeEnv.test.ts +91 -0
- package/src/utils/normalizeEnv.ts +106 -0
- package/src/utils/openCodeModels.ts +82 -0
- package/src/utils/overrides.test.ts +89 -0
- package/src/utils/overrides.ts +98 -0
- package/src/utils/packageManager.test.ts +321 -0
- package/src/utils/packageManager.ts +257 -0
- package/src/utils/patchWorkflowRunFields.test.ts +92 -0
- package/src/utils/patchWorkflowRunFields.ts +150 -0
- package/src/utils/payload.test.ts +497 -0
- package/src/utils/payload.ts +371 -0
- package/src/utils/postApiFetch.ts +51 -0
- package/src/utils/prSummary.test.ts +224 -0
- package/src/utils/prSummary.ts +147 -0
- package/src/utils/progressComment.ts +261 -0
- package/src/utils/providerErrors.test.ts +315 -0
- package/src/utils/providerErrors.ts +172 -0
- package/src/utils/rangeDiff.test.ts +236 -0
- package/src/utils/rangeDiff.ts +182 -0
- package/src/utils/remediationCommand.test.ts +163 -0
- package/src/utils/remediationCommand.ts +119 -0
- package/src/utils/retry.test.ts +153 -0
- package/src/utils/retry.ts +58 -0
- package/src/utils/reviewCleanup.ts +106 -0
- package/src/utils/run.ts +99 -0
- package/src/utils/runContext.ts +145 -0
- package/src/utils/runContextData.ts +58 -0
- package/src/utils/runErrorRenderer.test.ts +95 -0
- package/src/utils/runErrorRenderer.ts +259 -0
- package/src/utils/runFixture.ts +76 -0
- package/src/utils/runLifecycle.ts +237 -0
- package/src/utils/runStartupLog.ts +60 -0
- package/src/utils/secrets.test.ts +103 -0
- package/src/utils/secrets.ts +177 -0
- package/src/utils/setup.test.ts +509 -0
- package/src/utils/setup.ts +352 -0
- package/src/utils/shell.ts +103 -0
- package/src/utils/skills.test.ts +46 -0
- package/src/utils/skills.ts +67 -0
- package/src/utils/subprocess.test.ts +170 -0
- package/src/utils/subprocess.ts +438 -0
- package/src/utils/terraformMcp.test.ts +63 -0
- package/src/utils/terraformMcp.ts +83 -0
- package/src/utils/time.test.ts +105 -0
- package/src/utils/time.ts +59 -0
- package/src/utils/timer.test.ts +91 -0
- package/src/utils/timer.ts +72 -0
- package/src/utils/todoTracking.test.ts +223 -0
- package/src/utils/todoTracking.ts +167 -0
- package/src/utils/token.test.ts +239 -0
- package/src/utils/token.ts +186 -0
- package/src/utils/version.ts +10 -0
- package/src/utils/versioning.test.ts +34 -0
- package/src/utils/versioning.ts +44 -0
- package/src/utils/vertex.ts +85 -0
- package/src/utils/workflow.ts +25 -0
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const GetCheckSuiteLogs: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
check_suite_id: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
type LogLine = {
|
|
6
|
+
line: number;
|
|
7
|
+
content: string;
|
|
8
|
+
type: "error" | "warning" | "failure" | "trace";
|
|
9
|
+
};
|
|
10
|
+
type LogAnalysis = {
|
|
11
|
+
totalLines: number;
|
|
12
|
+
index: LogLine[];
|
|
13
|
+
excerpt: {
|
|
14
|
+
content: string;
|
|
15
|
+
startLine: number;
|
|
16
|
+
endLine: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function analyzeLog(logs: string, excerptLines?: number): LogAnalysis;
|
|
20
|
+
export declare function GetCheckSuiteLogsTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
21
|
+
check_suite_id: number;
|
|
22
|
+
}, {
|
|
23
|
+
check_suite_id: number;
|
|
24
|
+
}>>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { RestEndpointMethodTypes } from "@octokit/rest";
|
|
2
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
3
|
+
type PullFile = RestEndpointMethodTypes["pulls"]["listFiles"]["response"]["data"][number];
|
|
4
|
+
export type FormatFilesResult = {
|
|
5
|
+
content: string;
|
|
6
|
+
toc: string;
|
|
7
|
+
};
|
|
8
|
+
export type FetchAndFormatPrDiffResult = FormatFilesResult & {
|
|
9
|
+
files: PullFile[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* formats PR files with explicit line numbers for each code line.
|
|
13
|
+
* preserves all original diff info (file headers, hunk headers) and adds:
|
|
14
|
+
* | OLD | NEW | TYPE | code
|
|
15
|
+
* returns both the formatted content and a TOC with line ranges per file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatFilesWithLineNumbers(files: PullFile[]): FormatFilesResult;
|
|
18
|
+
export declare const CheckoutPr: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
19
|
+
pull_number: number;
|
|
20
|
+
}, {}>;
|
|
21
|
+
export type CheckoutPrResult = {
|
|
22
|
+
success: true;
|
|
23
|
+
number: number;
|
|
24
|
+
title: string;
|
|
25
|
+
body: string | null;
|
|
26
|
+
base: string;
|
|
27
|
+
localBranch: string;
|
|
28
|
+
remoteBranch: string;
|
|
29
|
+
isFork: boolean;
|
|
30
|
+
maintainerCanModify: boolean;
|
|
31
|
+
url: string;
|
|
32
|
+
headRepo: string;
|
|
33
|
+
diffPath: string;
|
|
34
|
+
incrementalDiffPath?: string | undefined;
|
|
35
|
+
toc: string;
|
|
36
|
+
commitCount: number;
|
|
37
|
+
commitLog: string;
|
|
38
|
+
/** true when commitLog was capped because the PR has more commits than we render */
|
|
39
|
+
commitLogTruncated: boolean;
|
|
40
|
+
/** true when commit metadata could not be computed (e.g. base ref unreachable after shallow fetch). commitCount/commitLog are zero/empty in that case, not "no commits". */
|
|
41
|
+
commitLogUnavailable: boolean;
|
|
42
|
+
/** non-fatal warning from the post-checkout lifecycle hook, if any */
|
|
43
|
+
hookWarning?: string | undefined;
|
|
44
|
+
instructions: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* fetches PR files from GitHub and formats them with line numbers and TOC.
|
|
48
|
+
* this is the core diff formatting logic, extracted for testability.
|
|
49
|
+
*/
|
|
50
|
+
export declare function fetchAndFormatPrDiff(ctx: ToolContext, pullNumber: number): Promise<FetchAndFormatPrDiffResult>;
|
|
51
|
+
import { type GitContext } from "#app/utils/setup";
|
|
52
|
+
export type PrData = {
|
|
53
|
+
number: number;
|
|
54
|
+
headSha: string;
|
|
55
|
+
headRef: string;
|
|
56
|
+
headRepoFullName: string;
|
|
57
|
+
baseRef: string;
|
|
58
|
+
baseRepoFullName: string;
|
|
59
|
+
maintainerCanModify: boolean;
|
|
60
|
+
};
|
|
61
|
+
type CheckoutPrBranchParams = GitContext & {
|
|
62
|
+
beforeSha?: string | undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Shared helper to checkout a PR branch and configure fork remotes.
|
|
66
|
+
* Assumes origin remote is already configured with authentication.
|
|
67
|
+
* Updates toolState.issueNumber, toolState.checkoutSha, and toolState.pushUrl (for fork PRs).
|
|
68
|
+
*/
|
|
69
|
+
export declare function checkoutPrBranch(pr: PrData, params: CheckoutPrBranchParams): Promise<{
|
|
70
|
+
hookWarning?: string | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export declare function CheckoutPrTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
73
|
+
pull_number: number;
|
|
74
|
+
}, {
|
|
75
|
+
pull_number: number;
|
|
76
|
+
}>>;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export { isLeapingIntoActionCommentBody, LEAPING_INTO_ACTION_PREFIX, } from "#app/utils/leapingComment";
|
|
3
|
+
export declare function addFooter(ctx: ToolContext, body: string): string;
|
|
4
|
+
export declare const Comment: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
issueNumber: number;
|
|
6
|
+
body: string;
|
|
7
|
+
type?: "Plan" | "Comment";
|
|
8
|
+
}, {}>;
|
|
9
|
+
export declare function CreateCommentTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
10
|
+
issueNumber: number;
|
|
11
|
+
body: string;
|
|
12
|
+
type?: "Plan" | "Comment";
|
|
13
|
+
}, {
|
|
14
|
+
issueNumber: number;
|
|
15
|
+
body: string;
|
|
16
|
+
type?: "Plan" | "Comment";
|
|
17
|
+
}>>;
|
|
18
|
+
export declare const EditComment: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
19
|
+
commentId: number;
|
|
20
|
+
body: string;
|
|
21
|
+
}, {}>;
|
|
22
|
+
export declare function EditCommentTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
23
|
+
commentId: number;
|
|
24
|
+
body: string;
|
|
25
|
+
}, {
|
|
26
|
+
commentId: number;
|
|
27
|
+
body: string;
|
|
28
|
+
}>>;
|
|
29
|
+
export declare const ReportProgress: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
30
|
+
body: string;
|
|
31
|
+
target_plan_comment?: boolean;
|
|
32
|
+
}, {}>;
|
|
33
|
+
/**
|
|
34
|
+
* Report progress to a GitHub comment.
|
|
35
|
+
*
|
|
36
|
+
* progressComment has three states:
|
|
37
|
+
* - undefined: no comment yet — will create one if an issue/PR target exists
|
|
38
|
+
* - object: active comment — will update it in place via the right REST endpoint for its type
|
|
39
|
+
* - null: deliberately deleted (e.g. after submitting a PR review) — skips silently
|
|
40
|
+
*
|
|
41
|
+
* The body is tracked in lastProgressBody for the job summary regardless of comment state,
|
|
42
|
+
* EXCEPT for `liveProgress` (todo-tracker) writes — see the param note below.
|
|
43
|
+
*
|
|
44
|
+
* The "existing plan comment" path always targets a top-level issue comment (plan comments are
|
|
45
|
+
* created by create_issue_comment with type:"Plan", never as review-thread replies).
|
|
46
|
+
*/
|
|
47
|
+
export declare function reportProgress(ctx: ToolContext, params: {
|
|
48
|
+
body: string;
|
|
49
|
+
target_plan_comment?: boolean;
|
|
50
|
+
liveProgress?: boolean;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
commentId?: number;
|
|
53
|
+
url?: string;
|
|
54
|
+
body: string;
|
|
55
|
+
action: "created" | "updated" | "skipped";
|
|
56
|
+
}>;
|
|
57
|
+
export declare function ReportProgressTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
58
|
+
body: string;
|
|
59
|
+
target_plan_comment?: boolean;
|
|
60
|
+
}, {
|
|
61
|
+
body: string;
|
|
62
|
+
target_plan_comment?: boolean;
|
|
63
|
+
}>>;
|
|
64
|
+
/**
|
|
65
|
+
* Delete the progress comment if it exists.
|
|
66
|
+
* Used by main.ts for stranded-comment cleanup (orphaned "Leaping into action" or
|
|
67
|
+
* checklist left by the todo tracker when the agent didn't call report_progress).
|
|
68
|
+
* Sets progressComment to null so subsequent report_progress calls are no-ops.
|
|
69
|
+
*/
|
|
70
|
+
export declare function deleteProgressComment(ctx: ToolContext): Promise<boolean>;
|
|
71
|
+
export declare const ReplyToReviewComment: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
72
|
+
pull_number: number;
|
|
73
|
+
comment_id: number;
|
|
74
|
+
body: string;
|
|
75
|
+
}, {}>;
|
|
76
|
+
/**
|
|
77
|
+
* decision returned by `duplicateReplyDecision` when a session has already
|
|
78
|
+
* posted an identical reply to the same parent review comment.
|
|
79
|
+
*/
|
|
80
|
+
export interface DuplicateReplyDecision {
|
|
81
|
+
kind: "already-replied";
|
|
82
|
+
commentId: number;
|
|
83
|
+
url: string | undefined;
|
|
84
|
+
reason: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* decide whether a second reply_to_review_comment call in the same session
|
|
88
|
+
* is a duplicate of an earlier reply to the same parent comment.
|
|
89
|
+
*
|
|
90
|
+
* the agent is instructed to call reply_to_review_comment exactly once per
|
|
91
|
+
* parent comment per AddressReviews session, but in practice it sometimes
|
|
92
|
+
* emits the same call twice. PR #610 reproduced this with Kimi K2:
|
|
93
|
+
* identical body posted 3 seconds apart, only one tool_use event in the
|
|
94
|
+
* agent log. the second post is always redundant and clutters the PR thread.
|
|
95
|
+
*
|
|
96
|
+
* we key on (comment_id, bodyWithFooter) so a legitimate follow-up reply
|
|
97
|
+
* with different content still goes through. within a single run the
|
|
98
|
+
* footer is constant (workflow run + model + jobId), so byte-equal bodies
|
|
99
|
+
* catch the stutter without blocking real follow-ups.
|
|
100
|
+
*
|
|
101
|
+
* mirrors the shape of `duplicateReviewDecision` in mcp/review.ts.
|
|
102
|
+
*/
|
|
103
|
+
export declare function duplicateReplyDecision(params: {
|
|
104
|
+
existing: {
|
|
105
|
+
commentId: number;
|
|
106
|
+
url: string | undefined;
|
|
107
|
+
bodyWithFooter: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
bodyWithFooter: string;
|
|
110
|
+
}): DuplicateReplyDecision | null;
|
|
111
|
+
export declare function ReplyToReviewCommentTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
112
|
+
pull_number: number;
|
|
113
|
+
comment_id: number;
|
|
114
|
+
body: string;
|
|
115
|
+
}, {
|
|
116
|
+
pull_number: number;
|
|
117
|
+
comment_id: number;
|
|
118
|
+
body: string;
|
|
119
|
+
}>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const CommitInfo: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
sha: string;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function CommitInfoTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
sha: string;
|
|
7
|
+
}, {
|
|
8
|
+
sha: string;
|
|
9
|
+
}>>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
/**
|
|
3
|
+
* Compliance crosswalk (§differentiator 23 — "explain like I'm the auditor", the
|
|
4
|
+
* seed of the Part-6 moat). Maps a best-practice concern → the control families
|
|
5
|
+
* it touches across UK public-sector + general frameworks, so a remediation can
|
|
6
|
+
* be narrated to an assessor in their own language ("this closes NCSC Cloud
|
|
7
|
+
* Principle 2 / Cyber Essentials Secure Configuration") rather than as a raw
|
|
8
|
+
* scanner rule id.
|
|
9
|
+
*
|
|
10
|
+
* SCOPE / HONESTY: this is a deterministic STARTER rule-pack keyed on the
|
|
11
|
+
* defect's THEME (encryption, public exposure, least-privilege, logging, …),
|
|
12
|
+
* not a certified control-by-control mapping. The durable product is a
|
|
13
|
+
* versioned, framework-revision-pinned crosswalk (Part 6) — so every mapping
|
|
14
|
+
* carries the pack version + date and is labelled indicative, never an audit
|
|
15
|
+
* verdict. No open crosswalk to UK frameworks exists; this is the wedge.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CROSSWALK_VERSION = "0.1.0";
|
|
18
|
+
/** the date this rule-pack's framework references were last reviewed (absolute). */
|
|
19
|
+
export declare const CROSSWALK_REVIEWED = "2026-06-07";
|
|
20
|
+
export interface ControlRef {
|
|
21
|
+
/** the framework, e.g. "NCSC Cloud Security Principles". */
|
|
22
|
+
framework: string;
|
|
23
|
+
/** the control id within that framework, e.g. "Principle 2". */
|
|
24
|
+
control: string;
|
|
25
|
+
/** the control's short title. */
|
|
26
|
+
title: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Map a single concern to the indicative control references it touches. Matches
|
|
30
|
+
* the concern's `rule_id` + `evidence` (and an optional `category`) against the
|
|
31
|
+
* crosswalk themes; unions the controls of every theme that fires. Pure.
|
|
32
|
+
* Returns an empty array when nothing matches (honest — better than a forced
|
|
33
|
+
* mapping). De-duplicates identical control refs.
|
|
34
|
+
*/
|
|
35
|
+
export declare function mapConcernToControls(concern: {
|
|
36
|
+
rule_id: string;
|
|
37
|
+
evidence: string;
|
|
38
|
+
category?: string;
|
|
39
|
+
}): {
|
|
40
|
+
themes: string[];
|
|
41
|
+
controls: ControlRef[];
|
|
42
|
+
};
|
|
43
|
+
export interface ConcernForCrosswalk {
|
|
44
|
+
id: string;
|
|
45
|
+
rule_id: string;
|
|
46
|
+
evidence: string;
|
|
47
|
+
category?: string;
|
|
48
|
+
severity?: string;
|
|
49
|
+
location?: {
|
|
50
|
+
file: string;
|
|
51
|
+
line: number | null;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface CrosswalkEntry {
|
|
55
|
+
concern_id: string;
|
|
56
|
+
rule_id: string;
|
|
57
|
+
themes: string[];
|
|
58
|
+
controls: ControlRef[];
|
|
59
|
+
}
|
|
60
|
+
export interface CrosswalkReport {
|
|
61
|
+
version: string;
|
|
62
|
+
reviewed: string;
|
|
63
|
+
/** per-concern control mappings (only concerns that mapped to ≥1 control). */
|
|
64
|
+
entries: CrosswalkEntry[];
|
|
65
|
+
/** framework → the distinct controls this scan touched, for an auditor index. */
|
|
66
|
+
by_framework: Record<string, {
|
|
67
|
+
control: string;
|
|
68
|
+
title: string;
|
|
69
|
+
}[]>;
|
|
70
|
+
/** concerns that did not map to any control (honest coverage signal). */
|
|
71
|
+
unmapped_concern_ids: string[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Build the auditor crosswalk for a set of concerns: per-concern control refs
|
|
75
|
+
* plus a `by_framework` index (which controls this scan touched, deduped) and an
|
|
76
|
+
* honest `unmapped` list. Pure + deterministic. Carries the pack version + date
|
|
77
|
+
* so the report is reproducible and clearly indicative.
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildCrosswalkReport(concerns: ConcernForCrosswalk[]): CrosswalkReport;
|
|
80
|
+
export declare const ComplianceCrosswalkParams: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
81
|
+
concerns: {
|
|
82
|
+
id: string;
|
|
83
|
+
rule_id: string;
|
|
84
|
+
evidence: string;
|
|
85
|
+
category?: string;
|
|
86
|
+
severity?: string;
|
|
87
|
+
}[];
|
|
88
|
+
}, {}>;
|
|
89
|
+
export declare function ComplianceCrosswalkTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
90
|
+
concerns: {
|
|
91
|
+
id: string;
|
|
92
|
+
rule_id: string;
|
|
93
|
+
evidence: string;
|
|
94
|
+
category?: string;
|
|
95
|
+
severity?: string;
|
|
96
|
+
}[];
|
|
97
|
+
}, {
|
|
98
|
+
concerns: {
|
|
99
|
+
id: string;
|
|
100
|
+
rule_id: string;
|
|
101
|
+
evidence: string;
|
|
102
|
+
category?: string;
|
|
103
|
+
severity?: string;
|
|
104
|
+
}[];
|
|
105
|
+
}>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
/**
|
|
3
|
+
* start dependency installation in the background (non-blocking, idempotent).
|
|
4
|
+
* called eagerly from main.ts at startup and also available via MCP tools.
|
|
5
|
+
*/
|
|
6
|
+
export declare function startInstallation(ctx: ToolContext): void;
|
|
7
|
+
export declare function StartDependencyInstallationTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<object, object>>;
|
|
8
|
+
export declare function AwaitDependencyInstallationTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<object, object>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
import type { Tool } from "fastmcp";
|
|
3
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
4
|
+
/**
|
|
5
|
+
* Recursively transform a JSON schema to gemini's stricter subset.
|
|
6
|
+
* See module header for the exact transforms applied.
|
|
7
|
+
*/
|
|
8
|
+
export declare function sanitizeForGemini(schema: unknown): unknown;
|
|
9
|
+
export declare function wrapSchemaForGemini(schema: StandardSchemaV1<any>): StandardSchemaV1<any>;
|
|
10
|
+
export declare function sanitizeToolForGemini<T extends Tool<any, any>>(tool: T): T;
|
|
11
|
+
/**
|
|
12
|
+
* true when the effective upstream model is — or might become — google
|
|
13
|
+
* generative language API traffic. matches:
|
|
14
|
+
* - direct `google/*`, opencode `opencode/gemini-*`, openrouter
|
|
15
|
+
* `openrouter/google/gemini-*` (slug substring "gemini" wins).
|
|
16
|
+
* - any unresolved specifier: `undefined`, `"auto"`, or a slug that
|
|
17
|
+
* didn't map through the alias registry (no `provider/` prefix).
|
|
18
|
+
* these flow through the agent's own auto-select, which may land
|
|
19
|
+
* on gemini *after* the MCP server has already registered tools —
|
|
20
|
+
* at which point sanitization is too late to apply. erring on the
|
|
21
|
+
* side of sanitizing is safe: cases 1 + 2 are universally
|
|
22
|
+
* compatible JSON-Schema normalizations (enum-only → typed string,
|
|
23
|
+
* collapsible const-unions → string enum); case 3 is gemini-
|
|
24
|
+
* specific but only fires on non-collapsible unions, which arktype
|
|
25
|
+
* does not emit for our current tool schemas. see issue #676 for
|
|
26
|
+
* the prod failure that motivated this widening.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isGeminiRouted(ctx: ToolContext): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare function rejectIfLeadingDash(value: string, kind: string): void;
|
|
3
|
+
export declare function rejectSpecialRef(value: string, kind: string): void;
|
|
4
|
+
export declare function validateTagName(tag: string): void;
|
|
5
|
+
export declare const PushBranch: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
6
|
+
force: import("arktype/internal/attributes.ts").Default<boolean, false>;
|
|
7
|
+
branchName?: string;
|
|
8
|
+
}, {}>;
|
|
9
|
+
export type PushErrorKind = "concurrent-push" | "transient" | "unknown";
|
|
10
|
+
export declare function classifyPushError(msg: string): PushErrorKind;
|
|
11
|
+
export declare function PushBranchTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
12
|
+
branchName?: string;
|
|
13
|
+
force?: boolean;
|
|
14
|
+
}, {
|
|
15
|
+
branchName?: string;
|
|
16
|
+
force?: boolean;
|
|
17
|
+
}>>;
|
|
18
|
+
export declare const AUTH_REQUIRED_REDIRECT: Record<string, string>;
|
|
19
|
+
export declare const NOSHELL_BLOCKED_SUBCOMMANDS: Record<string, string>;
|
|
20
|
+
export declare const NOSHELL_BLOCKED_ARGS: string[];
|
|
21
|
+
export declare function GitTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
22
|
+
command: string;
|
|
23
|
+
args?: string[];
|
|
24
|
+
}, {
|
|
25
|
+
command: string;
|
|
26
|
+
args?: string[];
|
|
27
|
+
}>>;
|
|
28
|
+
export declare function GitFetchTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
29
|
+
ref: string;
|
|
30
|
+
depth?: number;
|
|
31
|
+
}, {
|
|
32
|
+
ref: string;
|
|
33
|
+
depth?: number;
|
|
34
|
+
}>>;
|
|
35
|
+
export declare function DeleteBranchTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
36
|
+
branchName: string;
|
|
37
|
+
}, {
|
|
38
|
+
branchName: string;
|
|
39
|
+
}>>;
|
|
40
|
+
export declare function PushTagsTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
41
|
+
tag: string;
|
|
42
|
+
force?: boolean;
|
|
43
|
+
}, {
|
|
44
|
+
tag: string;
|
|
45
|
+
force?: boolean;
|
|
46
|
+
}>>;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
/**
|
|
3
|
+
* Terraform-write guardrails — hard, code-level limits that back the prompt
|
|
4
|
+
* rules of the modes that write Terraform and open PRs (**Remediate** and
|
|
5
|
+
* **GenerateTerraform**). They only engage for those modes, so every other mode
|
|
6
|
+
* (Build, Fix, Review, …) is completely unaffected.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REMEDIATE_MODE = "Remediate";
|
|
9
|
+
export declare const GENERATE_MODE = "GenerateTerraform";
|
|
10
|
+
/** §27 — the stale-fix self-healing sweep re-derives + force-updates remediation
|
|
11
|
+
* PRs, so it writes Terraform and pushes exactly like Remediate and is bounded by
|
|
12
|
+
* the same guardrails. */
|
|
13
|
+
export declare const REFRESH_REMEDIATION_MODE = "RefreshRemediation";
|
|
14
|
+
/** default paths these modes may modify/create: Terraform sources only. */
|
|
15
|
+
export declare const DEFAULT_ALLOWED_PATHS: readonly ["**/*.tf", "**/*.tfvars"];
|
|
16
|
+
/** §28 — extra paths the Terratest scaffold writes, allowed only when the
|
|
17
|
+
* `terratest` input is enabled (Go test files + native `*.tftest.hcl` tests fall
|
|
18
|
+
* outside the Terraform-only default). */
|
|
19
|
+
export declare const TERRATEST_ALLOWED_PATHS: readonly ["**/*_test.go", "**/*.tftest.hcl", "test/**", "tests/**", "go.mod", "go.sum"];
|
|
20
|
+
export declare function resolveAllowedPaths(ctx: ToolContext): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Compile a glob to an anchored RegExp. Supports `**` (any path segments,
|
|
23
|
+
* including the `**\/` "zero or more leading dirs" idiom), `*` (within a
|
|
24
|
+
* segment), and `?`. Sufficient for the path allow-list patterns
|
|
25
|
+
* (`**\/*.tf`, `modules/**`, `*.tfvars`).
|
|
26
|
+
*/
|
|
27
|
+
export declare function globToRegex(glob: string): RegExp;
|
|
28
|
+
export declare function isPathAllowed(path: string, globs: string[]): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Enforce the path allow-list before a Remediate-mode push. Throws if the
|
|
31
|
+
* branch changed any file outside the allowed globs — the choke point is
|
|
32
|
+
* push_branch, the only way changes reach a PR. Fails closed: if the baseline
|
|
33
|
+
* can't be established it refuses rather than letting an unbounded change
|
|
34
|
+
* through.
|
|
35
|
+
*/
|
|
36
|
+
export declare function enforceRemediationPaths(ctx: ToolContext): void;
|
|
37
|
+
/** glob patterns marking files the fixer must NEVER auto-modify (prod state,
|
|
38
|
+
* data stores, anything sensitive). The inverse of `allowed_paths`. */
|
|
39
|
+
export declare function resolveProtectedPaths(ctx: ToolContext): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Block a push that touched any file matching `protected_paths`. This is the
|
|
42
|
+
* inverse of the allow-list: a changed file matching a protected glob fails the
|
|
43
|
+
* push, even though it's a `.tf`/`.tfvars` the allow-list would otherwise permit.
|
|
44
|
+
* No-op when `protected_paths` is unset or outside a guarded mode. Fails closed:
|
|
45
|
+
* if the run-start baseline can't be established it refuses, same as
|
|
46
|
+
* `enforceRemediationPaths`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function enforceProtectedPaths(ctx: ToolContext): void;
|
|
49
|
+
export interface SecretHit {
|
|
50
|
+
file: string;
|
|
51
|
+
line: number;
|
|
52
|
+
rule: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Scan a unified `git diff` for inlined secrets on ADDED lines only. Tracks the
|
|
56
|
+
* current file from `+++ b/<path>` headers and the new-side line number from
|
|
57
|
+
* `@@` hunk headers, so each hit carries an accurate `file:line`. Pure — the
|
|
58
|
+
* guardrail feeds it `git diff` output. Removed/context lines are ignored (a
|
|
59
|
+
* secret already in the base isn't this run's doing).
|
|
60
|
+
*/
|
|
61
|
+
export declare function scanDiffForSecrets(diff: string): SecretHit[];
|
|
62
|
+
/**
|
|
63
|
+
* Parse a `gitleaks detect --report-format json` report (an array of finding
|
|
64
|
+
* objects) into the shared `SecretHit` shape. Pure, so it's unit-testable
|
|
65
|
+
* without the binary. `gitleaks:` prefixes the rule so a hit's engine is
|
|
66
|
+
* obvious next to the built-in detectors. Tolerates an empty / non-array report.
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseGitleaksReport(json: string): SecretHit[];
|
|
69
|
+
/**
|
|
70
|
+
* Block a push whose diff (since run start) inlines a secret. Reuses the same
|
|
71
|
+
* run-start baseline as the path guardrail. No-op outside a guarded mode. Fails
|
|
72
|
+
* closed on a missing baseline. The diff is read with `$` (restricted env), so
|
|
73
|
+
* no secret leaks into the subprocess.
|
|
74
|
+
*
|
|
75
|
+
* The built-in detectors always run (the deterministic, fail-closed baseline).
|
|
76
|
+
* When the operator opts in via the `gitleaks` input, gitleaks ALSO runs for
|
|
77
|
+
* deeper coverage and its hits are merged — but its absence never weakens the
|
|
78
|
+
* baseline (see scanWithGitleaks).
|
|
79
|
+
*/
|
|
80
|
+
export declare function assertNoSecretsInDiff(ctx: ToolContext): void;
|
|
81
|
+
/** resource addresses the operator has explicitly allowed to be destroyed/replaced. */
|
|
82
|
+
export declare function resolveAllowReplace(ctx: ToolContext): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Block a push that `terraform_plan` showed would DELETE or REPLACE a stateful
|
|
85
|
+
* (data-bearing) resource — RDS, S3, EBS, a SQL database, etc. A best-practice
|
|
86
|
+
* remediation should never destroy data; if the replacement is genuinely
|
|
87
|
+
* intended the operator opts in per-resource via the `allow_replace` input
|
|
88
|
+
* (an address, a glob, or `*`/`all`). No-op outside guarded modes. When no plan
|
|
89
|
+
* ran (no cloud credentials — `terraform_plan` degraded green), there is no
|
|
90
|
+
* evidence to act on and nothing is blocked: this gate engages only on what the
|
|
91
|
+
* plan actually reported, so it strengthens the run when creds are wired and is
|
|
92
|
+
* silent otherwise.
|
|
93
|
+
*/
|
|
94
|
+
export declare function assertNoBlockedDestroy(ctx: ToolContext): void;
|
|
95
|
+
/** maximum remediation PRs a single run may open (default 1). */
|
|
96
|
+
export declare function resolveMaxPrs(ctx: ToolContext): number;
|
|
97
|
+
/**
|
|
98
|
+
* Enforce the per-run PR cap before opening a remediation PR. Throws when the
|
|
99
|
+
* cap is already reached so the agent stops at the configured number of scoped
|
|
100
|
+
* PRs instead of fanning out.
|
|
101
|
+
*/
|
|
102
|
+
export declare function assertUnderPrCap(ctx: ToolContext): void;
|
|
103
|
+
/** record that a guarded-mode PR was opened (after create_pull_request succeeds). */
|
|
104
|
+
export declare function recordRemediationPrOpened(ctx: ToolContext): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const Issue: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
labels?: string[];
|
|
6
|
+
assignees?: string[];
|
|
7
|
+
}, {}>;
|
|
8
|
+
export declare function IssueTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
9
|
+
title: string;
|
|
10
|
+
body: string;
|
|
11
|
+
labels?: string[];
|
|
12
|
+
assignees?: string[];
|
|
13
|
+
}, {
|
|
14
|
+
title: string;
|
|
15
|
+
body: string;
|
|
16
|
+
labels?: string[];
|
|
17
|
+
assignees?: string[];
|
|
18
|
+
}>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const GetIssueComments: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function GetIssueCommentsTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
issue_number: number;
|
|
7
|
+
}, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
}>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const GetIssueEvents: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function GetIssueEventsTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
issue_number: number;
|
|
7
|
+
}, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
}>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const IssueInfo: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function IssueInfoTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
issue_number: number;
|
|
7
|
+
}, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
}>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolContext } from "#app/mcp/server";
|
|
2
|
+
export declare const AddLabelsParams: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
labels: string[];
|
|
5
|
+
}, {}>;
|
|
6
|
+
export declare function AddLabelsTool(ctx: ToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
7
|
+
issue_number: number;
|
|
8
|
+
labels: string[];
|
|
9
|
+
}, {
|
|
10
|
+
issue_number: number;
|
|
11
|
+
labels: string[];
|
|
12
|
+
}>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ToolState } from "#app/toolState";
|
|
2
|
+
import type { ResolvedPayload } from "#app/utils/payload";
|
|
3
|
+
/**
|
|
4
|
+
* The cwd-scoped, GitHub-free subset of `ToolContext` that the read-only
|
|
5
|
+
* Terraform tools depend on. Two providers exist:
|
|
6
|
+
*
|
|
7
|
+
* - the GitHub Action run: the full `ToolContext` (structurally assignable —
|
|
8
|
+
* it carries these fields plus the GitHub/auth surface), and
|
|
9
|
+
* - `terramend mcp` (the local stdio MCP server): exactly this shape, built
|
|
10
|
+
* from CLI flags — no octokit, no tokens, no event payload.
|
|
11
|
+
*
|
|
12
|
+
* Keep this interface to fields a LOCAL run can genuinely provide. A tool that
|
|
13
|
+
* needs more (octokit, push, PR state) belongs on `ToolContext`, not here.
|
|
14
|
+
*/
|
|
15
|
+
export interface LocalToolContext {
|
|
16
|
+
payload: Pick<ResolvedPayload, "cwd" | "scanScope" | "severityThreshold" | "autonomyThreshold" | "costIncreaseBlockUsd" | "moduleCatalogue">;
|
|
17
|
+
toolState: ToolState;
|
|
18
|
+
tmpdir: string;
|
|
19
|
+
}
|