@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.
- package/README.md +324 -0
- package/bin/specforge-mcp +19 -1
- package/dist/cli/commands/blocked.d.ts +16 -0
- package/dist/cli/commands/blocked.d.ts.map +1 -0
- package/dist/cli/commands/blocked.js +214 -0
- package/dist/cli/commands/blocked.js.map +1 -0
- package/dist/cli/commands/configure.d.ts +16 -0
- package/dist/cli/commands/configure.d.ts.map +1 -0
- package/dist/cli/commands/configure.js +218 -0
- package/dist/cli/commands/configure.js.map +1 -0
- package/dist/cli/commands/configure.types.d.ts +110 -0
- package/dist/cli/commands/configure.types.d.ts.map +1 -0
- package/dist/cli/commands/configure.types.js +105 -0
- package/dist/cli/commands/configure.types.js.map +1 -0
- package/dist/cli/commands/debug/call.d.ts +14 -0
- package/dist/cli/commands/debug/call.d.ts.map +1 -0
- package/dist/cli/commands/debug/call.js +117 -0
- package/dist/cli/commands/debug/call.js.map +1 -0
- package/dist/cli/commands/debug/index.d.ts +12 -0
- package/dist/cli/commands/debug/index.d.ts.map +1 -0
- package/dist/cli/commands/debug/index.js +12 -0
- package/dist/cli/commands/debug/index.js.map +1 -0
- package/dist/cli/commands/debug/register.d.ts +11 -0
- package/dist/cli/commands/debug/register.d.ts.map +1 -0
- package/dist/cli/commands/debug/register.js +90 -0
- package/dist/cli/commands/debug/register.js.map +1 -0
- package/dist/cli/commands/debug/test.d.ts +13 -0
- package/dist/cli/commands/debug/test.d.ts.map +1 -0
- package/dist/cli/commands/debug/test.js +117 -0
- package/dist/cli/commands/debug/test.js.map +1 -0
- package/dist/cli/commands/debug/tools.d.ts +13 -0
- package/dist/cli/commands/debug/tools.d.ts.map +1 -0
- package/dist/cli/commands/debug/tools.js +117 -0
- package/dist/cli/commands/debug/tools.js.map +1 -0
- package/dist/cli/commands/debug/types.d.ts +117 -0
- package/dist/cli/commands/debug/types.d.ts.map +1 -0
- package/dist/cli/commands/debug/types.js +43 -0
- package/dist/cli/commands/debug/types.js.map +1 -0
- package/dist/cli/commands/debug/whoami.d.ts +13 -0
- package/dist/cli/commands/debug/whoami.d.ts.map +1 -0
- package/dist/cli/commands/debug/whoami.js +161 -0
- package/dist/cli/commands/debug/whoami.js.map +1 -0
- package/dist/cli/commands/docs/content/api.d.ts +7 -0
- package/dist/cli/commands/docs/content/api.d.ts.map +1 -0
- package/dist/cli/commands/docs/content/api.js +64 -0
- package/dist/cli/commands/docs/content/api.js.map +1 -0
- package/dist/cli/commands/docs/content/concepts.d.ts +7 -0
- package/dist/cli/commands/docs/content/concepts.d.ts.map +1 -0
- package/dist/cli/commands/docs/content/concepts.js +68 -0
- package/dist/cli/commands/docs/content/concepts.js.map +1 -0
- package/dist/cli/commands/docs/content/examples.d.ts +7 -0
- package/dist/cli/commands/docs/content/examples.d.ts.map +1 -0
- package/dist/cli/commands/docs/content/examples.js +84 -0
- package/dist/cli/commands/docs/content/examples.js.map +1 -0
- package/dist/cli/commands/docs/content/index.d.ts +10 -0
- package/dist/cli/commands/docs/content/index.d.ts.map +1 -0
- package/dist/cli/commands/docs/content/index.js +10 -0
- package/dist/cli/commands/docs/content/index.js.map +1 -0
- package/dist/cli/commands/docs/content/workflow.d.ts +7 -0
- package/dist/cli/commands/docs/content/workflow.d.ts.map +1 -0
- package/dist/cli/commands/docs/content/workflow.js +44 -0
- package/dist/cli/commands/docs/content/workflow.js.map +1 -0
- package/dist/cli/commands/docs/content.d.ts +23 -0
- package/dist/cli/commands/docs/content.d.ts.map +1 -0
- package/dist/cli/commands/docs/content.js +38 -0
- package/dist/cli/commands/docs/content.js.map +1 -0
- package/dist/cli/commands/docs/display.d.ts +26 -0
- package/dist/cli/commands/docs/display.d.ts.map +1 -0
- package/dist/cli/commands/docs/display.js +53 -0
- package/dist/cli/commands/docs/display.js.map +1 -0
- package/dist/cli/commands/docs/docs.d.ts +19 -0
- package/dist/cli/commands/docs/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs/docs.js +124 -0
- package/dist/cli/commands/docs/docs.js.map +1 -0
- package/dist/cli/commands/docs/index.d.ts +13 -0
- package/dist/cli/commands/docs/index.d.ts.map +1 -0
- package/dist/cli/commands/docs/index.js +13 -0
- package/dist/cli/commands/docs/index.js.map +1 -0
- package/dist/cli/commands/docs/register.d.ts +23 -0
- package/dist/cli/commands/docs/register.d.ts.map +1 -0
- package/dist/cli/commands/docs/register.js +64 -0
- package/dist/cli/commands/docs/register.js.map +1 -0
- package/dist/cli/commands/docs/tool-docs.d.ts +44 -0
- package/dist/cli/commands/docs/tool-docs.d.ts.map +1 -0
- package/dist/cli/commands/docs/tool-docs.js +182 -0
- package/dist/cli/commands/docs/tool-docs.js.map +1 -0
- package/dist/cli/commands/docs/tool-examples.d.ts +14 -0
- package/dist/cli/commands/docs/tool-examples.d.ts.map +1 -0
- package/dist/cli/commands/docs/tool-examples.js +127 -0
- package/dist/cli/commands/docs/tool-examples.js.map +1 -0
- package/dist/cli/commands/docs/types.d.ts +108 -0
- package/dist/cli/commands/docs/types.d.ts.map +1 -0
- package/dist/cli/commands/docs/types.js +33 -0
- package/dist/cli/commands/docs/types.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +16 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +322 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/doctor.types.d.ts +177 -0
- package/dist/cli/commands/doctor.types.d.ts.map +1 -0
- package/dist/cli/commands/doctor.types.js +172 -0
- package/dist/cli/commands/doctor.types.js.map +1 -0
- package/dist/cli/commands/index.d.ts +18 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +18 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +17 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +326 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/init.types.d.ts +141 -0
- package/dist/cli/commands/init.types.d.ts.map +1 -0
- package/dist/cli/commands/init.types.js +24 -0
- package/dist/cli/commands/init.types.js.map +1 -0
- package/dist/cli/commands/login.d.ts +40 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +174 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/commands/next.d.ts +16 -0
- package/dist/cli/commands/next.d.ts.map +1 -0
- package/dist/cli/commands/next.js +279 -0
- package/dist/cli/commands/next.js.map +1 -0
- package/dist/cli/commands/next.types.d.ts +191 -0
- package/dist/cli/commands/next.types.d.ts.map +1 -0
- package/dist/cli/commands/next.types.js +129 -0
- package/dist/cli/commands/next.types.js.map +1 -0
- package/dist/cli/commands/projects.d.ts +16 -0
- package/dist/cli/commands/projects.d.ts.map +1 -0
- package/dist/cli/commands/projects.js +149 -0
- package/dist/cli/commands/projects.js.map +1 -0
- package/dist/cli/commands/projects.types.d.ts +81 -0
- package/dist/cli/commands/projects.types.d.ts.map +1 -0
- package/dist/cli/commands/projects.types.js +35 -0
- package/dist/cli/commands/projects.types.js.map +1 -0
- package/dist/cli/commands/review/display.d.ts +33 -0
- package/dist/cli/commands/review/display.d.ts.map +1 -0
- package/dist/cli/commands/review/display.js +159 -0
- package/dist/cli/commands/review/display.js.map +1 -0
- package/dist/cli/commands/review/epic-review.d.ts +13 -0
- package/dist/cli/commands/review/epic-review.d.ts.map +1 -0
- package/dist/cli/commands/review/epic-review.js +69 -0
- package/dist/cli/commands/review/epic-review.js.map +1 -0
- package/dist/cli/commands/review/index.d.ts +13 -0
- package/dist/cli/commands/review/index.d.ts.map +1 -0
- package/dist/cli/commands/review/index.js +17 -0
- package/dist/cli/commands/review/index.js.map +1 -0
- package/dist/cli/commands/review/report.d.ts +31 -0
- package/dist/cli/commands/review/report.d.ts.map +1 -0
- package/dist/cli/commands/review/report.js +146 -0
- package/dist/cli/commands/review/report.js.map +1 -0
- package/dist/cli/commands/review/review.d.ts +17 -0
- package/dist/cli/commands/review/review.d.ts.map +1 -0
- package/dist/cli/commands/review/review.js +129 -0
- package/dist/cli/commands/review/review.js.map +1 -0
- package/dist/cli/commands/review/spec-review.d.ts +13 -0
- package/dist/cli/commands/review/spec-review.d.ts.map +1 -0
- package/dist/cli/commands/review/spec-review.js +65 -0
- package/dist/cli/commands/review/spec-review.js.map +1 -0
- package/dist/cli/commands/review/ticket-review.d.ts +37 -0
- package/dist/cli/commands/review/ticket-review.d.ts.map +1 -0
- package/dist/cli/commands/review/ticket-review.js +194 -0
- package/dist/cli/commands/review/ticket-review.js.map +1 -0
- package/dist/cli/commands/review/types.d.ts +232 -0
- package/dist/cli/commands/review/types.d.ts.map +1 -0
- package/dist/cli/commands/review/types.js +85 -0
- package/dist/cli/commands/review/types.js.map +1 -0
- package/dist/cli/commands/scaffold/display.d.ts +27 -0
- package/dist/cli/commands/scaffold/display.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/display.js +90 -0
- package/dist/cli/commands/scaffold/display.js.map +1 -0
- package/dist/cli/commands/scaffold/index.d.ts +12 -0
- package/dist/cli/commands/scaffold/index.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/index.js +12 -0
- package/dist/cli/commands/scaffold/index.js.map +1 -0
- package/dist/cli/commands/scaffold/register.d.ts +11 -0
- package/dist/cli/commands/scaffold/register.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/register.js +25 -0
- package/dist/cli/commands/scaffold/register.js.map +1 -0
- package/dist/cli/commands/scaffold/scaffold.d.ts +11 -0
- package/dist/cli/commands/scaffold/scaffold.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/scaffold.js +111 -0
- package/dist/cli/commands/scaffold/scaffold.js.map +1 -0
- package/dist/cli/commands/scaffold/targets.d.ts +31 -0
- package/dist/cli/commands/scaffold/targets.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/targets.js +84 -0
- package/dist/cli/commands/scaffold/targets.js.map +1 -0
- package/dist/cli/commands/scaffold/types.d.ts +88 -0
- package/dist/cli/commands/scaffold/types.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/types.js +21 -0
- package/dist/cli/commands/scaffold/types.js.map +1 -0
- package/dist/cli/commands/scaffold/utils.d.ts +31 -0
- package/dist/cli/commands/scaffold/utils.d.ts.map +1 -0
- package/dist/cli/commands/scaffold/utils.js +71 -0
- package/dist/cli/commands/scaffold/utils.js.map +1 -0
- package/dist/cli/commands/session/display.d.ts +40 -0
- package/dist/cli/commands/session/display.d.ts.map +1 -0
- package/dist/cli/commands/session/display.js +114 -0
- package/dist/cli/commands/session/display.js.map +1 -0
- package/dist/cli/commands/session/end.d.ts +12 -0
- package/dist/cli/commands/session/end.d.ts.map +1 -0
- package/dist/cli/commands/session/end.js +165 -0
- package/dist/cli/commands/session/end.js.map +1 -0
- package/dist/cli/commands/session/index.d.ts +13 -0
- package/dist/cli/commands/session/index.d.ts.map +1 -0
- package/dist/cli/commands/session/index.js +13 -0
- package/dist/cli/commands/session/index.js.map +1 -0
- package/dist/cli/commands/session/register.d.ts +12 -0
- package/dist/cli/commands/session/register.d.ts.map +1 -0
- package/dist/cli/commands/session/register.js +87 -0
- package/dist/cli/commands/session/register.js.map +1 -0
- package/dist/cli/commands/session/start.d.ts +12 -0
- package/dist/cli/commands/session/start.d.ts.map +1 -0
- package/dist/cli/commands/session/start.js +189 -0
- package/dist/cli/commands/session/start.js.map +1 -0
- package/dist/cli/commands/session/status.d.ts +12 -0
- package/dist/cli/commands/session/status.d.ts.map +1 -0
- package/dist/cli/commands/session/status.js +93 -0
- package/dist/cli/commands/session/status.js.map +1 -0
- package/dist/cli/commands/session/types.d.ts +179 -0
- package/dist/cli/commands/session/types.d.ts.map +1 -0
- package/dist/cli/commands/session/types.js +8 -0
- package/dist/cli/commands/session/types.js.map +1 -0
- package/dist/cli/commands/session/utils.d.ts +24 -0
- package/dist/cli/commands/session/utils.d.ts.map +1 -0
- package/dist/cli/commands/session/utils.js +72 -0
- package/dist/cli/commands/session/utils.js.map +1 -0
- package/dist/cli/commands/specs.d.ts +16 -0
- package/dist/cli/commands/specs.d.ts.map +1 -0
- package/dist/cli/commands/specs.js +212 -0
- package/dist/cli/commands/specs.js.map +1 -0
- package/dist/cli/commands/specs.types.d.ts +120 -0
- package/dist/cli/commands/specs.types.d.ts.map +1 -0
- package/dist/cli/commands/specs.types.js +75 -0
- package/dist/cli/commands/specs.types.js.map +1 -0
- package/dist/cli/commands/status.d.ts +17 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +271 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/status.types.d.ts +382 -0
- package/dist/cli/commands/status.types.d.ts.map +1 -0
- package/dist/cli/commands/status.types.js +166 -0
- package/dist/cli/commands/status.types.js.map +1 -0
- package/dist/cli/commands/switch.d.ts +18 -0
- package/dist/cli/commands/switch.d.ts.map +1 -0
- package/dist/cli/commands/switch.js +181 -0
- package/dist/cli/commands/switch.js.map +1 -0
- package/dist/cli/commands/switch.types.d.ts +123 -0
- package/dist/cli/commands/switch.types.d.ts.map +1 -0
- package/dist/cli/commands/switch.types.js +65 -0
- package/dist/cli/commands/switch.types.js.map +1 -0
- package/dist/cli/commands/ticket/command.d.ts +14 -0
- package/dist/cli/commands/ticket/command.d.ts.map +1 -0
- package/dist/cli/commands/ticket/command.js +141 -0
- package/dist/cli/commands/ticket/command.js.map +1 -0
- package/dist/cli/commands/ticket/display.d.ts +56 -0
- package/dist/cli/commands/ticket/display.d.ts.map +1 -0
- package/dist/cli/commands/ticket/display.js +205 -0
- package/dist/cli/commands/ticket/display.js.map +1 -0
- package/dist/cli/commands/ticket/index.d.ts +11 -0
- package/dist/cli/commands/ticket/index.d.ts.map +1 -0
- package/dist/cli/commands/ticket/index.js +11 -0
- package/dist/cli/commands/ticket/index.js.map +1 -0
- package/dist/cli/commands/ticket/register.d.ts +11 -0
- package/dist/cli/commands/ticket/register.d.ts.map +1 -0
- package/dist/cli/commands/ticket/register.js +39 -0
- package/dist/cli/commands/ticket/register.js.map +1 -0
- package/dist/cli/commands/ticket/resolver.d.ts +16 -0
- package/dist/cli/commands/ticket/resolver.d.ts.map +1 -0
- package/dist/cli/commands/ticket/resolver.js +35 -0
- package/dist/cli/commands/ticket/resolver.js.map +1 -0
- package/dist/cli/commands/ticket/types.d.ts +157 -0
- package/dist/cli/commands/ticket/types.d.ts.map +1 -0
- package/dist/cli/commands/ticket/types.js +8 -0
- package/dist/cli/commands/ticket/types.js.map +1 -0
- package/dist/cli/commands/tickets.d.ts +16 -0
- package/dist/cli/commands/tickets.d.ts.map +1 -0
- package/dist/cli/commands/tickets.js +271 -0
- package/dist/cli/commands/tickets.js.map +1 -0
- package/dist/cli/commands/tickets.types.d.ts +202 -0
- package/dist/cli/commands/tickets.types.d.ts.map +1 -0
- package/dist/cli/commands/tickets.types.js +138 -0
- package/dist/cli/commands/tickets.types.js.map +1 -0
- package/dist/cli/config/index.d.ts +11 -0
- package/dist/cli/config/index.d.ts.map +1 -0
- package/dist/cli/config/index.js +11 -0
- package/dist/cli/config/index.js.map +1 -0
- package/dist/cli/config/loader.d.ts +98 -0
- package/dist/cli/config/loader.d.ts.map +1 -0
- package/dist/cli/config/loader.js +237 -0
- package/dist/cli/config/loader.js.map +1 -0
- package/dist/cli/config/paths.d.ts +96 -0
- package/dist/cli/config/paths.d.ts.map +1 -0
- package/dist/cli/config/paths.js +140 -0
- package/dist/cli/config/paths.js.map +1 -0
- package/dist/cli/config/types.d.ts +148 -0
- package/dist/cli/config/types.d.ts.map +1 -0
- package/dist/cli/config/types.js +34 -0
- package/dist/cli/config/types.js.map +1 -0
- package/dist/cli/config/writer.d.ts +171 -0
- package/dist/cli/config/writer.d.ts.map +1 -0
- package/dist/cli/config/writer.js +312 -0
- package/dist/cli/config/writer.js.map +1 -0
- package/dist/cli/index.d.ts +30 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +183 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/middleware/auth-guard.d.ts +107 -0
- package/dist/cli/middleware/auth-guard.d.ts.map +1 -0
- package/dist/cli/middleware/auth-guard.js +190 -0
- package/dist/cli/middleware/auth-guard.js.map +1 -0
- package/dist/cli/middleware/error-handler.d.ts +133 -0
- package/dist/cli/middleware/error-handler.d.ts.map +1 -0
- package/dist/cli/middleware/error-handler.js +209 -0
- package/dist/cli/middleware/error-handler.js.map +1 -0
- package/dist/cli/middleware/index.d.ts +6 -0
- package/dist/cli/middleware/index.d.ts.map +1 -0
- package/dist/cli/middleware/index.js +6 -0
- package/dist/cli/middleware/index.js.map +1 -0
- package/dist/cli/templates/commands.d.ts +20 -0
- package/dist/cli/templates/commands.d.ts.map +1 -0
- package/dist/cli/templates/commands.js +174 -0
- package/dist/cli/templates/commands.js.map +1 -0
- package/dist/cli/templates/content/sf-autonomous.d.ts +7 -0
- package/dist/cli/templates/content/sf-autonomous.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-autonomous.js +78 -0
- package/dist/cli/templates/content/sf-autonomous.js.map +1 -0
- package/dist/cli/templates/content/sf-blockers.d.ts +7 -0
- package/dist/cli/templates/content/sf-blockers.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-blockers.js +68 -0
- package/dist/cli/templates/content/sf-blockers.js.map +1 -0
- package/dist/cli/templates/content/sf-commit.d.ts +7 -0
- package/dist/cli/templates/content/sf-commit.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-commit.js +78 -0
- package/dist/cli/templates/content/sf-commit.js.map +1 -0
- package/dist/cli/templates/content/sf-context.d.ts +7 -0
- package/dist/cli/templates/content/sf-context.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-context.js +64 -0
- package/dist/cli/templates/content/sf-context.js.map +1 -0
- package/dist/cli/templates/content/sf-create-epics.d.ts +7 -0
- package/dist/cli/templates/content/sf-create-epics.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-create-epics.js +70 -0
- package/dist/cli/templates/content/sf-create-epics.js.map +1 -0
- package/dist/cli/templates/content/sf-create-spec.d.ts +7 -0
- package/dist/cli/templates/content/sf-create-spec.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-create-spec.js +67 -0
- package/dist/cli/templates/content/sf-create-spec.js.map +1 -0
- package/dist/cli/templates/content/sf-create-tickets.d.ts +7 -0
- package/dist/cli/templates/content/sf-create-tickets.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-create-tickets.js +76 -0
- package/dist/cli/templates/content/sf-create-tickets.js.map +1 -0
- package/dist/cli/templates/content/sf-epic.d.ts +7 -0
- package/dist/cli/templates/content/sf-epic.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-epic.js +69 -0
- package/dist/cli/templates/content/sf-epic.js.map +1 -0
- package/dist/cli/templates/content/sf-help.d.ts +7 -0
- package/dist/cli/templates/content/sf-help.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-help.js +61 -0
- package/dist/cli/templates/content/sf-help.js.map +1 -0
- package/dist/cli/templates/content/sf-import.d.ts +7 -0
- package/dist/cli/templates/content/sf-import.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-import.js +88 -0
- package/dist/cli/templates/content/sf-import.js.map +1 -0
- package/dist/cli/templates/content/sf-init.d.ts +7 -0
- package/dist/cli/templates/content/sf-init.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-init.js +61 -0
- package/dist/cli/templates/content/sf-init.js.map +1 -0
- package/dist/cli/templates/content/sf-next.d.ts +7 -0
- package/dist/cli/templates/content/sf-next.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-next.js +67 -0
- package/dist/cli/templates/content/sf-next.js.map +1 -0
- package/dist/cli/templates/content/sf-reset.d.ts +7 -0
- package/dist/cli/templates/content/sf-reset.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-reset.js +78 -0
- package/dist/cli/templates/content/sf-reset.js.map +1 -0
- package/dist/cli/templates/content/sf-review.d.ts +7 -0
- package/dist/cli/templates/content/sf-review.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-review.js +67 -0
- package/dist/cli/templates/content/sf-review.js.map +1 -0
- package/dist/cli/templates/content/sf-search.d.ts +7 -0
- package/dist/cli/templates/content/sf-search.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-search.js +64 -0
- package/dist/cli/templates/content/sf-search.js.map +1 -0
- package/dist/cli/templates/content/sf-status.d.ts +7 -0
- package/dist/cli/templates/content/sf-status.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-status.js +67 -0
- package/dist/cli/templates/content/sf-status.js.map +1 -0
- package/dist/cli/templates/content/sf-ticket.d.ts +7 -0
- package/dist/cli/templates/content/sf-ticket.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-ticket.js +76 -0
- package/dist/cli/templates/content/sf-ticket.js.map +1 -0
- package/dist/cli/templates/content/sf-validate.d.ts +7 -0
- package/dist/cli/templates/content/sf-validate.d.ts.map +1 -0
- package/dist/cli/templates/content/sf-validate.js +78 -0
- package/dist/cli/templates/content/sf-validate.js.map +1 -0
- package/dist/cli/templates/index.d.ts +7 -0
- package/dist/cli/templates/index.d.ts.map +1 -0
- package/dist/cli/templates/index.js +7 -0
- package/dist/cli/templates/index.js.map +1 -0
- package/dist/cli/ui/colors.d.ts +76 -0
- package/dist/cli/ui/colors.d.ts.map +1 -0
- package/dist/cli/ui/colors.js +81 -0
- package/dist/cli/ui/colors.js.map +1 -0
- package/dist/cli/ui/dashboard.d.ts +54 -0
- package/dist/cli/ui/dashboard.d.ts.map +1 -0
- package/dist/cli/ui/dashboard.js +339 -0
- package/dist/cli/ui/dashboard.js.map +1 -0
- package/dist/cli/ui/index.d.ts +7 -0
- package/dist/cli/ui/index.d.ts.map +1 -0
- package/dist/cli/ui/index.js +7 -0
- package/dist/cli/ui/index.js.map +1 -0
- package/dist/cli/ui/output.d.ts +117 -0
- package/dist/cli/ui/output.d.ts.map +1 -0
- package/dist/cli/ui/output.js +172 -0
- package/dist/cli/ui/output.js.map +1 -0
- package/dist/cli/ui/spinner.d.ts +105 -0
- package/dist/cli/ui/spinner.d.ts.map +1 -0
- package/dist/cli/ui/spinner.js +148 -0
- package/dist/cli/ui/spinner.js.map +1 -0
- package/dist/cli/ui/time.d.ts +54 -0
- package/dist/cli/ui/time.d.ts.map +1 -0
- package/dist/cli/ui/time.js +173 -0
- package/dist/cli/ui/time.js.map +1 -0
- package/dist/lib/format.d.ts +4 -4
- package/dist/lib/format.js +5 -5
- package/dist/server.js +8 -8
- package/dist/server.js.map +1 -1
- package/dist/tools/core/session.js +6 -6
- package/dist/tools/core/session.js.map +1 -1
- package/dist/tools/index.js +9 -9
- package/dist/tools/index.js.map +1 -1
- package/dist/validation/index.js +1 -1
- package/dist/validation/index.js.map +1 -1
- package/package.json +9 -2
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Writer
|
|
3
|
+
*
|
|
4
|
+
* Provides safe config file writing with atomic operations and proper permissions.
|
|
5
|
+
*
|
|
6
|
+
* Security features:
|
|
7
|
+
* - Global config (contains API key) written with mode 0600 (owner read/write only)
|
|
8
|
+
* - Global directory created with mode 0700 (owner access only)
|
|
9
|
+
* - Project config written with standard permissions (0644)
|
|
10
|
+
* - Path validation to prevent writes outside allowed directories
|
|
11
|
+
*/
|
|
12
|
+
import fs from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
import { getGlobalConfigDir, getGlobalConfigPath, getProjectConfigPath, getMcpConfigPath, } from './paths.js';
|
|
15
|
+
import { loadGlobalConfig, loadProjectConfig } from './loader.js';
|
|
16
|
+
/**
|
|
17
|
+
* File permission constants
|
|
18
|
+
*/
|
|
19
|
+
const PERMISSIONS = {
|
|
20
|
+
/** Directory accessible only by owner (rwx------) */
|
|
21
|
+
SECURE_DIR: 0o700,
|
|
22
|
+
/** File readable/writable only by owner (rw-------) */
|
|
23
|
+
SECRET_FILE: 0o600,
|
|
24
|
+
/** Regular file permissions (rw-r--r--) */
|
|
25
|
+
REGULAR_FILE: 0o644,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Ensure global config directory exists with secure permissions
|
|
29
|
+
*
|
|
30
|
+
* Creates ~/.specforge/ if it doesn't exist, with mode 0700 (owner-only access).
|
|
31
|
+
* Idempotent - safe to call multiple times.
|
|
32
|
+
*
|
|
33
|
+
* @throws Error if directory creation fails
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* ensureGlobalDir();
|
|
38
|
+
* // ~/.specforge/ now exists with drwx------ permissions
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function ensureGlobalDir() {
|
|
42
|
+
const globalDir = getGlobalConfigDir();
|
|
43
|
+
if (fs.existsSync(globalDir)) {
|
|
44
|
+
return; // Already exists
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
fs.mkdirSync(globalDir, { mode: PERMISSIONS.SECURE_DIR, recursive: true });
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new Error(`Failed to create global config directory: ${globalDir}\n` +
|
|
51
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Save global configuration
|
|
56
|
+
*
|
|
57
|
+
* Merges the provided config with existing global config and writes to
|
|
58
|
+
* ~/.specforge/config.json with secure permissions (0600).
|
|
59
|
+
*
|
|
60
|
+
* Undefined values are removed from the final config.
|
|
61
|
+
*
|
|
62
|
+
* @param config - Partial global config to save
|
|
63
|
+
* @throws Error if write fails
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* // Save API key
|
|
68
|
+
* saveGlobalConfig({ apiKey: 'sf_live_...' });
|
|
69
|
+
*
|
|
70
|
+
* // Update format, keeping existing apiKey
|
|
71
|
+
* saveGlobalConfig({ format: 'json' });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export function saveGlobalConfig(config) {
|
|
75
|
+
ensureGlobalDir();
|
|
76
|
+
const configPath = getGlobalConfigPath();
|
|
77
|
+
// Load existing config
|
|
78
|
+
const existing = loadGlobalConfig();
|
|
79
|
+
// Merge configs
|
|
80
|
+
const merged = {
|
|
81
|
+
...existing,
|
|
82
|
+
...config,
|
|
83
|
+
};
|
|
84
|
+
// Remove undefined values
|
|
85
|
+
Object.keys(merged).forEach(key => {
|
|
86
|
+
if (merged[key] === undefined) {
|
|
87
|
+
delete merged[key];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
// Write with secure permissions
|
|
91
|
+
const content = JSON.stringify(merged, null, 2) + '\n';
|
|
92
|
+
try {
|
|
93
|
+
fs.writeFileSync(configPath, content, { mode: PERMISSIONS.SECRET_FILE });
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new Error(`Failed to write global config: ${configPath}\n` +
|
|
97
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Delete a field from global config
|
|
102
|
+
*
|
|
103
|
+
* Loads existing config, removes the specified field, and saves.
|
|
104
|
+
* No-op if the field doesn't exist.
|
|
105
|
+
*
|
|
106
|
+
* @param field - Field name to remove
|
|
107
|
+
* @throws Error if read/write fails
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* deleteGlobalConfigField('apiKey');
|
|
112
|
+
* deleteGlobalConfigField('defaultProjectId');
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export function deleteGlobalConfigField(field) {
|
|
116
|
+
const configPath = getGlobalConfigPath();
|
|
117
|
+
if (!fs.existsSync(configPath)) {
|
|
118
|
+
return; // No config to modify
|
|
119
|
+
}
|
|
120
|
+
const existing = loadGlobalConfig();
|
|
121
|
+
// Remove field
|
|
122
|
+
delete existing[field];
|
|
123
|
+
// Save updated config
|
|
124
|
+
const content = JSON.stringify(existing, null, 2) + '\n';
|
|
125
|
+
try {
|
|
126
|
+
fs.writeFileSync(configPath, content, { mode: PERMISSIONS.SECRET_FILE });
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new Error(`Failed to update global config: ${configPath}\n` +
|
|
130
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Save project configuration
|
|
135
|
+
*
|
|
136
|
+
* Merges the provided config with existing project config and writes to
|
|
137
|
+
* .specforge.json in the current directory.
|
|
138
|
+
*
|
|
139
|
+
* Undefined values are removed from the final config.
|
|
140
|
+
*
|
|
141
|
+
* @param config - Partial project config to save
|
|
142
|
+
* @param targetDir - Directory to write .specforge.json to (defaults to cwd)
|
|
143
|
+
* @throws Error if write fails
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* // Initialize project
|
|
148
|
+
* saveProjectConfig({
|
|
149
|
+
* projectId: 'proj_123',
|
|
150
|
+
* specificationId: 'spec_456',
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* // Update format setting
|
|
154
|
+
* saveProjectConfig({ format: 'json' });
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export function saveProjectConfig(config, targetDir) {
|
|
158
|
+
const configPath = targetDir
|
|
159
|
+
? path.join(path.resolve(targetDir), '.specforge.json')
|
|
160
|
+
: getProjectConfigPath();
|
|
161
|
+
// Load existing config (may be null if new file)
|
|
162
|
+
const existing = loadProjectConfig() || {};
|
|
163
|
+
// Merge configs
|
|
164
|
+
const merged = {
|
|
165
|
+
...existing,
|
|
166
|
+
...config,
|
|
167
|
+
};
|
|
168
|
+
// Remove undefined values
|
|
169
|
+
Object.keys(merged).forEach(key => {
|
|
170
|
+
if (merged[key] === undefined) {
|
|
171
|
+
delete merged[key];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
// Write with standard permissions
|
|
175
|
+
const content = JSON.stringify(merged, null, 2) + '\n';
|
|
176
|
+
try {
|
|
177
|
+
fs.writeFileSync(configPath, content, { mode: PERMISSIONS.REGULAR_FILE });
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
throw new Error(`Failed to write project config: ${configPath}\n` +
|
|
181
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Generate MCP configuration for Claude Code integration
|
|
186
|
+
*
|
|
187
|
+
* Creates a .mcp.json configuration that registers the SpecForge MCP server
|
|
188
|
+
* for Claude Code. The server is registered under the @specforge/mcp
|
|
189
|
+
* package name.
|
|
190
|
+
*
|
|
191
|
+
* @returns MCP config object
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* const mcpConfig = generateMcpConfig();
|
|
196
|
+
* console.log(mcpConfig.mcpServers['@specforge/mcp']);
|
|
197
|
+
* // { command: 'npx', args: [...] }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
export function generateMcpConfig() {
|
|
201
|
+
return {
|
|
202
|
+
mcpServers: {
|
|
203
|
+
'@specforge/mcp': {
|
|
204
|
+
command: 'npx',
|
|
205
|
+
args: ['-y', '@specforge/mcp'],
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Save MCP configuration file
|
|
212
|
+
*
|
|
213
|
+
* Writes .mcp.json to the current directory (or specified directory)
|
|
214
|
+
* to enable Claude Code integration with the SpecForge MCP server.
|
|
215
|
+
*
|
|
216
|
+
* @param targetDir - Directory to write .mcp.json to (defaults to cwd)
|
|
217
|
+
* @throws Error if write fails
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* saveMcpConfig();
|
|
222
|
+
* // .mcp.json created in current directory
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export function saveMcpConfig(targetDir) {
|
|
226
|
+
const configPath = targetDir
|
|
227
|
+
? path.join(path.resolve(targetDir), '.mcp.json')
|
|
228
|
+
: getMcpConfigPath();
|
|
229
|
+
const content = JSON.stringify(generateMcpConfig(), null, 2) + '\n';
|
|
230
|
+
try {
|
|
231
|
+
fs.writeFileSync(configPath, content, { mode: PERMISSIONS.REGULAR_FILE });
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
throw new Error(`Failed to write MCP config: ${configPath}\n` +
|
|
235
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Add an entry to .gitignore if it exists
|
|
240
|
+
*
|
|
241
|
+
* Does not create .gitignore if it doesn't exist.
|
|
242
|
+
* Does not duplicate existing entries.
|
|
243
|
+
*
|
|
244
|
+
* @param entry - Line to add to .gitignore
|
|
245
|
+
* @param targetDir - Directory containing .gitignore (defaults to cwd)
|
|
246
|
+
* @returns true if entry was added, false if already exists or no .gitignore
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```typescript
|
|
250
|
+
* const added = addToGitignore('.specforge.json');
|
|
251
|
+
* if (added) {
|
|
252
|
+
* console.log('Added .specforge.json to .gitignore');
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export function addToGitignore(entry, targetDir) {
|
|
257
|
+
const gitignorePath = targetDir
|
|
258
|
+
? path.join(path.resolve(targetDir), '.gitignore')
|
|
259
|
+
: path.resolve('.gitignore');
|
|
260
|
+
if (!fs.existsSync(gitignorePath)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
const content = fs.readFileSync(gitignorePath, 'utf-8');
|
|
265
|
+
const lines = content.split('\n');
|
|
266
|
+
// Check if entry already exists (exact match, trimmed)
|
|
267
|
+
const normalizedEntry = entry.trim();
|
|
268
|
+
if (lines.some(line => line.trim() === normalizedEntry)) {
|
|
269
|
+
return false; // Already exists
|
|
270
|
+
}
|
|
271
|
+
// Add entry with proper newline handling
|
|
272
|
+
const newContent = content.endsWith('\n')
|
|
273
|
+
? content + normalizedEntry + '\n'
|
|
274
|
+
: content + '\n' + normalizedEntry + '\n';
|
|
275
|
+
fs.writeFileSync(gitignorePath, newContent);
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
// Log warning but don't fail - this is a nice-to-have
|
|
280
|
+
console.warn(`Warning: Could not update .gitignore: ${error instanceof Error ? error.message : String(error)}`);
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Remove API key from global config (logout)
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* clearApiKey();
|
|
290
|
+
* console.log('Logged out successfully');
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
export function clearApiKey() {
|
|
294
|
+
deleteGlobalConfigField('apiKey');
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Check if global config file exists
|
|
298
|
+
*
|
|
299
|
+
* @returns true if ~/.specforge/config.json exists
|
|
300
|
+
*/
|
|
301
|
+
export function hasGlobalConfig() {
|
|
302
|
+
return fs.existsSync(getGlobalConfigPath());
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Check if project config file exists in cwd
|
|
306
|
+
*
|
|
307
|
+
* @returns true if .specforge.json exists
|
|
308
|
+
*/
|
|
309
|
+
export function hasProjectConfig() {
|
|
310
|
+
return fs.existsSync(getProjectConfigPath());
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../../src/cli/config/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,W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AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,EAAE,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,EAAE,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpecForge MCP CLI Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Main CLI application using Commander.js.
|
|
5
|
+
* Sets up command routing, middleware, and global options.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
/**
|
|
9
|
+
* CLI version - should match package.json
|
|
10
|
+
*/
|
|
11
|
+
declare const CLI_VERSION = "2.1.0";
|
|
12
|
+
/**
|
|
13
|
+
* The main CLI program instance
|
|
14
|
+
*/
|
|
15
|
+
declare const program: Command;
|
|
16
|
+
/**
|
|
17
|
+
* Run the CLI with given arguments
|
|
18
|
+
*
|
|
19
|
+
* @param argv - Command line arguments (defaults to process.argv)
|
|
20
|
+
*/
|
|
21
|
+
export declare function runCLI(argv?: string[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Export program for testing and extension
|
|
24
|
+
*/
|
|
25
|
+
export { program };
|
|
26
|
+
/**
|
|
27
|
+
* Export version for external use
|
|
28
|
+
*/
|
|
29
|
+
export { CLI_VERSION };
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC;;GAEG;AACH,QAAA,MAAM,WAAW,UAAU,CAAC;AAoK5B;;GAEG;AACH,QAAA,MAAM,OAAO,SAAkB,CAAC;AAShC;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,IAAI,CAQ1D;AAED;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SpecForge MCP CLI Entry Point
|
|
3
|
+
*
|
|
4
|
+
* Main CLI application using Commander.js.
|
|
5
|
+
* Sets up command routing, middleware, and global options.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { authGuardHook } from './middleware/auth-guard.js';
|
|
9
|
+
import { withErrorHandler, debugLog } from './middleware/error-handler.js';
|
|
10
|
+
import { resolveConfig } from './config/loader.js';
|
|
11
|
+
import { colors } from './ui/index.js';
|
|
12
|
+
import { registerLoginCommand, registerInitCommand, registerConfigureCommand, registerDoctorCommand, registerStatusCommand, registerProjectsCommand, registerSpecsCommand, registerSwitchCommand, registerTicketsCommand, registerNextCommand, registerBlockedCommand, } from './commands/index.js';
|
|
13
|
+
import { registerTicketCommand } from './commands/ticket/index.js';
|
|
14
|
+
import { registerSessionCommands } from './commands/session/index.js';
|
|
15
|
+
import { registerDebugCommands } from './commands/debug/index.js';
|
|
16
|
+
import { registerScaffoldCommand } from './commands/scaffold/index.js';
|
|
17
|
+
import { registerDocumentationCommands } from './commands/docs/index.js';
|
|
18
|
+
/**
|
|
19
|
+
* CLI version - should match package.json
|
|
20
|
+
*/
|
|
21
|
+
const CLI_VERSION = '2.1.0';
|
|
22
|
+
/**
|
|
23
|
+
* CLI name for display
|
|
24
|
+
*/
|
|
25
|
+
const CLI_NAME = 'specforge-mcp';
|
|
26
|
+
/**
|
|
27
|
+
* Create and configure the CLI program
|
|
28
|
+
*/
|
|
29
|
+
function createProgram() {
|
|
30
|
+
const program = new Command();
|
|
31
|
+
// Basic program info
|
|
32
|
+
program
|
|
33
|
+
.name(CLI_NAME)
|
|
34
|
+
.description('SpecForge MCP CLI - Configure and interact with SpecForge')
|
|
35
|
+
.version(CLI_VERSION, '-v, --version', 'Display version number');
|
|
36
|
+
// Global options
|
|
37
|
+
program
|
|
38
|
+
.option('--debug', 'Enable debug output')
|
|
39
|
+
.option('--no-color', 'Disable colored output')
|
|
40
|
+
.option('--json', 'Output in JSON format');
|
|
41
|
+
// Pre-action hook for auth guard
|
|
42
|
+
program.hook('preAction', (thisCommand, actionCommand) => {
|
|
43
|
+
const commandName = actionCommand.name();
|
|
44
|
+
// Set debug mode from flag
|
|
45
|
+
if (thisCommand.opts().debug) {
|
|
46
|
+
process.env.SPECFORGE_DEBUG = 'true';
|
|
47
|
+
}
|
|
48
|
+
// Disable colors if requested
|
|
49
|
+
if (thisCommand.opts().noColor) {
|
|
50
|
+
// chalk.level = 0 is handled in colors module
|
|
51
|
+
process.env.NO_COLOR = '1';
|
|
52
|
+
}
|
|
53
|
+
debugLog(`Running command: ${commandName}`);
|
|
54
|
+
debugLog('Resolved config:', resolveConfig());
|
|
55
|
+
// Run auth guard
|
|
56
|
+
authGuardHook({ name: () => commandName });
|
|
57
|
+
});
|
|
58
|
+
return program;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Register the default serve command (MCP server mode)
|
|
62
|
+
*
|
|
63
|
+
* This is the hidden default when no subcommand is provided.
|
|
64
|
+
* Maintains backward compatibility with direct MCP server usage.
|
|
65
|
+
*/
|
|
66
|
+
function registerServeCommand(program) {
|
|
67
|
+
program
|
|
68
|
+
.command('serve', { isDefault: true, hidden: true })
|
|
69
|
+
.description('Start MCP server (default)')
|
|
70
|
+
.action(withErrorHandler(async () => {
|
|
71
|
+
debugLog('Starting MCP server');
|
|
72
|
+
// Dynamic import to avoid loading server code for CLI commands
|
|
73
|
+
const { loadConfig, validateConfig } = await import('../config/index.js');
|
|
74
|
+
const { createServer, startServer } = await import('../server.js');
|
|
75
|
+
// Load and validate config
|
|
76
|
+
const config = await loadConfig();
|
|
77
|
+
validateConfig(config);
|
|
78
|
+
// Create and start server
|
|
79
|
+
const server = await createServer(config);
|
|
80
|
+
await startServer(server);
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Register all CLI commands
|
|
85
|
+
*/
|
|
86
|
+
function registerCommands(program) {
|
|
87
|
+
// E02 - Login command (implemented)
|
|
88
|
+
registerLoginCommand(program);
|
|
89
|
+
// E03 - Init command (implemented)
|
|
90
|
+
registerInitCommand(program);
|
|
91
|
+
// E04 - Configure command (implemented)
|
|
92
|
+
registerConfigureCommand(program);
|
|
93
|
+
// E05 - Doctor command (implemented)
|
|
94
|
+
registerDoctorCommand(program);
|
|
95
|
+
// E06 - Status command (implemented)
|
|
96
|
+
registerStatusCommand(program);
|
|
97
|
+
// E07 - Projects Command (implemented)
|
|
98
|
+
registerProjectsCommand(program);
|
|
99
|
+
// E07 - Specs Command (implemented)
|
|
100
|
+
registerSpecsCommand(program);
|
|
101
|
+
// E08 - Switch Command (implemented)
|
|
102
|
+
registerSwitchCommand(program);
|
|
103
|
+
// E09 - Tickets Command (implemented)
|
|
104
|
+
registerTicketsCommand(program);
|
|
105
|
+
// E10 - Next Command (implemented)
|
|
106
|
+
registerNextCommand(program);
|
|
107
|
+
// E10 - Blocked Command (implemented)
|
|
108
|
+
registerBlockedCommand(program);
|
|
109
|
+
// E11 - Ticket Command (implemented)
|
|
110
|
+
registerTicketCommand(program);
|
|
111
|
+
// E12 - Session Commands (implemented)
|
|
112
|
+
registerSessionCommands(program);
|
|
113
|
+
// E13 - Debug Commands (implemented)
|
|
114
|
+
registerDebugCommands(program);
|
|
115
|
+
// E14 - Scaffold Command (implemented)
|
|
116
|
+
registerScaffoldCommand(program);
|
|
117
|
+
// E15 - MCP Docs Command (implemented)
|
|
118
|
+
registerDocumentationCommands(program);
|
|
119
|
+
// E16 - Review Command
|
|
120
|
+
program
|
|
121
|
+
.command('review')
|
|
122
|
+
.description('Review implementation progress')
|
|
123
|
+
.action(() => {
|
|
124
|
+
console.log(colors.muted('Review command will be implemented in E16'));
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Configure help output styling
|
|
129
|
+
*/
|
|
130
|
+
function configureHelp(program) {
|
|
131
|
+
program.configureHelp({
|
|
132
|
+
sortSubcommands: true,
|
|
133
|
+
subcommandTerm: (cmd) => cmd.name(),
|
|
134
|
+
});
|
|
135
|
+
// Custom help footer
|
|
136
|
+
program.addHelpText('after', `
|
|
137
|
+
${colors.muted('Examples:')}
|
|
138
|
+
$ specforge-mcp login # Authenticate with API key
|
|
139
|
+
$ specforge-mcp init # Initialize in current directory
|
|
140
|
+
$ specforge-mcp status # Show current status
|
|
141
|
+
$ specforge-mcp tickets # List all tickets
|
|
142
|
+
$ specforge-mcp next # Get next ticket to work on
|
|
143
|
+
|
|
144
|
+
${colors.muted('Documentation:')}
|
|
145
|
+
${colors.primary('https://docs.specforge.com/cli')}
|
|
146
|
+
|
|
147
|
+
${colors.muted('Report issues:')}
|
|
148
|
+
${colors.primary('https://github.com/specforge/mcp/issues')}
|
|
149
|
+
`);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The main CLI program instance
|
|
153
|
+
*/
|
|
154
|
+
const program = createProgram();
|
|
155
|
+
// Register commands
|
|
156
|
+
registerServeCommand(program);
|
|
157
|
+
registerCommands(program);
|
|
158
|
+
// Configure help
|
|
159
|
+
configureHelp(program);
|
|
160
|
+
/**
|
|
161
|
+
* Run the CLI with given arguments
|
|
162
|
+
*
|
|
163
|
+
* @param argv - Command line arguments (defaults to process.argv)
|
|
164
|
+
*/
|
|
165
|
+
export function runCLI(argv = process.argv) {
|
|
166
|
+
try {
|
|
167
|
+
program.parse(argv);
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
// Commander handles most errors, but catch any that slip through
|
|
171
|
+
debugLog('CLI parse error:', error);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Export program for testing and extension
|
|
177
|
+
*/
|
|
178
|
+
export { program };
|
|
179
|
+
/**
|
|
180
|
+
* Export version for external use
|
|
181
|
+
*/
|
|
182
|
+
export { CLI_VERSION };
|
|
183
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B;;GAEG;AACH,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,qBAAqB;IACrB,OAAO;SACJ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,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iEAAiE;QACjE,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;GAEG;AACH,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -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"}
|