@schandlergarcia/sf-web-components 1.0.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 (195) hide show
  1. package/.a4drules/skills/building-data-visualization/SKILL.md +72 -0
  2. package/.a4drules/skills/building-data-visualization/implementation/bar-line-chart.md +316 -0
  3. package/.a4drules/skills/building-data-visualization/implementation/dashboard-layout.md +189 -0
  4. package/.a4drules/skills/building-data-visualization/implementation/donut-chart.md +181 -0
  5. package/.a4drules/skills/building-data-visualization/implementation/stat-card.md +150 -0
  6. package/.a4drules/skills/building-react-components/SKILL.md +96 -0
  7. package/.a4drules/skills/building-react-components/implementation/component.md +78 -0
  8. package/.a4drules/skills/building-react-components/implementation/header-footer.md +132 -0
  9. package/.a4drules/skills/building-react-components/implementation/page.md +93 -0
  10. package/.a4drules/skills/configuring-csp-trusted-sites/SKILL.md +90 -0
  11. package/.a4drules/skills/configuring-csp-trusted-sites/implementation/metadata-format.md +281 -0
  12. package/.a4drules/skills/configuring-webapp-metadata/SKILL.md +158 -0
  13. package/.a4drules/skills/creating-webapp/SKILL.md +140 -0
  14. package/.a4drules/skills/deploying-to-salesforce/SKILL.md +226 -0
  15. package/.a4drules/skills/implementing-file-upload/SKILL.md +396 -0
  16. package/.a4drules/skills/installing-webapp-features/SKILL.md +210 -0
  17. package/.a4drules/skills/managing-agentforce-conversation-client/SKILL.md +186 -0
  18. package/.a4drules/skills/managing-agentforce-conversation-client/references/constraints.md +134 -0
  19. package/.a4drules/skills/managing-agentforce-conversation-client/references/examples.md +132 -0
  20. package/.a4drules/skills/managing-agentforce-conversation-client/references/style-tokens.md +101 -0
  21. package/.a4drules/skills/managing-agentforce-conversation-client/references/troubleshooting.md +57 -0
  22. package/.a4drules/skills/using-salesforce-data/SKILL.md +363 -0
  23. package/.a4drules/skills/using-salesforce-data/graphql-search.sh +139 -0
  24. package/.a4drules/webapp-data.md +353 -0
  25. package/.a4drules/webapp-ui.md +16 -0
  26. package/README.md +124 -0
  27. package/dist/components/library/cards/ActionList.js +27 -0
  28. package/dist/components/library/cards/ActionList.js.map +1 -0
  29. package/dist/components/library/cards/ActivityCard.js +40 -0
  30. package/dist/components/library/cards/ActivityCard.js.map +1 -0
  31. package/dist/components/library/cards/BaseCard.js +89 -0
  32. package/dist/components/library/cards/BaseCard.js.map +1 -0
  33. package/dist/components/library/cards/CalloutCard.js +28 -0
  34. package/dist/components/library/cards/CalloutCard.js.map +1 -0
  35. package/dist/components/library/cards/ChartCard.js +79 -0
  36. package/dist/components/library/cards/ChartCard.js.map +1 -0
  37. package/dist/components/library/cards/FeedPanel.js +38 -0
  38. package/dist/components/library/cards/FeedPanel.js.map +1 -0
  39. package/dist/components/library/cards/ListCard.js +112 -0
  40. package/dist/components/library/cards/ListCard.js.map +1 -0
  41. package/dist/components/library/cards/MetricCard.js +86 -0
  42. package/dist/components/library/cards/MetricCard.js.map +1 -0
  43. package/dist/components/library/cards/MetricsStrip.js +60 -0
  44. package/dist/components/library/cards/MetricsStrip.js.map +1 -0
  45. package/dist/components/library/cards/SectionCard.js +59 -0
  46. package/dist/components/library/cards/SectionCard.js.map +1 -0
  47. package/dist/components/library/cards/StatusCard.js +137 -0
  48. package/dist/components/library/cards/StatusCard.js.map +1 -0
  49. package/dist/components/library/cards/TableCard.js +244 -0
  50. package/dist/components/library/cards/TableCard.js.map +1 -0
  51. package/dist/components/library/cards/WidgetCard.js +60 -0
  52. package/dist/components/library/cards/WidgetCard.js.map +1 -0
  53. package/dist/components/library/charts/D3Chart.js +74 -0
  54. package/dist/components/library/charts/D3Chart.js.map +1 -0
  55. package/dist/components/library/charts/D3ChartTemplates.js +44 -0
  56. package/dist/components/library/charts/D3ChartTemplates.js.map +1 -0
  57. package/dist/components/library/charts/GeoMap.js +229 -0
  58. package/dist/components/library/charts/GeoMap.js.map +1 -0
  59. package/dist/components/library/chat/ChatBar.js +194 -0
  60. package/dist/components/library/chat/ChatBar.js.map +1 -0
  61. package/dist/components/library/chat/ChatInput.js +67 -0
  62. package/dist/components/library/chat/ChatInput.js.map +1 -0
  63. package/dist/components/library/chat/ChatMessage.js +112 -0
  64. package/dist/components/library/chat/ChatMessage.js.map +1 -0
  65. package/dist/components/library/chat/ChatMessageList.js +50 -0
  66. package/dist/components/library/chat/ChatMessageList.js.map +1 -0
  67. package/dist/components/library/chat/ChatPanel.js +77 -0
  68. package/dist/components/library/chat/ChatPanel.js.map +1 -0
  69. package/dist/components/library/chat/ChatSuggestions.js +22 -0
  70. package/dist/components/library/chat/ChatSuggestions.js.map +1 -0
  71. package/dist/components/library/chat/ChatToolCall.js +87 -0
  72. package/dist/components/library/chat/ChatToolCall.js.map +1 -0
  73. package/dist/components/library/chat/ChatTypingIndicator.js +20 -0
  74. package/dist/components/library/chat/ChatTypingIndicator.js.map +1 -0
  75. package/dist/components/library/chat/ChatWelcome.js +24 -0
  76. package/dist/components/library/chat/ChatWelcome.js.map +1 -0
  77. package/dist/components/library/chat/useChatState.js +77 -0
  78. package/dist/components/library/chat/useChatState.js.map +1 -0
  79. package/dist/components/library/data/DataModeProvider.js +47 -0
  80. package/dist/components/library/data/DataModeProvider.js.map +1 -0
  81. package/dist/components/library/data/DataModeToggle.js +28 -0
  82. package/dist/components/library/data/DataModeToggle.js.map +1 -0
  83. package/dist/components/library/data/filterUtils.js +71 -0
  84. package/dist/components/library/data/filterUtils.js.map +1 -0
  85. package/dist/components/library/data/useDataSource.js +13 -0
  86. package/dist/components/library/data/useDataSource.js.map +1 -0
  87. package/dist/components/library/data/usePageFilters.js +46 -0
  88. package/dist/components/library/data/usePageFilters.js.map +1 -0
  89. package/dist/components/library/filters/FilterBar.js +89 -0
  90. package/dist/components/library/filters/FilterBar.js.map +1 -0
  91. package/dist/components/library/filters/SearchFilter.js +44 -0
  92. package/dist/components/library/filters/SearchFilter.js.map +1 -0
  93. package/dist/components/library/filters/SelectFilter.js +44 -0
  94. package/dist/components/library/filters/SelectFilter.js.map +1 -0
  95. package/dist/components/library/filters/ToggleFilter.js +48 -0
  96. package/dist/components/library/filters/ToggleFilter.js.map +1 -0
  97. package/dist/components/library/forms/FormField.js +256 -0
  98. package/dist/components/library/forms/FormField.js.map +1 -0
  99. package/dist/components/library/forms/FormModal.js +161 -0
  100. package/dist/components/library/forms/FormModal.js.map +1 -0
  101. package/dist/components/library/forms/FormRenderer.js +32 -0
  102. package/dist/components/library/forms/FormRenderer.js.map +1 -0
  103. package/dist/components/library/forms/FormSection.js +49 -0
  104. package/dist/components/library/forms/FormSection.js.map +1 -0
  105. package/dist/components/library/forms/useFormState.js +85 -0
  106. package/dist/components/library/forms/useFormState.js.map +1 -0
  107. package/dist/components/library/heroui/Accordion.js +12 -0
  108. package/dist/components/library/heroui/Accordion.js.map +1 -0
  109. package/dist/components/library/heroui/Alert.js +12 -0
  110. package/dist/components/library/heroui/Alert.js.map +1 -0
  111. package/dist/components/library/heroui/Badge.js +12 -0
  112. package/dist/components/library/heroui/Badge.js.map +1 -0
  113. package/dist/components/library/heroui/Breadcrumbs.js +12 -0
  114. package/dist/components/library/heroui/Breadcrumbs.js.map +1 -0
  115. package/dist/components/library/heroui/Button.js +18 -0
  116. package/dist/components/library/heroui/Button.js.map +1 -0
  117. package/dist/components/library/heroui/Card.js +12 -0
  118. package/dist/components/library/heroui/Card.js.map +1 -0
  119. package/dist/components/library/heroui/Drawer.js +12 -0
  120. package/dist/components/library/heroui/Drawer.js.map +1 -0
  121. package/dist/components/library/heroui/Dropdown.js +12 -0
  122. package/dist/components/library/heroui/Dropdown.js.map +1 -0
  123. package/dist/components/library/heroui/Input.js +10 -0
  124. package/dist/components/library/heroui/Input.js.map +1 -0
  125. package/dist/components/library/heroui/Kbd.js +12 -0
  126. package/dist/components/library/heroui/Kbd.js.map +1 -0
  127. package/dist/components/library/heroui/Meter.js +12 -0
  128. package/dist/components/library/heroui/Meter.js.map +1 -0
  129. package/dist/components/library/heroui/Modal.js +12 -0
  130. package/dist/components/library/heroui/Modal.js.map +1 -0
  131. package/dist/components/library/heroui/Pagination.js +12 -0
  132. package/dist/components/library/heroui/Pagination.js.map +1 -0
  133. package/dist/components/library/heroui/ProgressBar.js +12 -0
  134. package/dist/components/library/heroui/ProgressBar.js.map +1 -0
  135. package/dist/components/library/heroui/ProgressCircle.js +12 -0
  136. package/dist/components/library/heroui/ProgressCircle.js.map +1 -0
  137. package/dist/components/library/heroui/ScrollShadow.js +12 -0
  138. package/dist/components/library/heroui/ScrollShadow.js.map +1 -0
  139. package/dist/components/library/heroui/Select.js +12 -0
  140. package/dist/components/library/heroui/Select.js.map +1 -0
  141. package/dist/components/library/heroui/Separator.js +12 -0
  142. package/dist/components/library/heroui/Separator.js.map +1 -0
  143. package/dist/components/library/heroui/Skeleton.js +12 -0
  144. package/dist/components/library/heroui/Skeleton.js.map +1 -0
  145. package/dist/components/library/heroui/Tabs.js +12 -0
  146. package/dist/components/library/heroui/Tabs.js.map +1 -0
  147. package/dist/components/library/heroui/Toast.js +13 -0
  148. package/dist/components/library/heroui/Toast.js.map +1 -0
  149. package/dist/components/library/heroui/Toggle.js +12 -0
  150. package/dist/components/library/heroui/Toggle.js.map +1 -0
  151. package/dist/components/library/heroui/Tooltip.js +12 -0
  152. package/dist/components/library/heroui/Tooltip.js.map +1 -0
  153. package/dist/components/library/layout/PageContainer.js +9 -0
  154. package/dist/components/library/layout/PageContainer.js.map +1 -0
  155. package/dist/components/library/skeletons/CardSkeleton.js +29 -0
  156. package/dist/components/library/skeletons/CardSkeleton.js.map +1 -0
  157. package/dist/components/library/theme/AppThemeProvider.js +55 -0
  158. package/dist/components/library/theme/AppThemeProvider.js.map +1 -0
  159. package/dist/components/library/theme/tokens.js +55 -0
  160. package/dist/components/library/theme/tokens.js.map +1 -0
  161. package/dist/components/library/ui/Avatar.js +33 -0
  162. package/dist/components/library/ui/Avatar.js.map +1 -0
  163. package/dist/components/library/ui/Button.js +50 -0
  164. package/dist/components/library/ui/Button.js.map +1 -0
  165. package/dist/components/library/ui/Card.js +21 -0
  166. package/dist/components/library/ui/Card.js.map +1 -0
  167. package/dist/components/library/ui/Chip.js +31 -0
  168. package/dist/components/library/ui/Chip.js.map +1 -0
  169. package/dist/components/library/ui/Container.js +42 -0
  170. package/dist/components/library/ui/Container.js.map +1 -0
  171. package/dist/components/library/ui/EmptyState.js +27 -0
  172. package/dist/components/library/ui/EmptyState.js.map +1 -0
  173. package/dist/components/library/ui/Input.js +22 -0
  174. package/dist/components/library/ui/Input.js.map +1 -0
  175. package/dist/components/library/ui/Spinner.js +64 -0
  176. package/dist/components/library/ui/Spinner.js.map +1 -0
  177. package/dist/components/library/ui/Text.js +43 -0
  178. package/dist/components/library/ui/Text.js.map +1 -0
  179. package/dist/components/library/ui/Toggle.js +47 -0
  180. package/dist/components/library/ui/Toggle.js.map +1 -0
  181. package/dist/components/workspace/ComponentRegistry.js +231 -0
  182. package/dist/components/workspace/ComponentRegistry.js.map +1 -0
  183. package/dist/index.js +185 -0
  184. package/dist/index.js.map +1 -0
  185. package/dist/lib/utils.js +9 -0
  186. package/dist/lib/utils.js.map +1 -0
  187. package/dist/node_modules/clsx/dist/clsx.js +17 -0
  188. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  189. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +2925 -0
  190. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  191. package/package.json +81 -0
  192. package/scripts/get-graphql-schema.mjs +68 -0
  193. package/scripts/reset-command-center.sh +358 -0
  194. package/scripts/rewrite-e2e-assets.mjs +23 -0
  195. package/scripts/validate-dashboard.sh +290 -0
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: creating-webapp
3
+ description: Use this skill when creating or setting up a new SFDX React web application. Covers first steps, npm install, skills-first protocol, deployment order, and core web app rules.
4
+ paths:
5
+ - "**/webapplications/**/*"
6
+ ---
7
+
8
+ # First Steps (MUST FOLLOW)
9
+
10
+ **Always run `npm install` before doing anything else** when working in a web app directory (e.g. `force-app/main/default/webapplications/<appName>/` or a dist app path). Dependencies must be installed before running `npm run dev`, `npm run build`, `npm run lint`, or any other script. If `node_modules` is missing or stale, commands will fail.
11
+
12
+ # Skills-First (MUST FOLLOW)
13
+
14
+ **Before writing any code or running any command**, search for relevant skills (`SKILL.md` files) that cover your task. Read the full skill and follow its instructions. Skills live in `.a4drules/skills/` and `feature/*/skills/`.
15
+
16
+ - Do not write custom scripts or complex bash commands for a workflow already covered by a loaded skill.
17
+ - Only proceed with manual execution after confirming no relevant skill exists.
18
+
19
+ # Deployment Order (MUST FOLLOW)
20
+
21
+ **Metadata deployments must complete before fetching GraphQL schema or running codegen.** The schema reflects the current org state; custom objects and fields appear only after metadata is deployed. Running schema fetch or codegen too early produces incomplete or incorrect types.
22
+
23
+ **Invoke the `deploying-to-salesforce` skill** (`.a4drules/skills/deploying-to-salesforce/`) whenever the task involves:
24
+ - Deploying metadata (objects, permission sets, layouts)
25
+ - Fetching GraphQL schema (`npm run graphql:schema`)
26
+ - Running GraphQL codegen (`npm run graphql:codegen`)
27
+ - Generating deploy/setup commands or syncing with the org
28
+
29
+ The skill enforces the correct sequence: **deploy metadata → assign permset → schema fetch → codegen**.
30
+
31
+ **Critical rules:**
32
+ - Do **not** run `npm run graphql:schema` before metadata (objects, permission sets) is deployed — the schema will not include custom objects/fields.
33
+ - Do **not** skip schema refetch after any metadata deployment — re-run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir.
34
+
35
+ # Web App Generation
36
+
37
+ ## Before `sf webapp generate`
38
+
39
+ **Webapp name (`-n`):** Must be **alphanumerical only**—no spaces, hyphens, underscores, or special characters. Use only letters (A–Z, a–z) and digits (0–9). Example: `CoffeeBoutique` not `Coffee Boutique`.
40
+
41
+ ```bash
42
+ sf webapp generate -n MyWebApp -t reactbasic
43
+ ```
44
+
45
+ Do not use `create-react-app`, Vite, or other generic scaffolds; use `sf webapp generate` so the app is SFDX-aware.
46
+
47
+ ## After Generation (MANDATORY)
48
+
49
+ After generating or when touching an existing app:
50
+
51
+ 1. **Replace all default boilerplate** — "React App", "Vite + React", default `<title>`, placeholder text in shell. Use the actual app name.
52
+ 2. **Populate the home page** — Never leave it as default template. Add real content: landing section, banners, hero, navigation to features.
53
+ 3. **Update navigation and placeholders** — See [Navigation & Layout section](#navigation--layout-mandatory) below.
54
+
55
+ # Navigation & Layout (MANDATORY)
56
+
57
+ Agents consistently miss these. **You must not leave them default.**
58
+
59
+ ## appLayout.tsx is the Source of Truth
60
+
61
+ - **Build navigation into the app layout** (`appLayout.tsx`). The layout must include nav (header, sidebar, or both) so every page shares the same shell.
62
+ - Path: `force-app/main/default/webapplications/<appName>/src/appLayout.tsx`
63
+
64
+ ## When Making UI Changes
65
+
66
+ **When making any change** that affects navigation, header, footer, sidebar, theme, or overall layout:
67
+
68
+ 1. **You MUST edit `src/appLayout.tsx`** (the layout used by `routes.tsx`).
69
+ 2. Do not only edit pages/components and leave `appLayout.tsx` unchanged.
70
+ 3. Before finishing: confirm you opened and modified `appLayout.tsx`. If you did not, the task is incomplete.
71
+
72
+ ## Navigation Menu (Critical)
73
+
74
+ - **Always edit the navigation menu** in `appLayout.tsx`. Replace default nav items and labels with **app-specific** links and names.
75
+ - Do **not** leave template items (e.g. "Home", "About", generic placeholder links).
76
+ - Use real routes and labels matching the app (e.g. "Dashboard", "Products", "Orders").
77
+
78
+ **Check before finishing:** Did I change the nav items and labels to match this app?
79
+
80
+ ## Placeholder Name & Design (Critical)
81
+
82
+ - **Replace the placeholder app name** everywhere: header, nav brand/logo, footer, `<title>` in `index.html`, any "Welcome to…" text.
83
+ - **Replace placeholder design** in the shell: default header/footer styling, generic branding.
84
+
85
+ **Check before finishing:** Is the app name and shell design still the template default? If yes, update it.
86
+
87
+ ## Where to Edit
88
+
89
+
90
+ | What | Where |
91
+ | ------------------- | -------------------------------------------------------------------- |
92
+ | Layout/nav/branding | `force-app/main/default/webapplications/<appName>/src/appLayout.tsx` |
93
+ | Document title | `force-app/main/default/webapplications/<appName>/index.html` |
94
+ | Root page content | Component at root route (often `Home` in `routes.tsx`) |
95
+
96
+
97
+ # React & TypeScript Constraints
98
+
99
+ ## Routing (React Router)
100
+
101
+ Use a **single** router package. When using `createBrowserRouter` / `RouterProvider`, all imports MUST come from **`react-router`** — not `react-router-dom`.
102
+
103
+ ## Component Library + Styling
104
+
105
+ - **shadcn/ui** for components: `import { Button } from '@/components/ui/button';`
106
+ - **Tailwind CSS** utility classes
107
+
108
+ ## URL & Path Handling
109
+
110
+ Apps run behind dynamic base paths. Router navigation (`<Link to>`, `navigate()`) prefer absolute paths (`/x`). Non-router attributes (`<img src>`) use dot-relative (`./x`) to resolve against `<base>`. Prefer Vite `import` for static assets.
111
+
112
+ ## Module Restrictions
113
+
114
+ React apps must NOT import Salesforce platform modules like `lightning/*` or `@wire` (LWC-only). For data access, invoke the **using-salesforce-data** skill.
115
+
116
+ # Frontend Aesthetics
117
+
118
+ **Avoid AI slop.** Make creative, distinctive frontends:
119
+
120
+ - **Typography:** Avoid Inter, Roboto, Arial, Space Grotesk as defaults. Choose distinctive fonts.
121
+ - **Color:** Use cohesive color with sharp accents via CSS variables. Avoid purple-on-white clichés.
122
+ - **Motion:** Use high-impact motion (e.g. staggered reveals).
123
+ - **Depth:** Add atmosphere/depth in backgrounds.
124
+
125
+ # Shell Command Safety (MUST FOLLOW)
126
+
127
+ **Never use complex `node -e` one-liners** for file edits or multi-line transforms. They break in Zsh due to `!` history expansion and backtick interpolation. Use a temporary `.js` file, `sed`/`awk`, `jq`, or IDE file-editing tools instead.
128
+
129
+ # Development Cycle
130
+
131
+ - Execute tasks continuously until all planned items complete in the current iteration.
132
+ - Maintain a running checklist and proceed sequentially.
133
+
134
+ ## Stop Conditions
135
+
136
+ Only stop when:
137
+
138
+ - All checklist items are completed and quality gates pass, or
139
+ - A blocking error cannot be resolved after reasonable remediation, or
140
+ - The user explicitly asks to pause.
@@ -0,0 +1,226 @@
1
+ ---
2
+ name: deploying-to-salesforce
3
+ description: Enforces the correct order for deploying metadata, assigning permission sets, and fetching GraphQL schema. Use for ANY deployment to a Salesforce org — webapps, LWC, Aura, Apex, metadata, schema fetch, or org sync. Codifies setup-cli.mjs.
4
+ ---
5
+
6
+ # Deploying to Salesforce
7
+
8
+ Guidance for AI agents deploying metadata to a Salesforce org or syncing with the org. **The order of operations is critical.** This skill codifies the exact sequence from `scripts/setup-cli.mjs` and documents **every Salesforce interaction**.
9
+
10
+ ## When to Use
11
+
12
+ Invoke this skill whenever the task involves:
13
+
14
+ - Deploying metadata (objects, permission sets, layouts, Apex, web applications)
15
+ - Generating deploy commands or setup instructions
16
+ - Fetching the GraphQL schema (`npm run graphql:schema`)
17
+ - Running GraphQL codegen (`npm run graphql:codegen`)
18
+ - Full org setup (login, deploy, permset, data, schema, build)
19
+ - Any manual step that touches the Salesforce org
20
+
21
+ ## Canonical Sequence (from setup-cli.mjs)
22
+
23
+ Execute steps in this **exact order**. Steps marked **(SF)** perform a Salesforce API or CLI interaction.
24
+
25
+ ### Step 1: Login — org authentication
26
+
27
+ | Action | Salesforce interaction? | Command |
28
+ |--------|-------------------------|---------|
29
+ | Check if org is connected | **(SF)** | `sf org display --target-org <alias> --json` |
30
+ | If not connected: authenticate | **(SF)** | `sf org login web --alias <alias>` |
31
+
32
+ - **Run when:** Org is not connected. **Omit when:** Org is already authenticated (check via `sf org display`).
33
+ - All subsequent steps require an authenticated org.
34
+
35
+ ### Step 2: Webapp build — pre-deploy (required for entity deployment)
36
+
37
+ | Action | Salesforce interaction? | Command |
38
+ |--------|-------------------------|---------|
39
+ | Install dependencies | No | `npm install` (in each webapp dir) |
40
+ | Build web app | No | `npm run build` (in each webapp dir) |
41
+
42
+ - Produces `dist/` so `sf project deploy start` can deploy web application entities. Run **before** deploy when deploying web apps.
43
+ - **Run when:** Deploying web apps AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** Not deploying, or `dist/` is current and no source changes.
44
+
45
+ ### Step 3: Deploy metadata
46
+
47
+ | Action | Salesforce interaction? | Command |
48
+ |--------|-------------------------|---------|
49
+ | Deploy metadata | **(SF)** | See below |
50
+
51
+ **Check for a manifest (package.xml) first.** Only use it if present:
52
+
53
+ - **If `manifest/package.xml` (or `package.xml`) exists:** Deploy using the manifest:
54
+ ```bash
55
+ sf project deploy start --manifest manifest/package.xml --target-org <alias>
56
+ ```
57
+ - **If no manifest exists:** Deploy all metadata from the project (packageDirectories in sfdx-project.json):
58
+ ```bash
59
+ sf project deploy start --target-org <alias>
60
+ ```
61
+
62
+ Do not assume a manifest exists. Check the project root and common locations (e.g., `manifest/`, `config/`) before choosing the deploy command.
63
+
64
+ - Deploys objects, layouts, permission sets, Apex classes, web applications, and all other metadata.
65
+ - **Must complete successfully before schema fetch** — the schema reflects org state; custom objects/fields appear only after deployment.
66
+ - **Run when:** Metadata has changed since last deploy, or never deployed. **Omit when:** No metadata changes and deploy has already run successfully.
67
+
68
+ ### Step 4: Post-deployment configuration — assign permissions and configure
69
+
70
+ | Action | Salesforce interaction? | Command |
71
+ |--------|-------------------------|---------|
72
+ | Assign permission set or group | **(SF)** | `sf org assign permset --name <name> --target-org <alias>` (works for both permsets and permset groups) |
73
+ | Assign profile to user | **(SF)** | `sf data update record` or at user creation |
74
+ | Other post-deploy config | **(SF)** | Varies (e.g., named credentials, connected apps, custom settings) |
75
+
76
+ **Example commands:**
77
+
78
+ ```bash
79
+ # Permission set (assigns to default user of target org)
80
+ sf org assign permset --name Property_Management_Access --target-org myorg
81
+
82
+ # Permission set group (same command; pass the group name)
83
+ sf org assign permset --name My_Permset_Group --target-org myorg
84
+
85
+ # Assign to a specific user
86
+ sf org assign permset --name Property_Management_Access --target-org myorg --on-behalf-of user@example.com
87
+
88
+ # Profile — update existing user's profile (requires ProfileId and User Id)
89
+ sf data update record --sobject User --record-id <userId> --values "ProfileId=<profileId>" --target-org myorg
90
+
91
+ # Profile — get ProfileId first
92
+ sf data query --query "SELECT Id, Name FROM Profile WHERE Name='Standard User'" --target-org myorg
93
+ ```
94
+
95
+ - **Deploying does not mean assigning.** Even after permission sets, permission set groups, and profiles are deployed to the org, they must be explicitly assigned or configured for users. Deployment makes them available; assignment/configuration grants access.
96
+ - **Permission sets** — Assign to users so they have access to custom objects and fields. Required for GraphQL introspection to return the correct schema.
97
+ - **Permission set groups** — Assign to users when using grouped permission sets.
98
+ - **Profiles** — Ensure users have the correct profile; profile assignment may be done at user creation or via Setup.
99
+ - **Other post-deploy configuration** — Named credentials, connected apps, custom settings, flow activation, and any metadata that requires manual configuration after deploy.
100
+ - All of the above must exist in the org (deployed in Step 3).
101
+ - **Run when:** Any permission set, permission set group, profile, or other post-deploy config was deployed or changed and not yet assigned/configured. **Omit when:** All required assignments and configuration are already in place.
102
+
103
+ **Proactive behavior:** After a successful deploy, discover permission sets in the project (e.g., `force-app/main/default/permissionsets/*.permissionset-meta.xml`) and assign each one. Extract the API name from the filename (e.g., `Property_Management_Access.permissionset-meta.xml` → `Property_Management_Access`). If the user has not explicitly requested a full setup, you may ask: "Do you want me to assign the permission sets to your org?" — but do not skip this step silently; either run it or ask.
104
+
105
+ ### Step 5: Data — prepare and import (optional)
106
+
107
+ | Action | Salesforce interaction? | Command |
108
+ |--------|-------------------------|---------|
109
+ | Prepare unique fields | No | `node scripts/prepare-import-unique-fields.js --data-dir <dataDir>` |
110
+ | Clean existing records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per sobject, reverse plan order) |
111
+ | Import records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per batch) |
112
+
113
+ - Only runs if `data/data-plan.json` and `data/` exist.
114
+ - Delete runs in reverse plan order (children before parents).
115
+ - Import uses Anonymous Apex with `Database.DMLOptions.duplicateRuleHeader.allowSave = true`.
116
+ - **Run when:** Data plan exists AND (never imported OR data files or plan changed). **Omit when:** No data plan, or data already imported and unchanged.
117
+
118
+ **Proactive behavior:** If `data/data-plan.json` and `data/` exist, you MUST ask the user: "Do you want me to import the sample data now? This will prepare unique fields, optionally clean existing records, and import data. Reply yes to proceed." Do not skip this step silently; either run it (after confirmation) or ask. Never import or clean without explicit user confirmation.
119
+
120
+ ### Step 6: GraphQL schema and codegen
121
+
122
+ | Action | Salesforce interaction? | Command |
123
+ |--------|-------------------------|---------|
124
+ | Install webapp deps | No | `npm install` (in webapp dir) |
125
+ | Set default org | **(SF)** | `sf config set target-org <alias> --global` |
126
+ | Fetch schema (introspection) | **(SF)** | `npm run graphql:schema` (from webapp dir) |
127
+ | Generate types | No | `npm run graphql:codegen` (from webapp dir) |
128
+
129
+ - `graphql:schema` performs GraphQL introspection against the org — a **Salesforce API call**.
130
+ - Schema is written to `schema.graphql` at the SFDX project root.
131
+ - Codegen reads the schema file locally; no Salesforce interaction.
132
+ - **Run when:** Schema does not exist, OR metadata was deployed/changed since last schema fetch, OR permissions or post-deploy config was assigned since last schema fetch. **Omit when:** Schema exists and is current relative to org state.
133
+
134
+ ### Step 7: Webapp build (if not done in Step 2)
135
+
136
+ | Action | Salesforce interaction? | Command |
137
+ |--------|-------------------------|---------|
138
+ | Build web app | No | `npm run build` (in webapp dir) |
139
+
140
+ - **Run when:** Build is needed (e.g., for dev server or deploy) AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** `dist/` is current and no build needed.
141
+
142
+ ### Step 8: Dev server (optional)
143
+
144
+ | Action | Salesforce interaction? | Command |
145
+ |--------|-------------------------|---------|
146
+ | Launch dev server | No | `npm run dev` (in webapp dir) |
147
+
148
+ - **Run when:** User requests to launch the dev server. **Omit when:** Not requested.
149
+
150
+ ## Summary: All Salesforce Interactions (in order)
151
+
152
+ 1. `sf org display` — check org connection
153
+ 2. `sf org login web` — authenticate (if needed)
154
+ 3. `sf project deploy start` — deploy metadata
155
+ 4. `sf org assign permset` (permsets and permset groups) / profile assignment / other post-deploy config — assign permissions and configure
156
+ 5. `sf apex run` — delete existing data (if data plan)
157
+ 6. `sf apex run` — import data (if data plan)
158
+ 7. `sf config set target-org` — set default org for schema
159
+ 8. `npm run graphql:schema` — GraphQL introspection (Salesforce API)
160
+
161
+ ## Post-Deploy Checklist (MUST NOT SKIP)
162
+
163
+ After **every successful metadata deploy**, the agent MUST address these before considering the task complete:
164
+
165
+ 1. **Permission sets** — Discover `force-app/main/default/permissionsets/*.permissionset-meta.xml`, extract API names, and assign each via `sf org assign permset --name <name> --target-org <alias>`. If unsure, ask: "Do you want me to assign the permission sets (e.g., Property_Management_Access, Tenant_Maintenance_Access) to your org?"
166
+ 2. **Data import** — If `data/data-plan.json` exists, ask: "Do you want me to import the sample data now? Reply yes to proceed." Do not import without confirmation.
167
+ 3. **Schema refetch** — Run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir (required after deploy).
168
+
169
+ Do not silently skip permission set assignment or data import. Either run them or ask the user.
170
+
171
+ ## Agent Decision Criteria
172
+
173
+ Evaluate each step before running it. Ask:
174
+
175
+ - **Has this step ever run before?** If not, it is likely needed.
176
+ - **Have changes been made that require this step?** (e.g., metadata edits → deploy; deploy → schema refetch)
177
+ - **Is the current state sufficient?** (e.g., org connected, schema exists and is current, permissions and post-deploy config assigned)
178
+
179
+ Do not rely on CLI flags. Decide based on project state and what has changed.
180
+
181
+ ## Evaluation: When Each Step Touches Salesforce
182
+
183
+ | Step | Salesforce interaction | Run when |
184
+ |------|------------------------|----------|
185
+ | 1. Login | Yes | Org not connected |
186
+ | 2. Webapp build | No | Deploying web apps AND dist missing or source changed |
187
+ | 3. Deploy | Yes | Metadata changed or never deployed |
188
+ | 4. Post-deploy config | Yes | Permission sets, permset groups, profiles, or other config deployed/changed and not assigned |
189
+ | 5. Data | Yes | Data plan exists AND (never imported OR data changed) |
190
+ | 6. GraphQL | Yes (schema only) | Schema missing or metadata/permissions changed since last fetch |
191
+ | 7. Webapp build | No | Build needed AND dist missing or source changed |
192
+ | 8. Dev | No | User requests dev server |
193
+
194
+ **Critical rule:** Steps 3 (deploy) and 4 (post-deploy config) must complete **before** step 6 (graphql:schema). The schema reflects the org state; running introspection too early yields an incomplete schema.
195
+
196
+ ## Schema Refetch Rule (CRITICAL)
197
+
198
+ **After any metadata deployment**, you MUST re-run schema fetch and codegen:
199
+
200
+ - New custom objects
201
+ - New custom fields
202
+ - New or updated permission sets
203
+ - Any change to metadata that affects the GraphQL schema
204
+
205
+ ```bash
206
+ # From webapp dir (force-app/main/default/webapplications/<appName>/)
207
+ npm run graphql:schema
208
+ npm run graphql:codegen
209
+ ```
210
+
211
+ Do **not** assume the existing `schema.graphql` is current after metadata changes.
212
+
213
+ ## One-Command Setup (Reference)
214
+
215
+ The project includes `scripts/setup-cli.mjs` which runs this sequence in batch. Use it when the user wants a full setup; otherwise, follow this skill and run only the steps that are needed based on current state.
216
+
217
+ ## Prohibited Actions
218
+
219
+ - **Do not** run `npm run graphql:schema` before metadata is deployed — the schema will not include custom objects/fields
220
+ - **Do not** skip schema refetch after deploying new metadata — types and queries will be out of sync
221
+ - **Do not** assign permissions or configure before deploying — permission sets, permset groups, and profiles must exist in the org first
222
+ - **Do not** run GraphQL introspection before assigning permissions — the user may lack FLS for custom fields
223
+
224
+ ## Related Skills
225
+
226
+ - **using-salesforce-data** — Full data access workflow (GraphQL queries/mutations, REST APIs, schema exploration, webapp integration)