@specforge/cli 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 (380) hide show
  1. package/README.md +781 -0
  2. package/bin/specforge +21 -0
  3. package/dist/channel.d.ts +27 -0
  4. package/dist/channel.d.ts.map +1 -0
  5. package/dist/channel.js +22 -0
  6. package/dist/channel.js.map +1 -0
  7. package/dist/cli/commands/configure.d.ts +16 -0
  8. package/dist/cli/commands/configure.d.ts.map +1 -0
  9. package/dist/cli/commands/configure.js +186 -0
  10. package/dist/cli/commands/configure.js.map +1 -0
  11. package/dist/cli/commands/configure.types.d.ts +110 -0
  12. package/dist/cli/commands/configure.types.d.ts.map +1 -0
  13. package/dist/cli/commands/configure.types.js +82 -0
  14. package/dist/cli/commands/configure.types.js.map +1 -0
  15. package/dist/cli/commands/debug/call.d.ts +14 -0
  16. package/dist/cli/commands/debug/call.d.ts.map +1 -0
  17. package/dist/cli/commands/debug/call.js +96 -0
  18. package/dist/cli/commands/debug/call.js.map +1 -0
  19. package/dist/cli/commands/debug/index.d.ts +12 -0
  20. package/dist/cli/commands/debug/index.d.ts.map +1 -0
  21. package/dist/cli/commands/debug/index.js +14 -0
  22. package/dist/cli/commands/debug/index.js.map +1 -0
  23. package/dist/cli/commands/debug/register.d.ts +11 -0
  24. package/dist/cli/commands/debug/register.d.ts.map +1 -0
  25. package/dist/cli/commands/debug/register.js +78 -0
  26. package/dist/cli/commands/debug/register.js.map +1 -0
  27. package/dist/cli/commands/debug/test.d.ts +13 -0
  28. package/dist/cli/commands/debug/test.d.ts.map +1 -0
  29. package/dist/cli/commands/debug/test.js +91 -0
  30. package/dist/cli/commands/debug/test.js.map +1 -0
  31. package/dist/cli/commands/debug/tools.d.ts +13 -0
  32. package/dist/cli/commands/debug/tools.d.ts.map +1 -0
  33. package/dist/cli/commands/debug/tools.js +86 -0
  34. package/dist/cli/commands/debug/tools.js.map +1 -0
  35. package/dist/cli/commands/debug/types.d.ts +119 -0
  36. package/dist/cli/commands/debug/types.d.ts.map +1 -0
  37. package/dist/cli/commands/debug/types.js +36 -0
  38. package/dist/cli/commands/debug/types.js.map +1 -0
  39. package/dist/cli/commands/debug/whoami.d.ts +13 -0
  40. package/dist/cli/commands/debug/whoami.d.ts.map +1 -0
  41. package/dist/cli/commands/debug/whoami.js +131 -0
  42. package/dist/cli/commands/debug/whoami.js.map +1 -0
  43. package/dist/cli/commands/doctor.d.ts +16 -0
  44. package/dist/cli/commands/doctor.d.ts.map +1 -0
  45. package/dist/cli/commands/doctor.js +413 -0
  46. package/dist/cli/commands/doctor.js.map +1 -0
  47. package/dist/cli/commands/doctor.types.d.ts +180 -0
  48. package/dist/cli/commands/doctor.types.d.ts.map +1 -0
  49. package/dist/cli/commands/doctor.types.js +140 -0
  50. package/dist/cli/commands/doctor.types.js.map +1 -0
  51. package/dist/cli/commands/feedback.d.ts +27 -0
  52. package/dist/cli/commands/feedback.d.ts.map +1 -0
  53. package/dist/cli/commands/feedback.js +262 -0
  54. package/dist/cli/commands/feedback.js.map +1 -0
  55. package/dist/cli/commands/feedback.types.d.ts +116 -0
  56. package/dist/cli/commands/feedback.types.d.ts.map +1 -0
  57. package/dist/cli/commands/feedback.types.js +65 -0
  58. package/dist/cli/commands/feedback.types.js.map +1 -0
  59. package/dist/cli/commands/index.d.ts +15 -0
  60. package/dist/cli/commands/index.d.ts.map +1 -0
  61. package/dist/cli/commands/index.js +21 -0
  62. package/dist/cli/commands/index.js.map +1 -0
  63. package/dist/cli/commands/init.d.ts +17 -0
  64. package/dist/cli/commands/init.d.ts.map +1 -0
  65. package/dist/cli/commands/init.js +773 -0
  66. package/dist/cli/commands/init.js.map +1 -0
  67. package/dist/cli/commands/init.types.d.ts +193 -0
  68. package/dist/cli/commands/init.types.d.ts.map +1 -0
  69. package/dist/cli/commands/init.types.js +29 -0
  70. package/dist/cli/commands/init.types.js.map +1 -0
  71. package/dist/cli/commands/invitations.d.ts +31 -0
  72. package/dist/cli/commands/invitations.d.ts.map +1 -0
  73. package/dist/cli/commands/invitations.js +250 -0
  74. package/dist/cli/commands/invitations.js.map +1 -0
  75. package/dist/cli/commands/login.d.ts +40 -0
  76. package/dist/cli/commands/login.d.ts.map +1 -0
  77. package/dist/cli/commands/login.js +139 -0
  78. package/dist/cli/commands/login.js.map +1 -0
  79. package/dist/cli/commands/members.d.ts +55 -0
  80. package/dist/cli/commands/members.d.ts.map +1 -0
  81. package/dist/cli/commands/members.js +296 -0
  82. package/dist/cli/commands/members.js.map +1 -0
  83. package/dist/cli/commands/scaffold/agent-types.d.ts +54 -0
  84. package/dist/cli/commands/scaffold/agent-types.d.ts.map +1 -0
  85. package/dist/cli/commands/scaffold/agent-types.js +22 -0
  86. package/dist/cli/commands/scaffold/agent-types.js.map +1 -0
  87. package/dist/cli/commands/scaffold/display.d.ts +56 -0
  88. package/dist/cli/commands/scaffold/display.d.ts.map +1 -0
  89. package/dist/cli/commands/scaffold/display.js +217 -0
  90. package/dist/cli/commands/scaffold/display.js.map +1 -0
  91. package/dist/cli/commands/scaffold/files.d.ts +99 -0
  92. package/dist/cli/commands/scaffold/files.d.ts.map +1 -0
  93. package/dist/cli/commands/scaffold/files.js +122 -0
  94. package/dist/cli/commands/scaffold/files.js.map +1 -0
  95. package/dist/cli/commands/scaffold/index.d.ts +13 -0
  96. package/dist/cli/commands/scaffold/index.d.ts.map +1 -0
  97. package/dist/cli/commands/scaffold/index.js +12 -0
  98. package/dist/cli/commands/scaffold/index.js.map +1 -0
  99. package/dist/cli/commands/scaffold/register.d.ts +11 -0
  100. package/dist/cli/commands/scaffold/register.d.ts.map +1 -0
  101. package/dist/cli/commands/scaffold/register.js +11 -0
  102. package/dist/cli/commands/scaffold/register.js.map +1 -0
  103. package/dist/cli/commands/scaffold/scaffold.d.ts +11 -0
  104. package/dist/cli/commands/scaffold/scaffold.d.ts.map +1 -0
  105. package/dist/cli/commands/scaffold/scaffold.js +728 -0
  106. package/dist/cli/commands/scaffold/scaffold.js.map +1 -0
  107. package/dist/cli/commands/scaffold/targets.d.ts +60 -0
  108. package/dist/cli/commands/scaffold/targets.d.ts.map +1 -0
  109. package/dist/cli/commands/scaffold/targets.js +251 -0
  110. package/dist/cli/commands/scaffold/targets.js.map +1 -0
  111. package/dist/cli/commands/scaffold/types.d.ts +170 -0
  112. package/dist/cli/commands/scaffold/types.d.ts.map +1 -0
  113. package/dist/cli/commands/scaffold/types.js +12 -0
  114. package/dist/cli/commands/scaffold/types.js.map +1 -0
  115. package/dist/cli/commands/scaffold/utils.d.ts +89 -0
  116. package/dist/cli/commands/scaffold/utils.d.ts.map +1 -0
  117. package/dist/cli/commands/scaffold/utils.js +401 -0
  118. package/dist/cli/commands/scaffold/utils.js.map +1 -0
  119. package/dist/cli/commands/status.d.ts +19 -0
  120. package/dist/cli/commands/status.d.ts.map +1 -0
  121. package/dist/cli/commands/status.js +124 -0
  122. package/dist/cli/commands/status.js.map +1 -0
  123. package/dist/cli/commands/status.types.d.ts +37 -0
  124. package/dist/cli/commands/status.types.d.ts.map +1 -0
  125. package/dist/cli/commands/status.types.js +7 -0
  126. package/dist/cli/commands/status.types.js.map +1 -0
  127. package/dist/cli/commands/switch.d.ts +18 -0
  128. package/dist/cli/commands/switch.d.ts.map +1 -0
  129. package/dist/cli/commands/switch.js +134 -0
  130. package/dist/cli/commands/switch.js.map +1 -0
  131. package/dist/cli/commands/switch.types.d.ts +123 -0
  132. package/dist/cli/commands/switch.types.d.ts.map +1 -0
  133. package/dist/cli/commands/switch.types.js +46 -0
  134. package/dist/cli/commands/switch.types.js.map +1 -0
  135. package/dist/cli/config/agent-teams.types.d.ts +120 -0
  136. package/dist/cli/config/agent-teams.types.d.ts.map +1 -0
  137. package/dist/cli/config/agent-teams.types.js +23 -0
  138. package/dist/cli/config/agent-teams.types.js.map +1 -0
  139. package/dist/cli/config/index.d.ts +13 -0
  140. package/dist/cli/config/index.d.ts.map +1 -0
  141. package/dist/cli/config/index.js +7 -0
  142. package/dist/cli/config/index.js.map +1 -0
  143. package/dist/cli/config/loader.d.ts +114 -0
  144. package/dist/cli/config/loader.d.ts.map +1 -0
  145. package/dist/cli/config/loader.js +198 -0
  146. package/dist/cli/config/loader.js.map +1 -0
  147. package/dist/cli/config/paths.d.ts +107 -0
  148. package/dist/cli/config/paths.d.ts.map +1 -0
  149. package/dist/cli/config/paths.js +79 -0
  150. package/dist/cli/config/paths.js.map +1 -0
  151. package/dist/cli/config/planning-sessions-registry.d.ts +52 -0
  152. package/dist/cli/config/planning-sessions-registry.d.ts.map +1 -0
  153. package/dist/cli/config/planning-sessions-registry.js +46 -0
  154. package/dist/cli/config/planning-sessions-registry.js.map +1 -0
  155. package/dist/cli/config/types.d.ts +186 -0
  156. package/dist/cli/config/types.d.ts.map +1 -0
  157. package/dist/cli/config/types.js +27 -0
  158. package/dist/cli/config/types.js.map +1 -0
  159. package/dist/cli/config/validation.d.ts +62 -0
  160. package/dist/cli/config/validation.d.ts.map +1 -0
  161. package/dist/cli/config/validation.js +133 -0
  162. package/dist/cli/config/validation.js.map +1 -0
  163. package/dist/cli/config/writer.d.ts +153 -0
  164. package/dist/cli/config/writer.d.ts.map +1 -0
  165. package/dist/cli/config/writer.js +168 -0
  166. package/dist/cli/config/writer.js.map +1 -0
  167. package/dist/cli/index.d.ts +30 -0
  168. package/dist/cli/index.d.ts.map +1 -0
  169. package/dist/cli/index.js +142 -0
  170. package/dist/cli/index.js.map +1 -0
  171. package/dist/cli/middleware/auth-guard.d.ts +107 -0
  172. package/dist/cli/middleware/auth-guard.d.ts.map +1 -0
  173. package/dist/cli/middleware/auth-guard.js +97 -0
  174. package/dist/cli/middleware/auth-guard.js.map +1 -0
  175. package/dist/cli/middleware/error-handler.d.ts +133 -0
  176. package/dist/cli/middleware/error-handler.d.ts.map +1 -0
  177. package/dist/cli/middleware/error-handler.js +139 -0
  178. package/dist/cli/middleware/error-handler.js.map +1 -0
  179. package/dist/cli/middleware/index.d.ts +6 -0
  180. package/dist/cli/middleware/index.d.ts.map +1 -0
  181. package/dist/cli/middleware/index.js +3 -0
  182. package/dist/cli/middleware/index.js.map +1 -0
  183. package/dist/cli/templates/agents/content/core/sfag-orchestrator.d.ts +9 -0
  184. package/dist/cli/templates/agents/content/core/sfag-orchestrator.d.ts.map +1 -0
  185. package/dist/cli/templates/agents/content/core/sfag-orchestrator.js +160 -0
  186. package/dist/cli/templates/agents/content/core/sfag-orchestrator.js.map +1 -0
  187. package/dist/cli/templates/agents/content/core/sfag-spec-creator.d.ts +9 -0
  188. package/dist/cli/templates/agents/content/core/sfag-spec-creator.d.ts.map +1 -0
  189. package/dist/cli/templates/agents/content/core/sfag-spec-creator.js +343 -0
  190. package/dist/cli/templates/agents/content/core/sfag-spec-creator.js.map +1 -0
  191. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.d.ts +9 -0
  192. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.d.ts.map +1 -0
  193. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.js +254 -0
  194. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.js.map +1 -0
  195. package/dist/cli/templates/agents/content/research/sfag-package-researcher.d.ts +8 -0
  196. package/dist/cli/templates/agents/content/research/sfag-package-researcher.d.ts.map +1 -0
  197. package/dist/cli/templates/agents/content/research/sfag-package-researcher.js +128 -0
  198. package/dist/cli/templates/agents/content/research/sfag-package-researcher.js.map +1 -0
  199. package/dist/cli/templates/agents/index.d.ts +23 -0
  200. package/dist/cli/templates/agents/index.d.ts.map +1 -0
  201. package/dist/cli/templates/agents/index.js +29 -0
  202. package/dist/cli/templates/agents/index.js.map +1 -0
  203. package/dist/cli/templates/commands.d.ts +17 -0
  204. package/dist/cli/templates/commands.d.ts.map +1 -0
  205. package/dist/cli/templates/commands.js +78 -0
  206. package/dist/cli/templates/commands.js.map +1 -0
  207. package/dist/cli/templates/content/sf-blockers.d.ts +7 -0
  208. package/dist/cli/templates/content/sf-blockers.d.ts.map +1 -0
  209. package/dist/cli/templates/content/sf-blockers.js +69 -0
  210. package/dist/cli/templates/content/sf-blockers.js.map +1 -0
  211. package/dist/cli/templates/content/sf-commit.d.ts +7 -0
  212. package/dist/cli/templates/content/sf-commit.d.ts.map +1 -0
  213. package/dist/cli/templates/content/sf-commit.js +79 -0
  214. package/dist/cli/templates/content/sf-commit.js.map +1 -0
  215. package/dist/cli/templates/content/sf-context.d.ts +7 -0
  216. package/dist/cli/templates/content/sf-context.d.ts.map +1 -0
  217. package/dist/cli/templates/content/sf-context.js +63 -0
  218. package/dist/cli/templates/content/sf-context.js.map +1 -0
  219. package/dist/cli/templates/content/sf-help.d.ts +7 -0
  220. package/dist/cli/templates/content/sf-help.d.ts.map +1 -0
  221. package/dist/cli/templates/content/sf-help.js +42 -0
  222. package/dist/cli/templates/content/sf-help.js.map +1 -0
  223. package/dist/cli/templates/content/sf-init.d.ts +7 -0
  224. package/dist/cli/templates/content/sf-init.d.ts.map +1 -0
  225. package/dist/cli/templates/content/sf-init.js +62 -0
  226. package/dist/cli/templates/content/sf-init.js.map +1 -0
  227. package/dist/cli/templates/content/sf-reset.d.ts +7 -0
  228. package/dist/cli/templates/content/sf-reset.d.ts.map +1 -0
  229. package/dist/cli/templates/content/sf-reset.js +67 -0
  230. package/dist/cli/templates/content/sf-reset.js.map +1 -0
  231. package/dist/cli/templates/content/sf-search.d.ts +7 -0
  232. package/dist/cli/templates/content/sf-search.d.ts.map +1 -0
  233. package/dist/cli/templates/content/sf-search.js +63 -0
  234. package/dist/cli/templates/content/sf-search.js.map +1 -0
  235. package/dist/cli/templates/content/sf-status.d.ts +7 -0
  236. package/dist/cli/templates/content/sf-status.d.ts.map +1 -0
  237. package/dist/cli/templates/content/sf-status.js +62 -0
  238. package/dist/cli/templates/content/sf-status.js.map +1 -0
  239. package/dist/cli/templates/index.d.ts +8 -0
  240. package/dist/cli/templates/index.d.ts.map +1 -0
  241. package/dist/cli/templates/index.js +17 -0
  242. package/dist/cli/templates/index.js.map +1 -0
  243. package/dist/cli/ui/banner.d.ts +38 -0
  244. package/dist/cli/ui/banner.d.ts.map +1 -0
  245. package/dist/cli/ui/banner.js +89 -0
  246. package/dist/cli/ui/banner.js.map +1 -0
  247. package/dist/cli/ui/colors.d.ts +76 -0
  248. package/dist/cli/ui/colors.d.ts.map +1 -0
  249. package/dist/cli/ui/colors.js +67 -0
  250. package/dist/cli/ui/colors.js.map +1 -0
  251. package/dist/cli/ui/index.d.ts +7 -0
  252. package/dist/cli/ui/index.d.ts.map +1 -0
  253. package/dist/cli/ui/index.js +4 -0
  254. package/dist/cli/ui/index.js.map +1 -0
  255. package/dist/cli/ui/output.d.ts +117 -0
  256. package/dist/cli/ui/output.d.ts.map +1 -0
  257. package/dist/cli/ui/output.js +83 -0
  258. package/dist/cli/ui/output.js.map +1 -0
  259. package/dist/cli/ui/spinner.d.ts +120 -0
  260. package/dist/cli/ui/spinner.d.ts.map +1 -0
  261. package/dist/cli/ui/spinner.js +158 -0
  262. package/dist/cli/ui/spinner.js.map +1 -0
  263. package/dist/cli/ui/time.d.ts +54 -0
  264. package/dist/cli/ui/time.d.ts.map +1 -0
  265. package/dist/cli/ui/time.js +119 -0
  266. package/dist/cli/ui/time.js.map +1 -0
  267. package/dist/client/api-client.d.ts +123 -0
  268. package/dist/client/api-client.d.ts.map +1 -0
  269. package/dist/client/api-client.js +105 -0
  270. package/dist/client/api-client.js.map +1 -0
  271. package/dist/client/cli-client.d.ts +26 -0
  272. package/dist/client/cli-client.d.ts.map +1 -0
  273. package/dist/client/cli-client.js +20 -0
  274. package/dist/client/cli-client.js.map +1 -0
  275. package/dist/config/index.d.ts +78 -0
  276. package/dist/config/index.d.ts.map +1 -0
  277. package/dist/config/index.js +79 -0
  278. package/dist/config/index.js.map +1 -0
  279. package/dist/index.d.ts +16 -0
  280. package/dist/index.d.ts.map +1 -0
  281. package/dist/index.js +73 -0
  282. package/dist/index.js.map +1 -0
  283. package/dist/lib/format.d.ts +126 -0
  284. package/dist/lib/format.d.ts.map +1 -0
  285. package/dist/lib/format.js +71 -0
  286. package/dist/lib/format.js.map +1 -0
  287. package/dist/lib/index.d.ts +11 -0
  288. package/dist/lib/index.d.ts.map +1 -0
  289. package/dist/lib/index.js +45 -0
  290. package/dist/lib/index.js.map +1 -0
  291. package/dist/lib/monorepo-detector.d.ts +31 -0
  292. package/dist/lib/monorepo-detector.d.ts.map +1 -0
  293. package/dist/lib/monorepo-detector.js +188 -0
  294. package/dist/lib/monorepo-detector.js.map +1 -0
  295. package/dist/lib/prompt-generator.d.ts +65 -0
  296. package/dist/lib/prompt-generator.d.ts.map +1 -0
  297. package/dist/lib/prompt-generator.js +162 -0
  298. package/dist/lib/prompt-generator.js.map +1 -0
  299. package/dist/lib/strategy-analyzer.d.ts +59 -0
  300. package/dist/lib/strategy-analyzer.d.ts.map +1 -0
  301. package/dist/lib/strategy-analyzer.js +91 -0
  302. package/dist/lib/strategy-analyzer.js.map +1 -0
  303. package/dist/lib/workflow-definitions.d.ts +41 -0
  304. package/dist/lib/workflow-definitions.d.ts.map +1 -0
  305. package/dist/lib/workflow-definitions.js +497 -0
  306. package/dist/lib/workflow-definitions.js.map +1 -0
  307. package/dist/patterns/index.d.ts +9 -0
  308. package/dist/patterns/index.d.ts.map +1 -0
  309. package/dist/patterns/index.js +21 -0
  310. package/dist/patterns/index.js.map +1 -0
  311. package/dist/patterns/inheritance.d.ts +193 -0
  312. package/dist/patterns/inheritance.d.ts.map +1 -0
  313. package/dist/patterns/inheritance.js +125 -0
  314. package/dist/patterns/inheritance.js.map +1 -0
  315. package/dist/server.d.ts +44 -0
  316. package/dist/server.d.ts.map +1 -0
  317. package/dist/server.js +91 -0
  318. package/dist/server.js.map +1 -0
  319. package/dist/tools/core/context-helper.d.ts +50 -0
  320. package/dist/tools/core/context-helper.d.ts.map +1 -0
  321. package/dist/tools/core/context-helper.js +49 -0
  322. package/dist/tools/core/context-helper.js.map +1 -0
  323. package/dist/tools/core/index.d.ts +2 -0
  324. package/dist/tools/core/index.d.ts.map +1 -0
  325. package/dist/tools/core/index.js +2 -0
  326. package/dist/tools/core/index.js.map +1 -0
  327. package/dist/tools/index.d.ts +58 -0
  328. package/dist/tools/index.d.ts.map +1 -0
  329. package/dist/tools/index.js +1499 -0
  330. package/dist/tools/index.js.map +1 -0
  331. package/dist/transport/__tests__/resolve-endpoint.test.d.ts +6 -0
  332. package/dist/transport/__tests__/resolve-endpoint.test.d.ts.map +1 -0
  333. package/dist/transport/index.d.ts +6 -0
  334. package/dist/transport/index.d.ts.map +1 -0
  335. package/dist/transport/index.js +5 -0
  336. package/dist/transport/index.js.map +1 -0
  337. package/dist/transport/interface.d.ts +25 -0
  338. package/dist/transport/interface.d.ts.map +1 -0
  339. package/dist/transport/interface.js +1 -0
  340. package/dist/transport/interface.js.map +1 -0
  341. package/dist/transport/remote.d.ts +38 -0
  342. package/dist/transport/remote.d.ts.map +1 -0
  343. package/dist/transport/remote.js +107 -0
  344. package/dist/transport/remote.js.map +1 -0
  345. package/dist/transport/resolve-endpoint.d.ts +58 -0
  346. package/dist/transport/resolve-endpoint.d.ts.map +1 -0
  347. package/dist/transport/resolve-endpoint.js +146 -0
  348. package/dist/transport/resolve-endpoint.js.map +1 -0
  349. package/dist/types/index.d.ts +212 -0
  350. package/dist/types/index.d.ts.map +1 -0
  351. package/dist/types/index.js +16 -0
  352. package/dist/types/index.js.map +1 -0
  353. package/dist/validation/index.d.ts +86 -0
  354. package/dist/validation/index.d.ts.map +1 -0
  355. package/dist/validation/index.js +392 -0
  356. package/dist/validation/index.js.map +1 -0
  357. package/dist/validation/ticket-validation.d.ts +162 -0
  358. package/dist/validation/ticket-validation.d.ts.map +1 -0
  359. package/dist/validation/ticket-validation.js +188 -0
  360. package/dist/validation/ticket-validation.js.map +1 -0
  361. package/package.json +69 -0
  362. package/src/cli/templates/agents/content/core/sfag-orchestrator.ts +165 -0
  363. package/src/cli/templates/agents/content/core/sfag-spec-creator.ts +348 -0
  364. package/src/cli/templates/agents/content/core/sfag-ticket-implementer.ts +259 -0
  365. package/src/cli/templates/agents/content/research/sfag-package-researcher.ts +132 -0
  366. package/src/cli/templates/agents/index.ts +47 -0
  367. package/src/cli/templates/commands.ts +90 -0
  368. package/src/cli/templates/content/sf-blockers.ts +71 -0
  369. package/src/cli/templates/content/sf-commit.ts +81 -0
  370. package/src/cli/templates/content/sf-context.ts +65 -0
  371. package/src/cli/templates/content/sf-help.ts +44 -0
  372. package/src/cli/templates/content/sf-init.ts +64 -0
  373. package/src/cli/templates/content/sf-reset.ts +69 -0
  374. package/src/cli/templates/content/sf-search.ts +65 -0
  375. package/src/cli/templates/content/sf-status.ts +64 -0
  376. package/src/cli/templates/index.ts +16 -0
  377. package/src/cli/templates/skills/specforge-conventions.md +114 -0
  378. package/src/cli/templates/skills/specforge-orchestrator.md +409 -0
  379. package/src/cli/templates/skills/specforge-validator.md +128 -0
  380. package/src/cli/templates/skills/specforge-worker.md +412 -0
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Auth Guard Middleware
3
+ *
4
+ * Checks for valid API key authentication before executing protected commands.
5
+ * Provides helpful error messages directing users to authenticate.
6
+ */
7
+ /**
8
+ * Check if a command requires authentication
9
+ *
10
+ * @param command - Command name or flag to check
11
+ * @returns true if command requires authentication
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * requiresAuth('status'); // true
16
+ * requiresAuth('login'); // false
17
+ * requiresAuth('--help'); // false
18
+ * ```
19
+ */
20
+ export declare function requiresAuth(command: string): boolean;
21
+ /**
22
+ * Get the list of public commands
23
+ *
24
+ * @returns Array of command names that don't require auth
25
+ */
26
+ export declare function getPublicCommands(): string[];
27
+ /**
28
+ * Add a command to the public (no-auth-required) list
29
+ *
30
+ * Useful for plugins or extensions that add unauthenticated commands.
31
+ *
32
+ * @param command - Command name to add
33
+ */
34
+ export declare function addPublicCommand(command: string): void;
35
+ /**
36
+ * Authentication guard - checks auth and exits if not authenticated
37
+ *
38
+ * Call this at the start of protected command handlers.
39
+ * Exits the process with code 1 if not authenticated.
40
+ *
41
+ * @param command - Command name being executed (for logging)
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * // In a command handler
46
+ * export function statusCommand() {
47
+ * authGuard('status');
48
+ * // ... rest of command (only runs if authenticated)
49
+ * }
50
+ * ```
51
+ */
52
+ export declare function authGuard(command: string): void;
53
+ /**
54
+ * Check authentication without exiting
55
+ *
56
+ * Use this for conditional logic where you don't want to exit.
57
+ *
58
+ * @returns Object with auth status and config
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const { authenticated, config } = checkAuth();
63
+ * if (!authenticated) {
64
+ * // Handle gracefully without exiting
65
+ * }
66
+ * ```
67
+ */
68
+ export declare function checkAuth(): {
69
+ authenticated: boolean;
70
+ apiKeySource: 'env' | 'global' | null;
71
+ };
72
+ /**
73
+ * Validate API key format
74
+ *
75
+ * Checks that the API key matches expected format without making API calls.
76
+ *
77
+ * @param apiKey - API key to validate
78
+ * @returns Object with validity and any error message
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const { valid, error } = validateApiKeyFormat('sf_live_abc123');
83
+ * if (!valid) {
84
+ * console.error(error);
85
+ * }
86
+ * ```
87
+ */
88
+ export declare function validateApiKeyFormat(apiKey: string): {
89
+ valid: boolean;
90
+ error?: string;
91
+ };
92
+ /**
93
+ * Commander.js pre-action hook for auth guard
94
+ *
95
+ * Use this with Commander's hook system for automatic auth checking.
96
+ *
97
+ * @param thisCommand - Commander command object
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * program.hook('preAction', authGuardHook);
102
+ * ```
103
+ */
104
+ export declare function authGuardHook(thisCommand: {
105
+ name: () => string;
106
+ }): void;
107
+ //# sourceMappingURL=auth-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-guard.d.ts","sourceRoot":"","sources":["../../../src/cli/middleware/auth-guard.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6BH;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAc/C;AA8BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,IAAI;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC;CACvC,CAOA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CA2BA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,MAAM,CAAA;CAAE,GAAG,IAAI,CAGvE"}
@@ -0,0 +1,97 @@
1
+ import chalk from "chalk";
2
+ import { isAuthenticated, resolveConfig } from "../config/loader.js";
3
+ const PUBLIC_COMMANDS = /* @__PURE__ */ new Set([
4
+ "login",
5
+ "help",
6
+ "--help",
7
+ "-h",
8
+ "version",
9
+ "--version",
10
+ "-v",
11
+ "doctor",
12
+ "tools",
13
+ "docs"
14
+ ]);
15
+ function requiresAuth(command) {
16
+ return !PUBLIC_COMMANDS.has(command);
17
+ }
18
+ function getPublicCommands() {
19
+ return Array.from(PUBLIC_COMMANDS);
20
+ }
21
+ function addPublicCommand(command) {
22
+ PUBLIC_COMMANDS.add(command);
23
+ }
24
+ function authGuard(command) {
25
+ if (!requiresAuth(command)) {
26
+ return;
27
+ }
28
+ if (isAuthenticated()) {
29
+ return;
30
+ }
31
+ printAuthError();
32
+ process.exit(1);
33
+ }
34
+ function printAuthError() {
35
+ console.error(chalk.red("Error: Not authenticated.\n"));
36
+ console.error(
37
+ "You need to authenticate before running this command.\n"
38
+ );
39
+ console.error(chalk.bold("To authenticate:"));
40
+ console.error(
41
+ ` ${chalk.cyan("specforge login")} - Interactive login
42
+ `
43
+ );
44
+ console.error(chalk.bold("Or set environment variable:"));
45
+ console.error(
46
+ ` ${chalk.cyan("export SPECFORGE_API_KEY=sf_live_your_key")}
47
+ `
48
+ );
49
+ console.error(chalk.bold("Get your API key:"));
50
+ console.error(
51
+ ` ${chalk.underline("https://specforge.com.br/settings/api-keys")}
52
+ `
53
+ );
54
+ }
55
+ function checkAuth() {
56
+ const config = resolveConfig();
57
+ return {
58
+ authenticated: config.apiKey !== null,
59
+ apiKeySource: config.sources.apiKey
60
+ };
61
+ }
62
+ function validateApiKeyFormat(apiKey) {
63
+ if (!apiKey.startsWith("sf_live_")) {
64
+ return {
65
+ valid: false,
66
+ error: 'API key must start with "sf_live_"'
67
+ };
68
+ }
69
+ if (apiKey.length < 28) {
70
+ return {
71
+ valid: false,
72
+ error: "API key is too short. Make sure you copied the complete key."
73
+ };
74
+ }
75
+ const keyPart = apiKey.slice(8);
76
+ if (!/^[a-zA-Z0-9_-]+$/.test(keyPart)) {
77
+ return {
78
+ valid: false,
79
+ error: "API key contains invalid characters."
80
+ };
81
+ }
82
+ return { valid: true };
83
+ }
84
+ function authGuardHook(thisCommand) {
85
+ const commandName = thisCommand.name();
86
+ authGuard(commandName);
87
+ }
88
+ export {
89
+ addPublicCommand,
90
+ authGuard,
91
+ authGuardHook,
92
+ checkAuth,
93
+ getPublicCommands,
94
+ requiresAuth,
95
+ validateApiKeyFormat
96
+ };
97
+ //# sourceMappingURL=auth-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli/middleware/auth-guard.ts"],"sourcesContent":["/**\n * Auth Guard Middleware\n *\n * Checks for valid API key authentication before executing protected commands.\n * Provides helpful error messages directing users to authenticate.\n */\n\nimport chalk from 'chalk';\nimport { isAuthenticated, resolveConfig } from '../config/loader.js';\n\n/**\n * Commands that do not require authentication\n *\n * These commands can be run without an API key:\n * - login: Obviously needs to work to set up auth\n * - help: Should always be accessible\n * - version: Should always be accessible\n * - doctor: Diagnostic tool should work without auth\n * - tools: Lists locally defined tools (no API access needed)\n * - docs: Documentation is available offline without auth\n */\nconst PUBLIC_COMMANDS = new Set([\n 'login',\n 'help',\n '--help',\n '-h',\n 'version',\n '--version',\n '-v',\n 'doctor',\n 'tools',\n 'docs',\n]);\n\n/**\n * Check if a command requires authentication\n *\n * @param command - Command name or flag to check\n * @returns true if command requires authentication\n *\n * @example\n * ```typescript\n * requiresAuth('status'); // true\n * requiresAuth('login'); // false\n * requiresAuth('--help'); // false\n * ```\n */\nexport function requiresAuth(command: string): boolean {\n return !PUBLIC_COMMANDS.has(command);\n}\n\n/**\n * Get the list of public commands\n *\n * @returns Array of command names that don't require auth\n */\nexport function getPublicCommands(): string[] {\n return Array.from(PUBLIC_COMMANDS);\n}\n\n/**\n * Add a command to the public (no-auth-required) list\n *\n * Useful for plugins or extensions that add unauthenticated commands.\n *\n * @param command - Command name to add\n */\nexport function addPublicCommand(command: string): void {\n PUBLIC_COMMANDS.add(command);\n}\n\n/**\n * Authentication guard - checks auth and exits if not authenticated\n *\n * Call this at the start of protected command handlers.\n * Exits the process with code 1 if not authenticated.\n *\n * @param command - Command name being executed (for logging)\n *\n * @example\n * ```typescript\n * // In a command handler\n * export function statusCommand() {\n * authGuard('status');\n * // ... rest of command (only runs if authenticated)\n * }\n * ```\n */\nexport function authGuard(command: string): void {\n // Skip auth check for public commands\n if (!requiresAuth(command)) {\n return;\n }\n\n // Check if authenticated\n if (isAuthenticated()) {\n return;\n }\n\n // Not authenticated - show helpful error and exit\n printAuthError();\n process.exit(1);\n}\n\n/**\n * Print authentication error message with instructions\n *\n * Provides clear guidance on how to authenticate.\n */\nfunction printAuthError(): void {\n console.error(chalk.red('Error: Not authenticated.\\n'));\n\n console.error(\n 'You need to authenticate before running this command.\\n'\n );\n\n console.error(chalk.bold('To authenticate:'));\n console.error(\n ` ${chalk.cyan('specforge login')} - Interactive login\\n`\n );\n\n console.error(chalk.bold('Or set environment variable:'));\n console.error(\n ` ${chalk.cyan('export SPECFORGE_API_KEY=sf_live_your_key')}\\n`\n );\n\n console.error(chalk.bold('Get your API key:'));\n console.error(\n ` ${chalk.underline('https://specforge.com.br/settings/api-keys')}\\n`\n );\n}\n\n/**\n * Check authentication without exiting\n *\n * Use this for conditional logic where you don't want to exit.\n *\n * @returns Object with auth status and config\n *\n * @example\n * ```typescript\n * const { authenticated, config } = checkAuth();\n * if (!authenticated) {\n * // Handle gracefully without exiting\n * }\n * ```\n */\nexport function checkAuth(): {\n authenticated: boolean;\n apiKeySource: 'env' | 'global' | null;\n} {\n const config = resolveConfig();\n\n return {\n authenticated: config.apiKey !== null,\n apiKeySource: config.sources.apiKey,\n };\n}\n\n/**\n * Validate API key format\n *\n * Checks that the API key matches expected format without making API calls.\n *\n * @param apiKey - API key to validate\n * @returns Object with validity and any error message\n *\n * @example\n * ```typescript\n * const { valid, error } = validateApiKeyFormat('sf_live_abc123');\n * if (!valid) {\n * console.error(error);\n * }\n * ```\n */\nexport function validateApiKeyFormat(apiKey: string): {\n valid: boolean;\n error?: string;\n} {\n // Check prefix\n if (!apiKey.startsWith('sf_live_')) {\n return {\n valid: false,\n error: 'API key must start with \"sf_live_\"',\n };\n }\n\n // Check minimum length (prefix + at least 20 chars)\n if (apiKey.length < 28) {\n return {\n valid: false,\n error: 'API key is too short. Make sure you copied the complete key.',\n };\n }\n\n // Check for invalid characters (should be alphanumeric after prefix)\n const keyPart = apiKey.slice(8); // Remove 'sf_live_' prefix\n if (!/^[a-zA-Z0-9_-]+$/.test(keyPart)) {\n return {\n valid: false,\n error: 'API key contains invalid characters.',\n };\n }\n\n return { valid: true };\n}\n\n/**\n * Commander.js pre-action hook for auth guard\n *\n * Use this with Commander's hook system for automatic auth checking.\n *\n * @param thisCommand - Commander command object\n *\n * @example\n * ```typescript\n * program.hook('preAction', authGuardHook);\n * ```\n */\nexport function authGuardHook(thisCommand: { name: () => string }): void {\n const commandName = thisCommand.name();\n authGuard(commandName);\n}\n"],"mappings":"AAOA,OAAO,WAAW;AAClB,SAAS,iBAAiB,qBAAqB;AAa/C,MAAM,kBAAkB,oBAAI,IAAI;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAeM,SAAS,aAAa,SAA0B;AACrD,SAAO,CAAC,gBAAgB,IAAI,OAAO;AACrC;AAOO,SAAS,oBAA8B;AAC5C,SAAO,MAAM,KAAK,eAAe;AACnC;AASO,SAAS,iBAAiB,SAAuB;AACtD,kBAAgB,IAAI,OAAO;AAC7B;AAmBO,SAAS,UAAU,SAAuB;AAE/C,MAAI,CAAC,aAAa,OAAO,GAAG;AAC1B;AAAA,EACF;AAGA,MAAI,gBAAgB,GAAG;AACrB;AAAA,EACF;AAGA,iBAAe;AACf,UAAQ,KAAK,CAAC;AAChB;AAOA,SAAS,iBAAuB;AAC9B,UAAQ,MAAM,MAAM,IAAI,6BAA6B,CAAC;AAEtD,UAAQ;AAAA,IACN;AAAA,EACF;AAEA,UAAQ,MAAM,MAAM,KAAK,kBAAkB,CAAC;AAC5C,UAAQ;AAAA,IACN,KAAK,MAAM,KAAK,iBAAiB,CAAC;AAAA;AAAA,EACpC;AAEA,UAAQ,MAAM,MAAM,KAAK,8BAA8B,CAAC;AACxD,UAAQ;AAAA,IACN,KAAK,MAAM,KAAK,2CAA2C,CAAC;AAAA;AAAA,EAC9D;AAEA,UAAQ,MAAM,MAAM,KAAK,mBAAmB,CAAC;AAC7C,UAAQ;AAAA,IACN,KAAK,MAAM,UAAU,4CAA4C,CAAC;AAAA;AAAA,EACpE;AACF;AAiBO,SAAS,YAGd;AACA,QAAM,SAAS,cAAc;AAE7B,SAAO;AAAA,IACL,eAAe,OAAO,WAAW;AAAA,IACjC,cAAc,OAAO,QAAQ;AAAA,EAC/B;AACF;AAkBO,SAAS,qBAAqB,QAGnC;AAEA,MAAI,CAAC,OAAO,WAAW,UAAU,GAAG;AAClC,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAGA,MAAI,OAAO,SAAS,IAAI;AACtB,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAGA,QAAM,UAAU,OAAO,MAAM,CAAC;AAC9B,MAAI,CAAC,mBAAmB,KAAK,OAAO,GAAG;AACrC,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,KAAK;AACvB;AAcO,SAAS,cAAc,aAA2C;AACvE,QAAM,cAAc,YAAY,KAAK;AACrC,YAAU,WAAW;AACvB;","names":[]}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Error Handler Middleware
3
+ *
4
+ * Provides consistent error handling and formatting across all CLI commands.
5
+ * Supports debug mode for detailed stack traces.
6
+ */
7
+ /**
8
+ * Standard exit codes
9
+ */
10
+ export declare const EXIT_CODES: {
11
+ /** Successful execution */
12
+ readonly SUCCESS: 0;
13
+ /** General error */
14
+ readonly ERROR: 1;
15
+ /** Authentication error */
16
+ readonly AUTH_ERROR: 2;
17
+ /** Configuration error */
18
+ readonly CONFIG_ERROR: 3;
19
+ /** Network/API error */
20
+ readonly NETWORK_ERROR: 4;
21
+ /** Not found error */
22
+ readonly NOT_FOUND: 5;
23
+ /** Validation error */
24
+ readonly VALIDATION_ERROR: 6;
25
+ };
26
+ export type ExitCode = typeof EXIT_CODES[keyof typeof EXIT_CODES];
27
+ /**
28
+ * Custom error class for CLI errors with exit codes
29
+ */
30
+ export declare class CliError extends Error {
31
+ readonly exitCode: ExitCode;
32
+ readonly hint?: string | undefined;
33
+ constructor(message: string, exitCode?: ExitCode, hint?: string | undefined);
34
+ }
35
+ /**
36
+ * Authentication error
37
+ */
38
+ export declare class AuthError extends CliError {
39
+ constructor(message?: string);
40
+ }
41
+ /**
42
+ * Configuration error
43
+ */
44
+ export declare class ConfigError extends CliError {
45
+ constructor(message: string, hint?: string);
46
+ }
47
+ /**
48
+ * Network/API error
49
+ */
50
+ export declare class NetworkError extends CliError {
51
+ constructor(message: string, hint?: string);
52
+ }
53
+ /**
54
+ * Not found error
55
+ */
56
+ export declare class NotFoundError extends CliError {
57
+ constructor(resource: string, identifier?: string);
58
+ }
59
+ /**
60
+ * Validation error
61
+ */
62
+ export declare class ValidationError extends CliError {
63
+ constructor(message: string, hint?: string);
64
+ }
65
+ /**
66
+ * Check if debug mode is enabled
67
+ */
68
+ export declare function isDebugMode(): boolean;
69
+ /**
70
+ * Format error for display
71
+ *
72
+ * @param error - Error to format
73
+ * @returns Formatted error string
74
+ */
75
+ export declare function formatError(error: unknown): string;
76
+ /**
77
+ * Handle error and exit process
78
+ *
79
+ * @param error - Error to handle
80
+ */
81
+ export declare function handleError(error: unknown): never;
82
+ /**
83
+ * Wrap an async function with error handling
84
+ *
85
+ * Use this to wrap command action handlers for automatic error handling.
86
+ *
87
+ * @param fn - Async function to wrap
88
+ * @returns Wrapped function that handles errors
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * program
93
+ * .command('status')
94
+ * .action(withErrorHandler(async () => {
95
+ * // If this throws, error is caught and formatted
96
+ * const data = await api.getStatus();
97
+ * }));
98
+ * ```
99
+ */
100
+ export declare function withErrorHandler<T extends unknown[], R>(fn: (...args: T) => Promise<R>): (...args: T) => Promise<void>;
101
+ /**
102
+ * Wrap a sync function with error handling
103
+ *
104
+ * @param fn - Sync function to wrap
105
+ * @returns Wrapped function that handles errors
106
+ */
107
+ export declare function withErrorHandlerSync<T extends unknown[], R>(fn: (...args: T) => R): (...args: T) => void;
108
+ /**
109
+ * Log debug information (only in debug mode)
110
+ *
111
+ * @param message - Message to log
112
+ * @param data - Optional data to log
113
+ */
114
+ export declare function debugLog(message: string, data?: unknown): void;
115
+ /**
116
+ * Log warning message
117
+ *
118
+ * @param message - Warning message
119
+ */
120
+ export declare function warnLog(message: string): void;
121
+ /**
122
+ * Log success message
123
+ *
124
+ * @param message - Success message
125
+ */
126
+ export declare function successLog(message: string): void;
127
+ /**
128
+ * Log info message
129
+ *
130
+ * @param message - Info message
131
+ */
132
+ export declare function infoLog(message: string): void;
133
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../../src/cli/middleware/error-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB,2BAA2B;;IAE3B,oBAAoB;;IAEpB,2BAA2B;;IAE3B,0BAA0B;;IAE1B,wBAAwB;;IAExB,sBAAsB;;IAEtB,uBAAuB;;CAEf,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAElE;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;aAGf,QAAQ,EAAE,QAAQ;aAClB,IAAI,CAAC,EAAE,MAAM;gBAF7B,OAAO,EAAE,MAAM,EACC,QAAQ,GAAE,QAA2B,EACrC,IAAI,CAAC,EAAE,MAAM,YAAA;CAKhC;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,QAAQ;gBACzB,OAAO,GAAE,MAA4B;CAGlD;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,QAAQ;gBAC3B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAG3C;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAO3C;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAMlD;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAG3C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA0BlD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAOjD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EACrD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7B,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAQ/B;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,OAAO,EAAE,EAAE,CAAC,EACzD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GACpB,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAQtB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAU9D;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C"}
@@ -0,0 +1,139 @@
1
+ import chalk from "chalk";
2
+ import { CONFIG_ENV_VARS } from "../config/types.js";
3
+ const EXIT_CODES = {
4
+ /** Successful execution */
5
+ SUCCESS: 0,
6
+ /** General error */
7
+ ERROR: 1,
8
+ /** Authentication error */
9
+ AUTH_ERROR: 2,
10
+ /** Configuration error */
11
+ CONFIG_ERROR: 3,
12
+ /** Network/API error */
13
+ NETWORK_ERROR: 4,
14
+ /** Not found error */
15
+ NOT_FOUND: 5,
16
+ /** Validation error */
17
+ VALIDATION_ERROR: 6
18
+ };
19
+ class CliError extends Error {
20
+ constructor(message, exitCode = EXIT_CODES.ERROR, hint) {
21
+ super(message);
22
+ this.exitCode = exitCode;
23
+ this.hint = hint;
24
+ this.name = "CliError";
25
+ }
26
+ }
27
+ class AuthError extends CliError {
28
+ constructor(message = "Not authenticated") {
29
+ super(message, EXIT_CODES.AUTH_ERROR, "Run `specforge login` to authenticate");
30
+ }
31
+ }
32
+ class ConfigError extends CliError {
33
+ constructor(message, hint) {
34
+ super(message, EXIT_CODES.CONFIG_ERROR, hint);
35
+ }
36
+ }
37
+ class NetworkError extends CliError {
38
+ constructor(message, hint) {
39
+ super(
40
+ message,
41
+ EXIT_CODES.NETWORK_ERROR,
42
+ hint || "Check your internet connection and try again"
43
+ );
44
+ }
45
+ }
46
+ class NotFoundError extends CliError {
47
+ constructor(resource, identifier) {
48
+ const message = identifier ? `${resource} not found: ${identifier}` : `${resource} not found`;
49
+ super(message, EXIT_CODES.NOT_FOUND);
50
+ }
51
+ }
52
+ class ValidationError extends CliError {
53
+ constructor(message, hint) {
54
+ super(message, EXIT_CODES.VALIDATION_ERROR, hint);
55
+ }
56
+ }
57
+ function isDebugMode() {
58
+ return process.env[CONFIG_ENV_VARS.DEBUG] === "true";
59
+ }
60
+ function formatError(error) {
61
+ if (error instanceof CliError) {
62
+ let output = chalk.red(`Error: ${error.message}`);
63
+ if (error.hint) {
64
+ output += "\n" + chalk.yellow(`Hint: ${error.hint}`);
65
+ }
66
+ if (isDebugMode() && error.stack) {
67
+ output += "\n\n" + chalk.gray(error.stack);
68
+ }
69
+ return output;
70
+ }
71
+ if (error instanceof Error) {
72
+ let output = chalk.red(`Error: ${error.message}`);
73
+ if (isDebugMode() && error.stack) {
74
+ output += "\n\n" + chalk.gray(error.stack);
75
+ }
76
+ return output;
77
+ }
78
+ return chalk.red(`Error: ${String(error)}`);
79
+ }
80
+ function handleError(error) {
81
+ console.error(formatError(error));
82
+ const exitCode = error instanceof CliError ? error.exitCode : EXIT_CODES.ERROR;
83
+ process.exit(exitCode);
84
+ }
85
+ function withErrorHandler(fn) {
86
+ return async (...args) => {
87
+ try {
88
+ await fn(...args);
89
+ } catch (error) {
90
+ handleError(error);
91
+ }
92
+ };
93
+ }
94
+ function withErrorHandlerSync(fn) {
95
+ return (...args) => {
96
+ try {
97
+ fn(...args);
98
+ } catch (error) {
99
+ handleError(error);
100
+ }
101
+ };
102
+ }
103
+ function debugLog(message, data) {
104
+ if (!isDebugMode()) {
105
+ return;
106
+ }
107
+ console.error(chalk.gray(`[DEBUG] ${message}`));
108
+ if (data !== void 0) {
109
+ console.error(chalk.gray(JSON.stringify(data, null, 2)));
110
+ }
111
+ }
112
+ function warnLog(message) {
113
+ console.error(chalk.yellow(`Warning: ${message}`));
114
+ }
115
+ function successLog(message) {
116
+ console.log(chalk.green(message));
117
+ }
118
+ function infoLog(message) {
119
+ console.log(chalk.cyan(message));
120
+ }
121
+ export {
122
+ AuthError,
123
+ CliError,
124
+ ConfigError,
125
+ EXIT_CODES,
126
+ NetworkError,
127
+ NotFoundError,
128
+ ValidationError,
129
+ debugLog,
130
+ formatError,
131
+ handleError,
132
+ infoLog,
133
+ isDebugMode,
134
+ successLog,
135
+ warnLog,
136
+ withErrorHandler,
137
+ withErrorHandlerSync
138
+ };
139
+ //# sourceMappingURL=error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli/middleware/error-handler.ts"],"sourcesContent":["/**\n * Error Handler Middleware\n *\n * Provides consistent error handling and formatting across all CLI commands.\n * Supports debug mode for detailed stack traces.\n */\n\nimport chalk from 'chalk';\nimport { CONFIG_ENV_VARS } from '../config/types.js';\n\n/**\n * Standard exit codes\n */\nexport const EXIT_CODES = {\n /** Successful execution */\n SUCCESS: 0,\n /** General error */\n ERROR: 1,\n /** Authentication error */\n AUTH_ERROR: 2,\n /** Configuration error */\n CONFIG_ERROR: 3,\n /** Network/API error */\n NETWORK_ERROR: 4,\n /** Not found error */\n NOT_FOUND: 5,\n /** Validation error */\n VALIDATION_ERROR: 6,\n} as const;\n\nexport type ExitCode = typeof EXIT_CODES[keyof typeof EXIT_CODES];\n\n/**\n * Custom error class for CLI errors with exit codes\n */\nexport class CliError extends Error {\n constructor(\n message: string,\n public readonly exitCode: ExitCode = EXIT_CODES.ERROR,\n public readonly hint?: string\n ) {\n super(message);\n this.name = 'CliError';\n }\n}\n\n/**\n * Authentication error\n */\nexport class AuthError extends CliError {\n constructor(message: string = 'Not authenticated') {\n super(message, EXIT_CODES.AUTH_ERROR, 'Run `specforge login` to authenticate');\n }\n}\n\n/**\n * Configuration error\n */\nexport class ConfigError extends CliError {\n constructor(message: string, hint?: string) {\n super(message, EXIT_CODES.CONFIG_ERROR, hint);\n }\n}\n\n/**\n * Network/API error\n */\nexport class NetworkError extends CliError {\n constructor(message: string, hint?: string) {\n super(\n message,\n EXIT_CODES.NETWORK_ERROR,\n hint || 'Check your internet connection and try again'\n );\n }\n}\n\n/**\n * Not found error\n */\nexport class NotFoundError extends CliError {\n constructor(resource: string, identifier?: string) {\n const message = identifier\n ? `${resource} not found: ${identifier}`\n : `${resource} not found`;\n super(message, EXIT_CODES.NOT_FOUND);\n }\n}\n\n/**\n * Validation error\n */\nexport class ValidationError extends CliError {\n constructor(message: string, hint?: string) {\n super(message, EXIT_CODES.VALIDATION_ERROR, hint);\n }\n}\n\n/**\n * Check if debug mode is enabled\n */\nexport function isDebugMode(): boolean {\n return process.env[CONFIG_ENV_VARS.DEBUG] === 'true';\n}\n\n/**\n * Format error for display\n *\n * @param error - Error to format\n * @returns Formatted error string\n */\nexport function formatError(error: unknown): string {\n if (error instanceof CliError) {\n let output = chalk.red(`Error: ${error.message}`);\n\n if (error.hint) {\n output += '\\n' + chalk.yellow(`Hint: ${error.hint}`);\n }\n\n if (isDebugMode() && error.stack) {\n output += '\\n\\n' + chalk.gray(error.stack);\n }\n\n return output;\n }\n\n if (error instanceof Error) {\n let output = chalk.red(`Error: ${error.message}`);\n\n if (isDebugMode() && error.stack) {\n output += '\\n\\n' + chalk.gray(error.stack);\n }\n\n return output;\n }\n\n return chalk.red(`Error: ${String(error)}`);\n}\n\n/**\n * Handle error and exit process\n *\n * @param error - Error to handle\n */\nexport function handleError(error: unknown): never {\n console.error(formatError(error));\n\n const exitCode =\n error instanceof CliError ? error.exitCode : EXIT_CODES.ERROR;\n\n process.exit(exitCode);\n}\n\n/**\n * Wrap an async function with error handling\n *\n * Use this to wrap command action handlers for automatic error handling.\n *\n * @param fn - Async function to wrap\n * @returns Wrapped function that handles errors\n *\n * @example\n * ```typescript\n * program\n * .command('status')\n * .action(withErrorHandler(async () => {\n * // If this throws, error is caught and formatted\n * const data = await api.getStatus();\n * }));\n * ```\n */\nexport function withErrorHandler<T extends unknown[], R>(\n fn: (...args: T) => Promise<R>\n): (...args: T) => Promise<void> {\n return async (...args: T): Promise<void> => {\n try {\n await fn(...args);\n } catch (error) {\n handleError(error);\n }\n };\n}\n\n/**\n * Wrap a sync function with error handling\n *\n * @param fn - Sync function to wrap\n * @returns Wrapped function that handles errors\n */\nexport function withErrorHandlerSync<T extends unknown[], R>(\n fn: (...args: T) => R\n): (...args: T) => void {\n return (...args: T): void => {\n try {\n fn(...args);\n } catch (error) {\n handleError(error);\n }\n };\n}\n\n/**\n * Log debug information (only in debug mode)\n *\n * @param message - Message to log\n * @param data - Optional data to log\n */\nexport function debugLog(message: string, data?: unknown): void {\n if (!isDebugMode()) {\n return;\n }\n\n console.error(chalk.gray(`[DEBUG] ${message}`));\n\n if (data !== undefined) {\n console.error(chalk.gray(JSON.stringify(data, null, 2)));\n }\n}\n\n/**\n * Log warning message\n *\n * @param message - Warning message\n */\nexport function warnLog(message: string): void {\n console.error(chalk.yellow(`Warning: ${message}`));\n}\n\n/**\n * Log success message\n *\n * @param message - Success message\n */\nexport function successLog(message: string): void {\n console.log(chalk.green(message));\n}\n\n/**\n * Log info message\n *\n * @param message - Info message\n */\nexport function infoLog(message: string): void {\n console.log(chalk.cyan(message));\n}\n"],"mappings":"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","names":[]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * CLI Middleware Module
3
+ */
4
+ export * from './auth-guard.js';
5
+ export * from './error-handler.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/middleware/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./auth-guard.js";
2
+ export * from "./error-handler.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli/middleware/index.ts"],"sourcesContent":["/**\n * CLI Middleware Module\n */\n\nexport * from './auth-guard.js';\nexport * from './error-handler.js';\n"],"mappings":"AAIA,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SFAG-Orchestrator Agent Template v2
3
+ *
4
+ * Strategic task decomposition with concrete decision trees.
5
+ * Knows when to delegate, to whom, and in what order.
6
+ */
7
+ import type { AgentTemplate } from '../../../../commands/scaffold/agent-types.js';
8
+ export declare const SFAG_ORCHESTRATOR: AgentTemplate;
9
+ //# sourceMappingURL=sfag-orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sfag-orchestrator.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/templates/agents/content/core/sfag-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAElF,eAAO,MAAM,iBAAiB,EAAE,aA2J/B,CAAC"}