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/bin/index.js CHANGED
@@ -4,6 +4,9 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { version } = require('../package.json');
6
6
  const profiles = require('../.agents/profiles.js');
7
+ const { isKnownCommand, getStatus, formatStatusText } = require('./commands.js');
8
+ const { detectProjectAttributes } = require('./lib/detector.js');
9
+ const lockfileLib = require('./lib/lockfile.js');
7
10
 
8
11
  // ── CLI argument parsing ──────────────────────────────────────────────────────
9
12
  const args = process.argv.slice(2);
@@ -15,7 +18,12 @@ const flags = {
15
18
  skipCompile: args.includes('--skip-compile'),
16
19
  auto: args.includes('--auto'),
17
20
  minimal: args.includes('--minimal'),
21
+ json: args.includes('--json'),
18
22
  withMcp: args.includes('--with-mcp') || args.includes('--mcp'),
23
+ agent: (() => {
24
+ const i = args.indexOf('--agent');
25
+ return i !== -1 ? args[i + 1] : null;
26
+ })(),
19
27
  profile: (() => {
20
28
  const i = args.indexOf('--profile');
21
29
  return i !== -1 ? args[i + 1] : null;
@@ -28,7 +36,11 @@ const flags = {
28
36
 
29
37
  // ── Help / Version ────────────────────────────────────────────────────────────
30
38
  if (flags.ver) {
31
- console.log(`contextos-agents v${version}`);
39
+ if (flags.json) {
40
+ console.log(JSON.stringify({ package: 'contextos-agents', version }));
41
+ } else {
42
+ console.log(`contextos-agents v${version}`);
43
+ }
32
44
  process.exit(0);
33
45
  }
34
46
 
@@ -38,33 +50,41 @@ contextos / contextos-agents v${version}
38
50
  Install AI assistant skills and rules into your project.
39
51
 
40
52
  Usage:
41
- npx contextos [options]
53
+ npx contextos-agents init [options]
54
+ npx contextos-agents <command> [args...]
42
55
  contextos <command> [args...]
43
56
 
44
57
  Options:
45
58
  --help, -h Show this help message
46
59
  --version, -v Show version number
60
+ --json Output machine-readable JSON format
61
+ --agent <name> Target AI agent or IDE (gemini, claude, cursor, auto)
47
62
  --dry-run Preview what will be copied without making changes
48
63
  --force Overwrite an existing .agents/ folder
49
- --minimal Install only 5 core skills (lightweight footprint)
64
+ --minimal Install only 7 core skills (lightweight footprint)
50
65
  --profile <name> Install a specific profile (mvp, startup, enterprise, frontend, backend)
51
66
  --auto Auto-detect tech stack and apply recommended profile
52
- --with-mcp, --mcp Install with MCP execution server enabled (.agents/mcp/ & mcp_config.json)
67
+ --with-mcp, --mcp [DEPRECATED] Use the separate @contextos/mcp package instead
53
68
  --skip-compile Skip running ctx.js export after installation
54
69
  --add-skill <ref> Install a community plugin skill after setup
55
70
 
56
71
  Commands:
72
+ init Install and configure .agents/ in target project
73
+ status Display project configuration, active profile, and lockfile status
74
+ update Safely update skills without overwriting custom changes
75
+ uninstall Safely uninstall ContextOS files (preserves user custom skills)
57
76
  doctor Run full project diagnostic health check
58
77
  audit Validate local skills (alias for validate)
59
78
  validate Validate local skills, frontmatter, and sync
79
+ compile Compile skill manifests into deterministic registry v2
60
80
  profile <subcmd> Manage profiles (list, apply, show, remove)
61
81
  export <target> Export skills (gemini, claude, cursor, copilot, aider, zed, all)
62
82
  resolve <prompt> Dynamically resolve minimal skills for a prompt or files
63
83
  stats Display token context savings report
64
84
  watch Start continuous file watcher and auto-sync daemon
65
- detect Analyze project and display detected tech stack
85
+ detect Analyze project and display detected tech stack & IDE
66
86
  install-skill Interactive skill installer (or pass <ref> / --from-repo)
67
- setup-mcp Add MCP execution server to an existing .agents/ project
87
+ setup-mcp [DEPRECATED] Add MCP execution server to an existing .agents/ project
68
88
 
69
89
  Profiles:
70
90
  mvp Fastest shipping, minimalist monolith, excludes microservices & DDD
@@ -82,12 +102,12 @@ Plugin ref formats:
82
102
  @scope/npm-package A scoped npm skill package
83
103
 
84
104
  Examples:
85
- npx contextos Install .agents/ into current project
86
- npx contextos --minimal Install only 5 core essential skills
87
- npx contextos --profile startup Install with startup profile
88
- contextos doctor Run project health check
89
- contextos export gemini Compile skills for Gemini
90
- contextos profile list List available profiles
105
+ npx contextos-agents init Install .agents/ with auto-detected stack
106
+ npx contextos-agents init --agent auto Install and configure for detected stack & IDE
107
+ npx contextos-agents init --minimal Install only 7 core essential skills
108
+ npx contextos status Show project configuration and lockfile status
109
+ npx contextos doctor Run project health check
110
+ npx contextos export gemini Compile skills for Gemini
91
111
  `);
92
112
  process.exit(0);
93
113
  }
@@ -95,10 +115,146 @@ Examples:
95
115
  // ── Top-level Commands & Proxy Routing ────────────────────────────────────────
96
116
  const mainCommand = args[0] && !args[0].startsWith('-') ? args[0] : null;
97
117
 
118
+ // Unknown command check
119
+ if (mainCommand && mainCommand !== 'init' && !isKnownCommand(mainCommand)) {
120
+ if (flags.json) {
121
+ console.error(JSON.stringify({ error: `Unknown command: ${mainCommand}`, code: 1 }));
122
+ } else {
123
+ console.error(`[ERROR] Unknown command: ${mainCommand}`);
124
+ console.error(' Run `npx contextos-agents --help` to view available commands.');
125
+ }
126
+ process.exit(1);
127
+ }
128
+
129
+ // Status command
130
+ if (mainCommand === 'status') {
131
+ const status = getStatus(process.cwd());
132
+ if (flags.json) {
133
+ console.log(JSON.stringify(status, null, 2));
134
+ } else {
135
+ console.log(formatStatusText(status));
136
+ }
137
+ process.exit(0);
138
+ }
139
+
140
+ // Detect command
141
+ if (mainCommand === 'detect') {
142
+ const { WorkspaceGraphBuilder } = require('../.agents/workspace/workspace-graph.js');
143
+ const scopeIdx = args.indexOf('--scope');
144
+ const scopeArg = scopeIdx !== -1 && args[scopeIdx + 1] && !args[scopeIdx + 1].startsWith('--')
145
+ ? args[scopeIdx + 1]
146
+ : (args.find(a => a.startsWith('--scope=')) || '').split('=')[1];
147
+ const explain = args.includes('--explain');
148
+
149
+ const builder = new WorkspaceGraphBuilder();
150
+ const graph = builder.build(process.cwd());
151
+
152
+ if (scopeArg) {
153
+ const nearestPkg = builder.findNearestPackage(scopeArg, graph);
154
+ const evidence = builder.extractPackageEvidence(scopeArg, graph);
155
+
156
+ if (flags.json) {
157
+ console.log(JSON.stringify({
158
+ scope: scopeArg,
159
+ nearestPackage: nearestPkg,
160
+ evidence,
161
+ }, null, 2));
162
+ } else {
163
+ console.log('\n══════════════════════════════════════════');
164
+ console.log(' ContextOS — Workspace Scoped Detection');
165
+ console.log('══════════════════════════════════════════\n');
166
+ console.log(` Scope Path : ${scopeArg}`);
167
+ if (nearestPkg) {
168
+ console.log(` Nearest Package : ${nearestPkg.id} (${nearestPkg.ecosystem})`);
169
+ console.log(` Package Root : ${nearestPkg.root}`);
170
+ console.log(` Languages : ${nearestPkg.languages.join(', ') || 'unspecified'}`);
171
+ console.log(` Dependencies : ${nearestPkg.dependencies.length} (${nearestPkg.dependencies.slice(0, 8).join(', ')}${nearestPkg.dependencies.length > 8 ? '...' : ''})`);
172
+ console.log(` Configs : ${nearestPkg.configs.join(', ') || 'none'}`);
173
+ if (nearestPkg.internalDependencies.length > 0) {
174
+ console.log(` Internal Links : ${nearestPkg.internalDependencies.join(', ')}`);
175
+ }
176
+ if (evidence.length > 0) {
177
+ console.log('\n Scoped Evidence:');
178
+ for (const ev of evidence.slice(0, 10)) {
179
+ console.log(` • [${ev.source}] ${ev.target} (+${ev.weight}) — ${ev.description}`);
180
+ }
181
+ if (evidence.length > 10) {
182
+ console.log(` ... and ${evidence.length - 10} more signals`);
183
+ }
184
+ }
185
+ } else {
186
+ console.log(' Nearest Package : (none found)');
187
+ }
188
+ console.log('\n──────────────────────────────────────────\n');
189
+ }
190
+ } else if (flags.json) {
191
+ const detection = detectProjectAttributes(process.cwd());
192
+ console.log(JSON.stringify({
193
+ ...detection,
194
+ workspaceGraph: graph,
195
+ }, null, 2));
196
+ } else if (explain) {
197
+ console.log('\n══════════════════════════════════════════');
198
+ console.log(' ContextOS — Workspace Evidence Graph');
199
+ console.log('══════════════════════════════════════════\n');
200
+ console.log(` Repository Root : ${graph.repositoryRoot}`);
201
+ console.log(` Fingerprint : ${graph.fingerprint}`);
202
+ console.log(` Packages Found : ${graph.packages.length} ${graph.partial ? '(partial: true)' : ''}\n`);
203
+ for (const pkg of graph.packages) {
204
+ console.log(` • ${pkg.id} [${pkg.ecosystem}]`);
205
+ console.log(` Root : ${pkg.root}`);
206
+ console.log(` Manifests : ${pkg.manifests.join(', ')}`);
207
+ console.log(` Languages : ${pkg.languages.join(', ') || 'unspecified'}`);
208
+ console.log(` Dependencies : ${pkg.dependencies.length}`);
209
+ if (pkg.configs.length > 0) {
210
+ console.log(` Configs : ${pkg.configs.join(', ')}`);
211
+ }
212
+ if (pkg.internalDependencies.length > 0) {
213
+ console.log(` Internal Links : ${pkg.internalDependencies.join(', ')}`);
214
+ }
215
+ console.log('');
216
+ }
217
+ console.log('──────────────────────────────────────────\n');
218
+ } else {
219
+ const detection = detectProjectAttributes(process.cwd());
220
+ console.log('\nContextOS — Tech Stack & Environment Detection\n');
221
+ console.log(` Repository Root : ${graph.repositoryRoot}`);
222
+ console.log(` Packages Detected : ${graph.packages.map(p => `${p.id} (${p.root})`).join(', ')}`);
223
+ console.log(` Detected Technologies : ${detection.summary.technologies.join(', ')}`);
224
+ console.log(` Detected Environments : ${detection.summary.ides.join(', ')}`);
225
+ console.log(` Recommended Profile : ${detection.summary.recommendedProfile}`);
226
+ console.log(` Recommended Agents : ${detection.summary.recommendedAgents.join(', ')}`);
227
+ console.log(` Recommended Skills : ${detection.summary.recommendedSkills.join(', ')}\n`);
228
+ console.log(' Commands:');
229
+ console.log(' contextos detect --scope <path> Scope detection to a specific file/subproject');
230
+ console.log(' contextos detect --explain Display full workspace evidence graph\n');
231
+ }
232
+ process.exit(0);
233
+ }
234
+
235
+ // Doctor command
236
+ if (mainCommand === 'doctor') {
237
+ const doctorModule = require('../.agents/doctor.js');
238
+ const result = doctorModule.runDoctor(process.cwd(), {
239
+ json: flags.json,
240
+ fix: args.includes('--fix'),
241
+ strict: args.includes('--strict'),
242
+ });
243
+ process.exit(result && result.ok === false ? 1 : 0);
244
+ }
245
+
246
+ // Recover command
247
+ if (mainCommand === 'recover') {
248
+ const recoverModule = require('./commands/recover.js');
249
+ recoverModule(args, flags);
250
+ process.exit(0);
251
+ }
252
+
98
253
  // Proxy commands to .agents/ctx.js when executed in a ContextOS project
99
254
  const PROXY_COMMANDS = [
100
255
  'profile', 'export', 'validate', 'resolve', 'skill', 'index',
101
- 'clean-worktrees', 'doctor', 'stats', 'watch', 'init'
256
+ 'clean-worktrees', 'stats', 'watch', 'compile', 'explain',
257
+ 'thread'
102
258
  ];
103
259
 
104
260
  const ctxPath = path.join(process.cwd(), '.agents', 'ctx.js');
@@ -115,9 +271,21 @@ if (mainCommand && PROXY_COMMANDS.includes(mainCommand) && hasLocalCtx) {
115
271
  }
116
272
 
117
273
  // Fallbacks when running outside an initialized .agents/ directory
118
- if (mainCommand === 'doctor') {
119
- const doctorModule = require('../.agents/doctor.js');
120
- doctorModule.runDoctor(process.cwd());
274
+ if (mainCommand === 'update') {
275
+ const { runUpdate } = require('./commands/update.js');
276
+ runUpdate(process.cwd(), {
277
+ dryRun: flags.dryRun,
278
+ skipCompile: flags.skipCompile,
279
+ profile: flags.profile,
280
+ });
281
+ process.exit(0);
282
+ }
283
+
284
+ if (mainCommand === 'uninstall') {
285
+ const { runUninstall } = require('./commands/uninstall.js');
286
+ runUninstall(process.cwd(), {
287
+ dryRun: flags.dryRun,
288
+ });
121
289
  process.exit(0);
122
290
  }
123
291
 
@@ -132,24 +300,7 @@ if (mainCommand === 'watch') {
132
300
  watchModule.runWatch(process.cwd());
133
301
  }
134
302
 
135
- if (mainCommand === 'init') {
136
- console.log(`
137
- ContextOS — Project Setup
138
-
139
- Usage:
140
- npx contextos Install .agents/ with auto-detected stack
141
- npx contextos --profile <name> Install with specific profile (mvp, startup, enterprise, frontend, backend)
142
- npx contextos --minimal Install only 5 core skills
143
- npx contextos --with-mcp Install with MCP execution server enabled
144
-
145
- Run:
146
- contextos doctor Verify installation health
147
- contextos stats Show token savings report
148
- `);
149
- process.exit(0);
150
- }
151
-
152
- const PROJECT_ONLY_COMMANDS = ['profile', 'export', 'validate', 'resolve', 'skill', 'index', 'clean-worktrees'];
303
+ const PROJECT_ONLY_COMMANDS = ['profile', 'export', 'validate', 'resolve', 'skill', 'index', 'clean-worktrees', 'compile', 'explain'];
153
304
  if (mainCommand && PROJECT_ONLY_COMMANDS.includes(mainCommand) && !hasLocalCtx) {
154
305
  console.error('[ERROR] .agents/ctx.js not found in current directory.');
155
306
  console.error(' Are you in a ContextOS project? Run `contextos` or `npx contextos-agents` first.');
@@ -170,15 +321,6 @@ if (mainCommand === 'audit') {
170
321
  process.exit(0);
171
322
  }
172
323
 
173
- if (mainCommand === 'detect') {
174
- const stack = profiles.detectStack(process.cwd());
175
- console.log('\nContextOS — Tech Stack Detection\n');
176
- console.log(` Detected Technologies : ${stack.detected.length ? stack.detected.join(', ') : 'Generic JavaScript'}`);
177
- console.log(` Recommended Profile : ${stack.recommendedProfile}`);
178
- console.log(` Recommended Skills : ${stack.recommendedSkills.join(', ')}\n`);
179
- process.exit(0);
180
- }
181
-
182
324
  if (mainCommand === 'install-skill') {
183
325
  const ctxPath = path.join(process.cwd(), '.agents', 'ctx.js');
184
326
  if (!fs.existsSync(ctxPath)) {
@@ -288,46 +430,10 @@ if (mainCommand === 'install-skill') {
288
430
  })();
289
431
  }
290
432
  } else if (mainCommand === 'setup-mcp') {
291
- const targetPath = path.join(process.cwd(), '.agents');
292
- if (!fs.existsSync(targetPath)) {
293
- console.error('[ERROR] .agents/ folder not found in current directory.');
294
- console.error(' Run `npx contextos-agents` first or `npx contextos-agents --with-mcp`.');
295
- process.exit(1);
296
- }
297
-
298
- const sourceMcp = path.join(__dirname, '..', '.agents', 'mcp');
299
- const targetMcp = path.join(targetPath, 'mcp');
300
- if (!fs.existsSync(sourceMcp)) {
301
- console.error('[ERROR] Source MCP server bundle not found in package.');
302
- process.exit(1);
303
- }
304
-
305
- try {
306
- fs.cpSync(sourceMcp, targetMcp, { recursive: true, force: true });
307
- console.log('[OK] Installed ContextOS MCP execution server into .agents/mcp/');
308
-
309
- const mcpConfigPath = path.join(targetPath, 'mcp_config.json');
310
- if (!fs.existsSync(mcpConfigPath) || flags.force) {
311
- const defaultMcpConfig = {
312
- mcpServers: {
313
- "contextos": {
314
- command: "node",
315
- args: ["./.agents/mcp/server.mjs", "--dir", "."]
316
- }
317
- }
318
- };
319
- fs.writeFileSync(mcpConfigPath, JSON.stringify(defaultMcpConfig, null, 2));
320
- console.log('[OK] Created MCP configuration (.agents/mcp_config.json)');
321
- } else {
322
- console.log('[INFO] Existing .agents/mcp_config.json retained.');
323
- }
324
- console.log('\n[SUCCESS] ContextOS MCP execution layer is configured.');
325
- console.log('You can now use parallel subagents and git worktrees in your MCP-compatible IDE.\n');
326
- } catch (err) {
327
- console.error('[ERROR] Failed to configure MCP:', err.message);
328
- process.exit(1);
329
- }
330
- process.exit(0);
433
+ console.error('[DEPRECATED] The bundled MCP server has been moved to a separate package in v2.0.');
434
+ console.error(' To use the MCP Bridge or execution runtime, install @contextos/mcp:');
435
+ console.error(' npm install @contextos/mcp --save-dev');
436
+ process.exit(1);
331
437
  } else {
332
438
 
333
439
  // ── Paths ─────────────────────────────────────────────────────────────────────
@@ -339,7 +445,9 @@ const MINIMAL_SKILLS = new Set([
339
445
  'ponytail-mindset',
340
446
  'gstack-roles',
341
447
  'gemini-precision',
342
- 'react',
448
+ 'context-os',
449
+ 'context-manager',
450
+ 'security',
343
451
  ]);
344
452
 
345
453
  function uniqueSiblingPath(basePath, suffix) {
@@ -365,10 +473,8 @@ function installAtomically(source, target, options = {}) {
365
473
  force: true,
366
474
  filter: (src) => {
367
475
  const norm = src.replace(/\\/g, '/');
368
- if (!options.withMcp) {
369
- if (norm.endsWith('/mcp') || norm.includes('/mcp/') || norm.endsWith('/mcp_config.json')) {
370
- return false;
371
- }
476
+ if (norm.endsWith('/mcp') || norm.includes('/mcp/') || norm.endsWith('/mcp_config.json')) {
477
+ return false;
372
478
  }
373
479
  if (options.minimal) {
374
480
  const skillMatch = norm.match(/\/core\/skills\/([^/]+)/);
@@ -404,12 +510,18 @@ function installAtomically(source, target, options = {}) {
404
510
  }
405
511
  }
406
512
 
407
- // ── Stack detection ───────────────────────────────────────────────────────────
408
- const stackDetection = profiles.detectStack(process.cwd());
513
+ // ── Stack & IDE detection ───────────────────────────────────────────────────
514
+ const projectAttrs = detectProjectAttributes(process.cwd());
515
+ const stackDetection = projectAttrs.stack;
516
+ const ideDetection = projectAttrs.ide;
517
+
518
+ const targetProfile = flags.profile || (flags.auto || flags.agent === 'auto' ? stackDetection.recommendedProfile : 'none');
519
+ const targetAgents = (flags.agent === 'auto' || flags.auto)
520
+ ? ideDetection.recommendedAgents
521
+ : (flags.agent ? [flags.agent] : ['gemini']);
409
522
 
410
523
  // ── Dry run ───────────────────────────────────────────────────────────────────
411
524
  if (flags.dryRun) {
412
- console.log('[DRY-RUN] No files will be written.\n');
413
525
  if (!fs.existsSync(sourcePath)) {
414
526
  console.error('[ERROR] Source .agents/ folder not found in package.');
415
527
  process.exit(1);
@@ -439,14 +551,34 @@ if (flags.dryRun) {
439
551
  return count;
440
552
  };
441
553
  const total = countFiles(sourcePath);
554
+
555
+ if (flags.json) {
556
+ console.log(JSON.stringify({
557
+ dryRun: true,
558
+ targetPath,
559
+ targetProfile,
560
+ detectedStack: stackDetection.detected,
561
+ detectedIde: ideDetection.detected,
562
+ targetAgents,
563
+ filesCount: total,
564
+ minimal: flags.minimal,
565
+ withMcp: flags.withMcp,
566
+ }, null, 2));
567
+ process.exit(0);
568
+ }
569
+
570
+ console.log('[DRY-RUN] No files will be written.\n');
442
571
  if (fs.existsSync(targetPath)) {
443
572
  console.log(`[WARN] .agents/ already exists — would be overwritten with --force.`);
444
573
  } else {
445
574
  console.log(`[OK] Would create .agents/ in: ${process.cwd()}`);
446
575
  }
447
576
  console.log(`[INFO] Detected stack: ${stackDetection.detected.length ? stackDetection.detected.join(', ') : 'Generic JavaScript'}`);
448
- const targetProfile = flags.profile || (flags.auto ? stackDetection.recommendedProfile : 'none');
577
+ if (ideDetection.detected.length > 0) {
578
+ console.log(`[INFO] Detected IDEs: ${ideDetection.detected.join(', ')}`);
579
+ }
449
580
  console.log(`[INFO] Selected profile: ${targetProfile}`);
581
+ console.log(`[INFO] Target agents for export: ${targetAgents.join(', ')}`);
450
582
  if (flags.minimal) {
451
583
  console.log(`[INFO] Minimal mode: copying only 5 core essential skills`);
452
584
  }
@@ -456,7 +588,9 @@ if (flags.dryRun) {
456
588
  }
457
589
 
458
590
  // ── Main install ──────────────────────────────────────────────────────────────
459
- console.log('Installing AI assistant skills (.agents/)...');
591
+ if (!flags.json) {
592
+ console.log('Installing AI assistant skills (.agents/)...');
593
+ }
460
594
 
461
595
  try {
462
596
  if (!fs.existsSync(sourcePath)) {
@@ -477,64 +611,124 @@ try {
477
611
 
478
612
  installAtomically(sourcePath, targetPath, { withMcp: flags.withMcp, minimal: flags.minimal });
479
613
 
480
- console.log('[OK] .agents/ successfully installed in your project!');
481
- if (flags.minimal) {
482
- console.log('[OK] Minimal profile: 5 core skills installed.');
483
- console.log(' (engineering-workflow, ponytail-mindset, gstack-roles, gemini-precision, react)');
484
- console.log(' Tip: Add more skills anytime with: contextos skill add <name>');
614
+ // ── Create/update lockfile for provenance & safe lifecycle ─────────────────
615
+ const selectedProfile = flags.profile || (flags.auto || flags.agent === 'auto' ? stackDetection.recommendedProfile : null);
616
+ try {
617
+ lockfileLib.migrateExistingInstallation(process.cwd(), sourcePath, {
618
+ selectedProfile: selectedProfile || 'none',
619
+ installedPackage: 'contextos-agents',
620
+ version,
621
+ });
622
+ } catch (err) {
623
+ if (flags.json) {
624
+ console.error(JSON.stringify({ success: false, error: `Could not generate lockfile: ${err.message}` }));
625
+ } else {
626
+ console.error(`[ERROR] Could not generate lockfile: ${err.message}`);
627
+ }
628
+ process.exit(1);
485
629
  }
486
- if (stackDetection.detected.length > 0) {
487
- console.log(`[OK] Detected project stack: ${stackDetection.detected.join(', ')}`);
630
+
631
+ if (!flags.json) {
632
+ console.log('[OK] .agents/ successfully installed in your project!');
633
+ if (flags.minimal) {
634
+ console.log('[OK] Minimal profile: 5 core skills installed.');
635
+ console.log(' (engineering-workflow, ponytail-mindset, gstack-roles, gemini-precision, react)');
636
+ console.log(' Tip: Add more skills anytime with: contextos skill add <name>');
637
+ }
638
+ if (stackDetection.detected.length > 0) {
639
+ console.log(`[OK] Detected project stack: ${stackDetection.detected.join(', ')}`);
640
+ }
641
+ if (ideDetection.detected.length > 0) {
642
+ console.log(`[OK] Detected developer environment: ${ideDetection.detected.join(', ')}`);
643
+ }
488
644
  }
489
645
 
490
- // ── Create mcp_config.json only if --with-mcp ────────────────────────────────
646
+ // ── Deprecation warning for --with-mcp ────────────────────────────────────────────────
491
647
  if (flags.withMcp) {
492
- const mcpConfigPath = path.join(targetPath, 'mcp_config.json');
493
- if (!fs.existsSync(mcpConfigPath)) {
494
- const defaultMcpConfig = {
495
- mcpServers: {
496
- "contextos": {
497
- command: "node",
498
- args: ["./.agents/mcp/server.mjs", "--dir", "."]
499
- }
500
- }
501
- };
502
- fs.writeFileSync(mcpConfigPath, JSON.stringify(defaultMcpConfig, null, 2));
503
- console.log('[OK] Created default MCP configuration (.agents/mcp_config.json)');
504
- }
648
+ console.warn('\n[DEPRECATED] The --with-mcp flag is no longer supported in ContextOS v2.0.');
649
+ console.warn(' The MCP execution runtime has been moved to a separate package.');
650
+ console.warn(' To enable the MCP server, run: npm install @contextos/mcp --save-dev\n');
505
651
  }
506
652
 
507
653
  // ── Apply profile if requested or auto ──────────────────────────────────────
508
- const selectedProfile = flags.profile || (flags.auto ? stackDetection.recommendedProfile : null);
509
654
  if (selectedProfile) {
510
655
  try {
511
656
  const applied = profiles.applyProfile(selectedProfile, process.cwd());
512
- console.log(`[OK] Applied profile '${applied.name}' (excluded: ${(applied.exclude_skills || []).join(', ') || 'none'})`);
657
+ if (!flags.json) console.log(`[OK] Applied profile '${applied.name}' (excluded: ${(applied.exclude_skills || []).join(', ') || 'none'})`);
513
658
  } catch (e) {
514
- console.warn(`[WARN] Could not apply profile '${selectedProfile}': ${e.message}`);
659
+ if (flags.json) {
660
+ console.error(JSON.stringify({ success: false, error: `Could not apply profile '${selectedProfile}': ${e.message}` }));
661
+ } else {
662
+ console.error(`[ERROR] Could not apply profile '${selectedProfile}': ${e.message}`);
663
+ }
664
+ process.exit(1);
515
665
  }
516
666
  }
517
667
 
518
- console.log('[OK] Your AI assistant now has skills and rules configured.\n');
668
+ if (!flags.json) {
669
+ console.log('[OK] Your AI assistant now has skills and rules configured.\n');
670
+ }
519
671
 
520
- // ── Auto-compile skills ───────────────────────────────────────────────────
672
+ // ── Auto-compile skills for target agents ──────────────────────────────────
521
673
  if (!flags.skipCompile) {
522
674
  const ctxPath = path.join(targetPath, 'ctx.js');
523
675
  if (fs.existsSync(ctxPath)) {
524
- console.log('Compiling skills for Gemini...');
676
+ const { execFileSync } = require('child_process');
677
+ for (const ag of targetAgents) {
678
+ if (!flags.json) console.log(`Compiling skills for ${ag}...`);
679
+ try {
680
+ execFileSync(process.execPath, [ctxPath, 'export', ag], {
681
+ cwd: process.cwd(),
682
+ stdio: flags.json ? 'ignore' : 'inherit',
683
+ });
684
+ } catch (e) {
685
+ if (flags.json) {
686
+ console.error(JSON.stringify({ success: false, error: `Skill compilation for '${ag}' failed` }));
687
+ } else {
688
+ console.error(`[ERROR] Skill compilation for '${ag}' failed — run manually: contextos export ${ag}`);
689
+ }
690
+ process.exit(1);
691
+ }
692
+ }
693
+ }
694
+ } else if (!flags.json) {
695
+ console.log('Tip: Run `contextos export gemini` to compile skills.');
696
+ }
697
+
698
+ // ── --add-skill flag ────────────────────────────────────────────────────────
699
+ if (flags.addSkill) {
700
+ const ctxPath = path.join(targetPath, 'ctx.js');
701
+ if (fs.existsSync(ctxPath)) {
702
+ if (!flags.json) console.log(`Installing plugin skill: ${flags.addSkill}`);
525
703
  try {
526
704
  const { execFileSync } = require('child_process');
527
- execFileSync(process.execPath, [ctxPath, 'export', 'gemini'], {
705
+ execFileSync(process.execPath, [ctxPath, 'skill', 'add', flags.addSkill], {
528
706
  cwd: process.cwd(),
529
- stdio: 'inherit',
707
+ stdio: flags.json ? 'ignore' : 'inherit',
530
708
  });
531
709
  } catch (e) {
532
- console.warn('[WARN] Skill compilation failed — run manually:');
533
- console.warn(' contextos export gemini');
710
+ if (flags.json) {
711
+ console.error(JSON.stringify({ success: false, error: `Skill install failed for ${flags.addSkill}` }));
712
+ } else {
713
+ console.error(`[ERROR] Skill install failed — run manually: node .agents/ctx.js skill add ${flags.addSkill}`);
714
+ }
715
+ process.exit(1);
534
716
  }
535
717
  }
536
- } else {
537
- console.log('Tip: Run `contextos export gemini` to compile skills.');
718
+ }
719
+
720
+ if (flags.json) {
721
+ console.log(JSON.stringify({
722
+ success: true,
723
+ package: 'contextos-agents',
724
+ version,
725
+ projectDir: process.cwd(),
726
+ profile: selectedProfile || 'default',
727
+ agents: targetAgents,
728
+ withMcp: flags.withMcp,
729
+ minimal: flags.minimal,
730
+ }, null, 2));
731
+ process.exit(0);
538
732
  }
539
733
 
540
734
  console.log('\n Next steps:');
@@ -552,32 +746,15 @@ try {
552
746
  console.log(' 6. Add community skills (plugins):');
553
747
  console.log(' contextos skill add username/my-skill');
554
748
  console.log(' contextos skill list');
555
- if (!flags.withMcp) {
556
- console.log(' 7. Enable MCP parallel subagents & worktrees (optional):');
557
- console.log(' contextos setup-mcp');
558
- }
559
- console.log('');
560
749
 
561
- // ── --add-skill flag ────────────────────────────────────────────────────────
562
- if (flags.addSkill) {
563
- const ctxPath = path.join(targetPath, 'ctx.js');
564
- if (fs.existsSync(ctxPath)) {
565
- console.log(`Installing plugin skill: ${flags.addSkill}`);
566
- try {
567
- const { execFileSync } = require('child_process');
568
- execFileSync(process.execPath, [ctxPath, 'skill', 'add', flags.addSkill], {
569
- cwd: process.cwd(),
570
- stdio: 'inherit',
571
- });
572
- } catch (e) {
573
- console.warn(`[WARN] Skill install failed — run manually:`);
574
- console.warn(` node .agents/ctx.js skill add ${flags.addSkill}`);
575
- }
576
- }
577
- }
750
+ console.log('');
578
751
 
579
752
  } catch (error) {
580
- console.error('[ERROR] Installation failed:', error.message);
753
+ if (flags.json) {
754
+ console.error(JSON.stringify({ success: false, error: error.message }));
755
+ } else {
756
+ console.error('[ERROR] Installation failed:', error.message);
757
+ }
581
758
  process.exit(1);
582
759
  }
583
760