@astryxdesign/cli 0.7.4-canary.b25f95e → 0.7.4-canary.ccdb1b8

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 (93) hide show
  1. package/README.md +63 -63
  2. package/api/docs/_adapter.d.mts +80 -0
  3. package/api/docs/_adapter.mjs +248 -5
  4. package/api/docs/detail/detail.mjs +8 -0
  5. package/api/docs/docs.doc.mjs +1 -1
  6. package/api/docs/docs.type.d.mts +28 -2
  7. package/api/docs/docs.type.mjs +13 -3
  8. package/api/docs/guide-route-targets.test.mjs +998 -0
  9. package/api/docs/index/index.mjs +9 -0
  10. package/api/docs/list/list.mjs +7 -1
  11. package/api/docs/node/node.mjs +9 -1
  12. package/api/docs/reference-blocks.test.mjs +1 -1
  13. package/api/doctor/_adapter.d.mts +40 -0
  14. package/api/doctor/_adapter.mjs +171 -1
  15. package/api/doctor/built-checks.d.mts +85 -0
  16. package/api/doctor/built-checks.mjs +837 -0
  17. package/api/doctor/built-checks.test.mjs +531 -0
  18. package/api/doctor/doctor.d.mts +6 -5
  19. package/api/doctor/doctor.doc.mjs +10 -0
  20. package/api/doctor/doctor.mjs +18 -3
  21. package/api/doctor/doctor.type.d.mts +6 -0
  22. package/api/doctor/doctor.type.mjs +3 -0
  23. package/api/integration/_adapter.d.mts +8 -0
  24. package/api/integration/_adapter.mjs +25 -0
  25. package/api/integration/authoring-checks.mjs +29 -2
  26. package/api/integration/pack-check.mjs +32 -1
  27. package/api/integration/pack-check.test.mjs +33 -0
  28. package/api/integration/validate-integration.mjs +66 -1
  29. package/api/integration/validateIntegration.doc.mjs +1 -1
  30. package/api/search/_candidate-score.d.mts +3 -2
  31. package/api/search/_candidate-score.mjs +66 -3
  32. package/api/search/_gather-docs.mjs +12 -2
  33. package/api/search/_priority.mjs +2 -1
  34. package/api/search/_score.d.mts +2 -1
  35. package/api/search/_score.mjs +2 -2
  36. package/api/search/search.family-members.test.mjs +124 -0
  37. package/assets/discover/official-packages.json +16 -0
  38. package/assets/docs/browser-support.doc.mjs +1 -1
  39. package/assets/docs/theme.doc.mjs +2 -2
  40. package/assets/docs/tree/component-lookups.doc.mjs +2 -1
  41. package/assets/docs/tree/extend-or-replace.doc.mjs +36 -4
  42. package/assets/docs/tree/migration.doc.mjs +2 -1
  43. package/assets/docs/tree/styling-libraries.doc.mjs +2 -1
  44. package/assets/docs/tree/styling.doc.mjs +1 -1
  45. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +54 -0
  46. package/assets/templates/themes/butter/butterPalettes.generated.receipt.json +1499 -0
  47. package/assets/templates/themes/butter/butterPalettes.generated.ts +550 -0
  48. package/assets/templates/themes/butter/butterTheme.ts +274 -234
  49. package/assets/templates/themes/butter/palette.config.json +484 -0
  50. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +41 -0
  51. package/assets/templates/themes/gothic/gothicPalettes.generated.receipt.json +979 -0
  52. package/assets/templates/themes/gothic/gothicPalettes.generated.ts +271 -0
  53. package/assets/templates/themes/gothic/gothicTheme.ts +130 -160
  54. package/assets/templates/themes/gothic/palette.config.json +371 -0
  55. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +51 -0
  56. package/assets/templates/themes/matcha/matchaPalettes.generated.receipt.json +1502 -0
  57. package/assets/templates/themes/matcha/matchaPalettes.generated.ts +501 -0
  58. package/assets/templates/themes/matcha/matchaPalettes.ts +21 -0
  59. package/assets/templates/themes/matcha/matchaTheme.ts +164 -103
  60. package/assets/templates/themes/matcha/palette.config.json +448 -0
  61. package/assets/templates/themes/stone/palette.config.json +262 -0
  62. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +51 -0
  63. package/assets/templates/themes/stone/stonePalettes.generated.receipt.json +840 -0
  64. package/assets/templates/themes/stone/stonePalettes.generated.ts +501 -0
  65. package/assets/templates/themes/stone/stoneTheme.ts +190 -207
  66. package/assets/templates/themes/y2k/palette.config.json +166 -0
  67. package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +54 -0
  68. package/assets/templates/themes/y2k/y2kPalettes.generated.receipt.json +872 -0
  69. package/assets/templates/themes/y2k/y2kPalettes.generated.ts +550 -0
  70. package/assets/templates/themes/y2k/y2kPalettes.ts +257 -0
  71. package/assets/templates/themes/y2k/y2kTheme.ts +164 -391
  72. package/authoring/doctypes/_schema.d.mts +4 -0
  73. package/authoring/doctypes/_schema.mjs +4 -0
  74. package/authoring/doctypes/reference/type.ts +14 -2
  75. package/clients/cli/commands/docs.mjs +27 -2
  76. package/clients/cli/commands/docs.test.mjs +1 -1
  77. package/clients/cli/commands/doctor.doc.mjs +12 -0
  78. package/clients/cli/commands/doctor.mjs +23 -8
  79. package/foundation/agent-docs/agent-docs.d.mts +14 -2
  80. package/foundation/agent-docs/agent-docs.mjs +54 -2
  81. package/foundation/agent-docs/agent-docs.test.mjs +61 -0
  82. package/foundation/discovery/docs-discovery.d.mts +93 -2
  83. package/foundation/discovery/docs-discovery.mjs +236 -8
  84. package/foundation/doc-compiler/compile.mjs +8 -1
  85. package/foundation/doc-compiler/doc-loads.test.mjs +3 -0
  86. package/foundation/doc-compiler/tree.d.mts +5 -0
  87. package/foundation/doc-compiler/tree.mjs +3 -0
  88. package/foundation/integrations/cli-requirement.d.mts +14 -0
  89. package/foundation/integrations/cli-requirement.mjs +23 -0
  90. package/foundation/integrations/cli-requirement.test.mjs +1 -0
  91. package/foundation/response/error-codes.test.mjs +9 -0
  92. package/foundation/response/response-types.doc.mjs +5 -5
  93. package/package.json +9 -9
@@ -0,0 +1,124 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file A family member named by short words is found by them spelled out:
5
+ * "vertical stack" is VStack, whose own description says so, and a member whose
6
+ * name is its head word after single letters is a match for that head word.
7
+ * The same holds for any integration's members, which no learned weights know.
8
+ */
9
+
10
+ import fs from 'node:fs';
11
+ import os from 'node:os';
12
+ import path from 'node:path';
13
+ import {afterAll, beforeAll, describe, expect, it} from 'vitest';
14
+ import {search} from './search.mjs';
15
+
16
+ const SLOW = 60_000;
17
+
18
+ describe('family members found by their spelled-out names', () => {
19
+ it.each([
20
+ ['vertical stack', 'VStack'],
21
+ ['horizontal stack', 'HStack'],
22
+ ])('`%s` ranks %s first', async (query, name) => {
23
+ const {results} = (await search(query)).data;
24
+ expect(results[0], JSON.stringify(results.slice(0, 3))).toMatchObject({
25
+ domain: 'component',
26
+ name,
27
+ });
28
+ });
29
+
30
+ it('`stack` keeps Stack first and lists VStack and HStack', async () => {
31
+ const {results} = (await search('stack')).data;
32
+ expect(results[0]).toMatchObject({domain: 'component', name: 'Stack'});
33
+ const top = results.slice(0, 8).map(r => r.name);
34
+ expect(top).toContain('VStack');
35
+ expect(top).toContain('HStack');
36
+ });
37
+
38
+ it('only a single-letter word is spelled out', async () => {
39
+ // "without" begins with "With" but spells out no letter of the name.
40
+ const {results} = (await search('checkbox list without end content')).data;
41
+ expect(results[0]?.reason).not.toMatch(/spelled out/);
42
+ });
43
+
44
+ it('a longer query keeps Stack first', async () => {
45
+ // Stack in VStack counts as a keyword hit only when it is the whole query.
46
+ const {results} = (await search('vertical stack of cards')).data;
47
+ expect(results[0]).toMatchObject({domain: 'component', name: 'Stack'});
48
+ });
49
+
50
+ it("a longer query does not lift a head word's members", async () => {
51
+ const {results} = (await search('stack direction')).data;
52
+ const top = results.slice(0, 3).map(r => r.name);
53
+ expect(top).not.toContain('VStack');
54
+ expect(top).not.toContain('HStack');
55
+ });
56
+
57
+ it('a word the description does not spell out is no name', async () => {
58
+ const {results} = (await search('visual stack')).data;
59
+ expect(results[0]?.name).not.toBe('VStack');
60
+ });
61
+ });
62
+
63
+ describe("an integration's family members (cold start)", () => {
64
+ /** @type {string} */
65
+ let dir;
66
+ beforeAll(() => {
67
+ dir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-family-members-'));
68
+ const pkg = path.join(dir, 'node_modules', '@acme', 'grids');
69
+ fs.mkdirSync(path.join(pkg, 'components'), {recursive: true});
70
+ fs.mkdirSync(
71
+ path.join(dir, 'node_modules', '@astryxdesign', 'core', 'src'),
72
+ {
73
+ recursive: true,
74
+ },
75
+ );
76
+ fs.writeFileSync(path.join(dir, 'package.json'), '{"name":"consumer"}');
77
+ fs.writeFileSync(
78
+ path.join(dir, 'astryx.config.mjs'),
79
+ "export default { integrations: ['@acme/grids'] };\n",
80
+ );
81
+ fs.writeFileSync(
82
+ path.join(pkg, 'package.json'),
83
+ '{"name":"@acme/grids","version":"1.0.0"}',
84
+ );
85
+ fs.writeFileSync(
86
+ path.join(pkg, 'astryx.integration.mjs'),
87
+ "export default { components: './components' };\n",
88
+ );
89
+ for (const [name, description] of [
90
+ ['VGrid', 'Vertical grid for arranging tiles in columns.'],
91
+ ['HGrid', 'Horizontal grid for arranging tiles in rows.'],
92
+ ]) {
93
+ fs.writeFileSync(
94
+ path.join(pkg, 'components', `${name}.doc.mjs`),
95
+ `export default {
96
+ type: 'component',
97
+ name: '${name}',
98
+ usage: {description: '${description}'},
99
+ props: [],
100
+ };\n`,
101
+ );
102
+ fs.writeFileSync(
103
+ path.join(pkg, 'components', `${name}.tsx`),
104
+ `export function ${name}() { return null; }\n`,
105
+ );
106
+ }
107
+ });
108
+ afterAll(() => fs.rmSync(dir, {recursive: true, force: true}));
109
+
110
+ it.each([
111
+ ['vertical grid', 'VGrid'],
112
+ ['horizontal grid', 'HGrid'],
113
+ ])(
114
+ '`%s` ranks %s first',
115
+ async (query, name) => {
116
+ const {results} = (await search(query, {cwd: dir, type: 'component'}))
117
+ .data;
118
+ expect(results[0], JSON.stringify(results.slice(0, 3))).toMatchObject({
119
+ name,
120
+ });
121
+ },
122
+ SLOW,
123
+ );
124
+ });
@@ -243,6 +243,22 @@
243
243
  {
244
244
  "kind": "template",
245
245
  "name": "EmojiPickerShowcase"
246
+ },
247
+ {
248
+ "kind": "template",
249
+ "name": "ListInputBudgetAllocation"
250
+ },
251
+ {
252
+ "kind": "template",
253
+ "name": "ListInputFamilyMembers"
254
+ },
255
+ {
256
+ "kind": "template",
257
+ "name": "ListInputMailingList"
258
+ },
259
+ {
260
+ "kind": "template",
261
+ "name": "ListInputShowcase"
246
262
  }
247
263
  ]
248
264
  },
@@ -4,7 +4,7 @@
4
4
 
5
5
  export const docs = {
6
6
  name: 'browser-support',
7
- title: 'Browser Support',
7
+ title: 'Browser support',
8
8
  category: 'guide',
9
9
  description:
10
10
  'What browsers Astryx targets, which modern platform features it depends on, and how to support older browsers for your own audience.',
@@ -4,9 +4,9 @@
4
4
 
5
5
  export const docs = {
6
6
  name: 'theme',
7
- title: 'Theme System',
7
+ title: 'Theming',
8
8
  category: 'guide',
9
- keywords: ['theme', 'dark mode', 'defineTheme', 'provider'],
9
+ keywords: ['theme', 'theming', 'theme system', 'dark mode', 'defineTheme', 'provider'],
10
10
  description:
11
11
  'How to use and create themes: see Use a theme for applying themes, and Author a theme for creating and customizing them.',
12
12
 
@@ -10,8 +10,9 @@ export const docs = {
10
10
  type: 'generic',
11
11
  name: 'component-lookups',
12
12
  placement: {parent: 'namespace:cli', slot: 'guides', order: 5},
13
- title: 'Looking up components',
13
+ title: 'Component lookups',
14
14
  category: 'guide',
15
+ keywords: ['look up', 'looking up components', 'lookup', 'batch'],
15
16
  description:
16
17
  'Look up one or several exact component identities, choose a focused projection, and handle complete batch receipts.',
17
18
  sections: [
@@ -2,8 +2,9 @@
2
2
 
3
3
  /**
4
4
  * @file `astryx docs authoring/building-blocks/docs/extend-or-replace`:
5
- * take over an existing topic with `replaces`, merge sections into one with
6
- * `extends`, and check overlaps with Core topics.
5
+ * take over an existing topic or guide with `replaces`, merge sections into
6
+ * one with `extends` (placing each with `before` or `after`), and check
7
+ * overlaps with Core topics.
7
8
  */
8
9
 
9
10
  /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
@@ -13,7 +14,7 @@ export const docs = {
13
14
  placement: {parent: 'namespace:docs', slot: 'guides', order: 40},
14
15
  title: 'Extend or replace a topic',
15
16
  category: 'guide',
16
- description: 'Take over a topic, or merge sections into it.',
17
+ description: 'Take over a topic or guide, or merge sections into it.',
17
18
  sections: [
18
19
  {
19
20
  id: 'replace-a-topic',
@@ -63,7 +64,8 @@ export const docs = {
63
64
  type: 'list',
64
65
  style: 'unordered',
65
66
  items: [
66
- "Read the base topic's keys with `--index`, and give a section that replaces one that key as its `id`. A section without an `id` matches only a base section with exactly its title, or one whose `id` is the key its title makes, so `Integration Themes` is added beside a base `Integration themes` that has no `id`.",
67
+ "Read the base topic's keys with `--index`, and give a section that replaces one that key as its `id`. A section that replaces one keeps its place. A section without an `id` matches only a base section with exactly its title, or one whose `id` is the key its title makes, so `Integration Themes` is added beside a base `Integration themes` that has no `id`.",
68
+ "Set `before` or `after` to a base section's key to add a new section there instead of at the end. A key that names no section adds it at the end, and `astryx doctor integration validate` lists a note. An older CLI rejects these fields, so declare an `@astryxdesign/cli` peer range that starts at the release that reads them; `astryx integration verify` warns without it.",
67
69
  "The topic keeps the base's title and description, and readers open it by the base's name.",
68
70
  'Replace the `Overview` placeholder that `integration add` writes, or it is added to the base topic.',
69
71
  "Extend a topic to correct or add to it. A copy made with `replaces` stops getting the owner's fixes.",
@@ -71,6 +73,36 @@ export const docs = {
71
73
  },
72
74
  ],
73
75
  },
76
+ {
77
+ id: 'replace-or-extend-a-cli-guide',
78
+ title: 'Replace or extend a CLI guide',
79
+ content: [
80
+ {
81
+ type: 'prose',
82
+ text: "A guide in the CLI's docs tree has a route rather than a topic name. Set `replaces` or `extends` to that route to change the guide for every app that installs your package: say what differs for your users on the page agents already read.",
83
+ },
84
+ {
85
+ type: 'code',
86
+ lang: 'javascript',
87
+ label: 'docs/acme-quick-start.doc.mjs',
88
+ code: "export default {\n type: 'generic',\n name: 'acme-quick-start',\n extends: 'authoring/quick-start',\n title: 'Acme quick start',\n description: 'What differs when you build integrations at Acme.',\n sections: [\n {id: 'use-the-acme-registry', title: 'Use the Acme registry', before: 'fill-in-package-json', content: [/* ... */]},\n ],\n};",
89
+ },
90
+ {
91
+ type: 'list',
92
+ style: 'unordered',
93
+ items: [
94
+ 'Your doc stays a flat topic: do not give it a `placement`. Readers open the guide by its route, never by your `name`.',
95
+ 'With `replaces`, readers of the route get your doc, under your package. With `extends`, each section you add or replace names your package.',
96
+ 'A name that holds no topic or guide, such as a namespace, changes nothing; `astryx doctor integration validate` lists it as a note, with the guides below a namespace.',
97
+ ],
98
+ },
99
+ {
100
+ type: 'code',
101
+ lang: 'bash',
102
+ code: '# Every guide route, by namespace\nastryx docs authoring --depth all\nastryx docs cli --depth all\n# The keys to place sections by\nastryx docs authoring/quick-start --index',
103
+ },
104
+ ],
105
+ },
74
106
  {
75
107
  id: 'check-overlaps-with-core-topics',
76
108
  title: 'Check overlaps with Core topics',
@@ -10,11 +10,12 @@
10
10
  export const docs = {
11
11
  type: 'namespace',
12
12
  name: 'migration',
13
- title: 'Migration Guide',
13
+ title: 'Migration',
14
14
  summary:
15
15
  'Migrate an existing Tailwind, shadcn, or Radix app to the design system incrementally — setup, component replacement, and verification.',
16
16
  keywords: [
17
17
  'migration',
18
+ 'migration guide',
18
19
  'migrate',
19
20
  'Tailwind',
20
21
  'shadcn',
@@ -10,7 +10,7 @@
10
10
  export const docs = {
11
11
  type: 'namespace',
12
12
  name: 'styling-libraries',
13
- title: 'Styling Library Interop',
13
+ title: 'Other styling libraries',
14
14
  summary:
15
15
  'Integrate Tailwind, StyleX, Panda, Chakra, MUI, CSS-in-JS, CSS Modules, and non-CSS renderers with system tokens.',
16
16
  keywords: [
@@ -23,6 +23,7 @@ export const docs = {
23
23
  'styled-components',
24
24
  'CSS Modules',
25
25
  'interop',
26
+ 'styling library interop',
26
27
  ],
27
28
  slots: {
28
29
  guides: {title: 'Guides', accepts: {kinds: ['generic']}},
@@ -10,7 +10,7 @@
10
10
  export const docs = {
11
11
  type: 'namespace',
12
12
  name: 'styling',
13
- title: 'Styling Components',
13
+ title: 'Styling components',
14
14
  summary:
15
15
  'Customize component appearance: xstyle, Tailwind, className, rest props, compound components, data attribute selectors, tokens, and StyleX setup.',
16
16
  keywords: [
@@ -0,0 +1,54 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ // Generated from the committed full palette for the stops used by Butter's
4
+ // theme source. Regenerate with `pnpm generate:butter-palette-refs`.
5
+ // Keep the complete palette available for authoring and audits without
6
+ // making consumers pay for unused palette stops.
7
+ // prettier-ignore
8
+ export const butterPaletteRefs = {
9
+ purple: {
10
+ light: {25: '#52237b', 80: '#ddb9f6', 90: '#f2daff'},
11
+ dark: {25: '#52237b', 80: '#ddb9f6', 90: '#f2daff'},
12
+ },
13
+ green: {
14
+ light: {25: '#004a05', 70: '#7bbf7a', 80: '#a2d7a0', 85: '#b6e3b4', 90: '#caeec8'},
15
+ dark: {15: '#013004', 20: '#063c0a', 70: '#83bc82', 80: '#a8d4a6', 90: '#cdedcc'},
16
+ },
17
+ neutral: {
18
+ light: {0: '#000000', 15: '#1d1c11', 30: '#4a4732', 45: '#605f52', 55: '#79786a', 70: '#adac9e', 75: '#c7c4b2', 80: '#d6d3b8', 85: '#e5e3d4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
19
+ dark: {0: '#000000', 5: '#131107', 10: '#261a13', 15: '#2e2117', 20: '#3a2a1f', 30: '#4a4732', 35: '#49473b', 40: '#725538', 45: '#605f52', 60: '#939184', 70: '#adac9e', 80: '#d6d3b8', 85: '#f0edd4', 90: '#f3f2e2', 95: '#fdfbe4', 100: '#ffffff'},
20
+ },
21
+ orange: {
22
+ light: {25: '#622e00', 80: '#f2bd81', 90: '#ffdcb6'},
23
+ dark: {25: '#622e00', 80: '#f2bd81', 90: '#ffdcb6'},
24
+ },
25
+ blue: {
26
+ light: {25: '#203a6c', 80: '#bdc5eb', 90: '#dbe1ff'},
27
+ dark: {25: '#203a6c', 80: '#bdc5eb', 90: '#dbe1ff'},
28
+ },
29
+ red: {
30
+ light: {10: '#3b0200', 25: '#6f1400', 30: '#821b00', 60: '#e56241', 80: '#ffb09b', 90: '#ffd9cf', 95: '#ffece7'},
31
+ dark: {15: '#4c0700', 25: '#6f1400', 80: '#ffb09b', 85: '#ffc5b5', 90: '#ffd9cf'},
32
+ },
33
+ yellow: {
34
+ light: {25: '#443c00', 30: '#514700', 70: '#bfae35', 80: '#dfcf5b', 85: '#f0df72', 90: '#fdee8c', 95: '#fff7c0'},
35
+ dark: {15: '#2c2600', 25: '#443c00', 70: '#bcae4e', 75: '#cdbe59', 85: '#eedf75', 90: '#fdee8c'},
36
+ },
37
+ teal: {
38
+ light: {25: '#00482d', 80: '#94d3bb', 90: '#b0f0d7'},
39
+ dark: {25: '#00482d', 80: '#94d3bb', 90: '#b0f0d7'},
40
+ },
41
+ accent: {
42
+ light: {35: '#194ce8', 40: '#225bff', 55: '#4d82ff'},
43
+ },
44
+ cyan: {
45
+ light: {25: '#004649', 80: '#8dd2d3', 90: '#a9eff0'},
46
+ dark: {25: '#004649', 80: '#8dd2d3', 90: '#a9eff0'},
47
+ },
48
+ pink: {
49
+ light: {25: '#6c0a68', 80: '#f0b3e8', 90: '#ffd5fb'},
50
+ dark: {25: '#6c0a68', 80: '#f0b3e8', 90: '#ffd5fb'},
51
+ },
52
+ } as const;
53
+
54
+ export default butterPaletteRefs;