contextos-agents 1.6.1 → 2.0.0-beta.2

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 (323) hide show
  1. package/.agents/AGENTS.md +6 -1
  2. package/.agents/adapters/aider/export.js +117 -97
  3. package/.agents/adapters/claude/export.js +68 -26
  4. package/.agents/adapters/copilot/export.js +90 -51
  5. package/.agents/adapters/cursor/export.js +83 -68
  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 +109 -62
  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/references/context-rules.md +59 -0
  18. package/.agents/core/skills/context-manager/skill.yaml +10 -5
  19. package/.agents/core/skills/context-os/SKILL.md +3 -6
  20. package/.agents/core/skills/context-os/skill.yaml +14 -8
  21. package/.agents/core/skills/engineering-workflow/SKILL.md +1 -1
  22. package/.agents/core/skills/engineering-workflow/skill.yaml +7 -7
  23. package/.agents/core/skills/gemini-precision/SKILL.md +4 -0
  24. package/.agents/core/skills/gemini-precision/skill.yaml +5 -6
  25. package/.agents/core/skills/gstack-roles/SKILL.md +3 -1
  26. package/.agents/core/skills/gstack-roles/skill.yaml +9 -6
  27. package/.agents/core/skills/ponytail-mindset/skill.yaml +7 -7
  28. package/.agents/core/skills/security/skill.yaml +21 -2
  29. package/.agents/ctx.js +587 -111
  30. package/.agents/customization-dx.js +282 -0
  31. package/.agents/doctor.js +877 -33
  32. package/.agents/filesystem/index.js +71 -0
  33. package/.agents/filesystem/journaled-transaction.js +451 -0
  34. package/.agents/filesystem/lockfile-v2.js +275 -0
  35. package/.agents/filesystem/platform-hardening.js +222 -0
  36. package/.agents/filesystem/project-lock.js +218 -0
  37. package/.agents/filesystem/safe-path.js +256 -0
  38. package/.agents/generated/claude/skills/context-os/SKILL.md +1 -1
  39. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +1 -1
  40. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +4 -0
  41. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +3 -1
  42. package/.agents/generated/gemini/skills/context-os/SKILL.md +2 -2
  43. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +1 -1
  44. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +4 -0
  45. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +3 -1
  46. package/.agents/plugins/contextos/hooks.json +25 -0
  47. package/.agents/plugins/contextos/plugin.json +19 -0
  48. package/.agents/plugins.js +432 -73
  49. package/.agents/profiles.js +507 -46
  50. package/.agents/resolver.js +50 -414
  51. package/.agents/schemas/attestation.review.v1.json +111 -0
  52. package/.agents/schemas/attestation.verification.v1.json +85 -0
  53. package/.agents/schemas/lockfile.v2.schema.json +134 -0
  54. package/.agents/schemas/profile.v2.schema.json +114 -0
  55. package/.agents/schemas/runtime.thread.v1.json +192 -0
  56. package/.agents/schemas/skill.manifest.v2.json +177 -0
  57. package/.agents/schemas/verification.spec.v1.json +39 -0
  58. package/.agents/schemas/workspace.graph.schema.json +106 -0
  59. package/.agents/stats.js +22 -9
  60. package/.agents/transaction-core/event-store.js +288 -0
  61. package/.agents/transaction-core/idempotency.js +129 -0
  62. package/.agents/transaction-core/ipc-lock.js +311 -0
  63. package/.agents/transaction-core/plugin-supply-chain-bundle.js +436 -0
  64. package/.agents/validate.js +143 -14
  65. package/.agents/watch.js +354 -102
  66. package/.agents/workspace/workspace-graph.js +778 -0
  67. package/README.md +59 -387
  68. package/benchmarks/v2/analysis/statistics.js +140 -0
  69. package/benchmarks/v2/analysis/stats.js +69 -0
  70. package/benchmarks/v2/arms/arm-definitions.js +79 -0
  71. package/benchmarks/v2/dataset.schema.json +34 -0
  72. package/benchmarks/v2/evaluators/index.js +25 -0
  73. package/benchmarks/v2/evaluators/verified-success.js +116 -0
  74. package/benchmarks/v2/harness/runner.js +88 -0
  75. package/benchmarks/v2/pilot-tasks.json +392 -0
  76. package/bin/commands/recover.js +88 -0
  77. package/bin/commands/uninstall.js +207 -0
  78. package/bin/commands/update.js +325 -0
  79. package/bin/commands.js +342 -0
  80. package/bin/index.js +326 -149
  81. package/bin/lib/detector.js +106 -0
  82. package/bin/lib/lockfile.js +253 -0
  83. package/bin/lib/safe-writer.js +290 -0
  84. package/package.json +85 -73
  85. package/registry.json +15 -7
  86. package/registry.schema.json +3 -1
  87. package/registry.v2.schema.json +86 -0
  88. package/.agents/core/profiles/backend.yaml +0 -47
  89. package/.agents/core/profiles/enterprise.yaml +0 -46
  90. package/.agents/core/profiles/frontend.yaml +0 -46
  91. package/.agents/core/profiles/hackathon.yaml +0 -45
  92. package/.agents/core/profiles/mvp.yaml +0 -44
  93. package/.agents/core/profiles/startup.yaml +0 -48
  94. package/.agents/core/skills/adapters/EXAMPLES.md +0 -19
  95. package/.agents/core/skills/adapters/SKILL.md +0 -105
  96. package/.agents/core/skills/adapters/TROUBLESHOOTING.md +0 -7
  97. package/.agents/core/skills/adapters/VALIDATION.json +0 -12
  98. package/.agents/core/skills/adapters/skill.yaml +0 -10
  99. package/.agents/core/skills/architecture-diagrams/SKILL.md +0 -108
  100. package/.agents/core/skills/architecture-diagrams/VALIDATION.json +0 -12
  101. package/.agents/core/skills/architecture-diagrams/skill.yaml +0 -8
  102. package/.agents/core/skills/brutalist-design/SKILL.md +0 -150
  103. package/.agents/core/skills/brutalist-design/VALIDATION.json +0 -12
  104. package/.agents/core/skills/brutalist-design/skill.yaml +0 -8
  105. package/.agents/core/skills/database/EXAMPLES.md +0 -74
  106. package/.agents/core/skills/database/SKILL.md +0 -101
  107. package/.agents/core/skills/database/TROUBLESHOOTING.md +0 -18
  108. package/.agents/core/skills/database/VALIDATION.json +0 -11
  109. package/.agents/core/skills/database/skill.yaml +0 -25
  110. package/.agents/core/skills/ddd/EXAMPLES.md +0 -42
  111. package/.agents/core/skills/ddd/SKILL.md +0 -247
  112. package/.agents/core/skills/ddd/TROUBLESHOOTING.md +0 -19
  113. package/.agents/core/skills/ddd/VALIDATION.json +0 -12
  114. package/.agents/core/skills/ddd/ddd.md +0 -178
  115. package/.agents/core/skills/ddd/skill.yaml +0 -10
  116. package/.agents/core/skills/decisions/EXAMPLES.md +0 -35
  117. package/.agents/core/skills/decisions/SKILL.md +0 -90
  118. package/.agents/core/skills/decisions/TROUBLESHOOTING.md +0 -13
  119. package/.agents/core/skills/decisions/VALIDATION.json +0 -12
  120. package/.agents/core/skills/decisions/skill.yaml +0 -10
  121. package/.agents/core/skills/docker/EXAMPLES.md +0 -56
  122. package/.agents/core/skills/docker/SKILL.md +0 -63
  123. package/.agents/core/skills/docker/TROUBLESHOOTING.md +0 -18
  124. package/.agents/core/skills/docker/VALIDATION.json +0 -11
  125. package/.agents/core/skills/docker/skill.yaml +0 -23
  126. package/.agents/core/skills/fastapi/EXAMPLES.md +0 -36
  127. package/.agents/core/skills/fastapi/SKILL.md +0 -148
  128. package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +0 -19
  129. package/.agents/core/skills/fastapi/VALIDATION.json +0 -12
  130. package/.agents/core/skills/fastapi/fastapi.md +0 -112
  131. package/.agents/core/skills/fastapi/skill.yaml +0 -10
  132. package/.agents/core/skills/generators/EXAMPLES.md +0 -19
  133. package/.agents/core/skills/generators/SKILL.md +0 -112
  134. package/.agents/core/skills/generators/TROUBLESHOOTING.md +0 -7
  135. package/.agents/core/skills/generators/VALIDATION.json +0 -12
  136. package/.agents/core/skills/generators/skill.yaml +0 -10
  137. package/.agents/core/skills/generators/templates/API.md +0 -77
  138. package/.agents/core/skills/generators/templates/ARCHITECTURE.md +0 -70
  139. package/.agents/core/skills/generators/templates/DATABASE.md +0 -42
  140. package/.agents/core/skills/generators/templates/DECISION.md +0 -46
  141. package/.agents/core/skills/generators/templates/PRD.md +0 -67
  142. package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +0 -56
  143. package/.agents/core/skills/generators/templates/ROADMAP.md +0 -51
  144. package/.agents/core/skills/generators/templates/TASKS.md +0 -43
  145. package/.agents/core/skills/generators/templates/UI.md +0 -73
  146. package/.agents/core/skills/graphify/EXAMPLES.md +0 -73
  147. package/.agents/core/skills/graphify/SKILL.md +0 -130
  148. package/.agents/core/skills/graphify/VALIDATION.json +0 -12
  149. package/.agents/core/skills/graphify/skill.yaml +0 -13
  150. package/.agents/core/skills/impeccable-design/EXAMPLES.md +0 -26
  151. package/.agents/core/skills/impeccable-design/SKILL.md +0 -201
  152. package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +0 -19
  153. package/.agents/core/skills/impeccable-design/VALIDATION.json +0 -12
  154. package/.agents/core/skills/impeccable-design/skill.yaml +0 -14
  155. package/.agents/core/skills/interview-me/SKILL.md +0 -97
  156. package/.agents/core/skills/interview-me/VALIDATION.json +0 -12
  157. package/.agents/core/skills/interview-me/skill.yaml +0 -8
  158. package/.agents/core/skills/microservices/EXAMPLES.md +0 -38
  159. package/.agents/core/skills/microservices/SKILL.md +0 -164
  160. package/.agents/core/skills/microservices/TROUBLESHOOTING.md +0 -19
  161. package/.agents/core/skills/microservices/VALIDATION.json +0 -12
  162. package/.agents/core/skills/microservices/microservices.md +0 -119
  163. package/.agents/core/skills/microservices/skill.yaml +0 -10
  164. package/.agents/core/skills/minimalist-design/SKILL.md +0 -113
  165. package/.agents/core/skills/minimalist-design/VALIDATION.json +0 -12
  166. package/.agents/core/skills/minimalist-design/skill.yaml +0 -8
  167. package/.agents/core/skills/nestjs/EXAMPLES.md +0 -40
  168. package/.agents/core/skills/nestjs/SKILL.md +0 -139
  169. package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +0 -19
  170. package/.agents/core/skills/nestjs/VALIDATION.json +0 -12
  171. package/.agents/core/skills/nestjs/nestjs.md +0 -103
  172. package/.agents/core/skills/nestjs/skill.yaml +0 -10
  173. package/.agents/core/skills/nextjs/EXAMPLES.md +0 -40
  174. package/.agents/core/skills/nextjs/SKILL.md +0 -163
  175. package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +0 -19
  176. package/.agents/core/skills/nextjs/VALIDATION.json +0 -12
  177. package/.agents/core/skills/nextjs/nextjs.md +0 -67
  178. package/.agents/core/skills/nextjs/skill.yaml +0 -10
  179. package/.agents/core/skills/node/EXAMPLES.md +0 -80
  180. package/.agents/core/skills/node/SKILL.md +0 -128
  181. package/.agents/core/skills/node/TROUBLESHOOTING.md +0 -19
  182. package/.agents/core/skills/node/VALIDATION.json +0 -12
  183. package/.agents/core/skills/node/node.md +0 -87
  184. package/.agents/core/skills/node/skill.yaml +0 -10
  185. package/.agents/core/skills/performance/EXAMPLES.md +0 -30
  186. package/.agents/core/skills/performance/SKILL.md +0 -75
  187. package/.agents/core/skills/performance/TROUBLESHOOTING.md +0 -19
  188. package/.agents/core/skills/performance/VALIDATION.json +0 -12
  189. package/.agents/core/skills/performance/performance.md +0 -52
  190. package/.agents/core/skills/performance/skill.yaml +0 -10
  191. package/.agents/core/skills/react/EXAMPLES.md +0 -79
  192. package/.agents/core/skills/react/SKILL.md +0 -132
  193. package/.agents/core/skills/react/TROUBLESHOOTING.md +0 -19
  194. package/.agents/core/skills/react/VALIDATION.json +0 -12
  195. package/.agents/core/skills/react/react.md +0 -93
  196. package/.agents/core/skills/react/skill.yaml +0 -10
  197. package/.agents/core/skills/react-best-practices/SKILL.md +0 -155
  198. package/.agents/core/skills/react-best-practices/VALIDATION.json +0 -12
  199. package/.agents/core/skills/react-best-practices/skill.yaml +0 -10
  200. package/.agents/core/skills/redesign-audit/SKILL.md +0 -117
  201. package/.agents/core/skills/redesign-audit/VALIDATION.json +0 -12
  202. package/.agents/core/skills/redesign-audit/skill.yaml +0 -8
  203. package/.agents/core/skills/soft-design/SKILL.md +0 -108
  204. package/.agents/core/skills/soft-design/VALIDATION.json +0 -12
  205. package/.agents/core/skills/soft-design/skill.yaml +0 -8
  206. package/.agents/core/skills/state-management/EXAMPLES.md +0 -56
  207. package/.agents/core/skills/state-management/SKILL.md +0 -48
  208. package/.agents/core/skills/state-management/TROUBLESHOOTING.md +0 -18
  209. package/.agents/core/skills/state-management/VALIDATION.json +0 -11
  210. package/.agents/core/skills/state-management/skill.yaml +0 -22
  211. package/.agents/core/skills/subagent-orchestrator/SKILL.md +0 -100
  212. package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +0 -12
  213. package/.agents/core/skills/subagent-orchestrator/skill.yaml +0 -8
  214. package/.agents/core/skills/system-design/EXAMPLES.md +0 -75
  215. package/.agents/core/skills/system-design/SKILL.md +0 -419
  216. package/.agents/core/skills/system-design/TROUBLESHOOTING.md +0 -19
  217. package/.agents/core/skills/system-design/VALIDATION.json +0 -12
  218. package/.agents/core/skills/system-design/skill.yaml +0 -13
  219. package/.agents/core/skills/system-design/system-design.md +0 -112
  220. package/.agents/core/skills/testing/EXAMPLES.md +0 -71
  221. package/.agents/core/skills/testing/SKILL.md +0 -70
  222. package/.agents/core/skills/testing/TROUBLESHOOTING.md +0 -18
  223. package/.agents/core/skills/testing/VALIDATION.json +0 -11
  224. package/.agents/core/skills/testing/skill.yaml +0 -26
  225. package/.agents/core/skills/typescript/EXAMPLES.md +0 -64
  226. package/.agents/core/skills/typescript/SKILL.md +0 -112
  227. package/.agents/core/skills/typescript/TROUBLESHOOTING.md +0 -19
  228. package/.agents/core/skills/typescript/VALIDATION.json +0 -12
  229. package/.agents/core/skills/typescript/skill.yaml +0 -10
  230. package/.agents/core/skills/typescript/typescript.md +0 -71
  231. package/.agents/core/skills/ui-design/EXAMPLES.md +0 -21
  232. package/.agents/core/skills/ui-design/SKILL.md +0 -124
  233. package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +0 -19
  234. package/.agents/core/skills/ui-design/VALIDATION.json +0 -12
  235. package/.agents/core/skills/ui-design/skill.yaml +0 -10
  236. package/.agents/core/skills/ui-design/ui.md +0 -88
  237. package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +0 -62
  238. package/.agents/core/skills/ui-ux-pro/SKILL.md +0 -375
  239. package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +0 -19
  240. package/.agents/core/skills/ui-ux-pro/VALIDATION.json +0 -12
  241. package/.agents/core/skills/ui-ux-pro/skill.yaml +0 -13
  242. package/.agents/core/skills/ux-design/EXAMPLES.md +0 -36
  243. package/.agents/core/skills/ux-design/SKILL.md +0 -116
  244. package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +0 -19
  245. package/.agents/core/skills/ux-design/VALIDATION.json +0 -12
  246. package/.agents/core/skills/ux-design/skill.yaml +0 -10
  247. package/.agents/core/skills/ux-design/ux.md +0 -80
  248. package/.agents/core/skills/vercel-optimize/SKILL.md +0 -83
  249. package/.agents/core/skills/vercel-optimize/VALIDATION.json +0 -12
  250. package/.agents/core/skills/vercel-optimize/skill.yaml +0 -10
  251. package/.agents/core/skills/web-accessibility/EXAMPLES.md +0 -39
  252. package/.agents/core/skills/web-accessibility/SKILL.md +0 -170
  253. package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +0 -19
  254. package/.agents/core/skills/web-accessibility/VALIDATION.json +0 -12
  255. package/.agents/core/skills/web-accessibility/accessibility.md +0 -63
  256. package/.agents/core/skills/web-accessibility/skill.yaml +0 -10
  257. package/.agents/generated/claude/skills/adapters/SKILL.md +0 -126
  258. package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +0 -101
  259. package/.agents/generated/claude/skills/brutalist-design/SKILL.md +0 -145
  260. package/.agents/generated/claude/skills/database/SKILL.md +0 -191
  261. package/.agents/generated/claude/skills/ddd/SKILL.md +0 -305
  262. package/.agents/generated/claude/skills/decisions/SKILL.md +0 -134
  263. package/.agents/generated/claude/skills/docker/SKILL.md +0 -135
  264. package/.agents/generated/claude/skills/fastapi/SKILL.md +0 -200
  265. package/.agents/generated/claude/skills/generators/SKILL.md +0 -133
  266. package/.agents/generated/claude/skills/graphify/SKILL.md +0 -198
  267. package/.agents/generated/claude/skills/impeccable-design/SKILL.md +0 -241
  268. package/.agents/generated/claude/skills/interview-me/SKILL.md +0 -90
  269. package/.agents/generated/claude/skills/microservices/SKILL.md +0 -218
  270. package/.agents/generated/claude/skills/minimalist-design/SKILL.md +0 -108
  271. package/.agents/generated/claude/skills/nestjs/SKILL.md +0 -195
  272. package/.agents/generated/claude/skills/nextjs/SKILL.md +0 -219
  273. package/.agents/generated/claude/skills/node/SKILL.md +0 -224
  274. package/.agents/generated/claude/skills/performance/SKILL.md +0 -121
  275. package/.agents/generated/claude/skills/react/SKILL.md +0 -227
  276. package/.agents/generated/claude/skills/react-best-practices/SKILL.md +0 -146
  277. package/.agents/generated/claude/skills/redesign-audit/SKILL.md +0 -112
  278. package/.agents/generated/claude/skills/soft-design/SKILL.md +0 -103
  279. package/.agents/generated/claude/skills/state-management/SKILL.md +0 -120
  280. package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +0 -93
  281. package/.agents/generated/claude/skills/system-design/SKILL.md +0 -507
  282. package/.agents/generated/claude/skills/testing/SKILL.md +0 -157
  283. package/.agents/generated/claude/skills/typescript/SKILL.md +0 -192
  284. package/.agents/generated/claude/skills/ui-design/SKILL.md +0 -161
  285. package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +0 -451
  286. package/.agents/generated/claude/skills/ux-design/SKILL.md +0 -168
  287. package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +0 -76
  288. package/.agents/generated/claude/skills/web-accessibility/SKILL.md +0 -225
  289. package/.agents/generated/gemini/skills/adapters/SKILL.md +0 -135
  290. package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +0 -107
  291. package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +0 -151
  292. package/.agents/generated/gemini/skills/database/SKILL.md +0 -200
  293. package/.agents/generated/gemini/skills/ddd/SKILL.md +0 -314
  294. package/.agents/generated/gemini/skills/decisions/SKILL.md +0 -143
  295. package/.agents/generated/gemini/skills/docker/SKILL.md +0 -144
  296. package/.agents/generated/gemini/skills/fastapi/SKILL.md +0 -209
  297. package/.agents/generated/gemini/skills/generators/SKILL.md +0 -142
  298. package/.agents/generated/gemini/skills/graphify/SKILL.md +0 -205
  299. package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +0 -250
  300. package/.agents/generated/gemini/skills/interview-me/SKILL.md +0 -96
  301. package/.agents/generated/gemini/skills/microservices/SKILL.md +0 -227
  302. package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +0 -114
  303. package/.agents/generated/gemini/skills/nestjs/SKILL.md +0 -204
  304. package/.agents/generated/gemini/skills/nextjs/SKILL.md +0 -298
  305. package/.agents/generated/gemini/skills/node/SKILL.md +0 -323
  306. package/.agents/generated/gemini/skills/performance/SKILL.md +0 -185
  307. package/.agents/generated/gemini/skills/react/SKILL.md +0 -332
  308. package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +0 -152
  309. package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +0 -118
  310. package/.agents/generated/gemini/skills/soft-design/SKILL.md +0 -109
  311. package/.agents/generated/gemini/skills/state-management/SKILL.md +0 -129
  312. package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +0 -99
  313. package/.agents/generated/gemini/skills/system-design/SKILL.md +0 -631
  314. package/.agents/generated/gemini/skills/testing/SKILL.md +0 -166
  315. package/.agents/generated/gemini/skills/typescript/SKILL.md +0 -275
  316. package/.agents/generated/gemini/skills/ui-design/SKILL.md +0 -170
  317. package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +0 -460
  318. package/.agents/generated/gemini/skills/ux-design/SKILL.md +0 -177
  319. package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +0 -82
  320. package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +0 -300
  321. package/.agents/mcp/runtime.py +0 -470
  322. package/.agents/mcp/server.mjs +0 -189271
  323. package/benchmarks/gemini-issues.js +0 -533
@@ -1,20 +1,23 @@
1
+ /**
2
+ * .agents/adapters/cursor/export.js
3
+ * ContextOS Cursor Pure Adapter (.cursorrules and .cursor/rules/*.mdc)
4
+ */
5
+
1
6
  const fs = require('fs');
2
7
  const path = require('path');
3
8
  const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts, createProvenanceHeader } = require('../pure-compiler.js');
4
10
 
5
- // Output paths
6
- const OUTPUT_FILE = path.join(process.cwd(), '.cursorrules');
7
- const CURSOR_RULES_DIR = path.join(process.cwd(), '.cursor', 'rules');
11
+ const GENERATOR_ID = 'cursor@2';
8
12
 
9
- /**
10
- * Cursor adapter — export.js
11
- *
12
- * Generates:
13
- * 1. Modern modular Cursor rules in `.cursor/rules/<skill>.mdc` with glob filters
14
- * 2. Flat `.cursorrules` at project root for backwards compatibility
15
- *
16
- * Format spec: https://docs.cursor.com/context/rules-for-ai
17
- */
13
+ function describe() {
14
+ return {
15
+ name: 'cursor',
16
+ version: '2.0.0',
17
+ description: 'Compiles modular rules for Cursor (.cursor/rules/*.mdc and legacy .cursorrules)',
18
+ targetPattern: '.cursor/rules/*.mdc',
19
+ };
20
+ }
18
21
 
19
22
  function getSkillGlobsAndFlags(skillName) {
20
23
  const ALWAYS_APPLY_SKILLS = ['engineering-workflow', 'gstack-roles', 'ponytail-mindset'];
@@ -22,7 +25,6 @@ function getSkillGlobsAndFlags(skillName) {
22
25
  return { globs: '', alwaysApply: true };
23
26
  }
24
27
 
25
- // Precise surgical globs mapping to prevent context flooding
26
28
  const GLOB_MAP = {
27
29
  'react': '**/*.{tsx,jsx}',
28
30
  'react-best-practices': '**/*.{tsx,jsx}',
@@ -58,9 +60,9 @@ function getSkillGlobsAndFlags(skillName) {
58
60
  }
59
61
 
60
62
  function buildSkillSection(skillDir) {
61
- const skillName = path.basename(skillDir);
62
- const skillMdPath = path.join(skillDir, 'SKILL.md');
63
- const yamlPath = path.join(skillDir, 'skill.yaml');
63
+ const skillName = path.basename(skillDir);
64
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
65
+ const yamlPath = path.join(skillDir, 'skill.yaml');
64
66
 
65
67
  let title = skillName;
66
68
  let description = '';
@@ -70,9 +72,7 @@ function buildSkillSection(skillDir) {
70
72
  description = extractYamlField(yaml, 'description') || '';
71
73
  }
72
74
 
73
- if (!fs.existsSync(skillMdPath)) {
74
- return null;
75
- }
75
+ if (!fs.existsSync(skillMdPath)) return null;
76
76
 
77
77
  const raw = fs.readFileSync(skillMdPath, 'utf8');
78
78
  const body = stripFrontmatter(raw);
@@ -130,78 +130,93 @@ ${body}
130
130
  return { skillName, mdcContent };
131
131
  }
132
132
 
133
- function run() {
134
- console.log('Starting Cursor adapter export...');
135
-
136
- const sections = [];
137
-
138
- // ── Header ──────────────────────────────────────────────────────────────────
139
- sections.push(
140
- `# ContextOS — AI Rules for Cursor\n` +
141
- `# Auto-generated by: node .agents/ctx.js export cursor\n` +
142
- `# Source: .agents/core/skills/ · Do not edit manually.\n\n` +
143
- `> **Core law: Do not read everything. Read only what the current task requires.**\n\n` +
144
- `Detailed rules are modularized in \`.cursor/rules/*.mdc\` with file-glob activation.\n` +
145
- `Core orchestration is handled by \`.cursor/rules/00-project-rules.mdc\`.\n`
146
- );
133
+ function render(context) {
134
+ const projectRoot = context?.projectRoot || '.';
135
+ const agentsMdPath = fs.existsSync(path.join(projectRoot, '.agents', 'AGENTS.md'))
136
+ ? path.join(projectRoot, '.agents', 'AGENTS.md')
137
+ : AGENTS_MD_PATH;
147
138
 
148
- // Prepare .cursor/rules directory
149
- fs.mkdirSync(CURSOR_RULES_DIR, { recursive: true });
139
+ const artifacts = [];
150
140
 
151
- let count = 0;
152
- let mdcCount = 0;
141
+ const prov = createProvenanceHeader({
142
+ generator: GENERATOR_ID,
143
+ sourceGraphHash: context?.sourceGraphHash,
144
+ profileId: context?.profileId,
145
+ profileHash: context?.profileHash,
146
+ });
153
147
 
154
- // Write 00-project-rules.mdc
155
- if (fs.existsSync(AGENTS_MD_PATH)) {
156
- const agentsMd = fs.readFileSync(AGENTS_MD_PATH, 'utf8');
148
+ // 1. 00-project-rules.mdc
149
+ if (fs.existsSync(agentsMdPath)) {
150
+ const agentsMd = fs.readFileSync(agentsMdPath, 'utf8');
157
151
  const projectMdc = `---
158
152
  description: "ContextOS core project rules and role orchestration"
159
153
  globs: ""
160
154
  alwaysApply: true
161
155
  ---
162
156
 
157
+ ${prov}
163
158
  # ContextOS — Project Operating System Rules
164
159
 
165
160
  ${agentsMd}
166
161
  `;
167
- fs.writeFileSync(path.join(CURSOR_RULES_DIR, '00-project-rules.mdc'), projectMdc);
168
- mdcCount++;
162
+ artifacts.push({
163
+ path: '.cursor/rules/00-project-rules.mdc',
164
+ content: projectMdc.replace(/\r\n/g, '\n'),
165
+ mediaType: 'text/markdown',
166
+ kind: 'generated-adapter',
167
+ generator: GENERATOR_ID,
168
+ sourceSkillIds: ['project-rules'],
169
+ inputsHash: context?.sourceGraphHash || 'none',
170
+ });
169
171
  }
170
172
 
171
- // ── Skills Index ─────────────────────────────────────────────────────────────
172
- sections.push('\n---\n\n# Skills Index (Loaded On-Demand)\n\n' +
173
- 'The following specialist skills are configured as `.cursor/rules/<skill>.mdc`:\n');
174
- const skills = collectSkillDirectories();
175
- const activeMdcFiles = new Set(['00-project-rules.mdc']);
176
-
173
+ const skills = collectSkillDirectories(context?.profile);
177
174
  for (const skill of skills) {
178
- const section = buildSkillSection(skill);
179
- if (section) {
180
- sections.push(section);
181
- count++;
182
- }
183
-
184
175
  const mdc = generateCursorMdc(skill);
185
176
  if (mdc) {
186
- const mdcFileName = `${mdc.skillName}.mdc`;
187
- activeMdcFiles.add(mdcFileName);
188
- fs.writeFileSync(path.join(CURSOR_RULES_DIR, mdcFileName), mdc.mdcContent);
189
- mdcCount++;
177
+ const fullMdc = mdc.mdcContent.replace(/\r\n/g, '\n');
178
+ artifacts.push({
179
+ path: `.cursor/rules/${mdc.skillName}.mdc`,
180
+ content: fullMdc,
181
+ mediaType: 'text/markdown',
182
+ kind: 'generated-adapter',
183
+ generator: GENERATOR_ID,
184
+ sourceSkillIds: [mdc.skillName],
185
+ inputsHash: context?.sourceGraphHash || 'none',
186
+ });
190
187
  }
191
188
  }
192
189
 
193
- // Clean up stale .mdc rules from uninstalled skills/plugins
194
- if (fs.existsSync(CURSOR_RULES_DIR)) {
195
- for (const file of fs.readdirSync(CURSOR_RULES_DIR)) {
196
- if (file.endsWith('.mdc') && !activeMdcFiles.has(file)) {
197
- fs.unlinkSync(path.join(CURSOR_RULES_DIR, file));
198
- }
190
+ return artifacts;
191
+ }
192
+
193
+ function validate(artifacts) {
194
+ const diagnostics = [];
195
+ for (const art of artifacts) {
196
+ if (!art.content || art.content.length === 0) {
197
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
199
198
  }
200
199
  }
200
+ return diagnostics;
201
+ }
201
202
 
202
- fs.writeFileSync(OUTPUT_FILE, sections.join('\n'));
203
- console.log(`Generated .cursorrules (${count} skills) → ${OUTPUT_FILE}`);
204
- console.log(`Generated .cursor/rules/*.mdc (${mdcCount} rules) → ${CURSOR_RULES_DIR}`);
203
+ function run(options = {}) {
204
+ const { loadCompilerContext } = require('../pure-compiler.js');
205
+ const projectRoot = options.projectRoot || '.';
206
+ const context = loadCompilerContext(projectRoot, options);
207
+ const artifacts = render(context);
208
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export cursor', context });
209
+ console.log(`✓ Cursor export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
210
+ return result;
205
211
  }
206
212
 
207
- module.exports = { run };
213
+ const adapter = {
214
+ describe,
215
+ render,
216
+ validate,
217
+ run,
218
+ };
219
+
220
+ registerAdapter('cursor', adapter);
221
+
222
+ module.exports = adapter;
@@ -0,0 +1,196 @@
1
+ /**
2
+ * .agents/adapters/drift-detector.js
3
+ * ContextOS Adapter Output Drift & Out-of-Sync Detector
4
+ *
5
+ * Implements Section 12.4 drift states:
6
+ * - STALE_INPUT: Source graph or profile modified since last compile
7
+ * - MISSING_OUTPUT: Planned or recorded file absent from disk
8
+ * - MODIFIED_MANAGED_OUTPUT: Disk content differs from lockfile (user edits)
9
+ * - ORPHAN_MANAGED_OUTPUT: Lockfile records file no longer rendered
10
+ * - ADAPTER_VERSION_MISMATCH: Generator version differs
11
+ * - PROFILE_MISMATCH: Active profile differs from lockfile profile
12
+ */
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+ const { LockfileV2Manager, computeExactHash, computeSemanticHash } = require('../filesystem/index.js');
17
+ const { renderAdapters } = require('./pure-compiler.js');
18
+
19
+ const DRIFT_STATES = {
20
+ STALE_INPUT: 'STALE_INPUT',
21
+ MISSING_OUTPUT: 'MISSING_OUTPUT',
22
+ MODIFIED_MANAGED_OUTPUT: 'MODIFIED_MANAGED_OUTPUT',
23
+ ORPHAN_MANAGED_OUTPUT: 'ORPHAN_MANAGED_OUTPUT',
24
+ ADAPTER_VERSION_MISMATCH: 'ADAPTER_VERSION_MISMATCH',
25
+ PROFILE_MISMATCH: 'PROFILE_MISMATCH',
26
+ };
27
+
28
+ /**
29
+ * Computes a unified textual diff snippet between before and after strings.
30
+ */
31
+ function computeDiffSnippet(beforeStr, afterStr, maxLines = 15) {
32
+ const beforeLines = beforeStr.split(/\r?\n/);
33
+ const afterLines = afterStr.split(/\r?\n/);
34
+ const diffLines = [];
35
+
36
+ let lineCount = 0;
37
+ for (let i = 0; i < Math.max(beforeLines.length, afterLines.length); i++) {
38
+ const b = beforeLines[i];
39
+ const a = afterLines[i];
40
+ if (b !== a) {
41
+ if (b !== undefined) {
42
+ diffLines.push(`- ${b}`);
43
+ lineCount++;
44
+ }
45
+ if (a !== undefined) {
46
+ diffLines.push(`+ ${a}`);
47
+ lineCount++;
48
+ }
49
+ }
50
+ if (lineCount >= maxLines) {
51
+ diffLines.push('... (diff truncated)');
52
+ break;
53
+ }
54
+ }
55
+
56
+ return diffLines.join('\n');
57
+ }
58
+
59
+ /**
60
+ * Analyzes drift between current project state, Lockfile v2, and projected adapter render.
61
+ *
62
+ * @param {string} projectRoot
63
+ * @param {string[]|string} [adapters='all']
64
+ * @param {object} [options]
65
+ * @returns {object} Structured drift report
66
+ */
67
+ function detectDrift(projectRoot, adapters = 'all', options = {}) {
68
+ const absRoot = path.resolve(projectRoot);
69
+ const lockManager = new LockfileV2Manager(absRoot);
70
+ const lockfile = lockManager.read();
71
+
72
+ const { artifacts, collisions, context } = renderAdapters(absRoot, adapters, options);
73
+
74
+ const findings = {
75
+ [DRIFT_STATES.STALE_INPUT]: [],
76
+ [DRIFT_STATES.MISSING_OUTPUT]: [],
77
+ [DRIFT_STATES.MODIFIED_MANAGED_OUTPUT]: [],
78
+ [DRIFT_STATES.ORPHAN_MANAGED_OUTPUT]: [],
79
+ [DRIFT_STATES.ADAPTER_VERSION_MISMATCH]: [],
80
+ [DRIFT_STATES.PROFILE_MISMATCH]: [],
81
+ };
82
+
83
+ const diffs = [];
84
+
85
+ // 1. Check Profile Mismatch
86
+ if (lockfile && lockfile.profile) {
87
+ if (context.profileId && lockfile.profile.id !== context.profileId) {
88
+ findings[DRIFT_STATES.PROFILE_MISMATCH].push({
89
+ expected: context.profileId,
90
+ actual: lockfile.profile.id,
91
+ });
92
+ }
93
+ }
94
+
95
+ // 2. Check Stale Input (Source Graph Hash)
96
+ if (lockfile && lockfile.sourceGraphHash) {
97
+ if (context.sourceGraphHash && lockfile.sourceGraphHash !== context.sourceGraphHash) {
98
+ findings[DRIFT_STATES.STALE_INPUT].push({
99
+ expected: context.sourceGraphHash,
100
+ actual: lockfile.sourceGraphHash,
101
+ });
102
+ }
103
+ }
104
+
105
+ const projectedPaths = new Set(artifacts.map(a => a.path));
106
+
107
+ // 3. Inspect each projected artifact against disk and lockfile
108
+ for (const art of artifacts) {
109
+ const fullPath = path.resolve(absRoot, art.path);
110
+ const projectedContent = art.content.toString('utf8');
111
+ const projectedExactHash = computeExactHash(art.content);
112
+ const projectedSemanticHash = computeSemanticHash(art.content);
113
+
114
+ if (!fs.existsSync(fullPath)) {
115
+ findings[DRIFT_STATES.MISSING_OUTPUT].push({
116
+ path: art.path,
117
+ reason: 'Projected artifact does not exist on disk',
118
+ });
119
+ diffs.push({
120
+ path: art.path,
121
+ type: 'missing',
122
+ diff: `+ (new file, ${projectedContent.length} bytes)`,
123
+ });
124
+ } else {
125
+ const diskContent = fs.readFileSync(fullPath, 'utf8');
126
+ const diskSemanticHash = computeSemanticHash(diskContent);
127
+
128
+ // Check if disk matches projected render
129
+ if (diskSemanticHash !== projectedSemanticHash) {
130
+ const lockRecord = lockfile?.managedFiles?.[art.path];
131
+ if (lockRecord && lockRecord.semanticTextSha256 !== diskSemanticHash) {
132
+ findings[DRIFT_STATES.MODIFIED_MANAGED_OUTPUT].push({
133
+ path: art.path,
134
+ reason: 'Managed file was modified by user on disk',
135
+ diskHash: diskSemanticHash,
136
+ lockHash: lockRecord.semanticTextSha256,
137
+ });
138
+ } else {
139
+ findings[DRIFT_STATES.STALE_INPUT].push({
140
+ path: art.path,
141
+ reason: 'Generated artifact differs from source skills projection',
142
+ });
143
+ }
144
+
145
+ diffs.push({
146
+ path: art.path,
147
+ type: 'modified',
148
+ diff: computeDiffSnippet(diskContent, projectedContent),
149
+ });
150
+ }
151
+ }
152
+ }
153
+
154
+ // 4. Check for orphan files recorded in lockfile but no longer projected
155
+ if (lockfile && lockfile.managedFiles) {
156
+ for (const [recordedPath, meta] of Object.entries(lockfile.managedFiles)) {
157
+ if (!projectedPaths.has(recordedPath)) {
158
+ const fullRecorded = path.resolve(absRoot, recordedPath);
159
+ if (fs.existsSync(fullRecorded)) {
160
+ findings[DRIFT_STATES.ORPHAN_MANAGED_OUTPUT].push({
161
+ path: recordedPath,
162
+ reason: 'File recorded in lockfile is no longer generated by active skills/profile',
163
+ });
164
+ diffs.push({
165
+ path: recordedPath,
166
+ type: 'orphan',
167
+ diff: `- (orphan file on disk, ${meta.kind})`,
168
+ });
169
+ }
170
+ }
171
+ }
172
+ }
173
+
174
+ if (diffs.length === 0 && findings[DRIFT_STATES.ORPHAN_MANAGED_OUTPUT].length === 0) {
175
+ findings[DRIFT_STATES.STALE_INPUT] = [];
176
+ findings[DRIFT_STATES.PROFILE_MISMATCH] = [];
177
+ }
178
+
179
+ const totalFindings = Object.values(findings).reduce((acc, list) => acc + list.length, 0);
180
+ const hasDrift = totalFindings > 0 || collisions.length > 0;
181
+
182
+ return {
183
+ hasDrift,
184
+ totalFindings,
185
+ findings,
186
+ collisions,
187
+ diffs,
188
+ projectedCount: artifacts.length,
189
+ };
190
+ }
191
+
192
+ module.exports = {
193
+ detectDrift,
194
+ computeDiffSnippet,
195
+ DRIFT_STATES,
196
+ };
@@ -1,18 +1,31 @@
1
+ /**
2
+ * .agents/adapters/gemini/export.js
3
+ * ContextOS Gemini & Antigravity IDE Pure Adapter
4
+ */
5
+
1
6
  const fs = require('fs');
2
7
  const path = require('path');
3
- const { collectSkillDirectories, resetDirectory, readMeaningfulMarkdown, extractYamlField } = require('../shared.js');
4
-
5
- const GENERATED_SKILLS_PATH = path.join(__dirname, '..', '..', 'generated', 'gemini', 'skills');
8
+ const { collectSkillDirectories, readMeaningfulMarkdown, extractYamlField } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts } = require('../pure-compiler.js');
10
+
11
+ const GENERATOR_ID = 'gemini@2';
12
+
13
+ function describe() {
14
+ return {
15
+ name: 'gemini',
16
+ version: '2.0.0',
17
+ description: 'Compiles modular skills for Gemini 3.8 and Google Antigravity IDE',
18
+ targetPattern: '.agents/generated/gemini/skills/**/SKILL.md',
19
+ };
20
+ }
6
21
 
7
- function generateGeminiSkill(skillDir) {
22
+ function renderGeminiSkill(skillDir, context) {
8
23
  const skillName = path.basename(skillDir);
9
24
  const yamlPath = path.join(skillDir, 'skill.yaml');
10
25
  const existingSkillMdPath = path.join(skillDir, 'SKILL.md');
11
- const outputDir = path.join(GENERATED_SKILLS_PATH, skillName);
12
26
 
13
27
  if (!fs.existsSync(existingSkillMdPath) && !fs.existsSync(yamlPath)) {
14
- console.log(`Skipping ${skillName} (no skill.yaml or SKILL.md)`);
15
- return;
28
+ return [];
16
29
  }
17
30
 
18
31
  let name = skillName;
@@ -30,11 +43,9 @@ function generateGeminiSkill(skillDir) {
30
43
  }
31
44
  description = description || `ContextOS skill for ${name}`;
32
45
 
33
- // Find all .md files in the skill directory deterministically
34
46
  const files = fs.readdirSync(skillDir).sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
35
47
  const mdFiles = files.filter(f => f.endsWith('.md'));
36
48
 
37
- // Primary skill content first: SKILL.md is canonical; fallback to <skillName>.md
38
49
  const primaryMd = mdFiles.includes('SKILL.md')
39
50
  ? 'SKILL.md'
40
51
  : (mdFiles.find(f => f === `${skillName}.md`) || mdFiles[0]);
@@ -42,22 +53,16 @@ function generateGeminiSkill(skillDir) {
42
53
  let mergedContent = '';
43
54
  if (primaryMd) {
44
55
  let primaryText = fs.readFileSync(path.join(skillDir, primaryMd), 'utf8');
45
- // Strip existing frontmatter from source so we don't double-nest
46
56
  primaryText = primaryText.replace(/^---[\s\S]*?---\r?\n/, '');
47
57
  mergedContent += primaryText;
48
58
  }
49
59
 
50
- // Partition supplemental markdown files for deterministic, logical ordering:
51
- // 1. Specific topic / reference docs (e.g. accessibility.md), sorted alphabetically
52
- // 2. EXAMPLES.md
53
- // 3. TROUBLESHOOTING.md
54
60
  const otherTopicFiles = mdFiles.filter(f => f !== primaryMd && f !== 'EXAMPLES.md' && f !== 'TROUBLESHOOTING.md');
55
61
  const orderedExtras = [...otherTopicFiles];
56
62
  if (mdFiles.includes('EXAMPLES.md') && primaryMd !== 'EXAMPLES.md') orderedExtras.push('EXAMPLES.md');
57
63
  if (mdFiles.includes('TROUBLESHOOTING.md') && primaryMd !== 'TROUBLESHOOTING.md') orderedExtras.push('TROUBLESHOOTING.md');
58
64
 
59
65
  for (const mdFile of orderedExtras) {
60
- // Avoid re-appending content that was already inlined via Source comments in SKILL.md
61
66
  if (mergedContent.includes(`<!-- Source: ${mdFile} -->`)) continue;
62
67
  const extraContent = readMeaningfulMarkdown(path.join(skillDir, mdFile));
63
68
  if (extraContent) {
@@ -65,7 +70,6 @@ function generateGeminiSkill(skillDir) {
65
70
  }
66
71
  }
67
72
 
68
- // Construct Gemini SKILL.md format (normalizing line endings to \n)
69
73
  const outputContent = `---
70
74
  name: ${name}
71
75
  description: >
@@ -74,42 +78,69 @@ description: >
74
78
  ${mergedContent.trimStart()}
75
79
  `.replace(/\r\n/g, '\n');
76
80
 
77
- fs.mkdirSync(outputDir, { recursive: true });
78
- fs.writeFileSync(path.join(outputDir, 'SKILL.md'), outputContent);
81
+ const artifacts = [
82
+ {
83
+ path: `.agents/generated/gemini/skills/${skillName}/SKILL.md`,
84
+ content: outputContent,
85
+ mediaType: 'text/markdown',
86
+ kind: 'generated-adapter',
87
+ generator: GENERATOR_ID,
88
+ sourceSkillIds: [skillName],
89
+ inputsHash: context?.sourceGraphHash || 'none',
90
+ },
91
+ {
92
+ path: `.agents/skills/${skillName}/SKILL.md`,
93
+ content: outputContent,
94
+ mediaType: 'text/markdown',
95
+ kind: 'generated-adapter',
96
+ generator: GENERATOR_ID,
97
+ sourceSkillIds: [skillName],
98
+ inputsHash: context?.sourceGraphHash || 'none',
99
+ },
100
+ ];
101
+
102
+ return artifacts;
103
+ }
104
+
105
+ function render(context) {
106
+ const skills = collectSkillDirectories(context?.profile);
107
+ const artifacts = [];
108
+
109
+ for (const skill of skills) {
110
+ const rendered = renderGeminiSkill(skill, context);
111
+ artifacts.push(...rendered);
112
+ }
79
113
 
80
- console.log(`Generated SKILL.md for ${skillName}`);
114
+ return artifacts;
81
115
  }
82
116
 
83
- const ANTIGRAVITY_SKILLS_PATH = path.join(__dirname, '..', '..', 'skills');
84
-
85
- function copyFolderRecursiveSync(source, target) {
86
- if (!fs.existsSync(target)) fs.mkdirSync(target, { recursive: true });
87
- const files = fs.readdirSync(source).sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
88
- for (const file of files) {
89
- const curSource = path.join(source, file);
90
- const curTarget = path.join(target, file);
91
- if (fs.statSync(curSource).isDirectory()) {
92
- copyFolderRecursiveSync(curSource, curTarget);
93
- } else {
94
- fs.copyFileSync(curSource, curTarget);
117
+ function validate(artifacts) {
118
+ const diagnostics = [];
119
+ for (const art of artifacts) {
120
+ if (!art.content || art.content.length === 0) {
121
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
95
122
  }
96
123
  }
124
+ return diagnostics;
97
125
  }
98
126
 
99
- function run() {
100
- console.log('Starting Gemini adapter export...');
101
- resetDirectory(GENERATED_SKILLS_PATH);
102
-
103
- const skills = collectSkillDirectories();
104
- for (const skill of skills) {
105
- generateGeminiSkill(skill);
106
- }
127
+ function run(options = {}) {
128
+ const { loadCompilerContext } = require('../pure-compiler.js');
129
+ const projectRoot = options.projectRoot || '.';
130
+ const context = loadCompilerContext(projectRoot, options);
131
+ const artifacts = render(context);
132
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export gemini', context });
133
+ console.log(`✓ Gemini export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
134
+ return result;
135
+ }
107
136
 
108
- // Also sync to .agents/skills for Antigravity IDE native discovery
109
- resetDirectory(ANTIGRAVITY_SKILLS_PATH);
110
- copyFolderRecursiveSync(GENERATED_SKILLS_PATH, ANTIGRAVITY_SKILLS_PATH);
137
+ const adapter = {
138
+ describe,
139
+ render,
140
+ validate,
141
+ run,
142
+ };
111
143
 
112
- console.log('Export complete. Skills are in generated/gemini/skills and .agents/skills');
113
- }
144
+ registerAdapter('gemini', adapter);
114
145
 
115
- module.exports = { run };
146
+ module.exports = adapter;