@ttctl/cli 0.0.0 → 0.1.0-rc.2
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 +44 -9
- package/dist/commands/applications/index.d.ts +21 -0
- package/dist/commands/applications/index.d.ts.map +1 -0
- package/dist/commands/applications/index.js +87 -0
- package/dist/commands/applications/index.js.map +1 -0
- package/dist/commands/applications/list.d.ts +55 -0
- package/dist/commands/applications/list.d.ts.map +1 -0
- package/dist/commands/applications/list.js +106 -0
- package/dist/commands/applications/list.js.map +1 -0
- package/dist/commands/applications/shared.d.ts +14 -0
- package/dist/commands/applications/shared.d.ts.map +1 -0
- package/dist/commands/applications/shared.js +19 -0
- package/dist/commands/applications/shared.js.map +1 -0
- package/dist/commands/applications/show.d.ts +51 -0
- package/dist/commands/applications/show.d.ts.map +1 -0
- package/dist/commands/applications/show.js +154 -0
- package/dist/commands/applications/show.js.map +1 -0
- package/dist/commands/applications/stats.d.ts +42 -0
- package/dist/commands/applications/stats.d.ts.map +1 -0
- package/dist/commands/applications/stats.js +69 -0
- package/dist/commands/applications/stats.js.map +1 -0
- package/dist/commands/auth/index.d.ts +17 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +69 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/init.d.ts +98 -0
- package/dist/commands/auth/init.d.ts.map +1 -0
- package/dist/commands/auth/init.js +387 -0
- package/dist/commands/auth/init.js.map +1 -0
- package/dist/commands/auth/signin.d.ts +81 -0
- package/dist/commands/auth/signin.d.ts.map +1 -0
- package/dist/commands/auth/signin.js +145 -0
- package/dist/commands/auth/signin.js.map +1 -0
- package/dist/commands/auth/signout.d.ts +133 -0
- package/dist/commands/auth/signout.d.ts.map +1 -0
- package/dist/commands/auth/signout.js +172 -0
- package/dist/commands/auth/signout.js.map +1 -0
- package/dist/commands/auth/status.d.ts +62 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +98 -0
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/availability/allocated-hours.d.ts +27 -0
- package/dist/commands/availability/allocated-hours.d.ts.map +1 -0
- package/dist/commands/availability/allocated-hours.js +61 -0
- package/dist/commands/availability/allocated-hours.js.map +1 -0
- package/dist/commands/availability/index.d.ts +30 -0
- package/dist/commands/availability/index.d.ts.map +1 -0
- package/dist/commands/availability/index.js +124 -0
- package/dist/commands/availability/index.js.map +1 -0
- package/dist/commands/availability/shared.d.ts +11 -0
- package/dist/commands/availability/shared.d.ts.map +1 -0
- package/dist/commands/availability/shared.js +30 -0
- package/dist/commands/availability/shared.js.map +1 -0
- package/dist/commands/availability/show.d.ts +32 -0
- package/dist/commands/availability/show.d.ts.map +1 -0
- package/dist/commands/availability/show.js +86 -0
- package/dist/commands/availability/show.js.map +1 -0
- package/dist/commands/availability/working-hours.d.ts +53 -0
- package/dist/commands/availability/working-hours.d.ts.map +1 -0
- package/dist/commands/availability/working-hours.js +151 -0
- package/dist/commands/availability/working-hours.js.map +1 -0
- package/dist/commands/contracts/index.d.ts +69 -0
- package/dist/commands/contracts/index.d.ts.map +1 -0
- package/dist/commands/contracts/index.js +198 -0
- package/dist/commands/contracts/index.js.map +1 -0
- package/dist/commands/engagements/breaks.d.ts +81 -0
- package/dist/commands/engagements/breaks.d.ts.map +1 -0
- package/dist/commands/engagements/breaks.js +229 -0
- package/dist/commands/engagements/breaks.js.map +1 -0
- package/dist/commands/engagements/index.d.ts +29 -0
- package/dist/commands/engagements/index.d.ts.map +1 -0
- package/dist/commands/engagements/index.js +172 -0
- package/dist/commands/engagements/index.js.map +1 -0
- package/dist/commands/engagements/list.d.ts +49 -0
- package/dist/commands/engagements/list.d.ts.map +1 -0
- package/dist/commands/engagements/list.js +95 -0
- package/dist/commands/engagements/list.js.map +1 -0
- package/dist/commands/engagements/shared.d.ts +10 -0
- package/dist/commands/engagements/shared.d.ts.map +1 -0
- package/dist/commands/engagements/shared.js +31 -0
- package/dist/commands/engagements/shared.js.map +1 -0
- package/dist/commands/engagements/show.d.ts +19 -0
- package/dist/commands/engagements/show.d.ts.map +1 -0
- package/dist/commands/engagements/show.js +150 -0
- package/dist/commands/engagements/show.js.map +1 -0
- package/dist/commands/engagements/stats.d.ts +24 -0
- package/dist/commands/engagements/stats.d.ts.map +1 -0
- package/dist/commands/engagements/stats.js +51 -0
- package/dist/commands/engagements/stats.js.map +1 -0
- package/dist/commands/jobs/index.d.ts +49 -0
- package/dist/commands/jobs/index.d.ts.map +1 -0
- package/dist/commands/jobs/index.js +304 -0
- package/dist/commands/jobs/index.js.map +1 -0
- package/dist/commands/jobs/interest.d.ts +65 -0
- package/dist/commands/jobs/interest.d.ts.map +1 -0
- package/dist/commands/jobs/interest.js +172 -0
- package/dist/commands/jobs/interest.js.map +1 -0
- package/dist/commands/jobs/list.d.ts +81 -0
- package/dist/commands/jobs/list.d.ts.map +1 -0
- package/dist/commands/jobs/list.js +157 -0
- package/dist/commands/jobs/list.js.map +1 -0
- package/dist/commands/jobs/search.d.ts +71 -0
- package/dist/commands/jobs/search.d.ts.map +1 -0
- package/dist/commands/jobs/search.js +163 -0
- package/dist/commands/jobs/search.js.map +1 -0
- package/dist/commands/jobs/shared.d.ts +79 -0
- package/dist/commands/jobs/shared.d.ts.map +1 -0
- package/dist/commands/jobs/shared.js +133 -0
- package/dist/commands/jobs/shared.js.map +1 -0
- package/dist/commands/jobs/show.d.ts +20 -0
- package/dist/commands/jobs/show.d.ts.map +1 -0
- package/dist/commands/jobs/show.js +135 -0
- package/dist/commands/jobs/show.js.map +1 -0
- package/dist/commands/payments/index.d.ts +34 -0
- package/dist/commands/payments/index.d.ts.map +1 -0
- package/dist/commands/payments/index.js +160 -0
- package/dist/commands/payments/index.js.map +1 -0
- package/dist/commands/payments/methods.d.ts +17 -0
- package/dist/commands/payments/methods.d.ts.map +1 -0
- package/dist/commands/payments/methods.js +79 -0
- package/dist/commands/payments/methods.js.map +1 -0
- package/dist/commands/payments/payouts.d.ts +44 -0
- package/dist/commands/payments/payouts.d.ts.map +1 -0
- package/dist/commands/payments/payouts.js +147 -0
- package/dist/commands/payments/payouts.js.map +1 -0
- package/dist/commands/payments/rate.d.ts +48 -0
- package/dist/commands/payments/rate.d.ts.map +1 -0
- package/dist/commands/payments/rate.js +229 -0
- package/dist/commands/payments/rate.js.map +1 -0
- package/dist/commands/payments/shared.d.ts +10 -0
- package/dist/commands/payments/shared.d.ts.map +1 -0
- package/dist/commands/payments/shared.js +27 -0
- package/dist/commands/payments/shared.js.map +1 -0
- package/dist/commands/profile/basic/index.d.ts +18 -0
- package/dist/commands/profile/basic/index.d.ts.map +1 -0
- package/dist/commands/profile/basic/index.js +79 -0
- package/dist/commands/profile/basic/index.js.map +1 -0
- package/dist/commands/profile/basic/photo-show.d.ts +28 -0
- package/dist/commands/profile/basic/photo-show.d.ts.map +1 -0
- package/dist/commands/profile/basic/photo-show.js +112 -0
- package/dist/commands/profile/basic/photo-show.js.map +1 -0
- package/dist/commands/profile/basic/photo-upload.d.ts +10 -0
- package/dist/commands/profile/basic/photo-upload.d.ts.map +1 -0
- package/dist/commands/profile/basic/photo-upload.js +61 -0
- package/dist/commands/profile/basic/photo-upload.js.map +1 -0
- package/dist/commands/profile/basic/set.d.ts +54 -0
- package/dist/commands/profile/basic/set.d.ts.map +1 -0
- package/dist/commands/profile/basic/set.js +174 -0
- package/dist/commands/profile/basic/set.js.map +1 -0
- package/dist/commands/profile/basic/show.d.ts +95 -0
- package/dist/commands/profile/basic/show.d.ts.map +1 -0
- package/dist/commands/profile/basic/show.js +310 -0
- package/dist/commands/profile/basic/show.js.map +1 -0
- package/dist/commands/profile/certifications/index.d.ts +40 -0
- package/dist/commands/profile/certifications/index.d.ts.map +1 -0
- package/dist/commands/profile/certifications/index.js +350 -0
- package/dist/commands/profile/certifications/index.js.map +1 -0
- package/dist/commands/profile/education/index.d.ts +37 -0
- package/dist/commands/profile/education/index.d.ts.map +1 -0
- package/dist/commands/profile/education/index.js +331 -0
- package/dist/commands/profile/education/index.js.map +1 -0
- package/dist/commands/profile/employment/index.d.ts +49 -0
- package/dist/commands/profile/employment/index.d.ts.map +1 -0
- package/dist/commands/profile/employment/index.js +425 -0
- package/dist/commands/profile/employment/index.js.map +1 -0
- package/dist/commands/profile/external/_shared.d.ts +35 -0
- package/dist/commands/profile/external/_shared.d.ts.map +1 -0
- package/dist/commands/profile/external/_shared.js +59 -0
- package/dist/commands/profile/external/_shared.js.map +1 -0
- package/dist/commands/profile/external/advanced-wizard-show.d.ts +15 -0
- package/dist/commands/profile/external/advanced-wizard-show.d.ts.map +1 -0
- package/dist/commands/profile/external/advanced-wizard-show.js +82 -0
- package/dist/commands/profile/external/advanced-wizard-show.js.map +1 -0
- package/dist/commands/profile/external/custom-requirements-set.d.ts +32 -0
- package/dist/commands/profile/external/custom-requirements-set.d.ts.map +1 -0
- package/dist/commands/profile/external/custom-requirements-set.js +116 -0
- package/dist/commands/profile/external/custom-requirements-set.js.map +1 -0
- package/dist/commands/profile/external/custom-requirements-show.d.ts +16 -0
- package/dist/commands/profile/external/custom-requirements-show.d.ts.map +1 -0
- package/dist/commands/profile/external/custom-requirements-show.js +84 -0
- package/dist/commands/profile/external/custom-requirements-show.js.map +1 -0
- package/dist/commands/profile/external/index.d.ts +21 -0
- package/dist/commands/profile/external/index.d.ts.map +1 -0
- package/dist/commands/profile/external/index.js +113 -0
- package/dist/commands/profile/external/index.js.map +1 -0
- package/dist/commands/profile/external/readiness.d.ts +15 -0
- package/dist/commands/profile/external/readiness.d.ts.map +1 -0
- package/dist/commands/profile/external/readiness.js +104 -0
- package/dist/commands/profile/external/readiness.js.map +1 -0
- package/dist/commands/profile/external/recommendations.d.ts +17 -0
- package/dist/commands/profile/external/recommendations.d.ts.map +1 -0
- package/dist/commands/profile/external/recommendations.js +97 -0
- package/dist/commands/profile/external/recommendations.js.map +1 -0
- package/dist/commands/profile/external/show.d.ts +22 -0
- package/dist/commands/profile/external/show.d.ts.map +1 -0
- package/dist/commands/profile/external/show.js +83 -0
- package/dist/commands/profile/external/show.js.map +1 -0
- package/dist/commands/profile/external/update.d.ts +37 -0
- package/dist/commands/profile/external/update.d.ts.map +1 -0
- package/dist/commands/profile/external/update.js +125 -0
- package/dist/commands/profile/external/update.js.map +1 -0
- package/dist/commands/profile/index.d.ts +16 -0
- package/dist/commands/profile/index.d.ts.map +1 -0
- package/dist/commands/profile/index.js +81 -0
- package/dist/commands/profile/index.js.map +1 -0
- package/dist/commands/profile/industries/index.d.ts +43 -0
- package/dist/commands/profile/industries/index.d.ts.map +1 -0
- package/dist/commands/profile/industries/index.js +258 -0
- package/dist/commands/profile/industries/index.js.map +1 -0
- package/dist/commands/profile/portfolio/add.d.ts +43 -0
- package/dist/commands/profile/portfolio/add.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/add.js +181 -0
- package/dist/commands/profile/portfolio/add.js.map +1 -0
- package/dist/commands/profile/portfolio/highlight.d.ts +11 -0
- package/dist/commands/profile/portfolio/highlight.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/highlight.js +31 -0
- package/dist/commands/profile/portfolio/highlight.js.map +1 -0
- package/dist/commands/profile/portfolio/index.d.ts +16 -0
- package/dist/commands/profile/portfolio/index.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/index.js +121 -0
- package/dist/commands/profile/portfolio/index.js.map +1 -0
- package/dist/commands/profile/portfolio/list.d.ts +83 -0
- package/dist/commands/profile/portfolio/list.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/list.js +189 -0
- package/dist/commands/profile/portfolio/list.js.map +1 -0
- package/dist/commands/profile/portfolio/remove.d.ts +9 -0
- package/dist/commands/profile/portfolio/remove.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/remove.js +24 -0
- package/dist/commands/profile/portfolio/remove.js.map +1 -0
- package/dist/commands/profile/portfolio/reorder.d.ts +17 -0
- package/dist/commands/profile/portfolio/reorder.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/reorder.js +135 -0
- package/dist/commands/profile/portfolio/reorder.js.map +1 -0
- package/dist/commands/profile/portfolio/shared.d.ts +8 -0
- package/dist/commands/profile/portfolio/shared.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/shared.js +10 -0
- package/dist/commands/profile/portfolio/shared.js.map +1 -0
- package/dist/commands/profile/portfolio/update.d.ts +18 -0
- package/dist/commands/profile/portfolio/update.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/update.js +77 -0
- package/dist/commands/profile/portfolio/update.js.map +1 -0
- package/dist/commands/profile/portfolio/upload.d.ts +8 -0
- package/dist/commands/profile/portfolio/upload.d.ts.map +1 -0
- package/dist/commands/profile/portfolio/upload.js +131 -0
- package/dist/commands/profile/portfolio/upload.js.map +1 -0
- package/dist/commands/profile/resume/cancel-upload.d.ts +9 -0
- package/dist/commands/profile/resume/cancel-upload.d.ts.map +1 -0
- package/dist/commands/profile/resume/cancel-upload.js +30 -0
- package/dist/commands/profile/resume/cancel-upload.js.map +1 -0
- package/dist/commands/profile/resume/index.d.ts +15 -0
- package/dist/commands/profile/resume/index.d.ts.map +1 -0
- package/dist/commands/profile/resume/index.js +42 -0
- package/dist/commands/profile/resume/index.js.map +1 -0
- package/dist/commands/profile/resume/upload.d.ts +16 -0
- package/dist/commands/profile/resume/upload.d.ts.map +1 -0
- package/dist/commands/profile/resume/upload.js +65 -0
- package/dist/commands/profile/resume/upload.js.map +1 -0
- package/dist/commands/profile/reviews/_shared.d.ts +9 -0
- package/dist/commands/profile/reviews/_shared.d.ts.map +1 -0
- package/dist/commands/profile/reviews/_shared.js +15 -0
- package/dist/commands/profile/reviews/_shared.js.map +1 -0
- package/dist/commands/profile/reviews/approve-item.d.ts +30 -0
- package/dist/commands/profile/reviews/approve-item.d.ts.map +1 -0
- package/dist/commands/profile/reviews/approve-item.js +82 -0
- package/dist/commands/profile/reviews/approve-item.js.map +1 -0
- package/dist/commands/profile/reviews/approve-section.d.ts +15 -0
- package/dist/commands/profile/reviews/approve-section.d.ts.map +1 -0
- package/dist/commands/profile/reviews/approve-section.js +67 -0
- package/dist/commands/profile/reviews/approve-section.js.map +1 -0
- package/dist/commands/profile/reviews/index.d.ts +19 -0
- package/dist/commands/profile/reviews/index.d.ts.map +1 -0
- package/dist/commands/profile/reviews/index.js +71 -0
- package/dist/commands/profile/reviews/index.js.map +1 -0
- package/dist/commands/profile/reviews/list.d.ts +17 -0
- package/dist/commands/profile/reviews/list.d.ts.map +1 -0
- package/dist/commands/profile/reviews/list.js +96 -0
- package/dist/commands/profile/reviews/list.js.map +1 -0
- package/dist/commands/profile/reviews/submit-for-review.d.ts +16 -0
- package/dist/commands/profile/reviews/submit-for-review.d.ts.map +1 -0
- package/dist/commands/profile/reviews/submit-for-review.js +65 -0
- package/dist/commands/profile/reviews/submit-for-review.js.map +1 -0
- package/dist/commands/profile/shared.d.ts +46 -0
- package/dist/commands/profile/shared.d.ts.map +1 -0
- package/dist/commands/profile/shared.js +111 -0
- package/dist/commands/profile/shared.js.map +1 -0
- package/dist/commands/profile/skills/index.d.ts +29 -0
- package/dist/commands/profile/skills/index.d.ts.map +1 -0
- package/dist/commands/profile/skills/index.js +475 -0
- package/dist/commands/profile/skills/index.js.map +1 -0
- package/dist/commands/profile/visas/add.d.ts +19 -0
- package/dist/commands/profile/visas/add.d.ts.map +1 -0
- package/dist/commands/profile/visas/add.js +37 -0
- package/dist/commands/profile/visas/add.js.map +1 -0
- package/dist/commands/profile/visas/index.d.ts +13 -0
- package/dist/commands/profile/visas/index.d.ts.map +1 -0
- package/dist/commands/profile/visas/index.js +69 -0
- package/dist/commands/profile/visas/index.js.map +1 -0
- package/dist/commands/profile/visas/list.d.ts +40 -0
- package/dist/commands/profile/visas/list.d.ts.map +1 -0
- package/dist/commands/profile/visas/list.js +115 -0
- package/dist/commands/profile/visas/list.js.map +1 -0
- package/dist/commands/profile/visas/remove.d.ts +8 -0
- package/dist/commands/profile/visas/remove.d.ts.map +1 -0
- package/dist/commands/profile/visas/remove.js +23 -0
- package/dist/commands/profile/visas/remove.js.map +1 -0
- package/dist/commands/profile/visas/shared.d.ts +11 -0
- package/dist/commands/profile/visas/shared.d.ts.map +1 -0
- package/dist/commands/profile/visas/shared.js +16 -0
- package/dist/commands/profile/visas/shared.js.map +1 -0
- package/dist/commands/profile/visas/update.d.ts +13 -0
- package/dist/commands/profile/visas/update.d.ts.map +1 -0
- package/dist/commands/profile/visas/update.js +44 -0
- package/dist/commands/profile/visas/update.js.map +1 -0
- package/dist/commands/timesheet/index.d.ts +24 -0
- package/dist/commands/timesheet/index.d.ts.map +1 -0
- package/dist/commands/timesheet/index.js +98 -0
- package/dist/commands/timesheet/index.js.map +1 -0
- package/dist/commands/timesheet/list.d.ts +40 -0
- package/dist/commands/timesheet/list.d.ts.map +1 -0
- package/dist/commands/timesheet/list.js +79 -0
- package/dist/commands/timesheet/list.js.map +1 -0
- package/dist/commands/timesheet/shared.d.ts +10 -0
- package/dist/commands/timesheet/shared.d.ts.map +1 -0
- package/dist/commands/timesheet/shared.js +35 -0
- package/dist/commands/timesheet/shared.js.map +1 -0
- package/dist/commands/timesheet/show.d.ts +19 -0
- package/dist/commands/timesheet/show.d.ts.map +1 -0
- package/dist/commands/timesheet/show.js +109 -0
- package/dist/commands/timesheet/show.js.map +1 -0
- package/dist/commands/timesheet/submit.d.ts +50 -0
- package/dist/commands/timesheet/submit.d.ts.map +1 -0
- package/dist/commands/timesheet/submit.js +151 -0
- package/dist/commands/timesheet/submit.js.map +1 -0
- package/dist/crash-handlers.d.ts +67 -0
- package/dist/crash-handlers.d.ts.map +1 -0
- package/dist/crash-handlers.js +78 -0
- package/dist/crash-handlers.js.map +1 -0
- package/dist/errors.d.ts +45 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +57 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config-context.d.ts +41 -0
- package/dist/lib/config-context.d.ts.map +1 -0
- package/dist/lib/config-context.js +74 -0
- package/dist/lib/config-context.js.map +1 -0
- package/dist/lib/dry-run.d.ts +70 -0
- package/dist/lib/dry-run.d.ts.map +1 -0
- package/dist/lib/dry-run.js +114 -0
- package/dist/lib/dry-run.js.map +1 -0
- package/dist/lib/empty-state-cta.d.ts +63 -0
- package/dist/lib/empty-state-cta.d.ts.map +1 -0
- package/dist/lib/empty-state-cta.js +88 -0
- package/dist/lib/empty-state-cta.js.map +1 -0
- package/dist/lib/envelopes.d.ts +540 -0
- package/dist/lib/envelopes.d.ts.map +1 -0
- package/dist/lib/envelopes.js +598 -0
- package/dist/lib/envelopes.js.map +1 -0
- package/dist/lib/error-routing.d.ts +49 -0
- package/dist/lib/error-routing.d.ts.map +1 -0
- package/dist/lib/error-routing.js +72 -0
- package/dist/lib/error-routing.js.map +1 -0
- package/dist/lib/format-helpers.d.ts +65 -0
- package/dist/lib/format-helpers.d.ts.map +1 -0
- package/dist/lib/format-helpers.js +79 -0
- package/dist/lib/format-helpers.js.map +1 -0
- package/dist/lib/format-overrides.d.ts +81 -0
- package/dist/lib/format-overrides.d.ts.map +1 -0
- package/dist/lib/format-overrides.js +55 -0
- package/dist/lib/format-overrides.js.map +1 -0
- package/dist/lib/freetext.d.ts +83 -0
- package/dist/lib/freetext.d.ts.map +1 -0
- package/dist/lib/freetext.js +182 -0
- package/dist/lib/freetext.js.map +1 -0
- package/dist/lib/kill-switch-hook.d.ts +49 -0
- package/dist/lib/kill-switch-hook.d.ts.map +1 -0
- package/dist/lib/kill-switch-hook.js +34 -0
- package/dist/lib/kill-switch-hook.js.map +1 -0
- package/dist/lib/output.d.ts +173 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +177 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/pagination.d.ts +49 -0
- package/dist/lib/pagination.d.ts.map +1 -0
- package/dist/lib/pagination.js +36 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/program.d.ts +80 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +273 -0
- package/dist/program.js.map +1 -0
- package/package.json +35 -13
- package/index.js +0 -7
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI-side wire-up for the remote version-killed manifest (#312).
|
|
3
|
+
*
|
|
4
|
+
* Invoked from the root program's `preAction` hook (see `program.ts`).
|
|
5
|
+
* Per AC 3:
|
|
6
|
+
* - Fetches the manifest at startup (synchronous-await, up to 3s).
|
|
7
|
+
* - Warns on match (stderr).
|
|
8
|
+
* - Refuses (exit non-zero) when `entry.action === "refuse"`.
|
|
9
|
+
* - Never blocks on fetch failure — fail-silent contract.
|
|
10
|
+
*
|
|
11
|
+
* The running version is resolved via `readPackageVersion(import.meta.url)`
|
|
12
|
+
* from this module's location, which points at
|
|
13
|
+
* `packages/cli/package.json` post-build. All workspace packages are
|
|
14
|
+
* stamped to the same version at release time
|
|
15
|
+
* (`pnpm -r exec npm version` in `.github/workflows/release.yml`), so
|
|
16
|
+
* either the cli or the umbrella package's version is correct.
|
|
17
|
+
*
|
|
18
|
+
* Why synchronous (not fire-and-forget): the CLI is a short-lived
|
|
19
|
+
* process. If the warning is printed asynchronously after the action's
|
|
20
|
+
* output, it risks getting buried or missed. Synchronous-await before
|
|
21
|
+
* the action runs ensures the warning is the first thing the user sees
|
|
22
|
+
* when their version is flagged. Worst-case 3s latency (timeout cap);
|
|
23
|
+
* typical 50-200ms against raw.githubusercontent.com.
|
|
24
|
+
*
|
|
25
|
+
* Exposed as a separate `preAction` hook (rather than mixed into the
|
|
26
|
+
* existing one) so the existing hook stays sync — Commander runs
|
|
27
|
+
* registered hooks in order, so the sync hook fires first (diagnostic
|
|
28
|
+
* logger, dry-run capture, format mutex), then this async one.
|
|
29
|
+
*
|
|
30
|
+
* `exit` is parameterised for testability — production callers omit it
|
|
31
|
+
* (defaults to `process.exit`); tests inject a spy that throws instead
|
|
32
|
+
* of terminating the test runner.
|
|
33
|
+
*/
|
|
34
|
+
export interface KillSwitchHookOptions {
|
|
35
|
+
/** Override for `process.exit`. Defaults to the real exit (refuse path). */
|
|
36
|
+
exit?: (code: number) => never;
|
|
37
|
+
/** Override for stderr writer. Defaults to `process.stderr.write`. */
|
|
38
|
+
writeStderr?: (chunk: string) => void;
|
|
39
|
+
/** Override the running version (default: read from this package's package.json). */
|
|
40
|
+
version?: string;
|
|
41
|
+
/** Override the manifest URL (default: project raw.githubusercontent.com URL). */
|
|
42
|
+
url?: string;
|
|
43
|
+
/** Override the timeout (default: `KILL_SWITCH_DEFAULT_TIMEOUT_MS`). */
|
|
44
|
+
timeoutMs?: number;
|
|
45
|
+
/** Injected fetch (default: global). Tests pass a mock. */
|
|
46
|
+
fetchFn?: typeof globalThis.fetch;
|
|
47
|
+
}
|
|
48
|
+
export declare function runKillSwitchAtStartup(opts?: KillSwitchHookOptions): Promise<void>;
|
|
49
|
+
//# sourceMappingURL=kill-switch-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kill-switch-hook.d.ts","sourceRoot":"","sources":["../../src/lib/kill-switch-hook.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;IAC/B,sEAAsE;IACtE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACnC;AAED,wBAAsB,sBAAsB,CAAC,IAAI,GAAE,qBAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC5F"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { checkKillSwitch, formatKillSwitchMessage, KILL_SWITCH_DEFAULT_TIMEOUT_MS, readPackageVersion, } from "@ttctl/core";
|
|
4
|
+
export async function runKillSwitchAtStartup(opts = {}) {
|
|
5
|
+
const writeStderr = opts.writeStderr ??
|
|
6
|
+
((chunk) => {
|
|
7
|
+
process.stderr.write(chunk);
|
|
8
|
+
});
|
|
9
|
+
const exit = opts.exit ??
|
|
10
|
+
((code) => {
|
|
11
|
+
process.exit(code);
|
|
12
|
+
});
|
|
13
|
+
const version = opts.version ?? readPackageVersion(import.meta.url);
|
|
14
|
+
const result = await checkKillSwitch({
|
|
15
|
+
version,
|
|
16
|
+
...(opts.url !== undefined ? { url: opts.url } : {}),
|
|
17
|
+
timeoutMs: opts.timeoutMs ?? KILL_SWITCH_DEFAULT_TIMEOUT_MS,
|
|
18
|
+
...(opts.fetchFn !== undefined ? { fetchFn: opts.fetchFn } : {}),
|
|
19
|
+
});
|
|
20
|
+
if (result.status !== "match") {
|
|
21
|
+
// disabled | no-match | fetch-failed — all silent per fail-silent
|
|
22
|
+
// contract. Diagnostic logging of fetch-failed is intentionally
|
|
23
|
+
// omitted to avoid noise in restrictive networks (corporate, CI,
|
|
24
|
+
// offline laptops); users can flip TTCTL_DEBUG_CONFIG to inspect
|
|
25
|
+
// the configWriter taxonomy but kill-switch deliberately stays
|
|
26
|
+
// out of that surface.
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
writeStderr(formatKillSwitchMessage({ toolName: "ttctl", version, entry: result.entry }));
|
|
30
|
+
if (result.entry.action === "refuse") {
|
|
31
|
+
exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=kill-switch-hook.js.map
|
|
@@ -0,0 +1 @@
|
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vB,OAAO;IACT,CAAC;IAED,WAAW,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAE1F,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-CLI output format for `show` and `list` commands.
|
|
3
|
+
*
|
|
4
|
+
* - `pretty`: human-formatted layout (default; trimmed/laid out for direct
|
|
5
|
+
* terminal reading). Internally dispatches on shape — `show` verbs render
|
|
6
|
+
* a curated key:value layout via the caller-supplied `pretty` formatter,
|
|
7
|
+
* `list` verbs render a column-aligned table via the caller-supplied
|
|
8
|
+
* `table` formatter, and paragraph-bearing lists render a curated
|
|
9
|
+
* multi-line layout (the override registry at
|
|
10
|
+
* `lib/format-overrides.ts` carries the strategy classification; the
|
|
11
|
+
* shape dispatch is internal — `pretty` is the only user-visible name
|
|
12
|
+
* for the human layout).
|
|
13
|
+
* - `json`: stable single-line JSON, suitable for piping to `jq` or `yq`.
|
|
14
|
+
* - `yaml`: block-style YAML rendered via `yaml.stringify` with
|
|
15
|
+
* `customTags: []` (no `!!timestamp` auto-parse on roundtrip),
|
|
16
|
+
* `aliasDuplicateObjects: false` (no `&anchor`/`*alias` noise on
|
|
17
|
+
* duplicate references), and `lineWidth: 0` (no line wrapping —
|
|
18
|
+
* preserves field-level semantic boundaries; the terminal wraps if
|
|
19
|
+
* needed). Multi-paragraph string fields surface as `|` literal block
|
|
20
|
+
* scalars; lists as block style (`- item`, not `[item]`). The data
|
|
21
|
+
* layer is responsible for shaping `Date` values to ISO 8601 strings
|
|
22
|
+
* BEFORE invoking the helper — explicit conversion is safer than
|
|
23
|
+
* relying on the YAML lib's date handling.
|
|
24
|
+
*
|
|
25
|
+
* The JSON shape commitment is "may break across 0.x" pre-1.0 and
|
|
26
|
+
* "stable across majors per semver" at 1.0+; the helper enforces
|
|
27
|
+
* single-line JSON to keep that contract observable to downstream tools.
|
|
28
|
+
*
|
|
29
|
+
* The pre-#126 enum carried `text` and `table` as user-visible values;
|
|
30
|
+
* both were collapsed into the single `pretty` name with internal shape
|
|
31
|
+
* dispatch. Pre-launch is free moves — there are no backward-compat
|
|
32
|
+
* aliases.
|
|
33
|
+
*/
|
|
34
|
+
export type OutputFormat = "pretty" | "json" | "yaml";
|
|
35
|
+
/**
|
|
36
|
+
* All valid `OutputFormat` values, intended for `commander`'s
|
|
37
|
+
* `Option#choices()`. Frozen at the type level via `readonly` so callers
|
|
38
|
+
* cannot mutate the shared array.
|
|
39
|
+
*/
|
|
40
|
+
export declare const OUTPUT_FORMATS: readonly OutputFormat[];
|
|
41
|
+
/**
|
|
42
|
+
* Caller-supplied formatters per format. Each returns the exact string
|
|
43
|
+
* to emit on stdout (the helper appends a single trailing newline). The
|
|
44
|
+
* `json` and `yaml` formats have no formatter slot — the helper
|
|
45
|
+
* stringifies the data directly via `JSON.stringify(data)` /
|
|
46
|
+
* `formatYaml(data)`.
|
|
47
|
+
*
|
|
48
|
+
* `pretty` is the user-visible human-layout slot used by `show` verbs
|
|
49
|
+
* for curated key:value renderings. `table` is an internal-only slot
|
|
50
|
+
* used by `list` verbs to provide a column-aligned table rendering.
|
|
51
|
+
* The user-visible `pretty` format internally dispatches on data shape
|
|
52
|
+
* (per #126):
|
|
53
|
+
*
|
|
54
|
+
* - data is array-shaped or `{items: [...]}`-shaped (list) → prefer
|
|
55
|
+
* `table`, fall back to `pretty`.
|
|
56
|
+
* - data is object-shaped (show) → prefer `pretty`, fall back to
|
|
57
|
+
* `table`.
|
|
58
|
+
* - neither formatter present → fall through to
|
|
59
|
+
* `JSON.stringify(_, null, 2)` plus a stderr warning.
|
|
60
|
+
*
|
|
61
|
+
* The shape dispatch is internal — `pretty` is the only user-visible
|
|
62
|
+
* name for the human layout. Show / list / paragraph-bearing-list
|
|
63
|
+
* routing is the dispatcher's job, not the user's.
|
|
64
|
+
*
|
|
65
|
+
* `empty` opts the call site into the empty-state wrapper (#122). When
|
|
66
|
+
* present AND `isEmptyCollection(data)` returns true, the wrapper
|
|
67
|
+
* short-circuits BEFORE per-format dispatch and emits a per-format
|
|
68
|
+
* empty payload — `[]` (single-line) for `json`; the prose+CTA from
|
|
69
|
+
* `emptyStateProse(empty.command)` for `pretty` (deliberately AVOIDS a
|
|
70
|
+
* header-only `cli-table3` grid, which the v0.4 reframe categorised
|
|
71
|
+
* as a "looks broken" pattern). The wrapper is opt-in (not auto-fire on
|
|
72
|
+
* every call) so search leaves like `autocomplete` — which return
|
|
73
|
+
* arrays but want a query-aware "no matches" line, not a create-CTA —
|
|
74
|
+
* can keep their custom empty handling without overriding.
|
|
75
|
+
*/
|
|
76
|
+
export interface OutputFormatters<T> {
|
|
77
|
+
pretty?: (data: T) => string;
|
|
78
|
+
table?: (data: T) => string;
|
|
79
|
+
empty?: {
|
|
80
|
+
command: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Stderr hint surfaced when the helper falls through to pretty-printed
|
|
85
|
+
* JSON because no `pretty` or `table` formatter was provided. Exposed as
|
|
86
|
+
* a constant so tests can assert on the exact wording without
|
|
87
|
+
* duplicating it.
|
|
88
|
+
*/
|
|
89
|
+
export declare const PRETTY_FALLBACK_HINT = "note: no pretty formatter provided; falling back to pretty-printed JSON.";
|
|
90
|
+
/**
|
|
91
|
+
* Render `data` as block-style YAML.
|
|
92
|
+
*
|
|
93
|
+
* Behavior:
|
|
94
|
+
*
|
|
95
|
+
* - Multi-paragraph strings surface as `|` literal block scalars (the
|
|
96
|
+
* YAML lib's default for strings containing newlines), preserving
|
|
97
|
+
* paragraph breaks visually rather than escaping them as `\n`.
|
|
98
|
+
* - Strings already shaped as ISO 8601 by the data layer (e.g.,
|
|
99
|
+
* `"2026-05-10T05:45:00Z"`) render quoted, NOT auto-converted to a
|
|
100
|
+
* `!!timestamp` tag — `customTags: []` ensures stability of the
|
|
101
|
+
* roundtrip contract.
|
|
102
|
+
* - Numeric fields render as their natural YAML scalar type (numbers,
|
|
103
|
+
* not strings).
|
|
104
|
+
* - Lists and maps render in block style (`- item`, `key: value`),
|
|
105
|
+
* never flow style (`[item]`, `{key: value}`).
|
|
106
|
+
*
|
|
107
|
+
* The yaml lib's `stringify` always appends a trailing newline; this
|
|
108
|
+
* helper strips it so the formatter contract matches `JSON.stringify`'s
|
|
109
|
+
* (no trailing newline). `emitResult` then appends exactly one trailing
|
|
110
|
+
* newline when writing to stdout.
|
|
111
|
+
*
|
|
112
|
+
* The helper does NOT validate `data` for YAML-safe shapes (cycles,
|
|
113
|
+
* `BigInt`, `Date` objects, `undefined`, etc.); callers shape data into
|
|
114
|
+
* YAML-friendly form before invoking. In particular: convert `Date` to
|
|
115
|
+
* ISO 8601 strings at the data layer.
|
|
116
|
+
*/
|
|
117
|
+
export declare function formatYaml(data: unknown): string;
|
|
118
|
+
/**
|
|
119
|
+
* Result of resolving a `(data, format, options)` triple to a string for
|
|
120
|
+
* stdout. The optional `warning` field is present only when the helper
|
|
121
|
+
* fell through to a default branch worth surfacing on stderr (currently:
|
|
122
|
+
* `pretty` with neither `pretty` nor `table` formatter). Callers using
|
|
123
|
+
* `formatResult` directly can inspect this field instead of letting
|
|
124
|
+
* `emitResult` write to stderr.
|
|
125
|
+
*
|
|
126
|
+
* `exactOptionalPropertyTypes` is enabled, so `warning` is either absent
|
|
127
|
+
* or a string — never `undefined`.
|
|
128
|
+
*/
|
|
129
|
+
export type FormatResult = {
|
|
130
|
+
output: string;
|
|
131
|
+
} | {
|
|
132
|
+
output: string;
|
|
133
|
+
warning: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Format `data` per `format` and return the string to emit, plus an
|
|
137
|
+
* optional `warning` line suitable for stderr. Pure — no I/O.
|
|
138
|
+
*
|
|
139
|
+
* Behavior summary:
|
|
140
|
+
*
|
|
141
|
+
* - `json` → `JSON.stringify(data)` (single-line; no extra whitespace)
|
|
142
|
+
* - `yaml` → `formatYaml(data)` (block-style YAML; no formatter slot —
|
|
143
|
+
* the helper is the single source of truth for `yaml` rendering)
|
|
144
|
+
* - `pretty` → shape-dispatched human layout:
|
|
145
|
+
* - list-shape data (array, `{items: [...]}`) → prefer
|
|
146
|
+
* `options.table`, fall back to `options.pretty`
|
|
147
|
+
* - show-shape data (single object) → prefer `options.pretty`, fall
|
|
148
|
+
* back to `options.table`
|
|
149
|
+
* - neither formatter present → `JSON.stringify(data, null, 2)` plus
|
|
150
|
+
* a stderr warning
|
|
151
|
+
*
|
|
152
|
+
* The helper does NOT validate `data` for JSON/YAML-safe shapes
|
|
153
|
+
* (cycles, `undefined`, `Date`, `BigInt`, etc.); callers are
|
|
154
|
+
* responsible for shaping data into a serialization-friendly form
|
|
155
|
+
* before passing it.
|
|
156
|
+
*
|
|
157
|
+
* The `format` parameter defaults to `"pretty"` so the spec's "default
|
|
158
|
+
* format is pretty" behavior holds even when commander defaults aren't
|
|
159
|
+
* available (e.g., direct programmatic use).
|
|
160
|
+
*/
|
|
161
|
+
export declare function formatResult<T>(data: T, format?: OutputFormat, options?: OutputFormatters<T>): FormatResult;
|
|
162
|
+
/**
|
|
163
|
+
* Format `data` per `format` and write the result to `process.stdout`
|
|
164
|
+
* (with a trailing newline). When `formatResult` surfaces a `warning`
|
|
165
|
+
* (`pretty` fall-through with neither formatter), it's written to
|
|
166
|
+
* `process.stderr` BEFORE the stdout payload — keeping stdout
|
|
167
|
+
* structured for downstream consumers.
|
|
168
|
+
*
|
|
169
|
+
* Tests can spy on `process.stdout.write` and `process.stderr.write` to
|
|
170
|
+
* assert the exact bytes emitted.
|
|
171
|
+
*/
|
|
172
|
+
export declare function emitResult<T>(data: T, format?: OutputFormat, options?: OutputFormatters<T>): void;
|
|
173
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@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AAC,CAAM,GAAG,IAAI,CAM/G"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { stringify as yamlStringify } from "yaml";
|
|
4
|
+
import { emptyStateProse, isEmptyCollection } from "./empty-state-cta.js";
|
|
5
|
+
/**
|
|
6
|
+
* All valid `OutputFormat` values, intended for `commander`'s
|
|
7
|
+
* `Option#choices()`. Frozen at the type level via `readonly` so callers
|
|
8
|
+
* cannot mutate the shared array.
|
|
9
|
+
*/
|
|
10
|
+
export const OUTPUT_FORMATS = ["pretty", "json", "yaml"];
|
|
11
|
+
/**
|
|
12
|
+
* Detect whether `data` is list-shaped — an array (current top-level
|
|
13
|
+
* shape) or `{items: [...]}` (the future `{items, pageInfo?}` envelope
|
|
14
|
+
* reserved by the v0.4 reframe). Used by the `pretty` dispatcher to
|
|
15
|
+
* pick `table` vs `pretty` formatter on shape (`list` → `table`,
|
|
16
|
+
* `show` → `pretty`).
|
|
17
|
+
*
|
|
18
|
+
* Returns `false` for `null`, scalars, and objects without an `items`
|
|
19
|
+
* field — those collapse to the show branch. Note this is a
|
|
20
|
+
* NON-emptiness signal: `[]` is still list-shape (the empty-state
|
|
21
|
+
* wrapper handles the empty case BEFORE the dispatcher fires; once it
|
|
22
|
+
* passes through to dispatch, the array's emptiness no longer matters).
|
|
23
|
+
*/
|
|
24
|
+
function isListShape(data) {
|
|
25
|
+
if (Array.isArray(data))
|
|
26
|
+
return true;
|
|
27
|
+
if (typeof data !== "object" || data === null)
|
|
28
|
+
return false;
|
|
29
|
+
if (!Object.prototype.hasOwnProperty.call(data, "items"))
|
|
30
|
+
return false;
|
|
31
|
+
return Array.isArray(data.items);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Stderr hint surfaced when the helper falls through to pretty-printed
|
|
35
|
+
* JSON because no `pretty` or `table` formatter was provided. Exposed as
|
|
36
|
+
* a constant so tests can assert on the exact wording without
|
|
37
|
+
* duplicating it.
|
|
38
|
+
*/
|
|
39
|
+
export const PRETTY_FALLBACK_HINT = "note: no pretty formatter provided; falling back to pretty-printed JSON.";
|
|
40
|
+
/**
|
|
41
|
+
* Configuration object passed to `yaml.stringify` for the `yaml` output
|
|
42
|
+
* format. Module-private; `const`-declared so callers cannot rebind
|
|
43
|
+
* (the yaml lib's options type is mutable, so we cannot deep-freeze
|
|
44
|
+
* without a type cast — module isolation is sufficient).
|
|
45
|
+
*
|
|
46
|
+
* - `customTags: []` — disable the lib's optional tags (`!!timestamp`,
|
|
47
|
+
* `!!binary`, etc.) so dates/datetimes encoded as ISO 8601 strings by
|
|
48
|
+
* the data layer surface verbatim instead of being re-emitted with
|
|
49
|
+
* tag prefixes (which would break roundtrip parsers configured to
|
|
50
|
+
* reject custom tags).
|
|
51
|
+
* - `aliasDuplicateObjects: false` — emit duplicate object references
|
|
52
|
+
* inline rather than as `&anchor`/`*alias` pairs, keeping output
|
|
53
|
+
* readable for non-YAML-savvy consumers.
|
|
54
|
+
* - `lineWidth: 0` — disable line wrapping. Field-level semantic
|
|
55
|
+
* boundaries stay intact; the terminal wraps for display if needed.
|
|
56
|
+
*/
|
|
57
|
+
const YAML_STRINGIFY_OPTIONS = {
|
|
58
|
+
customTags: [],
|
|
59
|
+
aliasDuplicateObjects: false,
|
|
60
|
+
lineWidth: 0,
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Render `data` as block-style YAML.
|
|
64
|
+
*
|
|
65
|
+
* Behavior:
|
|
66
|
+
*
|
|
67
|
+
* - Multi-paragraph strings surface as `|` literal block scalars (the
|
|
68
|
+
* YAML lib's default for strings containing newlines), preserving
|
|
69
|
+
* paragraph breaks visually rather than escaping them as `\n`.
|
|
70
|
+
* - Strings already shaped as ISO 8601 by the data layer (e.g.,
|
|
71
|
+
* `"2026-05-10T05:45:00Z"`) render quoted, NOT auto-converted to a
|
|
72
|
+
* `!!timestamp` tag — `customTags: []` ensures stability of the
|
|
73
|
+
* roundtrip contract.
|
|
74
|
+
* - Numeric fields render as their natural YAML scalar type (numbers,
|
|
75
|
+
* not strings).
|
|
76
|
+
* - Lists and maps render in block style (`- item`, `key: value`),
|
|
77
|
+
* never flow style (`[item]`, `{key: value}`).
|
|
78
|
+
*
|
|
79
|
+
* The yaml lib's `stringify` always appends a trailing newline; this
|
|
80
|
+
* helper strips it so the formatter contract matches `JSON.stringify`'s
|
|
81
|
+
* (no trailing newline). `emitResult` then appends exactly one trailing
|
|
82
|
+
* newline when writing to stdout.
|
|
83
|
+
*
|
|
84
|
+
* The helper does NOT validate `data` for YAML-safe shapes (cycles,
|
|
85
|
+
* `BigInt`, `Date` objects, `undefined`, etc.); callers shape data into
|
|
86
|
+
* YAML-friendly form before invoking. In particular: convert `Date` to
|
|
87
|
+
* ISO 8601 strings at the data layer.
|
|
88
|
+
*/
|
|
89
|
+
export function formatYaml(data) {
|
|
90
|
+
const out = yamlStringify(data, YAML_STRINGIFY_OPTIONS);
|
|
91
|
+
return out.endsWith("\n") ? out.slice(0, -1) : out;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Format `data` per `format` and return the string to emit, plus an
|
|
95
|
+
* optional `warning` line suitable for stderr. Pure — no I/O.
|
|
96
|
+
*
|
|
97
|
+
* Behavior summary:
|
|
98
|
+
*
|
|
99
|
+
* - `json` → `JSON.stringify(data)` (single-line; no extra whitespace)
|
|
100
|
+
* - `yaml` → `formatYaml(data)` (block-style YAML; no formatter slot —
|
|
101
|
+
* the helper is the single source of truth for `yaml` rendering)
|
|
102
|
+
* - `pretty` → shape-dispatched human layout:
|
|
103
|
+
* - list-shape data (array, `{items: [...]}`) → prefer
|
|
104
|
+
* `options.table`, fall back to `options.pretty`
|
|
105
|
+
* - show-shape data (single object) → prefer `options.pretty`, fall
|
|
106
|
+
* back to `options.table`
|
|
107
|
+
* - neither formatter present → `JSON.stringify(data, null, 2)` plus
|
|
108
|
+
* a stderr warning
|
|
109
|
+
*
|
|
110
|
+
* The helper does NOT validate `data` for JSON/YAML-safe shapes
|
|
111
|
+
* (cycles, `undefined`, `Date`, `BigInt`, etc.); callers are
|
|
112
|
+
* responsible for shaping data into a serialization-friendly form
|
|
113
|
+
* before passing it.
|
|
114
|
+
*
|
|
115
|
+
* The `format` parameter defaults to `"pretty"` so the spec's "default
|
|
116
|
+
* format is pretty" behavior holds even when commander defaults aren't
|
|
117
|
+
* available (e.g., direct programmatic use).
|
|
118
|
+
*/
|
|
119
|
+
export function formatResult(data, format = "pretty", options = {}) {
|
|
120
|
+
// Empty-state wrapper (#122): fires BEFORE per-format dispatch when
|
|
121
|
+
// the caller opts in via `options.empty` AND `data` is detected as an
|
|
122
|
+
// empty collection (`[]` or `{items: []}`). Pretty mode renders the
|
|
123
|
+
// CTA prose; JSON / YAML fall through to normal serialization so the
|
|
124
|
+
// list envelope (`{version, items: []}`, per #128) is preserved on
|
|
125
|
+
// empty collections — the pre-#147 behavior of emitting a literal
|
|
126
|
+
// "[]" on the JSON path silently dropped the envelope wrapper, which
|
|
127
|
+
// tripped E2E suites that read `.items` (surfaced by #147 round-trip).
|
|
128
|
+
if (options.empty !== undefined && isEmptyCollection(data)) {
|
|
129
|
+
if (format === "pretty") {
|
|
130
|
+
return { output: emptyStateProse(options.empty.command) };
|
|
131
|
+
}
|
|
132
|
+
// json / yaml: fall through to normal serialization
|
|
133
|
+
}
|
|
134
|
+
if (format === "json") {
|
|
135
|
+
return { output: JSON.stringify(data) };
|
|
136
|
+
}
|
|
137
|
+
if (format === "yaml") {
|
|
138
|
+
return { output: formatYaml(data) };
|
|
139
|
+
}
|
|
140
|
+
// pretty branch — internal shape dispatch (per #126 AC):
|
|
141
|
+
// - list-shape data → table formatter (the column-aligned default for
|
|
142
|
+
// list verbs; matches pre-#126 `--output=table` behavior)
|
|
143
|
+
// - show-shape data → pretty formatter (the curated key:value layout
|
|
144
|
+
// for show verbs; matches pre-#126 `--output=text` behavior)
|
|
145
|
+
// - missing formatters fall through to JSON pretty-print + warning
|
|
146
|
+
if (isListShape(data)) {
|
|
147
|
+
if (options.table !== undefined)
|
|
148
|
+
return { output: options.table(data) };
|
|
149
|
+
if (options.pretty !== undefined)
|
|
150
|
+
return { output: options.pretty(data) };
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (options.pretty !== undefined)
|
|
154
|
+
return { output: options.pretty(data) };
|
|
155
|
+
if (options.table !== undefined)
|
|
156
|
+
return { output: options.table(data) };
|
|
157
|
+
}
|
|
158
|
+
return { output: JSON.stringify(data, null, 2), warning: PRETTY_FALLBACK_HINT };
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Format `data` per `format` and write the result to `process.stdout`
|
|
162
|
+
* (with a trailing newline). When `formatResult` surfaces a `warning`
|
|
163
|
+
* (`pretty` fall-through with neither formatter), it's written to
|
|
164
|
+
* `process.stderr` BEFORE the stdout payload — keeping stdout
|
|
165
|
+
* structured for downstream consumers.
|
|
166
|
+
*
|
|
167
|
+
* Tests can spy on `process.stdout.write` and `process.stderr.write` to
|
|
168
|
+
* assert the exact bytes emitted.
|
|
169
|
+
*/
|
|
170
|
+
export function emitResult(data, format = "pretty", options = {}) {
|
|
171
|
+
const result = formatResult(data, format, options);
|
|
172
|
+
if ("warning" in result) {
|
|
173
|
+
process.stderr.write(`${result.warning}\n`);
|
|
174
|
+
}
|
|
175
|
+
process.stdout.write(`${result.output}\n`);
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAqC1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,cA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,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAClF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CAAI,IAAO,EAAE,SAAuB,QAAQ,EAAE,UAA+B,EAAE;IACvG,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination flag values as parsed off a Commander leaf. Both fields
|
|
3
|
+
* are independent — one may be passed without the other (the server
|
|
4
|
+
* fills the missing one with its default). User-facing values are
|
|
5
|
+
* 1-indexed; service-layer translation to wire-indexing happens inside
|
|
6
|
+
* the per-service `list()` adapter, not here.
|
|
7
|
+
*
|
|
8
|
+
* Declared per paginating leaf (#183, follow-up to #138). Action
|
|
9
|
+
* handlers read these directly off their Commander `opts()` payload —
|
|
10
|
+
* no module-scoped capture, no global enforcement. Leaves whose wire
|
|
11
|
+
* operation does not paginate simply do not declare the flags; Commander
|
|
12
|
+
* emits its standard `error: unknown option '--page'` (exit 1) when a
|
|
13
|
+
* user passes the flag to such a leaf, which is the right error
|
|
14
|
+
* pedagogy (a global advertisement followed by a per-command refusal
|
|
15
|
+
* was an architectural category error — see #183 deliberation).
|
|
16
|
+
*
|
|
17
|
+
* `exactOptionalPropertyTypes` is enabled, so absent fields are
|
|
18
|
+
* literally missing rather than `undefined`.
|
|
19
|
+
*/
|
|
20
|
+
export interface PaginationOptions {
|
|
21
|
+
/** 1-indexed page number; must be ≥ 1. */
|
|
22
|
+
page?: number;
|
|
23
|
+
/** Items per page; must be ≥ 1. Upper bound is server-enforced. */
|
|
24
|
+
perPage?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Custom Commander argument parser for `--page <number>` and
|
|
28
|
+
* `--per-page <number>`. Both flags share the same constraint set —
|
|
29
|
+
* positive integers — so the parser is reused via `Option.argParser`
|
|
30
|
+
* on each paginating leaf.
|
|
31
|
+
*
|
|
32
|
+
* Rejects:
|
|
33
|
+
*
|
|
34
|
+
* - empty strings (`""`)
|
|
35
|
+
* - non-numeric input (`"abc"`, `"1.5"`, `"1e3"`, `"0x10"`)
|
|
36
|
+
* - non-finite values (`NaN`, `Infinity`)
|
|
37
|
+
* - zero or negative values (`"0"`, `"-1"`)
|
|
38
|
+
*
|
|
39
|
+
* Returns the parsed integer on success. Throws
|
|
40
|
+
* `InvalidArgumentError` (Commander surfaces it as a parse-time error
|
|
41
|
+
* before any sub-command action runs).
|
|
42
|
+
*
|
|
43
|
+
* The strict regex (`^[1-9][0-9]*$`) is the gating check — `Number()`
|
|
44
|
+
* alone would accept `"1.5"`, `"1e3"`, `"0x10"`, leading/trailing
|
|
45
|
+
* whitespace, signs, etc. The integer-shape constraint is part of the
|
|
46
|
+
* AC contract ("--page <number>", 1-indexed) and the wire constraint.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parsePaginationFlag(name: string, raw: string): number;
|
|
49
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/lib/pagination.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CASrE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (C) 2026 Oleksii PELYKH
|
|
3
|
+
import { InvalidArgumentError } from "commander";
|
|
4
|
+
/**
|
|
5
|
+
* Custom Commander argument parser for `--page <number>` and
|
|
6
|
+
* `--per-page <number>`. Both flags share the same constraint set —
|
|
7
|
+
* positive integers — so the parser is reused via `Option.argParser`
|
|
8
|
+
* on each paginating leaf.
|
|
9
|
+
*
|
|
10
|
+
* Rejects:
|
|
11
|
+
*
|
|
12
|
+
* - empty strings (`""`)
|
|
13
|
+
* - non-numeric input (`"abc"`, `"1.5"`, `"1e3"`, `"0x10"`)
|
|
14
|
+
* - non-finite values (`NaN`, `Infinity`)
|
|
15
|
+
* - zero or negative values (`"0"`, `"-1"`)
|
|
16
|
+
*
|
|
17
|
+
* Returns the parsed integer on success. Throws
|
|
18
|
+
* `InvalidArgumentError` (Commander surfaces it as a parse-time error
|
|
19
|
+
* before any sub-command action runs).
|
|
20
|
+
*
|
|
21
|
+
* The strict regex (`^[1-9][0-9]*$`) is the gating check — `Number()`
|
|
22
|
+
* alone would accept `"1.5"`, `"1e3"`, `"0x10"`, leading/trailing
|
|
23
|
+
* whitespace, signs, etc. The integer-shape constraint is part of the
|
|
24
|
+
* AC contract ("--page <number>", 1-indexed) and the wire constraint.
|
|
25
|
+
*/
|
|
26
|
+
export function parsePaginationFlag(name, raw) {
|
|
27
|
+
if (!/^[1-9][0-9]*$/.test(raw)) {
|
|
28
|
+
throw new InvalidArgumentError(`${name} must be a positive integer (got: ${JSON.stringify(raw)})`);
|
|
29
|
+
}
|
|
30
|
+
const n = Number(raw);
|
|
31
|
+
if (!Number.isInteger(n) || n < 1) {
|
|
32
|
+
throw new InvalidArgumentError(`${name} must be a positive integer (got: ${JSON.stringify(raw)})`);
|
|
33
|
+
}
|
|
34
|
+
return n;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/lib/pagination.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AA4BjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,GAAW;IAC3D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,oBAAoB,CAAC,GAAG,IAAI,qCAAqC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrG,CAAC;IACD,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,oBAAoB,CAAC,GAAG,IAAI,qCAAqC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Build the root TTCtl Commander program. Sub-commands are registered as they
|
|
4
|
+
* land in milestones; the program is shaped as a noun-verb tree (e.g.,
|
|
5
|
+
* `ttctl profile show`, `ttctl timesheet list`).
|
|
6
|
+
*
|
|
7
|
+
* Global options:
|
|
8
|
+
*
|
|
9
|
+
* `--config <path>` — explicit path to the YAML config, takes precedence
|
|
10
|
+
* over `TTCTL_CONFIG_FILE` and the home dotfile. Validated at invocation
|
|
11
|
+
* time (before any sub-command's action runs) — a missing file surfaces
|
|
12
|
+
* as `ConfigError(code: NO_CREDS)` rather than failing later inside
|
|
13
|
+
* `loadConfigFile`. Honors `aws --profile` / `kubectl --kubeconfig` UX
|
|
14
|
+
* expectations.
|
|
15
|
+
*
|
|
16
|
+
* Resolution precedence (highest → lowest, post-#107):
|
|
17
|
+
*
|
|
18
|
+
* 1. `--config <path>` — this flag (per-invocation)
|
|
19
|
+
* 2. `TTCTL_CONFIG_FILE` env — process-scoped (CI, direnv)
|
|
20
|
+
* 3. `~/.ttctl.yaml` — POSIX home dotfile (only fallback)
|
|
21
|
+
*
|
|
22
|
+
* The CWD `./.ttctl.yaml` is NOT auto-discovered (closed in #92).
|
|
23
|
+
* XDG paths (`$XDG_CONFIG_HOME/ttctl/config.yaml`,
|
|
24
|
+
* `~/.config/ttctl/config.yaml`) are NOT consulted (closed in #107 — the
|
|
25
|
+
* single-file model places the captured bearer in the same YAML, so
|
|
26
|
+
* `~/.ttctl.yaml` is the canonical home location).
|
|
27
|
+
*
|
|
28
|
+
* `--json` / `--yaml` — boolean shortcuts for `--output=json` /
|
|
29
|
+
* `--output=yaml` (post-#126). Mutual exclusion with `--output`/`-o` is
|
|
30
|
+
* enforced in the preAction hook: any two of `{--output, -o, --json,
|
|
31
|
+
* --yaml}` present together raise a parse-time error before the
|
|
32
|
+
* sub-command's action runs.
|
|
33
|
+
*
|
|
34
|
+
* `--dry-run` (issue #52) — preview a mutation without sending it.
|
|
35
|
+
* Captured into the module-scoped `cliDryRun` holder via
|
|
36
|
+
* `setCliDryRun` in the preAction hook so mutation handlers can read
|
|
37
|
+
* it through `getCliDryRun()`. Leaf commands tagged via
|
|
38
|
+
* `markMutation()` (in their `build*Command` factories) route the
|
|
39
|
+
* value through to the core layer's `dryRun` option; non-mutation
|
|
40
|
+
* leaves get a one-line stderr no-op note from the preAction hook
|
|
41
|
+
* (`DRY_RUN_NO_OP_STDERR_NOTE`) and proceed normally.
|
|
42
|
+
*
|
|
43
|
+
* MCP tool integration is conditional on issue #10 having landed —
|
|
44
|
+
* when MCP tools that wrap mutations ship, they accept the same
|
|
45
|
+
* `dryRun?: boolean` input parameter and route through the same core
|
|
46
|
+
* `dryRun` option. Until then, no MCP-side wiring is required.
|
|
47
|
+
*
|
|
48
|
+
* `--verbose` / `--debug` (issue #139) — diagnostic observability for
|
|
49
|
+
* transport-level request/response activity. `--verbose` emits a
|
|
50
|
+
* one-line request descriptor + one-line response status per
|
|
51
|
+
* transport call to STDERR; `--debug` emits full JSON-encoded
|
|
52
|
+
* request/response envelopes (including redacted headers and body)
|
|
53
|
+
* to STDERR. Both write EXCLUSIVELY to stderr — the stdout data
|
|
54
|
+
* channel (json/yaml/pretty envelopes per #126/#128) is never
|
|
55
|
+
* touched, so `--debug --output=json` works as one would expect:
|
|
56
|
+
* structured data on stdout, redacted debug trace on stderr.
|
|
57
|
+
*
|
|
58
|
+
* Mutual relationship: `--debug` is a strict superset of
|
|
59
|
+
* `--verbose`; if both are passed, `--debug` wins (no warning —
|
|
60
|
+
* the user got what they implicitly asked for, the verbose-tier
|
|
61
|
+
* data is a subset of the debug-tier data). The preAction hook
|
|
62
|
+
* computes the effective level and routes it through
|
|
63
|
+
* `setDiagnosticLogger` so every transport (stockTransport,
|
|
64
|
+
* impersonatedTransport, impersonatedMultipartTransport, and the
|
|
65
|
+
* hand-rolled photo-upload path in profile/basic) emits the same
|
|
66
|
+
* shape. Secret redaction (cookies, authorization headers,
|
|
67
|
+
* password / token / secret body fields, the
|
|
68
|
+
* `user_<24hex>_<20alnum>` bearer pattern) is applied by the
|
|
69
|
+
* `redact` module BEFORE serialization, so verbatim bearers /
|
|
70
|
+
* cookies cannot appear in either log tier.
|
|
71
|
+
*
|
|
72
|
+
* Pagination flags are declared PER paginating leaf (`jobs list`,
|
|
73
|
+
* `jobs saved`, `jobs viewed`, `jobs not-interested-list`) rather
|
|
74
|
+
* than globally — see #183 (follow-up to #138). The leaf's `--help`
|
|
75
|
+
* is the source of truth for "does this command paginate?"; Commander
|
|
76
|
+
* emits its standard `error: unknown option '--page'` (exit 1) when
|
|
77
|
+
* the flag is passed to a non-paginating leaf.
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildProgram(): Command;
|
|
80
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAoB5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAoLtC"}
|