sf-forcekit 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 (32) hide show
  1. package/License +21 -0
  2. package/README.md +106 -0
  3. package/bin/cli.js +85 -0
  4. package/package.json +44 -0
  5. package/templates/ai-dir/README.md +155 -0
  6. package/templates/ai-dir/agentforce.md +213 -0
  7. package/templates/ai-dir/architecture.md +123 -0
  8. package/templates/ai-dir/commands.md +276 -0
  9. package/templates/ai-dir/context-snapshots/TEMPLATE.md +64 -0
  10. package/templates/ai-dir/conventions.md +242 -0
  11. package/templates/ai-dir/current-state.md +113 -0
  12. package/templates/ai-dir/debugging-notes.md +165 -0
  13. package/templates/ai-dir/deployment.md +161 -0
  14. package/templates/ai-dir/integrations.md +199 -0
  15. package/templates/ai-dir/inventory.md +209 -0
  16. package/templates/ai-dir/known-issues.md +124 -0
  17. package/templates/ai-dir/org-context.md +110 -0
  18. package/templates/ai-dir/performance.md +312 -0
  19. package/templates/ai-dir/prompts/agentforce.md +163 -0
  20. package/templates/ai-dir/prompts/apex.md +165 -0
  21. package/templates/ai-dir/prompts/flows.md +125 -0
  22. package/templates/ai-dir/prompts/lwc.md +230 -0
  23. package/templates/ai-dir/prompts/security.md +181 -0
  24. package/templates/ai-dir/prompts/testing.md +269 -0
  25. package/templates/ai-dir/rules.md +238 -0
  26. package/templates/ai-dir/scripts/update_state.py +1406 -0
  27. package/templates/ai-dir/source-of-truth.md +180 -0
  28. package/templates/ai-dir/templates/Selector.cls +113 -0
  29. package/templates/ai-dir/templates/Service.cls +132 -0
  30. package/templates/ai-dir/templates/TestClass.cls +143 -0
  31. package/templates/ai-dir/templates/TriggerHandler.cls +67 -0
  32. package/templates/ai-dir/testing-strategy.md +342 -0
@@ -0,0 +1,209 @@
1
+ # Project Inventory
2
+
3
+ > 🤖 **AUTO-UPDATED BY AI AGENTS** — Registry of everything that actually exists in this project.
4
+ > Agents MUST consult this file before referencing any class, object, or component.
5
+ > Agents MUST update this file after creating or deleting anything.
6
+
7
+ ---
8
+
9
+ ## How to Populate This File
10
+
11
+ Run these commands and paste the output into the appropriate section below.
12
+ Agents should do this at the **start of the first session** on a new project.
13
+
14
+ ```bash
15
+ # List Apex classes in project
16
+ ls force-app/main/default/classes/*.cls 2>/dev/null | xargs -I{} basename {} .cls | sort
17
+
18
+ # List triggers in project
19
+ ls force-app/main/default/triggers/*.trigger 2>/dev/null | xargs -I{} basename {} .trigger | sort
20
+
21
+ # List LWC components
22
+ ls -d force-app/main/default/lwc/*/ 2>/dev/null | xargs -I{} basename {} | sort
23
+
24
+ # List custom objects
25
+ ls force-app/main/default/objects/ 2>/dev/null | sort
26
+
27
+ # List permission sets
28
+ ls force-app/main/default/permissionsets/*.permissionset-meta.xml 2>/dev/null | xargs -I{} basename {} .permissionset-meta.xml | sort
29
+
30
+ # List flows
31
+ ls force-app/main/default/flows/*.flow-meta.xml 2>/dev/null | xargs -I{} basename {} .flow-meta.xml | sort
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Custom Objects
37
+
38
+ <!-- Agent: List every custom object in the project. Format:
39
+ | API Name | Label | Key Fields | Notes | -->
40
+
41
+ | API Name | Label | Key Fields | Notes |
42
+ |----------|-------|------------|-------|
43
+ | _Populate from project_ | | | |
44
+
45
+ ---
46
+
47
+ ## Apex Classes
48
+
49
+ <!-- Agent: List every Apex class. Categorize by layer. Format:
50
+ | Class Name | Layer | Object | Description | -->
51
+
52
+ ### Triggers
53
+
54
+ | Trigger Name | Object | Handler Class |
55
+ |-------------|--------|---------------|
56
+ | CaseTrigger | Case | |
57
+
58
+ ### Handlers
59
+
60
+ | Handler Name | Trigger | Service Class |
61
+ |-------------|---------|---------------|
62
+ | CaseService | | |
63
+ | CaseTriggerHandler | | |
64
+
65
+ ### Services
66
+
67
+ | Service Name | Object | Key Methods |
68
+ |-------------|--------|-------------|
69
+ | | | |
70
+
71
+ ### Selectors
72
+
73
+ | Selector Name | Object | Key Queries |
74
+ |--------------|--------|-------------|
75
+ | CaseSelector | | |
76
+
77
+ ### Controllers (LWC / Aura)
78
+
79
+ | Controller Name | Component | Key Methods |
80
+ |----------------|-----------|-------------|
81
+ | CaseController | | |
82
+ | ChangePasswordController | | |
83
+ | CommunitiesLandingController | | |
84
+ | CommunitiesLoginController | | |
85
+ | CommunitiesSelfRegConfirmController | | |
86
+ | CommunitiesSelfRegController | | |
87
+ | ForgotPasswordController | | |
88
+ | LightningForgotPasswordController | | |
89
+ | LightningLoginFormController | | |
90
+ | LightningSelfRegisterController | | |
91
+ | MicrobatchSelfRegController | | |
92
+ | MyProfilePageController | | |
93
+ | SiteLoginController | | |
94
+ | SiteRegisterController | | |
95
+
96
+ ### Batch / Queueable / Schedulable
97
+
98
+ | Class Name | Type | Purpose | Schedule |
99
+ |-----------|------|---------|----------|
100
+ | | | | |
101
+
102
+ ### Utilities / Helpers
103
+
104
+ | Class Name | Purpose |
105
+ |-----------|---------|
106
+ | CaseServiceException | |
107
+
108
+ ### Test Classes
109
+
110
+ | Test Class | Tests For | Coverage |
111
+ |-----------|-----------|----------|
112
+ | CaseControllerTest | | |
113
+ | CaseSelectorTest | | |
114
+ | CaseServiceTest | | |
115
+ | CaseTriggerHandlerTest | | |
116
+ | ChangePasswordControllerTest | | |
117
+ | CommunitiesLandingControllerTest | | |
118
+ | CommunitiesLoginControllerTest | | |
119
+ | CommunitiesSelfRegConfirmControllerTest | | |
120
+ | CommunitiesSelfRegControllerTest | | |
121
+ | ForgotPasswordControllerTest | | |
122
+ | LightningForgotPasswordControllerTest | | |
123
+ | LightningLoginFormControllerTest | | |
124
+ | LightningSelfRegisterControllerTest | | |
125
+ | MicrobatchSelfRegControllerTest | | |
126
+ | MyProfilePageControllerTest | | |
127
+ | SiteLoginControllerTest | | |
128
+ | SiteRegisterControllerTest | | |
129
+
130
+ ---
131
+
132
+ ## LWC Components
133
+
134
+ <!-- Agent: List every LWC in the project. Format:
135
+ | Component Name | Targets | Data Source | Description | -->
136
+
137
+ | Component Name | Targets | Data Source | Description |
138
+ |---------------|---------|-------------|-------------|
139
+ | | | Wire / Imperative / LDS | |
140
+
141
+ ---
142
+
143
+ ## Flows
144
+
145
+ <!-- Agent: List every Flow. Format:
146
+ | Flow Name | Type | Object | Status | Purpose | -->
147
+
148
+ | Flow Name | Type | Object | Status | Purpose |
149
+ |-----------|------|--------|--------|---------|
150
+ | | Before-Save / After-Save / Screen / Scheduled | | Active / Draft | |
151
+
152
+ ---
153
+
154
+ ## Custom Labels
155
+
156
+ <!-- Agent: List Custom Labels used in the project. Format:
157
+ | Label Name | Value | Used In | -->
158
+
159
+ | Label Name | Value | Used In |
160
+ |-----------|-------|---------|
161
+ | | | |
162
+
163
+ ---
164
+
165
+ ## Custom Metadata Types
166
+
167
+ <!-- Agent: List CMDTs and their records. Format:
168
+ | CMDT Name | Key Records | Purpose | -->
169
+
170
+ | CMDT Name | Key Records | Purpose |
171
+ |----------|-------------|---------|
172
+ | | | |
173
+
174
+ ---
175
+
176
+ ## Named Credentials
177
+
178
+ <!-- Agent: List Named Credentials. Format:
179
+ | Name | Endpoint | Auth Type | Used By | -->
180
+
181
+ | Name | Endpoint | Auth Type | Used By |
182
+ |------|----------|-----------|---------|
183
+ | | | | |
184
+
185
+ ---
186
+
187
+ ## Permission Sets
188
+
189
+ | Permission Set Name | Purpose | Assigned To |
190
+ |--------------------|---------|-------------|
191
+ | Dashboard_Fields_Access | | |
192
+
193
+ ---
194
+
195
+ ## Platform Events
196
+
197
+ | Event Name | Purpose | Publishers | Subscribers |
198
+ |-----------|---------|-----------|-------------|
199
+ | | | | |
200
+
201
+ ---
202
+
203
+ ## Last Full Scan
204
+
205
+ <!-- Agent: Update this after running the populate commands above -->
206
+ **Date:** 2026-05-22
207
+ **Agent:** Auto-Scan Script
208
+ **Method:** python3 .ai/scripts/update_state.py scan
209
+
@@ -0,0 +1,124 @@
1
+ # Known Issues
2
+
3
+ > Platform bugs, workarounds, project-specific tech debt, and gotchas.
4
+
5
+ ---
6
+
7
+ ## Platform Known Issues (API v66.0 — Spring '26)
8
+
9
+ ### Breaking Changes
10
+
11
+ | Issue | Impact | Workaround | Reference |
12
+ |-------|--------|------------|-----------|
13
+ | Session IDs no longer supported in outbound messages | Outbound message integrations break if relying on Session ID | Migrate to OAuth-based auth with Named Credentials | [Spring '26 Release Notes] |
14
+ | Flow: Enforces no-argument constructor visibility for invocable action parameters | Flow invocable actions with parameterized constructors may fail | Add no-arg constructor to all DTO/wrapper classes used in invocable actions | [Spring '26 Release Notes] |
15
+ | Record-Triggered Flows respect internal writeable status of non-insertable fields | Before-save flows may behave differently with formula/rollup fields | Review flows that reference non-editable fields | [Spring '26 Release Notes] |
16
+
17
+ ### New Features to Leverage
18
+
19
+ | Feature | Version | Impact |
20
+ |---------|---------|--------|
21
+ | **Apex Cursors** (GA) | v66.0 | Work with large SOQL result sets in chunks without hitting heap limits |
22
+ | **GraphQL Mutations** | v66.0 | Replace simple `@AuraEnabled` CRUD Apex in LWC with declarative GraphQL |
23
+ | **TypeScript for LWC** | v66.0 | `@salesforce/lightning-types` for full autocomplete and type safety |
24
+
25
+ ---
26
+
27
+ ## API Version Maintenance
28
+
29
+ | Status | Versions | Notes |
30
+ |--------|----------|-------|
31
+ | ✅ Active | v55.0 — v66.0 | Fully supported |
32
+ | ⚠️ Deprecated | v31.0 — v54.0 | Still works, will retire |
33
+ | ❌ Retired | v21.0 — v30.0 | Returns `410: GONE` |
34
+
35
+ **Rule:** Always use the latest GA version (v66.0) for new code. Check [Salesforce Trust](https://status.salesforce.com/) for maintenance windows.
36
+
37
+ ---
38
+
39
+ ## Common Gotchas
40
+
41
+ ### 1. Mixed DML
42
+
43
+ Cannot perform DML on setup objects (User, PermissionSet) and non-setup objects (Account, Contact) in the same transaction.
44
+
45
+ ```apex
46
+ // ❌ This fails
47
+ insert new User(...);
48
+ insert new Account(...);
49
+
50
+ // ✅ Fix: Use @future or Queueable for setup DML
51
+ @future
52
+ public static void createUser(String email) { ... }
53
+ ```
54
+
55
+ ### 2. Trigger Recursion
56
+
57
+ Triggers can re-fire when a service method updates related records. Use a static recursion guard.
58
+
59
+ ```apex
60
+ public class TriggerRecursionGuard {
61
+ private static Set<Id> processedIds = new Set<Id>();
62
+
63
+ public static Boolean hasBeenProcessed(Id recordId) {
64
+ return processedIds.contains(recordId);
65
+ }
66
+
67
+ public static void markProcessed(Id recordId) {
68
+ processedIds.add(recordId);
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### 3. UNABLE_TO_LOCK_ROW
74
+
75
+ Concurrent transactions on the same record cause row lock errors. Mitigate with:
76
+ - Process parent records before children
77
+ - Reduce transaction size
78
+ - Add retry logic in Queueable
79
+ - Avoid `FOR UPDATE` unless truly needed
80
+
81
+ ### 4. SOQL 101 in Tests
82
+
83
+ Test methods share governor limits. Large test data + multiple service calls = SOQL limit hit.
84
+ - Use `@TestSetup` to front-load data creation
85
+ - Use `Test.startTest()` / `Test.stopTest()` to reset limits
86
+
87
+ ### 5. Deployment Order Dependencies
88
+
89
+ | Deploy First | Then Deploy |
90
+ |-------------|-------------|
91
+ | Custom Objects / Fields | Apex Classes referencing them |
92
+ | Apex Classes | Triggers referencing handler classes |
93
+ | Permission Sets | Profiles referencing permission sets |
94
+ | Custom Labels | Apex / Flows referencing labels |
95
+
96
+ ---
97
+
98
+ ## Project-Specific Issues
99
+
100
+ <!-- Add issues specific to this project as they're discovered -->
101
+
102
+ | Issue | Severity | Status | Workaround | Owner |
103
+ |-------|----------|--------|------------|-------|
104
+ | <!-- Example: Account trigger recursion with Contact updates --> | 🟡 Medium | Open | Static recursion guard | |
105
+ | <!-- Add rows --> | | | | |
106
+
107
+ ---
108
+
109
+ ## Tech Debt Tracker
110
+
111
+ | Item | Priority | Effort | Description |
112
+ |------|----------|--------|-------------|
113
+ | <!-- Example: Migrate Process Builders to Flows --> | P1 | Medium | 3 active PBs on Account, Contact, Opportunity |
114
+ | <!-- Add rows --> | | | |
115
+
116
+ ---
117
+
118
+ ## Useful Links
119
+
120
+ - [Salesforce Known Issues Portal](https://trailblazer.salesforce.com/issues_index)
121
+ - [Salesforce Trust / Status](https://status.salesforce.com/)
122
+ - [Release Notes (Latest)](https://help.salesforce.com/s/articleView?id=release-notes.salesforce_release_notes.htm)
123
+ - [Apex Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/)
124
+ - [LWC Developer Guide](https://developer.salesforce.com/docs/platform/lwc/guide)
@@ -0,0 +1,110 @@
1
+ # Org Context
2
+
3
+ > Static reference for the target Salesforce org. Update when org changes or packages are installed.
4
+
5
+ ---
6
+
7
+ ## Org Details
8
+
9
+ | Property | Value |
10
+ |----------|-------|
11
+ | **Org Alias** | `<insert_org_alias>` |
12
+ | **Username** | `<insert_username>` |
13
+ | **Edition** | `<insert_edition>` |
14
+ | **API Version** | v66.0 |
15
+ | **Instance** | `<insert_instance>` |
16
+ | **Org ID** | `<insert_org_id>` |
17
+ | **My Domain** | `<insert_my_domain>` |
18
+
19
+ ---
20
+
21
+ ## CLI Configuration
22
+
23
+ | Property | Value |
24
+ |----------|-------|
25
+ | **CLI** | `@salesforce/cli` v2.x |
26
+ | **Command prefix** | `sf` (NOT `sfdx`) |
27
+ | **Default target org** | `--target-org <insert_org_alias>` |
28
+ | **JSON output** | Add `--json` when parsing programmatically |
29
+
30
+ ### Common Commands
31
+
32
+ ```bash
33
+ # Deploy
34
+ sf project deploy start --target-org <insert_org_alias> --source-dir force-app
35
+
36
+ # Retrieve
37
+ sf project retrieve start --target-org <insert_org_alias> --metadata "ApexClass:AccountService"
38
+
39
+ # SOQL Query
40
+ sf data query --query "SELECT Id, Name FROM Account LIMIT 10" --target-org <insert_org_alias>
41
+
42
+ # Tooling API Query
43
+ sf data query --query "SELECT Id, Name FROM ApexClass" --target-org <insert_org_alias> --use-tooling-api
44
+
45
+ # Run Tests
46
+ sf apex run test --target-org <insert_org_alias> --code-coverage --result-format human
47
+
48
+ # Open Org
49
+ sf org open --target-org <insert_org_alias>
50
+
51
+ # View Limits
52
+ sf limits api display --target-org <insert_org_alias>
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Governor Limits (<insert_edition>)
58
+
59
+ | Limit | Value | Notes |
60
+ |-------|-------|-------|
61
+ | Daily API Requests | 15,000 | Monitor — adjust for your edition |
62
+ | Data Storage | 5 MB | Update with actual storage limit |
63
+ | File Storage | 20 MB | |
64
+ | SOQL Queries / Txn | 100 | |
65
+ | SOQL Rows / Txn | 50,000 | |
66
+ | DML Statements / Txn | 150 | |
67
+ | DML Rows / Txn | 10,000 | |
68
+ | CPU Time (Sync) | 10,000 ms | |
69
+ | CPU Time (Async) | 60,000 ms | |
70
+ | Heap (Sync) | 6 MB | |
71
+ | Heap (Async) | 12 MB | |
72
+ | Callouts / Txn | 100 | |
73
+ | Callout Timeout (each) | 10 sec | |
74
+ | Callout Timeout (total) | 120 sec | |
75
+ | Future Calls / Txn | 50 | Prefer Queueable |
76
+ | Queueable Jobs / Txn | 50 | |
77
+
78
+ ---
79
+
80
+ ## Installed Packages
81
+
82
+ | Package Name | Namespace | Version | Purpose |
83
+ |-------------|-----------|---------|---------|
84
+ | <!-- Add rows --> | | | |
85
+
86
+ ---
87
+
88
+ ## Enabled Features
89
+
90
+ <!-- Check features enabled in this org -->
91
+
92
+ - [ ] Einstein AI (Copilot / Agentforce)
93
+ - [ ] Platform Events
94
+ - [ ] Change Data Capture
95
+ - [ ] Shield (Event Monitoring / Platform Encryption)
96
+ - [ ] Experience Cloud (Communities)
97
+ - [ ] Omni-Channel
98
+ - [ ] Knowledge
99
+ - [ ] Field Service
100
+ - [ ] CPQ
101
+ - [ ] Other: ___
102
+
103
+ ---
104
+
105
+ ## Connected Orgs / Sandboxes
106
+
107
+ | Org/Sandbox | Type | Username | Purpose |
108
+ |------------|------|----------|---------|
109
+ | <insert_org_alias> (Dev) | <insert_edition> | <insert_username> | Primary dev |
110
+ | <!-- Add rows --> | Full / Partial / Dev Pro | | |