contextos-agents 1.7.0 → 2.0.0-beta.3

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 (313) hide show
  1. package/.agents/AGENTS.md +16 -50
  2. package/.agents/adapters/aider/export.js +117 -99
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -53
  5. package/.agents/adapters/cursor/export.js +100 -104
  6. package/.agents/adapters/drift-detector.js +196 -0
  7. package/.agents/adapters/gemini/export.js +76 -45
  8. package/.agents/adapters/pure-compiler.js +443 -0
  9. package/.agents/adapters/zed/export.js +104 -96
  10. package/.agents/compiled/registry.v2.json +504 -0
  11. package/.agents/compiled/registry.v2.sha256 +1 -0
  12. package/.agents/compiler/manifest-compiler.js +963 -0
  13. package/.agents/compiler/vendor/yaml.LICENSE.txt +13 -0
  14. package/.agents/compiler/vendor/yaml.SBOM.json +6 -0
  15. package/.agents/compiler/vendor/yaml.js +139 -0
  16. package/.agents/core/profiles/init.yaml +25 -0
  17. package/.agents/core/skills/context-manager/skill.yaml +3 -5
  18. package/.agents/core/skills/context-os/SKILL.md +3 -6
  19. package/.agents/core/skills/context-os/skill.yaml +3 -8
  20. package/.agents/core/skills/engineering-workflow/skill.yaml +1 -7
  21. package/.agents/core/skills/gemini-precision/skill.yaml +1 -6
  22. package/.agents/core/skills/gstack-roles/skill.yaml +3 -6
  23. package/.agents/core/skills/ponytail-mindset/skill.yaml +1 -7
  24. package/.agents/core/skills/security/skill.yaml +15 -3
  25. package/.agents/ctx.js +537 -112
  26. package/.agents/customization-dx.js +282 -0
  27. package/.agents/doctor.js +855 -66
  28. package/.agents/filesystem/index.js +71 -0
  29. package/.agents/filesystem/journaled-transaction.js +451 -0
  30. package/.agents/filesystem/lockfile-v2.js +275 -0
  31. package/.agents/filesystem/platform-hardening.js +222 -0
  32. package/.agents/filesystem/project-lock.js +218 -0
  33. package/.agents/filesystem/safe-path.js +256 -0
  34. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  35. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  36. package/.agents/plugins/contextos/plugin.json +1 -1
  37. package/.agents/plugins.js +278 -64
  38. package/.agents/profiles.js +486 -51
  39. package/.agents/resolver/canonical-resolver.js +1348 -0
  40. package/.agents/resolver.js +50 -534
  41. package/.agents/rules/rule-catalog.js +525 -0
  42. package/.agents/schemas/attestation.review.v1.json +111 -0
  43. package/.agents/schemas/attestation.verification.v1.json +85 -0
  44. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  45. package/.agents/schemas/profile.v2.schema.json +114 -0
  46. package/.agents/schemas/runtime.thread.v1.json +192 -0
  47. package/.agents/schemas/skill.manifest.v2.json +177 -0
  48. package/.agents/schemas/verification.spec.v1.json +39 -0
  49. package/.agents/schemas/workspace.graph.schema.json +106 -0
  50. package/.agents/skills-index.json +6 -166
  51. package/.agents/stats.js +9 -9
  52. package/.agents/transaction-core/event-store.js +288 -0
  53. package/.agents/transaction-core/idempotency.js +129 -0
  54. package/.agents/transaction-core/ipc-lock.js +311 -0
  55. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  56. package/.agents/validate.js +44 -1
  57. package/.agents/watch.js +354 -102
  58. package/.agents/workspace/workspace-graph.js +778 -0
  59. package/README.md +59 -387
  60. package/benchmarks/v2/analysis/statistics.js +140 -0
  61. package/benchmarks/v2/analysis/stats.js +69 -0
  62. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  63. package/benchmarks/v2/dataset.schema.json +34 -0
  64. package/benchmarks/v2/evaluators/index.js +25 -0
  65. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  66. package/benchmarks/v2/harness/runner.js +88 -0
  67. package/benchmarks/v2/pilot-tasks.json +392 -0
  68. package/bin/commands/recover.js +88 -0
  69. package/bin/commands/update.js +80 -17
  70. package/bin/commands.js +62 -25
  71. package/bin/index.js +138 -81
  72. package/bin/lib/lockfile.js +5 -3
  73. package/bin/lib/safe-writer.js +34 -3
  74. package/package.json +87 -72
  75. package/registry.json +2 -2
  76. package/registry.v2.schema.json +86 -0
  77. package/.agents/core/profiles/backend.yaml +0 -47
  78. package/.agents/core/profiles/enterprise.yaml +0 -46
  79. package/.agents/core/profiles/frontend.yaml +0 -46
  80. package/.agents/core/profiles/hackathon.yaml +0 -45
  81. package/.agents/core/profiles/mvp.yaml +0 -44
  82. package/.agents/core/profiles/startup.yaml +0 -48
  83. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  84. package/.agents/core/skills/adapters/SKILL.md +0 -105
  85. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  86. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  87. package/.agents/core/skills/adapters/skill.yaml +0 -16
  88. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  89. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  90. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -12
  91. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  92. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  93. package/.agents/core/skills/brutalist-design/skill.yaml +0 -12
  94. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  95. package/.agents/core/skills/database/SKILL.md +0 -101
  96. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  97. package/.agents/core/skills/database/VALIDATION.json +0 -11
  98. package/.agents/core/skills/database/skill.yaml +0 -31
  99. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  100. package/.agents/core/skills/ddd/SKILL.md +0 -247
  101. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  102. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  103. package/.agents/core/skills/ddd/ddd.md +0 -178
  104. package/.agents/core/skills/ddd/skill.yaml +0 -17
  105. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  106. package/.agents/core/skills/decisions/SKILL.md +0 -90
  107. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  108. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  109. package/.agents/core/skills/decisions/skill.yaml +0 -16
  110. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  111. package/.agents/core/skills/docker/SKILL.md +0 -63
  112. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  113. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  114. package/.agents/core/skills/docker/skill.yaml +0 -29
  115. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  116. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  117. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  118. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  119. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  120. package/.agents/core/skills/fastapi/skill.yaml +0 -17
  121. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  122. package/.agents/core/skills/generators/SKILL.md +0 -112
  123. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  124. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  125. package/.agents/core/skills/generators/skill.yaml +0 -25
  126. package/.agents/core/skills/generators/templates/API.md +0 -77
  127. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  128. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  129. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  130. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  131. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  132. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  133. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  134. package/.agents/core/skills/generators/templates/UI.md +0 -73
  135. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  136. package/.agents/core/skills/graphify/SKILL.md +0 -130
  137. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  138. package/.agents/core/skills/graphify/skill.yaml +0 -18
  139. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  140. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  141. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  142. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  143. package/.agents/core/skills/impeccable-design/skill.yaml +0 -20
  144. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  145. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  146. package/.agents/core/skills/interview-me/skill.yaml +0 -12
  147. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  148. package/.agents/core/skills/microservices/SKILL.md +0 -164
  149. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  150. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  151. package/.agents/core/skills/microservices/microservices.md +0 -119
  152. package/.agents/core/skills/microservices/skill.yaml +0 -17
  153. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  154. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  155. package/.agents/core/skills/minimalist-design/skill.yaml +0 -12
  156. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  157. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  158. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  159. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  160. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  161. package/.agents/core/skills/nestjs/skill.yaml +0 -17
  162. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  163. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  164. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  165. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  166. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  167. package/.agents/core/skills/nextjs/skill.yaml +0 -17
  168. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  169. package/.agents/core/skills/node/SKILL.md +0 -128
  170. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  171. package/.agents/core/skills/node/VALIDATION.json +0 -12
  172. package/.agents/core/skills/node/node.md +0 -87
  173. package/.agents/core/skills/node/skill.yaml +0 -17
  174. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  175. package/.agents/core/skills/performance/SKILL.md +0 -75
  176. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  177. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  178. package/.agents/core/skills/performance/performance.md +0 -52
  179. package/.agents/core/skills/performance/skill.yaml +0 -17
  180. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  181. package/.agents/core/skills/react/SKILL.md +0 -132
  182. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  183. package/.agents/core/skills/react/VALIDATION.json +0 -12
  184. package/.agents/core/skills/react/react.md +0 -93
  185. package/.agents/core/skills/react/skill.yaml +0 -17
  186. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  187. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  188. package/.agents/core/skills/react-best-practices/skill.yaml +0 -14
  189. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  190. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  191. package/.agents/core/skills/redesign-audit/skill.yaml +0 -12
  192. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  193. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  194. package/.agents/core/skills/soft-design/skill.yaml +0 -12
  195. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  196. package/.agents/core/skills/state-management/SKILL.md +0 -48
  197. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  198. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  199. package/.agents/core/skills/state-management/skill.yaml +0 -28
  200. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -117
  201. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  202. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -12
  203. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  204. package/.agents/core/skills/system-design/SKILL.md +0 -419
  205. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  206. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  207. package/.agents/core/skills/system-design/skill.yaml +0 -20
  208. package/.agents/core/skills/system-design/system-design.md +0 -112
  209. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  210. package/.agents/core/skills/testing/SKILL.md +0 -70
  211. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  212. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  213. package/.agents/core/skills/testing/skill.yaml +0 -32
  214. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  215. package/.agents/core/skills/typescript/SKILL.md +0 -112
  216. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  217. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  218. package/.agents/core/skills/typescript/skill.yaml +0 -17
  219. package/.agents/core/skills/typescript/typescript.md +0 -71
  220. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  221. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  222. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  223. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  224. package/.agents/core/skills/ui-design/skill.yaml +0 -17
  225. package/.agents/core/skills/ui-design/ui.md +0 -88
  226. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  227. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  228. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  229. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  230. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -19
  231. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  232. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  233. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  234. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  235. package/.agents/core/skills/ux-design/skill.yaml +0 -17
  236. package/.agents/core/skills/ux-design/ux.md +0 -80
  237. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  238. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  239. package/.agents/core/skills/vercel-optimize/scripts/collect-signals.mjs +0 -131
  240. package/.agents/core/skills/vercel-optimize/scripts/gate-investigations.mjs +0 -142
  241. package/.agents/core/skills/vercel-optimize/scripts/merge-signals.mjs +0 -143
  242. package/.agents/core/skills/vercel-optimize/scripts/scan-codebase.mjs +0 -174
  243. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -18
  244. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  245. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  246. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  247. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  248. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  249. package/.agents/core/skills/web-accessibility/skill.yaml +0 -17
  250. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  251. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  252. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  253. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  254. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  255. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  256. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  257. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  258. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  259. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  260. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  261. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  262. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  263. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  264. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  265. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  266. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  267. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  268. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  269. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  270. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  271. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  272. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  273. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -110
  274. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  275. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  276. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  277. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  278. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  279. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  280. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  281. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  282. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  283. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  284. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  285. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  286. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  287. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  288. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  289. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  290. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  291. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  292. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  293. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  294. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  295. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  296. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  297. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  298. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  299. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  300. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  301. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  302. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  303. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  304. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  305. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -116
  306. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  307. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  308. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  309. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  310. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  311. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  312. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  313. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
@@ -0,0 +1,392 @@
1
+ [
2
+ {
3
+ "id": "task-01-mock-task",
4
+ "description": "This is mock task 1 for the benchmark pilot.",
5
+ "expectedState": {
6
+ "filesToExist": [
7
+ "output-01.js"
8
+ ],
9
+ "filesToContain": {
10
+ "output-01.js": "console.log('mock 1');"
11
+ }
12
+ },
13
+ "hash": "sha256:7afaa346b4bf92bf9dc21e9ae809887412a86beb766842e99df7fee6573a4781"
14
+ },
15
+ {
16
+ "id": "task-02-mock-task",
17
+ "description": "This is mock task 2 for the benchmark pilot.",
18
+ "expectedState": {
19
+ "filesToExist": [
20
+ "output-02.js"
21
+ ],
22
+ "filesToContain": {
23
+ "output-02.js": "console.log('mock 2');"
24
+ }
25
+ },
26
+ "hash": "sha256:78686d2704d4d6900bb73f4941aa661a26a09f4346ab5e83281c0a18830ad1dd"
27
+ },
28
+ {
29
+ "id": "task-03-mock-task",
30
+ "description": "This is mock task 3 for the benchmark pilot.",
31
+ "expectedState": {
32
+ "filesToExist": [
33
+ "output-03.js"
34
+ ],
35
+ "filesToContain": {
36
+ "output-03.js": "console.log('mock 3');"
37
+ }
38
+ },
39
+ "hash": "sha256:1724980aa084bbaa16a8a69b664b783799bc75f8abe13ffc65b76843564fbbff"
40
+ },
41
+ {
42
+ "id": "task-04-mock-task",
43
+ "description": "This is mock task 4 for the benchmark pilot.",
44
+ "expectedState": {
45
+ "filesToExist": [
46
+ "output-04.js"
47
+ ],
48
+ "filesToContain": {
49
+ "output-04.js": "console.log('mock 4');"
50
+ }
51
+ },
52
+ "hash": "sha256:8f9ba36d8e59dd863b941cf6aba8709674901dba17f3e9c904e4da733538e38a"
53
+ },
54
+ {
55
+ "id": "task-05-mock-task",
56
+ "description": "This is mock task 5 for the benchmark pilot.",
57
+ "expectedState": {
58
+ "filesToExist": [
59
+ "output-05.js"
60
+ ],
61
+ "filesToContain": {
62
+ "output-05.js": "console.log('mock 5');"
63
+ }
64
+ },
65
+ "hash": "sha256:e7c08de777760acda054e9e20c19133287d1c245ef5efb6abaea6ec1ee3020e9"
66
+ },
67
+ {
68
+ "id": "task-06-mock-task",
69
+ "description": "This is mock task 6 for the benchmark pilot.",
70
+ "expectedState": {
71
+ "filesToExist": [
72
+ "output-06.js"
73
+ ],
74
+ "filesToContain": {
75
+ "output-06.js": "console.log('mock 6');"
76
+ }
77
+ },
78
+ "hash": "sha256:98c4ca9fa7207111d5816fe81f22b0e0cd27dc2b9d78ee9deb626d0a901f6921"
79
+ },
80
+ {
81
+ "id": "task-07-mock-task",
82
+ "description": "This is mock task 7 for the benchmark pilot.",
83
+ "expectedState": {
84
+ "filesToExist": [
85
+ "output-07.js"
86
+ ],
87
+ "filesToContain": {
88
+ "output-07.js": "console.log('mock 7');"
89
+ }
90
+ },
91
+ "hash": "sha256:014e4ceaa5a9e5112150d2536f78ecab3801305b5e95ceabf1de359314f9274f"
92
+ },
93
+ {
94
+ "id": "task-08-mock-task",
95
+ "description": "This is mock task 8 for the benchmark pilot.",
96
+ "expectedState": {
97
+ "filesToExist": [
98
+ "output-08.js"
99
+ ],
100
+ "filesToContain": {
101
+ "output-08.js": "console.log('mock 8');"
102
+ }
103
+ },
104
+ "hash": "sha256:f0470f4ad3dcb981ec0447de20036801ec638a0b7b32ae4dd8e6d1c94c08257e"
105
+ },
106
+ {
107
+ "id": "task-09-mock-task",
108
+ "description": "This is mock task 9 for the benchmark pilot.",
109
+ "expectedState": {
110
+ "filesToExist": [
111
+ "output-09.js"
112
+ ],
113
+ "filesToContain": {
114
+ "output-09.js": "console.log('mock 9');"
115
+ }
116
+ },
117
+ "hash": "sha256:e34d3152baeb112c9bd77f2381ea0cf9b902613c95d5ae2660b51a4e7ede2785"
118
+ },
119
+ {
120
+ "id": "task-10-mock-task",
121
+ "description": "This is mock task 10 for the benchmark pilot.",
122
+ "expectedState": {
123
+ "filesToExist": [
124
+ "output-10.js"
125
+ ],
126
+ "filesToContain": {
127
+ "output-10.js": "console.log('mock 10');"
128
+ }
129
+ },
130
+ "hash": "sha256:8bfdd14ef40300544ba24d517506314c6b8fd3075ecad82341f15eb2715692e0"
131
+ },
132
+ {
133
+ "id": "task-11-mock-task",
134
+ "description": "This is mock task 11 for the benchmark pilot.",
135
+ "expectedState": {
136
+ "filesToExist": [
137
+ "output-11.js"
138
+ ],
139
+ "filesToContain": {
140
+ "output-11.js": "console.log('mock 11');"
141
+ }
142
+ },
143
+ "hash": "sha256:555ada841ff8a3cc6b4ce15165f2d214f818bde82cdb71d942137ab132d499e6"
144
+ },
145
+ {
146
+ "id": "task-12-mock-task",
147
+ "description": "This is mock task 12 for the benchmark pilot.",
148
+ "expectedState": {
149
+ "filesToExist": [
150
+ "output-12.js"
151
+ ],
152
+ "filesToContain": {
153
+ "output-12.js": "console.log('mock 12');"
154
+ }
155
+ },
156
+ "hash": "sha256:712690d9849664fd0adbfeb295d9e47618024ad8c4be52adfa314e3d31481e50"
157
+ },
158
+ {
159
+ "id": "task-13-mock-task",
160
+ "description": "This is mock task 13 for the benchmark pilot.",
161
+ "expectedState": {
162
+ "filesToExist": [
163
+ "output-13.js"
164
+ ],
165
+ "filesToContain": {
166
+ "output-13.js": "console.log('mock 13');"
167
+ }
168
+ },
169
+ "hash": "sha256:aa050d240a6c17ad68f304685f77782bbb8ab5cc6dae23d3cbd845de6cf87304"
170
+ },
171
+ {
172
+ "id": "task-14-mock-task",
173
+ "description": "This is mock task 14 for the benchmark pilot.",
174
+ "expectedState": {
175
+ "filesToExist": [
176
+ "output-14.js"
177
+ ],
178
+ "filesToContain": {
179
+ "output-14.js": "console.log('mock 14');"
180
+ }
181
+ },
182
+ "hash": "sha256:ec88ecb7025218c79945d70e568f358e61452ab70d9c434b337411f6a8f468fc"
183
+ },
184
+ {
185
+ "id": "task-15-mock-task",
186
+ "description": "This is mock task 15 for the benchmark pilot.",
187
+ "expectedState": {
188
+ "filesToExist": [
189
+ "output-15.js"
190
+ ],
191
+ "filesToContain": {
192
+ "output-15.js": "console.log('mock 15');"
193
+ }
194
+ },
195
+ "hash": "sha256:5f1f6caf37ba31b3b91b876e5e592717abc9c97e0349c15e7ff3c2da2d133947"
196
+ },
197
+ {
198
+ "id": "task-16-mock-task",
199
+ "description": "This is mock task 16 for the benchmark pilot.",
200
+ "expectedState": {
201
+ "filesToExist": [
202
+ "output-16.js"
203
+ ],
204
+ "filesToContain": {
205
+ "output-16.js": "console.log('mock 16');"
206
+ }
207
+ },
208
+ "hash": "sha256:e8e6bfe60cd69b3373e667336d41d3c95fdbc5008f9c0eb99b1b94460e7ad0fd"
209
+ },
210
+ {
211
+ "id": "task-17-mock-task",
212
+ "description": "This is mock task 17 for the benchmark pilot.",
213
+ "expectedState": {
214
+ "filesToExist": [
215
+ "output-17.js"
216
+ ],
217
+ "filesToContain": {
218
+ "output-17.js": "console.log('mock 17');"
219
+ }
220
+ },
221
+ "hash": "sha256:3a41c6b074a0770e0fb6822ed252c69a77c05fa7bd97fcd9bf9b16f6cf193dd8"
222
+ },
223
+ {
224
+ "id": "task-18-mock-task",
225
+ "description": "This is mock task 18 for the benchmark pilot.",
226
+ "expectedState": {
227
+ "filesToExist": [
228
+ "output-18.js"
229
+ ],
230
+ "filesToContain": {
231
+ "output-18.js": "console.log('mock 18');"
232
+ }
233
+ },
234
+ "hash": "sha256:dbd6cc88cb73c805eef95f0cea09e09927f6b13e33fad1e69c049d174eab537f"
235
+ },
236
+ {
237
+ "id": "task-19-mock-task",
238
+ "description": "This is mock task 19 for the benchmark pilot.",
239
+ "expectedState": {
240
+ "filesToExist": [
241
+ "output-19.js"
242
+ ],
243
+ "filesToContain": {
244
+ "output-19.js": "console.log('mock 19');"
245
+ }
246
+ },
247
+ "hash": "sha256:b844124ce8543a3863a82699dd4cefb5e9b9391547934546974419be2b069895"
248
+ },
249
+ {
250
+ "id": "task-20-mock-task",
251
+ "description": "This is mock task 20 for the benchmark pilot.",
252
+ "expectedState": {
253
+ "filesToExist": [
254
+ "output-20.js"
255
+ ],
256
+ "filesToContain": {
257
+ "output-20.js": "console.log('mock 20');"
258
+ }
259
+ },
260
+ "hash": "sha256:ad1eb8063f7138e9fb193982a6bc4db5eed1e8fb4af21ddbda75270cb2c06d51"
261
+ },
262
+ {
263
+ "id": "task-21-mock-task",
264
+ "description": "This is mock task 21 for the benchmark pilot.",
265
+ "expectedState": {
266
+ "filesToExist": [
267
+ "output-21.js"
268
+ ],
269
+ "filesToContain": {
270
+ "output-21.js": "console.log('mock 21');"
271
+ }
272
+ },
273
+ "hash": "sha256:2dd74021abc2bb10e9bed627b7fb072311ed8e86b95526b8a57149cd4f89a7df"
274
+ },
275
+ {
276
+ "id": "task-22-mock-task",
277
+ "description": "This is mock task 22 for the benchmark pilot.",
278
+ "expectedState": {
279
+ "filesToExist": [
280
+ "output-22.js"
281
+ ],
282
+ "filesToContain": {
283
+ "output-22.js": "console.log('mock 22');"
284
+ }
285
+ },
286
+ "hash": "sha256:4865211d3986fbea264350c8965dba461d6eb5dec27beceaebd247c49b7f6fff"
287
+ },
288
+ {
289
+ "id": "task-23-mock-task",
290
+ "description": "This is mock task 23 for the benchmark pilot.",
291
+ "expectedState": {
292
+ "filesToExist": [
293
+ "output-23.js"
294
+ ],
295
+ "filesToContain": {
296
+ "output-23.js": "console.log('mock 23');"
297
+ }
298
+ },
299
+ "hash": "sha256:168e4241ee5aee2f186f0aab6856178a11fef6399d27f17f62cc25cb695aac0e"
300
+ },
301
+ {
302
+ "id": "task-24-mock-task",
303
+ "description": "This is mock task 24 for the benchmark pilot.",
304
+ "expectedState": {
305
+ "filesToExist": [
306
+ "output-24.js"
307
+ ],
308
+ "filesToContain": {
309
+ "output-24.js": "console.log('mock 24');"
310
+ }
311
+ },
312
+ "hash": "sha256:1b7f1e388d8f3e020f6f33a61f29bf40f9e56f203f1b634c47b36e70a5493f01"
313
+ },
314
+ {
315
+ "id": "task-25-mock-task",
316
+ "description": "This is mock task 25 for the benchmark pilot.",
317
+ "expectedState": {
318
+ "filesToExist": [
319
+ "output-25.js"
320
+ ],
321
+ "filesToContain": {
322
+ "output-25.js": "console.log('mock 25');"
323
+ }
324
+ },
325
+ "hash": "sha256:2ad0d0c64bbc6d5fc6bb10e398ce1e62ae9a6c73b4a13390646d94f90830ee04"
326
+ },
327
+ {
328
+ "id": "task-26-mock-task",
329
+ "description": "This is mock task 26 for the benchmark pilot.",
330
+ "expectedState": {
331
+ "filesToExist": [
332
+ "output-26.js"
333
+ ],
334
+ "filesToContain": {
335
+ "output-26.js": "console.log('mock 26');"
336
+ }
337
+ },
338
+ "hash": "sha256:b4eaa7cfe62d917b87a0311079eadd9a7c2488676f84b3bad540425c5d52ed5c"
339
+ },
340
+ {
341
+ "id": "task-27-mock-task",
342
+ "description": "This is mock task 27 for the benchmark pilot.",
343
+ "expectedState": {
344
+ "filesToExist": [
345
+ "output-27.js"
346
+ ],
347
+ "filesToContain": {
348
+ "output-27.js": "console.log('mock 27');"
349
+ }
350
+ },
351
+ "hash": "sha256:1d571536957594de46fbd9fe0710eefcc66d849ea53dde9ad61ee483941349e1"
352
+ },
353
+ {
354
+ "id": "task-28-mock-task",
355
+ "description": "This is mock task 28 for the benchmark pilot.",
356
+ "expectedState": {
357
+ "filesToExist": [
358
+ "output-28.js"
359
+ ],
360
+ "filesToContain": {
361
+ "output-28.js": "console.log('mock 28');"
362
+ }
363
+ },
364
+ "hash": "sha256:765672c715bfb9813a05949c7e9eff2a8cd91eed05b0ee026d177561b77411eb"
365
+ },
366
+ {
367
+ "id": "task-29-mock-task",
368
+ "description": "This is mock task 29 for the benchmark pilot.",
369
+ "expectedState": {
370
+ "filesToExist": [
371
+ "output-29.js"
372
+ ],
373
+ "filesToContain": {
374
+ "output-29.js": "console.log('mock 29');"
375
+ }
376
+ },
377
+ "hash": "sha256:7209b936824e13b1ec6eeec1503b0ef2ffd0698378ab5739857130773ebf743c"
378
+ },
379
+ {
380
+ "id": "task-30-mock-task",
381
+ "description": "This is mock task 30 for the benchmark pilot.",
382
+ "expectedState": {
383
+ "filesToExist": [
384
+ "output-30.js"
385
+ ],
386
+ "filesToContain": {
387
+ "output-30.js": "console.log('mock 30');"
388
+ }
389
+ },
390
+ "hash": "sha256:872fd6ef064d17a4315293952bf4d8704c47d3d94affa903695dfd7e2f9461e8"
391
+ }
392
+ ]
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const { JournaledTransaction, TX_STATES } = require('../../.agents/filesystem/journaled-transaction.js');
5
+ const { ProjectMutationLock } = require('../../.agents/filesystem/project-lock.js');
6
+
7
+ // Minimal ANSI colors
8
+ const isTTY = process.stdout.isTTY;
9
+ const c = {
10
+ red: (s) => isTTY ? `\x1b[31m${s}\x1b[0m` : s,
11
+ green: (s) => isTTY ? `\x1b[32m${s}\x1b[0m` : s,
12
+ yellow: (s) => isTTY ? `\x1b[33m${s}\x1b[0m` : s,
13
+ cyan: (s) => isTTY ? `\x1b[36m${s}\x1b[0m` : s,
14
+ };
15
+
16
+ function recoverCommand(args, flags) {
17
+ const ROOT = process.cwd();
18
+
19
+ const isList = flags.list || args.includes('--list');
20
+
21
+ const rollbackIdx = args.indexOf('--rollback');
22
+ const txIdRollback = rollbackIdx !== -1 && args[rollbackIdx + 1] ? args[rollbackIdx + 1] : null;
23
+
24
+ const resumeIdx = args.indexOf('--resume');
25
+ const txIdResume = resumeIdx !== -1 && args[resumeIdx + 1] ? args[resumeIdx + 1] : null;
26
+
27
+ if (isList) {
28
+ const pending = JournaledTransaction.listPending(ROOT);
29
+ if (pending.length === 0) {
30
+ console.log(c.green('✓ No pending or stuck transactions found.'));
31
+ process.exit(0);
32
+ }
33
+ console.log(c.yellow(`Found ${pending.length} pending/stuck transaction(s):\n`));
34
+ pending.forEach(tx => {
35
+ console.log(` ID: ${c.cyan(tx.txId)}`);
36
+ console.log(` State: ${tx.state === TX_STATES.RECOVERY_REQUIRED ? c.red(tx.state) : c.yellow(tx.state)}`);
37
+ console.log(` Date: ${tx.createdAt}`);
38
+ if (tx.error) console.log(` Error: ${c.red(tx.error)}`);
39
+ console.log('');
40
+ });
41
+ console.log('To recover, run:');
42
+ console.log(` contextos recover --resume <ID>`);
43
+ console.log(` contextos recover --rollback <ID>`);
44
+ process.exit(0);
45
+ }
46
+
47
+ if (txIdRollback) {
48
+ console.log(c.cyan(`Attempting to rollback transaction: ${txIdRollback}`));
49
+ const projectLock = new ProjectMutationLock(ROOT);
50
+ let lockToken = null;
51
+ try {
52
+ lockToken = projectLock.acquire({ command: 'recover:rollback' });
53
+ const tx = JournaledTransaction.load(ROOT, txIdRollback);
54
+ tx.rollback();
55
+ console.log(c.green(`✓ Transaction ${txIdRollback} successfully rolled back.`));
56
+ } catch (err) {
57
+ console.error(c.red(`\n[ERROR] Rollback failed: ${err.message}`));
58
+ process.exit(1);
59
+ } finally {
60
+ if (lockToken) projectLock.release(lockToken);
61
+ }
62
+ process.exit(0);
63
+ }
64
+
65
+ if (txIdResume) {
66
+ console.log(c.cyan(`Attempting to resume transaction: ${txIdResume}`));
67
+ const projectLock = new ProjectMutationLock(ROOT);
68
+ let lockToken = null;
69
+ try {
70
+ lockToken = projectLock.acquire({ command: 'recover:resume' });
71
+ const tx = JournaledTransaction.load(ROOT, txIdResume);
72
+ // Simply calling commit() will resume if it's not COMMITTED/ROLLED_BACK
73
+ tx.commit();
74
+ console.log(c.green(`✓ Transaction ${txIdResume} successfully resumed and committed.`));
75
+ } catch (err) {
76
+ console.error(c.red(`\n[ERROR] Resume failed: ${err.message}`));
77
+ process.exit(1);
78
+ } finally {
79
+ if (lockToken) projectLock.release(lockToken);
80
+ }
81
+ process.exit(0);
82
+ }
83
+
84
+ console.log(c.red('Usage: contextos recover [--list] [--rollback <txId>] [--resume <txId>]'));
85
+ process.exit(1);
86
+ }
87
+
88
+ module.exports = recoverCommand;
@@ -12,17 +12,23 @@
12
12
 
13
13
  const fs = require('fs');
14
14
  const path = require('path');
15
+ const {
16
+ LockfileV2Manager,
17
+ ProjectMutationLock,
18
+ JournaledTransaction,
19
+ computeExactHash,
20
+ computeSemanticHash,
21
+ } = require('../../.agents/filesystem/index.js');
15
22
  const {
16
23
  loadLockfile,
17
24
  saveLockfile,
25
+ recordManagedFile,
18
26
  migrateExistingInstallation,
19
- createLockfileData,
20
27
  } = require('../lib/lockfile.js');
21
28
  const {
22
29
  planFileWrite,
23
- executeFileWrite,
24
30
  planFileDelete,
25
- executeFileDelete,
31
+ cleanEmptyParentDirectories,
26
32
  } = require('../lib/safe-writer.js');
27
33
 
28
34
  const pkg = require('../../package.json');
@@ -214,22 +220,78 @@ function runUpdate(projectDir = process.cwd(), options = {}) {
214
220
 
215
221
  // Execute plans
216
222
  let executedCount = 0;
217
- for (const item of plans) {
218
- if (item.action === 'CREATE' || item.action === 'UPDATE' || item.action === 'CONFLICT') {
219
- executeFileWrite(item, lockData, { dryRun: false });
220
- if (item.action !== 'SKIP') executedCount++;
221
- } else if (item.action === 'DELETE') {
222
- executeFileDelete(item, lockData, { dryRun: false });
223
- executedCount++;
223
+
224
+ const lock = new ProjectMutationLock(projectDir);
225
+ const lockToken = lock.acquire({ command: 'update' });
226
+
227
+ try {
228
+ const tx = new JournaledTransaction(projectDir);
229
+
230
+ for (const item of plans) {
231
+ if (item.action === 'CREATE' || item.action === 'UPDATE' || item.action === 'CONFLICT') {
232
+ const targetRel = item.action === 'CONFLICT' ? (item.conflictPath || `${item.relPath}.contextos.new`) : item.relPath;
233
+ tx.stageWrite(targetRel, item.newContent);
234
+ if (item.action !== 'SKIP') executedCount++;
235
+ } else if (item.action === 'DELETE') {
236
+ tx.stageDelete(item.relPath);
237
+ executedCount++;
238
+ }
239
+ }
240
+
241
+ const txResult = tx.commit();
242
+
243
+ // Clean up empty directories left behind by deletions
244
+ for (const item of plans) {
245
+ if (item.action === 'DELETE') {
246
+ cleanEmptyParentDirectories(path.join(projectDir, item.relPath));
247
+ }
224
248
  }
225
- }
226
249
 
227
- // Update lockfile metadata
228
- lockData.version = options.packageVersion || pkg.version;
229
- lockData.updatedAt = new Date().toISOString();
230
- saveLockfile(projectDir, lockData);
250
+ // Update lockfile metadata via V2 Manager
251
+ const lockfileManager = new LockfileV2Manager(projectDir);
252
+ let lockfileData = lockfileManager.read();
253
+
254
+ if (!lockfileData) {
255
+ lockfileData = lockfileManager.createEmpty({ packageVersion: options.packageVersion || pkg.version });
256
+ }
257
+
258
+ for (const item of plans) {
259
+ if (item.action === 'CREATE' || item.action === 'UPDATE') {
260
+ lockfileManager.recordManagedFile(lockfileData, item.relPath, {
261
+ exactSha256: computeExactHash(item.newContent),
262
+ semanticTextSha256: computeSemanticHash(item.newContent),
263
+ kind: 'distribution-skill',
264
+ generator: 'update',
265
+ lastTransaction: txResult.txId,
266
+ });
267
+ } else if (item.action === 'DELETE') {
268
+ if (lockfileData.managedFiles && lockfileData.managedFiles[item.relPath]) {
269
+ delete lockfileData.managedFiles[item.relPath];
270
+ }
271
+ }
272
+ }
273
+
274
+ lockfileData.package.version = options.packageVersion || pkg.version;
275
+ // We update the timestamp equivalent in v2
276
+ lockfileManager.write(lockfileData);
277
+
278
+ if (lockData) {
279
+ for (const item of plans) {
280
+ if (item.action === 'CREATE' || item.action === 'UPDATE') {
281
+ recordManagedFile(lockData, item.relPath, item.newContent);
282
+ } else if (item.action === 'DELETE') {
283
+ if (lockData.managedFiles) delete lockData.managedFiles[item.relPath];
284
+ }
285
+ }
286
+ lockData.version = options.packageVersion || pkg.version;
287
+ saveLockfile(projectDir, lockData);
288
+ }
289
+
290
+ } finally {
291
+ lock.release(lockToken);
292
+ }
231
293
 
232
- console.log(`\n[OK] ContextOS successfully updated to v${lockData.version}!`);
294
+ console.log(`\n[OK] ContextOS successfully updated!`);
233
295
  if (summary.conflict > 0) {
234
296
  console.warn(`[WARN] ${summary.conflict} customized file(s) had upstream changes.`);
235
297
  console.warn(' Inspect the .contextos.new file(s) to merge upstream updates.');
@@ -247,7 +309,8 @@ function runUpdate(projectDir = process.cwd(), options = {}) {
247
309
  stdio: 'inherit',
248
310
  });
249
311
  } catch (err) {
250
- console.warn(`[WARN] Post-update compilation failed: ${err.message}`);
312
+ console.error(`[ERROR] Post-update compilation failed: ${err.message}`);
313
+ process.exit(1);
251
314
  }
252
315
  }
253
316
  }