@seamapi/cli 0.18.1 → 0.19.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 +55 -1
- package/bin/cli.js +73 -249
- package/bin/cli.js.map +1 -1
- package/lib/args/coerce.d.ts +28 -0
- package/lib/args/coerce.js +131 -0
- package/lib/args/coerce.js.map +1 -0
- package/lib/{util/cli-args.d.ts → args/parse.d.ts} +12 -15
- package/lib/{util/cli-args.js → args/parse.js} +21 -24
- package/lib/args/parse.js.map +1 -0
- package/lib/args/validate.d.ts +23 -0
- package/lib/args/validate.js +42 -0
- package/lib/args/validate.js.map +1 -0
- package/lib/auth/operations.d.ts +54 -0
- package/lib/auth/operations.js +115 -0
- package/lib/auth/operations.js.map +1 -0
- package/lib/{validate-token.js → auth/validate-token.js} +2 -2
- package/lib/auth/validate-token.js.map +1 -0
- package/lib/blueprint/cache.d.ts +16 -0
- package/lib/blueprint/cache.js +73 -0
- package/lib/blueprint/cache.js.map +1 -0
- package/lib/blueprint/endpoint.d.ts +14 -0
- package/lib/{get-response-key.js → blueprint/endpoint.js} +11 -2
- package/lib/blueprint/endpoint.js.map +1 -0
- package/lib/blueprint/index.d.ts +12 -0
- package/lib/blueprint/index.js +10 -0
- package/lib/blueprint/index.js.map +1 -0
- package/lib/blueprint/source-npm.d.ts +10 -0
- package/lib/{blueprint.js → blueprint/source-npm.js} +20 -74
- package/lib/blueprint/source-npm.js.map +1 -0
- package/lib/blueprint/source-remote.d.ts +6 -0
- package/lib/blueprint/source-remote.js +14 -0
- package/lib/blueprint/source-remote.js.map +1 -0
- package/lib/commands/api-command.d.ts +8 -0
- package/lib/commands/api-command.js +71 -0
- package/lib/commands/api-command.js.map +1 -0
- package/lib/commands/local/completion.d.ts +18 -0
- package/lib/commands/local/completion.js +35 -0
- package/lib/commands/local/completion.js.map +1 -0
- package/lib/commands/local/config-reveal-location.d.ts +2 -0
- package/lib/commands/local/config-reveal-location.js +15 -0
- package/lib/commands/local/config-reveal-location.js.map +1 -0
- package/lib/commands/local/config-set-fake-server.d.ts +3 -0
- package/lib/commands/local/config-set-fake-server.js +20 -0
- package/lib/commands/local/config-set-fake-server.js.map +1 -0
- package/lib/commands/local/config-use-remote-api-defs.d.ts +2 -0
- package/lib/commands/local/config-use-remote-api-defs.js +20 -0
- package/lib/commands/local/config-use-remote-api-defs.js.map +1 -0
- package/lib/commands/local/health.d.ts +2 -0
- package/lib/commands/local/health.js +18 -0
- package/lib/commands/local/health.js.map +1 -0
- package/lib/commands/local/login.d.ts +2 -0
- package/lib/commands/local/login.js +35 -0
- package/lib/commands/local/login.js.map +1 -0
- package/lib/commands/local/logout.d.ts +2 -0
- package/lib/commands/local/logout.js +17 -0
- package/lib/commands/local/logout.js.map +1 -0
- package/lib/commands/local/select-server.d.ts +2 -0
- package/lib/commands/local/select-server.js +27 -0
- package/lib/commands/local/select-server.js.map +1 -0
- package/lib/commands/local/select-workspace.d.ts +2 -0
- package/lib/commands/local/select-workspace.js +22 -0
- package/lib/commands/local/select-workspace.js.map +1 -0
- package/lib/commands/local/wizard.d.ts +9 -0
- package/lib/commands/local/wizard.js +28 -0
- package/lib/commands/local/wizard.js.map +1 -0
- package/lib/commands/registry.d.ts +54 -0
- package/lib/commands/registry.js +64 -0
- package/lib/commands/registry.js.map +1 -0
- package/lib/{command-spec.d.ts → commands/spec.d.ts} +8 -12
- package/lib/{command-spec.js → commands/spec.js} +27 -120
- package/lib/commands/spec.js.map +1 -0
- package/lib/config/config-store.d.ts +23 -8
- package/lib/config/config-store.js +16 -42
- package/lib/config/config-store.js.map +1 -1
- package/lib/config/index.d.ts +2 -1
- package/lib/config/index.js +2 -1
- package/lib/config/index.js.map +1 -1
- package/lib/config/memory-config-store.d.ts +21 -0
- package/lib/config/memory-config-store.js +48 -0
- package/lib/config/memory-config-store.js.map +1 -0
- package/lib/config/migrate.js +1 -1
- package/lib/config/migrate.js.map +1 -1
- package/lib/config/values.d.ts +12 -0
- package/lib/config/values.js +50 -0
- package/lib/config/values.js.map +1 -0
- package/lib/context.d.ts +37 -0
- package/lib/context.js +31 -0
- package/lib/context.js.map +1 -0
- package/lib/env.d.ts +5 -0
- package/lib/env.js +5 -0
- package/lib/env.js.map +1 -1
- package/lib/errors.d.ts +31 -0
- package/lib/errors.js +58 -0
- package/lib/errors.js.map +1 -0
- package/lib/http/api.d.ts +37 -0
- package/lib/http/api.js +20 -0
- package/lib/http/api.js.map +1 -0
- package/lib/http/client.d.ts +4 -0
- package/lib/{get-seam.js → http/client.js} +16 -17
- package/lib/http/client.js.map +1 -0
- package/lib/http/follow-ups.d.ts +6 -0
- package/lib/http/follow-ups.js +30 -0
- package/lib/http/follow-ups.js.map +1 -0
- package/lib/http/memory-seam-api.d.ts +22 -0
- package/lib/http/memory-seam-api.js +41 -0
- package/lib/http/memory-seam-api.js.map +1 -0
- package/lib/http/request.d.ts +19 -0
- package/lib/http/request.js +39 -0
- package/lib/http/request.js.map +1 -0
- package/lib/{interact-for-access-code.js → interactions/access-code.js} +4 -4
- package/lib/interactions/access-code.js.map +1 -0
- package/lib/{interact-for-acs-entrance.js → interactions/acs-entrance.js} +3 -3
- package/lib/interactions/acs-entrance.js.map +1 -0
- package/lib/{interact-for-acs-system.js → interactions/acs-system.js} +3 -3
- package/lib/interactions/acs-system.js.map +1 -0
- package/lib/{interact-for-acs-user.js → interactions/acs-user.js} +4 -4
- package/lib/interactions/acs-user.js.map +1 -0
- package/lib/{interact-for-action-attempt-poll.js → interactions/action-attempt-poll.js} +5 -5
- package/lib/interactions/action-attempt-poll.js.map +1 -0
- package/lib/{interact-for-array.js → interactions/array.js} +4 -3
- package/lib/interactions/array.js.map +1 -0
- package/lib/{interact-for-blueprint-object.d.ts → interactions/blueprint-object.d.ts} +3 -2
- package/lib/{interact-for-blueprint-object.js → interactions/blueprint-object.js} +49 -20
- package/lib/interactions/blueprint-object.js.map +1 -0
- package/lib/{interact-for-command-params.d.ts → interactions/command-params.d.ts} +2 -2
- package/lib/{interact-for-command-params.js → interactions/command-params.js} +4 -3
- package/lib/interactions/command-params.js.map +1 -0
- package/lib/interactions/command-selection.d.ts +10 -0
- package/lib/{interact-for-command-selection.js → interactions/command-selection.js} +9 -15
- package/lib/interactions/command-selection.js.map +1 -0
- package/lib/{interact-for-connected-account.js → interactions/connected-account.js} +3 -3
- package/lib/interactions/connected-account.js.map +1 -0
- package/lib/{interact-for-custom-metadata.js → interactions/custom-metadata.js} +4 -3
- package/lib/interactions/custom-metadata.js.map +1 -0
- package/lib/{interact-for-device.js → interactions/device.js} +3 -3
- package/lib/interactions/device.js.map +1 -0
- package/lib/interactions/index.d.ts +19 -0
- package/lib/interactions/index.js +20 -0
- package/lib/interactions/index.js.map +1 -0
- package/lib/{interact-for-login.js → interactions/login.js} +16 -14
- package/lib/interactions/login.js.map +1 -0
- package/lib/{interact-for-resource.js → interactions/resource.js} +3 -3
- package/lib/interactions/resource.js.map +1 -0
- package/lib/{interact-for-server-selection.js → interactions/server-selection.js} +10 -13
- package/lib/interactions/server-selection.js.map +1 -0
- package/lib/{interact-for-timestamp.js → interactions/timestamp.js} +2 -2
- package/lib/interactions/timestamp.js.map +1 -0
- package/lib/{interact-for-use-remote-api-defs.js → interactions/use-remote-api-defs.js} +5 -6
- package/lib/interactions/use-remote-api-defs.js.map +1 -0
- package/lib/{interact-for-user-identity.js → interactions/user-identity.js} +3 -3
- package/lib/interactions/user-identity.js.map +1 -0
- package/lib/{interact-for-workspace-id.js → interactions/workspace-id.js} +11 -10
- package/lib/interactions/workspace-id.js.map +1 -0
- package/lib/memory-prompt.d.ts +32 -0
- package/lib/memory-prompt.js +41 -0
- package/lib/memory-prompt.js.map +1 -0
- package/lib/output/get-output.d.ts +1 -1
- package/lib/output/get-output.js +1 -1
- package/lib/output/get-output.js.map +1 -1
- package/lib/output/{create-memory-output.d.ts → memory-output.d.ts} +1 -1
- package/lib/output/{create-memory-output.js → memory-output.js} +2 -2
- package/lib/output/memory-output.js.map +1 -0
- package/lib/output/{create-output.d.ts → output.d.ts} +18 -1
- package/lib/output/output.js +46 -0
- package/lib/output/output.js.map +1 -0
- package/lib/output/read-stdin-json.js.map +1 -0
- package/lib/output/resolve-output-format.d.ts +1 -1
- package/lib/{util → output}/with-loading.js +1 -1
- package/lib/output/with-loading.js.map +1 -0
- package/lib/prompt.d.ts +101 -0
- package/lib/{util/prompt.js → prompt.js} +83 -56
- package/lib/prompt.js.map +1 -0
- package/lib/{completion → render/completion}/describe.js +1 -2
- package/lib/render/completion/describe.js.map +1 -0
- package/lib/{completion → render/completion}/index.d.ts +2 -2
- package/lib/{completion → render/completion}/index.js +1 -2
- package/lib/render/completion/index.js.map +1 -0
- package/lib/{completion → render/completion}/render-bash.d.ts +1 -1
- package/lib/{completion → render/completion}/render-bash.js +1 -1
- package/lib/render/completion/render-bash.js.map +1 -0
- package/lib/{completion → render/completion}/render-fish.d.ts +1 -1
- package/lib/render/completion/render-fish.js.map +1 -0
- package/lib/{completion → render/completion}/render-zsh.d.ts +1 -1
- package/lib/{completion → render/completion}/render-zsh.js +1 -1
- package/lib/render/completion/render-zsh.js.map +1 -0
- package/lib/{render-help.d.ts → render/help.d.ts} +1 -1
- package/lib/{render-help.js → render/help.js} +2 -2
- package/lib/render/help.js.map +1 -0
- package/lib/render/text.d.ts +4 -0
- package/lib/render/text.js +16 -0
- package/lib/render/text.js.map +1 -0
- package/lib/version.d.ts +2 -2
- package/lib/version.js +2 -2
- package/package.json +4 -3
- package/src/bin/cli.ts +91 -332
- package/src/lib/args/coerce.ts +164 -0
- package/src/lib/{util/cli-args.ts → args/parse.ts} +30 -25
- package/src/lib/args/validate.ts +73 -0
- package/src/lib/auth/operations.ts +169 -0
- package/src/lib/{validate-token.ts → auth/validate-token.ts} +2 -2
- package/src/lib/blueprint/cache.ts +97 -0
- package/src/lib/{get-response-key.ts → blueprint/endpoint.ts} +17 -3
- package/src/lib/blueprint/index.ts +27 -0
- package/src/lib/{blueprint.ts → blueprint/source-npm.ts} +27 -99
- package/src/lib/blueprint/source-remote.ts +17 -0
- package/src/lib/commands/api-command.ts +109 -0
- package/src/lib/commands/local/completion.ts +51 -0
- package/src/lib/commands/local/config-reveal-location.ts +16 -0
- package/src/lib/commands/local/config-set-fake-server.ts +21 -0
- package/src/lib/commands/local/config-use-remote-api-defs.ts +23 -0
- package/src/lib/commands/local/health.ts +22 -0
- package/src/lib/commands/local/login.ts +42 -0
- package/src/lib/commands/local/logout.ts +18 -0
- package/src/lib/commands/local/select-server.ts +30 -0
- package/src/lib/commands/local/select-workspace.ts +25 -0
- package/src/lib/commands/local/wizard.ts +31 -0
- package/src/lib/commands/registry.ts +127 -0
- package/src/lib/{command-spec.ts → commands/spec.ts} +30 -131
- package/src/lib/config/config-store.ts +39 -64
- package/src/lib/config/index.ts +8 -1
- package/src/lib/config/memory-config-store.ts +62 -0
- package/src/lib/config/migrate.ts +1 -1
- package/src/lib/config/values.ts +72 -0
- package/src/lib/context.ts +84 -0
- package/src/lib/env.ts +9 -2
- package/src/lib/errors.ts +67 -0
- package/src/lib/http/api.ts +61 -0
- package/src/lib/{get-seam.ts → http/client.ts} +19 -18
- package/src/lib/http/follow-ups.ts +42 -0
- package/src/lib/http/memory-seam-api.ts +57 -0
- package/src/lib/http/request.ts +69 -0
- package/src/lib/{interact-for-access-code.ts → interactions/access-code.ts} +4 -3
- package/src/lib/{interact-for-acs-entrance.ts → interactions/acs-entrance.ts} +3 -2
- package/src/lib/{interact-for-acs-system.ts → interactions/acs-system.ts} +3 -2
- package/src/lib/{interact-for-acs-user.ts → interactions/acs-user.ts} +4 -3
- package/src/lib/{interact-for-action-attempt-poll.ts → interactions/action-attempt-poll.ts} +4 -4
- package/src/lib/{interact-for-array.ts → interactions/array.ts} +3 -3
- package/src/lib/{interact-for-blueprint-object.ts → interactions/blueprint-object.ts} +57 -24
- package/src/lib/{interact-for-command-params.ts → interactions/command-params.ts} +6 -4
- package/src/lib/{interact-for-command-selection.ts → interactions/command-selection.ts} +11 -23
- package/src/lib/{interact-for-connected-account.ts → interactions/connected-account.ts} +3 -2
- package/src/lib/{interact-for-custom-metadata.ts → interactions/custom-metadata.ts} +3 -7
- package/src/lib/{interact-for-device.ts → interactions/device.ts} +3 -2
- package/src/lib/interactions/index.ts +19 -0
- package/src/lib/{interact-for-login.ts → interactions/login.ts} +16 -13
- package/src/lib/{interact-for-resource.ts → interactions/resource.ts} +2 -2
- package/src/lib/{interact-for-server-selection.ts → interactions/server-selection.ts} +12 -17
- package/src/lib/{interact-for-timestamp.ts → interactions/timestamp.ts} +1 -1
- package/src/lib/{interact-for-use-remote-api-defs.ts → interactions/use-remote-api-defs.ts} +4 -5
- package/src/lib/{interact-for-user-identity.ts → interactions/user-identity.ts} +3 -2
- package/src/lib/{interact-for-workspace-id.ts → interactions/workspace-id.ts} +10 -17
- package/src/lib/memory-prompt.ts +89 -0
- package/src/lib/output/get-output.ts +1 -1
- package/src/lib/output/{create-memory-output.ts → memory-output.ts} +1 -1
- package/src/lib/output/{create-output.ts → output.ts} +47 -32
- package/src/lib/output/resolve-output-format.ts +1 -1
- package/src/lib/{util → output}/with-loading.ts +1 -1
- package/src/lib/prompt.ts +306 -0
- package/src/lib/{completion → render/completion}/describe.ts +1 -2
- package/src/lib/{completion → render/completion}/index.ts +3 -4
- package/src/lib/{completion → render/completion}/render-bash.ts +1 -1
- package/src/lib/{completion → render/completion}/render-fish.ts +2 -1
- package/src/lib/{completion → render/completion}/render-zsh.ts +2 -1
- package/src/lib/{render-help.ts → render/help.ts} +1 -1
- package/src/lib/render/text.ts +17 -0
- package/src/lib/version.ts +2 -2
- package/lib/blueprint.d.ts +0 -7
- package/lib/blueprint.js.map +0 -1
- package/lib/command-spec.js.map +0 -1
- package/lib/completion/describe.js.map +0 -1
- package/lib/completion/index.js.map +0 -1
- package/lib/completion/render-bash.js.map +0 -1
- package/lib/completion/render-fish.js.map +0 -1
- package/lib/completion/render-zsh.js.map +0 -1
- package/lib/get-api-blueprint.d.ts +0 -6
- package/lib/get-api-blueprint.js +0 -18
- package/lib/get-api-blueprint.js.map +0 -1
- package/lib/get-command-blueprint-def.d.ts +0 -2
- package/lib/get-command-blueprint-def.js +0 -11
- package/lib/get-command-blueprint-def.js.map +0 -1
- package/lib/get-credentials.d.ts +0 -15
- package/lib/get-credentials.js +0 -35
- package/lib/get-credentials.js.map +0 -1
- package/lib/get-current-workspace-id.d.ts +0 -1
- package/lib/get-current-workspace-id.js +0 -9
- package/lib/get-current-workspace-id.js.map +0 -1
- package/lib/get-response-key.d.ts +0 -9
- package/lib/get-response-key.js.map +0 -1
- package/lib/get-seam.d.ts +0 -3
- package/lib/get-seam.js.map +0 -1
- package/lib/get-server.d.ts +0 -6
- package/lib/get-server.js +0 -17
- package/lib/get-server.js.map +0 -1
- package/lib/interact-for-access-code.js.map +0 -1
- package/lib/interact-for-acs-entrance.js.map +0 -1
- package/lib/interact-for-acs-system.js.map +0 -1
- package/lib/interact-for-acs-user.js.map +0 -1
- package/lib/interact-for-action-attempt-poll.js.map +0 -1
- package/lib/interact-for-array.js.map +0 -1
- package/lib/interact-for-blueprint-object.js.map +0 -1
- package/lib/interact-for-command-params.js.map +0 -1
- package/lib/interact-for-command-selection.d.ts +0 -2
- package/lib/interact-for-command-selection.js.map +0 -1
- package/lib/interact-for-connected-account.js.map +0 -1
- package/lib/interact-for-custom-metadata.js.map +0 -1
- package/lib/interact-for-device.js.map +0 -1
- package/lib/interact-for-login.js.map +0 -1
- package/lib/interact-for-resource.js.map +0 -1
- package/lib/interact-for-server-selection.js.map +0 -1
- package/lib/interact-for-timestamp.js.map +0 -1
- package/lib/interact-for-use-remote-api-defs.js.map +0 -1
- package/lib/interact-for-user-identity.js.map +0 -1
- package/lib/interact-for-workspace-id.js.map +0 -1
- package/lib/output/create-memory-output.js.map +0 -1
- package/lib/output/create-output.js +0 -34
- package/lib/output/create-output.js.map +0 -1
- package/lib/render-help.js.map +0 -1
- package/lib/types.d.ts +0 -6
- package/lib/types.js +0 -2
- package/lib/types.js.map +0 -1
- package/lib/util/cli-args.js.map +0 -1
- package/lib/util/ellipsis.d.ts +0 -1
- package/lib/util/ellipsis.js +0 -6
- package/lib/util/ellipsis.js.map +0 -1
- package/lib/util/prompt.d.ts +0 -80
- package/lib/util/prompt.js.map +0 -1
- package/lib/util/read-stdin-json.js.map +0 -1
- package/lib/util/request-seam-api.d.ts +0 -7
- package/lib/util/request-seam-api.js +0 -26
- package/lib/util/request-seam-api.js.map +0 -1
- package/lib/util/with-loading.js.map +0 -1
- package/lib/validate-token.js.map +0 -1
- package/src/lib/get-api-blueprint.ts +0 -31
- package/src/lib/get-command-blueprint-def.ts +0 -15
- package/src/lib/get-credentials.ts +0 -38
- package/src/lib/get-current-workspace-id.ts +0 -9
- package/src/lib/get-server.ts +0 -20
- package/src/lib/types.ts +0 -7
- package/src/lib/util/ellipsis.ts +0 -4
- package/src/lib/util/prompt.ts +0 -229
- package/src/lib/util/request-seam-api.ts +0 -47
- /package/lib/{validate-token.d.ts → auth/validate-token.d.ts} +0 -0
- /package/lib/{interact-for-access-code.d.ts → interactions/access-code.d.ts} +0 -0
- /package/lib/{interact-for-acs-entrance.d.ts → interactions/acs-entrance.d.ts} +0 -0
- /package/lib/{interact-for-acs-system.d.ts → interactions/acs-system.d.ts} +0 -0
- /package/lib/{interact-for-acs-user.d.ts → interactions/acs-user.d.ts} +0 -0
- /package/lib/{interact-for-action-attempt-poll.d.ts → interactions/action-attempt-poll.d.ts} +0 -0
- /package/lib/{interact-for-array.d.ts → interactions/array.d.ts} +0 -0
- /package/lib/{interact-for-connected-account.d.ts → interactions/connected-account.d.ts} +0 -0
- /package/lib/{interact-for-custom-metadata.d.ts → interactions/custom-metadata.d.ts} +0 -0
- /package/lib/{interact-for-device.d.ts → interactions/device.d.ts} +0 -0
- /package/lib/{interact-for-login.d.ts → interactions/login.d.ts} +0 -0
- /package/lib/{interact-for-resource.d.ts → interactions/resource.d.ts} +0 -0
- /package/lib/{interact-for-server-selection.d.ts → interactions/server-selection.d.ts} +0 -0
- /package/lib/{interact-for-timestamp.d.ts → interactions/timestamp.d.ts} +0 -0
- /package/lib/{interact-for-use-remote-api-defs.d.ts → interactions/use-remote-api-defs.d.ts} +0 -0
- /package/lib/{interact-for-user-identity.d.ts → interactions/user-identity.d.ts} +0 -0
- /package/lib/{interact-for-workspace-id.d.ts → interactions/workspace-id.d.ts} +0 -0
- /package/lib/{util → output}/read-stdin-json.d.ts +0 -0
- /package/lib/{util → output}/read-stdin-json.js +0 -0
- /package/lib/{util → output}/with-loading.d.ts +0 -0
- /package/lib/{completion → render/completion}/describe.d.ts +0 -0
- /package/lib/{completion → render/completion}/render-fish.js +0 -0
- /package/src/lib/{util → output}/read-stdin-json.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-fish.js","sourceRoot":"","sources":["../../../src/lib/render/completion/render-fish.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAiB,EAAU,EAAE,CAChE,GAAG;IACD,MAAM;IACN,OAAO;IACP,CAAC,qBAAqB,EAAE,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAClE,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IAChC,qBAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CACvC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;AAEpB,MAAM,MAAM,GAAG;;;;;;;gEAOiD,CAAA;AAEhE,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;IAkBZ,CAAA;AAEJ,MAAM,qBAAqB,GAAG,CAAC,IAAiB,EAAY,EAAE,CAC5D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC5B,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAA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CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;CAC3B,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,WAAmB,EAAU,EAAE;IAC/C,MAAM,OAAO,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAA;IAC7C,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,OAAO,GAAG,CAAA;AAChD,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,OAAiB,EAAU,EAAE,CAC7C,CAAC,kBAAkB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type CommandSpec } from '
|
|
1
|
+
import { type CommandSpec } from '../../commands/spec.js';
|
|
2
2
|
export declare const renderZshCompletion: (spec: CommandSpec) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-zsh.js","sourceRoot":"","sources":["../../../src/lib/render/completion/render-zsh.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,GACX,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEhD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAiB,EAAU,EAAE;IAC/D,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW;SACrC,MAAM,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC;SACvC,OAAO,CAAC,UAAU,CAAC;SACnB,IAAI,EAAE,CAAA;IAET,OAAO,GAAG;QACR,MAAM;QACN,UAAU,CAAC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,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,OAAO,GAAG,CAAA;AAChE,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,QAAkB,EAAU,EAAE,CAC9D;IACE,GAAG,IAAI,MAAM;IACb,gBAAgB;IAChB,GAAG,QAAQ,CAAC,GAAG,CACb,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CACvB,SAAS,OAAO,oBAAoB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAC9D;IACD,QAAQ;IACR,GAAG;CACJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import commandLineUsage, {} from 'command-line-usage';
|
|
2
|
-
import { findCommand, findGroup, } from '
|
|
2
|
+
import { findCommand, findGroup, } from '../commands/spec.js';
|
|
3
3
|
/**
|
|
4
4
|
* Render the help guide for a command path, or `null` when no command or
|
|
5
5
|
* group goes by that path.
|
|
@@ -151,4 +151,4 @@ const describeValues = (flag) => {
|
|
|
151
151
|
const rest = flag.values.length - maxDocumentedValues;
|
|
152
152
|
return rest > 0 ? `One of: ${shown}, and ${rest} more.` : `One of: ${shown}.`;
|
|
153
153
|
};
|
|
154
|
-
//# sourceMappingURL=
|
|
154
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/lib/render/help.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,EAAE,EAAgB,MAAM,oBAAoB,CAAA;AAEnE,OAAO,EAKL,WAAW,EACX,SAAS,GACV,MAAM,sBAAsB,CAAA;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAAc,EACd,IAAiB,EACF,EAAE;IACjB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAA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,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;QACxC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,IAAiB,EAAU,EAAE;IACnD,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAEvC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAClE,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,mBAAmB,CAAA;IAErD,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,WAAW,KAAK,GAAG,CAAA;AAC/E,CAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const ellipsis = (str, len) => {
|
|
2
|
+
if (str.length <= len)
|
|
3
|
+
return str;
|
|
4
|
+
return str.slice(0, len - 3) + '...';
|
|
5
|
+
};
|
|
6
|
+
/** Reduce documentation markdown to a single line of prose. */
|
|
7
|
+
export const toPlainText = (markdown) => markdown
|
|
8
|
+
.replace(/\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
9
|
+
.replace(/[`*]/g, '')
|
|
10
|
+
.replace(/\s+/g, ' ')
|
|
11
|
+
.trim();
|
|
12
|
+
export const firstSentence = (text) => {
|
|
13
|
+
const [sentence] = text.split(/(?<=\.)\s/);
|
|
14
|
+
return sentence ?? text;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/lib/render/text.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE;IACnD,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,GAAG,CAAA;IACjC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;AACtC,CAAC,CAAA;AAED,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAU,EAAE,CACtD,QAAQ;KACL,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC;KACvC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;KACpB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;KACpB,IAAI,EAAE,CAAA;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAU,EAAE;IACpD,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAC1C,OAAO,QAAQ,IAAI,IAAI,CAAA;AACzB,CAAC,CAAA"}
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Versions are replaced with generated values when the package is packed.
|
|
2
|
-
const seamapiCliVersion = '0.
|
|
3
|
-
const seamapiBlueprintVersion = '1.
|
|
2
|
+
const seamapiCliVersion = '0.19.0';
|
|
3
|
+
const seamapiBlueprintVersion = '1.5.0';
|
|
4
4
|
export { seamapiBlueprintVersion };
|
|
5
5
|
export default seamapiCliVersion;
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "A command-line interface (CLI) for interacting with the Seam API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@clack/prompts": "^1.7.0",
|
|
96
|
-
"@seamapi/blueprint": "1.
|
|
96
|
+
"@seamapi/blueprint": "1.5.0",
|
|
97
97
|
"@seamapi/http": "2.2.0",
|
|
98
98
|
"@seamapi/wizard": "0.5.2",
|
|
99
99
|
"chalk": "^6.0.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"tar": "^7.5.22"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@seamapi/types": "1.
|
|
109
|
+
"@seamapi/types": "^1.994.0",
|
|
110
110
|
"@types/command-line-usage": "^5.0.4",
|
|
111
111
|
"@types/minimist": "^1.2.5",
|
|
112
112
|
"@types/node": "^24.10.9",
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"concurrently": "^10.0.4",
|
|
115
115
|
"del-cli": "^7.0.0",
|
|
116
116
|
"eslint": "^9.31.0",
|
|
117
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
117
118
|
"eslint-plugin-import": "^2.32.0",
|
|
118
119
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
119
120
|
"eslint-plugin-unused-imports": "^4.1.4",
|
package/src/bin/cli.ts
CHANGED
|
@@ -1,65 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { randomBytes } from 'node:crypto'
|
|
3
2
|
import { isDeepStrictEqual as isEqual } from 'node:util'
|
|
4
3
|
|
|
5
4
|
import chalk from 'chalk'
|
|
6
5
|
import type { ParsedArgs } from 'minimist'
|
|
7
6
|
|
|
8
|
-
import { findLocalCommand, getCommandSpec } from 'lib/command-spec.js'
|
|
9
|
-
import {
|
|
10
|
-
completionShells,
|
|
11
|
-
isCompletionShell,
|
|
12
|
-
renderCompletion,
|
|
13
|
-
} from 'lib/completion/index.js'
|
|
14
|
-
import { getConfigStore } from 'lib/config/index.js'
|
|
15
|
-
import {
|
|
16
|
-
assertEnvVarUnset,
|
|
17
|
-
endpointEnvVar,
|
|
18
|
-
EnvVarOverrideError,
|
|
19
|
-
getEndpointFromEnv,
|
|
20
|
-
getTokenFromEnv,
|
|
21
|
-
getWorkspaceIdFromEnv,
|
|
22
|
-
tokenEnvVar,
|
|
23
|
-
workspaceIdEnvVar,
|
|
24
|
-
} from 'lib/env.js'
|
|
25
|
-
import { getApiBlueprint } from 'lib/get-api-blueprint.js'
|
|
26
|
-
import { getCommandBlueprintDef } from 'lib/get-command-blueprint-def.js'
|
|
27
|
-
import { getToken } from 'lib/get-credentials.js'
|
|
28
|
-
import { getResponseKey } from 'lib/get-response-key.js'
|
|
29
|
-
import { getServer } from 'lib/get-server.js'
|
|
30
|
-
import { interactForActionAttemptPoll } from 'lib/interact-for-action-attempt-poll.js'
|
|
31
|
-
import { interactForCommandParams } from 'lib/interact-for-command-params.js'
|
|
32
|
-
import { interactForCommandSelection } from 'lib/interact-for-command-selection.js'
|
|
33
|
-
import { interactForLogin } from 'lib/interact-for-login.js'
|
|
34
|
-
import { interactForServerSelection } from 'lib/interact-for-server-selection.js'
|
|
35
|
-
import { interactForUseRemoteApiDefs } from 'lib/interact-for-use-remote-api-defs.js'
|
|
36
|
-
import { interactForWorkspaceId } from 'lib/interact-for-workspace-id.js'
|
|
37
|
-
import { createOutput } from 'lib/output/create-output.js'
|
|
38
|
-
import { getOutput, setOutput } from 'lib/output/get-output.js'
|
|
39
|
-
import { resolveOutputFormat } from 'lib/output/resolve-output-format.js'
|
|
40
|
-
import { renderHelp } from 'lib/render-help.js'
|
|
41
|
-
import type { ContextHelpers } from 'lib/types.js'
|
|
42
7
|
import {
|
|
43
8
|
cliFlags,
|
|
44
9
|
getInteractivity,
|
|
45
|
-
type Interactivity,
|
|
46
|
-
NonInteractiveError,
|
|
47
10
|
parseCliArgs,
|
|
48
|
-
toGivenArgName,
|
|
49
11
|
toParameterName,
|
|
50
|
-
|
|
51
|
-
} from 'lib/
|
|
12
|
+
} from 'lib/args/parse.js'
|
|
13
|
+
import { assertKnownArgs } from 'lib/args/validate.js'
|
|
14
|
+
import { getApiBlueprint } from 'lib/blueprint/index.js'
|
|
15
|
+
import { printCompletion } from 'lib/commands/local/completion.js'
|
|
16
|
+
import { runWizard } from 'lib/commands/local/wizard.js'
|
|
17
|
+
import {
|
|
18
|
+
acceptedParamsOf,
|
|
19
|
+
buildRegistry,
|
|
20
|
+
findLocalCommand,
|
|
21
|
+
} from 'lib/commands/registry.js'
|
|
22
|
+
import { getConfigStore } from 'lib/config/index.js'
|
|
23
|
+
import { type CliContext, resolveAuth } from 'lib/context.js'
|
|
24
|
+
import { tokenEnvVar } from 'lib/env.js'
|
|
25
|
+
import { reportErrorAndExit } from 'lib/errors.js'
|
|
26
|
+
import { createSeamApi, type SeamApi } from 'lib/http/api.js'
|
|
27
|
+
import { interactForCommandSelection } from 'lib/interactions/index.js'
|
|
28
|
+
import { getOutput, setOutput } from 'lib/output/get-output.js'
|
|
29
|
+
import { createOutput } from 'lib/output/output.js'
|
|
30
|
+
import { readStdinJson } from 'lib/output/read-stdin-json.js'
|
|
31
|
+
import { resolveOutputFormat } from 'lib/output/resolve-output-format.js'
|
|
32
|
+
import { canPrompt } from 'lib/prompt.js'
|
|
52
33
|
import {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} from 'lib/
|
|
57
|
-
import { readStdinJson } from 'lib/util/read-stdin-json.js'
|
|
58
|
-
import { RequestSeamApi } from 'lib/util/request-seam-api.js'
|
|
59
|
-
import { validateToken } from 'lib/validate-token.js'
|
|
34
|
+
completionShells,
|
|
35
|
+
isCompletionShell,
|
|
36
|
+
} from 'lib/render/completion/index.js'
|
|
37
|
+
import { renderHelp } from 'lib/render/help.js'
|
|
60
38
|
import seamapiCliVersion from 'lib/version.js'
|
|
61
39
|
|
|
62
|
-
async function cli(args: ParsedArgs) {
|
|
40
|
+
async function cli(args: ParsedArgs, argv: string[]) {
|
|
63
41
|
const config = getConfigStore()
|
|
64
42
|
const output = getOutput()
|
|
65
43
|
|
|
@@ -69,7 +47,8 @@ async function cli(args: ParsedArgs) {
|
|
|
69
47
|
if (helpFlag != null) {
|
|
70
48
|
// Help comes from the cached API definitions so that it works without
|
|
71
49
|
// logging in, and offline once the cache is warm.
|
|
72
|
-
const
|
|
50
|
+
const cachedBlueprint = await getApiBlueprint({ update })
|
|
51
|
+
const { spec } = buildRegistry(cachedBlueprint)
|
|
73
52
|
|
|
74
53
|
// minimist reads the word after --help as its value, so 'seam --help
|
|
75
54
|
// devices' asks about devices just as 'seam devices --help' does.
|
|
@@ -128,41 +107,29 @@ async function cli(args: ParsedArgs) {
|
|
|
128
107
|
return
|
|
129
108
|
}
|
|
130
109
|
|
|
131
|
-
|
|
110
|
+
const command = findLocalCommand(['completion', shell])
|
|
111
|
+
assertKnownArgs(argParams, ['completion', shell], {
|
|
112
|
+
accepted:
|
|
113
|
+
command == null ? new Set() : acceptedParamsOf(command.definition),
|
|
114
|
+
isLocal: true,
|
|
115
|
+
})
|
|
132
116
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
// served by Seam when config use-remote-api-defs is enabled.
|
|
136
|
-
output.text(
|
|
137
|
-
renderCompletion(shell, await getApiBlueprint(false, { update })),
|
|
138
|
-
)
|
|
117
|
+
const cachedBlueprint = await getApiBlueprint({ update })
|
|
118
|
+
printCompletion(shell, buildRegistry(cachedBlueprint).spec)
|
|
139
119
|
return
|
|
140
120
|
}
|
|
141
121
|
|
|
142
|
-
|
|
143
|
-
args._[0] === 'config' &&
|
|
144
|
-
args._[1] === 'set' &&
|
|
145
|
-
args._[2] === 'fake-server'
|
|
146
|
-
) {
|
|
147
|
-
assertEnvVarUnset(endpointEnvVar, getEndpointFromEnv(), 'select a server')
|
|
148
|
-
assertEnvVarUnset(tokenEnvVar, getTokenFromEnv(), 'log in')
|
|
122
|
+
const localCommand = findLocalCommand(args._)
|
|
149
123
|
|
|
150
|
-
|
|
151
|
-
|
|
124
|
+
// Commands declared not to need a token bypass the login gate. A partial
|
|
125
|
+
// path keeps the historical rule: only login and select server may be
|
|
126
|
+
// reached logged out.
|
|
127
|
+
const requiresAuth =
|
|
128
|
+
localCommand != null
|
|
129
|
+
? localCommand.requiresAuth
|
|
130
|
+
: !(args._[0] === 'login' || isEqual(args._, ['select', 'server']))
|
|
152
131
|
|
|
153
|
-
|
|
154
|
-
output.info(`Server URL set to ${fakeApiUrl}`)
|
|
155
|
-
|
|
156
|
-
config.set(`${getServer()}.pat`, `seam_apikey1_token`)
|
|
157
|
-
output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`)
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (
|
|
162
|
-
getToken() == null &&
|
|
163
|
-
args._[0] !== 'login' &&
|
|
164
|
-
!isEqual(args._, ['select', 'server'])
|
|
165
|
-
) {
|
|
132
|
+
if (requiresAuth && resolveAuth(config).token == null) {
|
|
166
133
|
output.error(`Not logged in. Please run "seam login" or set ${tokenEnvVar}`)
|
|
167
134
|
process.exitCode = 1
|
|
168
135
|
return
|
|
@@ -171,265 +138,78 @@ async function cli(args: ParsedArgs) {
|
|
|
171
138
|
const useRemoteApiDefs =
|
|
172
139
|
args['remote_api_defs'] ?? config.get('use_remote_api_defs')
|
|
173
140
|
|
|
174
|
-
const blueprint = await getApiBlueprint(
|
|
141
|
+
const blueprint = await getApiBlueprint({
|
|
142
|
+
useRemoteDefinitions: useRemoteApiDefs ?? false,
|
|
175
143
|
update,
|
|
176
144
|
})
|
|
177
145
|
|
|
146
|
+
const registry = buildRegistry(blueprint)
|
|
147
|
+
|
|
178
148
|
// Params piped or redirected in, e.g., `seam devices list < params.json`.
|
|
179
|
-
|
|
180
|
-
const
|
|
149
|
+
const pipedParams = await readStdinJson()
|
|
150
|
+
const stdinParams: Record<string, any> = { ...pipedParams }
|
|
151
|
+
|
|
152
|
+
const auth = resolveAuth(config)
|
|
153
|
+
let seamApi: Promise<SeamApi> | null = null
|
|
181
154
|
|
|
182
|
-
const ctx:
|
|
155
|
+
const ctx: CliContext = {
|
|
156
|
+
config,
|
|
157
|
+
auth,
|
|
158
|
+
output,
|
|
183
159
|
blueprint,
|
|
184
160
|
interactivity: getInteractivity(args, { canPrompt: canPrompt() }),
|
|
161
|
+
api: async () => await (seamApi ??= createSeamApi(auth)),
|
|
185
162
|
}
|
|
186
163
|
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
Object.assign(commandParams, argParams)
|
|
190
|
-
|
|
191
|
-
const selectedCommand = await interactForCommandSelection(args._, ctx)
|
|
164
|
+
const selectableCommands = registry.spec.commands.map(({ path }) => path)
|
|
192
165
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
166
|
+
let commandPath = args._
|
|
167
|
+
while (true) {
|
|
168
|
+
const selectedCommand = await interactForCommandSelection(commandPath, {
|
|
169
|
+
commands: selectableCommands,
|
|
170
|
+
interactivity: ctx.interactivity,
|
|
198
171
|
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Check the arguments before the command acts on any of them, so a mistake
|
|
202
|
-
// is reported rather than half applied.
|
|
203
|
-
assertKnownArgs(argParams, selectedCommand, ctx)
|
|
204
172
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (args['server']) {
|
|
210
|
-
assertEnvVarUnset(endpointEnvVar, getEndpointFromEnv(), 'select a server')
|
|
211
|
-
}
|
|
212
|
-
if (args['workspace_id']) {
|
|
213
|
-
assertEnvVarUnset(
|
|
214
|
-
workspaceIdEnvVar,
|
|
215
|
-
getWorkspaceIdFromEnv(),
|
|
216
|
-
'select a workspace',
|
|
217
|
-
)
|
|
218
|
-
}
|
|
219
|
-
if (args['server']) {
|
|
220
|
-
config.set('server', args['server'])
|
|
221
|
-
config.delete('current_workspace_id')
|
|
222
|
-
}
|
|
223
|
-
if (args['token']) {
|
|
224
|
-
const token = String(args['token']).trim()
|
|
225
|
-
await validateToken(token, args['workspace_id'])
|
|
226
|
-
config.set(`${getServer()}.pat`, token)
|
|
227
|
-
config.delete('current_workspace_id')
|
|
173
|
+
// Hit 'back' on a top-level command path, so we start again
|
|
174
|
+
if (selectedCommand.at(-1) === '[Back]') {
|
|
175
|
+
commandPath = []
|
|
176
|
+
continue
|
|
228
177
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
if (isNonInteractive) {
|
|
236
|
-
throw new NonInteractiveError(
|
|
237
|
-
'Missing required parameter for login: --token',
|
|
238
|
-
)
|
|
239
|
-
}
|
|
240
|
-
await interactForLogin()
|
|
241
|
-
return
|
|
242
|
-
} else if (isEqual(selectedCommand, ['logout'])) {
|
|
243
|
-
assertEnvVarUnset(tokenEnvVar, getTokenFromEnv(), 'log out')
|
|
244
|
-
config.delete(`${getServer()}.pat`)
|
|
245
|
-
config.delete('current_workspace_id')
|
|
246
|
-
output.info('Logged out!')
|
|
247
|
-
return
|
|
248
|
-
} else if (isEqual(selectedCommand, ['config', 'reveal-location'])) {
|
|
249
|
-
output.text(config.path)
|
|
250
|
-
return
|
|
251
|
-
} else if (isEqual(selectedCommand, ['config', 'use-remote-api-defs'])) {
|
|
252
|
-
if (isNonInteractive) {
|
|
253
|
-
throw new NonInteractiveError(
|
|
254
|
-
'Cannot select whether to use remote API definitions in non-interactive mode',
|
|
255
|
-
)
|
|
256
|
-
}
|
|
257
|
-
await interactForUseRemoteApiDefs()
|
|
258
|
-
return
|
|
259
|
-
} else if (isEqual(selectedCommand, ['select', 'workspace'])) {
|
|
260
|
-
assertEnvVarUnset(
|
|
261
|
-
workspaceIdEnvVar,
|
|
262
|
-
getWorkspaceIdFromEnv(),
|
|
263
|
-
'select a workspace',
|
|
264
|
-
)
|
|
265
|
-
if (isNonInteractive) {
|
|
266
|
-
throw new NonInteractiveError(
|
|
267
|
-
'Cannot select a workspace in non-interactive mode: pass --workspace-id to "seam login"',
|
|
268
|
-
)
|
|
269
|
-
}
|
|
270
|
-
await interactForWorkspaceId()
|
|
271
|
-
return
|
|
272
|
-
} else if (isEqual(selectedCommand, ['events', 'list'])) {
|
|
273
|
-
if (!commandParams['since']) {
|
|
274
|
-
const date = new Date()
|
|
275
|
-
date.setMonth(date.getMonth() - 1)
|
|
276
|
-
commandParams['since'] = date.toISOString()
|
|
277
|
-
}
|
|
278
|
-
} else if (isEqual(selectedCommand, ['select', 'server'])) {
|
|
279
|
-
assertEnvVarUnset(endpointEnvVar, getEndpointFromEnv(), 'select a server')
|
|
280
|
-
if (args['server']) {
|
|
281
|
-
config.set('server', args['server'])
|
|
282
|
-
config.delete('current_workspace_id')
|
|
283
|
-
return
|
|
284
|
-
}
|
|
285
|
-
if (isNonInteractive) {
|
|
286
|
-
throw new NonInteractiveError(
|
|
287
|
-
'Missing required parameter for select server: --server',
|
|
178
|
+
|
|
179
|
+
const command = registry.find(selectedCommand)
|
|
180
|
+
if (command == null) {
|
|
181
|
+
throw new Error(
|
|
182
|
+
`No definition for command seam ${selectedCommand.join(' ')}`,
|
|
288
183
|
)
|
|
289
184
|
}
|
|
290
|
-
await interactForServerSelection()
|
|
291
|
-
return
|
|
292
|
-
} else if (isEqual(selectedCommand, ['health', 'get-health'])) {
|
|
293
|
-
await RequestSeamApi({
|
|
294
|
-
path: '/health/get_health',
|
|
295
|
-
params: {},
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
return
|
|
299
|
-
}
|
|
300
|
-
// TODO - do this using the OpenAPI spec for the command rather than
|
|
301
|
-
// explicitly encoding the property names
|
|
302
|
-
if (commandParams['accepted_providers']) {
|
|
303
|
-
commandParams['accepted_providers'] =
|
|
304
|
-
commandParams['accepted_providers'].split(',')
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const apiPath = `/${selectedCommand.join('/').replace(/-/g, '_')}`
|
|
308
185
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (params === '[Back]') {
|
|
315
|
-
const previousCommands = [...selectedCommand]
|
|
316
|
-
previousCommands.pop()
|
|
317
|
-
return await cli({
|
|
318
|
-
...args,
|
|
319
|
-
_: previousCommands,
|
|
186
|
+
// Check the arguments before the command acts on any of them, so a
|
|
187
|
+
// mistake is reported rather than half applied.
|
|
188
|
+
assertKnownArgs(argParams, selectedCommand, {
|
|
189
|
+
accepted: acceptedParamsOf(command.definition),
|
|
190
|
+
isLocal: findLocalCommand(selectedCommand) != null,
|
|
320
191
|
})
|
|
321
|
-
}
|
|
322
192
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const response = await RequestSeamApi({
|
|
328
|
-
path: apiPath,
|
|
329
|
-
params,
|
|
330
|
-
responseKey: getResponseKey(selectedCommand, ctx),
|
|
331
|
-
})
|
|
332
|
-
|
|
333
|
-
if (response.data?.connect_webview) {
|
|
334
|
-
await handleConnectWebviewResponse(
|
|
335
|
-
response.data.connect_webview,
|
|
336
|
-
ctx.interactivity,
|
|
193
|
+
const result = await command.execute(
|
|
194
|
+
{ path: selectedCommand, argParams, stdinParams, args, argv },
|
|
195
|
+
ctx,
|
|
337
196
|
)
|
|
338
|
-
}
|
|
339
197
|
|
|
340
|
-
|
|
341
|
-
|
|
198
|
+
if (result.kind === 'back') {
|
|
199
|
+
commandPath = result.toPath
|
|
200
|
+
continue
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return
|
|
342
204
|
}
|
|
343
205
|
}
|
|
344
206
|
|
|
345
207
|
const toCommandWord = (arg: string): string =>
|
|
346
208
|
arg.toLowerCase().replace(/_/g, '-')
|
|
347
209
|
|
|
348
|
-
/**
|
|
349
|
-
* Report any argument the command does not accept, rather than acting on it.
|
|
350
|
-
* An unrecognized argument is a mistake: forwarded to the API it would fail
|
|
351
|
-
* somewhere less obvious or be quietly ignored, and on a command the CLI
|
|
352
|
-
* handles itself it would go nowhere at all.
|
|
353
|
-
*
|
|
354
|
-
* Only arguments are checked. Params read from stdin are passed through as
|
|
355
|
-
* given, so a caller may send whatever the API itself accepts.
|
|
356
|
-
*
|
|
357
|
-
* `ctx` is only needed to look up an endpoint's parameters, so commands the
|
|
358
|
-
* CLI declares itself can be checked before any blueprint is loaded.
|
|
359
|
-
*/
|
|
360
|
-
const assertKnownArgs = (
|
|
361
|
-
argParams: Record<string, any>,
|
|
362
|
-
command: string[],
|
|
363
|
-
ctx?: ContextHelpers,
|
|
364
|
-
): void => {
|
|
365
|
-
const local = findLocalCommand(command)
|
|
366
|
-
|
|
367
|
-
let accepted: Set<string>
|
|
368
|
-
if (local != null) {
|
|
369
|
-
accepted = new Set(
|
|
370
|
-
local.flags.flatMap(({ long }) =>
|
|
371
|
-
long == null ? [] : [toParameterName(long)],
|
|
372
|
-
),
|
|
373
|
-
)
|
|
374
|
-
} else if (ctx != null) {
|
|
375
|
-
accepted = new Set(
|
|
376
|
-
getCommandBlueprintDef(command, ctx).request.parameters.map(
|
|
377
|
-
({ name }) => name,
|
|
378
|
-
),
|
|
379
|
-
)
|
|
380
|
-
} else {
|
|
381
|
-
throw new Error(`No definition for command seam ${command.join(' ')}`)
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
const unknown = Object.keys(argParams).filter((key) => !accepted.has(key))
|
|
385
|
-
if (unknown.length === 0) return
|
|
386
|
-
|
|
387
|
-
// Name an endpoint command by its path, as missing params are named, and a
|
|
388
|
-
// command the CLI handles itself by the words that run it.
|
|
389
|
-
const target =
|
|
390
|
-
local == null
|
|
391
|
-
? `/${command.join('/').replace(/-/g, '_')}`
|
|
392
|
-
: command.join(' ')
|
|
393
|
-
|
|
394
|
-
throw new UsageError(
|
|
395
|
-
`Unknown ${
|
|
396
|
-
unknown.length === 1 ? 'parameter' : 'parameters'
|
|
397
|
-
} for ${target}: ${unknown.map(toGivenArgName).join(' ')}`,
|
|
398
|
-
{
|
|
399
|
-
hint: `Run 'seam ${command.join(' ')} --help' to see what it accepts.`,
|
|
400
|
-
},
|
|
401
|
-
)
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
const handleConnectWebviewResponse = async (
|
|
405
|
-
connectWebview: any,
|
|
406
|
-
interactivity: Interactivity,
|
|
407
|
-
) => {
|
|
408
|
-
const url = connectWebview.url
|
|
409
|
-
|
|
410
|
-
if (
|
|
411
|
-
interactivity !== 'non-interactive' &&
|
|
412
|
-
process.env['INSIDE_WEB_BROWSER'] !== '1'
|
|
413
|
-
) {
|
|
414
|
-
const action = await promptConfirm({
|
|
415
|
-
message: 'Would you like to open the webview in your browser?',
|
|
416
|
-
initialValue: false,
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
if (action) {
|
|
420
|
-
const { default: open } = await import('open')
|
|
421
|
-
await open(url)
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
210
|
const run = async (argv: string[]) => {
|
|
427
211
|
if (argv[0] === 'wizard') {
|
|
428
|
-
|
|
429
|
-
await wizard({
|
|
430
|
-
argv: argv.slice(1),
|
|
431
|
-
commandName: 'seam wizard',
|
|
432
|
-
})
|
|
212
|
+
await runWizard(argv.slice(1))
|
|
433
213
|
return
|
|
434
214
|
}
|
|
435
215
|
|
|
@@ -444,30 +224,9 @@ const run = async (argv: string[]) => {
|
|
|
444
224
|
}),
|
|
445
225
|
)
|
|
446
226
|
|
|
447
|
-
await cli(args)
|
|
227
|
+
await cli(args, argv)
|
|
448
228
|
}
|
|
449
229
|
|
|
450
230
|
run(process.argv.slice(2)).catch((e: unknown) => {
|
|
451
|
-
|
|
452
|
-
process.exitCode = 1
|
|
453
|
-
|
|
454
|
-
if (e instanceof UsageError) {
|
|
455
|
-
output.error(chalk.red(e.message))
|
|
456
|
-
if (e.hint !== '') output.error(e.hint)
|
|
457
|
-
return
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
if (e instanceof NonInteractiveError || e instanceof EnvVarOverrideError) {
|
|
461
|
-
output.error(chalk.red(e.message))
|
|
462
|
-
return
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (e instanceof PromptCancelledError) {
|
|
466
|
-
output.error(chalk.gray(e.message))
|
|
467
|
-
return
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
const error = e instanceof Error ? e : new Error(String(e))
|
|
471
|
-
output.error(chalk.red(`CLI Error: ${error.message}`))
|
|
472
|
-
if (error.stack != null) output.error(chalk.gray(error.stack))
|
|
231
|
+
reportErrorAndExit(e, getOutput())
|
|
473
232
|
})
|