@sidekickdb/cli 0.0.0 → 2.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/.turbo/turbo-build.log +4 -0
- package/LICENSE.md +202 -0
- package/NOTICE +27 -0
- package/README.md +67 -2
- package/__tests__/appCommands.test.ts +229 -0
- package/__tests__/args.test.ts +358 -0
- package/__tests__/auth.test.ts +128 -0
- package/__tests__/authClientAddApple.test.ts +377 -0
- package/__tests__/authClientAddClerk.test.ts +223 -0
- package/__tests__/authClientAddGithub.test.ts +245 -0
- package/__tests__/authClientAddGoogle.test.ts +374 -0
- package/__tests__/authClientAddLinkedin.test.ts +263 -0
- package/__tests__/authClientList.test.ts +90 -0
- package/__tests__/authClientUpdate.test.ts +584 -0
- package/__tests__/authOriginManagement.test.ts +308 -0
- package/__tests__/backupDownload.test.ts +206 -0
- package/__tests__/backups.test.ts +222 -0
- package/__tests__/config.test.ts +164 -0
- package/__tests__/configAliases.test.ts +232 -0
- package/__tests__/e2e/cli.e2e.test.ts +1269 -0
- package/__tests__/e2e/helpers.ts +186 -0
- package/__tests__/effectHelpers.ts +45 -0
- package/__tests__/legacyPackageCompat.test.ts +104 -0
- package/__tests__/mergeSchema.test.ts +197 -0
- package/__tests__/multiSelect.test.ts +236 -0
- package/__tests__/oauthMock.ts +76 -0
- package/__tests__/promptOk.test.ts +44 -0
- package/__tests__/redirectUriPrompt.test.ts +40 -0
- package/__tests__/select.test.ts +224 -0
- package/__tests__/webhooks.test.ts +729 -0
- package/bin/index.js +3 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +103 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/commands/app/delete.d.ts +7 -0
- package/dist/commands/app/delete.d.ts.map +1 -0
- package/dist/commands/app/delete.js +57 -0
- package/dist/commands/app/delete.js.map +1 -0
- package/dist/commands/app/list.d.ts +6 -0
- package/dist/commands/app/list.d.ts.map +1 -0
- package/dist/commands/app/list.js +29 -0
- package/dist/commands/app/list.js.map +1 -0
- package/dist/commands/auth/client/add.d.ts +9 -0
- package/dist/commands/auth/client/add.d.ts.map +1 -0
- package/dist/commands/auth/client/add.js +409 -0
- package/dist/commands/auth/client/add.js.map +1 -0
- package/dist/commands/auth/client/delete.d.ts +11 -0
- package/dist/commands/auth/client/delete.d.ts.map +1 -0
- package/dist/commands/auth/client/delete.js +48 -0
- package/dist/commands/auth/client/delete.js.map +1 -0
- package/dist/commands/auth/client/list.d.ts +6 -0
- package/dist/commands/auth/client/list.d.ts.map +1 -0
- package/dist/commands/auth/client/list.js +38 -0
- package/dist/commands/auth/client/list.js.map +1 -0
- package/dist/commands/auth/client/shared.d.ts +70 -0
- package/dist/commands/auth/client/shared.d.ts.map +1 -0
- package/dist/commands/auth/client/shared.js +140 -0
- package/dist/commands/auth/client/shared.js.map +1 -0
- package/dist/commands/auth/client/update.d.ts +8 -0
- package/dist/commands/auth/client/update.d.ts.map +1 -0
- package/dist/commands/auth/client/update.js +445 -0
- package/dist/commands/auth/client/update.js.map +1 -0
- package/dist/commands/auth/email/pull.d.ts +24 -0
- package/dist/commands/auth/email/pull.d.ts.map +1 -0
- package/dist/commands/auth/email/pull.js +100 -0
- package/dist/commands/auth/email/pull.js.map +1 -0
- package/dist/commands/auth/email/push.d.ts +8 -0
- package/dist/commands/auth/email/push.d.ts.map +1 -0
- package/dist/commands/auth/email/push.js +58 -0
- package/dist/commands/auth/email/push.js.map +1 -0
- package/dist/commands/auth/email/resend.d.ts +3 -0
- package/dist/commands/auth/email/resend.d.ts.map +1 -0
- package/dist/commands/auth/email/resend.js +7 -0
- package/dist/commands/auth/email/resend.js.map +1 -0
- package/dist/commands/auth/email/reset.d.ts +5 -0
- package/dist/commands/auth/email/reset.d.ts.map +1 -0
- package/dist/commands/auth/email/reset.js +25 -0
- package/dist/commands/auth/email/reset.js.map +1 -0
- package/dist/commands/auth/email/status.d.ts +57 -0
- package/dist/commands/auth/email/status.d.ts.map +1 -0
- package/dist/commands/auth/email/status.js +96 -0
- package/dist/commands/auth/email/status.js.map +1 -0
- package/dist/commands/auth/email/verify.d.ts +5 -0
- package/dist/commands/auth/email/verify.d.ts.map +1 -0
- package/dist/commands/auth/email/verify.js +12 -0
- package/dist/commands/auth/email/verify.js.map +1 -0
- package/dist/commands/auth/origin/add.d.ts +12 -0
- package/dist/commands/auth/origin/add.d.ts.map +1 -0
- package/dist/commands/auth/origin/add.js +153 -0
- package/dist/commands/auth/origin/add.js.map +1 -0
- package/dist/commands/auth/origin/delete.d.ts +8 -0
- package/dist/commands/auth/origin/delete.d.ts.map +1 -0
- package/dist/commands/auth/origin/delete.js +38 -0
- package/dist/commands/auth/origin/delete.js.map +1 -0
- package/dist/commands/auth/origin/list.d.ts +9 -0
- package/dist/commands/auth/origin/list.d.ts.map +1 -0
- package/dist/commands/auth/origin/list.js +52 -0
- package/dist/commands/auth/origin/list.js.map +1 -0
- package/dist/commands/backup/download.d.ts +10 -0
- package/dist/commands/backup/download.d.ts.map +1 -0
- package/dist/commands/backup/download.js +174 -0
- package/dist/commands/backup/download.js.map +1 -0
- package/dist/commands/backup/list.d.ts +11 -0
- package/dist/commands/backup/list.d.ts.map +1 -0
- package/dist/commands/backup/list.js +74 -0
- package/dist/commands/backup/list.js.map +1 -0
- package/dist/commands/claim.d.ts +6 -0
- package/dist/commands/claim.d.ts.map +1 -0
- package/dist/commands/claim.js +22 -0
- package/dist/commands/claim.js.map +1 -0
- package/dist/commands/explorer.d.ts +6 -0
- package/dist/commands/explorer.d.ts.map +1 -0
- package/dist/commands/explorer.js +13 -0
- package/dist/commands/explorer.js.map +1 -0
- package/dist/commands/info.d.ts +9 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +41 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +41 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/initWithoutFiles.d.ts +6 -0
- package/dist/commands/initWithoutFiles.d.ts.map +1 -0
- package/dist/commands/initWithoutFiles.js +64 -0
- package/dist/commands/initWithoutFiles.js.map +1 -0
- package/dist/commands/login.d.ts +9 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +44 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +14 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/pull.d.ts +5 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +15 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +6 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +20 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/query.d.ts +7 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +52 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/webhooks/add.d.ts +9 -0
- package/dist/commands/webhooks/add.d.ts.map +1 -0
- package/dist/commands/webhooks/add.js +75 -0
- package/dist/commands/webhooks/add.js.map +1 -0
- package/dist/commands/webhooks/delete.d.ts +6 -0
- package/dist/commands/webhooks/delete.d.ts.map +1 -0
- package/dist/commands/webhooks/delete.js +17 -0
- package/dist/commands/webhooks/delete.js.map +1 -0
- package/dist/commands/webhooks/disable.d.ts +7 -0
- package/dist/commands/webhooks/disable.d.ts.map +1 -0
- package/dist/commands/webhooks/disable.js +18 -0
- package/dist/commands/webhooks/disable.js.map +1 -0
- package/dist/commands/webhooks/enable.d.ts +6 -0
- package/dist/commands/webhooks/enable.d.ts.map +1 -0
- package/dist/commands/webhooks/enable.js +18 -0
- package/dist/commands/webhooks/enable.js.map +1 -0
- package/dist/commands/webhooks/events/list.d.ts +7 -0
- package/dist/commands/webhooks/events/list.d.ts.map +1 -0
- package/dist/commands/webhooks/events/list.js +31 -0
- package/dist/commands/webhooks/events/list.js.map +1 -0
- package/dist/commands/webhooks/events/payload.d.ts +8 -0
- package/dist/commands/webhooks/events/payload.d.ts.map +1 -0
- package/dist/commands/webhooks/events/payload.js +39 -0
- package/dist/commands/webhooks/events/payload.js.map +1 -0
- package/dist/commands/webhooks/events/resend.d.ts +8 -0
- package/dist/commands/webhooks/events/resend.d.ts.map +1 -0
- package/dist/commands/webhooks/events/resend.js +43 -0
- package/dist/commands/webhooks/events/resend.js.map +1 -0
- package/dist/commands/webhooks/list.d.ts +8 -0
- package/dist/commands/webhooks/list.d.ts.map +1 -0
- package/dist/commands/webhooks/list.js +29 -0
- package/dist/commands/webhooks/list.js.map +1 -0
- package/dist/commands/webhooks/shared.d.ts +40 -0
- package/dist/commands/webhooks/shared.d.ts.map +1 -0
- package/dist/commands/webhooks/shared.js +248 -0
- package/dist/commands/webhooks/shared.js.map +1 -0
- package/dist/commands/webhooks/update.d.ts +10 -0
- package/dist/commands/webhooks/update.d.ts.map +1 -0
- package/dist/commands/webhooks/update.js +189 -0
- package/dist/commands/webhooks/update.js.map +1 -0
- package/dist/context/authToken.d.ts +29 -0
- package/dist/context/authToken.d.ts.map +1 -0
- package/dist/context/authToken.js +73 -0
- package/dist/context/authToken.js.map +1 -0
- package/dist/context/currentApp.d.ts +38 -0
- package/dist/context/currentApp.d.ts.map +1 -0
- package/dist/context/currentApp.js +222 -0
- package/dist/context/currentApp.js.map +1 -0
- package/dist/context/globalOpts.d.ts +11 -0
- package/dist/context/globalOpts.d.ts.map +1 -0
- package/dist/context/globalOpts.js +13 -0
- package/dist/context/globalOpts.js.map +1 -0
- package/dist/context/platformApi.d.ts +19 -0
- package/dist/context/platformApi.d.ts.map +1 -0
- package/dist/context/platformApi.js +24 -0
- package/dist/context/platformApi.js.map +1 -0
- package/dist/context/projectInfo.d.ts +32 -0
- package/dist/context/projectInfo.d.ts.map +1 -0
- package/dist/context/projectInfo.js +160 -0
- package/dist/context/projectInfo.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +6 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +721 -0
- package/dist/index.js.map +1 -0
- package/dist/layer.d.ts +25 -0
- package/dist/layer.d.ts.map +1 -0
- package/dist/layer.js +119 -0
- package/dist/layer.js.map +1 -0
- package/dist/lib/args.d.ts +212 -0
- package/dist/lib/args.d.ts.map +1 -0
- package/dist/lib/args.js +313 -0
- package/dist/lib/args.js.map +1 -0
- package/dist/lib/backupDownload.d.ts +21 -0
- package/dist/lib/backupDownload.d.ts.map +1 -0
- package/dist/lib/backupDownload.js +151 -0
- package/dist/lib/backupDownload.js.map +1 -0
- package/dist/lib/backups.d.ts +12 -0
- package/dist/lib/backups.d.ts.map +1 -0
- package/dist/lib/backups.js +26 -0
- package/dist/lib/backups.js.map +1 -0
- package/dist/lib/config.d.ts +13 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +62 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/createApp.d.ts +12 -0
- package/dist/lib/createApp.d.ts.map +1 -0
- package/dist/lib/createApp.js +15 -0
- package/dist/lib/createApp.js.map +1 -0
- package/dist/lib/email.d.ts +47 -0
- package/dist/lib/email.d.ts.map +1 -0
- package/dist/lib/email.js +71 -0
- package/dist/lib/email.js.map +1 -0
- package/dist/lib/handleEnv.d.ts +7 -0
- package/dist/lib/handleEnv.d.ts.map +1 -0
- package/dist/lib/handleEnv.js +103 -0
- package/dist/lib/handleEnv.js.map +1 -0
- package/dist/lib/http.d.ts +30 -0
- package/dist/lib/http.d.ts.map +1 -0
- package/dist/lib/http.js +55 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/login.d.ts +12 -0
- package/dist/lib/login.d.ts.map +1 -0
- package/dist/lib/login.js +38 -0
- package/dist/lib/login.js.map +1 -0
- package/dist/lib/oauth.d.ts +306 -0
- package/dist/lib/oauth.d.ts.map +1 -0
- package/dist/lib/oauth.js +195 -0
- package/dist/lib/oauth.js.map +1 -0
- package/dist/lib/platformApi.d.ts +5 -0
- package/dist/lib/platformApi.d.ts.map +1 -0
- package/dist/lib/platformApi.js +11 -0
- package/dist/lib/platformApi.js.map +1 -0
- package/dist/lib/pullPerms.d.ts +7 -0
- package/dist/lib/pullPerms.d.ts.map +1 -0
- package/dist/lib/pullPerms.js +41 -0
- package/dist/lib/pullPerms.js.map +1 -0
- package/dist/lib/pullSchema.d.ts +12 -0
- package/dist/lib/pullSchema.d.ts.map +1 -0
- package/dist/lib/pullSchema.js +62 -0
- package/dist/lib/pullSchema.js.map +1 -0
- package/dist/lib/pushPerms.d.ts +13 -0
- package/dist/lib/pushPerms.d.ts.map +1 -0
- package/dist/lib/pushPerms.js +54 -0
- package/dist/lib/pushPerms.js.map +1 -0
- package/dist/lib/pushSchema.d.ts +53 -0
- package/dist/lib/pushSchema.d.ts.map +1 -0
- package/dist/lib/pushSchema.js +165 -0
- package/dist/lib/pushSchema.js.map +1 -0
- package/dist/lib/ui.d.ts +18 -0
- package/dist/lib/ui.d.ts.map +1 -0
- package/dist/lib/ui.js +32 -0
- package/dist/lib/ui.js.map +1 -0
- package/dist/lib/webhooks.d.ts +27 -0
- package/dist/lib/webhooks.d.ts.map +1 -0
- package/dist/lib/webhooks.js +95 -0
- package/dist/lib/webhooks.js.map +1 -0
- package/dist/logging.d.ts +5 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +25 -0
- package/dist/logging.js.map +1 -0
- package/dist/old.d.ts +18 -0
- package/dist/old.d.ts.map +1 -0
- package/dist/old.js +423 -0
- package/dist/old.js.map +1 -0
- package/dist/program.d.ts +3 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +3 -0
- package/dist/program.js.map +1 -0
- package/dist/renderSchemaPlan.d.ts +19 -0
- package/dist/renderSchemaPlan.d.ts.map +1 -0
- package/dist/renderSchemaPlan.js +220 -0
- package/dist/renderSchemaPlan.js.map +1 -0
- package/dist/ui/index.d.ts +292 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +1296 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/lib.d.ts +124 -0
- package/dist/ui/lib.d.ts.map +1 -0
- package/dist/ui/lib.js +333 -0
- package/dist/ui/lib.js.map +1 -0
- package/dist/util/envAliases.d.ts +25 -0
- package/dist/util/envAliases.d.ts.map +1 -0
- package/dist/util/envAliases.js +47 -0
- package/dist/util/envAliases.js.map +1 -0
- package/dist/util/findConfigCandidates.d.ts +33 -0
- package/dist/util/findConfigCandidates.d.ts.map +1 -0
- package/dist/util/findConfigCandidates.js +230 -0
- package/dist/util/findConfigCandidates.js.map +1 -0
- package/dist/util/fs.d.ts +4 -0
- package/dist/util/fs.d.ts.map +1 -0
- package/dist/util/fs.js +22 -0
- package/dist/util/fs.js.map +1 -0
- package/dist/util/getAppName.d.ts +5 -0
- package/dist/util/getAppName.d.ts.map +1 -0
- package/dist/util/getAppName.js +14 -0
- package/dist/util/getAppName.js.map +1 -0
- package/dist/util/instantConfig.d.ts +9 -0
- package/dist/util/instantConfig.d.ts.map +1 -0
- package/dist/util/instantConfig.js +13 -0
- package/dist/util/instantConfig.js.map +1 -0
- package/dist/util/isHeadlessEnvironment.d.ts +4 -0
- package/dist/util/isHeadlessEnvironment.d.ts.map +1 -0
- package/dist/util/isHeadlessEnvironment.js +11 -0
- package/dist/util/isHeadlessEnvironment.js.map +1 -0
- package/dist/util/loadConfig.d.ts +3 -0
- package/dist/util/loadConfig.d.ts.map +1 -0
- package/dist/util/loadConfig.js +80 -0
- package/dist/util/loadConfig.js.map +1 -0
- package/dist/util/loadEnv.d.ts +2 -0
- package/dist/util/loadEnv.d.ts.map +1 -0
- package/dist/util/loadEnv.js +16 -0
- package/dist/util/loadEnv.js.map +1 -0
- package/dist/util/mergeSchema.d.ts +10 -0
- package/dist/util/mergeSchema.d.ts.map +1 -0
- package/dist/util/mergeSchema.js +338 -0
- package/dist/util/mergeSchema.js.map +1 -0
- package/dist/util/projectDir.d.ts +7 -0
- package/dist/util/projectDir.d.ts.map +1 -0
- package/dist/util/projectDir.js +43 -0
- package/dist/util/projectDir.js.map +1 -0
- package/dist/util/renamePrompt.d.ts +15 -0
- package/dist/util/renamePrompt.d.ts.map +1 -0
- package/dist/util/renamePrompt.js +57 -0
- package/dist/util/renamePrompt.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +83 -3
- package/src/auth/index.ts +125 -0
- package/src/commands/app/delete.ts +82 -0
- package/src/commands/app/list.ts +44 -0
- package/src/commands/auth/client/add.ts +744 -0
- package/src/commands/auth/client/delete.ts +60 -0
- package/src/commands/auth/client/list.ts +60 -0
- package/src/commands/auth/client/shared.ts +190 -0
- package/src/commands/auth/client/update.ts +830 -0
- package/src/commands/auth/email/pull.ts +143 -0
- package/src/commands/auth/email/push.ts +94 -0
- package/src/commands/auth/email/resend.ts +8 -0
- package/src/commands/auth/email/reset.ts +37 -0
- package/src/commands/auth/email/status.ts +154 -0
- package/src/commands/auth/email/verify.ts +22 -0
- package/src/commands/auth/origin/add.ts +237 -0
- package/src/commands/auth/origin/delete.ts +50 -0
- package/src/commands/auth/origin/list.ts +66 -0
- package/src/commands/backup/download.ts +231 -0
- package/src/commands/backup/list.ts +94 -0
- package/src/commands/claim.ts +31 -0
- package/src/commands/explorer.ts +21 -0
- package/src/commands/info.ts +57 -0
- package/src/commands/init.ts +60 -0
- package/src/commands/initWithoutFiles.ts +107 -0
- package/src/commands/login.ts +62 -0
- package/src/commands/logout.ts +22 -0
- package/src/commands/pull.ts +22 -0
- package/src/commands/push.ts +25 -0
- package/src/commands/query.ts +61 -0
- package/src/commands/webhooks/add.ts +111 -0
- package/src/commands/webhooks/delete.ts +23 -0
- package/src/commands/webhooks/disable.ts +24 -0
- package/src/commands/webhooks/enable.ts +24 -0
- package/src/commands/webhooks/events/list.ts +38 -0
- package/src/commands/webhooks/events/payload.ts +56 -0
- package/src/commands/webhooks/events/resend.ts +66 -0
- package/src/commands/webhooks/list.ts +41 -0
- package/src/commands/webhooks/shared.ts +339 -0
- package/src/commands/webhooks/update.ts +276 -0
- package/src/context/authToken.ts +134 -0
- package/src/context/currentApp.ts +301 -0
- package/src/context/globalOpts.ts +22 -0
- package/src/context/platformApi.ts +35 -0
- package/src/context/projectInfo.ts +227 -0
- package/src/errors.ts +7 -0
- package/src/index.ts +1222 -0
- package/src/layer.ts +211 -0
- package/src/lib/args.ts +453 -0
- package/src/lib/backupDownload.ts +188 -0
- package/src/lib/backups.ts +33 -0
- package/src/lib/config.ts +107 -0
- package/src/lib/createApp.ts +28 -0
- package/src/lib/email.ts +93 -0
- package/src/lib/handleEnv.ts +126 -0
- package/src/lib/http.ts +128 -0
- package/src/lib/login.ts +48 -0
- package/src/lib/oauth.ts +310 -0
- package/src/lib/platformApi.ts +11 -0
- package/src/lib/pullPerms.ts +50 -0
- package/src/lib/pullSchema.ts +95 -0
- package/src/lib/pushPerms.ts +80 -0
- package/src/lib/pushSchema.ts +248 -0
- package/src/lib/ui.ts +48 -0
- package/src/lib/webhooks.ts +118 -0
- package/src/logging.ts +41 -0
- package/src/old.js +502 -0
- package/src/program.ts +3 -0
- package/src/renderSchemaPlan.ts +324 -0
- package/src/ui/index.ts +1615 -0
- package/src/ui/lib.ts +424 -0
- package/src/util/envAliases.ts +53 -0
- package/src/util/findConfigCandidates.ts +288 -0
- package/src/util/fs.ts +26 -0
- package/src/util/getAppName.ts +14 -0
- package/src/util/instantConfig.ts +21 -0
- package/src/util/isHeadlessEnvironment.ts +15 -0
- package/src/util/loadConfig.ts +101 -0
- package/src/util/loadEnv.ts +19 -0
- package/src/util/mergeSchema.ts +374 -0
- package/src/util/projectDir.ts +54 -0
- package/src/util/renamePrompt.ts +79 -0
- package/src/version.js +3 -0
- package/tsconfig.build.json +20 -0
- package/tsconfig.json +23 -0
- package/vitest.config.ts +22 -0
package/src/ui/lib.ts
ADDED
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { ReadStream, WriteStream } from 'node:tty';
|
|
2
|
+
import { cursor, erase } from 'sisteransi';
|
|
3
|
+
import throttle from 'lodash.throttle';
|
|
4
|
+
import readline from 'node:readline';
|
|
5
|
+
|
|
6
|
+
const isWindows = process.platform === 'win32';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Set terminal raw mode on stdin, with a Windows workaround.
|
|
10
|
+
*
|
|
11
|
+
* Raw mode (true):
|
|
12
|
+
* - Input available character-by-character (not line-buffered)
|
|
13
|
+
* - No echo of typed characters
|
|
14
|
+
* - Ctrl+C doesn't send SIGINT (must handle manually)
|
|
15
|
+
* - Required to capture arrow keys and other special keys
|
|
16
|
+
*
|
|
17
|
+
* Normal mode (false):
|
|
18
|
+
* - Input is line-buffered (available after Enter)
|
|
19
|
+
* - Typed characters are echoed
|
|
20
|
+
* - Ctrl+C sends SIGINT as normal
|
|
21
|
+
*
|
|
22
|
+
* Windows workaround: We skip disabling raw mode on Windows because
|
|
23
|
+
* toggling it between prompts causes a race condition that breaks
|
|
24
|
+
* subsequent keypress events. Raw mode is automatically reset when
|
|
25
|
+
* the process exits, so this is safe.
|
|
26
|
+
*
|
|
27
|
+
* See: https://github.com/bombshell-dev/clack/issues/176
|
|
28
|
+
*/
|
|
29
|
+
export function setRawModeWindowsFriendly(input: ReadStream, value: boolean) {
|
|
30
|
+
if (!value && isWindows) return;
|
|
31
|
+
input.setRawMode(value);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Closable {
|
|
35
|
+
close(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ModifyOutputFn = (
|
|
39
|
+
output: string,
|
|
40
|
+
status?: 'idle' | 'submitted' | 'aborted',
|
|
41
|
+
) => string;
|
|
42
|
+
|
|
43
|
+
export abstract class Prompt<RESULT> {
|
|
44
|
+
protected terminal: ITerminal | undefined;
|
|
45
|
+
private attachCallbacks: ((terminal: ITerminal) => void)[] = [];
|
|
46
|
+
private detachCallbacks: ((terminal: ITerminal) => void)[] = [];
|
|
47
|
+
private inputCallbacks: ((str: string | undefined, key: AnyKey) => void)[] =
|
|
48
|
+
[];
|
|
49
|
+
|
|
50
|
+
public modifier: ModifyOutputFn | undefined = undefined;
|
|
51
|
+
|
|
52
|
+
requestLayout() {
|
|
53
|
+
if (this.terminal) {
|
|
54
|
+
this.terminal!.requestLayout();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
constructor(modifier?: ModifyOutputFn) {
|
|
59
|
+
this.modifier = modifier;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
on(type: 'attach', callback: (terminal: ITerminal) => void): void;
|
|
63
|
+
on(type: 'detach', callback: (terminal: ITerminal) => void): void;
|
|
64
|
+
on(
|
|
65
|
+
type: 'input',
|
|
66
|
+
callback: (str: string | undefined, key: AnyKey) => void,
|
|
67
|
+
): void;
|
|
68
|
+
on(type: 'attach' | 'detach' | 'input', callback: any): void {
|
|
69
|
+
if (type === 'attach') {
|
|
70
|
+
this.attachCallbacks.push(callback);
|
|
71
|
+
} else if (type === 'detach') {
|
|
72
|
+
this.detachCallbacks.push(callback);
|
|
73
|
+
} else if (type === 'input') {
|
|
74
|
+
this.inputCallbacks.push(callback);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
attach(terminal: ITerminal) {
|
|
79
|
+
this.terminal = terminal;
|
|
80
|
+
this.attachCallbacks.forEach((it) => it(terminal));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
detach(terminal: ITerminal) {
|
|
84
|
+
this.detachCallbacks.forEach((it) => it(terminal));
|
|
85
|
+
this.terminal = undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
input(str: string | undefined, key: AnyKey) {
|
|
89
|
+
this.inputCallbacks.forEach((it) => it(str, key));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
abstract result(): RESULT;
|
|
93
|
+
abstract render(status: 'idle' | 'submitted' | 'aborted'): string;
|
|
94
|
+
fullRender(status: 'idle' | 'submitted' | 'aborted'): string {
|
|
95
|
+
if (this.modifier) {
|
|
96
|
+
return this.modifier(this.render(status), status);
|
|
97
|
+
}
|
|
98
|
+
return this.render(status);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export class SelectState<T> {
|
|
103
|
+
public selectedIdx = 0;
|
|
104
|
+
constructor(public readonly items: T[]) {}
|
|
105
|
+
|
|
106
|
+
bind(prompt: Prompt<any>) {
|
|
107
|
+
prompt.on('input', (str, key) => {
|
|
108
|
+
const invalidate = this.consume(str, key);
|
|
109
|
+
if (invalidate) prompt.requestLayout();
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private consume(str: string | undefined, key: AnyKey): boolean {
|
|
114
|
+
if (!key) return false;
|
|
115
|
+
|
|
116
|
+
if (key.name === 'down') {
|
|
117
|
+
this.selectedIdx = (this.selectedIdx + 1) % this.items.length;
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (key.name === 'up') {
|
|
122
|
+
this.selectedIdx -= 1;
|
|
123
|
+
this.selectedIdx =
|
|
124
|
+
this.selectedIdx < 0 ? this.items.length - 1 : this.selectedIdx;
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const deferred = <T>() => {
|
|
133
|
+
let resolve!: (value: T | PromiseLike<T>) => void;
|
|
134
|
+
let reject!: (reason?: any) => void;
|
|
135
|
+
const promise = new Promise<T>((res, rej) => {
|
|
136
|
+
resolve = res;
|
|
137
|
+
reject = rej;
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
resolve,
|
|
142
|
+
reject,
|
|
143
|
+
promise,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export interface ITerminal {
|
|
148
|
+
toggleCursor(state: 'hide' | 'show'): void;
|
|
149
|
+
requestLayout(): void;
|
|
150
|
+
resolve(value: Prompted<{}>): void;
|
|
151
|
+
setAllowInteraction(value: boolean): void;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type AnyKey = {
|
|
155
|
+
sequence: string;
|
|
156
|
+
name: string | undefined;
|
|
157
|
+
ctrl: boolean;
|
|
158
|
+
meta: boolean;
|
|
159
|
+
shift: boolean;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
type Prompted<T> =
|
|
163
|
+
| {
|
|
164
|
+
data: undefined;
|
|
165
|
+
status: 'aborted';
|
|
166
|
+
}
|
|
167
|
+
| {
|
|
168
|
+
data: T;
|
|
169
|
+
status: 'submitted';
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Module-level counter that tracks the cumulative line count of submitted
|
|
174
|
+
* prompts. A command opts in to "erase the trail at the very end" by calling
|
|
175
|
+
* {@link clearPromptTrail} right before printing its final summary.
|
|
176
|
+
*/
|
|
177
|
+
let promptTrailLineCount = 0;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Walk the cursor up by however many lines submitted prompts have written, and
|
|
181
|
+
* erase from there to the end of the screen. Resets the counter. No-op on a
|
|
182
|
+
* non-TTY stdout (e.g. when output is piped). Vanished prompts don't
|
|
183
|
+
* contribute, so calling this only erases the dimmed trail.
|
|
184
|
+
*/
|
|
185
|
+
export function clearPromptTrail(): void {
|
|
186
|
+
if (process.stdout.isTTY && promptTrailLineCount > 0) {
|
|
187
|
+
process.stdout.write(cursor.up(promptTrailLineCount) + erase.down());
|
|
188
|
+
}
|
|
189
|
+
promptTrailLineCount = 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export class Terminal implements ITerminal {
|
|
193
|
+
private text = '';
|
|
194
|
+
private status: 'idle' | 'submitted' | 'aborted' = 'idle';
|
|
195
|
+
private _resolve: (value: Prompted<{}>) => void;
|
|
196
|
+
private promise: Promise<Prompted<{}>>;
|
|
197
|
+
private renderFunc: (str: string) => void;
|
|
198
|
+
|
|
199
|
+
private allowInteraction = true;
|
|
200
|
+
|
|
201
|
+
public resolve: (value: Prompted<{}>) => void;
|
|
202
|
+
|
|
203
|
+
public setAllowInteraction(value: boolean) {
|
|
204
|
+
this.allowInteraction = value;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
constructor(
|
|
208
|
+
private readonly view: Prompt<any>,
|
|
209
|
+
private readonly stdin: ReadStream,
|
|
210
|
+
private readonly stdout: WriteStream,
|
|
211
|
+
private readonly closable: Closable,
|
|
212
|
+
) {
|
|
213
|
+
if (this.stdin.isTTY) setRawModeWindowsFriendly(this.stdin, true);
|
|
214
|
+
|
|
215
|
+
const keypress = (str: string | undefined, key: AnyKey) => {
|
|
216
|
+
if (key.name === 'c' && key.ctrl === true) {
|
|
217
|
+
this.requestLayout();
|
|
218
|
+
this.view.detach(this);
|
|
219
|
+
this.tearDown(keypress);
|
|
220
|
+
if (terminateHandler) {
|
|
221
|
+
terminateHandler(this.stdin, this.stdout);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this.stdout.write(`\n^C\n`);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (this.allowInteraction) {
|
|
229
|
+
if (key.name === 'escape') {
|
|
230
|
+
this.status = 'aborted';
|
|
231
|
+
this.requestLayout();
|
|
232
|
+
this.view.detach(this);
|
|
233
|
+
this.tearDown(keypress);
|
|
234
|
+
this._resolve({ status: 'aborted', data: undefined });
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (key.name === 'return') {
|
|
239
|
+
this.status = 'submitted';
|
|
240
|
+
this.requestLayout();
|
|
241
|
+
this.view.detach(this);
|
|
242
|
+
this.tearDown(keypress);
|
|
243
|
+
this._resolve({ status: 'submitted', data: this.view.result() });
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
view.input(str, key);
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
this.stdin.on('keypress', keypress);
|
|
252
|
+
this.view.attach(this);
|
|
253
|
+
|
|
254
|
+
const { resolve, promise } = deferred<Prompted<{}>>();
|
|
255
|
+
this._resolve = resolve;
|
|
256
|
+
|
|
257
|
+
this.resolve = (value: Prompted<{}>) => {
|
|
258
|
+
this.status = 'submitted';
|
|
259
|
+
this.requestLayout();
|
|
260
|
+
this.view.detach(this);
|
|
261
|
+
this.tearDown(keypress);
|
|
262
|
+
this._resolve(value);
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
this.promise = promise;
|
|
266
|
+
|
|
267
|
+
this.renderFunc = throttle((str: string) => {
|
|
268
|
+
this.stdout.write(str);
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
private tearDown(keypress: (...args: any[]) => void) {
|
|
273
|
+
this.stdout.write(cursor.show);
|
|
274
|
+
this.stdin.removeListener('keypress', keypress);
|
|
275
|
+
if (this.stdin.isTTY) setRawModeWindowsFriendly(this.stdin, false);
|
|
276
|
+
this.closable.close();
|
|
277
|
+
// Track rows the cursor advanced past so a command can erase the whole
|
|
278
|
+
// prompt trail at the end. Counts each \n plus wraps for lines wider than
|
|
279
|
+
// the terminal — mirrors `clear()`'s formula so wrapped output is still
|
|
280
|
+
// fully cleared. Skip vanished output (whitespace-only after the modifier
|
|
281
|
+
// ran).
|
|
282
|
+
if (this.status === 'submitted' && this.text.trim().length > 0) {
|
|
283
|
+
const cols = this.stdout.columns || 0;
|
|
284
|
+
const lines = this.text.split(/\r?\n/);
|
|
285
|
+
let rows = lines.length - 1; // one cursor-down per newline
|
|
286
|
+
if (cols > 0) {
|
|
287
|
+
for (const line of lines) {
|
|
288
|
+
const w = stringWidth(line);
|
|
289
|
+
if (w > 0) rows += Math.floor((w - 1) / cols);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
promptTrailLineCount += rows;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
result(): Promise<{}> {
|
|
297
|
+
return this.promise;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
toggleCursor(state: 'hide' | 'show') {
|
|
301
|
+
if (state === 'hide') {
|
|
302
|
+
this.stdout.write(cursor.hide);
|
|
303
|
+
} else {
|
|
304
|
+
this.stdout.write(cursor.show);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
requestLayout() {
|
|
309
|
+
const string = this.view.fullRender(this.status);
|
|
310
|
+
let realString = string;
|
|
311
|
+
// Only ensure a trailing newline when there's content. Vanished renders
|
|
312
|
+
// (empty string after modifyOutput) would otherwise inject a phantom line
|
|
313
|
+
// that pushes the next prompt down on each iteration.
|
|
314
|
+
if (realString.length > 0 && !realString.endsWith('\n')) {
|
|
315
|
+
realString += '\n';
|
|
316
|
+
}
|
|
317
|
+
const realText = this.text.endsWith('\n') ? this.text : `${this.text}\n`;
|
|
318
|
+
const clearPrefix = this.text ? clear(realText, this.stdout.columns) : '';
|
|
319
|
+
this.text = realString;
|
|
320
|
+
|
|
321
|
+
this.renderFunc(`${clearPrefix}${realString}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function render<T>(view: Prompt<T>): Promise<Prompted<T>>;
|
|
326
|
+
export function render(view: string): void;
|
|
327
|
+
export function render(view: any): any {
|
|
328
|
+
const { stdin, stdout, closable } = prepareReadLine();
|
|
329
|
+
if (view instanceof Prompt) {
|
|
330
|
+
const terminal = new Terminal(view, stdin, stdout, closable);
|
|
331
|
+
terminal.requestLayout();
|
|
332
|
+
return terminal.result();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
stdout.write(`${view}\n`);
|
|
336
|
+
closable.close();
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export class CancelledPromptError extends Error {
|
|
341
|
+
constructor(message?: string) {
|
|
342
|
+
super(message);
|
|
343
|
+
this.name = 'CancelledPromptError';
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Renders a prompt object and throws if the Prompt was "cancelled"
|
|
349
|
+
* If using the standard render function you must check if the result ended in a cancellation before accessing the data.
|
|
350
|
+
* Cancellations are rare so this is more of a future proof for future components
|
|
351
|
+
* where cancelling may make more sense.
|
|
352
|
+
*/
|
|
353
|
+
export async function renderUnwrap<T>(view: Prompt<T>): Promise<T> {
|
|
354
|
+
const { stdin, stdout, closable } = prepareReadLine();
|
|
355
|
+
const terminal = new Terminal(view, stdin, stdout, closable);
|
|
356
|
+
terminal.requestLayout();
|
|
357
|
+
const result = (await terminal.result()) as Prompted<T>;
|
|
358
|
+
if (result.status === 'aborted') {
|
|
359
|
+
throw new CancelledPromptError('Prompt was aborted');
|
|
360
|
+
} else {
|
|
361
|
+
// Prompt.result may throw an error but it is swallowed by the use of
|
|
362
|
+
// Terminal. Terminal.result() just returns the prompt's internal promise
|
|
363
|
+
if (result.data instanceof Error) {
|
|
364
|
+
throw result.data;
|
|
365
|
+
}
|
|
366
|
+
return result.data;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
let terminateHandler:
|
|
371
|
+
| ((stdin: ReadStream, stdout: WriteStream) => void)
|
|
372
|
+
| undefined;
|
|
373
|
+
|
|
374
|
+
export function onTerminate(
|
|
375
|
+
callback: ((stdin: ReadStream, stdout: WriteStream) => void) | undefined,
|
|
376
|
+
) {
|
|
377
|
+
terminateHandler = callback;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export const prepareReadLine = (): {
|
|
381
|
+
stdin: ReadStream;
|
|
382
|
+
stdout: WriteStream;
|
|
383
|
+
closable: Closable;
|
|
384
|
+
} => {
|
|
385
|
+
const stdin = process.stdin;
|
|
386
|
+
const stdout = process.stdout;
|
|
387
|
+
|
|
388
|
+
const rl = readline.createInterface({
|
|
389
|
+
input: stdin,
|
|
390
|
+
escapeCodeTimeout: 50,
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
readline.emitKeypressEvents(stdin, rl);
|
|
394
|
+
|
|
395
|
+
return {
|
|
396
|
+
stdin,
|
|
397
|
+
stdout,
|
|
398
|
+
closable: rl,
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const strip = (str: string) => {
|
|
403
|
+
const pattern = [
|
|
404
|
+
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
405
|
+
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))',
|
|
406
|
+
].join('|');
|
|
407
|
+
|
|
408
|
+
const RGX = new RegExp(pattern, 'g');
|
|
409
|
+
return typeof str === 'string' ? str.replace(RGX, '') : str;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const stringWidth = (str: string) => [...strip(str)].length;
|
|
413
|
+
|
|
414
|
+
export const clear = function (prompt: string, perLine: number) {
|
|
415
|
+
if (!perLine) return erase.line + cursor.to(0);
|
|
416
|
+
|
|
417
|
+
let rows = 0;
|
|
418
|
+
const lines = prompt.split(/\r?\n/);
|
|
419
|
+
for (let line of lines) {
|
|
420
|
+
rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
return erase.lines(rows);
|
|
424
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SidekickDB names for environment variables.
|
|
3
|
+
*
|
|
4
|
+
* Every variable with `INSTANT_` in its name can also be set with `SIDEKICK_`
|
|
5
|
+
* in that place: `SIDEKICK_CLI_API_URI` for `INSTANT_CLI_API_URI`,
|
|
6
|
+
* `NEXT_PUBLIC_SIDEKICK_APP_ID` for `NEXT_PUBLIC_INSTANT_APP_ID`, and so on.
|
|
7
|
+
* The `SIDEKICK_` name wins when both are set; a blank value counts as unset.
|
|
8
|
+
*
|
|
9
|
+
* The rest of the CLI keeps reading the `INSTANT_` names, so that its source
|
|
10
|
+
* stays close to upstream. `applyEnvAliases` copies each `SIDEKICK_` value onto
|
|
11
|
+
* its `INSTANT_` name once, right after the env files are loaded.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const SIDEKICK_NAME = /^((?:[A-Z0-9]+_)*?)SIDEKICK_([A-Z0-9_]+)$/;
|
|
15
|
+
|
|
16
|
+
/** `INSTANT_` name that `name` stands for, or null when it is not an alias. */
|
|
17
|
+
export function legacyEnvName(name: string): string | null {
|
|
18
|
+
const match = SIDEKICK_NAME.exec(name);
|
|
19
|
+
return match ? `${match[1]}INSTANT_${match[2]}` : null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// INSTANT_ name -> the SIDEKICK_ name its value came from.
|
|
23
|
+
const applied = new Map<string, string>();
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Copies every `SIDEKICK_` variable in `env` onto its `INSTANT_` name.
|
|
27
|
+
* Returns the names it set, as `INSTANT_` name -> `SIDEKICK_` name.
|
|
28
|
+
*/
|
|
29
|
+
export function applyEnvAliases(
|
|
30
|
+
env: Record<string, string | undefined> = process.env,
|
|
31
|
+
): Record<string, string> {
|
|
32
|
+
const result: Record<string, string> = {};
|
|
33
|
+
for (const [name, value] of Object.entries(env)) {
|
|
34
|
+
const legacyName = legacyEnvName(name);
|
|
35
|
+
if (!legacyName || value === undefined || value.trim() === '') {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
env[legacyName] = value;
|
|
39
|
+
result[legacyName] = name;
|
|
40
|
+
if (env === process.env) {
|
|
41
|
+
applied.set(legacyName, name);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The name to show for an `INSTANT_` variable: the `SIDEKICK_` name when the
|
|
49
|
+
* value was set under it, otherwise the name itself.
|
|
50
|
+
*/
|
|
51
|
+
export function envNameForDisplay(legacyName: string): string {
|
|
52
|
+
return applied.get(legacyName) ?? legacyName;
|
|
53
|
+
}
|