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
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { ToolState } from "#app/toolState";
|
|
2
|
+
import type { OctokitWithPlugins } from "#app/utils/github";
|
|
3
|
+
import type { ResolvedPayload } from "#app/utils/payload";
|
|
4
|
+
import type { RunContextData } from "#app/utils/runContextData";
|
|
5
|
+
/**
|
|
6
|
+
* The narrow context the push-time guardrails read: the payload (allow-lists,
|
|
7
|
+
* tool selection, protected paths, PR caps), the tool state (selected mode,
|
|
8
|
+
* run-start baseline, recorded plan verdicts), and tmpdir (a gitleaks report
|
|
9
|
+
* lands here). No GitHub/git tokens — these gates inspect local state + the local
|
|
10
|
+
* git tree, so both `GitToolContext` and the GitHub write context satisfy them.
|
|
11
|
+
*/
|
|
12
|
+
export interface GuardrailContext {
|
|
13
|
+
payload: ResolvedPayload;
|
|
14
|
+
toolState: ToolState;
|
|
15
|
+
tmpdir: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The cross-run open-PR flood guard additionally needs the GitHub client + repo
|
|
19
|
+
* coordinates to count PRs the run can't see in local state. Only
|
|
20
|
+
* {@link assertUnderOpenPrCaps} requires it; the pure push-time gates take the
|
|
21
|
+
* narrower {@link GuardrailContext}.
|
|
22
|
+
*/
|
|
23
|
+
export interface OpenPrCapContext extends GuardrailContext {
|
|
24
|
+
octokit: OctokitWithPlugins;
|
|
25
|
+
repo: RunContextData["repo"];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Terraform-write guardrails — hard, code-level limits that back the prompt
|
|
29
|
+
* rules of the modes that write Terraform and open PRs (**Remediate** and the
|
|
30
|
+
* **RefreshRemediation** sweep). They only engage for those modes, so every other
|
|
31
|
+
* mode (Build, Fix, Review, …) is completely unaffected.
|
|
32
|
+
*/
|
|
33
|
+
export declare const REMEDIATE_MODE = "Remediate";
|
|
34
|
+
/** the stale-fix self-healing sweep re-derives + force-updates remediation
|
|
35
|
+
* PRs, so it writes Terraform and pushes exactly like Remediate and is bounded by
|
|
36
|
+
* the same guardrails. */
|
|
37
|
+
export declare const REFRESH_REMEDIATION_MODE = "RefreshRemediation";
|
|
38
|
+
/** the `refactor` verb relocates resources behind a module boundary and pushes
|
|
39
|
+
* Terraform like Remediate, so it is bounded by the same allow-list / secret /
|
|
40
|
+
* destroy guardrails — PLUS the equivalence hard-fail below (a refactor that
|
|
41
|
+
* can't prove behaviour-preservation must not reach a human). */
|
|
42
|
+
export declare const REFACTOR_MODE = "Refactor";
|
|
43
|
+
/** the dependency / deprecation / cost verbs each write Terraform and push
|
|
44
|
+
* exactly like Remediate, so they are bounded by the same allow-list / secret /
|
|
45
|
+
* destroy / PR-cap guardrails. UpdateDependencies also runs the equivalence
|
|
46
|
+
* check for config-preserving bumps and so inherits the equivalence hard-fail
|
|
47
|
+
* below; ModernizeDeprecated and CostOptimization are behaviour-altering and
|
|
48
|
+
* prove via plan, so they never record an equivalence verdict and that one gate
|
|
49
|
+
* no-ops for them. */
|
|
50
|
+
export declare const UPDATE_DEPENDENCIES_MODE = "UpdateDependencies";
|
|
51
|
+
export declare const MODERNIZE_DEPRECATED_MODE = "ModernizeDeprecated";
|
|
52
|
+
export declare const COST_OPTIMIZATION_MODE = "CostOptimization";
|
|
53
|
+
/** the combined verb: it both remediates (a ✗→✓ fix, like Remediate) and
|
|
54
|
+
* refactors (an equivalence-proven modularisation, like Refactor) on one branch,
|
|
55
|
+
* so it is bounded by EVERY guardrail of both — the allow-list / secret /
|
|
56
|
+
* destroy / PR caps AND the equivalence hard-fail (which gates the refactor half
|
|
57
|
+
* once terraform_equivalence_check runs; no-op until it does). */
|
|
58
|
+
export declare const REMEDIATE_AND_REFACTOR_MODE = "RemediateAndRefactor";
|
|
59
|
+
/** default paths these modes may modify/create: Terraform sources only. */
|
|
60
|
+
export declare const DEFAULT_ALLOWED_PATHS: readonly ["**/*.tf", "**/*.tfvars"];
|
|
61
|
+
/** extra paths the Terratest scaffold writes, allowed only when the
|
|
62
|
+
* `terratest` input is enabled (Go test files + native `*.tftest.hcl` tests fall
|
|
63
|
+
* outside the Terraform-only default). */
|
|
64
|
+
export declare const TERRATEST_ALLOWED_PATHS: readonly ["**/*_test.go", "**/*.tftest.hcl", "test/**", "tests/**", "go.mod", "go.sum"];
|
|
65
|
+
/** doc paths writable only when the `docs` input is enabled — the
|
|
66
|
+
* terraform_module_docs surface. Deliberately narrow: module READMEs and the
|
|
67
|
+
* infraweaver docs dir only; the repo root README and arbitrary `docs/**` stay
|
|
68
|
+
* blocked even with the input on (fail-closed, mirroring the Terratest
|
|
69
|
+
* carve-out above). */
|
|
70
|
+
export declare const DOCS_ALLOWED_PATHS: readonly ["modules/**/README.md", "docs/infraweaver/**/*.md"];
|
|
71
|
+
/** the cost artifact, writable only by the CostOptimization mode (§5.19). A
|
|
72
|
+
* single exact filename rather than a glob — the same fail-closed narrowness as
|
|
73
|
+
* the docs carve-out, so no other markdown becomes writable by accident. */
|
|
74
|
+
export declare const COST_ALLOWED_PATHS: readonly ["cost.md"];
|
|
75
|
+
/** modes whose pushes/PRs are bounded by these guardrails — exported (ordered)
|
|
76
|
+
* so the security-model doc generator renders the real list, not a copy. */
|
|
77
|
+
export declare const GUARDED_MODE_NAMES: readonly ["Remediate", "RefreshRemediation", "Refactor", "RemediateAndRefactor", "UpdateDependencies", "ModernizeDeprecated", "CostOptimization"];
|
|
78
|
+
/** Whether a mode NAME is one whose pushes/PRs are bounded by these guardrails.
|
|
79
|
+
* Pure (no ctx) so read-only tools — e.g. terraform_plan, which can't see the
|
|
80
|
+
* full push surface — can tell whether a destructive plan WOULD block a push. */
|
|
81
|
+
export declare function isGuardedModeName(mode: string | undefined): boolean;
|
|
82
|
+
export declare function resolveAllowedPaths(ctx: GuardrailContext): string[];
|
|
83
|
+
/**
|
|
84
|
+
* Compile a glob to an anchored RegExp. Supports `**` (any path segments,
|
|
85
|
+
* including the `**\/` "zero or more leading dirs" idiom), `*` (within a
|
|
86
|
+
* segment), and `?`. Sufficient for the path allow-list patterns
|
|
87
|
+
* (`**\/*.tf`, `modules/**`, `*.tfvars`).
|
|
88
|
+
*/
|
|
89
|
+
export declare function globToRegex(glob: string): RegExp;
|
|
90
|
+
export declare function isPathAllowed(path: string, globs: string[]): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Enforce the path allow-list before a Remediate-mode push. Throws if the
|
|
93
|
+
* branch changed any file outside the allowed globs — the choke point is
|
|
94
|
+
* push_branch, the only way changes reach a PR. Fails closed: if the baseline
|
|
95
|
+
* can't be established it refuses rather than letting an unbounded change
|
|
96
|
+
* through.
|
|
97
|
+
*/
|
|
98
|
+
export declare function enforceRemediationPaths(ctx: GuardrailContext): void;
|
|
99
|
+
/** glob patterns marking files the fixer must NEVER auto-modify (prod state,
|
|
100
|
+
* data stores, anything sensitive). The inverse of `allowed_paths`. */
|
|
101
|
+
export declare function resolveProtectedPaths(ctx: GuardrailContext): string[];
|
|
102
|
+
/**
|
|
103
|
+
* Block a push that touched any file matching `protected_paths`. This is the
|
|
104
|
+
* inverse of the allow-list: a changed file matching a protected glob fails the
|
|
105
|
+
* push, even though it's a `.tf`/`.tfvars` the allow-list would otherwise permit.
|
|
106
|
+
* No-op when `protected_paths` is unset or outside a guarded mode. Fails closed:
|
|
107
|
+
* if the run-start baseline can't be established it refuses, same as
|
|
108
|
+
* `enforceRemediationPaths`.
|
|
109
|
+
*/
|
|
110
|
+
export declare function enforceProtectedPaths(ctx: GuardrailContext): void;
|
|
111
|
+
/** globs marking FETCHED (vendored) module code — a private cross-repo `git::`
|
|
112
|
+
* module (refactor b.1) or a third-party registry module (b.4) that `terraform
|
|
113
|
+
* init` resolved into the local module cache. The refactor contract is that such
|
|
114
|
+
* a module is READ-ONLY: a concern inside it is fixed at the CALL SITE via inputs,
|
|
115
|
+
* never by editing the vendored copy, and a separate-repo b.1 module must never
|
|
116
|
+
* receive a write change. This is the code-level backing for that rule. */
|
|
117
|
+
export declare const VENDORED_MODULE_PATHS: readonly ["**/.terraform/modules/**", "**/.external_modules/**"];
|
|
118
|
+
/**
|
|
119
|
+
* Block a push that committed an edit to FETCHED (vendored) module code. The
|
|
120
|
+
* Terraform-only allow-list (`**/*.tf`) would otherwise PERMIT
|
|
121
|
+
* `.terraform/modules/<x>/main.tf`, so without this a refactor could silently
|
|
122
|
+
* vendor-and-edit a read-only module's source — exactly what the b.1/b.4 contract
|
|
123
|
+
* forbids ("never open a write PR against a read-only module repo; never edit
|
|
124
|
+
* vendored module code"). Engages only in a guarded mode; fails closed on a
|
|
125
|
+
* missing baseline, like {@link enforceRemediationPaths}. No-op when nothing under
|
|
126
|
+
* the module cache was committed (the normal case — it's usually gitignored).
|
|
127
|
+
*/
|
|
128
|
+
export declare function assertNoVendoredModuleEdits(ctx: GuardrailContext): void;
|
|
129
|
+
export interface SecretHit {
|
|
130
|
+
file: string;
|
|
131
|
+
line: number;
|
|
132
|
+
rule: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Scan a unified `git diff` for inlined secrets on ADDED lines only. Tracks the
|
|
136
|
+
* current file from `+++ b/<path>` headers and the new-side line number from
|
|
137
|
+
* `@@` hunk headers, so each hit carries an accurate `file:line`. Pure — the
|
|
138
|
+
* guardrail feeds it `git diff` output. Removed/context lines are ignored (a
|
|
139
|
+
* secret already in the base isn't this run's doing).
|
|
140
|
+
*/
|
|
141
|
+
export declare function scanDiffForSecrets(diff: string): SecretHit[];
|
|
142
|
+
/**
|
|
143
|
+
* Parse a `gitleaks detect --report-format json` report (an array of finding
|
|
144
|
+
* objects) into the shared `SecretHit` shape. Pure, so it's unit-testable
|
|
145
|
+
* without the binary. `gitleaks:` prefixes the rule so a hit's engine is
|
|
146
|
+
* obvious next to the built-in detectors. Tolerates an empty / non-array report.
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseGitleaksReport(json: string): SecretHit[];
|
|
149
|
+
/**
|
|
150
|
+
* Block a push whose diff (since run start) inlines a secret. Reuses the same
|
|
151
|
+
* run-start baseline as the path guardrail. No-op outside a guarded mode. Fails
|
|
152
|
+
* closed on a missing baseline. The diff is read with `$` (restricted env), so
|
|
153
|
+
* no secret leaks into the subprocess.
|
|
154
|
+
*
|
|
155
|
+
* The built-in detectors always run (the deterministic, fail-closed baseline).
|
|
156
|
+
* When the operator opts in via the `gitleaks` input, gitleaks ALSO runs for
|
|
157
|
+
* deeper coverage and its hits are merged — but its absence never weakens the
|
|
158
|
+
* baseline (see scanWithGitleaks).
|
|
159
|
+
*/
|
|
160
|
+
export declare function assertNoSecretsInDiff(ctx: GuardrailContext): void;
|
|
161
|
+
/** resource addresses the operator has explicitly allowed to be destroyed/replaced. */
|
|
162
|
+
export declare function resolveAllowReplace(ctx: GuardrailContext): string[];
|
|
163
|
+
export declare function isReplaceAllowed(address: string, allowList: string[]): boolean;
|
|
164
|
+
/** Split a plan's stateful destroy/replace set by whether the operator's
|
|
165
|
+
* `allow_replace` list covers each address. `blocked` is what
|
|
166
|
+
* {@link assertNoBlockedDestroy} throws on at push — surfacing it at plan time
|
|
167
|
+
* lets a committing mode abandon BEFORE the wasted commit/push round-trip. */
|
|
168
|
+
export declare function partitionStatefulDestroy<T extends {
|
|
169
|
+
address: string;
|
|
170
|
+
}>(stateful: T[], allowList: string[]): {
|
|
171
|
+
blocked: T[];
|
|
172
|
+
allowed: T[];
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Block a push that `terraform_plan` showed would DELETE or REPLACE a stateful
|
|
176
|
+
* (data-bearing) resource — RDS, S3, EBS, a SQL database, etc. A best-practice
|
|
177
|
+
* remediation should never destroy data; if the replacement is genuinely
|
|
178
|
+
* intended the operator opts in per-resource via the `allow_replace` input
|
|
179
|
+
* (an address, a glob, or `*`/`all`). No-op outside guarded modes. When no plan
|
|
180
|
+
* ran (no cloud credentials — `terraform_plan` degraded green), there is no
|
|
181
|
+
* evidence to act on and nothing is blocked: this gate engages only on what the
|
|
182
|
+
* plan actually reported, so it strengthens the run when creds are wired and is
|
|
183
|
+
* silent otherwise.
|
|
184
|
+
*/
|
|
185
|
+
export declare function assertNoBlockedDestroy(ctx: GuardrailContext): void;
|
|
186
|
+
/**
|
|
187
|
+
* Block a push whose `refactor` did not PROVE behaviour-equivalence. Acts on the
|
|
188
|
+
* `terraform_equivalence_check` verdict recorded in tool state — most critically
|
|
189
|
+
* an UNCOVERED `moved {}` block, which would silently destroy and recreate live
|
|
190
|
+
* resources on apply (the single highest-risk refactor defect, a sin of
|
|
191
|
+
* commission far worse than a missed finding). Like the destroy-block gate, it
|
|
192
|
+
* engages only on evidence the proof tool actually produced: no equivalence check
|
|
193
|
+
* recorded → nothing to act on → no-op (so a remediation, which never runs the
|
|
194
|
+
* check, is unaffected). No-op outside a guarded mode. When the recorded verdict
|
|
195
|
+
* is `equivalent: false`, the push is refused with the proof's own reasons.
|
|
196
|
+
*/
|
|
197
|
+
export declare function assertRefactorEquivalence(ctx: GuardrailContext): void;
|
|
198
|
+
/** maximum remediation PRs a single run may open (default 1). */
|
|
199
|
+
export declare function resolveMaxPrs(ctx: GuardrailContext): number;
|
|
200
|
+
/**
|
|
201
|
+
* Enforce the per-run PR cap before opening a remediation PR. Throws when the
|
|
202
|
+
* cap is already reached so the agent stops at the configured number of scoped
|
|
203
|
+
* PRs instead of fanning out.
|
|
204
|
+
*/
|
|
205
|
+
export declare function assertUnderPrCap(ctx: GuardrailContext): void;
|
|
206
|
+
/** record that a guarded-mode PR was opened (after create_pull_request succeeds). */
|
|
207
|
+
export declare function recordRemediationPrOpened(ctx: GuardrailContext): void;
|
|
208
|
+
/** max simultaneously-open remediation PRs before new ones are held back
|
|
209
|
+
* (default 10; 0 disables the cap). Action-input only (see payload.ts). */
|
|
210
|
+
export declare function resolvePrConcurrentLimit(ctx: GuardrailContext): number;
|
|
211
|
+
/** max remediation PRs opened per rolling hour (default 0 = no hourly cap). */
|
|
212
|
+
export declare function resolvePrHourlyLimit(ctx: GuardrailContext): number;
|
|
213
|
+
/**
|
|
214
|
+
* Cross-run flood guard: cap how many remediation PRs may be simultaneously OPEN
|
|
215
|
+
* (`prConcurrentLimit`) and how many may be CREATED per rolling hour
|
|
216
|
+
* (`prHourlyLimit`). Unlike {@link assertUnderPrCap} — which counts only this
|
|
217
|
+
* run's PRs from in-memory tool state — this queries GitHub for PRs across runs,
|
|
218
|
+
* so a first scan on a messy repo (or a burst of push-triggered runs) can't bury
|
|
219
|
+
* the maintainer under remediation PRs. Engages only in a guarded mode; a 0 limit
|
|
220
|
+
* disables that check. Throws with an agent-actionable message, before creation.
|
|
221
|
+
*/
|
|
222
|
+
export declare function assertUnderOpenPrCaps(ctx: OpenPrCapContext): Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GitHubWriteToolContext } from "#app/mcp/capabilityContext";
|
|
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: GitHubWriteToolContext): 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
|
+
}>> & {
|
|
19
|
+
mutates?: boolean;
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
2
|
+
export declare const GetIssueComments: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function GetIssueCommentsTool(ctx: GitHubToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
issue_number: number;
|
|
7
|
+
}, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
}>> & {
|
|
10
|
+
mutates?: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
2
|
+
export declare const GetIssueEvents: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function GetIssueEventsTool(ctx: GitHubToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
issue_number: number;
|
|
7
|
+
}, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
}>> & {
|
|
10
|
+
mutates?: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
2
|
+
export declare const IssueInfo: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
3
|
+
issue_number: number;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export declare function IssueInfoTool(ctx: GitHubToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
6
|
+
issue_number: number;
|
|
7
|
+
}, {
|
|
8
|
+
issue_number: number;
|
|
9
|
+
}>> & {
|
|
10
|
+
mutates?: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GitHubToolContext } from "#app/mcp/capabilityContext";
|
|
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: GitHubToolContext): 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
|
+
}>> & {
|
|
13
|
+
mutates?: boolean;
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
* - `infraweaver 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" | "iacLanguages" | "severityThreshold" | "grouping" | "autonomyThreshold" | "costIncreaseBlockUsd" | "moduleCatalogue" | "allowReplace" | "toolsEnabled" | "toolsNetwork" | "gitleaks" | "terratest" | "docs" | "terraformMcp" | "moduleFetchToken" | "moduleFetchSshKey" | "registryToken" | "registryHost" | "opentofuMcp" | "fixMemory">;
|
|
17
|
+
toolState: ToolState;
|
|
18
|
+
tmpdir: string;
|
|
19
|
+
/** resolved upstream model specifier driving this run's agent (e.g.
|
|
20
|
+
* "anthropic/claude-opus-4-8"). The Action's full `ToolContext` carries it
|
|
21
|
+
* (structurally assignable); a local `infraweaver mcp` session has no agent of
|
|
22
|
+
* its own, so it is absent there. Read by `terraform_emit_evidence` for the
|
|
23
|
+
* bundle's PROVENANCE block (A.3) — recording WHO produced the evidence, not
|
|
24
|
+
* just what was found. */
|
|
25
|
+
resolvedModel?: string | undefined;
|
|
26
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modularization-as-remediation (M2, the hepcare pattern) — DETECTION.
|
|
3
|
+
*
|
|
4
|
+
* Finds clusters of raw resources that look like they should be a module call,
|
|
5
|
+
* and matches each cluster against the modules the repo already trusts: the
|
|
6
|
+
* operator's `module_catalogue` and the repo's own local ("house") modules.
|
|
7
|
+
* The agent turns a candidate into a refactor PR; `terraform_plan`'s
|
|
8
|
+
* `refactor_safe` gate (pure `moved {}` plan) is what makes that PR provably a
|
|
9
|
+
* no-op on live infrastructure.
|
|
10
|
+
*
|
|
11
|
+
* Everything here is pure parsing + set arithmetic over files already on disk —
|
|
12
|
+
* no subprocess, no network — mirroring the modules.ts design.
|
|
13
|
+
*/
|
|
14
|
+
import type { LocalToolContext } from "#app/mcp/localContext";
|
|
15
|
+
import { type ModuleCatalogueEntry, type ModuleSourceKind } from "#app/mcp/modules";
|
|
16
|
+
import { type MovedBlock } from "#app/mcp/terraform/refactor";
|
|
17
|
+
export interface ParsedResource {
|
|
18
|
+
type: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
/** parse every `resource "<type>" "<name>" {` header in some HCL. Headers are
|
|
22
|
+
* enough here — clustering and signature matching only need type + name. */
|
|
23
|
+
export declare function parseResourceBlocks(hcl: string): ParsedResource[];
|
|
24
|
+
export interface ExtractionCluster {
|
|
25
|
+
/** the file the resources live in (clusters never span files — one file is
|
|
26
|
+
* the unit a reviewer can hold in their head, and the unit `moved {}` blocks
|
|
27
|
+
* keep reviewable). */
|
|
28
|
+
file: string;
|
|
29
|
+
/** the shared resource-NAME prefix that bound the cluster, or null for a
|
|
30
|
+
* whole-file cluster. */
|
|
31
|
+
name_prefix: string | null;
|
|
32
|
+
resources: ParsedResource[];
|
|
33
|
+
/** distinct resource types, sorted — the cluster's signature. */
|
|
34
|
+
resource_types: string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Cluster one file's resources into extraction candidates:
|
|
38
|
+
* - groups sharing a name prefix with ≥ MIN_CLUSTER_SIZE members, else
|
|
39
|
+
* - the whole file when it holds ≥ MIN_CLUSTER_SIZE+1 resources of ≥2 types
|
|
40
|
+
* (a single-type pile is usually `count`/`for_each` material, not a module).
|
|
41
|
+
* Prefix clusters that would equal the whole-file cluster collapse into one.
|
|
42
|
+
*/
|
|
43
|
+
export declare function clusterResources(file: string, resources: ParsedResource[]): ExtractionCluster[];
|
|
44
|
+
export interface CandidateModule {
|
|
45
|
+
name: string;
|
|
46
|
+
source: string;
|
|
47
|
+
version: string | null;
|
|
48
|
+
kind: ModuleSourceKind;
|
|
49
|
+
/** how the match was made: a house module's actual resource types, or a
|
|
50
|
+
* catalogue module's name matching the cluster's service keywords. */
|
|
51
|
+
match: "resource_signature" | "name_keyword";
|
|
52
|
+
/** fraction of the cluster's resource types the candidate covers (signature
|
|
53
|
+
* matches) or whose service keyword hits the candidate's name (keyword). */
|
|
54
|
+
overlap: number;
|
|
55
|
+
/** house modules only — what the call site must wire up. */
|
|
56
|
+
required_variables?: string[];
|
|
57
|
+
/** the EXHAUSTIVE `moved {}` mapping for adopting THIS candidate — one entry
|
|
58
|
+
* per cluster resource (`<type>.<name>` → `module.<name>.<type>.<name>`). This
|
|
59
|
+
* is the denominator the equivalence proof checks coverage against: emit every
|
|
60
|
+
* one or terraform_equivalence_check hard-fails on the uncovered move. */
|
|
61
|
+
expected_moves: MovedBlock[];
|
|
62
|
+
}
|
|
63
|
+
/** service keywords of a resource type: `aws_s3_bucket` → ["s3", "bucket"]. */
|
|
64
|
+
export declare function serviceKeywords(resourceType: string): string[];
|
|
65
|
+
export interface HouseModuleSignature {
|
|
66
|
+
dir: string;
|
|
67
|
+
resourceTypes: string[];
|
|
68
|
+
requiredVariables: string[];
|
|
69
|
+
}
|
|
70
|
+
export declare function matchCluster(cluster: ExtractionCluster, houseModules: HouseModuleSignature[], catalogue: ModuleCatalogueEntry[]): CandidateModule[];
|
|
71
|
+
export interface ExtractionCandidate {
|
|
72
|
+
cluster: ExtractionCluster;
|
|
73
|
+
candidates: CandidateModule[];
|
|
74
|
+
}
|
|
75
|
+
export declare function findExtractionCandidates(cwd: string, rawCatalogue: string | undefined): ExtractionCandidate[];
|
|
76
|
+
export declare const ModuleExtractionCandidatesParams: import("arktype/internal/variants/object.ts").ObjectType<object, {}>;
|
|
77
|
+
export declare function ModuleExtractionCandidatesTool(ctx: LocalToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<object, object>> & {
|
|
78
|
+
mutates?: boolean;
|
|
79
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { LocalToolContext } from "#app/mcp/localContext";
|
|
2
|
+
/**
|
|
3
|
+
* Keep a reusable module's EXISTING tests/examples
|
|
4
|
+
* consistent with a fix. `scaffold_terratest` covers the GENERATION direction
|
|
5
|
+
* (new module → new plan-only tests). This is the inverse: when Remediate fixes
|
|
6
|
+
* an existing local/house module and the fix changes the module's public
|
|
7
|
+
* interface (adds a required `variable`, renames or removes one, tightens a
|
|
8
|
+
* type), the module's `examples/` fixtures and `terraform test` / Terratest
|
|
9
|
+
* files that CALL it can silently go stale — a missing required variable breaks
|
|
10
|
+
* `terraform test`/`plan`, and a reference to a removed variable is an error.
|
|
11
|
+
*
|
|
12
|
+
* This module finds those test/example assets for a module dir and computes the
|
|
13
|
+
* DRIFT between what each asset passes and the module's CURRENT interface, so the
|
|
14
|
+
* agent updates exactly the assets that need it (and only those) after a fix —
|
|
15
|
+
* never weakening an assertion to go green. The parsing is pure + unit-tested;
|
|
16
|
+
* the collector just reads the conventional locations (no full-repo walk).
|
|
17
|
+
*/
|
|
18
|
+
export type ModuleTestAssetKind = "example" | "native-test" | "go-test";
|
|
19
|
+
export interface ModuleTestAsset {
|
|
20
|
+
/** repo-relative path: a dir for examples, a file for native/go tests. */
|
|
21
|
+
path: string;
|
|
22
|
+
kind: ModuleTestAssetKind;
|
|
23
|
+
/** variable names the asset passes to the module (best-effort for go tests). */
|
|
24
|
+
set_variables: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface ModuleTestDrift {
|
|
27
|
+
path: string;
|
|
28
|
+
kind: ModuleTestAssetKind;
|
|
29
|
+
/** required module variables the asset does NOT set (would break plan/test). */
|
|
30
|
+
missing_required: string[];
|
|
31
|
+
/** variables the asset sets that are NOT in the module interface — the fix
|
|
32
|
+
* renamed or removed them, so the reference is now stale/an error. */
|
|
33
|
+
unknown_set: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface ModuleTestReport {
|
|
36
|
+
module_dir: string;
|
|
37
|
+
/** the module's CURRENT interface, the truth the assets must match. */
|
|
38
|
+
required_variables: string[];
|
|
39
|
+
variable_names: string[];
|
|
40
|
+
assets: ModuleTestAsset[];
|
|
41
|
+
drift: ModuleTestDrift[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The TOP-LEVEL attribute names assigned (`name = …`) directly in an HCL block
|
|
45
|
+
* body — nested-block / object-field keys are excluded by collapsing `{…}` spans
|
|
46
|
+
* first. Pure. Used for both a `module` block's arguments and a `variables {}`
|
|
47
|
+
* block's entries. `==`/`>=`/`!=` etc. are excluded via the `=(?!=)` guard and
|
|
48
|
+
* by requiring the name to start a line.
|
|
49
|
+
*/
|
|
50
|
+
export declare function topLevelAttributeNames(body: string): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Variables an example sets on the module(s) whose `source` satisfies
|
|
53
|
+
* `sourceMatches` — the union of the matching `module` blocks' top-level
|
|
54
|
+
* arguments (minus meta-args like `source`/`version`/`count`). Pure. Returns []
|
|
55
|
+
* when no module block in the HCL targets the module.
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseExampleModuleVariables(hcl: string, sourceMatches: (source: string) => boolean): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Variables a Terraform-native test (`*.tftest.hcl`) sets — the union of every
|
|
60
|
+
* `variables { … }` block's top-level entries (the top-level block plus any
|
|
61
|
+
* inside `run "…" { … }`). When the test lives in the module's own dir it tests
|
|
62
|
+
* the module in place, so these are the module's variables. Pure.
|
|
63
|
+
*/
|
|
64
|
+
export declare function parseNativeTestVariables(hcl: string): string[];
|
|
65
|
+
/**
|
|
66
|
+
* Variable keys a Go Terratest sets — the `"<key>":` entries inside a
|
|
67
|
+
* `Vars: map[string]interface{}{ … }` (or `map[string]any{ … }`) literal.
|
|
68
|
+
* Best-effort (Go isn't parsed structurally); advisory only. Pure.
|
|
69
|
+
*/
|
|
70
|
+
export declare function parseGoTestVariables(go: string): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Drift between what an asset passes and the module's CURRENT interface:
|
|
73
|
+
* `missing_required` (required vars the asset never sets) and `unknown_set`
|
|
74
|
+
* (vars the asset sets that the module no longer declares). Pure.
|
|
75
|
+
*/
|
|
76
|
+
export declare function computeInterfaceDrift(input: {
|
|
77
|
+
setVariables: string[];
|
|
78
|
+
requiredVariables: string[];
|
|
79
|
+
variableNames: string[];
|
|
80
|
+
}): {
|
|
81
|
+
missing_required: string[];
|
|
82
|
+
unknown_set: string[];
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Find a module's existing test/example assets in the conventional locations and
|
|
86
|
+
* record which of the module's variables each one passes. Reads only the module's
|
|
87
|
+
* own `examples/`/`tests/`/`test/` dirs and the repo-root `examples/` (no
|
|
88
|
+
* full-tree walk). `moduleDir` is repo-relative POSIX. Side-effecting (reads fs).
|
|
89
|
+
*/
|
|
90
|
+
export declare function discoverModuleTestAssets(cwd: string, moduleDir: string): ModuleTestAsset[];
|
|
91
|
+
/**
|
|
92
|
+
* Build the module's test/example consistency report: its current interface, the
|
|
93
|
+
* discovered assets, and the per-asset drift against that interface. Side-effecting
|
|
94
|
+
* (reads fs). The agent reads `drift` to know which assets to update after a fix.
|
|
95
|
+
*/
|
|
96
|
+
export declare function analyzeModuleTests(cwd: string, moduleDir: string): ModuleTestReport;
|
|
97
|
+
export declare const TerraformModuleTestsParams: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
98
|
+
module_dir: string;
|
|
99
|
+
}, {}>;
|
|
100
|
+
export declare function TerraformModuleTestsTool(ctx: LocalToolContext): import("fastmcp").Tool<any, import("@standard-schema/spec").StandardSchemaV1<{
|
|
101
|
+
module_dir: string;
|
|
102
|
+
}, {
|
|
103
|
+
module_dir: string;
|
|
104
|
+
}>> & {
|
|
105
|
+
mutates?: boolean;
|
|
106
|
+
};
|