@astryxdesign/cli 0.7.3 → 0.7.4-canary.39f7153

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +5 -5
  2. package/api/discover/_adapter.mjs +22 -10
  3. package/api/discover/_catalog-view.d.mts +2 -0
  4. package/api/discover/_catalog-view.mjs +1 -0
  5. package/api/discover/_catalog-view.test.mjs +1 -0
  6. package/api/discover/detail/detail.mjs +1 -0
  7. package/api/discover/detail/detail.test.mjs +3 -0
  8. package/api/discover/detail/doc/doc.mjs +5 -1
  9. package/api/discover/detail/doc/doc.test.mjs +1 -0
  10. package/api/discover/detail/item/item.mjs +2 -0
  11. package/api/discover/detail/item/item.test.mjs +2 -0
  12. package/api/discover/discover.doc.mjs +4 -4
  13. package/api/discover/discover.type.d.mts +20 -0
  14. package/api/discover/discover.type.mjs +5 -0
  15. package/api/discover/list/list.test.mjs +2 -0
  16. package/api/discover/search/search.d.mts +3 -2
  17. package/api/discover/search/search.mjs +26 -7
  18. package/api/discover/search/search.test.mjs +67 -0
  19. package/api/doctor/_adapter.d.mts +40 -0
  20. package/api/doctor/_adapter.mjs +171 -1
  21. package/api/doctor/built-checks.d.mts +85 -0
  22. package/api/doctor/built-checks.mjs +807 -0
  23. package/api/doctor/built-checks.test.mjs +502 -0
  24. package/api/doctor/doctor.d.mts +6 -5
  25. package/api/doctor/doctor.doc.mjs +10 -0
  26. package/api/doctor/doctor.mjs +18 -3
  27. package/api/doctor/doctor.type.d.mts +6 -0
  28. package/api/doctor/doctor.type.mjs +3 -0
  29. package/api/integration/pack-check.mjs +6 -1
  30. package/api/integration/pack-check.test.mjs +14 -0
  31. package/api/theme/palette/generate/generate.d.mts +8 -0
  32. package/api/theme/palette/generate/generate.mjs +38 -11
  33. package/api/theme/palette/generate/generate.test.mjs +83 -4
  34. package/api/theme/palette/generate/generator.d.mts +6 -0
  35. package/api/theme/palette/generate/generator.mjs +6 -0
  36. package/api/theme/theme.type.d.mts +12 -1
  37. package/api/theme/theme.type.mjs +7 -1
  38. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  39. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +1 -1
  40. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +1 -1
  41. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
  42. package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
  43. package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
  44. package/assets/templates/themes/butter/butterTheme.ts +274 -234
  45. package/assets/templates/themes/butter/palette.config.json +484 -0
  46. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +41 -0
  47. package/assets/templates/themes/gothic/gothicPalettes.generated.receipt.json +979 -0
  48. package/assets/templates/themes/gothic/gothicPalettes.generated.ts +271 -0
  49. package/assets/templates/themes/gothic/gothicTheme.ts +130 -160
  50. package/assets/templates/themes/gothic/palette.config.json +371 -0
  51. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +51 -0
  52. package/assets/templates/themes/matcha/matchaPalettes.generated.receipt.json +1502 -0
  53. package/assets/templates/themes/matcha/matchaPalettes.generated.ts +501 -0
  54. package/assets/templates/themes/matcha/matchaPalettes.ts +21 -0
  55. package/assets/templates/themes/matcha/matchaTheme.ts +164 -103
  56. package/assets/templates/themes/matcha/palette.config.json +448 -0
  57. package/assets/templates/themes/stone/palette.config.json +262 -0
  58. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +51 -0
  59. package/assets/templates/themes/stone/stonePalettes.generated.receipt.json +840 -0
  60. package/assets/templates/themes/stone/stonePalettes.generated.ts +501 -0
  61. package/assets/templates/themes/stone/stoneTheme.ts +190 -207
  62. package/clients/cli/commands/discover.mjs +1 -1
  63. package/clients/cli/commands/discover.sources.test.mjs +6 -0
  64. package/clients/cli/commands/doctor.doc.mjs +12 -0
  65. package/clients/cli/commands/doctor.mjs +23 -8
  66. package/foundation/response/error-codes.test.mjs +9 -0
  67. package/foundation/response/response-types.doc.mjs +5 -5
  68. package/foundation/response/response-types.doc.test.mjs +29 -0
  69. package/package.json +9 -9
@@ -563,9 +563,14 @@ export function printIntegrationCheckResponse(response) {
563
563
  }
564
564
  }
565
565
 
566
- /** @param {import('commander').Command} program */
567
- async function runProjectDoctor(program) {
568
- const report = await runChecks();
566
+ /**
567
+ * @param {import('commander').Command} program
568
+ * @param {{built?: string}} [options]
569
+ */
570
+ async function runProjectDoctor(program, options = {}) {
571
+ const report = await runChecks(
572
+ options.built != null ? {built: options.built} : {},
573
+ );
569
574
  if (program.opts().json) jsonOut({type: 'doctor', data: report});
570
575
  else printHuman(report);
571
576
  if (report.summary.fail > 0) process.exitCode = 1;
@@ -689,7 +694,7 @@ export function registerDoctor(program) {
689
694
  action: async (options, invoked) => {
690
695
  const word = unknownWord(invoked);
691
696
  if (word != null) return unknownSubcommand(doctorCmd, 'doctor', word);
692
- return runProjectDoctor(program);
697
+ return runProjectDoctor(program, options);
693
698
  },
694
699
  });
695
700
  /** @type {import('commander').Command} */
@@ -704,20 +709,30 @@ export function registerDoctor(program) {
704
709
  return NO_RESULT_SET;
705
710
  },
706
711
  });
712
+ // `--built` checks a project's build; an integration check has none.
713
+ const refuseBuilt = () =>
714
+ doctorCmd.opts().built != null
715
+ ? cliError(
716
+ '`--built` checks a finished build and goes with `doctor` alone, not with a `doctor integration` check',
717
+ {code: ERROR_CODES.ERR_INVALID_OPTION},
718
+ )
719
+ : null;
707
720
  defineCommand(integrationCmd, doctorIntegrationValidateCommand, {
708
721
  fn: validateIntegrationFn,
709
- action: async pkg => runIntegrationValidation(program, pkg),
722
+ action: async pkg => refuseBuilt() ?? runIntegrationValidation(program, pkg),
710
723
  });
711
724
  defineCommand(integrationCmd, doctorIntegrationTemplatesCommand, {
712
725
  fn: integrationTemplateConflictsFn,
713
- action: async pkg => runAuthoringCheck(program, pkg, 'templates'),
726
+ action: async pkg =>
727
+ refuseBuilt() ?? runAuthoringCheck(program, pkg, 'templates'),
714
728
  });
715
729
  defineCommand(integrationCmd, doctorIntegrationComponentsCommand, {
716
730
  fn: integrationComponentConflictsFn,
717
- action: async pkg => runAuthoringCheck(program, pkg, 'components'),
731
+ action: async pkg =>
732
+ refuseBuilt() ?? runAuthoringCheck(program, pkg, 'components'),
718
733
  });
719
734
  defineCommand(integrationCmd, doctorIntegrationDocsCommand, {
720
735
  fn: integrationDocConflictsFn,
721
- action: async pkg => runAuthoringCheck(program, pkg, 'docs'),
736
+ action: async pkg => refuseBuilt() ?? runAuthoringCheck(program, pkg, 'docs'),
722
737
  });
723
738
  }
@@ -258,6 +258,15 @@ describe('error codes: human mode stays clean', () => {
258
258
  expect(stdout).not.toContain('ERR_UNKNOWN_COMPONENT');
259
259
  });
260
260
 
261
+ it('refuses --built with a doctor integration check', async () => {
262
+ const json = await runCli(['--json', 'doctor', '--built', 'dist', 'integration', 'validate']);
263
+ expect(json.status).toBe(1);
264
+ expect(JSON.parse(json.stdout)).toMatchObject({code: 'ERR_INVALID_OPTION'});
265
+ const text = await runCli(['doctor', '--built', 'dist', 'integration', 'docs']);
266
+ expect(text.status).toBe(1);
267
+ expect(text.stderr).toContain('goes with `doctor` alone');
268
+ });
269
+
261
270
  it('unknown subcommand exits 1, with the code in JSON and not in text', async () => {
262
271
  // A group that is not JSON-capable itself still answers an unknown
263
272
  // subcommand in JSON, so a JSON caller learns the subcommands it has.
@@ -117,22 +117,22 @@ export const doc = {
117
117
  {
118
118
  value: 'discover.list',
119
119
  description:
120
- 'What the project has, the integrations it loads and the official packages it declares, official packages first (name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered".',
120
+ 'What the project has, the integrations it loads and the official packages it declares, official packages first (package, the npm package and always equal to name; name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with its package and the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered".',
121
121
  },
122
122
  {
123
123
  value: 'discover.detail',
124
124
  description:
125
- 'One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it.',
125
+ 'One package, for an @scope/name or @scope/name@version query: its package (the npm package the result is about), what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it.',
126
126
  },
127
127
  {
128
128
  value: 'discover.detail.doc',
129
129
  description:
130
- 'The validated ComponentDoc for one installed component, for an @scope/name/Component query.',
130
+ 'The validated ComponentDoc for one installed component, for an @scope/name/Component query, plus package, the npm package that owns the component.',
131
131
  },
132
132
  {
133
133
  value: 'discover.item',
134
134
  description:
135
- 'One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package.',
135
+ 'One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. The envelope\'s package names the same package.',
136
136
  },
137
137
  {
138
138
  value: 'discover.search',
@@ -272,7 +272,7 @@ export const doc = {
272
272
  {
273
273
  value: 'theme.palette.generate',
274
274
  description:
275
- 'An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result.',
275
+ 'An author-reviewable OKLCH palette response: recipe (`astryx-oklch-v1`), status (`candidate`), familyCount, stopCount, modes, candidate (`TonalPaletteCandidate`), and generationReceipt. The generationReceipt contains schemaVersion (1), recipe, generatorVersion (`palette-generator-v1`), candidateFormatVersion (`palette-typescript-v1` or `palette-json-v1`), candidateSha256, optional preview, resolved request, and diagnostics. File-write fields are output, receipt, preview, written, and reason (`exists` or null).',
276
276
  },
277
277
 
278
278
  // upgrade
@@ -172,6 +172,35 @@ describe('response-types EnumDoc names every field', () => {
172
172
  expectNamed('theme.targets', fieldsOf(res.data));
173
173
  });
174
174
 
175
+ it('theme.palette.generate, including receipt provenance', async () => {
176
+ const cwd = fs.mkdtempSync(
177
+ path.join(os.tmpdir(), 'astryx-response-types-palette-'),
178
+ );
179
+ fs.writeFileSync(
180
+ path.join(cwd, 'palette.config.json'),
181
+ JSON.stringify({
182
+ modeStrategy: 'light-only',
183
+ stops: [20, 50, 80],
184
+ families: [{id: 'blue', seed: '#0074e2'}],
185
+ }),
186
+ );
187
+ const res = await data(
188
+ ['theme', 'palette', 'generate', 'palette.config.json'],
189
+ cwd,
190
+ );
191
+ expect(res.type).toBe('theme.palette.generate');
192
+ expectNamed('theme.palette.generate', [
193
+ ...Object.keys(res.data),
194
+ ...Object.keys(res.data.generationReceipt),
195
+ ]);
196
+ expect(describedAs('theme.palette.generate')).toMatch(
197
+ /generatorVersion.*palette-generator-v1/,
198
+ );
199
+ expect(describedAs('theme.palette.generate')).toMatch(
200
+ /candidateFormatVersion.*palette-typescript-v1.*palette-json-v1/,
201
+ );
202
+ });
203
+
175
204
  it('gap-report.file, including each delivery', async () => {
176
205
  const res = await data([
177
206
  'gap-report',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.3",
3
+ "version": "0.7.4-canary.39f7153",
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",
@@ -106,10 +106,10 @@
106
106
  "zod": "^4.4.3"
107
107
  },
108
108
  "peerDependencies": {
109
- "@astryxdesign/charts": "*",
110
- "@astryxdesign/core": "*",
111
- "@astryxdesign/lab": "*",
112
- "@astryxdesign/theme-neutral": "*"
109
+ "@astryxdesign/charts": "0.7.4-canary.39f7153",
110
+ "@astryxdesign/core": "0.7.4-canary.39f7153",
111
+ "@astryxdesign/lab": "0.7.4-canary.39f7153",
112
+ "@astryxdesign/theme-neutral": "0.7.4-canary.39f7153"
113
113
  },
114
114
  "peerDependenciesMeta": {
115
115
  "@astryxdesign/charts": {
@@ -126,10 +126,10 @@
126
126
  }
127
127
  },
128
128
  "devDependencies": {
129
- "@astryxdesign/charts": "*",
130
- "@astryxdesign/core": "*",
131
- "@astryxdesign/lab": "*",
132
- "@astryxdesign/theme-neutral": "*",
129
+ "@astryxdesign/charts": "0.7.4-canary.39f7153",
130
+ "@astryxdesign/core": "0.7.4-canary.39f7153",
131
+ "@astryxdesign/lab": "0.7.4-canary.39f7153",
132
+ "@astryxdesign/theme-neutral": "0.7.4-canary.39f7153",
133
133
  "@heroicons/react": "^2.2.0",
134
134
  "@stylexjs/stylex": "^0.19.0",
135
135
  "@types/babel__core": "^7.20.5",