@copado/agentia-cli 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/README.md +2252 -1529
- package/dist/commands/ai/agent/ask.js +4 -4
- package/dist/commands/ai/agent/chat.js +4 -4
- package/dist/commands/cicd/cloud/commit.js +7 -2
- package/dist/commands/cicd/credential/auth/status.js +38 -0
- package/dist/commands/cicd/credential/auth/web/login.js +54 -0
- package/dist/commands/cicd/credential/list.js +13 -17
- package/dist/commands/cicd/credential/open.js +30 -0
- package/dist/commands/cicd/credential/update.js +9 -12
- package/dist/commands/cicd/environment/auth/status.js +34 -13
- package/dist/commands/cicd/environment/auth/web/login.js +20 -4
- package/dist/commands/cicd/environment/open.js +6 -22
- package/dist/commands/cicd/extension/create.js +53 -0
- package/dist/commands/cicd/extension/install.js +127 -0
- package/dist/commands/cicd/extension/package.js +35 -0
- package/dist/commands/cicd/extension/publish.js +61 -0
- package/dist/commands/cicd/extension/uninstall.js +99 -0
- package/dist/commands/cicd/extension/validate.js +47 -0
- package/dist/commands/cicd/extension-configuration/get.js +24 -0
- package/dist/commands/cicd/extension-configuration/list.js +49 -0
- package/dist/commands/cicd/extension-configuration/open.js +38 -0
- package/dist/commands/cicd/metadata/content/get.js +1 -1
- package/dist/commands/cicd/metadata/dependency/list.js +2 -2
- package/dist/commands/cicd/metadata/explore.js +81 -0
- package/dist/commands/cicd/metadata/list.js +3 -3
- package/dist/commands/cicd/metadata/refresh/deleted.js +1 -1
- package/dist/commands/cicd/metadata/refresh/run.js +2 -2
- package/dist/commands/cicd/metadata/refresh/status.js +2 -2
- package/dist/commands/cicd/pipeline/automation/activate.js +39 -0
- package/dist/commands/cicd/pipeline/automation/create.js +33 -0
- package/dist/commands/cicd/pipeline/automation/deactivate.js +39 -0
- package/dist/commands/cicd/pipeline/automation/delete.js +45 -0
- package/dist/commands/cicd/pipeline/automation/get.js +32 -0
- package/dist/commands/cicd/pipeline/automation/list.js +38 -0
- package/dist/commands/cicd/pipeline/automation/open.js +38 -0
- package/dist/commands/cicd/pipeline/automation/update.js +38 -0
- package/dist/commands/cicd/pipeline/quality-gate/activate.js +39 -0
- package/dist/commands/cicd/pipeline/quality-gate/create.js +34 -0
- package/dist/commands/cicd/pipeline/quality-gate/deactivate.js +39 -0
- package/dist/commands/cicd/pipeline/quality-gate/delete.js +45 -0
- package/dist/commands/cicd/pipeline/quality-gate/get.js +32 -0
- package/dist/commands/cicd/pipeline/quality-gate/list.js +34 -0
- package/dist/commands/cicd/pipeline/quality-gate/open.js +38 -0
- package/dist/commands/cicd/pipeline/quality-gate/update.js +38 -0
- package/dist/commands/cicd/work/create.js +1 -0
- package/dist/commands/cicd/work/environment-sync.js +8 -7
- package/dist/commands/cicd/work/get.js +18 -2
- package/dist/commands/cicd/work/set.js +6 -4
- package/dist/commands/cicd/work/submit.js +3 -2
- package/dist/commands/cicd/work/update.js +1 -0
- package/dist/commands/plugins/install.js +2 -5
- package/dist/commands/setup/skills/create.js +29 -3
- package/dist/commands/setup/skills/list.js +55 -0
- package/dist/commands/setup/skills/update.js +37 -4
- package/dist/commands/setup.js +3 -3
- package/dist/commands/testing/data-table/create.js +1 -2
- package/dist/commands/testing/data-table/delete.js +1 -2
- package/dist/commands/testing/data-table/export.js +2 -6
- package/dist/commands/testing/data-table/get.js +2 -4
- package/dist/commands/testing/data-table/list.js +1 -2
- package/dist/commands/testing/data-table/update.js +3 -4
- package/dist/commands/testing/job/create.js +26 -22
- package/dist/commands/testing/job/delete.js +2 -2
- package/dist/commands/testing/job/files/download.js +73 -0
- package/dist/commands/testing/job/files/list.js +43 -0
- package/dist/commands/testing/job/{upload.js → files/upload.js} +13 -9
- package/dist/commands/testing/job/get.js +2 -2
- package/dist/commands/testing/job/list.js +1 -1
- package/dist/commands/testing/job/refs.js +4 -4
- package/dist/commands/testing/job/run.js +134 -1
- package/dist/commands/testing/{build → job/runs}/abort.js +10 -8
- package/dist/commands/testing/job/runs/get.js +42 -0
- package/dist/commands/testing/{build → job/runs}/list.js +19 -10
- package/dist/commands/testing/{logs.js → job/runs/logs.js} +9 -6
- package/dist/commands/testing/{build → job/runs}/search.js +9 -7
- package/dist/commands/testing/job/schedule/get.js +5 -11
- package/dist/commands/testing/job/schedule/remove.js +3 -3
- package/dist/commands/testing/job/schedule/set.js +3 -3
- package/dist/commands/testing/job/update.js +22 -65
- package/dist/commands/testing/live/continue.js +5 -10
- package/dist/commands/testing/live/execute.js +3 -3
- package/dist/commands/testing/live/history.js +7 -2
- package/dist/commands/testing/live/inspect.js +5 -4
- package/dist/commands/testing/live/interrupt.js +5 -10
- package/dist/commands/testing/live/recorder.js +23 -115
- package/dist/commands/testing/live/reports.js +3 -3
- package/dist/commands/testing/live/screenshot.js +3 -3
- package/dist/commands/testing/live/set-options.js +11 -4
- package/dist/commands/testing/live/start.js +9 -4
- package/dist/commands/testing/live/status.js +2 -5
- package/dist/commands/testing/live/stop.js +3 -5
- package/dist/commands/testing/live/view.js +2 -2
- package/dist/commands/testing/project/create.js +1 -17
- package/dist/commands/testing/project/get.js +0 -1
- package/dist/commands/testing/project/list.js +2 -2
- package/dist/commands/testing/project/permission/set.js +3 -7
- package/dist/commands/testing/project/permission/update.js +2 -2
- package/dist/commands/testing/robot/create.js +22 -25
- package/dist/commands/testing/robot/get.js +1 -1
- package/dist/commands/testing/robot/list.js +3 -3
- package/dist/commands/testing/robot/update.js +3 -3
- package/dist/commands/testing/user-parameter/create.js +3 -9
- package/dist/commands/testing/user-parameter/update.js +1 -7
- package/dist/commands/testing/variable/create.js +4 -9
- package/dist/commands/testing/variable/list.js +3 -3
- package/dist/commands/testing/variable/update.js +5 -12
- package/dist/help.js +17 -0
- package/dist/lib/ai-types.js +2 -1
- package/dist/lib/claude-mcp-config.js +15 -0
- package/dist/lib/credential-sync.js +1 -2
- package/dist/lib/defaults-store.js +4 -1
- package/dist/lib/environment-auth-status.js +2 -1
- package/dist/lib/environment-auth.js +2 -1
- package/dist/lib/environment-credential-flags.js +3 -1
- package/dist/lib/environment-credential-operations.js +8 -2
- package/dist/lib/environment-types.js +3 -1
- package/dist/lib/extension/assets.js +4 -0
- package/dist/lib/extension/create.js +3 -0
- package/dist/lib/extension/git.js +17 -0
- package/dist/lib/extension/index.js +27 -0
- package/dist/lib/extension/install.js +4 -0
- package/dist/lib/extension/manifest.js +21 -0
- package/dist/lib/extension/package.js +3 -0
- package/dist/lib/extension/paths.js +5 -0
- package/dist/lib/extension/publish.js +3 -0
- package/dist/lib/extension/sf-deploy.js +8 -0
- package/dist/lib/extension/source.js +7 -0
- package/dist/lib/extension/uninstall.js +3 -0
- package/dist/lib/extension-configuration-ops.js +4 -0
- package/dist/lib/extension-configuration-sanitize.js +7 -0
- package/dist/lib/extension-configuration-types.js +8 -0
- package/dist/lib/function-types.js +3 -1
- package/dist/lib/http-proxy.js +13 -0
- package/dist/lib/mcp/ai-tools.js +3 -3
- package/dist/lib/mcp/command-id.js +2 -0
- package/dist/lib/mcp/pipeline-automation-quality-tools.js +452 -0
- package/dist/lib/mcp/server.js +70 -1
- package/dist/lib/mcp/testing-live-tools.js +24 -13
- package/dist/lib/mcp/testing-tools.js +239 -550
- package/dist/lib/mcp/tool-annotations.js +27 -18
- package/dist/lib/mcp/tools.js +117 -32
- package/dist/lib/mcp/work-tools.js +37 -10
- package/dist/lib/metadata-explore.js +8 -0
- package/dist/lib/network-error.js +8 -0
- package/dist/lib/pipeline-automation-flags.js +12 -0
- package/dist/lib/pipeline-automation-ops.js +9 -0
- package/dist/lib/pipeline-automation-types.js +18 -0
- package/dist/lib/pipeline-lifecycle-id.js +3 -0
- package/dist/lib/pipeline-quality-gate-flags.js +12 -0
- package/dist/lib/pipeline-quality-gate-ops.js +9 -0
- package/dist/lib/pipeline-quality-gate-types.js +17 -0
- package/dist/lib/plugin-host/ai.js +2 -1
- package/dist/lib/plugin-skills.js +22 -0
- package/dist/lib/plugin-trust/gate.js +1 -2
- package/dist/lib/project-root.js +3 -1
- package/dist/lib/project-setup.js +5 -4
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/salesforce-tooling-check.js +6 -0
- package/dist/lib/setup-skills.js +4 -1
- package/dist/lib/setup-templates.js +1 -4
- package/dist/lib/skill-packs.js +7 -0
- package/dist/lib/template-types.js +3 -1
- package/dist/lib/testing-archive.js +9 -0
- package/dist/lib/testing-data-table.js +39 -0
- package/dist/lib/testing-execution.js +22 -0
- package/dist/lib/testing-flags.js +6 -2
- package/dist/lib/testing-gateway.js +4 -1
- package/dist/lib/testing-live-command.js +3 -1
- package/dist/lib/testing-live-operations.js +7 -1
- package/dist/lib/testing-live-recorder.js +3 -1
- package/dist/lib/testing-live-state.js +8 -1
- package/dist/lib/testing-operations.js +6 -21
- package/dist/lib/testing-sanitization.js +2 -1
- package/dist/lib/testing-secret-input.js +2 -1
- package/dist/lib/testing-types.js +24 -3
- package/dist/lib/work-committed-metadata.js +4 -0
- package/dist/lib/work-environment-sync.js +3 -1
- package/dist/lib/work-flags.js +6 -1
- package/dist/lib/work-get.js +2 -1
- package/dist/lib/work-local-development-flow.js +4 -0
- package/dist/lib/work-submit-wait.js +3 -1
- package/oclif.manifest.json +9771 -9650
- package/package.json +35 -2
- package/templates/rules/cursor/agentia.mdc +29 -0
- package/templates/skills/agentia/SKILL.md +29 -0
- package/templates/skills/agentia-ai/SKILL.md +3 -4
- package/templates/skills/agentia-ai/references/ai-agents.md +2 -2
- package/templates/skills/agentia-cicd/SKILL.md +9 -4
- package/templates/skills/agentia-cicd/references/environments-and-credentials.md +19 -13
- package/templates/skills/agentia-cicd/references/extensions.md +52 -0
- package/templates/skills/agentia-cicd/references/pipelines.md +36 -2
- package/templates/skills/agentia-cicd/references/work.md +25 -8
- package/templates/skills/agentia-metadata/SKILL.md +140 -0
- package/templates/skills/agentia-metadata/references/metadata-explore.md +142 -0
- package/templates/skills/agentia-testing/SKILL.md +3 -3
- package/templates/skills/agentia-testing/references/tests.md +14 -14
- package/dist/commands/testing/build/get.js +0 -38
- package/dist/commands/testing/build/latest.js +0 -40
- package/dist/commands/testing/build/logs.js +0 -47
- package/dist/commands/testing/build/run.js +0 -26
- package/dist/commands/testing/create.js +0 -2
- package/dist/commands/testing/job/download.js +0 -54
- package/dist/commands/testing/job/files.js +0 -34
- package/dist/commands/testing/run.js +0 -26
- package/dist/commands/testing/status.js +0 -45
- package/dist/commands/testing/test/create.js +0 -2
- package/dist/commands/testing/test/logs.js +0 -2
- package/dist/commands/testing/test/run.js +0 -26
- package/dist/commands/testing/test/status.js +0 -2
- package/dist/commands/testing/test/update.js +0 -2
- package/dist/commands/testing/update.js +0 -65
- package/dist/lib/testing-data-command.js +0 -8
- package/dist/lib/testing-data-core.js +0 -20
- package/dist/lib/testing-data-export.js +0 -6
- package/dist/lib/testing-data-import.js +0 -6
- package/dist/lib/testing-data-io.js +0 -12
- package/dist/lib/testing-data-operations.js +0 -10
- package/dist/lib/testing-data-types.js +0 -4
- package/dist/lib/testing-live-endpoints.js +0 -6
- package/dist/lib/testing-live-history.js +0 -7
- package/dist/lib/testing-run-command.js +0 -3
- package/dist/lib/testing-schedule.js +0 -5
- package/dist/lib/testing-session.js +0 -5
- package/dist/lib/testing-watch.js +0 -4
- package/templates/AGENTS.md +0 -24
|
@@ -3,11 +3,11 @@ import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
|
3
3
|
import { aiConnectionFlags, aiGatewayCallOptions } from '../../../lib/ai-flags.js';
|
|
4
4
|
import { runAiAsk } from '../../../lib/ai-operations.js';
|
|
5
5
|
import { formatAiTerminalMessage, renderMarkdown, StreamingMarkdownRenderer, streamSupportsColor, } from '../../../lib/ai-terminal-renderer.js';
|
|
6
|
-
import { AI_ASK_AGENTS } from '../../../lib/ai-types.js';
|
|
6
|
+
import { AI_ASK_AGENTS, AI_DEFAULT_AGENT } from '../../../lib/ai-types.js';
|
|
7
7
|
export default class AiAgentAsk extends AgentiaCommand {
|
|
8
8
|
static description = 'Send a single-turn prompt to a Copado AI agent';
|
|
9
9
|
static examples = [
|
|
10
|
-
'<%= config.bin %> <%= command.id %> -p "
|
|
10
|
+
'<%= config.bin %> <%= command.id %> -p "Why did the last promotion fail?"',
|
|
11
11
|
'<%= config.bin %> <%= command.id %> --agent plan -p "Break this requirement into implementation steps"',
|
|
12
12
|
'<%= config.bin %> <%= command.id %> --agent build -p "Generate an Apex handler outline" --sf-org test14 --user-story US-1042',
|
|
13
13
|
'<%= config.bin %> <%= command.id %> --agent test -p "Create regression checks" --component LeadScoringHandler --json',
|
|
@@ -16,8 +16,8 @@ export default class AiAgentAsk extends AgentiaCommand {
|
|
|
16
16
|
];
|
|
17
17
|
static flags = {
|
|
18
18
|
agent: Flags.option({
|
|
19
|
-
default:
|
|
20
|
-
description: 'AI agent to target (defaults to
|
|
19
|
+
default: AI_DEFAULT_AGENT,
|
|
20
|
+
description: 'AI agent to target (defaults to orchestrate, which routes to the right specialist)',
|
|
21
21
|
options: [...AI_ASK_AGENTS],
|
|
22
22
|
})(),
|
|
23
23
|
component: Flags.string({
|
|
@@ -3,7 +3,7 @@ import { stdin as input } from 'node:process';
|
|
|
3
3
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
4
4
|
import { runAiChatSession } from '../../../lib/ai-chat-session.js';
|
|
5
5
|
import { aiConnectionFlags, aiGatewayCallOptions } from '../../../lib/ai-flags.js';
|
|
6
|
-
import { AI_CHAT_AGENTS } from '../../../lib/ai-types.js';
|
|
6
|
+
import { AI_CHAT_AGENTS, AI_DEFAULT_AGENT } from '../../../lib/ai-types.js';
|
|
7
7
|
export default class AiAgentChat extends AgentiaCommand {
|
|
8
8
|
static description = 'Start an interactive Copado AI agent chat session';
|
|
9
9
|
static enableJsonFlag = false;
|
|
@@ -12,12 +12,12 @@ export default class AiAgentChat extends AgentiaCommand {
|
|
|
12
12
|
'<%= config.bin %> <%= command.id %> --agent plan --sf-org test14',
|
|
13
13
|
'<%= config.bin %> <%= command.id %> --agent build --user-story US-1042 --timeout 240',
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --agent knowledge',
|
|
15
|
-
'<%= config.bin %> <%= command.id %> --
|
|
15
|
+
'<%= config.bin %> <%= command.id %> --workspace 42d0b908-37b7-4565-9ec9-86eda40c9782',
|
|
16
16
|
];
|
|
17
17
|
static flags = {
|
|
18
18
|
agent: Flags.option({
|
|
19
|
-
default:
|
|
20
|
-
description: 'AI agent to target (defaults to
|
|
19
|
+
default: AI_DEFAULT_AGENT,
|
|
20
|
+
description: 'AI agent to target (defaults to orchestrate, which routes to the right specialist)',
|
|
21
21
|
options: [...AI_CHAT_AGENTS],
|
|
22
22
|
})(),
|
|
23
23
|
component: Flags.string({
|
|
@@ -90,7 +90,10 @@ async function commitInputFromFlags(flags) {
|
|
|
90
90
|
return jsonInputFromFlags(flags);
|
|
91
91
|
}
|
|
92
92
|
if (!simpleMode) {
|
|
93
|
-
throw new WorkCommitValidationError('Requires simple metadata flags such as --metadata-name and --metadata-
|
|
93
|
+
throw new WorkCommitValidationError('Requires simple metadata flags such as --metadata-name, --metadata-type, and --metadata-category, or JSON input with --file/--stdin.');
|
|
94
|
+
}
|
|
95
|
+
if (flags['metadata-category'] === undefined || flags['metadata-category'].trim().length === 0) {
|
|
96
|
+
throw new WorkCommitValidationError('--metadata-category is required.');
|
|
94
97
|
}
|
|
95
98
|
return simpleInputFromFlags(flags);
|
|
96
99
|
}
|
|
@@ -105,7 +108,9 @@ export default class CloudCommit extends AgentiaCommand {
|
|
|
105
108
|
'Create a Copado cloud metadata commit for a user story.',
|
|
106
109
|
'Preflights the story, submits POST /release/commit, and polls the job monitor by default.',
|
|
107
110
|
'For local Git work, use git add/commit then `cicd work publish`. Permission and full-metadata selections belong on `cicd work publish`.',
|
|
108
|
-
|
|
111
|
+
'',
|
|
112
|
+
'NOTE: Do not use this command along with local development (git operations, cicd work push/submit).',
|
|
113
|
+
].join('\n');
|
|
109
114
|
static examples = [
|
|
110
115
|
'<%= config.bin %> <%= command.id %> --message "Commit AccountService" --metadata-name AccountService --metadata-type ApexClass --metadata-category SFDX --action Add',
|
|
111
116
|
'<%= config.bin %> <%= command.id %> a07XXXXXXXXXXXXXXX --message "Update Aura files" --metadata-name accountEditor --metadata-type AuraDefinitionBundle --metadata-category SFDX --action SelectiveCommit --selection accountEditor/accountEditor.cmp --selection accountEditor/accountEditorController.js',
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Args, ux } from '@oclif/core';
|
|
2
|
+
import { AgentiaCommand } from '../../../../lib/agentia-command.js';
|
|
3
|
+
import { runCredentialAuthStatus, } from '../../../../lib/environment-auth-status.js';
|
|
4
|
+
import { EnvironmentCredentialInputError } from '../../../../lib/environment-credential-flags.js';
|
|
5
|
+
import { formatEnvironmentAuthStatus } from '../../../../lib/environment-types.js';
|
|
6
|
+
export default class CredentialAuthStatus extends AgentiaCommand {
|
|
7
|
+
static args = {
|
|
8
|
+
id: Args.string({
|
|
9
|
+
description: 'Copado credential ID',
|
|
10
|
+
name: 'id',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
static description = 'Validate the authentication status of a credential by ID';
|
|
15
|
+
static examples = [
|
|
16
|
+
'<%= config.bin %> <%= command.id %> <credential-id>',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --json',
|
|
18
|
+
];
|
|
19
|
+
async run() {
|
|
20
|
+
const { args } = await this.parse(CredentialAuthStatus);
|
|
21
|
+
try {
|
|
22
|
+
const result = await this.withSpinner('Validating credential', () => runCredentialAuthStatus({
|
|
23
|
+
credentialId: args.id,
|
|
24
|
+
}));
|
|
25
|
+
this.display(() => {
|
|
26
|
+
this.log(formatEnvironmentAuthStatus(result, { colorize: ux.colorize }));
|
|
27
|
+
});
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error instanceof EnvironmentCredentialInputError) {
|
|
32
|
+
this.error(error.message, { exit: error.exitCode });
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { AgentiaCommand } from '../../../../../lib/agentia-command.js';
|
|
3
|
+
import { DEFAULT_AUTH_TIMEOUT_SECONDS, runCredentialWebLogin, } from '../../../../../lib/environment-auth.js';
|
|
4
|
+
import { EnvironmentCredentialInputError } from '../../../../../lib/environment-credential-flags.js';
|
|
5
|
+
export default class CredentialAuthWebLogin extends AgentiaCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({
|
|
8
|
+
description: 'Copado credential ID',
|
|
9
|
+
name: 'id',
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = 'Authenticate a credential via browser web login';
|
|
14
|
+
static examples = [
|
|
15
|
+
'<%= config.bin %> <%= command.id %> <credential-id>',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --port 8085 --timeout 120',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --json',
|
|
18
|
+
];
|
|
19
|
+
static flags = {
|
|
20
|
+
port: Flags.integer({
|
|
21
|
+
description: 'Local loopback port (default: scan 8080-8090)',
|
|
22
|
+
}),
|
|
23
|
+
timeout: Flags.integer({
|
|
24
|
+
default: DEFAULT_AUTH_TIMEOUT_SECONDS,
|
|
25
|
+
description: 'Max seconds to wait for browser login',
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { args, flags } = await this.parse(CredentialAuthWebLogin);
|
|
30
|
+
try {
|
|
31
|
+
const result = await this.withSpinner('Authenticating credential', () => runCredentialWebLogin({
|
|
32
|
+
credentialId: args.id,
|
|
33
|
+
port: flags.port,
|
|
34
|
+
quiet: this.jsonEnabled(),
|
|
35
|
+
timeoutSeconds: flags.timeout,
|
|
36
|
+
}));
|
|
37
|
+
this.display(() => {
|
|
38
|
+
this.log(`Authenticated credential "${result.credentialName}" for environment ${result.environmentId}.`);
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (error instanceof EnvironmentCredentialInputError) {
|
|
44
|
+
this.error(error.message, { exit: error.exitCode });
|
|
45
|
+
}
|
|
46
|
+
const { exitCode } = error;
|
|
47
|
+
if (exitCode !== undefined) {
|
|
48
|
+
this.error(error.message, { exit: exitCode });
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
2
|
-
import { credentialListFlags } from '../../../lib/environment-credential-flags.js';
|
|
3
|
-
import {
|
|
2
|
+
import { buildCredentialListFilters, credentialListFlags } from '../../../lib/environment-credential-flags.js';
|
|
3
|
+
import { listCredentials } from '../../../lib/environment-credential-operations.js';
|
|
4
4
|
import { cellValue, table } from '../../../lib/format.js';
|
|
5
|
-
|
|
5
|
+
import { displayListPagination } from '../../../lib/list-pagination.js';
|
|
6
6
|
export function formatCredentialTable(credentials) {
|
|
7
7
|
const header = [
|
|
8
8
|
{ alias: 'ID', value: 'id' },
|
|
@@ -29,30 +29,26 @@ export function formatCredentialTable(credentials) {
|
|
|
29
29
|
return table(header, rows);
|
|
30
30
|
}
|
|
31
31
|
export default class CredentialList extends AgentiaCommand {
|
|
32
|
-
static description = 'List credentials
|
|
32
|
+
static description = 'List Copado credentials across environments';
|
|
33
33
|
static examples = [
|
|
34
|
-
'<%= config.bin %> <%= command.id %>
|
|
35
|
-
'<%= config.bin %> <%= command.id %> --
|
|
36
|
-
'<%= config.bin %> <%= command.id %> --
|
|
34
|
+
'<%= config.bin %> <%= command.id %>',
|
|
35
|
+
'<%= config.bin %> <%= command.id %> --name CI',
|
|
36
|
+
'<%= config.bin %> <%= command.id %> --page-size 50',
|
|
37
|
+
'<%= config.bin %> <%= command.id %> --cursor NEXT --json',
|
|
37
38
|
];
|
|
38
39
|
static flags = credentialListFlags;
|
|
39
40
|
async run() {
|
|
40
41
|
const { flags } = await this.parse(CredentialList);
|
|
41
|
-
const
|
|
42
|
-
const credentials = response.map((credential) => sanitizeCredentialListItem(credential));
|
|
42
|
+
const page = await this.withSpinner('Fetching credentials', () => listCredentials(buildCredentialListFilters(flags)));
|
|
43
43
|
this.display(() => {
|
|
44
|
-
if (
|
|
44
|
+
if (page.data.length === 0) {
|
|
45
45
|
this.log('No credentials found.');
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (truncated) {
|
|
51
|
-
this.log(`Showing first ${CREDENTIAL_TABLE_DISPLAY_LIMIT} of ${credentials.length} credentials.`);
|
|
52
|
-
}
|
|
53
|
-
this.log(formatCredentialTable(displayedCredentials));
|
|
48
|
+
this.log(formatCredentialTable(page.data));
|
|
49
|
+
displayListPagination(this.log.bind(this), page);
|
|
54
50
|
});
|
|
55
|
-
return
|
|
51
|
+
return page;
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
|
+
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
+
import { openNavigationTarget } from '../../../lib/navigation-open.js';
|
|
4
|
+
import { resolveNavigationTarget } from '../../../lib/navigation.js';
|
|
5
|
+
export default class CredentialOpen extends AgentiaCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
id: Args.string({
|
|
8
|
+
description: 'Copado credential ID',
|
|
9
|
+
required: true,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
static description = 'Open a Copado credential in the browser';
|
|
13
|
+
static examples = [
|
|
14
|
+
'<%= config.bin %> <%= command.id %> <credential-id>',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --json',
|
|
16
|
+
];
|
|
17
|
+
async run() {
|
|
18
|
+
const { args } = await this.parse(CredentialOpen);
|
|
19
|
+
const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
|
|
20
|
+
id: args.id,
|
|
21
|
+
resourceType: 'credential',
|
|
22
|
+
}));
|
|
23
|
+
await openNavigationTarget(target, {
|
|
24
|
+
jsonEnabled: this.jsonEnabled(),
|
|
25
|
+
log: this.log.bind(this),
|
|
26
|
+
});
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=open.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
3
|
import { collectCredentialUpdateFlagKeys, credentialUpdateFlags, EnvironmentCredentialInputError, validateCredentialName, } from '../../../lib/environment-credential-flags.js';
|
|
4
|
-
import {
|
|
4
|
+
import { sanitizeCredentialListItem, updateCredentialById, } from '../../../lib/environment-credential-operations.js';
|
|
5
5
|
export default class CredentialUpdate extends AgentiaCommand {
|
|
6
6
|
static args = {
|
|
7
7
|
id: Args.string({
|
|
@@ -9,11 +9,11 @@ export default class CredentialUpdate extends AgentiaCommand {
|
|
|
9
9
|
required: true,
|
|
10
10
|
}),
|
|
11
11
|
};
|
|
12
|
-
static description = 'Update a Copado
|
|
12
|
+
static description = 'Update a Copado credential by ID';
|
|
13
13
|
static examples = [
|
|
14
|
-
'<%= config.bin %> <%= command.id %> <credential-id> --
|
|
15
|
-
'<%= config.bin %> <%= command.id %> <credential-id> --
|
|
16
|
-
'<%= config.bin %> <%= command.id %> <credential-id> --
|
|
14
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --name "CI User"',
|
|
15
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --default',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> <credential-id> --no-default --json',
|
|
17
17
|
];
|
|
18
18
|
static flags = credentialUpdateFlags;
|
|
19
19
|
async run() {
|
|
@@ -23,8 +23,8 @@ export default class CredentialUpdate extends AgentiaCommand {
|
|
|
23
23
|
this.error('Must provide at least one flag to update.', {
|
|
24
24
|
exit: 2,
|
|
25
25
|
suggestions: [
|
|
26
|
-
`${this.config.bin} cicd credential update ${args.id} --
|
|
27
|
-
`${this.config.bin} cicd credential update ${args.id} --
|
|
26
|
+
`${this.config.bin} cicd credential update ${args.id} --name <name>`,
|
|
27
|
+
`${this.config.bin} cicd credential update ${args.id} --default`,
|
|
28
28
|
],
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -33,14 +33,11 @@ export default class CredentialUpdate extends AgentiaCommand {
|
|
|
33
33
|
this.error(nameError, { exit: 2 });
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
const credential = await this.withSpinner('Updating credential', () => updateEnvironmentCredential({
|
|
36
|
+
const credential = sanitizeCredentialListItem((await this.withSpinner('Updating credential', () => updateCredentialById({
|
|
38
37
|
credentialId: args.id,
|
|
39
38
|
defaultCredential: flags.default,
|
|
40
|
-
environmentId: flags.environmentid,
|
|
41
39
|
name: flags.name,
|
|
42
|
-
|
|
43
|
-
}));
|
|
40
|
+
}))));
|
|
44
41
|
this.display(() => {
|
|
45
42
|
this.log(`Updated credential ${credential.name ?? flags.name ?? args.id} (ID: ${credential.id ?? args.id}).`);
|
|
46
43
|
});
|
|
@@ -1,36 +1,57 @@
|
|
|
1
1
|
import { Args, Flags, ux } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../../lib/agentia-command.js';
|
|
3
|
-
import { runEnvironmentAuthStatus
|
|
3
|
+
import { runEnvironmentAuthStatus } from '../../../../lib/environment-auth-status.js';
|
|
4
|
+
import { EnvironmentCredentialInputError } from '../../../../lib/environment-credential-flags.js';
|
|
4
5
|
import { formatEnvironmentAuthStatus } from '../../../../lib/environment-types.js';
|
|
5
6
|
export default class EnvironmentAuthStatus extends AgentiaCommand {
|
|
6
7
|
static args = {
|
|
7
8
|
id: Args.string({
|
|
8
|
-
description: 'Copado environment ID',
|
|
9
|
+
description: 'Copado environment ID (optional when --credentialid is provided)',
|
|
9
10
|
name: 'id',
|
|
10
|
-
required:
|
|
11
|
+
required: false,
|
|
11
12
|
}),
|
|
12
13
|
};
|
|
13
14
|
static description = 'Validate the authentication status of an environment credential';
|
|
14
15
|
static examples = [
|
|
15
16
|
'<%= config.bin %> <%= command.id %> <environment-id>',
|
|
16
|
-
'<%= config.bin %> <%= command.id %>
|
|
17
|
+
'<%= config.bin %> <%= command.id %> --credentialid <credential-id>',
|
|
17
18
|
'<%= config.bin %> <%= command.id %> <environment-id> --json',
|
|
18
19
|
];
|
|
19
20
|
static flags = {
|
|
20
21
|
credentialid: Flags.string({
|
|
21
|
-
description: 'Credential ID to validate when
|
|
22
|
+
description: 'Credential ID to validate; when set without an environment ID, resolves the environment from the credential',
|
|
22
23
|
}),
|
|
23
24
|
};
|
|
24
25
|
async run() {
|
|
25
26
|
const { args, flags } = await this.parse(EnvironmentAuthStatus);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const environmentId = args.id?.trim();
|
|
28
|
+
const credentialId = flags.credentialid?.trim();
|
|
29
|
+
if ((environmentId === undefined || environmentId.length === 0) &&
|
|
30
|
+
(credentialId === undefined || credentialId.length === 0)) {
|
|
31
|
+
this.error('Provide an environment ID or --credentialid.', {
|
|
32
|
+
exit: 2,
|
|
33
|
+
suggestions: [
|
|
34
|
+
`${this.config.bin} cicd environment auth status <environment-id>`,
|
|
35
|
+
`${this.config.bin} cicd environment auth status --credentialid <credential-id>`,
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const result = await this.withSpinner('Validating environment credential', () => runEnvironmentAuthStatus({
|
|
41
|
+
credentialId: flags.credentialid,
|
|
42
|
+
environmentId: args.id,
|
|
43
|
+
}));
|
|
44
|
+
this.display(() => {
|
|
45
|
+
this.log(formatEnvironmentAuthStatus(result, { colorize: ux.colorize }));
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof EnvironmentCredentialInputError) {
|
|
51
|
+
this.error(error.message, { exit: error.exitCode });
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
34
55
|
}
|
|
35
56
|
}
|
|
36
57
|
//# sourceMappingURL=status.js.map
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../../../lib/agentia-command.js';
|
|
3
3
|
import { DEFAULT_AUTH_TIMEOUT_SECONDS, runEnvironmentWebLogin, } from '../../../../../lib/environment-auth.js';
|
|
4
|
+
import { EnvironmentCredentialInputError } from '../../../../../lib/environment-credential-flags.js';
|
|
4
5
|
export default class EnvironmentAuthWebLogin extends AgentiaCommand {
|
|
5
6
|
static args = {
|
|
6
7
|
id: Args.string({
|
|
7
|
-
description: 'Copado environment ID',
|
|
8
|
+
description: 'Copado environment ID (optional when --credentialid is provided)',
|
|
8
9
|
name: 'id',
|
|
9
|
-
required:
|
|
10
|
+
required: false,
|
|
10
11
|
}),
|
|
11
12
|
};
|
|
12
13
|
static description = 'Authenticate an environment credential via browser web login';
|
|
13
14
|
static examples = [
|
|
14
15
|
'<%= config.bin %> <%= command.id %> <environment-id>',
|
|
15
|
-
'<%= config.bin %> <%= command.id %>
|
|
16
|
+
'<%= config.bin %> <%= command.id %> --credentialid <credential-id>',
|
|
16
17
|
'<%= config.bin %> <%= command.id %> <environment-id> --port 8085 --timeout 120',
|
|
17
18
|
'<%= config.bin %> <%= command.id %> <environment-id> --json',
|
|
18
19
|
];
|
|
19
20
|
static flags = {
|
|
20
21
|
credentialid: Flags.string({
|
|
21
|
-
description: 'Credential ID to authenticate when
|
|
22
|
+
description: 'Credential ID to authenticate; when set without an environment ID, resolves the environment from the credential',
|
|
22
23
|
}),
|
|
23
24
|
port: Flags.integer({
|
|
24
25
|
description: 'Local loopback port (default: scan 8080-8090)',
|
|
@@ -30,6 +31,18 @@ export default class EnvironmentAuthWebLogin extends AgentiaCommand {
|
|
|
30
31
|
};
|
|
31
32
|
async run() {
|
|
32
33
|
const { args, flags } = await this.parse(EnvironmentAuthWebLogin);
|
|
34
|
+
const environmentId = args.id?.trim();
|
|
35
|
+
const credentialId = flags.credentialid?.trim();
|
|
36
|
+
if ((environmentId === undefined || environmentId.length === 0) &&
|
|
37
|
+
(credentialId === undefined || credentialId.length === 0)) {
|
|
38
|
+
this.error('Provide an environment ID or --credentialid.', {
|
|
39
|
+
exit: 2,
|
|
40
|
+
suggestions: [
|
|
41
|
+
`${this.config.bin} cicd environment auth web login <environment-id>`,
|
|
42
|
+
`${this.config.bin} cicd environment auth web login --credentialid <credential-id>`,
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
}
|
|
33
46
|
try {
|
|
34
47
|
const result = await this.withSpinner('Authenticating environment credential', () => runEnvironmentWebLogin({
|
|
35
48
|
credentialId: flags.credentialid,
|
|
@@ -44,6 +57,9 @@ export default class EnvironmentAuthWebLogin extends AgentiaCommand {
|
|
|
44
57
|
return result;
|
|
45
58
|
}
|
|
46
59
|
catch (error) {
|
|
60
|
+
if (error instanceof EnvironmentCredentialInputError) {
|
|
61
|
+
this.error(error.message, { exit: error.exitCode });
|
|
62
|
+
}
|
|
47
63
|
const { exitCode } = error;
|
|
48
64
|
if (exitCode !== undefined) {
|
|
49
65
|
this.error(error.message, { exit: exitCode });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Args
|
|
1
|
+
import { Args } from '@oclif/core';
|
|
2
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
3
|
import { openNavigationTarget } from '../../../lib/navigation-open.js';
|
|
4
4
|
import { resolveNavigationTarget } from '../../../lib/navigation.js';
|
|
@@ -10,33 +10,17 @@ export default class EnvironmentOpen extends AgentiaCommand {
|
|
|
10
10
|
required: false,
|
|
11
11
|
}),
|
|
12
12
|
};
|
|
13
|
-
static description = 'Open a Copado environment
|
|
13
|
+
static description = 'Open a Copado environment in the browser';
|
|
14
14
|
static examples = [
|
|
15
15
|
'<%= config.bin %> <%= command.id %>',
|
|
16
16
|
'<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU',
|
|
17
|
-
'<%= config.bin %> <%= command.id %> --
|
|
18
|
-
'<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --credentialid <credential-id> --json',
|
|
17
|
+
'<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --json',
|
|
19
18
|
];
|
|
20
|
-
static flags = {
|
|
21
|
-
credentialid: Flags.string({
|
|
22
|
-
description: 'Credential ID to open instead of the environment record',
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
25
19
|
async run() {
|
|
26
|
-
const { args
|
|
27
|
-
const credentialId = flags.credentialid?.trim();
|
|
28
|
-
const resourceType = credentialId !== undefined && credentialId.length > 0 ? 'credential' : 'environment';
|
|
20
|
+
const { args } = await this.parse(EnvironmentOpen);
|
|
29
21
|
let resourceId;
|
|
30
22
|
try {
|
|
31
|
-
|
|
32
|
-
if (credentialId === undefined || credentialId.length === 0) {
|
|
33
|
-
this.error('Credential ID is required when opening a credential.', { exit: 2 });
|
|
34
|
-
}
|
|
35
|
-
resourceId = credentialId;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
resourceId = await resolveProjectDefaultId('environment', args.id);
|
|
39
|
-
}
|
|
23
|
+
resourceId = await resolveProjectDefaultId('environment', args.id);
|
|
40
24
|
}
|
|
41
25
|
catch (error) {
|
|
42
26
|
if (error instanceof ProjectDefaultResolutionError) {
|
|
@@ -49,7 +33,7 @@ export default class EnvironmentOpen extends AgentiaCommand {
|
|
|
49
33
|
}
|
|
50
34
|
const target = await this.withSpinner('Resolving navigation URL', () => resolveNavigationTarget({
|
|
51
35
|
id: resourceId,
|
|
52
|
-
resourceType,
|
|
36
|
+
resourceType: 'environment',
|
|
53
37
|
}));
|
|
54
38
|
await openNavigationTarget(target, {
|
|
55
39
|
jsonEnabled: this.jsonEnabled(),
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
3
|
+
import { createExtension } from '../../../lib/extension/create.js';
|
|
4
|
+
export default class ExtensionCreate extends AgentiaCommand {
|
|
5
|
+
static description = 'Create or refresh a Copado extension manifest at copado/extension_manifest.json (scans copado/functions and copado/templates)';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> <%= command.id %> --name my-extension --version 1.0.0',
|
|
8
|
+
'<%= config.bin %> <%= command.id %> --name my-extension --overwrite --json',
|
|
9
|
+
];
|
|
10
|
+
static experimental = true;
|
|
11
|
+
static flags = {
|
|
12
|
+
name: Flags.string({
|
|
13
|
+
char: 'n',
|
|
14
|
+
description: 'Extension name (alphanumeric, underscore, hyphen)',
|
|
15
|
+
required: true,
|
|
16
|
+
}),
|
|
17
|
+
overwrite: Flags.boolean({
|
|
18
|
+
description: 'Overwrite an existing extension_manifest.json',
|
|
19
|
+
default: false,
|
|
20
|
+
}),
|
|
21
|
+
version: Flags.string({
|
|
22
|
+
description: 'Initial semver version written to the manifest (X.Y.Z)',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
const { flags } = await this.parse(ExtensionCreate);
|
|
28
|
+
let result;
|
|
29
|
+
try {
|
|
30
|
+
result = await createExtension({
|
|
31
|
+
name: flags.name,
|
|
32
|
+
overwrite: flags.overwrite,
|
|
33
|
+
version: flags.version,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
this.error(error instanceof Error ? error.message : String(error), { exit: 2 });
|
|
38
|
+
}
|
|
39
|
+
this.display(() => {
|
|
40
|
+
this.log(`Created extension manifest at ${result.manifestPath}`);
|
|
41
|
+
this.log(`Name: ${result.manifest.name}`);
|
|
42
|
+
if (result.manifest.version !== undefined)
|
|
43
|
+
this.log(`Version: ${result.manifest.version}`);
|
|
44
|
+
this.log(`Functions: ${(result.manifest.functions ?? []).join(', ') || '(none)'}`);
|
|
45
|
+
this.log(`Templates: ${(result.manifest.templates ?? []).join(', ') || '(none)'}`);
|
|
46
|
+
if (result.createdDirs.length > 0) {
|
|
47
|
+
this.log(`Created directories: ${result.createdDirs.join(', ')}`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return { manifest: result.manifest, manifestPath: result.manifestPath };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=create.js.map
|