@gate-forge/cli 0.7.1 → 0.9.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 (296) hide show
  1. package/README.md +91 -704
  2. package/dist/adapter-audit.d.ts +208 -0
  3. package/dist/adapter-audit.d.ts.map +1 -0
  4. package/dist/adapter-audit.js +579 -0
  5. package/dist/adapter-audit.js.map +1 -0
  6. package/dist/adapter-scaffold.d.ts +91 -0
  7. package/dist/adapter-scaffold.d.ts.map +1 -0
  8. package/dist/adapter-scaffold.js +474 -0
  9. package/dist/adapter-scaffold.js.map +1 -0
  10. package/dist/adopted-baseline.d.ts +10 -0
  11. package/dist/adopted-baseline.d.ts.map +1 -1
  12. package/dist/adopted-baseline.js +18 -1
  13. package/dist/adopted-baseline.js.map +1 -1
  14. package/dist/args.d.ts +15 -0
  15. package/dist/args.d.ts.map +1 -1
  16. package/dist/args.js +61 -2
  17. package/dist/args.js.map +1 -1
  18. package/dist/behavior-setup.d.ts +239 -0
  19. package/dist/behavior-setup.d.ts.map +1 -0
  20. package/dist/behavior-setup.js +751 -0
  21. package/dist/behavior-setup.js.map +1 -0
  22. package/dist/broker.d.ts.map +1 -1
  23. package/dist/broker.js +28 -2
  24. package/dist/broker.js.map +1 -1
  25. package/dist/cache-exclusions.d.ts +45 -0
  26. package/dist/cache-exclusions.d.ts.map +1 -0
  27. package/dist/cache-exclusions.js +205 -0
  28. package/dist/cache-exclusions.js.map +1 -0
  29. package/dist/candidate-tree.d.ts +86 -14
  30. package/dist/candidate-tree.d.ts.map +1 -1
  31. package/dist/candidate-tree.js +236 -62
  32. package/dist/candidate-tree.js.map +1 -1
  33. package/dist/ci-witnessed-template.d.ts +43 -0
  34. package/dist/ci-witnessed-template.d.ts.map +1 -0
  35. package/dist/ci-witnessed-template.js +283 -0
  36. package/dist/ci-witnessed-template.js.map +1 -0
  37. package/dist/cli.d.ts +1 -1
  38. package/dist/cli.d.ts.map +1 -1
  39. package/dist/cli.js +31 -4
  40. package/dist/cli.js.map +1 -1
  41. package/dist/commands/adapters.d.ts +15 -0
  42. package/dist/commands/adapters.d.ts.map +1 -0
  43. package/dist/commands/adapters.js +355 -0
  44. package/dist/commands/adapters.js.map +1 -0
  45. package/dist/commands/adopt.d.ts +7 -0
  46. package/dist/commands/adopt.d.ts.map +1 -1
  47. package/dist/commands/adopt.js +44 -2
  48. package/dist/commands/adopt.js.map +1 -1
  49. package/dist/commands/baseline.d.ts.map +1 -1
  50. package/dist/commands/baseline.js +42 -1
  51. package/dist/commands/baseline.js.map +1 -1
  52. package/dist/commands/blocking.d.ts +105 -2
  53. package/dist/commands/blocking.d.ts.map +1 -1
  54. package/dist/commands/blocking.js +395 -53
  55. package/dist/commands/blocking.js.map +1 -1
  56. package/dist/commands/check.d.ts +36 -0
  57. package/dist/commands/check.d.ts.map +1 -1
  58. package/dist/commands/check.js +1068 -64
  59. package/dist/commands/check.js.map +1 -1
  60. package/dist/commands/classify.d.ts +2 -1
  61. package/dist/commands/classify.d.ts.map +1 -1
  62. package/dist/commands/classify.js +188 -5
  63. package/dist/commands/classify.js.map +1 -1
  64. package/dist/commands/enforce.d.ts +4 -4
  65. package/dist/commands/enforce.d.ts.map +1 -1
  66. package/dist/commands/enforce.js +41 -9
  67. package/dist/commands/enforce.js.map +1 -1
  68. package/dist/commands/enforcement.d.ts +13 -1
  69. package/dist/commands/enforcement.d.ts.map +1 -1
  70. package/dist/commands/enforcement.js +880 -33
  71. package/dist/commands/enforcement.js.map +1 -1
  72. package/dist/commands/explain.d.ts +1 -1
  73. package/dist/commands/explain.d.ts.map +1 -1
  74. package/dist/commands/explain.js +162 -3
  75. package/dist/commands/explain.js.map +1 -1
  76. package/dist/commands/history.d.ts +12 -0
  77. package/dist/commands/history.d.ts.map +1 -0
  78. package/dist/commands/history.js +45 -0
  79. package/dist/commands/history.js.map +1 -0
  80. package/dist/commands/init-presets.d.ts +155 -0
  81. package/dist/commands/init-presets.d.ts.map +1 -0
  82. package/dist/commands/init-presets.js +203 -0
  83. package/dist/commands/init-presets.js.map +1 -0
  84. package/dist/commands/init.d.ts +7 -12
  85. package/dist/commands/init.d.ts.map +1 -1
  86. package/dist/commands/init.js +987 -99
  87. package/dist/commands/init.js.map +1 -1
  88. package/dist/commands/keys.d.ts.map +1 -1
  89. package/dist/commands/keys.js +29 -13
  90. package/dist/commands/keys.js.map +1 -1
  91. package/dist/commands/next.d.ts.map +1 -1
  92. package/dist/commands/next.js +846 -19
  93. package/dist/commands/next.js.map +1 -1
  94. package/dist/commands/pre-commit.d.ts +25 -0
  95. package/dist/commands/pre-commit.d.ts.map +1 -1
  96. package/dist/commands/pre-commit.js +91 -6
  97. package/dist/commands/pre-commit.js.map +1 -1
  98. package/dist/commands/quarantine.d.ts +16 -0
  99. package/dist/commands/quarantine.d.ts.map +1 -0
  100. package/dist/commands/quarantine.js +213 -0
  101. package/dist/commands/quarantine.js.map +1 -0
  102. package/dist/commands/run.d.ts +39 -0
  103. package/dist/commands/run.d.ts.map +1 -0
  104. package/dist/commands/run.js +196 -0
  105. package/dist/commands/run.js.map +1 -0
  106. package/dist/commands/test-gates.d.ts +284 -2
  107. package/dist/commands/test-gates.d.ts.map +1 -1
  108. package/dist/commands/test-gates.js +3620 -187
  109. package/dist/commands/test-gates.js.map +1 -1
  110. package/dist/commands/tests.d.ts +1 -1
  111. package/dist/commands/tests.d.ts.map +1 -1
  112. package/dist/commands/tests.js +264 -29
  113. package/dist/commands/tests.js.map +1 -1
  114. package/dist/docs-exclusions.d.ts.map +1 -1
  115. package/dist/docs-exclusions.js +18 -3
  116. package/dist/docs-exclusions.js.map +1 -1
  117. package/dist/endpoint-compiler.d.ts.map +1 -1
  118. package/dist/endpoint-compiler.js +78 -9
  119. package/dist/endpoint-compiler.js.map +1 -1
  120. package/dist/engine-browser.d.ts +183 -0
  121. package/dist/engine-browser.d.ts.map +1 -0
  122. package/dist/engine-browser.js +381 -0
  123. package/dist/engine-browser.js.map +1 -0
  124. package/dist/engine-identity.d.ts +100 -0
  125. package/dist/engine-identity.d.ts.map +1 -0
  126. package/dist/engine-identity.js +182 -0
  127. package/dist/engine-identity.js.map +1 -0
  128. package/dist/evaluate.d.ts +105 -1
  129. package/dist/evaluate.d.ts.map +1 -1
  130. package/dist/evaluate.js +149 -18
  131. package/dist/evaluate.js.map +1 -1
  132. package/dist/execution.d.ts +253 -9
  133. package/dist/execution.d.ts.map +1 -1
  134. package/dist/execution.js +309 -12
  135. package/dist/execution.js.map +1 -1
  136. package/dist/gateforge-owned.d.ts +78 -0
  137. package/dist/gateforge-owned.d.ts.map +1 -0
  138. package/dist/gateforge-owned.js +254 -0
  139. package/dist/gateforge-owned.js.map +1 -0
  140. package/dist/git-hooks.d.ts +35 -0
  141. package/dist/git-hooks.d.ts.map +1 -1
  142. package/dist/git-hooks.js +140 -1
  143. package/dist/git-hooks.js.map +1 -1
  144. package/dist/git-ignored.d.ts +27 -0
  145. package/dist/git-ignored.d.ts.map +1 -0
  146. package/dist/git-ignored.js +102 -0
  147. package/dist/git-ignored.js.map +1 -0
  148. package/dist/git-objects.d.ts +60 -0
  149. package/dist/git-objects.d.ts.map +1 -0
  150. package/dist/git-objects.js +152 -0
  151. package/dist/git-objects.js.map +1 -0
  152. package/dist/glob.d.ts +33 -14
  153. package/dist/glob.d.ts.map +1 -1
  154. package/dist/glob.js +96 -5
  155. package/dist/glob.js.map +1 -1
  156. package/dist/history.d.ts +52 -0
  157. package/dist/history.d.ts.map +1 -0
  158. package/dist/history.js +116 -0
  159. package/dist/history.js.map +1 -0
  160. package/dist/host-load.d.ts +49 -0
  161. package/dist/host-load.d.ts.map +1 -0
  162. package/dist/host-load.js +78 -0
  163. package/dist/host-load.js.map +1 -0
  164. package/dist/index.d.ts +4 -1
  165. package/dist/index.d.ts.map +1 -1
  166. package/dist/index.js +2 -1
  167. package/dist/index.js.map +1 -1
  168. package/dist/input-snapshot.d.ts +63 -9
  169. package/dist/input-snapshot.d.ts.map +1 -1
  170. package/dist/input-snapshot.js +195 -17
  171. package/dist/input-snapshot.js.map +1 -1
  172. package/dist/io.d.ts +49 -0
  173. package/dist/io.d.ts.map +1 -1
  174. package/dist/io.js +22 -0
  175. package/dist/io.js.map +1 -1
  176. package/dist/mapping.d.ts +84 -1
  177. package/dist/mapping.d.ts.map +1 -1
  178. package/dist/mapping.js +276 -5
  179. package/dist/mapping.js.map +1 -1
  180. package/dist/native-freeze.d.ts +217 -0
  181. package/dist/native-freeze.d.ts.map +1 -0
  182. package/dist/native-freeze.js +332 -0
  183. package/dist/native-freeze.js.map +1 -0
  184. package/dist/pipeline.d.ts +67 -1
  185. package/dist/pipeline.d.ts.map +1 -1
  186. package/dist/pipeline.js +164 -6
  187. package/dist/pipeline.js.map +1 -1
  188. package/dist/planes-inference.d.ts +12 -5
  189. package/dist/planes-inference.d.ts.map +1 -1
  190. package/dist/planes-inference.js +13 -15
  191. package/dist/planes-inference.js.map +1 -1
  192. package/dist/playwright-browsers.d.ts +210 -0
  193. package/dist/playwright-browsers.d.ts.map +1 -0
  194. package/dist/playwright-browsers.js +364 -0
  195. package/dist/playwright-browsers.js.map +1 -0
  196. package/dist/plugins.d.ts +15 -5
  197. package/dist/plugins.d.ts.map +1 -1
  198. package/dist/plugins.js +59 -9
  199. package/dist/plugins.js.map +1 -1
  200. package/dist/progress.d.ts +148 -0
  201. package/dist/progress.d.ts.map +1 -0
  202. package/dist/progress.js +263 -0
  203. package/dist/progress.js.map +1 -0
  204. package/dist/providers.d.ts +26 -1
  205. package/dist/providers.d.ts.map +1 -1
  206. package/dist/providers.js +39 -0
  207. package/dist/providers.js.map +1 -1
  208. package/dist/receipts.d.ts +1 -0
  209. package/dist/receipts.d.ts.map +1 -1
  210. package/dist/receipts.js +35 -7
  211. package/dist/receipts.js.map +1 -1
  212. package/dist/repo-scan.d.ts +15 -1
  213. package/dist/repo-scan.d.ts.map +1 -1
  214. package/dist/repo-scan.js +329 -34
  215. package/dist/repo-scan.js.map +1 -1
  216. package/dist/reseal-chain.d.ts +184 -0
  217. package/dist/reseal-chain.d.ts.map +1 -0
  218. package/dist/reseal-chain.js +735 -0
  219. package/dist/reseal-chain.js.map +1 -0
  220. package/dist/reseal-evidence.d.ts +241 -0
  221. package/dist/reseal-evidence.d.ts.map +1 -0
  222. package/dist/reseal-evidence.js +319 -0
  223. package/dist/reseal-evidence.js.map +1 -0
  224. package/dist/reseal.d.ts +181 -0
  225. package/dist/reseal.d.ts.map +1 -0
  226. package/dist/reseal.js +1620 -0
  227. package/dist/reseal.js.map +1 -0
  228. package/dist/response-field-guidance.d.ts +82 -0
  229. package/dist/response-field-guidance.d.ts.map +1 -0
  230. package/dist/response-field-guidance.js +184 -0
  231. package/dist/response-field-guidance.js.map +1 -0
  232. package/dist/route-plane-proposals.d.ts +100 -0
  233. package/dist/route-plane-proposals.d.ts.map +1 -0
  234. package/dist/route-plane-proposals.js +213 -0
  235. package/dist/route-plane-proposals.js.map +1 -0
  236. package/dist/run-cache.d.ts +260 -0
  237. package/dist/run-cache.d.ts.map +1 -0
  238. package/dist/run-cache.js +771 -0
  239. package/dist/run-cache.js.map +1 -0
  240. package/dist/run-preflight.d.ts +77 -0
  241. package/dist/run-preflight.d.ts.map +1 -0
  242. package/dist/run-preflight.js +774 -0
  243. package/dist/run-preflight.js.map +1 -0
  244. package/dist/run-recipe.d.ts +107 -0
  245. package/dist/run-recipe.d.ts.map +1 -0
  246. package/dist/run-recipe.js +295 -0
  247. package/dist/run-recipe.js.map +1 -0
  248. package/dist/run-reliability.d.ts +126 -0
  249. package/dist/run-reliability.d.ts.map +1 -0
  250. package/dist/run-reliability.js +221 -0
  251. package/dist/run-reliability.js.map +1 -0
  252. package/dist/runtime.d.ts +15 -0
  253. package/dist/runtime.d.ts.map +1 -1
  254. package/dist/runtime.js +11 -1
  255. package/dist/runtime.js.map +1 -1
  256. package/dist/scope.d.ts +20 -0
  257. package/dist/scope.d.ts.map +1 -1
  258. package/dist/scope.js +26 -5
  259. package/dist/scope.js.map +1 -1
  260. package/dist/secret-guard.d.ts +36 -0
  261. package/dist/secret-guard.d.ts.map +1 -0
  262. package/dist/secret-guard.js +63 -0
  263. package/dist/secret-guard.js.map +1 -0
  264. package/dist/singleton-guidance.d.ts +82 -0
  265. package/dist/singleton-guidance.d.ts.map +1 -0
  266. package/dist/singleton-guidance.js +138 -0
  267. package/dist/singleton-guidance.js.map +1 -0
  268. package/dist/staged-candidate.d.ts +17 -0
  269. package/dist/staged-candidate.d.ts.map +1 -1
  270. package/dist/staged-candidate.js +50 -0
  271. package/dist/staged-candidate.js.map +1 -1
  272. package/dist/state-artifacts.d.ts +70 -0
  273. package/dist/state-artifacts.d.ts.map +1 -0
  274. package/dist/state-artifacts.js +215 -0
  275. package/dist/state-artifacts.js.map +1 -0
  276. package/dist/state.d.ts +170 -2
  277. package/dist/state.d.ts.map +1 -1
  278. package/dist/state.js +248 -8
  279. package/dist/state.js.map +1 -1
  280. package/dist/unmatched-routes.d.ts +60 -0
  281. package/dist/unmatched-routes.d.ts.map +1 -0
  282. package/dist/unmatched-routes.js +131 -0
  283. package/dist/unmatched-routes.js.map +1 -0
  284. package/dist/verifier-keys.d.ts +33 -2
  285. package/dist/verifier-keys.d.ts.map +1 -1
  286. package/dist/verifier-keys.js +95 -9
  287. package/dist/verifier-keys.js.map +1 -1
  288. package/guides/CONNECT-YOUR-PROJECT.md +425 -0
  289. package/guides/QUICKSTART.md +306 -26
  290. package/guides/REFERENCE.md +1710 -0
  291. package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
  292. package/guides/TEST-ENVIRONMENT.md +1044 -6
  293. package/guides/UPGRADE-0.6-to-0.7.md +3 -3
  294. package/guides/UPGRADE-0.7-to-0.8.md +114 -0
  295. package/guides/UPGRADE-0.8-to-0.9.md +104 -0
  296. package/package.json +10 -9
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Adapter scaffolding: turning the compiled graph + route inventory
3
+ * into a REVIEWED-CANDIDATE adapter per business resource.
4
+ *
5
+ * The rules this planner follows are the plan's, and they are the
6
+ * opposite of "just generate something that runs":
7
+ *
8
+ * - it NEVER overwrites: a resource that already has an adapter is
9
+ * reported as `exists` and left alone;
10
+ * - it marks EVERY guess, in the generated file's own header, where a
11
+ * reviewer sees it before the file is ever run;
12
+ * - it refuses to write a file it cannot write honestly (unknown
13
+ * target fingerprint, no route to read from) and says why instead;
14
+ * - anything left for a human is listed as `needs you`, with the
15
+ * reason — the command prints it, the guide explains it;
16
+ * - it writes ONLY from routes the engine LINKED to the resource: a
17
+ * path that merely names it is a candidate for a human to confirm,
18
+ * and a route linked to a different resource is someone else's;
19
+ * - it never takes a route with a literal segment between the
20
+ * resource and its id as a by-id read (`/shipments/carrier/{id}`
21
+ * reads a carrier through a shipment);
22
+ * - it writes a LIST-ONLY adapter when the app serves a complete
23
+ * collection and no by-id route at all — the kit resolves the
24
+ * member out of the collection — and says in the header that this
25
+ * is slower than a real read;
26
+ * - a route that exists but whose endpoint plane is unanswered is
27
+ * NAMED with that blocker, never reported as absent.
28
+ */
29
+ import type { GraphResource, HttpRouteCandidate } from '@gate-forge/core';
30
+ import { type UnresolvedRoute } from './adapter-audit.js';
31
+ /** What the planner decided for one resource. */
32
+ export type ScaffoldStatus = 'create' | 'exists' | 'needs-you';
33
+ /** One resource's scaffolding decision. */
34
+ export interface ScaffoldPlan {
35
+ /** The plane-qualified resource id (also the adapter file name). */
36
+ resourceId: string;
37
+ /** Bare resource name, for messages. */
38
+ name: string;
39
+ /** What the planner decided. */
40
+ status: ScaffoldStatus;
41
+ /** The generated module text (`null` unless status is `create`). */
42
+ source: string | null;
43
+ /** Every guess baked into the generated file. */
44
+ guesses: string[];
45
+ /** What still needs a human, with the reason. */
46
+ needsYou: string[];
47
+ }
48
+ /** One business resource plus the adapter name it is bound to. */
49
+ export interface AdapterTarget {
50
+ /** The graph resource (raw id: a blocked resource has no bound id). */
51
+ resource: GraphResource;
52
+ /** The adapter file name the classifier expects. */
53
+ adapterId: string;
54
+ /** Proven delete semantics, or null when the classifier could not. */
55
+ deleteSemantics: 'hard' | 'archive' | null;
56
+ }
57
+ /** Everything the planner reads. */
58
+ export interface ScaffoldInput {
59
+ /** Business resources the classifier demands an adapter for. */
60
+ targets: readonly AdapterTarget[];
61
+ /** The compiled GET route inventory. */
62
+ routes: readonly HttpRouteCandidate[];
63
+ /** Adapter names already present in the adapters directory. */
64
+ existing: readonly string[];
65
+ /** The run's target fingerprint, when the environment declares one. */
66
+ environmentFingerprint: string | null;
67
+ /**
68
+ * GET routes the runtime inventory omits because the endpoint's
69
+ * plane is unanswered: the scaffolder names them instead of
70
+ * reporting the resource as unserved.
71
+ */
72
+ unresolvedRoutes: readonly UnresolvedRoute[];
73
+ /**
74
+ * Route paths no app mounts (the endpoint is declared by a standalone
75
+ * router): a path derived from one of these is marked as an explicit
76
+ * guess, never silently trusted.
77
+ */
78
+ standalonePaths: readonly string[];
79
+ }
80
+ /**
81
+ * Plans one adapter per business resource.
82
+ *
83
+ * Args:
84
+ * input: resources, resolved routes, plane-unanswered routes, existing
85
+ * adapter names, and the target fingerprint.
86
+ *
87
+ * Returns:
88
+ * ScaffoldPlan[]: one decision per resource, sorted by resource id.
89
+ */
90
+ export declare function planAdapters(input: ScaffoldInput): ScaffoldPlan[];
91
+ //# sourceMappingURL=adapter-scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-scaffold.d.ts","sourceRoot":"","sources":["../src/adapter-scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,oBAAoB,CAAC;AAE5B,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAE/D,2CAA2C;AAC3C,MAAM,WAAW,YAAY;IAC3B,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,oEAAoE;IACpE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,iDAAiD;IACjD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,QAAQ,EAAE,aAAa,CAAC;IACxB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,eAAe,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC5C;AAED,oCAAoC;AACpC,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,wCAAwC;IACxC,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtC,+DAA+D;IAC/D,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,uEAAuE;IACvE,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;;OAIG;IACH,gBAAgB,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C;;;;OAIG;IACH,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAiPD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,EAAE,CA0SjE"}
@@ -0,0 +1,474 @@
1
+ import { literalTailAfterResource, routesForResource, splitRoutePath, unresolvedRoutesForResource, } from './adapter-audit.js';
2
+ /**
3
+ * Renders the guess block of a generated file.
4
+ *
5
+ * Args:
6
+ * resourceId: the resource the adapter proves.
7
+ * guesses: every guess baked into the file.
8
+ * notice: the shape warning the header carries above the guess list
9
+ * (a list-only adapter reads every member out of the collection,
10
+ * and that must be visible in the file itself).
11
+ *
12
+ * Returns:
13
+ * string: the header comment (empty guesses render as a single line).
14
+ */
15
+ function guessComment(resourceId, guesses, notice) {
16
+ const lines = [
17
+ '/**',
18
+ ` * ${resourceId} — GENERATED by \`gateforge adapters scaffold\`.`,
19
+ ' *',
20
+ ' * A STARTING POINT, never proof: the gate grades this file exactly',
21
+ ' * like a hand-written adapter. Review every line below before you',
22
+ ' * trust it, and run `gateforge adapters check --probe` afterwards.',
23
+ ' *',
24
+ ...(notice === undefined
25
+ ? []
26
+ : [' *', ...notice.split('\n').map((line) => ` * ${line}`), ' *']),
27
+ ' * Guesses in this file:',
28
+ ...(guesses.length === 0
29
+ ? [' * (none — every value below was derived from the compiled graph)']
30
+ : guesses.map((guess, index) => ` * ${String(index + 1)}. ${guess}`)),
31
+ ' */',
32
+ ];
33
+ return lines.join('\n');
34
+ }
35
+ /**
36
+ * Whether a route's literal prefix still carries an INNER positional
37
+ * segment (e.g. `/api/v1/contracts/:contractId/invoices`).
38
+ *
39
+ * Args:
40
+ * prefix: the literal prefix `splitRoutePath` left behind.
41
+ *
42
+ * Returns:
43
+ * boolean: true when a parameter sits before the collection name.
44
+ */
45
+ function hasInnerParam(prefix) {
46
+ return prefix
47
+ .split('/')
48
+ .some((segment) => segment.startsWith(':') || segment === '{}');
49
+ }
50
+ /** Column names that usually mark a soft-deleted row, not a removed one. */
51
+ const SOFT_DELETE_COLUMNS = {
52
+ is_active: true,
53
+ active: true,
54
+ archived: true,
55
+ archived_at: true,
56
+ deleted_at: true,
57
+ is_deleted: true,
58
+ };
59
+ /** Column-name fragments that mark a credential, never a projected field. */
60
+ const SECRET_COLUMN_PATTERN = /password|secret|token|hash|api[-_]?key|private[-_]?key/;
61
+ /** Attribute keys a detector may use to mark columns as non-projectable. */
62
+ const SECRET_COLUMN_KEYS = [
63
+ 'secretColumns',
64
+ 'secretFields',
65
+ 'sensitiveFields',
66
+ 'nonProjectableFields',
67
+ ];
68
+ /**
69
+ * The business fields a scaffolder can honestly project, and the
70
+ * declared columns it deliberately left out.
71
+ *
72
+ * Every column the graph declares for the table is projected — the
73
+ * obligations observe read-only columns and foreign keys, not only
74
+ * the updateable ones — except the primary key (that IS the id) and
75
+ * the columns that must never leave the app.
76
+ *
77
+ * Args:
78
+ * resource: the business resource.
79
+ *
80
+ * Returns:
81
+ * {fields: string[], excluded: string[]}: the projected columns and
82
+ * the excluded ones, each sorted and deduplicated.
83
+ */
84
+ function projectedFields(resource) {
85
+ // The primary key IS the entity id, so it is never a projected
86
+ // field — whichever layer declared it (the classification, or the
87
+ // table's own primary-key facts).
88
+ const primaryKey = new Set([
89
+ ...(resource.classification?.primaryKey ?? []),
90
+ ...attributeColumns(resource.attributes['primaryKeyColumns'], 'name'),
91
+ ]);
92
+ const declaredSecrets = new Set(SECRET_COLUMN_KEYS.flatMap((key) => attributeColumns(resource.attributes[key], 'name')));
93
+ const fields = [];
94
+ const excluded = [];
95
+ for (const column of declaredColumns(resource)) {
96
+ const isSecret = declaredSecrets.has(column) || SECRET_COLUMN_PATTERN.test(column.toLowerCase());
97
+ if (primaryKey.has(column) || isSecret)
98
+ excluded.push(column);
99
+ else
100
+ fields.push(column);
101
+ }
102
+ return { fields, excluded };
103
+ }
104
+ /**
105
+ * Reads column names out of one column-bearing graph attribute, in
106
+ * either of the two shapes a detector emits: bare names, or records
107
+ * that carry the name under `name` / `column`.
108
+ *
109
+ * Args:
110
+ * value: the raw attribute value (never trusted).
111
+ * key: the property holding the name for the record shape.
112
+ *
113
+ * Returns:
114
+ * string[]: every non-empty column name in the attribute.
115
+ */
116
+ function attributeColumns(value, key) {
117
+ if (!Array.isArray(value))
118
+ return [];
119
+ const names = [];
120
+ for (const entry of value) {
121
+ if (typeof entry === 'string') {
122
+ if (entry.length > 0)
123
+ names.push(entry);
124
+ continue;
125
+ }
126
+ if (typeof entry === 'object' && entry !== null && key in entry) {
127
+ const name = entry[key];
128
+ if (typeof name === 'string' && name.length > 0)
129
+ names.push(name);
130
+ }
131
+ }
132
+ return names;
133
+ }
134
+ /**
135
+ * Every column the compiled graph declares for one table.
136
+ *
137
+ * Detectors own their attribute vocabulary, so this reads the
138
+ * column-bearing attributes the graph actually carries: the full
139
+ * column list a detector emits (`columnNames` / `columns`), the
140
+ * primary-key, foreign-key, soft-delete and updateable field facts,
141
+ * and the classification's own identity/updateable declarations.
142
+ *
143
+ * Args:
144
+ * resource: the business resource.
145
+ *
146
+ * Returns:
147
+ * string[]: the declared column names, sorted and deduplicated.
148
+ */
149
+ function declaredColumns(resource) {
150
+ const attributes = resource.attributes;
151
+ const columns = [
152
+ ...attributeColumns(attributes['columnNames'], 'name'),
153
+ ...attributeColumns(attributes['columns'], 'name'),
154
+ ...attributeColumns(attributes['primaryKeyColumns'], 'name'),
155
+ ...attributeColumns(attributes['foreignKeyReferences'], 'column'),
156
+ ...attributeColumns(attributes['softDeleteCandidateFields'], 'name'),
157
+ ...attributeColumns(attributes['updateableFields'], 'name'),
158
+ ...(resource.classification?.primaryKey ?? []),
159
+ ...(resource.classification?.lifecycle.updateableFields ?? []),
160
+ ];
161
+ return [...new Set(columns)].sort();
162
+ }
163
+ /**
164
+ * How the table's delete semantics look to the graph.
165
+ *
166
+ * Args:
167
+ * resource: the business resource.
168
+ *
169
+ * Returns:
170
+ * {declared: string[], lookalike: string[]}: the columns the graph
171
+ * itself declares as soft-delete evidence (authoritative), and the
172
+ * columns that merely LOOK like one (a question for the human).
173
+ */
174
+ function softDeleteSignal(resource) {
175
+ const declared = attributeColumns(resource.attributes['softDeleteCandidateFields'], 'name').sort();
176
+ if (declared.length > 0)
177
+ return { declared, lookalike: [] };
178
+ const lookalike = declaredColumns(resource).filter((column) => SOFT_DELETE_COLUMNS[column.toLowerCase()] === true);
179
+ return { declared, lookalike };
180
+ }
181
+ /**
182
+ * Renders a JS string literal for generated source.
183
+ *
184
+ * Args:
185
+ * value: the literal value.
186
+ *
187
+ * Returns:
188
+ * string: the quoted literal.
189
+ */
190
+ function literal(value) {
191
+ return JSON.stringify(value);
192
+ }
193
+ /**
194
+ * The header paragraph a list-only adapter carries, so the reviewer who
195
+ * opens the file sees the cost before the code: the kit resolves every
196
+ * member out of the complete collection, which is slower than a by-id
197
+ * read and only correct while the collection returns every row.
198
+ */
199
+ const LIST_ONLY_NOTICE = [
200
+ 'LIST-ONLY: the app serves no by-id route for this resource, so every read',
201
+ 'walks the COMPLETE collection and picks the member out of it. That is',
202
+ 'slower than a by-id read, and it is only correct while the collection',
203
+ 'really returns every row. Add readPath as soon as the app serves one.',
204
+ ].join('\n');
205
+ /**
206
+ * The one line that says a route EXISTS and names what actually blocks
207
+ * it: an endpoint with no plane has no graph id, so the runtime route
208
+ * inventory never carries it (GF-12). Reporting such a resource as
209
+ * unserved is the false negative this replaces.
210
+ *
211
+ * Args:
212
+ * entries: the compiled routes held back by the unanswered plane.
213
+ *
214
+ * Returns:
215
+ * string: the `needs you` line.
216
+ */
217
+ function planeBlocker(entries) {
218
+ const listed = entries.map((entry) => `GET ${entry.route.canonicalPath}`).sort();
219
+ const many = listed.length > 1;
220
+ return (`${listed.join(', ')} ${many ? 'exist' : 'exists'} but ` +
221
+ `${many ? 'their' : 'its'} plane is unanswered, so the route inventory never carries ` +
222
+ `${many ? 'them' : 'it'}: answer the plane first (\`gateforge classify plane <path>\`), then re-run`);
223
+ }
224
+ /**
225
+ * Plans one adapter per business resource.
226
+ *
227
+ * Args:
228
+ * input: resources, resolved routes, plane-unanswered routes, existing
229
+ * adapter names, and the target fingerprint.
230
+ *
231
+ * Returns:
232
+ * ScaffoldPlan[]: one decision per resource, sorted by resource id.
233
+ */
234
+ export function planAdapters(input) {
235
+ const existing = new Set(input.existing);
236
+ // Route paths no app mounts: a path derived from one of these is a
237
+ // guess the reviewer must confirm, never a silent value.
238
+ const unmounted = new Set(input.standalonePaths);
239
+ const plans = [];
240
+ for (const target of input.targets) {
241
+ const { resource } = target;
242
+ const resourceId = target.adapterId;
243
+ const guesses = [];
244
+ const needsYou = [];
245
+ if (existing.has(resourceId)) {
246
+ plans.push({
247
+ resourceId,
248
+ name: resource.name,
249
+ status: 'exists',
250
+ source: null,
251
+ guesses: [],
252
+ needsYou: [],
253
+ });
254
+ continue;
255
+ }
256
+ // Only LINKED routes may produce a file. A path that merely NAMES
257
+ // the resource is a candidate for a human to confirm, and a route
258
+ // the engine linked to a DIFFERENT resource is someone else's.
259
+ const { linked, candidates } = routesForResource(resource, input.routes);
260
+ if (linked.length > 0) {
261
+ guesses.push(`routes linked to '${resource.name}' by the compiled graph (${linked
262
+ .map((route) => `GET ${route.canonicalPath}`)
263
+ .sort()
264
+ .join(', ')})`);
265
+ }
266
+ // A route with an INNER parameter is scoped to a parent: it is never
267
+ // the complete collection of the resource, and never a by-id read of
268
+ // the resource itself. A LITERAL segment between the resource
269
+ // segment and the id reads something else THROUGH the resource
270
+ // (`/shipments/carrier/{id}` looks a carrier up through a
271
+ // shipment), so it is never the resource's own by-id read either.
272
+ const entries = linked.map((route) => ({
273
+ route,
274
+ split: splitRoutePath(route.canonicalPath),
275
+ }));
276
+ // The same shapes, one blocker earlier: real compiled routes the
277
+ // runtime inventory cannot carry because their plane is unanswered.
278
+ const behindPlane = unresolvedRoutesForResource(resource, input.unresolvedRoutes).map((route) => ({
279
+ route,
280
+ split: splitRoutePath(route.canonicalPath),
281
+ }));
282
+ const literalTail = (entry) => literalTailAfterResource(entry.split.prefix, resource.name);
283
+ const atOwnLevel = (entry) => !hasInnerParam(entry.split.prefix) && literalTail(entry).length === 0;
284
+ const reads = entries.filter((entry) => entry.split.idSegments.length > 0 && atOwnLevel(entry));
285
+ const collections = entries.filter((entry) => entry.split.idSegments.length === 0 && atOwnLevel(entry));
286
+ const perParent = entries.filter((entry) => hasInnerParam(entry.split.prefix));
287
+ const perParentReads = perParent.filter((entry) => entry.split.idSegments.length > 0);
288
+ const subResourceReads = entries.filter((entry) => entry.split.idSegments.length > 0 &&
289
+ !hasInnerParam(entry.split.prefix) &&
290
+ literalTail(entry).length > 0);
291
+ const behindPlaneReads = behindPlane.filter((entry) => entry.split.idSegments.length > 0 && atOwnLevel(entry));
292
+ const behindPlaneCollections = behindPlane.filter((entry) => entry.split.idSegments.length === 0 && atOwnLevel(entry));
293
+ // A by-id route at the resource's OWN level that nothing linked to
294
+ // it still counts as "the app serves a by-id read": the list-only
295
+ // shape must not be written silently over it. A per-parent or
296
+ // sub-resource path does not — that is not a by-id read at all.
297
+ const unlinkedReads = candidates.filter((route) => {
298
+ const split = splitRoutePath(route.canonicalPath);
299
+ return (split.idSegments.length > 0 &&
300
+ !hasInnerParam(split.prefix) &&
301
+ literalTailAfterResource(split.prefix, resource.name).length === 0);
302
+ });
303
+ const softDelete = softDeleteSignal(resource);
304
+ const singleReads = reads.filter((entry) => entry.split.idSegments.length === 1);
305
+ const collectionFirst = collections[0];
306
+ // One resource's read and collection share a prefix; when both are
307
+ // derivable, prefer that pair over any other shape.
308
+ const byId = singleReads.find((entry) => entry.split.prefix === collectionFirst?.split.prefix) ??
309
+ singleReads[0];
310
+ const composite = reads.find((entry) => entry.split.idSegments.length > 1);
311
+ const collection = byId === undefined
312
+ ? collectionFirst
313
+ : (collections.find((entry) => entry.split.prefix === byId.split.prefix) ?? collectionFirst);
314
+ // The kit resolves a member out of the COMPLETE collection, so a
315
+ // resource with a collection and no by-id route at all can be
316
+ // scaffolded as a list-only adapter. A REJECTED or unlinked by-id
317
+ // shape is not that case: something looks like a read, and a human
318
+ // must say which route really reads the entity.
319
+ const listOnlyAllowed = byId === undefined &&
320
+ composite === undefined &&
321
+ behindPlaneReads.length === 0 &&
322
+ subResourceReads.length === 0 &&
323
+ perParentReads.length === 0 &&
324
+ unlinkedReads.length === 0;
325
+ if (byId === undefined && behindPlaneReads.length === 0) {
326
+ if (subResourceReads.length > 0) {
327
+ needsYou.push(`these routes add a literal segment after ${resource.name}, so they read something else ` +
328
+ `through the resource (${subResourceReads
329
+ .map((entry) => `GET ${entry.route.canonicalPath}`)
330
+ .sort()
331
+ .join(', ')}): declare readPath yourself — a sub-resource path is never a by-id read`);
332
+ }
333
+ else if (perParentReads.length > 0) {
334
+ needsYou.push(`every by-id route for ${resource.name} is a per-parent route (${perParentReads
335
+ .map((entry) => `GET ${entry.route.canonicalPath}`)
336
+ .sort()
337
+ .join(', ')}): a per-parent read is not a by-id read of the resource — declare ` +
338
+ 'readPath yourself');
339
+ }
340
+ else {
341
+ needsYou.push(composite === undefined
342
+ ? `no GET route serves one ${resource.name} entity: declare readPath yourself — the ` +
343
+ 'adapter cannot read an entity without one'
344
+ : `the by-id route serves a COMPOSITE key ` +
345
+ `(${composite.split.idSegments.join(', ')}): declare readPath as a function of the ` +
346
+ 'composite key yourself');
347
+ }
348
+ }
349
+ if (collection === undefined && behindPlaneCollections.length === 0) {
350
+ const perParentCollections = perParent.filter((entry) => entry.split.idSegments.length === 0);
351
+ needsYou.push(perParentCollections.length > 0
352
+ ? `only per-parent collections serve ${resource.name} (${perParentCollections
353
+ .map((entry) => `GET ${entry.route.canonicalPath}`)
354
+ .sort()
355
+ .join(', ')}): a sub-collection is never the complete collection — declare ` +
356
+ 'listPath / listCollection yourself'
357
+ : `no GET collection route serves ${resource.name}: a create cannot be witnessed without a ` +
358
+ 'complete collection read (ADAPTER_CANNOT_WITNESS) — declare listPath yourself');
359
+ }
360
+ if (input.environmentFingerprint === null) {
361
+ needsYou.push('the target environment fingerprint is unknown: export GATEFORGE_TARGET_FINGERPRINT (the ' +
362
+ 'value the app presents in the x-gateforge-env-fingerprint header) and re-run');
363
+ }
364
+ // A path that merely NAMES the resource is never turned into a
365
+ // written readPath: the candidates are listed so a human can say
366
+ // which route serves the entity (GF-18).
367
+ if (candidates.length > 0 && byId === undefined) {
368
+ needsYou.push(`nothing is written from a name match: no schema or handler evidence links a by-id route to ` +
369
+ `${resource.name}, so the scaffolder will not turn one of these into a readPath — ` +
370
+ `confirm which serves the entity: ${candidates
371
+ .map((route) => `GET ${route.canonicalPath}`)
372
+ .sort()
373
+ .join(', ')}. Then link it (or declare readPath / listPath yourself)`);
374
+ }
375
+ if (target.deleteSemantics === null &&
376
+ softDelete.declared.length === 0 &&
377
+ softDelete.lookalike.length > 0) {
378
+ needsYou.push(`table has ${softDelete.lookalike.join(', ')}: if DELETE archives instead of removing, set ` +
379
+ "deletion: 'archive' — the graph declares no delete semantics, so the generated value is a " +
380
+ 'guess');
381
+ }
382
+ if (byId !== undefined || collection !== undefined) {
383
+ needsYou.push('reads may need authentication: if the app answers 401, declare auth.seats with the ' +
384
+ 'witness environment variables holding the credentials');
385
+ }
386
+ // A file is written when the kit can observe the resource at all:
387
+ // through a by-id read, or (a list-only adapter) through the
388
+ // complete collection when the app genuinely serves no by-id route.
389
+ if (input.environmentFingerprint === null ||
390
+ collection === undefined ||
391
+ (byId === undefined && !listOnlyAllowed)) {
392
+ if (behindPlane.length > 0) {
393
+ needsYou.unshift(planeBlocker(behindPlane));
394
+ }
395
+ plans.push({
396
+ resourceId,
397
+ name: resource.name,
398
+ status: 'needs-you',
399
+ source: null,
400
+ guesses,
401
+ needsYou,
402
+ });
403
+ continue;
404
+ }
405
+ const readPath = byId === undefined ? null : byId.split.prefix + '/{id}';
406
+ const listOnly = readPath === null;
407
+ const listPath = collection.route.canonicalPath;
408
+ const { fields, excluded } = projectedFields(resource);
409
+ if (fields.length === 0) {
410
+ needsYou.push(`the graph declares no columns for ${resource.name} beyond its primary key and secrets: add the ` +
411
+ 'business fields the obligations grade — a response-only computed field is the human’s call');
412
+ }
413
+ const deletion = target.deleteSemantics ?? (softDelete.declared.length > 0 ? 'archive' : 'hard');
414
+ if (byId !== undefined) {
415
+ guesses.push(`readPath '${byId.split.prefix}/{id}' guessed from GET ${byId.route.canonicalPath}`);
416
+ }
417
+ for (const [role, source] of [
418
+ ...(byId === undefined ? [] : [['readPath', byId.route.canonicalPath]]),
419
+ ['listPath', collection.route.canonicalPath],
420
+ ]) {
421
+ if (!unmounted.has(source))
422
+ continue;
423
+ guesses.push(`${role} taken from GET ${source}, which no app mounts (the router is never included): the ` +
424
+ 'route exists in the source tree but nothing serves it — confirm it before trusting this path');
425
+ needsYou.push(`GET ${source} is declared by a router no app mounts: the generated ${role} points at a ` +
426
+ 'route nothing serves — confirm the path, or declare the mounted one yourself');
427
+ }
428
+ if (readPath === null) {
429
+ guesses.push(`readPath omitted: no linked GET route serves one ${resource.name} entity, so the kit ` +
430
+ 'resolves each member out of the complete collection — add readPath as soon as the app ' +
431
+ 'serves a by-id route');
432
+ }
433
+ guesses.push(`listPath '${listPath}' guessed from GET ${collection.route.canonicalPath}`);
434
+ guesses.push('collectionKey guessed as the first array in the response body — replace it with the exact key');
435
+ guesses.push(`paging guessed as page/page_size (a single page would hide rows behind page 1)`);
436
+ guesses.push(fields.length === 0
437
+ ? 'no fields could be derived; add the business fields the obligations grade'
438
+ : `fields [${fields.join(', ')}] derived from every column the compiled graph declares for ` +
439
+ `${resource.name}` +
440
+ (excluded.length === 0 ? '' : ` (excluded: ${excluded.join(', ')})`));
441
+ guesses.push('itemWrapper guessed as none (the response body IS the entity)');
442
+ guesses.push(target.deleteSemantics !== null
443
+ ? `deletion '${deletion}' taken from the classification's delete semantics`
444
+ : softDelete.declared.length > 0
445
+ ? `deletion '${deletion}' taken from the graph's soft-delete signal (${softDelete.declared.join(', ')}), ` +
446
+ 'which is a guess about the endpoint: confirm the endpoint archives the row'
447
+ : softDelete.lookalike.length > 0
448
+ ? `deletion '${deletion}' GUESSED: the table has ${softDelete.lookalike.join(', ')}, ` +
449
+ 'which usually means a soft delete — confirm whether the endpoint hard-deletes or archives'
450
+ : `deletion '${deletion}' GUESSED: the classifier could not prove the delete semantics, so ` +
451
+ 'confirm whether the resource hard-deletes or archives');
452
+ guesses.push('environmentFingerprint taken from GATEFORGE_TARGET_FINGERPRINT (the run target marker)');
453
+ const source = [
454
+ guessComment(resourceId, guesses, listOnly ? LIST_ONLY_NOTICE : undefined),
455
+ '',
456
+ "import { defineHttpAdapter, firstArrayOf } from '@gate-forge/witness/adapter-kit';",
457
+ '',
458
+ 'export default defineHttpAdapter({',
459
+ ` resourceId: ${literal(resourceId)},`,
460
+ ...(readPath === null ? [] : [` readPath: ${literal(readPath)},`]),
461
+ ` listPath: ${literal(listPath)},`,
462
+ ' collectionKey: firstArrayOf,',
463
+ ' paging: { kind: \'page\', pageSize: 100 },',
464
+ ` fields: [${fields.map((field) => literal(field)).join(', ')}],`,
465
+ ` deletion: ${literal(deletion)},`,
466
+ ` environmentFingerprint: ${literal(input.environmentFingerprint)},`,
467
+ '});',
468
+ '',
469
+ ].join('\n');
470
+ plans.push({ resourceId, name: resource.name, status: 'create', source, guesses, needsYou });
471
+ }
472
+ return plans.sort((a, b) => (a.resourceId < b.resourceId ? -1 : a.resourceId > b.resourceId ? 1 : 0));
473
+ }
474
+ //# sourceMappingURL=adapter-scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-scaffold.js","sourceRoot":"","sources":["../src/adapter-scaffold.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAuD5B;;;;;;;;;;;;GAYG;AACH,SAAS,YAAY,CACnB,UAAkB,EAClB,OAA0B,EAC1B,MAAe;IAEf,MAAM,KAAK,GAAG;QACZ,KAAK;QACL,MAAM,UAAU,kDAAkD;QAClE,IAAI;QACJ,qEAAqE;QACrE,oEAAoE;QACpE,qEAAqE;QACrE,IAAI;QACJ,GAAG,CAAC,MAAM,KAAK,SAAS;YACtB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACpE,0BAA0B;QAC1B,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YACtB,CAAC,CAAC,CAAC,qEAAqE,CAAC;YACzE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CA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O,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAAG;YACrE,KAAK;YACL,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxG,CAAC"}
@@ -12,9 +12,19 @@
12
12
  * carries it. A pre-layer receipt (no `classificationBlocked` field) is
13
13
  * simply NOT ADOPTED for that layer — nothing classification-shaped is
14
14
  * waived without the recorded set (fail closed, backward compatible).
15
+ *
16
+ * Args:
17
+ * cwd: repository root.
18
+ * baselinesPath: configured baseline path.
19
+ *
20
+ * Returns:
21
+ * adopted baseline fingerprint and identity metadata, or null when not adopted.
15
22
  */
16
23
  export declare function resolveAdoptedBaseline(cwd: string, baselinesPath: string): {
17
24
  fingerprints: ReadonlySet<string>;
18
25
  classificationBlocked?: ReadonlySet<string>;
26
+ adoptedAt: string;
27
+ obligationFingerprintsById?: ReadonlyMap<string, string>;
28
+ obligationSourcesById?: ReadonlyMap<string, readonly string[]>;
19
29
  } | null;
20
30
  //# sourceMappingURL=adopted-baseline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adopted-baseline.d.ts","sourceRoot":"","sources":["../src/adopted-baseline.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GACpB;IAAE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAAC,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAAE,GAAG,IAAI,CAW3F"}
1
+ {"version":3,"file":"adopted-baseline.d.ts","sourceRoot":"","sources":["../src/adopted-baseline.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GAEnB;IACE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;CAChE,GACD,IAAI,CA+BP"}
@@ -29,17 +29,34 @@ import { resolveRepoPath } from './pipeline.js';
29
29
  * carries it. A pre-layer receipt (no `classificationBlocked` field) is
30
30
  * simply NOT ADOPTED for that layer — nothing classification-shaped is
31
31
  * waived without the recorded set (fail closed, backward compatible).
32
+ *
33
+ * Args:
34
+ * cwd: repository root.
35
+ * baselinesPath: configured baseline path.
36
+ *
37
+ * Returns:
38
+ * adopted baseline fingerprint and identity metadata, or null when not adopted.
32
39
  */
33
40
  export function resolveAdoptedBaseline(cwd, baselinesPath) {
34
41
  const baselinePath = resolveRepoPath(cwd, baselinesPath);
35
42
  const adoption = loadAdoptionRecord(join(dirname(baselinePath), ADOPTION_RECORD_FILENAME));
36
43
  if (adoption === null)
37
44
  return null;
45
+ const fingerprints = new Set(loadBaseline(baselinePath).fingerprints);
46
+ const obligationFingerprintsById = adoption.obligationFingerprintsById === undefined
47
+ ? undefined
48
+ : new Map(Object.entries(adoption.obligationFingerprintsById).filter(([, fingerprint]) => fingerprints.has(fingerprint)));
49
+ const obligationSourcesById = adoption.obligationSourcesById === undefined || obligationFingerprintsById === undefined
50
+ ? undefined
51
+ : new Map(Object.entries(adoption.obligationSourcesById).filter(([id]) => obligationFingerprintsById.has(id)));
38
52
  return {
39
- fingerprints: new Set(loadBaseline(baselinePath).fingerprints),
53
+ fingerprints,
40
54
  classificationBlocked: adoption.classificationBlocked !== undefined
41
55
  ? new Set(adoption.classificationBlocked)
42
56
  : undefined,
57
+ adoptedAt: adoption.adoptedAt,
58
+ obligationFingerprintsById,
59
+ obligationSourcesById,
43
60
  };
44
61
  }
45
62
  //# sourceMappingURL=adopted-baseline.js.map