@astryxdesign/cli 0.6.4-canary.06c8fa3 → 0.6.4-canary.0e1fbdb
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 +49 -40
- package/api/build/build.doc.mjs +6 -1
- package/api/build/build.test.mjs +22 -0
- package/api/build/kit/kit.mjs +44 -5
- package/api/component/component.doc.mjs +14 -7
- package/api/docs/_adapter.d.mts +8 -3
- package/api/docs/_adapter.mjs +14 -6
- package/api/docs/docOverlays.test.mjs +27 -1
- package/api/docs/docs.doc.mjs +2 -2
- package/api/doctor/doctor.doc.mjs +17 -8
- package/api/doctor/doctor.type.d.mts +1 -1
- package/api/doctor/doctor.type.mjs +1 -1
- package/api/gap-report/gap-report.doc.mjs +19 -10
- package/api/hook/hook.doc.mjs +6 -3
- package/api/index.d.mts +2 -0
- package/api/index.mjs +3 -1
- package/api/init/init.doc.mjs +17 -12
- package/api/integration/add-theme.mjs +22 -1
- package/api/integration/add-theme.test.mjs +34 -0
- package/api/integration/authoring-checks.mjs +2 -2
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/pack-check.lifecycle-output.test.mjs +2 -0
- package/api/integration/pack-check.mjs +54 -6
- package/api/integration/pack-check.test.mjs +90 -0
- package/api/integration/pack-check.type.mjs +1 -1
- package/api/json/assertResponse.doc.mjs +1 -1
- package/api/json/index.ts +1 -0
- package/api/json/isError.doc.mjs +1 -1
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/search/search.d.mts +27 -1
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +228 -16
- package/api/swizzle/swizzle.doc.mjs +7 -5
- package/api/template/copy/copy.mjs +1 -1
- package/api/template/copy/copy.test.mjs +9 -0
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.doc.mjs +2 -1
- package/api/template/template.mjs +1 -1
- package/api/theme/generateTonalPalette.doc.mjs +1 -2
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +9 -10
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +2 -1
- package/api/theme/themePaletteGenerate.doc.mjs +15 -8
- package/api/theme/themeTargets.doc.mjs +3 -2
- package/api/theme/themeTemplate.doc.mjs +2 -1
- package/api/upgrade/run/run.mjs +1 -1
- package/api/upgrade/upgrade.doc.mjs +24 -22
- package/assets/docs/README.md +4 -2
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +8 -2
- package/assets/docs/elevation.doc.mjs +6 -4
- package/assets/docs/getting-started.doc.mjs +5 -16
- package/assets/docs/icons.doc.mjs +2 -21
- package/assets/docs/illustrations.doc.mjs +7 -15
- package/assets/docs/layout.doc.dense.mjs +130 -82
- package/assets/docs/layout.doc.mjs +133 -77
- package/assets/docs/migration.doc.mjs +19 -21
- package/assets/docs/motion.doc.mjs +16 -3
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +8 -0
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +8 -3
- package/assets/docs/spacing.doc.mjs +7 -2
- package/assets/docs/styling-libraries.doc.mjs +6 -2
- package/assets/docs/styling.doc.mjs +19 -23
- package/assets/docs/theme.doc.dense.mjs +58 -18
- package/assets/docs/theme.doc.mjs +56 -46
- package/assets/docs/theme.doc.zh.mjs +9 -8
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +389 -8
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/add-a-component.doc.mjs +75 -0
- package/assets/docs/tree/add-a-theme.doc.mjs +85 -0
- package/assets/docs/tree/add-a-topic.doc.mjs +144 -0
- package/assets/docs/tree/agent-guidance.doc.mjs +138 -0
- package/assets/docs/tree/block-template.doc.mjs +130 -0
- package/assets/docs/tree/build-the-template.doc.mjs +28 -0
- package/assets/docs/tree/building-blocks.doc.mjs +46 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +137 -0
- package/assets/docs/tree/checks.doc.mjs +119 -0
- package/assets/docs/tree/codemods.doc.mjs +147 -0
- package/assets/docs/tree/component-family.doc.mjs +113 -0
- package/assets/docs/tree/component-imports.doc.mjs +69 -0
- package/assets/docs/tree/components.doc.mjs +23 -0
- package/assets/docs/tree/configuration.doc.mjs +23 -0
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +182 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +118 -0
- package/assets/docs/tree/describe-the-component.doc.mjs +57 -0
- package/assets/docs/tree/docs.doc.mjs +21 -0
- package/assets/docs/tree/document-the-template.doc.mjs +28 -0
- package/assets/docs/tree/document-the-theme.doc.mjs +68 -0
- package/assets/docs/tree/export-template-assets.doc.mjs +147 -0
- package/assets/docs/tree/extend-or-replace.doc.mjs +103 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +106 -0
- package/assets/docs/tree/generate-a-palette.doc.mjs +66 -0
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +105 -0
- package/assets/docs/tree/help.doc.mjs +16 -0
- package/assets/docs/tree/integrations.doc.mjs +25 -470
- package/assets/docs/tree/links.doc.mjs +98 -0
- package/assets/docs/tree/package-and-test.doc.mjs +32 -0
- package/assets/docs/tree/page-template.doc.mjs +71 -0
- package/assets/docs/tree/publishing.doc.mjs +111 -0
- package/assets/docs/tree/quick-start.doc.mjs +272 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +104 -0
- package/assets/docs/tree/replace-a-core-template.doc.mjs +172 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +108 -0
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +59 -0
- package/assets/docs/tree/ship.doc.mjs +16 -0
- package/assets/docs/tree/short-and-findable.doc.mjs +108 -0
- package/assets/docs/tree/single-component.doc.mjs +165 -0
- package/assets/docs/tree/start-a-template.doc.mjs +143 -0
- package/assets/docs/tree/subcomponent.doc.mjs +115 -0
- package/assets/docs/tree/template-assets.doc.mjs +64 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +109 -0
- package/assets/docs/tree/template-fonts.doc.mjs +102 -0
- package/assets/docs/tree/template-grading-rubric.doc.mjs +452 -0
- package/assets/docs/tree/template-icons.doc.mjs +97 -0
- package/assets/docs/tree/template-images-media.doc.mjs +127 -0
- package/assets/docs/tree/template-styles.doc.mjs +93 -0
- package/assets/docs/tree/templates.doc.mjs +34 -0
- package/assets/docs/tree/test-in-an-app.doc.mjs +115 -0
- package/assets/docs/tree/test-template-in-app.doc.mjs +128 -0
- package/assets/docs/tree/themes.doc.mjs +39 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +149 -0
- package/assets/docs/tree/upgrading.doc.mjs +103 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +51 -0
- package/assets/docs/tree/verify-packed-template.doc.mjs +77 -0
- package/assets/docs/tree/versioning.doc.mjs +161 -0
- package/assets/docs/tree/write-good-templates.doc.mjs +64 -0
- package/assets/docs/tree/write-the-template-file.doc.mjs +154 -0
- package/assets/docs/typography.doc.mjs +24 -4
- package/assets/docs/working-with-ai.doc.mjs +30 -22
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/type.ts +2 -2
- package/authoring/doctypes/_schema.d.mts +3 -2
- package/authoring/doctypes/_schema.mjs +6 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +4 -2
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/component.doc.mjs +6 -0
- package/authoring/doctypes/component/type.ts +8 -0
- package/authoring/doctypes/reference/reference.doc.mjs +7 -0
- package/authoring/doctypes/reference/type.ts +5 -0
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +2 -2
- package/authoring/integration/integration.doc.mjs +12 -10
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component.doc.mjs +4 -3
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +60 -17
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -2
- package/clients/cli/commands/doctor-integration.test.mjs +53 -0
- package/clients/cli/commands/doctor.doc.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +49 -5
- package/clients/cli/commands/gap-report.doc.mjs +10 -9
- package/clients/cli/commands/init.doc.mjs +9 -6
- package/clients/cli/commands/integration-add.doc.mjs +9 -9
- package/clients/cli/commands/integration-authoring.test.mjs +61 -10
- package/clients/cli/commands/integration-pack.doc.mjs +5 -9
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration-verify.doc.mjs +22 -0
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +74 -43
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +10 -3
- package/clients/cli/commands/search.mjs +21 -2
- package/clients/cli/commands/search.test.mjs +21 -4
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/text-json-parity.test.mjs +24 -1
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
- package/clients/cli/commands/theme-palette.doc.mjs +1 -2
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +2 -1
- package/clients/cli/commands/upgrade.doc.mjs +62 -3
- package/clients/cli/index.mjs +32 -6
- package/clients/cli/lib/define-command.mjs +28 -4
- package/clients/cli/lib/define-command.test.mjs +54 -0
- package/clients/cli/lib/exit-codes.test.mjs +25 -2
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +23 -5
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/discovery/authoring-self-docs.test.mjs +6 -2
- package/foundation/discovery/cli-self-docs.mjs +16 -2
- package/foundation/discovery/cli-self-docs.test.mjs +20 -0
- package/foundation/discovery/docs-discovery.mjs +5 -1
- package/foundation/discovery/docs-discovery.test.mjs +21 -0
- package/foundation/discovery/docs-section-key.d.mts +1 -1
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -2
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/tree.d.mts +4 -0
- package/foundation/doc-compiler/tree.mjs +6 -1
- package/foundation/integrations/cli-requirement.d.mts +26 -6
- package/foundation/integrations/cli-requirement.mjs +46 -11
- package/foundation/integrations/cli-requirement.test.mjs +7 -2
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/response/error-codes.doc.mjs +6 -8
- package/foundation/response/error-codes.test.mjs +30 -5
- package/foundation/response/response-types.doc.d.mts +4 -3
- package/foundation/response/response-types.doc.mjs +42 -6
- package/foundation/response/response.doc.mjs +11 -10
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
- package/api/docs/docs.test.mjs +0 -245
- package/api/docs/integration-tree.test.mjs +0 -555
- package/api/docs/integrationDocs.test.mjs +0 -314
- package/api/search/search.test.mjs +0 -530
- package/assets/docs/tree/integrations.test.mjs +0 -62
- package/assets/docs/tree/writing-docs.doc.mjs +0 -286
- package/clients/cli/commands/docs.test.mjs +0 -323
- package/foundation/agent-docs/agent-docs.test.mjs +0 -1159
- package/foundation/doc-compiler/tree.test.mjs +0 -606
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* open one section by its key, and `--full` prints the whole topic. `--json`
|
|
8
8
|
* keeps the docs() contract: a topic returns its whole doc, and `--index` its
|
|
9
9
|
* sections.
|
|
10
|
-
* Supports --detail (full|compact|brief) and --lang (en|zh|dense).
|
|
10
|
+
* Supports --detail (full|compact|brief) and --lang (en|zh|dense). A code
|
|
11
|
+
* block's label prints above its fence, and table cells escape their pipes.
|
|
11
12
|
*
|
|
12
13
|
* Usage:
|
|
13
14
|
* astryx docs List available topics
|
|
@@ -42,21 +43,35 @@ import {doc as docsFn} from '../../../api/docs/docs.doc.mjs';
|
|
|
42
43
|
|
|
43
44
|
// ─── Formatting ──────────────────────────────────────────────────────────────
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* A table cell with its pipes escaped. Columns are separated by ` | `, and a
|
|
48
|
+
* union type such as `'light' | 'dark'` is spelled with the same character,
|
|
49
|
+
* so an unescaped cell reads as extra columns. `astryx component` escapes its
|
|
50
|
+
* prop tables the same way.
|
|
51
|
+
* @param {string | undefined} cell
|
|
52
|
+
* @returns {string}
|
|
53
|
+
*/
|
|
54
|
+
function tableCell(cell) {
|
|
55
|
+
return (cell || '').replaceAll('|', '\\|');
|
|
56
|
+
}
|
|
57
|
+
|
|
45
58
|
/**
|
|
46
59
|
* @param {string[]} headers
|
|
47
60
|
* @param {string[][]} rows
|
|
48
61
|
* @returns {string}
|
|
49
62
|
*/
|
|
50
63
|
function formatTable(headers, rows) {
|
|
51
|
-
const
|
|
52
|
-
|
|
64
|
+
const head = headers.map(tableCell);
|
|
65
|
+
const cells = rows.map(r => r.map(tableCell));
|
|
66
|
+
const widths = head.map((h, i) =>
|
|
67
|
+
Math.max(h.length, ...cells.map(r => (r[i] || '').length)),
|
|
53
68
|
);
|
|
54
69
|
const sep = widths.map(w => '-'.repeat(w)).join(' | ');
|
|
55
|
-
const
|
|
56
|
-
const body =
|
|
57
|
-
.map(r => r.map((c, i) =>
|
|
70
|
+
const top = head.map((h, i) => h.padEnd(widths[i])).join(' | ');
|
|
71
|
+
const body = cells
|
|
72
|
+
.map(r => r.map((c, i) => c.padEnd(widths[i])).join(' | '))
|
|
58
73
|
.join('\n');
|
|
59
|
-
return `${
|
|
74
|
+
return `${top}\n${sep}\n${body}`;
|
|
60
75
|
}
|
|
61
76
|
|
|
62
77
|
/**
|
|
@@ -65,15 +80,19 @@ function formatTable(headers, rows) {
|
|
|
65
80
|
* @returns {string}
|
|
66
81
|
*/
|
|
67
82
|
function formatTableCompact(headers, rows) {
|
|
68
|
-
|
|
83
|
+
// An empty cell, such as a Default with none, adds nothing to the line.
|
|
84
|
+
return rows
|
|
85
|
+
.map(r => r.filter(cell => String(cell ?? '').trim() !== '').join(' = '))
|
|
86
|
+
.join('\n');
|
|
69
87
|
}
|
|
70
88
|
|
|
71
89
|
/**
|
|
90
|
+
* One content block as text. Exported for its tests.
|
|
72
91
|
* @param {import('@astryxdesign/cli/authoring').ReferenceContentBlock} block
|
|
73
92
|
* @param {'full' | 'compact' | 'brief'} detail
|
|
74
93
|
* @returns {string | null}
|
|
75
94
|
*/
|
|
76
|
-
function formatBlock(block, detail) {
|
|
95
|
+
export function formatBlock(block, detail) {
|
|
77
96
|
switch (block.type) {
|
|
78
97
|
case 'prose':
|
|
79
98
|
return block.text;
|
|
@@ -84,13 +103,20 @@ function formatBlock(block, detail) {
|
|
|
84
103
|
case 'code':
|
|
85
104
|
if (detail === 'compact' || detail === 'brief') return null;
|
|
86
105
|
{
|
|
87
|
-
|
|
88
|
-
|
|
106
|
+
// The label names the block, so it prints above the fence, not
|
|
107
|
+
// inside it: `// label` is not a comment in bash, CSS, JSON, or
|
|
108
|
+
// HTML, and a reader who copies the block would copy it too.
|
|
109
|
+
const label = block.label
|
|
110
|
+
? `${block.label.replace(/:\s*$/, '')}:\n`
|
|
111
|
+
: '';
|
|
112
|
+
return `${label}\`\`\`${block.lang}\n${block.code}\n\`\`\``;
|
|
89
113
|
}
|
|
90
114
|
|
|
91
115
|
case 'table':
|
|
92
116
|
if (detail === 'brief') {
|
|
93
|
-
return block.rows
|
|
117
|
+
return block.rows
|
|
118
|
+
.map(r => r.slice(0, 2).map(tableCell).join('='))
|
|
119
|
+
.join(' | ');
|
|
94
120
|
}
|
|
95
121
|
if (detail === 'compact') {
|
|
96
122
|
return formatTableCompact(block.headers, block.rows);
|
|
@@ -202,16 +228,23 @@ function emitIndex(index, run) {
|
|
|
202
228
|
}
|
|
203
229
|
|
|
204
230
|
/**
|
|
205
|
-
* One child row of a namespace
|
|
206
|
-
*
|
|
231
|
+
* One child row of a namespace. Namespace and guide route names are already
|
|
232
|
+
* readable, so repeating their titles adds noise (`start-a-template Start a
|
|
233
|
+
* template`). Typed docs keep a distinct title when it carries the real symbol
|
|
234
|
+
* name (`assert-response assertResponse()`).
|
|
207
235
|
* @param {import('../../../api/docs/docs.type.mjs').DocsNodeChild} child
|
|
208
236
|
* @returns {{name: string, summary: string}}
|
|
209
237
|
*/
|
|
210
238
|
function childRow(child) {
|
|
239
|
+
const titleAddsIdentity =
|
|
240
|
+
child.kind !== 'namespace' &&
|
|
241
|
+
child.kind !== 'generic' &&
|
|
242
|
+
child.title !== child.name;
|
|
211
243
|
return {
|
|
212
244
|
name: child.name,
|
|
213
|
-
summary:
|
|
214
|
-
|
|
245
|
+
summary: titleAddsIdentity
|
|
246
|
+
? `${child.title}: ${child.summary}`
|
|
247
|
+
: child.summary,
|
|
215
248
|
};
|
|
216
249
|
}
|
|
217
250
|
|
|
@@ -227,6 +260,17 @@ function emitNode(node, detail, run) {
|
|
|
227
260
|
if (node.kind === 'namespace') {
|
|
228
261
|
emit(
|
|
229
262
|
section(node.title, wrapText(node.summary)),
|
|
263
|
+
// A namespace may author intro `blocks`; they render above its children.
|
|
264
|
+
...(node.content?.length
|
|
265
|
+
? [
|
|
266
|
+
text(
|
|
267
|
+
node.content
|
|
268
|
+
.map(b => formatBlock(b, detail))
|
|
269
|
+
.filter(Boolean)
|
|
270
|
+
.join('\n\n'),
|
|
271
|
+
),
|
|
272
|
+
]
|
|
273
|
+
: []),
|
|
230
274
|
...node.slots.flatMap(slot => [
|
|
231
275
|
// A namespace with one slot titled like itself needs no second heading.
|
|
232
276
|
...(node.slots.length === 1 && slot.title === node.title
|
|
@@ -235,7 +279,6 @@ function emitNode(node, detail, run) {
|
|
|
235
279
|
records(slot.children.map(childRow), {
|
|
236
280
|
fields: ['name', 'summary'],
|
|
237
281
|
layout: 'inline',
|
|
238
|
-
overflow: 'truncate',
|
|
239
282
|
}),
|
|
240
283
|
]),
|
|
241
284
|
text(
|
|
@@ -10,9 +10,10 @@ export const doc = {
|
|
|
10
10
|
namespace: 'cli/commands',
|
|
11
11
|
summary: 'Check an integration\'s docs: the docs tree they add, every link, and overlaps with Core topics',
|
|
12
12
|
description:
|
|
13
|
-
'
|
|
13
|
+
'Checks the docs tree the package adds, every link in its docs, and overlaps with Core topics. ' +
|
|
14
|
+
'Intentional replacements and extensions are information. ' +
|
|
14
15
|
'A same-name topic without `replaces` or `extends` is an accidental conflict ' +
|
|
15
|
-
'and fails until the author declares the relationship or renames it.',
|
|
16
|
+
'and fails until the author declares the relationship or renames it. See {@link generic:check-your-docs}.',
|
|
16
17
|
fn: 'integrationDocConflicts',
|
|
17
18
|
args: [
|
|
18
19
|
{
|
|
@@ -13,6 +13,7 @@ vi.mock('../../../foundation/discovery/template-conflict-release.mjs', () => ({
|
|
|
13
13
|
expandedTemplateConflictSchemaActive: () => true,
|
|
14
14
|
}));
|
|
15
15
|
import * as fs from 'node:fs';
|
|
16
|
+
import * as os from 'node:os';
|
|
16
17
|
import * as path from 'node:path';
|
|
17
18
|
import {Command} from 'commander';
|
|
18
19
|
import {discoverCoreTemplates} from '../../../foundation/discovery/template-adapter.mjs';
|
|
@@ -344,6 +345,35 @@ describe('doctor integration — command', () => {
|
|
|
344
345
|
expect(process.exitCode).toBe(1);
|
|
345
346
|
});
|
|
346
347
|
|
|
348
|
+
it('components exits 1 when Core is missing, with no [ok] after the failure', async () => {
|
|
349
|
+
// Outside the repo, so nothing above the package resolves Core.
|
|
350
|
+
const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-no-core-'));
|
|
351
|
+
const previousTmp = tmpDir;
|
|
352
|
+
tmpDir = outside;
|
|
353
|
+
try {
|
|
354
|
+
writeComponentIntegration('AcmeCarousel');
|
|
355
|
+
expect(findCoreDir(outside)).toBeNull();
|
|
356
|
+
process.chdir(outside);
|
|
357
|
+
|
|
358
|
+
await createProgram().parseAsync([
|
|
359
|
+
'node',
|
|
360
|
+
'astryx',
|
|
361
|
+
'doctor',
|
|
362
|
+
'integration',
|
|
363
|
+
'components',
|
|
364
|
+
]);
|
|
365
|
+
|
|
366
|
+
const printed = logCalls.join('\n');
|
|
367
|
+
expect(printed).toContain('core_not_found');
|
|
368
|
+
expect(printed).not.toContain('[ok]');
|
|
369
|
+
expect(process.exitCode).toBe(1);
|
|
370
|
+
} finally {
|
|
371
|
+
tmpDir = previousTmp;
|
|
372
|
+
process.chdir(previousCwd);
|
|
373
|
+
fs.rmSync(outside, {recursive: true, force: true});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
|
|
347
377
|
it('components warns with the exact package-qualified command', async () => {
|
|
348
378
|
const coreDir = findCoreDir(tmpDir);
|
|
349
379
|
expect(coreDir).not.toBeNull();
|
|
@@ -433,6 +463,29 @@ describe('doctor integration — command', () => {
|
|
|
433
463
|
expect(process.exitCode).toBeUndefined();
|
|
434
464
|
});
|
|
435
465
|
|
|
466
|
+
it('docs exits 1 for a placement that hides a guide, with no [ok] after the failure', async () => {
|
|
467
|
+
writeDocIntegration({name: 'deploying'});
|
|
468
|
+
fs.writeFileSync(
|
|
469
|
+
path.join(tmpDir, 'docs', 'deploying.doc.mjs'),
|
|
470
|
+
"export default {type: 'generic', name: 'deploying', title: 'Deploying', description: 'Deploy.', placement: {parent: 'namespace:nope', slot: 'guides'}, sections: [{title: 'Deploy', content: [{type: 'prose', text: 'Deploy.'}]}]};\n",
|
|
471
|
+
);
|
|
472
|
+
process.chdir(tmpDir);
|
|
473
|
+
|
|
474
|
+
await createProgram().parseAsync([
|
|
475
|
+
'node',
|
|
476
|
+
'astryx',
|
|
477
|
+
'doctor',
|
|
478
|
+
'integration',
|
|
479
|
+
'docs',
|
|
480
|
+
]);
|
|
481
|
+
|
|
482
|
+
const printed = logCalls.join('\n');
|
|
483
|
+
expect(printed).toContain('[fail]');
|
|
484
|
+
expect(printed).toContain('invalid_doc_graph');
|
|
485
|
+
expect(printed).not.toContain('[ok]');
|
|
486
|
+
expect(process.exitCode).toBe(1);
|
|
487
|
+
});
|
|
488
|
+
|
|
436
489
|
it('docs exits 1 for an accidental same-name Core topic', async () => {
|
|
437
490
|
const [coreTopic] = Object.keys(discoverBuiltinTopics());
|
|
438
491
|
writeDocIntegration({name: coreTopic});
|
|
@@ -16,7 +16,9 @@ export const doc = {
|
|
|
16
16
|
summary: 'Diagnose Astryx projects and integration packages',
|
|
17
17
|
description:
|
|
18
18
|
'Runs read-only project health diagnostics by default: Node version, @astryxdesign/core ' +
|
|
19
|
-
'install and version alignment, themes, config,
|
|
19
|
+
'install and version alignment, themes, config, integrations (linked without a config entry, ' +
|
|
20
|
+
'provider identity, contribution issues), agent docs, core peer dependencies, package manager, ' +
|
|
21
|
+
"and the docs the CLI reads. It writes nothing, but loading astryx.config runs that file's code. " +
|
|
20
22
|
'The `integration` subcommands provide authoring checks for one integration package.',
|
|
21
23
|
fn: 'doctor',
|
|
22
24
|
subcommands: ['integration'],
|
|
@@ -36,6 +36,8 @@ import {doc as integrationTemplateConflictsFn} from '../../../api/integration/in
|
|
|
36
36
|
import {doc as integrationComponentConflictsFn} from '../../../api/integration/integrationComponentConflicts.doc.mjs';
|
|
37
37
|
import {doc as integrationDocConflictsFn} from '../../../api/integration/integrationDocConflicts.doc.mjs';
|
|
38
38
|
import {NO_RESULT_SET} from '../../../foundation/debug/index.mjs';
|
|
39
|
+
import {cliError} from '../lib/cli-error.mjs';
|
|
40
|
+
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
39
41
|
|
|
40
42
|
const STATUS = {
|
|
41
43
|
pass: '[ok]',
|
|
@@ -181,8 +183,10 @@ function printComponentConflicts(data) {
|
|
|
181
183
|
),
|
|
182
184
|
...issueBlocks(data.issues),
|
|
183
185
|
];
|
|
186
|
+
// An [ok] after a failed check reads as a pass: say nothing it could not check.
|
|
187
|
+
const failed = data.issues.some(issue => issue.severity === 'error');
|
|
184
188
|
if (data.conflicts.length === 0) {
|
|
185
|
-
output.push(text('[ok] No component names conflict with Core.'));
|
|
189
|
+
if (!failed) output.push(text('[ok] No component names conflict with Core.'));
|
|
186
190
|
} else {
|
|
187
191
|
output.push(
|
|
188
192
|
records(data.conflicts, {
|
|
@@ -224,7 +228,9 @@ function printDocConflicts(data) {
|
|
|
224
228
|
);
|
|
225
229
|
}
|
|
226
230
|
if (data.findings.length === 0) {
|
|
227
|
-
|
|
231
|
+
if (!data.issues.some(issue => issue.severity === 'error')) {
|
|
232
|
+
output.push(text('[ok] No doc topics overlap with Core.'));
|
|
233
|
+
}
|
|
228
234
|
} else {
|
|
229
235
|
output.push(
|
|
230
236
|
records(data.findings, {
|
|
@@ -315,19 +321,57 @@ async function runAuthoringCheck(program, pkg, kind) {
|
|
|
315
321
|
return NO_RESULT_SET;
|
|
316
322
|
}
|
|
317
323
|
|
|
324
|
+
/**
|
|
325
|
+
* The first word after a command group, which names a subcommand it does not
|
|
326
|
+
* have, or null.
|
|
327
|
+
* @param {import('commander').Command | undefined} invoked
|
|
328
|
+
* @returns {string | null}
|
|
329
|
+
*/
|
|
330
|
+
function unknownWord(invoked) {
|
|
331
|
+
const word = (invoked?.args ?? []).find(arg => !String(arg).startsWith('-'));
|
|
332
|
+
return word == null ? null : String(word);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Report an unknown subcommand, in text as in JSON, with the ones the group has.
|
|
337
|
+
* @param {import('commander').Command} group
|
|
338
|
+
* @param {string} label the group's full name
|
|
339
|
+
* @param {string} word
|
|
340
|
+
*/
|
|
341
|
+
function unknownSubcommand(group, label, word) {
|
|
342
|
+
return cliError(`unknown subcommand '${label} ${word}'`, {
|
|
343
|
+
suggestions: group.commands.map(child => ({
|
|
344
|
+
name: child.name(),
|
|
345
|
+
reason: 'available subcommand',
|
|
346
|
+
})),
|
|
347
|
+
code: ERROR_CODES.ERR_UNKNOWN_SUBCOMMAND,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
318
351
|
/**
|
|
319
352
|
* Register `astryx doctor` and its integration-authoring leaves.
|
|
320
353
|
* @param {import('commander').Command} program
|
|
321
354
|
*/
|
|
322
355
|
export function registerDoctor(program) {
|
|
323
|
-
|
|
356
|
+
/** @type {import('commander').Command} */
|
|
357
|
+
let doctorCmd;
|
|
358
|
+
doctorCmd = defineCommand(program, doctorCommand, {
|
|
324
359
|
fn: doctorFn,
|
|
325
|
-
|
|
360
|
+
// `doctor integrations` is a mistyped subcommand, not a project check.
|
|
361
|
+
action: async (options, invoked) => {
|
|
362
|
+
const word = unknownWord(invoked);
|
|
363
|
+
if (word != null) return unknownSubcommand(doctorCmd, 'doctor', word);
|
|
364
|
+
return runProjectDoctor(program);
|
|
365
|
+
},
|
|
326
366
|
});
|
|
327
367
|
/** @type {import('commander').Command} */
|
|
328
368
|
let integrationCmd;
|
|
329
369
|
integrationCmd = defineCommand(doctorCmd, doctorIntegrationGroup, {
|
|
330
|
-
action: () => {
|
|
370
|
+
action: (options, invoked) => {
|
|
371
|
+
const word = unknownWord(invoked);
|
|
372
|
+
if (word != null) {
|
|
373
|
+
return unknownSubcommand(integrationCmd, 'doctor integration', word);
|
|
374
|
+
}
|
|
331
375
|
integrationCmd.outputHelp();
|
|
332
376
|
return NO_RESULT_SET;
|
|
333
377
|
},
|
|
@@ -11,9 +11,12 @@ export const doc = {
|
|
|
11
11
|
name: 'gap-report',
|
|
12
12
|
displayName: 'astryx gap-report',
|
|
13
13
|
namespace: 'cli/commands',
|
|
14
|
-
summary: '
|
|
14
|
+
summary: 'Report a missing component or feature to the package that owns it',
|
|
15
15
|
description:
|
|
16
|
-
'Reports a missing component, variant, layout, styling, accessibility, API, or documentation capability
|
|
16
|
+
'Reports a missing component, variant, layout, styling, accessibility, API, or documentation capability to the package that owns it: the --package you name, else the one package that provides the component, else Core. ' +
|
|
17
|
+
'Every configured handler receives the report: the project config handler first, then each integration handler in config order. Public handlers run only with --confirm-public; internal handlers always run. A failing handler does not stop the others. ' +
|
|
18
|
+
"With no handler it files a GitHub issue for the owning package, only with --confirm-public (without it nothing is sent), or returns the package's issues URL when that is not on GitHub. " +
|
|
19
|
+
'The report records whether an agent or a person ran it.',
|
|
17
20
|
fn: 'gapReport',
|
|
18
21
|
args: [
|
|
19
22
|
{
|
|
@@ -45,12 +48,14 @@ export const doc = {
|
|
|
45
48
|
{
|
|
46
49
|
flag: '--package <pkg>',
|
|
47
50
|
param: 'options.package',
|
|
48
|
-
description:
|
|
51
|
+
description:
|
|
52
|
+
'Package that owns the gap: @astryxdesign/core or a loaded integration. Overrides automatic routing; needed when more than one package provides the component',
|
|
49
53
|
},
|
|
50
54
|
{
|
|
51
55
|
flag: '--confirm-public',
|
|
52
56
|
param: 'options.confirmPublic',
|
|
53
|
-
description:
|
|
57
|
+
description:
|
|
58
|
+
'Allow public delivery: public handlers run, and with no handler it files a GitHub issue with your gh login',
|
|
54
59
|
},
|
|
55
60
|
{
|
|
56
61
|
flag: '--list-categories',
|
|
@@ -62,13 +67,9 @@ export const doc = {
|
|
|
62
67
|
examples: [
|
|
63
68
|
{label: 'List categories', cli: 'astryx gap-report --list-categories'},
|
|
64
69
|
{
|
|
65
|
-
label: '
|
|
70
|
+
label: 'Prepare a report (nothing public happens without --confirm-public)',
|
|
66
71
|
cli: "astryx gap-report Button --category missing_variant --reason 'Need a compact size'",
|
|
67
72
|
},
|
|
68
|
-
{
|
|
69
|
-
label: 'Confirm public filing',
|
|
70
|
-
cli: "astryx gap-report Button --category docs_gap --reason 'Missing keyboard example' --confirm-public",
|
|
71
|
-
},
|
|
72
73
|
],
|
|
73
74
|
exitCodes: [
|
|
74
75
|
{
|
|
@@ -18,21 +18,22 @@ export const doc = {
|
|
|
18
18
|
'Non-interactive project setup (no prompts, so it behaves the same for humans, ' +
|
|
19
19
|
'agents, and CI). By default it installs the AGENTS.md/CLAUDE.md agent-docs, ' +
|
|
20
20
|
'including guidance from configured integrations, and prints getting-started ' +
|
|
21
|
-
|
|
22
|
-
'
|
|
21
|
+
"steps. --features and --all print only the chosen features' guidance (no " +
|
|
22
|
+
'getting-started steps); the theme feature also writes an annotated theme template.',
|
|
23
23
|
fn: 'init',
|
|
24
24
|
options: [
|
|
25
25
|
{
|
|
26
26
|
flag: '--features <list>',
|
|
27
27
|
param: 'options.features',
|
|
28
28
|
description:
|
|
29
|
-
'Comma-separated features
|
|
30
|
-
'Ignored with --all or --remove-agents',
|
|
29
|
+
'Comma-separated features: agents (agent docs), theme (writes theme.template.ts), template (prints the page-building commands; writes no file). ' +
|
|
30
|
+
'An unknown feature exits 1 with ERR_UNKNOWN_FEATURE. Ignored with --all or --remove-agents',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
flag: '--all',
|
|
34
34
|
param: 'options.all',
|
|
35
|
-
description:
|
|
35
|
+
description:
|
|
36
|
+
'Install all features (agents, theme, template); overrides --features. Prints their guidance instead of the getting-started steps',
|
|
36
37
|
},
|
|
37
38
|
{
|
|
38
39
|
flag: '--remove-agents',
|
|
@@ -47,7 +48,9 @@ export const doc = {
|
|
|
47
48
|
param: 'options.agent',
|
|
48
49
|
choices: ['claude', 'cursor', 'codex', 'hermes', 'muse', 'all'],
|
|
49
50
|
description:
|
|
50
|
-
'Target AI tool for agent docs: claude
|
|
51
|
+
'Target AI tool for agent docs: claude (CLAUDE.md or .claude/CLAUDE.md, else creates .claude/CLAUDE.md), cursor (.cursorrules if present, else AGENTS.md), ' +
|
|
52
|
+
'codex and muse (AGENTS.md), hermes (.hermes.md or HERMES.md if present, else AGENTS.md), all (every existing agent doc, else AGENTS.md and .claude/CLAUDE.md). ' +
|
|
53
|
+
'An unknown tool exits 1 with ERR_UNKNOWN_AGENT. ' +
|
|
51
54
|
'Used only when agent docs are installed (the default, --all, or --features agents); --agent-docs-path takes precedence',
|
|
52
55
|
},
|
|
53
56
|
{
|
|
@@ -8,7 +8,7 @@ export const doc = {
|
|
|
8
8
|
namespace: 'cli/commands',
|
|
9
9
|
summary: 'Add one working contribution to an integration package',
|
|
10
10
|
description:
|
|
11
|
-
'Writes the
|
|
11
|
+
'Writes the files one contribution needs, creates the integration manifest on first use, and declares a root only after a contribution the CLI can read exists behind it. A component or template import also needs an `exports` entry: add writes one only when package.json already has an `exports` map, so start a new package with `"exports": {}`. See {@link generic:quick-start}.',
|
|
12
12
|
fn: 'integrationAdd',
|
|
13
13
|
args: [
|
|
14
14
|
{
|
|
@@ -60,10 +60,14 @@ export const doc = {
|
|
|
60
60
|
flag: '--to <version>',
|
|
61
61
|
param: 'options.to',
|
|
62
62
|
description:
|
|
63
|
-
'Exact semver the
|
|
63
|
+
'Exact semver of the @astryxdesign/core version whose upgrade runs the codemod (e.g. 0.7.0); required for codemod and only valid there',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
66
|
examples: [
|
|
67
|
+
{
|
|
68
|
+
label: 'Preview',
|
|
69
|
+
cli: 'astryx integration add component AcmeWidget --dry-run --json',
|
|
70
|
+
},
|
|
67
71
|
{
|
|
68
72
|
label: 'Add a component',
|
|
69
73
|
cli: 'astryx integration add component AcmeWidget',
|
|
@@ -71,7 +75,7 @@ export const doc = {
|
|
|
71
75
|
{label: 'Add a doc topic', cli: 'astryx integration add doc deploying'},
|
|
72
76
|
{
|
|
73
77
|
label: 'Add a page template',
|
|
74
|
-
cli: 'astryx integration add template dashboard',
|
|
78
|
+
cli: 'astryx integration add template acme-dashboard',
|
|
75
79
|
},
|
|
76
80
|
{
|
|
77
81
|
label: 'Add a block template',
|
|
@@ -87,7 +91,7 @@ export const doc = {
|
|
|
87
91
|
},
|
|
88
92
|
{
|
|
89
93
|
label: 'Add a guide to the package\'s own docs section',
|
|
90
|
-
cli: 'astryx integration add doc
|
|
94
|
+
cli: 'astryx integration add doc releasing --parent acme',
|
|
91
95
|
},
|
|
92
96
|
{
|
|
93
97
|
label: 'Add a codemod',
|
|
@@ -98,10 +102,6 @@ export const doc = {
|
|
|
98
102
|
cli: "astryx integration add agent-doc 'Run acme verify before finishing.'",
|
|
99
103
|
},
|
|
100
104
|
{label: 'Add a source theme', cli: 'astryx integration add theme ocean'},
|
|
101
|
-
{
|
|
102
|
-
label: 'Preview',
|
|
103
|
-
cli: 'astryx integration add component AcmeWidget --dry-run --json',
|
|
104
|
-
},
|
|
105
105
|
],
|
|
106
106
|
exitCodes: [
|
|
107
107
|
{code: 0, when: 'the contribution is written or the dry run succeeds'},
|
|
@@ -110,5 +110,5 @@ export const doc = {
|
|
|
110
110
|
when: 'the kind, name, options, package, or target files are invalid or conflict',
|
|
111
111
|
},
|
|
112
112
|
],
|
|
113
|
-
related: ['integration
|
|
113
|
+
related: ['integration verify', 'doctor integration validate', 'theme add'],
|
|
114
114
|
};
|
|
@@ -127,10 +127,7 @@ describe('integration authoring CLI', () => {
|
|
|
127
127
|
);
|
|
128
128
|
expect(added.status).toBe(0);
|
|
129
129
|
|
|
130
|
-
const checked = await runCli(
|
|
131
|
-
['integration', 'pack', '--check', '--json'],
|
|
132
|
-
tmpDir,
|
|
133
|
-
);
|
|
130
|
+
const checked = await runCli(['integration', 'verify', '--json'], tmpDir);
|
|
134
131
|
// Without an exports map, the extensionless import cannot resolve —
|
|
135
132
|
// pack-check must fail, not false-green.
|
|
136
133
|
expect(checked.status).not.toBe(0);
|
|
@@ -150,13 +147,67 @@ describe('integration authoring CLI', () => {
|
|
|
150
147
|
);
|
|
151
148
|
});
|
|
152
149
|
|
|
153
|
-
it('
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
it('keeps `integration pack --check` as a deprecated alias of `integration verify`', async () => {
|
|
151
|
+
// The old spelling runs the same check: the same JSON, the same exit code.
|
|
152
|
+
const verify = await runCli(['integration', 'verify', '--json'], tmpDir);
|
|
153
|
+
const old = await runCli(
|
|
154
|
+
['integration', 'pack', '--check', '--json'],
|
|
155
|
+
tmpDir,
|
|
156
|
+
);
|
|
157
|
+
expect(old.status).toBe(verify.status);
|
|
158
|
+
const verifyEnvelope = parseEnvelope(verify.stdout);
|
|
159
|
+
const oldEnvelope = parseEnvelope(old.stdout);
|
|
160
|
+
expect(oldEnvelope.type).toBe('integration.pack-check');
|
|
161
|
+
expect(oldEnvelope.type).toBe(verifyEnvelope.type);
|
|
162
|
+
expect(oldEnvelope.data.packable).toBe(verifyEnvelope.data.packable);
|
|
163
|
+
expect(oldEnvelope.data.issues).toEqual(verifyEnvelope.data.issues);
|
|
164
|
+
// The global flag may come first, as agents usually write it.
|
|
165
|
+
const lead = await runCli(
|
|
166
|
+
['--json', 'integration', 'pack', '--check'],
|
|
167
|
+
tmpDir,
|
|
168
|
+
);
|
|
169
|
+
expect(parseEnvelope(lead.stdout).type).toBe('integration.pack-check');
|
|
170
|
+
// In text, it says to use the new name, on stderr, so stdout is the same.
|
|
171
|
+
const text = await runCli(['integration', 'pack', '--check'], tmpDir);
|
|
172
|
+
const verifyText = await runCli(['integration', 'verify'], tmpDir);
|
|
173
|
+
expect(text.status).toBe(verifyText.status);
|
|
174
|
+
expect(text.stdout).toBe(verifyText.stdout);
|
|
175
|
+
expect(text.stderr).toContain('`integration pack --check` is deprecated');
|
|
176
|
+
expect(text.stderr).toContain('astryx integration verify');
|
|
177
|
+
// Without --check it fails, as it did, and names both spellings.
|
|
178
|
+
const bare = await runCli(['integration', 'pack'], tmpDir);
|
|
179
|
+
expect(bare.status).not.toBe(0);
|
|
180
|
+
expect(bare.stderr).toContain('--check');
|
|
181
|
+
expect(bare.stderr).toContain('astryx integration verify');
|
|
182
|
+
// Help lists it, marked deprecated: nothing is hidden.
|
|
183
|
+
const help = await runCli(['integration', '--help'], tmpDir);
|
|
184
|
+
expect(help.stdout).toMatch(
|
|
185
|
+
/pack .*Deprecated: the old name of `integration verify`/,
|
|
186
|
+
);
|
|
187
|
+
// `verify` itself takes no --check.
|
|
188
|
+
const flag = await runCli(['integration', 'verify', '--check'], tmpDir);
|
|
189
|
+
expect(flag.status).not.toBe(0);
|
|
190
|
+
expect(flag.stderr).toContain("unknown option '--check'");
|
|
191
|
+
// An unknown subcommand with a flag names the subcommand, in text and JSON.
|
|
192
|
+
const unknown = await runCli(['integration', 'bogus', '--check'], tmpDir);
|
|
193
|
+
expect(unknown.status).not.toBe(0);
|
|
194
|
+
expect(unknown.stderr).toContain("unknown subcommand 'integration bogus'");
|
|
195
|
+
expect(unknown.stderr).toMatch(/verify\s+\(available subcommand\)/);
|
|
196
|
+
const unknownJson = await runCli(
|
|
197
|
+
['integration', 'bogus', '--check', '--json'],
|
|
198
|
+
tmpDir,
|
|
199
|
+
);
|
|
200
|
+
expect(parseEnvelope(unknownJson.stdout)).toMatchObject({
|
|
201
|
+
code: 'ERR_UNKNOWN_SUBCOMMAND',
|
|
202
|
+
error: "unknown subcommand 'integration bogus'",
|
|
203
|
+
suggestions: expect.arrayContaining([
|
|
204
|
+
expect.objectContaining({name: 'verify'}),
|
|
205
|
+
]),
|
|
159
206
|
});
|
|
207
|
+
// A flag alone is an unknown option, not an unknown subcommand.
|
|
208
|
+
const flagOnly = await runCli(['integration', '--bogus'], tmpDir);
|
|
209
|
+
expect(flagOnly.status).not.toBe(0);
|
|
210
|
+
expect(flagOnly.stderr).toContain("unknown option '--bogus'");
|
|
160
211
|
});
|
|
161
212
|
|
|
162
213
|
it('refuses kind-specific options on another kind', async () => {
|
|
@@ -6,22 +6,18 @@ export const doc = {
|
|
|
6
6
|
name: 'integration pack',
|
|
7
7
|
displayName: 'astryx integration pack',
|
|
8
8
|
namespace: 'cli/commands',
|
|
9
|
-
summary: '
|
|
9
|
+
summary: 'Deprecated: the old name of `integration verify`',
|
|
10
10
|
description:
|
|
11
|
-
'
|
|
11
|
+
'`astryx integration pack --check` is the name this check had before {@link command:integration verify}. It still runs the same check, with the same output, JSON, and exit codes, and prints a note that names `integration verify`. It will be removed in a later release.',
|
|
12
12
|
fn: 'integrationPackCheck',
|
|
13
13
|
options: [
|
|
14
14
|
{
|
|
15
15
|
flag: '--check',
|
|
16
|
-
description: 'Run the
|
|
16
|
+
description: 'Run the check. Required, as before.',
|
|
17
17
|
},
|
|
18
18
|
],
|
|
19
19
|
examples: [
|
|
20
|
-
{label: '
|
|
21
|
-
{
|
|
22
|
-
label: 'Machine-readable result',
|
|
23
|
-
cli: 'astryx integration pack --check --json',
|
|
24
|
-
},
|
|
20
|
+
{label: 'The old spelling', cli: 'astryx integration pack --check'},
|
|
25
21
|
],
|
|
26
22
|
exitCodes: [
|
|
27
23
|
{code: 0, when: 'the packed package exposes the same valid contributions'},
|
|
@@ -30,5 +26,5 @@ export const doc = {
|
|
|
30
26
|
when: '--check is omitted or the tarball is incomplete or invalid',
|
|
31
27
|
},
|
|
32
28
|
],
|
|
33
|
-
related: ['integration
|
|
29
|
+
related: ['integration verify'],
|
|
34
30
|
};
|
|
@@ -214,7 +214,7 @@ export const oceanTheme = defineTheme({
|
|
|
214
214
|
]);
|
|
215
215
|
|
|
216
216
|
const checked = await runCli(
|
|
217
|
-
['integration', '
|
|
217
|
+
['integration', 'verify', '--json'],
|
|
218
218
|
providerDir,
|
|
219
219
|
);
|
|
220
220
|
expect(checked.status, checked.stderr).toBe(0);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'command',
|
|
6
|
+
name: 'integration verify',
|
|
7
|
+
displayName: 'astryx integration verify',
|
|
8
|
+
namespace: 'cli/commands',
|
|
9
|
+
summary: 'Check the package the way npm will publish it, before you publish',
|
|
10
|
+
description:
|
|
11
|
+
'Packs the package with npm, unpacks the tarball into a temporary app without installing its dependencies, and checks that the app sees the same components, templates, themes, docs, and codemods as the package, that every public import resolves, and that the package declares a CLI new enough to read it. It publishes nothing and leaves no tarball behind. It runs the package\'s own pack lifecycle scripts, as `npm pack` does.',
|
|
12
|
+
fn: 'integrationPackCheck',
|
|
13
|
+
examples: [
|
|
14
|
+
{label: 'Check before publishing', cli: 'astryx integration verify'},
|
|
15
|
+
{label: 'Machine-readable result', cli: 'astryx integration verify --json'},
|
|
16
|
+
],
|
|
17
|
+
exitCodes: [
|
|
18
|
+
{code: 0, when: 'the packed package exposes the same valid contributions'},
|
|
19
|
+
{code: 1, when: 'the tarball is incomplete or invalid'},
|
|
20
|
+
],
|
|
21
|
+
related: ['integration add', 'doctor integration validate'],
|
|
22
|
+
};
|