paperlint 20.1.2 → 20.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CLAUDE.md +5 -1
- package/dist/adapters/venue-corpus/index.d.ts +361 -0
- package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
- package/dist/adapters/venue-corpus/index.js +221 -0
- package/dist/adapters/venue-corpus/index.js.map +1 -0
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +42 -13
- package/dist/cli.js.map +1 -1
- package/dist/corpus-record-rule.d.ts +65 -0
- package/dist/corpus-record-rule.d.ts.map +1 -0
- package/dist/corpus-record-rule.js +85 -0
- package/dist/corpus-record-rule.js.map +1 -0
- package/dist/domain/corpus-record.d.ts +51 -0
- package/dist/domain/corpus-record.d.ts.map +1 -0
- package/dist/domain/corpus-record.js +119 -0
- package/dist/domain/corpus-record.js.map +1 -0
- package/dist/domain/licence.d.ts +51 -0
- package/dist/domain/licence.d.ts.map +1 -0
- package/dist/domain/licence.js +61 -0
- package/dist/domain/licence.js.map +1 -0
- package/dist/domain/venue-corpus.d.ts +142 -0
- package/dist/domain/venue-corpus.d.ts.map +1 -0
- package/dist/domain/venue-corpus.js +17 -0
- package/dist/domain/venue-corpus.js.map +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
- package/dist/paper-files.d.ts +10 -3
- package/dist/paper-files.d.ts.map +1 -1
- package/dist/paper-files.js +17 -2
- package/dist/paper-files.js.map +1 -1
- package/dist/papers-roots.d.ts +6 -0
- package/dist/papers-roots.d.ts.map +1 -1
- package/dist/papers-roots.js +14 -0
- package/dist/papers-roots.js.map +1 -1
- package/dist/ports/venue-corpus-codec.d.ts +11 -0
- package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
- package/dist/ports/venue-corpus-codec.js +2 -0
- package/dist/ports/venue-corpus-codec.js.map +1 -0
- package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
- package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
- package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
- package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
- package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
- package/docs/design/venue-corpus.md +271 -0
- package/docs/layout.md +2 -2
- package/docs/rules/corpus/record.md +119 -0
- package/docs/rules.md +1 -0
- package/docs/venues.md +158 -24
- package/eslint-rules/CLAUDE.md +5 -1
- package/eslint-rules/CLAUDE.md.spec.ts +3 -0
- package/eslint.config.mjs +1 -0
- package/package.json +3 -1
- package/scripts/bundle-skills.ts +1 -0
- package/scripts/eslint-file-length.mjs +3 -3
- package/scripts/venue-corpus-schema.test.ts +39 -0
- package/scripts/venue-corpus-schema.ts +17 -0
- package/skills/argument-arc/scripts/headings.js +6 -4
- package/skills/cold-read-diff/scripts/cold-read.js +6 -4
- package/skills/paper-pipeline/scripts/extract-ref-facts.js +6 -5
- package/skills/pc-panel-review/scripts/prior-reviews.js +7 -5
- package/skills/study-accepted-papers/SKILL.md +34 -2
- package/skills/study-accepted-papers/SKILL.md.spec.ts +33 -1
- package/skills/study-accepted-papers/papers.schema.json +474 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +303 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.js +393 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +488 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
- package/skills/verify-citations/scripts/bib-authors.js +6 -5
- package/skills/verify-citations/scripts/verify-cites.js +6 -5
- package/src/adapters/venue-corpus/index.test.ts +337 -0
- package/src/adapters/venue-corpus/index.ts +306 -0
- package/src/cli-e2e.test.mjs +2 -2
- package/src/cli.test.ts +1 -1
- package/src/cli.ts +57 -13
- package/src/corpus-record-rule.test.ts +228 -0
- package/src/corpus-record-rule.ts +175 -0
- package/src/domain/corpus-record.test.ts +163 -0
- package/src/domain/corpus-record.ts +210 -0
- package/src/domain/licence.test.ts +122 -0
- package/src/domain/licence.ts +95 -0
- package/src/domain/venue-corpus.ts +159 -0
- package/src/paper-files.test.ts +13 -4
- package/src/paper-files.ts +23 -2
- package/src/paper-settings-commands.test.ts +2 -2
- package/src/papers-roots.test.ts +34 -1
- package/src/papers-roots.ts +15 -0
- package/src/ports/venue-corpus-codec.ts +11 -0
- package/src/rule-cases.test.ts +15 -0
- package/src/settled-paper.test.ts +1 -1
- package/src/unowned-file.test.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paper-files.d.ts","sourceRoot":"","sources":["../src/paper-files.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paper-files.d.ts","sourceRoot":"","sources":["../src/paper-files.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IACE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAEN,eAAO,MAAM,SAAS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SAAS,WAAW,EAAE,GAAG,MAAM,EAAE,CAEnE;AAKD,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG;IACtD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;CAC5B,CASA;AAQD;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,SAAS,WAAW,EAAE,GAC1B,GAAG,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,CAYpC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC,EAClD,MAAM,GAAE,UAAsB,GAC7B,WAAW,EAAE,CAkBf"}
|
package/dist/paper-files.js
CHANGED
|
@@ -41,21 +41,36 @@
|
|
|
41
41
|
* - `files: [["a", "b"]]` matches a file only when BOTH patterns match.
|
|
42
42
|
*/
|
|
43
43
|
import { relative, sep } from "node:path";
|
|
44
|
+
import { CORPORA_DIR } from "./domain/corpus-record.js";
|
|
44
45
|
export const ANY_PAPER = { kind: "any" };
|
|
45
46
|
/** The characters a glob reads as syntax, escaped so a folder's name matches only itself. Pure. */
|
|
46
47
|
const literalGlob = (path) => path.replace(/[\\*?[\]{}()!+@]/gu, "\\$&");
|
|
47
48
|
/** `to` relative to `from`, `/`-separated. Pure. */
|
|
48
49
|
const posixRelative = (from, to) => relative(from, to).split(sep).join("/");
|
|
49
|
-
/** The papers `dirs` under ESLint's `cwd`: the scope `paperlint lint` lints. Pure. */
|
|
50
|
-
export const papersScope = (dirs, cwd) => ({
|
|
50
|
+
/** The papers `dirs` and the papers `roots` under ESLint's `cwd`: the scope `paperlint lint` lints. Pure. */
|
|
51
|
+
export const papersScope = (dirs, cwd, roots) => ({
|
|
51
52
|
kind: "papers",
|
|
52
53
|
cwd,
|
|
53
54
|
prefixes: dirs.map((d) => literalGlob(posixRelative(cwd, d))),
|
|
55
|
+
roots,
|
|
54
56
|
});
|
|
55
57
|
/** A glob of a paper's own file (`paper.tex`, `reviews/*.md`) in each paper of `scope`. Pure. */
|
|
56
58
|
export const paperFiles = (scope, glob) => scope.kind === "any"
|
|
57
59
|
? [`**/${glob}`]
|
|
58
60
|
: scope.prefixes.map((p) => (p === "" ? glob : `${p}/${glob}`));
|
|
61
|
+
/**
|
|
62
|
+
* A glob of a file in each venue corpus, `<papers-root>/venues/<venue>/<glob>`; none for a root
|
|
63
|
+
* outside ESLint's `cwd`, whose files ESLint never lints. Pure.
|
|
64
|
+
*/
|
|
65
|
+
export const corpusFiles = (scope, glob) => {
|
|
66
|
+
const inCorpus = `${CORPORA_DIR}/*/${glob}`;
|
|
67
|
+
if (scope.kind === "any")
|
|
68
|
+
return [`**/${inCorpus}`];
|
|
69
|
+
return scope.roots
|
|
70
|
+
.map((r) => posixRelative(scope.cwd, r))
|
|
71
|
+
.filter((r) => r !== ".." && !r.startsWith("../"))
|
|
72
|
+
.map((r) => (r === "" ? inCorpus : `${literalGlob(r)}/${inCorpus}`));
|
|
73
|
+
};
|
|
59
74
|
/**
|
|
60
75
|
* A glob relative to `cwd`, as the block whose `basePath` is `base` must write it — ESLint reads a
|
|
61
76
|
* block's patterns from its `basePath`, and a paper's own settings carry the paper's folder. None
|
package/dist/paper-files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paper-files.js","sourceRoot":"","sources":["../src/paper-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"paper-files.js","sourceRoot":"","sources":["../src/paper-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,OAAO,EAAE,QAAQ,EAAE,GAAG,EAA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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IAChB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7D,OAAO;QACL;YACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,KAAK;YACL,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtE,KAAK;SACN;KACF,CAAC;AACJ,CAAC"}
|
package/dist/papers-roots.d.ts
CHANGED
|
@@ -16,4 +16,10 @@ export declare const papersRoots: (cfg: {
|
|
|
16
16
|
* when it is under none of them. `file` must be absolute; so must the roots (`papersRoots`).
|
|
17
17
|
*/
|
|
18
18
|
export declare function segmentsUnder(file: string, roots: readonly string[]): readonly string[] | null;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the absolute folder `dir` is a venue corpus of one of `roots`, or inside one:
|
|
21
|
+
* `<root>/venues/<venue>/` and below. A paper found there is an accepted paper's source kept in the
|
|
22
|
+
* corpus, not one of the project's papers (#215), so no paper rule judges it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function inCorpus(dir: string, roots: readonly string[]): boolean;
|
|
19
25
|
//# sourceMappingURL=papers-roots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"papers-roots.d.ts","sourceRoot":"","sources":["../src/papers-roots.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"papers-roots.d.ts","sourceRoot":"","sources":["../src/papers-roots.ts"],"names":[],"mappings":"AAeA,0GAA0G;AAC1G,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAG3E;AAED,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAO1D;AAED,4FAA4F;AAC5F,eAAO,MAAM,WAAW,GAAI,KAAK;IAC/B,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,KAAG,SAAS,MAAM,EACkD,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,SAAS,MAAM,EAAE,GAAG,IAAI,CAW1B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAOvE"}
|
package/dist/papers-roots.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { isAbsolute, relative, resolve, sep } from "node:path";
|
|
13
13
|
import { DEFAULT_PAPERS_ROOT } from "#lib/paper-config";
|
|
14
|
+
import { CORPORA_DIR } from "./domain/corpus-record.js";
|
|
14
15
|
/** The papers directory field of the settings, read by its one declared name; the default when absent. */
|
|
15
16
|
export function papersDirOf(opts) {
|
|
16
17
|
const declared = opts.papersDir;
|
|
@@ -39,4 +40,17 @@ export function segmentsUnder(file, roots) {
|
|
|
39
40
|
!isAbsolute(rel));
|
|
40
41
|
return below === undefined ? null : below.split(sep);
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Whether the absolute folder `dir` is a venue corpus of one of `roots`, or inside one:
|
|
45
|
+
* `<root>/venues/<venue>/` and below. A paper found there is an accepted paper's source kept in the
|
|
46
|
+
* corpus, not one of the project's papers (#215), so no paper rule judges it.
|
|
47
|
+
*/
|
|
48
|
+
export function inCorpus(dir, roots) {
|
|
49
|
+
// Each root on its own: roots may overlap (`.` and `papers`), and the first that holds `dir` need
|
|
50
|
+
// not be the one whose `venues/` it is in.
|
|
51
|
+
return roots.some((root) => {
|
|
52
|
+
const [first, venue] = segmentsUnder(dir, [root]) ?? [];
|
|
53
|
+
return first === CORPORA_DIR && venue !== undefined;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
42
56
|
//# sourceMappingURL=papers-roots.js.map
|
package/dist/papers-roots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"papers-roots.js","sourceRoot":"","sources":["../src/papers-roots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,0GAA0G;AAC1G,MAAM,UAAU,WAAW,CAAC,IAAsC;IAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;IAChC,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC;AACjE,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,OAAO,CAAC,MAAe;IACrC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACvB,OAAO,MAAM,CAAC,MAAM,CAClB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;IACJ,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,KAAwB;IAC5D,kGAAkG;IAClG,2CAA2C;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,OAAO,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,SAAS,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a venue corpus's `papers.json` becomes a value: its text parsed once, where it enters, against
|
|
3
|
+
* the schema of `VenueCorpus` (`src/domain/venue-corpus.ts`). The one implementation is
|
|
4
|
+
* `src/adapters/venue-corpus/` (zod).
|
|
5
|
+
*/
|
|
6
|
+
import type { ParsedCorpus } from "../domain/venue-corpus.ts";
|
|
7
|
+
export interface VenueCorpusCodec {
|
|
8
|
+
/** A `papers.json`'s text: the record, or every reason it is not one, each with its path. */
|
|
9
|
+
readonly parse: (text: string) => ParsedCorpus;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=venue-corpus-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"venue-corpus-codec.d.ts","sourceRoot":"","sources":["../../src/ports/venue-corpus-codec.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,YAAY,CAAC;CAChD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"venue-corpus-codec.js","sourceRoot":"","sources":["../../src/ports/venue-corpus-codec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createRequire as __plCreateRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __plFileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __plDirname } from "node:path";
|
|
4
|
+
const require = __plCreateRequire(import.meta.url);
|
|
5
|
+
const __filename = __plFileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __plDirname(__filename);
|
|
7
|
+
|
|
8
|
+
// src/domain/text.ts
|
|
9
|
+
var printed = (stream) => stream ?? "";
|
|
10
|
+
var messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
11
|
+
var codeOf = (e) => typeof e === "object" && e !== null && "code" in e && typeof e.code === "string" ? e.code : void 0;
|
|
12
|
+
|
|
13
|
+
// src/adapters/node/files.io.ts
|
|
14
|
+
import {
|
|
15
|
+
mkdirSync,
|
|
16
|
+
readFileSync,
|
|
17
|
+
renameSync,
|
|
18
|
+
rmSync,
|
|
19
|
+
statSync,
|
|
20
|
+
writeFileSync
|
|
21
|
+
} from "node:fs";
|
|
22
|
+
import { dirname } from "node:path";
|
|
23
|
+
var errorCode = (e) => codeOf(e);
|
|
24
|
+
var nodeFiles = {
|
|
25
|
+
isFile(p) {
|
|
26
|
+
return statSync(p, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
27
|
+
},
|
|
28
|
+
readBytes(p) {
|
|
29
|
+
try {
|
|
30
|
+
return readFileSync(p);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
if (errorCode(e) === "ENOENT") return null;
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
writeAtomic(p, bytes) {
|
|
37
|
+
const part = `${p}.part`;
|
|
38
|
+
mkdirSync(dirname(p), { recursive: true });
|
|
39
|
+
try {
|
|
40
|
+
writeFileSync(part, bytes);
|
|
41
|
+
renameSync(part, p);
|
|
42
|
+
} finally {
|
|
43
|
+
rmSync(part, { force: true });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/adapters/node/process.io.ts
|
|
49
|
+
import {
|
|
50
|
+
spawnSync
|
|
51
|
+
} from "node:child_process";
|
|
52
|
+
var errno = (r) => codeOf(r.error);
|
|
53
|
+
function exitOf(r, c) {
|
|
54
|
+
const out = {
|
|
55
|
+
stdout: printed(r.stdout),
|
|
56
|
+
stderr: printed(r.stderr)
|
|
57
|
+
};
|
|
58
|
+
const code = errno(r);
|
|
59
|
+
if (code === "ENOENT") return { kind: "not-found", file: c.file };
|
|
60
|
+
if (code === "ETIMEDOUT")
|
|
61
|
+
return { kind: "timed-out", afterMs: c.timeoutMs, ...out };
|
|
62
|
+
if (r.error) return { kind: "spawn-failed", message: r.error.message };
|
|
63
|
+
if (r.signal) return { kind: "signalled", signal: r.signal, ...out };
|
|
64
|
+
return { kind: "exited", status: r.status ?? 1, ...out };
|
|
65
|
+
}
|
|
66
|
+
function spawnProcess(spawn = spawnSync) {
|
|
67
|
+
return {
|
|
68
|
+
run(c) {
|
|
69
|
+
const opts = {
|
|
70
|
+
encoding: "utf8",
|
|
71
|
+
env: { ...c.env },
|
|
72
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
73
|
+
timeout: c.timeoutMs,
|
|
74
|
+
...c.maxOutputBytes ? { maxBuffer: c.maxOutputBytes } : {},
|
|
75
|
+
...c.cwd ? { cwd: c.cwd } : {}
|
|
76
|
+
};
|
|
77
|
+
return exitOf(spawn(c.file, [...c.args], opts), c);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/domain/paths.ts
|
|
83
|
+
import { isAbsolute, join, posix } from "node:path";
|
|
84
|
+
|
|
85
|
+
// src/domain/result.ts
|
|
86
|
+
var ok = (value) => ({ ok: true, value });
|
|
87
|
+
var err = (error) => ({ ok: false, error });
|
|
88
|
+
|
|
89
|
+
// src/domain/paths.ts
|
|
90
|
+
var isAbsolutePath = (p) => isAbsolute(p);
|
|
91
|
+
function absolutePath(p) {
|
|
92
|
+
if (!isAbsolutePath(p)) throw new Error(`not an absolute path: ${p}`);
|
|
93
|
+
return p;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/caller-path.ts
|
|
97
|
+
import { resolve } from "node:path";
|
|
98
|
+
var callerPath = (p) => absolutePath(resolve(p));
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
ok,
|
|
102
|
+
err,
|
|
103
|
+
messageOf,
|
|
104
|
+
nodeFiles,
|
|
105
|
+
spawnProcess,
|
|
106
|
+
absolutePath,
|
|
107
|
+
callerPath
|
|
108
|
+
};
|
|
@@ -9,21 +9,23 @@ import {
|
|
|
9
9
|
printRaw,
|
|
10
10
|
replaceNode,
|
|
11
11
|
visit
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
CONFIG_KEY,
|
|
15
|
-
settingsOf
|
|
16
|
-
} from "./chunk-IREAROCV.js";
|
|
12
|
+
} from "./chunk-CXAGKT44.js";
|
|
17
13
|
import {
|
|
18
14
|
JOBNAME,
|
|
19
|
-
callerPath,
|
|
20
15
|
decoded,
|
|
21
16
|
describeChanges,
|
|
22
|
-
err,
|
|
23
|
-
ok,
|
|
24
17
|
paperRecord,
|
|
25
18
|
spelledIn
|
|
26
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-J5XYPERO.js";
|
|
20
|
+
import {
|
|
21
|
+
CONFIG_KEY,
|
|
22
|
+
settingsOf
|
|
23
|
+
} from "./chunk-Z5YMDZYW.js";
|
|
24
|
+
import {
|
|
25
|
+
callerPath,
|
|
26
|
+
err,
|
|
27
|
+
ok
|
|
28
|
+
} from "./chunk-5KCU4WTN.js";
|
|
27
29
|
import {
|
|
28
30
|
__commonJS,
|
|
29
31
|
__toESM
|
|
@@ -11,13 +11,11 @@ import {
|
|
|
11
11
|
SOURCES_SCHEMA,
|
|
12
12
|
collapse,
|
|
13
13
|
documentClassLine,
|
|
14
|
-
err,
|
|
15
14
|
fieldOf,
|
|
16
|
-
ok,
|
|
17
15
|
optionsInEffect,
|
|
18
16
|
readWhole,
|
|
19
17
|
venueClass
|
|
20
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-J5XYPERO.js";
|
|
21
19
|
import {
|
|
22
20
|
countBy,
|
|
23
21
|
hasAtLeast,
|
|
@@ -28,6 +26,10 @@ import {
|
|
|
28
26
|
sortBy,
|
|
29
27
|
zip
|
|
30
28
|
} from "./chunk-C2G5EK7S.js";
|
|
29
|
+
import {
|
|
30
|
+
err,
|
|
31
|
+
ok
|
|
32
|
+
} from "./chunk-5KCU4WTN.js";
|
|
31
33
|
import {
|
|
32
34
|
external_exports
|
|
33
35
|
} from "./chunk-4MHEJ6FR.js";
|
|
@@ -4,59 +4,9 @@ import { dirname as __plDirname } from "node:path";
|
|
|
4
4
|
const require = __plCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __plFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __plDirname(__filename);
|
|
7
|
-
|
|
8
|
-
// src/domain/text.ts
|
|
9
|
-
var messageOf = (e) => e instanceof Error ? e.message : String(e);
|
|
10
|
-
var codeOf = (e) => typeof e === "object" && e !== null && "code" in e && typeof e.code === "string" ? e.code : void 0;
|
|
11
|
-
|
|
12
|
-
// src/adapters/node/files.io.ts
|
|
13
7
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
renameSync,
|
|
17
|
-
rmSync,
|
|
18
|
-
statSync,
|
|
19
|
-
writeFileSync
|
|
20
|
-
} from "node:fs";
|
|
21
|
-
import { dirname } from "node:path";
|
|
22
|
-
var errorCode = (e) => codeOf(e);
|
|
23
|
-
var nodeFiles = {
|
|
24
|
-
isFile(p) {
|
|
25
|
-
return statSync(p, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
26
|
-
},
|
|
27
|
-
readBytes(p) {
|
|
28
|
-
try {
|
|
29
|
-
return readFileSync(p);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
if (errorCode(e) === "ENOENT") return null;
|
|
32
|
-
throw e;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
writeAtomic(p, bytes) {
|
|
36
|
-
const part = `${p}.part`;
|
|
37
|
-
mkdirSync(dirname(p), { recursive: true });
|
|
38
|
-
try {
|
|
39
|
-
writeFileSync(part, bytes);
|
|
40
|
-
renameSync(part, p);
|
|
41
|
-
} finally {
|
|
42
|
-
rmSync(part, { force: true });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// src/domain/paths.ts
|
|
48
|
-
import { isAbsolute, join, posix } from "node:path";
|
|
49
|
-
|
|
50
|
-
// src/domain/result.ts
|
|
51
|
-
var ok = (value) => ({ ok: true, value });
|
|
52
|
-
var err = (error) => ({ ok: false, error });
|
|
53
|
-
|
|
54
|
-
// src/domain/paths.ts
|
|
55
|
-
var isAbsolutePath = (p) => isAbsolute(p);
|
|
56
|
-
function absolutePath(p) {
|
|
57
|
-
if (!isAbsolutePath(p)) throw new Error(`not an absolute path: ${p}`);
|
|
58
|
-
return p;
|
|
59
|
-
}
|
|
8
|
+
callerPath
|
|
9
|
+
} from "./chunk-5KCU4WTN.js";
|
|
60
10
|
|
|
61
11
|
// src/domain/tex-document.ts
|
|
62
12
|
var collapse = (s) => s.split(/\s+/u).filter(Boolean).join(" ");
|
|
@@ -100,12 +50,8 @@ function spelledIn(names, name) {
|
|
|
100
50
|
return only !== void 0 && more.length === 0 ? only : null;
|
|
101
51
|
}
|
|
102
52
|
|
|
103
|
-
// src/caller-path.ts
|
|
104
|
-
import { resolve } from "node:path";
|
|
105
|
-
var callerPath = (p) => absolutePath(resolve(p));
|
|
106
|
-
|
|
107
53
|
// src/paper-record.ts
|
|
108
|
-
import { resolve as
|
|
54
|
+
import { resolve as resolve2 } from "node:path";
|
|
109
55
|
|
|
110
56
|
// src/domain/sha256.ts
|
|
111
57
|
import { createHash } from "node:crypto";
|
|
@@ -119,12 +65,12 @@ function parseSha256(s) {
|
|
|
119
65
|
var sha256Hex = (bytes) => parseSha256(createHash("sha256").update(bytes).digest("hex"));
|
|
120
66
|
|
|
121
67
|
// src/sources-record.ts
|
|
122
|
-
import { join
|
|
123
|
-
var sourcesPath = (paperDir) =>
|
|
68
|
+
import { join, posix, resolve } from "node:path";
|
|
69
|
+
var sourcesPath = (paperDir) => join(paperDir, SOURCES_DIR, SOURCES_FILE);
|
|
124
70
|
|
|
125
71
|
// src/paper-record.ts
|
|
126
72
|
var digestOf = (dir, files) => (path) => {
|
|
127
|
-
const b = files.readBytes(callerPath(
|
|
73
|
+
const b = files.readBytes(callerPath(resolve2(dir, path)));
|
|
128
74
|
return b === null ? null : sha256Hex(b);
|
|
129
75
|
};
|
|
130
76
|
function paperRecord(dir, deps) {
|
|
@@ -137,13 +83,13 @@ function paperRecord(dir, deps) {
|
|
|
137
83
|
}
|
|
138
84
|
|
|
139
85
|
// src/tex-paper.ts
|
|
140
|
-
import { basename, dirname
|
|
86
|
+
import { basename, dirname, join as join2 } from "node:path";
|
|
141
87
|
|
|
142
88
|
// src/domain/paper-source.ts
|
|
143
|
-
import { posix as
|
|
89
|
+
import { posix as posix2 } from "node:path";
|
|
144
90
|
var candidates = (target) => {
|
|
145
|
-
const t =
|
|
146
|
-
return
|
|
91
|
+
const t = posix2.normalize(target.trim());
|
|
92
|
+
return posix2.extname(t) === "" ? [`${t}.tex`, t] : [t];
|
|
147
93
|
};
|
|
148
94
|
function found(target, read) {
|
|
149
95
|
const hits = candidates(target).flatMap((path) => {
|
|
@@ -212,7 +158,7 @@ function assemblePaper(main, text, deps) {
|
|
|
212
158
|
// src/tex-paper.ts
|
|
213
159
|
var decoded = (b) => b === null ? null : new TextDecoder().decode(b);
|
|
214
160
|
function readPaper(filename, src, deps) {
|
|
215
|
-
const dir =
|
|
161
|
+
const dir = dirname(filename);
|
|
216
162
|
const record = paperRecord(dir, deps);
|
|
217
163
|
const listed = record.kind === "fresh" ? record.record.inputs.map((i) => i.path) : [];
|
|
218
164
|
return assemblePaper(basename(filename), src, {
|
|
@@ -221,7 +167,7 @@ function readPaper(filename, src, deps) {
|
|
|
221
167
|
documentBody: deps.latex.documentBody,
|
|
222
168
|
read: (rel) => {
|
|
223
169
|
const recorded = spelledIn(listed, rel);
|
|
224
|
-
return recorded === null ? null : decoded(deps.files.readBytes(callerPath(
|
|
170
|
+
return recorded === null ? null : decoded(deps.files.readBytes(callerPath(join2(dir, recorded))));
|
|
225
171
|
}
|
|
226
172
|
});
|
|
227
173
|
}
|
|
@@ -233,8 +179,6 @@ var fieldOf = (v, key) => isRecord(v) ? v[key] : void 0;
|
|
|
233
179
|
export {
|
|
234
180
|
isRecord,
|
|
235
181
|
fieldOf,
|
|
236
|
-
ok,
|
|
237
|
-
err,
|
|
238
182
|
collapse,
|
|
239
183
|
optionsInEffect,
|
|
240
184
|
readWhole,
|
|
@@ -243,15 +187,11 @@ export {
|
|
|
243
187
|
runText,
|
|
244
188
|
OPAQUE,
|
|
245
189
|
LINE_BREAK,
|
|
246
|
-
messageOf,
|
|
247
|
-
nodeFiles,
|
|
248
|
-
absolutePath,
|
|
249
190
|
SOURCES_SCHEMA,
|
|
250
191
|
SOURCES_FILE,
|
|
251
192
|
JOBNAME,
|
|
252
193
|
describeChanges,
|
|
253
194
|
spelledIn,
|
|
254
|
-
callerPath,
|
|
255
195
|
paperRecord,
|
|
256
196
|
decoded,
|
|
257
197
|
readPaper
|
|
@@ -37,6 +37,8 @@ function settingsOf(root) {
|
|
|
37
37
|
}
|
|
38
38
|
return isObject(v) ? v : void 0;
|
|
39
39
|
}
|
|
40
|
+
var DEFAULT_PAPERS_ROOT = "papers";
|
|
41
|
+
var PAPERS_DIR_FIELD = "papersDir";
|
|
40
42
|
var SETTINGS_KEYS = Object.freeze({
|
|
41
43
|
papersDir: `the papers directory, default "papers" \u2014 every command, the hooks`,
|
|
42
44
|
structure: "which files a paper directory must hold \u2014 paperlint lint",
|
|
@@ -79,6 +81,8 @@ export {
|
|
|
79
81
|
CONFIG_FILE,
|
|
80
82
|
findProjectRoot,
|
|
81
83
|
settingsOf,
|
|
84
|
+
DEFAULT_PAPERS_ROOT,
|
|
85
|
+
PAPERS_DIR_FIELD,
|
|
82
86
|
SETTINGS_KEYS,
|
|
83
87
|
ROOT_ONLY_KEYS
|
|
84
88
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type LicenceSettings, type Permission, type StoredKind } from "#src/domain/licence";
|
|
2
|
+
import { type Copy, type KnownVersion, type VenueCorpus } from "#src/domain/venue-corpus";
|
|
3
|
+
import type { Files } from "#src/ports/files";
|
|
4
|
+
import type { RunProcess } from "#src/ports/process";
|
|
5
|
+
import type { VenueCorpusCodec } from "#src/ports/venue-corpus-codec";
|
|
6
|
+
/** Why one copy may not be kept as one kind. */
|
|
7
|
+
export type Refused = Exclude<Permission, {
|
|
8
|
+
readonly kind: "permitted";
|
|
9
|
+
}>;
|
|
10
|
+
/** One copy's refusal: its version, its licence id, and why. */
|
|
11
|
+
export interface Refusal {
|
|
12
|
+
readonly version: Copy["version"];
|
|
13
|
+
readonly licence: string;
|
|
14
|
+
readonly permission: Refused;
|
|
15
|
+
}
|
|
16
|
+
/** For one paper and one kind: the copy to keep, or every copy's refusal (none when it has no copy). */
|
|
17
|
+
export type Verdict = {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly stored: StoredKind;
|
|
20
|
+
readonly outcome: "keep";
|
|
21
|
+
readonly version: KnownVersion;
|
|
22
|
+
readonly licence: string;
|
|
23
|
+
readonly url: string;
|
|
24
|
+
} | {
|
|
25
|
+
readonly key: string;
|
|
26
|
+
readonly stored: StoredKind;
|
|
27
|
+
readonly outcome: "none";
|
|
28
|
+
readonly refusals: readonly Refusal[];
|
|
29
|
+
};
|
|
30
|
+
/** Every paper's verdict for each kind, in the record's order. */
|
|
31
|
+
export declare const verdicts: (corpus: VenueCorpus, settings: Readonly<LicenceSettings>) => readonly Verdict[];
|
|
32
|
+
/** What the command prints for `all`. */
|
|
33
|
+
export declare const listing: (all: readonly Verdict[]) => string;
|
|
34
|
+
/** What the command reads with: the disk, the record's codec, and where the project is. */
|
|
35
|
+
export interface Deps {
|
|
36
|
+
readonly files: Files;
|
|
37
|
+
readonly codec: VenueCorpusCodec;
|
|
38
|
+
/** The top of the git working tree holding `cwd`, or null when `cwd` is in none. */
|
|
39
|
+
readonly projectRoot: (cwd: string) => string | null;
|
|
40
|
+
/** The folder the command was started in. */
|
|
41
|
+
readonly cwd: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `git rev-parse --show-toplevel` in `cwd`: the project's root, or null outside a repository (or
|
|
45
|
+
* when git did not run). `path` is the caller's PATH, the only variable git is given.
|
|
46
|
+
*/
|
|
47
|
+
export declare function gitTopLevel(git: RunProcess, path: string | undefined, cwd: string): string | null;
|
|
48
|
+
/** Where the command writes: the listing, and what stops it. */
|
|
49
|
+
export interface Output {
|
|
50
|
+
readonly out: (s: string) => void;
|
|
51
|
+
readonly err: (s: string) => void;
|
|
52
|
+
}
|
|
53
|
+
/** Run the command on `argv`; the exit code. */
|
|
54
|
+
export declare function main(argv: readonly string[], deps: Deps, { out, err }: Output): number;
|