twenty 2.49.0 → 2.51.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 (127) hide show
  1. package/dist/app-template/AGENTS.md +16 -1
  2. package/dist/app-template/package.json +1 -1
  3. package/dist/app-template/src/front-components/main-page.tsx +1 -1
  4. package/dist/app-template/yarn.lock +143 -96
  5. package/dist/app-worker.cjs +1 -1
  6. package/dist/chunks/application-DOWikeQt.cjs +5 -0
  7. package/dist/chunks/{build-pull-entities-caP3XupC.cjs → build-pull-entities-ShVsLh_s.cjs} +2 -2
  8. package/dist/chunks/{build-source-manifest-DWRbCMVq.cjs → build-source-manifest-BmZlsY97.cjs} +1 -1
  9. package/dist/chunks/{build-source-snapshot-CtgBQfSx.cjs → build-source-snapshot-BWbLS2F3.cjs} +19 -19
  10. package/dist/chunks/cli-version.constant-DGQXQw_V.cjs +1 -0
  11. package/dist/chunks/{collect-translatable-strings-GBVXMoaX.cjs → collect-translatable-strings-DWRZN9zQ.cjs} +1 -1
  12. package/dist/chunks/{collect-watch-inputs-CJVgCTo5.cjs → collect-watch-inputs-CS4oNP1F.cjs} +1 -1
  13. package/dist/chunks/{compile-application-translations-B4jILjGc.cjs → compile-application-translations-DS6jGOV4.cjs} +1 -1
  14. package/dist/chunks/{constants-CemcuPi_-D7dbw2cv.cjs → constants-D-caeNc5-9rDzSg5B.cjs} +1 -1
  15. package/dist/chunks/{convert-to-label-DH4ArWop.cjs → convert-to-label-hx-g0Lvj.cjs} +1 -1
  16. package/dist/chunks/{create-http-status-error-C6gJS0JS.cjs → create-http-status-error-E0DUDIUP.cjs} +1 -1
  17. package/dist/chunks/create-metadata-client-9IF8ArjT.cjs +6 -0
  18. package/dist/chunks/{create-pull-base-write-CX9yftCd.cjs → create-pull-base-write-JW3ZTnaC.cjs} +1 -1
  19. package/dist/chunks/create-rest-client-PU2Uyfnb.cjs +1 -0
  20. package/dist/chunks/{extract-manifest-from-file-mvb6OhWm.cjs → extract-manifest-from-file-nrU-X7g7.cjs} +1 -1
  21. package/dist/chunks/{extract-source-translations-Bd_030qL.cjs → extract-source-translations-DeVUs6Xz.cjs} +1 -1
  22. package/dist/chunks/{fetch-metadata-inspection-CAmEp-xl.cjs → fetch-metadata-inspection-CeqzcB_x.cjs} +1 -1
  23. package/dist/chunks/{fetch-signed-in-identity-b_LbRuL-.cjs → fetch-signed-in-identity-B49Tf79K.cjs} +1 -1
  24. package/dist/chunks/{fetch-workspace-id-C9kY0s84.cjs → fetch-workspace-id-CsvJDu8b.cjs} +1 -1
  25. package/dist/chunks/format-body-CyNgSGIx.cjs +1 -0
  26. package/dist/chunks/{format-data-value-C7Njc7Sb.cjs → format-data-value-kug8Yjt2.cjs} +1 -1
  27. package/dist/chunks/{format-metadata-fields-BOG2kj2h.cjs → format-metadata-fields-BTukrGn9.cjs} +1 -1
  28. package/dist/chunks/{format-metadata-owner-CyEMvoQr.cjs → format-metadata-owner-CsQXOj_P.cjs} +1 -1
  29. package/dist/chunks/format-progress-line-DhMnjGkz.cjs +1 -0
  30. package/dist/chunks/{generate-application-client-BOLnv8nr.cjs → generate-application-client-B3Fen9_7.cjs} +1 -1
  31. package/dist/chunks/{get-app-plan-summary-D1Dsd34P.cjs → get-app-plan-summary-C-CQdNrh.cjs} +2 -2
  32. package/dist/chunks/{get-client-generation-skip-reason-CUn0Y2Vu.cjs → get-client-generation-skip-reason-BVkBgZWQ.cjs} +1 -1
  33. package/dist/chunks/{get-function-input-schema-GNk3NRLJ-CWNFoyKh.cjs → get-function-input-schema-GNk3NRLJ-DTFC8CbW.cjs} +1 -1
  34. package/dist/chunks/{global-flags.constant-0k222fHC.cjs → global-flags.constant-CRom3uiZ.cjs} +1 -1
  35. package/dist/chunks/is-access-token-expiring-DT6D8bMy.cjs +1 -0
  36. package/dist/chunks/{is-application-not-found-error-4vnGlYbm.cjs → is-application-not-found-error-Cja7iQrL.cjs} +1 -1
  37. package/dist/chunks/{is-exported-manifest-dsiWCcjx.cjs → is-exported-manifest-DnQNK9XY.cjs} +1 -1
  38. package/dist/chunks/is-locale-catalog-CUFLOiRx.cjs +1 -0
  39. package/dist/chunks/is-supported-locale-xFJcoWeE.cjs +1 -0
  40. package/dist/chunks/{locale-catalog-format-rg5FMb7l.cjs → locale-catalog-format-CgKjHqcW.cjs} +2 -2
  41. package/dist/chunks/metadata-DkXpEhJh.cjs +1 -0
  42. package/dist/chunks/{metadata-page.constant-thBSPIZT.cjs → metadata-page.constant-CxWuBtP5.cjs} +1 -1
  43. package/dist/chunks/{parse-api-url-CEfjRyid.cjs → parse-api-url-CFCz3xUA.cjs} +1 -1
  44. package/dist/chunks/{parse-app-export-DUZ2dQJ8.cjs → parse-app-export-DFV_KqHM.cjs} +1 -1
  45. package/dist/chunks/parse-extraction-locale-C7Gdd3Oa.cjs +1 -0
  46. package/dist/chunks/{parse-graphql-response-DvoRiFPV.cjs → parse-graphql-response-BcKxw_s9.cjs} +1 -1
  47. package/dist/chunks/{parse-json-input-DE451WQG.cjs → parse-json-input-CO-KP4XZ.cjs} +1 -1
  48. package/dist/chunks/{print-typescript-value-DaEFmMda.cjs → print-typescript-value-D5kLR9wo.cjs} +1 -1
  49. package/dist/chunks/{pull-source-D9QUEAsK.cjs → pull-source-BKm8k5WI.cjs} +1 -1
  50. package/dist/chunks/{read-app-identity-DtEnxiEF.cjs → read-app-identity-dWB3NG6p.cjs} +1 -1
  51. package/dist/chunks/{read-application-identifier-DyZcsUV4.cjs → read-application-identifier-BlkRhC8j.cjs} +1 -1
  52. package/dist/chunks/{read-application-identity-CMJ-W5D8.cjs → read-application-identity-DgEOK9zh.cjs} +1 -1
  53. package/dist/chunks/{read-config-DdtXhdPp.cjs → read-config-Qwl4pAO8.cjs} +1 -1
  54. package/dist/chunks/read-json-object-BXZs97qz.cjs +1 -0
  55. package/dist/chunks/{read-snapshot-file-dvWjVexO.cjs → read-snapshot-file-CxPJh0Bk.cjs} +1 -1
  56. package/dist/chunks/{read-source-identity-Ca7QkuwC.cjs → read-source-identity-BM-MsOjA.cjs} +1 -1
  57. package/dist/chunks/{record-pull-base-Dfqth7Uy.cjs → record-pull-base-DwoMDnXm.cjs} +1 -1
  58. package/dist/chunks/{record-typecheck-config-inputs-DZy2PhMY.cjs → record-typecheck-config-inputs-CmF0bbqm.cjs} +1 -1
  59. package/dist/chunks/{request-oauth-tokens-BY5ew3aM.cjs → request-oauth-tokens-QdDt7j8i.cjs} +1 -1
  60. package/dist/chunks/{resolve-app-project-dftvbB2P.cjs → resolve-app-project-B0KRR-xp.cjs} +1 -1
  61. package/dist/chunks/{resolve-command-target-0k6iitOZ.cjs → resolve-command-target-BWCnYRCn.cjs} +1 -1
  62. package/dist/chunks/{resolve-inside-sdk-6M8jy9bi.cjs → resolve-inside-sdk-DiEOTO12.cjs} +1 -1
  63. package/dist/chunks/{resolve-metadata-object-DzDTQF_T.cjs → resolve-metadata-object-BSDYVuzQ.cjs} +1 -1
  64. package/dist/chunks/{resolve-project-typescript-Cw2kvn6E.cjs → resolve-project-typescript-vMtmufcP.cjs} +1 -1
  65. package/dist/chunks/{resolve-request-url-Cnuxu_nj.cjs → resolve-request-url-BvOe0vYd.cjs} +1 -1
  66. package/dist/chunks/{resolve-source-sdk-B1Fxlsmt.cjs → resolve-source-sdk-CU1wk4bl.cjs} +1 -1
  67. package/dist/chunks/{run-api-graphql-command-CzQ4IH4l.cjs → run-api-graphql-command-Df2FAGpA.cjs} +1 -1
  68. package/dist/chunks/{run-api-rest-command-BtXv11uz.cjs → run-api-rest-command-2YvvMh8h.cjs} +1 -1
  69. package/dist/chunks/{run-app-add-command-DsgrCsEl.cjs → run-app-add-command-wpCH-Lp9.cjs} +5 -5
  70. package/dist/chunks/{run-app-apply-command-X_XGAwRN.cjs → run-app-apply-command-CPocg1Xz.cjs} +2 -2
  71. package/dist/chunks/{run-app-build-command--t8qRNsn.cjs → run-app-build-command-DSGpIZBT.cjs} +1 -1
  72. package/dist/chunks/{run-app-dev-command-Cc-nhH2t.cjs → run-app-dev-command-BOAYsAKr.cjs} +2 -2
  73. package/dist/chunks/{run-app-exec-command-mdXCYmUn.cjs → run-app-exec-command-Fwi80y3g.cjs} +2 -2
  74. package/dist/chunks/{run-app-generate-client-command-3DMg-WyX.cjs → run-app-generate-client-command-DidOpqNE.cjs} +1 -1
  75. package/dist/chunks/{run-app-init-command-BfS8IFmY.cjs → run-app-init-command-DRFYqMMh.cjs} +2 -2
  76. package/dist/chunks/{run-app-install-command-DMbwFvtE.cjs → run-app-install-command-DPt8PzUS.cjs} +1 -1
  77. package/dist/chunks/{run-app-logs-command-B7_iDOj1.cjs → run-app-logs-command-C-9ZyGau.cjs} +3 -3
  78. package/dist/chunks/{run-app-operation-DFCj0sG_.cjs → run-app-operation-Cw5M8v43.cjs} +1 -1
  79. package/dist/chunks/{run-app-plan-command-Dh_DFA7H.cjs → run-app-plan-command-CT1SlcdX.cjs} +1 -1
  80. package/dist/chunks/{run-app-publish-command-eJcYGb8S.cjs → run-app-publish-command-DiIlqdTg.cjs} +2 -2
  81. package/dist/chunks/{run-app-pull-command-BV2cMuLU.cjs → run-app-pull-command-r_NjC_Rk.cjs} +2 -2
  82. package/dist/chunks/{run-app-translations-extract-command-CBBbk_vJ.cjs → run-app-translations-extract-command-Ba66GX7e.cjs} +1 -1
  83. package/dist/chunks/{run-app-typecheck-command-pAHhuBGo.cjs → run-app-typecheck-command-MAxB7Yg3.cjs} +1 -1
  84. package/dist/chunks/{run-app-uninstall-command-C5um6udQ.cjs → run-app-uninstall-command-BzYSsL5a.cjs} +1 -1
  85. package/dist/chunks/{run-auth-login-command-C4VI44Xu.cjs → run-auth-login-command-Cb3bITQj.cjs} +1 -1
  86. package/dist/chunks/{run-auth-logout-command-5Tvqclki.cjs → run-auth-logout-command-iC22soKN.cjs} +1 -1
  87. package/dist/chunks/{run-auth-status-command-CLH1bylR.cjs → run-auth-status-command-C0rdb747.cjs} +1 -1
  88. package/dist/chunks/{run-cli-BA0FsxzB.cjs → run-cli-CuxXyb__.cjs} +7 -7
  89. package/dist/chunks/{run-commands-command-CjzkTcrO.cjs → run-commands-command-D0P3mHHz.cjs} +1 -1
  90. package/dist/chunks/{run-data-get-command-DoZIpf8O.cjs → run-data-get-command-D7czgisf.cjs} +1 -1
  91. package/dist/chunks/{run-data-list-command-DAoplyqj.cjs → run-data-list-command-CUp_FN_I.cjs} +1 -1
  92. package/dist/chunks/{run-doctor-command-D8cpt7FI.cjs → run-doctor-command-ClisEoI5.cjs} +2 -2
  93. package/dist/chunks/{run-metadata-field-describe-command-BrZYIhjH.cjs → run-metadata-field-describe-command-7xrRVRwr.cjs} +1 -1
  94. package/dist/chunks/{run-metadata-field-list-command-C9-pHXbx.cjs → run-metadata-field-list-command-CpIUXOmy.cjs} +1 -1
  95. package/dist/chunks/{run-metadata-object-describe-command-WFdGu1Iq.cjs → run-metadata-object-describe-command--cIPFkWW.cjs} +1 -1
  96. package/dist/chunks/run-metadata-object-list-command-CQ1jcSJc.cjs +2 -0
  97. package/dist/chunks/{run-open-command-B1pdHp36.cjs → run-open-command-DLe3PYqB.cjs} +1 -1
  98. package/dist/chunks/{run-remote-list-command-BRPcCOKx.cjs → run-remote-list-command-DV-Ruk98.cjs} +1 -1
  99. package/dist/chunks/{run-remote-remove-command-CS6za2Pm.cjs → run-remote-remove-command-C1JeH5mK.cjs} +1 -1
  100. package/dist/chunks/{run-remote-rename-command-BOqWQUR4.cjs → run-remote-rename-command-CCVu4hEw.cjs} +1 -1
  101. package/dist/chunks/{run-remote-use-command-BANiokD-.cjs → run-remote-use-command-BvqWgEsP.cjs} +1 -1
  102. package/dist/chunks/{run-version-command-C0xgcPP6.cjs → run-version-command-DdKb9JL0.cjs} +1 -1
  103. package/dist/chunks/{select-target-CfuNLCQL.cjs → select-target-DZlm8j62.cjs} +1 -1
  104. package/dist/chunks/{sign-in-to-remote-again-DYCWIDa9.cjs → sign-in-to-remote-again-WEIeFaAT.cjs} +1 -1
  105. package/dist/chunks/{sign-in-with-browser-Ck4tOxtA.cjs → sign-in-with-browser-BUvT_awm.cjs} +1 -1
  106. package/dist/chunks/to-public-target-bNT50le0.cjs +1 -0
  107. package/dist/chunks/{to-worker-output-diagnostics-Bt_acI26.cjs → to-worker-output-diagnostics-BzdY4Z2V.cjs} +1 -1
  108. package/dist/chunks/{typecheck-application-DEO1SVdO.cjs → typecheck-application-dVtzoMDg.cjs} +2 -2
  109. package/dist/chunks/{update-config-FzOzO3wZ.cjs → update-config-CnB7lDVC.cjs} +1 -1
  110. package/dist/chunks/{utils-ZOESAfF8-ub6jPiZ-.cjs → utils-CvvLHbc4-CKDJ1YgX.cjs} +20 -17
  111. package/dist/chunks/{write-config-atomically-C-YMKq3P.cjs → write-config-atomically-DkRUfbw0.cjs} +1 -1
  112. package/dist/cli.cjs +1 -1
  113. package/package.json +2 -2
  114. package/dist/chunks/application-BE-X21OV.cjs +0 -5
  115. package/dist/chunks/cli-version.constant-BBeYll5N.cjs +0 -1
  116. package/dist/chunks/create-metadata-client-BRD2ys8z.cjs +0 -6
  117. package/dist/chunks/create-rest-client-Cc5Cmakp.cjs +0 -60
  118. package/dist/chunks/format-body-BIv-9Sd5.cjs +0 -1
  119. package/dist/chunks/format-progress-line-DgxG_7p2.cjs +0 -1
  120. package/dist/chunks/is-access-token-expiring-D-YfufId.cjs +0 -1
  121. package/dist/chunks/is-locale-catalog-CRn-mKHj.cjs +0 -1
  122. package/dist/chunks/is-supported-locale-BOZxTj7r.cjs +0 -1
  123. package/dist/chunks/metadata-Vepr2xeA.cjs +0 -1
  124. package/dist/chunks/parse-extraction-locale-fg7K8vps.cjs +0 -1
  125. package/dist/chunks/read-json-object-CgaXuNS0.cjs +0 -1
  126. package/dist/chunks/run-metadata-object-list-command-8UKU3cMW.cjs +0 -2
  127. package/dist/chunks/to-public-target-C0POrVoG.cjs +0 -1
@@ -1,16 +1,16 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-ZOESAfF8-ub6jPiZ-.cjs"),n=require("./constants-CemcuPi_-D7dbw2cv.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./is-interaction-allowed-CF-ko1KI.cjs"),a=require("./style-BR52fK4V.cjs"),o=require("./to-cli-error-BBYf_wqo.cjs"),s=require("./cli-version.constant-BBeYll5N.cjs"),c=require("./format-progress-line-DgxG_7p2.cjs"),l=require("./to-public-target-C0POrVoG.cjs"),u=require("./resolve-command-target-0k6iitOZ.cjs"),d=require("./global-flags.constant-0k222fHC.cjs");let f=require("node:events"),p=require("node:readline");var m=e.t();function h({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}var g=h();function ee(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(g,``)}var _=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],v=[12288,12288,65281,65376,65504,65510],y=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],b=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],x=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],S=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},te=_[0],C=_.at(-1),w=v[0],ne=v.at(-1);y[0],y.at(-1),b[0],b.at(-1);var re=x[0],ie=x.at(-1),T=19968,[ae,oe]=se(x);function se(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(T>=i&&T<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}var ce=e=>e<te||e>C?!1:S(_,e),le=e=>e<w||e>ne?!1:S(v,e),ue=e=>e>=ae&&e<=oe?!0:e<re||e>ie?!1:S(x,e);function de(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function E(e,{ambiguousAsWide:t=!1}={}){return de(e),le(e)||ue(e)||t&&ce(e)?2:1}var fe=new Intl.Segmenter,pe=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,me=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,he=/^\p{RGI_Emoji}$/v,D=/^[\d#*]\u20E3$/,O=/\p{Extended_Pictographic}/gu;function k(e){if(e.length>50)return!1;if(D.test(e))return!0;if(e.includes(`‍`)){let t=e.match(O);return t!==null&&t.length>=2}return!1}function A(e){return e.replace(me,``)}function j(e){return pe.test(e)}function M(e,t){let n=0;if(e.length>1)for(let r of e.slice(1))r>=`＀`&&r<=`￯`&&(n+=E(r.codePointAt(0),t));return n}function N(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t,i=e;if(!r&&(i.includes(`\x1B`)||i.includes(`›`))&&(i=ee(i)),i.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(i))return i.length;let a=0,o={ambiguousAsWide:!n};for(let{segment:e}of fe.segment(i)){if(j(e))continue;if(he.test(e)||k(e)){a+=2;continue}let t=A(e).codePointAt(0);a+=E(t,o),a+=M(e,o)}return a}var P=({stream:e,text:t})=>{e.write(t.endsWith(`
2
- `)?t:`${t}\n`)},F=({mode:e})=>{let t=!1,r=()=>{t&&=((0,p.cursorTo)(process.stderr,0),(0,p.clearLine)(process.stderr,0),!1)};return{write:({message:a,percentage:o})=>{let s=n.Vt(o)?`${o}%`:``,l=Math.min(20,(process.stderr.columns??80)-N(a)-s.length-5);if(r(),e!==`human`||!process.stderr.isTTY||i.n()||process.env.TERM===`dumb`||!n.Vt(o)||!Number.isFinite(o)||l<4){P({stream:process.stderr,text:c.t({message:a,percentage:o})});return}let u=Math.round(Math.min(100,Math.max(0,o))/100*l),d=`█`.repeat(u)+`░`.repeat(l-u);process.stderr.write(`${a} ${d} ${s}`),t=!0},clear:r}},I=async(e,t)=>{t.throwIfAborted(),process.stdout.write(`${JSON.stringify(e)}\n`)||await(0,f.once)(process.stdout,`drain`,{signal:t}),t.throwIfAborted()},L=e=>{P({stream:process.stdout,text:JSON.stringify(e)})},R=e=>e.split(`
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-CvvLHbc4-CKDJ1YgX.cjs"),n=require("./constants-D-caeNc5-9rDzSg5B.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./is-interaction-allowed-CF-ko1KI.cjs"),a=require("./style-BR52fK4V.cjs"),o=require("./to-cli-error-BBYf_wqo.cjs"),s=require("./cli-version.constant-DGQXQw_V.cjs"),c=require("./format-progress-line-DhMnjGkz.cjs"),l=require("./to-public-target-bNT50le0.cjs"),u=require("./resolve-command-target-BWCnYRCn.cjs"),d=require("./global-flags.constant-CRom3uiZ.cjs");let f=require("node:events"),p=require("node:readline");var m=e.t();function h({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}var g=h();function _(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(g,``)}var v=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],y=[12288,12288,65281,65376,65504,65510],b=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],x=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],S=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],C=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},ee=v[0],te=v.at(-1),ne=y[0],re=y.at(-1);b[0],b.at(-1),x[0],x.at(-1);var ie=S[0],ae=S.at(-1),w=19968,[oe,se]=T(S);function T(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(w>=i&&w<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}var ce=e=>e<ee||e>te?!1:C(v,e),le=e=>e<ne||e>re?!1:C(y,e),ue=e=>e>=oe&&e<=se?!0:e<ie||e>ae?!1:C(S,e);function de(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function E(e,{ambiguousAsWide:t=!1}={}){return de(e),le(e)||ue(e)||t&&ce(e)?2:1}var fe=new Intl.Segmenter,pe=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Mark}|\p{Surrogate})+$/v,me=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Mark}\p{Surrogate}]+/v,he=/^\p{RGI_Emoji}$/v,ge=/^[\d#*]\u20E3$/,D=/\p{Extended_Pictographic}/gu;function O(e){if(e.length>50)return!1;if(ge.test(e))return!0;if(e.includes(`‍`)){let t=e.match(D);return t!==null&&t.length>=2}return!1}function k(e){return e.replace(me,``)}function A(e){return pe.test(e)}function j(e,t){let n=0;if(e.length>1)for(let r of e.slice(1))r>=`＀`&&r<=`￯`&&(n+=E(r.codePointAt(0),t));return n}function M(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t,i=e;if(!r&&(i.includes(`\x1B`)||i.includes(`›`))&&(i=_(i)),i.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(i))return i.length;let a=0,o={ambiguousAsWide:!n};for(let{segment:e}of fe.segment(i)){if(A(e))continue;if(he.test(e)||O(e)){a+=2;continue}let t=k(e).codePointAt(0);a+=E(t,o),a+=j(e,o)}return a}var N=({stream:e,text:t})=>{e.write(t.endsWith(`
2
+ `)?t:`${t}\n`)},P=({mode:e})=>{let t=!1,r=()=>{t&&=((0,p.cursorTo)(process.stderr,0),(0,p.clearLine)(process.stderr,0),!1)};return{write:({message:a,percentage:o})=>{let s=n.Ut(o)?`${o}%`:``,l=Math.min(20,(process.stderr.columns??80)-M(a)-s.length-5);if(r(),e!==`human`||!process.stderr.isTTY||i.n()||process.env.TERM===`dumb`||!n.Ut(o)||!Number.isFinite(o)||l<4){N({stream:process.stderr,text:c.t({message:a,percentage:o})});return}let u=Math.round(Math.min(100,Math.max(0,o))/100*l),d=`█`.repeat(u)+`░`.repeat(l-u);process.stderr.write(`${a} ${d} ${s}`),t=!0},clear:r}},F=async(e,t)=>{t.throwIfAborted(),process.stdout.write(`${JSON.stringify(e)}\n`)||await(0,f.once)(process.stdout,`drain`,{signal:t}),t.throwIfAborted()},I=e=>{N({stream:process.stdout,text:JSON.stringify(e)})},L=e=>e.split(`
3
3
  `).map(e=>(0,m.isNonEmptyString)(e)?` ${e}`:e).join(`
4
- `),z=e=>n.Vt(e)?{target:e}:{},B=({mode:e,command:t})=>{let r=[],i=F({mode:e}),o=0,s=(e,n)=>{o+=1,L({schemaVersion:1,command:t,type:e,sequence:o,data:n})},c=()=>{for(let e of r)P({stream:process.stderr,text:a.s(e.message)})};return{event:async(n,r,i)=>{e===`ndjson`&&(o+=1,await I({schemaVersion:1,command:t,type:n,sequence:o,data:r},i))},progress:({message:t,percentage:n})=>{if(e===`ndjson`){s(`progress`,{message:t,percentage:n});return}i.write({message:t,percentage:n})},warn:t=>{if(i.clear(),e===`ndjson`){s(`warning`,t);return}r.push(t)},succeed:({data:n,human:a},o)=>{if(i.clear(),e===`json`){L({schemaVersion:1,ok:!0,command:t,...z(o),data:n,warnings:r});return}if(e===`ndjson`){s(`result`,n);return}let l=a??JSON.stringify(n,null,2);(0,m.isNonEmptyString)(l)&&P({stream:process.stdout,text:l}),c()},fail:(o,l)=>{i.clear(),process.exitCode=o.exitCode;let u={code:o.code,message:o.message,...n.Vt(o.hint)?{hint:o.hint}:{},...n.Vt(o.details)?{details:o.details}:{}};if(e===`json`){L({schemaVersion:1,ok:!1,command:t,...z(l),error:u,warnings:r});return}if(e===`ndjson`){s(`error`,u);return}P({stream:process.stderr,text:a.a(o.message)}),n.Vt(o.hint)&&P({stream:process.stderr,text:R(o.hint)}),c()}}},V=`--format`,ge=e=>e.reduce((t,n,r)=>n.startsWith(`${V}=`)?n.slice(9):n===V?e[r+1]:t,void 0),_e=e=>{let t=e.indexOf(`--`),n=t===-1?e:e.slice(0,t),r=ge(n);return n.includes(`--json`)||r===`json`?`json`:r===`ndjson`?`ndjson`:`human`},H=class extends Error{commanderError;commandName;operands;constructor({commanderError:e,commandName:t,operands:n}){super(e.message),this.name=`CommandParseError`,this.commanderError=e,this.commandName=t,this.operands=n}},U=`twenty`,ve=()=>{let e={standardOutput:``,standardError:``};return{captured:e,configuration:{writeOut:t=>{e.standardOutput+=t},writeErr:t=>{e.standardError+=t},outputError:t=>{e.standardError+=t}}}},W=e.n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),G=e.n((e=>{var{InvalidArgumentError:t}=W(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),K=e.n((e=>{var{humanReadableArgName:t}=G(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
4
+ `),R=e=>n.Ut(e)?{target:e}:{},z=({mode:e,command:t})=>{let r=[],i=P({mode:e}),o=0,s=(e,n)=>{o+=1,I({schemaVersion:1,command:t,type:e,sequence:o,data:n})},c=()=>{for(let e of r)N({stream:process.stderr,text:a.s(e.message)})};return{event:async(n,r,i)=>{e===`ndjson`&&(o+=1,await F({schemaVersion:1,command:t,type:n,sequence:o,data:r},i))},progress:({message:t,percentage:n})=>{if(e===`ndjson`){s(`progress`,{message:t,percentage:n});return}i.write({message:t,percentage:n})},warn:t=>{if(i.clear(),e===`ndjson`){s(`warning`,t);return}r.push(t)},succeed:({data:n,human:a},o)=>{if(i.clear(),e===`json`){I({schemaVersion:1,ok:!0,command:t,...R(o),data:n,warnings:r});return}if(e===`ndjson`){s(`result`,n);return}let l=a??JSON.stringify(n,null,2);(0,m.isNonEmptyString)(l)&&N({stream:process.stdout,text:l}),c()},fail:(o,l)=>{i.clear(),process.exitCode=o.exitCode;let u={code:o.code,message:o.message,...n.Ut(o.hint)?{hint:o.hint}:{},...n.Ut(o.details)?{details:o.details}:{}};if(e===`json`){I({schemaVersion:1,ok:!1,command:t,...R(l),error:u,warnings:r});return}if(e===`ndjson`){s(`error`,u);return}N({stream:process.stderr,text:a.a(o.message)}),n.Ut(o.hint)&&N({stream:process.stderr,text:L(o.hint)}),c()}}},B=`--format`,_e=e=>e.reduce((t,n,r)=>n.startsWith(`${B}=`)?n.slice(9):n===B?e[r+1]:t,void 0),ve=e=>{let t=e.indexOf(`--`),n=t===-1?e:e.slice(0,t),r=_e(n);return n.includes(`--json`)||r===`json`?`json`:r===`ndjson`?`ndjson`:`human`},V=class extends Error{commanderError;commandName;operands;constructor({commanderError:e,commandName:t,operands:n}){super(e.message),this.name=`CommandParseError`,this.commanderError=e,this.commandName=t,this.operands=n}},H=`twenty`,ye=()=>{let e={standardOutput:``,standardError:``};return{captured:e,configuration:{writeOut:t=>{e.standardOutput+=t},writeErr:t=>{e.standardError+=t},outputError:t=>{e.standardError+=t}}}},U=e.n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),W=e.n((e=>{var{InvalidArgumentError:t}=U(),n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),G=e.n((e=>{var{humanReadableArgName:t}=W(),n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
5
5
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
6
6
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
7
- `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),q=e.n((e=>{var{InvalidArgumentError:t}=W(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
7
+ `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),K=e.n((e=>{var{InvalidArgumentError:t}=U(),n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
8
8
  - a short flag is a single dash and a single character
9
9
  - either use a single dash and a single character (for a short flag)
10
10
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
11
11
  - too many short flags`):i.test(t)?Error(`${n}
12
12
  - too many long flags`):Error(`${n}
13
- - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),ye=e.n((e=>{var t=3;function n(e,n){if(Math.abs(e.length-n.length)>t)return Math.max(e.length,n.length);let r=[];for(let t=0;t<=e.length;t++)r[t]=[t];for(let e=0;e<=n.length;e++)r[0][e]=e;for(let t=1;t<=n.length;t++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===n[t-1]?0:1,r[i][t]=Math.min(r[i-1][t]+1,r[i][t-1]+1,r[i-1][t-1]+a),i>1&&t>1&&e[i-1]===n[t-2]&&e[i-2]===n[t-1]&&(r[i][t]=Math.min(r[i][t],r[i-2][t-2]+1))}return r[e.length][n.length]}function r(e,r){if(!r||r.length===0)return``;r=Array.from(new Set(r));let i=e.startsWith(`--`);i&&(e=e.slice(2),r=r.map(e=>e.slice(2)));let a=[],o=t;return r.forEach(t=>{if(t.length<=1)return;let r=n(e,t),i=Math.max(e.length,t.length);(i-r)/i>.4&&(r<o?(o=r,a=[t]):r===o&&a.push(t))}),a.sort((e,t)=>e.localeCompare(t)),i&&(a=a.map(e=>`--${e}`)),a.length>1?`\n(Did you mean one of ${a.join(`, `)}?)`:a.length===1?`\n(Did you mean ${a[0]}?)`:``}e.suggestSimilar=r})),be=e.n((e=>{var t=require("node:events").EventEmitter,n=require("node:child_process"),r=require("node:path"),i=require("node:fs"),a=require("node:process"),{Argument:o,humanReadableArgName:s}=G(),{CommanderError:c}=W(),{Help:l,stripColor:u}=K(),{Option:d,DualOptions:f}=q(),{suggestSimilar:p}=ye(),m=class e extends t{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>g()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>g()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:e=>u(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new l,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
13
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),be=e.n((e=>{var t=3;function n(e,n){if(Math.abs(e.length-n.length)>t)return Math.max(e.length,n.length);let r=[];for(let t=0;t<=e.length;t++)r[t]=[t];for(let e=0;e<=n.length;e++)r[0][e]=e;for(let t=1;t<=n.length;t++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===n[t-1]?0:1,r[i][t]=Math.min(r[i-1][t]+1,r[i][t-1]+1,r[i-1][t-1]+a),i>1&&t>1&&e[i-1]===n[t-2]&&e[i-2]===n[t-1]&&(r[i][t]=Math.min(r[i][t],r[i-2][t-2]+1))}return r[e.length][n.length]}function r(e,r){if(!r||r.length===0)return``;r=Array.from(new Set(r));let i=e.startsWith(`--`);i&&(e=e.slice(2),r=r.map(e=>e.slice(2)));let a=[],o=t;return r.forEach(t=>{if(t.length<=1)return;let r=n(e,t),i=Math.max(e.length,t.length);(i-r)/i>.4&&(r<o?(o=r,a=[t]):r===o&&a.push(t))}),a.sort((e,t)=>e.localeCompare(t)),i&&(a=a.map(e=>`--${e}`)),a.length>1?`\n(Did you mean one of ${a.join(`, `)}?)`:a.length===1?`\n(Did you mean ${a[0]}?)`:``}e.suggestSimilar=r})),xe=e.n((e=>{var t=require("node:events").EventEmitter,n=require("node:child_process"),r=require("node:path"),i=require("node:fs"),a=require("node:process"),{Argument:o,humanReadableArgName:s}=W(),{CommanderError:c}=U(),{Help:l,stripColor:u}=G(),{Option:d,DualOptions:f}=K(),{suggestSimilar:p}=be(),m=class e extends t{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>g()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>g()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:e=>u(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new l,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
14
14
  - specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new o(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
15
15
  Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new c(e,t,n)),a.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new d(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
16
16
  - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{r(t,`error: option '${e.flags}' argument '${t}' is invalid.`,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{r(t,`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof d)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){a.versions?.electron&&(t.from=`electron`);let e=a.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=a.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:a.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
@@ -19,5 +19,5 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
19
19
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
20
20
  - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
21
21
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
22
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g})),xe=e.n((e=>{var{Argument:t}=G(),{Command:n}=be(),{CommanderError:r,InvalidArgumentError:i}=W(),{Help:a}=K(),{Option:o}=q();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),{program:Se,createCommand:Ce,createArgument:we,createOption:Te,CommanderError:Ee,InvalidArgumentError:De,InvalidOptionArgumentError:Oe,Command:ke,Argument:Ae,Option:J,Help:je}=e.i(xe(),1).default,Me=[{path:[`app`],description:`Create, develop and manage applications`,helpGroup:d.a.APP},{path:[`app`,`translations`],description:`Manage app translation catalogs`},{path:[`data`],description:`Read workspace records`,helpGroup:d.a.WORKSPACE},{path:[`auth`],description:`Sign in and manage credentials`,helpGroup:d.a.WORKSPACE},{path:[`remote`],description:`Manage saved workspace connections`,helpGroup:d.a.WORKSPACE},{path:[`metadata`],description:`Inspect the data model`,helpGroup:d.a.WORKSPACE},{path:[`metadata`,`object`],description:`Objects`},{path:[`metadata`,`field`],description:`Fields`},{path:[`api`],description:`Send raw REST and GraphQL requests`,helpGroup:d.a.WORKSPACE}],Ne=[`human`,`json`,`ndjson`],Pe=(e,t)=>t.reduce((e,t)=>e?.commands.find(e=>e.name()===t),e),Y=(e,t)=>{let r=Pe(e,t);if(!n.Vt(r))throw Error(`Topic "${t.join(` `)}" is not registered.`);return r},Fe=(e,t)=>{if(!e.outputModes.includes(t))throw new r.t({code:`USAGE`,exitCode:r.n.USAGE,message:`twenty ${d.n(e)} does not support ${t} output.`,hint:`Supported: ${e.outputModes.join(`, `)}`})},X=async({definition:e,outputMode:t,commandArguments:r,options:i})=>{let a=d.n(e),s=B({mode:t,command:a}),c=new AbortController,f=()=>c.abort(),p;process.once(`SIGINT`,f);try{Fe(e,t);let n={command:a,arguments:r,options:i,output:s,outputMode:t,signal:c.signal};if(!e.needsTarget){let t=await e.load();s.succeed(await t(n));return}let o=await u.t({options:i,outputMode:t,output:s,signal:c.signal});p=o;let d=await e.load();s.succeed(await d({...n,target:o}),l.t(o))}catch(e){s.fail(o.t(e,c.signal),n.Vt(p)?l.t(p):void 0)}finally{process.off(`SIGINT`,f),c.abort()}},Z=(e,t)=>e.exitOverride(n=>{throw new H({commanderError:n,commandName:t,operands:e.args})}),Ie=({flags:e,description:t,choices:r,required:i,hidden:a})=>{let o=new J(e,t);return a===!0&&o.hideHelp(),n.Vt(r)&&o.choices(r),i===!0&&o.makeOptionMandatory(),o},Le=e=>`\nExamples:\n${e.map(e=>` ${e}`).join(`
23
- `)}\n`,Re=({program:e,definition:r,outputMode:i})=>{let a=Y(e,r.path.slice(0,-1)).command(r.path[r.path.length-1]).description(r.description);n.Vt(r.helpGroup)&&a.helpGroup(r.helpGroup);for(let e of r.arguments??[])a.argument(e.required?`<${e.name}>`:`[${e.name}]`,e.description);for(let e of r.options??[])a.addOption(Ie(e));t.r(r.examples)&&a.addHelpText(`after`,Le(r.examples)),Z(a,d.n(r)),a.action(()=>X({definition:r,outputMode:i,commandArguments:a.processedArgs,options:a.optsWithGlobals()}))},Q=({program:e,topic:t})=>{let r=Y(e,t.path.slice(0,-1)).command(t.path[t.path.length-1]).description(t.description);n.Vt(t.helpGroup)&&r.helpGroup(t.helpGroup),Z(r,t.path.join(` `))},ze=({outputMode:e,outputConfiguration:t})=>{let n=new ke(U).description(`The Twenty command line`).version(s.t,d.t.VERSION,`Print the version`).addOption(new J(d.t.JSON,`Print one JSON document on stdout`).conflicts(`format`)).addOption(new J(d.t.FORMAT,`Output format`).choices(Ne)).option(d.t.REMOTE,`Saved remote to use for this command`).option(d.t.NO_INPUT,`Never prompt or open a browser`).helpOption(d.t.HELP,`Show help`).commandsGroup(d.a.TOOLS).helpCommand(`help [command]`,`Show help for a command`).configureHelp({showGlobalOptions:!0}).configureOutput(t);Z(n,U);for(let e of Me)Q({program:n,topic:e});for(let t of d.r)Re({program:n,definition:t,outputMode:e});return n},Be=`help`,Ve=e=>t.l(e.replace(/^error: /,``).replace(/\s*\n\s*/g,` `).trim()),He=e=>e===`twenty`?U:`${U} ${e}`,$=({message:e,commandName:t})=>new r.t({code:`USAGE`,exitCode:r.n.USAGE,message:e,hint:`See: ${He(t)} --help`}),Ue=(e,n)=>e.code===`commander.helpDisplayed`||e.code===`commander.help`&&(e.exitCode===0||!t.r(n)),We=e=>(e[0]===Be?e.slice(1):e).join(` `),Ge=async({error:e,outputMode:t,capturedOutput:n})=>{let{commanderError:r,commandName:i,operands:a}=e;if(r.code===`commander.version`){await X({definition:d.i,outputMode:t,commandArguments:[],options:{}});return}let o=B({mode:t,command:i});if(Ue(r,a)){let e=(0,m.isNonEmptyString)(n.standardOutput)?n.standardOutput:n.standardError;o.succeed({data:{help:e},human:e});return}if(r.code===`commander.help`){o.fail($({message:`Unknown command '${We(a)}'`,commandName:i}));return}o.fail($({message:Ve(r.message),commandName:i}))},Ke=async e=>{let t=_e(e),n=ve(),r=ze({outputMode:t,outputConfiguration:n.configuration});try{await r.parseAsync(e,{from:`user`})}catch(e){if(e instanceof H){await Ge({error:e,outputMode:t,capturedOutput:n.captured});return}B({mode:t,command:U}).fail(o.t(e))}};exports.runCli=Ke;
22
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g})),q=e.n((e=>{var{Argument:t}=W(),{Command:n}=xe(),{CommanderError:r,InvalidArgumentError:i}=U(),{Help:a}=G(),{Option:o}=K();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i})),{program:Se,createCommand:Ce,createArgument:we,createOption:Te,CommanderError:Ee,InvalidArgumentError:De,InvalidOptionArgumentError:Oe,Command:ke,Argument:Ae,Option:J,Help:je}=e.i(q(),1).default,Me=[{path:[`app`],description:`Create, develop and manage applications`,helpGroup:d.a.APP},{path:[`app`,`translations`],description:`Manage app translation catalogs`},{path:[`data`],description:`Read workspace records`,helpGroup:d.a.WORKSPACE},{path:[`auth`],description:`Sign in and manage credentials`,helpGroup:d.a.WORKSPACE},{path:[`remote`],description:`Manage saved workspace connections`,helpGroup:d.a.WORKSPACE,helpHint:`Add a remote using browser sign-in or an API key. See: twenty auth login --help`,examples:d.o.examples},{path:[`metadata`],description:`Inspect the data model`,helpGroup:d.a.WORKSPACE},{path:[`metadata`,`object`],description:`Objects`},{path:[`metadata`,`field`],description:`Fields`},{path:[`api`],description:`Send raw REST and GraphQL requests`,helpGroup:d.a.WORKSPACE}],Ne=[`human`,`json`,`ndjson`],Pe=(e,t)=>t.reduce((e,t)=>e?.commands.find(e=>e.name()===t),e),Y=(e,t)=>{let r=Pe(e,t);if(!n.Ut(r))throw Error(`Topic "${t.join(` `)}" is not registered.`);return r},X=e=>`\nExamples:\n${e.map(e=>` ${e}`).join(`
23
+ `)}\n`,Fe=(e,t)=>{if(!e.outputModes.includes(t))throw new r.t({code:`USAGE`,exitCode:r.n.USAGE,message:`twenty ${d.n(e)} does not support ${t} output.`,hint:`Supported: ${e.outputModes.join(`, `)}`})},Z=async({definition:e,outputMode:t,commandArguments:r,options:i})=>{let a=d.n(e),s=z({mode:t,command:a}),c=new AbortController,f=()=>c.abort(),p;process.once(`SIGINT`,f);try{Fe(e,t);let n={command:a,arguments:r,options:i,output:s,outputMode:t,signal:c.signal};if(!e.needsTarget){let t=await e.load();s.succeed(await t(n));return}let o=await u.t({options:i,outputMode:t,output:s,signal:c.signal});p=o;let d=await e.load();s.succeed(await d({...n,target:o}),l.t(o))}catch(e){s.fail(o.t(e,c.signal),n.Ut(p)?l.t(p):void 0)}finally{process.off(`SIGINT`,f),c.abort()}},Q=(e,t)=>e.exitOverride(n=>{throw new V({commanderError:n,commandName:t,operands:e.args})}),Ie=({flags:e,description:t,choices:r,required:i,hidden:a})=>{let o=new J(e,t);return a===!0&&o.hideHelp(),n.Ut(r)&&o.choices(r),i===!0&&o.makeOptionMandatory(),o},Le=({program:e,definition:r,outputMode:i})=>{let a=Y(e,r.path.slice(0,-1)).command(r.path[r.path.length-1]).description(r.description);n.Ut(r.helpGroup)&&a.helpGroup(r.helpGroup);for(let e of r.arguments??[])a.argument(e.required?`<${e.name}>`:`[${e.name}]`,e.description);for(let e of r.options??[])a.addOption(Ie(e));t.n(r.examples)&&a.addHelpText(`after`,X(r.examples)),Q(a,d.n(r)),a.action(()=>Z({definition:r,outputMode:i,commandArguments:a.processedArgs,options:a.optsWithGlobals()}))},Re=({program:e,topic:r})=>{let i=Y(e,r.path.slice(0,-1)).command(r.path[r.path.length-1]).description(r.description);n.Ut(r.helpGroup)&&i.helpGroup(r.helpGroup),n.Ut(r.helpHint)&&i.addHelpText(`after`,`\n${r.helpHint}`),t.n(r.examples)&&i.addHelpText(`after`,X(r.examples)),Q(i,r.path.join(` `))},ze=({outputMode:e,outputConfiguration:t})=>{let n=new ke(H).description(`The Twenty command line`).version(s.t,d.t.VERSION,`Print the version`).addOption(new J(d.t.JSON,`Print one JSON document on stdout`).conflicts(`format`)).addOption(new J(d.t.FORMAT,`Output format`).choices(Ne)).option(d.t.REMOTE,`Saved remote to use for this command`).option(d.t.NO_INPUT,`Never prompt or open a browser`).helpOption(d.t.HELP,`Show help`).commandsGroup(d.a.TOOLS).helpCommand(`help [command]`,`Show help for a command`).configureHelp({showGlobalOptions:!0}).configureOutput(t);Q(n,H);for(let e of Me)Re({program:n,topic:e});for(let t of d.r)Le({program:n,definition:t,outputMode:e});return n},Be=`help`,Ve=e=>t.u(e.replace(/^error: /,``).replace(/\s*\n\s*/g,` `).trim()),He=e=>e===`twenty`?H:`${H} ${e}`,$=({message:e,commandName:t})=>new r.t({code:`USAGE`,exitCode:r.n.USAGE,message:e,hint:`See: ${He(t)} --help`}),Ue=(e,n)=>e.code===`commander.helpDisplayed`||e.code===`commander.help`&&(e.exitCode===0||!t.n(n)),We=e=>(e[0]===Be?e.slice(1):e).join(` `),Ge=async({error:e,outputMode:t,capturedOutput:n})=>{let{commanderError:r,commandName:i,operands:a}=e;if(r.code===`commander.version`){await Z({definition:d.i,outputMode:t,commandArguments:[],options:{}});return}let o=z({mode:t,command:i});if(Ue(r,a)){let e=(0,m.isNonEmptyString)(n.standardOutput)?n.standardOutput:n.standardError;o.succeed({data:{help:e},human:e});return}if(r.code===`commander.help`){o.fail($({message:`Unknown command '${We(a)}'`,commandName:i}));return}o.fail($({message:Ve(r.message),commandName:i}))},Ke=async e=>{let t=ve(e),n=ye(),r=ze({outputMode:t,outputConfiguration:n.configuration});try{await r.parseAsync(e,{from:`user`})}catch(e){if(e instanceof V){await Ge({error:e,outputMode:t,capturedOutput:n.captured});return}z({mode:t,command:H}).fail(o.t(e))}};exports.runCli=Ke;
@@ -1,2 +1,2 @@
1
- const e=require("./constants-CemcuPi_-D7dbw2cv.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./global-flags.constant-0k222fHC.cjs"),r=require("./format-table-4drtI5sP.cjs");var i=async()=>{let i=n.r.map(t=>({name:n.n(t),description:t.description,arguments:(t.arguments??[]).map(({name:e,required:t})=>({name:e,required:t})),flags:(t.options??[]).filter(({hidden:e})=>e!==!0).map(({flags:e})=>e),outputs:t.outputModes,writes:t.writes,needsProject:t.needsProject,needsTarget:t.needsTarget,...e.Vt(t.requiredPermissions)?{requiredPermissions:t.requiredPermissions}:{}})).sort((e,t)=>e.name.localeCompare(t.name));return{data:{commands:i,globalFlags:Object.values(n.t)},human:[r.t({rows:i,columns:[{header:`COMMAND`,value:e=>e.name},{header:`DESCRIPTION`,value:e=>e.description}]}),`${t.i(`${i.length} commands · details: `)}${t.r(`twenty <command> --help`)}`].join(`
1
+ const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./global-flags.constant-CRom3uiZ.cjs"),r=require("./format-table-4drtI5sP.cjs");var i=async()=>{let i=n.r.map(t=>({name:n.n(t),description:t.description,arguments:(t.arguments??[]).map(({name:e,required:t})=>({name:e,required:t})),flags:(t.options??[]).filter(({hidden:e})=>e!==!0).map(({flags:e})=>e),outputs:t.outputModes,writes:t.writes,needsProject:t.needsProject,needsTarget:t.needsTarget,...e.Ut(t.requiredPermissions)?{requiredPermissions:t.requiredPermissions}:{}})).sort((e,t)=>e.name.localeCompare(t.name));return{data:{commands:i,globalFlags:Object.values(n.t)},human:[r.t({rows:i,columns:[{header:`COMMAND`,value:e=>e.name},{header:`DESCRIPTION`,value:e=>e.description}]}),`${t.i(`${i.length} commands · details: `)}${t.r(`twenty <command> --help`)}`].join(`
2
2
  `)}};exports.runCommandsCommand=i;
@@ -1 +1 @@
1
- const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./create-metadata-client-BRD2ys8z.cjs"),r=require("./format-data-value-C7Njc7Sb.cjs"),i=require("./format-details-COEwKz_M.cjs"),a=require("./create-rest-client-Cc5Cmakp.cjs"),o=require("./resolve-metadata-object-DzDTQF_T.cjs");var s=async({arguments:s,target:c,signal:l,outputMode:u})=>{let d=t.n(s,1)??``;if(d.length===0||d===`.`||d===`..`)throw new e.t({code:`USAGE`,exitCode:e.n.USAGE,message:`A record id is required.`});let f=await o.t({client:n.t({target:c,signal:l}),name:t.n(s,0)??``}),p=a.r(await a.t({target:c,signal:l}).get(`/rest/${encodeURIComponent(f.namePlural)}/${encodeURIComponent(d)}`,{query:{depth:1}}),f.nameSingular);return{data:p,...u===`human`?{human:i.t(Object.entries(p).map(([e,t])=>[r.t(e),r.n(t)]))}:{}}};exports.runDataGetCommand=s;
1
+ const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./create-metadata-client-9IF8ArjT.cjs"),r=require("./format-data-value-kug8Yjt2.cjs"),i=require("./format-details-COEwKz_M.cjs"),a=require("./create-rest-client-PU2Uyfnb.cjs"),o=require("./resolve-metadata-object-BSDYVuzQ.cjs");var s=async({arguments:s,target:c,signal:l,outputMode:u})=>{let d=t.n(s,1)??``;if(d.length===0||d===`.`||d===`..`)throw new e.t({code:`USAGE`,exitCode:e.n.USAGE,message:`A record id is required.`});let f=await o.t({client:n.t({target:c,signal:l}),name:t.n(s,0)??``}),p=a.r(await a.t({target:c,signal:l}).get(`/rest/${encodeURIComponent(f.namePlural)}/${encodeURIComponent(d)}`,{query:{depth:1}}),f.nameSingular);return{data:p,...u===`human`?{human:i.t(Object.entries(p).map(([e,t])=>[r.t(e),r.n(t)]))}:{}}};exports.runDataGetCommand=s;
@@ -1 +1 @@
1
- const e=require("./constants-CemcuPi_-D7dbw2cv.cjs"),t=require("./cli-error-CSsayo0u.cjs"),n=require("./read-command-values-uSJqBG_E.cjs");require("./resolve-request-url-Cnuxu_nj.cjs");const r=require("./style-BR52fK4V.cjs"),i=require("./to-cli-error-BBYf_wqo.cjs");require("./result-item-limit.constant-CDrOhiWD.cjs");const a=require("./create-metadata-client-BRD2ys8z.cjs"),o=require("./format-data-value-C7Njc7Sb.cjs"),s=require("./to-public-target-C0POrVoG.cjs"),c=require("./format-table-4drtI5sP.cjs"),l=require("./create-rest-client-Cc5Cmakp.cjs"),u=require("./resolve-metadata-object-DzDTQF_T.cjs");var d=({recordCount:e,bytes:n})=>{if(e>1e4||n>16777216)throw new t.t({code:`RESULT_LIMIT_EXCEEDED`,exitCode:t.n.USAGE,message:`Records exceed the 10,000-item or 16 MiB result limit.`,hint:`Use data list <object> --all --format ndjson to stream records, or request fewer records.`,details:{recordCount:e,bytes:n}})},f=[`id`,`name`],p=new Set([`deletedAt`]),m=(e,t)=>o.t(Object.hasOwn(e,t)?e[t]:void 0),h=({page:e,options:t})=>{let n=Object.keys(e.records[0]??{}),i=t.fields??[...f.filter(e=>n.includes(e)),...n.filter(e=>!f.includes(e)&&!p.has(e))].slice(0,5),a=c.n.ROW_INDENT.length,s=0;for(let t of i){let n=o.t(t),r=n.length;s+=Buffer.byteLength(n,`utf8`)-n.length;for(let n of e.records){let e=m(n,t);r=Math.max(r,e.length),s+=Buffer.byteLength(e,`utf8`)-e.length}a+=r+c.n.COLUMN_GAP.length}d({recordCount:e.records.length,bytes:a*(e.records.length+1)+s});let l=e.records.length===0?`No records.`:c.t({rows:e.records,columns:i.map(e=>({header:o.t(e),value:t=>m(t,e)}))}),u=`${e.records.length} of ${e.totalCount} records`;return`${l}\n${r.i(e.pageInfo.hasNextPage?`${u} · --all for every page · --json for the next cursor`:u)}`};async function*g({fetchPage:e,cursor:n,signal:r}){let i=n,a=n,o=1,s=0,c=!0;for(;c;){r.throwIfAborted();let n=await e(i);r.throwIfAborted();let l=n.pageInfo.endCursor??void 0;if(n.records.length>0&&(l===i||l===a))throw new t.t({code:`INVALID_RESPONSE`,message:`The server returned a repeated pagination cursor.`});c=n.pageInfo.hasNextPage,c&&(s+=1,s===o&&(a=l,o*=2,s=0)),yield n,i=l}}var _=r=>{let i=n.r(r,`limit`)??`50`,a=Number(i),o=n.r(r,`fields`)?.split(`,`).map(e=>e.trim()),s=n.r(r,`cursor`);if(!/^\d+$/.test(i)||!Number.isInteger(a)||a<1||a>200)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`--limit must be an integer between 1 and 200.`});if(o?.some(e=>e.length===0)||e.Vt(s)&&s.length===0)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`--fields and --cursor cannot contain empty values.`});return{limit:a,fields:e.Vt(o)?[...new Set(o)]:void 0,cursor:s,filter:n.r(r,`filter`),orderBy:n.r(r,`orderBy`),all:n.t(r,`all`)}},v=async({arguments:e,options:r,target:o,signal:c,output:f,outputMode:p})=>{let m=_(r),v=await u.t({client:a.t({target:o,signal:c}),name:n.n(e,0)??``}),y=l.t({target:o,signal:c}),b=p===`ndjson`,x=[],S=0,C=0,w=0,T=m.cursor??null,E={hasNextPage:!1,startCursor:null,endCursor:null},D=0;try{b&&await f.event(`start`,{object:v.namePlural,target:s.t(o)},c);for await(let e of g({cursor:m.cursor,signal:c,fetchPage:async e=>l.n(await y.get(`/rest/${encodeURIComponent(v.namePlural)}`,{query:{limit:m.limit,starting_after:e,filter:m.filter,order_by:m.orderBy}}),v.namePlural,m.limit)})){for(let t of e.records)b?await f.event(`record`,t,c):(w+=Buffer.byteLength(JSON.stringify(t),`utf8`),d({recordCount:S+1,bytes:w+S+Buffer.byteLength(JSON.stringify({records:[],pageInfo:e.pageInfo,totalCount:e.totalCount}),`utf8`)}),x.push(t)),S+=1;if(C+=1,E=e.pageInfo,D=e.totalCount,T=E.endCursor??T,b&&await f.event(`progress`,{recordCount:S,pages:C,resumeCursor:T,pageInfo:E,totalCount:D},c),!m.all)break}}catch(e){let n=i.t(e,c);throw b?new t.t({code:n.code,exitCode:n.exitCode,message:n.message,hint:n.hint,details:{...n.details,recordCount:S,pages:C,resumeCursor:T}}):n}if(b)return{data:{recordCount:S,pages:C,resumeCursor:T,pageInfo:E,totalCount:D}};let O={records:x,pageInfo:E,totalCount:D},k=p===`human`&&x.length>0?(m.fields??[]).filter(e=>!x.some(t=>Object.hasOwn(t,e))):[];return k.length>0&&f.warn({code:`FIELDS_NOT_RETURNED`,message:`No returned record has ${k.join(`, `)}; see twenty metadata field list ${v.namePlural}.`}),{data:O,...p===`human`?{human:h({page:O,options:m})}:{}}};exports.runDataListCommand=v;
1
+ const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./cli-error-CSsayo0u.cjs"),n=require("./read-command-values-uSJqBG_E.cjs");require("./resolve-request-url-BvOe0vYd.cjs");const r=require("./style-BR52fK4V.cjs"),i=require("./to-cli-error-BBYf_wqo.cjs");require("./result-item-limit.constant-CDrOhiWD.cjs");const a=require("./create-metadata-client-9IF8ArjT.cjs"),o=require("./format-data-value-kug8Yjt2.cjs"),s=require("./to-public-target-bNT50le0.cjs"),c=require("./format-table-4drtI5sP.cjs"),l=require("./create-rest-client-PU2Uyfnb.cjs"),u=require("./resolve-metadata-object-BSDYVuzQ.cjs");var d=({recordCount:e,bytes:n})=>{if(e>1e4||n>16777216)throw new t.t({code:`RESULT_LIMIT_EXCEEDED`,exitCode:t.n.USAGE,message:`Records exceed the 10,000-item or 16 MiB result limit.`,hint:`Use data list <object> --all --format ndjson to stream records, or request fewer records.`,details:{recordCount:e,bytes:n}})},f=[`id`,`name`],p=new Set([`deletedAt`]),m=(e,t)=>o.t(Object.hasOwn(e,t)?e[t]:void 0),h=({page:e,options:t})=>{let n=Object.keys(e.records[0]??{}),i=t.fields??[...f.filter(e=>n.includes(e)),...n.filter(e=>!f.includes(e)&&!p.has(e))].slice(0,5),a=c.n.ROW_INDENT.length,s=0;for(let t of i){let n=o.t(t),r=n.length;s+=Buffer.byteLength(n,`utf8`)-n.length;for(let n of e.records){let e=m(n,t);r=Math.max(r,e.length),s+=Buffer.byteLength(e,`utf8`)-e.length}a+=r+c.n.COLUMN_GAP.length}d({recordCount:e.records.length,bytes:a*(e.records.length+1)+s});let l=e.records.length===0?`No records.`:c.t({rows:e.records,columns:i.map(e=>({header:o.t(e),value:t=>m(t,e)}))}),u=`${e.records.length} of ${e.totalCount} records`;return`${l}\n${r.i(e.pageInfo.hasNextPage?`${u} · --all for every page · --json for the next cursor`:u)}`};async function*g({fetchPage:e,cursor:n,signal:r}){let i=n,a=n,o=1,s=0,c=!0;for(;c;){r.throwIfAborted();let n=await e(i);r.throwIfAborted();let l=n.pageInfo.endCursor??void 0;if(n.records.length>0&&(l===i||l===a))throw new t.t({code:`INVALID_RESPONSE`,message:`The server returned a repeated pagination cursor.`});c=n.pageInfo.hasNextPage,c&&(s+=1,s===o&&(a=l,o*=2,s=0)),yield n,i=l}}var _=r=>{let i=n.r(r,`limit`)??`50`,a=Number(i),o=n.r(r,`fields`)?.split(`,`).map(e=>e.trim()),s=n.r(r,`cursor`);if(!/^\d+$/.test(i)||!Number.isInteger(a)||a<1||a>200)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`--limit must be an integer between 1 and 200.`});if(o?.some(e=>e.length===0)||e.Ut(s)&&s.length===0)throw new t.t({code:`USAGE`,exitCode:t.n.USAGE,message:`--fields and --cursor cannot contain empty values.`});return{limit:a,fields:e.Ut(o)?[...new Set(o)]:void 0,cursor:s,filter:n.r(r,`filter`),orderBy:n.r(r,`orderBy`),all:n.t(r,`all`)}},v=async({arguments:e,options:r,target:o,signal:c,output:f,outputMode:p})=>{let m=_(r),v=await u.t({client:a.t({target:o,signal:c}),name:n.n(e,0)??``}),y=l.t({target:o,signal:c}),b=p===`ndjson`,x=[],S=0,C=0,w=0,T=m.cursor??null,E={hasNextPage:!1,startCursor:null,endCursor:null},D=0;try{b&&await f.event(`start`,{object:v.namePlural,target:s.t(o)},c);for await(let e of g({cursor:m.cursor,signal:c,fetchPage:async e=>l.n(await y.get(`/rest/${encodeURIComponent(v.namePlural)}`,{query:{limit:m.limit,starting_after:e,filter:m.filter,order_by:m.orderBy}}),v.namePlural,m.limit)})){for(let t of e.records)b?await f.event(`record`,t,c):(w+=Buffer.byteLength(JSON.stringify(t),`utf8`),d({recordCount:S+1,bytes:w+S+Buffer.byteLength(JSON.stringify({records:[],pageInfo:e.pageInfo,totalCount:e.totalCount}),`utf8`)}),x.push(t)),S+=1;if(C+=1,E=e.pageInfo,D=e.totalCount,T=E.endCursor??T,b&&await f.event(`progress`,{recordCount:S,pages:C,resumeCursor:T,pageInfo:E,totalCount:D},c),!m.all)break}}catch(e){let n=i.t(e,c);throw b?new t.t({code:n.code,exitCode:n.exitCode,message:n.message,hint:n.hint,details:{...n.details,recordCount:S,pages:C,resumeCursor:T}}):n}if(b)return{data:{recordCount:S,pages:C,resumeCursor:T,pageInfo:E,totalCount:D}};let O={records:x,pageInfo:E,totalCount:D},k=p===`human`&&x.length>0?(m.fields??[]).filter(e=>!x.some(t=>Object.hasOwn(t,e))):[];return k.length>0&&f.warn({code:`FIELDS_NOT_RETURNED`,message:`No returned record has ${k.join(`, `)}; see twenty metadata field list ${v.namePlural}.`}),{data:O,...p===`human`?{human:h({page:O,options:m})}:{}}};exports.runDataListCommand=v;
@@ -1,2 +1,2 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./check-node-requirement-CGBKvEqH.cjs"),n=require("./cli-node-version-range.constant-D7fE8edk.cjs"),r=require("./utils-ZOESAfF8-ub6jPiZ-.cjs"),i=require("./constants-CemcuPi_-D7dbw2cv.cjs"),a=require("./read-json-object-CgaXuNS0.cjs"),o=require("./has-yarn-plug-and-play-X3ay5Xl0.cjs"),s=require("./cli-error-CSsayo0u.cjs"),c=require("./resolve-source-sdk-B1Fxlsmt.cjs"),l=require("./parse-api-url-CEfjRyid.cjs"),u=require("./read-command-values-uSJqBG_E.cjs"),d=require("./target-environment-variable.constant-D7z8AihP.cjs"),f=require("./style-BR52fK4V.cjs"),p=require("./resolve-app-project-dftvbB2P.cjs"),m=require("./cli-version.constant-BBeYll5N.cjs"),h=require("./to-public-target-C0POrVoG.cjs"),g=require("./select-target-CfuNLCQL.cjs"),_=require("./get-config-path-C-D-QHuX.cjs"),v=require("./read-config-DdtXhdPp.cjs"),y=require("./is-access-token-expiring-D-YfufId.cjs"),b=require("./config-file-mode.constant-DLBzKKUl.cjs"),x=require("./fetch-signed-in-identity-b_LbRuL-.cjs");let S=require("node:fs/promises"),C=require("node:path"),w=require("node:fs");var T={pass:`green`,warning:`yellow`,fail:`red`,skipped:`yellow`},E=(e,t=process.stdout)=>e.map(e=>{let n=i.Vt(e.hint)?`\n ${e.hint}`:``;return`${f.n(T[e.status],`[${e.status.toUpperCase()}]`,t)} ${e.id}: ${e.message}${n}`}).join(`
2
- `),D=e.t(),O={AUTH_REQUIRED:{message:`The metadata endpoint rejected these credentials.`,hint:`Check the configured credentials, or sign in again.`},PERMISSION_DENIED:{message:`The metadata endpoint denied access to the workspace identity.`,hint:`Check the selected remote and the permissions granted to its credentials.`},INVALID_RESPONSE:{message:`The server did not return a valid metadata API response.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},UNSUPPORTED_RESPONSE_TYPE:{message:`The metadata endpoint returned an unsupported response type.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},REDIRECT_NOT_FOLLOWED:{message:`The metadata endpoint redirected the request. No redirect was followed.`,hint:`Configure the final Twenty API URL, including the correct protocol and base path.`},TIMEOUT:{message:`The metadata endpoint did not respond before the request timed out.`,hint:`Check server availability and the network connection.`},NETWORK_ERROR:{message:`Could not connect to the metadata endpoint.`,hint:`Check the API URL, network connection, server availability and TLS configuration.`}},k={ENOTFOUND:`DNS could not resolve the metadata endpoint hostname.`,EAI_AGAIN:`DNS resolution of the metadata endpoint temporarily failed.`,ECONNREFUSED:`The metadata endpoint refused the connection.`,ECONNRESET:`The connection to the metadata endpoint was reset.`,EHOSTUNREACH:`The metadata endpoint host is unreachable.`,ENETUNREACH:`The network containing the metadata endpoint is unreachable.`,ETIMEDOUT:`The connection to the metadata endpoint timed out.`,UND_ERR_CONNECT_TIMEOUT:`The connection to the metadata endpoint timed out.`,CERT_HAS_EXPIRED:`The metadata endpoint TLS certificate has expired.`,ERR_TLS_CERT_ALTNAME_INVALID:`The metadata endpoint TLS certificate does not match its hostname.`,DEPTH_ZERO_SELF_SIGNED_CERT:`The metadata endpoint uses an untrusted self-signed TLS certificate.`,SELF_SIGNED_CERT_IN_CHAIN:`The metadata endpoint TLS certificate chain contains an untrusted self-signed certificate.`,UNABLE_TO_VERIFY_LEAF_SIGNATURE:`The metadata endpoint TLS certificate chain could not be verified.`,UNABLE_TO_GET_ISSUER_CERT_LOCALLY:`The metadata endpoint TLS certificate issuer is not trusted locally.`},A=e=>{let t=e instanceof s.t?e.code:`INTERNAL_ERROR`,n=O[t]??{message:`The metadata endpoint could not be verified (${t}).`,hint:`Check the API URL and server availability.`},r=e instanceof s.t&&t===`NETWORK_ERROR`?e.details?.networkCode:void 0,a=(0,D.isString)(r)&&Object.hasOwn(k,r)?k[r]:void 0;return{id:`metadata-api`,status:`fail`,code:t,message:a??n.message,hint:e instanceof s.t&&t===`AUTH_REQUIRED`&&i.Vt(e.hint)?e.hint:n.hint,...i.Vt(a)?{details:{networkCode:r}}:{}}},j=async({configPath:e,environment:t,remoteFlag:n,offline:r,signal:a})=>{let o=[],c,u;a.throwIfAborted();try{if(c=await v.t(e),o.push({id:`configuration`,status:`pass`,message:`CLI configuration checked at ${e}.`,details:{path:e,remoteCount:Object.keys(c.remotes).length,defaultRemote:c.defaultRemote??null}}),process.platform!==`win32`){let t=await(0,S.stat)(e).catch(()=>void 0);i.Vt(t)&&t.mode&63&&o.push({id:`configuration-permissions`,status:`warning`,message:`Other users may access the CLI configuration file.`,hint:`Review its permissions; ${b.t.PRIVATE_FILE.toString(8)} is the expected mode. Doctor does not change them.`})}}catch(t){u=t,o.push({id:`configuration`,status:`fail`,code:t instanceof s.t?t.code:`INVALID_CONFIG`,message:t instanceof s.t?t.message:`The CLI configuration is unreadable or invalid.`,hint:t instanceof s.t?t.hint:`Check ${e}. Doctor does not overwrite it.`})}let f;try{let e=await g.t({environment:t,remoteFlag:n,loadConfig:async()=>{if(!i.Vt(c))throw u;return c},warn:e=>o.push({id:`target-precedence`,status:`warning`,code:e.code,message:e.message})}),r=l.t({rawUrl:e.source===`remote`?e.remote.apiUrl:e.apiUrl,sourceName:e.source===`remote`?`The URL of remote ${e.remoteName}`:d.t.API_URL}),a={apiUrl:r,source:e.source,remote:e.source===`remote`?e.remoteName:null};o.push({id:`target`,status:`pass`,message:`Selected ${r} from ${e.source}.`,details:a});let s=e.source===`remote`?e.remote.twentyCLIAccessToken:void 0,p=(0,D.isNonEmptyString)(s)?`oauth`:`apiKey`,m=e.source===`remote`?e.remote.apiKey:e.apiKey,h=(0,D.isNonEmptyString)(s)?s:m;if(!(0,D.isNonEmptyString)(h))return o.push({id:`credentials`,status:`fail`,code:`AUTH_REQUIRED`,message:`The selected remote has no saved credentials.`,hint:`Sign in with twenty auth login, then rerun doctor.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`No credentials are available.`}];let _=p===`oauth`?y.t(h):void 0;if(i.Vt(_)&&_<=Date.now()){let t=e.source===`remote`&&(0,D.isNonEmptyString)(e.remote.twentyCLIRefreshToken);return o.push({id:`credentials`,status:t?`warning`:`fail`,code:`AUTH_REQUIRED`,message:t?`The OAuth access token has expired. A refresh token is saved, but renewal has not been verified.`:`The saved OAuth access token has expired and no refresh token is available.`,hint:`Run twenty auth status with the same remote to refresh the session, or sign in again. Doctor does not refresh credentials.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`The access token has expired.`}]}f={apiUrl:r,source:e.source,...e.source===`remote`?{remoteName:e.remoteName}:{},credentialKind:p,bearerToken:h},o.push({id:`credentials`,status:`pass`,message:`${p===`oauth`?`OAuth token`:`API key`} configured; acceptance is checked separately.`,details:{kind:p}})}catch(e){a.throwIfAborted();let t=e instanceof s.t?e.code:`INTERNAL_ERROR`;return o.push({id:`target`,status:t===`TARGET_REQUIRED`?`skipped`:`fail`,code:t,message:e instanceof s.t?e.message:`Could not select a workspace.`,hint:e instanceof s.t?e.hint:void 0}),[...o,{id:`credentials`,status:`skipped`,message:`No workspace was selected.`},{id:`metadata-api`,status:`skipped`,message:`No workspace was selected.`}]}if(r)return[...o,{id:`metadata-api`,status:`skipped`,message:`Network checks disabled by --offline.`}];try{a.throwIfAborted(),await x.t({target:f,signal:a}),o.push({id:`metadata-api`,status:`pass`,message:`The metadata endpoint accepted the configured credentials.`,details:{...h.t(f)}})}catch(e){a.throwIfAborted(),o.push(A(e))}return o},M=async e=>{for(let t of o.n((0,C.dirname)(e))){let n=await a.t((0,C.join)(t,`package.json`));if(!i.Vt(n))continue;let r=n.bin,o=(0,D.isString)(r)&&n.name===`twenty`?r:void 0,s=i.p(r)&&(0,D.isString)(r.twenty)?r.twenty:o;if(i.Vt(s)&&await(0,S.realpath)((0,C.resolve)(t,s)).catch(()=>void 0)===e)return{name:(0,D.isString)(n.name)?n.name:`unknown`,version:(0,D.isString)(n.version)?n.version:`unknown`}}return null},N=async({environment:e,workingDirectory:t,signal:n})=>{let a=[],o=process.platform===`win32`?[`twenty.exe`,`twenty.cmd`,`twenty.bat`,`twenty`]:[`twenty`],s=i.Vt(e.PATH)?e.PATH.split(C.delimiter):[];for(let e of new Set(s))for(let r of o){n.throwIfAborted();let i=(0,C.resolve)(t,e,r);if(!await(0,S.access)(i,w.constants.X_OK).then(()=>(0,S.stat)(i).then(e=>e.isFile()),()=>!1))continue;let o=await(0,S.realpath)(i);a.push({path:i,resolvedPath:o,owner:await M(o)})}let c=a[0],l=process.argv[1],u=i.Vt(l)?await(0,S.realpath)((0,C.resolve)(t,l)).catch(()=>void 0):void 0,d=a.filter(e=>e.owner?.name===`twenty-sdk`);return r.r(d)?{id:`path`,status:`warning`,message:`PATH contains legacy twenty-sdk executable(s) named twenty: ${d.map(e=>e.path).join(`, `)}.`,hint:`If this is a global twenty-sdk installation, remove it before installing the twenty CLI so the CLI owns the twenty name. Removing the SDK afterward can remove that executable link. Keep app-local SDK dependencies; use the intended CLI by its full path when needed. Doctor does not change installations.`,details:{candidates:a}}:i.Vt(c)?i.Vt(u)&&c.resolvedPath!==u?{id:`path`,status:`warning`,message:`${c.path} is first on PATH and differs from the running CLI.`,hint:`Use the intended executable by its full path, or review PATH order. Shell aliases, functions and command caches are not inspected.`,details:{candidates:a,runningPath:u}}:{id:`path`,status:c.owner?.name===`twenty`?`pass`:`warning`,message:i.Vt(c.owner)?`First twenty executable on PATH: ${c.path} (${c.owner.name} ${c.owner.version}).`:`First twenty executable on PATH: ${c.path}. Its package owner could not be determined.`,hint:`Shell aliases, functions and command caches are not inspected.`,details:{candidates:a}}:{id:`path`,status:`warning`,message:`No executable named twenty was found on PATH.`,hint:`Use the CLI entry point shown above, or your package manager to invoke the installed CLI.`,details:{candidates:a}}},P=async({explicitPath:e,workingDirectory:t,signal:n})=>{let r;n.throwIfAborted();try{r=await p.t({explicitPath:e,workingDirectory:t})}catch(t){return n.throwIfAborted(),[{id:`project`,status:!i.Vt(e)&&t instanceof s.t&&(t.code===`APP_NOT_FOUND`||t.code===`APP_PATH_REQUIRED`)?`skipped`:`fail`,message:t instanceof s.t?t.message:`Could not inspect the app directory.`,hint:`Use --path <app directory> to check a specific app.`},{id:`sdk`,status:`skipped`,message:`No app was selected.`}]}let a={id:`project`,status:`pass`,message:`${r.name} at ${r.path}.`,details:{name:r.name,path:r.path}};try{n.throwIfAborted();let e=[],t=await c.t({appPath:r.path,warn:t=>e.push(t)}),[o]=e,s={version:t.version,path:t.packagePath};return[a,i.Vt(o)?{id:`sdk`,status:`warning`,code:o.code,message:o.message,hint:`Builds continue. If one fails, switch to a Node version in that range.`,details:s}:{id:`sdk`,status:`pass`,message:`twenty-sdk ${t.version} provides the authoring exports required by the CLI.`,details:s}]}catch(e){return n.throwIfAborted(),[a,{id:`sdk`,status:`fail`,code:e instanceof s.t?e.code:`INTERNAL_ERROR`,message:e instanceof s.t?e.message:`Could not inspect the app SDK installation.`,hint:e instanceof s.t?e.hint:`Check that the app dependencies are installed and readable.`}]}},F=()=>{let e=t.t({version:process.versions.node,range:n.t})===`satisfied`;return[{id:`node`,status:e?`pass`:`fail`,message:`Node ${process.versions.node}, required ${n.t}.`,...e?{}:{hint:`Switch to a supported Node version and rerun doctor.`},details:{version:process.versions.node,required:n.t}},{id:`cli`,status:`pass`,message:`twenty ${m.t}, entry point ${process.argv[1]??`unknown`}.`,details:{version:m.t,nodeExecutable:process.execPath,entryPoint:process.argv[1]??null,platform:process.platform,arch:process.arch}}]},I=async({options:e,signal:t,outputMode:n})=>{let i=F(),a=process.cwd();try{i.push(await N({environment:process.env,workingDirectory:a,signal:t}))}catch{t.throwIfAborted(),i.push({id:`path`,status:`fail`,message:`Could not inspect executables on PATH.`})}i.push(...await P({explicitPath:u.r(e,`path`),workingDirectory:a,signal:t})),i.push(...await j({environment:process.env,configPath:_.t(),remoteFlag:u.r(e,`remote`),offline:u.t(e,`offline`),signal:t})),t.throwIfAborted();let o=i.filter(e=>e.status===`fail`),c=E(i,r.r(o)?process.stderr:process.stdout);if(r.r(o))throw new s.t({code:`DOCTOR_FAILED`,message:`${o.length} doctor ${o.length===1?`check`:`checks`} failed.`,hint:n===`human`?c:`Read error.details.checks for the failures and recovery hints.`,details:{checks:i}});return{data:{checks:i},human:c}};exports.runDoctorCommand=I;
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./check-node-requirement-CGBKvEqH.cjs"),n=require("./cli-node-version-range.constant-D7fE8edk.cjs"),r=require("./utils-CvvLHbc4-CKDJ1YgX.cjs"),i=require("./constants-D-caeNc5-9rDzSg5B.cjs"),a=require("./read-json-object-BXZs97qz.cjs"),o=require("./has-yarn-plug-and-play-X3ay5Xl0.cjs"),s=require("./cli-error-CSsayo0u.cjs"),c=require("./resolve-source-sdk-CU1wk4bl.cjs"),l=require("./parse-api-url-CFCz3xUA.cjs"),u=require("./read-command-values-uSJqBG_E.cjs"),d=require("./target-environment-variable.constant-D7z8AihP.cjs"),f=require("./style-BR52fK4V.cjs"),p=require("./resolve-app-project-B0KRR-xp.cjs"),m=require("./cli-version.constant-DGQXQw_V.cjs"),h=require("./to-public-target-bNT50le0.cjs"),g=require("./select-target-DZlm8j62.cjs"),_=require("./get-config-path-C-D-QHuX.cjs"),v=require("./read-config-Qwl4pAO8.cjs"),y=require("./is-access-token-expiring-DT6D8bMy.cjs"),b=require("./config-file-mode.constant-DLBzKKUl.cjs"),x=require("./fetch-signed-in-identity-B49Tf79K.cjs");let S=require("node:fs/promises"),C=require("node:path"),w=require("node:fs");var T={pass:`green`,warning:`yellow`,fail:`red`,skipped:`yellow`},E=(e,t=process.stdout)=>e.map(e=>{let n=i.Ut(e.hint)?`\n ${e.hint}`:``;return`${f.n(T[e.status],`[${e.status.toUpperCase()}]`,t)} ${e.id}: ${e.message}${n}`}).join(`
2
+ `),D=e.t(),O={AUTH_REQUIRED:{message:`The metadata endpoint rejected these credentials.`,hint:`Check the configured credentials, or sign in again.`},PERMISSION_DENIED:{message:`The metadata endpoint denied access to the workspace identity.`,hint:`Check the selected remote and the permissions granted to its credentials.`},INVALID_RESPONSE:{message:`The server did not return a valid metadata API response.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},UNSUPPORTED_RESPONSE_TYPE:{message:`The metadata endpoint returned an unsupported response type.`,hint:`Check the API URL and base path, and whether a proxy returned another page.`},REDIRECT_NOT_FOLLOWED:{message:`The metadata endpoint redirected the request. No redirect was followed.`,hint:`Configure the final Twenty API URL, including the correct protocol and base path.`},TIMEOUT:{message:`The metadata endpoint did not respond before the request timed out.`,hint:`Check server availability and the network connection.`},NETWORK_ERROR:{message:`Could not connect to the metadata endpoint.`,hint:`Check the API URL, network connection, server availability and TLS configuration.`}},k={ENOTFOUND:`DNS could not resolve the metadata endpoint hostname.`,EAI_AGAIN:`DNS resolution of the metadata endpoint temporarily failed.`,ECONNREFUSED:`The metadata endpoint refused the connection.`,ECONNRESET:`The connection to the metadata endpoint was reset.`,EHOSTUNREACH:`The metadata endpoint host is unreachable.`,ENETUNREACH:`The network containing the metadata endpoint is unreachable.`,ETIMEDOUT:`The connection to the metadata endpoint timed out.`,UND_ERR_CONNECT_TIMEOUT:`The connection to the metadata endpoint timed out.`,CERT_HAS_EXPIRED:`The metadata endpoint TLS certificate has expired.`,ERR_TLS_CERT_ALTNAME_INVALID:`The metadata endpoint TLS certificate does not match its hostname.`,DEPTH_ZERO_SELF_SIGNED_CERT:`The metadata endpoint uses an untrusted self-signed TLS certificate.`,SELF_SIGNED_CERT_IN_CHAIN:`The metadata endpoint TLS certificate chain contains an untrusted self-signed certificate.`,UNABLE_TO_VERIFY_LEAF_SIGNATURE:`The metadata endpoint TLS certificate chain could not be verified.`,UNABLE_TO_GET_ISSUER_CERT_LOCALLY:`The metadata endpoint TLS certificate issuer is not trusted locally.`},A=e=>{let t=e instanceof s.t?e.code:`INTERNAL_ERROR`,n=O[t]??{message:`The metadata endpoint could not be verified (${t}).`,hint:`Check the API URL and server availability.`},r=e instanceof s.t&&t===`NETWORK_ERROR`?e.details?.networkCode:void 0,a=(0,D.isString)(r)&&Object.hasOwn(k,r)?k[r]:void 0;return{id:`metadata-api`,status:`fail`,code:t,message:a??n.message,hint:e instanceof s.t&&t===`AUTH_REQUIRED`&&i.Ut(e.hint)?e.hint:n.hint,...i.Ut(a)?{details:{networkCode:r}}:{}}},j=async({configPath:e,environment:t,remoteFlag:n,offline:r,signal:a})=>{let o=[],c,u;a.throwIfAborted();try{if(c=await v.t(e),o.push({id:`configuration`,status:`pass`,message:`CLI configuration checked at ${e}.`,details:{path:e,remoteCount:Object.keys(c.remotes).length,defaultRemote:c.defaultRemote??null}}),process.platform!==`win32`){let t=await(0,S.stat)(e).catch(()=>void 0);i.Ut(t)&&t.mode&63&&o.push({id:`configuration-permissions`,status:`warning`,message:`Other users may access the CLI configuration file.`,hint:`Review its permissions; ${b.t.PRIVATE_FILE.toString(8)} is the expected mode. Doctor does not change them.`})}}catch(t){u=t,o.push({id:`configuration`,status:`fail`,code:t instanceof s.t?t.code:`INVALID_CONFIG`,message:t instanceof s.t?t.message:`The CLI configuration is unreadable or invalid.`,hint:t instanceof s.t?t.hint:`Check ${e}. Doctor does not overwrite it.`})}let f;try{let e=await g.t({environment:t,remoteFlag:n,loadConfig:async()=>{if(!i.Ut(c))throw u;return c},warn:e=>o.push({id:`target-precedence`,status:`warning`,code:e.code,message:e.message})}),r=l.t({rawUrl:e.source===`remote`?e.remote.apiUrl:e.apiUrl,sourceName:e.source===`remote`?`The URL of remote ${e.remoteName}`:d.t.API_URL}),a={apiUrl:r,source:e.source,remote:e.source===`remote`?e.remoteName:null};o.push({id:`target`,status:`pass`,message:`Selected ${r} from ${e.source}.`,details:a});let s=e.source===`remote`?e.remote.twentyCLIAccessToken:void 0,p=(0,D.isNonEmptyString)(s)?`oauth`:`apiKey`,m=e.source===`remote`?e.remote.apiKey:e.apiKey,h=(0,D.isNonEmptyString)(s)?s:m;if(!(0,D.isNonEmptyString)(h))return o.push({id:`credentials`,status:`fail`,code:`AUTH_REQUIRED`,message:`The selected remote has no saved credentials.`,hint:`Sign in with twenty auth login, then rerun doctor.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`No credentials are available.`}];let _=p===`oauth`?y.t(h):void 0;if(i.Ut(_)&&_<=Date.now()){let t=e.source===`remote`&&(0,D.isNonEmptyString)(e.remote.twentyCLIRefreshToken);return o.push({id:`credentials`,status:t?`warning`:`fail`,code:`AUTH_REQUIRED`,message:t?`The OAuth access token has expired. A refresh token is saved, but renewal has not been verified.`:`The saved OAuth access token has expired and no refresh token is available.`,hint:`Run twenty auth status with the same remote to refresh the session, or sign in again. Doctor does not refresh credentials.`}),[...o,{id:`metadata-api`,status:`skipped`,message:`The access token has expired.`}]}f={apiUrl:r,source:e.source,...e.source===`remote`?{remoteName:e.remoteName}:{},credentialKind:p,bearerToken:h},o.push({id:`credentials`,status:`pass`,message:`${p===`oauth`?`OAuth token`:`API key`} configured; acceptance is checked separately.`,details:{kind:p}})}catch(e){a.throwIfAborted();let t=e instanceof s.t?e.code:`INTERNAL_ERROR`;return o.push({id:`target`,status:t===`TARGET_REQUIRED`?`skipped`:`fail`,code:t,message:e instanceof s.t?e.message:`Could not select a workspace.`,hint:e instanceof s.t?e.hint:void 0}),[...o,{id:`credentials`,status:`skipped`,message:`No workspace was selected.`},{id:`metadata-api`,status:`skipped`,message:`No workspace was selected.`}]}if(r)return[...o,{id:`metadata-api`,status:`skipped`,message:`Network checks disabled by --offline.`}];try{a.throwIfAborted(),await x.t({target:f,signal:a}),o.push({id:`metadata-api`,status:`pass`,message:`The metadata endpoint accepted the configured credentials.`,details:{...h.t(f)}})}catch(e){a.throwIfAborted(),o.push(A(e))}return o},M=async e=>{for(let t of o.n((0,C.dirname)(e))){let n=await a.t((0,C.join)(t,`package.json`));if(!i.Ut(n))continue;let r=n.bin,o=(0,D.isString)(r)&&n.name===`twenty`?r:void 0,s=i.u(r)&&(0,D.isString)(r.twenty)?r.twenty:o;if(i.Ut(s)&&await(0,S.realpath)((0,C.resolve)(t,s)).catch(()=>void 0)===e)return{name:(0,D.isString)(n.name)?n.name:`unknown`,version:(0,D.isString)(n.version)?n.version:`unknown`}}return null},N=async({environment:e,workingDirectory:t,signal:n})=>{let a=[],o=process.platform===`win32`?[`twenty.exe`,`twenty.cmd`,`twenty.bat`,`twenty`]:[`twenty`],s=i.Ut(e.PATH)?e.PATH.split(C.delimiter):[];for(let e of new Set(s))for(let r of o){n.throwIfAborted();let i=(0,C.resolve)(t,e,r);if(!await(0,S.access)(i,w.constants.X_OK).then(()=>(0,S.stat)(i).then(e=>e.isFile()),()=>!1))continue;let o=await(0,S.realpath)(i);a.push({path:i,resolvedPath:o,owner:await M(o)})}let c=a[0],l=process.argv[1],u=i.Ut(l)?await(0,S.realpath)((0,C.resolve)(t,l)).catch(()=>void 0):void 0,d=a.filter(e=>e.owner?.name===`twenty-sdk`);return r.n(d)?{id:`path`,status:`warning`,message:`PATH contains legacy twenty-sdk executable(s) named twenty: ${d.map(e=>e.path).join(`, `)}.`,hint:`If this is a global twenty-sdk installation, remove it before installing the twenty CLI so the CLI owns the twenty name. Removing the SDK afterward can remove that executable link. Keep app-local SDK dependencies; use the intended CLI by its full path when needed. Doctor does not change installations.`,details:{candidates:a}}:i.Ut(c)?i.Ut(u)&&c.resolvedPath!==u?{id:`path`,status:`warning`,message:`${c.path} is first on PATH and differs from the running CLI.`,hint:`Use the intended executable by its full path, or review PATH order. Shell aliases, functions and command caches are not inspected.`,details:{candidates:a,runningPath:u}}:{id:`path`,status:c.owner?.name===`twenty`?`pass`:`warning`,message:i.Ut(c.owner)?`First twenty executable on PATH: ${c.path} (${c.owner.name} ${c.owner.version}).`:`First twenty executable on PATH: ${c.path}. Its package owner could not be determined.`,hint:`Shell aliases, functions and command caches are not inspected.`,details:{candidates:a}}:{id:`path`,status:`warning`,message:`No executable named twenty was found on PATH.`,hint:`Use the CLI entry point shown above, or your package manager to invoke the installed CLI.`,details:{candidates:a}}},P=async({explicitPath:e,workingDirectory:t,signal:n})=>{let r;n.throwIfAborted();try{r=await p.t({explicitPath:e,workingDirectory:t})}catch(t){return n.throwIfAborted(),[{id:`project`,status:!i.Ut(e)&&t instanceof s.t&&(t.code===`APP_NOT_FOUND`||t.code===`APP_PATH_REQUIRED`)?`skipped`:`fail`,message:t instanceof s.t?t.message:`Could not inspect the app directory.`,hint:`Use --path <app directory> to check a specific app.`},{id:`sdk`,status:`skipped`,message:`No app was selected.`}]}let a={id:`project`,status:`pass`,message:`${r.name} at ${r.path}.`,details:{name:r.name,path:r.path}};try{n.throwIfAborted();let e=[],t=await c.t({appPath:r.path,warn:t=>e.push(t)}),[o]=e,s={version:t.version,path:t.packagePath};return[a,i.Ut(o)?{id:`sdk`,status:`warning`,code:o.code,message:o.message,hint:`Builds continue. If one fails, switch to a Node version in that range.`,details:s}:{id:`sdk`,status:`pass`,message:`twenty-sdk ${t.version} provides the authoring exports required by the CLI.`,details:s}]}catch(e){return n.throwIfAborted(),[a,{id:`sdk`,status:`fail`,code:e instanceof s.t?e.code:`INTERNAL_ERROR`,message:e instanceof s.t?e.message:`Could not inspect the app SDK installation.`,hint:e instanceof s.t?e.hint:`Check that the app dependencies are installed and readable.`}]}},F=()=>{let e=t.t({version:process.versions.node,range:n.t})===`satisfied`;return[{id:`node`,status:e?`pass`:`fail`,message:`Node ${process.versions.node}, required ${n.t}.`,...e?{}:{hint:`Switch to a supported Node version and rerun doctor.`},details:{version:process.versions.node,required:n.t}},{id:`cli`,status:`pass`,message:`twenty ${m.t}, entry point ${process.argv[1]??`unknown`}.`,details:{version:m.t,nodeExecutable:process.execPath,entryPoint:process.argv[1]??null,platform:process.platform,arch:process.arch}}]},I=async({options:e,signal:t,outputMode:n})=>{let i=F(),a=process.cwd();try{i.push(await N({environment:process.env,workingDirectory:a,signal:t}))}catch{t.throwIfAborted(),i.push({id:`path`,status:`fail`,message:`Could not inspect executables on PATH.`})}i.push(...await P({explicitPath:u.r(e,`path`),workingDirectory:a,signal:t})),i.push(...await j({environment:process.env,configPath:_.t(),remoteFlag:u.r(e,`remote`),offline:u.t(e,`offline`),signal:t})),t.throwIfAborted();let o=i.filter(e=>e.status===`fail`),c=E(i,r.n(o)?process.stderr:process.stdout);if(r.n(o))throw new s.t({code:`DOCTOR_FAILED`,message:`${o.length} doctor ${o.length===1?`check`:`checks`} failed.`,hint:n===`human`?c:`Read error.details.checks for the failures and recovery hints.`,details:{checks:i}});return{data:{checks:i},human:c}};exports.runDoctorCommand=I;
@@ -1,3 +1,3 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-ZOESAfF8-ub6jPiZ-.cjs"),n=require("./constants-CemcuPi_-D7dbw2cv.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./format-details-COEwKz_M.cjs"),o=require("./format-table-4drtI5sP.cjs"),s=require("./format-metadata-owner-CyEMvoQr.cjs"),c=require("./fetch-metadata-inspection-CAmEp-xl.cjs"),l=require("./format-metadata-fields-BOG2kj2h.cjs");var u=e.t(),d=e=>n.Vt(e)?String(e):`unknown`,f=async({arguments:e,target:f,signal:p,output:m})=>{let h=i.n(e,1)??``,{object:g,fields:_}=await c.t({objectName:i.n(e,0)??``,target:f,signal:p,output:m}),v=_.filter(e=>e.name===h);if(v.length>1)throw new r.t({code:`AMBIGUOUS_RESOURCE`,exitCode:r.n.USAGE,message:`More than one field has the API name ${h} on ${g.namePlural}.`});let y=v[0];if(!n.Vt(y))throw new r.t({code:`NOT_FOUND`,exitCode:r.n.NOT_FOUND,message:`No field has the API name ${h} on ${g.namePlural}.`,hint:`Use an exact API name from twenty metadata field list ${g.namePlural} --all.`});let b=l.r(y);return{data:{object:g,field:y},human:[`${y.label} (${y.name}) on ${g.namePlural}`,a.t([[`ID`,y.id],[`Type`,y.type],[`Owner`,s.t(y.owner)],[`Active`,d(y.isActive)],[`System`,d(y.isSystem)],[`Nullable`,d(y.isNullable)],[`Unique`,d(y.isUnique)],[`Default`,JSON.stringify(y.defaultValue??null)]]),y.description??``,l.n(y),t.r(b)?o.t({rows:b,columns:[{header:`OPTION`,value:e=>String(e.label??``)},{header:`VALUE`,value:e=>String(e.value??``)},{header:`COLOR`,value:e=>String(e.color??``)}]}):``].filter(u.isNonEmptyString).join(`
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-CvvLHbc4-CKDJ1YgX.cjs"),n=require("./constants-D-caeNc5-9rDzSg5B.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./format-details-COEwKz_M.cjs"),o=require("./format-table-4drtI5sP.cjs"),s=require("./format-metadata-owner-CsQXOj_P.cjs"),c=require("./fetch-metadata-inspection-CeqzcB_x.cjs"),l=require("./format-metadata-fields-BTukrGn9.cjs");var u=e.t(),d=e=>n.Ut(e)?String(e):`unknown`,f=async({arguments:e,target:f,signal:p,output:m})=>{let h=i.n(e,1)??``,{object:g,fields:_}=await c.t({objectName:i.n(e,0)??``,target:f,signal:p,output:m}),v=_.filter(e=>e.name===h);if(v.length>1)throw new r.t({code:`AMBIGUOUS_RESOURCE`,exitCode:r.n.USAGE,message:`More than one field has the API name ${h} on ${g.namePlural}.`});let y=v[0];if(!n.Ut(y))throw new r.t({code:`NOT_FOUND`,exitCode:r.n.NOT_FOUND,message:`No field has the API name ${h} on ${g.namePlural}.`,hint:`Use an exact API name from twenty metadata field list ${g.namePlural} --all.`});let b=l.r(y);return{data:{object:g,field:y},human:[`${y.label} (${y.name}) on ${g.namePlural}`,a.t([[`ID`,y.id],[`Type`,y.type],[`Owner`,s.t(y.owner)],[`Active`,d(y.isActive)],[`System`,d(y.isSystem)],[`Nullable`,d(y.isNullable)],[`Unique`,d(y.isUnique)],[`Default`,JSON.stringify(y.defaultValue??null)]]),y.description??``,l.n(y),t.n(b)?o.t({rows:b,columns:[{header:`OPTION`,value:e=>String(e.label??``)},{header:`VALUE`,value:e=>String(e.value??``)},{header:`COLOR`,value:e=>String(e.color??``)}]}):``].filter(u.isNonEmptyString).join(`
2
2
 
3
3
  `)}};exports.runMetadataFieldDescribeCommand=f;
@@ -1,3 +1,3 @@
1
- const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./fetch-metadata-inspection-CAmEp-xl.cjs"),n=require("./format-metadata-fields-BOG2kj2h.cjs");var r=({fields:e,includeSystemFields:t})=>{let n=e.filter(e=>t||e.isSystem!==!0);return{fields:n,hiddenSystemFieldCount:e.length-n.length}},i=async({arguments:i,options:a,target:o,signal:s,output:c})=>{let l=await t.t({objectName:e.n(i,0)??``,target:o,signal:s,output:c}),{object:u}=l,{fields:d,hiddenSystemFieldCount:f}=r({fields:l.fields,includeSystemFields:e.t(a,`all`)});return{data:{object:u,fields:d,hiddenSystemFieldCount:f},human:[`${u.labelPlural} (${u.namePlural})`,n.t({fields:d,hiddenSystemFieldCount:f,labelIdentifierFieldMetadataId:u.labelIdentifierFieldMetadataId})].join(`
1
+ const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./fetch-metadata-inspection-CeqzcB_x.cjs"),n=require("./format-metadata-fields-BTukrGn9.cjs");var r=({fields:e,includeSystemFields:t})=>{let n=e.filter(e=>t||e.isSystem!==!0);return{fields:n,hiddenSystemFieldCount:e.length-n.length}},i=async({arguments:i,options:a,target:o,signal:s,output:c})=>{let l=await t.t({objectName:e.n(i,0)??``,target:o,signal:s,output:c}),{object:u}=l,{fields:d,hiddenSystemFieldCount:f}=r({fields:l.fields,includeSystemFields:e.t(a,`all`)});return{data:{object:u,fields:d,hiddenSystemFieldCount:f},human:[`${u.labelPlural} (${u.namePlural})`,n.t({fields:d,hiddenSystemFieldCount:f,labelIdentifierFieldMetadataId:u.labelIdentifierFieldMetadataId})].join(`
2
2
 
3
3
  `)}};exports.runMetadataFieldListCommand=i;
@@ -1,3 +1,3 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./format-data-value-C7Njc7Sb.cjs"),i=require("./format-details-COEwKz_M.cjs"),a=require("./format-metadata-owner-CyEMvoQr.cjs"),o=require("./fetch-metadata-inspection-CAmEp-xl.cjs");var s=e.t(),c=async({arguments:e,target:c,signal:l,output:u})=>{let{object:d}=await o.t({objectName:t.n(e,0)??``,target:c,signal:l,output:u});return{data:{object:d},human:[`${d.labelPlural} (${d.namePlural})`,i.t([[`ID`,d.id],[`API names`,`${d.nameSingular} / ${d.namePlural}`],...(0,s.isNonEmptyString)(d.description)?[[`Description`,r.r(d.description)]]:[],[`Owner`,a.t(d.owner)],[`Active`,String(d.isActive)],[`System`,String(d.isSystem)],[`Searchable`,String(d.isSearchable)]]),`Fields: ${n.r(`twenty metadata field list ${d.namePlural}`)}`].join(`
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./format-data-value-kug8Yjt2.cjs"),i=require("./format-details-COEwKz_M.cjs"),a=require("./format-metadata-owner-CsQXOj_P.cjs"),o=require("./fetch-metadata-inspection-CeqzcB_x.cjs");var s=e.t(),c=async({arguments:e,target:c,signal:l,output:u})=>{let{object:d}=await o.t({objectName:t.n(e,0)??``,target:c,signal:l,output:u});return{data:{object:d},human:[`${d.labelPlural} (${d.namePlural})`,i.t([[`ID`,d.id],[`API names`,`${d.nameSingular} / ${d.namePlural}`],...(0,s.isNonEmptyString)(d.description)?[[`Description`,r.r(d.description)]]:[],[`Owner`,a.t(d.owner)],[`Active`,String(d.isActive)],[`System`,String(d.isSystem)],[`Searchable`,String(d.isSearchable)]]),`Fields: ${n.r(`twenty metadata field list ${d.namePlural}`)}`].join(`
2
2
 
3
3
  `)}};exports.runMetadataObjectDescribeCommand=c;
@@ -0,0 +1,2 @@
1
+ const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./create-metadata-client-9IF8ArjT.cjs"),r=require("./format-table-4drtI5sP.cjs"),i=require("./metadata-page.constant-CxWuBtP5.cjs"),a=require("./format-metadata-owner-CsQXOj_P.cjs");var o=[`standard`,`application`,`custom`,`unknown`],s=(e,t)=>e.query({objects:{__args:{paging:{first:i.t,after:t},filter:{}},pageInfo:{hasNextPage:!0,endCursor:!0},edges:{node:{nameSingular:!0,namePlural:!0,labelSingular:!0,labelPlural:!0,isSystem:!0,isActive:!0,applicationId:!0}}},currentWorkspace:{workspaceCustomApplicationId:!0}}),c=async({options:c,output:l,target:u,signal:d})=>{let f=e.t(c,`all`),p=n.t({target:u,signal:d}),[{objects:m,currentWorkspace:h},{applications:g,areOwnersNamed:_}]=await Promise.all([s(p),a.r(p)]),v=await i.n(async e=>e===void 0?m:(await s(p,e)).objects);_||l.warn({code:`OWNERS_UNAVAILABLE`,message:`Owners other than Custom show as unknown: listing apps needs the Workspace Apps permission.`});let y=a.n({applications:g,workspaceCustomApplicationId:h.workspaceCustomApplicationId}),b=v.map(({applicationId:e,...t})=>({...t,owner:y(e)})),x=b.filter(e=>f||!e.isSystem).sort((e,t)=>{let n=o.indexOf(e.owner.kind)-o.indexOf(t.owner.kind);return n===0?e.namePlural.localeCompare(t.namePlural):n}),S=b.length-x.length;return{data:{objects:x,hiddenSystemObjectCount:S},human:[r.t({rows:x,columns:[{header:`API NAME`,value:e=>e.namePlural},{header:`LABEL`,value:e=>e.isActive?e.labelPlural:`${e.labelPlural} ${t.i(`(inactive)`)}`},{header:`OWNER`,value:e=>a.t(e.owner)}]}),t.i(S>0?`${x.length} objects · ${S} system objects hidden, show them with --all`:`${x.length} objects`)].join(`
2
+ `)}};exports.runMetadataObjectListCommand=c;
@@ -1 +1 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CemcuPi_-D7dbw2cv.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./parse-api-url-CEfjRyid.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./resolve-request-url-Cnuxu_nj.cjs"),o=require("./is-interaction-allowed-CF-ko1KI.cjs"),s=require("./create-metadata-client-BRD2ys8z.cjs"),c=require("./open-browser-LPuVspT7.cjs");var l=({workspaceUrl:e,page:r})=>{if(!t.Vt(r))return e.href;let i=URL.parse(r,e);if(!t.Vt(i)||i.origin!==e.origin||i.pathname.startsWith(`//`))throw new n.t({code:`USAGE`,exitCode:n.n.USAGE,message:`${r} is not a page of the workspace.`,hint:`Pass a path inside the workspace, for example settings/applications.`});return i.href},u=e.t(),d=(e,i)=>{let a=(0,u.isNonEmptyString)(e)?URL.parse(e):null;if(!t.Vt(a)||!r.r.includes(a.protocol))throw new n.t({code:`INVALID_RESPONSE`,message:`${i} did not return a web address for this workspace.`});return a},f=async({target:e,signal:n})=>{let{currentWorkspace:r}=await s.t({target:e,signal:n}).query({currentWorkspace:{workspaceUrls:{customUrl:!0,subdomainUrl:!0}}}),i=r?.workspaceUrls,o=(0,u.isNonEmptyString)(i?.customUrl)?i.customUrl:i?.subdomainUrl;if((0,u.isNonEmptyString)(o))return d(o,e.apiUrl);let c=await a.r({apiUrl:e.apiUrl,signal:n})(a.t({apiUrl:e.apiUrl,path:`/.well-known/oauth-authorization-server`}),{headers:{Accept:`application/json`}}),l=await a.n(c),f=d(c.ok&&t.p(l)?l.authorization_endpoint:void 0,e.apiUrl);return new URL(f.origin)},p=async({arguments:e,options:t,outputMode:r,target:a,signal:s})=>{let u=i.t(t,`urlOnly`);if(!u&&!o.t({options:t,outputMode:r}))throw new n.t({code:`USAGE`,exitCode:n.n.USAGE,message:`twenty open only opens a browser in an interactive terminal, not with --no-input, JSON output, redirected stdin or in CI.`,hint:`Add --url-only to print the address instead.`});let d=l({workspaceUrl:await f({target:a,signal:s}),page:i.n(e,0)});return u?{data:{url:d},human:d}:(c.t(d),{data:{url:d},human:`Opening ${d} in your browser.`})};exports.runOpenCommand=p;
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./parse-api-url-CFCz3xUA.cjs"),i=require("./read-command-values-uSJqBG_E.cjs"),a=require("./resolve-request-url-BvOe0vYd.cjs"),o=require("./is-interaction-allowed-CF-ko1KI.cjs"),s=require("./create-metadata-client-9IF8ArjT.cjs"),c=require("./open-browser-LPuVspT7.cjs");var l=({workspaceUrl:e,page:r})=>{if(!t.Ut(r))return e.href;let i=URL.parse(r,e);if(!t.Ut(i)||i.origin!==e.origin||i.pathname.startsWith(`//`))throw new n.t({code:`USAGE`,exitCode:n.n.USAGE,message:`${r} is not a page of the workspace.`,hint:`Pass a path inside the workspace, for example settings/applications.`});return i.href},u=e.t(),d=(e,i)=>{let a=(0,u.isNonEmptyString)(e)?URL.parse(e):null;if(!t.Ut(a)||!r.r.includes(a.protocol))throw new n.t({code:`INVALID_RESPONSE`,message:`${i} did not return a web address for this workspace.`});return a},f=async({target:e,signal:n})=>{let{currentWorkspace:r}=await s.t({target:e,signal:n}).query({currentWorkspace:{workspaceUrls:{customUrl:!0,subdomainUrl:!0}}}),i=r?.workspaceUrls,o=(0,u.isNonEmptyString)(i?.customUrl)?i.customUrl:i?.subdomainUrl;if((0,u.isNonEmptyString)(o))return d(o,e.apiUrl);let c=await a.r({apiUrl:e.apiUrl,signal:n})(a.t({apiUrl:e.apiUrl,path:`/.well-known/oauth-authorization-server`}),{headers:{Accept:`application/json`}}),l=await a.n(c),f=d(c.ok&&t.u(l)?l.authorization_endpoint:void 0,e.apiUrl);return new URL(f.origin)},p=async({arguments:e,options:t,outputMode:r,target:a,signal:s})=>{let u=i.t(t,`urlOnly`);if(!u&&!o.t({options:t,outputMode:r}))throw new n.t({code:`USAGE`,exitCode:n.n.USAGE,message:`twenty open only opens a browser in an interactive terminal, not with --no-input, JSON output, redirected stdin or in CI.`,hint:`Add --url-only to print the address instead.`});let d=l({workspaceUrl:await f({target:a,signal:s}),page:i.n(e,0)});return u?{data:{url:d},human:d}:(c.t(d),{data:{url:d},human:`Opening ${d} in your browser.`})};exports.runOpenCommand=p;
@@ -1 +1 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./read-config-DdtXhdPp.cjs"),i=require("./get-credential-kind-JI9heHe2.cjs"),a=require("./credential-kind-labels.constant-CKdoQF8o.cjs"),o=require("./format-table-4drtI5sP.cjs");var s=e.t(),c=async()=>{let e=await r.t(n.t()),c=Object.entries(e.remotes).map(([t,n])=>({name:t,apiUrl:n.apiUrl,credentials:i.t(n),workspaceName:(0,s.isString)(n.workspaceName)?n.workspaceName:null,isDefault:t===e.defaultRemote})).sort((e,t)=>e.name.localeCompare(t.name));return c.length===0?{data:{remotes:c,defaultRemote:null},human:`No saved remotes. ${t.i(`Sign in with: `)}${t.r(`twenty auth login --url <url>`)}`}:{data:{remotes:c,defaultRemote:e.defaultRemote??null},human:o.t({rows:c,columns:[{header:` `,value:e=>e.isDefault?t.n(`green`,`●`):``},{header:`NAME`,value:e=>e.name},{header:`URL`,value:e=>e.apiUrl},{header:`AUTH`,value:e=>a.t[e.credentials]},{header:`WORKSPACE`,value:e=>e.workspaceName??``}]})}};exports.runRemoteListCommand=c;
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./read-config-Qwl4pAO8.cjs"),i=require("./get-credential-kind-JI9heHe2.cjs"),a=require("./credential-kind-labels.constant-CKdoQF8o.cjs"),o=require("./format-table-4drtI5sP.cjs");var s=e.t(),c=async()=>{let e=await r.t(n.t()),c=Object.entries(e.remotes).map(([t,n])=>({name:t,apiUrl:n.apiUrl,credentials:i.t(n),workspaceName:(0,s.isString)(n.workspaceName)?n.workspaceName:null,isDefault:t===e.defaultRemote})).sort((e,t)=>e.name.localeCompare(t.name));return c.length===0?{data:{remotes:c,defaultRemote:null},human:`No saved remotes. ${t.i(`Sign in with: `)}${t.r(`twenty auth login --url <url>`)}`}:{data:{remotes:c,defaultRemote:e.defaultRemote??null},human:o.t({rows:c,columns:[{header:` `,value:e=>e.isDefault?t.n(`green`,`●`):``},{header:`NAME`,value:e=>e.name},{header:`URL`,value:e=>e.apiUrl},{header:`AUTH`,value:e=>a.t[e.credentials]},{header:`WORKSPACE`,value:e=>e.workspaceName??``}]})}};exports.runRemoteListCommand=c;
@@ -1,2 +1,2 @@
1
- const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-D48r20g0.cjs"),i=require("./update-config-FzOzO3wZ.cjs");var a=async({arguments:a,signal:o})=>{let s=e.n(a,0)??``,c=await i.t({configPath:n.t(),signal:o,update:e=>{r.t(e,s);let{[s]:t,...n}=e.remotes,{defaultRemote:i,...a}=e,o=i===s;return{result:o,config:{...o?a:e,remotes:n}}}});return{data:{removed:s,wasDefault:c},human:[t.o(`Removed ${s}.`),...c?[t.i(` There is no default remote now. Pick one with: twenty remote use <name>`)]:[]].join(`
1
+ const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-D48r20g0.cjs"),i=require("./update-config-CnB7lDVC.cjs");var a=async({arguments:a,signal:o})=>{let s=e.n(a,0)??``,c=await i.t({configPath:n.t(),signal:o,update:e=>{r.t(e,s);let{[s]:t,...n}=e.remotes,{defaultRemote:i,...a}=e,o=i===s;return{result:o,config:{...o?a:e,remotes:n}}}});return{data:{removed:s,wasDefault:c},human:[t.o(`Removed ${s}.`),...c?[t.i(` There is no default remote now. Pick one with: twenty remote use <name>`)]:[]].join(`
2
2
  `)}};exports.runRemoteRemoveCommand=a;
@@ -1 +1 @@
1
- const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./get-config-path-C-D-QHuX.cjs"),i=require("./find-remote-D48r20g0.cjs"),a=require("./update-config-FzOzO3wZ.cjs"),o=require("./validate-remote-name-w-qnr43w.cjs");var s=async({arguments:s,signal:c})=>{let l=t.n(s,0)??``,u=o.t(t.n(s,1)??``);return{data:{previousName:l,name:u,isDefault:await a.t({configPath:r.t(),signal:c,update:t=>{let n=i.t(t,l);if(Object.hasOwn(t.remotes,u))throw new e.t({code:`REMOTE_EXISTS`,exitCode:e.n.USAGE,message:`A remote named ${u} already exists.`,hint:`Pick another name, or remove it first: twenty remote remove ${u}`});let{[l]:r,...a}=t.remotes,o=t.defaultRemote===l;return{result:o,config:{...t,remotes:{...a,[u]:n},...o?{defaultRemote:u}:{}}}}})},human:n.o(`Renamed ${l} to ${u}.`)}};exports.runRemoteRenameCommand=s;
1
+ const e=require("./cli-error-CSsayo0u.cjs"),t=require("./read-command-values-uSJqBG_E.cjs"),n=require("./style-BR52fK4V.cjs"),r=require("./get-config-path-C-D-QHuX.cjs"),i=require("./find-remote-D48r20g0.cjs"),a=require("./update-config-CnB7lDVC.cjs"),o=require("./validate-remote-name-w-qnr43w.cjs");var s=async({arguments:s,signal:c})=>{let l=t.n(s,0)??``,u=o.t(t.n(s,1)??``);return{data:{previousName:l,name:u,isDefault:await a.t({configPath:r.t(),signal:c,update:t=>{let n=i.t(t,l);if(Object.hasOwn(t.remotes,u))throw new e.t({code:`REMOTE_EXISTS`,exitCode:e.n.USAGE,message:`A remote named ${u} already exists.`,hint:`Pick another name, or remove it first: twenty remote remove ${u}`});let{[l]:r,...a}=t.remotes,o=t.defaultRemote===l;return{result:o,config:{...t,remotes:{...a,[u]:n},...o?{defaultRemote:u}:{}}}}})},human:n.o(`Renamed ${l} to ${u}.`)}};exports.runRemoteRenameCommand=s;
@@ -1 +1 @@
1
- const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-D48r20g0.cjs"),i=require("./update-config-FzOzO3wZ.cjs");var a=async({arguments:a,signal:o})=>{let s=e.n(a,0)??``,c=await i.t({configPath:n.t(),signal:o,update:e=>({result:r.t(e,s),config:{...e,defaultRemote:s}})});return{data:{defaultRemote:s,apiUrl:c.apiUrl},human:t.o(`Default remote is now ${s} ${t.i(`(${c.apiUrl})`)}`)}};exports.runRemoteUseCommand=a;
1
+ const e=require("./read-command-values-uSJqBG_E.cjs"),t=require("./style-BR52fK4V.cjs"),n=require("./get-config-path-C-D-QHuX.cjs"),r=require("./find-remote-D48r20g0.cjs"),i=require("./update-config-CnB7lDVC.cjs");var a=async({arguments:a,signal:o})=>{let s=e.n(a,0)??``,c=await i.t({configPath:n.t(),signal:o,update:e=>({result:r.t(e,s),config:{...e,defaultRemote:s}})});return{data:{defaultRemote:s,apiUrl:c.apiUrl},human:t.o(`Default remote is now ${s} ${t.i(`(${c.apiUrl})`)}`)}};exports.runRemoteUseCommand=a;
@@ -1 +1 @@
1
- const e=require("./style-BR52fK4V.cjs"),t=require("./cli-version.constant-BBeYll5N.cjs");var n=async()=>{let n={version:t.t,node:process.versions.node,platform:process.platform,arch:process.arch};return{data:n,human:`twenty ${n.version} ${e.i(`(node ${n.node}, ${n.platform}-${n.arch})`)}`}};exports.runVersionCommand=n;
1
+ const e=require("./style-BR52fK4V.cjs"),t=require("./cli-version.constant-DGQXQw_V.cjs");var n=async()=>{let n={version:t.t,node:process.versions.node,platform:process.platform,arch:process.arch};return{data:n,human:`twenty ${n.version} ${e.i(`(node ${n.node}, ${n.platform}-${n.arch})`)}`}};exports.runVersionCommand=n;
@@ -1 +1 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-ZOESAfF8-ub6jPiZ-.cjs"),n=require("./constants-CemcuPi_-D7dbw2cv.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./target-environment-variable.constant-D7z8AihP.cjs"),a=require("./find-remote-D48r20g0.cjs");var o=e.t(),s=e=>e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`,c=(e,t)=>{let n=e[t]?.trim();return(0,o.isNonEmptyString)(n)?n:void 0},l=(e,t)=>({source:`remote`,remoteName:t,remote:a.t(e,t)}),u=async({environment:e,remoteFlag:a,loadConfig:o,warn:u})=>{let d=c(e,i.t.REMOTE),f=c(e,i.t.API_URL),p=c(e,i.t.API_KEY);if(n.Vt(a)){let r=Object.values(i.t).filter(t=>n.Vt(c(e,t)));return t.r(r)&&u({code:`ENVIRONMENT_TARGET_IGNORED`,message:`Using remote ${a}. Ignoring ${s(r)}.`}),l(await o(),a)}if(n.Vt(d)){if(n.Vt(f)||n.Vt(p))throw new r.t({code:`CONFLICTING_TARGET`,exitCode:r.n.USAGE,message:`${i.t.REMOTE} cannot be combined with ${i.t.API_URL} or ${i.t.API_KEY}.`,hint:`Unset one of them, or choose with --remote.`});return l(await o(),d)}if(n.Vt(f)!==n.Vt(p)){let e=n.Vt(f)?i.t.API_KEY:i.t.API_URL;throw new r.t({code:`INCOMPLETE_TARGET`,exitCode:r.n.USAGE,message:`${e} is not set.`,hint:`Set both ${i.t.API_URL} and ${i.t.API_KEY}, or neither.`})}if(n.Vt(f)&&n.Vt(p))return{source:`environment`,apiUrl:f,apiKey:p};let m=await o();if(n.Vt(m.defaultRemote))return l(m,m.defaultRemote);throw new r.t({code:`TARGET_REQUIRED`,exitCode:r.n.USAGE,message:`No workspace selected.`,hint:`Sign in with: twenty auth login --url <url>. Or set ${i.t.API_URL} and ${i.t.API_KEY}.`})};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./utils-CvvLHbc4-CKDJ1YgX.cjs"),n=require("./constants-D-caeNc5-9rDzSg5B.cjs"),r=require("./cli-error-CSsayo0u.cjs"),i=require("./target-environment-variable.constant-D7z8AihP.cjs"),a=require("./find-remote-D48r20g0.cjs");var o=e.t(),s=e=>e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`,c=(e,t)=>{let n=e[t]?.trim();return(0,o.isNonEmptyString)(n)?n:void 0},l=(e,t)=>({source:`remote`,remoteName:t,remote:a.t(e,t)}),u=async({environment:e,remoteFlag:a,loadConfig:o,warn:u})=>{let d=c(e,i.t.REMOTE),f=c(e,i.t.API_URL),p=c(e,i.t.API_KEY);if(n.Ut(a)){let r=Object.values(i.t).filter(t=>n.Ut(c(e,t)));return t.n(r)&&u({code:`ENVIRONMENT_TARGET_IGNORED`,message:`Using remote ${a}. Ignoring ${s(r)}.`}),l(await o(),a)}if(n.Ut(d)){if(n.Ut(f)||n.Ut(p))throw new r.t({code:`CONFLICTING_TARGET`,exitCode:r.n.USAGE,message:`${i.t.REMOTE} cannot be combined with ${i.t.API_URL} or ${i.t.API_KEY}.`,hint:`Unset one of them, or choose with --remote.`});return l(await o(),d)}if(n.Ut(f)!==n.Ut(p)){let e=n.Ut(f)?i.t.API_KEY:i.t.API_URL;throw new r.t({code:`INCOMPLETE_TARGET`,exitCode:r.n.USAGE,message:`${e} is not set.`,hint:`Set both ${i.t.API_URL} and ${i.t.API_KEY}, or neither.`})}if(n.Ut(f)&&n.Ut(p))return{source:`environment`,apiUrl:f,apiKey:p};let m=await o();if(n.Ut(m.defaultRemote))return l(m,m.defaultRemote);throw new r.t({code:`TARGET_REQUIRED`,exitCode:r.n.USAGE,message:`No workspace selected.`,hint:`Sign in with: twenty auth login --url <url>. Or set ${i.t.API_URL} and ${i.t.API_KEY}.`})};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
@@ -1 +1 @@
1
- const e=require("./constants-CemcuPi_-D7dbw2cv.cjs"),t=require("./cli-error-CSsayo0u.cjs"),n=require("./parse-api-url-CEfjRyid.cjs"),r=require("./confirm-in-terminal-BxEM5lxE.cjs"),i=require("./read-config-DdtXhdPp.cjs"),a=require("./get-credential-kind-JI9heHe2.cjs"),o=require("./sign-in-with-browser-Ck4tOxtA.cjs"),s=require("./update-config-FzOzO3wZ.cjs"),c=require("./fetch-signed-in-identity-b_LbRuL-.cjs");var l=(r,i,o)=>{let s=Object.hasOwn(r.remotes,o)?r.remotes[o]:void 0;if(!e.Vt(s)||a.t(s)!==`oauth`||s.twentyCLIAccessToken!==i.bearerToken||n.t({rawUrl:s.apiUrl,sourceName:o})!==i.apiUrl)throw new t.t({code:`CONFLICT`,exitCode:t.n.CONFLICT,message:`Remote ${o} changed while signing in again. No credentials were saved.`,hint:`Run the command again.`});return s},u=async({target:e,remoteName:t,error:n,configPath:a,output:u,signal:d})=>{if(l(await i.t(a),e,t),!await r.t({question:`Your session on ${t} is no longer valid. Sign in again now?`,signal:d}))throw n;let f=await o.t({apiUrl:e.apiUrl,output:u,signal:d}),p={...e,bearerToken:f.accessToken};return await c.t({target:p,signal:d}),await s.t({configPath:a,signal:d,update:n=>{let r=l(n,e,t);return{result:void 0,config:{...n,remotes:{...n.remotes,[t]:o.n({remote:r,credentials:{kind:`oauth`,...f}})}}}}}),p};exports.signInToRemoteAgain=u;
1
+ const e=require("./constants-D-caeNc5-9rDzSg5B.cjs"),t=require("./cli-error-CSsayo0u.cjs"),n=require("./parse-api-url-CFCz3xUA.cjs"),r=require("./confirm-in-terminal-BxEM5lxE.cjs"),i=require("./read-config-Qwl4pAO8.cjs"),a=require("./get-credential-kind-JI9heHe2.cjs"),o=require("./sign-in-with-browser-BUvT_awm.cjs"),s=require("./update-config-CnB7lDVC.cjs"),c=require("./fetch-signed-in-identity-B49Tf79K.cjs");var l=(r,i,o)=>{let s=Object.hasOwn(r.remotes,o)?r.remotes[o]:void 0;if(!e.Ut(s)||a.t(s)!==`oauth`||s.twentyCLIAccessToken!==i.bearerToken||n.t({rawUrl:s.apiUrl,sourceName:o})!==i.apiUrl)throw new t.t({code:`CONFLICT`,exitCode:t.n.CONFLICT,message:`Remote ${o} changed while signing in again. No credentials were saved.`,hint:`Run the command again.`});return s},u=async({target:e,remoteName:t,error:n,configPath:a,output:u,signal:d})=>{if(l(await i.t(a),e,t),!await r.t({question:`Your session on ${t} is no longer valid. Sign in again now?`,signal:d}))throw n;let f=await o.t({apiUrl:e.apiUrl,output:u,signal:d}),p={...e,bearerToken:f.accessToken};return await c.t({target:p,signal:d}),await s.t({configPath:a,signal:d,update:n=>{let r=l(n,e,t);return{result:void 0,config:{...n,remotes:{...n.remotes,[t]:o.n({remote:r,credentials:{kind:`oauth`,...f}})}}}}}),p};exports.signInToRemoteAgain=u;
@@ -1 +1 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CemcuPi_-D7dbw2cv.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./oauth-timing.constant-BClMQcKn.cjs"),i=require("./request-oauth-tokens-BY5ew3aM.cjs"),a=require("./open-browser-LPuVspT7.cjs");let o=require("node:http"),s=require("node:crypto");var c=({remote:e,credentials:n})=>{let{apiKey:r,twentyCLIAccessToken:i,twentyCLIRefreshToken:a,twentyCLIRegistrationClientId:o,...s}=e;return{...s,...n.kind===`apiKey`?{apiKey:n.apiKey}:{twentyCLIAccessToken:n.accessToken,twentyCLIRegistrationClientId:n.clientId,...t.Vt(n.refreshToken)?{twentyCLIRefreshToken:n.refreshToken}:{}}}},l=()=>{let e=(0,s.randomBytes)(32).toString(`base64url`);return{codeVerifier:e,codeChallenge:(0,s.createHash)(`sha256`).update(e).digest(`base64url`)}},u=e.t(),d=e=>{let n=e.address();if(!t.Vt(n)||(0,u.isString)(n))throw Error(`The server is not listening on a TCP port.`);return n.port},f=`/callback`,p=e=>`<!doctype html><meta charset="utf-8"><title>Twenty CLI</title><body style="margin:0;display:grid;place-items:center;min-height:100vh;font-family:system-ui,sans-serif"><p>${e}</p></body>`,m=e=>new n.t({code:`OAUTH_FAILED`,message:e,hint:`Run twenty auth login again.`}),h=({url:e,state:n,issuer:r,isIssuerInResponse:i})=>{let a=e.searchParams.get(`iss`);if(i&&!t.Vt(a))throw m(`The sign-in response does not say which server sent it.`);if(t.Vt(a)&&a!==r)throw m(`The sign-in response came from ${a} instead of ${r}.`);if(e.searchParams.get(`state`)!==n)throw m(`The sign-in response does not match this login attempt.`);let o=e.searchParams.get(`error`);if((0,u.isNonEmptyString)(o))throw m(o===`access_denied`?`Sign-in was declined in the browser.`:`Sign-in failed: ${e.searchParams.get(`error_description`)??o}`);let s=e.searchParams.get(`code`);if(!(0,u.isNonEmptyString)(s))throw m(`The sign-in response has no authorization code.`);return s},g=async({state:e,issuer:t,isIssuerInResponse:i,signal:a})=>{let{promise:s,resolve:c,reject:l}=Promise.withResolvers();s.catch(()=>void 0);let u=(0,o.createServer)((n,r)=>{let a=new URL(n.url??`/`,`http://127.0.0.1`);if(a.pathname!==f){r.writeHead(404,{Connection:`close`}).end();return}try{let n=h({url:a,state:e,issuer:t,isIssuerInResponse:i});r.writeHead(200,{"Content-Type":`text/html; charset=utf-8`,Connection:`close`}).end(p(`Signed in. You can close this tab and go back to the terminal.`)),c(n)}catch(e){r.writeHead(400,{"Content-Type":`text/html; charset=utf-8`,Connection:`close`}).end(p(`Sign-in did not complete. Go back to the terminal for details.`)),l(e)}});await new Promise((e,t)=>{u.once(`error`,t),u.listen(0,`127.0.0.1`,()=>e())});let m=d(u),g=setTimeout(()=>l(new n.t({code:`TIMEOUT`,message:`Sign-in was not completed within ${r.t.SIGN_IN_TIMEOUT_MILLISECONDS/6e4} minutes.`,hint:`Run twenty auth login again.`})),r.t.SIGN_IN_TIMEOUT_MILLISECONDS),_=()=>l(a.reason),v=()=>{clearTimeout(g),a.removeEventListener(`abort`,_),u.closeAllConnections(),u.close()};return a.aborted&&(v(),a.throwIfAborted()),a.addEventListener(`abort`,_,{once:!0}),{redirectUri:`http://127.0.0.1:${m}${f}`,waitForCode:()=>s,close:v}},_=async({apiUrl:e,output:t,signal:n})=>{let r=await i.n({apiUrl:e,signal:n}),{codeVerifier:o,codeChallenge:c}=l(),u=(0,s.randomBytes)(16).toString(`base64url`),d=await g({state:u,issuer:r.issuer,isIssuerInResponse:r.isIssuerInResponse,signal:n});try{let s=new URL(r.authorizationEndpoint);s.searchParams.set(`response_type`,`code`),s.searchParams.set(`client_id`,r.clientId),s.searchParams.set(`code_challenge`,c),s.searchParams.set(`code_challenge_method`,`S256`),s.searchParams.set(`redirect_uri`,d.redirectUri),s.searchParams.set(`state`,u),t.progress({message:`Opening your browser to sign in to ${new URL(e).host}…`}),a.t(s.href),t.progress({message:`If nothing opens, visit: ${s.href}`}),t.progress({message:`Waiting for you to approve in the browser. Press Ctrl+C to cancel.`});let l=await d.waitForCode();return{...await i.t({apiUrl:e,tokenEndpoint:r.tokenEndpoint,parameters:{grant_type:`authorization_code`,code:l,code_verifier:o,redirect_uri:d.redirectUri,client_id:r.clientId},signal:n}),clientId:r.clientId}}finally{d.close()}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./oauth-timing.constant-BClMQcKn.cjs"),i=require("./request-oauth-tokens-QdDt7j8i.cjs"),a=require("./open-browser-LPuVspT7.cjs");let o=require("node:http"),s=require("node:crypto");var c=({remote:e,credentials:n})=>{let{apiKey:r,twentyCLIAccessToken:i,twentyCLIRefreshToken:a,twentyCLIRegistrationClientId:o,...s}=e;return{...s,...n.kind===`apiKey`?{apiKey:n.apiKey}:{twentyCLIAccessToken:n.accessToken,twentyCLIRegistrationClientId:n.clientId,...t.Ut(n.refreshToken)?{twentyCLIRefreshToken:n.refreshToken}:{}}}},l=()=>{let e=(0,s.randomBytes)(32).toString(`base64url`);return{codeVerifier:e,codeChallenge:(0,s.createHash)(`sha256`).update(e).digest(`base64url`)}},u=e.t(),d=e=>{let n=e.address();if(!t.Ut(n)||(0,u.isString)(n))throw Error(`The server is not listening on a TCP port.`);return n.port},f=`/callback`,p=e=>`<!doctype html><meta charset="utf-8"><title>Twenty CLI</title><body style="margin:0;display:grid;place-items:center;min-height:100vh;font-family:system-ui,sans-serif"><p>${e}</p></body>`,m=e=>new n.t({code:`OAUTH_FAILED`,message:e,hint:`Run twenty auth login again.`}),h=({url:e,state:n,issuer:r,isIssuerInResponse:i})=>{let a=e.searchParams.get(`iss`);if(i&&!t.Ut(a))throw m(`The sign-in response does not say which server sent it.`);if(t.Ut(a)&&a!==r)throw m(`The sign-in response came from ${a} instead of ${r}.`);if(e.searchParams.get(`state`)!==n)throw m(`The sign-in response does not match this login attempt.`);let o=e.searchParams.get(`error`);if((0,u.isNonEmptyString)(o))throw m(o===`access_denied`?`Sign-in was declined in the browser.`:`Sign-in failed: ${e.searchParams.get(`error_description`)??o}`);let s=e.searchParams.get(`code`);if(!(0,u.isNonEmptyString)(s))throw m(`The sign-in response has no authorization code.`);return s},g=async({state:e,issuer:t,isIssuerInResponse:i,signal:a})=>{let{promise:s,resolve:c,reject:l}=Promise.withResolvers();s.catch(()=>void 0);let u=(0,o.createServer)((n,r)=>{let a=new URL(n.url??`/`,`http://127.0.0.1`);if(a.pathname!==f){r.writeHead(404,{Connection:`close`}).end();return}try{let n=h({url:a,state:e,issuer:t,isIssuerInResponse:i});r.writeHead(200,{"Content-Type":`text/html; charset=utf-8`,Connection:`close`}).end(p(`Signed in. You can close this tab and go back to the terminal.`)),c(n)}catch(e){r.writeHead(400,{"Content-Type":`text/html; charset=utf-8`,Connection:`close`}).end(p(`Sign-in did not complete. Go back to the terminal for details.`)),l(e)}});await new Promise((e,t)=>{u.once(`error`,t),u.listen(0,`127.0.0.1`,()=>e())});let m=d(u),g=setTimeout(()=>l(new n.t({code:`TIMEOUT`,message:`Sign-in was not completed within ${r.t.SIGN_IN_TIMEOUT_MILLISECONDS/6e4} minutes.`,hint:`Run twenty auth login again.`})),r.t.SIGN_IN_TIMEOUT_MILLISECONDS),_=()=>l(a.reason),v=()=>{clearTimeout(g),a.removeEventListener(`abort`,_),u.closeAllConnections(),u.close()};return a.aborted&&(v(),a.throwIfAborted()),a.addEventListener(`abort`,_,{once:!0}),{redirectUri:`http://127.0.0.1:${m}${f}`,waitForCode:()=>s,close:v}},_=async({apiUrl:e,output:t,signal:n})=>{let r=await i.n({apiUrl:e,signal:n}),{codeVerifier:o,codeChallenge:c}=l(),u=(0,s.randomBytes)(16).toString(`base64url`),d=await g({state:u,issuer:r.issuer,isIssuerInResponse:r.isIssuerInResponse,signal:n});try{let s=new URL(r.authorizationEndpoint);s.searchParams.set(`response_type`,`code`),s.searchParams.set(`client_id`,r.clientId),s.searchParams.set(`code_challenge`,c),s.searchParams.set(`code_challenge_method`,`S256`),s.searchParams.set(`redirect_uri`,d.redirectUri),s.searchParams.set(`state`,u),t.progress({message:`Opening your browser to sign in to ${new URL(e).host}…`}),a.t(s.href),t.progress({message:`If nothing opens, visit: ${s.href}`}),t.progress({message:`Waiting for you to approve in the browser. Press Ctrl+C to cancel.`});let l=await d.waitForCode();return{...await i.t({apiUrl:e,tokenEndpoint:r.tokenEndpoint,parameters:{grant_type:`authorization_code`,code:l,code_verifier:o,redirect_uri:d.redirectUri,client_id:r.clientId},signal:n}),clientId:r.clientId}}finally{d.close()}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
@@ -0,0 +1 @@
1
+ const e=require("./constants-D-caeNc5-9rDzSg5B.cjs");var t=({apiUrl:t,source:n,remoteName:r})=>({...e.Ut(r)?{remote:r}:{},apiUrl:t,source:n});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1,2 +1,2 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CemcuPi_-D7dbw2cv.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./target-environment-variable.constant-D7z8AihP.cjs"),i=require("./create-cancelled-error-DgrNfOv2.cjs"),a=require("./style-BR52fK4V.cjs");let o=require("node:path"),s=require("node:fs"),c=require("node:child_process");var l=({severity:e,code:n,message:r,file:i,line:o,column:s})=>{let c=[t.Vt(i)?[i,o,s].filter(t.Vt).join(`:`):void 0,a.i(n,process.stderr),r].filter(t.Vt).join(` `);return e===`error`?a.a(c):a.s(c)},u=e.t(),d=e=>!t.Vt(e)||(0,u.isString)(e),f=e=>!t.Vt(e)||(0,u.isNumber)(e),p=e=>t.p(e)&&(e.severity===`error`||e.severity===`warning`)&&(0,u.isString)(e.code)&&(0,u.isString)(e.message)&&d(e.file)&&f(e.line)&&f(e.column),m=e=>t.p(e)&&(0,u.isString)(e.path)&&(0,u.isString)(e.role)&&(0,u.isString)(e.sourcePath)&&(0,u.isNumber)(e.size)&&(0,u.isString)(e.sha256),h=()=>new n.t({code:`WORKER_FAILED`,message:`The app worker returned a result this CLI cannot read.`,hint:`Check that the app and the CLI use compatible versions.`}),g=e=>{if(!(!t.p(e)||!(0,u.isString)(e.buildId)||!d(e.directory)||!(0,u.isString)(e.contentHash)||!t.p(e.application)||!(0,u.isString)(e.application.universalIdentifier)||!(0,u.isString)(e.application.name)||!(0,u.isString)(e.application.displayName)||!(0,u.isString)(e.manifestFormat)||!t.p(e.manifest)||!(0,u.isArray)(e.files)||!e.files.every(m)))return{data:{buildId:e.buildId,...(0,u.isString)(e.directory)?{directory:e.directory}:{},contentHash:e.contentHash,application:{universalIdentifier:e.application.universalIdentifier,name:e.application.name,displayName:e.application.displayName},manifestFormat:e.manifestFormat,manifest:e.manifest,files:e.files}}},_=e=>(0,u.isNull)(e)?{data:null}:void 0,v=({value:e,parseData:n})=>{if(!t.p(e)||!(0,u.isArray)(e.diagnostics)||!e.diagnostics.every(p))throw h();let r=e.diagnostics;if(e.success===!0){let i=n(e.data);if(!t.Vt(i))throw h();return{success:!0,data:i.data,diagnostics:r}}if(e.success===!1&&t.p(e.error)&&(0,u.isString)(e.error.code)&&(0,u.isString)(e.error.message))return{success:!1,error:{code:e.error.code,message:e.error.message,...(0,u.isString)(e.error.hint)?{hint:e.error.hint}:{},...t.p(e.error.details)?{details:e.error.details}:{}},diagnostics:r};throw h()},y={CANCEL_GRACE_MILLISECONDS:3e3,OUTPUT_LIMIT_BYTES:64*1024},b=new Set([...Object.values(r.t),`TWENTY_APP_ACCESS_TOKEN`,`TWENTY_APP_APPLICATION_ACCESS_TOKEN`]),x=/^TWENTY_.*(TOKEN|KEY|SECRET|PASSWORD)$/,S=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!b.has(e)&&!x.test(e))),C=e=>{let t=Buffer.alloc(e),n=0,r=!1;return{add:i=>{let a=i.copy(t,n,0,e-n);n+=a,r||=a<i.length},read:()=>({text:t.toString(`utf8`,0,n),isTruncated:r})}},w=()=>({modulePath:(0,o.join)((0,o.dirname)((0,s.realpathSync)(process.argv[1]??``)),`app-worker.cjs`),execArgv:[]}),T=e=>t.p(e)&&(e.type===`result`&&`result`in e&&(e.isSnapshotHeld===!0||e.isSnapshotHeld===!1)||e.type===`released`&&`release`in e||e.type===`failure`&&(0,u.isString)(e.message)&&(!t.Vt(e.code)||(0,u.isString)(e.code))&&(!t.Vt(e.hint)||(0,u.isString)(e.hint))&&(!t.Vt(e.details)||t.p(e.details))),E=async({request:e,signal:r,useHeldSnapshot:a})=>{r.throwIfAborted();let{modulePath:o,execArgv:s}=w(),l=(0,c.fork)(o,[],{cwd:e.appPath,env:S(process.env),execArgv:s,serialization:`json`,stdio:[`ignore`,`pipe`,`pipe`,`ipc`]}),u=C(y.OUTPUT_LIMIT_BYTES),d=C(y.OUTPUT_LIMIT_BYTES);return l.stdout?.on(`data`,u.add),l.stderr?.on(`data`,d.add),new Promise((o,s)=>{let c,f,p,m,h,g=!1,_=()=>{let e=u.read(),t=d.read();return{stdout:e.text,stderr:t.text,isTruncated:e.isTruncated||t.isTruncated}},v=e=>{l.connected&&l.send(e),h=setTimeout(()=>l.kill(`SIGKILL`),y.CANCEL_GRACE_MILLISECONDS)},b=()=>v({type:`cancel`}),x=e=>{g||(g=!0,r.removeEventListener(`abort`,b),clearTimeout(h),e())},S=e=>{r.removeEventListener(`abort`,b),clearTimeout(h),m=(t.Vt(a)?a({result:e.result,watchInputs:e.watchInputs,output:_()}):Promise.resolve()).then(()=>({isSuccessful:!0}),e=>({isSuccessful:!1,error:e})).finally(()=>v({type:`release`}))},C=({exitCode:e,exitSignal:a,heldOutcome:l})=>x(()=>{let u=_();if(t.Vt(l)&&!l.isSuccessful){s(l.error);return}if(t.Vt(c)){o({result:c.result,watchInputs:c.watchInputs,release:c.isSnapshotHeld?p?.release:c.release,isSnapshotHeld:c.isSnapshotHeld,output:u});return}if(r.aborted){s(i.t());return}let d=t.Vt(a)?`signal ${a}`:`exit code ${e}`;s(new n.t({code:`WORKER_FAILED`,message:t.Vt(f)?`The app worker failed: ${f.message}`:`The app worker stopped before finishing (${d}). App code or a dependency may have exited the process.`,hint:f?.hint,details:{...f?.details,workerErrorCode:f?.code,exitCode:e,signal:a,output:u}}))});r.addEventListener(`abort`,b,{once:!0}),l.on(`message`,e=>{if(T(e)){if(e.type===`released`){p=e;return}if(e.type===`failure`){f=e;return}c=e,e.isSnapshotHeld&&S(e)}}),l.on(`error`,e=>x(()=>s(new n.t({code:`WORKER_FAILED`,message:`The app worker could not run: ${e.message}`})))),l.on(`close`,(e,n)=>{if(!t.Vt(m)){C({exitCode:e,exitSignal:n});return}m.then(t=>C({exitCode:e,exitSignal:n,heldOutcome:t})).catch(e=>x(()=>s(e)))}),l.send(e)})},D=e=>[[`stdout`,e.stdout],[`stderr`,e.stderr]].filter(([,e])=>(0,u.isNonEmptyString)(e.trim())).map(([t,n])=>({severity:`warning`,code:`PROJECT_OUTPUT`,message:`The app or twenty-sdk wrote to ${t}:\n${n.trimEnd()}${e.isTruncated?`
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./cli-error-CSsayo0u.cjs"),r=require("./target-environment-variable.constant-D7z8AihP.cjs"),i=require("./create-cancelled-error-DgrNfOv2.cjs"),a=require("./style-BR52fK4V.cjs");let o=require("node:path"),s=require("node:fs"),c=require("node:child_process");var l=({severity:e,code:n,message:r,file:i,line:o,column:s})=>{let c=[t.Ut(i)?[i,o,s].filter(t.Ut).join(`:`):void 0,a.i(n,process.stderr),r].filter(t.Ut).join(` `);return e===`error`?a.a(c):a.s(c)},u=e.t(),d=e=>!t.Ut(e)||(0,u.isString)(e),f=e=>!t.Ut(e)||(0,u.isNumber)(e),p=e=>t.u(e)&&(e.severity===`error`||e.severity===`warning`)&&(0,u.isString)(e.code)&&(0,u.isString)(e.message)&&d(e.file)&&f(e.line)&&f(e.column),m=e=>t.u(e)&&(0,u.isString)(e.path)&&(0,u.isString)(e.role)&&(0,u.isString)(e.sourcePath)&&(0,u.isNumber)(e.size)&&(0,u.isString)(e.sha256),h=()=>new n.t({code:`WORKER_FAILED`,message:`The app worker returned a result this CLI cannot read.`,hint:`Check that the app and the CLI use compatible versions.`}),g=e=>{if(!(!t.u(e)||!(0,u.isString)(e.buildId)||!d(e.directory)||!(0,u.isString)(e.contentHash)||!t.u(e.application)||!(0,u.isString)(e.application.universalIdentifier)||!(0,u.isString)(e.application.name)||!(0,u.isString)(e.application.displayName)||!(0,u.isString)(e.manifestFormat)||!t.u(e.manifest)||!(0,u.isArray)(e.files)||!e.files.every(m)))return{data:{buildId:e.buildId,...(0,u.isString)(e.directory)?{directory:e.directory}:{},contentHash:e.contentHash,application:{universalIdentifier:e.application.universalIdentifier,name:e.application.name,displayName:e.application.displayName},manifestFormat:e.manifestFormat,manifest:e.manifest,files:e.files}}},_=e=>(0,u.isNull)(e)?{data:null}:void 0,v=({value:e,parseData:n})=>{if(!t.u(e)||!(0,u.isArray)(e.diagnostics)||!e.diagnostics.every(p))throw h();let r=e.diagnostics;if(e.success===!0){let i=n(e.data);if(!t.Ut(i))throw h();return{success:!0,data:i.data,diagnostics:r}}if(e.success===!1&&t.u(e.error)&&(0,u.isString)(e.error.code)&&(0,u.isString)(e.error.message))return{success:!1,error:{code:e.error.code,message:e.error.message,...(0,u.isString)(e.error.hint)?{hint:e.error.hint}:{},...t.u(e.error.details)?{details:e.error.details}:{}},diagnostics:r};throw h()},y={CANCEL_GRACE_MILLISECONDS:3e3,OUTPUT_LIMIT_BYTES:64*1024},b=new Set([...Object.values(r.t),`TWENTY_APP_ACCESS_TOKEN`,`TWENTY_APP_APPLICATION_ACCESS_TOKEN`]),x=/^TWENTY_.*(TOKEN|KEY|SECRET|PASSWORD)$/,S=e=>Object.fromEntries(Object.entries(e).filter(([e])=>!b.has(e)&&!x.test(e))),C=e=>{let t=Buffer.alloc(e),n=0,r=!1;return{add:i=>{let a=i.copy(t,n,0,e-n);n+=a,r||=a<i.length},read:()=>({text:t.toString(`utf8`,0,n),isTruncated:r})}},w=()=>({modulePath:(0,o.join)((0,o.dirname)((0,s.realpathSync)(process.argv[1]??``)),`app-worker.cjs`),execArgv:[]}),T=e=>t.u(e)&&(e.type===`result`&&`result`in e&&(e.isSnapshotHeld===!0||e.isSnapshotHeld===!1)||e.type===`released`&&`release`in e||e.type===`failure`&&(0,u.isString)(e.message)&&(!t.Ut(e.code)||(0,u.isString)(e.code))&&(!t.Ut(e.hint)||(0,u.isString)(e.hint))&&(!t.Ut(e.details)||t.u(e.details))),E=async({request:e,signal:r,useHeldSnapshot:a})=>{r.throwIfAborted();let{modulePath:o,execArgv:s}=w(),l=(0,c.fork)(o,[],{cwd:e.appPath,env:S(process.env),execArgv:s,serialization:`json`,stdio:[`ignore`,`pipe`,`pipe`,`ipc`]}),u=C(y.OUTPUT_LIMIT_BYTES),d=C(y.OUTPUT_LIMIT_BYTES);return l.stdout?.on(`data`,u.add),l.stderr?.on(`data`,d.add),new Promise((o,s)=>{let c,f,p,m,h,g=!1,_=()=>{let e=u.read(),t=d.read();return{stdout:e.text,stderr:t.text,isTruncated:e.isTruncated||t.isTruncated}},v=e=>{l.connected&&l.send(e),h=setTimeout(()=>l.kill(`SIGKILL`),y.CANCEL_GRACE_MILLISECONDS)},b=()=>v({type:`cancel`}),x=e=>{g||(g=!0,r.removeEventListener(`abort`,b),clearTimeout(h),e())},S=e=>{r.removeEventListener(`abort`,b),clearTimeout(h),m=(t.Ut(a)?a({result:e.result,watchInputs:e.watchInputs,output:_()}):Promise.resolve()).then(()=>({isSuccessful:!0}),e=>({isSuccessful:!1,error:e})).finally(()=>v({type:`release`}))},C=({exitCode:e,exitSignal:a,heldOutcome:l})=>x(()=>{let u=_();if(t.Ut(l)&&!l.isSuccessful){s(l.error);return}if(t.Ut(c)){o({result:c.result,watchInputs:c.watchInputs,release:c.isSnapshotHeld?p?.release:c.release,isSnapshotHeld:c.isSnapshotHeld,output:u});return}if(r.aborted){s(i.t());return}let d=t.Ut(a)?`signal ${a}`:`exit code ${e}`;s(new n.t({code:`WORKER_FAILED`,message:t.Ut(f)?`The app worker failed: ${f.message}`:`The app worker stopped before finishing (${d}). App code or a dependency may have exited the process.`,hint:f?.hint,details:{...f?.details,workerErrorCode:f?.code,exitCode:e,signal:a,output:u}}))});r.addEventListener(`abort`,b,{once:!0}),l.on(`message`,e=>{if(T(e)){if(e.type===`released`){p=e;return}if(e.type===`failure`){f=e;return}c=e,e.isSnapshotHeld&&S(e)}}),l.on(`error`,e=>x(()=>s(new n.t({code:`WORKER_FAILED`,message:`The app worker could not run: ${e.message}`})))),l.on(`close`,(e,n)=>{if(!t.Ut(m)){C({exitCode:e,exitSignal:n});return}m.then(t=>C({exitCode:e,exitSignal:n,heldOutcome:t})).catch(e=>x(()=>s(e)))}),l.send(e)})},D=e=>[[`stdout`,e.stdout],[`stderr`,e.stderr]].filter(([,e])=>(0,u.isNonEmptyString)(e.trim())).map(([t,n])=>({severity:`warning`,code:`PROJECT_OUTPUT`,message:`The app or twenty-sdk wrote to ${t}:\n${n.trimEnd()}${e.isTruncated?`
2
2
  (output truncated)`:``}`}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
@@ -1,2 +1,2 @@
1
- const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-CemcuPi_-D7dbw2cv.cjs"),n=require("./validate-app-path-Dau-PC0a.cjs"),r=require("./collect-watch-inputs-CJVgCTo5.cjs"),i=require("./resolve-project-typescript-Cw2kvn6E.cjs"),a=require("./cli-error-CSsayo0u.cjs"),o=require("./get-tooling-error-context-C69TBSej.cjs");let s=require("node:path");var c=e.r({typecheckApplication:()=>d}),l=({diagnostic:e,appPath:n,typescript:r})=>{let i=t.Vt(e.file)&&t.Vt(e.start)?e.file.getLineAndCharacterOfPosition(e.start):void 0;return{severity:e.category===r.DiagnosticCategory.Warning?`warning`:`error`,code:`TS${e.code}`,message:r.flattenDiagnosticMessageText(e.messageText,`
2
- `),...t.Vt(e.file)?{file:(0,s.relative)(n,e.file.fileName)}:{},...t.Vt(i)?{line:i.line+1,column:i.character+1}:{}}},u=({appPath:e,typescript:n})=>{let i=(0,s.join)(e,`tsconfig.json`),a=(e,t)=>(r.r(e),n.sys.readFile(e,t)),o=n.readConfigFile(i,a);if(t.Vt(o.error))return[o.error];let c=n.parseJsonConfigFileContent(o.config,{...n.sys,readFile:a},e,{noEmit:!0},i);if(c.errors.length>0)return c.errors;let l=n.createCompilerHost(c.options),u=l.readFile;l.readFile=e=>(r.r(e),u(e));let d=l.fileExists;l.fileExists=e=>{let t=d(e);return t||r.i(e),t};let f=n.createProgram({host:l,rootNames:c.fileNames,options:c.options,projectReferences:c.projectReferences});return n.getPreEmitDiagnostics(f)},d=async({appPath:e,signal:t})=>{let r=await n.t(e);if(!r.success)return r;try{t?.throwIfAborted();let n=await i.t(e);t?.throwIfAborted();let r=u({appPath:e,typescript:n});t?.throwIfAborted();let a=r.map(t=>l({diagnostic:t,appPath:e,typescript:n}));return a.some(e=>e.severity===`error`)?{success:!1,error:{code:`TYPECHECK_FAILED`,message:`Typecheck failed.`},diagnostics:a}:{success:!0,data:null,diagnostics:a}}catch(e){return{success:!1,error:{code:t?.aborted?`CANCELLED`:e instanceof a.t?e.code:`TYPECHECK_FAILED`,message:e instanceof Error?e.message:String(e),...o.t(e)},diagnostics:[]}}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
1
+ const e=require("./build-CX6FBrbu.cjs"),t=require("./constants-D-caeNc5-9rDzSg5B.cjs"),n=require("./validate-app-path-Dau-PC0a.cjs"),r=require("./collect-watch-inputs-CS4oNP1F.cjs"),i=require("./resolve-project-typescript-vMtmufcP.cjs"),a=require("./cli-error-CSsayo0u.cjs"),o=require("./get-tooling-error-context-C69TBSej.cjs");let s=require("node:path");var c=e.r({typecheckApplication:()=>d}),l=({diagnostic:e,appPath:n,typescript:r})=>{let i=t.Ut(e.file)&&t.Ut(e.start)?e.file.getLineAndCharacterOfPosition(e.start):void 0;return{severity:e.category===r.DiagnosticCategory.Warning?`warning`:`error`,code:`TS${e.code}`,message:r.flattenDiagnosticMessageText(e.messageText,`
2
+ `),...t.Ut(e.file)?{file:(0,s.relative)(n,e.file.fileName)}:{},...t.Ut(i)?{line:i.line+1,column:i.character+1}:{}}},u=({appPath:e,typescript:n})=>{let i=(0,s.join)(e,`tsconfig.json`),a=(e,t)=>(r.r(e),n.sys.readFile(e,t)),o=n.readConfigFile(i,a);if(t.Ut(o.error))return[o.error];let c=n.parseJsonConfigFileContent(o.config,{...n.sys,readFile:a},e,{noEmit:!0},i);if(c.errors.length>0)return c.errors;let l=n.createCompilerHost(c.options),u=l.readFile;l.readFile=e=>(r.r(e),u(e));let d=l.fileExists;l.fileExists=e=>{let t=d(e);return t||r.i(e),t};let f=n.createProgram({host:l,rootNames:c.fileNames,options:c.options,projectReferences:c.projectReferences});return n.getPreEmitDiagnostics(f)},d=async({appPath:e,signal:t})=>{let r=await n.t(e);if(!r.success)return r;try{t?.throwIfAborted();let n=await i.t(e);t?.throwIfAborted();let r=u({appPath:e,typescript:n});t?.throwIfAborted();let a=r.map(t=>l({diagnostic:t,appPath:e,typescript:n}));return a.some(e=>e.severity===`error`)?{success:!1,error:{code:`TYPECHECK_FAILED`,message:`Typecheck failed.`},diagnostics:a}:{success:!0,data:null,diagnostics:a}}catch(e){return{success:!1,error:{code:t?.aborted?`CANCELLED`:e instanceof a.t?e.code:`TYPECHECK_FAILED`,message:e instanceof Error?e.message:String(e),...o.t(e)},diagnostics:[]}}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
@@ -1 +1 @@
1
- const e=require("./read-config-DdtXhdPp.cjs"),t=require("./write-config-atomically-C-YMKq3P.cjs");var n=({configPath:n,signal:r,update:i})=>t.n({configPath:n,signal:r,operation:async()=>{let{config:a,result:o}=i(await e.t(n));return r.throwIfAborted(),await t.t(n,a),o}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
1
+ const e=require("./read-config-Qwl4pAO8.cjs"),t=require("./write-config-atomically-DkRUfbw0.cjs");var n=({configPath:n,signal:r,update:i})=>t.n({configPath:n,signal:r,operation:async()=>{let{config:a,result:o}=i(await e.t(n));return r.throwIfAborted(),await t.t(n,a),o}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});