paperlint 11.1.2 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +18 -8
- package/dist/build.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/latex-log.d.ts +61 -26
- package/dist/latex-log.d.ts.map +1 -1
- package/dist/latex-log.js +59 -6
- package/dist/latex-log.js.map +1 -1
- package/dist/latex-loop.d.ts +21 -6
- package/dist/latex-loop.d.ts.map +1 -1
- package/dist/latex-loop.js +32 -12
- package/dist/latex-loop.js.map +1 -1
- package/dist/submission-confirm-hook.d.ts +27 -19
- package/dist/submission-confirm-hook.d.ts.map +1 -1
- package/dist/submission-confirm-hook.js +302 -95
- package/dist/submission-confirm-hook.js.map +1 -1
- package/docs/configuration.md +30 -1
- package/docs/e2e.md +1 -0
- package/docs/layout.md +22 -22
- package/docs/submission.md +32 -8
- package/fixtures/build-e2e/lost-character/PIPELINE-STATUS.md +3 -0
- package/fixtures/build-e2e/lost-character/expect.json +15 -0
- package/fixtures/build-e2e/lost-character/paper.tex +8 -0
- package/package.json +1 -1
- package/skills/submission-portal/SKILL.md +18 -12
- package/skills/submission-portal/SKILL.md.spec.ts +17 -11
- package/src/build.test.ts +46 -3
- package/src/build.ts +20 -8
- package/src/cli.test.ts +3 -3
- package/src/cli.ts +2 -2
- package/src/latex-log.harness.ts +145 -14
- package/src/latex-log.ts +105 -16
- package/src/latex-loop.harness.ts +70 -34
- package/src/latex-loop.ts +51 -30
- package/src/submission-confirm-hook.test.ts +493 -60
- package/src/submission-confirm-hook.ts +448 -116
package/dist/latex-log.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* must therefore read the log as `latin1`, so one character is one byte and `length` counts what
|
|
20
20
|
* TeX counted.
|
|
21
21
|
*/
|
|
22
|
+
import { filter, map, pipe, range, unique } from "remeda";
|
|
22
23
|
/** TeX Live's `max_print_line`. A physical log line of exactly this many bytes was broken by TeX. */
|
|
23
24
|
export const MAX_PRINT_LINE = 79;
|
|
24
25
|
/**
|
|
@@ -54,20 +55,72 @@ export function logMarkers(lines) {
|
|
|
54
55
|
found.add("labels-changed");
|
|
55
56
|
if (line.startsWith("Package rerunfilecheck Warning:"))
|
|
56
57
|
found.add("rerunfilecheck");
|
|
57
|
-
if (line.includes("There were undefined references"))
|
|
58
|
-
found.add("undefined-references");
|
|
59
|
-
if (line.includes("There were undefined citations"))
|
|
60
|
-
found.add("undefined-citations");
|
|
61
58
|
}
|
|
62
59
|
const order = [
|
|
63
60
|
"rerun-requested",
|
|
64
61
|
"labels-changed",
|
|
65
62
|
"rerunfilecheck",
|
|
66
|
-
"undefined-references",
|
|
67
|
-
"undefined-citations",
|
|
68
63
|
];
|
|
69
64
|
return order.filter((m) => found.has(m));
|
|
70
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Does `prefix` start one of the PHYSICAL lines this logical line was joined from? `unwrapLog` joins
|
|
68
|
+
* only lines of exactly 79 bytes, so every physical line starts at a multiple of 79. That keeps a
|
|
69
|
+
* marker found after unwrapLog's false join (a 79-byte line by itself, then the marker) and still
|
|
70
|
+
* ignores the same words in the middle of a line — an overfull box quoting the text it set.
|
|
71
|
+
*/
|
|
72
|
+
const startsPhysicalLine = (line, prefix) => range(0, Math.floor(line.length / MAX_PRINT_LINE) + 1).some((k) => line.startsWith(prefix, k * MAX_PRINT_LINE));
|
|
73
|
+
/**
|
|
74
|
+
* 🔴 THE WARNINGS THAT FAIL THE BUILD — like an ESLint rule at "error". pdflatex exits 0 on each of
|
|
75
|
+
* them and writes a PDF that is wrong: a character missing, `??` or `[?]` in the text, a reference
|
|
76
|
+
* that may point at the wrong place. Only the log of the FINAL pass is judged (`latex-loop.ts`):
|
|
77
|
+
* before the rerun every reference is undefined by construction.
|
|
78
|
+
*
|
|
79
|
+
* WHY THESE FOUR. Each makes the PDF wrong for a reader, and turning all four on was measured on four
|
|
80
|
+
* real papers (their final logs of 2026-10-26): 0 hits each, so no correct paper turns red. Left out: overfull boxes (cosmetic,
|
|
81
|
+
* nearly every paper has some, and the pdf/* rules check the margins), font shape substitution
|
|
82
|
+
* (usually harmless), "Rerun to get" (the loop already reruns). Those never fail a build.
|
|
83
|
+
*
|
|
84
|
+
* Adding one is one entry here, plus its row of cases in `latex-log.harness.ts` (the harness does
|
|
85
|
+
* not type-check without it).
|
|
86
|
+
*
|
|
87
|
+
* `lost-character`: TeX prints "Missing character: There is no X in font F!" when
|
|
88
|
+
* `\tracinglostchars` > 0; LaTeX's format sets it to 2 (TeX Live 2026, `latex.ltx`), and pdflatex
|
|
89
|
+
* still exits 0. A paper that sets it to 0 silences the line, and this check with it. At 3 or more
|
|
90
|
+
* TeX makes it an error, and the build fails on the exit code instead.
|
|
91
|
+
*/
|
|
92
|
+
export const FAILING_WARNINGS = [
|
|
93
|
+
{
|
|
94
|
+
id: "lost-character",
|
|
95
|
+
reason: "the font has no glyph for this character, so pdflatex left it out of the PDF",
|
|
96
|
+
matches: (l) => startsPhysicalLine(l, "Missing character: There is no "),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "undefined-references",
|
|
100
|
+
reason: "a \\ref — or, without natbib, a \\cite — names what no pass defined, so the PDF prints ?? or [?] in its place",
|
|
101
|
+
matches: (l) => l.includes("There were undefined references"),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "undefined-citations",
|
|
105
|
+
reason: "a \\cite names a key the bibliography does not hold, so the PDF prints [?] in its place (natbib's summary)",
|
|
106
|
+
matches: (l) => l.includes("There were undefined citations"),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "multiply-defined-labels",
|
|
110
|
+
reason: "two \\label share a name, so a \\ref may point at the wrong one",
|
|
111
|
+
matches: (l) => l.includes("There were multiply-defined labels"),
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
const quotesOf = (matched) => map(unique(matched), (text) => ({
|
|
115
|
+
text,
|
|
116
|
+
times: matched.filter((l) => l === text).length,
|
|
117
|
+
}));
|
|
118
|
+
/** Which of `FAILING_WARNINGS` the log carries, in table order, each line quoted once with a count. */
|
|
119
|
+
export const failingWarnings = (lines) => pipe(FAILING_WARNINGS, map((w) => ({
|
|
120
|
+
id: w.id,
|
|
121
|
+
reason: w.reason,
|
|
122
|
+
quotes: quotesOf(lines.filter((l) => w.matches(l))),
|
|
123
|
+
})), filter((h) => h.quotes.length > 0));
|
|
71
124
|
/**
|
|
72
125
|
* Is this the line a TeX error starts on? Two spellings exist and `-file-line-error` produces
|
|
73
126
|
* both: most errors become `./paper.tex:4: Undefined control sequence.`, while some keep the
|
package/dist/latex-log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex-log.js","sourceRoot":"","sources":["../src/latex-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":"latex-log.js","sourceRoot":"","sources":["../src/latex-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1D,qGAAqG;AACrG,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAWjC;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;YACnC,KAAK,IAAI,IAAI,CAAC;YACd,SAAS;QACX,CAAC;QAC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8
8
|
* ── THE LOOP: `summarize` reduces the history to a `State`, and `nextStep` asks four questions ──
|
|
9
|
-
* 1. did the last program fail
|
|
9
|
+
* 1. did the last program fail — a non-zero exit, or a
|
|
10
|
+
* final log carrying a warning on latex-log's list of
|
|
11
|
+
* failing ones (`FAILING_WARNINGS`)? → fail, with its lines
|
|
10
12
|
* 2. did the citations, a .bib or the style change since
|
|
11
13
|
* bibtex last ran? → bibtex
|
|
12
14
|
* 3. did the last pass change a tracked file, or did the
|
|
@@ -42,7 +44,19 @@ export type Hashes = {
|
|
|
42
44
|
readonly [K in Tracked]: string | null;
|
|
43
45
|
};
|
|
44
46
|
/** Log markers, as `latex-log.ts` reads them. Re-declared as a type so this module has no imports. */
|
|
45
|
-
export type LogMarker = "rerun-requested" | "labels-changed" | "rerunfilecheck"
|
|
47
|
+
export type LogMarker = "rerun-requested" | "labels-changed" | "rerunfilecheck";
|
|
48
|
+
/**
|
|
49
|
+
* A warning on `latex-log.ts`'s list of those that fail the build, as the log of one pass carries it:
|
|
50
|
+
* its id, why it fails, and each distinct line quoted once with how many times it appeared.
|
|
51
|
+
*/
|
|
52
|
+
export interface LogFailure {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly reason: string;
|
|
55
|
+
readonly quotes: readonly {
|
|
56
|
+
readonly text: string;
|
|
57
|
+
readonly times: number;
|
|
58
|
+
}[];
|
|
59
|
+
}
|
|
46
60
|
/**
|
|
47
61
|
* What bibtex would be run on. `none` — the aux names no `\bibdata`, so there is nothing for
|
|
48
62
|
* bibtex to do. Two `needed` states are the same input exactly when every field is equal: the
|
|
@@ -73,6 +87,8 @@ export type Observation = {
|
|
|
73
87
|
readonly errorLines: readonly string[];
|
|
74
88
|
/** What `-recorder` wrote after this pass (`paper.fls`), or null when pdflatex wrote none. */
|
|
75
89
|
readonly fls: string | null;
|
|
90
|
+
/** The failing warnings this pass's log carries. Only the final pass's are judged. */
|
|
91
|
+
readonly failing: readonly LogFailure[];
|
|
76
92
|
} | {
|
|
77
93
|
readonly step: "bibtex";
|
|
78
94
|
readonly exitCode: number;
|
|
@@ -88,6 +104,9 @@ export type FailCause = {
|
|
|
88
104
|
} | {
|
|
89
105
|
readonly kind: "no-convergence";
|
|
90
106
|
readonly unsettled: readonly string[];
|
|
107
|
+
} | {
|
|
108
|
+
readonly kind: "log-warnings";
|
|
109
|
+
readonly ids: readonly string[];
|
|
91
110
|
};
|
|
92
111
|
export type Step = {
|
|
93
112
|
readonly kind: "latex";
|
|
@@ -96,8 +115,6 @@ export type Step = {
|
|
|
96
115
|
readonly kind: "bibtex";
|
|
97
116
|
} | {
|
|
98
117
|
readonly kind: "done";
|
|
99
|
-
/** Undefined-reference summaries still in the final log — a converged doc with a bad key. */
|
|
100
|
-
readonly warnings: readonly LogMarker[];
|
|
101
118
|
} | {
|
|
102
119
|
readonly kind: "fail";
|
|
103
120
|
readonly step: "latex" | "bibtex";
|
|
@@ -121,8 +138,6 @@ export type State = {
|
|
|
121
138
|
/** Non-final pdflatex passes so far. */
|
|
122
139
|
readonly latexPasses: number;
|
|
123
140
|
readonly finalDone: boolean;
|
|
124
|
-
/** Undefined-reference summaries in the log of the final pass. */
|
|
125
|
-
readonly warnings: readonly LogMarker[];
|
|
126
141
|
};
|
|
127
142
|
export declare function nextStep(s: State): Step;
|
|
128
143
|
/** The tracked files whose digest differs between two snapshots. */
|
package/dist/latex-loop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex-loop.d.ts","sourceRoot":"","sources":["../src/latex-loop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"latex-loop.d.ts","sourceRoot":"","sources":["../src/latex-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,gGAAgG;AAChG,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AACpD,eAAO,MAAM,OAAO,E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;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEN,qFAAqF;AACrF,eAAO,MAAM,UAAU,EAAE,MAAU,CAAC;AAEpC,kEAAkE;AAClE,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAC;QAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;QAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;KACnC,GAAG,IAAI,CAAC;IACT,mFAAmF;IACnF,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAOvC;AAaD,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAErE;AAkDD,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,KAAK,CAchE"}
|
package/dist/latex-loop.js
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Both halves are table tests (`latex-loop.harness.ts`), not scenarios that need TeX.
|
|
7
7
|
*
|
|
8
8
|
* ── THE LOOP: `summarize` reduces the history to a `State`, and `nextStep` asks four questions ──
|
|
9
|
-
* 1. did the last program fail
|
|
9
|
+
* 1. did the last program fail — a non-zero exit, or a
|
|
10
|
+
* final log carrying a warning on latex-log's list of
|
|
11
|
+
* failing ones (`FAILING_WARNINGS`)? → fail, with its lines
|
|
10
12
|
* 2. did the citations, a .bib or the style change since
|
|
11
13
|
* bibtex last ran? → bibtex
|
|
12
14
|
* 3. did the last pass change a tracked file, or did the
|
|
@@ -46,7 +48,7 @@ export function nextStep(s) {
|
|
|
46
48
|
if (s.failed)
|
|
47
49
|
return { kind: "fail", ...s.failed };
|
|
48
50
|
if (s.finalDone)
|
|
49
|
-
return { kind: "done"
|
|
51
|
+
return { kind: "done" };
|
|
50
52
|
if (s.bibOutdated)
|
|
51
53
|
return { kind: "bibtex" };
|
|
52
54
|
if (s.unsettled.length === 0)
|
|
@@ -87,27 +89,45 @@ function unsettledBy(history) {
|
|
|
87
89
|
}
|
|
88
90
|
return [];
|
|
89
91
|
}
|
|
92
|
+
/** A failing warning as the human reads it: the id and reason, then each quoted line. */
|
|
93
|
+
const failureLines = (f) => [
|
|
94
|
+
`${f.id} — ${f.reason}:`,
|
|
95
|
+
...f.quotes.map((q) => ` ${q.text}${q.times > 1 ? ` (${String(q.times)} times)` : ""}`),
|
|
96
|
+
];
|
|
97
|
+
/**
|
|
98
|
+
* Did the last run fail? A non-zero exit, whichever program; or a FINAL pass whose log carries a
|
|
99
|
+
* failing warning. An earlier pass's log is not judged: before the rerun every reference is
|
|
100
|
+
* undefined by construction.
|
|
101
|
+
*/
|
|
102
|
+
function failureOf(last) {
|
|
103
|
+
if (last === undefined)
|
|
104
|
+
return null;
|
|
105
|
+
if (last.exitCode !== 0)
|
|
106
|
+
return {
|
|
107
|
+
step: last.step,
|
|
108
|
+
cause: { kind: "exit", code: last.exitCode },
|
|
109
|
+
lines: last.errorLines,
|
|
110
|
+
};
|
|
111
|
+
if (last.step !== "latex" || !last.final || last.failing.length === 0)
|
|
112
|
+
return null;
|
|
113
|
+
return {
|
|
114
|
+
step: "latex",
|
|
115
|
+
cause: { kind: "log-warnings", ids: last.failing.map((f) => f.id) },
|
|
116
|
+
lines: last.failing.flatMap(failureLines),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
90
119
|
export function summarize(history) {
|
|
91
120
|
const last = history.at(-1);
|
|
92
121
|
const latexRuns = history.filter((o) => o.step === "latex");
|
|
93
122
|
const lastLatex = latexRuns.at(-1);
|
|
94
123
|
const lastBibtex = history.filter((o) => o.step === "bibtex").at(-1);
|
|
95
124
|
return {
|
|
96
|
-
failed: last
|
|
97
|
-
? {
|
|
98
|
-
step: last.step,
|
|
99
|
-
cause: { kind: "exit", code: last.exitCode },
|
|
100
|
-
lines: last.errorLines,
|
|
101
|
-
}
|
|
102
|
-
: null,
|
|
125
|
+
failed: failureOf(last),
|
|
103
126
|
bibOutdated: lastLatex?.bib.kind === "needed" &&
|
|
104
127
|
!(lastBibtex && sameBib(lastBibtex.bib, lastLatex.bib)),
|
|
105
128
|
unsettled: unsettledBy(history),
|
|
106
129
|
latexPasses: latexRuns.filter((o) => !o.final).length,
|
|
107
130
|
finalDone: last?.step === "latex" && last.final,
|
|
108
|
-
warnings: last?.step === "latex"
|
|
109
|
-
? last.markers.filter((m) => m === "undefined-references" || m === "undefined-citations")
|
|
110
|
-
: [],
|
|
111
131
|
};
|
|
112
132
|
}
|
|
113
133
|
//# sourceMappingURL=latex-loop.js.map
|
package/dist/latex-loop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex-loop.js","sourceRoot":"","sources":["../src/latex-loop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"latex-loop.js","sourceRoot":"","sources":["../src/latex-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,MAAM,CAAC,MAAM,OAAO,GAAuB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAkBxE,MAAM,KAAK,GAAyB;IAClC,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB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T,SAAS,EAAE,GAAG,CAAC,IAAI,KAAK,QAAQ;YAChC,CAAC,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;QACzD,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC;QAC/B,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM;QACrD,SAAS,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK;KAChD,CAAC;AACJ,CAAC"}
|
|
@@ -22,11 +22,11 @@ export type ConfirmDeps = PresetDeps & {
|
|
|
22
22
|
*/
|
|
23
23
|
readonly readSend: (words: readonly string[]) => Send | null;
|
|
24
24
|
};
|
|
25
|
-
/** What Claude Code reads from a PreToolUse hook's stdout to
|
|
26
|
-
export interface
|
|
25
|
+
/** What Claude Code reads from a PreToolUse hook's stdout to refuse the command; the agent sees the reason. */
|
|
26
|
+
export interface DenyOutput {
|
|
27
27
|
readonly hookSpecificOutput: {
|
|
28
28
|
readonly hookEventName: "PreToolUse";
|
|
29
|
-
readonly permissionDecision: "
|
|
29
|
+
readonly permissionDecision: "deny";
|
|
30
30
|
readonly permissionDecisionReason: string;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
@@ -35,25 +35,33 @@ export interface Send {
|
|
|
35
35
|
readonly paper: string | null;
|
|
36
36
|
readonly pdf: string | null;
|
|
37
37
|
}
|
|
38
|
+
/** One question the person answered: its text, and the option they chose. */
|
|
39
|
+
interface Answer {
|
|
40
|
+
readonly question: string;
|
|
41
|
+
readonly answer: string;
|
|
42
|
+
}
|
|
43
|
+
/** What tells an earlier send in the transcript. */
|
|
44
|
+
interface EarlierSend {
|
|
45
|
+
/** This call's own `tool_use_id`: no earlier send. */
|
|
46
|
+
readonly current: string | null;
|
|
47
|
+
/** Whether text may hold a send — cheap, so the shell parser runs only where it may matter. */
|
|
48
|
+
readonly mayHold: (text: string) => boolean;
|
|
49
|
+
/** Whether a command sends: a paperlint send, or a portal named. */
|
|
50
|
+
readonly sends: (command: string) => boolean;
|
|
51
|
+
}
|
|
38
52
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
export declare function sendKind(leaves: readonly ShellLeaf[], hosts: () => readonly string[]): "paperlint" | "direct" | null;
|
|
45
|
-
/**
|
|
46
|
-
* Why the person is asked, for `paperlint submission` sends: each send's paper, PDF and build — every
|
|
47
|
-
* send in the command, one block each. Words the shell would expand (`$…`, backticks) are not
|
|
48
|
-
* guessed at: such a command is described as unresolved.
|
|
53
|
+
* The person's answers to `AskUserQuestion` since the last send in the transcript, oldest first.
|
|
54
|
+
* A line that may matter and is not JSON (real transcripts have them: an entry cut short, run into
|
|
55
|
+
* the next) counts as a send when it may hold one, so a yes before it is used up — never wrongly
|
|
56
|
+
* kept; otherwise it is skipped, and a yes lost in it only means asking again.
|
|
49
57
|
*/
|
|
50
|
-
export declare function
|
|
51
|
-
/** The
|
|
52
|
-
export declare const UNREADABLE_INPUT:
|
|
58
|
+
export declare function answersSinceLastSend(transcript: string, earlier: EarlierSend): readonly Answer[];
|
|
59
|
+
/** The refusal when the hook's input cannot be read at all: it cannot tell, so it does not let it run. */
|
|
60
|
+
export declare const UNREADABLE_INPUT: DenyOutput;
|
|
53
61
|
/**
|
|
54
|
-
* The hook on one payload, as Claude Code sends it on stdin:
|
|
55
|
-
* sends nothing
|
|
62
|
+
* The hook on one payload, as Claude Code sends it on stdin: a refusal, or null to let the command
|
|
63
|
+
* run (it sends nothing, or every send in it has the person's yes). Never throws: a crash refuses.
|
|
56
64
|
*/
|
|
57
|
-
export declare function submissionConfirm(stdin: string, deps: ConfirmDeps):
|
|
65
|
+
export declare function submissionConfirm(stdin: string, deps: ConfirmDeps): DenyOutput | null;
|
|
58
66
|
export {};
|
|
59
67
|
//# sourceMappingURL=submission-confirm-hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submission-confirm-hook.d.ts","sourceRoot":"","sources":["../src/submission-confirm-hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"submission-confirm-hook.d.ts","sourceRoot":"","sources":["../src/submission-confirm-hook.ts"],"names":[],"mappings":"AAkEA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG5D,4GAA4G;AAC5G,UAAU,SAAS;IACjB,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,wEAAwE;IACxE,OAAO,CAAC,GAAG,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC;IAC9C,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,0GAA0G;AAC1G,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IACrC,oGAAoG;IACpG,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;IACzD,kGAAkG;IAClG,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,SAAS,SAAS,EAAE,CAAC;IAChE;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CAC9D,CAAC;AAEF,+GAA+G;AAC/G,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,kBAAkB,EAAE;QAC3B,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC;QACrC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,wBAAwB,EAAE,MAAM,CAAC;KAC3C,CAAC;CACH;A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