@mc1global/opencode-jarvis 0.1.1 → 0.3.1

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 (299) hide show
  1. package/dist/application/agent-registry/dtos.d.ts +66 -0
  2. package/dist/application/agent-registry/dtos.d.ts.map +1 -0
  3. package/dist/application/agent-registry/dtos.js +11 -0
  4. package/dist/application/agent-registry/dtos.js.map +1 -0
  5. package/dist/application/agent-registry/use-cases.d.ts +39 -0
  6. package/dist/application/agent-registry/use-cases.d.ts.map +1 -0
  7. package/dist/application/agent-registry/use-cases.js +222 -0
  8. package/dist/application/agent-registry/use-cases.js.map +1 -0
  9. package/dist/application/azure-sync/dtos.d.ts +210 -0
  10. package/dist/application/azure-sync/dtos.d.ts.map +1 -0
  11. package/dist/application/azure-sync/dtos.js +11 -0
  12. package/dist/application/azure-sync/dtos.js.map +1 -0
  13. package/dist/application/azure-sync/field-builders.d.ts +54 -0
  14. package/dist/application/azure-sync/field-builders.d.ts.map +1 -0
  15. package/dist/application/azure-sync/field-builders.js +166 -0
  16. package/dist/application/azure-sync/field-builders.js.map +1 -0
  17. package/dist/application/azure-sync/index.d.ts +16 -0
  18. package/dist/application/azure-sync/index.d.ts.map +1 -0
  19. package/dist/application/azure-sync/index.js +10 -0
  20. package/dist/application/azure-sync/index.js.map +1 -0
  21. package/dist/application/azure-sync/pr-use-cases.d.ts +39 -0
  22. package/dist/application/azure-sync/pr-use-cases.d.ts.map +1 -0
  23. package/dist/application/azure-sync/pr-use-cases.js +192 -0
  24. package/dist/application/azure-sync/pr-use-cases.js.map +1 -0
  25. package/dist/application/azure-sync/pull-use-cases.d.ts +43 -0
  26. package/dist/application/azure-sync/pull-use-cases.d.ts.map +1 -0
  27. package/dist/application/azure-sync/pull-use-cases.js +322 -0
  28. package/dist/application/azure-sync/pull-use-cases.js.map +1 -0
  29. package/dist/application/azure-sync/push-use-cases.d.ts +53 -0
  30. package/dist/application/azure-sync/push-use-cases.d.ts.map +1 -0
  31. package/dist/application/azure-sync/push-use-cases.js +341 -0
  32. package/dist/application/azure-sync/push-use-cases.js.map +1 -0
  33. package/dist/application/azure-sync/reverse-field-builder.d.ts +52 -0
  34. package/dist/application/azure-sync/reverse-field-builder.d.ts.map +1 -0
  35. package/dist/application/azure-sync/reverse-field-builder.js +130 -0
  36. package/dist/application/azure-sync/reverse-field-builder.js.map +1 -0
  37. package/dist/application/azure-sync/task-push-use-cases.d.ts +68 -0
  38. package/dist/application/azure-sync/task-push-use-cases.d.ts.map +1 -0
  39. package/dist/application/azure-sync/task-push-use-cases.js +162 -0
  40. package/dist/application/azure-sync/task-push-use-cases.js.map +1 -0
  41. package/dist/application/config/config-service.d.ts +64 -0
  42. package/dist/application/config/config-service.d.ts.map +1 -0
  43. package/dist/application/config/config-service.js +110 -0
  44. package/dist/application/config/config-service.js.map +1 -0
  45. package/dist/application/config/index.d.ts +5 -0
  46. package/dist/application/config/index.d.ts.map +1 -0
  47. package/dist/application/config/index.js +5 -0
  48. package/dist/application/config/index.js.map +1 -0
  49. package/dist/application/kanban/board-use-cases.d.ts.map +1 -1
  50. package/dist/application/kanban/board-use-cases.js +14 -0
  51. package/dist/application/kanban/board-use-cases.js.map +1 -1
  52. package/dist/application/kanban/card-use-cases.d.ts +21 -2
  53. package/dist/application/kanban/card-use-cases.d.ts.map +1 -1
  54. package/dist/application/kanban/card-use-cases.js +180 -1
  55. package/dist/application/kanban/card-use-cases.js.map +1 -1
  56. package/dist/application/kanban/dtos.d.ts +59 -0
  57. package/dist/application/kanban/dtos.d.ts.map +1 -1
  58. package/dist/application/mcp/index.d.ts +10 -0
  59. package/dist/application/mcp/index.d.ts.map +1 -0
  60. package/dist/application/mcp/index.js +8 -0
  61. package/dist/application/mcp/index.js.map +1 -0
  62. package/dist/application/mcp/middleware.d.ts +91 -0
  63. package/dist/application/mcp/middleware.d.ts.map +1 -0
  64. package/dist/application/mcp/middleware.js +84 -0
  65. package/dist/application/mcp/middleware.js.map +1 -0
  66. package/dist/application/mcp/tool-adapter.d.ts +72 -0
  67. package/dist/application/mcp/tool-adapter.d.ts.map +1 -0
  68. package/dist/application/mcp/tool-adapter.js +132 -0
  69. package/dist/application/mcp/tool-adapter.js.map +1 -0
  70. package/dist/application/pipeline/dtos.d.ts +135 -0
  71. package/dist/application/pipeline/dtos.d.ts.map +1 -0
  72. package/dist/application/pipeline/dtos.js +11 -0
  73. package/dist/application/pipeline/dtos.js.map +1 -0
  74. package/dist/application/pipeline/index.d.ts +8 -0
  75. package/dist/application/pipeline/index.d.ts.map +1 -0
  76. package/dist/application/pipeline/index.js +7 -0
  77. package/dist/application/pipeline/index.js.map +1 -0
  78. package/dist/application/pipeline/use-cases.d.ts +67 -0
  79. package/dist/application/pipeline/use-cases.d.ts.map +1 -0
  80. package/dist/application/pipeline/use-cases.js +413 -0
  81. package/dist/application/pipeline/use-cases.js.map +1 -0
  82. package/dist/application/rag/use-cases.d.ts +3 -0
  83. package/dist/application/rag/use-cases.d.ts.map +1 -1
  84. package/dist/application/rag/use-cases.js +112 -34
  85. package/dist/application/rag/use-cases.js.map +1 -1
  86. package/dist/domain/agent-registry/entities.d.ts +68 -0
  87. package/dist/domain/agent-registry/entities.d.ts.map +1 -0
  88. package/dist/domain/agent-registry/entities.js +177 -0
  89. package/dist/domain/agent-registry/entities.js.map +1 -0
  90. package/dist/domain/agent-registry/repositories.d.ts +56 -0
  91. package/dist/domain/agent-registry/repositories.d.ts.map +1 -0
  92. package/dist/domain/agent-registry/repositories.js +12 -0
  93. package/dist/domain/agent-registry/repositories.js.map +1 -0
  94. package/dist/domain/agent-registry/services.d.ts +87 -0
  95. package/dist/domain/agent-registry/services.d.ts.map +1 -0
  96. package/dist/domain/agent-registry/services.js +188 -0
  97. package/dist/domain/agent-registry/services.js.map +1 -0
  98. package/dist/domain/agent-registry/value-objects.d.ts +145 -0
  99. package/dist/domain/agent-registry/value-objects.d.ts.map +1 -0
  100. package/dist/domain/agent-registry/value-objects.js +339 -0
  101. package/dist/domain/agent-registry/value-objects.js.map +1 -0
  102. package/dist/domain/azure-sync/entities.d.ts +165 -0
  103. package/dist/domain/azure-sync/entities.d.ts.map +1 -0
  104. package/dist/domain/azure-sync/entities.js +203 -0
  105. package/dist/domain/azure-sync/entities.js.map +1 -0
  106. package/dist/domain/azure-sync/index.d.ts +16 -0
  107. package/dist/domain/azure-sync/index.d.ts.map +1 -0
  108. package/dist/domain/azure-sync/index.js +14 -0
  109. package/dist/domain/azure-sync/index.js.map +1 -0
  110. package/dist/domain/azure-sync/ports.d.ts +117 -0
  111. package/dist/domain/azure-sync/ports.d.ts.map +1 -0
  112. package/dist/domain/azure-sync/ports.js +13 -0
  113. package/dist/domain/azure-sync/ports.js.map +1 -0
  114. package/dist/domain/azure-sync/repositories.d.ts +53 -0
  115. package/dist/domain/azure-sync/repositories.d.ts.map +1 -0
  116. package/dist/domain/azure-sync/repositories.js +11 -0
  117. package/dist/domain/azure-sync/repositories.js.map +1 -0
  118. package/dist/domain/azure-sync/services.d.ts +107 -0
  119. package/dist/domain/azure-sync/services.d.ts.map +1 -0
  120. package/dist/domain/azure-sync/services.js +316 -0
  121. package/dist/domain/azure-sync/services.js.map +1 -0
  122. package/dist/domain/azure-sync/value-objects.d.ts +129 -0
  123. package/dist/domain/azure-sync/value-objects.d.ts.map +1 -0
  124. package/dist/domain/azure-sync/value-objects.js +343 -0
  125. package/dist/domain/azure-sync/value-objects.js.map +1 -0
  126. package/dist/domain/config/index.d.ts +9 -0
  127. package/dist/domain/config/index.d.ts.map +1 -0
  128. package/dist/domain/config/index.js +7 -0
  129. package/dist/domain/config/index.js.map +1 -0
  130. package/dist/domain/config/repositories.d.ts +36 -0
  131. package/dist/domain/config/repositories.d.ts.map +1 -0
  132. package/dist/domain/config/repositories.js +12 -0
  133. package/dist/domain/config/repositories.js.map +1 -0
  134. package/dist/domain/config/value-objects.d.ts +112 -0
  135. package/dist/domain/config/value-objects.d.ts.map +1 -0
  136. package/dist/domain/config/value-objects.js +93 -0
  137. package/dist/domain/config/value-objects.js.map +1 -0
  138. package/dist/domain/governance/policies.d.ts.map +1 -1
  139. package/dist/domain/governance/policies.js +70 -0
  140. package/dist/domain/governance/policies.js.map +1 -1
  141. package/dist/domain/kanban/entities.d.ts +67 -15
  142. package/dist/domain/kanban/entities.d.ts.map +1 -1
  143. package/dist/domain/kanban/entities.js +177 -14
  144. package/dist/domain/kanban/entities.js.map +1 -1
  145. package/dist/domain/kanban/grooming.d.ts +27 -7
  146. package/dist/domain/kanban/grooming.d.ts.map +1 -1
  147. package/dist/domain/kanban/grooming.js +50 -12
  148. package/dist/domain/kanban/grooming.js.map +1 -1
  149. package/dist/domain/kanban/services.d.ts +16 -2
  150. package/dist/domain/kanban/services.d.ts.map +1 -1
  151. package/dist/domain/kanban/services.js +29 -2
  152. package/dist/domain/kanban/services.js.map +1 -1
  153. package/dist/domain/kanban/value-objects.d.ts +48 -0
  154. package/dist/domain/kanban/value-objects.d.ts.map +1 -1
  155. package/dist/domain/kanban/value-objects.js +53 -0
  156. package/dist/domain/kanban/value-objects.js.map +1 -1
  157. package/dist/domain/pipeline/gate.d.ts +75 -0
  158. package/dist/domain/pipeline/gate.d.ts.map +1 -0
  159. package/dist/domain/pipeline/gate.js +158 -0
  160. package/dist/domain/pipeline/gate.js.map +1 -0
  161. package/dist/domain/pipeline/index.d.ts +13 -0
  162. package/dist/domain/pipeline/index.d.ts.map +1 -0
  163. package/dist/domain/pipeline/index.js +14 -0
  164. package/dist/domain/pipeline/index.js.map +1 -0
  165. package/dist/domain/pipeline/pipeline.d.ts +99 -0
  166. package/dist/domain/pipeline/pipeline.d.ts.map +1 -0
  167. package/dist/domain/pipeline/pipeline.js +257 -0
  168. package/dist/domain/pipeline/pipeline.js.map +1 -0
  169. package/dist/domain/pipeline/ports.d.ts +120 -0
  170. package/dist/domain/pipeline/ports.d.ts.map +1 -0
  171. package/dist/domain/pipeline/ports.js +12 -0
  172. package/dist/domain/pipeline/ports.js.map +1 -0
  173. package/dist/domain/pipeline/repositories.d.ts +66 -0
  174. package/dist/domain/pipeline/repositories.d.ts.map +1 -0
  175. package/dist/domain/pipeline/repositories.js +11 -0
  176. package/dist/domain/pipeline/repositories.js.map +1 -0
  177. package/dist/domain/pipeline/services.d.ts +77 -0
  178. package/dist/domain/pipeline/services.d.ts.map +1 -0
  179. package/dist/domain/pipeline/services.js +156 -0
  180. package/dist/domain/pipeline/services.js.map +1 -0
  181. package/dist/domain/pipeline/value-objects.d.ts +117 -0
  182. package/dist/domain/pipeline/value-objects.d.ts.map +1 -0
  183. package/dist/domain/pipeline/value-objects.js +313 -0
  184. package/dist/domain/pipeline/value-objects.js.map +1 -0
  185. package/dist/domain/rag/value-objects.d.ts +9 -2
  186. package/dist/domain/rag/value-objects.d.ts.map +1 -1
  187. package/dist/domain/rag/value-objects.js +8 -2
  188. package/dist/domain/rag/value-objects.js.map +1 -1
  189. package/dist/hooks/event-handlers.d.ts +3 -0
  190. package/dist/hooks/event-handlers.d.ts.map +1 -1
  191. package/dist/hooks/event-handlers.js +4 -2
  192. package/dist/hooks/event-handlers.js.map +1 -1
  193. package/dist/hooks/logger.d.ts +46 -0
  194. package/dist/hooks/logger.d.ts.map +1 -0
  195. package/dist/hooks/logger.js +79 -0
  196. package/dist/hooks/logger.js.map +1 -0
  197. package/dist/index.d.ts.map +1 -1
  198. package/dist/index.js +152 -108
  199. package/dist/index.js.map +1 -1
  200. package/dist/infrastructure/agent-registry/agent-profile-repository.d.ts +29 -0
  201. package/dist/infrastructure/agent-registry/agent-profile-repository.d.ts.map +1 -0
  202. package/dist/infrastructure/agent-registry/agent-profile-repository.js +109 -0
  203. package/dist/infrastructure/agent-registry/agent-profile-repository.js.map +1 -0
  204. package/dist/infrastructure/agent-registry/agent-session-adapter.d.ts +28 -0
  205. package/dist/infrastructure/agent-registry/agent-session-adapter.d.ts.map +1 -0
  206. package/dist/infrastructure/agent-registry/agent-session-adapter.js +61 -0
  207. package/dist/infrastructure/agent-registry/agent-session-adapter.js.map +1 -0
  208. package/dist/infrastructure/agent-registry/built-in-profiles.d.ts +19 -0
  209. package/dist/infrastructure/agent-registry/built-in-profiles.d.ts.map +1 -0
  210. package/dist/infrastructure/agent-registry/built-in-profiles.js +210 -0
  211. package/dist/infrastructure/agent-registry/built-in-profiles.js.map +1 -0
  212. package/dist/infrastructure/azure-sync/azure-auth.d.ts +40 -0
  213. package/dist/infrastructure/azure-sync/azure-auth.d.ts.map +1 -0
  214. package/dist/infrastructure/azure-sync/azure-auth.js +94 -0
  215. package/dist/infrastructure/azure-sync/azure-auth.js.map +1 -0
  216. package/dist/infrastructure/azure-sync/azure-devops-client.d.ts +43 -0
  217. package/dist/infrastructure/azure-sync/azure-devops-client.d.ts.map +1 -0
  218. package/dist/infrastructure/azure-sync/azure-devops-client.js +296 -0
  219. package/dist/infrastructure/azure-sync/azure-devops-client.js.map +1 -0
  220. package/dist/infrastructure/azure-sync/index.d.ts +9 -0
  221. package/dist/infrastructure/azure-sync/index.d.ts.map +1 -0
  222. package/dist/infrastructure/azure-sync/index.js +12 -0
  223. package/dist/infrastructure/azure-sync/index.js.map +1 -0
  224. package/dist/infrastructure/azure-sync/sqlite-sync-repository.d.ts +39 -0
  225. package/dist/infrastructure/azure-sync/sqlite-sync-repository.d.ts.map +1 -0
  226. package/dist/infrastructure/azure-sync/sqlite-sync-repository.js +202 -0
  227. package/dist/infrastructure/azure-sync/sqlite-sync-repository.js.map +1 -0
  228. package/dist/infrastructure/config/index.d.ts +5 -0
  229. package/dist/infrastructure/config/index.d.ts.map +1 -0
  230. package/dist/infrastructure/config/index.js +5 -0
  231. package/dist/infrastructure/config/index.js.map +1 -0
  232. package/dist/infrastructure/config/yaml-config-repository.d.ts +22 -0
  233. package/dist/infrastructure/config/yaml-config-repository.d.ts.map +1 -0
  234. package/dist/infrastructure/config/yaml-config-repository.js +68 -0
  235. package/dist/infrastructure/config/yaml-config-repository.js.map +1 -0
  236. package/dist/infrastructure/domain-map/llm-prompt-factory.d.ts +21 -0
  237. package/dist/infrastructure/domain-map/llm-prompt-factory.d.ts.map +1 -0
  238. package/dist/infrastructure/domain-map/llm-prompt-factory.js +49 -0
  239. package/dist/infrastructure/domain-map/llm-prompt-factory.js.map +1 -0
  240. package/dist/infrastructure/kanban/card-repository.d.ts +6 -0
  241. package/dist/infrastructure/kanban/card-repository.d.ts.map +1 -1
  242. package/dist/infrastructure/kanban/card-repository.js +79 -7
  243. package/dist/infrastructure/kanban/card-repository.js.map +1 -1
  244. package/dist/infrastructure/pipeline/dagger-adapter.d.ts +50 -0
  245. package/dist/infrastructure/pipeline/dagger-adapter.d.ts.map +1 -0
  246. package/dist/infrastructure/pipeline/dagger-adapter.js +153 -0
  247. package/dist/infrastructure/pipeline/dagger-adapter.js.map +1 -0
  248. package/dist/infrastructure/pipeline/dagger-scaffold-generator.d.ts +35 -0
  249. package/dist/infrastructure/pipeline/dagger-scaffold-generator.d.ts.map +1 -0
  250. package/dist/infrastructure/pipeline/dagger-scaffold-generator.js +132 -0
  251. package/dist/infrastructure/pipeline/dagger-scaffold-generator.js.map +1 -0
  252. package/dist/infrastructure/pipeline/index.d.ts +20 -0
  253. package/dist/infrastructure/pipeline/index.d.ts.map +1 -0
  254. package/dist/infrastructure/pipeline/index.js +19 -0
  255. package/dist/infrastructure/pipeline/index.js.map +1 -0
  256. package/dist/infrastructure/pipeline/pipeline-template-registry.d.ts +23 -0
  257. package/dist/infrastructure/pipeline/pipeline-template-registry.d.ts.map +1 -0
  258. package/dist/infrastructure/pipeline/pipeline-template-registry.js +63 -0
  259. package/dist/infrastructure/pipeline/pipeline-template-registry.js.map +1 -0
  260. package/dist/infrastructure/pipeline/scaffold-templates-extra.d.ts +17 -0
  261. package/dist/infrastructure/pipeline/scaffold-templates-extra.d.ts.map +1 -0
  262. package/dist/infrastructure/pipeline/scaffold-templates-extra.js +467 -0
  263. package/dist/infrastructure/pipeline/scaffold-templates-extra.js.map +1 -0
  264. package/dist/infrastructure/pipeline/scaffold-templates.d.ts +23 -0
  265. package/dist/infrastructure/pipeline/scaffold-templates.d.ts.map +1 -0
  266. package/dist/infrastructure/pipeline/scaffold-templates.js +476 -0
  267. package/dist/infrastructure/pipeline/scaffold-templates.js.map +1 -0
  268. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.d.ts +32 -0
  269. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.d.ts.map +1 -0
  270. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.js +197 -0
  271. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.js.map +1 -0
  272. package/dist/mcp-server.d.ts +3 -0
  273. package/dist/mcp-server.d.ts.map +1 -0
  274. package/dist/mcp-server.js +300 -0
  275. package/dist/mcp-server.js.map +1 -0
  276. package/dist/tools/agent-registry-tools.d.ts +11 -0
  277. package/dist/tools/agent-registry-tools.d.ts.map +1 -0
  278. package/dist/tools/agent-registry-tools.js +208 -0
  279. package/dist/tools/agent-registry-tools.js.map +1 -0
  280. package/dist/tools/azure-sync-tools.d.ts +15 -0
  281. package/dist/tools/azure-sync-tools.d.ts.map +1 -0
  282. package/dist/tools/azure-sync-tools.js +332 -0
  283. package/dist/tools/azure-sync-tools.js.map +1 -0
  284. package/dist/tools/kanban-card-tools.d.ts.map +1 -1
  285. package/dist/tools/kanban-card-tools.js +41 -16
  286. package/dist/tools/kanban-card-tools.js.map +1 -1
  287. package/dist/tools/kanban-gate-tools.d.ts +7 -0
  288. package/dist/tools/kanban-gate-tools.d.ts.map +1 -0
  289. package/dist/tools/kanban-gate-tools.js +106 -0
  290. package/dist/tools/kanban-gate-tools.js.map +1 -0
  291. package/dist/tools/kanban-grooming-tools.d.ts +7 -0
  292. package/dist/tools/kanban-grooming-tools.d.ts.map +1 -0
  293. package/dist/tools/kanban-grooming-tools.js +180 -0
  294. package/dist/tools/kanban-grooming-tools.js.map +1 -0
  295. package/dist/tools/pipeline-tools.d.ts +15 -0
  296. package/dist/tools/pipeline-tools.d.ts.map +1 -0
  297. package/dist/tools/pipeline-tools.js +424 -0
  298. package/dist/tools/pipeline-tools.js.map +1 -0
  299. package/package.json +7 -2
@@ -0,0 +1,316 @@
1
+ /**
2
+ * Azure Sync Domain — Services
3
+ *
4
+ * FieldMapper adapts field mappings per Azure DevOps process template.
5
+ * ConflictResolver determines sync outcomes when both sides are modified.
6
+ *
7
+ * SOLID: SRP — each service has one responsibility
8
+ * SOLID: OCP — new templates added by extending mapping tables
9
+ * DDD: Domain services encapsulating logic that doesn't belong to entities
10
+ */
11
+ import { FieldMapping, LOCAL_TO_AZURE_STATE, AZURE_TO_LOCAL_STATE, LOCAL_TO_AZURE_TYPE, } from "./value-objects.js";
12
+ // ─── Azure DevOps Field References ───────────────────────────────────────────
13
+ /** Well-known Azure DevOps field reference names. */
14
+ export const AZURE_FIELDS = {
15
+ TITLE: "System.Title",
16
+ STATE: "System.State",
17
+ DESCRIPTION: "System.Description",
18
+ PRIORITY: "Microsoft.VSTS.Common.Priority",
19
+ ITERATION_PATH: "System.IterationPath",
20
+ AREA_PATH: "System.AreaPath",
21
+ WORK_ITEM_TYPE: "System.WorkItemType",
22
+ TAGS: "System.Tags",
23
+ // Agile-specific
24
+ STORY_POINTS: "Microsoft.VSTS.Scheduling.StoryPoints",
25
+ ACCEPTANCE_CRITERIA_HTML: "Microsoft.VSTS.Common.AcceptanceCriteria",
26
+ // Scrum-specific
27
+ EFFORT: "Microsoft.VSTS.Scheduling.Effort",
28
+ };
29
+ // ─── Per-Template Field Rules ─────────────────────────────────────────────────
30
+ /** Fields available across all process templates. */
31
+ const UNIVERSAL_FIELDS = [
32
+ { localField: "title", azureField: AZURE_FIELDS.TITLE, fallback: "none" },
33
+ {
34
+ localField: "description",
35
+ azureField: AZURE_FIELDS.DESCRIPTION,
36
+ fallback: "none",
37
+ },
38
+ {
39
+ localField: "priority",
40
+ azureField: AZURE_FIELDS.PRIORITY,
41
+ fallback: "none",
42
+ },
43
+ {
44
+ localField: "iterationPath",
45
+ azureField: AZURE_FIELDS.ITERATION_PATH,
46
+ fallback: "none",
47
+ },
48
+ {
49
+ localField: "areaPath",
50
+ azureField: AZURE_FIELDS.AREA_PATH,
51
+ fallback: "none",
52
+ },
53
+ { localField: "tags", azureField: AZURE_FIELDS.TAGS, fallback: "none" },
54
+ ];
55
+ /** Additional field rules per process template (beyond universal). */
56
+ const TEMPLATE_SPECIFIC_FIELDS = {
57
+ basic: [
58
+ { localField: "storyPoints", azureField: AZURE_FIELDS.TAGS, fallback: "tag" },
59
+ {
60
+ localField: "acceptanceCriteria",
61
+ azureField: AZURE_FIELDS.DESCRIPTION,
62
+ fallback: "description",
63
+ },
64
+ ],
65
+ agile: [
66
+ {
67
+ localField: "storyPoints",
68
+ azureField: AZURE_FIELDS.STORY_POINTS,
69
+ fallback: "none",
70
+ },
71
+ {
72
+ localField: "acceptanceCriteria",
73
+ azureField: AZURE_FIELDS.ACCEPTANCE_CRITERIA_HTML,
74
+ fallback: "none",
75
+ },
76
+ ],
77
+ scrum: [
78
+ {
79
+ localField: "storyPoints",
80
+ azureField: AZURE_FIELDS.EFFORT,
81
+ fallback: "none",
82
+ },
83
+ {
84
+ localField: "acceptanceCriteria",
85
+ azureField: AZURE_FIELDS.ACCEPTANCE_CRITERIA_HTML,
86
+ fallback: "none",
87
+ },
88
+ ],
89
+ cmmi: [
90
+ { localField: "storyPoints", azureField: AZURE_FIELDS.TAGS, fallback: "tag" },
91
+ {
92
+ localField: "acceptanceCriteria",
93
+ azureField: AZURE_FIELDS.DESCRIPTION,
94
+ fallback: "description",
95
+ },
96
+ ],
97
+ };
98
+ // ─── FieldMapper Service ──────────────────────────────────────────────────────
99
+ /**
100
+ * Produces field mappings adapted to the target Azure DevOps process template.
101
+ * Handles the differences between Basic, Agile, Scrum, and CMMI templates
102
+ * by selecting the correct Azure field reference or applying fallback strategies.
103
+ */
104
+ export class FieldMapper {
105
+ /**
106
+ * Get all field mappings for a given process template.
107
+ * Returns universal fields plus template-specific fields.
108
+ */
109
+ getFieldMappings(template) {
110
+ const universal = UNIVERSAL_FIELDS.map((r) => FieldMapping.create(r.localField, r.azureField, r.fallback));
111
+ const specific = TEMPLATE_SPECIFIC_FIELDS[template].map((r) => FieldMapping.create(r.localField, r.azureField, r.fallback));
112
+ return [...universal, ...specific];
113
+ }
114
+ /**
115
+ * Map a local kanban state to an Azure DevOps work item state.
116
+ * Returns the state string expected by Azure DevOps REST API.
117
+ */
118
+ mapStateToAzure(template, localState) {
119
+ const mapping = LOCAL_TO_AZURE_STATE[template];
120
+ return mapping[localState];
121
+ }
122
+ /**
123
+ * Map an Azure DevOps work item state to a local kanban state.
124
+ * Returns undefined if the Azure state is not recognized for this template.
125
+ */
126
+ mapStateFromAzure(template, azureState) {
127
+ const mapping = AZURE_TO_LOCAL_STATE[template];
128
+ return mapping[azureState];
129
+ }
130
+ /**
131
+ * Get the Azure DevOps work item type for a local entity type.
132
+ * Returns the work item type string for the REST API.
133
+ */
134
+ mapWorkItemType(template, localType) {
135
+ const mapping = LOCAL_TO_AZURE_TYPE[template];
136
+ return mapping[localType];
137
+ }
138
+ /**
139
+ * Build the Azure DevOps tag string for story points fallback.
140
+ * Used by Basic/CMMI templates that lack a native story points field.
141
+ * Format: "SP:N" appended to existing tags.
142
+ */
143
+ buildStoryPointsTag(points, existingTags) {
144
+ // Remove any existing SP tag
145
+ const filtered = existingTags
146
+ .split(";")
147
+ .map((t) => t.trim())
148
+ .filter((t) => !t.startsWith("SP:") && t.length > 0);
149
+ filtered.push(`SP:${points}`);
150
+ return filtered.join("; ");
151
+ }
152
+ /**
153
+ * Extract story points from an Azure DevOps tag string.
154
+ * Returns undefined if no SP tag is found.
155
+ */
156
+ extractStoryPointsFromTags(tags) {
157
+ const parts = tags.split(";").map((t) => t.trim());
158
+ const spTag = parts.find((t) => t.startsWith("SP:"));
159
+ if (!spTag)
160
+ return undefined;
161
+ const value = parseInt(spTag.substring(3), 10);
162
+ return isNaN(value) ? undefined : value;
163
+ }
164
+ /**
165
+ * Build acceptance criteria HTML to embed in the Description field.
166
+ * Used by Basic/CMMI templates that lack a dedicated AC field.
167
+ */
168
+ buildAcceptanceCriteriaHtml(description, criteria) {
169
+ if (criteria.length === 0)
170
+ return description;
171
+ const acHtml = criteria
172
+ .map((c) => `<li>${escapeHtml(c)}</li>`)
173
+ .join("");
174
+ const acSection = `<h3>Acceptance Criteria</h3><ul>${acHtml}</ul>`;
175
+ return description
176
+ ? `${description}<hr/>${acSection}`
177
+ : acSection;
178
+ }
179
+ /**
180
+ * Extract acceptance criteria from Description HTML.
181
+ * Looks for the AC section appended by buildAcceptanceCriteriaHtml.
182
+ * Handles Azure DevOps HTML normalization (whitespace, self-closing tags).
183
+ */
184
+ extractAcceptanceCriteriaFromHtml(html) {
185
+ // Azure DevOps normalizes HTML: <hr/> -> <hr>, adds whitespace around tags.
186
+ // Use a flexible regex to find the separator pattern.
187
+ const separatorPattern = /<hr\s*\/?>[\s]*<h3>\s*Acceptance Criteria\s*<\/h3>/i;
188
+ const separatorMatch = separatorPattern.exec(html);
189
+ if (!separatorMatch) {
190
+ return { description: html, criteria: [] };
191
+ }
192
+ const description = html.substring(0, separatorMatch.index).trim();
193
+ const acPart = html.substring(separatorMatch.index + separatorMatch[0].length);
194
+ // Flexible li extraction — handles whitespace around content
195
+ const liRegex = /<li>\s*(.*?)\s*<\/li>/gi;
196
+ const criteria = [];
197
+ let match = liRegex.exec(acPart);
198
+ while (match !== null) {
199
+ const content = match[1];
200
+ if (content !== undefined && content.trim().length > 0) {
201
+ criteria.push(unescapeHtml(content.trim()));
202
+ }
203
+ match = liRegex.exec(acPart);
204
+ }
205
+ return { description, criteria };
206
+ }
207
+ }
208
+ /**
209
+ * Resolves conflicts when both local and Azure sides have been modified
210
+ * since the last successful sync. Uses timestamp-based last-write-wins
211
+ * with revision checking.
212
+ */
213
+ export class ConflictResolver {
214
+ /**
215
+ * Determine the sync outcome for a mapping with potential conflicts.
216
+ *
217
+ * Strategy:
218
+ * 1. If only one side modified → that side wins (no conflict)
219
+ * 2. If both modified → last-write-wins based on timestamps
220
+ * 3. If timestamps equal → Azure wins (external source of truth)
221
+ */
222
+ resolve(mapping, direction) {
223
+ const localNewer = mapping.isLocalNewer();
224
+ const azureNewer = mapping.isAzureNewer();
225
+ // No changes on either side
226
+ if (!localNewer && !azureNewer) {
227
+ return { winner: "skip", reason: "No changes detected on either side" };
228
+ }
229
+ // Only local changed — push is safe
230
+ if (localNewer && !azureNewer) {
231
+ if (direction === "pull") {
232
+ return {
233
+ winner: "skip",
234
+ reason: "Only local changes exist but direction is pull",
235
+ };
236
+ }
237
+ return { winner: "local", reason: "Only local side modified since last sync" };
238
+ }
239
+ // Only Azure changed — pull is safe
240
+ if (!localNewer && azureNewer) {
241
+ if (direction === "push") {
242
+ return {
243
+ winner: "skip",
244
+ reason: "Only Azure changes exist but direction is push",
245
+ };
246
+ }
247
+ return { winner: "azure", reason: "Only Azure side modified since last sync" };
248
+ }
249
+ // Both sides modified — true conflict
250
+ return this.resolveConflict(mapping, direction);
251
+ }
252
+ resolveConflict(mapping, direction) {
253
+ if (direction === "push") {
254
+ return {
255
+ winner: "local",
256
+ reason: "Both sides modified — push direction forces local wins",
257
+ };
258
+ }
259
+ if (direction === "pull") {
260
+ return {
261
+ winner: "azure",
262
+ reason: "Both sides modified — pull direction forces Azure wins",
263
+ };
264
+ }
265
+ // Bidirectional: last-write-wins
266
+ const localTime = mapping.localModifiedAt.value.getTime();
267
+ const azureTime = mapping.azureModifiedAt.value.getTime();
268
+ if (localTime > azureTime) {
269
+ return {
270
+ winner: "local",
271
+ reason: "Both sides modified — local is newer (last-write-wins)",
272
+ };
273
+ }
274
+ // Azure wins on tie or when azure is newer
275
+ return {
276
+ winner: "azure",
277
+ reason: localTime === azureTime
278
+ ? "Both sides modified — timestamps equal, Azure wins as external source of truth"
279
+ : "Both sides modified — Azure is newer (last-write-wins)",
280
+ };
281
+ }
282
+ }
283
+ // ─── HTML Utilities ───────────────────────────────────────────────────────────
284
+ function escapeHtml(text) {
285
+ return text
286
+ .replace(/&/g, "&amp;")
287
+ .replace(/</g, "&lt;")
288
+ .replace(/>/g, "&gt;")
289
+ .replace(/"/g, "&quot;");
290
+ }
291
+ function unescapeHtml(text) {
292
+ return text
293
+ .replace(/&amp;/g, "&")
294
+ .replace(/&lt;/g, "<")
295
+ .replace(/&gt;/g, ">")
296
+ .replace(/&quot;/g, "\"");
297
+ }
298
+ // ─── Iteration Name Sanitization ──────────────────────────────────────────────
299
+ /**
300
+ * Characters forbidden in Azure DevOps classification node names.
301
+ * See: https://learn.microsoft.com/en-us/azure/devops/organizations/settings/naming-restrictions
302
+ */
303
+ const INVALID_ITERATION_CHARS = /[\\/$?*:"&><#%|+;]/g;
304
+ /**
305
+ * Sanitize a sprint name for use as an Azure DevOps iteration node name.
306
+ * Replaces invalid characters with dash, normalizes whitespace around dashes, trims.
307
+ */
308
+ export function sanitizeIterationName(name) {
309
+ return name
310
+ .replace(INVALID_ITERATION_CHARS, "-")
311
+ .replace(/\s*-+\s*/g, " - ")
312
+ .replace(/ {2,}/g, " ")
313
+ .replace(/^[ -]+|[ -]+$/g, "")
314
+ .trim();
315
+ }
316
+ //# sourceMappingURL=services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/domain/azure-sync/services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAS5B,gFAAgF;AAEhF,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK,EAAE,cAAc;IACrB,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,oBAAoB;IACjC,QAAQ,EAAE,gCAAgC;IAC1C,cAAc,EAAE,sBAAsB;IACtC,SAAS,EAAE,iBAAiB;IAC5B,cAAc,EAAE,qBAAqB;IACrC,IAAI,EAAE,aAAa;IACnB,iBAAiB;IACjB,YAAY,EAAE,uCAAuC;IACrD,w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AAI;SACR,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;SACrB,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAEtD;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO,IAAI;SACR,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC;SACrC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC;SAC3B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;SAC7B,IAAI,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Azure Sync Domain — Value Objects
3
+ *
4
+ * Identifiers, enums, and constrained types for the azure-sync bounded context.
5
+ * Models Azure DevOps concepts (organizations, work items, process templates)
6
+ * with validation and immutability. Zero external dependencies (pure domain).
7
+ *
8
+ * SOLID: SRP — each type models a single domain concept
9
+ * DDD: Value Objects compared by value, no identity of their own
10
+ */
11
+ import { EntityId } from "../shared/value-objects.js";
12
+ /** Sync mapping identifier (format: SM-NNN). */
13
+ export declare class SyncMappingId extends EntityId {
14
+ private constructor();
15
+ static create(sequence: number): SyncMappingId;
16
+ static from(value: string): SyncMappingId;
17
+ get sequence(): number;
18
+ }
19
+ /** Sync log entry identifier (format: SL-NNN). */
20
+ export declare class SyncLogId extends EntityId {
21
+ private constructor();
22
+ static create(sequence: number): SyncLogId;
23
+ static from(value: string): SyncLogId;
24
+ get sequence(): number;
25
+ }
26
+ /**
27
+ * Validated Azure DevOps organization URL.
28
+ * Accepts formats:
29
+ * - https://dev.azure.com/{org}
30
+ * - https://{org}.visualstudio.com
31
+ */
32
+ export declare class AzureOrgUrl {
33
+ readonly value: string;
34
+ private static readonly DEV_AZURE_PATTERN;
35
+ private static readonly VSTS_PATTERN;
36
+ private constructor();
37
+ static create(url: string): AzureOrgUrl;
38
+ static from(value: string): AzureOrgUrl;
39
+ /** Extract the organization name from the URL. */
40
+ get orgName(): string;
41
+ equals(other: AzureOrgUrl): boolean;
42
+ toString(): string;
43
+ }
44
+ /**
45
+ * Azure DevOps work item numeric identifier.
46
+ * Always a positive integer assigned by Azure DevOps.
47
+ */
48
+ export declare class WorkItemId {
49
+ readonly value: number;
50
+ private constructor();
51
+ static create(id: number): WorkItemId;
52
+ static from(value: number): WorkItemId;
53
+ equals(other: WorkItemId): boolean;
54
+ toString(): string;
55
+ }
56
+ /** Azure DevOps process templates that determine available fields and states. */
57
+ export declare const PROCESS_TEMPLATES: readonly ["basic", "agile", "scrum", "cmmi"];
58
+ export type ProcessTemplate = (typeof PROCESS_TEMPLATES)[number];
59
+ export declare function isValidProcessTemplate(value: string): value is ProcessTemplate;
60
+ /** Azure DevOps work item types across all process templates. */
61
+ export declare const WORK_ITEM_TYPES: readonly ["Epic", "Issue", "Task", "User Story", "Product Backlog Item", "Bug", "Feature", "Requirement"];
62
+ export type WorkItemType = (typeof WORK_ITEM_TYPES)[number];
63
+ /**
64
+ * Maps local entity types to Azure DevOps work item types per process template.
65
+ * Local "card" maps to the primary work item type for the template.
66
+ */
67
+ export declare const LOCAL_TO_AZURE_TYPE: Record<ProcessTemplate, Record<string, WorkItemType>>;
68
+ export declare const SYNC_DIRECTIONS: readonly ["push", "pull", "bidirectional"];
69
+ export type SyncDirection = (typeof SYNC_DIRECTIONS)[number];
70
+ export declare function isValidSyncDirection(value: string): value is SyncDirection;
71
+ export declare const SYNC_STATUSES: readonly ["pending", "synced", "conflict", "error", "stale"];
72
+ export type SyncStatus = (typeof SYNC_STATUSES)[number];
73
+ export declare function isValidSyncStatus(value: string): value is SyncStatus;
74
+ /** Azure DevOps work item states per process template. */
75
+ export declare const AZURE_STATES: Record<ProcessTemplate, readonly string[]>;
76
+ /**
77
+ * Local kanban states ordered by workflow progression.
78
+ * Used for mapping to/from Azure DevOps states.
79
+ */
80
+ export declare const LOCAL_KANBAN_STATES: readonly ["backlog", "grooming", "ready", "doing", "review", "blocked", "tested", "done"];
81
+ export type LocalKanbanState = (typeof LOCAL_KANBAN_STATES)[number];
82
+ /**
83
+ * Maps local kanban states to Azure DevOps states per process template.
84
+ * Multiple local states may map to a single Azure state.
85
+ */
86
+ export declare const LOCAL_TO_AZURE_STATE: Record<ProcessTemplate, Record<LocalKanbanState, string>>;
87
+ /**
88
+ * Maps Azure DevOps states back to the most likely local kanban state.
89
+ * Since the mapping is many-to-one, we pick the "earliest" local state
90
+ * that maps to the Azure state (conservative approach).
91
+ */
92
+ export declare const AZURE_TO_LOCAL_STATE: Record<ProcessTemplate, Record<string, LocalKanbanState>>;
93
+ /**
94
+ * Maps acceptance criteria "met" status to Azure DevOps Task states.
95
+ * Tasks have simpler state workflows than parent work items.
96
+ * met=true → completed state, met=false → initial state.
97
+ */
98
+ export declare const TASK_STATE_FOR_MET: Record<ProcessTemplate, {
99
+ done: string;
100
+ todo: string;
101
+ }>;
102
+ /**
103
+ * Represents a mapping between a local field name and an Azure DevOps field reference.
104
+ * Some fields only exist on certain process templates; the `fallback` strategy
105
+ * specifies how to handle the field on templates that lack native support.
106
+ */
107
+ export declare class FieldMapping {
108
+ readonly localField: string;
109
+ readonly azureField: string;
110
+ readonly fallback: FieldFallback;
111
+ private constructor();
112
+ static create(localField: string, azureField: string, fallback?: FieldFallback): FieldMapping;
113
+ static from(localField: string, azureField: string, fallback: FieldFallback): FieldMapping;
114
+ equals(other: FieldMapping): boolean;
115
+ toString(): string;
116
+ }
117
+ /** Strategy for handling fields that don't exist on the target process template. */
118
+ export declare const FIELD_FALLBACKS: readonly ["none", "tag", "description", "skip"];
119
+ export type FieldFallback = (typeof FIELD_FALLBACKS)[number];
120
+ export declare function isValidFieldFallback(value: string): value is FieldFallback;
121
+ /** Supported authentication methods for Azure DevOps REST API. */
122
+ export declare const AUTH_METHODS: readonly ["az-cli", "pat"];
123
+ export type AuthMethod = (typeof AUTH_METHODS)[number];
124
+ export declare function isValidAuthMethod(value: string): value is AuthMethod;
125
+ /** Local JARVIS entity types that can be synced to Azure DevOps. */
126
+ export declare const LOCAL_ENTITY_TYPES: readonly ["card", "epic", "sprint", "task"];
127
+ export type LocalEntityType = (typeof LOCAL_ENTITY_TYPES)[number];
128
+ export declare function isValidLocalEntityType(value: string): value is LocalEntityType;
129
+ //# sourceMappingURL=value-objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-objects.d.ts","sourceRoot":"","sources":["../../../src/domain/azure-sync/value-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAItD,gDAAgD;AAChD,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa;IAO9C,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAIzC,IAAI,QAAQ,IAAI,MAAM,CAGrB;CACF;AAED,kDAAkD;AAClD,qBAAa,SAAU,SAAQ,QAAQ;IACrC,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAO1C,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIrC,IAAI,QAAQ,IAAI,MAAM,CAGrB;CACF;AAID;;;;;GAKG;AACH,qBAAa,WAAW;aAMc,KAAK,EAAE,MAAM;IALjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CACqB;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAC4B;IAEhE,OAAO;IAEP,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAgBvC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