@salesforce/templates 66.4.1 → 66.5.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.
- package/lib/generators/projectGenerator.js +97 -1
- package/lib/generators/projectGenerator.js.map +1 -1
- package/lib/templates/project/agent/Manifest.xml +40 -0
- package/lib/templates/project/agent/README.md +91 -0
- package/lib/templates/project/agent/ScratchDef.json +19 -0
- package/lib/templates/project/agent/md/aab/Local_Info_Agent.agent +265 -0
- package/lib/templates/project/agent/md/aab/Local_Info_Agent.bundle-meta.xml +4 -0
- package/lib/templates/project/agent/md/apex/CheckWeather.cls +54 -0
- package/lib/templates/project/agent/md/apex/CheckWeather.cls-meta.xml +5 -0
- package/lib/templates/project/agent/md/apex/CurrentDate.cls +38 -0
- package/lib/templates/project/agent/md/apex/CurrentDate.cls-meta.xml +5 -0
- package/lib/templates/project/agent/md/apex/CurrentDateTest.cls +23 -0
- package/lib/templates/project/agent/md/apex/CurrentDateTest.cls-meta.xml +5 -0
- package/lib/templates/project/agent/md/apex/WeatherService.cls +51 -0
- package/lib/templates/project/agent/md/apex/WeatherService.cls-meta.xml +5 -0
- package/lib/templates/project/agent/md/apex/WeatherServiceTest.cls +22 -0
- package/lib/templates/project/agent/md/apex/WeatherServiceTest.cls-meta.xml +5 -0
- package/lib/templates/project/agent/md/flow/Get_Resort_Hours.flow-meta.xml +298 -0
- package/lib/templates/project/agent/md/gapt/Get_Event_Info.genAiPromptTemplate-meta.xml +41 -0
- package/lib/templates/project/agent/md/ps/Resort_Admin.permissionset-meta.xml +30 -0
- package/lib/templates/project/agent/md/ps/Resort_Agent.permissionset-meta.xml +23 -0
- package/lib/templates/project/agent/md/psg/AFDX_Agent_Perms.permissionsetgroup-meta.xml +11 -0
- package/lib/templates/project/agent/md/psg/AFDX_User_Perms.permissionsetgroup-meta.xml +14 -0
- package/lib/templates/project/agent/package.json +15 -0
- package/lib/templates/project/nativemobile/README.md +21 -0
- package/lib/templates/project/nativemobile/ScratchDef.json +5 -0
- package/lib/templates/project/nativemobile/appMetadata-content.json +29 -0
- package/lib/templates/project/nativemobile/appMetadata-meta.json +5 -0
- package/lib/templates/project/nativemobile/buildMetadata-content.json +8 -0
- package/lib/templates/project/nativemobile/buildMetadata-meta.json +5 -0
- package/lib/templates/project/nativemobile/digitalExperience-meta.xml +4 -0
- package/lib/templates/project/nativemobile/ecDefinition-content.json +5 -0
- package/lib/templates/project/nativemobile/ecDefinition-meta.json +5 -0
- package/lib/templates/project/nativemobile/homeScreen-content.json +77 -0
- package/lib/templates/project/nativemobile/homeScreen-meta.json +5 -0
- package/lib/templates/project/reactb2e/AGENT.md +17 -13
- package/lib/templates/project/reactb2e/CHANGELOG.md +276 -0
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/index.html +2 -2
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/package.json +10 -5
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/src/app.tsx +1 -9
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/src/components/AgentforceConversationClient.tsx +15 -5
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -0
- package/lib/templates/project/reactb2e/_p_/_m_/_w_/_a_/vite.config.ts +1 -2
- package/lib/templates/project/reactb2e/_r_/skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md +11 -5
- package/lib/templates/project/reactb2e/_r_/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md +13 -6
- package/lib/templates/project/reactb2e/_r_/skills/feature-react-file-upload-file-upload/SKILL.md +396 -0
- package/lib/templates/project/reactb2e/_r_/skills/webapp-features/SKILL.md +210 -0
- package/lib/templates/project/reactb2e/_r_/skills/{webapp-react-add-component → webapp-react}/SKILL.md +5 -3
- package/lib/templates/project/reactb2e/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/header-footer.md +8 -0
- package/lib/templates/project/{reactb2x/_r_/skills/webapp-react-add-component → reactb2e/_r_/skills/webapp-react}/implementation/page.md +8 -7
- package/lib/templates/project/reactb2e/_r_/skills/webapp-ui-ux/SKILL.md +11 -8
- package/lib/templates/project/reactb2e/_r_/webapp-cli-commands.md +88 -0
- package/lib/templates/project/reactb2e/_r_/webapp-react-code-quality.md +1 -1
- package/lib/templates/project/reactb2e/_r_/webapp-react-typescript.md +1 -1
- package/lib/templates/project/reactb2e/_r_/webapp-react.md +55 -1
- package/lib/templates/project/reactb2e/_r_/webapp-skills-first.md +1 -1
- package/lib/templates/project/reactb2e/_r_/webapp-webapplication.md +159 -0
- package/lib/templates/project/reactb2e/_r_/webapp.md +2 -2
- package/lib/templates/project/reactb2e/package.json +1 -1
- package/lib/templates/project/reactb2e/scripts/prepare-import-unique-fields.js +17 -3
- package/lib/templates/project/reactb2e/scripts/setup-cli.mjs +318 -67
- package/lib/templates/project/reactb2x/AGENT.md +17 -13
- package/lib/templates/project/reactb2x/CHANGELOG.md +276 -0
- package/lib/templates/project/reactb2x/_p_/_m_/_d_/_s_/_a1_/sfdc_cms__site/appreacttemplateb2x1/content.json +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/index.html +2 -2
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/package.json +10 -4
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/api/userProfileApi.ts +15 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ChangePassword.tsx +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ForgotPassword.tsx +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Login.tsx +2 -2
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/Register.tsx +2 -2
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/_f_/authentication/pages/ResetPassword.tsx +1 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/src/app.tsx +2 -1
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/tsconfig.tsbuildinfo +1 -0
- package/lib/templates/project/reactb2x/_p_/_m_/_w_/_a_/vite.config.ts +1 -2
- package/lib/templates/project/reactb2x/_r_/skills/feature-graphql-graphql-data-access/docs/generate-mutation-query.md +11 -5
- package/lib/templates/project/reactb2x/_r_/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md +13 -6
- package/lib/templates/project/reactb2x/_r_/skills/feature-react-file-upload-file-upload/SKILL.md +396 -0
- package/lib/templates/project/reactb2x/_r_/skills/webapp-features/SKILL.md +210 -0
- package/lib/templates/project/reactb2x/_r_/skills/{webapp-react-add-component → webapp-react}/SKILL.md +5 -3
- package/lib/templates/project/reactb2x/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/header-footer.md +8 -0
- package/lib/templates/project/{reactb2e/_r_/skills/webapp-react-add-component → reactb2x/_r_/skills/webapp-react}/implementation/page.md +8 -7
- package/lib/templates/project/reactb2x/_r_/skills/webapp-ui-ux/SKILL.md +11 -8
- package/lib/templates/project/reactb2x/_r_/webapp-cli-commands.md +88 -0
- package/lib/templates/project/reactb2x/_r_/webapp-react-code-quality.md +1 -1
- package/lib/templates/project/reactb2x/_r_/webapp-react-typescript.md +1 -1
- package/lib/templates/project/reactb2x/_r_/webapp-react.md +55 -1
- package/lib/templates/project/reactb2x/_r_/webapp-skills-first.md +1 -1
- package/lib/templates/project/reactb2x/_r_/webapp-webapplication.md +159 -0
- package/lib/templates/project/reactb2x/_r_/webapp.md +2 -2
- package/lib/templates/project/reactb2x/package.json +1 -1
- package/lib/templates/project/reactb2x/scripts/prepare-import-unique-fields.js +17 -3
- package/lib/templates/project/reactb2x/scripts/setup-cli.mjs +318 -67
- package/lib/templates/webapplication/reactbasic/index.html +2 -2
- package/lib/templates/webapplication/reactbasic/package.json +3 -3
- package/lib/templates/webapplication/reactbasic/src/app.tsx +1 -9
- package/lib/templates/webapplication/reactbasic/vite.config.ts +1 -2
- package/lib/utils/types.d.ts +1 -1
- package/package.json +6 -6
- package/lib/templates/project/reactb2e/_r_/webapp-no-node-e.md +0 -65
- package/lib/templates/project/reactb2x/_r_/webapp-no-node-e.md +0 -65
- /package/lib/templates/project/reactb2e/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/component.md +0 -0
- /package/lib/templates/project/reactb2x/_r_/skills/{webapp-react-add-component → webapp-react}/implementation/component.md +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: webapp-features
|
|
3
|
+
description: Search, describe, and install pre-built UI features (authentication, shadcn components, navigation, charts, search, GraphQL, Agentforce AI) into Salesforce webapps. Use this when the user wants to add functionality to a webapp, or when determining what salesforce-provided features are available — whether prompted by the user or on your own initiative. Always check for an existing feature before building from scratch.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# webapps-features-experimental CLI — Agent Reference
|
|
7
|
+
|
|
8
|
+
**Always check for an existing feature before building something yourself.** This CLI installs pre-built, tested feature packages into Salesforce webapps. Features range from foundational UI component libraries (shadcn/ui with Button, Card, Input, Table, etc.) to full-stack application capabilities like authentication (login, registration, password flows, session management, and Apex backend classes), global search, navigation menus, data visualization charts, GraphQL integrations, and Agentforce AI conversation UIs. Each feature ships as a complete implementation — including React components, context providers, route guards, and any required Salesforce server-side code — that already handles platform-specific concerns like Salesforce API integration, session management, and SFDX metadata structure. Building these from scratch is error-prone and unnecessary when a feature exists. **If no existing feature is found, ask the user before proceeding with a custom implementation — a relevant feature may exist under a different name or keyword.**
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npx @salesforce/webapps-features-experimental <command> [options]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Workflow: Search Project → Search Features → Describe → Install
|
|
15
|
+
|
|
16
|
+
**MANDATORY**: When the user asks to add ANY webapp functionality, follow this entire workflow. Do not skip steps.
|
|
17
|
+
|
|
18
|
+
### 1. Search existing project code
|
|
19
|
+
|
|
20
|
+
Before installing anything, check whether the functionality already exists in the **project source code** (not dependencies).
|
|
21
|
+
|
|
22
|
+
- **Always scope searches to `src/`** to avoid matching files in `node_modules/`, `dist/`, or `build/` output
|
|
23
|
+
- Use Glob with a scoped path: e.g., `src/**/Button.tsx`, `src/**/*auth*.tsx`
|
|
24
|
+
- Use Grep with the `path` parameter set to the `src/` directory, or use `glob: "*.{ts,tsx}"` to restrict file types
|
|
25
|
+
- Check common directories: `src/components/`, `src/lib/`, `src/pages/`, `src/hooks/`
|
|
26
|
+
- **Never** search from the project root without a path or glob filter — this will crawl `node_modules` and produce massive, unhelpful output
|
|
27
|
+
|
|
28
|
+
**If existing code is found** — read the files, present them to the user, and ask if they want to reuse or extend what's there. If yes, use the existing code and stop. If no, proceed to step 2.
|
|
29
|
+
|
|
30
|
+
**If nothing is found** — proceed to step 2.
|
|
31
|
+
|
|
32
|
+
### 2. Search available features
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx @salesforce/webapps-features-experimental list [options]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Options:
|
|
39
|
+
|
|
40
|
+
- `-v, --verbose` — Show full descriptions, packages, and dependencies
|
|
41
|
+
- `--search <query>` — Filter features by keyword (ranked by relevance)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx @salesforce/webapps-features-experimental list
|
|
45
|
+
npx @salesforce/webapps-features-experimental list --search "auth"
|
|
46
|
+
npx @salesforce/webapps-features-experimental list --search "button"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**If no matching feature is found** — ask the user before proceeding with a custom implementation. A relevant feature may exist under a different name or keyword.
|
|
50
|
+
|
|
51
|
+
### 3. Describe a feature
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx @salesforce/webapps-features-experimental describe <feature>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Shows description, package name, dependencies, components, copy operations, and example files.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx @salesforce/webapps-features-experimental describe authentication
|
|
61
|
+
npx @salesforce/webapps-features-experimental describe shadcn
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Install a feature
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx @salesforce/webapps-features-experimental install <feature> --webapp-dir <path> [options]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Resolves the feature name to an npm package, installs it and its dependencies (including transitive feature dependencies like `shadcn`), copies source files into your project, and reports any `__example__` files that require manual integration.
|
|
71
|
+
|
|
72
|
+
Options:
|
|
73
|
+
|
|
74
|
+
- `--webapp-dir <name>` (required) — Webapp name, resolves to `<sfdx-source>/webapplications/<name>`
|
|
75
|
+
- `--sfdx-source <path>` (default: `force-app/main/default`) — SFDX source directory
|
|
76
|
+
- `--dry-run` (default: `false`) — Preview changes without writing files
|
|
77
|
+
- `-v, --verbose` (default: `false`) — Enable verbose logging
|
|
78
|
+
- `-y, --yes` (default: `false`) — Skip all prompts (auto-skip conflicts)
|
|
79
|
+
- `--on-conflict <mode>` (default: `prompt`) — `prompt`, `error`, `skip`, or `overwrite`
|
|
80
|
+
- `--conflict-resolution <file>` — Path to JSON file with per-file resolutions
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install authentication (also installs shadcn dependency)
|
|
84
|
+
npx @salesforce/webapps-features-experimental install authentication \
|
|
85
|
+
--webapp-dir mywebapp
|
|
86
|
+
|
|
87
|
+
# Dry run to preview changes
|
|
88
|
+
npx @salesforce/webapps-features-experimental install shadcn \
|
|
89
|
+
--webapp-dir mywebapp \
|
|
90
|
+
--dry-run
|
|
91
|
+
|
|
92
|
+
# Non-interactive install (skip all file conflicts)
|
|
93
|
+
npx @salesforce/webapps-features-experimental install authentication \
|
|
94
|
+
--webapp-dir mywebapp \
|
|
95
|
+
--yes
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Conflict Handling
|
|
99
|
+
|
|
100
|
+
Since you are running in a non-interactive environment, you cannot use `--on-conflict prompt` directly. When conflicts are likely (e.g. installing into an existing project), you have two options:
|
|
101
|
+
|
|
102
|
+
**Option A — Let the user resolve conflicts interactively.** Suggest the user run the install command themselves with `--on-conflict prompt` so they can decide per-file.
|
|
103
|
+
|
|
104
|
+
**Option B — Two-pass automated resolution:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Pass 1: detect conflicts
|
|
108
|
+
npx @salesforce/webapps-features-experimental install authentication \
|
|
109
|
+
--webapp-dir mywebapp \
|
|
110
|
+
--on-conflict error
|
|
111
|
+
|
|
112
|
+
# The CLI will exit with an error listing every conflicting file path.
|
|
113
|
+
|
|
114
|
+
# Pass 2: create a resolution file and re-run
|
|
115
|
+
echo '{ "src/styles/global.css": "overwrite", "src/lib/utils.ts": "skip" }' > resolutions.json
|
|
116
|
+
|
|
117
|
+
npx @salesforce/webapps-features-experimental install authentication \
|
|
118
|
+
--webapp-dir mywebapp \
|
|
119
|
+
--conflict-resolution resolutions.json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Resolution values per file: `"skip"` (keep existing) or `"overwrite"` (replace). When unsure how to resolve a conflict, ask the user rather than guessing.
|
|
123
|
+
|
|
124
|
+
## Hint Placeholders in Copy Paths
|
|
125
|
+
|
|
126
|
+
Some copy operations use **hint placeholders** in the `"to"` path — descriptive segments like `<desired-page-with-search-input>` that are NOT resolved by the CLI. These are guidance for the user or LLM to choose an appropriate destination.
|
|
127
|
+
|
|
128
|
+
**How they work:** The file is copied with the literal placeholder name (e.g., `src/pages/<desired-page-with-search-input>.tsx`). After installation, you should:
|
|
129
|
+
|
|
130
|
+
1. Read the copied file to understand its purpose
|
|
131
|
+
2. Rename or relocate it to the intended target (e.g., `src/pages/Home.tsx`)
|
|
132
|
+
3. Or integrate its patterns into an existing file, then delete it
|
|
133
|
+
|
|
134
|
+
**How to identify them:** Hint placeholders use `<descriptive-name>` syntax but are NOT one of the system placeholders (`<sfdxSource>`, `<webappDir>`, `<webapp>`). They always appear in the middle or end of a path, never as the leading segment.
|
|
135
|
+
|
|
136
|
+
**Example from features.json:**
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"to": "<webappDir>/src/pages/<desired-page-with-search-input>.tsx",
|
|
141
|
+
"description": "Example home page showing GlobalSearchInput integration",
|
|
142
|
+
"integrationTarget": "src/pages/Home.tsx"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The `integrationTarget` field tells you the suggested destination. Use your judgment — if the user already has a different page where search should go, integrate there instead.
|
|
147
|
+
|
|
148
|
+
**When `integrationTarget` itself is a placeholder:** Some features use a hint placeholder in the `integrationTarget` value (e.g., `"integrationTarget": "src/<path-to-desired-page-with-search-input>.tsx"`). This means there is no single default target — the user must decide which existing file to integrate into. When you encounter this:
|
|
149
|
+
|
|
150
|
+
1. Ask the user which page or file they want to integrate the feature into
|
|
151
|
+
2. Read the `__example__` file to understand the integration pattern
|
|
152
|
+
3. Read the user's chosen target file
|
|
153
|
+
4. Apply the pattern from the example into the target file
|
|
154
|
+
|
|
155
|
+
## Post Installation: Integrating **example** Files
|
|
156
|
+
|
|
157
|
+
Features may include `__example__` files (e.g., `__example__auth-app.tsx`) showing integration patterns.
|
|
158
|
+
|
|
159
|
+
**The describe command shows**:
|
|
160
|
+
|
|
161
|
+
- Which **example** files will be copied
|
|
162
|
+
- Target file to integrate into (e.g., `src/app.tsx`)
|
|
163
|
+
- What the example demonstrates
|
|
164
|
+
|
|
165
|
+
### How to Integrate Example Files (CRITICAL FOR LLMs)
|
|
166
|
+
|
|
167
|
+
⚠️ **ONLY USE Read AND Edit TOOLS - NO BASH COMMANDS** ⚠️
|
|
168
|
+
|
|
169
|
+
**DO NOT DO THIS**:
|
|
170
|
+
|
|
171
|
+
- ❌ `git status` or any git commands
|
|
172
|
+
- ❌ `ls`, `cat`, `sed`, `awk`, or ANY bash file commands
|
|
173
|
+
- ❌ Chaining bash commands to read multiple files
|
|
174
|
+
- ❌ Using bash to check directories or file existence
|
|
175
|
+
|
|
176
|
+
**DO THIS INSTEAD**:
|
|
177
|
+
|
|
178
|
+
- ✅ Use Read tool with `file_path` parameter to read each file
|
|
179
|
+
- ✅ Use Edit tool with `file_path`, `old_string`, `new_string` to modify files
|
|
180
|
+
- ✅ That's it! Just Read and Edit tools.
|
|
181
|
+
|
|
182
|
+
**Integration steps**:
|
|
183
|
+
|
|
184
|
+
1. **Read each example file** (use Read tool)
|
|
185
|
+
- Example: Read tool with `file_path: "force-app/main/default/webapplications/mywebapp/src/__example__auth-app.tsx"`
|
|
186
|
+
- Note the imports and patterns to integrate
|
|
187
|
+
|
|
188
|
+
2. **Read each target file** (use Read tool)
|
|
189
|
+
- Example: Read tool with `file_path: "force-app/main/default/webapplications/mywebapp/src/app.tsx"`
|
|
190
|
+
- Understand where the new code should go
|
|
191
|
+
|
|
192
|
+
3. **Edit each target file** (use Edit tool)
|
|
193
|
+
- Add imports from the example
|
|
194
|
+
- Add or modify code following the example's patterns
|
|
195
|
+
- Preserve existing functionality
|
|
196
|
+
|
|
197
|
+
4. **Delete the example file after successful integration** (use Bash tool)
|
|
198
|
+
- Example: `rm force-app/main/default/webapplications/mywebapp/src/__example__authentication-routes.tsx`
|
|
199
|
+
- Only delete after you have successfully integrated the pattern
|
|
200
|
+
- This keeps the codebase clean and removes temporary example files
|
|
201
|
+
|
|
202
|
+
## Troubleshooting
|
|
203
|
+
|
|
204
|
+
**Directory not found**: Check paths are correct, use absolute or correct relative paths
|
|
205
|
+
|
|
206
|
+
**Feature not found**: Use `npx @salesforce/webapps-features-experimental list` to see available feature names
|
|
207
|
+
|
|
208
|
+
**Conflicts in error mode**: Follow CLI instructions to create resolution file
|
|
209
|
+
|
|
210
|
+
**Need help?**: Run `npx @salesforce/webapps-features-experimental --help` to see all commands and options
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: webapp-react
|
|
3
|
-
description:
|
|
2
|
+
name: webapp-react
|
|
3
|
+
description: Use when editing any React code in the web application — creating or modifying components, pages, layout, headers, footers, or any TSX/JSX files. Follow this skill for add component, add page, header/footer, and general React UI implementation patterns (shadcn UI and Tailwind CSS).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# React Web App (Components, Pages, Layout)
|
|
7
|
+
|
|
8
|
+
Use this skill whenever you are editing React/TSX code in the web app (creating or modifying components, pages, header/footer, or layout).
|
|
7
9
|
|
|
8
10
|
## Step 1 — Identify the type of component
|
|
9
11
|
|
|
@@ -116,6 +116,14 @@ AppLayout (appLayout.tsx)
|
|
|
116
116
|
- **Icons:** `lucide-react`; add `aria-hidden="true"` on decorative icons
|
|
117
117
|
- **Design tokens:** `bg-background`, `text-foreground`, `text-muted-foreground`, `border`, `bg-primary`
|
|
118
118
|
|
|
119
|
+
### Mobile hamburger / Menu icon — Must be functional
|
|
120
|
+
|
|
121
|
+
If the header includes a hamburger or `Menu` icon for mobile:
|
|
122
|
+
|
|
123
|
+
- **Do not** add a Menu/hamburger icon that does nothing. It must toggle a visible mobile menu.
|
|
124
|
+
- **Required:** (1) State: `const [isOpen, setIsOpen] = useState(false)`. (2) Button: `onClick={() => setIsOpen(!isOpen)}`, `aria-label="Toggle menu"`. (3) Conditional panel: `{isOpen && ( <div>...nav links...</div> )}` with responsive visibility (e.g. `md:hidden`). (4) Close on navigate: each link in the panel should `onClick={() => setIsOpen(false)}`.
|
|
125
|
+
- Implement in `appLayout.tsx` (or the component that owns the header). Use the `Menu` icon from `lucide-react`.
|
|
126
|
+
|
|
119
127
|
### Confirm — Header / Footer
|
|
120
128
|
|
|
121
129
|
- Header and footer appear on every page (navigate to at least two routes)
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
### Rules
|
|
4
4
|
|
|
5
|
-
1.
|
|
6
|
-
2.
|
|
7
|
-
3. **
|
|
8
|
-
4. **
|
|
9
|
-
5. **
|
|
10
|
-
6. **
|
|
11
|
-
7. **
|
|
5
|
+
1. **Edit the component that owns the UI, never output raw HTML** — When editing the home page or any page content, modify the actual `.tsx` file that renders the target. If the target is inside a child component (e.g. `<GlobalSearchInput />` in `Home.tsx`), edit the child's file (e.g. `GlobalSearchInput.tsx`), not the parent. Do not wrap the component with extra elements in the parent; go into the component and change its JSX. Do not paste or generate raw HTML.
|
|
6
|
+
2. **`routes.tsx` is the only route registry** — never add routes in `app.tsx` or inside page files.
|
|
7
|
+
3. **All pages are children of the AppLayout route** — do not create top-level routes that bypass the layout shell.
|
|
8
|
+
4. **Default export per page** — each page file has exactly one default-export component.
|
|
9
|
+
5. **Path aliases in all imports** — use `@/pages/...`, `@/components/...`; no deep relative paths.
|
|
10
|
+
6. **No inline styles** — Tailwind utility classes and design tokens only.
|
|
11
|
+
7. **Catch-all last** — `path: '*'` (NotFound) must always remain the last child in the layout route.
|
|
12
|
+
8. **Never modify `appLayout.tsx`** when adding a page — layout changes are a separate concern.
|
|
12
13
|
|
|
13
14
|
### Step 1 — Create the page file
|
|
14
15
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: ui-ux
|
|
3
|
-
description: Comprehensive design guide for React + Tailwind + shadcn/ui
|
|
2
|
+
name: webapp-ui-ux
|
|
3
|
+
description: Use when editing any UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or visual/UX changes. Comprehensive design guide and searchable database for React + Tailwind + shadcn/ui (styles, color palettes, font pairings, UX guidelines, chart types).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Web App UI/UX
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use this skill whenever you are editing UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or any visual/UX change.
|
|
9
|
+
|
|
10
|
+
Comprehensive design guide for React + Tailwind + shadcn/ui. Contains 67 styles, 96 color palettes, 57 font pairings, 99 UX guidelines, and 25 chart types. Searchable database with priority-based recommendations.
|
|
9
11
|
|
|
10
12
|
## Prerequisites
|
|
11
13
|
|
|
@@ -200,9 +202,10 @@ These are frequently overlooked issues that make UI look unprofessional:
|
|
|
200
202
|
|
|
201
203
|
| Rule | Do | Don't |
|
|
202
204
|
|------|----|----- |
|
|
203
|
-
| **
|
|
205
|
+
| **Icons: Lucide only** | Use **lucide-react** for all UI icons: `import { IconName } from 'lucide-react'` | Use Heroicons, react-icons, or other icon libraries; use emojis as icons |
|
|
206
|
+
| **No emojis ever** | Use words + Lucide icons for labels, empty states, tooltips, headings | Use emojis anywhere in UI or user-facing text (e.g. 🎨 🚀 ⚙️) |
|
|
204
207
|
| **Stable hover states** | Use color/opacity transitions on hover | Use scale transforms that shift layout |
|
|
205
|
-
| **Correct brand logos** | Research official SVG from Simple Icons | Guess or use incorrect logo paths |
|
|
208
|
+
| **Correct brand logos** | Research official SVG from Simple Icons (when needed outside Lucide) | Guess or use incorrect logo paths |
|
|
206
209
|
| **Consistent icon sizing** | Use fixed viewBox (24x24) with w-6 h-6 | Mix different icon sizes randomly |
|
|
207
210
|
|
|
208
211
|
### Interaction & Cursor
|
|
@@ -237,8 +240,8 @@ These are frequently overlooked issues that make UI look unprofessional:
|
|
|
237
240
|
Before delivering UI code, verify these items:
|
|
238
241
|
|
|
239
242
|
### Visual Quality
|
|
240
|
-
- [ ] No emojis
|
|
241
|
-
- [ ] All icons from
|
|
243
|
+
- [ ] No emojis anywhere (UI, labels, empty states, tooltips—use words + Lucide icons only)
|
|
244
|
+
- [ ] All icons from **lucide-react** only (no Heroicons, react-icons, or emojis)
|
|
242
245
|
- [ ] Brand logos are correct (verified from Simple Icons)
|
|
243
246
|
- [ ] Hover states don't cause layout shift
|
|
244
247
|
- [ ] Use theme colors directly (bg-primary) not var() wrapper
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CLI command generation rules — no node -e one-liners; safe quoting and scripts
|
|
3
|
+
paths:
|
|
4
|
+
- "**/webapplications/**/*"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# A4D Enforcement: CLI Command Generation & No `node -e` One-Liners
|
|
8
|
+
|
|
9
|
+
When **generating any CLI/shell commands** (for the user or for automation), follow the rules below. Default shell is **Zsh** (macOS); commands must work there without Bash-only syntax.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Never Use Complex `node -e` One-Liners
|
|
14
|
+
|
|
15
|
+
**Forbidden:** `node -e` (or `node -p`, `node --eval`) for file manipulation, string replacement, reading/writing configs, or multi-line logic.
|
|
16
|
+
|
|
17
|
+
**Why:** In Zsh, `node -e '...'` **silently breaks** due to:
|
|
18
|
+
- **`!` (history expansion):** Zsh expands `!` in double-quoted strings → `event not found` or wrong output.
|
|
19
|
+
- **Backticks:** `` ` `` is command substitution; the shell runs it before Node sees the string.
|
|
20
|
+
- **Nested quoting:** Escaping differs between Bash and Zsh; multi-line JS in one string is fragile.
|
|
21
|
+
|
|
22
|
+
**Allowed:** Trivial one-line only if it has **no** backticks, no `!`, no nested quotes, no multi-line, no `fs` usage. Example: `node -e "console.log(1+1)"`. If in doubt, **use a script file**.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 2. How To Generate CLI Commands Correctly
|
|
27
|
+
|
|
28
|
+
### Run Node scripts by path, not inline code
|
|
29
|
+
|
|
30
|
+
- **Do:** `node scripts/setup-cli.mjs --target-org myorg`
|
|
31
|
+
- **Do:** `node path/to/script.mjs arg1 arg2`
|
|
32
|
+
- **Do not:** `node -e "require('fs').writeFileSync(...)"` or any non-trivial inline JS.
|
|
33
|
+
|
|
34
|
+
### For file edits or transforms
|
|
35
|
+
|
|
36
|
+
1. **Prefer IDE/agent file tools** (StrReplace, Write, etc.) — they avoid the shell.
|
|
37
|
+
2. **Otherwise:** write a **temporary `.js` or `.mjs` file**, run it, then remove it. Use a **heredoc with quoted delimiter** so the shell does not interpret `$`, `` ` ``, or `!`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cat > /tmp/_transform.js << 'SCRIPT'
|
|
41
|
+
const fs = require('fs');
|
|
42
|
+
const data = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
43
|
+
data.name = 'my-app';
|
|
44
|
+
fs.writeFileSync('package.json', JSON.stringify(data, null, 2) + '\n');
|
|
45
|
+
SCRIPT
|
|
46
|
+
node /tmp/_transform.js && rm /tmp/_transform.js
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. **Simple replacements:** `sed -i '' 's/old/new/g' path/to/file` (macOS: `-i ''`).
|
|
50
|
+
4. **JSON:** `jq '.name = "my-app"' package.json > tmp.json && mv tmp.json package.json`.
|
|
51
|
+
|
|
52
|
+
### Quoting and shell safety
|
|
53
|
+
|
|
54
|
+
- Use **single quotes** around the outer shell string when the inner content has `$`, `` ` ``, or `!`.
|
|
55
|
+
- For heredocs that must be literal, use **`<< 'END'`** (quoted delimiter) so the body is not expanded.
|
|
56
|
+
- **Do not** generate commands that rely on Bash-only features (e.g. `[[ ]]` is fine in Zsh; avoid `source` vs `.` if you need POSIX).
|
|
57
|
+
|
|
58
|
+
### Paths and working directory
|
|
59
|
+
|
|
60
|
+
- **State where to run from** when it matters, e.g. "From project root" or "From `force-app/main/default/webapplications/<appName>`".
|
|
61
|
+
- Prefer **explicit paths** or `cd <dir> && ...` so the command is copy-paste safe.
|
|
62
|
+
- This project: setup is `node scripts/setup-cli.mjs --target-org <alias>` from **project root**. Web app commands (`npm run dev`, `npm run build`, `npm run lint`) run from the **web app directory** (e.g. `force-app/main/default/webapplications/<appName>` or `**/webapplications/<appName>`).
|
|
63
|
+
|
|
64
|
+
### npm / npx
|
|
65
|
+
|
|
66
|
+
- Use **exact package names** (e.g. `npx @salesforce/webapps-features-experimental list`).
|
|
67
|
+
- For app-specific scripts, **cd to the web app directory first**, then run `npm run <script>` or `npm install ...`.
|
|
68
|
+
- Chain steps with `&&`; one logical command per line is clearer than one giant line.
|
|
69
|
+
|
|
70
|
+
### Summary checklist when generating a command
|
|
71
|
+
|
|
72
|
+
- [ ] No `node -e` / `node -p` / `node --eval` with complex or multi-line code.
|
|
73
|
+
- [ ] If Node logic is needed, use `node path/to/script.mjs` or a temp script with heredoc `<< 'SCRIPT'`.
|
|
74
|
+
- [ ] No unescaped `!`, `` ` ``, or `$` in double-quoted strings in Zsh.
|
|
75
|
+
- [ ] Working directory and required args (e.g. `--target-org`) are clear.
|
|
76
|
+
- [ ] Prefer file-editing tools over shell one-liners when editing project files.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 3. Violation Handling
|
|
81
|
+
|
|
82
|
+
- If a generated command used a complex `node -e` one-liner, **revert and redo** using a script file, `sed`/`jq`, or IDE file tools.
|
|
83
|
+
- If the user sees `event not found`, `unexpected token`, or garbled output, **check for**:
|
|
84
|
+
- `node -e` with special characters,
|
|
85
|
+
- Double-quoted strings containing `!` or backticks,
|
|
86
|
+
- Wrong working directory or missing args.
|
|
87
|
+
|
|
88
|
+
**Cross-reference:** **webapp.md** (MUST FOLLOW #1) summarizes the no–`node -e` rule; this file is the full reference for CLI command generation and alternatives.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: React-specific patterns and Salesforce data access for SFDX web apps
|
|
3
3
|
paths:
|
|
4
|
-
- "
|
|
4
|
+
- "**/webapplications/**/*"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# React Web App (SFDX)
|
|
@@ -18,6 +18,15 @@ For layout, navigation, and generation rules, see **webapp.md**.
|
|
|
18
18
|
- Dev server: `npm run dev`
|
|
19
19
|
- Build: `npm run build`
|
|
20
20
|
|
|
21
|
+
## Routing (React Router)
|
|
22
|
+
|
|
23
|
+
Use a **single** router package for the app. When using `createBrowserRouter` and `RouterProvider` from `react-router`, all routing imports must come from **`react-router`** — not from `react-router-dom`.
|
|
24
|
+
|
|
25
|
+
- ✅ `import { createBrowserRouter, RouterProvider, Link, useNavigate, useLocation, Outlet } from 'react-router';`
|
|
26
|
+
- ❌ `import { Link } from 'react-router-dom';` when the app uses `RouterProvider` from `react-router`
|
|
27
|
+
|
|
28
|
+
Mixing packages causes "Cannot destructure property 'basename' of ... as it is null" because `Link`/hooks from `react-router-dom` read a different context than the one provided by `RouterProvider` from `react-router`.
|
|
29
|
+
|
|
21
30
|
## Component Library (MANDATORY)
|
|
22
31
|
|
|
23
32
|
Use **shadcn/ui** for UI components:
|
|
@@ -28,6 +37,42 @@ import { Card, CardHeader, CardContent } from '@/components/ui/card';
|
|
|
28
37
|
import { Input } from '@/components/ui/input';
|
|
29
38
|
```
|
|
30
39
|
|
|
40
|
+
## Icons & No Emojis (MANDATORY)
|
|
41
|
+
|
|
42
|
+
- **Icons:** Use **lucide-react** only. Do not use Heroicons, Simple Icons, or other icon libraries in the web app.
|
|
43
|
+
- ✅ `import { Menu, Settings, Bell } from 'lucide-react';` then `<Menu className="w-5 h-5" />`
|
|
44
|
+
- ❌ Any emoji character as an icon or visual element (e.g. 🎨 🚀 ⚙️ 🔔)
|
|
45
|
+
- ❌ Other icon libraries (e.g. `@heroicons/react`, `react-icons`, custom SVG icon sets)
|
|
46
|
+
- **No emojis ever:** Do not use emojis anywhere in the app: no emojis in UI labels, buttons, headings, empty states, tooltips, or any user-facing text. Use words and lucide-react icons instead.
|
|
47
|
+
- ✅ "Settings" with `<Settings />` icon
|
|
48
|
+
- ❌ "⚙️ Settings" or "Settings 🔧"
|
|
49
|
+
- For icon usage patterns and naming, see the **webapp-ui-ux** skill (`.a4drules/skills/webapp-ui-ux/`, especially `data/icons.csv`).
|
|
50
|
+
|
|
51
|
+
## Editing UI — Source Files Only (CRITICAL)
|
|
52
|
+
|
|
53
|
+
When asked to edit the home page, a section, or any on-screen UI:
|
|
54
|
+
|
|
55
|
+
- **Always edit the actual React/TSX source files.** Never output, paste, or generate raw HTML. The UI is built from components; the agent must locate the component file(s) that render the target area and change **JSX in those files**.
|
|
56
|
+
- **Do not** replace JSX with HTML strings, and do not copy browser-rendered DOM (e.g. expanded `<div>`, `data-slot`, long class strings) into the codebase. That is the output of React + shadcn; the source is `.tsx` with `<Card>`, `<Input>`, etc.
|
|
57
|
+
- **Edit inside the component that owns the UI.** If the element to change is rendered by a **child component** (e.g. `<GlobalSearchInput />` in `Home.tsx`), make the edit **inside that component's file** (e.g. `GlobalSearchInput.tsx`). Do **not** only wrap the component with extra elements in the parent (e.g. adding a `<section>` or `<div>` around `<GlobalSearchInput />`). The parent composes components; the visual/content change belongs in the component that actually renders that part of the UI.
|
|
58
|
+
- **Where to edit:**
|
|
59
|
+
- **Home page content:** `src/pages/Home.tsx` — but if the target is inside a child (e.g. `<GlobalSearchInput />`), edit the child's file, not the parent.
|
|
60
|
+
- **Layout, header, nav:** `src/appLayout.tsx`.
|
|
61
|
+
- **Feature-specific UI (e.g. search, list):** open the **specific component file** that renders the target (e.g. `GlobalSearchInput.tsx` for the search input UI).
|
|
62
|
+
- **Steps:** (1) Identify which **component** owns the section (follow the import: e.g. `GlobalSearchInput` → its file). (2) Open that component's file and modify the JSX there. (3) Only change the parent (e.g. `Home.tsx`) if the change is layout/ordering of components, not the internals of a child. Do not emit a standalone HTML snippet as the “edit.”
|
|
63
|
+
|
|
64
|
+
## Mobile Nav / Hamburger — Must Be Functional
|
|
65
|
+
|
|
66
|
+
When adding a navigation menu that includes a hamburger (or Menu icon) for mobile:
|
|
67
|
+
|
|
68
|
+
- **Do not** add a hamburger/Menu icon that does nothing. The icon must **toggle a visible mobile menu**.
|
|
69
|
+
- **Required implementation:**
|
|
70
|
+
1. **State:** e.g. `const [isOpen, setIsOpen] = useState(false);`
|
|
71
|
+
2. **Toggle button:** The hamburger/Menu button must have `onClick={() => setIsOpen(!isOpen)}` and `aria-label="Toggle menu"` (or equivalent).
|
|
72
|
+
3. **Conditional panel:** A mobile-only menu panel that renders when `isOpen` is true, e.g. `{isOpen && ( <div className="..."> ... nav links ... </div> )}`. Use responsive classes (e.g. `md:hidden`) so the panel is shown only on small screens if the desktop nav is separate.
|
|
73
|
+
4. **Close on navigation:** Each nav link in the mobile panel should call `onClick={() => setIsOpen(false)}` (or similar) so the menu closes when the user navigates.
|
|
74
|
+
- Implement this in `appLayout.tsx` (or the component that owns the header/nav). See existing apps for the full pattern (state + button + conditional panel + link onClick).
|
|
75
|
+
|
|
31
76
|
## Styling
|
|
32
77
|
|
|
33
78
|
- Use **Tailwind CSS** utility classes
|
|
@@ -137,11 +182,20 @@ window.location.reload();
|
|
|
137
182
|
- ❌ Using LWC patterns (`@wire`, LDS) in React
|
|
138
183
|
- ❌ Hardcoded Salesforce IDs or URLs
|
|
139
184
|
- ❌ Missing error handling for async operations
|
|
185
|
+
- ❌ Mixing `react-router` and `react-router-dom` (e.g. `RouterProvider` from `react-router` but `Link` from `react-router-dom`) — use one package for all routing imports
|
|
186
|
+
- ❌ Using emojis anywhere in the app (labels, icons, empty states, headings, tooltips)
|
|
187
|
+
- ❌ Using any icon library other than **lucide-react** (no Heroicons, react-icons, or emoji-as-icon)
|
|
188
|
+
- ❌ Outputting or pasting raw HTML when editing UI — always edit the React/TSX source files (e.g. `Home.tsx`, `appLayout.tsx`, feature components)
|
|
189
|
+
- ❌ Adding a hamburger or Menu icon for mobile nav without implementing toggle state, conditional menu panel, and close-on-navigate
|
|
140
190
|
|
|
141
191
|
## Quality Checklist
|
|
142
192
|
|
|
143
193
|
- [ ] Entry point maintained (`app.tsx`)
|
|
144
194
|
- [ ] Uses shadcn/ui and Tailwind
|
|
195
|
+
- [ ] Icons from **lucide-react** only; no emojis anywhere in UI or user-facing text
|
|
196
|
+
- [ ] UI changes made by editing .tsx source files (never by pasting raw HTML)
|
|
197
|
+
- [ ] If mobile hamburger exists: it has toggle state, conditional menu panel, and close on link click
|
|
198
|
+
- [ ] All routing imports from same package as router (e.g. `react-router` only)
|
|
145
199
|
- [ ] DataSDK used for all Salesforce API calls
|
|
146
200
|
- [ ] Proper error handling with try/catch
|
|
147
201
|
- [ ] Loading and error states implemented
|