@owlmeans/viable-common 0.0.43 → 0.0.44

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 (322) hide show
  1. package/README.md +3 -3
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/agent-presentation/SKILL.md +1 -1
  4. package/agent-meta/skills/viable-common/SKILL.md +22 -11
  5. package/build/agent/consts.d.ts +58 -0
  6. package/build/agent/consts.d.ts.map +1 -0
  7. package/build/agent/consts.js +63 -0
  8. package/build/agent/consts.js.map +1 -0
  9. package/build/agent/consts.local.d.ts +21 -0
  10. package/build/agent/consts.local.d.ts.map +1 -0
  11. package/build/agent/consts.local.js +44 -0
  12. package/build/agent/consts.local.js.map +1 -0
  13. package/build/agent/index.d.ts +1 -0
  14. package/build/agent/index.d.ts.map +1 -1
  15. package/build/agent/index.js +1 -0
  16. package/build/agent/index.js.map +1 -1
  17. package/build/agent/presentation.d.ts +2 -86
  18. package/build/agent/presentation.d.ts.map +1 -1
  19. package/build/agent/presentation.js +2 -104
  20. package/build/agent/presentation.js.map +1 -1
  21. package/build/agent/types.d.ts +30 -0
  22. package/build/agent/types.d.ts.map +1 -1
  23. package/build/agent/types.local.d.ts +2 -0
  24. package/build/agent/types.local.d.ts.map +1 -0
  25. package/build/agent/types.local.js +2 -0
  26. package/build/agent/types.local.js.map +1 -0
  27. package/build/areas/consts.d.ts +5 -0
  28. package/build/areas/consts.d.ts.map +1 -1
  29. package/build/areas/consts.js +4 -0
  30. package/build/areas/consts.js.map +1 -1
  31. package/build/areas/tenancy.d.ts +1 -36
  32. package/build/areas/tenancy.d.ts.map +1 -1
  33. package/build/areas/tenancy.js +1 -5
  34. package/build/areas/tenancy.js.map +1 -1
  35. package/build/areas/types.d.ts +32 -0
  36. package/build/areas/types.d.ts.map +1 -1
  37. package/build/ba/types.d.ts +1 -1
  38. package/build/ba/types.d.ts.map +1 -1
  39. package/build/blueprint/consts.d.ts +41 -0
  40. package/build/blueprint/consts.d.ts.map +1 -1
  41. package/build/blueprint/consts.js +51 -0
  42. package/build/blueprint/consts.js.map +1 -1
  43. package/build/blueprint/consts.local.d.ts +2 -0
  44. package/build/blueprint/consts.local.d.ts.map +1 -0
  45. package/build/blueprint/consts.local.js +3 -0
  46. package/build/blueprint/consts.local.js.map +1 -0
  47. package/build/blueprint/index.d.ts +1 -0
  48. package/build/blueprint/index.d.ts.map +1 -1
  49. package/build/blueprint/index.js +1 -0
  50. package/build/blueprint/index.js.map +1 -1
  51. package/build/blueprint/types.d.ts +2 -50
  52. package/build/blueprint/types.d.ts.map +1 -1
  53. package/build/blueprint/types.js +1 -65
  54. package/build/blueprint/types.js.map +1 -1
  55. package/build/blueprint/utils.d.ts +11 -0
  56. package/build/blueprint/utils.d.ts.map +1 -0
  57. package/build/blueprint/utils.js +16 -0
  58. package/build/blueprint/utils.js.map +1 -0
  59. package/build/branding.d.ts +0 -8
  60. package/build/branding.d.ts.map +1 -1
  61. package/build/branding.js +0 -16
  62. package/build/branding.js.map +1 -1
  63. package/build/connect/consts.d.ts +0 -10
  64. package/build/connect/consts.d.ts.map +1 -1
  65. package/build/connect/consts.js +0 -23
  66. package/build/connect/consts.js.map +1 -1
  67. package/build/connect/entrypoints.d.ts +49 -86
  68. package/build/connect/entrypoints.d.ts.map +1 -1
  69. package/build/connect/entrypoints.js +5 -2
  70. package/build/connect/entrypoints.js.map +1 -1
  71. package/build/connect/errors.d.ts +32 -0
  72. package/build/connect/errors.d.ts.map +1 -1
  73. package/build/connect/errors.js +65 -0
  74. package/build/connect/errors.js.map +1 -1
  75. package/build/connect/index.d.ts +1 -0
  76. package/build/connect/index.d.ts.map +1 -1
  77. package/build/connect/index.js +1 -0
  78. package/build/connect/index.js.map +1 -1
  79. package/build/connect/references.d.ts +1 -153
  80. package/build/connect/references.d.ts.map +1 -1
  81. package/build/connect/references.js.map +1 -1
  82. package/build/connect/schemas.d.ts +2 -1
  83. package/build/connect/schemas.d.ts.map +1 -1
  84. package/build/connect/schemas.js +9 -0
  85. package/build/connect/schemas.js.map +1 -1
  86. package/build/connect/types.d.ts +214 -1
  87. package/build/connect/types.d.ts.map +1 -1
  88. package/build/connect/types.local.d.ts +4 -0
  89. package/build/connect/types.local.d.ts.map +1 -0
  90. package/build/connect/types.local.js +2 -0
  91. package/build/connect/types.local.js.map +1 -0
  92. package/build/connect/utils.d.ts +12 -0
  93. package/build/connect/utils.d.ts.map +1 -0
  94. package/build/connect/utils.js +25 -0
  95. package/build/connect/utils.js.map +1 -0
  96. package/build/consts.d.ts +8 -0
  97. package/build/consts.d.ts.map +1 -1
  98. package/build/consts.js +16 -0
  99. package/build/consts.js.map +1 -1
  100. package/build/convert/consts.d.ts +0 -12
  101. package/build/convert/consts.d.ts.map +1 -1
  102. package/build/convert/consts.js +0 -3
  103. package/build/convert/consts.js.map +1 -1
  104. package/build/convert/consts.local.d.ts +55 -0
  105. package/build/convert/consts.local.d.ts.map +1 -0
  106. package/build/convert/consts.local.js +104 -0
  107. package/build/convert/consts.local.js.map +1 -0
  108. package/build/convert/helpers.d.ts.map +1 -1
  109. package/build/convert/helpers.js +1 -102
  110. package/build/convert/helpers.js.map +1 -1
  111. package/build/convert/index.d.ts +1 -0
  112. package/build/convert/index.d.ts.map +1 -1
  113. package/build/convert/index.js +1 -0
  114. package/build/convert/index.js.map +1 -1
  115. package/build/convert/types.d.ts +10 -1
  116. package/build/convert/types.d.ts.map +1 -1
  117. package/build/convert/utils.d.ts +4 -0
  118. package/build/convert/utils.d.ts.map +1 -0
  119. package/build/convert/utils.js +5 -0
  120. package/build/convert/utils.js.map +1 -0
  121. package/build/design/consts.d.ts +37 -0
  122. package/build/design/consts.d.ts.map +1 -1
  123. package/build/design/consts.js +44 -8
  124. package/build/design/consts.js.map +1 -1
  125. package/build/design/runtime.d.ts +2 -103
  126. package/build/design/runtime.d.ts.map +1 -1
  127. package/build/design/runtime.js +1 -44
  128. package/build/design/runtime.js.map +1 -1
  129. package/build/design/schemas.d.ts +1 -9
  130. package/build/design/schemas.d.ts.map +1 -1
  131. package/build/design/schemas.js +1 -1
  132. package/build/design/schemas.js.map +1 -1
  133. package/build/design/types.d.ts +75 -1
  134. package/build/design/types.d.ts.map +1 -1
  135. package/build/dev/schemas.d.ts.map +1 -1
  136. package/build/dev/schemas.js.map +1 -1
  137. package/build/dev/types.local.d.ts +4 -0
  138. package/build/dev/types.local.d.ts.map +1 -0
  139. package/build/dev/types.local.js +2 -0
  140. package/build/dev/types.local.js.map +1 -0
  141. package/build/integrity/consts.d.ts +0 -117
  142. package/build/integrity/consts.d.ts.map +1 -1
  143. package/build/integrity/consts.js +0 -281
  144. package/build/integrity/consts.js.map +1 -1
  145. package/build/integrity/consts.local.d.ts +5 -0
  146. package/build/integrity/consts.local.d.ts.map +1 -0
  147. package/build/integrity/consts.local.js +5 -0
  148. package/build/integrity/consts.local.js.map +1 -0
  149. package/build/integrity/index.d.ts +1 -0
  150. package/build/integrity/index.d.ts.map +1 -1
  151. package/build/integrity/index.js +1 -0
  152. package/build/integrity/index.js.map +1 -1
  153. package/build/integrity/types.d.ts +33 -1
  154. package/build/integrity/types.d.ts.map +1 -1
  155. package/build/integrity/utils.d.ts +88 -0
  156. package/build/integrity/utils.d.ts.map +1 -0
  157. package/build/integrity/utils.js +280 -0
  158. package/build/integrity/utils.js.map +1 -0
  159. package/build/integrity/verify.d.ts.map +1 -1
  160. package/build/integrity/verify.js +2 -1
  161. package/build/integrity/verify.js.map +1 -1
  162. package/build/intent/consts.local.d.ts +4 -0
  163. package/build/intent/consts.local.d.ts.map +1 -0
  164. package/build/intent/consts.local.js +3 -0
  165. package/build/intent/consts.local.js.map +1 -0
  166. package/build/intent/entrypoints.d.ts +0 -1
  167. package/build/intent/entrypoints.d.ts.map +1 -1
  168. package/build/intent/flow.d.ts.map +1 -1
  169. package/build/intent/flow.js +2 -2
  170. package/build/intent/flow.js.map +1 -1
  171. package/build/intent/types.d.ts +2 -0
  172. package/build/intent/types.d.ts.map +1 -1
  173. package/build/metadata/consts.d.ts +33 -0
  174. package/build/metadata/consts.d.ts.map +1 -1
  175. package/build/metadata/consts.js +37 -0
  176. package/build/metadata/consts.js.map +1 -1
  177. package/build/metadata/types.d.ts +1 -33
  178. package/build/metadata/types.d.ts.map +1 -1
  179. package/build/metadata/types.js +1 -38
  180. package/build/metadata/types.js.map +1 -1
  181. package/build/planning/consts.d.ts +13 -1
  182. package/build/planning/consts.d.ts.map +1 -1
  183. package/build/planning/consts.js +13 -0
  184. package/build/planning/consts.js.map +1 -1
  185. package/build/planning/index.d.ts +0 -1
  186. package/build/planning/index.d.ts.map +1 -1
  187. package/build/planning/index.js +0 -1
  188. package/build/planning/index.js.map +1 -1
  189. package/build/planning/landing.d.ts +0 -12
  190. package/build/planning/landing.d.ts.map +1 -1
  191. package/build/planning/landing.js +1 -13
  192. package/build/planning/landing.js.map +1 -1
  193. package/build/planning/schemas.d.ts +37 -0
  194. package/build/planning/schemas.d.ts.map +1 -1
  195. package/build/planning/schemas.js +173 -4
  196. package/build/planning/schemas.js.map +1 -1
  197. package/build/planning/types.d.ts +2 -2
  198. package/build/planning/types.d.ts.map +1 -1
  199. package/build/preview/consts.d.ts +3 -1
  200. package/build/preview/consts.d.ts.map +1 -1
  201. package/build/preview/consts.js +2 -0
  202. package/build/preview/consts.js.map +1 -1
  203. package/build/preview/types.d.ts +17 -2
  204. package/build/preview/types.d.ts.map +1 -1
  205. package/build/scaffold/helpers.d.ts +1 -14
  206. package/build/scaffold/helpers.d.ts.map +1 -1
  207. package/build/scaffold/helpers.js +11 -0
  208. package/build/scaffold/helpers.js.map +1 -1
  209. package/build/scaffold/types.d.ts +2 -0
  210. package/build/scaffold/types.d.ts.map +1 -1
  211. package/build/slot/consts.d.ts +7 -13
  212. package/build/slot/consts.d.ts.map +1 -1
  213. package/build/slot/consts.js +10 -36
  214. package/build/slot/consts.js.map +1 -1
  215. package/build/slot/helpers.d.ts +1 -6
  216. package/build/slot/helpers.d.ts.map +1 -1
  217. package/build/slot/helpers.js.map +1 -1
  218. package/build/slot/index.d.ts +1 -0
  219. package/build/slot/index.d.ts.map +1 -1
  220. package/build/slot/index.js +1 -0
  221. package/build/slot/index.js.map +1 -1
  222. package/build/slot/layout.d.ts +1 -57
  223. package/build/slot/layout.d.ts.map +1 -1
  224. package/build/slot/layout.js +0 -12
  225. package/build/slot/layout.js.map +1 -1
  226. package/build/slot/types.d.ts +55 -1
  227. package/build/slot/types.d.ts.map +1 -1
  228. package/build/slot/utils.d.ts +18 -0
  229. package/build/slot/utils.d.ts.map +1 -0
  230. package/build/slot/utils.js +41 -0
  231. package/build/slot/utils.js.map +1 -0
  232. package/build/topology/card.d.ts +1 -6
  233. package/build/topology/card.d.ts.map +1 -1
  234. package/build/topology/card.js +1 -3
  235. package/build/topology/card.js.map +1 -1
  236. package/build/topology/consts.local.d.ts +4 -0
  237. package/build/topology/consts.local.d.ts.map +1 -0
  238. package/build/topology/consts.local.js +4 -0
  239. package/build/topology/consts.local.js.map +1 -0
  240. package/build/topology/types.d.ts +5 -0
  241. package/build/topology/types.d.ts.map +1 -1
  242. package/package.json +13 -13
  243. package/src/agent/consts.local.ts +47 -0
  244. package/src/agent/consts.ts +61 -0
  245. package/src/agent/index.ts +1 -0
  246. package/src/agent/presentation.ts +4 -147
  247. package/src/agent/types.local.ts +1 -0
  248. package/src/agent/types.ts +40 -0
  249. package/src/areas/consts.ts +7 -0
  250. package/src/areas/tenancy.ts +2 -38
  251. package/src/areas/types.ts +31 -0
  252. package/src/ba/types.ts +1 -1
  253. package/src/blueprint/consts.local.ts +3 -0
  254. package/src/blueprint/consts.ts +52 -0
  255. package/src/blueprint/index.ts +1 -0
  256. package/src/blueprint/types.ts +2 -72
  257. package/src/blueprint/utils.ts +20 -0
  258. package/src/branding.ts +0 -17
  259. package/src/connect/consts.ts +0 -22
  260. package/src/connect/entrypoints.ts +7 -35
  261. package/src/connect/errors.ts +75 -0
  262. package/src/connect/index.ts +1 -0
  263. package/src/connect/references.ts +4 -75
  264. package/src/connect/schemas.ts +11 -0
  265. package/src/connect/types.local.ts +5 -0
  266. package/src/connect/types.ts +124 -1
  267. package/src/connect/utils.ts +23 -0
  268. package/src/consts.ts +17 -0
  269. package/src/convert/consts.local.ts +120 -0
  270. package/src/convert/consts.ts +0 -14
  271. package/src/convert/helpers.ts +1 -119
  272. package/src/convert/index.ts +1 -0
  273. package/src/convert/types.ts +11 -5
  274. package/src/convert/utils.ts +8 -0
  275. package/src/design/consts.ts +48 -0
  276. package/src/design/runtime.ts +2 -115
  277. package/src/design/schemas.ts +2 -10
  278. package/src/design/types.ts +81 -1
  279. package/src/dev/schemas.ts +1 -3
  280. package/src/dev/types.local.ts +4 -0
  281. package/src/integrity/consts.local.ts +5 -0
  282. package/src/integrity/consts.ts +0 -348
  283. package/src/integrity/index.ts +1 -0
  284. package/src/integrity/types.ts +34 -1
  285. package/src/integrity/utils.ts +320 -0
  286. package/src/integrity/verify.ts +2 -4
  287. package/src/intent/consts.local.ts +3 -0
  288. package/src/intent/entrypoints.ts +0 -1
  289. package/src/intent/flow.ts +2 -3
  290. package/src/intent/types.ts +3 -0
  291. package/src/metadata/consts.ts +37 -0
  292. package/src/metadata/types.ts +1 -37
  293. package/src/planning/consts.ts +15 -2
  294. package/src/planning/index.ts +0 -1
  295. package/src/planning/landing.ts +1 -14
  296. package/src/planning/schemas.ts +191 -4
  297. package/src/planning/types.ts +2 -2
  298. package/src/preview/consts.ts +2 -0
  299. package/src/preview/types.ts +19 -0
  300. package/src/scaffold/helpers.ts +1 -4
  301. package/src/scaffold/types.ts +3 -0
  302. package/src/slot/consts.ts +11 -40
  303. package/src/slot/helpers.ts +1 -6
  304. package/src/slot/index.ts +1 -0
  305. package/src/slot/layout.ts +1 -62
  306. package/src/slot/types.ts +57 -1
  307. package/src/slot/utils.ts +45 -0
  308. package/src/topology/card.ts +2 -9
  309. package/src/topology/consts.local.ts +6 -0
  310. package/src/topology/types.ts +6 -0
  311. package/tests/branding.spec.ts +2 -2
  312. package/tests/connect-convert.spec.ts +21 -1
  313. package/tests/connect-errors.spec.ts +34 -1
  314. package/tests/convert.spec.ts +2 -3
  315. package/tests/error-status.spec.ts +7 -1
  316. package/tests/planning.spec.ts +3 -18
  317. package/tests/presentation.spec.ts +2 -4
  318. package/build/planning/flows.d.ts +0 -34
  319. package/build/planning/flows.d.ts.map +0 -1
  320. package/build/planning/flows.js +0 -174
  321. package/build/planning/flows.js.map +0 -1
  322. package/src/planning/flows.ts +0 -204
@@ -85,327 +85,6 @@ export enum TargetLayout {
85
85
  */
86
86
  export const TARGET_CURRENT_LAYOUT = TargetLayout.V2
87
87
 
88
- /**
89
- * Everything one layout asserts about a tree.
90
- *
91
- * One record per layout rather than a set of parallel constants, because the rules are the same
92
- * questions asked of a different package set: a rule that exists for one layout and is forgotten
93
- * for the other is a hole that nothing fails on.
94
- */
95
- export interface TargetLayoutManifest {
96
- layout: TargetLayout
97
- /** Directory holding the workspace packages, relative to the sandbox root. */
98
- dir: string
99
- /** Package directory names, in build order. */
100
- packages: readonly string[]
101
- /** The one file whose presence identifies this layout and appears in no other. */
102
- probe: string
103
- /** Every file the verifier reads for this layout. */
104
- files: readonly string[]
105
- /** Files no user-facing write may touch in a tree of this layout. */
106
- protectedFiles: readonly string[]
107
- /** The exact `scripts.build` each package must declare. */
108
- buildScripts: Readonly<Record<string, string>>
109
- /** Framework dependencies without which a package cannot be the generated app. */
110
- requiredDeps: Readonly<Record<string, readonly string[]>>
111
- /** The workspace siblings each package must depend on. */
112
- workspaceDeps: Readonly<Record<string, readonly string[]>>
113
- /** The glob spelling of the root manifest's workspace list. */
114
- workspaceGlob: string
115
- /** The written-out spelling of the same list. */
116
- workspaceEntries: readonly string[]
117
- /** Markers proving an entry file is still the framework's entry, keyed by file. */
118
- markers: Readonly<Record<string, readonly string[]>>
119
- }
120
-
121
- const fileIn = (dir: string, pkg: string, path: string): string => `${dir}/${pkg}/${path}`
122
-
123
- /** The harness files, protected in every layout — see {@link TARGET_PROTECTED_FILES}. */
124
- const HARNESS_PROTECTED = ['.claude/settings.json', '.agents/scripts/link-skills.sh'] as const
125
-
126
- /** Root-level files protected in every layout. */
127
- const ROOT_PROTECTED = ['package.json', 'bunfig.toml', 'bun.lock', 'index.js'] as const
128
-
129
- const protectedOf = (
130
- dir: string, packages: readonly string[], bundled: readonly string[]
131
- ): readonly string[] => [
132
- ...ROOT_PROTECTED,
133
- ...HARNESS_PROTECTED,
134
- ...packages.flatMap(pkg => [fileIn(dir, pkg, 'package.json'), fileIn(dir, pkg, 'tsconfig.json')]),
135
- ...bundled.flatMap(pkg =>
136
- [fileIn(dir, pkg, 'rollup.config.js'), fileIn(dir, pkg, 'rollup.build.mjs')]),
137
- ]
138
-
139
- const v2 = (pkg: TargetPackage, path: string): string =>
140
- fileIn(TARGET_PACKAGES_DIR, pkg, path)
141
- const v1 = (pkg: TargetLegacyPackage, path: string): string =>
142
- fileIn(TARGET_LEGACY_PACKAGES_DIR, pkg, path)
143
-
144
- /**
145
- * The current layout: five workspace packages under `sources/`.
146
- *
147
- * `common` and `backend` are libraries the other three import, so they emit declarations with
148
- * `tsc -b` rather than a bundle; `api`, `web` and `worker` each bundle themselves.
149
- */
150
- const V2_MANIFEST: TargetLayoutManifest = {
151
- layout: TargetLayout.V2,
152
- dir: TARGET_PACKAGES_DIR,
153
- packages: Object.values(TargetPackage),
154
- // The same file the publisher's own filesystem detection probes for (`sources/api`), so the
155
- // two answers about one volume cannot disagree.
156
- probe: v2(TargetPackage.Api, 'package.json'),
157
- files: [
158
- 'package.json',
159
- 'bunfig.toml',
160
- v2(TargetPackage.Common, 'package.json'),
161
- v2(TargetPackage.Common, 'tsconfig.json'),
162
- v2(TargetPackage.Common, 'src/index.ts'),
163
- v2(TargetPackage.Common, 'src/entrypoints.ts'),
164
- v2(TargetPackage.Backend, 'package.json'),
165
- v2(TargetPackage.Backend, 'tsconfig.json'),
166
- v2(TargetPackage.Backend, 'src/index.ts'),
167
- v2(TargetPackage.Backend, 'src/context.ts'),
168
- v2(TargetPackage.Backend, 'src/config.ts'),
169
- v2(TargetPackage.Api, 'package.json'),
170
- v2(TargetPackage.Api, 'tsconfig.json'),
171
- v2(TargetPackage.Api, 'rollup.config.js'),
172
- v2(TargetPackage.Api, 'rollup.build.mjs'),
173
- v2(TargetPackage.Api, 'src/index.ts'),
174
- v2(TargetPackage.Api, 'src/owlmeans.ts'),
175
- v2(TargetPackage.Api, 'src/config.ts'),
176
- v2(TargetPackage.Api, 'src/entrypoints.ts'),
177
- v2(TargetPackage.Web, 'package.json'),
178
- v2(TargetPackage.Web, 'tsconfig.json'),
179
- v2(TargetPackage.Web, 'rollup.config.js'),
180
- v2(TargetPackage.Web, 'rollup.build.mjs'),
181
- v2(TargetPackage.Web, 'src/index.tsx'),
182
- v2(TargetPackage.Web, 'src/owlmeans.ts'),
183
- v2(TargetPackage.Web, 'src/config.ts'),
184
- v2(TargetPackage.Web, 'src/entrypoints.ts'),
185
- v2(TargetPackage.Worker, 'package.json'),
186
- v2(TargetPackage.Worker, 'tsconfig.json'),
187
- v2(TargetPackage.Worker, 'rollup.config.js'),
188
- v2(TargetPackage.Worker, 'rollup.build.mjs'),
189
- v2(TargetPackage.Worker, 'src/index.ts'),
190
- v2(TargetPackage.Worker, 'src/owlmeans.ts'),
191
- v2(TargetPackage.Worker, 'src/config.ts'),
192
- v2(TargetPackage.Worker, 'src/entrypoints.ts'),
193
- ],
194
- protectedFiles: protectedOf(
195
- TARGET_PACKAGES_DIR, Object.values(TargetPackage), TARGET_BUNDLED_PACKAGES),
196
- buildScripts: {
197
- [TargetPackage.Common]: 'tsc -b',
198
- [TargetPackage.Backend]: 'tsc -b',
199
- [TargetPackage.Api]: 'bun ./rollup.build.mjs',
200
- [TargetPackage.Web]: 'bun ./rollup.build.mjs',
201
- [TargetPackage.Worker]: 'bun ./rollup.build.mjs',
202
- },
203
- requiredDeps: {
204
- [TargetPackage.Common]: ['@owlmeans/context', '@owlmeans/entrypoint'],
205
- [TargetPackage.Backend]: ['@owlmeans/context', '@owlmeans/postgres-resource'],
206
- [TargetPackage.Api]: ['@owlmeans/server-app'],
207
- [TargetPackage.Web]: ['@owlmeans/web-client'],
208
- [TargetPackage.Worker]: ['@owlmeans/queue', '@owlmeans/redis-queue'],
209
- },
210
- // `api` and `worker` both reach the database through `backend`, which is the whole reason
211
- // `backend` is a library: two runtimes, one context factory, one set of resources. A `worker`
212
- // that stopped depending on `backend` is processing jobs against something else.
213
- workspaceDeps: {
214
- [TargetPackage.Common]: [],
215
- [TargetPackage.Backend]: [TargetPackage.Common],
216
- [TargetPackage.Api]: [TargetPackage.Common, TargetPackage.Backend],
217
- [TargetPackage.Web]: [TargetPackage.Common],
218
- [TargetPackage.Worker]: [TargetPackage.Backend],
219
- },
220
- workspaceGlob: `${TARGET_PACKAGES_DIR}/*`,
221
- workspaceEntries: Object.values(TargetPackage).map(pkg => `${TARGET_PACKAGES_DIR}/${pkg}`),
222
- markers: {
223
- [v2(TargetPackage.Common, 'src/index.ts')]: ['./entrypoints.js'],
224
- [v2(TargetPackage.Backend, 'src/index.ts')]: ['./context.js'],
225
- [v2(TargetPackage.Backend, 'src/context.ts')]: ['@owlmeans/context', 'makeContext'],
226
- [v2(TargetPackage.Api, 'src/index.ts')]: ['./owlmeans.js', 'initOwlMeans'],
227
- [v2(TargetPackage.Api, 'src/owlmeans.ts')]: ['@owlmeans/server-app', 'makeContext'],
228
- [v2(TargetPackage.Web, 'src/index.tsx')]: ['@owlmeans/web-client', 'renderApp', './owlmeans'],
229
- [v2(TargetPackage.Web, 'src/owlmeans.ts')]: ['makeContext', 'owlCtx'],
230
- // The worker binds nothing but its health port; what makes it a worker is that it listens.
231
- [v2(TargetPackage.Worker, 'src/index.ts')]: ['./owlmeans.js', 'initOwlMeans'],
232
- [v2(TargetPackage.Worker, 'src/owlmeans.ts')]: ['@owlmeans/queue', 'makeContext'],
233
- // The build configuration itself: what it reads and what it emits. These are the paths the
234
- // publisher spawns and serves, so a config that redirects either one is a different program.
235
- // Matched loosely enough to survive the `path.resolve(srcDir, …)` the template writes them
236
- // with, and strictly enough that an input or an output somewhere else fails.
237
- [v2(TargetPackage.Api, 'rollup.config.js')]: ['input:', 'index.ts', 'dist', 'index.js'],
238
- [v2(TargetPackage.Web, 'rollup.config.js')]: ['input:', 'index.tsx', 'dist', 'bundle.js'],
239
- [v2(TargetPackage.Worker, 'rollup.config.js')]: ['input:', 'index.ts', 'dist', 'index.js'],
240
- },
241
- }
242
-
243
- /**
244
- * The legacy layout: three workspace packages under `packages/`.
245
- *
246
- * Frozen — nothing generates one any more, and every rule here is stated against the trees that
247
- * exist rather than against a template this repository still ships (it does not). `backend` is
248
- * the HTTP server AND the data layer, which is why it carries both `@owlmeans/server-app` and
249
- * `@owlmeans/postgres-resource`; `common` is the only library.
250
- */
251
- const V1_MANIFEST: TargetLayoutManifest = {
252
- layout: TargetLayout.V1,
253
- dir: TARGET_LEGACY_PACKAGES_DIR,
254
- packages: TARGET_LEGACY_PACKAGES,
255
- // `packages/backend` again — the publisher's own marker for this layout.
256
- probe: v1(TargetLegacyPackage.Backend, 'package.json'),
257
- files: [
258
- 'package.json',
259
- 'bunfig.toml',
260
- v1(TargetLegacyPackage.Common, 'package.json'),
261
- v1(TargetLegacyPackage.Common, 'tsconfig.json'),
262
- v1(TargetLegacyPackage.Common, 'src/index.ts'),
263
- v1(TargetLegacyPackage.Common, 'src/entrypoints.ts'),
264
- v1(TargetLegacyPackage.Backend, 'package.json'),
265
- v1(TargetLegacyPackage.Backend, 'tsconfig.json'),
266
- v1(TargetLegacyPackage.Backend, 'rollup.config.js'),
267
- v1(TargetLegacyPackage.Backend, 'rollup.build.mjs'),
268
- v1(TargetLegacyPackage.Backend, 'src/index.ts'),
269
- v1(TargetLegacyPackage.Backend, 'src/owlmeans.ts'),
270
- v1(TargetLegacyPackage.Backend, 'src/config.ts'),
271
- v1(TargetLegacyPackage.Backend, 'src/entrypoints.ts'),
272
- v1(TargetLegacyPackage.Frontend, 'package.json'),
273
- v1(TargetLegacyPackage.Frontend, 'tsconfig.json'),
274
- v1(TargetLegacyPackage.Frontend, 'rollup.config.js'),
275
- v1(TargetLegacyPackage.Frontend, 'rollup.build.mjs'),
276
- v1(TargetLegacyPackage.Frontend, 'src/index.tsx'),
277
- v1(TargetLegacyPackage.Frontend, 'src/owlmeans.ts'),
278
- v1(TargetLegacyPackage.Frontend, 'src/config.ts'),
279
- v1(TargetLegacyPackage.Frontend, 'src/entrypoints.ts'),
280
- ],
281
- protectedFiles: protectedOf(
282
- TARGET_LEGACY_PACKAGES_DIR, TARGET_LEGACY_PACKAGES, TARGET_LEGACY_BUNDLED_PACKAGES),
283
- buildScripts: {
284
- [TargetLegacyPackage.Common]: 'tsc -b',
285
- [TargetLegacyPackage.Backend]: 'bun ./rollup.build.mjs',
286
- [TargetLegacyPackage.Frontend]: 'bun ./rollup.build.mjs',
287
- },
288
- requiredDeps: {
289
- [TargetLegacyPackage.Common]: ['@owlmeans/context', '@owlmeans/entrypoint'],
290
- [TargetLegacyPackage.Backend]: ['@owlmeans/server-app', '@owlmeans/postgres-resource'],
291
- [TargetLegacyPackage.Frontend]: ['@owlmeans/web-client'],
292
- },
293
- workspaceDeps: {
294
- [TargetLegacyPackage.Common]: [],
295
- [TargetLegacyPackage.Backend]: [TargetLegacyPackage.Common],
296
- [TargetLegacyPackage.Frontend]: [TargetLegacyPackage.Common],
297
- },
298
- workspaceGlob: `${TARGET_LEGACY_PACKAGES_DIR}/*`,
299
- workspaceEntries: TARGET_LEGACY_PACKAGES.map(pkg => `${TARGET_LEGACY_PACKAGES_DIR}/${pkg}`),
300
- markers: {
301
- [v1(TargetLegacyPackage.Common, 'src/index.ts')]: ['./entrypoints.js'],
302
- [v1(TargetLegacyPackage.Backend, 'src/index.ts')]: ['./owlmeans.js', 'initOwlMeans'],
303
- [v1(TargetLegacyPackage.Backend, 'src/owlmeans.ts')]: ['@owlmeans/server-app', 'makeContext'],
304
- [v1(TargetLegacyPackage.Frontend, 'src/index.tsx')]:
305
- ['@owlmeans/web-client', 'renderApp', './owlmeans'],
306
- [v1(TargetLegacyPackage.Frontend, 'src/owlmeans.ts')]: ['makeContext', 'owlCtx'],
307
- [v1(TargetLegacyPackage.Backend, 'rollup.config.js')]:
308
- ['input:', 'index.ts', 'dist', 'index.js'],
309
- [v1(TargetLegacyPackage.Frontend, 'rollup.config.js')]:
310
- ['input:', 'index.tsx', 'dist', 'bundle.js'],
311
- },
312
- }
313
-
314
- /**
315
- * Every layout the platform is willing to run, keyed by its own name.
316
- *
317
- * Declared current-first, and the order is load-bearing: detection walks it and takes the first
318
- * probe it finds, so a half-migrated tree carrying both is verified against the layout the
319
- * platform generates today rather than against the frozen one.
320
- */
321
- export const TARGET_LAYOUTS: Readonly<Record<TargetLayout, TargetLayoutManifest>> = {
322
- [TargetLayout.V2]: V2_MANIFEST,
323
- [TargetLayout.V1]: V1_MANIFEST,
324
- }
325
-
326
- /** What one layout asserts. */
327
- export const targetManifest = (layout: TargetLayout): TargetLayoutManifest =>
328
- TARGET_LAYOUTS[layout]
329
-
330
- /**
331
- * Whether a tree of this layout can still be GENERATED INTO.
332
- *
333
- * A legacy target is served, built and run exactly like any other — that is the whole point of
334
- * verifying it against its own manifest. What no longer works on it is code generation: every
335
- * path builder, every stamped import specifier and the whole `docs/` metadata tree name the
336
- * current layout's packages, so a story implemented into a legacy tree writes files into
337
- * directories its workspace does not contain. That fails silently — the build succeeds, the
338
- * story completes and the application does not change — which is why the platform refuses
339
- * instead, and names re-initialization as the one cure.
340
- *
341
- * `undefined` reads as current: a publisher that predates layout reporting omits it, and reading
342
- * that silence as legacy would refuse development for every slot already in the cluster.
343
- */
344
- export const isLegacyLayout = (layout: TargetLayout | string | undefined | null): boolean =>
345
- layout != null && layout !== TARGET_CURRENT_LAYOUT
346
-
347
- /**
348
- * The files whose presence tells the layouts apart.
349
- *
350
- * Each layout's probe is a path the other cannot have. They are members of their own layout's
351
- * file list too, so a caller that reads {@link TARGET_INTEGRITY_FILES} always has both in hand —
352
- * which is the whole reason detection works at all. It did not before: the probe for the legacy
353
- * layout was declared but never read, so `detectTargetLayout` could only ever answer `V2`.
354
- */
355
- export const TARGET_LAYOUT_PROBE_FILES: readonly string[] =
356
- Object.values(TARGET_LAYOUTS).map(manifest => manifest.probe)
357
-
358
- /**
359
- * Which layout a tree is in, from its files alone — IO-free, like everything else here.
360
- *
361
- * A tree that shows neither probe is reported as the current layout: it is not a target at all,
362
- * and the integrity report is what has to say so, in the vocabulary of the layout the platform
363
- * generates today.
364
- */
365
- export const detectTargetLayout = (files: Record<string, string | null>): TargetLayout => {
366
- for (const manifest of Object.values(TARGET_LAYOUTS)) {
367
- if (files[manifest.probe] != null) {
368
- return manifest.layout
369
- }
370
- }
371
-
372
- return TARGET_CURRENT_LAYOUT
373
- }
374
-
375
- /**
376
- * Files a caller must read and hand to `verifyTargetShape`.
377
- *
378
- * The UNION over every layout, because a caller reads before it knows which layout it is holding
379
- * and the probes are what settle that. The verifier reports only the files its selected layout
380
- * actually requires, so the extra reads cost a `stat` each and never a violation.
381
- *
382
- * The verifier is pure and does no IO of its own — the publisher reads these from the PVC, and
383
- * a test reads them from the template tree. A path that does not exist is passed as `null`,
384
- * which the verifier reports rather than skipping: absence is a violation for everything here.
385
- */
386
- export const TARGET_INTEGRITY_FILES: readonly string[] = [
387
- ...new Set(Object.values(TARGET_LAYOUTS).flatMap(manifest => manifest.files)),
388
- ]
389
-
390
- /**
391
- * Files no user-facing write may touch, through any path — the union over every layout.
392
- *
393
- * These are the ones that decide what gets EXECUTED — the build scripts, the package manifests
394
- * that name them, the compiler configuration that resolves them, and the install configuration.
395
- * The agent harness is here for the same reason: `.claude/settings.json` declares a
396
- * `SessionStart` hook and `.agents/scripts/link-skills.sh` is the command it spawns, so a write
397
- * to either runs code in the slot the next time an agent session opens, with no build and no
398
- * request involved. The agent's own generator already refuses the wiring sources
399
- * (`WIRING_SOURCES`), but that guard is LLM-scoped: it never saw a manual editor save and never
400
- * saw a git merge.
401
- *
402
- * The union rather than the current layout's list, because this is a path-shaped refusal with
403
- * nothing to gain from being narrow: a v2 path cannot exist in a v1 tree, so covering both costs
404
- * nothing and covers the legacy slots that were left writable.
405
- */
406
- export const TARGET_PROTECTED_FILES: readonly string[] = [
407
- ...new Set(Object.values(TARGET_LAYOUTS).flatMap(manifest => manifest.protectedFiles)),
408
- ]
409
88
 
410
89
  /**
411
90
  * What a target's root package may be named — and therefore what every other name in the tree is.
@@ -421,9 +100,6 @@ export const TARGET_PROTECTED_FILES: readonly string[] = [
421
100
  */
422
101
  export const TARGET_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])?$/
423
102
 
424
- /** `<slug>-<package>` — the only way a workspace package is ever named, in either layout. */
425
- export const targetPackageName = (slug: string, pkg: string): string => `${slug}-${pkg}`
426
-
427
103
  /**
428
104
  * npm lifecycle hooks, forbidden in every one of the target's manifests.
429
105
  *
@@ -437,30 +113,6 @@ export const TARGET_FORBIDDEN_SCRIPTS = [
437
113
  'prepublish', 'prepublishOnly', 'postpublish', 'prepack', 'postpack',
438
114
  ] as const
439
115
 
440
- /** Everything one package must declare, once the root manifest has named the slug. */
441
- export const targetRequiredDeps = (
442
- slug: string, pkg: string, layout: TargetLayout = TARGET_CURRENT_LAYOUT
443
- ): string[] => {
444
- const manifest = targetManifest(layout)
445
-
446
- return [
447
- ...(manifest.requiredDeps[pkg] ?? []),
448
- ...(manifest.workspaceDeps[pkg] ?? []).map(dep => targetPackageName(slug, dep)),
449
- ]
450
- }
451
-
452
- /**
453
- * The current layout's own rules, kept as named constants because consumers outside the verifier
454
- * ask about the tree the platform generates today — never about a frozen one.
455
- */
456
- export const TARGET_BUILD_SCRIPTS: Readonly<Record<string, string>> = V2_MANIFEST.buildScripts
457
- export const TARGET_REQUIRED_DEPS: Readonly<Record<string, readonly string[]>> =
458
- V2_MANIFEST.requiredDeps
459
- export const TARGET_WORKSPACE_DEPS: Readonly<Record<string, readonly string[]>> =
460
- V2_MANIFEST.workspaceDeps
461
- export const TARGET_ENTRY_MARKERS: Readonly<Record<string, readonly string[]>> = V2_MANIFEST.markers
462
- export const TARGET_WORKSPACE_GLOB = V2_MANIFEST.workspaceGlob
463
- export const TARGET_WORKSPACE_ENTRIES: readonly string[] = V2_MANIFEST.workspaceEntries
464
116
 
465
117
  /** Rule ids carried on a violation, so a consumer can branch without parsing prose. */
466
118
  export enum IntegrityRule {
@@ -1,3 +1,4 @@
1
1
  export * from './consts.js'
2
+ export * from './utils.js'
2
3
  export * from './verify.js'
3
4
  export type * from './types.js'
@@ -1,4 +1,4 @@
1
- import type { IntegrityRule, TargetLayout } from './consts.js'
1
+ import { type IntegrityRule, TargetLayout } from './consts.js'
2
2
 
3
3
  /** One reason a tree was refused. */
4
4
  export interface IntegrityViolation {
@@ -35,3 +35,36 @@ export interface TargetIntegrityReport {
35
35
  * one that could not be read. The verifier does no IO — see `verifyTargetShape`.
36
36
  */
37
37
  export type TargetFileMap = Record<string, string | null>
38
+
39
+ /**
40
+ * Everything one layout asserts about a tree.
41
+ *
42
+ * One record per layout rather than a set of parallel constants, because the rules are the same
43
+ * questions asked of a different package set: a rule that exists for one layout and is forgotten
44
+ * for the other is a hole that nothing fails on.
45
+ */
46
+ export interface TargetLayoutManifest {
47
+ layout: TargetLayout
48
+ /** Directory holding the workspace packages, relative to the sandbox root. */
49
+ dir: string
50
+ /** Package directory names, in build order. */
51
+ packages: readonly string[]
52
+ /** The one file whose presence identifies this layout and appears in no other. */
53
+ probe: string
54
+ /** Every file the verifier reads for this layout. */
55
+ files: readonly string[]
56
+ /** Files no user-facing write may touch in a tree of this layout. */
57
+ protectedFiles: readonly string[]
58
+ /** The exact `scripts.build` each package must declare. */
59
+ buildScripts: Readonly<Record<string, string>>
60
+ /** Framework dependencies without which a package cannot be the generated app. */
61
+ requiredDeps: Readonly<Record<string, readonly string[]>>
62
+ /** The workspace siblings each package must depend on. */
63
+ workspaceDeps: Readonly<Record<string, readonly string[]>>
64
+ /** The glob spelling of the root manifest's workspace list. */
65
+ workspaceGlob: string
66
+ /** The written-out spelling of the same list. */
67
+ workspaceEntries: readonly string[]
68
+ /** Markers proving an entry file is still the framework's entry, keyed by file. */
69
+ markers: Readonly<Record<string, readonly string[]>>
70
+ }