infraweaver 0.3.11 → 0.3.12
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/README.md +1 -1
- package/dist/cli.mjs +310 -231
- package/dist/index.js +289 -210
- package/dist/mcp/terraform/awsPrices.d.ts +1 -1
- package/dist/mcp/terraform/azurePrices.d.ts +1 -1
- package/dist/mcp/terraform/scanSession.d.ts +2 -0
- package/dist/mcp/terraform/verifySites.d.ts +48 -0
- package/package.json +1 -1
- package/src/mcp/terraform/awsPrices.ts +1 -1
- package/src/mcp/terraform/azurePrices.ts +23 -23
- package/src/mcp/terraform/concernResult.ts +2 -0
- package/src/mcp/terraform/scanSession.ts +6 -0
- package/src/mcp/terraform/tools/verifyRemediation.ts +23 -1
- package/src/mcp/terraform/verifySites.ts +106 -0
package/dist/index.js
CHANGED
|
@@ -84161,14 +84161,14 @@ var require_turndown_cjs = __commonJS({
|
|
|
84161
84161
|
} else if (node3.nodeType === 1) {
|
|
84162
84162
|
replacement = replacementForNode.call(self2, node3);
|
|
84163
84163
|
}
|
|
84164
|
-
return
|
|
84164
|
+
return join75(output2, replacement);
|
|
84165
84165
|
}, "");
|
|
84166
84166
|
}
|
|
84167
84167
|
function postProcess(output2) {
|
|
84168
84168
|
var self2 = this;
|
|
84169
84169
|
this.rules.forEach(function(rule) {
|
|
84170
84170
|
if (typeof rule.append === "function") {
|
|
84171
|
-
output2 =
|
|
84171
|
+
output2 = join75(output2, rule.append(self2.options));
|
|
84172
84172
|
}
|
|
84173
84173
|
});
|
|
84174
84174
|
return output2.replace(/^[\t\r\n]+/, "").replace(/[\t\r\n\s]+$/, "");
|
|
@@ -84180,7 +84180,7 @@ var require_turndown_cjs = __commonJS({
|
|
|
84180
84180
|
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
84181
84181
|
return whitespace.leading + rule.replacement(content, node3, this.options) + whitespace.trailing;
|
|
84182
84182
|
}
|
|
84183
|
-
function
|
|
84183
|
+
function join75(output2, replacement) {
|
|
84184
84184
|
var s1 = trimTrailingNewlines(output2);
|
|
84185
84185
|
var s2 = trimLeadingNewlines(replacement);
|
|
84186
84186
|
var nls = Math.max(output2.length - s1.length, replacement.length - s2.length);
|
|
@@ -97300,7 +97300,7 @@ var require_polyfill = __commonJS({
|
|
|
97300
97300
|
var {
|
|
97301
97301
|
dirname: dirname15,
|
|
97302
97302
|
isAbsolute: isAbsolute7,
|
|
97303
|
-
join:
|
|
97303
|
+
join: join75,
|
|
97304
97304
|
parse: parse8,
|
|
97305
97305
|
resolve: resolve11,
|
|
97306
97306
|
sep: sep11,
|
|
@@ -97557,8 +97557,8 @@ var require_polyfill = __commonJS({
|
|
|
97557
97557
|
const dir = await readdir2(src);
|
|
97558
97558
|
for (let i = 0; i < dir.length; i++) {
|
|
97559
97559
|
const item = dir[i];
|
|
97560
|
-
const srcItem =
|
|
97561
|
-
const destItem =
|
|
97560
|
+
const srcItem = join75(src, item);
|
|
97561
|
+
const destItem = join75(dest, item);
|
|
97562
97562
|
const { destStat } = await checkPaths2(srcItem, destItem, opts);
|
|
97563
97563
|
await startCopy(destStat, srcItem, destItem, opts);
|
|
97564
97564
|
}
|
|
@@ -97631,7 +97631,7 @@ var require_cp = __commonJS({
|
|
|
97631
97631
|
// node_modules/.pnpm/@npmcli+fs@6.0.0/node_modules/@npmcli/fs/lib/with-temp-dir.js
|
|
97632
97632
|
var require_with_temp_dir = __commonJS({
|
|
97633
97633
|
"node_modules/.pnpm/@npmcli+fs@6.0.0/node_modules/@npmcli/fs/lib/with-temp-dir.js"(exports2, module) {
|
|
97634
|
-
var { join:
|
|
97634
|
+
var { join: join75, sep: sep11 } = __require("path");
|
|
97635
97635
|
var getOptions2 = require_get_options();
|
|
97636
97636
|
var { mkdir: mkdir5, mkdtemp, rm: rm2 } = __require("fs/promises");
|
|
97637
97637
|
var withTempDir = async (root, fn2, opts) => {
|
|
@@ -97639,7 +97639,7 @@ var require_with_temp_dir = __commonJS({
|
|
|
97639
97639
|
copy: ["tmpPrefix"]
|
|
97640
97640
|
});
|
|
97641
97641
|
await mkdir5(root, { recursive: true });
|
|
97642
|
-
const target = await mkdtemp(
|
|
97642
|
+
const target = await mkdtemp(join75(`${root}${sep11}`, options.tmpPrefix || ""));
|
|
97643
97643
|
let err;
|
|
97644
97644
|
let result;
|
|
97645
97645
|
try {
|
|
@@ -97664,13 +97664,13 @@ var require_with_temp_dir = __commonJS({
|
|
|
97664
97664
|
var require_readdir_scoped = __commonJS({
|
|
97665
97665
|
"node_modules/.pnpm/@npmcli+fs@6.0.0/node_modules/@npmcli/fs/lib/readdir-scoped.js"(exports2, module) {
|
|
97666
97666
|
var { readdir: readdir2 } = __require("fs/promises");
|
|
97667
|
-
var { join:
|
|
97667
|
+
var { join: join75 } = __require("path");
|
|
97668
97668
|
var readdirScoped = async (dir) => {
|
|
97669
97669
|
const results = [];
|
|
97670
97670
|
for (const item of await readdir2(dir)) {
|
|
97671
97671
|
if (item.startsWith("@")) {
|
|
97672
|
-
for (const scopedItem of await readdir2(
|
|
97673
|
-
results.push(
|
|
97672
|
+
for (const scopedItem of await readdir2(join75(dir, item))) {
|
|
97673
|
+
results.push(join75(item, scopedItem));
|
|
97674
97674
|
}
|
|
97675
97675
|
} else {
|
|
97676
97676
|
results.push(item);
|
|
@@ -97685,7 +97685,7 @@ var require_readdir_scoped = __commonJS({
|
|
|
97685
97685
|
// node_modules/.pnpm/@npmcli+fs@6.0.0/node_modules/@npmcli/fs/lib/move-file.js
|
|
97686
97686
|
var require_move_file = __commonJS({
|
|
97687
97687
|
"node_modules/.pnpm/@npmcli+fs@6.0.0/node_modules/@npmcli/fs/lib/move-file.js"(exports2, module) {
|
|
97688
|
-
var { dirname: dirname15, join:
|
|
97688
|
+
var { dirname: dirname15, join: join75, resolve: resolve11, relative: relative8, isAbsolute: isAbsolute7 } = __require("path");
|
|
97689
97689
|
var fs12 = __require("fs/promises");
|
|
97690
97690
|
var pathExists2 = async (path15) => {
|
|
97691
97691
|
try {
|
|
@@ -97715,7 +97715,7 @@ var require_move_file = __commonJS({
|
|
|
97715
97715
|
if (sourceStat.isDirectory()) {
|
|
97716
97716
|
const files = await fs12.readdir(source);
|
|
97717
97717
|
await Promise.all(files.map(
|
|
97718
|
-
(file2) => moveFile(
|
|
97718
|
+
(file2) => moveFile(join75(source, file2), join75(destination, file2), options, false, symlinks)
|
|
97719
97719
|
));
|
|
97720
97720
|
} else if (sourceStat.isSymbolicLink()) {
|
|
97721
97721
|
symlinks.push({ source, destination });
|
|
@@ -259203,7 +259203,7 @@ import { randomBytes as randomBytes2 } from "node:crypto";
|
|
|
259203
259203
|
// package.json
|
|
259204
259204
|
var package_default = {
|
|
259205
259205
|
name: "infraweaver",
|
|
259206
|
-
version: "0.3.
|
|
259206
|
+
version: "0.3.12",
|
|
259207
259207
|
description: "GitHub Action that remediates Terraform to best practices and opens one scoped pull request per concern.",
|
|
259208
259208
|
keywords: [
|
|
259209
259209
|
"ai-coding-agent",
|
|
@@ -272925,7 +272925,7 @@ function TerraformChangeSummaryTool(ctx) {
|
|
|
272925
272925
|
// src/mcp/checkout.ts
|
|
272926
272926
|
import { createHash as createHash9 } from "node:crypto";
|
|
272927
272927
|
import { statSync as statSync5, unlinkSync as unlinkSync3, writeFileSync as writeFileSync10 } from "node:fs";
|
|
272928
|
-
import { join as
|
|
272928
|
+
import { join as join36 } from "node:path";
|
|
272929
272929
|
|
|
272930
272930
|
// node_modules/.pnpm/@infraweaver-io+ci@0.1.8/node_modules/@infraweaver-io/ci/dist/diffCoverage.js
|
|
272931
272931
|
import { isAbsolute as isAbsolute3, normalize as normalize3, resolve as resolve5 } from "node:path";
|
|
@@ -278577,7 +278577,7 @@ function PushTagsTool(ctx) {
|
|
|
278577
278577
|
}
|
|
278578
278578
|
|
|
278579
278579
|
// src/mcp/review.ts
|
|
278580
|
-
import { readFileSync as
|
|
278580
|
+
import { readFileSync as readFileSync20 } from "node:fs";
|
|
278581
278581
|
|
|
278582
278582
|
// src/mcp/findingAudit.ts
|
|
278583
278583
|
var COHERENCE_RULES = {
|
|
@@ -281789,7 +281789,7 @@ function apply(worktree, path15, cs) {
|
|
|
281789
281789
|
|
|
281790
281790
|
// src/mcp/terraform/gateScan.ts
|
|
281791
281791
|
import { existsSync as existsSync7, mkdtempSync as mkdtempSync3, rmSync as rmSync6 } from "node:fs";
|
|
281792
|
-
import { join as
|
|
281792
|
+
import { join as join33, posix as posix10 } from "node:path";
|
|
281793
281793
|
|
|
281794
281794
|
// src/mcp/terraform/coverage.ts
|
|
281795
281795
|
function bandOf(group2, concerns, signals) {
|
|
@@ -282227,6 +282227,66 @@ function dedupeCrossScanner(concerns) {
|
|
|
282227
282227
|
return [...merged, ...passthrough];
|
|
282228
282228
|
}
|
|
282229
282229
|
|
|
282230
|
+
// src/mcp/terraform/verifySites.ts
|
|
282231
|
+
import { readFileSync as readFileSync17 } from "node:fs";
|
|
282232
|
+
import { join as join29 } from "node:path";
|
|
282233
|
+
function fileReader(cwd) {
|
|
282234
|
+
const cache3 = /* @__PURE__ */ new Map();
|
|
282235
|
+
return (file2) => {
|
|
282236
|
+
if (!cache3.has(file2)) {
|
|
282237
|
+
let text;
|
|
282238
|
+
try {
|
|
282239
|
+
text = readFileSync17(join29(cwd, file2), "utf8");
|
|
282240
|
+
} catch {
|
|
282241
|
+
text = null;
|
|
282242
|
+
}
|
|
282243
|
+
cache3.set(file2, text);
|
|
282244
|
+
}
|
|
282245
|
+
return cache3.get(file2) ?? null;
|
|
282246
|
+
};
|
|
282247
|
+
}
|
|
282248
|
+
function siteOf(c, read3) {
|
|
282249
|
+
const text = read3(c.location.file);
|
|
282250
|
+
return text === null ? null : resourceAddressAt(text, c.location.line);
|
|
282251
|
+
}
|
|
282252
|
+
function recordConcernSites(session, concerns, cwd) {
|
|
282253
|
+
const read3 = fileReader(cwd);
|
|
282254
|
+
session.siteById ??= /* @__PURE__ */ new Map();
|
|
282255
|
+
session.firstSitesByKey ??= /* @__PURE__ */ new Map();
|
|
282256
|
+
const first = session.firstSitesByKey;
|
|
282257
|
+
const fresh = /* @__PURE__ */ new Map();
|
|
282258
|
+
for (const c of concerns) {
|
|
282259
|
+
const site = siteOf(c, read3);
|
|
282260
|
+
session.siteById.set(c.id, site);
|
|
282261
|
+
const key = concernKeyOf(c);
|
|
282262
|
+
if (first.has(key)) continue;
|
|
282263
|
+
const sites = fresh.get(key) ?? /* @__PURE__ */ new Set();
|
|
282264
|
+
sites.add(site);
|
|
282265
|
+
fresh.set(key, sites);
|
|
282266
|
+
}
|
|
282267
|
+
for (const [key, sites] of fresh) first.set(key, sites);
|
|
282268
|
+
}
|
|
282269
|
+
function resolvedAtSite(params) {
|
|
282270
|
+
const firingByKey = /* @__PURE__ */ new Map();
|
|
282271
|
+
for (const c of params.current) {
|
|
282272
|
+
const list = firingByKey.get(c.key) ?? [];
|
|
282273
|
+
list.push(c.site);
|
|
282274
|
+
firingByKey.set(c.key, list);
|
|
282275
|
+
}
|
|
282276
|
+
const out = [];
|
|
282277
|
+
for (const r of params.requested) {
|
|
282278
|
+
if (r.site === null || r.file === void 0) continue;
|
|
282279
|
+
const firing = firingByKey.get(r.key) ?? [];
|
|
282280
|
+
const known = params.firstSites.get(r.key);
|
|
282281
|
+
if (known === void 0) continue;
|
|
282282
|
+
if (firing.some((s) => s === null || !known.has(s))) continue;
|
|
282283
|
+
if (firing.includes(r.site)) continue;
|
|
282284
|
+
if (!params.declared(r.file).has(r.site)) continue;
|
|
282285
|
+
out.push(r.id);
|
|
282286
|
+
}
|
|
282287
|
+
return out;
|
|
282288
|
+
}
|
|
282289
|
+
|
|
282230
282290
|
// src/mcp/terraform/concernResult.ts
|
|
282231
282291
|
function annotateConcerns(rawConcerns, opts) {
|
|
282232
282292
|
const inScope = opts.inScope ?? (() => true);
|
|
@@ -282253,6 +282313,7 @@ function buildConcernResult(ctx, rawConcerns, opts) {
|
|
|
282253
282313
|
fullBaseline.map((c) => concernKeyOf(c))
|
|
282254
282314
|
);
|
|
282255
282315
|
recordConcernKeys(session, fullBaseline);
|
|
282316
|
+
recordConcernSites(session, fullBaseline, opts.cwd);
|
|
282256
282317
|
session.baselineFmtDriftFiles = union3(
|
|
282257
282318
|
session.baselineFmtDriftFiles,
|
|
282258
282319
|
fullBaseline.filter((c) => c.source === "terraform-fmt").map((c) => c.location.file)
|
|
@@ -282289,7 +282350,7 @@ function buildConcernResult(ctx, rawConcerns, opts) {
|
|
|
282289
282350
|
|
|
282290
282351
|
// src/mcp/terraform/initArtefacts.ts
|
|
282291
282352
|
import { rmSync as rmSync4 } from "node:fs";
|
|
282292
|
-
import { join as
|
|
282353
|
+
import { join as join30, posix as posix9 } from "node:path";
|
|
282293
282354
|
var INIT_ARTEFACTS = /* @__PURE__ */ new Set([".terraform", ".terraform.lock.hcl"]);
|
|
282294
282355
|
function initArtefacts(cwd) {
|
|
282295
282356
|
const r = run("git", ["status", "--porcelain=v1", "-z", "--untracked-files=normal"], cwd);
|
|
@@ -282312,7 +282373,7 @@ function removeNewInitArtefacts(cwd, before, by) {
|
|
|
282312
282373
|
const created = [...after?.untracked ?? []].filter((p) => !before.untracked.has(p));
|
|
282313
282374
|
const changed = [...after?.modifiedLocks ?? []].filter((p) => !before.modifiedLocks.has(p));
|
|
282314
282375
|
if (!top || created.length + changed.length === 0) return;
|
|
282315
|
-
for (const p of created) rmSync4(
|
|
282376
|
+
for (const p of created) rmSync4(join30(top, p), { recursive: true, force: true });
|
|
282316
282377
|
if (changed.length > 0) run("git", ["checkout", "--", ...changed], top);
|
|
282317
282378
|
resetTerraformInitCache();
|
|
282318
282379
|
log2.info(
|
|
@@ -282321,8 +282382,8 @@ function removeNewInitArtefacts(cwd, before, by) {
|
|
|
282321
282382
|
}
|
|
282322
282383
|
|
|
282323
282384
|
// src/mcp/terraform/secretScan.ts
|
|
282324
|
-
import { readFileSync as
|
|
282325
|
-
import { join as
|
|
282385
|
+
import { readFileSync as readFileSync18, rmSync as rmSync5 } from "node:fs";
|
|
282386
|
+
import { join as join31 } from "node:path";
|
|
282326
282387
|
function parseBetterleaksReport(json5, prefix2 = "") {
|
|
282327
282388
|
const doc = JSON.parse(json5);
|
|
282328
282389
|
if (Array.isArray(doc) || !doc || typeof doc !== "object" || !("findings" in doc)) {
|
|
@@ -282356,7 +282417,7 @@ async function scanAddedSecrets(cwd, mergeBase, tmp) {
|
|
|
282356
282417
|
const top = run("git", ["rev-parse", "--show-toplevel"], cwd).stdout.trim();
|
|
282357
282418
|
const prefix2 = run("git", ["rev-parse", "--show-prefix"], cwd).stdout.trim();
|
|
282358
282419
|
if (!top) return { ran: false, reason: "not a git checkout", concerns: [] };
|
|
282359
|
-
const report2 =
|
|
282420
|
+
const report2 = join31(tmp, `betterleaks-${process.pid}.json`);
|
|
282360
282421
|
try {
|
|
282361
282422
|
const r = await runAsync(
|
|
282362
282423
|
"betterleaks",
|
|
@@ -282379,7 +282440,7 @@ async function scanAddedSecrets(cwd, mergeBase, tmp) {
|
|
|
282379
282440
|
const why = (r.stderr || r.stdout).trim().split("\n").pop() ?? "";
|
|
282380
282441
|
let parsed2;
|
|
282381
282442
|
try {
|
|
282382
|
-
parsed2 = parseBetterleaksReport(
|
|
282443
|
+
parsed2 = parseBetterleaksReport(readFileSync18(report2, "utf-8"), prefix2);
|
|
282383
282444
|
} catch (error63) {
|
|
282384
282445
|
const reason = r.status !== 0 ? `betterleaks exited ${r.status}: ${why}` : `${error63}`;
|
|
282385
282446
|
return { ran: false, reason, concerns: [] };
|
|
@@ -282394,8 +282455,8 @@ async function scanAddedSecrets(cwd, mergeBase, tmp) {
|
|
|
282394
282455
|
}
|
|
282395
282456
|
|
|
282396
282457
|
// src/mcp/terraform/tools/scan.ts
|
|
282397
|
-
import { readFileSync as
|
|
282398
|
-
import { join as
|
|
282458
|
+
import { readFileSync as readFileSync19 } from "node:fs";
|
|
282459
|
+
import { join as join32 } from "node:path";
|
|
282399
282460
|
|
|
282400
282461
|
// src/mcp/terraform/noiseProfile.ts
|
|
282401
282462
|
var MIN_DISMISSAL_REPOS = 3;
|
|
@@ -282581,7 +282642,7 @@ async function runScan(ctx, {
|
|
|
282581
282642
|
outcomes.flatMap((o) => o.concerns),
|
|
282582
282643
|
(rel) => {
|
|
282583
282644
|
try {
|
|
282584
|
-
return
|
|
282645
|
+
return readFileSync19(join32(cwd, rel), "utf-8");
|
|
282585
282646
|
} catch {
|
|
282586
282647
|
return null;
|
|
282587
282648
|
}
|
|
@@ -282733,8 +282794,8 @@ function checkOutBase(cwd, pr, tmp) {
|
|
|
282733
282794
|
}
|
|
282734
282795
|
const mergeBase = run("git", ["merge-base", pr.baseSha, "HEAD"], cwd).stdout.trim() || pr.baseSha;
|
|
282735
282796
|
const prefix2 = run("git", ["rev-parse", "--show-prefix"], cwd).stdout.trim();
|
|
282736
|
-
const parent = mkdtempSync3(
|
|
282737
|
-
const worktree =
|
|
282797
|
+
const parent = mkdtempSync3(join33(tmp, "scan-delta-base-"));
|
|
282798
|
+
const worktree = join33(parent, "wt");
|
|
282738
282799
|
if (run("git", ["worktree", "add", "--detach", worktree, mergeBase], cwd).status !== 0) {
|
|
282739
282800
|
rmSync6(parent, { recursive: true, force: true });
|
|
282740
282801
|
log2.warning("\xBB scan delta: could not check out the base \u2014 every finding is treated as new.");
|
|
@@ -282742,7 +282803,7 @@ function checkOutBase(cwd, pr, tmp) {
|
|
|
282742
282803
|
}
|
|
282743
282804
|
return {
|
|
282744
282805
|
mergeBase,
|
|
282745
|
-
cwd: prefix2 ?
|
|
282806
|
+
cwd: prefix2 ? join33(worktree, prefix2) : worktree,
|
|
282746
282807
|
close: () => {
|
|
282747
282808
|
run("git", ["worktree", "remove", "--force", worktree], cwd);
|
|
282748
282809
|
rmSync6(parent, { recursive: true, force: true });
|
|
@@ -283677,7 +283738,7 @@ ${coverageState.lastBreakdown}`
|
|
|
283677
283738
|
}
|
|
283678
283739
|
function readReviewedFile(path15) {
|
|
283679
283740
|
try {
|
|
283680
|
-
return
|
|
283741
|
+
return readFileSync20(resolveWithinCwd(resolveRepoRoot(), path15), "utf-8");
|
|
283681
283742
|
} catch {
|
|
283682
283743
|
return null;
|
|
283683
283744
|
}
|
|
@@ -283992,7 +284053,7 @@ function fastForwardDiff(params, exec2) {
|
|
|
283992
284053
|
|
|
283993
284054
|
// src/utils/prompt/changeImpact.ts
|
|
283994
284055
|
import { writeFileSync as writeFileSync9 } from "node:fs";
|
|
283995
|
-
import { join as
|
|
284056
|
+
import { join as join34 } from "node:path";
|
|
283996
284057
|
var MAX_ATOMS = 20;
|
|
283997
284058
|
var MAX_REFS_PER_ATOM = 6;
|
|
283998
284059
|
var MAX_EXCERPT = 160;
|
|
@@ -284172,7 +284233,7 @@ function createChangeImpactArtifact(params) {
|
|
|
284172
284233
|
fileCount: params.files.length,
|
|
284173
284234
|
lookupError
|
|
284174
284235
|
});
|
|
284175
|
-
const path15 =
|
|
284236
|
+
const path15 = join34(
|
|
284176
284237
|
params.tmpdir,
|
|
284177
284238
|
`pr-${params.pullNumber}-${params.headSha.slice(0, 7)}-impact.md`
|
|
284178
284239
|
);
|
|
@@ -284192,7 +284253,7 @@ function createChangeImpactArtifact(params) {
|
|
|
284192
284253
|
import { execFileSync, execSync as execSync2 } from "node:child_process";
|
|
284193
284254
|
import { mkdtempSync as mkdtempSync4, readdirSync as readdirSync5, realpathSync as realpathSync4, unlinkSync as unlinkSync2 } from "node:fs";
|
|
284194
284255
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
284195
|
-
import { join as
|
|
284256
|
+
import { join as join35 } from "node:path";
|
|
284196
284257
|
|
|
284197
284258
|
// src/utils/github/ghaCore.ts
|
|
284198
284259
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
@@ -284215,7 +284276,7 @@ var TEMP_DIR_STATE_KEY = "infraweaver_temp_dir";
|
|
|
284215
284276
|
|
|
284216
284277
|
// src/utils/setup/setup.ts
|
|
284217
284278
|
function createTempDirectory() {
|
|
284218
|
-
const sharedTempDir = mkdtempSync4(
|
|
284279
|
+
const sharedTempDir = mkdtempSync4(join35(tmpdir2(), `${PRODUCT_SLUG}-`));
|
|
284219
284280
|
process.env.INFRAWEAVER_TEMP_DIR = sharedTempDir;
|
|
284220
284281
|
saveState2(TEMP_DIR_STATE_KEY, sharedTempDir);
|
|
284221
284282
|
log2.info(`\xBB created temp dir at ${sharedTempDir}`);
|
|
@@ -284261,13 +284322,13 @@ function wipeRunnerLeakSurface() {
|
|
|
284261
284322
|
return [];
|
|
284262
284323
|
}
|
|
284263
284324
|
};
|
|
284264
|
-
const fileCommandsDir =
|
|
284325
|
+
const fileCommandsDir = join35(runnerTemp, "_runner_file_commands");
|
|
284265
284326
|
for (const entry4 of listDir(fileCommandsDir)) {
|
|
284266
|
-
tryUnlink(
|
|
284327
|
+
tryUnlink(join35(fileCommandsDir, entry4));
|
|
284267
284328
|
}
|
|
284268
284329
|
for (const entry4 of listDir(runnerTemp)) {
|
|
284269
284330
|
if (entry4.endsWith(".sh") || /^git-credentials-.*\.config$/.test(entry4)) {
|
|
284270
|
-
tryUnlink(
|
|
284331
|
+
tryUnlink(join35(runnerTemp, entry4));
|
|
284271
284332
|
}
|
|
284272
284333
|
}
|
|
284273
284334
|
if (wiped.length > 0) {
|
|
@@ -284766,7 +284827,7 @@ function CheckoutPrTool(ctx) {
|
|
|
284766
284827
|
headSha: ctx.toolState.checkoutSha
|
|
284767
284828
|
});
|
|
284768
284829
|
if (incremental) {
|
|
284769
|
-
incrementalDiffPath =
|
|
284830
|
+
incrementalDiffPath = join36(
|
|
284770
284831
|
tempDir,
|
|
284771
284832
|
`pr-${pull_number}-${beforeShort}-${headShort}-incremental.diff`
|
|
284772
284833
|
);
|
|
@@ -284780,7 +284841,7 @@ function CheckoutPrTool(ctx) {
|
|
|
284780
284841
|
const diffPreview = formatResult.content.split("\n").slice(0, 100).join("\n");
|
|
284781
284842
|
log2.debug(`formatted diff preview (first 100 lines):
|
|
284782
284843
|
${diffPreview}`);
|
|
284783
|
-
const diffPath =
|
|
284844
|
+
const diffPath = join36(tempDir, `pr-${pull_number}-${headShort}.diff`);
|
|
284784
284845
|
writeFileSync10(diffPath, formatResult.content);
|
|
284785
284846
|
log2.debug(`wrote diff to ${diffPath} (${formatResult.content.length} bytes)`);
|
|
284786
284847
|
ctx.toolState.diffCoverage = createDiffCoverageState({
|
|
@@ -284921,7 +284982,7 @@ ${dirty}`
|
|
|
284921
284982
|
|
|
284922
284983
|
// src/mcp/checkSuite.ts
|
|
284923
284984
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync11 } from "node:fs";
|
|
284924
|
-
import { join as
|
|
284985
|
+
import { join as join37 } from "node:path";
|
|
284925
284986
|
import { stripVTControlCharacters } from "node:util";
|
|
284926
284987
|
var GetCheckSuiteLogs = type({
|
|
284927
284988
|
check_suite_id: type.number.describe("the id from check_suite.id")
|
|
@@ -285016,7 +285077,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
285016
285077
|
};
|
|
285017
285078
|
}
|
|
285018
285079
|
const tempDir = getTempDir();
|
|
285019
|
-
const logsDir =
|
|
285080
|
+
const logsDir = join37(tempDir, "ci-logs");
|
|
285020
285081
|
mkdirSync3(logsDir, { recursive: true });
|
|
285021
285082
|
const jobLists = await mapWithConcurrency(
|
|
285022
285083
|
failedRuns,
|
|
@@ -285040,7 +285101,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
285040
285101
|
request: { signal: AbortSignal.timeout(1e4) }
|
|
285041
285102
|
});
|
|
285042
285103
|
const logsText = typeof data === "string" ? data : Buffer.from(data).toString("utf8");
|
|
285043
|
-
const logPath =
|
|
285104
|
+
const logPath = join37(logsDir, `job-${job.id}.log`);
|
|
285044
285105
|
writeFileSync11(logPath, logsText);
|
|
285045
285106
|
const analysis = analyzeLog(logsText, 80);
|
|
285046
285107
|
const failedSteps = job.steps?.filter((s) => s.conclusion === "failure").map((s) => `Step ${s.number}: ${s.name}`) ?? [];
|
|
@@ -285102,7 +285163,7 @@ function GetCheckSuiteLogsTool(ctx) {
|
|
|
285102
285163
|
|
|
285103
285164
|
// src/mcp/commitInfo.ts
|
|
285104
285165
|
import { writeFileSync as writeFileSync12 } from "node:fs";
|
|
285105
|
-
import { join as
|
|
285166
|
+
import { join as join38 } from "node:path";
|
|
285106
285167
|
var CommitInfo = type({
|
|
285107
285168
|
sha: type.string.describe("the commit SHA (full or abbreviated) to fetch")
|
|
285108
285169
|
});
|
|
@@ -285121,7 +285182,7 @@ function CommitInfoTool(ctx) {
|
|
|
285121
285182
|
const files = data.files ?? [];
|
|
285122
285183
|
const formatResult = formatFilesWithLineNumbers(files);
|
|
285123
285184
|
const tempDir = getTempDir("get_commit_info");
|
|
285124
|
-
const diffFile =
|
|
285185
|
+
const diffFile = join38(tempDir, `commit-${sha.slice(0, 7)}.diff`);
|
|
285125
285186
|
writeFileSync12(diffFile, formatResult.content);
|
|
285126
285187
|
log2.debug(`wrote commit diff to ${diffFile} (${formatResult.content.length} bytes)`);
|
|
285127
285188
|
return {
|
|
@@ -285283,7 +285344,7 @@ import { performance as performance3 } from "node:perf_hooks";
|
|
|
285283
285344
|
|
|
285284
285345
|
// src/prep/installNodeDependencies.ts
|
|
285285
285346
|
import { existsSync as existsSync8 } from "node:fs";
|
|
285286
|
-
import { join as
|
|
285347
|
+
import { join as join39 } from "node:path";
|
|
285287
285348
|
|
|
285288
285349
|
// node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
285289
285350
|
function splitRunArgs(args2, valueFlags = []) {
|
|
@@ -285669,7 +285730,7 @@ async function installFallback(name, installSpec) {
|
|
|
285669
285730
|
return result.stderr || `failed to install ${name}`;
|
|
285670
285731
|
}
|
|
285671
285732
|
if (name === "deno") {
|
|
285672
|
-
const denoPath =
|
|
285733
|
+
const denoPath = join39(process.env.HOME || "", ".deno", "bin");
|
|
285673
285734
|
process.env.PATH = `${denoPath}:${process.env.PATH}`;
|
|
285674
285735
|
}
|
|
285675
285736
|
log2.info(`\xBB installed ${name}`);
|
|
@@ -285678,7 +285739,7 @@ async function installFallback(name, installSpec) {
|
|
|
285678
285739
|
var installNodeDependencies = {
|
|
285679
285740
|
name: "installNodeDependencies",
|
|
285680
285741
|
shouldRun: () => {
|
|
285681
|
-
const packageJsonPath =
|
|
285742
|
+
const packageJsonPath = join39(process.cwd(), "package.json");
|
|
285682
285743
|
return existsSync8(packageJsonPath);
|
|
285683
285744
|
},
|
|
285684
285745
|
run: async (options) => {
|
|
@@ -285787,8 +285848,8 @@ ${errorMessage2}`]
|
|
|
285787
285848
|
};
|
|
285788
285849
|
|
|
285789
285850
|
// src/prep/installPythonDependencies.ts
|
|
285790
|
-
import { existsSync as existsSync9, readFileSync as
|
|
285791
|
-
import { join as
|
|
285851
|
+
import { existsSync as existsSync9, readFileSync as readFileSync21 } from "node:fs";
|
|
285852
|
+
import { join as join40 } from "node:path";
|
|
285792
285853
|
var PYTHON_CONFIGS = [
|
|
285793
285854
|
{
|
|
285794
285855
|
file: "requirements.txt",
|
|
@@ -285823,7 +285884,7 @@ var PYTHON_CONFIGS = [
|
|
|
285823
285884
|
];
|
|
285824
285885
|
function pyprojectDeclaresBuildSystem(cwd) {
|
|
285825
285886
|
try {
|
|
285826
|
-
const content =
|
|
285887
|
+
const content = readFileSync21(join40(cwd, "pyproject.toml"), "utf8");
|
|
285827
285888
|
return /^\s*\[build-system\]/m.test(content);
|
|
285828
285889
|
} catch {
|
|
285829
285890
|
return false;
|
|
@@ -285873,13 +285934,13 @@ var installPythonDependencies = {
|
|
|
285873
285934
|
}
|
|
285874
285935
|
const cwd = process.cwd();
|
|
285875
285936
|
return PYTHON_CONFIGS.some(
|
|
285876
|
-
(config3) => existsSync9(
|
|
285937
|
+
(config3) => existsSync9(join40(cwd, config3.file)) && configApplies(config3, cwd)
|
|
285877
285938
|
);
|
|
285878
285939
|
},
|
|
285879
285940
|
run: async (options) => {
|
|
285880
285941
|
const cwd = process.cwd();
|
|
285881
285942
|
const config3 = PYTHON_CONFIGS.find(
|
|
285882
|
-
(c) => existsSync9(
|
|
285943
|
+
(c) => existsSync9(join40(cwd, c.file)) && configApplies(c, cwd)
|
|
285883
285944
|
);
|
|
285884
285945
|
if (!config3) {
|
|
285885
285946
|
return {
|
|
@@ -286400,12 +286461,12 @@ function AddLabelsTool(ctx) {
|
|
|
286400
286461
|
}
|
|
286401
286462
|
|
|
286402
286463
|
// src/mcp/moduleExtraction.ts
|
|
286403
|
-
import { readFileSync as
|
|
286404
|
-
import { join as
|
|
286464
|
+
import { readFileSync as readFileSync24 } from "node:fs";
|
|
286465
|
+
import { join as join43, posix as posix11 } from "node:path";
|
|
286405
286466
|
|
|
286406
286467
|
// src/mcp/terraform/partialInterface.ts
|
|
286407
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
286408
|
-
import { join as
|
|
286468
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync22 } from "node:fs";
|
|
286469
|
+
import { join as join41 } from "node:path";
|
|
286409
286470
|
function unmappedArguments(resource, moduleResources) {
|
|
286410
286471
|
const matching = moduleResources.filter((m) => m.type === resource.type);
|
|
286411
286472
|
if (matching.length === 0) return [];
|
|
@@ -286415,10 +286476,10 @@ function unmappedArguments(resource, moduleResources) {
|
|
|
286415
286476
|
function readDirHcl(cwd, dir) {
|
|
286416
286477
|
let text = "";
|
|
286417
286478
|
try {
|
|
286418
|
-
for (const f of readdirSync6(
|
|
286479
|
+
for (const f of readdirSync6(join41(cwd, dir)).sort((a, b) => a.localeCompare(b, "en"))) {
|
|
286419
286480
|
if (!f.endsWith(".tf")) continue;
|
|
286420
286481
|
try {
|
|
286421
|
-
text += `${
|
|
286482
|
+
text += `${readFileSync22(join41(cwd, dir, f), "utf8")}
|
|
286422
286483
|
`;
|
|
286423
286484
|
} catch {
|
|
286424
286485
|
}
|
|
@@ -286448,7 +286509,7 @@ function findPartialInterfaces(cwd) {
|
|
|
286448
286509
|
if (isInHouseModule(file2, graph)) continue;
|
|
286449
286510
|
let text;
|
|
286450
286511
|
try {
|
|
286451
|
-
text =
|
|
286512
|
+
text = readFileSync22(join41(cwd, file2), "utf8");
|
|
286452
286513
|
} catch {
|
|
286453
286514
|
continue;
|
|
286454
286515
|
}
|
|
@@ -286465,8 +286526,8 @@ function findPartialInterfaces(cwd) {
|
|
|
286465
286526
|
}
|
|
286466
286527
|
|
|
286467
286528
|
// src/mcp/terraform/refactorScope.ts
|
|
286468
|
-
import { existsSync as existsSync10, readdirSync as readdirSync7, readFileSync as
|
|
286469
|
-
import { join as
|
|
286529
|
+
import { existsSync as existsSync10, readdirSync as readdirSync7, readFileSync as readFileSync23, statSync as statSync6 } from "node:fs";
|
|
286530
|
+
import { join as join42 } from "node:path";
|
|
286470
286531
|
function isExamplePath(path15) {
|
|
286471
286532
|
return /(?:^|\/)examples?\//.test(path15.replace(/\\/g, "/"));
|
|
286472
286533
|
}
|
|
@@ -286479,7 +286540,7 @@ function holdsTerraform(dir, depth) {
|
|
|
286479
286540
|
return false;
|
|
286480
286541
|
}
|
|
286481
286542
|
for (const name of entries) {
|
|
286482
|
-
const path15 =
|
|
286543
|
+
const path15 = join42(dir, name);
|
|
286483
286544
|
if (name.endsWith(".tf")) return true;
|
|
286484
286545
|
if (depth > 0 && !name.startsWith(".") && statSync6(path15, { throwIfNoEntry: false })?.isDirectory()) {
|
|
286485
286546
|
if (holdsTerraform(path15, depth - 1)) return true;
|
|
@@ -286498,14 +286559,14 @@ function libraryRepoReason(cwd) {
|
|
|
286498
286559
|
for (const f of rootFiles) {
|
|
286499
286560
|
let text;
|
|
286500
286561
|
try {
|
|
286501
|
-
text =
|
|
286562
|
+
text = readFileSync23(join42(cwd, f), "utf8");
|
|
286502
286563
|
} catch {
|
|
286503
286564
|
continue;
|
|
286504
286565
|
}
|
|
286505
286566
|
if (PROVIDER_OR_BACKEND.test(text)) return null;
|
|
286506
286567
|
}
|
|
286507
|
-
const examples = ["examples", "example"].find((d) => existsSync10(
|
|
286508
|
-
if (examples === void 0 || !holdsTerraform(
|
|
286568
|
+
const examples = ["examples", "example"].find((d) => existsSync10(join42(cwd, d)));
|
|
286569
|
+
if (examples === void 0 || !holdsTerraform(join42(cwd, examples), 2)) return null;
|
|
286509
286570
|
return `the repository root configures no provider and no backend, and ships \`${examples}/\`: it is a module other configurations call, so restructuring it is churn for every caller`;
|
|
286510
286571
|
}
|
|
286511
286572
|
function reportOnly(reason) {
|
|
@@ -286800,7 +286861,7 @@ function findExtractionCandidates(cwd, rawCatalogue, orgModuleHcl) {
|
|
|
286800
286861
|
if (isInHouseModule(file2, graph) !== null) continue;
|
|
286801
286862
|
let text;
|
|
286802
286863
|
try {
|
|
286803
|
-
text =
|
|
286864
|
+
text = readFileSync24(join43(cwd, file2), "utf8");
|
|
286804
286865
|
} catch {
|
|
286805
286866
|
continue;
|
|
286806
286867
|
}
|
|
@@ -286908,8 +286969,8 @@ function ModuleExtractionCandidatesTool(ctx) {
|
|
|
286908
286969
|
}
|
|
286909
286970
|
|
|
286910
286971
|
// src/mcp/moduleTests.ts
|
|
286911
|
-
import { existsSync as existsSync11, readdirSync as readdirSync8, readFileSync as
|
|
286912
|
-
import { join as
|
|
286972
|
+
import { existsSync as existsSync11, readdirSync as readdirSync8, readFileSync as readFileSync25, statSync as statSync7 } from "node:fs";
|
|
286973
|
+
import { join as join44 } from "node:path";
|
|
286913
286974
|
var MODULE_META_ARGS = /* @__PURE__ */ new Set([
|
|
286914
286975
|
"source",
|
|
286915
286976
|
"version",
|
|
@@ -287050,9 +287111,9 @@ function listSubdirs(absDir) {
|
|
|
287050
287111
|
}
|
|
287051
287112
|
function readAllTf(cwd, relDir) {
|
|
287052
287113
|
let text = "";
|
|
287053
|
-
for (const f of listFiles(
|
|
287114
|
+
for (const f of listFiles(join44(cwd, relDir), ".tf")) {
|
|
287054
287115
|
try {
|
|
287055
|
-
text += `${
|
|
287116
|
+
text += `${readFileSync25(join44(cwd, relDir, f), "utf8")}
|
|
287056
287117
|
`;
|
|
287057
287118
|
} catch {
|
|
287058
287119
|
}
|
|
@@ -287064,8 +287125,8 @@ function discoverModuleTestAssets(cwd, moduleDir) {
|
|
|
287064
287125
|
const assets = [];
|
|
287065
287126
|
const matchesModule = (source, fromDir) => resolveSourceDir(fromDir, source) === md;
|
|
287066
287127
|
for (const examplesRoot of [`${md}/examples`, "examples"]) {
|
|
287067
|
-
if (!isDir(
|
|
287068
|
-
for (const sub of listSubdirs(
|
|
287128
|
+
if (!isDir(join44(cwd, examplesRoot))) continue;
|
|
287129
|
+
for (const sub of listSubdirs(join44(cwd, examplesRoot))) {
|
|
287069
287130
|
const exDir = `${examplesRoot}/${sub}`;
|
|
287070
287131
|
const hcl2 = readAllTf(cwd, exDir);
|
|
287071
287132
|
if (!hcl2) continue;
|
|
@@ -287081,12 +287142,12 @@ function discoverModuleTestAssets(cwd, moduleDir) {
|
|
|
287081
287142
|
}
|
|
287082
287143
|
}
|
|
287083
287144
|
for (const testDir of [`${md}/tests`, md]) {
|
|
287084
|
-
if (!isDir(
|
|
287085
|
-
for (const f of listFiles(
|
|
287145
|
+
if (!isDir(join44(cwd, testDir))) continue;
|
|
287146
|
+
for (const f of listFiles(join44(cwd, testDir), ".tftest.hcl")) {
|
|
287086
287147
|
const rel = `${testDir}/${f}`;
|
|
287087
287148
|
let hcl2;
|
|
287088
287149
|
try {
|
|
287089
|
-
hcl2 =
|
|
287150
|
+
hcl2 = readFileSync25(join44(cwd, rel), "utf8");
|
|
287090
287151
|
} catch {
|
|
287091
287152
|
continue;
|
|
287092
287153
|
}
|
|
@@ -287094,12 +287155,12 @@ function discoverModuleTestAssets(cwd, moduleDir) {
|
|
|
287094
287155
|
}
|
|
287095
287156
|
}
|
|
287096
287157
|
for (const goDir of [`${md}/test`, `${md}/tests`]) {
|
|
287097
|
-
if (!isDir(
|
|
287098
|
-
for (const f of listFiles(
|
|
287158
|
+
if (!isDir(join44(cwd, goDir))) continue;
|
|
287159
|
+
for (const f of listFiles(join44(cwd, goDir), "_test.go")) {
|
|
287099
287160
|
const rel = `${goDir}/${f}`;
|
|
287100
287161
|
let go;
|
|
287101
287162
|
try {
|
|
287102
|
-
go =
|
|
287163
|
+
go = readFileSync25(join44(cwd, rel), "utf8");
|
|
287103
287164
|
} catch {
|
|
287104
287165
|
continue;
|
|
287105
287166
|
}
|
|
@@ -287223,8 +287284,8 @@ function SetOutputTool(ctx, outputSchema) {
|
|
|
287223
287284
|
|
|
287224
287285
|
// src/mcp/policy.ts
|
|
287225
287286
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
287226
|
-
import { existsSync as existsSync12, readFileSync as
|
|
287227
|
-
import { join as
|
|
287287
|
+
import { existsSync as existsSync12, readFileSync as readFileSync26 } from "node:fs";
|
|
287288
|
+
import { join as join45 } from "node:path";
|
|
287228
287289
|
function parseConftestOutput(stdout) {
|
|
287229
287290
|
let parsed2;
|
|
287230
287291
|
try {
|
|
@@ -287258,7 +287319,7 @@ var CONFTEST_CONFIG = "conftest.toml";
|
|
|
287258
287319
|
function conftestSelectsNamespaces(conftestCwd) {
|
|
287259
287320
|
let raw2;
|
|
287260
287321
|
try {
|
|
287261
|
-
raw2 =
|
|
287322
|
+
raw2 = readFileSync26(join45(conftestCwd, CONFTEST_CONFIG), "utf-8");
|
|
287262
287323
|
} catch {
|
|
287263
287324
|
return false;
|
|
287264
287325
|
}
|
|
@@ -287274,7 +287335,7 @@ function namespaceArgs(conftestCwd) {
|
|
|
287274
287335
|
}
|
|
287275
287336
|
function findPlanJson(cwd) {
|
|
287276
287337
|
for (const candidate of PLAN_JSON_NAMES) {
|
|
287277
|
-
const abs =
|
|
287338
|
+
const abs = join45(cwd, candidate);
|
|
287278
287339
|
if (existsSync12(abs)) return abs;
|
|
287279
287340
|
}
|
|
287280
287341
|
return null;
|
|
@@ -287319,7 +287380,7 @@ function resolvePolicyDir(cwd, explicit) {
|
|
|
287319
287380
|
return existsSync12(abs) ? abs : null;
|
|
287320
287381
|
}
|
|
287321
287382
|
for (const d of DEFAULT_POLICY_DIRS) {
|
|
287322
|
-
const abs =
|
|
287383
|
+
const abs = join45(cwd, d);
|
|
287323
287384
|
if (existsSync12(abs)) return abs;
|
|
287324
287385
|
}
|
|
287325
287386
|
return null;
|
|
@@ -287627,9 +287688,9 @@ function PullRequestInfoTool(ctx) {
|
|
|
287627
287688
|
|
|
287628
287689
|
// node_modules/.pnpm/@infraweaver-io+sandbox@0.1.8/node_modules/@infraweaver-io/sandbox/dist/writePolicy.js
|
|
287629
287690
|
import { renameSync, writeFileSync as writeFileSync13 } from "node:fs";
|
|
287630
|
-
import { join as
|
|
287691
|
+
import { join as join46 } from "node:path";
|
|
287631
287692
|
function writePolicyPath(tmpdir5, filename) {
|
|
287632
|
-
return
|
|
287693
|
+
return join46(tmpdir5, filename);
|
|
287633
287694
|
}
|
|
287634
287695
|
function publishWritePolicy(params) {
|
|
287635
287696
|
try {
|
|
@@ -287800,12 +287861,12 @@ function SelectModeTool(ctx) {
|
|
|
287800
287861
|
}
|
|
287801
287862
|
|
|
287802
287863
|
// src/mcp/terraform/tools/advise.ts
|
|
287803
|
-
import { existsSync as existsSync13, readFileSync as
|
|
287804
|
-
import { join as
|
|
287864
|
+
import { existsSync as existsSync13, readFileSync as readFileSync28 } from "node:fs";
|
|
287865
|
+
import { join as join48 } from "node:path";
|
|
287805
287866
|
|
|
287806
287867
|
// src/mcp/terraform/fixMemory.ts
|
|
287807
|
-
import { readFileSync as
|
|
287808
|
-
import { join as
|
|
287868
|
+
import { readFileSync as readFileSync27 } from "node:fs";
|
|
287869
|
+
import { join as join47 } from "node:path";
|
|
287809
287870
|
var FIX_MEMORY_FILENAME = FIX_MEMORY_FILE;
|
|
287810
287871
|
var MAX_DESCRIPTION = 400;
|
|
287811
287872
|
var MAX_BEFORE_EXAMPLE = 1200;
|
|
@@ -287892,7 +287953,7 @@ function loadFixMemory(cwd) {
|
|
|
287892
287953
|
const root = cwd ?? process.cwd();
|
|
287893
287954
|
for (const filename of [FIX_MEMORY_FILENAME, LEGACY_FIX_MEMORY_FILENAME]) {
|
|
287894
287955
|
try {
|
|
287895
|
-
return parseFixMemory(
|
|
287956
|
+
return parseFixMemory(readFileSync27(join47(root, filename), "utf-8")) ?? [];
|
|
287896
287957
|
} catch {
|
|
287897
287958
|
}
|
|
287898
287959
|
}
|
|
@@ -287958,10 +288019,10 @@ function inlineWaivers(content, file2) {
|
|
|
287958
288019
|
];
|
|
287959
288020
|
}
|
|
287960
288021
|
function readLearnings(tmpdir5) {
|
|
287961
|
-
const path15 =
|
|
288022
|
+
const path15 = join48(tmpdir5, LEARNINGS_FILE);
|
|
287962
288023
|
if (!existsSync13(path15)) return [];
|
|
287963
288024
|
try {
|
|
287964
|
-
return
|
|
288025
|
+
return readFileSync28(path15, "utf-8").split("\n");
|
|
287965
288026
|
} catch {
|
|
287966
288027
|
return [];
|
|
287967
288028
|
}
|
|
@@ -287980,7 +288041,7 @@ function runAdvise(ctx, input2) {
|
|
|
287980
288041
|
const learnings = readLearnings(ctx.tmpdir);
|
|
287981
288042
|
const openConcerns = session.lastScanConcerns;
|
|
287982
288043
|
const dossiers = files.map((file2) => {
|
|
287983
|
-
const content = readTextCapped(
|
|
288044
|
+
const content = readTextCapped(join48(cwd, file2));
|
|
287984
288045
|
const inline = content === null ? [] : inlineWaivers(content, file2);
|
|
287985
288046
|
const reviewedInline = reviewedCopy(
|
|
287986
288047
|
cwd,
|
|
@@ -289318,8 +289379,8 @@ function ConsolidationCandidatesTool(ctx) {
|
|
|
289318
289379
|
}
|
|
289319
289380
|
|
|
289320
289381
|
// src/mcp/terraform/tools/detectPlanDrift.ts
|
|
289321
|
-
import { readFileSync as
|
|
289322
|
-
import { join as
|
|
289382
|
+
import { readFileSync as readFileSync29 } from "node:fs";
|
|
289383
|
+
import { join as join49 } from "node:path";
|
|
289323
289384
|
|
|
289324
289385
|
// src/mcp/terraform/cspm.ts
|
|
289325
289386
|
var ExternalResource = type({
|
|
@@ -289737,7 +289798,7 @@ function readTfFiles(cwd) {
|
|
|
289737
289798
|
const out = [];
|
|
289738
289799
|
for (const file2 of walkTfFiles(cwd)) {
|
|
289739
289800
|
try {
|
|
289740
|
-
out.push({ file: file2, hcl:
|
|
289801
|
+
out.push({ file: file2, hcl: readFileSync29(join49(cwd, file2), "utf8") });
|
|
289741
289802
|
} catch {
|
|
289742
289803
|
}
|
|
289743
289804
|
}
|
|
@@ -289754,7 +289815,7 @@ function DetectPlanDriftTool(ctx) {
|
|
|
289754
289815
|
const planPath = path15 || !envPlanPath ? resolveWithinCwd(cwd, path15 ?? "plan.json") : envPlanPath;
|
|
289755
289816
|
let raw2;
|
|
289756
289817
|
try {
|
|
289757
|
-
raw2 =
|
|
289818
|
+
raw2 = readFileSync29(planPath, "utf8");
|
|
289758
289819
|
} catch {
|
|
289759
289820
|
return skipResult(
|
|
289760
289821
|
"plan_artifact_not_found",
|
|
@@ -289886,13 +289947,13 @@ function DetectPlanDriftTool(ctx) {
|
|
|
289886
289947
|
}
|
|
289887
289948
|
|
|
289888
289949
|
// src/mcp/terraform/tools/emitCost.ts
|
|
289889
|
-
import { readFileSync as
|
|
289890
|
-
import { join as
|
|
289950
|
+
import { readFileSync as readFileSync30, writeFileSync as writeFileSync14 } from "node:fs";
|
|
289951
|
+
import { join as join50 } from "node:path";
|
|
289891
289952
|
|
|
289892
289953
|
// src/mcp/terraform/awsPrices.ts
|
|
289893
289954
|
var AWS_PRICE_REGION = "eu-west-2";
|
|
289894
289955
|
var AWS_PRICE_CURRENCY = "USD";
|
|
289895
|
-
var AWS_PRICE_FETCHED_AT = "2026-
|
|
289956
|
+
var AWS_PRICE_FETCHED_AT = "2026-10-03";
|
|
289896
289957
|
var AWS_HOURLY_PRICES = {
|
|
289897
289958
|
"eks-cluster-standard": 0.1,
|
|
289898
289959
|
"elb-application": 0.02646,
|
|
@@ -289910,30 +289971,30 @@ var AWS_PER_GB_PRICES = {
|
|
|
289910
289971
|
// src/mcp/terraform/azurePrices.ts
|
|
289911
289972
|
var AZURE_PRICE_REGION = "westeurope";
|
|
289912
289973
|
var AZURE_PRICE_CURRENCY = "EUR";
|
|
289913
|
-
var AZURE_PRICE_FETCHED_AT = "2026-
|
|
289974
|
+
var AZURE_PRICE_FETCHED_AT = "2026-10-03";
|
|
289914
289975
|
var AZURE_HOURLY_PRICES = {
|
|
289915
|
-
"app-service-p0v3": 0.
|
|
289916
|
-
"app-service-p1v3": 0.
|
|
289917
|
-
"app-service-p2v3": 0.
|
|
289918
|
-
"app-service-p3v3": 0.
|
|
289919
|
-
"bastion-basic": 0.
|
|
289920
|
-
"bastion-premium": 0.
|
|
289921
|
-
"bastion-standard": 0.
|
|
289922
|
-
"firewall-basic": 0.
|
|
289923
|
-
"firewall-premium": 1.
|
|
289924
|
-
"firewall-standard": 1.
|
|
289925
|
-
"redis-c0": 0.
|
|
289926
|
-
"redis-c1": 0.
|
|
289927
|
-
"redis-c2": 0.
|
|
289928
|
-
"redis-c3": 0.
|
|
289929
|
-
"redis-p1": 0.
|
|
289930
|
-
"redis-p2": 0.
|
|
289931
|
-
"redis-p3": 0.
|
|
289932
|
-
"vpn-gateway-vpngw1": 0.
|
|
289933
|
-
"vpn-gateway-vpngw2": 0.
|
|
289934
|
-
"vpn-gateway-vpngw3": 1.
|
|
289935
|
-
"vpn-gateway-vpngw4": 1.
|
|
289936
|
-
"vpn-gateway-vpngw5": 3.
|
|
289976
|
+
"app-service-p0v3": 0.0783,
|
|
289977
|
+
"app-service-p1v3": 0.1566,
|
|
289978
|
+
"app-service-p2v3": 0.3133,
|
|
289979
|
+
"app-service-p3v3": 0.6265,
|
|
289980
|
+
"bastion-basic": 0.1672,
|
|
289981
|
+
"bastion-premium": 0.396,
|
|
289982
|
+
"bastion-standard": 0.2552,
|
|
289983
|
+
"firewall-basic": 0.3476,
|
|
289984
|
+
"firewall-premium": 1.54,
|
|
289985
|
+
"firewall-standard": 1.1,
|
|
289986
|
+
"redis-c0": 0.0242,
|
|
289987
|
+
"redis-c1": 0.0607,
|
|
289988
|
+
"redis-c2": 0.0986,
|
|
289989
|
+
"redis-c3": 0.198,
|
|
289990
|
+
"redis-p1": 0.2438,
|
|
289991
|
+
"redis-p2": 0.4884,
|
|
289992
|
+
"redis-p3": 0.9759,
|
|
289993
|
+
"vpn-gateway-vpngw1": 0.1672,
|
|
289994
|
+
"vpn-gateway-vpngw2": 0.4312,
|
|
289995
|
+
"vpn-gateway-vpngw3": 1.1,
|
|
289996
|
+
"vpn-gateway-vpngw4": 1.8479,
|
|
289997
|
+
"vpn-gateway-vpngw5": 3.2119
|
|
289937
289998
|
};
|
|
289938
289999
|
|
|
289939
290000
|
// src/mcp/terraform/idleFloor.ts
|
|
@@ -290211,7 +290272,7 @@ function readTfFiles2(cwd) {
|
|
|
290211
290272
|
const out = [];
|
|
290212
290273
|
for (const file2 of walkTfFiles(cwd)) {
|
|
290213
290274
|
try {
|
|
290214
|
-
out.push({ file: file2, hcl:
|
|
290275
|
+
out.push({ file: file2, hcl: readFileSync30(join50(cwd, file2), "utf8") });
|
|
290215
290276
|
} catch {
|
|
290216
290277
|
}
|
|
290217
290278
|
}
|
|
@@ -291475,7 +291536,7 @@ function TerraformEmitVexTool(ctx) {
|
|
|
291475
291536
|
// src/mcp/terraform/tools/equivalenceCheck.ts
|
|
291476
291537
|
import { mkdtempSync as mkdtempSync5, rmSync as rmSync7 } from "node:fs";
|
|
291477
291538
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
291478
|
-
import { join as
|
|
291539
|
+
import { join as join51 } from "node:path";
|
|
291479
291540
|
|
|
291480
291541
|
// src/mcp/terraform/refactor/attribution.ts
|
|
291481
291542
|
import { posix as posix13 } from "node:path";
|
|
@@ -293267,12 +293328,12 @@ async function baselineValidateErrors(cwd, base, env2, session) {
|
|
|
293267
293328
|
}
|
|
293268
293329
|
const prefix2 = run("git", ["rev-parse", "--show-prefix"], cwd);
|
|
293269
293330
|
if (prefix2.status !== 0) return null;
|
|
293270
|
-
const tree = mkdtempSync5(
|
|
293331
|
+
const tree = mkdtempSync5(join51(tmpdir3(), "iw-baseline-"));
|
|
293271
293332
|
try {
|
|
293272
293333
|
if (run("git", ["worktree", "add", "--detach", "--quiet", tree, base], cwd).status !== 0) {
|
|
293273
293334
|
return null;
|
|
293274
293335
|
}
|
|
293275
|
-
const outcome2 = await scanValidate(
|
|
293336
|
+
const outcome2 = await scanValidate(join51(tree, prefix2.stdout.trim()), env2);
|
|
293276
293337
|
if (!outcome2.ran || outcome2.unvalidated) return null;
|
|
293277
293338
|
const errors = outcome2.concerns.map(validateErrorKey);
|
|
293278
293339
|
session.baselineValidateErrors = { base, errors };
|
|
@@ -293373,7 +293434,7 @@ function TerraformGenerateMovedTool(ctx) {
|
|
|
293373
293434
|
|
|
293374
293435
|
// src/mcp/terraform/cost.ts
|
|
293375
293436
|
import { mkdtempSync as mkdtempSync6, rmSync as rmSync8 } from "node:fs";
|
|
293376
|
-
import { join as
|
|
293437
|
+
import { join as join52 } from "node:path";
|
|
293377
293438
|
function parseInfracostBreakdown(stdout) {
|
|
293378
293439
|
const parsed2 = parseScannerJson(InfracostBreakdownOutput, stdout, "infracost");
|
|
293379
293440
|
const raw2 = parsed2.totalMonthlyCost;
|
|
@@ -293455,15 +293516,15 @@ async function infracostBaseline(cwd, key, tmpdir5) {
|
|
|
293455
293516
|
if (!baseRef) return null;
|
|
293456
293517
|
const prefixResult = run("git", ["rev-parse", "--show-prefix"], cwd);
|
|
293457
293518
|
const prefix2 = prefixResult.status === 0 ? prefixResult.stdout.trim() : "";
|
|
293458
|
-
const baseDir = mkdtempSync6(
|
|
293459
|
-
const worktree =
|
|
293519
|
+
const baseDir = mkdtempSync6(join52(tmpdir5, "infracost-base-"));
|
|
293520
|
+
const worktree = join52(baseDir, "wt");
|
|
293460
293521
|
const add = run("git", ["worktree", "add", "--detach", worktree, baseRef], cwd);
|
|
293461
293522
|
if (add.status !== 0) {
|
|
293462
293523
|
rmSync8(baseDir, { recursive: true, force: true });
|
|
293463
293524
|
return null;
|
|
293464
293525
|
}
|
|
293465
293526
|
try {
|
|
293466
|
-
const scanCwd = prefix2 ?
|
|
293527
|
+
const scanCwd = prefix2 ? join52(worktree, prefix2) : worktree;
|
|
293467
293528
|
const r = await runInfracostBreakdown(scanCwd, key);
|
|
293468
293529
|
if (r.missing || r.status !== 0) return null;
|
|
293469
293530
|
return parseInfracostBreakdown(r.stdout);
|
|
@@ -293534,7 +293595,7 @@ function InfracostDiffTool(ctx) {
|
|
|
293534
293595
|
|
|
293535
293596
|
// src/mcp/terraform/tools/ingestExternalFindings.ts
|
|
293536
293597
|
import { statSync as statSync8 } from "node:fs";
|
|
293537
|
-
import { join as
|
|
293598
|
+
import { join as join53 } from "node:path";
|
|
293538
293599
|
|
|
293539
293600
|
// src/mcp/terraform/prowlerOcsf.ts
|
|
293540
293601
|
var DETECTION_FINDING_CREATE = 200401;
|
|
@@ -293760,7 +293821,7 @@ var MAX_FEED_BYTES = 100 * 1024 * 1024;
|
|
|
293760
293821
|
function readTfFiles3(cwd) {
|
|
293761
293822
|
const out = [];
|
|
293762
293823
|
for (const file2 of walkTfFiles(cwd)) {
|
|
293763
|
-
const hcl2 = readTextCapped(
|
|
293824
|
+
const hcl2 = readTextCapped(join53(cwd, file2));
|
|
293764
293825
|
if (hcl2 !== null) out.push({ file: file2, hcl: hcl2 });
|
|
293765
293826
|
}
|
|
293766
293827
|
return out;
|
|
@@ -293917,8 +293978,8 @@ function IngestExternalFindingsTool(ctx) {
|
|
|
293917
293978
|
}
|
|
293918
293979
|
|
|
293919
293980
|
// src/mcp/terraform/tools/moduleDocs.ts
|
|
293920
|
-
import { readFileSync as
|
|
293921
|
-
import { join as
|
|
293981
|
+
import { readFileSync as readFileSync31, writeFileSync as writeFileSync16 } from "node:fs";
|
|
293982
|
+
import { join as join54 } from "node:path";
|
|
293922
293983
|
|
|
293923
293984
|
// src/mcp/terraform/moduleDocs.ts
|
|
293924
293985
|
var VERDICT_CLAIM = {
|
|
@@ -294032,7 +294093,7 @@ function TerraformModuleDocsTool(ctx) {
|
|
|
294032
294093
|
);
|
|
294033
294094
|
}
|
|
294034
294095
|
const absDir = resolveWithinCwd(cwd, module_dir);
|
|
294035
|
-
const target =
|
|
294096
|
+
const target = join54(absDir, "README.md");
|
|
294036
294097
|
let gitHead = null;
|
|
294037
294098
|
try {
|
|
294038
294099
|
gitHead = $("git", ["rev-parse", "HEAD"], { cwd, log: false });
|
|
@@ -294040,7 +294101,7 @@ function TerraformModuleDocsTool(ctx) {
|
|
|
294040
294101
|
}
|
|
294041
294102
|
let existing = null;
|
|
294042
294103
|
try {
|
|
294043
|
-
existing =
|
|
294104
|
+
existing = readFileSync31(target, "utf8");
|
|
294044
294105
|
} catch {
|
|
294045
294106
|
}
|
|
294046
294107
|
const priorHead = readFooterGitHead(existing);
|
|
@@ -294364,7 +294425,7 @@ function NormalizationCandidatesTool(ctx) {
|
|
|
294364
294425
|
|
|
294365
294426
|
// src/mcp/terraform/tools/plan.ts
|
|
294366
294427
|
import { rmSync as rmSync9 } from "node:fs";
|
|
294367
|
-
import { join as
|
|
294428
|
+
import { join as join55 } from "node:path";
|
|
294368
294429
|
var PLAN_JSON_ARGS = ["plan", "-input=false", "-no-color", "-lock=false", "-json"];
|
|
294369
294430
|
var planFileSeq = 0;
|
|
294370
294431
|
async function capturePlanPairs(absDir, planFile, creds) {
|
|
@@ -294387,7 +294448,7 @@ async function planOneRoot(absDir, creds, tmpdir5) {
|
|
|
294387
294448
|
skipReason: `terraform init failed: ${init.stderr.trim().slice(0, 200) || "unknown error"}`
|
|
294388
294449
|
};
|
|
294389
294450
|
}
|
|
294390
|
-
const planFile = tmpdir5 ?
|
|
294451
|
+
const planFile = tmpdir5 ? join55(tmpdir5, `plan-${process.pid}-${planFileSeq++}.tfplan`) : void 0;
|
|
294391
294452
|
const plan = await runTfAsync(
|
|
294392
294453
|
planFile ? [...PLAN_JSON_ARGS, `-out=${planFile}`] : PLAN_JSON_ARGS,
|
|
294393
294454
|
absDir,
|
|
@@ -294757,8 +294818,8 @@ function TerraformProviderUpgradeTool(ctx) {
|
|
|
294757
294818
|
}
|
|
294758
294819
|
|
|
294759
294820
|
// src/mcp/terraform/tfquery.ts
|
|
294760
|
-
import { readFileSync as
|
|
294761
|
-
import { join as
|
|
294821
|
+
import { readFileSync as readFileSync32 } from "node:fs";
|
|
294822
|
+
import { join as join56 } from "node:path";
|
|
294762
294823
|
var TFQUERY_SUFFIX = ".tfquery.hcl";
|
|
294763
294824
|
function parseQueryFile(hcl2) {
|
|
294764
294825
|
return parseBlocks(hcl2, ["list"]).map((block) => {
|
|
@@ -294784,7 +294845,7 @@ function collectQueryInventory(cwd) {
|
|
|
294784
294845
|
for (const rel of walkFilesBySuffix(cwd, TFQUERY_SUFFIX)) {
|
|
294785
294846
|
let text;
|
|
294786
294847
|
try {
|
|
294787
|
-
text =
|
|
294848
|
+
text = readFileSync32(join56(cwd, rel), "utf8");
|
|
294788
294849
|
} catch {
|
|
294789
294850
|
continue;
|
|
294790
294851
|
}
|
|
@@ -294819,7 +294880,7 @@ function TerraformQueryInventoryTool(ctx) {
|
|
|
294819
294880
|
}
|
|
294820
294881
|
|
|
294821
294882
|
// src/mcp/terraform/tools/readFindings.ts
|
|
294822
|
-
import { readFileSync as
|
|
294883
|
+
import { readFileSync as readFileSync33 } from "node:fs";
|
|
294823
294884
|
var ReadFindingsParams = type({
|
|
294824
294885
|
"path?": type.string.describe(
|
|
294825
294886
|
"path to the Assessor's findings.json. Defaults to $INFRAWEAVER_FINDINGS_PATH, then ./findings.json in the workspace."
|
|
@@ -294844,7 +294905,7 @@ function ReadFindingsTool(ctx) {
|
|
|
294844
294905
|
const findingsPath = path15 || !envFindingsPath ? resolveWithinCwd(cwd, path15 ?? "findings.json") : envFindingsPath;
|
|
294845
294906
|
let raw2;
|
|
294846
294907
|
try {
|
|
294847
|
-
raw2 =
|
|
294908
|
+
raw2 = readFileSync33(findingsPath, "utf8");
|
|
294848
294909
|
} catch {
|
|
294849
294910
|
return skipResult(
|
|
294850
294911
|
"findings_not_found",
|
|
@@ -295522,7 +295583,25 @@ async function runVerifyRemediation(ctx, { concern_ids, download_external_module
|
|
|
295522
295583
|
if (key !== void 0) keyed.push({ id, key });
|
|
295523
295584
|
else unkeyed.push(id);
|
|
295524
295585
|
}
|
|
295525
|
-
const
|
|
295586
|
+
const byKey = partitionByKey(keyed, currentKeys);
|
|
295587
|
+
const read3 = fileReader(cwd);
|
|
295588
|
+
const remainingKeyed = keyed.filter((k) => byKey.remaining.includes(k.id));
|
|
295589
|
+
const atSite = new Set(
|
|
295590
|
+
resolvedAtSite({
|
|
295591
|
+
requested: remainingKeyed.map((k) => ({
|
|
295592
|
+
...k,
|
|
295593
|
+
site: session.siteById?.get(k.id) ?? null,
|
|
295594
|
+
file: reported.get(k.id)?.location.file
|
|
295595
|
+
})),
|
|
295596
|
+
current: currentConcerns.map((c) => ({ key: concernKeyOf(c), site: siteOf(c, read3) })),
|
|
295597
|
+
firstSites: session.firstSitesByKey ?? /* @__PURE__ */ new Map(),
|
|
295598
|
+
declared: (file2) => new Set(declaredAddresses2(read3(file2) ?? ""))
|
|
295599
|
+
})
|
|
295600
|
+
);
|
|
295601
|
+
const keyedVerdict = {
|
|
295602
|
+
resolved: [...byKey.resolved, ...byKey.remaining.filter((id) => atSite.has(id))],
|
|
295603
|
+
remaining: byKey.remaining.filter((id) => !atSite.has(id))
|
|
295604
|
+
};
|
|
295526
295605
|
const fallbackVerdict = computeRemediationVerdict(unkeyed, new Set(currentIds));
|
|
295527
295606
|
const resolved = [...keyedVerdict.resolved, ...fallbackVerdict.resolved];
|
|
295528
295607
|
const remaining = [...keyedVerdict.remaining, ...fallbackVerdict.remaining];
|
|
@@ -298780,11 +298859,11 @@ import {
|
|
|
298780
298859
|
mkdirSync as mkdirSync7,
|
|
298781
298860
|
mkdtempSync as mkdtempSync7,
|
|
298782
298861
|
readdirSync as readdirSync9,
|
|
298783
|
-
readFileSync as
|
|
298862
|
+
readFileSync as readFileSync35,
|
|
298784
298863
|
writeFileSync as writeFileSync17
|
|
298785
298864
|
} from "node:fs";
|
|
298786
298865
|
import { tmpdir as osTmpdir } from "node:os";
|
|
298787
|
-
import { dirname as dirname8, isAbsolute as isAbsolute6, join as
|
|
298866
|
+
import { dirname as dirname8, isAbsolute as isAbsolute6, join as join58, relative as relative6, resolve as resolve8 } from "node:path";
|
|
298788
298867
|
function coercePolicyRules(raw2) {
|
|
298789
298868
|
const rules = [];
|
|
298790
298869
|
const rejected = [];
|
|
@@ -299036,7 +299115,7 @@ function evaluateRulesStatically(cwd, rules, scope2 = { kind: "all", reason: ""
|
|
|
299036
299115
|
const files = [];
|
|
299037
299116
|
for (const rel of walk.files) {
|
|
299038
299117
|
try {
|
|
299039
|
-
files.push({ rel, text:
|
|
299118
|
+
files.push({ rel, text: readFileSync35(join58(cwd, rel), "utf-8") });
|
|
299040
299119
|
} catch {
|
|
299041
299120
|
}
|
|
299042
299121
|
}
|
|
@@ -299151,16 +299230,16 @@ function cloudEmittedRego(rules) {
|
|
|
299151
299230
|
}
|
|
299152
299231
|
function readOrEmpty(path15) {
|
|
299153
299232
|
try {
|
|
299154
|
-
return
|
|
299233
|
+
return readFileSync35(path15, "utf-8");
|
|
299155
299234
|
} catch {
|
|
299156
299235
|
return "";
|
|
299157
299236
|
}
|
|
299158
299237
|
}
|
|
299159
299238
|
function regoDirIn(root, skip) {
|
|
299160
299239
|
for (const dir of DEFAULT_POLICY_DIRS) {
|
|
299161
|
-
const abs =
|
|
299240
|
+
const abs = join58(root, dir);
|
|
299162
299241
|
if (existsSync14(abs) && walkFilesBySuffix(abs, ".rego").some(
|
|
299163
|
-
(rel) => !skip(
|
|
299242
|
+
(rel) => !skip(join58(dir, rel), readOrEmpty(join58(abs, rel)))
|
|
299164
299243
|
)) {
|
|
299165
299244
|
return dir;
|
|
299166
299245
|
}
|
|
@@ -299168,14 +299247,14 @@ function regoDirIn(root, skip) {
|
|
|
299168
299247
|
return null;
|
|
299169
299248
|
}
|
|
299170
299249
|
function withoutSkipped(root, dir, skip, tmpdir5) {
|
|
299171
|
-
const abs =
|
|
299172
|
-
const files = readdirSync9(abs, { recursive: true, withFileTypes: true }).filter((e) => e.isFile()).map((e) => relative6(abs,
|
|
299173
|
-
const kept = files.filter((rel) => !skip(
|
|
299250
|
+
const abs = join58(root, dir);
|
|
299251
|
+
const files = readdirSync9(abs, { recursive: true, withFileTypes: true }).filter((e) => e.isFile()).map((e) => relative6(abs, join58(e.parentPath, e.name)));
|
|
299252
|
+
const kept = files.filter((rel) => !skip(join58(dir, rel), readOrEmpty(join58(abs, rel))));
|
|
299174
299253
|
if (kept.length === files.length) return abs;
|
|
299175
|
-
const copy =
|
|
299254
|
+
const copy = join58(mkdtempSync7(join58(tmpdir5 ?? osTmpdir(), "policy-own-")), dir);
|
|
299176
299255
|
for (const rel of kept) {
|
|
299177
|
-
mkdirSync7(dirname8(
|
|
299178
|
-
writeFileSync17(
|
|
299256
|
+
mkdirSync7(dirname8(join58(copy, rel)), { recursive: true });
|
|
299257
|
+
writeFileSync17(join58(copy, rel), readFileSync35(join58(abs, rel)));
|
|
299179
299258
|
}
|
|
299180
299259
|
return copy;
|
|
299181
299260
|
}
|
|
@@ -299197,18 +299276,18 @@ function resolveRepoPolicy(cwd, baseRef, tmpdir5, notes, skip) {
|
|
|
299197
299276
|
}
|
|
299198
299277
|
const own2 = tree.files.filter((f) => !skip(f.path, f.raw));
|
|
299199
299278
|
if (!own2.some((f) => f.path.endsWith(".rego"))) continue;
|
|
299200
|
-
const root = mkdtempSync7(
|
|
299279
|
+
const root = mkdtempSync7(join58(tmpdir5 ?? osTmpdir(), "policy-base-"));
|
|
299201
299280
|
for (const f of own2) {
|
|
299202
|
-
mkdirSync7(dirname8(
|
|
299203
|
-
writeFileSync17(
|
|
299281
|
+
mkdirSync7(dirname8(join58(root, f.path)), { recursive: true });
|
|
299282
|
+
writeFileSync17(join58(root, f.path), f.raw);
|
|
299204
299283
|
}
|
|
299205
299284
|
const toml = readFileAtBaseRef(cwd, baseRef, CONFTEST_CONFIG);
|
|
299206
|
-
if (toml.kind === "file") writeFileSync17(
|
|
299207
|
-
const same = head === dir && readdirSync9(
|
|
299285
|
+
if (toml.kind === "file") writeFileSync17(join58(root, CONFTEST_CONFIG), toml.raw);
|
|
299286
|
+
const same = head === dir && readdirSync9(join58(cwd, dir), { recursive: true, withFileTypes: true }).filter(
|
|
299208
299287
|
(e) => e.isFile()
|
|
299209
299288
|
).length === tree.files.length && tree.files.every((f) => {
|
|
299210
299289
|
try {
|
|
299211
|
-
return
|
|
299290
|
+
return readFileSync35(join58(cwd, f.path), "utf-8") === f.raw;
|
|
299212
299291
|
} catch {
|
|
299213
299292
|
return false;
|
|
299214
299293
|
}
|
|
@@ -299218,7 +299297,7 @@ function resolveRepoPolicy(cwd, baseRef, tmpdir5, notes, skip) {
|
|
|
299218
299297
|
`the Rego policy differs from the base ref (${tree.ref}) \u2014 applying the BASE ${dir}/ so this change cannot relax the policy reviewing it. It takes effect once merged.`
|
|
299219
299298
|
);
|
|
299220
299299
|
}
|
|
299221
|
-
return { policyDir:
|
|
299300
|
+
return { policyDir: join58(root, dir), conftestCwd: root };
|
|
299222
299301
|
}
|
|
299223
299302
|
if (head) {
|
|
299224
299303
|
notes.push(
|
|
@@ -299228,7 +299307,7 @@ function resolveRepoPolicy(cwd, baseRef, tmpdir5, notes, skip) {
|
|
|
299228
299307
|
return null;
|
|
299229
299308
|
}
|
|
299230
299309
|
function findWorkflowPlanJson(cwd, notes) {
|
|
299231
|
-
const present = PLAN_JSON_NAMES.filter((name) => existsSync14(
|
|
299310
|
+
const present = PLAN_JSON_NAMES.filter((name) => existsSync14(join58(cwd, name)));
|
|
299232
299311
|
if (present.length === 0) return null;
|
|
299233
299312
|
const listing = run("git", ["ls-files", "-z"], cwd);
|
|
299234
299313
|
if (listing.status !== 0) {
|
|
@@ -299245,7 +299324,7 @@ function findWorkflowPlanJson(cwd, notes) {
|
|
|
299245
299324
|
);
|
|
299246
299325
|
continue;
|
|
299247
299326
|
}
|
|
299248
|
-
return
|
|
299327
|
+
return join58(cwd, name);
|
|
299249
299328
|
}
|
|
299250
299329
|
return null;
|
|
299251
299330
|
}
|
|
@@ -299275,7 +299354,7 @@ function evaluatePolicyGate(cwd, rawRules, opts = {}) {
|
|
|
299275
299354
|
let plan;
|
|
299276
299355
|
if (planPath) {
|
|
299277
299356
|
try {
|
|
299278
|
-
plan = asPlan(JSON.parse(
|
|
299357
|
+
plan = asPlan(JSON.parse(readFileSync35(planPath, "utf-8")));
|
|
299279
299358
|
} catch {
|
|
299280
299359
|
}
|
|
299281
299360
|
if (!plan) notes.push(`${planPath} is not a Terraform plan JSON \u2014 ignored`);
|
|
@@ -299378,7 +299457,7 @@ function capturePolicyGate(ctx) {
|
|
|
299378
299457
|
if (!result) return;
|
|
299379
299458
|
const workspace = process.env.GITHUB_WORKSPACE ?? cwd;
|
|
299380
299459
|
for (const o of [...result.violations, ...result.inconclusive]) {
|
|
299381
|
-
if (o.file) o.file = posix16(relative6(workspace,
|
|
299460
|
+
if (o.file) o.file = posix16(relative6(workspace, join58(cwd, o.file)));
|
|
299382
299461
|
}
|
|
299383
299462
|
session.policyGate = result;
|
|
299384
299463
|
for (const n of result.notes) log2.warning(`\xBB policy gate: ${n}`);
|
|
@@ -299713,7 +299792,7 @@ var ThinkingTimer = class {
|
|
|
299713
299792
|
// src/agents/claude.ts
|
|
299714
299793
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
299715
299794
|
import { chmodSync as chmodSync3, mkdirSync as mkdirSync10, writeFileSync as writeFileSync22 } from "node:fs";
|
|
299716
|
-
import { join as
|
|
299795
|
+
import { join as join67 } from "node:path";
|
|
299717
299796
|
import { performance as performance6 } from "node:perf_hooks";
|
|
299718
299797
|
import { setTimeout as sleep6 } from "node:timers/promises";
|
|
299719
299798
|
|
|
@@ -300073,7 +300152,7 @@ import { readFile as readFile2 } from "node:fs/promises";
|
|
|
300073
300152
|
|
|
300074
300153
|
// src/agents/shared.ts
|
|
300075
300154
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
300076
|
-
import { join as
|
|
300155
|
+
import { join as join59 } from "node:path";
|
|
300077
300156
|
var MAX_STDERR_LINES = 20;
|
|
300078
300157
|
var MAX_POST_RUN_RETRIES = 3;
|
|
300079
300158
|
function getGitStatus() {
|
|
@@ -300110,7 +300189,7 @@ var agent = (input2) => {
|
|
|
300110
300189
|
};
|
|
300111
300190
|
};
|
|
300112
300191
|
function agentHomeEnv(tmpdir5) {
|
|
300113
|
-
return { HOME: tmpdir5, XDG_CONFIG_HOME:
|
|
300192
|
+
return { HOME: tmpdir5, XDG_CONFIG_HOME: join59(tmpdir5, ".config") };
|
|
300114
300193
|
}
|
|
300115
300194
|
function baseAgentEnv(homeEnv, repoDir) {
|
|
300116
300195
|
return { ...process.env, ...homeEnv, PWD: repoDir };
|
|
@@ -300913,7 +300992,7 @@ function matchesRouteSentinel(envVar, model) {
|
|
|
300913
300992
|
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
300914
300993
|
import { mkdirSync as mkdirSync8, rmSync as rmSync10, writeFileSync as writeFileSync18 } from "node:fs";
|
|
300915
300994
|
import { homedir } from "node:os";
|
|
300916
|
-
import { join as
|
|
300995
|
+
import { join as join60 } from "node:path";
|
|
300917
300996
|
var VERTEX_SERVICE_ACCOUNT_JSON_ENV = "VERTEX_SERVICE_ACCOUNT_JSON";
|
|
300918
300997
|
var GOOGLE_APPLICATION_CREDENTIALS_ENV = "GOOGLE_APPLICATION_CREDENTIALS";
|
|
300919
300998
|
var GOOGLE_CLOUD_PROJECT_ENV = "GOOGLE_CLOUD_PROJECT";
|
|
@@ -300937,7 +301016,7 @@ function readProjectIdFromVertexServiceAccountJson() {
|
|
|
300937
301016
|
}
|
|
300938
301017
|
function createSecretDir() {
|
|
300939
301018
|
const base = process.env.INFRAWEAVER_SECRET_HOME || process.env.HOME || homedir();
|
|
300940
|
-
const secretDir =
|
|
301019
|
+
const secretDir = join60(base, `.${PRODUCT_SLUG}`, "secrets", randomUUID9());
|
|
300941
301020
|
mkdirSync8(secretDir, { recursive: true, mode: 448 });
|
|
300942
301021
|
return secretDir;
|
|
300943
301022
|
}
|
|
@@ -300946,7 +301025,7 @@ function materializeVertexCredentials(params) {
|
|
|
300946
301025
|
const blob = process.env[VERTEX_SERVICE_ACCOUNT_JSON_ENV];
|
|
300947
301026
|
if (!blob) return void 0;
|
|
300948
301027
|
const secretDir = createSecretDir();
|
|
300949
|
-
const credentialsPath =
|
|
301028
|
+
const credentialsPath = join60(secretDir, "vertex-sa.json");
|
|
300950
301029
|
writeFileSync18(credentialsPath, blob, { mode: 384 });
|
|
300951
301030
|
process.env[GOOGLE_APPLICATION_CREDENTIALS_ENV] = credentialsPath;
|
|
300952
301031
|
const projectId = readProjectIdFromVertexServiceAccountJson();
|
|
@@ -301082,15 +301161,15 @@ function createProcessOutputActivityTimeout(ctx) {
|
|
|
301082
301161
|
}
|
|
301083
301162
|
|
|
301084
301163
|
// src/utils/prompt/skills.ts
|
|
301085
|
-
import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as
|
|
301086
|
-
import { dirname as dirname9, join as
|
|
301164
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync36, writeFileSync as writeFileSync19 } from "node:fs";
|
|
301165
|
+
import { dirname as dirname9, join as join61 } from "node:path";
|
|
301087
301166
|
import { fileURLToPath } from "node:url";
|
|
301088
301167
|
var BUNDLED_SKILL_NAMES = ["terraform-best-practices"];
|
|
301089
301168
|
function resolveSkillPath(name) {
|
|
301090
301169
|
const here = dirname9(fileURLToPath(import.meta.url));
|
|
301091
301170
|
const candidates = [
|
|
301092
|
-
|
|
301093
|
-
|
|
301171
|
+
join61(here, "..", "..", "skills", name, "SKILL.md"),
|
|
301172
|
+
join61(here, "skills", name, "SKILL.md")
|
|
301094
301173
|
];
|
|
301095
301174
|
for (const candidate of candidates) {
|
|
301096
301175
|
if (existsSync15(candidate)) return candidate;
|
|
@@ -301100,11 +301179,11 @@ function resolveSkillPath(name) {
|
|
|
301100
301179
|
var SKILL_TARGET_DIRS = [".opencode/skills", ".claude/skills", ".agents/skills"];
|
|
301101
301180
|
function installBundledSkills(params) {
|
|
301102
301181
|
for (const name of BUNDLED_SKILL_NAMES) {
|
|
301103
|
-
const content =
|
|
301182
|
+
const content = readFileSync36(resolveSkillPath(name), "utf8");
|
|
301104
301183
|
for (const targetDir of SKILL_TARGET_DIRS) {
|
|
301105
|
-
const skillDir =
|
|
301184
|
+
const skillDir = join61(params.home, targetDir, name);
|
|
301106
301185
|
mkdirSync9(skillDir, { recursive: true });
|
|
301107
|
-
writeFileSync19(
|
|
301186
|
+
writeFileSync19(join61(skillDir, "SKILL.md"), content);
|
|
301108
301187
|
}
|
|
301109
301188
|
}
|
|
301110
301189
|
log2.success(`installed bundled skills: ${BUNDLED_SKILL_NAMES.join(", ")}`);
|
|
@@ -301113,8 +301192,8 @@ function installBundledSkills(params) {
|
|
|
301113
301192
|
// src/utils/setup/install.ts
|
|
301114
301193
|
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
301115
301194
|
import { createHash as createHash14 } from "node:crypto";
|
|
301116
|
-
import { chmodSync as chmodSync2, createWriteStream as createWriteStream2, existsSync as existsSync18, readFileSync as
|
|
301117
|
-
import { join as
|
|
301195
|
+
import { chmodSync as chmodSync2, createWriteStream as createWriteStream2, existsSync as existsSync18, readFileSync as readFileSync37 } from "node:fs";
|
|
301196
|
+
import { join as join66 } from "node:path";
|
|
301118
301197
|
import { pipeline as pipeline2 } from "node:stream/promises";
|
|
301119
301198
|
|
|
301120
301199
|
// src/utils/setup/tarballCache.ts
|
|
@@ -301169,7 +301248,7 @@ function verifyTarballIntegrity(tarballPath, dist, descriptor) {
|
|
|
301169
301248
|
`Refusing to install ${descriptor}: the registry published no integrity digest (neither dist.integrity nor dist.shasum), so the download cannot be verified.`
|
|
301170
301249
|
);
|
|
301171
301250
|
}
|
|
301172
|
-
const bytes =
|
|
301251
|
+
const bytes = readFileSync37(tarballPath);
|
|
301173
301252
|
if (integrity2) {
|
|
301174
301253
|
const candidates = integrity2.trim().split(/\s+/).filter(Boolean);
|
|
301175
301254
|
for (const candidate of candidates) {
|
|
@@ -301198,8 +301277,8 @@ function verifyTarballIntegrity(tarballPath, dist, descriptor) {
|
|
|
301198
301277
|
}
|
|
301199
301278
|
async function installFromNpmTarball(params) {
|
|
301200
301279
|
const tempDir = getTempDir();
|
|
301201
|
-
const extractedDir =
|
|
301202
|
-
const cliPath =
|
|
301280
|
+
const extractedDir = join66(tempDir, "package");
|
|
301281
|
+
const cliPath = join66(extractedDir, params.executablePath);
|
|
301203
301282
|
if (existsSync18(cliPath)) {
|
|
301204
301283
|
log2.debug(`\xBB using cached binary at ${cliPath}`);
|
|
301205
301284
|
return cliPath;
|
|
@@ -301251,7 +301330,7 @@ async function installFromNpmTarball(params) {
|
|
|
301251
301330
|
dist = (await manifestResponse.json()).dist;
|
|
301252
301331
|
}
|
|
301253
301332
|
log2.debug(`\xBB installing ${params.packageName}@${resolvedVersion}...`);
|
|
301254
|
-
const tarballPath =
|
|
301333
|
+
const tarballPath = join66(tempDir, "package.tgz");
|
|
301255
301334
|
const tarballFileName = params.packageName.startsWith("@") ? params.packageName.split("/")[1] : params.packageName;
|
|
301256
301335
|
const tarballUrl = `${npmRegistry}/${encodedName}/-/${tarballFileName}-${resolvedVersion}.tgz`;
|
|
301257
301336
|
const restored = await restoreTarball({
|
|
@@ -301402,9 +301481,9 @@ var CLAUDE_DISALLOWED_TOOLS = CLAUDE_EXEC_TOOL_DENY_RULES.join(",");
|
|
|
301402
301481
|
var INFRAWEAVER_MCP_AUTH_HEADER = `Bearer \${${MCP_SERVER_TOKEN_ENV}}`;
|
|
301403
301482
|
var CLAUDE_MAX_CONCURRENT_SUBAGENTS_DEFAULT = "4";
|
|
301404
301483
|
function writeMcpConfig(ctx) {
|
|
301405
|
-
const configDir =
|
|
301484
|
+
const configDir = join67(ctx.tmpdir, ".claude");
|
|
301406
301485
|
mkdirSync10(configDir, { recursive: true });
|
|
301407
|
-
const configPath =
|
|
301486
|
+
const configPath = join67(configDir, "mcp.json");
|
|
301408
301487
|
const terraformMcp = resolveTerraformMcp(ctx.payload);
|
|
301409
301488
|
if (terraformMcp.kind === "docker_missing") log2.info(`\xBB ${terraformMcp.note}`);
|
|
301410
301489
|
const opentofuMcp = resolveOpenTofuMcp(ctx.payload);
|
|
@@ -301436,13 +301515,13 @@ function writeMcpConfig(ctx) {
|
|
|
301436
301515
|
return configPath;
|
|
301437
301516
|
}
|
|
301438
301517
|
function writePretoolGateAssets(ctx, stopHookPath) {
|
|
301439
|
-
const scriptPath =
|
|
301518
|
+
const scriptPath = join67(ctx.tmpdir, CLAUDE_PRETOOL_GATE_FILENAME);
|
|
301440
301519
|
writeFileSync22(
|
|
301441
301520
|
scriptPath,
|
|
301442
301521
|
buildClaudePretoolGateSource(ctx.subagentDeniedTools, writePolicyPath2(ctx.tmpdir))
|
|
301443
301522
|
);
|
|
301444
301523
|
chmodSync3(scriptPath, 493);
|
|
301445
|
-
const settingsPath =
|
|
301524
|
+
const settingsPath = join67(ctx.tmpdir, "infraweaver-claude-settings.json");
|
|
301446
301525
|
const settings = buildClaudePretoolGateSettings(scriptPath, CLAUDE_EXEC_TOOL_DENY_RULES);
|
|
301447
301526
|
settings.permissions.deny.push(...harnessTmpdirWriteDenyClaude(ctx.tmpdir));
|
|
301448
301527
|
if (stopHookPath) {
|
|
@@ -302067,11 +302146,11 @@ var claude = agent({
|
|
|
302067
302146
|
const onVertex = matchesRouteSentinel(VERTEX_MODEL_ID_ENV, specifier) && specifier !== void 0 && isVertexAnthropicId(specifier);
|
|
302068
302147
|
const model = !specifier ? void 0 : onBedrock ? specifier : onVertex ? void 0 : stripProviderPrefix(specifier);
|
|
302069
302148
|
const homeEnv = agentHomeEnv(ctx.tmpdir);
|
|
302070
|
-
mkdirSync10(
|
|
302149
|
+
mkdirSync10(join67(homeEnv.XDG_CONFIG_HOME, "claude"), { recursive: true });
|
|
302071
302150
|
installBundledSkills({ home: homeEnv.HOME });
|
|
302072
302151
|
const mcpConfigPath = writeMcpConfig(ctx);
|
|
302073
302152
|
const effort = resolveEffort(model);
|
|
302074
|
-
const stopHookPath =
|
|
302153
|
+
const stopHookPath = join67(ctx.tmpdir, "infraweaver-stop-hook.sh");
|
|
302075
302154
|
writeFileSync22(stopHookPath, buildStopHookScript(), { mode: 493 });
|
|
302076
302155
|
const pretoolGate = writePretoolGateAssets(ctx, stopHookPath);
|
|
302077
302156
|
installManagedSettings({
|
|
@@ -302237,7 +302316,7 @@ var claude = agent({
|
|
|
302237
302316
|
init_core3();
|
|
302238
302317
|
import { spawn as nodeSpawn2 } from "node:child_process";
|
|
302239
302318
|
import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync24 } from "node:fs";
|
|
302240
|
-
import { join as
|
|
302319
|
+
import { join as join69 } from "node:path";
|
|
302241
302320
|
import { performance as performance7 } from "node:perf_hooks";
|
|
302242
302321
|
import { StringDecoder as StringDecoder2 } from "node:string_decoder";
|
|
302243
302322
|
import { setTimeout as sleep7 } from "node:timers/promises";
|
|
@@ -307920,7 +307999,7 @@ function autoSelectModel() {
|
|
|
307920
307999
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
307921
308000
|
import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync23 } from "node:fs";
|
|
307922
308001
|
import { homedir as homedir3, userInfo as userInfo2 } from "node:os";
|
|
307923
|
-
import { join as
|
|
308002
|
+
import { join as join68 } from "node:path";
|
|
307924
308003
|
|
|
307925
308004
|
// src/utils/agent/codexOAuth.ts
|
|
307926
308005
|
init_webapi();
|
|
@@ -307974,8 +308053,8 @@ function installCodexAuth() {
|
|
|
307974
308053
|
}
|
|
307975
308054
|
const expiresMs = decodeJwtExpMs(body2.tokens.access_token) ?? 0;
|
|
307976
308055
|
const xdgDataHome = resolveDataHome();
|
|
307977
|
-
const opencodeDir =
|
|
307978
|
-
const authPath =
|
|
308056
|
+
const opencodeDir = join68(xdgDataHome, "opencode");
|
|
308057
|
+
const authPath = join68(opencodeDir, "auth.json");
|
|
307979
308058
|
const opencodeAuth = {
|
|
307980
308059
|
openai: {
|
|
307981
308060
|
type: "oauth",
|
|
@@ -307999,7 +308078,7 @@ function installCodexAuth() {
|
|
|
307999
308078
|
};
|
|
308000
308079
|
}
|
|
308001
308080
|
function resolveDataHome() {
|
|
308002
|
-
if (process.env.CI !== "true") return
|
|
308081
|
+
if (process.env.CI !== "true") return join68(homedir3(), ".local", "share");
|
|
308003
308082
|
bootstrapInfraweaverDataDir();
|
|
308004
308083
|
return INFRAWEAVER_DATA_DIR;
|
|
308005
308084
|
}
|
|
@@ -308740,10 +308819,10 @@ var opencode = agent({
|
|
|
308740
308819
|
const openAiCompatModel = resolveOpenAiCompatibleOpenCodeModel(rawModel);
|
|
308741
308820
|
const model = isBedrockRoute ? `amazon-bedrock/${rawModel}` : vertexModel ?? openAiCompatModel ?? rawModel;
|
|
308742
308821
|
const homeEnv = agentHomeEnv(ctx.tmpdir);
|
|
308743
|
-
const opencodePluginDir =
|
|
308822
|
+
const opencodePluginDir = join69(homeEnv.XDG_CONFIG_HOME, "opencode", "plugin");
|
|
308744
308823
|
mkdirSync12(opencodePluginDir, { recursive: true });
|
|
308745
308824
|
writeFileSync24(
|
|
308746
|
-
|
|
308825
|
+
join69(opencodePluginDir, INFRAWEAVER_OPENCODE_GATE_PLUGIN_FILENAME),
|
|
308747
308826
|
buildOpencodeSubagentGateSource(ctx.subagentDeniedTools, writePolicyPath2(ctx.tmpdir))
|
|
308748
308827
|
);
|
|
308749
308828
|
installBundledSkills({ home: homeEnv.HOME });
|
|
@@ -309779,7 +309858,7 @@ async function fetchRunContext(params) {
|
|
|
309779
309858
|
// src/utils/github/github.ts
|
|
309780
309859
|
init_core3();
|
|
309781
309860
|
import { rename as rename2, writeFile as writeFile2 } from "node:fs/promises";
|
|
309782
|
-
import { dirname as dirname12, join as
|
|
309861
|
+
import { dirname as dirname12, join as join70 } from "node:path";
|
|
309783
309862
|
|
|
309784
309863
|
// node_modules/.pnpm/universal-user-agent@7.0.3/node_modules/universal-user-agent/index.js
|
|
309785
309864
|
function getUserAgent2() {
|
|
@@ -315595,7 +315674,7 @@ function getGitHubUsageSummary() {
|
|
|
315595
315674
|
}
|
|
315596
315675
|
async function writeGitHubUsageSummaryToFile(path15) {
|
|
315597
315676
|
const summary2 = getGitHubUsageSummary();
|
|
315598
|
-
const tmpPath =
|
|
315677
|
+
const tmpPath = join70(dirname12(path15), `.usage-summary-${process.pid}.tmp`);
|
|
315599
315678
|
await writeFile2(tmpPath, JSON.stringify(summary2));
|
|
315600
315679
|
await rename2(tmpPath, path15);
|
|
315601
315680
|
}
|
|
@@ -316140,7 +316219,7 @@ async function resolveModelAndAuth(params) {
|
|
|
316140
316219
|
// src/utils/run/runLifecycle.ts
|
|
316141
316220
|
init_core3();
|
|
316142
316221
|
import { writeFile as writeFile5 } from "node:fs/promises";
|
|
316143
|
-
import { join as
|
|
316222
|
+
import { join as join73, resolve as resolve10 } from "node:path";
|
|
316144
316223
|
|
|
316145
316224
|
// src/utils/cloud/cloudReport.ts
|
|
316146
316225
|
init_core3();
|
|
@@ -316534,7 +316613,7 @@ async function reportToCloud(input2) {
|
|
|
316534
316613
|
|
|
316535
316614
|
// src/utils/cloud/learnings.ts
|
|
316536
316615
|
import { mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
|
|
316537
|
-
import { dirname as dirname13, join as
|
|
316616
|
+
import { dirname as dirname13, join as join71 } from "node:path";
|
|
316538
316617
|
|
|
316539
316618
|
// src/utils/cloud/learningsTruncate.ts
|
|
316540
316619
|
var MAX_LEARNINGS_LENGTH = 1e5;
|
|
@@ -316551,7 +316630,7 @@ function truncateAtLineBoundary(body2, cap2) {
|
|
|
316551
316630
|
// src/utils/cloud/learnings.ts
|
|
316552
316631
|
var LEARNINGS_FILE_NAME = LEARNINGS_FILE;
|
|
316553
316632
|
function learningsFilePath(tmpdir5) {
|
|
316554
|
-
return
|
|
316633
|
+
return join71(tmpdir5, LEARNINGS_FILE_NAME);
|
|
316555
316634
|
}
|
|
316556
316635
|
async function seedLearningsFile(params) {
|
|
316557
316636
|
const path15 = learningsFilePath(params.tmpdir);
|
|
@@ -316682,7 +316761,7 @@ ${ctx.error}` : ctx.error;
|
|
|
316682
316761
|
|
|
316683
316762
|
// src/utils/github/prSummary.ts
|
|
316684
316763
|
import { mkdir as mkdir4, readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
|
|
316685
|
-
import { dirname as dirname14, join as
|
|
316764
|
+
import { dirname as dirname14, join as join72 } from "node:path";
|
|
316686
316765
|
var SUMMARY_FILE_NAME = SUMMARY_FILE;
|
|
316687
316766
|
var SUMMARY_SCAFFOLD = `# PR summary
|
|
316688
316767
|
|
|
@@ -316692,7 +316771,7 @@ var SUMMARY_SCAFFOLD = `# PR summary
|
|
|
316692
316771
|
var MIN_SNAPSHOT_LENGTH = 60;
|
|
316693
316772
|
var MAX_SNAPSHOT_LENGTH = 32768;
|
|
316694
316773
|
function summaryFilePath(tmpdir5) {
|
|
316695
|
-
return
|
|
316774
|
+
return join72(tmpdir5, SUMMARY_FILE_NAME);
|
|
316696
316775
|
}
|
|
316697
316776
|
async function seedSummaryFile(params) {
|
|
316698
316777
|
const path15 = summaryFilePath(params.tmpdir);
|
|
@@ -317226,7 +317305,7 @@ async function emitFindingsOutputs(toolState, requiredControls) {
|
|
|
317226
317305
|
if (a.level === "error") error62(a.message, props);
|
|
317227
317306
|
else warning(a.message, props);
|
|
317228
317307
|
}
|
|
317229
|
-
const sarifPath =
|
|
317308
|
+
const sarifPath = join73(workspace, SARIF_FILE);
|
|
317230
317309
|
if (session.emittedSarifPath && resolve10(session.emittedSarifPath) === resolve10(sarifPath)) {
|
|
317231
317310
|
log2.info(`\xBB findings output: replacing the agent-emitted ${SARIF_FILE} with the gate's`);
|
|
317232
317311
|
}
|
|
@@ -317658,7 +317737,7 @@ async function runAgentWithWatchdogs(params) {
|
|
|
317658
317737
|
// src/phases/startToolPlane.ts
|
|
317659
317738
|
import { existsSync as existsSync19, readdirSync as readdirSync10 } from "node:fs";
|
|
317660
317739
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
317661
|
-
import { join as
|
|
317740
|
+
import { join as join74 } from "node:path";
|
|
317662
317741
|
|
|
317663
317742
|
// src/utils/cloud/runTerminalStatus.ts
|
|
317664
317743
|
var TERMINAL_STATE_KEY = "run_terminal";
|
|
@@ -318486,7 +318565,7 @@ ${instructions.user}` : null,
|
|
|
318486
318565
|
log2.info(instructions.full);
|
|
318487
318566
|
});
|
|
318488
318567
|
if (toolContext.agentId === "opencode") {
|
|
318489
|
-
const pluginDir =
|
|
318568
|
+
const pluginDir = join74(process.cwd(), ".opencode", "plugin");
|
|
318490
318569
|
const hasPlugins = existsSync19(pluginDir) && readdirSync10(pluginDir).some((f) => /\.[jt]sx?$/.test(f));
|
|
318491
318570
|
if (hasPlugins && toolState.dependencyInstallation?.promise) {
|
|
318492
318571
|
log2.info(
|