@astryxdesign/cli 0.6.3-canary.7ada42e → 0.6.3-canary.7ec7be0
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 +21 -19
- package/api/build/_adapter.d.mts +50 -0
- package/api/build/_adapter.mjs +60 -0
- package/api/build/build.doc.mjs +13 -7
- package/api/build/build.test.mjs +184 -6
- package/api/build/build.type.d.mts +57 -2
- package/api/build/build.type.mjs +30 -7
- package/api/build/help/help.d.mts +4 -0
- package/api/build/help/help.mjs +24 -11
- package/api/build/kit/kit.d.mts +4 -1
- package/api/build/kit/kit.mjs +165 -49
- package/api/build/kit/rank.d.mts +44 -0
- package/api/build/kit/rank.mjs +432 -0
- package/api/build/kit/rank.test.mjs +196 -0
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.mjs +60 -12
- package/api/component/list/list.mjs +3 -2
- package/api/docs/_adapter.d.mts +251 -28
- package/api/docs/_adapter.mjs +918 -35
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +38 -17
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +181 -2
- package/api/docs/docs.type.mjs +117 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +555 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +25 -5
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/docs/reference-blocks.test.mjs +406 -0
- package/api/doctor/doctor.d.mts +30 -2
- package/api/doctor/doctor.mjs +151 -8
- package/api/doctor/doctor.test.mjs +95 -7
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +1 -1
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +107 -5
- package/api/integration/add-contribution.test.mjs +137 -0
- package/api/integration/authoring-checks.mjs +138 -28
- package/api/integration/authoring-checks.test.mjs +171 -3
- package/api/integration/authoring-checks.type.mjs +6 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddDoc.doc.mjs +7 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationPackCheck.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +3 -0
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +121 -0
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/template-conflict-compatibility.test.mjs +73 -0
- package/api/integration/validate-integration.test.mjs +3 -3
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/index.ts +2 -0
- package/api/layout/_adapter.mjs +20 -5
- package/api/search/search.d.mts +59 -1
- package/api/search/search.doc.mjs +4 -3
- package/api/search/search.mjs +442 -71
- package/api/search/search.test.mjs +91 -2
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/template/list/list.mjs +1 -0
- package/api/template/table-floating-bulk-actions.test.mjs +66 -0
- package/api/template/template-integration.test.mjs +1072 -3
- package/api/template/template.doc.mjs +27 -7
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- package/api/theme/template/template.test.mjs +5 -0
- package/api/theme/themeTemplate.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/layout.doc.dense.mjs +2 -2
- package/assets/docs/layout.doc.mjs +1 -1
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +3 -3
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +37 -9
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/working-with-ai.doc.mjs +3 -3
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +119 -117
- package/authoring/doctypes/_schema.mjs +54 -3
- package/authoring/doctypes/base/graph-fields.doc.mjs +7 -5
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/load-contract.test.mjs +26 -1
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.mjs +3 -2
- package/authoring/doctypes/reference/reference.doc.mjs +34 -5
- package/authoring/doctypes/reference/type.ts +28 -11
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -1
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +8 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/index.d.ts +1 -0
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.mjs +1 -1
- package/clients/cli/commands/build.doc.mjs +11 -6
- package/clients/cli/commands/build.mjs +105 -67
- package/clients/cli/commands/build.text-fields.test.mjs +41 -0
- package/clients/cli/commands/component/index.mjs +1 -1
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
- package/clients/cli/commands/discover.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +20 -8
- package/clients/cli/commands/docs.mjs +183 -69
- package/clients/cli/commands/docs.test.mjs +120 -16
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -2
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +14 -7
- package/clients/cli/commands/doctor-integration.test.mjs +75 -1
- package/clients/cli/commands/doctor.mjs +53 -16
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/search.mjs +11 -2
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/template.doc.mjs +23 -6
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/index.mjs +8 -0
- package/clients/cli/lib/manifest.mjs +9 -2
- package/foundation/agent-docs/agent-docs.d.mts +3 -2
- package/foundation/agent-docs/agent-docs.mjs +13 -9
- package/foundation/agent-docs/agent-docs.test.mjs +19 -1
- package/foundation/config/project.d.mts +12 -11
- package/foundation/config/project.mjs +73 -59
- package/foundation/config/project.test.mjs +141 -5
- package/foundation/discovery/authoring-self-docs.d.mts +12 -0
- package/foundation/discovery/authoring-self-docs.mjs +20 -8
- package/foundation/discovery/authoring-self-docs.test.mjs +25 -9
- package/foundation/discovery/cli-self-docs.d.mts +40 -34
- package/foundation/discovery/cli-self-docs.mjs +91 -115
- package/foundation/discovery/cli-self-docs.test.mjs +104 -166
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -0
- package/foundation/discovery/docs-discovery.d.mts +109 -9
- package/foundation/discovery/docs-discovery.mjs +223 -24
- package/foundation/discovery/docs-discovery.test.mjs +103 -27
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +92 -6
- package/foundation/discovery/template-adapter.mjs +453 -17
- package/foundation/discovery/template-adapter.test.mjs +42 -0
- package/foundation/discovery/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -0
- package/foundation/doc-compiler/bundle.mjs +61 -1
- package/foundation/doc-compiler/bundle.test.mjs +21 -10
- package/foundation/doc-compiler/compile.d.mts +113 -132
- package/foundation/doc-compiler/compile.mjs +57 -10
- package/foundation/doc-compiler/diagnostics.mjs +28 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
- package/foundation/doc-compiler/inputs.d.mts +2 -2
- package/foundation/doc-compiler/inputs.mjs +6 -1
- package/foundation/doc-compiler/ir.mjs +7 -0
- package/foundation/doc-compiler/lenses.d.mts +8 -5
- package/foundation/doc-compiler/lenses.mjs +50 -4
- package/foundation/doc-compiler/links.d.mts +162 -0
- package/foundation/doc-compiler/links.mjs +294 -0
- package/foundation/doc-compiler/links.test.mjs +192 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +5 -2
- package/foundation/doc-compiler/read.d.mts +3 -2
- package/foundation/doc-compiler/read.mjs +6 -1
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +84 -0
- package/foundation/integrations/contribution-inventory.d.mts +2 -1
- package/foundation/integrations/contribution-inventory.mjs +10 -4
- package/foundation/integrations/contribution-inventory.test.mjs +19 -0
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/validate-contributions.mjs +25 -27
- package/foundation/response/response-types.doc.d.mts +5 -1
- package/foundation/response/response-types.doc.mjs +19 -10
- package/foundation/text/string-utils.d.mts +8 -0
- package/foundation/text/string-utils.mjs +18 -0
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +9 -9
- package/assets/docs/cli.doc.mjs +0 -15
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* @file build command — thin wrapper with a stable result summary.
|
|
5
5
|
*
|
|
6
6
|
* astryx build → the PLAYBOOK (how to build a page)
|
|
7
|
-
* astryx build "<what>" →
|
|
8
|
-
*
|
|
7
|
+
* astryx build "<what>" → the TEMPLATE to start from (always one: the
|
|
8
|
+
* closest page, or the app shell), other
|
|
9
|
+
* templates, then blocks and components.
|
|
9
10
|
*
|
|
10
11
|
* All grouping/scoring lives in api/build; this file only parses flags and
|
|
11
12
|
* renders. Command strings are prefixed for the caller's package manager here
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
records,
|
|
28
29
|
} from '../formatters/index.mjs';
|
|
29
30
|
import {cliError} from '../lib/cli-error.mjs';
|
|
31
|
+
import {firstSentence} from '../../../foundation/text/string-utils.mjs';
|
|
30
32
|
import {defineCommand} from '../lib/define-command.mjs';
|
|
31
33
|
import {build as buildApi} from '../../../api/build/build.mjs';
|
|
32
34
|
import {doc as buildCommand} from './build.doc.mjs';
|
|
@@ -126,6 +128,7 @@ export function registerBuild(program) {
|
|
|
126
128
|
hasResults,
|
|
127
129
|
matchCount,
|
|
128
130
|
directMatch,
|
|
131
|
+
start,
|
|
129
132
|
pages,
|
|
130
133
|
blocks,
|
|
131
134
|
domain,
|
|
@@ -134,8 +137,8 @@ export function registerBuild(program) {
|
|
|
134
137
|
hint,
|
|
135
138
|
} = result.data;
|
|
136
139
|
// The kit spans domains, so its kind comes from the pieces themselves.
|
|
137
|
-
// `
|
|
138
|
-
// are not what the query matched.
|
|
140
|
+
// `start` (which may be the fallback shell), `frame` and `foundation`
|
|
141
|
+
// are deliberately excluded: they are not what the query matched.
|
|
139
142
|
const answered = resultSetOf([...pages, ...blocks, ...domain], {
|
|
140
143
|
count: matchCount,
|
|
141
144
|
empty: !hasResults,
|
|
@@ -148,7 +151,7 @@ export function registerBuild(program) {
|
|
|
148
151
|
return answered;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
if (!hasResults) {
|
|
154
|
+
if (!hasResults && !start) {
|
|
152
155
|
emit(
|
|
153
156
|
text(`No matches for "${q}".`),
|
|
154
157
|
text(`Try a broader term, or browse: ${run} component --list`),
|
|
@@ -156,91 +159,126 @@ export function registerBuild(program) {
|
|
|
156
159
|
return answered;
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
'domain',
|
|
166
|
-
'displayName',
|
|
167
|
-
'score',
|
|
168
|
-
'reason',
|
|
169
|
-
'import',
|
|
170
|
-
'description',
|
|
171
|
-
'command',
|
|
172
|
-
]
|
|
173
|
-
: ['name', 'displayName', 'description', 'command'];
|
|
162
|
+
// Four sections, one job each: the TEMPLATE to scaffold, OTHER
|
|
163
|
+
// TEMPLATES if its layout is wrong, BLOCKS for parts it lacks, and
|
|
164
|
+
// COMPONENTS for the rest. Descriptions stop at their first sentence and
|
|
165
|
+
// blocks and components share one command line in their heading; the
|
|
166
|
+
// JSON and --verbose carry everything.
|
|
167
|
+
const verbose = Boolean(options.verbose);
|
|
174
168
|
/** @type {import('../formatters/index.mjs').RecordOptions} */
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
169
|
+
const full = {
|
|
170
|
+
fields: [
|
|
171
|
+
'name',
|
|
172
|
+
'domain',
|
|
173
|
+
'displayName',
|
|
174
|
+
'score',
|
|
175
|
+
'reason',
|
|
176
|
+
'import',
|
|
177
|
+
'description',
|
|
178
|
+
'command',
|
|
179
|
+
],
|
|
180
|
+
format: {command: formatCliCommand},
|
|
181
|
+
};
|
|
182
|
+
/** @param {string[]} fields */
|
|
183
|
+
const brief = fields => ({
|
|
184
|
+
fields,
|
|
185
|
+
format: {command: formatCliCommand, description: firstSentence},
|
|
186
|
+
});
|
|
187
|
+
// Blocks and components are extras: the text names the top few, and
|
|
188
|
+
// says how many more the JSON and --verbose carry.
|
|
189
|
+
const TOP = 3;
|
|
190
|
+
/** @param {unknown[]} items */
|
|
191
|
+
const shown = items => (verbose ? items : items.slice(0, TOP));
|
|
192
|
+
/** @param {unknown[]} items */
|
|
193
|
+
const more = items =>
|
|
194
|
+
!verbose && items.length > TOP
|
|
195
|
+
? ` (top ${TOP} of ${items.length}; --verbose for all)`
|
|
196
|
+
: '';
|
|
202
197
|
|
|
203
198
|
/** @type {import('../formatters/index.mjs').Block[]} */
|
|
204
199
|
const out = [
|
|
205
200
|
section(`Build kit for "${q}"`),
|
|
206
201
|
text(
|
|
207
|
-
|
|
208
|
-
'
|
|
209
|
-
|
|
210
|
-
|
|
202
|
+
start
|
|
203
|
+
? 'Start from the TEMPLATE, fill it with BLOCKS, and use COMPONENTS only for what is left.\n' +
|
|
204
|
+
'Changing a page you already have? Keep it, and use only the blocks and components.'
|
|
205
|
+
: 'This kit is narrowed by --type, so it names no template.',
|
|
211
206
|
),
|
|
212
|
-
section('RECOMMENDED START', `${startNote}\n${startCmd}`),
|
|
213
207
|
];
|
|
214
208
|
|
|
215
|
-
if (
|
|
209
|
+
if (start) {
|
|
216
210
|
out.push(
|
|
217
211
|
section(
|
|
218
|
-
'
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
212
|
+
'TEMPLATE',
|
|
213
|
+
`${start.reason} ${
|
|
214
|
+
start.basis === 'fallback'
|
|
215
|
+
? 'Scaffold it, then put blocks inside it.'
|
|
216
|
+
: 'Scaffold it, then replace its content. Keep its layout and spacing.'
|
|
217
|
+
}`,
|
|
218
|
+
),
|
|
219
|
+
record(
|
|
220
|
+
start,
|
|
221
|
+
verbose
|
|
222
|
+
? {
|
|
223
|
+
fields: ['name', 'displayName', 'description', 'command'],
|
|
224
|
+
format: {command: formatCliCommand},
|
|
225
|
+
}
|
|
226
|
+
: brief(['name', 'description', 'command']),
|
|
222
227
|
),
|
|
223
|
-
records(pages, recordOpts),
|
|
224
228
|
);
|
|
229
|
+
if (start.alternatives.length) {
|
|
230
|
+
out.push(
|
|
231
|
+
section(
|
|
232
|
+
'OTHER TEMPLATES',
|
|
233
|
+
`If the layout is wrong, scaffold one of these instead. All page templates: ${formatCliCommand('template --list --type page')}`,
|
|
234
|
+
),
|
|
235
|
+
records(
|
|
236
|
+
start.alternatives,
|
|
237
|
+
verbose ? full : brief(['name', 'description', 'command']),
|
|
238
|
+
),
|
|
239
|
+
);
|
|
240
|
+
}
|
|
225
241
|
}
|
|
226
|
-
|
|
242
|
+
// Search's own page matches, so the text carries every field the JSON
|
|
243
|
+
// does: one line by default, the full entries under --verbose.
|
|
244
|
+
if (pages.length) {
|
|
227
245
|
out.push(
|
|
228
|
-
|
|
229
|
-
|
|
246
|
+
verbose
|
|
247
|
+
? section(
|
|
248
|
+
'SEARCH MATCHES',
|
|
249
|
+
'Page templates keyword search matched, best first.',
|
|
250
|
+
)
|
|
251
|
+
: text(
|
|
252
|
+
`Keyword search matched these page templates: ${pages.map(p => p.name).join(', ')}.`,
|
|
253
|
+
),
|
|
230
254
|
);
|
|
255
|
+
if (verbose) out.push(records(pages, full));
|
|
231
256
|
}
|
|
232
|
-
if (
|
|
257
|
+
if (blocks.length) {
|
|
233
258
|
out.push(
|
|
234
|
-
section(
|
|
235
|
-
|
|
259
|
+
section(
|
|
260
|
+
'BLOCKS',
|
|
261
|
+
`Ready-made sections for parts the template lacks${more(blocks)}. Print one: ${formatCliCommand('template <name>')}`,
|
|
262
|
+
),
|
|
263
|
+
records(
|
|
264
|
+
shown(blocks),
|
|
265
|
+
verbose ? full : brief(['name', 'description']),
|
|
266
|
+
),
|
|
236
267
|
);
|
|
237
268
|
}
|
|
238
|
-
|
|
239
269
|
out.push(
|
|
240
270
|
section(
|
|
241
|
-
'
|
|
242
|
-
|
|
271
|
+
'COMPONENTS',
|
|
272
|
+
`For what the template and blocks do not cover${more(domain)}. Read one: ${formatCliCommand('component <name>')}`,
|
|
243
273
|
),
|
|
274
|
+
...(domain.length
|
|
275
|
+
? [
|
|
276
|
+
records(
|
|
277
|
+
shown(domain),
|
|
278
|
+
verbose ? full : brief(['name', 'description']),
|
|
279
|
+
),
|
|
280
|
+
]
|
|
281
|
+
: []),
|
|
244
282
|
record({frame, foundation}),
|
|
245
283
|
);
|
|
246
284
|
|
|
@@ -21,6 +21,8 @@ describe('build kit text fields mirror the JSON keys', () => {
|
|
|
21
21
|
const {data} = JSON.parse(json.stdout);
|
|
22
22
|
const keys = new Set([
|
|
23
23
|
...Object.keys(data),
|
|
24
|
+
...Object.keys(data.start ?? {}),
|
|
25
|
+
...(data.start?.alternatives ?? []).flatMap(a => Object.keys(a)),
|
|
24
26
|
...[...data.pages, ...data.blocks, ...data.domain].flatMap(e => Object.keys(e)),
|
|
25
27
|
]);
|
|
26
28
|
|
|
@@ -35,6 +37,45 @@ describe('build kit text fields mirror the JSON keys', () => {
|
|
|
35
37
|
),
|
|
36
38
|
];
|
|
37
39
|
expect(fields).toContain('frame');
|
|
40
|
+
// The start is printed as a record, so its fields are checked too.
|
|
41
|
+
expect(fields).toContain('command');
|
|
42
|
+
expect(fields).toContain('displayName');
|
|
38
43
|
for (const field of fields) expect(keys).toContain(field);
|
|
39
44
|
}, SLOW);
|
|
45
|
+
|
|
46
|
+
it('leads with the start, then the alternatives, blocks and components', async () => {
|
|
47
|
+
const human = await runCli(['build', 'analytics dashboard'], REPO);
|
|
48
|
+
expect(human.status).toBe(0);
|
|
49
|
+
const headings = human.stdout
|
|
50
|
+
.split('\n')
|
|
51
|
+
.filter(line => /^(TEMPLATE|OTHER TEMPLATES|BLOCKS|COMPONENTS)$/.test(line));
|
|
52
|
+
expect(headings).toEqual(['TEMPLATE', 'OTHER TEMPLATES', 'BLOCKS', 'COMPONENTS']);
|
|
53
|
+
// A builder changing a page they already have keeps it.
|
|
54
|
+
expect(human.stdout).toContain(
|
|
55
|
+
'Changing a page you already have? Keep it, and use only the blocks and components.',
|
|
56
|
+
);
|
|
57
|
+
}, SLOW);
|
|
58
|
+
|
|
59
|
+
it("shortens the start's description by default and prints it whole under --verbose", async () => {
|
|
60
|
+
const json = await runCli(['build', 'quarterly revenue dashboard', '--json'], REPO);
|
|
61
|
+
const {start} = JSON.parse(json.stdout).data;
|
|
62
|
+
const first = start.description.slice(0, start.description.indexOf('. ') + 1);
|
|
63
|
+
expect(first.length).toBeGreaterThan(0);
|
|
64
|
+
expect(first.length).toBeLessThan(start.description.length);
|
|
65
|
+
const line = out => out.split('\n').find(l => l.startsWith('description:'));
|
|
66
|
+
const brief = await runCli(['build', 'quarterly revenue dashboard'], REPO);
|
|
67
|
+
expect(line(brief.stdout)).toBe(`description: ${first}`);
|
|
68
|
+
const whole = await runCli(['build', 'quarterly revenue dashboard', '--verbose'], REPO);
|
|
69
|
+
expect(whole.stdout).toContain(start.description);
|
|
70
|
+
}, SLOW);
|
|
71
|
+
|
|
72
|
+
it("names search's page matches in the default text", async () => {
|
|
73
|
+
const json = await runCli(['build', 'contact form', '--json'], REPO);
|
|
74
|
+
const {data} = JSON.parse(json.stdout);
|
|
75
|
+
expect(data.pages.length).toBeGreaterThan(0);
|
|
76
|
+
const human = await runCli(['build', 'contact form'], REPO);
|
|
77
|
+
expect(human.stdout).toContain(
|
|
78
|
+
`Keyword search matched these page templates: ${data.pages.map(p => p.name).join(', ')}.`,
|
|
79
|
+
);
|
|
80
|
+
}, SLOW);
|
|
40
81
|
});
|
|
@@ -111,7 +111,7 @@ export function registerComponent(program) {
|
|
|
111
111
|
// doctor integration validate. Best-effort; suppressed in --json mode.
|
|
112
112
|
try {
|
|
113
113
|
const project = await Project.load(process.cwd());
|
|
114
|
-
await warnOnIntegrationIssues(project
|
|
114
|
+
await warnOnIntegrationIssues(project, {json});
|
|
115
115
|
} catch {
|
|
116
116
|
// Never let the nudge break the command.
|
|
117
117
|
}
|
|
@@ -71,7 +71,7 @@ function createFixture({
|
|
|
71
71
|
);
|
|
72
72
|
fs.writeFileSync(
|
|
73
73
|
path.join(compDir, 'MetaAppShell.doc.mjs'),
|
|
74
|
-
`export
|
|
74
|
+
`export default {\n type: 'component',\n name: 'MetaAppShell',\n usage: { description: 'Meta-flavored app shell.' },\n props: [{ name: 'title', type: 'string', description: 'Header title' }],\n};\n`,
|
|
75
75
|
);
|
|
76
76
|
if (withSource) {
|
|
77
77
|
fs.writeFileSync(
|
|
@@ -82,7 +82,7 @@ function createFixture({
|
|
|
82
82
|
if (extraComponent) {
|
|
83
83
|
fs.writeFileSync(
|
|
84
84
|
path.join(compDir, `${extraComponent}.doc.mjs`),
|
|
85
|
-
`export
|
|
85
|
+
`export default {\n type: 'component',\n name: '${extraComponent}',\n usage: { description: '${extraComponent} from meta.' },\n props: [],\n};\n`,
|
|
86
86
|
);
|
|
87
87
|
fs.writeFileSync(
|
|
88
88
|
path.join(compDir, `${extraComponent}.tsx`),
|
|
@@ -100,7 +100,7 @@ function createFixture({
|
|
|
100
100
|
: '';
|
|
101
101
|
fs.writeFileSync(
|
|
102
102
|
path.join(entryDir, `${entryPoint.component}.doc.mjs`),
|
|
103
|
-
`export
|
|
103
|
+
`export default {\n type: 'component',\n name: '${entryPoint.component}',${ownSpecifier}\n usage: { description: '${entryPoint.component} from an entry point.' },\n props: [],\n};\n`,
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -69,11 +69,12 @@ describe('astryx discover with a manifest that fails to load', () => {
|
|
|
69
69
|
|
|
70
70
|
expect(status).toBe(0);
|
|
71
71
|
expect(stderr).toContain(
|
|
72
|
-
'Warning: @test/broken has 1 integration issue(s). '
|
|
73
|
-
'Run: astryx doctor integration validate @test/broken',
|
|
72
|
+
'Warning: @test/broken has 1 integration issue(s). Run: astryx doctor',
|
|
74
73
|
);
|
|
75
74
|
expect(stdout).not.toContain('No integrations configured.');
|
|
76
|
-
expect(stdout).toContain(
|
|
75
|
+
expect(stdout).toContain(
|
|
76
|
+
'No external components found in configured integrations.',
|
|
77
|
+
);
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
it('reports meta.configured=true in --json, with the nudge suppressed', async () => {
|
|
@@ -101,7 +102,7 @@ describe('astryx discover with a configured package that is not installed', () =
|
|
|
101
102
|
);
|
|
102
103
|
fs.writeFileSync(
|
|
103
104
|
path.join(healthy, 'components', 'Widget.doc.mjs'),
|
|
104
|
-
`export const docs = {name: 'Widget', usage: {description: 'A widget.'}};\n`,
|
|
105
|
+
`export const docs = {name: 'Widget', usage: {description: 'A widget.'}, props: []};\n`,
|
|
105
106
|
);
|
|
106
107
|
fs.writeFileSync(
|
|
107
108
|
path.join(healthy, 'components', 'Widget.tsx'),
|
|
@@ -129,8 +130,7 @@ describe('astryx discover with a configured package that is not installed', () =
|
|
|
129
130
|
|
|
130
131
|
expect(status).toBe(0);
|
|
131
132
|
expect(stderr).toContain(
|
|
132
|
-
'Warning: @test/missing has 1 integration issue(s). '
|
|
133
|
-
'Run: astryx doctor integration validate @test/missing',
|
|
133
|
+
'Warning: @test/missing has 1 integration issue(s). Run: astryx doctor\n',
|
|
134
134
|
);
|
|
135
135
|
});
|
|
136
136
|
});
|
|
@@ -149,8 +149,7 @@ describe('astryx search with a manifest that fails to load', () => {
|
|
|
149
149
|
|
|
150
150
|
expect(status).toBe(0);
|
|
151
151
|
expect(stderr).toContain(
|
|
152
|
-
'Warning: @test/broken has 1 integration issue(s). '
|
|
153
|
-
'Run: astryx doctor integration validate @test/broken',
|
|
152
|
+
'Warning: @test/broken has 1 integration issue(s). Run: astryx doctor',
|
|
154
153
|
);
|
|
155
154
|
|
|
156
155
|
const asJson = await runCli(['search', 'button', '--json'], {cwd: project});
|
|
@@ -83,7 +83,7 @@ export function registerDiscover(program) {
|
|
|
83
83
|
// doctor integration validate. Best-effort; suppressed in --json mode.
|
|
84
84
|
try {
|
|
85
85
|
const project = await Project.load(process.cwd());
|
|
86
|
-
await warnOnIntegrationIssues(project
|
|
86
|
+
await warnOnIntegrationIssues(project, {json});
|
|
87
87
|
} catch {
|
|
88
88
|
// Never let the nudge break the command.
|
|
89
89
|
}
|
|
@@ -15,10 +15,14 @@ export const doc = {
|
|
|
15
15
|
namespace: 'cli/commands',
|
|
16
16
|
summary: 'Print reference docs',
|
|
17
17
|
description:
|
|
18
|
-
'Reads the reference docs: with no topic it lists every topic; a
|
|
19
|
-
'
|
|
20
|
-
'topic plus a section prints that section
|
|
21
|
-
'a
|
|
18
|
+
'Reads the reference docs one level at a time: with no topic it lists every topic; a ' +
|
|
19
|
+
'topic lists its sections, each with the key to read it by (a topic with one section ' +
|
|
20
|
+
'prints whole); a topic plus a section prints that section; `--full` prints the whole ' +
|
|
21
|
+
'topic, as does `--dense`. With `--json`, a topic returns its whole doc, as docs() ' +
|
|
22
|
+
'does, and `--index` its section index. A route ' +
|
|
23
|
+
'opens a node of the docs tree: `cli` lists its guides and reference, ' +
|
|
24
|
+
'`cli/api/functions` lists every API function, and `cli/api/functions/search` prints ' +
|
|
25
|
+
'one.',
|
|
22
26
|
fn: 'docs',
|
|
23
27
|
args: [
|
|
24
28
|
{name: 'topic', param: 'topic', required: false},
|
|
@@ -28,20 +32,28 @@ export const doc = {
|
|
|
28
32
|
{
|
|
29
33
|
flag: '--index',
|
|
30
34
|
param: 'options.index',
|
|
31
|
-
description: "List the topic's sections and their keys
|
|
35
|
+
description: "List the topic's sections and their keys, even for a topic with one section",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
flag: '--full',
|
|
39
|
+
description:
|
|
40
|
+
'Print the whole topic instead of its sections (text; `--json` returns the whole topic unless --index). Cannot be set with --index',
|
|
32
41
|
},
|
|
33
42
|
],
|
|
34
43
|
examples: [
|
|
35
44
|
{label: 'List topics', cli: 'astryx docs'},
|
|
36
|
-
{label:
|
|
37
|
-
{label:
|
|
45
|
+
{label: "A topic's sections", cli: 'astryx docs theme'},
|
|
46
|
+
{label: 'A whole topic as JSON', cli: 'astryx docs spacing --json'},
|
|
38
47
|
{label: 'One section', cli: 'astryx docs theme quick-start'},
|
|
48
|
+
{label: 'The CLI docs tree', cli: 'astryx docs cli'},
|
|
49
|
+
{label: 'One API function', cli: 'astryx docs cli/api/functions/search'},
|
|
50
|
+
{label: 'A whole guide', cli: 'astryx docs cli/integrations --full'},
|
|
39
51
|
],
|
|
40
52
|
exitCodes: [
|
|
41
53
|
{code: 0, when: 'success'},
|
|
42
54
|
{
|
|
43
55
|
code: 1,
|
|
44
|
-
when: 'unknown topic, or a section that matches no section or more than one',
|
|
56
|
+
when: 'unknown topic or route, or a section that matches no section or more than one',
|
|
45
57
|
},
|
|
46
58
|
],
|
|
47
59
|
related: ['search', 'component', 'hook', 'template'],
|