@copado/agentia-cli 1.2.0 → 1.4.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 +58 -1
- package/README.md +2299 -1615
- package/dist/commands/auth/get.js +21 -1
- package/dist/commands/auth/set.js +13 -0
- package/dist/commands/auth/unset.js +37 -0
- package/dist/commands/cicd/cloud/commit.js +6 -5
- package/dist/commands/cicd/cloud/promote.js +44 -8
- package/dist/commands/cicd/credential/auth/status.js +2 -2
- package/dist/commands/cicd/credential/auth/web/login.js +2 -2
- package/dist/commands/cicd/credential/create.js +2 -2
- package/dist/commands/cicd/credential/list.js +4 -3
- package/dist/commands/cicd/credential/open.js +2 -2
- package/dist/commands/cicd/credential/update.js +2 -2
- package/dist/commands/cicd/data/commit/create.js +2 -2
- package/dist/commands/cicd/data/commit/list.js +2 -2
- package/dist/commands/cicd/data/dataset-file/content.js +2 -2
- package/dist/commands/cicd/data/dataset-file/list.js +2 -2
- package/dist/commands/cicd/data/filter/add.js +2 -2
- package/dist/commands/cicd/data/filter/delete.js +2 -2
- package/dist/commands/cicd/data/filter/list.js +2 -2
- package/dist/commands/cicd/data/filter/update.js +2 -2
- package/dist/commands/cicd/data/formula/create.js +2 -2
- package/dist/commands/cicd/data/formula/list.js +2 -2
- package/dist/commands/cicd/data/formula/update.js +2 -2
- package/dist/commands/cicd/data/records/match.js +2 -2
- package/dist/commands/cicd/data/records/search.js +2 -2
- package/dist/commands/cicd/data/sobject/fields.js +2 -2
- package/dist/commands/cicd/data/sobject/relationships.js +2 -2
- package/dist/commands/cicd/data/sync/apply.js +2 -2
- package/dist/commands/cicd/data/sync/preview-updates.js +2 -2
- package/dist/commands/cicd/data/template/convert-old.js +2 -2
- package/dist/commands/cicd/data/template/create.js +2 -2
- package/dist/commands/cicd/data/template/delete.js +2 -2
- package/dist/commands/cicd/data/template/get-detail.js +2 -2
- package/dist/commands/cicd/data/template/get.js +2 -2
- package/dist/commands/cicd/data/template/list.js +2 -2
- package/dist/commands/cicd/data/template/open.js +2 -2
- package/dist/commands/cicd/data/template/save-detail.js +2 -2
- package/dist/commands/cicd/environment/auth/status.js +2 -2
- package/dist/commands/cicd/environment/auth/web/login.js +2 -2
- package/dist/commands/cicd/environment/create.js +2 -2
- package/dist/commands/cicd/environment/get.js +2 -2
- package/dist/commands/cicd/environment/list.js +4 -3
- package/dist/commands/cicd/environment/open.js +2 -2
- package/dist/commands/cicd/environment/update.js +2 -2
- package/dist/commands/cicd/extension/create.js +2 -2
- package/dist/commands/cicd/extension/install.js +2 -2
- package/dist/commands/cicd/extension/package.js +2 -2
- package/dist/commands/cicd/extension/publish.js +2 -2
- package/dist/commands/cicd/extension/uninstall.js +2 -2
- package/dist/commands/cicd/extension/validate.js +2 -2
- package/dist/commands/cicd/extension-configuration/get.js +2 -2
- package/dist/commands/cicd/extension-configuration/list.js +4 -3
- package/dist/commands/cicd/extension-configuration/open.js +2 -2
- package/dist/commands/cicd/function/defaults.js +2 -2
- package/dist/commands/cicd/function/delete.js +2 -2
- package/dist/commands/cicd/function/get.js +2 -2
- package/dist/commands/cicd/function/list.js +12 -15
- package/dist/commands/cicd/function/open.js +2 -2
- package/dist/commands/cicd/function/result/get.js +2 -2
- package/dist/commands/cicd/function/result/log/get.js +2 -2
- package/dist/commands/cicd/function/run-local.js +2 -2
- package/dist/commands/cicd/function/run.js +2 -2
- package/dist/commands/cicd/function/upsert.js +2 -2
- package/dist/commands/cicd/health-check.js +2 -2
- package/dist/commands/cicd/job/get.js +2 -2
- package/dist/commands/cicd/job/kill.js +2 -2
- package/dist/commands/cicd/job/list.js +4 -3
- package/dist/commands/cicd/job/log/get.js +2 -2
- package/dist/commands/cicd/job/open.js +2 -2
- package/dist/commands/cicd/job/pause.js +2 -2
- package/dist/commands/cicd/job/result-file/get.js +13 -8
- package/dist/commands/cicd/job/result-file/list.js +2 -2
- package/dist/commands/cicd/job/resume.js +2 -2
- package/dist/commands/cicd/job/run.js +2 -2
- package/dist/commands/cicd/metadata/content/compare.js +2 -2
- package/dist/commands/cicd/metadata/content/get.js +2 -2
- package/dist/commands/cicd/metadata/dependency/list.js +44 -21
- package/dist/commands/cicd/metadata/explore.js +2 -2
- package/dist/commands/cicd/metadata/index/compare.js +2 -2
- package/dist/commands/cicd/metadata/list.js +2 -2
- package/dist/commands/cicd/metadata/refresh/deleted.js +2 -2
- package/dist/commands/cicd/metadata/refresh/run.js +2 -2
- package/dist/commands/cicd/metadata/refresh/status.js +2 -2
- package/dist/commands/cicd/notification/configure.js +2 -2
- package/dist/commands/cicd/notification/get.js +2 -2
- package/dist/commands/cicd/pipeline/automation/activate.js +2 -2
- package/dist/commands/cicd/pipeline/automation/create.js +2 -2
- package/dist/commands/cicd/pipeline/automation/deactivate.js +2 -2
- package/dist/commands/cicd/pipeline/automation/delete.js +2 -2
- package/dist/commands/cicd/pipeline/automation/get.js +2 -2
- package/dist/commands/cicd/pipeline/automation/list.js +4 -3
- package/dist/commands/cicd/pipeline/automation/open.js +2 -2
- package/dist/commands/cicd/pipeline/automation/update.js +2 -2
- package/dist/commands/cicd/pipeline/connection/create.js +2 -2
- package/dist/commands/cicd/pipeline/connection/delete.js +2 -2
- package/dist/commands/cicd/pipeline/connection/list.js +2 -2
- package/dist/commands/cicd/pipeline/connection/open.js +2 -2
- package/dist/commands/cicd/pipeline/connection/update.js +2 -2
- package/dist/commands/cicd/pipeline/create.js +2 -2
- package/dist/commands/cicd/pipeline/get.js +2 -2
- package/dist/commands/cicd/pipeline/list.js +4 -3
- package/dist/commands/cicd/pipeline/open.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/activate.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/create.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/deactivate.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/delete.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/get.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/list.js +4 -3
- package/dist/commands/cicd/pipeline/quality-gate/open.js +2 -2
- package/dist/commands/cicd/pipeline/quality-gate/update.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/create.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/delete.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/list.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/open.js +2 -2
- package/dist/commands/cicd/pipeline/stage-connection/update.js +2 -2
- package/dist/commands/cicd/pipeline/update.js +2 -2
- package/dist/commands/cicd/project/create.js +2 -2
- package/dist/commands/cicd/project/default/get.js +2 -2
- package/dist/commands/cicd/project/default/set.js +2 -2
- package/dist/commands/cicd/project/default/unset.js +2 -2
- package/dist/commands/cicd/project/delete.js +2 -2
- package/dist/commands/cicd/project/get.js +2 -2
- package/dist/commands/cicd/project/list.js +4 -3
- package/dist/commands/cicd/project/open.js +2 -2
- package/dist/commands/cicd/project/update.js +2 -2
- package/dist/commands/cicd/promotion/conflict/get.js +2 -2
- package/dist/commands/cicd/promotion/conflict/list.js +2 -2
- package/dist/commands/cicd/promotion/conflict/resolve.js +2 -2
- package/dist/commands/cicd/promotion/conflict/unresolve.js +2 -2
- package/dist/commands/cicd/promotion/get.js +2 -2
- package/dist/commands/cicd/promotion/job-step/update.js +2 -2
- package/dist/commands/cicd/promotion/list.js +4 -3
- package/dist/commands/cicd/promotion/open.js +2 -2
- package/dist/commands/cicd/promotion/queue/list.js +28 -0
- package/dist/commands/cicd/promotion/queue/remove.js +37 -0
- package/dist/commands/cicd/promotion/run.js +2 -2
- package/dist/commands/cicd/promotion/status.js +29 -0
- package/dist/commands/cicd/repository/auth/https/configure.js +2 -2
- package/dist/commands/cicd/repository/auth/oauth/login.js +2 -2
- package/dist/commands/cicd/repository/auth/setup.js +2 -2
- package/dist/commands/cicd/repository/auth/ssh/configure.js +2 -2
- package/dist/commands/cicd/repository/create.js +2 -2
- package/dist/commands/cicd/repository/delete.js +2 -2
- package/dist/commands/cicd/repository/get.js +2 -2
- package/dist/commands/cicd/repository/list.js +7 -10
- package/dist/commands/cicd/repository/open.js +2 -2
- package/dist/commands/cicd/repository/reset.js +2 -2
- package/dist/commands/cicd/repository/update.js +2 -2
- package/dist/commands/cicd/repository/validate.js +2 -2
- package/dist/commands/cicd/stage/create.js +2 -2
- package/dist/commands/cicd/stage/delete.js +2 -2
- package/dist/commands/cicd/stage/get.js +2 -2
- package/dist/commands/cicd/stage/list.js +4 -3
- package/dist/commands/cicd/stage/open.js +2 -2
- package/dist/commands/cicd/stage/update.js +2 -2
- package/dist/commands/cicd/template/defaults.js +2 -2
- package/dist/commands/cicd/template/delete.js +2 -2
- package/dist/commands/cicd/template/get.js +2 -2
- package/dist/commands/cicd/template/list.js +11 -14
- package/dist/commands/cicd/template/upsert.js +2 -2
- package/dist/commands/cicd/user/get.js +2 -2
- package/dist/commands/cicd/work/ahead-behind.js +2 -2
- package/dist/commands/cicd/work/create.js +2 -2
- package/dist/commands/cicd/work/delete.js +4 -4
- package/dist/commands/cicd/work/deployment-step/create.js +2 -2
- package/dist/commands/cicd/work/deployment-step/delete.js +2 -2
- package/dist/commands/cicd/work/deployment-step/list.js +2 -2
- package/dist/commands/cicd/work/deployment-step/reorder.js +2 -2
- package/dist/commands/cicd/work/deployment-step/salesforce-flows.js +2 -2
- package/dist/commands/cicd/work/deployment-step/types.js +2 -2
- package/dist/commands/cicd/work/deployment-step/update.js +2 -2
- package/dist/commands/cicd/work/done.js +2 -2
- package/dist/commands/cicd/work/environment-sync.js +140 -64
- package/dist/commands/cicd/work/get.js +4 -4
- package/dist/commands/cicd/work/list.js +4 -3
- package/dist/commands/cicd/work/open.js +2 -2
- package/dist/commands/cicd/work/promote.js +2 -2
- package/dist/commands/cicd/work/publish.js +2 -2
- package/dist/commands/cicd/work/push.js +2 -2
- package/dist/commands/cicd/work/set.js +2 -2
- package/dist/commands/cicd/work/status.js +2 -2
- package/dist/commands/cicd/work/submit.js +2 -2
- package/dist/commands/cicd/work/test/apex.js +20 -35
- package/dist/commands/cicd/work/test.js +116 -11
- package/dist/commands/cicd/work/update.js +4 -4
- package/dist/commands/help-agent.js +15 -0
- package/dist/commands/help.js +38 -0
- package/dist/commands/history/clear.js +42 -0
- package/dist/commands/history/list.js +50 -0
- package/dist/commands/support.js +15 -0
- package/dist/commands/testing/browser/execute.js +49 -0
- package/dist/commands/testing/browser/history.js +49 -0
- package/dist/commands/testing/browser/inspect.js +35 -0
- package/dist/commands/testing/browser/recorder.js +52 -0
- package/dist/commands/testing/browser/screenshot.js +27 -0
- package/dist/commands/testing/browser/set-options.js +35 -0
- package/dist/commands/testing/browser/start.js +51 -0
- package/dist/commands/testing/browser/status.js +26 -0
- package/dist/commands/testing/browser/stop.js +34 -0
- package/dist/commands/testing/browser/view.js +35 -0
- package/dist/commands/testing/job/runs/abort.js +1 -1
- package/dist/commands/testing/job/runs/get.js +1 -1
- package/dist/commands/testing/job/runs/list.js +1 -1
- package/dist/commands/testing/job/runs/logs.js +1 -1
- package/dist/commands/testing/job/runs/search.js +1 -1
- package/dist/hooks/init/cicd-connection.js +59 -0
- package/dist/lib/agentia-command.js +69 -6
- package/dist/lib/cicd-command.js +3 -0
- package/dist/lib/cicd-connection.js +22 -0
- package/dist/lib/cicd-gateway.js +2 -1
- package/dist/lib/command-history-sanitization.js +9 -0
- package/dist/lib/command-history.js +11 -0
- package/dist/lib/command-output-buffer.js +6 -1
- package/dist/lib/defaults-store.js +5 -1
- package/dist/lib/dependency-from-changes.js +3 -1
- package/dist/lib/dependency-source-context.js +3 -0
- package/dist/lib/function-list.js +3 -0
- package/dist/lib/git-worktree.js +4 -1
- package/dist/lib/help-agent-command.js +3 -0
- package/dist/lib/help-agent-interaction-history.js +10 -0
- package/dist/lib/help-agent-session.js +3 -0
- package/dist/lib/job-get.js +2 -1
- package/dist/lib/job-types.js +2 -1
- package/dist/lib/list-pagination.js +6 -1
- package/dist/lib/local-quality-gates.js +4 -1
- package/dist/lib/mcp/result.js +41 -3
- package/dist/lib/mcp/server.js +3 -2
- package/dist/lib/mcp/testing-browser-tools.js +179 -0
- package/dist/lib/mcp/testing-tools.js +4 -3
- package/dist/lib/mcp/tool-annotations.js +31 -12
- package/dist/lib/mcp/tools.js +115 -59
- package/dist/lib/mcp/work-tools.js +100 -47
- package/dist/lib/promotion-queue.js +5 -0
- package/dist/lib/promotion-run.js +4 -1
- package/dist/lib/promotion-status.js +12 -0
- package/dist/lib/quality-gates.js +13 -0
- package/dist/lib/repository-list.js +3 -0
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/stock-quality-gates.js +2 -1
- package/dist/lib/support-ai-context.js +11 -0
- package/dist/lib/support-ai-stream-parser.js +4 -0
- package/dist/lib/support-ai.js +9 -0
- package/dist/lib/template-list.js +3 -0
- package/dist/lib/testing-browser-command.js +6 -0
- package/dist/lib/testing-browser-operations.js +16 -0
- package/dist/lib/testing-browser-requests.js +11 -0
- package/dist/lib/testing-browser-robot.js +9 -0
- package/dist/lib/testing-browser-session.js +13 -0
- package/dist/lib/testing-browser-state.js +17 -0
- package/dist/lib/testing-browser-stream.js +7 -0
- package/dist/lib/testing-browser-types.js +3 -0
- package/dist/lib/testing-browser-viewer-key.js +7 -0
- package/dist/lib/testing-gateway.js +2 -1
- package/dist/lib/testing-operations.js +21 -1
- package/dist/lib/testing-sanitization.js +2 -1
- package/dist/lib/work-apex-test-failures.js +2 -1
- package/dist/lib/work-environment-sync-ready.js +7 -1
- package/dist/lib/work-environment-sync.js +8 -1
- package/dist/lib/work-local-run-tests.js +2 -1
- package/dist/lib/work-promote-deploy.js +3 -1
- package/dist/lib/work-promote.js +2 -1
- package/dist/lib/work-types.js +3 -1
- package/oclif.manifest.json +3544 -1828
- package/package.json +11 -4
- package/templates/skills/agentia-ai/SKILL.md +6 -2
- package/templates/skills/agentia-ai/references/ai-agents.md +19 -1
- package/templates/skills/agentia-cicd/SKILL.md +6 -5
- package/templates/skills/agentia-cicd/references/environments-and-credentials.md +16 -0
- package/templates/skills/agentia-cicd/references/jobs.md +3 -2
- package/templates/skills/agentia-cicd/references/promotions.md +26 -5
- package/templates/skills/agentia-cicd/references/work.md +25 -11
- package/templates/skills/agentia-metadata/SKILL.md +9 -3
- package/templates/skills/agentia-metadata/references/metadata-dependency.md +70 -0
- package/templates/skills/agentia-metadata/references/metadata-explore.md +8 -4
- package/templates/skills/agentia-testing/SKILL.md +9 -4
- package/templates/skills/agentia-testing/references/browser-testing.md +92 -0
- package/templates/skills/agentia-testing/references/flow-automation.md +112 -0
- package/templates/skills/agentia-testing/references/qforce.md +88 -0
- package/templates/skills/agentia-testing/references/qweb.md +103 -0
- package/templates/skills/agentia-testing/references/tests.md +17 -9
- package/vendor/java/var-replace-command.jar +0 -0
- package/dist/commands/testing/live/continue.js +0 -16
- package/dist/commands/testing/live/execute.js +0 -43
- package/dist/commands/testing/live/history.js +0 -40
- package/dist/commands/testing/live/inspect.js +0 -31
- package/dist/commands/testing/live/interrupt.js +0 -16
- package/dist/commands/testing/live/recorder.js +0 -42
- package/dist/commands/testing/live/reports.js +0 -31
- package/dist/commands/testing/live/screenshot.js +0 -25
- package/dist/commands/testing/live/set-options.js +0 -35
- package/dist/commands/testing/live/start.js +0 -58
- package/dist/commands/testing/live/status.js +0 -24
- package/dist/commands/testing/live/stop.js +0 -36
- package/dist/commands/testing/live/view.js +0 -36
- package/dist/lib/mcp/testing-live-tools.js +0 -226
- package/dist/lib/testing-live-command.js +0 -8
- package/dist/lib/testing-live-operations.js +0 -25
- package/dist/lib/testing-live-recorder.js +0 -11
- package/dist/lib/testing-live-robot.js +0 -9
- package/dist/lib/testing-live-state.js +0 -12
- package/dist/lib/testing-live-types.js +0 -3
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
3
3
|
import { commandStdioCaptureOptions, withCapturedCommandOutput } from '../../../lib/command-output-buffer.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { isPromotionRunExecutionError, PROMOTION_RUN_DEFAULT_TIMEOUT_SECONDS, promotionRunErrorJson, waitForPromotionDeploymentExecution, } from '../../../lib/promotion-run.js';
|
|
5
|
+
import { assertEnvironmentSyncDestOrgSelector, ENVIRONMENT_SYNC_DEPLOYMENT_WAIT_MESSAGE, ENVIRONMENT_SYNC_DEPLOYMENTS, formatWorkEnvironmentSyncDeploymentMonitor, formatWorkEnvironmentSyncResult, performWorkEnvironmentSync, shouldWaitForEnvironmentSyncDeployment, WorkEnvironmentSyncConflictError, WorkEnvironmentSyncValidationError, } from '../../../lib/work-environment-sync.js';
|
|
6
|
+
export default class WorkEnvironmentSync extends CicdCommand {
|
|
6
7
|
static description = [
|
|
7
8
|
'Sync committed metadata from the next environment onto the destination environment (or current feature branch).',
|
|
8
9
|
'Back-promotes every user story behind the destination environment from the next environment branch.',
|
|
9
|
-
'
|
|
10
|
+
'On a feature branch, requires published commits first: stops when HEAD is ahead of origin/<feature> and suggests `cicd work publish`.',
|
|
11
|
+
'GET user stories ahead and behind. If none are behind, log that and stop. Otherwise create a back-promotion via POST /agentia/headless/work/promote-action (PromoteAction with execute flags false) including those behind stories.',
|
|
10
12
|
'Resolves the next-environment Git branch from --destination-environment or --dev-org-branch (the dest pipeline connection destinationBranch, or that destination environment\'s outbound branch).',
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'If guessed pathspecs still conflict, PATCH the back-promotion status to Merge Conflict, store lastEnvironmentSyncName, resolve the files
|
|
14
|
-
'To discard a conflicted merge, re-run with --abort (optional --promotion); runs git merge --abort and
|
|
15
|
-
'After a successful sync,
|
|
13
|
+
'Creates promotion/<promotionName> from the dest org branch, merges origin/<next-env> pathspecs into that promotion branch (--no-ff --no-commit, restores non-pathspec paths), commits, merges the promotion branch into the dest org branch, and pushes both refs.',
|
|
14
|
+
'If the run started on a feature branch, checks out that branch\'s changed files (vs lastBaseBranch) from the dest org, commits updates when needed, and tells you to re-check and publish again.',
|
|
15
|
+
'If guessed pathspecs still conflict, PATCH the back-promotion status to Merge Conflict, store lastEnvironmentSyncName, resolve the files on promotion/<name>, and re-run with --continue (optional --promotion).',
|
|
16
|
+
'To discard a conflicted merge, re-run with --abort (optional --promotion); runs git merge --abort and POST /agentia/headless/work/promote-action/complete with status Cancelled.',
|
|
17
|
+
'After a successful sync, when --deployment resolves to local, runs `sf project deploy start --ignore-conflicts` against --sf-alias (Add-only changes), then POST /agentia/headless/work/promote-action/complete with status Completed and the resolved deployment (none|local|cloud; auto chooses local when every change is Add and --sf-alias is set, otherwise cloud).',
|
|
18
|
+
'By default polls the cloud deployment JobExecution to a terminal status when deployment is cloud (--no-wait to skip).',
|
|
16
19
|
'On git/merge failure (including conflicts) and after a successful --continue, uploads the captured command transcript as a Salesforce File on the back-promotion (`Environment Sync Logs <name-or-id> <datetime>.txt`) via `/agentia/headless/file/upload`. HTTP 404 is ignored until that endpoint is rolled out; other upload failures are warned and do not change the environment-sync outcome.',
|
|
17
20
|
].join(' ');
|
|
18
21
|
static examples = [
|
|
@@ -21,12 +24,16 @@ export default class WorkEnvironmentSync extends AgentiaCommand {
|
|
|
21
24
|
'<%= config.bin %> <%= command.id %> --continue',
|
|
22
25
|
'<%= config.bin %> <%= command.id %> --abort',
|
|
23
26
|
'<%= config.bin %> <%= command.id %> --promotion=P29334 --continue',
|
|
27
|
+
'<%= config.bin %> <%= command.id %> --destination-environment=dev1 --deployment=local --sf-alias=dev1',
|
|
28
|
+
'<%= config.bin %> <%= command.id %> --destination-environment=dev1 --deployment=cloud',
|
|
29
|
+
'<%= config.bin %> <%= command.id %> --destination-environment=dev1 --no-wait',
|
|
24
30
|
'<%= config.bin %> <%= command.id %> --destination-environment=dev1 --json',
|
|
25
31
|
];
|
|
32
|
+
static experimental = true;
|
|
26
33
|
static flags = {
|
|
27
34
|
abort: Flags.boolean({
|
|
28
35
|
default: false,
|
|
29
|
-
description: 'Abort an in-progress merge (`git merge --abort`) and
|
|
36
|
+
description: 'Abort an in-progress merge (`git merge --abort`) and cancel the back-promotion via promote-action/complete. Uses --promotion or lastEnvironmentSyncName. Exclusive with --continue.',
|
|
30
37
|
exclusive: ['continue'],
|
|
31
38
|
}),
|
|
32
39
|
continue: Flags.boolean({
|
|
@@ -34,8 +41,13 @@ export default class WorkEnvironmentSync extends AgentiaCommand {
|
|
|
34
41
|
description: 'Finish after merge conflicts. If the merge is still in progress (conflicts fixed and staged, but not committed), commits it; if you already committed, continues from there through the remaining git steps. Uses --promotion or lastEnvironmentSyncName.',
|
|
35
42
|
exclusive: ['abort'],
|
|
36
43
|
}),
|
|
44
|
+
deployment: Flags.string({
|
|
45
|
+
default: 'auto',
|
|
46
|
+
description: 'How promote-action/complete handles deployment after a successful sync: none (leave deployment job untouched), local (sf project deploy start --ignore-conflicts then mark deployment JobExecution Successful; Add-only changes; requires --sf-alias), cloud (start PromotionDeployAction), or auto (local when every change is Add and --sf-alias is set, otherwise cloud). Sent to the gateway as none|local|cloud (never auto).',
|
|
47
|
+
options: [...ENVIRONMENT_SYNC_DEPLOYMENTS],
|
|
48
|
+
}),
|
|
37
49
|
'destination-credential': Flags.string({
|
|
38
|
-
description: 'Credential ID
|
|
50
|
+
description: 'Credential ID recorded on the environment-sync result as destinationCredentialId. Defaults to the next/source environment defaultCredential, otherwise the first source credential. PromoteAction resolves deployment credentials itself.',
|
|
39
51
|
}),
|
|
40
52
|
'destination-environment': Flags.string({
|
|
41
53
|
description: 'Destination org environment name or Id. Resolves to that environment\'s pipeline connection Git branch.',
|
|
@@ -51,42 +63,29 @@ export default class WorkEnvironmentSync extends AgentiaCommand {
|
|
|
51
63
|
promotion: Flags.string({
|
|
52
64
|
description: 'Back-promotion Id or name to PATCH when this run stops on merge conflicts, finishes successfully, continues, or aborts. Optional for --continue/--abort when lastEnvironmentSyncName was stored from a prior environment-sync run. Defaults to the back-promotion created in this run.',
|
|
53
65
|
}),
|
|
66
|
+
'sf-alias': Flags.string({
|
|
67
|
+
description: 'Salesforce CLI org alias or username for local deployment (`sf project deploy start -o`). Required with --deployment=local; with --deployment=auto enables local when changes are Add-only.',
|
|
68
|
+
}),
|
|
69
|
+
wait: Flags.boolean({
|
|
70
|
+
allowNo: true,
|
|
71
|
+
default: true,
|
|
72
|
+
description: 'Poll promotion and deployment executions to terminal status.',
|
|
73
|
+
}),
|
|
74
|
+
'wait-timeout': Flags.integer({
|
|
75
|
+
default: PROMOTION_RUN_DEFAULT_TIMEOUT_SECONDS,
|
|
76
|
+
description: 'Maximum total seconds to wait for promotion and deployment executions.',
|
|
77
|
+
}),
|
|
54
78
|
};
|
|
55
79
|
async run() {
|
|
56
80
|
const { flags } = await this.parse(WorkEnvironmentSync);
|
|
81
|
+
const syncFlags = flags;
|
|
82
|
+
if (!Number.isInteger(syncFlags['wait-timeout']) || syncFlags['wait-timeout'] <= 0) {
|
|
83
|
+
this.error('--wait-timeout must be a positive integer.', { exit: 2 });
|
|
84
|
+
}
|
|
57
85
|
return withCapturedCommandOutput(async () => {
|
|
58
86
|
const startedAt = Date.now();
|
|
59
87
|
try {
|
|
60
|
-
await
|
|
61
|
-
abort: flags.abort === true,
|
|
62
|
-
continue: flags.continue === true,
|
|
63
|
-
destinationEnvironment: flags['destination-environment'],
|
|
64
|
-
devOrgBranch: flags['dev-org-branch'],
|
|
65
|
-
promotion: flags.promotion,
|
|
66
|
-
});
|
|
67
|
-
const result = await performWorkEnvironmentSync({
|
|
68
|
-
abort: flags.abort === true,
|
|
69
|
-
cliBin: this.config.bin,
|
|
70
|
-
continue: flags.continue === true,
|
|
71
|
-
hooks: {
|
|
72
|
-
log: (message) => {
|
|
73
|
-
this.display(() => {
|
|
74
|
-
this.log(message);
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
withSpinner: (message, action) => this.withSpinner(message, action),
|
|
78
|
-
},
|
|
79
|
-
json: this.jsonEnabled(),
|
|
80
|
-
...(flags['destination-credential'] === undefined
|
|
81
|
-
? {}
|
|
82
|
-
: { destinationCredentialId: flags['destination-credential'] }),
|
|
83
|
-
...(flags['destination-environment'] === undefined
|
|
84
|
-
? {}
|
|
85
|
-
: { destinationEnvironment: flags['destination-environment'] }),
|
|
86
|
-
...(flags['dev-org-branch'] === undefined ? {} : { devOrgBranch: flags['dev-org-branch'] }),
|
|
87
|
-
...(flags['pipeline-id'] === undefined ? {} : { pipelineId: flags['pipeline-id'] }),
|
|
88
|
-
...(flags.promotion === undefined ? {} : { promotion: flags.promotion }),
|
|
89
|
-
});
|
|
88
|
+
const result = await this.runEnvironmentSync(syncFlags);
|
|
90
89
|
this.display(() => {
|
|
91
90
|
const formatted = formatWorkEnvironmentSyncResult(result);
|
|
92
91
|
if (formatted.length > 0) {
|
|
@@ -94,34 +93,111 @@ export default class WorkEnvironmentSync extends AgentiaCommand {
|
|
|
94
93
|
}
|
|
95
94
|
});
|
|
96
95
|
this.logElapsed(startedAt);
|
|
96
|
+
await this.waitForDeploymentIfNeeded(result, syncFlags, startedAt);
|
|
97
97
|
return result;
|
|
98
98
|
}
|
|
99
99
|
catch (error) {
|
|
100
|
-
|
|
101
|
-
const { suggestions } = error;
|
|
102
|
-
const suggestionOptions = suggestions === undefined ? {} : { suggestions };
|
|
103
|
-
if (this.jsonEnabled()) {
|
|
104
|
-
const message = error.gitStatus === undefined || error.gitStatus.length === 0
|
|
105
|
-
? error.message
|
|
106
|
-
: `${error.message}\n\n${error.gitStatus}`;
|
|
107
|
-
this.error(message, { exit: error.exit, ...suggestionOptions });
|
|
108
|
-
}
|
|
109
|
-
this.error(error.message, { exit: false, ...suggestionOptions });
|
|
110
|
-
if (error.gitStatus !== undefined && error.gitStatus.length > 0) {
|
|
111
|
-
this.log('');
|
|
112
|
-
this.log(error.gitStatus);
|
|
113
|
-
}
|
|
114
|
-
this.exit(error.exit);
|
|
115
|
-
}
|
|
116
|
-
if (error instanceof WorkEnvironmentSyncValidationError) {
|
|
117
|
-
this.error(error.message, {
|
|
118
|
-
exit: error.exit,
|
|
119
|
-
...(error.suggestions === undefined ? {} : { suggestions: error.suggestions }),
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
throw error;
|
|
100
|
+
this.handleEnvironmentSyncError(error);
|
|
123
101
|
}
|
|
124
102
|
}, commandStdioCaptureOptions(this));
|
|
125
103
|
}
|
|
104
|
+
toErrorJson(err) {
|
|
105
|
+
const base = super.toErrorJson(err);
|
|
106
|
+
return promotionRunErrorJson(base, err);
|
|
107
|
+
}
|
|
108
|
+
handleEnvironmentSyncError(error) {
|
|
109
|
+
if (error instanceof WorkEnvironmentSyncConflictError) {
|
|
110
|
+
const { suggestions } = error;
|
|
111
|
+
const suggestionOptions = suggestions === undefined ? {} : { suggestions };
|
|
112
|
+
if (this.jsonEnabled()) {
|
|
113
|
+
const message = error.gitStatus === undefined || error.gitStatus.length === 0
|
|
114
|
+
? error.message
|
|
115
|
+
: `${error.message}\n\n${error.gitStatus}`;
|
|
116
|
+
this.error(message, { exit: error.exit, ...suggestionOptions });
|
|
117
|
+
}
|
|
118
|
+
this.error(error.message, { exit: false, ...suggestionOptions });
|
|
119
|
+
if (error.gitStatus !== undefined && error.gitStatus.length > 0) {
|
|
120
|
+
this.log('');
|
|
121
|
+
this.log(error.gitStatus);
|
|
122
|
+
}
|
|
123
|
+
this.exit(error.exit);
|
|
124
|
+
}
|
|
125
|
+
if (error instanceof WorkEnvironmentSyncValidationError) {
|
|
126
|
+
this.error(error.message, {
|
|
127
|
+
exit: error.exit,
|
|
128
|
+
...(error.suggestions === undefined ? {} : { suggestions: error.suggestions }),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
async runEnvironmentSync(syncFlags) {
|
|
134
|
+
await assertEnvironmentSyncDestOrgSelector({
|
|
135
|
+
abort: syncFlags.abort === true,
|
|
136
|
+
continue: syncFlags.continue === true,
|
|
137
|
+
destinationEnvironment: syncFlags['destination-environment'],
|
|
138
|
+
devOrgBranch: syncFlags['dev-org-branch'],
|
|
139
|
+
promotion: syncFlags.promotion,
|
|
140
|
+
});
|
|
141
|
+
return performWorkEnvironmentSync({
|
|
142
|
+
abort: syncFlags.abort === true,
|
|
143
|
+
cliBin: this.config.bin,
|
|
144
|
+
continue: syncFlags.continue === true,
|
|
145
|
+
deployment: syncFlags.deployment,
|
|
146
|
+
hooks: {
|
|
147
|
+
log: (message) => {
|
|
148
|
+
this.display(() => {
|
|
149
|
+
this.log(message);
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
withSpinner: (message, action) => this.withSpinner(message, action),
|
|
153
|
+
},
|
|
154
|
+
json: this.jsonEnabled(),
|
|
155
|
+
...(syncFlags['destination-credential'] === undefined
|
|
156
|
+
? {}
|
|
157
|
+
: { destinationCredentialId: syncFlags['destination-credential'] }),
|
|
158
|
+
...(syncFlags['destination-environment'] === undefined
|
|
159
|
+
? {}
|
|
160
|
+
: { destinationEnvironment: syncFlags['destination-environment'] }),
|
|
161
|
+
...(syncFlags['dev-org-branch'] === undefined ? {} : { devOrgBranch: syncFlags['dev-org-branch'] }),
|
|
162
|
+
...(syncFlags['pipeline-id'] === undefined ? {} : { pipelineId: syncFlags['pipeline-id'] }),
|
|
163
|
+
...(syncFlags.promotion === undefined ? {} : { promotion: syncFlags.promotion }),
|
|
164
|
+
...(syncFlags['sf-alias'] === undefined ? {} : { sfAlias: syncFlags['sf-alias'] }),
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
async waitForDeploymentIfNeeded(result, syncFlags, startedAt) {
|
|
168
|
+
if (!syncFlags.wait || !shouldWaitForEnvironmentSyncDeployment(result) || result.promotion?.id === undefined) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
this.display(() => {
|
|
172
|
+
this.log(ENVIRONMENT_SYNC_DEPLOYMENT_WAIT_MESSAGE);
|
|
173
|
+
});
|
|
174
|
+
try {
|
|
175
|
+
const deploymentJobMonitor = await this.withSpinner('Waiting for deployment execution', () => waitForPromotionDeploymentExecution({
|
|
176
|
+
hooks: {
|
|
177
|
+
log: (message) => {
|
|
178
|
+
this.display(() => {
|
|
179
|
+
this.log(message);
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
withSpinner: (message, action) => this.withSpinner(message, action),
|
|
183
|
+
},
|
|
184
|
+
promotionId: result.promotion.id,
|
|
185
|
+
timeoutSeconds: syncFlags['wait-timeout'],
|
|
186
|
+
}));
|
|
187
|
+
result.deploymentJobMonitor = deploymentJobMonitor;
|
|
188
|
+
result.wait = true;
|
|
189
|
+
this.display(() => {
|
|
190
|
+
this.log(formatWorkEnvironmentSyncDeploymentMonitor(deploymentJobMonitor));
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
if (isPromotionRunExecutionError(error)) {
|
|
195
|
+
;
|
|
196
|
+
error.oclif = { exit: 1 };
|
|
197
|
+
}
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
this.logElapsed(startedAt);
|
|
201
|
+
}
|
|
126
202
|
}
|
|
127
203
|
//# sourceMappingURL=environment-sync.js.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
3
3
|
import { WorkActiveResolutionError } from '../../../lib/work-active.js';
|
|
4
4
|
import { formatCommittedMetadataSection, } from '../../../lib/work-committed-metadata.js';
|
|
5
5
|
import { fetchWorkItemWithOptions } from '../../../lib/work-get.js';
|
|
6
6
|
import { formatUserStoriesAheadBehindLines, reportUserStoriesAheadBehindForStory, } from '../../../lib/work-submit-ahead-behind.js';
|
|
7
7
|
import { formatUserStoryDetail, } from '../../../lib/work-types.js';
|
|
8
|
-
export default class WorkGet extends
|
|
8
|
+
export default class WorkGet extends CicdCommand {
|
|
9
9
|
static args = {
|
|
10
10
|
id: Args.string({
|
|
11
|
-
description: 'User story ID (defaults to the active work item from `work set`)',
|
|
11
|
+
description: 'User story ID or name (defaults to the active work item from `work set`)',
|
|
12
12
|
required: false,
|
|
13
13
|
}),
|
|
14
14
|
};
|
|
15
|
-
static description = 'Get a Copado user story by ID';
|
|
15
|
+
static description = 'Get a Copado user story by ID or name';
|
|
16
16
|
static examples = [
|
|
17
17
|
'<%= config.bin %> <%= command.id %>',
|
|
18
18
|
'<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { displayListPagination } from '../../../lib/list-pagination.js';
|
|
1
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
2
|
+
import { displayListPagination, emitPaginatedListWarnings } from '../../../lib/list-pagination.js';
|
|
3
3
|
import { getUserContext } from '../../../lib/user-context.js';
|
|
4
4
|
import { buildWorkListFilters, workListFilterFlags } from '../../../lib/work-flags.js';
|
|
5
5
|
import { fetchWorkItems } from '../../../lib/work-get.js';
|
|
6
6
|
import { formatUserStoryTable } from '../../../lib/work-types.js';
|
|
7
|
-
export default class WorkList extends
|
|
7
|
+
export default class WorkList extends CicdCommand {
|
|
8
8
|
static description = 'List Copado user stories';
|
|
9
9
|
static examples = [
|
|
10
10
|
'<%= config.bin %> <%= command.id %>',
|
|
@@ -42,6 +42,7 @@ export default class WorkList extends AgentiaCommand {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const page = await this.withSpinner('Fetching user stories', () => fetchWorkItems(filters));
|
|
45
|
+
emitPaginatedListWarnings(this.warn.bind(this), page);
|
|
45
46
|
this.display(() => {
|
|
46
47
|
if (page.data.length === 0) {
|
|
47
48
|
this.log('No user stories found.');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Args } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
3
3
|
import { openNavigationTarget } from '../../../lib/navigation-open.js';
|
|
4
4
|
import { resolveNavigationTarget } from '../../../lib/navigation.js';
|
|
5
5
|
import { resolveWorkItemId, WorkActiveResolutionError } from '../../../lib/work-active.js';
|
|
6
|
-
export default class WorkOpen extends
|
|
6
|
+
export default class WorkOpen extends CicdCommand {
|
|
7
7
|
static args = {
|
|
8
8
|
id: Args.string({
|
|
9
9
|
description: 'User story ID (defaults to the active work item from `work set`)',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
3
3
|
import { collectPromoteUserStoryIds, formatWorkPromoteResult, performWorkPromote, WorkPromoteConflictError, WorkPromoteValidationError, } from '../../../lib/work-promote.js';
|
|
4
|
-
export default class WorkPromote extends
|
|
4
|
+
export default class WorkPromote extends CicdCommand {
|
|
5
5
|
static args = {
|
|
6
6
|
userStoryIds: Args.string({
|
|
7
7
|
description: 'User story ID. Pass more than one to merge those feature branches in order. Omit when using --promotion with --continue or --abort.',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
2
2
|
import { commandStdioCaptureOptions, withCapturedCommandOutput } from '../../../lib/command-output-buffer.js';
|
|
3
3
|
import { runWorkPublish, WORK_PUBLISH_DESCRIPTION, workPublishFlags, } from '../../../lib/work-publish-command.js';
|
|
4
|
-
export default class WorkPublish extends
|
|
4
|
+
export default class WorkPublish extends CicdCommand {
|
|
5
5
|
static description = WORK_PUBLISH_DESCRIPTION;
|
|
6
6
|
static examples = [
|
|
7
7
|
'<%= config.bin %> <%= command.id %>',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
2
2
|
import { commandStdioCaptureOptions, withCapturedCommandOutput } from '../../../lib/command-output-buffer.js';
|
|
3
3
|
import { runWorkPublish, workPublishFlags, } from '../../../lib/work-publish-command.js';
|
|
4
4
|
/**
|
|
5
5
|
* Compatibility alias of `cicd work publish`.
|
|
6
6
|
* Prefer `agentia cicd work publish` in scripts and docs.
|
|
7
7
|
*/
|
|
8
|
-
export default class WorkPush extends
|
|
8
|
+
export default class WorkPush extends CicdCommand {
|
|
9
9
|
static description = [
|
|
10
10
|
'Alias of cicd work publish.',
|
|
11
11
|
'Publishes the current feature/<lastWorkItem> branch and registers commits with Copado.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
3
3
|
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
4
4
|
import { reconcileWorkSetCredential } from '../../../lib/credential-sync.js';
|
|
5
5
|
import { writeLastWorkSelection } from '../../../lib/defaults-store.js';
|
|
@@ -8,7 +8,7 @@ import { withLocalDevelopmentFlow } from '../../../lib/work-local-development-fl
|
|
|
8
8
|
import { performWorkSetNone, WorkSetNoneValidationError } from '../../../lib/work-set-none.js';
|
|
9
9
|
import { isWorkSetWarning, parseWorkSetSelection, toWorkSetWarningResult, writeWorkSetWarningSelection, } from '../../../lib/work-set-selection.js';
|
|
10
10
|
import { featureBranchName, workSetEndpoint, } from '../../../lib/work-types.js';
|
|
11
|
-
export default class WorkSet extends
|
|
11
|
+
export default class WorkSet extends CicdCommand {
|
|
12
12
|
static args = {
|
|
13
13
|
id: Args.string({
|
|
14
14
|
description: 'User story ID or name (omit with --none)',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
3
3
|
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
4
4
|
import { readLastWorkItem } from '../../../lib/defaults-store.js';
|
|
5
5
|
import { resolveRecordedWorkBranchMetadata, } from '../../../lib/work-branch-metadata.js';
|
|
6
6
|
import { formatWorkBranchMetadata, formatWorkStatus, workStatusEndpoint, } from '../../../lib/work-types.js';
|
|
7
|
-
export default class WorkStatus extends
|
|
7
|
+
export default class WorkStatus extends CicdCommand {
|
|
8
8
|
static args = {
|
|
9
9
|
id: Args.string({
|
|
10
10
|
description: 'User story ID or name (defaults to the last work item from `work set`)',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { CicdCommand } from '../../../lib/cicd-command.js';
|
|
4
4
|
import { CicdGateway } from '../../../lib/cicd-gateway.js';
|
|
5
5
|
import { commandStdioCaptureOptions, withCapturedCommandOutput } from '../../../lib/command-output-buffer.js';
|
|
6
6
|
import { readLastBaseBranch, readLastPullRequestBaseUrl, readSkipPullRequest, } from '../../../lib/defaults-store.js';
|
|
@@ -15,7 +15,7 @@ import { performWorkPush, resolveActiveFeatureWorkItem, resolveWorkPushContext,
|
|
|
15
15
|
import { reportSubmitUserStoriesAheadBehind } from '../../../lib/work-submit-ahead-behind.js';
|
|
16
16
|
import { waitForPendingCommitJobBeforeSubmit } from '../../../lib/work-submit-wait.js';
|
|
17
17
|
import { buildPullRequestCompareUrl, formatWorkCommandMessage, workSubmitEndpoint, } from '../../../lib/work-types.js';
|
|
18
|
-
export default class WorkSubmit extends
|
|
18
|
+
export default class WorkSubmit extends CicdCommand {
|
|
19
19
|
static description = withLocalDevelopmentFlow([
|
|
20
20
|
'Submit the current feature/<lastWorkItem> work item for pipeline quality gates and validation.',
|
|
21
21
|
'Runs project-root .agentia_quality_gates.sh (macOS/Linux) or .agentia_quality_gates.cmd (Windows) when present,',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { DEFAULT_APEX_TEST_WAIT_MINUTES, formatWorkApexTestHuman, parseApexTestClassNames,
|
|
5
|
-
export default class WorkTestApex extends
|
|
2
|
+
import { CicdCommand } from '../../../../lib/cicd-command.js';
|
|
3
|
+
import { executeWorkApexTestRun, WorkApexRerunError } from '../../../../lib/work-apex-test-failures.js';
|
|
4
|
+
import { DEFAULT_APEX_TEST_WAIT_MINUTES, formatWorkApexTestHuman, parseApexTestClassNames, validateApexTestWaitMinutes, } from '../../../../lib/work-apex-test.js';
|
|
5
|
+
export default class WorkTestApex extends CicdCommand {
|
|
6
6
|
static description = [
|
|
7
|
+
'Legacy alias of `work test --gate apex`; prefer that form (it is what the sample quality-gate scripts call).',
|
|
7
8
|
'Run specified Apex test classes via Salesforce CLI (`sf apex run test`) with code coverage.',
|
|
8
|
-
'Usually run from project-root local quality gates (`.agentia_quality_gates.sh` / `.agentia_quality_gates.cmd`) when those scripts are configured.',
|
|
9
9
|
'When `--apex-test-classes` is omitted or empty, logs that no Apex tests were specified and exits without running Salesforce CLI.',
|
|
10
10
|
'Failed runs save `.agentia/apex.tests.<user-story>.json`; successful runs delete that file.',
|
|
11
11
|
'`--rerun-failed-apex-tests` runs the previously failed classes (optionally filtered by `--apex-test-classes`).',
|
|
@@ -34,6 +34,7 @@ export default class WorkTestApex extends AgentiaCommand {
|
|
|
34
34
|
description: 'Minutes to wait for Salesforce CLI Apex test results',
|
|
35
35
|
}),
|
|
36
36
|
};
|
|
37
|
+
static hidden = true;
|
|
37
38
|
async run() {
|
|
38
39
|
const { flags } = await this.parse(WorkTestApex);
|
|
39
40
|
const startedAt = Date.now();
|
|
@@ -46,42 +47,26 @@ export default class WorkTestApex extends AgentiaCommand {
|
|
|
46
47
|
catch (error) {
|
|
47
48
|
this.error(error.message, { exit: 2 });
|
|
48
49
|
}
|
|
49
|
-
let plan;
|
|
50
50
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const result = skippedWorkApexTestResult(waitMinutes);
|
|
64
|
-
this.display(() => {
|
|
65
|
-
this.log(plan.message);
|
|
66
|
-
});
|
|
67
|
-
this.logElapsed(startedAt);
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
try {
|
|
71
|
-
const result = await this.withSpinner(`Running Apex tests (${plan.classNames.join(', ')}), waiting up to ${waitMinutes} minute(s)`, () => runWorkApexTests({ classNames: plan.classNames, waitMinutes }));
|
|
72
|
-
await recordWorkApexTestOutcome({ failed: false, result, userStory: plan.userStory });
|
|
73
|
-
this.display(() => {
|
|
74
|
-
this.log(formatWorkApexTestHuman(result));
|
|
51
|
+
const result = await executeWorkApexTestRun({ requestedClassNames: classNames, rerunFailed: flags['rerun-failed-apex-tests'] === true, waitMinutes }, {
|
|
52
|
+
onResult: (apexResult) => {
|
|
53
|
+
this.display(() => {
|
|
54
|
+
this.log(formatWorkApexTestHuman(apexResult));
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
onSkip: (message) => {
|
|
58
|
+
this.display(() => {
|
|
59
|
+
this.log(message);
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
withSpinner: (message, action) => this.withSpinner(message, action),
|
|
75
63
|
});
|
|
76
64
|
this.logElapsed(startedAt);
|
|
77
65
|
return result;
|
|
78
66
|
}
|
|
79
67
|
catch (error) {
|
|
80
|
-
if (error instanceof
|
|
81
|
-
|
|
82
|
-
this.display(() => {
|
|
83
|
-
this.log(formatWorkApexTestHuman(error.result));
|
|
84
|
-
});
|
|
68
|
+
if (error instanceof WorkApexRerunError) {
|
|
69
|
+
this.error(error.message, { exit: 2 });
|
|
85
70
|
}
|
|
86
71
|
throw error;
|
|
87
72
|
}
|