@salesforce/afv-skills 1.45.0 → 1.47.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 (171) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-observe/SKILL.md +32 -4
  3. package/skills/agentforce-observe/references/ahm-alerts.md +719 -0
  4. package/skills/automation-flow-generate/SKILL.md +11 -5
  5. package/skills/consumer-goods-promotion-bo-api-deploy/SKILL.md +275 -0
  6. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/README.md +32 -0
  7. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/SetCommentValue.cls +75 -0
  8. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/SetCommentValue.cls-meta.xml +5 -0
  9. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/interview-answers.json +13 -0
  10. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/payloads/copy.json +10 -0
  11. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/payloads/create.json +20 -0
  12. package/skills/consumer-goods-promotion-bo-api-deploy/assets/set-comment-value/payloads/update.json +16 -0
  13. package/skills/consumer-goods-promotion-bo-api-deploy/references/conventions-and-payload-rules.md +273 -0
  14. package/skills/consumer-goods-promotion-bo-api-deploy/references/generate-and-wire.md +236 -0
  15. package/skills/consumer-goods-promotion-bo-api-deploy/references/reference-example-set-comment-value.md +132 -0
  16. package/skills/consumer-goods-promotion-bo-api-deploy/references/smoke-and-verify.md +211 -0
  17. package/skills/dx-code-analyzer-configure/scripts/validate-config.sh +14 -10
  18. package/skills/dx-code-analyzer-run/scripts/apply-fixes.js +45 -4
  19. package/skills/dx-code-analyzer-run/scripts/describe-rule.js +52 -32
  20. package/skills/dx-devops-project-manage/SKILL.md +197 -0
  21. package/skills/dx-devops-project-manage/examples/common-workflows.md +197 -0
  22. package/skills/dx-devops-project-manage/references/cli-commands.md +295 -0
  23. package/skills/dx-devops-project-manage/scripts/create-project.sh +48 -0
  24. package/skills/dx-devops-project-manage/scripts/list-projects.sh +51 -0
  25. package/skills/dx-devops-project-manage/scripts/update-project.sh +96 -0
  26. package/skills/education-cloud-academic-calendar-generate/SKILL.md +225 -0
  27. package/skills/education-cloud-academic-calendar-generate/examples/quarter-calendar.json +47 -0
  28. package/skills/education-cloud-academic-calendar-generate/examples/sample-output.md +57 -0
  29. package/skills/education-cloud-academic-calendar-generate/examples/semester-calendar.json +54 -0
  30. package/skills/education-cloud-academic-calendar-generate/references/calendar-systems.md +127 -0
  31. package/skills/education-cloud-academic-calendar-generate/references/date-validation.md +222 -0
  32. package/skills/education-cloud-academic-calendar-generate/references/foundation_prerequisites.md +40 -0
  33. package/skills/education-cloud-academic-calendar-generate/scripts/validate_calendar_dates.py +143 -0
  34. package/skills/education-cloud-course-catalog-migrate/SKILL.md +321 -0
  35. package/skills/education-cloud-course-catalog-migrate/references/gotchas-detail.md +16 -0
  36. package/skills/education-cloud-course-catalog-migrate/references/gotchas.md +16 -0
  37. package/skills/education-cloud-course-catalog-migrate/references/large-catalog-handling.md +42 -0
  38. package/skills/education-cloud-course-catalog-migrate/scripts/batch_courses.py +36 -0
  39. package/skills/education-cloud-course-catalog-migrate/scripts/detect_linked_courses.py +51 -0
  40. package/skills/education-cloud-course-catalog-migrate/scripts/detect_modality_variants.py +48 -0
  41. package/skills/education-cloud-course-catalog-migrate/scripts/resolve_api_version.py +43 -0
  42. package/skills/education-cloud-course-catalog-migrate/scripts/split_course_code.py +39 -0
  43. package/skills/education-cloud-course-catalog-migrate/scripts/validate_completeness.py +54 -0
  44. package/skills/education-cloud-multi-campus-configure/references/foundation_prerequisites.md +3 -5
  45. package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +177 -0
  46. package/skills/education-cloud-student-recruitment-agent-configure/references/agent-and-subagents.md +151 -0
  47. package/skills/education-cloud-student-recruitment-agent-configure/references/customer-narration.md +34 -0
  48. package/skills/education-cloud-student-recruitment-agent-configure/references/execution-model.md +54 -0
  49. package/skills/education-cloud-student-recruitment-agent-configure/references/flows.md +82 -0
  50. package/skills/education-cloud-student-recruitment-agent-configure/references/grounding.md +199 -0
  51. package/skills/education-cloud-student-recruitment-agent-configure/references/permissions.md +183 -0
  52. package/skills/education-cloud-student-recruitment-agent-configure/references/platform-enablement.md +82 -0
  53. package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +158 -0
  54. package/skills/education-cloud-student-recruitment-agent-configure/references/routing.md +141 -0
  55. package/skills/experience-cms-brand-apply/SKILL.md +5 -5
  56. package/skills/experience-cms-brand-create/SKILL.md +2 -2
  57. package/skills/experience-cms-content-generate/SKILL.md +1 -0
  58. package/skills/experience-cms-content-render/SKILL.md +173 -0
  59. package/skills/experience-cms-content-render/assets/angular/DetailPage.component.ts +25 -0
  60. package/skills/experience-cms-content-render/assets/angular/MediaRenderer.component.ts +133 -0
  61. package/skills/experience-cms-content-render/assets/angular/TypeList.component.ts +38 -0
  62. package/skills/experience-cms-content-render/assets/angular/TypeRenderer.component.ts +90 -0
  63. package/skills/experience-cms-content-render/assets/angular/cms-content.component.ts +248 -0
  64. package/skills/experience-cms-content-render/assets/angular/cms-item.service.ts +100 -0
  65. package/skills/experience-cms-content-render/assets/react/DetailPage.tsx +20 -0
  66. package/skills/experience-cms-content-render/assets/react/MediaRenderer.tsx +129 -0
  67. package/skills/experience-cms-content-render/assets/react/TypeList.tsx +40 -0
  68. package/skills/experience-cms-content-render/assets/react/TypeRenderer.tsx +64 -0
  69. package/skills/experience-cms-content-render/assets/react/heuristicRenderer.tsx +310 -0
  70. package/skills/experience-cms-content-render/assets/react/useCmsItem.ts +129 -0
  71. package/skills/experience-cms-content-render/assets/shared/cmsContentType.ts +49 -0
  72. package/skills/experience-cms-content-render/assets/shared/cmsCore.types.ts +96 -0
  73. package/skills/experience-cms-content-render/assets/shared/externalRefs.ts +55 -0
  74. package/skills/experience-cms-content-render/references/bulk-loading.md +60 -0
  75. package/skills/experience-cms-content-render/references/codegen-guardrails.md +111 -0
  76. package/skills/experience-cms-content-render/references/detail-pages.md +87 -0
  77. package/skills/experience-cms-content-render/references/embed-recipes.md +127 -0
  78. package/skills/experience-cms-content-render/references/failure-modes.md +96 -0
  79. package/skills/experience-cms-content-render/references/heuristic-render-rules.md +131 -0
  80. package/skills/experience-cms-content-render/references/init-scaffold.md +122 -0
  81. package/skills/experience-cms-content-render/references/interaction-model.md +173 -0
  82. package/skills/experience-cms-content-render/references/package-api.md +106 -0
  83. package/skills/experience-cms-content-render/references/schema-sync.md +114 -0
  84. package/skills/experience-cms-content-render/references/styling-scopes.md +65 -0
  85. package/skills/experience-cms-content-render/references/verify.md +49 -0
  86. package/skills/experience-cms-content-type-generate/SKILL.md +2 -2
  87. package/skills/experience-content-media-stock-image-search/SKILL.md +5 -4
  88. package/skills/experience-search-coordinate/SKILL.md +198 -0
  89. package/skills/experience-search-coordinate/assets/search-payload-template.json +25 -0
  90. package/skills/experience-search-coordinate/references/content-route.md +313 -0
  91. package/skills/experience-search-coordinate/references/content-type-discovery.md +57 -0
  92. package/skills/experience-search-coordinate/references/media-route.md +172 -0
  93. package/skills/experience-search-coordinate/references/scope-resolution.md +14 -0
  94. package/skills/experience-ui-bundle-localize/SKILL.md +1 -1
  95. package/skills/experience-ui-bundle-localize/references/i18n-setup.md +5 -3
  96. package/skills/experience-ui-bundle-project-generate/SKILL.md +18 -14
  97. package/skills/experience-ui-bundle-project-generate/references/angular-project-generate.md +22 -0
  98. package/skills/experience-ui-bundle-project-generate/references/react-project-generate.md +20 -0
  99. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +58 -54
  100. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +6 -0
  101. package/skills/experience-ui-bundle-salesforce-data-access/references/graphiti-cli.md +2 -2
  102. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +6 -0
  103. package/skills/experience-ui-bundle-salesforce-data-access/references/rest-and-integration.md +2 -1
  104. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +6 -0
  105. package/skills/experience-ui-bundle-site-generate/SKILL.md +59 -8
  106. package/skills/experience-ui-bundle-site-generate/references/configure-metadata-digital-experience.md +8 -3
  107. package/skills/experience-ui-bundle-site-generate/references/configure-metadata-language-settings.md +120 -0
  108. package/skills/life-sciences-fieldsalesrep-coordinate/SKILL.md +336 -0
  109. package/skills/life-sciences-fieldsalesrep-coordinate/references/orchestration-flow.md +143 -0
  110. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-application-flexipage-mapping.md +127 -0
  111. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-deploy-commands.md +116 -0
  112. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-lifesci-metadata-deploy.md +111 -0
  113. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-overview.md +312 -0
  114. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-profile-layout-assignments.md +171 -0
  115. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-state-tracking.md +64 -0
  116. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-2-starter-config-trigger-handlers.md +122 -0
  117. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-4-user-provisioning-overview.md +335 -0
  118. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-4-user-provisioning-user-provisioning-details.md +140 -0
  119. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-execution-state-and-recovery.md +196 -0
  120. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-metadata-cache-generation.md +155 -0
  121. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-overview.md +307 -0
  122. package/skills/life-sciences-fieldsalesrep-coordinate/references/stage-5-visit-creation-visit-creation-data.md +211 -0
  123. package/skills/life-sciences-fieldsalesrep-coordinate/references/state-machine-and-changes.md +108 -0
  124. package/skills/life-sciences-kam-coordinate/SKILL.md +241 -0
  125. package/skills/life-sciences-kam-coordinate/references/orchestration-flow.md +152 -0
  126. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-application-flexipage-mapping.md +79 -0
  127. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-deploy-commands.md +131 -0
  128. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-kam-config-records.md +85 -0
  129. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-lifesci-metadata-deploy.md +112 -0
  130. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-overview.md +202 -0
  131. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-profile-layout-assignments.md +67 -0
  132. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-state-tracking.md +65 -0
  133. package/skills/life-sciences-kam-coordinate/references/stage-2-starter-config-trigger-handlers.md +123 -0
  134. package/skills/life-sciences-kam-coordinate/references/stage-4-participant-role-and-sprint.md +89 -0
  135. package/skills/life-sciences-kam-coordinate/references/stage-5-data-and-plan-templates-overview.md +337 -0
  136. package/skills/life-sciences-kam-coordinate/references/stage-5-data-creation-data.md +248 -0
  137. package/skills/life-sciences-kam-coordinate/references/stage-6-ipad-validation-script.md +35 -0
  138. package/skills/life-sciences-kam-coordinate/references/stage-6-metadata-cache-generation.md +155 -0
  139. package/skills/life-sciences-kam-coordinate/references/stage-6-user-provisioning-details.md +146 -0
  140. package/skills/life-sciences-kam-coordinate/references/stage-6-user-provisioning-overview.md +89 -0
  141. package/skills/life-sciences-kam-coordinate/references/state-machine-and-changes.md +114 -0
  142. package/skills/life-sciences-prerequisites-validate/SKILL.md +138 -0
  143. package/skills/life-sciences-prerequisites-validate/references/checks-org-settings.md +190 -0
  144. package/skills/life-sciences-prerequisites-validate/references/checks-user-and-package.md +211 -0
  145. package/skills/life-sciences-territory-configure/SKILL.md +217 -0
  146. package/skills/life-sciences-territory-configure/references/territory-metadata.md +262 -0
  147. package/skills/platform-apex-logs-debug/SKILL.md +7 -7
  148. package/skills/platform-custom-application-generate/SKILL.md +4 -4
  149. package/skills/platform-custom-object-generate/SKILL.md +7 -7
  150. package/skills/platform-custom-tab-generate/SKILL.md +1 -1
  151. package/skills/platform-dsar-policy-manage/SKILL.md +272 -0
  152. package/skills/platform-dsar-policy-manage/references/configure.md +106 -0
  153. package/skills/platform-dsar-policy-manage/references/export-and-history.md +123 -0
  154. package/skills/platform-dsar-policy-manage/references/gap-analysis-guide.md +150 -0
  155. package/skills/platform-dsar-policy-manage/references/gap-scan.md +129 -0
  156. package/skills/platform-dsar-policy-manage/references/headless-sor.md +59 -0
  157. package/skills/platform-dsar-policy-manage/references/report-format.md +59 -0
  158. package/skills/platform-dsar-policy-manage/scripts/tests/__init__.py +0 -0
  159. package/skills/platform-dsar-policy-manage/scripts/tests/test_validate_policy_tree.py +76 -0
  160. package/skills/platform-dsar-policy-manage/scripts/validate-policy-tree.py +130 -0
  161. package/skills/platform-flexipage-generate/SKILL.md +4 -0
  162. package/skills/platform-list-view-generate/SKILL.md +1 -0
  163. package/skills/platform-salesforce-connect-adapter-generate/SKILL.md +359 -0
  164. package/skills/platform-salesforce-connect-adapter-generate/references/official-examples.md +69 -0
  165. package/skills/platform-salesforce-connect-adapter-generate/references/scenarios.md +187 -0
  166. package/skills/platform-soql-query/SKILL.md +8 -8
  167. package/skills/platform-value-set-generate/SKILL.md +2 -2
  168. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +20 -27
  169. package/skills/service-native-voice-recording-transcription-configure/SKILL.md +47 -27
  170. package/skills/service-native-voice-recording-transcription-configure/references/thunderbird-voice-settings.md +13 -9
  171. package/skills/service-native-voice-recording-transcription-configure/scripts/enable-recording-transcription.sh +104 -45
@@ -0,0 +1,211 @@
1
+ # Phase 6 — Smoke test through the REST endpoints
2
+
3
+ Prove the interview's chosen workflows all reach the org and that the generated
4
+ step actually applied the interview's writes. `SKILL.md` Phase 6 links here.
5
+
6
+ The **shape** of the payload varies by interview:
7
+ - `entity` decides which nested entity the writes go on (`Tactic`, `Promotion`, etc.).
8
+ - `inputPaths` decide what keys the payload must carry.
9
+ - `outputWrites` decide what the verification SOQL should assert.
10
+
11
+ The **flow** is fixed: `initialize → ingest(create) → verify → ingest(update) →
12
+ verify → ingest(copy) → verify`, but the update and copy legs only run if the
13
+ interview included them in `workflows`.
14
+
15
+ ## 6.-1 — Derive the payload contract from the workflow (schema-first)
16
+
17
+ Do this BEFORE composing any request body. The workflow itself declares the
18
+ accepted paths — read them, don't guess. See
19
+ `references/conventions-and-payload-rules.md` ("Payload contract derivation")
20
+ for the canonical SOQL; run it once per invoked workflow (`create`, `update`,
21
+ `copy`), producing three contracts.
22
+
23
+ **Additionally**, apply the eight cross-workflow rules (R1..R8) in
24
+ `references/conventions-and-payload-rules.md` ("Promotion payload — cross-workflow
25
+ rules"). These are the constraints the schema alone cannot express and every one
26
+ has caused a smoke-test failure historically. Summary of what the skill MUST do
27
+ on top of the derived contract:
28
+
29
+ - **R1** — force `DateFrom`, `DateThru`, `Slogan` into the create payload. If the user gave duration-in-weeks intent, compute `DateThru = DateFrom + weeks*7 - 1` client-side.
30
+ - **R2** — poll for `Status__c = 'Calculated'` (NOT `Processed`, which does not exist in the picklist).
31
+ - **R3** — send level NAMES verbatim as `ProductFilter.Criteria` keys (`Category`, `Brand`, ...), NOT Product2 field API names.
32
+ - **R4** — pre-flight the anchor account has a `Plan` `Account_Extension__c` row valid for `DateFrom..DateThru` in this sales org.
33
+ - **R5** — restrict `ManualInputs[].KPI` values to `editable` / `editable_calculated` `KPI_Definition__c.Name` on the template's `KPI_Set__c`.
34
+ - **R6** — for `copy`, derive requireds the same way, then layer the Apex-only preconditions (`Is_Copyable__c`, template type, anchor).
35
+ - **R7** — reject any `Tactics[*].TacticTemplate` not linked to the chosen `PromotionTemplate` in this sales org.
36
+ - **R8** — reject any `PromotionTemplate` whose `Promotion_Type__c != 'Promotion'` (fail-fast before ingest — otherwise it surfaces as a misleading `/productfilter` error).
37
+
38
+ For each derived contract, compute:
39
+ - `requiredPaths` = union of `Path__c` where `Required__c = true`.
40
+ - `optionalPaths` = every other declared path.
41
+ - `arrayPaths` = any `Path__c` starting with or containing `[*]` (bind to `Tactics[]` / `ManualInputs[]` in the request).
42
+
43
+ Emit `./out/contracts/<workflow>.json`:
44
+ ```json
45
+ {
46
+ "workflow": "create",
47
+ "salesOrg": "<salesOrg>",
48
+ "required": [{"path": ".PromotionTemplate", "step": "loadPromotionDefaults2"}, ...],
49
+ "optional": [...],
50
+ "arrayPaths": ["Tactics[*].TacticTemplate", ...]
51
+ }
52
+ ```
53
+
54
+ Then reconcile against user input (three possible sources; skill picks the first non-empty):
55
+
56
+ 1. `--intent-file <path>` — a JSON object whose keys mirror the payload shape. Validate every top-level key against the derived contract; any key not in `required ∪ optional` → stop, print `"Property '<key>' is not declared in the <workflow> contract"`.
57
+ 2. `--mass-upload <path>` — a JSONL or CSV file, one promotion per row. Column headers MUST match the contract's `required` and `optional` path list verbatim; missing any required column → stop with the list of missing columns.
58
+ 3. Interactive prompt — print the required list, ask for each in turn, then offer the optional list. Interview text is `./out/prompts/<workflow>.txt` (generated, not hard-coded).
59
+
60
+ Reference-data resolution (still schema-first, but the schema alone cannot
61
+ express these — do it AFTER contract validation and BEFORE any REST call):
62
+
63
+ - `PromotionTemplate` value → resolve name against `${PREFIX_UNDER}Promotion_Template__c` with `${PREFIX_UNDER}Sales_Org__c = <salesOrg>`. Miss → stop with "Promotion Template <name> not found in sales org <salesOrg>".
64
+ - Each `Tactics[*].TacticTemplate` value → resolve against `${PREFIX_UNDER}Tactic_Template__c` scoped to sales org, AND confirm linkage to the chosen `PromotionTemplate` via `${PREFIX_UNDER}Promotion_Template_Tactic_Template__c`. Miss → stop with the concrete failure.
65
+ - `AnchorAccount` value → resolve against `Account` where `${PREFIX_UNDER}ExternalId__c = <value> AND ${PREFIX_UNDER}Sales_Org__c = <salesOrg>`. Never pass a Salesforce Id — the packaged Apex looks up by external id.
66
+ - `ProductFilter.Criteria.{Brand,Category,Subcategory,Flavor,Package}[*]` → resolve each name against the packaged product-attribute lookups, scoped to the sales org.
67
+ - `ProductFilter.{Included,Excluded}Products[*]` → resolve each SKU against `Product2` scoped to the sales org.
68
+
69
+ Template-conditional requireds (the two the schema cannot express):
70
+ - `setPromotionAnchor2` declares `.AnchorAccount` as OPTIONAL, but the packaged Apex enforces it for certain `PromotionTemplate` values (verified for `Customer Promotion`). Do NOT hard-code the list — if a pre-flight `POST /ingest` with a probe promotion returns `"AnchorAccount is required"`, re-prompt for `AnchorAccount` and retry.
71
+
72
+ ## 6.0 — Materialize per-run payloads
73
+
74
+ Only reached once the derived contract, user input, and reference-data
75
+ resolution all pass. Emit three payload files under `./out/smoke/`:
76
+ `create.json`, `update.json`, `copy.json`. Each is composed from the contract:
77
+
78
+ 1. Top-level: `{importId, workflow, salesOrg, promotions: [...]}`. All four keys are lower-camel in the wire format (see the "Wire-format quirks" note in `references/conventions-and-payload-rules.md`).
79
+ 2. Each promotion carries every `requiredPaths` value the user supplied (or an interview-collected value), plus any `optionalPaths` opted into. No unrecognized keys.
80
+ 3. Nested arrays (`Tactics[]`, `ManualInputs[]`) mirror the `arrayPaths` groups from the contract.
81
+ 4. Any user-supplied lookup value has been REPLACED by its resolved-in-sales-org form before writing the file: template names remain as names (packaged Apex resolves per sales org), account external ids remain as external ids.
82
+ 5. Probe values for interview-driven `outputWrites` assertions are written to `./out/smoke/expected.json`.
83
+
84
+ The reference example ships a working set for `SetCommentValue`
85
+ (`assets/set-comment-value/payloads/`); `--preset set-comment-value` copies
86
+ those directly instead of running the generator.
87
+
88
+ Setup — every REST call below goes through `sf api request rest`, which
89
+ authenticates with the CLI's stored session for `--target-org` and
90
+ mints/refreshes the token internally. **Never** extract the access token
91
+ (`sf org display` / `sf org auth show-access-token`) and hand-build a `curl`
92
+ request: a bearer token in shell output, traces, or agent context is a
93
+ credential exposure (S1). Do **not** add `--json` to `sf api request rest` — the
94
+ raw stdout body is already JSON. `${URL_NS}` is the namespace segment from
95
+ Phase 1 (`/cgcloud` / `/cgcloud_dev` / empty); the endpoint is instance-relative.
96
+
97
+ ```bash
98
+ BASE="/services/apexrest${URL_NS}/promotions"
99
+ ```
100
+
101
+ ## 6a — Create
102
+
103
+ ```bash
104
+ # 1. Initialize a transaction
105
+ INIT=$(sf api request rest "${BASE}/initialize" --method POST \
106
+ --body '{"nrOfItems": 1, "salesOrg": "<salesOrg>", "timeout": 600}' \
107
+ --target-org <alias>)
108
+ IMPORT_ID=$(echo "$INIT" | jq -r .importId)
109
+ ```
110
+
111
+ Bounds (from `BeginPromotionImportService`): `nrOfItems >= 1` and
112
+ `nrOfItems <= BoApiPromotionsPerTransaction` application limit; `timeout in
113
+ [300, 3600]`. Smoke test uses 1 item and 600s.
114
+
115
+ ```bash
116
+ # 2. Ingest the generated create payload
117
+ CREATE_JSON=$(jq --arg id "$IMPORT_ID" '.importId = $id' ./out/smoke/create.json)
118
+ CREATE_RESP=$(sf api request rest "${BASE}/ingest" --method POST \
119
+ --body "$CREATE_JSON" \
120
+ --target-org <alias>)
121
+ ```
122
+
123
+ Non-2xx → stop, print the response body.
124
+
125
+ ```bash
126
+ # 3. Poll status until every record is Calculated (terminal success) or Error.
127
+ # Wire shape (verified against the running org): the endpoint returns an
128
+ # object, not an array — {"txid":"...","details":[{"status":"Calculated",
129
+ # "nrOfItems":1}]}. Note lowercase `status` and the `details[]` nesting.
130
+ for i in $(seq 1 60); do
131
+ STATUS=$(sf api request rest "${BASE}/status?importId=${IMPORT_ID}" \
132
+ --target-org <alias>)
133
+ echo "$STATUS" | jq .
134
+ DONE=$(echo "$STATUS" | jq '[.details[] | select(.status | test("^(Calculated|Error)$"))] | length')
135
+ TOTAL=$(echo "$STATUS" | jq '.details | length')
136
+ [ "$DONE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ] && break
137
+ sleep 5
138
+ done
139
+ ```
140
+
141
+ ## 6a-verify — transaction-log query + interview-driven write assertion
142
+
143
+ The status endpoint returns *counts*. To guarantee we never claim success while
144
+ a record failed, also query `BO_API_Transaction_Log__c` directly:
145
+
146
+ ```bash
147
+ sf data query --target-org <alias> --json --query "
148
+ SELECT Id, ${PREFIX_UNDER}Status__c, ${PREFIX_UNDER}Error_Type__c,
149
+ ${PREFIX_UNDER}Error_Information__c,
150
+ ${PREFIX_UNDER}Promotion__c, ${PREFIX_UNDER}Transaction_Id__c
151
+ FROM ${PREFIX_UNDER}BO_API_Transaction_Log__c
152
+ WHERE ${PREFIX_UNDER}Transaction_Id__c = '${IMPORT_ID}'
153
+ AND ${PREFIX_UNDER}Status__c != 'Calculated'
154
+ "
155
+ ```
156
+
157
+ Any rows returned → stop, print them, refuse to declare success.
158
+ `Error_Information__c` carries the actual transform/validation message (e.g.
159
+ `Properties other than those defined were not expected at #.<path>` or `Required
160
+ property missing at #.<path>`) — read it verbatim to fix the payload; it is the
161
+ ONLY error-detail field on this object (there is no `Error_Message__c`).
162
+
163
+ Once green, pull the created promotion and assert every field named in the
164
+ interview's `outputWrites` matches its expected probe value from
165
+ `./out/smoke/expected.json`:
166
+
167
+ ```bash
168
+ PROMO_ID=$(sf data query --target-org <alias> --json --query "
169
+ SELECT ${PREFIX_UNDER}Promotion__c
170
+ FROM ${PREFIX_UNDER}BO_API_Transaction_Log__c
171
+ WHERE ${PREFIX_UNDER}Transaction_Id__c = '${IMPORT_ID}'
172
+ AND ${PREFIX_UNDER}Status__c = 'Calculated'
173
+ LIMIT 1
174
+ " | jq -r ".result.records[0].${PREFIX_UNDER}Promotion__c")
175
+
176
+ # For each outputWrite {field}: SELECT ${PREFIX_UNDER}<field> FROM
177
+ # ${PREFIX_UNDER}<entity>__c WHERE (entity's parent linkage to PROMO_ID)
178
+ ```
179
+
180
+ Every field's actual value must equal the expected probe value in
181
+ `expected.json`. Any mismatch → stop, print `(field, expected, actual)`, refuse
182
+ to declare success — the generated step didn't do what the interview said.
183
+
184
+ ## 6b — Update (skip if `update` not in interview `workflows`)
185
+
186
+ Repeat 6a with `update.json`. The payload references the newly-created promotion
187
+ id + entity ids from 6a's create response and carries different probe values.
188
+ Verify every `outputWrites` field now equals the *update* probe values.
189
+
190
+ ## 6c — Copy (skip if `copy` not in interview `workflows`)
191
+
192
+ Repeat 6a with `copy.json` (references the created promotion id as the copy
193
+ source). Verify:
194
+ - A new promotion id came back.
195
+ - Every `outputWrites` field on the *copied* record equals the source record's value at copy-time (proves the step fired inside the copy workflow too).
196
+
197
+ **Copy payload schema is *stricter* than create/update, and child inputs come
198
+ from the source record.** The BO API rejects `PromotionTemplate`, `DateFrom`,
199
+ `DateThru`, `AnchorAccount`, `Tactics[].Id`, `Tactics[].TacticTemplate` for the
200
+ `copy` workflow — those come from the source record. Copying `create.json`
201
+ verbatim and swapping `workflow` fails with `Properties other than those defined
202
+ were not expected at #.<field>` and the ATL row lands in `Error`.
203
+
204
+ Also — verified in-org — on `copy`, **per-child input paths come from the source
205
+ record, not the payload**. The payload's `Tactics[]` block is accepted by the
206
+ schema but has no effect on the cloned children; each cloned child runs its
207
+ `outputWrites` against the *source* child's value. That is why the 6c verify says
208
+ "copied == source-at-copy value": it checks the step fired, not that payload
209
+ child probes made it through. `copy.json` should therefore carry only the source
210
+ promotion `Id` plus top-level probe fields (e.g. `Slogan`); `Tactics[]` in the
211
+ copy payload is decorative.
@@ -37,10 +37,11 @@ fi
37
37
  # Basic YAML syntax check (if python3 available)
38
38
  if command -v python3 &> /dev/null; then
39
39
  echo "Checking YAML syntax..."
40
- if python3 -c "
40
+ if python3 - "$CONFIG_FILE" 2>&1 <<'PYEOF'; then
41
41
  import yaml, sys
42
+ config_file = sys.argv[1]
42
43
  try:
43
- with open('${CONFIG_FILE}', 'r') as f:
44
+ with open(config_file, 'r') as f:
44
45
  config = yaml.safe_load(f)
45
46
  if config is None:
46
47
  print('WARNING: Config file is empty or contains only comments')
@@ -50,10 +51,10 @@ try:
50
51
  sys.exit(1)
51
52
  print('YAML syntax: OK')
52
53
  except yaml.YAMLError as e:
53
- print(f'ERROR: Invalid YAML syntax')
54
+ print('ERROR: Invalid YAML syntax')
54
55
  print(f' {e}')
55
56
  sys.exit(1)
56
- " 2>&1; then
57
+ PYEOF
57
58
  echo ""
58
59
  else
59
60
  echo ""
@@ -69,16 +70,19 @@ echo "Checking known fields..."
69
70
  VALID_TOP_LEVEL="config_root log_folder log_level rules engines ignores suppressions"
70
71
 
71
72
  if command -v python3 &> /dev/null; then
72
- python3 -c "
73
+ python3 - "$CONFIG_FILE" "$VALID_TOP_LEVEL" 2>&1 <<'PYEOF'
73
74
  import yaml, sys
74
75
 
75
- with open('${CONFIG_FILE}', 'r') as f:
76
+ config_file = sys.argv[1]
77
+ valid_top_level = sys.argv[2]
78
+
79
+ with open(config_file, 'r') as f:
76
80
  config = yaml.safe_load(f)
77
81
 
78
82
  if config is None:
79
83
  sys.exit(0)
80
84
 
81
- valid_fields = set('${VALID_TOP_LEVEL}'.split())
85
+ valid_fields = set(valid_top_level.split())
82
86
  unknown = set(config.keys()) - valid_fields
83
87
  if unknown:
84
88
  print(f'WARNING: Unknown top-level fields: {sorted(unknown)}')
@@ -100,12 +104,12 @@ if 'engines' in config and config['engines']:
100
104
  # Check ignores section
101
105
  if 'ignores' in config and config['ignores']:
102
106
  if 'files' not in config['ignores']:
103
- print('WARNING: ignores section should contain a \"files\" list')
107
+ print('WARNING: ignores section should contain a "files" list')
104
108
  elif not isinstance(config['ignores']['files'], list):
105
109
  print('ERROR: ignores.files must be a list of glob patterns')
106
110
  sys.exit(1)
107
111
  else:
108
- print(f'Ignore patterns: {len(config[\"ignores\"][\"files\"])} patterns configured')
112
+ print(f'Ignore patterns: {len(config["ignores"]["files"])} patterns configured')
109
113
 
110
114
  # Check rules section
111
115
  if 'rules' in config and config['rules']:
@@ -120,7 +124,7 @@ if 'rules' in config and config['rules']:
120
124
  print(f'WARNING: rules.{engine}.{rule_name}.severity = {sev} (expected 1-5 or Critical/High/Moderate/Low/Info)')
121
125
 
122
126
  print('')
123
- " 2>&1
127
+ PYEOF
124
128
  fi
125
129
 
126
130
  # Run sf code-analyzer config validation (if sf CLI available)
@@ -15,14 +15,55 @@ const filePath = process.argv[2];
15
15
  const data = JSON.parse(fs.readFileSync(filePath, "utf8"));
16
16
  const runDir = data.runDir || "";
17
17
 
18
- // Group fixes by file
18
+ // Fix targets are confined to the current working directory (the project being
19
+ // fixed). loc.file and runDir come from the results JSON and are untrusted;
20
+ // resolving each target against cwd and rejecting anything that escapes it
21
+ // stops a crafted results file from writing arbitrary paths (e.g. /etc/passwd
22
+ // or ../../outside-project).
23
+ const baseDir = fs.realpathSync(process.cwd());
24
+
25
+ function isOutside(base, target) {
26
+ const rel = path.relative(base, target);
27
+ return rel === "" || rel.startsWith("..") || path.isAbsolute(rel);
28
+ }
29
+
30
+ function safeResolve(candidate) {
31
+ if (typeof candidate !== "string" || !candidate) return null;
32
+ let rel = candidate;
33
+ // Engine output often uses absolute paths under the scan runDir; normalize
34
+ // those to project-relative before confinement.
35
+ if (runDir && rel.startsWith(runDir)) rel = rel.substring(runDir.length + 1);
36
+ const resolved = path.resolve(baseDir, rel);
37
+ // Lexical guard: rejects absolute paths and `..` traversal.
38
+ if (isOutside(baseDir, resolved)) return null;
39
+ // Symlink-aware guard: path.resolve/relative do not follow symlinks, so a
40
+ // symlinked path component (e.g. `link/victim` where `link` -> outside the
41
+ // tree) would pass the lexical check and let writeFileSync escape. Fix
42
+ // targets are read before being written, so the file exists — resolve its
43
+ // real path and re-check. Writing to the realpath also avoids following a
44
+ // symlink at write time. A missing target (realpathSync throws) is skipped.
45
+ let real;
46
+ try {
47
+ real = fs.realpathSync(resolved);
48
+ } catch {
49
+ return null;
50
+ }
51
+ if (isOutside(baseDir, real)) return null;
52
+ return real;
53
+ }
54
+
55
+ // Group fixes by confined, absolute file path
19
56
  const fileFixesMap = new Map();
57
+ let fixesSkippedUnsafe = 0;
20
58
  data.violations.forEach(v => {
21
59
  if (v.fixes && v.fixes.length > 0) {
22
60
  v.fixes.forEach(fix => {
23
61
  const loc = fix.location;
24
- let filePath = loc.file;
25
- if (runDir && filePath.startsWith(runDir)) filePath = filePath.substring(runDir.length + 1);
62
+ const filePath = safeResolve(loc.file);
63
+ if (!filePath) {
64
+ fixesSkippedUnsafe++;
65
+ return;
66
+ }
26
67
 
27
68
  if (!fileFixesMap.has(filePath)) fileFixesMap.set(filePath, []);
28
69
  fileFixesMap.get(filePath).push({
@@ -83,4 +124,4 @@ fileFixesMap.forEach((fixes, filePath) => {
83
124
  }
84
125
  });
85
126
 
86
- console.log(JSON.stringify({ success: true, filesModified, fixesApplied, fixesSkipped, totalFixableFiles: fileFixesMap.size }));
127
+ console.log(JSON.stringify({ success: true, filesModified, fixesApplied, fixesSkipped, fixesSkippedUnsafe, totalFixableFiles: fileFixesMap.size }));
@@ -15,7 +15,32 @@
15
15
  // resource: https://...
16
16
  // description: Some description text
17
17
 
18
- const { execSync } = require("child_process");
18
+ const { execFileSync } = require("child_process");
19
+
20
+ /**
21
+ * Run `sf code-analyzer rules ...` safely.
22
+ *
23
+ * Arguments are passed as an argv array (NOT a shell string), so a rule name
24
+ * or --engine value can never be interpreted as shell syntax. Returns the
25
+ * command's stdout as text; never throws (a non-zero exit still yields the
26
+ * output the caller wants to parse).
27
+ */
28
+ function runCodeAnalyzerRules(extraArgs) {
29
+ try {
30
+ return execFileSync("sf", ["code-analyzer", "rules", ...extraArgs], {
31
+ encoding: "utf8",
32
+ timeout: 60000,
33
+ maxBuffer: 2 * 1024 * 1024,
34
+ stdio: ["ignore", "pipe", "pipe"],
35
+ });
36
+ } catch (err) {
37
+ // Preserve the original `2>&1` behavior: a non-zero exit that emitted
38
+ // partial stdout plus a diagnostic on stderr must surface BOTH streams, in
39
+ // order, so a genuine failure isn't misparsed as "rule not found".
40
+ const combined = String(err.stdout || "") + String(err.stderr || "");
41
+ return combined || (err.output && err.output.filter(Boolean).join("")) || "";
42
+ }
43
+ }
19
44
 
20
45
  function printUsage() {
21
46
  console.error(`Usage: node describe-rule.js <rule-name> [--engine <engine>]
@@ -52,25 +77,21 @@ for (let i = 1; i < args.length; i++) {
52
77
  // Build the rule selector for the lookup
53
78
  const selector = engine ? `${engine}:${ruleName}` : ruleName;
54
79
 
55
- // Run `sf code-analyzer rules` with --view detail to get full rule info
56
- let rawOutput;
57
- try {
58
- const cmd = `sf code-analyzer rules --rule-selector "${selector}" --view detail 2>&1`;
59
- rawOutput = execSync(cmd, {
60
- encoding: "utf8",
61
- timeout: 60000,
62
- maxBuffer: 2 * 1024 * 1024,
63
- });
64
- } catch (err) {
65
- // execSync throws on non-zero exit, but we still want the output
66
- rawOutput = err.stdout || err.stderr || (err.output && err.output.join("")) || "";
67
- if (!rawOutput) {
68
- console.log(JSON.stringify({
69
- status: "error",
70
- message: `Failed to run sf code-analyzer rules: ${err.message}`,
71
- }));
72
- process.exit(0);
73
- }
80
+ // Run `sf code-analyzer rules` with --view detail to get full rule info.
81
+ // `selector` is passed as a single argv element, so it cannot inject shell
82
+ // commands even if it contains metacharacters.
83
+ const rawOutput = runCodeAnalyzerRules([
84
+ "--rule-selector",
85
+ selector,
86
+ "--view",
87
+ "detail",
88
+ ]);
89
+ if (!rawOutput) {
90
+ console.log(JSON.stringify({
91
+ status: "error",
92
+ message: `Failed to run sf code-analyzer rules for selector "${selector}"`,
93
+ }));
94
+ process.exit(0);
74
95
  }
75
96
 
76
97
  // Parse the detail view output
@@ -224,12 +245,16 @@ function parseDetailOutput(output) {
224
245
  function tryGrepFallback(ruleName, engine) {
225
246
  try {
226
247
  const sel = engine || "Recommended";
227
- const cmd = `sf code-analyzer rules --rule-selector "${sel}" 2>&1 | grep -i "${ruleName}"`;
228
- const grepOutput = execSync(cmd, {
229
- encoding: "utf8",
230
- timeout: 60000,
231
- maxBuffer: 2 * 1024 * 1024,
232
- });
248
+ const output = runCodeAnalyzerRules(["--rule-selector", sel]);
249
+
250
+ // Case-insensitive substring filter done in JS. Previously this shelled out
251
+ // to `... | grep -i "${ruleName}"`, interpolating the untrusted rule name
252
+ // into a shell command; matching here removes that injection sink.
253
+ const needle = ruleName.toLowerCase();
254
+ const grepOutput = output
255
+ .split("\n")
256
+ .filter((line) => line.toLowerCase().includes(needle))
257
+ .join("\n");
233
258
 
234
259
  if (!grepOutput.trim()) return null;
235
260
 
@@ -273,12 +298,7 @@ function tryGrepFallback(ruleName, engine) {
273
298
  function tryFuzzyFallback(ruleName, engine) {
274
299
  try {
275
300
  const sel = engine || "Recommended";
276
- const cmd = `sf code-analyzer rules --rule-selector "${sel}" 2>&1`;
277
- const output = execSync(cmd, {
278
- encoding: "utf8",
279
- timeout: 60000,
280
- maxBuffer: 2 * 1024 * 1024,
281
- });
301
+ const output = runCodeAnalyzerRules(["--rule-selector", sel]);
282
302
 
283
303
  // Extract rule names from table output
284
304
  // Lines with rule data have: index name engine severity tags
@@ -0,0 +1,197 @@
1
+ ---
2
+ name: dx-devops-project-manage
3
+ description: "Use this skill to list, view, or manage DevOps Center projects in a Salesforce org — show all projects, create a new project, or update an existing project's name, description, or active status. Invoke it to run sf devops project list whenever the user wants to show, see, view, display, or list available projects, check which or how many DevOps Center projects exist, or look up a project ID — even a plain listing request should use this skill rather than a raw tool or a direct answer. Also invoke to create a project, set up a new deployment pipeline foundation, initialize DevOps Center for a new feature, update project settings like name and description, or activate/deactivate (archive) a project. Consolidates sf devops project list/create/update operations. DO NOT TRIGGER for work item, pipeline, promotion, or conflict operations — those are separate skills."
4
+ metadata:
5
+ version: "1.0"
6
+ domains: ["Developer Experience"]
7
+ minApiVersion: "58.0"
8
+ relatedSkills:
9
+ - "dx-devops-pipeline-manage"
10
+ - "dx-devops-promote"
11
+ - "dx-devops-work-item-manage"
12
+ accessCheck:
13
+ - type: "orgPref"
14
+ value: "ALMDevopsCorePref"
15
+ - type: "userPerm"
16
+ value: "UserHasDevOpsCore"
17
+ cliTools:
18
+ - tool: ["jq"]
19
+ semver: ">=1.6"
20
+ - tool: ["sf"]
21
+ semver: ">=2.0.0"
22
+ ---
23
+
24
+ # DevOps Center Project Management
25
+
26
+ Manages the complete DevOps Center project lifecycle — from listing existing projects through creation to updating project settings. Provides headless CLI-driven operations for autonomous release workflows.
27
+
28
+ ## Scope
29
+
30
+ - **In scope**: List DevOps Center projects, create a new project, update project fields (name, description), resolve a project name to its ID for downstream skills
31
+ - **Out of scope**: Work item lifecycle, pipeline creation/configuration, promotion/deployment, conflict detection (separate skills)
32
+
33
+ ---
34
+
35
+ ## Required Inputs
36
+
37
+ Gather or infer before proceeding:
38
+
39
+ - **Operation type**: list, create, or update
40
+ - **Target org**: `--target-org <alias>` is required on every command unless the `target-org` config var is already set (`sf config get target-org`)
41
+ - **For list**: no other required input (lists all projects in the org); optional name filter
42
+ - **For create**: project name (required), description (optional)
43
+ - **For update**: project ID (required), fields to update — at least one of name, description, or active status
44
+
45
+ Defaults unless specified:
46
+ - Output format: `--json` for headless consumption
47
+ - Project identifier: when the user gives a project name for update, resolve it to a project ID first via `sf devops project list --target-org <alias> --json`
48
+
49
+ If the user provides a clear request ("list all projects", "create a project called Release Alpha", "rename project X to Y"), proceed immediately without unnecessary questions.
50
+
51
+ ---
52
+
53
+ ## Workflow
54
+
55
+ All operations use `sf devops project` CLI commands with `--json` output for structured consumption.
56
+
57
+ ### Phase 1 — Identify Operation
58
+
59
+ 1. **Determine the operation type** from user intent:
60
+ - Keywords like "list", "show", "find", "what projects", "get project ID" → list operation
61
+ - Keywords like "create", "new", "set up", "initialize" → create operation
62
+ - Keywords like "update", "change", "rename", "modify", "edit" → update operation
63
+
64
+ ### Phase 2 — Execute Operation
65
+
66
+ 2. **Verify org authentication** before any operation, checking the same org the operation will target:
67
+ ```bash
68
+ # When a specific org is requested, check that alias (do NOT rely on the default org):
69
+ sf org display --target-org <alias> --json
70
+ # Only when no alias is supplied and a default org is expected:
71
+ sf org display --json
72
+ ```
73
+ - If the requested org is not authenticated or authentication has expired, instruct the user to run:
74
+ ```bash
75
+ sf org login web --alias <alias>
76
+ ```
77
+ - Verify the authenticated org has DevOps Center enabled by attempting to list projects
78
+ - `--target-org <alias>` is **required** on every `sf devops project` command unless the `target-org` config var is set (check with `sf config get target-org`). Add `--target-org <alias>` to all commands when targeting a specific org — a targeted operation must never require or reset the default org
79
+
80
+ > Deterministic project-list parsing, empty-list handling, name→ID resolution, idempotent create, and update are handled by the scripts in `scripts/` — each script exits non-zero with an actionable message on failure. Pass the org alias as the trailing/`--target-org` argument when the `target-org` config var is not set; omit it to use the default org. The scripts read the authoritative `.result.projects[]` list envelope.
81
+
82
+ 3. **List projects** — when the user wants to see existing projects or resolve a project name to an ID:
83
+ - **Use the `sf devops project list` CLI (via `scripts/list-projects.sh`) — do NOT substitute an MCP/metadata tool** (e.g. a `list_devops_center_projects` tool). The `sf devops project` CLI is the only supported, verifiable path; other tools bypass this skill and will not satisfy the operation.
84
+ - To list all projects: run `scripts/list-projects.sh [target-org]` and report any errors it returns. Output is tab-separated `Id Name Description`, one project per line; a single line `NO_PROJECTS` means none exist.
85
+ - To resolve a single project name to its ID: run `scripts/list-projects.sh --resolve "<project-name>" [target-org]` and report any errors it returns (exit 3 = no such project).
86
+
87
+ 4. **Create a project** — when the user wants to create a new project:
88
+ - Run `scripts/create-project.sh "<name>" "<description>" [target-org]` and report any errors it returns. The description argument is optional.
89
+ - The script is idempotent: it prints `EXISTING <id>` if a project with that name already exists, or `CREATED <id>` after creating and verifying a new one. Capture the returned ID for downstream operations (work items, pipelines).
90
+
91
+ 5. **Update a project** — when the user wants to change name, description, or active status:
92
+ - Run `scripts/update-project.sh --project (<id>|name:<name>) [--name "<new-name>"] [--description "<new-desc>"] [--is-active|--no-is-active] [--target-org <alias>]` and report any errors it returns.
93
+ - Pass `--project name:<name>` to update by name (the script resolves it to an ID) or `--project <id>` for a known ID.
94
+ - At least one of `--name`, `--description`, or `--is-active`/`--no-is-active` must be provided (the script enforces this). Use `--is-active` to activate or `--no-is-active` to deactivate.
95
+ - The script prints `UPDATED <id>` on success.
96
+
97
+ ### Phase 3 — Report
98
+
99
+ 6. **Report results** (the scripts already verified success deterministically; report their output to the user):
100
+ - **List**: present projects in a readable format showing project ID, name, and description. If `NO_PROJECTS` was returned, state that no DevOps Center projects were found. If resolving a name to an ID, return the ID.
101
+ - **Create**: return the project ID and confirm — "Project created successfully. Use this project ID for work items and pipelines: <id>." If the script returned `EXISTING <id>`, tell the user the project already existed and return that ID.
102
+ - **Update**: confirm which fields were changed (e.g., "Project name updated to 'Platform Core'", or "Project deactivated").
103
+
104
+ ---
105
+
106
+ ## Rules / Constraints
107
+
108
+ | Constraint | Rationale |
109
+ |-----------|-----------|
110
+ | Always use the `sf devops project` CLI | List/create/update MUST go through `sf devops project` (via the `scripts/`), never a `salesforce_dx` MCP tool or metadata query — those bypass this skill and fail the operation |
111
+ | All sf devops commands must use `--json` flag | Structured output is required for headless consumption; human-readable output is unreliable for parsing |
112
+ | `--target-org` required unless config var set | Every `sf devops project` command requires `--target-org <alias>` unless the `target-org` config var is already set |
113
+ | Project ID required for update | Use `--project-id` (`-i`); resolve from a name via `sf devops project list --target-org <alias> --json` when the user gives a name |
114
+ | `--name` required for create | A project cannot be created without a name |
115
+ | At least one update field required | Update command fails if none of `--name`, `--description`, or `--is-active` is provided |
116
+ | Use `--is-active` / `--no-is-active` for activation | Activate with `--is-active`, deactivate with `--no-is-active`; do not pass a value |
117
+ | Idempotent create operations | Check for an existing project with the same name before creating a duplicate |
118
+ | Never use interactive prompts | Skills run in headless environments; all inputs must be via CLI flags |
119
+ | A project is a prerequisite for work items and pipelines | Downstream skills (work-item-manage, pipeline-manage) need the project ID this skill returns |
120
+
121
+ ---
122
+
123
+ ## Gotchas
124
+
125
+ | Issue | Resolution |
126
+ |-------|------------|
127
+ | **No default org set** | Run `sf org display --json` first; if it fails, instruct the user to run `sf org login web --set-default` |
128
+ | **User provides project by name, not ID (update)** | Resolve via `scripts/list-projects.sh --resolve "<name>" [target-org]`, or pass `--project name:<name>` to `scripts/update-project.sh` (it resolves internally) |
129
+ | **Tempted to use an MCP listing tool** | A `salesforce_dx` MCP tool (e.g. `list_devops_center_projects`) may be available, but using it bypasses this skill and the `sf devops project list` CLI — always list via `scripts/list-projects.sh` |
130
+ | **DevOps Center not enabled** | If `sf devops project list` errors, the org lacks DevOps Center; instruct the user to provision it in Setup → DevOps Center |
131
+ | **Project not found (update)** | User provided an invalid project ID; run `scripts/list-projects.sh [target-org]` to show available projects |
132
+ | **Wrong list envelope** | `project list` returns records under `.result.projects[]` (capitalized `Id`/`Name`/`Description`), NOT `.result[]`; the scripts already use the correct path |
133
+ | **Duplicate project name** | Idempotent create check should catch this; return the existing project ID instead of creating a duplicate |
134
+ | **Empty project list** | No projects exist yet; guide the user to create one before setting up work items or pipelines |
135
+ | **Missing update field** | Update fails if none of `--name`, `--description`, or `--is-active` is provided; ensure at least one is passed |
136
+ | **No default org and no `--target-org`** | Commands fail with a NoOrgFound / missing target-org error; set `--target-org <alias>` or `sf config set target-org <alias>` |
137
+ | **Activate/deactivate passes a value** | `--is-active` is a boolean flag — use `--is-active` or `--no-is-active`, never `--is-active true` |
138
+
139
+ ---
140
+
141
+ ## Output Expectations
142
+
143
+ Deliverables vary by operation:
144
+
145
+ - **List**: tab-separated `Id Name Description` lines (or `NO_PROJECTS`) from `scripts/list-projects.sh`
146
+ - **Create**: `EXISTING <id>` or `CREATED <id>` from `scripts/create-project.sh`
147
+ - **Update**: `UPDATED <id>` from `scripts/update-project.sh`
148
+
149
+ Outputs are derived from the `sf devops project` CLI via the `scripts/` helpers, which read the authoritative `.result.projects[]` list envelope.
150
+
151
+ ---
152
+
153
+ ## Verification Checklist
154
+
155
+ Before reporting results to the user:
156
+
157
+ ### Universal Checks
158
+ - [ ] Was org authentication verified with `sf org display --json`?
159
+ - [ ] Was `--target-org <alias>` supplied to the script (or the `target-org` config var confirmed set)?
160
+ - [ ] Did the invoked script exit 0? (Non-zero exit means the operation failed — report the script's error message.)
161
+
162
+ ### List Operation Checks
163
+ - [ ] Are projects displayed with project ID, name, and description?
164
+ - [ ] If the script returned `NO_PROJECTS`, was this communicated to the user?
165
+ - [ ] If resolving a name to an ID, was the ID returned (or "not found" surfaced on exit 3)?
166
+
167
+ ### Create Operation Checks
168
+ - [ ] Did the script return `CREATED <id>` or `EXISTING <id>`, and was the ID reported?
169
+
170
+ ### Update Operation Checks
171
+ - [ ] Was the project identified by `--project <id>` or `--project name:<name>`?
172
+ - [ ] Was at least one update field provided (name, description, or `--is-active`/`--no-is-active`)?
173
+ - [ ] Did the script return `UPDATED <id>`?
174
+
175
+ ---
176
+
177
+ ## Cross-Skill Integration
178
+
179
+ | When | Delegate to |
180
+ |------|-------------|
181
+ | User wants to create, list, or update work items in a project | `dx-devops-work-item-manage` (pass the project ID from this skill) |
182
+ | User wants to create or configure a pipeline for a project | `dx-devops-pipeline-manage` |
183
+ | User wants to promote or deploy changes | `dx-devops-promote` |
184
+
185
+ This skill typically runs **first** in a DevOps Center workflow — the project ID it returns is the entry point for work item and pipeline skills.
186
+
187
+ ---
188
+
189
+ ## Reference File Index
190
+
191
+ | File | When to read / run |
192
+ |------|-------------|
193
+ | `scripts/list-projects.sh` | Workflow step 3 — list all projects or resolve a project name to an ID (`--resolve`); handles the empty-list case |
194
+ | `scripts/create-project.sh` | Workflow step 4 — idempotently create a project and verify it via re-read |
195
+ | `scripts/update-project.sh` | Workflow step 5 — update name/description/active status by ID or name |
196
+ | `references/cli-commands.md` | When you need detailed CLI flag documentation, JSON output schemas, or error handling patterns |
197
+ | `examples/common-workflows.md` | When the user's request matches a common pattern (name resolution, idempotent creation, project setup as a workflow entry point) |