@astryxdesign/cli 0.7.14 → 0.7.15-canary.g061b2fa

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 (164) hide show
  1. package/README.md +63 -63
  2. package/api/build/_adapter.d.mts +4 -0
  3. package/api/build/_adapter.mjs +28 -2
  4. package/api/build/blocks/blocks.d.mts +10 -1
  5. package/api/build/blocks/blocks.mjs +84 -7
  6. package/api/build/build.mjs +6 -1
  7. package/api/build/tree.d.mts +4 -0
  8. package/api/build/tree.mjs +9 -2
  9. package/api/doctor/_adapter.d.mts +3 -1
  10. package/api/doctor/_adapter.mjs +14 -1
  11. package/api/doctor/_authoring-audit.d.mts +42 -0
  12. package/api/doctor/_authoring-audit.mjs +106 -0
  13. package/api/doctor/doctor.d.mts +7 -0
  14. package/api/doctor/doctor.mjs +24 -39
  15. package/api/doctor/theme-checks.mjs +56 -21
  16. package/api/integration/validate-integration.mjs +17 -3
  17. package/api/integration/validateIntegration.doc.mjs +1 -1
  18. package/api/search/_adapter.mjs +124 -3
  19. package/api/search/_candidate-score.mjs +63 -9
  20. package/api/search/_entries.d.mts +10 -0
  21. package/api/search/_entries.mjs +68 -1
  22. package/api/search/_gather-templates.d.mts +11 -0
  23. package/api/search/_gather-templates.mjs +22 -2
  24. package/api/search/_words.mjs +26 -6
  25. package/api/swizzle/copy/copy.mjs +1 -1
  26. package/api/theme/_adapter.d.mts +17 -1
  27. package/api/theme/_adapter.mjs +185 -40
  28. package/api/theme/build/build.d.mts +29 -1
  29. package/api/theme/build/build.mjs +426 -65
  30. package/api/theme/eject/eject.mjs +10 -6
  31. package/api/theme/targets/targets.d.mts +8 -0
  32. package/api/theme/targets/targets.mjs +24 -4
  33. package/api/theme/template/template.mjs +48 -2
  34. package/api/theme/theme.type.d.mts +8 -0
  35. package/api/theme/theme.type.mjs +5 -1
  36. package/api/theme/themeBuild.doc.mjs +7 -4
  37. package/api/theme/themeEject.doc.mjs +3 -3
  38. package/api/theme/themeRemove.doc.mjs +5 -2
  39. package/api/theme/themeTargets.doc.mjs +1 -1
  40. package/api/theme/themeTemplate.doc.mjs +2 -2
  41. package/api/theme/themeUse.doc.mjs +8 -2
  42. package/api/theme-edit/_adapter.d.mts +46 -3
  43. package/api/theme-edit/_adapter.mjs +372 -109
  44. package/api/theme-edit/_check.d.mts +6 -3
  45. package/api/theme-edit/_check.mjs +665 -87
  46. package/api/theme-edit/_color.mjs +4 -2
  47. package/api/theme-edit/_compiler.d.mts +2 -1
  48. package/api/theme-edit/_compiler.mjs +27 -13
  49. package/api/theme-edit/_context.d.mts +2 -1
  50. package/api/theme-edit/_context.mjs +47 -8
  51. package/api/theme-edit/_edit.d.mts +9 -3
  52. package/api/theme-edit/_edit.mjs +484 -66
  53. package/api/theme-edit/_how-commands.d.mts +33 -7
  54. package/api/theme-edit/_how-commands.mjs +57 -45
  55. package/api/theme-edit/_how-question.d.mts +4 -0
  56. package/api/theme-edit/_how-question.mjs +1004 -223
  57. package/api/theme-edit/_how.mjs +96 -9
  58. package/api/theme-edit/_palette.d.mts +38 -13
  59. package/api/theme-edit/_palette.mjs +620 -223
  60. package/api/theme-edit/_parts.mjs +63 -7
  61. package/api/theme-edit/_png.d.mts +4 -4
  62. package/api/theme-edit/_png.mjs +4 -2
  63. package/api/theme-edit/_preview-app.d.mts +6 -0
  64. package/api/theme-edit/_preview-app.mjs +1194 -207
  65. package/api/theme-edit/_preview.mjs +2 -2
  66. package/api/theme-edit/_project.d.mts +12 -1
  67. package/api/theme-edit/_project.mjs +37 -6
  68. package/api/theme-edit/_settings.d.mts +104 -33
  69. package/api/theme-edit/_settings.mjs +818 -118
  70. package/api/theme-edit/_tables.d.mts +7 -0
  71. package/api/theme-edit/_tables.mjs +61 -0
  72. package/api/theme-edit/theme-edit.type.d.mts +11 -1
  73. package/api/theme-edit/theme-edit.type.mjs +4 -3
  74. package/api/theme-edit/themeEditHow.doc.mjs +6 -0
  75. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
  76. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  77. package/api/theme-edit/themeEditPreviewList.doc.mjs +1 -1
  78. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +5 -1
  79. package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
  80. package/api/upgrade/_adapter.d.mts +1 -0
  81. package/assets/codemods/run-codemod.mjs +61 -0
  82. package/assets/codemods/runner.mjs +5 -4
  83. package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +3 -0
  84. package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +5 -1
  85. package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +3 -0
  86. package/assets/codemods/transforms/v0.7.0/migrate-deprecated-theme-surface.mjs +4 -0
  87. package/assets/codemods/transforms/v0.7.0/rename-empty-search-results-text.mjs +17 -12
  88. package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +3 -0
  89. package/assets/codemods/transforms/v0.7.5/migrate-codeblock-tokenizer-to-language.mjs +3 -0
  90. package/assets/codemods/transforms/v0.7.8/promote-tokenizer-presentation.mjs +3 -0
  91. package/assets/docs/tree/calendars.doc.mjs +1 -3
  92. package/assets/docs/tree/checks.doc.mjs +22 -1
  93. package/assets/docs.generated.json +2 -1
  94. package/assets/self-audit.generated.json +1 -0
  95. package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.doc.mjs +14 -0
  96. package/assets/templates/blocks/components/Theme/useThemeNameHookUsage.tsx +31 -0
  97. package/assets/templates/components.generated.json +1 -1
  98. package/authoring/integration/integration.doc.mjs +8 -0
  99. package/authoring/integration/schema.d.mts +8 -0
  100. package/authoring/integration/schema.mjs +1 -0
  101. package/authoring/integration/type.ts +9 -0
  102. package/clients/cli/bin/astryx.mjs +19 -15
  103. package/clients/cli/build-id.generated.json +1 -0
  104. package/clients/cli/commands/ensure-core-built.mjs +12 -5
  105. package/clients/cli/commands/experimental/theme.mjs +178 -78
  106. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  107. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -1
  108. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -2
  109. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
  110. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  111. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  112. package/clients/cli/commands/experimental-theme-eject.doc.mjs +3 -3
  113. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  114. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  115. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +1 -1
  116. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +1 -1
  117. package/clients/cli/commands/experimental-theme-remove.doc.mjs +1 -1
  118. package/clients/cli/commands/experimental-theme-template.doc.mjs +4 -3
  119. package/clients/cli/commands/manifest.mjs +5 -2
  120. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  121. package/clients/cli/commands/theme-list.doc.mjs +1 -1
  122. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  123. package/clients/cli/commands/theme.mjs +374 -42
  124. package/clients/cli/index.mjs +9 -3
  125. package/clients/cli/lib/manifest.mjs +37 -0
  126. package/clients/cli/lib/resolve-theme.mjs +2 -1
  127. package/clients/cli/manifest.generated.json +1 -0
  128. package/foundation/config/theme-state.d.mts +16 -0
  129. package/foundation/config/theme-state.mjs +84 -13
  130. package/foundation/discovery/module-exports.mjs +16 -2
  131. package/foundation/discovery/stored-self-audit.d.mts +31 -0
  132. package/foundation/discovery/stored-self-audit.mjs +119 -0
  133. package/foundation/discovery/template-adapter.d.mts +48 -2
  134. package/foundation/discovery/template-adapter.mjs +51 -19
  135. package/foundation/discovery/template-needs.d.mts +19 -0
  136. package/foundation/discovery/template-needs.mjs +50 -16
  137. package/foundation/discovery/template-source-tree.d.mts +7 -0
  138. package/foundation/discovery/template-source-tree.mjs +15 -0
  139. package/foundation/discovery/theme-discovery.d.mts +2 -1
  140. package/foundation/discovery/theme-discovery.mjs +2 -8
  141. package/foundation/discovery/theme-module-extensions.d.mts +18 -0
  142. package/foundation/discovery/theme-module-extensions.mjs +30 -0
  143. package/foundation/doc-compiler/import.mjs +22 -15
  144. package/foundation/doc-compiler/stored-docs.d.mts +18 -12
  145. package/foundation/doc-compiler/stored-docs.mjs +52 -19
  146. package/foundation/env/private-dir.d.mts +17 -0
  147. package/foundation/env/private-dir.mjs +42 -0
  148. package/foundation/fs/gather-cache.d.mts +108 -0
  149. package/foundation/fs/gather-cache.mjs +741 -0
  150. package/foundation/fs/jiti-cache.d.mts +21 -0
  151. package/foundation/fs/jiti-cache.mjs +66 -0
  152. package/foundation/fs/module-loader.mjs +14 -3
  153. package/foundation/fs/read-record.d.mts +31 -1
  154. package/foundation/fs/read-record.mjs +100 -7
  155. package/foundation/integrations/integrations.d.mts +8 -0
  156. package/foundation/integrations/integrations.mjs +4 -0
  157. package/foundation/integrations/validate-contributions.d.mts +62 -1
  158. package/foundation/integrations/validate-contributions.mjs +476 -40
  159. package/foundation/release/cache.d.mts +11 -2
  160. package/foundation/release/cache.mjs +59 -10
  161. package/foundation/release/folder-lock.d.mts +21 -0
  162. package/foundation/release/folder-lock.mjs +171 -0
  163. package/foundation/response/response-types.doc.mjs +1 -1
  164. package/package.json +8 -6
@@ -31,6 +31,8 @@ import {
31
31
  resolveRecordedTheme,
32
32
  resolveThemeModule,
33
33
  SOURCE_EXTENSIONS,
34
+ missingThemePackage,
35
+ packageInstallCommand,
34
36
  themeBuild,
35
37
  themeRecordOwner,
36
38
  validateThemePrivateInputs,
@@ -1083,6 +1085,8 @@ export async function checkAppThemes(cwd) {
1083
1085
  });
1084
1086
  } else {
1085
1087
  const stale = [];
1088
+ /** @type {Map<string, string[]>} theme slugs by the package they import and the app lacks */
1089
+ const missingPackages = new Map();
1086
1090
  const previousSilent = logger.silent;
1087
1091
  logger.setSilent(true);
1088
1092
  try {
@@ -1106,38 +1110,69 @@ export async function checkAppThemes(cwd) {
1106
1110
  ) {
1107
1111
  stale.push(theme.slug);
1108
1112
  }
1109
- } catch {
1110
- stale.push(theme.slug);
1113
+ } catch (error) {
1114
+ const missing = missingThemePackage(error);
1115
+ if (missing) {
1116
+ missingPackages.set(missing, [
1117
+ ...(missingPackages.get(missing) ?? []),
1118
+ theme.slug,
1119
+ ]);
1120
+ } else {
1121
+ stale.push(theme.slug);
1122
+ }
1111
1123
  }
1112
1124
  }
1113
1125
  } finally {
1114
1126
  logger.setSilent(previousSilent);
1115
1127
  }
1128
+ const packages = [...missingPackages.keys()];
1129
+ const install =
1130
+ packages.length > 0
1131
+ ? packageInstallCommand(packages, state.projectDir)
1132
+ : null;
1133
+ const refresh = stale.map(slug =>
1134
+ refreshThemeCommand(
1135
+ state.projectDir,
1136
+ run,
1137
+ available,
1138
+ slug,
1139
+ state.themes[slug],
1140
+ ),
1141
+ );
1116
1142
  checks.push(
1117
- stale.length > 0
1143
+ packages.length > 0
1118
1144
  ? {
1119
1145
  id: 'theme-local-builds',
1120
1146
  label: 'Local theme build freshness',
1121
1147
  status: 'fail',
1122
- message: `Local theme outputs are missing or stale: ${stale.join(', ')}.`,
1123
- fix: stale
1124
- .map(slug =>
1125
- refreshThemeCommand(
1126
- state.projectDir,
1127
- run,
1128
- available,
1129
- slug,
1130
- state.themes[slug],
1131
- ),
1132
- )
1133
- .join(' '),
1148
+ message: `Local themes import packages the app does not have installed, so they cannot build: ${[
1149
+ ...missingPackages,
1150
+ ]
1151
+ .map(([pkg, slugs]) => `${pkg} (${slugs.join(', ')})`)
1152
+ .join(
1153
+ '; ',
1154
+ )}.${stale.length > 0 ? ` Local theme outputs are also missing or stale: ${stale.join(', ')}.` : ''}`,
1155
+ fix: [
1156
+ install?.installCommand ??
1157
+ install?.noCommandReason ??
1158
+ `Install ${packages.join(', ')}.`,
1159
+ ...refresh,
1160
+ ].join(' '),
1134
1161
  }
1135
- : {
1136
- id: 'theme-local-builds',
1137
- label: 'Local theme build freshness',
1138
- status: 'pass',
1139
- message: 'Every added local theme output matches its source.',
1140
- },
1162
+ : stale.length > 0
1163
+ ? {
1164
+ id: 'theme-local-builds',
1165
+ label: 'Local theme build freshness',
1166
+ status: 'fail',
1167
+ message: `Local theme outputs are missing or stale: ${stale.join(', ')}.`,
1168
+ fix: refresh.join(' '),
1169
+ }
1170
+ : {
1171
+ id: 'theme-local-builds',
1172
+ label: 'Local theme build freshness',
1173
+ status: 'pass',
1174
+ message: 'Every added local theme output matches its source.',
1175
+ },
1141
1176
  );
1142
1177
  }
1143
1178
 
@@ -74,6 +74,7 @@ import {
74
74
  import {
75
75
  blockComponentsCheck,
76
76
  componentExamplesCheck,
77
+ packageListingCheck,
77
78
  componentDocNamesCheck,
78
79
  INVALID_CLI_COMMAND,
79
80
  isListedIssue,
@@ -448,6 +449,7 @@ async function validateAtPackageDir(
448
449
  ? resolveRoot(manifest.experimental?.iconSets, 'experimental.iconSets')
449
450
  : undefined,
450
451
  issuesUrl: manifest.issuesUrl,
452
+ logo: manifest.logo,
451
453
  agentDocs: manifest.agentDocs,
452
454
  cliCommand: manifest.cliCommand,
453
455
  __cliCommandError: cliCommandError,
@@ -889,6 +891,11 @@ export async function validateIntegration(pkg, options = {}) {
889
891
  const examples = integration
890
892
  ? await componentExamplesCheck(integration)
891
893
  : undefined;
894
+ // What a catalog needs to list the package: a logo, and an example of
895
+ // its components.
896
+ const listing = integration
897
+ ? packageListingCheck(integration, examples?.examples)
898
+ : undefined;
892
899
  const docNames = names?.[0].report;
893
900
  const blockComponents = names?.[1].report;
894
901
  // Notes fail nothing: a malformed `cliCommand`, and the findings added
@@ -913,6 +920,9 @@ export async function validateIntegration(pkg, options = {}) {
913
920
  each.notes.map(note => ({...note, next: true})),
914
921
  ),
915
922
  ...(examples?.notes ?? []).map(note => ({...note, next: true})),
923
+ // What a catalog needs to list the package is information only:
924
+ // these notes fail no check, under any flag.
925
+ ...(listing?.notes ?? []),
916
926
  ]
917
927
  : [];
918
928
  // The doc-syntax findings in the package's topics, as `next` notes with
@@ -926,6 +936,10 @@ export async function validateIntegration(pkg, options = {}) {
926
936
  })),
927
937
  );
928
938
  }
939
+ const assetsUnchecked = [
940
+ ...(examples?.unchecked ?? []),
941
+ ...(listing?.unchecked ?? []),
942
+ ];
929
943
  return {
930
944
  type: 'integration.validate',
931
945
  data: {
@@ -955,13 +969,13 @@ export async function validateIntegration(pkg, options = {}) {
955
969
  ...(result.found && result.olderCliNotes
956
970
  ? {olderCliNotes: result.olderCliNotes}
957
971
  : {}),
958
- // Template assets npm could not place, when there are any.
959
- ...(examples && examples.unchecked.length > 0
972
+ // Template assets and logos npm could not place, when there are any.
973
+ ...(assetsUnchecked.length > 0
960
974
  ? {
961
975
  exampleAssets: {
962
976
  status: 'checked',
963
977
  findings: [],
964
- unchecked: examples.unchecked,
978
+ unchecked: assetsUnchecked,
965
979
  },
966
980
  }
967
981
  : {}),
@@ -62,7 +62,7 @@ export const doc = {
62
62
  {
63
63
  type: 'integration.validate',
64
64
  description:
65
- "The result envelope: `data.validated`, false when nothing was validated — with no `package.json` at all, `data.issues` carries one `no_package` error-severity issue so the command exits 1; with a `package.json` but no integration manifest, `data.issues` is empty, which means \"not looked at\", not \"healthy\"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message, fix?, file?, line?}: `fix` is the change that resolves the issue, and `file` and `line` where it is, relative to the package, when the check knows them; and `data.notes` when there are any: {code, message, next?} information beside the issues; a note fails nothing by default, and one with `next: true` counts as a warning under `integration check --next`, fails `integration check --strict --next`, and fails `--strict` from the next minor release. Notes include `invalid_cli_command` for a `cliCommand` that was ignored as malformed and `cli_peer_version` when the running CLI is outside the `@astryxdesign/cli` peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message: `duplicate_component_doc`, `symlinked_root`, `unreadable_file`, `invalid_package_json` (no `name` or `version`), `no_provider_id`, and `source_without_component_doc` for a doc whose file name differs from its source only in letter case where the two still pair; and `doc_name_mismatch` and `unknown_block_component` (see `docNames` and `blockComponents`); they become warnings in the next minor release. For the commands a topic writes, `runner_command` (written with a package runner), `plain_command` (written bare), `package_manager_command` (written for one package manager) and `doc_token` (a token that does not parse) notes each give the file, line and the token to write. A `doc_target_not_found` note names a doc whose `replaces` or `extends` names no topic and no guide of the CLI's docs or the package's own (such as a namespace, with the guides below it), so it changes nothing unless an app also installs a package that provides it, and a `doc_section_unplaced` note a section whose `before` or `after` names no section of the topic or guide it extends, so it is added at the end, and a `duplicate_guide_replacement` note two docs of the package that replace one guide, of which only the last is read; they become warnings in the next minor release. When the manifest loads, `data.docTypes` holds the doc type check: `status` (`checked` | `skipped`), `reason` when skipped, `typescript`, `docs` (doc values checked), `findings` ({doc, line, export, type, field, problem: `unknown_field` | `missing_field` | `wrong_type`, severity: `warning`, message, fix}), `unchecked` ({doc, reason}: a doc that could not be fully checked, or a root its reader cannot read), and `fixtures` when the components or docs root holds test fixture docs under `__tests__`: how many, none of them checked. When the manifest loads, `data.docNames` lists the component doc names it could not judge: `status` (`checked`), `findings` (always empty; a doc name the module its import names provably does not export is a `doc_name_mismatch` note, with its fix in the message) and `unchecked` ({file, name, reason}: a doc whose `name` differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, `data.blockComponents` lists the component names templates give in `exampleFor` or `componentsUsed` that could not be judged: `status` (`checked`), `findings` (always empty; a name neither the package nor Core has, and the template does not import, is an `unknown_block_component` note, with its fix in the message) and `unchecked` ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is a note in `data.notes`, its fix inside the message, listed only: it does not fail this command or `integration check --strict`, and fails `--strict` from the next minor release. The codes are `component_import_not_exported`, `component_import_other_package`, `component_import_missing_name`, `example_import_not_exported`, `example_import_missing_name`, `template_import_not_exported`, `template_import_outside_root`, `template_private_import`, `template_import_missing_name` and `template_no_default_export`. Since 0.7.4 the examples a package ships are checked the same way: `component_without_example` (a published component no block template shows with `exampleFor` and `isShowcase: true`, or names in `alsoShowcaseFor`), `template_category` (a template category written as a path, such as `components/X`), `showcase_not_standalone` (a showcase that imports server-only code or reads `process.env` past `NODE_ENV`) and `template_asset_not_packed` (a `new URL(…, import.meta.url)` asset that is missing, or that `npm pack --dry-run` leaves out of the package). When npm cannot list the package's files, an asset no `files` entry can reach is still a note, and any other is listed in `data.exampleAssets` (`{status: 'checked', findings: [], unchecked}`, present only when it lists any) as {file, asset, reason}; `integration check` counts them as not compared. When the manifest loads, `data.publicImports` is `{status: 'checked', findings: [], unchecked}`: `unchecked` lists each import the check could not judge, as {file, specifier, reason}, the reason starting `example <label>:` for an import in a component example: an `exports` target not built yet; a module whose export list cannot be read in full (CommonJS, or a declaration file it cannot read); a root import in a package with no `exports` (the root module `main` names is not read); every name an import (other than a component doc's own component) names that its module does not export, while a TypeScript file in the package has a `declare module` block for a relative path or the package's own name or a subpath of it, which can add names to that module (a `declare module` in a comment, `declare global`, a wildcard such as `'*.css'`, and another package's name do not count; a file whose text has `declare module` but that cannot be parsed counts); the same for every such name when the package has more than 5,000 files to search for that block; a deep path into build output not built yet in a package with no `exports`; a template import of Core when `@astryxdesign/core` is not installed beside the package (a `packages/core` of the workspace under another name does not count); every import of the package's own name when package.json has no `name` or a `name` that is not a bare package name; one entry for the whole check when package.json cannot be read; and an import of a subpath whose `exports` entry has only a `types` target, unless it is `import type`, every binding is an inline `type`, or every name it imports is a type its types file declares: a value import of a name that file does not declare as a type, a namespace or side-effect import, or any import when the types file cannot be read (it may be build output). `integration check` counts the unchecked as not compared; they never fail it. `data.olderCliNotes` ({file, kind: `template` | `namespace`, field, message}), for the local package, lists each descriptor field a release before 0.7.4 refuses while the package's CLI peer range admits one, such as `stability` on a template or namespace doc; it is present only when it has entries, is never counted, and never fails a check.",
65
+ "The result envelope: `data.validated`, false when nothing was validated — with no `package.json` at all, `data.issues` carries one `no_package` error-severity issue so the command exits 1; with a `package.json` but no integration manifest, `data.issues` is empty, which means \"not looked at\", not \"healthy\"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message, fix?, file?, line?}: `fix` is the change that resolves the issue, and `file` and `line` where it is, relative to the package, when the check knows them; and `data.notes` when there are any: {code, message, next?} information beside the issues; a note fails nothing by default, and one with `next: true` counts as a warning under `integration check --next`, fails `integration check --strict --next`, and fails `--strict` from the next minor release. Notes include `invalid_cli_command` for a `cliCommand` that was ignored as malformed and `cli_peer_version` when the running CLI is outside the `@astryxdesign/cli` peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message: `duplicate_component_doc`, `symlinked_root`, `unreadable_file`, `invalid_package_json` (no `name` or `version`), `no_provider_id`, and `source_without_component_doc` for a doc whose file name differs from its source only in letter case where the two still pair; and `doc_name_mismatch` and `unknown_block_component` (see `docNames` and `blockComponents`); they become warnings in the next minor release. For the commands a topic writes, `runner_command` (written with a package runner), `plain_command` (written bare), `package_manager_command` (written for one package manager) and `doc_token` (a token that does not parse) notes each give the file, line and the token to write. A `doc_target_not_found` note names a doc whose `replaces` or `extends` names no topic and no guide of the CLI's docs or the package's own (such as a namespace, with the guides below it), so it changes nothing unless an app also installs a package that provides it, and a `doc_section_unplaced` note a section whose `before` or `after` names no section of the topic or guide it extends, so it is added at the end, and a `duplicate_guide_replacement` note two docs of the package that replace one guide, of which only the last is read; they become warnings in the next minor release. When the manifest loads, `data.docTypes` holds the doc type check: `status` (`checked` | `skipped`), `reason` when skipped, `typescript`, `docs` (doc values checked), `findings` ({doc, line, export, type, field, problem: `unknown_field` | `missing_field` | `wrong_type`, severity: `warning`, message, fix}), `unchecked` ({doc, reason}: a doc that could not be fully checked, or a root its reader cannot read), and `fixtures` when the components or docs root holds test fixture docs under `__tests__`: how many, none of them checked. When the manifest loads, `data.docNames` lists the component doc names it could not judge: `status` (`checked`), `findings` (always empty; a doc name the module its import names provably does not export is a `doc_name_mismatch` note, with its fix in the message) and `unchecked` ({file, name, reason}: a doc whose `name` differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, `data.blockComponents` lists the component names templates give in `exampleFor` or `componentsUsed` that could not be judged: `status` (`checked`), `findings` (always empty; a name neither the package nor Core has, and the template does not import, is an `unknown_block_component` note, with its fix in the message) and `unchecked` ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is a note in `data.notes`, its fix inside the message, listed only: it does not fail this command or `integration check --strict`, and fails `--strict` from the next minor release. The codes are `component_import_not_exported`, `component_import_other_package`, `component_import_missing_name`, `example_import_not_exported`, `example_import_missing_name`, `template_import_not_exported`, `template_import_outside_root`, `template_private_import`, `template_import_missing_name` and `template_no_default_export`. Since 0.7.4 the examples a package ships are checked the same way: `component_without_example` (a published component no block template shows with `exampleFor` and `isShowcase: true`, or names in `alsoShowcaseFor`), `template_category` (a template category written as a path, such as `components/X`), `showcase_not_standalone` (a showcase that imports server-only code or reads `process.env` past `NODE_ENV`) and `template_asset_not_packed` (a `new URL(…, import.meta.url)` asset that is missing, or that `npm pack --dry-run` leaves out of the package). When npm cannot list the package's files, an asset no `files` entry can reach is still a note, and any other is listed in `data.exampleAssets` (`{status: 'checked', findings: [], unchecked}`, present only when it lists any) as {file, asset, reason}; `integration check` counts them as not compared. Since 0.7.15 two notes, without `next`, say what a catalog needs to list the package, each with its fix in the message; they fail no check under any flag: `package_without_logo` (the integration file's `logo.light`, or a `logo.dark` that is set, names no file in the package that is a PNG, JPEG, WebP or shapes-only SVG of at most 512 KB and that npm packs; when the integration file has no `logo`, package.json `marketplace.logo` is read the same way) and `package_without_example` (the package contributes components, other than the ones `component_without_example` exempts, but no block template sets `isShowcase: true` with `exampleFor`, or `alsoShowcaseFor`; a package of themes, docs or codemods alone needs none). A logo npm cannot be asked about is listed in `data.exampleAssets` with `file` set to the file that names it. When the manifest loads, `data.publicImports` is `{status: 'checked', findings: [], unchecked}`: `unchecked` lists each import the check could not judge, as {file, specifier, reason}, the reason starting `example <label>:` for an import in a component example: an `exports` target not built yet; a module whose export list cannot be read in full (CommonJS, or a declaration file it cannot read); a root import in a package with no `exports` (the root module `main` names is not read); every name an import (other than a component doc's own component) names that its module does not export, while a TypeScript file in the package has a `declare module` block for a relative path or the package's own name or a subpath of it, which can add names to that module (a `declare module` in a comment, `declare global`, a wildcard such as `'*.css'`, and another package's name do not count; a file whose text has `declare module` but that cannot be parsed counts); the same for every such name when the package has more than 5,000 files to search for that block; a deep path into build output not built yet in a package with no `exports`; a template import of Core when `@astryxdesign/core` is not installed beside the package (a `packages/core` of the workspace under another name does not count); every import of the package's own name when package.json has no `name` or a `name` that is not a bare package name; one entry for the whole check when package.json cannot be read; and an import of a subpath whose `exports` entry has only a `types` target, unless it is `import type`, every binding is an inline `type`, or every name it imports is a type its types file declares: a value import of a name that file does not declare as a type, a namespace or side-effect import, or any import when the types file cannot be read (it may be build output). `integration check` counts the unchecked as not compared; they never fail it. `data.olderCliNotes` ({file, kind: `template` | `namespace`, field, message}), for the local package, lists each descriptor field a release before 0.7.4 refuses while the package's CLI peer range admits one, such as `stability` on a template or namespace doc; it is present only when it has entries, is never counted, and never fails a check.",
66
66
  },
67
67
  ],
68
68
  examples: [
@@ -6,10 +6,11 @@
6
6
  * domain, _gather-*.mjs) and loads the tree's static data before it runs.
7
7
  */
8
8
 
9
- import {readFileSync} from 'node:fs';
9
+ import {readFileSync, realpathSync} from 'node:fs';
10
10
  import * as path from 'node:path';
11
11
  import {requireCoreDir} from '../../foundation/fs/paths.mjs';
12
12
  import {withListingCache} from '../../foundation/fs/listing-cache.mjs';
13
+ import {persistedGather} from '../../foundation/fs/gather-cache.mjs';
13
14
  import {
14
15
  reusedWhileUnchanged,
15
16
  unchangedSince,
@@ -21,7 +22,12 @@ import {CORELESS_DOMAINS} from './_query.mjs';
21
22
  import {gatherComponents} from './_gather-components.mjs';
22
23
  import {gatherHooks} from './_gather-hooks.mjs';
23
24
  import {gatherDocs} from './_gather-docs.mjs';
24
- import {gatherTemplates, gatherThemes} from './_gather-templates.mjs';
25
+ import {
26
+ derivedFromSource,
27
+ gatherTemplates,
28
+ gatherThemes,
29
+ } from './_gather-templates.mjs';
30
+ import {componentsInSource} from '../../foundation/discovery/template-adapter.mjs';
25
31
 
26
32
  export {componentKeywords} from './_gather-components.mjs';
27
33
 
@@ -124,6 +130,112 @@ async function gatherDomains(options) {
124
130
  };
125
131
  }
126
132
 
133
+ /**
134
+ * The folder's real path, so a link and its target share a kept gather.
135
+ * @param {string} dir
136
+ * @returns {string}
137
+ */
138
+ function realFolder(dir) {
139
+ try {
140
+ return realpathSync(dir);
141
+ } catch {
142
+ return dir;
143
+ }
144
+ }
145
+
146
+ /**
147
+ * A gathered catalog as plain JSON and back, for a gather kept between runs
148
+ * (persistedGather). A template's derived component names are read once and
149
+ * stored as their value; `components` is stored by position in `all`, whose
150
+ * objects it shares.
151
+ */
152
+ const GATHER_CODEC = {
153
+ /**
154
+ * @param {any} gathered
155
+ * @returns {any}
156
+ */
157
+ encode(gathered) {
158
+ const position = new Map(
159
+ gathered.all.map((/** @type {any} */ c, /** @type {number} */ i) => [
160
+ c,
161
+ i,
162
+ ]),
163
+ );
164
+ return {
165
+ ...gathered,
166
+ all: gathered.all.map((/** @type {any} */ c) => {
167
+ if (!Object.getOwnPropertyDescriptor(c, 'weakKeywords')?.get) return c;
168
+ // The names come from the source file, read again when first asked
169
+ // for (its content is one of the stored inputs); a source that could
170
+ // not be read derives none.
171
+ const from = derivedFromSource.get(c);
172
+ const names = from?.derivedSoFar();
173
+ /** @type {Record<string, unknown>} */
174
+ const out = {};
175
+ for (const k of Object.keys(c)) {
176
+ out[k] =
177
+ k === 'weakKeywords'
178
+ ? {[DERIVED]: names ?? from?.file ?? null}
179
+ : c[k];
180
+ }
181
+ return out;
182
+ }),
183
+ components: gathered.components.map((/** @type {any} */ c) =>
184
+ position.get(c),
185
+ ),
186
+ };
187
+ },
188
+ /**
189
+ * @param {any} stored
190
+ * @returns {any}
191
+ */
192
+ decode(stored) {
193
+ const all = stored.all.map((/** @type {any} */ c) => {
194
+ const stored = c.weakKeywords?.[DERIVED];
195
+ if (stored === undefined) return c;
196
+ // Names read by the run that stored them, or the file to read them from.
197
+ const file = typeof stored === 'string' ? stored : null;
198
+ /** @type {string[] | undefined} */
199
+ let derived = Array.isArray(stored) ? stored : undefined;
200
+ const derive = () => {
201
+ if (derived === undefined) {
202
+ try {
203
+ derived =
204
+ file == null
205
+ ? []
206
+ : componentsInSource(readFileSync(file, 'utf-8'));
207
+ } catch {
208
+ derived = [];
209
+ }
210
+ }
211
+ return derived;
212
+ };
213
+ /** @type {Record<string, unknown>} */
214
+ const out = {};
215
+ for (const k of Object.keys(c)) {
216
+ if (k === 'weakKeywords') {
217
+ Object.defineProperty(out, k, {
218
+ get: derive,
219
+ enumerable: true,
220
+ configurable: true,
221
+ });
222
+ } else {
223
+ out[k] = c[k];
224
+ }
225
+ }
226
+ return out;
227
+ });
228
+ return {
229
+ ...stored,
230
+ all,
231
+ components: stored.components.map((/** @type {number} */ i) => all[i]),
232
+ };
233
+ },
234
+ };
235
+
236
+ /** The key a stored template's derived component names sit under. */
237
+ const DERIVED = '\0derived';
238
+
127
239
  /**
128
240
  * @typedef {Awaited<ReturnType<typeof gatherCandidates>>} Gathered
129
241
  * @type {Map<string, (options?: {fresh?: boolean}) => Promise<Gathered>>}
@@ -150,7 +262,16 @@ export function gatherCandidatesReused(options) {
150
262
  let gather = gathered.get(key);
151
263
  if (!gather) {
152
264
  gather = reusedWhileUnchanged(
153
- () => gatherCandidates({cwd, type}),
265
+ () =>
266
+ persistedGather(
267
+ [realFolder(cwd), type ?? null],
268
+ () => gatherCandidates({cwd, type}),
269
+ GATHER_CODEC,
270
+ // A gather that skipped Core (a failed install still in its
271
+ // backoff, spec:AST-081 FR2) is not kept: once the backoff ends,
272
+ // the next run must try again.
273
+ value => value.coreSkipped == null,
274
+ ),
154
275
  unchangedSince,
155
276
  );
156
277
  gathered.set(key, gather);
@@ -94,6 +94,65 @@ function headOfLetters(t, name) {
94
94
  /** How many of a family's members a query naming the family lists. */
95
95
  const FAMILY_MEMBERS = 3;
96
96
 
97
+ /**
98
+ * The pattern that finds any form of a term as a whole word in prose, with
99
+ * any common suffix, built once per term: a search tests it against every
100
+ * candidate's description.
101
+ * @type {Map<string, RegExp>}
102
+ */
103
+ const mentionPatterns = new Map();
104
+
105
+ /**
106
+ * How many terms' patterns are kept before the cache starts over. A compiled
107
+ * pattern is several kilobytes and a long-running caller sees ever new
108
+ * terms, so this cache stays small; one search uses a handful of terms.
109
+ */
110
+ const MENTION_LIMIT = 1_000;
111
+
112
+ /**
113
+ * @param {string} term
114
+ * @param {ReturnType<typeof termWords>} t - the term's words
115
+ * @returns {RegExp}
116
+ */
117
+ function mentionPattern(term, t) {
118
+ let re = mentionPatterns.get(term);
119
+ if (!re) {
120
+ if (mentionPatterns.size >= MENTION_LIMIT) mentionPatterns.clear();
121
+ // Any form of the term, with any common suffix: `spacing` finds
122
+ // "space" and "spaces", `tables` finds "table".
123
+ const roots = [...new Set([stem(term), ...t.forms])]
124
+ .filter(f => f.length >= 3)
125
+ .map(f => f.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
126
+ re = new RegExp(`\\b(?:${roots.join('|')})(s|es|ing|ed|ies)?\\b`);
127
+ mentionPatterns.set(term, re);
128
+ }
129
+ return re;
130
+ }
131
+
132
+ /**
133
+ * Each prose text lowercased once per process: a search reads every
134
+ * candidate's description for every term.
135
+ * @type {Map<string, string>}
136
+ */
137
+ const lowered = new Map();
138
+
139
+ /** How many texts are kept lowercased before the cache starts over. */
140
+ const CACHE_LIMIT = 100_000;
141
+
142
+ /**
143
+ * @param {string} text
144
+ * @returns {string}
145
+ */
146
+ function lower(text) {
147
+ let out = lowered.get(text);
148
+ if (out === undefined) {
149
+ if (lowered.size >= CACHE_LIMIT) lowered.clear();
150
+ out = text.toLowerCase();
151
+ lowered.set(text, out);
152
+ }
153
+ return out;
154
+ }
155
+
97
156
  /**
98
157
  * A derived name's score for a term: 60 for the same word, 40 for a word the
99
158
  * term starts, else 0.
@@ -308,18 +367,13 @@ export function scoreCandidate(
308
367
  // Match the term's stem as a whole word, tolerating plural/gerund suffixes
309
368
  // so "chart" matches "charts" and "filter" matches "filtering".
310
369
  if (term.length >= 3) {
311
- // Any form of the term, with any common suffix: `spacing` finds
312
- // "space" and "spaces", `tables` finds "table".
313
- const roots = [...new Set([stem(term), ...t.forms])]
314
- .filter(f => f.length >= 3)
315
- .map(f => f.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
316
- const re = new RegExp(`\\b(?:${roots.join('|')})(s|es|ing|ed|ies)?\\b`);
317
- if (description && re.test(description.toLowerCase())) {
370
+ const re = mentionPattern(term, t);
371
+ if (description && re.test(lower(description))) {
318
372
  consider(50, `description mentions "${term}"`);
319
373
  } else {
320
374
  let matchedProse = false;
321
375
  for (const blob of prose) {
322
- if (blob && re.test(String(blob).toLowerCase())) {
376
+ if (blob && re.test(lower(String(blob)))) {
323
377
  consider(50, `docs mention "${term}"`);
324
378
  matchedProse = true;
325
379
  break;
@@ -330,7 +384,7 @@ export function scoreCandidate(
330
384
  // summary. Only consulted when nothing stronger matched.
331
385
  if (!matchedProse) {
332
386
  for (const blob of guidance) {
333
- if (blob && re.test(String(blob).toLowerCase())) {
387
+ if (blob && re.test(lower(String(blob)))) {
334
388
  consider(45, `guidance mentions "${term}"`);
335
389
  break;
336
390
  }
@@ -13,6 +13,16 @@ export function entryTable(all: any[], cards: Record<string, {
13
13
  synonyms?: string[];
14
14
  props?: string[];
15
15
  }>): EntryTable;
16
+ /**
17
+ * A table's plain-JSON form and back. Candidates are kept as their place in
18
+ * `all`, maps as their entries in order, so the table reads back the same.
19
+ * @param {any[]} all
20
+ * @returns {{encode: (table: EntryTable) => any, decode: (stored: any) => EntryTable}}
21
+ */
22
+ export function tableCodec(all: any[]): {
23
+ encode: (table: EntryTable) => any;
24
+ decode: (stored: any) => EntryTable;
25
+ };
16
26
  /**
17
27
  * @param {any[]} all
18
28
  * @param {Record<string, {what?: string, synonyms?: string[], props?: string[]}>} cards
@@ -8,6 +8,16 @@
8
8
 
9
9
  import {createHash} from 'node:crypto';
10
10
  import {DOMAINS, words, fold, nameWords} from './_query-words.mjs';
11
+ import {fileURLToPath} from 'node:url';
12
+ import {persistedDerived} from '../../foundation/fs/gather-cache.mjs';
13
+
14
+ /** This module and the word rules it builds entries with, by path. */
15
+ const ENTRIES_FILE = fileURLToPath(import.meta.url);
16
+ const QUERY_WORDS_FILE = fileURLToPath(
17
+ new URL('./_query-words.mjs', import.meta.url),
18
+ );
19
+ /** The cards search reads (./_adapter.mjs), by path. */
20
+ const CARDS_FILE = fileURLToPath(new URL('./_cards.json', import.meta.url));
11
21
 
12
22
  /** @param {string[]} list @returns {Map<string, number>} */
13
23
  const counts = list => {
@@ -65,7 +75,16 @@ export function entryTable(all, cards) {
65
75
  tables.set(all, last.table);
66
76
  return last.table;
67
77
  }
68
- const built = buildTable(all, cards);
78
+ // The table is a function of the text it is built from: kept beside the
79
+ // catalog, a later run with the same catalog reads it back.
80
+ const built = persistedDerived(
81
+ ['entry-table', key],
82
+ () => buildTable(all, cards),
83
+ tableCodec(all),
84
+ // The code that builds it, loaded or not when the table is kept, and the
85
+ // cards it reads, which search reads after the catalog is kept.
86
+ [ENTRIES_FILE, QUERY_WORDS_FILE, CARDS_FILE],
87
+ );
69
88
  last = {key, table: built};
70
89
  tables.set(all, built);
71
90
  return built;
@@ -73,6 +92,54 @@ export function entryTable(all, cards) {
73
92
 
74
93
  /** @type {{key: string, table: EntryTable} | null} */
75
94
  let last = null;
95
+
96
+ /**
97
+ * A table's plain-JSON form and back. Candidates are kept as their place in
98
+ * `all`, maps as their entries in order, so the table reads back the same.
99
+ * @param {any[]} all
100
+ * @returns {{encode: (table: EntryTable) => any, decode: (stored: any) => EntryTable}}
101
+ */
102
+ export function tableCodec(all) {
103
+ return {
104
+ encode(table) {
105
+ const place = new Map(all.map((c, k) => [c, k]));
106
+ const t = /** @type {any} */ (table);
107
+ return {
108
+ ids: t.ids,
109
+ candidate: t.candidate.map((/** @type {any} */ c) => place.get(c)),
110
+ domain: t.domain,
111
+ name: t.name,
112
+ fields: Object.fromEntries(
113
+ Object.entries(t.fields).map(([f, {post, idf, len, avg}]) => [
114
+ f,
115
+ {post: [...post], idf: [...idf], len, avg},
116
+ ]),
117
+ ),
118
+ };
119
+ },
120
+ decode(stored) {
121
+ return /** @type {EntryTable} */ (
122
+ /** @type {unknown} */ ({
123
+ ids: stored.ids,
124
+ index: new Map(
125
+ stored.ids.map(
126
+ (/** @type {string} */ id, /** @type {number} */ k) => [id, k],
127
+ ),
128
+ ),
129
+ candidate: stored.candidate.map((/** @type {number} */ k) => all[k]),
130
+ domain: stored.domain,
131
+ name: stored.name,
132
+ fields: Object.fromEntries(
133
+ Object.entries(stored.fields).map(([f, {post, idf, len, avg}]) => [
134
+ f,
135
+ {post: new Map(post), idf: new Map(idf), len, avg},
136
+ ]),
137
+ ),
138
+ })
139
+ );
140
+ },
141
+ };
142
+ }
76
143
  /** @type {WeakMap<object, number>} */
77
144
  const cardIds = new WeakMap();
78
145
  let nextCardId = 0;
@@ -21,4 +21,15 @@ export function gatherTemplates(cwd: string): Promise<Candidate[]>;
21
21
  * @returns {Promise<Candidate[]>}
22
22
  */
23
23
  export function gatherThemes(cwd: string): Promise<Candidate[]>;
24
+ /**
25
+ * The source file each template candidate's `weakKeywords` are read from,
26
+ * when it could be read, and the names if this run already read them: a
27
+ * gather kept between runs stores the names it has and the file for the rest
28
+ * (api/search/_adapter.mjs), so storing costs no parse.
29
+ * @type {WeakMap<object, {file: string, derivedSoFar: () => string[] | undefined}>}
30
+ */
31
+ export const derivedFromSource: WeakMap<object, {
32
+ file: string;
33
+ derivedSoFar: () => string[] | undefined;
34
+ }>;
24
35
  export type Candidate = import("./_lexical.mjs").Candidate;
@@ -15,6 +15,14 @@ import {
15
15
  } from '../../foundation/discovery/template-adapter.mjs';
16
16
  import {sameWord, wordsOf} from './_words.mjs';
17
17
 
18
+ /**
19
+ * The source file each template candidate's `weakKeywords` are read from,
20
+ * when it could be read, and the names if this run already read them: a
21
+ * gather kept between runs stores the names it has and the file for the rest
22
+ * (api/search/_adapter.mjs), so storing costs no parse.
23
+ * @type {WeakMap<object, {file: string, derivedSoFar: () => string[] | undefined}>}
24
+ */
25
+ export const derivedFromSource = new WeakMap();
18
26
  /** @typedef {import('./_lexical.mjs').Candidate} Candidate */
19
27
 
20
28
  /**
@@ -75,14 +83,20 @@ export async function gatherTemplates(cwd) {
75
83
  let derive = () => [];
76
84
  /** @type {string[] | null} */
77
85
  let weakKeywordBound = null;
86
+ /** @type {string | null} */
87
+ let readSource = null;
88
+ /** @type {(() => string[] | undefined) | undefined} */
89
+ let derivedNow;
78
90
  if (t.type === 'page') {
79
91
  if (t.filePath) {
80
92
  try {
81
93
  const source = fs.readFileSync(t.filePath, 'utf-8');
94
+ readSource = t.filePath;
82
95
  // Parsing the source costs more than the rest of the page's gather.
83
96
  // It waits until a term could match a name the source can yield.
84
97
  /** @type {string[] | undefined} */
85
98
  let derived;
99
+ derivedNow = () => derived;
86
100
  derive = () => {
87
101
  if (derived === undefined) {
88
102
  try {
@@ -101,8 +115,8 @@ export async function gatherTemplates(cwd) {
101
115
  if (t.category)
102
116
  keywords.push(...t.category.split(/[^A-Za-z0-9]+/).filter(Boolean));
103
117
  }
104
- return {
105
- domain: 'template',
118
+ const candidate = {
119
+ domain: /** @type {const} */ ('template'),
106
120
  name: commandName,
107
121
  keywords,
108
122
  get weakKeywords() {
@@ -123,6 +137,12 @@ export async function gatherTemplates(cwd) {
123
137
  _resultName: t.dirName,
124
138
  _commandName: commandName,
125
139
  };
140
+ if (readSource)
141
+ derivedFromSource.set(candidate, {
142
+ file: readSource,
143
+ derivedSoFar: () => derivedNow?.(),
144
+ });
145
+ return candidate;
126
146
  });
127
147
  }
128
148