diff --git a/packages/cli-test/src/cli/commands/app.ts b/packages/cli-test/src/cli/commands/app.ts index 4532b5574..edc682c32 100644 --- a/packages/cli-test/src/cli/commands/app.ts +++ b/packages/cli-test/src/cli/commands/app.ts @@ -10,11 +10,11 @@ import commandError from '../command-error'; export const del = async function appDelete( appPath: string, teamFlag: string, - options?: { isLocalApp?: boolean }, + options?: { isLocalApp?: boolean, qa?: boolean }, ): Promise { - // TODO: breaking change, separate params vs single-param-object + // TODO: breaking change, separate params vs single-param-object, probably should reflect global vs command CLI flags const appEnvironment = options?.isLocalApp ? 'local' : 'deployed'; - const cmd = new SlackCLIProcess('app delete --force', { team: teamFlag }, { + const cmd = new SlackCLIProcess('app delete --force', { team: teamFlag, qa: options?.qa }, { '--app': appEnvironment, }); try { @@ -33,9 +33,13 @@ export const del = async function appDelete( * @param teamFlag team domain where the app will be installed * @returns command output */ -export const install = async function workspaceInstall(appPath: string, teamFlag: string): Promise { - // TODO: breaking change, separate params vs single-param-object - const cmd = new SlackCLIProcess('app install', { team: teamFlag }); +export const install = async function workspaceInstall( + appPath: string, + teamFlag: string, + options?: { qa?: boolean }, +): Promise { + // TODO: breaking change, separate params vs single-param-object, probably should reflect global vs command CLI flags + const cmd = new SlackCLIProcess('app install', { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, diff --git a/packages/cli-test/src/cli/commands/collaborator.ts b/packages/cli-test/src/cli/commands/collaborator.ts index 22cd51ffb..3d191ef8c 100644 --- a/packages/cli-test/src/cli/commands/collaborator.ts +++ b/packages/cli-test/src/cli/commands/collaborator.ts @@ -12,9 +12,10 @@ export const add = async function collaboratorsAdd( appPath: string, teamFlag: string, collaboratorEmail: string, + options?: { qa?: boolean }, ): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess(`collaborators add ${collaboratorEmail}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`collaborators add ${collaboratorEmail}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -31,9 +32,13 @@ export const add = async function collaboratorsAdd( * @param teamFlag team domain to list collaborators for * @returns command output */ -export const list = async function collaboratorsList(appPath: string, teamFlag: string): Promise { +export const list = async function collaboratorsList( + appPath: string, + teamFlag: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess('collaborators list', { team: teamFlag }); + const cmd = new SlackCLIProcess('collaborators list', { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -55,9 +60,10 @@ export const remove = async function collaboratorsRemove( appPath: string, teamFlag: string, collaboratorEmail: string, + options?: { qa?: boolean }, ): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess(`collaborators remove ${collaboratorEmail}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`collaborators remove ${collaboratorEmail}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, diff --git a/packages/cli-test/src/cli/commands/env.ts b/packages/cli-test/src/cli/commands/env.ts index b801db9a7..5595ccfa5 100644 --- a/packages/cli-test/src/cli/commands/env.ts +++ b/packages/cli-test/src/cli/commands/env.ts @@ -14,9 +14,10 @@ export const add = async function envAdd( teamFlag: string, secretKey: string, secretValue: string, + options?: { qa?: boolean }, ): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess(`env add ${secretKey} ${secretValue}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`env add ${secretKey} ${secretValue}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -33,9 +34,13 @@ export const add = async function envAdd( * @param teamFlag team domain to list env vars for * @returns command output */ -export const list = async function envList(appPath: string, teamFlag: string): Promise { +export const list = async function envList( + appPath: string, + teamFlag: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess('env list', { team: teamFlag }); + const cmd = new SlackCLIProcess('env list', { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -57,9 +62,10 @@ export const remove = async function envRemove( appPath: string, teamFlag: string, secretKey: string, + options?: { qa?: boolean }, ): Promise { // TODO: (breaking change) separate parameters vs single-param-object - const cmd = new SlackCLIProcess(`env remove ${secretKey}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`env remove ${secretKey}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, diff --git a/packages/cli-test/src/cli/commands/external-auth.ts b/packages/cli-test/src/cli/commands/external-auth.ts index 83c3a8730..7c4a707ca 100644 --- a/packages/cli-test/src/cli/commands/external-auth.ts +++ b/packages/cli-test/src/cli/commands/external-auth.ts @@ -14,11 +14,12 @@ export const externalAuth = async function externalAuth( teamFlag: string, provider: string, flags: string, + options?: { qa?: boolean }, ): Promise { // TODO: (breaking change) separate parameters vs single-param-object // TODO: this is a generic entry point to the `external-auth` suite of commands, and today `flags` is abused to // specify the actual sub-command. easy, but lazy, not sure if best approach - const cmd = new SlackCLIProcess(`external-auth ${flags}`, { team: teamFlag }, { + const cmd = new SlackCLIProcess(`external-auth ${flags}`, { team: teamFlag, qa: options?.qa }, { '--provider': provider, }); try { diff --git a/packages/cli-test/src/cli/commands/function.ts b/packages/cli-test/src/cli/commands/function.ts index cccdc875e..eeee2f784 100644 --- a/packages/cli-test/src/cli/commands/function.ts +++ b/packages/cli-test/src/cli/commands/function.ts @@ -15,9 +15,10 @@ export const access = async function functionAccess( appPath: string, teamFlag: string, flags: string, + options?: { qa?: boolean }, ): Promise { // TODO: breaking change, separate params vs single-param-object - const cmd = new SlackCLIProcess(`function access ${flags}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`function access ${flags}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, diff --git a/packages/cli-test/src/cli/commands/manifest.ts b/packages/cli-test/src/cli/commands/manifest.ts index 0f0ea7c26..192acf321 100644 --- a/packages/cli-test/src/cli/commands/manifest.ts +++ b/packages/cli-test/src/cli/commands/manifest.ts @@ -8,9 +8,10 @@ import commandError from '../command-error'; */ export const validate = async function manifestValidate( appPath: string, + options?: { qa?: boolean }, ): Promise { // TODO: breaking change, separate params vs single-param-object - const cmd = new SlackCLIProcess('manifest validate'); + const cmd = new SlackCLIProcess('manifest validate', options); try { const proc = await cmd.execAsync({ cwd: appPath, diff --git a/packages/cli-test/src/cli/commands/platform.ts b/packages/cli-test/src/cli/commands/platform.ts index 7bac474ca..156f1dc55 100644 --- a/packages/cli-test/src/cli/commands/platform.ts +++ b/packages/cli-test/src/cli/commands/platform.ts @@ -18,6 +18,7 @@ export default { teamFlag, flag, localApp = true, + qa = false, }: { /** Path to app */ appPath: string; @@ -27,9 +28,11 @@ export default { flag?: string; /** Whether to operate on the local or deployed app */ localApp?: boolean; // TODO: this option is provided inconsistently across commands (breaking change) + /** Whether to operate against --slackdev or production */ + qa?: boolean; // TODO: this option is provided inconsistently across commands (breaking change) }): Promise { const appEnvironment = localApp ? 'local' : 'deployed'; - const cmd = new SlackCLIProcess(`activity ${flag}`, { team: teamFlag }, { + const cmd = new SlackCLIProcess(`activity ${flag}`, { team: teamFlag, qa }, { '--app': appEnvironment, }); try { @@ -52,6 +55,7 @@ export default { teamFlag, stringToWaitFor, localApp = true, + qa = false, }: { /** Path to app */ appPath: string; @@ -61,9 +65,11 @@ export default { stringToWaitFor: string; /** Whether to operate on the local or deployed app */ localApp?: boolean; + /** Whether to operate against --slackdev or production */ + qa?: boolean; // TODO: this option is provided inconsistently across commands (breaking change) }): Promise { const appEnvironment = localApp ? 'local' : 'deployed'; - const cmd = new SlackCLIProcess('activity --tail', { team: teamFlag }, { + const cmd = new SlackCLIProcess('activity --tail', { team: teamFlag, qa }, { '--app': appEnvironment, }); try { @@ -112,6 +118,7 @@ export default { teamFlag, hideTriggers = true, orgWorkspaceGrantFlag, + qa = false, }: { /** Path to app */ appPath: string; @@ -124,8 +131,10 @@ export default { * to request grant access to in AAA scenarios */ orgWorkspaceGrantFlag?: string; + /** Whether to operate against --slackdev or production */ + qa?: boolean; // TODO: this option is provided inconsistently across commands (breaking change) }): Promise { - const cmd = new SlackCLIProcess('deploy', { team: teamFlag }, { + const cmd = new SlackCLIProcess('deploy', { team: teamFlag, qa }, { '--hide-triggers': hideTriggers, '--org-workspace-grant': orgWorkspaceGrantFlag, }); @@ -150,6 +159,7 @@ export default { cleanup = true, hideTriggers = true, orgWorkspaceGrantFlag, + qa = false, }: { /** Path to app */ appPath: string; @@ -164,8 +174,10 @@ export default { * to request grant access to in AAA scenarios */ orgWorkspaceGrantFlag?: string; + /** Whether to operate against --slackdev or production */ + qa?: boolean; // TODO: this option is provided inconsistently across commands (breaking change) }): Promise { - const cmd = new SlackCLIProcess('run', { team: teamFlag }, { + const cmd = new SlackCLIProcess('run', { team: teamFlag, qa }, { '--cleanup': cleanup, '--hide-triggers': hideTriggers, '--org-workspace-grant': orgWorkspaceGrantFlag, diff --git a/packages/cli-test/src/cli/commands/trigger.ts b/packages/cli-test/src/cli/commands/trigger.ts index a1bd60dd1..3ea89d1bf 100644 --- a/packages/cli-test/src/cli/commands/trigger.ts +++ b/packages/cli-test/src/cli/commands/trigger.ts @@ -11,10 +11,15 @@ import commandError from '../command-error'; * @param flags specification of trigger access, e.g. --trigger-id Ft0143UPTAV8 --everyone * @returns command output */ -export const access = async function triggerAccess(appPath: string, teamFlag: string, flags: string): Promise { +export const access = async function triggerAccess( + appPath: string, + teamFlag: string, + flags: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate params vs. single-param-object // TODO: access requires --trigger-id so add that to parameters (breaking change) - const cmd = new SlackCLIProcess(`trigger access ${flags}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`trigger access ${flags}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -46,12 +51,12 @@ export const create = async function triggerCreate({ options?: { // TODO: must be a better way of exposing these options /** Local app for local run sessions */ localApp?: boolean; - /** Install app by selecting "Install to a new team" */ - installApp?: boolean; // TODO: this isn't even used? + /** Whether to run against --slackdev or production */ + qa?: boolean; }; }): Promise { const appEnvironment = options?.localApp ? 'local' : 'deployed'; - const cmd = new SlackCLIProcess(`trigger create ${flag}`, { team: teamFlag }, { + const cmd = new SlackCLIProcess(`trigger create ${flag}`, { team: teamFlag, qa: options?.qa }, { '--app': appEnvironment, '--org-workspace-grant': orgWorkspaceGrantFlag, }); @@ -72,10 +77,15 @@ export const create = async function triggerCreate({ * @param flag * @returns command output */ -export const del = async function triggerDelete(appPath: string, teamFlag: string, flag: string): Promise { +export const del = async function triggerDelete( + appPath: string, + teamFlag: string, + flag: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate params vs. single-param-object // TODO: delete requires --trigger-id so add that to parameters (breaking change) - const cmd = new SlackCLIProcess(`trigger delete ${flag}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`trigger delete ${flag}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -93,10 +103,15 @@ export const del = async function triggerDelete(appPath: string, teamFlag: strin * @param flag arbitrary additional flags * @returns command output */ -export const info = async function triggerInfo(appPath: string, teamFlag: string, flag: string): Promise { +export const info = async function triggerInfo( + appPath: string, + teamFlag: string, + flag: string, + options?: { qa?: boolean }, +): Promise { // TODO: getting trigger info necessitates passing a trigger ID, so that should be exposed in the parameters here // TODO: (breaking change) separate params vs. single-param-object - const cmd = new SlackCLIProcess(`trigger info ${flag}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`trigger info ${flag}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -114,9 +129,14 @@ export const info = async function triggerInfo(appPath: string, teamFlag: string * @param flag arbitrary additional flags to pass * @returns command output */ -export const list = async function triggerList(appPath: string, teamFlag: string, flag: string): Promise { +export const list = async function triggerList( + appPath: string, + teamFlag: string, + flag: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate params vs. single-param-object - const cmd = new SlackCLIProcess(`trigger list ${flag}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`trigger list ${flag}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath, @@ -134,9 +154,14 @@ export const list = async function triggerList(appPath: string, teamFlag: string * @param flag arbitrary additional flags to pass to command * @returns command output */ -export const update = async function triggerUpdate(appPath: string, teamFlag: string, flag: string): Promise { +export const update = async function triggerUpdate( + appPath: string, + teamFlag: string, + flag: string, + options?: { qa?: boolean }, +): Promise { // TODO: (breaking change) separate params vs. single-param-object - const cmd = new SlackCLIProcess(`trigger update ${flag}`, { team: teamFlag }); + const cmd = new SlackCLIProcess(`trigger update ${flag}`, { team: teamFlag, qa: options?.qa }); try { const proc = await cmd.execAsync({ cwd: appPath,