@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,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Formatting Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent output formatting for tables, lists, and structured data.
|
|
5
|
+
*/
|
|
6
|
+
import { colors, style, icons } from './colors.js';
|
|
7
|
+
/**
|
|
8
|
+
* Print a labeled value
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* printField('Project', 'my-project');
|
|
12
|
+
* // Output: Project: my-project
|
|
13
|
+
*/
|
|
14
|
+
export function printField(label, value) {
|
|
15
|
+
const displayValue = value ?? colors.muted('(not set)');
|
|
16
|
+
console.log(`${style.label(label)}: ${displayValue}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Print a section header
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* printHeader('Configuration');
|
|
23
|
+
* // Output:
|
|
24
|
+
* // Configuration
|
|
25
|
+
* // ─────────────
|
|
26
|
+
*/
|
|
27
|
+
export function printHeader(title) {
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(style.label(title));
|
|
30
|
+
console.log(colors.muted('─'.repeat(title.length)));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Print a blank line
|
|
34
|
+
*/
|
|
35
|
+
export function printBlank() {
|
|
36
|
+
console.log();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Print a list of items
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* printList(['Item 1', 'Item 2', 'Item 3']);
|
|
43
|
+
* // Output:
|
|
44
|
+
* // • Item 1
|
|
45
|
+
* // • Item 2
|
|
46
|
+
* // • Item 3
|
|
47
|
+
*/
|
|
48
|
+
export function printList(items, bullet = icons.bullet) {
|
|
49
|
+
for (const item of items) {
|
|
50
|
+
console.log(` ${bullet} ${item}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Print a success message
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* printSuccess('Configuration saved');
|
|
58
|
+
* // Output: ✓ Configuration saved
|
|
59
|
+
*/
|
|
60
|
+
export function printSuccess(message) {
|
|
61
|
+
console.log(`${icons.success} ${message}`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Print an error message
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* printError('Failed to connect');
|
|
68
|
+
* // Output: ✗ Failed to connect
|
|
69
|
+
*/
|
|
70
|
+
export function printError(message) {
|
|
71
|
+
console.error(`${icons.error} ${style.err(message)}`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Print a warning message
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* printWarning('API key will expire soon');
|
|
78
|
+
* // Output: ⚠ API key will expire soon
|
|
79
|
+
*/
|
|
80
|
+
export function printWarning(message) {
|
|
81
|
+
console.error(`${icons.warning} ${style.warn(message)}`);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Print an info message
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* printInfo('Fetching data...');
|
|
88
|
+
* // Output: ℹ Fetching data...
|
|
89
|
+
*/
|
|
90
|
+
export function printInfo(message) {
|
|
91
|
+
console.log(`${icons.info} ${message}`);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Print a key-value table
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* printTable({
|
|
98
|
+
* 'Project': 'my-project',
|
|
99
|
+
* 'Specification': 'v2.0',
|
|
100
|
+
* 'Status': 'active',
|
|
101
|
+
* });
|
|
102
|
+
*/
|
|
103
|
+
export function printTable(data) {
|
|
104
|
+
const maxKeyLength = Math.max(...Object.keys(data).map(k => k.length));
|
|
105
|
+
for (const [key, value] of Object.entries(data)) {
|
|
106
|
+
const paddedKey = key.padEnd(maxKeyLength);
|
|
107
|
+
const displayValue = value ?? colors.muted('(not set)');
|
|
108
|
+
console.log(` ${style.label(paddedKey)} ${displayValue}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Print JSON output (for --format json)
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* printJson({ project: 'my-project', status: 'active' });
|
|
116
|
+
*/
|
|
117
|
+
export function printJson(data) {
|
|
118
|
+
console.log(JSON.stringify(data, null, 2));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Print a command hint
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* printHint('specforge-mcp init', 'Initialize project');
|
|
125
|
+
* // Output: → Run `specforge-mcp init` to initialize project
|
|
126
|
+
*/
|
|
127
|
+
export function printHint(command, description) {
|
|
128
|
+
console.log(`${icons.arrow} Run ${style.command(command)} to ${description}`);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Print a URL with description
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* printLink('https://specforge.com', 'Visit documentation');
|
|
135
|
+
* // Output: → Visit documentation: https://specforge.com
|
|
136
|
+
*/
|
|
137
|
+
export function printLink(url, description) {
|
|
138
|
+
console.log(`${icons.arrow} ${description}: ${style.url(url)}`);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Format bytes to human readable size
|
|
142
|
+
*/
|
|
143
|
+
export function formatBytes(bytes) {
|
|
144
|
+
if (bytes === 0)
|
|
145
|
+
return '0 B';
|
|
146
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
147
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
148
|
+
return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${units[i]}`;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Format duration in milliseconds to human readable
|
|
152
|
+
*/
|
|
153
|
+
export function formatDuration(ms) {
|
|
154
|
+
if (ms < 1000)
|
|
155
|
+
return `${ms}ms`;
|
|
156
|
+
if (ms < 60000)
|
|
157
|
+
return `${(ms / 1000).toFixed(1)}s`;
|
|
158
|
+
if (ms < 3600000)
|
|
159
|
+
return `${Math.floor(ms / 60000)}m ${Math.floor((ms % 60000) / 1000)}s`;
|
|
160
|
+
const hours = Math.floor(ms / 3600000);
|
|
161
|
+
const minutes = Math.floor((ms % 3600000) / 60000);
|
|
162
|
+
return `${hours}h ${minutes}m`;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Truncate string with ellipsis
|
|
166
|
+
*/
|
|
167
|
+
export function truncate(str, maxLength) {
|
|
168
|
+
if (str.length <= maxLength)
|
|
169
|
+
return str;
|
|
170
|
+
return str.slice(0, maxLength - 1) + '…';
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/cli/ui/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,KAAgC;IACxE,MAAM,YAAY,GAAG,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACxD,OAAO,C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GAAG,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,SAAiB;IACrD,IAAI,GAAG,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC;IACxC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading Spinner Utilities
|
|
3
|
+
*
|
|
4
|
+
* Wraps ora spinner with consistent styling and error handling.
|
|
5
|
+
*/
|
|
6
|
+
import { Ora } from 'ora';
|
|
7
|
+
/**
|
|
8
|
+
* Spinner instance type
|
|
9
|
+
*/
|
|
10
|
+
export type Spinner = Ora;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new spinner with consistent styling
|
|
13
|
+
*
|
|
14
|
+
* @param text - Initial spinner text
|
|
15
|
+
* @returns Spinner instance
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const spinner = createSpinner('Loading...');
|
|
20
|
+
* spinner.start();
|
|
21
|
+
*
|
|
22
|
+
* try {
|
|
23
|
+
* await doAsyncWork();
|
|
24
|
+
* spinner.succeed('Done!');
|
|
25
|
+
* } catch (error) {
|
|
26
|
+
* spinner.fail('Failed');
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function createSpinner(text: string): Spinner;
|
|
31
|
+
/**
|
|
32
|
+
* Run an async function with a spinner
|
|
33
|
+
*
|
|
34
|
+
* Automatically handles success/failure states.
|
|
35
|
+
*
|
|
36
|
+
* @param text - Spinner text while running
|
|
37
|
+
* @param fn - Async function to run
|
|
38
|
+
* @param successText - Text to show on success (optional)
|
|
39
|
+
* @returns Result of the async function
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const data = await withSpinner(
|
|
44
|
+
* 'Fetching tickets...',
|
|
45
|
+
* async () => await api.getTickets(),
|
|
46
|
+
* 'Tickets loaded'
|
|
47
|
+
* );
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function withSpinner<T>(text: string, fn: () => Promise<T>, successText?: string): Promise<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Run multiple async operations with progress
|
|
53
|
+
*
|
|
54
|
+
* @param operations - Array of operations with labels
|
|
55
|
+
* @returns Array of results
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const results = await withProgress([
|
|
60
|
+
* { label: 'Loading config', fn: loadConfig },
|
|
61
|
+
* { label: 'Fetching data', fn: fetchData },
|
|
62
|
+
* { label: 'Processing', fn: process },
|
|
63
|
+
* ]);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function withProgress<T>(operations: Array<{
|
|
67
|
+
label: string;
|
|
68
|
+
fn: () => Promise<T>;
|
|
69
|
+
}>): Promise<T[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Create a manual spinner for custom control
|
|
72
|
+
*
|
|
73
|
+
* @param text - Initial text
|
|
74
|
+
* @returns Object with spinner control methods
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const { start, update, succeed, fail } = manualSpinner('Loading');
|
|
79
|
+
*
|
|
80
|
+
* start();
|
|
81
|
+
* update('Loading step 1...');
|
|
82
|
+
* update('Loading step 2...');
|
|
83
|
+
* succeed('All loaded');
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function manualSpinner(text: string): {
|
|
87
|
+
start: () => Ora;
|
|
88
|
+
stop: () => Ora;
|
|
89
|
+
update: (newText: string) => void;
|
|
90
|
+
succeed: (finalText?: string) => void;
|
|
91
|
+
fail: (finalText?: string) => void;
|
|
92
|
+
warn: (finalText?: string) => void;
|
|
93
|
+
info: (finalText?: string) => void;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Check if spinners should be disabled (non-TTY)
|
|
97
|
+
*/
|
|
98
|
+
export declare function shouldDisableSpinner(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Simple progress indicator for non-TTY environments
|
|
101
|
+
*
|
|
102
|
+
* @param text - Progress text
|
|
103
|
+
*/
|
|
104
|
+
export declare function progressLog(text: string): void;
|
|
105
|
+
//# sourceMappingURL=spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG/B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC;AAE1B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMnD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,CAAC,CAYZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,UAAU,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,GACzD,OAAO,CAAC,CAAC,EAAE,CAAC,CAad;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM;;;sBAMpB,MAAM;0BAGF,MAAM;uBAGT,MAAM;uBAGN,MAAM;uBAGN,MAAM;EAI5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAO9C"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading Spinner Utilities
|
|
3
|
+
*
|
|
4
|
+
* Wraps ora spinner with consistent styling and error handling.
|
|
5
|
+
*/
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import { icons } from './colors.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create a new spinner with consistent styling
|
|
10
|
+
*
|
|
11
|
+
* @param text - Initial spinner text
|
|
12
|
+
* @returns Spinner instance
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const spinner = createSpinner('Loading...');
|
|
17
|
+
* spinner.start();
|
|
18
|
+
*
|
|
19
|
+
* try {
|
|
20
|
+
* await doAsyncWork();
|
|
21
|
+
* spinner.succeed('Done!');
|
|
22
|
+
* } catch (error) {
|
|
23
|
+
* spinner.fail('Failed');
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function createSpinner(text) {
|
|
28
|
+
return ora({
|
|
29
|
+
text,
|
|
30
|
+
color: 'cyan',
|
|
31
|
+
spinner: 'dots',
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Run an async function with a spinner
|
|
36
|
+
*
|
|
37
|
+
* Automatically handles success/failure states.
|
|
38
|
+
*
|
|
39
|
+
* @param text - Spinner text while running
|
|
40
|
+
* @param fn - Async function to run
|
|
41
|
+
* @param successText - Text to show on success (optional)
|
|
42
|
+
* @returns Result of the async function
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const data = await withSpinner(
|
|
47
|
+
* 'Fetching tickets...',
|
|
48
|
+
* async () => await api.getTickets(),
|
|
49
|
+
* 'Tickets loaded'
|
|
50
|
+
* );
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export async function withSpinner(text, fn, successText) {
|
|
54
|
+
const spinner = createSpinner(text);
|
|
55
|
+
spinner.start();
|
|
56
|
+
try {
|
|
57
|
+
const result = await fn();
|
|
58
|
+
spinner.succeed(successText || text.replace(/\.{3}$/, ''));
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
spinner.fail(text.replace(/\.{3}$/, ' failed'));
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Run multiple async operations with progress
|
|
68
|
+
*
|
|
69
|
+
* @param operations - Array of operations with labels
|
|
70
|
+
* @returns Array of results
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const results = await withProgress([
|
|
75
|
+
* { label: 'Loading config', fn: loadConfig },
|
|
76
|
+
* { label: 'Fetching data', fn: fetchData },
|
|
77
|
+
* { label: 'Processing', fn: process },
|
|
78
|
+
* ]);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export async function withProgress(operations) {
|
|
82
|
+
const results = [];
|
|
83
|
+
for (let i = 0; i < operations.length; i++) {
|
|
84
|
+
const { label, fn } = operations[i];
|
|
85
|
+
const progress = `[${i + 1}/${operations.length}]`;
|
|
86
|
+
const text = `${progress} ${label}...`;
|
|
87
|
+
const result = await withSpinner(text, fn);
|
|
88
|
+
results.push(result);
|
|
89
|
+
}
|
|
90
|
+
return results;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a manual spinner for custom control
|
|
94
|
+
*
|
|
95
|
+
* @param text - Initial text
|
|
96
|
+
* @returns Object with spinner control methods
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const { start, update, succeed, fail } = manualSpinner('Loading');
|
|
101
|
+
*
|
|
102
|
+
* start();
|
|
103
|
+
* update('Loading step 1...');
|
|
104
|
+
* update('Loading step 2...');
|
|
105
|
+
* succeed('All loaded');
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function manualSpinner(text) {
|
|
109
|
+
const spinner = createSpinner(text);
|
|
110
|
+
return {
|
|
111
|
+
start: () => spinner.start(),
|
|
112
|
+
stop: () => spinner.stop(),
|
|
113
|
+
update: (newText) => {
|
|
114
|
+
spinner.text = newText;
|
|
115
|
+
},
|
|
116
|
+
succeed: (finalText) => {
|
|
117
|
+
spinner.succeed(finalText);
|
|
118
|
+
},
|
|
119
|
+
fail: (finalText) => {
|
|
120
|
+
spinner.fail(finalText);
|
|
121
|
+
},
|
|
122
|
+
warn: (finalText) => {
|
|
123
|
+
spinner.warn(finalText);
|
|
124
|
+
},
|
|
125
|
+
info: (finalText) => {
|
|
126
|
+
spinner.info(finalText);
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Check if spinners should be disabled (non-TTY)
|
|
132
|
+
*/
|
|
133
|
+
export function shouldDisableSpinner() {
|
|
134
|
+
return !process.stdout.isTTY;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Simple progress indicator for non-TTY environments
|
|
138
|
+
*
|
|
139
|
+
* @param text - Progress text
|
|
140
|
+
*/
|
|
141
|
+
export function progressLog(text) {
|
|
142
|
+
if (process.stdout.isTTY) {
|
|
143
|
+
// In TTY, use spinner instead
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
console.log(`${icons.running} ${text}`);
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/cli/ui/spinner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,GAAY,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AAO5C;;;;;;;;;;;;;;;;;;GAkBG;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
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time Utilities
|
|
3
|
+
*
|
|
4
|
+
* Formatting utilities for time display in CLI output.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format ISO timestamp to relative time string
|
|
8
|
+
*
|
|
9
|
+
* Examples:
|
|
10
|
+
* - "just now" (< 1 minute)
|
|
11
|
+
* - "5m ago" (minutes)
|
|
12
|
+
* - "2h ago" (hours)
|
|
13
|
+
* - "3 days ago" (days)
|
|
14
|
+
* - "2 weeks ago" (weeks)
|
|
15
|
+
* - "1 month ago" (months)
|
|
16
|
+
* - "1 year ago" (years)
|
|
17
|
+
*
|
|
18
|
+
* @param isoString ISO 8601 timestamp string
|
|
19
|
+
* @returns Human-readable relative time
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatRelativeTime(isoString: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Format duration between two timestamps
|
|
24
|
+
*
|
|
25
|
+
* @param startIso Start timestamp (ISO 8601)
|
|
26
|
+
* @param endIso End timestamp (ISO 8601), defaults to now
|
|
27
|
+
* @returns Human-readable duration string
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatDuration(startIso: string, endIso?: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* Format a timestamp for display
|
|
32
|
+
*
|
|
33
|
+
* @param isoString ISO 8601 timestamp string
|
|
34
|
+
* @param format Output format: 'relative', 'short', 'long'
|
|
35
|
+
* @returns Formatted time string
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatTimestamp(isoString: string, format?: 'relative' | 'short' | 'long'): string;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a timestamp is within a given time window
|
|
40
|
+
*
|
|
41
|
+
* @param isoString ISO 8601 timestamp string
|
|
42
|
+
* @param windowMs Time window in milliseconds
|
|
43
|
+
* @returns True if within window
|
|
44
|
+
*/
|
|
45
|
+
export declare function isWithinTimeWindow(isoString: string, windowMs: number): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get "time ago" for session display
|
|
48
|
+
* Similar to formatRelativeTime but more compact
|
|
49
|
+
*
|
|
50
|
+
* @param isoString ISO 8601 timestamp string
|
|
51
|
+
* @returns Compact relative time (e.g., "2h 15m ago")
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatTimeAgo(isoString: string): string;
|
|
54
|
+
//# sourceMappingURL=time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/cli/ui/time.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgD5D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CA0BxE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,UAAU,GAAG,OAAO,GAAG,MAAmB,GACjD,MAAM,CA6BR;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK/E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA0BvD"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time Utilities
|
|
3
|
+
*
|
|
4
|
+
* Formatting utilities for time display in CLI output.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Time unit thresholds in milliseconds
|
|
8
|
+
*/
|
|
9
|
+
const MS_PER_MINUTE = 60 * 1000;
|
|
10
|
+
const MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
|
11
|
+
const MS_PER_DAY = 24 * MS_PER_HOUR;
|
|
12
|
+
const MS_PER_WEEK = 7 * MS_PER_DAY;
|
|
13
|
+
const MS_PER_MONTH = 30 * MS_PER_DAY;
|
|
14
|
+
const MS_PER_YEAR = 365 * MS_PER_DAY;
|
|
15
|
+
/**
|
|
16
|
+
* Format ISO timestamp to relative time string
|
|
17
|
+
*
|
|
18
|
+
* Examples:
|
|
19
|
+
* - "just now" (< 1 minute)
|
|
20
|
+
* - "5m ago" (minutes)
|
|
21
|
+
* - "2h ago" (hours)
|
|
22
|
+
* - "3 days ago" (days)
|
|
23
|
+
* - "2 weeks ago" (weeks)
|
|
24
|
+
* - "1 month ago" (months)
|
|
25
|
+
* - "1 year ago" (years)
|
|
26
|
+
*
|
|
27
|
+
* @param isoString ISO 8601 timestamp string
|
|
28
|
+
* @returns Human-readable relative time
|
|
29
|
+
*/
|
|
30
|
+
export function formatRelativeTime(isoString) {
|
|
31
|
+
const date = new Date(isoString);
|
|
32
|
+
const now = new Date();
|
|
33
|
+
const diffMs = now.getTime() - date.getTime();
|
|
34
|
+
// Handle future dates
|
|
35
|
+
if (diffMs < 0) {
|
|
36
|
+
return 'in the future';
|
|
37
|
+
}
|
|
38
|
+
// Just now (< 1 minute)
|
|
39
|
+
if (diffMs < MS_PER_MINUTE) {
|
|
40
|
+
return 'just now';
|
|
41
|
+
}
|
|
42
|
+
// Minutes
|
|
43
|
+
if (diffMs < MS_PER_HOUR) {
|
|
44
|
+
const minutes = Math.floor(diffMs / MS_PER_MINUTE);
|
|
45
|
+
return `${minutes}m ago`;
|
|
46
|
+
}
|
|
47
|
+
// Hours
|
|
48
|
+
if (diffMs < MS_PER_DAY) {
|
|
49
|
+
const hours = Math.floor(diffMs / MS_PER_HOUR);
|
|
50
|
+
return `${hours}h ago`;
|
|
51
|
+
}
|
|
52
|
+
// Days
|
|
53
|
+
if (diffMs < MS_PER_WEEK) {
|
|
54
|
+
const days = Math.floor(diffMs / MS_PER_DAY);
|
|
55
|
+
return days === 1 ? '1 day ago' : `${days} days ago`;
|
|
56
|
+
}
|
|
57
|
+
// Weeks
|
|
58
|
+
if (diffMs < MS_PER_MONTH) {
|
|
59
|
+
const weeks = Math.floor(diffMs / MS_PER_WEEK);
|
|
60
|
+
return weeks === 1 ? '1 week ago' : `${weeks} weeks ago`;
|
|
61
|
+
}
|
|
62
|
+
// Months
|
|
63
|
+
if (diffMs < MS_PER_YEAR) {
|
|
64
|
+
const months = Math.floor(diffMs / MS_PER_MONTH);
|
|
65
|
+
return months === 1 ? '1 month ago' : `${months} months ago`;
|
|
66
|
+
}
|
|
67
|
+
// Years
|
|
68
|
+
const years = Math.floor(diffMs / MS_PER_YEAR);
|
|
69
|
+
return years === 1 ? '1 year ago' : `${years} years ago`;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Format duration between two timestamps
|
|
73
|
+
*
|
|
74
|
+
* @param startIso Start timestamp (ISO 8601)
|
|
75
|
+
* @param endIso End timestamp (ISO 8601), defaults to now
|
|
76
|
+
* @returns Human-readable duration string
|
|
77
|
+
*/
|
|
78
|
+
export function formatDuration(startIso, endIso) {
|
|
79
|
+
const start = new Date(startIso);
|
|
80
|
+
const end = endIso ? new Date(endIso) : new Date();
|
|
81
|
+
const diffMs = end.getTime() - start.getTime();
|
|
82
|
+
if (diffMs < 0) {
|
|
83
|
+
return '0m';
|
|
84
|
+
}
|
|
85
|
+
const days = Math.floor(diffMs / MS_PER_DAY);
|
|
86
|
+
const hours = Math.floor((diffMs % MS_PER_DAY) / MS_PER_HOUR);
|
|
87
|
+
const minutes = Math.floor((diffMs % MS_PER_HOUR) / MS_PER_MINUTE);
|
|
88
|
+
if (days > 0) {
|
|
89
|
+
return `${days}d ${hours}h`;
|
|
90
|
+
}
|
|
91
|
+
if (hours > 0) {
|
|
92
|
+
return `${hours}h ${minutes}m`;
|
|
93
|
+
}
|
|
94
|
+
if (minutes > 0) {
|
|
95
|
+
return `${minutes}m`;
|
|
96
|
+
}
|
|
97
|
+
return 'just started';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Format a timestamp for display
|
|
101
|
+
*
|
|
102
|
+
* @param isoString ISO 8601 timestamp string
|
|
103
|
+
* @param format Output format: 'relative', 'short', 'long'
|
|
104
|
+
* @returns Formatted time string
|
|
105
|
+
*/
|
|
106
|
+
export function formatTimestamp(isoString, format = 'relative') {
|
|
107
|
+
const date = new Date(isoString);
|
|
108
|
+
switch (format) {
|
|
109
|
+
case 'relative':
|
|
110
|
+
return formatRelativeTime(isoString);
|
|
111
|
+
case 'short':
|
|
112
|
+
// e.g., "Jan 15, 2:30 PM"
|
|
113
|
+
return date.toLocaleString('en-US', {
|
|
114
|
+
month: 'short',
|
|
115
|
+
day: 'numeric',
|
|
116
|
+
hour: 'numeric',
|
|
117
|
+
minute: '2-digit',
|
|
118
|
+
});
|
|
119
|
+
case 'long':
|
|
120
|
+
// e.g., "January 15, 2024 at 2:30 PM"
|
|
121
|
+
return date.toLocaleString('en-US', {
|
|
122
|
+
year: 'numeric',
|
|
123
|
+
month: 'long',
|
|
124
|
+
day: 'numeric',
|
|
125
|
+
hour: 'numeric',
|
|
126
|
+
minute: '2-digit',
|
|
127
|
+
});
|
|
128
|
+
default:
|
|
129
|
+
return formatRelativeTime(isoString);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Check if a timestamp is within a given time window
|
|
134
|
+
*
|
|
135
|
+
* @param isoString ISO 8601 timestamp string
|
|
136
|
+
* @param windowMs Time window in milliseconds
|
|
137
|
+
* @returns True if within window
|
|
138
|
+
*/
|
|
139
|
+
export function isWithinTimeWindow(isoString, windowMs) {
|
|
140
|
+
const date = new Date(isoString);
|
|
141
|
+
const now = new Date();
|
|
142
|
+
const diffMs = now.getTime() - date.getTime();
|
|
143
|
+
return diffMs >= 0 && diffMs <= windowMs;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get "time ago" for session display
|
|
147
|
+
* Similar to formatRelativeTime but more compact
|
|
148
|
+
*
|
|
149
|
+
* @param isoString ISO 8601 timestamp string
|
|
150
|
+
* @returns Compact relative time (e.g., "2h 15m ago")
|
|
151
|
+
*/
|
|
152
|
+
export function formatTimeAgo(isoString) {
|
|
153
|
+
const date = new Date(isoString);
|
|
154
|
+
const now = new Date();
|
|
155
|
+
const diffMs = now.getTime() - date.getTime();
|
|
156
|
+
if (diffMs < 0) {
|
|
157
|
+
return 'in the future';
|
|
158
|
+
}
|
|
159
|
+
if (diffMs < MS_PER_MINUTE) {
|
|
160
|
+
return 'just now';
|
|
161
|
+
}
|
|
162
|
+
const days = Math.floor(diffMs / MS_PER_DAY);
|
|
163
|
+
const hours = Math.floor((diffMs % MS_PER_DAY) / MS_PER_HOUR);
|
|
164
|
+
const minutes = Math.floor((diffMs % MS_PER_HOUR) / MS_PER_MINUTE);
|
|
165
|
+
if (days > 0) {
|
|
166
|
+
return `${days}d ${hours}h ago`;
|
|
167
|
+
}
|
|
168
|
+
if (hours > 0) {
|
|
169
|
+
return `${hours}h ${minutes}m ago`;
|
|
170
|
+
}
|
|
171
|
+
return `${minutes}m ago`;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../src/cli/ui/time.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,aAAa,GAAG,EAAE,GAAG,IAAI,CAAC;AAChC,MAAM,WAAW,GAAG,EAAE,GAAG,aAAa,CAAC;AACvC,MAAM,UAAU,GAAG,EAAE,GAAG,WAAW,CAAC;AACpC,MAAM,WAAW,GAAG,CAAC,GAAG,UAAU,CAAC;AACnC,MAAM,YAAY,GAAG,EAAE,GAAG,UAAU,CAAC;AACrC,MAAM,WAAW,GAAG,GAAG,GAAG,UAAU,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CA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