infraweaver 0.3.7 → 0.3.9

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.
Files changed (175) hide show
  1. package/README.md +2 -2
  2. package/dist/agents/claude.d.ts +1 -1
  3. package/dist/agents/claudePretoolGate.d.ts +0 -36
  4. package/dist/agents/toolPlaneWatch.d.ts +31 -0
  5. package/dist/cli.mjs +31908 -18736
  6. package/dist/external.d.ts +2 -1
  7. package/dist/index.js +31992 -18749
  8. package/dist/internal.js +133 -52
  9. package/dist/mcp/baseBranch.d.ts +41 -0
  10. package/dist/mcp/changeSummary.d.ts +1 -1
  11. package/dist/mcp/findingAudit.d.ts +2 -0
  12. package/dist/mcp/guardrails.d.ts +38 -0
  13. package/dist/mcp/localContext.d.ts +1 -1
  14. package/dist/mcp/moduleExtraction.d.ts +5 -0
  15. package/dist/mcp/pr.d.ts +0 -31
  16. package/dist/mcp/reproveSuggestions.d.ts +27 -0
  17. package/dist/mcp/review.d.ts +126 -2
  18. package/dist/mcp/reviewCommentLimit.d.ts +17 -0
  19. package/dist/mcp/reviewComments.d.ts +9 -5
  20. package/dist/mcp/reviewDedup.d.ts +1 -0
  21. package/dist/mcp/reviewMarkers.d.ts +10 -0
  22. package/dist/mcp/reviewProvenance.d.ts +20 -6
  23. package/dist/mcp/shared.d.ts +15 -0
  24. package/dist/mcp/suggestionProver.d.ts +3 -2
  25. package/dist/mcp/terraform/checkovSeverities.d.ts +7 -0
  26. package/dist/mcp/terraform/consolidation.d.ts +26 -0
  27. package/dist/mcp/terraform/cost.d.ts +2 -2
  28. package/dist/mcp/terraform/currency.d.ts +11 -0
  29. package/dist/mcp/terraform/deltaSummary.d.ts +11 -1
  30. package/dist/mcp/terraform/emittedArtefacts.d.ts +11 -0
  31. package/dist/mcp/terraform/evidence.d.ts +10 -0
  32. package/dist/mcp/terraform/gateScan.d.ts +2 -16
  33. package/dist/mcp/terraform/hcl.d.ts +15 -0
  34. package/dist/mcp/terraform/initArtefacts.d.ts +21 -0
  35. package/dist/mcp/terraform/localModules.d.ts +29 -0
  36. package/dist/mcp/terraform/moduleFindings.d.ts +38 -0
  37. package/dist/mcp/terraform/refactor/attribution.d.ts +1 -1
  38. package/dist/mcp/terraform/refactor/equivalence.d.ts +7 -0
  39. package/dist/mcp/terraform/refactor/expressions.d.ts +62 -0
  40. package/dist/mcp/terraform/refactor/references.d.ts +15 -0
  41. package/dist/mcp/terraform/refactor/resources.d.ts +11 -0
  42. package/dist/mcp/terraform/refactor/substitution.d.ts +55 -37
  43. package/dist/mcp/terraform/scanDelta.d.ts +28 -0
  44. package/dist/mcp/terraform/scanSession.d.ts +13 -0
  45. package/dist/mcp/terraform/scanners.d.ts +67 -18
  46. package/dist/mcp/terraform/secretScan.d.ts +19 -0
  47. package/dist/mcp/terraform/standardsReport.d.ts +1 -1
  48. package/dist/mcp/terraform/tools/plan.d.ts +1 -1
  49. package/dist/mcp/terraform/tools/scan.d.ts +7 -7
  50. package/dist/mcp/terraform/tools/validate.d.ts +7 -2
  51. package/dist/mcp/terraform/tools/verifyRemediation.d.ts +1 -1
  52. package/dist/mcp/terraform/treeLayout.d.ts +57 -0
  53. package/dist/mcp/terraform/types.d.ts +1 -1
  54. package/dist/phases/applyPlan.d.ts +0 -2
  55. package/dist/toolState.d.ts +3 -0
  56. package/dist/utils/agent/codexOAuth.d.ts +1 -1
  57. package/dist/utils/cli.d.ts +1 -7
  58. package/dist/utils/cloud/cloudReport.d.ts +1 -1
  59. package/dist/utils/config/baseRefConfig.d.ts +1 -1
  60. package/dist/utils/config/infraweaverConfig.d.ts +1 -1
  61. package/dist/utils/config/payload.d.ts +5 -0
  62. package/dist/utils/markdownTable.d.ts +6 -0
  63. package/dist/utils/setup/toolLicensing.d.ts +1 -1
  64. package/dist/utils/unifiedDiff.d.ts +69 -0
  65. package/package.json +34 -28
  66. package/src/agents/claude.ts +48 -13
  67. package/src/agents/claudePretoolGate.ts +9 -17
  68. package/src/agents/sessionLabeler.ts +3 -3
  69. package/src/agents/toolPlaneWatch.ts +71 -0
  70. package/src/external.ts +3 -1
  71. package/src/mcp/assess.ts +8 -8
  72. package/src/mcp/baseBranch.ts +96 -0
  73. package/src/mcp/changeSummary.ts +10 -11
  74. package/src/mcp/checkSuite.ts +7 -10
  75. package/src/mcp/checkout.ts +13 -40
  76. package/src/mcp/crosswalk.ts +5 -0
  77. package/src/mcp/findingAudit.ts +1 -1
  78. package/src/mcp/git.ts +44 -2
  79. package/src/mcp/guardrails.ts +188 -36
  80. package/src/mcp/localContext.ts +2 -0
  81. package/src/mcp/localServer.ts +1 -0
  82. package/src/mcp/moduleExtraction.ts +17 -5
  83. package/src/mcp/moduleTests.ts +9 -2
  84. package/src/mcp/modules.ts +10 -7
  85. package/src/mcp/pr.ts +17 -65
  86. package/src/mcp/reproveSuggestions.ts +86 -0
  87. package/src/mcp/review.ts +249 -75
  88. package/src/mcp/reviewAnchor.ts +11 -23
  89. package/src/mcp/reviewCommentLimit.ts +79 -0
  90. package/src/mcp/reviewComments.ts +34 -81
  91. package/src/mcp/reviewDedup.ts +1 -1
  92. package/src/mcp/reviewMarkers.ts +25 -2
  93. package/src/mcp/reviewProvenance.ts +56 -21
  94. package/src/mcp/roots.ts +3 -2
  95. package/src/mcp/server.ts +2 -1
  96. package/src/mcp/shared.ts +40 -1
  97. package/src/mcp/shell.ts +27 -28
  98. package/src/mcp/suggestionProver.ts +8 -4
  99. package/src/mcp/terraform/checkovSeverities.ts +1156 -0
  100. package/src/mcp/terraform/concernResult.ts +2 -1
  101. package/src/mcp/terraform/consolidation.ts +232 -19
  102. package/src/mcp/terraform/cost.ts +16 -7
  103. package/src/mcp/terraform/cspm.ts +8 -4
  104. package/src/mcp/terraform/currency.ts +28 -12
  105. package/src/mcp/terraform/decisions.ts +1 -1
  106. package/src/mcp/terraform/deltaSummary.ts +50 -1
  107. package/src/mcp/terraform/emittedArtefacts.ts +63 -0
  108. package/src/mcp/terraform/evidence.ts +23 -3
  109. package/src/mcp/terraform/gateScan.ts +191 -128
  110. package/src/mcp/terraform/hcl.ts +27 -2
  111. package/src/mcp/terraform/idleFloor.ts +2 -1
  112. package/src/mcp/terraform/initArtefacts.ts +76 -0
  113. package/src/mcp/terraform/localModules.ts +112 -0
  114. package/src/mcp/terraform/moduleDocs.ts +2 -5
  115. package/src/mcp/terraform/moduleFindings.ts +102 -0
  116. package/src/mcp/terraform/moduleVersionConstraints.ts +1 -1
  117. package/src/mcp/terraform/planPairs.ts +2 -20
  118. package/src/mcp/terraform/policyGate.ts +0 -15
  119. package/src/mcp/terraform/refactor/attribution.ts +39 -5
  120. package/src/mcp/terraform/refactor/equivalence.ts +49 -10
  121. package/src/mcp/terraform/refactor/expressions.ts +323 -0
  122. package/src/mcp/terraform/refactor/references.ts +101 -0
  123. package/src/mcp/terraform/refactor/resources.ts +79 -7
  124. package/src/mcp/terraform/refactor/substitution.ts +852 -256
  125. package/src/mcp/terraform/scanDelta.ts +41 -0
  126. package/src/mcp/terraform/scanSession.ts +30 -0
  127. package/src/mcp/terraform/scannerCache.ts +4 -0
  128. package/src/mcp/terraform/scanners.ts +553 -233
  129. package/src/mcp/terraform/secretScan.ts +131 -0
  130. package/src/mcp/terraform/standardsReport.ts +14 -13
  131. package/src/mcp/terraform/tools/consolidationCandidates.ts +3 -0
  132. package/src/mcp/terraform/tools/emitEvidence.ts +13 -5
  133. package/src/mcp/terraform/tools/emitOscal.ts +3 -2
  134. package/src/mcp/terraform/tools/emitVex.ts +10 -4
  135. package/src/mcp/terraform/tools/equivalenceCheck.ts +139 -21
  136. package/src/mcp/terraform/tools/infracostDiff.ts +2 -2
  137. package/src/mcp/terraform/tools/plan.ts +30 -17
  138. package/src/mcp/terraform/tools/reviewScanDelta.ts +3 -0
  139. package/src/mcp/terraform/tools/scan.ts +5 -3
  140. package/src/mcp/terraform/tools/standardsReport.ts +1 -1
  141. package/src/mcp/terraform/tools/validate.ts +20 -5
  142. package/src/mcp/terraform/tools/verifyRemediation.ts +14 -7
  143. package/src/mcp/terraform/tools/versionCurrency.ts +3 -1
  144. package/src/mcp/terraform/treeLayout.ts +378 -0
  145. package/src/mcp/terraform/types.ts +4 -1
  146. package/src/mcp/terraform/versionRequirements.ts +11 -2
  147. package/src/modes/__snapshots__/assemblePrompt.test.ts.snap +2 -0
  148. package/src/modes/modernize-deprecated.ts +2 -2
  149. package/src/modes/refactor.ts +9 -9
  150. package/src/modes/remediate.ts +1 -1
  151. package/src/modes/terraform-code-review.ts +7 -3
  152. package/src/modes/update-dependencies.ts +6 -6
  153. package/src/phases/applyPlan.ts +33 -14
  154. package/src/phases/applySuggestions.ts +2 -2
  155. package/src/phases/runAgentWithWatchdogs.ts +2 -1
  156. package/src/toolState.ts +7 -0
  157. package/src/utils/agent/codexOAuth.ts +7 -7
  158. package/src/utils/agent/openCodeModels.ts +4 -6
  159. package/src/utils/cli.ts +1 -31
  160. package/src/utils/cloud/runContext.ts +1 -8
  161. package/src/utils/config/baseRefConfig.ts +6 -0
  162. package/src/utils/config/infraweaverConfig.ts +2 -0
  163. package/src/utils/config/payload.ts +41 -0
  164. package/src/utils/github/assets.ts +1 -6
  165. package/src/utils/github/github.ts +42 -150
  166. package/src/utils/github/token.ts +6 -11
  167. package/src/utils/log.ts +4 -5
  168. package/src/utils/markdownTable.ts +11 -0
  169. package/src/utils/prompt/changeImpact.ts +18 -26
  170. package/src/utils/prompt/instructions.ts +1 -1
  171. package/src/utils/prompt/promptDirectives.ts +1 -1
  172. package/src/utils/prompt/toolSelection.ts +11 -2
  173. package/src/utils/setup/toolLicensing.ts +7 -0
  174. package/src/utils/telemetry.ts +2 -1
  175. package/src/utils/unifiedDiff.ts +120 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](LICENSE)
4
4
  [![CI](https://github.com/infraweaver-io/infraweaver-action/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/infraweaver-io/infraweaver-action/actions/workflows/test.yml)
5
- [![Version](https://img.shields.io/badge/version-0.3.7)](package.json) <!-- x-release-please-version -->
5
+ [![Version](https://img.shields.io/badge/version-0.3.9)](package.json) <!-- x-release-please-version -->
6
6
 
7
7
  **Infraweaver brings your Terraform up to best practice — automatically, as reviewable pull requests.**
8
8
 
@@ -53,7 +53,7 @@ jobs:
53
53
  - uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1
54
54
  with:
55
55
  # renovate: datasource=github-releases depName=aquasecurity/trivy
56
- version: v0.72.0 # pin the TOOL too: a SHA-pinned action still installs floating-latest
56
+ version: v0.74.0 # pin the TOOL too: a SHA-pinned action still installs floating-latest
57
57
  - run: pipx install checkov
58
58
 
59
59
  - name: Run Infraweaver
@@ -26,7 +26,7 @@ export declare function writeMcpConfig(ctx: AgentRunContext): string;
26
26
  * 'sonnet' | 'opus' | 'haiku') and takes precedence over what's set here —
27
27
  * we don't pass it; the per-subagent `model` field is the right default.
28
28
  *
29
- * The `model` is route-aware: the bare Anthropic-API id `claude-sonnet-5`
29
+ * The `model` is route-aware: the bare Anthropic-API id `claude-sonnet-5-5`
30
30
  * is only valid on the direct API. On Bedrock (`eu.anthropic.…`) and Vertex
31
31
  * (`@`-versioned) routes that id is rejected, and claude-code does not
32
32
  * translate per-agent model names — so on those routes we omit `model`
@@ -34,42 +34,6 @@
34
34
  * inside `ctx.tmpdir` (where `--settings` can find it) and survives bundle
35
35
  * minification.
36
36
  */
37
- /**
38
- * The pinned `@anthropic-ai/claude-code` version against which the subagent
39
- * gate's `agent_id` discriminator was last verified (see the contract notes in
40
- * the gate source below). The gate fails OPEN for subagents if claude-code ever
41
- * stops populating `agent_id` in the PreToolUse hook payload, so a version bump
42
- * must be paired with a re-verification of `createBaseHookInput`.
43
- *
44
- * `claudePretoolGate.test.ts` asserts this equals the version pinned in
45
- * `package.json` — that test fails on any bump, forcing the re-verification
46
- * before the pin and this constant are updated together.
47
- *
48
- * 2.1.266 verified 2026-09-26 against the schema embedded in the installed
49
- * binary: the base hook input still declares `agent_id` as
50
- * `string().optional().describe("Subagent identifier. Present only when the
51
- * hook fires from within a subagent (e.g., a tool called by an AgentTool
52
- * worker). Absent for the main thread, even in --agent sessions. Use this
53
- * field (not agent_type) to distinguish subagent calls from main-thread
54
- * calls.")` — exactly the discriminator the gate relies on, byte-for-byte
55
- * unchanged from the 2.1.220 verification (2026-07-28), which was itself
56
- * unchanged from 2.1.198 (2026-07-10), 2.1.195 (2026-07-01) and 2.1.190
57
- * (2026-06-25), the last of which was more explicit than the 2.1.177 schema it
58
- * replaced. The 2.1.266 pass also re-confirmed the field is POPULATED and not
59
- * merely declared: `createBaseHookInput` (minified; the names change per build)
60
- * returns `{ …, agent_id: o?.agentId, agent_type: d, … }` — read off the caller's
61
- * context object, not a hardcoded empty string. (The bundle does contain an
62
- * `agent_id:""` literal, but on a different path — the coercion
63
- * `Xu(e.agent_id) ? String(e.agent_id) : ""` that normalises an ABSENT id on
64
- * the main thread, which is the documented behaviour, not the hook builder.)
65
- *
66
- * Scope of this verification, stated honestly: it is static inspection of the
67
- * shipped binary. No CI job exercises the Claude subagent gate against a live
68
- * agent — `security-tests.yml` is deliberately opencode-only (free keyless
69
- * model; Claude Code cannot use an `opencode/*` gateway model). So this pin,
70
- * plus the tripwire test, IS the contract check. Keep both.
71
- */
72
- export declare const CLAUDE_CODE_AGENT_ID_VERIFIED_VERSION: "2.1.266";
73
37
  /**
74
38
  * Source written to `<ctx.tmpdir>/infraweaver-pretool-gate.mjs`. Plain ESM,
75
39
  * no TypeScript, no dependencies — node executes it directly via the
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Notices when the agent has lost the infraweaver tool server, so the run stops
3
+ * instead of spending its budget without it.
4
+ *
5
+ * Every deliverable — the push, the pull request, the review, the final
6
+ * progress report — goes through that server. Once Claude Code drops it, each
7
+ * call fails at once with "not connected", and a model told to keep trying
8
+ * retries in a tight loop until the token quota ends the run: a refactor did
9
+ * exactly that for 41 minutes and 8.5M tokens.
10
+ *
11
+ * One lost call is not enough to stop on: Claude Code reconnects, and a call
12
+ * that lands mid-reconnect fails the same way. The run stops only after
13
+ * {@link LOST_CALLS} such failures in a row spanning at least
14
+ * {@link LOST_WINDOW_MS}, with no infraweaver call succeeding in between.
15
+ */
16
+ export declare const LOST_CALLS = 3;
17
+ export declare const LOST_WINDOW_MS = 30000;
18
+ export declare class ToolPlaneLostError extends Error {
19
+ constructor(calls: number, seconds: number);
20
+ }
21
+ export interface ToolResult {
22
+ /** the tool that was called, when known. */
23
+ toolName: string | undefined;
24
+ isError: boolean;
25
+ text: string;
26
+ }
27
+ export declare function createToolPlaneWatch(now?: () => number): {
28
+ /** Record one tool result; returns the error to stop with once the server is lost. */
29
+ observe(result: ToolResult): ToolPlaneLostError | null;
30
+ };
31
+ export type ToolPlaneWatch = ReturnType<typeof createToolPlaneWatch>;