@astryxdesign/cli 0.6.5-canary.24fe2cd → 0.6.5-canary.2ad3b83

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 (156) hide show
  1. package/README.md +13 -14
  2. package/api/build/_adapter.d.mts +2 -36
  3. package/api/build/_adapter.mjs +10 -41
  4. package/api/build/build.doc.mjs +2 -2
  5. package/api/build/build.test.mjs +2 -38
  6. package/api/build/kit/kit.mjs +21 -65
  7. package/api/build/kit/rank.d.mts +8 -24
  8. package/api/build/kit/rank.mjs +97 -277
  9. package/api/build/kit/rank.test.mjs +48 -231
  10. package/api/error.d.mts +0 -22
  11. package/api/error.mjs +0 -42
  12. package/api/integration/add-contribution.d.mts +1 -2
  13. package/api/integration/add-contribution.mjs +3 -7
  14. package/api/integration/add-contribution.test.mjs +3 -3
  15. package/api/integration/add-theme.mjs +22 -243
  16. package/api/integration/add-theme.test.mjs +0 -213
  17. package/api/integration/authoring-checks.mjs +7 -10
  18. package/api/integration/authoring-checks.type.d.mts +0 -8
  19. package/api/integration/authoring-checks.type.mjs +3 -7
  20. package/api/integration/integration-authoring.type.d.mts +1 -4
  21. package/api/integration/integration-authoring.type.mjs +1 -6
  22. package/api/integration/integrationAdd.doc.mjs +0 -6
  23. package/api/integration/integrationAddTheme.doc.mjs +0 -10
  24. package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
  25. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  26. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  27. package/api/integration/pack-check.mjs +2 -11
  28. package/api/integration/pack-check.test.mjs +1 -38
  29. package/api/integration/validate-integration.d.mts +2 -4
  30. package/api/integration/validate-integration.mjs +2 -7
  31. package/api/integration/validate-integration.test.mjs +0 -55
  32. package/api/integration/validate-integration.type.d.mts +0 -5
  33. package/api/integration/validate-integration.type.mjs +1 -5
  34. package/api/integration/validateIntegration.doc.mjs +1 -1
  35. package/api/layout/expand/expand.mjs +7 -12
  36. package/api/layout/layout.type.d.mts +0 -1
  37. package/api/layout/layout.type.mjs +0 -1
  38. package/api/layout/layoutExpand.doc.mjs +1 -1
  39. package/api/search/search.d.mts +0 -24
  40. package/api/search/search.mjs +1 -71
  41. package/api/swizzle/copy/copy.mjs +3 -66
  42. package/api/swizzle/swizzle.doc.mjs +0 -4
  43. package/api/template/copy/copy.mjs +8 -14
  44. package/api/template/show/show.mjs +4 -15
  45. package/api/template/template-integration.test.mjs +0 -14
  46. package/api/template/template.d.mts +1 -1
  47. package/api/template/template.doc.mjs +2 -6
  48. package/api/template/template.mjs +0 -1
  49. package/api/template/template.type.d.mts +0 -2
  50. package/api/template/template.type.mjs +0 -2
  51. package/api/theme/build/build.d.mts +0 -24
  52. package/api/theme/build/build.mjs +8 -235
  53. package/api/upgrade/run/run.mjs +3 -20
  54. package/api/upgrade/run/run.test.mjs +1 -45
  55. package/api/upgrade/upgrade.doc.mjs +1 -1
  56. package/api/upgrade/upgrade.type.d.mts +0 -1
  57. package/api/upgrade/upgrade.type.mjs +0 -1
  58. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  59. package/assets/docs/tree/checks.doc.mjs +1 -1
  60. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  61. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -13
  62. package/assets/docs/tree/troubleshooting.doc.mjs +3 -7
  63. package/assets/docs/tree/versioning.doc.mjs +6 -6
  64. package/assets/templates/pages/ai-chat/template.doc.mjs +1 -16
  65. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +1 -9
  66. package/assets/templates/pages/blank/template.doc.mjs +1 -3
  67. package/assets/templates/pages/canvas-editor/template.doc.mjs +1 -9
  68. package/assets/templates/pages/centered-hero/template.doc.mjs +1 -3
  69. package/assets/templates/pages/checkout-wizard/template.doc.mjs +0 -1
  70. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -3
  71. package/assets/templates/pages/contact-form/template.doc.mjs +1 -16
  72. package/assets/templates/pages/dashboard/template.doc.mjs +1 -15
  73. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +1 -23
  74. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +1 -10
  75. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +1 -9
  76. package/assets/templates/pages/dashboard-composition/template.doc.mjs +1 -10
  77. package/assets/templates/pages/dashboard-progress/template.doc.mjs +1 -17
  78. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +1 -2
  79. package/assets/templates/pages/detail-page/template.doc.mjs +0 -8
  80. package/assets/templates/pages/documentation/template.doc.mjs +1 -10
  81. package/assets/templates/pages/documentation-design/template.doc.mjs +1 -10
  82. package/assets/templates/pages/documentation-technical/template.doc.mjs +1 -10
  83. package/assets/templates/pages/editor/template.doc.mjs +1 -9
  84. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -3
  85. package/assets/templates/pages/form-two-column/template.doc.mjs +1 -17
  86. package/assets/templates/pages/form-wizard/template.doc.mjs +1 -14
  87. package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +0 -1
  88. package/assets/templates/pages/gallery-hero/template.doc.mjs +1 -10
  89. package/assets/templates/pages/ide/template.doc.mjs +1 -9
  90. package/assets/templates/pages/incident-console/template.doc.mjs +1 -10
  91. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -11
  92. package/assets/templates/pages/library/template.doc.mjs +1 -15
  93. package/assets/templates/pages/login/template.doc.mjs +1 -10
  94. package/assets/templates/pages/login-card/template.doc.mjs +1 -11
  95. package/assets/templates/pages/login-split/template.doc.mjs +1 -10
  96. package/assets/templates/pages/login-sso/template.doc.mjs +1 -10
  97. package/assets/templates/pages/messaging-shell/template.doc.mjs +1 -11
  98. package/assets/templates/pages/mixed-gallery/template.doc.mjs +1 -10
  99. package/assets/templates/pages/payment-form/template.doc.mjs +1 -3
  100. package/assets/templates/pages/product-detail/template.doc.mjs +1 -9
  101. package/assets/templates/pages/product-gallery/template.doc.mjs +1 -10
  102. package/assets/templates/pages/settings/template.doc.mjs +1 -3
  103. package/assets/templates/pages/settings-dialog/template.doc.mjs +1 -9
  104. package/assets/templates/pages/settings-sidebar/template.doc.mjs +1 -9
  105. package/assets/templates/pages/shell-nav/template.doc.mjs +1 -10
  106. package/assets/templates/pages/shell-side-nav/template.doc.mjs +1 -14
  107. package/assets/templates/pages/shell-top-nav/template.doc.mjs +1 -11
  108. package/assets/templates/pages/side-gallery/template.doc.mjs +1 -3
  109. package/assets/templates/pages/table/template.doc.mjs +1 -11
  110. package/assets/templates/pages/table-filter/template.doc.mjs +1 -21
  111. package/assets/templates/pages/table-grouped/template.doc.mjs +1 -15
  112. package/assets/templates/pages/table-inbox/template.doc.mjs +6 -18
  113. package/assets/templates/pages/table-page/template.doc.mjs +1 -20
  114. package/assets/templates/pages/table-tree/template.doc.mjs +1 -14
  115. package/assets/templates/pages/theme-showcase/template.doc.mjs +1 -10
  116. package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -10
  117. package/authoring/doctypes/template/parse.d.mts +0 -2
  118. package/authoring/doctypes/template/parse.mjs +0 -1
  119. package/authoring/doctypes/template/parse.test.mjs +0 -21
  120. package/authoring/doctypes/template/template.doc.mjs +0 -6
  121. package/authoring/doctypes/template/type.ts +0 -10
  122. package/clients/cli/commands/doctor.mjs +4 -4
  123. package/clients/cli/commands/integration-add.doc.mjs +0 -10
  124. package/clients/cli/commands/integration-authoring.test.mjs +2 -12
  125. package/clients/cli/commands/integration.mjs +1 -3
  126. package/clients/cli/commands/layout-expand.doc.mjs +1 -3
  127. package/clients/cli/commands/layout.mjs +0 -16
  128. package/clients/cli/commands/template.mjs +5 -19
  129. package/clients/cli/commands/upgrade.ascii-output.test.mjs +0 -14
  130. package/clients/cli/lib/manifest.mjs +165 -44
  131. package/clients/cli/lib/manifest.test.mjs +7 -98
  132. package/foundation/discovery/template-adapter.d.mts +0 -14
  133. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +1 -37
  134. package/foundation/discovery/template-adapter.mjs +1 -21
  135. package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
  136. package/foundation/integrations/cli-requirement.d.mts +11 -23
  137. package/foundation/integrations/cli-requirement.mjs +18 -40
  138. package/foundation/integrations/cli-requirement.test.mjs +15 -66
  139. package/foundation/response/response-types.doc.d.mts +5 -5
  140. package/foundation/response/response-types.doc.mjs +13 -13
  141. package/package.json +9 -9
  142. package/api/docs/docs.test.mjs +0 -279
  143. package/api/docs/integration-tree.test.mjs +0 -572
  144. package/api/docs/integrationDocs.test.mjs +0 -336
  145. package/api/layout/expand/expand.receipt.test.mjs +0 -74
  146. package/api/search/search.test.mjs +0 -710
  147. package/api/template/copy/copy.receipt.test.mjs +0 -77
  148. package/api/template/show/show.test.mjs +0 -76
  149. package/api/theme/build/build.project-core.test.mjs +0 -165
  150. package/clients/cli/commands/docs.test.mjs +0 -383
  151. package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
  152. package/clients/cli/commands/template.copy-receipt.test.mjs +0 -60
  153. package/clients/cli/commands/template.show-media.test.mjs +0 -62
  154. package/clients/cli/commands/write-failure.test.mjs +0 -175
  155. package/foundation/agent-docs/agent-docs.test.mjs +0 -1160
  156. package/foundation/doc-compiler/tree.test.mjs +0 -649
@@ -2,15 +2,14 @@
2
2
 
3
3
  /**
4
4
  * @file Tests for build's page ranker: long ideas, head nouns, family bases,
5
- * rare-word weighting, keywords, family words taken from the templates
6
- * themselves, and parts told from pages by the system's own components.
5
+ * rare-word weighting, and family words taken from the templates themselves.
7
6
  */
8
7
 
9
8
  import {describe, it, expect} from 'vitest';
10
9
  import * as path from 'node:path';
11
10
  import {fileURLToPath} from 'node:url';
12
- import {ideaKind, pickStart, rankPages} from './rank.mjs';
13
- import {loadComponents, loadPageTemplates} from '../_adapter.mjs';
11
+ import {pickStart, rankPages} from './rank.mjs';
12
+ import {loadPageTemplates} from '../_adapter.mjs';
14
13
 
15
14
  // api/build/kit/ -> up 5 = repo root (has packages/core and the templates).
16
15
  const REPO = path.resolve(
@@ -18,24 +17,14 @@ const REPO = path.resolve(
18
17
  '../../../../..',
19
18
  );
20
19
 
21
- /**
22
- * @param {string} name
23
- * @param {string} category
24
- * @param {string} description
25
- * @param {string[]} [keywords]
26
- */
27
- const page = (name, category, description, keywords = []) => ({
20
+ /** @param {string} name @param {string} category @param {string} description */
21
+ const page = (name, category, description) => ({
28
22
  name,
29
23
  displayName: name,
30
24
  category,
31
25
  description,
32
- keywords,
33
- command: `astryx template ${name} --type page`,
34
26
  });
35
27
 
36
- /** @param {string} name @param {string[]} [keywords] */
37
- const component = (name, keywords = []) => ({name, keywords});
38
-
39
28
  describe('rankPages on the shipped page templates', () => {
40
29
  /** @param {string} query */
41
30
  const start = async query =>
@@ -60,19 +49,6 @@ describe('rankPages on the shipped page templates', () => {
60
49
  );
61
50
  });
62
51
 
63
- it('keeps the family base when a variant shares one incidental word', async () => {
64
- // "comparison" and "cohort" name dashboard variants, but here each is one
65
- // small part of a general dashboard.
66
- expect(
67
- await start(
68
- 'support dashboard with ticket volume charts and a small comparison note',
69
- ),
70
- ).toBe('dashboard');
71
- expect(
72
- await start('sales dashboard with a cohort filter and weekly charts'),
73
- ).toBe('dashboard');
74
- });
75
-
76
52
  it('lets the head noun decide between families', async () => {
77
53
  // Both ideas mention a table and summary numbers; the head says which
78
54
  // page it is.
@@ -88,14 +64,6 @@ describe('rankPages on the shipped page templates', () => {
88
64
  ).toMatch(/^table-/);
89
65
  });
90
66
 
91
- it('keeps a variant that leads when its family base cannot start alone', async () => {
92
- // The dashboard base matches only the family word here; the funnel
93
- // dashboard matches the idea.
94
- expect(await start('a funnel for a dashboard')).toBe(
95
- 'dashboard-cohort-funnel',
96
- );
97
- });
98
-
99
67
  it('does not start from one rare word', async () => {
100
68
  // "board" is the kanban board's own word; a game board is not a kanban.
101
69
  expect(
@@ -107,10 +75,11 @@ describe('rankPages on the shipped page templates', () => {
107
75
  describe('rankPages on any catalog', () => {
108
76
  it('ranks only the templates it is given', () => {
109
77
  const ranked = rankPages('dashboard', [
110
- page('dashboard', 'Dashboard - Analytics', 'Tiles, charts, tables.', [
78
+ page(
111
79
  'dashboard',
112
- 'metrics',
113
- ]),
80
+ 'Dashboard - Analytics',
81
+ 'Tiles, charts, tables. Dashboard, metrics.',
82
+ ),
114
83
  ]);
115
84
  expect(ranked.map(r => r.name)).toEqual(['dashboard']);
116
85
  });
@@ -119,14 +88,17 @@ describe('rankPages on any catalog', () => {
119
88
  // An integration's family: its word is in two of its ids, so an idea
120
89
  // naming it picks the family, and its base template leads it.
121
90
  const catalog = [
122
- page('dashboard', 'Dashboard - Analytics', 'Tiles, charts, tables.', [
91
+ page(
123
92
  'dashboard',
124
- 'metrics',
125
- ]),
126
- page('widget', 'Widget - Basic', 'One compact card.', ['widget', 'tile']),
127
- page('widget-grid', 'Widget - Grid', 'Many compact cards in a grid.', [
128
- 'widget wall',
129
- ]),
93
+ 'Dashboard - Analytics',
94
+ 'Tiles, charts, tables. Dashboard, metrics.',
95
+ ),
96
+ page('widget', 'Widget - Basic', 'One compact card. Widget, tile.'),
97
+ page(
98
+ 'widget-grid',
99
+ 'Widget - Grid',
100
+ 'Many compact cards in a grid. Widget wall.',
101
+ ),
130
102
  ];
131
103
  const ranked = rankPages('weather widget with charts', catalog);
132
104
  expect(ranked[0].name).toBe('widget');
@@ -134,41 +106,15 @@ describe('rankPages on any catalog', () => {
134
106
  expect(pickStart(ranked)?.name).toBe('widget');
135
107
  });
136
108
 
137
- it("counts a template's keywords above words in its description", () => {
138
- // Both mention uptime; only one names it as an idea it serves.
139
- const catalog = [
140
- page('ops', 'Dashboard - Ops', 'Uptime strips beside alert rows.'),
141
- page('health', 'Dashboard - Health', 'Status tiles over time charts.', [
142
- 'uptime',
143
- ]),
144
- ];
145
- expect(rankPages('uptime overview', catalog)[0].name).toBe('health');
146
- });
147
-
148
- it("lets a variant displace its family's base only with two words of its own", () => {
149
- const catalog = [
150
- page('widget', 'Widget - Basic', 'One compact card.', ['widget']),
151
- page('widget-weather', 'Widget - Weather', 'A forecast card.', [
152
- 'weather',
153
- 'forecast',
154
- 'radar',
155
- ]),
156
- ];
157
- // One word of the variant's own: still the family's base.
158
- expect(rankPages('weather widget', catalog)[0].name).toBe('widget');
159
- // Two: the variant.
160
- expect(rankPages('weather widget with radar', catalog)[0].name).toBe(
161
- 'widget-weather',
162
- );
163
- });
164
-
165
109
  it('weighs a word by how rare it is among page templates', () => {
166
110
  const catalog = [
167
- page('alpha', 'Dashboard - Alpha', 'Status tiles.', ['status overview']),
168
- page('beta', 'Dashboard - Beta', 'Status rows.', ['status list']),
169
- page('gamma', 'Dashboard - Gamma', 'Funnel of stages.', [
170
- 'funnel conversion',
171
- ]),
111
+ page('alpha', 'Dashboard - Alpha', 'Status tiles. Status overview.'),
112
+ page('beta', 'Dashboard - Beta', 'Status rows. Status list.'),
113
+ page(
114
+ 'gamma',
115
+ 'Dashboard - Gamma',
116
+ 'Funnel of stages. Funnel conversion.',
117
+ ),
172
118
  ];
173
119
  // "status" is on two templates, "funnel" on one: the rare word wins.
174
120
  const ranked = rankPages('status funnel', catalog);
@@ -181,24 +127,22 @@ describe('rankPages structure signals', () => {
181
127
  page(
182
128
  'dialog-panel',
183
129
  'Settings - Dialog',
184
- 'Preferences inside a modal container.',
185
- ['settings', 'modal dialog'],
130
+ 'Preferences inside a modal container. Settings, or modal dialog.',
131
+ ),
132
+ page(
133
+ 'tree-table',
134
+ 'Table - Tree',
135
+ 'Nested rows under parents. Tree, nested rows, file browser.',
136
+ ),
137
+ page(
138
+ 'item-detail',
139
+ 'Content - Item Detail',
140
+ 'One item with its media. Product, listing, or item detail.',
186
141
  ),
187
- page('tree-table', 'Table - Tree', 'Nested rows under parents.', [
188
- 'tree',
189
- 'nested rows',
190
- 'file browser',
191
- ]),
192
- page('item-detail', 'Content - Item Detail', 'One item with its media.', [
193
- 'product',
194
- 'listing',
195
- 'item detail',
196
- ]),
197
142
  page(
198
143
  'docs-catalog',
199
144
  'Content - Documentation Catalog',
200
- 'A grid of category cards.',
201
- ['documentation', 'docs', 'api index'],
145
+ 'A grid of category cards. Documentation, docs, or API index.',
202
146
  ),
203
147
  ];
204
148
 
@@ -235,145 +179,18 @@ describe('rankPages structure signals', () => {
235
179
  it('does not treat a synonym as a family name', () => {
236
180
  // "landing" is a synonym of "hero" in search, not a family word here.
237
181
  const heroes = [
238
- page('hero-centered', 'Gallery - Hero', 'A centered hero.', [
239
- 'hero',
240
- 'banner',
241
- 'landing',
242
- ]),
243
- page('hero-split', 'Gallery - Hero Split', 'A split hero.', [
244
- 'hero',
245
- 'splash',
246
- ]),
182
+ page(
183
+ 'hero-centered',
184
+ 'Gallery - Hero',
185
+ 'A centered hero. Hero, banner, or landing.',
186
+ ),
187
+ page(
188
+ 'hero-split',
189
+ 'Gallery - Hero Split',
190
+ 'A split hero. Hero or splash.',
191
+ ),
247
192
  ];
248
193
  const ranked = rankPages('internal landing page', heroes);
249
194
  expect(ranked.every(r => !r.familyNamed)).toBe(true);
250
195
  });
251
196
  });
252
-
253
- describe('ideaKind: a part of a page, told by the components the system ships', () => {
254
- const pages = [
255
- page('table', 'Table - Basic', 'Rows of records.'),
256
- page('table-filter', 'Table - Filtering', 'Rows narrowed by filters.'),
257
- page('settings', 'Settings', 'Grouped preferences.'),
258
- ];
259
- const components = [
260
- component('DateRangeInput', ['date picker']),
261
- component('Tooltip'),
262
- component('Calendar'),
263
- component('Table'),
264
- component('Dialog', ['modal']),
265
- ];
266
- /** @param {string} idea @param {object[]} [using] */
267
- const kind = (idea, using = components) => ideaKind(idea, pages, using);
268
-
269
- it('takes a part from a component name or keyword at the head', () => {
270
- expect(kind('a date range input')).toBe('part');
271
- expect(kind('a date picker with presets')).toBe('part');
272
- expect(kind('a tooltip')).toBe('part');
273
- });
274
-
275
- it('takes a page word or a family word at the head as a page', () => {
276
- expect(kind('a calendar')).toBe('part');
277
- expect(kind('a team calendar page')).toBe('page');
278
- // Table is a component, but table is also a family of page templates.
279
- expect(kind('a data table with filters')).toBe('page');
280
- });
281
-
282
- it("reads parts from the project's own components", () => {
283
- // An integration's component joins the vocabulary by existing.
284
- expect(kind('a revenue gauge')).toBe('page');
285
- expect(
286
- kind('a revenue gauge', [...components, component('AcmeGauge')]),
287
- ).toBe('part');
288
- });
289
-
290
- it("takes an idea that lists a page's worth of pieces as a page", () => {
291
- expect(kind('a calendar with a tooltip')).toBe('part');
292
- expect(kind('a calendar, a tooltip, and a date range input')).toBe('page');
293
- });
294
-
295
- it('takes the frame of a container phrase as the frame, not the head', () => {
296
- expect(kind('a dialog')).toBe('part');
297
- expect(kind('saved drafts in a modal')).toBe('page');
298
- });
299
-
300
- it('takes a change to an existing page or part as an edit', () => {
301
- expect(kind('add a sort toggle to the existing reports table')).toBe(
302
- 'edit',
303
- );
304
- expect(kind('reuse the existing tooltip on the chart')).toBe('edit');
305
- });
306
-
307
- it('does not take "existing" that names no page or part as an edit', () => {
308
- expect(kind('a new settings page inspired by the existing one')).toBe(
309
- 'page',
310
- );
311
- expect(kind('show existing users in a settings page')).toBe('page');
312
- });
313
-
314
- it('does not take a request for a new page as an edit', () => {
315
- expect(
316
- kind('a new settings page based on the existing settings page'),
317
- ).toBe('page');
318
- expect(kind('clone the existing table as a new page')).toBe('page');
319
- // "A new column" asks for a part, so the change stays a change.
320
- expect(kind('add a new column to the existing reports table')).toBe('edit');
321
- });
322
- });
323
-
324
- describe('pickStart on parts and edits (spec:AST-048/FR3)', () => {
325
- const shipped = Promise.all([loadPageTemplates(REPO), loadComponents(REPO)]);
326
- /** @param {string} query */
327
- const start = async query => {
328
- const [catalog, components] = await shipped;
329
- const kind = ideaKind(query, catalog, components);
330
- return pickStart(rankPages(query, catalog), kind)?.name ?? null;
331
- };
332
-
333
- it('starts a part from the page it names, else from the app shell', async () => {
334
- expect(await start('an empty state for a settings page')).toBe('settings');
335
- expect(await start('a date range picker')).toBeNull();
336
- expect(await start('compact status pill with a tooltip')).toBeNull();
337
- });
338
-
339
- it('starts an edit of an existing page or part from the app shell', async () => {
340
- for (const idea of [
341
- 'add a sparkline column to the existing incidents table',
342
- 'add a sort toggle to the existing reports dashboard',
343
- 'swap the existing banner for a toast',
344
- ]) {
345
- expect(await start(idea)).toBeNull();
346
- }
347
- });
348
-
349
- it('starts a new page that mentions something existing from its template', async () => {
350
- expect(await start('a new dashboard inspired by the existing one')).toBe(
351
- 'dashboard',
352
- );
353
- expect(await start('show existing users in a table page')).toMatch(
354
- /^table/,
355
- );
356
- });
357
-
358
- it('starts a new page that names an existing one from its template', async () => {
359
- for (const idea of [
360
- 'a new dashboard based on the existing dashboard',
361
- 'a new dashboard like the existing dashboard',
362
- 'clone the existing dashboard as a new page',
363
- ]) {
364
- expect(await start(idea)).toBe('dashboard');
365
- }
366
- });
367
-
368
- it('reads a bare "existing" phrase that names a page as the builder\'s page', async () => {
369
- expect(
370
- await start('existing reports dashboard with a date filter'),
371
- ).toBeNull();
372
- });
373
-
374
- it('still starts a whole page from its template', async () => {
375
- expect(
376
- await start('saved drafts in a modal with resume and delete row actions'),
377
- ).toBe('settings-dialog');
378
- });
379
- });
package/api/error.d.mts CHANGED
@@ -1,28 +1,6 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /**
5
- * The error for a write that failed on the filesystem: no permission, a
6
- * read-only mount, a full disk, a path component that is not a directory.
7
- *
8
- * A raw Node errno error reached the envelope as
9
- * `{"error": "EACCES: permission denied, open '/home/you/p/readonly/x.tsx'",
10
- * "code": "ERR_UNKNOWN"}` — the wrong code (ERR_WRITE_FAILED is in the frozen
11
- * registry for exactly this) and an absolute host path in the message. This
12
- * keeps the errno, which is the part that tells you what to fix, and reports
13
- * the target the way every other Astryx message does: relative to the project.
14
- *
15
- * A caller that wrote files before the failure must undo them first and pass
16
- * the ones it could not restore as `unrestored`, so the message never says
17
- * nothing was written when something was.
18
- *
19
- * @param {string} target absolute path the write was aimed at
20
- * @param {string} cwd project root, for the relative form
21
- * @param {unknown} cause the error the filesystem call threw
22
- * @param {string[]} [unrestored] absolute paths an undo could not put back
23
- * @returns {AstryxError}
24
- */
25
- export function writeFailed(target: string, cwd: string, cause: unknown, unrestored?: string[]): AstryxError;
26
4
  export class AstryxError extends Error {
27
5
  /**
28
6
  * @param {string} message
package/api/error.mjs CHANGED
@@ -12,7 +12,6 @@
12
12
  */
13
13
 
14
14
  import {ERROR_CODES} from '../foundation/response/error-codes.mjs';
15
- import * as path from 'node:path';
16
15
 
17
16
  export class AstryxError extends Error {
18
17
  /** @type {import('../foundation/response/base').Suggestion[] | undefined} */
@@ -37,44 +36,3 @@ export class AstryxError extends Error {
37
36
  if (Array.isArray(suggestions) && suggestions.length) this.suggestions = suggestions;
38
37
  }
39
38
  }
40
-
41
- /**
42
- * The error for a write that failed on the filesystem: no permission, a
43
- * read-only mount, a full disk, a path component that is not a directory.
44
- *
45
- * A raw Node errno error reached the envelope as
46
- * `{"error": "EACCES: permission denied, open '/home/you/p/readonly/x.tsx'",
47
- * "code": "ERR_UNKNOWN"}` — the wrong code (ERR_WRITE_FAILED is in the frozen
48
- * registry for exactly this) and an absolute host path in the message. This
49
- * keeps the errno, which is the part that tells you what to fix, and reports
50
- * the target the way every other Astryx message does: relative to the project.
51
- *
52
- * A caller that wrote files before the failure must undo them first and pass
53
- * the ones it could not restore as `unrestored`, so the message never says
54
- * nothing was written when something was.
55
- *
56
- * @param {string} target absolute path the write was aimed at
57
- * @param {string} cwd project root, for the relative form
58
- * @param {unknown} cause the error the filesystem call threw
59
- * @param {string[]} [unrestored] absolute paths an undo could not put back
60
- * @returns {AstryxError}
61
- */
62
- export function writeFailed(target, cwd, cause, unrestored = []) {
63
- const rel = path.relative(cwd, target) || target;
64
- const errno =
65
- typeof (/** @type {any} */ (cause)?.code) === 'string'
66
- ? /** @type {any} */ (cause).code
67
- : null;
68
- const why = errno === 'EACCES' || errno === 'EPERM' ? ' (no permission)' : '';
69
- const outcome =
70
- unrestored.length === 0
71
- ? 'Nothing was written.'
72
- : `Earlier writes could not all be undone: ${unrestored
73
- .map(file => path.relative(cwd, file) || file)
74
- .join(', ')}.`;
75
- return new AstryxError(
76
- `Could not write ${rel}${errno ? `: ${errno}` : ''}${why}. ${outcome}`,
77
- undefined,
78
- ERROR_CODES.ERR_WRITE_FAILED,
79
- );
80
- }
@@ -31,7 +31,7 @@ export function integrationAddAgentDoc(line: string, options?: import("./integra
31
31
  *
32
32
  * @param {'component'|'doc'|'template'|'codemod'|'agent-doc'|'theme'} kind
33
33
  * @param {string} name
34
- * @param {{cwd?: string, dryRun?: boolean, templateType?: 'page'|'block', to?: string, replaces?: string, extends?: string, parent?: string, from?: string}} [options]
34
+ * @param {{cwd?: string, dryRun?: boolean, templateType?: 'page'|'block', to?: string, replaces?: string, extends?: string, parent?: string}} [options]
35
35
  * @returns {Promise<import('./integration-authoring.type.mjs').IntegrationAddResponse>}
36
36
  */
37
37
  export function integrationAdd(kind: "component" | "doc" | "template" | "codemod" | "agent-doc" | "theme", name: string, options?: {
@@ -42,5 +42,4 @@ export function integrationAdd(kind: "component" | "doc" | "template" | "codemod
42
42
  replaces?: string;
43
43
  extends?: string;
44
44
  parent?: string;
45
- from?: string;
46
45
  }): Promise<import("./integration-authoring.type.mjs").IntegrationAddResponse>;
@@ -1211,7 +1211,7 @@ const KIND_OPTIONS = {
1211
1211
  template: new Set(['cwd', 'dryRun', 'templateType']),
1212
1212
  codemod: new Set(['cwd', 'dryRun', 'to']),
1213
1213
  'agent-doc': new Set(['cwd', 'dryRun']),
1214
- theme: new Set(['cwd', 'dryRun', 'from']),
1214
+ theme: new Set(['cwd', 'dryRun']),
1215
1215
  };
1216
1216
 
1217
1217
  /**
@@ -1238,7 +1238,7 @@ function validateKindOptions(kind, options) {
1238
1238
  *
1239
1239
  * @param {'component'|'doc'|'template'|'codemod'|'agent-doc'|'theme'} kind
1240
1240
  * @param {string} name
1241
- * @param {{cwd?: string, dryRun?: boolean, templateType?: 'page'|'block', to?: string, replaces?: string, extends?: string, parent?: string, from?: string}} [options]
1241
+ * @param {{cwd?: string, dryRun?: boolean, templateType?: 'page'|'block', to?: string, replaces?: string, extends?: string, parent?: string}} [options]
1242
1242
  * @returns {Promise<import('./integration-authoring.type.mjs').IntegrationAddResponse>}
1243
1243
  */
1244
1244
  export async function integrationAdd(kind, name, options = {}) {
@@ -1270,10 +1270,6 @@ export async function integrationAdd(kind, name, options = {}) {
1270
1270
  case 'agent-doc':
1271
1271
  return integrationAddAgentDoc(name, options);
1272
1272
  case 'theme':
1273
- return integrationAddTheme(name, {
1274
- cwd: options.cwd,
1275
- dryRun: options.dryRun,
1276
- from: options.from,
1277
- });
1273
+ return integrationAddTheme(name, options);
1278
1274
  }
1279
1275
  }
@@ -12,7 +12,7 @@ import {
12
12
  integrationAddTemplate,
13
13
  } from './add-contribution.mjs';
14
14
  import {validateLocalIntegration} from './validate-integration.mjs';
15
- import {NAMESPACE_DOCS_CLI} from '../../foundation/integrations/cli-requirement.mjs';
15
+ import {DOCS_TREE_CLI} from '../../foundation/integrations/cli-requirement.mjs';
16
16
 
17
17
  let tmpDir;
18
18
 
@@ -355,7 +355,7 @@ describe('integrationAdd doc', () => {
355
355
 
356
356
  // The namespace doc needs a CLI that reads it, declared as an optional peer.
357
357
  const pkg = JSON.parse(fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'));
358
- expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': '>=0.6.4'});
358
+ expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': `>=${DOCS_TREE_CLI}`});
359
359
  expect(pkg.peerDependenciesMeta).toEqual({'@astryxdesign/cli': {optional: true}});
360
360
 
361
361
  const second = await integrationAdd('doc', 'upgrading', {
@@ -429,7 +429,7 @@ describe('integrationAdd doc', () => {
429
429
  write('^0.6.0');
430
430
  await integrationAdd('doc', 'deploying', {cwd: tmpDir, parent: 'acme'});
431
431
  expect(JSON.parse(fs.readFileSync(file, 'utf-8')).peerDependencies).toEqual({
432
- '@astryxdesign/cli': `>=${NAMESPACE_DOCS_CLI}`,
432
+ '@astryxdesign/cli': `>=${DOCS_TREE_CLI}`,
433
433
  });
434
434
  write('^9.1.0');
435
435
  await integrationAdd('doc', 'upgrading', {cwd: tmpDir, parent: 'acme'});