Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/cli/dashboard/agents/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 4 additions & 2 deletions src/cli/dashboard/agents/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
20 changes: 11 additions & 9 deletions src/cli/dashboard/agents/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
16 changes: 9 additions & 7 deletions src/cli/dashboard/definitions/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 6 additions & 4 deletions src/cli/dashboard/definitions/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 8 additions & 4 deletions src/cli/dashboard/definitions/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 6 additions & 4 deletions src/cli/dashboard/definitions/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 7 additions & 5 deletions src/cli/dashboard/definitions/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof this.client.agentDefinitions.update.mutate>[0]['patch'],
});
const result = await this.withSpinner('Updating agent definition...', () =>
this.client.agentDefinitions.update.mutate({
agentType: args.agentType,
patch: patch as Parameters<typeof this.client.agentDefinitions.update.mutate>[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);
}
Expand Down
5 changes: 4 additions & 1 deletion src/cli/dashboard/login.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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 (
Expand Down
3 changes: 2 additions & 1 deletion src/cli/dashboard/logout.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -21,6 +22,6 @@ export default class Logout extends Command {
}

clearConfig();
this.log('Logged out.');
this.log(chalk.green('✓ Logged out.'));
}
}
6 changes: 4 additions & 2 deletions src/cli/dashboard/org/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
34 changes: 18 additions & 16 deletions src/cli/dashboard/projects/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 7 additions & 5 deletions src/cli/dashboard/projects/credentials-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
16 changes: 9 additions & 7 deletions src/cli/dashboard/projects/credentials-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 4 additions & 2 deletions src/cli/dashboard/projects/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading
Loading