@astryxdesign/cli 0.7.2-canary.6fddf4f → 0.7.2-canary.72db6f9

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 (133) hide show
  1. package/README.md +62 -62
  2. package/api/component/_adapter.d.mts +31 -0
  3. package/api/component/_adapter.mjs +116 -0
  4. package/api/component/component.mjs +60 -10
  5. package/api/component/doc-links.test.mjs +386 -0
  6. package/api/discover/_adapter.d.mts +119 -12
  7. package/api/discover/_adapter.mjs +449 -10
  8. package/api/discover/_adapter.test.mjs +599 -17
  9. package/api/discover/_catalog-view.d.mts +16 -5
  10. package/api/discover/_catalog-view.mjs +32 -8
  11. package/api/discover/detail/doc/doc.mjs +9 -1
  12. package/api/discover/discover.d.mts +11 -0
  13. package/api/discover/discover.doc.mjs +7 -6
  14. package/api/discover/discover.mjs +107 -19
  15. package/api/discover/discover.type.d.mts +18 -7
  16. package/api/discover/discover.type.mjs +15 -7
  17. package/api/discover/list/list.d.mts +4 -3
  18. package/api/discover/list/list.mjs +17 -10
  19. package/api/docs/_adapter.d.mts +63 -0
  20. package/api/docs/_adapter.mjs +309 -16
  21. package/api/docs/integration-tree.test.mjs +22 -0
  22. package/api/docs/list/list.mjs +12 -2
  23. package/api/doctor/theme-checks.test.mjs +136 -0
  24. package/api/gap-report/gap-report.d.mts +3 -0
  25. package/api/gap-report/gap-report.doc.mjs +11 -3
  26. package/api/gap-report/gap-report.mjs +152 -48
  27. package/api/gap-report/gap-report.test.mjs +233 -0
  28. package/api/gap-report/gap-report.type.d.mts +41 -0
  29. package/api/gap-report/gap-report.type.mjs +18 -0
  30. package/api/integration/_adapter.d.mts +33 -0
  31. package/api/integration/_adapter.mjs +58 -0
  32. package/api/integration/authoring-checks.mjs +98 -3
  33. package/api/integration/authoring-checks.test.mjs +769 -0
  34. package/api/integration/authoring-checks.type.d.mts +134 -0
  35. package/api/integration/authoring-checks.type.mjs +60 -1
  36. package/api/integration/integrationComponentConflicts.doc.mjs +3 -1
  37. package/api/integration/integrationDocConflicts.doc.mjs +22 -5
  38. package/api/integration/pack-check.mjs +296 -7
  39. package/api/integration/pack-check.test.mjs +367 -0
  40. package/api/integration/validate-integration-fixes.test.mjs +67 -0
  41. package/api/integration/validate-integration.mjs +28 -3
  42. package/api/integration/validate-integration.test.mjs +77 -8
  43. package/api/integration/validateIntegration.doc.mjs +1 -1
  44. package/api/search/search.mjs +2 -1
  45. package/api/upgrade/_adapter.d.mts +40 -2
  46. package/api/upgrade/_adapter.mjs +117 -4
  47. package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
  48. package/api/upgrade/run/run.mjs +30 -1
  49. package/api/upgrade/status/status.d.mts +21 -5
  50. package/api/upgrade/status/status.mjs +45 -8
  51. package/api/upgrade/upgrade.doc.mjs +5 -3
  52. package/api/upgrade/upgrade.type.d.mts +23 -0
  53. package/api/upgrade/upgrade.type.mjs +16 -1
  54. package/assets/codemods/runner.mjs +7 -1
  55. package/assets/discover/official-packages.json +367 -0
  56. package/assets/docs/author-a-theme.doc.mjs +2 -2
  57. package/assets/docs/browser-support.doc.mjs +1 -1
  58. package/assets/docs/styling-overview.doc.mjs +1 -1
  59. package/assets/docs/theme.doc.mjs +1 -1
  60. package/assets/docs/tree/add-a-topic.doc.mjs +3 -3
  61. package/assets/docs/tree/check-the-props.doc.mjs +7 -2
  62. package/assets/docs/tree/check-your-docs.doc.mjs +15 -3
  63. package/assets/docs/tree/checks.doc.mjs +5 -5
  64. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +25 -5
  65. package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
  66. package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
  67. package/assets/docs/tree/layout.doc.mjs +6 -6
  68. package/assets/docs/tree/migration-setup.doc.mjs +2 -2
  69. package/assets/docs/tree/publishing.doc.mjs +3 -3
  70. package/assets/docs/tree/quick-start.doc.mjs +2 -2
  71. package/assets/docs/tree/sections-and-placement.doc.mjs +2 -2
  72. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
  73. package/assets/docs/tree/troubleshooting.doc.mjs +5 -5
  74. package/assets/docs/tree/upgrading.doc.mjs +1 -1
  75. package/authoring/discover/discover.doc.mjs +1 -1
  76. package/authoring/doctypes/component/component.doc.mjs +1 -1
  77. package/authoring/doctypes/component/type.ts +8 -0
  78. package/authoring/doctypes/hook/type.ts +4 -0
  79. package/clients/cli/commands/discover.broken-integration.test.mjs +4 -1
  80. package/clients/cli/commands/discover.doc.mjs +1 -1
  81. package/clients/cli/commands/discover.mjs +144 -93
  82. package/clients/cli/commands/discover.no-source.test.mjs +447 -33
  83. package/clients/cli/commands/discover.sources.test.mjs +20 -1
  84. package/clients/cli/commands/doctor-integration-components.doc.mjs +3 -2
  85. package/clients/cli/commands/doctor-integration-docs.doc.mjs +19 -5
  86. package/clients/cli/commands/doctor-integration.test.mjs +48 -1
  87. package/clients/cli/commands/doctor.mjs +91 -5
  88. package/clients/cli/commands/gap-report.doc.mjs +14 -2
  89. package/clients/cli/commands/gap-report.mjs +24 -2
  90. package/clients/cli/commands/gap-report.test.mjs +79 -0
  91. package/clients/cli/commands/integration-authoring.test.mjs +46 -0
  92. package/clients/cli/commands/integration-check.test.mjs +144 -0
  93. package/clients/cli/commands/integration.mjs +12 -7
  94. package/clients/cli/commands/json-contract.test.mjs +5 -1
  95. package/clients/cli/commands/upgrade.doc.mjs +14 -0
  96. package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
  97. package/foundation/discovery/copied-passages.d.mts +216 -0
  98. package/foundation/discovery/copied-passages.mjs +720 -0
  99. package/foundation/discovery/copied-passages.test.mjs +124 -0
  100. package/foundation/discovery/doc-consistency.d.mts +34 -0
  101. package/foundation/discovery/doc-consistency.mjs +513 -0
  102. package/foundation/discovery/doc-consistency.test.mjs +347 -0
  103. package/foundation/discovery/doc-fluff.d.mts +112 -0
  104. package/foundation/discovery/doc-fluff.mjs +328 -0
  105. package/foundation/discovery/doc-fluff.test.mjs +142 -0
  106. package/foundation/discovery/doc-types.mjs +12 -5
  107. package/foundation/discovery/doc-types.test.mjs +46 -2
  108. package/foundation/discovery/docs-discovery.d.mts +7 -0
  109. package/foundation/discovery/docs-discovery.mjs +26 -2
  110. package/foundation/discovery/prop-drift.d.mts +25 -6
  111. package/foundation/discovery/prop-drift.mjs +171 -6
  112. package/foundation/discovery/prop-drift.test.mjs +65 -0
  113. package/foundation/discovery/stray-pointers.d.mts +52 -0
  114. package/foundation/discovery/stray-pointers.mjs +293 -0
  115. package/foundation/discovery/stray-pointers.test.mjs +86 -0
  116. package/foundation/doc-compiler/doc-loads.test.mjs +16 -0
  117. package/foundation/doc-compiler/links.d.mts +32 -0
  118. package/foundation/doc-compiler/links.mjs +163 -26
  119. package/foundation/doc-compiler/links.test.mjs +97 -4
  120. package/foundation/doc-compiler/tree.mjs +30 -1
  121. package/foundation/doc-compiler/tree.test.mjs +7 -0
  122. package/foundation/env/package-manager.d.mts +32 -0
  123. package/foundation/env/package-manager.mjs +47 -0
  124. package/foundation/env/package-manager.test.mjs +194 -7
  125. package/foundation/fs/module-loader.d.mts +2 -1
  126. package/foundation/fs/module-loader.mjs +60 -4
  127. package/foundation/fs/module-loader.test.mjs +194 -0
  128. package/foundation/integrations/contribution-inventory.d.mts +11 -0
  129. package/foundation/integrations/contribution-inventory.mjs +50 -2
  130. package/foundation/integrations/issue.ts +6 -0
  131. package/foundation/integrations/validate-contributions.mjs +30 -1
  132. package/foundation/response/response-types.doc.mjs +10 -9
  133. package/package.json +11 -11
@@ -116,6 +116,20 @@ export const doc = {
116
116
  ],
117
117
  related: ['init', 'doctor'],
118
118
  notes: [
119
+ {type: 'heading', level: 3, text: 'A CLI older than your Core'},
120
+ {
121
+ type: 'prose',
122
+ text:
123
+ 'Core codemods ship inside the CLI, so a CLI older than the installed @astryxdesign/core has none for ' +
124
+ 'the releases after its own version. upgrade then says it cannot finish, never reports your code as up to date, ' +
125
+ 'and prints the same upgrade pinned to the CLI release that matches your Core, such as ' +
126
+ '`cd <project> && npx @astryxdesign/cli@<core-version> upgrade --from <old-version> --path <source-dir> --apply`. ' +
127
+ 'It changes to the folder this run used and names the directory it scanned as an absolute path, both with ' +
128
+ 'symbolic links resolved, so pasted from any folder it upgrades the same code. It is written for a POSIX shell (sh, bash, zsh), or for PowerShell on Windows, ' +
129
+ 'with each argument quoted for that shell; cmd.exe is not a target. The codemods this CLI has still run. ' +
130
+ 'It exits 0, so a script checks the JSON: the result carries `cliBehindCore` with `cliVersion` (the newest release ' +
131
+ 'this CLI has codemods for) and `command`.',
132
+ },
119
133
  {type: 'heading', level: 3, text: 'Protected files'},
120
134
  {
121
135
  type: 'prose',
@@ -0,0 +1,160 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file `astryx upgrade` with a CLI older than the installed Core: the human
5
+ * output never says the code is up to date, warns once with the same upgrade
6
+ * pinned to the CLI release that matches the Core, and keeps the exit status;
7
+ * `--json` carries the same facts in `cliBehindCore`. Pasted anywhere, the
8
+ * printed command runs that upgrade in the same project.
9
+ */
10
+
11
+ import {describe, it, expect, beforeEach, afterEach} from 'vitest';
12
+ import {spawnSync} from 'node:child_process';
13
+ import * as fs from 'node:fs';
14
+ import * as os from 'node:os';
15
+ import * as path from 'node:path';
16
+ import {runCli} from '../../../test-utils/run-cli.mjs';
17
+ import {CLI_ROOT} from '../../../foundation/fs/paths.mjs';
18
+ import {
19
+ commandInFolder,
20
+ getDlxPrefix,
21
+ quoteCommandArgument,
22
+ } from '../../../foundation/env/package-manager.mjs';
23
+
24
+ const CLI_VERSION = JSON.parse(
25
+ fs.readFileSync(path.join(CLI_ROOT, 'package.json'), 'utf8'),
26
+ ).version;
27
+ const [MAJOR, MINOR] = CLI_VERSION.split('.').map(Number);
28
+ const NEWER_CORE = `${MAJOR}.${MINOR + 1}.0`;
29
+ const NON_ASCII = /[\u0080-\uFFFF]/;
30
+
31
+ let tmpDir;
32
+
33
+ /** @param {string} rel @param {string} body */
34
+ function write(rel, body) {
35
+ const file = path.join(tmpDir, rel);
36
+ fs.mkdirSync(path.dirname(file), {recursive: true});
37
+ fs.writeFileSync(file, body);
38
+ }
39
+
40
+ beforeEach(() => {
41
+ tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-upgrade-older-cli-'));
42
+ write('package.json', JSON.stringify({name: 'consumer', private: true}));
43
+ write(
44
+ 'node_modules/@astryxdesign/core/package.json',
45
+ JSON.stringify({name: '@astryxdesign/core', version: NEWER_CORE}),
46
+ );
47
+ write('src/index.ts', 'export const x = 1;\n');
48
+ });
49
+
50
+ afterEach(() => {
51
+ fs.rmSync(tmpDir, {recursive: true, force: true});
52
+ });
53
+
54
+ /**
55
+ * The pinned command the CLI prints for this project. It names the folder the
56
+ * CLI ran in and the source directory as the CLI resolved them.
57
+ * @param {...string} rest the arguments after `--path <dir>`
58
+ */
59
+ function pinned(...rest) {
60
+ const project = fs.realpathSync(tmpDir);
61
+ return commandInFolder(
62
+ project,
63
+ [
64
+ getDlxPrefix(tmpDir),
65
+ `@astryxdesign/cli@${NEWER_CORE}`,
66
+ 'upgrade',
67
+ '--from',
68
+ CLI_VERSION,
69
+ '--path',
70
+ quoteCommandArgument(path.join(project, 'src')),
71
+ ...rest,
72
+ ].join(' '),
73
+ );
74
+ }
75
+
76
+ /**
77
+ * Stand-ins for the package runners: each drops its own words and the pinned
78
+ * package, then runs this CLI with the rest of the command.
79
+ */
80
+ const RUNS_THIS_CLI = [
81
+ ['npx', 1],
82
+ ['bunx', 1],
83
+ ['pnpm', 2],
84
+ ['yarn', 2],
85
+ ]
86
+ .map(
87
+ ([name, words]) =>
88
+ `${name}() { shift ${words}; "$0" ${quoteCommandArgument(path.join(CLI_ROOT, 'clients', 'cli', 'bin', 'astryx.mjs'))} "$@"; }`,
89
+ )
90
+ .join('; ');
91
+
92
+ describe('astryx upgrade with a CLI older than the installed Core', () => {
93
+ it('says it cannot finish and prints the upgrade pinned to the matching CLI', async () => {
94
+ const r = await runCli(['upgrade', '--from', CLI_VERSION, '--apply'], {
95
+ cwd: tmpDir,
96
+ });
97
+ const output = `${r.stdout}\n${r.stderr}`;
98
+
99
+ expect(r.status).toBe(0);
100
+ expect(output).not.toMatch(/up to date/i);
101
+ expect(output).not.toContain('No codemods available');
102
+ expect(r.stderr).toContain(
103
+ `This CLI (${CLI_VERSION}) is older than the installed @astryxdesign/core (${NEWER_CORE})`,
104
+ );
105
+ // The command has a line of its own, so it copies exactly.
106
+ expect(r.stderr).toContain(
107
+ `the CLI that matches your Core:\n ${pinned('--apply')}\n`,
108
+ );
109
+ expect(r.stdout.trim().split('\n').at(-1)).toBe('Upgrade incomplete');
110
+ expect(output.split('\n').filter(line => NON_ASCII.test(line))).toEqual([]);
111
+ });
112
+
113
+ it('carries cliBehindCore in --json with the same exit status', async () => {
114
+ const r = await runCli(['--json', 'upgrade', '--from', CLI_VERSION], {
115
+ cwd: tmpDir,
116
+ });
117
+ const parsed = JSON.parse(r.stdout);
118
+
119
+ expect(r.status).toBe(0);
120
+ expect(parsed.type).toBe('upgrade.status');
121
+ expect(parsed.data.status).toBe('no_codemods');
122
+ expect(parsed.data.cliBehindCore).toEqual({
123
+ cliVersion: CLI_VERSION,
124
+ command: pinned(),
125
+ });
126
+ });
127
+
128
+ // Where an upgrade runs decides what it finds: the installed Core is read
129
+ // from that folder, and --path must stay inside it. Printed without its
130
+ // folder, the command exited 1 when pasted in a subfolder
131
+ // (ERR_PATH_TRAVERSAL) or in the folder above (ERR_VERSION_DETECT).
132
+ it.skipIf(process.platform === 'win32')(
133
+ 'prints a command that upgrades the same project wherever it is pasted',
134
+ async () => {
135
+ write('src/deep/index.ts', 'export const y = 2;\n');
136
+ const r = await runCli(['--json', 'upgrade', '--from', CLI_VERSION], {
137
+ cwd: tmpDir,
138
+ });
139
+ const {command} = JSON.parse(r.stdout).data.cliBehindCore;
140
+
141
+ for (const pastedIn of [
142
+ path.join(tmpDir, 'src', 'deep'),
143
+ path.dirname(tmpDir),
144
+ ]) {
145
+ const ran = spawnSync(
146
+ '/bin/sh',
147
+ ['-c', `${RUNS_THIS_CLI}; ${command}`, process.execPath],
148
+ {cwd: pastedIn, encoding: 'utf8'},
149
+ );
150
+
151
+ expect(ran.status, ran.stderr).toBe(0);
152
+ expect(ran.stdout).toContain(`Installed target: ${NEWER_CORE}`);
153
+ expect(ran.stdout).toContain(
154
+ `Scanning ${path.join(fs.realpathSync(tmpDir), 'src')} `,
155
+ );
156
+ }
157
+ },
158
+ 30_000,
159
+ );
160
+ });
@@ -0,0 +1,216 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * The number of distinct content words in a run: words that are not function
6
+ * words, with surrounding punctuation set aside.
7
+ *
8
+ * @param {{word: string}[]} words
9
+ * @param {number} start
10
+ * @param {number} length
11
+ */
12
+ export function contentWords(words: {
13
+ word: string;
14
+ }[], start: number, length: number): number;
15
+ /**
16
+ * The words a passage is compared by: lowercase, with links and Markdown
17
+ * emphasis set aside. A token with no letter or digit (the `.` after a link)
18
+ * is not a word.
19
+ *
20
+ * @param {string} text
21
+ * @returns {string[]}
22
+ */
23
+ export function passageWords(text: string): string[];
24
+ /**
25
+ * Every word of a doc file, in order, with its 1-based line. Words are runs of
26
+ * letters and digits, so punctuation, code ticks, quotes and escapes in the
27
+ * source neither join nor split them.
28
+ *
29
+ * @param {string} source
30
+ * @returns {{word: string, line: number}[]}
31
+ */
32
+ export function fileWords(source: string): {
33
+ word: string;
34
+ line: number;
35
+ }[];
36
+ /**
37
+ * The words of a string the way {@link fileWords} reads a file, each with its
38
+ * offset in the string.
39
+ *
40
+ * @param {string} text
41
+ * @returns {{word: string, at: number}[]}
42
+ */
43
+ export function textWords(text: string): {
44
+ word: string;
45
+ at: number;
46
+ }[];
47
+ /**
48
+ * Where a string's whole run of words starts among a file's words, looking
49
+ * from `from` on, or -1.
50
+ *
51
+ * @param {{word: string}[]} file
52
+ * @param {{word: string}[]} words
53
+ * @param {number} [from]
54
+ * @returns {number}
55
+ */
56
+ export function locateWords(file: {
57
+ word: string;
58
+ }[], words: {
59
+ word: string;
60
+ }[], from?: number): number;
61
+ /**
62
+ * The file line of the character at offset `at` of a string whose words start
63
+ * at `index` among the file's words.
64
+ *
65
+ * @param {{line: number}[]} file
66
+ * @param {number} index
67
+ * @param {{at: number}[]} words the string's words
68
+ * @param {number} at
69
+ * @returns {number | null}
70
+ */
71
+ export function lineAtOffset(file: {
72
+ line: number;
73
+ }[], index: number, words: {
74
+ at: number;
75
+ }[], at: number): number | null;
76
+ /**
77
+ * A shared run with the boilerplate trimmed off its ends, judged window by
78
+ * window: every word a leading boilerplate window covers, and every word from
79
+ * the first trailing one on. A lead-in many topics open with thus never hides
80
+ * the copy after it. Null when less than {@link PASSAGE_WORDS} words are left.
81
+ *
82
+ * @param {{start: number, length: number}} run
83
+ * @param {(at: number) => boolean} boilerplate whether the window of
84
+ * {@link PASSAGE_WORDS} words starting at `at` is boilerplate
85
+ * @returns {{start: number, length: number} | null}
86
+ */
87
+ export function trimBoilerplate({ start, length }: {
88
+ start: number;
89
+ length: number;
90
+ }, boilerplate: (at: number) => boolean): {
91
+ start: number;
92
+ length: number;
93
+ } | null;
94
+ /**
95
+ * The words of one string as passageWords reads them, each with where it sits
96
+ * in the string as written, so a passage can be quoted with its case,
97
+ * punctuation and code ticks.
98
+ *
99
+ * @param {string} text
100
+ * @returns {{word: string, start: number, end: number}[]}
101
+ */
102
+ export function wordSpans(text: string): {
103
+ word: string;
104
+ start: number;
105
+ end: number;
106
+ }[];
107
+ /**
108
+ * Each prose string of a doc, in order, with the title of the section it is
109
+ * in (null before the first section). Code, examples, reference blocks, and
110
+ * identifier fields are left out.
111
+ *
112
+ * @param {unknown} doc an authored doc object
113
+ * @returns {{text: string, section: string | null}[]}
114
+ */
115
+ export function proseStrings(doc: unknown): {
116
+ text: string;
117
+ section: string | null;
118
+ }[];
119
+ /**
120
+ * Each prose word of a doc, in order, with the title of the section it is in
121
+ * (null before the first section) and the number of the string it came from.
122
+ * A passage never runs from one string into the next, so two fields that
123
+ * happen to sit side by side are not read as one sentence.
124
+ *
125
+ * @param {unknown} doc an authored doc object
126
+ * @returns {{word: string, section: string | null, block: number}[]}
127
+ */
128
+ export function proseWords(doc: unknown): {
129
+ word: string;
130
+ section: string | null;
131
+ block: number;
132
+ }[];
133
+ /**
134
+ * The runs of at least `size` words that both docs have, each inside one
135
+ * string of each doc, longest first, as its start in `mine` and its length.
136
+ *
137
+ * @param {{word: string, block?: number}[]} mine
138
+ * @param {{word: string, block?: number}[]} other
139
+ * @param {number} [size]
140
+ * @returns {{start: number, length: number}[]}
141
+ */
142
+ export function sharedPassages(mine: {
143
+ word: string;
144
+ block?: number;
145
+ }[], other: {
146
+ word: string;
147
+ block?: number;
148
+ }[], size?: number): {
149
+ start: number;
150
+ length: number;
151
+ }[];
152
+ /**
153
+ * @param {string} file
154
+ * @returns {Promise<any>} the doc, or null for one that does not load (the
155
+ * load problem is reported elsewhere)
156
+ */
157
+ export function loadQuietly(file: string): Promise<any>;
158
+ /** @returns {Promise<IndexedGuides>} the CLI's own guides, read and indexed once */
159
+ export function loadCoreGuides(): Promise<IndexedGuides>;
160
+ /**
161
+ * One entry for each pair of topics that repeat a passage word for word: two
162
+ * of the package's own topics, or one of them and a Core topic, except the
163
+ * Core topic it replaces (a replacement takes that topic's place, so it may
164
+ * carry its text).
165
+ *
166
+ * @param {{records: {name: string, path: string, replaces?: string | null, extendsTopic?: string | null}[], guides?: {name: string, ref?: {topicFile?: string}}[]}} discovered
167
+ * the package's docs, as discoverIntegrationDocs returns them
168
+ * @returns {Promise<import('../../api/integration/authoring-checks.type.mjs').CopiedPassage[]>}
169
+ */
170
+ export function findCopiedPassages(discovered: {
171
+ records: {
172
+ name: string;
173
+ path: string;
174
+ replaces?: string | null;
175
+ extendsTopic?: string | null;
176
+ }[];
177
+ guides?: {
178
+ name: string;
179
+ ref?: {
180
+ topicFile?: string;
181
+ };
182
+ }[];
183
+ }): Promise<import("../../api/integration/authoring-checks.type.mjs").CopiedPassage[]>;
184
+ /** The shortest run of identical words reported as a copy. */
185
+ export const PASSAGE_WORDS: 10;
186
+ /**
187
+ * A copy carries at least this many distinct content words, so a run of
188
+ * glue words ("and it is in the way that you can…") is a phrase, not a fact.
189
+ */
190
+ export const MIN_CONTENT_WORDS: 4;
191
+ /**
192
+ * A run that this many topics share is boilerplate, such as a lead-in every
193
+ * guide of a series opens with, not a copy of one topic's fact.
194
+ */
195
+ export const BOILERPLATE_TOPICS: 3;
196
+ export type GuideWords = {
197
+ name: string;
198
+ title?: string;
199
+ file?: string;
200
+ doc?: unknown;
201
+ words: {
202
+ word: string;
203
+ section: string | null;
204
+ block: number;
205
+ }[];
206
+ replaces: string | null;
207
+ extendsTopic?: string | null;
208
+ };
209
+ /**
210
+ * Guides with an index from each run of words to the guides that have it, so
211
+ * a topic is compared in full only with the guides it shares a run with.
212
+ */
213
+ export type IndexedGuides = {
214
+ guides: GuideWords[];
215
+ index: Map<string, number[]>;
216
+ };