@credibledata/cred-cli 0.0.103 → 0.0.105
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 +106 -1
- package/dist/agent-contract.spec.js +548 -0
- package/dist/agent-contract.spec.js.map +1 -0
- package/dist/browser.js +72 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.spec.js +125 -0
- package/dist/browser.spec.js.map +1 -0
- package/dist/client/api.js +4137 -1159
- package/dist/client/api.js.map +1 -1
- package/dist/client-codeassist/api.js +476 -0
- package/dist/client-codeassist/api.js.map +1 -0
- package/dist/client-codeassist/base.js +69 -0
- package/dist/client-codeassist/base.js.map +1 -0
- package/dist/client-codeassist/common.js +162 -0
- package/dist/client-codeassist/common.js.map +1 -0
- package/dist/client-codeassist/configuration.js +44 -0
- package/dist/client-codeassist/configuration.js.map +1 -0
- package/dist/client-codeassist/index.js +32 -0
- package/dist/client-codeassist/index.js.map +1 -0
- package/dist/clientconfiguration.js +17 -289
- package/dist/clientconfiguration.js.map +1 -1
- package/dist/clientconfiguration.spec.js +35 -96
- package/dist/clientconfiguration.spec.js.map +1 -1
- package/dist/commands/add.js +103 -3
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/add.spec.js +113 -0
- package/dist/commands/add.spec.js.map +1 -0
- package/dist/commands/connection/createconnections.js +104 -7
- package/dist/commands/connection/createconnections.js.map +1 -1
- package/dist/commands/connection/createconnections.spec.js +35 -1
- package/dist/commands/connection/createconnections.spec.js.map +1 -1
- package/dist/commands/connection/deleteconnection.js +4 -2
- package/dist/commands/connection/deleteconnection.js.map +1 -1
- package/dist/commands/connection/deleteconnection.spec.js +6 -1
- package/dist/commands/connection/deleteconnection.spec.js.map +1 -1
- package/dist/commands/connection/listconnections.js +2 -0
- package/dist/commands/connection/listconnections.js.map +1 -1
- package/dist/commands/connection/updateconnection.js +365 -0
- package/dist/commands/connection/updateconnection.js.map +1 -0
- package/dist/commands/connection/updateconnection.spec.js +625 -0
- package/dist/commands/connection/updateconnection.spec.js.map +1 -0
- package/dist/commands/database/createdatabase.js +52 -0
- package/dist/commands/database/createdatabase.js.map +1 -0
- package/dist/commands/database/database.spec.js +267 -0
- package/dist/commands/database/database.spec.js.map +1 -0
- package/dist/commands/database/deletedatabase.js +91 -0
- package/dist/commands/database/deletedatabase.js.map +1 -0
- package/dist/commands/database/getdatabase.js +97 -0
- package/dist/commands/database/getdatabase.js.map +1 -0
- package/dist/commands/database/listdatabases.js +36 -0
- package/dist/commands/database/listdatabases.js.map +1 -0
- package/dist/commands/database/shared.js +125 -0
- package/dist/commands/database/shared.js.map +1 -0
- package/dist/commands/database/shared.spec.js +109 -0
- package/dist/commands/database/shared.spec.js.map +1 -0
- package/dist/commands/database/updatedatabase.js +39 -0
- package/dist/commands/database/updatedatabase.js.map +1 -0
- package/dist/commands/environment/createenvironment.js +59 -28
- package/dist/commands/environment/createenvironment.js.map +1 -1
- package/dist/commands/environment/createenvironment.spec.js +29 -0
- package/dist/commands/environment/createenvironment.spec.js.map +1 -1
- package/dist/commands/environment/deleteenvironment.js +3 -2
- package/dist/commands/environment/deleteenvironment.js.map +1 -1
- package/dist/commands/environment/deleteenvironment.spec.js +5 -1
- package/dist/commands/environment/deleteenvironment.spec.js.map +1 -1
- package/dist/commands/environment/getenvironment.js +1 -0
- package/dist/commands/environment/getenvironment.js.map +1 -1
- package/dist/commands/environment/listenvironments.js +40 -8
- package/dist/commands/environment/listenvironments.js.map +1 -1
- package/dist/commands/environment/listenvironments.spec.js +41 -2
- package/dist/commands/environment/listenvironments.spec.js.map +1 -1
- package/dist/commands/environment/setenvironment.js +145 -6
- package/dist/commands/environment/setenvironment.js.map +1 -1
- package/dist/commands/environment/setenvironment.spec.js +256 -8
- package/dist/commands/environment/setenvironment.spec.js.map +1 -1
- package/dist/commands/environment/updateenvironment.js +12 -8
- package/dist/commands/environment/updateenvironment.js.map +1 -1
- package/dist/commands/environment/updateenvironment.spec.js +36 -2
- package/dist/commands/environment/updateenvironment.spec.js.map +1 -1
- package/dist/commands/get.js +64 -1
- package/dist/commands/get.js.map +1 -1
- package/dist/commands/group/addmember.js +3 -1
- package/dist/commands/group/addmember.js.map +1 -1
- package/dist/commands/group/addmember.spec.js +7 -2
- package/dist/commands/group/addmember.spec.js.map +1 -1
- package/dist/commands/group/creategroup.js +2 -0
- package/dist/commands/group/creategroup.js.map +1 -1
- package/dist/commands/group/deletegroup.js +3 -1
- package/dist/commands/group/deletegroup.js.map +1 -1
- package/dist/commands/group/deletegroup.spec.js +7 -1
- package/dist/commands/group/deletegroup.spec.js.map +1 -1
- package/dist/commands/group/getgroup.js +2 -0
- package/dist/commands/group/getgroup.js.map +1 -1
- package/dist/commands/group/listgroups.js +2 -0
- package/dist/commands/group/listgroups.js.map +1 -1
- package/dist/commands/group/removemember.js +3 -1
- package/dist/commands/group/removemember.js.map +1 -1
- package/dist/commands/group/removemember.spec.js +7 -2
- package/dist/commands/group/removemember.spec.js.map +1 -1
- package/dist/commands/groupaccesstoken/deleteToken.js +2 -1
- package/dist/commands/groupaccesstoken/deleteToken.js.map +1 -1
- package/dist/commands/groupaccesstoken/groupContainer.js +2 -0
- package/dist/commands/groupaccesstoken/groupContainer.js.map +1 -1
- package/dist/commands/list.js +24 -4
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/materialization/cancelrun.js +3 -1
- package/dist/commands/materialization/cancelrun.js.map +1 -1
- package/dist/commands/materialization/getindex.js +2 -0
- package/dist/commands/materialization/getindex.js.map +1 -1
- package/dist/commands/materialization/getmaterialization.js +2 -0
- package/dist/commands/materialization/getmaterialization.js.map +1 -1
- package/dist/commands/materialization/getpreaggregate.js +2 -0
- package/dist/commands/materialization/getpreaggregate.js.map +1 -1
- package/dist/commands/materialization/getrun.js +2 -0
- package/dist/commands/materialization/getrun.js.map +1 -1
- package/dist/commands/materialization/listindexes.js +2 -0
- package/dist/commands/materialization/listindexes.js.map +1 -1
- package/dist/commands/materialization/listmaterializations.js +2 -0
- package/dist/commands/materialization/listmaterializations.js.map +1 -1
- package/dist/commands/materialization/listpreaggregates.js +2 -0
- package/dist/commands/materialization/listpreaggregates.js.map +1 -1
- package/dist/commands/materialization/listruns.js +3 -1
- package/dist/commands/materialization/listruns.js.map +1 -1
- package/dist/commands/materialization/rerun.js +3 -1
- package/dist/commands/materialization/rerun.js.map +1 -1
- package/dist/commands/misc/inquirerHost.js +87 -0
- package/dist/commands/misc/inquirerHost.js.map +1 -0
- package/dist/commands/misc/inquirerHost.spec.js +91 -0
- package/dist/commands/misc/inquirerHost.spec.js.map +1 -0
- package/dist/commands/misc/login.js +348 -58
- package/dist/commands/misc/login.js.map +1 -1
- package/dist/commands/misc/login.spec.js +525 -7
- package/dist/commands/misc/login.spec.js.map +1 -1
- package/dist/commands/misc/logout.js +26 -3
- package/dist/commands/misc/logout.js.map +1 -1
- package/dist/commands/misc/logout.spec.js +52 -12
- package/dist/commands/misc/logout.spec.js.map +1 -1
- package/dist/commands/misc/resolveLoginTarget.spec.js +90 -0
- package/dist/commands/misc/resolveLoginTarget.spec.js.map +1 -0
- package/dist/commands/misc/scope.spec.js +108 -0
- package/dist/commands/misc/scope.spec.js.map +1 -0
- package/dist/commands/misc/set-access-token.js +1 -1
- package/dist/commands/misc/set-access-token.js.map +1 -1
- package/dist/commands/misc/set-access-token.spec.js +13 -2
- package/dist/commands/misc/set-access-token.spec.js.map +1 -1
- package/dist/commands/misc/setup.js +819 -0
- package/dist/commands/misc/setup.js.map +1 -0
- package/dist/commands/misc/setup.spec.js +783 -0
- package/dist/commands/misc/setup.spec.js.map +1 -0
- package/dist/commands/misc/status.js +168 -0
- package/dist/commands/misc/status.js.map +1 -0
- package/dist/commands/misc/status.spec.js +301 -0
- package/dist/commands/misc/status.spec.js.map +1 -0
- package/dist/commands/misc/token.js +57 -0
- package/dist/commands/misc/token.js.map +1 -0
- package/dist/commands/misc/token.spec.js +92 -0
- package/dist/commands/misc/token.spec.js.map +1 -0
- package/dist/commands/package/deletepackage.js +4 -2
- package/dist/commands/package/deletepackage.js.map +1 -1
- package/dist/commands/package/deletepackage.spec.js +7 -1
- package/dist/commands/package/deletepackage.spec.js.map +1 -1
- package/dist/commands/package/getpackage.js +142 -0
- package/dist/commands/package/getpackage.js.map +1 -0
- package/dist/commands/package/getpackage.spec.js +246 -0
- package/dist/commands/package/getpackage.spec.js.map +1 -0
- package/dist/commands/package/listpackages.js +2 -0
- package/dist/commands/package/listpackages.js.map +1 -1
- package/dist/commands/package/publish.archive.spec.js +570 -0
- package/dist/commands/package/publish.archive.spec.js.map +1 -0
- package/dist/commands/package/publish.js +780 -49
- package/dist/commands/package/publish.js.map +1 -1
- package/dist/commands/package/publish.spec.js +451 -8
- package/dist/commands/package/publish.spec.js.map +1 -1
- package/dist/commands/package/updatepackage.js +22 -19
- package/dist/commands/package/updatepackage.js.map +1 -1
- package/dist/commands/package/updatepackage.spec.js +36 -1
- package/dist/commands/package/updatepackage.spec.js.map +1 -1
- package/dist/commands/permission/createpermission.js +3 -1
- package/dist/commands/permission/createpermission.js.map +1 -1
- package/dist/commands/permission/deletepermission.js +6 -3
- package/dist/commands/permission/deletepermission.js.map +1 -1
- package/dist/commands/permission/getpermission.js +2 -0
- package/dist/commands/permission/getpermission.js.map +1 -1
- package/dist/commands/permission/listpermissions.js +2 -0
- package/dist/commands/permission/listpermissions.js.map +1 -1
- package/dist/commands/rm.js +21 -0
- package/dist/commands/rm.js.map +1 -1
- package/dist/commands/set.js +40 -6
- package/dist/commands/set.js.map +1 -1
- package/dist/commands/set.spec.js +123 -0
- package/dist/commands/set.spec.js.map +1 -0
- package/dist/commands/table/addtable.js +155 -0
- package/dist/commands/table/addtable.js.map +1 -0
- package/dist/commands/table/deletetable.js +45 -0
- package/dist/commands/table/deletetable.js.map +1 -0
- package/dist/commands/table/gettable.js +32 -0
- package/dist/commands/table/gettable.js.map +1 -0
- package/dist/commands/table/listtables.js +36 -0
- package/dist/commands/table/listtables.js.map +1 -0
- package/dist/commands/table/table.spec.js +304 -0
- package/dist/commands/table/table.spec.js.map +1 -0
- package/dist/commands/table/tablefile.js +195 -0
- package/dist/commands/table/tablefile.js.map +1 -0
- package/dist/commands/table/tablefile.spec.js +158 -0
- package/dist/commands/table/tablefile.spec.js.map +1 -0
- package/dist/commands/update.js +21 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/version/archive-unarchive-version.js +4 -2
- package/dist/commands/version/archive-unarchive-version.js.map +1 -1
- package/dist/commands/version/archive-unarchive-version.spec.js +6 -1
- package/dist/commands/version/archive-unarchive-version.spec.js.map +1 -1
- package/dist/commands/version/listversions.js +2 -0
- package/dist/commands/version/listversions.js.map +1 -1
- package/dist/common/UserGroupId.js +9 -4
- package/dist/common/UserGroupId.js.map +1 -1
- package/dist/common/UserGroupId.spec.js +5 -0
- package/dist/common/UserGroupId.spec.js.map +1 -1
- package/dist/constants.js +37 -143
- package/dist/constants.js.map +1 -1
- package/dist/index.js +487 -90
- package/dist/index.js.map +1 -1
- package/dist/logger.js +42 -9
- package/dist/logger.js.map +1 -1
- package/dist/session.js +56 -0
- package/dist/session.js.map +1 -0
- package/dist/session.spec.js +103 -0
- package/dist/session.spec.js.map +1 -0
- package/dist/setup-core/briefing.js +176 -0
- package/dist/setup-core/briefing.js.map +1 -0
- package/dist/setup-core/credstore.js +415 -0
- package/dist/setup-core/credstore.js.map +1 -0
- package/dist/setup-core/credstore.spec.js +238 -0
- package/dist/setup-core/credstore.spec.js.map +1 -0
- package/dist/setup-core/environments.js +267 -0
- package/dist/setup-core/environments.js.map +1 -0
- package/dist/setup-core/flow.e2e.js +165 -0
- package/dist/setup-core/flow.e2e.js.map +1 -0
- package/dist/setup-core/flow.js +765 -0
- package/dist/setup-core/flow.js.map +1 -0
- package/dist/setup-core/flow.spec.js +1348 -0
- package/dist/setup-core/flow.spec.js.map +1 -0
- package/dist/setup-core/folderconfig.js +283 -0
- package/dist/setup-core/folderconfig.js.map +1 -0
- package/dist/setup-core/git.js +97 -0
- package/dist/setup-core/git.js.map +1 -0
- package/dist/setup-core/host.js +77 -0
- package/dist/setup-core/host.js.map +1 -0
- package/dist/setup-core/importconnections.js +470 -0
- package/dist/setup-core/importconnections.js.map +1 -0
- package/dist/setup-core/importconnections.spec.js +594 -0
- package/dist/setup-core/importconnections.spec.js.map +1 -0
- package/dist/setup-core/liveness.js +94 -0
- package/dist/setup-core/liveness.js.map +1 -0
- package/dist/setup-core/liveness.spec.js +59 -0
- package/dist/setup-core/liveness.spec.js.map +1 -0
- package/dist/setup-core/localpublisherconfig.js +26 -0
- package/dist/setup-core/localpublisherconfig.js.map +1 -0
- package/dist/setup-core/localpublisherconfig.spec.js +29 -0
- package/dist/setup-core/localpublisherconfig.spec.js.map +1 -0
- package/dist/setup-core/mcpconfig.js +198 -0
- package/dist/setup-core/mcpconfig.js.map +1 -0
- package/dist/setup-core/mcpconfig.spec.js +205 -0
- package/dist/setup-core/mcpconfig.spec.js.map +1 -0
- package/dist/setup-core/packagemanifest.js +55 -0
- package/dist/setup-core/packagemanifest.js.map +1 -0
- package/dist/setup-core/ports.js +182 -0
- package/dist/setup-core/ports.js.map +1 -0
- package/dist/setup-core/ports.spec.js +173 -0
- package/dist/setup-core/ports.spec.js.map +1 -0
- package/dist/setup-core/publisherconfig.js +268 -0
- package/dist/setup-core/publisherconfig.js.map +1 -0
- package/dist/setup-core/publisherconfig.oracle.js +166 -0
- package/dist/setup-core/publisherconfig.oracle.js.map +1 -0
- package/dist/setup-core/publisherconfig.spec.js +277 -0
- package/dist/setup-core/publisherconfig.spec.js.map +1 -0
- package/dist/setup-core/publisherversion.js +26 -0
- package/dist/setup-core/publisherversion.js.map +1 -0
- package/dist/setup-core/readiness.spec.js +161 -0
- package/dist/setup-core/readiness.spec.js.map +1 -0
- package/dist/setup-core/readylines.js +169 -0
- package/dist/setup-core/readylines.js.map +1 -0
- package/dist/setup-core/readylines.spec.js +70 -0
- package/dist/setup-core/readylines.spec.js.map +1 -0
- package/dist/setup-core/refresh.js +348 -0
- package/dist/setup-core/refresh.js.map +1 -0
- package/dist/setup-core/refresh.spec.js +501 -0
- package/dist/setup-core/refresh.spec.js.map +1 -0
- package/dist/setup-core/skills.js +279 -0
- package/dist/setup-core/skills.js.map +1 -0
- package/dist/setup-core/skills.spec.js +334 -0
- package/dist/setup-core/skills.spec.js.map +1 -0
- package/dist/setup-core/supervisor.js +879 -0
- package/dist/setup-core/supervisor.js.map +1 -0
- package/dist/setup-core/supervisor.spec.js +833 -0
- package/dist/setup-core/supervisor.spec.js.map +1 -0
- package/dist/setup-core/writefile.js +61 -0
- package/dist/setup-core/writefile.js.map +1 -0
- package/dist/setup-core/writefile.spec.js +68 -0
- package/dist/setup-core/writefile.spec.js.map +1 -0
- package/dist/utils.js +409 -3
- package/dist/utils.js.map +1 -1
- package/dist/utils.spec.js +373 -2
- package/dist/utils.spec.js.map +1 -1
- package/dist/versioncheck-refresh.js +18 -0
- package/dist/versioncheck-refresh.js.map +1 -0
- package/dist/versioncheck.js +324 -0
- package/dist/versioncheck.js.map +1 -0
- package/dist/versioncheck.spec.js +587 -0
- package/dist/versioncheck.spec.js.map +1 -0
- package/node_modules/@credibledata/cli-auth/dist/index.d.ts +86 -0
- package/node_modules/@credibledata/cli-auth/dist/index.js +102 -0
- package/node_modules/@credibledata/cli-auth/package.json +19 -0
- package/package.json +18 -6
- package/.github/workflows/build.yml +0 -23
- package/.mocharc.json +0 -10
- package/.prettierignore +0 -2
- package/.prettierrc +0 -4
- package/README-DEV.md +0 -40
- package/coverage/coverage-summary.json +0 -40
- package/coverage/tmp/coverage-2152-1789496974457-0.json +0 -1
- package/coverage/tmp/coverage-2153-1789496954404-0.json +0 -1
- package/docker/Dockerfile.ci +0 -18
- package/docker-compose.yml +0 -18
- package/eslint.config.mjs +0 -45
- package/generate-client.sh +0 -27
- package/mocha.setup.ts +0 -4
- package/openapitools.json +0 -10
- package/src/client/.openapi-generator/FILES +0 -9
- package/src/client/.openapi-generator/VERSION +0 -1
- package/src/client/.openapi-generator-ignore +0 -23
- package/src/client/api.ts +0 -15999
- package/src/client/base.ts +0 -86
- package/src/client/common.ts +0 -150
- package/src/client/configuration.ts +0 -110
- package/src/client/git_push.sh +0 -57
- package/src/client/index.ts +0 -18
- package/src/clientconfiguration.spec.ts +0 -615
- package/src/clientconfiguration.ts +0 -364
- package/src/commands/add.ts +0 -191
- package/src/commands/connection/createconnections.spec.ts +0 -413
- package/src/commands/connection/createconnections.ts +0 -109
- package/src/commands/connection/deleteconnection.spec.ts +0 -189
- package/src/commands/connection/deleteconnection.ts +0 -57
- package/src/commands/connection/listconnections.spec.ts +0 -132
- package/src/commands/connection/listconnections.ts +0 -58
- package/src/commands/environment/createenvironment.spec.ts +0 -249
- package/src/commands/environment/createenvironment.ts +0 -73
- package/src/commands/environment/deleteenvironment.spec.ts +0 -152
- package/src/commands/environment/deleteenvironment.ts +0 -48
- package/src/commands/environment/getenvironment.spec.ts +0 -110
- package/src/commands/environment/getenvironment.ts +0 -43
- package/src/commands/environment/listenvironments.spec.ts +0 -123
- package/src/commands/environment/listenvironments.ts +0 -67
- package/src/commands/environment/setenvironment.spec.ts +0 -63
- package/src/commands/environment/setenvironment.ts +0 -14
- package/src/commands/environment/updateenvironment.spec.ts +0 -386
- package/src/commands/environment/updateenvironment.ts +0 -168
- package/src/commands/get.ts +0 -153
- package/src/commands/group/addmember.spec.ts +0 -257
- package/src/commands/group/addmember.ts +0 -85
- package/src/commands/group/creategroup.spec.ts +0 -146
- package/src/commands/group/creategroup.ts +0 -54
- package/src/commands/group/deletegroup.spec.ts +0 -120
- package/src/commands/group/deletegroup.ts +0 -45
- package/src/commands/group/getgroup.spec.ts +0 -129
- package/src/commands/group/getgroup.ts +0 -47
- package/src/commands/group/listgroups.spec.ts +0 -137
- package/src/commands/group/listgroups.ts +0 -45
- package/src/commands/group/removemember.spec.ts +0 -224
- package/src/commands/group/removemember.ts +0 -75
- package/src/commands/groupaccesstoken/createToken.spec.ts +0 -211
- package/src/commands/groupaccesstoken/createToken.ts +0 -72
- package/src/commands/groupaccesstoken/deleteToken.spec.ts +0 -147
- package/src/commands/groupaccesstoken/deleteToken.ts +0 -29
- package/src/commands/groupaccesstoken/groupContainer.ts +0 -83
- package/src/commands/groupaccesstoken/listTokens.spec.ts +0 -147
- package/src/commands/groupaccesstoken/listTokens.ts +0 -29
- package/src/commands/legacy.ts +0 -5
- package/src/commands/list.ts +0 -326
- package/src/commands/materialization/cancelrun.ts +0 -70
- package/src/commands/materialization/getindex.ts +0 -55
- package/src/commands/materialization/getmaterialization.ts +0 -57
- package/src/commands/materialization/getpreaggregate.ts +0 -58
- package/src/commands/materialization/getrun.ts +0 -55
- package/src/commands/materialization/listindexes.ts +0 -69
- package/src/commands/materialization/listmaterializations.ts +0 -53
- package/src/commands/materialization/listpreaggregates.ts +0 -74
- package/src/commands/materialization/listruns.ts +0 -77
- package/src/commands/materialization/rerun.ts +0 -123
- package/src/commands/misc/login.spec.ts +0 -371
- package/src/commands/misc/login.ts +0 -343
- package/src/commands/misc/logout.spec.ts +0 -32
- package/src/commands/misc/logout.ts +0 -9
- package/src/commands/misc/loopbackOAuth.ts +0 -127
- package/src/commands/misc/set-access-token.spec.ts +0 -95
- package/src/commands/misc/set-access-token.ts +0 -32
- package/src/commands/package/deletepackage.spec.ts +0 -164
- package/src/commands/package/deletepackage.ts +0 -58
- package/src/commands/package/listpackages.spec.ts +0 -163
- package/src/commands/package/listpackages.ts +0 -74
- package/src/commands/package/publish.spec.ts +0 -642
- package/src/commands/package/publish.ts +0 -236
- package/src/commands/package/updatepackage.spec.ts +0 -319
- package/src/commands/package/updatepackage.ts +0 -95
- package/src/commands/permission/createpermission.spec.ts +0 -507
- package/src/commands/permission/createpermission.ts +0 -181
- package/src/commands/permission/deletepermission.ts +0 -117
- package/src/commands/permission/getpermission.ts +0 -115
- package/src/commands/permission/listpermissions.ts +0 -101
- package/src/commands/permission/scope.ts +0 -180
- package/src/commands/rm.ts +0 -146
- package/src/commands/set.ts +0 -25
- package/src/commands/update.ts +0 -107
- package/src/commands/version/archive-unarchive-version.spec.ts +0 -456
- package/src/commands/version/archive-unarchive-version.ts +0 -108
- package/src/commands/version/listversions.spec.ts +0 -138
- package/src/commands/version/listversions.ts +0 -45
- package/src/common/UserGroupId.spec.ts +0 -115
- package/src/common/UserGroupId.ts +0 -137
- package/src/constants.spec.ts +0 -111
- package/src/constants.ts +0 -228
- package/src/index.ts +0 -378
- package/src/logger.spec.ts +0 -158
- package/src/logger.ts +0 -90
- package/src/polyfills/file.polyfill.ts +0 -6
- package/src/utils.spec.ts +0 -135
- package/src/utils.ts +0 -115
- package/src/validator.spec.ts +0 -51
- package/src/validator.ts +0 -44
- package/tsconfig.json +0 -17
package/dist/index.js
CHANGED
|
@@ -13,8 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
17
|
const axios_1 = __importDefault(require("axios"));
|
|
17
18
|
const commander_1 = require("commander");
|
|
19
|
+
const logger_1 = require("./logger");
|
|
18
20
|
const kleur_1 = __importDefault(require("kleur"));
|
|
19
21
|
const omelette_1 = __importDefault(require("omelette"));
|
|
20
22
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
@@ -25,6 +27,9 @@ const list_1 = require("./commands/list");
|
|
|
25
27
|
const login_1 = require("./commands/misc/login");
|
|
26
28
|
const logout_1 = require("./commands/misc/logout");
|
|
27
29
|
const set_access_token_1 = require("./commands/misc/set-access-token");
|
|
30
|
+
const setup_1 = require("./commands/misc/setup");
|
|
31
|
+
const status_1 = require("./commands/misc/status");
|
|
32
|
+
const token_1 = require("./commands/misc/token");
|
|
28
33
|
const listpackages_1 = require("./commands/package/listpackages");
|
|
29
34
|
const publish_1 = require("./commands/package/publish");
|
|
30
35
|
const listenvironments_1 = require("./commands/environment/listenvironments");
|
|
@@ -35,6 +40,30 @@ const archive_unarchive_version_1 = require("./commands/version/archive-unarchiv
|
|
|
35
40
|
const rerun_1 = require("./commands/materialization/rerun");
|
|
36
41
|
const cancelrun_1 = require("./commands/materialization/cancelrun");
|
|
37
42
|
const constants_1 = require("./constants");
|
|
43
|
+
const folderconfig_1 = require("./setup-core/folderconfig");
|
|
44
|
+
const host_1 = require("./setup-core/host");
|
|
45
|
+
const credstore_1 = require("./setup-core/credstore");
|
|
46
|
+
const session_1 = require("./session");
|
|
47
|
+
const utils_1 = require("./utils");
|
|
48
|
+
const versioncheck_1 = require("./versioncheck");
|
|
49
|
+
// First, before anything reads argv or the store: the flag is spliced out so
|
|
50
|
+
// everything below sees the line without it. Under `status --json` the error
|
|
51
|
+
// keeps the JSON contract an agent parses.
|
|
52
|
+
try {
|
|
53
|
+
(0, utils_1.takeCellFlag)(process.argv);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if ((0, utils_1.invokedCommand)(process.argv) === "status" &&
|
|
57
|
+
process.argv.includes("--json")) {
|
|
58
|
+
(0, status_1.printStatusError)(error);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
62
|
+
}
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
if ((0, utils_1.cellFlag)())
|
|
66
|
+
clientconfiguration_1.ClientConfiguration.scopeCommand({ deployment: (0, utils_1.cellFlag)() });
|
|
38
67
|
const clientConfig = new clientconfiguration_1.ClientConfiguration();
|
|
39
68
|
// `cred login` is the documented recovery path for a corrupt `~/.cred`, and the
|
|
40
69
|
// one command whose job is to (re)establish config. The startup reads below —
|
|
@@ -45,15 +74,169 @@ const clientConfig = new clientconfiguration_1.ClientConfiguration();
|
|
|
45
74
|
// command stays fail-loud (the thrown error still names `cred login` as the
|
|
46
75
|
// fix) so a stray read never silently resets a user's tokens.
|
|
47
76
|
if ((0, login_1.isLoginInvocation)(process.argv)) {
|
|
48
|
-
|
|
77
|
+
// Report it. `recoverIfCorrupt` returns the backup path instead of logging,
|
|
78
|
+
// because setup-core owns no logger — which makes saying so the caller's job.
|
|
79
|
+
// Dropping it would reset a user's tokens and move their file with no output
|
|
80
|
+
// at all, which is the silent-loss-of-state that #5133 exists to prevent.
|
|
81
|
+
const backupPath = clientConfig.recoverIfCorrupt();
|
|
82
|
+
if (backupPath) {
|
|
83
|
+
console.error(`Your credential file was unreadable, so it has been reset to defaults. ` +
|
|
84
|
+
`The previous one is at ${backupPath}.`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Every other command reads ~/.cred at startup too (the axios baseURL and the
|
|
88
|
+
// command registration below), so a corrupt file throws here, before Commander
|
|
89
|
+
// has parsed anything. Read it once up front and answer then: `status --json`
|
|
90
|
+
// with the JSON error an agent parses, anything else with the message, which
|
|
91
|
+
// names `cred login` as the fix. Either beats a stack trace.
|
|
92
|
+
try {
|
|
93
|
+
clientConfig.loadConfig();
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
if ((0, utils_1.invokedCommand)(process.argv) === "status" &&
|
|
97
|
+
process.argv.includes("--json")) {
|
|
98
|
+
(0, status_1.printStatusError)(error);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
if (!(error instanceof credstore_1.InvalidConfigError))
|
|
102
|
+
throw error;
|
|
103
|
+
console.error(error.message);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
const targetLines = [];
|
|
107
|
+
// Before anything below reads the store: in a directory `cred init` pinned,
|
|
108
|
+
// every org- and environment-scoped command acts on the pin, as publish does.
|
|
109
|
+
// Without this, `cred ls connections` there listed the global organization's
|
|
110
|
+
// connections under a `cred status` that named the pinned one.
|
|
111
|
+
try {
|
|
112
|
+
(0, setup_1.scopeCommandToDirectory)(process.argv
|
|
113
|
+
.slice(2)
|
|
114
|
+
.filter((arg) => !arg.startsWith("-"))
|
|
115
|
+
.slice(0, 2)
|
|
116
|
+
.join(" ") || undefined, process.cwd(),
|
|
117
|
+
// Held until the hook below: the scope has to be set before the commands
|
|
118
|
+
// register, but the line reads as "about to act", so it waits for a command
|
|
119
|
+
// that will actually run, not `--help` or one Commander rejects.
|
|
120
|
+
(line) => targetLines.push(line));
|
|
49
121
|
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
// A fresh store each time, so a scope set above is the one read.
|
|
50
127
|
const getActiveEnvironment = () => {
|
|
51
|
-
return
|
|
128
|
+
return new clientconfiguration_1.ClientConfiguration().getEnvironment();
|
|
52
129
|
};
|
|
53
130
|
axios_1.default.defaults.baseURL = constants_1.controlPlanesByEnv[getActiveEnvironment()];
|
|
54
131
|
const cli = commander_1.program
|
|
132
|
+
.name("cred")
|
|
55
133
|
.version(package_json_1.default.version, "-V, --cli-version", "Output the CLI version number")
|
|
56
|
-
.
|
|
134
|
+
.option("--non-interactive", "Never prompt. A question that needs an answer exits 2 and names the flag that answers it on stderr. Implied when stdin is not a terminal or CI is set.")
|
|
135
|
+
.description(kleur_1.default.green(constants_1.ASCII_TITLE))
|
|
136
|
+
.addHelpText("after", `
|
|
137
|
+
Driving cred from a script or an agent: every question has a flag. Without a
|
|
138
|
+
terminal (piped stdin, CI, --non-interactive) nothing prompts — a command that
|
|
139
|
+
needs an answer exits 2 and names the flag and the options on stderr. Logs go
|
|
140
|
+
to stderr; only data (\`cred status --json\`, \`cred ls ...\`) goes to stdout.
|
|
141
|
+
\`cred init\` writes .mcp.json, which an agent reads only when its session
|
|
142
|
+
starts: read \`cred init --help\` before running it. Each command's --help
|
|
143
|
+
documents it in full (\`cred publish --help\`, \`cred get --help\`).
|
|
144
|
+
|
|
145
|
+
Cells: credentials are kept per cell (${constants_1.ALL_ENVIRONMENTS.join(", ")}). \`--cell
|
|
146
|
+
<cell>\`, before or after any command, picks the cell for that one command, over
|
|
147
|
+
this directory's pin and your global cell, and is never saved. \`cred set cell
|
|
148
|
+
<cell>\` saves the global cell. \`cred login --force\` signs in again as someone
|
|
149
|
+
else; \`cred logout\` signs out of one cell.`);
|
|
150
|
+
// The agent contract, in one place: a prompt that could not be asked exits 2 —
|
|
151
|
+
// distinct from 1, so a script can tell "needs input" from "failed" — with the
|
|
152
|
+
// flag and the options already on stderr (`NeedsInputError` writes them). This
|
|
153
|
+
// catches the rejections Commander's `parseAsync` does not: actions that fire a
|
|
154
|
+
// promise without awaiting it.
|
|
155
|
+
process.on("unhandledRejection", (reason) => {
|
|
156
|
+
exitOnFailure(reason);
|
|
157
|
+
});
|
|
158
|
+
// Any other failure prints just its message and exits 1. Under `--debug` (or
|
|
159
|
+
// CRED_LOG_LEVEL=debug) it prints the stack instead, so a TypeError in an
|
|
160
|
+
// action can still be traced.
|
|
161
|
+
function exitOnFailure(error) {
|
|
162
|
+
if (error instanceof host_1.NeedsInputError) {
|
|
163
|
+
console.error(error.message);
|
|
164
|
+
process.exit(error.exitCode);
|
|
165
|
+
}
|
|
166
|
+
if (error instanceof Error) {
|
|
167
|
+
console.error(logger_1.debugRequested && error.stack ? error.stack : error.message);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
console.error(String(error));
|
|
171
|
+
}
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
// Refresh the access token before any command runs, rather than at each of the
|
|
175
|
+
// ~25 call sites that read it. Until now the CLI persisted a refresh token and
|
|
176
|
+
// never exchanged it, so every session died at the access token's `exp` and the
|
|
177
|
+
// user saw it as an unexplained 401.
|
|
178
|
+
//
|
|
179
|
+
// These commands are exempt:
|
|
180
|
+
// - `login` / `set-access-token` establish credentials, and `logout` destroys
|
|
181
|
+
// them, so refreshing first is pointless or actively wrong;
|
|
182
|
+
// - `token` runs its own refresh so it can report the outcome on stderr while
|
|
183
|
+
// keeping stdout to just the token;
|
|
184
|
+
// - `status` exists to *report* that you are not logged in. Refusing to run it
|
|
185
|
+
// for the reason it was invoked to explain would be the worst possible
|
|
186
|
+
// answer to "why isn't this working?";
|
|
187
|
+
// - `init` / `dev` resolve credentials themselves, and must: this hook exits
|
|
188
|
+
// the process on `logged-out`, which on a brand-new machine is exactly the
|
|
189
|
+
// state `cred init` exists to fix. Exiting here would make the one command
|
|
190
|
+
// a new user is told to type fail with "Run `cred login`" — the error
|
|
191
|
+
// message `ensureLoggedIn` was written to avoid. They also resolve a
|
|
192
|
+
// per-directory deployment first, so they need a differently-scoped
|
|
193
|
+
// credential store than the module-level one this hook holds;
|
|
194
|
+
// - `set ...` only writes the local config and sends no request, so on dev it
|
|
195
|
+
// worked with an expired session. Refreshing first would make it exit 1.
|
|
196
|
+
// - `publish --dry-run` (and `add version --dry-run`) uploads nothing and is
|
|
197
|
+
// documented as needing no login; see `needsNoSession`.
|
|
198
|
+
const COMMANDS_WITHOUT_REFRESH = new Set([
|
|
199
|
+
"login",
|
|
200
|
+
"logout",
|
|
201
|
+
"token",
|
|
202
|
+
"set-access-token",
|
|
203
|
+
"status",
|
|
204
|
+
"init",
|
|
205
|
+
"dev",
|
|
206
|
+
]);
|
|
207
|
+
cli.hook("preAction", (_thisCommand, actionCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
+
var _a;
|
|
209
|
+
for (const line of targetLines.splice(0))
|
|
210
|
+
console.error(line);
|
|
211
|
+
// Before the exemptions below: `init`, `dev` and `status` are the commands
|
|
212
|
+
// most worth a notice. On stderr, so `cred token` and `--json` stay clean.
|
|
213
|
+
const { notice } = (0, versioncheck_1.checkForUpdate)({ current: package_json_1.default.version });
|
|
214
|
+
if (notice)
|
|
215
|
+
console.error(notice);
|
|
216
|
+
if (COMMANDS_WITHOUT_REFRESH.has(actionCommand.name()) ||
|
|
217
|
+
((_a = actionCommand.parent) === null || _a === void 0 ? void 0 : _a.name()) === "set") {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// `add connection`, not `connection`: the name alone is shared by `get`,
|
|
221
|
+
// `rm` and the other groups.
|
|
222
|
+
const parent = actionCommand.parent;
|
|
223
|
+
const commandPath = parent && parent !== cli
|
|
224
|
+
? `${parent.name()} ${actionCommand.name()}`
|
|
225
|
+
: actionCommand.name();
|
|
226
|
+
if ((0, setup_1.needsNoSession)(commandPath, actionCommand.opts()))
|
|
227
|
+
return;
|
|
228
|
+
try {
|
|
229
|
+
(0, setup_1.refuseWriteUnderIgnoredPin)(commandPath, process.cwd());
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
yield (0, session_1.refreshSessionOrExit)(
|
|
236
|
+
// A fresh store, not the module-level one built before the scope was
|
|
237
|
+
// set: a scoped command sends the pinned deployment's token.
|
|
238
|
+
(0, setup_1.credStoreToRefresh)(commandPath, process.cwd(), new clientconfiguration_1.ClientConfiguration()));
|
|
239
|
+
}));
|
|
57
240
|
// Nested CRUD commands for resource management
|
|
58
241
|
(0, get_1.registerGetCommands)(cli, getActiveEnvironment());
|
|
59
242
|
(0, list_1.registerListCommands)(cli, getActiveEnvironment());
|
|
@@ -62,35 +245,85 @@ const cli = commander_1.program
|
|
|
62
245
|
(0, add_1.registerAddCommands)(cli, getActiveEnvironment());
|
|
63
246
|
(0, set_1.registerSetCommands)(cli);
|
|
64
247
|
// Root commands
|
|
65
|
-
|
|
66
|
-
|
|
248
|
+
// Every command against a Credible resource reads `cred <verb> <resource>`, the
|
|
249
|
+
// way the API is `<method> /…/<resource>`: publish is `add version` (POST a
|
|
250
|
+
// package version), archive is `update version --archived` (PATCH its
|
|
251
|
+
// archiveStatus), rerun is `add run`, cancel is `update run --cancel`. The verb
|
|
252
|
+
// set is the one `get`/`ls`/`add`/`update`/`rm` already use, so a new resource
|
|
253
|
+
// needs no new verb. The old top-level verbs (publish, archive, unarchive,
|
|
254
|
+
// rerun, cancel-run) stay exactly as they were, listed and without a warning:
|
|
255
|
+
// scripts, skills and docs use them, and each new form runs the same code.
|
|
256
|
+
const findGroup = (name) => {
|
|
257
|
+
const group = cli.commands.find((command) => command.name() === name);
|
|
258
|
+
if (!group)
|
|
259
|
+
throw new Error(`no '${name}' command group registered`);
|
|
260
|
+
return group;
|
|
261
|
+
};
|
|
262
|
+
const addGroup = findGroup("add");
|
|
263
|
+
const updateGroup = findGroup("update");
|
|
264
|
+
const publishOptions = (command) => command
|
|
67
265
|
.option("--debug")
|
|
68
266
|
.option("-y, --yes", "Skip confirmation.")
|
|
69
267
|
.option("--replication <replication_count>", "The number of replicas to create.", (v) => (v === undefined ? undefined : parseInt(v)), undefined)
|
|
70
|
-
.option("--set-latest", "
|
|
71
|
-
.
|
|
72
|
-
(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.
|
|
86
|
-
.
|
|
268
|
+
.option("--set-latest", "Make this version latest now, before its indexes and materialized tables are built. Without it, a package with auto-promote on (the default) makes it latest once they are built.", false)
|
|
269
|
+
.option("--dry-run", "List the files that would be uploaded and the ones left out, and upload nothing. Needs no login.", false)
|
|
270
|
+
.option("--json", "Machine-readable: one JSON document on stdout (the link, whether it became latest, what was left out).", false)
|
|
271
|
+
.addHelpText("after", (0, publish_1.publishHelpText)());
|
|
272
|
+
const publishAction = (options) => {
|
|
273
|
+
// Publish where this directory is pinned, not where the last unrelated
|
|
274
|
+
// command left the global deployment.
|
|
275
|
+
const target = (0, setup_1.resolveTarget)(process.cwd());
|
|
276
|
+
const identity = (0, setup_1.pinnedIdentity)(process.cwd(), target.credStore);
|
|
277
|
+
// Always, not only for a pin: see `describeIdentity`. An upload is not a
|
|
278
|
+
// step to take on an unstated assumption about which environment it is
|
|
279
|
+
// going to. stderr, because stdout is the command's data.
|
|
280
|
+
console.error(`Publishing to ${(0, setup_1.describeIdentity)(target.deployment, identity, identity.from, target.from)}`);
|
|
281
|
+
(0, publish_1.publish)(constants_1.controlPlanesByEnv[target.deployment],
|
|
282
|
+
// Known bug, kept as dev has it: `--replication` lands on
|
|
283
|
+
// `options.replication`, so this is always undefined and the flag is
|
|
284
|
+
// ignored. Honoring it made a local publish with `--replication 2` hang
|
|
285
|
+
// and roll back, so fixing it is its own change.
|
|
286
|
+
options.replicationCount, options.debug, options.yes, options.setLatest, target.credStore, identity, {
|
|
287
|
+
deployment: target.deployment,
|
|
288
|
+
dryRun: options.dryRun,
|
|
289
|
+
json: options.json,
|
|
290
|
+
});
|
|
291
|
+
};
|
|
292
|
+
publishOptions(addGroup
|
|
293
|
+
.command("version")
|
|
294
|
+
.description("Publish a new version of the package. Same as `cred publish`.")).action(publishAction);
|
|
295
|
+
publishOptions(cli.command("publish").description("Publish a new version of the package.")).action(publishAction);
|
|
296
|
+
const archiveAction = (archived) => (packageName, versionId, options) => (archived ? archive_unarchive_version_1.archiveVersion : archive_unarchive_version_1.unarchiveVersion)(constants_1.controlPlanesByEnv[getActiveEnvironment()], packageName, versionId, options.debug, options.yes);
|
|
297
|
+
updateGroup
|
|
298
|
+
.command("version")
|
|
299
|
+
.description("Update a version of a package: archive it, or bring it back.")
|
|
300
|
+
.argument("<packageName>", "The package the version belongs to.")
|
|
301
|
+
.argument("<versionId>", "The version to update (e.g. 0.1.21).")
|
|
302
|
+
.option("--archived", "Archive the version.")
|
|
303
|
+
.option("--no-archived", "Unarchive the version.")
|
|
87
304
|
.option("--debug")
|
|
88
305
|
.option("-y, --yes", "Skip confirmation.")
|
|
89
306
|
.action((packageName, versionId, options) => {
|
|
90
|
-
|
|
307
|
+
if (options.archived === undefined) {
|
|
308
|
+
logger_1.logger.error("Nothing to update. Pass --archived to archive the version, or --no-archived to unarchive it.");
|
|
309
|
+
process.exitCode = 1;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
return archiveAction(options.archived)(packageName, versionId, options);
|
|
91
313
|
});
|
|
92
|
-
|
|
93
|
-
|
|
314
|
+
for (const [verb, archived] of [
|
|
315
|
+
["archive", true],
|
|
316
|
+
["unarchive", false],
|
|
317
|
+
]) {
|
|
318
|
+
cli.command(verb)
|
|
319
|
+
.description(`${verb === "archive" ? "Archive" : "Unarchive"} a version of a package.`)
|
|
320
|
+
.argument("<packageName>", `The name of the package to ${verb} the version of.`)
|
|
321
|
+
.argument("<versionId>", `The id of the version to ${verb}.`)
|
|
322
|
+
.option("--debug")
|
|
323
|
+
.option("-y, --yes", "Skip confirmation.")
|
|
324
|
+
.action(archiveAction(archived));
|
|
325
|
+
}
|
|
326
|
+
const runOptions = (command) => command
|
|
94
327
|
.argument("<packageName>", "The name of the package to run.")
|
|
95
328
|
.argument("<versionId>", "The version to (re)build (e.g. 0.1.21).")
|
|
96
329
|
.option("--debug")
|
|
@@ -99,15 +332,36 @@ cli.command("rerun")
|
|
|
99
332
|
.option("--dimension <dimension>", "Scope the run to a single indexed dimension.")
|
|
100
333
|
.option("--measure <measure>", "Scope the run to a single pre-aggregated measure. Rebuilds the rollup serving it; add --source when the measure is declared at more than one grain.")
|
|
101
334
|
.option("--model-file <modelFilePath>", "Disambiguate a dimension/source defined in more than one model file.")
|
|
102
|
-
.option("--include-upstream", "Also force-rebuild the target's upstream persisted closure (only meaningful with --source/--dimension/--measure).", false)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
335
|
+
.option("--include-upstream", "Also force-rebuild the target's upstream persisted closure (only meaningful with --source/--dimension/--measure).", false);
|
|
336
|
+
const runAction = (packageName, versionId, options) => (0, rerun_1.rerun)(constants_1.controlPlanesByEnv[getActiveEnvironment()], packageName, versionId, {
|
|
337
|
+
source: options.source,
|
|
338
|
+
dimension: options.dimension,
|
|
339
|
+
measure: options.measure,
|
|
340
|
+
modelFile: options.modelFile,
|
|
341
|
+
includeUpstream: options.includeUpstream,
|
|
342
|
+
}, options.debug, options.yes);
|
|
343
|
+
runOptions(addGroup
|
|
344
|
+
.command("run")
|
|
345
|
+
.description("Start a run (rebuild/refresh) of a package version. Defaults to a full run (all sources, indexes and pre-aggregations); use --source/--dimension/--measure/--model-file to scope it to a single unit.")).action(runAction);
|
|
346
|
+
runOptions(cli
|
|
347
|
+
.command("rerun")
|
|
348
|
+
.description("Trigger an on-demand run (rebuild/refresh) for a package version. Defaults to a full run (all sources, indexes and pre-aggregations); use --source/--dimension/--measure/--model-file to scope it to a single unit.")).action(runAction);
|
|
349
|
+
const cancelAction = (packageName, runId, options) => (0, cancelrun_1.cancelRun)(constants_1.controlPlanesByEnv[getActiveEnvironment()], packageName, runId, options.debug, options.yes);
|
|
350
|
+
updateGroup
|
|
351
|
+
.command("run")
|
|
352
|
+
.description("Update a run: cancel it while it is in flight.")
|
|
353
|
+
.argument("<packageName>", "The name of the package that owns the run.")
|
|
354
|
+
.argument("<runId>", "The id of the run.")
|
|
355
|
+
.option("--cancel", "Cancel the run.")
|
|
356
|
+
.option("--debug")
|
|
357
|
+
.option("-y, --yes", "Skip confirmation.")
|
|
358
|
+
.action((packageName, runId, options) => {
|
|
359
|
+
if (!options.cancel) {
|
|
360
|
+
logger_1.logger.error("Nothing to update. Pass --cancel to cancel the run.");
|
|
361
|
+
process.exitCode = 1;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
return cancelAction(packageName, runId, options);
|
|
111
365
|
});
|
|
112
366
|
cli.command("cancel-run")
|
|
113
367
|
.description("Cancel an in-flight (non-terminal) run.")
|
|
@@ -115,61 +369,161 @@ cli.command("cancel-run")
|
|
|
115
369
|
.argument("<runId>", "The id of the run to cancel.")
|
|
116
370
|
.option("--debug")
|
|
117
371
|
.option("-y, --yes", "Skip confirmation.")
|
|
118
|
-
.action(
|
|
119
|
-
(0, cancelrun_1.cancelRun)(constants_1.controlPlanesByEnv[getActiveEnvironment()], packageName, runId, options.debug, options.yes);
|
|
120
|
-
});
|
|
372
|
+
.action(cancelAction);
|
|
121
373
|
cli.command("login")
|
|
122
374
|
.description("Login into Credible service.")
|
|
123
|
-
.argument("
|
|
375
|
+
.argument("[organizationName]", "The organization to login to. Omit it to pick from the organizations you belong to after signing in.")
|
|
124
376
|
.option("-c, --cluster <cluster>", "Target cluster: 'gcp' or 'aws'. Defaults to the org's default cluster (gcp for most orgs).")
|
|
125
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
377
|
+
.option("--no-browser", "Print the sign-in URL without opening a browser. Implied without a terminal.")
|
|
378
|
+
.option("--force", "Sign in again even if you are already signed in to this cell, to sign in as someone else.")
|
|
379
|
+
.action((organizationName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
380
|
+
var _a, _b;
|
|
381
|
+
// `--cell`, then the directory's pin, then the global value. A login in a directory pinned to another deployment signs
|
|
382
|
+
// in to that deployment, so the tokens land where that directory reads.
|
|
383
|
+
const resolved = (0, folderconfig_1.resolveDeployment)({
|
|
384
|
+
cwd: process.cwd(),
|
|
385
|
+
globalDefault: clientConfig.getEnvironment(),
|
|
386
|
+
flag: (0, utils_1.cellFlag)(),
|
|
387
|
+
});
|
|
388
|
+
const currentEnv = resolved.deployment;
|
|
389
|
+
let target;
|
|
390
|
+
try {
|
|
391
|
+
target = (0, login_1.resolveLoginTarget)(currentEnv, organizationName, options.cluster === undefined ? undefined : String(options.cluster),
|
|
392
|
+
// The pin says which deployment is meant, so an org's own default
|
|
393
|
+
// cluster must not pick another one.
|
|
394
|
+
{ pinned: resolved.from !== "global" });
|
|
143
395
|
}
|
|
144
|
-
|
|
145
|
-
|
|
396
|
+
catch (error) {
|
|
397
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
398
|
+
process.exit(1);
|
|
146
399
|
}
|
|
147
|
-
|
|
148
|
-
|
|
400
|
+
// A login to another deployment would store its tokens in a slot nothing
|
|
401
|
+
// in this directory reads, since the pin keeps naming its own. It looked
|
|
402
|
+
// like it worked, and every command here still said "not logged in".
|
|
403
|
+
if (resolved.from === "flag" && target.targetEnv !== currentEnv) {
|
|
404
|
+
console.error(`--cell ${currentEnv} names the cell, so a login to ${target.targetEnv} would not be used by it. Drop --cell, or drop -c / pass an organization that lives on ${currentEnv}.`);
|
|
405
|
+
process.exit(1);
|
|
149
406
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
];
|
|
155
|
-
if (!supportedClusters.includes(cluster)) {
|
|
156
|
-
console.error(`Organization '${organizationName}' is not available on the ${cluster} cluster.`);
|
|
407
|
+
if (resolved.from === "folder" && target.targetEnv !== currentEnv) {
|
|
408
|
+
const root = (_b = (_a = (0, folderconfig_1.findFolderConfig)(process.cwd())) === null || _a === void 0 ? void 0 : _a.root) !== null && _b !== void 0 ? _b : process.cwd();
|
|
409
|
+
console.error(`This directory is pinned to the ${currentEnv} deployment, so a login to ${target.targetEnv} here would not be used by anything in it. ` +
|
|
410
|
+
`Run the login from outside ${root}, or, to move this directory to ${target.targetEnv}, set "deployment": "${target.targetEnv}" in ${root}/.credible/config.json and run \`cred init\` there.`);
|
|
157
411
|
process.exit(1);
|
|
158
412
|
}
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (targetEnv !== currentEnv) {
|
|
166
|
-
clientConfig.setEnvironment(targetEnv);
|
|
413
|
+
// `resolveLoginTarget` has already refused everything it can refuse, so
|
|
414
|
+
// this write only happens for a login that is going to be attempted — and
|
|
415
|
+
// only when the deployment came from the global value: a directory pin
|
|
416
|
+
// must not move every other terminal's default.
|
|
417
|
+
if (resolved.from === "global" && target.targetEnv !== currentEnv) {
|
|
418
|
+
clientConfig.setEnvironment(target.targetEnv);
|
|
167
419
|
}
|
|
168
|
-
|
|
169
|
-
|
|
420
|
+
// Awaited, with its own catch. The `unhandledRejection` handler above
|
|
421
|
+
// would still report a rejection here with the right exit code, so this
|
|
422
|
+
// is not the difference between working and broken — it is the
|
|
423
|
+
// difference between a failure handled where it happened and one handled
|
|
424
|
+
// by a global net. Two things follow from awaiting. `parseAsync`
|
|
425
|
+
// otherwise returns while login is still running, because an action body
|
|
426
|
+
// that fires a promise without returning it resolves immediately; and
|
|
427
|
+
// login is the command with partial state to reason about (tokens are
|
|
428
|
+
// persisted before the organization is resolved), so its error path
|
|
429
|
+
// deserves to be visible next to that, not several files away.
|
|
430
|
+
try {
|
|
431
|
+
yield (0, login_1.login)(organizationName, constants_1.controlPlanesByEnv[target.targetEnv], undefined, target.cluster,
|
|
432
|
+
// Explicit rather than inherited from the write above, so where the
|
|
433
|
+
// tokens land does not depend on that statement having run.
|
|
434
|
+
target.targetEnv, { force: options.force });
|
|
435
|
+
}
|
|
436
|
+
catch (error) {
|
|
437
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
438
|
+
process.exit(error instanceof host_1.NeedsInputError ? 2 : 1);
|
|
439
|
+
}
|
|
440
|
+
if (resolved.from === "flag") {
|
|
441
|
+
const warning = (0, login_1.bareCellWarning)(currentEnv, (0, folderconfig_1.resolveDeployment)({
|
|
442
|
+
cwd: process.cwd(),
|
|
443
|
+
globalDefault: clientConfig.getGlobalEnvironment(),
|
|
444
|
+
}));
|
|
445
|
+
if (warning)
|
|
446
|
+
console.error(warning);
|
|
447
|
+
}
|
|
448
|
+
}));
|
|
449
|
+
cli.command("token")
|
|
450
|
+
.description("Print a fresh access token on stdout, refreshing it first if needed. Machine-facing: nothing else is written to stdout.")
|
|
451
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
452
|
+
yield (0, token_1.printToken)();
|
|
453
|
+
}));
|
|
454
|
+
cli.command("init")
|
|
455
|
+
.description("Set up this directory for local Malloy modeling: log in if needed, wire the directory to a Credible environment, and start a local Publisher serving it.")
|
|
456
|
+
.option("--no-start", "Write the configuration but do not start the publisher.")
|
|
457
|
+
.option("--no-open", "Start the publisher but do not open a browser.")
|
|
458
|
+
.option("-d, --directory <path>", "Set up this directory instead of the current one.")
|
|
459
|
+
.option("-o, --organization <name>", "Use this organization instead of asking. Also re-pins the directory.")
|
|
460
|
+
.option("-e, --environment <name>", "Use this Credible environment instead of asking. Also re-pins the directory.")
|
|
461
|
+
.option("--create-environment", "With --environment: create the environment if the organization does not have it yet.", false)
|
|
462
|
+
.option("--skills <replace|keep|none>", "What to do with skills already in .claude/skills/ that cred did not install (a create-malloy-package directory): replace them with Credible's set, keep both, or install none. Asked once when omitted.")
|
|
463
|
+
.option("--package <dir>", "In a directory whose publisher.config.json lists several packages (a create-malloy-package workspace), which one the local publisher serves. Remembered for cred dev.")
|
|
464
|
+
.option("--debug", "Show all of the local Publisher's output here, not only its errors.")
|
|
465
|
+
.option("--port <number>", "Serve on this port, and MCP on the port 40 above it, instead of the remembered pair or 4000/4040. Remembered, and .mcp.json follows. Use it when another Publisher holds the ports.")
|
|
466
|
+
.option("--connections <all|none|names>", "Which connections from a local publisher.config.json to copy into Credible: all, none, or a comma-separated list. Naming them is the consent to send their credentials, so no question is asked.")
|
|
467
|
+
.addHelpText("after", `
|
|
468
|
+
init writes .mcp.json, CLAUDE.md and AGENTS.md here. An agent reads those only
|
|
469
|
+
when its session starts, so one already running here gets no local \`malloy\`
|
|
470
|
+
tools from this run. Without --no-start, init then runs the publisher in the
|
|
471
|
+
foreground until Ctrl-C.
|
|
472
|
+
|
|
473
|
+
If you are an agent running init yourself:
|
|
474
|
+
1. cred init --no-start -e <environment> --connections <all|none|names> --skills <replace|keep|none>
|
|
475
|
+
2. Ask the user to restart you in this directory (for Claude Code: exit,
|
|
476
|
+
run \`claude\` here, and trust the project's MCP servers).
|
|
477
|
+
3. In the new session: \`cred dev --no-open\` in the background, then poll
|
|
478
|
+
\`cred status --json\` until publisher.ready is true. If it exits saying
|
|
479
|
+
another Publisher holds the ports, re-run it with the --port it names.
|
|
480
|
+
Simplest of all: the user runs \`cred init\` before starting the agent.`)
|
|
481
|
+
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
482
|
+
yield (0, setup_1.setup)({
|
|
483
|
+
start: options.start,
|
|
484
|
+
open: options.open,
|
|
485
|
+
directory: options.directory,
|
|
486
|
+
organization: options.organization,
|
|
487
|
+
environment: options.environment,
|
|
488
|
+
connections: options.connections,
|
|
489
|
+
createEnvironment: options.createEnvironment,
|
|
490
|
+
skills: options.skills,
|
|
491
|
+
package: options.package,
|
|
492
|
+
port: options.port,
|
|
493
|
+
});
|
|
494
|
+
}));
|
|
495
|
+
cli.command("dev")
|
|
496
|
+
.description("Re-enter the local Publisher session for this directory (foreground; Ctrl-C stops it).")
|
|
497
|
+
.option("--no-open", "Do not open a browser.")
|
|
498
|
+
.option("-o, --organization <name>", "Switch this directory to another organization, and remember it.")
|
|
499
|
+
.option("-e, --environment <name>", "Switch this directory to another Credible environment, and remember it.")
|
|
500
|
+
.option("--create-environment", "With --environment: create the environment if the organization does not have it yet.", false)
|
|
501
|
+
.option("--package <dir>", "Serve this listed package instead of the one this directory is pinned to, and remember it.")
|
|
502
|
+
.option("--skills <replace|keep|none>", "What to do with skills in .claude/skills/ that cred did not install, when it has to ask. none is remembered, and replace or keep undoes it.")
|
|
503
|
+
.option("--port <number>", "Serve on this port, and MCP on the port 40 above it, instead of the remembered pair or 4000/4040. Remembered, and .mcp.json follows. Use it when another Publisher holds the ports.")
|
|
504
|
+
.option("-y, --yes", "Use the organization and environment this directory is pinned to without asking. Implied without a terminal.", false)
|
|
505
|
+
.option("--debug", "Show all of the local Publisher's output here, not only its errors.")
|
|
506
|
+
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
507
|
+
yield (0, setup_1.dev)({
|
|
508
|
+
open: options.open,
|
|
509
|
+
organization: options.organization,
|
|
510
|
+
environment: options.environment,
|
|
511
|
+
createEnvironment: options.createEnvironment,
|
|
512
|
+
package: options.package,
|
|
513
|
+
skills: options.skills,
|
|
514
|
+
yes: options.yes,
|
|
515
|
+
port: options.port,
|
|
516
|
+
});
|
|
517
|
+
}));
|
|
170
518
|
cli.command("logout")
|
|
171
|
-
.description("
|
|
172
|
-
.action(
|
|
519
|
+
.description("Sign out of one cell: the one --cell names, else this directory's pin, else your global cell. Other cells stay signed in.")
|
|
520
|
+
.action(() => {
|
|
521
|
+
(0, logout_1.logout)((0, folderconfig_1.resolveDeployment)({
|
|
522
|
+
cwd: process.cwd(),
|
|
523
|
+
globalDefault: clientConfig.getGlobalEnvironment(),
|
|
524
|
+
flag: (0, utils_1.cellFlag)(),
|
|
525
|
+
}));
|
|
526
|
+
});
|
|
173
527
|
cli.command("set-access-token")
|
|
174
528
|
.description("Set a service account JWT token for CLI authentication")
|
|
175
529
|
.argument("<jwtToken>", "The JWT token to use for authentication")
|
|
@@ -178,22 +532,36 @@ cli.command("set-access-token")
|
|
|
178
532
|
(0, set_access_token_1.setAccessToken)(jwtToken, options.organization);
|
|
179
533
|
});
|
|
180
534
|
cli.command("status")
|
|
181
|
-
.description("Shows the
|
|
182
|
-
.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
535
|
+
.description("Shows the active organization, Credible environment, and token freshness — and, in a directory cred init wired, whether its publisher is running.")
|
|
536
|
+
.option("--json", "Machine-readable: one JSON document on stdout, nothing else. Poll publisher.ready after starting `cred dev` in the background.", false)
|
|
537
|
+
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
538
|
+
yield (0, status_1.printStatus)({ json: options.json });
|
|
539
|
+
}));
|
|
186
540
|
const complete = (0, omelette_1.default)("credible").tree({
|
|
187
541
|
// CRUD commands
|
|
188
542
|
get: [
|
|
189
543
|
"environment",
|
|
190
544
|
"project",
|
|
545
|
+
"package",
|
|
546
|
+
"version",
|
|
191
547
|
"group",
|
|
192
548
|
"permission",
|
|
193
549
|
"materialization",
|
|
194
550
|
"index",
|
|
195
551
|
"run",
|
|
196
552
|
],
|
|
553
|
+
list: [
|
|
554
|
+
"environment",
|
|
555
|
+
"connection",
|
|
556
|
+
"package",
|
|
557
|
+
"version",
|
|
558
|
+
"materialization",
|
|
559
|
+
"index",
|
|
560
|
+
"run",
|
|
561
|
+
"group",
|
|
562
|
+
"group-access-token",
|
|
563
|
+
"permission",
|
|
564
|
+
],
|
|
197
565
|
ls: [
|
|
198
566
|
"environment",
|
|
199
567
|
"project",
|
|
@@ -207,7 +575,7 @@ const complete = (0, omelette_1.default)("credible").tree({
|
|
|
207
575
|
"group-access-token",
|
|
208
576
|
"permission",
|
|
209
577
|
],
|
|
210
|
-
update: ["environment", "project", "package"],
|
|
578
|
+
update: ["environment", "project", "package", "version", "run"],
|
|
211
579
|
rm: [
|
|
212
580
|
"environment",
|
|
213
581
|
"project",
|
|
@@ -222,15 +590,20 @@ const complete = (0, omelette_1.default)("credible").tree({
|
|
|
222
590
|
"environment",
|
|
223
591
|
"project",
|
|
224
592
|
"connection",
|
|
593
|
+
"version",
|
|
594
|
+
"run",
|
|
225
595
|
"group",
|
|
226
596
|
"member",
|
|
227
597
|
"group-access-token",
|
|
228
598
|
"permission",
|
|
229
599
|
],
|
|
230
600
|
// Misc commands
|
|
231
|
-
set: ["environment", "project"],
|
|
601
|
+
set: ["environment", "project", "cell"],
|
|
232
602
|
login: [],
|
|
233
603
|
logout: [],
|
|
604
|
+
token: [],
|
|
605
|
+
init: [],
|
|
606
|
+
dev: [],
|
|
234
607
|
"set-access-token": [],
|
|
235
608
|
status: [],
|
|
236
609
|
publish: [],
|
|
@@ -249,7 +622,10 @@ complete.onAsync("$3", (_a) => __awaiter(void 0, [_a], void 0, function* ({ repl
|
|
|
249
622
|
"rm project",
|
|
250
623
|
];
|
|
251
624
|
if (environmentRelatedCommands.some((cmd) => line.includes(cmd))) {
|
|
252
|
-
reply((0, listenvironments_1.listEnvironments)(constants_1.controlPlanesByEnv[getActiveEnvironment()], false).then((result) => result.
|
|
625
|
+
reply((0, listenvironments_1.listEnvironments)(constants_1.controlPlanesByEnv[getActiveEnvironment()], false).then((result) => result.environments.map((environment) => environment.name)));
|
|
626
|
+
}
|
|
627
|
+
if (line.includes("set cell")) {
|
|
628
|
+
reply(Promise.resolve(constants_1.ALL_ENVIRONMENTS));
|
|
253
629
|
}
|
|
254
630
|
const packageRelatedCommands = ["rm package", "ls version"];
|
|
255
631
|
if (packageRelatedCommands.some((cmd) => line.includes(cmd))) {
|
|
@@ -257,15 +633,36 @@ complete.onAsync("$3", (_a) => __awaiter(void 0, [_a], void 0, function* ({ repl
|
|
|
257
633
|
}
|
|
258
634
|
}));
|
|
259
635
|
complete.next(() => {
|
|
260
|
-
|
|
636
|
+
// `parseAsync`, not `parse`, now that a `preAction` hook is async. `parse`
|
|
637
|
+
// does work — Commander still chains the hook before the action — but it
|
|
638
|
+
// returns before either has finished and hands back nothing to attach a
|
|
639
|
+
// catch to, so a rejection anywhere in that chain surfaces as an unhandled
|
|
640
|
+
// promise rejection and a stack dump. `ensureFreshTokens` is written not to
|
|
641
|
+
// throw, but that is a contract a future edit can break quietly.
|
|
642
|
+
commander_1.program.parseAsync(process.argv).catch(exitOnFailure);
|
|
261
643
|
});
|
|
644
|
+
// omelette finds the shell init file to edit from $SHELL, and throws when it is
|
|
645
|
+
// unset (a container started without a login shell: CI runner pods, `docker
|
|
646
|
+
// run`) or names a shell other than bash, zsh or fish. The CLI is installed by
|
|
647
|
+
// then and only completion needs the shell, so completion is skipped rather
|
|
648
|
+
// than failing the install.
|
|
649
|
+
function skipCompletionOnError(setup) {
|
|
650
|
+
try {
|
|
651
|
+
setup();
|
|
652
|
+
}
|
|
653
|
+
catch (error) {
|
|
654
|
+
console.log(`Skipping shell completion setup: ${error.message}`);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
262
657
|
if (~process.argv.indexOf("--cleanup")) {
|
|
263
|
-
complete.cleanupShellInitFile();
|
|
658
|
+
skipCompletionOnError(() => complete.cleanupShellInitFile());
|
|
264
659
|
process.exit(0);
|
|
265
660
|
}
|
|
266
661
|
if (~process.argv.indexOf("--install")) {
|
|
267
|
-
|
|
662
|
+
// Printed first: setupShellInitFile() exits the process itself once it has
|
|
663
|
+
// written the init file.
|
|
268
664
|
console.log("CLI installed successfully!");
|
|
665
|
+
skipCompletionOnError(() => complete.setupShellInitFile());
|
|
269
666
|
process.exit(0);
|
|
270
667
|
}
|
|
271
668
|
complete.init();
|