@astryxdesign/cli 0.6.5-canary.4b7cb3a → 0.6.5-canary.5058d27

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 (37) hide show
  1. package/README.md +2 -2
  2. package/api/gap-report/gap-report.d.mts +1 -3
  3. package/api/gap-report/gap-report.mjs +2 -12
  4. package/api/gap-report/gap-report.test.mjs +0 -106
  5. package/api/search/search.d.mts +4 -4
  6. package/api/search/search.doc.mjs +4 -4
  7. package/api/search/search.mjs +20 -79
  8. package/api/search/search.test.mjs +7 -9
  9. package/api/search/search.type.d.mts +5 -5
  10. package/api/search/search.type.mjs +5 -5
  11. package/api/theme/build/build.mjs +69 -146
  12. package/api/theme/build/build.test.mjs +1 -190
  13. package/api/theme/themeBuild.doc.d.mts +1 -4
  14. package/api/theme/themeBuild.doc.mjs +3 -14
  15. package/assets/docs/theme.doc.mjs +1 -2
  16. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  17. package/clients/cli/commands/build-theme.mjs +2 -8
  18. package/clients/cli/commands/discover.mjs +1 -29
  19. package/clients/cli/commands/gap-report.mjs +0 -12
  20. package/clients/cli/commands/gap-report.test.mjs +0 -63
  21. package/clients/cli/commands/search.doc.mjs +4 -5
  22. package/clients/cli/commands/search.mjs +6 -30
  23. package/clients/cli/commands/search.test.mjs +4 -39
  24. package/foundation/agent-docs/agent-docs.mjs +1 -2
  25. package/foundation/agent-docs/agent-docs.test.mjs +0 -8
  26. package/foundation/doc-compiler/doc-loads.test.mjs +1 -1
  27. package/package.json +9 -9
  28. package/api/theme/build/build.icon-lineage.test.mjs +0 -117
  29. package/api/theme/build/build.icon-preservation.test.mjs +0 -639
  30. package/api/theme/build/icon-imports.d.mts +0 -47
  31. package/api/theme/build/icon-imports.mjs +0 -691
  32. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +0 -15
  33. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +0 -38
  34. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +0 -20
  35. package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +0 -48
  36. package/clients/cli/commands/discover.no-source.test.mjs +0 -75
  37. package/clients/cli/commands/theme-list.behavior.test.mjs +0 -41
package/README.md CHANGED
@@ -69,7 +69,7 @@ Results for "button" (20 of 239):
69
69
 
70
70
  Options:
71
71
 
72
- - `--type <component|hook|doc|template|theme>`: restrict to a single domain (`doc` and `theme` work outside an app too)
72
+ - `--type <component|hook|doc|template>`: restrict to a single domain
73
73
  - `--limit <n>`: cap the number of results (default 20)
74
74
  - `--verbose`: also print each result's match score and reason
75
75
  - `--json`: typed `{ apiVersion, type: 'search', data: { query, matchCount, results } }` envelope — `matchCount` is how many candidates matched in total, `results` the slice `--limit` allowed
@@ -91,7 +91,7 @@ Options:
91
91
  | `init` | Initialize the design system in your project |
92
92
  | `integration` | Author and verify an Astryx integration package |
93
93
  | `layout` | Generate XDS layouts from compressed expressions (XLE/XLO) |
94
- | `search` | Search components, hooks, docs, templates, and themes in one ranked list |
94
+ | `search` | Search components, hooks, docs, and templates in one ranked list |
95
95
  | `swizzle` | Copy component source for customization |
96
96
  | `template` | List, show, or scaffold page and block templates |
97
97
  | `theme` | Create and build themes: add a shipped one, compile to CSS, or list what a theme can override |
@@ -4,9 +4,7 @@
4
4
  /**
5
5
  * Collect the effective handler set in delivery order: project config first,
6
6
  * then integrations in config order. Valid handlers dedupe by handle identity;
7
- * malformed integration exports and integrations that failed to load retain
8
- * their position as failed deliveries. An unloadable integration may export a
9
- * handler, so it never counts as an empty set that enables the fallback.
7
+ * malformed integration exports retain their position as failed deliveries.
10
8
  *
11
9
  * @param {Project} project
12
10
  * @returns {HandlerEntry[]}
@@ -189,9 +189,7 @@ async function selectTarget(project, component, packageName) {
189
189
  /**
190
190
  * Collect the effective handler set in delivery order: project config first,
191
191
  * then integrations in config order. Valid handlers dedupe by handle identity;
192
- * malformed integration exports and integrations that failed to load retain
193
- * their position as failed deliveries. An unloadable integration may export a
194
- * handler, so it never counts as an empty set that enables the fallback.
192
+ * malformed integration exports retain their position as failed deliveries.
195
193
  *
196
194
  * @param {Project} project
197
195
  * @returns {HandlerEntry[]}
@@ -216,15 +214,7 @@ export function collectGapReportHandlers(project) {
216
214
  }
217
215
 
218
216
  for (const integration of project.loadedIntegrations) {
219
- if (integration.__loadError) {
220
- entries.push({
221
- kind: 'malformed',
222
- handlerType: 'integration',
223
- handlerName: integration.name,
224
- error: `Integration failed to load, so it could not receive this report: ${integration.__loadError}. Fix the package or remove it from integrations in astryx.config, then rerun.`,
225
- });
226
- continue;
227
- }
217
+ if (integration.__loadError) continue;
228
218
  if (integration.__gapReportError) {
229
219
  entries.push({
230
220
  kind: 'malformed',
@@ -105,45 +105,6 @@ function addIntegration({
105
105
  return {dir};
106
106
  }
107
107
 
108
- /**
109
- * Add an integration whose module throws on import, so it never loads.
110
- * @param {string} name
111
- */
112
- function addBrokenIntegration(name) {
113
- const dir = packageDir(name);
114
- fs.mkdirSync(dir, {recursive: true});
115
- fs.writeFileSync(
116
- path.join(dir, 'package.json'),
117
- JSON.stringify({name, version: '1.0.0', type: 'module'}),
118
- );
119
- fs.writeFileSync(
120
- path.join(dir, 'astryx.integration.mjs'),
121
- "throw new Error('intentional integration load failure');\n",
122
- );
123
- }
124
-
125
- /**
126
- * Put a fake `gh` first on PATH that records its arguments if it is called.
127
- * @returns {string} the file the fake writes when invoked
128
- */
129
- function stubGh() {
130
- const binDir = path.join(projectDir, 'bin');
131
- const argsFile = path.join(projectDir, 'gh-args.json');
132
- fs.mkdirSync(binDir, {recursive: true});
133
- fs.writeFileSync(
134
- path.join(binDir, 'gh'),
135
- `#!/usr/bin/env node
136
- import fs from 'node:fs';
137
- fs.writeFileSync(${JSON.stringify(argsFile)}, JSON.stringify(process.argv.slice(2)));
138
- console.log('https://github.com/acme/core/issues/42');
139
- `,
140
- {mode: 0o755},
141
- );
142
- fs.chmodSync(path.join(binDir, 'gh'), 0o755);
143
- vi.stubEnv('PATH', `${binDir}${path.delimiter}${process.env.PATH ?? ''}`);
144
- return argsFile;
145
- }
146
-
147
108
  const reportOptions = {
148
109
  category: 'missing_variant',
149
110
  reason: 'Need a compact size',
@@ -720,73 +681,6 @@ describe('gapReport handler isolation', () => {
720
681
  });
721
682
  });
722
683
 
723
- it('an integration that fails to load is a failed delivery, not a missing handler', async () => {
724
- addBrokenIntegration('@test/broken');
725
- configure(['@test/broken'], {
726
- issuesUrl: 'https://github.com/acme/core/issues/new',
727
- });
728
-
729
- const result = await gapReport('General', {
730
- ...reportOptions,
731
- cwd: projectDir,
732
- });
733
-
734
- expect(result.data.status).toBe('failed');
735
- expect(result.data.deliveries).toEqual([
736
- {
737
- handlerType: 'integration',
738
- handler: '@test/broken',
739
- audience: null,
740
- status: 'failed',
741
- url: null,
742
- message: expect.stringContaining(
743
- 'intentional integration load failure',
744
- ),
745
- },
746
- ]);
747
- });
748
-
749
- it('an integration that fails to load keeps the public fallback off, even with consent', async () => {
750
- addBrokenIntegration('@test/broken');
751
- configure(['@test/broken'], {
752
- issuesUrl: 'https://github.com/acme/core/issues/new',
753
- });
754
- const argsFile = stubGh();
755
-
756
- const result = await gapReport('General', {
757
- ...reportOptions,
758
- confirmPublic: true,
759
- cwd: projectDir,
760
- });
761
-
762
- expect(result.data.status).toBe('failed');
763
- expect(result.data.deliveries.map(d => d.handlerType)).toEqual([
764
- 'integration',
765
- ]);
766
- expect(fs.existsSync(argsFile)).toBe(false);
767
- });
768
-
769
- it('an integration that fails to load keeps its place beside working handlers', async () => {
770
- addBrokenIntegration('@test/broken');
771
- addIntegration({
772
- name: '@test/valid',
773
- audience: 'internal',
774
- handleBody: "return {status: 'filed', message: 'ok'};",
775
- });
776
- configure(['@test/broken', '@test/valid']);
777
-
778
- const result = await gapReport('General', {
779
- ...reportOptions,
780
- cwd: projectDir,
781
- });
782
-
783
- expect(result.data.status).toBe('partial');
784
- expect(result.data.deliveries.map(d => [d.handler, d.status])).toEqual([
785
- ['@test/broken', 'failed'],
786
- ['@test/valid', 'filed'],
787
- ]);
788
- });
789
-
790
684
  it('invalid handler receipt is recorded as failed delivery', async () => {
791
685
  addIntegration({
792
686
  name: '@test/bad-receipt',
@@ -115,18 +115,18 @@ export function componentKeywords(coreDir: string, cwd: string): Promise<{
115
115
  keywords: string[];
116
116
  }[]>;
117
117
  /**
118
- * Unified ranked search across components, hooks, docs, templates, and themes.
118
+ * Unified ranked search across components, hooks, docs, and templates.
119
119
  *
120
120
  * @param {string} query - Free-text search term.
121
121
  * @param {object} [options]
122
122
  * @param {string} [options.cwd]
123
- * @param {'component'|'hook'|'doc'|'template'|'theme'} [options.type] - Restrict to one domain.
123
+ * @param {'component'|'hook'|'doc'|'template'} [options.type] - Restrict to one domain.
124
124
  * @param {number} [options.limit] - Max results (default 20).
125
125
  * @returns {Promise<import('./search.type.mjs').SearchResponse>}
126
126
  */
127
127
  export function search(query: string, options?: {
128
128
  cwd?: string | undefined;
129
- type?: "theme" | "component" | "hook" | "template" | "doc" | undefined;
129
+ type?: "component" | "hook" | "template" | "doc" | undefined;
130
130
  limit?: number | undefined;
131
131
  }): Promise<import("./search.type.mjs").SearchResponse>;
132
132
  export namespace SYNONYMS {
@@ -159,7 +159,7 @@ export const STOPWORDS: Set<string>;
159
159
  * prefixed fields carry domain-specific payload used only by {@link toResult}.
160
160
  */
161
161
  export type Candidate = {
162
- domain: "component" | "hook" | "doc" | "template" | "theme";
162
+ domain: "component" | "hook" | "doc" | "template";
163
163
  name: string;
164
164
  keywords?: string[] | undefined;
165
165
  weakKeywords?: string[] | undefined;
@@ -14,7 +14,7 @@ export const doc = {
14
14
  namespace: 'cli/api',
15
15
  displayName: 'search()',
16
16
  summary:
17
- 'Unified ranked search across components, hooks, docs, templates, and themes.',
17
+ 'Unified ranked search across components, hooks, docs, and templates.',
18
18
  description:
19
19
  'The single "I\'m looking for X" entry point across every content domain. ' +
20
20
  'Ranking is keyword + fuzzy (not embeddings); name and keyword signals outrank ' +
@@ -35,7 +35,7 @@ export const doc = {
35
35
  },
36
36
  {
37
37
  name: 'options.type',
38
- type: "'component' | 'hook' | 'doc' | 'template' | 'theme'",
38
+ type: "'component' | 'hook' | 'doc' | 'template'",
39
39
  description: 'Restrict results to a single domain.',
40
40
  },
41
41
  {
@@ -48,14 +48,14 @@ export const doc = {
48
48
  name: 'options.cwd',
49
49
  type: 'string',
50
50
  description:
51
- "Directory to resolve @astryxdesign/core from. A docs-only or themes-only search (`type: 'doc'` or `type: 'theme'`) does not need it, and a search with no `type` covers the docs and themes alone when core is missing.",
51
+ "Directory to resolve @astryxdesign/core from. A docs-only search (`type: 'doc'`) does not need it, and a search with no `type` covers the docs alone when core is missing.",
52
52
  },
53
53
  ],
54
54
  returns: [
55
55
  {
56
56
  type: 'search',
57
57
  description:
58
- 'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, `displayName` and `kind` for templates, and `displayName` for themes. A doc result is the smallest part that answers: one section (with `section`, and a command that reads only it), one docs-tree route, or a topic, whose command lists its sections. `parent` is the command that opens the level above it: the section list of its topic, the namespace a tree node sits in, the Unorganized level for a flat topic, or the topic list for a top-level namespace. Every doc result also carries `package`, the npm package that authored it (for a section, the package its file came from). A theme result is one theme you can add: `name` is its slug, its command is the `astryx theme add` that copies it into the app, and `package` is the npm package that ships it (`@astryxdesign/cli` for the CLI\'s own themes).',
58
+ 'The query echoed back, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit`: each has domain, name, score, reason, description, and follow-up command, plus `import` for components and hooks, `title` for docs, and `displayName` and `kind` for templates. A doc result is the smallest part that answers: one section (with `section`, and a command that reads only it), one docs-tree route, or a topic, whose command lists its sections. `parent` is the command that opens the level above it: the section list of its topic, the namespace a tree node sits in, the Unorganized level for a flat topic, or the topic list for a top-level namespace. Every doc result also carries `package`, the npm package that authored it (for a section, the package its file came from).',
59
59
  },
60
60
  ],
61
61
  throws: [
@@ -7,10 +7,10 @@
7
7
  * outputs. The CLI command handler is a thin wrapper around this function.
8
8
  *
9
9
  * `search(query)` is the single "I'm looking for X" entry point across ALL
10
- * content domains — components, hooks, docs topics, templates (page + block),
11
- * and themes. Finding the right thing otherwise takes separate list calls
12
- * (`component --list`, `hook --list`, `docs`, `template --list`, `theme list`)
13
- * plus manual scanning; this collapses them into one ranked, typed result set.
10
+ * content domains — components, hooks, docs topics, and templates (page +
11
+ * block). Today, finding the right thing requires four separate list calls
12
+ * (`component --list`, `hook --list`, `docs`, `template --list`) plus manual
13
+ * scanning; this collapses them into one ranked, typed result set.
14
14
  *
15
15
  * Scoring is keyword + fuzzy ranking (NOT semantic / embeddings — that is a
16
16
  * deliberate future follow-up). It reuses the same signal weighting as the
@@ -89,7 +89,6 @@ import {loadIntegrationsSafely} from '../component/_adapter.mjs';
89
89
  import {levenshteinDistance} from '../../foundation/text/string-utils.mjs';
90
90
  import {discoverTemplates, extractComponents} from '../template/template.mjs';
91
91
  import {templateLookupIds} from '../../foundation/discovery/template-adapter.mjs';
92
- import {listAvailableThemes} from '../theme/_adapter.mjs';
93
92
  import {
94
93
  guideEntry,
95
94
  loadDocsCatalog,
@@ -111,7 +110,7 @@ import {setResultCoverage} from './coverage.mjs';
111
110
  * A search candidate gathered from one content domain. Extra underscore-
112
111
  * prefixed fields carry domain-specific payload used only by {@link toResult}.
113
112
  * @typedef {object} Candidate
114
- * @property {'component'|'hook'|'doc'|'template'|'theme'} domain
113
+ * @property {'component'|'hook'|'doc'|'template'} domain
115
114
  * @property {string} name
116
115
  * @property {string[]} [keywords]
117
116
  * @property {string[]} [weakKeywords]
@@ -292,13 +291,7 @@ const isTypo = (a, b, dist) =>
292
291
  TYPO_MIN_LENGTH[/** @type {1 | 2 | 3} */ (dist)];
293
292
 
294
293
  /** Valid domain filters for `--type`. */
295
- export const SEARCH_DOMAINS = ['component', 'hook', 'doc', 'template', 'theme'];
296
-
297
- /**
298
- * The domains a search reads without @astryxdesign/core. An open search outside
299
- * an app covers these alone.
300
- */
301
- const CORELESS_DOMAINS = ['doc', 'theme'];
294
+ export const SEARCH_DOMAINS = ['component', 'hook', 'doc', 'template'];
302
295
 
303
296
  /**
304
297
  * Filler words stripped from multi-word queries so natural-language phrasing
@@ -625,7 +618,6 @@ export function scoreQuery(term, tokens, candidate) {
625
618
  // strong hits, then reward coverage so candidates matching more terms win.
626
619
  let strongest = 0;
627
620
  let matched = 0;
628
- let tokenSum = 0;
629
621
  /** @type {string[]} */
630
622
  const hitTerms = [];
631
623
  for (const tok of tokens) {
@@ -634,7 +626,6 @@ export function scoreQuery(term, tokens, candidate) {
634
626
  if (h.score > strongest) strongest = h.score;
635
627
  matched++;
636
628
  hitTerms.push(tok);
637
- tokenSum += h.score;
638
629
  }
639
630
  }
640
631
  // The reverse of the title tier, a step lower: the query holds a whole title
@@ -659,25 +650,14 @@ export function scoreQuery(term, tokens, candidate) {
659
650
  // (50 + bonus + coverage = 77) lost to thirty docs that each match
660
651
  // `integration` alone, by name or in a code tick (98-108). The reader asked for
661
652
  // both; a candidate that has both comes first, ordered among its peers by
662
- // how strong its matches are. It needs one keyword-strength hit:
653
+ // how strong its strongest match is. It needs one keyword-strength hit:
663
654
  // every word mentioned in prose, or rendered by a page, is breadth, and
664
655
  // stays on the token sum below an exact hit on one word.
665
- //
666
- // The TOTAL quality of matches orders candidates within this tier, not
667
- // just the strongest single hit. A doc matching both words by keyword
668
- // (90 + 90 = 180) outranks one matching keyword + prose (90 + 50 = 140).
669
- // Before this, every all-word match whose strongest hit was a keyword (90)
670
- // scored 157, burying the better match among dozens of ties.
671
656
  if (matched === tokens.length && strongest >= STRONG_TOKEN_SCORE) {
672
657
  return {
673
658
  score:
674
659
  FULL_COVERAGE_SCORE +
675
- Math.min(
676
- Math.floor(
677
- (tokenSum - matched * MIN_TOKEN_SCORE) / (matched * 5),
678
- ),
679
- 8,
680
- ),
660
+ Math.floor((strongest - MIN_TOKEN_SCORE) / 6.25),
681
661
  reason,
682
662
  matched,
683
663
  total,
@@ -1483,33 +1463,6 @@ async function gatherTemplates(cwd) {
1483
1463
  });
1484
1464
  }
1485
1465
 
1486
- /**
1487
- * Build theme candidates from bundled and integration-provided themes. Without
1488
- * this, an integration's themes are invisible to `search` even though
1489
- * `theme list` and `discover` already resolve them.
1490
- * @param {string} cwd
1491
- * @returns {Promise<Candidate[]>}
1492
- */
1493
- async function gatherThemes(cwd) {
1494
- let themes;
1495
- try {
1496
- themes = await listAvailableThemes(cwd);
1497
- } catch {
1498
- return [];
1499
- }
1500
- return themes.map(t => ({
1501
- domain: 'theme',
1502
- name: t.slug,
1503
- keywords: [
1504
- t.displayName,
1505
- ...(t.description ? t.description.split(/[^A-Za-z0-9]+/).filter(w => w.length > 3) : []),
1506
- ],
1507
- description: t.description || '',
1508
- _displayName: t.displayName,
1509
- _package: t.package,
1510
- }));
1511
- }
1512
-
1513
1466
  /**
1514
1467
  * Map a scored candidate to its public, actionable result shape. Each result
1515
1468
  * carries enough to act on it: the domain, name, a one-line description, and
@@ -1566,14 +1519,6 @@ function toResult(c, score, reason, matchedTerms, queryTerms) {
1566
1519
  command: `astryx template ${c._commandName ?? c.name} --type ${c._kind}`,
1567
1520
  };
1568
1521
  break;
1569
- case 'theme':
1570
- result = {
1571
- ...base,
1572
- displayName: c._displayName,
1573
- command: `astryx theme add ${c.name}`,
1574
- ...(c._package ? {package: c._package} : {}),
1575
- };
1576
- break;
1577
1522
  default:
1578
1523
  result = base;
1579
1524
  }
@@ -1581,12 +1526,12 @@ function toResult(c, score, reason, matchedTerms, queryTerms) {
1581
1526
  }
1582
1527
 
1583
1528
  /**
1584
- * Unified ranked search across components, hooks, docs, templates, and themes.
1529
+ * Unified ranked search across components, hooks, docs, and templates.
1585
1530
  *
1586
1531
  * @param {string} query - Free-text search term.
1587
1532
  * @param {object} [options]
1588
1533
  * @param {string} [options.cwd]
1589
- * @param {'component'|'hook'|'doc'|'template'|'theme'} [options.type] - Restrict to one domain.
1534
+ * @param {'component'|'hook'|'doc'|'template'} [options.type] - Restrict to one domain.
1590
1535
  * @param {number} [options.limit] - Max results (default 20).
1591
1536
  * @returns {Promise<import('./search.type.mjs').SearchResponse>}
1592
1537
  */
@@ -1623,14 +1568,12 @@ export async function search(query, options = {}) {
1623
1568
  const term = String(query).trim().toLowerCase();
1624
1569
  const tokens = tokenizeQuery(term);
1625
1570
 
1626
- // `astryx docs` reads docs without @astryxdesign/core, and `astryx theme
1627
- // list` reads themes without it (bundled themes need no project), so a
1628
- // search of either must too. Every other domain reads core: asked for by
1629
- // name, it is an error without core; an open search then covers the docs
1630
- // and themes alone.
1631
- const needsCore = !type || !CORELESS_DOMAINS.includes(type);
1632
- const coreDir = needsCore ? findCoreDir(cwd) : null;
1633
- if (type && needsCore && !coreDir) {
1571
+ // `astryx docs` reads docs without @astryxdesign/core, so a docs-only
1572
+ // search must too. Every other domain reads core: asked for by name, it is
1573
+ // an error without core; an open search then covers the docs alone.
1574
+ const docsOnly = type === 'doc';
1575
+ const coreDir = docsOnly ? null : findCoreDir(cwd);
1576
+ if (type && !docsOnly && !coreDir) {
1634
1577
  throw new AstryxError(
1635
1578
  'Could not find @astryxdesign/core package',
1636
1579
  undefined,
@@ -1640,19 +1583,17 @@ export async function search(query, options = {}) {
1640
1583
 
1641
1584
  // Gather candidates from each requested domain in parallel.
1642
1585
  /** @param {string} d */
1643
- const wants = d =>
1644
- (!type && (coreDir != null || CORELESS_DOMAINS.includes(d))) || type === d;
1645
- const [components, hooks, docTopics, templates, themes] = await Promise.all([
1586
+ const wants = d => (!type && (coreDir != null || d === 'doc')) || type === d;
1587
+ const [components, hooks, docTopics, templates] = await Promise.all([
1646
1588
  wants('component')
1647
1589
  ? gatherComponents(/** @type {string} */ (coreDir), cwd)
1648
1590
  : [],
1649
1591
  wants('hook') ? gatherHooks(/** @type {string} */ (coreDir)) : [],
1650
1592
  wants('doc') ? gatherDocs(cwd) : [],
1651
1593
  wants('template') ? gatherTemplates(cwd) : [],
1652
- wants('theme') ? gatherThemes(cwd) : [],
1653
1594
  ]);
1654
1595
 
1655
- const all = [...components, ...hooks, ...docTopics, ...templates, ...themes];
1596
+ const all = [...components, ...hooks, ...docTopics, ...templates];
1656
1597
 
1657
1598
  // Score every candidate on its own merits. The consumer groups results by
1658
1599
  // role (page / block / component) and takes the top of each, so there's no
@@ -1669,7 +1610,7 @@ export async function search(query, options = {}) {
1669
1610
 
1670
1611
  // Sort by score desc, then domain (stable order), then name.
1671
1612
  /** @type {Record<string, number>} */
1672
- const domainOrder = {component: 0, hook: 1, doc: 2, template: 3, theme: 4};
1613
+ const domainOrder = {component: 0, hook: 1, doc: 2, template: 3};
1673
1614
  scored.sort(
1674
1615
  (a, b) =>
1675
1616
  b.score - a.score ||
@@ -75,7 +75,7 @@ describe('search leaf — envelope + ranking', () => {
75
75
  });
76
76
 
77
77
  describe('search leaf — per-domain result fields', () => {
78
- it('carries import for components and hooks, title for docs, displayName and kind for templates, displayName for themes', async () => {
78
+ it('carries import for components and hooks, title for docs, displayName and kind for templates', async () => {
79
79
  const r = await search('theme', {cwd, limit: 60});
80
80
  expect(new Set(r.data.results.map(res => res.domain))).toEqual(
81
81
  new Set(SEARCH_DOMAINS),
@@ -89,12 +89,9 @@ describe('search leaf — per-domain result fields', () => {
89
89
  expect(res.title).toMatch(/\S/);
90
90
  const read = `astryx docs ${res.name}`;
91
91
  expect([read, `${read} --index`, `${read} ${res.section}`]).toContain(res.command);
92
- } else if (res.domain === 'template') {
92
+ } else {
93
93
  expect(res.displayName).toMatch(/\S/);
94
94
  expect(['page', 'block']).toContain(res.kind);
95
- } else if (res.domain === 'theme') {
96
- expect(res.displayName).toMatch(/\S/);
97
- expect(res.command).toMatch(/^astryx theme add /);
98
95
  }
99
96
  }
100
97
  }, SLOW);
@@ -400,10 +397,11 @@ describe('search leaf — a candidate that matches every word outranks a partial
400
397
  expect(score(q, all)).toBeLessThan(160);
401
398
  });
402
399
 
403
- // Among candidates that match every word, the stronger match comes first:
404
- // the all-words tier uses total match quality (sum of token scores), not
405
- // just the strongest, so an exact keyword outranks a stem-form keyword.
406
- it('ranks the stronger of two all-word matches first', () => {
400
+ // Among candidates that match every word, the stronger match should come
401
+ // first. Today every all-word match with a keyword hit gets the same score,
402
+ // so this records the order without enforcing it: it fails, as expected,
403
+ // until the scoring tells the two apart.
404
+ it.fails('ranks the stronger of two all-word matches first', () => {
407
405
  const all = {name: 'x', keywords: ['alphas'], description: 'alpha beta gamma delta'};
408
406
  const q = 'alpha beta gamma delta';
409
407
  expect(score(q, {name: 'y', keywords: ['alpha'], description: 'beta gamma delta'})).toBeGreaterThan(
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * The domain a search result belongs to.
6
6
  */
7
- export type SearchDomain = "component" | "hook" | "doc" | "template" | "theme";
7
+ export type SearchDomain = "component" | "hook" | "doc" | "template";
8
8
  /**
9
9
  * A single ranked search result, tagged with its domain.
10
10
  */
@@ -14,7 +14,7 @@ export type SearchResultEntry = {
14
14
  */
15
15
  domain: SearchDomain;
16
16
  /**
17
- * - Primary identifier (component/hook name, doc topic or docs-tree route, template dir, theme slug).
17
+ * - Primary identifier (component/hook name, doc topic or docs-tree route, template dir).
18
18
  */
19
19
  name: string;
20
20
  /**
@@ -30,7 +30,7 @@ export type SearchResultEntry = {
30
30
  */
31
31
  description: string;
32
32
  /**
33
- * - Follow-up command to act on this result (e.g. `astryx component Button`, or `astryx theme add neutral` for a theme).
33
+ * - Follow-up command to act on this result (e.g. `astryx component Button`).
34
34
  */
35
35
  command: string;
36
36
  /**
@@ -46,7 +46,7 @@ export type SearchResultEntry = {
46
46
  */
47
47
  section?: string | undefined;
48
48
  /**
49
- * - The npm package that authored a doc result (for a section, the package whose file the section came from), or that ships a theme result.
49
+ * - The npm package that authored a doc result; for a section, the package whose file the section came from.
50
50
  */
51
51
  package?: string | undefined;
52
52
  /**
@@ -54,7 +54,7 @@ export type SearchResultEntry = {
54
54
  */
55
55
  parent?: string | undefined;
56
56
  /**
57
- * - Friendly display name — present for template and theme results.
57
+ * - Friendly display name — present for template results.
58
58
  */
59
59
  displayName?: string | undefined;
60
60
  /**
@@ -9,24 +9,24 @@
9
9
 
10
10
  /**
11
11
  * The domain a search result belongs to.
12
- * @typedef {'component' | 'hook' | 'doc' | 'template' | 'theme'} SearchDomain
12
+ * @typedef {'component' | 'hook' | 'doc' | 'template'} SearchDomain
13
13
  */
14
14
 
15
15
  /**
16
16
  * A single ranked search result, tagged with its domain.
17
17
  * @typedef {object} SearchResultEntry
18
18
  * @property {SearchDomain} domain - Which content domain this result came from.
19
- * @property {string} name - Primary identifier (component/hook name, doc topic or docs-tree route, template dir, theme slug).
19
+ * @property {string} name - Primary identifier (component/hook name, doc topic or docs-tree route, template dir).
20
20
  * @property {number} score - Relevance score (higher is better).
21
21
  * @property {string} reason - Human-readable reason the candidate matched (e.g. `keyword "button"`).
22
22
  * @property {string} description - One-line description, when available.
23
- * @property {string} command - Follow-up command to act on this result (e.g. `astryx component Button`, or `astryx theme add neutral` for a theme).
23
+ * @property {string} command - Follow-up command to act on this result (e.g. `astryx component Button`).
24
24
  * @property {string} [import] - Import path — present for component and hook results.
25
25
  * @property {string} [title] - Doc title — present for doc results.
26
26
  * @property {string} [section] - Section key — present when a doc result is one section of a topic; `command` reads only that section.
27
- * @property {string} [package] - The npm package that authored a doc result (for a section, the package whose file the section came from), or that ships a theme result.
27
+ * @property {string} [package] - The npm package that authored a doc result; for a section, the package whose file the section came from.
28
28
  * @property {string} [parent] - Command that opens the level above a doc result — its topic's section list for a section, the docs-tree namespace it sits in for a tree node — so a reader can see the siblings and open another.
29
- * @property {string} [displayName] - Friendly display name — present for template and theme results.
29
+ * @property {string} [displayName] - Friendly display name — present for template results.
30
30
  * @property {'page' | 'block'} [kind] - Template kind (`page` | `block`) — present for template results.
31
31
  */
32
32