@astryxdesign/cli 0.7.16-canary.gbb5e9d4 → 0.7.16-canary.gca36b56

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 (144) hide show
  1. package/README.md +1 -1
  2. package/api/build/_adapter.d.mts +10 -0
  3. package/api/build/_adapter.mjs +24 -0
  4. package/api/build/blocks/blocks.d.mts +1 -0
  5. package/api/build/blocks/blocks.mjs +18 -1
  6. package/api/build/build.doc.mjs +2 -1
  7. package/api/build/kit/shell.weights.json +1 -0
  8. package/api/build/kit/shellcall.d.mts +26 -0
  9. package/api/build/kit/shellcall.mjs +87 -0
  10. package/api/build/kit/start.mjs +67 -4
  11. package/api/build/kit/weights.d.mts +15 -0
  12. package/api/build/kit/weights.mjs +27 -0
  13. package/api/component/__fixtures__/resolutions/modules.txt +1 -1
  14. package/api/doctor/_adapter.d.mts +21 -2
  15. package/api/doctor/_adapter.mjs +41 -1
  16. package/api/doctor/built-checks.mjs +1 -1
  17. package/api/doctor/doctor.d.mts +26 -0
  18. package/api/doctor/doctor.doc.mjs +1 -1
  19. package/api/doctor/doctor.mjs +139 -8
  20. package/api/doctor/theme-checks.mjs +171 -18
  21. package/api/icon/_adapter.d.mts +7 -3
  22. package/api/icon/_adapter.mjs +12 -3
  23. package/api/icon/icon.type.d.mts +15 -0
  24. package/api/icon/icon.type.mjs +10 -3
  25. package/api/icon/iconUse.doc.mjs +19 -5
  26. package/api/icon/list/list.mjs +7 -1
  27. package/api/icon/use/use.d.mts +8 -5
  28. package/api/icon/use/use.mjs +95 -13
  29. package/api/init/run/run.mjs +1 -0
  30. package/api/integration/add-contribution.mjs +3 -3
  31. package/api/integration/pack-check.mjs +1 -1
  32. package/api/search/_adapter.mjs +12 -0
  33. package/api/search/_entries.d.mts +2 -1
  34. package/api/search/_entries.mjs +28 -1
  35. package/api/swizzle/_moduleGraph.mjs +1 -1
  36. package/api/template/template.type.d.mts +6 -2
  37. package/api/template/template.type.mjs +2 -1
  38. package/api/theme/_adapter.mjs +16 -2
  39. package/api/theme/_fork.mjs +1 -1
  40. package/api/theme/build/build.d.mts +60 -9
  41. package/api/theme/build/build.mjs +163 -75
  42. package/api/theme/generateTonalPalette.doc.mjs +2 -2
  43. package/api/theme/palette/generate/generator.mjs +141 -2
  44. package/api/theme/theme.type.d.mts +39 -0
  45. package/api/theme/theme.type.mjs +21 -0
  46. package/api/theme/themeBuild.doc.mjs +1 -1
  47. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  48. package/api/theme-edit/_adapter.d.mts +7 -2
  49. package/api/theme-edit/_adapter.mjs +111 -28
  50. package/api/theme-edit/_check.d.mts +25 -2
  51. package/api/theme-edit/_check.mjs +251 -61
  52. package/api/theme-edit/_context.d.mts +2 -1
  53. package/api/theme-edit/_context.mjs +19 -1
  54. package/api/theme-edit/_edit.d.mts +16 -0
  55. package/api/theme-edit/_edit.mjs +360 -59
  56. package/api/theme-edit/_how-question.d.mts +8 -0
  57. package/api/theme-edit/_how-question.mjs +169 -22
  58. package/api/theme-edit/_marks.d.mts +13 -0
  59. package/api/theme-edit/_marks.mjs +15 -0
  60. package/api/theme-edit/_palette.d.mts +27 -0
  61. package/api/theme-edit/_palette.mjs +112 -8
  62. package/api/theme-edit/_preview-app.d.mts +46 -1
  63. package/api/theme-edit/_preview-app.mjs +367 -36
  64. package/api/theme-edit/_preview.d.mts +55 -0
  65. package/api/theme-edit/_preview.mjs +231 -6
  66. package/api/theme-edit/_project.d.mts +4 -0
  67. package/api/theme-edit/_project.mjs +27 -6
  68. package/api/theme-edit/_settings.d.mts +61 -2
  69. package/api/theme-edit/_settings.mjs +317 -115
  70. package/api/theme-edit/_tables.mjs +1 -1
  71. package/api/theme-edit/theme-edit.type.d.mts +30 -2
  72. package/api/theme-edit/theme-edit.type.mjs +10 -2
  73. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  74. package/assets/codemods/parse.mjs +2 -2
  75. package/assets/docs/author-a-theme.doc.mjs +1 -1
  76. package/assets/docs/theme.doc.dense.mjs +1 -1
  77. package/assets/docs/theme.doc.mjs +1 -1
  78. package/assets/docs/theme.doc.zh.mjs +4 -3
  79. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  80. package/assets/docs/tree/icon-sets.doc.mjs +63 -8
  81. package/assets/docs.generated.json +2 -2
  82. package/assets/self-audit.generated.json +1 -1
  83. package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs +21 -0
  84. package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx +62 -0
  85. package/assets/templates/components.generated.json +1 -1
  86. package/assets/templates/pages/ai-chat/page.tsx +20 -2
  87. package/assets/templates/themes/neutral/neutralPalettes.generated.receipt.json +2 -0
  88. package/authoring/config/config.doc.mjs +8 -0
  89. package/authoring/config/parse.d.mts +1 -0
  90. package/authoring/config/parse.mjs +12 -0
  91. package/authoring/config/type.ts +8 -0
  92. package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +3 -3
  93. package/authoring/shadcn/source-variants.d.mts +1 -1
  94. package/authoring/shadcn/source-variants.mjs +32 -10
  95. package/clients/cli/build-id.generated.json +1 -1
  96. package/clients/cli/commands/experimental/icon.mjs +61 -6
  97. package/clients/cli/commands/experimental/theme.mjs +9 -2
  98. package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
  99. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
  100. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
  101. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
  102. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  103. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  104. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  105. package/clients/cli/commands/theme.doc.mjs +7 -2
  106. package/clients/cli/commands/theme.mjs +65 -21
  107. package/clients/cli/commands.generated.json +1 -1
  108. package/clients/cli/index.mjs +25 -5
  109. package/clients/cli/manifest.generated.json +1 -1
  110. package/foundation/agent-docs/agent-docs.mjs +1 -1
  111. package/foundation/config/config-writer.d.mts +23 -0
  112. package/foundation/config/config-writer.mjs +152 -58
  113. package/foundation/config/project.mjs +53 -2
  114. package/foundation/discovery/component-discovery.mjs +11 -22
  115. package/foundation/discovery/icon-set-checks.mjs +164 -48
  116. package/foundation/discovery/icon-set-discovery.d.mts +38 -5
  117. package/foundation/discovery/icon-set-discovery.mjs +50 -6
  118. package/foundation/discovery/icon-set-theme-maps.d.mts +59 -0
  119. package/foundation/discovery/icon-set-theme-maps.mjs +95 -0
  120. package/foundation/discovery/icon-set-writer.d.mts +2 -3
  121. package/foundation/discovery/icon-set-writer.mjs +58 -17
  122. package/foundation/discovery/module-exports.mjs +1 -15
  123. package/foundation/discovery/template-adapter.mjs +16 -19
  124. package/foundation/discovery/template-icons.d.mts +27 -10
  125. package/foundation/discovery/template-icons.mjs +142 -26
  126. package/foundation/discovery/template-source-tree.mjs +3 -16
  127. package/foundation/discovery/theme-discovery.d.mts +25 -0
  128. package/foundation/discovery/theme-discovery.mjs +86 -48
  129. package/foundation/fs/gather-cache.d.mts +6 -3
  130. package/foundation/fs/gather-cache.mjs +44 -14
  131. package/foundation/integrations/autolink.d.mts +4 -2
  132. package/foundation/integrations/autolink.mjs +4 -2
  133. package/foundation/integrations/cli-requirement.d.mts +16 -5
  134. package/foundation/integrations/cli-requirement.mjs +27 -6
  135. package/foundation/integrations/contribution-fixes.mjs +1 -16
  136. package/foundation/integrations/may-have-integrations.mjs +5 -2
  137. package/foundation/integrations/missing-dependency.d.mts +9 -0
  138. package/foundation/integrations/missing-dependency.mjs +100 -0
  139. package/foundation/integrations/public-imports.mjs +1 -1
  140. package/foundation/render/embedded-imports.mjs +1 -1
  141. package/foundation/runtime/lazy-dependencies.d.mts +14 -0
  142. package/foundation/runtime/lazy-dependencies.mjs +82 -0
  143. package/foundation/xle/browser.d.mts +2 -2
  144. package/package.json +6 -6
package/README.md CHANGED
@@ -112,7 +112,7 @@ Each command declares what it does in a folder outside any project, and `astryx
112
112
  | `search` | Search components, hooks, docs, templates, and themes in one ranked list | `same` |
113
113
  | `swizzle` | Copy component source for customization | `refuse` |
114
114
  | `template` | List, show, or scaffold page and block templates | `same` |
115
- | `theme` | Add, switch, build, and author themes | by subcommand |
115
+ | `theme` | Add, switch, build, and author themes (to make or change one, use experimental theme editor) | by subcommand |
116
116
  | `upgrade` | Update your code after upgrading Astryx, and refresh ShadCN-copied components | `own` |
117
117
 
118
118
  <!-- END GENERATED: commands -->
@@ -69,6 +69,15 @@ export function loadComponents(cwd: string): Promise<ComponentWords[]>;
69
69
  * @returns {import('./kit/weights.mjs').WeightsFile | null}
70
70
  */
71
71
  export function loadWeights(): import("./kit/weights.mjs").WeightsFile | null;
72
+ /**
73
+ * The fixed word table of the shell-start check (kit/shell.weights.json), read
74
+ * once. Null when the file is missing or unreadable.
75
+ * @returns {{threshold: number, weights: Record<string, number>} | null}
76
+ */
77
+ export function loadShellWeights(): {
78
+ threshold: number;
79
+ weights: Record<string, number>;
80
+ } | null;
72
81
  /**
73
82
  * The classifier weights of build's root (tree.weights.json), read once.
74
83
  * @returns {import('../../foundation/route/route.mjs').ClassifierWeights}
@@ -77,6 +86,7 @@ export function loadTreeWeights(): import("../../foundation/route/route.mjs").Cl
77
86
  export function keptBlockCatalog<T>(key: unknown[], compute: () => T, codec: {
78
87
  encode: (value: T) => any;
79
88
  decode: (stored: any) => T;
89
+ valid?: (value: any) => boolean;
80
90
  }): T;
81
91
  /**
82
92
  * The block picker's weights (blocks/blocks.weights.json), read once; null
@@ -164,6 +164,30 @@ export function loadWeights() {
164
164
  return weights ?? null;
165
165
  }
166
166
 
167
+ /** @type {{threshold: number, weights: Record<string, number>} | null | undefined} */
168
+ let shellWeights;
169
+
170
+ /**
171
+ * The fixed word table of the shell-start check (kit/shell.weights.json), read
172
+ * once. Null when the file is missing or unreadable.
173
+ * @returns {{threshold: number, weights: Record<string, number>} | null}
174
+ */
175
+ export function loadShellWeights() {
176
+ if (shellWeights === undefined) {
177
+ try {
178
+ shellWeights = JSON.parse(
179
+ fs.readFileSync(
180
+ new URL('./kit/shell.weights.json', import.meta.url),
181
+ 'utf8',
182
+ ),
183
+ );
184
+ } catch {
185
+ shellWeights = null;
186
+ }
187
+ }
188
+ return shellWeights ?? null;
189
+ }
190
+
167
191
  /** @type {import('../../foundation/route/route.mjs').ClassifierWeights | undefined} */
168
192
  let treeWeights;
169
193
 
@@ -90,6 +90,7 @@ export function pickBlocks(request: string, signals: {
90
90
  export type KeepCatalog = <T>(key: unknown[], compute: () => T, codec: {
91
91
  encode: (value: T) => any;
92
92
  decode: (stored: any) => T;
93
+ valid?: (value: any) => boolean;
93
94
  }) => T;
94
95
  export type BlockPickerWeights = {
95
96
  /**
@@ -45,7 +45,7 @@ import {STOPWORDS} from '../../search/_query.mjs';
45
45
  /**
46
46
  * Keeps a value derived from the catalog between runs (build's adapter does
47
47
  * it beside the kept search catalog), or works it out.
48
- * @typedef {<T>(key: unknown[], compute: () => T, codec: {encode: (value: T) => any, decode: (stored: any) => T}) => T} KeepCatalog
48
+ * @typedef {<T>(key: unknown[], compute: () => T, codec: {encode: (value: T) => any, decode: (stored: any) => T, valid?: (value: any) => boolean}) => T} KeepCatalog
49
49
  */
50
50
 
51
51
  /**
@@ -410,6 +410,23 @@ function computeCatalog(key, catalog, components, weights) {
410
410
  * projection as its numbers.
411
411
  */
412
412
  const CATALOG_CODEC = {
413
+ /**
414
+ * What decode can get wrong in a read-back catalog: its key, each block's
415
+ * component, and projections of one width with finite numbers.
416
+ * @param {any} read
417
+ */
418
+ valid: read => {
419
+ if (read == null || typeof read.key !== 'string') return false;
420
+ const blocks = [...read.blocks.values()];
421
+ const width = blocks[0]?.projected.length;
422
+ return blocks.every(
423
+ (/** @type {any} */ b) =>
424
+ typeof b.component === 'string' &&
425
+ b.projected.length > 0 &&
426
+ b.projected.length === width &&
427
+ [...b.projected].every(Number.isFinite),
428
+ );
429
+ },
413
430
  /** @param {ReturnType<typeof computeCatalog>} read */
414
431
  encode: read => ({
415
432
  key: read.key,
@@ -20,7 +20,8 @@ export const doc = {
20
20
  'how-to-build-a-page playbook as data: the workflow steps with their ' +
21
21
  'commands, the on-system rules, and related lookups. Called with a query it names the page template to ' +
22
22
  'START from (always one: the page template a ranker built for long descriptions puts first; for a part ' +
23
- 'of a page, the page it names; else the app shell) and the next two templates, ' +
23
+ 'of a page, the page it names; else the app shell, unless the idea reads as a whole page, which starts ' +
24
+ 'from the closest page template) and the next two templates, ' +
24
25
  'and the unified search grouped around it: the other close page templates, drop-in blocks, and ' +
25
26
  'idea-specific components/hooks, plus the always-on frame + foundation. A template carries the page ' +
26
27
  'frame and spacing, so the kit never recommends composing a page from components.',
@@ -0,0 +1 @@
1
+ {"threshold":1.5,"weights":{"b:above_an":-0.5,"b:above_existing":-0.5,"b:action_and":-1.0,"b:action_with":-1.0,"b:actions_and":-1.0,"b:add_button":1.0,"b:all_and":-1.0,"b:an_add":0.5,"b:an_empty":-1.0,"b:an_existing":-1.5,"b:an_external":-1.0,"b:an_open":-1.0,"b:an_optional":-0.5,"b:analytics_dashboard":-0.5,"b:and_accessible":-1.5,"b:and_action":-1.0,"b:and_after":0.5,"b:and_before":-0.5,"b:and_cancel":-0.5,"b:and_collapsed":-1.0,"b:and_collapsible":0.5,"b:and_compact":1.5,"b:and_confirmation":-0.5,"b:and_current":-0.5,"b:and_dark":-1.0,"b:and_data":0.5,"b:and_date":-0.5,"b:and_dense":0.5,"b:and_detail":1.5,"b:and_empty":-0.5,"b:and_evidence":0.5,"b:and_explicit":1.0,"b:and_inline":1.0,"b:and_links":0.5,"b:and_live":1.0,"b:and_metadata":1.0,"b:and_next":1.0,"b:and_no":-1.0,"b:and_one":0.5,"b:and_open":0.5,"b:and_optional":1.0,"b:and_percentage":-0.5,"b:and_refresh":-1.0,"b:and_saved":-0.5,"b:and_selected":1.0,"b:and_separate":1.0,"b:and_show":1.5,"b:and_source":-0.5,"b:and_status":0.5,"b:and_table":-0.5,"b:and_three":-1.0,"b:and_time":-0.5,"b:and_two":1.0,"b:and_unavailable":-1.5,"b:app_name":-0.5,"b:app_shell":0.5,"b:app_with":0.5,"b:banner_for":-0.5,"b:banner_with":-0.5,"b:bar_and":-1.0,"b:bar_chart":-0.5,"b:bar_with":0.5,"b:bars_and":0.5,"b:before_after":1.0,"b:before_and":0.5,"b:below_the":-0.5,"b:beside_an":-0.5,"b:button_and":1.0,"b:button_in":-0.5,"b:button_opening":-0.5,"b:button_with":-0.5,"b:buttons_and":0.5,"b:calendar_with":1.5,"b:card_with":-1.5,"b:cards_and":1.5,"b:cell_with":-0.5,"b:chart_and":1.0,"b:chart_legend":-0.5,"b:chart_with":-1.5,"b:charts_with":-1.5,"b:columns_and":-0.5,"b:compact_chart":-0.5,"b:compact_inline":-0.5,"b:compact_model":-0.5,"b:compact_read":-0.5,"b:compact_status":-0.5,"b:compact_table":-1.0,"b:comparison_table":0.5,"b:comparison_with":1.0,"b:confirmation_dialog":-0.5,"b:controls_for":-0.5,"b:controls_with":-1.5,"b:copy_link":-1.0,"b:counts_and":1.0,"b:coverage_and":-0.5,"b:coverage_table":-0.5,"b:dashboard_with":0.5,"b:data_dashboard":-0.5,"b:data_source":0.5,"b:data_table":-0.5,"b:date_and":-0.5,"b:dense_data":1.0,"b:dense_read":0.5,"b:dense_table":-1.0,"b:description_and":0.5,"b:detail_dialog":1.0,"b:detail_page":-0.5,"b:detail_panel":0.5,"b:detail_with":1.0,"b:details_and":-0.5,"b:details_dialog":-0.5,"b:details_panel":0.5,"b:details_with":-0.5,"b:dialog_and":-0.5,"b:dialog_with":-2.5,"b:each_with":-1.5,"b:empty_and":0.5,"b:empty_state":-0.5,"b:empty_states":-0.5,"b:error_and":0.5,"b:error_banner":0.5,"b:error_states":-0.5,"b:evidence_and":1.0,"b:evidence_table":1.0,"b:existing_analytics":-0.5,"b:existing_app":3.0,"b:existing_dashboard":-0.5,"b:existing_dense":-2.0,"b:existing_metric":-0.5,"b:existing_metrics":-0.5,"b:existing_overview":-0.5,"b:existing_page":-1.0,"b:existing_review":-0.5,"b:existing_run":-0.5,"b:existing_sidebar":-0.5,"b:existing_test":-0.5,"b:external_link":-0.5,"b:external_links":-0.5,"b:fields_and":-0.5,"b:filter_for":-0.5,"b:filters_and":0.5,"b:filters_with":-0.5,"b:for_an":1.0,"b:for_the":1.0,"b:form_and":0.5,"b:form_dialog":-0.5,"b:form_to":0.5,"b:form_with":1.0,"b:full_width":0.5,"b:graph_with":-0.5,"b:grid_of":1.0,"b:grid_with":1.0,"b:header_and":-2.0,"b:header_with":-0.5,"b:heading_and":-0.5,"b:headings_and":-0.5,"b:health_dashboard":-0.5,"b:history_table":0.5,"b:history_with":0.5,"b:hover_card":-0.5,"b:in_an":-0.5,"b:inside_existing":-0.5,"b:inside_the":2.0,"b:inspector_with":-1.0,"b:keep_existing":-0.5,"b:keep_the":-2.0,"b:keyboard_accessible":-0.5,"b:label_and":-1.0,"b:labels_and":-0.5,"b:landing_page":-0.5,"b:last_updated":0.5,"b:left_and":1.0,"b:light_and":-0.5,"b:line_chart":1.5,"b:link_button":-0.5,"b:link_to":1.0,"b:links_and":-0.5,"b:links_in":-1.0,"b:links_to":1.5,"b:list_and":-1.0,"b:list_with":1.0,"b:loading_empty":1.0,"b:loading_error":0.5,"b:menu_with":-1.0,"b:metadata_and":0.5,"b:metadata_rows":-0.5,"b:metadata_with":-1.0,"b:metric_card":-0.5,"b:metric_cards":-1.0,"b:metrics_and":-1.0,"b:metrics_table":-1.0,"b:metrics_with":0.5,"b:modal_with":-0.5,"b:name_and":-0.5,"b:names_and":-0.5,"b:navigation_and":0.5,"b:navigation_with":-0.5,"b:next_action":0.5,"b:next_to":-0.5,"b:notice_with":-0.5,"b:of_an":-0.5,"b:of_the":0.5,"b:on_an":-0.5,"b:on_hover":-0.5,"b:on_mobile":-0.5,"b:on_the":0.5,"b:one_compact":-0.5,"b:one_primary":-0.5,"b:overview_and":-1.0,"b:overview_with":2.0,"b:page_and":-0.5,"b:page_for":1.0,"b:page_frame":-1.0,"b:page_header":-1.0,"b:page_with":1.0,"b:panel_with":-2.5,"b:per_row":0.5,"b:picker_with":-0.5,"b:popover_with":-1.0,"b:preserve_the":-0.5,"b:primary_action":0.5,"b:report_with":1.0,"b:results_table":-0.5,"b:results_with":-0.5,"b:retry_button":-0.5,"b:review_page":0.5,"b:review_queue":0.5,"b:review_table":-0.5,"b:review_with":0.5,"b:right_side":-0.5,"b:row_and":-0.5,"b:row_with":-0.5,"b:rows_and":0.5,"b:rows_in":-0.5,"b:rows_with":-0.5,"b:run_history":0.5,"b:save_and":-0.5,"b:search_and":-0.5,"b:search_with":1.5,"b:searchable_multi":-1.0,"b:section_with":-1.0,"b:sections_with":-1.5,"b:segmented_control":-0.5,"b:selector_for":-0.5,"b:selector_in":-0.5,"b:selector_to":-1.0,"b:selectors_and":-0.5,"b:series_chart":-1.0,"b:shell_and":1.5,"b:shell_with":-0.5,"b:side_navigation":-1.0,"b:sidebar_and":1.5,"b:sidebar_with":-1.5,"b:single_page":1.5,"b:source_and":0.5,"b:source_details":-0.5,"b:source_links":1.0,"b:state_for":-0.5,"b:status_in":-0.5,"b:status_rows":1.0,"b:summary_and":1.0,"b:summary_card":-0.5,"b:summary_table":-0.5,"b:summary_with":-1.0,"b:switch_and":0.5,"b:tab_with":0.5,"b:table_and":0.5,"b:table_cell":-0.5,"b:table_column":-1.0,"b:table_of":0.5,"b:table_row":-1.0,"b:table_rows":-0.5,"b:table_to":-0.5,"b:table_with":0.5,"b:tables_and":1.0,"b:tables_with":0.5,"b:tags_and":-0.5,"b:text_and":-0.5,"b:text_input":2.5,"b:that_opens":-0.5,"b:the_app":1.0,"b:the_current":-1.5,"b:the_existing":-1.0,"b:the_left":0.5,"b:the_page":-1.0,"b:the_right":0.5,"b:the_selected":0.5,"b:time_and":-1.0,"b:time_range":0.5,"b:time_series":0.5,"b:timeline_with":-0.5,"b:timestamp_and":-0.5,"b:title_and":-0.5,"b:to_show":-1.0,"b:to_the":-1.0,"b:toggle_to":-0.5,"b:tokens_and":-0.5,"b:tool_with":0.5,"b:toolbar_and":1.0,"b:toolbar_with":-1.0,"b:trend_and":0.5,"b:two_column":-0.5,"b:two_compact":-1.0,"b:unavailable_states":-1.0,"b:update_the":-0.5,"b:using_the":1.0,"b:warning_and":-0.5,"b:while_preserving":-0.5,"b:with_clickable":0.5,"b:with_colored":-0.5,"b:with_compact":-0.5,"b:with_copy":-1.0,"b:with_counts":-0.5,"b:with_current":0.5,"b:with_editable":0.5,"b:with_exact":-0.5,"b:with_expandable":-1.0,"b:with_explicit":-0.5,"b:with_filters":0.5,"b:with_four":-0.5,"b:with_grouped":0.5,"b:with_hover":1.0,"b:with_independent":-0.5,"b:with_inline":1.5,"b:with_one":0.5,"b:with_per":0.5,"b:with_progress":-1.0,"b:with_read":-0.5,"b:with_request":1.0,"b:with_search":-0.5,"b:with_separate":-0.5,"b:with_shared":0.5,"b:with_tabs":0.5,"b:with_the":-0.5,"b:with_title":-1.0,"b:without_changing":-0.5,"b:workflow_with":1.5,"b:workspace_with":1.5,"base":-0.5,"commas:0":-0.5,"commas:3":1.0,"commas:4":1.0,"h:3":-0.5,"k:edit":-1.0,"k:page":0.5,"k:part":-0.5,"len:0":-1.0,"len:1":-1.0,"len:2":-0.5,"len:4":0.5,"len:5":0.5,"len:6":1.5,"s:0":-0.5,"s:4":0.5,"s:5":0.5,"u:above":-0.5,"u:accepted":-0.5,"u:access":1.0,"u:accessible":-1.0,"u:account":0.5,"u:actions":-0.5,"u:add":-1.5,"u:admin":1.0,"u:after":-0.5,"u:agent":0.5,"u:ai":0.5,"u:alert":1.0,"u:all":-0.5,"u:analytics":0.5,"u:animated":0.5,"u:answer":0.5,"u:application":0.5,"u:apply":-0.5,"u:architecture":1.0,"u:area":-0.5,"u:areas":1.0,"u:artifact":-0.5,"u:artifacts":-0.5,"u:as":-0.5,"u:assistant":-0.5,"u:at":0.5,"u:attachment":-1.0,"u:badge":-1.0,"u:banner":-0.5,"u:bar":-0.5,"u:below":-1.0,"u:benchmark":1.0,"u:between":-0.5,"u:blocked":-0.5,"u:blocking":-0.5,"u:blocks":0.5,"u:board":1.5,"u:body":0.5,"u:bounded":-1.0,"u:brief":0.5,"u:browser":1.0,"u:bug":-1.0,"u:bulk":-0.5,"u:button":-0.5,"u:buttons":-0.5,"u:by":0.5,"u:calendar":1.0,"u:cancel":-0.5,"u:candidate":0.5,"u:candidates":-0.5,"u:capture":0.5,"u:card":-0.5,"u:catalog":0.5,"u:category":0.5,"u:cells":0.5,"u:center":0.5,"u:change":-0.5,"u:changes":-0.5,"u:changing":-0.5,"u:chart":-1.0,"u:charts":0.5,"u:check":0.5,"u:checkboxes":-1.0,"u:chips":-1.0,"u:choose":-1.0,"u:clear":-1.0,"u:close":-0.5,"u:closed":-1.5,"u:cohort":0.5,"u:collapse":-0.5,"u:collapsed":-1.5,"u:collapsible":-0.5,"u:color":-0.5,"u:colors":-0.5,"u:columns":0.5,"u:comment":-0.5,"u:comments":-1.5,"u:compact":-0.5,"u:compare":2.0,"u:completed":-1.0,"u:completion":-0.5,"u:component":1.0,"u:concise":-0.5,"u:config":1.0,"u:configuration":-0.5,"u:confirm":-1.0,"u:confirmed":-1.0,"u:console":1.0,"u:containing":0.5,"u:content":-1.0,"u:contextual":-1.0,"u:conversation":-0.5,"u:copy":-0.5,"u:count":-0.5,"u:counts":-1.0,"u:create":0.5,"u:custom":-0.5,"u:daily":0.5,"u:dark":0.5,"u:dashboard":0.5,"u:data":-0.5,"u:dataset":0.5,"u:day":-0.5,"u:days":-0.5,"u:decision":0.5,"u:decisions":1.5,"u:default":-2.0,"u:definition":-0.5,"u:definitions":0.5,"u:delete":-0.5,"u:delta":-1.5,"u:demand":-0.5,"u:dense":0.5,"u:dependency":-1.0,"u:description":-0.5,"u:descriptions":-1.0,"u:destination":-1.5,"u:detailed":-0.5,"u:details":0.5,"u:diagnostic":0.5,"u:diagnostics":0.5,"u:dialog":-1.0,"u:directory":2.5,"u:disabled":-0.5,"u:disclosure":-0.5,"u:display":-0.5,"u:distinct":-0.5,"u:document":1.5,"u:documentation":0.5,"u:dot":-0.5,"u:dots":0.5,"u:drafts":-0.5,"u:drawer":-1.0,"u:drill":0.5,"u:drop":-0.5,"u:dropdown":-0.5,"u:duration":-0.5,"u:each":1.0,"u:editable":1.0,"u:editor":-0.5,"u:edits":-1.0,"u:embedded":-1.0,"u:end":-0.5,"u:entity":0.5,"u:error":-0.5,"u:event":0.5,"u:events":0.5,"u:evidence":-0.5,"u:existing":-2.5,"u:expand":-1.0,"u:expandable":-0.5,"u:expanded":-1.5,"u:experiment":-0.5,"u:explain":-1.0,"u:explaining":-0.5,"u:explicit":-1.0,"u:failed":-0.5,"u:failure":-0.5,"u:fallback":-1.0,"u:feature":1.0,"u:feed":0.5,"u:feedback":-0.5,"u:fields":-0.5,"u:file":0.5,"u:filterable":1.5,"u:filtered":-1.0,"u:filters":0.5,"u:findings":0.5,"u:first":0.5,"u:flow":-0.5,"u:follow":0.5,"u:footer":-1.5,"u:for":-1.0,"u:form":1.0,"u:four":1.0,"u:from":-0.5,"u:gallery":0.5,"u:gap":-0.5,"u:gate":1.0,"u:generate":0.5,"u:generated":-0.5,"u:global":0.5,"u:graph":0.5,"u:grid":1.0,"u:group":0.5,"u:grouped":0.5,"u:guide":2.0,"u:header":-0.5,"u:headers":-0.5,"u:heading":-0.5,"u:headings":0.5,"u:headline":0.5,"u:health":0.5,"u:hierarchy":-0.5,"u:highlight":-0.5,"u:highlighted":0.5,"u:home":0.5,"u:horizontal":0.5,"u:host":-0.5,"u:hours":0.5,"u:hover":-1.0,"u:icon":-1.5,"u:icons":-0.5,"u:id":-0.5,"u:in":-1.0,"u:inbox":1.0,"u:independently":0.5,"u:indicator":-0.5,"u:info":-1.0,"u:information":-0.5,"u:informational":-1.0,"u:inline":-1.5,"u:inside":-1.0,"u:inspector":1.5,"u:intake":1.5,"u:interactive":1.0,"u:into":-1.0,"u:inventory":1.5,"u:item":-0.5,"u:items":-1.5,"u:its":0.5,"u:job":0.5,"u:jobs":-0.5,"u:json":0.5,"u:keep":-1.0,"u:keeping":-0.5,"u:label":-1.0,"u:labeled":-0.5,"u:labeling":1.0,"u:labels":-1.0,"u:landing":1.0,"u:legend":-0.5,"u:level":-1.0,"u:library":0.5,"u:lifecycle":0.5,"u:light":-0.5,"u:line":-0.5,"u:lines":-0.5,"u:linked":-1.0,"u:links":-0.5,"u:list":1.0,"u:listing":1.0,"u:lists":0.5,"u:load":-0.5,"u:loading":-1.0,"u:log":2.0,"u:long":-0.5,"u:lookup":1.0,"u:manager":0.5,"u:match":-1.0,"u:matching":1.0,"u:matrix":1.5,"u:measured":0.5,"u:measurement":0.5,"u:message":-0.5,"u:messages":-1.5,"u:metadata":-0.5,"u:metric":0.5,"u:minimal":-0.5,"u:mobile":1.0,"u:modal":-1.0,"u:mode":-0.5,"u:model":-0.5,"u:monitoring":-0.5,"u:more":0.5,"u:multi":0.5,"u:multiple":-0.5,"u:my":1.0,"u:name":-0.5,"u:names":-0.5,"u:nav":-0.5,"u:navigation":-0.5,"u:neutral":-1.0,"u:new":-0.5,"u:node":-0.5,"u:not":-1.0,"u:note":1.0,"u:numbered":-0.5,"u:numbers":-1.5,"u:observed":-1.0,"u:of":0.5,"u:on":-1.0,"u:only":0.5,"u:open":-0.5,"u:opening":-0.5,"u:opens":-0.5,"u:operations":0.5,"u:option":0.5,"u:optional":-1.0,"u:options":-1.5,"u:outcome":-1.0,"u:output":-0.5,"u:over":-1.0,"u:overlay":-1.0,"u:owner":0.5,"u:page":1.0,"u:pages":0.5,"u:paginated":0.5,"u:pagination":-0.5,"u:pane":1.0,"u:panel":-0.5,"u:panels":1.0,"u:percentage":-0.5,"u:performance":0.5,"u:person":-0.5,"u:pill":-1.5,"u:pills":-0.5,"u:pinned":0.5,"u:pipeline":-1.0,"u:placeholder":-2.0,"u:plus":0.5,"u:popover":-0.5,"u:post":0.5,"u:presentation":1.5,"u:preserve":-1.5,"u:preserving":-2.5,"u:preview":0.5,"u:previews":0.5,"u:primary":0.5,"u:priority":1.5,"u:production":0.5,"u:progress":0.5,"u:project":0.5,"u:projects":1.0,"u:prominent":0.5,"u:prompt":1.0,"u:public":1.0,"u:publication":0.5,"u:publish":1.0,"u:published":1.5,"u:quality":-0.5,"u:query":-0.5,"u:question":1.5,"u:queue":1.0,"u:quick":0.5,"u:quiet":1.0,"u:rail":-2.0,"u:range":-1.0,"u:ranked":0.5,"u:rate":0.5,"u:read":0.5,"u:readiness":-0.5,"u:reading":0.5,"u:reason":-0.5,"u:reasoning":-0.5,"u:recording":0.5,"u:reference":0.5,"u:region":-1.0,"u:release":0.5,"u:rename":-0.5,"u:report":1.0,"u:reporting":-0.5,"u:reports":0.5,"u:request":0.5,"u:requirement":-0.5,"u:resizable":-0.5,"u:response":-1.0,"u:responsive":-0.5,"u:result":-0.5,"u:results":0.5,"u:retain":-1.0,"u:retry":-1.0,"u:review":0.5,"u:reviewed":0.5,"u:rollout":-0.5,"u:routing":1.0,"u:rows":0.5,"u:rule":-0.5,"u:running":-1.5,"u:runs":0.5,"u:save":-1.5,"u:saved":0.5,"u:scoped":0.5,"u:score":0.5,"u:scorecard":0.5,"u:scroll":-1.5,"u:scrollable":0.5,"u:scrolling":-0.5,"u:search":0.5,"u:section":-1.0,"u:sections":1.0,"u:segment":-1.0,"u:select":-1.0,"u:selectable":-0.5,"u:selecting":-0.5,"u:selection":0.5,"u:semantic":-0.5,"u:send":-0.5,"u:separate":-1.0,"u:separated":-1.0,"u:series":-0.5,"u:server":0.5,"u:service":0.5,"u:sessions":0.5,"u:setup":0.5,"u:share":-1.0,"u:shared":-0.5,"u:shell":0.5,"u:short":0.5,"u:show":-0.5,"u:shows":1.0,"u:side":0.5,"u:sidebar":-0.5,"u:single":0.5,"u:six":1.0,"u:small":-0.5,"u:snapshot":-1.0,"u:sortable":0.5,"u:sources":-1.0,"u:spacing":-1.0,"u:stacked":-1.0,"u:stage":0.5,"u:stale":-1.0,"u:step":-0.5,"u:stepper":1.0,"u:steps":0.5,"u:sticky":0.5,"u:strip":-1.0,"u:style":1.0,"u:submission":0.5,"u:submit":1.0,"u:suggestions":-1.0,"u:summaries":0.5,"u:surface":-0.5,"u:svg":0.5,"u:system":1.5,"u:tab":-0.5,"u:table":0.5,"u:tables":0.5,"u:tabs":0.5,"u:tag":-1.0,"u:tags":-0.5,"u:target":-0.5,"u:team":1.0,"u:technical":-0.5,"u:text":-0.5,"u:that":-0.5,"u:the":-1.0,"u:theme":0.5,"u:then":2.0,"u:tiles":1.0,"u:timestamp":-1.5,"u:timing":0.5,"u:to":-0.5,"u:toggles":1.0,"u:token":-0.5,"u:tokens":-0.5,"u:tool":1.0,"u:toolbar":-0.5,"u:tools":0.5,"u:top":-1.0,"u:totals":-0.5,"u:trace":-0.5,"u:tracker":0.5,"u:tracking":1.0,"u:transcript":-0.5,"u:tree":1.0,"u:trends":2.0,"u:triage":0.5,"u:turn":-0.5,"u:type":-0.5,"u:typed":-0.5,"u:types":-1.5,"u:unavailable":-1.5,"u:up":-0.5,"u:updated":0.5,"u:upload":1.0,"u:url":0.5,"u:usage":-1.0,"u:use":-0.5,"u:using":0.5,"u:validation":-1.0,"u:value":-0.5,"u:values":-1.0,"u:version":-1.0,"u:versus":-0.5,"u:vertical":-0.5,"u:vertically":-0.5,"u:view":0.5,"u:viewer":1.0,"u:visible":-0.5,"u:visual":1.0,"u:visualization":-0.5,"u:volume":0.5,"u:warning":-1.0,"u:warnings":0.5,"u:weekly":1.5,"u:when":-2.0,"u:where":1.0,"u:while":-2.0,"u:widget":-1.0,"u:widgets":-1.5,"u:windows":1.0,"u:with":0.5,"u:without":-1.5,"u:wizard":-0.5,"u:work":0.5,"u:workflow":0.5,"u:workspace":1.0,"u:wrapped":-0.5,"u:wrapping":-0.5}}
@@ -0,0 +1,26 @@
1
+ // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
+ // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
+
4
+ /**
5
+ * Whether an idea carries an edit phrase. It needs no word table.
6
+ * @param {string} idea
7
+ * @returns {boolean}
8
+ */
9
+ export function hasEditPhrase(idea: string): boolean;
10
+ /**
11
+ * The ranker's best page template that is not a shell, or undefined.
12
+ * @param {import('./rank.mjs').RankedPage[]} ranked
13
+ */
14
+ export function bestPage(ranked: import("./rank.mjs").RankedPage[]): import("./words.mjs").RankedPage | undefined;
15
+ /**
16
+ * The text score without its threshold, and whether the edit rule fires.
17
+ * Null without the table or a page to weigh.
18
+ * @param {string} idea
19
+ * @param {import('./rank.mjs').IdeaKind} kind
20
+ * @param {import('./rank.mjs').RankedPage[]} ranked
21
+ * @returns {{edit: boolean, score: number} | null}
22
+ */
23
+ export function shellCallScore(idea: string, kind: import("./rank.mjs").IdeaKind, ranked: import("./rank.mjs").RankedPage[]): {
24
+ edit: boolean;
25
+ score: number;
26
+ } | null;
@@ -0,0 +1,87 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Whether an idea that build would start on the app shell still asks
5
+ * for a whole page.
6
+ *
7
+ * @input The idea, its kind (`ideaKind`), and the page ranker's output.
8
+ * @output True when the idea reads as a new page, so build starts from the
9
+ * closest page template instead of the empty shell.
10
+ * @position Beside start.mjs (api/build/kit/). It runs only on a shell start,
11
+ * after the placement rules. An idea with an edit phrase keeps the shell.
12
+ *
13
+ * The call is a linear score over fixed weights
14
+ * (`shell.weights.json`): the idea's words and word pairs, its kind, its
15
+ * length, and how strongly the ranker's best page template matched.
16
+ */
17
+
18
+ import {loadShellWeights} from '../_adapter.mjs';
19
+ import {SHELL_FAMILY} from './words.mjs';
20
+
21
+ /**
22
+ * Words that mark a change to a page or app the builder already has.
23
+ */
24
+ const EDIT =
25
+ /\b(existing|current|my (page|app|dashboard|screen|site)|add (a |an |the )?\w* ?to|change|fix|move|rename|restyle|update|modify|replace|remove|tweak|adjust|improve|refactor|our (page|app))\b/;
26
+
27
+ /**
28
+ * Whether an idea carries an edit phrase. It needs no word table.
29
+ * @param {string} idea
30
+ * @returns {boolean}
31
+ */
32
+ export function hasEditPhrase(idea) {
33
+ return EDIT.test(String(idea).toLowerCase());
34
+ }
35
+
36
+ /**
37
+ * The features the weights are keyed by.
38
+ * @param {string} text the idea, lower case
39
+ * @param {string} kind
40
+ * @param {import('./rank.mjs').RankedPage | undefined} best the ranker's best
41
+ * page template that is not a shell
42
+ * @returns {Set<string>}
43
+ */
44
+ function featuresOf(text, kind, best) {
45
+ const words = text.match(/[a-z]+/g) ?? [];
46
+ const features = new Set(['bias', `k:${kind}`]);
47
+ words.forEach((word, i) => {
48
+ features.add(`u:${word}`);
49
+ if (i > 0) features.add(`b:${words[i - 1]}_${word}`);
50
+ });
51
+ if (best) {
52
+ features.add(`s:${Math.min(Math.floor(best.score / 5), 6)}`);
53
+ features.add(`h:${Math.min(best.hits, 4)}`);
54
+ if (best.familyNamed) features.add('fam');
55
+ if (best.base) features.add('base');
56
+ }
57
+ features.add(`len:${Math.min(Math.floor(words.length / 5), 6)}`);
58
+ features.add(`commas:${Math.min((text.match(/,/g) ?? []).length, 4)}`);
59
+ return features;
60
+ }
61
+
62
+ /**
63
+ * The ranker's best page template that is not a shell, or undefined.
64
+ * @param {import('./rank.mjs').RankedPage[]} ranked
65
+ */
66
+ export function bestPage(ranked) {
67
+ return ranked.find(r => r.family !== SHELL_FAMILY && r.score > 0);
68
+ }
69
+
70
+ /**
71
+ * The text score without its threshold, and whether the edit rule fires.
72
+ * Null without the table or a page to weigh.
73
+ * @param {string} idea
74
+ * @param {import('./rank.mjs').IdeaKind} kind
75
+ * @param {import('./rank.mjs').RankedPage[]} ranked
76
+ * @returns {{edit: boolean, score: number} | null}
77
+ */
78
+ export function shellCallScore(idea, kind, ranked) {
79
+ const weights = loadShellWeights();
80
+ if (!weights) return null;
81
+ const text = String(idea).toLowerCase();
82
+ const best = bestPage(ranked);
83
+ let score = 0;
84
+ for (const feature of featuresOf(text, kind, best))
85
+ score += weights.weights[feature] ?? 0;
86
+ return {edit: EDIT.test(text), score};
87
+ }
@@ -8,7 +8,8 @@
8
8
  import {loadWeights} from '../_adapter.mjs';
9
9
  import {asksForNewPage} from './kind.mjs';
10
10
  import {pickAlternatives, pickStart} from './rank.mjs';
11
- import {blendOrder, weighStart} from './weights.mjs';
11
+ import {hasEditPhrase, shellCallScore} from './shellcall.mjs';
12
+ import {blendOrder, blendSummary, weighStart} from './weights.mjs';
12
13
 
13
14
  /**
14
15
  * @typedef {import('../../search/search.type.mjs').SearchResultEntry} SearchResultEntry
@@ -57,6 +58,60 @@ function placement(kind, inPage) {
57
58
  return null;
58
59
  }
59
60
 
61
+ /**
62
+ * Fixed coefficients of a logistic decision over build's own numbers: bias,
63
+ * whole page, edit, blend margin over the shell, the shell's blend score, the
64
+ * gap to the blend's second template, the idea's comma count, the text score
65
+ * (shellcall.mjs) and its edit-word flag. Fixed constants; nothing is trained
66
+ * at run time. An edit phrase keeps the shell before the decision runs, so the
67
+ * two edit inputs are 0 whenever it runs; they stay because the constants were
68
+ * fit with them.
69
+ */
70
+ const LIFT = [
71
+ -0.7707, 0.6706, -0.2642, 0.2815, -0.1621, 0.1759, 0.1713, 0.2891, -0.3491,
72
+ ];
73
+
74
+ /** The decision replaces the shell with a page when p >= 0.30. */
75
+ const LIFT_AT = 0.3;
76
+
77
+ /**
78
+ * The page template that replaces an app-shell start, or null to keep the
79
+ * shell. The blend's best template takes the start when the decision's
80
+ * whole-page probability is at least 0.30.
81
+ * @param {import('./rank.mjs').RankedPage[]} ranked
82
+ * @param {import('./rank.mjs').IdeaKind} kind
83
+ * @param {PageTemplate[]} catalog
84
+ * @param {string} idea
85
+ * @returns {PageTemplate | null}
86
+ */
87
+ function liftFromShell(ranked, kind, catalog, idea) {
88
+ const b = blendSummary(
89
+ idea,
90
+ ranked,
91
+ pickStart(ranked, 'page'),
92
+ catalog,
93
+ loadWeights(),
94
+ );
95
+ if (!b || !b.best) return null;
96
+ // A change to a page or app the builder already has keeps its shell.
97
+ if (hasEditPhrase(idea)) return null;
98
+ const text = shellCallScore(idea, kind, ranked);
99
+ const x = [
100
+ 1,
101
+ kind === 'page' ? 1 : 0,
102
+ kind === 'edit' ? 1 : 0,
103
+ b.bestScore - b.shell,
104
+ b.shell,
105
+ b.bestScore - b.secondScore,
106
+ (String(idea).match(/,/g) ?? []).length,
107
+ text?.score ?? 0,
108
+ text?.edit ? 1 : 0,
109
+ ];
110
+ const logit = x.reduce((s, v, i) => s + v * LIFT[i], 0);
111
+ if (1 / (1 + Math.exp(-logit)) < LIFT_AT) return null;
112
+ return catalog.find(t => t.name === b.best) ?? null;
113
+ }
114
+
60
115
  /**
61
116
  * The template to start from: the ready page the ranker puts first when it
62
117
  * has the evidence to lead, else the first fallback shell the project can
@@ -113,10 +168,18 @@ export function chooseStart(ranked, kind, pages, directMatch, catalog, idea) {
113
168
  ? proposed
114
169
  : null
115
170
  : (ranked.find(r => r.name === weighed) ?? proposed);
116
- const closest = pick && catalog.find(t => t.name === pick.name);
117
- if (pick && closest) {
171
+ // An idea that would start on the app shell starts from the blend's best page
172
+ // when the decision's whole-page probability is at least 0.30. A direct match,
173
+ // ready or not, keeps the start and reason it already has.
174
+ const lifted =
175
+ !direct && (!pick || pick.family === 'Shell')
176
+ ? liftFromShell(ranked, kind, catalog, idea)
177
+ : null;
178
+ const closest = lifted ?? (pick && catalog.find(t => t.name === pick.name));
179
+ if (closest) {
118
180
  const agrees = closest.name === direct;
119
- const place = placement(kind, pick.base && pick.familyNamed);
181
+ const place =
182
+ lifted || !pick ? null : placement(kind, pick.base && pick.familyNamed);
120
183
  return {
121
184
  ...asTemplate(closest),
122
185
  basis: agrees ? 'direct' : 'closest',
@@ -40,6 +40,21 @@ export function weighStart(idea: string, ranked: import("./rank.mjs").RankedPage
40
40
  weights?: WeightsFile | null;
41
41
  newPage?: boolean;
42
42
  }): string | null | undefined;
43
+ /**
44
+ * The blend's scores: the app shell's, and the best non-shell template with
45
+ * its score and the runner-up's. Null without weights.
46
+ * @param {string} idea
47
+ * @param {import('./rank.mjs').RankedPage[]} ranked
48
+ * @param {import('./rank.mjs').RankedPage | null} pick
49
+ * @param {DescribedTemplate[]} catalog
50
+ * @param {WeightsFile | null} weights
51
+ */
52
+ export function blendSummary(idea: string, ranked: import("./rank.mjs").RankedPage[], pick: import("./rank.mjs").RankedPage | null, catalog: DescribedTemplate[], weights: WeightsFile | null): {
53
+ shell: number;
54
+ best: string;
55
+ bestScore: number;
56
+ secondScore: number;
57
+ } | null;
43
58
  /** The app shell, as one candidate. */
44
59
  export const SHELL: "SHELL";
45
60
  export type WeightTable = {
@@ -418,3 +418,30 @@ export function weighStart(
418
418
  if (newPage && kept) return kept;
419
419
  return null;
420
420
  }
421
+
422
+ /**
423
+ * The blend's scores: the app shell's, and the best non-shell template with
424
+ * its score and the runner-up's. Null without weights.
425
+ * @param {string} idea
426
+ * @param {import('./rank.mjs').RankedPage[]} ranked
427
+ * @param {import('./rank.mjs').RankedPage | null} pick
428
+ * @param {DescribedTemplate[]} catalog
429
+ * @param {WeightsFile | null} weights
430
+ */
431
+ export function blendSummary(idea, ranked, pick, catalog, weights) {
432
+ if (!weights) return null;
433
+ const {cands, scores} = blend(idea, ranked, pick, catalog, weights);
434
+ let shell = 0;
435
+ const rest = [];
436
+ for (let i = 0; i < cands.length; i++) {
437
+ if (cands[i] === SHELL) shell = scores[i];
438
+ else rest.push({name: cands[i], score: scores[i], i});
439
+ }
440
+ rest.sort((x, y) => y.score - x.score || x.i - y.i);
441
+ return {
442
+ shell,
443
+ best: rest[0]?.name ?? null,
444
+ bestScore: rest[0]?.score ?? 0,
445
+ secondScore: rest[1]?.score ?? 0,
446
+ };
447
+ }
@@ -277,7 +277,7 @@ useMenuDrillIn useMenuDrillIn DropdownMenu/DropdownMenu.doc.mjs DropdownMenu/use
277
277
  useMenuHover useMenuHover hooks/useAnimatedLayout.doc.mjs hooks/useMenuHover.ts
278
278
  useMenuOverflow useMenuOverflow DropdownMenu/DropdownMenu.doc.mjs DropdownMenu/useMenuOverflow.ts
279
279
  useMobileKeyboard ERR_UNKNOWN_COMPONENT - keyboard/useMobileKeyboard.ts
280
- useOutlineFromDOM useOutlineFromDOM Outline/Outline.doc.mjs Outline/useOutlineFromDOM.ts
280
+ useOutlineFromDOM useOutlineFromDOM Outline/useOutlineFromDOM.doc.mjs Outline/useOutlineFromDOM.ts
281
281
  useOverlay useOverlay Overlay/useOverlay.doc.mjs Overlay/useOverlay.tsx
282
282
  useOwnScrollGesture useOwnScrollGesture DateInput/DateInput.doc.mjs DateInput/useOwnScrollGesture.ts
283
283
  usePager usePager hooks/useAnimatedLayout.doc.mjs hooks/usePager.ts
@@ -88,6 +88,24 @@ export function doctorElementPropOrigins(file: string, element: Parameters<typeo
88
88
  * @returns {Set<string>}
89
89
  */
90
90
  export function doctorStylesheetImports(css: string): Set<string>;
91
+ /**
92
+ * The `@astryxdesign/core` range a package's peerDependencies declare, and
93
+ * whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
94
+ * doctor check uses to compare a package with the installed Core:
95
+ * `theme-core-peers` for added theme packages, `integration-core-range` for
96
+ * every other loaded integration.
97
+ * @param {{peerDependencies?: Record<string, unknown>} | null | undefined} pkg
98
+ * @param {string | null | undefined} coreVersion
99
+ * Any declared string is judged by `satisfiesRange`, so an empty range
100
+ * accepts every Core; only a missing range is `null`.
101
+ * @returns {{range: string | null, accepts: boolean}}
102
+ */
103
+ export function corePeerRange(pkg: {
104
+ peerDependencies?: Record<string, unknown>;
105
+ } | null | undefined, coreVersion: string | null | undefined): {
106
+ range: string | null;
107
+ accepts: boolean;
108
+ };
91
109
  /** @param {string} projectDir */
92
110
  export function findDoctorCoreDir(projectDir: string): string | null;
93
111
  /** @param {string} projectDir @param {string} packageName */
@@ -264,7 +282,6 @@ export function readBuiltPath(target: string, { fileLimit }?: {
264
282
  */
265
283
  export function builtIntegrationPackages(target: string, cwd: string): string[];
266
284
  export { placeholderFixes } from "../../foundation/discovery/template-icons.mjs";
267
- export { unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
268
285
  export { installCommandFor as packageInstallCommand } from "../../foundation/discovery/template-needs.mjs";
269
286
  export { resolveRecordedTheme } from "../theme/theme.mjs";
270
287
  export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
@@ -280,6 +297,8 @@ import { lastNoticeSkip } from '../../foundation/release/notices.mjs';
280
297
  import { lastCheckFailure } from '../../foundation/release/global-state.mjs';
281
298
  import { stateLockHolder } from '../../foundation/release/global-state.mjs';
282
299
  import { displayHomePath } from '../../foundation/agent-docs/computer-agent-text.mjs';
300
+ export { iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
283
301
  export { isLocalThemeOwner, planThemeAppWrite, readThemeState, resolveThemeModule } from "../../foundation/config/theme-state.mjs";
284
- export { missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
302
+ export { GENERATED_MARKER, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
303
+ export { APP_COPY_MARK, EDITOR_GENERATED_MARK } from "../theme-edit/_marks.mjs";
285
304
  export { AUTHORING_AUDIT, authoringAudit, authoringAuditData } from "./_authoring-audit.mjs";
@@ -41,9 +41,13 @@ import {computerAgentTextSettings} from '../../foundation/env/user-settings.mjs'
41
41
  import * as fs from 'node:fs';
42
42
  import {placeholderUses} from '../../foundation/discovery/template-icons.mjs';
43
43
  export {placeholderFixes} from '../../foundation/discovery/template-icons.mjs';
44
- export {unlistedIconSets} from '../../foundation/discovery/icon-set-discovery.mjs';
44
+ export {
45
+ iconUseCommand,
46
+ unlistedIconSets,
47
+ } from '../../foundation/discovery/icon-set-discovery.mjs';
45
48
  import {elementPropOrigins} from '../../foundation/discovery/module-exports.mjs';
46
49
  import {cssImports} from '../../foundation/render/embedded-imports.mjs';
50
+ import {satisfiesRange} from '../../foundation/env/semver.mjs';
47
51
  import * as path from 'node:path';
48
52
  import {
49
53
  persistedGather,
@@ -72,10 +76,13 @@ export {
72
76
  resolveThemeModule,
73
77
  } from '../../foundation/config/theme-state.mjs';
74
78
  export {
79
+ GENERATED_MARKER,
80
+ isPrivateVarRefusal,
75
81
  missingThemePackage,
76
82
  themeBuild,
77
83
  validateThemePrivateInputs,
78
84
  } from '../theme/build/build.mjs';
85
+ export {APP_COPY_MARK, EDITOR_GENERATED_MARK} from '../theme-edit/_marks.mjs';
79
86
  export {installCommandFor as packageInstallCommand} from '../../foundation/discovery/template-needs.mjs';
80
87
  export {resolveRecordedTheme} from '../theme/theme.mjs';
81
88
  export {collectUnloadedFonts} from '../theme/build/font-warning.mjs';
@@ -92,6 +99,14 @@ export {
92
99
  const CHECK_CODEC = {
93
100
  encode: (/** @type {any} */ check) => check,
94
101
  decode: (/** @type {any} */ check) => check,
102
+ /** A check record: its id, label, status and message. */
103
+ valid: (/** @type {any} */ check) =>
104
+ check != null &&
105
+ typeof check === 'object' &&
106
+ typeof check.id === 'string' &&
107
+ typeof check.label === 'string' &&
108
+ typeof check.status === 'string' &&
109
+ typeof check.message === 'string',
95
110
  };
96
111
 
97
112
  /**
@@ -291,6 +306,31 @@ export function doctorStylesheetImports(css) {
291
306
  return new Set(cssImports(css));
292
307
  }
293
308
 
309
+ /**
310
+ * The `@astryxdesign/core` range a package's peerDependencies declare, and
311
+ * whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
312
+ * doctor check uses to compare a package with the installed Core:
313
+ * `theme-core-peers` for added theme packages, `integration-core-range` for
314
+ * every other loaded integration.
315
+ * @param {{peerDependencies?: Record<string, unknown>} | null | undefined} pkg
316
+ * @param {string | null | undefined} coreVersion
317
+ * Any declared string is judged by `satisfiesRange`, so an empty range
318
+ * accepts every Core; only a missing range is `null`.
319
+ * @returns {{range: string | null, accepts: boolean}}
320
+ */
321
+ export function corePeerRange(pkg, coreVersion) {
322
+ const raw = pkg?.peerDependencies?.['@astryxdesign/core'];
323
+ const range = typeof raw === 'string' ? raw.trim() : null;
324
+ return {
325
+ range,
326
+ accepts:
327
+ range !== null &&
328
+ typeof coreVersion === 'string' &&
329
+ coreVersion !== '' &&
330
+ satisfiesRange(coreVersion, range),
331
+ };
332
+ }
333
+
294
334
  /** @param {string} projectDir */
295
335
  export function findDoctorCoreDir(projectDir) {
296
336
  return findProjectCoreDir(projectDir);
@@ -30,7 +30,7 @@ import {
30
30
  resolveBuiltPath,
31
31
  } from './_adapter.mjs';
32
32
  import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
33
- import {parse as parseModule} from '@babel/parser';
33
+ import {babelParse as parseModule} from '../../foundation/runtime/lazy-dependencies.mjs';
34
34
 
35
35
  /** Source files, read for imports and JSX. */
36
36
  const SOURCE_EXT = new Set(['.tsx', '.jsx', '.ts', '.js', '.mjs', '.cjs']);
@@ -86,6 +86,19 @@ export function checkPeerDeps(ctx: DoctorContext): DoctorCheck;
86
86
  * @returns {DoctorCheck}
87
87
  */
88
88
  export function checkIntegrationIssues(ctx: DoctorContext): DoctorCheck;
89
+ /**
90
+ * Every loaded integration's `@astryxdesign/core` peer range admits the
91
+ * installed Core: a package's declared peer ranges define the Core versions it
92
+ * supports (spec:AST-017 FR12). A package made for another Core installs with
93
+ * only a package manager warning, and its components, themes and docs may not
94
+ * work. New, so it warns: a project that passed before keeps passing.
95
+ * Packages of added themes are left to `theme-core-peers` (spec:AST-050 FR11),
96
+ * which applies the same rule. Null when Core is not installed or no other
97
+ * loaded integration declares a Core range.
98
+ * @param {DoctorContext} ctx
99
+ * @returns {DoctorCheck | null}
100
+ */
101
+ export function checkIntegrationCoreRange(ctx: DoctorContext): DoctorCheck | null;
89
102
  /**
90
103
  * The project's icon sets (AST-084 FR17). Fails when `experimental.iconSet`
91
104
  * names a set, main or backup, that is not installed, that is installed but
@@ -387,6 +400,11 @@ export type DoctorContext = {
387
400
  * false means the copy that started the run answered it (spec AST-081 FR2).
388
401
  */
389
402
  ownCli?: boolean | undefined;
403
+ /**
404
+ * - Packages of the project's added
405
+ * themes, which `theme-core-peers` checks against Core
406
+ */
407
+ addedThemePackages?: string[] | undefined;
390
408
  /**
391
409
  * - The Core release the project names
392
410
  * (installed, else locked, else declared), as the daily hint reads it.
@@ -464,6 +482,14 @@ export type DoctorContext = {
464
482
  status: "selected" | "none" | "ambiguous" | "missing" | "withdrawn";
465
483
  reason: string;
466
484
  configured?: string;
485
+ set?: {
486
+ name: string;
487
+ package: string;
488
+ data: {
489
+ variants?: string[];
490
+ };
491
+ };
492
+ variant?: string;
467
493
  backups?: Array<{
468
494
  selector: string;
469
495
  status: "selected" | "ambiguous" | "missing" | "withdrawn";
@@ -20,7 +20,7 @@ export const doc = {
20
20
  '@astryxdesign/core install and version alignment with the CLI, installed ' +
21
21
  'themes and wiring, astryx.config validity, whether every integration ' +
22
22
  'astryx.config names loads (a failed one fails the run), integrations linked from ' +
23
- 'package.json without a config entry, core peer dependencies, ' +
23
+ 'package.json without a config entry, core peer dependencies, whether the @astryxdesign/core peer range of each loaded integration includes the installed Core (`integration-core-range`, a warning; added theme packages are checked by `theme-core-peers` instead), ' +
24
24
  'integration provider identity and contribution issues, agent docs, the ' +
25
25
  'detected package manager, and the health of the docs the CLI reads (authoring ' +
26
26
  'and CLI docs, the docs tree, doc size), and returns a structured ' +