@specforge/mcp 2.0.9 → 2.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 (433) hide show
  1. package/README.md +324 -0
  2. package/bin/specforge-mcp +19 -1
  3. package/dist/cli/commands/blocked.d.ts +16 -0
  4. package/dist/cli/commands/blocked.d.ts.map +1 -0
  5. package/dist/cli/commands/blocked.js +214 -0
  6. package/dist/cli/commands/blocked.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 +218 -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 +105 -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 +117 -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 +12 -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 +90 -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 +117 -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 +117 -0
  34. package/dist/cli/commands/debug/tools.js.map +1 -0
  35. package/dist/cli/commands/debug/types.d.ts +117 -0
  36. package/dist/cli/commands/debug/types.d.ts.map +1 -0
  37. package/dist/cli/commands/debug/types.js +43 -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 +161 -0
  42. package/dist/cli/commands/debug/whoami.js.map +1 -0
  43. package/dist/cli/commands/docs/content/api.d.ts +7 -0
  44. package/dist/cli/commands/docs/content/api.d.ts.map +1 -0
  45. package/dist/cli/commands/docs/content/api.js +64 -0
  46. package/dist/cli/commands/docs/content/api.js.map +1 -0
  47. package/dist/cli/commands/docs/content/concepts.d.ts +7 -0
  48. package/dist/cli/commands/docs/content/concepts.d.ts.map +1 -0
  49. package/dist/cli/commands/docs/content/concepts.js +68 -0
  50. package/dist/cli/commands/docs/content/concepts.js.map +1 -0
  51. package/dist/cli/commands/docs/content/examples.d.ts +7 -0
  52. package/dist/cli/commands/docs/content/examples.d.ts.map +1 -0
  53. package/dist/cli/commands/docs/content/examples.js +84 -0
  54. package/dist/cli/commands/docs/content/examples.js.map +1 -0
  55. package/dist/cli/commands/docs/content/index.d.ts +10 -0
  56. package/dist/cli/commands/docs/content/index.d.ts.map +1 -0
  57. package/dist/cli/commands/docs/content/index.js +10 -0
  58. package/dist/cli/commands/docs/content/index.js.map +1 -0
  59. package/dist/cli/commands/docs/content/workflow.d.ts +7 -0
  60. package/dist/cli/commands/docs/content/workflow.d.ts.map +1 -0
  61. package/dist/cli/commands/docs/content/workflow.js +44 -0
  62. package/dist/cli/commands/docs/content/workflow.js.map +1 -0
  63. package/dist/cli/commands/docs/content.d.ts +23 -0
  64. package/dist/cli/commands/docs/content.d.ts.map +1 -0
  65. package/dist/cli/commands/docs/content.js +38 -0
  66. package/dist/cli/commands/docs/content.js.map +1 -0
  67. package/dist/cli/commands/docs/display.d.ts +26 -0
  68. package/dist/cli/commands/docs/display.d.ts.map +1 -0
  69. package/dist/cli/commands/docs/display.js +53 -0
  70. package/dist/cli/commands/docs/display.js.map +1 -0
  71. package/dist/cli/commands/docs/docs.d.ts +19 -0
  72. package/dist/cli/commands/docs/docs.d.ts.map +1 -0
  73. package/dist/cli/commands/docs/docs.js +124 -0
  74. package/dist/cli/commands/docs/docs.js.map +1 -0
  75. package/dist/cli/commands/docs/index.d.ts +13 -0
  76. package/dist/cli/commands/docs/index.d.ts.map +1 -0
  77. package/dist/cli/commands/docs/index.js +13 -0
  78. package/dist/cli/commands/docs/index.js.map +1 -0
  79. package/dist/cli/commands/docs/register.d.ts +23 -0
  80. package/dist/cli/commands/docs/register.d.ts.map +1 -0
  81. package/dist/cli/commands/docs/register.js +64 -0
  82. package/dist/cli/commands/docs/register.js.map +1 -0
  83. package/dist/cli/commands/docs/tool-docs.d.ts +44 -0
  84. package/dist/cli/commands/docs/tool-docs.d.ts.map +1 -0
  85. package/dist/cli/commands/docs/tool-docs.js +182 -0
  86. package/dist/cli/commands/docs/tool-docs.js.map +1 -0
  87. package/dist/cli/commands/docs/tool-examples.d.ts +14 -0
  88. package/dist/cli/commands/docs/tool-examples.d.ts.map +1 -0
  89. package/dist/cli/commands/docs/tool-examples.js +127 -0
  90. package/dist/cli/commands/docs/tool-examples.js.map +1 -0
  91. package/dist/cli/commands/docs/types.d.ts +108 -0
  92. package/dist/cli/commands/docs/types.d.ts.map +1 -0
  93. package/dist/cli/commands/docs/types.js +33 -0
  94. package/dist/cli/commands/docs/types.js.map +1 -0
  95. package/dist/cli/commands/doctor.d.ts +16 -0
  96. package/dist/cli/commands/doctor.d.ts.map +1 -0
  97. package/dist/cli/commands/doctor.js +322 -0
  98. package/dist/cli/commands/doctor.js.map +1 -0
  99. package/dist/cli/commands/doctor.types.d.ts +177 -0
  100. package/dist/cli/commands/doctor.types.d.ts.map +1 -0
  101. package/dist/cli/commands/doctor.types.js +172 -0
  102. package/dist/cli/commands/doctor.types.js.map +1 -0
  103. package/dist/cli/commands/index.d.ts +18 -0
  104. package/dist/cli/commands/index.d.ts.map +1 -0
  105. package/dist/cli/commands/index.js +18 -0
  106. package/dist/cli/commands/index.js.map +1 -0
  107. package/dist/cli/commands/init.d.ts +17 -0
  108. package/dist/cli/commands/init.d.ts.map +1 -0
  109. package/dist/cli/commands/init.js +326 -0
  110. package/dist/cli/commands/init.js.map +1 -0
  111. package/dist/cli/commands/init.types.d.ts +141 -0
  112. package/dist/cli/commands/init.types.d.ts.map +1 -0
  113. package/dist/cli/commands/init.types.js +24 -0
  114. package/dist/cli/commands/init.types.js.map +1 -0
  115. package/dist/cli/commands/login.d.ts +40 -0
  116. package/dist/cli/commands/login.d.ts.map +1 -0
  117. package/dist/cli/commands/login.js +174 -0
  118. package/dist/cli/commands/login.js.map +1 -0
  119. package/dist/cli/commands/next.d.ts +16 -0
  120. package/dist/cli/commands/next.d.ts.map +1 -0
  121. package/dist/cli/commands/next.js +279 -0
  122. package/dist/cli/commands/next.js.map +1 -0
  123. package/dist/cli/commands/next.types.d.ts +191 -0
  124. package/dist/cli/commands/next.types.d.ts.map +1 -0
  125. package/dist/cli/commands/next.types.js +129 -0
  126. package/dist/cli/commands/next.types.js.map +1 -0
  127. package/dist/cli/commands/projects.d.ts +16 -0
  128. package/dist/cli/commands/projects.d.ts.map +1 -0
  129. package/dist/cli/commands/projects.js +149 -0
  130. package/dist/cli/commands/projects.js.map +1 -0
  131. package/dist/cli/commands/projects.types.d.ts +81 -0
  132. package/dist/cli/commands/projects.types.d.ts.map +1 -0
  133. package/dist/cli/commands/projects.types.js +35 -0
  134. package/dist/cli/commands/projects.types.js.map +1 -0
  135. package/dist/cli/commands/review/display.d.ts +33 -0
  136. package/dist/cli/commands/review/display.d.ts.map +1 -0
  137. package/dist/cli/commands/review/display.js +159 -0
  138. package/dist/cli/commands/review/display.js.map +1 -0
  139. package/dist/cli/commands/review/epic-review.d.ts +13 -0
  140. package/dist/cli/commands/review/epic-review.d.ts.map +1 -0
  141. package/dist/cli/commands/review/epic-review.js +69 -0
  142. package/dist/cli/commands/review/epic-review.js.map +1 -0
  143. package/dist/cli/commands/review/index.d.ts +13 -0
  144. package/dist/cli/commands/review/index.d.ts.map +1 -0
  145. package/dist/cli/commands/review/index.js +17 -0
  146. package/dist/cli/commands/review/index.js.map +1 -0
  147. package/dist/cli/commands/review/report.d.ts +31 -0
  148. package/dist/cli/commands/review/report.d.ts.map +1 -0
  149. package/dist/cli/commands/review/report.js +146 -0
  150. package/dist/cli/commands/review/report.js.map +1 -0
  151. package/dist/cli/commands/review/review.d.ts +17 -0
  152. package/dist/cli/commands/review/review.d.ts.map +1 -0
  153. package/dist/cli/commands/review/review.js +129 -0
  154. package/dist/cli/commands/review/review.js.map +1 -0
  155. package/dist/cli/commands/review/spec-review.d.ts +13 -0
  156. package/dist/cli/commands/review/spec-review.d.ts.map +1 -0
  157. package/dist/cli/commands/review/spec-review.js +65 -0
  158. package/dist/cli/commands/review/spec-review.js.map +1 -0
  159. package/dist/cli/commands/review/ticket-review.d.ts +37 -0
  160. package/dist/cli/commands/review/ticket-review.d.ts.map +1 -0
  161. package/dist/cli/commands/review/ticket-review.js +194 -0
  162. package/dist/cli/commands/review/ticket-review.js.map +1 -0
  163. package/dist/cli/commands/review/types.d.ts +232 -0
  164. package/dist/cli/commands/review/types.d.ts.map +1 -0
  165. package/dist/cli/commands/review/types.js +85 -0
  166. package/dist/cli/commands/review/types.js.map +1 -0
  167. package/dist/cli/commands/scaffold/display.d.ts +27 -0
  168. package/dist/cli/commands/scaffold/display.d.ts.map +1 -0
  169. package/dist/cli/commands/scaffold/display.js +90 -0
  170. package/dist/cli/commands/scaffold/display.js.map +1 -0
  171. package/dist/cli/commands/scaffold/index.d.ts +12 -0
  172. package/dist/cli/commands/scaffold/index.d.ts.map +1 -0
  173. package/dist/cli/commands/scaffold/index.js +12 -0
  174. package/dist/cli/commands/scaffold/index.js.map +1 -0
  175. package/dist/cli/commands/scaffold/register.d.ts +11 -0
  176. package/dist/cli/commands/scaffold/register.d.ts.map +1 -0
  177. package/dist/cli/commands/scaffold/register.js +25 -0
  178. package/dist/cli/commands/scaffold/register.js.map +1 -0
  179. package/dist/cli/commands/scaffold/scaffold.d.ts +11 -0
  180. package/dist/cli/commands/scaffold/scaffold.d.ts.map +1 -0
  181. package/dist/cli/commands/scaffold/scaffold.js +111 -0
  182. package/dist/cli/commands/scaffold/scaffold.js.map +1 -0
  183. package/dist/cli/commands/scaffold/targets.d.ts +31 -0
  184. package/dist/cli/commands/scaffold/targets.d.ts.map +1 -0
  185. package/dist/cli/commands/scaffold/targets.js +84 -0
  186. package/dist/cli/commands/scaffold/targets.js.map +1 -0
  187. package/dist/cli/commands/scaffold/types.d.ts +88 -0
  188. package/dist/cli/commands/scaffold/types.d.ts.map +1 -0
  189. package/dist/cli/commands/scaffold/types.js +21 -0
  190. package/dist/cli/commands/scaffold/types.js.map +1 -0
  191. package/dist/cli/commands/scaffold/utils.d.ts +31 -0
  192. package/dist/cli/commands/scaffold/utils.d.ts.map +1 -0
  193. package/dist/cli/commands/scaffold/utils.js +71 -0
  194. package/dist/cli/commands/scaffold/utils.js.map +1 -0
  195. package/dist/cli/commands/session/display.d.ts +40 -0
  196. package/dist/cli/commands/session/display.d.ts.map +1 -0
  197. package/dist/cli/commands/session/display.js +114 -0
  198. package/dist/cli/commands/session/display.js.map +1 -0
  199. package/dist/cli/commands/session/end.d.ts +12 -0
  200. package/dist/cli/commands/session/end.d.ts.map +1 -0
  201. package/dist/cli/commands/session/end.js +165 -0
  202. package/dist/cli/commands/session/end.js.map +1 -0
  203. package/dist/cli/commands/session/index.d.ts +13 -0
  204. package/dist/cli/commands/session/index.d.ts.map +1 -0
  205. package/dist/cli/commands/session/index.js +13 -0
  206. package/dist/cli/commands/session/index.js.map +1 -0
  207. package/dist/cli/commands/session/register.d.ts +12 -0
  208. package/dist/cli/commands/session/register.d.ts.map +1 -0
  209. package/dist/cli/commands/session/register.js +87 -0
  210. package/dist/cli/commands/session/register.js.map +1 -0
  211. package/dist/cli/commands/session/start.d.ts +12 -0
  212. package/dist/cli/commands/session/start.d.ts.map +1 -0
  213. package/dist/cli/commands/session/start.js +189 -0
  214. package/dist/cli/commands/session/start.js.map +1 -0
  215. package/dist/cli/commands/session/status.d.ts +12 -0
  216. package/dist/cli/commands/session/status.d.ts.map +1 -0
  217. package/dist/cli/commands/session/status.js +93 -0
  218. package/dist/cli/commands/session/status.js.map +1 -0
  219. package/dist/cli/commands/session/types.d.ts +179 -0
  220. package/dist/cli/commands/session/types.d.ts.map +1 -0
  221. package/dist/cli/commands/session/types.js +8 -0
  222. package/dist/cli/commands/session/types.js.map +1 -0
  223. package/dist/cli/commands/session/utils.d.ts +24 -0
  224. package/dist/cli/commands/session/utils.d.ts.map +1 -0
  225. package/dist/cli/commands/session/utils.js +72 -0
  226. package/dist/cli/commands/session/utils.js.map +1 -0
  227. package/dist/cli/commands/specs.d.ts +16 -0
  228. package/dist/cli/commands/specs.d.ts.map +1 -0
  229. package/dist/cli/commands/specs.js +212 -0
  230. package/dist/cli/commands/specs.js.map +1 -0
  231. package/dist/cli/commands/specs.types.d.ts +120 -0
  232. package/dist/cli/commands/specs.types.d.ts.map +1 -0
  233. package/dist/cli/commands/specs.types.js +75 -0
  234. package/dist/cli/commands/specs.types.js.map +1 -0
  235. package/dist/cli/commands/status.d.ts +17 -0
  236. package/dist/cli/commands/status.d.ts.map +1 -0
  237. package/dist/cli/commands/status.js +271 -0
  238. package/dist/cli/commands/status.js.map +1 -0
  239. package/dist/cli/commands/status.types.d.ts +382 -0
  240. package/dist/cli/commands/status.types.d.ts.map +1 -0
  241. package/dist/cli/commands/status.types.js +166 -0
  242. package/dist/cli/commands/status.types.js.map +1 -0
  243. package/dist/cli/commands/switch.d.ts +18 -0
  244. package/dist/cli/commands/switch.d.ts.map +1 -0
  245. package/dist/cli/commands/switch.js +181 -0
  246. package/dist/cli/commands/switch.js.map +1 -0
  247. package/dist/cli/commands/switch.types.d.ts +123 -0
  248. package/dist/cli/commands/switch.types.d.ts.map +1 -0
  249. package/dist/cli/commands/switch.types.js +65 -0
  250. package/dist/cli/commands/switch.types.js.map +1 -0
  251. package/dist/cli/commands/ticket/command.d.ts +14 -0
  252. package/dist/cli/commands/ticket/command.d.ts.map +1 -0
  253. package/dist/cli/commands/ticket/command.js +141 -0
  254. package/dist/cli/commands/ticket/command.js.map +1 -0
  255. package/dist/cli/commands/ticket/display.d.ts +56 -0
  256. package/dist/cli/commands/ticket/display.d.ts.map +1 -0
  257. package/dist/cli/commands/ticket/display.js +205 -0
  258. package/dist/cli/commands/ticket/display.js.map +1 -0
  259. package/dist/cli/commands/ticket/index.d.ts +11 -0
  260. package/dist/cli/commands/ticket/index.d.ts.map +1 -0
  261. package/dist/cli/commands/ticket/index.js +11 -0
  262. package/dist/cli/commands/ticket/index.js.map +1 -0
  263. package/dist/cli/commands/ticket/register.d.ts +11 -0
  264. package/dist/cli/commands/ticket/register.d.ts.map +1 -0
  265. package/dist/cli/commands/ticket/register.js +39 -0
  266. package/dist/cli/commands/ticket/register.js.map +1 -0
  267. package/dist/cli/commands/ticket/resolver.d.ts +16 -0
  268. package/dist/cli/commands/ticket/resolver.d.ts.map +1 -0
  269. package/dist/cli/commands/ticket/resolver.js +35 -0
  270. package/dist/cli/commands/ticket/resolver.js.map +1 -0
  271. package/dist/cli/commands/ticket/types.d.ts +157 -0
  272. package/dist/cli/commands/ticket/types.d.ts.map +1 -0
  273. package/dist/cli/commands/ticket/types.js +8 -0
  274. package/dist/cli/commands/ticket/types.js.map +1 -0
  275. package/dist/cli/commands/tickets.d.ts +16 -0
  276. package/dist/cli/commands/tickets.d.ts.map +1 -0
  277. package/dist/cli/commands/tickets.js +271 -0
  278. package/dist/cli/commands/tickets.js.map +1 -0
  279. package/dist/cli/commands/tickets.types.d.ts +202 -0
  280. package/dist/cli/commands/tickets.types.d.ts.map +1 -0
  281. package/dist/cli/commands/tickets.types.js +138 -0
  282. package/dist/cli/commands/tickets.types.js.map +1 -0
  283. package/dist/cli/config/index.d.ts +11 -0
  284. package/dist/cli/config/index.d.ts.map +1 -0
  285. package/dist/cli/config/index.js +11 -0
  286. package/dist/cli/config/index.js.map +1 -0
  287. package/dist/cli/config/loader.d.ts +98 -0
  288. package/dist/cli/config/loader.d.ts.map +1 -0
  289. package/dist/cli/config/loader.js +237 -0
  290. package/dist/cli/config/loader.js.map +1 -0
  291. package/dist/cli/config/paths.d.ts +96 -0
  292. package/dist/cli/config/paths.d.ts.map +1 -0
  293. package/dist/cli/config/paths.js +140 -0
  294. package/dist/cli/config/paths.js.map +1 -0
  295. package/dist/cli/config/types.d.ts +148 -0
  296. package/dist/cli/config/types.d.ts.map +1 -0
  297. package/dist/cli/config/types.js +34 -0
  298. package/dist/cli/config/types.js.map +1 -0
  299. package/dist/cli/config/writer.d.ts +171 -0
  300. package/dist/cli/config/writer.d.ts.map +1 -0
  301. package/dist/cli/config/writer.js +312 -0
  302. package/dist/cli/config/writer.js.map +1 -0
  303. package/dist/cli/index.d.ts +30 -0
  304. package/dist/cli/index.d.ts.map +1 -0
  305. package/dist/cli/index.js +183 -0
  306. package/dist/cli/index.js.map +1 -0
  307. package/dist/cli/middleware/auth-guard.d.ts +107 -0
  308. package/dist/cli/middleware/auth-guard.d.ts.map +1 -0
  309. package/dist/cli/middleware/auth-guard.js +190 -0
  310. package/dist/cli/middleware/auth-guard.js.map +1 -0
  311. package/dist/cli/middleware/error-handler.d.ts +133 -0
  312. package/dist/cli/middleware/error-handler.d.ts.map +1 -0
  313. package/dist/cli/middleware/error-handler.js +209 -0
  314. package/dist/cli/middleware/error-handler.js.map +1 -0
  315. package/dist/cli/middleware/index.d.ts +6 -0
  316. package/dist/cli/middleware/index.d.ts.map +1 -0
  317. package/dist/cli/middleware/index.js +6 -0
  318. package/dist/cli/middleware/index.js.map +1 -0
  319. package/dist/cli/templates/commands.d.ts +20 -0
  320. package/dist/cli/templates/commands.d.ts.map +1 -0
  321. package/dist/cli/templates/commands.js +174 -0
  322. package/dist/cli/templates/commands.js.map +1 -0
  323. package/dist/cli/templates/content/sf-autonomous.d.ts +7 -0
  324. package/dist/cli/templates/content/sf-autonomous.d.ts.map +1 -0
  325. package/dist/cli/templates/content/sf-autonomous.js +78 -0
  326. package/dist/cli/templates/content/sf-autonomous.js.map +1 -0
  327. package/dist/cli/templates/content/sf-blockers.d.ts +7 -0
  328. package/dist/cli/templates/content/sf-blockers.d.ts.map +1 -0
  329. package/dist/cli/templates/content/sf-blockers.js +68 -0
  330. package/dist/cli/templates/content/sf-blockers.js.map +1 -0
  331. package/dist/cli/templates/content/sf-commit.d.ts +7 -0
  332. package/dist/cli/templates/content/sf-commit.d.ts.map +1 -0
  333. package/dist/cli/templates/content/sf-commit.js +78 -0
  334. package/dist/cli/templates/content/sf-commit.js.map +1 -0
  335. package/dist/cli/templates/content/sf-context.d.ts +7 -0
  336. package/dist/cli/templates/content/sf-context.d.ts.map +1 -0
  337. package/dist/cli/templates/content/sf-context.js +64 -0
  338. package/dist/cli/templates/content/sf-context.js.map +1 -0
  339. package/dist/cli/templates/content/sf-create-epics.d.ts +7 -0
  340. package/dist/cli/templates/content/sf-create-epics.d.ts.map +1 -0
  341. package/dist/cli/templates/content/sf-create-epics.js +70 -0
  342. package/dist/cli/templates/content/sf-create-epics.js.map +1 -0
  343. package/dist/cli/templates/content/sf-create-spec.d.ts +7 -0
  344. package/dist/cli/templates/content/sf-create-spec.d.ts.map +1 -0
  345. package/dist/cli/templates/content/sf-create-spec.js +67 -0
  346. package/dist/cli/templates/content/sf-create-spec.js.map +1 -0
  347. package/dist/cli/templates/content/sf-create-tickets.d.ts +7 -0
  348. package/dist/cli/templates/content/sf-create-tickets.d.ts.map +1 -0
  349. package/dist/cli/templates/content/sf-create-tickets.js +76 -0
  350. package/dist/cli/templates/content/sf-create-tickets.js.map +1 -0
  351. package/dist/cli/templates/content/sf-epic.d.ts +7 -0
  352. package/dist/cli/templates/content/sf-epic.d.ts.map +1 -0
  353. package/dist/cli/templates/content/sf-epic.js +69 -0
  354. package/dist/cli/templates/content/sf-epic.js.map +1 -0
  355. package/dist/cli/templates/content/sf-help.d.ts +7 -0
  356. package/dist/cli/templates/content/sf-help.d.ts.map +1 -0
  357. package/dist/cli/templates/content/sf-help.js +61 -0
  358. package/dist/cli/templates/content/sf-help.js.map +1 -0
  359. package/dist/cli/templates/content/sf-import.d.ts +7 -0
  360. package/dist/cli/templates/content/sf-import.d.ts.map +1 -0
  361. package/dist/cli/templates/content/sf-import.js +88 -0
  362. package/dist/cli/templates/content/sf-import.js.map +1 -0
  363. package/dist/cli/templates/content/sf-init.d.ts +7 -0
  364. package/dist/cli/templates/content/sf-init.d.ts.map +1 -0
  365. package/dist/cli/templates/content/sf-init.js +61 -0
  366. package/dist/cli/templates/content/sf-init.js.map +1 -0
  367. package/dist/cli/templates/content/sf-next.d.ts +7 -0
  368. package/dist/cli/templates/content/sf-next.d.ts.map +1 -0
  369. package/dist/cli/templates/content/sf-next.js +67 -0
  370. package/dist/cli/templates/content/sf-next.js.map +1 -0
  371. package/dist/cli/templates/content/sf-reset.d.ts +7 -0
  372. package/dist/cli/templates/content/sf-reset.d.ts.map +1 -0
  373. package/dist/cli/templates/content/sf-reset.js +78 -0
  374. package/dist/cli/templates/content/sf-reset.js.map +1 -0
  375. package/dist/cli/templates/content/sf-review.d.ts +7 -0
  376. package/dist/cli/templates/content/sf-review.d.ts.map +1 -0
  377. package/dist/cli/templates/content/sf-review.js +67 -0
  378. package/dist/cli/templates/content/sf-review.js.map +1 -0
  379. package/dist/cli/templates/content/sf-search.d.ts +7 -0
  380. package/dist/cli/templates/content/sf-search.d.ts.map +1 -0
  381. package/dist/cli/templates/content/sf-search.js +64 -0
  382. package/dist/cli/templates/content/sf-search.js.map +1 -0
  383. package/dist/cli/templates/content/sf-status.d.ts +7 -0
  384. package/dist/cli/templates/content/sf-status.d.ts.map +1 -0
  385. package/dist/cli/templates/content/sf-status.js +67 -0
  386. package/dist/cli/templates/content/sf-status.js.map +1 -0
  387. package/dist/cli/templates/content/sf-ticket.d.ts +7 -0
  388. package/dist/cli/templates/content/sf-ticket.d.ts.map +1 -0
  389. package/dist/cli/templates/content/sf-ticket.js +76 -0
  390. package/dist/cli/templates/content/sf-ticket.js.map +1 -0
  391. package/dist/cli/templates/content/sf-validate.d.ts +7 -0
  392. package/dist/cli/templates/content/sf-validate.d.ts.map +1 -0
  393. package/dist/cli/templates/content/sf-validate.js +78 -0
  394. package/dist/cli/templates/content/sf-validate.js.map +1 -0
  395. package/dist/cli/templates/index.d.ts +7 -0
  396. package/dist/cli/templates/index.d.ts.map +1 -0
  397. package/dist/cli/templates/index.js +7 -0
  398. package/dist/cli/templates/index.js.map +1 -0
  399. package/dist/cli/ui/colors.d.ts +76 -0
  400. package/dist/cli/ui/colors.d.ts.map +1 -0
  401. package/dist/cli/ui/colors.js +81 -0
  402. package/dist/cli/ui/colors.js.map +1 -0
  403. package/dist/cli/ui/dashboard.d.ts +54 -0
  404. package/dist/cli/ui/dashboard.d.ts.map +1 -0
  405. package/dist/cli/ui/dashboard.js +339 -0
  406. package/dist/cli/ui/dashboard.js.map +1 -0
  407. package/dist/cli/ui/index.d.ts +7 -0
  408. package/dist/cli/ui/index.d.ts.map +1 -0
  409. package/dist/cli/ui/index.js +7 -0
  410. package/dist/cli/ui/index.js.map +1 -0
  411. package/dist/cli/ui/output.d.ts +117 -0
  412. package/dist/cli/ui/output.d.ts.map +1 -0
  413. package/dist/cli/ui/output.js +172 -0
  414. package/dist/cli/ui/output.js.map +1 -0
  415. package/dist/cli/ui/spinner.d.ts +105 -0
  416. package/dist/cli/ui/spinner.d.ts.map +1 -0
  417. package/dist/cli/ui/spinner.js +148 -0
  418. package/dist/cli/ui/spinner.js.map +1 -0
  419. package/dist/cli/ui/time.d.ts +54 -0
  420. package/dist/cli/ui/time.d.ts.map +1 -0
  421. package/dist/cli/ui/time.js +173 -0
  422. package/dist/cli/ui/time.js.map +1 -0
  423. package/dist/lib/format.d.ts +4 -4
  424. package/dist/lib/format.js +5 -5
  425. package/dist/server.js +8 -8
  426. package/dist/server.js.map +1 -1
  427. package/dist/tools/core/session.js +6 -6
  428. package/dist/tools/core/session.js.map +1 -1
  429. package/dist/tools/index.js +9 -9
  430. package/dist/tools/index.js.map +1 -1
  431. package/dist/validation/index.js +1 -1
  432. package/dist/validation/index.js.map +1 -1
  433. package/package.json +9 -2
@@ -0,0 +1,190 @@
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
+ import chalk from 'chalk';
8
+ import { isAuthenticated, resolveConfig } from '../config/loader.js';
9
+ /**
10
+ * Commands that do not require authentication
11
+ *
12
+ * These commands can be run without an API key:
13
+ * - login: Obviously needs to work to set up auth
14
+ * - help: Should always be accessible
15
+ * - version: Should always be accessible
16
+ * - doctor: Diagnostic tool should work without auth
17
+ * - tools: Lists locally defined tools (no API access needed)
18
+ * - docs: Documentation is available offline without auth
19
+ */
20
+ const PUBLIC_COMMANDS = new Set([
21
+ 'login',
22
+ 'help',
23
+ '--help',
24
+ '-h',
25
+ 'version',
26
+ '--version',
27
+ '-v',
28
+ 'doctor',
29
+ 'tools',
30
+ 'docs',
31
+ ]);
32
+ /**
33
+ * Check if a command requires authentication
34
+ *
35
+ * @param command - Command name or flag to check
36
+ * @returns true if command requires authentication
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * requiresAuth('status'); // true
41
+ * requiresAuth('login'); // false
42
+ * requiresAuth('--help'); // false
43
+ * ```
44
+ */
45
+ export function requiresAuth(command) {
46
+ return !PUBLIC_COMMANDS.has(command);
47
+ }
48
+ /**
49
+ * Get the list of public commands
50
+ *
51
+ * @returns Array of command names that don't require auth
52
+ */
53
+ export function getPublicCommands() {
54
+ return Array.from(PUBLIC_COMMANDS);
55
+ }
56
+ /**
57
+ * Add a command to the public (no-auth-required) list
58
+ *
59
+ * Useful for plugins or extensions that add unauthenticated commands.
60
+ *
61
+ * @param command - Command name to add
62
+ */
63
+ export function addPublicCommand(command) {
64
+ PUBLIC_COMMANDS.add(command);
65
+ }
66
+ /**
67
+ * Authentication guard - checks auth and exits if not authenticated
68
+ *
69
+ * Call this at the start of protected command handlers.
70
+ * Exits the process with code 1 if not authenticated.
71
+ *
72
+ * @param command - Command name being executed (for logging)
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * // In a command handler
77
+ * export function statusCommand() {
78
+ * authGuard('status');
79
+ * // ... rest of command (only runs if authenticated)
80
+ * }
81
+ * ```
82
+ */
83
+ export function authGuard(command) {
84
+ // Skip auth check for public commands
85
+ if (!requiresAuth(command)) {
86
+ return;
87
+ }
88
+ // Check if authenticated
89
+ if (isAuthenticated()) {
90
+ return;
91
+ }
92
+ // Not authenticated - show helpful error and exit
93
+ printAuthError();
94
+ process.exit(1);
95
+ }
96
+ /**
97
+ * Print authentication error message with instructions
98
+ *
99
+ * Provides clear guidance on how to authenticate.
100
+ */
101
+ function printAuthError() {
102
+ console.error(chalk.red('Error: Not authenticated.\n'));
103
+ console.error('You need to authenticate before running this command.\n');
104
+ console.error(chalk.bold('To authenticate:'));
105
+ console.error(` ${chalk.cyan('specforge-mcp login')} - Interactive login\n`);
106
+ console.error(chalk.bold('Or set environment variable:'));
107
+ console.error(` ${chalk.cyan('export SPECFORGE_API_KEY=sf_live_your_key')}\n`);
108
+ console.error(chalk.bold('Get your API key:'));
109
+ console.error(` ${chalk.underline('https://specforge.com.br/settings/api-keys')}\n`);
110
+ }
111
+ /**
112
+ * Check authentication without exiting
113
+ *
114
+ * Use this for conditional logic where you don't want to exit.
115
+ *
116
+ * @returns Object with auth status and config
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const { authenticated, config } = checkAuth();
121
+ * if (!authenticated) {
122
+ * // Handle gracefully without exiting
123
+ * }
124
+ * ```
125
+ */
126
+ export function checkAuth() {
127
+ const config = resolveConfig();
128
+ return {
129
+ authenticated: config.apiKey !== null,
130
+ apiKeySource: config.sources.apiKey,
131
+ };
132
+ }
133
+ /**
134
+ * Validate API key format
135
+ *
136
+ * Checks that the API key matches expected format without making API calls.
137
+ *
138
+ * @param apiKey - API key to validate
139
+ * @returns Object with validity and any error message
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * const { valid, error } = validateApiKeyFormat('sf_live_abc123');
144
+ * if (!valid) {
145
+ * console.error(error);
146
+ * }
147
+ * ```
148
+ */
149
+ export function validateApiKeyFormat(apiKey) {
150
+ // Check prefix
151
+ if (!apiKey.startsWith('sf_live_')) {
152
+ return {
153
+ valid: false,
154
+ error: 'API key must start with "sf_live_"',
155
+ };
156
+ }
157
+ // Check minimum length (prefix + at least 20 chars)
158
+ if (apiKey.length < 28) {
159
+ return {
160
+ valid: false,
161
+ error: 'API key is too short. Make sure you copied the complete key.',
162
+ };
163
+ }
164
+ // Check for invalid characters (should be alphanumeric after prefix)
165
+ const keyPart = apiKey.slice(8); // Remove 'sf_live_' prefix
166
+ if (!/^[a-zA-Z0-9_-]+$/.test(keyPart)) {
167
+ return {
168
+ valid: false,
169
+ error: 'API key contains invalid characters.',
170
+ };
171
+ }
172
+ return { valid: true };
173
+ }
174
+ /**
175
+ * Commander.js pre-action hook for auth guard
176
+ *
177
+ * Use this with Commander's hook system for automatic auth checking.
178
+ *
179
+ * @param thisCommand - Commander command object
180
+ *
181
+ * @example
182
+ * ```typescript
183
+ * program.hook('preAction', authGuardHook);
184
+ * ```
185
+ */
186
+ export function authGuardHook(thisCommand) {
187
+ const commandName = thisCommand.name();
188
+ authGuard(commandName);
189
+ }
190
+ //# sourceMappingURL=auth-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-guard.js","sourceRoot":"","sources":["../../../src/cli/middleware/auth-guard.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;;;;;;;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;AACzB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmC;IAC/D,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IACvC,SAAS,CAAC,WAAW,CAAC,CAAC;AACzB,CAAC"}
@@ -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;;;;;G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S,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,209 @@
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
+ import chalk from 'chalk';
8
+ import { CONFIG_ENV_VARS } from '../config/types.js';
9
+ /**
10
+ * Standard exit codes
11
+ */
12
+ export const EXIT_CODES = {
13
+ /** Successful execution */
14
+ SUCCESS: 0,
15
+ /** General error */
16
+ ERROR: 1,
17
+ /** Authentication error */
18
+ AUTH_ERROR: 2,
19
+ /** Configuration error */
20
+ CONFIG_ERROR: 3,
21
+ /** Network/API error */
22
+ NETWORK_ERROR: 4,
23
+ /** Not found error */
24
+ NOT_FOUND: 5,
25
+ /** Validation error */
26
+ VALIDATION_ERROR: 6,
27
+ };
28
+ /**
29
+ * Custom error class for CLI errors with exit codes
30
+ */
31
+ export class CliError extends Error {
32
+ exitCode;
33
+ hint;
34
+ constructor(message, exitCode = EXIT_CODES.ERROR, hint) {
35
+ super(message);
36
+ this.exitCode = exitCode;
37
+ this.hint = hint;
38
+ this.name = 'CliError';
39
+ }
40
+ }
41
+ /**
42
+ * Authentication error
43
+ */
44
+ export class AuthError extends CliError {
45
+ constructor(message = 'Not authenticated') {
46
+ super(message, EXIT_CODES.AUTH_ERROR, 'Run `specforge-mcp login` to authenticate');
47
+ }
48
+ }
49
+ /**
50
+ * Configuration error
51
+ */
52
+ export class ConfigError extends CliError {
53
+ constructor(message, hint) {
54
+ super(message, EXIT_CODES.CONFIG_ERROR, hint);
55
+ }
56
+ }
57
+ /**
58
+ * Network/API error
59
+ */
60
+ export class NetworkError extends CliError {
61
+ constructor(message, hint) {
62
+ super(message, EXIT_CODES.NETWORK_ERROR, hint || 'Check your internet connection and try again');
63
+ }
64
+ }
65
+ /**
66
+ * Not found error
67
+ */
68
+ export class NotFoundError extends CliError {
69
+ constructor(resource, identifier) {
70
+ const message = identifier
71
+ ? `${resource} not found: ${identifier}`
72
+ : `${resource} not found`;
73
+ super(message, EXIT_CODES.NOT_FOUND);
74
+ }
75
+ }
76
+ /**
77
+ * Validation error
78
+ */
79
+ export class ValidationError extends CliError {
80
+ constructor(message, hint) {
81
+ super(message, EXIT_CODES.VALIDATION_ERROR, hint);
82
+ }
83
+ }
84
+ /**
85
+ * Check if debug mode is enabled
86
+ */
87
+ export function isDebugMode() {
88
+ return process.env[CONFIG_ENV_VARS.DEBUG] === 'true';
89
+ }
90
+ /**
91
+ * Format error for display
92
+ *
93
+ * @param error - Error to format
94
+ * @returns Formatted error string
95
+ */
96
+ export function formatError(error) {
97
+ if (error instanceof CliError) {
98
+ let output = chalk.red(`Error: ${error.message}`);
99
+ if (error.hint) {
100
+ output += '\n' + chalk.yellow(`Hint: ${error.hint}`);
101
+ }
102
+ if (isDebugMode() && error.stack) {
103
+ output += '\n\n' + chalk.gray(error.stack);
104
+ }
105
+ return output;
106
+ }
107
+ if (error instanceof Error) {
108
+ let output = chalk.red(`Error: ${error.message}`);
109
+ if (isDebugMode() && error.stack) {
110
+ output += '\n\n' + chalk.gray(error.stack);
111
+ }
112
+ return output;
113
+ }
114
+ return chalk.red(`Error: ${String(error)}`);
115
+ }
116
+ /**
117
+ * Handle error and exit process
118
+ *
119
+ * @param error - Error to handle
120
+ */
121
+ export function handleError(error) {
122
+ console.error(formatError(error));
123
+ const exitCode = error instanceof CliError ? error.exitCode : EXIT_CODES.ERROR;
124
+ process.exit(exitCode);
125
+ }
126
+ /**
127
+ * Wrap an async function with error handling
128
+ *
129
+ * Use this to wrap command action handlers for automatic error handling.
130
+ *
131
+ * @param fn - Async function to wrap
132
+ * @returns Wrapped function that handles errors
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * program
137
+ * .command('status')
138
+ * .action(withErrorHandler(async () => {
139
+ * // If this throws, error is caught and formatted
140
+ * const data = await api.getStatus();
141
+ * }));
142
+ * ```
143
+ */
144
+ export function withErrorHandler(fn) {
145
+ return async (...args) => {
146
+ try {
147
+ await fn(...args);
148
+ }
149
+ catch (error) {
150
+ handleError(error);
151
+ }
152
+ };
153
+ }
154
+ /**
155
+ * Wrap a sync function with error handling
156
+ *
157
+ * @param fn - Sync function to wrap
158
+ * @returns Wrapped function that handles errors
159
+ */
160
+ export function withErrorHandlerSync(fn) {
161
+ return (...args) => {
162
+ try {
163
+ fn(...args);
164
+ }
165
+ catch (error) {
166
+ handleError(error);
167
+ }
168
+ };
169
+ }
170
+ /**
171
+ * Log debug information (only in debug mode)
172
+ *
173
+ * @param message - Message to log
174
+ * @param data - Optional data to log
175
+ */
176
+ export function debugLog(message, data) {
177
+ if (!isDebugMode()) {
178
+ return;
179
+ }
180
+ console.error(chalk.gray(`[DEBUG] ${message}`));
181
+ if (data !== undefined) {
182
+ console.error(chalk.gray(JSON.stringify(data, null, 2)));
183
+ }
184
+ }
185
+ /**
186
+ * Log warning message
187
+ *
188
+ * @param message - Warning message
189
+ */
190
+ export function warnLog(message) {
191
+ console.error(chalk.yellow(`Warning: ${message}`));
192
+ }
193
+ /**
194
+ * Log success message
195
+ *
196
+ * @param message - Success message
197
+ */
198
+ export function successLog(message) {
199
+ console.log(chalk.green(message));
200
+ }
201
+ /**
202
+ * Log info message
203
+ *
204
+ * @param message - Info message
205
+ */
206
+ export function infoLog(message) {
207
+ console.log(chalk.cyan(message));
208
+ }
209
+ //# sourceMappingURL=error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../../src/cli/middleware/error-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,2BAA2B;IAC3B,OAAO,EAAE,CAAC;IACV,oBAAoB;IACpB,KAAK,EAAE,CAAC;IACR,2BAA2B;IAC3B,UAAU,EAAE,CAAC;IACb,0BAA0B;IAC1B,YAAY,EAAE,CAAC;IACf,wBAAwB;IACxB,aAAa,EAAE,CAAC;IAChB,sBAAsB;IACtB,SAAS,EAAE,CAAC;IACZ,uBAAuB;IACvB,gBAAgB,EAAE,CAAC;CACX,CAAC;AAIX;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGf;IACA;IAHlB,YACE,OAAe,EACC,WAAqB,UAAU,CAAC,KAAK,EACrC,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,aAAQ,GAAR,QAAQ,CAA6B;QACrC,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,QAAQ;IACrC,YAAY,UAAkB,mBAAmB;QAC/C,KAAK,CAAC,OAAO,EAAE,UA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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,6 @@
1
+ /**
2
+ * CLI Middleware Module
3
+ */
4
+ export * from './auth-guard.js';
5
+ export * from './error-handler.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/middleware/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Command Templates Module
3
+ *
4
+ * Defines all SpecForge slash commands with their full markdown content
5
+ * for scaffolding to AI CLI tools.
6
+ */
7
+ import type { CommandTemplate } from '../commands/scaffold/types.js';
8
+ /**
9
+ * Get all command templates
10
+ */
11
+ export declare function getCommandTemplates(): CommandTemplate[];
12
+ /**
13
+ * Get a specific command template by name
14
+ */
15
+ export declare function getCommandTemplate(name: string): CommandTemplate | undefined;
16
+ /**
17
+ * Get command templates by category
18
+ */
19
+ export declare function getCommandsByCategory(category: string): CommandTemplate[];
20
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/cli/templates/commands.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAsBrE;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,eAAe,EAAE,CAoIvD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAE5E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,CAEzE"}