@astryxdesign/cli 0.7.3-canary.b74cf21 → 0.7.3-canary.be42333

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 (229) hide show
  1. package/README.md +68 -68
  2. package/api/build/blocks/blocks.d.mts +6 -4
  3. package/api/build/blocks/blocks.mjs +103 -20
  4. package/api/build/blocks/blocks.test.mjs +126 -13
  5. package/api/build/blocks/blocks.weights.json +1 -1
  6. package/api/build/kit/answer.d.mts +5 -4
  7. package/api/build/kit/answer.mjs +114 -12
  8. package/api/build/kit/answer.test.mjs +73 -3
  9. package/api/build/kit/signals.d.mts +8 -0
  10. package/api/build/kit/signals.mjs +10 -0
  11. package/api/build/tree.test.mjs +19 -11
  12. package/api/component/component-replacement.test.mjs +1 -0
  13. package/api/component/component.mjs +17 -3
  14. package/api/component/component.test.mjs +15 -0
  15. package/api/component/doc-links.test.mjs +2 -2
  16. package/api/discover/_adapter.d.mts +1 -2
  17. package/api/discover/_adapter.mjs +6 -8
  18. package/api/discover/discover.mjs +0 -1
  19. package/api/docs/_adapter.d.mts +2 -2
  20. package/api/docs/_adapter.mjs +61 -18
  21. package/api/docs/docs-homes.test.mjs +127 -0
  22. package/api/docs/docs.doc.mjs +3 -3
  23. package/api/docs/docs.test.mjs +28 -18
  24. package/api/docs/integration-tree.test.mjs +20 -20
  25. package/api/docs/integrationDocs.test.mjs +1 -1
  26. package/api/docs/namespace-section.test.mjs +6 -6
  27. package/api/docs/reference-blocks.test.mjs +2 -2
  28. package/api/doctor/_adapter.d.mts +24 -10
  29. package/api/doctor/_adapter.mjs +28 -25
  30. package/api/doctor/doctor.d.mts +7 -4
  31. package/api/doctor/doctor.mjs +68 -26
  32. package/api/doctor/doctor.test.mjs +95 -12
  33. package/api/hook/hook.mjs +1 -1
  34. package/api/integration/_adapter.d.mts +8 -0
  35. package/api/integration/_adapter.mjs +21 -1
  36. package/api/integration/authoring-checks.test.mjs +220 -0
  37. package/api/integration/pack-check.mjs +110 -4
  38. package/api/integration/pack-check.test.mjs +69 -0
  39. package/api/integration/validate-integration-fixes.test.mjs +6 -5
  40. package/api/integration/validate-integration-gaps.test.mjs +304 -1
  41. package/api/integration/validate-integration.d.mts +6 -1
  42. package/api/integration/validate-integration.mjs +82 -13
  43. package/api/integration/validate-integration.type.d.mts +37 -4
  44. package/api/integration/validate-integration.type.mjs +28 -5
  45. package/api/integration/validateIntegration.doc.mjs +1 -1
  46. package/api/search/_adapter.d.mts +16 -0
  47. package/api/search/_adapter.mjs +39 -0
  48. package/api/search/_adapter.test.mjs +173 -0
  49. package/api/search/_candidate-score.mjs +1 -1
  50. package/api/search/_entries.d.mts +11 -0
  51. package/api/search/_entries.mjs +77 -3
  52. package/api/search/_entries.test.mjs +48 -0
  53. package/api/search/_gather-docs.mjs +3 -3
  54. package/api/search/search.doc.mjs +1 -1
  55. package/api/search/search.mjs +6 -2
  56. package/api/search/search.test.mjs +14 -14
  57. package/api/upgrade/_adapter.d.mts +57 -3
  58. package/api/upgrade/_adapter.mjs +149 -27
  59. package/api/upgrade/registry/registry.d.mts +10 -4
  60. package/api/upgrade/registry/registry.mjs +33 -16
  61. package/api/upgrade/registry/registry.test.mjs +85 -0
  62. package/api/upgrade/run/run.d.mts +4 -2
  63. package/api/upgrade/run/run.mjs +13 -2
  64. package/api/upgrade/run/run.test.mjs +417 -3
  65. package/api/upgrade/upgrade.doc.mjs +10 -5
  66. package/api/upgrade/upgrade.mjs +13 -2
  67. package/api/upgrade/upgrade.type.d.mts +5 -3
  68. package/api/upgrade/upgrade.type.mjs +8 -6
  69. package/assets/docs/author-a-theme.doc.mjs +2 -2
  70. package/assets/docs/is-my-code-good.doc.mjs +287 -0
  71. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  72. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  73. package/assets/docs/tree/add-a-topic.doc.mjs +2 -2
  74. package/assets/docs/tree/agent-guidance.doc.mjs +1 -1
  75. package/assets/docs/tree/{integrations.doc.mjs → authoring.doc.mjs} +15 -6
  76. package/assets/docs/tree/block-template.doc.mjs +1 -1
  77. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  78. package/assets/docs/tree/building-blocks.doc.mjs +2 -2
  79. package/assets/docs/tree/check-the-props.doc.mjs +1 -1
  80. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  81. package/assets/docs/tree/checks.doc.mjs +3 -3
  82. package/assets/docs/tree/cli-command.doc.mjs +1 -1
  83. package/assets/docs/tree/cli.doc.mjs +1 -1
  84. package/assets/docs/tree/codemods.doc.mjs +1 -1
  85. package/assets/docs/tree/component-family.doc.mjs +1 -1
  86. package/assets/docs/tree/component-imports.doc.mjs +1 -1
  87. package/assets/docs/tree/components.doc.mjs +1 -1
  88. package/assets/docs/tree/configuration.doc.mjs +1 -1
  89. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  90. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  91. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  92. package/assets/docs/tree/docs.doc.mjs +1 -1
  93. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  94. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  95. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  96. package/assets/docs/tree/extend-or-replace.doc.mjs +1 -1
  97. package/assets/docs/{authoring.doc.mjs → tree/field-reference.doc.mjs} +4 -3
  98. package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
  99. package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
  100. package/assets/docs/tree/global-integrations.doc.mjs +2 -2
  101. package/assets/docs/tree/grade-template-with-agent.doc.mjs +4 -4
  102. package/assets/docs/tree/help.doc.mjs +2 -2
  103. package/assets/docs/tree/links.doc.mjs +1 -1
  104. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  105. package/assets/docs/tree/page-template.doc.mjs +1 -1
  106. package/assets/docs/tree/publishing.doc.mjs +1 -1
  107. package/assets/docs/tree/quick-start.doc.mjs +1 -1
  108. package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
  109. package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
  110. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  111. package/assets/docs/tree/see-it-in-an-app.doc.mjs +1 -1
  112. package/assets/docs/tree/ship.doc.mjs +2 -2
  113. package/assets/docs/tree/short-and-findable.doc.mjs +1 -1
  114. package/assets/docs/tree/single-component.doc.mjs +1 -1
  115. package/assets/docs/tree/start-a-template.doc.mjs +1 -1
  116. package/assets/docs/tree/subcomponent.doc.mjs +1 -1
  117. package/assets/docs/tree/template-assets.doc.mjs +1 -1
  118. package/assets/docs/tree/template-doc-overview.doc.mjs +2 -2
  119. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  120. package/assets/docs/tree/template-grading-rubric.doc.mjs +17 -38
  121. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  122. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  123. package/assets/docs/tree/template-styles.doc.mjs +1 -1
  124. package/assets/docs/tree/templates.doc.mjs +1 -1
  125. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  126. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  127. package/assets/docs/tree/themes.doc.mjs +1 -1
  128. package/assets/docs/tree/troubleshooting.doc.mjs +1 -1
  129. package/assets/docs/tree/upgrading.doc.mjs +1 -1
  130. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
  131. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  132. package/assets/docs/tree/versioning.doc.mjs +5 -1
  133. package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
  134. package/assets/docs/tree/write-the-template-file.doc.mjs +1 -1
  135. package/assets/docs/use-integrations.doc.mjs +120 -0
  136. package/assets/templates/themes/butter/butterTheme.ts +4 -2
  137. package/assets/templates/themes/stone/stoneTheme.ts +4 -2
  138. package/assets/templates/themes/y2k/y2kTheme.ts +4 -2
  139. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  140. package/authoring/integration/integration.doc.mjs +1 -1
  141. package/authoring/integration/type.ts +1 -1
  142. package/clients/cli/command-result-coverage.test.mjs +6 -5
  143. package/clients/cli/commands/build-theme.color-scheme.test.mjs +1 -1
  144. package/clients/cli/commands/{component/index.mjs → component.mjs} +37 -37
  145. package/clients/cli/commands/component.test.mjs +6 -6
  146. package/clients/cli/commands/docs.doc.mjs +2 -2
  147. package/clients/cli/commands/docs.mjs +1 -1
  148. package/clients/cli/commands/docs.test.mjs +14 -14
  149. package/clients/cli/commands/doctor-integration.test.mjs +49 -1
  150. package/clients/cli/commands/doctor.mjs +10 -0
  151. package/clients/cli/commands/{hook/index.mjs → hook.mjs} +22 -22
  152. package/clients/cli/commands/import-hint-correctness.test.mjs +1 -1
  153. package/clients/cli/commands/integration-check.test.mjs +48 -0
  154. package/clients/cli/commands/integration.doc.mjs +1 -1
  155. package/clients/cli/commands/manifest.doc.mjs +1 -1
  156. package/clients/cli/commands/manifest.mjs +67 -0
  157. package/clients/cli/commands/postinstall.doc.mjs +23 -0
  158. package/clients/cli/commands/postinstall.mjs +31 -0
  159. package/clients/cli/commands/setup-nudge.test.mjs +17 -0
  160. package/clients/cli/commands/{build-theme.mjs → theme.mjs} +1 -1
  161. package/clients/cli/commands/upgrade.doc.mjs +4 -2
  162. package/clients/cli/commands/upgrade.mjs +9 -2
  163. package/clients/cli/commands/upgrade.subfolder-path.test.mjs +97 -0
  164. package/clients/cli/index.mjs +35 -93
  165. package/clients/cli/lib/component-format.mjs +1 -1
  166. package/clients/cli/lib/define-command.mjs +12 -7
  167. package/clients/cli/lib/exit-codes.test.mjs +5 -0
  168. package/clients/cli/lib/manifest.test.mjs +12 -0
  169. package/clients/cli/lib/welcome-box.mjs +50 -0
  170. package/foundation/agent-docs/agent-doc-state.d.mts +12 -0
  171. package/foundation/agent-docs/agent-doc-state.mjs +24 -2
  172. package/foundation/agent-docs/agent-docs.mjs +7 -6
  173. package/foundation/agent-docs/agent-docs.test.mjs +5 -4
  174. package/foundation/agent-docs/computer-agent-text.mjs +16 -1
  175. package/foundation/agent-docs/computer-agent-text.test.mjs +23 -2
  176. package/foundation/config/project.mjs +5 -20
  177. package/foundation/config/project.test.mjs +56 -0
  178. package/foundation/discovery/authoring-self-docs.d.mts +7 -0
  179. package/foundation/discovery/authoring-self-docs.mjs +16 -4
  180. package/foundation/discovery/authoring-self-docs.test.mjs +15 -3
  181. package/foundation/discovery/authoring-surface.d.mts +1 -1
  182. package/foundation/discovery/authoring-surface.mjs +2 -2
  183. package/foundation/discovery/authoring-surface.test.mjs +1 -1
  184. package/foundation/discovery/cli-self-docs.d.mts +2 -1
  185. package/foundation/discovery/cli-self-docs.mjs +4 -3
  186. package/foundation/discovery/cli-self-docs.test.mjs +2 -2
  187. package/foundation/discovery/runner-allowlist.d.mts +2 -4
  188. package/foundation/discovery/runner-allowlist.mjs +2 -4
  189. package/foundation/discovery/runner-commands.d.mts +77 -0
  190. package/foundation/discovery/runner-commands.mjs +294 -0
  191. package/foundation/discovery/runner-commands.test.mjs +128 -0
  192. package/foundation/discovery/stray-pointers.test.mjs +1 -1
  193. package/foundation/discovery/template-adapter.mjs +18 -1
  194. package/foundation/discovery/template-needs.mjs +1 -44
  195. package/foundation/discovery/theme-discovery.mjs +147 -3
  196. package/foundation/doc-compiler/doc-loads.test.mjs +25 -9
  197. package/foundation/doc-compiler/read.mjs +59 -1
  198. package/foundation/doc-compiler/read.test.mjs +11 -2
  199. package/foundation/doc-compiler/split-topic-keywords.test.mjs +3 -2
  200. package/foundation/doc-compiler/tree.d.mts +32 -6
  201. package/foundation/doc-compiler/tree.mjs +77 -43
  202. package/foundation/doc-compiler/tree.test.mjs +7 -7
  203. package/foundation/fs/paths.d.mts +70 -8
  204. package/foundation/fs/paths.mjs +526 -35
  205. package/foundation/fs/paths.test.mjs +430 -54
  206. package/foundation/fs/read-record.d.mts +18 -0
  207. package/foundation/fs/read-record.mjs +131 -0
  208. package/foundation/fs/read-record.test.mjs +77 -0
  209. package/foundation/integrations/autolink.d.mts +2 -1
  210. package/foundation/integrations/autolink.mjs +4 -13
  211. package/foundation/integrations/cli-peer-version.d.mts +36 -0
  212. package/foundation/integrations/cli-peer-version.mjs +132 -0
  213. package/foundation/integrations/cli-peer-version.test.mjs +354 -0
  214. package/foundation/integrations/exports-subpaths.d.mts +57 -0
  215. package/foundation/integrations/exports-subpaths.mjs +113 -0
  216. package/foundation/integrations/integrations.d.mts +20 -1
  217. package/foundation/integrations/integrations.mjs +59 -2
  218. package/foundation/integrations/public-imports.d.mts +118 -0
  219. package/foundation/integrations/public-imports.mjs +1769 -0
  220. package/foundation/integrations/public-imports.test.mjs +1793 -0
  221. package/foundation/integrations/validate-contributions.d.mts +19 -0
  222. package/foundation/integrations/validate-contributions.mjs +172 -3
  223. package/foundation/release/global-state.d.mts +8 -4
  224. package/foundation/release/global-state.mjs +4 -2
  225. package/foundation/release/notices.d.mts +62 -8
  226. package/foundation/release/notices.mjs +136 -25
  227. package/foundation/release/notices.test.mjs +21 -0
  228. package/foundation/response/response-types.doc.mjs +1 -1
  229. package/package.json +9 -9
@@ -108,13 +108,14 @@ export function outsideProject(cwd: string): boolean;
108
108
  /**
109
109
  * The commands that bring a project's own CLI and Core to one release, with
110
110
  * the project's package manager: Core up to the CLI, then its codemods, when
111
- * the CLI is newer; else the CLI to the Core's release.
111
+ * the CLI is newer; else the CLI to the Core's release. Null when no
112
+ * command fits (see `alignCliAndCore`).
112
113
  * @param {string} cwd
113
114
  * @param {string} cli
114
115
  * @param {string} core
115
- * @returns {string}
116
+ * @returns {string | null}
116
117
  */
117
- export function alignCommand(cwd: string, cli: string, core: string): string;
118
+ export function alignCommand(cwd: string, cli: string, core: string): string | null;
118
119
  /**
119
120
  * The Core release the project at `cwd` names: installed, else locked, else
120
121
  * declared; the version the daily hint and notice compare against (spec
@@ -131,19 +132,32 @@ export function projectCoreVersion(cwd: string): string | null;
131
132
  export function projectHasOwnCli(cwd: string): boolean;
132
133
  /**
133
134
  * The command that adds the CLI at `version` with the project's package
134
- * manager.
135
+ * manager, and the Core it matches: from a folder whose package.json declares
136
+ * no Astryx package, in the Astryx project above at that project's Core; null
137
+ * when there is none (see `cliInstallAdvice`).
135
138
  * @param {string} cwd
136
139
  * @param {string} version
137
- * @returns {string}
140
+ * @returns {{command: string, core: string} | null}
138
141
  */
139
- export function addCliCommandFor(cwd: string, version: string): string;
142
+ export function addCliCommandFor(cwd: string, version: string): {
143
+ command: string;
144
+ core: string;
145
+ } | null;
140
146
  /**
141
- * The command that adds a package with the folder's package manager, read
142
- * from its lockfiles and `packageManager` field.
147
+ * The command that adds a package to the project of `cwd`; null in a folder
148
+ * that belongs to no project or whose package.json is not the project's (see
149
+ * `projectAddCommand`).
143
150
  * @param {string} cwd
144
- * @returns {(name: string) => string}
151
+ * @returns {((name: string) => string) | null}
152
+ */
153
+ export function installCommandFor(cwd: string): ((name: string) => string) | null;
154
+ /**
155
+ * Whether `cwd` is inside a project whose package.json is not the project's,
156
+ * so advice points at the project's folder (see `installFolder`).
157
+ * @param {string} cwd
158
+ * @returns {boolean}
145
159
  */
146
- export function installCommandFor(cwd: string): (name: string) => string;
160
+ export function insideProjectElsewhere(cwd: string): boolean;
147
161
  export { resolveRecordedTheme } from "../theme/theme.mjs";
148
162
  export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
149
163
  export const SOURCE_EXTENSIONS: Set<string>;
@@ -10,20 +10,17 @@ import {
10
10
  stateLockHolder,
11
11
  } from '../../foundation/release/global-state.mjs';
12
12
  import {
13
- addCliCommand,
14
13
  alignCliAndCore,
14
+ cliInstallAdvice,
15
+ installFolder,
16
+ projectAddCommand,
15
17
  globalBehind,
16
18
  globalUpgradeCommand,
17
19
  lastNoticeSkip,
18
20
  projectLag,
19
21
  } from '../../foundation/release/notices.mjs';
20
- import {
21
- coreVersionOf,
22
- isGlobalCopy,
23
- projectRootOf,
24
- } from '../../foundation/release/choose.mjs';
22
+ import {coreVersionOf, isGlobalCopy} from '../../foundation/release/choose.mjs';
25
23
  import {readReleaseFacts} from '../../foundation/release/project.mjs';
26
- import {detectPackageManager} from '../../foundation/env/package-manager.mjs';
27
24
  import {astryxCommandsOnSearchPath} from '../../foundation/env/search-path.mjs';
28
25
  import {readDeclaredDependencies} from '../../foundation/integrations/autolink.mjs';
29
26
  import {
@@ -348,11 +345,12 @@ export function outsideProject(/** @type {string} */ cwd) {
348
345
  /**
349
346
  * The commands that bring a project's own CLI and Core to one release, with
350
347
  * the project's package manager: Core up to the CLI, then its codemods, when
351
- * the CLI is newer; else the CLI to the Core's release.
348
+ * the CLI is newer; else the CLI to the Core's release. Null when no
349
+ * command fits (see `alignCliAndCore`).
352
350
  * @param {string} cwd
353
351
  * @param {string} cli
354
352
  * @param {string} core
355
- * @returns {string}
353
+ * @returns {string | null}
356
354
  */
357
355
  export function alignCommand(cwd, cli, core) {
358
356
  return alignCliAndCore({cwd, cli, core});
@@ -380,30 +378,35 @@ export function projectHasOwnCli(cwd) {
380
378
 
381
379
  /**
382
380
  * The command that adds the CLI at `version` with the project's package
383
- * manager.
381
+ * manager, and the Core it matches: from a folder whose package.json declares
382
+ * no Astryx package, in the Astryx project above at that project's Core; null
383
+ * when there is none (see `cliInstallAdvice`).
384
384
  * @param {string} cwd
385
385
  * @param {string} version
386
- * @returns {string}
386
+ * @returns {{command: string, core: string} | null}
387
387
  */
388
388
  export function addCliCommandFor(cwd, version) {
389
- return addCliCommand(projectRootOf(readReleaseFacts(cwd)) ?? cwd, version);
389
+ const advice = cliInstallAdvice({cwd, core: version});
390
+ return advice?.command ? {command: advice.command, core: advice.core} : null;
390
391
  }
391
392
 
392
393
  /**
393
- * The command that adds a package with the folder's package manager, read
394
- * from its lockfiles and `packageManager` field.
394
+ * The command that adds a package to the project of `cwd`; null in a folder
395
+ * that belongs to no project or whose package.json is not the project's (see
396
+ * `projectAddCommand`).
395
397
  * @param {string} cwd
396
- * @returns {(name: string) => string}
398
+ * @returns {((name: string) => string) | null}
397
399
  */
398
400
  export function installCommandFor(cwd) {
399
- const pm = detectPackageManager(cwd);
400
- const verb =
401
- pm === 'pnpm'
402
- ? 'pnpm add'
403
- : pm === 'yarn'
404
- ? 'yarn add'
405
- : pm === 'bun'
406
- ? 'bun add'
407
- : 'npm install';
408
- return name => `${verb} ${name}`;
401
+ return projectAddCommand(cwd);
402
+ }
403
+
404
+ /**
405
+ * Whether `cwd` is inside a project whose package.json is not the project's,
406
+ * so advice points at the project's folder (see `installFolder`).
407
+ * @param {string} cwd
408
+ * @returns {boolean}
409
+ */
410
+ export function insideProjectElsewhere(cwd) {
411
+ return installFolder(cwd)?.moved === true;
409
412
  }
@@ -259,15 +259,18 @@ export function checkComputerIntegrations(ctx: ComputerContext): DoctorCheck;
259
259
  * Inside a project, the integrations installed for the computer that the
260
260
  * project does not install: available, never used (spec AST-081 FR12).
261
261
  * Always info.
262
- * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: (name: string) => string}} input
262
+ * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: ((name: string) => string) | null, elsewhere?: boolean}} input
263
263
  * `install`: the command that adds a package with the project's package
264
- * manager (read by the adapter)
264
+ * manager (read by the adapter); null when the folder belongs to no
265
+ * project, or `elsewhere`: its package.json is not the project's, where the
266
+ * fix points at the project's folder
265
267
  * @returns {DoctorCheck}
266
268
  */
267
- export function checkComputerIntegrationsAvailable({ installed, candidates, install }: {
269
+ export function checkComputerIntegrationsAvailable({ installed, candidates, install, elsewhere }: {
268
270
  installed: Set<string>;
269
271
  candidates: import("../../foundation/integrations/computer-integrations.mjs").ComputerIntegrationCandidate[];
270
- install: (name: string) => string;
272
+ install: ((name: string) => string) | null;
273
+ elsewhere?: boolean;
271
274
  }): DoctorCheck;
272
275
  /**
273
276
  * Run all diagnostic checks and return a structured report.
@@ -65,8 +65,8 @@ import {typedEdges} from '../docs/node/node.mjs';
65
65
  import {detailView, indexView} from '../../foundation/doc-compiler/lenses.mjs';
66
66
  import {semverCompare, isValidSemver, satisfiesRange} from '../../foundation/env/semver.mjs';
67
67
  import {checkAppThemes, checkThemes} from './theme-checks.mjs';
68
- import {availableLine, upgradeLine} from '../../foundation/release/notices.mjs';
69
- import {alignCommand, addCliCommandFor, computerAgentTextState, installCommandFor, projectCoreVersion, projectHasOwnCli, computerIntegrationsOutside, computerIntegrationsToAdd, displayHomePath, outsideProject, releaseFacts} from './_adapter.mjs';
68
+ import {availableLine, RUN_FROM_PROJECT, upgradeLine} from '../../foundation/release/notices.mjs';
69
+ import {alignCommand, addCliCommandFor, computerAgentTextState, installCommandFor, insideProjectElsewhere, projectCoreVersion, projectHasOwnCli, computerIntegrationsOutside, computerIntegrationsToAdd, displayHomePath, outsideProject, releaseFacts} from './_adapter.mjs';
70
70
 
71
71
  /**
72
72
  * @typedef {'pass'|'warn'|'fail'|'info'} DoctorStatus
@@ -286,15 +286,25 @@ export function checkVersionAlignment(ctx) {
286
286
  // the run (spec AST-081 FR2): say so, and how to add the CLI at Core's
287
287
  // version.
288
288
  if (ctx.ownCli === false) {
289
+ // The same comparison as the daily hint: the CLI against the Core the
290
+ // run reads (spec AST-081 FR2). The command adds the CLI in the project
291
+ // spec:AST-040 FR9 defines; from a folder inside it whose package.json
292
+ // is not the project's, or in no project, the fix says how to reach one.
293
+ const add = addCliCommandFor(ctx.cwd, coreVersion);
294
+ const matches = coreVersion === cliVersion;
295
+ const fix = add
296
+ ? `${matches ? 'To pin it for the team and CI' : 'To match'}, run: ${add.command}.`
297
+ : matches
298
+ ? null
299
+ : NO_PROJECT_FIX;
289
300
  return {
290
301
  id: 'version-alignment',
291
302
  label: '@astryxdesign/core <-> @astryxdesign/cli alignment',
292
- status: coreVersion === cliVersion ? 'info' : 'warn',
293
- message:
294
- coreVersion === cliVersion
295
- ? `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered and matches its Core.`
296
- : `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered while its Core is ${coreVersion}.`,
297
- fix: `${coreVersion === cliVersion ? 'To pin it for the team and CI' : 'To match'}, run: ${addCliCommandFor(ctx.cwd, coreVersion)}.`,
303
+ status: matches ? 'info' : 'warn',
304
+ message: matches
305
+ ? `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered and matches its Core.`
306
+ : `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered while its Core is ${coreVersion}.`,
307
+ ...(fix ? {fix} : {}),
298
308
  };
299
309
  }
300
310
  // The project's own CLI answers this project whatever its version
@@ -308,10 +318,31 @@ export function checkVersionAlignment(ctx) {
308
318
  message: drift
309
319
  ? `This project's CLI ${cliVersion} answers it, but its Core is ${coreVersion}: templates, docs, and agent text come from CLI ${cliVersion}, components from Core ${coreVersion}.`
310
320
  : `@astryxdesign/core v${coreVersion} is in step with @astryxdesign/cli v${cliVersion}.`,
311
- ...(drift ? {fix: `To align them, run: ${alignCommand(ctx.cwd, cliVersion, coreVersion)}.`} : {}),
321
+ ...(drift ? alignFix(ctx.cwd, cliVersion, coreVersion) : {}),
312
322
  };
313
323
  }
314
324
 
325
+ /**
326
+ * The fix for a CLI and Core on different releases, when a command fits.
327
+ * @param {string} cwd
328
+ * @param {string} cli
329
+ * @param {string} core
330
+ * @returns {{fix?: string}}
331
+ */
332
+ function alignFix(cwd, cli, core) {
333
+ // From a folder inside a project whose package.json is not the project's,
334
+ // aligning the project would leave this warning in place, so no command
335
+ // fits there (alignCommand returns none): point at the project instead.
336
+ const command = alignCommand(cwd, cli, core);
337
+ return {fix: command ? `To align them, run: ${command}.` : NO_PROJECT_FIX};
338
+ }
339
+
340
+ /**
341
+ * The fix where no install command fits: the folder's package.json is not an
342
+ * Astryx project's (spec AST-040 FR9), and adding there would make it one.
343
+ */
344
+ const NO_PROJECT_FIX = RUN_FROM_PROJECT;
345
+
315
346
  /**
316
347
  * Check 5 — astryx.config.mjs (if present) loads and has a valid shape.
317
348
  * @param {DoctorContext} ctx
@@ -1048,16 +1079,20 @@ function nameTypes(names) {
1048
1079
  }
1049
1080
 
1050
1081
  /**
1051
- * The section keys `astryx docs authoring --index` lists, read the way that
1052
- * command reads them.
1082
+ * The section keys the field reference lists (`astryx docs
1083
+ * authoring/field-reference --index`), read the way that command reads them.
1053
1084
  * @returns {Promise<{keys: Set<string>} | {keys: null, error: string}>}
1054
1085
  */
1055
1086
  async function authoringTopicKeys() {
1056
1087
  try {
1088
+ const {AUTHORING_REFERENCE_ROUTE} =
1089
+ await import('../../foundation/discovery/authoring-self-docs.mjs');
1057
1090
  const catalog = DocsCatalog.fromBuiltins();
1058
- const entry = catalog.resolve('authoring');
1059
- if (!entry) return {keys: null, error: 'it is not a built-in topic'};
1060
- const index = indexView(await lowerTopic(catalog, entry));
1091
+ const node = (await projectTree(catalog)).get(AUTHORING_REFERENCE_ROUTE);
1092
+ if (!node?.ref?.topicFile) {
1093
+ return {keys: null, error: 'the docs tree has no field reference'};
1094
+ }
1095
+ const index = indexView(await lowerTopic(catalog, guideEntry(node)));
1061
1096
  return {keys: new Set(index.sections.map(section => section.id))};
1062
1097
  } catch (err) {
1063
1098
  return {
@@ -1076,7 +1111,7 @@ function surfaceProblems(surface) {
1076
1111
  const problems = [];
1077
1112
  if (surface.types === 0 && surface.untraced.length === 0) {
1078
1113
  problems.push(
1079
- `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring')}\``,
1114
+ `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring/field-reference')}\``,
1080
1115
  );
1081
1116
  }
1082
1117
  for (const {module, names, reason, source, key} of surface.unreadable) {
@@ -1089,7 +1124,7 @@ function surfaceProblems(surface) {
1089
1124
  ? `${source} does not load`
1090
1125
  : `${source} renders section "${key}", which the topic's index does not list`;
1091
1126
  problems.push(
1092
- `${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring')}\`: ${why}`,
1127
+ `${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring/field-reference')}\`: ${why}`,
1093
1128
  );
1094
1129
  }
1095
1130
  for (const {name, reason} of surface.untraced) {
@@ -1130,7 +1165,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1130
1165
  const audit = await auditAuthoringSelfDocs({root, sources});
1131
1166
  const problems = [
1132
1167
  ...audit.unreachable.map(
1133
- source => `${source} is not in \`${formatCliCommand('docs authoring')}\``,
1168
+ source => `${source} is not in \`${formatCliCommand('docs authoring/field-reference')}\``,
1134
1169
  ),
1135
1170
  ...audit.failed.map(
1136
1171
  ({source, error}) => `${source} failed to load: ${error}`,
@@ -1146,7 +1181,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1146
1181
  : {keys: options.topicKeys};
1147
1182
  const surface = [
1148
1183
  ...('error' in topic
1149
- ? [`\`${formatCliCommand('docs authoring')}\` could not be read: ${topic.error}`]
1184
+ ? [`\`${formatCliCommand('docs authoring/field-reference')}\` could not be read: ${topic.error}`]
1150
1185
  : []),
1151
1186
  ...surfaceProblems(
1152
1187
  await auditAuthoringSurface({root, sources, topicKeys: topic.keys}),
@@ -1170,7 +1205,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1170
1205
  id,
1171
1206
  label,
1172
1207
  status: 'pass',
1173
- message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring')}\`.`,
1208
+ message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
1174
1209
  };
1175
1210
  } catch (err) {
1176
1211
  return {
@@ -1238,7 +1273,7 @@ export async function checkCliDocs(_ctx, options = {}) {
1238
1273
  id,
1239
1274
  label,
1240
1275
  status: 'pass',
1241
- message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring')}\`.`,
1276
+ message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
1242
1277
  };
1243
1278
  } catch (err) {
1244
1279
  return {
@@ -1355,7 +1390,7 @@ export async function checkDocsProgressiveDisclosure(ctx) {
1355
1390
  // A guide the docs tree places is a topic read by its route; it is held
1356
1391
  // to the same budget as every flat topic.
1357
1392
  const guides = [...(await projectTree(catalog)).nodes.values()]
1358
- // A flat topic in the Unorganized level is checked above, as a topic.
1393
+ // A flat topic in a topic level is checked above, as a topic.
1359
1394
  .filter(node => node.kind === 'generic' && !node.ref?.flatTopic)
1360
1395
  .map(guideEntry);
1361
1396
  for (const entry of [...catalog.entries(), ...guides]) {
@@ -1555,6 +1590,7 @@ function checkFailureNote(failed) {
1555
1590
  const SKIP_REASONS = {
1556
1591
  'already-shown': 'it had already printed that day',
1557
1592
  'no-newer': 'no newer release was known',
1593
+ 'no-project': 'the folder belongs to no Astryx project, so no install command fits',
1558
1594
  };
1559
1595
 
1560
1596
  /**
@@ -1760,12 +1796,14 @@ export function checkComputerIntegrations(ctx) {
1760
1796
  * Inside a project, the integrations installed for the computer that the
1761
1797
  * project does not install: available, never used (spec AST-081 FR12).
1762
1798
  * Always info.
1763
- * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: (name: string) => string}} input
1799
+ * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: ((name: string) => string) | null, elsewhere?: boolean}} input
1764
1800
  * `install`: the command that adds a package with the project's package
1765
- * manager (read by the adapter)
1801
+ * manager (read by the adapter); null when the folder belongs to no
1802
+ * project, or `elsewhere`: its package.json is not the project's, where the
1803
+ * fix points at the project's folder
1766
1804
  * @returns {DoctorCheck}
1767
1805
  */
1768
- export function checkComputerIntegrationsAvailable({installed, candidates, install}) {
1806
+ export function checkComputerIntegrationsAvailable({installed, candidates, install, elsewhere = false}) {
1769
1807
  const available = candidates.filter(c => !installed.has(c.name));
1770
1808
  const base = {id: 'computer-integrations', label: 'Integrations installed for this computer', status: /** @type {const} */ ('info')};
1771
1809
  if (available.length === 0) {
@@ -1775,7 +1813,11 @@ export function checkComputerIntegrationsAvailable({installed, candidates, insta
1775
1813
  return {
1776
1814
  ...base,
1777
1815
  message: `Installed for this computer but not in this project, so not used here: ${available.map(c => c.name).join(', ')}.`,
1778
- fix: `To use one in this project, run ${available.map(c => `\`${add(c.name)}\``).join(' or ')}.`,
1816
+ ...(add
1817
+ ? {fix: `To use one in this project, run ${available.map(c => `\`${add(c.name)}\``).join(' or ')}.`}
1818
+ : elsewhere
1819
+ ? {fix: NO_PROJECT_FIX}
1820
+ : {}),
1779
1821
  };
1780
1822
  }
1781
1823
 
@@ -2034,7 +2076,7 @@ export async function runChecks(options = {}) {
2034
2076
  {
2035
2077
  const loadedNames = (project?.loadedIntegrations ?? []).map((/** @type {{name: string}} */ i) => i.name);
2036
2078
  const candidates = await computerIntegrationsToAdd(cwd, loadedNames);
2037
- checks.push(checkComputerIntegrationsAvailable({installed: new Set(loadedNames), candidates, install: installCommandFor(cwd)}));
2079
+ checks.push(checkComputerIntegrationsAvailable({installed: new Set(loadedNames), candidates, install: installCommandFor(cwd), elsewhere: insideProjectElsewhere(cwd)}));
2038
2080
  }
2039
2081
  checks.push(await checkAuthoringDocs(ctx));
2040
2082
  checks.push(await checkCliDocs(ctx));
@@ -31,7 +31,9 @@ import {
31
31
  checkIntegrationIssues,
32
32
  checkVersionAlignment,
33
33
  checkPackageManager,
34
+ checkComputerIntegrationsAvailable,
34
35
  } from './doctor.mjs';
36
+ import {installCommandFor} from './_adapter.mjs';
35
37
  import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
36
38
  import {Project} from '../../foundation/config/project.mjs';
37
39
 
@@ -223,7 +225,13 @@ describe("doctor — the project's own CLI and Core on different releases", () =
223
225
  ).version;
224
226
  /** @param {string} core */
225
227
  const at = core => {
228
+ // A project as spec:AST-040 FR9 defines it: its package.json declares
229
+ // an Astryx package.
226
230
  const dir = mkProject({
231
+ 'package.json': JSON.stringify({
232
+ name: 'app',
233
+ dependencies: {'@astryxdesign/core': core},
234
+ }),
227
235
  'package-lock.json': '{}',
228
236
  'node_modules/@astryxdesign/core/package.json': JSON.stringify({
229
237
  name: '@astryxdesign/core',
@@ -257,6 +265,10 @@ describe("doctor — the project's own CLI and Core on different releases", () =
257
265
 
258
266
  it('in a project with no CLI of its own, warns that the started copy answered and names the command that adds the CLI at Core', () => {
259
267
  const dir = mkProject({
268
+ 'package.json': JSON.stringify({
269
+ name: 'app',
270
+ dependencies: {'@astryxdesign/core': '0.0.1'},
271
+ }),
260
272
  'package-lock.json': '{}',
261
273
  'node_modules/@astryxdesign/core/package.json': JSON.stringify({
262
274
  name: '@astryxdesign/core',
@@ -279,6 +291,52 @@ describe("doctor — the project's own CLI and Core on different releases", () =
279
291
  });
280
292
  });
281
293
 
294
+ describe('the command that adds an integration installed for the computer', () => {
295
+ const app = () =>
296
+ mkProject({
297
+ 'package.json': JSON.stringify({
298
+ name: 'app',
299
+ dependencies: {'@astryxdesign/core': '0.7.0'},
300
+ }),
301
+ 'pnpm-lock.yaml': '',
302
+ 'tools/codegen/package.json': JSON.stringify({name: 'codegen'}),
303
+ });
304
+
305
+ it('adds it in the project, with its package manager', () => {
306
+ const dir = app();
307
+ expect(installCommandFor(dir)?.('@acme/a')).toBe('pnpm add @acme/a');
308
+ });
309
+
310
+ // A package.json that is not the project's (spec AST-040 FR9): a run
311
+ // there loads integrations from it, so a package added to the project
312
+ // stays unused there. No command; the fix points at the project.
313
+ it("from a tool folder inside the project, names no command and points at the project's folder", () => {
314
+ const dir = app();
315
+ expect(installCommandFor(path.join(dir, 'tools', 'codegen'))).toBeNull();
316
+ const c = checkComputerIntegrationsAvailable({
317
+ installed: new Set(),
318
+ candidates: [/** @type {any} */ ({name: '@acme/a'})],
319
+ install: null,
320
+ elsewhere: true,
321
+ });
322
+ expect(c.fix).toBe(
323
+ "Run this from the Astryx project's folder, or declare an Astryx package in this folder's package.json to make it a project of its own.",
324
+ );
325
+ });
326
+
327
+ it('in a folder that belongs to no project, names no command', () => {
328
+ const dir = mkProject({'package.json': JSON.stringify({name: 'tool'})});
329
+ expect(installCommandFor(dir)).toBeNull();
330
+ const c = checkComputerIntegrationsAvailable({
331
+ installed: new Set(),
332
+ candidates: [/** @type {any} */ ({name: '@acme/a'})],
333
+ install: null,
334
+ });
335
+ expect(c.status).toBe('info');
336
+ expect(c).not.toHaveProperty('fix');
337
+ });
338
+ });
339
+
282
340
  describe('checkCliCommand', () => {
283
341
  it('is informational when no integration declares a command', () => {
284
342
  const dir = mkProject({'pnpm-lock.yaml': ''});
@@ -652,7 +710,7 @@ describe('checkAuthoringDocs', () => {
652
710
  it('passes when every authoring self-doc is reachable and fits one read', async () => {
653
711
  const c = await checkAuthoringDocs();
654
712
  expect(c).toMatchObject({id: 'authoring-docs', status: 'pass'});
655
- expect(c.message).toContain(formatCliCommand('docs authoring'));
713
+ expect(c.message).toContain(formatCliCommand('docs authoring/field-reference'));
656
714
  }, SLOW);
657
715
  });
658
716
 
@@ -680,7 +738,7 @@ describe('checkCliDocs', () => {
680
738
  id: 'cli-docs',
681
739
  label: 'CLI docs',
682
740
  status: 'pass',
683
- message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring')}\`.`,
741
+ message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
684
742
  });
685
743
  },
686
744
  SLOW,
@@ -790,7 +848,7 @@ describe('checkDocsTree', () => {
790
848
  describe('checkAuthoringDocs against the public authoring surface', () => {
791
849
  const NAMESPACE = 'doctypes/namespace/namespace.doc.mjs';
792
850
  const NAMESPACE_TYPES =
793
- `NamespaceDoc, NamespaceProviderScope, NamespaceSlotAcceptance, NamespaceSlot, NamespaceAdoptionSource, NamespaceAdoptionRule from doctypes/namespace/type.ts have no doc in \`${formatCliCommand('docs authoring')}\``;
851
+ `NamespaceDoc, NamespaceProviderScope, NamespaceSlotAcceptance, NamespaceSlot, NamespaceAdoptionSource, NamespaceAdoptionRule from doctypes/namespace/type.ts have no doc in \`${formatCliCommand('docs authoring/field-reference')}\``;
794
852
  const SURFACE_FIX =
795
853
  'Put a self-doc beside each module whose types @astryxdesign/cli/authoring exports and list it in AUTHORING_SELF_DOCS; export what each listed self-doc documents, or remove that self-doc.';
796
854
 
@@ -820,7 +878,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
820
878
  id: 'authoring-docs',
821
879
  label: 'Authoring docs',
822
880
  status: 'pass',
823
- message: `All ${AUTHORING_SELF_DOCS.length} authoring schemas are readable in \`${formatCliCommand('docs authoring')}\`.`,
881
+ message: `All ${AUTHORING_SELF_DOCS.length} authoring schemas are readable in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
824
882
  });
825
883
  },
826
884
  SLOW,
@@ -849,7 +907,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
849
907
  });
850
908
  expect(c.status).toBe('fail');
851
909
  expect(c.message).toBe(
852
- `2 problems: ${NAMESPACE} is not in \`${formatCliCommand('docs authoring')}\`; ${NAMESPACE_TYPES}: ${NAMESPACE} is not listed in AUTHORING_SELF_DOCS`,
910
+ `2 problems: ${NAMESPACE} is not in \`${formatCliCommand('docs authoring/field-reference')}\`; ${NAMESPACE_TYPES}: ${NAMESPACE} is not listed in AUTHORING_SELF_DOCS`,
853
911
  );
854
912
  },
855
913
  SLOW,
@@ -858,7 +916,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
858
916
  it(
859
917
  "fails when the topic's index no longer exposes the NamespaceDoc section",
860
918
  async () => {
861
- const index = await docs('authoring', undefined, {index: true});
919
+ const index = await docs('authoring/field-reference', undefined, {index: true});
862
920
  const topicKeys = new Set(
863
921
  index.data.sections
864
922
  .map((/** @type {any} */ s) => s.id)
@@ -947,7 +1005,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
947
1005
  expect(c.fix).toBe(SURFACE_FIX);
948
1006
  expect(c.message).toMatch(
949
1007
  new RegExp(
950
- `^[A-Za-z, ]+ from ${escape(module)} have no doc in \`${escape(formatCliCommand('docs authoring'))}\`: no self-doc sits beside ${escape(module)}$`,
1008
+ `^[A-Za-z, ]+ from ${escape(module)} have no doc in \`${escape(formatCliCommand('docs authoring/field-reference'))}\`: no self-doc sits beside ${escape(module)}$`,
951
1009
  ),
952
1010
  );
953
1011
  for (const name of names) {
@@ -990,7 +1048,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
990
1048
  expect(await checkAuthoringDocs()).toMatchObject({
991
1049
  status: 'fail',
992
1050
  message:
993
- `\`${formatCliCommand('docs authoring')}\` could not be read: no built-in docs`,
1051
+ `\`${formatCliCommand('docs authoring/field-reference')}\` could not be read: no built-in docs`,
994
1052
  fix: SURFACE_FIX,
995
1053
  });
996
1054
  } finally {
@@ -1011,7 +1069,7 @@ describe('checkAuthoringDocs against the public authoring surface', () => {
1011
1069
  const c = await checkAuthoringDocs(undefined, {root});
1012
1070
  expect(c.status).toBe('fail');
1013
1071
  expect(c.message).toContain(
1014
- `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring')}\``,
1072
+ `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring/field-reference')}\``,
1015
1073
  );
1016
1074
  },
1017
1075
  SLOW,
@@ -1317,8 +1375,12 @@ describe('a configured integration that cannot load fails the gate', () => {
1317
1375
  'astryx.config.mjs': "export default { integrations: ['@acme/widgets'] };\n",
1318
1376
  };
1319
1377
 
1320
- /** Run doctor on a project under the working directory. */
1321
- async function report(files) {
1378
+ /**
1379
+ * Run doctor on a project under the working directory, in its folder `at`.
1380
+ * @param {Record<string, string>} files
1381
+ * @param {string} [at]
1382
+ */
1383
+ async function report(files, at = '.') {
1322
1384
  const dir = fs.mkdtempSync(path.join(process.cwd(), '.astryx-doctor-gate-'));
1323
1385
  tmpDirs.push(dir);
1324
1386
  for (const [rel, content] of Object.entries(files)) {
@@ -1326,7 +1388,7 @@ describe('a configured integration that cannot load fails the gate', () => {
1326
1388
  fs.mkdirSync(path.dirname(abs), {recursive: true});
1327
1389
  fs.writeFileSync(abs, content);
1328
1390
  }
1329
- const {checks, summary} = (await doctor({cwd: dir})).data;
1391
+ const {checks, summary} = (await doctor({cwd: path.join(dir, at)})).data;
1330
1392
  return {by: Object.fromEntries(checks.map(c => [c.id, c])), summary};
1331
1393
  }
1332
1394
 
@@ -1354,6 +1416,27 @@ describe('a configured integration that cannot load fails the gate', () => {
1354
1416
  SLOW,
1355
1417
  );
1356
1418
 
1419
+ it(
1420
+ 'passes in a workspace member whose configured integration is hoisted to the root',
1421
+ async () => {
1422
+ const {by} = await report(
1423
+ {
1424
+ 'package.json': JSON.stringify({name: 'root', private: true, workspaces: ['apps/*']}),
1425
+ ...CORE_STUB,
1426
+ ...widgets(),
1427
+ 'apps/web/package.json': '{"name":"web"}',
1428
+ 'apps/web/astryx.config.mjs': "export default { integrations: ['@acme/widgets'] };\n",
1429
+ },
1430
+ 'apps/web',
1431
+ );
1432
+ expect(by['configured-integrations'].status).toBe('pass');
1433
+ expect(by['configured-integrations'].message).toBe(
1434
+ '1 integration named in astryx.config loaded: @acme/widgets.',
1435
+ );
1436
+ },
1437
+ SLOW,
1438
+ );
1439
+
1357
1440
  it(
1358
1441
  'counts the package being authored when its own config names it',
1359
1442
  async () => {
package/api/hook/hook.mjs CHANGED
@@ -43,7 +43,7 @@ export async function hook(name, options = {}) {
43
43
  zh = false,
44
44
  } = options;
45
45
 
46
- // Default detail level mirrors the CLI (see commands/hook/index.mjs):
46
+ // Default detail level mirrors the CLI (see commands/hook.mjs):
47
47
  // single-hook views default to 'full', list-style views (--list,
48
48
  // --category, or no name) default to 'brief' (scannable name lists).
49
49
  // Keeping this in sync with the CLI is what the API↔CLI parity test checks.
@@ -40,6 +40,14 @@ export function integrationFluff(discovered: Parameters<typeof findFluff>[0]): P
40
40
  * read too
41
41
  */
42
42
  export function integrationStrayPointers(discovered: Parameters<typeof findStrayPointers>[0], integration?: any): Promise<import("./authoring-checks.type.mjs").StrayPointer[]>;
43
+ /**
44
+ * Each Astryx command a package's topics write with a package runner. A
45
+ * package whose topics cannot be discovered has none here: the other checks
46
+ * report topics that do not load.
47
+ * @param {any} integration a loaded integration
48
+ * @returns {Promise<import('../../foundation/discovery/runner-commands.mjs').RunnerCommand[]>}
49
+ */
50
+ export function integrationRunnerCommands(integration: any): Promise<import("../../foundation/discovery/runner-commands.mjs").RunnerCommand[]>;
43
51
  import { findCopiedPassages } from '../../foundation/discovery/copied-passages.mjs';
44
52
  import { findFluff } from '../../foundation/discovery/doc-fluff.mjs';
45
53
  import { findStrayPointers } from '../../foundation/discovery/stray-pointers.mjs';