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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup log formatting for the resolver pipeline. Computes the
|
|
3
|
+
* "model / agent / push / shell / timeout" block that main.ts prints
|
|
4
|
+
* after resolving the agent + model + payload.
|
|
5
|
+
*/
|
|
6
|
+
import type { ResolvedPayload } from "#app/utils/payload";
|
|
7
|
+
/**
|
|
8
|
+
* Emit the startup block ("» model / agent / push / shell / timeout") after
|
|
9
|
+
* the agent and model are resolved. Single side-effect; no return.
|
|
10
|
+
*/
|
|
11
|
+
export declare function logRunStartup(ctx: {
|
|
12
|
+
payload: ResolvedPayload;
|
|
13
|
+
resolvedModel: string | undefined;
|
|
14
|
+
agentName: string;
|
|
15
|
+
}): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret detection and env filtering utilities
|
|
3
|
+
*
|
|
4
|
+
* subprocess env filtering: default-deny allowlist model.
|
|
5
|
+
* only vars in the safe set or user allowlist are passed to child processes.
|
|
6
|
+
*
|
|
7
|
+
* log redaction: SENSITIVE_PATTERNS are used to identify secret values
|
|
8
|
+
* for redaction in logs and GHA masking (independent of subprocess filtering).
|
|
9
|
+
*/
|
|
10
|
+
export declare const SENSITIVE_PATTERNS: RegExp[];
|
|
11
|
+
export declare function isSensitiveEnvName(key: string): boolean;
|
|
12
|
+
export declare function setEnvAllowlist(raw: string): void;
|
|
13
|
+
/** filter env vars using default-deny allowlist: safe set + user allowlist */
|
|
14
|
+
export declare function filterEnv(): Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* env for "inherit" mode: everything in process.env EXCEPT secret-bearing names.
|
|
17
|
+
*
|
|
18
|
+
* inherit exists to widen the *command* surface (arbitrary toolchain vars the
|
|
19
|
+
* restricted allowlist can't enumerate), not to hand the agent credentials — so
|
|
20
|
+
* this is a denylist over the full env rather than the restricted allowlist. A
|
|
21
|
+
* specific var can still be opted back in explicitly via the user allowlist.
|
|
22
|
+
*
|
|
23
|
+
* Without this, `shell: "enabled"` would let the agent read INPUT_*_TOKEN, a BYO
|
|
24
|
+
* model key, or the OIDC minting creds straight out of `env`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function inheritEnv(): Record<string, string>;
|
|
27
|
+
export type EnvMode = "restricted" | "inherit" | Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* resolve env mode to actual env object
|
|
30
|
+
* - "restricted" (default): filterEnv() — only safe set + user allowlist
|
|
31
|
+
* - "inherit": full process.env minus secret-bearing names
|
|
32
|
+
* - object: custom env merged with restricted base
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveEnv(mode: EnvMode | undefined): Record<string, string | undefined>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { ShellPermission } from "#app/external";
|
|
2
|
+
import type { ToolState } from "#app/toolState";
|
|
3
|
+
import type { OctokitWithPlugins } from "#app/utils/github";
|
|
4
|
+
export interface SetupOptions {
|
|
5
|
+
tempDir: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create a shared temp directory for the action
|
|
9
|
+
*/
|
|
10
|
+
export declare function createTempDirectory(): string;
|
|
11
|
+
/**
|
|
12
|
+
* snapshot-and-delete the GHA runner's known credential leak surfaces inside
|
|
13
|
+
* `$RUNNER_TEMP` before the agent spawns. without this, a shell-capable agent
|
|
14
|
+
* can grep:
|
|
15
|
+
* - `_runner_file_commands/set_output_*` for `core.setOutput('token', ghs_…)`
|
|
16
|
+
* calls made by earlier composite-action steps (e.g.
|
|
17
|
+
* infraweaver-io/infraweaver-action/get-installation-token);
|
|
18
|
+
* - `<uuid>.sh` rendered step scripts whose `run: |` body embeds
|
|
19
|
+
* `${{ steps.token.outputs.token }}` literally (GHA expands BEFORE writing);
|
|
20
|
+
* - `git-credentials-*.config` written by `actions/checkout@v6` for the
|
|
21
|
+
* workflow GITHUB_TOKEN.
|
|
22
|
+
*
|
|
23
|
+
* the running bash process already has its own `.sh` open via fd, so the
|
|
24
|
+
* unlink is safe — `unlink` removes the dirent, the kernel keeps reading.
|
|
25
|
+
*
|
|
26
|
+
* preserves every `_runner_file_commands/` file path the runner pre-allocated
|
|
27
|
+
* for OUR step — `$GITHUB_OUTPUT`, `$GITHUB_ENV`, `$GITHUB_PATH`,
|
|
28
|
+
* `$GITHUB_STATE`, `$GITHUB_STEP_SUMMARY`. those are read by the runner
|
|
29
|
+
* AFTER we exit (or by our own `post:` hook), and wiping them would break
|
|
30
|
+
* infraweaver's `result` output, `post:` state handoff, and job summary.
|
|
31
|
+
*
|
|
32
|
+
* silent no-op when `$RUNNER_TEMP` is unset (local dev, `pnpm dev:run`).
|
|
33
|
+
* per-file errors are tolerated — the runner may delete files between
|
|
34
|
+
* our readdir and our unlink.
|
|
35
|
+
*/
|
|
36
|
+
export declare function wipeRunnerLeakSurface(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Setup the test repository for running actions
|
|
39
|
+
*/
|
|
40
|
+
export declare function setupTestRepo(options: SetupOptions): void;
|
|
41
|
+
/**
|
|
42
|
+
* remove any `[includeIf ...]` entries from the local git config so that
|
|
43
|
+
* actions/checkout-persisted credentials don't ride alongside ASKPASS-provided
|
|
44
|
+
* auth for subsequent git operations.
|
|
45
|
+
*
|
|
46
|
+
* SECURITY: git config subsection values can contain arbitrary characters
|
|
47
|
+
* including `$(...)` command substitutions, and `${IFS}` spacing tricks defeat
|
|
48
|
+
* naive split-on-space filtering. we read keys via the `-z` (null-terminated)
|
|
49
|
+
* output format and feed them to a spawn-array `git config --unset-all` so
|
|
50
|
+
* the shell never interpolates key contents — closing the RCE path that a
|
|
51
|
+
* string-interpolated `execSync(...)` would expose.
|
|
52
|
+
*/
|
|
53
|
+
export declare function removeIncludeIfEntries(repoDir: string): void;
|
|
54
|
+
export interface GitContext {
|
|
55
|
+
gitToken: string;
|
|
56
|
+
owner: string;
|
|
57
|
+
name: string;
|
|
58
|
+
octokit: OctokitWithPlugins;
|
|
59
|
+
toolState: ToolState;
|
|
60
|
+
shell: ShellPermission;
|
|
61
|
+
postCheckoutScript: string | null;
|
|
62
|
+
}
|
|
63
|
+
export type SetupGitParams = GitContext;
|
|
64
|
+
/**
|
|
65
|
+
* setup git configuration and authentication for the repository.
|
|
66
|
+
* - configures git identity (user.email, user.name)
|
|
67
|
+
* - sets up authentication via gitToken (minimal contents:write)
|
|
68
|
+
*
|
|
69
|
+
* gitToken is a minimal-permission token (contents + workflows) used for git operations.
|
|
70
|
+
* it is assumed to be potentially exfiltratable, so it has limited scope.
|
|
71
|
+
*/
|
|
72
|
+
export declare function setupGit(params: SetupGitParams): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* snapshot the current HEAD as either a branch name (when on a named branch)
|
|
75
|
+
* or a literal SHA (when detached). used by setupGit to pin the run-entry
|
|
76
|
+
* position and by checkout_pr to compare the live HEAD against it.
|
|
77
|
+
*
|
|
78
|
+
* splitting the two cases is load-bearing: `git rev-parse --abbrev-ref HEAD`
|
|
79
|
+
* returns the sentinel string `"HEAD"` on detached entry — which is the
|
|
80
|
+
* default `actions/checkout` state for `pull_request` events. storing that
|
|
81
|
+
* raw string would make any future detached state (including a subagent's
|
|
82
|
+
* `git checkout --detach <sha>`) compare equal.
|
|
83
|
+
*/
|
|
84
|
+
export declare function captureInitialHead(repoDir: string): {
|
|
85
|
+
kind: "branch";
|
|
86
|
+
name: string;
|
|
87
|
+
} | {
|
|
88
|
+
kind: "detached";
|
|
89
|
+
sha: string;
|
|
90
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type EnvMode } from "#app/utils/secrets";
|
|
2
|
+
interface ShellOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
encoding?: "utf-8" | "utf8" | "ascii" | "base64" | "base64url" | "hex" | "latin1" | "ucs-2" | "ucs2" | "utf16le";
|
|
5
|
+
log?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* env mode: "restricted" (default) filters secrets, "inherit" passes full env,
|
|
8
|
+
* or provide a custom env object (merged with restricted base)
|
|
9
|
+
*/
|
|
10
|
+
env?: EnvMode;
|
|
11
|
+
onError?: (result: {
|
|
12
|
+
status: number;
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
/** wall-clock cap in ms; defaults to DEFAULT_TIMEOUT_MS. a stalled remote or
|
|
17
|
+
* wedged repo hook would otherwise hang until the run-level idle watchdog. */
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
/** stdout/stderr cap in bytes; defaults to DEFAULT_MAX_BUFFER. node's 1 MiB
|
|
20
|
+
* spawnSync default silently truncates large `git diff` output into a
|
|
21
|
+
* generic failure. */
|
|
22
|
+
maxBuffer?: number;
|
|
23
|
+
}
|
|
24
|
+
/** every `$` caller is a git invocation; the longest legitimate one is a
|
|
25
|
+
* clone/fetch of a large repo, well under this. */
|
|
26
|
+
export declare const DEFAULT_TIMEOUT_MS: number;
|
|
27
|
+
/** big-PR `git diff` output can far exceed node's 1 MiB default. */
|
|
28
|
+
export declare const DEFAULT_MAX_BUFFER: number;
|
|
29
|
+
/**
|
|
30
|
+
* Execute a shell command safely using spawnSync with argument arrays.
|
|
31
|
+
* Prevents shell injection by avoiding string interpolation in shell commands.
|
|
32
|
+
*
|
|
33
|
+
* SECURITY: by default, env vars are filtered to remove secrets (tokens, keys, passwords).
|
|
34
|
+
* this prevents malicious code (git hooks, npm scripts, etc.) from exfiltrating credentials.
|
|
35
|
+
* use env: "inherit" only when absolutely necessary.
|
|
36
|
+
*
|
|
37
|
+
* @param cmd - The command to execute
|
|
38
|
+
* @param args - Array of arguments to pass to the command
|
|
39
|
+
* @param options - Optional configuration (cwd, encoding, onError)
|
|
40
|
+
* @returns The trimmed stdout output
|
|
41
|
+
* @throws Error if command fails and no onError handler is provided
|
|
42
|
+
*/
|
|
43
|
+
export declare function $(cmd: string, args: string[], options?: ShellOptions): string;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* write all bundled skills into the fake HOME so OpenCode / Claude Code discover
|
|
3
|
+
* them via their auto-scan directories.
|
|
4
|
+
*
|
|
5
|
+
* called once per agent run from each agent's `run()`. cheap (small file
|
|
6
|
+
* writes), no network, idempotent.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installBundledSkills(params: {
|
|
9
|
+
home: string;
|
|
10
|
+
}): void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
2
|
+
export type TrackChildOptions = {
|
|
3
|
+
child: ChildProcess;
|
|
4
|
+
killGroup?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const SPAWN_TIMEOUT_CODE = "E_SPAWN_TIMEOUT";
|
|
7
|
+
export declare const SPAWN_ACTIVITY_TIMEOUT_CODE = "E_SPAWN_ACTIVITY_TIMEOUT";
|
|
8
|
+
export declare class SpawnTimeoutError extends Error {
|
|
9
|
+
readonly code: typeof SPAWN_TIMEOUT_CODE | typeof SPAWN_ACTIVITY_TIMEOUT_CODE;
|
|
10
|
+
constructor(message: string, code: typeof SPAWN_TIMEOUT_CODE | typeof SPAWN_ACTIVITY_TIMEOUT_CODE);
|
|
11
|
+
}
|
|
12
|
+
export type SignalHandler = (signal: NodeJS.Signals) => void;
|
|
13
|
+
export declare function trackChild(options: TrackChildOptions): void;
|
|
14
|
+
export declare function untrackChild(child: ChildProcess): void;
|
|
15
|
+
export declare function setSignalHandler(handler: SignalHandler | null): void;
|
|
16
|
+
export declare function killTrackedChildren(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Controls what the wrapper retains in memory across the child's lifetime
|
|
19
|
+
* for the post-hoc `SpawnResult.stdout` / `SpawnResult.stderr` snapshots.
|
|
20
|
+
*
|
|
21
|
+
* Streaming callbacks (`onStdout` / `onStderr`) fire regardless — `retain`
|
|
22
|
+
* only governs the buffered snapshot returned in `SpawnResult`.
|
|
23
|
+
*
|
|
24
|
+
* - `"tail"` (default): keep the last `maxRetainedBytes` UTF-16 code units
|
|
25
|
+
* of each stream. Once the cap is exceeded, oldest bytes are sliced off
|
|
26
|
+
* and the result is prefixed with a `... [N MiB truncated] ...` sentinel.
|
|
27
|
+
* Right default for short-lived commands whose failure mode is in their
|
|
28
|
+
* final output (git errors, install failures, hook scripts).
|
|
29
|
+
* - `"none"`: skip the buffer entirely. `SpawnResult.stdout` / `.stderr`
|
|
30
|
+
* are empty strings. Use this for long-lived streaming agents that already
|
|
31
|
+
* drain via `onStdout` / `onStderr` and never read the buffered snapshot.
|
|
32
|
+
*
|
|
33
|
+
* Default cap is 8 MiB — well below V8's ~1 GiB `kMaxLength` so `+= chunk`
|
|
34
|
+
* can never throw `RangeError: Invalid string length`.
|
|
35
|
+
*/
|
|
36
|
+
export type RetainMode = "tail" | "none";
|
|
37
|
+
export declare const DEFAULT_MAX_RETAINED_BYTES: number;
|
|
38
|
+
export interface SpawnOptions {
|
|
39
|
+
cmd: string;
|
|
40
|
+
args: string[];
|
|
41
|
+
env?: NodeJS.ProcessEnv;
|
|
42
|
+
input?: string;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
activityTimeout?: number;
|
|
45
|
+
onActivityTimeout?: (() => void) | undefined;
|
|
46
|
+
abortSignal?: AbortSignal | undefined;
|
|
47
|
+
cwd?: string;
|
|
48
|
+
stdio?: ("pipe" | "ignore" | "inherit")[];
|
|
49
|
+
onStdout?: (chunk: string) => void;
|
|
50
|
+
onStderr?: (chunk: string) => void;
|
|
51
|
+
killGroup?: boolean;
|
|
52
|
+
retain?: RetainMode;
|
|
53
|
+
maxRetainedBytes?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Bounded string accumulator that keeps the tail of appended chunks.
|
|
57
|
+
* Once the cap is exceeded, oldest bytes are sliced off and `toString()`
|
|
58
|
+
* prefixes the survivors with a sentinel describing the elided byte count.
|
|
59
|
+
*
|
|
60
|
+
* Exported because long-lived agent runtimes (opencode, claude) also
|
|
61
|
+
* accumulate per-run narration strings independently of the spawn wrapper
|
|
62
|
+
* and need the same protection against V8's `kMaxLength`.
|
|
63
|
+
*/
|
|
64
|
+
export declare class TailBuffer {
|
|
65
|
+
private readonly cap;
|
|
66
|
+
private buffer;
|
|
67
|
+
private truncatedBytes;
|
|
68
|
+
constructor(cap: number);
|
|
69
|
+
append(chunk: string): void;
|
|
70
|
+
toString(): string;
|
|
71
|
+
}
|
|
72
|
+
export interface SpawnResult {
|
|
73
|
+
stdout: string;
|
|
74
|
+
stderr: string;
|
|
75
|
+
exitCode: number;
|
|
76
|
+
durationMs: number;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Spawn a subprocess with streaming callbacks and buffered results
|
|
80
|
+
*/
|
|
81
|
+
export declare function spawn(options: SpawnOptions): Promise<SpawnResult>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HashiCorp terraform-mcp-server integration.
|
|
3
|
+
*
|
|
4
|
+
* When the `terraform_mcp` input is on, the agent harness registers a SECOND
|
|
5
|
+
* MCP server next to infraweaver's: HashiCorp's terraform-mcp-server, run as a
|
|
6
|
+
* Docker container over stdio. It gives the fixing agent live Terraform
|
|
7
|
+
* Registry knowledge — current module versions, provider argument shapes —
|
|
8
|
+
* which directly powers module-source-aware fixes and generation.
|
|
9
|
+
*
|
|
10
|
+
* Security posture:
|
|
11
|
+
* - the image is VERSION+DIGEST-PINNED (`TERRAFORM_MCP_IMAGE`): the `:0.5.2`
|
|
12
|
+
* tag is human-readable, the `@sha256:` digest is the authoritative pin, so
|
|
13
|
+
* a re-tagged or compromised `0.5.2` upstream can never be pulled. Bump both
|
|
14
|
+
* deliberately (resolve the new digest with `docker buildx imagetools inspect
|
|
15
|
+
* hashicorp/terraform-mcp-server:<ver>` or the Docker Hub tags API).
|
|
16
|
+
* - only the read-only `registry` toolset is enabled — no TFE operations,
|
|
17
|
+
* and no TFE_TOKEN is ever passed.
|
|
18
|
+
* - degrades green: docker absent → a log note, never a failed run.
|
|
19
|
+
*/
|
|
20
|
+
import { type ToolSelectionFlags } from "#app/utils/toolSelection";
|
|
21
|
+
/** pinned release of hashicorp/terraform-mcp-server — tag for humans, digest for
|
|
22
|
+
* integrity (the multi-arch index digest of `0.5.2`). Bump both deliberately. */
|
|
23
|
+
export declare const TERRAFORM_MCP_IMAGE = "hashicorp/terraform-mcp-server:0.5.2@sha256:67b4d3d39aa2c32c5ee280b21d67fb6513dab463af6c93c2ae0cdd4af09d4603";
|
|
24
|
+
/** the registry name the server is registered under in agent MCP configs —
|
|
25
|
+
* matches HashiCorp's own client-config examples, so agent guidance written
|
|
26
|
+
* against "the terraform MCP server" finds it under the expected key. */
|
|
27
|
+
export declare const TERRAFORM_MCP_SERVER_NAME = "terraform";
|
|
28
|
+
export type TerraformMcpResolution = {
|
|
29
|
+
kind: "disabled";
|
|
30
|
+
} | {
|
|
31
|
+
kind: "docker_missing";
|
|
32
|
+
note: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "available";
|
|
35
|
+
command: "docker";
|
|
36
|
+
args: string[];
|
|
37
|
+
};
|
|
38
|
+
/** test hook — the docker probe is cached per process. */
|
|
39
|
+
export declare function _clearDockerProbeCache(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Decide whether the run gets the terraform-mcp-server, as a discriminated
|
|
42
|
+
* union so each harness handles all three outcomes explicitly: register the
|
|
43
|
+
* server (`available`), log the degrade-green note (`docker_missing`), or do
|
|
44
|
+
* nothing (`disabled`).
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveTerraformMcp(payload: ToolSelectionFlags): TerraformMcpResolution;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* time string parsing utilities for timeout configuration.
|
|
3
|
+
* supports formats like "10m", "1h30m", "10m12s", "30s".
|
|
4
|
+
*/
|
|
5
|
+
export declare const TIMEOUT_DISABLED = "none";
|
|
6
|
+
/**
|
|
7
|
+
* parse a time string like "10m", "1h30m", "10m12s" into milliseconds.
|
|
8
|
+
* returns null if the string is not a valid time format.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseTimeString(input: string): number | null;
|
|
11
|
+
/**
|
|
12
|
+
* check if a string is a valid time format.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isValidTimeString(input: string): boolean;
|
|
15
|
+
export declare function resolveTimeoutMs(input: string | undefined): number | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class Timer {
|
|
2
|
+
private initialTimestamp;
|
|
3
|
+
private lastCheckpointTimestamp;
|
|
4
|
+
constructor();
|
|
5
|
+
checkpoint(name: string): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Measures wall-clock gap between the last tool_result and the next tool_call,
|
|
9
|
+
* surfacing it as a "thought for Xs" log when over `THINKING_THRESHOLD`.
|
|
10
|
+
*
|
|
11
|
+
* Use one instance per logical session (orchestrator, each subagent) — sharing
|
|
12
|
+
* a single timer across sessions conflates cross-session interleaving as
|
|
13
|
+
* thinking time. The optional `formatLine` lets the caller prefix output with
|
|
14
|
+
* a session label so attribution is visible in the merged log stream.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ThinkingTimer {
|
|
17
|
+
private readonly durationFormatter;
|
|
18
|
+
private lastToolResultTimestamp;
|
|
19
|
+
private readonly formatLine;
|
|
20
|
+
constructor(formatLine?: (line: string) => string);
|
|
21
|
+
markToolResult(): void;
|
|
22
|
+
markToolCall(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TodoTracker = {
|
|
2
|
+
update: (input: unknown) => void;
|
|
3
|
+
flush: () => Promise<void>;
|
|
4
|
+
cancel: () => void;
|
|
5
|
+
/** resolves when any in-flight onUpdate call completes */
|
|
6
|
+
settled: () => Promise<void>;
|
|
7
|
+
/** mark in-progress items as completed (for final snapshot before review/progress post) */
|
|
8
|
+
completeInProgress: () => void;
|
|
9
|
+
renderCollapsible: (options?: {
|
|
10
|
+
completeInProgress?: boolean;
|
|
11
|
+
}) => string;
|
|
12
|
+
readonly enabled: boolean;
|
|
13
|
+
/** true after the tracker has successfully called onUpdate at least once */
|
|
14
|
+
readonly hasPublished: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function createTodoTracker(onUpdate: (body: string) => Promise<void>): TodoTracker;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PushPermission } from "#app/external";
|
|
2
|
+
import { acquireNewToken } from "#app/utils/github";
|
|
3
|
+
export { acquireNewToken as acquireInstallationToken, revokeGitHubInstallationToken as revokeInstallationToken, };
|
|
4
|
+
/** The live MCP-token refresher (see {@link refreshMcpTokenFn}), or undefined
|
|
5
|
+
* when re-minting isn't possible. Passed into `createOctokit` as `refreshAuth`. */
|
|
6
|
+
export declare function getMcpTokenRefresh(): ((stale: string) => Promise<string>) | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* get the job-scoped token from action input.
|
|
9
|
+
* this token has permissions defined by the workflow's permissions block.
|
|
10
|
+
*
|
|
11
|
+
* fallback order:
|
|
12
|
+
* 1. INPUT_TOKEN (from workflow `with: token:`)
|
|
13
|
+
* 2. GH_TOKEN (external token override)
|
|
14
|
+
* 3. GITHUB_TOKEN (pre-acquired in tests or from GHA env)
|
|
15
|
+
*/
|
|
16
|
+
export declare function getJobToken(): string;
|
|
17
|
+
export type TokenRef = {
|
|
18
|
+
/** Read live via the getter below: after a mid-run re-mint (`refreshGitToken`
|
|
19
|
+
* recovers an auth-class push 401 with a fresh token, revoking the old one),
|
|
20
|
+
* this reflects the CURRENT git token. Push-class tools (push_branch,
|
|
21
|
+
* push_tags, delete_branch, git_fetch) that read it per call therefore never
|
|
22
|
+
* reuse a stale/revoked snapshot. Mirrors the `getMcpTokenRefresh` /
|
|
23
|
+
* `githubInstallationToken` live-getter pattern (pullfrog #891/#964). */
|
|
24
|
+
gitToken: string;
|
|
25
|
+
mcpToken: string;
|
|
26
|
+
/** single-flight re-mint of the git token, threaded into pushWithRetry so an
|
|
27
|
+
* auth-class push 401 can recover with a fresh token (pullfrog #972). undefined
|
|
28
|
+
* when re-minting isn't possible (off-CI or external GH_TOKEN). */
|
|
29
|
+
refreshGitToken?: (stale: string) => Promise<string>;
|
|
30
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
type ResolveTokensParams = {
|
|
33
|
+
push: PushPermission;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* resolve tokens for the action run.
|
|
37
|
+
*
|
|
38
|
+
* creates two separate tokens:
|
|
39
|
+
* - gitToken: contents permission based on `push` setting (assumed exfiltratable)
|
|
40
|
+
* - push: enabled → contents:write (can push)
|
|
41
|
+
* - push: disabled → contents:read (read-only)
|
|
42
|
+
* - mcpToken: full installation token - used for GitHub API calls in MCP tools (not exfiltratable)
|
|
43
|
+
*
|
|
44
|
+
* security-conscious users can pass their own token via GH_TOKEN env var or inputs.token.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveTokens(params: ResolveTokensParams): Promise<TokenRef>;
|
|
47
|
+
/**
|
|
48
|
+
* get the MCP token from memory.
|
|
49
|
+
* this is the token used for GitHub API calls in MCP tools.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getGitHubInstallationToken(): string;
|
|
52
|
+
export declare function revokeGitHubInstallationToken(token: string): Promise<void>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-licence classification (dependency posture; the "non-permissive-tool
|
|
3
|
+
* confirmation gate").
|
|
4
|
+
*
|
|
5
|
+
* Infraweaver ORCHESTRATES external tools — it never bundles or redistributes
|
|
6
|
+
* their binaries ("be an orchestrator, not a redistributor"). This module
|
|
7
|
+
* makes the licence of every selectable tool explicit so the engine can DEFAULT
|
|
8
|
+
* to the permissively-licensed tools and treat a non-permissive one (tflint's
|
|
9
|
+
* embedded BUSL Terraform fork, HashiCorp's terraform-mcp-server) as an
|
|
10
|
+
* *informed, named opt-in* rather than something whose output is consumed
|
|
11
|
+
* silently. Pure data + pure predicates — the gate that consumes it lives in
|
|
12
|
+
* [[toolSelection]].
|
|
13
|
+
*/
|
|
14
|
+
/** every external tool the engine can be configured to run. */
|
|
15
|
+
export type ToolId = "terraform" | "tflint" | "trivy" | "checkov" | "infracost" | "gitleaks" | "conftest" | "terratest" | "terraform_mcp" | "opentofu_mcp";
|
|
16
|
+
/**
|
|
17
|
+
* Coarse licence family the gate reasons about:
|
|
18
|
+
* - `permissive` — MIT / Apache-2.0 / BSD / ISC: default-enabled.
|
|
19
|
+
* - `copyleft` — MPL / (L)GPL / AGPL: gated (explicit opt-in).
|
|
20
|
+
* - `source-available` — BUSL / SSPL / Elastic: gated (explicit opt-in).
|
|
21
|
+
*/
|
|
22
|
+
export type LicenseClass = "permissive" | "copyleft" | "source-available";
|
|
23
|
+
export interface ToolLicense {
|
|
24
|
+
id: ToolId;
|
|
25
|
+
/** display name for logs / PR notes. */
|
|
26
|
+
name: string;
|
|
27
|
+
/** human-facing SPDX-ish identifier (shown, never parsed). */
|
|
28
|
+
license: string;
|
|
29
|
+
class: LicenseClass;
|
|
30
|
+
/**
|
|
31
|
+
* The core Terraform CLI is the SUBSTRATE the engine cannot run without and
|
|
32
|
+
* which the operator installs themselves — invoking it is never
|
|
33
|
+
* redistribution. It is licence-classified for honesty (Terraform moved to
|
|
34
|
+
* BUSL-1.1 at v1.6) but EXEMPT from the opt-in gate, so a Terraform fixer
|
|
35
|
+
* always has Terraform.
|
|
36
|
+
*/
|
|
37
|
+
required?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The single source of truth for what each tool is licensed under. Verified
|
|
41
|
+
* against the "third-party dependency posture" note (June 2026). Keep in sync
|
|
42
|
+
* when a tool's licence changes (e.g. a vendor relicensing event).
|
|
43
|
+
*/
|
|
44
|
+
export declare const TOOL_LICENSES: Readonly<Record<ToolId, ToolLicense>>;
|
|
45
|
+
export declare const ALL_TOOL_IDS: ToolId[];
|
|
46
|
+
/** a permissively-licensed tool can be enabled by default; anything else needs
|
|
47
|
+
* an explicit, licence-named opt-in. */
|
|
48
|
+
export declare function isPermissive(c: LicenseClass): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* A tool whose output must NOT be consumed without an explicit, licence-named
|
|
51
|
+
* opt-in: non-permissive AND not the required substrate. This is the predicate
|
|
52
|
+
* the confirmation gate is built on.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isLicenseGated(id: ToolId): boolean;
|
|
55
|
+
/** every tool currently behind the licence gate (for docs / reporting). */
|
|
56
|
+
export declare const LICENSE_GATED_TOOLS: ToolId[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified tool-selection config + the
|
|
3
|
+
* non-permissive-tool confirmation gate (built on [[toolLicensing]]).
|
|
4
|
+
*
|
|
5
|
+
* One declarative `tools_enabled` list replaces the previous mix of per-flag
|
|
6
|
+
* inputs and silent presence-detection: an operator names the scanners/engines
|
|
7
|
+
* they want, prefixing `-` to turn one off. The same list is how a non-permissive
|
|
8
|
+
* tool (tflint, terraform-mcp-server) is opted into — naming it is the explicit,
|
|
9
|
+
* licence-aware acknowledgement the gate requires.
|
|
10
|
+
*
|
|
11
|
+
* Resolution precedence, per tool (highest first):
|
|
12
|
+
* 1. the required substrate (`terraform`) → ON (exempt; never disablable)
|
|
13
|
+
* 2. an explicit `-tool` in the list → OFF (always wins over the rest)
|
|
14
|
+
* 3. an explicit `tool` / `+tool` → ON (this is the licence opt-in)
|
|
15
|
+
* 4. `all` base → ON (operator accepts every tool)
|
|
16
|
+
* 5. `none` base → only the explicitly/flag-enabled
|
|
17
|
+
* 6. default base:
|
|
18
|
+
* - licence-gated tool → ON only if its dedicated flag is set, else OFF
|
|
19
|
+
* - flag-opt-in tool → ON only if its dedicated flag is set, else OFF
|
|
20
|
+
* - permissive tool → ON
|
|
21
|
+
*
|
|
22
|
+
* The dedicated booleans (`gitleaks`, `terratest`, `terraform_mcp`) still work
|
|
23
|
+
* and count as an opt-in, so existing workflows keep running unchanged. Pure.
|
|
24
|
+
*/
|
|
25
|
+
import { isPermissive, TOOL_LICENSES, type ToolId } from "#app/utils/toolLicensing";
|
|
26
|
+
/** the parsed `tools_enabled` input: a base posture + per-tool overrides. */
|
|
27
|
+
export interface ToolDirective {
|
|
28
|
+
/** `all` (enable everything) / `none` (enable nothing) / undefined (defaults). */
|
|
29
|
+
base?: "all" | "none" | undefined;
|
|
30
|
+
/** explicit per-tool overrides: true = enable, false = disable. */
|
|
31
|
+
explicit: Map<ToolId, boolean>;
|
|
32
|
+
/** tokens that matched no known tool — surfaced as a warning, never fatal. */
|
|
33
|
+
unknown: string[];
|
|
34
|
+
}
|
|
35
|
+
/** the dedicated booleans that pre-date the unified list. */
|
|
36
|
+
export interface ToolSelectionFlags {
|
|
37
|
+
toolsEnabled?: ToolDirective | undefined;
|
|
38
|
+
gitleaks?: boolean;
|
|
39
|
+
terratest?: boolean;
|
|
40
|
+
terraformMcp?: boolean;
|
|
41
|
+
opentofuMcp?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parse the `tools_enabled` input (comma- or newline-separated). Recognises the
|
|
45
|
+
* `all` / `none` bases and `tool` / `+tool` / `-tool` (also `!tool`) overrides.
|
|
46
|
+
* Returns undefined for an empty input so "unset" stays distinguishable from an
|
|
47
|
+
* explicit list (the consumer then applies the licence-aware defaults).
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseToolSelection(raw: string | undefined): ToolDirective | undefined;
|
|
50
|
+
/** the resolved selection for a run — a deterministic verdict per tool. */
|
|
51
|
+
export interface ResolvedToolSelection {
|
|
52
|
+
enabled(id: ToolId): boolean;
|
|
53
|
+
/** the reason a tool is OFF (for the scan report / logs); undefined when ON. */
|
|
54
|
+
offReason(id: ToolId): string | undefined;
|
|
55
|
+
/** licence-gated tools that are OFF because they weren't opted into. */
|
|
56
|
+
gated: ToolId[];
|
|
57
|
+
/** tools explicitly turned off via `tools_enabled`. */
|
|
58
|
+
disabled: ToolId[];
|
|
59
|
+
/** unrecognised `tools_enabled` tokens (warn, never fatal). */
|
|
60
|
+
unknownTokens: string[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the per-tool selection from the run's payload (the parsed
|
|
64
|
+
* `tools_enabled` directive + the dedicated booleans). Pure; safe to call from
|
|
65
|
+
* any consumer (the scan tool, the secret guardrail, the terraform-mcp resolver,
|
|
66
|
+
* the plan tool) so they all agree on which tools may run this run.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveToolSelection(flags: ToolSelectionFlags): ResolvedToolSelection;
|
|
69
|
+
/** map a `terraform_scan` scanner source to the tool id it belongs to (null for
|
|
70
|
+
* the `reviewer` pseudo-source, which the gate never governs). */
|
|
71
|
+
export declare function scannerToolId(source: string): ToolId | null;
|
|
72
|
+
export type { ToolId };
|
|
73
|
+
export { isPermissive, TOOL_LICENSES };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { encode } from "@toon-format/toon";
|
|
2
|
+
/**
|
|
3
|
+
* Recursively replaces lone surrogates in strings and object keys with U+FFFD.
|
|
4
|
+
* Exported for the tests; prefer {@link toonEncode}.
|
|
5
|
+
*
|
|
6
|
+
* Rebuilt with `Object.fromEntries`, which defines own data properties rather
|
|
7
|
+
* than assigning them — so a `__proto__` key in untrusted input cannot reach
|
|
8
|
+
* the prototype setter.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toWellFormedDeep<T>(value: T): T;
|
|
11
|
+
/**
|
|
12
|
+
* `@toon-format/toon`'s `encode`, applied to well-formed input. Use this
|
|
13
|
+
* everywhere instead of importing `encode` directly — `knip` and the import
|
|
14
|
+
* guard keep the direct import to this module.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toonEncode(input: unknown, options?: Parameters<typeof encode>[1]): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @throws Error if the action can't process payload
|
|
3
|
+
* The compatibility is determined according to the COMPATIBILITY_POLICY above.
|
|
4
|
+
* @param payloadVersion the version of the payload
|
|
5
|
+
* @param actionVersion the version of the action (recipient)
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateCompatibility(payloadVersion: string, actionVersion: string): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const VERTEX_SERVICE_ACCOUNT_JSON_ENV = "VERTEX_SERVICE_ACCOUNT_JSON";
|
|
2
|
+
export declare const GOOGLE_APPLICATION_CREDENTIALS_ENV = "GOOGLE_APPLICATION_CREDENTIALS";
|
|
3
|
+
export declare const GOOGLE_CLOUD_PROJECT_ENV = "GOOGLE_CLOUD_PROJECT";
|
|
4
|
+
export declare const VERTEX_LOCATION_ENV = "VERTEX_LOCATION";
|
|
5
|
+
export type VertexCredentials = {
|
|
6
|
+
credentialsPath: string;
|
|
7
|
+
secretDir: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function isVertexRoute(model: string | undefined): boolean;
|
|
10
|
+
export declare function readProjectIdFromVertexServiceAccountJson(): string | undefined;
|
|
11
|
+
export declare function materializeVertexCredentials(params: {
|
|
12
|
+
model: string | undefined;
|
|
13
|
+
}): VertexCredentials | undefined;
|
|
14
|
+
export declare function cleanupVertexCredentials(credentials: VertexCredentials | undefined): void;
|
|
15
|
+
export declare function applyClaudeVertexEnv(env: Record<string, string | undefined>): void;
|
|
16
|
+
export declare function resolveVertexOpenCodeModel(model: string | undefined): string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OctokitWithPlugins } from "#app/utils/github";
|
|
2
|
+
interface ResolveRunParams {
|
|
3
|
+
octokit: OctokitWithPlugins;
|
|
4
|
+
}
|
|
5
|
+
export interface ResolveRunResult {
|
|
6
|
+
runId: number | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolve GitHub Actions workflow run context.
|
|
10
|
+
* Uses GITHUB_REPOSITORY and GITHUB_RUN_ID env vars.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveRun(_params: ResolveRunParams): Promise<ResolveRunResult>;
|
|
13
|
+
export {};
|