@copado/agentia-cli 1.0.0-beta.4 → 1.0.0-beta.5
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 +19 -0
- package/README.md +265 -244
- package/dist/commands/cicd/work/test/apex.js +37 -4
- package/dist/commands/cicd/work/test.js +20 -1
- package/dist/lib/cicd-gateway.js +2 -1
- package/dist/lib/local-quality-gates.js +4 -1
- package/dist/lib/mcp/work-tools.js +42 -8
- package/dist/lib/plugin-host/event-log.js +3 -0
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/setup-templates.js +2 -1
- package/dist/lib/work-apex-test-failures.js +13 -0
- package/dist/lib/work-apex-test.js +4 -1
- package/oclif.manifest.json +72 -49
- package/package.json +1 -1
- package/templates/skills/agentia-cicd/SKILL.md +1 -1
- package/templates/skills/agentia-cicd/references/work.md +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {modules} from './runtime.js';
|
|
2
2
|
const AGENTIA_AGENTS_END_MARKER = modules["setup-templates.js"]["AGENTIA_AGENTS_END_MARKER"]
|
|
3
3
|
const AGENTIA_AGENTS_START_MARKER = modules["setup-templates.js"]["AGENTIA_AGENTS_START_MARKER"]
|
|
4
|
+
const AGENTIA_APEX_TESTS_GITIGNORE_ENTRY = modules["setup-templates.js"]["AGENTIA_APEX_TESTS_GITIGNORE_ENTRY"]
|
|
4
5
|
const AGENTIA_DIR_GITIGNORE_ENTRIES = modules["setup-templates.js"]["AGENTIA_DIR_GITIGNORE_ENTRIES"]
|
|
5
6
|
const AGENTIA_GITIGNORE_ENTRIES = modules["setup-templates.js"]["AGENTIA_GITIGNORE_ENTRIES"]
|
|
6
7
|
const AGENTIA_GITIGNORE_ENTRY = modules["setup-templates.js"]["AGENTIA_GITIGNORE_ENTRY"]
|
|
@@ -9,4 +10,4 @@ const BUNDLED_AGENTS_MD = modules["setup-templates.js"]["BUNDLED_AGENTS_MD"]
|
|
|
9
10
|
const SAMPLE_QUALITY_GATES_UNIX = modules["setup-templates.js"]["SAMPLE_QUALITY_GATES_UNIX"]
|
|
10
11
|
const SAMPLE_QUALITY_GATES_WINDOWS = modules["setup-templates.js"]["SAMPLE_QUALITY_GATES_WINDOWS"]
|
|
11
12
|
const qualityGatesExplanation = modules["setup-templates.js"]["qualityGatesExplanation"]
|
|
12
|
-
export {AGENTIA_AGENTS_END_MARKER, AGENTIA_AGENTS_START_MARKER, AGENTIA_DIR_GITIGNORE_ENTRIES, AGENTIA_GITIGNORE_ENTRIES, AGENTIA_GITIGNORE_ENTRY, AGENTIA_IDEX_GITIGNORE_ENTRY, BUNDLED_AGENTS_MD, SAMPLE_QUALITY_GATES_UNIX, SAMPLE_QUALITY_GATES_WINDOWS, qualityGatesExplanation};
|
|
13
|
+
export {AGENTIA_AGENTS_END_MARKER, AGENTIA_AGENTS_START_MARKER, AGENTIA_APEX_TESTS_GITIGNORE_ENTRY, AGENTIA_DIR_GITIGNORE_ENTRIES, AGENTIA_GITIGNORE_ENTRIES, AGENTIA_GITIGNORE_ENTRY, AGENTIA_IDEX_GITIGNORE_ENTRY, BUNDLED_AGENTS_MD, SAMPLE_QUALITY_GATES_UNIX, SAMPLE_QUALITY_GATES_WINDOWS, qualityGatesExplanation};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {modules} from './runtime.js';
|
|
2
|
+
const APEX_TEST_FAILURE_FILE_PREFIX = modules["work-apex-test-failures.js"]["APEX_TEST_FAILURE_FILE_PREFIX"]
|
|
3
|
+
const APEX_TEST_FAILURE_FILE_SUFFIX = modules["work-apex-test-failures.js"]["APEX_TEST_FAILURE_FILE_SUFFIX"]
|
|
4
|
+
const WorkApexRerunError = modules["work-apex-test-failures.js"]["WorkApexRerunError"]
|
|
5
|
+
const clearSavedApexTestFailures = modules["work-apex-test-failures.js"]["clearSavedApexTestFailures"]
|
|
6
|
+
const normalizeApexFailureUserStory = modules["work-apex-test-failures.js"]["normalizeApexFailureUserStory"]
|
|
7
|
+
const planWorkApexTestRun = modules["work-apex-test-failures.js"]["planWorkApexTestRun"]
|
|
8
|
+
const readSavedApexTestFailures = modules["work-apex-test-failures.js"]["readSavedApexTestFailures"]
|
|
9
|
+
const recordWorkApexTestOutcome = modules["work-apex-test-failures.js"]["recordWorkApexTestOutcome"]
|
|
10
|
+
const resolveApexFailureUserStory = modules["work-apex-test-failures.js"]["resolveApexFailureUserStory"]
|
|
11
|
+
const resolveApexTestFailureFilePath = modules["work-apex-test-failures.js"]["resolveApexTestFailureFilePath"]
|
|
12
|
+
const saveFailedApexTests = modules["work-apex-test-failures.js"]["saveFailedApexTests"]
|
|
13
|
+
export {APEX_TEST_FAILURE_FILE_PREFIX, APEX_TEST_FAILURE_FILE_SUFFIX, WorkApexRerunError, clearSavedApexTestFailures, normalizeApexFailureUserStory, planWorkApexTestRun, readSavedApexTestFailures, recordWorkApexTestOutcome, resolveApexFailureUserStory, resolveApexTestFailureFilePath, saveFailedApexTests};
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {modules} from './runtime.js';
|
|
2
2
|
const DEFAULT_APEX_TEST_WAIT_MINUTES = modules["work-apex-test.js"]["DEFAULT_APEX_TEST_WAIT_MINUTES"]
|
|
3
|
+
const NO_APEX_TESTS_SPECIFIED_MESSAGE = modules["work-apex-test.js"]["NO_APEX_TESTS_SPECIFIED_MESSAGE"]
|
|
3
4
|
const WorkApexTestError = modules["work-apex-test.js"]["WorkApexTestError"]
|
|
4
5
|
const buildSfApexTestArgs = modules["work-apex-test.js"]["buildSfApexTestArgs"]
|
|
6
|
+
const collectFailedApexClassNames = modules["work-apex-test.js"]["collectFailedApexClassNames"]
|
|
5
7
|
const formatWorkApexTestHuman = modules["work-apex-test.js"]["formatWorkApexTestHuman"]
|
|
6
8
|
const parseApexTestClassNames = modules["work-apex-test.js"]["parseApexTestClassNames"]
|
|
7
9
|
const parseSfApexTestJson = modules["work-apex-test.js"]["parseSfApexTestJson"]
|
|
8
10
|
const resetSfApexTestExecForTests = modules["work-apex-test.js"]["resetSfApexTestExecForTests"]
|
|
9
11
|
const runWorkApexTests = modules["work-apex-test.js"]["runWorkApexTests"]
|
|
10
12
|
const setSfApexTestExecForTests = modules["work-apex-test.js"]["setSfApexTestExecForTests"]
|
|
13
|
+
const skippedWorkApexTestResult = modules["work-apex-test.js"]["skippedWorkApexTestResult"]
|
|
11
14
|
const validateApexTestWaitMinutes = modules["work-apex-test.js"]["validateApexTestWaitMinutes"]
|
|
12
|
-
export {DEFAULT_APEX_TEST_WAIT_MINUTES, WorkApexTestError, buildSfApexTestArgs, formatWorkApexTestHuman, parseApexTestClassNames, parseSfApexTestJson, resetSfApexTestExecForTests, runWorkApexTests, setSfApexTestExecForTests, validateApexTestWaitMinutes};
|
|
15
|
+
export {DEFAULT_APEX_TEST_WAIT_MINUTES, NO_APEX_TESTS_SPECIFIED_MESSAGE, WorkApexTestError, buildSfApexTestArgs, collectFailedApexClassNames, formatWorkApexTestHuman, parseApexTestClassNames, parseSfApexTestJson, resetSfApexTestExecForTests, runWorkApexTests, setSfApexTestExecForTests, skippedWorkApexTestResult, validateApexTestWaitMinutes};
|
package/oclif.manifest.json
CHANGED
|
@@ -5497,6 +5497,50 @@
|
|
|
5497
5497
|
"validate.js"
|
|
5498
5498
|
]
|
|
5499
5499
|
},
|
|
5500
|
+
"cicd:user:get": {
|
|
5501
|
+
"aliases": [],
|
|
5502
|
+
"args": {},
|
|
5503
|
+
"description": "Get a Copado user by ID (defaults to the authenticated user)",
|
|
5504
|
+
"examples": [
|
|
5505
|
+
"<%= config.bin %> <%= command.id %>",
|
|
5506
|
+
"<%= config.bin %> <%= command.id %> --id me",
|
|
5507
|
+
"<%= config.bin %> <%= command.id %> --id 005000000000000",
|
|
5508
|
+
"<%= config.bin %> <%= command.id %> --json"
|
|
5509
|
+
],
|
|
5510
|
+
"flags": {
|
|
5511
|
+
"json": {
|
|
5512
|
+
"description": "Format output as json.",
|
|
5513
|
+
"helpGroup": "GLOBAL",
|
|
5514
|
+
"name": "json",
|
|
5515
|
+
"allowNo": false,
|
|
5516
|
+
"type": "boolean"
|
|
5517
|
+
},
|
|
5518
|
+
"id": {
|
|
5519
|
+
"description": "User ID, or \"me\" for the authenticated user",
|
|
5520
|
+
"name": "id",
|
|
5521
|
+
"default": "me",
|
|
5522
|
+
"hasDynamicHelp": false,
|
|
5523
|
+
"multiple": false,
|
|
5524
|
+
"type": "option"
|
|
5525
|
+
}
|
|
5526
|
+
},
|
|
5527
|
+
"hasDynamicHelp": false,
|
|
5528
|
+
"hiddenAliases": [],
|
|
5529
|
+
"id": "cicd:user:get",
|
|
5530
|
+
"pluginAlias": "@copado/agentia-cli",
|
|
5531
|
+
"pluginName": "@copado/agentia-cli",
|
|
5532
|
+
"pluginType": "core",
|
|
5533
|
+
"strict": true,
|
|
5534
|
+
"enableJsonFlag": true,
|
|
5535
|
+
"isESM": true,
|
|
5536
|
+
"relativePath": [
|
|
5537
|
+
"dist",
|
|
5538
|
+
"commands",
|
|
5539
|
+
"cicd",
|
|
5540
|
+
"user",
|
|
5541
|
+
"get.js"
|
|
5542
|
+
]
|
|
5543
|
+
},
|
|
5500
5544
|
"cicd:stage:create": {
|
|
5501
5545
|
"aliases": [],
|
|
5502
5546
|
"args": {
|
|
@@ -5780,50 +5824,6 @@
|
|
|
5780
5824
|
"update.js"
|
|
5781
5825
|
]
|
|
5782
5826
|
},
|
|
5783
|
-
"cicd:user:get": {
|
|
5784
|
-
"aliases": [],
|
|
5785
|
-
"args": {},
|
|
5786
|
-
"description": "Get a Copado user by ID (defaults to the authenticated user)",
|
|
5787
|
-
"examples": [
|
|
5788
|
-
"<%= config.bin %> <%= command.id %>",
|
|
5789
|
-
"<%= config.bin %> <%= command.id %> --id me",
|
|
5790
|
-
"<%= config.bin %> <%= command.id %> --id 005000000000000",
|
|
5791
|
-
"<%= config.bin %> <%= command.id %> --json"
|
|
5792
|
-
],
|
|
5793
|
-
"flags": {
|
|
5794
|
-
"json": {
|
|
5795
|
-
"description": "Format output as json.",
|
|
5796
|
-
"helpGroup": "GLOBAL",
|
|
5797
|
-
"name": "json",
|
|
5798
|
-
"allowNo": false,
|
|
5799
|
-
"type": "boolean"
|
|
5800
|
-
},
|
|
5801
|
-
"id": {
|
|
5802
|
-
"description": "User ID, or \"me\" for the authenticated user",
|
|
5803
|
-
"name": "id",
|
|
5804
|
-
"default": "me",
|
|
5805
|
-
"hasDynamicHelp": false,
|
|
5806
|
-
"multiple": false,
|
|
5807
|
-
"type": "option"
|
|
5808
|
-
}
|
|
5809
|
-
},
|
|
5810
|
-
"hasDynamicHelp": false,
|
|
5811
|
-
"hiddenAliases": [],
|
|
5812
|
-
"id": "cicd:user:get",
|
|
5813
|
-
"pluginAlias": "@copado/agentia-cli",
|
|
5814
|
-
"pluginName": "@copado/agentia-cli",
|
|
5815
|
-
"pluginType": "core",
|
|
5816
|
-
"strict": true,
|
|
5817
|
-
"enableJsonFlag": true,
|
|
5818
|
-
"isESM": true,
|
|
5819
|
-
"relativePath": [
|
|
5820
|
-
"dist",
|
|
5821
|
-
"commands",
|
|
5822
|
-
"cicd",
|
|
5823
|
-
"user",
|
|
5824
|
-
"get.js"
|
|
5825
|
-
]
|
|
5826
|
-
},
|
|
5827
5827
|
"cicd:work:commit": {
|
|
5828
5828
|
"aliases": [],
|
|
5829
5829
|
"args": {
|
|
@@ -7019,6 +7019,8 @@
|
|
|
7019
7019
|
"examples": [
|
|
7020
7020
|
"<%= config.bin %> <%= command.id %>",
|
|
7021
7021
|
"<%= config.bin %> <%= command.id %> --local --apex-test-classes=MyTest,OtherTest",
|
|
7022
|
+
"<%= config.bin %> <%= command.id %> --local --rerun-failed-apex-tests",
|
|
7023
|
+
"<%= config.bin %> <%= command.id %> -e SKIP_LWC_TESTS=1 -e TOOL_API_KEY=secret",
|
|
7022
7024
|
"<%= config.bin %> <%= command.id %> --json",
|
|
7023
7025
|
"<%= config.bin %> <%= command.id %> --cloud"
|
|
7024
7026
|
],
|
|
@@ -7043,11 +7045,25 @@
|
|
|
7043
7045
|
"allowNo": false,
|
|
7044
7046
|
"type": "boolean"
|
|
7045
7047
|
},
|
|
7048
|
+
"env": {
|
|
7049
|
+
"char": "e",
|
|
7050
|
+
"description": "Extra environment variable for the quality-gate script as NAME=value. Repeatable. Applied before reserved AGENTIA_APEX_* variables.",
|
|
7051
|
+
"name": "env",
|
|
7052
|
+
"hasDynamicHelp": false,
|
|
7053
|
+
"multiple": true,
|
|
7054
|
+
"type": "option"
|
|
7055
|
+
},
|
|
7046
7056
|
"local": {
|
|
7047
7057
|
"description": "Run local project-root quality gates scripts. Used by default when --cloud is omitted.",
|
|
7048
7058
|
"name": "local",
|
|
7049
7059
|
"allowNo": false,
|
|
7050
7060
|
"type": "boolean"
|
|
7061
|
+
},
|
|
7062
|
+
"rerun-failed-apex-tests": {
|
|
7063
|
+
"description": "Pass AGENTIA_APEX_RERUN_FAILED=--rerun-failed-apex-tests to local quality gates so sample scripts forward that flag to work test apex.",
|
|
7064
|
+
"name": "rerun-failed-apex-tests",
|
|
7065
|
+
"allowNo": false,
|
|
7066
|
+
"type": "boolean"
|
|
7051
7067
|
}
|
|
7052
7068
|
},
|
|
7053
7069
|
"hasDynamicHelp": false,
|
|
@@ -17790,11 +17806,13 @@
|
|
|
17790
17806
|
"cicd:work:test:apex": {
|
|
17791
17807
|
"aliases": [],
|
|
17792
17808
|
"args": {},
|
|
17793
|
-
"description": "Run specified Apex test classes via Salesforce CLI (`sf apex run test`) with code coverage. Usually run from project-root local quality gates (`.agentia_quality_gates.sh` / `.agentia_quality_gates.cmd`) when those scripts are configured. Prints the test-run summary when the run passes, or failing tests with their messages and stack traces when it fails.",
|
|
17809
|
+
"description": "Run specified Apex test classes via Salesforce CLI (`sf apex run test`) with code coverage. Usually run from project-root local quality gates (`.agentia_quality_gates.sh` / `.agentia_quality_gates.cmd`) when those scripts are configured. When `--apex-test-classes` is omitted or empty, logs that no Apex tests were specified and exits without running Salesforce CLI. Failed runs save `.agentia/apex.tests.<user-story>.json`; successful runs delete that file. `--rerun-failed-apex-tests` runs the previously failed classes (optionally filtered by `--apex-test-classes`). Prints the test-run summary when the run passes, or failing tests with their messages and stack traces when it fails. Exits with the same process exit code as Salesforce CLI (`sf`), including 100 when Apex tests fail.",
|
|
17794
17810
|
"examples": [
|
|
17795
17811
|
"<%= config.bin %> <%= command.id %> -t HelloWorldTest",
|
|
17796
17812
|
"<%= config.bin %> <%= command.id %> --apex-test-classes=MyTest,OtherTest",
|
|
17797
|
-
"<%= config.bin %> <%= command.id %> -t MyTest,OtherTest -w 10 --json"
|
|
17813
|
+
"<%= config.bin %> <%= command.id %> -t MyTest,OtherTest -w 10 --json",
|
|
17814
|
+
"<%= config.bin %> <%= command.id %> -t \"$AGENTIA_APEX_TEST_CLASSES\"",
|
|
17815
|
+
"<%= config.bin %> <%= command.id %> --rerun-failed-apex-tests"
|
|
17798
17816
|
],
|
|
17799
17817
|
"flags": {
|
|
17800
17818
|
"json": {
|
|
@@ -17806,13 +17824,18 @@
|
|
|
17806
17824
|
},
|
|
17807
17825
|
"apex-test-classes": {
|
|
17808
17826
|
"char": "t",
|
|
17809
|
-
"description": "Comma-separated Apex test class names to run",
|
|
17827
|
+
"description": "Comma-separated Apex test class names to run. Omit or leave empty to skip without running Salesforce CLI.",
|
|
17810
17828
|
"name": "apex-test-classes",
|
|
17811
|
-
"required": true,
|
|
17812
17829
|
"hasDynamicHelp": false,
|
|
17813
17830
|
"multiple": false,
|
|
17814
17831
|
"type": "option"
|
|
17815
17832
|
},
|
|
17833
|
+
"rerun-failed-apex-tests": {
|
|
17834
|
+
"description": "Rerun Apex classes saved from the last failure for this user story (`.agentia/apex.tests.<user-story>.json`). Combined with --apex-test-classes, only matching failed classes run.",
|
|
17835
|
+
"name": "rerun-failed-apex-tests",
|
|
17836
|
+
"allowNo": false,
|
|
17837
|
+
"type": "boolean"
|
|
17838
|
+
},
|
|
17816
17839
|
"wait": {
|
|
17817
17840
|
"char": "w",
|
|
17818
17841
|
"description": "Minutes to wait for Salesforce CLI Apex test results",
|
|
@@ -18517,5 +18540,5 @@
|
|
|
18517
18540
|
]
|
|
18518
18541
|
}
|
|
18519
18542
|
},
|
|
18520
|
-
"version": "1.0.0-beta.
|
|
18543
|
+
"version": "1.0.0-beta.5"
|
|
18521
18544
|
}
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ Prefer Agentia MCP tools when they are available and match the task. Use CLI exa
|
|
|
34
34
|
- For local project work, keep the tracked working tree clean before commands that require it: `work set`, `work publish`, and `work submit`. If `work set` returns `status: "warning"`, show the message and do not assume a feature branch was created; branch keys are cleared and the work item id/name/title are still recorded in config.user.json.
|
|
35
35
|
- Treat `cicd job` as Copado CICD JobExecution. It is different from CRT `testing job`.
|
|
36
36
|
- Treat `cicd work test` as local quality gates (`--local` is the default). It is different from CRT `testing test run`.
|
|
37
|
-
- Treat `cicd work test apex` as the Apex test runner that local quality gates (`.agentia_quality_gates.*`) usually call
|
|
37
|
+
- Treat `cicd work test apex` as the Apex test runner that local quality gates (`.agentia_quality_gates.*`) usually call. An empty `--apex-test-classes` list skips Salesforce CLI. It can also be invoked directly. It is different from CRT.
|
|
38
38
|
- Treat `auth` credentials as keychain/API credentials and `cicd credential` records as Copado environment credentials.
|
|
39
39
|
|
|
40
40
|
## Report Back
|
|
@@ -47,7 +47,7 @@ Cloud commit checks Story readiness and source credentials before submission. Av
|
|
|
47
47
|
| `cloud commit` | Copado cloud metadata commit | For local Git work, use `git commit` then `work publish`. `work commit` is a hidden compatibility alias. |
|
|
48
48
|
| `work publish` | Publish local commits and register with Copado | Requires active story context and clean tree. Accepts `--permissions` and `--full-metadata` when nested detection is not enough. `work push` is a compatibility alias. |
|
|
49
49
|
| `work test` | Run local quality gate scripts | `--local` is default. Runs `.agentia_quality_gates.sh` or `.agentia_quality_gates.cmd` from repo root. If missing, warns and runs the stock setup sample from a temp file. `--cloud` is not implemented yet. |
|
|
50
|
-
| `work test apex` | Run named Apex test classes |
|
|
50
|
+
| `work test apex` | Run named Apex test classes | Optional `--apex-test-classes`. Omit or pass empty to log a skip and exit 0 without calling Salesforce CLI. `--rerun-failed-apex-tests` reruns classes from `.agentia/apex.tests.<user-story>.json`. Optional `--wait` minutes (default 60). Usually invoked from `.agentia_quality_gates.*`. |
|
|
51
51
|
| `work submit` | Submit for review/validation or promote | Runs local gates unless `--skip-local-tests`; can push ahead commits. Waits up to 5 minutes when the last pending related job template contains `Commit`. `--skip-pull-request` skips opening the MR URL. `--done` and `--deploy` match Copado UI Submit when promoting. |
|
|
52
52
|
| `work done` | Compatibility alias | Prefer `work submit --done`; both promote and deploy rather than validate-only. |
|
|
53
53
|
| `work promote` | Experimental local promotion | Skips Quality Gates. Requires `enableLocalPromote: true` in `.agentia/config.json`. Merges `feature/<name>` into `promotion/<promotionName>`. Use `--backpromote --destination-branch` for back promotions; `--continue` after conflict resolution. |
|
|
@@ -118,7 +118,7 @@ Prefer explicit flags for standard step types. Use `--config-json`, `--file`, or
|
|
|
118
118
|
## Gotchas
|
|
119
119
|
|
|
120
120
|
- `work test` is not CRT. For Robot Framework execution, use the `agentia-testing` skill.
|
|
121
|
-
- `work test apex` runs named Apex classes. Local quality gates (`.agentia_quality_gates.*`) usually call it
|
|
121
|
+
- `work test apex` runs named Apex classes. Local quality gates (`.agentia_quality_gates.*`) usually call it with `-t "${AGENTIA_APEX_TEST_CLASSES}"` and `${AGENTIA_APEX_RERUN_FAILED}` (empty or `--rerun-failed-apex-tests`); an empty class list skips Apex without failing the script. `--rerun-failed-apex-tests` reruns classes saved in `.agentia/apex.tests.<user-story>.json` after a failure. Direct use is for a targeted rerun without the rest of the gates.
|
|
122
122
|
- Local Git work uses `git commit` then `work publish`. Cloud `cloud commit` is a separate path.
|
|
123
123
|
- `work submit` may push ahead commits, but the local flow still needs story and branch context from `work set`.
|
|
124
124
|
- `work submit --done` (or `--deploy`) promotes/deploys. Do not run it unless the user explicitly asked to promote or finish the story.
|