paperlint 19.0.2 → 19.0.3
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/CLAUDE.md +2 -2
- package/dist/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/CLAUDE.md.spec.js +7 -1
- package/dist/CLAUDE.md.spec.js.map +1 -1
- package/dist/cli.d.ts +2 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +45 -93
- package/dist/cli.js.map +1 -1
- package/dist/doctor.d.ts +8 -10
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +27 -37
- package/dist/doctor.js.map +1 -1
- package/dist/hooks-notice.d.ts +8 -2
- package/dist/hooks-notice.d.ts.map +1 -1
- package/dist/hooks-notice.js +15 -20
- package/dist/hooks-notice.js.map +1 -1
- package/dist/hooks-settings.d.ts +1 -1
- package/dist/hooks-settings.js +1 -1
- package/dist/init.d.ts +1 -1
- package/dist/init.js +5 -5
- package/dist/lib/paper-config.d.ts +4 -9
- package/dist/lib/paper-config.d.ts.map +1 -1
- package/dist/lib/paper-config.js +4 -9
- package/dist/lib/paper-config.js.map +1 -1
- package/dist/papers-roots.d.ts +19 -0
- package/dist/papers-roots.d.ts.map +1 -0
- package/dist/papers-roots.js +42 -0
- package/dist/papers-roots.js.map +1 -0
- package/dist/retired-hooks.d.ts +6 -0
- package/dist/retired-hooks.d.ts.map +1 -0
- package/dist/retired-hooks.js +34 -0
- package/dist/retired-hooks.js.map +1 -0
- package/dist/skill-chunks/chunk-C2G5EK7S.js +579 -0
- package/dist/skill-chunks/{chunk-UL4INX2P.js → chunk-L3NJUJUP.js} +446 -446
- package/dist/skill-chunks/{chunk-EOVEVX67.js → chunk-X4VKG4KT.js} +1 -1
- package/dist/types.d.ts +1 -1
- package/docs/install.md +9 -11
- package/docs/layout.md +2 -4
- package/docs/rules/paper/allowed-files-only.md +1 -2
- package/docs/testing.md +1 -1
- package/eslint.config.mjs +1 -1
- package/lib/paper-config.harness.mjs +3 -6
- package/lib/paper-config.ts +4 -9
- package/package.json +2 -3
- package/plugin/hooks/hooks.json +0 -13
- package/scripts/coverage-config.test.ts +0 -1
- package/scripts/eslint-file-length.mjs +0 -1
- package/skills/argument-arc/scripts/headings.js +2 -2
- package/skills/build-label-page/scripts/label-page.js +125 -125
- package/skills/cold-read-diff/scripts/cold-read.js +11 -11
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +3 -3
- package/skills/paper-status/SKILL.md +1 -2
- package/skills/paper-status/SKILL.md.spec.ts +0 -1
- package/skills/pc-panel-review/scripts/prior-reviews.js +1 -1
- package/skills/verify-citations/scripts/bib-authors.js +3 -3
- package/skills/verify-citations/scripts/verify-cites.js +3 -3
- package/src/CLAUDE.md +16 -1
- package/src/CLAUDE.md.spec.ts +12 -1
- package/src/cli.harness.mjs +14 -79
- package/src/cli.test.ts +4 -34
- package/src/cli.ts +47 -140
- package/src/doctor.harness.mjs +17 -59
- package/src/doctor.test.ts +1 -1
- package/src/doctor.ts +26 -41
- package/src/domain/paper-folder.test.ts +1 -1
- package/src/hooks-notice.test.ts +21 -74
- package/src/hooks-notice.ts +30 -20
- package/src/hooks-settings.harness.ts +25 -27
- package/src/hooks-settings.ts +1 -1
- package/src/in-process-hooks.test.ts +18 -0
- package/src/init.ts +5 -5
- package/src/lint-edited-site-example.test.ts +0 -3
- package/src/papers-roots.test.ts +56 -0
- package/src/papers-roots.ts +56 -0
- package/src/retired-hooks.test.ts +155 -0
- package/src/retired-hooks.ts +41 -0
- package/src/types.ts +1 -1
- package/dist/skill-chunks/chunk-GRSXIWYF.js +0 -352
- package/hooks/CLAUDE.md +0 -34
- package/hooks/CLAUDE.md.spec.ts +0 -30
- package/hooks/hooks.harness.ts +0 -566
- package/hooks/paper-edit-guard.hook.d.mts +0 -12
- package/hooks/paper-edit-guard.hook.mjs +0 -443
- package/hooks/paper-edit-guard.test.ts +0 -66
- package/hooks/paper-skills-nudge.hook.d.mts +0 -22
- package/hooks/paper-skills-nudge.hook.mjs +0 -193
- package/hooks/paper-skills-nudge.test.ts +0 -122
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- vigiles:sha256:
|
|
1
|
+
<!-- vigiles:sha256:5f17988324cc5bd4 compiled from CLAUDE.md.spec.ts -->
|
|
2
2
|
|
|
3
3
|
# CLAUDE.md
|
|
4
4
|
|
|
@@ -36,7 +36,7 @@ Claude Code loads `add-venue` from `.claude/skills/` and Codex loads it from `.a
|
|
|
36
36
|
| when you are… | read | holds |
|
|
37
37
|
| --- | --- | --- |
|
|
38
38
|
| writing a lint rule, or a check that judges prose | [`eslint-rules/CLAUDE.md`](eslint-rules/CLAUDE.md) | lint rule over script, what holds each requirement of a new rule, the five writing principles |
|
|
39
|
-
| writing or changing a hook | [`
|
|
39
|
+
| writing or changing a hook | [`src/CLAUDE.md`](src/CLAUDE.md) | how hooks run and are wired, and why the in-process table is frozen |
|
|
40
40
|
| writing or changing a skill | [`skills/CLAUDE.md`](skills/CLAUDE.md) | how skills ship |
|
|
41
41
|
| in `src/` | [`src/CLAUDE.md`](src/CLAUDE.md) | the two layer axes |
|
|
42
42
|
| thinking of a Claude Code plugin | [`plugin/CLAUDE.md`](plugin/CLAUDE.md) | why there is none, and what must be measured to bring it back |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../src/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAGA,
|
|
1
|
+
{"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../src/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAGA,wBAkFG"}
|
package/dist/CLAUDE.md.spec.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Compiled to src/CLAUDE.md by `npx vigiles compile`. Edit THIS file, never the markdown.
|
|
2
|
-
import { enforce, file, instructionFile, prose } from "vigiles/spec";
|
|
2
|
+
import { enforce, file, guidance, instructionFile, prose } from "vigiles/spec";
|
|
3
3
|
export default instructionFile({
|
|
4
4
|
sections: {
|
|
5
5
|
"`src/`": prose `The package's TypeScript: the CLI, the build, the toolchain installer, and the measuring that feeds
|
|
@@ -56,8 +56,14 @@ report nothing — dropping it turns the fixtures \`src/domain/reads-disk.ts\` a
|
|
|
56
56
|
"Readers and commands": prose `\`@retorquere/bibtex-parser\` is the one \`.bib\` reader, behind ${file("src/ports/bib-reader.ts")}.
|
|
57
57
|
Rejected on 2026-09-27, so not proposed again: a separate \`paperlint refs\` command; the slowness it
|
|
58
58
|
would have moved was a cache thrown away after every build (${file("docs/references.md")}).`,
|
|
59
|
+
Hooks: prose `The Claude Code hooks paperlint ships (\`submission-confirm\`, \`paper-folder-layout\`,
|
|
60
|
+
\`lint-edited\`) are app functions in \`src/*-hook.ts\`, run in-process by \`paperlint hook <name>\` from the
|
|
61
|
+
\`IN_PROCESS_HOOKS\` table in ${file("src/cli.ts")}. A bug in one does not break this repository; it breaks
|
|
62
|
+
somebody else's session.`,
|
|
59
63
|
},
|
|
60
64
|
rules: {
|
|
65
|
+
"one-wiring-file": guidance("The wiring is `plugin/hooks/hooks.json`. The Claude Code plugin ships it as its hooks, and `paperlint init` without the plugin merges it into the consumer's `.claude/settings.json`; there is no second copy."),
|
|
66
|
+
"in-process-hooks-frozen": guidance("`IN_PROCESS_HOOKS` is a workaround: a vigiles hook program may import only `vigiles/hook`, so a hook that needs this package's code was routed around the runtime. Do not add or grow an entry; the way out is zernie/vigiles#472, then #650, which moves the hooks to `hooks/<name>.hook.mjs`. `src/in-process-hooks.test.ts` fails when a name is added. Rejected for that move, so not proposed again: a `.hook.ts` hook (it does not load from `node_modules`), and a thin consumer-side `.hook.ts` importing the logic (`vigiles compile` refuses the import)."),
|
|
61
67
|
layers: enforce("eslint/boundaries/dependencies", "Both axes: what a layer may import, and where an effect may be written.", { render: "id" }),
|
|
62
68
|
"effect-globals": enforce("eslint/no-restricted-globals", "The process and fetch globals only where an effect may be written.", { render: "id" }),
|
|
63
69
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../src/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../src/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE/E,eAAe,eAAe,CAAC;IAC7B,QAAQ,EAAE;QACR,QAAQ,EAAE,KAAK,CAAA;;eAEJ;QAEX,oBAAoB,EAAE,KAAK,CAAA;oCACK,IAAI,CAAC,4BAA4B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCpE,IAAI,CAAC,gCAAgC,CAAC;;;;;;;;;;;;;+CAaO;QAE3C,sBAAsB,EAAE,KAAK,CAAA,oEAAoE,IAAI,CAAC,yBAAyB,CAAC;;8DAEtE,IAAI,CAAC,oBAAoB,CAAC,IAAI;QAExF,KAAK,EAAE,KAAK,CAAA;;gCAEgB,IAAI,CAAC,YAAY,CAAC;yBACzB;KACtB;IACD,KAAK,EAAE;QACL,iBAAiB,EAAE,QAAQ,CACzB,gNAAgN,CACjN;QACD,yBAAyB,EAAE,QAAQ,CACjC,qiBAAqiB,CACtiB;QACD,MAAM,EAAE,OAAO,CACb,gCAAgC,EAChC,yEAAyE,EACzE,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;QACD,gBAAgB,EAAE,OAAO,CACvB,8BAA8B,EAC9B,oEAAoE,EACpE,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;KACF;CACF,CAAC,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -117,17 +117,10 @@ export declare function readConfig(a: Args, { log, err, cwd, }?: {
|
|
|
117
117
|
err?: typeof console.error;
|
|
118
118
|
cwd?: string;
|
|
119
119
|
}): ConfigRead;
|
|
120
|
-
/** The papers directory field of the settings, read by its one declared name; the default when absent. */
|
|
121
|
-
export declare function papersDirOf(opts: PaperlintConfig): unknown;
|
|
122
120
|
/** The error for a papers directory that is missing or holds no paper. */
|
|
123
121
|
export declare const noPapersMessage: (dir: string) => string;
|
|
124
|
-
/** The
|
|
125
|
-
export declare const
|
|
126
|
-
opts: PaperlintConfig;
|
|
127
|
-
root: string;
|
|
128
|
-
}) => string[];
|
|
129
|
-
/** The papers directory may be one directory or several; both spellings normalise to a list. */
|
|
130
|
-
export declare function toPaths(papers: unknown): string[];
|
|
122
|
+
/** The names in `IN_PROCESS_HOOKS`, for the test that keeps the list from growing. */
|
|
123
|
+
export declare const IN_PROCESS_HOOK_NAMES: readonly string[];
|
|
131
124
|
/**
|
|
132
125
|
* The words after `submission` read by this CLI's own parser, as the command reads them: the paper
|
|
133
126
|
* and `--pdf` a send names, null for their defaults — or null when the words would not run cleanly
|
|
@@ -170,16 +163,6 @@ export declare function runHook(name: string | undefined, { err, stdin, out, ...
|
|
|
170
163
|
/** What `runHook` takes; every effect is injectable, so a test stages none of them. */
|
|
171
164
|
interface HookOptions {
|
|
172
165
|
readonly err?: typeof console.error;
|
|
173
|
-
/** Runs the hook with the terminal's streams: `spawnSync` is one. Only its status and stdout are read. */
|
|
174
|
-
readonly run?: (file: string, args: readonly string[], options: {
|
|
175
|
-
readonly stdio: "inherit" | readonly ["pipe", "pipe" | "inherit", "inherit"];
|
|
176
|
-
readonly input?: string;
|
|
177
|
-
readonly encoding?: "utf8";
|
|
178
|
-
}) => {
|
|
179
|
-
readonly status: number | null;
|
|
180
|
-
readonly stdout?: string | null;
|
|
181
|
-
};
|
|
182
|
-
readonly resolve?: (spec: string) => string;
|
|
183
166
|
/** The hook's payload, as Claude Code sends it on stdin. */
|
|
184
167
|
readonly stdin?: () => string;
|
|
185
168
|
/** Where an in-process hook's output goes: stdout, which Claude Code reads. */
|
|
@@ -193,8 +176,6 @@ interface HookOptions {
|
|
|
193
176
|
/** Whether the Claude Code plugin is on; the disk by default. */
|
|
194
177
|
readonly claude?: ClaudeCode;
|
|
195
178
|
}
|
|
196
|
-
/** The real spawner, narrowed to what `runHook` asks of it. */
|
|
197
|
-
export declare const spawnHook: NonNullable<HookOptions["run"]>;
|
|
198
179
|
/**
|
|
199
180
|
* Create one paper and lint it — shared by `paperlint new` and `paperlint init --paper`, so the two cannot
|
|
200
181
|
* become two implementations. The lint runs on THAT folder, so the first thing printed after the
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAe7C,OAAO,EAAE,MAAM,EAAE,MAAM,+CAA+C,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EACL,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EAAyB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAsErE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AA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AAC,EAAE,WAAW,CAAC;CACxB,GACL,OAAO,CAAC,MAAM,CAAC,CA2JjB"}
|
package/dist/cli.js
CHANGED
|
@@ -26,9 +26,7 @@
|
|
|
26
26
|
import { ESLint } from "eslint";
|
|
27
27
|
import { readFileSync, readdirSync, existsSync, realpathSync, statSync, } from "node:fs";
|
|
28
28
|
import { absolutePath } from "./domain/paths.js";
|
|
29
|
-
import { createRequire } from "node:module";
|
|
30
29
|
import { stripVTControlCharacters } from "node:util";
|
|
31
|
-
import { spawnSync } from "node:child_process";
|
|
32
30
|
import { fileURLToPath } from "node:url";
|
|
33
31
|
import { join, dirname, resolve, relative, basename, sep } from "node:path";
|
|
34
32
|
import markdown from "@eslint/markdown";
|
|
@@ -85,7 +83,7 @@ import { newPaper, reportNewPaper, STATUS_FILE, } from "./new-paper.js";
|
|
|
85
83
|
// The one source for the consumer's config key lives in lib/ (the ESLint rules and the skill scripts
|
|
86
84
|
// import it too). It is imported compiled, from dist/, the one path that resolves the same from src/
|
|
87
85
|
// and from dist/ — see CONTRIBUTING.md.
|
|
88
|
-
import { CONFIG_FILE,
|
|
86
|
+
import { CONFIG_FILE, PAPERS_DIR_FIELD, PAPER_ONLY_KEYS, SETTINGS_KEYS, findProjectRoot, } from "#lib/paper-config";
|
|
89
87
|
import { parseRuleBlocks, parseRuleEntries, shippedRuleIds, unknownKeys, } from "./rules-config.js";
|
|
90
88
|
export { init };
|
|
91
89
|
export { nextSteps } from "./init.js";
|
|
@@ -106,10 +104,12 @@ import { DRAFT_RULE_LEVELS, draftRules, submittedFrozenRules, VERSION_STATUS_RUL
|
|
|
106
104
|
import { FOLDER_VENUE_RULE_LEVELS, folderVenueRules, } from "./folder-venue-rule.js";
|
|
107
105
|
import { FOLDER_LAYOUT_RULE_LEVELS, folderLayoutRules, } from "./folder-layout-rule.js";
|
|
108
106
|
import { folderLayoutHook } from "./folder-layout-hook.js";
|
|
107
|
+
import { papersDirOf, papersRoots, toPaths } from "./papers-roots.js";
|
|
109
108
|
import { paperFolderOf, writtenPath } from "./domain/paper-folder.js";
|
|
110
109
|
import { papersReached } from "./domain/paper-dirs.js";
|
|
111
110
|
import { NOTICE_HOOKS, collector, lintLine, mergeNotice, noticeText, notYetTold, recordTold, hookNotRunningText, } from "./hooks-notice.js";
|
|
112
111
|
import { unwiredHooks } from "./hooks-settings.js";
|
|
112
|
+
import { RETIRED_HOOKS, retiredWired } from "./retired-hooks.js";
|
|
113
113
|
import { linkSkills, locatePackage, unlinkedSkills, } from "./link-skills.js";
|
|
114
114
|
import { projectInstall } from "./adapters/package-manager/index.js";
|
|
115
115
|
import { claudeCode } from "./adapters/claude-code/index.js";
|
|
@@ -1099,28 +1099,21 @@ export function readConfig(a, { log = console.log, err = console.error, cwd = pr
|
|
|
1099
1099
|
}
|
|
1100
1100
|
return { opts: settings.value, configPath, root };
|
|
1101
1101
|
}
|
|
1102
|
-
/** The papers directory field of the settings, read by its one declared name; the default when absent. */
|
|
1103
|
-
export function papersDirOf(opts) {
|
|
1104
|
-
const declared = opts.papersDir;
|
|
1105
|
-
return declared === undefined ? DEFAULT_PAPERS_ROOT : declared;
|
|
1106
|
-
}
|
|
1107
1102
|
/** The error for a papers directory that is missing or holds no paper. */
|
|
1108
1103
|
export const noPapersMessage = (dir) => `no papers in ${dir}/ — create one with \`npx paperlint new <name>\`, or set "${PAPERS_DIR_FIELD}" ` +
|
|
1109
1104
|
`in ${CONFIG_FILE} if your papers live elsewhere`;
|
|
1110
|
-
/** The papers directories of a read config, absolute: each relative to the project root. */
|
|
1111
|
-
export const papersRoots = (cfg) => toPaths(papersDirOf(cfg.opts)).map((rel) => resolve(cfg.root, rel));
|
|
1112
|
-
/** The papers directory may be one directory or several; both spellings normalise to a list. */
|
|
1113
|
-
export function toPaths(papers) {
|
|
1114
|
-
if (typeof papers === "string")
|
|
1115
|
-
return papers.trim() ? [papers.trim()] : [];
|
|
1116
|
-
if (Array.isArray(papers))
|
|
1117
|
-
return papers.filter((x) => typeof x === "string" && x.trim() !== "");
|
|
1118
|
-
return [];
|
|
1119
|
-
}
|
|
1120
1105
|
/**
|
|
1121
1106
|
* Hooks that run inside this process instead of as a vigiles program, each because it must call the
|
|
1122
|
-
* package's own code (`src/folder-layout-hook.ts` says why for its one).
|
|
1123
|
-
*
|
|
1107
|
+
* package's own code (`src/folder-layout-hook.ts` says why for its one). Each exits 0; a gate
|
|
1108
|
+
* refuses through its JSON, and an advisory hook that fails says so on stderr.
|
|
1109
|
+
*
|
|
1110
|
+
* TODO(zernie/vigiles#472, zernie/paperlint#650): this table is a workaround, not a pattern. It
|
|
1111
|
+
* exists because a vigiles hook program may import only `vigiles/hook`, so a hook that needs this
|
|
1112
|
+
* package's code was routed around the runtime: it gets no capability check, no state and no
|
|
1113
|
+
* throttle, and the package ends up with two ways to run a hook. Do NOT add an entry and do not
|
|
1114
|
+
* grow one. A hook that needs the package's code waits for vigiles#472 (a hook may declare a module
|
|
1115
|
+
* of its own package); then every entry here moves to `hooks/<name>.hook.mjs` and the table is
|
|
1116
|
+
* deleted (#650). `src/in-process-hooks.test.ts` fails when a name is added.
|
|
1124
1117
|
*/
|
|
1125
1118
|
const IN_PROCESS_HOOKS = {
|
|
1126
1119
|
// Never in the way: whatever throws is one stderr line and exit 0 (src/lint-edited-hook.ts).
|
|
@@ -1164,6 +1157,8 @@ const IN_PROCESS_HOOKS = {
|
|
|
1164
1157
|
return said instanceof Promise ? said.then(write) : write(said);
|
|
1165
1158
|
},
|
|
1166
1159
|
};
|
|
1160
|
+
/** The names in `IN_PROCESS_HOOKS`, for the test that keeps the list from growing. */
|
|
1161
|
+
export const IN_PROCESS_HOOK_NAMES = Object.keys(IN_PROCESS_HOOKS);
|
|
1167
1162
|
/**
|
|
1168
1163
|
* The words after `submission` read by this CLI's own parser, as the command reads them: the paper
|
|
1169
1164
|
* and `--pdf` a send names, null for their defaults — or null when the words would not run cleanly
|
|
@@ -1261,20 +1256,6 @@ const defaultStdin = () => readFileSync(0, "utf8");
|
|
|
1261
1256
|
const defaultOut = (text) => {
|
|
1262
1257
|
process.stdout.write(text);
|
|
1263
1258
|
};
|
|
1264
|
-
/** The real spawner, narrowed to what `runHook` asks of it. */
|
|
1265
|
-
export const spawnHook = (file, args, o) => {
|
|
1266
|
-
const r = o.stdio === "inherit"
|
|
1267
|
-
? spawnSync(file, [...args], { stdio: "inherit" })
|
|
1268
|
-
: spawnSync(file, [...args], {
|
|
1269
|
-
stdio: [...o.stdio],
|
|
1270
|
-
input: o.input,
|
|
1271
|
-
encoding: "utf8",
|
|
1272
|
-
});
|
|
1273
|
-
return {
|
|
1274
|
-
status: r.status,
|
|
1275
|
-
stdout: typeof r.stdout === "string" ? r.stdout : null,
|
|
1276
|
-
};
|
|
1277
|
-
};
|
|
1278
1259
|
/** The project root the hooks are anchored to. */
|
|
1279
1260
|
const hookRoot = (io) => io.projectDir ?? process.env["CLAUDE_PROJECT_DIR"] ?? process.cwd();
|
|
1280
1261
|
/** This package's version, as its own manifest says. */
|
|
@@ -1287,9 +1268,10 @@ const packageVersion = () => z
|
|
|
1287
1268
|
*/
|
|
1288
1269
|
function owed(root, skillLinks, claude) {
|
|
1289
1270
|
if (installedPluginVersion(claude.plugin(absolutePath(root))) !== null)
|
|
1290
|
-
return { missing: [], byHand: false, skills: [] };
|
|
1271
|
+
return { missing: [], byHand: false, skills: [], retired: [] };
|
|
1291
1272
|
const { missing, byHand } = unwiredHooks(root);
|
|
1292
|
-
|
|
1273
|
+
const skills = unlinkedSkills(skillLinks(root));
|
|
1274
|
+
return { missing, byHand, skills, retired: retiredWired(root) };
|
|
1293
1275
|
}
|
|
1294
1276
|
/**
|
|
1295
1277
|
* The notice this hook owes the project, or null. Never throws and never speaks twice for one
|
|
@@ -1298,12 +1280,18 @@ function owed(root, skillLinks, claude) {
|
|
|
1298
1280
|
function pendingNotice(io) {
|
|
1299
1281
|
try {
|
|
1300
1282
|
const root = hookRoot(io);
|
|
1301
|
-
const { missing, byHand, skills } = owed(root, io.skillLinks ?? readSkillLinks, io.claude ?? claudeCode());
|
|
1283
|
+
const { missing, byHand, skills, retired } = owed(root, io.skillLinks ?? readSkillLinks, io.claude ?? claudeCode());
|
|
1302
1284
|
const version = io.version ?? packageVersion();
|
|
1303
|
-
return (missing.length === 0 &&
|
|
1285
|
+
return (missing.length === 0 &&
|
|
1286
|
+
skills.length === 0 &&
|
|
1287
|
+
retired.length === 0) ||
|
|
1304
1288
|
!notYetTold(nodeFiles, root, version)
|
|
1305
1289
|
? null
|
|
1306
|
-
: {
|
|
1290
|
+
: {
|
|
1291
|
+
text: noticeText(version, missing, byHand, { skills, retired }),
|
|
1292
|
+
root,
|
|
1293
|
+
version,
|
|
1294
|
+
};
|
|
1307
1295
|
}
|
|
1308
1296
|
catch (e) {
|
|
1309
1297
|
io.err(`paperlint: the unwired-hooks check did not run: ${firstLine(messageOf(e))}`);
|
|
@@ -1331,13 +1319,12 @@ function hooksLine(root, err, skillLinks, claude) {
|
|
|
1331
1319
|
// The report above is the verdict; this line is advice, and a broken settings read is not worth a second one.
|
|
1332
1320
|
}
|
|
1333
1321
|
}
|
|
1334
|
-
const after = (code, then) => typeof code === "number" ? then(code) : code.then(then);
|
|
1335
1322
|
/**
|
|
1336
1323
|
* The hook as always, with the notice added to what it printed — when its payload is about a paper's
|
|
1337
1324
|
* file. The payload is read once and handed on; anything outside a paper, or unreadable, runs the hook
|
|
1338
1325
|
* untouched and leaves the notice for the next edit that is about a paper.
|
|
1339
1326
|
*/
|
|
1340
|
-
function runHookWithNotice(name, notice, io) {
|
|
1327
|
+
async function runHookWithNotice(name, notice, io) {
|
|
1341
1328
|
const text = (() => {
|
|
1342
1329
|
try {
|
|
1343
1330
|
return io.stdin();
|
|
@@ -1348,21 +1335,18 @@ function runHookWithNotice(name, notice, io) {
|
|
|
1348
1335
|
})();
|
|
1349
1336
|
if (text === null)
|
|
1350
1337
|
return runHookPlain(name, io);
|
|
1351
|
-
const fed = { ...io, stdin: () => text
|
|
1338
|
+
const fed = { ...io, stdin: () => text };
|
|
1352
1339
|
if (!touchesAPaper(text))
|
|
1353
1340
|
return runHookPlain(name, fed);
|
|
1354
1341
|
const printed = collector();
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
io.out(merged !== null && remember(notice, io) ? merged : said);
|
|
1364
|
-
return code;
|
|
1365
|
-
});
|
|
1342
|
+
// The one hook that carries the notice (NOTICE_HOOKS) always exits 0 (`lintEditedHook`), so Claude
|
|
1343
|
+
// Code reads what it printed, and the notice can ride on it.
|
|
1344
|
+
const code = await runHookPlain(name, { ...fed, out: printed.write });
|
|
1345
|
+
const said = printed.text();
|
|
1346
|
+
const merged = mergeNotice(said, notice.text);
|
|
1347
|
+
// Remembered BEFORE it is said: a state that cannot be written must not make the notice repeat on every edit.
|
|
1348
|
+
io.out(merged !== null && remember(notice, io) ? merged : said);
|
|
1349
|
+
return code;
|
|
1366
1350
|
}
|
|
1367
1351
|
/** Records that the notice was given; false, with one stderr line, when it cannot be. */
|
|
1368
1352
|
function remember(notice, io) {
|
|
@@ -1375,48 +1359,16 @@ function remember(notice, io) {
|
|
|
1375
1359
|
return false;
|
|
1376
1360
|
}
|
|
1377
1361
|
}
|
|
1378
|
-
function runHookPlain(name, { err
|
|
1379
|
-
// The resolver is injected so that "the runtime was not found" is checked by an assert and not
|
|
1380
|
-
// by deleting node_modules: a failure must be reproducible, not staged.
|
|
1381
|
-
// 🔴 WE RESOLVE THE PACKAGE, NOT A FILE INSIDE IT. `require.resolve("vigiles/dist/cli.js")`
|
|
1382
|
-
// DOES NOT WORK: the package's `exports` map hands out only "." and nine named subpaths, and
|
|
1383
|
-
// `./dist/cli.js` — even `./package.json` — is not among them:
|
|
1384
|
-
// Package subpath './dist/cli.js' is not defined by "exports"
|
|
1385
|
-
// This is neither our oversight nor their bug: a closed export map is normal practice. So we
|
|
1386
|
-
// resolve the root entry ("." → dist/test.js), take its directory and put `cli.js` next to it —
|
|
1387
|
-
// the very file the package itself declares as its `bin`.
|
|
1388
|
-
resolve = (spec) => createRequire(import.meta.url).resolve(spec), stdin = defaultStdin, out = defaultOut, feed, capture = false, } = {}) {
|
|
1362
|
+
function runHookPlain(name, { err, stdin, out }) {
|
|
1389
1363
|
const inProcess = IN_PROCESS_HOOKS[name ?? ""];
|
|
1390
1364
|
if (inProcess !== undefined)
|
|
1391
1365
|
return inProcess({ err, stdin, out });
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
return
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
try {
|
|
1399
|
-
runtime = join(dirname(resolve("vigiles")), "cli.js");
|
|
1400
|
-
if (!existsSync(runtime))
|
|
1401
|
-
throw new Error(`resolved vigiles, but no cli.js beside it: ${runtime}`);
|
|
1402
|
-
}
|
|
1403
|
-
catch {
|
|
1404
|
-
err(`paperlint: the hook runtime (vigiles) is not resolvable from ${fileURLToPath(new URL(".", import.meta.url))}.\n` +
|
|
1405
|
-
`The \`${name}\` hook is NOT running. Everything else — \`paperlint lint\`, CI — is unaffected.\n` +
|
|
1406
|
-
`Reinstall this package so its dependencies are present.`);
|
|
1407
|
-
return 1; // not 2: that would deny every Bash command; not 0: nobody would see this
|
|
1408
|
-
}
|
|
1409
|
-
const args = [runtime, "hook-runtime", "run-program", program];
|
|
1410
|
-
const r = feed === undefined
|
|
1411
|
-
? run(process.execPath, args, { stdio: "inherit" })
|
|
1412
|
-
: run(process.execPath, args, {
|
|
1413
|
-
stdio: ["pipe", capture ? "pipe" : "inherit", "inherit"],
|
|
1414
|
-
input: feed,
|
|
1415
|
-
encoding: "utf8",
|
|
1416
|
-
});
|
|
1417
|
-
if (capture && typeof r.stdout === "string")
|
|
1418
|
-
out(r.stdout);
|
|
1419
|
-
return r.status ?? 0;
|
|
1366
|
+
// Removed on purpose, not mistyped: an entry `init` wrote before stays until `init` runs again, and
|
|
1367
|
+
// it fires on every tool call; `doctor` and the notice name it, so each call is silent.
|
|
1368
|
+
if (RETIRED_HOOKS.includes(name ?? ""))
|
|
1369
|
+
return 0;
|
|
1370
|
+
err(hookNotRunningText(name, packageVersion()));
|
|
1371
|
+
return 1; // not 2: that denies every Bash command, the fix included (#324); not 0: nobody sees it
|
|
1420
1372
|
}
|
|
1421
1373
|
/**
|
|
1422
1374
|
* Create one paper and lint it — shared by `paperlint new` and `paperlint init --paper`, so the two cannot
|
|
@@ -2008,7 +1960,7 @@ export async function run(argv, { log = console.log, err = console.error, cwd =
|
|
|
2008
1960
|
// an explicable one.
|
|
2009
1961
|
let results;
|
|
2010
1962
|
try {
|
|
2011
|
-
results = await eslint.lintFiles(paths);
|
|
1963
|
+
results = await eslint.lintFiles([...paths]);
|
|
2012
1964
|
}
|
|
2013
1965
|
catch (e) {
|
|
2014
1966
|
if (isEmptyLintSet(e))
|