@salesforce/afv-skills 1.33.0 → 1.35.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 (146) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-architecture-analyze/SKILL.md +8 -0
  3. package/skills/agentforce-bot-upgrade/SKILL.md +0 -2
  4. package/skills/agentforce-d360-analyze/SKILL.md +8 -0
  5. package/skills/agentforce-observe/SKILL.md +3 -0
  6. package/skills/agentforce-test/SKILL.md +3 -0
  7. package/skills/automation-flow-generate/SKILL.md +1 -0
  8. package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +239 -0
  9. package/skills/automation-sandbox-post-copy-config-generate/assets/config_template.json +21 -0
  10. package/skills/automation-sandbox-post-copy-config-generate/assets/json_schema.json +90 -0
  11. package/skills/automation-sandbox-post-copy-config-generate/examples/sample_sop_excerpt.md +31 -0
  12. package/skills/automation-sandbox-post-copy-config-generate/examples/sample_sop_to_config.json +50 -0
  13. package/skills/automation-sandbox-post-copy-config-generate/references/configuration_catalog.md +76 -0
  14. package/skills/automation-sandbox-post-copy-config-generate/references/sop_parsing_patterns.md +157 -0
  15. package/skills/automation-sandbox-post-copy-config-generate/references/source_format_handling.md +230 -0
  16. package/skills/commerce-b2b-open-code-components-integrate/SKILL.md +8 -0
  17. package/skills/commerce-b2b-open-code-components-replace/SKILL.md +2 -0
  18. package/skills/commerce-b2b-store-create/SKILL.md +4 -1
  19. package/skills/data360-activate/SKILL.md +12 -0
  20. package/skills/data360-code-extension-generate/SKILL.md +6 -6
  21. package/skills/data360-connect/SKILL.md +11 -0
  22. package/skills/data360-harmonize/SKILL.md +11 -0
  23. package/skills/data360-orchestrate/SKILL.md +30 -0
  24. package/skills/data360-prepare/SKILL.md +14 -0
  25. package/skills/data360-query/SKILL.md +10 -0
  26. package/skills/data360-schema-get/SKILL.md +7 -0
  27. package/skills/data360-segment/SKILL.md +11 -0
  28. package/skills/design-systems-slds-validate/SKILL.md +8 -0
  29. package/skills/design-systems-slds2-migrate/SKILL.md +3 -0
  30. package/skills/dx-apexguru-scan/SKILL.md +403 -0
  31. package/skills/dx-apexguru-scan/examples/README.md +54 -0
  32. package/skills/dx-apexguru-scan/examples/sample-decoded-summary.json +176 -0
  33. package/skills/dx-apexguru-scan/examples/sample-full-no-runtime-response.json +26 -0
  34. package/skills/dx-apexguru-scan/examples/sample-succeeded-response.json +15 -0
  35. package/skills/dx-apexguru-scan/references/api-reference.md +81 -0
  36. package/skills/dx-apexguru-scan/references/authentication.md +134 -0
  37. package/skills/dx-apexguru-scan/references/error-handling.md +56 -0
  38. package/skills/dx-apexguru-scan/references/violation-catalog.md +28 -0
  39. package/skills/dx-apexguru-scan/scripts/build-zip.sh +87 -0
  40. package/skills/dx-apexguru-scan/scripts/decode-report.js +389 -0
  41. package/skills/dx-apexguru-scan/scripts/resolve-token.sh +151 -0
  42. package/skills/dx-apexguru-scan/scripts/run-scan.sh +153 -0
  43. package/skills/dx-apexguru-scan/scripts/scan.sh +96 -0
  44. package/skills/dx-apexguru-scan/scripts/validate-token.js +121 -0
  45. package/skills/dx-app-analytics-query/SKILL.md +5 -0
  46. package/skills/dx-code-analyzer-configure/SKILL.md +5 -5
  47. package/skills/dx-code-analyzer-custom-rule-create/SKILL.md +3 -1
  48. package/skills/dx-code-analyzer-run/SKILL.md +10 -2
  49. package/skills/dx-devops-pipeline-manage/SKILL.md +263 -0
  50. package/skills/dx-devops-pipeline-manage/examples/common-workflows.md +177 -0
  51. package/skills/dx-devops-pipeline-manage/references/cli-commands.md +298 -0
  52. package/skills/dx-devops-pipeline-manage/references/parsing-patterns.md +134 -0
  53. package/skills/dx-devops-pipeline-manage/scripts/check-activation-ready.sh +34 -0
  54. package/skills/dx-devops-pipeline-manage/scripts/validate-org-type.sh +17 -0
  55. package/skills/dx-devops-pipeline-manage/scripts/verify-operation.sh +82 -0
  56. package/skills/dx-devops-promote/SKILL.md +214 -0
  57. package/skills/dx-devops-promote/examples/promotion-workflows.md +212 -0
  58. package/skills/dx-devops-promote/references/cli-commands.md +303 -0
  59. package/skills/dx-devops-test-failures-analyze/SKILL.md +8 -0
  60. package/skills/dx-devops-test-pipeline-configure/SKILL.md +7 -0
  61. package/skills/dx-devops-test-suite-assignments-configure/SKILL.md +9 -0
  62. package/skills/dx-devops-test-suite-run/SKILL.md +8 -0
  63. package/skills/dx-org-switch/SKILL.md +3 -0
  64. package/skills/experience-lwc-base-components-integrate/SKILL.md +176 -0
  65. package/skills/experience-lwc-base-components-integrate/references/lbc-expert-guidance.md +127 -0
  66. package/skills/experience-lwc-base-components-integrate/references/lightning-component-index.md +179 -0
  67. package/skills/experience-lwc-base-components-integrate/references/lightning-components.md +5429 -0
  68. package/skills/experience-lwc-base-components-integrate/scripts/extract-component-docs.sh +61 -0
  69. package/skills/experience-lwc-generate/SKILL.md +18 -0
  70. package/skills/experience-lwc-rtl-validate/SKILL.md +149 -0
  71. package/skills/experience-lwc-rtl-validate/references/rtl-expert.md +892 -0
  72. package/skills/experience-lwc-rtl-validate/scripts/scan-rtl-css.sh +206 -0
  73. package/skills/experience-lwc-typescript-migrate/SKILL.md +207 -0
  74. package/skills/experience-lwc-typescript-migrate/assets/dts-template.ts +15 -0
  75. package/skills/experience-lwc-typescript-migrate/assets/type-patterns.ts +44 -0
  76. package/skills/experience-lwc-typescript-migrate/scripts/find-consumers.sh +128 -0
  77. package/skills/experience-lwr-site-generate/SKILL.md +1 -1
  78. package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +5 -2
  79. package/skills/experience-ui-bundle-custom-app-generate/SKILL.md +1 -1
  80. package/skills/experience-ui-bundle-file-upload-generate/SKILL.md +5 -0
  81. package/skills/experience-ui-bundle-localize/SKILL.md +323 -0
  82. package/skills/experience-ui-bundle-localize/references/gotchas.md +249 -0
  83. package/skills/experience-ui-bundle-localize/references/i18n-setup.md +169 -0
  84. package/skills/experience-ui-bundle-localize/references/interpolation.md +311 -0
  85. package/skills/experience-ui-bundle-localize/references/label-xml.md +282 -0
  86. package/skills/experience-ui-bundle-localize/references/verifying.md +219 -0
  87. package/skills/experience-ui-bundle-localize/scripts/check-i18n-wired.sh +195 -0
  88. package/skills/experience-ui-bundle-localize/scripts/check-manifest-registered.sh +100 -0
  89. package/skills/experience-ui-bundle-localize/scripts/check-org-api-version.sh +40 -0
  90. package/skills/experience-ui-bundle-localize/scripts/detect-bundle-type.sh +57 -0
  91. package/skills/experience-ui-bundle-metadata-generate/SKILL.md +1 -1
  92. package/skills/experience-ui-bundle-project-generate/SKILL.md +4 -4
  93. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +11 -0
  94. package/skills/external-diagram-mermaid-generate/SKILL.md +21 -0
  95. package/skills/integration-connectivity-generate/SKILL.md +17 -0
  96. package/skills/integration-eventing-cdc-configure/SKILL.md +9 -0
  97. package/skills/integration-eventing-subscription-configure/SKILL.md +7 -0
  98. package/skills/mobile-apps-create/SKILL.md +5 -0
  99. package/skills/mobile-platform-native-capabilities-integrate/SKILL.md +3 -0
  100. package/skills/mobile-platform-offline-validate/SKILL.md +9 -0
  101. package/skills/omnistudio-callable-apex-generate/SKILL.md +14 -0
  102. package/skills/omnistudio-datamapper-generate/SKILL.md +13 -0
  103. package/skills/omnistudio-datapacks-deploy/SKILL.md +18 -0
  104. package/skills/omnistudio-dependencies-analyze/SKILL.md +12 -0
  105. package/skills/omnistudio-epc-catalog-generate/SKILL.md +15 -0
  106. package/skills/omnistudio-flexcard-generate/SKILL.md +11 -0
  107. package/skills/omnistudio-integration-procedure-generate/SKILL.md +11 -0
  108. package/skills/omnistudio-omniscript-generate/SKILL.md +9 -0
  109. package/skills/platform-agentexchange-partner-offers-configure/SKILL.md +8 -0
  110. package/skills/platform-agentsetup-categories-fetch/SKILL.md +3 -0
  111. package/skills/platform-apex-generate/SKILL.md +5 -0
  112. package/skills/platform-apex-logs-debug/SKILL.md +12 -0
  113. package/skills/platform-apex-test-generate/SKILL.md +5 -0
  114. package/skills/platform-apex-test-run/SKILL.md +14 -0
  115. package/skills/platform-custom-application-generate/SKILL.md +1 -0
  116. package/skills/platform-custom-field-generate/SKILL.md +1 -1
  117. package/skills/platform-custom-lightning-type-generate/SKILL.md +3 -0
  118. package/skills/platform-custom-lightning-type-generate/assets/primitive-types-and-constraints.md +1 -1
  119. package/skills/platform-custom-tab-generate/SKILL.md +1 -0
  120. package/skills/platform-data-manage/SKILL.md +15 -0
  121. package/skills/platform-dataspace-access-configure/SKILL.md +2 -2
  122. package/skills/platform-flexipage-generate/SKILL.md +3 -0
  123. package/skills/platform-lightning-app-coordinate/SKILL.md +18 -1
  124. package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +250 -0
  125. package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +74 -0
  126. package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +90 -0
  127. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +191 -0
  128. package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +85 -0
  129. package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +74 -0
  130. package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +184 -0
  131. package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +128 -0
  132. package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +181 -0
  133. package/skills/platform-metadata-api-context-get/SKILL.md +6 -2
  134. package/skills/platform-metadata-retrieve/SKILL.md +5 -0
  135. package/skills/platform-models-api-configure/SKILL.md +10 -0
  136. package/skills/platform-permission-set-generate/SKILL.md +1 -2
  137. package/skills/platform-policy-rule-generate/SKILL.md +2 -0
  138. package/skills/platform-report-generate/SKILL.md +1 -1
  139. package/skills/platform-sharing-rules-generate/SKILL.md +1 -1
  140. package/skills/platform-soql-query/SKILL.md +13 -0
  141. package/skills/platform-tracing-agentforce-configure/SKILL.md +5 -1
  142. package/skills/platform-tracing-configure/SKILL.md +4 -1
  143. package/skills/platform-trust-archive-manage/SKILL.md +3 -0
  144. package/skills/platform-validation-rule-generate/SKILL.md +1 -0
  145. package/skills/platform-widget-generate/SKILL.md +2 -1
  146. package/skills/sales-agentforce-pipeline-management-configure/SKILL.md +3 -1
@@ -0,0 +1,263 @@
1
+ ---
2
+ name: dx-devops-pipeline-manage
3
+ description: "Use this skill to manage the full lifecycle of a DevOps Center pipeline — list all pipelines, get a single pipeline's details, create a new pipeline linked to a Git repository, add or remove stages, rename a stage, add or remove Salesforce environments on stages, attach or detach projects, and activate or deactivate the pipeline. Invoke when the user wants to set up a release pipeline, wire promotion stages across integration, UAT, staging, and production orgs, connect environments to stages, attach a project, or activate a continuous delivery pipeline. Uses sf devops pipeline and sf devops stage commands with --json output. DO NOT TRIGGER for work-item lifecycle, promotion or deployment execution, conflict detection, or standalone project creation (separate skills)."
4
+ metadata:
5
+ version: "1.0"
6
+ minApiVersion: "58.0"
7
+ relatedSkills:
8
+ - "dx-devops-work-item-manage"
9
+ accessCheck:
10
+ - type: "orgPref"
11
+ value: "ALMDevopsCorePref"
12
+ - type: "userPerm"
13
+ value: "UserHasDevOpsCore"
14
+ cliTools:
15
+ - tool: ["jq"]
16
+ semver: ">=1.6"
17
+ - tool: ["sf"]
18
+ semver: ">=2.0.0"
19
+ ---
20
+
21
+ # DevOps Center Pipeline Management
22
+
23
+ Manages the complete pipeline lifecycle in DevOps Center — from creation against a repository, through stage and environment configuration and project attachment, to activation of a ready-to-promote release pipeline. Provides headless CLI-driven operations for autonomous release workflows.
24
+
25
+ ## Scope
26
+
27
+ - **In scope**: List pipelines, get pipeline details, create a pipeline (linked to an existing or new Git repo), add/delete/rename stages, add/delete Salesforce environments on stages, attach/detach projects, and activate/deactivate/rename the pipeline
28
+ - **Out of scope**: Work-item lifecycle, promotion/deployment execution, conflict detection, standalone project creation (separate skills)
29
+
30
+ ---
31
+
32
+ ## Required Inputs
33
+
34
+ Gather or infer before proceeding:
35
+
36
+ - **Operation type**: list, get, create, add-stage, delete-stage, rename-stage, add-environment, delete-environment, attach-project, detach-project, activate, or deactivate
37
+ - **For get / any stage or environment op**: pipeline ID (required) — obtain via `sf devops pipeline list --json`
38
+ - **For create**: pipeline name (required) and a Git repo (`--repo`, required). Repo flags differ by scenario:
39
+ - **Existing repo (GitHub or Bitbucket)**: only `--repo <url>` — do **not** pass `--repo-type`/`--create-repo`
40
+ - **New GitHub repo**: `--repo <name> --create-repo --repo-type github --repo-owner <org-or-user>`
41
+ - **New Bitbucket repo**: `--repo <name> --create-repo --repo-type bitbucket --bitbucket-workspace <workspace>` (`--bitbucket-project-key <key>` optional)
42
+ - Description (`--description`) optional in all cases
43
+ - **For add-stage**: pipeline ID, new stage name, and `--next-stage-id` (the stage the new one precedes) — get stage IDs via `sf devops pipeline get`
44
+ - **For add-environment**: pipeline ID, stage ID, environment name, and `--org-type` (Production or Sandbox)
45
+ - **For attach/detach-project**: pipeline ID and project ID
46
+ - **For activate/deactivate/rename**: pipeline ID
47
+
48
+ Defaults unless specified:
49
+ - Output format: `--json` for headless consumption
50
+ - Target org: use `--target-org <alias>` if not relying on the default org
51
+
52
+ If the user gives a clear request ("create a pipeline on repo myorg/myrepo", "add a UAT stage before Production", "activate pipeline 0XB..."), proceed immediately without unnecessary questions.
53
+
54
+ ---
55
+
56
+ ## Workflow
57
+
58
+ All operations use `sf devops pipeline` and `sf devops stage` CLI commands with `--json` output for structured consumption. Pipeline IDs and stage IDs are the primary identifiers — resolve them via `list` and `get` before mutating.
59
+
60
+ ### Phase 1 — Identify Operation
61
+
62
+ 1. **Determine the operation type** from user intent:
63
+ - "list", "show all pipelines" → list; "details of pipeline", "show stages" → get
64
+ - "create", "set up", "new pipeline" → create
65
+ - "add stage", "insert stage" → add-stage; "rename stage" → rename-stage; "remove/delete stage" → delete-stage
66
+ - "connect environment", "add org to stage" → add-environment; "remove environment" → delete-environment
67
+ - "attach project", "connect project" → attach-project; "detach project" → detach-project
68
+ - "activate", "turn on"; "deactivate", "turn off"; "rename pipeline" → lifecycle update
69
+
70
+ ### Phase 2 — Execute Operation
71
+
72
+ 2. **Verify org authentication** before any operation:
73
+ ```bash
74
+ sf org display --json
75
+ ```
76
+ - If no default org is set or auth has expired, instruct the user to run `sf org login web --set-default --alias <alias>`
77
+ - Confirm the org has DevOps Center enabled by running `sf devops pipeline list --json`
78
+ - Add `--target-org <alias>` to every command when targeting a specific org
79
+
80
+ 3. **Inspect pipelines**:
81
+ ```bash
82
+ sf devops pipeline list --json # all pipelines in the org
83
+ sf devops pipeline get --pipeline-id <pipeline-id> --json # one pipeline, with stages/repos/projects
84
+ ```
85
+ - `list` returns SObject records under `.result.pipelines[]` with capitalized fields (`.Id`, `.Name`, `.IsActive`) — it does **not** include stages or connected projects
86
+ - `get` returns a single pipeline under `.result` with camelCase fields (`.id`, `.name`, `.stages[]`, `.connectedProjects[]`); each stage has `.id`, `.name`, `.nextStageId`, `.branchName`, and `.environment.{id,name}`. **Stages are a linked list** — order is defined by `nextStageId`, and the terminal stage has `nextStageId: null`. Use `get` to discover **stage IDs** before any stage or environment operation
87
+
88
+ 4. **Create a pipeline** — the pipeline must be linked to a Git repository. `--name` and `--repo` are always required; the remaining flags depend on the repo scenario:
89
+ ```bash
90
+ # Existing repo (GitHub or Bitbucket) — pass the full repo URL, nothing else
91
+ sf devops pipeline create --name "<pipeline-name>" --repo <repo-url> --json
92
+
93
+ # New GitHub repo — requires --repo-owner
94
+ sf devops pipeline create --name "<pipeline-name>" --repo <repo-name> \
95
+ --create-repo --repo-type github --repo-owner <org-or-user> --json
96
+
97
+ # New Bitbucket repo — requires --bitbucket-workspace (--bitbucket-project-key optional)
98
+ sf devops pipeline create --name "<pipeline-name>" --repo <repo-name> \
99
+ --create-repo --repo-type bitbucket --bitbucket-workspace <workspace> \
100
+ --bitbucket-project-key <key> --json
101
+
102
+ # Custom stage chain (any scenario) — repeat --stage in promotion order
103
+ sf devops pipeline create --name "<pipeline-name>" --repo <repo-url> \
104
+ --stage Dev --stage QA --stage Prod --json
105
+ ```
106
+ - Provider-specific required flags: **GitHub new repo** → `--repo-owner`; **Bitbucket new repo** → `--bitbucket-workspace`. Omitting the provider's required flag fails the create
107
+ - Do **not** pass `--repo-type`/`--create-repo` for an existing repo — supply only the repo URL via `--repo`
108
+ - **Custom stages at create time**: a new pipeline seeds the default stage chain **Integration → UAT → Staging → Production**. To seed different stages, repeat `-s/--stage` once per stage **in promotion order** — e.g. `--stage Dev --stage QA --stage Prod`. This avoids adding/renaming stages afterward
109
+ - Add `--description "<text>"` optionally in any scenario
110
+ - Capture the returned pipeline ID for subsequent stage/environment/project/activation steps
111
+ - **Idempotency**: the CLI does not dedupe. Before creating, run `sf devops pipeline list --json` and check for a pipeline with the same name/repo; return the existing one if found. See `references/parsing-patterns.md` for the check-before-create snippet
112
+
113
+ 5. **Configure stages** — a stage is added relative to an existing stage, then bound to an environment. **Read `references/cli-commands.md`** for full flag details before multi-stage work:
114
+ ```bash
115
+ # Insert an empty stage BEFORE an existing stage (get the next-stage-id from `pipeline get`)
116
+ sf devops pipeline stage add --pipeline-id <id> --name "<stage-name>" --next-stage-id <stage-id> --json
117
+ # Rename a stage
118
+ sf devops pipeline stage update --pipeline-id <id> --stage-id <stage-id> --name "<new-name>" --json
119
+ # Delete a stage (predecessor auto-relinks to successor)
120
+ sf devops pipeline stage delete --pipeline-id <id> --stage-id <stage-id> --json
121
+ ```
122
+ - `stage add` inserts an **empty** stage (no branch/environment) before `--next-stage-id`; configure its environment separately
123
+ - Build the promotion chain by inserting each new stage before the stage that should follow it
124
+
125
+ 6. **Bind environments to stages** — attach a Salesforce org to a stage:
126
+ ```bash
127
+ # Validate the org-type against the fixed enum BEFORE calling the CLI
128
+ bash scripts/validate-org-type.sh "<Production|Sandbox>" # exits non-zero on an invalid value
129
+ sf devops stage environment add --pipeline-id <id> --stage-id <stage-id> \
130
+ --environment-name "<env-name>" --org-type <Production|Sandbox> --json
131
+ # Remove an environment (pipeline must be inactive)
132
+ sf devops stage environment delete --pipeline-id <id> --environment-id <env-id> --json
133
+ ```
134
+ - `--org-type` must be exactly `Production` or `Sandbox` — run `scripts/validate-org-type.sh <value>` first and only proceed on exit 0
135
+ - **Headless caveat**: `stage environment add` triggers an OAuth browser flow. In headless/CI runs pass `--no-browser` — the CLI prints a redirect URL for manual authentication
136
+
137
+ 7. **Attach / detach a project** — a project can be attached to only one pipeline:
138
+ ```bash
139
+ sf devops pipeline project add --pipeline-id <id> --project-id <project-id> --json
140
+ sf devops pipeline project delete --pipeline-id <id> --project-id <project-id> --json
141
+ ```
142
+ - If the user names a project instead of providing its ID, resolve it via `sf devops project list --json` (see `references/parsing-patterns.md`)
143
+
144
+ 8. **Activate / deactivate / rename the pipeline**:
145
+ ```bash
146
+ # Before activating, confirm the deterministic ≥1-stage prerequisite
147
+ bash scripts/check-activation-ready.sh <id> [target-org] # exits non-zero if stage-less
148
+ sf devops pipeline update --pipeline-id <id> --activate --json # activate
149
+ sf devops pipeline update --pipeline-id <id> --deactivate --json # deactivate
150
+ sf devops pipeline update --pipeline-id <id> --name "<new-name>" --json # rename
151
+ ```
152
+ - Before `--activate`, run `scripts/check-activation-ready.sh <id>` and only proceed on exit 0 — it fails with an actionable message when the pipeline has no stages
153
+ - **Stages cannot be modified after the pipeline is activated and changes are promoted through it** — finish stage/environment configuration before activating
154
+ - `--activate` and `--deactivate` are mutually exclusive; `--deactivate` and `--name` may be combined in one command
155
+
156
+ ### Phase 3 — Verify and Report
157
+
158
+ 9. **Verify operation success** — use `scripts/verify-operation.sh`, which performs the deterministic JSON-status and post-state field checks and exits non-zero with an actionable message on mismatch:
159
+ ```bash
160
+ # Assert a captured command's JSON status is 0 (pipe the CLI output in)
161
+ sf devops pipeline update --pipeline-id <id> --activate --json | bash scripts/verify-operation.sh status -
162
+ # Assert post-state after activate / stage / project ops
163
+ bash scripts/verify-operation.sh active <id> true [target-org] # isActive == true
164
+ bash scripts/verify-operation.sh has-stage <id> "<stage>" [target-org] # stage present in chain
165
+ bash scripts/verify-operation.sh has-project <id> "<project>" [target-org] # project connected
166
+ ```
167
+ - **Create**: confirm the pipeline appears in `sf devops pipeline list --json` by `.Name` and capture its `.Id`
168
+ - **Stage / environment / project changes**: verify with the `has-stage` / `has-project` modes above (they read `sf devops pipeline get` and check `.result.stages[]` / `.result.connectedProjects[]`)
169
+ - **Activate**: verify with the `active <id> true` mode
170
+
171
+ 10. **Report results**:
172
+ - **List**: pipeline name, ID, and active state per pipeline (no stages — that's what `get` is for)
173
+ - **Get**: pipeline name, ID, active state, stage chain (each stage's name → environment → branch, ordered via `nextStageId`), connected projects
174
+ - **Create**: pipeline ID, name, and linked repo (or "existing pipeline returned" on idempotent match)
175
+ - **Stage / environment / project op**: the resulting stage chain with each stage's environment, in promotion order
176
+ - **Lifecycle**: the new active state and/or name
177
+
178
+ ### Verification Checklist (gate before reporting success)
179
+
180
+ Confirm the items for the operation you performed. Do **not** report success until every applicable box holds:
181
+
182
+ - [ ] Every `sf devops` command was run with `--json` and returned `status: 0` (`scripts/verify-operation.sh status -`)
183
+ - [ ] **Create**: the new pipeline appears in `sf devops pipeline list --json` by name, and (for a new repo) the provider-specific flags were supplied (`--repo-owner` for GitHub, `--bitbucket-workspace` for Bitbucket)
184
+ - [ ] **Add-stage / add-environment**: the stage exists in the chain and `--org-type` passed `scripts/validate-org-type.sh` (`scripts/verify-operation.sh has-stage ...`)
185
+ - [ ] **Attach-project**: the project shows in `.result.connectedProjects[]` (`scripts/verify-operation.sh has-project ...`)
186
+ - [ ] **Activate**: `scripts/check-activation-ready.sh` passed beforehand and `.result.isActive` is now `true` (`scripts/verify-operation.sh active <id> true`)
187
+ - [ ] **Delete-environment**: the pipeline was inactive before the delete
188
+
189
+ ---
190
+
191
+ ## Rules / Constraints
192
+
193
+ | Constraint | Rationale |
194
+ |-----------|-----------|
195
+ | All sf devops commands must use `--json` flag | Structured output is required for headless consumption; human-readable output is unreliable for parsing |
196
+ | A pipeline requires a Git repo at create time | `sf devops pipeline create` requires `--name` and `--repo`; for an existing repo pass only the URL, for a new repo add `--create-repo` and `--repo-type` |
197
+ | New-repo create needs provider-specific flags | GitHub requires `--repo-owner`; Bitbucket requires `--bitbucket-workspace` (`--bitbucket-project-key` optional). The wrong provider's flags fail the command |
198
+ | Pipeline ID required for get, update, and all stage/environment/project ops | These commands identify the pipeline only by `--pipeline-id`; obtain it via `sf devops pipeline list` |
199
+ | Stage IDs come from `pipeline get` | `stage add` (`--next-stage-id`), `stage update`/`delete` (`--stage-id`), and `stage environment add` (`--stage-id`) all need stage IDs |
200
+ | `stage add` inserts an empty stage before `--next-stage-id` | Stages carry no environment until one is added; build the chain by anchoring to the following stage |
201
+ | `--org-type` must be exactly `Production` or `Sandbox` | The flag is a fixed enum; other values fail |
202
+ | Pipeline must have ≥1 stage before activation | `sf devops pipeline update --activate` rejects a stage-less pipeline |
203
+ | Do not modify stages after activate + promote | DevOps Center locks stage structure once changes have been promoted through an active pipeline |
204
+ | Environment delete requires an inactive pipeline | `stage environment delete` only succeeds while the pipeline is inactive |
205
+ | A project attaches to only one pipeline | `pipeline project add` fails if the project is already attached elsewhere; detach first |
206
+ | Idempotent create via check-before-create | The CLI does not dedupe; list existing pipelines and return the match instead of erroring |
207
+ | Prefer `--no-browser` in headless runs | `stage environment add` opens an OAuth browser flow; `--no-browser` prints a redirect URL for CI |
208
+
209
+ ---
210
+
211
+ ## Gotchas
212
+
213
+ | Issue | Resolution |
214
+ |-------|------------|
215
+ | **No default org set** | Run `sf org display --json` first; if it fails, instruct user to run `sf org login web --set-default` |
216
+ | **Create fails — missing repo** | `--repo` is required; pass an existing repo URL, or `--create-repo` + `--repo-type` for a new repo |
217
+ | **New-repo create fails — missing provider flag** | GitHub new repo needs `--repo-owner`; Bitbucket new repo needs `--bitbucket-workspace`. Don't mix providers' flags (`--repo-owner` with `bitbucket`, or `--bitbucket-workspace` with `github`) |
218
+ | **`stage add` fails — no next-stage-id** | `--next-stage-id` is required; run `sf devops pipeline get --pipeline-id <id> --json` to find the stage IDs and pick the one the new stage should precede |
219
+ | **Environment add hangs in CI** | The OAuth browser flow blocks headless runs; add `--no-browser` and complete auth via the printed redirect URL |
220
+ | **Activation rejected** | The pipeline needs at least one stage; add a stage (and its environment) before `--activate` |
221
+ | **Cannot modify stages** | The pipeline is active and has promoted changes; stage structure is locked — configuration must complete before activation |
222
+ | **Environment delete fails** | The pipeline is active; deactivate with `pipeline update --deactivate` before deleting the environment |
223
+ | **Project already attached** | A project attaches to only one pipeline; detach from the other pipeline first via `pipeline project delete` |
224
+ | **Pipeline / stage / project not found** | The ID is invalid; run `sf devops pipeline list --json`, `sf devops pipeline get --json`, or `sf devops project list --json` to find valid IDs |
225
+
226
+ ---
227
+
228
+ ## Output Expectations
229
+
230
+ Deliverables vary by operation:
231
+
232
+ - **List**: pipelines with ID, name, and active state (no stages/projects in the list view)
233
+ - **Get**: a pipeline with ID, name, active state, its stage chain (each with environment and branch, ordered via `nextStageId`), and connected projects
234
+ - **Create**: pipeline ID, name, and linked repository (or the pre-existing pipeline on idempotent match)
235
+ - **Stage op**: the updated ordered stage chain
236
+ - **Environment op**: the stage with its bound environment (name, org-type)
237
+ - **Project op**: confirmation of attach/detach
238
+ - **Lifecycle**: the new active state and/or pipeline name
239
+
240
+ Outputs are derived from `sf devops pipeline` and `sf devops stage` CLI commands.
241
+
242
+ ---
243
+
244
+ ## Cross-Skill Integration
245
+
246
+ | Delegate to | When |
247
+ |-------------|------|
248
+ | `dx-devops-work-item-manage` | The user wants to create or advance work items once the pipeline is active |
249
+
250
+ If a project the user wants to attach can't be found, resolve or list existing projects with `sf devops project list --json` (see `references/parsing-patterns.md`) rather than delegating — project creation is out of scope for this skill.
251
+
252
+ ---
253
+
254
+ ## Reference File Index
255
+
256
+ | File | When to read |
257
+ |------|-------------|
258
+ | `references/cli-commands.md` | When you need detailed CLI flag documentation and JSON output schemas for each `sf devops pipeline` / `sf devops stage` command |
259
+ | `references/parsing-patterns.md` | When you need jq snippets to parse the JSON (stage chains, pipeline/project ID resolution), error-handling reference, the check-before-create idempotent pattern, or auth requirements |
260
+ | `examples/common-workflows.md` | When the user's request matches a common pattern (end-to-end pipeline setup, inserting a stage, binding an environment, attaching a project, activation) |
261
+ | `scripts/validate-org-type.sh` | Run before `stage environment add` to validate `--org-type` against the `Production`/`Sandbox` enum |
262
+ | `scripts/check-activation-ready.sh` | Run before `pipeline update --activate` to confirm the pipeline has ≥1 stage |
263
+ | `scripts/verify-operation.sh` | Run in Phase 3 to assert a command's JSON status and post-state fields (`status` / `active` / `has-stage` / `has-project`) |
@@ -0,0 +1,177 @@
1
+ # Common Pipeline Management Workflows
2
+
3
+ Real-world examples of typical pipeline operations in DevOps Center autonomous release scenarios. All commands use `--json`; add `--target-org <alias>` when not relying on the default org.
4
+
5
+ ---
6
+
7
+ ## Workflow 1: End-to-End Pipeline Setup — Create, Stage, Bind Environments, Activate
8
+
9
+ **User request:** "Set up a release pipeline on repo myorg/myrepo with Integration → UAT → Production and activate it"
10
+
11
+ **Steps:**
12
+
13
+ 1. **Create the pipeline** against the existing repo, then resolve its ID from the list:
14
+ ```bash
15
+ sf devops pipeline create \
16
+ --name "Release Pipeline" \
17
+ --repo https://github.com/myorg/myrepo \
18
+ --json
19
+ PIPELINE_ID=$(sf devops pipeline list --json | \
20
+ jq -r '.result.pipelines[] | select(.Name == "Release Pipeline") | .Id' | head -n1)
21
+ ```
22
+
23
+ 2. **Inspect the initial stages** (a new pipeline always starts with at least one seeded stage):
24
+ ```bash
25
+ sf devops pipeline get --pipeline-id "$PIPELINE_ID" --json | \
26
+ jq -r '.result.stages[] | "\(.name) (\(.id)) -> next: \(.nextStageId)"'
27
+ ```
28
+
29
+ 3. **Add stages in promotion order.** `stage add` inserts a stage *before* `--next-stage-id`, so anchor each new stage to the one that should follow it. To build Integration → UAT → Production, add Production first (or anchor to the terminal stage), then insert UAT before Production, then Integration before UAT:
30
+ ```bash
31
+ # Assume Production stage id is 0Xc...PROD (from step 2 or a prior add)
32
+ sf devops pipeline stage add --pipeline-id "$PIPELINE_ID" \
33
+ --name "UAT" --next-stage-id 0XcPROD --json
34
+ sf devops pipeline stage add --pipeline-id "$PIPELINE_ID" \
35
+ --name "Integration" --next-stage-id 0XcUAT --json
36
+ ```
37
+
38
+ 4. **Bind an environment to each stage** (re-fetch stage IDs with `pipeline get`). In CI, add `--no-browser`:
39
+ ```bash
40
+ sf devops stage environment add --pipeline-id "$PIPELINE_ID" \
41
+ --stage-id 0XcINT --environment-name integration-org --org-type Sandbox --no-browser --json
42
+ sf devops stage environment add --pipeline-id "$PIPELINE_ID" \
43
+ --stage-id 0XcUAT --environment-name uat-org --org-type Sandbox --no-browser --json
44
+ sf devops stage environment add --pipeline-id "$PIPELINE_ID" \
45
+ --stage-id 0XcPROD --environment-name prod-org --org-type Production --no-browser --json
46
+ ```
47
+
48
+ 5. **Activate** once every stage has an environment:
49
+ ```bash
50
+ sf devops pipeline update --pipeline-id "$PIPELINE_ID" --activate --json
51
+ ```
52
+
53
+ 6. **Verify** the final shape:
54
+ ```bash
55
+ sf devops pipeline get --pipeline-id "$PIPELINE_ID" --json | \
56
+ jq -r '.result | "\(.name) [\(.isActive)]: \([.stages[].name] | join(", "))"'
57
+ ```
58
+
59
+ **Report:** "Release Pipeline created and activated: Integration → UAT → Production, environments bound."
60
+
61
+ ---
62
+
63
+ ## Workflow 2: Insert a Staging Stage Before Production
64
+
65
+ **User request:** "Add a Staging stage between UAT and Production on the Release Pipeline"
66
+
67
+ **Steps:**
68
+
69
+ 1. **Find the pipeline and stage IDs**:
70
+ ```bash
71
+ PIPELINE_ID=$(sf devops pipeline list --json | \
72
+ jq -r '.result.pipelines[] | select(.Name == "Release Pipeline") | .Id' | head -n1)
73
+ sf devops pipeline get --pipeline-id "$PIPELINE_ID" --json | \
74
+ jq -r '.result.stages[] | "\(.name) (\(.id)) -> next: \(.nextStageId)"'
75
+ # Integration (0XcINT) -> next: 0XcUAT
76
+ # UAT (0XcUAT) -> next: 0XcPROD
77
+ # Production (0XcPROD) -> next: null
78
+ ```
79
+
80
+ 2. **Insert Staging before Production**:
81
+ ```bash
82
+ sf devops pipeline stage add --pipeline-id "$PIPELINE_ID" \
83
+ --name "Staging" --next-stage-id 0XcPROD --json
84
+ ```
85
+
86
+ 3. **Bind the staging environment** (get the new stage ID from `pipeline get`):
87
+ ```bash
88
+ sf devops stage environment add --pipeline-id "$PIPELINE_ID" \
89
+ --stage-id 0XcSTG --environment-name staging-org --org-type Sandbox --no-browser --json
90
+ ```
91
+
92
+ 4. **Verify** Staging now sits between UAT and Production.
93
+
94
+ > **Constraint:** This works only if the pipeline is not yet locked. Stages can't be modified after the pipeline is activated and changes have been promoted through it.
95
+
96
+ **Report:** "Staging stage inserted before Production, bound to staging-org."
97
+
98
+ ---
99
+
100
+ ## Workflow 3: Attach a Project to a Pipeline
101
+
102
+ **User request:** "Connect Project Alpha to the Release Pipeline"
103
+
104
+ **Steps:**
105
+
106
+ 1. **Resolve IDs**:
107
+ ```bash
108
+ PIPELINE_ID=$(sf devops pipeline list --json | \
109
+ jq -r '.result.pipelines[] | select(.Name == "Release Pipeline") | .Id' | head -n1)
110
+ PROJECT_ID=$(sf devops project list --json | \
111
+ jq -r '.result.projects[] | select(.Name == "Project Alpha") | .Id' | head -n1)
112
+ ```
113
+
114
+ 2. **Attach**:
115
+ ```bash
116
+ sf devops pipeline project add --pipeline-id "$PIPELINE_ID" --project-id "$PROJECT_ID" --json
117
+ ```
118
+
119
+ 3. **Verify** via `pipeline get` that Project Alpha appears in `.result.connectedProjects[]`.
120
+
121
+ > **Constraint:** A project attaches to only one pipeline. If attach fails with "already attached," detach it from the other pipeline first: `sf devops pipeline project delete --pipeline-id <other> --project-id "$PROJECT_ID" --json`.
122
+
123
+ **Report:** "Project Alpha attached to Release Pipeline."
124
+
125
+ ---
126
+
127
+ ## Workflow 4: Rename and Deactivate a Pipeline
128
+
129
+ **User request:** "Deactivate the Release Pipeline and rename it to Legacy Pipeline"
130
+
131
+ **Steps:**
132
+
133
+ 1. **Combine deactivate + rename** in one command:
134
+ ```bash
135
+ sf devops pipeline update --pipeline-id 0XB000000000001 \
136
+ --deactivate --name "Legacy Pipeline" --json
137
+ ```
138
+
139
+ 2. **Verify** via `pipeline get` that `.result.isActive` is false and the name updated.
140
+
141
+ **Report:** "Pipeline deactivated and renamed to 'Legacy Pipeline'."
142
+
143
+ ---
144
+
145
+ ## Workflow 5: Idempotent Pipeline Setup (Safe Re-Run in CI)
146
+
147
+ **User request:** "Ensure the Release Pipeline exists — runs on every CI job"
148
+
149
+ **Steps:**
150
+
151
+ ```bash
152
+ PIPELINE_NAME="Release Pipeline"
153
+
154
+ EXISTING_ID=$(sf devops pipeline list --json | \
155
+ jq -r ".result.pipelines[] | select(.Name == \"$PIPELINE_NAME\") | .Id" | head -n1)
156
+
157
+ if [ -n "$EXISTING_ID" ]; then
158
+ echo "Pipeline already exists: $EXISTING_ID"
159
+ else
160
+ sf devops pipeline create --name "$PIPELINE_NAME" \
161
+ --repo https://github.com/myorg/myrepo --json
162
+ fi
163
+ ```
164
+
165
+ **Report:** either the existing pipeline ID or the newly created one — no duplicate created.
166
+
167
+ ---
168
+
169
+ ## Notes for Autonomous Runs
170
+
171
+ - Confirm org auth with `sf org display --json` before the first command.
172
+ - **Stage IDs come from `sf devops pipeline get`** — always fetch them before `stage add` / `stage update` / `stage delete` / `stage environment add`.
173
+ - `stage add` inserts *before* `--next-stage-id`; plan the anchor stage to get the order you want.
174
+ - `stage environment add` opens a browser OAuth flow — always pass `--no-browser` in CI and complete auth via the printed redirect URL.
175
+ - Finish all stage/environment configuration **before** activating; an active, promoted pipeline locks its stage structure.
176
+ - Deactivate before deleting an environment; the pipeline must be inactive.
177
+ - Treat a same-name create as idempotent — check-before-create and report the existing pipeline.