114 lines
4.2 KiB
Markdown
114 lines
4.2 KiB
Markdown
# Copilot Instructions for AgentForceTest
|
|
|
|
## Project Overview
|
|
|
|
This is a **Salesforce DX project** (Agentforce) integrating Jira for project management. The codebase contains:
|
|
|
|
- **Apex classes** for backend logic (e.g., JiraIntegration.cls)
|
|
- **Lightning Web Components (LWC)** for UI (e.g., accountQuickCreate)
|
|
- **Custom Salesforce objects** (Project\_\_c with Budget, Start Date fields)
|
|
- **SFDX tooling** for deployment and testing
|
|
|
|
## Architecture & Key Components
|
|
|
|
### Project Structure
|
|
|
|
- `force-app/main/default/` - Core SFDX package directory
|
|
- `classes/` - Apex backend logic
|
|
- `lwc/` - Lightning Web Components (LWC)
|
|
- `objects/` - Custom Salesforce objects with metadata
|
|
- `tabs/`, `layouts/`, `flexipages/` - UI configuration
|
|
- `scripts/` - SOQL queries and Apex scripts for development
|
|
- `config/project-scratch-def.json` - Scratch org configuration
|
|
- `mdapiOut/` - Metadata API deployment artifacts
|
|
|
|
### Data Integration
|
|
|
|
- **JiraIntegration.cls** bridges Salesforce with Jira via REST API
|
|
- **Project\_\_c custom object** stores Salesforce-side project data (Budget, Start Date)
|
|
- Integration pattern: Account Quick Create → Project creation → Jira sync
|
|
|
|
## Development Workflows
|
|
|
|
### Code Quality & Linting
|
|
|
|
```bash
|
|
npm run lint # Run ESLint on Aura/LWC JS files
|
|
eslint force-app/main/default/lwc/**/*.js --fix # Auto-fix with flat config
|
|
npm run prettier # Format all supported file types
|
|
npm run prettier:verify # Check formatting without changes
|
|
```
|
|
|
|
### Testing
|
|
|
|
```bash
|
|
npm run test # Run all LWC unit tests
|
|
npm run test:unit:watch # Watch mode for TDD
|
|
npm run test:unit:debug # Debug mode
|
|
npm run test:unit:coverage # Coverage report
|
|
```
|
|
|
|
**Key detail:** Jest config uses `sfdx-lwc-jest` with mock modules. Test files use `.test.js` suffix.
|
|
|
|
### Pre-commit Hooks
|
|
|
|
Configured via `lint-staged` and Husky:
|
|
|
|
- Automatically runs Prettier on staged files
|
|
- Runs ESLint on LWC/Aura JS
|
|
- Runs Jest tests on LWC components before commit
|
|
|
|
## Code Conventions
|
|
|
|
### Apex Classes
|
|
|
|
- Use `public with sharing` for security
|
|
- Document public methods with JSDoc-style comments
|
|
- Follow: `public String processAccount(String accountId)` pattern
|
|
- Placeholder implementations include return statements with descriptive messages
|
|
|
|
### LWC Components
|
|
|
|
- Import from `'lwc'` core: `LightningElement`, `track`, `wire`, etc.
|
|
- Use `@track` for reactive properties
|
|
- Show toasts via `ShowToastEvent` for user feedback
|
|
- Validation: Last Name required (per standard contact requirements), email optional
|
|
- Component files: `<name>.js` (logic), `<name>.html` (template), `<name>.js-meta.xml` (metadata)
|
|
|
|
### Metadata XML Files
|
|
|
|
- Custom objects stored as `.object-meta.xml` with field definitions
|
|
- Tab definitions in `tabs/<ObjectName>.tab-meta.xml`
|
|
- All metadata follows Salesforce v65.0 API schema
|
|
- **Important:** Remove compactLayoutAssignment to avoid deployment errors
|
|
|
|
## External Integrations
|
|
|
|
### Jira REST API
|
|
|
|
- **Endpoint:** `https://shaikmosina.atlassian.net/rest/api/2/`
|
|
- **Auth:** Basic auth (email:API_token Base64 encoded)
|
|
- **Usage:** JiraIntegration.cls handles transitions, issue updates
|
|
- **Common operations:** Transition status (e.g., move to "To Do" via transition ID 11)
|
|
|
|
### Salesforce CLI (SFDX)
|
|
|
|
- Project uses `sfdx-project.json` (v65.0 API)
|
|
- Namespace: empty (unmanaged package)
|
|
- Default package path: `force-app/`
|
|
|
|
## Important Patterns & Gotchas
|
|
|
|
1. **ESLint Config:** Uses modern flat config (`eslint/config`), not legacy `.eslintrc.json`
|
|
2. **Test Isolation:** LWC test rules differ from regular LWC rules (wire adapter warnings disabled)
|
|
3. **Aura + LWC:** Both supported; Aura uses its own ESLint config via `@salesforce/eslint-plugin-aura`
|
|
4. **Metadata Deployment:** Verify all XML files are valid; bad metadata blocks SFDX deployments
|
|
5. **Git Hooks:** Husky requires `npm install`; run `npm run prepare` if hooks don't trigger
|
|
|
|
## Quick References
|
|
|
|
- **Salesforce Docs:** https://developer.salesforce.com/tools/vscode/
|
|
- **Salesforce CLI:** https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
|
|
- **LWC Best Practices:** Review `accountQuickCreate.js` for input handling and validation patterns
|
|
- **API Version:** 65.0 (see sfdx-project.json)
|