@bevel-software/platform-core-backend 0.25.2 → 0.26.0

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 (248) hide show
  1. package/agent-guide/access-control.md +234 -0
  2. package/agent-guide/conventions.md +27 -0
  3. package/agent-guide/directory-structure.md +145 -0
  4. package/agent-guide/finding-things.md +7 -0
  5. package/agent-guide/introduction.md +27 -0
  6. package/agent-guide/skills.md +47 -0
  7. package/agent-guide/tool-manuals.md +217 -0
  8. package/agent-guide/where-a-new-file-goes.md +36 -0
  9. package/dist/assets.d.ts +7 -0
  10. package/dist/assets.d.ts.map +1 -1
  11. package/dist/assets.js +9 -0
  12. package/dist/assets.js.map +1 -1
  13. package/dist/core/core-ports.d.ts +11 -0
  14. package/dist/core/core-ports.d.ts.map +1 -1
  15. package/dist/core/core-ports.js.map +1 -1
  16. package/dist/core/create-core-server.d.ts.map +1 -1
  17. package/dist/core/create-core-server.js +13 -2
  18. package/dist/core/create-core-server.js.map +1 -1
  19. package/dist/core/create-core-services.d.ts +9 -0
  20. package/dist/core/create-core-services.d.ts.map +1 -1
  21. package/dist/core/create-core-services.js +14 -4
  22. package/dist/core/create-core-services.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/index.js.map +1 -1
  27. package/dist/modules/access/access-control.interface.d.ts +9 -0
  28. package/dist/modules/access/access-control.interface.d.ts.map +1 -1
  29. package/dist/modules/access/access-control.service.d.ts +1 -0
  30. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  31. package/dist/modules/access/access-control.service.js +16 -0
  32. package/dist/modules/access/access-control.service.js.map +1 -1
  33. package/dist/modules/agent-guide/agent-guide.d.ts +139 -0
  34. package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -0
  35. package/dist/modules/agent-guide/agent-guide.js +191 -0
  36. package/dist/modules/agent-guide/agent-guide.js.map +1 -0
  37. package/dist/modules/agent-guide/agent-guide.tools.d.ts +24 -0
  38. package/dist/modules/agent-guide/agent-guide.tools.d.ts.map +1 -0
  39. package/dist/modules/agent-guide/agent-guide.tools.js +100 -0
  40. package/dist/modules/agent-guide/agent-guide.tools.js.map +1 -0
  41. package/dist/modules/agent-guide/index.d.ts +4 -0
  42. package/dist/modules/agent-guide/index.d.ts.map +1 -0
  43. package/dist/modules/agent-guide/index.js +4 -0
  44. package/dist/modules/agent-guide/index.js.map +1 -0
  45. package/dist/modules/agent-instructions/agent-instructions.routes.d.ts +3 -2
  46. package/dist/modules/agent-instructions/agent-instructions.routes.d.ts.map +1 -1
  47. package/dist/modules/agent-instructions/agent-instructions.routes.js +3 -2
  48. package/dist/modules/agent-instructions/agent-instructions.routes.js.map +1 -1
  49. package/dist/modules/agent-instructions/compose.d.ts +9 -6
  50. package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
  51. package/dist/modules/agent-instructions/compose.js +9 -6
  52. package/dist/modules/agent-instructions/compose.js.map +1 -1
  53. package/dist/modules/agent-instructions/index.d.ts +1 -1
  54. package/dist/modules/agent-instructions/index.d.ts.map +1 -1
  55. package/dist/modules/agent-instructions/index.js +1 -1
  56. package/dist/modules/agent-instructions/index.js.map +1 -1
  57. package/dist/modules/agent-instructions/shared-file-rules.d.ts +10 -50
  58. package/dist/modules/agent-instructions/shared-file-rules.d.ts.map +1 -1
  59. package/dist/modules/agent-instructions/shared-file-rules.js +32 -85
  60. package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
  61. package/dist/modules/mcp/mcp.service.d.ts +29 -2
  62. package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
  63. package/dist/modules/mcp/mcp.service.js +113 -16
  64. package/dist/modules/mcp/mcp.service.js.map +1 -1
  65. package/dist/modules/mcp/tool-schema-guard.d.ts +105 -0
  66. package/dist/modules/mcp/tool-schema-guard.d.ts.map +1 -0
  67. package/dist/modules/mcp/tool-schema-guard.js +171 -0
  68. package/dist/modules/mcp/tool-schema-guard.js.map +1 -0
  69. package/dist/modules/plugins/plugins.tools.d.ts +36 -2
  70. package/dist/modules/plugins/plugins.tools.d.ts.map +1 -1
  71. package/dist/modules/plugins/plugins.tools.js +71 -14
  72. package/dist/modules/plugins/plugins.tools.js.map +1 -1
  73. package/dist/modules/settings/deployment-settings.service.d.ts +0 -7
  74. package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
  75. package/dist/modules/settings/deployment-settings.service.js +14 -53
  76. package/dist/modules/settings/deployment-settings.service.js.map +1 -1
  77. package/dist/modules/settings/setup.routes.d.ts.map +1 -1
  78. package/dist/modules/settings/setup.routes.js +3 -6
  79. package/dist/modules/settings/setup.routes.js.map +1 -1
  80. package/dist/modules/skills/skills.tools.d.ts.map +1 -1
  81. package/dist/modules/skills/skills.tools.js +58 -16
  82. package/dist/modules/skills/skills.tools.js.map +1 -1
  83. package/dist/modules/tool-manuals/tool-manuals.contract.d.ts +23 -4
  84. package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -1
  85. package/dist/modules/tool-manuals/tool-manuals.contract.js.map +1 -1
  86. package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -0
  87. package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
  88. package/dist/modules/tool-manuals/tool-manuals.service.js +14 -0
  89. package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
  90. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +7 -0
  91. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
  92. package/dist/modules/tool-manuals/tool-manuals.tools.js +66 -36
  93. package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
  94. package/dist/modules/tool-registry/description-length.d.ts +14 -14
  95. package/dist/modules/tool-registry/description-length.d.ts.map +1 -1
  96. package/dist/modules/tool-registry/description-length.js +24 -26
  97. package/dist/modules/tool-registry/description-length.js.map +1 -1
  98. package/dist/modules/tool-registry/guide-first.d.ts +23 -0
  99. package/dist/modules/tool-registry/guide-first.d.ts.map +1 -0
  100. package/dist/modules/tool-registry/guide-first.js +32 -0
  101. package/dist/modules/tool-registry/guide-first.js.map +1 -0
  102. package/dist/modules/tool-registry/tool-registry.d.ts +6 -0
  103. package/dist/modules/tool-registry/tool-registry.d.ts.map +1 -1
  104. package/dist/modules/tool-registry/tool-registry.js +9 -2
  105. package/dist/modules/tool-registry/tool-registry.js.map +1 -1
  106. package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts +449 -0
  107. package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts.map +1 -0
  108. package/dist/modules/workflow/agent-tools/change-request-read-shape.js +481 -0
  109. package/dist/modules/workflow/agent-tools/change-request-read-shape.js.map +1 -0
  110. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts +73 -0
  111. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +1 -0
  112. package/dist/modules/workflow/agent-tools/change-request-read.tools.js +582 -0
  113. package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +1 -0
  114. package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +12 -1
  115. package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -1
  116. package/dist/modules/workflow/agent-tools/change-request-summary.js +5 -1
  117. package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -1
  118. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
  119. package/dist/modules/workflow/agent-tools/workflow.tools.js +9 -0
  120. package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
  121. package/dist/modules/workflow/git/git.service.d.ts +210 -13
  122. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  123. package/dist/modules/workflow/git/git.service.js +456 -91
  124. package/dist/modules/workflow/git/git.service.js.map +1 -1
  125. package/dist/modules/workflow/git/merge-commit.d.ts +73 -0
  126. package/dist/modules/workflow/git/merge-commit.d.ts.map +1 -0
  127. package/dist/modules/workflow/git/merge-commit.js +89 -0
  128. package/dist/modules/workflow/git/merge-commit.js.map +1 -0
  129. package/dist/modules/workflow/git/pull-request.service.d.ts +94 -1
  130. package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
  131. package/dist/modules/workflow/git/pull-request.service.js +332 -37
  132. package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
  133. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts +35 -0
  134. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
  135. package/dist/modules/workflow/review-workflow/review-workflow.service.js +178 -12
  136. package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
  137. package/dist/modules/workflow/workflow.routes.d.ts +6 -2
  138. package/dist/modules/workflow/workflow.routes.d.ts.map +1 -1
  139. package/dist/modules/workflow/workflow.routes.js +7 -2
  140. package/dist/modules/workflow/workflow.routes.js.map +1 -1
  141. package/dist/modules/workflow/workflow.service.d.ts +4 -0
  142. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  143. package/dist/modules/workflow/workflow.service.js +3 -0
  144. package/dist/modules/workflow/workflow.service.js.map +1 -1
  145. package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
  146. package/dist/modules/workspace/startup/steps/seed-tree.js +22 -27
  147. package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
  148. package/dist/modules/workspace/startup/steps/template-files.step.d.ts +58 -52
  149. package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
  150. package/dist/modules/workspace/startup/steps/template-files.step.js +209 -223
  151. package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
  152. package/dist/modules/workspace/startup/steps/template-source.d.ts +5 -3
  153. package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
  154. package/dist/modules/workspace/startup/steps/template-source.js +5 -3
  155. package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
  156. package/dist/modules/workspace/workspace.tools.d.ts +10 -1
  157. package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
  158. package/dist/modules/workspace/workspace.tools.js +211 -18
  159. package/dist/modules/workspace/workspace.tools.js.map +1 -1
  160. package/dist/shared/domain-errors.d.ts +11 -0
  161. package/dist/shared/domain-errors.d.ts.map +1 -1
  162. package/dist/shared/domain-errors.js +14 -0
  163. package/dist/shared/domain-errors.js.map +1 -1
  164. package/dist/shared/hidden-tools.d.ts +44 -0
  165. package/dist/shared/hidden-tools.d.ts.map +1 -0
  166. package/dist/shared/hidden-tools.js +13 -0
  167. package/dist/shared/hidden-tools.js.map +1 -0
  168. package/kb-template/.bevelignore +0 -5
  169. package/package.json +4 -3
  170. package/src/__tests__/kb-layout-config.test.ts +10 -100
  171. package/src/__tests__/packaged-assets-ship.test.ts +54 -0
  172. package/src/assets.ts +10 -0
  173. package/src/core/core-ports.ts +11 -0
  174. package/src/core/create-core-server.ts +13 -2
  175. package/src/core/create-core-services.ts +28 -4
  176. package/src/index.ts +2 -2
  177. package/src/modules/access/__tests__/access-control.atref-batch.test.ts +58 -0
  178. package/src/modules/access/__tests__/access-control.platform-restore.test.ts +8 -7
  179. package/src/modules/access/__tests__/access-personal-plugin.test.ts +1 -18
  180. package/src/modules/access/access-control.interface.ts +15 -0
  181. package/src/modules/access/access-control.service.ts +21 -0
  182. package/src/modules/agent-guide/__tests__/agent-guide.test.ts +328 -0
  183. package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +189 -0
  184. package/src/modules/agent-guide/agent-guide.tools.ts +122 -0
  185. package/src/modules/agent-guide/agent-guide.ts +291 -0
  186. package/src/modules/agent-guide/index.ts +21 -0
  187. package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +28 -121
  188. package/src/modules/agent-instructions/agent-instructions.routes.ts +3 -2
  189. package/src/modules/agent-instructions/compose.ts +9 -6
  190. package/src/modules/agent-instructions/index.ts +0 -3
  191. package/src/modules/agent-instructions/shared-file-rules.ts +31 -93
  192. package/src/modules/mcp/__tests__/fake-downstream-mcp-server.ts +14 -3
  193. package/src/modules/mcp/__tests__/mcp.e2e.test.ts +250 -0
  194. package/src/modules/mcp/__tests__/mcp.service.test.ts +31 -23
  195. package/src/modules/mcp/__tests__/tool-schema-guard.test.ts +266 -0
  196. package/src/modules/mcp/mcp.service.ts +137 -19
  197. package/src/modules/mcp/tool-schema-guard.ts +196 -0
  198. package/src/modules/plugins/__tests__/plugins.tools.test.ts +154 -4
  199. package/src/modules/plugins/plugins.tools.ts +75 -15
  200. package/src/modules/settings/__tests__/deployment-settings.service.test.ts +26 -55
  201. package/src/modules/settings/deployment-settings.service.ts +13 -54
  202. package/src/modules/settings/setup.routes.ts +3 -6
  203. package/src/modules/skills/__tests__/skills.tools.description.test.ts +91 -0
  204. package/src/modules/skills/skills.tools.ts +62 -16
  205. package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +57 -0
  206. package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +73 -4
  207. package/src/modules/tool-manuals/tool-manuals.contract.ts +24 -4
  208. package/src/modules/tool-manuals/tool-manuals.service.ts +17 -0
  209. package/src/modules/tool-manuals/tool-manuals.tools.ts +74 -36
  210. package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +160 -0
  211. package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +61 -59
  212. package/src/modules/tool-registry/description-length.ts +24 -26
  213. package/src/modules/tool-registry/guide-first.ts +34 -0
  214. package/src/modules/tool-registry/tool-registry.ts +9 -2
  215. package/src/modules/workflow/__tests__/apply-failure.test.ts +6 -1
  216. package/src/modules/workflow/agent-tools/__tests__/change-request-read-shape.test.ts +705 -0
  217. package/src/modules/workflow/agent-tools/__tests__/change-request-read.tools.test.ts +1518 -0
  218. package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +23 -2
  219. package/src/modules/workflow/agent-tools/change-request-read-shape.ts +712 -0
  220. package/src/modules/workflow/agent-tools/change-request-read.tools.ts +724 -0
  221. package/src/modules/workflow/agent-tools/change-request-summary.ts +5 -1
  222. package/src/modules/workflow/agent-tools/workflow.tools.ts +8 -0
  223. package/src/modules/workflow/git/__tests__/git.service.appliedChange.test.ts +285 -0
  224. package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +124 -0
  225. package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +334 -0
  226. package/src/modules/workflow/git/__tests__/pull-request.service.list-fetch.test.ts +72 -2
  227. package/src/modules/workflow/git/__tests__/pull-request.service.placeholder.test.ts +24 -2
  228. package/src/modules/workflow/git/__tests__/pull-request.service.test.ts +620 -1
  229. package/src/modules/workflow/git/git.service.ts +537 -94
  230. package/src/modules/workflow/git/merge-commit.ts +88 -0
  231. package/src/modules/workflow/git/pull-request.service.ts +380 -54
  232. package/src/modules/workflow/review-workflow/__tests__/approval-states.test.ts +7 -1
  233. package/src/modules/workflow/review-workflow/__tests__/merge-records-own-commit.test.ts +407 -0
  234. package/src/modules/workflow/review-workflow/review-workflow.service.ts +189 -11
  235. package/src/modules/workflow/workflow.routes.ts +7 -2
  236. package/src/modules/workflow/workflow.service.ts +7 -0
  237. package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +4 -3
  238. package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +21 -10
  239. package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +33 -55
  240. package/src/modules/workspace/__tests__/workspace.tools.test.ts +255 -22
  241. package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +191 -489
  242. package/src/modules/workspace/startup/steps/seed-tree.ts +21 -27
  243. package/src/modules/workspace/startup/steps/template-files.step.ts +217 -249
  244. package/src/modules/workspace/startup/steps/template-source.ts +5 -3
  245. package/src/modules/workspace/workspace.tools.ts +226 -16
  246. package/src/shared/domain-errors.ts +15 -0
  247. package/src/shared/hidden-tools.ts +45 -0
  248. package/kb-template/AGENTS.md +0 -730
@@ -1,7 +1,9 @@
1
1
  import { type KbLayout } from '@bevel-software/platform-shared';
2
2
  import { type IFsProbe } from '../../../../shared/fs.contract.js';
3
3
  import type { KbContext } from '../../../../shared/kb-context.js';
4
+ import { isManagedGuide } from '../../../agent-guide/agent-guide.js';
4
5
  import type { OnServerStart, ServerStartContext, StepResult } from '../on-server-start.js';
6
+ export { isManagedGuide };
5
7
  /**
6
8
  * The **required scaffolding** — the minimum an operational KB needs. Any of
7
9
  * these missing from a protected branch are added at the startup phase; the
@@ -17,11 +19,11 @@ import type { OnServerStart, ServerStartContext, StepResult } from '../on-server
17
19
  *
18
20
  * `roles.yaml` is in neither, and is not part of the template at all: it is
19
21
  * generated from `ADMIN_EMAIL` (see roles-yaml.step.ts), so a repo can't be
20
- * seeded with a stale hard-coded Admin list.
22
+ * seeded with a stale hard-coded Admin list. The agent guide is in neither
23
+ * either, any more: it is served from code (see modules/agent-guide), and the
24
+ * copies earlier releases wrote are REMOVED here, not refreshed.
21
25
  */
22
- export declare function requiredFiles(layout: Required<KbLayout>): readonly string[];
23
- /** Whether `text` is a copy of the platform's managed guide, of any vintage. */
24
- export declare function isManagedGuide(text: string): boolean;
26
+ export declare function requiredFiles(_layout: Required<KbLayout>): readonly string[];
25
27
  /**
26
28
  * Repo-root files the startup phase GENERATES rather than copies — today just
27
29
  * `roles.yaml`, rendered from `ADMIN_EMAIL` (see roles-yaml.step.ts and
@@ -42,13 +44,16 @@ export declare const GENERATED_FILES: readonly string[];
42
44
  export declare function reservedRootDirs(extraRootDirs: readonly string[], layout: Required<KbLayout>): readonly string[];
43
45
  /**
44
46
  * The template top-up as an {@link OnServerStart} step: add any missing base
45
- * scaffolding to every PROTECTED branch, and keep the managed agent guide
46
- * current — under whatever this deployment calls it, and taking its own
47
- * stale `AGENTS.md` with it when that name was handed back to the customer. Drafts are deliberately out of scope — whatever the protected
48
- * branches gain, drafts fork from; a scaffolding addition on a draft would
49
- * surface as noise in its change request's diff. (Unlike the Groups→Plugins
50
- * rename, a missing file diffs as one file, not the whole tree — so the
51
- * uniform-application argument does not bite here.)
47
+ * scaffolding to every PROTECTED branch, and take the agent guide copies
48
+ * earlier releases wrote OUT of them — the guide is served from code now, and
49
+ * a copy left on disk would be read as the organisation's own conventions
50
+ * file, stale and under a header that says the platform owns it. Drafts are
51
+ * deliberately out of scope — whatever the protected branches gain, drafts
52
+ * fork from; a scaffolding addition on a draft would surface as noise in its
53
+ * change request's diff. (Unlike the Groups→Plugins rename, a missing file
54
+ * diffs as one file, not the whole tree — so the uniform-application argument
55
+ * does not bite here. A stale guide copy on a draft is recognised by its
56
+ * header and never served, see `modules/agent-guide`.)
52
57
  *
53
58
  * Everything is DECLARED on the branch handle; reads go against the pre-step
54
59
  * tree via `repoDir()`. Fail-open behavior from the lazy top-up (best-effort,
@@ -65,7 +70,6 @@ export declare class TemplateFilesStep implements OnServerStart {
65
70
  */
66
71
  private readonly kb;
67
72
  private readonly extraRootDirs;
68
- private readonly agentsFileLink;
69
73
  readonly name = "template-files";
70
74
  /**
71
75
  * @param extraRootDirs Additional root folders this distribution reserves,
@@ -74,45 +78,39 @@ export declare class TemplateFilesStep implements OnServerStart {
74
78
  * claim a root without also shipping a template entry
75
79
  * for it.
76
80
  */
77
- /**
78
- * @param agentsFileLink Whether to keep the platform's pointer sentence in a
79
- * customer-owned root `AGENTS.md` — a GETTER, because
80
- * the setting behind it may be saved by the very
81
- * first-run save that then runs this phase.
82
- */
83
81
  constructor(disk: IFsProbe,
84
82
  /**
85
83
  * Read per run, never captured: the save that completes first-run setup
86
84
  * applies the admin's names after this step was built. A snapshot taken
87
85
  * here scaffolded `Skills/` beside the `skills/` they had just chosen.
88
86
  */
89
- kb: Pick<KbContext, 'layout'>, extraRootDirs?: readonly string[], agentsFileLink?: () => boolean);
87
+ kb: Pick<KbContext, 'layout'>, extraRootDirs?: readonly string[]);
90
88
  run(ctx: ServerStartContext): Promise<StepResult>;
91
89
  private topUp;
92
90
  /**
93
- * The root `AGENTS.md` on a deployment whose guide is called something else:
94
- * removed when the platform can PROVE it wrote it, otherwise left alone —
95
- * and, while the admin keeps the link setting on, given the one sentence
96
- * that points at the guide beside it.
97
- *
98
- * Removal is gated on the managed header and nothing else. An admin who
99
- * renames the guide on a knowledge base the platform seeded would otherwise
100
- * be left with stale platform content sitting under the very name they
101
- * wanted for their own file; an admin who renames it on a repository whose
102
- * `AGENTS.md` is their own must find that file byte-for-byte untouched. The
103
- * header is the one fact that tells the two apart, so it is the one thing
104
- * asked.
91
+ * The copies of the guide the platform wrote to the repository root while
92
+ * the guide was a file — under `AGENTS.md`, under `CLAUDE.md` from before
93
+ * the rename, and under every name a deployment ever gave the guide —
94
+ * removed when the platform can PROVE it wrote them, and otherwise left
95
+ * exactly alone.
105
96
  *
106
- * The pointer is bounded by three conditions, all of them the customer's to
107
- * control: the admin keeps the setting on, the file exists (one is NEVER
108
- * created for this), and the guide's name appears nowhere in the text. That
109
- * last one is a plain content search on purpose — a mention in the
110
- * customer's own words, a link, a heading, all count, and the platform stays
111
- * out of a file it does not own.
97
+ * Found by SCANNING the root's markdown files rather than by the names the
98
+ * deployment knows today: a deployment that renamed the guide more than
99
+ * once left a copy under each earlier name, and the current setting
100
+ * remembers only the last. The header is what makes a scan safe, and the
101
+ * one fact that tells a copy of ours from a file of theirs: the
102
+ * organisation's own `AGENTS.md`, a `CLAUDE.md` its people edited, a note
103
+ * of theirs that happens to sit at the root, must all be found byte for
104
+ * byte untouched. A SYMLINK or a directory is left as it is: reading a link
105
+ * follows it, so a link pointing at a copy of the guide — or at any other
106
+ * file carrying the header — would read as ours and the removal would take
107
+ * the organisation's entry. Links are never followed anywhere else in the
108
+ * platform, and they are not followed here.
112
109
  *
113
- * Returns the paths changed, for the note.
110
+ * Returns the names removed, in name order, for the note and for the
111
+ * ignore rules that hid them.
114
112
  */
115
- private reconcileLegacyGuide;
113
+ private retireGuideCopies;
116
114
  /**
117
115
  * Which reserved roots are absent — and which are SQUATTED. `lstat`, not
118
116
  * `exists`: `fs.access` answers "is there something here?", which is true of
@@ -167,23 +165,31 @@ export declare class TemplateFilesStep implements OnServerStart {
167
165
  * branches this step never visits (drafts).
168
166
  */
169
167
  export declare function withoutIgnoreLine(text: string, pattern: string): string;
168
+ /**
169
+ * `text` without the rules THE PLATFORM WROTE to hide the guide while it was a
170
+ * file. Under WHATEVER name: every rule sitting directly under one of the two
171
+ * comments the platform wrote above the guide's rule
172
+ * ({@link withoutPlatformConventionsRules}) — the name a deployment saved for
173
+ * the guide is not read any more, so the rule for it is known by its comment
174
+ * and by nothing else. Then the two names the template itself shipped a rule
175
+ * for, under each of `names`: the `AGENTS.md` line in the slot at the end of
176
+ * the template's own repo-hygiene block
177
+ * ({@link TEMPLATE_HYGIENE_BLOCK_ABOVE_AGENTS_RULE}) and the `CLAUDE.md` line
178
+ * under the two-line comment the template carried it with. Each goes with
179
+ * its comment.
180
+ *
181
+ * The guide is not on disk any more, which is what makes every one of these
182
+ * lines wrong: it hides a file the platform never writes, which is therefore
183
+ * the organisation's own. A `!AGENTS.md` negation is not the rule and stays,
184
+ * as everywhere else here, and so does a bare rule an operator wrote by hand.
185
+ */
186
+ export declare function withoutPlatformGuideRules(text: string, names: readonly string[]): string;
170
187
  /**
171
188
  * `text` without the `AGENTS.md` line THE PLATFORM WROTE — under its own
172
189
  * comment (either spelling), or in the slot at the end of the template's own
173
190
  * repo-hygiene block ({@link TEMPLATE_HYGIENE_BLOCK_ABOVE_AGENTS_RULE}) — and
174
- * without that comment.
175
- *
176
- * Called only when the guide has been renamed, which is what makes the line
177
- * wrong: it hides a file the platform no longer owns. A `!AGENTS.md` negation
178
- * is not the rule and stays, as everywhere else here.
191
+ * without that comment. A `!AGENTS.md` negation is not the rule and stays, as
192
+ * everywhere else here.
179
193
  */
180
194
  export declare function withoutPlatformAgentsRule(text: string): string;
181
- /**
182
- * `text` with the platform's pointer sentence appended as its own paragraph.
183
- *
184
- * One blank line between the customer's last line and ours, whether or not
185
- * their file ended in a newline: a sentence glued onto the end of their last
186
- * paragraph would read as a continuation of something they wrote.
187
- */
188
- export declare function withPointerSentence(text: string, agentsFile: string): string;
189
195
  //# sourceMappingURL=template-files.step.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template-files.step.d.ts","sourceRoot":"","sources":["../../../../../src/modules/workspace/startup/steps/template-files.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,KAAK,EAAY,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMrG;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,MAAM,EAAE,CAgB3E;AAwBD,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAmB,CAAC;AA8CjE;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,MAAM,EAAE,CAchH;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IAiBnD,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAxBjC,QAAQ,CAAC,IAAI,oBAAoB;IAEjC;;;;;;OAMG;IACH;;;;;OAKG;gBAEgB,IAAI,EAAE,QAAQ;IAC/B;;;;OAIG;IACc,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAC7B,aAAa,GAAE,SAAS,MAAM,EAAO,EACrC,cAAc,GAAE,MAAM,OAAoB;IAOvD,GAAG,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;YAOzC,KAAK;IAgKnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;YACW,oBAAoB;IAoElC;;;;;;;;;;OAUG;YACW,WAAW;IAiBzB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;;;;;;;;;;;;;;OAeG;YACW,oBAAoB;CA0CnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAcvE;AAwCD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwB9D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAG5E"}
1
+ {"version":3,"file":"template-files.step.d.ts","sourceRoot":"","sources":["../../../../../src/modules/workspace/startup/steps/template-files.step.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,KAAK,EAAY,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGrG,OAAO,EAAE,cAAc,EAAE,CAAC;AAY1B;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,MAAM,EAAE,CAW5E;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAmB,CAAC;AA8CjE;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,SAAS,MAAM,EAAE,CAchH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IAWnD,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAjBhC,QAAQ,CAAC,IAAI,oBAAoB;IAEjC;;;;;;OAMG;gBAEgB,IAAI,EAAE,QAAQ;IAC/B;;;;OAIG;IACc,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAC7B,aAAa,GAAE,SAAS,MAAM,EAAO;IAOlD,GAAG,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;YAOzC,KAAK;IAqInB;;;;;;;;;;;;;;;;;;;;;;OAsBG;YACW,iBAAiB;IAyB/B;;;;;;;;;;OAUG;YACW,WAAW;IAiBzB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;;;;;;;;;;;;;;OAeG;YACW,oBAAoB;CAuCnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAcvE;AAwCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAOxF;AAiED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwB9D"}