@osfactory/har 1.14.3 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38722,6 +38722,26 @@ function substituteEnvTemplate(template, values) {
|
|
|
38722
38722
|
}
|
|
38723
38723
|
);
|
|
38724
38724
|
}
|
|
38725
|
+
function findUnsubstitutedTemplateVars(template) {
|
|
38726
|
+
const allowed = new Set(AGENT_ENV_TEMPLATE_VARS);
|
|
38727
|
+
const found = /* @__PURE__ */ new Map();
|
|
38728
|
+
template.split("\n").forEach((line, idx) => {
|
|
38729
|
+
if (/^\s*#/.test(line)) return;
|
|
38730
|
+
const re2 = /\$(?:\{([A-Za-z_][A-Za-z0-9_]*)([^}]*)(\}?)|([A-Za-z_][A-Za-z0-9_]*))/g;
|
|
38731
|
+
for (let m = re2.exec(line); m !== null; m = re2.exec(line)) {
|
|
38732
|
+
const braced = m[1] !== void 0;
|
|
38733
|
+
const name = braced ? m[1] : m[4];
|
|
38734
|
+
const plain = !braced || m[2] === "" && m[3] === "}";
|
|
38735
|
+
const reason = plain ? "not-substituted" : "parameter-syntax";
|
|
38736
|
+
if (plain && allowed.has(name)) continue;
|
|
38737
|
+
const key = `${reason}:${name}`;
|
|
38738
|
+
const entry = found.get(key) ?? { name, reason, lines: [] };
|
|
38739
|
+
if (!entry.lines.includes(idx + 1)) entry.lines.push(idx + 1);
|
|
38740
|
+
found.set(key, entry);
|
|
38741
|
+
}
|
|
38742
|
+
});
|
|
38743
|
+
return [...found.values()];
|
|
38744
|
+
}
|
|
38725
38745
|
function generateAgentEnvFile(options) {
|
|
38726
38746
|
const templatePath = options.templatePath ?? path24.join(options.harnessDir, "env.template");
|
|
38727
38747
|
if (!fs24.existsSync(templatePath)) return false;
|
|
@@ -84485,6 +84505,7 @@ function applyLine(repoPath, lineSpec, options = {}) {
|
|
|
84485
84505
|
// src/harness/doctor.ts
|
|
84486
84506
|
init_stages();
|
|
84487
84507
|
init_hooks2();
|
|
84508
|
+
init_agent_env();
|
|
84488
84509
|
|
|
84489
84510
|
// src/harness/migrations.ts
|
|
84490
84511
|
var fs64 = __toESM(require("fs"));
|
|
@@ -84969,6 +84990,7 @@ var CHECK_LABELS = {
|
|
|
84969
84990
|
"lifecycle-stages": "lifecycle stages (launch/verify/teardown)",
|
|
84970
84991
|
"verification-ids": "verificationStages ids",
|
|
84971
84992
|
"port-lanes": "infra port lanes",
|
|
84993
|
+
"env-template": "env.template placeholders",
|
|
84972
84994
|
"slot-registry": "slot registry worktrees",
|
|
84973
84995
|
hooks: "lifecycle hooks (.har/hooks)",
|
|
84974
84996
|
"retired-machinery": "no references to retired runtime machinery",
|
|
@@ -85196,6 +85218,27 @@ function runDoctor(repoPath) {
|
|
|
85196
85218
|
}
|
|
85197
85219
|
}
|
|
85198
85220
|
}
|
|
85221
|
+
const envTemplatePath = path73.join(harnessDir, "env.template");
|
|
85222
|
+
if (!fs65.existsSync(envTemplatePath)) {
|
|
85223
|
+
skipped.add("env-template");
|
|
85224
|
+
} else {
|
|
85225
|
+
const allowed = new Set(AGENT_ENV_TEMPLATE_VARS);
|
|
85226
|
+
const allowedVars = AGENT_ENV_TEMPLATE_VARS.join(", ");
|
|
85227
|
+
const template = fs65.readFileSync(envTemplatePath, "utf8");
|
|
85228
|
+
for (const { name, reason, lines } of findUnsubstitutedTemplateVars(template)) {
|
|
85229
|
+
const rest = lines.slice(1);
|
|
85230
|
+
const more = rest.length ? ` (also line${rest.length > 1 ? "s" : ""} ${rest.join(", ")})` : "";
|
|
85231
|
+
const literalDollar = "A literal `$` cannot be written in env.template: envsubst has no escape and keeps `\\$` as-is";
|
|
85232
|
+
findings.push({
|
|
85233
|
+
check: "env-template",
|
|
85234
|
+
severity: "warning",
|
|
85235
|
+
file: "env.template",
|
|
85236
|
+
line: lines[0],
|
|
85237
|
+
message: reason === "parameter-syntax" ? `\${${name}\u2026} uses shell parameter syntax, which launch never expands \u2014 the whole reference is written literally to .env.agent.<id>${more}` : `\${${name}} is not substituted at launch and will be written literally to .env.agent.<id>${more}`,
|
|
85238
|
+
remedy: reason === "parameter-syntax" && allowed.has(name) ? `Write a plain \${${name}}; :- / :? / # / % are not supported by envsubst` : `Use one of ${allowedVars} (plain \${NAME}, no modifiers), or hard-code the value (variables in harness.env are not substituted into env.template). ${literalDollar}`
|
|
85239
|
+
});
|
|
85240
|
+
}
|
|
85241
|
+
}
|
|
85199
85242
|
const manifest = readManifest(repoPath);
|
|
85200
85243
|
if (!manifest?.ejected) {
|
|
85201
85244
|
skipped.add("ejected-runtime");
|