@gadgetinc/ggt 2.2.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +392 -307
- package/dist/action-CF6zatIh.js +64 -0
- package/dist/action-CF6zatIh.js.map +1 -0
- package/dist/action-CrDCeX3F.js +8 -0
- package/dist/action-CrDCeX3F.js.map +1 -0
- package/dist/add-Basu3Gyf.js +1 -0
- package/dist/agent-plugin-CqgwTOk-.js +15 -0
- package/dist/agent-plugin-CqgwTOk-.js.map +1 -0
- package/dist/agent-plugin-DU9G5B1d.js +9 -0
- package/dist/agent-plugin-DU9G5B1d.js.map +1 -0
- package/dist/assert-Bu1E126Z.js +2 -0
- package/dist/assert-Bu1E126Z.js.map +1 -0
- package/dist/chunk-BjEoQXZ0.js +1 -0
- package/dist/collection-C2TCeYqY.js +2 -0
- package/dist/collection-C2TCeYqY.js.map +1 -0
- package/dist/collection-aM0fpch0.js +1 -0
- package/dist/command-2iNTc5dV.js +118 -0
- package/dist/command-2iNTc5dV.js.map +1 -0
- package/dist/completion-D96nxD5n.js +37 -0
- package/dist/completion-D96nxD5n.js.map +1 -0
- package/dist/configure-C8ge-2cK.js +15 -0
- package/dist/configure-C8ge-2cK.js.map +1 -0
- package/dist/debugger-BkYgApKn.js +22 -0
- package/dist/debugger-BkYgApKn.js.map +1 -0
- package/dist/defaults-B_eD7Pia.js +2 -0
- package/dist/defaults-B_eD7Pia.js.map +1 -0
- package/dist/deploy-Da6P2HXS.js +15 -0
- package/dist/deploy-Da6P2HXS.js.map +1 -0
- package/dist/dev-DWMSNcLl.js +32 -0
- package/dist/dev-DWMSNcLl.js.map +1 -0
- package/dist/dev-lock-BFanZSu1.js +10 -0
- package/dist/dev-lock-BFanZSu1.js.map +1 -0
- package/dist/directory-CNL03L6c.js +9 -0
- package/dist/directory-CNL03L6c.js.map +1 -0
- package/dist/env-DoWNvHzW.js +62 -0
- package/dist/env-DoWNvHzW.js.map +1 -0
- package/dist/esm-B25i6Etq.js +12 -0
- package/dist/esm-B25i6Etq.js.map +1 -0
- package/dist/esm-CJocZrdd.js +2 -0
- package/dist/esm-CJocZrdd.js.map +1 -0
- package/dist/eval-BceZMSd5.js +27 -0
- package/dist/eval-BceZMSd5.js.map +1 -0
- package/dist/execAsync-DrhcEHLd.js +2 -0
- package/dist/execAsync-DrhcEHLd.js.map +1 -0
- package/dist/filesync-De6asZeR.js +61 -0
- package/dist/filesync-De6asZeR.js.map +1 -0
- package/dist/getMachineId-bsd-Cch8Z6pV.js +2 -0
- package/dist/getMachineId-bsd-Cch8Z6pV.js.map +1 -0
- package/dist/getMachineId-darwin-kbQWK54o.js +3 -0
- package/dist/getMachineId-darwin-kbQWK54o.js.map +1 -0
- package/dist/getMachineId-linux-DdIel6zr.js +2 -0
- package/dist/getMachineId-linux-DdIel6zr.js.map +1 -0
- package/dist/getMachineId-unsupported-Bvmsh30k.js +2 -0
- package/dist/getMachineId-unsupported-Bvmsh30k.js.map +1 -0
- package/dist/getMachineId-win-BteHZe8j.js +2 -0
- package/dist/getMachineId-win-BteHZe8j.js.map +1 -0
- package/dist/ggt-B3HQjQRM.js +3 -0
- package/dist/ggt-B3HQjQRM.js.map +1 -0
- package/dist/handler-DZyG8Sel.js +4 -0
- package/dist/handler-DZyG8Sel.js.map +1 -0
- package/dist/http-CY3lPMkt.js +320 -0
- package/dist/http-CY3lPMkt.js.map +1 -0
- package/dist/indent-string-BVm-4tyL.js +2 -0
- package/dist/indent-string-BVm-4tyL.js.map +1 -0
- package/dist/list-lQKWZ6ZI.js +10 -0
- package/dist/list-lQKWZ6ZI.js.map +1 -0
- package/dist/login-Ce0tByNd.js +1 -0
- package/dist/logout-_sTWeaiQ.js +5 -0
- package/dist/logout-_sTWeaiQ.js.map +1 -0
- package/dist/logs-DbhJzz4M.js +9 -0
- package/dist/logs-DbhJzz4M.js.map +1 -0
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -7
- package/dist/model-CBiMKY0P.js +11 -0
- package/dist/model-CBiMKY0P.js.map +1 -0
- package/dist/ms-B7sMc0pR.js +2 -0
- package/dist/ms-B7sMc0pR.js.map +1 -0
- package/dist/open-CSsA4B-l.js +38 -0
- package/dist/open-CSsA4B-l.js.map +1 -0
- package/dist/p-map-DE0acmRv.js +2 -0
- package/dist/p-map-DE0acmRv.js.map +1 -0
- package/dist/problems-BMLsmxd4.js +11 -0
- package/dist/problems-BMLsmxd4.js.map +1 -0
- package/dist/prompt-C9nwJW0G.js +2 -0
- package/dist/prompt-C9nwJW0G.js.map +1 -0
- package/dist/pull-DpizmJGk.js +12 -0
- package/dist/pull-DpizmJGk.js.map +1 -0
- package/dist/push-67KBCw6c.js +12 -0
- package/dist/push-67KBCw6c.js.map +1 -0
- package/dist/root-D_UnUsp7.js +28 -0
- package/dist/root-D_UnUsp7.js.map +1 -0
- package/dist/select-Dey_sjjd.js +4 -0
- package/dist/select-Dey_sjjd.js.map +1 -0
- package/dist/session-BmzGF1t7.js +2 -0
- package/dist/session-BmzGF1t7.js.map +1 -0
- package/dist/spinner-BVmbgIil.js +8 -0
- package/dist/spinner-BVmbgIil.js.map +1 -0
- package/dist/src-DxCC1MV4.js +6 -0
- package/dist/src-DxCC1MV4.js.map +1 -0
- package/dist/status-P_RFQ7J0.js +13 -0
- package/dist/status-P_RFQ7J0.js.map +1 -0
- package/dist/subscribeToEnvironmentLogs-CUicaiw_.js +2 -0
- package/dist/subscribeToEnvironmentLogs-CUicaiw_.js.map +1 -0
- package/dist/sync-json-V52OzeCz.js +112 -0
- package/dist/sync-json-V52OzeCz.js.map +1 -0
- package/dist/table-MrBbxMay.js +11 -0
- package/dist/table-MrBbxMay.js.map +1 -0
- package/dist/update-CfxiL08e.js +12 -0
- package/dist/update-CfxiL08e.js.map +1 -0
- package/dist/update-iyhnL9-M.js +1 -0
- package/dist/var-ByWcufFt.js +59 -0
- package/dist/var-ByWcufFt.js.map +1 -0
- package/dist/version-B_9GB4u3.js +9 -0
- package/dist/version-B_9GB4u3.js.map +1 -0
- package/dist/whoami-BNcXIfz7.js +5 -0
- package/dist/whoami-BNcXIfz7.js.map +1 -0
- package/package.json +19 -23
- package/assets/favicon-128@4x.png +0 -0
- package/dist/add-TWLGKL2T.js +0 -82
- package/dist/add-TWLGKL2T.js.map +0 -7
- package/dist/agent-plugin-TN24O7FB.js +0 -10
- package/dist/agent-plugin-TN24O7FB.js.map +0 -7
- package/dist/chunk-2742UPMB.js +0 -10
- package/dist/chunk-2742UPMB.js.map +0 -7
- package/dist/chunk-3OM5WM7E.js +0 -2
- package/dist/chunk-3OM5WM7E.js.map +0 -7
- package/dist/chunk-442CSROP.js +0 -66
- package/dist/chunk-442CSROP.js.map +0 -7
- package/dist/chunk-7DYQUG5M.js +0 -2
- package/dist/chunk-7DYQUG5M.js.map +0 -7
- package/dist/chunk-DR4CXBD6.js +0 -11
- package/dist/chunk-DR4CXBD6.js.map +0 -7
- package/dist/chunk-F255O64V.js +0 -2
- package/dist/chunk-F255O64V.js.map +0 -7
- package/dist/chunk-GFQYFEEH.js +0 -2
- package/dist/chunk-GFQYFEEH.js.map +0 -7
- package/dist/chunk-GJGBTM5Y.js +0 -2
- package/dist/chunk-GJGBTM5Y.js.map +0 -7
- package/dist/chunk-HCULGPBH.js +0 -2
- package/dist/chunk-HCULGPBH.js.map +0 -7
- package/dist/chunk-J232VCIM.js +0 -2
- package/dist/chunk-J232VCIM.js.map +0 -7
- package/dist/chunk-JG2QCDK2.js +0 -118
- package/dist/chunk-JG2QCDK2.js.map +0 -7
- package/dist/chunk-JKZNSRLU.js +0 -8
- package/dist/chunk-JKZNSRLU.js.map +0 -7
- package/dist/chunk-JYE5LLIF.js +0 -9
- package/dist/chunk-JYE5LLIF.js.map +0 -7
- package/dist/chunk-KKIL22RY.js +0 -2
- package/dist/chunk-KKIL22RY.js.map +0 -7
- package/dist/chunk-L2XBSR7G.js +0 -2
- package/dist/chunk-L2XBSR7G.js.map +0 -7
- package/dist/chunk-MW6MXMSN.js +0 -2
- package/dist/chunk-MW6MXMSN.js.map +0 -7
- package/dist/chunk-OUIZQC4D.js +0 -12
- package/dist/chunk-OUIZQC4D.js.map +0 -7
- package/dist/chunk-R6KJLEKY.js +0 -28
- package/dist/chunk-R6KJLEKY.js.map +0 -7
- package/dist/chunk-SIR6HLN3.js +0 -69
- package/dist/chunk-SIR6HLN3.js.map +0 -7
- package/dist/chunk-SVWK2NXG.js +0 -2
- package/dist/chunk-SVWK2NXG.js.map +0 -7
- package/dist/chunk-T6UHSWMT.js +0 -2
- package/dist/chunk-T6UHSWMT.js.map +0 -7
- package/dist/chunk-WB6O2V5D.js +0 -11
- package/dist/chunk-WB6O2V5D.js.map +0 -7
- package/dist/chunk-XC4F2TLW.js +0 -113
- package/dist/chunk-XC4F2TLW.js.map +0 -7
- package/dist/chunk-YFUOXDPK.js +0 -10
- package/dist/chunk-YFUOXDPK.js.map +0 -7
- package/dist/chunk-ZSREFZXV.js +0 -211
- package/dist/chunk-ZSREFZXV.js.map +0 -7
- package/dist/chunk-ZYDMXS5R.js +0 -6
- package/dist/chunk-ZYDMXS5R.js.map +0 -7
- package/dist/configure-UJS7V2JX.js +0 -12
- package/dist/configure-UJS7V2JX.js.map +0 -7
- package/dist/debugger-QN2MCLBL.js +0 -41
- package/dist/debugger-QN2MCLBL.js.map +0 -7
- package/dist/deploy-J74PHPQA.js +0 -25
- package/dist/deploy-J74PHPQA.js.map +0 -7
- package/dist/dev-GGUSOOYP.js +0 -59
- package/dist/dev-GGUSOOYP.js.map +0 -7
- package/dist/esm-D77XRR65.js +0 -38
- package/dist/esm-D77XRR65.js.map +0 -7
- package/dist/eval-L6WHUFLU.js +0 -54
- package/dist/eval-L6WHUFLU.js.map +0 -7
- package/dist/getMachineId-bsd-QUXN4NKS.js +0 -2
- package/dist/getMachineId-bsd-QUXN4NKS.js.map +0 -7
- package/dist/getMachineId-darwin-TCXBAX22.js +0 -3
- package/dist/getMachineId-darwin-TCXBAX22.js.map +0 -7
- package/dist/getMachineId-linux-IJ3LYIOX.js +0 -2
- package/dist/getMachineId-linux-IJ3LYIOX.js.map +0 -7
- package/dist/getMachineId-unsupported-IKXBUCYY.js +0 -2
- package/dist/getMachineId-unsupported-IKXBUCYY.js.map +0 -7
- package/dist/getMachineId-win-6CX7VSFF.js +0 -2
- package/dist/getMachineId-win-6CX7VSFF.js.map +0 -7
- package/dist/ggt-5XNRJZSW.js +0 -44
- package/dist/ggt-5XNRJZSW.js.map +0 -7
- package/dist/list-756D46N5.js +0 -11
- package/dist/list-756D46N5.js.map +0 -7
- package/dist/login-GMWQRH7V.js +0 -2
- package/dist/login-GMWQRH7V.js.map +0 -7
- package/dist/logout-LQABTJFD.js +0 -7
- package/dist/logout-LQABTJFD.js.map +0 -7
- package/dist/logs-AQZB272X.js +0 -28
- package/dist/logs-AQZB272X.js.map +0 -7
- package/dist/open-OMZWPQ66.js +0 -74
- package/dist/open-OMZWPQ66.js.map +0 -7
- package/dist/problems-FZJKH52E.js +0 -14
- package/dist/problems-FZJKH52E.js.map +0 -7
- package/dist/pull-XYCYN7QN.js +0 -28
- package/dist/pull-XYCYN7QN.js.map +0 -7
- package/dist/push-3QM7ZFTC.js +0 -2
- package/dist/push-3QM7ZFTC.js.map +0 -7
- package/dist/status-PWAXNK5G.js +0 -14
- package/dist/status-PWAXNK5G.js.map +0 -7
- package/dist/update-QIQFJFRQ.js +0 -2
- package/dist/update-QIQFJFRQ.js.map +0 -7
- package/dist/var-N4WGGJXZ.js +0 -159
- package/dist/var-N4WGGJXZ.js.map +0 -7
- package/dist/version-AJKSJJDC.js +0 -11
- package/dist/version-AJKSJJDC.js.map +0 -7
- package/dist/whoami-KJYDSQSD.js +0 -7
- package/dist/whoami-KJYDSQSD.js.map +0 -7
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t=1,n={}){let{indent:r=` `,includeEmptyLines:i=!1}=n;if(typeof e!=`string`)throw TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if(typeof t!=`number`)throw TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if(t<0)throw RangeError(`Expected \`count\` to be at least 0, got \`${t}\``);if(typeof r!=`string`)throw TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(t===0)return e;let a=i?/^/gm:/^(?!\s*$)/gm;return e.replace(a,r.repeat(t))}export{e as t};
|
|
2
|
+
//# sourceMappingURL=indent-string-BVm-4tyL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indent-string-BVm-4tyL.js","names":[],"sources":["../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js"],"sourcesContent":["export default function indentString(string, count = 1, options = {}) {\n\tconst {\n\t\tindent = ' ',\n\t\tincludeEmptyLines = false\n\t} = options;\n\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`input\\` to be a \\`string\\`, got \\`${typeof string}\\``\n\t\t);\n\t}\n\n\tif (typeof count !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`count\\` to be a \\`number\\`, got \\`${typeof count}\\``\n\t\t);\n\t}\n\n\tif (count < 0) {\n\t\tthrow new RangeError(\n\t\t\t`Expected \\`count\\` to be at least 0, got \\`${count}\\``\n\t\t);\n\t}\n\n\tif (typeof indent !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`options.indent\\` to be a \\`string\\`, got \\`${typeof indent}\\``\n\t\t);\n\t}\n\n\tif (count === 0) {\n\t\treturn string;\n\t}\n\n\tconst regex = includeEmptyLines ? /^/gm : /^(?!\\s*$)/gm;\n\n\treturn string.replace(regex, indent.repeat(count));\n}\n"],"x_google_ignoreList":[0],"mappings":"AAAA,SAAwB,EAAa,EAAQ,EAAQ,EAAG,EAAU,EAAE,CAAE,CACrE,GAAM,CACL,SAAS,IACT,oBAAoB,IACjB,EAEJ,GAAI,OAAO,GAAW,SACrB,MAAU,UACT,gDAAgD,OAAO,EAAO,IAC9D,CAGF,GAAI,OAAO,GAAU,SACpB,MAAU,UACT,gDAAgD,OAAO,EAAM,IAC7D,CAGF,GAAI,EAAQ,EACX,MAAU,WACT,8CAA8C,EAAM,IACpD,CAGF,GAAI,OAAO,GAAW,SACrB,MAAU,UACT,yDAAyD,OAAO,EAAO,IACvE,CAGF,GAAI,IAAU,EACb,OAAO,EAGR,IAAM,EAAQ,EAAoB,MAAQ,cAE1C,OAAO,EAAO,QAAQ,EAAO,EAAO,OAAO,EAAM,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import"./ms-B7sMc0pR.js";import"./prompt-C9nwJW0G.js";import{f as e,h as t,l as n}from"./http-CY3lPMkt.js";import{D as r,E as i,c as a,l as o,n as s,s as c}from"./command-2iNTc5dV.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{t as l}from"./table-MrBbxMay.js";var u=s({name:`list`,description:`List your Gadget apps`,details:i`
|
|
2
|
+
Fetches all apps accessible to the authenticated user. In interactive mode,
|
|
3
|
+
apps are grouped by team and displayed as a table. In non-interactive mode,
|
|
4
|
+
outputs tab-separated slug and domain pairs suitable for scripting.
|
|
5
|
+
`,examples:[`ggt list`,`ggt list --json`],run:async i=>{await t(i,`list`);let s=await n(i);if(s.length===0){a`
|
|
6
|
+
It doesn't look like you have any applications.
|
|
7
|
+
|
|
8
|
+
Visit https://gadget.new to create one!
|
|
9
|
+
`;return}if(o.isInteractive)for(let[t,n]of e(s))a(c.subdued(t)),l({json:n,headers:[`Name`,`Domain`],rows:n.map(e=>[e.slug,e.primaryDomain])}),a(``);else{let e=``;for(let t of s)e+=r`${t.slug}\t${t.primaryDomain}`;a({json:s,content:e})}}});export{u as default};
|
|
10
|
+
//# sourceMappingURL=list-lQKWZ6ZI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-lQKWZ6ZI.js","names":["colors"],"sources":["../src/commands/list.ts"],"sourcesContent":["import { getApplications, groupByTeam } from \"../services/app/app.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport colors from \"../services/output/colors.ts\";\nimport { output } from \"../services/output/output.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { sprint, sprintln } from \"../services/output/sprint.ts\";\nimport { printTable } from \"../services/output/table.ts\";\nimport { getUserOrLogin } from \"../services/user/user.ts\";\n\nexport default defineCommand({\n name: \"list\",\n description: \"List your Gadget apps\",\n details: sprint`\n Fetches all apps accessible to the authenticated user. In interactive mode,\n apps are grouped by team and displayed as a table. In non-interactive mode,\n outputs tab-separated slug and domain pairs suitable for scripting.\n `,\n examples: [\"ggt list\", \"ggt list --json\"],\n run: async (ctx) => {\n await getUserOrLogin(ctx, \"list\");\n\n const availableApps = await getApplications(ctx);\n if (availableApps.length === 0) {\n println`\n It doesn't look like you have any applications.\n\n Visit https://gadget.new to create one!\n `;\n return;\n }\n\n if (output.isInteractive) {\n for (const [teamName, apps] of groupByTeam(availableApps)) {\n println(colors.subdued(teamName));\n printTable({\n json: apps,\n headers: [\"Name\", \"Domain\"],\n rows: apps.map((app) => [app.slug, app.primaryDomain]),\n });\n println(\"\");\n }\n } else {\n let simpleOutput = \"\";\n for (const app of availableApps) {\n simpleOutput += sprintln`${app.slug}\\t${app.primaryDomain}`;\n }\n\n println({ json: availableApps, content: simpleOutput });\n }\n },\n});\n"],"mappings":"+TASA,IAAA,EAAe,EAAc,CAC3B,KAAM,OACN,YAAa,wBACb,QAAS,CAAM;;;;IAKf,SAAU,CAAC,WAAY,kBAAkB,CACzC,IAAK,KAAO,IAAQ,CAClB,MAAM,EAAe,EAAK,OAAO,CAEjC,IAAM,EAAgB,MAAM,EAAgB,EAAI,CAChD,GAAI,EAAc,SAAW,EAAG,CAC9B,CAAO;;;;MAKP,OAGF,GAAI,EAAO,cACT,IAAK,GAAM,CAAC,EAAU,KAAS,EAAY,EAAc,CACvD,EAAQA,EAAO,QAAQ,EAAS,CAAC,CACjC,EAAW,CACT,KAAM,EACN,QAAS,CAAC,OAAQ,SAAS,CAC3B,KAAM,EAAK,IAAK,GAAQ,CAAC,EAAI,KAAM,EAAI,cAAc,CAAC,CACvD,CAAC,CACF,EAAQ,GAAG,KAER,CACL,IAAI,EAAe,GACnB,IAAK,IAAM,KAAO,EAChB,GAAgB,CAAQ,GAAG,EAAI,KAAK,IAAI,EAAI,gBAG9C,EAAQ,CAAE,KAAM,EAAe,QAAS,EAAc,CAAC,GAG5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./ms-B7sMc0pR.js";import"./prompt-C9nwJW0G.js";import{w as e}from"./http-CY3lPMkt.js";import"./command-2iNTc5dV.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";export{e as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{E as e,c as t,n}from"./command-2iNTc5dV.js";import"./directory-CNL03L6c.js";import{r,t as i}from"./session-BmzGF1t7.js";var a=n({name:`logout`,description:`Log out of Gadget`,details:e`
|
|
2
|
+
Clears the locally stored session token. Has no effect if you are not
|
|
3
|
+
currently logged in.
|
|
4
|
+
`,examples:[`ggt logout`],run:e=>{i(e)?(r(e,void 0),t(`Goodbye`)):t(`You are not logged in`)}});export{a as default};
|
|
5
|
+
//# sourceMappingURL=logout-_sTWeaiQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout-_sTWeaiQ.js","names":[],"sources":["../src/commands/logout.ts"],"sourcesContent":["import { defineCommand } from \"../services/command/command.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\nimport { readSession, writeSession } from \"../services/user/session.ts\";\n\nexport default defineCommand({\n name: \"logout\",\n description: \"Log out of Gadget\",\n details: sprint`\n Clears the locally stored session token. Has no effect if you are not\n currently logged in.\n `,\n examples: [\"ggt logout\"],\n run: (ctx) => {\n const token = readSession(ctx);\n if (token) {\n writeSession(ctx, undefined);\n println(\"Goodbye\");\n } else {\n println(\"You are not logged in\");\n }\n },\n});\n"],"mappings":"+HAKA,IAAA,EAAe,EAAc,CAC3B,KAAM,SACN,YAAa,oBACb,QAAS,CAAM;;;IAIf,SAAU,CAAC,aAAa,CACxB,IAAM,GAAQ,CACE,EAAY,EAAI,EAE5B,EAAa,EAAK,IAAA,GAAU,CAC5B,EAAQ,UAAU,EAElB,EAAQ,wBAAwB,EAGrC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{o as e}from"./chunk-BjEoQXZ0.js";import{t}from"./ms-B7sMc0pR.js";import"./src-DxCC1MV4.js";import"./prompt-C9nwJW0G.js";import{i as n,j as r}from"./http-CY3lPMkt.js";import{E as i,n as a}from"./command-2iNTc5dV.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{a as o,i as s,r as c}from"./sync-json-V52OzeCz.js";import"./select-Dey_sjjd.js";import{t as l}from"./subscribeToEnvironmentLogs-CUicaiw_.js";var u=e(t(),1);const d=(0,u.default)(`3s`);var f=a({name:`logs`,aliases:[`log`],description:`Print recent logs or stream logs from your app`,details:i`
|
|
2
|
+
Prints recent logs and exits by default. Use ${`--follow`} (${`-f`}) to stream logs continuously.
|
|
3
|
+
`,examples:[`ggt logs`,`ggt logs --start 2025-01-01T00:00:00Z --log-level warn`,`ggt logs --follow --my-logs`,`ggt logs --env production --json`],flags:{...o,...n,"--follow":{type:Boolean,alias:[`-f`],default:!1,description:`Stream logs continuously`,details:`When omitted, prints recent logs and exits.`},"--start":{type:e=>{let t=new Date(e);if(isNaN(t.getTime()))throw new r(`Invalid date: "${e}". Use an ISO 8601 format like "2025-01-01T00:00:00Z".`);return t},description:`Start time for one-shot log queries`,valueName:`datetime`,details:`ISO 8601 timestamp. Defaults to 5 minutes ago.`}},run:async(e,t)=>{if(t._.length>0)throw new r(i`
|
|
4
|
+
"ggt logs" does not take any positional arguments.
|
|
5
|
+
|
|
6
|
+
If you are trying to print logs for an app in a specific directory,
|
|
7
|
+
you must "cd" to that directory and then run "ggt logs".
|
|
8
|
+
`);let n=await c(process.cwd()),a=await s.load(e,{command:`logs`,flags:t,directory:n});if(t[`--follow`]&&t[`--start`])throw new r(`--start cannot be used with --follow. --start is only for one-shot log queries.`);if(t[`--follow`]){let n=l(a.edit,t,{onError:t=>{e.abort(t)}});e.onAbort(t=>{e.log.info(`stopping`,{reason:t}),n.unsubscribe()});return}let o=t[`--start`]??new Date(Date.now()-(0,u.default)(`5m`)),f=Date.now();await new Promise((n,r)=>{let i=!1,s,c,u=()=>{c&&clearTimeout(c),c=setTimeout(()=>p(n),100)},p=e=>{i||(i=!0,c&&=(clearTimeout(c),void 0),s?.unsubscribe(),e())};s=l(a.edit,t,{mode:`one-shot`,start:o,limit:500,onError:e=>p(()=>r(e)),onBatch:e=>{e>=f?p(n):u()}}),c=setTimeout(()=>p(n),d),e.onAbort(e=>{p(()=>{e instanceof Error?r(e):r(Error(`Aborted`))})})})}});export{f as default};
|
|
9
|
+
//# sourceMappingURL=logs-DbhJzz4M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs-DbhJzz4M.js","names":[],"sources":["../src/commands/logs.ts"],"sourcesContent":["import ms from \"ms\";\n\nimport { AppIdentity, AppIdentityFlags } from \"../services/command/app-identity.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport { FlagError } from \"../services/command/flag.ts\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.ts\";\nimport { subscribeToEnvironmentLogs } from \"../services/logs/subscribeToEnvironmentLogs.ts\";\nimport { LoggingFlags } from \"../services/output/log/structured.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\n\nconst ONE_SHOT_INITIAL_TIMEOUT_MS = ms(\"3s\");\nconst ONE_SHOT_SILENCE_TIMEOUT_MS = 100;\n\nexport default defineCommand({\n name: \"logs\",\n aliases: [\"log\"],\n description: \"Print recent logs or stream logs from your app\",\n details: sprint`\n Prints recent logs and exits by default. Use ${\"--follow\"} (${\"-f\"}) to stream logs continuously.\n `,\n examples: [\n \"ggt logs\",\n \"ggt logs --start 2025-01-01T00:00:00Z --log-level warn\",\n \"ggt logs --follow --my-logs\",\n \"ggt logs --env production --json\",\n ],\n flags: {\n ...AppIdentityFlags,\n ...LoggingFlags,\n \"--follow\": {\n type: Boolean,\n alias: [\"-f\"],\n default: false,\n description: \"Stream logs continuously\",\n details: \"When omitted, prints recent logs and exits.\",\n },\n \"--start\": {\n type: (value: string): Date => {\n const date = new Date(value);\n if (isNaN(date.getTime())) {\n throw new FlagError(`Invalid date: \"${value}\". Use an ISO 8601 format like \"2025-01-01T00:00:00Z\".`);\n }\n return date;\n },\n description: \"Start time for one-shot log queries\",\n valueName: \"datetime\",\n details: \"ISO 8601 timestamp. Defaults to 5 minutes ago.\",\n },\n },\n run: async (ctx, flags) => {\n if (flags._.length > 0) {\n throw new FlagError(\n sprint`\n \"ggt logs\" does not take any positional arguments.\n\n If you are trying to print logs for an app in a specific directory,\n you must \"cd\" to that directory and then run \"ggt logs\".\n `,\n );\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"logs\", flags, directory });\n\n if (flags[\"--follow\"] && flags[\"--start\"]) {\n throw new FlagError(\"--start cannot be used with --follow. --start is only for one-shot log queries.\");\n }\n\n if (flags[\"--follow\"]) {\n const logsSubscription = subscribeToEnvironmentLogs(appIdentity.edit, flags, {\n onError: (error) => {\n ctx.abort(error);\n },\n });\n\n ctx.onAbort((reason) => {\n ctx.log.info(\"stopping\", { reason });\n logsSubscription.unsubscribe();\n });\n\n return;\n }\n\n const start = flags[\"--start\"] ?? new Date(Date.now() - ms(\"5m\"));\n const queryTime = Date.now();\n\n await new Promise<void>((resolve, reject) => {\n let settled = false;\n let logsSubscription: { unsubscribe(): void } | undefined;\n let noDataTimeout: ReturnType<typeof setTimeout> | undefined;\n\n const resetTimeout = (): void => {\n if (noDataTimeout) clearTimeout(noDataTimeout);\n noDataTimeout = setTimeout(() => finish(resolve), ONE_SHOT_SILENCE_TIMEOUT_MS);\n };\n\n const finish = (done: () => void): void => {\n if (settled) return;\n settled = true;\n if (noDataTimeout) {\n clearTimeout(noDataTimeout);\n noDataTimeout = undefined;\n }\n logsSubscription?.unsubscribe();\n done();\n };\n\n logsSubscription = subscribeToEnvironmentLogs(appIdentity.edit, flags, {\n mode: \"one-shot\",\n start,\n limit: 500,\n onError: (error) => finish(() => reject(error)),\n onBatch: (latestTimestampMs) => {\n if (latestTimestampMs >= queryTime) {\n // We've caught up to live — historical data is complete\n finish(resolve);\n } else {\n // More historical data may follow, reset with short silence timeout\n resetTimeout();\n }\n },\n });\n\n // Initial timeout is longer to allow for WebSocket connection setup\n noDataTimeout = setTimeout(() => finish(resolve), ONE_SHOT_INITIAL_TIMEOUT_MS);\n\n ctx.onAbort((reason) => {\n finish(() => {\n if (reason instanceof Error) reject(reason);\n else reject(new Error(\"Aborted\"));\n });\n });\n });\n },\n});\n"],"mappings":"geAUA,MAAM,GAAA,EAAA,EAAA,SAAiC,KAAK,CAG5C,IAAA,EAAe,EAAc,CAC3B,KAAM,OACN,QAAS,CAAC,MAAM,CAChB,YAAa,iDACb,QAAS,CAAM;mDACkC,WAAW,IAAI,KAAK;IAErE,SAAU,CACR,WACA,yDACA,8BACA,mCACD,CACD,MAAO,CACL,GAAG,EACH,GAAG,EACH,WAAY,CACV,KAAM,QACN,MAAO,CAAC,KAAK,CACb,QAAS,GACT,YAAa,2BACb,QAAS,8CACV,CACD,UAAW,CACT,KAAO,GAAwB,CAC7B,IAAM,EAAO,IAAI,KAAK,EAAM,CAC5B,GAAI,MAAM,EAAK,SAAS,CAAC,CACvB,MAAM,IAAI,EAAU,kBAAkB,EAAM,wDAAwD,CAEtG,OAAO,GAET,YAAa,sCACb,UAAW,WACX,QAAS,iDACV,CACF,CACD,IAAK,MAAO,EAAK,IAAU,CACzB,GAAI,EAAM,EAAE,OAAS,EACnB,MAAM,IAAI,EACR,CAAM;;;;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/bin/env node
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=main.js.map
|
|
2
|
+
process.setSourceMapsEnabled(!0),Number(process.versions.node.split(`.`)[0])<22&&(console.error(`ggt requires Node.js v22 or later, but you're running v${process.versions.node}.`),console.error(``),console.error(`To upgrade Node.js, pick whichever method you used to install it:`),console.error(``),console.error(` nvm: nvm install 22 && nvm use 22`),console.error(` fnm: fnm install 22 && fnm use 22`),console.error(` Homebrew: brew upgrade node`),console.error(` Installer: https://nodejs.org/en/download`),console.error(``),console.error(`After upgrading, run ggt again.`),process.exit(1));const{ggt:e}=await import(`./ggt-B3HQjQRM.js`);await e();export{};
|
|
3
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/main.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n\n// Enable source maps for better error stack traces\n// Must be called before importing any modules so all stack traces are mapped\nprocess.setSourceMapsEnabled(true);\n\nconst { ggt } = await import(\"./ggt.js\");\nawait ggt();\n"],
|
|
5
|
-
"mappings": ";wCAAAA,IAIA,QAAQ,qBAAqB,EAAI,EAEjC,GAAM,CAAE,IAAAC,CAAI,EAAI,KAAM,QAAO,mBAAU,EACvC,MAAMA,EAAI",
|
|
6
|
-
"names": ["init_cjs", "ggt"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"main.js","names":[],"sources":["../src/main.ts"],"sourcesContent":["process.setSourceMapsEnabled(true);\n\nconst major = Number(process.versions.node.split(\".\")[0]);\nif (major < 22) {\n console.error(`ggt requires Node.js v22 or later, but you're running v${process.versions.node}.`);\n console.error(\"\");\n console.error(\"To upgrade Node.js, pick whichever method you used to install it:\");\n console.error(\"\");\n console.error(\" nvm: nvm install 22 && nvm use 22\");\n console.error(\" fnm: fnm install 22 && fnm use 22\");\n console.error(\" Homebrew: brew upgrade node\");\n console.error(\" Installer: https://nodejs.org/en/download\");\n console.error(\"\");\n console.error(\"After upgrading, run ggt again.\");\n process.exit(1);\n}\n\nconst { ggt } = await import(\"./ggt.ts\");\nawait ggt();\n"],"mappings":";AAAA,QAAQ,qBAAqB,GAAK,CAEpB,OAAO,QAAQ,SAAS,KAAK,MAAM,IAAI,CAAC,GAAG,CAC7C,KACV,QAAQ,MAAM,0DAA0D,QAAQ,SAAS,KAAK,GAAG,CACjG,QAAQ,MAAM,GAAG,CACjB,QAAQ,MAAM,oEAAoE,CAClF,QAAQ,MAAM,GAAG,CACjB,QAAQ,MAAM,6CAA6C,CAC3D,QAAQ,MAAM,6CAA6C,CAC3D,QAAQ,MAAM,kCAAkC,CAChD,QAAQ,MAAM,+CAA+C,CAC7D,QAAQ,MAAM,GAAG,CACjB,QAAQ,MAAM,kCAAkC,CAChD,QAAQ,KAAK,EAAE,EAGjB,KAAM,CAAE,OAAQ,MAAM,OAAO,qBAC7B,MAAM,GAAK"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{o as e}from"./chunk-BjEoQXZ0.js";import"./ms-B7sMc0pR.js";import"./src-DxCC1MV4.js";import{r as t}from"./prompt-C9nwJW0G.js";import{g as n,gt as r,j as i}from"./http-CY3lPMkt.js";import{E as a,V as o,c as s,n as c,s as l}from"./command-2iNTc5dV.js";import"./filesync-De6asZeR.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{n as u}from"./sync-json-V52OzeCz.js";import"./select-Dey_sjjd.js";import"./spinner-BVmbgIil.js";import"./table-MrBbxMay.js";import{a as d,i as f,o as p}from"./action-CF6zatIh.js";import m from"node:path";var h=e(o(),1);const g=e=>`api/models/${e}`,_=async(e,t)=>{let n=e.directory.absolute(`api/models`),r=m.dirname(e.directory.absolute(g(t)));for(;r.startsWith(n)&&r!==n;){try{await h.default.rmdir(r)}catch{break}r=m.dirname(r)}},v=(e,t,n)=>{let r=`${g(t)}/`,i=`${g(n)}/`,a=e.get(r),o=e.get(i);!a||a.type!==`delete`||!o||o.type!==`create`||(e.set(i,{...o,oldPath:r}),e.delete(r))};var y=c({name:`model`,description:`Add and manage models in your app`,details:a`
|
|
2
|
+
Model commands sync local files with the environment before making schema
|
|
3
|
+
changes. Use add to scaffold models, remove for destructive deletion, and
|
|
4
|
+
rename to move a model path.
|
|
5
|
+
`,examples:[`ggt model add post`,`ggt model remove post --force`,`ggt model rename post article`],flags:u,subcommands:e=>({add:e({description:`Add a model to your app`,examples:[`ggt model add post`,`ggt model add blog/post`,`ggt model add post title:string body:string`],positionals:[{name:`name`,required:!0,description:`Model path`},{name:`field:type ...`,description:`Optional field definitions`}],run:async(e,n)=>{let{filesync:o,syncJson:c}=await f(e,`model`,n),u=n._[0],m=[];if(n._.length>1){let[e,t]=p(n._.slice(1));if(t.length>0)throw new i(a`
|
|
6
|
+
Failed to add model:
|
|
7
|
+
|
|
8
|
+
${t.map(e=>`• ${e}`).join(`
|
|
9
|
+
`)}
|
|
10
|
+
`,{usageHint:!1});m=e}await d(e,{syncJson:c,filesync:o,modelApiIdentifier:u,fields:m});let h=r.isSupported?r(u,`https://${c.environment.application.primaryDomain}/edit/${c.environment.name}/model/${u}/schema`):u;s({ensureEmptyLineAbove:!0,content:l.subdued(`New model created in environment.`)}),s({ensureEmptyLineAbove:!0,content:`${l.created(t.tick)} Model ${l.code(h)} added successfully.`})}}),remove:e({description:`Remove a model from your app`,examples:[`ggt model remove post`,`ggt model remove post --force`],positionals:[{name:`name`,required:!0,description:`Model path`}],flags:{"--force":{type:Boolean,alias:`-f`,description:`Skip confirmation`}},run:async(e,r)=>{let{filesync:a,syncJson:o}=await f(e,`model`,r),c=r._[0],u=g(c),d=o.directory.absolute(u);if(!await h.default.pathExists(d))throw new i(`${c} does not exist.`,{usageHint:!1});r[`--force`]||await n(`Delete ${c} and all of its data?`),await h.default.remove(d),await _(o,c);let p=await a.hashes(e,{silent:!0});await a.push(e,{command:`model`,hashes:p}),s({ensureEmptyLineAbove:!0,content:`${l.created(t.tick)} Removed ${l.code(c)}.`})}}),rename:e({description:`Rename a model`,examples:[`ggt model rename post article`,`ggt model rename blog/post blog/article`],positionals:[{name:`name`,required:!0,description:`Current model path`},{name:`new-name`,required:!0,description:`New model path`}],run:async(e,n)=>{let{filesync:r,syncJson:a}=await f(e,`model`,n),o=n._[0],c=n._[1];if(o===c)throw new i(`New model path must be different from the existing path.`,{usageHint:!1});let u=a.directory.absolute(g(o)),d=a.directory.absolute(g(c));if(!await h.default.pathExists(u))throw new i(`${o} does not exist.`,{usageHint:!1});if(await h.default.pathExists(d))throw new i(`${c} already exists.`,{usageHint:!1});await h.default.ensureDir(m.dirname(d)),await h.default.move(u,d),await _(a,o);let p=await r.hashes(e,{silent:!0});v(p.localChangesToPush,o,c),await r.push(e,{command:`model`,hashes:p}),s({ensureEmptyLineAbove:!0,content:`${l.created(t.tick)} Renamed ${l.code(o)} to ${l.code(c)}.`})}})})});export{y as default};
|
|
11
|
+
//# sourceMappingURL=model-CBiMKY0P.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-CBiMKY0P.js","names":["fs","colors"],"sources":["../src/commands/model.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport fs from \"fs-extra\";\nimport terminalLink from \"terminal-link\";\n\nimport { parseFieldValues } from \"../services/add/field.ts\";\nimport { addModel } from \"../services/add/model.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport { FlagError } from \"../services/command/flag.ts\";\nimport { setupCommandSync } from \"../services/filesync/setup-sync.ts\";\nimport { SyncJson, SyncJsonFlags } from \"../services/filesync/sync-json.ts\";\nimport colors from \"../services/output/colors.ts\";\nimport { confirm } from \"../services/output/confirm.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\nimport { symbol } from \"../services/output/symbols.ts\";\n\nconst modelPathToDirectory = (modelPath: string): string => `api/models/${modelPath}`;\n\nconst removeEmptyModelParentDirectories = async (syncJson: SyncJson, modelPath: string): Promise<void> => {\n const modelsRoot = syncJson.directory.absolute(\"api/models\");\n let current = path.dirname(syncJson.directory.absolute(modelPathToDirectory(modelPath)));\n\n while (current.startsWith(modelsRoot) && current !== modelsRoot) {\n try {\n await fs.rmdir(current);\n } catch {\n break;\n }\n\n current = path.dirname(current);\n }\n};\n\nconst markModelRenameChanges = (\n changes: Map<string, { type: string; oldPath?: string }>,\n oldModelPath: string,\n newModelPath: string,\n): void => {\n const oldDirectoryPath = `${modelPathToDirectory(oldModelPath)}/`;\n const newDirectoryPath = `${modelPathToDirectory(newModelPath)}/`;\n\n const oldChange = changes.get(oldDirectoryPath);\n const newChange = changes.get(newDirectoryPath);\n\n if (!oldChange || oldChange.type !== \"delete\" || !newChange || newChange.type !== \"create\") {\n return;\n }\n\n changes.set(newDirectoryPath, { ...newChange, oldPath: oldDirectoryPath });\n changes.delete(oldDirectoryPath);\n};\n\nexport default defineCommand({\n name: \"model\",\n description: \"Add and manage models in your app\",\n details: sprint`\n Model commands sync local files with the environment before making schema\n changes. Use add to scaffold models, remove for destructive deletion, and\n rename to move a model path.\n `,\n examples: [\"ggt model add post\", \"ggt model remove post --force\", \"ggt model rename post article\"],\n flags: SyncJsonFlags,\n subcommands: (sub) => ({\n add: sub({\n description: \"Add a model to your app\",\n examples: [\"ggt model add post\", \"ggt model add blog/post\", \"ggt model add post title:string body:string\"],\n positionals: [\n {\n name: \"name\",\n required: true,\n description: \"Model path\",\n },\n {\n name: \"field:type ...\",\n description: \"Optional field definitions\",\n },\n ],\n run: async (ctx, flags) => {\n const { filesync, syncJson } = await setupCommandSync(ctx, \"model\", flags);\n // oxlint-disable-next-line no-non-null-assertion -- framework validates required positional\n const modelApiIdentifier = flags._[0]!;\n\n let fields: { name: string; fieldType: string }[] = [];\n if (flags._.length > 1) {\n const [modelFields, problems] = parseFieldValues(flags._.slice(1));\n\n if (problems.length > 0) {\n throw new FlagError(\n sprint`\n Failed to add model:\n\n ${problems.map((p) => `• ${p}`).join(\"\\n\")}\n `,\n { usageHint: false },\n );\n }\n\n fields = modelFields;\n }\n\n await addModel(ctx, {\n syncJson,\n filesync,\n modelApiIdentifier,\n fields,\n });\n\n const modelPrintout = terminalLink.isSupported\n ? terminalLink(\n modelApiIdentifier,\n `https://${syncJson.environment.application.primaryDomain}/edit/${syncJson.environment.name}/model/${modelApiIdentifier}/schema`,\n )\n : modelApiIdentifier;\n\n println({ ensureEmptyLineAbove: true, content: colors.subdued(\"New model created in environment.\") });\n println({\n ensureEmptyLineAbove: true,\n content: `${colors.created(symbol.tick)} Model ${colors.code(modelPrintout)} added successfully.`,\n });\n },\n }),\n remove: sub({\n description: \"Remove a model from your app\",\n examples: [\"ggt model remove post\", \"ggt model remove post --force\"],\n positionals: [\n {\n name: \"name\",\n required: true,\n description: \"Model path\",\n },\n ],\n flags: {\n \"--force\": {\n type: Boolean,\n alias: \"-f\",\n description: \"Skip confirmation\",\n },\n },\n run: async (ctx, flags) => {\n const { filesync, syncJson } = await setupCommandSync(ctx, \"model\", flags);\n // oxlint-disable-next-line no-non-null-assertion -- framework validates required positional\n const modelPath = flags._[0]!;\n\n const relativeModelDirectory = modelPathToDirectory(modelPath);\n const modelDirectory = syncJson.directory.absolute(relativeModelDirectory);\n\n if (!(await fs.pathExists(modelDirectory))) {\n throw new FlagError(`${modelPath} does not exist.`, { usageHint: false });\n }\n\n if (!flags[\"--force\"]) {\n await confirm(`Delete ${modelPath} and all of its data?`);\n }\n\n await fs.remove(modelDirectory);\n await removeEmptyModelParentDirectories(syncJson, modelPath);\n\n const hashes = await filesync.hashes(ctx, { silent: true });\n await filesync.push(ctx, { command: \"model\", hashes });\n\n println({ ensureEmptyLineAbove: true, content: `${colors.created(symbol.tick)} Removed ${colors.code(modelPath)}.` });\n },\n }),\n rename: sub({\n description: \"Rename a model\",\n examples: [\"ggt model rename post article\", \"ggt model rename blog/post blog/article\"],\n positionals: [\n {\n name: \"name\",\n required: true,\n description: \"Current model path\",\n },\n {\n name: \"new-name\",\n required: true,\n description: \"New model path\",\n },\n ],\n run: async (ctx, flags) => {\n const { filesync, syncJson } = await setupCommandSync(ctx, \"model\", flags);\n // oxlint-disable-next-line no-non-null-assertion -- framework validates required positional\n const modelPath = flags._[0]!;\n // oxlint-disable-next-line no-non-null-assertion -- framework validates required positional\n const newModelPath = flags._[1]!;\n\n if (modelPath === newModelPath) {\n throw new FlagError(\"New model path must be different from the existing path.\", { usageHint: false });\n }\n\n const currentDirectory = syncJson.directory.absolute(modelPathToDirectory(modelPath));\n const nextDirectory = syncJson.directory.absolute(modelPathToDirectory(newModelPath));\n\n if (!(await fs.pathExists(currentDirectory))) {\n throw new FlagError(`${modelPath} does not exist.`, { usageHint: false });\n }\n\n if (await fs.pathExists(nextDirectory)) {\n throw new FlagError(`${newModelPath} already exists.`, { usageHint: false });\n }\n\n await fs.ensureDir(path.dirname(nextDirectory));\n await fs.move(currentDirectory, nextDirectory);\n await removeEmptyModelParentDirectories(syncJson, modelPath);\n\n const hashes = await filesync.hashes(ctx, { silent: true });\n markModelRenameChanges(hashes.localChangesToPush, modelPath, newModelPath);\n\n await filesync.push(ctx, { command: \"model\", hashes });\n\n println({\n ensureEmptyLineAbove: true,\n content: `${colors.created(symbol.tick)} Renamed ${colors.code(modelPath)} to ${colors.code(newModelPath)}.`,\n });\n },\n }),\n }),\n});\n"],"mappings":"gmBAiBA,MAAM,EAAwB,GAA8B,cAAc,IAEpE,EAAoC,MAAO,EAAoB,IAAqC,CACxG,IAAM,EAAa,EAAS,UAAU,SAAS,aAAa,CACxD,EAAU,EAAK,QAAQ,EAAS,UAAU,SAAS,EAAqB,EAAU,CAAC,CAAC,CAExF,KAAO,EAAQ,WAAW,EAAW,EAAI,IAAY,GAAY,CAC/D,GAAI,CACF,MAAMA,EAAAA,QAAG,MAAM,EAAQ,MACjB,CACN,MAGF,EAAU,EAAK,QAAQ,EAAQ,GAI7B,GACJ,EACA,EACA,IACS,CACT,IAAM,EAAmB,GAAG,EAAqB,EAAa,CAAC,GACzD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AAiB,EAAK,QAAS,EAAM,CAEpE,EAAY,EAAM,EAAE,GAEpB,EAAe,EAAM,EAAE,GAE7B,GAAI,IAAc,EAChB,MAAM,IAAI,EAAU,2DAA4D,CAAE,UAAW,GAAO,CAAC,CAGvG,IAAM,EAAmB,EAAS,UAAU,SAAS,EAAqB,EAAU,CAAC,CAC/E,EAAgB,EAAS,UAAU,SAAS,EAAqB,EAAa,CAAC,CAErF,GAAI,CAAE,MAAMD,EAAAA,QAAG,WAAW,EAAiB,CACzC,MAAM,IAAI,EAAU,GAAG,EAAU,kBAAmB,CAAE,UAAW,GAAO,CAAC,CAG3E,GAAI,MAAMA,EAAAA,QAAG,WAAW,EAAc,CACpC,MAAM,IAAI,EAAU,GAAG,EAAa,kBAAmB,CAAE,UAAW,GAAO,CAAC,CAG9E,MAAMA,EAAAA,QAAG,UAAU,EAAK,QAAQ,EAAc,CAAC,CAC/C,MAAMA,EAAAA,QAAG,KAAK,EAAkB,EAAc,CAC9C,MAAM,EAAkC,EAAU,EAAU,CAE5D,IAAM,EAAS,MAAM,EAAS,OAAO,EAAK,CAAE,OAAQ,GAAM,CAAC,CAC3D,EAAuB,EAAO,mBAAoB,EAAW,EAAa,CAE1E,MAAM,EAAS,KAAK,EAAK,CAAE,QAAS,QAAS,SAAQ,CAAC,CAEtD,EAAQ,CACN,qBAAsB,GACtB,QAAS,GAAGC,EAAO,QAAQ,EAAO,KAAK,CAAC,WAAWA,EAAO,KAAK,EAAU,CAAC,MAAMA,EAAO,KAAK,EAAa,CAAC,GAC3G,CAAC,EAEL,CAAC,CACH,EACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as e}from"./chunk-BjEoQXZ0.js";var t=e(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}));export{t};
|
|
2
|
+
//# sourceMappingURL=ms-B7sMc0pR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms-B7sMc0pR.js","names":[],"sources":["../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n"],"x_google_ignoreList":[0],"mappings":"yDAIA,IAAI,EAAI,IACJ,EAAI,EAAI,GACR,EAAI,EAAI,GACR,EAAI,EAAI,GACR,EAAI,EAAI,EACR,EAAI,EAAI,OAgBZ,EAAO,QAAU,SAAU,EAAK,EAAS,CACvC,IAAqB,EAAE,CACvB,IAAI,EAAO,OAAO,EAClB,GAAI,IAAS,UAAY,EAAI,OAAS,EACpC,OAAO,EAAM,EAAI,IACR,IAAS,UAAY,SAAS,EAAI,CAC3C,OAAO,EAAQ,KAAO,EAAQ,EAAI,CAAG,EAAS,EAAI,CAEpD,MAAU,MACR,wDACE,KAAK,UAAU,EAAI,CACtB,EAWH,SAAS,EAAM,EAAK,CAClB,KAAM,OAAO,EAAI,CACb,IAAI,OAAS,KAGjB,KAAI,EAAQ,mIAAmI,KAC7I,EACD,CACI,KAGL,KAAI,EAAI,WAAW,EAAM,GAAG,CAE5B,QADY,EAAM,IAAM,MAAM,aAAa,CAC3C,CACE,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAO,EAAI,EACb,IAAK,QACL,IAAK,OACL,IAAK,IACH,OAAO,EAAI,EACb,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAO,EAAI,EACb,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAO,EAAI,EACb,IAAK,UACL,IAAK,SACL,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAO,EAAI,EACb,IAAK,UACL,IAAK,SACL,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAO,EAAI,EACb,IAAK,eACL,IAAK,cACL,IAAK,QACL,IAAK,OACL,IAAK,KACH,OAAO,EACT,QACE,UAYN,SAAS,EAAS,EAAI,CACpB,IAAI,EAAQ,KAAK,IAAI,EAAG,CAaxB,OAZI,GAAS,EACJ,KAAK,MAAM,EAAK,EAAE,CAAG,IAE1B,GAAS,EACJ,KAAK,MAAM,EAAK,EAAE,CAAG,IAE1B,GAAS,EACJ,KAAK,MAAM,EAAK,EAAE,CAAG,IAE1B,GAAS,EACJ,KAAK,MAAM,EAAK,EAAE,CAAG,IAEvB,EAAK,KAWd,SAAS,EAAQ,EAAI,CACnB,IAAI,EAAQ,KAAK,IAAI,EAAG,CAaxB,OAZI,GAAS,EACJ,EAAO,EAAI,EAAO,EAAG,MAAM,CAEhC,GAAS,EACJ,EAAO,EAAI,EAAO,EAAG,OAAO,CAEjC,GAAS,EACJ,EAAO,EAAI,EAAO,EAAG,SAAS,CAEnC,GAAS,EACJ,EAAO,EAAI,EAAO,EAAG,SAAS,CAEhC,EAAK,MAOd,SAAS,EAAO,EAAI,EAAO,EAAG,EAAM,CAClC,IAAI,EAAW,GAAS,EAAI,IAC5B,OAAO,KAAK,MAAM,EAAK,EAAE,CAAG,IAAM,GAAQ,EAAW,IAAM"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import"./ms-B7sMc0pR.js";import"./src-DxCC1MV4.js";import"./prompt-C9nwJW0G.js";import{T as e,d as t,j as n}from"./http-CY3lPMkt.js";import{E as r,_t as i,c as a,n as o,s}from"./command-2iNTc5dV.js";import{t as c}from"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{a as l,i as u,r as d}from"./sync-json-V52OzeCz.js";import{t as f}from"./select-Dey_sjjd.js";const p=[`logs`,`permissions`,`data`,`schema`];var m=o({name:`open`,description:`Open your app in a browser`,details:r`
|
|
2
|
+
Opens the Gadget web editor for your app by default. The data and schema locations require a model
|
|
3
|
+
name or ${s.subdued(`--show-all`)} to pick from a list.
|
|
4
|
+
`,sections:[{title:`Locations`,content:r`
|
|
5
|
+
location specifies the part of Gadget to open. By default it opens the app's editor.
|
|
6
|
+
|
|
7
|
+
logs Opens the log viewer for your environment.
|
|
8
|
+
permissions Opens the permissions settings page.
|
|
9
|
+
data Opens the data editor for a specific model.
|
|
10
|
+
schema Opens the schema editor for a specific model.
|
|
11
|
+
`}],examples:[`ggt open`,`ggt open logs`,`ggt open permissions`,`ggt open data post`,`ggt open schema post`,`ggt open data --show-all`,`ggt open schema --show-all`,`ggt open data post --app myBlog --env staging`],positionals:[{name:`location`,description:`Page to open: logs, permissions, data, or schema`,details:`One of: logs, permissions, data, schema. Opens the app editor when omitted.`},{name:`model`,description:`Model name for data or schema locations`,details:`Required for data and schema locations. Use --show-all to pick from a list instead.`}],flags:{...l,"--show-all":{type:Boolean,description:`Prompt to pick a model from the full list`,details:`Displays an interactive picker with all models in your app. Useful when you don't remember the exact model name.`}},run:async(o,l)=>{let m=await d(process.cwd()),h=await u.load(o,{command:`open`,flags:l,directory:m}),g=l._[0];if(!g){await e(`https://${h.environment.application.primaryDomain}/edit/${h.environment.name}`),a`
|
|
12
|
+
Opened editor for environment ${s.code(h.environment.name)}.
|
|
13
|
+
`;return}if(!p.includes(g))throw new n(r`
|
|
14
|
+
Unknown location ${s.warning(g)}
|
|
15
|
+
|
|
16
|
+
Did you mean ${s.identifier(c(g,p))}?
|
|
17
|
+
`);let _=g;switch(_){case`logs`:await e(`https://${h.environment.application.primaryDomain}/edit/${h.environment.name}/logs`),a`
|
|
18
|
+
Opened log viewer for environment ${s.code(h.environment.name)}.
|
|
19
|
+
`;break;case`permissions`:await e(`https://${h.environment.application.primaryDomain}/edit/${h.environment.name}/settings/permissions`),a`
|
|
20
|
+
Opened permissions settings for environment ${s.code(h.environment.name)}.
|
|
21
|
+
`;break;case`data`:case`schema`:{let i=(await t(o,h.environment)).map(e=>e.apiIdentifier),u=l._[1];if(!u)if(l[`--show-all`])u=await f({choices:i,content:`Which model do you wish to open?`});else throw new n(r`
|
|
22
|
+
"ggt open ${_}" requires a model to be specified.
|
|
23
|
+
|
|
24
|
+
Run with "--show-all" to choose from available models.
|
|
25
|
+
|
|
26
|
+
ggt open ${_} --show-all
|
|
27
|
+
`,{usageHint:!1});if(!i.includes(u))throw new n(r`
|
|
28
|
+
Unknown model ${s.warning(u)}
|
|
29
|
+
|
|
30
|
+
Did you mean ${s.identifier(c(u,i))}?
|
|
31
|
+
|
|
32
|
+
Run with "--show-all" to choose from available models.
|
|
33
|
+
|
|
34
|
+
ggt open ${_} --show-all
|
|
35
|
+
`,{usageHint:!1});await e(`https://${h.environment.application.primaryDomain}/edit/${h.environment.name}/model/${u}/${_}`),a`
|
|
36
|
+
Opened ${_} viewer for environment ${s.code(h.environment.name)} for model ${s.code(u)}.
|
|
37
|
+
`;break}default:i(_)}}});export{m as default};
|
|
38
|
+
//# sourceMappingURL=open-CSsA4B-l.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-CSsA4B-l.js","names":["colors"],"sources":["../src/commands/open.ts"],"sourcesContent":["import open from \"open\";\n\nimport { getModels } from \"../services/app/app.ts\";\nimport { AppIdentity, AppIdentityFlags } from \"../services/command/app-identity.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport { FlagError } from \"../services/command/flag.ts\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.ts\";\nimport colors from \"../services/output/colors.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { select } from \"../services/output/select.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\nimport { closestMatch } from \"../services/util/collection.ts\";\nimport { isNever } from \"../services/util/is.ts\";\n\nconst Locations = [\"logs\", \"permissions\", \"data\", \"schema\"] as const;\n\ntype Location = (typeof Locations)[number];\n\nexport default defineCommand({\n name: \"open\",\n description: \"Open your app in a browser\",\n details: sprint`\n Opens the Gadget web editor for your app by default. The data and schema locations require a model\n name or ${colors.subdued(\"--show-all\")} to pick from a list.\n `,\n sections: [\n {\n title: \"Locations\",\n content: sprint`\n location specifies the part of Gadget to open. By default it opens the app's editor.\n\n logs Opens the log viewer for your environment.\n permissions Opens the permissions settings page.\n data Opens the data editor for a specific model.\n schema Opens the schema editor for a specific model.\n `,\n },\n ],\n examples: [\n \"ggt open\",\n \"ggt open logs\",\n \"ggt open permissions\",\n \"ggt open data post\",\n \"ggt open schema post\",\n \"ggt open data --show-all\",\n \"ggt open schema --show-all\",\n \"ggt open data post --app myBlog --env staging\",\n ],\n positionals: [\n {\n name: \"location\",\n description: \"Page to open: logs, permissions, data, or schema\",\n details: \"One of: logs, permissions, data, schema. Opens the app editor when omitted.\",\n },\n {\n name: \"model\",\n description: \"Model name for data or schema locations\",\n details: \"Required for data and schema locations. Use --show-all to pick from a list instead.\",\n },\n ],\n flags: {\n ...AppIdentityFlags,\n \"--show-all\": {\n type: Boolean,\n description: \"Prompt to pick a model from the full list\",\n details: \"Displays an interactive picker with all models in your app. Useful when you don't remember the exact model name.\",\n },\n },\n run: async (ctx, flags) => {\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"open\", flags, directory });\n\n const locationArg = flags._[0];\n if (!locationArg) {\n await open(`https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}`);\n println`\n Opened editor for environment ${colors.code(appIdentity.environment.name)}.\n `;\n return;\n }\n\n if (!Locations.includes(locationArg as Location)) {\n throw new FlagError(\n sprint`\n Unknown location ${colors.warning(locationArg)}\n\n Did you mean ${colors.identifier(closestMatch(locationArg, Locations))}?\n `,\n );\n }\n\n const location: Location = locationArg as Location;\n\n switch (location) {\n case \"logs\": {\n await open(`https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}/logs`);\n println`\n Opened log viewer for environment ${colors.code(appIdentity.environment.name)}.\n `;\n break;\n }\n case \"permissions\": {\n await open(\n `https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}/settings/permissions`,\n );\n println`\n Opened permissions settings for environment ${colors.code(appIdentity.environment.name)}.\n `;\n break;\n }\n case \"data\":\n case \"schema\": {\n const remoteModelApiIdentifiers = (await getModels(ctx, appIdentity.environment)).map((e) => e.apiIdentifier);\n\n let modelApiIdentifier = flags._[1];\n if (!modelApiIdentifier) {\n if (flags[\"--show-all\"]) {\n modelApiIdentifier = await select({ choices: remoteModelApiIdentifiers, content: \"Which model do you wish to open?\" });\n } else {\n throw new FlagError(\n sprint`\n \"ggt open ${location}\" requires a model to be specified.\n\n Run with \"--show-all\" to choose from available models.\n\n ggt open ${location} --show-all\n `,\n { usageHint: false },\n );\n }\n }\n\n if (!remoteModelApiIdentifiers.includes(modelApiIdentifier)) {\n throw new FlagError(\n sprint`\n Unknown model ${colors.warning(modelApiIdentifier)}\n\n Did you mean ${colors.identifier(closestMatch(modelApiIdentifier, remoteModelApiIdentifiers))}?\n\n Run with \"--show-all\" to choose from available models.\n\n ggt open ${location} --show-all\n `,\n { usageHint: false },\n );\n }\n\n await open(\n `https://${appIdentity.environment.application.primaryDomain}/edit/${appIdentity.environment.name}/model/${modelApiIdentifier}/${location}`,\n );\n println`\n Opened ${location} viewer for environment ${colors.code(appIdentity.environment.name)} for model ${colors.code(modelApiIdentifier)}.\n `;\n break;\n }\n default:\n isNever(location);\n }\n },\n});\n"],"mappings":"qZAcA,MAAM,EAAY,CAAC,OAAQ,cAAe,OAAQ,SAAS,CAI3D,IAAA,EAAe,EAAc,CAC3B,KAAM,OACN,YAAa,6BACb,QAAS,CAAM;;cAEHA,EAAO,QAAQ,aAAa,CAAC;IAEzC,SAAU,CACR,CACE,MAAO,YACP,QAAS,CAAM;;;;;;;QAQhB,CACF,CACD,SAAU,CACR,WACA,gBACA,uBACA,qBACA,uBACA,2BACA,6BACA,gDACD,CACD,YAAa,CACX,CACE,KAAM,WACN,YAAa,mDACb,QAAS,8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I,EACR,CAAM;4BACQ,EAAS;;;;6BAIR,EAAS;gBAExB,CAAE,UAAW,GAAO,CACrB,CAIL,GAAI,CAAC,EAA0B,SAAS,EAAmB,CACzD,MAAM,IAAI,EACR,CAAM;8BACYA,EAAO,QAAQ,EAAmB,CAAC;;6BAEpCA,EAAO,WAAW,EAAa,EAAoB,EAA0B,CAAC,CAAC;;;;2BAIjF,EAAS;cAExB,CAAE,UAAW,GAAO,CACrB,CAGH,MAAM,EACJ,WAAW,EAAY,YAAY,YAAY,cAAc,QAAQ,EAAY,YAAY,KAAK,SAAS,EAAmB,GAAG,IAClI,CACD,CAAO;mBACI,EAAS,0BAA0BA,EAAO,KAAK,EAAY,YAAY,KAAK,CAAC,aAAaA,EAAO,KAAK,EAAmB,CAAC;UAErI,MAEF,QACE,EAAQ,EAAS,GAGxB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
async function e(e,n,{concurrency:r=1/0,stopOnError:i=!0,signal:a}={}){return new Promise((o,s)=>{if(e[Symbol.iterator]===void 0&&e[Symbol.asyncIterator]===void 0)throw TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof e})`);if(typeof n!=`function`)throw TypeError(`Mapper function is required`);if(!(Number.isSafeInteger(r)&&r>=1||r===1/0))throw TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${r}\` (${typeof r})`);let c=[],l=[],u=new Map,d=!1,f=!1,p=!1,m=0,h=0,g=e[Symbol.iterator]===void 0?e[Symbol.asyncIterator]():e[Symbol.iterator](),_=()=>{b(a.reason)},v=()=>{a?.removeEventListener(`abort`,_)},y=e=>{o(e),v()},b=e=>{d=!0,f=!0,s(e),v()};a&&(a.aborted&&b(a.reason),a.addEventListener(`abort`,_,{once:!0}));let x=async()=>{if(f)return;let e=await g.next(),r=h;if(h++,e.done){if(p=!0,m===0&&!f){if(!i&&l.length>0){b(AggregateError(l));return}if(f=!0,u.size===0){y(c);return}let e=[];for(let[n,r]of c.entries())u.get(n)!==t&&e.push(r);y(e)}return}m++,(async()=>{try{let i=await e.value;if(f)return;let a=await n(i,r);a===t&&u.set(r,a),c[r]=a,m--,await x()}catch(e){if(i)b(e);else{l.push(e),m--;try{await x()}catch(e){b(e)}}}})()};(async()=>{for(let e=0;e<r;e++){try{await x()}catch(e){b(e);break}if(p||d)break}})()})}const t=Symbol(`skip`);export{e as t};
|
|
2
|
+
//# sourceMappingURL=p-map-DE0acmRv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p-map-DE0acmRv.js","names":[],"sources":["../node_modules/.pnpm/p-map@7.0.4/node_modules/p-map/index.js"],"sourcesContent":["export default async function pMap(\n\titerable,\n\tmapper,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tstopOnError = true,\n\t\tsignal,\n\t} = {},\n) {\n\treturn new Promise((resolve_, reject_) => {\n\t\tif (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {\n\t\t\tthrow new TypeError(`Expected \\`input\\` to be either an \\`Iterable\\` or \\`AsyncIterable\\`, got (${typeof iterable})`);\n\t\t}\n\n\t\tif (typeof mapper !== 'function') {\n\t\t\tthrow new TypeError('Mapper function is required');\n\t\t}\n\n\t\tif (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {\n\t\t\tthrow new TypeError(`Expected \\`concurrency\\` to be an integer from 1 and up or \\`Infinity\\`, got \\`${concurrency}\\` (${typeof concurrency})`);\n\t\t}\n\n\t\tconst result = [];\n\t\tconst errors = [];\n\t\tconst skippedIndexesMap = new Map();\n\t\tlet isRejected = false;\n\t\tlet isResolved = false;\n\t\tlet isIterableDone = false;\n\t\tlet resolvingCount = 0;\n\t\tlet currentIndex = 0;\n\t\tconst iterator = iterable[Symbol.iterator] === undefined ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator]();\n\n\t\tconst signalListener = () => {\n\t\t\treject(signal.reason);\n\t\t};\n\n\t\tconst cleanup = () => {\n\t\t\tsignal?.removeEventListener('abort', signalListener);\n\t\t};\n\n\t\tconst resolve = value => {\n\t\t\tresolve_(value);\n\t\t\tcleanup();\n\t\t};\n\n\t\tconst reject = reason => {\n\t\t\tisRejected = true;\n\t\t\tisResolved = true;\n\t\t\treject_(reason);\n\t\t\tcleanup();\n\t\t};\n\n\t\tif (signal) {\n\t\t\tif (signal.aborted) {\n\t\t\t\treject(signal.reason);\n\t\t\t}\n\n\t\t\tsignal.addEventListener('abort', signalListener, {once: true});\n\t\t}\n\n\t\tconst next = async () => {\n\t\t\tif (isResolved) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextItem = await iterator.next();\n\n\t\t\tconst index = currentIndex;\n\t\t\tcurrentIndex++;\n\n\t\t\t// Note: `iterator.next()` can be called many times in parallel.\n\t\t\t// This can cause multiple calls to this `next()` function to\n\t\t\t// receive a `nextItem` with `done === true`.\n\t\t\t// The shutdown logic that rejects/resolves must be protected\n\t\t\t// so it runs only one time as the `skippedIndex` logic is\n\t\t\t// non-idempotent.\n\t\t\tif (nextItem.done) {\n\t\t\t\tisIterableDone = true;\n\n\t\t\t\tif (resolvingCount === 0 && !isResolved) {\n\t\t\t\t\tif (!stopOnError && errors.length > 0) {\n\t\t\t\t\t\treject(new AggregateError(errors)); // eslint-disable-line unicorn/error-message\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tisResolved = true;\n\n\t\t\t\t\tif (skippedIndexesMap.size === 0) {\n\t\t\t\t\t\tresolve(result);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst pureResult = [];\n\n\t\t\t\t\t// Support multiple `pMapSkip`'s.\n\t\t\t\t\tfor (const [index, value] of result.entries()) {\n\t\t\t\t\t\tif (skippedIndexesMap.get(index) === pMapSkip) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpureResult.push(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tresolve(pureResult);\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresolvingCount++;\n\n\t\t\t// Intentionally detached\n\t\t\t(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst element = await nextItem.value;\n\n\t\t\t\t\tif (isResolved) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst value = await mapper(element, index);\n\n\t\t\t\t\t// Use Map to stage the index of the element.\n\t\t\t\t\tif (value === pMapSkip) {\n\t\t\t\t\t\tskippedIndexesMap.set(index, value);\n\t\t\t\t\t}\n\n\t\t\t\t\tresult[index] = value;\n\n\t\t\t\t\tresolvingCount--;\n\t\t\t\t\tawait next();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (stopOnError) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrors.push(error);\n\t\t\t\t\t\tresolvingCount--;\n\n\t\t\t\t\t\t// In that case we can't really continue regardless of `stopOnError` state\n\t\t\t\t\t\t// since an iterable is likely to continue throwing after it throws once.\n\t\t\t\t\t\t// If we continue calling `next()` indefinitely we will likely end up\n\t\t\t\t\t\t// in an infinite loop of failed iteration.\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait next();\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})();\n\t\t};\n\n\t\t// Create the concurrent runners in a detached (non-awaited)\n\t\t// promise. We need this so we can await the `next()` calls\n\t\t// to stop creating runners before hitting the concurrency limit\n\t\t// if the iterable has already been marked as done.\n\t\t// NOTE: We *must* do this for async iterators otherwise we'll spin up\n\t\t// infinite `next()` calls by default and never start the event loop.\n\t\t(async () => {\n\t\t\tfor (let index = 0; index < concurrency; index++) {\n\t\t\t\ttry {\n\t\t\t\t\t// eslint-disable-next-line no-await-in-loop\n\t\t\t\t\tawait next();\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (isIterableDone || isRejected) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t})();\n\t});\n}\n\nexport function pMapIterable(\n\titerable,\n\tmapper,\n\t{\n\t\tconcurrency = Number.POSITIVE_INFINITY,\n\t\tbackpressure = concurrency,\n\t} = {},\n) {\n\tif (iterable[Symbol.iterator] === undefined && iterable[Symbol.asyncIterator] === undefined) {\n\t\tthrow new TypeError(`Expected \\`input\\` to be either an \\`Iterable\\` or \\`AsyncIterable\\`, got (${typeof iterable})`);\n\t}\n\n\tif (typeof mapper !== 'function') {\n\t\tthrow new TypeError('Mapper function is required');\n\t}\n\n\tif (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {\n\t\tthrow new TypeError(`Expected \\`concurrency\\` to be an integer from 1 and up or \\`Infinity\\`, got \\`${concurrency}\\` (${typeof concurrency})`);\n\t}\n\n\tif (!((Number.isSafeInteger(backpressure) && backpressure >= concurrency) || backpressure === Number.POSITIVE_INFINITY)) {\n\t\tthrow new TypeError(`Expected \\`backpressure\\` to be an integer from \\`concurrency\\` (${concurrency}) and up or \\`Infinity\\`, got \\`${backpressure}\\` (${typeof backpressure})`);\n\t}\n\n\treturn {\n\t\tasync * [Symbol.asyncIterator]() {\n\t\t\tconst iterator = iterable[Symbol.asyncIterator] === undefined ? iterable[Symbol.iterator]() : iterable[Symbol.asyncIterator]();\n\n\t\t\tconst promises = [];\n\t\t\tlet pendingPromisesCount = 0;\n\t\t\tlet isDone = false;\n\t\t\tlet index = 0;\n\n\t\t\tfunction trySpawn() {\n\t\t\t\tif (isDone || !(pendingPromisesCount < concurrency && promises.length < backpressure)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tpendingPromisesCount++;\n\n\t\t\t\tconst promise = (async () => {\n\t\t\t\t\tconst {done, value} = await iterator.next();\n\n\t\t\t\t\tif (done) {\n\t\t\t\t\t\tpendingPromisesCount--;\n\t\t\t\t\t\treturn {done: true};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Spawn if still below concurrency and backpressure limit\n\t\t\t\t\ttrySpawn();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst returnValue = await mapper(await value, index++);\n\n\t\t\t\t\t\tpendingPromisesCount--;\n\n\t\t\t\t\t\tif (returnValue === pMapSkip) {\n\t\t\t\t\t\t\tconst index = promises.indexOf(promise);\n\n\t\t\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t\t\tpromises.splice(index, 1);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Spawn if still below backpressure limit and just dropped below concurrency limit\n\t\t\t\t\t\ttrySpawn();\n\n\t\t\t\t\t\treturn {done: false, value: returnValue};\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tpendingPromisesCount--;\n\t\t\t\t\t\tisDone = true;\n\t\t\t\t\t\treturn {error};\n\t\t\t\t\t}\n\t\t\t\t})();\n\n\t\t\t\tpromises.push(promise);\n\t\t\t}\n\n\t\t\ttrySpawn();\n\n\t\t\twhile (promises.length > 0) {\n\t\t\t\tconst {error, done, value} = await promises[0]; // eslint-disable-line no-await-in-loop\n\n\t\t\t\tpromises.shift();\n\n\t\t\t\tif (error) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\n\t\t\t\tif (done) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Spawn if just dropped below backpressure limit and below the concurrency limit\n\t\t\t\ttrySpawn();\n\n\t\t\t\tif (value === pMapSkip) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tyield value;\n\t\t\t}\n\t\t},\n\t};\n}\n\nexport const pMapSkip = Symbol('skip');\n"],"x_google_ignoreList":[0],"mappings":"AAAA,eAA8B,EAC7B,EACA,EACA,CACC,cAAc,IACd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AAU,EAAO,SAAS,CACxC,EAAkB,IAAI,EAAM,GAAK,GAIrC,EAAW,KAAK,EAAM,CAGvB,EAAQ,EAAW,CAGpB,OAGD,KAGC,SAAY,CACZ,GAAI,CACH,IAAM,EAAU,MAAM,EAAS,MAE/B,GAAI,EACH,OAGD,IAAM,EAAQ,MAAM,EAAO,EAAS,EAAM,CAGtC,IAAU,GACb,EAAkB,IAAI,EAAO,EAAM,CAGpC,EAAO,GAAS,EAEhB,IACA,MAAM,GAAM,OACJ,EAAO,CACf,GAAI,EACH,EAAO,EAAM,KACP,CACN,EAAO,KAAK,EAAM,CAClB,IAMA,GAAI,CACH,MAAM,GAAM,OACJ,EAAO,CACf,EAAO,EAAM,OAIb,GASJ,SAAY,CACZ,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAa,IAAS,CACjD,GAAI,CAEH,MAAM,GAAM,OACJ,EAAO,CACf,EAAO,EAAM,CACb,MAGD,GAAI,GAAkB,EACrB,UAGC,EACH,CA6GH,MAAa,EAAW,OAAO,OAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import"./ms-B7sMc0pR.js";import"./src-DxCC1MV4.js";import"./prompt-C9nwJW0G.js";import{j as e,ut as t}from"./http-CY3lPMkt.js";import{E as n,c as r,n as i,s as a}from"./command-2iNTc5dV.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{_ as o,a as s,g as c,i as l,r as u}from"./sync-json-V52OzeCz.js";import"./select-Dey_sjjd.js";var d=i({name:`problems`,aliases:[`problem`],description:`Show errors and warnings in your app`,details:n`
|
|
2
|
+
Fetches issues that would block a deploy from the Gadget platform for your app's environment.
|
|
3
|
+
Issues include type errors, missing action files, and schema conflicts. Exits
|
|
4
|
+
cleanly with a success message when no problems are found.
|
|
5
|
+
`,examples:[`ggt problems`,`ggt problems --app myBlog`,`ggt problems --env staging`,`ggt problems --app myBlog --env production`],flags:s,run:async(i,s)=>{if(s._.length>0)throw new e(n`
|
|
6
|
+
"ggt problems" does not take any positional arguments.
|
|
7
|
+
|
|
8
|
+
If you are trying to see the problems of a specific directory,
|
|
9
|
+
you must "cd" to that directory and then run "ggt problems".
|
|
10
|
+
`);let d=await u(process.cwd()),f=await l.load(i,{command:`problems`,flags:s,directory:d}),{publishIssues:p}=await f.edit.query({query:t});p.length===0?r({ensureEmptyLineAbove:!0,content:a.success(`No problems found.`)}):(r({ensureEmptyLineAbove:!0,content:`${a.warning(`!`)} ${a.header(`Problems found in your app`)}`}),c({problems:o(p)})),await f.edit.dispose()}});export{d as default};
|
|
11
|
+
//# sourceMappingURL=problems-BMLsmxd4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"problems-BMLsmxd4.js","names":["colors"],"sources":["../src/commands/problems.ts"],"sourcesContent":["import { PUBLISH_ISSUES_QUERY } from \"../services/app/edit/operation.ts\";\nimport { AppIdentity, AppIdentityFlags } from \"../services/command/app-identity.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport { FlagError } from \"../services/command/flag.ts\";\nimport { loadSyncJsonDirectory } from \"../services/filesync/sync-json.ts\";\nimport colors from \"../services/output/colors.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { printProblems, publishIssuesToProblems } from \"../services/output/problems.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\n\nexport default defineCommand({\n name: \"problems\",\n aliases: [\"problem\"],\n description: \"Show errors and warnings in your app\",\n details: sprint`\n Fetches issues that would block a deploy from the Gadget platform for your app's environment.\n Issues include type errors, missing action files, and schema conflicts. Exits\n cleanly with a success message when no problems are found.\n `,\n examples: [\"ggt problems\", \"ggt problems --app myBlog\", \"ggt problems --env staging\", \"ggt problems --app myBlog --env production\"],\n flags: AppIdentityFlags,\n run: async (ctx, flags) => {\n if (flags._.length > 0) {\n throw new FlagError(\n sprint`\n \"ggt problems\" does not take any positional arguments.\n\n If you are trying to see the problems of a specific directory,\n you must \"cd\" to that directory and then run \"ggt problems\".\n `,\n );\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const appIdentity = await AppIdentity.load(ctx, { command: \"problems\", flags, directory });\n\n const { publishIssues } = await appIdentity.edit.query({ query: PUBLISH_ISSUES_QUERY });\n\n if (publishIssues.length === 0) {\n println({ ensureEmptyLineAbove: true, content: colors.success(\"No problems found.\") });\n } else {\n println({ ensureEmptyLineAbove: true, content: `${colors.warning(\"!\")} ${colors.header(\"Problems found in your app\")}` });\n printProblems({ problems: publishIssuesToProblems(publishIssues) });\n }\n\n await appIdentity.edit.dispose();\n },\n});\n"],"mappings":"kYAUA,IAAA,EAAe,EAAc,CAC3B,KAAM,WACN,QAAS,CAAC,UAAU,CACpB,YAAa,uCACb,QAAS,CAAM;;;;IAKf,SAAU,CAAC,eAAgB,4BAA6B,6BAA8B,6CAA6C,CACnI,MAAO,EACP,IAAK,MAAO,EAAK,IAAU,CACzB,GAAI,EAAM,EAAE,OAAS,EACnB,MAAM,IAAI,EACR,CAAM;;;;;UAMP,CAGH,IAAM,EAAY,MAAM,EAAsB,QAAQ,KAAK,CAAC,CACtD,EAAc,MAAM,EAAY,KAAK,EAAK,CAAE,QAAS,WAAY,QAAO,YAAW,CAAC,CAEpF,CAAE,iBAAkB,MAAM,EAAY,KAAK,MAAM,CAAE,MAAO,EAAsB,CAAC,CAEnF,EAAc,SAAW,EAC3B,EAAQ,CAAE,qBAAsB,GAAM,QAASA,EAAO,QAAQ,qBAAqB,CAAE,CAAC,EAEtF,EAAQ,CAAE,qBAAsB,GAAM,QAAS,GAAGA,EAAO,QAAQ,IAAI,CAAC,GAAGA,EAAO,OAAO,6BAA6B,GAAI,CAAC,CACzH,EAAc,CAAE,SAAU,EAAwB,EAAc,CAAE,CAAC,EAGrE,MAAM,EAAY,KAAK,SAAS,EAEnC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{T as e,d as t,l as n}from"./command-2iNTc5dV.js";import r from"node:events";import i from"node:os";import a from"node:readline";import o from"node:process";import s from"node:assert";const c=globalThis.window?.document!==void 0;globalThis.process?.versions?.node,globalThis.process?.versions?.bun,globalThis.Deno?.version?.deno,globalThis.process?.versions?.electron,globalThis.navigator?.userAgent?.includes(`jsdom`),typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope,typeof DedicatedWorkerGlobalScope<`u`&&globalThis instanceof DedicatedWorkerGlobalScope,typeof SharedWorkerGlobalScope<`u`&&globalThis instanceof SharedWorkerGlobalScope,typeof ServiceWorkerGlobalScope<`u`&&globalThis instanceof ServiceWorkerGlobalScope;const l=globalThis.navigator?.userAgentData?.platform;l===`macOS`||globalThis.navigator?.platform===`MacIntel`||globalThis.navigator?.userAgent?.includes(` Mac `)===!0||globalThis.process?.platform,l===`Windows`||globalThis.navigator?.platform===`Win32`||globalThis.process?.platform,l===`Linux`||globalThis.navigator?.platform?.startsWith(`Linux`)===!0||globalThis.navigator?.userAgent?.includes(` Linux `)===!0||globalThis.process?.platform,l===`iOS`||globalThis.navigator?.platform===`MacIntel`&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),l===`Android`||globalThis.navigator?.platform===`Android`||globalThis.navigator?.userAgent?.includes(` Android `)===!0||globalThis.process?.platform,!c&&o.env.TERM_PROGRAM;const u=!c&&o.platform===`win32`,d=!c&&(o.env.TERM?.startsWith(`screen`)||o.env.TERM?.startsWith(`tmux`)||o.env.TMUX!==void 0);c||o.cwd;const f=e=>d?`\x1BPtmux;`+e.replaceAll(`\x1B`,`\x1B\x1B`)+`\x1B\\`:e,p=`\x1B[2J`;`${p}`,(()=>{if(c||!u)return!1;let e=i.release().split(`.`),t=Number(e[0]),n=Number(e[2]??0);return t<10||t===10&&n<10586})(),`${p}`;const m=(e,t)=>{let n=f(`]8;;${t}`),r=f(`\x1B]8;;\x07`);return n+e+r};function h(){let{env:e}=o,{TERM:t,TERM_PROGRAM:n}=e;return o.platform===`win32`?!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask===`{cmd::Cmder}`||n===`Terminus-Sublime`||n===`vscode`||t===`xterm-256color`||t===`alacritty`||t===`rxvt-unicode`||t===`rxvt-unicode-256color`||e.TERMINAL_EMULATOR===`JetBrains-JediTerm`:t!==`linux`}const g={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},_={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},v={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},y={...g,..._},b={...g,...v},x=h()?y:b;Object.entries(_);const S={...e.testLike?y:x};if(h()&&t.windowsOrWsl)for(let e of[`tick`,`cross`])S[e]+=` `;var C=class e extends r{static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),s(!e.active,`only one prompt can be active at a time`),e.active=!0;let t=a.createInterface({input:o.stdin,escapeCodeTimeout:50});a.emitKeypressEvents(o.stdin,t),o.stdin.isTTY&&o.stdin.setRawMode(!0);let n=(e,t)=>{let n=w(t);n===!1?this._(e,t):n&&typeof this[n]==`function`?this[n](t):this.bell()};this.close=()=>{o.stdin.removeListener(`keypress`,n),o.stdin.isTTY&&o.stdin.setRawMode(!1),t.close(),this.emit(this.aborted?`abort`:this.exited?`exit`:`submit`,this.value),this.closed=!0,e.active=!1},o.stdin.on(`keypress`,n)}_(e,t){}onRender(){}fire(){this.emit(`state`,{value:this.value,aborted:this.aborted,exited:this.exited})}bell(){n.writeStdout(`\x07`)}render(){this.onRender(),this.firstRender&&=!1}};const w=e=>{if(!(e.meta&&e.name!==`escape`)){if(e.ctrl)switch(e.name){case`a`:return`first`;case`c`:case`d`:return`abort`;case`e`:return`last`;case`g`:return`reset`;default:return}switch(e.name){case`return`:case`enter`:return`submit`;case`backspace`:return`delete`;case`delete`:return`deleteForward`;case`abort`:return`abort`;case`escape`:return`exit`;case`tab`:return`next`;case`pagedown`:return`nextPage`;case`pageup`:return`prevPage`;case`home`:return`home`;case`end`:return`end`;case`up`:return`up`;case`down`:return`down`;case`right`:return`right`;case`left`:return`left`;default:return!1}}},T=(e,t,n)=>{n||=t;let r=Math.min(t-n,e-Math.floor(n/2));r<0&&(r=0);let i=Math.min(r+n,t);return{startIndex:r,endIndex:i}};export{m as a,x as i,T as n,S as r,C as t};
|
|
2
|
+
//# sourceMappingURL=prompt-C9nwJW0G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-C9nwJW0G.js","names":["platform","isWindows"],"sources":["../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js","../node_modules/.pnpm/ansi-escapes@7.3.0/node_modules/ansi-escapes/base.js","../node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js","../node_modules/.pnpm/figures@6.1.0/node_modules/figures/index.js","../src/services/output/symbols.ts","../src/services/output/prompt.ts"],"sourcesContent":["/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */\n\nexport const isBrowser = globalThis.window?.document !== undefined;\n\nexport const isNode = globalThis.process?.versions?.node !== undefined;\n\nexport const isBun = globalThis.process?.versions?.bun !== undefined;\n\nexport const isDeno = globalThis.Deno?.version?.deno !== undefined;\n\nexport const isElectron = globalThis.process?.versions?.electron !== undefined;\n\nexport const isJsDom = globalThis.navigator?.userAgent?.includes('jsdom') === true;\n\nexport const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;\n\nexport const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;\n\nexport const isSharedWorker = typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;\n\nexport const isServiceWorker = typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;\n\n// Note: I'm intentionally not DRYing up the other variables to keep them \"lazy\".\nconst platform = globalThis.navigator?.userAgentData?.platform;\n\nexport const isMacOs = platform === 'macOS'\n\t|| globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.\n\t|| globalThis.navigator?.userAgent?.includes(' Mac ') === true\n\t|| globalThis.process?.platform === 'darwin';\n\nexport const isWindows = platform === 'Windows'\n\t|| globalThis.navigator?.platform === 'Win32'\n\t|| globalThis.process?.platform === 'win32';\n\nexport const isLinux = platform === 'Linux'\n\t|| globalThis.navigator?.platform?.startsWith('Linux') === true\n\t|| globalThis.navigator?.userAgent?.includes(' Linux ') === true\n\t|| globalThis.process?.platform === 'linux';\n\nexport const isIos = platform === 'iOS'\n\t|| (globalThis.navigator?.platform === 'MacIntel' && globalThis.navigator?.maxTouchPoints > 1)\n\t|| /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);\n\nexport const isAndroid = platform === 'Android'\n\t|| globalThis.navigator?.platform === 'Android'\n\t|| globalThis.navigator?.userAgent?.includes(' Android ') === true\n\t|| globalThis.process?.platform === 'android';\n","import process from 'node:process';\nimport os from 'node:os';\nimport {isBrowser} from 'environment';\n\nconst ESC = '\\u001B[';\nconst OSC = '\\u001B]';\nconst BEL = '\\u0007';\nconst SEP = ';';\n\nconst isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === 'Apple_Terminal';\nconst isWindows = !isBrowser && process.platform === 'win32';\nconst isTmux = !isBrowser && (process.env.TERM?.startsWith('screen') || process.env.TERM?.startsWith('tmux') || process.env.TMUX !== undefined);\n\nconst cwdFunction = isBrowser ? () => {\n\tthrow new Error('`process.cwd()` only works in Node.js, not the browser.');\n} : process.cwd;\n\nconst wrapOsc = sequence => {\n\tif (isTmux) {\n\t\t// Tmux requires OSC sequences to be wrapped with DCS tmux; <sequence> ST\n\t\t// and all ESCs in <sequence> to be replaced with ESC ESC.\n\t\t// It only accepts ESC backslash for ST.\n\t\treturn '\\u001BPtmux;' + sequence.replaceAll('\\u001B', '\\u001B\\u001B') + '\\u001B\\\\';\n\t}\n\n\treturn sequence;\n};\n\nexport const cursorTo = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tif (typeof y !== 'number') {\n\t\treturn ESC + (x + 1) + 'G';\n\t}\n\n\treturn ESC + (y + 1) + SEP + (x + 1) + 'H';\n};\n\nexport const cursorMove = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tlet returnValue = '';\n\n\tif (x < 0) {\n\t\treturnValue += ESC + (-x) + 'D';\n\t} else if (x > 0) {\n\t\treturnValue += ESC + x + 'C';\n\t}\n\n\tif (y < 0) {\n\t\treturnValue += ESC + (-y) + 'A';\n\t} else if (y > 0) {\n\t\treturnValue += ESC + y + 'B';\n\t}\n\n\treturn returnValue;\n};\n\nexport const cursorUp = (count = 1) => ESC + count + 'A';\nexport const cursorDown = (count = 1) => ESC + count + 'B';\nexport const cursorForward = (count = 1) => ESC + count + 'C';\nexport const cursorBackward = (count = 1) => ESC + count + 'D';\n\nexport const cursorLeft = ESC + 'G';\nexport const cursorSavePosition = isTerminalApp ? '\\u001B7' : ESC + 's';\nexport const cursorRestorePosition = isTerminalApp ? '\\u001B8' : ESC + 'u';\nexport const cursorGetPosition = ESC + '6n';\nexport const cursorNextLine = ESC + 'E';\nexport const cursorPrevLine = ESC + 'F';\nexport const cursorHide = ESC + '?25l';\nexport const cursorShow = ESC + '?25h';\n\nexport const eraseLines = count => {\n\tlet clear = '';\n\n\tfor (let i = 0; i < count; i++) {\n\t\tclear += eraseLine + (i < count - 1 ? cursorUp() : '');\n\t}\n\n\tif (count) {\n\t\tclear += cursorLeft;\n\t}\n\n\treturn clear;\n};\n\nexport const eraseEndLine = ESC + 'K';\nexport const eraseStartLine = ESC + '1K';\nexport const eraseLine = ESC + '2K';\nexport const eraseDown = ESC + 'J';\nexport const eraseUp = ESC + '1J';\nexport const eraseScreen = ESC + '2J';\nexport const scrollUp = ESC + 'S';\nexport const scrollDown = ESC + 'T';\n\nexport const clearScreen = '\\u001Bc';\n\nexport const clearViewport = `${eraseScreen}${ESC}H`;\n\nconst isOldWindows = () => {\n\tif (isBrowser || !isWindows) {\n\t\treturn false;\n\t}\n\n\tconst parts = os.release().split('.');\n\tconst major = Number(parts[0]);\n\tconst build = Number(parts[2] ?? 0);\n\n\tif (major < 10) {\n\t\treturn true;\n\t}\n\n\tif (major === 10 && build < 10_586) {\n\t\treturn true;\n\t}\n\n\treturn false;\n};\n\nexport const clearTerminal = isOldWindows()\n\t? `${eraseScreen}${ESC}0f`\n\t// 1. Erases the screen (Only done in case `2` is not supported)\n\t// 2. Erases the whole screen including scrollback buffer\n\t// 3. Moves cursor to the top-left position\n\t// More info: https://www.real-world-systems.com/docs/ANSIcode.html\n\t: `${eraseScreen}${ESC}3J${ESC}H`;\n\nexport const enterAlternativeScreen = ESC + '?1049h';\nexport const exitAlternativeScreen = ESC + '?1049l';\n\nexport const beginSynchronizedOutput = ESC + '?2026h';\nexport const endSynchronizedOutput = ESC + '?2026l';\nexport const synchronizedOutput = text => beginSynchronizedOutput + text + endSynchronizedOutput;\n\nexport const beep = BEL;\n\nexport const link = (text, url) => {\n\tconst openLink = wrapOsc(`${OSC}8${SEP}${SEP}${url}${BEL}`);\n\tconst closeLink = wrapOsc(`${OSC}8${SEP}${SEP}${BEL}`);\n\treturn openLink + text + closeLink;\n};\n\nexport const image = (data, options = {}) => {\n\tlet returnValue = `${OSC}1337;File=inline=1`;\n\n\tif (options.width) {\n\t\treturnValue += `;width=${options.width}`;\n\t}\n\n\tif (options.height) {\n\t\treturnValue += `;height=${options.height}`;\n\t}\n\n\tif (options.preserveAspectRatio === false) {\n\t\treturnValue += ';preserveAspectRatio=0';\n\t}\n\n\tconst imageBuffer = Buffer.from(data);\n\n\t// `size` is optional in the spec, but xterm.js requires it.\n\treturn wrapOsc(returnValue + `;size=${imageBuffer.byteLength}` + ':' + imageBuffer.toString('base64') + BEL);\n};\n\nexport const iTerm = {\n\tsetCwd: (cwd = cwdFunction()) => wrapOsc(`${OSC}50;CurrentDir=${cwd}${BEL}`),\n\n\tannotation(message, options = {}) {\n\t\tlet returnValue = `${OSC}1337;`;\n\n\t\tconst hasX = options.x !== undefined;\n\t\tconst hasY = options.y !== undefined;\n\t\tif ((hasX || hasY) && !(hasX && hasY && options.length !== undefined)) {\n\t\t\tthrow new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');\n\t\t}\n\n\t\tmessage = message.replaceAll('|', '');\n\n\t\treturnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';\n\n\t\tif (options.length > 0) {\n\t\t\treturnValue += (\n\t\t\t\thasX\n\t\t\t\t\t? [message, options.length, options.x, options.y]\n\t\t\t\t\t: [options.length, message]\n\t\t\t).join('|');\n\t\t} else {\n\t\t\treturnValue += message;\n\t\t}\n\n\t\treturn wrapOsc(returnValue + BEL);\n\t},\n};\n\nexport const ConEmu = {\n\tsetCwd: (cwd = cwdFunction()) => wrapOsc(`${OSC}9;9;${cwd}${BEL}`),\n};\n\nexport const setCwd = (cwd = cwdFunction()) => iTerm.setCwd(cwd) + ConEmu.setCwd(cwd);\n","import process from 'node:process';\n\nexport default function isUnicodeSupported() {\n\tconst {env} = process;\n\tconst {TERM, TERM_PROGRAM} = env;\n\n\tif (process.platform !== 'win32') {\n\t\treturn TERM !== 'linux'; // Linux console (kernel)\n\t}\n\n\treturn Boolean(env.WT_SESSION) // Windows Terminal\n\t\t|| Boolean(env.TERMINUS_SUBLIME) // Terminus (<0.2.27)\n\t\t|| env.ConEmuTask === '{cmd::Cmder}' // ConEmu and cmder\n\t\t|| TERM_PROGRAM === 'Terminus-Sublime'\n\t\t|| TERM_PROGRAM === 'vscode'\n\t\t|| TERM === 'xterm-256color'\n\t\t|| TERM === 'alacritty'\n\t\t|| TERM === 'rxvt-unicode'\n\t\t|| TERM === 'rxvt-unicode-256color'\n\t\t|| env.TERMINAL_EMULATOR === 'JetBrains-JediTerm';\n}\n","import isUnicodeSupported from 'is-unicode-supported';\n\nconst common = {\n\tcircleQuestionMark: '(?)',\n\tquestionMarkPrefix: '(?)',\n\tsquare: '█',\n\tsquareDarkShade: '▓',\n\tsquareMediumShade: '▒',\n\tsquareLightShade: '░',\n\tsquareTop: '▀',\n\tsquareBottom: '▄',\n\tsquareLeft: '▌',\n\tsquareRight: '▐',\n\tsquareCenter: '■',\n\tbullet: '●',\n\tdot: '․',\n\tellipsis: '…',\n\tpointerSmall: '›',\n\ttriangleUp: '▲',\n\ttriangleUpSmall: '▴',\n\ttriangleDown: '▼',\n\ttriangleDownSmall: '▾',\n\ttriangleLeftSmall: '◂',\n\ttriangleRightSmall: '▸',\n\thome: '⌂',\n\theart: '♥',\n\tmusicNote: '♪',\n\tmusicNoteBeamed: '♫',\n\tarrowUp: '↑',\n\tarrowDown: '↓',\n\tarrowLeft: '←',\n\tarrowRight: '→',\n\tarrowLeftRight: '↔',\n\tarrowUpDown: '↕',\n\talmostEqual: '≈',\n\tnotEqual: '≠',\n\tlessOrEqual: '≤',\n\tgreaterOrEqual: '≥',\n\tidentical: '≡',\n\tinfinity: '∞',\n\tsubscriptZero: '₀',\n\tsubscriptOne: '₁',\n\tsubscriptTwo: '₂',\n\tsubscriptThree: '₃',\n\tsubscriptFour: '₄',\n\tsubscriptFive: '₅',\n\tsubscriptSix: '₆',\n\tsubscriptSeven: '₇',\n\tsubscriptEight: '₈',\n\tsubscriptNine: '₉',\n\toneHalf: '½',\n\toneThird: '⅓',\n\toneQuarter: '¼',\n\toneFifth: '⅕',\n\toneSixth: '⅙',\n\toneEighth: '⅛',\n\ttwoThirds: '⅔',\n\ttwoFifths: '⅖',\n\tthreeQuarters: '¾',\n\tthreeFifths: '⅗',\n\tthreeEighths: '⅜',\n\tfourFifths: '⅘',\n\tfiveSixths: '⅚',\n\tfiveEighths: '⅝',\n\tsevenEighths: '⅞',\n\tline: '─',\n\tlineBold: '━',\n\tlineDouble: '═',\n\tlineDashed0: '┄',\n\tlineDashed1: '┅',\n\tlineDashed2: '┈',\n\tlineDashed3: '┉',\n\tlineDashed4: '╌',\n\tlineDashed5: '╍',\n\tlineDashed6: '╴',\n\tlineDashed7: '╶',\n\tlineDashed8: '╸',\n\tlineDashed9: '╺',\n\tlineDashed10: '╼',\n\tlineDashed11: '╾',\n\tlineDashed12: '−',\n\tlineDashed13: '–',\n\tlineDashed14: '‐',\n\tlineDashed15: '⁃',\n\tlineVertical: '│',\n\tlineVerticalBold: '┃',\n\tlineVerticalDouble: '║',\n\tlineVerticalDashed0: '┆',\n\tlineVerticalDashed1: '┇',\n\tlineVerticalDashed2: '┊',\n\tlineVerticalDashed3: '┋',\n\tlineVerticalDashed4: '╎',\n\tlineVerticalDashed5: '╏',\n\tlineVerticalDashed6: '╵',\n\tlineVerticalDashed7: '╷',\n\tlineVerticalDashed8: '╹',\n\tlineVerticalDashed9: '╻',\n\tlineVerticalDashed10: '╽',\n\tlineVerticalDashed11: '╿',\n\tlineDownLeft: '┐',\n\tlineDownLeftArc: '╮',\n\tlineDownBoldLeftBold: '┓',\n\tlineDownBoldLeft: '┒',\n\tlineDownLeftBold: '┑',\n\tlineDownDoubleLeftDouble: '╗',\n\tlineDownDoubleLeft: '╖',\n\tlineDownLeftDouble: '╕',\n\tlineDownRight: '┌',\n\tlineDownRightArc: '╭',\n\tlineDownBoldRightBold: '┏',\n\tlineDownBoldRight: '┎',\n\tlineDownRightBold: '┍',\n\tlineDownDoubleRightDouble: '╔',\n\tlineDownDoubleRight: '╓',\n\tlineDownRightDouble: '╒',\n\tlineUpLeft: '┘',\n\tlineUpLeftArc: '╯',\n\tlineUpBoldLeftBold: '┛',\n\tlineUpBoldLeft: '┚',\n\tlineUpLeftBold: '┙',\n\tlineUpDoubleLeftDouble: '╝',\n\tlineUpDoubleLeft: '╜',\n\tlineUpLeftDouble: '╛',\n\tlineUpRight: '└',\n\tlineUpRightArc: '╰',\n\tlineUpBoldRightBold: '┗',\n\tlineUpBoldRight: '┖',\n\tlineUpRightBold: '┕',\n\tlineUpDoubleRightDouble: '╚',\n\tlineUpDoubleRight: '╙',\n\tlineUpRightDouble: '╘',\n\tlineUpDownLeft: '┤',\n\tlineUpBoldDownBoldLeftBold: '┫',\n\tlineUpBoldDownBoldLeft: '┨',\n\tlineUpDownLeftBold: '┥',\n\tlineUpBoldDownLeftBold: '┩',\n\tlineUpDownBoldLeftBold: '┪',\n\tlineUpDownBoldLeft: '┧',\n\tlineUpBoldDownLeft: '┦',\n\tlineUpDoubleDownDoubleLeftDouble: '╣',\n\tlineUpDoubleDownDoubleLeft: '╢',\n\tlineUpDownLeftDouble: '╡',\n\tlineUpDownRight: '├',\n\tlineUpBoldDownBoldRightBold: '┣',\n\tlineUpBoldDownBoldRight: '┠',\n\tlineUpDownRightBold: '┝',\n\tlineUpBoldDownRightBold: '┡',\n\tlineUpDownBoldRightBold: '┢',\n\tlineUpDownBoldRight: '┟',\n\tlineUpBoldDownRight: '┞',\n\tlineUpDoubleDownDoubleRightDouble: '╠',\n\tlineUpDoubleDownDoubleRight: '╟',\n\tlineUpDownRightDouble: '╞',\n\tlineDownLeftRight: '┬',\n\tlineDownBoldLeftBoldRightBold: '┳',\n\tlineDownLeftBoldRightBold: '┯',\n\tlineDownBoldLeftRight: '┰',\n\tlineDownBoldLeftBoldRight: '┱',\n\tlineDownBoldLeftRightBold: '┲',\n\tlineDownLeftRightBold: '┮',\n\tlineDownLeftBoldRight: '┭',\n\tlineDownDoubleLeftDoubleRightDouble: '╦',\n\tlineDownDoubleLeftRight: '╥',\n\tlineDownLeftDoubleRightDouble: '╤',\n\tlineUpLeftRight: '┴',\n\tlineUpBoldLeftBoldRightBold: '┻',\n\tlineUpLeftBoldRightBold: '┷',\n\tlineUpBoldLeftRight: '┸',\n\tlineUpBoldLeftBoldRight: '┹',\n\tlineUpBoldLeftRightBold: '┺',\n\tlineUpLeftRightBold: '┶',\n\tlineUpLeftBoldRight: '┵',\n\tlineUpDoubleLeftDoubleRightDouble: '╩',\n\tlineUpDoubleLeftRight: '╨',\n\tlineUpLeftDoubleRightDouble: '╧',\n\tlineUpDownLeftRight: '┼',\n\tlineUpBoldDownBoldLeftBoldRightBold: '╋',\n\tlineUpDownBoldLeftBoldRightBold: '╈',\n\tlineUpBoldDownLeftBoldRightBold: '╇',\n\tlineUpBoldDownBoldLeftRightBold: '╊',\n\tlineUpBoldDownBoldLeftBoldRight: '╉',\n\tlineUpBoldDownLeftRight: '╀',\n\tlineUpDownBoldLeftRight: '╁',\n\tlineUpDownLeftBoldRight: '┽',\n\tlineUpDownLeftRightBold: '┾',\n\tlineUpBoldDownBoldLeftRight: '╂',\n\tlineUpDownLeftBoldRightBold: '┿',\n\tlineUpBoldDownLeftBoldRight: '╃',\n\tlineUpBoldDownLeftRightBold: '╄',\n\tlineUpDownBoldLeftBoldRight: '╅',\n\tlineUpDownBoldLeftRightBold: '╆',\n\tlineUpDoubleDownDoubleLeftDoubleRightDouble: '╬',\n\tlineUpDoubleDownDoubleLeftRight: '╫',\n\tlineUpDownLeftDoubleRightDouble: '╪',\n\tlineCross: '╳',\n\tlineBackslash: '╲',\n\tlineSlash: '╱',\n};\n\nconst specialMainSymbols = {\n\ttick: '✔',\n\tinfo: 'ℹ',\n\twarning: '⚠',\n\tcross: '✘',\n\tsquareSmall: '◻',\n\tsquareSmallFilled: '◼',\n\tcircle: '◯',\n\tcircleFilled: '◉',\n\tcircleDotted: '◌',\n\tcircleDouble: '◎',\n\tcircleCircle: 'ⓞ',\n\tcircleCross: 'ⓧ',\n\tcirclePipe: 'Ⓘ',\n\tradioOn: '◉',\n\tradioOff: '◯',\n\tcheckboxOn: '☒',\n\tcheckboxOff: '☐',\n\tcheckboxCircleOn: 'ⓧ',\n\tcheckboxCircleOff: 'Ⓘ',\n\tpointer: '❯',\n\ttriangleUpOutline: '△',\n\ttriangleLeft: '◀',\n\ttriangleRight: '▶',\n\tlozenge: '◆',\n\tlozengeOutline: '◇',\n\thamburger: '☰',\n\tsmiley: '㋡',\n\tmustache: '෴',\n\tstar: '★',\n\tplay: '▶',\n\tnodejs: '⬢',\n\toneSeventh: '⅐',\n\toneNinth: '⅑',\n\toneTenth: '⅒',\n};\n\nconst specialFallbackSymbols = {\n\ttick: '√',\n\tinfo: 'i',\n\twarning: '‼',\n\tcross: '×',\n\tsquareSmall: '□',\n\tsquareSmallFilled: '■',\n\tcircle: '( )',\n\tcircleFilled: '(*)',\n\tcircleDotted: '( )',\n\tcircleDouble: '( )',\n\tcircleCircle: '(○)',\n\tcircleCross: '(×)',\n\tcirclePipe: '(│)',\n\tradioOn: '(*)',\n\tradioOff: '( )',\n\tcheckboxOn: '[×]',\n\tcheckboxOff: '[ ]',\n\tcheckboxCircleOn: '(×)',\n\tcheckboxCircleOff: '( )',\n\tpointer: '>',\n\ttriangleUpOutline: '∆',\n\ttriangleLeft: '◄',\n\ttriangleRight: '►',\n\tlozenge: '♦',\n\tlozengeOutline: '◊',\n\thamburger: '≡',\n\tsmiley: '☺',\n\tmustache: '┌─┐',\n\tstar: '✶',\n\tplay: '►',\n\tnodejs: '♦',\n\toneSeventh: '1/7',\n\toneNinth: '1/9',\n\toneTenth: '1/10',\n};\n\nexport const mainSymbols = {...common, ...specialMainSymbols};\nexport const fallbackSymbols = {...common, ...specialFallbackSymbols};\n\nconst shouldUseMain = isUnicodeSupported();\nconst figures = shouldUseMain ? mainSymbols : fallbackSymbols;\nexport default figures;\n\nconst replacements = Object.entries(specialMainSymbols);\n\n// On terminals which do not support Unicode symbols, substitute them to other symbols\nexport const replaceSymbols = (string, {useFallback = !shouldUseMain} = {}) => {\n\tif (useFallback) {\n\t\tfor (const [key, mainSymbol] of replacements) {\n\t\t\tstring = string.replaceAll(mainSymbol, fallbackSymbols[key]);\n\t\t}\n\t}\n\n\treturn string;\n};\n","// oxlint-disable-next-line no-restricted-imports -- this is the only place we're allowed to import figures\nimport figures, { mainSymbols } from \"figures\";\nimport isUnicodeSupported from \"is-unicode-supported\";\n\nimport { config } from \"../config/config.ts\";\nimport { env } from \"../config/env.ts\";\n\n// we always use main symbols in tests rather than figures so that our\n// tests are consistent across platforms (particularly Windows)\nexport const symbol = { ...(env.testLike ? mainSymbols : figures) };\n\nif (isUnicodeSupported() && config.windowsOrWsl) {\n // when unicode is supported and we're on windows or wsl, these\n // symbols end up rendering over two cells while only taking up one,\n // so we add an extra space to each of them to make them take up two\n for (const name of [\"tick\", \"cross\"] as const) {\n symbol[name] += \" \";\n }\n}\n","import assert from \"node:assert\";\nimport EventEmitter from \"node:events\";\nimport process from \"node:process\";\nimport readline from \"node:readline\";\n\nimport ansiEscapes from \"ansi-escapes\";\n\nimport { output } from \"./output.ts\";\n\n/**\n * Inspired by `prompts`:\n * https://github.com/terkelg/prompts/blob/e0519913ec4fcc6746bb3d97d8cd0960c3f3ffde/lib/elements/prompt.js\n *\n * MIT License\n *\n * Copyright (c) 2018 Terkel Gjervig Nielsen\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nexport class Prompt extends EventEmitter {\n // oxlint-disable-next-line no-explicit-any\n [action: string]: any; // (key: StdinKey) => void;\n\n static active = false;\n\n // state\n value: unknown = undefined;\n firstRender = true;\n done = false;\n closed = false;\n aborted = false;\n exited = false;\n\n // methods that rely on constructor closure\n close: () => void;\n\n constructor() {\n super();\n assert(!Prompt.active, \"only one prompt can be active at a time\");\n Prompt.active = true;\n\n const rl = readline.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });\n readline.emitKeypressEvents(process.stdin, rl);\n\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(true);\n }\n\n const keypress = (str: string, key: StdinKey): void => {\n const action = getPromptAction(key);\n if (action === false) {\n this._(str, key);\n } else if (action && typeof this[action] === \"function\") {\n // oxlint-disable-next-line no-unsafe-call\n this[action](key);\n } else {\n this.bell();\n }\n };\n\n this.close = () => {\n process.stdin.removeListener(\"keypress\", keypress);\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(false);\n }\n\n rl.close();\n this.emit(this.aborted ? \"abort\" : this.exited ? \"exit\" : \"submit\", this.value);\n this.closed = true;\n Prompt.active = false;\n };\n\n process.stdin.on(\"keypress\", keypress);\n }\n\n _(_str: string, _key: StdinKey): void {\n // noop\n }\n\n onRender(): void {\n // noop\n }\n\n fire(): void {\n this.emit(\"state\", {\n value: this.value,\n aborted: this.aborted,\n exited: this.exited,\n });\n }\n\n bell(): void {\n output.writeStdout(ansiEscapes.beep);\n }\n\n render(): void {\n this.onRender();\n if (this.firstRender) {\n this.firstRender = false;\n }\n }\n}\n\nexport type PromptAction =\n | \"abort\"\n | \"exit\"\n | \"submit\"\n | \"next\"\n | \"nextPage\"\n | \"prevPage\"\n | \"home\"\n | \"end\"\n | \"up\"\n | \"down\"\n | \"right\"\n | \"left\"\n | \"reset\"\n | \"delete\"\n | \"deleteForward\"\n | \"first\"\n | \"last\";\n\nexport type StdinKey = {\n name: string;\n ctrl: boolean;\n meta: boolean;\n};\n\nconst getPromptAction = (key: StdinKey): PromptAction | false | undefined => {\n if (key.meta && key.name !== \"escape\") {\n return;\n }\n\n if (key.ctrl) {\n switch (key.name) {\n case \"a\":\n return \"first\";\n case \"c\":\n case \"d\":\n return \"abort\";\n case \"e\":\n return \"last\";\n case \"g\":\n return \"reset\";\n default:\n return;\n }\n }\n\n switch (key.name) {\n case \"return\":\n case \"enter\":\n return \"submit\";\n case \"backspace\":\n return \"delete\";\n case \"delete\":\n return \"deleteForward\";\n case \"abort\":\n return \"abort\";\n case \"escape\":\n return \"exit\";\n case \"tab\":\n return \"next\";\n case \"pagedown\":\n return \"nextPage\";\n case \"pageup\":\n return \"prevPage\";\n case \"home\":\n return \"home\";\n case \"end\":\n return \"end\";\n case \"up\":\n return \"up\";\n case \"down\":\n return \"down\";\n case \"right\":\n return \"right\";\n case \"left\":\n return \"left\";\n default:\n return false;\n }\n};\n\n/**\n * Determine what entries should be displayed on the screen, based on the\n * currently selected index and the maximum visible. Used in list-based\n * prompts like `select` and `multiselect`.\n *\n * @param cursor - the currently selected entry\n * @param total - the total entries available to display\n * @param [maxVisible] - the number of entries that can be displayed\n */\nexport const entriesToDisplay = (cursor: number, total: number, maxVisible: number): { startIndex: number; endIndex: number } => {\n maxVisible = maxVisible || total;\n\n let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));\n if (startIndex < 0) {\n startIndex = 0;\n }\n\n const endIndex = Math.min(startIndex + maxVisible, total);\n\n return { startIndex, endIndex };\n};\n"],"x_google_ignoreList":[0,1,2,3],"mappings":"8LAEA,MAAa,EAAY,WAAW,QAAQ,WAAa,IAAA,GAEnC,WAAW,SAAS,UAAU,KAE/B,WAAW,SAAS,UAAU,IAE7B,WAAW,MAAM,SAAS,KAEtB,WAAW,SAAS,UAAU,SAEjC,WAAW,WAAW,WAAW,SAAS,QAAQ,CAE9C,OAAO,kBAAsB,KAAe,sBAAsB,kBAE5D,OAAO,2BAA+B,KAAe,sBAAsB,2BAE9E,OAAO,wBAA4B,KAAe,sBAAsB,wBAEvE,OAAO,yBAA6B,KAAe,sBAAsB,yBAGxG,MAAMA,EAAW,WAAW,WAAW,eAAe,SAE/BA,IAAa,SAChC,WAAW,WAAW,WAAa,YACnC,WAAW,WAAW,WAAW,SAAS,QAAQ,GAAK,IACvD,WAAW,SAAS,SAECA,IAAa,WAClC,WAAW,WAAW,WAAa,SACnC,WAAW,SAAS,SAEDA,IAAa,SAChC,WAAW,WAAW,UAAU,WAAW,QAAQ,GAAK,IACxD,WAAW,WAAW,WAAW,SAAS,UAAU,GAAK,IACzD,WAAW,SAAS,SAEHA,IAAa,OAC7B,WAAW,WAAW,WAAa,YAAc,WAAW,WAAW,eAAiB,GACzF,mBAAmB,KAAK,WAAW,WAAW,SAAS,CAElCA,IAAa,WAClC,WAAW,WAAW,WAAa,WACnC,WAAW,WAAW,WAAW,SAAS,YAAY,GAAK,IAC3D,WAAW,SAAS,SCrCF,CAAC,GAAa,EAAQ,IAAI,aALhD,MAMM,EAAY,CAAC,GAAa,EAAQ,WAAa,QAC/C,EAAS,CAAC,IAAc,EAAQ,I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K,OACH,MAAO,OACT,QACE,MAAO,MAaA,GAAoB,EAAgB,EAAe,IAAiE,CAC/H,IAA2B,EAE3B,IAAI,EAAa,KAAK,IAAI,EAAQ,EAAY,EAAS,KAAK,MAAM,EAAa,EAAE,CAAC,CAC9E,EAAa,IACf,EAAa,GAGf,IAAM,EAAW,KAAK,IAAI,EAAa,EAAY,EAAM,CAEzD,MAAO,CAAE,aAAY,WAAU"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import"./ms-B7sMc0pR.js";import"./src-DxCC1MV4.js";import"./prompt-C9nwJW0G.js";import{j as e,s as t}from"./http-CY3lPMkt.js";import{E as n,c as r,n as i}from"./command-2iNTc5dV.js";import{t as a}from"./filesync-De6asZeR.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{n as o,r as s,t as c}from"./sync-json-V52OzeCz.js";import"./select-Dey_sjjd.js";import"./spinner-BVmbgIil.js";import"./table-MrBbxMay.js";var l=i({name:`pull`,description:`Download environment files to your local directory`,details:n`
|
|
2
|
+
Downloads all environment file changes since the last sync to your local directory. If
|
|
3
|
+
you also have local changes since the last sync, you'll be prompted to discard those
|
|
4
|
+
local changes or abort. Use --force to skip the prompt and discard automatically.
|
|
5
|
+
`,sections:[{title:`See Also`,content:`ggt push — Upload local file changes to Gadget.
|
|
6
|
+
ggt dev — Bidirectional file sync with real-time watching.`}],examples:[`ggt pull`,`ggt pull --env staging`,`ggt pull --env production --force`],flags:{...o,"--environment":{...t,alias:[`-e`,`--env`,`--from`],description:`Environment to pull from`,details:`Defaults to the development environment recorded in .gadget/sync.json.`},"--force":{type:Boolean,alias:`-f`,description:`Pull without prompting, discarding local changes`,details:`Any local changes since the last sync are overwritten by the environment's files.`}},run:async(t,i)=>{if(i._.length>0)throw new e(n`
|
|
7
|
+
"ggt pull" does not take any positional arguments.
|
|
8
|
+
|
|
9
|
+
If you are trying to pull changes to a specific directory,
|
|
10
|
+
you must "cd" to that directory and then run "ggt pull".
|
|
11
|
+
`);let o=await s(process.cwd()),l=new a(await c.loadOrAskAndInit(t,{command:`pull`,flags:i,directory:o})),u=await l.hashes(t);if(u.environmentChangesToPull.size===0){r({ensureEmptyLineAbove:!0,content:`Nothing to pull.`});return}u.localChangesToPush.size>0&&await l.print(t,{hashes:u}),await l.pull(t,{hashes:u,force:i[`--force`]})}});export{l as default};
|
|
12
|
+
//# sourceMappingURL=pull-DpizmJGk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull-DpizmJGk.js","names":[],"sources":["../src/commands/pull.ts"],"sourcesContent":["import { EnvArg } from \"../services/app/app.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport { FlagError } from \"../services/command/flag.ts\";\nimport { FileSync } from \"../services/filesync/filesync.ts\";\nimport { SyncJson, SyncJsonFlags, loadSyncJsonDirectory } from \"../services/filesync/sync-json.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\n\nexport default defineCommand({\n name: \"pull\",\n description: \"Download environment files to your local directory\",\n details: sprint`\n Downloads all environment file changes since the last sync to your local directory. If\n you also have local changes since the last sync, you'll be prompted to discard those\n local changes or abort. Use --force to skip the prompt and discard automatically.\n `,\n sections: [\n {\n title: \"See Also\",\n content: \"ggt push — Upload local file changes to Gadget.\\nggt dev — Bidirectional file sync with real-time watching.\",\n },\n ],\n examples: [\"ggt pull\", \"ggt pull --env staging\", \"ggt pull --env production --force\"],\n flags: {\n ...SyncJsonFlags,\n \"--environment\": {\n ...EnvArg,\n alias: [\"-e\", \"--env\", \"--from\"],\n description: \"Environment to pull from\",\n details: \"Defaults to the development environment recorded in .gadget/sync.json.\",\n },\n \"--force\": {\n type: Boolean,\n alias: \"-f\",\n description: \"Pull without prompting, discarding local changes\",\n details: \"Any local changes since the last sync are overwritten by the environment's files.\",\n },\n },\n run: async (ctx, flags) => {\n if (flags._.length > 0) {\n throw new FlagError(\n sprint`\n \"ggt pull\" does not take any positional arguments.\n\n If you are trying to pull changes to a specific directory,\n you must \"cd\" to that directory and then run \"ggt pull\".\n `,\n );\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.loadOrAskAndInit(ctx, { command: \"pull\", flags, directory });\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n\n if (hashes.environmentChangesToPull.size === 0) {\n println({ ensureEmptyLineAbove: true, content: \"Nothing to pull.\" });\n return;\n }\n\n if (hashes.localChangesToPush.size > 0) {\n // show them the local changes they will discard\n await filesync.print(ctx, { hashes });\n }\n\n await filesync.pull(ctx, { hashes, force: flags[\"--force\"] });\n },\n});\n"],"mappings":"idAQA,IAAA,EAAe,EAAc,CAC3B,KAAM,OACN,YAAa,qDACb,QAAS,CAAM;;;;IAKf,SAAU,CACR,CACE,MAAO,WACP,QAAS;4DACV,CACF,CACD,SAAU,CAAC,WAAY,yBAA0B,oCAAoC,CACrF,MAAO,CACL,GAAG,EACH,gBAAiB,CACf,GAAG,EACH,MAAO,CAAC,KAAM,QAAS,SAAS,CAChC,YAAa,2BACb,QAAS,yEACV,CACD,UAAW,CACT,KAAM,QACN,MAAO,KACP,YAAa,mDACb,QAAS,oFACV,CACF,CACD,IAAK,MAAO,EAAK,IAAU,CACzB,GAAI,EAAM,EAAE,OAAS,EACnB,MAAM,IAAI,EACR,CAAM;;;;;UAMP,CAGH,IAAM,EAAY,MAAM,EAAsB,QAAQ,KAAK,CAAC,CAEtD,EAAW,IAAI,EADJ,MAAM,EAAS,iBAAiB,EAAK,CAAE,QAAS,OAAQ,QAAO,YAAW,CAAC,CACrD,CACjC,EAAS,MAAM,EAAS,OAAO,EAAI,CAEzC,GAAI,EAAO,yBAAyB,OAAS,EAAG,CAC9C,EAAQ,CAAE,qBAAsB,GAAM,QAAS,mBAAoB,CAAC,CACpE,OAGE,EAAO,mBAAmB,KAAO,GAEnC,MAAM,EAAS,MAAM,EAAK,CAAE,SAAQ,CAAC,CAGvC,MAAM,EAAS,KAAK,EAAK,CAAE,SAAQ,MAAO,EAAM,WAAY,CAAC,EAEhE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import"./ms-B7sMc0pR.js";import"./src-DxCC1MV4.js";import"./prompt-C9nwJW0G.js";import{g as e,j as t,s as n}from"./http-CY3lPMkt.js";import{E as r,c as i,n as a,s as o}from"./command-2iNTc5dV.js";import{t as s}from"./filesync-De6asZeR.js";import"./collection-C2TCeYqY.js";import"./directory-CNL03L6c.js";import"./session-BmzGF1t7.js";import{n as c,r as l,t as u}from"./sync-json-V52OzeCz.js";import"./select-Dey_sjjd.js";import"./spinner-BVmbgIil.js";import"./table-MrBbxMay.js";var d=a({name:`push`,description:`Upload local file changes to Gadget`,details:r`
|
|
2
|
+
Uploads all local file changes since the last sync to your Gadget environment. If the
|
|
3
|
+
environment also has changes since the last sync, you'll be prompted to discard those
|
|
4
|
+
environment changes or abort. Use --force to skip the prompt and discard automatically.
|
|
5
|
+
`,sections:[{title:`See Also`,content:`ggt pull — Download environment files.
|
|
6
|
+
ggt dev — Bidirectional file sync with real-time watching.`}],examples:[`ggt push`,`ggt push --env main`,`ggt push --env main --force`],flags:{...c,"--environment":{...n,alias:[`-e`,`--env`,`--to`],description:`Environment to push to`,details:`Defaults to the development environment recorded in .gadget/sync.json. Production cannot be pushed to.`},"--force":{type:Boolean,alias:`-f`,description:`Push without prompting, discarding environment changes`,details:`Any changes on the environment since the last sync are overwritten by your local files.`}},run:async(n,a)=>{if(a._.length>0)throw new t(r`
|
|
7
|
+
"ggt push" does not take any positional arguments.
|
|
8
|
+
|
|
9
|
+
If you are trying to push changes from a specific directory,
|
|
10
|
+
you must "cd" to that directory and then run "ggt push".
|
|
11
|
+
`);let c=await l(process.cwd()),d=new s(await u.loadOrAskAndInit(n,{command:`push`,flags:a,directory:c})),f=await d.hashes(n);if(f.localChangesToPush.size===0){i({ensureEmptyLineAbove:!0,content:`Nothing to push.`});return}f.environmentChanges.size>0&&!f.onlyDotGadgetFilesChanged&&(await d.print(n,{hashes:f}),a[`--force`]||await e({ensureEmptyLineAbove:!0,content:r`Are you sure you want to ${o.emphasis(`discard`)} your environment's changes?`})),await d.push(n,{command:`push`,hashes:f})}});export{d as default};
|
|
12
|
+
//# sourceMappingURL=push-67KBCw6c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-67KBCw6c.js","names":["colors"],"sources":["../src/commands/push.ts"],"sourcesContent":["import { EnvArg } from \"../services/app/app.ts\";\nimport { defineCommand } from \"../services/command/command.ts\";\nimport { FlagError } from \"../services/command/flag.ts\";\nimport { FileSync } from \"../services/filesync/filesync.ts\";\nimport { SyncJson, SyncJsonFlags, loadSyncJsonDirectory } from \"../services/filesync/sync-json.ts\";\nimport colors from \"../services/output/colors.ts\";\nimport { confirm } from \"../services/output/confirm.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\n\nexport default defineCommand({\n name: \"push\",\n description: \"Upload local file changes to Gadget\",\n details: sprint`\n Uploads all local file changes since the last sync to your Gadget environment. If the\n environment also has changes since the last sync, you'll be prompted to discard those\n environment changes or abort. Use --force to skip the prompt and discard automatically.\n `,\n sections: [\n {\n title: \"See Also\",\n content: \"ggt pull — Download environment files.\\nggt dev — Bidirectional file sync with real-time watching.\",\n },\n ],\n examples: [\"ggt push\", \"ggt push --env main\", \"ggt push --env main --force\"],\n flags: {\n ...SyncJsonFlags,\n \"--environment\": {\n ...EnvArg,\n alias: [\"-e\", \"--env\", \"--to\"],\n description: \"Environment to push to\",\n details: \"Defaults to the development environment recorded in .gadget/sync.json. Production cannot be pushed to.\",\n },\n \"--force\": {\n type: Boolean,\n alias: \"-f\",\n description: \"Push without prompting, discarding environment changes\",\n details: \"Any changes on the environment since the last sync are overwritten by your local files.\",\n },\n },\n run: async (ctx, flags) => {\n if (flags._.length > 0) {\n throw new FlagError(\n sprint`\n \"ggt push\" does not take any positional arguments.\n\n If you are trying to push changes from a specific directory,\n you must \"cd\" to that directory and then run \"ggt push\".\n `,\n );\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.loadOrAskAndInit(ctx, { command: \"push\", flags, directory });\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n\n if (hashes.localChangesToPush.size === 0) {\n println({ ensureEmptyLineAbove: true, content: \"Nothing to push.\" });\n return;\n }\n\n if (hashes.environmentChanges.size > 0 && !hashes.onlyDotGadgetFilesChanged) {\n // show them the environment changes they will discard\n await filesync.print(ctx, { hashes });\n\n if (!flags[\"--force\"]) {\n // they didn't pass --force, so we need to ask them if they want to discard the environment changes\n await confirm({\n ensureEmptyLineAbove: true,\n content: sprint`Are you sure you want to ${colors.emphasis(\"discard\")} your environment's changes?`,\n });\n }\n }\n\n await filesync.push(ctx, { command: \"push\", hashes });\n },\n});\n"],"mappings":"+dAUA,IAAA,EAAe,EAAc,CAC3B,KAAM,OACN,YAAa,sCACb,QAAS,CAAM;;;;IAKf,SAAU,CACR,CACE,MAAO,WACP,QAAS;4DACV,CACF,CACD,SAAU,CAAC,WAAY,sBAAuB,8BAA8B,CAC5E,MAAO,CACL,GAAG,EACH,gBAAiB,CACf,GAAG,EACH,MAAO,CAAC,KAAM,QAAS,OAAO,CAC9B,YAAa,yBACb,QAAS,yGACV,CACD,UAAW,CACT,KAAM,QACN,MAAO,KACP,YAAa,yDACb,QAAS,0FACV,CACF,CACD,IAAK,MAAO,EAAK,IAAU,CACzB,GAAI,EAAM,EAAE,OAAS,EACnB,MAAM,IAAI,EACR,CAAM;;;;;UAMP,CAGH,IAAM,EAAY,MAAM,EAAsB,QAAQ,KAAK,CAAC,CAEtD,EAAW,IAAI,EADJ,MAAM,EAAS,iBAAiB,EAAK,CAAE,QAAS,OAAQ,QAAO,YAAW,CAAC,CACrD,CACjC,EAAS,MAAM,EAAS,OAAO,EAAI,CAEzC,GAAI,EAAO,mBAAmB,OAAS,EAAG,CACxC,EAAQ,CAAE,qBAAsB,GAAM,QAAS,mBAAoB,CAAC,CACpE,OAGE,EAAO,mBAAmB,KAAO,GAAK,CAAC,EAAO,4BAEhD,MAAM,EAAS,MAAM,EAAK,CAAE,SAAQ,CAAC,CAEhC,EAAM,YAET,MAAM,EAAQ,CACZ,qBAAsB,GACtB,QAAS,CAAM,4BAA4BA,EAAO,SAAS,UAAU,CAAC,8BACvE,CAAC,EAIN,MAAM,EAAS,KAAK,EAAK,CAAE,QAAS,OAAQ,SAAQ,CAAC,EAExD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{o as e}from"./chunk-BjEoQXZ0.js";import{F as t,J as n,N as r,R as i,S as a,_ as o,b as s,q as c,v as l,x as u,y as d}from"./http-CY3lPMkt.js";import{E as f,_ as p,a as m,c as h,i as g,j as _,o as v,r as y,s as b,t as x,vt as S}from"./command-2iNTc5dV.js";import{t as C}from"./collection-C2TCeYqY.js";import{n as w}from"./update-CfxiL08e.js";var T=e(i(),1);const E={"--help":{type:Boolean,alias:`-h`,description:`Show command help`,details:`Use -h for a compact summary. Use --help for expanded descriptions including flag details.`},"--version":{type:Boolean,description:`Print the ggt version`,details:`Prints the currently installed ggt version string and exits. Same output as ggt version.`},"--verbose":{type:T.default.COUNT,alias:[`-v`,t(`--debug`)],description:`Increase output verbosity (-vv for debug, -vvv for trace)`,details:`Each -v increases the log level: -v shows info messages, -vv enables debug output, and -vvv enables full trace logging.`},"--telemetry":{type:Boolean,description:`Enable telemetry`,details:`Sends anonymous error reports to help improve ggt. Enabled by default. Use ggt configure to persist this setting.`},"--json":{type:Boolean,description:`Output as JSON where supported`,details:`Formats all output as newline-delimited JSON instead of human-readable text. Useful for scripting and piping ggt output to other tools.`},"--__complete":{type:Boolean,hidden:!0}},D=async(e=`-h`)=>{let t=await m(),n=r(E).filter(e=>!e.hidden),i;if(e===`--help`)i=O(n);else{let e=Math.max(0,...n.map(e=>l(e).length+2));i=n.map(t=>u(t,e,0)).join(`
|
|
2
|
+
`)}return f`
|
|
3
|
+
The command-line interface for Gadget.
|
|
4
|
+
|
|
5
|
+
${b.header(`USAGE`)}
|
|
6
|
+
ggt [command]
|
|
7
|
+
|
|
8
|
+
${b.header(`COMMANDS`)}
|
|
9
|
+
${t}
|
|
10
|
+
|
|
11
|
+
${b.header(`FLAGS`)}
|
|
12
|
+
${i}
|
|
13
|
+
|
|
14
|
+
Use ${b.hint(`-h`)} for a summary, ${b.hint(`--help`)} for full details.
|
|
15
|
+
|
|
16
|
+
Documentation: https://docs.gadget.dev/guides/cli
|
|
17
|
+
Issues: https://github.com/gadget-inc/ggt/issues
|
|
18
|
+
`},O=e=>e.map(e=>{let t=d(e),n=s(e),r=`${b.identifier.bold(t)}${n?b.placeholder(n):``}`,i=e.description;return e.details&&(i=`${i.endsWith(`.`)?i:`${i}.`} ${e.details}`),` ${r}\n${a(i,` `.repeat(8),80).join(`
|
|
19
|
+
`)}`}).join(`
|
|
20
|
+
|
|
21
|
+
`),k=async(e,t)=>{let r=e.child({name:`root`});if(t[`--__complete`]){let{handleCompletionRequest:e}=await import(`./handler-DZyG8Sel.js`);await e(r,t._),process.exit(0)}if(t[`--version`]&&(h(_.version),process.exit(0)),t[`--json`]&&(process.env.GGT_LOG_FORMAT=`json`),t[`--verbose`]&&(process.env.GGT_LOG_LEVEL=p(t[`--verbose`]).toString()),await w(r)){let{warnIfUpdateAvailable:e}=await import(`./update-iyhnL9-M.js`);await e(r)}let i=t._.shift();if(S(i)&&(h(await D(t[`--help`]?process.argv.includes(`-h`)&&!process.argv.includes(`--help`)?`-h`:`--help`:`-h`)),process.exit(0)),i===`help`){let e=t._.shift();S(e)&&(h(await D(`--help`)),process.exit(0)),i=e,t[`--help`]=!0}if(!g(i)){let e=await v(i);e&&(i=e)}g(i)||(h`
|
|
22
|
+
Unknown command ${b.warning(i)}
|
|
23
|
+
|
|
24
|
+
Did you mean ${b.identifier(C(i,x))}?
|
|
25
|
+
|
|
26
|
+
Run ${b.hint(`ggt --help`)} for usage
|
|
27
|
+
`,process.exit(1));let a=await y(i);n({command:i});let s=t[`--help`]?process.argv.includes(`-h`)&&!process.argv.includes(`--help`)?`-h`:`--help`:void 0;if(s){await o(r.child({name:a.name}),a,s,...t._);return}try{await o(r.child({name:a.name}),a,...t._)}catch(e){await c(r,e)}};export{k as n,E as t};
|
|
28
|
+
//# sourceMappingURL=root-D_UnUsp7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root-D_UnUsp7.js","names":["arg","colors"],"sources":["../src/commands/root.ts"],"sourcesContent":["import arg from \"arg\";\n\nimport { Commands, importCommand, isCommand, renderCommandList, resolveCommandAlias } from \"../services/command/command.ts\";\nimport type { Context } from \"../services/command/context.ts\";\nimport { extractFlags, hidden, type FlagsDefinition, type FlagsResult, type FlagDef } from \"../services/command/flag.ts\";\nimport { runCommand } from \"../services/command/run.ts\";\nimport { flagLeft, flagNamePrefix, flagValueSuffix, formatFlag, wrapText } from \"../services/command/usage.ts\";\nimport colors from \"../services/output/colors.ts\";\nimport { verbosityToLevel } from \"../services/output/log/level.ts\";\nimport { println } from \"../services/output/print.ts\";\nimport { reportErrorAndExit } from \"../services/output/report.ts\";\nimport { setSentryTags } from \"../services/output/sentry.ts\";\nimport { sprint } from \"../services/output/sprint.ts\";\nimport { shouldCheckForUpdate } from \"../services/output/update.ts\";\nimport { closestMatch } from \"../services/util/collection.ts\";\nimport { isNil } from \"../services/util/is.ts\";\nimport { packageJson } from \"../services/util/package-json.ts\";\n\nexport type RootFlags = typeof flags;\nexport type RootFlagsResult = FlagsResult<RootFlags>;\n\n// root.ts is intentionally not converted to defineCommand because it is the\n// dispatch entry point that resolves and delegates to sub-commands, not a\n// standard sub-command itself.\nexport const flags = {\n \"--help\": {\n type: Boolean,\n alias: \"-h\",\n description: \"Show command help\",\n details: \"Use -h for a compact summary. Use --help for expanded descriptions including flag details.\",\n },\n \"--version\": {\n type: Boolean,\n description: \"Print the ggt version\",\n details: \"Prints the currently installed ggt version string and exits. Same output as ggt version.\",\n },\n \"--verbose\": {\n type: arg.COUNT,\n alias: [\"-v\", hidden(\"--debug\")],\n description: \"Increase output verbosity (-vv for debug, -vvv for trace)\",\n details: \"Each -v increases the log level: -v shows info messages, -vv enables debug output, and -vvv enables full trace logging.\",\n },\n \"--telemetry\": {\n type: Boolean,\n description: \"Enable telemetry\",\n details: \"Sends anonymous error reports to help improve ggt. Enabled by default. Use ggt configure to persist this setting.\",\n },\n \"--json\": {\n type: Boolean,\n description: \"Output as JSON where supported\",\n details:\n \"Formats all output as newline-delimited JSON instead of human-readable text. Useful for scripting and piping ggt output to other tools.\",\n },\n \"--__complete\": {\n type: Boolean,\n hidden: true,\n },\n} satisfies FlagsDefinition;\n\nexport const usage = async (helpLevel: \"-h\" | \"--help\" = \"-h\"): Promise<string> => {\n const commandList = await renderCommandList();\n\n const visibleFlags = extractFlags(flags).filter((f) => !f.hidden);\n let flagLines: string;\n\n if (helpLevel === \"--help\") {\n flagLines = renderExpandedFlags(visibleFlags);\n } else {\n const maxLeft = Math.max(0, ...visibleFlags.map((f) => flagLeft(f).length + 2));\n flagLines = visibleFlags.map((f) => formatFlag(f, maxLeft, 0)).join(\"\\n\");\n }\n\n return sprint`\n The command-line interface for Gadget.\n\n ${colors.header(\"USAGE\")}\n ggt [command]\n\n ${colors.header(\"COMMANDS\")}\n ${commandList}\n\n ${colors.header(\"FLAGS\")}\n ${flagLines}\n\n Use ${colors.hint(\"-h\")} for a summary, ${colors.hint(\"--help\")} for full details.\n\n Documentation: https://docs.gadget.dev/guides/cli\n Issues: https://github.com/gadget-inc/ggt/issues\n `;\n};\n\nconst renderExpandedFlags = (flags: FlagDef[]): string => {\n return flags\n .map((f) => {\n const name = flagNamePrefix(f);\n const value = flagValueSuffix(f);\n const styledLeft = `${colors.identifier.bold(name)}${value ? colors.placeholder(value) : \"\"}`;\n let desc = f.description;\n if (f.details) {\n desc = `${desc.endsWith(\".\") ? desc : `${desc}.`} ${f.details}`;\n }\n const wrapped = wrapText(desc, \" \".repeat(8), 80).join(\"\\n\");\n return ` ${styledLeft}\\n${wrapped}`;\n })\n .join(\"\\n\\n\");\n};\n\nexport const run = async (parent: Context, rootFlags: RootFlagsResult): Promise<void> => {\n const ctx = parent.child({ name: \"root\" });\n\n if (rootFlags[\"--__complete\"]) {\n const { handleCompletionRequest } = await import(\"../services/completion/handler.ts\");\n await handleCompletionRequest(ctx, rootFlags._);\n process.exit(0);\n }\n\n if (rootFlags[\"--version\"]) {\n println(packageJson.version);\n process.exit(0);\n }\n\n if (rootFlags[\"--json\"]) {\n process.env[\"GGT_LOG_FORMAT\"] = \"json\";\n }\n\n if (rootFlags[\"--verbose\"]) {\n process.env[\"GGT_LOG_LEVEL\"] = verbosityToLevel(rootFlags[\"--verbose\"]).toString();\n }\n\n if (await shouldCheckForUpdate(ctx)) {\n const { warnIfUpdateAvailable } = await import(\"../services/output/update.ts\");\n await warnIfUpdateAvailable(ctx);\n }\n\n let commandName = rootFlags._.shift();\n if (isNil(commandName)) {\n const helpLevel = rootFlags[\"--help\"] ? (process.argv.includes(\"-h\") && !process.argv.includes(\"--help\") ? \"-h\" : \"--help\") : \"-h\";\n println(await usage(helpLevel));\n process.exit(0);\n }\n\n // handle `ggt help [command]`\n if (commandName === \"help\") {\n const helpTarget = rootFlags._.shift();\n if (isNil(helpTarget)) {\n println(await usage(\"--help\"));\n process.exit(0);\n }\n // treat as `ggt <command> --help`\n commandName = helpTarget;\n rootFlags[\"--help\"] = true;\n }\n\n if (!isCommand(commandName)) {\n // Try to resolve as a command alias\n const resolved = await resolveCommandAlias(commandName);\n if (resolved) {\n commandName = resolved;\n }\n }\n\n if (!isCommand(commandName)) {\n println`\n Unknown command ${colors.warning(commandName)}\n\n Did you mean ${colors.identifier(closestMatch(commandName, Commands))}?\n\n Run ${colors.hint(\"ggt --help\")} for usage\n `;\n process.exit(1);\n }\n\n const command = await importCommand(commandName);\n setSentryTags({ command: commandName });\n\n // handle root-level help flags before the error-catching boundary so\n // process.exit(0) is not caught and misinterpreted as a command failure\n const helpFlag = rootFlags[\"--help\"] ? (process.argv.includes(\"-h\") && !process.argv.includes(\"--help\") ? \"-h\" : \"--help\") : undefined;\n if (helpFlag) {\n await runCommand(ctx.child({ name: command.name }), command, helpFlag, ...rootFlags._);\n return;\n }\n\n try {\n await runCommand(ctx.child({ name: command.name }), command, ...rootFlags._);\n } catch (error) {\n await reportErrorAndExit(ctx, error);\n }\n};\n"],"mappings":"2WAwBA,MAAa,EAAQ,CACnB,SAAU,CACR,KAAM,QACN,MAAO,KACP,YAAa,oBACb,QAAS,6FACV,CACD,YAAa,CACX,KAAM,QACN,YAAa,wBACb,QAAS,2FACV,CACD,YAAa,CACX,KAAMA,EAAAA,QAAI,MACV,MAAO,CAAC,KAAM,EAAO,UAAU,CAAC,CAChC,YAAa,4DACb,QAAS,0HACV,CACD,cAAe,CACb,KAAM,QACN,YAAa,mBACb,QAAS,oHACV,CACD,SAAU,CACR,KAAM,QACN,YAAa,iCACb,QACE,0IACH,CACD,eAAgB,CACd,KAAM,QACN,OAAQ,GACT,CACF,CAEY,EAAQ,MAAO,EAA6B,OAA0B,CACjF,IAAM,EAAc,MAAM,GAAmB,CAEvC,EAAe,EAAa,EAAM,CAAC,OAAQ,GAAM,CAAC,EAAE,OAAO,CAC7D,EAEJ,GAAI,IAAc,SAChB,EAAY,EAAoB,EAAa,KACxC,CACL,IAAM,EAAU,KAAK,IAAI,EAAG,GAAG,EAAa,IAAK,GAAM,EAAS,EAAE,CAAC,OAAS,EAAE,CAAC,CAC/E,EAAY,EAAa,IAAK,GAAM,EAAW,EAAG,EAAS,EAAE,CAAC,CAAC,KAAK;EAAK,CAG3E,MAAO,EAAM;;;MAGTC,EAAO,OAAO,QAAQ,CAAC;;;MAGvBA,EAAO,OAAO,WAAW,CAAC;QACxB,EAAY;;MAEdA,EAAO,OAAO,QAAQ,CAAC;QACrB,EAAU;;UAERA,EAAO,KAAK,KAAK,CAAC,kBAAkBA,EAAO,KAAK,SAAS,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SAAS,CAAC,CAC9B,QAAQ,KAAK,EAAE,EAGjB,EAAc,EACd,EAAU,UAAY,GAGxB,GAAI,CAAC,EAAU,EAAY,CAAE,CAE3B,IAAM,EAAW,MAAM,EAAoB,EAAY,CACnD,IACF,EAAc,GAIb,EAAU,EAAY,GACzB,CAAO;wBACaA,EAAO,QAAQ,EAAY,CAAC;;qBAE/BA,EAAO,WAAW,EAAa,EAAa,EAAS,CAAC,CAAC;;YAEhEA,EAAO,KAAK,aAAa,CAAC;MAElC,QAAQ,KAAK,EAAE,EAGjB,IAAM,EAAU,MAAM,EAAc,EAAY,CAChD,EAAc,CAAE,QAAS,EAAa,CAAC,CAIvC,IAAM,EAAW,EAAU,UAAa,QAAQ,KAAK,SAAS,KAAK,EAAI,CAAC,QAAQ,KAAK,SAAS,SAAS,CAAG,KAAO,SAAY,IAAA,GAC7H,GAAI,EAAU,CACZ,MAAM,EAAW,EAAI,MAAM,CAAE,KAAM,EAAQ,KAAM,CAAC,CAAE,EAAS,EAAU,GAAG,EAAU,EAAE,CACtF,OAGF,GAAI,CACF,MAAM,EAAW,EAAI,MAAM,CAAE,KAAM,EAAQ,KAAM,CAAC,CAAE,EAAS,GAAG,EAAU,EAAE,OACrE,EAAO,CACd,MAAM,EAAmB,EAAK,EAAM"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./prompt-C9nwJW0G.js";import{D as r,Lt as i,O as a,c as o,l as s}from"./command-2iNTc5dV.js";import{t as c}from"./indent-string-BVm-4tyL.js";import l from"node:process";import u from"node:assert";const d=e=>(e=a(e,{ensureEmptyLineAbove:!0}),s.isInteractive||(o(e.content),o(JSON.stringify(e.choices??e.groupedChoices,void 0,2)),o({ensureEmptyLineAbove:!0,content:`Aborting because ggt is not running in an interactive terminal.`}),l.exit(1)),new Promise(t=>{let n=new f({formatChoice:e=>e,formatSelection:e=>e,...e});n.on(`submit`,t),n.on(`exit`,()=>l.exit(0)),n.on(`abort`,()=>l.exit(0))}));var f=class extends n{cursor=0;optionsPerPage=10;options;currentChoices;groupedChoicesTitleIndexMap=new Map;searchable;input=``;allChoices;allGroupedChoices;constructor(e){super(),this.options=a(e,{formatChoice:e=>e,formatSelection:e=>e,...e}),this.searchable=this.options.searchable??!1,this.options.choices?(this.currentChoices=this.options.choices,this.allChoices=[...this.options.choices]):(this.currentChoices=this.options.groupedChoices.flatMap(([e,t])=>t),this.allChoices=[...this.currentChoices],this.allGroupedChoices=this.options.groupedChoices,this.rebuildGroupTitleIndexMap()),this.render()}rebuildGroupTitleIndexMap(){if(this.groupedChoicesTitleIndexMap.clear(),!this.allGroupedChoices)return;let e=this.input.toLowerCase(),t=0;for(let[n,r]of this.allGroupedChoices){let i=e?r.filter(t=>t.toLowerCase().includes(e)):r;for(let e=0;e<i.length;e++)e===0&&this.groupedChoicesTitleIndexMap.set(t,n),t++}}refilter(){let e=this.input.toLowerCase();this.allGroupedChoices?(e?this.currentChoices=this.allGroupedChoices.flatMap(([t,n])=>n.filter(t=>t.toLowerCase().includes(e))):this.currentChoices=this.allGroupedChoices.flatMap(([e,t])=>t),this.rebuildGroupTitleIndexMap()):e?this.currentChoices=this.allChoices.filter(t=>t.toLowerCase().includes(e)):this.currentChoices=[...this.allChoices],this.cursor=0,this.render()}get selection(){let e=this.currentChoices[this.cursor];return u(e,`choices[${this.cursor}] is not defined`),e}moveCursor(e){this.cursor=e,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){if(this.searchable&&this.input.length>0){this.input=``,this.refilter();return}this.bell()}abort(){this.done=this.aborted=!0,this.fire(),this.render(`Cancel (Ctrl+C)`),this.close()}submit(){if(this.currentChoices.length===0){this.bell();return}this.done=!0,this.aborted=!1,this.value=this.selection,this.fire(),this.render(),this.close()}delete(){if(!this.searchable||this.input.length===0){this.bell();return}this.input=this.input.slice(0,-1),this.refilter()}first(){this.currentChoices.length!==0&&(this.moveCursor(0),this.render())}last(){this.currentChoices.length!==0&&(this.moveCursor(this.currentChoices.length-1),this.render())}up(){this.currentChoices.length!==0&&(this.cursor===0?this.moveCursor(this.currentChoices.length-1):this.moveCursor(this.cursor-1),this.render())}down(){this.currentChoices.length!==0&&(this.cursor===this.currentChoices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render())}next(){this.currentChoices.length!==0&&(this.moveCursor((this.cursor+1)%this.currentChoices.length),this.render())}_(e,t){if(this.searchable&&e){if(e===` `&&this.input.length===0){this.submit();return}this.input+=e,this.refilter();return}if(e===` `){this.submit();return}}render(n){if(this.closed)return;super.render();let a=this.options.content;if(this.done){s.persistPrompt(r({...this.options,content:`${a.trimEnd()} ${this.options.formatChoice(n??this.selection)}`}));return}if(this.searchable?(a+=` ${i.gray(`Type to filter, arrow keys to move`)}\n`,a+=`${i.gray(`>`)} ${this.input}\n\n`):a+=` ${i.gray(`Use arrow keys to move`)}\n\n`,this.currentChoices.length===0){let e=i.gray(`No matches found`)+`
|
|
2
|
+
`;this.options.indent&&(e=c(e,this.options.indent)),s.updatePrompt(a+e);return}let o=``,{startIndex:l,endIndex:d}=e(this.cursor,this.currentChoices.length,this.optionsPerPage);for(let e=l;e<d;e++){let n;n=this.cursor===e?`${t.arrowRight} `:e===l&&l>0?`${t.arrowUp} `:e===d-1&&d<this.currentChoices.length?`${t.arrowDown} `:` `;let r=this.currentChoices[e];u(r,`choices[${e}] is not defined`);let a=this.options.formatChoice(r);this.cursor===e&&(a=i.blue.underline(a)),this.groupedChoicesTitleIndexMap.has(e)&&(e!==l&&(o+=`
|
|
3
|
+
`),o+=`${i.grey(this.groupedChoicesTitleIndexMap.get(e))}\n`),o+=`${n}${a}\n`}this.options.indent&&(o=c(o,this.options.indent)),s.updatePrompt(a+o)}};export{d as t};
|
|
4
|
+
//# sourceMappingURL=select-Dey_sjjd.js.map
|