@astryxdesign/cli 0.7.2-canary.01eab6a → 0.7.2-canary.0da784d
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/README.md +9 -8
- package/api/build/help/help.mjs +1 -1
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +244 -1
- package/api/docs/integrationDocs.test.mjs +124 -0
- package/api/doctor/doctor.mjs +27 -3
- package/api/doctor/doctor.test.mjs +43 -0
- package/api/doctor/theme-checks.mjs +1 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/init/run/run.mjs +2 -2
- package/api/integration/add-contribution.mjs +1 -1
- package/api/integration/add-contribution.test.mjs +4 -2
- package/api/integration/check/check.d.mts +96 -0
- package/api/integration/check/check.mjs +357 -0
- package/api/integration/check/check.test.mjs +489 -0
- package/api/integration/integration-check.type.d.mts +118 -0
- package/api/integration/integration-check.type.mjs +84 -0
- package/api/integration/integrationCheck.doc.d.mts +10 -0
- package/api/integration/integrationCheck.doc.mjs +73 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +27 -6
- package/api/integration/validate-integration.mjs +8 -0
- package/api/integration/validate-integration.test.mjs +11 -0
- package/api/integration/validate-integration.type.d.mts +8 -0
- package/api/integration/validate-integration.type.mjs +12 -1
- package/api/integration/validateIntegration.doc.mjs +19 -3
- package/api/search/search.d.mts +72 -12
- package/api/search/search.domain-priority.test.mjs +108 -18
- package/api/search/search.integration-check.test.mjs +24 -0
- package/api/search/search.mjs +501 -37
- package/api/search/search.test.mjs +139 -0
- package/api/theme/build/build.family.test.mjs +54 -6
- package/api/theme/build/build.mjs +114 -17
- package/api/theme/themeBuild.doc.mjs +4 -4
- package/assets/docs/README.md +10 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +3 -3
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/docs/tree/add-a-component.doc.mjs +1 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +10 -7
- package/assets/docs/tree/agent-guidance.doc.mjs +2 -2
- package/assets/docs/tree/block-template.doc.mjs +8 -20
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/check-the-props.doc.mjs +52 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +51 -5
- package/assets/docs/tree/checks.doc.mjs +21 -13
- package/assets/docs/tree/codemods.doc.mjs +4 -4
- package/assets/docs/tree/component-family.doc.mjs +3 -5
- package/assets/docs/tree/component-imports.doc.mjs +2 -2
- package/assets/docs/tree/components.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +7 -18
- package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/docs.doc.mjs +3 -3
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +6 -6
- package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
- package/assets/docs/tree/generate-a-palette.doc.mjs +5 -3
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +1 -1
- package/assets/docs/tree/integrations.doc.mjs +8 -0
- package/assets/docs/tree/links.doc.mjs +6 -5
- package/assets/docs/tree/migration-setup.doc.mjs +1 -0
- package/assets/docs/tree/migration-verification.doc.mjs +0 -1
- package/assets/docs/tree/migration.doc.mjs +0 -1
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +4 -8
- package/assets/docs/tree/publishing.doc.mjs +1 -1
- package/assets/docs/tree/quick-start.doc.mjs +37 -21
- package/assets/docs/tree/replace-a-core-component.doc.mjs +4 -6
- package/assets/docs/tree/replace-a-core-template.doc.mjs +6 -8
- package/assets/docs/tree/sections-and-placement.doc.mjs +4 -6
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +4 -2
- package/assets/docs/tree/short-and-findable.doc.mjs +6 -5
- package/assets/docs/tree/single-component.doc.mjs +12 -4
- package/assets/docs/tree/start-a-template.doc.mjs +3 -3
- package/assets/docs/tree/subcomponent.doc.mjs +6 -6
- package/assets/docs/tree/template-assets.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +4 -15
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +2 -2
- package/assets/docs/tree/templates.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +3 -3
- package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
- package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
- package/assets/docs/tree/troubleshooting.doc.mjs +4 -4
- package/assets/docs/tree/type-scale.doc.mjs +3 -3
- package/assets/docs/tree/upgrading.doc.mjs +3 -3
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +3 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +6 -6
- package/assets/docs/tree/write-the-template-file.doc.mjs +4 -3
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/theme.template.ts +1 -1
- package/authoring/codemod/codemod.doc.mjs +7 -3
- package/authoring/config/config.doc.mjs +9 -6
- package/authoring/config/type.ts +4 -2
- package/authoring/discover/discover.doc.mjs +1 -1
- package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
- package/authoring/doctypes/command/command.doc.mjs +14 -12
- package/authoring/doctypes/component/component.doc.mjs +28 -25
- package/authoring/doctypes/component/type.ts +7 -5
- package/authoring/doctypes/enum/enum.doc.mjs +7 -4
- package/authoring/doctypes/function/function.doc.mjs +9 -8
- package/authoring/doctypes/hook/hook.doc.mjs +5 -4
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
- package/authoring/doctypes/reference/reference.doc.mjs +11 -10
- package/authoring/doctypes/schema/schema.doc.mjs +9 -9
- package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
- package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
- package/authoring/doctypes/template/parse.d.mts +6 -2
- package/authoring/doctypes/template/parse.mjs +3 -1
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/template/type.ts +22 -0
- package/authoring/doctypes/theme/theme.doc.mjs +2 -2
- package/authoring/gap-report/gap-report.doc.mjs +2 -2
- package/authoring/identity/identity.doc.mjs +3 -3
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/integration.doc.mjs +12 -4
- package/authoring/integration/parse.test.mjs +10 -0
- package/authoring/integration/schema.d.mts +2 -0
- package/authoring/integration/schema.mjs +1 -0
- package/authoring/integration/type.ts +4 -0
- package/clients/cli/commands/build-theme.batch-report.test.mjs +3 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
- package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +11 -4
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +13 -2
- package/clients/cli/commands/doctor-integration.test.mjs +512 -2
- package/clients/cli/commands/doctor.mjs +116 -0
- package/clients/cli/commands/integration-check.doc.mjs +85 -0
- package/clients/cli/commands/integration-check.test.mjs +267 -0
- package/clients/cli/commands/integration.doc.mjs +6 -2
- package/clients/cli/commands/integration.mjs +107 -1
- package/clients/cli/commands/setup-nudge.test.mjs +79 -1
- package/clients/cli/commands/swizzle.mjs +5 -3
- package/clients/cli/commands/swizzle.routing.test.mjs +18 -1
- package/clients/cli/commands/text-json-parity.test.mjs +5 -0
- package/clients/cli/commands/theme-build.doc.mjs +2 -2
- package/clients/cli/index.mjs +30 -5
- package/foundation/agent-docs/agent-doc-state.d.mts +14 -0
- package/foundation/agent-docs/agent-doc-state.mjs +38 -0
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +8 -6
- package/foundation/config/project.mjs +82 -0
- package/foundation/discovery/authoring-self-docs.mjs +2 -1
- package/foundation/discovery/doc-types.d.mts +157 -0
- package/foundation/discovery/doc-types.mjs +1224 -0
- package/foundation/discovery/doc-types.test.mjs +700 -0
- package/foundation/discovery/docs-discovery.d.mts +81 -0
- package/foundation/discovery/docs-discovery.mjs +57 -0
- package/foundation/discovery/integration-doc-files.d.mts +22 -0
- package/foundation/discovery/integration-doc-files.mjs +231 -0
- package/foundation/discovery/integration-doc-files.test.mjs +246 -0
- package/foundation/discovery/project-typescript.d.mts +11 -2
- package/foundation/discovery/project-typescript.mjs +32 -4
- package/foundation/discovery/prop-drift.d.mts +62 -4
- package/foundation/discovery/prop-drift.mjs +561 -63
- package/foundation/discovery/prop-drift.test.mjs +1086 -11
- package/foundation/discovery/type-match.d.mts +53 -0
- package/foundation/discovery/type-match.mjs +660 -0
- package/foundation/discovery/type-match.test.mjs +169 -0
- package/foundation/discovery/type-text.d.mts +68 -0
- package/foundation/discovery/type-text.mjs +658 -0
- package/foundation/discovery/type-text.test.mjs +196 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +8 -2
- package/foundation/doc-compiler/links.d.mts +9 -5
- package/foundation/doc-compiler/links.mjs +4 -2
- package/foundation/response/response-types.doc.mjs +7 -2
- package/package.json +9 -9
- package/scripts/postinstall.mjs +3 -3
|
@@ -16,9 +16,24 @@ import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
|
16
16
|
import * as fs from 'node:fs';
|
|
17
17
|
import * as path from 'node:path';
|
|
18
18
|
import * as os from 'node:os';
|
|
19
|
-
import {
|
|
19
|
+
import {fileURLToPath} from 'node:url';
|
|
20
|
+
import {
|
|
21
|
+
isAstryxInitialized,
|
|
22
|
+
isAstryxPromptInReach,
|
|
23
|
+
} from '../../../foundation/agent-docs/agent-docs.mjs';
|
|
20
24
|
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
21
25
|
|
|
26
|
+
/** This source checkout: the tests run the CLI from it. */
|
|
27
|
+
const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../..');
|
|
28
|
+
|
|
29
|
+
/** Is `dir` inside a git repository? The temp folder normally is not. */
|
|
30
|
+
function insideRepository(dir) {
|
|
31
|
+
for (let d = path.resolve(dir); ; d = path.dirname(d)) {
|
|
32
|
+
if (fs.existsSync(path.join(d, '.git'))) return true;
|
|
33
|
+
if (path.dirname(d) === d) return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
const MARKER = '<!-- ASTRYX:START -->';
|
|
23
38
|
const NUDGE = /finish setup and install the Astryx agent prompt/;
|
|
24
39
|
|
|
@@ -61,6 +76,41 @@ describe('isAstryxInitialized — centralized setup check (one place)', () => {
|
|
|
61
76
|
});
|
|
62
77
|
});
|
|
63
78
|
|
|
79
|
+
// Agents read the agent docs between the repository root and the folder they
|
|
80
|
+
// work in, so a monorepo initialized at its root is set up in every package.
|
|
81
|
+
describe('isAstryxPromptInReach — up to the repository root', () => {
|
|
82
|
+
it('finds init\'s block at the repository root from a workspace package', () => {
|
|
83
|
+
fs.mkdirSync(path.join(tmp, '.git'));
|
|
84
|
+
write('AGENTS.md', MARKER);
|
|
85
|
+
write('packages/app/package.json', '{"name":"app"}');
|
|
86
|
+
expect(isAstryxPromptInReach(path.join(tmp, 'packages/app'))).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('treats a worktree .git file as the repository root', () => {
|
|
90
|
+
write('.git', 'gitdir: /elsewhere\n');
|
|
91
|
+
write('CLAUDE.md', MARKER);
|
|
92
|
+
write('packages/app/package.json', '{"name":"app"}');
|
|
93
|
+
expect(isAstryxPromptInReach(path.join(tmp, 'packages/app'))).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('does not look above the repository root', () => {
|
|
97
|
+
write('AGENTS.md', MARKER);
|
|
98
|
+
fs.mkdirSync(path.join(tmp, 'repo/.git'), {recursive: true});
|
|
99
|
+
write('repo/pkg/package.json', '{"name":"pkg"}');
|
|
100
|
+
expect(isAstryxPromptInReach(path.join(tmp, 'repo/pkg'))).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it.skipIf(insideRepository(os.tmpdir()))(
|
|
104
|
+
'checks only the folder itself outside a repository',
|
|
105
|
+
() => {
|
|
106
|
+
write('AGENTS.md', MARKER);
|
|
107
|
+
write('pkg/package.json', '{"name":"pkg"}');
|
|
108
|
+
expect(isAstryxPromptInReach(tmp)).toBe(true);
|
|
109
|
+
expect(isAstryxPromptInReach(path.join(tmp, 'pkg'))).toBe(false);
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
|
|
64
114
|
describe('enforcement layer 3 — per-command setup nudge', () => {
|
|
65
115
|
const asProject = () => write('package.json', '{"name":"t"}');
|
|
66
116
|
|
|
@@ -99,4 +149,32 @@ describe('enforcement layer 3 — per-command setup nudge', () => {
|
|
|
99
149
|
asProject();
|
|
100
150
|
expect((await runCli(['init'], tmp)).stderr).not.toMatch(NUDGE);
|
|
101
151
|
});
|
|
152
|
+
|
|
153
|
+
it('is quiet in a workspace package when init\'s block is at the repository root', async () => {
|
|
154
|
+
fs.mkdirSync(path.join(tmp, '.git'));
|
|
155
|
+
write('AGENTS.md', MARKER);
|
|
156
|
+
write('packages/app/package.json', '{"name":"app"}');
|
|
157
|
+
const r = await runCli(['docs', 'tokens'], path.join(tmp, 'packages/app'));
|
|
158
|
+
expect(r.stderr).not.toMatch(NUDGE);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('still nudges in a workspace package with no block up to the repository root', async () => {
|
|
162
|
+
fs.mkdirSync(path.join(tmp, '.git'));
|
|
163
|
+
write('AGENTS.md', 'project notes, no astryx block');
|
|
164
|
+
write('packages/app/package.json', '{"name":"app"}');
|
|
165
|
+
const r = await runCli(['docs', 'tokens'], path.join(tmp, 'packages/app'));
|
|
166
|
+
expect(r.stderr).toMatch(NUDGE);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// The tests run the CLI from this checkout, so a project inside it is the
|
|
170
|
+
// contributor flow. The same project in the temp folder nudges (above).
|
|
171
|
+
it('is quiet inside the source checkout the CLI runs from', async () => {
|
|
172
|
+
const inside = fs.mkdtempSync(path.join(REPO, '.astryx-setup-nudge-'));
|
|
173
|
+
try {
|
|
174
|
+
fs.writeFileSync(path.join(inside, 'package.json'), '{"name":"t"}');
|
|
175
|
+
expect((await runCli(['docs', 'tokens'], inside)).stderr).not.toMatch(NUDGE);
|
|
176
|
+
} finally {
|
|
177
|
+
fs.rmSync(inside, {recursive: true, force: true});
|
|
178
|
+
}
|
|
179
|
+
});
|
|
102
180
|
});
|
|
@@ -91,14 +91,16 @@ export function registerSwizzle(program) {
|
|
|
91
91
|
),
|
|
92
92
|
];
|
|
93
93
|
|
|
94
|
-
// StyleX build requirement — swizzled StyleX source
|
|
95
|
-
//
|
|
94
|
+
// StyleX build requirement — swizzled StyleX source throws on import
|
|
95
|
+
// ("Unexpected 'stylex.create' call at runtime") unless the consumer's
|
|
96
|
+
// build runs a StyleX compiler, so the page does not render at all.
|
|
96
97
|
if (usesStyleX) {
|
|
97
98
|
out.push(
|
|
98
99
|
text(
|
|
99
100
|
[
|
|
100
101
|
`${WARN} These components use StyleX and require a StyleX compiler in your build.`,
|
|
101
|
-
|
|
102
|
+
` Without one, importing them throws "Unexpected 'stylex.create' call at runtime"`,
|
|
103
|
+
' and the page does not render. See setup per framework:',
|
|
102
104
|
` ${run} docs styling`,
|
|
103
105
|
' Next.js note: the StyleX Babel plugin disables SWC and breaks next/font -',
|
|
104
106
|
' use an SWC-based StyleX transform instead (covered in the guide).',
|
|
@@ -15,8 +15,16 @@ import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
|
15
15
|
import * as fs from 'node:fs';
|
|
16
16
|
import * as path from 'node:path';
|
|
17
17
|
import * as os from 'node:os';
|
|
18
|
+
import {createRequire} from 'node:module';
|
|
19
|
+
import {fileURLToPath} from 'node:url';
|
|
18
20
|
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
19
21
|
|
|
22
|
+
/** The StyleX runtime that Core ships with, resolved the way Core resolves it. */
|
|
23
|
+
const CORE_PACKAGE = path.resolve(
|
|
24
|
+
path.dirname(fileURLToPath(import.meta.url)),
|
|
25
|
+
'../../../../core/package.json',
|
|
26
|
+
);
|
|
27
|
+
|
|
20
28
|
/**
|
|
21
29
|
* Build a fake @astryxdesign/core under <project>/node_modules with a single
|
|
22
30
|
* swizzleable Button component (bare `Button.tsx`, no doc).
|
|
@@ -303,12 +311,21 @@ describe('swizzle — StyleX build setup note (#3373)', () => {
|
|
|
303
311
|
const humanResult = await runCli(['swizzle', 'Styled', '-f'], project);
|
|
304
312
|
expect(humanResult.code).toBe(0);
|
|
305
313
|
expect(humanResult.stdout).toMatch(/StyleX compiler/i);
|
|
306
|
-
expect(humanResult.stdout).toMatch(/
|
|
314
|
+
expect(humanResult.stdout).toMatch(/importing them throws "Unexpected 'stylex\.create' call at runtime"/);
|
|
315
|
+
expect(humanResult.stdout).not.toMatch(/unstyled/i);
|
|
307
316
|
expect(humanResult.stdout).toMatch(/next\/font/i);
|
|
308
317
|
// The fixture has no `astryx` bin installed, so the note names the scoped package.
|
|
309
318
|
expect(humanResult.stdout).toMatch(/@astryxdesign\/cli docs styling/);
|
|
310
319
|
});
|
|
311
320
|
|
|
321
|
+
// The note quotes what StyleX does without a compiler; this keeps it true.
|
|
322
|
+
it('matches what the StyleX runtime does when styles are not compiled', () => {
|
|
323
|
+
const stylex = createRequire(CORE_PACKAGE)('@stylexjs/stylex');
|
|
324
|
+
expect(() => stylex.create({root: {color: 'red'}})).toThrow(
|
|
325
|
+
/Unexpected 'stylex\.create' call at runtime/,
|
|
326
|
+
);
|
|
327
|
+
});
|
|
328
|
+
|
|
312
329
|
it('does not print the StyleX note for components without StyleX', async () => {
|
|
313
330
|
buildStyleXCore(project);
|
|
314
331
|
writeProjectPackageJson(project);
|
|
@@ -341,6 +341,11 @@ const CASES = [
|
|
|
341
341
|
args: ['doctor', 'integration', 'validate'],
|
|
342
342
|
skipFieldChecks: true,
|
|
343
343
|
},
|
|
344
|
+
{
|
|
345
|
+
name: 'integration check',
|
|
346
|
+
args: ['integration', 'check'],
|
|
347
|
+
skipFieldChecks: true,
|
|
348
|
+
},
|
|
344
349
|
{
|
|
345
350
|
name: 'doctor integration components',
|
|
346
351
|
args: ['doctor', 'integration', 'components'],
|
|
@@ -30,7 +30,7 @@ export const doc = {
|
|
|
30
30
|
{
|
|
31
31
|
flag: '--family',
|
|
32
32
|
description:
|
|
33
|
-
'Build the selected extension family into one keyed CSS, JS, and declaration set, written beside the family root theme file, which must be inside the working directory (ERR_PATH_TRAVERSAL). Requires --family-key; refused with --out or --watch (ERR_THEME_INVALID)',
|
|
33
|
+
'Build the selected extension family into one keyed CSS, JS, and declaration set, written beside the family root theme file, which must be inside the working directory to build (ERR_PATH_TRAVERSAL); --check only reads, so it compares outputs anywhere. Requires --family-key; refused with --out or --watch (ERR_THEME_INVALID)',
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
flag: '--family-key <key>',
|
|
@@ -41,7 +41,7 @@ export const doc = {
|
|
|
41
41
|
flag: '-o, --out <path>',
|
|
42
42
|
param: 'options.out',
|
|
43
43
|
description:
|
|
44
|
-
'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source).
|
|
44
|
+
'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
flag: '--icons-specifier <specifier>',
|
package/clients/cli/index.mjs
CHANGED
|
@@ -26,7 +26,8 @@ import {levenshteinDistance} from '../../foundation/text/string-utils.mjs';
|
|
|
26
26
|
import {installJsonShim} from './lib/json-shim.mjs';
|
|
27
27
|
import {addDocHelp, markReportsResult} from './lib/define-command.mjs';
|
|
28
28
|
import {doc as manifestDoc} from './commands/manifest.doc.mjs';
|
|
29
|
-
import {isAstryxInitialized} from '../../foundation/agent-docs/agent-docs.mjs';
|
|
29
|
+
import {isAstryxInitialized, isAstryxPromptInReach} from '../../foundation/agent-docs/agent-docs.mjs';
|
|
30
|
+
import {CLI_ROOT} from '../../foundation/fs/paths.mjs';
|
|
30
31
|
import * as debug from '../../foundation/debug/index.mjs';
|
|
31
32
|
|
|
32
33
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -98,6 +99,7 @@ export const JSON_SUPPORTED = new Set([
|
|
|
98
99
|
'theme targets',
|
|
99
100
|
'theme palette generate',
|
|
100
101
|
'integration add',
|
|
102
|
+
'integration check',
|
|
101
103
|
'integration verify',
|
|
102
104
|
'integration pack',
|
|
103
105
|
'upgrade',
|
|
@@ -276,6 +278,26 @@ const commands = [
|
|
|
276
278
|
];
|
|
277
279
|
|
|
278
280
|
const SETUP_NUDGE_EXEMPT = new Set(['init', 'agent-docs']);
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Is `cwd` inside the CLI's own source checkout while the CLI runs from it?
|
|
284
|
+
* An installed CLI always lives under `node_modules`; a CLI running from source
|
|
285
|
+
* does not, and its checkout is the pnpm workspace that holds it. Developing
|
|
286
|
+
* Astryx is not an app to set up, so the setup nudge stays quiet there.
|
|
287
|
+
* @param {string} cwd
|
|
288
|
+
* @returns {boolean}
|
|
289
|
+
*/
|
|
290
|
+
function inOwnSourceCheckout(cwd) {
|
|
291
|
+
if (CLI_ROOT.split(path.sep).includes('node_modules')) return false;
|
|
292
|
+
let checkout = CLI_ROOT;
|
|
293
|
+
while (!fs.existsSync(path.join(checkout, 'pnpm-workspace.yaml'))) {
|
|
294
|
+
const parent = path.dirname(checkout);
|
|
295
|
+
if (parent === checkout) return false;
|
|
296
|
+
checkout = parent;
|
|
297
|
+
}
|
|
298
|
+
const rel = path.relative(checkout, path.resolve(cwd));
|
|
299
|
+
return rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel);
|
|
300
|
+
}
|
|
279
301
|
/** An integration package's manifest: the package is not an app to set up. */
|
|
280
302
|
const INTEGRATION_MANIFEST_FILES = [
|
|
281
303
|
'astryx.integration.ts',
|
|
@@ -527,8 +549,9 @@ export async function createProgram() {
|
|
|
527
549
|
|
|
528
550
|
/**
|
|
529
551
|
* Enforcement layer 3 — setup nudge. If this project hasn't run `astryx init`
|
|
530
|
-
* yet (no Astryx marker in any agent-doc file
|
|
531
|
-
* the user/agent that
|
|
552
|
+
* yet (no Astryx marker in any agent-doc file between the project and its
|
|
553
|
+
* repository root — see isAstryxPromptInReach), remind the user/agent that
|
|
554
|
+
* setup is missing.
|
|
532
555
|
*
|
|
533
556
|
* Uses `preAction` (not postAction) so it fires for EVERY valid command — even
|
|
534
557
|
* ones whose action errors or calls process.exit (postAction is skipped then).
|
|
@@ -538,7 +561,8 @@ export async function createProgram() {
|
|
|
538
561
|
* consumers parse stdout, not stderr — a stderr nudge would not reach them anyway.
|
|
539
562
|
* The core/cli postinstall layers already nudge at install time regardless of
|
|
540
563
|
* --json; a machine-readable nudge could later be an envelope field. Also skipped
|
|
541
|
-
* for the installer commands themselves
|
|
564
|
+
* for the installer commands themselves, outside a project (no package.json),
|
|
565
|
+
* and inside the CLI's own source checkout when it runs from there.
|
|
542
566
|
*/
|
|
543
567
|
program.hook('preAction', (thisCommand, actionCommand) => {
|
|
544
568
|
try {
|
|
@@ -548,7 +572,8 @@ export async function createProgram() {
|
|
|
548
572
|
if (!fs.existsSync(path.join(cwd, 'package.json'))) return; // not a project
|
|
549
573
|
// An integration package is not an app: `init` is not its next step.
|
|
550
574
|
if (INTEGRATION_MANIFEST_FILES.some(file => fs.existsSync(path.join(cwd, file)))) return;
|
|
551
|
-
if (
|
|
575
|
+
if (inOwnSourceCheckout(cwd)) return; // developing Astryx itself, not an app
|
|
576
|
+
if (isAstryxPromptInReach(cwd)) return; // already set up — stay quiet
|
|
552
577
|
// Same wording as the core/cli postinstall nudges. #4151's getCliInvocation()
|
|
553
578
|
// renders the correct form for THIS project — scoped `npx @astryxdesign/cli`
|
|
554
579
|
// one-off, or `<pm> astryx` when installed — never the bare `npx astryx` footgun.
|
|
@@ -20,6 +20,20 @@ export function discoverAgentDocs(targetDir: string): string[];
|
|
|
20
20
|
* @returns {boolean}
|
|
21
21
|
*/
|
|
22
22
|
export function isAstryxInitialized(targetDir?: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Does an agent working in `startDir` already have the Astryx prompt in reach?
|
|
25
|
+
*
|
|
26
|
+
* Coding agents read the agent docs between the repository root and the folder
|
|
27
|
+
* they work in. So inside a git repository, init's block in any folder from
|
|
28
|
+
* `startDir` up to the repository root counts: a workspace package of a
|
|
29
|
+
* monorepo initialized at its root is set up. Outside a repository only
|
|
30
|
+
* `startDir` itself is checked, as {@link isAstryxInitialized} does. Both the
|
|
31
|
+
* per-command nudge and the postinstall nudges ask this.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} [startDir=process.cwd()]
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
export function isAstryxPromptInReach(startDir?: string): boolean;
|
|
23
37
|
/**
|
|
24
38
|
* Pure decision: should a postinstall print the setup nudge? Shared by BOTH
|
|
25
39
|
* postinstall layers, so the matrix cannot drift between them, and unit-testable
|
|
@@ -96,6 +96,44 @@ export function isAstryxInitialized(targetDir = process.cwd()) {
|
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Does an agent working in `startDir` already have the Astryx prompt in reach?
|
|
101
|
+
*
|
|
102
|
+
* Coding agents read the agent docs between the repository root and the folder
|
|
103
|
+
* they work in. So inside a git repository, init's block in any folder from
|
|
104
|
+
* `startDir` up to the repository root counts: a workspace package of a
|
|
105
|
+
* monorepo initialized at its root is set up. Outside a repository only
|
|
106
|
+
* `startDir` itself is checked, as {@link isAstryxInitialized} does. Both the
|
|
107
|
+
* per-command nudge and the postinstall nudges ask this.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} [startDir=process.cwd()]
|
|
110
|
+
* @returns {boolean}
|
|
111
|
+
*/
|
|
112
|
+
export function isAstryxPromptInReach(startDir = process.cwd()) {
|
|
113
|
+
const start = path.resolve(startDir);
|
|
114
|
+
const repositoryRoot = findRepositoryRoot(start);
|
|
115
|
+
if (!repositoryRoot) return isAstryxInitialized(start);
|
|
116
|
+
for (let dir = start; ; dir = path.dirname(dir)) {
|
|
117
|
+
if (isAstryxInitialized(dir)) return true;
|
|
118
|
+
if (dir === repositoryRoot) return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The nearest folder at or above `start` that holds `.git` (a folder, or the
|
|
124
|
+
* file a worktree uses), or null outside a repository.
|
|
125
|
+
* @param {string} start
|
|
126
|
+
* @returns {string | null}
|
|
127
|
+
*/
|
|
128
|
+
function findRepositoryRoot(start) {
|
|
129
|
+
for (let dir = start; ; ) {
|
|
130
|
+
if (fs.existsSync(path.join(dir, '.git'))) return dir;
|
|
131
|
+
const parent = path.dirname(dir);
|
|
132
|
+
if (parent === dir) return null;
|
|
133
|
+
dir = parent;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
99
137
|
/**
|
|
100
138
|
* The one-line next-step both postinstall nudges print. Kept here so layer 1
|
|
101
139
|
* (core) and layer 2 (cli) can never word it differently.
|
|
@@ -226,4 +226,5 @@ export function installAgentDocs(targetDir: string, { zh, lang, agent, paths, on
|
|
|
226
226
|
}): string[];
|
|
227
227
|
import { discoverAgentDocs } from './agent-doc-state.mjs';
|
|
228
228
|
import { isAstryxInitialized } from './agent-doc-state.mjs';
|
|
229
|
-
|
|
229
|
+
import { isAstryxPromptInReach } from './agent-doc-state.mjs';
|
|
230
|
+
export { discoverAgentDocs, isAstryxInitialized, isAstryxPromptInReach };
|
|
@@ -42,15 +42,17 @@ import {
|
|
|
42
42
|
LEGACY_MARKER_END,
|
|
43
43
|
discoverAgentDocs,
|
|
44
44
|
isAstryxInitialized,
|
|
45
|
+
isAstryxPromptInReach,
|
|
45
46
|
} from './agent-doc-state.mjs';
|
|
46
47
|
|
|
47
48
|
// The agent-doc locations, markers, and the setup-state predicates
|
|
48
|
-
// (discoverAgentDocs, isAstryxInitialized) are the ONE
|
|
49
|
-
// live in the dependency-free leaf
|
|
50
|
-
// nudge (enforcement layer 2) can load
|
|
51
|
-
//
|
|
52
|
-
// clients/cli/index.mjs, tests)
|
|
53
|
-
|
|
49
|
+
// (discoverAgentDocs, isAstryxInitialized, isAstryxPromptInReach) are the ONE
|
|
50
|
+
// canonical contract. They live in the dependency-free leaf
|
|
51
|
+
// ./agent-doc-state.mjs so the postinstall nudge (enforcement layer 2) can load
|
|
52
|
+
// them safely at install time. Re-exported here so existing importers
|
|
53
|
+
// (init/upgrade commands, the layer-3 nudge in clients/cli/index.mjs, tests)
|
|
54
|
+
// keep their `from './agent-docs.mjs'` paths.
|
|
55
|
+
export {discoverAgentDocs, isAstryxInitialized, isAstryxPromptInReach};
|
|
54
56
|
|
|
55
57
|
const MAX_PROJECT_AGENT_DOC_LINES = 32;
|
|
56
58
|
const MANAGED_MARKER_TEXT = /(?:ASTRYX|XDS):(START|END)/u;
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
applyTemplateReplacements,
|
|
61
61
|
effectiveTemplateDiscovery,
|
|
62
62
|
discoverAllUnresolved as discoverTemplates,
|
|
63
|
+
discoverCoreTemplates,
|
|
63
64
|
discoverIntegrationTemplatesForOne,
|
|
64
65
|
} from '../discovery/template-adapter.mjs';
|
|
65
66
|
import {
|
|
@@ -821,6 +822,85 @@ export class Project {
|
|
|
821
822
|
});
|
|
822
823
|
}
|
|
823
824
|
|
|
825
|
+
/**
|
|
826
|
+
* The components and templates this project reads, as links name them: by
|
|
827
|
+
* owner provider id, kind, and name (a template by its id).
|
|
828
|
+
* @returns {Promise<import('../discovery/docs-discovery.mjs').LinkableContributions>}
|
|
829
|
+
*/
|
|
830
|
+
async #linkableContributions() {
|
|
831
|
+
/** @type {Map<string, string>} */
|
|
832
|
+
const providers = new Map([[CORE_PACKAGE, CORE_PACKAGE]]);
|
|
833
|
+
for (const integration of this.#loadedIntegrations) {
|
|
834
|
+
if (integration?.name) {
|
|
835
|
+
providers.set(
|
|
836
|
+
integration.name,
|
|
837
|
+
integration.providerId ?? integration.name,
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
const providerOf = (/** @type {string | undefined} */ pkg) =>
|
|
842
|
+
providers.get(pkg ?? CORE_PACKAGE) ?? pkg ?? CORE_PACKAGE;
|
|
843
|
+
// An active replacement answers to the Core name it replaces, so a link
|
|
844
|
+
// to that Core component has to select Core (spec:AST-035 FR11).
|
|
845
|
+
/** @type {Map<string, string>} */
|
|
846
|
+
const replacing = new Map();
|
|
847
|
+
if (this.#loadedIntegrations.length > 0) {
|
|
848
|
+
const {active} = await resolveComponentReplacements(
|
|
849
|
+
findCoreDir(this.#cwd),
|
|
850
|
+
this.#loadedIntegrations,
|
|
851
|
+
);
|
|
852
|
+
for (const each of active) {
|
|
853
|
+
replacing.set(`${each.package}\0${each.name}`, each.target);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
const components = (await this.components()).map(record => {
|
|
857
|
+
const replaces = replacing.get(`${record.package}\0${record.name}`);
|
|
858
|
+
return {
|
|
859
|
+
providerId: providerOf(record.package),
|
|
860
|
+
package: record.package,
|
|
861
|
+
name: record.name,
|
|
862
|
+
docPath: record.docPath,
|
|
863
|
+
...(replaces == null ? {} : {replaces}),
|
|
864
|
+
};
|
|
865
|
+
});
|
|
866
|
+
/** @param {any} template @param {string} pkg */
|
|
867
|
+
const linkable = (template, pkg) => ({
|
|
868
|
+
providerId: providerOf(pkg),
|
|
869
|
+
package: pkg,
|
|
870
|
+
type: template.type,
|
|
871
|
+
id: template.dirName,
|
|
872
|
+
name: template.name,
|
|
873
|
+
...(template.displayName == null
|
|
874
|
+
? {}
|
|
875
|
+
: {displayName: template.displayName}),
|
|
876
|
+
...(template.description == null
|
|
877
|
+
? {}
|
|
878
|
+
: {description: template.description}),
|
|
879
|
+
...(typeof template.replaces === 'string'
|
|
880
|
+
? {replaces: template.replaces}
|
|
881
|
+
: {}),
|
|
882
|
+
});
|
|
883
|
+
/** @param {any} template */
|
|
884
|
+
const isPageOrBlock = template =>
|
|
885
|
+
template.type === 'page' || template.type === 'block';
|
|
886
|
+
// Every Core template, a replaced one too, since `--package
|
|
887
|
+
// @astryxdesign/core` still opens it; everyone else's as unqualified
|
|
888
|
+
// lookups see them, an active replacement with the id it takes over.
|
|
889
|
+
const templates = [
|
|
890
|
+
...(await discoverCoreTemplates())
|
|
891
|
+
.filter(isPageOrBlock)
|
|
892
|
+
.map(template => linkable(template, CORE_PACKAGE)),
|
|
893
|
+
.../** @type {any[]} */ (await this.templates())
|
|
894
|
+
.filter(
|
|
895
|
+
template =>
|
|
896
|
+
isPageOrBlock(template) &&
|
|
897
|
+
(template.package ?? CORE_PACKAGE) !== CORE_PACKAGE,
|
|
898
|
+
)
|
|
899
|
+
.map(template => linkable(template, template.package)),
|
|
900
|
+
];
|
|
901
|
+
return {components, templates};
|
|
902
|
+
}
|
|
903
|
+
|
|
824
904
|
/**
|
|
825
905
|
* The CLI's own doc topics plus the ones the configured integrations
|
|
826
906
|
* contribute, resolved into one catalog: additions, replacements (with the
|
|
@@ -838,6 +918,8 @@ export class Project {
|
|
|
838
918
|
async docs() {
|
|
839
919
|
return this.#memo('docs', async () => {
|
|
840
920
|
const catalog = DocsCatalog.fromBuiltins();
|
|
921
|
+
// Links name component, page, and block docs too (spec:AST-047 FR9).
|
|
922
|
+
catalog.setContributions(() => this.#linkableContributions());
|
|
841
923
|
let rank = 0;
|
|
842
924
|
|
|
843
925
|
for (const integration of this.#loadedIntegrations) {
|
|
@@ -46,6 +46,7 @@ export const AUTHORING_SELF_DOCS = [
|
|
|
46
46
|
'doctypes/reference/reference.doc.mjs',
|
|
47
47
|
'doctypes/schema/schema.doc.mjs',
|
|
48
48
|
'doctypes/template/template.doc.mjs',
|
|
49
|
+
'doctypes/template/integration-template.doc.mjs',
|
|
49
50
|
'doctypes/theme/theme.doc.mjs',
|
|
50
51
|
];
|
|
51
52
|
|
|
@@ -192,7 +193,7 @@ export function buildAuthoringReferenceDoc(docs) {
|
|
|
192
193
|
title: 'Authoring Reference',
|
|
193
194
|
category: 'guide',
|
|
194
195
|
description:
|
|
195
|
-
'Every file an integration author writes, field by field: the integration manifest, astryx.config, codemods, identity, and each doc type.',
|
|
196
|
+
'Every file an integration author writes, field by field: the integration manifest, astryx.config, codemods, identity, and each doc type. The step-by-step guides are under `astryx docs cli/integrations`.',
|
|
196
197
|
sections: docs.map(selfDocSection),
|
|
197
198
|
});
|
|
198
199
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
* Check each doc file's values against the published authoring types.
|
|
6
|
+
* @param {DocFile[]} files
|
|
7
|
+
* @param {{packageDir: string, resolveFrom: Array<string | null | undefined>, core?: boolean}} options
|
|
8
|
+
* `core`: the docs are Core's own, so templates are held to TemplateDoc
|
|
9
|
+
* @returns {Promise<DocTypesReport>}
|
|
10
|
+
*/
|
|
11
|
+
export function checkDocTypes(files: DocFile[], options: {
|
|
12
|
+
packageDir: string;
|
|
13
|
+
resolveFrom: Array<string | null | undefined>;
|
|
14
|
+
core?: boolean;
|
|
15
|
+
}): Promise<DocTypesReport>;
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {'components' | 'hooks' | 'templates' | 'docs' | 'docs-overlay' | 'themes'} DocRoot
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {object} DocFile
|
|
21
|
+
* @property {string} path absolute path to the doc file
|
|
22
|
+
* @property {DocRoot} root the contribution root it was found in
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {'unknown_field' | 'missing_field' | 'wrong_type'} DocTypeProblem
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {object} DocTypeFinding
|
|
29
|
+
* @property {string} doc the doc file, relative to the package root
|
|
30
|
+
* @property {number} line 1-based line of the field (or of the doc value)
|
|
31
|
+
* @property {string} export the export checked (`default`, `docs`, `docsZh`, …)
|
|
32
|
+
* @property {string} type the authoring type it was checked against
|
|
33
|
+
* @property {string} field the field's path in the doc, such as
|
|
34
|
+
* `usage.bestPractices[2].guidance`; empty for the doc value as a whole
|
|
35
|
+
* @property {DocTypeProblem} problem
|
|
36
|
+
* @property {'warning'} severity
|
|
37
|
+
* @property {string} message what TypeScript reports, shortened
|
|
38
|
+
* @property {string} fix what to change
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {object} DocTypesUnchecked
|
|
42
|
+
* @property {string} doc the doc file, relative to the package root
|
|
43
|
+
* @property {string} reason why it was not checked
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {object} DocTypesReport
|
|
47
|
+
* @property {'checked' | 'skipped'} status `skipped` means nothing was checked,
|
|
48
|
+
* and `reason` says why
|
|
49
|
+
* @property {string} [reason]
|
|
50
|
+
* @property {string} [typescript] the version of the compiler that checked
|
|
51
|
+
* @property {number} docs how many doc values were checked
|
|
52
|
+
* @property {DocTypeFinding[]} findings
|
|
53
|
+
* @property {DocTypesUnchecked[]} unchecked doc files with nothing to check,
|
|
54
|
+
* or not fully checked
|
|
55
|
+
*/
|
|
56
|
+
/** The line both surfaces print when the compiler is missing. */
|
|
57
|
+
export const DOC_TYPES_TYPESCRIPT_MISSING_REASON: "TypeScript is not installed in this project, so docs were not checked against the authoring types. On TypeScript 7, add its TypeScript 6 API package (`npm install -D @typescript/typescript6`); otherwise install TypeScript 5.0 through 6 (`npm install -D typescript@6`). Then run this check again.";
|
|
58
|
+
export type DocRoot = "components" | "hooks" | "templates" | "docs" | "docs-overlay" | "themes";
|
|
59
|
+
export type DocFile = {
|
|
60
|
+
/**
|
|
61
|
+
* absolute path to the doc file
|
|
62
|
+
*/
|
|
63
|
+
path: string;
|
|
64
|
+
/**
|
|
65
|
+
* the contribution root it was found in
|
|
66
|
+
*/
|
|
67
|
+
root: DocRoot;
|
|
68
|
+
};
|
|
69
|
+
export type DocTypeProblem = "unknown_field" | "missing_field" | "wrong_type";
|
|
70
|
+
export type DocTypeFinding = {
|
|
71
|
+
/**
|
|
72
|
+
* the doc file, relative to the package root
|
|
73
|
+
*/
|
|
74
|
+
doc: string;
|
|
75
|
+
/**
|
|
76
|
+
* 1-based line of the field (or of the doc value)
|
|
77
|
+
*/
|
|
78
|
+
line: number;
|
|
79
|
+
/**
|
|
80
|
+
* the export checked (`default`, `docs`, `docsZh`, …)
|
|
81
|
+
*/
|
|
82
|
+
export: string;
|
|
83
|
+
/**
|
|
84
|
+
* the authoring type it was checked against
|
|
85
|
+
*/
|
|
86
|
+
type: string;
|
|
87
|
+
/**
|
|
88
|
+
* the field's path in the doc, such as
|
|
89
|
+
* `usage.bestPractices[2].guidance`; empty for the doc value as a whole
|
|
90
|
+
*/
|
|
91
|
+
field: string;
|
|
92
|
+
problem: DocTypeProblem;
|
|
93
|
+
severity: "warning";
|
|
94
|
+
/**
|
|
95
|
+
* what TypeScript reports, shortened
|
|
96
|
+
*/
|
|
97
|
+
message: string;
|
|
98
|
+
/**
|
|
99
|
+
* what to change
|
|
100
|
+
*/
|
|
101
|
+
fix: string;
|
|
102
|
+
};
|
|
103
|
+
export type DocTypesUnchecked = {
|
|
104
|
+
/**
|
|
105
|
+
* the doc file, relative to the package root
|
|
106
|
+
*/
|
|
107
|
+
doc: string;
|
|
108
|
+
/**
|
|
109
|
+
* why it was not checked
|
|
110
|
+
*/
|
|
111
|
+
reason: string;
|
|
112
|
+
};
|
|
113
|
+
export type DocTypesReport = {
|
|
114
|
+
/**
|
|
115
|
+
* `skipped` means nothing was checked,
|
|
116
|
+
* and `reason` says why
|
|
117
|
+
*/
|
|
118
|
+
status: "checked" | "skipped";
|
|
119
|
+
reason?: string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* the version of the compiler that checked
|
|
122
|
+
*/
|
|
123
|
+
typescript?: string | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* how many doc values were checked
|
|
126
|
+
*/
|
|
127
|
+
docs: number;
|
|
128
|
+
findings: DocTypeFinding[];
|
|
129
|
+
/**
|
|
130
|
+
* doc files with nothing to check,
|
|
131
|
+
* or not fully checked
|
|
132
|
+
*/
|
|
133
|
+
unchecked: DocTypesUnchecked[];
|
|
134
|
+
};
|
|
135
|
+
export type Target = {
|
|
136
|
+
exportName: string;
|
|
137
|
+
/**
|
|
138
|
+
* the doc value's expression
|
|
139
|
+
*/
|
|
140
|
+
node: any;
|
|
141
|
+
/**
|
|
142
|
+
* the authoring type, as a type expression
|
|
143
|
+
*/
|
|
144
|
+
typeExpr: string;
|
|
145
|
+
/**
|
|
146
|
+
* how findings name that type
|
|
147
|
+
*/
|
|
148
|
+
typeName: string;
|
|
149
|
+
/**
|
|
150
|
+
* nodes whose leading JSDoc annotations are blanked
|
|
151
|
+
*/
|
|
152
|
+
blank: any[];
|
|
153
|
+
/**
|
|
154
|
+
* source ranges to blank
|
|
155
|
+
*/
|
|
156
|
+
blankRanges: Array<[number, number]>;
|
|
157
|
+
};
|