@astryxdesign/cli 0.7.0-canary.21875fc → 0.7.0-canary.291c4e9
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 +79 -84
- package/api/build/build.mjs +9 -0
- package/api/component/_adapter.d.mts +2 -0
- package/api/component/_adapter.mjs +3 -1
- package/api/component/component.doc.mjs +5 -1
- package/api/docs/compiled-topics.test.mjs +16 -0
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.test.mjs +28 -0
- package/api/doctor/theme-checks.mjs +10 -10
- package/api/doctor/theme-checks.test.mjs +5 -4
- package/api/gap-report/gap-report.doc.mjs +1 -1
- package/api/gap-report/gap-report.mjs +15 -0
- package/api/gap-report/gap-report.test.mjs +1 -1
- package/api/index.d.mts +0 -2
- package/api/index.mjs +0 -2
- package/api/init/init.doc.mjs +5 -1
- package/api/init/init.mjs +22 -0
- package/api/init/init.type.d.mts +4 -1
- package/api/init/init.type.mjs +1 -1
- package/api/init/remove/remove.mjs +8 -3
- package/api/init/remove/remove.test.mjs +12 -0
- package/api/init/run/run.d.mts +1 -1
- package/api/init/run/run.mjs +3 -3
- package/api/integration/pack-check.test.mjs +8 -0
- package/api/integration/validate-integration.d.mts +4 -0
- package/api/integration/validate-integration.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/index.ts +0 -1
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.mjs +1 -1
- package/api/search/search.test.mjs +1 -1
- package/api/search/search.type.d.mts +1 -1
- package/api/search/search.type.mjs +1 -1
- package/api/template/list/list.mjs +23 -2
- package/api/template/list/list.test.mjs +52 -0
- package/api/template/template-integration.test.mjs +37 -100
- package/api/template/template.doc.mjs +8 -3
- package/api/template/template.mjs +45 -0
- package/api/template/template.type.mjs +1 -1
- package/api/theme/_adapter.mjs +3 -3
- package/api/theme/add/add.d.mts +11 -5
- package/api/theme/add/add.mjs +19 -192
- package/api/theme/add/add.test.mjs +68 -258
- package/api/theme/add/add.types.test.mjs +0 -1
- package/api/theme/build/build.d.mts +3 -4
- package/api/theme/build/build.mjs +26 -65
- package/api/theme/build/build.test.mjs +11 -24
- package/api/theme/build/family.mjs +1 -1
- package/api/theme/eject/eject.copy-compat.test.mjs +168 -0
- package/api/theme/integration-themes.test.mjs +3 -3
- package/api/theme/remove/remove.test.mjs +1 -1
- package/api/theme/targets/targets.test.mjs +0 -4
- package/api/theme/template/template.mjs +1 -1
- package/api/theme/theme.type.d.mts +1 -30
- package/api/theme/theme.type.mjs +3 -13
- package/api/theme/themeAdd.doc.mjs +19 -27
- package/api/theme/themeTargets.doc.mjs +3 -4
- package/api/theme/themeTemplate.doc.mjs +1 -1
- package/api/theme/use/use.test.mjs +1 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.mjs +19 -0
- package/assets/codemods/transforms/next/__tests__/migrate-deprecated-theme-surface.test.mjs +322 -0
- package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
- package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
- package/assets/codemods/transforms/next/index.mjs +27 -1
- package/assets/codemods/transforms/next/migrate-deprecated-theme-surface-v0.6-data.mjs +229 -0
- package/assets/codemods/transforms/next/migrate-deprecated-theme-surface.mjs +624 -0
- package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
- package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
- package/assets/codemods/transforms/v0.6.0/migrate-astryx-theme-selectors-to-data-attrs.mjs +38 -18
- package/assets/docs/author-a-theme.doc.mjs +5 -5
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +2 -2
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/fonts-and-assets.doc.mjs +3 -3
- package/assets/docs/tree/styling-advanced.doc.mjs +21 -14
- package/assets/docs/tree/themes.doc.mjs +1 -1
- package/assets/docs/tree/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +2 -2
- package/assets/docs/tree/versioning.doc.mjs +1 -4
- package/assets/docs/use-a-theme.doc.mjs +16 -16
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
- package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
- package/assets/templates/pages/canvas-editor/page.tsx +2 -2
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/table-filter/page.tsx +3 -3
- package/assets/templates/pages/theme-showcase/page.tsx +2 -2
- package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +10 -9
- package/authoring/debug/type.ts +2 -2
- package/authoring/doctypes/base/type.ts +0 -9
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/command-result-coverage.test.mjs +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +4 -0
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +35 -8
- package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
- package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
- package/clients/cli/commands/build-theme.mjs +31 -67
- package/clients/cli/commands/build-theme.registry.test.mjs +0 -10
- package/clients/cli/commands/build.doc.mjs +1 -1
- package/clients/cli/commands/build.mjs +1 -1
- package/clients/cli/commands/component-ownership.test.mjs +2 -2
- package/clients/cli/commands/debug-result-summary.test.mjs +0 -16
- package/clients/cli/commands/discover.mjs +2 -1
- package/clients/cli/commands/doctor.mjs +5 -2
- package/clients/cli/commands/empty-argument.test.mjs +16 -0
- package/clients/cli/commands/gap-report.doc.mjs +1 -1
- package/clients/cli/commands/gap-report.test.mjs +2 -2
- package/clients/cli/commands/init.doc.mjs +4 -4
- package/clients/cli/commands/init.flag-help.test.mjs +7 -10
- package/clients/cli/commands/init.next-steps.test.mjs +1 -1
- package/clients/cli/commands/integration.mjs +2 -1
- package/clients/cli/commands/option-pair-refusals.test.mjs +37 -0
- package/clients/cli/commands/search.test.mjs +1 -1
- package/clients/cli/commands/silent-success-refusals.test.mjs +15 -0
- package/clients/cli/commands/swizzle.mjs +4 -1
- package/clients/cli/commands/template.doc.mjs +4 -4
- package/clients/cli/commands/template.flag-help.test.mjs +18 -11
- package/clients/cli/commands/template.mjs +7 -1
- package/clients/cli/commands/text-json-parity.test.mjs +0 -17
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +142 -49
- package/clients/cli/commands/theme-add.doc.mjs +10 -17
- package/clients/cli/commands/theme-list.behavior.test.mjs +2 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +8 -6
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +2 -2
- package/clients/cli/commands/upgrade.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.flag-help.test.mjs +7 -11
- package/clients/cli/commands/validate-nothing-exits-nonzero.test.mjs +67 -0
- package/clients/cli/index.mjs +0 -4
- package/clients/cli/lib/cli-error.mjs +19 -0
- package/clients/cli/lib/component-format.mjs +111 -57
- package/clients/cli/lib/component-format.test.mjs +28 -39
- package/clients/cli/lib/doc-text-ascii.test.mjs +5 -2
- package/clients/cli/lib/exit-codes.test.mjs +0 -7
- package/clients/cli/lib/json-shim.test.mjs +0 -24
- package/foundation/agent-docs/agent-docs.d.mts +2 -1
- package/foundation/agent-docs/agent-docs.mjs +6 -1
- package/foundation/agent-docs/app-theme-workflow.test.mjs +3 -0
- package/foundation/config/theme-state.mjs +3 -3
- package/foundation/debug/debug-fields.test.mjs +13 -35
- package/foundation/debug/event.mjs +13 -78
- package/foundation/debug/privacy-contract.test.mjs +20 -12
- package/foundation/debug/redact.d.mts +2 -2
- package/foundation/debug/redact.mjs +2 -2
- package/foundation/discovery/template-needs.mjs +93 -11
- package/foundation/discovery/template-needs.test.mjs +106 -3
- package/foundation/discovery/theme-imports.mjs +1 -1
- package/foundation/discovery/theming-targets.d.mts +1 -20
- package/foundation/discovery/theming-targets.mjs +1 -38
- package/foundation/discovery/theming-targets.test.mjs +9 -175
- package/foundation/doc-compiler/doc-loads.test.mjs +0 -12
- package/foundation/env/package-manager.d.mts +13 -0
- package/foundation/env/package-manager.mjs +106 -63
- package/foundation/response/error-codes.doc.mjs +1 -1
- package/foundation/response/response-types.doc.mjs +11 -31
- package/foundation/response/response-types.doc.test.mjs +36 -14
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/xle/browser.d.mts +2 -2
- package/foundation/xle/browser.mjs +2 -2
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/print.mjs +1 -1
- package/package.json +9 -9
- package/api/layout/_adapter.d.mts +0 -34
- package/api/layout/_adapter.mjs +0 -148
- package/api/layout/check/check.d.mts +0 -17
- package/api/layout/check/check.mjs +0 -41
- package/api/layout/expand/expand.d.mts +0 -23
- package/api/layout/expand/expand.mjs +0 -161
- package/api/layout/expand/expand.path-safety.test.mjs +0 -53
- package/api/layout/expand/expand.receipt.test.mjs +0 -74
- package/api/layout/grammar/grammar.d.mts +0 -14
- package/api/layout/grammar/grammar.mjs +0 -88
- package/api/layout/layout.d.mts +0 -6
- package/api/layout/layout.mjs +0 -17
- package/api/layout/layout.test.mjs +0 -297
- package/api/layout/layout.type.d.mts +0 -90
- package/api/layout/layout.type.mjs +0 -104
- package/api/layout/layoutCheck.doc.d.mts +0 -11
- package/api/layout/layoutCheck.doc.mjs +0 -85
- package/api/layout/layoutExpand.doc.d.mts +0 -11
- package/api/layout/layoutExpand.doc.mjs +0 -107
- package/api/layout/layoutGrammar.doc.d.mts +0 -11
- package/api/layout/layoutGrammar.doc.mjs +0 -57
- package/api/theme/add/add.binary.test.mjs +0 -157
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/add/add.staging.test.mjs +0 -83
- package/clients/cli/commands/layout-check.doc.mjs +0 -67
- package/clients/cli/commands/layout-expand.doc.mjs +0 -87
- package/clients/cli/commands/layout-grammar.doc.mjs +0 -32
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +0 -140
- package/clients/cli/commands/layout.doc.mjs +0 -36
- package/clients/cli/commands/layout.error-codes.test.mjs +0 -66
- package/clients/cli/commands/layout.exit-parity.test.mjs +0 -41
- package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
- package/clients/cli/commands/layout.mjs +0 -327
- package/clients/cli/commands/layout.path-help.test.mjs +0 -33
- package/clients/cli/commands/layout.stdin-cap.test.mjs +0 -47
- package/clients/cli/commands/layout.text-fields.test.mjs +0 -39
|
@@ -144,6 +144,76 @@ function evidenceIn(dir) {
|
|
|
144
144
|
* them, because a tool that trusts the lockfile instead will disagree with us.
|
|
145
145
|
*/
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* What one directory's own files say about its package manager, by the rules
|
|
149
|
+
* {@link explainPackageManager} applies within a directory (declared field,
|
|
150
|
+
* then a single lockfile, then committed config when lockfiles tie). Returns
|
|
151
|
+
* null when the directory has neither a declaration nor a lockfile, so a caller
|
|
152
|
+
* walking up keeps looking. An ambiguous directory reports `ambiguous: true`
|
|
153
|
+
* with the lockfiles that disagree, so a caller can name them.
|
|
154
|
+
* @param {string} dir
|
|
155
|
+
* @returns {(Omit<PackageManagerResolution, 'dir'> & {lockfiles: FoundLockfile[]}) | null}
|
|
156
|
+
*/
|
|
157
|
+
export function decidePackageManagerIn(dir) {
|
|
158
|
+
const locks = lockfilesIn(dir);
|
|
159
|
+
const candidates = locks.map(lock => lock.pm);
|
|
160
|
+
const declared = declaredPackageManager(dir);
|
|
161
|
+
|
|
162
|
+
// The project declared one. Nothing on the filesystem outranks that.
|
|
163
|
+
if (declared) {
|
|
164
|
+
return {
|
|
165
|
+
pm: declared,
|
|
166
|
+
ambiguous: false,
|
|
167
|
+
candidates,
|
|
168
|
+
declared,
|
|
169
|
+
source: 'declared',
|
|
170
|
+
lockfiles: locks,
|
|
171
|
+
strayLockfiles: locks.filter(lock => lock.pm !== declared),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// One lockfile is unambiguous.
|
|
176
|
+
if (locks.length === 1) {
|
|
177
|
+
return {
|
|
178
|
+
pm: locks[0].pm,
|
|
179
|
+
ambiguous: false,
|
|
180
|
+
candidates,
|
|
181
|
+
declared: null,
|
|
182
|
+
source: 'lockfile',
|
|
183
|
+
lockfiles: locks,
|
|
184
|
+
strayLockfiles: [],
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Several lockfiles and no declaration: the filesystem cannot say. Only a
|
|
189
|
+
// file the project committed on purpose can.
|
|
190
|
+
if (locks.length > 1) {
|
|
191
|
+
const evidence = evidenceIn(dir).filter(pm => candidates.includes(pm));
|
|
192
|
+
if (evidence.length === 1) {
|
|
193
|
+
return {
|
|
194
|
+
pm: evidence[0],
|
|
195
|
+
ambiguous: false,
|
|
196
|
+
candidates,
|
|
197
|
+
declared: null,
|
|
198
|
+
source: 'evidence',
|
|
199
|
+
lockfiles: locks,
|
|
200
|
+
strayLockfiles: [],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
pm: 'npx',
|
|
205
|
+
ambiguous: true,
|
|
206
|
+
candidates,
|
|
207
|
+
declared: null,
|
|
208
|
+
source: 'none',
|
|
209
|
+
lockfiles: locks,
|
|
210
|
+
strayLockfiles: [],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
|
|
147
217
|
/**
|
|
148
218
|
* Detect the project's package manager, with the reasoning attached.
|
|
149
219
|
* Walks up from targetDir, taking the first directory that answers.
|
|
@@ -182,59 +252,16 @@ export function explainPackageManager(targetDir = process.cwd()) {
|
|
|
182
252
|
const root = path.parse(dir).root;
|
|
183
253
|
|
|
184
254
|
while (dir !== root) {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const declared = declaredPackageManager(dir);
|
|
188
|
-
|
|
189
|
-
// 1. The project declared one. Nothing on the filesystem outranks that.
|
|
190
|
-
if (declared) {
|
|
255
|
+
const decision = decidePackageManagerIn(dir);
|
|
256
|
+
if (decision) {
|
|
191
257
|
return {
|
|
192
|
-
pm:
|
|
193
|
-
ambiguous:
|
|
194
|
-
dir,
|
|
195
|
-
candidates,
|
|
196
|
-
declared,
|
|
197
|
-
source: 'declared',
|
|
198
|
-
strayLockfiles: locks.filter(lock => lock.pm !== declared),
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// 2. One lockfile is unambiguous.
|
|
203
|
-
if (locks.length === 1) {
|
|
204
|
-
return {
|
|
205
|
-
pm: locks[0].pm,
|
|
206
|
-
ambiguous: false,
|
|
258
|
+
pm: decision.pm,
|
|
259
|
+
ambiguous: decision.ambiguous,
|
|
207
260
|
dir,
|
|
208
|
-
candidates,
|
|
209
|
-
declared:
|
|
210
|
-
source:
|
|
211
|
-
strayLockfiles:
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// 3. Several lockfiles and no declaration: the filesystem cannot say.
|
|
216
|
-
// Only a file the project committed on purpose can.
|
|
217
|
-
if (locks.length > 1) {
|
|
218
|
-
const evidence = evidenceIn(dir).filter(pm => candidates.includes(pm));
|
|
219
|
-
if (evidence.length === 1) {
|
|
220
|
-
return {
|
|
221
|
-
pm: evidence[0],
|
|
222
|
-
ambiguous: false,
|
|
223
|
-
dir,
|
|
224
|
-
candidates,
|
|
225
|
-
declared: null,
|
|
226
|
-
source: 'evidence',
|
|
227
|
-
strayLockfiles: [],
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
pm: 'npx',
|
|
232
|
-
ambiguous: true,
|
|
233
|
-
dir,
|
|
234
|
-
candidates,
|
|
235
|
-
declared: null,
|
|
236
|
-
source: 'none',
|
|
237
|
-
strayLockfiles: [],
|
|
261
|
+
candidates: decision.candidates,
|
|
262
|
+
declared: decision.declared,
|
|
263
|
+
source: decision.source,
|
|
264
|
+
strayLockfiles: decision.strayLockfiles,
|
|
238
265
|
};
|
|
239
266
|
}
|
|
240
267
|
|
|
@@ -279,11 +306,15 @@ export function detectPackageManager(targetDir = process.cwd()) {
|
|
|
279
306
|
export function getRunPrefix(targetDir) {
|
|
280
307
|
const pm = detectPackageManager(targetDir);
|
|
281
308
|
switch (pm) {
|
|
282
|
-
case 'yarn':
|
|
283
|
-
|
|
284
|
-
case '
|
|
309
|
+
case 'yarn':
|
|
310
|
+
return 'yarn';
|
|
311
|
+
case 'pnpm':
|
|
312
|
+
return 'pnpm exec';
|
|
313
|
+
case 'bun':
|
|
314
|
+
return 'bunx';
|
|
285
315
|
case 'npm':
|
|
286
|
-
default:
|
|
316
|
+
default:
|
|
317
|
+
return 'npx';
|
|
287
318
|
}
|
|
288
319
|
}
|
|
289
320
|
|
|
@@ -310,11 +341,15 @@ export const CLI_BIN = 'astryx';
|
|
|
310
341
|
export function getDlxPrefix(targetDir) {
|
|
311
342
|
const resolution = explainPackageManager(targetDir);
|
|
312
343
|
switch (resolution.pm) {
|
|
313
|
-
case 'yarn':
|
|
314
|
-
|
|
315
|
-
case '
|
|
344
|
+
case 'yarn':
|
|
345
|
+
return isYarnClassic(resolution) ? 'npx' : 'yarn dlx';
|
|
346
|
+
case 'pnpm':
|
|
347
|
+
return 'pnpm dlx';
|
|
348
|
+
case 'bun':
|
|
349
|
+
return 'bunx';
|
|
316
350
|
case 'npm':
|
|
317
|
-
default:
|
|
351
|
+
default:
|
|
352
|
+
return 'npx';
|
|
318
353
|
}
|
|
319
354
|
}
|
|
320
355
|
|
|
@@ -343,7 +378,9 @@ function isYarnClassic({dir}) {
|
|
|
343
378
|
if (fs.existsSync(path.join(dir, '.yarnrc.yml'))) return false;
|
|
344
379
|
if (fs.existsSync(path.join(dir, '.yarnrc'))) return true;
|
|
345
380
|
}
|
|
346
|
-
const agent = /^yarn\/(\d+)\./.exec(
|
|
381
|
+
const agent = /^yarn\/(\d+)\./.exec(
|
|
382
|
+
String(process.env.npm_config_user_agent ?? ''),
|
|
383
|
+
);
|
|
347
384
|
return agent ? agent[1] === '1' : false;
|
|
348
385
|
}
|
|
349
386
|
|
|
@@ -354,8 +391,12 @@ function isYarnClassic({dir}) {
|
|
|
354
391
|
*/
|
|
355
392
|
function declaredYarnMajor(dir) {
|
|
356
393
|
try {
|
|
357
|
-
const pkg = JSON.parse(
|
|
358
|
-
|
|
394
|
+
const pkg = JSON.parse(
|
|
395
|
+
fs.readFileSync(path.join(dir, 'package.json'), 'utf-8'),
|
|
396
|
+
);
|
|
397
|
+
const match = /^yarn@(\d+)(?:[.+]|$)/.exec(
|
|
398
|
+
String(pkg.packageManager ?? ''),
|
|
399
|
+
);
|
|
359
400
|
return match ? Number(match[1]) : null;
|
|
360
401
|
} catch {
|
|
361
402
|
// Best-effort: no package.json, or an unreadable one.
|
|
@@ -465,7 +506,9 @@ export function getCliInvocation(targetDir) {
|
|
|
465
506
|
* @returns {string}
|
|
466
507
|
*/
|
|
467
508
|
export function formatCliCommand(command, targetDir) {
|
|
468
|
-
const sub = String(command)
|
|
509
|
+
const sub = String(command)
|
|
510
|
+
.replace(/^\s*astryx\b\s*/, '')
|
|
511
|
+
.trim();
|
|
469
512
|
const stem = getCliInvocation(targetDir);
|
|
470
513
|
return sub ? `${stem} ${sub}` : stem;
|
|
471
514
|
}
|
|
@@ -36,7 +36,7 @@ export const doc = {
|
|
|
36
36
|
{
|
|
37
37
|
value: 'ERR_INVALID_OPTION',
|
|
38
38
|
description:
|
|
39
|
-
'An unknown option was passed, --json was given to a command without JSON output
|
|
39
|
+
'An unknown option was passed, --json was given to a command without JSON output.',
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
value: 'ERR_INVALID_ARGUMENT',
|
|
@@ -30,7 +30,7 @@ export const doc = {
|
|
|
30
30
|
{
|
|
31
31
|
value: 'init.remove',
|
|
32
32
|
description:
|
|
33
|
-
'
|
|
33
|
+
'The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove.',
|
|
34
34
|
},
|
|
35
35
|
// component
|
|
36
36
|
{
|
|
@@ -50,11 +50,13 @@ export const doc = {
|
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
value: 'component.detail.props',
|
|
53
|
-
description:
|
|
53
|
+
description:
|
|
54
|
+
"Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component.",
|
|
54
55
|
},
|
|
55
56
|
{
|
|
56
57
|
value: 'component.detail.source',
|
|
57
|
-
description:
|
|
58
|
+
description:
|
|
59
|
+
"One component's source file, as {component, source}. The envelope's package names the npm package that owns the component.",
|
|
58
60
|
},
|
|
59
61
|
{
|
|
60
62
|
value: 'component.detail.showcase',
|
|
@@ -86,7 +88,7 @@ export const doc = {
|
|
|
86
88
|
{
|
|
87
89
|
value: 'docs.detail.section',
|
|
88
90
|
description:
|
|
89
|
-
|
|
91
|
+
"One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section.",
|
|
90
92
|
},
|
|
91
93
|
{
|
|
92
94
|
value: 'docs.node',
|
|
@@ -161,7 +163,7 @@ export const doc = {
|
|
|
161
163
|
{
|
|
162
164
|
value: 'swizzle.copy',
|
|
163
165
|
description:
|
|
164
|
-
|
|
166
|
+
"An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package.",
|
|
165
167
|
},
|
|
166
168
|
|
|
167
169
|
// gap reports
|
|
@@ -194,7 +196,7 @@ export const doc = {
|
|
|
194
196
|
{
|
|
195
197
|
value: 'template.copy',
|
|
196
198
|
description:
|
|
197
|
-
|
|
199
|
+
"A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template.",
|
|
198
200
|
},
|
|
199
201
|
|
|
200
202
|
{
|
|
@@ -207,7 +209,7 @@ export const doc = {
|
|
|
207
209
|
{
|
|
208
210
|
value: 'hook.list',
|
|
209
211
|
description:
|
|
210
|
-
|
|
212
|
+
"The hook catalog grouped by category: `detail` (the level: names | compact | full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks.",
|
|
211
213
|
},
|
|
212
214
|
{
|
|
213
215
|
value: 'hook.detail',
|
|
@@ -241,11 +243,6 @@ export const doc = {
|
|
|
241
243
|
description:
|
|
242
244
|
'Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries.',
|
|
243
245
|
},
|
|
244
|
-
{
|
|
245
|
-
value: 'theme.add',
|
|
246
|
-
description:
|
|
247
|
-
'The released source-copy receipt: slug, displayName, maintained flag, owner package, outputDir, source entry, exportName, and files. Its additive meta.deprecations entry names DEP-0005 and the source-fork/import replacements.',
|
|
248
|
-
},
|
|
249
246
|
{
|
|
250
247
|
value: 'theme.app',
|
|
251
248
|
description:
|
|
@@ -264,7 +261,7 @@ export const doc = {
|
|
|
264
261
|
{
|
|
265
262
|
value: 'theme.targets',
|
|
266
263
|
description:
|
|
267
|
-
'The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states
|
|
264
|
+
'The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys.',
|
|
268
265
|
},
|
|
269
266
|
{
|
|
270
267
|
value: 'theme.palette.generate',
|
|
@@ -335,7 +332,7 @@ export const doc = {
|
|
|
335
332
|
{
|
|
336
333
|
value: 'integration.validate',
|
|
337
334
|
description:
|
|
338
|
-
'The validation result: validated (false when no
|
|
335
|
+
'The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning | error, message}.',
|
|
339
336
|
},
|
|
340
337
|
{
|
|
341
338
|
value: 'integration.template-conflicts',
|
|
@@ -352,22 +349,5 @@ export const doc = {
|
|
|
352
349
|
description:
|
|
353
350
|
'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',
|
|
354
351
|
},
|
|
355
|
-
|
|
356
|
-
// layout (XLE/XLO)
|
|
357
|
-
{
|
|
358
|
-
value: 'layout.expand',
|
|
359
|
-
description:
|
|
360
|
-
'The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, written (the output path, or null when nothing was written), and demoMediaReplaced (count of demo media placeholders). Carries `meta.deprecations` with DEP-0006 and its replacement commands.',
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
value: 'layout.check',
|
|
364
|
-
description:
|
|
365
|
-
'The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline). Carries `meta.deprecations` with DEP-0006 and its replacement commands.',
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
value: 'layout.grammar',
|
|
369
|
-
description:
|
|
370
|
-
"The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry. Carries `meta.deprecations` with DEP-0006 and its replacement commands.",
|
|
371
|
-
},
|
|
372
352
|
],
|
|
373
353
|
};
|
|
@@ -14,7 +14,8 @@ import {doc} from './response-types.doc.mjs';
|
|
|
14
14
|
import {runCli} from '../../test-utils/run-cli.mjs';
|
|
15
15
|
|
|
16
16
|
/** @param {string} type */
|
|
17
|
-
const describedAs =
|
|
17
|
+
const describedAs = type =>
|
|
18
|
+
doc.members.find(m => m.value === type)?.description ?? '';
|
|
18
19
|
|
|
19
20
|
/** @param {string} text @param {string} field */
|
|
20
21
|
const names = (text, field) => new RegExp(`(^|\\W)${field}(\\W|$)`).test(text);
|
|
@@ -27,7 +28,7 @@ const names = (text, field) => new RegExp(`(^|\\W)${field}(\\W|$)`).test(text);
|
|
|
27
28
|
function fieldsOf(value, depth = 2) {
|
|
28
29
|
const out = new Set();
|
|
29
30
|
const visit = (/** @type {unknown} */ v, /** @type {number} */ d) => {
|
|
30
|
-
if (Array.isArray(v)) return v.forEach(
|
|
31
|
+
if (Array.isArray(v)) return v.forEach(item => visit(item, d));
|
|
31
32
|
if (!v || typeof v !== 'object' || d < 0) return;
|
|
32
33
|
for (const [key, child] of Object.entries(v)) {
|
|
33
34
|
out.add(key);
|
|
@@ -40,7 +41,10 @@ function fieldsOf(value, depth = 2) {
|
|
|
40
41
|
|
|
41
42
|
/** @param {string[]} args @param {string} [cwd] */
|
|
42
43
|
async function data(args, cwd) {
|
|
43
|
-
const {status, stdout} = await runCli(
|
|
44
|
+
const {status, stdout} = await runCli(
|
|
45
|
+
['--json', ...args],
|
|
46
|
+
cwd ? {cwd} : undefined,
|
|
47
|
+
);
|
|
44
48
|
expect(status, stdout).toBe(0);
|
|
45
49
|
return JSON.parse(stdout);
|
|
46
50
|
}
|
|
@@ -48,7 +52,7 @@ async function data(args, cwd) {
|
|
|
48
52
|
/** @param {string} type @param {Iterable<string>} fields */
|
|
49
53
|
function expectNamed(type, fields) {
|
|
50
54
|
const text = describedAs(type);
|
|
51
|
-
const missing = [...fields].filter(
|
|
55
|
+
const missing = [...fields].filter(f => !names(text, f));
|
|
52
56
|
expect(missing, `${type} omits`).toEqual([]);
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -99,8 +103,13 @@ describe('response-types EnumDoc names every field', () => {
|
|
|
99
103
|
it('search, across component, hook, template, and doc results', async () => {
|
|
100
104
|
const mixed = await data(['search', 'dashboard', '--limit', '50']);
|
|
101
105
|
const docsOnly = await data(['search', 'tokens', '--type', 'doc']);
|
|
102
|
-
expect(new Set(mixed.data.results.map(
|
|
103
|
-
|
|
106
|
+
expect(new Set(mixed.data.results.map(r => r.domain))).toContain(
|
|
107
|
+
'template',
|
|
108
|
+
);
|
|
109
|
+
expectNamed(
|
|
110
|
+
'search',
|
|
111
|
+
new Set([...fieldsOf(mixed.data), ...fieldsOf(docsOnly.data)]),
|
|
112
|
+
);
|
|
104
113
|
});
|
|
105
114
|
|
|
106
115
|
it('build.kit, including the hint a thin kit carries', async () => {
|
|
@@ -112,25 +121,38 @@ describe('response-types EnumDoc names every field', () => {
|
|
|
112
121
|
expectNamed('build.kit', fields);
|
|
113
122
|
});
|
|
114
123
|
|
|
115
|
-
it('theme.targets
|
|
124
|
+
it('theme.targets', async () => {
|
|
116
125
|
const res = await data(['theme', 'targets']);
|
|
117
|
-
|
|
118
|
-
expect(fields).toContain('deprecatedFor');
|
|
119
|
-
expectNamed('theme.targets', fields);
|
|
126
|
+
expectNamed('theme.targets', fieldsOf(res.data));
|
|
120
127
|
});
|
|
121
128
|
|
|
122
129
|
it('gap-report.file, including each delivery', async () => {
|
|
123
|
-
const res = await data([
|
|
130
|
+
const res = await data([
|
|
131
|
+
'gap-report',
|
|
132
|
+
'Button',
|
|
133
|
+
'--category',
|
|
134
|
+
'docs_gap',
|
|
135
|
+
'--reason',
|
|
136
|
+
'probe',
|
|
137
|
+
]);
|
|
124
138
|
expect(res.type).toBe('gap-report.file');
|
|
125
139
|
expect(res.data.deliveries.length).toBeGreaterThan(0);
|
|
126
140
|
expectNamed('gap-report.file', fieldsOf(res.data));
|
|
127
141
|
});
|
|
128
142
|
|
|
129
143
|
it('theme.build, including notices', async () => {
|
|
130
|
-
const cwd = fs.mkdtempSync(
|
|
131
|
-
|
|
144
|
+
const cwd = fs.mkdtempSync(
|
|
145
|
+
path.join(os.tmpdir(), 'astryx-response-types-'),
|
|
146
|
+
);
|
|
147
|
+
fs.writeFileSync(
|
|
148
|
+
path.join(cwd, 'package.json'),
|
|
149
|
+
'{"name":"app","version":"1.0.0"}',
|
|
150
|
+
);
|
|
132
151
|
await data(['theme', 'template', 'starter.ts'], cwd);
|
|
133
|
-
const res = await data(
|
|
152
|
+
const res = await data(
|
|
153
|
+
['theme', 'build', 'starter.ts', '--out', 'starter.css'],
|
|
154
|
+
cwd,
|
|
155
|
+
);
|
|
134
156
|
expect(res.type).toBe('theme.build');
|
|
135
157
|
expectNamed('theme.build', fieldsOf(res.data));
|
|
136
158
|
});
|
|
@@ -166,7 +166,7 @@ export const doc = {
|
|
|
166
166
|
text:
|
|
167
167
|
'The process exit code is part of the contract too. Exit 0 means success, ' +
|
|
168
168
|
'and every error envelope exits 1. Some commands also exit 1 with a success ' +
|
|
169
|
-
'envelope when what they report failed: a failed check (
|
|
169
|
+
'envelope when what they report failed: a failed check (doctor ' +
|
|
170
170
|
'and its integration subcommands, integration verify, theme build ' +
|
|
171
171
|
'--check), a gap report that was not delivered, an upgrade left incomplete, ' +
|
|
172
172
|
'or init agent docs refused for a path outside the project. Read the ' +
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Validate an expression and return both canonical surfaces — the browser
|
|
6
|
-
* twin of
|
|
6
|
+
* browser twin of the XLE validator. Never throws on invalid input; returns the errors.
|
|
7
7
|
*
|
|
8
8
|
* @param {string} expression
|
|
9
9
|
* @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
|
|
@@ -19,7 +19,7 @@ export function checkExpression(expression: string, registry: import("./xle-ast"
|
|
|
19
19
|
loose?: boolean | undefined;
|
|
20
20
|
}): import("./browser").CheckResult;
|
|
21
21
|
/**
|
|
22
|
-
* Validate + expand to TSX — the browser twin of
|
|
22
|
+
* Validate + expand to TSX — the browser twin of the XLE expander.
|
|
23
23
|
* Returns either {code, ...} or {errors} (never writes files).
|
|
24
24
|
*
|
|
25
25
|
* @param {string} expression
|
|
@@ -45,7 +45,7 @@ function formatIssue(issue) {
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Validate an expression and return both canonical surfaces — the browser
|
|
48
|
-
* twin of
|
|
48
|
+
* browser twin of the XLE validator. Never throws on invalid input; returns the errors.
|
|
49
49
|
*
|
|
50
50
|
* @param {string} expression
|
|
51
51
|
* @param {import('./xle-ast').Registry | import('./browser').SerializedRegistry | object} registry - serialized or hydrated
|
|
@@ -85,7 +85,7 @@ export function checkExpression(expression, registry, opts = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* Validate + expand to TSX — the browser twin of
|
|
88
|
+
* Validate + expand to TSX — the browser twin of the XLE expander.
|
|
89
89
|
* Returns either {code, ...} or {errors} (never writes files).
|
|
90
90
|
*
|
|
91
91
|
* @param {string} expression
|
|
@@ -751,7 +751,7 @@ export function expand(doc, registry, options = {}) {
|
|
|
751
751
|
: [];
|
|
752
752
|
|
|
753
753
|
const code = [
|
|
754
|
-
`// Generated by
|
|
754
|
+
`// Generated by the Astryx XLE expander — this file is the artifact; edit freely.`,
|
|
755
755
|
...importLines,
|
|
756
756
|
...blockSection,
|
|
757
757
|
'',
|
package/foundation/xle/print.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file XLE canonical printers — AST → compact (XLE) or outline (XLO) text.
|
|
5
5
|
*
|
|
6
|
-
* Used by
|
|
6
|
+
* Used by the XLE validator so either party (agent or human)
|
|
7
7
|
* can request the other surface, and by round-trip conformance tests.
|
|
8
8
|
* Printing is best-effort canonical: spelling variants the lexer
|
|
9
9
|
* normalized are emitted in canonical form.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.0-canary.
|
|
3
|
+
"version": "0.7.0-canary.291c4e9",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
"zod": "^4.4.3"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@astryxdesign/charts": "0.7.0-canary.
|
|
105
|
-
"@astryxdesign/core": "0.7.0-canary.
|
|
106
|
-
"@astryxdesign/lab": "0.7.0-canary.
|
|
107
|
-
"@astryxdesign/theme-neutral": "0.7.0-canary.
|
|
104
|
+
"@astryxdesign/charts": "0.7.0-canary.291c4e9",
|
|
105
|
+
"@astryxdesign/core": "0.7.0-canary.291c4e9",
|
|
106
|
+
"@astryxdesign/lab": "0.7.0-canary.291c4e9",
|
|
107
|
+
"@astryxdesign/theme-neutral": "0.7.0-canary.291c4e9"
|
|
108
108
|
},
|
|
109
109
|
"peerDependenciesMeta": {
|
|
110
110
|
"@astryxdesign/charts": {
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "0.7.0-canary.
|
|
125
|
-
"@astryxdesign/core": "0.7.0-canary.
|
|
126
|
-
"@astryxdesign/lab": "0.7.0-canary.
|
|
127
|
-
"@astryxdesign/theme-neutral": "0.7.0-canary.
|
|
124
|
+
"@astryxdesign/charts": "0.7.0-canary.291c4e9",
|
|
125
|
+
"@astryxdesign/core": "0.7.0-canary.291c4e9",
|
|
126
|
+
"@astryxdesign/lab": "0.7.0-canary.291c4e9",
|
|
127
|
+
"@astryxdesign/theme-neutral": "0.7.0-canary.291c4e9",
|
|
128
128
|
"@heroicons/react": "^2.2.0",
|
|
129
129
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
130
|
"@types/babel__core": "^7.20.5",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
-
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
-
|
|
4
|
-
/** @param {import('../../foundation/xle/xle-ast').RawIssue} issue */
|
|
5
|
-
export function formatIssue(issue: import("../../foundation/xle/xle-ast").RawIssue): string;
|
|
6
|
-
/**
|
|
7
|
-
* Parse + validate, throwing structured XDSErrors on failure.
|
|
8
|
-
* Returns {doc, registry, blocks, warnings}.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} expression
|
|
11
|
-
* @param {{form?: 'compact'|'outline'|'auto', loose?: boolean, cwd?: string}} [options]
|
|
12
|
-
*/
|
|
13
|
-
export function analyze(expression: string, { form, loose, cwd }?: {
|
|
14
|
-
form?: "compact" | "outline" | "auto";
|
|
15
|
-
loose?: boolean;
|
|
16
|
-
cwd?: string;
|
|
17
|
-
}): Promise<{
|
|
18
|
-
doc: import("../../foundation/xle/xle-ast").XLEDoc;
|
|
19
|
-
registry: import("../../foundation/xle/xle-ast").Registry;
|
|
20
|
-
blocks: LayoutBlock[];
|
|
21
|
-
errors: import("../../foundation/xle/xle-ast").RawIssue[];
|
|
22
|
-
warnings: import("../../foundation/xle/xle-ast").RawIssue[];
|
|
23
|
-
}>;
|
|
24
|
-
export type LayoutBlock = {
|
|
25
|
-
dirName: string;
|
|
26
|
-
name: string;
|
|
27
|
-
kind: "template" | "component";
|
|
28
|
-
type?: string | undefined;
|
|
29
|
-
description?: string | undefined;
|
|
30
|
-
category?: string | undefined;
|
|
31
|
-
importPath?: string | undefined;
|
|
32
|
-
filePath?: string | undefined;
|
|
33
|
-
isDefault?: boolean | undefined;
|
|
34
|
-
};
|