paperlint 18.6.0 → 18.7.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.md +2 -2
- package/CONTRIBUTING.md +5 -2
- package/README.md +6 -6
- package/dist/adapters/clack/index.d.ts +3 -0
- package/dist/adapters/clack/index.d.ts.map +1 -0
- package/dist/adapters/clack/index.js +3 -0
- package/dist/adapters/clack/index.js.map +1 -0
- package/dist/adapters/clack/prompts.io.d.ts +8 -0
- package/dist/adapters/clack/prompts.io.d.ts.map +1 -0
- package/dist/adapters/clack/prompts.io.js +20 -0
- package/dist/adapters/clack/prompts.io.js.map +1 -0
- package/dist/adapters/package-manager/index.d.ts +4 -0
- package/dist/adapters/package-manager/index.d.ts.map +1 -0
- package/dist/adapters/package-manager/index.js +4 -0
- package/dist/adapters/package-manager/index.js.map +1 -0
- package/dist/adapters/package-manager/install.io.d.ts +3 -0
- package/dist/adapters/package-manager/install.io.d.ts.map +1 -0
- package/dist/adapters/package-manager/install.io.js +23 -0
- package/dist/adapters/package-manager/install.io.js.map +1 -0
- package/dist/adapters/package-manager/manager.d.ts +13 -0
- package/dist/adapters/package-manager/manager.d.ts.map +1 -0
- package/dist/adapters/package-manager/manager.js +22 -0
- package/dist/adapters/package-manager/manager.js.map +1 -0
- package/dist/adapters/study-registry/index.d.ts +2 -2
- package/dist/cli.d.ts +4 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +42 -6
- package/dist/cli.js.map +1 -1
- package/dist/init.d.ts +38 -15
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +99 -39
- package/dist/init.js.map +1 -1
- package/dist/ports/project-install.d.ts +19 -0
- package/dist/ports/project-install.d.ts.map +1 -0
- package/dist/ports/project-install.js +2 -0
- package/dist/ports/project-install.js.map +1 -0
- package/dist/ports/prompts.d.ts +31 -0
- package/dist/ports/prompts.d.ts.map +1 -0
- package/dist/ports/prompts.js +2 -0
- package/dist/ports/prompts.js.map +1 -0
- package/dist/self-install.d.ts +65 -0
- package/dist/self-install.d.ts.map +1 -0
- package/dist/self-install.js +145 -0
- package/dist/self-install.js.map +1 -0
- package/dist/skill-chunks/chunk-65X5HVIJ.js +26462 -0
- package/dist/skill-chunks/chunk-6NU6CXUS.js +258 -0
- package/dist/skill-chunks/chunk-GRSXIWYF.js +352 -0
- package/dist/skill-chunks/chunk-IREAROCV.js +84 -0
- package/dist/skill-chunks/chunk-KWK6RT4T.js +24267 -0
- package/dist/skill-chunks/chunk-NPQVDEE4.js +19681 -0
- package/dist/skill-chunks/chunk-PJ4KNV4J.js +45 -0
- package/dist/skill-chunks/dist-UPCJMLBM.js +385 -0
- package/dist/skill-chunks/pdfjs-LUMEFOH2.js +39518 -0
- package/docs/e2e.md +10 -0
- package/docs/install.md +27 -16
- package/docs/prior-art/README.md +2 -0
- package/docs/prior-art/one-command-install.md +33 -0
- package/docs/prior-art/prompt-libraries.md +32 -0
- package/eslint.config.mjs +1 -0
- package/lib/skill-checks.mjs +17 -9
- package/lib/skill-checks.test.mjs +28 -15
- package/lib/skill-corpus.mjs +5 -2
- package/package.json +5 -3
- package/scripts/bundle-skills.test.ts +226 -0
- package/scripts/bundle-skills.ts +304 -0
- package/skills/argument-arc/SKILL.md +2 -2
- package/skills/argument-arc/SKILL.md.spec.ts +1 -1
- package/skills/argument-arc/scripts/headings.js +57 -13
- package/skills/build-label-page/scripts/label-page.js +2005 -93
- package/skills/cold-read-diff/scripts/cold-read.js +221 -14
- package/skills/label-agent-runs/scripts/labels.js +272 -348
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +304 -0
- package/skills/pc-panel-review/scripts/prior-reviews.js +7244 -12
- package/skills/run-agent-grid/scripts/grid-guard.js +562 -627
- package/skills/verify-citations/SKILL.md +9 -9
- package/skills/verify-citations/SKILL.md.spec.ts +8 -8
- package/skills/verify-citations/scripts/bib-authors.js +228 -0
- package/skills/verify-citations/scripts/verify-cites.js +816 -0
- package/src/adapters/clack/index.ts +2 -0
- package/src/adapters/clack/prompts.io.ts +35 -0
- package/src/adapters/clack/prompts.test.ts +58 -0
- package/src/adapters/package-manager/index.test.ts +67 -0
- package/src/adapters/package-manager/index.ts +3 -0
- package/src/adapters/package-manager/install.io.ts +27 -0
- package/src/adapters/package-manager/manager.ts +33 -0
- package/src/cli.harness.mjs +41 -26
- package/src/cli.test.ts +93 -2
- package/src/cli.ts +75 -4
- package/src/init.test.ts +138 -27
- package/src/init.ts +128 -72
- package/src/ports/project-install.ts +18 -0
- package/src/ports/prompts.ts +27 -0
- package/src/self-install.test.ts +267 -0
- package/src/self-install.ts +224 -0
package/CLAUDE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- vigiles:sha256:
|
|
1
|
+
<!-- vigiles:sha256:8064945a6b19d6f0 compiled from CLAUDE.md.spec.ts -->
|
|
2
2
|
|
|
3
3
|
# CLAUDE.md
|
|
4
4
|
|
|
@@ -93,7 +93,7 @@ Before writing machinery, **run the thing you are about to replace and paste its
|
|
|
93
93
|
|
|
94
94
|
### Installing Paperlint Is Smooth
|
|
95
95
|
|
|
96
|
-
**Guidance only** — The target is
|
|
96
|
+
**Guidance only** — The target is one command, `npx paperlint init`; any further manual step is a paperlint defect, except a choice that really belongs to the user, named when it is asked. An automatic step that can fail silently is worse than an explicit one.
|
|
97
97
|
|
|
98
98
|
### The Default Set Is What The Venue Decides
|
|
99
99
|
|
package/CONTRIBUTING.md
CHANGED
|
@@ -139,7 +139,7 @@ shrinks. Code that only this repository runs (tests, `scripts/`, `test/e2e/`) is
|
|
|
139
139
|
run by `node` directly; code a consumer runs from `node_modules` needs a build first, because Node
|
|
140
140
|
does not strip types there.
|
|
141
141
|
|
|
142
|
-
`npm run build` is `tsc -b
|
|
142
|
+
`npm run build` is `tsc -b`, then the skill bundles: TypeScript's build mode over the project references in the root
|
|
143
143
|
`tsconfig.json`, which is a solution file and compiles nothing itself. The three projects share
|
|
144
144
|
`tsconfig.base.json`: `tsconfig.pkg.json` builds `lib/` and `eslint-rules/` to `dist/lib/` and
|
|
145
145
|
`dist/eslint-rules/`; `tsconfig.src.json` builds `src/` to `dist/*.js` and references the first,
|
|
@@ -147,7 +147,10 @@ whose declarations it reads; `tsconfig.skills.json` compiles a skill's scripts
|
|
|
147
147
|
(`skills/*/scripts/*.ts`) to a `.js` BESIDE each, gitignored and shipped through `files` (their
|
|
148
148
|
declarations go to `dist/skills/`): a skill names its script as `${CLAUDE_SKILL_DIR}/scripts/<name>.js`,
|
|
149
149
|
and only a path inside the skill's own directory resolves the same through the consumer's
|
|
150
|
-
`.claude/skills/<name>` link and in this checkout.
|
|
150
|
+
`.claude/skills/<name>` link and in this checkout. Then `scripts/bundle-skills.ts` replaces each
|
|
151
|
+
script a `SKILL.md` runs with an esbuild bundle at the same `.js` path (a `.mjs` script gets a `.js`
|
|
152
|
+
bundle beside it), its dependencies inside and shared code in `dist/skill-chunks/`, so it runs from a
|
|
153
|
+
plugin copy with no `node_modules` (`test/e2e/install/skill-scripts.e2e.ts`). A second `tsc -b` with nothing changed is a no-op;
|
|
151
154
|
it decides that from `dist/.tsbuildinfo/`, so an output deleted by hand is rebuilt only by
|
|
152
155
|
`npx tsc -b --force` (or by deleting `dist/` with it). `tsconfig.test.json` is not part of the build:
|
|
153
156
|
it type-checks every `.ts` without emitting. Everything else imports `lib/` and `eslint-rules/` through the package's subpath imports,
|
package/README.md
CHANGED
|
@@ -80,12 +80,12 @@ edition, and what is not shipped yet (USENIX, ICLR, IJCAI, Springer …): [`docs
|
|
|
80
80
|
|
|
81
81
|
<!-- `vigiles:symbol src/init.ts#init` — `npm run check` fails if this function is renamed or removed. -->
|
|
82
82
|
|
|
83
|
-
1. Install (Node 22.13 or newer)
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
1. Install and set up, in one command (Node 22.13 or newer). `init` adds paperlint to your
|
|
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 also installs the
|
|
86
|
+
skills and four hooks ([what they do](docs/install.md)).
|
|
86
87
|
|
|
87
88
|
```sh
|
|
88
|
-
npm i -D paperlint
|
|
89
89
|
npx paperlint init
|
|
90
90
|
```
|
|
91
91
|
|
|
@@ -267,8 +267,8 @@ Both workflows in full, with the TeX Live cache: [`docs/ci.md`](docs/ci.md).
|
|
|
267
267
|
## ❓ FAQ
|
|
268
268
|
|
|
269
269
|
**Does it install anything without asking?**
|
|
270
|
-
|
|
271
|
-
Windows, install
|
|
270
|
+
Only paperlint itself, into devDependencies (asked first at a terminal). TeX Live comes only from
|
|
271
|
+
`paperlint toolchain`, or a yes in `init` or `build`; on Windows, install it yourself.
|
|
272
272
|
|
|
273
273
|
**Several papers for different venues in one repo?**
|
|
274
274
|
Yes. Each paper names its own venue preset in its own `paperlint.json`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/clack/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/clack/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
2
|
+
import type { Prompts } from "../../ports/prompts.ts";
|
|
3
|
+
/** The terminal's streams by default; a test passes its own. */
|
|
4
|
+
export declare const clackPrompts: (streams?: {
|
|
5
|
+
readonly input?: Readable;
|
|
6
|
+
readonly output?: Writable;
|
|
7
|
+
}) => Prompts;
|
|
8
|
+
//# sourceMappingURL=prompts.io.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.io.d.ts","sourceRoot":"","sources":["../../../src/adapters/clack/prompts.io.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAM9D,gEAAgE;AAChE,eAAO,MAAM,YAAY,GACvB,UAAS;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;CAAO,KACtE,OAkBD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Prompts` port drawn by @clack/prompts, the one prompt library of this package (chosen on
|
|
3
|
+
* 2026-11-22: `docs/prior-art/prompt-libraries.md`). Clack's cancel (Ctrl+C, Esc) is a symbol;
|
|
4
|
+
* it becomes the port's `cancel`, so nothing outside this folder knows the symbol exists.
|
|
5
|
+
*/
|
|
6
|
+
import { confirm, select, text } from "@clack/prompts";
|
|
7
|
+
/** Clack answers with the value or with its one symbol, the cancel (`isCancel` tests the same). */
|
|
8
|
+
const answer = (value) => typeof value === "symbol" ? { kind: "cancel" } : { kind: "answer", value };
|
|
9
|
+
/** The terminal's streams by default; a test passes its own. */
|
|
10
|
+
export const clackPrompts = (streams = {}) => ({
|
|
11
|
+
confirm: async ({ message, initial }) => answer(await confirm({ ...streams, message, initialValue: initial })),
|
|
12
|
+
select: async ({ message, options, initial }) => answer(await select({
|
|
13
|
+
...streams,
|
|
14
|
+
message,
|
|
15
|
+
options: options.map((value) => ({ value, label: value })),
|
|
16
|
+
initialValue: initial,
|
|
17
|
+
})),
|
|
18
|
+
text: async ({ message, placeholder }) => answer(await text({ ...streams, message, placeholder, defaultValue: "" })),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=prompts.io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.io.js","sourceRoot":"","sources":["../../../src/adapters/clack/prompts.io.ts"],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mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/package-manager/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.io.d.ts","sourceRoot":"","sources":["../../../src/adapters/package-manager/install.io.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,eAAO,MAAM,cAAc,EAAE,cAe5B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ProjectInstall` over the disk and the package manager's own program: the lockfiles are looked
|
|
3
|
+
* for in the project root, and the command runs there with the terminal's streams, so its progress
|
|
4
|
+
* and its errors reach the person who ran `paperlint init`.
|
|
5
|
+
*/
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { addCommand, managerOf } from "./manager.js";
|
|
10
|
+
export const projectInstall = {
|
|
11
|
+
command: (root, spec) => addCommand(managerOf((file) => existsSync(join(root, file))), spec),
|
|
12
|
+
run: (root, [file, ...args]) => {
|
|
13
|
+
const r = spawnSync(file, args, { cwd: root, stdio: "inherit" });
|
|
14
|
+
if (r.error)
|
|
15
|
+
return { ok: false, reason: r.error.message };
|
|
16
|
+
if (r.signal !== null)
|
|
17
|
+
return { ok: false, reason: `killed by ${r.signal}` };
|
|
18
|
+
return r.status === 0
|
|
19
|
+
? { ok: true }
|
|
20
|
+
: { ok: false, reason: `exited ${String(r.status)}` };
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=install.io.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.io.js","sourceRoot":"","sources":["../../../src/adapters/package-manager/install.io.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CACtB,UAAU,CACR,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACjD,IAAI,CACL;IACH,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE;QAC7B,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,CAAC,KAAK;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3D,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI;YACnB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QACxD,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC;YACnB,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE;YACd,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;IAC1D,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which package manager a project uses, read from its lockfile, and how that manager adds a
|
|
3
|
+
* devDependency saved at an exact version. npm when no lockfile is there: it ships with Node.
|
|
4
|
+
*/
|
|
5
|
+
import type { Argv } from "../../ports/project-install.ts";
|
|
6
|
+
export type Manager = "npm" | "pnpm" | "yarn" | "bun";
|
|
7
|
+
/** Each lockfile and its manager, in the order they are looked for. */
|
|
8
|
+
export declare const LOCKFILES: readonly (readonly [string, Manager])[];
|
|
9
|
+
/** The manager of the first lockfile `present` says is there; npm when none is. */
|
|
10
|
+
export declare const managerOf: (present: (file: string) => boolean) => Manager;
|
|
11
|
+
/** The command that adds `spec` to devDependencies with `manager`. */
|
|
12
|
+
export declare const addCommand: (manager: Manager, spec: string) => Argv;
|
|
13
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/adapters/package-manager/manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAE3D,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtD,uEAAuE;AACvE,eAAO,MAAM,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAM5D,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,SAAS,GAAI,SAAS,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,KAAG,OACN,CAAC;AAS1D,sEAAsE;AACtE,eAAO,MAAM,UAAU,GAAI,SAAS,OAAO,EAAE,MAAM,MAAM,KAAG,IAG3D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Each lockfile and its manager, in the order they are looked for. */
|
|
2
|
+
export const LOCKFILES = [
|
|
3
|
+
["package-lock.json", "npm"],
|
|
4
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
5
|
+
["yarn.lock", "yarn"],
|
|
6
|
+
["bun.lock", "bun"],
|
|
7
|
+
["bun.lockb", "bun"],
|
|
8
|
+
];
|
|
9
|
+
/** The manager of the first lockfile `present` says is there; npm when none is. */
|
|
10
|
+
export const managerOf = (present) => LOCKFILES.find(([file]) => present(file))?.[1] ?? "npm";
|
|
11
|
+
const ADD = {
|
|
12
|
+
npm: ["npm", "install", "--save-dev", "--save-exact"],
|
|
13
|
+
pnpm: ["pnpm", "add", "--save-dev", "--save-exact"],
|
|
14
|
+
yarn: ["yarn", "add", "--dev", "--exact"],
|
|
15
|
+
bun: ["bun", "add", "--dev", "--exact"],
|
|
16
|
+
};
|
|
17
|
+
/** The command that adds `spec` to devDependencies with `manager`. */
|
|
18
|
+
export const addCommand = (manager, spec) => {
|
|
19
|
+
const [file, ...flags] = ADD[manager];
|
|
20
|
+
return [file, ...flags, spec];
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/adapters/package-manager/manager.ts"],"names":[],"mappings":"AAQA,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAA4C;IAChE,CAAC,mBAAmB,EAAE,KAAK,CAAC;IAC5B,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAC1B,CAAC,WAAW,EAAE,MAAM,CAAC;IACrB,CAAC,UAAU,EAAE,KAAK,CAAC;IACnB,CAAC,WAAW,EAAE,KAAK,CAAC;CACrB,CAAC;AAEF,mFAAmF;AACnF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAkC,EAAW,EAAE,CACvE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;AAE1D,MAAM,GAAG,GAAoC;IAC3C,GAAG,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,CAAC;IACrD,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,cAAc,CAAC;IACnD,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC;IACzC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC;CACxC,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,IAAY,EAAQ,EAAE;IACjE,MAAM,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -39,8 +39,8 @@ declare const study: z.ZodObject<{
|
|
|
39
39
|
status: z.ZodEnum<{
|
|
40
40
|
done: "done";
|
|
41
41
|
dropped: "dropped";
|
|
42
|
-
designing: "designing";
|
|
43
42
|
running: "running";
|
|
43
|
+
designing: "designing";
|
|
44
44
|
stopped: "stopped";
|
|
45
45
|
superseded: "superseded";
|
|
46
46
|
}>;
|
|
@@ -125,8 +125,8 @@ declare const registry: z.ZodObject<{
|
|
|
125
125
|
status: z.ZodEnum<{
|
|
126
126
|
done: "done";
|
|
127
127
|
dropped: "dropped";
|
|
128
|
-
designing: "designing";
|
|
129
128
|
running: "running";
|
|
129
|
+
designing: "designing";
|
|
130
130
|
stopped: "stopped";
|
|
131
131
|
superseded: "superseded";
|
|
132
132
|
}>;
|
package/dist/cli.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ import { type Parsed, type ConfigBlock, type RuleBlock } from "./rules-config.ts
|
|
|
38
38
|
export { init };
|
|
39
39
|
export { nextSteps } from "./init.ts";
|
|
40
40
|
import { type LinkReport } from "./link-skills.ts";
|
|
41
|
+
import type { ProjectInstall } from "./ports/project-install.ts";
|
|
41
42
|
import { type Upload } from "./submission-confirm-hook.ts";
|
|
42
43
|
/** The config the user would otherwise write by hand. The data comes from `opts`, the mechanism is here. */
|
|
43
44
|
export declare function buildConfig(opts: PaperlintConfig | undefined, texLanguage: unknown, papers?: PaperScope): ConfigBlock[];
|
|
@@ -257,10 +258,12 @@ export declare function initTexLive(a: Args, { log, err, cwd, }: {
|
|
|
257
258
|
readonly installed: () => boolean;
|
|
258
259
|
readonly install: () => number;
|
|
259
260
|
};
|
|
260
|
-
export declare function run(argv: readonly string[], { log, err, cwd, now, checkReferences, loadTexLanguage, skillLinks, }?: {
|
|
261
|
+
export declare function run(argv: readonly string[], { log, err, cwd, now, checkReferences, loadTexLanguage, skillLinks, install, }?: {
|
|
261
262
|
log?: typeof console.log;
|
|
262
263
|
err?: typeof console.error;
|
|
263
264
|
cwd?: string;
|
|
265
|
+
/** How `init` adds paperlint to a project: the package manager by default; a test hands a fake. */
|
|
266
|
+
install?: ProjectInstall;
|
|
264
267
|
/** The clock `lint` times itself with, in milliseconds; a test hands one that answers fixed values. */
|
|
265
268
|
now?: () => number;
|
|
266
269
|
/**
|
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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O,CAAC,MAAM,CAAC,CAcjB"}
|
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
* replaced it: silently breaking someone else's workflow is worse than asking them to fix a line.
|
|
25
25
|
*/
|
|
26
26
|
import { ESLint } from "eslint";
|
|
27
|
-
import { readFileSync, readdirSync, existsSync, statSync } from "node:fs";
|
|
27
|
+
import { readFileSync, readdirSync, existsSync, realpathSync, statSync, } from "node:fs";
|
|
28
|
+
import { absolutePath } from "./domain/paths.js";
|
|
28
29
|
import { createRequire } from "node:module";
|
|
29
30
|
import { stripVTControlCharacters } from "node:util";
|
|
30
31
|
import { spawnSync } from "node:child_process";
|
|
@@ -76,7 +77,7 @@ import { ANY_PAPER, narrowToOwners, ownedPatterns, paperFiles, papersScope, rule
|
|
|
76
77
|
import { paperPreset, settingsProblemLine, presetProblemText, resolvePreset, resolveShipped, bareSeriesText, shippedPresets, shippedSpec, shippedFolderNames, SHIPPED_PREFIX, } from "./presets.js";
|
|
77
78
|
import { mergeRequirements, declaredUnion, requirementsFor, NO_REQUIREMENTS, } from "./tex-requirements.js";
|
|
78
79
|
import { doctor } from "./doctor.js";
|
|
79
|
-
import { askOnTerminal, askOrDefault, init, processInteractivity, } from "./init.js";
|
|
80
|
+
import { askOnTerminal, askOrDefault, CANCELLED_CODE, CANCELLED_LINE, init, processInteractivity, } from "./init.js";
|
|
80
81
|
import { newPaper, reportNewPaper, STATUS_FILE, } from "./new-paper.js";
|
|
81
82
|
// The one source for the consumer's config key lives in lib/ (the ESLint rules and the skill scripts
|
|
82
83
|
// import it too). It is imported compiled, from dist/, the one path that resolves the same from src/
|
|
@@ -106,7 +107,9 @@ import { paperFolderOf, writtenPath } from "./domain/paper-folder.js";
|
|
|
106
107
|
import { papersReached } from "./domain/paper-dirs.js";
|
|
107
108
|
import { NOTICE_HOOKS, collector, lintLine, mergeNotice, noticeText, notYetTold, recordTold, } from "./hooks-notice.js";
|
|
108
109
|
import { unwiredHooks } from "./hooks-settings.js";
|
|
109
|
-
import { linkSkills, unlinkedSkills } from "./link-skills.js";
|
|
110
|
+
import { linkSkills, locatePackage, unlinkedSkills, } from "./link-skills.js";
|
|
111
|
+
import { projectInstall } from "./adapters/package-manager/index.js";
|
|
112
|
+
import { selfInstallStep, versionOf, } from "./self-install.js";
|
|
110
113
|
import { lintEditedHook, } from "./lint-edited-hook.js";
|
|
111
114
|
import { submissionConfirm, UNREADABLE_INPUT, } from "./submission-confirm-hook.js";
|
|
112
115
|
import { leafCommandsNormalized } from "vigiles/hook";
|
|
@@ -1788,17 +1791,25 @@ function cliPapers(a, cwd) {
|
|
|
1788
1791
|
: null;
|
|
1789
1792
|
}
|
|
1790
1793
|
/** `paperlint init`: its flags checked here, the install itself in `init.ts`. */
|
|
1791
|
-
async function runInit(a, { log, err, cwd, }) {
|
|
1794
|
+
async function runInit(a, { log, err, cwd, install, }) {
|
|
1792
1795
|
// Deferred, not implemented: named and refused, rather than read as the directory argument.
|
|
1793
1796
|
if (a.hooksMode !== null) {
|
|
1794
1797
|
err(`--hooks=${a.hooksMode} is not implemented. init writes the hooks into .claude/settings.json ` +
|
|
1795
1798
|
`(shared, committed) or, with --no-hooks, nowhere.`);
|
|
1796
1799
|
return 2;
|
|
1797
1800
|
}
|
|
1801
|
+
// Loaded here, not at the top: every hook runs through this file, and none of them asks anything.
|
|
1802
|
+
const { clackPrompts } = await import("./adapters/clack/index.js");
|
|
1803
|
+
const prompts = clackPrompts();
|
|
1804
|
+
// Step 0, before init: paperlint itself, in the project's devDependencies (`self-install.ts`).
|
|
1805
|
+
const stop = await selfInstallStep(absolutePath(resolve(cwd, a.paths[0] ?? ".")), selfInstallDeps(install), { prompts, interactive: processInteractivity(a.yes).interactive, log }, { code: CANCELLED_CODE, line: CANCELLED_LINE });
|
|
1806
|
+
if (stop !== null)
|
|
1807
|
+
return stop;
|
|
1798
1808
|
return await init(a.paths[0] ?? ".", {
|
|
1799
1809
|
log,
|
|
1800
1810
|
err,
|
|
1801
1811
|
cwd,
|
|
1812
|
+
prompts,
|
|
1802
1813
|
yes: a.yes,
|
|
1803
1814
|
hooks: !a.noHooks,
|
|
1804
1815
|
paper: a.paper,
|
|
@@ -1808,9 +1819,34 @@ async function runInit(a, { log, err, cwd, }) {
|
|
|
1808
1819
|
resolveCliPapers: (root) => cliPapers({ ...a, config: null }, root),
|
|
1809
1820
|
});
|
|
1810
1821
|
}
|
|
1822
|
+
/** This copy of paperlint: its real directory and its version. */
|
|
1823
|
+
const runningCopy = () => ({
|
|
1824
|
+
dir: realpathSync(fileURLToPath(new URL("..", import.meta.url))),
|
|
1825
|
+
version: packageVersion(),
|
|
1826
|
+
});
|
|
1827
|
+
/**
|
|
1828
|
+
* What `init` needs to add paperlint to a project. `PAPERLINT_INSTALL_SPEC` replaces what is added
|
|
1829
|
+
* (a tarball, for the install e2e: an unreleased build's version is on no registry).
|
|
1830
|
+
*/
|
|
1831
|
+
const selfInstallDeps = (install) => {
|
|
1832
|
+
const running = runningCopy();
|
|
1833
|
+
return {
|
|
1834
|
+
running,
|
|
1835
|
+
installed: (root) => {
|
|
1836
|
+
const at = locatePackage(root);
|
|
1837
|
+
if ("error" in at)
|
|
1838
|
+
return null;
|
|
1839
|
+
const version = versionOf(nodeFiles.readBytes(absolutePath(join(at.dir, "package.json"))));
|
|
1840
|
+
return version === null ? null : { dir: at.dir, version };
|
|
1841
|
+
},
|
|
1842
|
+
files: nodeFiles,
|
|
1843
|
+
install,
|
|
1844
|
+
spec: process.env["PAPERLINT_INSTALL_SPEC"] ?? `paperlint@${running.version}`,
|
|
1845
|
+
};
|
|
1846
|
+
};
|
|
1811
1847
|
/** The LaTeX language, loaded when a lint needs it: only `lint` and the `lint-edited` hook do. */
|
|
1812
1848
|
const loadLatexLanguage = async () => (await import("#eslint-rules/latex-language")).texLanguage;
|
|
1813
|
-
export async function run(argv, { log = console.log, err = console.error, cwd = process.cwd(), now = () => performance.now(), checkReferences = onlineReferences, loadTexLanguage = loadLatexLanguage, skillLinks = readSkillLinks, } = {}) {
|
|
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, } = {}) {
|
|
1814
1850
|
const a = parseArgs(argv);
|
|
1815
1851
|
// The refusal must come FIRST: behind a flag without a value there is usually a typo, or a
|
|
1816
1852
|
// substitution in CI that collapsed into nothing, and any continuation works on something other
|
|
@@ -1833,7 +1869,7 @@ export async function run(argv, { log = console.log, err = console.error, cwd =
|
|
|
1833
1869
|
// not two implementations of the same question. A second resolver here is the defect the
|
|
1834
1870
|
// comparison exists to catch.
|
|
1835
1871
|
if (a.cmd === "init")
|
|
1836
|
-
return await runInit(a, { log, err, cwd });
|
|
1872
|
+
return await runInit(a, { log, err, cwd, install });
|
|
1837
1873
|
// `doctor` reads the config but must NOT die on a broken one — reporting that the config is
|
|
1838
1874
|
// broken is precisely its job. So a failed read becomes "the CLI would lint nothing", which is
|
|
1839
1875
|
// what it prints, rather than an early exit that tells the reader nothing about the hooks.
|