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,267 @@
|
|
|
1
|
+
import type { LocatedResource, ProviderRequirement } from "#app/mcp/terraform/scanners";
|
|
2
|
+
/** Bumped when the pack SHAPE changes (not when an individual pack's content
|
|
3
|
+
* does — each pack carries its own `version`). Mirrors `FixMemoryFile.version`. */
|
|
4
|
+
export declare const TRANSFORM_PACK_SCHEMA: "infraweaver-transform-pack/v1";
|
|
5
|
+
/**
|
|
6
|
+
* The built-in packs.
|
|
7
|
+
*
|
|
8
|
+
* Built in rather than fetched: a migration table pulled at runtime is a remote
|
|
9
|
+
* input that decides how live infrastructure gets edited, which is the last
|
|
10
|
+
* thing that should be mutable outside a reviewed release. Adding a pack is a
|
|
11
|
+
* code change with a diff, a review and a version — exactly like the crosswalk.
|
|
12
|
+
*
|
|
13
|
+
* These ship to everyone, OSS included, with no input to enable. The only
|
|
14
|
+
* Cloud-gated part of TC-2.2 is the fleet-wide *proven* counters.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BUILTIN_TRANSFORM_PACKS: readonly TransformPack[];
|
|
17
|
+
/**
|
|
18
|
+
* How a transform's state has to move.
|
|
19
|
+
*
|
|
20
|
+
* This is the field the whole feature turns on, because it — not the size of the
|
|
21
|
+
* diff — decides whether a human must look. `auto` is a pure config edit that
|
|
22
|
+
* `plan` should show as a no-op. `moved_block` needs a `moved {}` block authored
|
|
23
|
+
* (Terraform ≥ 1.8) but keeps the resource. `manual_import` means the state
|
|
24
|
+
* entry cannot be carried across: without `state rm` + `import`, applying the
|
|
25
|
+
* change DESTROYS and RECREATES the resource.
|
|
26
|
+
*/
|
|
27
|
+
export type StateMove = "auto" | "moved_block" | "manual_import";
|
|
28
|
+
export type TransformKind = "resource_renamed" | "resource_removed" | "argument_renamed" | "argument_removed" | "argument_required" | "provider_setting";
|
|
29
|
+
/** One codified breaking change. */
|
|
30
|
+
export interface TransformEntry {
|
|
31
|
+
/** stable id, `<provider>.<from>-<to>.<slug>` — the fleet-sharing match key. */
|
|
32
|
+
id: string;
|
|
33
|
+
kind: TransformKind;
|
|
34
|
+
/** the resource type the change applies to; `null` for provider-block changes. */
|
|
35
|
+
resource_type: string | null;
|
|
36
|
+
/** what the config says today (old resource type, old argument name). */
|
|
37
|
+
from: string;
|
|
38
|
+
/** what it becomes; `null` when the thing was removed with no replacement. */
|
|
39
|
+
to: string | null;
|
|
40
|
+
state_move: StateMove;
|
|
41
|
+
/** true when applying this change is expected to force replacement even after
|
|
42
|
+
* the config edit — the pre-plan signal that a human will be needed. */
|
|
43
|
+
forces_replacement: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Set when the VALUE must change too, not just the identifier.
|
|
46
|
+
*
|
|
47
|
+
* This exists because the most dangerous entry in any migration table is the
|
|
48
|
+
* one that looks like a pure rename and isn't: `disable_bgp_route_propagation`
|
|
49
|
+
* → `bgp_route_propagation_enabled` inverts the boolean, and a mechanical
|
|
50
|
+
* rename would silently flip the routing behaviour of a live network while
|
|
51
|
+
* `validate`, `plan` and every scanner stayed green. When this is set, the
|
|
52
|
+
* transform is never presented as a rename.
|
|
53
|
+
*/
|
|
54
|
+
value_change?: string;
|
|
55
|
+
/** one line the agent can act on. */
|
|
56
|
+
note: string;
|
|
57
|
+
}
|
|
58
|
+
export interface TransformPack {
|
|
59
|
+
/** registry provider name, e.g. `azurerm`. */
|
|
60
|
+
provider: string;
|
|
61
|
+
from_major: number;
|
|
62
|
+
to_major: number;
|
|
63
|
+
/** pack content version — bump when entries change. */
|
|
64
|
+
version: string;
|
|
65
|
+
/** the upstream guide these entries were transcribed from. Every claim in this
|
|
66
|
+
* file is someone else's documented breaking change, so it gets a citation. */
|
|
67
|
+
source: string;
|
|
68
|
+
/** ALWAYS false in practice, and stated rather than implied: no pack here is a
|
|
69
|
+
* complete migration. `unknown_arguments` is the exhaustive check. */
|
|
70
|
+
exhaustive: boolean;
|
|
71
|
+
/** upstream's own migration tool, when one exists. Preferring it over our own
|
|
72
|
+
* leads is "integrate upward, don't compete" applied to migrations. */
|
|
73
|
+
official_tool?: string;
|
|
74
|
+
entries: TransformEntry[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Whether the installed provider schema CORROBORATES a pack entry.
|
|
78
|
+
*
|
|
79
|
+
* - `pre-upgrade` — schema has `from`, not `to`. Consistent with the old major
|
|
80
|
+
* still being installed; the entry is a valid lead.
|
|
81
|
+
* - `post-upgrade` — schema has `to`, not `from`. The new major is installed, so
|
|
82
|
+
* any remaining use of `from` is a confirmed must-fix.
|
|
83
|
+
* - `unverified` — schema has both, neither, or wasn't loadable. The pack is
|
|
84
|
+
* not believed; the entry is reported but never actionable.
|
|
85
|
+
*/
|
|
86
|
+
export type SchemaAgreement = "pre-upgrade" | "post-upgrade" | "unverified";
|
|
87
|
+
/**
|
|
88
|
+
* How sure we are that this entry applies to a specific piece of the config.
|
|
89
|
+
*
|
|
90
|
+
* `absent` exists because one entry kind — `argument_required` — fires on the
|
|
91
|
+
* argument NOT being there. Reporting that as `confirmed` (which is documented
|
|
92
|
+
* as "the identifier was found") would tell the reader the exact opposite of
|
|
93
|
+
* what happened.
|
|
94
|
+
*/
|
|
95
|
+
export type MatchConfidence = "confirmed" | "nested" | "absent";
|
|
96
|
+
export interface TransformMatch {
|
|
97
|
+
entry: TransformEntry;
|
|
98
|
+
/** the pack that produced it. Carried per-match rather than read from the
|
|
99
|
+
* run's primary pack, because a repo can be mid-upgrade on two providers and
|
|
100
|
+
* the fleet row's provider/major columns must describe the right one. */
|
|
101
|
+
provider: string;
|
|
102
|
+
from_major: number;
|
|
103
|
+
to_major: number;
|
|
104
|
+
/** where it was found. */
|
|
105
|
+
file: string;
|
|
106
|
+
/** the resource block's local name (`""` for provider-block matches). */
|
|
107
|
+
resource_name: string;
|
|
108
|
+
/**
|
|
109
|
+
* `confirmed` — the exact top-level identifier was found in the parsed config.
|
|
110
|
+
* `nested` — the entry names a path inside a block (`a.b.c`) and the parser
|
|
111
|
+
* only sees top-level argument names, so the resource TYPE
|
|
112
|
+
* matched but the argument itself was not confirmed. Reported as
|
|
113
|
+
* a lead to check by hand, never as a certainty.
|
|
114
|
+
*/
|
|
115
|
+
confidence: MatchConfidence;
|
|
116
|
+
schema_agreement: SchemaAgreement;
|
|
117
|
+
/** true when this match must not be applied autonomously. */
|
|
118
|
+
needs_human: boolean;
|
|
119
|
+
/** why, when it does. */
|
|
120
|
+
needs_human_reason: string | null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Does this transform need a human?
|
|
124
|
+
*
|
|
125
|
+
* Two independent triggers, both deliberately conservative:
|
|
126
|
+
* 1. `manual_import` — the state cannot be carried across automatically, so an
|
|
127
|
+
* unattended apply destroys and recreates. Always human, every resource type.
|
|
128
|
+
* 2. `forces_replacement` on a STATEFUL resource type. Stateful-ness is read
|
|
129
|
+
* from `plan.ts`'s `STATEFUL_RESOURCE_TYPES` — the exact set the push-time
|
|
130
|
+
* `assertNoBlockedDestroy` guardrail uses — and NOT from `governance.ts`'s
|
|
131
|
+
* regex heuristic, because the point of pre-declaring this is to predict
|
|
132
|
+
* what the guard will actually block. Predicting it with a different
|
|
133
|
+
* definition than the guard uses would be worse than not predicting it.
|
|
134
|
+
*/
|
|
135
|
+
export declare function transformNeedsHuman(entry: TransformEntry): {
|
|
136
|
+
needs: boolean;
|
|
137
|
+
reason: string | null;
|
|
138
|
+
};
|
|
139
|
+
/** Schema lookup seam. Returns the argument names known for a resource type, or
|
|
140
|
+
* `null` when the schema could not be loaded / the type is unknown to it. */
|
|
141
|
+
export type SchemaLookup = (resourceType: string) => ReadonlySet<string> | null;
|
|
142
|
+
/**
|
|
143
|
+
* Check one entry against the installed provider schema.
|
|
144
|
+
*
|
|
145
|
+
* Only argument-level entries are checkable this way — a removed RESOURCE type
|
|
146
|
+
* cannot be corroborated by asking the schema about it (its absence is equally
|
|
147
|
+
* consistent with "removed in v4" and "this provider isn't installed"), so those
|
|
148
|
+
* return `unverified` and lean on the deterministic type match instead.
|
|
149
|
+
*/
|
|
150
|
+
export declare function verifyEntry(entry: TransformEntry, lookup: SchemaLookup): SchemaAgreement;
|
|
151
|
+
/**
|
|
152
|
+
* Select the packs that apply to what this repo actually pins.
|
|
153
|
+
*
|
|
154
|
+
* A pack applies when the provider is required AND the pinned lower-bound major
|
|
155
|
+
* equals the pack's `from_major`. An unconstrained provider (`major: null`)
|
|
156
|
+
* matches nothing: guessing which major an unpinned provider resolves to is how
|
|
157
|
+
* you hand someone a migration they don't need.
|
|
158
|
+
*/
|
|
159
|
+
export declare function packsForRequirements(packs: readonly TransformPack[], requirements: readonly ProviderRequirement[]): TransformPack[];
|
|
160
|
+
/**
|
|
161
|
+
* Match a pack's entries against the parsed configuration. Pure.
|
|
162
|
+
*
|
|
163
|
+
* `resources` comes from `parseResourceArguments`, which reports TOP-LEVEL
|
|
164
|
+
* argument names only. That bound is honoured rather than papered over: a
|
|
165
|
+
* dotted entry produces a `nested` match (resource type present, argument not
|
|
166
|
+
* confirmed) so the agent knows to look inside the block itself.
|
|
167
|
+
*/
|
|
168
|
+
export declare function matchTransforms(pack: TransformPack, resources: readonly LocatedResource[], lookup: SchemaLookup): TransformMatch[];
|
|
169
|
+
/**
|
|
170
|
+
* Fleet reuse stats for a transform id — the §5.12-shaped half.
|
|
171
|
+
*
|
|
172
|
+
* Notice what is NOT here: no config, no snippet, no repo name. A transform is
|
|
173
|
+
* already fully described by the pack every engine ships; the only thing worth
|
|
174
|
+
* sharing across an org is *whether it has been proven to plan cleanly, and how
|
|
175
|
+
* widely*. That keeps the fleet payload a set of counters, so there is no path
|
|
176
|
+
* by which one repo's configuration reaches another.
|
|
177
|
+
*/
|
|
178
|
+
export interface ProvenTransform {
|
|
179
|
+
/** matches `TransformEntry.id`. */
|
|
180
|
+
transform_id: string;
|
|
181
|
+
provider: string;
|
|
182
|
+
from_major: number;
|
|
183
|
+
to_major: number;
|
|
184
|
+
/** how many times this transform's upgrade planned cleanly. */
|
|
185
|
+
times_proven?: number;
|
|
186
|
+
/** distinct repos it has been proven on. */
|
|
187
|
+
repos_count?: number;
|
|
188
|
+
last_proven?: string;
|
|
189
|
+
/** operator retired it in the dashboard — never offered as proven. */
|
|
190
|
+
disabled?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export declare function isProvenTransform(value: unknown): value is ProvenTransform;
|
|
193
|
+
/** Coerce the untrusted Cloud `provenTransforms` blob. Pure — the wire boundary
|
|
194
|
+
* can't be typechecked across repos (same reasoning as `coerceLibrary`). */
|
|
195
|
+
export declare function coerceProvenTransforms(raw: unknown): ProvenTransform[];
|
|
196
|
+
/**
|
|
197
|
+
* What `terraform_provider_upgrade` detected this run, parked on the session so
|
|
198
|
+
* the evidence builder can bind it to the plan that came after.
|
|
199
|
+
*/
|
|
200
|
+
export interface UpgradeIntent {
|
|
201
|
+
provider: string;
|
|
202
|
+
from_major: number;
|
|
203
|
+
to_major: number;
|
|
204
|
+
pack_version: string;
|
|
205
|
+
pack_source: string;
|
|
206
|
+
pack_exhaustive: boolean;
|
|
207
|
+
/** ids of every transform matched in this config, deduped, sorted. */
|
|
208
|
+
transform_ids: string[];
|
|
209
|
+
/** how many of those must not be applied autonomously. */
|
|
210
|
+
needing_human: number;
|
|
211
|
+
}
|
|
212
|
+
/** The plan facts the proof rests on. Supplied by the caller from the session so
|
|
213
|
+
* this stays pure and testable. */
|
|
214
|
+
export interface UpgradePlanFacts {
|
|
215
|
+
to_add: number;
|
|
216
|
+
to_change: number;
|
|
217
|
+
to_destroy: number;
|
|
218
|
+
/** count of destroy/replace actions across all roots. */
|
|
219
|
+
destructive: number;
|
|
220
|
+
/** count of those that hit a data-bearing resource type. */
|
|
221
|
+
stateful_destructive: number;
|
|
222
|
+
/** false when a second plan disagreed with the first. */
|
|
223
|
+
idempotent: boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The signed-evidence statement for a provider upgrade (TC-2.2's "carrying the
|
|
227
|
+
* passing plan as proof").
|
|
228
|
+
*
|
|
229
|
+
* The verdict is computed from the plan, never asserted by the agent, and — per
|
|
230
|
+
* §8 — the statement carries what it does NOT claim. A clean plan proves that
|
|
231
|
+
* Terraform intends no destructive change to the resources it can see. It does
|
|
232
|
+
* not prove the upgrade is behaviourally correct, and it says so.
|
|
233
|
+
*/
|
|
234
|
+
export interface UpgradeEvidenceStatement {
|
|
235
|
+
provider: string;
|
|
236
|
+
from_major: number;
|
|
237
|
+
to_major: number;
|
|
238
|
+
pack_version: string;
|
|
239
|
+
pack_source: string;
|
|
240
|
+
/** always false, carried into the signed bytes so a reader cannot mistake the
|
|
241
|
+
* transform list for a complete migration. */
|
|
242
|
+
pack_exhaustive: boolean;
|
|
243
|
+
verdict: "plan-proven" | "plan-unclean" | "no-plan";
|
|
244
|
+
transforms_detected: number;
|
|
245
|
+
transforms_needing_human: number;
|
|
246
|
+
transform_ids: string[];
|
|
247
|
+
plan?: UpgradePlanFacts | undefined;
|
|
248
|
+
asserts: string;
|
|
249
|
+
does_not_assert: string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Build the upgrade statement. Pure. `facts` is undefined when no plan ran —
|
|
253
|
+
* which is itself recorded as a verdict rather than omitted, because an upgrade
|
|
254
|
+
* shipped without a plan is precisely the case a reader must be able to spot.
|
|
255
|
+
*/
|
|
256
|
+
export declare function buildUpgradeStatement(intent: UpgradeIntent | undefined, facts: UpgradePlanFacts | undefined): UpgradeEvidenceStatement | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* The transforms this run may report to the org's fleet library as PROVEN.
|
|
259
|
+
*
|
|
260
|
+
* Only on a `plan-proven` verdict, and only transforms that did not need a
|
|
261
|
+
* human — a transform a person had to intervene on is not evidence that the
|
|
262
|
+
* transform is safe to apply unattended, which is the only claim the fleet
|
|
263
|
+
* counter is allowed to make.
|
|
264
|
+
*/
|
|
265
|
+
export declare function captureProvenTransforms(statement: UpgradeEvidenceStatement | undefined, matches: readonly TransformMatch[]): ProvenTransform[];
|
|
266
|
+
/** Index a fleet library by transform id for O(1) lookup while rendering. */
|
|
267
|
+
export declare function indexProvenTransforms(library: readonly ProvenTransform[]): Map<string, ProvenTransform>;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type { IacLanguage } from "#app/mcp/terraform/iacLanguages";
|
|
2
|
+
/**
|
|
3
|
+
* A degrade-green skip result carrying the structured envelope
|
|
4
|
+
* (`ok: false` + machine `code` + human `detail`) PLUS the legacy alias the tool
|
|
5
|
+
* returned before it converged on the envelope — `ran`/`found` and
|
|
6
|
+
* `skipped_reason`/`reason` — so existing prompt + test contracts keep working.
|
|
7
|
+
* Additive, never breaking. `extra` folds in any tool-specific fields (e.g.
|
|
8
|
+
* read_findings' empty `concerns`/`groups`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function skipResult(code: string, detail: string, opts?: {
|
|
11
|
+
key?: "ran" | "found";
|
|
12
|
+
reasonKey?: "skipped_reason" | "reason";
|
|
13
|
+
extra?: Record<string, any>;
|
|
14
|
+
}): Record<string, any>;
|
|
15
|
+
/**
|
|
16
|
+
* Internal "concern" model — the Remediator's ground truth for "what is not
|
|
17
|
+
* best practice". Produced by `terraform_scan` from the fork's own deterministic
|
|
18
|
+
* Terraform check tools (fmt / validate / tflint / trivy / checkov).
|
|
19
|
+
*
|
|
20
|
+
* This is a deliberate SUBSET of the reviewer's `findings.schema.json` v1.0
|
|
21
|
+
* (../terraform-reviewer/schemas/findings.schema.json). The reviewer's findings
|
|
22
|
+
* add `lens` / `standard` / `control_id` / `state` on top. Keeping the shape a
|
|
23
|
+
* subset means a future reviewer integration (read_findings) can emit the same
|
|
24
|
+
* Concern[] with no change to the modes or the rest of the tools — only the
|
|
25
|
+
* SOURCE of concerns swaps.
|
|
26
|
+
*/
|
|
27
|
+
export interface Concern {
|
|
28
|
+
/** stable content id: sha1(source|rule_id|file|line). idempotency key for branch/PR naming. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** producing tool. `infraweaver` is the NATIVE rule pack ([[nativeRules]]) — the
|
|
31
|
+
* findings no upstream scanner can produce, re-derived on every scan so they stay
|
|
32
|
+
* ✗→✓ verifiable. `reviewer` marks a concern loaded from a terraform-reviewer
|
|
33
|
+
* findings.json whose original tool isn't one Infraweaver re-runs (tfsec / infracost
|
|
34
|
+
* / llm) — its provenance lives in `rule_id`. */
|
|
35
|
+
source: "terraform-fmt" | "terraform-validate" | "tflint" | "trivy" | "checkov" | "infraweaver" | "reviewer";
|
|
36
|
+
/** original namespaced rule, e.g. "trivy:AVD-AWS-0088" */
|
|
37
|
+
rule_id: string;
|
|
38
|
+
severity: Severity;
|
|
39
|
+
category: "security" | "style" | "correctness" | "cost";
|
|
40
|
+
/** the scanner message — what is wrong */
|
|
41
|
+
evidence: string;
|
|
42
|
+
location: {
|
|
43
|
+
file: string;
|
|
44
|
+
line: number | null;
|
|
45
|
+
};
|
|
46
|
+
/** the IaC language the flagged file is written in (from the scanner's own
|
|
47
|
+
* classification — trivy `Type` / checkov `check_type`). Absent on the
|
|
48
|
+
* Terraform-only scanners (fmt/validate/tflint) and reviewer-loaded concerns;
|
|
49
|
+
* scope filtering falls back to a path classification then terraform.
|
|
50
|
+
* NOT part of the content `id` — purely descriptive, additive. */
|
|
51
|
+
language?: IacLanguage;
|
|
52
|
+
/** the offending source line(s) the scanner flagged (trivy cause lines /
|
|
53
|
+
* checkov code block), so a reader sees the exact code, not just file:line.
|
|
54
|
+
* Absent when the scanner doesn't attach source context. */
|
|
55
|
+
code_snippet?: string | null;
|
|
56
|
+
remediation_hint: string | null;
|
|
57
|
+
suppression?: ConcernSuppression;
|
|
58
|
+
/** 2c taxonomy: the canonical resource+misconfig class this rule maps to (e.g.
|
|
59
|
+
* "aws-s3-encryption"), set when cross-scanner normalisation recognises it. */
|
|
60
|
+
canonical_class?: string;
|
|
61
|
+
/** 2c taxonomy: the scanner(s) that flagged this canonical issue, after a
|
|
62
|
+
* cross-scanner merge (e.g. ["checkov", "trivy"]). */
|
|
63
|
+
flagged_by?: string[];
|
|
64
|
+
}
|
|
65
|
+
export interface ConcernSuppression {
|
|
66
|
+
source: "inline" | "policy";
|
|
67
|
+
reason: string;
|
|
68
|
+
expires: string | null;
|
|
69
|
+
}
|
|
70
|
+
export declare const SEVERITIES: readonly ["critical", "high", "medium", "low", "info"];
|
|
71
|
+
export type Severity = (typeof SEVERITIES)[number];
|
|
72
|
+
export declare const SEVERITY_RANK: Record<Severity, number>;
|
|
73
|
+
export declare const SEVERITY_CVSS_SCORE: Record<Severity, number>;
|
|
74
|
+
export declare const CVSS_SEVERITY_BANDS: ReadonlyArray<{
|
|
75
|
+
min: number;
|
|
76
|
+
severity: Severity;
|
|
77
|
+
}>;
|
|
78
|
+
export declare function severityFromCvss(score: number): Severity;
|
|
79
|
+
export declare function cvssScoreForSeverity(severity: Severity): number;
|
|
80
|
+
export declare function concernId(source: string, ruleId: string, file: string, line: number | null): string;
|
|
81
|
+
/**
|
|
82
|
+
* The single constructor every scanner parser uses to turn a raw finding into a
|
|
83
|
+
* `Concern`. It owns the one coupling that must never drift: the content `id`
|
|
84
|
+
* (`sha1(source|rule|file|line)`) and the namespaced `rule_id` (`source:rule`)
|
|
85
|
+
* are BOTH derived from the same bare `rule` here, so a parser can't accidentally
|
|
86
|
+
* hash one rule string while labelling the concern with another — which would
|
|
87
|
+
* silently break `remediate/<id>` branch naming and the ✗→✓ re-scan match.
|
|
88
|
+
*
|
|
89
|
+
* The per-scanner bits that genuinely differ (severity map, category, evidence
|
|
90
|
+
* text, remediation hint, whether a source snippet is attached) stay explicit at
|
|
91
|
+
* the call site — they're not uniform enough to hide behind a config object
|
|
92
|
+
* without obscuring each parser. `code_snippet` is only set when provided, so
|
|
93
|
+
* fmt/validate/tflint concerns keep their exact prior shape (no `code_snippet`
|
|
94
|
+
* key) and trivy/checkov keep theirs (`code_snippet` before `remediation_hint`).
|
|
95
|
+
*/
|
|
96
|
+
export declare function buildConcern(input: {
|
|
97
|
+
source: Concern["source"];
|
|
98
|
+
/** the BARE rule (e.g. `unformatted`, `AVD-AWS-0088`), NOT `source:rule`. */
|
|
99
|
+
rule: string;
|
|
100
|
+
file: string;
|
|
101
|
+
line: number | null;
|
|
102
|
+
severity: Severity;
|
|
103
|
+
category: Concern["category"];
|
|
104
|
+
evidence: string;
|
|
105
|
+
remediation_hint: string | null;
|
|
106
|
+
code_snippet?: string | null;
|
|
107
|
+
/** the scanner-reported IaC language (trivy `Type` / checkov `check_type`);
|
|
108
|
+
* omit for the Terraform-only scanners — descriptive only, never hashed. */
|
|
109
|
+
language?: IacLanguage | null;
|
|
110
|
+
}): Concern;
|
|
111
|
+
/**
|
|
112
|
+
* A LINE-INDEPENDENT identity for a concern — which rule fires in which file,
|
|
113
|
+
* ignoring the exact line. Two instances of the same rule in the same file at
|
|
114
|
+
* different lines share a key.
|
|
115
|
+
*
|
|
116
|
+
* The full content `id` keys on the line so it's unique per instance (right for
|
|
117
|
+
* SARIF alerts + branch naming), but that makes it UNSTABLE under a fix: almost
|
|
118
|
+
* every fix adds or removes lines, shifting every concern below it to a new line
|
|
119
|
+
* → a new id. If ✗→✓ verification compared raw ids, a shifted-but-unfixed concern
|
|
120
|
+
* would look RESOLVED (old id gone) and simultaneously look like a REGRESSION
|
|
121
|
+
* (new id appeared) — a false attestation either way. `terraform_verify_remediation`
|
|
122
|
+
* compares on this key instead, so a line shift can't fabricate a resolution or a
|
|
123
|
+
* regression. Derived identically to `id` minus the line (same bare-rule
|
|
124
|
+
* normalization) so keys match across the original scan and the re-scan.
|
|
125
|
+
*/
|
|
126
|
+
/** Strip a rule id's own `<source>:` namespace prefix, if present — the
|
|
127
|
+
* normalization shared by `concernKeyOf` (per-file key) and the fix-memory
|
|
128
|
+
* finding-TYPE key (`source|bareRule`, file-independent). One helper so the two
|
|
129
|
+
* can never disagree on what "the same rule" means. */
|
|
130
|
+
export declare function bareRuleOf(source: string, ruleId: string): string;
|
|
131
|
+
export declare function concernKeyOf(c: Pick<Concern, "source" | "rule_id" | "location">): string;
|
|
132
|
+
export type ScannerOutcome = {
|
|
133
|
+
source: Concern["source"];
|
|
134
|
+
ran: boolean;
|
|
135
|
+
skipped_reason?: string;
|
|
136
|
+
concerns: Concern[];
|
|
137
|
+
/**
|
|
138
|
+
* For `terraform validate` only: count of roots where terraform RAN but its
|
|
139
|
+
* `-json` output could not be parsed (a real CLI-level failure, not a missing
|
|
140
|
+
* binary). Lets the validate tool report `passed` as fail-closed instead of
|
|
141
|
+
* silently treating an un-validated root as clean. Undefined/0 elsewhere.
|
|
142
|
+
*/
|
|
143
|
+
unvalidated?: number;
|
|
144
|
+
/**
|
|
145
|
+
* A scanner that RAN but whose coverage was incomplete — one named check inside
|
|
146
|
+
* it could not execute. Distinct from `ran: false` (nothing ran) and from an
|
|
147
|
+
* empty `concerns` (everything ran and found nothing), which is exactly the
|
|
148
|
+
* distinction that stops a partially-blind scan reading as a clean one. Folded
|
|
149
|
+
* into the verification summary's INCONCLUSIVE list, never dropped.
|
|
150
|
+
*/
|
|
151
|
+
partial?: {
|
|
152
|
+
check: string;
|
|
153
|
+
reason: string;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Set when this scanner executed under egress denial (supply-chain 0.2).
|
|
157
|
+
* Always the honest word "partial": the control is an env-level proxy
|
|
158
|
+
* contract, not a kernel boundary — a malicious binary can ignore it. The
|
|
159
|
+
* run summary records it so an assessor can see WHICH findings were produced
|
|
160
|
+
* under bounded egress; absence means the tool ran with open egress.
|
|
161
|
+
*/
|
|
162
|
+
egress_isolation?: "partial";
|
|
163
|
+
};
|
|
164
|
+
export declare function skipped(source: Concern["source"], reason: string): ScannerOutcome;
|
|
165
|
+
/**
|
|
166
|
+
* Re-base a concern produced by a per-root command (its file is relative to the
|
|
167
|
+
* root dir) onto the scan `cwd` by prefixing the root's `relDir`, and recompute
|
|
168
|
+
* the content id so it stays consistent with the cwd-relative scanners (✗→✓).
|
|
169
|
+
* A no-op when `relDir` is "" (the root IS cwd).
|
|
170
|
+
*/
|
|
171
|
+
export declare function rebaseConcern(c: Concern, relDir: string): Concern;
|
|
172
|
+
/** true when a path is a Terraform source file Infraweaver may remediate. */
|
|
173
|
+
export declare function isTerraformFile(file: string): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* The FIX-LOOP filter: Remediate is Terraform-first. A concern in a
|
|
176
|
+
* non-`.tf`/`.tfvars` file can never be remediated (the `allowed_paths` push
|
|
177
|
+
* guardrail blocks the edit, and the `✗→✓` proof machinery is Terraform-specific).
|
|
178
|
+
* The single chokepoint that enforces this is `buildConcernResult`
|
|
179
|
+
* (concernResult.ts), through which EVERY fixer-feeding surface routes —
|
|
180
|
+
* `terraform_scan`, `read_findings`, `detect_plan_drift` and
|
|
181
|
+
* `ingest_external_findings` — so a non-Terraform concern can never reach grouping,
|
|
182
|
+
* a PR branch, or the verifier no matter which tool produced it.
|
|
183
|
+
* The READ-ONLY surfaces (Assess / SARIF / evidence) deliberately do NOT use this
|
|
184
|
+
* filter: they scope by detected IaC language instead (`inLanguageScope`), which is
|
|
185
|
+
* how multi-language Assess widens breadth without ever faking a fix proof for a
|
|
186
|
+
* format the machinery can't verify.
|
|
187
|
+
*/
|
|
188
|
+
export declare function isTerraformConcern(c: Concern): boolean;
|
|
189
|
+
export declare function dedupe(concerns: Concern[]): Concern[];
|
|
190
|
+
export declare function sortConcerns(concerns: Concern[]): Concern[];
|
|
191
|
+
export declare function lowerSeverity(s: string | undefined): Severity;
|
|
192
|
+
/**
|
|
193
|
+
* A scoped unit of work = all concerns in one file. Different scanners flag the
|
|
194
|
+
* same underlying defect under different rule ids (trivy ∩ checkov overlap
|
|
195
|
+
* heavily on e.g. S3 buckets), so per-concern PRs would spam many PRs for one
|
|
196
|
+
* bad file. Remediate acts on ONE group per PR (branch `remediate/<group.id>`),
|
|
197
|
+
* fixing every concern in the file together and proving them all cleared (✗→✓).
|
|
198
|
+
*/
|
|
199
|
+
export interface ConcernGroup {
|
|
200
|
+
/** stable id — the remediation branch/PR key (`remediate/<id>`). Derived from
|
|
201
|
+
* the file (by-file grouping) or the rule (by-rule grouping). */
|
|
202
|
+
id: string;
|
|
203
|
+
/** the group's primary file (by-file) or a human label like "3 files"
|
|
204
|
+
* (by-rule); `files` carries the full list for by-rule groups. */
|
|
205
|
+
file: string;
|
|
206
|
+
/** every file the group spans. one entry for a by-file group; the
|
|
207
|
+
* full set for a by-rule group (the agent must fix the rule in all of them). */
|
|
208
|
+
files?: string[];
|
|
209
|
+
/** how the group was formed — `file` (default) or `rule`. */
|
|
210
|
+
grouping?: "file" | "rule";
|
|
211
|
+
/** highest severity among the group's concerns. */
|
|
212
|
+
severity: Severity;
|
|
213
|
+
concern_count: number;
|
|
214
|
+
/** distinct rule ids in the group, for the PR body. */
|
|
215
|
+
rule_ids: string[];
|
|
216
|
+
/** the concern ids the re-scan must confirm are gone to call this ✓. */
|
|
217
|
+
concern_ids: string[];
|
|
218
|
+
/** `auto` (open a normal PR) or `needs-human` (escalate). attached by
|
|
219
|
+
* the scan tool from the group's concerns, not by `groupConcerns` (which has
|
|
220
|
+
* no autonomy threshold). undefined until the scan tool annotates it. */
|
|
221
|
+
autonomy?: Autonomy;
|
|
222
|
+
/** why the group was escalated (empty/absent for `auto`). */
|
|
223
|
+
autonomy_reasons?: string[];
|
|
224
|
+
}
|
|
225
|
+
export type Autonomy = "auto" | "needs-human";
|
|
226
|
+
export type BlastTier = "low" | "medium" | "high";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Concern, ScannerOutcome } from "#app/mcp/terraform/types";
|
|
2
|
+
/**
|
|
3
|
+
* Five-status verification taxonomy (the auditor-credibility win the evidence
|
|
4
|
+
* pack + crosswalk both lean on). The point is HONESTY: never let "no finding"
|
|
5
|
+
* read as "compliant", and never claim the engine proved something it cannot see
|
|
6
|
+
* from code. Every assessment statement carries exactly one of these:
|
|
7
|
+
*
|
|
8
|
+
* - `pass` — a check ran and code-verified compliance.
|
|
9
|
+
* - `fail` — a check ran and code-verified a violation.
|
|
10
|
+
* - `not-applicable` — the control does not apply to the resources present.
|
|
11
|
+
* - `inconclusive` — a relevant check did NOT run (gated / not installed /
|
|
12
|
+
* unparseable). A coverage gap, never silently a pass.
|
|
13
|
+
* - `not-code-verifiable` — the control needs human / process evidence
|
|
14
|
+
* (governance, training, a key-policy decision); IaC
|
|
15
|
+
* scanning structurally cannot prove it either way.
|
|
16
|
+
*
|
|
17
|
+
* What this engine asserts today: `fail` and `not-code-verifiable` per concern,
|
|
18
|
+
* and `inconclusive` per scanner that didn't run. It deliberately does NOT
|
|
19
|
+
* fabricate `pass` / `not-applicable` for controls nothing fired on — absence of
|
|
20
|
+
* a finding is not proof, and over-claiming is exactly what costs credibility
|
|
21
|
+
* with an assessor. The two reserved statuses are part of the shared vocabulary
|
|
22
|
+
* for the evidence consumer (and a future full-framework crosswalk). Pure.
|
|
23
|
+
*/
|
|
24
|
+
export declare const VERIFICATION_STATUSES: readonly ["pass", "fail", "not-applicable", "inconclusive", "not-code-verifiable"];
|
|
25
|
+
export type VerificationStatus = (typeof VERIFICATION_STATUSES)[number];
|
|
26
|
+
/** one-line legend per status — for the report / evidence bundle. */
|
|
27
|
+
export declare const VERIFICATION_STATUS_LABEL: Record<VerificationStatus, string>;
|
|
28
|
+
/** the statuses the engine asserts per concern (a concern is always one or the
|
|
29
|
+
* other — it fired, the only question is whether code can prove the fix). */
|
|
30
|
+
export type ConcernVerificationStatus = Extract<VerificationStatus, "fail" | "not-code-verifiable">;
|
|
31
|
+
/**
|
|
32
|
+
* Classify one concern: a code-verified violation (`fail`) — UNLESS its
|
|
33
|
+
* remediation is a human decision the engine can flag but not prove from code
|
|
34
|
+
* (IAM least-privilege, a KMS key policy, a real CIDR — the refusal set), in
|
|
35
|
+
* which case it is `not-code-verifiable`. Pure.
|
|
36
|
+
*
|
|
37
|
+
* A NATIVE rule ([[nativeRules]]) is decided by its declared band FIRST, and the
|
|
38
|
+
* band is checked before the keyword-matching refusal set on purpose: a
|
|
39
|
+
* governance rule's own text (which names what it deliberately does not assert)
|
|
40
|
+
* must never be able to trip a refusal regex into a different reason, and a
|
|
41
|
+
* `verified` native rule must never be downgraded because its evidence happens
|
|
42
|
+
* to contain a word like "policy".
|
|
43
|
+
*/
|
|
44
|
+
export declare function concernVerificationStatus(concern: Pick<Concern, "rule_id" | "evidence">): {
|
|
45
|
+
status: ConcernVerificationStatus;
|
|
46
|
+
reason?: string;
|
|
47
|
+
};
|
|
48
|
+
export interface VerifiedConcern {
|
|
49
|
+
id: string;
|
|
50
|
+
status: ConcernVerificationStatus;
|
|
51
|
+
reason?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface VerificationSummary {
|
|
54
|
+
/** per-concern verification status. */
|
|
55
|
+
concerns: VerifiedConcern[];
|
|
56
|
+
counts: {
|
|
57
|
+
fail: number;
|
|
58
|
+
not_code_verifiable: number;
|
|
59
|
+
/** scanners that did not run (each is a coverage gap). */
|
|
60
|
+
inconclusive: number;
|
|
61
|
+
};
|
|
62
|
+
coverage: {
|
|
63
|
+
/** scanners that ran — their checks are code-verified for what they cover. */
|
|
64
|
+
verified: string[];
|
|
65
|
+
/** scanners that did NOT run — their checks are INCONCLUSIVE, never a pass. */
|
|
66
|
+
inconclusive: {
|
|
67
|
+
source: string;
|
|
68
|
+
reason: string;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
/** the honesty caveat an assessor should read alongside the statuses. */
|
|
72
|
+
note: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Roll a scan up into a verification summary: every concern classified
|
|
76
|
+
* (fail / not-code-verifiable) and every scanner partitioned into verified (ran)
|
|
77
|
+
* vs inconclusive (skipped — gated, not installed, or unparseable). Pure;
|
|
78
|
+
* `outcomes` is the raw `runScanners` result, `concerns` the deduped,
|
|
79
|
+
* Terraform-only set the assessment reports on.
|
|
80
|
+
*/
|
|
81
|
+
export declare function buildVerificationSummary(concerns: Pick<Concern, "id" | "rule_id" | "evidence">[], outcomes: ScannerOutcome[]): VerificationSummary;
|