paperlint 18.4.0 → 18.5.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.
Files changed (104) hide show
  1. package/CLAUDE.md +5 -1
  2. package/dist/adapters/latex/abstract.d.ts +11 -0
  3. package/dist/adapters/latex/abstract.d.ts.map +1 -1
  4. package/dist/adapters/latex/abstract.js +1 -1
  5. package/dist/adapters/latex/abstract.js.map +1 -1
  6. package/dist/adapters/latex/index.d.ts.map +1 -1
  7. package/dist/adapters/latex/index.js +3 -0
  8. package/dist/adapters/latex/index.js.map +1 -1
  9. package/dist/adapters/latex/macros.d.ts +6 -0
  10. package/dist/adapters/latex/macros.d.ts.map +1 -0
  11. package/dist/adapters/latex/macros.js +27 -0
  12. package/dist/adapters/latex/macros.js.map +1 -0
  13. package/dist/adapters/osf/host.io.d.ts +12 -0
  14. package/dist/adapters/osf/host.io.d.ts.map +1 -0
  15. package/dist/adapters/osf/host.io.js +119 -0
  16. package/dist/adapters/osf/host.io.js.map +1 -0
  17. package/dist/adapters/osf/index.d.ts +10 -0
  18. package/dist/adapters/osf/index.d.ts.map +1 -0
  19. package/dist/adapters/osf/index.js +10 -0
  20. package/dist/adapters/osf/index.js.map +1 -0
  21. package/dist/adapters/osf/response.d.ts +11 -0
  22. package/dist/adapters/osf/response.d.ts.map +1 -0
  23. package/dist/adapters/osf/response.js +87 -0
  24. package/dist/adapters/osf/response.js.map +1 -0
  25. package/dist/artifact-upload-rule.d.ts +66 -0
  26. package/dist/artifact-upload-rule.d.ts.map +1 -0
  27. package/dist/artifact-upload-rule.js +151 -0
  28. package/dist/artifact-upload-rule.js.map +1 -0
  29. package/dist/artifact.d.ts +35 -0
  30. package/dist/artifact.d.ts.map +1 -0
  31. package/dist/artifact.js +251 -0
  32. package/dist/artifact.js.map +1 -0
  33. package/dist/cli.d.ts +9 -1
  34. package/dist/cli.d.ts.map +1 -1
  35. package/dist/cli.js +136 -23
  36. package/dist/cli.js.map +1 -1
  37. package/dist/domain/artifact-upload.d.ts +44 -0
  38. package/dist/domain/artifact-upload.d.ts.map +1 -0
  39. package/dist/domain/artifact-upload.js +80 -0
  40. package/dist/domain/artifact-upload.js.map +1 -0
  41. package/dist/domain/paper-dirs.d.ts +16 -0
  42. package/dist/domain/paper-dirs.d.ts.map +1 -0
  43. package/dist/domain/paper-dirs.js +42 -0
  44. package/dist/domain/paper-dirs.js.map +1 -0
  45. package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
  46. package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
  47. package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
  48. package/dist/paper-files.d.ts +25 -42
  49. package/dist/paper-files.d.ts.map +1 -1
  50. package/dist/paper-files.js +101 -9
  51. package/dist/paper-files.js.map +1 -1
  52. package/dist/ports/artifact-host.d.ts +54 -0
  53. package/dist/ports/artifact-host.d.ts.map +1 -0
  54. package/dist/ports/artifact-host.js +2 -0
  55. package/dist/ports/artifact-host.js.map +1 -0
  56. package/dist/ports/latex.d.ts +9 -0
  57. package/dist/ports/latex.d.ts.map +1 -1
  58. package/dist/submission-confirm-hook.d.ts +11 -1
  59. package/dist/submission-confirm-hook.d.ts.map +1 -1
  60. package/dist/submission-confirm-hook.js +83 -21
  61. package/dist/submission-confirm-hook.js.map +1 -1
  62. package/dist/types.d.ts +6 -0
  63. package/dist/types.d.ts.map +1 -1
  64. package/docs/artifact-upload.md +124 -0
  65. package/docs/optional-rules.md +1 -0
  66. package/docs/osf-artifact.md +4 -1
  67. package/docs/rules/artifact/upload-current.md +85 -0
  68. package/docs/rules.md +1 -0
  69. package/eslint-rules/CLAUDE.md +5 -1
  70. package/eslint-rules/CLAUDE.md.spec.ts +3 -0
  71. package/package.json +1 -1
  72. package/src/adapters/latex/abstract.ts +3 -1
  73. package/src/adapters/latex/index.ts +3 -0
  74. package/src/adapters/latex/macros.test.ts +31 -0
  75. package/src/adapters/latex/macros.ts +43 -0
  76. package/src/adapters/osf/cassette/README.md +20 -0
  77. package/src/adapters/osf/cassette/get-file.json +108 -0
  78. package/src/adapters/osf/cassette/get-listing.json +111 -0
  79. package/src/adapters/osf/cassette/get-missing.json +1 -0
  80. package/src/adapters/osf/cassette/put-new.json +31 -0
  81. package/src/adapters/osf/host.io.ts +156 -0
  82. package/src/adapters/osf/host.test.ts +274 -0
  83. package/src/adapters/osf/index.ts +14 -0
  84. package/src/adapters/osf/response.ts +105 -0
  85. package/src/artifact-upload-rule.test.ts +213 -0
  86. package/src/artifact-upload-rule.ts +213 -0
  87. package/src/artifact.test.ts +504 -0
  88. package/src/artifact.ts +402 -0
  89. package/src/cli.test.ts +271 -1
  90. package/src/cli.ts +168 -23
  91. package/src/domain/artifact-upload.test.ts +80 -0
  92. package/src/domain/artifact-upload.ts +111 -0
  93. package/src/domain/paper-dirs.test.ts +91 -0
  94. package/src/domain/paper-dirs.ts +62 -0
  95. package/src/new-paper.test.ts +8 -2
  96. package/src/paper-files.test.ts +88 -0
  97. package/src/paper-files.ts +98 -9
  98. package/src/paper-settings-commands.test.ts +18 -0
  99. package/src/ports/artifact-host.ts +65 -0
  100. package/src/ports/latex.ts +10 -0
  101. package/src/rule-cases.test.ts +44 -0
  102. package/src/submission-confirm-hook.test.ts +113 -1
  103. package/src/submission-confirm-hook.ts +120 -27
  104. package/src/types.ts +6 -0
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ import { type Result } from "./result.ts";
3
+ /** The record's version: a reader refuses one it does not know rather than misread it. */
4
+ export declare const RECORD_VERSION = 1;
5
+ /** Where the record is, relative to the paper, unless the rule's `record` option names another. */
6
+ export declare const DEFAULT_RECORD = "submission/artifact-upload.json";
7
+ declare const Record: z.ZodObject<{
8
+ version: z.ZodLiteral<1>;
9
+ host: z.ZodString;
10
+ url: z.ZodURL;
11
+ file: z.ZodString;
12
+ id: z.ZodOptional<z.ZodString>;
13
+ sha256: z.ZodOptional<z.ZodString>;
14
+ md5: z.ZodOptional<z.ZodString>;
15
+ uploadedAt: z.ZodISODateTime;
16
+ numbers: z.ZodRecord<z.ZodString, z.ZodString>;
17
+ }, z.core.$strict>;
18
+ export type UploadRecord = Readonly<z.infer<typeof Record>>;
19
+ /** `json` as a record, or why it is not one, in words: which field and what is wrong with it. */
20
+ export declare function recordOf(json: unknown): Result<UploadRecord, string>;
21
+ /** The record in `text`, or why it is not one, in words. */
22
+ export declare function parseUploadRecord(text: string): Result<UploadRecord, string>;
23
+ /** The record as its file holds it: two-space JSON, keys in the order given, a final newline. */
24
+ export declare const uploadRecordText: (r: UploadRecord) => string;
25
+ /** The md5 of `bytes`, as hosts print it: 32 lowercase hex digits. */
26
+ export declare const md5Hex: (bytes: Uint8Array) => string;
27
+ /**
28
+ * `used`, plus every macro of `values` that a used macro's definition names, at any depth
29
+ * (`repoCount` defined as `\nRepos` prints `nRepos` too). `usesIn` reads the names a definition
30
+ * uses. The set only grows and is bounded by `values`, so a cycle of definitions ends.
31
+ */
32
+ export declare const printedThrough: (values: ReadonlyMap<string, string>, used: ReadonlySet<string>, usesIn: (definition: string) => readonly string[]) => ReadonlySet<string>;
33
+ /** What the paper prints now that the upload was not built for: keys it lacked, keys with another value. */
34
+ export interface Drift {
35
+ readonly added: readonly string[];
36
+ readonly changed: readonly string[];
37
+ }
38
+ /**
39
+ * The drift between the numbers recorded at upload and the paper's `current` ones, counting only the
40
+ * keys the paper uses: a macro defined and never printed never fires. Keys in source order.
41
+ */
42
+ export declare const drift: (recorded: Readonly<Record<string, string>>, current: ReadonlyMap<string, string>, used: ReadonlySet<string>) => Drift;
43
+ export {};
44
+ //# sourceMappingURL=artifact-upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-upload.d.ts","sourceRoot":"","sources":["../../src/domain/artifact-upload.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAEnD,0FAA0F;AAC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PLOAD RECORD — what an artifact host holds, written down once at upload time, so a lint rule
3
+ * can say later whether the paper still prints what that upload was built for. Pure.
4
+ *
5
+ * The record is a JSON file (default `<paper>/submission/artifact-upload.json`, docs/artifact-upload.md)
6
+ * that anyone may write: `paperlint artifact record`, `paperlint artifact upload --save`, the author's
7
+ * own script, or a hand. It is parsed here, once, into `UploadRecord`; nothing after reads the raw
8
+ * JSON. `numbers` is the paper's printed key → value map at upload time: every argument-less macro
9
+ * of the paper's numbers file, as written in its definition.
10
+ */
11
+ import { createHash } from "node:crypto";
12
+ import { z } from "zod";
13
+ import { err, ok } from "./result.js";
14
+ /** The record's version: a reader refuses one it does not know rather than misread it. */
15
+ export const RECORD_VERSION = 1;
16
+ /** Where the record is, relative to the paper, unless the rule's `record` option names another. */
17
+ export const DEFAULT_RECORD = "submission/artifact-upload.json";
18
+ const Hex = (n) => z.string().regex(new RegExp(`^[0-9a-f]{${String(n)}}$`));
19
+ const Record = z.strictObject({
20
+ version: z.literal(RECORD_VERSION),
21
+ /** The host's name: `osf`, `zenodo`, `other`, … — a host paperlint has no adapter for is fine. */
22
+ host: z.string().min(1),
23
+ url: z.url(),
24
+ /** The uploaded file's name. */
25
+ file: z.string().min(1),
26
+ /** The host's own id of the file, when it has one (OSF: the file's id); lets `show` find it. */
27
+ id: z.string().min(1).optional(),
28
+ sha256: Hex(64).optional(),
29
+ md5: Hex(32).optional(),
30
+ uploadedAt: z.iso.datetime({ offset: true }),
31
+ numbers: z.record(z.string(), z.string()),
32
+ });
33
+ /** `json` as a record, or why it is not one, in words: which field and what is wrong with it. */
34
+ export function recordOf(json) {
35
+ const r = Record.safeParse(json);
36
+ return r.success
37
+ ? ok(r.data)
38
+ : err(r.error.issues
39
+ .map((i) => `${i.path.join(".") || "the record"}: ${i.message}`)
40
+ .join("; "));
41
+ }
42
+ /** The record in `text`, or why it is not one, in words. */
43
+ export function parseUploadRecord(text) {
44
+ try {
45
+ return recordOf(JSON.parse(text));
46
+ }
47
+ catch {
48
+ return err("it is not JSON");
49
+ }
50
+ }
51
+ /** The record as its file holds it: two-space JSON, keys in the order given, a final newline. */
52
+ export const uploadRecordText = (r) => `${JSON.stringify(r, null, 2)}\n`;
53
+ /** The md5 of `bytes`, as hosts print it: 32 lowercase hex digits. */
54
+ export const md5Hex = (bytes) => createHash("md5").update(bytes).digest("hex");
55
+ /**
56
+ * `used`, plus every macro of `values` that a used macro's definition names, at any depth
57
+ * (`repoCount` defined as `\nRepos` prints `nRepos` too). `usesIn` reads the names a definition
58
+ * uses. The set only grows and is bounded by `values`, so a cycle of definitions ends.
59
+ */
60
+ export const printedThrough = (values, used, usesIn) => {
61
+ const next = new Set([
62
+ ...used,
63
+ ...[...used].flatMap((k) => usesIn(values.get(k) ?? "").filter((u) => values.has(u))),
64
+ ]);
65
+ return next.size === used.size ? used : printedThrough(values, next, usesIn);
66
+ };
67
+ /**
68
+ * The drift between the numbers recorded at upload and the paper's `current` ones, counting only the
69
+ * keys the paper uses: a macro defined and never printed never fires. Keys in source order.
70
+ */
71
+ export const drift = (recorded, current, used) => {
72
+ const printed = [...current].filter(([k]) => used.has(k));
73
+ return {
74
+ added: printed.filter(([k]) => !Object.hasOwn(recorded, k)).map(([k]) => k),
75
+ changed: printed
76
+ .filter(([k, v]) => Object.hasOwn(recorded, k) && recorded[k] !== v)
77
+ .map(([k]) => k),
78
+ };
79
+ };
80
+ //# sourceMappingURL=artifact-upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-upload.js","sourceRoot":"","sources":["../../src/domain/artifact-upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,aAAa,CAAC;AAEnD,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC,mGAAmG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AAI,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/E,CAAC,CAAC;AAQF;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,QAA0C,EAC1C,OAAoC,EACpC,IAAyB,EAClB,EAAE;IACT,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC3E,OAAO,EAAE,OAAO;aACb,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;aACnE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;KACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { IsFile } from "./paper-folder.ts";
2
+ /** The two questions the rule asks of the disk. */
3
+ export interface PaperTree extends IsFile {
4
+ /** The folders a walk enters below `dir`: not hidden, not installed packages, not `extra/`. */
5
+ subfolders(dir: string): readonly string[];
6
+ }
7
+ /** The files that make a folder a paper. */
8
+ export declare const PAPER_MARKERS: readonly string[];
9
+ export declare const isPaper: (dir: string, tree: IsFile) => boolean;
10
+ /** The nearest paper at or above `dir`; null when there is none. */
11
+ export declare const paperOwning: (dir: string, tree: IsFile) => string | null;
12
+ /** The papers below `dir`, at any depth, not looking inside any paper it finds. */
13
+ export declare const papersBelow: (dir: string, tree: PaperTree) => readonly string[];
14
+ /** The papers the absolute folders `dirs` reach, each once, in the order they were reached. */
15
+ export declare const papersReached: (dirs: readonly string[], tree: PaperTree) => readonly string[];
16
+ //# sourceMappingURL=paper-dirs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paper-dirs.d.ts","sourceRoot":"","sources":["../../src/domain/paper-dirs.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,mDAAmD;AACnD,MAAM,WAAW,SAAU,SAAQ,MAAM;IACvC,+FAA+F;IAC/F,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED,4CAA4C;AAC5C,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAA6B,CAAC;AAKzE,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,KAAG,OAEgB,CAAC;AAErE,oEAAoE;AACpE,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,MAAM,MAAM,KAAG,MAAM,GAAG,IAIhE,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,MAAM,SAAS,KAAG,SAAS,MAAM,EAGN,CAAC;AAErE,+FAA+F;AAC/F,eAAO,MAAM,aAAa,GACxB,MAAM,SAAS,MAAM,EAAE,EACvB,MAAM,SAAS,KACd,SAAS,MAAM,EAMf,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Which papers a path given to `paperlint lint` reaches (#582). One owner for the question, so the
3
+ * claimed scope, the papers' own settings and the record checks cannot disagree about it.
4
+ *
5
+ * The rule, every case of which is a row in `paper-dirs.test.ts`:
6
+ * - a paper is a folder with `paper.tex` or `PIPELINE-STATUS.md` at its top. `paperlint.json` alone
7
+ * is the project's settings, not a paper;
8
+ * - a path inside a paper (the paper itself, a review card, its `reviews/`) reaches the nearest
9
+ * paper at or above it, looking only up, so a snapshot kept beside the card never stands in for
10
+ * the paper the card belongs to;
11
+ * - any other folder (the project root, a papers directory, an archive) reaches the papers below
12
+ * it, at any depth; the walk stops at each paper, so a copy kept inside one is never a paper;
13
+ * - nothing under a folder named `extra/` is a paper, the same reach as lint's own ignore.
14
+ */
15
+ import { unique } from "remeda";
16
+ import { dirname, join, sep } from "node:path";
17
+ import { STATUS_FILE } from "./paper-folder.js";
18
+ import { ESCAPE_HATCH } from "./paper-layout.js";
19
+ import { MAIN_FILE } from "./paper-sources.js";
20
+ import { absolutePath } from "./paths.js";
21
+ /** The files that make a folder a paper. */
22
+ export const PAPER_MARKERS = [MAIN_FILE, STATUS_FILE];
23
+ const underExtra = (dir) => dir.split(sep).includes(ESCAPE_HATCH);
24
+ export const isPaper = (dir, tree) => !underExtra(dir) &&
25
+ PAPER_MARKERS.some((m) => tree.isFile(absolutePath(join(dir, m))));
26
+ /** The nearest paper at or above `dir`; null when there is none. */
27
+ export const paperOwning = (dir, tree) => {
28
+ if (isPaper(dir, tree))
29
+ return dir;
30
+ const parent = dirname(dir);
31
+ return parent === dir ? null : paperOwning(parent, tree);
32
+ };
33
+ /** The papers below `dir`, at any depth, not looking inside any paper it finds. */
34
+ export const papersBelow = (dir, tree) => tree
35
+ .subfolders(dir)
36
+ .flatMap((d) => (isPaper(d, tree) ? [d] : papersBelow(d, tree)));
37
+ /** The papers the absolute folders `dirs` reach, each once, in the order they were reached. */
38
+ export const papersReached = (dirs, tree) => unique(dirs.flatMap((d) => {
39
+ const owner = paperOwning(d, tree);
40
+ return owner === null ? papersBelow(d, tree) : [owner];
41
+ }));
42
+ //# sourceMappingURL=paper-dirs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paper-dirs.js","sourceRoot":"","sources":["../../src/domain/paper-d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CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,IAAe,EAAqB,EAAE,CAC7E,IAAI;KACD,UAAU,CAAC,GAAG,CAAC;KACf,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAErE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,IAAuB,EACvB,IAAe,EACI,EAAE,CACrB,MAAM,CACJ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACnC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC,CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAMA,wBAqCG"}
1
+ {"version":3,"file":"CLAUDE.md.spec.d.ts","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":";AAMA,wBAwCG"}
@@ -35,6 +35,7 @@ the checks push every paper toward a blog post.
35
35
  },
36
36
  rules: {
37
37
  "lint-rule-over-script": guidance("A check over a syntax tree is a lint rule, not a script. It fires in the editor on save, gets the AST for free, and has a suppression syntax people already know. A script is for corpus-wide questions — index connectivity, ratios across many files. When the work has to run a program, a script may do the work and write facts to a JSON file, and a rule judges that file: the verdict still lands in the engine."),
38
+ "a-rule-is-configured-the-eslint-way": guidance('Provisional, pending #599 (the author is not sure it is right). A rule\'s own switches (what to require, a threshold, a file to compare) come from its options where it is turned on: `["warn", { … }]`. A new rule is not on by default and silent until some key of `paperlint.json` is declared: that hides a check behind a setting nobody sees in the rule list. A fact several rules share about a paper (its venue, cycles, artifact, talk) reaches them through ESLint\'s `settings`, filled once by `buildConfig` from `paperlint.json`; a rule does not open `paperlint.json` itself. A rule whose subject IS `paperlint.json` (it validates the config) is exempt. Where an outside service varies (an artifact host, a portal), the rule reads a file of facts a command wrote and never the service; the services are adapters behind a port, as `src/ports/submission-portal.ts` and `src/adapters/hotcrp/` are, and eslint-plugin-import\'s `settings["import/resolver"]` is the ESLint precedent. About 25 existing rules predate this; #599 decides whether to move them, narrow this rule, or drop it and allow a rule to read `paperlint.json`. The author proposed this on 2026-11-21.'),
38
39
  },
39
40
  });
40
41
  //# sourceMappingURL=CLAUDE.md.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,EAAE;AACF,gGAAgG;AAChG,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtE,eAAe,eAAe,CAAC;IAC7B,QAAQ,EAAE;QACR,iBAAiB,EAAE,KAAK,CAAA;;oBAER;QAEhB,+CAA+C,EAAE,KAAK,CAAA;;sEAEY,IAAI,CAAC,wBAAwB,CAAC;;0KAEsE,IAAI,CAAC,yCAAyC,CAAC;gHACzG,IAAI,CAAC,0CAA0C,CAAC,6NAA6N,IAAI,CAAC,8BAA8B,CAAC;2FACtU,IAAI,CAAC,uBAAuB,CAAC;wGAChB,IAAI,CAAC,6BAA6B,CAAC;;;kDAGzF,IAAI,CAAC,eAAe,CAAC,6BAA6B;QAEhG,0BAA0B,EAAE,KAAK,CAAA;;;;;;;;;;;;iEAY4B;KAC9D;IACD,KAAK,EAAE;QACL,uBAAuB,EAAE,QAAQ,CAC/B,0ZAA0Z,CAC3Z;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"CLAUDE.md.spec.js","sourceRoot":"","sources":["../../eslint-rules/CLAUDE.md.spec.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,EAAE;AACF,gGAAgG;AAChG,uFAAuF;AACvF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEtE,eAAe,eAAe,CAAC;IAC7B,QAAQ,EAAE;QACR,iBAAiB,EAAE,KAAK,CAAA;;oBAER;QAEhB,+CAA+C,EAAE,KAAK,CAAA;;sEAEY,IAAI,CAAC,wBAAwB,CAAC;;0KAEsE,IAAI,CAAC,yCAAyC,CAAC;gHACzG,IAAI,CAAC,0CAA0C,CAAC,6NAA6N,IAAI,CAAC,8BAA8B,CAAC;2FACtU,IAAI,CAAC,uBAAuB,CAAC;wGAChB,IAAI,CAAC,6BAA6B,CAAC;;;kDAGzF,IAAI,CAAC,eAAe,CAAC,6BAA6B;QAEhG,0BAA0B,EAAE,KAAK,CAAA;;;;;;;;;;;;iEAY4B;KAC9D;IACD,KAAK,EAAE;QACL,uBAAuB,EAAE,QAAQ,CAC/B,0ZAA0Z,CAC3Z;QACD,qCAAqC,EAAE,QAAQ,CAC7C,4oCAA4oC,CAC7oC;KACF;CACF,CAAC,CAAC"}
@@ -1,46 +1,29 @@
1
+ import type { ConfigBlock, RuleBlock, RuleEntry } from "./rules-config.ts";
1
2
  /**
2
- * THE FILES PAPERLINT OWNS — read off its own config, and made the only thing ESLint may reach.
3
- *
4
- * paperlint's blocks name the files they lint (`PIPELINE-STATUS.md`, `paper.tex`, `reviews/*.md`,
5
- * …). That list is the whole scope of `paperlint lint`, and this module turns it
6
- * into two things ESLint understands:
7
- *
8
- * 1. **A global ignore of everything else** (`scopeToOwned`). Handing ESLint a directory is not
9
- * enough: its built-in defaults lint every JavaScript file it finds, whatever our config says.
10
- * Measured on a consumer project with vendored code under a paper's `repro/` folder: 1,877
11
- * files, 74 errors ("'return' outside of function", "Definition for rule … was not found"),
12
- * zero of them on a paper file, exit 1 — and nothing in the settings could turn it off. With
13
- * the ignore, a stray script under the papers directory is never enumerated at all, and a file
14
- * named on the command line can be asked about (`ESLint#isPathIgnored`) with ESLint's own
15
- * matcher instead of a hand-written one.
16
- *
17
- * 2. **Each rule scoped to the files it was written for** (`ruleOwners` + `narrowToOwners`).
18
- * One plugin NAME is bound to different plugin objects in different blocks: `paper` holds
19
- * `stages`/`source`/`author-list` beside `PIPELINE-STATUS.md` and `typography` beside
20
- * `paper.tex`. So a consumer block that named `paper/source`
21
- * for every file under the papers directory reached `paper.tex`, where `paper` has no `source`
22
- * — and ESLint threw `Could not find "source" in plugin "paper"` from inside `lintFiles`,
23
- * after paperlint's own validation had (correctly) accepted the id. A block is therefore split
24
- * per owner and its `files` ANDed with the owner's (ESLint's nested-array form), so a rule can
25
- * only land where its plugin is registered.
26
- *
27
- * Both read ONE definition of "the files paperlint lints": `ownedScopes`, each own block's `files`
28
- * together with its `ignores`. The globs alone are not that definition. The sibling-card block
29
- * claims every markdown file under `siblings/` EXCEPT the index, and a rule whose plugin is
30
- * registered for every file (`pdf`) used to keep the consumer block's `files` as they were — so a
31
- * venue preset's rules reached `siblings/README.md`, a block with no `language` matched it, and
32
- * ESLint parsed the markdown as JavaScript (#101). Now every generated block narrows to scopes,
33
- * exceptions included, and a plugin registered everywhere owns exactly what paperlint lints.
34
- *
35
- * ESLint's semantics that this leans on, each measured against ESLint 10 before writing it:
36
- * - a global-ignore pattern that matches a DIRECTORY hides everything inside it, so directories
37
- * must be un-ignored (`!` + a pattern ending in a slash) before owned files can be;
38
- * - that un-ignores `node_modules/` and `.git/` too — ESLint's own defaults — so they are
39
- * re-ignored after, or a `paper.tex` inside a dependency would be linted;
40
- * - later global-ignore patterns win, across blocks, in config order;
41
- * - `files: [["a", "b"]]` matches a file only when BOTH patterns match.
3
+ * Which papers' own files paperlint's blocks claim. `any` is the config's SHAPE, for the rule list and
4
+ * the docs: a file in any folder. `papers` is what `paperlint lint` runs on: the real papers, as glob
5
+ * prefixes relative to ESLint's `cwd` ("" for `cwd` itself), so a copy of a paper kept inside one (a
6
+ * review snapshot, a build copy) is claimed by no block (#582).
42
7
  */
43
- import type { ConfigBlock, RuleBlock, RuleEntry } from "./rules-config.ts";
8
+ export type PaperScope = {
9
+ readonly kind: "any";
10
+ } | {
11
+ readonly kind: "papers";
12
+ readonly cwd: string;
13
+ readonly prefixes: readonly string[];
14
+ };
15
+ export declare const ANY_PAPER: PaperScope;
16
+ /** The papers `dirs` under ESLint's `cwd`: the scope `paperlint lint` lints. Pure. */
17
+ export declare const papersScope: (dirs: readonly string[], cwd: string) => PaperScope;
18
+ /** A glob of a paper's own file (`paper.tex`, `reviews/*.md`) in each paper of `scope`. Pure. */
19
+ export declare const paperFiles: (scope: PaperScope, glob: string) => readonly string[];
20
+ /**
21
+ * A glob relative to `cwd`, as the block whose `basePath` is `base` must write it — ESLint reads a
22
+ * block's patterns from its `basePath`, and a paper's own settings carry the paper's folder. None
23
+ * when the glob names files outside `base`: that block can never reach them. A glob that starts with
24
+ * `**` matches at any depth and is kept as it is. Pure.
25
+ */
26
+ export declare const rebaseGlob: (glob: string, cwd: string, base: string) => readonly string[];
44
27
  /**
45
28
  * A set of files paperlint lints: an own block's globs and the exceptions that block makes. A file is
46
29
  * in it when it matches one of `files` and none of `ignores`.
@@ -81,5 +64,5 @@ export declare function ruleOwners(own: readonly ConfigBlock[]): Map<string, rea
81
64
  * of this config registers (the LaTeX block is absent when its parser did not load) gets no block:
82
65
  * it has no file to reach in this run, and naming it to ESLint would only crash.
83
66
  */
84
- export declare function narrowToOwners(block: RuleBlock, owners: ReadonlyMap<string, readonly OwnedScope[]>): ScopedBlock[];
67
+ export declare function narrowToOwners(block: RuleBlock, owners: ReadonlyMap<string, readonly OwnedScope[]>, papers?: PaperScope): ScopedBlock[];
85
68
  //# sourceMappingURL=paper-files.d.ts.map
@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AC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACrD;AA0BD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,WAAW,EAAE,GAAG,UAAU,EAAE,CAQrE;AAED,qEAAqE;AACrE,wBAAgB,aAAa,CAAC,GAAG,EAAE,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"}
@@ -1,3 +1,76 @@
1
+ /**
2
+ * THE FILES PAPERLINT OWNS — read off its own config, and made the only thing ESLint may reach.
3
+ *
4
+ * paperlint's blocks name the files they lint (`PIPELINE-STATUS.md`, `paper.tex`, `reviews/*.md`,
5
+ * …). That list is the whole scope of `paperlint lint`, and this module turns it
6
+ * into two things ESLint understands:
7
+ *
8
+ * 1. **A global ignore of everything else** (`scopeToOwned`). Handing ESLint a directory is not
9
+ * enough: its built-in defaults lint every JavaScript file it finds, whatever our config says.
10
+ * Measured on a consumer project with vendored code under a paper's `repro/` folder: 1,877
11
+ * files, 74 errors ("'return' outside of function", "Definition for rule … was not found"),
12
+ * zero of them on a paper file, exit 1 — and nothing in the settings could turn it off. With
13
+ * the ignore, a stray script under the papers directory is never enumerated at all, and a file
14
+ * named on the command line can be asked about (`ESLint#isPathIgnored`) with ESLint's own
15
+ * matcher instead of a hand-written one.
16
+ *
17
+ * 2. **Each rule scoped to the files it was written for** (`ruleOwners` + `narrowToOwners`).
18
+ * One plugin NAME is bound to different plugin objects in different blocks: `paper` holds
19
+ * `stages`/`source`/`author-list` beside `PIPELINE-STATUS.md` and `typography` beside
20
+ * `paper.tex`. So a consumer block that named `paper/source`
21
+ * for every file under the papers directory reached `paper.tex`, where `paper` has no `source`
22
+ * — and ESLint threw `Could not find "source" in plugin "paper"` from inside `lintFiles`,
23
+ * after paperlint's own validation had (correctly) accepted the id. A block is therefore split
24
+ * per owner and its `files` ANDed with the owner's (ESLint's nested-array form), so a rule can
25
+ * only land where its plugin is registered.
26
+ *
27
+ * Both read ONE definition of "the files paperlint lints": `ownedScopes`, each own block's `files`
28
+ * together with its `ignores`. The globs alone are not that definition. The sibling-card block
29
+ * claims every markdown file under `siblings/` EXCEPT the index, and a rule whose plugin is
30
+ * registered for every file (`pdf`) used to keep the consumer block's `files` as they were — so a
31
+ * venue preset's rules reached `siblings/README.md`, a block with no `language` matched it, and
32
+ * ESLint parsed the markdown as JavaScript (#101). Now every generated block narrows to scopes,
33
+ * exceptions included, and a plugin registered everywhere owns exactly what paperlint lints.
34
+ *
35
+ * ESLint's semantics that this leans on, each measured against ESLint 10 before writing it:
36
+ * - a global-ignore pattern that matches a DIRECTORY hides everything inside it, so directories
37
+ * must be un-ignored (`!` + a pattern ending in a slash) before owned files can be;
38
+ * - that un-ignores `node_modules/` and `.git/` too — ESLint's own defaults — so they are
39
+ * re-ignored after, or a `paper.tex` inside a dependency would be linted;
40
+ * - later global-ignore patterns win, across blocks, in config order;
41
+ * - `files: [["a", "b"]]` matches a file only when BOTH patterns match.
42
+ */
43
+ import { relative, sep } from "node:path";
44
+ export const ANY_PAPER = { kind: "any" };
45
+ /** The characters a glob reads as syntax, escaped so a folder's name matches only itself. Pure. */
46
+ const literalGlob = (path) => path.replace(/[\\*?[\]{}()!+@]/gu, "\\$&");
47
+ /** `to` relative to `from`, `/`-separated. Pure. */
48
+ 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) => ({
51
+ kind: "papers",
52
+ cwd,
53
+ prefixes: dirs.map((d) => literalGlob(posixRelative(cwd, d))),
54
+ });
55
+ /** A glob of a paper's own file (`paper.tex`, `reviews/*.md`) in each paper of `scope`. Pure. */
56
+ export const paperFiles = (scope, glob) => scope.kind === "any"
57
+ ? [`**/${glob}`]
58
+ : scope.prefixes.map((p) => (p === "" ? glob : `${p}/${glob}`));
59
+ /**
60
+ * A glob relative to `cwd`, as the block whose `basePath` is `base` must write it — ESLint reads a
61
+ * block's patterns from its `basePath`, and a paper's own settings carry the paper's folder. None
62
+ * when the glob names files outside `base`: that block can never reach them. A glob that starts with
63
+ * `**` matches at any depth and is kept as it is. Pure.
64
+ */
65
+ export const rebaseGlob = (glob, cwd, base) => {
66
+ if (glob.startsWith("**"))
67
+ return [glob];
68
+ const up = posixRelative(base, cwd);
69
+ if (!up.startsWith(".."))
70
+ return [up === "" ? glob : `${literalGlob(up)}/${glob}`];
71
+ const down = `${literalGlob(posixRelative(cwd, base))}/`;
72
+ return glob.startsWith(down) ? [glob.slice(down.length)] : [];
73
+ };
1
74
  /** A block's `files`, the string globs only. */
2
75
  const globsOf = (files) => files.filter((f) => typeof f === "string");
3
76
  const stringsOf = (xs) => (xs ?? []).filter((x) => typeof x === "string");
@@ -68,7 +141,7 @@ export function ruleOwners(own) {
68
141
  * of this config registers (the LaTeX block is absent when its parser did not load) gets no block:
69
142
  * it has no file to reach in this run, and naming it to ESLint would only crash.
70
143
  */
71
- export function narrowToOwners(block, owners) {
144
+ export function narrowToOwners(block, owners, papers = ANY_PAPER) {
72
145
  // Keyed by the owner's JSON, so rules with equal owners share one group of blocks.
73
146
  const groups = new Map();
74
147
  const ownerOf = new Map();
@@ -80,19 +153,38 @@ export function narrowToOwners(block, owners) {
80
153
  groups.set(key, { ...groups.get(key), [id]: entry });
81
154
  ownerOf.set(key, owner);
82
155
  }
83
- return [...ownerOf].flatMap(([key, owner]) => owner.map((scope) => within(block, scope, { ...groups.get(key) })));
156
+ return [...ownerOf].flatMap(([key, owner]) => owner.flatMap((scope) => within(block, rebased(scope, papers, block.basePath), {
157
+ ...groups.get(key),
158
+ })));
159
+ }
160
+ /**
161
+ * `scope` as the block with `basePath` `base` must write it. The scope's globs are relative to ESLint's
162
+ * `cwd`; a paper's own settings are read from the paper's folder (#582).
163
+ */
164
+ function rebased(scope, papers, base) {
165
+ if (papers.kind === "any")
166
+ return scope;
167
+ const onto = (globs) => globs.flatMap((g) => rebaseGlob(g, papers.cwd, base));
168
+ return { files: onto(scope.files), ignores: onto(scope.ignores) };
84
169
  }
85
- /** `block`'s rules over the files both it and `scope` claim, minus both sets of exceptions. */
170
+ /**
171
+ * `block`'s rules over the files both it and `scope` claim, minus both sets of exceptions; none when
172
+ * the scope claims no file the block can reach (ESLint refuses an empty `files`).
173
+ */
86
174
  function within(block, scope, rules) {
175
+ if (scope.files.length === 0)
176
+ return [];
87
177
  const files = block.files
88
178
  ? block.files.flatMap((f) => scope.files.map((o) => [f, o]))
89
179
  : scope.files;
90
180
  const ignores = [...(block.ignores ?? []), ...scope.ignores];
91
- return {
92
- basePath: block.basePath,
93
- files,
94
- ...(ignores.length ? { ignores } : {}),
95
- rules,
96
- };
181
+ return [
182
+ {
183
+ basePath: block.basePath,
184
+ files,
185
+ ...(ignores.length ? { ignores } : {}),
186
+ rules,
187
+ },
188
+ ];
97
189
  }
98
190
  //# sourceMappingURL=paper-files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pa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OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IACxD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,SAAS,MAAM,CACb,KAAgB,EAChB,KAAiB,EACjB,KAA0C;IAE1C,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxC,MAAM,KAAK,GAA0B,KAAK,CAAC,KAAK;QAC9C,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,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,KAAK;SACN;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * A host that keeps a paper's reproduction artifact — the port `paperlint artifact upload|show` talk
3
+ * through. Shaped by what the two commands need (put one file there, read one file's hashes back),
4
+ * not by any host's API; one adapter per host (`src/adapters/osf/`), listed in one place, the root's
5
+ * `ARTIFACT_HOSTS`. The rule `artifact/upload-current` never uses it: it reads the upload record.
6
+ */
7
+ import type { Result } from "../domain/result.ts";
8
+ /** A hash a host can give back for a file it holds. */
9
+ export type HashKind = "sha256" | "md5";
10
+ /** A file as the host holds it: its id there, its page, and the hashes the host gave. */
11
+ export interface HostedFile {
12
+ readonly id: string;
13
+ readonly url: string;
14
+ readonly sha256: string | null;
15
+ readonly md5: string | null;
16
+ }
17
+ /** Why the host gave no answer to use. The token never appears in `detail`. */
18
+ export interface HostFailure {
19
+ readonly kind: "unreachable" | "refused" | "not-found" | "malformed";
20
+ readonly detail: string;
21
+ }
22
+ /** Where a file was put, or is to be found: the record's url, the file's name, the host's id of it. */
23
+ export interface Where {
24
+ readonly url: string;
25
+ readonly file: string;
26
+ readonly id: string | null;
27
+ }
28
+ /** An upload: the file, and the host's container for it (an OSF project's guid). */
29
+ export interface Upload {
30
+ readonly target: string;
31
+ readonly name: string;
32
+ readonly bytes: Uint8Array;
33
+ }
34
+ export interface ArtifactHost {
35
+ /** What this host's adapter can do: upload, and which hashes it reads back (none: cannot check). */
36
+ readonly can: {
37
+ readonly upload: boolean;
38
+ readonly hashes: readonly HashKind[];
39
+ };
40
+ /** The environment variable the token is read from; the site-less one refused by name. */
41
+ readonly token: {
42
+ readonly variable: string;
43
+ readonly siteLess: string;
44
+ /** Where the author makes one, and with which permission, in the words the command prints. */
45
+ readonly help: string;
46
+ };
47
+ /** The container `upload` puts a file in, read off a record's url (an OSF project's guid); null when none. */
48
+ readonly targetOf: (url: string) => string | null;
49
+ /** The file's hashes as the host holds them now; a token only where the file is not public. */
50
+ readonly read: (where: Where, token: string | null) => Promise<Result<HostedFile, HostFailure>>;
51
+ /** Put the file there: a new version of a file of the same name, else a new file. */
52
+ readonly upload: (u: Upload, token: string) => Promise<Result<HostedFile, HostFailure>>;
53
+ }
54
+ //# sourceMappingURL=artifact-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-host.d.ts","sourceRoot":"","sources":["../../src/ports/artifact-host.ts"],"names":[],"mappings":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C;QAC1B,8FAA8F;QAC9F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,8GAA8G;IAC9G,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAClD,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,EAAE,CACb,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,MAAM,GAAG,IAAI,KACjB,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAC9C,qFAAqF;IACrF,QAAQ,CAAC,MAAM,EAAE,CACf,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,KACV,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;CAC/C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=artifact-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-host.js","sourceRoot":"","sources":["../../src/ports/artifact-host.ts"],"names":[],"mappings":""}
@@ -30,6 +30,11 @@ export type AbstractProblem = {
30
30
  /** Each definition's offset in the source, in order. */
31
31
  readonly at: readonly number[];
32
32
  };
33
+ /** An argument-less macro the source defines, and its body as written. */
34
+ export interface MacroValue {
35
+ readonly name: string;
36
+ readonly value: string;
37
+ }
33
38
  export interface LatexReader {
34
39
  /** The source's `\documentclass`, as one of its states. */
35
40
  readonly documentClass: (src: string) => ClassLine;
@@ -119,5 +124,9 @@ export interface LatexReader {
119
124
  * unwrapped.
120
125
  */
121
126
  readonly macroTexts: (src: string, names: readonly string[]) => readonly string[];
127
+ /** Each argument-less macro `src` defines, with its body as written, in source order. */
128
+ readonly macroValues: (src: string) => readonly MacroValue[];
129
+ /** The names of the macros `src` uses anywhere but in their own definition. */
130
+ readonly macrosUsed: (src: string) => readonly string[];
122
131
  }
123
132
  //# sourceMappingURL=latex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file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AC,GAAG,EAAE,MAAM,KAAK,SAAS,cAAc,EAAE,CAAC;IACrE;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,CACrB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,KACZ,SAAS,YAAY,EAAE,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACxE;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;IACpD,2FAA2F;IAC3F,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;IACtD,6FAA6F;IAC7F,QAAQ,CAAC,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;IAC/D;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,CACnB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,SAAS,MAAM,EAAE,KACrB,SAAS,MAAM,EAAE,CAAC;IACvB,yFAAyF;IACzF,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,UAAU,EAAE,CAAC;IAC7D,+EAA+E;IAC/E,QAAQ,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;CACzD"}
@@ -21,6 +21,8 @@ export type ConfirmDeps = PresetDeps & {
21
21
  * `--pdf` the send names (null for the defaults), or null when they do not parse cleanly.
22
22
  */
23
23
  readonly readSend: (words: readonly string[]) => Send | null;
24
+ /** The words after `artifact`, read the same way: the paper and the file an upload names, or null. */
25
+ readonly readUpload: (words: readonly string[]) => Upload | null;
24
26
  };
25
27
  /** What Claude Code reads from a PreToolUse hook's stdout to refuse the command; the agent sees the reason. */
26
28
  export interface DenyOutput {
@@ -30,11 +32,19 @@ export interface DenyOutput {
30
32
  readonly permissionDecisionReason: string;
31
33
  };
32
34
  }
33
- /** One `paperlint submission new|update` send: the paper folder and `--pdf` it names; null for the default. */
35
+ /** One send: the paper folder and the `--pdf` a `submission new|update` names (null for the default). */
34
36
  export interface Send {
35
37
  readonly paper: string | null;
36
38
  readonly pdf: string | null;
37
39
  }
40
+ /** One `artifact upload --save`: the paper (null for the current folder), the file, and where it goes. */
41
+ export interface Upload {
42
+ readonly paper: string | null;
43
+ readonly artifact: string;
44
+ /** The host's name (`--to`) and the project on it (`--node`). */
45
+ readonly host: string;
46
+ readonly project: string;
47
+ }
38
48
  /** One question the person answered: its text, and the option they chose. */
39
49
  interface Answer {
40
50
  readonly question: string;