overlane 0.1.144 → 0.1.145
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/overlane.mjs +651 -409
- package/package.json +1 -1
- package/plugins/claude/plugins/mvrx-harness/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/plugins/mvrx-harness/hooks/hooks.json +24 -1
- package/plugins/claude/plugins/mvrx-harness/scripts/harness-overlay.mjs +66 -0
- package/plugins/codex/plugins/mvrx-harness/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/mvrx-harness/scripts/harness-overlay.mjs +66 -0
- package/plugins/release-manifest.json +19 -9
package/dist/overlane.mjs
CHANGED
|
@@ -3446,7 +3446,7 @@ var init_schemas = __esm({
|
|
|
3446
3446
|
}
|
|
3447
3447
|
return propValues;
|
|
3448
3448
|
});
|
|
3449
|
-
const
|
|
3449
|
+
const isObject4 = isObject;
|
|
3450
3450
|
const catchall = def.catchall;
|
|
3451
3451
|
let value;
|
|
3452
3452
|
const memo3 = globalConfig.memoizer;
|
|
@@ -3454,7 +3454,7 @@ var init_schemas = __esm({
|
|
|
3454
3454
|
inst._zod.parse = (payload, ctx) => {
|
|
3455
3455
|
value ?? (value = _normalized.value);
|
|
3456
3456
|
const input2 = payload.value;
|
|
3457
|
-
if (!
|
|
3457
|
+
if (!isObject4(input2)) {
|
|
3458
3458
|
payload.issues.push({
|
|
3459
3459
|
expected: "object",
|
|
3460
3460
|
code: "invalid_type",
|
|
@@ -3590,7 +3590,7 @@ var init_schemas = __esm({
|
|
|
3590
3590
|
return doc.compile();
|
|
3591
3591
|
};
|
|
3592
3592
|
let fastpass;
|
|
3593
|
-
const
|
|
3593
|
+
const isObject4 = isObject;
|
|
3594
3594
|
const jit = !globalConfig.jitless;
|
|
3595
3595
|
const allowsEval2 = allowsEval;
|
|
3596
3596
|
const fastEnabled = jit && allowsEval2.value;
|
|
@@ -3599,7 +3599,7 @@ var init_schemas = __esm({
|
|
|
3599
3599
|
inst._zod.parse = (payload, ctx) => {
|
|
3600
3600
|
value ?? (value = _normalized.value);
|
|
3601
3601
|
const input2 = payload.value;
|
|
3602
|
-
if (!
|
|
3602
|
+
if (!isObject4(input2)) {
|
|
3603
3603
|
payload.issues.push({
|
|
3604
3604
|
expected: "object",
|
|
3605
3605
|
code: "invalid_type",
|
|
@@ -8993,8 +8993,8 @@ var capitalizeFirstCharacter, error33;
|
|
|
8993
8993
|
var init_lt = __esm({
|
|
8994
8994
|
"../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js"() {
|
|
8995
8995
|
init_util();
|
|
8996
|
-
capitalizeFirstCharacter = (
|
|
8997
|
-
return
|
|
8996
|
+
capitalizeFirstCharacter = (text2) => {
|
|
8997
|
+
return text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
8998
8998
|
};
|
|
8999
8999
|
error33 = () => {
|
|
9000
9000
|
const Sizable = {
|
|
@@ -20701,7 +20701,7 @@ var init_code_map = __esm({
|
|
|
20701
20701
|
CODE_MAP_BASES = ["gate-07-failed", "gate-07-passed", "spec-default-provisional", "spec-default", "project-setting"];
|
|
20702
20702
|
CodeMapDefault = external_exports.object({ setting: CodeMapSetting, on: external_exports.boolean(), basis: external_exports.enum(CODE_MAP_BASES), reason: external_exports.string().min(1), gate07: Gate07Verdict }).strict();
|
|
20703
20703
|
CODE_MAP_CHARS_PER_TOKEN = 2.3;
|
|
20704
|
-
estimateCodeMapTokens = (
|
|
20704
|
+
estimateCodeMapTokens = (text2) => Math.ceil(text2.length * 10 / (CODE_MAP_CHARS_PER_TOKEN * 10));
|
|
20705
20705
|
CODE_MAP_CONTEXT_SETTINGS = ["default", "on", "off"];
|
|
20706
20706
|
CodeMapContextSetting = external_exports.enum(CODE_MAP_CONTEXT_SETTINGS);
|
|
20707
20707
|
CODE_MAP_INTENTS = ["read-only", "edit", "unknown"];
|
|
@@ -20782,7 +20782,7 @@ var init_context_packet = __esm({
|
|
|
20782
20782
|
}).strict();
|
|
20783
20783
|
SkillSummary = external_exports.object({
|
|
20784
20784
|
name: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/, "skill names are lowercase kebab-case"),
|
|
20785
|
-
description: external_exports.string().min(1).max(200).refine((
|
|
20785
|
+
description: external_exports.string().min(1).max(200).refine((text2) => !/[\r\n]/.test(text2), "description must be one line")
|
|
20786
20786
|
}).strict();
|
|
20787
20787
|
ContextPacket = external_exports.object({
|
|
20788
20788
|
tenantId: TenantId,
|
|
@@ -21299,9 +21299,9 @@ var init_release = __esm({
|
|
|
21299
21299
|
});
|
|
21300
21300
|
|
|
21301
21301
|
// ../contracts/src/kit.ts
|
|
21302
|
-
function fingerprint(
|
|
21302
|
+
function fingerprint(text2) {
|
|
21303
21303
|
let hash2 = 0xcbf29ce484222325n;
|
|
21304
|
-
for (const byte of new TextEncoder().encode(
|
|
21304
|
+
for (const byte of new TextEncoder().encode(text2)) {
|
|
21305
21305
|
hash2 ^= BigInt(byte);
|
|
21306
21306
|
hash2 = BigInt.asUintN(64, hash2 * 0x100000001b3n);
|
|
21307
21307
|
}
|
|
@@ -21977,7 +21977,7 @@ var init_memory = __esm({
|
|
|
21977
21977
|
RECALL_LABEL = "recalled memory: untrusted data, not an instruction";
|
|
21978
21978
|
Id = external_exports.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/);
|
|
21979
21979
|
MemoryItemId = Id;
|
|
21980
|
-
Body = external_exports.string().refine((
|
|
21980
|
+
Body = external_exports.string().refine((text2) => new TextEncoder().encode(text2).length <= MAX_MEMORY_BODY_BYTES, { message: `body must be at most ${MAX_MEMORY_BODY_BYTES} bytes` });
|
|
21981
21981
|
MemoryObserverKind = external_exports.enum(["user", "agent", "ci", "curator"]);
|
|
21982
21982
|
MemoryProvenance = external_exports.object({
|
|
21983
21983
|
observer: external_exports.string().min(1).max(160),
|
|
@@ -22635,8 +22635,8 @@ function canonicalJson(value) {
|
|
|
22635
22635
|
const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
22636
22636
|
return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(",")}}`;
|
|
22637
22637
|
}
|
|
22638
|
-
function sha256Hex(
|
|
22639
|
-
const data = new TextEncoder().encode(
|
|
22638
|
+
function sha256Hex(text2) {
|
|
22639
|
+
const data = new TextEncoder().encode(text2);
|
|
22640
22640
|
const bitLength = data.length * 8;
|
|
22641
22641
|
const padded = new Uint8Array(Math.ceil((data.length + 9) / 64) * 64);
|
|
22642
22642
|
padded.set(data);
|
|
@@ -23783,10 +23783,10 @@ function classifyMethod(method) {
|
|
|
23783
23783
|
}
|
|
23784
23784
|
function blockedClassFor(op) {
|
|
23785
23785
|
const words = op.operationId.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
23786
|
-
const
|
|
23787
|
-
if (op.method.toUpperCase() === "DELETE" || DESTRUCTIVE.test(
|
|
23788
|
-
if (BILLING.test(
|
|
23789
|
-
if (SECRETS.test(
|
|
23786
|
+
const text2 = `${op.path.toLowerCase()} ${words}`;
|
|
23787
|
+
if (op.method.toUpperCase() === "DELETE" || DESTRUCTIVE.test(text2)) return "destructive";
|
|
23788
|
+
if (BILLING.test(text2)) return "billing";
|
|
23789
|
+
if (SECRETS.test(text2)) return "secrets";
|
|
23790
23790
|
return null;
|
|
23791
23791
|
}
|
|
23792
23792
|
var AGENT_PLANS, AgentPlan, AGENT_PROVIDERS, AgentProvider, TOOL_CLASSES, AgentToolClass, BLOCKED_CLASSES, BlockedClass, BILLING, SECRETS, DESTRUCTIVE, AgentOperation, AgentToolDefinition, AGENT_REFUSAL_CODES, AgentRefusalCode, AgentRefusal, AgentDiffEntry, APPROVAL_STATES, AgentApprovalState, AgentInverseChange, AgentApproval, AgentWriteToolResult, AgentReadToolResult, AgentToolResult, AgentCitation, MESSAGE_ORIGINS, AgentMessageOrigin, AgentMessage, AgentChatRequest, AgentFeedback, AGENT_AUDIT_RESULTS, AgentAuditResult, AgentAuditEvent, AgentReadOnlyMode, RouteIndexEntry, RouteIndex, AgentRouteHit;
|
|
@@ -24569,43 +24569,43 @@ var init_git = __esm({
|
|
|
24569
24569
|
});
|
|
24570
24570
|
|
|
24571
24571
|
// ../contracts/src/ci.ts
|
|
24572
|
-
function stripComment(
|
|
24572
|
+
function stripComment(text2) {
|
|
24573
24573
|
let quote4 = null;
|
|
24574
|
-
for (let i2 = 0; i2 <
|
|
24575
|
-
const ch =
|
|
24574
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
24575
|
+
const ch = text2[i2];
|
|
24576
24576
|
if (quote4 !== null) {
|
|
24577
24577
|
if (ch === quote4) quote4 = null;
|
|
24578
24578
|
} else if (ch === '"' || ch === "'") {
|
|
24579
|
-
if (i2 === 0 || /[\s[,{:]/.test(
|
|
24580
|
-
} else if (ch === "#" && (i2 === 0 || /\s/.test(
|
|
24581
|
-
return
|
|
24579
|
+
if (i2 === 0 || /[\s[,{:]/.test(text2[i2 - 1] ?? " ")) quote4 = ch;
|
|
24580
|
+
} else if (ch === "#" && (i2 === 0 || /\s/.test(text2[i2 - 1] ?? ""))) {
|
|
24581
|
+
return text2.slice(0, i2);
|
|
24582
24582
|
}
|
|
24583
24583
|
}
|
|
24584
|
-
return
|
|
24584
|
+
return text2;
|
|
24585
24585
|
}
|
|
24586
24586
|
function parseScalar(raw, line3) {
|
|
24587
|
-
const
|
|
24588
|
-
if (
|
|
24589
|
-
if (
|
|
24590
|
-
if (
|
|
24591
|
-
if (/^-?\d+$/.test(
|
|
24592
|
-
if (
|
|
24593
|
-
if (!
|
|
24587
|
+
const text2 = raw.trim();
|
|
24588
|
+
if (text2 === "" || text2 === "~" || text2 === "null") return null;
|
|
24589
|
+
if (text2 === "true") return true;
|
|
24590
|
+
if (text2 === "false") return false;
|
|
24591
|
+
if (/^-?\d+$/.test(text2)) return Number(text2);
|
|
24592
|
+
if (text2.startsWith('"')) {
|
|
24593
|
+
if (!text2.endsWith('"') || text2.length < 2) throw new YamlFail(line3, "unterminated double-quoted string");
|
|
24594
24594
|
try {
|
|
24595
|
-
return JSON.parse(
|
|
24595
|
+
return JSON.parse(text2);
|
|
24596
24596
|
} catch {
|
|
24597
24597
|
throw new YamlFail(line3, "bad escape in double-quoted string");
|
|
24598
24598
|
}
|
|
24599
24599
|
}
|
|
24600
|
-
if (
|
|
24601
|
-
if (!
|
|
24602
|
-
return
|
|
24600
|
+
if (text2.startsWith("'")) {
|
|
24601
|
+
if (!text2.endsWith("'") || text2.length < 2) throw new YamlFail(line3, "unterminated single-quoted string");
|
|
24602
|
+
return text2.slice(1, -1).replaceAll("''", "'");
|
|
24603
24603
|
}
|
|
24604
|
-
if (
|
|
24605
|
-
if (
|
|
24606
|
-
if (
|
|
24607
|
-
if (!
|
|
24608
|
-
const inner =
|
|
24604
|
+
if (text2 === "{}") return {};
|
|
24605
|
+
if (text2 === "[]") return [];
|
|
24606
|
+
if (text2.startsWith("[")) {
|
|
24607
|
+
if (!text2.endsWith("]")) throw new YamlFail(line3, "unterminated list; write the list on one line or use '- ' items");
|
|
24608
|
+
const inner = text2.slice(1, -1);
|
|
24609
24609
|
const items = [];
|
|
24610
24610
|
let current2 = "";
|
|
24611
24611
|
let quote4 = null;
|
|
@@ -24624,9 +24624,9 @@ function parseScalar(raw, line3) {
|
|
|
24624
24624
|
if (current2.trim() !== "" || items.length > 0) items.push(parseScalar(current2, line3));
|
|
24625
24625
|
return items;
|
|
24626
24626
|
}
|
|
24627
|
-
if (
|
|
24628
|
-
if (/^[&*!%@`]/.test(
|
|
24629
|
-
return
|
|
24627
|
+
if (text2.startsWith("{")) throw new YamlFail(line3, "flow maps are not supported; use an indented block");
|
|
24628
|
+
if (/^[&*!%@`]/.test(text2)) throw new YamlFail(line3, `'${text2[0]}' (anchors, aliases and tags) is not supported`);
|
|
24629
|
+
return text2;
|
|
24630
24630
|
}
|
|
24631
24631
|
function parseYaml(source) {
|
|
24632
24632
|
const lines = source.replaceAll("\r\n", "\n").split("\n");
|
|
@@ -24772,10 +24772,10 @@ function mapKeys(value, canon, orig, paths) {
|
|
|
24772
24772
|
}
|
|
24773
24773
|
return value;
|
|
24774
24774
|
}
|
|
24775
|
-
function parsePipelineConfig(
|
|
24775
|
+
function parsePipelineConfig(text2) {
|
|
24776
24776
|
let located;
|
|
24777
24777
|
try {
|
|
24778
|
-
located = parseYaml(
|
|
24778
|
+
located = parseYaml(text2);
|
|
24779
24779
|
} catch (error62) {
|
|
24780
24780
|
if (error62 instanceof YamlFail) return { ok: false, issues: [{ line: error62.line, message: error62.message }] };
|
|
24781
24781
|
throw error62;
|
|
@@ -26202,12 +26202,12 @@ function rulesRevision(source) {
|
|
|
26202
26202
|
return sha256Hex(normaliseText(source)).slice(0, 12);
|
|
26203
26203
|
}
|
|
26204
26204
|
function validateRulesSource(source) {
|
|
26205
|
-
const
|
|
26206
|
-
if (
|
|
26207
|
-
if (new TextEncoder().encode(
|
|
26208
|
-
if (
|
|
26209
|
-
return { ok: true, text:
|
|
26210
|
-
`, revision: rulesRevision(
|
|
26205
|
+
const text2 = normaliseText(source);
|
|
26206
|
+
if (text2.trim() === "") return { ok: false, problem: `${RULES_SOURCE_PATH} is empty` };
|
|
26207
|
+
if (new TextEncoder().encode(text2).length > MAX_RULES_BYTES) return { ok: false, problem: `${RULES_SOURCE_PATH} is larger than ${MAX_RULES_BYTES / 1024} KB` };
|
|
26208
|
+
if (text2.includes(MARKER)) return { ok: false, problem: `${RULES_SOURCE_PATH} contains the text "${MARKER}", which is reserved for the managed region markers` };
|
|
26209
|
+
return { ok: true, text: text2.endsWith("\n") ? text2 : `${text2}
|
|
26210
|
+
`, revision: rulesRevision(text2) };
|
|
26211
26211
|
}
|
|
26212
26212
|
function regionBody(source) {
|
|
26213
26213
|
return `<!-- Generated from ${RULES_SOURCE_PATH}. Edit that file, then run \`overlane rules sync\`. A hand edit in this region is reported as drift. -->
|
|
@@ -26255,8 +26255,8 @@ function firstDifference(found, expected) {
|
|
|
26255
26255
|
}
|
|
26256
26256
|
return { line: 1, found: "", expected: "" };
|
|
26257
26257
|
}
|
|
26258
|
-
function describeLine(
|
|
26259
|
-
const clean2 =
|
|
26258
|
+
function describeLine(text2) {
|
|
26259
|
+
const clean2 = text2.trim();
|
|
26260
26260
|
return clean2.length > 80 ? `${clean2.slice(0, 77)}...` : clean2;
|
|
26261
26261
|
}
|
|
26262
26262
|
function inspectRegionTarget(target2, fileText, source) {
|
|
@@ -26291,9 +26291,9 @@ function planRegionSync(target2, fileText, source, force) {
|
|
|
26291
26291
|
case "missing":
|
|
26292
26292
|
return { ...base5, action: "create", next: `${target2.preamble}${region}`, reason: "created" };
|
|
26293
26293
|
case "unmanaged": {
|
|
26294
|
-
const
|
|
26295
|
-
const joined =
|
|
26296
|
-
` : `${
|
|
26294
|
+
const text2 = normaliseText(fileText);
|
|
26295
|
+
const joined = text2 === "" ? "" : text2.endsWith("\n\n") ? text2 : text2.endsWith("\n") ? `${text2}
|
|
26296
|
+
` : `${text2}
|
|
26297
26297
|
|
|
26298
26298
|
`;
|
|
26299
26299
|
return { ...base5, action: "append", next: `${joined}${region}`, reason: "appended a managed region at the end; every existing line is kept" };
|
|
@@ -26324,10 +26324,10 @@ function planRegionSync(target2, fileText, source, force) {
|
|
|
26324
26324
|
return { ...base5, action: "refuse", next: null, reason: report2.detail };
|
|
26325
26325
|
}
|
|
26326
26326
|
}
|
|
26327
|
-
function parseSettings(
|
|
26328
|
-
if (
|
|
26327
|
+
function parseSettings(text2) {
|
|
26328
|
+
if (text2 === null || text2.trim() === "") return { ok: true, value: {} };
|
|
26329
26329
|
try {
|
|
26330
|
-
const value = JSON.parse(
|
|
26330
|
+
const value = JSON.parse(text2);
|
|
26331
26331
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return { ok: false, problem: "is not a JSON object" };
|
|
26332
26332
|
return { ok: true, value };
|
|
26333
26333
|
} catch {
|
|
@@ -26405,7 +26405,7 @@ var init_rules_sync = __esm({
|
|
|
26405
26405
|
{ id: "gemini-settings", path: ".gemini/settings.json", kind: "gemini-settings", reader: "Gemini CLI settings (context.fileName)", preamble: "" }
|
|
26406
26406
|
];
|
|
26407
26407
|
GEMINI_CONTEXT_FILES = ["GEMINI.md", "AGENTS.md"];
|
|
26408
|
-
normaliseText = (
|
|
26408
|
+
normaliseText = (text2) => text2.replace(/\r\n?/g, "\n");
|
|
26409
26409
|
digestOf = (body2) => sha256Hex(body2).slice(0, 16);
|
|
26410
26410
|
BEGIN = new RegExp(`^<!-- ${MARKER}:begin rev=([0-9a-f]{12}) digest=([0-9a-f]{16}) -->$`);
|
|
26411
26411
|
END_LINE = `<!-- ${MARKER}:end -->`;
|
|
@@ -26629,10 +26629,10 @@ var init_egress = __esm({
|
|
|
26629
26629
|
"repl.co"
|
|
26630
26630
|
];
|
|
26631
26631
|
HOST_PATTERN = external_exports.string().min(3).max(253).refine((value) => {
|
|
26632
|
-
const
|
|
26633
|
-
const name2 =
|
|
26632
|
+
const text2 = value.trim().toLowerCase();
|
|
26633
|
+
const name2 = text2.startsWith("*.") ? text2.slice(2) : text2;
|
|
26634
26634
|
const check2 = normaliseHost(name2);
|
|
26635
|
-
return check2.ok && check2.kind === "name" && name2.includes(".") && !isMetadataHost(name2) && !isInternalName(name2) && !isSharedHostingWildcard(
|
|
26635
|
+
return check2.ok && check2.kind === "name" && name2.includes(".") && !isMetadataHost(name2) && !isInternalName(name2) && !isSharedHostingWildcard(text2);
|
|
26636
26636
|
}, "must be a host name such as registry.npmjs.org or *.example.com (no address, no internal name, no wildcard over a top-level or shared-hosting domain)");
|
|
26637
26637
|
MAX_EGRESS_RULES = 100;
|
|
26638
26638
|
EgressRule = external_exports.object({
|
|
@@ -26757,15 +26757,15 @@ var init_egress = __esm({
|
|
|
26757
26757
|
});
|
|
26758
26758
|
|
|
26759
26759
|
// ../contracts/src/enterprise.ts
|
|
26760
|
-
function parseCsv(
|
|
26760
|
+
function parseCsv(text2) {
|
|
26761
26761
|
const rows = [];
|
|
26762
26762
|
let row = [];
|
|
26763
26763
|
let cell = "";
|
|
26764
26764
|
let quoted = false;
|
|
26765
|
-
for (let i2 = 0; i2 <
|
|
26766
|
-
const ch =
|
|
26765
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
26766
|
+
const ch = text2[i2];
|
|
26767
26767
|
if (quoted) {
|
|
26768
|
-
if (ch === '"' &&
|
|
26768
|
+
if (ch === '"' && text2[i2 + 1] === '"') {
|
|
26769
26769
|
cell += '"';
|
|
26770
26770
|
i2 += 1;
|
|
26771
26771
|
} else if (ch === '"') quoted = false;
|
|
@@ -26775,7 +26775,7 @@ function parseCsv(text) {
|
|
|
26775
26775
|
row.push(cell);
|
|
26776
26776
|
cell = "";
|
|
26777
26777
|
} else if (ch === "\n" || ch === "\r") {
|
|
26778
|
-
if (ch === "\r" &&
|
|
26778
|
+
if (ch === "\r" && text2[i2 + 1] === "\n") i2 += 1;
|
|
26779
26779
|
row.push(cell);
|
|
26780
26780
|
rows.push(row);
|
|
26781
26781
|
row = [];
|
|
@@ -28307,14 +28307,14 @@ var require_foldFlowLines = __commonJS({
|
|
|
28307
28307
|
var FOLD_FLOW = "flow";
|
|
28308
28308
|
var FOLD_BLOCK = "block";
|
|
28309
28309
|
var FOLD_QUOTED = "quoted";
|
|
28310
|
-
function foldFlowLines(
|
|
28310
|
+
function foldFlowLines(text2, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
28311
28311
|
if (!lineWidth || lineWidth < 0)
|
|
28312
|
-
return
|
|
28312
|
+
return text2;
|
|
28313
28313
|
if (lineWidth < minContentWidth)
|
|
28314
28314
|
minContentWidth = 0;
|
|
28315
28315
|
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
|
|
28316
|
-
if (
|
|
28317
|
-
return
|
|
28316
|
+
if (text2.length <= endStep)
|
|
28317
|
+
return text2;
|
|
28318
28318
|
const folds = [];
|
|
28319
28319
|
const escapedFolds = {};
|
|
28320
28320
|
let end = lineWidth - indent.length;
|
|
@@ -28331,14 +28331,14 @@ var require_foldFlowLines = __commonJS({
|
|
|
28331
28331
|
let escStart = -1;
|
|
28332
28332
|
let escEnd = -1;
|
|
28333
28333
|
if (mode === FOLD_BLOCK) {
|
|
28334
|
-
i2 = consumeMoreIndentedLines(
|
|
28334
|
+
i2 = consumeMoreIndentedLines(text2, i2, indent.length);
|
|
28335
28335
|
if (i2 !== -1)
|
|
28336
28336
|
end = i2 + endStep;
|
|
28337
28337
|
}
|
|
28338
|
-
for (let ch; ch =
|
|
28338
|
+
for (let ch; ch = text2[i2 += 1]; ) {
|
|
28339
28339
|
if (mode === FOLD_QUOTED && ch === "\\") {
|
|
28340
28340
|
escStart = i2;
|
|
28341
|
-
switch (
|
|
28341
|
+
switch (text2[i2 + 1]) {
|
|
28342
28342
|
case "x":
|
|
28343
28343
|
i2 += 3;
|
|
28344
28344
|
break;
|
|
@@ -28355,12 +28355,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
28355
28355
|
}
|
|
28356
28356
|
if (ch === "\n") {
|
|
28357
28357
|
if (mode === FOLD_BLOCK)
|
|
28358
|
-
i2 = consumeMoreIndentedLines(
|
|
28358
|
+
i2 = consumeMoreIndentedLines(text2, i2, indent.length);
|
|
28359
28359
|
end = i2 + indent.length + endStep;
|
|
28360
28360
|
split = void 0;
|
|
28361
28361
|
} else {
|
|
28362
28362
|
if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
|
|
28363
|
-
const next =
|
|
28363
|
+
const next = text2[i2 + 1];
|
|
28364
28364
|
if (next && next !== " " && next !== "\n" && next !== " ")
|
|
28365
28365
|
split = i2;
|
|
28366
28366
|
}
|
|
@@ -28372,12 +28372,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
28372
28372
|
} else if (mode === FOLD_QUOTED) {
|
|
28373
28373
|
while (prev === " " || prev === " ") {
|
|
28374
28374
|
prev = ch;
|
|
28375
|
-
ch =
|
|
28375
|
+
ch = text2[i2 += 1];
|
|
28376
28376
|
overflow = true;
|
|
28377
28377
|
}
|
|
28378
28378
|
const j = i2 > escEnd + 1 ? i2 - 2 : escStart - 1;
|
|
28379
28379
|
if (escapedFolds[j])
|
|
28380
|
-
return
|
|
28380
|
+
return text2;
|
|
28381
28381
|
folds.push(j);
|
|
28382
28382
|
escapedFolds[j] = true;
|
|
28383
28383
|
end = j + endStep;
|
|
@@ -28392,39 +28392,39 @@ var require_foldFlowLines = __commonJS({
|
|
|
28392
28392
|
if (overflow && onOverflow)
|
|
28393
28393
|
onOverflow();
|
|
28394
28394
|
if (folds.length === 0)
|
|
28395
|
-
return
|
|
28395
|
+
return text2;
|
|
28396
28396
|
if (onFold)
|
|
28397
28397
|
onFold();
|
|
28398
|
-
let res =
|
|
28398
|
+
let res = text2.slice(0, folds[0]);
|
|
28399
28399
|
for (let i3 = 0; i3 < folds.length; ++i3) {
|
|
28400
28400
|
const fold = folds[i3];
|
|
28401
|
-
const end2 = folds[i3 + 1] ||
|
|
28401
|
+
const end2 = folds[i3 + 1] || text2.length;
|
|
28402
28402
|
if (fold === 0)
|
|
28403
28403
|
res = `
|
|
28404
|
-
${indent}${
|
|
28404
|
+
${indent}${text2.slice(0, end2)}`;
|
|
28405
28405
|
else {
|
|
28406
28406
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
28407
|
-
res += `${
|
|
28407
|
+
res += `${text2[fold]}\\`;
|
|
28408
28408
|
res += `
|
|
28409
|
-
${indent}${
|
|
28409
|
+
${indent}${text2.slice(fold + 1, end2)}`;
|
|
28410
28410
|
}
|
|
28411
28411
|
}
|
|
28412
28412
|
return res;
|
|
28413
28413
|
}
|
|
28414
|
-
function consumeMoreIndentedLines(
|
|
28414
|
+
function consumeMoreIndentedLines(text2, i2, indent) {
|
|
28415
28415
|
let end = i2;
|
|
28416
28416
|
let start2 = i2 + 1;
|
|
28417
|
-
let ch =
|
|
28417
|
+
let ch = text2[start2];
|
|
28418
28418
|
while (ch === " " || ch === " ") {
|
|
28419
28419
|
if (i2 < start2 + indent) {
|
|
28420
|
-
ch =
|
|
28420
|
+
ch = text2[++i2];
|
|
28421
28421
|
} else {
|
|
28422
28422
|
do {
|
|
28423
|
-
ch =
|
|
28423
|
+
ch = text2[++i2];
|
|
28424
28424
|
} while (ch && ch !== "\n");
|
|
28425
28425
|
end = i2;
|
|
28426
28426
|
start2 = i2 + 1;
|
|
28427
|
-
ch =
|
|
28427
|
+
ch = text2[start2];
|
|
28428
28428
|
}
|
|
28429
28429
|
}
|
|
28430
28430
|
return end;
|
|
@@ -34671,7 +34671,7 @@ var require_dist = __commonJS({
|
|
|
34671
34671
|
});
|
|
34672
34672
|
|
|
34673
34673
|
// src/assets.ts
|
|
34674
|
-
import { basename as basename5, join as
|
|
34674
|
+
import { basename as basename5, join as join32, resolve as resolve17 } from "node:path";
|
|
34675
34675
|
import { fileURLToPath } from "node:url";
|
|
34676
34676
|
function packageRoot(env = process.env) {
|
|
34677
34677
|
const override = env["MVRX_PACKAGE_ROOT"];
|
|
@@ -34680,16 +34680,16 @@ function packageRoot(env = process.env) {
|
|
|
34680
34680
|
}
|
|
34681
34681
|
function assetDir(env = process.env) {
|
|
34682
34682
|
const override = env["MVRX_ASSET_DIR"];
|
|
34683
|
-
return override !== void 0 && override !== "" ? override :
|
|
34683
|
+
return override !== void 0 && override !== "" ? override : join32(packageRoot(env), "assets");
|
|
34684
34684
|
}
|
|
34685
34685
|
function assetFile(name2) {
|
|
34686
|
-
return
|
|
34686
|
+
return join32(assetDir(), basename5(name2));
|
|
34687
34687
|
}
|
|
34688
34688
|
var VERSION;
|
|
34689
34689
|
var init_assets = __esm({
|
|
34690
34690
|
"src/assets.ts"() {
|
|
34691
34691
|
"use strict";
|
|
34692
|
-
VERSION = true ? "0.1.
|
|
34692
|
+
VERSION = true ? "0.1.145" : "0.0.0-dev";
|
|
34693
34693
|
}
|
|
34694
34694
|
});
|
|
34695
34695
|
|
|
@@ -35072,7 +35072,7 @@ var init_unsafe = __esm({
|
|
|
35072
35072
|
});
|
|
35073
35073
|
|
|
35074
35074
|
// ../../node_modules/.pnpm/@bufbuild+protobuf@2.16.0/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js
|
|
35075
|
-
function
|
|
35075
|
+
function isObject3(arg4) {
|
|
35076
35076
|
return arg4 !== null && typeof arg4 == "object" && !Array.isArray(arg4);
|
|
35077
35077
|
}
|
|
35078
35078
|
var init_guard = __esm({
|
|
@@ -35147,7 +35147,7 @@ function compileCreate(desc) {
|
|
|
35147
35147
|
message[name2] = property.convert !== void 0 && Array.isArray(initValue) ? initValue.map(property.convert) : initValue !== null && initValue !== void 0 ? initValue : [];
|
|
35148
35148
|
break;
|
|
35149
35149
|
case INIT_MAP:
|
|
35150
|
-
if (property.convert === void 0 || !
|
|
35150
|
+
if (property.convert === void 0 || !isObject3(initValue)) {
|
|
35151
35151
|
message[name2] = initValue !== null && initValue !== void 0 ? initValue : {};
|
|
35152
35152
|
} else {
|
|
35153
35153
|
const converted = {};
|
|
@@ -35265,7 +35265,7 @@ function compileConvertMessage(field2) {
|
|
|
35265
35265
|
const messageDesc2 = field2.message;
|
|
35266
35266
|
let compiled;
|
|
35267
35267
|
return (value) => {
|
|
35268
|
-
if (!
|
|
35268
|
+
if (!isObject3(value) || isMessage(value, messageDesc2)) {
|
|
35269
35269
|
return value;
|
|
35270
35270
|
}
|
|
35271
35271
|
compiled !== null && compiled !== void 0 ? compiled : compiled = compiledCreate(messageDesc2);
|
|
@@ -35327,8 +35327,8 @@ function getTextEncoding() {
|
|
|
35327
35327
|
const textDecoder = new globals.TextDecoder();
|
|
35328
35328
|
let textDecoderStrict;
|
|
35329
35329
|
const config2 = {
|
|
35330
|
-
encodeUtf8(
|
|
35331
|
-
return textEncoder.encode(
|
|
35330
|
+
encodeUtf8(text2) {
|
|
35331
|
+
return textEncoder.encode(text2);
|
|
35332
35332
|
},
|
|
35333
35333
|
decodeUtf8(bytes, strict) {
|
|
35334
35334
|
if (strict) {
|
|
@@ -35341,9 +35341,9 @@ function getTextEncoding() {
|
|
|
35341
35341
|
}
|
|
35342
35342
|
return textDecoder.decode(bytes);
|
|
35343
35343
|
},
|
|
35344
|
-
checkUtf8(
|
|
35344
|
+
checkUtf8(text2) {
|
|
35345
35345
|
try {
|
|
35346
|
-
encodeURIComponent(
|
|
35346
|
+
encodeURIComponent(text2);
|
|
35347
35347
|
return true;
|
|
35348
35348
|
} catch (_) {
|
|
35349
35349
|
return false;
|
|
@@ -35355,8 +35355,8 @@ function getTextEncoding() {
|
|
|
35355
35355
|
}
|
|
35356
35356
|
const nativeStringIsWellFormed = String.prototype.isWellFormed;
|
|
35357
35357
|
if (nativeStringIsWellFormed) {
|
|
35358
|
-
config2.checkUtf8 = (
|
|
35359
|
-
return nativeStringIsWellFormed.call(
|
|
35358
|
+
config2.checkUtf8 = (text2) => {
|
|
35359
|
+
return nativeStringIsWellFormed.call(text2);
|
|
35360
35360
|
};
|
|
35361
35361
|
}
|
|
35362
35362
|
configureTextEncoding(config2);
|
|
@@ -35364,8 +35364,8 @@ function getTextEncoding() {
|
|
|
35364
35364
|
return te;
|
|
35365
35365
|
}
|
|
35366
35366
|
function emulateEncodeInto(encodeUtf8) {
|
|
35367
|
-
return (
|
|
35368
|
-
const bytes = encodeUtf8(
|
|
35367
|
+
return (text2, dest) => {
|
|
35368
|
+
const bytes = encodeUtf8(text2);
|
|
35369
35369
|
dest.set(bytes);
|
|
35370
35370
|
return { written: bytes.byteLength };
|
|
35371
35371
|
};
|
|
@@ -35633,7 +35633,7 @@ function wktStructToReflect(json2) {
|
|
|
35633
35633
|
$typeName: "google.protobuf.Struct",
|
|
35634
35634
|
fields: {}
|
|
35635
35635
|
};
|
|
35636
|
-
if (
|
|
35636
|
+
if (isObject3(json2)) {
|
|
35637
35637
|
for (const k of Object.keys(json2)) {
|
|
35638
35638
|
setOwn(struct.fields, k, wktValueToReflect(json2[k]));
|
|
35639
35639
|
}
|
|
@@ -38035,22 +38035,22 @@ function parseScipSymbol(symbol2) {
|
|
|
38035
38035
|
}
|
|
38036
38036
|
return parseDescriptors(symbol2.slice(index));
|
|
38037
38037
|
}
|
|
38038
|
-
function parseDescriptors(
|
|
38038
|
+
function parseDescriptors(text2) {
|
|
38039
38039
|
const out2 = [];
|
|
38040
38040
|
let i2 = 0;
|
|
38041
|
-
while (i2 <
|
|
38042
|
-
const ch =
|
|
38041
|
+
while (i2 < text2.length) {
|
|
38042
|
+
const ch = text2[i2];
|
|
38043
38043
|
if (ch === "[") {
|
|
38044
|
-
const end =
|
|
38044
|
+
const end = text2.indexOf("]", i2);
|
|
38045
38045
|
if (end < 0) return null;
|
|
38046
|
-
out2.push({ name:
|
|
38046
|
+
out2.push({ name: text2.slice(i2 + 1, end), suffix: "typeParameter" });
|
|
38047
38047
|
i2 = end + 1;
|
|
38048
38048
|
continue;
|
|
38049
38049
|
}
|
|
38050
38050
|
if (ch === "(") {
|
|
38051
|
-
const end =
|
|
38051
|
+
const end = text2.indexOf(")", i2);
|
|
38052
38052
|
if (end < 0) return null;
|
|
38053
|
-
out2.push({ name:
|
|
38053
|
+
out2.push({ name: text2.slice(i2 + 1, end), suffix: "parameter" });
|
|
38054
38054
|
i2 = end + 1;
|
|
38055
38055
|
continue;
|
|
38056
38056
|
}
|
|
@@ -38058,9 +38058,9 @@ function parseDescriptors(text) {
|
|
|
38058
38058
|
if (ch === "`") {
|
|
38059
38059
|
i2 += 1;
|
|
38060
38060
|
for (; ; ) {
|
|
38061
|
-
if (i2 >=
|
|
38062
|
-
if (
|
|
38063
|
-
if (
|
|
38061
|
+
if (i2 >= text2.length) return null;
|
|
38062
|
+
if (text2[i2] === "`") {
|
|
38063
|
+
if (text2[i2 + 1] === "`") {
|
|
38064
38064
|
name2 += "`";
|
|
38065
38065
|
i2 += 2;
|
|
38066
38066
|
continue;
|
|
@@ -38068,17 +38068,17 @@ function parseDescriptors(text) {
|
|
|
38068
38068
|
i2 += 1;
|
|
38069
38069
|
break;
|
|
38070
38070
|
}
|
|
38071
|
-
name2 +=
|
|
38071
|
+
name2 += text2[i2];
|
|
38072
38072
|
i2 += 1;
|
|
38073
38073
|
}
|
|
38074
38074
|
} else {
|
|
38075
|
-
while (i2 <
|
|
38076
|
-
name2 +=
|
|
38075
|
+
while (i2 < text2.length && SIMPLE_IDENTIFIER.test(text2[i2] ?? "")) {
|
|
38076
|
+
name2 += text2[i2];
|
|
38077
38077
|
i2 += 1;
|
|
38078
38078
|
}
|
|
38079
38079
|
if (name2 === "") return null;
|
|
38080
38080
|
}
|
|
38081
|
-
const suffix =
|
|
38081
|
+
const suffix = text2[i2];
|
|
38082
38082
|
i2 += 1;
|
|
38083
38083
|
switch (suffix) {
|
|
38084
38084
|
case "/":
|
|
@@ -38097,7 +38097,7 @@ function parseDescriptors(text) {
|
|
|
38097
38097
|
out2.push({ name: name2, suffix: "macro" });
|
|
38098
38098
|
break;
|
|
38099
38099
|
case "(": {
|
|
38100
|
-
const end =
|
|
38100
|
+
const end = text2.indexOf(").", i2);
|
|
38101
38101
|
if (end < 0) return null;
|
|
38102
38102
|
out2.push({ name: name2, suffix: "method" });
|
|
38103
38103
|
i2 = end + 2;
|
|
@@ -40152,11 +40152,11 @@ function parseMatchPredicate(steps, index, operator, textPredicates) {
|
|
|
40152
40152
|
for (const c2 of captures) {
|
|
40153
40153
|
if (c2.name === captureName) nodes.push(c2.node.text);
|
|
40154
40154
|
}
|
|
40155
|
-
const test = /* @__PURE__ */ __name((
|
|
40156
|
-
return positive2 ? regex.test(
|
|
40155
|
+
const test = /* @__PURE__ */ __name((text2, positive2) => {
|
|
40156
|
+
return positive2 ? regex.test(text2) : !regex.test(text2);
|
|
40157
40157
|
}, "test");
|
|
40158
40158
|
if (nodes.length === 0) return !isPositive;
|
|
40159
|
-
return matchAll ? nodes.every((
|
|
40159
|
+
return matchAll ? nodes.every((text2) => test(text2, isPositive)) : nodes.some((text2) => test(text2, isPositive));
|
|
40160
40160
|
});
|
|
40161
40161
|
}
|
|
40162
40162
|
function parseAnyOfPredicate(steps, index, operator, textPredicates) {
|
|
@@ -40185,7 +40185,7 @@ function parseAnyOfPredicate(steps, index, operator, textPredicates) {
|
|
|
40185
40185
|
if (c2.name === captureName) nodes.push(c2.node.text);
|
|
40186
40186
|
}
|
|
40187
40187
|
if (nodes.length === 0) return !isPositive;
|
|
40188
|
-
return nodes.every((
|
|
40188
|
+
return nodes.every((text2) => values.includes(text2)) === isPositive;
|
|
40189
40189
|
});
|
|
40190
40190
|
}
|
|
40191
40191
|
function parseIsPredicate(steps, index, operator, assertedProperties, refutedProperties) {
|
|
@@ -42633,7 +42633,7 @@ var init_treesitter = __esm({
|
|
|
42633
42633
|
import { execFile as execFile2 } from "node:child_process";
|
|
42634
42634
|
import { createHash as createHash6 } from "node:crypto";
|
|
42635
42635
|
import { lstat, readFile as readFile4 } from "node:fs/promises";
|
|
42636
|
-
import { join as
|
|
42636
|
+
import { join as join33 } from "node:path";
|
|
42637
42637
|
import { promisify } from "node:util";
|
|
42638
42638
|
function shardKeyOf(shard) {
|
|
42639
42639
|
return `sha256:${sha256Hex2(Buffer.from(`${shard.path}\0${shard.contentHash}\0${shard.precision}`, "utf8"))}`;
|
|
@@ -42660,7 +42660,7 @@ async function mapLimit(items, limit, task) {
|
|
|
42660
42660
|
return results;
|
|
42661
42661
|
}
|
|
42662
42662
|
async function hashRegularFile(repoRoot, path) {
|
|
42663
|
-
const absolute =
|
|
42663
|
+
const absolute = join33(repoRoot, path);
|
|
42664
42664
|
try {
|
|
42665
42665
|
const stats = await lstat(absolute);
|
|
42666
42666
|
if (!stats.isFile()) return null;
|
|
@@ -42698,7 +42698,7 @@ async function buildSnapshot(options) {
|
|
|
42698
42698
|
const needParse = [...hashes.keys()].filter((path) => !byPath.has(path));
|
|
42699
42699
|
const parsed = await mapLimit(needParse, 8, async (path) => {
|
|
42700
42700
|
if (languageForPath(path) === null) return { path, shard: null };
|
|
42701
|
-
const bytes = await readFile4(
|
|
42701
|
+
const bytes = await readFile4(join33(options.repoRoot, path));
|
|
42702
42702
|
if (bytes.byteLength > MAX_PARSE_BYTES) return { path, shard: null };
|
|
42703
42703
|
const hash2 = `sha256:${sha256Hex2(bytes)}`;
|
|
42704
42704
|
if (hash2 !== hashes.get(path)) throw new Error(`${path} changed while the snapshot was being built`);
|
|
@@ -42772,9 +42772,9 @@ async function uploadSnapshot(options) {
|
|
|
42772
42772
|
if (response.ok) return response;
|
|
42773
42773
|
const retryable = response.status === 429 || response.status >= 500;
|
|
42774
42774
|
if (!retryable || attempt2 >= ATTEMPTS) {
|
|
42775
|
-
const
|
|
42776
|
-
const hint = refusalHint(response.status,
|
|
42777
|
-
throw new HttpError(`POST ${path} failed with status ${response.status}: ${
|
|
42775
|
+
const text2 = await response.text();
|
|
42776
|
+
const hint = refusalHint(response.status, text2);
|
|
42777
|
+
throw new HttpError(`POST ${path} failed with status ${response.status}: ${text2.slice(0, 300)}${hint === null ? "" : `
|
|
42778
42778
|
${hint}`}`);
|
|
42779
42779
|
}
|
|
42780
42780
|
failure4 = `status ${response.status}`;
|
|
@@ -42860,8 +42860,8 @@ var init_oidc = __esm({
|
|
|
42860
42860
|
});
|
|
42861
42861
|
|
|
42862
42862
|
// ../index-builder/src/rank.ts
|
|
42863
|
-
function wordsOf(
|
|
42864
|
-
const parts2 =
|
|
42863
|
+
function wordsOf(text2) {
|
|
42864
|
+
const parts2 = text2.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[^A-Za-z0-9]+/);
|
|
42865
42865
|
const out2 = [];
|
|
42866
42866
|
for (const part of parts2) {
|
|
42867
42867
|
let word = part.toLowerCase();
|
|
@@ -43090,9 +43090,9 @@ function buildCodeMap(index, task, options = DEFAULT_MAP_OPTIONS) {
|
|
|
43090
43090
|
related.push(line3);
|
|
43091
43091
|
}
|
|
43092
43092
|
if (related.length > 0) lines.push("", taskFree ? "Central files:" : "Related files:", ...related);
|
|
43093
|
-
const
|
|
43093
|
+
const text2 = `${lines.join("\n")}
|
|
43094
43094
|
`;
|
|
43095
|
-
return { lines, text, estimatedTokens: estimateTokens(
|
|
43095
|
+
return { lines, text: text2, estimatedTokens: estimateTokens(text2), seeds: seeds.map((seed) => seed.qualified), files: index.files, symbols: index.symbols.size };
|
|
43096
43096
|
}
|
|
43097
43097
|
function buildCodeMapDigest(input2) {
|
|
43098
43098
|
const map2 = buildCodeMap(input2.index, input2.task ?? "", input2.options ?? DEFAULT_MAP_OPTIONS);
|
|
@@ -43133,8 +43133,8 @@ var init_rank = __esm({
|
|
|
43133
43133
|
});
|
|
43134
43134
|
|
|
43135
43135
|
// ../index-builder/src/context-map.ts
|
|
43136
|
-
function stripNoise(
|
|
43137
|
-
return
|
|
43136
|
+
function stripNoise(text2) {
|
|
43137
|
+
return text2.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/\/\/[^\n]*/g, " ").replace(/"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|`(?:[^`\\]|\\.)*`/g, '""');
|
|
43138
43138
|
}
|
|
43139
43139
|
function resolveImport(from, spec) {
|
|
43140
43140
|
if (!spec.startsWith(".")) return null;
|
|
@@ -43198,10 +43198,10 @@ async function buildRepoIndex(files) {
|
|
|
43198
43198
|
if (!CALLABLE.has(entry.kind)) continue;
|
|
43199
43199
|
const range = ranges.get(entry.id)?.enclosingRange;
|
|
43200
43200
|
if (range === void 0) continue;
|
|
43201
|
-
const
|
|
43201
|
+
const text2 = stripNoise(files.get(entry.path).split("\n").slice(range[0], range[2] + 1).join("\n"));
|
|
43202
43202
|
const visible = imports.get(entry.path) ?? /* @__PURE__ */ new Set();
|
|
43203
43203
|
const seen = /* @__PURE__ */ new Set();
|
|
43204
|
-
for (const match of
|
|
43204
|
+
for (const match of text2.matchAll(/[A-Za-z_$][\w$]*/g)) {
|
|
43205
43205
|
const id2 = match[0];
|
|
43206
43206
|
if (KEYWORDS.has(id2) || seen.has(id2)) continue;
|
|
43207
43207
|
seen.add(id2);
|
|
@@ -43254,7 +43254,7 @@ var init_context_map = __esm({
|
|
|
43254
43254
|
// ../index-builder/src/context-map-build.ts
|
|
43255
43255
|
import { execFile as execFile3 } from "node:child_process";
|
|
43256
43256
|
import { mkdir as mkdir3, readFile as readFile5, writeFile as writeFile3 } from "node:fs/promises";
|
|
43257
|
-
import { dirname as dirname11, join as
|
|
43257
|
+
import { dirname as dirname11, join as join34 } from "node:path";
|
|
43258
43258
|
import { promisify as promisify2 } from "node:util";
|
|
43259
43259
|
async function git5(root, args2) {
|
|
43260
43260
|
const { stdout } = await execFileAsync2("git", args2, { cwd: root, encoding: "utf8", maxBuffer: 256 * 1024 * 1024 });
|
|
@@ -43267,7 +43267,7 @@ async function buildArtifactsForCheckout(options) {
|
|
|
43267
43267
|
for (const path of tracked) {
|
|
43268
43268
|
if (languageForPath(path) === null) continue;
|
|
43269
43269
|
try {
|
|
43270
|
-
const bytes = await readFile5(
|
|
43270
|
+
const bytes = await readFile5(join34(options.root, path));
|
|
43271
43271
|
if (bytes.byteLength > MAX_PARSE_BYTES) {
|
|
43272
43272
|
uncovered += 1;
|
|
43273
43273
|
continue;
|
|
@@ -43291,14 +43291,14 @@ async function buildArtifactsForCheckout(options) {
|
|
|
43291
43291
|
return { digest, indexFile };
|
|
43292
43292
|
}
|
|
43293
43293
|
async function writeIndexFile(root, indexFile) {
|
|
43294
|
-
const path =
|
|
43294
|
+
const path = join34(root, CODE_INDEX_PATH);
|
|
43295
43295
|
await mkdir3(dirname11(path), { recursive: true });
|
|
43296
43296
|
await writeFile3(path, `${JSON.stringify(indexFile)}
|
|
43297
43297
|
`);
|
|
43298
43298
|
return path;
|
|
43299
43299
|
}
|
|
43300
43300
|
async function writeDigest(root, digest, out2) {
|
|
43301
|
-
const path = out2 ??
|
|
43301
|
+
const path = out2 ?? join34(root, CODE_MAP_DIGEST_PATH);
|
|
43302
43302
|
await mkdir3(dirname11(path), { recursive: true });
|
|
43303
43303
|
await writeFile3(path, `${JSON.stringify(digest)}
|
|
43304
43304
|
`);
|
|
@@ -43319,7 +43319,7 @@ var init_context_map_build = __esm({
|
|
|
43319
43319
|
// ../index-builder/src/run.ts
|
|
43320
43320
|
import { execFile as execFile4 } from "node:child_process";
|
|
43321
43321
|
import { mkdir as mkdir4, readdir as readdir4, rm as rm2, writeFile as writeFile4 } from "node:fs/promises";
|
|
43322
|
-
import { join as
|
|
43322
|
+
import { join as join35, resolve as resolve18 } from "node:path";
|
|
43323
43323
|
import { parseArgs as parseArgs2 } from "node:util";
|
|
43324
43324
|
import { promisify as promisify3 } from "node:util";
|
|
43325
43325
|
function originOf(url2) {
|
|
@@ -43410,13 +43410,13 @@ ${USAGE}`);
|
|
|
43410
43410
|
}
|
|
43411
43411
|
}
|
|
43412
43412
|
async function writeSnapshot(dir, built) {
|
|
43413
|
-
await mkdir4(
|
|
43414
|
-
for (const name2 of await readdir4(
|
|
43415
|
-
await writeFile4(
|
|
43416
|
-
await writeFile4(
|
|
43413
|
+
await mkdir4(join35(dir, "shards"), { recursive: true });
|
|
43414
|
+
for (const name2 of await readdir4(join35(dir, "shards"))) await rm2(join35(dir, "shards", name2));
|
|
43415
|
+
await writeFile4(join35(dir, "manifest.json"), JSON.stringify(built.manifest, null, 2));
|
|
43416
|
+
await writeFile4(join35(dir, "uncovered.json"), JSON.stringify(built.uncovered, null, 2));
|
|
43417
43417
|
for (const shard of built.shards) {
|
|
43418
43418
|
const name2 = shardKeyOf(shard).slice("sha256:".length);
|
|
43419
|
-
await writeFile4(
|
|
43419
|
+
await writeFile4(join35(dir, "shards", `${name2}.json`), JSON.stringify(shard));
|
|
43420
43420
|
}
|
|
43421
43421
|
}
|
|
43422
43422
|
var execFileAsync3, USAGE, UsageError2, OPTIONS;
|
|
@@ -51126,7 +51126,7 @@ var init_ajvProvider_CEoC_sr = __esm({
|
|
|
51126
51126
|
const schId = normalizeId(schema[schemaId] || baseId);
|
|
51127
51127
|
const baseIds = { "": schId };
|
|
51128
51128
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
51129
|
-
const
|
|
51129
|
+
const localRefs2 = {};
|
|
51130
51130
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
51131
51131
|
traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
|
|
51132
51132
|
if (parentJsonPtr === void 0) return;
|
|
@@ -51145,8 +51145,8 @@ var init_ajvProvider_CEoC_sr = __esm({
|
|
|
51145
51145
|
if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef];
|
|
51146
51146
|
if (typeof schOrRef == "object") checkAmbiguosRef(sch, schOrRef.schema, ref);
|
|
51147
51147
|
else if (ref !== normalizeId(fullPath)) if (ref[0] === "#") {
|
|
51148
|
-
checkAmbiguosRef(sch,
|
|
51149
|
-
|
|
51148
|
+
checkAmbiguosRef(sch, localRefs2[ref], ref);
|
|
51149
|
+
localRefs2[ref] = sch;
|
|
51150
51150
|
} else this.refs[ref] = fullPath;
|
|
51151
51151
|
return ref;
|
|
51152
51152
|
}
|
|
@@ -51157,7 +51157,7 @@ var init_ajvProvider_CEoC_sr = __esm({
|
|
|
51157
51157
|
}
|
|
51158
51158
|
}
|
|
51159
51159
|
});
|
|
51160
|
-
return
|
|
51160
|
+
return localRefs2;
|
|
51161
51161
|
function checkAmbiguosRef(sch1, sch2, ref) {
|
|
51162
51162
|
if (sch2 !== void 0 && !equal(sch1, sch2)) throw ambiguos(ref);
|
|
51163
51163
|
}
|
|
@@ -52773,7 +52773,7 @@ var init_ajvProvider_CEoC_sr = __esm({
|
|
|
52773
52773
|
}
|
|
52774
52774
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
52775
52775
|
if (!errors || errors.length === 0) return "No errors";
|
|
52776
|
-
return errors.map((e2) => `${dataVar}${e2.instancePath} ${e2.message}`).reduce((
|
|
52776
|
+
return errors.map((e2) => `${dataVar}${e2.instancePath} ${e2.message}`).reduce((text2, msg) => text2 + separator + msg);
|
|
52777
52777
|
}
|
|
52778
52778
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
52779
52779
|
const rules = this.RULES.all;
|
|
@@ -52813,13 +52813,13 @@ var init_ajvProvider_CEoC_sr = __esm({
|
|
|
52813
52813
|
let sch = this._cache.get(schema);
|
|
52814
52814
|
if (sch !== void 0) return sch;
|
|
52815
52815
|
baseId = (0, resolve_1.normalizeId)(id2 || baseId);
|
|
52816
|
-
const
|
|
52816
|
+
const localRefs2 = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
52817
52817
|
sch = new compile_1.SchemaEnv({
|
|
52818
52818
|
schema,
|
|
52819
52819
|
schemaId,
|
|
52820
52820
|
meta: meta3,
|
|
52821
52821
|
baseId,
|
|
52822
|
-
localRefs
|
|
52822
|
+
localRefs: localRefs2
|
|
52823
52823
|
});
|
|
52824
52824
|
this._cache.set(sch.schema, sch);
|
|
52825
52825
|
if (addSchema && !baseId.startsWith("#")) {
|
|
@@ -54710,14 +54710,14 @@ var init_ajvProvider_CEoC_sr = __esm({
|
|
|
54710
54710
|
exports.dynamicAnchor = dynamicAnchor;
|
|
54711
54711
|
function _getValidate(cxt) {
|
|
54712
54712
|
const { schemaEnv, schema, self } = cxt.it;
|
|
54713
|
-
const { root, baseId, localRefs, meta: meta3 } = schemaEnv.root;
|
|
54713
|
+
const { root, baseId, localRefs: localRefs2, meta: meta3 } = schemaEnv.root;
|
|
54714
54714
|
const { schemaId } = self.opts;
|
|
54715
54715
|
const sch = new compile_1.SchemaEnv({
|
|
54716
54716
|
schema,
|
|
54717
54717
|
schemaId,
|
|
54718
54718
|
root,
|
|
54719
54719
|
baseId,
|
|
54720
|
-
localRefs,
|
|
54720
|
+
localRefs: localRefs2,
|
|
54721
54721
|
meta: meta3
|
|
54722
54722
|
});
|
|
54723
54723
|
compile_1.compileSchema.call(self, sch);
|
|
@@ -58261,12 +58261,12 @@ var init_cloud = __esm({
|
|
|
58261
58261
|
});
|
|
58262
58262
|
|
|
58263
58263
|
// ../code-shim/src/git.ts
|
|
58264
|
-
import { execFileSync } from "node:child_process";
|
|
58264
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
58265
58265
|
import { existsSync as existsSync14 } from "node:fs";
|
|
58266
|
-
import { join as
|
|
58266
|
+
import { join as join39 } from "node:path";
|
|
58267
58267
|
function git7(root, args2) {
|
|
58268
58268
|
try {
|
|
58269
|
-
return
|
|
58269
|
+
return execFileSync2("git", args2, { cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 64 * 1024 * 1024, timeout: 1e4 });
|
|
58270
58270
|
} catch {
|
|
58271
58271
|
return null;
|
|
58272
58272
|
}
|
|
@@ -58325,7 +58325,7 @@ function readWorkingCopyState(root) {
|
|
|
58325
58325
|
const head = headCommit2(root);
|
|
58326
58326
|
const raw = git7(root, ["status", "--porcelain=v2", "-z", "--untracked-files=all"]);
|
|
58327
58327
|
if (raw === null) return { head, dirty: /* @__PURE__ */ new Set(), deleted: /* @__PURE__ */ new Set(), renamed: /* @__PURE__ */ new Map() };
|
|
58328
|
-
return { head, ...parseStatus(raw, (path) => existsSync14(
|
|
58328
|
+
return { head, ...parseStatus(raw, (path) => existsSync14(join39(root, path))) };
|
|
58329
58329
|
}
|
|
58330
58330
|
var init_git2 = __esm({
|
|
58331
58331
|
"../code-shim/src/git.ts"() {
|
|
@@ -58334,18 +58334,18 @@ var init_git2 = __esm({
|
|
|
58334
58334
|
});
|
|
58335
58335
|
|
|
58336
58336
|
// ../code-shim/src/config.ts
|
|
58337
|
-
import { readFileSync as
|
|
58338
|
-
import { homedir as
|
|
58339
|
-
import { join as
|
|
58340
|
-
function
|
|
58341
|
-
const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ??
|
|
58342
|
-
return
|
|
58337
|
+
import { readFileSync as readFileSync22 } from "node:fs";
|
|
58338
|
+
import { homedir as homedir3 } from "node:os";
|
|
58339
|
+
import { join as join40 } from "node:path";
|
|
58340
|
+
function configDir2(env) {
|
|
58341
|
+
const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join40(homedir3(), ".config");
|
|
58342
|
+
return join40(base5, "mvrx-harness");
|
|
58343
58343
|
}
|
|
58344
58344
|
function findToken2(env, serviceUrl, now) {
|
|
58345
58345
|
const fromEnv = env["HARNESS_TOKEN"];
|
|
58346
58346
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
58347
58347
|
try {
|
|
58348
|
-
const file2 = JSON.parse(
|
|
58348
|
+
const file2 = JSON.parse(readFileSync22(join40(configDir2(env), "credentials.json"), "utf8"));
|
|
58349
58349
|
const stored = file2[serviceUrl];
|
|
58350
58350
|
if (stored === void 0 || typeof stored.accessToken !== "string" || stored.accessToken.length === 0) return null;
|
|
58351
58351
|
if (typeof stored.expiresAt === "number" && stored.expiresAt <= now) return null;
|
|
@@ -58357,7 +58357,7 @@ function findToken2(env, serviceUrl, now) {
|
|
|
58357
58357
|
function resolveCloudConfig(root, env, now) {
|
|
58358
58358
|
let binding;
|
|
58359
58359
|
try {
|
|
58360
|
-
const parsed = ProjectBinding.safeParse(JSON.parse(
|
|
58360
|
+
const parsed = ProjectBinding.safeParse(JSON.parse(readFileSync22(join40(root, ".harness", "project.json"), "utf8")));
|
|
58361
58361
|
if (!parsed.success) return null;
|
|
58362
58362
|
binding = parsed.data;
|
|
58363
58363
|
} catch {
|
|
@@ -58379,7 +58379,7 @@ var init_config = __esm({
|
|
|
58379
58379
|
});
|
|
58380
58380
|
|
|
58381
58381
|
// ../code-shim/src/local.ts
|
|
58382
|
-
import { readFileSync as
|
|
58382
|
+
import { readFileSync as readFileSync23, statSync as statSync4 } from "node:fs";
|
|
58383
58383
|
import { isAbsolute as isAbsolute2, relative as relative5, resolve as resolve19, sep as sep2 } from "node:path";
|
|
58384
58384
|
function resolveInside(root, path) {
|
|
58385
58385
|
const absolute = resolve19(root, path);
|
|
@@ -58499,7 +58499,7 @@ var init_local = __esm({
|
|
|
58499
58499
|
let shard;
|
|
58500
58500
|
try {
|
|
58501
58501
|
this.parses += 1;
|
|
58502
|
-
shard = await this.parse(path,
|
|
58502
|
+
shard = await this.parse(path, readFileSync23(absolute, "utf8"));
|
|
58503
58503
|
} catch {
|
|
58504
58504
|
shard = null;
|
|
58505
58505
|
}
|
|
@@ -58511,7 +58511,7 @@ var init_local = __esm({
|
|
|
58511
58511
|
const absolute = resolveInside(this.root, path);
|
|
58512
58512
|
if (absolute === null) return null;
|
|
58513
58513
|
try {
|
|
58514
|
-
return
|
|
58514
|
+
return readFileSync23(absolute, "utf8");
|
|
58515
58515
|
} catch {
|
|
58516
58516
|
return null;
|
|
58517
58517
|
}
|
|
@@ -58521,7 +58521,7 @@ var init_local = __esm({
|
|
|
58521
58521
|
const absolute = resolveInside(this.root, path);
|
|
58522
58522
|
if (absolute === null) return void 0;
|
|
58523
58523
|
try {
|
|
58524
|
-
const lines =
|
|
58524
|
+
const lines = readFileSync23(absolute, "utf8").split("\n");
|
|
58525
58525
|
const start2 = range[0];
|
|
58526
58526
|
if (start2 >= lines.length) return void 0;
|
|
58527
58527
|
const end = Math.min(Math.max(range[2], start2), start2 + maxLines - 1, lines.length - 1);
|
|
@@ -58748,26 +58748,26 @@ var init_nav = __esm({
|
|
|
58748
58748
|
|
|
58749
58749
|
// ../code-shim/src/edit.ts
|
|
58750
58750
|
import { createHash as createHash8 } from "node:crypto";
|
|
58751
|
-
import { readFileSync as
|
|
58752
|
-
function lineStarts(
|
|
58751
|
+
import { readFileSync as readFileSync24, writeFileSync as writeFileSync11 } from "node:fs";
|
|
58752
|
+
function lineStarts(text2) {
|
|
58753
58753
|
const starts = [0];
|
|
58754
|
-
for (let i2 = 0; i2 <
|
|
58754
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) if (text2[i2] === "\n") starts.push(i2 + 1);
|
|
58755
58755
|
return starts;
|
|
58756
58756
|
}
|
|
58757
|
-
function offsetOf(starts,
|
|
58757
|
+
function offsetOf(starts, text2, line3, character) {
|
|
58758
58758
|
const start2 = starts[line3];
|
|
58759
58759
|
if (start2 === void 0) return null;
|
|
58760
|
-
const next = starts[line3 + 1] ??
|
|
58760
|
+
const next = starts[line3 + 1] ?? text2.length + 1;
|
|
58761
58761
|
return Math.min(start2 + character, next - 1);
|
|
58762
58762
|
}
|
|
58763
|
-
function positionAt(
|
|
58764
|
-
const starts = lineStarts(
|
|
58763
|
+
function positionAt(text2, offset) {
|
|
58764
|
+
const starts = lineStarts(text2.slice(0, offset));
|
|
58765
58765
|
const line3 = starts.length - 1;
|
|
58766
58766
|
return [line3, offset - (starts[line3] ?? 0)];
|
|
58767
58767
|
}
|
|
58768
|
-
function lineEnd(starts,
|
|
58768
|
+
function lineEnd(starts, text2, line3) {
|
|
58769
58769
|
const next = starts[line3 + 1];
|
|
58770
|
-
return next === void 0 ?
|
|
58770
|
+
return next === void 0 ? text2.length : next - 1;
|
|
58771
58771
|
}
|
|
58772
58772
|
async function locate(index, path, namePath) {
|
|
58773
58773
|
if (resolveInside(index.root, path) === null) return { ok: false, reason: `path ${path} is outside the repository` };
|
|
@@ -58789,7 +58789,7 @@ async function editSymbol(index, args2) {
|
|
|
58789
58789
|
if (!found.ok) return found;
|
|
58790
58790
|
const absolute = resolveInside(index.root, args2.path);
|
|
58791
58791
|
if (absolute === null) return { ok: false, reason: `path ${args2.path} is outside the repository` };
|
|
58792
|
-
const original =
|
|
58792
|
+
const original = readFileSync24(absolute, "utf8");
|
|
58793
58793
|
const starts = lineStarts(original);
|
|
58794
58794
|
const range = found.symbol.enclosingRange ?? found.symbol.range;
|
|
58795
58795
|
const from = offsetOf(starts, original, range[0], range[1]);
|
|
@@ -58854,21 +58854,21 @@ async function renameSymbol(deps, args2) {
|
|
|
58854
58854
|
for (const [path, ranges] of byFile) {
|
|
58855
58855
|
const absolute = resolveInside(deps.index.root, path);
|
|
58856
58856
|
if (absolute === null) return { ok: false, reason: `reference path ${path} is outside the repository` };
|
|
58857
|
-
let
|
|
58857
|
+
let text2;
|
|
58858
58858
|
try {
|
|
58859
|
-
|
|
58859
|
+
text2 = readFileSync24(absolute, "utf8");
|
|
58860
58860
|
} catch {
|
|
58861
58861
|
return { ok: false, reason: `cannot read ${path}` };
|
|
58862
58862
|
}
|
|
58863
|
-
const starts = lineStarts(
|
|
58863
|
+
const starts = lineStarts(text2);
|
|
58864
58864
|
for (const range of ranges) {
|
|
58865
|
-
const from = offsetOf(starts,
|
|
58866
|
-
const to = offsetOf(starts,
|
|
58867
|
-
if (range[0] !== range[2] || from === null || to === null ||
|
|
58865
|
+
const from = offsetOf(starts, text2, range[0], range[1]);
|
|
58866
|
+
const to = offsetOf(starts, text2, range[2], range[3]);
|
|
58867
|
+
if (range[0] !== range[2] || from === null || to === null || text2.slice(from, to) !== oldName) {
|
|
58868
58868
|
return { ok: false, reason: `${path}:${range[0] + 1}:${range[1] + 1} does not contain ${oldName}; the index is out of step with the file` };
|
|
58869
58869
|
}
|
|
58870
58870
|
}
|
|
58871
|
-
plan3.push({ path, absolute, text, ranges });
|
|
58871
|
+
plan3.push({ path, absolute, text: text2, ranges });
|
|
58872
58872
|
}
|
|
58873
58873
|
const filesChanged = [];
|
|
58874
58874
|
let edits = 0;
|
|
@@ -59181,10 +59181,10 @@ function isMissing(error62) {
|
|
|
59181
59181
|
return error62 instanceof Error && "code" in error62 && (error62.code === "ENOENT" || error62.code === "ENOTDIR");
|
|
59182
59182
|
}
|
|
59183
59183
|
function readJson(path) {
|
|
59184
|
-
const
|
|
59185
|
-
if (
|
|
59184
|
+
const text2 = readText(path);
|
|
59185
|
+
if (text2 === null) return void 0;
|
|
59186
59186
|
try {
|
|
59187
|
-
return JSON.parse(
|
|
59187
|
+
return JSON.parse(text2);
|
|
59188
59188
|
} catch {
|
|
59189
59189
|
return void 0;
|
|
59190
59190
|
}
|
|
@@ -59255,11 +59255,11 @@ function removeOwned(root) {
|
|
|
59255
59255
|
|
|
59256
59256
|
// ../cli/src/binding.ts
|
|
59257
59257
|
function readBindingFile(root) {
|
|
59258
|
-
const
|
|
59259
|
-
if (
|
|
59258
|
+
const text2 = readText(join2(root, BINDING_FILE));
|
|
59259
|
+
if (text2 === null) return { kind: "missing" };
|
|
59260
59260
|
let raw;
|
|
59261
59261
|
try {
|
|
59262
|
-
raw = JSON.parse(
|
|
59262
|
+
raw = JSON.parse(text2);
|
|
59263
59263
|
} catch {
|
|
59264
59264
|
return { kind: "invalid", detail: "not JSON" };
|
|
59265
59265
|
}
|
|
@@ -59461,8 +59461,8 @@ var PATTERNS = [
|
|
|
59461
59461
|
[/(["']?(?:access_?token|refresh_?token|id_?token|token|api_?key|secret|password|authorization|client_?secret)["']?\s*[:=]\s*)(["']?)[^\s"',;}&]{6,}\2/gi, "$1$2[redacted]$2"],
|
|
59462
59462
|
[/(-----BEGIN [A-Z ]*PRIVATE KEY-----)[\s\S]*?(-----END [A-Z ]*PRIVATE KEY-----)/g, "$1[redacted]$2"]
|
|
59463
59463
|
];
|
|
59464
|
-
function redact(
|
|
59465
|
-
let out2 =
|
|
59464
|
+
function redact(text2) {
|
|
59465
|
+
let out2 = text2;
|
|
59466
59466
|
for (const secret of knownSecrets) out2 = out2.split(secret).join("[redacted]");
|
|
59467
59467
|
for (const [pattern, replacement] of PATTERNS) out2 = out2.replace(pattern, replacement);
|
|
59468
59468
|
return out2;
|
|
@@ -59711,10 +59711,10 @@ function parseKeyPath(source) {
|
|
|
59711
59711
|
return parts2.length === 0 ? null : parts2;
|
|
59712
59712
|
}
|
|
59713
59713
|
var HEADER = /^\s*\[(?!\[)(.+?)\]\s*(?:#.*)?$/;
|
|
59714
|
-
function readTables(
|
|
59714
|
+
function readTables(text2) {
|
|
59715
59715
|
const tables = [];
|
|
59716
59716
|
let current2 = null;
|
|
59717
|
-
for (const line3 of
|
|
59717
|
+
for (const line3 of text2.split("\n")) {
|
|
59718
59718
|
const match = HEADER.exec(line3);
|
|
59719
59719
|
if (match !== null && match[1] !== void 0) {
|
|
59720
59720
|
if (current2 !== null) tables.push({ path: current2.path, body: current2.lines.join("\n") });
|
|
@@ -59730,8 +59730,8 @@ function readTables(text) {
|
|
|
59730
59730
|
if (current2 !== null) tables.push({ path: current2.path, body: current2.lines.join("\n") });
|
|
59731
59731
|
return tables;
|
|
59732
59732
|
}
|
|
59733
|
-
function findTable(
|
|
59734
|
-
return readTables(
|
|
59733
|
+
function findTable(text2, path) {
|
|
59734
|
+
return readTables(text2).find((table2) => table2.path.length === path.length && table2.path.every((p2, i2) => p2 === path[i2])) ?? null;
|
|
59735
59735
|
}
|
|
59736
59736
|
function isTrue(body2, key) {
|
|
59737
59737
|
return new RegExp(`^\\s*${key}\\s*=\\s*true\\s*(?:#.*)?$`, "m").test(body2);
|
|
@@ -59961,10 +59961,10 @@ async function startLoopback(preferredPort, state) {
|
|
|
59961
59961
|
}
|
|
59962
59962
|
async function postJson(deps, url2, body2, contentType) {
|
|
59963
59963
|
const response = await deps.fetch(url2, { method: "POST", headers: { "content-type": contentType, accept: "application/json" }, body: body2 });
|
|
59964
|
-
const
|
|
59965
|
-
if (!response.ok) throw new CliError(`${url2} answered ${response.status}: ${
|
|
59964
|
+
const text2 = await response.text();
|
|
59965
|
+
if (!response.ok) throw new CliError(`${url2} answered ${response.status}: ${text2.slice(0, 200)}`);
|
|
59966
59966
|
try {
|
|
59967
|
-
return JSON.parse(
|
|
59967
|
+
return JSON.parse(text2);
|
|
59968
59968
|
} catch {
|
|
59969
59969
|
throw new CliError(`${url2} did not answer with JSON`);
|
|
59970
59970
|
}
|
|
@@ -60120,8 +60120,8 @@ function parseProvider(value) {
|
|
|
60120
60120
|
if (PROVIDERS.includes(value)) return value;
|
|
60121
60121
|
throw new UsageError(`--provider must be one of ${PROVIDERS.join(", ")}`, { hint: "overlane connect --provider overlane" });
|
|
60122
60122
|
}
|
|
60123
|
-
function safeName(
|
|
60124
|
-
const cleaned =
|
|
60123
|
+
function safeName(text2) {
|
|
60124
|
+
const cleaned = text2.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-.]+|-+$/g, "");
|
|
60125
60125
|
return cleaned.slice(0, 100) === "" ? "project" : cleaned.slice(0, 100);
|
|
60126
60126
|
}
|
|
60127
60127
|
function projectLabel(project) {
|
|
@@ -60178,18 +60178,18 @@ async function isHarnessIgnored(deps, root) {
|
|
|
60178
60178
|
}
|
|
60179
60179
|
async function addExclude(deps, root) {
|
|
60180
60180
|
const path = await excludePath(deps, root);
|
|
60181
|
-
const
|
|
60182
|
-
if (
|
|
60183
|
-
const prefix =
|
|
60184
|
-
writeIfDifferent(path, `${
|
|
60181
|
+
const text2 = readText(path) ?? "";
|
|
60182
|
+
if (text2.split("\n").includes(EXCLUDE_LINE)) return false;
|
|
60183
|
+
const prefix = text2.length === 0 || text2.endsWith("\n") ? "" : "\n";
|
|
60184
|
+
writeIfDifferent(path, `${text2}${prefix}${EXCLUDE_LINE}
|
|
60185
60185
|
`);
|
|
60186
60186
|
return true;
|
|
60187
60187
|
}
|
|
60188
60188
|
async function removeExclude(deps, root) {
|
|
60189
60189
|
const path = await excludePath(deps, root);
|
|
60190
|
-
const
|
|
60191
|
-
if (
|
|
60192
|
-
const lines =
|
|
60190
|
+
const text2 = readText(path);
|
|
60191
|
+
if (text2 === null) return;
|
|
60192
|
+
const lines = text2.split("\n");
|
|
60193
60193
|
const index = lines.indexOf(EXCLUDE_LINE);
|
|
60194
60194
|
if (index === -1) return;
|
|
60195
60195
|
lines.splice(index, 1);
|
|
@@ -60279,9 +60279,9 @@ var ReleaseRefusal = class extends CliError {
|
|
|
60279
60279
|
}
|
|
60280
60280
|
};
|
|
60281
60281
|
async function failure2(response) {
|
|
60282
|
-
const
|
|
60282
|
+
const text2 = await response.text();
|
|
60283
60283
|
try {
|
|
60284
|
-
const parsed = ApiError.safeParse(JSON.parse(
|
|
60284
|
+
const parsed = ApiError.safeParse(JSON.parse(text2));
|
|
60285
60285
|
if (parsed.success) return { code: parsed.data.error.code, text: `${parsed.data.error.code}: ${parsed.data.error.message}` };
|
|
60286
60286
|
} catch {
|
|
60287
60287
|
}
|
|
@@ -60340,9 +60340,9 @@ function authHeaders(token) {
|
|
|
60340
60340
|
return { authorization: `Bearer ${token}`, accept: "application/json" };
|
|
60341
60341
|
}
|
|
60342
60342
|
async function describeFailure(response) {
|
|
60343
|
-
const
|
|
60343
|
+
const text2 = await response.text();
|
|
60344
60344
|
try {
|
|
60345
|
-
const parsed = ApiError.safeParse(JSON.parse(
|
|
60345
|
+
const parsed = ApiError.safeParse(JSON.parse(text2));
|
|
60346
60346
|
if (parsed.success) return { text: `${parsed.data.error.code}: ${parsed.data.error.message}`, code: parsed.data.error.code };
|
|
60347
60347
|
} catch {
|
|
60348
60348
|
}
|
|
@@ -61217,9 +61217,9 @@ var LocalTaskState = external_exports.object({
|
|
|
61217
61217
|
}).strict();
|
|
61218
61218
|
function readTaskState(root) {
|
|
61219
61219
|
try {
|
|
61220
|
-
const
|
|
61221
|
-
if (
|
|
61222
|
-
const parsed = LocalTaskState.safeParse(JSON.parse(
|
|
61220
|
+
const text2 = readText(join10(root, TASK_STATE_PATH));
|
|
61221
|
+
if (text2 === null) return null;
|
|
61222
|
+
const parsed = LocalTaskState.safeParse(JSON.parse(text2));
|
|
61223
61223
|
return parsed.success ? parsed.data : null;
|
|
61224
61224
|
} catch {
|
|
61225
61225
|
return null;
|
|
@@ -61471,9 +61471,9 @@ init_zod();
|
|
|
61471
61471
|
// ../cli/src/task/api.ts
|
|
61472
61472
|
init_src();
|
|
61473
61473
|
async function failure3(response) {
|
|
61474
|
-
const
|
|
61474
|
+
const text2 = await response.text();
|
|
61475
61475
|
try {
|
|
61476
|
-
const json2 = JSON.parse(
|
|
61476
|
+
const json2 = JSON.parse(text2);
|
|
61477
61477
|
const parsed = ApiError.safeParse(json2);
|
|
61478
61478
|
const developer = parsed.success ? null : DeveloperError.safeParse(json2);
|
|
61479
61479
|
const error62 = parsed.success ? parsed.data.error : developer?.success === true ? developer.data.error : null;
|
|
@@ -61569,9 +61569,9 @@ var LocalRunState = external_exports.object({
|
|
|
61569
61569
|
}).strict();
|
|
61570
61570
|
function readRunState(root) {
|
|
61571
61571
|
try {
|
|
61572
|
-
const
|
|
61573
|
-
if (
|
|
61574
|
-
const parsed = LocalRunState.safeParse(JSON.parse(
|
|
61572
|
+
const text2 = readText(join14(root, RUN_STATE_PATH));
|
|
61573
|
+
if (text2 === null) return null;
|
|
61574
|
+
const parsed = LocalRunState.safeParse(JSON.parse(text2));
|
|
61575
61575
|
return parsed.success ? parsed.data : null;
|
|
61576
61576
|
} catch {
|
|
61577
61577
|
return null;
|
|
@@ -61626,8 +61626,8 @@ function naturalCompare(a, b) {
|
|
|
61626
61626
|
}
|
|
61627
61627
|
return left.length - right.length || (a < b ? -1 : a > b ? 1 : 0);
|
|
61628
61628
|
}
|
|
61629
|
-
function splitFrontMatter(
|
|
61630
|
-
const normalized =
|
|
61629
|
+
function splitFrontMatter(text2, where2) {
|
|
61630
|
+
const normalized = text2.replace(/\r\n/g, "\n");
|
|
61631
61631
|
const match = /^---\n([\s\S]*?)\n?---\n?([\s\S]*)$/.exec(normalized);
|
|
61632
61632
|
if (!match) throw new KitError(`${where2}: missing YAML front matter`);
|
|
61633
61633
|
let data;
|
|
@@ -61749,7 +61749,7 @@ async function writePlan(repoDir, plan3) {
|
|
|
61749
61749
|
await mkdir(paths.tasks, { recursive: true });
|
|
61750
61750
|
const keep = new Set(canonical.tasks.map((task) => `${task.id}.md`));
|
|
61751
61751
|
for (const entry of await readdir(paths.tasks)) if (entry.endsWith(".md") && !keep.has(entry)) await rm(join15(paths.tasks, entry));
|
|
61752
|
-
for (const [file2,
|
|
61752
|
+
for (const [file2, text2] of files) await writeFile(file2, text2, "utf8");
|
|
61753
61753
|
return [...files.keys()].map((file2) => file2.slice(repoDir.length).replace(/^\/+/, ""));
|
|
61754
61754
|
}
|
|
61755
61755
|
async function readText2(file2) {
|
|
@@ -61759,16 +61759,16 @@ async function readText2(file2) {
|
|
|
61759
61759
|
throw new KitError(`cannot read ${file2}`, [error62 instanceof Error ? error62.message : String(error62)]);
|
|
61760
61760
|
}
|
|
61761
61761
|
}
|
|
61762
|
-
function parseProject(
|
|
61763
|
-
const { data, body: body2 } = splitFrontMatter(
|
|
61762
|
+
function parseProject(text2, where2) {
|
|
61763
|
+
const { data, body: body2 } = splitFrontMatter(text2, where2);
|
|
61764
61764
|
const sections = sectionsOf(body2);
|
|
61765
61765
|
return {
|
|
61766
61766
|
schemaVersion: data["schemaVersion"],
|
|
61767
61767
|
project: { name: data["name"], goal: sectionText(sections.get("Goal")), constraints: bulletsOf(sections.get("Constraints"), `${where2} Constraints`) }
|
|
61768
61768
|
};
|
|
61769
61769
|
}
|
|
61770
|
-
function parseMilestones(
|
|
61771
|
-
const { body: body2 } = splitFrontMatter(
|
|
61770
|
+
function parseMilestones(text2, where2) {
|
|
61771
|
+
const { body: body2 } = splitFrontMatter(text2, where2);
|
|
61772
61772
|
const milestones = [];
|
|
61773
61773
|
let current2;
|
|
61774
61774
|
let inAcceptance = false;
|
|
@@ -61796,8 +61796,8 @@ function parseMilestones(text, where2) {
|
|
|
61796
61796
|
}
|
|
61797
61797
|
return milestones;
|
|
61798
61798
|
}
|
|
61799
|
-
function parseTask(
|
|
61800
|
-
const { data, body: body2 } = splitFrontMatter(
|
|
61799
|
+
function parseTask(text2, where2) {
|
|
61800
|
+
const { data, body: body2 } = splitFrontMatter(text2, where2);
|
|
61801
61801
|
const sections = sectionsOf(body2);
|
|
61802
61802
|
return {
|
|
61803
61803
|
id: data["id"],
|
|
@@ -61852,14 +61852,14 @@ async function readOptional(file2) {
|
|
|
61852
61852
|
}
|
|
61853
61853
|
}
|
|
61854
61854
|
function classifyCommand(command) {
|
|
61855
|
-
const
|
|
61856
|
-
if (/^(echo|printf|cat|export|git|curl|wget|mkdir|cp|mv|rm|set|source)\b/.test(
|
|
61857
|
-
if (/^(pnpm|npm|yarn|bun)\s+(install|ci|i)\b/.test(
|
|
61858
|
-
if (/^(pip3?|python3? -m pip|sudo|apt|apt-get|brew|cargo install|go install|npm (i|install) -g)\b/.test(
|
|
61859
|
-
if (/\b(typecheck|type-check|tsc|mypy|pyright)\b/.test(
|
|
61860
|
-
if (/\b(lint|eslint|ruff|flake8|biome|clippy|golangci-lint)\b/.test(
|
|
61861
|
-
if (/\b(test|tests|pytest|vitest|jest)\b/.test(
|
|
61862
|
-
if (/\bbuild\b/.test(
|
|
61855
|
+
const text2 = command.trim();
|
|
61856
|
+
if (/^(echo|printf|cat|export|git|curl|wget|mkdir|cp|mv|rm|set|source)\b/.test(text2)) return void 0;
|
|
61857
|
+
if (/^(pnpm|npm|yarn|bun)\s+(install|ci|i)\b/.test(text2) || /^(pip3?|python3? -m pip)\s+install\s+(-r|-e|--requirement|--editable|\.)/.test(text2) || /^(uv sync|poetry install|bundle install)\b/.test(text2)) return "install";
|
|
61858
|
+
if (/^(pip3?|python3? -m pip|sudo|apt|apt-get|brew|cargo install|go install|npm (i|install) -g)\b/.test(text2)) return void 0;
|
|
61859
|
+
if (/\b(typecheck|type-check|tsc|mypy|pyright)\b/.test(text2)) return "typecheck";
|
|
61860
|
+
if (/\b(lint|eslint|ruff|flake8|biome|clippy|golangci-lint)\b/.test(text2)) return "lint";
|
|
61861
|
+
if (/\b(test|tests|pytest|vitest|jest)\b/.test(text2)) return "test";
|
|
61862
|
+
if (/\bbuild\b/.test(text2)) return "build";
|
|
61863
61863
|
return void 0;
|
|
61864
61864
|
}
|
|
61865
61865
|
async function packageManagerOf(repoDir, pkg) {
|
|
@@ -62038,9 +62038,9 @@ async function readOptional2(file2) {
|
|
|
62038
62038
|
return void 0;
|
|
62039
62039
|
}
|
|
62040
62040
|
}
|
|
62041
|
-
function parseTasksFile(
|
|
62041
|
+
function parseTasksFile(text2, where2) {
|
|
62042
62042
|
let block2 = { milestones: {}, tasks: {} };
|
|
62043
|
-
const match = BLOCK_PATTERN.exec(
|
|
62043
|
+
const match = BLOCK_PATTERN.exec(text2);
|
|
62044
62044
|
if (match) {
|
|
62045
62045
|
try {
|
|
62046
62046
|
block2 = BlockSchema.parse(JSON.parse(match[1] ?? ""));
|
|
@@ -62057,7 +62057,7 @@ function parseTasksFile(text, where2) {
|
|
|
62057
62057
|
}
|
|
62058
62058
|
return state.current;
|
|
62059
62059
|
};
|
|
62060
|
-
for (const line3 of
|
|
62060
|
+
for (const line3 of text2.replace(BLOCK_PATTERN, "").replace(/\r\n/g, "\n").split("\n")) {
|
|
62061
62061
|
const heading = /^##\s+Phase\s+(\d+)\s*[:\u2013\u2014-]\s*(.*?)\s*$/i.exec(line3);
|
|
62062
62062
|
if (heading) {
|
|
62063
62063
|
let title2 = heading[2] ?? "";
|
|
@@ -62113,8 +62113,8 @@ function parseStories(specText) {
|
|
|
62113
62113
|
}
|
|
62114
62114
|
return stories;
|
|
62115
62115
|
}
|
|
62116
|
-
function parseConstitution(
|
|
62117
|
-
const noComments =
|
|
62116
|
+
function parseConstitution(text2) {
|
|
62117
|
+
const noComments = text2.replace(/<!--[\s\S]*?-->/g, "");
|
|
62118
62118
|
const h1 = /^#\s+(.+?)\s*$/m.exec(noComments)?.[1];
|
|
62119
62119
|
const name2 = h1 ? h1.replace(/\s+Constitution$/i, "").trim() : void 0;
|
|
62120
62120
|
const sections = sectionsOf(noComments);
|
|
@@ -62138,8 +62138,8 @@ function parseConstitution(text) {
|
|
|
62138
62138
|
}
|
|
62139
62139
|
async function findConstitution(repoDir) {
|
|
62140
62140
|
for (const rel of CONSTITUTION_PATHS) {
|
|
62141
|
-
const
|
|
62142
|
-
if (
|
|
62141
|
+
const text2 = await readOptional2(join17(repoDir, rel));
|
|
62142
|
+
if (text2 !== void 0) return { file: rel, text: text2 };
|
|
62143
62143
|
}
|
|
62144
62144
|
return void 0;
|
|
62145
62145
|
}
|
|
@@ -62315,9 +62315,9 @@ function window2(value) {
|
|
|
62315
62315
|
}
|
|
62316
62316
|
function readUsage(deps) {
|
|
62317
62317
|
try {
|
|
62318
|
-
const
|
|
62319
|
-
if (
|
|
62320
|
-
const raw = JSON.parse(
|
|
62318
|
+
const text2 = readText(join18(deps.paths.configDir, "usage.json"));
|
|
62319
|
+
if (text2 === null) return null;
|
|
62320
|
+
const raw = JSON.parse(text2);
|
|
62321
62321
|
if (typeof raw.updatedAt !== "number") return null;
|
|
62322
62322
|
return { updatedAt: raw.updatedAt, fiveHour: window2(raw.fiveHour), sevenDay: window2(raw.sevenDay) };
|
|
62323
62323
|
} catch {
|
|
@@ -62851,7 +62851,7 @@ async function submitTask(deps, input2) {
|
|
|
62851
62851
|
}
|
|
62852
62852
|
};
|
|
62853
62853
|
}
|
|
62854
|
-
var sha256 = (
|
|
62854
|
+
var sha256 = (text2) => `sha256:${createHash4("sha256").update(text2).digest("hex")}`;
|
|
62855
62855
|
async function recordEvidence(deps, input2) {
|
|
62856
62856
|
if (input2.level !== "L1") throw new UsageError("evidence needs --level L1 (L2 evidence comes from CI on the pushed commit)");
|
|
62857
62857
|
const command = input2.words.join(" ").trim();
|
|
@@ -64221,15 +64221,15 @@ async function planned(inv, method, path, body2, note) {
|
|
|
64221
64221
|
}
|
|
64222
64222
|
var usd = (cents) => `$${Math.trunc(cents / 100)}.${String(cents % 100).padStart(2, "0")}`;
|
|
64223
64223
|
var micros = (value) => value % 1e4 === 0 ? usd(value / 1e4) : `$${(value / 1e6).toFixed(3)}`;
|
|
64224
|
-
function parseUsdToCents(
|
|
64225
|
-
const match = /^(\d{1,7})(?:\.(\d{1,2}))?$/.exec(
|
|
64224
|
+
function parseUsdToCents(text2) {
|
|
64225
|
+
const match = /^(\d{1,7})(?:\.(\d{1,2}))?$/.exec(text2.trim());
|
|
64226
64226
|
if (match === null) throw new UsageError("--usd must be an amount like 50 or 12.50", { hint: "overlane billing caps set --scope team --usd 50" });
|
|
64227
64227
|
return Number(match[1]) * 100 + Number((match[2] ?? "").padEnd(2, "0") || "0");
|
|
64228
64228
|
}
|
|
64229
|
-
function positiveInt(
|
|
64230
|
-
if (
|
|
64231
|
-
if (!/^\d+$/.test(
|
|
64232
|
-
return Number(
|
|
64229
|
+
function positiveInt(text2, flag) {
|
|
64230
|
+
if (text2 === void 0) return void 0;
|
|
64231
|
+
if (!/^\d+$/.test(text2) || Number(text2) < 1) throw new UsageError(`--${flag} must be a whole number of at least 1`);
|
|
64232
|
+
return Number(text2);
|
|
64233
64233
|
}
|
|
64234
64234
|
var PLAN_FLAG = (plans, required2) => ({ name: "plan", type: "string", required: required2, enum: plans, value: "PLAN", description: "The plan" });
|
|
64235
64235
|
var INTERVAL_FLAG = { name: "interval", type: "string", enum: ["month", "year"], value: "month|year", description: "Billing period; annual billing is cheaper per month" };
|
|
@@ -64494,10 +64494,10 @@ var approvalHeaders = (inv) => {
|
|
|
64494
64494
|
const id2 = textFlag(inv, "approval");
|
|
64495
64495
|
return id2 === void 0 ? void 0 : { [APPROVAL_HEADER]: id2 };
|
|
64496
64496
|
};
|
|
64497
|
-
function positive(
|
|
64498
|
-
if (
|
|
64499
|
-
if (!/^\d+$/.test(
|
|
64500
|
-
return Number(
|
|
64497
|
+
function positive(text2, flag) {
|
|
64498
|
+
if (text2 === void 0) return void 0;
|
|
64499
|
+
if (!/^\d+$/.test(text2) || Number(text2) < 1) throw new UsageError(`--${flag} must be a whole number of at least 1`);
|
|
64500
|
+
return Number(text2);
|
|
64501
64501
|
}
|
|
64502
64502
|
function arg(inv, index, what, hint) {
|
|
64503
64503
|
const value = inv.positionals[index];
|
|
@@ -64970,8 +64970,8 @@ var prOpenCommand = defineCommand({
|
|
|
64970
64970
|
const title = textFlag(inv, "title");
|
|
64971
64971
|
if (head === void 0 || title === void 0) throw new UsageError("--head and --title are required", { hint: 'overlane repo pr open app --head feature/x --title "Add x"' });
|
|
64972
64972
|
const base5 = textFlag(inv, "base");
|
|
64973
|
-
const
|
|
64974
|
-
const body2 = { requestId: requestId4(), title, head, ...base5 === void 0 ? {} : { base: base5 }, ...
|
|
64973
|
+
const text2 = textFlag(inv, "body");
|
|
64974
|
+
const body2 = { requestId: requestId4(), title, head, ...base5 === void 0 ? {} : { base: base5 }, ...text2 === void 0 ? {} : { body: text2 }, draft: boolFlag(inv, "draft") };
|
|
64975
64975
|
if (inv.dryRun) return planned2(inv, "repo", "POST", (t2, p2) => gitPaths.pulls(t2, p2, repo), body2);
|
|
64976
64976
|
const { call: call2, tenantId, projectId } = await connected2(inv, "repo");
|
|
64977
64977
|
return { data: await call2(PullRequest, "POST", gitPaths.pulls(tenantId, projectId, repo), body2) };
|
|
@@ -65101,21 +65101,21 @@ var ciValidateCommand = defineCommand({
|
|
|
65101
65101
|
text: (d) => d.ok ? [`${d.file} is valid: jobs ${d.jobs.join(", ")}`] : formatConfigIssues(d.file, d.issues),
|
|
65102
65102
|
handler: async (inv) => {
|
|
65103
65103
|
const file2 = textFlag(inv, "file") ?? PIPELINE_CONFIG_PATH;
|
|
65104
|
-
let
|
|
65104
|
+
let text2;
|
|
65105
65105
|
try {
|
|
65106
|
-
|
|
65106
|
+
text2 = readFileSync9(resolve9(inv.deps.paths.cwd, file2), "utf8");
|
|
65107
65107
|
} catch {
|
|
65108
65108
|
throw new UsageError(`could not read ${file2}`, { hint: "overlane ci validate --file <path>" });
|
|
65109
65109
|
}
|
|
65110
|
-
const parsed = parsePipelineConfig(
|
|
65110
|
+
const parsed = parsePipelineConfig(text2);
|
|
65111
65111
|
const data = { ok: parsed.ok, file: file2, jobs: parsed.ok ? Object.keys(parsed.config.jobs) : [], issues: parsed.ok ? [] : parsed.issues };
|
|
65112
65112
|
return parsed.ok ? { data } : { data, exit: EXIT.usage };
|
|
65113
65113
|
}
|
|
65114
65114
|
});
|
|
65115
65115
|
async function gitFact(inv, args2) {
|
|
65116
65116
|
const out2 = await inv.deps.exec("git", args2, { cwd: inv.deps.paths.cwd });
|
|
65117
|
-
const
|
|
65118
|
-
return out2.code === 0 &&
|
|
65117
|
+
const text2 = out2.stdout.trim();
|
|
65118
|
+
return out2.code === 0 && text2.length > 0 ? text2 : void 0;
|
|
65119
65119
|
}
|
|
65120
65120
|
var ciRunCommand = defineCommand({
|
|
65121
65121
|
path: ["ci", "run"],
|
|
@@ -66165,14 +66165,14 @@ var shown = (deps, issue2) => isAgent(deps) ? forAgent(issue2) : issue2;
|
|
|
66165
66165
|
var textOf = (value) => typeof value === "string" ? value : value.text;
|
|
66166
66166
|
var IssueShown = external_exports.union([Issue, AgentIssueView]);
|
|
66167
66167
|
var line = (issue2) => `#${issue2.number} ${issue2.issueId} ${issue2.status} ${issue2.priority} ${issue2.assignee === null ? "unassigned" : issue2.assignee.type} ${textOf(issue2.title)}`;
|
|
66168
|
-
function parseAssignee(
|
|
66169
|
-
if (
|
|
66170
|
-
if (
|
|
66171
|
-
const [kind, value] = [
|
|
66168
|
+
function parseAssignee(text2) {
|
|
66169
|
+
if (text2 === void 0) throw new UsageError("assign needs an assignee: human:<user-id>, agent:claude-code, agent:codex, bot:<bot-id> or none");
|
|
66170
|
+
if (text2 === "none") return null;
|
|
66171
|
+
const [kind, value] = [text2.slice(0, text2.indexOf(":")), text2.slice(text2.indexOf(":") + 1)];
|
|
66172
66172
|
if (kind === "human" && value.length > 0) return { type: "human", userId: value };
|
|
66173
66173
|
if (kind === "agent" && (value === "claude-code" || value === "codex")) return { type: "agent", executor: value };
|
|
66174
66174
|
if (kind === "bot" && /^bot_[A-Za-z0-9]{8,32}$/.test(value)) return { type: "bot", botId: value };
|
|
66175
|
-
throw new UsageError(`"${
|
|
66175
|
+
throw new UsageError(`"${text2}" is not an assignee; use human:<user-id>, agent:claude-code, agent:codex, bot:<bot-id> or none`);
|
|
66176
66176
|
}
|
|
66177
66177
|
function priorityFlag(inv) {
|
|
66178
66178
|
const value = inv.values["priority"];
|
|
@@ -66395,10 +66395,10 @@ init_zod();
|
|
|
66395
66395
|
var common7 = { needsAuth: true, needsNetwork: true };
|
|
66396
66396
|
var Deleted = external_exports.object({ deleted: external_exports.literal(true) });
|
|
66397
66397
|
var FIELDS = ["status", "priority", "assigneeType", "assignee", "labelId", "workProjectId", "cycleId", "estimate", "source", "title", "number", "createdAt", "updatedAt"];
|
|
66398
|
-
function parseCondition(
|
|
66399
|
-
const match = /^([A-Za-z]+)(!=|=|~)(.+)$/.exec(
|
|
66398
|
+
function parseCondition(text2) {
|
|
66399
|
+
const match = /^([A-Za-z]+)(!=|=|~)(.+)$/.exec(text2);
|
|
66400
66400
|
const field2 = match?.[1];
|
|
66401
|
-
if (match === null || field2 === void 0 || !FIELDS.includes(field2)) throw new UsageError(`"${
|
|
66401
|
+
if (match === null || field2 === void 0 || !FIELDS.includes(field2)) throw new UsageError(`"${text2}" is not a filter; write field=value, field!=value or field~value with a field from: ${FIELDS.join(", ")}`);
|
|
66402
66402
|
const value = /^\d+$/.test(match[3] ?? "") && (field2 === "number" || field2 === "estimate") ? Number(match[3]) : match[3];
|
|
66403
66403
|
return { field: field2, op: match[2] === "=" ? "eq" : match[2] === "!=" ? "neq" : "contains", value };
|
|
66404
66404
|
}
|
|
@@ -66605,29 +66605,29 @@ async function diffOf(inv) {
|
|
|
66605
66605
|
const pull = inv.positionals[0];
|
|
66606
66606
|
if (flag !== void 0 && pull !== void 0) throw new UsageError("give a pull request number or --diff, not both", { hint: "overlane review run --diff change.patch" });
|
|
66607
66607
|
let from;
|
|
66608
|
-
let
|
|
66608
|
+
let text2;
|
|
66609
66609
|
if (flag !== void 0) {
|
|
66610
66610
|
if (flag === "-") {
|
|
66611
66611
|
if (inv.deps.stdin === void 0) throw new UsageError("--diff - reads standard input, which is not available here", { hint: "overlane review run --diff change.patch" });
|
|
66612
66612
|
from = "standard input";
|
|
66613
|
-
|
|
66613
|
+
text2 = await inv.deps.stdin.read();
|
|
66614
66614
|
} else {
|
|
66615
66615
|
from = flag;
|
|
66616
|
-
|
|
66617
|
-
if (
|
|
66616
|
+
text2 = readText(resolve11(inv.deps.paths.cwd, flag));
|
|
66617
|
+
if (text2 === null) throw new UsageError(`could not read the diff file ${flag}`, { hint: "git diff > change.patch && overlane review run --diff change.patch" });
|
|
66618
66618
|
}
|
|
66619
66619
|
} else if (pull === void 0) {
|
|
66620
66620
|
if (inv.deps.stdin === void 0 || inv.deps.stdin.isTTY) {
|
|
66621
66621
|
throw new UsageError("nothing to review: give a diff (--diff change.patch, or pipe one in) or a pull request number", { hint: "overlane review run --diff change.patch" });
|
|
66622
66622
|
}
|
|
66623
66623
|
from = "standard input";
|
|
66624
|
-
|
|
66624
|
+
text2 = await inv.deps.stdin.read();
|
|
66625
66625
|
} else {
|
|
66626
66626
|
return void 0;
|
|
66627
66627
|
}
|
|
66628
|
-
if (
|
|
66629
|
-
if (
|
|
66630
|
-
return { text, from };
|
|
66628
|
+
if (text2.trim().length === 0) throw new UsageError(`the diff from ${from} is empty: there is nothing to review`, { hint: "git diff > change.patch && overlane review run --diff change.patch" });
|
|
66629
|
+
if (text2.length > MAX_PATCH_BYTES) throw new UsageError(`the diff is larger than ${MAX_PATCH_BYTES} characters; review it in parts`);
|
|
66630
|
+
return { text: text2, from };
|
|
66631
66631
|
}
|
|
66632
66632
|
function id(inv, what) {
|
|
66633
66633
|
const value = inv.positionals[0];
|
|
@@ -66957,8 +66957,8 @@ function stem(word) {
|
|
|
66957
66957
|
if (word.length > 3 && word.endsWith("s") && !word.endsWith("ss")) return word.slice(0, -1);
|
|
66958
66958
|
return word;
|
|
66959
66959
|
}
|
|
66960
|
-
function tokenize(
|
|
66961
|
-
const words =
|
|
66960
|
+
function tokenize(text2) {
|
|
66961
|
+
const words = text2.toLowerCase().split(/[^a-z0-9]+/).filter((word) => word.length > 0 && !STOP_WORDS.has(word));
|
|
66962
66962
|
const out2 = [];
|
|
66963
66963
|
for (let index = 0; index < words.length; index += 1) {
|
|
66964
66964
|
const word = words[index] ?? "";
|
|
@@ -69459,9 +69459,9 @@ async function secretOf(inv, required2) {
|
|
|
69459
69459
|
}
|
|
69460
69460
|
if (inv.values["secret-stdin"] === true) {
|
|
69461
69461
|
if (inv.deps.stdin === void 0) throw new UsageError("there is no standard input to read the secret from", { hint: "use --secret-env NAME" });
|
|
69462
|
-
const
|
|
69463
|
-
if (
|
|
69464
|
-
return
|
|
69462
|
+
const text2 = (await inv.deps.stdin.read()).trim();
|
|
69463
|
+
if (text2 === "") throw new UsageError("standard input was empty", { hint: "pipe the credential in, or use --secret-env NAME" });
|
|
69464
|
+
return text2;
|
|
69465
69465
|
}
|
|
69466
69466
|
if (required2) throw new UsageError("give the credential with --secret-env NAME or --secret-stdin (it is never taken from an argument)", { hint: "overlane schema connector connect" });
|
|
69467
69467
|
return void 0;
|
|
@@ -69545,9 +69545,9 @@ function inputOf(inv) {
|
|
|
69545
69545
|
const inline = textFlag(inv, "input");
|
|
69546
69546
|
const file2 = textFlag(inv, "input-file");
|
|
69547
69547
|
if (inline !== void 0 && file2 !== void 0) throw new UsageError("give --input or --input-file, not both", { hint: "overlane schema connector run" });
|
|
69548
|
-
const
|
|
69548
|
+
const text2 = inline ?? (file2 === void 0 ? "{}" : readFileSync13(file2, "utf8"));
|
|
69549
69549
|
try {
|
|
69550
|
-
const parsed = JSON.parse(
|
|
69550
|
+
const parsed = JSON.parse(text2);
|
|
69551
69551
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("not an object");
|
|
69552
69552
|
return parsed;
|
|
69553
69553
|
} catch {
|
|
@@ -69818,10 +69818,10 @@ function scopesOf(inv) {
|
|
|
69818
69818
|
return scopes;
|
|
69819
69819
|
}
|
|
69820
69820
|
function leaseFlag(inv) {
|
|
69821
|
-
const
|
|
69822
|
-
if (
|
|
69823
|
-
if (!/^\d+$/.test(
|
|
69824
|
-
return Number(
|
|
69821
|
+
const text2 = textFlag(inv, "lease-seconds");
|
|
69822
|
+
if (text2 === void 0) return void 0;
|
|
69823
|
+
if (!/^\d+$/.test(text2) || Number(text2) < 60) throw new UsageError("--lease-seconds is a whole number of at least 60");
|
|
69824
|
+
return Number(text2);
|
|
69825
69825
|
}
|
|
69826
69826
|
var claimAcquireCommand = defineCommand({
|
|
69827
69827
|
path: ["claim", "acquire"],
|
|
@@ -70259,9 +70259,9 @@ async function snapshotOf(inv, head, base5) {
|
|
|
70259
70259
|
return { provider: project.provider === "github" ? "github" : "overlane", repository, headSha: sha.stdout.trim(), baseRef: base5, files };
|
|
70260
70260
|
}
|
|
70261
70261
|
function numberOf(inv) {
|
|
70262
|
-
const
|
|
70263
|
-
if (
|
|
70264
|
-
return Number(
|
|
70262
|
+
const text2 = textFlag(inv, "number");
|
|
70263
|
+
if (text2 === void 0 || !/^[1-9]\d*$/.test(text2)) throw new UsageError("give the pull request number with --number", { hint: "overlane pr route --number 7" });
|
|
70264
|
+
return Number(text2);
|
|
70265
70265
|
}
|
|
70266
70266
|
function checkFlag(inv, name2) {
|
|
70267
70267
|
const value = textFlag(inv, name2);
|
|
@@ -70434,10 +70434,10 @@ async function planned8(inv, method, path, body2, note) {
|
|
|
70434
70434
|
const project = await offlineProject(inv.deps, "egress");
|
|
70435
70435
|
return planOutcome(inv.deps, dryRunPlan({ service: project.serviceUrl, requests: [{ method, path: path(project.binding.tenantId, project.binding.projectId), ...body2 === void 0 ? {} : { body: body2 }, ...note === void 0 ? {} : { note } }] }));
|
|
70436
70436
|
}
|
|
70437
|
-
function ruleOf(
|
|
70438
|
-
const [host, ports] =
|
|
70437
|
+
function ruleOf(text2) {
|
|
70438
|
+
const [host, ports] = text2.split(":");
|
|
70439
70439
|
const parsedPorts = ports === void 0 ? [443] : ports.split(",").map((p2) => /^\d{1,5}$/.test(p2) ? Number(p2) : Number.NaN);
|
|
70440
|
-
if (parsedPorts.some((p2) => !Number.isInteger(p2) || p2 < 1 || p2 > 65535)) throw new UsageError(`${
|
|
70440
|
+
if (parsedPorts.some((p2) => !Number.isInteger(p2) || p2 < 1 || p2 > 65535)) throw new UsageError(`${text2}: ports are whole numbers from 1 to 65535, for example registry.npmjs.org:443,8443`);
|
|
70441
70441
|
const checked2 = normaliseHost(host.replace(/^\*\./, "x."));
|
|
70442
70442
|
if (!checked2.ok || checked2.kind !== "name") throw new UsageError(`${host} is not a host name; an address cannot be a rule`, { hint: "overlane egress policy set --allow registry.npmjs.org" });
|
|
70443
70443
|
return { host: host.toLowerCase(), ports: parsedPorts };
|
|
@@ -70669,8 +70669,8 @@ async function secretValue2(inv, envFlag) {
|
|
|
70669
70669
|
return value;
|
|
70670
70670
|
}
|
|
70671
70671
|
if (inv.deps.stdin !== void 0 && !inv.deps.stdin.isTTY) {
|
|
70672
|
-
const
|
|
70673
|
-
if (
|
|
70672
|
+
const text2 = (await inv.deps.stdin.read()).trim();
|
|
70673
|
+
if (text2 !== "") return text2;
|
|
70674
70674
|
}
|
|
70675
70675
|
throw new UsageError("give the key through --value-env NAME or on standard input; it is never an argument", { hint: "overlane enterprise keys add --alias team-anthropic --provider anthropic --value-env PROVIDER_KEY" });
|
|
70676
70676
|
}
|
|
@@ -70983,9 +70983,9 @@ var enterpriseRetentionSetCommand = defineCommand({
|
|
|
70983
70983
|
handler: async (inv) => {
|
|
70984
70984
|
const raw = inv.values["rule"];
|
|
70985
70985
|
const texts = (Array.isArray(raw) ? raw : raw === void 0 ? [] : [raw]).filter((v) => typeof v === "string");
|
|
70986
|
-
const rules = texts.map((
|
|
70987
|
-
const [dataClass, days] =
|
|
70988
|
-
if (dataClass === void 0 || days === void 0 || !/^\d{1,4}$/.test(days)) throw new UsageError(`${
|
|
70986
|
+
const rules = texts.map((text2) => {
|
|
70987
|
+
const [dataClass, days] = text2.split("=");
|
|
70988
|
+
if (dataClass === void 0 || days === void 0 || !/^\d{1,4}$/.test(days)) throw new UsageError(`${text2}: use CLASS=DAYS, for example memory=365`);
|
|
70989
70989
|
return { dataClass, days: Number(days) };
|
|
70990
70990
|
});
|
|
70991
70991
|
if (inv.dryRun) return planned9(inv, "PUT", enterprisePaths.retention, { rules });
|
|
@@ -71115,11 +71115,11 @@ var enterpriseSsoGroupsSetCommand = defineCommand({
|
|
|
71115
71115
|
handler: async (inv) => {
|
|
71116
71116
|
const raw = inv.values["map"];
|
|
71117
71117
|
const texts = (Array.isArray(raw) ? raw : raw === void 0 ? [] : [raw]).filter((v) => typeof v === "string");
|
|
71118
|
-
const mappings = texts.map((
|
|
71119
|
-
const at =
|
|
71120
|
-
const groupName = at < 1 ? "" :
|
|
71121
|
-
const role =
|
|
71122
|
-
if (groupName === "" || !["viewer", "member", "admin"].includes(role)) throw new UsageError(`${
|
|
71118
|
+
const mappings = texts.map((text2) => {
|
|
71119
|
+
const at = text2.lastIndexOf("=");
|
|
71120
|
+
const groupName = at < 1 ? "" : text2.slice(0, at);
|
|
71121
|
+
const role = text2.slice(at + 1);
|
|
71122
|
+
if (groupName === "" || !["viewer", "member", "admin"].includes(role)) throw new UsageError(`${text2}: use GROUP=ROLE with ROLE viewer, member or admin`, { hint: "overlane enterprise sso groups set --map Engineering=member" });
|
|
71123
71123
|
return { groupName, role };
|
|
71124
71124
|
});
|
|
71125
71125
|
const body2 = { cap: textFlag(inv, "cap") ?? "admin", mappings };
|
|
@@ -71699,8 +71699,8 @@ function shortPath(cwd, path) {
|
|
|
71699
71699
|
return rel === "" || rel.startsWith("..") ? path : rel;
|
|
71700
71700
|
}
|
|
71701
71701
|
var sha7 = (sha) => sha.slice(0, 7);
|
|
71702
|
-
function clip(
|
|
71703
|
-
const one =
|
|
71702
|
+
function clip(text2, max) {
|
|
71703
|
+
const one = text2.replace(/\s+/g, " ").trim();
|
|
71704
71704
|
return one.length <= max ? one : `${one.slice(0, max - 1)}\u2026`;
|
|
71705
71705
|
}
|
|
71706
71706
|
|
|
@@ -71730,8 +71730,8 @@ function formatGitBrief(b) {
|
|
|
71730
71730
|
const where2 = b.upstream === null ? "no upstream" : `ahead ${b.ahead} behind ${b.behind} of ${b.upstream}`;
|
|
71731
71731
|
return `${b.branch} ${b.sha} ${where2}, ${b.dirty} dirty, last: ${b.subject === "" ? "(no commits)" : b.subject}`;
|
|
71732
71732
|
}
|
|
71733
|
-
function openP0Lines(
|
|
71734
|
-
return
|
|
71733
|
+
function openP0Lines(text2) {
|
|
71734
|
+
return text2.split("\n").filter((line3) => /^\s*- \[ \]\s+P0\b/.test(line3)).map((line3) => clip(line3.trim(), 160));
|
|
71735
71735
|
}
|
|
71736
71736
|
async function brief(ctx, input2) {
|
|
71737
71737
|
const mode = input2.mode ?? "all";
|
|
@@ -71837,14 +71837,14 @@ var LoadedIndex = class {
|
|
|
71837
71837
|
return this.callerMap.get(i2) ?? [];
|
|
71838
71838
|
}
|
|
71839
71839
|
};
|
|
71840
|
-
function parseIndex(
|
|
71840
|
+
function parseIndex(text2) {
|
|
71841
71841
|
let raw;
|
|
71842
71842
|
try {
|
|
71843
|
-
const cut =
|
|
71844
|
-
raw = JSON.parse(cut > 0 ? `${
|
|
71843
|
+
const cut = text2.lastIndexOf(',"words":[');
|
|
71844
|
+
raw = JSON.parse(cut > 0 ? `${text2.slice(0, cut)}}}` : text2);
|
|
71845
71845
|
} catch {
|
|
71846
71846
|
try {
|
|
71847
|
-
raw = JSON.parse(
|
|
71847
|
+
raw = JSON.parse(text2);
|
|
71848
71848
|
} catch {
|
|
71849
71849
|
return null;
|
|
71850
71850
|
}
|
|
@@ -71866,13 +71866,13 @@ function loadFreshIndex(ctx, root) {
|
|
|
71866
71866
|
async function loadFreshIndexUncached(ctx, root) {
|
|
71867
71867
|
const file2 = join27(root, INDEX_PATH);
|
|
71868
71868
|
if (!existsSync10(file2)) return { state: "missing" };
|
|
71869
|
-
let
|
|
71869
|
+
let text2;
|
|
71870
71870
|
try {
|
|
71871
|
-
|
|
71871
|
+
text2 = readFileSync16(file2, "utf8");
|
|
71872
71872
|
} catch {
|
|
71873
71873
|
return { state: "missing" };
|
|
71874
71874
|
}
|
|
71875
|
-
const index = parseIndex(
|
|
71875
|
+
const index = parseIndex(text2);
|
|
71876
71876
|
if (index === null) return { state: "unusable", reason: "the index file is not a version 1 code index" };
|
|
71877
71877
|
const [diff, untracked, head, count] = await Promise.all([
|
|
71878
71878
|
ctx.git(["diff", "--name-only", index.sha], root),
|
|
@@ -71920,11 +71920,11 @@ function braceEnd(lines, start2, limit = lines.length) {
|
|
|
71920
71920
|
let quote4 = "";
|
|
71921
71921
|
const stop3 = Math.min(limit, lines.length);
|
|
71922
71922
|
for (let n = start2; n <= stop3; n += 1) {
|
|
71923
|
-
const
|
|
71923
|
+
const text2 = lines[n - 1] ?? "";
|
|
71924
71924
|
let lastCode = "";
|
|
71925
|
-
for (let i2 = 0; i2 <
|
|
71926
|
-
const c2 =
|
|
71927
|
-
const two =
|
|
71925
|
+
for (let i2 = 0; i2 < text2.length; i2 += 1) {
|
|
71926
|
+
const c2 = text2[i2];
|
|
71927
|
+
const two = text2.slice(i2, i2 + 2);
|
|
71928
71928
|
if (block2) {
|
|
71929
71929
|
if (two === "*/") {
|
|
71930
71930
|
block2 = false;
|
|
@@ -71956,9 +71956,9 @@ function braceEnd(lines, start2, limit = lines.length) {
|
|
|
71956
71956
|
}
|
|
71957
71957
|
if (quote4 === '"' || quote4 === "'") quote4 = "";
|
|
71958
71958
|
if (depth <= 0 && quote4 === "" && !block2) {
|
|
71959
|
-
const t2 =
|
|
71959
|
+
const t2 = text2.trim();
|
|
71960
71960
|
if (opened || depth < 0) return n;
|
|
71961
|
-
if (t2 !== "" && !/[=,(&|?:+\-*/<>]$/.test(t2) && lastCode !== "" && !/^\s*(?:@|\/\/)/.test(
|
|
71961
|
+
if (t2 !== "" && !/[=,(&|?:+\-*/<>]$/.test(t2) && lastCode !== "" && !/^\s*(?:@|\/\/)/.test(text2)) {
|
|
71962
71962
|
const nextText = (lines[n] ?? "").trim();
|
|
71963
71963
|
if (!/^[|&?:.]/.test(nextText) && !/^extends\b|^implements\b/.test(nextText)) return n;
|
|
71964
71964
|
}
|
|
@@ -71970,10 +71970,10 @@ function indentEnd(lines, start2) {
|
|
|
71970
71970
|
const base5 = (lines[start2 - 1] ?? "").match(/^\s*/)?.[0].length ?? 0;
|
|
71971
71971
|
let end = start2;
|
|
71972
71972
|
for (let n = start2 + 1; n <= lines.length; n += 1) {
|
|
71973
|
-
const
|
|
71974
|
-
if (
|
|
71975
|
-
const indent =
|
|
71976
|
-
if (indent <= base5 && !/^\s*[)\]}]/.test(
|
|
71973
|
+
const text2 = lines[n - 1] ?? "";
|
|
71974
|
+
if (text2.trim() === "") continue;
|
|
71975
|
+
const indent = text2.match(/^\s*/)?.[0].length ?? 0;
|
|
71976
|
+
if (indent <= base5 && !/^\s*[)\]}]/.test(text2)) break;
|
|
71977
71977
|
end = n;
|
|
71978
71978
|
}
|
|
71979
71979
|
return end;
|
|
@@ -71993,7 +71993,7 @@ var SOURCE_FILE = /\.(?:[cm]?[jt]sx?|py|go|rs|java|rb|php|cs|kt|swift|astro|vue|
|
|
|
71993
71993
|
var DEF_WORDS = "function\\*?|class|interface|type|enum|const|let|var|def|fn|func|struct|trait|namespace|abstract class";
|
|
71994
71994
|
var KIND_RANK = { function: 0, class: 1, interface: 2, type: 3, constant: 4, method: 5, variable: 6, namespace: 7, property: 9 };
|
|
71995
71995
|
var GREP_EXCLUDES = [":(exclude)pnpm-lock.yaml", ":(exclude)*.lock", ":(exclude)evals/results"];
|
|
71996
|
-
var escapeRegex2 = (
|
|
71996
|
+
var escapeRegex2 = (text2) => text2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
71997
71997
|
var isTestPath = (path) => /(?:^|\/)(?:tests?|__tests__|fixtures)\/|\.(?:test|spec)\.[a-z]+$/.test(path);
|
|
71998
71998
|
function readLines(root, path) {
|
|
71999
71999
|
try {
|
|
@@ -72038,10 +72038,10 @@ function scanForDefinitions(root, files, name2) {
|
|
|
72038
72038
|
if (!SOURCE_FILE.test(path)) continue;
|
|
72039
72039
|
const lines = readLines(root, path);
|
|
72040
72040
|
if (lines === null) continue;
|
|
72041
|
-
lines.forEach((
|
|
72042
|
-
const m =
|
|
72041
|
+
lines.forEach((text2, i2) => {
|
|
72042
|
+
const m = text2.match(regex);
|
|
72043
72043
|
if (m === null) return;
|
|
72044
|
-
const word = (
|
|
72044
|
+
const word = (text2.match(new RegExp(`(?:${DEF_WORDS})(?=\\s+${escapeRegex2(name2)})`))?.[0] ?? "const").replace("abstract ", "").replace("*", "");
|
|
72045
72045
|
hits.push({ kind: KIND_OF_WORD[word] ?? "constant", qualified: name2, path, line: i2 + 1 });
|
|
72046
72046
|
});
|
|
72047
72047
|
}
|
|
@@ -72236,14 +72236,14 @@ async function outlineCore(ctx, input2) {
|
|
|
72236
72236
|
notice = fresh.state === "ready" ? fresh.changed.has(path) ? `${path} changed since index ${sha7(fresh.index.sha)}; outline by pattern` : `${path} is not in the index; outline by pattern` : indexProblem(fresh);
|
|
72237
72237
|
const lines = readLines(root, path) ?? [];
|
|
72238
72238
|
const any2 = new RegExp(`^(?:export\\s+)?(?:default\\s+)?(?:declare\\s+)?(?:async\\s+)?(${DEF_WORDS})\\s+([A-Za-z_$][\\w$]*)`);
|
|
72239
|
-
lines.forEach((
|
|
72240
|
-
const m =
|
|
72239
|
+
lines.forEach((text3, i2) => {
|
|
72240
|
+
const m = text3.match(any2);
|
|
72241
72241
|
if (m !== null) symbols2.push({ line: i2 + 1, kind: KIND_OF_WORD[m[1].replace("*", "")] ?? "constant", name: m[2] });
|
|
72242
72242
|
});
|
|
72243
72243
|
}
|
|
72244
|
-
const
|
|
72244
|
+
const text2 = symbols2.map((s) => `${s.line} ${s.kind} ${s.name}`);
|
|
72245
72245
|
if (symbols2.length === 0) return { data: { path, source, symbols: symbols2, ...notice === "" ? {} : { notice } }, lines: [...notice === "" ? [] : [notice], `none: no symbols in ${path}`], exit: 4 };
|
|
72246
|
-
return { data: { path, source, symbols: symbols2, ...notice === "" ? {} : { notice } }, lines: [...notice === "" ? [] : [notice], ...
|
|
72246
|
+
return { data: { path, source, symbols: symbols2, ...notice === "" ? {} : { notice } }, lines: [...notice === "" ? [] : [notice], ...text2], exit: 0 };
|
|
72247
72247
|
}
|
|
72248
72248
|
async function refsCore(ctx, input2) {
|
|
72249
72249
|
const root = findRoot(ctx.cwd);
|
|
@@ -72304,6 +72304,143 @@ async function refsCore(ctx, input2) {
|
|
|
72304
72304
|
return { data, lines, exit: 0 };
|
|
72305
72305
|
}
|
|
72306
72306
|
|
|
72307
|
+
// ../cli/src/token/cloud.ts
|
|
72308
|
+
import { execFileSync } from "node:child_process";
|
|
72309
|
+
import { readFileSync as readFileSync18 } from "node:fs";
|
|
72310
|
+
import { homedir } from "node:os";
|
|
72311
|
+
import { join as join29 } from "node:path";
|
|
72312
|
+
var CLOUD_TIMEOUT_MS = 4e3;
|
|
72313
|
+
var BINDING_FILE2 = join29(".harness", "project.json");
|
|
72314
|
+
var KEYCHAIN_SERVICE2 = "mvrx-harness";
|
|
72315
|
+
var CloudUnavailable = class extends Error {
|
|
72316
|
+
};
|
|
72317
|
+
var text = (value) => typeof value === "string" && value.length > 0 ? value : void 0;
|
|
72318
|
+
function readCloudBinding(root) {
|
|
72319
|
+
try {
|
|
72320
|
+
const raw = JSON.parse(readFileSync18(join29(root, BINDING_FILE2), "utf8"));
|
|
72321
|
+
const serviceUrl = text(raw["serviceUrl"]);
|
|
72322
|
+
const tenantId = text(raw["tenantId"]);
|
|
72323
|
+
const projectId = text(raw["projectId"]);
|
|
72324
|
+
if (serviceUrl === void 0 || tenantId === void 0 || projectId === void 0 || !serviceUrl.startsWith("https://")) return null;
|
|
72325
|
+
return { serviceUrl: serviceUrl.replace(/\/+$/, ""), tenantId, projectId };
|
|
72326
|
+
} catch {
|
|
72327
|
+
return null;
|
|
72328
|
+
}
|
|
72329
|
+
}
|
|
72330
|
+
function configDir(env) {
|
|
72331
|
+
const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join29(homedir(), ".config");
|
|
72332
|
+
return join29(base5, "mvrx-harness");
|
|
72333
|
+
}
|
|
72334
|
+
function readKeychain(serviceUrl) {
|
|
72335
|
+
const commands = {
|
|
72336
|
+
darwin: ["security", ["find-generic-password", "-s", KEYCHAIN_SERVICE2, "-a", serviceUrl, "-w"]],
|
|
72337
|
+
linux: ["secret-tool", ["lookup", "service", KEYCHAIN_SERVICE2, "username", serviceUrl]]
|
|
72338
|
+
};
|
|
72339
|
+
const command = commands[process.platform];
|
|
72340
|
+
if (command === void 0) return null;
|
|
72341
|
+
try {
|
|
72342
|
+
const out2 = execFileSync(command[0], command[1], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 150 }).trim();
|
|
72343
|
+
return out2.length > 0 ? out2 : null;
|
|
72344
|
+
} catch {
|
|
72345
|
+
return null;
|
|
72346
|
+
}
|
|
72347
|
+
}
|
|
72348
|
+
function usable(raw, now) {
|
|
72349
|
+
if (typeof raw !== "object" || raw === null) return null;
|
|
72350
|
+
const stored = raw;
|
|
72351
|
+
if (typeof stored.accessToken !== "string" || stored.accessToken.length === 0) return null;
|
|
72352
|
+
if (typeof stored.expiresAt === "number" && stored.expiresAt <= now) return null;
|
|
72353
|
+
return stored.accessToken;
|
|
72354
|
+
}
|
|
72355
|
+
function findCloudToken(ctx, serviceUrl) {
|
|
72356
|
+
const fromEnv = ctx.env["HARNESS_TOKEN"];
|
|
72357
|
+
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
72358
|
+
const stored = (ctx.keychain ?? readKeychain)(serviceUrl);
|
|
72359
|
+
if (stored !== null) {
|
|
72360
|
+
try {
|
|
72361
|
+
const token = usable(JSON.parse(stored), ctx.now());
|
|
72362
|
+
if (token !== null) return token;
|
|
72363
|
+
} catch {
|
|
72364
|
+
}
|
|
72365
|
+
}
|
|
72366
|
+
try {
|
|
72367
|
+
const file2 = JSON.parse(readFileSync18(join29(configDir(ctx.env), "credentials.json"), "utf8"));
|
|
72368
|
+
return usable(file2[serviceUrl], ctx.now());
|
|
72369
|
+
} catch {
|
|
72370
|
+
return null;
|
|
72371
|
+
}
|
|
72372
|
+
}
|
|
72373
|
+
function readOverlaySession(root) {
|
|
72374
|
+
try {
|
|
72375
|
+
const id2 = readFileSync18(join29(root, ".harness", "overlay", "session"), "utf8").trim();
|
|
72376
|
+
return /^[A-Za-z0-9._-]{1,64}$/.test(id2) ? id2 : void 0;
|
|
72377
|
+
} catch {
|
|
72378
|
+
return void 0;
|
|
72379
|
+
}
|
|
72380
|
+
}
|
|
72381
|
+
function cloudState(ctx, root) {
|
|
72382
|
+
const offline = ctx.env["OVERLANE_OFFLINE"] ?? ctx.env["HARNESS_OFFLINE"];
|
|
72383
|
+
if (offline !== void 0 && offline !== "" && offline !== "0" && offline !== "false") return { state: "offline" };
|
|
72384
|
+
const binding = readCloudBinding(root);
|
|
72385
|
+
if (binding === null) return { state: "unbound" };
|
|
72386
|
+
const token = findCloudToken(ctx, binding.serviceUrl);
|
|
72387
|
+
return token === null ? { state: "no-credentials", binding } : { state: "ready", binding, token };
|
|
72388
|
+
}
|
|
72389
|
+
var isObject2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
72390
|
+
var FRESHNESS = /* @__PURE__ */ new Set(["fresh", "partial", "stale", "unavailable"]);
|
|
72391
|
+
function hasMeta(value) {
|
|
72392
|
+
const coverage = value["coverage"];
|
|
72393
|
+
return isObject2(coverage) && typeof coverage["files"] === "number" && typeof value["freshness"] === "string" && FRESHNESS.has(value["freshness"]) && typeof value["incomplete"] === "boolean";
|
|
72394
|
+
}
|
|
72395
|
+
var CloudCodeSource = class {
|
|
72396
|
+
constructor(options) {
|
|
72397
|
+
this.options = options;
|
|
72398
|
+
}
|
|
72399
|
+
options;
|
|
72400
|
+
async call(route, args2, shape2) {
|
|
72401
|
+
const { ctx, binding, token, commit, session } = this.options;
|
|
72402
|
+
const doFetch = ctx.fetch ?? globalThis.fetch;
|
|
72403
|
+
const url2 = `${binding.serviceUrl}/v1/tenants/${encodeURIComponent(binding.tenantId)}/projects/${encodeURIComponent(binding.projectId)}/code/${route}`;
|
|
72404
|
+
const body2 = { ...commit === void 0 ? {} : { commit }, ...session === void 0 ? {} : { session }, ...args2 };
|
|
72405
|
+
const controller = new AbortController();
|
|
72406
|
+
const timer = setTimeout(() => controller.abort(), CLOUD_TIMEOUT_MS);
|
|
72407
|
+
try {
|
|
72408
|
+
const response = await doFetch(url2, { method: "POST", headers: { accept: "application/json", "content-type": "application/json", authorization: `Bearer ${token}` }, body: JSON.stringify(body2), signal: controller.signal });
|
|
72409
|
+
if (response.status === 401 || response.status === 403) throw new CloudUnavailable(`refused (HTTP ${response.status}); run overlane doctor`);
|
|
72410
|
+
if (!response.ok) throw new CloudUnavailable(`HTTP ${response.status}`);
|
|
72411
|
+
const parsed = JSON.parse(await response.text());
|
|
72412
|
+
if (!isObject2(parsed) || !shape2(parsed)) throw new CloudUnavailable("unexpected answer");
|
|
72413
|
+
return parsed;
|
|
72414
|
+
} catch (error62) {
|
|
72415
|
+
if (error62 instanceof CloudUnavailable) throw error62;
|
|
72416
|
+
throw new CloudUnavailable(controller.signal.aborted ? `no answer in ${CLOUD_TIMEOUT_MS / 1e3}s` : "unreachable");
|
|
72417
|
+
} finally {
|
|
72418
|
+
clearTimeout(timer);
|
|
72419
|
+
}
|
|
72420
|
+
}
|
|
72421
|
+
async find(name2, options) {
|
|
72422
|
+
return await this.call("find", { name: name2, ...options.kind === void 0 ? {} : { kind: options.kind }, ...options.limit === void 0 ? {} : { limit: options.limit } }, (v) => hasMeta(v) && Array.isArray(v["matches"]));
|
|
72423
|
+
}
|
|
72424
|
+
async outline(path, options) {
|
|
72425
|
+
return await this.call("outline", { path, ...options.all === true ? { all: true } : {} }, (v) => hasMeta(v) && Array.isArray(v["symbols"]));
|
|
72426
|
+
}
|
|
72427
|
+
async refs(name2, options) {
|
|
72428
|
+
return await this.call("refs", { name: name2, ...options.limit === void 0 ? {} : { limit: options.limit } }, (v) => hasMeta(v) && Array.isArray(v["matches"]) && Array.isArray(v["callers"]));
|
|
72429
|
+
}
|
|
72430
|
+
async span(target2, options) {
|
|
72431
|
+
return await this.call("span", { target: target2, ...options.kind === void 0 ? {} : { kind: options.kind } }, (v) => hasMeta(v) && typeof v["found"] === "boolean");
|
|
72432
|
+
}
|
|
72433
|
+
/** Source for a range, for a native project with no checkout here (the cloud reads it at the indexed commit). */
|
|
72434
|
+
async show(path, start2, end, maxLines) {
|
|
72435
|
+
return await this.call("show", { path, start: start2, end, maxLines }, (v) => hasMeta(v) && typeof v["text"] === "string");
|
|
72436
|
+
}
|
|
72437
|
+
};
|
|
72438
|
+
function metaHeader(meta3) {
|
|
72439
|
+
const sha = (value) => value === null ? "none" : value.slice(0, 7);
|
|
72440
|
+
const asked = meta3.requestedCommit !== null && meta3.requestedCommit !== meta3.indexedCommit ? ` (asked ${sha(meta3.requestedCommit)})` : "";
|
|
72441
|
+
return `@${sha(meta3.indexedCommit)} ${meta3.freshness}${asked}${meta3.overlay === void 0 ? "" : ` ${meta3.overlay}`} cov ${meta3.coverage.files}f/${meta3.coverage.symbols}s${meta3.incomplete ? " INCOMPLETE" : ""}`;
|
|
72442
|
+
}
|
|
72443
|
+
|
|
72307
72444
|
// ../cli/src/token/source.ts
|
|
72308
72445
|
async function navMeta(ctx) {
|
|
72309
72446
|
const root = findRoot(ctx.cwd);
|
|
@@ -72326,19 +72463,124 @@ async function withMeta(ctx, result) {
|
|
|
72326
72463
|
const meta3 = await navMeta(ctx);
|
|
72327
72464
|
return { ...result, data: { ...meta3, ...result.data } };
|
|
72328
72465
|
}
|
|
72329
|
-
var
|
|
72330
|
-
var
|
|
72331
|
-
var
|
|
72332
|
-
var
|
|
72466
|
+
var localFind = async (ctx, input2) => withMeta(ctx, await findCore(ctx, input2));
|
|
72467
|
+
var localShow = async (ctx, input2) => withMeta(ctx, await showCore(ctx, input2));
|
|
72468
|
+
var localOutline = async (ctx, input2) => withMeta(ctx, await outlineCore(ctx, input2));
|
|
72469
|
+
var localRefs = async (ctx, input2) => withMeta(ctx, await refsCore(ctx, input2));
|
|
72470
|
+
var PATH_LINE2 = /^(.+):(\d+)$/;
|
|
72471
|
+
var NO_ANSWER = /* @__PURE__ */ Symbol("no cloud answer");
|
|
72472
|
+
function fallbackNote(state, reason) {
|
|
72473
|
+
if (state.state === "offline") return "cloud: offline; answered from the local index";
|
|
72474
|
+
if (state.state === "no-credentials") return "cloud: no credentials; answered from the local index (overlane login)";
|
|
72475
|
+
if (state.state === "ready") return `cloud: ${reason ?? "unreachable"}; answered from the local index`;
|
|
72476
|
+
return void 0;
|
|
72477
|
+
}
|
|
72478
|
+
function withNote(result, note) {
|
|
72479
|
+
if (note === void 0) return result;
|
|
72480
|
+
const notice = result.data.notice === void 0 || result.data.notice === "" ? note : `${note}; ${result.data.notice}`;
|
|
72481
|
+
return { ...result, data: { ...result.data, notice }, lines: [note, ...result.lines] };
|
|
72482
|
+
}
|
|
72483
|
+
async function cloudFirst(ctx, ask, local2) {
|
|
72484
|
+
const root = findRoot(ctx.cwd);
|
|
72485
|
+
const state = cloudState(ctx, root);
|
|
72486
|
+
if (state.state !== "ready") return withNote(await local2(), fallbackNote(state));
|
|
72487
|
+
const head = await ctx.git(["rev-parse", "HEAD"], root);
|
|
72488
|
+
const commit = head.code === 0 && /^[0-9a-f]{40}$/.test(head.stdout.trim()) ? head.stdout.trim() : void 0;
|
|
72489
|
+
const source = new CloudCodeSource({ ctx, binding: state.binding, token: state.token, commit, session: readOverlaySession(root) });
|
|
72490
|
+
try {
|
|
72491
|
+
const answer = await ask(source, root);
|
|
72492
|
+
if (answer !== NO_ANSWER) return answer;
|
|
72493
|
+
return withNote(await local2(), "cloud: index incomplete for this; answered from the local index");
|
|
72494
|
+
} catch (error62) {
|
|
72495
|
+
if (!(error62 instanceof CloudUnavailable)) throw error62;
|
|
72496
|
+
return withNote(await local2(), fallbackNote(state, error62.message));
|
|
72497
|
+
}
|
|
72498
|
+
}
|
|
72499
|
+
var noticeLines = (meta3) => meta3.notice === void 0 || meta3.notice === "" ? [] : [meta3.notice];
|
|
72500
|
+
var codeFind = (ctx, input2) => cloudFirst(
|
|
72501
|
+
ctx,
|
|
72502
|
+
async (source) => {
|
|
72503
|
+
const limit = Math.max(1, input2.limit ?? DEFAULT_FIND_LIMIT);
|
|
72504
|
+
const a = await source.find(input2.name, { kind: input2.kind, limit });
|
|
72505
|
+
if (a.matches.length === 0 && a.incomplete) return NO_ANSWER;
|
|
72506
|
+
const rows = a.matches.slice(0, limit).map((h) => `${h.kind} ${h.qualified} ${h.path}:${h.line}`);
|
|
72507
|
+
const head = [metaHeader(a), ...noticeLines(a)];
|
|
72508
|
+
if (rows.length === 0) return { data: a, lines: [...head, `none: no definition of ${input2.name}${input2.kind === void 0 ? "" : ` (kind ${input2.kind})`}`], exit: 4 };
|
|
72509
|
+
return { data: a, lines: [...head, ...rows, ...a.more ? [`more: overlane code find ${input2.name} --limit ${limit * 3}`] : []], exit: 0 };
|
|
72510
|
+
},
|
|
72511
|
+
() => localFind(ctx, input2)
|
|
72512
|
+
);
|
|
72513
|
+
var codeOutline = (ctx, input2) => cloudFirst(
|
|
72514
|
+
ctx,
|
|
72515
|
+
async (source, root) => {
|
|
72516
|
+
const path = resolveFile(ctx, root, input2.path) ?? input2.path;
|
|
72517
|
+
const a = await source.outline(path, { all: input2.all });
|
|
72518
|
+
if (a.symbols.length === 0 && a.incomplete) return NO_ANSWER;
|
|
72519
|
+
const rows = a.symbols.map((s) => `${s.line} ${s.kind} ${s.name}`);
|
|
72520
|
+
const head = [metaHeader(a), ...noticeLines(a)];
|
|
72521
|
+
return { data: a, lines: rows.length === 0 ? [...head, `none: no symbols in ${a.path}`] : [...head, ...rows], exit: rows.length === 0 ? 4 : 0 };
|
|
72522
|
+
},
|
|
72523
|
+
() => localOutline(ctx, input2)
|
|
72524
|
+
);
|
|
72525
|
+
var codeRefs = (ctx, input2) => cloudFirst(
|
|
72526
|
+
ctx,
|
|
72527
|
+
async (source) => {
|
|
72528
|
+
const limit = Math.max(1, input2.limit ?? DEFAULT_REFS_LIMIT);
|
|
72529
|
+
const a = await source.refs(input2.name, { limit });
|
|
72530
|
+
if (a.matches.length === 0 && a.callers.length === 0 && a.incomplete) return NO_ANSWER;
|
|
72531
|
+
const rows = [...a.callers.slice(0, limit).map((h) => `caller ${h.qualified} ${h.path}:${h.line}`), ...a.matches.slice(0, limit).map((h) => `${h.path}:${h.line} ${h.text}`)];
|
|
72532
|
+
const head = [metaHeader(a), ...noticeLines(a)];
|
|
72533
|
+
if (rows.length === 0) return { data: a, lines: [...head, `none: no references to ${input2.name}`], exit: 4 };
|
|
72534
|
+
return { data: a, lines: [...head, ...rows, ...a.more > 0 ? [`+${a.more} more: overlane code refs ${input2.name} --limit ${limit * 3}`] : []], exit: 0 };
|
|
72535
|
+
},
|
|
72536
|
+
() => localRefs(ctx, input2)
|
|
72537
|
+
);
|
|
72538
|
+
var hitOf2 = (h) => ({ kind: h.kind, qualified: h.qualified, path: h.path, line: h.line });
|
|
72539
|
+
var codeShow = (ctx, input2) => cloudFirst(
|
|
72540
|
+
ctx,
|
|
72541
|
+
async (source, root) => {
|
|
72542
|
+
const at = PATH_LINE2.exec(input2.target);
|
|
72543
|
+
const file2 = at === null ? null : resolveFile(ctx, root, at[1]);
|
|
72544
|
+
const target2 = at !== null && file2 !== null ? `${file2}:${at[2]}` : input2.target;
|
|
72545
|
+
const span = await source.span(target2, { kind: input2.kind });
|
|
72546
|
+
const meta3 = { indexedCommit: span.indexedCommit, requestedCommit: span.requestedCommit, coverage: span.coverage, freshness: span.freshness, incomplete: span.incomplete, ...span.notice === void 0 ? {} : { notice: span.notice }, ...span.overlay === void 0 ? {} : { overlay: span.overlay } };
|
|
72547
|
+
if (!span.found) {
|
|
72548
|
+
if (span.incomplete) return NO_ANSWER;
|
|
72549
|
+
return { data: { ...meta3, path: "", kind: "", qualified: input2.target, start: 0, end: 0, from: 0, to: 0, truncated: false, remaining: 0, text: [], also: [] }, lines: [metaHeader(span), ...noticeLines(span), `none: no definition of ${input2.target}`], exit: 4 };
|
|
72550
|
+
}
|
|
72551
|
+
const notes = [metaHeader(span), ...noticeLines(span)];
|
|
72552
|
+
const cap = Math.max(1, input2.max ?? SHOW_CAP);
|
|
72553
|
+
const also = span.also.map(hitOf2);
|
|
72554
|
+
const lines = readLines(root, span.path);
|
|
72555
|
+
const end = Math.max(span.start, span.end);
|
|
72556
|
+
if (lines !== null) {
|
|
72557
|
+
const shown2 = finishShow(span.path, span.kind, span.qualified, span.start, Math.min(end, lines.length), lines, Math.max(0, input2.context ?? 0), input2.from, cap, also, notes);
|
|
72558
|
+
return { ...shown2, data: { ...meta3, ...shown2.data } };
|
|
72559
|
+
}
|
|
72560
|
+
let remote = null;
|
|
72561
|
+
try {
|
|
72562
|
+
remote = (await source.show(span.path, span.start, end, cap)).text.split("\n");
|
|
72563
|
+
if (remote.at(-1) === "") remote.pop();
|
|
72564
|
+
} catch (error62) {
|
|
72565
|
+
if (!(error62 instanceof CloudUnavailable)) throw error62;
|
|
72566
|
+
}
|
|
72567
|
+
const body2 = remote === null ? [] : remote.map((t2, i2) => `${span.start + i2} ${t2}`);
|
|
72568
|
+
const header = `${span.path}:${span.start}-${end} ${span.kind}${span.qualified === "" ? "" : ` ${span.qualified}`}`;
|
|
72569
|
+
const hint = remote === null ? [`no checkout of ${span.path} here and the cloud holds no source for it; read lines ${span.start}-${end} from the repository`] : [];
|
|
72570
|
+
const data = { ...meta3, path: span.path, kind: span.kind, qualified: span.qualified, start: span.start, end, from: span.start, to: remote === null ? span.start : span.start + remote.length - 1, truncated: false, remaining: 0, text: body2, also };
|
|
72571
|
+
return { data, lines: [...notes, header, ...body2, ...hint], exit: 0 };
|
|
72572
|
+
},
|
|
72573
|
+
() => localShow(ctx, input2)
|
|
72574
|
+
);
|
|
72333
72575
|
|
|
72334
72576
|
// ../cli/src/token/exec.ts
|
|
72335
72577
|
import { spawn } from "node:child_process";
|
|
72336
72578
|
import { createWriteStream, mkdirSync as mkdirSync10 } from "node:fs";
|
|
72337
|
-
import { join as
|
|
72579
|
+
import { join as join30 } from "node:path";
|
|
72338
72580
|
|
|
72339
72581
|
// ../cli/src/token/parsers.ts
|
|
72340
72582
|
var ANSI = /\u001b\[[0-9;?]*[A-Za-z]/g;
|
|
72341
|
-
var stripAnsi = (
|
|
72583
|
+
var stripAnsi = (text2) => text2.replace(ANSI, "");
|
|
72342
72584
|
var MAX_FAILURES = 15;
|
|
72343
72585
|
function groupByPackage(lines) {
|
|
72344
72586
|
const known = /* @__PURE__ */ new Set();
|
|
@@ -72367,9 +72609,9 @@ function groupByPackage(lines) {
|
|
|
72367
72609
|
return { groups, prefixed: true };
|
|
72368
72610
|
}
|
|
72369
72611
|
var packageOf = (key) => key.split(" ")[0] ?? key;
|
|
72370
|
-
function parseCountLine(
|
|
72371
|
-
const get = (word) => Number(
|
|
72372
|
-
return { failed: get("failed"), passed: get("passed"), skipped: get("skipped"), todo: get("todo"), total: Number(
|
|
72612
|
+
function parseCountLine(text2) {
|
|
72613
|
+
const get = (word) => Number(text2.match(new RegExp(`(\\d+) ${word}`))?.[1] ?? 0);
|
|
72614
|
+
return { failed: get("failed"), passed: get("passed"), skipped: get("skipped"), todo: get("todo"), total: Number(text2.match(/\((\d+)\)/)?.[1] ?? 0) };
|
|
72373
72615
|
}
|
|
72374
72616
|
function parseVitestBlock(lines, packageName2) {
|
|
72375
72617
|
const clean2 = lines.map(stripAnsi);
|
|
@@ -72572,14 +72814,14 @@ function wranglerErrors(lines) {
|
|
|
72572
72814
|
for (let i2 = 0; i2 < lines.length; i2 += 1) {
|
|
72573
72815
|
const m = lines[i2].match(/^\s*✘\s*\[ERROR\]\s*(.*)$/);
|
|
72574
72816
|
if (m === null) continue;
|
|
72575
|
-
let
|
|
72817
|
+
let text2 = m[1];
|
|
72576
72818
|
for (let j = i2 + 1; j < Math.min(lines.length, i2 + 5); j += 1) {
|
|
72577
72819
|
const next = lines[j].trim();
|
|
72578
72820
|
if (next === "") continue;
|
|
72579
72821
|
if (/^✘|^▲|^If you think/.test(next)) break;
|
|
72580
|
-
if (
|
|
72822
|
+
if (text2.length < 160) text2 += ` ${next}`;
|
|
72581
72823
|
}
|
|
72582
|
-
errors.push(clip(
|
|
72824
|
+
errors.push(clip(text2, 220));
|
|
72583
72825
|
}
|
|
72584
72826
|
return errors.slice(0, 10);
|
|
72585
72827
|
}
|
|
@@ -72697,10 +72939,10 @@ async function execCommand(ctx, input2) {
|
|
|
72697
72939
|
}
|
|
72698
72940
|
const command = commandLine(input2.tokens);
|
|
72699
72941
|
const root = findRoot(ctx.cwd);
|
|
72700
|
-
const dir =
|
|
72942
|
+
const dir = join30(root, ".harness", "logs");
|
|
72701
72943
|
mkdirSync10(dir, { recursive: true });
|
|
72702
72944
|
const started = ctx.now();
|
|
72703
|
-
const logFile =
|
|
72945
|
+
const logFile = join30(dir, `${utcStamp(started)}-${slugOf(input2.name, command)}.log`);
|
|
72704
72946
|
const stream = createWriteStream(logFile);
|
|
72705
72947
|
const chunks = [];
|
|
72706
72948
|
let captured = 0;
|
|
@@ -72739,8 +72981,8 @@ function signalNumber(signal) {
|
|
|
72739
72981
|
}
|
|
72740
72982
|
|
|
72741
72983
|
// ../cli/src/token/ledger.ts
|
|
72742
|
-
import { existsSync as existsSync12, readFileSync as
|
|
72743
|
-
import { join as
|
|
72984
|
+
import { existsSync as existsSync12, readFileSync as readFileSync19 } from "node:fs";
|
|
72985
|
+
import { join as join31, resolve as resolve16 } from "node:path";
|
|
72744
72986
|
var LEDGER_PATH = ".harness/token-ledger.jsonl";
|
|
72745
72987
|
var CATEGORY_RULES = [
|
|
72746
72988
|
["wrangler", /\bwrangler\b/],
|
|
@@ -72755,8 +72997,8 @@ var CATEGORY_RULES = [
|
|
|
72755
72997
|
];
|
|
72756
72998
|
function categorise(tool, command) {
|
|
72757
72999
|
if (tool === "Bash" || tool === "bash" || tool === "shell") {
|
|
72758
|
-
const
|
|
72759
|
-
for (const [name2, pattern] of CATEGORY_RULES) if (pattern.test(
|
|
73000
|
+
const text2 = (command ?? "").trim();
|
|
73001
|
+
for (const [name2, pattern] of CATEGORY_RULES) if (pattern.test(text2)) return name2;
|
|
72760
73002
|
return "other";
|
|
72761
73003
|
}
|
|
72762
73004
|
if (tool === "Grep" || tool === "Glob") return "grep/sed/cat";
|
|
@@ -72787,10 +73029,10 @@ function parseSince(value, now) {
|
|
|
72787
73029
|
if (Number.isNaN(date5)) throw new CoreError(`--since must be like 7d, 12h, 30m or a date; got "${value}"`, { exit: 2, code: "usage", hint: "overlane tokens report --since 7d" });
|
|
72788
73030
|
return date5;
|
|
72789
73031
|
}
|
|
72790
|
-
function readLedger(
|
|
73032
|
+
function readLedger(text2) {
|
|
72791
73033
|
const calls = [];
|
|
72792
73034
|
let skipped = 0;
|
|
72793
|
-
for (const line3 of
|
|
73035
|
+
for (const line3 of text2.split("\n")) {
|
|
72794
73036
|
if (line3.trim() === "") continue;
|
|
72795
73037
|
try {
|
|
72796
73038
|
const o = JSON.parse(line3);
|
|
@@ -72814,11 +73056,11 @@ function textOf2(content) {
|
|
|
72814
73056
|
if (Array.isArray(content)) return content.map((part) => typeof part === "string" ? part : typeof part.text === "string" ? part.text : "").join("");
|
|
72815
73057
|
return "";
|
|
72816
73058
|
}
|
|
72817
|
-
function readTranscript(
|
|
73059
|
+
function readTranscript(text2) {
|
|
72818
73060
|
const pending = /* @__PURE__ */ new Map();
|
|
72819
73061
|
const order = [];
|
|
72820
73062
|
let skipped = 0;
|
|
72821
|
-
for (const line3 of
|
|
73063
|
+
for (const line3 of text2.split("\n")) {
|
|
72822
73064
|
if (line3.trim() === "") continue;
|
|
72823
73065
|
let entry;
|
|
72824
73066
|
try {
|
|
@@ -72875,14 +73117,14 @@ async function tokensReport(ctx, input2) {
|
|
|
72875
73117
|
const file2 = resolve16(ctx.cwd, input2.transcript);
|
|
72876
73118
|
if (!existsSync12(file2)) return { data: { source: input2.transcript, since: input2.since ?? null, calls: 0, tokens: 0, skipped: 0, rows: [] }, lines: [`none: no transcript at ${input2.transcript}`], exit: 4 };
|
|
72877
73119
|
source = input2.transcript;
|
|
72878
|
-
read = readTranscript(
|
|
73120
|
+
read = readTranscript(readFileSync19(file2, "utf8"));
|
|
72879
73121
|
} else {
|
|
72880
|
-
const file2 =
|
|
73122
|
+
const file2 = join31(root, LEDGER_PATH);
|
|
72881
73123
|
if (!existsSync12(file2)) {
|
|
72882
73124
|
return { data: { source: LEDGER_PATH, since: input2.since ?? null, calls: 0, tokens: 0, skipped: 0, rows: [] }, lines: [`none: no ledger at ${LEDGER_PATH}; the tool-call hook writes it, or pass --transcript <path.jsonl>`], exit: 4 };
|
|
72883
73125
|
}
|
|
72884
73126
|
source = LEDGER_PATH;
|
|
72885
|
-
read = readLedger(
|
|
73127
|
+
read = readLedger(readFileSync19(file2, "utf8"));
|
|
72886
73128
|
}
|
|
72887
73129
|
const calls = cutoff === null ? read.calls : read.calls.filter((c2) => c2.ts >= cutoff);
|
|
72888
73130
|
const report2 = buildReport(calls, top, source, input2.since ?? null, read.skipped);
|
|
@@ -73240,7 +73482,7 @@ async function runCli(argv, deps, options) {
|
|
|
73240
73482
|
const globals = extractGlobals(argv);
|
|
73241
73483
|
const mode = outputMode(globals, deps, registry2.find(globals.tokens)?.spec.textDefault === true);
|
|
73242
73484
|
rememberSecret(deps.env["HARNESS_TOKEN"]);
|
|
73243
|
-
const inner = mode === "json" ? { ...deps, stdout: globals.verbose ? (
|
|
73485
|
+
const inner = mode === "json" ? { ...deps, stdout: globals.verbose ? (text2) => deps.stderr(redact(text2)) : () => void 0 } : deps;
|
|
73244
73486
|
const [first, ...more] = globals.tokens;
|
|
73245
73487
|
let current2;
|
|
73246
73488
|
try {
|
|
@@ -73333,38 +73575,38 @@ init_assets();
|
|
|
73333
73575
|
init_src2();
|
|
73334
73576
|
|
|
73335
73577
|
// src/data-dir.ts
|
|
73336
|
-
import { homedir } from "node:os";
|
|
73337
|
-
import { join as
|
|
73338
|
-
function dataDir(env = process.env, home =
|
|
73578
|
+
import { homedir as homedir2 } from "node:os";
|
|
73579
|
+
import { join as join36 } from "node:path";
|
|
73580
|
+
function dataDir(env = process.env, home = homedir2()) {
|
|
73339
73581
|
const override = env["MVRX_DATA_DIR"];
|
|
73340
73582
|
if (override !== void 0 && override !== "") return override;
|
|
73341
|
-
const base5 = env["XDG_DATA_HOME"] ?? (process.platform === "win32" ? env["LOCALAPPDATA"] : void 0) ?? (process.platform === "darwin" ?
|
|
73342
|
-
return
|
|
73583
|
+
const base5 = env["XDG_DATA_HOME"] ?? (process.platform === "win32" ? env["LOCALAPPDATA"] : void 0) ?? (process.platform === "darwin" ? join36(home, "Library", "Application Support") : join36(home, ".local", "share"));
|
|
73584
|
+
return join36(base5, "mvrx-harness");
|
|
73343
73585
|
}
|
|
73344
|
-
function marketplaceRoot(env = process.env, home =
|
|
73345
|
-
return
|
|
73586
|
+
function marketplaceRoot(env = process.env, home = homedir2()) {
|
|
73587
|
+
return join36(dataDir(env, home), "marketplace");
|
|
73346
73588
|
}
|
|
73347
73589
|
|
|
73348
73590
|
// src/plugin.ts
|
|
73349
|
-
import { readFileSync as
|
|
73350
|
-
import { join as
|
|
73591
|
+
import { readFileSync as readFileSync21 } from "node:fs";
|
|
73592
|
+
import { join as join38 } from "node:path";
|
|
73351
73593
|
import { parseArgs as parseArgs3 } from "node:util";
|
|
73352
73594
|
|
|
73353
73595
|
// src/marketplace.ts
|
|
73354
73596
|
init_src();
|
|
73355
73597
|
import { createHash as createHash7 } from "node:crypto";
|
|
73356
|
-
import { cpSync, existsSync as existsSync13, mkdirSync as mkdirSync11, readdirSync as readdirSync3, readFileSync as
|
|
73357
|
-
import { dirname as dirname12, join as
|
|
73598
|
+
import { cpSync, existsSync as existsSync13, mkdirSync as mkdirSync11, readdirSync as readdirSync3, readFileSync as readFileSync20, renameSync as renameSync7, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync10 } from "node:fs";
|
|
73599
|
+
import { dirname as dirname12, join as join37, relative as relative4, sep } from "node:path";
|
|
73358
73600
|
var CLIENT_DIRS = ["claude", "codex"];
|
|
73359
73601
|
var EMBEDDED_MANIFEST = "release-manifest.json";
|
|
73360
|
-
var INSTALLED_MANIFEST =
|
|
73602
|
+
var INSTALLED_MANIFEST = join37(".release", "manifest.json");
|
|
73361
73603
|
var MarketplaceError = class extends Error {
|
|
73362
73604
|
};
|
|
73363
73605
|
function loadEmbedded(packageRoot2) {
|
|
73364
|
-
const dir =
|
|
73365
|
-
const path =
|
|
73606
|
+
const dir = join37(packageRoot2, "plugins");
|
|
73607
|
+
const path = join37(dir, EMBEDDED_MANIFEST);
|
|
73366
73608
|
if (!existsSync13(path)) throw new MarketplaceError(`this package has no embedded plugin release (${path} is missing)`);
|
|
73367
|
-
const parsed = ReleaseManifest.safeParse(JSON.parse(
|
|
73609
|
+
const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync20(path, "utf8")));
|
|
73368
73610
|
if (!parsed.success) throw new MarketplaceError(`the embedded release manifest is invalid: ${parsed.error.message}`);
|
|
73369
73611
|
return { dir, manifest: parsed.data };
|
|
73370
73612
|
}
|
|
@@ -73375,7 +73617,7 @@ function listFiles(root, dir = root) {
|
|
|
73375
73617
|
if (!existsSync13(dir)) return [];
|
|
73376
73618
|
const out2 = [];
|
|
73377
73619
|
for (const entry of readdirSync3(dir, { withFileTypes: true })) {
|
|
73378
|
-
const full =
|
|
73620
|
+
const full = join37(dir, entry.name);
|
|
73379
73621
|
if (entry.isDirectory()) out2.push(...listFiles(root, full));
|
|
73380
73622
|
else out2.push(relative4(root, full).split(sep).join("/"));
|
|
73381
73623
|
}
|
|
@@ -73387,15 +73629,15 @@ async function verifyTree(treeRoot, manifest) {
|
|
|
73387
73629
|
if (recomputed !== manifest.digest) problems.push(`manifest digest ${manifest.digest} does not match its file list (${recomputed})`);
|
|
73388
73630
|
const listed = new Set(manifest.files.map((file2) => file2.path));
|
|
73389
73631
|
for (const file2 of manifest.files) {
|
|
73390
|
-
const path =
|
|
73632
|
+
const path = join37(treeRoot, file2.path);
|
|
73391
73633
|
if (!existsSync13(path)) {
|
|
73392
73634
|
problems.push(`missing: ${file2.path}`);
|
|
73393
73635
|
continue;
|
|
73394
73636
|
}
|
|
73395
|
-
if (sha2562(
|
|
73637
|
+
if (sha2562(readFileSync20(path)) !== file2.digest) problems.push(`modified: ${file2.path}`);
|
|
73396
73638
|
}
|
|
73397
73639
|
for (const client of CLIENT_DIRS) {
|
|
73398
|
-
for (const found of listFiles(
|
|
73640
|
+
for (const found of listFiles(join37(treeRoot, client))) {
|
|
73399
73641
|
if (!listed.has(`${client}/${found}`)) problems.push(`unlisted: ${client}/${found}`);
|
|
73400
73642
|
}
|
|
73401
73643
|
}
|
|
@@ -73403,7 +73645,7 @@ async function verifyTree(treeRoot, manifest) {
|
|
|
73403
73645
|
}
|
|
73404
73646
|
function readInstalledManifest(target2) {
|
|
73405
73647
|
try {
|
|
73406
|
-
const parsed = ReleaseManifest.safeParse(JSON.parse(
|
|
73648
|
+
const parsed = ReleaseManifest.safeParse(JSON.parse(readFileSync20(join37(target2, INSTALLED_MANIFEST), "utf8")));
|
|
73407
73649
|
return parsed.success ? parsed.data : null;
|
|
73408
73650
|
} catch {
|
|
73409
73651
|
return null;
|
|
@@ -73431,10 +73673,10 @@ async function syncMarketplace(embedded, target2) {
|
|
|
73431
73673
|
mkdirSync11(staging, { recursive: true });
|
|
73432
73674
|
try {
|
|
73433
73675
|
for (const client of CLIENT_DIRS) {
|
|
73434
|
-
if (existsSync13(
|
|
73676
|
+
if (existsSync13(join37(embedded.dir, client))) cpSync(join37(embedded.dir, client), join37(staging, client), { recursive: true });
|
|
73435
73677
|
}
|
|
73436
|
-
mkdirSync11(
|
|
73437
|
-
writeFileSync10(
|
|
73678
|
+
mkdirSync11(join37(staging, ".release"), { recursive: true });
|
|
73679
|
+
writeFileSync10(join37(staging, INSTALLED_MANIFEST), `${JSON.stringify(embedded.manifest, null, 2)}
|
|
73438
73680
|
`);
|
|
73439
73681
|
const after = await verifyTree(staging, embedded.manifest);
|
|
73440
73682
|
if (after.length > 0) throw new MarketplaceError(`the copied plugin files do not match the release manifest:
|
|
@@ -73466,8 +73708,8 @@ var PLUGIN_USAGE = ` overlane plugin install [--scope project|user] [--client c
|
|
|
73466
73708
|
var PluginUsageError = class extends Error {
|
|
73467
73709
|
};
|
|
73468
73710
|
function readNames(treeRoot, client) {
|
|
73469
|
-
const file2 = client === "claude" ?
|
|
73470
|
-
const parsed = JSON.parse(
|
|
73711
|
+
const file2 = client === "claude" ? join38(treeRoot, "claude", ".claude-plugin", "marketplace.json") : join38(treeRoot, "codex", ".agents", "plugins", "marketplace.json");
|
|
73712
|
+
const parsed = JSON.parse(readFileSync21(file2, "utf8"));
|
|
73471
73713
|
const record3 = parsed;
|
|
73472
73714
|
const plugin = record3.plugins?.[0]?.name;
|
|
73473
73715
|
if (typeof record3.name !== "string" || typeof plugin !== "string") throw new MarketplaceError(`${file2} names no marketplace or plugin`);
|
|
@@ -73480,8 +73722,8 @@ async function step(deps, program, args2, cwd) {
|
|
|
73480
73722
|
deps.stdout(` $ ${[program, ...args2].join(" ")}
|
|
73481
73723
|
`);
|
|
73482
73724
|
const result = await deps.exec(program, args2, { cwd });
|
|
73483
|
-
const
|
|
73484
|
-
if (
|
|
73725
|
+
const text2 = `${result.stdout}${result.stderr}`.trim();
|
|
73726
|
+
if (text2 !== "") deps.stdout(`${text2.split("\n").map((line3) => ` ${line3}`).join("\n")}
|
|
73485
73727
|
`);
|
|
73486
73728
|
return result.code === 0;
|
|
73487
73729
|
}
|
|
@@ -73513,7 +73755,7 @@ ${PLUGIN_USAGE}`);
|
|
|
73513
73755
|
const key = `${names.plugin}@${names.marketplace}`;
|
|
73514
73756
|
if (!await available(deps, client)) {
|
|
73515
73757
|
if (explicit !== void 0) {
|
|
73516
|
-
deps.stderr(`overlane: \`${client}\` was not found on PATH; the marketplace is at ${
|
|
73758
|
+
deps.stderr(`overlane: \`${client}\` was not found on PATH; the marketplace is at ${join38(root, client)}
|
|
73517
73759
|
`);
|
|
73518
73760
|
failed = true;
|
|
73519
73761
|
} else {
|
|
@@ -73525,7 +73767,7 @@ ${PLUGIN_USAGE}`);
|
|
|
73525
73767
|
ranAny = true;
|
|
73526
73768
|
deps.stdout(`${client}:
|
|
73527
73769
|
`);
|
|
73528
|
-
const dir =
|
|
73770
|
+
const dir = join38(root, client);
|
|
73529
73771
|
const steps = client === "claude" ? [
|
|
73530
73772
|
["claude", ["plugin", "marketplace", "add", dir, "--scope", scope]],
|
|
73531
73773
|
["claude", ["plugin", "marketplace", "update", names.marketplace]],
|
|
@@ -73560,10 +73802,10 @@ ${PLUGIN_USAGE}`);
|
|
|
73560
73802
|
}
|
|
73561
73803
|
|
|
73562
73804
|
// src/shim.ts
|
|
73563
|
-
import { execFileSync as
|
|
73805
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
73564
73806
|
function repositoryRoot(cwd) {
|
|
73565
73807
|
try {
|
|
73566
|
-
return
|
|
73808
|
+
return execFileSync3("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
73567
73809
|
} catch {
|
|
73568
73810
|
return null;
|
|
73569
73811
|
}
|
|
@@ -73692,8 +73934,8 @@ var packageCommands = [indexBuildCommand, indexUploadCommand, shimCommand, plugi
|
|
|
73692
73934
|
|
|
73693
73935
|
// src/deps.ts
|
|
73694
73936
|
import { execFile as execFile5, spawn as spawn2 } from "node:child_process";
|
|
73695
|
-
import { homedir as
|
|
73696
|
-
import { join as
|
|
73937
|
+
import { homedir as homedir4 } from "node:os";
|
|
73938
|
+
import { join as join41 } from "node:path";
|
|
73697
73939
|
import { createInterface } from "node:readline/promises";
|
|
73698
73940
|
function exec(command, args2, options) {
|
|
73699
73941
|
return new Promise((resolveResult) => {
|
|
@@ -73738,19 +73980,19 @@ async function confirm(question) {
|
|
|
73738
73980
|
rl.close();
|
|
73739
73981
|
}
|
|
73740
73982
|
}
|
|
73741
|
-
function
|
|
73742
|
-
const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ??
|
|
73743
|
-
return
|
|
73983
|
+
function configDir3(env) {
|
|
73984
|
+
const base5 = env["XDG_CONFIG_HOME"] ?? (process.platform === "win32" ? env["APPDATA"] : void 0) ?? join41(homedir4(), ".config");
|
|
73985
|
+
return join41(base5, "mvrx-harness");
|
|
73744
73986
|
}
|
|
73745
73987
|
function createDeps2(env = process.env) {
|
|
73746
73988
|
return {
|
|
73747
73989
|
exec,
|
|
73748
73990
|
fetch: (input2, init2) => globalThis.fetch(input2, init2),
|
|
73749
73991
|
keychain: noKeychain,
|
|
73750
|
-
paths: { cwd: process.cwd(), home:
|
|
73992
|
+
paths: { cwd: process.cwd(), home: homedir4(), configDir: configDir3(env), defaultMarketplaceRoot: marketplaceRoot(env) },
|
|
73751
73993
|
env,
|
|
73752
|
-
stdout: (
|
|
73753
|
-
stderr: (
|
|
73994
|
+
stdout: (text2) => void process.stdout.write(text2),
|
|
73995
|
+
stderr: (text2) => void process.stderr.write(text2),
|
|
73754
73996
|
isTTY: process.stdin.isTTY === true && process.stdout.isTTY === true,
|
|
73755
73997
|
stdoutIsTTY: process.stdout.isTTY === true,
|
|
73756
73998
|
confirm,
|