@ttctl/cli 0.0.0 → 0.1.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/README.md +44 -9
  2. package/dist/commands/applications/index.d.ts +21 -0
  3. package/dist/commands/applications/index.d.ts.map +1 -0
  4. package/dist/commands/applications/index.js +87 -0
  5. package/dist/commands/applications/index.js.map +1 -0
  6. package/dist/commands/applications/list.d.ts +55 -0
  7. package/dist/commands/applications/list.d.ts.map +1 -0
  8. package/dist/commands/applications/list.js +106 -0
  9. package/dist/commands/applications/list.js.map +1 -0
  10. package/dist/commands/applications/shared.d.ts +14 -0
  11. package/dist/commands/applications/shared.d.ts.map +1 -0
  12. package/dist/commands/applications/shared.js +19 -0
  13. package/dist/commands/applications/shared.js.map +1 -0
  14. package/dist/commands/applications/show.d.ts +51 -0
  15. package/dist/commands/applications/show.d.ts.map +1 -0
  16. package/dist/commands/applications/show.js +154 -0
  17. package/dist/commands/applications/show.js.map +1 -0
  18. package/dist/commands/applications/stats.d.ts +42 -0
  19. package/dist/commands/applications/stats.d.ts.map +1 -0
  20. package/dist/commands/applications/stats.js +69 -0
  21. package/dist/commands/applications/stats.js.map +1 -0
  22. package/dist/commands/auth/index.d.ts +17 -0
  23. package/dist/commands/auth/index.d.ts.map +1 -0
  24. package/dist/commands/auth/index.js +69 -0
  25. package/dist/commands/auth/index.js.map +1 -0
  26. package/dist/commands/auth/init.d.ts +98 -0
  27. package/dist/commands/auth/init.d.ts.map +1 -0
  28. package/dist/commands/auth/init.js +387 -0
  29. package/dist/commands/auth/init.js.map +1 -0
  30. package/dist/commands/auth/signin.d.ts +81 -0
  31. package/dist/commands/auth/signin.d.ts.map +1 -0
  32. package/dist/commands/auth/signin.js +145 -0
  33. package/dist/commands/auth/signin.js.map +1 -0
  34. package/dist/commands/auth/signout.d.ts +133 -0
  35. package/dist/commands/auth/signout.d.ts.map +1 -0
  36. package/dist/commands/auth/signout.js +172 -0
  37. package/dist/commands/auth/signout.js.map +1 -0
  38. package/dist/commands/auth/status.d.ts +62 -0
  39. package/dist/commands/auth/status.d.ts.map +1 -0
  40. package/dist/commands/auth/status.js +98 -0
  41. package/dist/commands/auth/status.js.map +1 -0
  42. package/dist/commands/availability/allocated-hours.d.ts +27 -0
  43. package/dist/commands/availability/allocated-hours.d.ts.map +1 -0
  44. package/dist/commands/availability/allocated-hours.js +61 -0
  45. package/dist/commands/availability/allocated-hours.js.map +1 -0
  46. package/dist/commands/availability/index.d.ts +30 -0
  47. package/dist/commands/availability/index.d.ts.map +1 -0
  48. package/dist/commands/availability/index.js +124 -0
  49. package/dist/commands/availability/index.js.map +1 -0
  50. package/dist/commands/availability/shared.d.ts +11 -0
  51. package/dist/commands/availability/shared.d.ts.map +1 -0
  52. package/dist/commands/availability/shared.js +30 -0
  53. package/dist/commands/availability/shared.js.map +1 -0
  54. package/dist/commands/availability/show.d.ts +32 -0
  55. package/dist/commands/availability/show.d.ts.map +1 -0
  56. package/dist/commands/availability/show.js +86 -0
  57. package/dist/commands/availability/show.js.map +1 -0
  58. package/dist/commands/availability/working-hours.d.ts +53 -0
  59. package/dist/commands/availability/working-hours.d.ts.map +1 -0
  60. package/dist/commands/availability/working-hours.js +151 -0
  61. package/dist/commands/availability/working-hours.js.map +1 -0
  62. package/dist/commands/contracts/index.d.ts +69 -0
  63. package/dist/commands/contracts/index.d.ts.map +1 -0
  64. package/dist/commands/contracts/index.js +198 -0
  65. package/dist/commands/contracts/index.js.map +1 -0
  66. package/dist/commands/engagements/breaks.d.ts +81 -0
  67. package/dist/commands/engagements/breaks.d.ts.map +1 -0
  68. package/dist/commands/engagements/breaks.js +229 -0
  69. package/dist/commands/engagements/breaks.js.map +1 -0
  70. package/dist/commands/engagements/index.d.ts +29 -0
  71. package/dist/commands/engagements/index.d.ts.map +1 -0
  72. package/dist/commands/engagements/index.js +172 -0
  73. package/dist/commands/engagements/index.js.map +1 -0
  74. package/dist/commands/engagements/list.d.ts +49 -0
  75. package/dist/commands/engagements/list.d.ts.map +1 -0
  76. package/dist/commands/engagements/list.js +95 -0
  77. package/dist/commands/engagements/list.js.map +1 -0
  78. package/dist/commands/engagements/shared.d.ts +10 -0
  79. package/dist/commands/engagements/shared.d.ts.map +1 -0
  80. package/dist/commands/engagements/shared.js +31 -0
  81. package/dist/commands/engagements/shared.js.map +1 -0
  82. package/dist/commands/engagements/show.d.ts +19 -0
  83. package/dist/commands/engagements/show.d.ts.map +1 -0
  84. package/dist/commands/engagements/show.js +150 -0
  85. package/dist/commands/engagements/show.js.map +1 -0
  86. package/dist/commands/engagements/stats.d.ts +24 -0
  87. package/dist/commands/engagements/stats.d.ts.map +1 -0
  88. package/dist/commands/engagements/stats.js +51 -0
  89. package/dist/commands/engagements/stats.js.map +1 -0
  90. package/dist/commands/jobs/index.d.ts +49 -0
  91. package/dist/commands/jobs/index.d.ts.map +1 -0
  92. package/dist/commands/jobs/index.js +304 -0
  93. package/dist/commands/jobs/index.js.map +1 -0
  94. package/dist/commands/jobs/interest.d.ts +65 -0
  95. package/dist/commands/jobs/interest.d.ts.map +1 -0
  96. package/dist/commands/jobs/interest.js +172 -0
  97. package/dist/commands/jobs/interest.js.map +1 -0
  98. package/dist/commands/jobs/list.d.ts +81 -0
  99. package/dist/commands/jobs/list.d.ts.map +1 -0
  100. package/dist/commands/jobs/list.js +157 -0
  101. package/dist/commands/jobs/list.js.map +1 -0
  102. package/dist/commands/jobs/search.d.ts +71 -0
  103. package/dist/commands/jobs/search.d.ts.map +1 -0
  104. package/dist/commands/jobs/search.js +163 -0
  105. package/dist/commands/jobs/search.js.map +1 -0
  106. package/dist/commands/jobs/shared.d.ts +79 -0
  107. package/dist/commands/jobs/shared.d.ts.map +1 -0
  108. package/dist/commands/jobs/shared.js +133 -0
  109. package/dist/commands/jobs/shared.js.map +1 -0
  110. package/dist/commands/jobs/show.d.ts +20 -0
  111. package/dist/commands/jobs/show.d.ts.map +1 -0
  112. package/dist/commands/jobs/show.js +135 -0
  113. package/dist/commands/jobs/show.js.map +1 -0
  114. package/dist/commands/payments/index.d.ts +34 -0
  115. package/dist/commands/payments/index.d.ts.map +1 -0
  116. package/dist/commands/payments/index.js +160 -0
  117. package/dist/commands/payments/index.js.map +1 -0
  118. package/dist/commands/payments/methods.d.ts +17 -0
  119. package/dist/commands/payments/methods.d.ts.map +1 -0
  120. package/dist/commands/payments/methods.js +79 -0
  121. package/dist/commands/payments/methods.js.map +1 -0
  122. package/dist/commands/payments/payouts.d.ts +44 -0
  123. package/dist/commands/payments/payouts.d.ts.map +1 -0
  124. package/dist/commands/payments/payouts.js +147 -0
  125. package/dist/commands/payments/payouts.js.map +1 -0
  126. package/dist/commands/payments/rate.d.ts +48 -0
  127. package/dist/commands/payments/rate.d.ts.map +1 -0
  128. package/dist/commands/payments/rate.js +229 -0
  129. package/dist/commands/payments/rate.js.map +1 -0
  130. package/dist/commands/payments/shared.d.ts +10 -0
  131. package/dist/commands/payments/shared.d.ts.map +1 -0
  132. package/dist/commands/payments/shared.js +27 -0
  133. package/dist/commands/payments/shared.js.map +1 -0
  134. package/dist/commands/profile/basic/index.d.ts +18 -0
  135. package/dist/commands/profile/basic/index.d.ts.map +1 -0
  136. package/dist/commands/profile/basic/index.js +79 -0
  137. package/dist/commands/profile/basic/index.js.map +1 -0
  138. package/dist/commands/profile/basic/photo-show.d.ts +28 -0
  139. package/dist/commands/profile/basic/photo-show.d.ts.map +1 -0
  140. package/dist/commands/profile/basic/photo-show.js +112 -0
  141. package/dist/commands/profile/basic/photo-show.js.map +1 -0
  142. package/dist/commands/profile/basic/photo-upload.d.ts +10 -0
  143. package/dist/commands/profile/basic/photo-upload.d.ts.map +1 -0
  144. package/dist/commands/profile/basic/photo-upload.js +61 -0
  145. package/dist/commands/profile/basic/photo-upload.js.map +1 -0
  146. package/dist/commands/profile/basic/set.d.ts +54 -0
  147. package/dist/commands/profile/basic/set.d.ts.map +1 -0
  148. package/dist/commands/profile/basic/set.js +174 -0
  149. package/dist/commands/profile/basic/set.js.map +1 -0
  150. package/dist/commands/profile/basic/show.d.ts +95 -0
  151. package/dist/commands/profile/basic/show.d.ts.map +1 -0
  152. package/dist/commands/profile/basic/show.js +310 -0
  153. package/dist/commands/profile/basic/show.js.map +1 -0
  154. package/dist/commands/profile/certifications/index.d.ts +31 -0
  155. package/dist/commands/profile/certifications/index.d.ts.map +1 -0
  156. package/dist/commands/profile/certifications/index.js +298 -0
  157. package/dist/commands/profile/certifications/index.js.map +1 -0
  158. package/dist/commands/profile/education/index.d.ts +28 -0
  159. package/dist/commands/profile/education/index.d.ts.map +1 -0
  160. package/dist/commands/profile/education/index.js +287 -0
  161. package/dist/commands/profile/education/index.js.map +1 -0
  162. package/dist/commands/profile/employment/index.d.ts +40 -0
  163. package/dist/commands/profile/employment/index.d.ts.map +1 -0
  164. package/dist/commands/profile/employment/index.js +364 -0
  165. package/dist/commands/profile/employment/index.js.map +1 -0
  166. package/dist/commands/profile/external/_shared.d.ts +35 -0
  167. package/dist/commands/profile/external/_shared.d.ts.map +1 -0
  168. package/dist/commands/profile/external/_shared.js +59 -0
  169. package/dist/commands/profile/external/_shared.js.map +1 -0
  170. package/dist/commands/profile/external/advanced-wizard-show.d.ts +15 -0
  171. package/dist/commands/profile/external/advanced-wizard-show.d.ts.map +1 -0
  172. package/dist/commands/profile/external/advanced-wizard-show.js +82 -0
  173. package/dist/commands/profile/external/advanced-wizard-show.js.map +1 -0
  174. package/dist/commands/profile/external/custom-requirements-set.d.ts +32 -0
  175. package/dist/commands/profile/external/custom-requirements-set.d.ts.map +1 -0
  176. package/dist/commands/profile/external/custom-requirements-set.js +116 -0
  177. package/dist/commands/profile/external/custom-requirements-set.js.map +1 -0
  178. package/dist/commands/profile/external/custom-requirements-show.d.ts +16 -0
  179. package/dist/commands/profile/external/custom-requirements-show.d.ts.map +1 -0
  180. package/dist/commands/profile/external/custom-requirements-show.js +84 -0
  181. package/dist/commands/profile/external/custom-requirements-show.js.map +1 -0
  182. package/dist/commands/profile/external/index.d.ts +20 -0
  183. package/dist/commands/profile/external/index.d.ts.map +1 -0
  184. package/dist/commands/profile/external/index.js +102 -0
  185. package/dist/commands/profile/external/index.js.map +1 -0
  186. package/dist/commands/profile/external/readiness.d.ts +15 -0
  187. package/dist/commands/profile/external/readiness.d.ts.map +1 -0
  188. package/dist/commands/profile/external/readiness.js +104 -0
  189. package/dist/commands/profile/external/readiness.js.map +1 -0
  190. package/dist/commands/profile/external/recommendations.d.ts +17 -0
  191. package/dist/commands/profile/external/recommendations.d.ts.map +1 -0
  192. package/dist/commands/profile/external/recommendations.js +97 -0
  193. package/dist/commands/profile/external/recommendations.js.map +1 -0
  194. package/dist/commands/profile/external/update.d.ts +32 -0
  195. package/dist/commands/profile/external/update.d.ts.map +1 -0
  196. package/dist/commands/profile/external/update.js +118 -0
  197. package/dist/commands/profile/external/update.js.map +1 -0
  198. package/dist/commands/profile/index.d.ts +16 -0
  199. package/dist/commands/profile/index.d.ts.map +1 -0
  200. package/dist/commands/profile/index.js +81 -0
  201. package/dist/commands/profile/index.js.map +1 -0
  202. package/dist/commands/profile/industries/index.d.ts +36 -0
  203. package/dist/commands/profile/industries/index.d.ts.map +1 -0
  204. package/dist/commands/profile/industries/index.js +230 -0
  205. package/dist/commands/profile/industries/index.js.map +1 -0
  206. package/dist/commands/profile/portfolio/add.d.ts +43 -0
  207. package/dist/commands/profile/portfolio/add.d.ts.map +1 -0
  208. package/dist/commands/profile/portfolio/add.js +181 -0
  209. package/dist/commands/profile/portfolio/add.js.map +1 -0
  210. package/dist/commands/profile/portfolio/highlight.d.ts +11 -0
  211. package/dist/commands/profile/portfolio/highlight.d.ts.map +1 -0
  212. package/dist/commands/profile/portfolio/highlight.js +31 -0
  213. package/dist/commands/profile/portfolio/highlight.js.map +1 -0
  214. package/dist/commands/profile/portfolio/index.d.ts +16 -0
  215. package/dist/commands/profile/portfolio/index.d.ts.map +1 -0
  216. package/dist/commands/profile/portfolio/index.js +121 -0
  217. package/dist/commands/profile/portfolio/index.js.map +1 -0
  218. package/dist/commands/profile/portfolio/list.d.ts +83 -0
  219. package/dist/commands/profile/portfolio/list.d.ts.map +1 -0
  220. package/dist/commands/profile/portfolio/list.js +189 -0
  221. package/dist/commands/profile/portfolio/list.js.map +1 -0
  222. package/dist/commands/profile/portfolio/remove.d.ts +9 -0
  223. package/dist/commands/profile/portfolio/remove.d.ts.map +1 -0
  224. package/dist/commands/profile/portfolio/remove.js +24 -0
  225. package/dist/commands/profile/portfolio/remove.js.map +1 -0
  226. package/dist/commands/profile/portfolio/reorder.d.ts +17 -0
  227. package/dist/commands/profile/portfolio/reorder.d.ts.map +1 -0
  228. package/dist/commands/profile/portfolio/reorder.js +135 -0
  229. package/dist/commands/profile/portfolio/reorder.js.map +1 -0
  230. package/dist/commands/profile/portfolio/shared.d.ts +8 -0
  231. package/dist/commands/profile/portfolio/shared.d.ts.map +1 -0
  232. package/dist/commands/profile/portfolio/shared.js +10 -0
  233. package/dist/commands/profile/portfolio/shared.js.map +1 -0
  234. package/dist/commands/profile/portfolio/update.d.ts +18 -0
  235. package/dist/commands/profile/portfolio/update.d.ts.map +1 -0
  236. package/dist/commands/profile/portfolio/update.js +77 -0
  237. package/dist/commands/profile/portfolio/update.js.map +1 -0
  238. package/dist/commands/profile/portfolio/upload.d.ts +8 -0
  239. package/dist/commands/profile/portfolio/upload.d.ts.map +1 -0
  240. package/dist/commands/profile/portfolio/upload.js +131 -0
  241. package/dist/commands/profile/portfolio/upload.js.map +1 -0
  242. package/dist/commands/profile/resume/cancel-upload.d.ts +9 -0
  243. package/dist/commands/profile/resume/cancel-upload.d.ts.map +1 -0
  244. package/dist/commands/profile/resume/cancel-upload.js +30 -0
  245. package/dist/commands/profile/resume/cancel-upload.js.map +1 -0
  246. package/dist/commands/profile/resume/index.d.ts +15 -0
  247. package/dist/commands/profile/resume/index.d.ts.map +1 -0
  248. package/dist/commands/profile/resume/index.js +42 -0
  249. package/dist/commands/profile/resume/index.js.map +1 -0
  250. package/dist/commands/profile/resume/upload.d.ts +16 -0
  251. package/dist/commands/profile/resume/upload.d.ts.map +1 -0
  252. package/dist/commands/profile/resume/upload.js +65 -0
  253. package/dist/commands/profile/resume/upload.js.map +1 -0
  254. package/dist/commands/profile/reviews/_shared.d.ts +9 -0
  255. package/dist/commands/profile/reviews/_shared.d.ts.map +1 -0
  256. package/dist/commands/profile/reviews/_shared.js +15 -0
  257. package/dist/commands/profile/reviews/_shared.js.map +1 -0
  258. package/dist/commands/profile/reviews/approve-item.d.ts +30 -0
  259. package/dist/commands/profile/reviews/approve-item.d.ts.map +1 -0
  260. package/dist/commands/profile/reviews/approve-item.js +82 -0
  261. package/dist/commands/profile/reviews/approve-item.js.map +1 -0
  262. package/dist/commands/profile/reviews/approve-section.d.ts +15 -0
  263. package/dist/commands/profile/reviews/approve-section.d.ts.map +1 -0
  264. package/dist/commands/profile/reviews/approve-section.js +67 -0
  265. package/dist/commands/profile/reviews/approve-section.js.map +1 -0
  266. package/dist/commands/profile/reviews/index.d.ts +19 -0
  267. package/dist/commands/profile/reviews/index.d.ts.map +1 -0
  268. package/dist/commands/profile/reviews/index.js +71 -0
  269. package/dist/commands/profile/reviews/index.js.map +1 -0
  270. package/dist/commands/profile/reviews/list.d.ts +17 -0
  271. package/dist/commands/profile/reviews/list.d.ts.map +1 -0
  272. package/dist/commands/profile/reviews/list.js +96 -0
  273. package/dist/commands/profile/reviews/list.js.map +1 -0
  274. package/dist/commands/profile/reviews/submit-for-review.d.ts +16 -0
  275. package/dist/commands/profile/reviews/submit-for-review.d.ts.map +1 -0
  276. package/dist/commands/profile/reviews/submit-for-review.js +65 -0
  277. package/dist/commands/profile/reviews/submit-for-review.js.map +1 -0
  278. package/dist/commands/profile/shared.d.ts +46 -0
  279. package/dist/commands/profile/shared.d.ts.map +1 -0
  280. package/dist/commands/profile/shared.js +111 -0
  281. package/dist/commands/profile/shared.js.map +1 -0
  282. package/dist/commands/profile/skills/index.d.ts +29 -0
  283. package/dist/commands/profile/skills/index.d.ts.map +1 -0
  284. package/dist/commands/profile/skills/index.js +475 -0
  285. package/dist/commands/profile/skills/index.js.map +1 -0
  286. package/dist/commands/profile/visas/add.d.ts +19 -0
  287. package/dist/commands/profile/visas/add.d.ts.map +1 -0
  288. package/dist/commands/profile/visas/add.js +37 -0
  289. package/dist/commands/profile/visas/add.js.map +1 -0
  290. package/dist/commands/profile/visas/index.d.ts +13 -0
  291. package/dist/commands/profile/visas/index.d.ts.map +1 -0
  292. package/dist/commands/profile/visas/index.js +69 -0
  293. package/dist/commands/profile/visas/index.js.map +1 -0
  294. package/dist/commands/profile/visas/list.d.ts +40 -0
  295. package/dist/commands/profile/visas/list.d.ts.map +1 -0
  296. package/dist/commands/profile/visas/list.js +115 -0
  297. package/dist/commands/profile/visas/list.js.map +1 -0
  298. package/dist/commands/profile/visas/remove.d.ts +8 -0
  299. package/dist/commands/profile/visas/remove.d.ts.map +1 -0
  300. package/dist/commands/profile/visas/remove.js +23 -0
  301. package/dist/commands/profile/visas/remove.js.map +1 -0
  302. package/dist/commands/profile/visas/shared.d.ts +11 -0
  303. package/dist/commands/profile/visas/shared.d.ts.map +1 -0
  304. package/dist/commands/profile/visas/shared.js +16 -0
  305. package/dist/commands/profile/visas/shared.js.map +1 -0
  306. package/dist/commands/profile/visas/update.d.ts +13 -0
  307. package/dist/commands/profile/visas/update.d.ts.map +1 -0
  308. package/dist/commands/profile/visas/update.js +44 -0
  309. package/dist/commands/profile/visas/update.js.map +1 -0
  310. package/dist/commands/timesheet/index.d.ts +24 -0
  311. package/dist/commands/timesheet/index.d.ts.map +1 -0
  312. package/dist/commands/timesheet/index.js +98 -0
  313. package/dist/commands/timesheet/index.js.map +1 -0
  314. package/dist/commands/timesheet/list.d.ts +40 -0
  315. package/dist/commands/timesheet/list.d.ts.map +1 -0
  316. package/dist/commands/timesheet/list.js +79 -0
  317. package/dist/commands/timesheet/list.js.map +1 -0
  318. package/dist/commands/timesheet/shared.d.ts +10 -0
  319. package/dist/commands/timesheet/shared.d.ts.map +1 -0
  320. package/dist/commands/timesheet/shared.js +35 -0
  321. package/dist/commands/timesheet/shared.js.map +1 -0
  322. package/dist/commands/timesheet/show.d.ts +19 -0
  323. package/dist/commands/timesheet/show.d.ts.map +1 -0
  324. package/dist/commands/timesheet/show.js +109 -0
  325. package/dist/commands/timesheet/show.js.map +1 -0
  326. package/dist/commands/timesheet/submit.d.ts +50 -0
  327. package/dist/commands/timesheet/submit.d.ts.map +1 -0
  328. package/dist/commands/timesheet/submit.js +151 -0
  329. package/dist/commands/timesheet/submit.js.map +1 -0
  330. package/dist/crash-handlers.d.ts +67 -0
  331. package/dist/crash-handlers.d.ts.map +1 -0
  332. package/dist/crash-handlers.js +78 -0
  333. package/dist/crash-handlers.js.map +1 -0
  334. package/dist/errors.d.ts +45 -0
  335. package/dist/errors.d.ts.map +1 -0
  336. package/dist/errors.js +57 -0
  337. package/dist/errors.js.map +1 -0
  338. package/dist/index.d.ts +8 -0
  339. package/dist/index.d.ts.map +1 -0
  340. package/dist/index.js +15 -0
  341. package/dist/index.js.map +1 -0
  342. package/dist/lib/config-context.d.ts +41 -0
  343. package/dist/lib/config-context.d.ts.map +1 -0
  344. package/dist/lib/config-context.js +74 -0
  345. package/dist/lib/config-context.js.map +1 -0
  346. package/dist/lib/dry-run.d.ts +70 -0
  347. package/dist/lib/dry-run.d.ts.map +1 -0
  348. package/dist/lib/dry-run.js +114 -0
  349. package/dist/lib/dry-run.js.map +1 -0
  350. package/dist/lib/empty-state-cta.d.ts +63 -0
  351. package/dist/lib/empty-state-cta.d.ts.map +1 -0
  352. package/dist/lib/empty-state-cta.js +88 -0
  353. package/dist/lib/empty-state-cta.js.map +1 -0
  354. package/dist/lib/envelopes.d.ts +540 -0
  355. package/dist/lib/envelopes.d.ts.map +1 -0
  356. package/dist/lib/envelopes.js +598 -0
  357. package/dist/lib/envelopes.js.map +1 -0
  358. package/dist/lib/error-routing.d.ts +49 -0
  359. package/dist/lib/error-routing.d.ts.map +1 -0
  360. package/dist/lib/error-routing.js +72 -0
  361. package/dist/lib/error-routing.js.map +1 -0
  362. package/dist/lib/format-helpers.d.ts +65 -0
  363. package/dist/lib/format-helpers.d.ts.map +1 -0
  364. package/dist/lib/format-helpers.js +79 -0
  365. package/dist/lib/format-helpers.js.map +1 -0
  366. package/dist/lib/format-overrides.d.ts +81 -0
  367. package/dist/lib/format-overrides.d.ts.map +1 -0
  368. package/dist/lib/format-overrides.js +55 -0
  369. package/dist/lib/format-overrides.js.map +1 -0
  370. package/dist/lib/freetext.d.ts +83 -0
  371. package/dist/lib/freetext.d.ts.map +1 -0
  372. package/dist/lib/freetext.js +182 -0
  373. package/dist/lib/freetext.js.map +1 -0
  374. package/dist/lib/kill-switch-hook.d.ts +49 -0
  375. package/dist/lib/kill-switch-hook.d.ts.map +1 -0
  376. package/dist/lib/kill-switch-hook.js +34 -0
  377. package/dist/lib/kill-switch-hook.js.map +1 -0
  378. package/dist/lib/output.d.ts +173 -0
  379. package/dist/lib/output.d.ts.map +1 -0
  380. package/dist/lib/output.js +177 -0
  381. package/dist/lib/output.js.map +1 -0
  382. package/dist/lib/pagination.d.ts +49 -0
  383. package/dist/lib/pagination.d.ts.map +1 -0
  384. package/dist/lib/pagination.js +36 -0
  385. package/dist/lib/pagination.js.map +1 -0
  386. package/dist/program.d.ts +80 -0
  387. package/dist/program.d.ts.map +1 -0
  388. package/dist/program.js +273 -0
  389. package/dist/program.js.map +1 -0
  390. package/package.json +35 -13
  391. package/index.js +0 -7
@@ -0,0 +1,598 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { formatYaml } from "./output.js";
4
+ /**
5
+ * Cross-CLI envelope ABI (#128) — discriminated-union wire shape for
6
+ * write-success and error responses, plus the top-level list envelope.
7
+ *
8
+ * The envelope locks the public-API contract for the JSON output:
9
+ * pre-`v1.0` (`0.x`) signals "expect breaking changes"; `v1.0` onward,
10
+ * any JSON shape change is a breaking-change release (semver-major).
11
+ *
12
+ * Discriminators:
13
+ *
14
+ * - `ok: true | false` separates success from error.
15
+ * - `operation: string` (e.g., `"profile.skills.add"`) identifies the
16
+ * verb so consumers can branch without parsing the command path.
17
+ * - For success: `created` / `updated` / `removed` field name selects
18
+ * the verb (add / update / remove respectively). Mutually exclusive.
19
+ * - For errors: `errors[]` is ALWAYS plural — even single-error cases
20
+ * ship a 1-element array so consumers don't branch on 1-vs-N shape.
21
+ *
22
+ * Routing (per `emitErrorAndExit`):
23
+ *
24
+ * - `--output=json` errors → STDOUT (machine consumers read structured
25
+ * payload regardless of exit code).
26
+ * - `--output=yaml` errors → STDOUT (same reasoning).
27
+ * - `--output=pretty` errors → STDERR human-formatted block; STDOUT
28
+ * stays clean.
29
+ * - Exit code is nonzero on error in all formats; `0` on success.
30
+ *
31
+ * The version string is hard-coded `"1.0"` here. Bumping to `"1.1"`
32
+ * signals an additive (non-breaking) change; bumping to `"2.0"`
33
+ * signals a breaking change — both are forward-evolution levers
34
+ * consumers may discriminate on.
35
+ */
36
+ export const ENVELOPE_VERSION = "1.0";
37
+ /**
38
+ * Wrap an array as the v0.4+ list envelope (`{version, items,
39
+ * pageInfo?}`). The `version` field is required (locked at `"1.0"`)
40
+ * so wire consumers can branch on the envelope shape uniformly across
41
+ * success / error / list payloads.
42
+ *
43
+ * When `pageInfo` is supplied (by a paginated command's action
44
+ * handler after threading `--page` / `--per-page` through to the
45
+ * service layer), it's included verbatim. When omitted (by a list
46
+ * command whose wire op has no pagination args, OR when the user
47
+ * passes no flags and the server returns no metadata), the envelope
48
+ * surfaces `{version, items}` only.
49
+ *
50
+ * The empty-state wrapper from #122 (`isEmptyCollection` in
51
+ * `lib/empty-state-cta.ts`) detects both raw `[]` AND `{items: []}` —
52
+ * wrapping list output through this helper keeps the empty-state
53
+ * behavior unchanged on json/yaml.
54
+ *
55
+ * Pure — no I/O.
56
+ */
57
+ export function wrapListEnvelope(items, pageInfo) {
58
+ const env = { version: ENVELOPE_VERSION, items };
59
+ if (pageInfo !== undefined)
60
+ env.pageInfo = pageInfo;
61
+ return env;
62
+ }
63
+ /**
64
+ * Pretty success-line marker. The visible glyph is a heavy check
65
+ * (`✓`); kept in a constant so tests can assert on it without
66
+ * duplicating Unicode escapes across snapshots.
67
+ */
68
+ export const PRETTY_SUCCESS_PREFIX = "✓";
69
+ /**
70
+ * Indent every line of `text` by two spaces. Used for the indented
71
+ * entity preview that follows the one-line `prettySummary` in success
72
+ * envelopes' pretty rendering.
73
+ *
74
+ * Pure — directly unit-testable.
75
+ */
76
+ function indent(text) {
77
+ return text
78
+ .split("\n")
79
+ .map((line) => ` ${line}`)
80
+ .join("\n");
81
+ }
82
+ /**
83
+ * Stringify the JSON success-add envelope (single-line, no extra
84
+ * whitespace — matches `formatResult` json branch). Exposed for tests.
85
+ */
86
+ export function formatAddJson(envelope) {
87
+ return JSON.stringify(envelope);
88
+ }
89
+ /**
90
+ * Stringify the YAML success-add envelope as block-style YAML via
91
+ * `formatYaml`. Exposed for tests.
92
+ */
93
+ export function formatAddYaml(envelope) {
94
+ return formatYaml(envelope);
95
+ }
96
+ /**
97
+ * Stringify the JSON success-update envelope. Exposed for tests.
98
+ */
99
+ export function formatUpdateJson(envelope) {
100
+ return JSON.stringify(envelope);
101
+ }
102
+ /**
103
+ * Stringify the YAML success-update envelope. Exposed for tests.
104
+ */
105
+ export function formatUpdateYaml(envelope) {
106
+ return formatYaml(envelope);
107
+ }
108
+ /**
109
+ * Stringify the JSON success-remove envelope. Exposed for tests.
110
+ */
111
+ export function formatRemoveJson(envelope) {
112
+ return JSON.stringify(envelope);
113
+ }
114
+ /**
115
+ * Stringify the YAML success-remove envelope. Exposed for tests.
116
+ */
117
+ export function formatRemoveYaml(envelope) {
118
+ return formatYaml(envelope);
119
+ }
120
+ /**
121
+ * Stringify the JSON error envelope. Exposed for tests.
122
+ */
123
+ export function formatErrorJson(envelope) {
124
+ return JSON.stringify(envelope);
125
+ }
126
+ /**
127
+ * Stringify the YAML error envelope. Exposed for tests.
128
+ */
129
+ export function formatErrorYaml(envelope) {
130
+ return formatYaml(envelope);
131
+ }
132
+ /**
133
+ * Build the pretty-format rendering of a success-add envelope:
134
+ *
135
+ * ✓ Added: <prettySummary>
136
+ * <prettyEntity-line-1>
137
+ * <prettyEntity-line-2>
138
+ * …
139
+ *
140
+ * `prettyEntity` is OPTIONAL — when omitted the output is just the
141
+ * single-line summary. `notice` (when present) appears on its own
142
+ * trailing line, also indented.
143
+ *
144
+ * Pure — directly unit-testable.
145
+ */
146
+ export function formatAddPretty(args) {
147
+ const lines = [`${PRETTY_SUCCESS_PREFIX} Added: ${args.prettySummary}`];
148
+ if (args.prettyEntity !== undefined) {
149
+ lines.push(indent(args.prettyEntity(args.entity)));
150
+ }
151
+ if (args.notice !== undefined) {
152
+ lines.push(indent(`notice: ${args.notice}`));
153
+ }
154
+ return lines.join("\n");
155
+ }
156
+ /**
157
+ * Build the pretty-format rendering of a success-update envelope.
158
+ * Mirror of `formatAddPretty` with an "Updated:" header. v0.4 does NOT
159
+ * render the `changes` diff (the deep comparison is out of scope per
160
+ * #128 caller context); the field is reserved on the JSON/YAML wire
161
+ * shape only.
162
+ */
163
+ export function formatUpdatePretty(args) {
164
+ const lines = [`${PRETTY_SUCCESS_PREFIX} Updated: ${args.prettySummary}`];
165
+ if (args.prettyEntity !== undefined) {
166
+ lines.push(indent(args.prettyEntity(args.entity)));
167
+ }
168
+ if (args.notice !== undefined) {
169
+ lines.push(indent(`notice: ${args.notice}`));
170
+ }
171
+ return lines.join("\n");
172
+ }
173
+ /**
174
+ * Build the pretty-format rendering of a success-remove envelope:
175
+ *
176
+ * ✓ Removed: <prettySummary or id>
177
+ *
178
+ * The summary defaults to the bare id when no `prettySummary` is
179
+ * supplied; callers that have the entity name handy (post-fetch) can
180
+ * pass a richer line like `"sk_abc123 (TypeScript)"`.
181
+ */
182
+ export function formatRemovePretty(args) {
183
+ const summary = args.prettySummary ?? args.id;
184
+ const lines = [`${PRETTY_SUCCESS_PREFIX} Removed: ${summary}`];
185
+ if (args.notice !== undefined) {
186
+ lines.push(indent(`notice: ${args.notice}`));
187
+ }
188
+ return lines.join("\n");
189
+ }
190
+ /**
191
+ * Maximum number of diff entries rendered in the pretty form of a
192
+ * `WIRE_SHAPE_ERROR` (per `docs/wire-validation-error-format.md`
193
+ * § `-o pretty`). The JSON / YAML wire shapes carry the full list;
194
+ * only the human-readable rendering caps to keep terminal output
195
+ * scannable. When the diff exceeds the cap, a `… and <K> more` line
196
+ * tells the operator where to look for the full data.
197
+ */
198
+ export const WIRE_SHAPE_DIFF_PRETTY_CAP = 10;
199
+ /**
200
+ * Render a single {@link WireShapeDiffEntry} as the one-line form used
201
+ * inside the `Diff (schema vs wire):` block (per
202
+ * `docs/wire-validation-error-format.md` § `-o pretty`). Examples:
203
+ *
204
+ * ~ records[0].duration: expected number, got string ("480")
205
+ * - records[1].notes: expected string, got undefined
206
+ * + records[0].surprise: unexpected wire field (unknown)
207
+ *
208
+ * The `value?` slot is rendered inline parenthesised with surrounding
209
+ * double quotes for string values — matching the spec's `("480")`
210
+ * formatting. Non-string values are rendered verbatim (already
211
+ * stringified upstream by `renderValue` in `wire-shape.ts`).
212
+ */
213
+ function formatWireShapeDiffEntry(entry) {
214
+ if (entry.op === "+") {
215
+ return `+ ${entry.path}: unexpected wire field (${entry.actual})`;
216
+ }
217
+ if (entry.op === "-") {
218
+ return `- ${entry.path}: expected ${entry.expected}, got ${entry.actual}`;
219
+ }
220
+ // op === "~"
221
+ if (entry.value === undefined) {
222
+ return `~ ${entry.path}: expected ${entry.expected}, got ${entry.actual}`;
223
+ }
224
+ return `~ ${entry.path}: expected ${entry.expected}, got ${entry.actual} ("${entry.value}")`;
225
+ }
226
+ /**
227
+ * Build the pretty-format rendering of an error envelope. Each error
228
+ * surfaces as its own block; `field` and `hint` annotate the message
229
+ * when present.
230
+ *
231
+ * Error: <message-1>
232
+ * (Code: <code-1>)
233
+ * (Field: <field-1>)
234
+ * Diff (schema vs wire):
235
+ * <op> <path>: expected <expected>, got <actual> [("<value>")]
236
+ * …
237
+ * Hint: <hint-1>
238
+ *
239
+ * Error: <message-2>
240
+ * …
241
+ *
242
+ * The format is symmetric with `formatTtctlErrorMessage` from
243
+ * `errors.ts` (used for the typed-hierarchy `TtctlError` block) — same
244
+ * `Error: …` prefix, same parenthesised metadata. The recovery line
245
+ * from `TtctlError` does not have a generic equivalent here; callers
246
+ * convert to `hint` if a recovery sentence is available.
247
+ *
248
+ * `WIRE_SHAPE_ERROR` (Z-3 / #286) carries a `diff` field — when
249
+ * present, the pretty form renders a `Diff (schema vs wire):` block
250
+ * before the `Hint:` footer per
251
+ * `docs/wire-validation-error-format.md` § `-o pretty`. Capped at
252
+ * {@link WIRE_SHAPE_DIFF_PRETTY_CAP} entries; overflow renders a
253
+ * `… and <K> more …` line pointing at `-o json` for the full diff.
254
+ */
255
+ export function formatErrorPretty(envelope) {
256
+ const blocks = envelope.errors.map((err) => {
257
+ const lines = [`Error: ${err.message}`];
258
+ lines.push(` (Code: ${err.code})`);
259
+ if (err.field !== undefined) {
260
+ lines.push(` (Field: ${err.field})`);
261
+ }
262
+ if (err.diff !== undefined && err.diff.length > 0) {
263
+ lines.push(` Diff (schema vs wire):`);
264
+ const head = err.diff.slice(0, WIRE_SHAPE_DIFF_PRETTY_CAP);
265
+ for (const entry of head) {
266
+ lines.push(` ${formatWireShapeDiffEntry(entry)}`);
267
+ }
268
+ const overflow = err.diff.length - head.length;
269
+ if (overflow > 0) {
270
+ lines.push(` … and ${overflow.toString()} more (see -o json for the full diff).`);
271
+ }
272
+ }
273
+ if (err.hint !== undefined) {
274
+ lines.push(` Hint: ${err.hint}`);
275
+ }
276
+ return lines.join("\n");
277
+ });
278
+ return blocks.join("\n\n");
279
+ }
280
+ /**
281
+ * One-line stderr summary for the pretty error path. The AC requires
282
+ * a "one-line stderr summary" alongside the multi-line block — when
283
+ * stdout is structured (json/yaml) the summary is omitted because the
284
+ * structured payload IS the summary.
285
+ *
286
+ * Defaults to `Error: <first-error.message>` when the caller does not
287
+ * pass an explicit summary. Useful when piping the multi-line block
288
+ * elsewhere but still wanting a glance-readable single line on the
289
+ * terminal.
290
+ */
291
+ export function defaultPrettyErrorSummary(envelope) {
292
+ const first = envelope.errors[0];
293
+ if (first === undefined) {
294
+ return "Error: (no error details supplied)";
295
+ }
296
+ return `Error: ${first.message}`;
297
+ }
298
+ /**
299
+ * Build the success-add envelope object (pure — no I/O). Shape:
300
+ * `{ok: true, version: "1.0", operation, created, notice?}`. Exposed
301
+ * separately from `emitAddSuccess` so callers (and tests) can inspect
302
+ * the structured shape without going through stdout.
303
+ */
304
+ export function buildAddEnvelope(args) {
305
+ const env = {
306
+ ok: true,
307
+ version: ENVELOPE_VERSION,
308
+ operation: args.operation,
309
+ created: args.created,
310
+ };
311
+ if (args.notice !== undefined)
312
+ env.notice = args.notice;
313
+ return env;
314
+ }
315
+ /**
316
+ * Build the success-update envelope object (pure — no I/O). Shape:
317
+ * `{ok: true, version: "1.0", operation, updated, changes?, notice?}`.
318
+ *
319
+ * `changes` is reserved (see `EnvelopeChange` doc). Callers do not
320
+ * thread it through in v0.4; the parameter is preserved for future
321
+ * extension without an API churn.
322
+ */
323
+ export function buildUpdateEnvelope(args) {
324
+ const env = {
325
+ ok: true,
326
+ version: ENVELOPE_VERSION,
327
+ operation: args.operation,
328
+ updated: args.updated,
329
+ };
330
+ if (args.changes !== undefined)
331
+ env.changes = args.changes;
332
+ if (args.notice !== undefined)
333
+ env.notice = args.notice;
334
+ return env;
335
+ }
336
+ /**
337
+ * Build the success-remove envelope object (pure — no I/O). Shape:
338
+ * `{ok: true, version: "1.0", operation, removed: {id}, notice?}`.
339
+ */
340
+ export function buildRemoveEnvelope(args) {
341
+ const env = {
342
+ ok: true,
343
+ version: ENVELOPE_VERSION,
344
+ operation: args.operation,
345
+ removed: { id: args.id },
346
+ };
347
+ if (args.notice !== undefined)
348
+ env.notice = args.notice;
349
+ return env;
350
+ }
351
+ /**
352
+ * Build the error envelope object (pure — no I/O). Shape:
353
+ * `{ok: false, version: "1.0", operation, errors[]}`. `errors` is
354
+ * normalised to a plural array even for single-error inputs so the
355
+ * wire shape is stable.
356
+ */
357
+ export function buildErrorEnvelope(args) {
358
+ return {
359
+ ok: false,
360
+ version: ENVELOPE_VERSION,
361
+ operation: args.operation,
362
+ errors: args.errors,
363
+ };
364
+ }
365
+ /**
366
+ * Side-effecting emitter for the `add` success envelope. Writes the
367
+ * per-format payload to stdout with a trailing newline; never throws.
368
+ *
369
+ * - `json` → single-line JSON envelope on stdout
370
+ * - `yaml` → block-style YAML envelope on stdout
371
+ * - `pretty` → `✓ Added: <summary>` + indented `prettyEntity?` on stdout
372
+ *
373
+ * The success path always exits 0 (the helper does not call
374
+ * `process.exit` — leaves it to the caller / Node's natural exit).
375
+ */
376
+ export function emitAddSuccess(args) {
377
+ const envelope = buildAddEnvelope({
378
+ operation: args.operation,
379
+ created: args.created,
380
+ notice: args.notice,
381
+ });
382
+ const payload = renderSuccessAdd(envelope, args.format, {
383
+ prettySummary: args.prettySummary,
384
+ prettyEntity: args.prettyEntity,
385
+ });
386
+ process.stdout.write(`${payload}\n`);
387
+ }
388
+ function renderSuccessAdd(envelope, format, prettyArgs) {
389
+ if (format === "json")
390
+ return formatAddJson(envelope);
391
+ if (format === "yaml")
392
+ return formatAddYaml(envelope);
393
+ return formatAddPretty({
394
+ prettySummary: prettyArgs.prettySummary,
395
+ prettyEntity: prettyArgs.prettyEntity,
396
+ entity: envelope.created,
397
+ notice: envelope.notice,
398
+ });
399
+ }
400
+ /**
401
+ * Side-effecting emitter for the `update` success envelope. Mirror of
402
+ * `emitAddSuccess` for the update verb.
403
+ */
404
+ export function emitUpdateSuccess(args) {
405
+ const envelope = buildUpdateEnvelope({
406
+ operation: args.operation,
407
+ updated: args.updated,
408
+ changes: args.changes,
409
+ notice: args.notice,
410
+ });
411
+ const payload = renderSuccessUpdate(envelope, args.format, {
412
+ prettySummary: args.prettySummary,
413
+ prettyEntity: args.prettyEntity,
414
+ });
415
+ process.stdout.write(`${payload}\n`);
416
+ }
417
+ function renderSuccessUpdate(envelope, format, prettyArgs) {
418
+ if (format === "json")
419
+ return formatUpdateJson(envelope);
420
+ if (format === "yaml")
421
+ return formatUpdateYaml(envelope);
422
+ return formatUpdatePretty({
423
+ prettySummary: prettyArgs.prettySummary,
424
+ prettyEntity: prettyArgs.prettyEntity,
425
+ entity: envelope.updated,
426
+ notice: envelope.notice,
427
+ });
428
+ }
429
+ /**
430
+ * Side-effecting emitter for the `remove` success envelope. The id is
431
+ * the server-issued identifier of the now-deleted entity (the caller
432
+ * already knows it from the input or from the API response).
433
+ */
434
+ export function emitRemoveSuccess(args) {
435
+ const envelope = buildRemoveEnvelope({
436
+ operation: args.operation,
437
+ id: args.id,
438
+ notice: args.notice,
439
+ });
440
+ const payload = renderSuccessRemove(envelope, args.format, args.prettySummary);
441
+ process.stdout.write(`${payload}\n`);
442
+ }
443
+ function renderSuccessRemove(envelope, format, prettySummary) {
444
+ if (format === "json")
445
+ return formatRemoveJson(envelope);
446
+ if (format === "yaml")
447
+ return formatRemoveYaml(envelope);
448
+ return formatRemovePretty({
449
+ id: envelope.removed.id,
450
+ prettySummary,
451
+ notice: envelope.notice,
452
+ });
453
+ }
454
+ /**
455
+ * Build the dry-run success envelope object (pure — no I/O). Shape:
456
+ * `{ok: true, version: "1.0", operation, dryRun: true, preview, notice?}`.
457
+ *
458
+ * Exposed separately from {@link emitDryRunSuccess} so callers (and
459
+ * tests) can inspect the structured shape without going through stdout.
460
+ */
461
+ export function buildDryRunEnvelope(args) {
462
+ const env = {
463
+ ok: true,
464
+ version: ENVELOPE_VERSION,
465
+ operation: args.operation,
466
+ dryRun: true,
467
+ preview: args.preview,
468
+ };
469
+ if (args.notice !== undefined)
470
+ env.notice = args.notice;
471
+ return env;
472
+ }
473
+ /**
474
+ * Stringify the JSON dry-run envelope (single-line, no extra whitespace
475
+ * — matches `formatResult` json branch). Exposed for tests.
476
+ */
477
+ export function formatDryRunJson(envelope) {
478
+ return JSON.stringify(envelope);
479
+ }
480
+ /**
481
+ * Stringify the YAML dry-run envelope as block-style YAML via
482
+ * `formatYaml`. Exposed for tests.
483
+ */
484
+ export function formatDryRunYaml(envelope) {
485
+ return formatYaml(envelope);
486
+ }
487
+ /**
488
+ * Build the pretty-format rendering of a dry-run envelope:
489
+ *
490
+ * ✓ Dry run: would call `<operationName>` (no changes sent)
491
+ * surface: <surface> (<transport>)
492
+ * endpoint: <endpoint>
493
+ * variables:
494
+ * <pretty-printed-JSON, 2-space indented>
495
+ * headers:
496
+ * authorization: Token token=<redacted>
497
+ * <other-header>: <value>
498
+ * …
499
+ *
500
+ * Pure — directly unit-testable. The output is human-friendly: the
501
+ * variables block uses `JSON.stringify(_, null, 2)` to give a readable
502
+ * multi-line shape, while headers list one-per-line so the redacted
503
+ * `authorization` is obvious at a glance.
504
+ */
505
+ export function formatDryRunPretty(envelope) {
506
+ const { preview } = envelope;
507
+ const lines = [
508
+ `${PRETTY_SUCCESS_PREFIX} Dry run: would call \`${preview.operationName}\` (no changes sent)`,
509
+ indent(`surface: ${preview.surface} (${preview.transport})`),
510
+ indent(`endpoint: ${preview.endpoint}`),
511
+ indent(`variables:`),
512
+ ];
513
+ const variablesJson = JSON.stringify(preview.variables, null, 2);
514
+ for (const line of variablesJson.split("\n")) {
515
+ // 4-space indent (2 base + 2 nest) so the JSON body is visibly
516
+ // grouped under the `variables:` header.
517
+ lines.push(` ${line}`);
518
+ }
519
+ lines.push(indent("headers:"));
520
+ // Sort headers for stable pretty rendering — JSON.stringify preserves
521
+ // insertion order, but sort here so the human view doesn't depend on
522
+ // the order COMMON_HEADERS keys were defined in. The `authorization`
523
+ // line surfaces under "a" naturally; redaction is visible without
524
+ // prejudice across sort orders.
525
+ for (const key of Object.keys(preview.headers).sort()) {
526
+ lines.push(` ${key}: ${preview.headers[key] ?? ""}`);
527
+ }
528
+ if (envelope.notice !== undefined) {
529
+ lines.push(indent(`notice: ${envelope.notice}`));
530
+ }
531
+ return lines.join("\n");
532
+ }
533
+ /**
534
+ * Side-effecting emitter for the dry-run success envelope. Mirrors
535
+ * {@link emitUpdateSuccess} for the dry-run variant — writes the
536
+ * per-format payload to stdout with a trailing newline; never throws.
537
+ *
538
+ * - `json` → single-line JSON envelope on stdout
539
+ * - `yaml` → block-style YAML envelope on stdout
540
+ * - `pretty` → multi-line `✓ Dry run: …` block on stdout
541
+ *
542
+ * The success path always exits 0 (helper does not call `process.exit`
543
+ * — leaves it to the caller / Node's natural exit). This matches the
544
+ * AC: a well-formed dry-run preview exits 0 regardless of whether the
545
+ * apply-path WOULD have errored at the server level.
546
+ */
547
+ export function emitDryRunSuccess(args) {
548
+ const envelope = buildDryRunEnvelope({
549
+ operation: args.operation,
550
+ preview: args.preview,
551
+ notice: args.notice,
552
+ });
553
+ const payload = renderDryRun(envelope, args.format);
554
+ process.stdout.write(`${payload}\n`);
555
+ }
556
+ function renderDryRun(envelope, format) {
557
+ if (format === "json")
558
+ return formatDryRunJson(envelope);
559
+ if (format === "yaml")
560
+ return formatDryRunYaml(envelope);
561
+ return formatDryRunPretty(envelope);
562
+ }
563
+ /**
564
+ * Side-effecting error emitter. Routes per format and exits the
565
+ * process — never returns.
566
+ *
567
+ * Routing:
568
+ *
569
+ * - `json` / `yaml`: the structured envelope is written to STDOUT (so
570
+ * `jq`/`yq` consumers see structured payload regardless of exit
571
+ * code). The exit code is nonzero (default `1`).
572
+ * - `pretty`: a one-line stderr summary is written FIRST, then the
573
+ * multi-line human block (also on stderr). STDOUT stays clean.
574
+ *
575
+ * Exit code defaults to `1`; callers can pass a different value (e.g.
576
+ * `2` for transport-level Cloudflare blocks, mirroring
577
+ * `exitCodeForTtctlError`).
578
+ */
579
+ export function emitErrorAndExit(args) {
580
+ const envelope = buildErrorEnvelope({
581
+ operation: args.operation,
582
+ errors: args.errors,
583
+ });
584
+ const code = args.exitCode ?? 1;
585
+ if (args.format === "json") {
586
+ process.stdout.write(`${formatErrorJson(envelope)}\n`);
587
+ }
588
+ else if (args.format === "yaml") {
589
+ process.stdout.write(`${formatErrorYaml(envelope)}\n`);
590
+ }
591
+ else {
592
+ const summary = args.prettySummary ?? defaultPrettyErrorSummary(envelope);
593
+ process.stderr.write(`${summary}\n`);
594
+ process.stderr.write(`${formatErrorPretty(envelope)}\n`);
595
+ }
596
+ process.exit(code);
597
+ }
598
+ //# sourceMappingURL=envelopes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelopes.js","sourceRoot":"","sources":["../../src/lib/envelopes.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAIpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAc,CAAC;AAwJ/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,gBAAgB,CAAI,KAAU,EAAE,QAA2B;IACzE,MAAM,GAAG,GAAoB,EAAE,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;IAClE,IAAI,QAAQ,KAAK,SAAS;QAAE,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC;;;;;;GAMG;AACH,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;SAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAI,QAA+B;IAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAA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M,UAAU,gBAAgB,CAAC,IAMhC;IACC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;QAClC,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;SAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,IAAI,yBAAyB,CAAC,QAAQ,CAAC,CAAC;QAC1E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { OutputFormat } from "./output.js";
2
+ /**
3
+ * Structural shape every domain error class instance satisfies: a
4
+ * machine-readable `code` token plus a human-readable `message`. All
5
+ * `*Error` classes exported from `@ttctl/core/services` match this shape
6
+ * (`ApplicationsError`, `AvailabilityError`, `ContractsError`,
7
+ * `EngagementsError`, `JobsError`, `PaymentsError`, `TimesheetError`,
8
+ * `profile.basic.ProfileError`, `profile.visas.VisasError`, …).
9
+ */
10
+ export interface DomainErrorLike {
11
+ code: string;
12
+ message: string;
13
+ }
14
+ /**
15
+ * Generic CLI error router (#330). Single source of truth for the
16
+ * branching logic that was previously copied into nine structurally
17
+ * identical handler functions across `packages/cli/src/commands/*\/shared.ts`
18
+ * (one per sub-domain). Each domain re-exports a thin wrapper that
19
+ * closes over its `DomainErrorClass` (and optionally a per-code hint
20
+ * adapter) so the call sites in action handlers stay unchanged.
21
+ *
22
+ * Three branches in priority order:
23
+ *
24
+ * 1. `TtctlError` subclasses (`AuthRevokedError`, `Cf403Error`,
25
+ * `Cf403PersistentError`, `SchedulerBearerExpired`, …) keep their
26
+ * dedicated 3-block pretty rendering on `pretty` (Error / Recovery /
27
+ * Code) via {@link presentTtctlError}; `json` / `yaml` flow through
28
+ * the envelope so machine consumers see the stable wire shape. Exit
29
+ * code routes via {@link exitCodeForTtctlError} — Cloudflare-403
30
+ * codes exit `2`, everything else `1`.
31
+ * 2. Domain errors (i.e. `instanceof DomainErrorClass`) flow through the
32
+ * envelope. When `hintForCode` is supplied and returns a string for
33
+ * the given code, the envelope entry carries a `hint:` field;
34
+ * otherwise the entry is just `{code, message}`.
35
+ * `exactOptionalPropertyTypes: true` — the entry is built additively
36
+ * so the omitted-vs-undefined distinction is preserved at the
37
+ * envelope boundary.
38
+ * 3. Anything else (a plain `Error` thrown from helper code, or a
39
+ * non-Error throw) collapses into `INTERNAL_ERROR` so the user sees
40
+ * a structured envelope rather than the bare exception message.
41
+ *
42
+ * `commandLabel` is the user-visible prefix (e.g. `"applications show"`);
43
+ * the envelope `operation` is derived by replacing spaces with dots
44
+ * (`"applications.show"`).
45
+ *
46
+ * Returns `never` — every branch exits the process via `process.exit`.
47
+ */
48
+ export declare function handleDomainError<E extends DomainErrorLike>(commandLabel: string, err: unknown, DomainErrorClass: new (...args: never[]) => E, format?: OutputFormat, hintForCode?: (code: E["code"]) => string | undefined): never;
49
+ //# sourceMappingURL=error-routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-routing.d.ts","sourceRoot":"","sources":["../../src/lib/error-routing.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,EACzD,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,OAAO,EACZ,gBAAgB,EAAE,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAC7C,MAAM,GAAE,YAAuB,EAC/B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM,GAAG,SAAS,GACpD,KAAK,CA6BP"}