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
package/.agents/AGENTS.md CHANGED
@@ -1,4 +1,4 @@
1
- # ContextOS — AI Project Operating System
1
+ # ContextOS — Deterministic context compiler and policy engine for AI coding agents.
2
2
 
3
3
  You are working inside a project managed by **ContextOS**. This file is the **single source of truth** for how you must behave, think, and which skills to activate for every task.
4
4
 
@@ -22,6 +22,10 @@ State your answers explicitly:
22
22
  Skills loaded: react, typescript, ui-ux-pro, ponytail-mindset
23
23
  ```
24
24
 
25
+ > **Anti-Spam Invariant**:
26
+ > Declare `[DOMAIN: ...] [PHASE: ...] [ROLE: ...]` **strictly once** at the beginning of a user task or when transitioning between major phases (`DEFINE → PLAN → BUILD → VERIFY → REVIEW → SHIP`).
27
+ > **NEVER** prefix intermediate tool calls, file reads, grep searches, or step updates with this header.
28
+
25
29
  ---
26
30
 
27
31
  ## Skill Architecture (Context Efficiency)
@@ -372,6 +376,7 @@ These rules apply regardless of which skills are loaded:
372
376
 
373
377
  ### Engineering
374
378
  - No code before spec + plan are approved in interactive development (proceed directly to BUILD when standalone/benchmark code is requested)
379
+ - **Fast-Track Exception**: For routine maintenance, operational tasks (git commands, version bump, lint fix, typo, single-line config tweaks, diagnostics, and direct questions), proceed directly without blocking on full `/spec` and `/plan` approval rituals.
375
380
  - Blast radius limited to files in current task's plan
376
381
  - One atomic commit per task
377
382
 
@@ -1,28 +1,28 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
4
-
5
- // Aider config goes to project root
6
- const CONF_FILE = path.join(process.cwd(), '.aider.conf.yml');
7
- const CONVENTIONS_FILE = path.join(process.cwd(), 'CONVENTIONS.md');
8
-
9
1
  /**
10
- * Aider adapter — export.js
11
- *
12
- * Aider uses two complementary files:
13
- * 1. `.aider.conf.yml` — config file that points Aider to conventions
14
- * 2. `CONVENTIONS.md` — flat Markdown with all skills compiled in
15
- *
16
- * The config tells Aider to load CONVENTIONS.md via `read:` directive and
17
- * pre-loads it as a read-only context file on every session.
18
- *
19
- * Format spec: https://aider.chat/docs/config/aider_conf.html
2
+ * .agents/adapters/aider/export.js
3
+ * ContextOS Aider Pure Adapter (.aider.conf.yml & CONVENTIONS.md)
20
4
  */
21
5
 
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts, createProvenanceHeader } = require('../pure-compiler.js');
10
+
11
+ const GENERATOR_ID = 'aider@2';
12
+
13
+ function describe() {
14
+ return {
15
+ name: 'aider',
16
+ version: '2.0.0',
17
+ description: 'Compiles configuration and conventions for Aider (.aider.conf.yml and CONVENTIONS.md)',
18
+ targetPattern: '{.aider.conf.yml,CONVENTIONS.md}',
19
+ };
20
+ }
21
+
22
22
  function buildSkillSection(skillDir) {
23
- const skillName = path.basename(skillDir);
24
- const skillMdPath = path.join(skillDir, 'SKILL.md');
25
- const yamlPath = path.join(skillDir, 'skill.yaml');
23
+ const skillName = path.basename(skillDir);
24
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
25
+ const yamlPath = path.join(skillDir, 'skill.yaml');
26
26
 
27
27
  let title = skillName;
28
28
  let description = '';
@@ -47,91 +47,111 @@ function buildSkillSection(skillDir) {
47
47
  return `\n## Skill: ${title}\n${descLine}${skillRef}`;
48
48
  }
49
49
 
50
- function generateAiderConf() {
51
- const conf = `# .aider.conf.yml
52
- # Auto-generated by: node .agents/ctx.js export aider
53
- # Source: .agents/core/skills/ · Do not edit manually.
54
-
55
- # Load project conventions as a read-only context file on every session
56
- read:
57
- - CONVENTIONS.md
58
-
59
- # Recommended model settings (override as needed)
60
- # model: gpt-4o
61
- # editor-model: gpt-4o-mini
62
-
63
- # Auto-commit after every accepted change
64
- auto-commits: true
65
-
66
- # Show diffs in git format
67
- pretty: true
68
- `;
69
- return conf;
70
- }
71
-
72
- function run() {
73
- console.log('Starting Aider adapter export...');
74
-
75
- // ── 1. Write .aider.conf.yml ─────────────────────────────────────────────────
76
- fs.writeFileSync(CONF_FILE, generateAiderConf());
77
- console.log(`Generated .aider.conf.yml → ${CONF_FILE}`);
78
-
79
- // ── 2. Build CONVENTIONS.md ──────────────────────────────────────────────────
80
- const sections = [];
81
-
82
- sections.push(
83
- `# CONVENTIONS.md — ContextOS Project Conventions\n\n` +
84
- `> Auto-generated by: node .agents/ctx.js export aider\n` +
85
- `> Source: .agents/core/skills/ · Do not edit manually.\n\n` +
86
- `Aider loads this file as read-only context on every session.\n` +
87
- `To keep your context window lean, load specific skill files on-demand using \`/read <path>\`.\n`
50
+ function render(context) {
51
+ const projectRoot = context?.projectRoot || '.';
52
+ const agentsMdPath = fs.existsSync(path.join(projectRoot, '.agents', 'AGENTS.md'))
53
+ ? path.join(projectRoot, '.agents', 'AGENTS.md')
54
+ : AGENTS_MD_PATH;
55
+
56
+ const yamlProv = createProvenanceHeader({
57
+ generator: GENERATOR_ID,
58
+ sourceGraphHash: context?.sourceGraphHash,
59
+ profileId: context?.profileId,
60
+ profileHash: context?.profileHash,
61
+ }, 'yaml');
62
+
63
+ const mdProv = createProvenanceHeader({
64
+ generator: GENERATOR_ID,
65
+ sourceGraphHash: context?.sourceGraphHash,
66
+ profileId: context?.profileId,
67
+ profileHash: context?.profileHash,
68
+ }, 'markdown');
69
+
70
+ // 1. .aider.conf.yml
71
+ const aiderConfContent = [
72
+ yamlProv,
73
+ '# Load project conventions as a read-only context file on every session',
74
+ 'read:',
75
+ ' - CONVENTIONS.md',
76
+ '',
77
+ '# Auto commit edits with standard git format',
78
+ 'auto-commits: true',
79
+ 'dirty-commits: true',
80
+ '',
81
+ ].join('\n');
82
+
83
+ // 2. CONVENTIONS.md
84
+ const convSections = [];
85
+ convSections.push(
86
+ mdProv +
87
+ `# ContextOS — Project Conventions for Aider\n\n` +
88
+ `> **Core law: Do not read everything. Read only what the current task requires.**\n\n`
88
89
  );
89
90
 
90
- // Project rules with Step 0
91
- sections.push(
92
- `\n---\n\n## Project Rules\n\n` +
93
- `### Step 0 — Identify Before Acting\n\n` +
94
- `Before writing a single line of code or plan, state:\n` +
95
- `\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n\n` +
96
- `### Non-Negotiable Rules\n\n` +
97
- `- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n` +
98
- `- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n` +
99
- `- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n` +
100
- `- **Surgical Blast Radius**: Modify only files strictly within scope.\n`
101
- );
91
+ if (fs.existsSync(agentsMdPath)) {
92
+ const agentsMd = fs.readFileSync(agentsMdPath, 'utf8');
93
+ convSections.push(`## Core Operational Rules\n\n${agentsMd}\n\n---\n`);
94
+ }
102
95
 
103
- // Skills Router Table
104
- sections.push('\n---\n\n## Skill Router\n\n');
105
- sections.push('Read the corresponding skill file only when the task matches the trigger:\n\n');
106
- sections.push('| Trigger / Domain | Skill | On-Demand Command |\n');
107
- sections.push('| --- | --- | --- |\n');
96
+ convSections.push(`\n## Available Specialist Skills\n\n` +
97
+ `Skills are loaded on demand. Use \`/read .agents/skills/<skill>/SKILL.md\` when needed.\n\n` +
98
+ `### Skill Index\n`);
108
99
 
109
- const skills = collectSkillDirectories();
100
+ const skills = collectSkillDirectories(context?.profile);
110
101
  for (const skill of skills) {
111
- const skillName = path.basename(skill);
112
- const yamlPath = path.join(skill, 'skill.yaml');
113
- let tags = skillName;
114
- if (fs.existsSync(yamlPath)) {
115
- const yaml = fs.readFileSync(yamlPath, 'utf8');
116
- const rawTags = extractYamlField(yaml, 'tags');
117
- if (rawTags) tags = rawTags.replace(/[\[\]]/g, '');
118
- }
119
- sections.push(`| \`${tags}\` | **${skillName}** | \`/read .agents/core/skills/${skillName}/SKILL.md\` |\n`);
102
+ const section = buildSkillSection(skill);
103
+ if (section) convSections.push(section);
120
104
  }
121
105
 
122
- // Skills
123
- sections.push('\n---\n\n# Skills\n');
124
- let count = 0;
125
- for (const skill of skills) {
126
- const section = buildSkillSection(skill);
127
- if (section) {
128
- sections.push(section);
129
- count++;
106
+ return [
107
+ {
108
+ path: '.aider.conf.yml',
109
+ content: aiderConfContent.replace(/\r\n/g, '\n'),
110
+ mediaType: 'application/yaml',
111
+ kind: 'generated-adapter',
112
+ generator: GENERATOR_ID,
113
+ sourceSkillIds: [],
114
+ inputsHash: context?.sourceGraphHash || 'none',
115
+ },
116
+ {
117
+ path: 'CONVENTIONS.md',
118
+ content: convSections.join('\n').replace(/\r\n/g, '\n'),
119
+ mediaType: 'text/markdown',
120
+ kind: 'generated-adapter',
121
+ generator: GENERATOR_ID,
122
+ sourceSkillIds: skills.map(s => path.basename(s)),
123
+ inputsHash: context?.sourceGraphHash || 'none',
124
+ },
125
+ ];
126
+ }
127
+
128
+ function validate(artifacts) {
129
+ const diagnostics = [];
130
+ for (const art of artifacts) {
131
+ if (!art.content || art.content.length === 0) {
132
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
130
133
  }
131
134
  }
135
+ return diagnostics;
136
+ }
132
137
 
133
- fs.writeFileSync(CONVENTIONS_FILE, sections.join('\n'));
134
- console.log(`Generated CONVENTIONS.md (${count} skills) → ${CONVENTIONS_FILE}`);
138
+ function run(options = {}) {
139
+ const { loadCompilerContext } = require('../pure-compiler.js');
140
+ const projectRoot = options.projectRoot || '.';
141
+ const context = loadCompilerContext(projectRoot, options);
142
+ const artifacts = render(context);
143
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export aider', context });
144
+ console.log(`✓ Aider export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
145
+ return result;
135
146
  }
136
147
 
137
- module.exports = { run };
148
+ const adapter = {
149
+ describe,
150
+ render,
151
+ validate,
152
+ run,
153
+ };
154
+
155
+ registerAdapter('aider', adapter);
156
+
157
+ module.exports = adapter;
@@ -1,55 +1,97 @@
1
+ /**
2
+ * .agents/adapters/claude/export.js
3
+ * ContextOS Claude Code Pure Adapter
4
+ */
5
+
1
6
  const fs = require('fs');
2
7
  const path = require('path');
3
- const { collectSkillDirectories, resetDirectory, readMeaningfulMarkdown } = require('../shared.js');
8
+ const { collectSkillDirectories, readMeaningfulMarkdown } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts } = require('../pure-compiler.js');
4
10
 
5
- const GENERATED_SKILLS_PATH = path.join(__dirname, '..', '..', 'generated', 'claude', 'skills');
11
+ const GENERATOR_ID = 'claude@2';
6
12
 
7
- /**
8
- * Claude Code skill format:
9
- * - Plain Markdown, no YAML frontmatter required
10
- * - First line is the skill name as an H1 comment
11
- * - Content is preserved as-is (Claude reads raw Markdown well)
12
- */
13
- function generateClaudeSkill(skillDir) {
13
+ function describe() {
14
+ return {
15
+ name: 'claude',
16
+ version: '2.0.0',
17
+ description: 'Compiles clean markdown skills for Claude Code CLI',
18
+ targetPattern: '.agents/generated/claude/skills/**/SKILL.md',
19
+ };
20
+ }
21
+
22
+ function renderClaudeSkill(skillDir, context) {
14
23
  const skillName = path.basename(skillDir);
15
24
  const existingSkillMdPath = path.join(skillDir, 'SKILL.md');
16
- const outputDir = path.join(GENERATED_SKILLS_PATH, skillName);
17
25
 
18
26
  if (!fs.existsSync(existingSkillMdPath)) {
19
- console.log(`Skipping ${skillName} (no SKILL.md)`);
20
- return;
27
+ return null;
21
28
  }
22
29
 
23
30
  let content = fs.readFileSync(existingSkillMdPath, 'utf8');
24
-
31
+
25
32
  const examples = readMeaningfulMarkdown(path.join(skillDir, 'EXAMPLES.md'));
26
33
  if (examples) {
27
34
  content += '\n\n' + examples;
28
35
  }
29
-
36
+
30
37
  const troubleshooting = readMeaningfulMarkdown(path.join(skillDir, 'TROUBLESHOOTING.md'));
31
38
  if (troubleshooting) {
32
39
  content += '\n\n' + troubleshooting;
33
40
  }
34
41
 
35
- // Strip YAML frontmatter if present (Claude doesn't need it)
42
+ // Strip YAML frontmatter
36
43
  content = content.replace(/^---[\s\S]*?---\r?\n/, '');
37
44
 
38
- // Write the cleaned Markdown
39
- fs.mkdirSync(outputDir, { recursive: true });
40
- fs.writeFileSync(path.join(outputDir, 'SKILL.md'), content.trimStart());
41
- console.log(`Generated SKILL.md for ${skillName} (claude)`);
45
+ return {
46
+ path: `.agents/generated/claude/skills/${skillName}/SKILL.md`,
47
+ content: content.trimStart().replace(/\r\n/g, '\n'),
48
+ mediaType: 'text/markdown',
49
+ kind: 'generated-adapter',
50
+ generator: GENERATOR_ID,
51
+ sourceSkillIds: [skillName],
52
+ inputsHash: context?.sourceGraphHash || 'none',
53
+ };
42
54
  }
43
55
 
44
- function run() {
45
- console.log('Starting Claude adapter export...');
46
- resetDirectory(GENERATED_SKILLS_PATH);
56
+ function render(context) {
57
+ const skills = collectSkillDirectories(context?.profile);
58
+ const artifacts = [];
47
59
 
48
- const skills = collectSkillDirectories();
49
60
  for (const skill of skills) {
50
- generateClaudeSkill(skill);
61
+ const art = renderClaudeSkill(skill, context);
62
+ if (art) artifacts.push(art);
51
63
  }
52
- console.log('Export complete. Skills are in generated/claude/skills');
64
+
65
+ return artifacts;
66
+ }
67
+
68
+ function validate(artifacts) {
69
+ const diagnostics = [];
70
+ for (const art of artifacts) {
71
+ if (!art.content || art.content.length === 0) {
72
+ diagnostics.push({ path: art.path, message: 'Empty artifact content' });
73
+ }
74
+ }
75
+ return diagnostics;
53
76
  }
54
77
 
55
- module.exports = { run };
78
+ function run(options = {}) {
79
+ const { loadCompilerContext } = require('../pure-compiler.js');
80
+ const projectRoot = options.projectRoot || '.';
81
+ const context = loadCompilerContext(projectRoot, options);
82
+ const artifacts = render(context);
83
+ const result = applyArtifacts(projectRoot, artifacts, { command: 'export claude', context });
84
+ console.log(`✓ Claude export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
85
+ return result;
86
+ }
87
+
88
+ const adapter = {
89
+ describe,
90
+ render,
91
+ validate,
92
+ run,
93
+ };
94
+
95
+ registerAdapter('claude', adapter);
96
+
97
+ module.exports = adapter;
@@ -1,24 +1,28 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
4
-
5
- // GitHub Copilot reads from .github/copilot-instructions.md
6
- const OUTPUT_FILE = path.join(process.cwd(), '.github', 'copilot-instructions.md');
7
-
8
1
  /**
9
- * GitHub Copilot adapter — export.js
10
- *
11
- * Copilot reads `.github/copilot-instructions.md` as a plain Markdown file.
12
- * We compile AGENTS.md + all skills into one document with clear section
13
- * headings so Copilot can reference them contextually.
14
- *
15
- * Format spec: https://docs.github.com/en/copilot/customizing-copilot/adding-repository-instructions
2
+ * .agents/adapters/copilot/export.js
3
+ * ContextOS GitHub Copilot Pure Adapter (.github/copilot-instructions.md)
16
4
  */
17
5
 
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const { collectSkillDirectories, extractYamlField, stripFrontmatter } = require('../shared.js');
9
+ const { registerAdapter, applyArtifacts, createProvenanceHeader } = require('../pure-compiler.js');
10
+
11
+ const GENERATOR_ID = 'copilot@2';
12
+
13
+ function describe() {
14
+ return {
15
+ name: 'copilot',
16
+ version: '2.0.0',
17
+ description: 'Compiles instructions for GitHub Copilot (.github/copilot-instructions.md)',
18
+ targetPattern: '.github/copilot-instructions.md',
19
+ };
20
+ }
21
+
18
22
  function buildSkillSection(skillDir) {
19
- const skillName = path.basename(skillDir);
20
- const skillMdPath = path.join(skillDir, 'SKILL.md');
21
- const yamlPath = path.join(skillDir, 'skill.yaml');
23
+ const skillName = path.basename(skillDir);
24
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
25
+ const yamlPath = path.join(skillDir, 'skill.yaml');
22
26
 
23
27
  let title = skillName;
24
28
  let description = '';
@@ -43,38 +47,39 @@ function buildSkillSection(skillDir) {
43
47
  return `\n### ${title}\n${descLine}${skillRef}`;
44
48
  }
45
49
 
46
- function run() {
47
- console.log('Starting GitHub Copilot adapter export...');
48
-
50
+ function render(context) {
49
51
  const lines = [];
50
52
 
51
- // ── Header ───────────────────────────────────────────────────────────────────
53
+ const prov = createProvenanceHeader({
54
+ generator: GENERATOR_ID,
55
+ sourceGraphHash: context?.sourceGraphHash,
56
+ profileId: context?.profileId,
57
+ profileHash: context?.profileHash,
58
+ });
59
+
52
60
  lines.push(
53
- `# GitHub Copilot Instructions — ContextOS\n`,
54
- `<!-- Auto-generated by: node .agents/ctx.js export copilot -->\n`,
55
- `<!-- Source: .agents/core/skills/ · Do not edit manually. -->\n\n`
61
+ prov +
62
+ `# GitHub Copilot Instructions — ContextOS\n\n` +
63
+ `## Project Rules\n\n` +
64
+ `### Step 0 — Identify Before Acting\n\n` +
65
+ `Before writing a single line of code or plan, state:\n` +
66
+ `\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n\n` +
67
+ `> **Anti-Spam Invariant**: Declare this strictly once at the start of a task or phase. Never repeat before intermediate tool calls or step updates.\n\n` +
68
+ `### Non-Negotiable Rules\n\n` +
69
+ `- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n` +
70
+ `- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n` +
71
+ `- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n` +
72
+ `- **Surgical Blast Radius**: Modify only files strictly within scope.\n` +
73
+ `- **Fast-Track Exception**: Routine maintenance, git commands, version bumps, typo fixes, and diagnostics skip spec/plan ceremonies.\n\n` +
74
+ `---\n\n` +
75
+ `## Skills Library\n\n` +
76
+ `ContextOS uses on-demand progressive disclosure. Read the relevant \`SKILL.md\` file only when your task matches the trigger.\n\n` +
77
+ `### Skill Routing Table\n\n` +
78
+ `| Trigger / Domain | Skill | Path |\n` +
79
+ `| --- | --- | --- |\n`
56
80
  );
57
81
 
58
- // ── Project rules & Step 0 ───────────────────────────────────────────────────
59
- lines.push(`## Project Rules\n\n`);
60
- lines.push(`### Step 0 — Identify Before Acting\n\n`);
61
- lines.push(`Before writing a single line of code or plan, state:\n`);
62
- lines.push(`\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n\n`);
63
- lines.push(`### Non-Negotiable Rules\n\n`);
64
- lines.push(`- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n`);
65
- lines.push(`- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n`);
66
- lines.push(`- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n`);
67
- lines.push(`- **Surgical Blast Radius**: Modify only files strictly within scope.\n\n`);
68
- lines.push(`---\n`);
69
-
70
- // ── Skills ───────────────────────────────────────────────────────────────────
71
- lines.push(`\n## Skills Library\n\n`);
72
- lines.push(`ContextOS uses on-demand progressive disclosure. Read the relevant \`SKILL.md\` file only when your task matches the trigger.\n\n`);
73
- lines.push(`### Skill Routing Table\n\n`);
74
- lines.push(`| Trigger / Domain | Skill | Path |\n`);
75
- lines.push(`| --- | --- | --- |\n`);
76
-
77
- const skills = collectSkillDirectories();
82
+ const skills = collectSkillDirectories(context?.profile);
78
83
  for (const skill of skills) {
79
84
  const skillName = path.basename(skill);
80
85
  const yamlPath = path.join(skill, 'skill.yaml');
@@ -89,19 +94,53 @@ function run() {
89
94
  }
90
95
  lines.push(`\n---\n`);
91
96
 
92
- let count = 0;
93
97
  for (const skill of skills) {
94
98
  const section = buildSkillSection(skill);
95
99
  if (section) {
96
100
  lines.push(section);
97
- count++;
98
101
  }
99
102
  }
100
103
 
101
- // ── Write ────────────────────────────────────────────────────────────────────
102
- fs.mkdirSync(path.dirname(OUTPUT_FILE), { recursive: true });
103
- fs.writeFileSync(OUTPUT_FILE, lines.join(''));
104
- console.log(`Generated .github/copilot-instructions.md (${count} skills) → ${OUTPUT_FILE}`);
104
+ return [
105
+ {
106
+ path: '.github/copilot-instructions.md',
107
+ content: lines.join('').replace(/\r\n/g, '\n'),
108
+ mediaType: 'text/markdown',
109
+ kind: 'generated-adapter',
110
+ generator: GENERATOR_ID,
111
+ sourceSkillIds: skills.map(s => path.basename(s)),
112
+ inputsHash: context?.sourceGraphHash || 'none',
113
+ },
114
+ ];
115
+ }
116
+
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' });
122
+ }
123
+ }
124
+ return diagnostics;
105
125
  }
106
126
 
107
- module.exports = { run };
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 copilot', context });
133
+ console.log(`✓ Copilot export complete: ${result.appliedCount} files applied (tx: ${result.txId})`);
134
+ return result;
135
+ }
136
+
137
+ const adapter = {
138
+ describe,
139
+ render,
140
+ validate,
141
+ run,
142
+ };
143
+
144
+ registerAdapter('copilot', adapter);
145
+
146
+ module.exports = adapter;