paperlint 20.1.1 → 20.2.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/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +7 -0
- package/CLAUDE.md +6 -2
- package/CONTRIBUTING.md +2 -2
- package/{action.harness.mjs → action.test.mjs} +147 -138
- package/dist/adapters/venue-corpus/index.d.ts +345 -0
- package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
- package/dist/adapters/venue-corpus/index.js +205 -0
- package/dist/adapters/venue-corpus/index.js.map +1 -0
- package/dist/domain/licence.d.ts +51 -0
- package/dist/domain/licence.d.ts.map +1 -0
- package/dist/domain/licence.js +61 -0
- package/dist/domain/licence.js.map +1 -0
- package/dist/domain/venue-corpus.d.ts +120 -0
- package/dist/domain/venue-corpus.d.ts.map +1 -0
- package/dist/domain/venue-corpus.js +13 -0
- package/dist/domain/venue-corpus.js.map +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
- package/dist/eslint-rules/papers.js +1 -1
- package/dist/latex-log.d.ts +1 -1
- package/dist/latex-log.js +1 -1
- package/dist/latex-loop.d.ts +1 -1
- package/dist/latex-loop.js +1 -1
- package/dist/lib/paper-config.d.ts +3 -3
- package/dist/lib/paper-config.js +3 -3
- package/dist/ports/venue-corpus-codec.d.ts +11 -0
- package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
- package/dist/ports/venue-corpus-codec.js +2 -0
- package/dist/ports/venue-corpus-codec.js.map +1 -0
- package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
- package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
- package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
- package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
- package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
- package/docs/design/venue-corpus.md +250 -0
- package/docs/e2e.md +9 -9
- package/docs/testing.md +3 -4
- package/docs/venues.md +144 -21
- package/eslint-rules/CLAUDE.md +5 -1
- package/eslint-rules/CLAUDE.md.spec.ts +3 -0
- package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
- package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
- package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
- package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
- package/eslint-rules/papers.ts +1 -1
- package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
- package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
- package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
- package/eslint.config.mjs +15 -2
- package/fixtures/pdf-facts/README.md +1 -1
- package/fixtures/render-paper/build-clean.sh +1 -1
- package/fixtures/toolchain-mirror/install-tl +1 -1
- package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
- package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
- package/lib/paper-config.ts +3 -3
- package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
- package/package.json +4 -3
- package/presets/acm-acmsmall.jsonc +1 -1
- package/scripts/bundle-skills.ts +1 -0
- package/scripts/check-workflow.test.ts +368 -0
- package/scripts/check.ts +2 -2
- package/scripts/eslint-file-length.mjs +9 -9
- package/scripts/eslint-report-guard.mjs +1 -1
- package/scripts/eslint-report-guard.test.mjs +1 -1
- package/scripts/harness-api.test.ts +7 -46
- package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
- package/scripts/rules-see-files.mjs +1 -1
- package/scripts/venue-corpus-schema.test.ts +39 -0
- package/scripts/venue-corpus-schema.ts +17 -0
- package/skills/argument-arc/scripts/headings.js +6 -4
- package/skills/cold-read-diff/scripts/cold-read.js +6 -4
- package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
- package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
- package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
- package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
- package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
- package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
- package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
- package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
- package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
- package/skills/study-accepted-papers/SKILL.md +28 -2
- package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -1
- package/skills/study-accepted-papers/papers.schema.json +427 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +302 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.js +383 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +485 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
- package/skills/verify-citations/scripts/bib-authors.js +6 -5
- package/skills/verify-citations/scripts/verify-cites.js +6 -5
- package/src/adapters/pdfjs/fill.test.ts +1 -1
- package/src/adapters/venue-corpus/index.test.ts +279 -0
- package/src/adapters/venue-corpus/index.ts +286 -0
- package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
- package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
- package/src/{cli.harness.mjs → cli-e2e.test.mjs} +108 -102
- package/src/cli.test.ts +1 -1
- package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
- package/src/domain/licence.test.ts +122 -0
- package/src/domain/licence.ts +95 -0
- package/src/domain/venue-corpus.ts +130 -0
- package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
- package/src/facts-file.test.ts +1 -1
- package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
- package/src/latex-log.test.ts +395 -0
- package/src/latex-log.ts +1 -1
- package/src/latex-loop.test.ts +553 -0
- package/src/latex-loop.ts +1 -1
- package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
- package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
- package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
- package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
- package/src/ports/venue-corpus-codec.ts +11 -0
- package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
- package/src/{structure.harness.ts → structure.test.ts} +12 -10
- package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
- package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
- package/scripts/check.harness.ts +0 -343
- package/scripts/harness-api.frozen.json +0 -41
- package/src/latex-log.harness.ts +0 -382
- package/src/latex-loop.harness.ts +0 -515
package/.github/workflows/ci.yml
CHANGED
|
@@ -465,6 +465,13 @@ jobs:
|
|
|
465
465
|
: "DIVERGE — this is the platform this job exists for");
|
|
466
466
|
'
|
|
467
467
|
|
|
468
|
+
# Shard 1 runs the harnesses (scripts/test.ts), and since vigiles 49 `--min=1` counts only
|
|
469
|
+
# files that RAN: without the agent binary all four skip and the shard fails (run 45346444793).
|
|
470
|
+
- name: the agent binary the harnesses drive
|
|
471
|
+
if: matrix.shard == 1
|
|
472
|
+
run: npm i -g @anthropic-ai/claude-code
|
|
473
|
+
timeout-minutes: 3
|
|
474
|
+
|
|
468
475
|
# Issue #9: `npm test` was red ONLY on macOS.
|
|
469
476
|
- name: npm test (macOS), shard ${{ matrix.shard }} of 2
|
|
470
477
|
run: npm test -- --shard=${{ matrix.shard }}/2
|
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- vigiles:sha256:
|
|
1
|
+
<!-- vigiles:sha256:b9266075626f0285 compiled from CLAUDE.md.spec.ts -->
|
|
2
2
|
|
|
3
3
|
# CLAUDE.md
|
|
4
4
|
|
|
@@ -46,7 +46,7 @@ Claude Code loads `add-venue` from `.claude/skills/` and Codex loads it from `.a
|
|
|
46
46
|
|
|
47
47
|
## Before leaving draft and before merge
|
|
48
48
|
|
|
49
|
-
While drafting, run `npm run test:changed` and `npm run lint`, and push `wip:` commits to the draft. `npm run test:changed` runs only the tests that import what the branch changed (109 s, measured; a change to `package.json` or the vitest config runs them all, 159 s with the report), then prints the changed files that are not at 100% coverage, with their uncovered lines: read it before leaving draft. It is a report, not a gate, because some lines are reached only by the harnesses or e2e suites it does not run (`scripts/test.ts`). Leave draft once both pass and any review asked for on the draft (a Codex review, for one) has nothing left to fix: leaving draft starts CI, every later push to the ready PR runs it again, and every gate of `npm run check` has a CI job (`scripts/check.
|
|
49
|
+
While drafting, run `npm run test:changed` and `npm run lint`, and push `wip:` commits to the draft. `npm run test:changed` runs only the tests that import what the branch changed (109 s, measured; a change to `package.json` or the vitest config runs them all, 159 s with the report), then prints the changed files that are not at 100% coverage, with their uncovered lines: read it before leaving draft. It is a report, not a gate, because some lines are reached only by the harnesses or e2e suites it does not run (`scripts/test.ts`). Leave draft once both pass and any review asked for on the draft (a Codex review, for one) has nothing left to fix: leaving draft starts CI, every later push to the ready PR runs it again, and every gate of `npm run check` has a CI job (`scripts/check-workflow.test.ts`), so CI is the gate. On red CI, fix it on the branch and push; merge on green CI at the current head. Run `npm run check` locally to debug one gate, or when `scripts/check.ts` itself changes (2026-11-08: 11 full local runs, ~127 min, each followed by a CI run that repeated it). `npm run lint` caches (`node_modules/.cache/eslint/`, 45 s → 3 s warm): a cached file is not re-judged when only a file it reads or imports changed (a preset, the build facts, an imported type), so a result that looks stale is checked with `rm -rf node_modules/.cache/eslint`; CI starts without the cache. Red first · assert the whole value · no test touches the real network · 100% coverage, no `c8 ignore`. In a container without TeX Live, only the TeX e2e gate fails, and it says so; `npx paperlint toolchain` installs it.
|
|
50
50
|
|
|
51
51
|
## Commits
|
|
52
52
|
|
|
@@ -121,6 +121,10 @@ Before writing machinery, **run the thing you are about to replace and paste its
|
|
|
121
121
|
|
|
122
122
|
**Guidance only** — Every check — lint rule, script, hook, harness — fires on a planted defect AND stays quiet on a clean fixture, and the test goes red before the fix lands. A check only ever seen quiet is indistinguishable from a dead one. [Details](docs/testing.md)
|
|
123
123
|
|
|
124
|
+
### Every Prescribed File Is Linted
|
|
125
|
+
|
|
126
|
+
**Guidance only** — Every file or folder paperlint prescribes to a project (a name a command or skill writes, or a doc tells the author to keep) has its names held by its family's `allowed-files-only` rule and its contents by a schema that a `record` rule reads, so a stray file or a misspelt key is a finding, not a silent pass. A file held only by prose or by a command at run time is a gap with an open issue. The audit of 2026-11-24 found most prescribed files only partly held; each gap's issue is linked from #516. The author asked for this on 2026-11-24.
|
|
127
|
+
|
|
124
128
|
### Never The Callers Cwd
|
|
125
129
|
|
|
126
130
|
**Guidance only** — No program this package ships (`bin/`, `lib/`, hooks, skill scripts) depends on the directory it is started from: resolve from `git rev-parse --show-toplevel` or from the module's own location.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -50,7 +50,7 @@ report and listed as skipped, never counted as passed. The e2e areas also run al
|
|
|
50
50
|
Each gate's command is listed in `scripts/check.ts`; run one of them directly while iterating on
|
|
51
51
|
one rule. They are not what you run before pushing.
|
|
52
52
|
|
|
53
|
-
**The list of gates cannot quietly fall behind CI.** `scripts/check.
|
|
53
|
+
**The list of gates cannot quietly fall behind CI.** `scripts/check-workflow.test.ts` pulls the job
|
|
54
54
|
names out of `.github/workflows/ci.yml` and requires each to be either reproduced by a gate or
|
|
55
55
|
named with a reason for why it cannot be. Add a job and it goes red the same day, naming the job
|
|
56
56
|
nobody covered — verified by adding a `windows` job and watching it fail.
|
|
@@ -199,7 +199,7 @@ A venue is a **preset**, a JSONC file in `presets/`, validated by
|
|
|
199
199
|
markers is written by `npm run build && npx eslint --fix presets/` (the config loads the rule from
|
|
200
200
|
`dist/`).
|
|
201
201
|
3. **A test.** A case in `src/presets.test.ts` that `paperlint:<series>-<year>` resolves over its family with
|
|
202
|
-
the kinds you declared; `src/tex-requirements.
|
|
202
|
+
the kinds you declared; `src/tex-requirements-tables.test.ts` already checks every shipped preset
|
|
203
203
|
against the schema.
|
|
204
204
|
|
|
205
205
|
`paperlint toolchain` picks the new preset's packages up by itself, and the README and
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Run: `npx vigiles test action.harness.mjs`
|
|
2
|
+
* Test over `action.yml` and the guard it calls.
|
|
4
3
|
*
|
|
5
|
-
* 🔴 WHAT IT REFUSES TO BE. A
|
|
4
|
+
* 🔴 WHAT IT REFUSES TO BE. A test that greps `action.yml` for `--no-config-lookup` would pass
|
|
6
5
|
* on a file where the flag sits inside a comment, and would say nothing about whether the action
|
|
7
6
|
* BEHAVES. So: the YAML is read with a PARSER (`js-yaml`) and addressed as nodes, and the
|
|
8
7
|
* green-zero guard is exercised by CALLING it on fixtures — the same entry point the action calls.
|
|
@@ -11,6 +10,7 @@
|
|
|
11
10
|
* A guard only ever observed silent is indistinguishable from a dead one.
|
|
12
11
|
*/
|
|
13
12
|
import assert from "node:assert/strict";
|
|
13
|
+
import { it } from "vitest";
|
|
14
14
|
import {
|
|
15
15
|
readFileSync,
|
|
16
16
|
writeFileSync,
|
|
@@ -28,85 +28,92 @@ const HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
28
28
|
const TMP = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-action-")));
|
|
29
29
|
const action = yaml.load(readFileSync(join(HERE, "action.yml"), "utf8"));
|
|
30
30
|
|
|
31
|
-
// ── I. SHAPE, read as nodes ───────────────────────────────────────────────────────────────────
|
|
32
|
-
assert.equal(action.runs.using, "composite", "the action must be composite");
|
|
33
31
|
const names = action.runs.steps.map((s) => s.name);
|
|
34
|
-
|
|
35
|
-
action.runs.steps.length,
|
|
36
|
-
4,
|
|
37
|
-
`expected 4 steps, got ${action.runs.steps.length}: ${names}`,
|
|
38
|
-
);
|
|
32
|
+
const eslintStep = action.runs.steps.find((s) => s.name === "paperlint lint");
|
|
39
33
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
assert.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
assert.ok(hooksStep, `no hooks step among: ${names}`);
|
|
50
|
-
assert.equal(
|
|
51
|
-
hooksStep.if,
|
|
52
|
-
"inputs.check-hooks == 'true'",
|
|
53
|
-
"the hooks step runs only when asked",
|
|
54
|
-
);
|
|
55
|
-
assert.match(
|
|
56
|
-
hooksStep.run,
|
|
57
|
-
/npx paperlint doctor/,
|
|
58
|
-
"the hooks step runs `paperlint doctor`",
|
|
59
|
-
);
|
|
60
|
-
assert.equal(
|
|
61
|
-
action.runs.steps.at(-1),
|
|
62
|
-
hooksStep,
|
|
63
|
-
"the hooks step comes after the lint step, so a failing doctor never hides the lint report",
|
|
64
|
-
);
|
|
34
|
+
// ── I. SHAPE, read as nodes ───────────────────────────────────────────────────────────────────
|
|
35
|
+
it("I. SHAPE, read as nodes", () => {
|
|
36
|
+
assert.equal(action.runs.using, "composite", "the action must be composite");
|
|
37
|
+
assert.equal(
|
|
38
|
+
action.runs.steps.length,
|
|
39
|
+
4,
|
|
40
|
+
`expected 4 steps, got ${action.runs.steps.length}: ${names}`,
|
|
41
|
+
);
|
|
65
42
|
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
// `check-hooks` is OFF unless asked for, and when on it runs `paperlint doctor` — the command whose
|
|
44
|
+
// exit code (2 for partly wired or doubled hooks, src/doctor.ts) is the verdict — and nothing else.
|
|
45
|
+
const hooksInput = action.inputs["check-hooks"];
|
|
46
|
+
assert.ok(hooksInput, "the action must take a `check-hooks` input");
|
|
47
|
+
assert.equal(
|
|
48
|
+
hooksInput.default,
|
|
49
|
+
"false",
|
|
50
|
+
"`check-hooks` must default to off",
|
|
51
|
+
);
|
|
52
|
+
assert.equal(hooksInput.required, false);
|
|
53
|
+
const hooksStep = action.runs.steps.find(
|
|
54
|
+
(s) => s.name === "paperlint doctor (hooks fully wired)",
|
|
55
|
+
);
|
|
56
|
+
assert.ok(hooksStep, `no hooks step among: ${names}`);
|
|
57
|
+
assert.equal(
|
|
58
|
+
hooksStep.if,
|
|
59
|
+
"inputs.check-hooks == 'true'",
|
|
60
|
+
"the hooks step runs only when asked",
|
|
61
|
+
);
|
|
62
|
+
assert.match(
|
|
63
|
+
hooksStep.run,
|
|
64
|
+
/npx paperlint doctor/,
|
|
65
|
+
"the hooks step runs `paperlint doctor`",
|
|
66
|
+
);
|
|
67
|
+
assert.equal(
|
|
68
|
+
action.runs.steps.at(-1),
|
|
69
|
+
hooksStep,
|
|
70
|
+
"the hooks step comes after the lint step, so a failing doctor never hides the lint report",
|
|
71
|
+
);
|
|
68
72
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
//
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
73
|
+
assert.ok(eslintStep, `no step named "paperlint lint" among: ${names}`);
|
|
74
|
+
|
|
75
|
+
// 🔴 THE ACTION MUST CALL THE PACKAGE'S OWN CLI, NOT ESLINT. This is not tidiness: while the step
|
|
76
|
+
// invoked `npx eslint` directly it was a SECOND implementation of the same job, and it had already
|
|
77
|
+
// drifted — the directory-structure check (a paper directory with no PIPELINE-STATUS.md gets zero
|
|
78
|
+
// rules and reports clean) lives in `bin/paperlint.mjs`, so in CI it did not run at all. Any future edit
|
|
79
|
+
// that reaches past the CLI reintroduces exactly that gap, silently and greenly.
|
|
80
|
+
assert.match(
|
|
81
|
+
eslintStep.run,
|
|
82
|
+
/npx paperlint lint/,
|
|
83
|
+
"the lint step must call this package's own CLI — invoking eslint directly bypasses the settings and the structure check",
|
|
84
|
+
);
|
|
85
|
+
assert.doesNotMatch(
|
|
86
|
+
eslintStep.run,
|
|
87
|
+
/npx eslint/,
|
|
88
|
+
"the lint step must not invoke eslint directly — that is the bypass this step was fixed to remove",
|
|
89
|
+
);
|
|
90
|
+
// `--no-config-lookup` is deliberately absent and is NOT missing: the CLI builds its config with
|
|
91
|
+
// `overrideConfigFile: true`, so a consumer's nested config cannot reach the run. The guarantee
|
|
92
|
+
// moved from a flag into the code — assert the code, not the flag.
|
|
93
|
+
//
|
|
94
|
+
// 🔴 AND ASSERT IT IN THE FILE THAT HOLDS IT. This read said `bin/paperlint.mjs` until the CLI moved to
|
|
95
|
+
// TypeScript; `bin/paperlint.mjs` is now a loader shim and contains no such call, so the assertion went
|
|
96
|
+
// red on a move that changed no behaviour. That redness is the point — the same assertion written
|
|
97
|
+
// as a grep over "the CLI" would have kept passing against whichever file still matched, which is
|
|
98
|
+
// how a check quietly stops watching its subject.
|
|
99
|
+
assert.match(
|
|
100
|
+
readFileSync(new URL("./src/cli.ts", import.meta.url), "utf8"),
|
|
101
|
+
/overrideConfigFile:\s*true/,
|
|
102
|
+
"the CLI must pin its own config, or a consumer's nested config silently changes the rule set",
|
|
103
|
+
);
|
|
104
|
+
// The redirect into a report file is only sound while `--json` keeps stdout clean.
|
|
105
|
+
assert.match(
|
|
106
|
+
eslintStep.run,
|
|
107
|
+
/--json > "\$RUNNER_TEMP\/paperlint-report\.json"/,
|
|
108
|
+
"the machine-readable report must be redirected whole — it is what the guard reads",
|
|
109
|
+
);
|
|
110
|
+
// The guard must be CALLED, and by file — an inline blob would be untestable.
|
|
111
|
+
assert.match(
|
|
112
|
+
eslintStep.run,
|
|
113
|
+
/eslint-report-guard\.mjs/,
|
|
114
|
+
"the lint step must hand its report to scripts/eslint-report-guard.mjs",
|
|
115
|
+
);
|
|
116
|
+
});
|
|
110
117
|
// ── I-b. THE STEP'S SHELL SEMANTICS, EXECUTED — not grepped ───────────────────────────────────
|
|
111
118
|
//
|
|
112
119
|
// 🔴 THE ASSERTION THAT STOOD HERE READ THE TEXT (`/RC=\$\?/`) AND WAS GREEN OVER A DEAD ERROR
|
|
@@ -153,7 +160,7 @@ const stubbedStepRun = (stubRc, paths = ".") => {
|
|
|
153
160
|
};
|
|
154
161
|
|
|
155
162
|
// FIRES-THROUGH: ESLint failed. This is the case the old text assertion could not see.
|
|
156
|
-
{
|
|
163
|
+
it("FIRES-THROUGH: ESLint failed, the guard still runs and the code comes through", () => {
|
|
157
164
|
const r = stubbedStepRun(2);
|
|
158
165
|
assert.match(
|
|
159
166
|
r.stdout,
|
|
@@ -165,9 +172,9 @@ const stubbedStepRun = (stubRc, paths = ".") => {
|
|
|
165
172
|
2,
|
|
166
173
|
"ESLint's failure code must come through the guard, not be masked to 1",
|
|
167
174
|
);
|
|
168
|
-
}
|
|
175
|
+
});
|
|
169
176
|
// QUIET HALF: ESLint succeeded — the guard runs and passes 0 through.
|
|
170
|
-
{
|
|
177
|
+
it("QUIET HALF: ESLint succeeded, the guard runs and passes 0 through", () => {
|
|
171
178
|
const r = stubbedStepRun(0);
|
|
172
179
|
assert.match(
|
|
173
180
|
r.stdout,
|
|
@@ -175,43 +182,47 @@ const stubbedStepRun = (stubRc, paths = ".") => {
|
|
|
175
182
|
"the guard must run on success too",
|
|
176
183
|
);
|
|
177
184
|
assert.equal(r.status, 0, "a clean run must stay green");
|
|
178
|
-
}
|
|
185
|
+
});
|
|
179
186
|
|
|
180
187
|
// texcount is checked for EXISTENCE, not by the installer's exit code: an installer can put nothing
|
|
181
188
|
// in place and report success (measured in this corpus, 2026-09-01).
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
assert.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
it("texcount is checked for existence, and the action takes its inputs", () => {
|
|
190
|
+
const pathStep = action.runs.steps.find((s) => /on PATH/i.test(s.name ?? ""));
|
|
191
|
+
assert.ok(pathStep, `no step verifying texcount is on PATH among: ${names}`);
|
|
192
|
+
assert.match(
|
|
193
|
+
pathStep.run,
|
|
194
|
+
/command -v texcount/,
|
|
195
|
+
"the PATH step must probe the binary itself",
|
|
196
|
+
);
|
|
189
197
|
|
|
190
|
-
for (const key of [
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
])
|
|
197
|
-
|
|
198
|
+
for (const key of [
|
|
199
|
+
"config",
|
|
200
|
+
"paths",
|
|
201
|
+
"max-warnings",
|
|
202
|
+
"texcount",
|
|
203
|
+
"working-directory",
|
|
204
|
+
])
|
|
205
|
+
assert.ok(action.inputs[key], `input \`${key}\` is missing`);
|
|
206
|
+
});
|
|
198
207
|
|
|
199
208
|
// ── `paths` is OPTIONAL: with none, the CLI lints the papersDir its paperlint.json declares ──────
|
|
200
209
|
// `paperlint lint` with no path finds the root paperlint.json and lints its `papersDir`, so that is
|
|
201
210
|
// the normal call and the action must not refuse it. What is asserted is the behaviour: the real
|
|
202
211
|
// `run:` block, handed an empty `paths`, calls the CLI with no path argument at all, and the guard
|
|
203
212
|
// still runs over what the CLI reported.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
it("`paths` is OPTIONAL: declared, not required", () => {
|
|
214
|
+
assert.equal(
|
|
215
|
+
action.inputs.paths.required,
|
|
216
|
+
false,
|
|
217
|
+
"`paths` must be optional — the CLI finds papersDir itself",
|
|
218
|
+
);
|
|
219
|
+
assert.equal(
|
|
220
|
+
action.inputs.paths.default,
|
|
221
|
+
"",
|
|
222
|
+
"`paths` must default to empty, which means: the papersDir of paperlint.json",
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
|
+
it("an empty `paths` runs clean and the CLI gets no path argument", () => {
|
|
215
226
|
const r = stubbedStepRun(0, "");
|
|
216
227
|
assert.equal(r.status, 0, `an empty \`paths\` must run clean: ${r.stderr}`);
|
|
217
228
|
assert.deepEqual(
|
|
@@ -220,8 +231,8 @@ assert.equal(
|
|
|
220
231
|
"with no `paths` the CLI must get no path argument — not an empty string, not `.`",
|
|
221
232
|
);
|
|
222
233
|
assert.match(r.stdout, /linted 1 file\(s\)/, "the guard must still run");
|
|
223
|
-
}
|
|
224
|
-
{
|
|
234
|
+
});
|
|
235
|
+
it("named paths are handed to the CLI one argument each", () => {
|
|
225
236
|
stubbedStepRun(0, "papers/a papers/b");
|
|
226
237
|
assert.deepEqual(
|
|
227
238
|
readFileSync(join(TMP, "npx-args"), "utf8").trim().split("\n"),
|
|
@@ -235,7 +246,7 @@ assert.equal(
|
|
|
235
246
|
],
|
|
236
247
|
"named paths are handed to the CLI one argument each",
|
|
237
248
|
);
|
|
238
|
-
}
|
|
249
|
+
});
|
|
239
250
|
|
|
240
251
|
// ── II. BEHAVIOUR of the guard — both halves, on fixtures ─────────────────────────────────────
|
|
241
252
|
const fixture = (name, body) => {
|
|
@@ -245,7 +256,7 @@ const fixture = (name, body) => {
|
|
|
245
256
|
};
|
|
246
257
|
|
|
247
258
|
// FIRES: zero files linted. The whole reason the guard exists.
|
|
248
|
-
{
|
|
259
|
+
it("FIRES: zero files linted", () => {
|
|
249
260
|
const { code, lines } = guard(fixture("empty.json", "[]"), 0, {
|
|
250
261
|
paths: ".",
|
|
251
262
|
config: "c.mjs",
|
|
@@ -256,9 +267,9 @@ const fixture = (name, body) => {
|
|
|
256
267
|
"a report of zero linted files must FAIL, not pass as clean",
|
|
257
268
|
);
|
|
258
269
|
assert.match(lines.join("\n"), /linted ZERO files/);
|
|
259
|
-
}
|
|
270
|
+
});
|
|
260
271
|
// With no paths given, the guard names where the scope came from instead of printing `paths=`.
|
|
261
|
-
{
|
|
272
|
+
it("with no paths given, the guard names where the scope came from", () => {
|
|
262
273
|
const { lines } = guard(fixture("empty2.json", "[]"), 0, {
|
|
263
274
|
paths: "",
|
|
264
275
|
config: "paperlint.json",
|
|
@@ -268,26 +279,28 @@ const fixture = (name, body) => {
|
|
|
268
279
|
/paths=\(none: the papersDir of paperlint\.json\)/,
|
|
269
280
|
"an empty paths value must be named as the papersDir, not printed blank",
|
|
270
281
|
);
|
|
271
|
-
}
|
|
282
|
+
});
|
|
272
283
|
// FIRES: the report is absent or unparsable — nothing was measured either way.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
it("FIRES: the report is absent or unparsable", () => {
|
|
285
|
+
assert.equal(
|
|
286
|
+
guard(join(TMP, "absent.json"), 0).code,
|
|
287
|
+
1,
|
|
288
|
+
"an unreadable report must FAIL",
|
|
289
|
+
);
|
|
290
|
+
assert.equal(
|
|
291
|
+
guard(fixture("garbage.json", "{oops"), 0).code,
|
|
292
|
+
1,
|
|
293
|
+
"an unparsable report must FAIL",
|
|
294
|
+
);
|
|
295
|
+
assert.equal(
|
|
296
|
+
guard(fixture("object.json", '{"not":"an array"}'), 0).code,
|
|
297
|
+
1,
|
|
298
|
+
"a report that is not a result array must FAIL",
|
|
299
|
+
);
|
|
300
|
+
});
|
|
288
301
|
|
|
289
302
|
// QUIET: files were linted and ESLint was happy → ESLint's code passes through untouched.
|
|
290
|
-
{
|
|
303
|
+
it("QUIET: files were linted and ESLint was happy", () => {
|
|
291
304
|
const one = fixture(
|
|
292
305
|
"one.json",
|
|
293
306
|
JSON.stringify([
|
|
@@ -309,9 +322,9 @@ assert.equal(
|
|
|
309
322
|
2,
|
|
310
323
|
"a real run must pass ESLint's failure code through, not mask it",
|
|
311
324
|
);
|
|
312
|
-
}
|
|
325
|
+
});
|
|
313
326
|
// QUIET: a file linted with NO findings is a legitimate clean run — the guard must not fire on it.
|
|
314
|
-
{
|
|
327
|
+
it("QUIET: a file linted with no findings is a clean run", () => {
|
|
315
328
|
const clean = fixture(
|
|
316
329
|
"clean.json",
|
|
317
330
|
JSON.stringify([{ filePath: "/x/a.md", messages: [] }]),
|
|
@@ -324,8 +337,4 @@ assert.equal(
|
|
|
324
337
|
);
|
|
325
338
|
assert.doesNotMatch(lines.join("\n"), /linted ZERO files/);
|
|
326
339
|
assert.match(lines.join("\n"), /linted 1 file\(s\) · 0 finding\(s\)/);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
console.log(
|
|
330
|
-
"✓ action.yml shape (parsed, not grepped) + guard behaviour, both halves",
|
|
331
|
-
);
|
|
340
|
+
});
|