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,84 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- import { realpath } from "node:fs/promises";
3
- import { basename, isAbsolute, resolve } from "node:path";
4
- import { runGit, runGitText } from "./git-command.js";
5
- const SUPPORTED_SOURCE_EXTENSIONS = new Set([
6
- ".cjs",
7
- ".cts",
8
- ".js",
9
- ".jsx",
10
- ".mjs",
11
- ".mts",
12
- ".ts",
13
- ".tsx",
14
- ]);
15
- function resolveGitPath(workingDirectory, path) {
16
- return isAbsolute(path) ? path : resolve(workingDirectory, path);
17
- }
18
- function normalizeIdentityPath(path) {
19
- const normalized = path.replaceAll("\\", "/");
20
- return process.platform === "win32" ? normalized.toLowerCase() : normalized;
21
- }
22
- function createRepositoryId(commonGitDirectory) {
23
- return createHash("sha256")
24
- .update("semantic-atlas:git-common-directory:v1\0")
25
- .update(normalizeIdentityPath(commonGitDirectory))
26
- .digest("hex");
27
- }
28
- function compareRepositoryPaths(left, right) {
29
- return left < right ? -1 : left > right ? 1 : 0;
30
- }
31
- async function discoverWorktreeRoots(workingDirectory) {
32
- const output = await runGit(workingDirectory, ["worktree", "list", "--porcelain", "-z"]);
33
- const worktreePaths = output
34
- .toString("utf8")
35
- .split("\0")
36
- .filter((field) => field.startsWith("worktree "))
37
- .map((field) => resolveGitPath(workingDirectory, field.slice("worktree ".length)));
38
- return [...new Set(worktreePaths)].sort(compareRepositoryPaths);
39
- }
40
- export function isSupportedSource(path) {
41
- const extensionIndex = path.lastIndexOf(".");
42
- if (extensionIndex < 0) {
43
- return false;
44
- }
45
- return SUPPORTED_SOURCE_EXTENSIONS.has(path.slice(extensionIndex).toLowerCase());
46
- }
47
- export function isTargetSource(path) {
48
- const fileName = basename(path);
49
- return (isSupportedSource(path) ||
50
- fileName === "package.json" ||
51
- /^(?:ts|js)config(?:\.[^.]+)*\.json$/u.test(fileName));
52
- }
53
- export async function inspectGitRepository(startPath) {
54
- const worktreeRoot = await realpath(await runGitText(startPath, ["rev-parse", "--show-toplevel"]));
55
- const gitDirectory = await realpath(resolveGitPath(startPath, await runGitText(startPath, ["rev-parse", "--git-dir"])));
56
- const commonGitDirectory = await realpath(resolveGitPath(startPath, await runGitText(startPath, ["rev-parse", "--git-common-dir"])));
57
- const indexPath = resolveGitPath(startPath, await runGitText(startPath, ["rev-parse", "--git-path", "index"]));
58
- const worktreeRoots = await discoverWorktreeRoots(worktreeRoot);
59
- return {
60
- repositoryId: createRepositoryId(commonGitDirectory),
61
- worktreeRoot,
62
- gitDirectory,
63
- commonGitDirectory,
64
- worktreeRoots,
65
- indexPath,
66
- };
67
- }
68
- export async function discoverTargetSources(repository) {
69
- const output = await runGit(repository.worktreeRoot, [
70
- "ls-files",
71
- "--cached",
72
- "--others",
73
- "--exclude-standard",
74
- "-z",
75
- ]);
76
- return output
77
- .toString("utf8")
78
- .split("\0")
79
- .filter((path) => path.length > 0 && isTargetSource(path))
80
- .sort(compareRepositoryPaths);
81
- }
82
- export async function readCurrentHead(repository) {
83
- return runGitText(repository.worktreeRoot, ["rev-parse", "--verify", "HEAD"]);
84
- }
@@ -1,14 +0,0 @@
1
- import type { GitRepository } from "./types.js";
2
- export interface SupportedRepositoryLanguage {
3
- readonly language: string;
4
- readonly support: "supported";
5
- }
6
- export interface UnsupportedRepositoryLanguage {
7
- readonly language: string;
8
- readonly support: "unsupported";
9
- readonly reason: string;
10
- }
11
- export type RepositoryLanguageSupport = SupportedRepositoryLanguage | UnsupportedRepositoryLanguage;
12
- export declare function inspectRepositoryLanguages(repository: GitRepository): Promise<readonly RepositoryLanguageSupport[]>;
13
- export declare function hasSupportedRepositoryLanguage(languages: readonly RepositoryLanguageSupport[]): boolean;
14
- //# sourceMappingURL=repository-language-support.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repository-language-support.d.ts","sourceRoot":"","sources":["../../src/repository/repository-language-support.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,yBAAyB,GACjC,2BAA2B,GAC3B,6BAA6B,CAAC;AAgClC,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,aAAa,GACxB,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC,CAiC/C;AAED,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,SAAS,yBAAyB,EAAE,GAC9C,OAAO,CAET"}
@@ -1,64 +0,0 @@
1
- import { extname } from "node:path";
2
- import { runGit } from "./git-command.js";
3
- const languageByExtension = new Map([
4
- [".c", "c"],
5
- [".cc", "cpp"],
6
- [".cpp", "cpp"],
7
- [".cs", "csharp"],
8
- [".cts", "typescript"],
9
- [".cxx", "cpp"],
10
- [".go", "go"],
11
- [".h", "c"],
12
- [".hpp", "cpp"],
13
- [".java", "java"],
14
- [".js", "javascript"],
15
- [".jsx", "javascript"],
16
- [".kt", "kotlin"],
17
- [".kts", "kotlin"],
18
- [".mjs", "javascript"],
19
- [".mts", "typescript"],
20
- [".php", "php"],
21
- [".py", "python"],
22
- [".rb", "ruby"],
23
- [".rs", "rust"],
24
- [".scala", "scala"],
25
- [".swift", "swift"],
26
- [".ts", "typescript"],
27
- [".tsx", "typescript"],
28
- [".vue", "vue"],
29
- ]);
30
- const supportedLanguages = new Set(["javascript", "typescript"]);
31
- export async function inspectRepositoryLanguages(repository) {
32
- const output = await runGit(repository.worktreeRoot, [
33
- "ls-files",
34
- "--cached",
35
- "--others",
36
- "--exclude-standard",
37
- "-z",
38
- ]);
39
- const languages = new Set(output.toString("utf8")
40
- .split("\0")
41
- .flatMap((path) => {
42
- const language = languageByExtension.get(extname(path).toLowerCase());
43
- return language === undefined ? [] : [language];
44
- }));
45
- if (languages.size === 0) {
46
- return [{
47
- language: "unknown",
48
- support: "unsupported",
49
- reason: "No supported TypeScript or JavaScript source files were found.",
50
- }];
51
- }
52
- return [...languages]
53
- .sort((left, right) => left.localeCompare(right))
54
- .map((language) => (supportedLanguages.has(language)
55
- ? { language, support: "supported" }
56
- : {
57
- language,
58
- support: "unsupported",
59
- reason: `Semantic Atlas v0.1 does not structurally index ${language} source files.`,
60
- }));
61
- }
62
- export function hasSupportedRepositoryLanguage(languages) {
63
- return languages.some(({ support }) => support === "supported");
64
- }
@@ -1,9 +0,0 @@
1
- export interface GitRepository {
2
- readonly repositoryId: string;
3
- readonly worktreeRoot: string;
4
- readonly gitDirectory: string;
5
- readonly commonGitDirectory: string;
6
- readonly worktreeRoots: readonly string[];
7
- readonly indexPath: string;
8
- }
9
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/repository/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface SqliteRuntimeState {
2
- readonly nodeVersion: string;
3
- readonly execArguments: readonly string[];
4
- readonly sqliteAvailable: boolean;
5
- }
6
- export declare function requiresSqliteCompatibilityProcess(runtime: SqliteRuntimeState): boolean;
7
- export declare function createSqliteCompatibilityArguments(entryPoint: string, applicationArguments: readonly string[], inheritedExecArguments?: readonly string[]): readonly string[];
8
- //# sourceMappingURL=sqlite-compatibility-process.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-compatibility-process.d.ts","sourceRoot":"","sources":["../../src/runtime/sqlite-compatibility-process.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AAED,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAWvF;AAED,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,MAAM,EAClB,oBAAoB,EAAE,SAAS,MAAM,EAAE,EACvC,sBAAsB,GAAE,SAAS,MAAM,EAAO,GAC7C,SAAS,MAAM,EAAE,CAYnB"}
@@ -1,20 +0,0 @@
1
- export function requiresSqliteCompatibilityProcess(runtime) {
2
- const nodeMajor = Number.parseInt(runtime.nodeVersion, 10);
3
- const warningAlreadyDisabled = runtime.execArguments.some((argument) => (argument === "--no-warnings"
4
- || argument === "--disable-warning=ExperimentalWarning"));
5
- if (nodeMajor < 24 && !warningAlreadyDisabled) {
6
- return true;
7
- }
8
- return !runtime.sqliteAvailable;
9
- }
10
- export function createSqliteCompatibilityArguments(entryPoint, applicationArguments, inheritedExecArguments = []) {
11
- const loaderArguments = inheritedExecArguments.filter((argument) => (argument !== "--experimental-sqlite"
12
- && argument !== "--no-experimental-sqlite"));
13
- return [
14
- "--experimental-sqlite",
15
- "--disable-warning=ExperimentalWarning",
16
- ...loaderArguments,
17
- entryPoint,
18
- ...applicationArguments,
19
- ];
20
- }
@@ -1,20 +0,0 @@
1
- export interface SkillInstallerOptions {
2
- readonly sourceDirectory?: string;
3
- readonly insightsSourceDirectory?: string;
4
- readonly userHome?: string;
5
- readonly version: string;
6
- }
7
- export interface SkillInstallationResult {
8
- readonly outcome: "installed" | "updated" | "current";
9
- readonly targetDirectory: string;
10
- readonly insightsTargetDirectory: string;
11
- readonly removedLegacyDirectories: readonly string[];
12
- }
13
- export declare class SkillInstaller {
14
- #private;
15
- constructor(options: SkillInstallerOptions);
16
- install(): Promise<SkillInstallationResult>;
17
- private existingLegacyDirectories;
18
- }
19
- export declare function resolveBundledSkillDirectory(name?: string): string;
20
- //# sourceMappingURL=skill-installer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skill-installer.d.ts","sourceRoot":"","sources":["../../src/setup/skill-installer.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;IACtD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtD;AAED,qBAAa,cAAc;;gBAQb,OAAO,EAAE,qBAAqB;IAWpC,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC;YAuDnC,yBAAyB;CAUxC;AAED,wBAAgB,4BAA4B,CAAC,IAAI,SAAY,GAAG,MAAM,CAGrE"}
@@ -1,187 +0,0 @@
1
- import { createHash, randomUUID } from "node:crypto";
2
- import { access, cp, mkdir, readFile, readdir, rename, rm, writeFile, } from "node:fs/promises";
3
- import { homedir } from "node:os";
4
- import { dirname, join, relative } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- const skillName = "semantic-atlas";
7
- const insightsSkillName = "semantic-atlas-insights";
8
- const installationMarkerName = ".semantic-atlas-managed.json";
9
- export class SkillInstaller {
10
- #sourceDirectory;
11
- #targetDirectory;
12
- #insightsSourceDirectory;
13
- #insightsTargetDirectory;
14
- #legacyDirectories;
15
- #version;
16
- constructor(options) {
17
- const userHome = options.userHome ?? homedir();
18
- this.#sourceDirectory = options.sourceDirectory ?? resolveBundledSkillDirectory();
19
- this.#targetDirectory = join(userHome, ".agents", "skills", skillName);
20
- this.#insightsSourceDirectory = options.insightsSourceDirectory
21
- ?? resolveBundledSkillDirectory(insightsSkillName);
22
- this.#insightsTargetDirectory = join(userHome, ".agents", "skills", insightsSkillName);
23
- this.#legacyDirectories = [join(userHome, ".codex", "skills", skillName)];
24
- this.#version = options.version;
25
- }
26
- async install() {
27
- await requireSemanticAtlasSkill(this.#sourceDirectory, "bundled Skill");
28
- await requireManagedSkill(this.#insightsSourceDirectory, insightsSkillName, "bundled insights Skill");
29
- const targetExists = await exists(this.#targetDirectory);
30
- if (targetExists) {
31
- await requireSemanticAtlasSkill(this.#targetDirectory, "existing shared Skill");
32
- }
33
- const insightsTargetExists = await exists(this.#insightsTargetDirectory);
34
- if (insightsTargetExists) {
35
- await requireManagedSkill(this.#insightsTargetDirectory, insightsSkillName, "existing shared insights Skill");
36
- }
37
- const existingLegacyDirectories = await this.existingLegacyDirectories();
38
- for (const directory of existingLegacyDirectories) {
39
- await requireSemanticAtlasSkill(directory, "legacy Codex Skill");
40
- }
41
- const sourceFingerprint = await fingerprintSkill(this.#sourceDirectory);
42
- const targetCurrent = targetExists
43
- && await installedSkillIsCurrent(this.#targetDirectory, this.#version, sourceFingerprint);
44
- if (!targetCurrent || existingLegacyDirectories.length > 0) {
45
- await installSkillAtomically(this.#sourceDirectory, this.#targetDirectory, { version: this.#version, fingerprint: sourceFingerprint });
46
- }
47
- const insights = await installManagedSkill({
48
- sourceDirectory: this.#insightsSourceDirectory,
49
- targetDirectory: this.#insightsTargetDirectory,
50
- version: this.#version,
51
- });
52
- for (const directory of existingLegacyDirectories) {
53
- await rm(directory, { recursive: true, force: true });
54
- }
55
- return {
56
- outcome: targetCurrent && insights === "current" && existingLegacyDirectories.length === 0
57
- ? "current"
58
- : targetExists || insightsTargetExists
59
- ? "updated"
60
- : "installed",
61
- targetDirectory: this.#targetDirectory,
62
- insightsTargetDirectory: this.#insightsTargetDirectory,
63
- removedLegacyDirectories: existingLegacyDirectories,
64
- };
65
- }
66
- async existingLegacyDirectories() {
67
- const result = [];
68
- for (const directory of this.#legacyDirectories) {
69
- if (await exists(directory)) {
70
- result.push(directory);
71
- }
72
- }
73
- return result;
74
- }
75
- }
76
- export function resolveBundledSkillDirectory(name = skillName) {
77
- const moduleDirectory = dirname(fileURLToPath(import.meta.url));
78
- return join(moduleDirectory, "..", "..", ".agents", "skills", name);
79
- }
80
- async function installedSkillIsCurrent(directory, version, sourceFingerprint) {
81
- const marker = await readInstallationMarker(join(directory, installationMarkerName));
82
- if (marker?.version !== version || marker.fingerprint !== sourceFingerprint) {
83
- return false;
84
- }
85
- return await fingerprintSkill(directory) === sourceFingerprint;
86
- }
87
- async function requireSemanticAtlasSkill(directory, description) {
88
- return requireManagedSkill(directory, skillName, description);
89
- }
90
- async function requireManagedSkill(directory, name, description) {
91
- let contents;
92
- try {
93
- contents = await readFile(join(directory, "SKILL.md"), "utf8");
94
- }
95
- catch {
96
- throw new Error(`Refusing to replace ${description} at ${directory}: SKILL.md is missing`);
97
- }
98
- const escapedName = name.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
99
- const namePattern = new RegExp(`^---\\r?\\n[\\s\\S]*?^name:\\s*["']?${escapedName}["']?\\s*$[\\s\\S]*?^---\\s*$`, "mu");
100
- if (!namePattern.test(contents)) {
101
- throw new Error(`Refusing to replace unrelated Skill at ${directory}`);
102
- }
103
- }
104
- async function installManagedSkill(options) {
105
- const targetExists = await exists(options.targetDirectory);
106
- const fingerprint = await fingerprintSkill(options.sourceDirectory);
107
- const current = targetExists && await installedSkillIsCurrent(options.targetDirectory, options.version, fingerprint);
108
- if (current)
109
- return "current";
110
- await installSkillAtomically(options.sourceDirectory, options.targetDirectory, {
111
- version: options.version,
112
- fingerprint,
113
- });
114
- return targetExists ? "updated" : "installed";
115
- }
116
- async function installSkillAtomically(sourceDirectory, targetDirectory, marker) {
117
- const parent = dirname(targetDirectory);
118
- const token = `${process.pid}-${randomUUID()}`;
119
- const temporary = `${targetDirectory}.installing-${token}`;
120
- const backup = `${targetDirectory}.backup-${token}`;
121
- const targetExists = await exists(targetDirectory);
122
- await mkdir(parent, { recursive: true });
123
- await rm(temporary, { recursive: true, force: true });
124
- await rm(backup, { recursive: true, force: true });
125
- await cp(sourceDirectory, temporary, { recursive: true });
126
- await writeFile(join(temporary, installationMarkerName), `${JSON.stringify(marker, null, 2)}\n`, "utf8");
127
- if (targetExists)
128
- await rename(targetDirectory, backup);
129
- try {
130
- await rename(temporary, targetDirectory);
131
- }
132
- catch (error) {
133
- if (targetExists)
134
- await rename(backup, targetDirectory);
135
- throw error;
136
- }
137
- await rm(backup, { recursive: true, force: true });
138
- }
139
- async function readInstallationMarker(path) {
140
- try {
141
- const parsed = JSON.parse(await readFile(path, "utf8"));
142
- return typeof parsed.version === "string" && /^[a-f0-9]{64}$/u.test(parsed.fingerprint ?? "")
143
- ? { version: parsed.version, fingerprint: parsed.fingerprint }
144
- : undefined;
145
- }
146
- catch (error) {
147
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
148
- return undefined;
149
- }
150
- return undefined;
151
- }
152
- }
153
- async function fingerprintSkill(directory) {
154
- const hash = createHash("sha256");
155
- for (const path of await listFiles(directory)) {
156
- const relativePath = relative(directory, path);
157
- hash.update(relativePath);
158
- hash.update("\0");
159
- hash.update(await readFile(path));
160
- hash.update("\0");
161
- }
162
- return hash.digest("hex");
163
- }
164
- async function listFiles(directory) {
165
- const result = [];
166
- for (const entry of await readdir(directory, { withFileTypes: true })) {
167
- if (entry.name === installationMarkerName) {
168
- continue;
169
- }
170
- const path = join(directory, entry.name);
171
- if (entry.isDirectory()) {
172
- result.push(...await listFiles(path));
173
- }
174
- else {
175
- result.push(path);
176
- }
177
- }
178
- return result.sort();
179
- }
180
- async function exists(path) {
181
- return access(path).then(() => true, (error) => {
182
- if (error.code === "ENOENT") {
183
- return false;
184
- }
185
- throw error;
186
- });
187
- }
@@ -1,4 +0,0 @@
1
- import type { GitRepository } from "../repository/types.js";
2
- import type { RepositorySnapshot } from "./types.js";
3
- export declare function createRepositorySnapshot(repository: GitRepository): Promise<RepositorySnapshot>;
4
- //# sourceMappingURL=repository-snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repository-snapshot.d.ts","sourceRoot":"","sources":["../../src/snapshots/repository-snapshot.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAGV,kBAAkB,EAGnB,MAAM,YAAY,CAAC;AAyGpB,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,aAAa,GACxB,OAAO,CAAC,kBAAkB,CAAC,CA0B7B"}
@@ -1,119 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- import { lstat, readFile, readlink } from "node:fs/promises";
3
- import { join } from "node:path";
4
- import { runGit } from "../repository/git-command.js";
5
- import { discoverTargetSources, isTargetSource, readCurrentHead, } from "../repository/repository-inspector.js";
6
- function parseIndexEntries(output) {
7
- const entries = new Map();
8
- for (const record of output.toString("utf8").split("\0")) {
9
- if (record.length === 0) {
10
- continue;
11
- }
12
- const separatorIndex = record.indexOf("\t");
13
- const metadata = record.slice(0, separatorIndex).split(" ");
14
- const path = record.slice(separatorIndex + 1);
15
- const [mode, objectId, stageText] = metadata;
16
- if (separatorIndex < 0 || mode === undefined || objectId === undefined || stageText === undefined) {
17
- throw new Error(`Invalid Git index entry: ${record}`);
18
- }
19
- const pathEntries = entries.get(path) ?? [];
20
- pathEntries.push({ mode, objectId, stage: Number.parseInt(stageText, 10) });
21
- entries.set(path, pathEntries);
22
- }
23
- return entries;
24
- }
25
- async function readIndexVersion(indexPath) {
26
- const header = (await readFile(indexPath)).subarray(0, 8);
27
- if (header.length !== 8 || header.subarray(0, 4).toString("ascii") !== "DIRC") {
28
- throw new Error(`Invalid Git index header at ${indexPath}`);
29
- }
30
- return header.readUInt32BE(4);
31
- }
32
- async function readWorktreeContent(absolutePath) {
33
- try {
34
- const fileStat = await lstat(absolutePath);
35
- const symbolicLink = fileStat.isSymbolicLink();
36
- const content = symbolicLink
37
- ? Buffer.from(await readlink(absolutePath), "utf8")
38
- : await readFile(absolutePath);
39
- return {
40
- contentHash: createHash("sha256").update(content).digest("hex"),
41
- executable: (fileStat.mode & 0o111) !== 0,
42
- symbolicLink,
43
- };
44
- }
45
- catch (error) {
46
- if (error.code === "ENOENT") {
47
- return null;
48
- }
49
- throw error;
50
- }
51
- }
52
- function parseChanges(output) {
53
- const staged = new Set();
54
- const unstaged = new Set();
55
- const untracked = new Set();
56
- const records = output.toString("utf8").split("\0");
57
- for (let index = 0; index < records.length; index += 1) {
58
- const record = records[index];
59
- if (record === undefined || record.length < 4) {
60
- continue;
61
- }
62
- const indexState = record[0];
63
- const worktreeState = record[1];
64
- const path = record.slice(3);
65
- const isRenameOrCopy = (indexState === "R" ||
66
- indexState === "C" ||
67
- worktreeState === "R" ||
68
- worktreeState === "C");
69
- const originalPath = isRenameOrCopy ? records[index + 1] : undefined;
70
- if (isRenameOrCopy) {
71
- index += 1;
72
- }
73
- if (!isTargetSource(path) && (originalPath === undefined || !isTargetSource(originalPath))) {
74
- continue;
75
- }
76
- if (indexState === "?" && worktreeState === "?") {
77
- untracked.add(path);
78
- continue;
79
- }
80
- if (indexState !== undefined && indexState !== " ") {
81
- staged.add(path);
82
- }
83
- if (worktreeState !== undefined && worktreeState !== " ") {
84
- unstaged.add(path);
85
- }
86
- }
87
- const sort = (paths) => [...paths].sort((left, right) => (left < right ? -1 : left > right ? 1 : 0));
88
- return {
89
- staged: sort(staged),
90
- unstaged: sort(unstaged),
91
- untracked: sort(untracked),
92
- };
93
- }
94
- export async function createRepositorySnapshot(repository) {
95
- const [headCommit, indexVersion, targetSources, rawIndexEntries, rawChanges] = await Promise.all([
96
- readCurrentHead(repository),
97
- readIndexVersion(repository.indexPath),
98
- discoverTargetSources(repository),
99
- runGit(repository.worktreeRoot, ["ls-files", "--stage", "-z"]),
100
- runGit(repository.worktreeRoot, ["status", "--porcelain=v1", "-z", "--untracked-files=all"]),
101
- ]);
102
- const indexEntries = parseIndexEntries(rawIndexEntries);
103
- const files = await Promise.all(targetSources.map(async (path) => ({
104
- path,
105
- indexEntries: indexEntries.get(path) ?? [],
106
- worktree: await readWorktreeContent(join(repository.worktreeRoot, path)),
107
- })));
108
- const changes = parseChanges(rawChanges);
109
- const content = {
110
- schemaVersion: 1,
111
- repositoryId: repository.repositoryId,
112
- headCommit,
113
- indexVersion,
114
- files,
115
- changes,
116
- };
117
- const snapshotId = createHash("sha256").update(JSON.stringify(content)).digest("hex");
118
- return { snapshotId, ...content };
119
- }
@@ -1,30 +0,0 @@
1
- export interface IndexEntry {
2
- readonly mode: string;
3
- readonly objectId: string;
4
- readonly stage: number;
5
- }
6
- export interface WorktreeContent {
7
- readonly contentHash: string;
8
- readonly executable: boolean;
9
- readonly symbolicLink: boolean;
10
- }
11
- export interface SnapshotFile {
12
- readonly path: string;
13
- readonly indexEntries: readonly IndexEntry[];
14
- readonly worktree: WorktreeContent | null;
15
- }
16
- export interface RepositoryChanges {
17
- readonly staged: readonly string[];
18
- readonly unstaged: readonly string[];
19
- readonly untracked: readonly string[];
20
- }
21
- export interface RepositorySnapshot {
22
- readonly schemaVersion: 1;
23
- readonly snapshotId: string;
24
- readonly repositoryId: string;
25
- readonly headCommit: string;
26
- readonly indexVersion: number;
27
- readonly files: readonly SnapshotFile[];
28
- readonly changes: RepositoryChanges;
29
- }
30
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/snapshots/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,19 +0,0 @@
1
- import type { DatabaseSync as NodeDatabaseSync } from "node:sqlite";
2
- import type { GitRepository } from "../repository/types.js";
3
- export declare const CURRENT_ATLAS_SCHEMA_VERSION = 1;
4
- export declare const SEMANTIC_ATLAS_HOME_ENVIRONMENT_VARIABLE = "SEMANTIC_ATLAS_HOME";
5
- export declare class AtlasDatabase implements Disposable {
6
- #private;
7
- readonly databasePath: string;
8
- readonly connection: NodeDatabaseSync;
9
- constructor(repository: GitRepository);
10
- get schemaVersion(): number;
11
- close(): void;
12
- [Symbol.dispose](): void;
13
- private initializeSchema;
14
- private registerRepository;
15
- }
16
- export declare function resolveAtlasHome(repository: GitRepository): string;
17
- export declare function resolveInsightsDatabasePath(): string;
18
- export declare function resolveAtlasDatabasePath(repository: GitRepository): string;
19
- //# sourceMappingURL=atlas-database.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"atlas-database.d.ts","sourceRoot":"","sources":["../../src/storage/atlas-database.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,wCAAwC,wBAAwB,CAAC;AAM9E,qBAAa,aAAc,YAAW,UAAU;;IAC9C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;gBAG1B,UAAU,EAAE,aAAa;IAcrC,IAAI,aAAa,IAAI,MAAM,CAO1B;IAED,KAAK,IAAI,IAAI;IAQb,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAIxB,OAAO,CAAC,gBAAgB;IAuCxB,OAAO,CAAC,kBAAkB;CAqC3B;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CASlE;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAeD,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,aAAa,GAAG,MAAM,CAQ1E"}