semantic-atlas 0.3.0 → 1.0.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 (322) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +134 -166
  2. package/.agents/skills/semantic-atlas/agents/openai.yaml +4 -0
  3. package/.agents/skills/semantic-atlas/references/observations.md +131 -0
  4. package/.agents/skills/semantic-atlas/scripts/query-context.mjs +110 -0
  5. package/.agents/skills/semantic-atlas-maintenance/SKILL.md +93 -0
  6. package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +4 -0
  7. package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +56 -0
  8. package/README.md +134 -239
  9. package/dist/application/map-application.d.ts +24 -0
  10. package/dist/application/map-application.d.ts.map +1 -0
  11. package/dist/application/map-application.js +134 -0
  12. package/dist/application/map-application.js.map +1 -0
  13. package/dist/cli/bin.js +6 -35
  14. package/dist/cli/bin.js.map +1 -0
  15. package/dist/cli/observation-commands.d.ts +16 -0
  16. package/dist/cli/observation-commands.d.ts.map +1 -0
  17. package/dist/cli/observation-commands.js +118 -0
  18. package/dist/cli/observation-commands.js.map +1 -0
  19. package/dist/cli/projection-writer.d.ts +2 -0
  20. package/dist/cli/projection-writer.d.ts.map +1 -0
  21. package/dist/cli/projection-writer.js +9 -0
  22. package/dist/cli/projection-writer.js.map +1 -0
  23. package/dist/cli/reconciliation-command.d.ts +7 -0
  24. package/dist/cli/reconciliation-command.d.ts.map +1 -0
  25. package/dist/cli/reconciliation-command.js +33 -0
  26. package/dist/cli/reconciliation-command.js.map +1 -0
  27. package/dist/cli/run-cli.d.ts +21 -0
  28. package/dist/cli/run-cli.d.ts.map +1 -0
  29. package/dist/cli/run-cli.js +299 -0
  30. package/dist/cli/run-cli.js.map +1 -0
  31. package/dist/contracts/cli.d.ts +166 -1211
  32. package/dist/contracts/cli.d.ts.map +1 -1
  33. package/dist/contracts/cli.js +2 -232
  34. package/dist/contracts/cli.js.map +1 -0
  35. package/dist/contracts/insights.d.ts +39 -1
  36. package/dist/contracts/insights.d.ts.map +1 -1
  37. package/dist/contracts/insights.js +2 -1
  38. package/dist/contracts/insights.js.map +1 -0
  39. package/dist/contracts/map.d.ts +154 -0
  40. package/dist/contracts/map.d.ts.map +1 -0
  41. package/dist/contracts/map.js +60 -0
  42. package/dist/contracts/map.js.map +1 -0
  43. package/dist/contracts/observation.d.ts +649 -0
  44. package/dist/contracts/observation.d.ts.map +1 -0
  45. package/dist/contracts/observation.js +140 -0
  46. package/dist/contracts/observation.js.map +1 -0
  47. package/dist/contracts/projection.d.ts +7 -0
  48. package/dist/contracts/projection.d.ts.map +1 -0
  49. package/dist/contracts/projection.js +2 -0
  50. package/dist/contracts/projection.js.map +1 -0
  51. package/dist/contracts/reconciliation.d.ts +40 -0
  52. package/dist/contracts/reconciliation.d.ts.map +1 -0
  53. package/dist/contracts/reconciliation.js +2 -0
  54. package/dist/contracts/reconciliation.js.map +1 -0
  55. package/dist/index.d.ts +7 -17
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +3 -9
  58. package/dist/index.js.map +1 -0
  59. package/dist/insights/insight-service.d.ts +14 -0
  60. package/dist/insights/insight-service.d.ts.map +1 -0
  61. package/dist/insights/insight-service.js +129 -0
  62. package/dist/insights/insight-service.js.map +1 -0
  63. package/dist/map/business-graph.d.ts +32 -0
  64. package/dist/map/business-graph.d.ts.map +1 -0
  65. package/dist/map/business-graph.js +122 -0
  66. package/dist/map/business-graph.js.map +1 -0
  67. package/dist/map/map-document-loader.d.ts +13 -0
  68. package/dist/map/map-document-loader.d.ts.map +1 -0
  69. package/dist/map/map-document-loader.js +86 -0
  70. package/dist/map/map-document-loader.js.map +1 -0
  71. package/dist/map/map-validator.d.ts +12 -0
  72. package/dist/map/map-validator.d.ts.map +1 -0
  73. package/dist/map/map-validator.js +322 -0
  74. package/dist/map/map-validator.js.map +1 -0
  75. package/dist/observations/observation-application.d.ts +23 -0
  76. package/dist/observations/observation-application.d.ts.map +1 -0
  77. package/dist/observations/observation-application.js +62 -0
  78. package/dist/observations/observation-application.js.map +1 -0
  79. package/dist/observations/observation-claim-manager.d.ts +13 -0
  80. package/dist/observations/observation-claim-manager.d.ts.map +1 -0
  81. package/dist/observations/observation-claim-manager.js +247 -0
  82. package/dist/observations/observation-claim-manager.js.map +1 -0
  83. package/dist/observations/observation-store.d.ts +43 -0
  84. package/dist/observations/observation-store.d.ts.map +1 -0
  85. package/dist/observations/observation-store.js +208 -0
  86. package/dist/observations/observation-store.js.map +1 -0
  87. package/dist/observations/repository-identity.d.ts +12 -0
  88. package/dist/observations/repository-identity.d.ts.map +1 -0
  89. package/dist/observations/repository-identity.js +108 -0
  90. package/dist/observations/repository-identity.js.map +1 -0
  91. package/dist/query/context-query-service.d.ts +15 -0
  92. package/dist/query/context-query-service.d.ts.map +1 -0
  93. package/dist/query/context-query-service.js +36 -0
  94. package/dist/query/context-query-service.js.map +1 -0
  95. package/dist/reconciliation/reconciliation-service.d.ts +10 -0
  96. package/dist/reconciliation/reconciliation-service.d.ts.map +1 -0
  97. package/dist/reconciliation/reconciliation-service.js +116 -0
  98. package/dist/reconciliation/reconciliation-service.js.map +1 -0
  99. package/dist/rendering/map-projector.d.ts +8 -0
  100. package/dist/rendering/map-projector.d.ts.map +1 -0
  101. package/dist/rendering/map-projector.js +386 -0
  102. package/dist/rendering/map-projector.js.map +1 -0
  103. package/dist/setup/managed-skill-installer.d.ts +60 -0
  104. package/dist/setup/managed-skill-installer.d.ts.map +1 -0
  105. package/dist/setup/managed-skill-installer.js +307 -0
  106. package/dist/setup/managed-skill-installer.js.map +1 -0
  107. package/dist/setup/package-identity.d.ts +6 -0
  108. package/dist/setup/package-identity.d.ts.map +1 -0
  109. package/dist/setup/package-identity.js +16 -0
  110. package/dist/setup/package-identity.js.map +1 -0
  111. package/dist/setup/package-upgrader.d.ts +10 -22
  112. package/dist/setup/package-upgrader.d.ts.map +1 -1
  113. package/dist/setup/package-upgrader.js +60 -76
  114. package/dist/setup/package-upgrader.js.map +1 -0
  115. package/docs/architecture.md +428 -0
  116. package/docs/evaluation.md +220 -174
  117. package/docs/index.md +27 -40
  118. package/docs/map-format.md +224 -0
  119. package/docs/observations.md +175 -0
  120. package/docs/product-contract.md +295 -137
  121. package/examples/commerce.yaml +204 -0
  122. package/package.json +31 -30
  123. package/.agents/skills/semantic-atlas/references/graph-patch.md +0 -190
  124. package/.agents/skills/semantic-atlas/references/product-feedback.md +0 -34
  125. package/.agents/skills/semantic-atlas/references/result-routing.md +0 -104
  126. package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +0 -42
  127. package/.agents/skills/semantic-atlas-insights/SKILL.md +0 -55
  128. package/README.zh-CN.md +0 -273
  129. package/dist/business-flow/business-flow-derivation-service.d.ts +0 -11
  130. package/dist/business-flow/business-flow-derivation-service.d.ts.map +0 -1
  131. package/dist/business-flow/business-flow-derivation-service.js +0 -151
  132. package/dist/business-flow/business-flow-draft.d.ts +0 -16
  133. package/dist/business-flow/business-flow-draft.d.ts.map +0 -1
  134. package/dist/business-flow/business-flow-draft.js +0 -150
  135. package/dist/business-flow/framework-business-strategy.d.ts +0 -7
  136. package/dist/business-flow/framework-business-strategy.d.ts.map +0 -1
  137. package/dist/business-flow/framework-business-strategy.js +0 -1
  138. package/dist/business-flow/strategies/bullmq-business-strategy.d.ts +0 -10
  139. package/dist/business-flow/strategies/bullmq-business-strategy.d.ts.map +0 -1
  140. package/dist/business-flow/strategies/bullmq-business-strategy.js +0 -79
  141. package/dist/business-flow/strategies/called-operation-derivation.d.ts +0 -13
  142. package/dist/business-flow/strategies/called-operation-derivation.d.ts.map +0 -1
  143. package/dist/business-flow/strategies/called-operation-derivation.js +0 -32
  144. package/dist/business-flow/strategies/graphql-business-strategy.d.ts +0 -8
  145. package/dist/business-flow/strategies/graphql-business-strategy.d.ts.map +0 -1
  146. package/dist/business-flow/strategies/graphql-business-strategy.js +0 -65
  147. package/dist/business-flow/strategies/nestjs-business-strategy.d.ts +0 -8
  148. package/dist/business-flow/strategies/nestjs-business-strategy.d.ts.map +0 -1
  149. package/dist/business-flow/strategies/nestjs-business-strategy.js +0 -72
  150. package/dist/business-flow/strategies/strategy-helpers.d.ts +0 -32
  151. package/dist/business-flow/strategies/strategy-helpers.d.ts.map +0 -1
  152. package/dist/business-flow/strategies/strategy-helpers.js +0 -49
  153. package/dist/business-flow/strategies/typeorm-business-strategy.d.ts +0 -10
  154. package/dist/business-flow/strategies/typeorm-business-strategy.d.ts.map +0 -1
  155. package/dist/business-flow/strategies/typeorm-business-strategy.js +0 -136
  156. package/dist/business-flow/strategies/verified-invariant-strategy.d.ts +0 -5
  157. package/dist/business-flow/strategies/verified-invariant-strategy.d.ts.map +0 -1
  158. package/dist/business-flow/strategies/verified-invariant-strategy.js +0 -38
  159. package/dist/business-flow/strategies/verified-test-strategy.d.ts +0 -5
  160. package/dist/business-flow/strategies/verified-test-strategy.d.ts.map +0 -1
  161. package/dist/business-flow/strategies/verified-test-strategy.js +0 -26
  162. package/dist/business-flow/structural-flow-catalog.d.ts +0 -21
  163. package/dist/business-flow/structural-flow-catalog.d.ts.map +0 -1
  164. package/dist/business-flow/structural-flow-catalog.js +0 -125
  165. package/dist/business-flow/types.d.ts +0 -51
  166. package/dist/business-flow/types.d.ts.map +0 -1
  167. package/dist/business-flow/types.js +0 -1
  168. package/dist/cli/argument-parser.d.ts +0 -3
  169. package/dist/cli/argument-parser.d.ts.map +0 -1
  170. package/dist/cli/argument-parser.js +0 -200
  171. package/dist/cli/cli-application.d.ts +0 -39
  172. package/dist/cli/cli-application.d.ts.map +0 -1
  173. package/dist/cli/cli-application.js +0 -571
  174. package/dist/cli/cli-error.d.ts +0 -12
  175. package/dist/cli/cli-error.d.ts.map +0 -1
  176. package/dist/cli/cli-error.js +0 -44
  177. package/dist/cli/cli-presenter.d.ts +0 -14
  178. package/dist/cli/cli-presenter.d.ts.map +0 -1
  179. package/dist/cli/cli-presenter.js +0 -36
  180. package/dist/cli/insights-cli.d.ts +0 -6
  181. package/dist/cli/insights-cli.d.ts.map +0 -1
  182. package/dist/cli/insights-cli.js +0 -236
  183. package/dist/cli/main.d.ts +0 -3
  184. package/dist/cli/main.d.ts.map +0 -1
  185. package/dist/cli/main.js +0 -137
  186. package/dist/cli/standalone-cli.d.ts +0 -3
  187. package/dist/cli/standalone-cli.d.ts.map +0 -1
  188. package/dist/cli/standalone-cli.js +0 -96
  189. package/dist/cli/types.d.ts +0 -49
  190. package/dist/cli/types.d.ts.map +0 -1
  191. package/dist/cli/types.js +0 -1
  192. package/dist/contracts/graph.d.ts +0 -266
  193. package/dist/contracts/graph.d.ts.map +0 -1
  194. package/dist/contracts/graph.js +0 -182
  195. package/dist/contracts/identifiers.d.ts +0 -4
  196. package/dist/contracts/identifiers.d.ts.map +0 -1
  197. package/dist/contracts/identifiers.js +0 -7
  198. package/dist/contracts/public-contracts.d.ts +0 -5
  199. package/dist/contracts/public-contracts.d.ts.map +0 -1
  200. package/dist/contracts/public-contracts.js +0 -4
  201. package/dist/evaluation/comparison.d.ts +0 -30
  202. package/dist/evaluation/comparison.d.ts.map +0 -1
  203. package/dist/evaluation/comparison.js +0 -108
  204. package/dist/evaluation/contracts.d.ts +0 -301
  205. package/dist/evaluation/contracts.d.ts.map +0 -1
  206. package/dist/evaluation/contracts.js +0 -413
  207. package/dist/graph/graph-store.d.ts +0 -55
  208. package/dist/graph/graph-store.d.ts.map +0 -1
  209. package/dist/graph/graph-store.js +0 -912
  210. package/dist/graph/types.d.ts +0 -189
  211. package/dist/graph/types.d.ts.map +0 -1
  212. package/dist/graph/types.js +0 -1
  213. package/dist/insights/contracts.d.ts +0 -266
  214. package/dist/insights/contracts.d.ts.map +0 -1
  215. package/dist/insights/contracts.js +0 -124
  216. package/dist/insights/insights-store.d.ts +0 -73
  217. package/dist/insights/insights-store.d.ts.map +0 -1
  218. package/dist/insights/insights-store.js +0 -246
  219. package/dist/knowledge/business-knowledge-service.d.ts +0 -24
  220. package/dist/knowledge/business-knowledge-service.d.ts.map +0 -1
  221. package/dist/knowledge/business-knowledge-service.js +0 -200
  222. package/dist/knowledge/graph-patch-conflict-error.d.ts +0 -8
  223. package/dist/knowledge/graph-patch-conflict-error.d.ts.map +0 -1
  224. package/dist/knowledge/graph-patch-conflict-error.js +0 -12
  225. package/dist/knowledge/structural-target-binding.d.ts +0 -14
  226. package/dist/knowledge/structural-target-binding.d.ts.map +0 -1
  227. package/dist/knowledge/structural-target-binding.js +0 -11
  228. package/dist/package-metadata.d.ts +0 -2
  229. package/dist/package-metadata.d.ts.map +0 -1
  230. package/dist/package-metadata.js +0 -9
  231. package/dist/repository/git-command.d.ts +0 -3
  232. package/dist/repository/git-command.d.ts.map +0 -1
  233. package/dist/repository/git-command.js +0 -25
  234. package/dist/repository/repository-inspector.d.ts +0 -7
  235. package/dist/repository/repository-inspector.d.ts.map +0 -1
  236. package/dist/repository/repository-inspector.js +0 -84
  237. package/dist/repository/repository-language-support.d.ts +0 -14
  238. package/dist/repository/repository-language-support.d.ts.map +0 -1
  239. package/dist/repository/repository-language-support.js +0 -64
  240. package/dist/repository/types.d.ts +0 -9
  241. package/dist/repository/types.d.ts.map +0 -1
  242. package/dist/repository/types.js +0 -1
  243. package/dist/runtime/sqlite-compatibility-process.d.ts +0 -8
  244. package/dist/runtime/sqlite-compatibility-process.d.ts.map +0 -1
  245. package/dist/runtime/sqlite-compatibility-process.js +0 -20
  246. package/dist/setup/skill-installer.d.ts +0 -20
  247. package/dist/setup/skill-installer.d.ts.map +0 -1
  248. package/dist/setup/skill-installer.js +0 -187
  249. package/dist/snapshots/repository-snapshot.d.ts +0 -4
  250. package/dist/snapshots/repository-snapshot.d.ts.map +0 -1
  251. package/dist/snapshots/repository-snapshot.js +0 -119
  252. package/dist/snapshots/types.d.ts +0 -30
  253. package/dist/snapshots/types.d.ts.map +0 -1
  254. package/dist/snapshots/types.js +0 -1
  255. package/dist/storage/atlas-database.d.ts +0 -19
  256. package/dist/storage/atlas-database.d.ts.map +0 -1
  257. package/dist/storage/atlas-database.js +0 -433
  258. package/dist/storage/snapshot-store.d.ts +0 -19
  259. package/dist/storage/snapshot-store.d.ts.map +0 -1
  260. package/dist/storage/snapshot-store.js +0 -74
  261. package/dist/structural-backend/codegraph-backend.d.ts +0 -57
  262. package/dist/structural-backend/codegraph-backend.d.ts.map +0 -1
  263. package/dist/structural-backend/codegraph-backend.js +0 -1230
  264. package/dist/structural-backend/codegraph-worker-client.d.ts +0 -5
  265. package/dist/structural-backend/codegraph-worker-client.d.ts.map +0 -1
  266. package/dist/structural-backend/codegraph-worker-client.js +0 -118
  267. package/dist/structural-backend/codegraph-worker-protocol.d.ts +0 -35
  268. package/dist/structural-backend/codegraph-worker-protocol.d.ts.map +0 -1
  269. package/dist/structural-backend/codegraph-worker-protocol.js +0 -1
  270. package/dist/structural-backend/codegraph-worker.d.ts +0 -2
  271. package/dist/structural-backend/codegraph-worker.d.ts.map +0 -1
  272. package/dist/structural-backend/codegraph-worker.js +0 -131
  273. package/dist/structural-backend/process-instance.d.ts +0 -18
  274. package/dist/structural-backend/process-instance.d.ts.map +0 -1
  275. package/dist/structural-backend/process-instance.js +0 -207
  276. package/dist/structural-backend/structural-fact-changes.d.ts +0 -7
  277. package/dist/structural-backend/structural-fact-changes.d.ts.map +0 -1
  278. package/dist/structural-backend/structural-fact-changes.js +0 -78
  279. package/dist/structural-backend/structural-projection-bootstrapper.d.ts +0 -10
  280. package/dist/structural-backend/structural-projection-bootstrapper.d.ts.map +0 -1
  281. package/dist/structural-backend/structural-projection-bootstrapper.js +0 -295
  282. package/dist/structural-backend/structural-publication.d.ts +0 -13
  283. package/dist/structural-backend/structural-publication.d.ts.map +0 -1
  284. package/dist/structural-backend/structural-publication.js +0 -255
  285. package/dist/structural-backend/structural-write-lock.d.ts +0 -8
  286. package/dist/structural-backend/structural-write-lock.d.ts.map +0 -1
  287. package/dist/structural-backend/structural-write-lock.js +0 -415
  288. package/dist/structural-backend/types.d.ts +0 -144
  289. package/dist/structural-backend/types.d.ts.map +0 -1
  290. package/dist/structural-backend/types.js +0 -11
  291. package/dist/world/business-map-projector.d.ts +0 -14
  292. package/dist/world/business-map-projector.d.ts.map +0 -1
  293. package/dist/world/business-map-projector.js +0 -178
  294. package/dist/world/types.d.ts +0 -77
  295. package/dist/world/types.d.ts.map +0 -1
  296. package/dist/world/types.js +0 -1
  297. package/dist/world/world-graph-query.d.ts +0 -26
  298. package/dist/world/world-graph-query.d.ts.map +0 -1
  299. package/dist/world/world-graph-query.js +0 -250
  300. package/dist/world/world-model-service.d.ts +0 -21
  301. package/dist/world/world-model-service.d.ts.map +0 -1
  302. package/dist/world/world-model-service.js +0 -219
  303. package/dist/world/world-snapshot-store.d.ts +0 -40
  304. package/dist/world/world-snapshot-store.d.ts.map +0 -1
  305. package/dist/world/world-snapshot-store.js +0 -581
  306. package/docs/README.md +0 -30
  307. package/docs/architecture/codegraph-backend.md +0 -190
  308. package/docs/architecture/continuous-business-learning.md +0 -240
  309. package/docs/contracts/cli-v1.md +0 -164
  310. package/docs/contracts/graph-model.md +0 -106
  311. package/docs/contracts/graph-patch-v1.md +0 -105
  312. package/docs/contracts/insights-v1.md +0 -84
  313. package/docs/log.md +0 -80
  314. package/docs/mindmaps/semantic-atlas-overview.drawio +0 -255
  315. package/docs/mindmaps/semantic-atlas-overview.png +0 -0
  316. package/docs/mindmaps/semantic-atlas-overview.zh-CN.drawio +0 -255
  317. package/docs/mindmaps/semantic-atlas-overview.zh-CN.png +0 -0
  318. package/schemas/cli-envelope-v1.schema.json +0 -1244
  319. package/schemas/evaluation-plan-v1.schema.json +0 -211
  320. package/schemas/evaluation-run-v1.schema.json +0 -659
  321. package/schemas/graph-patch-v1.schema.json +0 -392
  322. package/schemas/insights-envelope-v1.schema.json +0 -428
@@ -1,571 +0,0 @@
1
- var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
2
- if (value !== null && value !== void 0) {
3
- if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
4
- var dispose, inner;
5
- if (async) {
6
- if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
7
- dispose = value[Symbol.asyncDispose];
8
- }
9
- if (dispose === void 0) {
10
- if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
11
- dispose = value[Symbol.dispose];
12
- if (async) inner = dispose;
13
- }
14
- if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
15
- if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
16
- env.stack.push({ value: value, dispose: dispose, async: async });
17
- }
18
- else if (async) {
19
- env.stack.push({ async: true });
20
- }
21
- return value;
22
- };
23
- var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
24
- return function (env) {
25
- function fail(e) {
26
- env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
27
- env.hasError = true;
28
- }
29
- var r, s = 0;
30
- function next() {
31
- while (r = env.stack.pop()) {
32
- try {
33
- if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
34
- if (r.dispose) {
35
- var result = r.dispose.call(r.value);
36
- if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
37
- }
38
- else s |= 1;
39
- }
40
- catch (e) {
41
- fail(e);
42
- }
43
- }
44
- if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
45
- if (env.hasError) throw env.error;
46
- }
47
- return next();
48
- };
49
- })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
50
- var e = new Error(message);
51
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
52
- });
53
- import { cliEnvelopeSchema } from "../contracts/cli.js";
54
- import { graphPatchV1Schema } from "../contracts/graph.js";
55
- import { feedbackReportInputSchema } from "../contracts/insights.js";
56
- import { GraphStore } from "../graph/graph-store.js";
57
- import { BusinessKnowledgeService } from "../knowledge/business-knowledge-service.js";
58
- import { hasSupportedRepositoryLanguage, inspectRepositoryLanguages, } from "../repository/repository-language-support.js";
59
- import { inspectGitRepository, } from "../repository/repository-inspector.js";
60
- import { createRepositorySnapshot } from "../snapshots/repository-snapshot.js";
61
- import { SnapshotStore, } from "../storage/snapshot-store.js";
62
- import { resolveAtlasDatabasePath } from "../storage/atlas-database.js";
63
- import { InsightsStore } from "../insights/insights-store.js";
64
- import { CodeGraphStructuralBackend } from "../structural-backend/codegraph-backend.js";
65
- import { WorldGraphQuery } from "../world/world-graph-query.js";
66
- import { WorldModelService } from "../world/world-model-service.js";
67
- import { WorldSnapshotStore } from "../world/world-snapshot-store.js";
68
- import { CliError, invalidInput } from "./cli-error.js";
69
- export class CliApplication {
70
- io;
71
- constructor(io) {
72
- this.io = io;
73
- }
74
- async openRepository(path, command) {
75
- let repository;
76
- try {
77
- repository = await inspectGitRepository(path);
78
- }
79
- catch {
80
- throw new CliError(3, "REPOSITORY_NOT_FOUND", "The selected path is not inside a supported Git worktree.", command);
81
- }
82
- const [currentSnapshot, structural, languages] = await Promise.all([
83
- createRepositorySnapshot(repository),
84
- new CodeGraphStructuralBackend(repository).inspect(),
85
- inspectRepositoryLanguages(repository),
86
- ]);
87
- try {
88
- const env_1 = { stack: [], error: void 0, hasError: false };
89
- try {
90
- const world = __addDisposableResource(env_1, new WorldSnapshotStore(repository), false);
91
- const state = world.readState();
92
- const publishedSnapshot = state.currentSnapshotId === null
93
- ? null
94
- : findPublishedSnapshot(repository, state.currentSnapshotId);
95
- return { repository, currentSnapshot, structural, languages, state, publishedSnapshot };
96
- }
97
- catch (e_1) {
98
- env_1.error = e_1;
99
- env_1.hasError = true;
100
- }
101
- finally {
102
- __disposeResources(env_1);
103
- }
104
- }
105
- catch {
106
- return {
107
- repository,
108
- currentSnapshot,
109
- structural,
110
- languages,
111
- state: null,
112
- publishedSnapshot: null,
113
- };
114
- }
115
- }
116
- async execute(command, context) {
117
- switch (command.name) {
118
- case "status":
119
- return this.status(context);
120
- case "index":
121
- return this.index(context);
122
- case "map.view":
123
- return this.mapView(command.focusKey, context);
124
- case "map.search":
125
- return this.mapSearch(command.query, command.limit, context);
126
- case "map.show":
127
- return this.mapShow(command.businessKey, context);
128
- case "code.search":
129
- return this.codeSearch(command.query, command.limit, context);
130
- case "learn":
131
- return this.learn(context);
132
- case "feedback.report":
133
- return this.feedbackReport(context);
134
- case "changes":
135
- return this.changes(command, context);
136
- }
137
- }
138
- envelope(result, context) {
139
- const partial = hasPartialResult(result.data, result.warnings);
140
- return cliEnvelopeSchema.parse({
141
- schemaVersion: 1,
142
- repository: repositoryDescriptor(context),
143
- snapshot: snapshotDescriptor(context),
144
- status: partial ? "partial" : "ok",
145
- data: result.data,
146
- warnings: [...result.warnings],
147
- });
148
- }
149
- responseContext(context) {
150
- return {
151
- repository: repositoryDescriptor(context),
152
- snapshot: snapshotDescriptor(context),
153
- };
154
- }
155
- status(context) {
156
- const freshness = worldFreshness(context);
157
- const warnings = statusWarnings(context, freshness);
158
- return {
159
- data: {
160
- command: "status",
161
- currentRevision: {
162
- headCommit: context.currentSnapshot.headCommit,
163
- changes: changeCounts(context.currentSnapshot),
164
- },
165
- freshness,
166
- storeLocation: resolveAtlasDatabasePath(context.repository),
167
- languages: [...context.languages],
168
- backend: {
169
- version: context.structural.backendVersion,
170
- completeness: context.structural.completeness,
171
- extractionVersion: context.structural.extractionVersion,
172
- indexedAt: context.structural.indexedAt,
173
- },
174
- },
175
- warnings,
176
- };
177
- }
178
- async index(context) {
179
- if (!hasSupportedRepositoryLanguage(context.languages)) {
180
- throw new CliError(3, "UNSUPPORTED_REPOSITORY", "The repository has no TypeScript or JavaScript source files to index.", "index");
181
- }
182
- const previousUnknowns = context.structural.completeness === "complete"
183
- ? await new CodeGraphStructuralBackend(context.repository).listUnknownBoundaries()
184
- : [];
185
- const world = new WorldModelService(context.repository);
186
- const publication = context.structural.completeness === "incomplete"
187
- ? await world.build()
188
- : await world.sync();
189
- const unknownChanges = compareUnknownBoundaries(previousUnknowns, publication.structural.boundaries);
190
- const warnings = [
191
- ...unsupportedLanguageWarnings(context.languages),
192
- ...publication.staleAssertions.length === 0 ? [] : [{
193
- code: "STALE_ASSERTION",
194
- message: `${publication.staleAssertions.length} learned assertions have stale evidence.`,
195
- details: { assertions: publication.staleAssertions },
196
- }],
197
- ...publication.structural.boundaries.length === 0 ? [] : [{
198
- code: "UNKNOWN_BOUNDARY",
199
- message: `${publication.structural.boundaries.length} structural operations remain unresolved.`,
200
- }],
201
- ];
202
- return {
203
- data: {
204
- command: "index",
205
- snapshotId: publication.snapshotId,
206
- facts: publication.structural.factChanges,
207
- unknowns: {
208
- added: unknownChanges.added,
209
- resolved: unknownChanges.resolved,
210
- total: publication.structural.boundaries.length,
211
- },
212
- backendVersion: publication.structural.backendVersion,
213
- extractionVersion: publication.structural.extractionVersion,
214
- structuralTotals: {
215
- nodes: publication.structural.counts.nodes,
216
- relations: publication.structural.counts.relations,
217
- },
218
- staleAssertions: publication.staleAssertions,
219
- },
220
- warnings,
221
- };
222
- }
223
- async mapView(focusKey, context) {
224
- const env_2 = { stack: [], error: void 0, hasError: false };
225
- try {
226
- this.requireCurrentWorld(context, "map.view");
227
- const query = __addDisposableResource(env_2, new WorldGraphQuery(context.repository), false);
228
- const view = await query.view(focusKey);
229
- if (view === undefined) {
230
- throw invalidInput(`Business node ${focusKey} was not found.`, "map.view");
231
- }
232
- const warnings = view.focus === null && view.regions.length === 0
233
- ? [{
234
- code: "BUSINESS_KNOWLEDGE_EMPTY",
235
- message: "No business knowledge has been learned from engineering work yet.",
236
- }]
237
- : [];
238
- return mapResult({ command: "map.view", ...view }, context.languages, warnings);
239
- }
240
- catch (e_2) {
241
- env_2.error = e_2;
242
- env_2.hasError = true;
243
- }
244
- finally {
245
- __disposeResources(env_2);
246
- }
247
- }
248
- async mapSearch(lexicalQuery, limit, context) {
249
- const env_3 = { stack: [], error: void 0, hasError: false };
250
- try {
251
- this.requireCurrentWorld(context, "map.search");
252
- const query = __addDisposableResource(env_3, new WorldGraphQuery(context.repository), false);
253
- const results = await query.searchBusiness(lexicalQuery, { limit });
254
- return mapResult({ command: "map.search", query: lexicalQuery, limit, results }, context.languages);
255
- }
256
- catch (e_3) {
257
- env_3.error = e_3;
258
- env_3.hasError = true;
259
- }
260
- finally {
261
- __disposeResources(env_3);
262
- }
263
- }
264
- async codeSearch(structuralQuery, limit, context) {
265
- const env_4 = { stack: [], error: void 0, hasError: false };
266
- try {
267
- this.requireCurrentWorld(context, "code.search");
268
- const query = __addDisposableResource(env_4, new WorldGraphQuery(context.repository), false);
269
- const results = await query.searchCode(structuralQuery, { limit });
270
- return mapResult({
271
- command: "code.search",
272
- query: structuralQuery,
273
- limit,
274
- results,
275
- }, context.languages);
276
- }
277
- catch (e_4) {
278
- env_4.error = e_4;
279
- env_4.hasError = true;
280
- }
281
- finally {
282
- __disposeResources(env_4);
283
- }
284
- }
285
- async mapShow(businessKey, context) {
286
- const env_5 = { stack: [], error: void 0, hasError: false };
287
- try {
288
- this.requireCurrentWorld(context, "map.show");
289
- const query = __addDisposableResource(env_5, new WorldGraphQuery(context.repository), false);
290
- const view = await query.showBusiness(businessKey);
291
- if (view === undefined) {
292
- throw invalidInput(`Business node ${businessKey} was not found.`, "map.show");
293
- }
294
- return mapResult({
295
- command: "map.show",
296
- node: view.node,
297
- relations: view.relations.map(presentNeighbor),
298
- }, context.languages);
299
- }
300
- catch (e_5) {
301
- env_5.error = e_5;
302
- env_5.hasError = true;
303
- }
304
- finally {
305
- __disposeResources(env_5);
306
- }
307
- }
308
- async learn(context) {
309
- const env_6 = { stack: [], error: void 0, hasError: false };
310
- try {
311
- this.requireAvailableWorld(context, "learn");
312
- const input = await readStandardInput(this.io.stdin);
313
- let inputValue;
314
- try {
315
- inputValue = JSON.parse(input);
316
- }
317
- catch {
318
- throw invalidInput("Standard input must contain one complete JSON value.", "learn");
319
- }
320
- const parsedPatch = graphPatchV1Schema.safeParse(inputValue);
321
- if (!parsedPatch.success) {
322
- throw invalidInput("The GraphPatch input is invalid.", "learn", {
323
- issues: parsedPatch.error.issues.map(({ code, message, path }) => ({ code, message, path })),
324
- });
325
- }
326
- const patch = parsedPatch.data;
327
- const graph = __addDisposableResource(env_6, new GraphStore(context.repository), false);
328
- const applied = await new BusinessKnowledgeService(context.repository, graph).learn(patch);
329
- return {
330
- data: { command: "learn", ...applied },
331
- warnings: unsupportedLanguageWarnings(context.languages),
332
- };
333
- }
334
- catch (e_6) {
335
- env_6.error = e_6;
336
- env_6.hasError = true;
337
- }
338
- finally {
339
- __disposeResources(env_6);
340
- }
341
- }
342
- async feedbackReport(context) {
343
- const env_7 = { stack: [], error: void 0, hasError: false };
344
- try {
345
- const input = await readStandardInput(this.io.stdin);
346
- let inputValue;
347
- try {
348
- inputValue = JSON.parse(input);
349
- }
350
- catch {
351
- throw invalidInput("Standard input must contain one complete JSON value.", "feedback.report");
352
- }
353
- const parsed = feedbackReportInputSchema.safeParse(inputValue);
354
- if (!parsed.success) {
355
- throw invalidInput("The feedback report input is invalid.", "feedback.report", {
356
- issues: parsed.error.issues.map(({ code, message, path }) => ({ code, message, path })),
357
- });
358
- }
359
- const insights = __addDisposableResource(env_7, new InsightsStore(), false);
360
- const report = insights.recordFeedback({
361
- ...parsed.data,
362
- repositoryId: context.repository.repositoryId,
363
- snapshotId: snapshotDescriptor(context)?.id ?? null,
364
- });
365
- return {
366
- data: {
367
- command: "feedback.report",
368
- report: {
369
- id: report.id,
370
- kind: report.kind,
371
- category: report.category,
372
- impact: report.impact,
373
- sourceConfirmed: report.sourceConfirmed,
374
- status: report.status,
375
- contextEventCount: report.contextEventIds.length,
376
- createdAt: report.createdAt,
377
- },
378
- },
379
- warnings: [],
380
- };
381
- }
382
- catch (e_7) {
383
- env_7.error = e_7;
384
- env_7.hasError = true;
385
- }
386
- finally {
387
- __disposeResources(env_7);
388
- }
389
- }
390
- changes(command, context) {
391
- const env_8 = { stack: [], error: void 0, hasError: false };
392
- try {
393
- this.requireCurrentWorld(context, "changes");
394
- const query = __addDisposableResource(env_8, new WorldGraphQuery(context.repository), false);
395
- let changes;
396
- try {
397
- changes = query.changes({
398
- ...(command.fromSnapshotId === undefined ? {} : { fromSnapshotId: command.fromSnapshotId }),
399
- ...(command.toSnapshotId === undefined ? {} : { toSnapshotId: command.toSnapshotId }),
400
- });
401
- }
402
- catch (error) {
403
- throw new CliError(4, "CHANGE_RANGE_NOT_FOUND", error instanceof Error ? error.message : "The requested semantic change range is unavailable.", "changes");
404
- }
405
- if (changes === undefined) {
406
- throw new CliError(4, "CHANGE_RANGE_NOT_FOUND", "The requested semantic change range is not available.", "changes");
407
- }
408
- const warnings = [
409
- ...unsupportedLanguageWarnings(context.languages),
410
- ...changes.staleAssertions.length === 0 ? [] : [{
411
- code: "STALE_ASSERTION",
412
- message: `${changes.staleAssertions.length} assertions are stale at the target snapshot.`,
413
- details: { assertions: changes.staleAssertions },
414
- }],
415
- ];
416
- return { data: { command: "changes", ...changes }, warnings };
417
- }
418
- catch (e_8) {
419
- env_8.error = e_8;
420
- env_8.hasError = true;
421
- }
422
- finally {
423
- __disposeResources(env_8);
424
- }
425
- }
426
- requireAvailableWorld(context, command) {
427
- if (context.structural.completeness === "missing" || context.publishedSnapshot === null) {
428
- throw new CliError(4, "ATLAS_STATE_MISSING", "The repository has no published Atlas index.", command);
429
- }
430
- if (context.structural.completeness !== "complete" || context.state?.status !== "current") {
431
- throw new CliError(4, "ATLAS_STATE_STALE", "The published Atlas index is unavailable.", command);
432
- }
433
- }
434
- requireCurrentWorld(context, command) {
435
- this.requireAvailableWorld(context, command);
436
- if (worldFreshness(context) !== "current") {
437
- throw new CliError(4, "ATLAS_STATE_STALE", "The repository differs from the published Atlas snapshot; run index first.", command);
438
- }
439
- }
440
- }
441
- function compareUnknownBoundaries(previous, current) {
442
- const previousIds = new Set(previous.map(({ reference }) => reference.id));
443
- const currentIds = new Set(current.map(({ reference }) => reference.id));
444
- return {
445
- added: [...currentIds].filter((id) => !previousIds.has(id)).length,
446
- resolved: [...previousIds].filter((id) => !currentIds.has(id)).length,
447
- };
448
- }
449
- function repositoryDescriptor(context) {
450
- return {
451
- id: context.repository.repositoryId,
452
- root: context.repository.worktreeRoot,
453
- headCommit: context.currentSnapshot.headCommit,
454
- };
455
- }
456
- function snapshotDescriptor(context) {
457
- if (context.publishedSnapshot === null) {
458
- return null;
459
- }
460
- return {
461
- id: context.publishedSnapshot.snapshot.snapshotId,
462
- gitHead: context.publishedSnapshot.snapshot.headCommit,
463
- createdAt: context.publishedSnapshot.createdAt,
464
- freshness: worldFreshness(context) === "current"
465
- ? "current"
466
- : "stale",
467
- };
468
- }
469
- function worldFreshness(context) {
470
- if (context.publishedSnapshot === null)
471
- return "missing";
472
- if (context.state?.status !== "current")
473
- return "stale";
474
- return context.publishedSnapshot.snapshot.snapshotId === context.currentSnapshot.snapshotId
475
- ? "current"
476
- : "stale";
477
- }
478
- function findPublishedSnapshot(repository, snapshotId) {
479
- const env_9 = { stack: [], error: void 0, hasError: false };
480
- try {
481
- const snapshots = __addDisposableResource(env_9, new SnapshotStore(repository), false);
482
- return snapshots.findStored(snapshotId) ?? null;
483
- }
484
- catch (e_9) {
485
- env_9.error = e_9;
486
- env_9.hasError = true;
487
- }
488
- finally {
489
- __disposeResources(env_9);
490
- }
491
- }
492
- function changeCounts(snapshot) {
493
- return {
494
- staged: snapshot.changes.staged.length,
495
- unstaged: snapshot.changes.unstaged.length,
496
- untracked: snapshot.changes.untracked.length,
497
- };
498
- }
499
- function statusWarnings(context, freshness) {
500
- const warnings = unsupportedLanguageWarnings(context.languages);
501
- if (freshness === "stale") {
502
- warnings.push({ code: "STALE_INDEX", message: "The repository differs from the published Atlas snapshot." });
503
- }
504
- if (context.structural.completeness === "incomplete") {
505
- warnings.push({
506
- code: "INCOMPLETE_INDEX",
507
- message: "The structural index is incomplete.",
508
- details: { diagnostics: context.structural.diagnostics },
509
- });
510
- }
511
- return warnings;
512
- }
513
- function unsupportedLanguageWarnings(languages) {
514
- return languages.flatMap((language) => (language.support === "unsupported"
515
- ? [{ code: "UNSUPPORTED_LANGUAGE", message: language.reason, details: { language: language.language } }]
516
- : []));
517
- }
518
- function mapResult(data, languages, additionalWarnings = []) {
519
- const warnings = [
520
- ...unsupportedLanguageWarnings(languages),
521
- ...additionalWarnings,
522
- ];
523
- if (containsUnknown(data)) {
524
- warnings.push({ code: "UNKNOWN_BOUNDARY", message: "The result contains unresolved structural behavior." });
525
- }
526
- if (containsStale(data)) {
527
- warnings.push({ code: "STALE_ASSERTION", message: "The result contains stale learned assertions." });
528
- }
529
- return { data, warnings };
530
- }
531
- function presentNeighbor(neighbor) {
532
- return {
533
- type: neighbor.relation.type,
534
- direction: neighbor.direction,
535
- node: neighbor.node,
536
- certainty: neighbor.relation.certainty,
537
- validity: neighbor.relation.validity,
538
- evidence: neighbor.relation.evidence,
539
- ...(neighbor.relation.domain === "structural" ? { support: neighbor.relation.support } : {}),
540
- depth: neighbor.depth,
541
- };
542
- }
543
- function containsUnknown(data) {
544
- return JSON.stringify(data).includes('"validity":"unknown"');
545
- }
546
- function containsStale(data) {
547
- return JSON.stringify(data).includes('"validity":"stale"')
548
- || isChangesWithStaleAssertions(data);
549
- }
550
- function hasPartialResult(data, warnings) {
551
- return warnings.length > 0 || containsUnknown(data) || containsStale(data);
552
- }
553
- function isChangesWithStaleAssertions(data) {
554
- return typeof data === "object"
555
- && data !== null
556
- && "command" in data
557
- && data.command === "changes"
558
- && "staleAssertions" in data
559
- && Array.isArray(data.staleAssertions)
560
- && data.staleAssertions.length > 0;
561
- }
562
- async function readStandardInput(input) {
563
- let contents = "";
564
- for await (const chunk of input) {
565
- contents += Buffer.isBuffer(chunk) ? chunk.toString("utf8") : String(chunk);
566
- }
567
- if (contents.trim().length === 0) {
568
- throw invalidInput("Standard input must contain one complete JSON value.", "learn");
569
- }
570
- return contents;
571
- }
@@ -1,12 +0,0 @@
1
- import type { CliCommandName } from "./types.js";
2
- export declare class CliError extends Error {
3
- readonly exitCode: number;
4
- readonly code: string;
5
- readonly command: CliCommandName | null;
6
- readonly details?: unknown | undefined;
7
- constructor(exitCode: number, code: string, message: string, command: CliCommandName | null, details?: unknown | undefined);
8
- }
9
- export declare function invalidInput(message: string, command: CliCommandName | null, details?: unknown): CliError;
10
- export declare function classifyCliError(error: unknown, command: CliCommandName | null): CliError;
11
- export declare function errorMessage(error: unknown): string;
12
- //# sourceMappingURL=cli-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-error.d.ts","sourceRoot":"","sources":["../../src/cli/cli-error.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAJjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,OAAO,CAAC,EAAE,OAAO,YAAA;CAK7B;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,OAAO,CAAC,EAAE,OAAO,GAChB,QAAQ,CAEV;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,cAAc,GAAG,IAAI,GAC7B,QAAQ,CA+BV;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
@@ -1,44 +0,0 @@
1
- import { GraphPatchConflictError } from "../knowledge/graph-patch-conflict-error.js";
2
- import { StructuralBackendError } from "../structural-backend/types.js";
3
- export class CliError extends Error {
4
- exitCode;
5
- code;
6
- command;
7
- details;
8
- constructor(exitCode, code, message, command, details) {
9
- super(message);
10
- this.exitCode = exitCode;
11
- this.code = code;
12
- this.command = command;
13
- this.details = details;
14
- this.name = "CliError";
15
- }
16
- }
17
- export function invalidInput(message, command, details) {
18
- return new CliError(2, "INVALID_INPUT", message, command, details);
19
- }
20
- export function classifyCliError(error, command) {
21
- if (error instanceof CliError) {
22
- return error;
23
- }
24
- if (error instanceof GraphPatchConflictError) {
25
- return new CliError(5, error.code, error.message, command, {
26
- baseSnapshotId: error.baseSnapshotId,
27
- currentSnapshotId: error.currentSnapshotId,
28
- });
29
- }
30
- if (error instanceof StructuralBackendError) {
31
- if (command === "learn" && error.code === "STRUCTURAL_QUERY_FAILED") {
32
- return new CliError(5, "GRAPH_PATCH_REJECTED", error.message, command);
33
- }
34
- const missing = error.code === "STRUCTURAL_INDEX_MISSING";
35
- return new CliError(4, missing ? "ATLAS_STATE_MISSING" : "ATLAS_STATE_STALE", error.message, command);
36
- }
37
- if (command === "learn") {
38
- return new CliError(5, "GRAPH_PATCH_REJECTED", errorMessage(error), command);
39
- }
40
- return new CliError(1, "INTERNAL_ERROR", "Semantic Atlas failed unexpectedly.", command);
41
- }
42
- export function errorMessage(error) {
43
- return error instanceof Error ? error.message : String(error);
44
- }
@@ -1,14 +0,0 @@
1
- import { type CliEnvelope } from "../contracts/cli.js";
2
- import { type CliError } from "./cli-error.js";
3
- import type { CliIo } from "./types.js";
4
- export declare class CliPresenter {
5
- private readonly io;
6
- constructor(io: CliIo);
7
- write(envelope: CliEnvelope, pretty: boolean): void;
8
- writeError(error: CliError, context: {
9
- readonly repository: CliEnvelope["repository"];
10
- readonly snapshot: CliEnvelope["snapshot"];
11
- }, pretty: boolean): void;
12
- writeUnexpectedDiagnostic(error: unknown): void;
13
- }
14
- //# sourceMappingURL=cli-presenter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-presenter.d.ts","sourceRoot":"","sources":["../../src/cli/cli-presenter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,KAAK;IAEtC,KAAK,CAAC,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAKnD,UAAU,CACR,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE;QACP,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;QAC/C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;KAC5C,EACD,MAAM,EAAE,OAAO,GACd,IAAI;IAmBP,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAMhD"}
@@ -1,36 +0,0 @@
1
- import { cliEnvelopeSchema } from "../contracts/cli.js";
2
- import { errorMessage } from "./cli-error.js";
3
- export class CliPresenter {
4
- io;
5
- constructor(io) {
6
- this.io = io;
7
- }
8
- write(envelope, pretty) {
9
- const validated = cliEnvelopeSchema.parse(envelope);
10
- this.io.stdout.write(`${JSON.stringify(validated, null, pretty ? 2 : undefined)}\n`);
11
- }
12
- writeError(error, context, pretty) {
13
- const envelope = cliEnvelopeSchema.parse({
14
- schemaVersion: 1,
15
- repository: context.repository,
16
- snapshot: context.snapshot,
17
- status: "error",
18
- data: {
19
- command: error.command,
20
- error: {
21
- code: error.code,
22
- message: error.message,
23
- ...(error.details === undefined ? {} : { details: error.details }),
24
- },
25
- },
26
- warnings: [],
27
- });
28
- this.write(envelope, pretty);
29
- }
30
- writeUnexpectedDiagnostic(error) {
31
- const diagnostic = error instanceof Error && error.stack !== undefined
32
- ? error.stack
33
- : errorMessage(error);
34
- this.io.stderr.write(`${diagnostic}\n`);
35
- }
36
- }