@salesforce/afv-skills 1.23.0 → 1.25.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 (61) hide show
  1. package/package.json +1 -1
  2. package/skills/commerce-b2b-open-code-components-replace/SKILL.md +244 -0
  3. package/skills/commerce-b2b-open-code-components-replace/assets/ootb-to-open-code-mapping.json +66 -0
  4. package/skills/{developing-datacloud-code-extension → data360-code-extension-generate}/SKILL.md +7 -7
  5. package/skills/{developing-datacloud-code-extension → data360-code-extension-generate}/references/README.md +7 -7
  6. package/skills/{developing-datacloud-code-extension → data360-code-extension-generate}/references/quick-reference.md +2 -2
  7. package/skills/{getting-datacloud-schema → data360-schema-get}/SKILL.md +26 -26
  8. package/skills/{getting-datacloud-schema → data360-schema-get}/references/README.md +9 -9
  9. package/skills/dx-org-manage/SKILL.md +192 -0
  10. package/skills/dx-org-manage/examples/README.md +45 -0
  11. package/skills/dx-org-manage/examples/scratch-orgs/error_no_devhub.json +9 -0
  12. package/skills/dx-org-manage/examples/scratch-orgs/error_timeout.json +13 -0
  13. package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +28 -0
  14. package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +26 -0
  15. package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +27 -0
  16. package/skills/dx-org-manage/examples/snapshots/error_output.json +9 -0
  17. package/skills/dx-org-manage/examples/snapshots/success_output.json +15 -0
  18. package/skills/dx-org-manage/references/cli_flags.md +67 -0
  19. package/skills/dx-org-manage/references/creating-scratch-org.md +164 -0
  20. package/skills/dx-org-manage/references/creating-snapshot.md +103 -0
  21. package/skills/dx-org-manage/references/definition_file_options.md +224 -0
  22. package/skills/dx-org-manage/references/edition_types.md +78 -0
  23. package/skills/dx-org-manage/references/opening-org.md +160 -0
  24. package/skills/dx-org-manage/references/snapshot_usage.md +74 -0
  25. package/skills/dx-org-permission-set-assign/SKILL.md +98 -0
  26. package/skills/dx-org-permission-set-assign/examples/error_output.json +19 -0
  27. package/skills/dx-org-permission-set-assign/examples/success_output.json +16 -0
  28. package/skills/dx-org-permission-set-assign/references/cli_flags.md +68 -0
  29. package/skills/experience-cms-brand-apply/SKILL.md +1 -1
  30. package/skills/experience-ui-bundle-app-coordinate/SKILL.md +31 -19
  31. package/skills/experience-ui-bundle-file-upload-generate/SKILL.md +1 -1
  32. package/skills/experience-ui-bundle-frontend-generate/implementation/header-footer.md +1 -1
  33. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +336 -581
  34. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +172 -0
  35. package/skills/experience-ui-bundle-salesforce-data-access/references/graphiti-cli.md +373 -0
  36. package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +376 -0
  37. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +119 -0
  38. package/skills/experience-ui-bundle-salesforce-data-access/references/rest-and-integration.md +152 -0
  39. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +217 -0
  40. package/skills/experience-ui-bundle-salesforce-data-access/scripts/graphql-search.sh +36 -9
  41. package/skills/platform-agentsetup-categories-fetch/SKILL.md +109 -0
  42. package/skills/platform-agentsetup-categories-fetch/references/api-response-schema.md +121 -0
  43. package/skills/platform-custom-object-generate/SKILL.md +62 -7
  44. package/skills/platform-custom-object-generate/references/description-enrichment.md +125 -0
  45. package/skills/platform-metadata-retrieve/SKILL.md +121 -0
  46. package/skills/platform-metadata-retrieve/examples/error_output.json +10 -0
  47. package/skills/platform-metadata-retrieve/examples/success_output.json +27 -0
  48. package/skills/platform-metadata-retrieve/references/cli_flags.md +138 -0
  49. package/skills/platform-metadata-retrieve/references/retrieval_modes.md +181 -0
  50. package/skills/platform-sharing-rules-generate/SKILL.md +165 -0
  51. package/skills/platform-sharing-rules-generate/references/rule-types.md +199 -0
  52. package/skills/platform-tracing-agentforce-configure/SKILL.md +118 -0
  53. package/skills/platform-tracing-agentforce-configure/assets/AgentforcePlatformTracing-template.xml +4 -0
  54. package/skills/platform-tracing-configure/SKILL.md +118 -0
  55. package/skills/platform-tracing-configure/assets/EventSettings-template.xml +4 -0
  56. package/skills/platform-trust-archive-manage/SKILL.md +25 -11
  57. package/skills/platform-trust-archive-manage/examples/monitor-failed-jobs.md +2 -2
  58. package/skills/platform-trust-archive-manage/references/archive-activity-entity.md +1 -1
  59. package/skills/platform-trust-archive-manage/references/connect-api-operations.md +51 -12
  60. /package/skills/{getting-datacloud-schema → data360-schema-get}/scripts/get_dlo_schema.py +0 -0
  61. /package/skills/{getting-datacloud-schema → data360-schema-get}/scripts/get_dmo_schema.py +0 -0
@@ -0,0 +1,103 @@
1
+ # Creating Snapshots
2
+
3
+ Creates a point-in-time snapshot of a scratch org using `sf org create snapshot`. Snapshots preserve scratch org state and configuration for reuse in scratch org definition files.
4
+
5
+ ---
6
+
7
+ ## Required Inputs
8
+
9
+ Infer from the user's request:
10
+
11
+ - **Source org**: Scratch org ID (starts with 00D) or username/alias to snapshot
12
+ - **Snapshot name**: Unique name for the snapshot (required)
13
+ - **Dev Hub**: Dev Hub org alias/username (uses default if not specified)
14
+ - **Description** (optional): Document snapshot contents, version control reference
15
+
16
+ ---
17
+
18
+ ## Workflow
19
+
20
+ 1. **Gather inputs** — get source org, snapshot name, and optional description
21
+ 2. **Build command** — construct `sf org create snapshot` with appropriate flags
22
+ 3. **Execute via Bash tool** — run command with `--json` flag
23
+ 4. **Return result** — report snapshot ID and status
24
+
25
+ ### Command Patterns
26
+
27
+ | User intent | Execute via Bash tool |
28
+ |-------------|---------|
29
+ | Create snapshot with name only | `sf org create snapshot --source-org <orgId or alias> --name <SnapshotName> --json` |
30
+ | Create snapshot with description | `sf org create snapshot --source-org <orgId or alias> --name <SnapshotName> --description "<desc>" --json` |
31
+ | Specify Dev Hub explicitly | `sf org create snapshot --source-org <orgId or alias> --name <SnapshotName> --target-dev-hub <devHubAlias> --json` |
32
+
33
+ ---
34
+
35
+ ## Rules / Constraints
36
+
37
+ | Constraint | Rationale |
38
+ |-----------|-----------|
39
+ | Always use `--json` flag | Provides structured output for reliable parsing and error handling |
40
+ | Snapshot names must be unique in the Dev Hub | Duplicate names cause creation to fail |
41
+ | Source org must be a scratch org | Snapshots only work with scratch orgs, not sandboxes or production orgs |
42
+ | Dev Hub must have snapshot feature enabled | "NOT_FOUND" error means Dev Hub doesn't support snapshots |
43
+ | Source org accepts ID or username/alias | Command auto-resolves aliases to org IDs; org IDs start with 00D |
44
+ | Include description for tracking | Best practice: reference version control tag or commit ID in description |
45
+
46
+ ---
47
+
48
+ ## Troubleshooting
49
+
50
+ | Issue | Resolution |
51
+ |-------|------------|
52
+ | "NOT_FOUND" error when creating snapshot | Dev Hub doesn't have snapshot feature enabled — contact admin to enable in Dev Hub settings |
53
+ | "No org found for <alias>" error | Source org alias doesn't exist or isn't authenticated — verify with `sf org list` |
54
+ | Snapshot name already exists | Use a different unique name — snapshot names must be unique per Dev Hub |
55
+ | "An error while created the org snapshot" | Generic error — check that source org is a scratch org and still active |
56
+ | Long-running snapshot creation | Use `sf org get snapshot --snapshot <name>` to check status — snapshot creation is asynchronous |
57
+
58
+ ---
59
+
60
+ ## Output Expectations
61
+
62
+ The command returns JSON output with the created snapshot details.
63
+
64
+ See `examples/snapshots/success_output.json` and `examples/snapshots/error_output.json` for complete response structures.
65
+
66
+ Example success response:
67
+ ```json
68
+ {
69
+ "result": {
70
+ "SnapshotId": "0Ym...",
71
+ "SnapshotName": "MySnapshot",
72
+ "Status": "Active",
73
+ "SourceOrg": "00D..."
74
+ }
75
+ }
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Using Snapshots
81
+
82
+ After creating a snapshot, use it to create scratch orgs by:
83
+
84
+ 1. **In scratch org definition file:**
85
+ ```json
86
+ {
87
+ "snapshot": "MySnapshot"
88
+ }
89
+ ```
90
+
91
+ 2. **Or via command flag:**
92
+ ```bash
93
+ sf org create scratch --snapshot MySnapshot --target-dev-hub <alias> --alias <name> --json
94
+ ```
95
+
96
+ See `snapshot_usage.md` for detailed examples.
97
+
98
+ ---
99
+
100
+ ## Additional Resources
101
+
102
+ - See `cli_flags.md` for detailed explanation of all available flags
103
+ - See `snapshot_usage.md` for how to use snapshots in scratch org creation
@@ -0,0 +1,224 @@
1
+ # Scratch Org Definition File Options
2
+
3
+ Complete reference for scratch org definition file configuration. Use this when users need to configure org features, settings, or advanced options beyond basic org creation.
4
+
5
+ ## File Structure
6
+
7
+ ```json
8
+ {
9
+ "orgName": "My Company",
10
+ "edition": "Developer",
11
+ "features": ["<feature>", "<feature>"],
12
+ "settings": {
13
+ "<SettingType>": {
14
+ "<settingName>": <value>
15
+ }
16
+ },
17
+ "adminEmail": "admin@example.com",
18
+ "description": "Scratch org for feature X development",
19
+ "hasSampleData": false,
20
+ "snapshot": "SnapshotName",
21
+ "sourceOrg": "00D1234567890ABC",
22
+ "username": "custom.username@example.com"
23
+ }
24
+ ```
25
+
26
+ ## Core Fields
27
+
28
+ | Field | Type | Required | Description |
29
+ |-------|------|----------|-------------|
30
+ | `orgName` | string | Yes | Name of the company (user-visible) |
31
+ | `edition` | string | Yes* | Developer, Enterprise, Group, Professional, or Partner variants |
32
+ | `adminEmail` | string | No | Email for the admin user |
33
+ | `description` | string | No | Description shown in Dev Hub |
34
+ | `hasSampleData` | boolean | No | Include standard sample data (default: false) |
35
+ | `username` | string | No | Custom username for admin (must be globally unique) |
36
+
37
+ \* Not required if using `snapshot` or `sourceOrg`.
38
+
39
+ **CLI Flag Overrides:** When using a definition file with `--definition-file`, you can override any of these fields with CLI flags:
40
+ - `--edition` overrides `edition`
41
+ - `--name` overrides `orgName`
42
+ - `--username` overrides `username`
43
+ - `--description` overrides `description`
44
+ - `--admin-email` overrides `adminEmail`
45
+ - `--release` overrides `release`
46
+ - `--snapshot` overrides `snapshot`
47
+ - `--source-org` overrides `sourceOrg`
48
+
49
+ CLI flags take precedence over definition file values.
50
+
51
+ ## Features Array
52
+
53
+ Enable org features by adding to `features` array. Common features:
54
+
55
+ ```json
56
+ "features": [
57
+ "Communities",
58
+ "ServiceCloud",
59
+ "Sites",
60
+ "MultiCurrency",
61
+ "PersonAccounts",
62
+ "Walkthroughs",
63
+ "AdvancedPersonAccountSecurity"
64
+ ]
65
+ ```
66
+
67
+ **Finding available features:**
68
+ - Run: `sf org list metadata-types --target-org <dev-hub>`
69
+ - Look for `FeatureParameterValueSet` type
70
+ - Or check: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_scratch_orgs_def_file.htm
71
+
72
+ ## Settings Object
73
+
74
+ Configure org settings by type. Format:
75
+
76
+ ```json
77
+ "settings": {
78
+ "lightningExperienceSettings": {
79
+ "enableS1DesktopEnabled": true
80
+ },
81
+ "mobileSettings": {
82
+ "enableS1EncryptedStoragePref2": false
83
+ },
84
+ "securitySettings": {
85
+ "passwordPolicies": {
86
+ "minimumPasswordLength": 10
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ **Common settings:**
93
+
94
+ ### Language Settings
95
+ ```json
96
+ "languageSettings": {
97
+ "enableTranslationWorkbench": true
98
+ }
99
+ ```
100
+
101
+ ### Chatter Settings
102
+ ```json
103
+ "chatterSettings": {
104
+ "enableChatter": true
105
+ }
106
+ ```
107
+
108
+ ### Path Settings
109
+ ```json
110
+ "pathAssistantSettings": {
111
+ "pathAssistantEnabled": true
112
+ }
113
+ ```
114
+
115
+ ## Alternative Creation Sources
116
+
117
+ ### Snapshot
118
+ ```json
119
+ {
120
+ "snapshot": "BaselineSnapshot"
121
+ }
122
+ ```
123
+
124
+ Creates org from a snapshot. The `edition` field is optional when using snapshots.
125
+
126
+ ### Source Org (Org Shape)
127
+ ```json
128
+ {
129
+ "sourceOrg": "00D1234567890ABC"
130
+ }
131
+ ```
132
+
133
+ Creates org from an org shape. The `edition` field is optional when using org shapes.
134
+
135
+ **Note:** `snapshot` and `sourceOrg` are mutually exclusive.
136
+
137
+ ## Release Overrides
138
+
139
+ Control which Salesforce release the scratch org uses:
140
+
141
+ ```json
142
+ {
143
+ "release": "preview"
144
+ }
145
+ ```
146
+
147
+ Options: `preview` (next release), `previous` (previous release). Only use during Salesforce release transition periods.
148
+
149
+ ## Duration Control
150
+
151
+ While not part of the definition file, you can override duration with the CLI flag:
152
+ ```bash
153
+ --duration-days 15
154
+ ```
155
+
156
+ Maximum: 30 days. Default: 7 days.
157
+
158
+ ## Packaging Options
159
+
160
+ ```json
161
+ {
162
+ "ancestorId": "04t...",
163
+ "ancestorVersion": "1.0",
164
+ "namespace": "myns"
165
+ }
166
+ ```
167
+
168
+ Used for second-generation package (2GP) development.
169
+
170
+ **CLI Packaging Flags:**
171
+ - `--no-ancestors` - Exclude 2GP ancestors from the scratch org
172
+ - `--no-namespace` - Create scratch org without namespace, even if Dev Hub has one
173
+
174
+ ## Example: Full Configuration
175
+
176
+ ```json
177
+ {
178
+ "orgName": "Acme Corp Dev Org",
179
+ "edition": "Developer",
180
+ "description": "Feature X development scratch org",
181
+ "adminEmail": "dev-team@acme.com",
182
+ "hasSampleData": false,
183
+ "features": [
184
+ "Communities",
185
+ "ServiceCloud",
186
+ "MultiCurrency"
187
+ ],
188
+ "settings": {
189
+ "lightningExperienceSettings": {
190
+ "enableS1DesktopEnabled": true
191
+ },
192
+ "securitySettings": {
193
+ "passwordPolicies": {
194
+ "minimumPasswordLength": 10,
195
+ "minimumPasswordLifetime": false,
196
+ "obscure": false
197
+ }
198
+ },
199
+ "languageSettings": {
200
+ "enableTranslationWorkbench": true
201
+ }
202
+ }
203
+ }
204
+ ```
205
+
206
+ ## Connected App Authentication
207
+
208
+ For enhanced security, use a Connected App for authentication:
209
+
210
+ ```bash
211
+ sf org create scratch --definition-file config.json --client-id <consumer-key>
212
+ ```
213
+
214
+ When `--client-id` is provided, CLI prompts for the client secret. The scratch org will use the Connected App for authentication instead of default JWT.
215
+
216
+ ## Common Pitfalls
217
+
218
+ | Issue | Cause | Fix |
219
+ |-------|-------|-----|
220
+ | Features not available | Feature name spelled wrong or not available in edition | Check feature name spelling and edition compatibility |
221
+ | Settings ignored | Invalid setting name or structure | Verify setting exists in Metadata API docs |
222
+ | JSON parse error | Invalid JSON syntax | Validate JSON with linter |
223
+ | Conflicting options | Both `snapshot` and `sourceOrg` specified | Use only one alternative creation source |
224
+ | CLI flag ignored | Trying to override a field that doesn't support override | Only certain fields can be overridden (see CLI Flag Overrides section) |
@@ -0,0 +1,78 @@
1
+ # Scratch Org Edition Types
2
+
3
+ Reference for choosing the right Salesforce edition for scratch org creation.
4
+
5
+ ## Available Editions
6
+
7
+ | Edition | When to use | License limits | Features |
8
+ |---------|-------------|----------------|----------|
9
+ | `developer` | Default choice for most development | 2 user licenses | Most features available, best for general development |
10
+ | `enterprise` | Enterprise-specific features needed | 5 user licenses | All enterprise features, territory management, advanced approvals |
11
+ | `group` | Testing Professional edition behavior | 5 user licenses | Professional edition features |
12
+ | `professional` | Professional edition-specific testing | 5 user licenses | Professional edition feature set |
13
+
14
+ ## Partner Editions
15
+
16
+ Only available if the Dev Hub is a Partner Business Org:
17
+
18
+ | Edition | When to use |
19
+ |---------|-------------|
20
+ | `partner developer` | Partner app development |
21
+ | `partner enterprise` | Partner enterprise app testing |
22
+ | `partner group` | Partner professional edition testing |
23
+ | `partner professional` | Partner professional edition apps |
24
+
25
+ ## Edition Comparison
26
+
27
+ ### Developer Edition (Recommended Default)
28
+ - **Best for**: General development, most common use case
29
+ - **Features**: Apex, Visualforce, Lightning, Process Builder, Flow, most platform features
30
+ - **Limitations**: 2 user licenses (sufficient for most dev work)
31
+ - **Use when**: User doesn't specify or needs general Salesforce development environment
32
+
33
+ ### Enterprise Edition
34
+ - **Best for**: Enterprise-specific features, larger team testing
35
+ - **Additional features**: Territory Management 2.0, Advanced Approval Processes
36
+ - **Use when**: Testing enterprise-only features or need more than 2 users
37
+
38
+ ### Group/Professional Edition
39
+ - **Best for**: Testing behavior specific to Professional edition
40
+ - **Use when**: Building apps for Professional edition customers or testing edition-specific constraints
41
+
42
+ ## Choosing an Edition
43
+
44
+ Follow this decision tree:
45
+
46
+ ```text
47
+ 1. Does user specify edition? → Use specified edition
48
+ 2. Does user need Partner edition? → Check if Dev Hub is Partner Business Org
49
+ 3. Does user need Enterprise features? → Use enterprise
50
+ 4. Default → Use developer
51
+ ```
52
+
53
+ ## CLI Usage
54
+
55
+ **With flag:**
56
+ ```bash
57
+ sf org create scratch --edition developer --alias my-org
58
+ ```
59
+
60
+ **With definition file:**
61
+ ```json
62
+ {
63
+ "edition": "Developer"
64
+ }
65
+ ```
66
+
67
+ **Important notes:**
68
+ - Edition value is case-insensitive in CLI flags but case-sensitive in definition files (capital first letter)
69
+ - Partner editions use space format: `partner developer`, `partner enterprise`, etc. (no hyphen)
70
+ - CLI flag `--edition` overrides definition file `edition` if both are specified
71
+
72
+ ## Common Errors
73
+
74
+ | Error | Cause | Fix |
75
+ |-------|-------|-----|
76
+ | `edition value must be one of` | Invalid edition name | Use: developer, enterprise, group, professional, or partner editions (e.g., "partner developer") |
77
+ | Partner edition not available | Dev Hub is not a Partner Business Org | Use non-partner edition or switch to Partner Dev Hub |
78
+ | Features not available in edition | Requested features not available in chosen edition | Use Enterprise edition or remove unavailable features |
@@ -0,0 +1,160 @@
1
+ # Opening Orgs
2
+
3
+ Opens a Salesforce org or specific metadata artifact in a browser using `sf org open`. Handles all variants: default org, alias or username, browser selection, incognito mode, path navigation, metadata file → Builder, and URL-only output.
4
+
5
+ ---
6
+
7
+ ## Required Inputs
8
+
9
+ Infer from the user's request:
10
+
11
+ - **Target org**: Use default org unless a specific alias/username is mentioned
12
+ - **What to open**: Path, file, or org home
13
+ - **Browser**: Only include if explicitly requested (chrome, firefox, edge)
14
+ - **Incognito**: Only if user says "private" or "incognito"
15
+ - **URL only**: If user says "URL", "link", or "don't open browser"
16
+
17
+ Do not ask for clarification - infer and execute immediately.
18
+
19
+ ---
20
+
21
+ ## Workflow
22
+
23
+ 1. **Match user request** to command in table below
24
+ 2. **Execute via Bash tool**: `sf org open` with appropriate flags
25
+ 3. **Return result**
26
+
27
+ If error occurs:
28
+ - "no target org" → advise: `sf config set target-org <alias>`
29
+ - auth error → advise: `sf org login web --alias <alias>`
30
+
31
+ ### Command Decision Table
32
+
33
+ | User intent | Execute via Bash tool |
34
+ |-------------|---------|
35
+ | Open default org | `sf org open` |
36
+ | Open specific org | `sf org open --target-org <alias>` |
37
+ | Open in specific browser | `sf org open --browser chrome` (or firefox, edge) |
38
+ | Private/incognito mode | `sf org open --private` |
39
+ | Navigate to path | `sf org open --path '<path>'` |
40
+ | Get URL only | `sf org open --url-only` |
41
+ | Path + URL only | `sf org open --path '<path>' --url-only` |
42
+ | Open local file | `sf org open --source-file <file-path>` |
43
+ | File + URL only | `sf org open --source-file <file-path> --url-only` |
44
+
45
+ **Note:** Flags `--private`, `--url-only`, `--browser` are mutually exclusive.
46
+
47
+ ---
48
+
49
+ ## Common Paths
50
+
51
+ ### Setup Pages
52
+ ```bash
53
+ # Setup home
54
+ sf org open --path '/lightning/setup/SetupOneHome/home'
55
+
56
+ # Object Manager
57
+ sf org open --path '/lightning/setup/ObjectManager/home'
58
+
59
+ # Users
60
+ sf org open --path '/lightning/setup/ManageUsers/home'
61
+
62
+ # Permission Sets
63
+ sf org open --path '/lightning/setup/PermSets/home'
64
+
65
+ # Flows
66
+ sf org open --path '/lightning/setup/Flows/home'
67
+
68
+ # Custom Metadata Types
69
+ sf org open --path '/lightning/setup/CustomMetadata/home'
70
+ ```
71
+
72
+ ### App Pages
73
+ ```bash
74
+ # App Launcher
75
+ sf org open --path '/lightning/setup/NavigationMenus/home'
76
+
77
+ # Reports
78
+ sf org open --path '/lightning/o/Report/home'
79
+
80
+ # Dashboards
81
+ sf org open --path '/lightning/o/Dashboard/home'
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Opening Metadata Files
87
+
88
+ ### Supported Metadata Types
89
+
90
+ `--source-file` works with these metadata types:
91
+ - **FlexiPage** (Lightning pages) → Lightning App Builder
92
+ - **Flow** → Flow Builder
93
+ - **ApexPage** (Visualforce) → Visualforce Page Editor
94
+ - **ApexClass** → Apex Class detail page
95
+ - **CustomObject** → Object Manager
96
+
97
+ ### Important Constraints
98
+
99
+ | Constraint | Behavior |
100
+ |-----------|----------|
101
+ | Metadata must be deployed in the org | CLI queries org for record ID; undeployed metadata causes error or fallback |
102
+ | FlexiPage fallback | Silently falls back to `/lightning/setup/FlexiPageList/home` if not found |
103
+ | Flow error | Throws `FlowIdNotFound` if Flow not deployed |
104
+ | ApexClass error | Throws `ApexClassIdNotFound` if class not deployed |
105
+ | CustomObject error | Throws `CustomObjectIdNotFound` if object not deployed |
106
+
107
+ ### Example Commands
108
+
109
+ ```bash
110
+ # Open Lightning page in App Builder
111
+ sf org open --source-file force-app/main/default/flexipages/Account_Record_Page.flexipage-meta.xml
112
+
113
+ # Open Flow in Flow Builder
114
+ sf org open --source-file force-app/main/default/flows/MyFlow.flow-meta.xml
115
+
116
+ # Open Apex class
117
+ sf org open --source-file force-app/main/default/classes/MyController.cls
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Rules / Constraints
123
+
124
+ | Constraint | Rationale |
125
+ |-----------|-----------|
126
+ | `--path` and `--source-file` are mutually exclusive | Both control navigation destination; choose one |
127
+ | `--source-file` supported types: FlexiPage, Flow, ApexPage, ApexClass, CustomObject | CLI queries the org for the record ID; unsupported types or undeployed metadata fall back silently (FlexiPage) or throw a named error (Flow/ApexClass/CustomObject) |
128
+ | Do not hardcode `force-app/main/default/` for `--source-file` | Project package paths vary; use the path the user provides or read `sfdx-project.json` |
129
+ | Must use Bash tool, not MCP tools | MCP tools like `list_all_orgs` cannot open orgs in browser |
130
+
131
+ ---
132
+
133
+ ## Troubleshooting
134
+
135
+ | Issue | Resolution |
136
+ |-------|------------|
137
+ | No target org found | Set default: `sf config set target-org <alias>` or specify `--target-org <alias>` |
138
+ | Auth error | Re-authenticate: `sf org login web --alias <alias>` |
139
+ | `--source-file` opens wrong page or throws `FlowIdNotFound` / `ApexClassIdNotFound` / `CustomObjectIdNotFound` | Metadata is not deployed in the org. Run `sf project deploy start --source-file <path> --target-org <alias>` first. FlexiPage silently falls back to org home; Flow/ApexClass/CustomObject throw an error. |
140
+ | Metadata file opens wrong Builder | Verify the file extension matches the metadata type (e.g. `.flow-meta.xml` for Flow Builder) |
141
+ | URL-only flag but user expects browser to open | `--url-only` prints the URL without launching — remove the flag to open the browser |
142
+ | Path not found / 404 | Verify the path is correct; some paths require specific permissions or licenses |
143
+
144
+ ---
145
+
146
+ ## Output Expectations
147
+
148
+ ### Default behavior
149
+ - Opens the specified org/path in the system's default browser
150
+ - No console output on success
151
+
152
+ ### With `--url-only`
153
+ Returns the login URL without opening browser:
154
+ ```text
155
+ https://...-dev-ed.develop.my.salesforce.com/secur/frontdoor.jsp?sid=...
156
+ ```
157
+
158
+ ### With `--source-file`
159
+ - Opens the metadata in its appropriate Builder/Editor
160
+ - Example: FlexiPage → Lightning App Builder, Flow → Flow Builder
@@ -0,0 +1,74 @@
1
+ # Using Snapshots in Scratch Org Definition Files
2
+
3
+ After creating a snapshot, reference it in scratch org definition files to create new scratch orgs from the saved state.
4
+
5
+ ## Scratch Org Definition File Format
6
+
7
+ Use the `snapshot` field instead of `edition` in your `project-scratch-def.json`:
8
+
9
+ ```json
10
+ {
11
+ "orgName": "My Company",
12
+ "snapshot": "MySnapshot",
13
+ "features": ["EnableSetPasswordInApi"],
14
+ "settings": {
15
+ "lightningExperienceSettings": {
16
+ "enableS1DesktopEnabled": true
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ ## Key Differences from Edition-Based Definitions
23
+
24
+ | Field | Edition-based | Snapshot-based |
25
+ |-------|--------------|----------------|
26
+ | Primary field | `"edition": "Developer"` | `"snapshot": "MySnapshot"` |
27
+ | Contents | Empty org with edition defaults | Pre-configured org state from snapshot |
28
+
29
+ ## Creating a Scratch Org from Snapshot
30
+
31
+ ```bash
32
+ sf org create scratch --definition-file config/project-scratch-def.json --alias from-snapshot
33
+ ```
34
+
35
+ The scratch org will be created with all the metadata, data, and configuration from the snapshot.
36
+
37
+ ## Common Use Cases
38
+
39
+ ### 1. Package Development
40
+
41
+ ```json
42
+ {
43
+ "orgName": "Package Dev Org",
44
+ "snapshot": "Dependencies_v1.2.0",
45
+ "description": "Org with all dependencies installed"
46
+ }
47
+ ```
48
+
49
+ ### 2. Testing Baseline
50
+
51
+ ```json
52
+ {
53
+ "orgName": "Test Baseline",
54
+ "snapshot": "TestData_Populated",
55
+ "description": "Org with sample data for testing"
56
+ }
57
+ ```
58
+
59
+ ### 3. CI/CD Pipeline
60
+
61
+ ```json
62
+ {
63
+ "orgName": "CI Scratch Org",
64
+ "snapshot": "Nightly_Build_Baseline",
65
+ "description": "Latest nightly build dependencies"
66
+ }
67
+ ```
68
+
69
+ ## Workflow Summary
70
+
71
+ 1. **Create snapshot**: `sf org create snapshot --source-org <scratch> --name MySnapshot`
72
+ 2. **Check status**: `sf org get snapshot --snapshot MySnapshot`
73
+ 3. **Reference in definition file**: `"snapshot": "MySnapshot"`
74
+ 4. **Create new scratch org**: `sf org create scratch --definition-file config/project-scratch-def.json`