infraweaver 0.1.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 +244 -0
- package/dist/agents/claude.d.ts +113 -0
- package/dist/agents/claudePretoolGate.d.ts +137 -0
- package/dist/agents/dispatchMetrics.d.ts +77 -0
- package/dist/agents/gateServer.d.ts +7 -0
- package/dist/agents/index.d.ts +6 -0
- package/dist/agents/nativeFsDenies.d.ts +46 -0
- package/dist/agents/opencode.d.ts +284 -0
- package/dist/agents/opencodePlugin.d.ts +96 -0
- package/dist/agents/opencodeShared.d.ts +40 -0
- package/dist/agents/postRun.d.ts +126 -0
- package/dist/agents/reviewer.d.ts +41 -0
- package/dist/agents/sessionLabeler.d.ts +97 -0
- package/dist/agents/shared.d.ts +246 -0
- package/dist/agents/subagentModels.d.ts +19 -0
- package/dist/agents/tokenQuota.d.ts +118 -0
- package/dist/agents/writeGateSource.d.ts +22 -0
- package/dist/agents/writePolicy.d.ts +79 -0
- package/dist/brand.d.ts +67 -0
- package/dist/cli.mjs +247846 -0
- package/dist/external.d.ts +227 -0
- package/dist/i18n/scaffolding.d.ts +59 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +247061 -0
- package/dist/internal/index.d.ts +18 -0
- package/dist/internal.js +2398 -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/assess.d.ts +157 -0
- package/dist/mcp/capabilityContext.d.ts +71 -0
- package/dist/mcp/changeSummary.d.ts +52 -0
- package/dist/mcp/checkSuite.d.ts +27 -0
- package/dist/mcp/checkout.d.ts +92 -0
- package/dist/mcp/comment.d.ts +127 -0
- package/dist/mcp/commitInfo.d.ts +11 -0
- package/dist/mcp/crosswalk.d.ts +178 -0
- package/dist/mcp/crosswalkDigest.d.ts +1 -0
- package/dist/mcp/cyberEssentials.d.ts +24 -0
- package/dist/mcp/dashboard.d.ts +125 -0
- package/dist/mcp/dependencies.d.ts +12 -0
- package/dist/mcp/frameworks.d.ts +74 -0
- package/dist/mcp/geminiSanitizer.d.ts +28 -0
- package/dist/mcp/git.d.ts +60 -0
- package/dist/mcp/guardrails.d.ts +222 -0
- package/dist/mcp/issue.d.ts +20 -0
- package/dist/mcp/issueComments.d.ts +11 -0
- package/dist/mcp/issueEvents.d.ts +11 -0
- package/dist/mcp/issueInfo.d.ts +11 -0
- package/dist/mcp/labels.d.ts +14 -0
- package/dist/mcp/localContext.d.ts +26 -0
- package/dist/mcp/moduleExtraction.d.ts +79 -0
- package/dist/mcp/moduleTests.d.ts +106 -0
- package/dist/mcp/modules.d.ts +198 -0
- package/dist/mcp/output.d.ts +16 -0
- package/dist/mcp/pathSafety.d.ts +14 -0
- package/dist/mcp/policy.d.ts +50 -0
- package/dist/mcp/pr.d.ts +64 -0
- package/dist/mcp/prInfo.d.ts +11 -0
- package/dist/mcp/providerSchema.d.ts +52 -0
- package/dist/mcp/review.d.ts +212 -0
- package/dist/mcp/reviewComments.d.ts +245 -0
- package/dist/mcp/roots.d.ts +60 -0
- package/dist/mcp/scope.d.ts +26 -0
- package/dist/mcp/selectMode.d.ts +20 -0
- package/dist/mcp/server.d.ts +61 -0
- package/dist/mcp/shared.d.ts +62 -0
- package/dist/mcp/shell.d.ts +58 -0
- package/dist/mcp/staleFix.d.ts +138 -0
- package/dist/mcp/terraform/azurePrices.d.ts +8 -0
- package/dist/mcp/terraform/baseline.d.ts +57 -0
- package/dist/mcp/terraform/concernResult.d.ts +38 -0
- package/dist/mcp/terraform/cost.d.ts +55 -0
- package/dist/mcp/terraform/cspm.d.ts +80 -0
- package/dist/mcp/terraform/currency.d.ts +110 -0
- package/dist/mcp/terraform/decisions.d.ts +178 -0
- package/dist/mcp/terraform/eidas.d.ts +100 -0
- package/dist/mcp/terraform/evidence.d.ts +343 -0
- package/dist/mcp/terraform/findings.d.ts +76 -0
- package/dist/mcp/terraform/fixMemory.d.ts +81 -0
- package/dist/mcp/terraform/governance.d.ts +56 -0
- package/dist/mcp/terraform/hcl.d.ts +115 -0
- package/dist/mcp/terraform/iacLanguages.d.ts +120 -0
- package/dist/mcp/terraform/idleFloor.d.ts +78 -0
- package/dist/mcp/terraform/keyless.d.ts +68 -0
- package/dist/mcp/terraform/moduleDocs.d.ts +56 -0
- package/dist/mcp/terraform/nativeRules.d.ts +38 -0
- package/dist/mcp/terraform/nativeScan.d.ts +11 -0
- package/dist/mcp/terraform/noiseProfile.d.ts +100 -0
- package/dist/mcp/terraform/normalization.d.ts +52 -0
- package/dist/mcp/terraform/oscal.d.ts +103 -0
- package/dist/mcp/terraform/packs/azurerm-3-4.d.ts +2 -0
- package/dist/mcp/terraform/packs/cloudflare-4-5.d.ts +2 -0
- package/dist/mcp/terraform/paths.d.ts +28 -0
- package/dist/mcp/terraform/plan.d.ts +157 -0
- package/dist/mcp/terraform/planDrift.d.ts +199 -0
- package/dist/mcp/terraform/policyAuthor.d.ts +191 -0
- package/dist/mcp/terraform/prowlerOcsf.d.ts +136 -0
- package/dist/mcp/terraform/refactor.d.ts +183 -0
- package/dist/mcp/terraform/registry.d.ts +108 -0
- package/dist/mcp/terraform/risk.d.ts +41 -0
- package/dist/mcp/terraform/scanSession.d.ts +116 -0
- package/dist/mcp/terraform/scannerCache.d.ts +15 -0
- package/dist/mcp/terraform/scannerEgress.d.ts +72 -0
- package/dist/mcp/terraform/scannerJson.d.ts +13 -0
- package/dist/mcp/terraform/scanners.d.ts +205 -0
- package/dist/mcp/terraform/signing.d.ts +61 -0
- package/dist/mcp/terraform/stateLocking.d.ts +18 -0
- package/dist/mcp/terraform/subprocess.d.ts +43 -0
- package/dist/mcp/terraform/suppressions.d.ts +90 -0
- package/dist/mcp/terraform/taxonomy.d.ts +39 -0
- package/dist/mcp/terraform/tfquery.d.ts +47 -0
- package/dist/mcp/terraform/toolchainIntegrity.d.ts +82 -0
- package/dist/mcp/terraform/tools/authorPolicy.d.ts +59 -0
- package/dist/mcp/terraform/tools/detectPlanDrift.d.ts +20 -0
- package/dist/mcp/terraform/tools/emitCost.d.ts +11 -0
- package/dist/mcp/terraform/tools/emitSarif.d.ts +14 -0
- package/dist/mcp/terraform/tools/fixMemory.d.ts +19 -0
- package/dist/mcp/terraform/tools/infracostDiff.d.ts +22 -0
- package/dist/mcp/terraform/tools/ingestExternalFindings.d.ts +21 -0
- package/dist/mcp/terraform/tools/moduleLookup.d.ts +14 -0
- package/dist/mcp/terraform/tools/moduleSearch.d.ts +23 -0
- package/dist/mcp/terraform/tools/plan.d.ts +59 -0
- package/dist/mcp/terraform/tools/providerUpgrade.d.ts +55 -0
- package/dist/mcp/terraform/tools/readFindings.d.ts +17 -0
- package/dist/mcp/terraform/tools/scan.d.ts +114 -0
- package/dist/mcp/terraform/tools/validate.d.ts +31 -0
- package/dist/mcp/terraform/tools/verifyRemediation.d.ts +31 -0
- package/dist/mcp/terraform/tools/versionCurrency.d.ts +5 -0
- package/dist/mcp/terraform/tools.d.ts +16 -0
- package/dist/mcp/terraform/transformPacks.d.ts +267 -0
- package/dist/mcp/terraform/types.d.ts +226 -0
- package/dist/mcp/terraform/verification.d.ts +81 -0
- package/dist/mcp/terraform/vex.d.ts +115 -0
- package/dist/mcp/terraform/writeOnly.d.ts +67 -0
- package/dist/mcp/terraform.d.ts +51 -0
- package/dist/mcp/terratest.d.ts +85 -0
- package/dist/mcp/untrustedContent.d.ts +76 -0
- package/dist/mcp/upload.d.ts +8 -0
- package/dist/models.d.ts +181 -0
- package/dist/modes/address-reviews.d.ts +2 -0
- package/dist/modes/assess.d.ts +2 -0
- package/dist/modes/build.d.ts +2 -0
- package/dist/modes/compliance-audit.d.ts +2 -0
- package/dist/modes/cost-optimization.d.ts +2 -0
- package/dist/modes/drift-detect.d.ts +2 -0
- package/dist/modes/fix.d.ts +2 -0
- package/dist/modes/incremental-review.d.ts +2 -0
- package/dist/modes/index.d.ts +24 -0
- package/dist/modes/modernize-deprecated.d.ts +2 -0
- package/dist/modes/plan.d.ts +2 -0
- package/dist/modes/policy-gate.d.ts +2 -0
- package/dist/modes/prFormats.d.ts +3 -0
- package/dist/modes/refactor.d.ts +2 -0
- package/dist/modes/refresh-remediation.d.ts +2 -0
- package/dist/modes/remediate-and-refactor.d.ts +2 -0
- package/dist/modes/remediate.d.ts +2 -0
- package/dist/modes/resolve-conflicts.d.ts +2 -0
- package/dist/modes/review.d.ts +2 -0
- package/dist/modes/summarize-pr.d.ts +2 -0
- package/dist/modes/task.d.ts +2 -0
- package/dist/modes/terraform-code-review.d.ts +2 -0
- package/dist/modes/types.d.ts +9 -0
- package/dist/modes/update-dependencies.d.ts +2 -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 +107 -0
- package/dist/skills/terraform-best-practices/SKILL.md +379 -0
- package/dist/toolState.d.ts +123 -0
- package/dist/utils/activity.d.ts +40 -0
- package/dist/utils/agent.d.ts +47 -0
- package/dist/utils/agentHangReport.d.ts +38 -0
- package/dist/utils/annotations.d.ts +17 -0
- package/dist/utils/apiFetch.d.ts +11 -0
- package/dist/utils/apiKeys.d.ts +48 -0
- package/dist/utils/apiUrl.d.ts +28 -0
- package/dist/utils/assets.d.ts +8 -0
- package/dist/utils/baseRefConfig.d.ts +121 -0
- package/dist/utils/billingErrors.d.ts +85 -0
- package/dist/utils/body.d.ts +34 -0
- package/dist/utils/buildInfraweaverFooter.d.ts +29 -0
- package/dist/utils/byokFallback.d.ts +85 -0
- package/dist/utils/changeImpact.d.ts +101 -0
- package/dist/utils/claudeSubscription.d.ts +30 -0
- package/dist/utils/cli.d.ts +10 -0
- package/dist/utils/cloudClient.d.ts +33 -0
- package/dist/utils/cloudFetchCore.d.ts +42 -0
- package/dist/utils/cloudReport.d.ts +114 -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/env.d.ts +46 -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 +104 -0
- package/dist/utils/globals.d.ts +3 -0
- package/dist/utils/infraweaverConfig.d.ts +56 -0
- package/dist/utils/install.d.ts +37 -0
- package/dist/utils/instructions.d.ts +48 -0
- package/dist/utils/keylessOidc.d.ts +28 -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/modelResolver.d.ts +63 -0
- package/dist/utils/moduleFetch.d.ts +39 -0
- package/dist/utils/normalizeEnv.d.ts +30 -0
- package/dist/utils/openCodeModels.d.ts +11 -0
- package/dist/utils/openaiCompatible.d.ts +26 -0
- package/dist/utils/opentofuMcp.d.ts +50 -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 +249 -0
- package/dist/utils/prSummary.d.ts +61 -0
- package/dist/utils/presets.d.ts +36 -0
- package/dist/utils/progressComment.d.ts +146 -0
- package/dist/utils/providerErrors.d.ts +31 -0
- package/dist/utils/proxyModel.d.ts +76 -0
- package/dist/utils/rangeDiff.d.ts +51 -0
- package/dist/utils/redact.d.ts +33 -0
- package/dist/utils/registryAuth.d.ts +52 -0
- package/dist/utils/remediationCommand.d.ts +58 -0
- package/dist/utils/retry.d.ts +38 -0
- package/dist/utils/reviewCleanup.d.ts +14 -0
- package/dist/utils/run.d.ts +9 -0
- package/dist/utils/runContext.d.ts +112 -0
- package/dist/utils/runContextData.d.ts +42 -0
- package/dist/utils/runErrorRenderer.d.ts +64 -0
- package/dist/utils/runLifecycle.d.ts +89 -0
- package/dist/utils/runStartupLog.d.ts +15 -0
- package/dist/utils/secrets.d.ts +34 -0
- package/dist/utils/setup.d.ts +90 -0
- package/dist/utils/shell.d.ts +44 -0
- package/dist/utils/skills.d.ts +10 -0
- package/dist/utils/subprocess.d.ts +81 -0
- package/dist/utils/terraformMcp.d.ts +46 -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 +52 -0
- package/dist/utils/toolLicensing.d.ts +56 -0
- package/dist/utils/toolSelection.d.ts +73 -0
- package/dist/utils/toon.d.ts +16 -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 +132 -0
- package/src/agents/claude.ts +1588 -0
- package/src/agents/claudePretoolGate.ts +286 -0
- package/src/agents/dispatchMetrics.ts +162 -0
- package/src/agents/gateServer.ts +178 -0
- package/src/agents/index.ts +10 -0
- package/src/agents/nativeFsDenies.ts +164 -0
- package/src/agents/opencode.ts +1600 -0
- package/src/agents/opencodePlugin.ts +304 -0
- package/src/agents/opencodeShared.ts +134 -0
- package/src/agents/postRun.ts +615 -0
- package/src/agents/reviewer.ts +134 -0
- package/src/agents/sessionLabeler.ts +185 -0
- package/src/agents/shared.ts +377 -0
- package/src/agents/subagentModels.ts +40 -0
- package/src/agents/tokenQuota.ts +203 -0
- package/src/agents/writeGateSource.ts +148 -0
- package/src/agents/writePolicy.ts +132 -0
- package/src/brand.ts +84 -0
- package/src/cli.ts +117 -0
- package/src/commands/gha.ts +188 -0
- package/src/commands/mcp.ts +126 -0
- package/src/commands/verifyEvidence.ts +100 -0
- package/src/entry.ts +7 -0
- package/src/entryPost.ts +109 -0
- package/src/external.ts +308 -0
- package/src/i18n/scaffolding.ts +191 -0
- package/src/index.ts +7 -0
- package/src/internal/index.ts +74 -0
- package/src/lifecycle.ts +2 -0
- package/src/main.ts +815 -0
- package/src/mcp/__fixtures__/infraweaver-scratch-pr-49-review-3485940013.json +110 -0
- package/src/mcp/__fixtures__/infraweaver-scratch-pr-64-review-3531000326.json +14 -0
- package/src/mcp/__fixtures__/infraweaver-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/assess.ts +723 -0
- package/src/mcp/capabilityContext.ts +80 -0
- package/src/mcp/changeSummary.ts +145 -0
- package/src/mcp/checkSuite.ts +261 -0
- package/src/mcp/checkout.ts +1015 -0
- package/src/mcp/comment.ts +683 -0
- package/src/mcp/commitInfo.ts +57 -0
- package/src/mcp/crosswalk.ts +1253 -0
- package/src/mcp/crosswalkDigest.ts +5 -0
- package/src/mcp/cyberEssentials.ts +60 -0
- package/src/mcp/dashboard.ts +232 -0
- package/src/mcp/dependencies.ts +190 -0
- package/src/mcp/frameworks.ts +236 -0
- package/src/mcp/geminiSanitizer.ts +212 -0
- package/src/mcp/git.ts +1116 -0
- package/src/mcp/guardrails.ts +771 -0
- package/src/mcp/issue.ts +74 -0
- package/src/mcp/issueComments.ts +48 -0
- package/src/mcp/issueEvents.ts +100 -0
- package/src/mcp/issueInfo.ts +72 -0
- package/src/mcp/labels.ts +35 -0
- package/src/mcp/localContext.ts +65 -0
- package/src/mcp/localServer.ts +217 -0
- package/src/mcp/moduleExtraction.ts +368 -0
- package/src/mcp/moduleTests.ts +421 -0
- package/src/mcp/modules.ts +752 -0
- package/src/mcp/output.ts +71 -0
- package/src/mcp/pathSafety.ts +28 -0
- package/src/mcp/policy.ts +226 -0
- package/src/mcp/pr.ts +238 -0
- package/src/mcp/prInfo.ts +91 -0
- package/src/mcp/providerSchema.ts +175 -0
- package/src/mcp/review.ts +1081 -0
- package/src/mcp/reviewComments.ts +1137 -0
- package/src/mcp/roots.ts +217 -0
- package/src/mcp/scope.ts +82 -0
- package/src/mcp/selectMode.ts +207 -0
- package/src/mcp/server.ts +498 -0
- package/src/mcp/shared.ts +120 -0
- package/src/mcp/shell.ts +631 -0
- package/src/mcp/staleFix.ts +557 -0
- package/src/mcp/terraform/__snapshots__/moduleDocs.test.ts.snap +40 -0
- package/src/mcp/terraform/azurePrices.ts +38 -0
- package/src/mcp/terraform/baseline.ts +172 -0
- package/src/mcp/terraform/concernResult.ts +111 -0
- package/src/mcp/terraform/cost.ts +175 -0
- package/src/mcp/terraform/cspm.ts +326 -0
- package/src/mcp/terraform/currency.ts +354 -0
- package/src/mcp/terraform/decisions.ts +590 -0
- package/src/mcp/terraform/eidas.ts +134 -0
- package/src/mcp/terraform/evidence.ts +771 -0
- package/src/mcp/terraform/findings.ts +383 -0
- package/src/mcp/terraform/fixMemory.ts +253 -0
- package/src/mcp/terraform/governance.ts +231 -0
- package/src/mcp/terraform/hcl.ts +273 -0
- package/src/mcp/terraform/iacLanguages.ts +431 -0
- package/src/mcp/terraform/idleFloor.ts +304 -0
- package/src/mcp/terraform/keyless.ts +123 -0
- package/src/mcp/terraform/moduleDocs.ts +303 -0
- package/src/mcp/terraform/nativeRules.ts +152 -0
- package/src/mcp/terraform/nativeScan.ts +67 -0
- package/src/mcp/terraform/noiseProfile.ts +183 -0
- package/src/mcp/terraform/normalization.ts +265 -0
- package/src/mcp/terraform/oscal.ts +283 -0
- package/src/mcp/terraform/packs/azurerm-3-4.ts +382 -0
- package/src/mcp/terraform/packs/cloudflare-4-5.ts +114 -0
- package/src/mcp/terraform/paths.ts +59 -0
- package/src/mcp/terraform/plan.ts +377 -0
- package/src/mcp/terraform/planDrift.ts +520 -0
- package/src/mcp/terraform/policyAuthor.ts +886 -0
- package/src/mcp/terraform/prowlerOcsf.ts +380 -0
- package/src/mcp/terraform/refactor.ts +879 -0
- package/src/mcp/terraform/registry.ts +317 -0
- package/src/mcp/terraform/risk.ts +99 -0
- package/src/mcp/terraform/scanSession.ts +242 -0
- package/src/mcp/terraform/scannerCache.ts +86 -0
- package/src/mcp/terraform/scannerEgress.ts +141 -0
- package/src/mcp/terraform/scannerJson.ts +22 -0
- package/src/mcp/terraform/scanners.ts +1134 -0
- package/src/mcp/terraform/signing.ts +151 -0
- package/src/mcp/terraform/stateLocking.ts +106 -0
- package/src/mcp/terraform/subprocess.ts +102 -0
- package/src/mcp/terraform/suppressions.ts +551 -0
- package/src/mcp/terraform/taxonomy.ts +0 -0
- package/src/mcp/terraform/tfquery.ts +159 -0
- package/src/mcp/terraform/toolchainIntegrity.ts +151 -0
- package/src/mcp/terraform/tools/authorPolicy.ts +185 -0
- package/src/mcp/terraform/tools/detectPlanDrift.ts +279 -0
- package/src/mcp/terraform/tools/emitCost.ts +130 -0
- package/src/mcp/terraform/tools/emitSarif.ts +108 -0
- package/src/mcp/terraform/tools/fixMemory.ts +82 -0
- package/src/mcp/terraform/tools/infracostDiff.ts +110 -0
- package/src/mcp/terraform/tools/ingestExternalFindings.ts +259 -0
- package/src/mcp/terraform/tools/moduleLookup.ts +86 -0
- package/src/mcp/terraform/tools/moduleSearch.ts +46 -0
- package/src/mcp/terraform/tools/plan.ts +384 -0
- package/src/mcp/terraform/tools/providerUpgrade.ts +217 -0
- package/src/mcp/terraform/tools/readFindings.ts +138 -0
- package/src/mcp/terraform/tools/scan.ts +303 -0
- package/src/mcp/terraform/tools/validate.ts +160 -0
- package/src/mcp/terraform/tools/verifyRemediation.ts +190 -0
- package/src/mcp/terraform/tools/versionCurrency.ts +64 -0
- package/src/mcp/terraform/tools.ts +62 -0
- package/src/mcp/terraform/transformPacks.ts +594 -0
- package/src/mcp/terraform/types.ts +382 -0
- package/src/mcp/terraform/verification.ts +150 -0
- package/src/mcp/terraform/vex.ts +367 -0
- package/src/mcp/terraform/writeOnly.ts +252 -0
- package/src/mcp/terraform.ts +52 -0
- package/src/mcp/terratest.ts +215 -0
- package/src/mcp/untrustedContent.ts +126 -0
- package/src/mcp/upload.ts +123 -0
- package/src/models.ts +753 -0
- package/src/modes/address-reviews.ts +35 -0
- package/src/modes/assess.ts +27 -0
- package/src/modes/build.ts +86 -0
- package/src/modes/compliance-audit.ts +25 -0
- package/src/modes/cost-optimization.ts +36 -0
- package/src/modes/drift-detect.ts +31 -0
- package/src/modes/fix.ts +29 -0
- package/src/modes/incremental-review.ts +103 -0
- package/src/modes/index.ts +94 -0
- package/src/modes/modernize-deprecated.ts +36 -0
- package/src/modes/plan.ts +21 -0
- package/src/modes/policy-gate.ts +27 -0
- package/src/modes/prFormats.ts +325 -0
- package/src/modes/refactor.ts +74 -0
- package/src/modes/refresh-remediation.ts +40 -0
- package/src/modes/remediate-and-refactor.ts +42 -0
- package/src/modes/remediate.ts +78 -0
- package/src/modes/resolve-conflicts.ts +32 -0
- package/src/modes/review.ts +135 -0
- package/src/modes/summarize-pr.ts +42 -0
- package/src/modes/task.ts +26 -0
- package/src/modes/terraform-code-review.ts +68 -0
- package/src/modes/types.ts +17 -0
- package/src/modes/update-dependencies.ts +44 -0
- package/src/prep/index.ts +96 -0
- package/src/prep/installNodeDependencies.ts +251 -0
- package/src/prep/installPythonDependencies.ts +235 -0
- package/src/prep/types.ts +38 -0
- package/src/reviewQuality.ts +237 -0
- package/src/runCli.ts +335 -0
- package/src/skills/terraform-best-practices/SKILL.md +379 -0
- package/src/toolState.ts +241 -0
- package/src/utils/activity.ts +210 -0
- package/src/utils/agent.ts +245 -0
- package/src/utils/agentHangReport.ts +180 -0
- package/src/utils/annotations.ts +56 -0
- package/src/utils/apiFetch.ts +19 -0
- package/src/utils/apiKeys.ts +305 -0
- package/src/utils/apiUrl.ts +42 -0
- package/src/utils/assets.ts +123 -0
- package/src/utils/baseRefConfig.ts +254 -0
- package/src/utils/billingErrors.ts +210 -0
- package/src/utils/body.ts +168 -0
- package/src/utils/buildInfraweaverFooter.ts +104 -0
- package/src/utils/byokFallback.ts +137 -0
- package/src/utils/changeImpact.ts +330 -0
- package/src/utils/claudeSubscription.ts +93 -0
- package/src/utils/cli.ts +36 -0
- package/src/utils/cloudClient.ts +57 -0
- package/src/utils/cloudFetchCore.ts +139 -0
- package/src/utils/cloudReport.ts +316 -0
- package/src/utils/codexHome.ts +204 -0
- package/src/utils/codexOAuth.ts +154 -0
- package/src/utils/codexRefreshDetect.ts +36 -0
- package/src/utils/diffCoverage.ts +404 -0
- package/src/utils/env.ts +84 -0
- package/src/utils/errorReport.ts +94 -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.ts +268 -0
- package/src/utils/gitAuthServer.ts +186 -0
- package/src/utils/github.ts +676 -0
- package/src/utils/globals.ts +9 -0
- package/src/utils/humanEditCapture.ts +198 -0
- package/src/utils/infraweaverConfig.ts +202 -0
- package/src/utils/install.ts +279 -0
- package/src/utils/instructions.ts +640 -0
- package/src/utils/keylessOidc.ts +47 -0
- package/src/utils/leapingComment.ts +20 -0
- package/src/utils/learnings.ts +145 -0
- package/src/utils/learningsTruncate.ts +42 -0
- package/src/utils/lifecycle.ts +198 -0
- package/src/utils/log.ts +452 -0
- package/src/utils/modelResolver.ts +105 -0
- package/src/utils/moduleFetch.ts +138 -0
- package/src/utils/normalizeEnv.ts +106 -0
- package/src/utils/openCodeModels.ts +86 -0
- package/src/utils/openaiCompatible.ts +52 -0
- package/src/utils/opentofuMcp.ts +61 -0
- package/src/utils/overrides.ts +100 -0
- package/src/utils/packageManager.ts +257 -0
- package/src/utils/patchWorkflowRunFields.ts +173 -0
- package/src/utils/payload.ts +1206 -0
- package/src/utils/prSummary.ts +148 -0
- package/src/utils/presets.ts +105 -0
- package/src/utils/progressComment.ts +266 -0
- package/src/utils/providerErrors.ts +189 -0
- package/src/utils/proxyModel.ts +239 -0
- package/src/utils/rangeDiff.ts +182 -0
- package/src/utils/redact.ts +86 -0
- package/src/utils/registryAuth.ts +115 -0
- package/src/utils/remediationCommand.ts +144 -0
- package/src/utils/retry.ts +180 -0
- package/src/utils/reviewCleanup.ts +116 -0
- package/src/utils/run.ts +100 -0
- package/src/utils/runContext.ts +276 -0
- package/src/utils/runContextData.ts +121 -0
- package/src/utils/runErrorRenderer.ts +282 -0
- package/src/utils/runFixture.ts +91 -0
- package/src/utils/runLifecycle.ts +360 -0
- package/src/utils/runStartupLog.ts +67 -0
- package/src/utils/secrets.ts +208 -0
- package/src/utils/setup.ts +368 -0
- package/src/utils/shell.ts +132 -0
- package/src/utils/skills.ts +67 -0
- package/src/utils/subprocess.ts +474 -0
- package/src/utils/terraformMcp.ts +99 -0
- package/src/utils/time.ts +59 -0
- package/src/utils/timer.ts +72 -0
- package/src/utils/todoTracking.ts +168 -0
- package/src/utils/token.ts +294 -0
- package/src/utils/toolLicensing.ts +152 -0
- package/src/utils/toolSelection.ts +239 -0
- package/src/utils/toon.ts +76 -0
- package/src/utils/version.ts +10 -0
- package/src/utils/versioning.ts +44 -0
- package/src/utils/vertex.ts +94 -0
- package/src/utils/workflow.ts +25 -0
package/src/mcp/issue.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
import type { GitHubWriteToolContext } from "#app/mcp/capabilityContext";
|
|
3
|
+
import { recordCreatedTarget } from "#app/mcp/scope";
|
|
4
|
+
import { execute, tool } from "#app/mcp/shared";
|
|
5
|
+
import { log } from "#app/utils/cli";
|
|
6
|
+
import { fixDoubleEscapedString } from "#app/utils/fixDoubleEscapedString";
|
|
7
|
+
import { patchWorkflowRunFields } from "#app/utils/patchWorkflowRunFields";
|
|
8
|
+
|
|
9
|
+
export const Issue = type({
|
|
10
|
+
title: type.string.describe("the title of the issue"),
|
|
11
|
+
body: type.string.describe("the body content of the issue"),
|
|
12
|
+
labels: type.string
|
|
13
|
+
.array()
|
|
14
|
+
.describe("optional array of label names to apply to the issue")
|
|
15
|
+
.optional(),
|
|
16
|
+
assignees: type.string
|
|
17
|
+
.array()
|
|
18
|
+
.describe("optional array of usernames to assign to the issue")
|
|
19
|
+
.optional(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export function IssueTool(ctx: GitHubWriteToolContext) {
|
|
23
|
+
return tool({
|
|
24
|
+
mutates: true,
|
|
25
|
+
name: "create_issue",
|
|
26
|
+
description: "Create a new GitHub issue",
|
|
27
|
+
parameters: Issue,
|
|
28
|
+
execute: execute(async (params) => {
|
|
29
|
+
// permission gate: creating an issue is a repo write. `push: disabled`
|
|
30
|
+
// means read-only access, so block it (matches create_pull_request /
|
|
31
|
+
// push_branch) — an injected or read-only-intended agent must not be able
|
|
32
|
+
// to file issues.
|
|
33
|
+
if (ctx.payload.push === "disabled") {
|
|
34
|
+
throw new Error(
|
|
35
|
+
"Creating an issue is disabled. This repository is configured for read-only access (push: disabled).",
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const result = await ctx.octokit.rest.issues.create({
|
|
40
|
+
owner: ctx.repo.owner,
|
|
41
|
+
repo: ctx.repo.name,
|
|
42
|
+
title: params.title,
|
|
43
|
+
body: fixDoubleEscapedString(params.body),
|
|
44
|
+
labels: params.labels ?? [],
|
|
45
|
+
assignees: params.assignees ?? [],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
log.info(`» created issue #${result.data.number} (id ${result.data.id})`);
|
|
49
|
+
|
|
50
|
+
// record so a later comment on / label of THIS issue passes the scope guard.
|
|
51
|
+
recordCreatedTarget(ctx, result.data.number);
|
|
52
|
+
|
|
53
|
+
const nodeId = result.data.node_id;
|
|
54
|
+
if (typeof nodeId === "string" && nodeId.length > 0) {
|
|
55
|
+
await patchWorkflowRunFields(ctx, {
|
|
56
|
+
issueNodeId: nodeId,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
success: true,
|
|
62
|
+
issueId: result.data.id,
|
|
63
|
+
number: result.data.number,
|
|
64
|
+
url: result.data.html_url,
|
|
65
|
+
title: result.data.title,
|
|
66
|
+
state: result.data.state,
|
|
67
|
+
labels: result.data.labels?.map((label) =>
|
|
68
|
+
typeof label === "string" ? label : label.name,
|
|
69
|
+
),
|
|
70
|
+
assignees: result.data.assignees?.map((assignee) => assignee.login),
|
|
71
|
+
};
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
3
|
+
import { execute, tool } from "#app/mcp/shared";
|
|
4
|
+
import { resolveBodyAssets } from "#app/utils/body";
|
|
5
|
+
|
|
6
|
+
export const GetIssueComments = type({
|
|
7
|
+
issue_number: type.number.describe("The issue number to get comments for"),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export function GetIssueCommentsTool(ctx: GitHubToolContext) {
|
|
11
|
+
return tool({
|
|
12
|
+
name: "get_issue_comments",
|
|
13
|
+
description:
|
|
14
|
+
"Get all comments for a GitHub issue. Returns all comments including the issue body and all subsequent discussion comments. " +
|
|
15
|
+
"Example: `get_issue_comments({ issue_number: 1234 })`.",
|
|
16
|
+
parameters: GetIssueComments,
|
|
17
|
+
execute: execute(async ({ issue_number }) => {
|
|
18
|
+
// set issue context
|
|
19
|
+
ctx.toolState.issueNumber = issue_number;
|
|
20
|
+
|
|
21
|
+
const comments = await ctx.octokit.paginate(ctx.octokit.rest.issues.listComments, {
|
|
22
|
+
owner: ctx.repo.owner,
|
|
23
|
+
repo: ctx.repo.name,
|
|
24
|
+
issue_number,
|
|
25
|
+
headers: { accept: "application/vnd.github.full+json" },
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const processedComments = await Promise.all(
|
|
29
|
+
comments.map(async (comment) => ({
|
|
30
|
+
id: comment.id,
|
|
31
|
+
body: await resolveBodyAssets({
|
|
32
|
+
body: comment.body,
|
|
33
|
+
bodyHtml: comment.body_html,
|
|
34
|
+
tmpdir: ctx.tmpdir,
|
|
35
|
+
githubToken: ctx.githubInstallationToken,
|
|
36
|
+
}),
|
|
37
|
+
user: comment.user?.login,
|
|
38
|
+
})),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
issue_number,
|
|
43
|
+
comments: processedComments,
|
|
44
|
+
count: processedComments.length,
|
|
45
|
+
};
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
3
|
+
import { execute, tool } from "#app/mcp/shared";
|
|
4
|
+
|
|
5
|
+
export const GetIssueEvents = type({
|
|
6
|
+
issue_number: type.number.describe("The issue number to get events for"),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export function GetIssueEventsTool(ctx: GitHubToolContext) {
|
|
10
|
+
return tool({
|
|
11
|
+
name: "get_issue_events",
|
|
12
|
+
description:
|
|
13
|
+
"Get timeline events for a GitHub issue that aren't reflected in the current state. Returns cross-references to other issues/PRs and commit references. Note: current labels, assignees, state, and milestone are already available via get_issue.",
|
|
14
|
+
parameters: GetIssueEvents,
|
|
15
|
+
execute: execute(async ({ issue_number }) => {
|
|
16
|
+
// set issue context
|
|
17
|
+
ctx.toolState.issueNumber = issue_number;
|
|
18
|
+
|
|
19
|
+
const events = await ctx.octokit.paginate(ctx.octokit.rest.issues.listEventsForTimeline, {
|
|
20
|
+
owner: ctx.repo.owner,
|
|
21
|
+
repo: ctx.repo.name,
|
|
22
|
+
issue_number,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Only include events not reflected in current issue state (get_issue already has labels, assignees, state, etc.)
|
|
26
|
+
// Keep only relationship/reference events that show connections to other issues/PRs/commits
|
|
27
|
+
const relevantEventTypes = new Set(["cross_referenced", "referenced"]);
|
|
28
|
+
|
|
29
|
+
const parsedEvents = events.flatMap((event) => {
|
|
30
|
+
// octokit's timeline-event union includes members with `event?:
|
|
31
|
+
// string`, so `"event" in event` does not narrow it to defined.
|
|
32
|
+
// require a string before the Set.has() check.
|
|
33
|
+
if (!("event" in event) || typeof event.event !== "string") return [];
|
|
34
|
+
if (!relevantEventTypes.has(event.event)) return [];
|
|
35
|
+
|
|
36
|
+
const baseEvent: Record<string, any> = {
|
|
37
|
+
event: event.event,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Common fields
|
|
41
|
+
if ("id" in event) {
|
|
42
|
+
baseEvent.id = event.id;
|
|
43
|
+
}
|
|
44
|
+
if ("actor" in event && event.actor) {
|
|
45
|
+
baseEvent.actor = event.actor.login;
|
|
46
|
+
} else if ("user" in event && event.user) {
|
|
47
|
+
baseEvent.actor = event.user.login;
|
|
48
|
+
}
|
|
49
|
+
if ("created_at" in event) {
|
|
50
|
+
baseEvent.created_at = event.created_at;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Event-specific data
|
|
54
|
+
if (event.event === "cross_referenced") {
|
|
55
|
+
if ("source" in event && event.source) {
|
|
56
|
+
const source = event.source as {
|
|
57
|
+
type?: string;
|
|
58
|
+
issue?: { number: number; title: string; html_url: string };
|
|
59
|
+
pull_request?: { number: number; title: string; html_url: string };
|
|
60
|
+
};
|
|
61
|
+
baseEvent.source = {
|
|
62
|
+
type: source.type,
|
|
63
|
+
issue: source.issue
|
|
64
|
+
? {
|
|
65
|
+
number: source.issue.number,
|
|
66
|
+
title: source.issue.title,
|
|
67
|
+
html_url: source.issue.html_url,
|
|
68
|
+
}
|
|
69
|
+
: null,
|
|
70
|
+
pull_request: source.pull_request
|
|
71
|
+
? {
|
|
72
|
+
number: source.pull_request.number,
|
|
73
|
+
title: source.pull_request.title,
|
|
74
|
+
html_url: source.pull_request.html_url,
|
|
75
|
+
}
|
|
76
|
+
: null,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (event.event === "referenced") {
|
|
82
|
+
if ("commit_id" in event) {
|
|
83
|
+
baseEvent.commit_id = event.commit_id;
|
|
84
|
+
}
|
|
85
|
+
if ("commit_url" in event) {
|
|
86
|
+
baseEvent.commit_url = event.commit_url;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return [baseEvent];
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
issue_number,
|
|
95
|
+
events: parsedEvents,
|
|
96
|
+
count: parsedEvents.length,
|
|
97
|
+
};
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
3
|
+
import { execute, tool } from "#app/mcp/shared";
|
|
4
|
+
import { resolveBodyAssets } from "#app/utils/body";
|
|
5
|
+
|
|
6
|
+
export const IssueInfo = type({
|
|
7
|
+
issue_number: type.number.describe("The issue number to fetch"),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export function IssueInfoTool(ctx: GitHubToolContext) {
|
|
11
|
+
return tool({
|
|
12
|
+
name: "get_issue",
|
|
13
|
+
description:
|
|
14
|
+
"Retrieve GitHub issue information by issue number. " +
|
|
15
|
+
"Example: `get_issue({ issue_number: 1234 })`.",
|
|
16
|
+
parameters: IssueInfo,
|
|
17
|
+
execute: execute(async ({ issue_number }) => {
|
|
18
|
+
const issue = await ctx.octokit.rest.issues.get({
|
|
19
|
+
owner: ctx.repo.owner,
|
|
20
|
+
repo: ctx.repo.name,
|
|
21
|
+
issue_number,
|
|
22
|
+
headers: { accept: "application/vnd.github.full+json" },
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const data = issue.data;
|
|
26
|
+
|
|
27
|
+
const body = await resolveBodyAssets({
|
|
28
|
+
body: data.body,
|
|
29
|
+
bodyHtml: data.body_html,
|
|
30
|
+
tmpdir: ctx.tmpdir,
|
|
31
|
+
githubToken: ctx.githubInstallationToken,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// set issue context
|
|
35
|
+
ctx.toolState.issueNumber = issue_number;
|
|
36
|
+
|
|
37
|
+
const hints: string[] = [];
|
|
38
|
+
if (data.comments > 0) {
|
|
39
|
+
hints.push("use get_issue_comments to retrieve all comments for this issue");
|
|
40
|
+
}
|
|
41
|
+
hints.push(
|
|
42
|
+
"use get_issue_events to retrieve cross-references and commit references (relationships not reflected in current state)",
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
number: data.number,
|
|
47
|
+
url: data.html_url,
|
|
48
|
+
title: data.title,
|
|
49
|
+
body: body,
|
|
50
|
+
state: data.state,
|
|
51
|
+
locked: data.locked,
|
|
52
|
+
labels: data.labels?.map((label) => (typeof label === "string" ? label : label.name)),
|
|
53
|
+
assignees: data.assignees?.map((assignee) => assignee.login),
|
|
54
|
+
user: data.user?.login,
|
|
55
|
+
created_at: data.created_at,
|
|
56
|
+
updated_at: data.updated_at,
|
|
57
|
+
closed_at: data.closed_at,
|
|
58
|
+
comments: data.comments,
|
|
59
|
+
milestone: data.milestone?.title,
|
|
60
|
+
pull_request: data.pull_request
|
|
61
|
+
? {
|
|
62
|
+
url: data.pull_request.url,
|
|
63
|
+
html_url: data.pull_request.html_url,
|
|
64
|
+
diff_url: data.pull_request.diff_url,
|
|
65
|
+
patch_url: data.pull_request.patch_url,
|
|
66
|
+
}
|
|
67
|
+
: null,
|
|
68
|
+
hints,
|
|
69
|
+
};
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type } from "arktype";
|
|
2
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
3
|
+
import { assertTargetInScope } from "#app/mcp/scope";
|
|
4
|
+
import { execute, tool } from "#app/mcp/shared";
|
|
5
|
+
import { log } from "#app/utils/cli";
|
|
6
|
+
|
|
7
|
+
export const AddLabelsParams = type({
|
|
8
|
+
issue_number: type.number.describe("the issue or PR number to add labels to"),
|
|
9
|
+
labels: type.string.array().atLeastLength(1).describe("array of label names to add"),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export function AddLabelsTool(ctx: GitHubToolContext) {
|
|
13
|
+
return tool({
|
|
14
|
+
mutates: true,
|
|
15
|
+
name: "add_labels",
|
|
16
|
+
description:
|
|
17
|
+
"Add labels to a GitHub issue or pull request. Only use labels that already exist in the repository.",
|
|
18
|
+
parameters: AddLabelsParams,
|
|
19
|
+
execute: execute(async ({ issue_number, labels }) => {
|
|
20
|
+
assertTargetInScope(ctx, issue_number, "add labels to");
|
|
21
|
+
const result = await ctx.octokit.rest.issues.addLabels({
|
|
22
|
+
owner: ctx.repo.owner,
|
|
23
|
+
repo: ctx.repo.name,
|
|
24
|
+
issue_number,
|
|
25
|
+
labels,
|
|
26
|
+
});
|
|
27
|
+
log.info(`» added labels [${labels.join(", ")}] to issue #${issue_number}`);
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
success: true,
|
|
31
|
+
labels: result.data.map((label) => label.name),
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ToolState } from "#app/toolState";
|
|
2
|
+
import type { ResolvedPayload } from "#app/utils/payload";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The cwd-scoped, GitHub-free subset of `ToolContext` that the read-only
|
|
6
|
+
* Terraform tools depend on. Two providers exist:
|
|
7
|
+
*
|
|
8
|
+
* - the GitHub Action run: the full `ToolContext` (structurally assignable —
|
|
9
|
+
* it carries these fields plus the GitHub/auth surface), and
|
|
10
|
+
* - `infraweaver mcp` (the local stdio MCP server): exactly this shape, built
|
|
11
|
+
* from CLI flags — no octokit, no tokens, no event payload.
|
|
12
|
+
*
|
|
13
|
+
* Keep this interface to fields a LOCAL run can genuinely provide. A tool that
|
|
14
|
+
* needs more (octokit, push, PR state) belongs on `ToolContext`, not here.
|
|
15
|
+
*/
|
|
16
|
+
export interface LocalToolContext {
|
|
17
|
+
payload: Pick<
|
|
18
|
+
ResolvedPayload,
|
|
19
|
+
| "cwd"
|
|
20
|
+
| "scanScope"
|
|
21
|
+
// multi-language Assess scope: which IaC languages the READ-ONLY surfaces
|
|
22
|
+
// (Assess / SARIF / evidence) report on ("auto" | "terraform" | comma list).
|
|
23
|
+
// The fix loop stays Terraform-first regardless of this.
|
|
24
|
+
| "iacLanguages"
|
|
25
|
+
| "severityThreshold"
|
|
26
|
+
| "grouping"
|
|
27
|
+
| "autonomyThreshold"
|
|
28
|
+
| "costIncreaseBlockUsd"
|
|
29
|
+
| "moduleCatalogue"
|
|
30
|
+
// resource addresses the operator allows to be destroyed/replaced. Read by
|
|
31
|
+
// terraform_plan (read-only) to surface, at plan time, whether a stateful
|
|
32
|
+
// destroy/replace WOULD be blocked at push — moving the allow_replace gate
|
|
33
|
+
// earlier so a committing mode abandons before a wasted commit/push.
|
|
34
|
+
| "allowReplace"
|
|
35
|
+
// the unified tool selection + module-fetch/registry credentials are honoured
|
|
36
|
+
// on the local stdio MCP server too (read-only scans + private-module init).
|
|
37
|
+
| "toolsEnabled"
|
|
38
|
+
// per-scanner egress policy (supply-chain 0.2) — honoured wherever the
|
|
39
|
+
// scanners run, so a local session gets the same bounded-egress toolchain.
|
|
40
|
+
| "toolsNetwork"
|
|
41
|
+
| "gitleaks"
|
|
42
|
+
| "terratest"
|
|
43
|
+
| "docs"
|
|
44
|
+
| "terraformMcp"
|
|
45
|
+
| "moduleFetchToken"
|
|
46
|
+
| "moduleFetchSshKey"
|
|
47
|
+
| "registryToken"
|
|
48
|
+
| "registryHost"
|
|
49
|
+
| "opentofuMcp"
|
|
50
|
+
// §5.12 reusable proven-fix memory: capture proven transformations + offer
|
|
51
|
+
// them as priors (via the read-only terraform_fix_memory tool). Honoured on
|
|
52
|
+
// the local stdio MCP server too, so a CLI/IDE session benefits from a
|
|
53
|
+
// committed `.infraweaver.fix-memory.json`.
|
|
54
|
+
| "fixMemory"
|
|
55
|
+
>;
|
|
56
|
+
toolState: ToolState;
|
|
57
|
+
tmpdir: string;
|
|
58
|
+
/** resolved upstream model specifier driving this run's agent (e.g.
|
|
59
|
+
* "anthropic/claude-opus-4-8"). The Action's full `ToolContext` carries it
|
|
60
|
+
* (structurally assignable); a local `infraweaver mcp` session has no agent of
|
|
61
|
+
* its own, so it is absent there. Read by `terraform_emit_evidence` for the
|
|
62
|
+
* bundle's PROVENANCE block (A.3) — recording WHO produced the evidence, not
|
|
63
|
+
* just what was found. */
|
|
64
|
+
resolvedModel?: string | undefined;
|
|
65
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `infraweaver mcp` — the LOCAL stdio MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Exposes infraweaver's read-only Terraform intelligence (scan, validate, verify,
|
|
5
|
+
* plan, currency, modules, provider schema, roots) to MCP clients — Claude Code,
|
|
6
|
+
* Cursor, Windsurf — over stdio, scoped to a working directory.
|
|
7
|
+
*
|
|
8
|
+
* Security boundary: this surface must stay GITHUB-FREE and WRITE-FREE. It is
|
|
9
|
+
* built from `LocalToolContext` (no octokit, no tokens, no event payload), so a
|
|
10
|
+
* tool that pushes, comments, or opens PRs cannot even type-check here. The
|
|
11
|
+
* one file-writing exception is `terraform_emit_sarif`, which writes a report
|
|
12
|
+
* the USER asked for into the workspace — not repo state.
|
|
13
|
+
*
|
|
14
|
+
* stdout discipline: stdout is the JSON-RPC channel. The caller MUST call
|
|
15
|
+
* `setLogSink("stderr")` before `startLocalMcpServer` (the `mcp` CLI command
|
|
16
|
+
* does) so tool diagnostics land on stderr.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { mkdtempSync } from "node:fs";
|
|
20
|
+
import { tmpdir } from "node:os";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { FastMCP, type Tool } from "fastmcp";
|
|
23
|
+
import { PRODUCT_SLUG } from "#app/brand";
|
|
24
|
+
import { infraweaverMcpName } from "#app/external";
|
|
25
|
+
import { TerraformAssessTool } from "#app/mcp/assess";
|
|
26
|
+
import type { LocalToolContext } from "#app/mcp/localContext";
|
|
27
|
+
import { ModuleExtractionCandidatesTool } from "#app/mcp/moduleExtraction";
|
|
28
|
+
import {
|
|
29
|
+
ListModulesTool,
|
|
30
|
+
TerraformModuleGraphTool,
|
|
31
|
+
TerraformModuleInterfaceTool,
|
|
32
|
+
} from "#app/mcp/modules";
|
|
33
|
+
import { TerraformModuleTestsTool } from "#app/mcp/moduleTests";
|
|
34
|
+
import { TerraformProviderSchemaTool } from "#app/mcp/providerSchema";
|
|
35
|
+
import { TerraformRootsTool } from "#app/mcp/roots";
|
|
36
|
+
import {
|
|
37
|
+
DetectPlanDriftTool,
|
|
38
|
+
InfracostDiffTool,
|
|
39
|
+
IngestExternalFindingsTool,
|
|
40
|
+
NormalizationCandidatesTool,
|
|
41
|
+
ReadFindingsTool,
|
|
42
|
+
TerraformEmitCostTool,
|
|
43
|
+
TerraformEmitEvidenceTool,
|
|
44
|
+
TerraformEmitOscalTool,
|
|
45
|
+
TerraformEmitSarifTool,
|
|
46
|
+
TerraformEmitVexTool,
|
|
47
|
+
TerraformEquivalenceCheckTool,
|
|
48
|
+
TerraformFixMemoryTool,
|
|
49
|
+
TerraformGenerateMovedTool,
|
|
50
|
+
TerraformModuleDocsTool,
|
|
51
|
+
TerraformModuleLookupTool,
|
|
52
|
+
TerraformModuleSearchTool,
|
|
53
|
+
TerraformPlanTool,
|
|
54
|
+
TerraformProviderUpgradeTool,
|
|
55
|
+
TerraformQueryInventoryTool,
|
|
56
|
+
TerraformScanTool,
|
|
57
|
+
TerraformValidateTool,
|
|
58
|
+
TerraformVerifyRemediationTool,
|
|
59
|
+
TerraformVersionCurrencyTool,
|
|
60
|
+
} from "#app/mcp/terraform";
|
|
61
|
+
import { parseToolsNetwork } from "#app/mcp/terraform/scannerEgress";
|
|
62
|
+
import { initToolState } from "#app/toolState";
|
|
63
|
+
import { log } from "#app/utils/cli";
|
|
64
|
+
import { parseToolSelection } from "#app/utils/toolSelection";
|
|
65
|
+
|
|
66
|
+
export interface LocalMcpOptions {
|
|
67
|
+
/** absolute workspace directory the tools operate on. */
|
|
68
|
+
cwd: string;
|
|
69
|
+
severityThreshold?:
|
|
70
|
+
| "critical"
|
|
71
|
+
| "high"
|
|
72
|
+
| "medium"
|
|
73
|
+
| "low"
|
|
74
|
+
| "info"
|
|
75
|
+
| undefined;
|
|
76
|
+
scanScope?: "full" | "diff" | undefined;
|
|
77
|
+
/** multi-language Assess scope ("auto" | "terraform" | comma list); undefined → "auto". */
|
|
78
|
+
iacLanguages?: string | undefined;
|
|
79
|
+
/** default remediation grouping ("file" | "rule"); undefined → "file". */
|
|
80
|
+
grouping?: "file" | "rule" | undefined;
|
|
81
|
+
/** newline/comma-separated approved module list (same as the action input). */
|
|
82
|
+
moduleCatalogue?: string | undefined;
|
|
83
|
+
/** the unified tool-selection list (same syntax as the action input). */
|
|
84
|
+
toolsEnabled?: string | undefined;
|
|
85
|
+
/** per-scanner egress policy (same syntax as the `tools_network` input). */
|
|
86
|
+
toolsNetwork?: string | undefined;
|
|
87
|
+
/** scoped token to fetch private cross-repo `git::` modules at init. */
|
|
88
|
+
moduleFetchToken?: string | undefined;
|
|
89
|
+
/** SSH/deploy key for `git::ssh://…` cross-repo modules (the SSH counterpart). */
|
|
90
|
+
moduleFetchSshKey?: string | undefined;
|
|
91
|
+
/** scoped bearer token to fetch a private Terraform REGISTRY module at init. */
|
|
92
|
+
registryToken?: string | undefined;
|
|
93
|
+
/** host(s) the registry token authorises (default: app.terraform.io). */
|
|
94
|
+
registryHost?: string | undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** build the cwd-scoped context the read-only tools run against. */
|
|
98
|
+
export function buildLocalContext(options: LocalMcpOptions): LocalToolContext {
|
|
99
|
+
return {
|
|
100
|
+
payload: {
|
|
101
|
+
cwd: options.cwd,
|
|
102
|
+
scanScope: options.scanScope,
|
|
103
|
+
iacLanguages: options.iacLanguages,
|
|
104
|
+
severityThreshold: options.severityThreshold,
|
|
105
|
+
grouping: options.grouping,
|
|
106
|
+
autonomyThreshold: undefined,
|
|
107
|
+
costIncreaseBlockUsd: undefined,
|
|
108
|
+
// a local `infraweaver mcp` run has no PR/push surface, so the
|
|
109
|
+
// allow_replace gate never engages — terraform_plan reports
|
|
110
|
+
// blocked_destructive informationally with push_will_block: false.
|
|
111
|
+
allowReplace: undefined,
|
|
112
|
+
moduleCatalogue: options.moduleCatalogue,
|
|
113
|
+
toolsEnabled: parseToolSelection(options.toolsEnabled),
|
|
114
|
+
toolsNetwork: options.toolsNetwork
|
|
115
|
+
? parseToolsNetwork(options.toolsNetwork)
|
|
116
|
+
: undefined,
|
|
117
|
+
gitleaks: false,
|
|
118
|
+
terratest: false,
|
|
119
|
+
// a local `infraweaver mcp` user invoking terraform_module_docs has asked
|
|
120
|
+
// for the README write (same rationale as the emit_sarif exception), and
|
|
121
|
+
// there is no push surface here for the allow-list to gate.
|
|
122
|
+
docs: true,
|
|
123
|
+
terraformMcp: false,
|
|
124
|
+
opentofuMcp: false,
|
|
125
|
+
// read-only offer surface: terraform_fix_memory reads a committed
|
|
126
|
+
// `.infraweaver.fix-memory.json` so a local CLI/IDE session gets the same
|
|
127
|
+
// proven priors a Cloud-connected run does. Capture (the write side) only
|
|
128
|
+
// happens on the full Action run, so enabling it here is offer-only.
|
|
129
|
+
fixMemory: true,
|
|
130
|
+
moduleFetchToken: options.moduleFetchToken,
|
|
131
|
+
moduleFetchSshKey: options.moduleFetchSshKey,
|
|
132
|
+
registryToken: options.registryToken,
|
|
133
|
+
registryHost: options.registryHost,
|
|
134
|
+
},
|
|
135
|
+
toolState: initToolState({ progressComment: undefined }),
|
|
136
|
+
tmpdir: mkdtempSync(join(tmpdir(), `${PRODUCT_SLUG}-mcp-`)),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The local tool set. Append-only review rule: anything added here must be
|
|
142
|
+
* read-only w.r.t. the repo and runnable without GitHub context — the
|
|
143
|
+
* `localServer.test.ts` snapshot exists to make additions deliberate.
|
|
144
|
+
*/
|
|
145
|
+
export function buildLocalTools(ctx: LocalToolContext): Tool<any, any>[] {
|
|
146
|
+
return [
|
|
147
|
+
TerraformScanTool(ctx),
|
|
148
|
+
TerraformAssessTool(ctx),
|
|
149
|
+
TerraformValidateTool(ctx),
|
|
150
|
+
TerraformVerifyRemediationTool(ctx),
|
|
151
|
+
TerraformFixMemoryTool(ctx),
|
|
152
|
+
TerraformPlanTool(ctx),
|
|
153
|
+
TerraformProviderUpgradeTool(ctx),
|
|
154
|
+
TerraformVersionCurrencyTool(ctx),
|
|
155
|
+
TerraformModuleLookupTool(ctx),
|
|
156
|
+
TerraformModuleSearchTool(ctx),
|
|
157
|
+
InfracostDiffTool(ctx),
|
|
158
|
+
ReadFindingsTool(ctx),
|
|
159
|
+
IngestExternalFindingsTool(ctx),
|
|
160
|
+
DetectPlanDriftTool(ctx),
|
|
161
|
+
TerraformEmitSarifTool(ctx),
|
|
162
|
+
TerraformEmitEvidenceTool(ctx),
|
|
163
|
+
TerraformEmitOscalTool(ctx),
|
|
164
|
+
TerraformEmitVexTool(ctx),
|
|
165
|
+
TerraformEmitCostTool(ctx),
|
|
166
|
+
ListModulesTool(ctx),
|
|
167
|
+
TerraformModuleGraphTool(ctx),
|
|
168
|
+
TerraformModuleInterfaceTool(ctx),
|
|
169
|
+
TerraformModuleTestsTool(ctx),
|
|
170
|
+
ModuleExtractionCandidatesTool(ctx),
|
|
171
|
+
NormalizationCandidatesTool(ctx),
|
|
172
|
+
TerraformQueryInventoryTool(ctx),
|
|
173
|
+
TerraformEquivalenceCheckTool(ctx),
|
|
174
|
+
TerraformGenerateMovedTool(ctx),
|
|
175
|
+
TerraformModuleDocsTool(ctx),
|
|
176
|
+
TerraformProviderSchemaTool(ctx),
|
|
177
|
+
TerraformRootsTool(ctx),
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** the bundled CLI version when it looks like semver (esbuild injects
|
|
182
|
+
* CLI_VERSION at build time); a dev run without it reports 0.0.0. */
|
|
183
|
+
function cliVersion(): `${number}.${number}.${number}` {
|
|
184
|
+
const raw = process.env.CLI_VERSION;
|
|
185
|
+
if (raw !== undefined && /^\d+\.\d+\.\d+$/.test(raw)) {
|
|
186
|
+
return raw as `${number}.${number}.${number}`;
|
|
187
|
+
}
|
|
188
|
+
return "0.0.0";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export async function startLocalMcpServer(
|
|
192
|
+
options: LocalMcpOptions,
|
|
193
|
+
): Promise<{ stop: () => Promise<void> }> {
|
|
194
|
+
const ctx = buildLocalContext(options);
|
|
195
|
+
const server = new FastMCP({
|
|
196
|
+
name: infraweaverMcpName,
|
|
197
|
+
version: cliVersion(),
|
|
198
|
+
instructions:
|
|
199
|
+
"Read-only Terraform best-practice intelligence for the workspace at " +
|
|
200
|
+
`${options.cwd}. Start with terraform_scan (findings) or terraform_module_graph ` +
|
|
201
|
+
"(structure); verify any fix you make with terraform_validate and prove cleared " +
|
|
202
|
+
"concerns with terraform_verify_remediation. Use terraform_module_lookup / " +
|
|
203
|
+
"terraform_module_search to read or find published registry modules (and their real " +
|
|
204
|
+
"inputs/outputs) before wiring a module block. This server never holds cloud or " +
|
|
205
|
+
"GitHub credentials and cannot push, comment, or open PRs.",
|
|
206
|
+
});
|
|
207
|
+
for (const tool of buildLocalTools(ctx)) {
|
|
208
|
+
server.addTool(tool);
|
|
209
|
+
}
|
|
210
|
+
await server.start({ transportType: "stdio" });
|
|
211
|
+
log.info(`» ${PRODUCT_SLUG} mcp: stdio server ready (cwd: ${options.cwd})`);
|
|
212
|
+
return {
|
|
213
|
+
stop: async () => {
|
|
214
|
+
await server.stop();
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|