@amdahl/cli 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/amdahl.js +179 -64
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ It finds Claude Code, Cursor and Codex by their command on your PATH
|
|
|
78
78
|
`.cursor`, `.codex`), and ticks the ones it finds. Enter accepts. If you are
|
|
79
79
|
not signed in, it signs you in through the browser first. It prints the
|
|
80
80
|
sign-in link only if the browser could not be opened, or nothing came back
|
|
81
|
-
within
|
|
81
|
+
within a minute, and it waits up to 15 minutes, so someone new can create
|
|
82
82
|
their workspace on the way and land back in the same setup. If the server
|
|
83
83
|
rejects a key set in
|
|
84
84
|
`AMDAHL_KEY` (or `AMDAHL_API_KEY`, `AMDAHL_ACCESS_TOKEN`, `--api-key`), it says
|
package/dist/amdahl.js
CHANGED
|
@@ -1000,14 +1000,14 @@ var require_foldFlowLines = __commonJS({
|
|
|
1000
1000
|
var FOLD_FLOW = "flow";
|
|
1001
1001
|
var FOLD_BLOCK = "block";
|
|
1002
1002
|
var FOLD_QUOTED = "quoted";
|
|
1003
|
-
function foldFlowLines(
|
|
1003
|
+
function foldFlowLines(text2, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
|
|
1004
1004
|
if (!lineWidth || lineWidth < 0)
|
|
1005
|
-
return
|
|
1005
|
+
return text2;
|
|
1006
1006
|
if (lineWidth < minContentWidth)
|
|
1007
1007
|
minContentWidth = 0;
|
|
1008
1008
|
const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
|
|
1009
|
-
if (
|
|
1010
|
-
return
|
|
1009
|
+
if (text2.length <= endStep)
|
|
1010
|
+
return text2;
|
|
1011
1011
|
const folds = [];
|
|
1012
1012
|
const escapedFolds = {};
|
|
1013
1013
|
let end = lineWidth - indent.length;
|
|
@@ -1024,14 +1024,14 @@ var require_foldFlowLines = __commonJS({
|
|
|
1024
1024
|
let escStart = -1;
|
|
1025
1025
|
let escEnd = -1;
|
|
1026
1026
|
if (mode === FOLD_BLOCK) {
|
|
1027
|
-
i = consumeMoreIndentedLines(
|
|
1027
|
+
i = consumeMoreIndentedLines(text2, i, indent.length);
|
|
1028
1028
|
if (i !== -1)
|
|
1029
1029
|
end = i + endStep;
|
|
1030
1030
|
}
|
|
1031
|
-
for (let ch; ch =
|
|
1031
|
+
for (let ch; ch = text2[i += 1]; ) {
|
|
1032
1032
|
if (mode === FOLD_QUOTED && ch === "\\") {
|
|
1033
1033
|
escStart = i;
|
|
1034
|
-
switch (
|
|
1034
|
+
switch (text2[i + 1]) {
|
|
1035
1035
|
case "x":
|
|
1036
1036
|
i += 3;
|
|
1037
1037
|
break;
|
|
@@ -1048,12 +1048,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
1048
1048
|
}
|
|
1049
1049
|
if (ch === "\n") {
|
|
1050
1050
|
if (mode === FOLD_BLOCK)
|
|
1051
|
-
i = consumeMoreIndentedLines(
|
|
1051
|
+
i = consumeMoreIndentedLines(text2, i, indent.length);
|
|
1052
1052
|
end = i + indent.length + endStep;
|
|
1053
1053
|
split = void 0;
|
|
1054
1054
|
} else {
|
|
1055
1055
|
if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== " ") {
|
|
1056
|
-
const next =
|
|
1056
|
+
const next = text2[i + 1];
|
|
1057
1057
|
if (next && next !== " " && next !== "\n" && next !== " ")
|
|
1058
1058
|
split = i;
|
|
1059
1059
|
}
|
|
@@ -1065,12 +1065,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
1065
1065
|
} else if (mode === FOLD_QUOTED) {
|
|
1066
1066
|
while (prev === " " || prev === " ") {
|
|
1067
1067
|
prev = ch;
|
|
1068
|
-
ch =
|
|
1068
|
+
ch = text2[i += 1];
|
|
1069
1069
|
overflow = true;
|
|
1070
1070
|
}
|
|
1071
1071
|
const j = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
1072
1072
|
if (escapedFolds[j])
|
|
1073
|
-
return
|
|
1073
|
+
return text2;
|
|
1074
1074
|
folds.push(j);
|
|
1075
1075
|
escapedFolds[j] = true;
|
|
1076
1076
|
end = j + endStep;
|
|
@@ -1085,39 +1085,39 @@ var require_foldFlowLines = __commonJS({
|
|
|
1085
1085
|
if (overflow && onOverflow)
|
|
1086
1086
|
onOverflow();
|
|
1087
1087
|
if (folds.length === 0)
|
|
1088
|
-
return
|
|
1088
|
+
return text2;
|
|
1089
1089
|
if (onFold)
|
|
1090
1090
|
onFold();
|
|
1091
|
-
let res =
|
|
1091
|
+
let res = text2.slice(0, folds[0]);
|
|
1092
1092
|
for (let i2 = 0; i2 < folds.length; ++i2) {
|
|
1093
1093
|
const fold = folds[i2];
|
|
1094
|
-
const end2 = folds[i2 + 1] ||
|
|
1094
|
+
const end2 = folds[i2 + 1] || text2.length;
|
|
1095
1095
|
if (fold === 0)
|
|
1096
1096
|
res = `
|
|
1097
|
-
${indent}${
|
|
1097
|
+
${indent}${text2.slice(0, end2)}`;
|
|
1098
1098
|
else {
|
|
1099
1099
|
if (mode === FOLD_QUOTED && escapedFolds[fold])
|
|
1100
|
-
res += `${
|
|
1100
|
+
res += `${text2[fold]}\\`;
|
|
1101
1101
|
res += `
|
|
1102
|
-
${indent}${
|
|
1102
|
+
${indent}${text2.slice(fold + 1, end2)}`;
|
|
1103
1103
|
}
|
|
1104
1104
|
}
|
|
1105
1105
|
return res;
|
|
1106
1106
|
}
|
|
1107
|
-
function consumeMoreIndentedLines(
|
|
1107
|
+
function consumeMoreIndentedLines(text2, i, indent) {
|
|
1108
1108
|
let end = i;
|
|
1109
1109
|
let start = i + 1;
|
|
1110
|
-
let ch =
|
|
1110
|
+
let ch = text2[start];
|
|
1111
1111
|
while (ch === " " || ch === " ") {
|
|
1112
1112
|
if (i < start + indent) {
|
|
1113
|
-
ch =
|
|
1113
|
+
ch = text2[++i];
|
|
1114
1114
|
} else {
|
|
1115
1115
|
do {
|
|
1116
|
-
ch =
|
|
1116
|
+
ch = text2[++i];
|
|
1117
1117
|
} while (ch && ch !== "\n");
|
|
1118
1118
|
end = i;
|
|
1119
1119
|
start = i + 1;
|
|
1120
|
-
ch =
|
|
1120
|
+
ch = text2[start];
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
1123
|
return end;
|
|
@@ -6347,15 +6347,15 @@ var require_parser = __commonJS({
|
|
|
6347
6347
|
var node_process = __require("process");
|
|
6348
6348
|
var cst = require_cst();
|
|
6349
6349
|
var lexer = require_lexer();
|
|
6350
|
-
function includesToken(
|
|
6351
|
-
for (let i = 0; i <
|
|
6352
|
-
if (
|
|
6350
|
+
function includesToken(list2, type) {
|
|
6351
|
+
for (let i = 0; i < list2.length; ++i)
|
|
6352
|
+
if (list2[i].type === type)
|
|
6353
6353
|
return true;
|
|
6354
6354
|
return false;
|
|
6355
6355
|
}
|
|
6356
|
-
function findNonEmptyIndex(
|
|
6357
|
-
for (let i = 0; i <
|
|
6358
|
-
switch (
|
|
6356
|
+
function findNonEmptyIndex(list2) {
|
|
6357
|
+
for (let i = 0; i < list2.length; ++i) {
|
|
6358
|
+
switch (list2[i].type) {
|
|
6359
6359
|
case "space":
|
|
6360
6360
|
case "comment":
|
|
6361
6361
|
case "newline":
|
|
@@ -7406,10 +7406,10 @@ ${SHOW_CURSOR}`);
|
|
|
7406
7406
|
reject(outcome.error);
|
|
7407
7407
|
}
|
|
7408
7408
|
};
|
|
7409
|
-
const onKeypress = (
|
|
7410
|
-
const name = key?.name ??
|
|
7409
|
+
const onKeypress = (text2, key) => {
|
|
7410
|
+
const name = key?.name ?? text2;
|
|
7411
7411
|
if (key?.ctrl && (name === "c" || name === "d")) return finish({ error: new PromptCancelled() });
|
|
7412
|
-
const result = onKey(
|
|
7412
|
+
const result = onKey(text2, name);
|
|
7413
7413
|
if (result === "redraw") output.write(`${up(height + 1)}${draw()}`);
|
|
7414
7414
|
else if (result) finish(result);
|
|
7415
7415
|
};
|
|
@@ -7432,19 +7432,19 @@ ${draw()}`);
|
|
|
7432
7432
|
function marker(options) {
|
|
7433
7433
|
return options.color ? options.trueColor ? "\x1B[1;38;2;253;75;3m" : "\x1B[1;38;5;202m" : "\x1B[1m";
|
|
7434
7434
|
}
|
|
7435
|
-
function move(current, count,
|
|
7435
|
+
function move(current, count, text2, name) {
|
|
7436
7436
|
if (name === "up" || name === "k") return (current - 1 + count) % count;
|
|
7437
7437
|
if (name === "down" || name === "j") return (current + 1) % count;
|
|
7438
|
-
if (
|
|
7438
|
+
if (text2 && /^[1-9]$/.test(text2) && Number(text2) <= count) return Number(text2) - 1;
|
|
7439
7439
|
return null;
|
|
7440
7440
|
}
|
|
7441
7441
|
function selectMenu(input, output, question, choices, options = {}) {
|
|
7442
7442
|
let current = Math.min(Math.max(options.initial ?? 0, 0), choices.length - 1);
|
|
7443
7443
|
const on = marker(options);
|
|
7444
7444
|
const rows = () => choices.map((c, i) => i === current ? `${on}> ${c}${OFF}` : ` ${c}`);
|
|
7445
|
-
return runMenu(input, output, question, HINT, rows, (
|
|
7445
|
+
return runMenu(input, output, question, HINT, rows, (text2, name) => {
|
|
7446
7446
|
if (name === "return" || name === "enter") return { pick: current, summary: choices[current] ?? "" };
|
|
7447
|
-
const next = move(current, choices.length,
|
|
7447
|
+
const next = move(current, choices.length, text2, name);
|
|
7448
7448
|
if (next === null || next === current) return null;
|
|
7449
7449
|
current = next;
|
|
7450
7450
|
return "redraw";
|
|
@@ -7458,7 +7458,7 @@ function multiSelectMenu(input, output, question, choices, options = {}) {
|
|
|
7458
7458
|
const row = `[${ticked[i] ? "x" : " "}] ${c}`;
|
|
7459
7459
|
return i === current ? `${on}> ${row}${OFF}` : ` ${row}`;
|
|
7460
7460
|
});
|
|
7461
|
-
return runMenu(input, output, question, MULTI_HINT, rows, (
|
|
7461
|
+
return runMenu(input, output, question, MULTI_HINT, rows, (text2, name) => {
|
|
7462
7462
|
if (name === "return" || name === "enter") {
|
|
7463
7463
|
const picks = choices.flatMap((_, i) => ticked[i] ? [i] : []);
|
|
7464
7464
|
return { pick: picks, summary: picks.map((i) => choices[i]).join(", ") || "none" };
|
|
@@ -7467,12 +7467,12 @@ function multiSelectMenu(input, output, question, choices, options = {}) {
|
|
|
7467
7467
|
ticked[current] = !ticked[current];
|
|
7468
7468
|
return "redraw";
|
|
7469
7469
|
}
|
|
7470
|
-
if (
|
|
7471
|
-
current = Number(
|
|
7470
|
+
if (text2 && /^[1-9]$/.test(text2) && Number(text2) <= choices.length) {
|
|
7471
|
+
current = Number(text2) - 1;
|
|
7472
7472
|
ticked[current] = !ticked[current];
|
|
7473
7473
|
return "redraw";
|
|
7474
7474
|
}
|
|
7475
|
-
const next = move(current, choices.length,
|
|
7475
|
+
const next = move(current, choices.length, text2, name);
|
|
7476
7476
|
if (next === null || next === current) return null;
|
|
7477
7477
|
current = next;
|
|
7478
7478
|
return "redraw";
|
|
@@ -7548,8 +7548,8 @@ function openerFor(platform, url) {
|
|
|
7548
7548
|
function realIo() {
|
|
7549
7549
|
return {
|
|
7550
7550
|
env: process.env,
|
|
7551
|
-
stdout: (
|
|
7552
|
-
stderr: (
|
|
7551
|
+
stdout: (text2) => process.stdout.write(text2),
|
|
7552
|
+
stderr: (text2) => process.stderr.write(text2),
|
|
7553
7553
|
stdinIsTTY: Boolean(process.stdin.isTTY),
|
|
7554
7554
|
stdoutIsTTY: Boolean(process.stdout.isTTY),
|
|
7555
7555
|
stderrIsTTY: Boolean(process.stderr.isTTY),
|
|
@@ -7576,7 +7576,7 @@ function realIo() {
|
|
|
7576
7576
|
now: () => Date.now(),
|
|
7577
7577
|
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
7578
7578
|
loginTimeoutMs: 9e5,
|
|
7579
|
-
browserGraceMs:
|
|
7579
|
+
browserGraceMs: 6e4,
|
|
7580
7580
|
fetchTimeoutMs: 15e3
|
|
7581
7581
|
};
|
|
7582
7582
|
}
|
|
@@ -8131,8 +8131,8 @@ function signInAgainUrl(authorize) {
|
|
|
8131
8131
|
const url = new URL(authorize);
|
|
8132
8132
|
return `${url.origin}/login?redirect=${encodeURIComponent(`${url.pathname}${url.search}`)}`;
|
|
8133
8133
|
}
|
|
8134
|
-
function html(
|
|
8135
|
-
return
|
|
8134
|
+
function html(text2) {
|
|
8135
|
+
return text2.replace(/[&<>"']/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
8136
8136
|
}
|
|
8137
8137
|
function page(body) {
|
|
8138
8138
|
return `<!doctype html><html><head><meta charset="utf-8"><title>Amdahl CLI</title></head><body style="font-family:system-ui,sans-serif;max-width:32rem;margin:4rem auto;line-height:1.5">${body}</body></html>`;
|
|
@@ -8542,8 +8542,8 @@ async function call(fn) {
|
|
|
8542
8542
|
|
|
8543
8543
|
// src/output.ts
|
|
8544
8544
|
var CONTROL_RE = /[\u0000-\u001f\u007f-\u009f]/g;
|
|
8545
|
-
function printable(
|
|
8546
|
-
return
|
|
8545
|
+
function printable(text2) {
|
|
8546
|
+
return text2.replace(CONTROL_RE, "");
|
|
8547
8547
|
}
|
|
8548
8548
|
function createOutput(io, json, noColor) {
|
|
8549
8549
|
const color = !noColor && !io.env.NO_COLOR && io.env.TERM !== "dumb" && io.stderrIsTTY && !json;
|
|
@@ -8559,16 +8559,16 @@ function createOutput(io, json, noColor) {
|
|
|
8559
8559
|
`);
|
|
8560
8560
|
}
|
|
8561
8561
|
},
|
|
8562
|
-
info(
|
|
8563
|
-
io.stderr(
|
|
8562
|
+
info(text2) {
|
|
8563
|
+
io.stderr(text2.endsWith("\n") ? text2 : `${text2}
|
|
8564
8564
|
`);
|
|
8565
8565
|
},
|
|
8566
8566
|
event(data) {
|
|
8567
8567
|
if (json) io.stderr(`${JSON.stringify(data)}
|
|
8568
8568
|
`);
|
|
8569
8569
|
},
|
|
8570
|
-
bold(
|
|
8571
|
-
return color ? `\x1B[1m${
|
|
8570
|
+
bold(text2) {
|
|
8571
|
+
return color ? `\x1B[1m${text2}\x1B[22m` : text2;
|
|
8572
8572
|
}
|
|
8573
8573
|
};
|
|
8574
8574
|
}
|
|
@@ -8790,8 +8790,8 @@ var shipped_default = [
|
|
|
8790
8790
|
var SKILL_URL = "https://docs.amdahl.ai/skills/amdahl/SKILL.md";
|
|
8791
8791
|
var SKILL_TEXT = SKILL_default;
|
|
8792
8792
|
var SHIPPED_SKILL_SHA256 = shipped_default;
|
|
8793
|
-
function isShippedSkill(
|
|
8794
|
-
return SHIPPED_SKILL_SHA256.includes(createHash2("sha256").update(
|
|
8793
|
+
function isShippedSkill(text2) {
|
|
8794
|
+
return SHIPPED_SKILL_SHA256.includes(createHash2("sha256").update(text2).digest("hex"));
|
|
8795
8795
|
}
|
|
8796
8796
|
var SKILL_DIRS = {
|
|
8797
8797
|
"claude-code": [".claude", "skills"],
|
|
@@ -9178,6 +9178,119 @@ function withTimeout(promise, ms, file) {
|
|
|
9178
9178
|
});
|
|
9179
9179
|
return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
|
|
9180
9180
|
}
|
|
9181
|
+
var WEAKEST = {
|
|
9182
|
+
rules: "how it follows your rules",
|
|
9183
|
+
ask: "the ask",
|
|
9184
|
+
opener: "the opener",
|
|
9185
|
+
fit: "how it fits the recipient",
|
|
9186
|
+
proof: "its proof points",
|
|
9187
|
+
length: "the length",
|
|
9188
|
+
style: "the tone",
|
|
9189
|
+
preference: "how it matches your preferences",
|
|
9190
|
+
voice: "how much it sounds like you"
|
|
9191
|
+
};
|
|
9192
|
+
var CONCERNS = {
|
|
9193
|
+
conflicts_with_callers_ask: "it asks for a different length or time than your ask",
|
|
9194
|
+
drops_ask: "it leaves out your ask",
|
|
9195
|
+
adds_claim: "it states something neither your draft nor your facts support",
|
|
9196
|
+
drops_entity: "it drops a name, link or placeholder you had",
|
|
9197
|
+
inflates: "it is longer than you asked for",
|
|
9198
|
+
no_gain: "it changed little beyond the wording",
|
|
9199
|
+
breaks_rules: "it breaks one of your rules"
|
|
9200
|
+
};
|
|
9201
|
+
var EVIDENCE_MISSED = {
|
|
9202
|
+
corpus_empty: "the workspace has none yet",
|
|
9203
|
+
evidence_unavailable: "this environment does not read them",
|
|
9204
|
+
evidence_read_failed: "the read failed, so a retry may work"
|
|
9205
|
+
};
|
|
9206
|
+
var MAX_LINES = 3;
|
|
9207
|
+
function list(value) {
|
|
9208
|
+
return Array.isArray(value) ? value.filter((v) => !!v && typeof v === "object") : null;
|
|
9209
|
+
}
|
|
9210
|
+
function record(value) {
|
|
9211
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
9212
|
+
}
|
|
9213
|
+
function text(value) {
|
|
9214
|
+
return typeof value === "string" ? printable(value).trim() : "";
|
|
9215
|
+
}
|
|
9216
|
+
function sentence(value) {
|
|
9217
|
+
return /[.!?]$/.test(value) ? value : `${value}.`;
|
|
9218
|
+
}
|
|
9219
|
+
function plural(n, one, many = `${one}s`) {
|
|
9220
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
9221
|
+
}
|
|
9222
|
+
function readSteps(steps) {
|
|
9223
|
+
const reasonOf = (node) => text(steps.find((s) => s.node === node)?.reason);
|
|
9224
|
+
const changed = (node) => steps.some((s) => s.node === node && s.changed === true);
|
|
9225
|
+
const counts = new Map(
|
|
9226
|
+
reasonOf("w3").split(",").map((part) => part.split(":")).filter(([, n]) => /^\d+$/.test(n ?? "")).map(([code, n]) => [code, Number(n)])
|
|
9227
|
+
);
|
|
9228
|
+
const did = [];
|
|
9229
|
+
const repaired = counts.get("repaired") ?? 0;
|
|
9230
|
+
const deleted = counts.get("deleted") ?? 0;
|
|
9231
|
+
if (repaired && deleted) did.push(`Rewrote ${plural(repaired, "sentence")} and cut ${deleted} that nothing backed.`);
|
|
9232
|
+
else if (repaired) did.push(`Rewrote ${plural(repaired, "sentence")} that did not hold up.`);
|
|
9233
|
+
else if (deleted) did.push(`Cut ${plural(deleted, "sentence")} that nothing backed.`);
|
|
9234
|
+
const repair = reasonOf("w5");
|
|
9235
|
+
if (changed("w5") && repair.startsWith("repaired:")) {
|
|
9236
|
+
const weakest = WEAKEST[repair.slice("repaired:".length)];
|
|
9237
|
+
did.push(weakest ? `Reworked ${weakest}.` : "Reworked its weakest part.");
|
|
9238
|
+
}
|
|
9239
|
+
const flagged = [];
|
|
9240
|
+
const open = counts.get("open");
|
|
9241
|
+
if (open) flagged.push(`${plural(open, "sentence problem")} it could not fix`);
|
|
9242
|
+
const second = reasonOf("w6");
|
|
9243
|
+
if (changed("w6") && !second.startsWith("kept_before_repair")) {
|
|
9244
|
+
const concern = CONCERNS[second];
|
|
9245
|
+
flagged.push(concern ? `a second-check concern (${concern})` : "a second-check concern");
|
|
9246
|
+
}
|
|
9247
|
+
return { did: did.join(" "), flagged };
|
|
9248
|
+
}
|
|
9249
|
+
function and(parts) {
|
|
9250
|
+
return parts.length < 2 ? parts[0] ?? "" : `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`;
|
|
9251
|
+
}
|
|
9252
|
+
function whatAmdahlDid(result) {
|
|
9253
|
+
const steps = result.unchanged === true ? { did: "", flagged: [] } : readSteps(list(result.steps) ?? []);
|
|
9254
|
+
const flagged = [...steps.flagged];
|
|
9255
|
+
let checked = "";
|
|
9256
|
+
let removed = "";
|
|
9257
|
+
const evidence = record(result.evidence);
|
|
9258
|
+
const claims = list(result.unsupported_claims);
|
|
9259
|
+
if (evidence?.used === true) {
|
|
9260
|
+
const quotes = record(result.lift)?.quotes;
|
|
9261
|
+
const read = typeof quotes === "number" && quotes > 0 ? ` (${plural(quotes, "quote")})` : "";
|
|
9262
|
+
if (claims) {
|
|
9263
|
+
const still = claims.filter((c) => c.status !== "removed").length;
|
|
9264
|
+
const cut = claims.length - still;
|
|
9265
|
+
if (cut) removed = `Removed ${plural(cut, "claim")} your calls don't back.`;
|
|
9266
|
+
if (still) flagged.unshift(`${plural(still, "claim")} your calls don't back`);
|
|
9267
|
+
checked = `Checked every claim against your calls${read}${claims.length ? "" : " and found none they don't back"}.`;
|
|
9268
|
+
} else checked = `Checked the message against your calls${read}.`;
|
|
9269
|
+
} else if (evidence?.requested === "workspace" && EVIDENCE_MISSED[text(evidence.reason)]) {
|
|
9270
|
+
checked = `Skipped checking claims against your calls: ${EVIDENCE_MISSED[text(evidence.reason)]}.`;
|
|
9271
|
+
}
|
|
9272
|
+
const used = (list(record(result.context_use)?.rows) ?? []).filter((r) => r.verdict === "pass");
|
|
9273
|
+
const sources = [
|
|
9274
|
+
used.some((r) => r.bucket === "internal") ? "Amdahl's own records" : "",
|
|
9275
|
+
used.some((r) => r.bucket === "external") ? "what their company or market published" : ""
|
|
9276
|
+
].filter(Boolean);
|
|
9277
|
+
const usedLine = sources.length ? `Used ${plural(sources.length, "source")}: ${and(sources)}.` : "";
|
|
9278
|
+
const omitted = list(result.omitted) ?? [];
|
|
9279
|
+
const whys = [...new Set(omitted.map((o) => text(o.why)).filter(Boolean))];
|
|
9280
|
+
const more = whys.length > 1 ? ` (${plural(whys.length - 1, "more reason")} in --json)` : "";
|
|
9281
|
+
const leftOut = omitted.length ? `Left out ${plural(omitted.length, "thing")}${whys[0] ? `: ${sentence(whys[0])}` : "."}${more}` : "";
|
|
9282
|
+
const lines = [
|
|
9283
|
+
{ rank: 2, line: sentence(text(result.what_changed)) },
|
|
9284
|
+
{ rank: 5, line: checked },
|
|
9285
|
+
{ rank: 3, line: removed },
|
|
9286
|
+
{ rank: 6, line: usedLine },
|
|
9287
|
+
{ rank: 7, line: steps.did },
|
|
9288
|
+
{ rank: 4, line: leftOut },
|
|
9289
|
+
{ rank: 1, line: flagged.length ? `Flagged ${and(flagged)}; check before sending.` : "" }
|
|
9290
|
+
].filter((l) => l.line && l.line !== ".");
|
|
9291
|
+
const kept = new Set([...lines].sort((a, b) => a.rank - b.rank).slice(0, MAX_LINES));
|
|
9292
|
+
return lines.filter((l) => kept.has(l)).map((l) => l.line);
|
|
9293
|
+
}
|
|
9181
9294
|
async function optimize(ctx, args) {
|
|
9182
9295
|
const { io, out, flags } = ctx;
|
|
9183
9296
|
let files = args;
|
|
@@ -9242,6 +9355,8 @@ async function optimize(ctx, args) {
|
|
|
9242
9355
|
if (result.unchanged === true) out.info("No rewrite beat your draft; it is returned unchanged.");
|
|
9243
9356
|
else if (typeof result.summary === "string") out.info(result.summary);
|
|
9244
9357
|
out.result({}, String(result.message ?? ""));
|
|
9358
|
+
const did = whatAmdahlDid(result);
|
|
9359
|
+
if (did.length) out.info(did.join("\n"));
|
|
9245
9360
|
}
|
|
9246
9361
|
}
|
|
9247
9362
|
if (out.json) out.result(results.length === 1 ? results[0] : results);
|
|
@@ -9564,8 +9679,8 @@ async function setup(ctx) {
|
|
|
9564
9679
|
const verbose = ctx.flags.verbose === true;
|
|
9565
9680
|
const say = (line) => io.stdout(`${line}
|
|
9566
9681
|
`);
|
|
9567
|
-
const detail = (
|
|
9568
|
-
if (verbose &&
|
|
9682
|
+
const detail = (text2) => {
|
|
9683
|
+
if (verbose && text2) say(text2.replace(/^/gm, " "));
|
|
9569
9684
|
};
|
|
9570
9685
|
say(`${out.bold("Amdahl")} \xB7 predictive ML for GTM`);
|
|
9571
9686
|
const found = await detectClients(ctx);
|
|
@@ -9716,8 +9831,8 @@ function field(header, start, length) {
|
|
|
9716
9831
|
}
|
|
9717
9832
|
}
|
|
9718
9833
|
function octal(header, start, length) {
|
|
9719
|
-
const
|
|
9720
|
-
return /^[0-7]{1,12}$/.test(
|
|
9834
|
+
const text2 = header.toString("latin1", start, start + length).replace(/[\0 ]+$/, "").replace(/^ +/, "");
|
|
9835
|
+
return /^[0-7]{1,12}$/.test(text2) ? parseInt(text2, 8) : null;
|
|
9721
9836
|
}
|
|
9722
9837
|
function checkPath(path) {
|
|
9723
9838
|
const shown = JSON.stringify(path);
|
|
@@ -9843,15 +9958,15 @@ var UNREADABLE_WARNING = Object.freeze({
|
|
|
9843
9958
|
function readWarning(raw) {
|
|
9844
9959
|
if (raw === void 0 || raw === null) return void 0;
|
|
9845
9960
|
if (typeof raw !== "object" || Array.isArray(raw)) return { ...UNREADABLE_WARNING };
|
|
9846
|
-
const { result, flagged, line, text } = raw;
|
|
9961
|
+
const { result, flagged, line, text: text2 } = raw;
|
|
9847
9962
|
if (result !== "warn" && result !== "fail") return { ...UNREADABLE_WARNING };
|
|
9848
|
-
const
|
|
9849
|
-
if (!
|
|
9963
|
+
const sentence2 = typeof text2 === "string" ? warningText(text2) : "";
|
|
9964
|
+
if (!sentence2) return { ...UNREADABLE_WARNING };
|
|
9850
9965
|
return {
|
|
9851
9966
|
result,
|
|
9852
9967
|
flagged: typeof flagged === "string" && CHECK_ID_RE.test(flagged) ? flagged : null,
|
|
9853
9968
|
line: typeof line === "number" && Number.isSafeInteger(line) && line > 0 ? line : null,
|
|
9854
|
-
text:
|
|
9969
|
+
text: sentence2
|
|
9855
9970
|
};
|
|
9856
9971
|
}
|
|
9857
9972
|
function skillPage(site, ref) {
|
|
@@ -10047,13 +10162,13 @@ function checkDigest(body, fileUrl, sha256) {
|
|
|
10047
10162
|
}
|
|
10048
10163
|
function checkSkillMd(body, what, ref) {
|
|
10049
10164
|
const bad = (why) => new CliError("invalid_skill", `${what} is not a valid skill: ${why}.`, EXIT.general);
|
|
10050
|
-
let
|
|
10165
|
+
let text2;
|
|
10051
10166
|
try {
|
|
10052
|
-
|
|
10167
|
+
text2 = new TextDecoder("utf-8", { fatal: true }).decode(body);
|
|
10053
10168
|
} catch {
|
|
10054
10169
|
throw bad("it is not UTF-8 text");
|
|
10055
10170
|
}
|
|
10056
|
-
const fm = FRONT_MATTER_RE.exec(
|
|
10171
|
+
const fm = FRONT_MATTER_RE.exec(text2);
|
|
10057
10172
|
if (!fm) throw bad("it has no front matter");
|
|
10058
10173
|
const doc = (0, import_yaml.parseDocument)(fm[1] ?? "", { uniqueKeys: true });
|
|
10059
10174
|
const yamlError = doc.errors[0];
|
|
@@ -10248,7 +10363,7 @@ async function workspaceUse(ctx, args) {
|
|
|
10248
10363
|
}
|
|
10249
10364
|
|
|
10250
10365
|
// src/version.ts
|
|
10251
|
-
var VERSION = "0.3.
|
|
10366
|
+
var VERSION = "0.3.2";
|
|
10252
10367
|
|
|
10253
10368
|
// src/main.ts
|
|
10254
10369
|
var COMMANDS = {
|
package/package.json
CHANGED