@astryxdesign/cli 0.6.5-canary.8d216bb → 0.6.5-canary.91d1017

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 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 |
@@ -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
 
@@ -6,9 +6,8 @@ export const docs = {
6
6
  name: 'theme',
7
7
  title: 'Theme System',
8
8
  category: 'guide',
9
- keywords: ['use', 'apply', 'setup'],
10
9
  description:
11
- 'How to use and apply themes in your app: providers, custom themes, light/dark mode, production builds, and component style overrides.',
10
+ 'Theme provider, custom themes, theme build for production/SSR, light/dark mode, and component style overrides.',
12
11
 
13
12
  sections: [
14
13
  {
@@ -209,16 +209,11 @@ async function warnOnThemeIntegrationIssues(json) {
209
209
  * @param {import('../../../api/theme/theme.type.mjs').ThemeListEntry[]} themes
210
210
  */
211
211
  function printThemeList(themes) {
212
- const run = getCliInvocation();
213
- // `theme list` shows what this project can add now. Themes in packages it
214
- // has not installed are `discover`'s.
215
- const more = text(
216
- `More themes in packages you could add: ${run} discover theme`,
217
- );
218
212
  if (themes.length === 0) {
219
- emit(text('No themes are available in this project.'), more);
213
+ emit(text('No themes are available in this project.'));
220
214
  return;
221
215
  }
216
+ const run = getCliInvocation();
222
217
  emit(
223
218
  section('Themes'),
224
219
  list(
@@ -231,7 +226,6 @@ function printThemeList(themes) {
231
226
  text(
232
227
  `Usage:\n ${run} theme add <slug> [target-path] Scaffold a theme file you own`,
233
228
  ),
234
- more,
235
229
  );
236
230
  }
237
231
 
@@ -268,47 +268,19 @@ export function registerDiscover(program) {
268
268
  // No discover source: the list of what this project has, as always.
269
269
  if (available === undefined) {
270
270
  if (result.data.length === 0) {
271
- if (options.available) {
272
- // The user specifically asked for available packages but
273
- // there is no source to answer from. Say so honestly.
274
- emit(
275
- text('No discover source is configured.'),
276
- text(
277
- [
278
- 'Available integrations are listed by discover sources.',
279
- 'A project can set one in astryx.config.mjs, and installed',
280
- 'integrations can provide one.',
281
- ].join(' '),
282
- ),
283
- text(
284
- [
285
- `Find Astryx packages on npm: npm search @astryxdesign`,
286
- `Learn more: ${run} docs cli/integrations`,
287
- ].join('\n'),
288
- ),
289
- );
290
- } else if (result.meta && result.meta.configured === false) {
271
+ if (result.meta && result.meta.configured === false) {
291
272
  emit(
292
273
  text('No integrations configured.'),
293
274
  text('Add integration package names to astryx.config.mjs:'),
294
275
  code(
295
276
  "export default {\n integrations: ['@scope/your-integration'],\n};",
296
277
  ),
297
- text(
298
- [
299
- `Find Astryx packages on npm: npm search @astryxdesign`,
300
- `Learn more: ${run} docs cli/integrations`,
301
- ].join('\n'),
302
- ),
303
278
  );
304
279
  } else {
305
280
  emit(
306
281
  text(
307
282
  'No external components found in configured integrations.',
308
283
  ),
309
- text(
310
- `Find more packages: ${run} discover --available (needs a discover source)`,
311
- ),
312
284
  );
313
285
  }
314
286
  break;
@@ -13,11 +13,11 @@ export const doc = {
13
13
  name: 'search',
14
14
  displayName: 'astryx search',
15
15
  namespace: 'cli/commands',
16
- summary: 'Search components, hooks, docs, templates, and themes in one ranked list',
16
+ summary: 'Search components, hooks, docs, and templates in one ranked list',
17
17
  description:
18
18
  'Terminal front-end to search(): prints one ranked, greppable list across ' +
19
19
  'every content domain, each row carrying a follow-up command to act on it. ' +
20
- 'Outside an app, where @astryxdesign/core is not installed, it searches the docs and themes.',
20
+ 'Outside an app, where @astryxdesign/core is not installed, it searches the docs.',
21
21
  fn: 'search',
22
22
  // Every word after `search` is the query: `astryx search dark mode` searches
23
23
  // for "dark mode", with no quotes needed.
@@ -26,8 +26,8 @@ export const doc = {
26
26
  {
27
27
  flag: '--type <domain>',
28
28
  param: 'options.type',
29
- choices: ['component', 'hook', 'doc', 'template', 'theme'],
30
- description: 'Filter to one domain (component|hook|doc|template|theme)',
29
+ choices: ['component', 'hook', 'doc', 'template'],
30
+ description: 'Filter to one domain (component|hook|doc|template)',
31
31
  },
32
32
  {
33
33
  flag: '--limit <n>',
@@ -49,7 +49,6 @@ export const doc = {
49
49
  label: 'Filter + JSON',
50
50
  cli: 'astryx search "data table" --type template --json',
51
51
  },
52
- {label: 'Themes you can add', cli: 'astryx search warm --type theme'},
53
52
  ],
54
53
  exitCodes: [
55
54
  {code: 0, when: 'success (including zero matches)'},
@@ -4,9 +4,9 @@
4
4
  * @file search command — unified ranked search with a stable result summary.
5
5
  *
6
6
  * One "I'm looking for X" entry point spanning components, hooks, docs topics,
7
- * templates (page + block), and themes. Results are ranked by relevance and
8
- * tagged with their domain, with a follow-up command so the user knows what to
9
- * run next.
7
+ * and templates (page + block). Results are ranked by relevance and tagged
8
+ * with their domain, with a follow-up command so the user knows what to run
9
+ * next.
10
10
  *
11
11
  * The command surface (description, args, flags) is sourced from the colocated
12
12
  * `search.doc.mjs` CommandDoc via `defineCommand`; this file supplies only the
@@ -104,13 +104,13 @@ export function registerSearch(program) {
104
104
  // ── Text output ──────────────────────────────────────────────
105
105
  const run = getCliInvocation();
106
106
  const {query: q, matchCount, results} = result.data;
107
- // Outside an app an open search covers the docs and themes alone. Say
108
- // so, so that list does not read as "Astryx has no such component".
107
+ // Outside an app an open search covers the docs alone. Say so, so a
108
+ // docs-only list does not read as "Astryx has no such component".
109
109
  const note =
110
110
  !options.type && !findCoreDir(process.cwd())
111
111
  ? [
112
112
  text(
113
- '@astryxdesign/core is not installed here, so only the docs and themes were searched.',
113
+ '@astryxdesign/core is not installed here, so only the docs were searched.',
114
114
  ),
115
115
  ]
116
116
  : [];
@@ -123,7 +123,6 @@ export function registerSearch(program) {
123
123
  text(
124
124
  `Try a broader term, or browse: ${run} ${note.length > 0 ? 'docs' : 'component --list'}`,
125
125
  ),
126
- ...discoverHint(run, q, options.type),
127
126
  );
128
127
  return answered;
129
128
  }
@@ -175,34 +174,11 @@ export function registerSearch(program) {
175
174
  format: {command: formatCliCommand, parent: formatCliCommand},
176
175
  }),
177
176
  ...note,
178
- ...discoverHint(run, q, options.type),
179
177
  );
180
178
  return answered;
181
179
  },
182
180
  });
183
181
  }
184
182
 
185
- /**
186
- * Search reads only what is installed. Point at `discover` for the packages
187
- * that could add more, except for hooks, which no integration adds.
188
- * @param {string} run - The caller's CLI invocation prefix.
189
- * @param {string} query
190
- * @param {string | undefined} type
191
- */
192
- function discoverHint(run, query, type) {
193
- if (type === 'hook') return [];
194
- return [
195
- text(`More in packages you could add: ${run} discover ${shellWord(query)}`),
196
- ];
197
- }
198
-
199
- /**
200
- * One shell word: the value itself when it is plain, else single-quoted.
201
- * @param {string} value
202
- */
203
- function shellWord(value) {
204
- return /^[\w@./:-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
205
- }
206
-
207
183
  // Re-export the API for external consumers.
208
184
  export {search, SEARCH_DOMAINS} from '../../../api/search/search.mjs';
@@ -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,7 +279,7 @@ 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
- // One query that reaches every domain, so every per-domain field shows.
282
+ // One query that reaches all four domains, so every per-domain field shows.
292
283
  const args = ['search', 'theme', '--limit', '60'];
293
284
  const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
294
285
  expect(new Set(env.data.results.map(r => r.domain))).toEqual(new Set(SEARCH_DOMAINS));
@@ -320,42 +311,16 @@ describe('search CLI — exit codes + JSON contract', () => {
320
311
  expect(r.stdout).toContain('reason:');
321
312
  });
322
313
 
323
- it('points at discover for packages that could add more, except for hooks', async () => {
324
- const open = await runCli(['search', 'data', 'table'], REPO_ROOT);
325
- expect(open.status).toBe(0);
326
- expect(open.stdout).toMatch(/^More in packages you could add: .*discover 'data table'$/m);
327
- const none = await runCli(['search', 'zzqqxxnomatch'], REPO_ROOT);
328
- expect(none.stdout).toMatch(/^More in packages you could add: .*discover zzqqxxnomatch$/m);
329
- const hooks = await runCli(['search', 'click', '--type', 'hook'], REPO_ROOT);
330
- expect(hooks.status).toBe(0);
331
- expect(hooks.stdout).not.toContain('More in packages you could add');
332
- const json = await runCli(['--json', 'search', 'button'], REPO_ROOT);
333
- expect(json.stdout).not.toContain('More in packages you could add');
334
- });
335
-
336
- 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 () => {
337
315
  const empty = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-search-cli-no-core-'));
338
316
  try {
339
317
  const open = await runCli(['--json', 'search', 'make', 'an', 'integration'], empty);
340
318
  expect(open.status).toBe(0);
341
319
  expect(JSON.parse(open.stdout).data.results[0]).toMatchObject({domain: 'doc'});
342
- // Bundled themes need no project, so an open search finds them too.
343
- const theme = await runCli(['--json', 'search', 'neutral'], empty);
344
- expect(theme.status).toBe(0);
345
- expect(JSON.parse(theme.stdout).data.results[0]).toMatchObject({
346
- domain: 'theme',
347
- name: 'neutral',
348
- });
349
- // The text says the search covered the docs and themes alone.
320
+ // The text says the search covered the docs alone.
350
321
  const text = await runCli(['search', 'button'], empty);
351
322
  expect(text.status).toBe(0);
352
- expect(text.stdout).toContain('only the docs and themes were searched');
353
- // A themes-only search needs no core, like a docs-only one.
354
- const themes = await runCli(['--json', 'search', 'warm', '--type', 'theme'], empty);
355
- expect(themes.status).toBe(0);
356
- const found = JSON.parse(themes.stdout).data.results;
357
- expect(found.map(r => r.name)).toContain('neutral');
358
- expect(found.every(r => r.domain === 'theme')).toBe(true);
323
+ expect(text.stdout).toContain('only the docs were searched');
359
324
  const json = await runCli(['--json', 'search', 'button', '--type', 'component'], empty);
360
325
  expect(json.status).toBe(1);
361
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>');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.5-canary.8d216bb",
3
+ "version": "0.6.5-canary.91d1017",
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.8d216bb",
105
- "@astryxdesign/core": "0.6.5-canary.8d216bb",
106
- "@astryxdesign/lab": "0.6.5-canary.8d216bb",
107
- "@astryxdesign/theme-neutral": "0.6.5-canary.8d216bb"
104
+ "@astryxdesign/charts": "0.6.5-canary.91d1017",
105
+ "@astryxdesign/core": "0.6.5-canary.91d1017",
106
+ "@astryxdesign/lab": "0.6.5-canary.91d1017",
107
+ "@astryxdesign/theme-neutral": "0.6.5-canary.91d1017"
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.8d216bb",
125
- "@astryxdesign/core": "0.6.5-canary.8d216bb",
126
- "@astryxdesign/lab": "0.6.5-canary.8d216bb",
127
- "@astryxdesign/theme-neutral": "0.6.5-canary.8d216bb",
124
+ "@astryxdesign/charts": "0.6.5-canary.91d1017",
125
+ "@astryxdesign/core": "0.6.5-canary.91d1017",
126
+ "@astryxdesign/lab": "0.6.5-canary.91d1017",
127
+ "@astryxdesign/theme-neutral": "0.6.5-canary.91d1017",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",
@@ -1,75 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file `astryx discover` when no discover source is configured and no
5
- * integration provides one.
6
- *
7
- * In a fresh public app with no integrations, `discover --available` used to
8
- * print "No integrations configured. Add integration package names..." — a
9
- * message that told users to add names they had no way to find. These tests
10
- * pin the honest replacement.
11
- */
12
-
13
- import {describe, it, expect, beforeEach, afterEach} from 'vitest';
14
- import * as fs from 'node:fs';
15
- import * as path from 'node:path';
16
- import * as os from 'node:os';
17
- import {runCli} from '../../../test-utils/run-cli.mjs';
18
-
19
- let tmpDir;
20
- let project;
21
-
22
- beforeEach(() => {
23
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-discover-nosource-'));
24
- project = path.join(tmpDir, 'project');
25
- fs.mkdirSync(project, {recursive: true});
26
- fs.writeFileSync(
27
- path.join(project, 'package.json'),
28
- JSON.stringify({name: 'my-app', version: '1.0.0'}),
29
- );
30
- });
31
-
32
- afterEach(() => {
33
- fs.rmSync(tmpDir, {recursive: true, force: true});
34
- });
35
-
36
- describe('astryx discover --available with no source', () => {
37
- it('explains what discover sources are and where to find packages', async () => {
38
- const {status, stdout} = await runCli(['discover', '--available'], {
39
- cwd: project,
40
- });
41
-
42
- expect(status).toBe(0);
43
- expect(stdout).toContain('No discover source is configured.');
44
- expect(stdout).toContain('discover sources');
45
- expect(stdout).toContain('npm search @astryxdesign');
46
- expect(stdout).toContain('docs cli/integrations');
47
- // Must not show the old misleading message
48
- expect(stdout).not.toContain('Add integration package names');
49
- });
50
-
51
- it('returns an empty list with configured=false in --json', async () => {
52
- const {status, stdout} = await runCli(
53
- ['discover', '--available', '--json'],
54
- {cwd: project},
55
- );
56
-
57
- expect(status).toBe(0);
58
- const result = JSON.parse(stdout);
59
- expect(result.type).toBe('discover.list');
60
- expect(result.data).toEqual([]);
61
- expect(result.meta).toEqual({configured: false});
62
- });
63
- });
64
-
65
- describe('astryx discover with nothing configured', () => {
66
- it('shows the config snippet and a pointer to npm and docs', async () => {
67
- const {status, stdout} = await runCli(['discover'], {cwd: project});
68
-
69
- expect(status).toBe(0);
70
- expect(stdout).toContain('No integrations configured.');
71
- expect(stdout).toContain("integrations: ['@scope/your-integration']");
72
- expect(stdout).toContain('npm search @astryxdesign');
73
- expect(stdout).toContain('docs cli/integrations');
74
- });
75
- });
@@ -1,41 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file CLI behavior for `astryx theme list`.
5
- *
6
- * `theme list` shows the themes this project can add now. Themes in packages
7
- * it has not installed are `discover`'s, so the list ends by pointing there:
8
- * an agent that never learns `discover` exists searches the registry instead.
9
- */
10
-
11
- import {describe, it, expect, beforeEach, afterEach} from 'vitest';
12
- import * as fs from 'node:fs';
13
- import * as path from 'node:path';
14
- import * as os from 'node:os';
15
- import {runCli} from '../../../test-utils/run-cli.mjs';
16
-
17
- let tmpDir;
18
- beforeEach(() => {
19
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-cli-theme-list-'));
20
- });
21
- afterEach(() => {
22
- fs.rmSync(tmpDir, {recursive: true, force: true});
23
- });
24
-
25
- describe('astryx theme list', () => {
26
- it('lists the bundled themes and points at discover for more', async () => {
27
- const {status, stdout} = await runCli(['theme', 'list'], {cwd: tmpDir});
28
-
29
- expect(status).toBe(0);
30
- expect(stdout).toMatch(/^- neutral \(maintained, @astryxdesign\/cli\)/m);
31
- expect(stdout).toMatch(/More themes in packages you could add: .*discover theme$/m);
32
- });
33
-
34
- it('keeps the JSON envelope free of the hint', async () => {
35
- const {status, stdout} = await runCli(['--json', 'theme', 'list'], {cwd: tmpDir});
36
-
37
- expect(status).toBe(0);
38
- expect(stdout).not.toContain('discover');
39
- expect(JSON.parse(stdout).type).toBe('theme.list');
40
- });
41
- });