@astryxdesign/cli 0.6.5-canary.d6da8e4 → 0.6.5-canary.e5d11eb

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 (67) hide show
  1. package/README.md +2 -2
  2. package/api/build/_adapter.d.mts +0 -14
  3. package/api/build/_adapter.mjs +1 -58
  4. package/api/build/build.test.mjs +1 -74
  5. package/api/build/kit/kit.mjs +7 -39
  6. package/api/build/kit/rank.d.mts +0 -8
  7. package/api/build/kit/rank.mjs +0 -14
  8. package/api/docs/docs.d.mts +0 -6
  9. package/api/docs/docs.doc.mjs +2 -31
  10. package/api/docs/docs.mjs +1 -44
  11. package/api/docs/docs.type.d.mts +1 -38
  12. package/api/docs/docs.type.mjs +1 -18
  13. package/api/docs/node/node.d.mts +3 -28
  14. package/api/docs/node/node.mjs +23 -146
  15. package/api/gap-report/gap-report.d.mts +1 -3
  16. package/api/gap-report/gap-report.mjs +2 -12
  17. package/api/gap-report/gap-report.test.mjs +0 -106
  18. package/api/hook/list/list.d.mts +1 -1
  19. package/api/integration/add-theme.mjs +3 -93
  20. package/api/integration/add-theme.test.mjs +0 -100
  21. package/api/integration/integrationAddTheme.doc.mjs +1 -1
  22. package/api/search/search.d.mts +5 -12
  23. package/api/search/search.doc.mjs +4 -4
  24. package/api/search/search.mjs +53 -123
  25. package/api/search/search.test.mjs +8 -123
  26. package/api/search/search.type.d.mts +5 -5
  27. package/api/search/search.type.mjs +5 -5
  28. package/api/theme/build/build.mjs +69 -146
  29. package/api/theme/build/build.test.mjs +1 -190
  30. package/api/theme/themeBuild.doc.d.mts +1 -4
  31. package/api/theme/themeBuild.doc.mjs +3 -14
  32. package/assets/docs/theme.doc.mjs +1 -2
  33. package/assets/docs/tokens.doc.mjs +3 -3
  34. package/assets/docs/tree/add-a-theme.doc.mjs +0 -4
  35. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  36. package/clients/cli/commands/build-theme.mjs +2 -8
  37. package/clients/cli/commands/discover.mjs +1 -29
  38. package/clients/cli/commands/docs.doc.mjs +2 -15
  39. package/clients/cli/commands/docs.mjs +5 -222
  40. package/clients/cli/commands/gap-report.mjs +0 -12
  41. package/clients/cli/commands/gap-report.test.mjs +0 -63
  42. package/clients/cli/commands/integration-add.doc.mjs +1 -1
  43. package/clients/cli/commands/search.doc.mjs +4 -5
  44. package/clients/cli/commands/search.mjs +6 -30
  45. package/clients/cli/commands/search.test.mjs +16 -60
  46. package/foundation/agent-docs/agent-docs.mjs +1 -2
  47. package/foundation/agent-docs/agent-docs.test.mjs +0 -8
  48. package/foundation/discovery/theme-discovery.d.mts +0 -6
  49. package/foundation/discovery/theme-discovery.mjs +0 -9
  50. package/foundation/doc-compiler/doc-loads.test.mjs +1 -1
  51. package/package.json +9 -9
  52. package/api/build/kit/weights.d.mts +0 -82
  53. package/api/build/kit/weights.json +0 -1
  54. package/api/build/kit/weights.mjs +0 -305
  55. package/api/build/kit/weights.test.mjs +0 -190
  56. package/api/docs/docs.depth.test.mjs +0 -132
  57. package/api/theme/build/build.icon-lineage.test.mjs +0 -117
  58. package/api/theme/build/build.icon-preservation.test.mjs +0 -639
  59. package/api/theme/build/icon-imports.d.mts +0 -47
  60. package/api/theme/build/icon-imports.mjs +0 -691
  61. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +0 -15
  62. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +0 -38
  63. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +0 -20
  64. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +0 -48
  65. package/clients/cli/commands/discover.no-source.test.mjs +0 -75
  66. package/clients/cli/commands/docs.depth.test.mjs +0 -219
  67. package/clients/cli/commands/theme-list.behavior.test.mjs +0 -41
@@ -118,15 +118,6 @@ describe('search() API — filters', () => {
118
118
  }
119
119
  });
120
120
 
121
- it('--type theme returns only themes, each with the command that adds it', async () => {
122
- const {data} = await search('warm', {...OPTS, type: 'theme'});
123
- expect(data.results.map(r => r.name)).toContain('neutral');
124
- for (const r of data.results) {
125
- expect(r.domain).toBe('theme');
126
- expect(r.command).toBe(`astryx theme add ${r.name}`);
127
- }
128
- });
129
-
130
121
  it('respects --limit', async () => {
131
122
  const {data} = await search('button', {...OPTS, limit: 3});
132
123
  expect(data.results.length).toBeLessThanOrEqual(3);
@@ -288,31 +279,22 @@ describe('search CLI — exit codes + JSON contract', () => {
288
279
  });
289
280
 
290
281
  it('prints every result field under its JSON key (score and reason with --verbose)', async () => {
291
- // Between them these reach every domain, so every per-domain field shows.
292
- // A theme matches `theme` only through its description, a prose mention
293
- // ranked below every name and keyword hit, so the theme domain comes from
294
- // a theme's own name.
295
- const domains = new Set();
296
- for (const args of [
297
- ['search', 'theme', '--limit', '60'],
298
- ['search', 'neutral', '--type', 'theme'],
299
- ]) {
300
- const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
301
- const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
302
- const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
303
- for (const result of env.data.results) {
304
- domains.add(result.domain);
305
- for (const [key, value] of Object.entries(result)) {
306
- if (value == null || value === '') continue;
307
- const label = `${result.domain} ${result.name}: ${key}`;
308
- expect(printsField(verbose, key, value), label).toBe(true);
309
- if (key !== 'score' && key !== 'reason') {
310
- expect(printsField(plain, key, value), label).toBe(true);
311
- }
282
+ // One query that reaches all four domains, so every per-domain field shows.
283
+ const args = ['search', 'theme', '--limit', '60'];
284
+ const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
285
+ expect(new Set(env.data.results.map(r => r.domain))).toEqual(new Set(SEARCH_DOMAINS));
286
+ const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
287
+ const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
288
+ for (const result of env.data.results) {
289
+ for (const [key, value] of Object.entries(result)) {
290
+ if (value == null || value === '') continue;
291
+ const label = `${result.domain} ${result.name}: ${key}`;
292
+ expect(printsField(verbose, key, value), label).toBe(true);
293
+ if (key !== 'score' && key !== 'reason') {
294
+ expect(printsField(plain, key, value), label).toBe(true);
312
295
  }
313
296
  }
314
297
  }
315
- expect(domains).toEqual(new Set(SEARCH_DOMAINS));
316
298
  }, 90_000);
317
299
 
318
300
  it('--verbose exits 0 and prints import/match detail', async () => {
@@ -329,42 +311,16 @@ describe('search CLI — exit codes + JSON contract', () => {
329
311
  expect(r.stdout).toContain('reason:');
330
312
  });
331
313
 
332
- it('points at discover for packages that could add more, except for hooks', async () => {
333
- const open = await runCli(['search', 'data', 'table'], REPO_ROOT);
334
- expect(open.status).toBe(0);
335
- expect(open.stdout).toMatch(/^More in packages you could add: .*discover 'data table'$/m);
336
- const none = await runCli(['search', 'zzqqxxnomatch'], REPO_ROOT);
337
- expect(none.stdout).toMatch(/^More in packages you could add: .*discover zzqqxxnomatch$/m);
338
- const hooks = await runCli(['search', 'click', '--type', 'hook'], REPO_ROOT);
339
- expect(hooks.status).toBe(0);
340
- expect(hooks.stdout).not.toContain('More in packages you could add');
341
- const json = await runCli(['--json', 'search', 'button'], REPO_ROOT);
342
- expect(json.stdout).not.toContain('More in packages you could add');
343
- });
344
-
345
- it('searches the docs and themes when no @astryxdesign/core is reachable, and exits 1 for --type component', async () => {
314
+ it('searches the docs when no @astryxdesign/core is reachable, and exits 1 for --type component', async () => {
346
315
  const empty = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-search-cli-no-core-'));
347
316
  try {
348
317
  const open = await runCli(['--json', 'search', 'make', 'an', 'integration'], empty);
349
318
  expect(open.status).toBe(0);
350
319
  expect(JSON.parse(open.stdout).data.results[0]).toMatchObject({domain: 'doc'});
351
- // Bundled themes need no project, so an open search finds them too.
352
- const theme = await runCli(['--json', 'search', 'neutral'], empty);
353
- expect(theme.status).toBe(0);
354
- expect(JSON.parse(theme.stdout).data.results[0]).toMatchObject({
355
- domain: 'theme',
356
- name: 'neutral',
357
- });
358
- // The text says the search covered the docs and themes alone.
320
+ // The text says the search covered the docs alone.
359
321
  const text = await runCli(['search', 'button'], empty);
360
322
  expect(text.status).toBe(0);
361
- expect(text.stdout).toContain('only the docs and themes were searched');
362
- // A themes-only search needs no core, like a docs-only one.
363
- const themes = await runCli(['--json', 'search', 'warm', '--type', 'theme'], empty);
364
- expect(themes.status).toBe(0);
365
- const found = JSON.parse(themes.stdout).data.results;
366
- expect(found.map(r => r.name)).toContain('neutral');
367
- expect(found.every(r => r.domain === 'theme')).toBe(true);
323
+ expect(text.stdout).toContain('only the docs were searched');
368
324
  const json = await runCli(['--json', 'search', 'button', '--type', 'component'], empty);
369
325
  expect(json.status).toBe(1);
370
326
  expect(JSON.parse(json.stdout)).toMatchObject({code: 'ERR_CORE_NOT_FOUND'});
@@ -472,8 +472,7 @@ export function generateCompressedIndex(
472
472
 
473
473
  // Command reference — build/template/component are covered in WORKFLOW above.
474
474
  lines.push('MORE CLI:');
475
- lines.push(' search "<query>" find any component / hook / doc / template / block / theme');
476
- lines.push(' discover <words> integrations you could add, and the ones you have');
475
+ lines.push(' search "<query>" find any component / hook / doc / template / block');
477
476
  lines.push(` component --list ${componentCount} components by category`);
478
477
  lines.push(' template --list page + block recipes');
479
478
  const docsDir = path.join(CLI_ROOT, 'assets', 'docs');
@@ -110,14 +110,6 @@ describe('generateCompressedIndex', () => {
110
110
  expect(result).toMatch(/after any Astryx or integration dependency bump/);
111
111
  });
112
112
 
113
- it('points agents at discover for integrations they could add', () => {
114
- const result = generateCompressedIndex('1.0.0');
115
- // Without this line no surface an agent reads names `discover`, and agents
116
- // look for a theme in the package registry instead.
117
- expect(result).toMatch(/^ {2}discover <words> {3}integrations you could add, and the ones you have$/m);
118
- expect(result).toMatch(/^ {2}search "<query>" .*\/ theme$/m);
119
- });
120
-
121
113
  it('states the invocation once in the CLI header (yarn)', () => {
122
114
  const result = generateCompressedIndex('1.0.0', {invocation: 'yarn astryx'});
123
115
  expect(result).toContain('yarn astryx <cmd>');
@@ -1,12 +1,6 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /**
5
- * Every module a theme source file imports or re-exports, as written.
6
- * @param {string} file
7
- * @returns {string[]}
8
- */
9
- export function themeFileImports(file: string): string[];
10
4
  /**
11
5
  * How messages about a theme descriptor name it.
12
6
  * @param {string} docPath
@@ -200,15 +200,6 @@ function moduleSpecifiers(file, jscodeshift) {
200
200
  return specifiers;
201
201
  }
202
202
 
203
- /**
204
- * Every module a theme source file imports or re-exports, as written.
205
- * @param {string} file
206
- * @returns {string[]}
207
- */
208
- export function themeFileImports(file) {
209
- return moduleSpecifiers(file, sourceParser());
210
- }
211
-
212
203
  /**
213
204
  * Validate that every local static dependency is copied with the theme.
214
205
  * @param {string} file
@@ -65,7 +65,7 @@ const RUNNERS = {
65
65
  sites: [
66
66
  '.evalModule() ×2',
67
67
  '.import()',
68
- 'createJiti ×5',
68
+ 'createJiti ×4',
69
69
  'eval ×2',
70
70
  'import(<computed>) ×3',
71
71
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.5-canary.d6da8e4",
3
+ "version": "0.6.5-canary.e5d11eb",
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.6.5-canary.d6da8e4",
105
- "@astryxdesign/core": "0.6.5-canary.d6da8e4",
106
- "@astryxdesign/lab": "0.6.5-canary.d6da8e4",
107
- "@astryxdesign/theme-neutral": "0.6.5-canary.d6da8e4"
104
+ "@astryxdesign/charts": "0.6.5-canary.e5d11eb",
105
+ "@astryxdesign/core": "0.6.5-canary.e5d11eb",
106
+ "@astryxdesign/lab": "0.6.5-canary.e5d11eb",
107
+ "@astryxdesign/theme-neutral": "0.6.5-canary.e5d11eb"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.6.5-canary.d6da8e4",
125
- "@astryxdesign/core": "0.6.5-canary.d6da8e4",
126
- "@astryxdesign/lab": "0.6.5-canary.d6da8e4",
127
- "@astryxdesign/theme-neutral": "0.6.5-canary.d6da8e4",
124
+ "@astryxdesign/charts": "0.6.5-canary.e5d11eb",
125
+ "@astryxdesign/core": "0.6.5-canary.e5d11eb",
126
+ "@astryxdesign/lab": "0.6.5-canary.e5d11eb",
127
+ "@astryxdesign/theme-neutral": "0.6.5-canary.e5d11eb",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",
@@ -1,82 +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
- /**
5
- * The Porter stem of a lowercase word.
6
- * @param {string} word
7
- * @returns {string}
8
- */
9
- export function stem(word: string): string;
10
- /**
11
- * Lowercase words of an idea that can carry weight: letters only, two or more.
12
- * @param {string} idea
13
- * @returns {string[]}
14
- */
15
- export function weightWords(idea: string): string[];
16
- /**
17
- * Where an idea starts, by the blended weights.
18
- * @param {string} idea
19
- * @param {import('./rank.mjs').RankedPage[]} ranked the ranker's output for the idea
20
- * @param {import('./rank.mjs').RankedPage | null} pick the ranker's own start
21
- * @param {{name: string}[]} catalog the project's ready page templates
22
- * @param {{weights?: WeightsFile | null, newPage?: boolean}} [options]
23
- * `newPage`: the idea asks for a new page (rank.mjs `asksForNewPage`)
24
- * @returns {string | null | undefined} a template id, null for the app shell,
25
- * undefined without weights
26
- */
27
- export function weighStart(idea: string, ranked: import("./rank.mjs").RankedPage[], pick: import("./rank.mjs").RankedPage | null, catalog: {
28
- name: string;
29
- }[], { weights, newPage }?: {
30
- weights?: WeightsFile | null;
31
- newPage?: boolean;
32
- }): string | null | undefined;
33
- /**
34
- * @file Word weights for `build`'s START (spec:AST-048): a checked-in table of
35
- * per-template word weights, blended with the page ranker's own scores, picks
36
- * the template an idea starts from.
37
- *
38
- * @input An idea, the ranker's output for it (`rankPages`, `pickStart`), the
39
- * project's ready page templates, and the weights (`weights.json` beside this
40
- * file, read by the adapter): the candidates (the app shell as `SHELL`, then page template ids), one or more
41
- * word tables (stemmed words, a bias per candidate, and one row of weights
42
- * per word, a character per candidate) and the blend numbers.
43
- * @output `weighStart(idea, ranked, pick, catalog)`: the template id to start
44
- * from, null for the app shell, or undefined when no table is available, in
45
- * which case the ranker's own pick stands.
46
- * @position Beside rank.mjs (api/build/kit/); kit.mjs calls it for every
47
- * whole page (a part or an edit follows the ranker's placement rules). The
48
- * ranker's pick of a template the tables do not list stands, so a new
49
- * template can start a build.
50
- */
51
- /** The app shell, as one candidate. */
52
- export const SHELL: "SHELL";
53
- export type WeightTable = {
54
- /**
55
- * stemmed words
56
- */
57
- words: string[];
58
- /**
59
- * one per candidate
60
- */
61
- bias: number[];
62
- clip: number;
63
- step: number;
64
- /**
65
- * one per word: a character per candidate,
66
- * weight = (charCode - 97) * step - clip
67
- */
68
- rows: string[];
69
- };
70
- export type WeightsFile = {
71
- version: number;
72
- /**
73
- * `SHELL`, then page template ids
74
- */
75
- candidates: string[];
76
- tables: WeightTable[];
77
- /**
78
- * three numbers per member (the tables, in order,
79
- * with the ranker second), then one for `SHELL`
80
- */
81
- blend: number[];
82
- };