@copado/agentia-cli 0.115.0-alpha.0 → 0.117.0-alpha.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.
Files changed (73) hide show
  1. package/README.md +370 -357
  2. package/dist/commands/cicd/work/commit.d.ts +0 -5
  3. package/dist/commands/cicd/work/commit.js +18 -33
  4. package/dist/commands/cicd/work/commit.js.map +1 -1
  5. package/dist/commands/cicd/work/publish.d.ts +12 -0
  6. package/dist/commands/cicd/work/publish.js +20 -0
  7. package/dist/commands/cicd/work/publish.js.map +1 -0
  8. package/dist/commands/cicd/work/push.d.ts +4 -0
  9. package/dist/commands/cicd/work/push.js +11 -81
  10. package/dist/commands/cicd/work/push.js.map +1 -1
  11. package/dist/commands/cicd/work/set.d.ts +2 -2
  12. package/dist/commands/cicd/work/set.js +6 -2
  13. package/dist/commands/cicd/work/set.js.map +1 -1
  14. package/dist/commands/cicd/work/status.js +14 -13
  15. package/dist/commands/cicd/work/status.js.map +1 -1
  16. package/dist/commands/cicd/work/submit.d.ts +2 -0
  17. package/dist/commands/cicd/work/submit.js +11 -3
  18. package/dist/commands/cicd/work/submit.js.map +1 -1
  19. package/dist/commands/cicd/work/test/apex.d.ts +11 -0
  20. package/dist/commands/cicd/work/test/apex.js +57 -0
  21. package/dist/commands/cicd/work/test/apex.js.map +1 -0
  22. package/dist/commands/cicd/work/test.js +12 -4
  23. package/dist/commands/cicd/work/test.js.map +1 -1
  24. package/dist/lib/cicd-gateway.d.ts +3 -0
  25. package/dist/lib/cicd-gateway.js +35 -2
  26. package/dist/lib/cicd-gateway.js.map +1 -1
  27. package/dist/lib/defaults-store.d.ts +1 -1
  28. package/dist/lib/defaults-store.js +1 -1
  29. package/dist/lib/git-worktree.d.ts +13 -5
  30. package/dist/lib/git-worktree.js +49 -11
  31. package/dist/lib/git-worktree.js.map +1 -1
  32. package/dist/lib/local-quality-gates.d.ts +4 -0
  33. package/dist/lib/local-quality-gates.js +1 -1
  34. package/dist/lib/local-quality-gates.js.map +1 -1
  35. package/dist/lib/mcp/tools.d.ts +12 -2
  36. package/dist/lib/mcp/tools.js +10 -8
  37. package/dist/lib/mcp/tools.js.map +1 -1
  38. package/dist/lib/mcp/work-tools.d.ts +18 -6
  39. package/dist/lib/mcp/work-tools.js +75 -50
  40. package/dist/lib/mcp/work-tools.js.map +1 -1
  41. package/dist/lib/nested-metadata-changes.d.ts +4 -4
  42. package/dist/lib/setup-templates.d.ts +3 -3
  43. package/dist/lib/setup-templates.js +34 -29
  44. package/dist/lib/setup-templates.js.map +1 -1
  45. package/dist/lib/setup-wizard.js +1 -1
  46. package/dist/lib/setup-wizard.js.map +1 -1
  47. package/dist/lib/stock-quality-gates.d.ts +12 -0
  48. package/dist/lib/stock-quality-gates.js +67 -0
  49. package/dist/lib/stock-quality-gates.js.map +1 -0
  50. package/dist/lib/work-apex-test.d.ts +56 -0
  51. package/dist/lib/work-apex-test.js +265 -0
  52. package/dist/lib/work-apex-test.js.map +1 -0
  53. package/dist/lib/work-branch-metadata.d.ts +2 -0
  54. package/dist/lib/work-branch-metadata.js +9 -0
  55. package/dist/lib/work-branch-metadata.js.map +1 -1
  56. package/dist/lib/work-local-commit.d.ts +1 -1
  57. package/dist/lib/work-local-commit.js +1 -1
  58. package/dist/lib/work-publish-command.d.ts +26 -0
  59. package/dist/lib/work-publish-command.js +88 -0
  60. package/dist/lib/work-publish-command.js.map +1 -0
  61. package/dist/lib/work-push.d.ts +6 -5
  62. package/dist/lib/work-push.js +30 -22
  63. package/dist/lib/work-push.js.map +1 -1
  64. package/dist/lib/work-set-selection.d.ts +3 -1
  65. package/dist/lib/work-set-selection.js +19 -1
  66. package/dist/lib/work-set-selection.js.map +1 -1
  67. package/dist/lib/work-types.d.ts +12 -1
  68. package/dist/lib/work-types.js.map +1 -1
  69. package/oclif.manifest.json +2231 -2151
  70. package/package.json +4 -1
  71. package/templates/AGENTS.md +2 -2
  72. package/templates/skills/agentia-cicd/SKILL.md +4 -3
  73. package/templates/skills/agentia-cicd/references/work.md +25 -23
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@copado/agentia-cli",
3
3
  "description": "Command-line interface for Agentia",
4
- "version": "0.115.0-alpha.0",
4
+ "version": "0.117.0-alpha.0",
5
5
  "author": "Copado Solutions",
6
6
  "bin": {
7
7
  "agentia": "./bin/run.js"
@@ -191,6 +191,9 @@
191
191
  "cicd:work:deployment-step": {
192
192
  "description": "Manage user story deployment steps"
193
193
  },
194
+ "cicd:work:test": {
195
+ "description": "Run quality gates and Apex tests for a work item"
196
+ },
194
197
  "cicd:promotion": {
195
198
  "description": "Manage Copado promotions"
196
199
  },
@@ -8,7 +8,7 @@ Authentication must be configured before operational commands. Never print crede
8
8
 
9
9
  ## Copado workflow
10
10
 
11
- `list → get → set → commit → push → submit → done`
11
+ `list → get → set → (implement & git commit) → test → publish → submit [--done|--deploy]`
12
12
 
13
13
  Read records before changing them and use IDs returned by Copado. Do not skip `work set` before coding; use one story per feature branch. Keep the working tree clean for lifecycle commands, and confirm promotion/deployment intent before `done`.
14
14
 
@@ -16,7 +16,7 @@ Read records before changing them and use IDs returned by Copado. Do not skip `w
16
16
 
17
17
  Load exactly one copy of each applicable Agentia skill. Prefer the client-specific root when available (`.cursor/skills` in Cursor or `.claude/skills` in Claude); otherwise use `.agents/skills`.
18
18
 
19
- - `agentia-cicd/SKILL.md`: Copado stories, commits, push, submit, done, promotions, jobs, environments, pipelines, and data.
19
+ - `agentia-cicd/SKILL.md`: Copado stories, commits, publish, submit, done, promotions, jobs, environments, pipelines, and data.
20
20
  - `agentia-testing/SKILL.md`: Copado Robotic Testing operations.
21
21
  - `agentia-ai/SKILL.md`: Copado AI operations.
22
22
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agentia-cicd
3
- description: Use this skill when managing Copado CICD work with the Agentia CLI or Agentia MCP tools: user stories, work commit/push/submit/done, promotion runs and conflicts, job executions, environments, credentials, pipelines, stages, and release data templates. Use it whenever the user asks an agent to operate Copado CICD from a terminal, IDE, or headless workflow.
3
+ description: Use this skill when managing Copado CICD work with the Agentia CLI or Agentia MCP tools: user stories, work commit/publish/submit/done, promotion runs and conflicts, job executions, environments, credentials, pipelines, stages, and release data templates. Use it whenever the user asks an agent to operate Copado CICD from a terminal, IDE, or headless workflow.
4
4
  ---
5
5
 
6
6
  <!-- Agentia managed skill file: agentia setup skills -->
@@ -20,7 +20,7 @@ Prefer Agentia MCP tools when they are available and match the task. Use CLI exa
20
20
 
21
21
  ## References
22
22
 
23
- - User stories, local commits, cloud commits, push, submit, done, quality gates, and deployment steps: [references/work.md](references/work.md)
23
+ - User stories, git commits, cloud commits, publish, submit, done, quality gates, and deployment steps: [references/work.md](references/work.md)
24
24
  - Promotion lookup, run, resume, merge conflicts, and story-centric promotion: [references/promotions.md](references/promotions.md)
25
25
  - Copado JobExecution lookup, actions, logs, and monitoring: [references/jobs.md](references/jobs.md)
26
26
  - Copado environments, environment credentials, and browser authentication: [references/environments-and-credentials.md](references/environments-and-credentials.md)
@@ -31,9 +31,10 @@ Prefer Agentia MCP tools when they are available and match the task. Use CLI exa
31
31
 
32
32
  - Use Salesforce record IDs or generated names read from Copado. Do not invent story names, promotion IDs, job IDs, credential IDs, or pipeline IDs.
33
33
  - Keep human output off stdout in JSON workflows. Prefer `--json`, then parse the result object.
34
- - For local project work, keep the tracked working tree clean before commands that require it: `work set`, `work push`, and `work submit`.
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 or local work context was created.
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 when those scripts are configured. It can also be invoked directly. It is different from CRT.
37
38
  - Treat `auth` credentials as keychain/API credentials and `cicd credential` records as Copado environment credentials.
38
39
 
39
40
  ## Report Back
@@ -2,26 +2,26 @@
2
2
 
3
3
  # CICD Work Reference
4
4
 
5
- Use this reference for `agentia cicd work ...` and matching MCP tools such as `agentia_work_get`, `agentia_work_commit`, `agentia_work_push`, and `agentia_work_submit`.
5
+ Use this reference for `agentia cicd work ...` and matching MCP tools such as `agentia_work_get`, `agentia_work_commit`, `agentia_work_publish`, and `agentia_work_submit`.
6
6
 
7
7
  ## Choose One Workflow
8
8
 
9
- Local and cloud work are separate delivery paths. Do not continue a cloud commit with local `work push` or `work submit`: those commands inspect and push the local Git feature branch.
9
+ Local and cloud work are separate delivery paths. Do not continue a cloud commit with local `work publish` or `work submit`: those commands inspect and push the local Git feature branch.
10
10
 
11
11
  ### Local Repository Flow
12
12
 
13
13
  Use this path when the change exists in the local repository:
14
14
 
15
15
  1. Discover and inspect: `agentia cicd work list --assigned-to-me --json`, then `agentia cicd work get <id-or-name> --json`.
16
- 2. Activate: `agentia cicd work set <id-or-name> --json`. This fetches the configured base branch, checks out `feature/<story-name>`, and records the story, base branch, dev org branch, and pull-request context in `.agentia/config.user.json`. Use `--base-branch <branch>` only when intentionally overriding the Pipeline default. If the Story source credential differs from the project default, work set warns with the current credential and environment and does not PATCH; use `agentia cicd work update <id> --source-credential <credential-id>` to change it.
17
- 3. Implement and stage new files with `git add`. Commit with Git, or use `agentia cicd work commit --local --all --json` when Agentia should also remember permission, full-metadata, or Apex-test selections. `--local` is the default, and `--all` includes tracked changes only.
18
- 4. Run project-owned gates: `agentia cicd work test --json`. This runs `.agentia_quality_gates.sh` or `.agentia_quality_gates.cmd` from the repository root when present. `--local` is the default; `--cloud` is reserved and not implemented yet.
19
- 5. Register and synchronize: `agentia cicd work push --json`. A plain `git push` does not register a Copado Commit or merge the feature branch into the recorded dev org branch.
20
- 6. Validate and open the merge-request flow: `agentia cicd work submit --json`. Submit runs the local gates unless `--skip-local-tests` is explicit, pushes ahead commits, and submits with validate-only behavior.
21
- 7. Only with explicit approval to promote and deploy, run `agentia cicd work submit --done --json`. `work done` is a compatibility alias.
16
+ 2. Activate: `agentia cicd work set <id-or-name> --json`. This fetches the configured base branch, checks out `feature/<story-name>`, and records the story, base branch, dev org branch, and pull-request context in `.agentia/config.user.json`. Use `--base-branch <branch>` only when intentionally overriding the Pipeline default. If the JSON result has `status: "warning"` (missing pipeline or credential), show that `message`, do not assume a feature branch was created, and stop until the Story setup is fixed — publish and submit will not work. If the Story source credential differs from the project default, work set warns with the current credential and environment and does not PATCH; use `agentia cicd work update <id> --source-credential <credential-id>` to change it.
17
+ 3. Implement with Salesforce CLI, VS Code, or an IDE. Stage and commit with `git add` / `git commit`. Do not use `agentia cicd work commit` for local Git work.
18
+ 4. Run project-owned gates: `agentia cicd work test --json`. This runs `.agentia_quality_gates.sh` or `.agentia_quality_gates.cmd` from the repository root when present. If those files are missing, it warns and runs `agentia cicd work test apex` via the stock sample from a temporary file. Local tests can be slow; pass `--apex-test-classes=MyTest,OtherTest` for faster, earlier Apex checks.
19
+ 5. Register and synchronize: `agentia cicd work publish --json`. A plain `git push` does not register a Copado Commit or merge the feature branch into the recorded dev org branch. Pass `--permissions` and `--full-metadata` when nested detection is not enough.
20
+ 6. Validate and open the merge-request flow: `agentia cicd work submit --json`. Submit runs the local gates unless `--skip-local-tests` is explicit, pushes ahead commits, and submits with validate-only behavior. `--skip-pull-request` skips opening the compare URL.
21
+ 7. Only with explicit approval to promote and deploy, run `agentia cicd work submit --deploy --json` (or `--done`). `work done` is a compatibility alias.
22
22
  8. Check asynchronous results with `agentia cicd work status [id-or-name] --json`.
23
23
 
24
- `work set`, `work push`, and `work submit` require a clean tracked working tree. `work push` also requires the exact `feature/<story-name>` branch, recorded `lastBaseBranch` and `lastDevOrgBranch`, and at least one commit in `lastBaseBranch..HEAD`. `work submit` permits an empty commit range only for a Story with a Salesforce Data Set or Data Template deployment step.
24
+ `work set`, `work publish`, and `work submit` require a clean tracked working tree. `work publish` also requires the exact `feature/<story-name>` branch, recorded `lastBaseBranch` and `lastDevOrgBranch`, and at least one commit in `origin/<lastBaseBranch>..HEAD`. `work submit` fetches `origin/<lastBaseBranch>` and permits an empty commit range only for a Story with a Salesforce Data Set or Data Template deployment step.
25
25
 
26
26
  ### Copado Cloud Flow
27
27
 
@@ -42,11 +42,12 @@ Cloud commit checks Story readiness and source credentials before submission. Av
42
42
  | `work get [ID]` | Read story details | ID is optional after `work set`. Human output redacts OAuth signatures; JSON preserves structured fields. |
43
43
  | `work create` | Create a story | Use `--title`, project/team/assignee/theme fields, specs, and short acceptance criteria. `--source-credential` sends `sourceEnvironment` as null so Salesforce assigns the environment. |
44
44
  | `work update [ID]` | Mutate story fields or status | ID is optional after `work set`. Acceptance criteria must be fewer than 255 chars. `--source-credential` sends `sourceEnvironment` as null. |
45
- | `work set ID` | Mark active and prepare branch | Fetches base branch, creates/checks out `feature/<story-name>`, stores local context. Warns without PATCHing when the Story credential differs from the project default; use `work update --source-credential` to change it. `--none` clears every `last*` key and checks out `lastBaseBranch`, else `main`, else `master`. |
46
- | `work commit` | Local or cloud commit | The flag sets are disjoint. `--local` is default and performs no gateway call; `--cloud` calls Copado commit APIs and polls by default. |
47
- | `work push` | Push local commits and register with Copado | Requires active story context and clean tree. Sends stored retrieve-only permissions. |
48
- | `work test` | Run local quality gate scripts | `--local` is default. Runs `.agentia_quality_gates.sh` or `.agentia_quality_gates.cmd` from repo root. `--cloud` is not implemented yet. |
49
- | `work submit` | Submit for review/validation or promote | Runs local gates unless `--skip-local-tests`; can push ahead commits. `--done` matches Copado UI Submit when promoting. |
45
+ | `work set ID` | Mark active and prepare branch | Fetches base branch, creates/checks out `feature/<story-name>`, stores local context. A gateway warning prints the message and skips git. Warns without PATCHing when the Story credential differs from the project default; use `work update --source-credential` to change it. `--none` clears every `last*` key and checks out `lastBaseBranch`, else `main`, else `master`. |
46
+ | `work commit` | Copado cloud metadata commit | Requires `--cloud`. For local Git work, use `git commit` then `work publish`. |
47
+ | `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. |
48
+ | `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. |
49
+ | `work test apex` | Run named Apex test classes | Required `--apex-test-classes`. Optional `--wait` minutes (default 60). Usually invoked from `.agentia_quality_gates.*` when local quality gates are configured. |
50
+ | `work submit` | Submit for review/validation or promote | Runs local gates unless `--skip-local-tests`; can push ahead commits. `--skip-pull-request` skips opening the MR URL. `--done` and `--deploy` match Copado UI Submit when promoting. |
50
51
  | `work done` | Compatibility alias | Prefer `work submit --done`; both promote and deploy rather than validate-only. |
51
52
  | `work promote` | Story-centric promotion run | Requires `--cloud`; use `--deploy` for merge and deploy. |
52
53
  | `work status [ID]` | Check story and related executions | Useful after submit, promote, or commit jobs. |
@@ -54,21 +55,21 @@ Cloud commit checks Story readiness and source credentials before submission. Av
54
55
 
55
56
  ## Local Repository Details
56
57
 
57
- Use local commits for normal source changes. Stage new files explicitly because `--all` behaves like `git commit -a`:
58
+ Use Git for normal source changes:
58
59
 
59
60
  ```sh
60
61
  git add -A
61
- agentia cicd work commit --local --all --permissions CustomField:Account.SLA__c,ApexClass:AccountService --json
62
+ git commit -m "US-0001 add account service"
62
63
  agentia cicd work test --json
63
- agentia cicd work push --json
64
+ agentia cicd work publish --permissions CustomField:Account.SLA__c,ApexClass:AccountService --json
64
65
  agentia cicd work submit --json
65
66
  ```
66
67
 
67
- `--permissions` records metadata that Copado should treat as Retrieve Only during push. List the components whose access changed, not the permission set or profile files. Use `--full-metadata` only when a profile or permission set should travel as a complete file, because it can overwrite permissions the Story did not touch. Both selections are sticky in local user config until replaced or cleared with an empty value. Push-time selections apply only to that push.
68
+ `--permissions` on publish names metadata that Copado should treat as Retrieve Only. List the components whose access changed, not the permission set or profile files. Use `--full-metadata` only when a profile or permission set should travel as a complete file, because it can overwrite permissions the Story did not touch. Both flags apply to that publish only.
68
69
 
69
- `--apex-test-classes` records story-related test class names for later reference. `work test` and `work submit` still take `--apex-test-classes` explicitly when you want the local gate script to receive them.
70
+ `work test` and `work submit` take `--apex-test-classes` when you want the local gate script to receive them as `AGENTIA_APEX_TEST_CLASSES`. Sample quality-gate scripts pass that value to `work test apex`.
70
71
 
71
- `work push` detects nested metadata across the full branch diff from the merge base to `HEAD`, applies Copado environment-variable and YAML replacements, registers every commit in the range, and merges into the recorded dev org branch. Review unexpected Retrieve Only, Full Metadata, or nested-deletion output before continuing.
72
+ `work publish` detects nested metadata across the full branch diff from the merge base to `HEAD`, applies Copado environment-variable and YAML replacements, registers every commit in the range, and merges into the recorded dev org branch. Review unexpected Retrieve Only, Full Metadata, or nested-deletion output before continuing.
72
73
 
73
74
  ## Cloud Operation Details
74
75
 
@@ -109,8 +110,9 @@ Prefer explicit flags for standard step types. Use `--config-json`, `--file`, or
109
110
  ## Gotchas
110
111
 
111
112
  - `work test` is not CRT. For Robot Framework execution, use the `agentia-testing` skill.
112
- - Local `work commit` rejects Story IDs and cloud-only flags; cloud `work commit --cloud` rejects local-only flags.
113
+ - `work test apex` runs named Apex classes. Local quality gates (`.agentia_quality_gates.*`) usually call it when `AGENTIA_APEX_TEST_CLASSES` is set. Direct use is for a targeted rerun without the rest of the gates.
114
+ - Local Git work uses `git commit` then `work publish`. Cloud `work commit --cloud` is a separate path.
113
115
  - `work submit` may push ahead commits, but the local flow still needs story and branch context from `work set`.
114
- - `work submit --done` promotes/deploys. Do not run it unless the user explicitly asked to promote or finish the story.
115
- - `work promote --cloud` is not the next step after a local commit; local delivery uses `work push` and `work submit`.
116
+ - `work submit --done` (or `--deploy`) promotes/deploys. Do not run it unless the user explicitly asked to promote or finish the story.
117
+ - `work promote --cloud` is not the next step after a local git commit; local delivery uses `work publish` and `work submit`.
116
118
  - `work delete` is destructive; read the story and confirm intent first.