@copado/agentia-cli 1.3.0 → 1.5.0-rc.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 (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +437 -428
  3. package/dist/commands/cicd/cloud/commit.js +4 -3
  4. package/dist/commands/cicd/cloud/promote.js +40 -18
  5. package/dist/commands/cicd/credential/list.js +2 -1
  6. package/dist/commands/cicd/environment/list.js +2 -1
  7. package/dist/commands/cicd/extension-configuration/list.js +2 -1
  8. package/dist/commands/cicd/function/list.js +10 -13
  9. package/dist/commands/cicd/job/list.js +2 -1
  10. package/dist/commands/cicd/job/result-file/get.js +11 -6
  11. package/dist/commands/cicd/pipeline/automation/list.js +2 -1
  12. package/dist/commands/cicd/pipeline/list.js +2 -1
  13. package/dist/commands/cicd/pipeline/quality-gate/list.js +2 -1
  14. package/dist/commands/cicd/project/list.js +2 -1
  15. package/dist/commands/cicd/promotion/list.js +2 -1
  16. package/dist/commands/cicd/promotion/status.js +29 -0
  17. package/dist/commands/cicd/repository/list.js +5 -8
  18. package/dist/commands/cicd/stage/list.js +2 -1
  19. package/dist/commands/cicd/template/list.js +9 -12
  20. package/dist/commands/cicd/work/delete.js +2 -2
  21. package/dist/commands/cicd/work/environment-sync.js +138 -62
  22. package/dist/commands/cicd/work/get.js +2 -2
  23. package/dist/commands/cicd/work/list.js +2 -1
  24. package/dist/commands/cicd/work/test/apex.js +18 -33
  25. package/dist/commands/cicd/work/test.js +114 -9
  26. package/dist/commands/cicd/work/update.js +2 -2
  27. package/dist/lib/defaults-store.js +3 -1
  28. package/dist/lib/function-list.js +3 -0
  29. package/dist/lib/git-worktree.js +4 -1
  30. package/dist/lib/job-get.js +2 -1
  31. package/dist/lib/job-types.js +2 -1
  32. package/dist/lib/list-pagination.js +6 -1
  33. package/dist/lib/local-quality-gates.js +4 -1
  34. package/dist/lib/mcp/result.js +18 -2
  35. package/dist/lib/mcp/testing-browser-tools.js +1 -16
  36. package/dist/lib/mcp/tool-annotations.js +0 -1
  37. package/dist/lib/mcp/tools.js +30 -25
  38. package/dist/lib/mcp/work-tools.js +100 -47
  39. package/dist/lib/promotion-run.js +3 -1
  40. package/dist/lib/promotion-status.js +12 -0
  41. package/dist/lib/quality-gates.js +13 -0
  42. package/dist/lib/repository-list.js +3 -0
  43. package/dist/lib/runtime.js +1 -1
  44. package/dist/lib/stock-quality-gates.js +2 -1
  45. package/dist/lib/support-ai.js +1 -2
  46. package/dist/lib/template-list.js +3 -0
  47. package/dist/lib/testing-browser-operations.js +1 -2
  48. package/dist/lib/testing-browser-session.js +1 -2
  49. package/dist/lib/work-apex-test-failures.js +2 -1
  50. package/dist/lib/work-environment-sync-ready.js +7 -1
  51. package/dist/lib/work-environment-sync.js +8 -1
  52. package/dist/lib/work-local-run-tests.js +2 -1
  53. package/dist/lib/work-promote-deploy.js +3 -1
  54. package/dist/lib/work-types.js +3 -1
  55. package/oclif.manifest.json +151 -93
  56. package/package.json +1 -1
  57. package/templates/skills/agentia-ai/references/ai-agents.md +1 -1
  58. package/templates/skills/agentia-cicd/SKILL.md +4 -3
  59. package/templates/skills/agentia-cicd/references/jobs.md +3 -2
  60. package/templates/skills/agentia-cicd/references/promotions.md +16 -4
  61. package/templates/skills/agentia-cicd/references/work.md +25 -11
  62. package/templates/skills/agentia-testing/references/browser-testing.md +0 -1
  63. package/templates/skills/agentia-testing/references/tests.md +1 -1
  64. package/vendor/java/var-replace-command.jar +0 -0
  65. package/dist/commands/testing/browser/reports.js +0 -33
@@ -2447,11 +2447,11 @@
2447
2447
  "required": false
2448
2448
  }
2449
2449
  },
2450
- "description": "Create a Copado cloud metadata commit for a user story.\nPreflights the story, submits POST /release/commit, and polls the job monitor by default.\nFor local Git work, use git add/commit then `cicd work publish`. Permission and full-metadata selections belong on `cicd work publish`.\n\nNOTE: Do not use this command along with local development (git operations, cicd work push/submit).",
2450
+ "description": "Create a Copado cloud metadata commit for a user story.\nPreflights the story, submits POST /release/commit, and polls the job monitor by default.\nSimple --metadata-* flags commit exactly one component. Use --file or --stdin with a changes[] array for multiple components.\nFor local Git work, use git add/commit then `cicd work publish`. Permission and full-metadata selections belong on `cicd work publish`.\n\nNOTE: Do not use this command along with local development (git operations, cicd work push/submit).",
2451
2451
  "examples": [
2452
2452
  "<%= config.bin %> <%= command.id %> --message \"Commit AccountService\" --metadata-name AccountService --metadata-type ApexClass --metadata-category SFDX --action Add",
2453
2453
  "<%= 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",
2454
- "<%= config.bin %> <%= command.id %> --file commit-request.json # {\"message\":\"Commit AccountService\",\"changes\":[{\"a\":\"Add\",\"c\":\"SFDX\",\"n\":\"AccountService\",\"t\":\"ApexClass\"}]}",
2454
+ "<%= config.bin %> <%= command.id %> --file commit-request.json # {\"message\":\"Commit metadata\",\"changes\":[{\"a\":\"Add\",\"c\":\"SFDX\",\"n\":\"AccountService\",\"t\":\"ApexClass\"},{\"a\":\"Add\",\"c\":\"SFDX\",\"n\":\"AccountTrigger\",\"t\":\"ApexTrigger\"}]}",
2455
2455
  "cat commit-request.json | <%= config.bin %> <%= command.id %> --stdin --json"
2456
2456
  ],
2457
2457
  "flags": {
@@ -2513,7 +2513,7 @@
2513
2513
  },
2514
2514
  "file": {
2515
2515
  "char": "f",
2516
- "description": "Path to a JSON commit request body.",
2516
+ "description": "Path to a JSON commit request with message and changes[] (one object per metadata component).",
2517
2517
  "name": "file",
2518
2518
  "hasDynamicHelp": false,
2519
2519
  "multiple": false,
@@ -2576,7 +2576,7 @@
2576
2576
  "type": "option"
2577
2577
  },
2578
2578
  "stdin": {
2579
- "description": "Read a JSON commit request body from stdin.",
2579
+ "description": "Read a JSON commit request with message and changes[] from stdin.",
2580
2580
  "name": "stdin",
2581
2581
  "allowNo": false,
2582
2582
  "type": "boolean"
@@ -2673,7 +2673,7 @@
2673
2673
  "type": "option"
2674
2674
  },
2675
2675
  "promotion-id": {
2676
- "description": "Explicit 18-character Promotion ID when the User Story belongs to multiple promotions.",
2676
+ "description": "Explicit 18-character Promotion ID when the User Story belongs to multiple promotions. Used as is; never creates a promotion.",
2677
2677
  "name": "promotion-id",
2678
2678
  "hasDynamicHelp": false,
2679
2679
  "multiple": false,
@@ -6777,6 +6777,55 @@
6777
6777
  "run.js"
6778
6778
  ]
6779
6779
  },
6780
+ "cicd:promotion:status": {
6781
+ "aliases": [],
6782
+ "args": {
6783
+ "id": {
6784
+ "description": "Copado promotion ID",
6785
+ "name": "id",
6786
+ "required": true
6787
+ }
6788
+ },
6789
+ "description": "Show actionable status for a Copado promotion: user stories, current job step, queue summary, and whether a Manual Task or queue item needs attention.",
6790
+ "examples": [
6791
+ "<%= config.bin %> <%= command.id %> <promotion-id>",
6792
+ "<%= config.bin %> <%= command.id %> <promotion-id> --json"
6793
+ ],
6794
+ "flags": {
6795
+ "json": {
6796
+ "description": "Format output as json.",
6797
+ "helpGroup": "GLOBAL",
6798
+ "name": "json",
6799
+ "allowNo": false,
6800
+ "type": "boolean"
6801
+ },
6802
+ "cicd-connection": {
6803
+ "description": "Named CICD connection for this invocation only (see agentia auth set --connection). Does not change stored default auth.",
6804
+ "name": "cicd-connection",
6805
+ "required": false,
6806
+ "hasDynamicHelp": false,
6807
+ "multiple": false,
6808
+ "type": "option"
6809
+ }
6810
+ },
6811
+ "hasDynamicHelp": false,
6812
+ "hiddenAliases": [],
6813
+ "id": "cicd:promotion:status",
6814
+ "pluginAlias": "@copado/agentia-cli",
6815
+ "pluginName": "@copado/agentia-cli",
6816
+ "pluginType": "core",
6817
+ "strict": true,
6818
+ "enableJsonFlag": true,
6819
+ "experimental": false,
6820
+ "isESM": true,
6821
+ "relativePath": [
6822
+ "dist",
6823
+ "commands",
6824
+ "cicd",
6825
+ "promotion",
6826
+ "status.js"
6827
+ ]
6828
+ },
6780
6829
  "cicd:repository:create": {
6781
6830
  "aliases": [],
6782
6831
  "args": {
@@ -8262,7 +8311,7 @@
8262
8311
  },
8263
8312
  "file": {
8264
8313
  "char": "f",
8265
- "description": "Path to a JSON commit request body.",
8314
+ "description": "Path to a JSON commit request with message and changes[] (one object per metadata component).",
8266
8315
  "name": "file",
8267
8316
  "hasDynamicHelp": false,
8268
8317
  "multiple": false,
@@ -8325,7 +8374,7 @@
8325
8374
  "type": "option"
8326
8375
  },
8327
8376
  "stdin": {
8328
- "description": "Read a JSON commit request body from stdin.",
8377
+ "description": "Read a JSON commit request with message and changes[] from stdin.",
8329
8378
  "name": "stdin",
8330
8379
  "allowNo": false,
8331
8380
  "type": "boolean"
@@ -8494,7 +8543,7 @@
8494
8543
  "type": "option"
8495
8544
  },
8496
8545
  "record-type": {
8497
- "description": "Record type",
8546
+ "description": "Record type DeveloperName",
8498
8547
  "name": "record-type",
8499
8548
  "hasDynamicHelp": false,
8500
8549
  "multiple": false,
@@ -8600,12 +8649,12 @@
8600
8649
  "aliases": [],
8601
8650
  "args": {
8602
8651
  "id": {
8603
- "description": "User story ID",
8652
+ "description": "User story ID or name",
8604
8653
  "name": "id",
8605
8654
  "required": true
8606
8655
  }
8607
8656
  },
8608
- "description": "Delete a Copado user story by ID",
8657
+ "description": "Delete a Copado user story by ID or name",
8609
8658
  "examples": [
8610
8659
  "<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU",
8611
8660
  "<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --json"
@@ -8699,13 +8748,16 @@
8699
8748
  "cicd:work:environment-sync": {
8700
8749
  "aliases": [],
8701
8750
  "args": {},
8702
- "description": "Sync committed metadata from the next environment onto the destination environment (or current feature branch). Back-promotes every user story behind the destination environment from the next environment branch. GET user stories ahead and behind. If none are behind, log that and stop. Otherwise create a back-promotion and POST those behind stories onto the promotion. 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). Merges origin/<next-env> with --no-ff --no-commit, restores every other path from HEAD, commits the guessed pathspecs, and pushes the dest org branch (and the feature branch when HEAD starts with feature/). If guessed pathspecs still conflict, PATCH the back-promotion status to Merge Conflict, store lastEnvironmentSyncName, resolve the files, and re-run with --continue (optional --promotion). The promotion destination environment supplies the dest org branch and the next-env branch. To discard a conflicted merge, re-run with --abort (optional --promotion); runs git merge --abort and sets the back-promotion status to Draft. After a successful sync, PATCH the back-promotion status to Completed and clear lastEnvironmentSyncName. 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.",
8751
+ "description": "Sync committed metadata from the next environment onto the destination environment (or current feature branch). Back-promotes every user story behind the destination environment from the next environment branch. On a feature branch, requires published commits first: stops when HEAD is ahead of origin/<feature> and suggests `cicd work publish`. 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. 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). 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. 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. 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). 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. 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). By default polls the cloud deployment JobExecution to a terminal status when deployment is cloud (--no-wait to skip). 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.",
8703
8752
  "examples": [
8704
8753
  "<%= config.bin %> <%= command.id %> --destination-environment=dev1",
8705
8754
  "<%= config.bin %> <%= command.id %> --dev-org-branch=dev1-sfp",
8706
8755
  "<%= config.bin %> <%= command.id %> --continue",
8707
8756
  "<%= config.bin %> <%= command.id %> --abort",
8708
8757
  "<%= config.bin %> <%= command.id %> --promotion=P29334 --continue",
8758
+ "<%= config.bin %> <%= command.id %> --destination-environment=dev1 --deployment=local --sf-alias=dev1",
8759
+ "<%= config.bin %> <%= command.id %> --destination-environment=dev1 --deployment=cloud",
8760
+ "<%= config.bin %> <%= command.id %> --destination-environment=dev1 --no-wait",
8709
8761
  "<%= config.bin %> <%= command.id %> --destination-environment=dev1 --json"
8710
8762
  ],
8711
8763
  "flags": {
@@ -8725,7 +8777,7 @@
8725
8777
  "type": "option"
8726
8778
  },
8727
8779
  "abort": {
8728
- "description": "Abort an in-progress merge (`git merge --abort`) and set the back-promotion status to Draft. Uses --promotion or lastEnvironmentSyncName. Exclusive with --continue.",
8780
+ "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.",
8729
8781
  "exclusive": [
8730
8782
  "continue"
8731
8783
  ],
@@ -8742,8 +8794,22 @@
8742
8794
  "allowNo": false,
8743
8795
  "type": "boolean"
8744
8796
  },
8797
+ "deployment": {
8798
+ "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).",
8799
+ "name": "deployment",
8800
+ "default": "auto",
8801
+ "hasDynamicHelp": false,
8802
+ "multiple": false,
8803
+ "options": [
8804
+ "none",
8805
+ "local",
8806
+ "cloud",
8807
+ "auto"
8808
+ ],
8809
+ "type": "option"
8810
+ },
8745
8811
  "destination-credential": {
8746
- "description": "Credential ID posted as destinationCredentialId when creating the back-promotion. Copado requires a credential on the next/source environment (PRO-033 if a dest/dev credential is sent) and then stores the dest/dev credential. Defaults to that source environment defaultCredential, otherwise the first source credential.",
8812
+ "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.",
8747
8813
  "name": "destination-credential",
8748
8814
  "hasDynamicHelp": false,
8749
8815
  "multiple": false,
@@ -8782,6 +8848,27 @@
8782
8848
  "hasDynamicHelp": false,
8783
8849
  "multiple": false,
8784
8850
  "type": "option"
8851
+ },
8852
+ "sf-alias": {
8853
+ "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.",
8854
+ "name": "sf-alias",
8855
+ "hasDynamicHelp": false,
8856
+ "multiple": false,
8857
+ "type": "option"
8858
+ },
8859
+ "wait": {
8860
+ "description": "Poll promotion and deployment executions to terminal status.",
8861
+ "name": "wait",
8862
+ "allowNo": true,
8863
+ "type": "boolean"
8864
+ },
8865
+ "wait-timeout": {
8866
+ "description": "Maximum total seconds to wait for promotion and deployment executions.",
8867
+ "name": "wait-timeout",
8868
+ "default": 900,
8869
+ "hasDynamicHelp": false,
8870
+ "multiple": false,
8871
+ "type": "option"
8785
8872
  }
8786
8873
  },
8787
8874
  "hasDynamicHelp": false,
@@ -8792,7 +8879,7 @@
8792
8879
  "pluginType": "core",
8793
8880
  "strict": true,
8794
8881
  "enableJsonFlag": true,
8795
- "experimental": false,
8882
+ "experimental": true,
8796
8883
  "isESM": true,
8797
8884
  "relativePath": [
8798
8885
  "dist",
@@ -8806,12 +8893,12 @@
8806
8893
  "aliases": [],
8807
8894
  "args": {
8808
8895
  "id": {
8809
- "description": "User story ID (defaults to the active work item from `work set`)",
8896
+ "description": "User story ID or name (defaults to the active work item from `work set`)",
8810
8897
  "name": "id",
8811
8898
  "required": false
8812
8899
  }
8813
8900
  },
8814
- "description": "Get a Copado user story by ID",
8901
+ "description": "Get a Copado user story by ID or name",
8815
8902
  "examples": [
8816
8903
  "<%= config.bin %> <%= command.id %>",
8817
8904
  "<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU",
@@ -9536,11 +9623,12 @@
9536
9623
  "cicd:work:test": {
9537
9624
  "aliases": [],
9538
9625
  "args": {},
9539
- "description": "Run quality gates for the current work item. With --local (the default) it runs project-root .agentia_quality_gates.sh (macOS/Linux) or .agentia_quality_gates.cmd (Windows) when present. When no project script exists it warns, runs the stock Agentia setup sample from a temporary file, then deletes that file. With --cloud it runs remote Copado quality gates (not implemented yet).",
9626
+ "description": "Run quality gates for the current work item. Runs the project-root .agentia_quality_gates.sh (macOS/Linux) or .agentia_quality_gates.cmd (Windows); when none exists it warns and runs the stock Agentia sample from a temporary file. Every gate runs by default. Use --gate <id> (repeatable or comma-separated) to select gates; the selection is exported as AGENTIA_GATES. Standard ids are apex, lint and lwc; scripts declare gates with `# agentia-gate: <id> - <description>` comments (see --list-gates). `--gate apex` alone skips the script, runs the Apex tests directly and uploads the result to the work item (nested inside a script it does not upload; the outer run reports). With --cloud it runs remote Copado quality gates (not implemented yet).",
9540
9627
  "examples": [
9541
9628
  "<%= config.bin %> <%= command.id %>",
9542
- "<%= config.bin %> <%= command.id %> --local --apex-test-classes=MyTest,OtherTest",
9543
- "<%= config.bin %> <%= command.id %> --local --rerun-failed-apex-tests",
9629
+ "<%= config.bin %> <%= command.id %> --gate lint --gate lwc",
9630
+ "<%= config.bin %> <%= command.id %> --gate apex --apex-test-classes=MyTest,OtherTest",
9631
+ "<%= config.bin %> <%= command.id %> --list-gates",
9544
9632
  "<%= config.bin %> <%= command.id %> -e SKIP_LWC_TESTS=1 -e TOOL_API_KEY=secret",
9545
9633
  "<%= config.bin %> <%= command.id %> --json",
9546
9634
  "<%= config.bin %> <%= command.id %> --cloud"
@@ -9561,6 +9649,16 @@
9561
9649
  "multiple": false,
9562
9650
  "type": "option"
9563
9651
  },
9652
+ "all": {
9653
+ "description": "Run every gate in the quality-gates script (the default when no --gate is given).",
9654
+ "exclusive": [
9655
+ "gate",
9656
+ "list-gates"
9657
+ ],
9658
+ "name": "all",
9659
+ "allowNo": false,
9660
+ "type": "boolean"
9661
+ },
9564
9662
  "apex-test-classes": {
9565
9663
  "description": "Comma-separated Apex test class names passed to local quality gates as AGENTIA_APEX_TEST_CLASSES",
9566
9664
  "name": "apex-test-classes",
@@ -9582,6 +9680,23 @@
9582
9680
  "multiple": true,
9583
9681
  "type": "option"
9584
9682
  },
9683
+ "gate": {
9684
+ "description": "Run only this gate id (for example apex, lint, lwc or a custom id declared in the script). Repeatable or comma-separated. Exported to the script as AGENTIA_GATES.",
9685
+ "exclusive": [
9686
+ "all",
9687
+ "list-gates"
9688
+ ],
9689
+ "name": "gate",
9690
+ "hasDynamicHelp": false,
9691
+ "multiple": true,
9692
+ "type": "option"
9693
+ },
9694
+ "list-gates": {
9695
+ "description": "List the gates declared in the quality-gates script (or the stock sample) and exit.",
9696
+ "name": "list-gates",
9697
+ "allowNo": false,
9698
+ "type": "boolean"
9699
+ },
9585
9700
  "local": {
9586
9701
  "description": "Run local project-root quality gates scripts. Used by default when --cloud is omitted.",
9587
9702
  "name": "local",
@@ -9589,10 +9704,19 @@
9589
9704
  "type": "boolean"
9590
9705
  },
9591
9706
  "rerun-failed-apex-tests": {
9592
- "description": "Pass AGENTIA_APEX_RERUN_FAILED=--rerun-failed-apex-tests to local quality gates so sample scripts forward that flag to work test apex.",
9707
+ "description": "Pass AGENTIA_APEX_RERUN_FAILED=--rerun-failed-apex-tests to local quality gates so sample scripts forward that flag to the apex gate.",
9593
9708
  "name": "rerun-failed-apex-tests",
9594
9709
  "allowNo": false,
9595
9710
  "type": "boolean"
9711
+ },
9712
+ "wait": {
9713
+ "char": "w",
9714
+ "description": "Minutes to wait for Apex test results (only with --gate apex alone).",
9715
+ "name": "wait",
9716
+ "default": 60,
9717
+ "hasDynamicHelp": false,
9718
+ "multiple": false,
9719
+ "type": "option"
9596
9720
  }
9597
9721
  },
9598
9722
  "hasDynamicHelp": false,
@@ -9617,12 +9741,12 @@
9617
9741
  "aliases": [],
9618
9742
  "args": {
9619
9743
  "id": {
9620
- "description": "User story ID (defaults to the active work item from `work set`)",
9744
+ "description": "User story ID or name (defaults to the active work item from `work set`)",
9621
9745
  "name": "id",
9622
9746
  "required": false
9623
9747
  }
9624
9748
  },
9625
- "description": "Update a Copado user story by ID",
9749
+ "description": "Update a Copado user story by ID or name",
9626
9750
  "examples": [
9627
9751
  "<%= config.bin %> <%= command.id %> --title \"Updated story\"",
9628
9752
  "<%= config.bin %> <%= command.id %> --custom-field JIRA_Key__c=CICD-1",
@@ -9750,7 +9874,7 @@
9750
9874
  "type": "option"
9751
9875
  },
9752
9876
  "record-type": {
9753
- "description": "Record type",
9877
+ "description": "Record type DeveloperName",
9754
9878
  "name": "record-type",
9755
9879
  "hasDynamicHelp": false,
9756
9880
  "multiple": false,
@@ -10463,73 +10587,6 @@
10463
10587
  "recorder.js"
10464
10588
  ]
10465
10589
  },
10466
- "testing:browser:reports": {
10467
- "aliases": [],
10468
- "args": {
10469
- "job-id": {
10470
- "description": "CRT job ID.",
10471
- "name": "job-id",
10472
- "required": false
10473
- }
10474
- },
10475
- "deprecateAliases": true,
10476
- "description": "List or save report artifacts from an active CRT browser session",
10477
- "examples": [
10478
- "<%= config.bin %> <%= command.id %> --project <project-id>",
10479
- "<%= config.bin %> <%= command.id %> --project <project-id> --output-dir ./reports"
10480
- ],
10481
- "flags": {
10482
- "json": {
10483
- "description": "Format output as json.",
10484
- "helpGroup": "GLOBAL",
10485
- "name": "json",
10486
- "allowNo": false,
10487
- "type": "boolean"
10488
- },
10489
- "project": {
10490
- "char": "p",
10491
- "description": "CRT project ID.",
10492
- "name": "project",
10493
- "required": true,
10494
- "hasDynamicHelp": false,
10495
- "multiple": false,
10496
- "type": "option"
10497
- },
10498
- "session-id": {
10499
- "description": "Active CRT browser session ID.",
10500
- "name": "session-id",
10501
- "hasDynamicHelp": false,
10502
- "multiple": false,
10503
- "type": "option"
10504
- },
10505
- "output-dir": {
10506
- "description": "Directory for log.html, report.html, and output.xml.",
10507
- "name": "output-dir",
10508
- "hasDynamicHelp": false,
10509
- "multiple": false,
10510
- "type": "option"
10511
- }
10512
- },
10513
- "hasDynamicHelp": false,
10514
- "hiddenAliases": [
10515
- "testing:live:reports"
10516
- ],
10517
- "id": "testing:browser:reports",
10518
- "pluginAlias": "@copado/agentia-cli",
10519
- "pluginName": "@copado/agentia-cli",
10520
- "pluginType": "core",
10521
- "strict": true,
10522
- "enableJsonFlag": true,
10523
- "experimental": false,
10524
- "isESM": true,
10525
- "relativePath": [
10526
- "dist",
10527
- "commands",
10528
- "testing",
10529
- "browser",
10530
- "reports.js"
10531
- ]
10532
- },
10533
10590
  "testing:browser:screenshot": {
10534
10591
  "aliases": [],
10535
10592
  "args": {
@@ -15977,7 +16034,7 @@
15977
16034
  "type": "option"
15978
16035
  },
15979
16036
  "file-id": {
15980
- "description": "File Id returned by result-file list",
16037
+ "description": "fileId (068...) returned by result-file list; a contentDocumentId (069...) is resolved automatically",
15981
16038
  "name": "file-id",
15982
16039
  "required": true,
15983
16040
  "hasDynamicHelp": false,
@@ -20579,7 +20636,7 @@
20579
20636
  "cicd:work:test:apex": {
20580
20637
  "aliases": [],
20581
20638
  "args": {},
20582
- "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.",
20639
+ "description": "Legacy alias of `work test --gate apex`; prefer that form (it is what the sample quality-gate scripts call). Run specified Apex test classes via Salesforce CLI (`sf apex run test`) with code coverage. 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.",
20583
20640
  "examples": [
20584
20641
  "<%= config.bin %> <%= command.id %> -t HelloWorldTest",
20585
20642
  "<%= config.bin %> <%= command.id %> --apex-test-classes=MyTest,OtherTest",
@@ -20628,6 +20685,7 @@
20628
20685
  }
20629
20686
  },
20630
20687
  "hasDynamicHelp": false,
20688
+ "hidden": true,
20631
20689
  "hiddenAliases": [],
20632
20690
  "id": "cicd:work:test:apex",
20633
20691
  "pluginAlias": "@copado/agentia-cli",
@@ -22220,5 +22278,5 @@
22220
22278
  ]
22221
22279
  }
22222
22280
  },
22223
- "version": "1.3.0"
22281
+ "version": "1.5.0-rc.0"
22224
22282
  }
package/package.json CHANGED
@@ -275,7 +275,7 @@
275
275
  }
276
276
  },
277
277
  "type": "module",
278
- "version": "1.3.0",
278
+ "version": "1.5.0-rc.0",
279
279
  "x-agentia-protected-build": true,
280
280
  "x-agentia-protected-files": [
281
281
  "dist/lib/runtime.js"
@@ -64,7 +64,7 @@ agentia history list --limit 10
64
64
  agentia history clear --yes
65
65
  ```
66
66
 
67
- All three Help Agent entry points share the same behavior. They open without a CICD user or credential preflight and do not use the separately configured AI PAT. Every request identifies the assistant as a concise Copado expert on Agentia Headless and Copado tools for developers working locally. The system prompt uses retained history to identify dominant CLI/IDE/MCP usage and asks one brief question when tooling or a local-versus-cloud operations flow is unclear. Each turn requests a fresh short-lived HMAC and refreshes CLI version, platform, architecture, workspace basename, normalized current origin, aggregate tool counts, and the three newest sanitized command summaries. Follow-up turns include a deterministic redacted digest of at most six successful prior messages. SSE response deltas render immediately. `/help`, `/clear`, and `/exit` are supported; `/clear` resets the conversation identifier and in-memory digest.
67
+ All three Help Agent entry points share the same behavior. They open without a CICD user or credential preflight and do not use the separately configured AI PAT. The native Support AI service injects the system-role support persona; the CLI does not send a second system message. Each turn requests a fresh short-lived HMAC and refreshes CLI version, platform, architecture, workspace basename, normalized current origin, aggregate tool counts, and the three newest sanitized command summaries as data in the current user message. Follow-up turns include a deterministic redacted digest of at most six successful prior messages. SSE response deltas render immediately. `/help`, `/clear`, and `/exit` are supported; `/clear` resets the conversation identifier and in-memory digest.
68
68
 
69
69
  The `history` commands inspect up to 100 sanitized command summaries and clear all temporary history. CLI/IDE rows can contain sanitized parameters, a redacted structured result, and ordered 20 KiB stdout/stderr tails. MCP rows contain only command ID, timing, outcome, CLI version, workspace basename, and `mcp` origin—never arguments, output, results, or errors. Successful Help Agent turn pairs are separately redacted, capped at 4 KiB per message, and retained in private storage for at most 24 hours/100 pairs; they are not restored into later chats. `history clear --yes` deletes both stores. Help Agent has no JSON or MCP mode. Never paste credentials or tokens into prompts.
70
70
 
@@ -21,7 +21,7 @@ Prefer Agentia MCP tools when they are available and match the task. Use CLI exa
21
21
  ## References
22
22
 
23
23
  - User stories, git commits, cloud commits, publish, submit, done, quality gates, and deployment steps: [references/work.md](references/work.md)
24
- - Promotion lookup, run, resume, merge conflicts, and story-centric promotion: [references/promotions.md](references/promotions.md)
24
+ - Promotion lookup, status (blockers/Manual Task/queue), 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 Functions lifecycle, remote run/results, and local Docker run: [references/functions.md](references/functions.md)
27
27
  - Git-hosted Copado CICD extensions (`cicd extension`, experimental): [references/extensions.md](references/extensions.md)
@@ -39,13 +39,14 @@ For **Org Intelligence** (read Salesforce metadata against a sandbox/developer o
39
39
  - User Story subscriber custom fields: read `result.customFields` from `work get` / MCP `agentia_work_get`. Write with CLI `--custom-field ApiName=value` (repeatable) or MCP `customFields: [{ apiName, value }]` on create/update. See [references/work.md](references/work.md#subscriber-custom-fields).
40
40
  - Use Salesforce record IDs or generated names read from Copado. Do not invent story names, promotion IDs, job IDs, credential IDs, or pipeline IDs.
41
41
  - Keep human output off stdout in JSON workflows. Prefer `--json`, then parse the result object.
42
+ - Cursor-paginated CICD lists (`--cursor` / MCP `cursor`) self-heal on gateway category `SF-014` (expired or invalid cursor): Agentia retries once without the cursor and returns page 1 with a `warnings` entry (also mirrored at the top level of CLI `--json`). Treat that as a reset to the first page, not a hard failure; do not keep replaying the same cursor.
42
43
  - 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.
43
44
  - Treat `cicd job` as Copado CICD JobExecution. It is different from CRT `testing job`.
44
45
  - Treat `cicd function` as Copado Function definitions and runs. It is different from JobExecution (`cicd job`) and Job Templates (`cicd template`).
45
46
  - Treat `cicd extension` as experimental git-hosted packaging of Functions/Templates (plus optional `force-app`). It is different from per-asset `cicd function` / `cicd template` upserts.
46
47
  - Treat `cicd template` as Copado Job Templates via `/release/jobs/templates`. It is different from Release Data Templates (`cicd data template`).
47
- - Treat `cicd work test` as local quality gates (`--local` is the default). It is different from CRT `testing job run`.
48
- - 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.
48
+ - Treat `cicd work test` as local quality gates (`--local` is the default). Use `--gate <id>` / `--list-gates` to run or discover individual gates (apex, lint, lwc, custom). It is different from CRT `testing job run`.
49
+ - Treat `cicd work test --gate apex` as the Apex test runner; the sample local quality gates (`.agentia_quality_gates.*`) call it for their apex gate. Run directly it uploads the result to the work item; inside a script (`AGENTIA_QUALITY_GATES_ACTIVE=1`) it does not, because the outer run reports once. An empty `--apex-test-classes` list skips Salesforce CLI. `cicd work test apex` is the legacy hidden alias. It is different from CRT.
49
50
  - Treat `auth` credentials as keychain/API credentials and `cicd credential` records as Copado environment credentials.
50
51
 
51
52
  ## Report Back
@@ -13,8 +13,8 @@ Use this reference for Copado CICD JobExecution commands under `agentia cicd job
13
13
  | `job list` | Search job executions | Filter by `--status`, `--type`, `--parent`, `--context`, `--mine`, cursor, and page size. |
14
14
  | `job get ID` | Inspect a job and ordered steps | Read before action commands or log lookup. |
15
15
  | `job log get ID` | Read execution logs | Use `--step <step-id>` when a specific step is needed. |
16
- | `job result-file list RESULT_ID` | Discover files linked to a job-step Result | Returns file metadata; use its `fileId` with `get`. |
17
- | `job result-file get RESULT_ID --file-id CONTENT_VERSION_ID` | Retrieve one Result-linked Salesforce File | Use `--output-file <path>` to write validated decoded bytes; JSON and MCP return Base64 content. |
16
+ | `job result-file list RESULT_ID` | Discover files linked to a job-step Result | Human table includes FILE ID (`fileId`, 068); JSON returns `fileId` and `contentDocumentId`. |
17
+ | `job result-file get RESULT_ID --file-id FILE_ID` | Retrieve one Result-linked file | Pass `fileId` from list (068). A ContentDocument id (069) is resolved via list before download. |
18
18
  | `job run ID` | Run all steps | Use `--restart` only when the user asks to restart from the beginning. |
19
19
  | `job resume ID` | Resume outstanding steps | Good after a paused or partially completed job. |
20
20
  | `job pause ID` | Pause/cancel resumably | Confirm intent before interrupting active work. |
@@ -45,5 +45,6 @@ agentia cicd job resume <job-execution-id> --json
45
45
  - Some job tools require user and organization context at the gateway layer. If the CLI reports missing context, inspect auth and user context before retrying.
46
46
  - Logs can be large. Prefer a specific step when available.
47
47
  - Result-file commands require the job-step Result ID, not the JobExecution ID. They accept only 15- or 18-character Salesforce IDs and never derive output paths from remote filenames.
48
+ - Use `fileId` (068) from `result-file list` for downloads. The list table shows FILE ID; JSON also includes `contentDocumentId` (069), which must not be used directly in the download path. `result-file get` and MCP `agentia_job_result_file_get` resolve a 069 id when it matches a listed file.
48
49
  - `--output-file` can replace an existing file after Base64 validation. Use an explicitly controlled destination; malformed content leaves an existing target unchanged.
49
50
  - Do not use CICD job commands for Robot Framework builds; use the `agentia-testing` skill for CRT run status and logs.
@@ -9,7 +9,7 @@ Use this reference for `agentia cicd promotion ...`, `agentia cicd promotion con
9
9
  | Command | Starts From | Use When |
10
10
  | --- | --- | --- |
11
11
  | `agentia cicd promotion run <promotion-id>` | Promotion ID | You already know the Promotion record and want explicit merge or merge-and-deploy control. |
12
- | `agentia cicd cloud promote [story-id]` | User Story | You want Agentia to resolve the story's Promotion before running it. |
12
+ | `agentia cicd cloud promote [story-id]` | User Story | Resolve the story's Promotion before running; creates a forward Draft promotion and adds the story when none exists. |
13
13
  | `agentia cicd work submit --done` | Active User Story branch | The story is approved and should move to the next stage (Copado UI Submit promote). |
14
14
 
15
15
  Prefer `cloud promote` when the user talks about a story. Prefer `promotion run` when the user provides a Promotion ID.
@@ -19,15 +19,27 @@ Prefer `cloud promote` when the user talks about a story. Prefer `promotion run`
19
19
  | Command | Use For | Notes |
20
20
  | --- | --- | --- |
21
21
  | `promotion list` | Find promotions | Filter by `--work-id`, status, project, pipeline, source/destination environment, or back-promotion flags. |
22
- | `promotion get ID` | Inspect one promotion | Read this before running, resuming, or resolving conflicts. |
22
+ | `promotion status ID` | Actionable run status | Prefer when the user asks "promotion status", what is running, or what is blocking. Includes user stories, current job step, queue, and Manual Task action-needed. MCP: `agentia_promotion_status`. |
23
+ | `promotion get ID` | Inspect one promotion record | Read this before running, resuming, or resolving conflicts. Does not load job steps; use `promotion status` for blockers. |
23
24
  | `promotion run ID` | Preflight and submit a run | Requires `--operation merge` or `--operation merge_and_deploy` unless `--resume` is used. |
24
25
  | `promotion open ID` | Open in browser | CLI-only navigation helper. |
25
- | `cloud promote [ID]` | Story-centric run | Use `--deploy` for merge and deploy; use `--promotion-id` if the story has multiple promotions. |
26
+ | `cloud promote [ID]` | Story-centric run | Use `--deploy` for merge and deploy; use `--promotion-id` if the story has multiple promotions (explicit ID is used as is and never creates one). JSON/MCP return `createdPromotion` when auto-created. |
27
+
28
+ ## Status Reports
29
+
30
+ When the user asks about a promotion's progress or blockers, call `agentia cicd promotion status <id> --json` (or MCP `agentia_promotion_status`) and report **all** of:
31
+
32
+ 1. Promotion name/id and status (and Salesforce status when present).
33
+ 2. User stories involved (name and id).
34
+ 3. Current job and current step (name, status, type).
35
+ 4. Whether `actionNeeded.kind` is `manual_task` or `queue` — quote `actionNeeded.message` and tell the user they must act; do not say only "In Progress".
36
+ 5. Queue summary when present; call `promotion queue list` if they need item-level detail.
26
37
 
27
38
  Example:
28
39
 
29
40
  ```sh
30
41
  agentia cicd promotion list --work-id <story-id> --json
42
+ agentia cicd promotion status <promotion-id> --json
31
43
  agentia cicd promotion run <promotion-id> --operation merge_and_deploy --json
32
44
  agentia cicd cloud promote <story-id> --deploy --json
33
45
  ```
@@ -61,7 +73,7 @@ List first and take item IDs from the output. Removal is destructive: confirm th
61
73
 
62
74
  ## Gotchas
63
75
 
64
- - Promotion IDs are not User Story IDs. Use `cloud promote` if you only have the story.
76
+ - Promotion IDs are not User Story IDs. Use `cloud promote` if you only have the story; do not create the promotion manually first when none contains the story.
65
77
  - `--deploy` on `cloud promote` maps to promotion operation `merge_and_deploy`; without it, the default is merge only.
66
78
  - `--recreate-promotion-branch` is a sensitive run option and should be paired with explicit user intent and `--yes` when required.
67
79
  - If conflicts exist, resolve them first and then resume the same execution.