@copado/agentia-cli 1.0.0-beta.7 → 1.0.0-beta.9

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 (34) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +455 -307
  3. package/dist/commands/adv/auth/status.js +1 -0
  4. package/dist/commands/adv/component/add.js +3 -0
  5. package/dist/commands/adv/component/remove.js +3 -0
  6. package/dist/commands/adv/component/types.js +1 -0
  7. package/dist/commands/adv/job/wait.js +1 -1
  8. package/dist/commands/adv/organization/list.js +1 -0
  9. package/dist/commands/cicd/template/defaults.js +42 -0
  10. package/dist/commands/cicd/template/delete.js +36 -0
  11. package/dist/commands/cicd/template/get.js +48 -0
  12. package/dist/commands/cicd/template/list.js +53 -0
  13. package/dist/commands/cicd/template/upsert.js +45 -0
  14. package/dist/commands/plugins/install.js +76 -0
  15. package/dist/lib/adv-operations.js +3 -1
  16. package/dist/lib/agentia-command.js +35 -0
  17. package/dist/lib/mcp/adv-tools.js +40 -26
  18. package/dist/lib/mcp/tool-annotations.js +5 -0
  19. package/dist/lib/mcp/tools.js +118 -0
  20. package/dist/lib/plugin-trust/catalog.js +6 -0
  21. package/dist/lib/plugin-trust/gate.js +14 -0
  22. package/dist/lib/plugin-trust/http.js +5 -0
  23. package/dist/lib/plugin-trust/policy.js +3 -0
  24. package/dist/lib/runtime.js +1 -1
  25. package/dist/lib/template-flags.js +8 -0
  26. package/dist/lib/template-types.js +21 -0
  27. package/oclif.manifest.json +773 -377
  28. package/package.json +1 -1
  29. package/templates/AGENTS.md +1 -1
  30. package/templates/skills/agentia-adv/SKILL.md +7 -1
  31. package/templates/skills/agentia-adv/references/pipelines-advanced.md +7 -7
  32. package/templates/skills/agentia-cicd/SKILL.md +5 -1
  33. package/templates/skills/agentia-cicd/references/functions.md +148 -0
  34. package/templates/skills/agentia-cicd/references/templates.md +132 -0
package/package.json CHANGED
@@ -235,7 +235,7 @@
235
235
  }
236
236
  },
237
237
  "type": "module",
238
- "version": "1.0.0-beta.7",
238
+ "version": "1.0.0-beta.9",
239
239
  "x-agentia-protected-build": true,
240
240
  "x-agentia-protected-files": [
241
241
  "dist/lib/runtime.js"
@@ -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, publish, submit, done, promotions, jobs, environments, pipelines, Slack notification configure, and data.
19
+ - `agentia-cicd/SKILL.md`: Copado stories, commits, publish, submit, done, promotions, jobs, Functions, Job Templates, environments, pipelines, Slack notification configure, and data.
20
20
  - `agentia-testing/SKILL.md`: Copado Robotic Testing operations.
21
21
  - `agentia-ai/SKILL.md`: Copado AI operations.
22
22
 
@@ -1,4 +1,10 @@
1
+ ---
2
+ name: agentia-adv
3
+ description: Use this skill when working with Copado Pipelines Advanced through the Agentia CLI or MCP, including PAT auth via auth set --adv, organizations, deployments, components, and deployment jobs. Use it for experimental ADV workflows separate from standard CICD pipeline commands.
4
+ ---
5
+
1
6
  <!-- Agentia managed skill file: agentia setup skills -->
7
+
2
8
  # Agentia Pipelines Advanced Skill
3
9
 
4
10
  Use this skill when working with Copado Pipelines Advanced through the Agentia CLI.
@@ -19,4 +25,4 @@ Use this skill when working with Copado Pipelines Advanced through the Agentia C
19
25
  - In JSON or non-interactive CLI runs, deploy, quick deploy, cancel, and auth removal require `--yes`. The matching MCP deployment mutations require `confirm: true`; validation does not.
20
26
  - Treat a nonzero exit from a waited run as failure. JSON errors retain the command transaction ID and failed waited runs include `error.result.job`.
21
27
 
22
- See `references/pipelines-advanced.md` for command flows and examples.
28
+ See [references/pipelines-advanced.md](references/pipelines-advanced.md) for command flows and examples.
@@ -29,22 +29,22 @@ agentia adv job get <deployment-id> --json
29
29
 
30
30
  - `deployment list` exposes the API `flowId` as `id`; do not use the raw list row link id.
31
31
  - `deployment list` returns at most 500 rows and has no filter.
32
- - `deployment options` reads current options, merges `--set` or `--file`, and sends the complete options object because the API replaces the entire object. `--set` converts exact booleans/null and finite JavaScript Number forms, including hex and exponent notation. Supported test levels include `NO_TEST_RUN`, `RUN_SPECIFIED_TESTS`, `RUN_LOCAL_TESTS`, and `RUN_ALL_TESTS_IN_ORG`.
32
+ - `deployment options` reads current options, merges `--set` or `--file`, and sends the complete options object because the API replaces the entire object. `--set` converts exact booleans/null and finite JavaScript Number forms, including hex and exponent notation. Unknown option names can be silently dropped; verify saved options with `deployment get --json`. Rejected values can return HTTP 400 with no provider detail. The server owns the complete option catalog.
33
33
  - `component types` can report the same type name in several views.
34
34
  - `component add` and `component remove` accept `--component Type/Name`. Add supports a text `--file`; remove does not. `--json-file` must be a bare array and accepts `{type, fullName}`, rows extracted from `result.components`, or `{nodeType: {name}, fullName}`. Remove returns the submitted array in `requested`, not a count.
35
- - `validate`, `deploy`, `quick-deploy`, and `cancel` are asynchronous; use `--wait` or `agentia adv job wait`.
35
+ - `validate`, `deploy`, `quick-deploy`, and `cancel` are asynchronous; use `--wait` or `agentia adv job wait`. A timeout stops only the CLI wait; the run continues and the JSON error includes the last observed job.
36
36
  - `deploy`, `quick-deploy`, and `cancel` prompt interactively. JSON and non-interactive runs require `--yes`; matching MCP tools require `confirm: true`.
37
- - `quick-deploy --backup` invokes the server's `backupThenDeploy` action instead of a quick deploy.
37
+ - `quick-deploy --backup` invokes the server's `backupThenDeploy` action instead of a quick deploy. The CLI refuses a quick deploy only when the latest job explicitly reports `canQuickDeploy: false`; validate with tests first.
38
38
  - Polling defaults to 3 seconds with a 3600-second timeout. Failed or cancelled waited runs exit nonzero; JSON errors include the normalized job.
39
39
  - `job list` excludes validation runs. Page numbering starts at 0, page size defaults to 50, and the server caps it at 100.
40
- - API JSON errors expose sanitized code/status/method/URL/name/message plus `transactionId`; validation errors expose name/message plus `transactionId`.
40
+ - API JSON errors expose sanitized code/status/method/URL/name/message plus `transactionId`; validation errors expose only safe fields plus `transactionId`, never parser state or command configuration.
41
41
 
42
42
  ## MCP Argument Names
43
43
 
44
- - Organizations and deployments use `id`; selected/components/jobs use `deploymentId`; component list/refresh use `flow`.
45
- - Deployment validate: `id`, optional `wait`, `interval`, `timeout` (no confirmation).
44
+ - Organizations use `id`. All deployment-scoped tools use canonical `deploymentId`; legacy `id` and `flow` aliases remain accepted but cannot disagree.
45
+ - Deployment validate: `deploymentId`, optional `wait`, `interval`, `timeout` (no confirmation).
46
46
  - Deploy: the validation inputs plus `confirm: true`.
47
47
  - Quick deploy: deploy inputs plus optional `backup`.
48
- - Cancel: `id`, `confirm: true`, optional `wait`, `interval`, `timeout`.
48
+ - Cancel: `deploymentId`, `confirm: true`, optional `wait`, `interval`, `timeout`.
49
49
  - Component add/remove: `deploymentId`, `components` (`Type/Name` strings or `{type, fullName, excluded?}` objects).
50
50
  - Job list: `deploymentId`, optional `page`, `pageSize`.
@@ -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 (including current/active story context), cloud commit/promote, work publish/submit/done, promotion runs and conflicts, job executions, environments, credentials, pipelines, stages, Slack pipeline notification subscriptions, 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 (including current/active story context), cloud commit/promote, work publish/submit/done, promotion runs and conflicts, job executions, Copado Functions, Job Templates, environments, credentials, pipelines, stages, Slack pipeline notification subscriptions, 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 -->
@@ -23,6 +23,8 @@ Prefer Agentia MCP tools when they are available and match the task. Use CLI exa
23
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
+ - Copado Functions lifecycle, remote run/results, and local Docker run: [references/functions.md](references/functions.md)
27
+ - Copado Job Templates (`cicd template`, not data templates): [references/templates.md](references/templates.md)
26
28
  - Copado environments, environment credentials, and browser authentication: [references/environments-and-credentials.md](references/environments-and-credentials.md)
27
29
  - Pipelines, environment connections, stages, and stage connections: [references/pipelines.md](references/pipelines.md)
28
30
  - Slack notification subscriptions on a pipeline (`agentia_notification_configure` / CLI): [references/notifications.md](references/notifications.md)
@@ -35,6 +37,8 @@ Prefer Agentia MCP tools when they are available and match the task. Use CLI exa
35
37
  - Keep human output off stdout in JSON workflows. Prefer `--json`, then parse the result object.
36
38
  - 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.
37
39
  - Treat `cicd job` as Copado CICD JobExecution. It is different from CRT `testing job`.
40
+ - Treat `cicd function` as Copado Function definitions and runs. It is different from JobExecution (`cicd job`) and Job Templates (`cicd template`).
41
+ - Treat `cicd template` as Copado Job Templates via `/release/jobs/templates`. It is different from Release Data Templates (`cicd data template`).
38
42
  - Treat `cicd work test` as local quality gates (`--local` is the default). It is different from CRT `testing test run`.
39
43
  - 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.
40
44
  - Treat `auth` credentials as keychain/API credentials and `cicd credential` records as Copado environment credentials.
@@ -0,0 +1,148 @@
1
+ <!-- Agentia managed skill file: agentia setup skills -->
2
+
3
+ # CICD Functions Reference
4
+
5
+ Use this reference for Copado Function commands under `agentia cicd function ...`.
6
+
7
+ Prefer `agentia_function_*` MCP tools when available. Otherwise use the CLI and add `--json` when an agent will parse or reuse the result.
8
+
9
+ `cicd function` manages Copado Function definitions and remote runs through the CICD gateway. It is not the same as `cicd job` (JobExecution), CRT `testing job`, or Job Templates (`cicd template`).
10
+
11
+ ## Operating Rules
12
+
13
+ - Confirm CICD auth before gateway-backed commands (`defaults`, `list`, `get`, `upsert`, `delete`, `run`, `result …`).
14
+ - Use Function API names returned by Copado. Do not invent API names for delete or run.
15
+ - Prefer reading `function get <api-name> --json` before upsert or delete.
16
+ - `function run` starts a remote run and returns a result Id; it does not wait for completion.
17
+ - `function run-local` runs a script in Docker on the local machine. It does not call the CICD gateway and does not persist a Copado Function.
18
+ - Never pass secrets as `--parameter` values for `run` or `run-local`. Parameter values can appear in command results and Docker argv.
19
+
20
+ ## Choose A Workflow
21
+
22
+ | Intent | Workflow |
23
+ | --- | --- |
24
+ | Scaffold metadata/script without persisting | Defaults |
25
+ | Find or inspect a Function | List And Get |
26
+ | Create or update a Function | Upsert |
27
+ | Execute a persisted Function remotely | Remote Run And Results |
28
+ | Validate a script in Docker without Copado | Local Docker Run |
29
+ | Remove a Function | Delete |
30
+
31
+ ## Defaults
32
+
33
+ 1. Run `function defaults --name <display-name> --json`.
34
+ 2. Optional: set `--runtime` (`bash` default) and `--image-name` (`copado-function-core:v1` default).
35
+ 3. Use the returned scaffold as a starting point for upsert. Nothing is written to Salesforce.
36
+
37
+ ```sh
38
+ agentia cicd function defaults --name MyFunction --runtime python --json
39
+ ```
40
+
41
+ ## List And Get
42
+
43
+ 1. Discover candidates with `function list --json` (Custom only by default).
44
+ 2. Use `--type all` when Standard Functions must be included.
45
+ 3. Filter with `--name`, `--image-name`, and `--size` when needed.
46
+ 4. Inspect one Function with `function get <api-name> --json`.
47
+ 5. Use `function open <function-id>` only for browser navigation (CLI-only; not an MCP tool).
48
+
49
+ ```sh
50
+ agentia cicd function list --json
51
+ agentia cicd function list --type all --name MyFunction --json
52
+ agentia cicd function get myFunction --json
53
+ ```
54
+
55
+ ## Upsert
56
+
57
+ 1. Read the current Function when updating an existing API name.
58
+ 2. Choose one payload source:
59
+ - `--file <function.json>` for a full JSON payload (cannot combine with individual payload flags), or
60
+ - individual flags with script from `--script` or `--script-file`.
61
+ 3. Optional: `--parameters-file` for a parameters array; also description, Apex class, callback, flow handler, timeout, image, size, type, and version.
62
+ 4. Run `function upsert <api-name> ... --json`.
63
+ 5. Read the Function back with `function get <api-name> --json`.
64
+
65
+ Defaults when using individual flags: display name = API name, runtime `bash`, image `copado-function-core:v1`, size `S`, type `Custom`, version `1`.
66
+
67
+ ```sh
68
+ agentia cicd function upsert myFunction --name "My Function" --script-file ./functions/my-function.sh --runtime bash --json
69
+ agentia cicd function upsert myFunction --file ./function.json --json
70
+ ```
71
+
72
+ ## Remote Run And Results
73
+
74
+ 1. Confirm the Function exists with `function get <api-name> --json`.
75
+ 2. Start a run with `function run <api-name> --json`.
76
+ 3. Pass repeatable `--parameter key=value` values when needed.
77
+ 4. Optional: `--context-id` and `--deploy-first` when the user requests pre-run deployment or an execution context.
78
+ 5. Capture `result.resultId` from JSON output.
79
+ 6. Poll `function result get <result-id> --json` until status is terminal.
80
+ 7. Fetch logs with `function result log get <result-id> [--type <log-type>] --json` when diagnosis is needed.
81
+
82
+ ```sh
83
+ agentia cicd function run myFunction --parameter env=qa --json
84
+ agentia cicd function result get <result-id> --json
85
+ agentia cicd function result log get <result-id> --type stdout --json
86
+ ```
87
+
88
+ ## Local Docker Run
89
+
90
+ 1. Ensure Docker is installed, running, and on `PATH`.
91
+ 2. Provide a readable `.sh`, `.js`, or `.py` script.
92
+ 3. Run `function run-local <script-path> --json`.
93
+ 4. Override `--image` when the default Copado image cannot be pulled.
94
+ 5. Optional: `--cwd`, `--runtime`, `--platform`, and repeatable `--parameter key=value`.
95
+ 6. In JSON mode, inspect `.result.exitCode` (do not assume CLI process exit reflects the container).
96
+
97
+ ```sh
98
+ agentia cicd function run-local ./functions/my-function.sh --cwd . --parameter ENV=dev --json
99
+ agentia cicd function run-local ./functions/my-function.py --runtime python --platform linux/amd64 --image my-registry/function-core:v1 --json
100
+ ```
101
+
102
+ Local execution validates the script in a container only. It does not upsert, deploy, or invoke a persisted remote Function.
103
+
104
+ ## Delete
105
+
106
+ 1. Confirm the exact API name with `function get` or `function list`.
107
+ 2. Confirm destructive intent with the user.
108
+ 3. Run `function delete <api-name> --json`.
109
+
110
+ Deletion is immediate and has no confirmation prompt.
111
+
112
+ ## Commands
113
+
114
+ | Command | Use For | Notes |
115
+ | --- | --- | --- |
116
+ | `function defaults` | Scaffold defaults | Gateway call; not persisted. |
117
+ | `function list` | Find Functions | Default `--type custom`; filters for name, image, size. |
118
+ | `function get API_NAME` | Inspect one Function | Read before upsert/delete/run. |
119
+ | `function upsert API_NAME` | Create or update | `--file` or script flags; script required without `--file`. |
120
+ | `function delete API_NAME` | Delete a Function | Destructive; confirm API name. |
121
+ | `function run API_NAME` | Start remote run | Returns result Id; does not wait. |
122
+ | `function result get RESULT_ID` | Poll run status | Caller-controlled polling. |
123
+ | `function result log get RESULT_ID` | Read run logs | Optional `--type` filter. |
124
+ | `function run-local SCRIPT` | Docker local run | No gateway; no Salesforce write. |
125
+ | `function open ID` | Open in browser | CLI-only. |
126
+
127
+ ## MCP Tools
128
+
129
+ | Tool | Maps To |
130
+ | --- | --- |
131
+ | `agentia_function_defaults` | `function defaults` |
132
+ | `agentia_function_list` | `function list` |
133
+ | `agentia_function_get` | `function get` |
134
+ | `agentia_function_upsert` | `function upsert` |
135
+ | `agentia_function_delete` | `function delete` |
136
+ | `agentia_function_run` | `function run` |
137
+ | `agentia_function_result_get` | `function result get` |
138
+ | `agentia_function_result_log_get` | `function result log get` |
139
+ | `agentia_function_run_local` | `function run-local` |
140
+
141
+ MCP uses structured fields (for example `apiName`, `parameters` object) instead of CLI flag names.
142
+
143
+ ## Gotchas
144
+
145
+ - Function API name, Function Salesforce Id, and Function result Id are different values. Use the Id type each command documents.
146
+ - `AGENTIA_USE_LOCAL_GATEWAY=true` redirects gateway-backed Function commands to a contributor local gateway. That is not the same as `run-local`.
147
+ - `function open` is CLI-only; MCP covers Function operations but not browser navigation.
148
+ - Do not use Function commands for Job Templates (`cicd template`), Release Data Templates (`cicd data template`), or CRT jobs (`agentia testing …`).
@@ -0,0 +1,132 @@
1
+ <!-- Agentia managed skill file: agentia setup skills -->
2
+
3
+ # CICD Job Templates Reference
4
+
5
+ Use this reference for Copado Job Template commands under `agentia cicd template ...`.
6
+
7
+ Prefer `agentia_template_*` MCP tools when available. Otherwise use the CLI and add `--json` when an agent will parse or reuse the result.
8
+
9
+ `cicd template` manages Job Template definitions through the CICD Gateway `/release/jobs/templates` APIs. It is not the same as:
10
+
11
+ - Release Data Templates (`agentia cicd data template …` — see [data.md](data.md))
12
+ - Copado JobExecution records (`agentia cicd job …` — see [jobs.md](jobs.md))
13
+ - Copado Functions (`agentia cicd function …` — see [functions.md](functions.md))
14
+
15
+ There is no Job Template `run` command on the gateway. To execute jobs, use JobExecution commands after a template is already attached to a job flow elsewhere in Copado.
16
+
17
+ ## Operating Rules
18
+
19
+ - Confirm CICD auth before any command.
20
+ - Use Job Template API names returned by Copado (`[A-Za-z0-9_-]` only). Do not invent API names for get, upsert, or delete.
21
+ - Prefer reading `template get <api-name> --json` before upsert or delete.
22
+ - Upsert requires an explicit `steps` array (use `[]` to clear all steps). Partial flag-only upsert without `--file`, `--steps-file`, or the default disk file is rejected.
23
+ - Optional CLI disk I/O uses `copado/templates/{apiName}.metadata.json` with lowercase keys for legacy migration. MCP tools do not write disk files; pass structured JSON payloads.
24
+ - After every mutation, read the template back or list it by name.
25
+
26
+ ## Choose A Workflow
27
+
28
+ | Intent | Workflow |
29
+ | --- | --- |
30
+ | Scaffold metadata without persisting | Defaults |
31
+ | Find or inspect a Job Template | List And Get |
32
+ | Create or update a Job Template | Upsert |
33
+ | Persist retrieved JSON to disk | Get Or Defaults With Write |
34
+ | Remove a Job Template | Delete |
35
+
36
+ ## Defaults
37
+
38
+ 1. Run `template defaults --name <display-name> --json`.
39
+ 2. Optional: `--api-name` to control the scaffolded API name.
40
+ 3. Optional CLI disk write: `--write` (default path) or `--output <path>`.
41
+ 4. Nothing is written to Salesforce until upsert.
42
+
43
+ ```sh
44
+ agentia cicd template defaults --name MyTemplate --json
45
+ agentia cicd template defaults --name MyTemplate --api-name MyTemplate_1 --write
46
+ ```
47
+
48
+ ## List And Get
49
+
50
+ 1. Discover candidates with `template list --json` (Custom only by default).
51
+ 2. Use `--type all` when Standard templates must be included.
52
+ 3. Filter with `--name`, pagination (`--cursor`, `--page-size`), or `--fetch-all` when needed (`--fetch-all` is incompatible with `--cursor` on the gateway).
53
+ 4. Inspect one template with `template get <api-name> --json`.
54
+ 5. Optional CLI disk write on get: `--write` or `--output <path>`.
55
+
56
+ ```sh
57
+ agentia cicd template list --json
58
+ agentia cicd template list --type all --name Demo --fetch-all --json
59
+ agentia cicd template get MyTemplate_1 --json
60
+ agentia cicd template get MyTemplate_1 --write
61
+ ```
62
+
63
+ ## Upsert
64
+
65
+ 1. Prepare steps and metadata:
66
+ - default disk path `copado/templates/{apiName}.metadata.json`, or
67
+ - `--file <path>`, or
68
+ - `--steps-file` plus optional name/description flags.
69
+ 2. Ensure the payload includes a `steps` array.
70
+ 3. Run `template upsert <api-name> ... --json`.
71
+ 4. Read back with `template get <api-name> --json`.
72
+
73
+ Wire format is camelCase (`apiName`, `customType`, `volumeOptions`). Disk files use lowercase keys (`apiname`, `customtype`, `volumeoptions`); reads accept either casing.
74
+
75
+ ```sh
76
+ agentia cicd template upsert MyTemplate_1 --json
77
+ agentia cicd template upsert MyTemplate_1 --file ./copado/templates/MyTemplate_1.metadata.json --json
78
+ agentia cicd template upsert MyTemplate_1 --name "My Template" --steps-file ./steps.json --json
79
+ ```
80
+
81
+ ## Delete
82
+
83
+ 1. Confirm the exact API name with `template get` or `template list`.
84
+ 2. Confirm destructive intent with the user.
85
+ 3. Run `template delete <api-name> --json`.
86
+
87
+ ```sh
88
+ agentia cicd template delete MyTemplate_1 --json
89
+ ```
90
+
91
+ ## Commands
92
+
93
+ | Command | Use For | Notes |
94
+ | --- | --- | --- |
95
+ | `template defaults` | Scaffold defaults | Gateway GET; not persisted. Optional `--write` / `--output`. |
96
+ | `template list` | Find Job Templates | Default `--type custom`; name filter and pagination. |
97
+ | `template get API_NAME` | Inspect one template | Optional `--write` / `--output` for disk. |
98
+ | `template upsert API_NAME` | Create or update | Requires explicit `steps`; disk/`--file`/`--steps-file`. |
99
+ | `template delete API_NAME` | Delete a template | Destructive; confirm API name. |
100
+
101
+ ## MCP Tools
102
+
103
+ | Tool | Maps To |
104
+ | --- | --- |
105
+ | `agentia_template_defaults` | `template defaults` |
106
+ | `agentia_template_list` | `template list` |
107
+ | `agentia_template_get` | `template get` |
108
+ | `agentia_template_upsert` | `template upsert` |
109
+ | `agentia_template_delete` | `template delete` |
110
+
111
+ MCP tools accept structured fields (for example `apiName`, `steps`) and do not perform legacy disk writes.
112
+
113
+ ## Disk Format
114
+
115
+ Path: `copado/templates/{apiName}.metadata.json`
116
+
117
+ | Disk key | Gateway field |
118
+ | --- | --- |
119
+ | `apiname` | `apiName` |
120
+ | `customtype` (on steps) | `customType` |
121
+ | `volumeoptions` | `volumeOptions` |
122
+ | `name`, `type`, `version`, `description`, `steps` | same camelCase names |
123
+
124
+ Use disk files only when migrating from legacy `copado:beta:template:*` or when the user asks to keep local metadata in the repo.
125
+
126
+ ## Gotchas
127
+
128
+ - Job Template API name and Job Template Salesforce Id are different. CLI/MCP identify templates by API name for get/upsert/delete.
129
+ - Do not confuse `cicd template` with `cicd data template`. Data templates use Salesforce template Ids and live under `/release/data-templates`.
130
+ - Upsert without `steps` fails validation before the gateway runs. Provide `[]` only when clearing all steps is intentional.
131
+ - `--fetch-all` cannot be combined with `--cursor`.
132
+ - Gateway dependency: `/release/jobs/templates` (nested under release jobs). Older `/templates` paths are obsolete.