diff --git a/src/cli/dashboard/agents/create.ts b/src/cli/dashboard/agents/create.ts index 6b3fe01b..9e6a7cc0 100644 --- a/src/cli/dashboard/agents/create.ts +++ b/src/cli/dashboard/agents/create.ts @@ -24,21 +24,25 @@ export default class AgentsCreate extends DashboardCommand { const { flags } = await this.parse(AgentsCreate); try { - const result = await this.client.agentConfigs.create.mutate({ - agentType: flags['agent-type'], - projectId: flags['project-id'], - model: flags.model, - maxIterations: flags['max-iterations'], - agentEngine: flags.engine, - maxConcurrency: flags['max-concurrency'], - }); + const result = await this.withSpinner('Creating agent config...', () => + this.client.agentConfigs.create.mutate({ + agentType: flags['agent-type'], + projectId: flags['project-id'], + model: flags.model, + maxIterations: flags['max-iterations'], + agentEngine: flags.engine, + maxConcurrency: flags['max-concurrency'], + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Created agent config for ${flags['agent-type']}`); + this.success( + `Created agent config for '${flags['agent-type']}' on project '${flags['project-id']}'`, + ); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/agents/delete.ts b/src/cli/dashboard/agents/delete.ts index c5757cf0..27e94062 100644 --- a/src/cli/dashboard/agents/delete.ts +++ b/src/cli/dashboard/agents/delete.ts @@ -20,14 +20,16 @@ export default class AgentsDelete extends DashboardCommand { await confirm(`Delete agent config #${args.id}?`, flags.yes); try { - await this.client.agentConfigs.delete.mutate({ id: args.id }); + await this.withSpinner('Deleting agent config...', () => + this.client.agentConfigs.delete.mutate({ id: args.id }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Deleted agent config #${args.id}`); + this.success(`Deleted agent config #${args.id}`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/agents/update.ts b/src/cli/dashboard/agents/update.ts index 920715c7..609b58fc 100644 --- a/src/cli/dashboard/agents/update.ts +++ b/src/cli/dashboard/agents/update.ts @@ -21,21 +21,23 @@ export default class AgentsUpdate extends DashboardCommand { const { args, flags } = await this.parse(AgentsUpdate); try { - await this.client.agentConfigs.update.mutate({ - id: args.id, - agentType: flags['agent-type'], - model: flags.model, - maxIterations: flags['max-iterations'], - agentEngine: flags.engine, - maxConcurrency: flags['max-concurrency'], - }); + await this.withSpinner('Updating agent config...', () => + this.client.agentConfigs.update.mutate({ + id: args.id, + agentType: flags['agent-type'], + model: flags.model, + maxIterations: flags['max-iterations'], + agentEngine: flags.engine, + maxConcurrency: flags['max-concurrency'], + }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Updated agent config #${args.id}`); + this.success(`Updated agent config #${args.id}`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/definitions/create.ts b/src/cli/dashboard/definitions/create.ts index c459e861..6a889b50 100644 --- a/src/cli/dashboard/definitions/create.ts +++ b/src/cli/dashboard/definitions/create.ts @@ -35,19 +35,21 @@ export default class DefinitionsCreate extends DashboardCommand { definition = yaml.load(raw); } - const result = await this.client.agentDefinitions.create.mutate({ - agentType: flags['agent-type'], - definition: definition as Parameters< - typeof this.client.agentDefinitions.create.mutate - >[0]['definition'], - }); + const result = await this.withSpinner('Creating agent definition...', () => + this.client.agentDefinitions.create.mutate({ + agentType: flags['agent-type'], + definition: definition as Parameters< + typeof this.client.agentDefinitions.create.mutate + >[0]['definition'], + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Created agent definition: ${result.agentType}`); + this.success(`Created agent definition '${result.agentType}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/definitions/delete.ts b/src/cli/dashboard/definitions/delete.ts index a7c32851..3622d92a 100644 --- a/src/cli/dashboard/definitions/delete.ts +++ b/src/cli/dashboard/definitions/delete.ts @@ -21,16 +21,18 @@ export default class DefinitionsDelete extends DashboardCommand { } try { - const result = await this.client.agentDefinitions.delete.mutate({ - agentType: args.agentType, - }); + const result = await this.withSpinner('Deleting agent definition...', () => + this.client.agentDefinitions.delete.mutate({ + agentType: args.agentType, + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Deleted agent definition: ${result.agentType}`); + this.success(`Deleted agent definition '${result.agentType}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/definitions/import.ts b/src/cli/dashboard/definitions/import.ts index 8101d224..51e29e60 100644 --- a/src/cli/dashboard/definitions/import.ts +++ b/src/cli/dashboard/definitions/import.ts @@ -93,19 +93,23 @@ export default class DefinitionsImport extends DashboardCommand { const definition = (obj.definition ?? obj) as AgentDefinitionInput; if (flags.update) { - const result = await this.upsertDefinition(agentType, definition); + const result = await this.withSpinner('Importing agent definition...', () => + this.upsertDefinition(agentType, definition), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Imported (${result.action}) agent definition: ${result.agentType}`); + this.success(`Imported (${result.action}) agent definition '${result.agentType}'`); } else { - const result = await this.createDefinition(agentType, definition); + const result = await this.withSpinner('Importing agent definition...', () => + this.createDefinition(agentType, definition), + ); if (flags.json) { this.outputJson({ action: 'created', ...result }); return; } - this.log(`Imported agent definition: ${result.agentType}`); + this.success(`Imported agent definition '${result.agentType}'`); } } catch (err) { this.handleError(err); diff --git a/src/cli/dashboard/definitions/reset.ts b/src/cli/dashboard/definitions/reset.ts index f2d2d3e9..fad96bf9 100644 --- a/src/cli/dashboard/definitions/reset.ts +++ b/src/cli/dashboard/definitions/reset.ts @@ -21,16 +21,18 @@ export default class DefinitionsReset extends DashboardCommand { } try { - const result = await this.client.agentDefinitions.reset.mutate({ - agentType: args.agentType, - }); + const result = await this.withSpinner('Resetting agent definition...', () => + this.client.agentDefinitions.reset.mutate({ + agentType: args.agentType, + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Reset agent definition to YAML default: ${result.agentType}`); + this.success(`Reset agent definition '${result.agentType}' to YAML default`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/definitions/update.ts b/src/cli/dashboard/definitions/update.ts index c9e3b2ab..b024ea63 100644 --- a/src/cli/dashboard/definitions/update.ts +++ b/src/cli/dashboard/definitions/update.ts @@ -36,17 +36,19 @@ export default class DefinitionsUpdate extends DashboardCommand { patch = yaml.load(raw); } - const result = await this.client.agentDefinitions.update.mutate({ - agentType: args.agentType, - patch: patch as Parameters[0]['patch'], - }); + const result = await this.withSpinner('Updating agent definition...', () => + this.client.agentDefinitions.update.mutate({ + agentType: args.agentType, + patch: patch as Parameters[0]['patch'], + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Updated agent definition: ${result.agentType}`); + this.success(`Updated agent definition '${result.agentType}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/login.ts b/src/cli/dashboard/login.ts index de69dcc7..f6df0a8c 100644 --- a/src/cli/dashboard/login.ts +++ b/src/cli/dashboard/login.ts @@ -1,4 +1,5 @@ import { Command, Flags } from '@oclif/core'; +import chalk from 'chalk'; import { saveConfig } from './_shared/config.js'; export default class Login extends Command { @@ -43,7 +44,9 @@ export default class Login extends Command { const user = (await response.json()) as { email: string; name: string }; const orgSuffix = flags.org ? ` [org: ${flags.org}]` : ''; - this.log(`Logged in as ${user.name} (${user.email})${orgSuffix}`); + this.log( + chalk.green(`✓ Logged in as ${user.name} (${user.email}) at ${serverUrl}${orgSuffix}`), + ); // Show if overrides are active if ( diff --git a/src/cli/dashboard/logout.ts b/src/cli/dashboard/logout.ts index 3af36306..ab36c408 100644 --- a/src/cli/dashboard/logout.ts +++ b/src/cli/dashboard/logout.ts @@ -1,4 +1,5 @@ import { Command } from '@oclif/core'; +import chalk from 'chalk'; import { clearConfig, loadConfig } from './_shared/config.js'; export default class Logout extends Command { @@ -21,6 +22,6 @@ export default class Logout extends Command { } clearConfig(); - this.log('Logged out.'); + this.log(chalk.green('✓ Logged out.')); } } diff --git a/src/cli/dashboard/org/update.ts b/src/cli/dashboard/org/update.ts index 9a945e1a..44febf50 100644 --- a/src/cli/dashboard/org/update.ts +++ b/src/cli/dashboard/org/update.ts @@ -13,14 +13,16 @@ export default class OrgUpdate extends DashboardCommand { const { flags } = await this.parse(OrgUpdate); try { - await this.client.organization.update.mutate({ name: flags.name }); + await this.withSpinner('Updating organization...', () => + this.client.organization.update.mutate({ name: flags.name }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Organization updated: ${flags.name}`); + this.success(`Updated organization name to '${flags.name}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/create.ts b/src/cli/dashboard/projects/create.ts index e2db86c3..cae27e36 100644 --- a/src/cli/dashboard/projects/create.ts +++ b/src/cli/dashboard/projects/create.ts @@ -27,28 +27,30 @@ export default class ProjectsCreate extends DashboardCommand { const { flags } = await this.parse(ProjectsCreate); try { - const result = await this.client.projects.create.mutate({ - id: flags.id, - name: flags.name, - repo: flags.repo, - baseBranch: flags['base-branch'], - branchPrefix: flags['branch-prefix'], - model: flags.model, - maxIterations: flags['max-iterations'], - watchdogTimeoutMs: flags['watchdog-timeout'], - workItemBudgetUsd: flags['work-item-budget'], - agentEngine: flags['agent-engine'], - progressModel: flags['progress-model'], - progressIntervalMinutes: flags['progress-interval'], - maxInFlightItems: flags['max-in-flight-items'], - }); + const result = await this.withSpinner('Creating project...', () => + this.client.projects.create.mutate({ + id: flags.id, + name: flags.name, + repo: flags.repo, + baseBranch: flags['base-branch'], + branchPrefix: flags['branch-prefix'], + model: flags.model, + maxIterations: flags['max-iterations'], + watchdogTimeoutMs: flags['watchdog-timeout'], + workItemBudgetUsd: flags['work-item-budget'], + agentEngine: flags['agent-engine'], + progressModel: flags['progress-model'], + progressIntervalMinutes: flags['progress-interval'], + maxInFlightItems: flags['max-in-flight-items'], + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Created project: ${flags.id}`); + this.success(`Created project '${flags.id}' (repo: ${flags.repo})`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/credentials-delete.ts b/src/cli/dashboard/projects/credentials-delete.ts index 7d18cbe4..c67c3275 100644 --- a/src/cli/dashboard/projects/credentials-delete.ts +++ b/src/cli/dashboard/projects/credentials-delete.ts @@ -24,17 +24,19 @@ export default class ProjectsCredentialsDelete extends DashboardCommand { await confirm(`Delete credential ${flags.key} from project ${args.id}?`, flags.yes); try { - await this.client.projects.credentials.delete.mutate({ - projectId: args.id, - envVarKey: flags.key, - }); + await this.withSpinner('Deleting credential...', () => + this.client.projects.credentials.delete.mutate({ + projectId: args.id, + envVarKey: flags.key, + }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Deleted credential ${flags.key} from project ${args.id}`); + this.success(`Deleted credential ${flags.key} from project '${args.id}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/credentials-set.ts b/src/cli/dashboard/projects/credentials-set.ts index d9ff5fca..fd44c9d9 100644 --- a/src/cli/dashboard/projects/credentials-set.ts +++ b/src/cli/dashboard/projects/credentials-set.ts @@ -22,19 +22,21 @@ export default class ProjectsCredentialsSet extends DashboardCommand { const { args, flags } = await this.parse(ProjectsCredentialsSet); try { - await this.client.projects.credentials.set.mutate({ - projectId: args.id, - envVarKey: flags.key, - value: flags.value, - name: flags.name, - }); + await this.withSpinner('Setting credential...', () => + this.client.projects.credentials.set.mutate({ + projectId: args.id, + envVarKey: flags.key, + value: flags.value, + name: flags.name, + }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Set credential ${flags.key} for project ${args.id}`); + this.success(`Set credential ${flags.key} for project '${args.id}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/delete.ts b/src/cli/dashboard/projects/delete.ts index 5b056461..a638d371 100644 --- a/src/cli/dashboard/projects/delete.ts +++ b/src/cli/dashboard/projects/delete.ts @@ -20,14 +20,16 @@ export default class ProjectsDelete extends DashboardCommand { await confirm(`Delete project ${args.id}?`, flags.yes); try { - await this.client.projects.delete.mutate({ id: args.id }); + await this.withSpinner('Deleting project...', () => + this.client.projects.delete.mutate({ id: args.id }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Deleted project: ${args.id}`); + this.success(`Deleted project '${args.id}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/integration-set.ts b/src/cli/dashboard/projects/integration-set.ts index 6a026d51..8959b641 100644 --- a/src/cli/dashboard/projects/integration-set.ts +++ b/src/cli/dashboard/projects/integration-set.ts @@ -43,20 +43,22 @@ export default class ProjectsIntegrationSet extends DashboardCommand { } try { - await this.client.projects.integrations.upsert.mutate({ - projectId: args.id, - category: flags.category as 'pm' | 'scm', - provider: flags.provider, - config, - triggers, - }); + await this.withSpinner('Setting integration...', () => + this.client.projects.integrations.upsert.mutate({ + projectId: args.id, + category: flags.category as 'pm' | 'scm', + provider: flags.provider, + config, + triggers, + }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Set ${flags.category}/${flags.provider} integration for project: ${args.id}`); + this.success(`Set ${flags.category}/${flags.provider} integration for project '${args.id}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/trigger-set.ts b/src/cli/dashboard/projects/trigger-set.ts index 09fedc11..5f96cdd4 100644 --- a/src/cli/dashboard/projects/trigger-set.ts +++ b/src/cli/dashboard/projects/trigger-set.ts @@ -131,27 +131,29 @@ export default class ProjectsTriggerSet extends DashboardCommand { this.log(hint); } - const result = await this.client.agentTriggerConfigs.upsert.mutate({ - projectId: args.id, - agentType: agent, - triggerEvent: event, - enabled, - parameters, - }); + const result = await this.withSpinner('Updating trigger config...', () => + this.client.agentTriggerConfigs.upsert.mutate({ + projectId: args.id, + agentType: agent, + triggerEvent: event, + enabled, + parameters, + }), + ); if (flags.json) { this.outputJson(result); return; } - const lines: string[] = [`Trigger config updated for project: ${args.id}`]; - lines.push(` Agent: ${agent}`); - lines.push(` Event: ${event}`); - lines.push(` Enabled: ${result.enabled}`); - if (Object.keys(result.parameters).length > 0) { - lines.push(` Parameters: ${JSON.stringify(result.parameters)}`); - } - this.log(lines.join('\n')); + const statusStr = result.enabled ? 'enabled' : 'disabled'; + const paramsStr = + Object.keys(result.parameters).length > 0 + ? ` (params: ${JSON.stringify(result.parameters)})` + : ''; + this.success( + `Trigger ${event} ${statusStr} for agent '${agent}' on project '${args.id}'${paramsStr}`, + ); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/projects/update.ts b/src/cli/dashboard/projects/update.ts index f92308e7..cf78ea7c 100644 --- a/src/cli/dashboard/projects/update.ts +++ b/src/cli/dashboard/projects/update.ts @@ -34,33 +34,35 @@ export default class ProjectsUpdate extends DashboardCommand { const { args, flags } = await this.parse(ProjectsUpdate); try { - await this.client.projects.update.mutate({ - id: args.id, - name: flags.name, - repo: flags.repo, - baseBranch: flags['base-branch'], - branchPrefix: flags['branch-prefix'], - model: flags.model, - maxIterations: flags['max-iterations'], - watchdogTimeoutMs: flags['watchdog-timeout'], - workItemBudgetUsd: flags['work-item-budget'], - agentEngine: flags['agent-engine'], - progressModel: flags['progress-model'], - progressIntervalMinutes: flags['progress-interval'], - ...(flags['run-links-enabled'] !== undefined - ? { runLinksEnabled: flags['run-links-enabled'] } - : {}), - ...(flags['max-in-flight-items'] !== undefined - ? { maxInFlightItems: flags['max-in-flight-items'] } - : {}), - }); + await this.withSpinner('Updating project...', () => + this.client.projects.update.mutate({ + id: args.id, + name: flags.name, + repo: flags.repo, + baseBranch: flags['base-branch'], + branchPrefix: flags['branch-prefix'], + model: flags.model, + maxIterations: flags['max-iterations'], + watchdogTimeoutMs: flags['watchdog-timeout'], + workItemBudgetUsd: flags['work-item-budget'], + agentEngine: flags['agent-engine'], + progressModel: flags['progress-model'], + progressIntervalMinutes: flags['progress-interval'], + ...(flags['run-links-enabled'] !== undefined + ? { runLinksEnabled: flags['run-links-enabled'] } + : {}), + ...(flags['max-in-flight-items'] !== undefined + ? { maxInFlightItems: flags['max-in-flight-items'] } + : {}), + }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Updated project: ${args.id}`); + this.success(`Updated project '${args.id}'`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/prompts/reset-partial.ts b/src/cli/dashboard/prompts/reset-partial.ts index 45764509..1f86ad34 100644 --- a/src/cli/dashboard/prompts/reset-partial.ts +++ b/src/cli/dashboard/prompts/reset-partial.ts @@ -20,7 +20,7 @@ export default class PromptsResetPartial extends DashboardCommand { const partial = await this.client.prompts.getPartial.query({ name: flags.name }); if (partial.source === 'disk') { - this.log(`Partial "${flags.name}" is already using disk default.`); + this.log(`Partial '${flags.name}' is already using disk default.`); return; } @@ -28,14 +28,16 @@ export default class PromptsResetPartial extends DashboardCommand { this.error(`Cannot determine partial ID for "${flags.name}".`); } - await this.client.prompts.deletePartial.mutate({ id: partial.id }); + await this.withSpinner('Resetting partial...', () => + this.client.prompts.deletePartial.mutate({ id: partial.id as number }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Partial "${flags.name}" reset to disk default.`); + this.success(`Reset partial '${flags.name}' to disk default`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/prompts/set-partial.ts b/src/cli/dashboard/prompts/set-partial.ts index 5d8fe73d..0bb4dfe2 100644 --- a/src/cli/dashboard/prompts/set-partial.ts +++ b/src/cli/dashboard/prompts/set-partial.ts @@ -24,17 +24,19 @@ export default class PromptsSetPartial extends DashboardCommand { const content = flags.file === '-' ? readFileSync(0, 'utf-8') : readFileSync(flags.file, 'utf-8'); - const result = await this.client.prompts.upsertPartial.mutate({ - name: flags.name, - content, - }); + const result = await this.withSpinner('Saving partial...', () => + this.client.prompts.upsertPartial.mutate({ + name: flags.name, + content, + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Partial "${flags.name}" saved (id: ${result.id}).`); + this.success(`Saved partial '${flags.name}' (id: ${result.id})`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/runs/cancel.ts b/src/cli/dashboard/runs/cancel.ts index 3bdf0b22..c4e2cc43 100644 --- a/src/cli/dashboard/runs/cancel.ts +++ b/src/cli/dashboard/runs/cancel.ts @@ -20,15 +20,17 @@ export default class RunsCancel extends DashboardCommand { const { args, flags } = await this.parse(RunsCancel); try { - const result = await this.client.runs.cancel.mutate({ - runId: args.id, - reason: flags.reason, - }); + const result = await this.withSpinner('Cancelling run...', () => + this.client.runs.cancel.mutate({ + runId: args.id, + reason: flags.reason, + }), + ); if (flags.json) { this.outputJson(result); } else { - this.log('Run cancelled successfully.'); + this.success(`Cancelled run ${args.id}`); } } catch (err) { this.handleError(err); diff --git a/src/cli/dashboard/runs/retry.ts b/src/cli/dashboard/runs/retry.ts index 10ac5ac2..9cacc1bb 100644 --- a/src/cli/dashboard/runs/retry.ts +++ b/src/cli/dashboard/runs/retry.ts @@ -17,15 +17,17 @@ export default class RunsRetry extends DashboardCommand { const { args, flags } = await this.parse(RunsRetry); try { - const result = await this.client.runs.retry.mutate({ - runId: args.id, - model: flags.model, - }); + const result = await this.withSpinner('Retrying run...', () => + this.client.runs.retry.mutate({ + runId: args.id, + model: flags.model, + }), + ); if (flags.json) { this.outputJson(result); } else { - this.log('Run retry triggered successfully.'); + this.success(`Retry triggered — run ID: ${args.id}`); } } catch (err) { this.handleError(err); diff --git a/src/cli/dashboard/runs/trigger.ts b/src/cli/dashboard/runs/trigger.ts index b55e88f2..5d6527dc 100644 --- a/src/cli/dashboard/runs/trigger.ts +++ b/src/cli/dashboard/runs/trigger.ts @@ -20,21 +20,25 @@ export default class RunsTrigger extends DashboardCommand { const { flags } = await this.parse(RunsTrigger); try { - const result = await this.client.runs.trigger.mutate({ - projectId: flags.project, - agentType: flags['agent-type'], - workItemId: flags['work-item-id'], - prNumber: flags['pr-number'], - prBranch: flags['pr-branch'], - repoFullName: flags['repo-full-name'], - headSha: flags['head-sha'], - model: flags.model, - }); + const result = await this.withSpinner('Triggering agent run...', () => + this.client.runs.trigger.mutate({ + projectId: flags.project, + agentType: flags['agent-type'], + workItemId: flags['work-item-id'], + prNumber: flags['pr-number'], + prBranch: flags['pr-branch'], + repoFullName: flags['repo-full-name'], + headSha: flags['head-sha'], + model: flags.model, + }), + ); if (flags.json) { this.outputJson(result); } else { - this.log('Agent run triggered successfully.'); + this.success( + `Agent run triggered — project: ${flags.project}, agent: ${flags['agent-type']}`, + ); } } catch (err) { this.handleError(err); diff --git a/src/cli/dashboard/users/create.ts b/src/cli/dashboard/users/create.ts index ffe49931..d8cd5cbe 100644 --- a/src/cli/dashboard/users/create.ts +++ b/src/cli/dashboard/users/create.ts @@ -20,19 +20,21 @@ export default class UsersCreate extends DashboardCommand { const { flags } = await this.parse(UsersCreate); try { - const result = await this.client.users.create.mutate({ - email: flags.email, - password: flags.password, - name: flags.name, - role: flags.role as 'member' | 'admin' | 'superadmin' | undefined, - }); + const result = await this.withSpinner('Creating user...', () => + this.client.users.create.mutate({ + email: flags.email, + password: flags.password, + name: flags.name, + role: flags.role as 'member' | 'admin' | 'superadmin' | undefined, + }), + ); if (flags.json) { this.outputJson(result); return; } - this.log(`Created user: ${flags.name} <${flags.email}> (role: ${flags.role})`); + this.success(`Created user '${flags.name}' (${flags.email}), role: ${flags.role}`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/users/delete.ts b/src/cli/dashboard/users/delete.ts index 72643433..30e51952 100644 --- a/src/cli/dashboard/users/delete.ts +++ b/src/cli/dashboard/users/delete.ts @@ -20,14 +20,16 @@ export default class UsersDelete extends DashboardCommand { await confirm(`Delete user ${args.id}?`, flags.yes); try { - await this.client.users.delete.mutate({ id: args.id }); + await this.withSpinner('Deleting user...', () => + this.client.users.delete.mutate({ id: args.id }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Deleted user ${args.id}`); + this.success(`Deleted user ${args.id}`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/users/update.ts b/src/cli/dashboard/users/update.ts index 1f0f7392..6091a3f0 100644 --- a/src/cli/dashboard/users/update.ts +++ b/src/cli/dashboard/users/update.ts @@ -23,20 +23,22 @@ export default class UsersUpdate extends DashboardCommand { const { args, flags } = await this.parse(UsersUpdate); try { - await this.client.users.update.mutate({ - id: args.id, - name: flags.name, - email: flags.email, - role: flags.role as 'member' | 'admin' | 'superadmin' | undefined, - password: flags.password, - }); + await this.withSpinner('Updating user...', () => + this.client.users.update.mutate({ + id: args.id, + name: flags.name, + email: flags.email, + role: flags.role as 'member' | 'admin' | 'superadmin' | undefined, + password: flags.password, + }), + ); if (flags.json) { this.outputJson({ ok: true }); return; } - this.log(`Updated user ${args.id}`); + this.success(`Updated user ${args.id}`); } catch (err) { this.handleError(err); } diff --git a/src/cli/dashboard/webhooks/create.ts b/src/cli/dashboard/webhooks/create.ts index e9638bf8..d65a49dd 100644 --- a/src/cli/dashboard/webhooks/create.ts +++ b/src/cli/dashboard/webhooks/create.ts @@ -38,13 +38,15 @@ export default class WebhooksCreate extends DashboardCommand { if (flags['jira-email']) oneTimeTokens.jiraEmail = flags['jira-email']; if (flags['jira-api-token']) oneTimeTokens.jiraApiToken = flags['jira-api-token']; - const result = await this.client.webhooks.create.mutate({ - projectId: args.projectId, - callbackBaseUrl, - trelloOnly: flags['trello-only'], - githubOnly: flags['github-only'], - oneTimeTokens: Object.keys(oneTimeTokens).length > 0 ? oneTimeTokens : undefined, - }); + const result = await this.withSpinner('Creating webhooks...', () => + this.client.webhooks.create.mutate({ + projectId: args.projectId, + callbackBaseUrl, + trelloOnly: flags['trello-only'], + githubOnly: flags['github-only'], + oneTimeTokens: Object.keys(oneTimeTokens).length > 0 ? oneTimeTokens : undefined, + }), + ); if (flags.json) { this.outputJson(result); @@ -55,7 +57,9 @@ export default class WebhooksCreate extends DashboardCommand { if (typeof result.trello === 'string') { this.log(`Trello: ${result.trello}`); } else { - this.log(`Created Trello webhook: [${result.trello.id}] ${result.trello.callbackURL}`); + this.success( + `Created Trello webhook: [${result.trello.id}] ${result.trello.callbackURL}`, + ); } } @@ -63,7 +67,7 @@ export default class WebhooksCreate extends DashboardCommand { if (typeof result.github === 'string') { this.log(`GitHub: ${result.github}`); } else { - this.log(`Created GitHub webhook: [${result.github.id}] ${result.github.config.url}`); + this.success(`Created GitHub webhook: [${result.github.id}] ${result.github.config.url}`); } } @@ -71,7 +75,7 @@ export default class WebhooksCreate extends DashboardCommand { if (typeof result.jira === 'string') { this.log(`JIRA: ${result.jira}`); } else { - this.log(`Created JIRA webhook: [${result.jira.id}] ${result.jira.url}`); + this.success(`Created JIRA webhook: [${result.jira.id}] ${result.jira.url}`); } } } catch (err) { diff --git a/src/cli/dashboard/webhooks/delete.ts b/src/cli/dashboard/webhooks/delete.ts index 19116f96..04a10820 100644 --- a/src/cli/dashboard/webhooks/delete.ts +++ b/src/cli/dashboard/webhooks/delete.ts @@ -37,13 +37,15 @@ export default class WebhooksDelete extends DashboardCommand { if (flags['jira-email']) oneTimeTokens.jiraEmail = flags['jira-email']; if (flags['jira-api-token']) oneTimeTokens.jiraApiToken = flags['jira-api-token']; - const result = await this.client.webhooks.delete.mutate({ - projectId: args.projectId, - callbackBaseUrl, - trelloOnly: flags['trello-only'], - githubOnly: flags['github-only'], - oneTimeTokens: Object.keys(oneTimeTokens).length > 0 ? oneTimeTokens : undefined, - }); + const result = await this.withSpinner('Deleting webhooks...', () => + this.client.webhooks.delete.mutate({ + projectId: args.projectId, + callbackBaseUrl, + trelloOnly: flags['trello-only'], + githubOnly: flags['github-only'], + oneTimeTokens: Object.keys(oneTimeTokens).length > 0 ? oneTimeTokens : undefined, + }), + ); if (flags.json) { this.outputJson(result); @@ -51,19 +53,23 @@ export default class WebhooksDelete extends DashboardCommand { } if (result.trello.length > 0) { - this.log(`Deleted ${result.trello.length} Trello webhook(s): ${result.trello.join(', ')}`); + this.success( + `Deleted ${result.trello.length} Trello webhook(s): ${result.trello.join(', ')}`, + ); } else { this.log('No matching Trello webhooks found.'); } if (result.github.length > 0) { - this.log(`Deleted ${result.github.length} GitHub webhook(s): ${result.github.join(', ')}`); + this.success( + `Deleted ${result.github.length} GitHub webhook(s): ${result.github.join(', ')}`, + ); } else { this.log('No matching GitHub webhooks found.'); } if (result.jira.length > 0) { - this.log(`Deleted ${result.jira.length} JIRA webhook(s): ${result.jira.join(', ')}`); + this.success(`Deleted ${result.jira.length} JIRA webhook(s): ${result.jira.join(', ')}`); } else { this.log('No matching JIRA webhooks found.'); }