@astryxdesign/cli 0.7.3-canary.f94e962 → 0.7.3-canary.fba04ed

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 (201) hide show
  1. package/README.md +68 -68
  2. package/api/build/_adapter.mjs +37 -25
  3. package/api/build/blocks/blocks.d.mts +68 -18
  4. package/api/build/blocks/blocks.mjs +475 -116
  5. package/api/build/blocks/blocks.test.mjs +191 -61
  6. package/api/build/blocks/blocks.weights.json +1 -1
  7. package/api/build/build.type.mjs +1 -1
  8. package/api/build/kit/answer.d.mts +9 -5
  9. package/api/build/kit/answer.mjs +123 -13
  10. package/api/build/kit/answer.test.mjs +73 -3
  11. package/api/build/kit/signals.d.mts +19 -0
  12. package/api/build/kit/signals.mjs +18 -7
  13. package/api/build/tree.mjs +2 -1
  14. package/api/build/tree.test.mjs +37 -29
  15. package/api/component/_adapter.mjs +39 -5
  16. package/api/component/component-replacement.test.mjs +1 -0
  17. package/api/component/component.mjs +1 -1
  18. package/api/component/doc-links.test.mjs +2 -2
  19. package/api/discover/_adapter.d.mts +1 -2
  20. package/api/discover/_adapter.mjs +6 -8
  21. package/api/discover/discover.mjs +0 -1
  22. package/api/docs/_adapter.d.mts +2 -2
  23. package/api/docs/_adapter.mjs +65 -18
  24. package/api/docs/docs-homes.test.mjs +127 -0
  25. package/api/docs/docs.doc.mjs +3 -3
  26. package/api/docs/docs.test.mjs +28 -18
  27. package/api/docs/integration-tree.test.mjs +20 -20
  28. package/api/docs/integrationDocs.test.mjs +1 -1
  29. package/api/docs/namespace-section.test.mjs +6 -6
  30. package/api/docs/reference-blocks.test.mjs +2 -2
  31. package/api/doctor/_adapter.d.mts +33 -13
  32. package/api/doctor/_adapter.mjs +55 -25
  33. package/api/doctor/doctor.d.mts +23 -5
  34. package/api/doctor/doctor.mjs +97 -28
  35. package/api/doctor/doctor.test.mjs +67 -9
  36. package/api/hook/hook.mjs +1 -1
  37. package/api/integration/validate-integration-fixes.test.mjs +6 -5
  38. package/api/integration/validate-integration-gaps.test.mjs +12 -1
  39. package/api/integration/validate-integration.d.mts +4 -0
  40. package/api/integration/validate-integration.mjs +48 -7
  41. package/api/integration/validate-integration.type.d.mts +36 -5
  42. package/api/integration/validate-integration.type.mjs +27 -6
  43. package/api/integration/validateIntegration.doc.mjs +1 -1
  44. package/api/search/_adapter.d.mts +16 -0
  45. package/api/search/_adapter.mjs +39 -0
  46. package/api/search/_adapter.test.mjs +173 -0
  47. package/api/search/_candidate-score.mjs +1 -1
  48. package/api/search/_entries.d.mts +11 -0
  49. package/api/search/_entries.mjs +35 -17
  50. package/api/search/_entries.test.mjs +48 -0
  51. package/api/search/_gather-docs.mjs +3 -3
  52. package/api/search/_gather-templates.d.mts +0 -1
  53. package/api/search/_gather-templates.mjs +25 -0
  54. package/api/search/search.doc.mjs +1 -1
  55. package/api/search/search.integration-block.test.mjs +100 -0
  56. package/api/search/search.mjs +6 -2
  57. package/api/search/search.test.mjs +14 -14
  58. package/api/template/template.mjs +5 -1
  59. package/assets/docs/author-a-theme.doc.mjs +2 -2
  60. package/assets/docs/tree/add-a-component.doc.mjs +1 -1
  61. package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
  62. package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
  63. package/assets/docs/tree/agent-guidance.doc.mjs +1 -1
  64. package/assets/docs/tree/{integrations.doc.mjs → authoring.doc.mjs} +15 -6
  65. package/assets/docs/tree/block-template.doc.mjs +1 -1
  66. package/assets/docs/tree/build-the-template.doc.mjs +1 -1
  67. package/assets/docs/tree/building-blocks.doc.mjs +2 -2
  68. package/assets/docs/tree/check-the-props.doc.mjs +1 -1
  69. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  70. package/assets/docs/tree/checks.doc.mjs +2 -2
  71. package/assets/docs/tree/ci-and-containers.doc.mjs +13 -0
  72. package/assets/docs/tree/cli-command.doc.mjs +1 -1
  73. package/assets/docs/tree/cli.doc.mjs +1 -1
  74. package/assets/docs/tree/codemods.doc.mjs +1 -1
  75. package/assets/docs/tree/component-family.doc.mjs +1 -1
  76. package/assets/docs/tree/component-imports.doc.mjs +1 -1
  77. package/assets/docs/tree/components.doc.mjs +1 -1
  78. package/assets/docs/tree/configuration.doc.mjs +1 -1
  79. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
  80. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  81. package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
  82. package/assets/docs/tree/docs.doc.mjs +1 -1
  83. package/assets/docs/tree/document-the-template.doc.mjs +1 -1
  84. package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
  85. package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
  86. package/assets/docs/tree/extend-or-replace.doc.mjs +1 -1
  87. package/assets/docs/{authoring.doc.mjs → tree/field-reference.doc.mjs} +4 -3
  88. package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
  89. package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
  90. package/assets/docs/tree/global-integrations.doc.mjs +2 -2
  91. package/assets/docs/tree/grade-template-with-agent.doc.mjs +4 -4
  92. package/assets/docs/tree/help.doc.mjs +2 -2
  93. package/assets/docs/tree/links.doc.mjs +1 -1
  94. package/assets/docs/tree/package-and-test.doc.mjs +1 -1
  95. package/assets/docs/tree/page-template.doc.mjs +1 -1
  96. package/assets/docs/tree/publishing.doc.mjs +1 -1
  97. package/assets/docs/tree/quick-start.doc.mjs +1 -1
  98. package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
  99. package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
  100. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  101. package/assets/docs/tree/see-it-in-an-app.doc.mjs +1 -1
  102. package/assets/docs/tree/ship.doc.mjs +2 -2
  103. package/assets/docs/tree/short-and-findable.doc.mjs +1 -1
  104. package/assets/docs/tree/single-component.doc.mjs +1 -1
  105. package/assets/docs/tree/start-a-template.doc.mjs +1 -1
  106. package/assets/docs/tree/subcomponent.doc.mjs +1 -1
  107. package/assets/docs/tree/template-assets.doc.mjs +1 -1
  108. package/assets/docs/tree/template-doc-overview.doc.mjs +2 -2
  109. package/assets/docs/tree/template-fonts.doc.mjs +1 -1
  110. package/assets/docs/tree/template-grading-rubric.doc.mjs +1 -1
  111. package/assets/docs/tree/template-icons.doc.mjs +1 -1
  112. package/assets/docs/tree/template-images-media.doc.mjs +1 -1
  113. package/assets/docs/tree/template-styles.doc.mjs +1 -1
  114. package/assets/docs/tree/templates.doc.mjs +1 -1
  115. package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
  116. package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
  117. package/assets/docs/tree/themes.doc.mjs +1 -1
  118. package/assets/docs/tree/troubleshooting.doc.mjs +1 -1
  119. package/assets/docs/tree/upgrading.doc.mjs +1 -1
  120. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
  121. package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
  122. package/assets/docs/tree/versioning.doc.mjs +5 -1
  123. package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
  124. package/assets/docs/tree/write-the-template-file.doc.mjs +1 -1
  125. package/assets/docs/use-integrations.doc.mjs +120 -0
  126. package/authoring/doctypes/schema/schema.doc.mjs +1 -1
  127. package/authoring/integration/integration.doc.mjs +1 -1
  128. package/authoring/integration/type.ts +1 -1
  129. package/clients/cli/command-result-coverage.test.mjs +6 -5
  130. package/clients/cli/commands/build-theme.color-scheme.test.mjs +1 -1
  131. package/clients/cli/commands/{component/index.mjs → component.mjs} +37 -37
  132. package/clients/cli/commands/component.test.mjs +6 -6
  133. package/clients/cli/commands/docs.doc.mjs +2 -2
  134. package/clients/cli/commands/docs.mjs +1 -1
  135. package/clients/cli/commands/docs.test.mjs +14 -14
  136. package/clients/cli/commands/doctor-integration.test.mjs +49 -1
  137. package/clients/cli/commands/doctor.doc.mjs +1 -1
  138. package/clients/cli/commands/doctor.mjs +10 -0
  139. package/clients/cli/commands/{hook/index.mjs → hook.mjs} +22 -22
  140. package/clients/cli/commands/import-hint-correctness.test.mjs +1 -1
  141. package/clients/cli/commands/integration.doc.mjs +1 -1
  142. package/clients/cli/commands/manifest.doc.mjs +1 -1
  143. package/clients/cli/commands/manifest.mjs +67 -0
  144. package/clients/cli/commands/outside-project.test.mjs +99 -0
  145. package/clients/cli/commands/postinstall.doc.mjs +23 -0
  146. package/clients/cli/commands/postinstall.mjs +31 -0
  147. package/clients/cli/commands/setup-nudge.test.mjs +17 -0
  148. package/clients/cli/commands/{build-theme.mjs → theme.mjs} +1 -1
  149. package/clients/cli/index.mjs +35 -93
  150. package/clients/cli/lib/component-format.mjs +1 -1
  151. package/clients/cli/lib/define-command.mjs +12 -7
  152. package/clients/cli/lib/exit-codes.test.mjs +5 -0
  153. package/clients/cli/lib/manifest.test.mjs +12 -0
  154. package/clients/cli/lib/welcome-box.mjs +50 -0
  155. package/foundation/agent-docs/agent-doc-state.d.mts +12 -0
  156. package/foundation/agent-docs/agent-doc-state.mjs +24 -2
  157. package/foundation/agent-docs/agent-docs.mjs +7 -6
  158. package/foundation/agent-docs/agent-docs.test.mjs +5 -4
  159. package/foundation/agent-docs/computer-agent-text.d.mts +39 -2
  160. package/foundation/agent-docs/computer-agent-text.mjs +135 -8
  161. package/foundation/agent-docs/computer-agent-text.test.mjs +99 -2
  162. package/foundation/discovery/authoring-self-docs.d.mts +7 -0
  163. package/foundation/discovery/authoring-self-docs.mjs +16 -4
  164. package/foundation/discovery/authoring-self-docs.test.mjs +15 -3
  165. package/foundation/discovery/authoring-surface.d.mts +1 -1
  166. package/foundation/discovery/authoring-surface.mjs +2 -2
  167. package/foundation/discovery/authoring-surface.test.mjs +1 -1
  168. package/foundation/discovery/cli-self-docs.d.mts +2 -1
  169. package/foundation/discovery/cli-self-docs.mjs +4 -3
  170. package/foundation/discovery/cli-self-docs.test.mjs +2 -2
  171. package/foundation/discovery/runner-commands.mjs +1 -0
  172. package/foundation/discovery/stray-pointers.test.mjs +1 -1
  173. package/foundation/doc-compiler/doc-loads.test.mjs +21 -9
  174. package/foundation/doc-compiler/split-topic-keywords.test.mjs +3 -2
  175. package/foundation/doc-compiler/tree.d.mts +32 -6
  176. package/foundation/doc-compiler/tree.mjs +77 -43
  177. package/foundation/doc-compiler/tree.test.mjs +7 -7
  178. package/foundation/fs/read-record.d.mts +18 -0
  179. package/foundation/fs/read-record.mjs +131 -0
  180. package/foundation/fs/read-record.test.mjs +77 -0
  181. package/foundation/integrations/cli-peer-version.d.mts +36 -0
  182. package/foundation/integrations/cli-peer-version.mjs +132 -0
  183. package/foundation/integrations/cli-peer-version.test.mjs +354 -0
  184. package/foundation/integrations/exports-subpaths.d.mts +57 -0
  185. package/foundation/integrations/exports-subpaths.mjs +113 -0
  186. package/foundation/integrations/public-imports.d.mts +118 -0
  187. package/foundation/integrations/public-imports.mjs +1769 -0
  188. package/foundation/integrations/public-imports.test.mjs +1793 -0
  189. package/foundation/release/cache.test.mjs +24 -21
  190. package/foundation/release/global-state.d.mts +8 -4
  191. package/foundation/release/global-state.mjs +4 -2
  192. package/foundation/release/notices.d.mts +62 -8
  193. package/foundation/release/notices.mjs +136 -25
  194. package/foundation/release/notices.test.mjs +21 -0
  195. package/foundation/response/response-types.doc.mjs +1 -1
  196. package/foundation/text/string-utils.d.mts +2 -1
  197. package/foundation/text/string-utils.mjs +16 -5
  198. package/foundation/text/suggest-order.d.mts +72 -0
  199. package/foundation/text/suggest-order.mjs +363 -0
  200. package/foundation/text/suggest-order.test.mjs +259 -0
  201. package/package.json +9 -9
@@ -157,13 +157,13 @@ describe('a section read on a namespace', () => {
157
157
  expect(names).toContain('layout/side-panels');
158
158
  expect(names.every(name => name.startsWith('layout/'))).toBe(true);
159
159
  // At any depth: guides under nested namespaces are named, namespaces are not.
160
- const cli = await docs('cli', 'zzzz-nope').catch(e => e);
161
- expect(cli.code).toBe('ERR_UNKNOWN_SECTION');
162
- expect(cli.suggestions.map(s => s.name)).toContain(
163
- 'cli/integrations/quick-start',
160
+ const authoring = await docs('authoring', 'zzzz-nope').catch(e => e);
161
+ expect(authoring.code).toBe('ERR_UNKNOWN_SECTION');
162
+ expect(authoring.suggestions.map(s => s.name)).toContain(
163
+ 'authoring/building-blocks/components/add-a-component',
164
164
  );
165
- expect(cli.suggestions.map(s => s.name)).not.toContain(
166
- 'cli/integrations',
165
+ expect(authoring.suggestions.map(s => s.name)).not.toContain(
166
+ 'authoring/building-blocks',
167
167
  );
168
168
  },
169
169
  SLOW,
@@ -300,11 +300,11 @@ describe('a reference block that includes what it names', () => {
300
300
  });
301
301
 
302
302
  describe('what a reference block names', () => {
303
- it('resolves a CLI authoring schema by identity, to its section of `astryx docs authoring`', async () => {
303
+ it('resolves a CLI authoring schema by identity, to its section of the field reference', async () => {
304
304
  const resolve = await linkResolver(builtinCatalog(), CLI_PROVIDER_ID);
305
305
  expect(await resolve('schema:integration')).toMatchObject({
306
306
  id: createDocId(CLI_PROVIDER_ID, 'schema', 'integration'),
307
- route: 'authoring',
307
+ route: 'authoring/field-reference',
308
308
  title: 'Astryx Integration',
309
309
  command: 'astryx docs authoring integration',
310
310
  });
@@ -64,8 +64,11 @@ export function computerIntegrationsOutside(cwd: string): Promise<{
64
64
  */
65
65
  export function computerIntegrationsToAdd(cwd: string, loadedNames: string[]): Promise<import("../../foundation/integrations/computer-integrations.mjs").ComputerIntegrationCandidate[]>;
66
66
  /**
67
- * The computer-level agent text's setting and its state on disk.
68
- * @returns {{settings: import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings, entries: Array<{path: string, state: import('../../foundation/agent-docs/computer-agent-text.mjs').ComputerAgentTextState, link?: true}>}}
67
+ * The computer-level agent text's setting, its state on disk, and the command
68
+ * the skill file tells agents to run and the install step it records for when
69
+ * that command is not found (each null when there is no file, or it names
70
+ * none).
71
+ * @returns {{settings: import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings, entries: Array<{path: string, state: import('../../foundation/agent-docs/computer-agent-text.mjs').ComputerAgentTextState, link?: true}>, command: string | null, install: string | null}}
69
72
  */
70
73
  export function computerAgentTextState(): {
71
74
  settings: import("../../foundation/env/user-settings.mjs").ComputerAgentTextSettings;
@@ -74,6 +77,8 @@ export function computerAgentTextState(): {
74
77
  state: import("../../foundation/agent-docs/computer-agent-text.mjs").ComputerAgentTextState;
75
78
  link?: true;
76
79
  }>;
80
+ command: string | null;
81
+ install: string | null;
77
82
  };
78
83
  /**
79
84
  * The release facts doctor reports, read here so the checks stay pure
@@ -83,7 +88,7 @@ export function computerAgentTextState(): {
83
88
  * command that upgrades it.
84
89
  * @param {string} cwd
85
90
  * @param {{project: boolean}} options
86
- * @returns {{answeredBy: {cli: string, core: string | null, copy: string}, latest: string | null, globalBehind: ReturnType<typeof globalBehind> | null, projectLag: ReturnType<typeof projectLag> | null, lastNoticeSkip: ReturnType<typeof lastNoticeSkip>, lastCheckFailure: ReturnType<typeof lastCheckFailure>, stateLock: ReturnType<typeof stateLockHolder>, searchPathCommands: Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade: string | null}>}}
91
+ * @returns {{answeredBy: {cli: string, core: string | null, copy: string}, latest: string | null, globalBehind: ReturnType<typeof globalBehind> | null, projectLag: ReturnType<typeof projectLag> | null, lastNoticeSkip: ReturnType<typeof lastNoticeSkip>, lastCheckFailure: ReturnType<typeof lastCheckFailure>, stateLock: ReturnType<typeof stateLockHolder>, searchPathCommands: Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade: string | null, runner: boolean}>}}
87
92
  */
88
93
  export function releaseFacts(cwd: string, { project }: {
89
94
  project: boolean;
@@ -101,6 +106,7 @@ export function releaseFacts(cwd: string, { project }: {
101
106
  stateLock: ReturnType<typeof stateLockHolder>;
102
107
  searchPathCommands: Array<import("../../foundation/env/search-path.mjs").SearchPathCommand & {
103
108
  upgrade: string | null;
109
+ runner: boolean;
104
110
  }>;
105
111
  };
106
112
  /** Whether `cwd` is outside every project. */
@@ -108,13 +114,14 @@ export function outsideProject(cwd: string): boolean;
108
114
  /**
109
115
  * The commands that bring a project's own CLI and Core to one release, with
110
116
  * 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.
117
+ * the CLI is newer; else the CLI to the Core's release. Null when no
118
+ * command fits (see `alignCliAndCore`).
112
119
  * @param {string} cwd
113
120
  * @param {string} cli
114
121
  * @param {string} core
115
- * @returns {string}
122
+ * @returns {string | null}
116
123
  */
117
- export function alignCommand(cwd: string, cli: string, core: string): string;
124
+ export function alignCommand(cwd: string, cli: string, core: string): string | null;
118
125
  /**
119
126
  * The Core release the project at `cwd` names: installed, else locked, else
120
127
  * declared; the version the daily hint and notice compare against (spec
@@ -131,19 +138,32 @@ export function projectCoreVersion(cwd: string): string | null;
131
138
  export function projectHasOwnCli(cwd: string): boolean;
132
139
  /**
133
140
  * The command that adds the CLI at `version` with the project's package
134
- * manager.
141
+ * manager, and the Core it matches: from a folder whose package.json declares
142
+ * no Astryx package, in the Astryx project above at that project's Core; null
143
+ * when there is none (see `cliInstallAdvice`).
135
144
  * @param {string} cwd
136
145
  * @param {string} version
137
- * @returns {string}
146
+ * @returns {{command: string, core: string} | null}
138
147
  */
139
- export function addCliCommandFor(cwd: string, version: string): string;
148
+ export function addCliCommandFor(cwd: string, version: string): {
149
+ command: string;
150
+ core: string;
151
+ } | null;
140
152
  /**
141
- * The command that adds a package with the folder's package manager, read
142
- * from its lockfiles and `packageManager` field.
153
+ * The command that adds a package to the project of `cwd`; null in a folder
154
+ * that belongs to no project or whose package.json is not the project's (see
155
+ * `projectAddCommand`).
143
156
  * @param {string} cwd
144
- * @returns {(name: string) => string}
157
+ * @returns {((name: string) => string) | null}
158
+ */
159
+ export function installCommandFor(cwd: string): ((name: string) => string) | null;
160
+ /**
161
+ * Whether `cwd` is inside a project whose package.json is not the project's,
162
+ * so advice points at the project's folder (see `installFolder`).
163
+ * @param {string} cwd
164
+ * @returns {boolean}
145
165
  */
146
- export function installCommandFor(cwd: string): (name: string) => string;
166
+ export function insideProjectElsewhere(cwd: string): boolean;
147
167
  export { resolveRecordedTheme } from "../theme/theme.mjs";
148
168
  export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
149
169
  export const SOURCE_EXTENSIONS: Set<string>;
@@ -10,8 +10,10 @@ 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,
@@ -19,16 +21,18 @@ import {
19
21
  } from '../../foundation/release/notices.mjs';
20
22
  import {
21
23
  coreVersionOf,
24
+ installPlaceOf,
22
25
  isGlobalCopy,
23
- projectRootOf,
24
26
  } from '../../foundation/release/choose.mjs';
25
27
  import {readReleaseFacts} from '../../foundation/release/project.mjs';
26
- import {detectPackageManager} from '../../foundation/env/package-manager.mjs';
27
28
  import {astryxCommandsOnSearchPath} from '../../foundation/env/search-path.mjs';
28
29
  import {readDeclaredDependencies} from '../../foundation/integrations/autolink.mjs';
29
30
  import {
31
+ computerSkillFile,
30
32
  displayHomePath,
31
33
  inspectComputerAgentText,
34
+ skillCommandOf,
35
+ skillInstallStepOf,
32
36
  } from '../../foundation/agent-docs/computer-agent-text.mjs';
33
37
  import {computerAgentTextSettings} from '../../foundation/env/user-settings.mjs';
34
38
  import * as fs from 'node:fs';
@@ -291,12 +295,29 @@ function declaredPackageNames(cwd) {
291
295
  }
292
296
 
293
297
  /**
294
- * The computer-level agent text's setting and its state on disk.
295
- * @returns {{settings: import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings, entries: Array<{path: string, state: import('../../foundation/agent-docs/computer-agent-text.mjs').ComputerAgentTextState, link?: true}>}}
298
+ * The computer-level agent text's setting, its state on disk, and the command
299
+ * the skill file tells agents to run and the install step it records for when
300
+ * that command is not found (each null when there is no file, or it names
301
+ * none).
302
+ * @returns {{settings: import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings, entries: Array<{path: string, state: import('../../foundation/agent-docs/computer-agent-text.mjs').ComputerAgentTextState, link?: true}>, command: string | null, install: string | null}}
296
303
  */
297
304
  export function computerAgentTextState() {
298
305
  const settings = computerAgentTextSettings();
299
- return {settings, entries: inspectComputerAgentText({links: settings.links})};
306
+ let command = null;
307
+ let install = null;
308
+ try {
309
+ const text = fs.readFileSync(computerSkillFile(), 'utf8');
310
+ command = skillCommandOf(text);
311
+ install = skillInstallStepOf(text);
312
+ } catch {
313
+ // No skill file, or one that cannot be read: no command to check.
314
+ }
315
+ return {
316
+ settings,
317
+ entries: inspectComputerAgentText({links: settings.links}),
318
+ command,
319
+ install,
320
+ };
300
321
  }
301
322
 
302
323
  export {displayHomePath};
@@ -309,7 +330,7 @@ export {displayHomePath};
309
330
  * command that upgrades it.
310
331
  * @param {string} cwd
311
332
  * @param {{project: boolean}} options
312
- * @returns {{answeredBy: {cli: string, core: string | null, copy: string}, latest: string | null, globalBehind: ReturnType<typeof globalBehind> | null, projectLag: ReturnType<typeof projectLag> | null, lastNoticeSkip: ReturnType<typeof lastNoticeSkip>, lastCheckFailure: ReturnType<typeof lastCheckFailure>, stateLock: ReturnType<typeof stateLockHolder>, searchPathCommands: Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade: string | null}>}}
333
+ * @returns {{answeredBy: {cli: string, core: string | null, copy: string}, latest: string | null, globalBehind: ReturnType<typeof globalBehind> | null, projectLag: ReturnType<typeof projectLag> | null, lastNoticeSkip: ReturnType<typeof lastNoticeSkip>, lastCheckFailure: ReturnType<typeof lastCheckFailure>, stateLock: ReturnType<typeof stateLockHolder>, searchPathCommands: Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade: string | null, runner: boolean}>}}
313
334
  */
314
335
  export function releaseFacts(cwd, {project}) {
315
336
  const answered = answeredBy(cwd);
@@ -336,6 +357,9 @@ export function releaseFacts(cwd, {project}) {
336
357
  searchPathCommands: astryxCommandsOnSearchPath().map(row => ({
337
358
  ...row,
338
359
  upgrade: row.cliRoot ? globalUpgradeCommand(row.cliRoot) : null,
360
+ // A package runner's temporary install, which it puts first on the
361
+ // search path only for the run it starts.
362
+ runner: row.cliRoot ? installPlaceOf(row.cliRoot).runner : false,
339
363
  })),
340
364
  };
341
365
  }
@@ -348,11 +372,12 @@ export function outsideProject(/** @type {string} */ cwd) {
348
372
  /**
349
373
  * The commands that bring a project's own CLI and Core to one release, with
350
374
  * 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.
375
+ * the CLI is newer; else the CLI to the Core's release. Null when no
376
+ * command fits (see `alignCliAndCore`).
352
377
  * @param {string} cwd
353
378
  * @param {string} cli
354
379
  * @param {string} core
355
- * @returns {string}
380
+ * @returns {string | null}
356
381
  */
357
382
  export function alignCommand(cwd, cli, core) {
358
383
  return alignCliAndCore({cwd, cli, core});
@@ -380,30 +405,35 @@ export function projectHasOwnCli(cwd) {
380
405
 
381
406
  /**
382
407
  * The command that adds the CLI at `version` with the project's package
383
- * manager.
408
+ * manager, and the Core it matches: from a folder whose package.json declares
409
+ * no Astryx package, in the Astryx project above at that project's Core; null
410
+ * when there is none (see `cliInstallAdvice`).
384
411
  * @param {string} cwd
385
412
  * @param {string} version
386
- * @returns {string}
413
+ * @returns {{command: string, core: string} | null}
387
414
  */
388
415
  export function addCliCommandFor(cwd, version) {
389
- return addCliCommand(projectRootOf(readReleaseFacts(cwd)) ?? cwd, version);
416
+ const advice = cliInstallAdvice({cwd, core: version});
417
+ return advice?.command ? {command: advice.command, core: advice.core} : null;
390
418
  }
391
419
 
392
420
  /**
393
- * The command that adds a package with the folder's package manager, read
394
- * from its lockfiles and `packageManager` field.
421
+ * The command that adds a package to the project of `cwd`; null in a folder
422
+ * that belongs to no project or whose package.json is not the project's (see
423
+ * `projectAddCommand`).
395
424
  * @param {string} cwd
396
- * @returns {(name: string) => string}
425
+ * @returns {((name: string) => string) | null}
397
426
  */
398
427
  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}`;
428
+ return projectAddCommand(cwd);
429
+ }
430
+
431
+ /**
432
+ * Whether `cwd` is inside a project whose package.json is not the project's,
433
+ * so advice points at the project's folder (see `installFolder`).
434
+ * @param {string} cwd
435
+ * @returns {boolean}
436
+ */
437
+ export function insideProjectElsewhere(cwd) {
438
+ return installFolder(cwd)?.moved === true;
409
439
  }
@@ -188,6 +188,10 @@ export function checkCliCommand(ctx: DoctorContext): DoctorCheck;
188
188
  * each file of the computer-level agent text against this release's rendering
189
189
  * @property {import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings} [agentTextSettings]
190
190
  * the person's choices about the computer-level agent text
191
+ * @property {string | null} [agentTextCommand] the command the skill file
192
+ * tells agents to run, or null
193
+ * @property {string | null} [agentTextInstall] the install step the skill
194
+ * file records for when that command is not found, or null
191
195
  * @property {string} [cwd] the folder doctor runs in, for the printed fix
192
196
  * @property {import('../../foundation/release/notices.mjs').GlobalBehind | null} [globalBehind]
193
197
  * the CLI installed for the computer, when it is older than the newest
@@ -200,7 +204,7 @@ export function checkCliCommand(ctx: DoctorContext): DoctorCheck;
200
204
  * the newest update notice that did not print, and why (diagnostic only)
201
205
  * @property {{pid: number | null, host: string | null, since: number} | null} [stateLock]
202
206
  * who holds the state file's lock now (diagnostic only)
203
- * @property {Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade?: string | null}>} [searchPathCommands]
207
+ * @property {Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade?: string | null, runner?: boolean}>} [searchPathCommands]
204
208
  * every `astryx` on the search path, with the command that upgrades it
205
209
  * the `astryx` commands on the search path, in order
206
210
  * @property {import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[]} [computerIntegrations]
@@ -259,15 +263,18 @@ export function checkComputerIntegrations(ctx: ComputerContext): DoctorCheck;
259
263
  * Inside a project, the integrations installed for the computer that the
260
264
  * project does not install: available, never used (spec AST-081 FR12).
261
265
  * Always info.
262
- * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: (name: string) => string}} input
266
+ * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: ((name: string) => string) | null, elsewhere?: boolean}} input
263
267
  * `install`: the command that adds a package with the project's package
264
- * manager (read by the adapter)
268
+ * manager (read by the adapter); null when the folder belongs to no
269
+ * project, or `elsewhere`: its package.json is not the project's, where the
270
+ * fix points at the project's folder
265
271
  * @returns {DoctorCheck}
266
272
  */
267
- export function checkComputerIntegrationsAvailable({ installed, candidates, install }: {
273
+ export function checkComputerIntegrationsAvailable({ installed, candidates, install, elsewhere }: {
268
274
  installed: Set<string>;
269
275
  candidates: import("../../foundation/integrations/computer-integrations.mjs").ComputerIntegrationCandidate[];
270
- install: (name: string) => string;
276
+ install: ((name: string) => string) | null;
277
+ elsewhere?: boolean;
271
278
  }): DoctorCheck;
272
279
  /**
273
280
  * Run all diagnostic checks and return a structured report.
@@ -443,6 +450,16 @@ export type ComputerContext = {
443
450
  * the person's choices about the computer-level agent text
444
451
  */
445
452
  agentTextSettings?: import("../../foundation/env/user-settings.mjs").ComputerAgentTextSettings | undefined;
453
+ /**
454
+ * the command the skill file
455
+ * tells agents to run, or null
456
+ */
457
+ agentTextCommand?: string | null | undefined;
458
+ /**
459
+ * the install step the skill
460
+ * file records for when that command is not found, or null
461
+ */
462
+ agentTextInstall?: string | null | undefined;
446
463
  /**
447
464
  * the folder doctor runs in, for the printed fix
448
465
  */
@@ -484,6 +501,7 @@ export type ComputerContext = {
484
501
  */
485
502
  searchPathCommands?: (import("../../foundation/env/search-path.mjs").SearchPathCommand & {
486
503
  upgrade?: string | null;
504
+ runner?: boolean;
487
505
  })[] | undefined;
488
506
  /**
489
507
  * the integrations installed beside the running CLI
@@ -65,8 +65,9 @@ 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 {COMPUTER_COMMAND, COMPUTER_INSTALL_STEP} from '../../foundation/agent-docs/computer-agent-text.mjs';
70
+ import {alignCommand, addCliCommandFor, computerAgentTextState, installCommandFor, insideProjectElsewhere, projectCoreVersion, projectHasOwnCli, computerIntegrationsOutside, computerIntegrationsToAdd, displayHomePath, outsideProject, releaseFacts} from './_adapter.mjs';
70
71
 
71
72
  /**
72
73
  * @typedef {'pass'|'warn'|'fail'|'info'} DoctorStatus
@@ -286,15 +287,25 @@ export function checkVersionAlignment(ctx) {
286
287
  // the run (spec AST-081 FR2): say so, and how to add the CLI at Core's
287
288
  // version.
288
289
  if (ctx.ownCli === false) {
290
+ // The same comparison as the daily hint: the CLI against the Core the
291
+ // run reads (spec AST-081 FR2). The command adds the CLI in the project
292
+ // spec:AST-040 FR9 defines; from a folder inside it whose package.json
293
+ // is not the project's, or in no project, the fix says how to reach one.
294
+ const add = addCliCommandFor(ctx.cwd, coreVersion);
295
+ const matches = coreVersion === cliVersion;
296
+ const fix = add
297
+ ? `${matches ? 'To pin it for the team and CI' : 'To match'}, run: ${add.command}.`
298
+ : matches
299
+ ? null
300
+ : NO_PROJECT_FIX;
289
301
  return {
290
302
  id: 'version-alignment',
291
303
  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)}.`,
304
+ status: matches ? 'info' : 'warn',
305
+ message: matches
306
+ ? `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered and matches its Core.`
307
+ : `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered while its Core is ${coreVersion}.`,
308
+ ...(fix ? {fix} : {}),
298
309
  };
299
310
  }
300
311
  // The project's own CLI answers this project whatever its version
@@ -308,10 +319,31 @@ export function checkVersionAlignment(ctx) {
308
319
  message: drift
309
320
  ? `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
321
  : `@astryxdesign/core v${coreVersion} is in step with @astryxdesign/cli v${cliVersion}.`,
311
- ...(drift ? {fix: `To align them, run: ${alignCommand(ctx.cwd, cliVersion, coreVersion)}.`} : {}),
322
+ ...(drift ? alignFix(ctx.cwd, cliVersion, coreVersion) : {}),
312
323
  };
313
324
  }
314
325
 
326
+ /**
327
+ * The fix for a CLI and Core on different releases, when a command fits.
328
+ * @param {string} cwd
329
+ * @param {string} cli
330
+ * @param {string} core
331
+ * @returns {{fix?: string}}
332
+ */
333
+ function alignFix(cwd, cli, core) {
334
+ // From a folder inside a project whose package.json is not the project's,
335
+ // aligning the project would leave this warning in place, so no command
336
+ // fits there (alignCommand returns none): point at the project instead.
337
+ const command = alignCommand(cwd, cli, core);
338
+ return {fix: command ? `To align them, run: ${command}.` : NO_PROJECT_FIX};
339
+ }
340
+
341
+ /**
342
+ * The fix where no install command fits: the folder's package.json is not an
343
+ * Astryx project's (spec AST-040 FR9), and adding there would make it one.
344
+ */
345
+ const NO_PROJECT_FIX = RUN_FROM_PROJECT;
346
+
315
347
  /**
316
348
  * Check 5 — astryx.config.mjs (if present) loads and has a valid shape.
317
349
  * @param {DoctorContext} ctx
@@ -1048,16 +1080,20 @@ function nameTypes(names) {
1048
1080
  }
1049
1081
 
1050
1082
  /**
1051
- * The section keys `astryx docs authoring --index` lists, read the way that
1052
- * command reads them.
1083
+ * The section keys the field reference lists (`astryx docs
1084
+ * authoring/field-reference --index`), read the way that command reads them.
1053
1085
  * @returns {Promise<{keys: Set<string>} | {keys: null, error: string}>}
1054
1086
  */
1055
1087
  async function authoringTopicKeys() {
1056
1088
  try {
1089
+ const {AUTHORING_REFERENCE_ROUTE} =
1090
+ await import('../../foundation/discovery/authoring-self-docs.mjs');
1057
1091
  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));
1092
+ const node = (await projectTree(catalog)).get(AUTHORING_REFERENCE_ROUTE);
1093
+ if (!node?.ref?.topicFile) {
1094
+ return {keys: null, error: 'the docs tree has no field reference'};
1095
+ }
1096
+ const index = indexView(await lowerTopic(catalog, guideEntry(node)));
1061
1097
  return {keys: new Set(index.sections.map(section => section.id))};
1062
1098
  } catch (err) {
1063
1099
  return {
@@ -1076,7 +1112,7 @@ function surfaceProblems(surface) {
1076
1112
  const problems = [];
1077
1113
  if (surface.types === 0 && surface.untraced.length === 0) {
1078
1114
  problems.push(
1079
- `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring')}\``,
1115
+ `@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring/field-reference')}\``,
1080
1116
  );
1081
1117
  }
1082
1118
  for (const {module, names, reason, source, key} of surface.unreadable) {
@@ -1089,7 +1125,7 @@ function surfaceProblems(surface) {
1089
1125
  ? `${source} does not load`
1090
1126
  : `${source} renders section "${key}", which the topic's index does not list`;
1091
1127
  problems.push(
1092
- `${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring')}\`: ${why}`,
1128
+ `${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring/field-reference')}\`: ${why}`,
1093
1129
  );
1094
1130
  }
1095
1131
  for (const {name, reason} of surface.untraced) {
@@ -1130,7 +1166,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1130
1166
  const audit = await auditAuthoringSelfDocs({root, sources});
1131
1167
  const problems = [
1132
1168
  ...audit.unreachable.map(
1133
- source => `${source} is not in \`${formatCliCommand('docs authoring')}\``,
1169
+ source => `${source} is not in \`${formatCliCommand('docs authoring/field-reference')}\``,
1134
1170
  ),
1135
1171
  ...audit.failed.map(
1136
1172
  ({source, error}) => `${source} failed to load: ${error}`,
@@ -1146,7 +1182,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1146
1182
  : {keys: options.topicKeys};
1147
1183
  const surface = [
1148
1184
  ...('error' in topic
1149
- ? [`\`${formatCliCommand('docs authoring')}\` could not be read: ${topic.error}`]
1185
+ ? [`\`${formatCliCommand('docs authoring/field-reference')}\` could not be read: ${topic.error}`]
1150
1186
  : []),
1151
1187
  ...surfaceProblems(
1152
1188
  await auditAuthoringSurface({root, sources, topicKeys: topic.keys}),
@@ -1170,7 +1206,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
1170
1206
  id,
1171
1207
  label,
1172
1208
  status: 'pass',
1173
- message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring')}\`.`,
1209
+ message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring/field-reference')}\`.`,
1174
1210
  };
1175
1211
  } catch (err) {
1176
1212
  return {
@@ -1238,7 +1274,7 @@ export async function checkCliDocs(_ctx, options = {}) {
1238
1274
  id,
1239
1275
  label,
1240
1276
  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')}\`.`,
1277
+ 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
1278
  };
1243
1279
  } catch (err) {
1244
1280
  return {
@@ -1355,7 +1391,7 @@ export async function checkDocsProgressiveDisclosure(ctx) {
1355
1391
  // A guide the docs tree places is a topic read by its route; it is held
1356
1392
  // to the same budget as every flat topic.
1357
1393
  const guides = [...(await projectTree(catalog)).nodes.values()]
1358
- // A flat topic in the Unorganized level is checked above, as a topic.
1394
+ // A flat topic in a topic level is checked above, as a topic.
1359
1395
  .filter(node => node.kind === 'generic' && !node.ref?.flatTopic)
1360
1396
  .map(guideEntry);
1361
1397
  for (const entry of [...catalog.entries(), ...guides]) {
@@ -1456,6 +1492,10 @@ export function checkCliCommand(ctx) {
1456
1492
  * each file of the computer-level agent text against this release's rendering
1457
1493
  * @property {import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings} [agentTextSettings]
1458
1494
  * the person's choices about the computer-level agent text
1495
+ * @property {string | null} [agentTextCommand] the command the skill file
1496
+ * tells agents to run, or null
1497
+ * @property {string | null} [agentTextInstall] the install step the skill
1498
+ * file records for when that command is not found, or null
1459
1499
  * @property {string} [cwd] the folder doctor runs in, for the printed fix
1460
1500
  * @property {import('../../foundation/release/notices.mjs').GlobalBehind | null} [globalBehind]
1461
1501
  * the CLI installed for the computer, when it is older than the newest
@@ -1468,7 +1508,7 @@ export function checkCliCommand(ctx) {
1468
1508
  * the newest update notice that did not print, and why (diagnostic only)
1469
1509
  * @property {{pid: number | null, host: string | null, since: number} | null} [stateLock]
1470
1510
  * who holds the state file's lock now (diagnostic only)
1471
- * @property {Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade?: string | null}>} [searchPathCommands]
1511
+ * @property {Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade?: string | null, runner?: boolean}>} [searchPathCommands]
1472
1512
  * every `astryx` on the search path, with the command that upgrades it
1473
1513
  * the `astryx` commands on the search path, in order
1474
1514
  * @property {import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[]} [computerIntegrations]
@@ -1555,6 +1595,7 @@ function checkFailureNote(failed) {
1555
1595
  const SKIP_REASONS = {
1556
1596
  'already-shown': 'it had already printed that day',
1557
1597
  'no-newer': 'no newer release was known',
1598
+ 'no-project': 'the folder belongs to no Astryx project, so no install command fits',
1558
1599
  };
1559
1600
 
1560
1601
  /**
@@ -1678,6 +1719,8 @@ export function checkComputerAgentText(ctx) {
1678
1719
  };
1679
1720
  }
1680
1721
  const entries = ctx.agentText ?? /** @type {NonNullable<typeof state>} */ (state).entries;
1722
+ const command = ctx.agentText ? (ctx.agentTextCommand ?? null) : /** @type {NonNullable<typeof state>} */ (state).command;
1723
+ const recorded = (ctx.agentText ? ctx.agentTextInstall : /** @type {NonNullable<typeof state>} */ (state).install) ?? null;
1681
1724
  const fix = `Run \`${formatCliCommand('astryx init --user', ctx.cwd)}\`.`;
1682
1725
  const [file, ...links] = entries;
1683
1726
  const home = (/** @type {{path: string}} */ e) => displayHomePath(e.path);
@@ -1706,9 +1749,29 @@ export function checkComputerAgentText(ctx) {
1706
1749
  };
1707
1750
  }
1708
1751
  const current = file.state === 'current';
1752
+ const status = `${current ? 'The computer-level agent text matches this release' : "The computer-level agent text differs from this release's"}: ${home(file)}.`;
1753
+ // The skill outlives the CLI it names when the home folder outlasts the
1754
+ // folder the CLI is installed in, as on a machine whose system folders
1755
+ // reset on restart. Reported only when no `astryx` command is on the search
1756
+ // path at all, apart from a package runner's own copy, which it puts first
1757
+ // only for the run it starts (the way back when the global CLI is gone).
1758
+ // Any other `astryx`, even one the scan cannot trace to the package, such
1759
+ // as the shim of Volta, asdf or mise, may well run the CLI, so doctor stays
1760
+ // quiet here and cli-on-path reports what it can; never a false "gone".
1761
+ // The reinstalled copy refreshes the text too.
1762
+ const rows = ctx.searchPathCommands;
1763
+ if (command === COMPUTER_COMMAND && rows && !rows.some(r => !r.runner)) {
1764
+ return {
1765
+ ...base,
1766
+ message: `${status} It tells agents to run \`${COMPUTER_COMMAND}\`, but no \`${COMPUTER_COMMAND}\` command is on the search path, so agents that read it find no CLI to run (as when a restart removes the CLI installed for the computer and keeps the home folder).${linkNote}`,
1767
+ fix: recorded
1768
+ ? `Run \`${recorded}\`, the step the skill names for when \`${COMPUTER_COMMAND}\` is not found.`
1769
+ : `Install it for the computer: \`${COMPUTER_INSTALL_STEP}\`.`,
1770
+ };
1771
+ }
1709
1772
  return {
1710
1773
  ...base,
1711
- message: `${current ? 'The computer-level agent text matches this release' : "The computer-level agent text differs from this release's"}: ${home(file)}.${linkNote}`,
1774
+ message: `${status}${linkNote}`,
1712
1775
  ...(!current || missing.length > 0 || dangling.length > 0 ? {fix} : {}),
1713
1776
  };
1714
1777
  }
@@ -1760,12 +1823,14 @@ export function checkComputerIntegrations(ctx) {
1760
1823
  * Inside a project, the integrations installed for the computer that the
1761
1824
  * project does not install: available, never used (spec AST-081 FR12).
1762
1825
  * Always info.
1763
- * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: (name: string) => string}} input
1826
+ * @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: ((name: string) => string) | null, elsewhere?: boolean}} input
1764
1827
  * `install`: the command that adds a package with the project's package
1765
- * manager (read by the adapter)
1828
+ * manager (read by the adapter); null when the folder belongs to no
1829
+ * project, or `elsewhere`: its package.json is not the project's, where the
1830
+ * fix points at the project's folder
1766
1831
  * @returns {DoctorCheck}
1767
1832
  */
1768
- export function checkComputerIntegrationsAvailable({installed, candidates, install}) {
1833
+ export function checkComputerIntegrationsAvailable({installed, candidates, install, elsewhere = false}) {
1769
1834
  const available = candidates.filter(c => !installed.has(c.name));
1770
1835
  const base = {id: 'computer-integrations', label: 'Integrations installed for this computer', status: /** @type {const} */ ('info')};
1771
1836
  if (available.length === 0) {
@@ -1775,7 +1840,11 @@ export function checkComputerIntegrationsAvailable({installed, candidates, insta
1775
1840
  return {
1776
1841
  ...base,
1777
1842
  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 ')}.`,
1843
+ ...(add
1844
+ ? {fix: `To use one in this project, run ${available.map(c => `\`${add(c.name)}\``).join(' or ')}.`}
1845
+ : elsewhere
1846
+ ? {fix: NO_PROJECT_FIX}
1847
+ : {}),
1779
1848
  };
1780
1849
  }
1781
1850
 
@@ -2034,7 +2103,7 @@ export async function runChecks(options = {}) {
2034
2103
  {
2035
2104
  const loadedNames = (project?.loadedIntegrations ?? []).map((/** @type {{name: string}} */ i) => i.name);
2036
2105
  const candidates = await computerIntegrationsToAdd(cwd, loadedNames);
2037
- checks.push(checkComputerIntegrationsAvailable({installed: new Set(loadedNames), candidates, install: installCommandFor(cwd)}));
2106
+ checks.push(checkComputerIntegrationsAvailable({installed: new Set(loadedNames), candidates, install: installCommandFor(cwd), elsewhere: insideProjectElsewhere(cwd)}));
2038
2107
  }
2039
2108
  checks.push(await checkAuthoringDocs(ctx));
2040
2109
  checks.push(await checkCliDocs(ctx));