@cubis/foundry 0.3.32 → 0.3.34

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 (461) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +23 -0
  3. package/bin/cubis.js +461 -37
  4. package/mcp/README.md +17 -0
  5. package/mcp/catalogs/default.json +14 -0
  6. package/mcp/powers/atlassian-mcp/POWER.md +91 -0
  7. package/mcp/powers/atlassian-mcp/SKILL.md +88 -0
  8. package/mcp/powers/building-mcp-server-on-cloudflare/POWER.md +261 -0
  9. package/mcp/powers/building-mcp-server-on-cloudflare/SKILL.md +258 -0
  10. package/mcp/powers/datadog-automation/POWER.md +238 -0
  11. package/mcp/powers/datadog-automation/SKILL.md +235 -0
  12. package/mcp/powers/github-automation/POWER.md +230 -0
  13. package/mcp/powers/github-automation/SKILL.md +227 -0
  14. package/mcp/powers/mcp-builder/POWER.md +179 -0
  15. package/mcp/powers/mcp-builder/SKILL.md +176 -0
  16. package/mcp/powers/mcp-developer/POWER.md +88 -0
  17. package/mcp/powers/mcp-developer/SKILL.md +85 -0
  18. package/mcp/powers/postman/POWER.md +243 -0
  19. package/mcp/powers/postman/SKILL.md +240 -0
  20. package/mcp/powers/sentry-automation/POWER.md +235 -0
  21. package/mcp/powers/sentry-automation/SKILL.md +232 -0
  22. package/mcp/skills/atlassian-mcp/SKILL.md +88 -0
  23. package/mcp/skills/building-mcp-server-on-cloudflare/SKILL.md +258 -0
  24. package/mcp/skills/datadog-automation/SKILL.md +235 -0
  25. package/mcp/skills/github-automation/SKILL.md +227 -0
  26. package/mcp/skills/mcp-builder/SKILL.md +176 -0
  27. package/mcp/skills/mcp-developer/SKILL.md +85 -0
  28. package/mcp/skills/postman/SKILL.md +240 -0
  29. package/mcp/skills/sentry-automation/SKILL.md +232 -0
  30. package/package.json +2 -1
  31. package/workflows/powers/architecture/POWER.md +12 -46
  32. package/workflows/powers/architecture/SKILL.md +12 -46
  33. package/workflows/powers/atlassian-mcp/POWER.md +11 -81
  34. package/workflows/powers/atlassian-mcp/SKILL.md +11 -81
  35. package/workflows/powers/building-mcp-server-on-cloudflare/POWER.md +12 -252
  36. package/workflows/powers/building-mcp-server-on-cloudflare/SKILL.md +12 -252
  37. package/workflows/powers/code-review-checklist/POWER.md +11 -99
  38. package/workflows/powers/code-review-checklist/SKILL.md +11 -99
  39. package/workflows/powers/csharp-pro/POWER.md +43 -0
  40. package/workflows/powers/csharp-pro/SKILL.md +40 -0
  41. package/workflows/powers/database-design/POWER.md +47 -5
  42. package/workflows/powers/database-design/SKILL.md +45 -4
  43. package/workflows/powers/database-optimizer/POWER.md +11 -23
  44. package/workflows/powers/database-optimizer/SKILL.md +5 -5
  45. package/workflows/powers/datadog-automation/POWER.md +12 -229
  46. package/workflows/powers/datadog-automation/SKILL.md +12 -229
  47. package/workflows/powers/debugging-wizard/POWER.md +12 -78
  48. package/workflows/powers/debugging-wizard/SKILL.md +12 -78
  49. package/workflows/powers/deployment-procedures/POWER.md +11 -231
  50. package/workflows/powers/deployment-procedures/SKILL.md +11 -231
  51. package/workflows/powers/drift-flutter/POWER.md +51 -0
  52. package/workflows/powers/drift-flutter/SKILL.md +2 -2
  53. package/workflows/powers/github-automation/POWER.md +12 -221
  54. package/workflows/powers/github-automation/SKILL.md +12 -221
  55. package/workflows/powers/golang-pro/POWER.md +38 -66
  56. package/workflows/powers/golang-pro/SKILL.md +38 -66
  57. package/workflows/powers/java-pro/POWER.md +43 -0
  58. package/workflows/powers/java-pro/SKILL.md +40 -0
  59. package/workflows/powers/javascript-pro/POWER.md +37 -67
  60. package/workflows/powers/javascript-pro/SKILL.md +37 -67
  61. package/workflows/powers/kotlin-pro/POWER.md +43 -0
  62. package/workflows/powers/kotlin-pro/SKILL.md +40 -0
  63. package/workflows/powers/mcp-builder/POWER.md +12 -170
  64. package/workflows/powers/mcp-builder/SKILL.md +12 -170
  65. package/workflows/powers/mcp-developer/POWER.md +11 -78
  66. package/workflows/powers/mcp-developer/SKILL.md +11 -78
  67. package/workflows/powers/nextjs-developer/POWER.md +41 -148
  68. package/workflows/powers/nextjs-developer/SKILL.md +41 -148
  69. package/workflows/powers/nextjs-react-expert/POWER.md +10 -281
  70. package/workflows/powers/nextjs-react-expert/SKILL.md +10 -281
  71. package/workflows/powers/nodejs-best-practices/POWER.md +33 -317
  72. package/workflows/powers/nodejs-best-practices/SKILL.md +33 -317
  73. package/workflows/powers/postman/POWER.md +11 -233
  74. package/workflows/powers/postman/SKILL.md +11 -233
  75. package/workflows/powers/python-patterns/POWER.md +11 -431
  76. package/workflows/powers/python-patterns/SKILL.md +11 -431
  77. package/workflows/powers/python-pro/POWER.md +38 -66
  78. package/workflows/powers/python-pro/SKILL.md +38 -66
  79. package/workflows/powers/react-best-practices/POWER.md +35 -118
  80. package/workflows/powers/react-best-practices/SKILL.md +35 -118
  81. package/workflows/powers/react-expert/POWER.md +38 -66
  82. package/workflows/powers/react-expert/SKILL.md +38 -66
  83. package/workflows/powers/rust-engineer/POWER.md +10 -75
  84. package/workflows/powers/rust-engineer/SKILL.md +10 -75
  85. package/workflows/powers/rust-pro/POWER.md +36 -163
  86. package/workflows/powers/rust-pro/SKILL.md +36 -163
  87. package/workflows/powers/sentry-automation/POWER.md +12 -226
  88. package/workflows/powers/sentry-automation/SKILL.md +12 -226
  89. package/workflows/powers/server-management/POWER.md +11 -151
  90. package/workflows/powers/server-management/SKILL.md +11 -151
  91. package/workflows/powers/tdd-workflow/POWER.md +12 -140
  92. package/workflows/powers/tdd-workflow/SKILL.md +12 -140
  93. package/workflows/powers/testing-patterns/POWER.md +11 -168
  94. package/workflows/powers/testing-patterns/SKILL.md +11 -168
  95. package/workflows/powers/typescript-pro/POWER.md +43 -70
  96. package/workflows/powers/typescript-pro/SKILL.md +43 -70
  97. package/workflows/powers/vercel-ai/POWER.md +43 -0
  98. package/workflows/powers/vercel-ai/SKILL.md +40 -0
  99. package/workflows/powers/vercel-ai-gateway/POWER.md +11 -69
  100. package/workflows/powers/vercel-ai-gateway/SKILL.md +11 -69
  101. package/workflows/powers/vercel-ai-sdk/POWER.md +11 -49
  102. package/workflows/powers/vercel-ai-sdk/SKILL.md +11 -49
  103. package/workflows/powers/vercel-caching/POWER.md +10 -72
  104. package/workflows/powers/vercel-caching/SKILL.md +10 -72
  105. package/workflows/powers/vercel-cli/POWER.md +11 -75
  106. package/workflows/powers/vercel-cli/SKILL.md +11 -75
  107. package/workflows/powers/vercel-delivery/POWER.md +45 -0
  108. package/workflows/powers/vercel-delivery/SKILL.md +42 -0
  109. package/workflows/powers/vercel-deployments/POWER.md +10 -90
  110. package/workflows/powers/vercel-deployments/SKILL.md +10 -90
  111. package/workflows/powers/vercel-domains/POWER.md +10 -69
  112. package/workflows/powers/vercel-domains/SKILL.md +10 -69
  113. package/workflows/powers/vercel-firewall/POWER.md +10 -61
  114. package/workflows/powers/vercel-firewall/SKILL.md +10 -61
  115. package/workflows/powers/vercel-flags/POWER.md +10 -62
  116. package/workflows/powers/vercel-flags/SKILL.md +10 -62
  117. package/workflows/powers/vercel-functions/POWER.md +10 -70
  118. package/workflows/powers/vercel-functions/SKILL.md +10 -70
  119. package/workflows/powers/vercel-routing/POWER.md +10 -68
  120. package/workflows/powers/vercel-routing/SKILL.md +10 -68
  121. package/workflows/powers/vercel-runtime/POWER.md +43 -0
  122. package/workflows/powers/vercel-runtime/SKILL.md +40 -0
  123. package/workflows/powers/vercel-security/POWER.md +43 -0
  124. package/workflows/powers/vercel-security/SKILL.md +40 -0
  125. package/workflows/powers/vulnerability-scanner/POWER.md +11 -266
  126. package/workflows/powers/vulnerability-scanner/SKILL.md +11 -266
  127. package/workflows/scripts/generate-powers.mjs +95 -202
  128. package/workflows/skills/atlassian-mcp/SKILL.md +11 -81
  129. package/workflows/skills/building-mcp-server-on-cloudflare/SKILL.md +12 -252
  130. package/workflows/skills/catalogs/core.json +30 -0
  131. package/workflows/skills/catalogs/web-backend.json +70 -0
  132. package/workflows/skills/csharp-pro/SKILL.md +40 -0
  133. package/workflows/skills/datadog-automation/SKILL.md +12 -229
  134. package/workflows/skills/github-automation/SKILL.md +12 -221
  135. package/workflows/skills/golang-pro/SKILL.md +38 -66
  136. package/workflows/skills/java-pro/SKILL.md +40 -0
  137. package/workflows/skills/javascript-pro/SKILL.md +37 -67
  138. package/workflows/skills/kotlin-pro/SKILL.md +40 -0
  139. package/workflows/skills/mcp-builder/SKILL.md +12 -170
  140. package/workflows/skills/mcp-developer/SKILL.md +11 -78
  141. package/workflows/skills/nextjs-developer/SKILL.md +41 -148
  142. package/workflows/skills/nextjs-react-expert/SKILL.md +5 -11
  143. package/workflows/skills/nodejs-best-practices/SKILL.md +33 -317
  144. package/workflows/skills/postman/SKILL.md +11 -233
  145. package/workflows/skills/python-pro/SKILL.md +38 -66
  146. package/workflows/skills/react-best-practices/SKILL.md +35 -118
  147. package/workflows/skills/react-expert/SKILL.md +38 -66
  148. package/workflows/skills/rust-pro/SKILL.md +36 -163
  149. package/workflows/skills/sentry-automation/SKILL.md +12 -226
  150. package/workflows/skills/skills_index.json +43 -57
  151. package/workflows/skills/typescript-pro/SKILL.md +43 -70
  152. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/backend-specialist.md +1 -1
  153. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/code-archaeologist.md +1 -1
  154. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/database-architect.md +1 -1
  155. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/debugger.md +1 -1
  156. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/devops-engineer.md +1 -1
  157. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/documentation-writer.md +1 -1
  158. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/explorer-agent.md +1 -1
  159. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/frontend-specialist.md +1 -1
  160. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/game-developer.md +1 -1
  161. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/mobile-developer.md +1 -1
  162. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/orchestrator.md +28 -400
  163. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/penetration-tester.md +1 -1
  164. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/performance-optimizer.md +1 -1
  165. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/product-manager.md +1 -1
  166. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/product-owner.md +1 -1
  167. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/project-planner.md +1 -1
  168. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/qa-automation-engineer.md +1 -1
  169. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/security-auditor.md +1 -1
  170. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/seo-specialist.md +1 -1
  171. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/test-engineer.md +1 -1
  172. package/workflows/workflows/agent-environment-setup/platforms/antigravity/agents/vercel-expert.md +1 -1
  173. package/workflows/workflows/agent-environment-setup/platforms/antigravity/rules/GEMINI.md +7 -6
  174. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/backend-specialist.md +1 -1
  175. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/code-archaeologist.md +1 -1
  176. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/database-architect.md +1 -1
  177. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/debugger.md +1 -1
  178. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/devops-engineer.md +1 -1
  179. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/documentation-writer.md +1 -1
  180. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/explorer-agent.md +1 -1
  181. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/frontend-specialist.md +1 -1
  182. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/game-developer.md +1 -1
  183. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/mobile-developer.md +1 -1
  184. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/orchestrator.md +28 -400
  185. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/penetration-tester.md +1 -1
  186. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/performance-optimizer.md +1 -1
  187. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/product-manager.md +1 -1
  188. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/product-owner.md +1 -1
  189. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/project-planner.md +1 -1
  190. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/qa-automation-engineer.md +1 -1
  191. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/security-auditor.md +1 -1
  192. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/seo-specialist.md +1 -1
  193. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/test-engineer.md +1 -1
  194. package/workflows/workflows/agent-environment-setup/platforms/codex/agents/vercel-expert.md +1 -1
  195. package/workflows/workflows/agent-environment-setup/platforms/codex/rules/AGENTS.md +7 -6
  196. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/backend-specialist.md +1 -1
  197. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/code-archaeologist.md +1 -1
  198. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/database-architect.md +1 -1
  199. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/debugger.md +1 -1
  200. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/devops-engineer.md +1 -1
  201. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/documentation-writer.md +1 -1
  202. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/explorer-agent.md +1 -1
  203. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/frontend-specialist.md +1 -1
  204. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/game-developer.md +1 -1
  205. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/mobile-developer.md +1 -1
  206. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/orchestrator.md +28 -400
  207. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/penetration-tester.md +1 -1
  208. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/performance-optimizer.md +1 -1
  209. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/product-manager.md +1 -1
  210. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/product-owner.md +1 -1
  211. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/project-planner.md +1 -1
  212. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/qa-automation-engineer.md +1 -1
  213. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/security-auditor.md +1 -1
  214. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/seo-specialist.md +1 -1
  215. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/test-engineer.md +1 -1
  216. package/workflows/workflows/agent-environment-setup/platforms/copilot/agents/vercel-expert.md +1 -1
  217. package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/AGENTS.md +7 -6
  218. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/csharp-pro/SKILL.md +40 -0
  219. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/golang-pro/SKILL.md +38 -66
  220. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/java-pro/SKILL.md +40 -0
  221. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/javascript-pro/SKILL.md +37 -67
  222. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/kotlin-pro/SKILL.md +40 -0
  223. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/nextjs-developer/SKILL.md +41 -148
  224. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/nextjs-react-expert/SKILL.md +6 -12
  225. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/nodejs-best-practices/SKILL.md +33 -317
  226. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/python-pro/SKILL.md +38 -66
  227. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/react-best-practices/SKILL.md +35 -118
  228. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/react-expert/SKILL.md +38 -66
  229. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/rust-pro/SKILL.md +36 -163
  230. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/skills_index.json +43 -57
  231. package/workflows/workflows/agent-environment-setup/platforms/copilot/skills/typescript-pro/SKILL.md +43 -70
  232. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/csharp-pro/SKILL.md +40 -0
  233. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/golang-pro/SKILL.md +38 -66
  234. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/java-pro/SKILL.md +40 -0
  235. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/javascript-pro/SKILL.md +37 -67
  236. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/kotlin-pro/SKILL.md +40 -0
  237. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/nextjs-developer/SKILL.md +41 -148
  238. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/nextjs-react-expert/SKILL.md +6 -12
  239. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/nodejs-best-practices/SKILL.md +33 -317
  240. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/python-pro/SKILL.md +38 -66
  241. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/react-best-practices/SKILL.md +35 -118
  242. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/react-expert/SKILL.md +38 -66
  243. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/rust-pro/SKILL.md +36 -163
  244. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/skills_index.json +43 -57
  245. package/workflows/workflows/agent-environment-setup/platforms/cursor/skills/typescript-pro/SKILL.md +43 -70
  246. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/csharp-pro/SKILL.md +40 -0
  247. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/golang-pro/SKILL.md +38 -66
  248. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/java-pro/SKILL.md +40 -0
  249. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/javascript-pro/SKILL.md +37 -67
  250. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/kotlin-pro/SKILL.md +40 -0
  251. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/nextjs-developer/SKILL.md +41 -148
  252. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/nextjs-react-expert/SKILL.md +6 -12
  253. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/nodejs-best-practices/SKILL.md +33 -317
  254. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/python-pro/SKILL.md +38 -66
  255. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/react-best-practices/SKILL.md +35 -118
  256. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/react-expert/SKILL.md +38 -66
  257. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/rust-pro/SKILL.md +36 -163
  258. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/skills_index.json +43 -57
  259. package/workflows/workflows/agent-environment-setup/platforms/windsurf/skills/typescript-pro/SKILL.md +43 -70
  260. package/workflows/workflows/agent-environment-setup/shared/agents/backend-specialist.md +1 -1
  261. package/workflows/workflows/agent-environment-setup/shared/agents/code-archaeologist.md +1 -1
  262. package/workflows/workflows/agent-environment-setup/shared/agents/database-architect.md +1 -1
  263. package/workflows/workflows/agent-environment-setup/shared/agents/debugger.md +1 -1
  264. package/workflows/workflows/agent-environment-setup/shared/agents/devops-engineer.md +1 -1
  265. package/workflows/workflows/agent-environment-setup/shared/agents/documentation-writer.md +1 -1
  266. package/workflows/workflows/agent-environment-setup/shared/agents/explorer-agent.md +1 -1
  267. package/workflows/workflows/agent-environment-setup/shared/agents/frontend-specialist.md +1 -1
  268. package/workflows/workflows/agent-environment-setup/shared/agents/game-developer.md +1 -1
  269. package/workflows/workflows/agent-environment-setup/shared/agents/mobile-developer.md +1 -1
  270. package/workflows/workflows/agent-environment-setup/shared/agents/orchestrator.md +28 -400
  271. package/workflows/workflows/agent-environment-setup/shared/agents/penetration-tester.md +1 -1
  272. package/workflows/workflows/agent-environment-setup/shared/agents/performance-optimizer.md +1 -1
  273. package/workflows/workflows/agent-environment-setup/shared/agents/product-manager.md +1 -1
  274. package/workflows/workflows/agent-environment-setup/shared/agents/product-owner.md +1 -1
  275. package/workflows/workflows/agent-environment-setup/shared/agents/project-planner.md +1 -1
  276. package/workflows/workflows/agent-environment-setup/shared/agents/qa-automation-engineer.md +1 -1
  277. package/workflows/workflows/agent-environment-setup/shared/agents/security-auditor.md +1 -1
  278. package/workflows/workflows/agent-environment-setup/shared/agents/seo-specialist.md +1 -1
  279. package/workflows/workflows/agent-environment-setup/shared/agents/test-engineer.md +1 -1
  280. package/workflows/workflows/agent-environment-setup/shared/agents/vercel-expert.md +1 -1
  281. package/workflows/powers/sub-agents/scripts/run_subagent.py.bak +0 -512
  282. /package/{workflows → mcp}/powers/atlassian-mcp/steering/authentication-patterns.md +0 -0
  283. /package/{workflows → mcp}/powers/atlassian-mcp/steering/common-workflows.md +0 -0
  284. /package/{workflows → mcp}/powers/atlassian-mcp/steering/confluence-operations.md +0 -0
  285. /package/{workflows → mcp}/powers/atlassian-mcp/steering/jira-queries.md +0 -0
  286. /package/{workflows → mcp}/powers/atlassian-mcp/steering/mcp-server-setup.md +0 -0
  287. /package/{workflows → mcp}/powers/building-mcp-server-on-cloudflare/steering/examples.md +0 -0
  288. /package/{workflows → mcp}/powers/building-mcp-server-on-cloudflare/steering/oauth-setup.md +0 -0
  289. /package/{workflows → mcp}/powers/building-mcp-server-on-cloudflare/steering/troubleshooting.md +0 -0
  290. /package/{workflows → mcp}/powers/mcp-builder/LICENSE.txt +0 -0
  291. /package/{workflows → mcp}/powers/mcp-builder/reference/evaluation.md +0 -0
  292. /package/{workflows → mcp}/powers/mcp-builder/reference/mcp_best_practices.md +0 -0
  293. /package/{workflows → mcp}/powers/mcp-builder/reference/node_mcp_server.md +0 -0
  294. /package/{workflows → mcp}/powers/mcp-builder/reference/python_mcp_server.md +0 -0
  295. /package/{workflows → mcp}/powers/mcp-builder/scripts/connections.py +0 -0
  296. /package/{workflows → mcp}/powers/mcp-builder/scripts/evaluation.py +0 -0
  297. /package/{workflows → mcp}/powers/mcp-builder/scripts/example_evaluation.xml +0 -0
  298. /package/{workflows → mcp}/powers/mcp-builder/scripts/requirements.txt +0 -0
  299. /package/{workflows → mcp}/powers/mcp-developer/steering/protocol.md +0 -0
  300. /package/{workflows → mcp}/powers/mcp-developer/steering/python-sdk.md +0 -0
  301. /package/{workflows → mcp}/powers/mcp-developer/steering/resources.md +0 -0
  302. /package/{workflows → mcp}/powers/mcp-developer/steering/tools.md +0 -0
  303. /package/{workflows → mcp}/powers/mcp-developer/steering/typescript-sdk.md +0 -0
  304. /package/{workflows → mcp}/powers/postman/flutter-expert/POWER.md +0 -0
  305. /package/{workflows → mcp}/powers/postman/flutter-expert/SKILL.md +0 -0
  306. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/bloc-state.md +0 -0
  307. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/engineering-principles.md +0 -0
  308. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/gorouter-navigation.md +0 -0
  309. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/performance.md +0 -0
  310. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/project-structure.md +0 -0
  311. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/riverpod-state.md +0 -0
  312. /package/{workflows → mcp}/powers/postman/flutter-expert/steering/widget-patterns.md +0 -0
  313. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/POWER.md +0 -0
  314. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/SKILL.md +0 -0
  315. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/steering/log_redaction.md +0 -0
  316. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/steering/network_hardening.md +0 -0
  317. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/steering/secret-scanning.md +0 -0
  318. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/steering/secure_storage_policy.md +0 -0
  319. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/steering/vulnerability-patterns.md +0 -0
  320. /package/{workflows → mcp}/powers/postman/flutter-security-reviewer/templates/security_review_response.md +0 -0
  321. /package/{workflows → mcp}/powers/postman/flutter-test-master/POWER.md +0 -0
  322. /package/{workflows → mcp}/powers/postman/flutter-test-master/SKILL.md +0 -0
  323. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/golden-testing.md +0 -0
  324. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/integration-testing.md +0 -0
  325. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/property-testing.md +0 -0
  326. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/riverpod-testing.md +0 -0
  327. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/test-utilities.md +0 -0
  328. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/unit-testing.md +0 -0
  329. /package/{workflows → mcp}/powers/postman/flutter-test-master/steering/widget-testing.md +0 -0
  330. /package/{workflows → mcp}/powers/postman/git-commit/POWER.md +0 -0
  331. /package/{workflows → mcp}/powers/postman/git-commit/SKILL.md +0 -0
  332. /package/{workflows → mcp}/powers/postman/gorouter-restoration/POWER.md +0 -0
  333. /package/{workflows → mcp}/powers/postman/gorouter-restoration/SKILL.md +0 -0
  334. /package/{workflows → mcp}/powers/postman/gorouter-restoration/steering/guard_patterns.md +0 -0
  335. /package/{workflows → mcp}/powers/postman/gorouter-restoration/steering/tab_preservation.md +0 -0
  336. /package/{workflows → mcp}/powers/postman/gorouter-restoration/templates/guard_redirect.md +0 -0
  337. /package/{workflows → mcp}/powers/postman/gorouter-restoration/templates/stateful_shell_skeleton.md +0 -0
  338. /package/{workflows → mcp}/powers/postman/mcp.json +0 -0
  339. /package/{workflows → mcp}/powers/postman/microservices-architect/POWER.md +0 -0
  340. /package/{workflows → mcp}/powers/postman/microservices-architect/SKILL.md +0 -0
  341. /package/{workflows → mcp}/powers/postman/microservices-architect/steering/communication.md +0 -0
  342. /package/{workflows → mcp}/powers/postman/microservices-architect/steering/data.md +0 -0
  343. /package/{workflows → mcp}/powers/postman/microservices-architect/steering/decomposition.md +0 -0
  344. /package/{workflows → mcp}/powers/postman/microservices-architect/steering/observability.md +0 -0
  345. /package/{workflows → mcp}/powers/postman/microservices-architect/steering/patterns.md +0 -0
  346. /package/{workflows → mcp}/powers/postman/nestjs-expert/POWER.md +0 -0
  347. /package/{workflows → mcp}/powers/postman/nestjs-expert/SKILL.md +0 -0
  348. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/authentication.md +0 -0
  349. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/controllers-routing.md +0 -0
  350. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/dtos-validation.md +0 -0
  351. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/migration-from-express.md +0 -0
  352. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/secure-sessions.md +0 -0
  353. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/services-di.md +0 -0
  354. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/strangler-fig-pattern.md +0 -0
  355. /package/{workflows → mcp}/powers/postman/nestjs-expert/steering/testing-patterns.md +0 -0
  356. /package/{workflows → mcp}/powers/postman/oneup-design/POWER.md +0 -0
  357. /package/{workflows → mcp}/powers/postman/oneup-design/SKILL.md +0 -0
  358. /package/{workflows → mcp}/powers/postman/oneup-design/steering/colors.md +0 -0
  359. /package/{workflows → mcp}/powers/postman/oneup-design/steering/components.md +0 -0
  360. /package/{workflows → mcp}/powers/postman/oneup-design/steering/spacing.md +0 -0
  361. /package/{workflows → mcp}/powers/postman/openapi-docs/POWER.md +0 -0
  362. /package/{workflows → mcp}/powers/postman/openapi-docs/SKILL.md +0 -0
  363. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/crud-templates.md +0 -0
  364. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/framework-express.md +0 -0
  365. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/framework-fastapi.md +0 -0
  366. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/framework-nestjs.md +0 -0
  367. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/framework-raw-openapi.md +0 -0
  368. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/openapi-checklist.md +0 -0
  369. /package/{workflows → mcp}/powers/postman/openapi-docs/steering/stoplight-ui.md +0 -0
  370. /package/{workflows → mcp}/powers/postman/steering/steering.md +0 -0
  371. /package/{workflows → mcp}/skills/atlassian-mcp/references/authentication-patterns.md +0 -0
  372. /package/{workflows → mcp}/skills/atlassian-mcp/references/common-workflows.md +0 -0
  373. /package/{workflows → mcp}/skills/atlassian-mcp/references/confluence-operations.md +0 -0
  374. /package/{workflows → mcp}/skills/atlassian-mcp/references/jira-queries.md +0 -0
  375. /package/{workflows → mcp}/skills/atlassian-mcp/references/mcp-server-setup.md +0 -0
  376. /package/{workflows → mcp}/skills/building-mcp-server-on-cloudflare/references/examples.md +0 -0
  377. /package/{workflows → mcp}/skills/building-mcp-server-on-cloudflare/references/oauth-setup.md +0 -0
  378. /package/{workflows → mcp}/skills/building-mcp-server-on-cloudflare/references/tool-patterns.md +0 -0
  379. /package/{workflows → mcp}/skills/building-mcp-server-on-cloudflare/references/troubleshooting.md +0 -0
  380. /package/{workflows → mcp}/skills/mcp-builder/LICENSE.txt +0 -0
  381. /package/{workflows → mcp}/skills/mcp-builder/reference/evaluation.md +0 -0
  382. /package/{workflows → mcp}/skills/mcp-builder/reference/mcp_best_practices.md +0 -0
  383. /package/{workflows → mcp}/skills/mcp-builder/reference/node_mcp_server.md +0 -0
  384. /package/{workflows → mcp}/skills/mcp-builder/reference/python_mcp_server.md +0 -0
  385. /package/{workflows → mcp}/skills/mcp-builder/scripts/connections.py +0 -0
  386. /package/{workflows → mcp}/skills/mcp-builder/scripts/evaluation.py +0 -0
  387. /package/{workflows → mcp}/skills/mcp-builder/scripts/example_evaluation.xml +0 -0
  388. /package/{workflows → mcp}/skills/mcp-builder/scripts/requirements.txt +0 -0
  389. /package/{workflows → mcp}/skills/mcp-developer/references/protocol.md +0 -0
  390. /package/{workflows → mcp}/skills/mcp-developer/references/python-sdk.md +0 -0
  391. /package/{workflows → mcp}/skills/mcp-developer/references/resources.md +0 -0
  392. /package/{workflows → mcp}/skills/mcp-developer/references/tools.md +0 -0
  393. /package/{workflows → mcp}/skills/mcp-developer/references/typescript-sdk.md +0 -0
  394. /package/{workflows → mcp}/skills/postman/POWER.md +0 -0
  395. /package/{workflows → mcp}/skills/postman/flutter-expert/POWER.md +0 -0
  396. /package/{workflows → mcp}/skills/postman/flutter-expert/SKILL.md +0 -0
  397. /package/{workflows → mcp}/skills/postman/flutter-expert/references/bloc-state.md +0 -0
  398. /package/{workflows → mcp}/skills/postman/flutter-expert/references/engineering-principles.md +0 -0
  399. /package/{workflows → mcp}/skills/postman/flutter-expert/references/gorouter-navigation.md +0 -0
  400. /package/{workflows → mcp}/skills/postman/flutter-expert/references/performance.md +0 -0
  401. /package/{workflows → mcp}/skills/postman/flutter-expert/references/project-structure.md +0 -0
  402. /package/{workflows → mcp}/skills/postman/flutter-expert/references/riverpod-state.md +0 -0
  403. /package/{workflows → mcp}/skills/postman/flutter-expert/references/widget-patterns.md +0 -0
  404. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/POWER.md +0 -0
  405. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/SKILL.md +0 -0
  406. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/references/log_redaction.md +0 -0
  407. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/references/network_hardening.md +0 -0
  408. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/references/secret-scanning.md +0 -0
  409. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/references/secure_storage_policy.md +0 -0
  410. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/references/vulnerability-patterns.md +0 -0
  411. /package/{workflows → mcp}/skills/postman/flutter-security-reviewer/templates/security_review_response.md +0 -0
  412. /package/{workflows → mcp}/skills/postman/flutter-test-master/POWER.md +0 -0
  413. /package/{workflows → mcp}/skills/postman/flutter-test-master/SKILL.md +0 -0
  414. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/golden-testing.md +0 -0
  415. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/integration-testing.md +0 -0
  416. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/property-testing.md +0 -0
  417. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/riverpod-testing.md +0 -0
  418. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/test-utilities.md +0 -0
  419. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/unit-testing.md +0 -0
  420. /package/{workflows → mcp}/skills/postman/flutter-test-master/references/widget-testing.md +0 -0
  421. /package/{workflows → mcp}/skills/postman/git-commit/POWER.md +0 -0
  422. /package/{workflows → mcp}/skills/postman/git-commit/SKILL.md +0 -0
  423. /package/{workflows → mcp}/skills/postman/gorouter-restoration/POWER.md +0 -0
  424. /package/{workflows → mcp}/skills/postman/gorouter-restoration/SKILL.md +0 -0
  425. /package/{workflows → mcp}/skills/postman/gorouter-restoration/references/guard_patterns.md +0 -0
  426. /package/{workflows → mcp}/skills/postman/gorouter-restoration/references/tab_preservation.md +0 -0
  427. /package/{workflows → mcp}/skills/postman/gorouter-restoration/templates/guard_redirect.md +0 -0
  428. /package/{workflows → mcp}/skills/postman/gorouter-restoration/templates/stateful_shell_skeleton.md +0 -0
  429. /package/{workflows → mcp}/skills/postman/mcp.json +0 -0
  430. /package/{workflows → mcp}/skills/postman/microservices-architect/POWER.md +0 -0
  431. /package/{workflows → mcp}/skills/postman/microservices-architect/SKILL.md +0 -0
  432. /package/{workflows → mcp}/skills/postman/microservices-architect/references/communication.md +0 -0
  433. /package/{workflows → mcp}/skills/postman/microservices-architect/references/data.md +0 -0
  434. /package/{workflows → mcp}/skills/postman/microservices-architect/references/decomposition.md +0 -0
  435. /package/{workflows → mcp}/skills/postman/microservices-architect/references/observability.md +0 -0
  436. /package/{workflows → mcp}/skills/postman/microservices-architect/references/patterns.md +0 -0
  437. /package/{workflows → mcp}/skills/postman/nestjs-expert/POWER.md +0 -0
  438. /package/{workflows → mcp}/skills/postman/nestjs-expert/SKILL.md +0 -0
  439. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/authentication.md +0 -0
  440. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/controllers-routing.md +0 -0
  441. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/dtos-validation.md +0 -0
  442. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/migration-from-express.md +0 -0
  443. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/secure-sessions.md +0 -0
  444. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/services-di.md +0 -0
  445. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/strangler-fig-pattern.md +0 -0
  446. /package/{workflows → mcp}/skills/postman/nestjs-expert/references/testing-patterns.md +0 -0
  447. /package/{workflows → mcp}/skills/postman/oneup-design/POWER.md +0 -0
  448. /package/{workflows → mcp}/skills/postman/oneup-design/SKILL.md +0 -0
  449. /package/{workflows → mcp}/skills/postman/oneup-design/references/colors.md +0 -0
  450. /package/{workflows → mcp}/skills/postman/oneup-design/references/components.md +0 -0
  451. /package/{workflows → mcp}/skills/postman/oneup-design/references/spacing.md +0 -0
  452. /package/{workflows → mcp}/skills/postman/openapi-docs/POWER.md +0 -0
  453. /package/{workflows → mcp}/skills/postman/openapi-docs/SKILL.md +0 -0
  454. /package/{workflows → mcp}/skills/postman/openapi-docs/references/crud-templates.md +0 -0
  455. /package/{workflows → mcp}/skills/postman/openapi-docs/references/framework-express.md +0 -0
  456. /package/{workflows → mcp}/skills/postman/openapi-docs/references/framework-fastapi.md +0 -0
  457. /package/{workflows → mcp}/skills/postman/openapi-docs/references/framework-nestjs.md +0 -0
  458. /package/{workflows → mcp}/skills/postman/openapi-docs/references/framework-raw-openapi.md +0 -0
  459. /package/{workflows → mcp}/skills/postman/openapi-docs/references/openapi-checklist.md +0 -0
  460. /package/{workflows → mcp}/skills/postman/openapi-docs/references/stoplight-ui.md +0 -0
  461. /package/{workflows → mcp}/skills/postman/references/steering.md +0 -0
@@ -1,512 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- run_subagent.py - Execute external CLI AIs as sub-agents
4
-
5
- Usage:
6
- scripts/run_subagent.py --agent <name> --prompt "<task>" --cwd <path>
7
- scripts/run_subagent.py --list
8
-
9
- Supported CLIs: claude, cursor-agent, codex, gemini
10
-
11
- Environment:
12
- SUB_AGENTS_DIR: Override default agents directory ({cwd}/.agents/)
13
- """
14
-
15
- import argparse
16
- import json
17
- import os
18
- import re
19
- import subprocess
20
- import sys
21
- from pathlib import Path
22
-
23
- # =============================================================================
24
- # Agent Loader - frontmatter parsing and system context extraction
25
- # =============================================================================
26
-
27
-
28
- def parse_frontmatter(content: str) -> tuple[dict, str]:
29
- """
30
- Parse YAML frontmatter from markdown content.
31
- Returns (frontmatter_dict, body_without_frontmatter)
32
- """
33
- pattern = r"^---\s*\n(.*?)\n---\s*\n(.*)$"
34
- match = re.match(pattern, content, re.DOTALL)
35
-
36
- if not match:
37
- return {}, content
38
-
39
- frontmatter_raw = match.group(1)
40
- body = match.group(2)
41
-
42
- # Simple YAML parsing (key: value only, no nested structures)
43
- frontmatter = {}
44
- for line in frontmatter_raw.split("\n"):
45
- line = line.strip()
46
- if ":" in line and not line.startswith("#"):
47
- key, value = line.split(":", 1)
48
- frontmatter[key.strip()] = value.strip().strip("\"'")
49
-
50
- return frontmatter, body
51
-
52
-
53
- def extract_description(body: str) -> str:
54
- """Extract description from first non-heading line of body."""
55
- for line in body.strip().split("\n"):
56
- line = line.strip()
57
- if line and not line.startswith("#"):
58
- return line[:100]
59
- return ""
60
-
61
-
62
- def load_agent(agents_dir: str, agent_name: str) -> tuple[str | None, str, str]:
63
- """
64
- Load agent definition file and extract run-agent setting.
65
- Returns (run_agent_cli, system_context, description)
66
- """
67
- agents_path = Path(agents_dir)
68
-
69
- # Try .md first, then .txt
70
- for ext in [".md", ".txt"]:
71
- agent_file = agents_path / f"{agent_name}{ext}"
72
- if agent_file.exists():
73
- content = agent_file.read_text(encoding="utf-8")
74
- frontmatter, body = parse_frontmatter(content)
75
-
76
- run_agent = frontmatter.get("run-agent")
77
- description = extract_description(body)
78
-
79
- return run_agent, body.strip(), description
80
-
81
- raise FileNotFoundError(f"Agent definition not found: {agent_name}")
82
-
83
-
84
- def list_agents(agents_dir: str) -> list[dict]:
85
- """
86
- List all available agents in the directory.
87
- Returns list of {"name": str, "description": str}
88
- """
89
- agents_path = Path(agents_dir)
90
- agents = []
91
- seen_names: set[str] = set()
92
-
93
- if not agents_path.exists():
94
- return agents
95
-
96
- for ext in [".md", ".txt"]:
97
- for agent_file in agents_path.glob(f"*{ext}"):
98
- name = agent_file.stem
99
- # Skip if already added (prefer .md over .txt)
100
- if name in seen_names:
101
- continue
102
- seen_names.add(name)
103
-
104
- try:
105
- content = agent_file.read_text(encoding="utf-8")
106
- _, body = parse_frontmatter(content)
107
- description = extract_description(body)
108
- agents.append({"name": name, "description": description})
109
- except Exception:
110
- agents.append({"name": name, "description": ""})
111
-
112
- return sorted(agents, key=lambda a: a["name"])
113
-
114
-
115
- def get_agents_dir(args_agents_dir: str | None, args_cwd: str | None) -> str:
116
- """
117
- Determine agents directory.
118
- Priority: --agents-dir > SUB_AGENTS_DIR > {cwd}/.agents/
119
- """
120
- if args_agents_dir:
121
- return args_agents_dir
122
-
123
- env_dir = os.environ.get("SUB_AGENTS_DIR")
124
- if env_dir:
125
- return env_dir
126
-
127
- if args_cwd:
128
- return str(Path(args_cwd) / ".agents")
129
-
130
- # Fallback for --list without --cwd
131
- return str(Path.cwd() / ".agents")
132
-
133
-
134
- # =============================================================================
135
- # CLI Resolver - determine which CLI to use
136
- # =============================================================================
137
-
138
-
139
- def detect_caller_cli() -> str | None:
140
- """
141
- Detect which CLI is calling this script based on environment.
142
- Returns: 'claude', 'cursor-agent', 'codex', 'gemini', or None
143
- """
144
- # Check common environment indicators
145
- if os.environ.get("CLAUDE_CODE"):
146
- return "claude"
147
- if os.environ.get("CURSOR_AGENT"):
148
- return "cursor-agent"
149
- if os.environ.get("CODEX_CLI"):
150
- return "codex"
151
- if os.environ.get("GEMINI_CLI"):
152
- return "gemini"
153
-
154
- # Check parent process name (best effort)
155
- try:
156
- ppid = os.getppid()
157
- cmdline_path = f"/proc/{ppid}/cmdline"
158
- if os.path.exists(cmdline_path):
159
- with open(cmdline_path) as f:
160
- cmdline = f.read().lower()
161
- if "claude" in cmdline:
162
- return "claude"
163
- if "cursor" in cmdline:
164
- return "cursor-agent"
165
- if "codex" in cmdline:
166
- return "codex"
167
- if "gemini" in cmdline:
168
- return "gemini"
169
- except Exception:
170
- pass
171
-
172
- return None
173
-
174
-
175
- def resolve_cli(frontmatter_cli: str | None, default: str = "codex") -> str:
176
- """
177
- Resolve which CLI to use.
178
- Priority: frontmatter > caller detection > default
179
- """
180
- if frontmatter_cli:
181
- valid_clis = {"claude", "cursor-agent", "codex", "gemini"}
182
- if frontmatter_cli in valid_clis:
183
- return frontmatter_cli
184
-
185
- detected = detect_caller_cli()
186
- if detected:
187
- return detected
188
-
189
- return default
190
-
191
-
192
- # =============================================================================
193
- # Stream Processor - parse CLI output
194
- # =============================================================================
195
-
196
-
197
- class StreamProcessor:
198
- """Process streaming JSON output from various CLIs."""
199
-
200
- def __init__(self):
201
- self.result_json = None
202
- self.gemini_parts = []
203
- self.codex_messages = []
204
- self.is_gemini = False
205
- self.is_codex = False
206
-
207
- def process_line(self, line: str) -> bool:
208
- """
209
- Process a line from CLI output.
210
- Returns True when result is ready, False to continue.
211
- """
212
- line = line.strip()
213
- if not line or self.result_json is not None:
214
- return False
215
-
216
- try:
217
- data = json.loads(line)
218
- except json.JSONDecodeError:
219
- return False
220
-
221
- # Detect Gemini format
222
- if data.get("type") == "init":
223
- self.is_gemini = True
224
- return False
225
-
226
- # Detect Codex format
227
- if data.get("type") == "thread.started":
228
- self.is_codex = True
229
- return False
230
-
231
- # Gemini: accumulate assistant messages
232
- if self.is_gemini and data.get("type") == "message" and data.get("role") == "assistant":
233
- content = data.get("content", "")
234
- if isinstance(content, str):
235
- self.gemini_parts.append(content)
236
- return False
237
-
238
- # Codex: accumulate agent_message items
239
- if self.is_codex and data.get("type") == "item.completed":
240
- item = data.get("item", {})
241
- if item.get("type") == "agent_message" and isinstance(item.get("text"), str):
242
- self.codex_messages.append(item["text"])
243
- return False
244
-
245
- # Codex: turn.completed signals end
246
- if self.is_codex and data.get("type") == "turn.completed":
247
- self.result_json = {
248
- "type": "result",
249
- "result": "\n".join(self.codex_messages),
250
- "status": "success",
251
- }
252
- return True
253
-
254
- # Result type signals completion
255
- if data.get("type") == "result":
256
- if self.is_gemini:
257
- self.result_json = {
258
- "type": "result",
259
- "result": "".join(self.gemini_parts),
260
- "status": data.get("status", "success"),
261
- }
262
- else:
263
- self.result_json = data
264
- return True
265
-
266
- # Fallback: first valid JSON without type field
267
- if "type" not in data:
268
- self.result_json = data
269
- return True
270
-
271
- return False
272
-
273
- def get_result(self):
274
- return self.result_json
275
-
276
-
277
- # =============================================================================
278
- # Agent Executor - run CLI and capture output
279
- # =============================================================================
280
-
281
-
282
- def build_command(cli: str, prompt: str) -> tuple[str, list]:
283
- """Build command and arguments for the specified CLI."""
284
-
285
- if cli == "codex":
286
- return "codex", ["exec", "--json", prompt]
287
-
288
- if cli == "claude":
289
- return "claude", ["--output-format", "stream-json", "--verbose", "-p", prompt]
290
-
291
- if cli == "gemini":
292
- return "gemini", ["--output-format", "stream-json", "-p", prompt]
293
-
294
- if cli == "cursor-agent":
295
- args = ["--output-format", "json", "-p", prompt]
296
- api_key = os.environ.get("CLI_API_KEY")
297
- if api_key:
298
- args.extend(["-a", api_key])
299
- return "cursor-agent", args
300
-
301
- raise ValueError(f"Unknown CLI: {cli}")
302
-
303
-
304
- def execute_agent(
305
- cli: str, system_context: str, prompt: str, cwd: str, timeout: int = 600000
306
- ) -> dict:
307
- """
308
- Execute agent CLI and return result.
309
-
310
- Returns: {
311
- "result": str,
312
- "exit_code": int,
313
- "status": "success" | "partial" | "error",
314
- "cli": str
315
- }
316
- """
317
- # Format prompt with system context
318
- formatted_prompt = f"[System Context]\n{system_context}\n\n[User Prompt]\n{prompt}"
319
-
320
- command, args = build_command(cli, formatted_prompt)
321
- timeout_sec = timeout / 1000
322
-
323
- try:
324
- process = subprocess.Popen(
325
- [command] + args,
326
- cwd=cwd,
327
- stdout=subprocess.PIPE,
328
- stderr=subprocess.PIPE,
329
- text=True,
330
- bufsize=1,
331
- )
332
-
333
- processor = StreamProcessor()
334
- stdout_lines = []
335
-
336
- try:
337
- # Read stdout line by line
338
- for line in iter(process.stdout.readline, ""):
339
- stdout_lines.append(line)
340
- if processor.process_line(line):
341
- process.terminate()
342
- break
343
-
344
- # Wait for process to finish
345
- try:
346
- _, stderr = process.communicate(timeout=timeout_sec)
347
- except subprocess.TimeoutExpired:
348
- process.kill()
349
- _, stderr = process.communicate()
350
-
351
- result = processor.get_result()
352
- return {
353
- "result": result.get("result", "") if result else "",
354
- "exit_code": 124,
355
- "status": "partial" if result else "error",
356
- "cli": cli,
357
- "error": f"Timeout after {timeout}ms",
358
- }
359
-
360
- result = processor.get_result()
361
- exit_code = process.returncode or 0
362
-
363
- # Determine status
364
- if exit_code == 0 or exit_code in (143, -15) and result:
365
- status = "success"
366
- elif result:
367
- status = "partial"
368
- else:
369
- status = "error"
370
-
371
- response = {
372
- "result": result.get("result", "") if result else "".join(stdout_lines),
373
- "exit_code": exit_code,
374
- "status": status,
375
- "cli": cli,
376
- }
377
- if status == "error":
378
- error_msg = f"CLI exited with code {exit_code}"
379
- if stderr and stderr.strip():
380
- error_msg += f": {stderr.strip()}"
381
- response["error"] = error_msg
382
- return response
383
-
384
- except Exception as e:
385
- process.kill()
386
- result = processor.get_result()
387
- return {
388
- "result": result.get("result", "") if result else "",
389
- "exit_code": 1,
390
- "status": "error",
391
- "cli": cli,
392
- "error": str(e),
393
- }
394
-
395
- except FileNotFoundError:
396
- return {
397
- "result": "",
398
- "exit_code": 127,
399
- "status": "error",
400
- "cli": cli,
401
- "error": f"CLI not found: {command}",
402
- }
403
- except Exception as e:
404
- return {"result": "", "exit_code": 1, "status": "error", "cli": cli, "error": str(e)}
405
-
406
-
407
- # =============================================================================
408
- # Main
409
- # =============================================================================
410
-
411
-
412
- def main():
413
- parser = argparse.ArgumentParser(description="Execute external CLI AIs as sub-agents")
414
- parser.add_argument("--list", action="store_true", help="List available agents")
415
- parser.add_argument("--agent", help="Agent definition name")
416
- parser.add_argument("--prompt", help="Task prompt")
417
- parser.add_argument("--cwd", help="Working directory (absolute path)")
418
- parser.add_argument("--agents-dir", help="Directory containing agent definitions")
419
- parser.add_argument(
420
- "--timeout", type=int, default=600000, help="Timeout in ms (default: 600000)"
421
- )
422
- parser.add_argument("--cli", help="Force specific CLI (claude, cursor-agent, codex, gemini)")
423
-
424
- args = parser.parse_args()
425
-
426
- # Handle --list
427
- if args.list:
428
- agents_dir = get_agents_dir(args.agents_dir, args.cwd)
429
- agents = list_agents(agents_dir)
430
- print(json.dumps({"agents": agents, "agents_dir": agents_dir}, ensure_ascii=False))
431
- sys.exit(0)
432
-
433
- # Validate required args for execution
434
- if not args.agent:
435
- print(
436
- json.dumps(
437
- {"result": "", "exit_code": 1, "status": "error", "error": "--agent is required"}
438
- )
439
- )
440
- sys.exit(1)
441
-
442
- if not args.prompt:
443
- print(
444
- json.dumps(
445
- {"result": "", "exit_code": 1, "status": "error", "error": "--prompt is required"}
446
- )
447
- )
448
- sys.exit(1)
449
-
450
- if not args.cwd:
451
- print(
452
- json.dumps(
453
- {"result": "", "exit_code": 1, "status": "error", "error": "--cwd is required"}
454
- )
455
- )
456
- sys.exit(1)
457
-
458
- # Validate cwd
459
- if not os.path.isabs(args.cwd):
460
- print(
461
- json.dumps(
462
- {
463
- "result": "",
464
- "exit_code": 1,
465
- "status": "error",
466
- "error": "cwd must be an absolute path",
467
- }
468
- )
469
- )
470
- sys.exit(1)
471
-
472
- if not os.path.isdir(args.cwd):
473
- print(
474
- json.dumps(
475
- {
476
- "result": "",
477
- "exit_code": 1,
478
- "status": "error",
479
- "error": f"cwd does not exist: {args.cwd}",
480
- }
481
- )
482
- )
483
- sys.exit(1)
484
-
485
- # Determine agents directory
486
- agents_dir = get_agents_dir(args.agents_dir, args.cwd)
487
-
488
- # Load agent definition
489
- try:
490
- run_agent_cli, system_context, _ = load_agent(agents_dir, args.agent)
491
- except FileNotFoundError as e:
492
- print(json.dumps({"result": "", "exit_code": 1, "status": "error", "error": str(e)}))
493
- sys.exit(1)
494
-
495
- # Resolve CLI
496
- cli = args.cli or resolve_cli(run_agent_cli)
497
-
498
- # Execute
499
- result = execute_agent(
500
- cli=cli,
501
- system_context=system_context,
502
- prompt=args.prompt,
503
- cwd=args.cwd,
504
- timeout=args.timeout,
505
- )
506
-
507
- print(json.dumps(result, ensure_ascii=False))
508
- sys.exit(0 if result["status"] == "success" else 1)
509
-
510
-
511
- if __name__ == "__main__":
512
- main()
File without changes