squadfoundry 0.1.0

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 (309) hide show
  1. package/AGENTS.md +76 -0
  2. package/PROJECT.md +79 -0
  3. package/README.md +255 -0
  4. package/dist/orchestrator/adapters/context/IContextAdapter.d.ts +65 -0
  5. package/dist/orchestrator/adapters/context/IContextAdapter.d.ts.map +1 -0
  6. package/dist/orchestrator/adapters/context/IContextAdapter.js +12 -0
  7. package/dist/orchestrator/adapters/context/IContextAdapter.js.map +1 -0
  8. package/dist/orchestrator/adapters/context/filesystem.context-adapter.d.ts +33 -0
  9. package/dist/orchestrator/adapters/context/filesystem.context-adapter.d.ts.map +1 -0
  10. package/dist/orchestrator/adapters/context/filesystem.context-adapter.js +179 -0
  11. package/dist/orchestrator/adapters/context/filesystem.context-adapter.js.map +1 -0
  12. package/dist/orchestrator/adapters/deploy/IDeployAdapter.d.ts +78 -0
  13. package/dist/orchestrator/adapters/deploy/IDeployAdapter.d.ts.map +1 -0
  14. package/dist/orchestrator/adapters/deploy/IDeployAdapter.js +14 -0
  15. package/dist/orchestrator/adapters/deploy/IDeployAdapter.js.map +1 -0
  16. package/dist/orchestrator/adapters/deploy/vercel.adapter.d.ts +31 -0
  17. package/dist/orchestrator/adapters/deploy/vercel.adapter.d.ts.map +1 -0
  18. package/dist/orchestrator/adapters/deploy/vercel.adapter.js +83 -0
  19. package/dist/orchestrator/adapters/deploy/vercel.adapter.js.map +1 -0
  20. package/dist/orchestrator/adapters/host/IHostAdapter.d.ts +89 -0
  21. package/dist/orchestrator/adapters/host/IHostAdapter.d.ts.map +1 -0
  22. package/dist/orchestrator/adapters/host/IHostAdapter.js +10 -0
  23. package/dist/orchestrator/adapters/host/IHostAdapter.js.map +1 -0
  24. package/dist/orchestrator/adapters/host/anthropic.adapter.d.ts +27 -0
  25. package/dist/orchestrator/adapters/host/anthropic.adapter.d.ts.map +1 -0
  26. package/dist/orchestrator/adapters/host/anthropic.adapter.js +118 -0
  27. package/dist/orchestrator/adapters/host/anthropic.adapter.js.map +1 -0
  28. package/dist/orchestrator/adapters/host/antigravity.adapter.d.ts +53 -0
  29. package/dist/orchestrator/adapters/host/antigravity.adapter.d.ts.map +1 -0
  30. package/dist/orchestrator/adapters/host/antigravity.adapter.js +148 -0
  31. package/dist/orchestrator/adapters/host/antigravity.adapter.js.map +1 -0
  32. package/dist/orchestrator/adapters/host/claude-code.adapter.d.ts +13 -0
  33. package/dist/orchestrator/adapters/host/claude-code.adapter.d.ts.map +1 -0
  34. package/dist/orchestrator/adapters/host/claude-code.adapter.js +27 -0
  35. package/dist/orchestrator/adapters/host/claude-code.adapter.js.map +1 -0
  36. package/dist/orchestrator/adapters/host/command-model-invoker.d.ts +8 -0
  37. package/dist/orchestrator/adapters/host/command-model-invoker.d.ts.map +1 -0
  38. package/dist/orchestrator/adapters/host/command-model-invoker.js +46 -0
  39. package/dist/orchestrator/adapters/host/command-model-invoker.js.map +1 -0
  40. package/dist/orchestrator/adapters/host/ide.adapter.d.ts +61 -0
  41. package/dist/orchestrator/adapters/host/ide.adapter.d.ts.map +1 -0
  42. package/dist/orchestrator/adapters/host/ide.adapter.js +173 -0
  43. package/dist/orchestrator/adapters/host/ide.adapter.js.map +1 -0
  44. package/dist/orchestrator/adapters/host/local.adapter.d.ts +26 -0
  45. package/dist/orchestrator/adapters/host/local.adapter.d.ts.map +1 -0
  46. package/dist/orchestrator/adapters/host/local.adapter.js +82 -0
  47. package/dist/orchestrator/adapters/host/local.adapter.js.map +1 -0
  48. package/dist/orchestrator/adapters/host/openai.adapter.d.ts +26 -0
  49. package/dist/orchestrator/adapters/host/openai.adapter.d.ts.map +1 -0
  50. package/dist/orchestrator/adapters/host/openai.adapter.js +77 -0
  51. package/dist/orchestrator/adapters/host/openai.adapter.js.map +1 -0
  52. package/dist/orchestrator/adapters/host/opencode.adapter.d.ts +13 -0
  53. package/dist/orchestrator/adapters/host/opencode.adapter.d.ts.map +1 -0
  54. package/dist/orchestrator/adapters/host/opencode.adapter.js +27 -0
  55. package/dist/orchestrator/adapters/host/opencode.adapter.js.map +1 -0
  56. package/dist/orchestrator/adapters/model/IModelAdapter.d.ts +68 -0
  57. package/dist/orchestrator/adapters/model/IModelAdapter.d.ts.map +1 -0
  58. package/dist/orchestrator/adapters/model/IModelAdapter.js +11 -0
  59. package/dist/orchestrator/adapters/model/IModelAdapter.js.map +1 -0
  60. package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.d.ts +93 -0
  61. package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.d.ts.map +1 -0
  62. package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.js +10 -0
  63. package/dist/orchestrator/adapters/publishing/ISocialMediaAdapter.js.map +1 -0
  64. package/dist/orchestrator/adapters/publishing/instagram.adapter.d.ts +34 -0
  65. package/dist/orchestrator/adapters/publishing/instagram.adapter.d.ts.map +1 -0
  66. package/dist/orchestrator/adapters/publishing/instagram.adapter.js +105 -0
  67. package/dist/orchestrator/adapters/publishing/instagram.adapter.js.map +1 -0
  68. package/dist/orchestrator/adapters/tools/IToolAdapter.d.ts +52 -0
  69. package/dist/orchestrator/adapters/tools/IToolAdapter.d.ts.map +1 -0
  70. package/dist/orchestrator/adapters/tools/IToolAdapter.js +10 -0
  71. package/dist/orchestrator/adapters/tools/IToolAdapter.js.map +1 -0
  72. package/dist/orchestrator/adapters/vcs/IVCSAdapter.d.ts +89 -0
  73. package/dist/orchestrator/adapters/vcs/IVCSAdapter.d.ts.map +1 -0
  74. package/dist/orchestrator/adapters/vcs/IVCSAdapter.js +11 -0
  75. package/dist/orchestrator/adapters/vcs/IVCSAdapter.js.map +1 -0
  76. package/dist/orchestrator/adapters/vcs/github.adapter.d.ts +36 -0
  77. package/dist/orchestrator/adapters/vcs/github.adapter.d.ts.map +1 -0
  78. package/dist/orchestrator/adapters/vcs/github.adapter.js +110 -0
  79. package/dist/orchestrator/adapters/vcs/github.adapter.js.map +1 -0
  80. package/dist/orchestrator/artifacts/artifact-store.d.ts +47 -0
  81. package/dist/orchestrator/artifacts/artifact-store.d.ts.map +1 -0
  82. package/dist/orchestrator/artifacts/artifact-store.js +135 -0
  83. package/dist/orchestrator/artifacts/artifact-store.js.map +1 -0
  84. package/dist/orchestrator/builder/domain-classifier.d.ts +24 -0
  85. package/dist/orchestrator/builder/domain-classifier.d.ts.map +1 -0
  86. package/dist/orchestrator/builder/domain-classifier.js +156 -0
  87. package/dist/orchestrator/builder/domain-classifier.js.map +1 -0
  88. package/dist/orchestrator/builder/interview-questions.d.ts +13 -0
  89. package/dist/orchestrator/builder/interview-questions.d.ts.map +1 -0
  90. package/dist/orchestrator/builder/interview-questions.js +127 -0
  91. package/dist/orchestrator/builder/interview-questions.js.map +1 -0
  92. package/dist/orchestrator/builder/squad-builder.d.ts +53 -0
  93. package/dist/orchestrator/builder/squad-builder.d.ts.map +1 -0
  94. package/dist/orchestrator/builder/squad-builder.js +107 -0
  95. package/dist/orchestrator/builder/squad-builder.js.map +1 -0
  96. package/dist/orchestrator/builder/squad-generator.d.ts +33 -0
  97. package/dist/orchestrator/builder/squad-generator.d.ts.map +1 -0
  98. package/dist/orchestrator/builder/squad-generator.js +360 -0
  99. package/dist/orchestrator/builder/squad-generator.js.map +1 -0
  100. package/dist/orchestrator/cli/index.d.ts +3 -0
  101. package/dist/orchestrator/cli/index.d.ts.map +1 -0
  102. package/dist/orchestrator/cli/index.js +8 -0
  103. package/dist/orchestrator/cli/index.js.map +1 -0
  104. package/dist/orchestrator/context/context-index.d.ts +48 -0
  105. package/dist/orchestrator/context/context-index.d.ts.map +1 -0
  106. package/dist/orchestrator/context/context-index.js +116 -0
  107. package/dist/orchestrator/context/context-index.js.map +1 -0
  108. package/dist/orchestrator/context/context-loader.d.ts +49 -0
  109. package/dist/orchestrator/context/context-loader.d.ts.map +1 -0
  110. package/dist/orchestrator/context/context-loader.js +111 -0
  111. package/dist/orchestrator/context/context-loader.js.map +1 -0
  112. package/dist/orchestrator/core/guardrails.d.ts +33 -0
  113. package/dist/orchestrator/core/guardrails.d.ts.map +1 -0
  114. package/dist/orchestrator/core/guardrails.js +272 -0
  115. package/dist/orchestrator/core/guardrails.js.map +1 -0
  116. package/dist/orchestrator/core/state-machine.d.ts +65 -0
  117. package/dist/orchestrator/core/state-machine.d.ts.map +1 -0
  118. package/dist/orchestrator/core/state-machine.js +227 -0
  119. package/dist/orchestrator/core/state-machine.js.map +1 -0
  120. package/dist/orchestrator/core/types.d.ts +364 -0
  121. package/dist/orchestrator/core/types.d.ts.map +1 -0
  122. package/dist/orchestrator/core/types.js +10 -0
  123. package/dist/orchestrator/core/types.js.map +1 -0
  124. package/dist/orchestrator/index.d.ts +75 -0
  125. package/dist/orchestrator/index.d.ts.map +1 -0
  126. package/dist/orchestrator/index.js +64 -0
  127. package/dist/orchestrator/index.js.map +1 -0
  128. package/dist/orchestrator/mcp/server.d.ts +35 -0
  129. package/dist/orchestrator/mcp/server.d.ts.map +1 -0
  130. package/dist/orchestrator/mcp/server.js +378 -0
  131. package/dist/orchestrator/mcp/server.js.map +1 -0
  132. package/dist/orchestrator/runtime/agent-dispatcher.d.ts +25 -0
  133. package/dist/orchestrator/runtime/agent-dispatcher.d.ts.map +1 -0
  134. package/dist/orchestrator/runtime/agent-dispatcher.js +82 -0
  135. package/dist/orchestrator/runtime/agent-dispatcher.js.map +1 -0
  136. package/dist/orchestrator/runtime/approval-gate.d.ts +55 -0
  137. package/dist/orchestrator/runtime/approval-gate.d.ts.map +1 -0
  138. package/dist/orchestrator/runtime/approval-gate.js +104 -0
  139. package/dist/orchestrator/runtime/approval-gate.js.map +1 -0
  140. package/dist/orchestrator/runtime/handoff-manager.d.ts +29 -0
  141. package/dist/orchestrator/runtime/handoff-manager.d.ts.map +1 -0
  142. package/dist/orchestrator/runtime/handoff-manager.js +80 -0
  143. package/dist/orchestrator/runtime/handoff-manager.js.map +1 -0
  144. package/dist/orchestrator/runtime/job-manager.d.ts +39 -0
  145. package/dist/orchestrator/runtime/job-manager.d.ts.map +1 -0
  146. package/dist/orchestrator/runtime/job-manager.js +132 -0
  147. package/dist/orchestrator/runtime/job-manager.js.map +1 -0
  148. package/dist/orchestrator/runtime/squad-runtime.d.ts +70 -0
  149. package/dist/orchestrator/runtime/squad-runtime.d.ts.map +1 -0
  150. package/dist/orchestrator/runtime/squad-runtime.js +249 -0
  151. package/dist/orchestrator/runtime/squad-runtime.js.map +1 -0
  152. package/dist/orchestrator/shell/cli.d.ts +4 -0
  153. package/dist/orchestrator/shell/cli.d.ts.map +1 -0
  154. package/dist/orchestrator/shell/cli.js +27 -0
  155. package/dist/orchestrator/shell/cli.js.map +1 -0
  156. package/dist/orchestrator/shell/commands/create.command.d.ts +3 -0
  157. package/dist/orchestrator/shell/commands/create.command.d.ts.map +1 -0
  158. package/dist/orchestrator/shell/commands/create.command.js +41 -0
  159. package/dist/orchestrator/shell/commands/create.command.js.map +1 -0
  160. package/dist/orchestrator/shell/commands/edit.command.d.ts +3 -0
  161. package/dist/orchestrator/shell/commands/edit.command.d.ts.map +1 -0
  162. package/dist/orchestrator/shell/commands/edit.command.js +49 -0
  163. package/dist/orchestrator/shell/commands/edit.command.js.map +1 -0
  164. package/dist/orchestrator/shell/commands/hosts.command.d.ts +3 -0
  165. package/dist/orchestrator/shell/commands/hosts.command.d.ts.map +1 -0
  166. package/dist/orchestrator/shell/commands/hosts.command.js +27 -0
  167. package/dist/orchestrator/shell/commands/hosts.command.js.map +1 -0
  168. package/dist/orchestrator/shell/commands/init.command.d.ts +3 -0
  169. package/dist/orchestrator/shell/commands/init.command.d.ts.map +1 -0
  170. package/dist/orchestrator/shell/commands/init.command.js +13 -0
  171. package/dist/orchestrator/shell/commands/init.command.js.map +1 -0
  172. package/dist/orchestrator/shell/commands/list.command.d.ts +3 -0
  173. package/dist/orchestrator/shell/commands/list.command.d.ts.map +1 -0
  174. package/dist/orchestrator/shell/commands/list.command.js +18 -0
  175. package/dist/orchestrator/shell/commands/list.command.js.map +1 -0
  176. package/dist/orchestrator/shell/commands/run.command.d.ts +3 -0
  177. package/dist/orchestrator/shell/commands/run.command.d.ts.map +1 -0
  178. package/dist/orchestrator/shell/commands/run.command.js +71 -0
  179. package/dist/orchestrator/shell/commands/run.command.js.map +1 -0
  180. package/dist/orchestrator/shell/commands/status.command.d.ts +3 -0
  181. package/dist/orchestrator/shell/commands/status.command.d.ts.map +1 -0
  182. package/dist/orchestrator/shell/commands/status.command.js +29 -0
  183. package/dist/orchestrator/shell/commands/status.command.js.map +1 -0
  184. package/dist/orchestrator/shell/services/active-host-detector.service.d.ts +25 -0
  185. package/dist/orchestrator/shell/services/active-host-detector.service.d.ts.map +1 -0
  186. package/dist/orchestrator/shell/services/active-host-detector.service.js +128 -0
  187. package/dist/orchestrator/shell/services/active-host-detector.service.js.map +1 -0
  188. package/dist/orchestrator/shell/services/host-resolution.service.d.ts +42 -0
  189. package/dist/orchestrator/shell/services/host-resolution.service.d.ts.map +1 -0
  190. package/dist/orchestrator/shell/services/host-resolution.service.js +108 -0
  191. package/dist/orchestrator/shell/services/host-resolution.service.js.map +1 -0
  192. package/dist/orchestrator/shell/services/host-runtime.service.d.ts +23 -0
  193. package/dist/orchestrator/shell/services/host-runtime.service.d.ts.map +1 -0
  194. package/dist/orchestrator/shell/services/host-runtime.service.js +167 -0
  195. package/dist/orchestrator/shell/services/host-runtime.service.js.map +1 -0
  196. package/dist/orchestrator/shell/services/interview-host-bridge.service.d.ts +14 -0
  197. package/dist/orchestrator/shell/services/interview-host-bridge.service.d.ts.map +1 -0
  198. package/dist/orchestrator/shell/services/interview-host-bridge.service.js +16 -0
  199. package/dist/orchestrator/shell/services/interview-host-bridge.service.js.map +1 -0
  200. package/dist/orchestrator/shell/services/job-execution.service.d.ts +22 -0
  201. package/dist/orchestrator/shell/services/job-execution.service.d.ts.map +1 -0
  202. package/dist/orchestrator/shell/services/job-execution.service.js +39 -0
  203. package/dist/orchestrator/shell/services/job-execution.service.js.map +1 -0
  204. package/dist/orchestrator/shell/services/project-bootstrap.service.d.ts +6 -0
  205. package/dist/orchestrator/shell/services/project-bootstrap.service.d.ts.map +1 -0
  206. package/dist/orchestrator/shell/services/project-bootstrap.service.js +111 -0
  207. package/dist/orchestrator/shell/services/project-bootstrap.service.js.map +1 -0
  208. package/dist/orchestrator/shell/services/squad-scaffold.service.d.ts +3 -0
  209. package/dist/orchestrator/shell/services/squad-scaffold.service.d.ts.map +1 -0
  210. package/dist/orchestrator/shell/services/squad-scaffold.service.js +30 -0
  211. package/dist/orchestrator/shell/services/squad-scaffold.service.js.map +1 -0
  212. package/dist/tests/integration/instagram-squad.test.d.ts +8 -0
  213. package/dist/tests/integration/instagram-squad.test.d.ts.map +1 -0
  214. package/dist/tests/integration/instagram-squad.test.js +187 -0
  215. package/dist/tests/integration/instagram-squad.test.js.map +1 -0
  216. package/dist/tests/integration/shell/cli-run-host-native.test.d.ts +2 -0
  217. package/dist/tests/integration/shell/cli-run-host-native.test.d.ts.map +1 -0
  218. package/dist/tests/integration/shell/cli-run-host-native.test.js +42 -0
  219. package/dist/tests/integration/shell/cli-run-host-native.test.js.map +1 -0
  220. package/dist/tests/integration/software-squad.test.d.ts +8 -0
  221. package/dist/tests/integration/software-squad.test.d.ts.map +1 -0
  222. package/dist/tests/integration/software-squad.test.js +207 -0
  223. package/dist/tests/integration/software-squad.test.js.map +1 -0
  224. package/dist/tests/unit/artifact-store.test.d.ts +2 -0
  225. package/dist/tests/unit/artifact-store.test.d.ts.map +1 -0
  226. package/dist/tests/unit/artifact-store.test.js +137 -0
  227. package/dist/tests/unit/artifact-store.test.js.map +1 -0
  228. package/dist/tests/unit/context-loader.test.d.ts +2 -0
  229. package/dist/tests/unit/context-loader.test.d.ts.map +1 -0
  230. package/dist/tests/unit/context-loader.test.js +109 -0
  231. package/dist/tests/unit/context-loader.test.js.map +1 -0
  232. package/dist/tests/unit/docs/host-native-docs.test.d.ts +2 -0
  233. package/dist/tests/unit/docs/host-native-docs.test.d.ts.map +1 -0
  234. package/dist/tests/unit/docs/host-native-docs.test.js +18 -0
  235. package/dist/tests/unit/docs/host-native-docs.test.js.map +1 -0
  236. package/dist/tests/unit/guardrails.test.d.ts +2 -0
  237. package/dist/tests/unit/guardrails.test.d.ts.map +1 -0
  238. package/dist/tests/unit/guardrails.test.js +202 -0
  239. package/dist/tests/unit/guardrails.test.js.map +1 -0
  240. package/dist/tests/unit/host/host-adapter-contract.test.d.ts +2 -0
  241. package/dist/tests/unit/host/host-adapter-contract.test.d.ts.map +1 -0
  242. package/dist/tests/unit/host/host-adapter-contract.test.js +53 -0
  243. package/dist/tests/unit/host/host-adapter-contract.test.js.map +1 -0
  244. package/dist/tests/unit/host/ide.adapter.test.d.ts +2 -0
  245. package/dist/tests/unit/host/ide.adapter.test.d.ts.map +1 -0
  246. package/dist/tests/unit/host/ide.adapter.test.js +17 -0
  247. package/dist/tests/unit/host/ide.adapter.test.js.map +1 -0
  248. package/dist/tests/unit/host/native-ide-adapters.test.d.ts +2 -0
  249. package/dist/tests/unit/host/native-ide-adapters.test.d.ts.map +1 -0
  250. package/dist/tests/unit/host/native-ide-adapters.test.js +26 -0
  251. package/dist/tests/unit/host/native-ide-adapters.test.js.map +1 -0
  252. package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.d.ts +2 -0
  253. package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.d.ts.map +1 -0
  254. package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.js +128 -0
  255. package/dist/tests/unit/runtime/squad-runtime-host-metadata.test.js.map +1 -0
  256. package/dist/tests/unit/shell/active-host-detector.test.d.ts +2 -0
  257. package/dist/tests/unit/shell/active-host-detector.test.d.ts.map +1 -0
  258. package/dist/tests/unit/shell/active-host-detector.test.js +85 -0
  259. package/dist/tests/unit/shell/active-host-detector.test.js.map +1 -0
  260. package/dist/tests/unit/shell/host-resolution.service.test.d.ts +2 -0
  261. package/dist/tests/unit/shell/host-resolution.service.test.d.ts.map +1 -0
  262. package/dist/tests/unit/shell/host-resolution.service.test.js +252 -0
  263. package/dist/tests/unit/shell/host-resolution.service.test.js.map +1 -0
  264. package/dist/tests/unit/shell/interview-host-bridge.test.d.ts +2 -0
  265. package/dist/tests/unit/shell/interview-host-bridge.test.d.ts.map +1 -0
  266. package/dist/tests/unit/shell/interview-host-bridge.test.js +58 -0
  267. package/dist/tests/unit/shell/interview-host-bridge.test.js.map +1 -0
  268. package/dist/tests/unit/shell/project-bootstrap.service.test.d.ts +2 -0
  269. package/dist/tests/unit/shell/project-bootstrap.service.test.d.ts.map +1 -0
  270. package/dist/tests/unit/shell/project-bootstrap.service.test.js +58 -0
  271. package/dist/tests/unit/shell/project-bootstrap.service.test.js.map +1 -0
  272. package/dist/tests/unit/shell/squad-scaffold.service.test.d.ts +2 -0
  273. package/dist/tests/unit/shell/squad-scaffold.service.test.d.ts.map +1 -0
  274. package/dist/tests/unit/shell/squad-scaffold.service.test.js +40 -0
  275. package/dist/tests/unit/shell/squad-scaffold.service.test.js.map +1 -0
  276. package/dist/tests/unit/squad-builder.test.d.ts +2 -0
  277. package/dist/tests/unit/squad-builder.test.d.ts.map +1 -0
  278. package/dist/tests/unit/squad-builder.test.js +126 -0
  279. package/dist/tests/unit/squad-builder.test.js.map +1 -0
  280. package/dist/tests/unit/state-machine.test.d.ts +2 -0
  281. package/dist/tests/unit/state-machine.test.d.ts.map +1 -0
  282. package/dist/tests/unit/state-machine.test.js +133 -0
  283. package/dist/tests/unit/state-machine.test.js.map +1 -0
  284. package/docs/architecture/overview.md +115 -0
  285. package/docs/development/adding-agents.md +75 -0
  286. package/docs/development/adding-hosts.md +104 -0
  287. package/docs/development/adding-integrations.md +83 -0
  288. package/docs/development/host-detection-and-resolution.md +59 -0
  289. package/docs/squads/how-to-create.md +85 -0
  290. package/docs/squads/how-to-execute.md +139 -0
  291. package/docs/superpowers/plans/2026-04-01-host-native-cli-shell-implementation.md +617 -0
  292. package/docs/superpowers/specs/2026-04-01-host-native-cli-shell-design.md +253 -0
  293. package/package.json +103 -0
  294. package/squads/examples/instagram-content/AGENTS.md +63 -0
  295. package/squads/examples/instagram-content/POLICIES.md +45 -0
  296. package/squads/examples/instagram-content/SQUAD.md +63 -0
  297. package/squads/examples/instagram-content/WORKFLOW.md +58 -0
  298. package/squads/examples/instagram-content/config/squad.json +474 -0
  299. package/squads/examples/software-development/AGENTS.md +88 -0
  300. package/squads/examples/software-development/POLICIES.md +44 -0
  301. package/squads/examples/software-development/SQUAD.md +65 -0
  302. package/squads/examples/software-development/WORKFLOW.md +78 -0
  303. package/squads/examples/software-development/config/squad.json +442 -0
  304. package/templates/AGENTS.md +46 -0
  305. package/templates/POLICIES.md +24 -0
  306. package/templates/PROJECT.md +52 -0
  307. package/templates/SQUAD.md +52 -0
  308. package/templates/TASKS.md +31 -0
  309. package/templates/WORKFLOW.md +35 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * SquadBuilder
3
+ *
4
+ * High-level orchestrator for the squad design interview.
5
+ * Coordinates: questions → answers → classification → generation → file output.
6
+ *
7
+ * SquadBuilder is designed to run in two modes:
8
+ * 1. Programmatic: call conductInterview(answers[]) with pre-filled answers
9
+ * 2. Interactive CLI: use with the CLI entrypoint which prompts the user
10
+ */
11
+ import { mkdirSync, writeFileSync } from 'node:fs';
12
+ import { join, dirname } from 'node:path';
13
+ import { INTERVIEW_QUESTIONS } from './interview-questions.js';
14
+ import { createDomainClassifier } from './domain-classifier.js';
15
+ import { createSquadGenerator } from './squad-generator.js';
16
+ import { ContextLoader } from '../context/context-loader.js';
17
+ export class SquadBuilder {
18
+ contextRootPath;
19
+ outputDir;
20
+ classifier;
21
+ generator;
22
+ constructor(options = {}) {
23
+ this.contextRootPath = options.contextRootPath ?? process.cwd();
24
+ this.outputDir = options.outputDir ?? process.cwd();
25
+ this.classifier = options.classifier ?? createDomainClassifier();
26
+ this.generator = options.generator ?? createSquadGenerator();
27
+ }
28
+ /**
29
+ * Return all interview questions (for display in CLI or agent conversation).
30
+ */
31
+ getQuestions() {
32
+ return INTERVIEW_QUESTIONS;
33
+ }
34
+ /**
35
+ * Conduct the interview programmatically with a pre-built answer set.
36
+ * Returns the squad build result without writing files.
37
+ */
38
+ conductInterview(answers) {
39
+ const classification = this.classifier.classify(answers);
40
+ return this.generator.generate(answers, classification);
41
+ }
42
+ /**
43
+ * Build a squad from answers and write all generated files to disk.
44
+ */
45
+ async build(answers) {
46
+ // Load existing context and add to answers if context files found
47
+ const contextLoader = new ContextLoader({ rootPath: this.contextRootPath });
48
+ const summary = await contextLoader.summarize();
49
+ const enrichedAnswers = [...answers];
50
+ if (summary.hasProjectMd) {
51
+ enrichedAnswers.push({
52
+ questionId: '_context_project_md',
53
+ answer: 'PROJECT.md found and loaded',
54
+ });
55
+ }
56
+ if (summary.hasTasksMd) {
57
+ enrichedAnswers.push({
58
+ questionId: '_context_tasks_md',
59
+ answer: 'TASKS.md found and loaded',
60
+ });
61
+ }
62
+ const result = this.conductInterview(enrichedAnswers);
63
+ // Write generated files to disk
64
+ for (const file of result.generatedFiles) {
65
+ const fullPath = join(this.outputDir, file.path);
66
+ mkdirSync(dirname(fullPath), { recursive: true });
67
+ writeFileSync(fullPath, file.content, 'utf-8');
68
+ console.log(`[SquadBuilder] Written: ${file.path}`);
69
+ }
70
+ return result;
71
+ }
72
+ /**
73
+ * Validate that all required questions have answers.
74
+ * Returns an array of missing question IDs.
75
+ */
76
+ validateAnswers(answers) {
77
+ const required = INTERVIEW_QUESTIONS.filter((q) => q.required);
78
+ const answeredIds = new Set(answers.map((a) => a.questionId));
79
+ return required
80
+ .filter((q) => !answeredIds.has(q.id) || !answers.find((a) => a.questionId === q.id)?.answer?.trim())
81
+ .map((q) => q.id);
82
+ }
83
+ /**
84
+ * Generate a formatted prompt string for the orquestrador to use
85
+ * when interviewing the user in an agent conversation context.
86
+ */
87
+ generateInterviewPrompt() {
88
+ const questions = INTERVIEW_QUESTIONS.filter((q) => q.required);
89
+ const lines = [
90
+ '# Squad Design Interview',
91
+ '',
92
+ 'I will ask you a series of questions to design your squad.',
93
+ 'Answer as completely as you can — I will fill in reasonable defaults where needed.',
94
+ '',
95
+ ...questions.flatMap((q, i) => [
96
+ `**${i + 1}. ${q.question}**`,
97
+ q.hint ? ` _Hint: ${q.hint}_` : '',
98
+ '',
99
+ ]),
100
+ ];
101
+ return lines.filter((l) => l !== null).join('\n');
102
+ }
103
+ }
104
+ export function createSquadBuilder(options) {
105
+ return new SquadBuilder(options);
106
+ }
107
+ //# sourceMappingURL=squad-builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"squad-builder.js","sourceRoot":"","sources":["../../../orchestrator/builder/squad-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAoB,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AACjF,OAAO,EAAkB,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAW5D,MAAM,OAAO,YAAY;IACf,eAAe,CAAQ;IACvB,SAAS,CAAQ;IACjB,UAAU,CAAkB;IAC5B,SAAS,CAAgB;IAEjC,YAAY,UAA+B,EAAE;QAC3C,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QAC/D,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QACnD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,sBAAsB,EAAE,CAAA;QAChE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,oBAAoB,EAAE,CAAA;IAC9D,CAAC;IAED;;OAEG;IACH,Y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C,CAAC,CAAC,EAAE;gBACpC,EAAE;aACH,CAAC;SACH,CAAA;QACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAAC,OAA6B;IAC9D,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * SquadGenerator
3
+ *
4
+ * Takes interview answers + classification result and generates:
5
+ * - A complete SquadDefinition (in-memory)
6
+ * - SQUAD.md
7
+ * - WORKFLOW.md
8
+ * - AGENTS.md
9
+ * - POLICIES.md
10
+ * - config/squad.json
11
+ *
12
+ * All generated files are returned as GeneratedFile[] — writing to disk
13
+ * is handled by SquadBuilder.
14
+ */
15
+ import type { InterviewAnswer, SquadBuildResult } from '../core/types.js';
16
+ import type { ClassificationResult } from './domain-classifier.js';
17
+ export declare class SquadGenerator {
18
+ generate(answers: InterviewAnswer[], classification: ClassificationResult): SquadBuildResult;
19
+ private buildAgents;
20
+ private buildWorkflow;
21
+ private buildPolicy;
22
+ private renderSquadMd;
23
+ private renderWorkflowMd;
24
+ private renderAgentsMd;
25
+ private renderPoliciesMd;
26
+ private toSlug;
27
+ private inferTools;
28
+ private inferGuardrailsForStep;
29
+ private buildExpectedArtifacts;
30
+ private buildIntegrations;
31
+ }
32
+ export declare function createSquadGenerator(): SquadGenerator;
33
+ //# sourceMappingURL=squad-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"squad-generator.d.ts","sourceRoot":"","sources":["../../../orchestrator/builder/squad-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAOV,eAAe,EAEf,gBAAgB,EAGjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAMlE,qBAAa,cAAc;IACzB,QAAQ,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,cAAc,EAAE,oBAAoB,GAAG,gBAAgB;IAwE5F,OAAO,CAAC,WAAW;IA6CnB,OAAO,CAAC,aAAa;IA2CrB,OAAO,CAAC,WAAW;IA6DnB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,cAAc;IA8BtB,OAAO,CAAC,gBAAgB;IA0BxB,OAAO,CAAC,MAAM;IAOd,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,sBAAsB;IAQ9B,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,iBAAiB;CAQ1B;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAErD"}
@@ -0,0 +1,360 @@
1
+ /**
2
+ * SquadGenerator
3
+ *
4
+ * Takes interview answers + classification result and generates:
5
+ * - A complete SquadDefinition (in-memory)
6
+ * - SQUAD.md
7
+ * - WORKFLOW.md
8
+ * - AGENTS.md
9
+ * - POLICIES.md
10
+ * - config/squad.json
11
+ *
12
+ * All generated files are returned as GeneratedFile[] — writing to disk
13
+ * is handled by SquadBuilder.
14
+ */
15
+ // ─────────────────────────────────────────────────────────────────────────────
16
+ // Generator
17
+ // ─────────────────────────────────────────────────────────────────────────────
18
+ export class SquadGenerator {
19
+ generate(answers, classification) {
20
+ const get = (id) => answers.find((a) => a.questionId === id)?.answer ?? '';
21
+ const squadId = this.toSlug(get('q_squad_name') || `squad-${Date.now()}`);
22
+ const now = new Date().toISOString();
23
+ const warnings = [...classification.notes];
24
+ // ── Build agents ─────────────────────────────────────────────────────────
25
+ const agents = this.buildAgents(classification.suggestedAgentRoles, classification.domain, get('q_tools'), get('q_prohibited'));
26
+ // ── Build workflow ───────────────────────────────────────────────────────
27
+ const stepsRaw = get('q_steps');
28
+ const approvalSteps = get('q_approvals').toLowerCase();
29
+ const workflow = this.buildWorkflow(agents, stepsRaw, approvalSteps, classification.suggestedWorkflowPattern);
30
+ // ── Build policy ──────────────────────────────────────────────────────────
31
+ const policy = this.buildPolicy(get('q_prohibited'), get('q_policies'), get('q_human_in_loop'), workflow.steps);
32
+ // ── Assemble squad ───────────────────────────────────────────────────────
33
+ const squad = {
34
+ id: squadId,
35
+ name: get('q_squad_name') || squadId,
36
+ domain: classification.domain,
37
+ objective: get('q_objective'),
38
+ description: get('q_description'),
39
+ context: `Generated from interview on ${now}`,
40
+ agents,
41
+ workflow,
42
+ policy,
43
+ expectedArtifacts: this.buildExpectedArtifacts(get('q_outputs'), agents),
44
+ allowedIntegrations: this.buildIntegrations(get('q_tools')),
45
+ templates: [],
46
+ successCriteria: [get('q_outputs') || 'All workflow steps completed successfully'],
47
+ failureCriteria: [`Any step fails. Risks: ${get('q_risks') || 'none specified'}`],
48
+ metadata: {
49
+ version: '1.0.0',
50
+ createdAt: now,
51
+ updatedAt: now,
52
+ tags: [classification.domain],
53
+ hostCompatibility: ['claude-code', 'opencode', 'cursor', 'codex', 'zed', 'any'],
54
+ },
55
+ };
56
+ // ── Generate files ───────────────────────────────────────────────────────
57
+ const generatedFiles = [
58
+ { path: `squads/${squadId}/SQUAD.md`, content: this.renderSquadMd(squad, answers), format: 'markdown' },
59
+ { path: `squads/${squadId}/WORKFLOW.md`, content: this.renderWorkflowMd(workflow, agents), format: 'markdown' },
60
+ { path: `squads/${squadId}/AGENTS.md`, content: this.renderAgentsMd(agents), format: 'markdown' },
61
+ { path: `squads/${squadId}/POLICIES.md`, content: this.renderPoliciesMd(policy), format: 'markdown' },
62
+ { path: `squads/${squadId}/config/squad.json`, content: JSON.stringify(squad, null, 2), format: 'json' },
63
+ ];
64
+ return { squadDefinition: squad, generatedFiles, warnings };
65
+ }
66
+ // ─── Agent builder ──────────────────────────────────────────────────────────
67
+ buildAgents(roles, domain, tools, prohibited) {
68
+ return roles.map((role, idx) => {
69
+ const id = this.toSlug(role);
70
+ const isLast = idx === roles.length - 1;
71
+ const nextRole = isLast ? null : roles[idx + 1];
72
+ const handoffRules = nextRole
73
+ ? [
74
+ {
75
+ condition: 'step_completed_successfully',
76
+ targetAgentId: this.toSlug(nextRole),
77
+ description: `Pass output to ${nextRole}`,
78
+ requiresApproval: role.toLowerCase().includes('approv'),
79
+ },
80
+ ]
81
+ : [];
82
+ return {
83
+ id,
84
+ name: role,
85
+ role,
86
+ domain,
87
+ objective: `Execute the '${role}' responsibilities in the squad workflow`,
88
+ instructions: `You are the ${role}. Complete your assigned step carefully and produce the expected outputs. Respect all squad policies and constraints.`,
89
+ inputs: [{ name: 'job_context', description: 'Current job context and previous step outputs', required: true }],
90
+ outputs: [{ name: 'step_output', description: `Output produced by ${role}`, required: true }],
91
+ allowedTools: this.inferTools(role, tools),
92
+ constraints: prohibited ? [prohibited] : [],
93
+ successCriteria: [`${role} task completed and output produced`],
94
+ failureCriteria: [`${role} was unable to produce required output`],
95
+ allowedStates: ['READY_FOR_EXECUTION', 'RUNNING_STEP'],
96
+ blockingConditions: [],
97
+ handoffRules,
98
+ responseFormat: 'markdown',
99
+ };
100
+ });
101
+ }
102
+ // ─── Workflow builder ───────────────────────────────────────────────────────
103
+ buildWorkflow(agents, stepsRaw, approvalSteps, _pattern) {
104
+ const steps = agents.map((agent, idx) => {
105
+ const prev = idx > 0 ? agents[idx - 1] : null;
106
+ const next = idx < agents.length - 1 ? agents[idx + 1] : null;
107
+ const needsApproval = approvalSteps.includes(agent.name.toLowerCase()) ||
108
+ approvalSteps.includes('publish') && agent.name.toLowerCase().includes('publish') ||
109
+ approvalSteps.includes('deploy') && agent.name.toLowerCase().includes('deploy');
110
+ return {
111
+ id: `step-${agent.id}`,
112
+ name: agent.name,
113
+ agentId: agent.id,
114
+ description: `Execute ${agent.name} responsibilities`,
115
+ dependsOn: prev ? [`step-${prev.id}`] : [],
116
+ guardrails: this.inferGuardrailsForStep(agent),
117
+ requiresApprovalBefore: needsApproval && agent.name.toLowerCase().includes('publish'),
118
+ requiresApprovalAfter: needsApproval && !agent.name.toLowerCase().includes('publish'),
119
+ requiredArtifacts: idx > 0 ? [`${agents[idx - 1]?.name ?? ''}-output`] : [],
120
+ producedArtifacts: [`${agent.name}-output`],
121
+ allowsLoop: agent.name.toLowerCase().includes('review'),
122
+ nextStepId: next ? `step-${next.id}` : undefined,
123
+ failureStepId: undefined,
124
+ };
125
+ });
126
+ const entryStep = steps[0];
127
+ return {
128
+ id: `workflow-${Date.now()}`,
129
+ name: 'Generated Workflow',
130
+ description: `Workflow generated from: ${stepsRaw || 'interview answers'}`,
131
+ steps,
132
+ entryStepId: entryStep?.id ?? 'step-0',
133
+ };
134
+ }
135
+ // ─── Policy builder ─────────────────────────────────────────────────────────
136
+ buildPolicy(prohibited, policies, humanInLoop, steps) {
137
+ const guardrails = [
138
+ {
139
+ id: 'grail-min-context',
140
+ name: 'Require Minimum Context',
141
+ description: 'At least PROJECT.md or README.md must be present',
142
+ severity: 'warn',
143
+ ruleKey: 'require_minimum_context',
144
+ params: { requiredFields: ['projectMd'] },
145
+ },
146
+ ];
147
+ // Add publish guardrail if any publish steps exist
148
+ const hasPublish = steps.some((s) => s.name.toLowerCase().includes('publish') || s.name.toLowerCase().includes('publisher'));
149
+ if (hasPublish) {
150
+ guardrails.push({
151
+ id: 'grail-approval-publish',
152
+ name: 'Require Approval Before Publish',
153
+ description: 'Human approval is required before any publishing action',
154
+ severity: 'block',
155
+ ruleKey: 'require_approval_before_publish',
156
+ });
157
+ }
158
+ // Add deploy guardrail if any deploy steps exist
159
+ const hasDeploy = steps.some((s) => s.name.toLowerCase().includes('deploy'));
160
+ if (hasDeploy) {
161
+ guardrails.push({
162
+ id: 'grail-human-deploy',
163
+ name: 'Require Human Before Deploy',
164
+ description: 'Deployments always require explicit human confirmation',
165
+ severity: 'block',
166
+ ruleKey: 'require_human_before_deploy',
167
+ });
168
+ }
169
+ const prohibitedList = prohibited
170
+ ? prohibited.split(/[,.\n]/).map((s) => s.trim()).filter(Boolean)
171
+ : [];
172
+ return {
173
+ id: 'policy-generated',
174
+ name: 'Generated Policy',
175
+ description: policies || 'Auto-generated policy from interview',
176
+ guardrails,
177
+ prohibitedActions: prohibitedList,
178
+ requiredApprovals: humanInLoop
179
+ ? [{ action: humanInLoop, description: `Human confirmation required: ${humanInLoop}` }]
180
+ : [],
181
+ };
182
+ }
183
+ // ─── Markdown renderers ────────────────────────────────────────────────────
184
+ renderSquadMd(squad, answers) {
185
+ const get = (id) => answers.find((a) => a.questionId === id)?.answer ?? '_not provided_';
186
+ return `# ${squad.name}
187
+
188
+ **ID:** \`${squad.id}\`
189
+ **Domain:** ${squad.domain}
190
+ **Version:** ${squad.metadata.version}
191
+ **Created:** ${squad.metadata.createdAt}
192
+
193
+ ## Objective
194
+
195
+ ${squad.objective}
196
+
197
+ ## Description
198
+
199
+ ${squad.description}
200
+
201
+ ## Agents
202
+
203
+ ${squad.agents.map((a) => `- **${a.name}** (\`${a.id}\`) — ${a.objective}`).join('\n')}
204
+
205
+ ## Inputs
206
+
207
+ ${get('q_inputs')}
208
+
209
+ ## Outputs
210
+
211
+ ${get('q_outputs')}
212
+
213
+ ## Success Criteria
214
+
215
+ ${squad.successCriteria.map((c) => `- ${c}`).join('\n')}
216
+
217
+ ## Failure Criteria
218
+
219
+ ${squad.failureCriteria.map((c) => `- ${c}`).join('\n')}
220
+
221
+ ## Host Compatibility
222
+
223
+ ${squad.metadata.hostCompatibility.join(', ')}
224
+
225
+ ---
226
+ _Generated by Squad Foundry Squad Builder_
227
+ `;
228
+ }
229
+ renderWorkflowMd(workflow, agents) {
230
+ return `# Workflow: ${workflow.name}
231
+
232
+ ${workflow.description}
233
+
234
+ ## Steps
235
+
236
+ ${workflow.steps
237
+ .map((step, i) => `### ${i + 1}. ${step.name}
238
+
239
+ - **Agent:** ${agents.find((a) => a.id === step.agentId)?.name ?? step.agentId}
240
+ - **Depends on:** ${step.dependsOn.length > 0 ? step.dependsOn.join(', ') : 'none'}
241
+ - **Approval before:** ${step.requiresApprovalBefore ? 'YES' : 'no'}
242
+ - **Approval after:** ${step.requiresApprovalAfter ? 'YES' : 'no'}
243
+ - **Produces:** ${step.producedArtifacts.join(', ') || 'none'}
244
+ - **Next step:** ${step.nextStepId ?? '_(end)_'}
245
+ `)
246
+ .join('\n')}
247
+
248
+ ---
249
+ _Generated by Squad Foundry Squad Builder_
250
+ `;
251
+ }
252
+ renderAgentsMd(agents) {
253
+ return `# Agents
254
+
255
+ ${agents
256
+ .map((a) => `## ${a.name}
257
+
258
+ **ID:** \`${a.id}\`
259
+ **Role:** ${a.role}
260
+ **Objective:** ${a.objective}
261
+ **Allowed Tools:** ${a.allowedTools.join(', ') || 'none'}
262
+ **Response Format:** ${a.responseFormat}
263
+
264
+ ### Instructions
265
+
266
+ ${a.instructions}
267
+
268
+ ### Handoff Rules
269
+
270
+ ${a.handoffRules.map((h) => `- On \`${h.condition}\` → **${h.targetAgentId}**${h.requiresApproval ? ' _(requires approval)_' : ''}`).join('\n') || '_(none)_'}
271
+
272
+ `)
273
+ .join('\n---\n\n')}
274
+
275
+ ---
276
+ _Generated by Squad Foundry Squad Builder_
277
+ `;
278
+ }
279
+ renderPoliciesMd(policy) {
280
+ return `# Policies
281
+
282
+ ## Overview
283
+
284
+ ${policy.description}
285
+
286
+ ## Guardrails
287
+
288
+ ${policy.guardrails.map((g) => `### ${g.name}\n- **Severity:** ${g.severity}\n- **Rule:** \`${g.ruleKey}\`\n- ${g.description}`).join('\n\n')}
289
+
290
+ ## Prohibited Actions
291
+
292
+ ${policy.prohibitedActions.length > 0 ? policy.prohibitedActions.map((a) => `- ${a}`).join('\n') : '_None specified_'}
293
+
294
+ ## Required Approvals
295
+
296
+ ${policy.requiredApprovals.length > 0 ? policy.requiredApprovals.map((a) => `- **${a.action}**: ${a.description}`).join('\n') : '_None specified_'}
297
+
298
+ ---
299
+ _Generated by Squad Foundry Squad Builder_
300
+ `;
301
+ }
302
+ // ─── Helpers ────────────────────────────────────────────────────────────────
303
+ toSlug(str) {
304
+ return str
305
+ .toLowerCase()
306
+ .replace(/[^a-z0-9]+/g, '-')
307
+ .replace(/^-|-$/g, '');
308
+ }
309
+ inferTools(role, toolsAnswer) {
310
+ const lower = role.toLowerCase() + ' ' + toolsAnswer.toLowerCase();
311
+ const tools = [];
312
+ if (lower.includes('github') || lower.includes('pr') || lower.includes('commit'))
313
+ tools.push('git', 'github');
314
+ if (lower.includes('deploy') || lower.includes('vercel'))
315
+ tools.push('deploy');
316
+ if (lower.includes('instagram') || lower.includes('publish'))
317
+ tools.push('social-media');
318
+ if (lower.includes('test'))
319
+ tools.push('test-runner');
320
+ if (lower.includes('search') || lower.includes('research'))
321
+ tools.push('web-search');
322
+ if (lower.includes('doc') || lower.includes('spec'))
323
+ tools.push('filesystem');
324
+ return tools;
325
+ }
326
+ inferGuardrailsForStep(agent) {
327
+ const roles = agent.role.toLowerCase();
328
+ const ids = [];
329
+ if (roles.includes('publish'))
330
+ ids.push('grail-approval-publish');
331
+ if (roles.includes('deploy'))
332
+ ids.push('grail-human-deploy');
333
+ return ids;
334
+ }
335
+ buildExpectedArtifacts(_outputs, agents) {
336
+ return agents.map((a, i) => ({
337
+ id: `artifact-${a.id}`,
338
+ name: `${a.name} Output`,
339
+ description: `Artifact produced by ${a.name}`,
340
+ path: `outputs/${a.id}-output.md`,
341
+ required: i === agents.length - 1,
342
+ format: 'markdown',
343
+ }));
344
+ }
345
+ buildIntegrations(tools) {
346
+ const lower = tools.toLowerCase();
347
+ const integrations = [];
348
+ if (lower.includes('github'))
349
+ integrations.push({ id: 'github', type: 'vcs', name: 'GitHub', required: false, status: 'stub' });
350
+ if (lower.includes('vercel'))
351
+ integrations.push({ id: 'vercel', type: 'deploy', name: 'Vercel', required: false, status: 'stub' });
352
+ if (lower.includes('instagram'))
353
+ integrations.push({ id: 'instagram', type: 'social-media', name: 'Instagram', required: false, status: 'stub' });
354
+ return integrations;
355
+ }
356
+ }
357
+ export function createSquadGenerator() {
358
+ return new SquadGenerator();
359
+ }
360
+ //# sourceMappingURL=squad-generator.js.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/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { runShellCli } from '../shell/cli.js';
3
+ void runShellCli(process.argv).catch((err) => {
4
+ const message = err instanceof Error ? err.message : String(err);
5
+ console.error(message);
6
+ process.exitCode = 1;
7
+ });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../orchestrator/cli/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,KAAK,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACpD,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAChE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACtB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ContextIndex
3
+ *
4
+ * In-memory index of loaded context files with fast lookup by category and path.
5
+ * Constructed from a LoadedContext object and provides query methods used
6
+ * by the Squad Builder (during squad generation) and Squad Runtime (during execution).
7
+ */
8
+ import type { LoadedContext, ContextFileCategory } from '../core/types.js';
9
+ export interface IndexedFile {
10
+ path: string;
11
+ category: ContextFileCategory;
12
+ content: string;
13
+ loadedAt: string;
14
+ sizeChars: number;
15
+ }
16
+ export declare class ContextIndex {
17
+ private files;
18
+ private projectMd;
19
+ private tasksMd;
20
+ private agentsMd;
21
+ private readmeMd;
22
+ constructor(ctx: LoadedContext);
23
+ private makeEntry;
24
+ private fromFileContent;
25
+ /** Get all indexed files */
26
+ all(): IndexedFile[];
27
+ /** Get files by category */
28
+ byCategory(category: ContextFileCategory): IndexedFile[];
29
+ /** Get a file by its path */
30
+ byPath(path: string): IndexedFile | undefined;
31
+ /** Get PROJECT.md content */
32
+ getProjectMd(): string | undefined;
33
+ /** Get TASKS.md content */
34
+ getTasksMd(): string | undefined;
35
+ /** Get AGENTS.md content */
36
+ getAgentsMd(): string | undefined;
37
+ /** Get README.md content */
38
+ getReadmeMd(): string | undefined;
39
+ /** Search all indexed content for a keyword */
40
+ search(keyword: string): IndexedFile[];
41
+ /** Return a compact stats object */
42
+ stats(): Record<string, number>;
43
+ /** Return whether any context was loaded */
44
+ isEmpty(): boolean;
45
+ /** Check whether core context files are present */
46
+ hasCoreContext(): boolean;
47
+ }
48
+ //# sourceMappingURL=context-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-index.d.ts","sourceRoot":"","sources":["../../../orchestrator/context/context-index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAe,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEvF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,mBAAmB,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,QAAQ,CAAoB;gBAExB,GAAG,EAAE,aAAa;IA6B9B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,eAAe;IAYvB,4BAA4B;IAC5B,GAAG,IAAI,WAAW,EAAE;IAIpB,4BAA4B;IAC5B,U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