paperlint 18.7.0 → 18.8.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/marketplace.json +11 -0
- package/.claude-plugin/plugin.json +7 -0
- package/CLAUDE.md +2 -2
- package/README.md +2 -2
- package/dist/adapters/claude-code/claude.io.d.ts +13 -0
- package/dist/adapters/claude-code/claude.io.d.ts.map +1 -0
- package/dist/adapters/claude-code/claude.io.js +68 -0
- package/dist/adapters/claude-code/claude.io.js.map +1 -0
- package/dist/adapters/claude-code/index.d.ts +4 -0
- package/dist/adapters/claude-code/index.d.ts.map +1 -0
- package/dist/adapters/claude-code/index.js +4 -0
- package/dist/adapters/claude-code/index.js.map +1 -0
- package/dist/adapters/claude-code/plugin.d.ts +19 -0
- package/dist/adapters/claude-code/plugin.d.ts.map +1 -0
- package/dist/adapters/claude-code/plugin.js +66 -0
- package/dist/adapters/claude-code/plugin.js.map +1 -0
- package/dist/cli.d.ts +6 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +34 -10
- package/dist/cli.js.map +1 -1
- package/dist/doctor-plugin.d.ts +23 -0
- package/dist/doctor-plugin.d.ts.map +1 -0
- package/dist/doctor-plugin.js +56 -0
- package/dist/doctor-plugin.js.map +1 -0
- package/dist/doctor.d.ts +6 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +69 -26
- package/dist/doctor.js.map +1 -1
- package/dist/hooks-settings.d.ts +18 -0
- package/dist/hooks-settings.d.ts.map +1 -1
- package/dist/hooks-settings.js +25 -0
- package/dist/hooks-settings.js.map +1 -1
- package/dist/init.d.ts +9 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +144 -59
- package/dist/init.js.map +1 -1
- package/dist/link-skills.d.ts +15 -0
- package/dist/link-skills.d.ts.map +1 -1
- package/dist/link-skills.js +18 -1
- package/dist/link-skills.js.map +1 -1
- package/dist/plugin-offer.d.ts +73 -0
- package/dist/plugin-offer.d.ts.map +1 -0
- package/dist/plugin-offer.js +96 -0
- package/dist/plugin-offer.js.map +1 -0
- package/dist/ports/claude-code.d.ts +31 -0
- package/dist/ports/claude-code.d.ts.map +1 -0
- package/dist/ports/claude-code.js +2 -0
- package/dist/ports/claude-code.js.map +1 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/install.md +62 -14
- package/hooks/CLAUDE.md +2 -2
- package/hooks/CLAUDE.md.spec.ts +1 -1
- package/lib/skill-checks.mjs +6 -7
- package/package.json +4 -1
- package/plugin/CLAUDE.md +22 -14
- package/plugin/CLAUDE.md.spec.ts +20 -12
- package/scripts/plugin-version.test.ts +80 -0
- package/scripts/plugin-version.ts +58 -0
- package/skills/CLAUDE.md +2 -2
- package/skills/CLAUDE.md.spec.ts +1 -1
- package/skills/paper-pipeline/references/anonymization.md +4 -3
- package/skills/submit-paper/SKILL.md +5 -4
- package/skills/submit-paper/SKILL.md.spec.ts +4 -3
- package/skills/submit-paper/check-deanon.sh +17 -2
- package/skills/submit-paper/check-deanon.test.ts +141 -0
- package/src/adapters/claude-code/claude.io.ts +103 -0
- package/src/adapters/claude-code/index.test.ts +233 -0
- package/src/adapters/claude-code/index.ts +11 -0
- package/src/adapters/claude-code/plugin.ts +82 -0
- package/src/cli.harness.mjs +6 -0
- package/src/cli.test.ts +87 -1
- package/src/cli.ts +56 -7
- package/src/doctor-plugin.test.ts +103 -0
- package/src/doctor-plugin.ts +83 -0
- package/src/doctor.test.ts +111 -2
- package/src/doctor.ts +83 -32
- package/src/hooks-notice.test.ts +82 -0
- package/src/hooks-settings.ts +49 -0
- package/src/init-plugin.test.ts +178 -0
- package/src/init.ts +225 -64
- package/src/link-skills.test.ts +34 -1
- package/src/link-skills.ts +34 -0
- package/src/parse-args.test.ts +2 -0
- package/src/plugin-offer.test.ts +276 -0
- package/src/plugin-offer.ts +160 -0
- package/src/ports/claude-code.ts +30 -0
- package/src/types.ts +4 -0
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- vigiles:sha256:
|
|
1
|
+
<!-- vigiles:sha256:95d2ae05ac0791df compiled from CLAUDE.md.spec.ts -->
|
|
2
2
|
|
|
3
3
|
# CLAUDE.md
|
|
4
4
|
|
|
@@ -97,7 +97,7 @@ Before writing machinery, **run the thing you are about to replace and paste its
|
|
|
97
97
|
|
|
98
98
|
### The Default Set Is What The Venue Decides
|
|
99
99
|
|
|
100
|
-
**Guidance only** — paperlint is built for working scientists, so what is on by default must be very reliable. A check ships on by default only when the venue's own text decides it (page limit, template, anonymity, required sections, dates), when a desk reject or a broken build does (an undefined reference, a missing citation, a forbidden font), or when it holds for every paper whatever the venue (a universal fact, not a taste). Everything that flags the writing is opt-in: writing-preference rules (length caps, density, structure, register, style proxies), the skills and the hooks, and anything a careful author could dispute; its docs page says opt-in. A real author who installs paperlint should get no default finding they could reasonably disagree with. A rule moves into the default set only with evidence that a venue requires it, that it causes desk rejects, or that it holds for every paper. The same holds for what `paperlint init` installs: the build, the venue presets and the default-set rules, nothing opinionated
|
|
100
|
+
**Guidance only** — paperlint is built for working scientists, so what is on by default must be very reliable. A check ships on by default only when the venue's own text decides it (page limit, template, anonymity, required sections, dates), when a desk reject or a broken build does (an undefined reference, a missing citation, a forbidden font), or when it holds for every paper whatever the venue (a universal fact, not a taste). Everything that flags the writing is opt-in: writing-preference rules (length caps, density, structure, register, style proxies), the skills and the hooks, and anything a careful author could dispute; its docs page says opt-in. A real author who installs paperlint should get no default finding they could reasonably disagree with. A rule moves into the default set only with evidence that a venue requires it, that it causes desk rejects, or that it holds for every paper. The same holds for what `paperlint init` installs: the build, the venue presets and the default-set rules, nothing opinionated. The skills and hooks come as the Claude Code plugin, which init offers only where Claude Code is: a human is asked once, Yes preselected; without a human nothing is turned on and one line names `npx paperlint init --plugin` (decided 2026-11-22, replacing #510). The first named set, `paperlint:writing`, turns the writing rules on in one line (`src/rule-sets.ts`, `docs/optional-rules.md`); more sets, like ESLint's `recommended` and `strict`, are planned (#524). The author decided this on 2026-11-17, after a length cap set to error on a consumer paper forced its abstract into compression, and widened it on 2026-11-19.
|
|
101
101
|
|
|
102
102
|
### An Optional Tool Stays Out Of The Way
|
|
103
103
|
|
package/README.md
CHANGED
|
@@ -82,8 +82,8 @@ edition, and what is not shipped yet (USENIX, ICLR, IJCAI, Springer …): [`docs
|
|
|
82
82
|
|
|
83
83
|
1. Install and set up, in one command (Node 22.13 or newer). `init` adds paperlint to your
|
|
84
84
|
project's devDependencies, then asks where your papers live (default `papers/`), whether to
|
|
85
|
-
install TeX Live now, and whether to add a CI workflow; with Claude Code it
|
|
86
|
-
skills and
|
|
85
|
+
install TeX Live now, and whether to add a CI workflow; with Claude Code it offers the optional
|
|
86
|
+
plugin with the skills and hooks ([what they do](docs/install.md#the-claude-code-plugin)).
|
|
87
87
|
|
|
88
88
|
```sh
|
|
89
89
|
npx paperlint init
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ClaudeCode } from "../../ports/claude-code.ts";
|
|
2
|
+
/** Whether `file --version` runs and exits 0. */
|
|
3
|
+
export declare const onPath: (file: string) => boolean;
|
|
4
|
+
/** Runs `argv` in `cwd` with the terminal's streams; its exit status, null when it did not run. */
|
|
5
|
+
export declare const runInherit: ([file, ...args]: readonly [string, ...string[]], cwd: string) => number | null;
|
|
6
|
+
export interface ClaudeDeps {
|
|
7
|
+
/** Where Claude Code keeps the user's settings and plugins (`configDirOf`). */
|
|
8
|
+
readonly configDir: string;
|
|
9
|
+
readonly hasClaude: () => boolean;
|
|
10
|
+
readonly run: typeof runInherit;
|
|
11
|
+
}
|
|
12
|
+
export declare const claudeCode: ({ configDir, hasClaude, run, }?: Partial<ClaudeDeps>) => ClaudeCode;
|
|
13
|
+
//# sourceMappingURL=claude.io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.io.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-code/claude.io.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,4BAA4B,CAAC;AAmB3E,iDAAiD;AACjD,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,OAC4B,CAAC;AAEnE,mGAAmG;AACnG,eAAO,MAAM,UAAU,GACrB,iBAAiB,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EAC/C,KAAK,MAAM,KACV,MAAM,GAAG,IAA+D,CAAC;AAE5E,MAAM,WAAW,UAAU;IACzB,+EAA+E;IAC/E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,OAAO,UAAU,CAAC;CACjC;AAgBD,eAAO,MAAM,UAAU,GAAI,iCAIxB,OAAO,CAAC,UAAU,CAAM,KAAG,UAgB5B,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ClaudeCode` over the disk and the `claude` program.
|
|
3
|
+
*
|
|
4
|
+
* 🔴 TURNING THE PLUGIN ON IS `claude`'S OWN TWO COMMANDS WHEN `claude` IS ON PATH. Measured
|
|
5
|
+
* 2026-11-22 (Claude Code 2.1.330, a throwaway HOME): the settings keys alone
|
|
6
|
+
* (`extraKnownMarketplaces` + `enabledPlugins`, written by hand) leave `claude plugin list` empty, and
|
|
7
|
+
* a later `claude plugin install paperlint@paperlint --scope project` then fails with "Plugin
|
|
8
|
+
* \"paperlint\" not found in marketplace \"paperlint\"": the marketplace was never fetched. So with
|
|
9
|
+
* `claude` on PATH the commands run (they write the same keys). Without it the keys are written, so
|
|
10
|
+
* the project declares the plugin for every clone, and the report names the commands still owed.
|
|
11
|
+
*/
|
|
12
|
+
import { spawnSync } from "node:child_process";
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { homedir } from "node:os";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { isRecord } from "../../domain/record.js";
|
|
17
|
+
import { configDirOf, ENABLE_COMMANDS, enabledBy, installedVersion, withPlugin, } from "./plugin.js";
|
|
18
|
+
/** A JSON file's value; undefined when it is missing or does not parse. */
|
|
19
|
+
function readJson(path) {
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Whether `file --version` runs and exits 0. */
|
|
28
|
+
export const onPath = (file) => spawnSync(file, ["--version"], { stdio: "ignore" }).status === 0;
|
|
29
|
+
/** Runs `argv` in `cwd` with the terminal's streams; its exit status, null when it did not run. */
|
|
30
|
+
export const runInherit = ([file, ...args], cwd) => spawnSync(file, args, { cwd, stdio: "inherit" }).status;
|
|
31
|
+
const settingsFile = (root) => join(root, ".claude", "settings.json");
|
|
32
|
+
const COMMANDS = ENABLE_COMMANDS.map((c) => c.join(" "));
|
|
33
|
+
/** Writes the plugin keys into the project's settings; the reason when the file is not JSON. */
|
|
34
|
+
function writeKeys(root) {
|
|
35
|
+
const path = settingsFile(root);
|
|
36
|
+
const raw = existsSync(path) ? readJson(path) : {};
|
|
37
|
+
if (!isRecord(raw))
|
|
38
|
+
return `${path} is not a JSON object`;
|
|
39
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
40
|
+
writeFileSync(path, `${JSON.stringify(withPlugin(raw), null, 2)}\n`);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
export const claudeCode = ({ configDir = configDirOf(process.env, homedir()), hasClaude = () => onPath("claude"), run = runInherit, } = {}) => ({
|
|
44
|
+
present: (root) => existsSync(join(root, ".claude")) || hasClaude(),
|
|
45
|
+
plugin: (root) => ({
|
|
46
|
+
enabled: enabledBy([
|
|
47
|
+
join(root, ".claude", "settings.local.json"),
|
|
48
|
+
settingsFile(root),
|
|
49
|
+
join(configDir, "settings.json"),
|
|
50
|
+
].map(readJson)),
|
|
51
|
+
version: installedVersion(readJson(join(configDir, "plugins", "installed_plugins.json")), root),
|
|
52
|
+
}),
|
|
53
|
+
enable: (root) => enable(root, { hasClaude, run }),
|
|
54
|
+
});
|
|
55
|
+
/** `claude`'s two commands when it is on PATH; otherwise the keys, and the commands still owed. */
|
|
56
|
+
function enable(root, { hasClaude, run }) {
|
|
57
|
+
if (!hasClaude()) {
|
|
58
|
+
const bad = writeKeys(root);
|
|
59
|
+
return bad === null
|
|
60
|
+
? { ok: true, wrote: settingsFile(root), owed: COMMANDS }
|
|
61
|
+
: { ok: false, reason: bad };
|
|
62
|
+
}
|
|
63
|
+
const failed = ENABLE_COMMANDS.find((argv) => run(argv, root) !== 0);
|
|
64
|
+
return failed === undefined
|
|
65
|
+
? { ok: true, ran: COMMANDS }
|
|
66
|
+
: { ok: false, reason: `\`${failed.join(" ")}\` failed` };
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=claude.io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.io.js","sourceRoot":"","sources":["../../../src/adapters/claude-code/claude.io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACL,WAAW,EACX,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,2EAA2E;AAC3E,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAA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,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzD,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IACjC,CAAC;IACD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE;QAC7B,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Claude Code: whether it is here, and the paperlint plugin's state in it, as the `ClaudeCode` port. */
|
|
2
|
+
export { claudeCode, onPath, runInherit } from "./claude.io.ts";
|
|
3
|
+
export { ENABLE_COMMANDS, MARKETPLACE_REPO, PLUGIN_ID, configDirOf, enabledBy, installedVersion, withPlugin, } from "./plugin.ts";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-code/index.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Claude Code: whether it is here, and the paperlint plugin's state in it, as the `ClaudeCode` port. */
|
|
2
|
+
export { claudeCode, onPath, runInherit } from "./claude.io.js";
|
|
3
|
+
export { ENABLE_COMMANDS, MARKETPLACE_REPO, PLUGIN_ID, configDirOf, enabledBy, installedVersion, withPlugin, } from "./plugin.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/claude-code/index.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,UAAU,GACX,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The folder Claude Code keeps the user's settings and plugins in: `CLAUDE_CONFIG_DIR` when it is
|
|
3
|
+
* set (a second profile, for one), else `~/.claude`. Both the user settings and the install record
|
|
4
|
+
* live there, so both are read from the one answer.
|
|
5
|
+
*/
|
|
6
|
+
export declare const configDirOf: (env: Readonly<Record<string, string | undefined>>, home: string) => string;
|
|
7
|
+
/** `<plugin>@<marketplace>`: both are named `paperlint`. */
|
|
8
|
+
export declare const PLUGIN_ID = "paperlint@paperlint";
|
|
9
|
+
/** The marketplace is this repository: `.claude-plugin/marketplace.json`. */
|
|
10
|
+
export declare const MARKETPLACE_REPO = "zernie/paperlint";
|
|
11
|
+
/** The two commands that turn the plugin on for a project, in order. */
|
|
12
|
+
export declare const ENABLE_COMMANDS: readonly (readonly [string, ...string[]])[];
|
|
13
|
+
/** The most specific file that names the plugin decides; `files` are ordered most specific first. */
|
|
14
|
+
export declare const enabledBy: (files: readonly unknown[]) => boolean;
|
|
15
|
+
/** The version installed for `root`: an entry for this project, else a user-scope one. */
|
|
16
|
+
export declare function installedVersion(json: unknown, root: string): string | null;
|
|
17
|
+
/** The settings with the marketplace declared and the plugin turned on; everything else kept. */
|
|
18
|
+
export declare const withPlugin: (settings: Readonly<Record<string, unknown>>) => Readonly<Record<string, unknown>>;
|
|
19
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/adapters/claude-code/plugin.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,eAAO,MAAM,WAAW,GACtB,KAAK,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACjD,MAAM,MAAM,KACX,MAGF,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAE/C,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAEnD,wEAAwE;AACxE,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC,EAWtE,CAAC;AAQF,qGAAqG;AACrG,eAAO,MAAM,SAAS,GAAI,OAAO,SAAS,OAAO,EAAE,KAAG,OACC,CAAC;AAExD,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ3E;AAKD,iGAAiG;AACjG,eAAO,MAAM,UAAU,GACrB,UAAU,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAC1C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUjC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Claude Code's own files say about the paperlint plugin, read without touching them. Measured
|
|
3
|
+
* 2026-11-22 with Claude Code 2.1.330 (docs/prior-art/plugin-bundle-measurements.md):
|
|
4
|
+
* `claude plugin marketplace add <source> --scope project` writes `extraKnownMarketplaces.paperlint`
|
|
5
|
+
* into `.claude/settings.json`; `claude plugin install paperlint@paperlint --scope project` adds
|
|
6
|
+
* `enabledPlugins["paperlint@paperlint"]: true` there, and records the install in
|
|
7
|
+
* `~/.claude/plugins/installed_plugins.json` with its `scope`, `version` and `projectPath`.
|
|
8
|
+
*/
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { fieldOf, isRecord } from "../../domain/record.js";
|
|
11
|
+
/**
|
|
12
|
+
* The folder Claude Code keeps the user's settings and plugins in: `CLAUDE_CONFIG_DIR` when it is
|
|
13
|
+
* set (a second profile, for one), else `~/.claude`. Both the user settings and the install record
|
|
14
|
+
* live there, so both are read from the one answer.
|
|
15
|
+
*/
|
|
16
|
+
export const configDirOf = (env, home) => {
|
|
17
|
+
const set = env["CLAUDE_CONFIG_DIR"];
|
|
18
|
+
return set === undefined || set === "" ? join(home, ".claude") : set;
|
|
19
|
+
};
|
|
20
|
+
/** `<plugin>@<marketplace>`: both are named `paperlint`. */
|
|
21
|
+
export const PLUGIN_ID = "paperlint@paperlint";
|
|
22
|
+
/** The marketplace is this repository: `.claude-plugin/marketplace.json`. */
|
|
23
|
+
export const MARKETPLACE_REPO = "zernie/paperlint";
|
|
24
|
+
/** The two commands that turn the plugin on for a project, in order. */
|
|
25
|
+
export const ENABLE_COMMANDS = [
|
|
26
|
+
[
|
|
27
|
+
"claude",
|
|
28
|
+
"plugin",
|
|
29
|
+
"marketplace",
|
|
30
|
+
"add",
|
|
31
|
+
MARKETPLACE_REPO,
|
|
32
|
+
"--scope",
|
|
33
|
+
"project",
|
|
34
|
+
],
|
|
35
|
+
["claude", "plugin", "install", PLUGIN_ID, "--scope", "project"],
|
|
36
|
+
];
|
|
37
|
+
/** What one settings file says: on, off, or nothing. */
|
|
38
|
+
const says = (settings) => {
|
|
39
|
+
const v = fieldOf(fieldOf(settings, "enabledPlugins"), PLUGIN_ID);
|
|
40
|
+
return typeof v === "boolean" ? v : undefined;
|
|
41
|
+
};
|
|
42
|
+
/** The most specific file that names the plugin decides; `files` are ordered most specific first. */
|
|
43
|
+
export const enabledBy = (files) => files.map(says).find((v) => v !== undefined) ?? false;
|
|
44
|
+
/** The version installed for `root`: an entry for this project, else a user-scope one. */
|
|
45
|
+
export function installedVersion(json, root) {
|
|
46
|
+
const entries = fieldOf(fieldOf(json, "plugins"), PLUGIN_ID);
|
|
47
|
+
const list = Array.isArray(entries) ? entries : [];
|
|
48
|
+
const entry = list.find((e) => fieldOf(e, "projectPath") === root) ??
|
|
49
|
+
list.find((e) => fieldOf(e, "scope") === "user");
|
|
50
|
+
const version = fieldOf(entry, "version");
|
|
51
|
+
return typeof version === "string" ? version : null;
|
|
52
|
+
}
|
|
53
|
+
const recordOf = (v) => isRecord(v) ? v : {};
|
|
54
|
+
/** The settings with the marketplace declared and the plugin turned on; everything else kept. */
|
|
55
|
+
export const withPlugin = (settings) => ({
|
|
56
|
+
...settings,
|
|
57
|
+
extraKnownMarketplaces: {
|
|
58
|
+
...recordOf(settings["extraKnownMarketplaces"]),
|
|
59
|
+
paperlint: { source: { source: "github", repo: MARKETPLACE_REPO } },
|
|
60
|
+
},
|
|
61
|
+
enabledPlugins: {
|
|
62
|
+
...recordOf(settings["enabledPlugins"]),
|
|
63
|
+
[PLUGIN_ID]: true,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/adapters/claude-code/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,GAAiD,EACjD,IAAY,EACJ,EAAE;IACV,MAAM,GAAG,GAAG,GAAG,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uB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,MAAM,KAAK,GACT,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,aAAa,CAAC,KAAK,IAAI,CAAC;QACpD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAqC,EAAE,CACjE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAEvB,iGAAiG;AACjG,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAA2C,EACR,EAAE,CAAC,CAAC;IACvC,GAAG,QAAQ;IACX,sBAAsB,EAAE;QACtB,GAAG,QAAQ,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;QAC/C,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE;KACpE;IACD,cAAc,EAAE;QACd,GAAG,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACvC,CAAC,SAAS,CAAC,EAAE,IAAI;KAClB;CACF,CAAC,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export { init };
|
|
|
39
39
|
export { nextSteps } from "./init.ts";
|
|
40
40
|
import { type LinkReport } from "./link-skills.ts";
|
|
41
41
|
import type { ProjectInstall } from "./ports/project-install.ts";
|
|
42
|
+
import type { ClaudeCode } from "./ports/claude-code.ts";
|
|
42
43
|
import { type Upload } from "./submission-confirm-hook.ts";
|
|
43
44
|
/** The config the user would otherwise write by hand. The data comes from `opts`, the mechanism is here. */
|
|
44
45
|
export declare function buildConfig(opts: PaperlintConfig | undefined, texLanguage: unknown, papers?: PaperScope): ConfigBlock[];
|
|
@@ -191,6 +192,8 @@ interface HookOptions {
|
|
|
191
192
|
readonly version?: string;
|
|
192
193
|
/** What `paperlint doctor` reads to find unlinked skills; the disk by default. */
|
|
193
194
|
readonly skillLinks?: (root: string) => LinkReport;
|
|
195
|
+
/** Whether the Claude Code plugin is on; the disk by default. */
|
|
196
|
+
readonly claude?: ClaudeCode;
|
|
194
197
|
}
|
|
195
198
|
/** The real spawner, narrowed to what `runHook` asks of it. */
|
|
196
199
|
export declare const spawnHook: NonNullable<HookOptions["run"]>;
|
|
@@ -258,12 +261,14 @@ export declare function initTexLive(a: Args, { log, err, cwd, }: {
|
|
|
258
261
|
readonly installed: () => boolean;
|
|
259
262
|
readonly install: () => number;
|
|
260
263
|
};
|
|
261
|
-
export declare function run(argv: readonly string[], { log, err, cwd, now, checkReferences, loadTexLanguage, skillLinks, install, }?: {
|
|
264
|
+
export declare function run(argv: readonly string[], { log, err, cwd, now, checkReferences, loadTexLanguage, skillLinks, install, claude, }?: {
|
|
262
265
|
log?: typeof console.log;
|
|
263
266
|
err?: typeof console.error;
|
|
264
267
|
cwd?: string;
|
|
265
268
|
/** How `init` adds paperlint to a project: the package manager by default; a test hands a fake. */
|
|
266
269
|
install?: ProjectInstall;
|
|
270
|
+
/** Claude Code as `init` and `doctor` see it: the disk and `claude` by default; a test hands a fake. */
|
|
271
|
+
claude?: ClaudeCode;
|
|
267
272
|
/** The clock `lint` times itself with, in milliseconds; a test hands one that answers fixed values. */
|
|
268
273
|
now?: () => number;
|
|
269
274
|
/**
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
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A;CAAE,CAYvE;AAqGD,wBAAsB,GAAG,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EACE,GAAiB,EACjB,GAAmB,EACnB,GAAmB,EACnB,GAA6B,EAC7B,eAAkC,EAClC,eAAmC,EACnC,UAA2B,EAC3B,OAAwB,EACxB,MAAqB,GACtB,GAAE;IACD,GAAG,CAAC,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mGAAmG;IACnG,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,wGAAwG;IACxG,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,uGAAuG;IACvG,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,8EAA8E;IAC9E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,CAAC;CACtC,GACL,OAAO,CAAC,MAAM,CAAC,CAyKjB;AA2KD;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,SAAS,YAAY,EAAE,GAChC,OAAO,CAAC,MAAM,CAAC,CAcjB"}
|
package/dist/cli.js
CHANGED
|
@@ -77,6 +77,7 @@ import { ANY_PAPER, narrowToOwners, ownedPatterns, paperFiles, papersScope, rule
|
|
|
77
77
|
import { paperPreset, settingsProblemLine, presetProblemText, resolvePreset, resolveShipped, bareSeriesText, shippedPresets, shippedSpec, shippedFolderNames, SHIPPED_PREFIX, } from "./presets.js";
|
|
78
78
|
import { mergeRequirements, declaredUnion, requirementsFor, NO_REQUIREMENTS, } from "./tex-requirements.js";
|
|
79
79
|
import { doctor } from "./doctor.js";
|
|
80
|
+
import { installedPluginVersion } from "./plugin-offer.js";
|
|
80
81
|
import { askOnTerminal, askOrDefault, CANCELLED_CODE, CANCELLED_LINE, init, processInteractivity, } from "./init.js";
|
|
81
82
|
import { newPaper, reportNewPaper, STATUS_FILE, } from "./new-paper.js";
|
|
82
83
|
// The one source for the consumer's config key lives in lib/ (the ESLint rules and the skill scripts
|
|
@@ -109,6 +110,7 @@ import { NOTICE_HOOKS, collector, lintLine, mergeNotice, noticeText, notYetTold,
|
|
|
109
110
|
import { unwiredHooks } from "./hooks-settings.js";
|
|
110
111
|
import { linkSkills, locatePackage, unlinkedSkills, } from "./link-skills.js";
|
|
111
112
|
import { projectInstall } from "./adapters/package-manager/index.js";
|
|
113
|
+
import { claudeCode } from "./adapters/claude-code/index.js";
|
|
112
114
|
import { selfInstallStep, versionOf, } from "./self-install.js";
|
|
113
115
|
import { lintEditedHook, } from "./lint-edited-hook.js";
|
|
114
116
|
import { submissionConfirm, UNREADABLE_INPUT, } from "./submission-confirm-hook.js";
|
|
@@ -217,6 +219,10 @@ init:
|
|
|
217
219
|
--yes, -y ask nothing, take every default. Without a terminal on stdin AND stdout,
|
|
218
220
|
or with CI set, nothing is asked either
|
|
219
221
|
--no-hooks do not wire the hooks (the default without a human is to wire them)
|
|
222
|
+
--plugin turn on the Claude Code plugin (the skills and hooks) without asking, with
|
|
223
|
+
or without a terminal. Without a human and without this flag, init turns
|
|
224
|
+
nothing on and prints one line saying so
|
|
225
|
+
--no-plugin never ask about the plugin, never turn it on
|
|
220
226
|
--paper <name> create this paper too (without a human, the only way init creates one)
|
|
221
227
|
|
|
222
228
|
new:
|
|
@@ -922,6 +928,8 @@ export function parseArgs(argv) {
|
|
|
922
928
|
check: false,
|
|
923
929
|
yes: false,
|
|
924
930
|
noHooks: false,
|
|
931
|
+
plugin: false,
|
|
932
|
+
noPlugin: false,
|
|
925
933
|
allowVenueName: false,
|
|
926
934
|
paper: null,
|
|
927
935
|
venue: null,
|
|
@@ -1014,6 +1022,8 @@ const SWITCHES = new Map([
|
|
|
1014
1022
|
["--yes", "yes"],
|
|
1015
1023
|
["-y", "yes"],
|
|
1016
1024
|
["--no-hooks", "noHooks"],
|
|
1025
|
+
["--plugin", "plugin"],
|
|
1026
|
+
["--no-plugin", "noPlugin"],
|
|
1017
1027
|
["--allow-venue-name", "allowVenueName"],
|
|
1018
1028
|
["--submit", "submit"],
|
|
1019
1029
|
["--save", "save"],
|
|
@@ -1235,6 +1245,16 @@ const hookRoot = (io) => io.projectDir ?? process.env["CLAUDE_PROJECT_DIR"] ?? p
|
|
|
1235
1245
|
const packageVersion = () => z
|
|
1236
1246
|
.object({ version: z.string() })
|
|
1237
1247
|
.parse(JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"))).version;
|
|
1248
|
+
/**
|
|
1249
|
+
* What the project still owes of the hooks and skills — nothing once the Claude Code plugin is on: the
|
|
1250
|
+
* plugin carries both, so a project without init's links and hook entries is complete.
|
|
1251
|
+
*/
|
|
1252
|
+
function owed(root, skillLinks, claude) {
|
|
1253
|
+
if (installedPluginVersion(claude.plugin(absolutePath(root))) !== null)
|
|
1254
|
+
return { missing: [], byHand: false, skills: [] };
|
|
1255
|
+
const { missing, byHand } = unwiredHooks(root);
|
|
1256
|
+
return { missing, byHand, skills: unlinkedSkills(skillLinks(root)) };
|
|
1257
|
+
}
|
|
1238
1258
|
/**
|
|
1239
1259
|
* The notice this hook owes the project, or null. Never throws and never speaks twice for one
|
|
1240
1260
|
* version: whatever goes wrong here is one stderr line and the hook runs as if nothing were due.
|
|
@@ -1242,8 +1262,7 @@ const packageVersion = () => z
|
|
|
1242
1262
|
function pendingNotice(io) {
|
|
1243
1263
|
try {
|
|
1244
1264
|
const root = hookRoot(io);
|
|
1245
|
-
const { missing, byHand } =
|
|
1246
|
-
const skills = unlinkedSkills((io.skillLinks ?? readSkillLinks)(root));
|
|
1265
|
+
const { missing, byHand, skills } = owed(root, io.skillLinks ?? readSkillLinks, io.claude ?? claudeCode());
|
|
1247
1266
|
const version = io.version ?? packageVersion();
|
|
1248
1267
|
return (missing.length === 0 && skills.length === 0) ||
|
|
1249
1268
|
!notYetTold(nodeFiles, root, version)
|
|
@@ -1266,10 +1285,9 @@ const touchesAPaper = (payload) => {
|
|
|
1266
1285
|
}
|
|
1267
1286
|
};
|
|
1268
1287
|
/** `paperlint lint`'s one stderr line when the project's hooks are only partly wired. Never throws. */
|
|
1269
|
-
function hooksLine(root, err, skillLinks) {
|
|
1288
|
+
function hooksLine(root, err, skillLinks, claude) {
|
|
1270
1289
|
try {
|
|
1271
|
-
const { missing } =
|
|
1272
|
-
const skills = unlinkedSkills(skillLinks(root));
|
|
1290
|
+
const { missing, skills } = owed(root, skillLinks, claude);
|
|
1273
1291
|
if (missing.length > 0 || skills.length > 0)
|
|
1274
1292
|
err(lintLine(packageVersion(), missing, skills));
|
|
1275
1293
|
}
|
|
@@ -1791,7 +1809,7 @@ function cliPapers(a, cwd) {
|
|
|
1791
1809
|
: null;
|
|
1792
1810
|
}
|
|
1793
1811
|
/** `paperlint init`: its flags checked here, the install itself in `init.ts`. */
|
|
1794
|
-
async function runInit(a, { log, err, cwd, install, }) {
|
|
1812
|
+
async function runInit(a, { log, err, cwd, install, claude, }) {
|
|
1795
1813
|
// Deferred, not implemented: named and refused, rather than read as the directory argument.
|
|
1796
1814
|
if (a.hooksMode !== null) {
|
|
1797
1815
|
err(`--hooks=${a.hooksMode} is not implemented. init writes the hooks into .claude/settings.json ` +
|
|
@@ -1812,6 +1830,8 @@ async function runInit(a, { log, err, cwd, install, }) {
|
|
|
1812
1830
|
prompts,
|
|
1813
1831
|
yes: a.yes,
|
|
1814
1832
|
hooks: !a.noHooks,
|
|
1833
|
+
claude,
|
|
1834
|
+
pluginFlag: a.plugin ? "plugin" : a.noPlugin ? "no-plugin" : null,
|
|
1815
1835
|
paper: a.paper,
|
|
1816
1836
|
createPaper: (papersRoot, name) => createPaperAt(papersRoot, name, { log, err, cwd }),
|
|
1817
1837
|
venues: shippedFolderNames(PRESET_DEPS),
|
|
@@ -1846,7 +1866,7 @@ const selfInstallDeps = (install) => {
|
|
|
1846
1866
|
};
|
|
1847
1867
|
/** The LaTeX language, loaded when a lint needs it: only `lint` and the `lint-edited` hook do. */
|
|
1848
1868
|
const loadLatexLanguage = async () => (await import("#eslint-rules/latex-language")).texLanguage;
|
|
1849
|
-
export async function run(argv, { log = console.log, err = console.error, cwd = process.cwd(), now = () => performance.now(), checkReferences = onlineReferences, loadTexLanguage = loadLatexLanguage, skillLinks = readSkillLinks, install = projectInstall, } = {}) {
|
|
1869
|
+
export async function run(argv, { log = console.log, err = console.error, cwd = process.cwd(), now = () => performance.now(), checkReferences = onlineReferences, loadTexLanguage = loadLatexLanguage, skillLinks = readSkillLinks, install = projectInstall, claude = claudeCode(), } = {}) {
|
|
1850
1870
|
const a = parseArgs(argv);
|
|
1851
1871
|
// The refusal must come FIRST: behind a flag without a value there is usually a typo, or a
|
|
1852
1872
|
// substitution in CI that collapsed into nothing, and any continuation works on something other
|
|
@@ -1869,17 +1889,21 @@ export async function run(argv, { log = console.log, err = console.error, cwd =
|
|
|
1869
1889
|
// not two implementations of the same question. A second resolver here is the defect the
|
|
1870
1890
|
// comparison exists to catch.
|
|
1871
1891
|
if (a.cmd === "init")
|
|
1872
|
-
return await runInit(a, { log, err, cwd, install });
|
|
1892
|
+
return await runInit(a, { log, err, cwd, install, claude });
|
|
1873
1893
|
// `doctor` reads the config but must NOT die on a broken one — reporting that the config is
|
|
1874
1894
|
// broken is precisely its job. So a failed read becomes "the CLI would lint nothing", which is
|
|
1875
1895
|
// what it prints, rather than an early exit that tells the reader nothing about the hooks.
|
|
1876
1896
|
if (a.cmd === "doctor") {
|
|
1877
1897
|
const papers = cliPapers(a, cwd);
|
|
1898
|
+
const projectDir = process.env["CLAUDE_PROJECT_DIR"] ?? cwd;
|
|
1899
|
+
const at = absolutePath(resolve(cwd, projectDir));
|
|
1878
1900
|
return doctor({
|
|
1879
1901
|
log,
|
|
1880
1902
|
cwd,
|
|
1881
|
-
projectDir
|
|
1903
|
+
projectDir,
|
|
1882
1904
|
cliPapers: papers,
|
|
1905
|
+
plugin: claude.present(at) ? claude.plugin(at) : null,
|
|
1906
|
+
installed: packageVersion(),
|
|
1883
1907
|
});
|
|
1884
1908
|
}
|
|
1885
1909
|
const simple = SIMPLE[a.cmd];
|
|
@@ -1981,7 +2005,7 @@ export async function run(argv, { log = console.log, err = console.error, cwd =
|
|
|
1981
2005
|
.filter((f) => existsSync(f)),
|
|
1982
2006
|
bodies,
|
|
1983
2007
|
});
|
|
1984
|
-
hooksLine(root, err, skillLinks);
|
|
2008
|
+
hooksLine(root, err, skillLinks, claude);
|
|
1985
2009
|
// On stderr, so `--json` leaves stdout a clean array.
|
|
1986
2010
|
timingLines({
|
|
1987
2011
|
files: results.length,
|