This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Run all unit tests
npm test
# Run tests in watch mode
npm run test:unit:watch
# Run a single test file
npx sfdx-lwc-jest -- --testPathPattern="notebookAiChat"
# Lint LWC/Aura JS
npm run lint
# Format all files
npm run prettier
# Check formatting without writing
npm run prettier:verifySalesforce CLI (sf) commands for deploying/running:
# Deploy source to a scratch org
sf project deploy start --source-dir force-app
# Open the default org
sf org open
# Run Apex tests in org
sf apex run test --class-names NSFNotebookControllerTestNotebookSF is a Salesforce app that provides a notebook/study-tool experience inside a Salesforce org. Everything lives under force-app/main/default/.
The hierarchy is: Group → Project → Notebook → (Sections, Notes, Cards, Resources, Exams)
NSF_Group__c— top-level grouping bucketNSF_Project__c— belongs to a GroupNSF_Notebook__c— belongs to a ProjectNSF_Section__c,NSF_Note__c,NSF_Card__c,NSF_Resource__c,NSF_Exam__c— all belong to a NotebookNSF_Star_Listing__c— favorites/starred itemsNSF_Resource_Card__c,NSF_Resource_Exam__c— junction objects
Each controller (NSFGroupController, NSFProjectController, NSFNotebookController, etc.) is a single with sharing class exposing @AuraEnabled methods for CRUD. All DML uses as user (user-mode) to respect field/object permissions. Every controller has a matching *Test class.
NSFChatController.sendMessage() is a stub — the RAG pipeline (context retrieval + LLM call) is not yet implemented.
Two top-level page components:
notebookHome— the main landing page. Left sidebar lists Groups; main panel shows Projects (accordion) and Notebooks (lazy-loaded on expand). Uses@wirefor Groups and Projects (reactive on$selectedGroupId), and imperativegetNotebooksByProjectcalls on project expand.notebookNotebookView— the notebook detail page. Readsc__notebookId/c__notebookNamefrom page state viaCurrentPageReference. Contains alightning-tabsetthat lazy-renders tab content (Resources, Notes, Cards, Exams, AI Chat).
Shared utility component:
lwcModal— reusable modal. Callmodal.open()/modal.close()imperatively. Fires abuttonclickCustomEvent withdetail = 'confirm' | 'cancel'. Supportsvalidate-on-confirmwhich callsreportValidity()on all slotted Lightning input components before dispatching confirm.
Navigation between pages uses NavigationMixin with standard__navItemPage (API name NSF_Notebook_View) and page state params (c__notebookId, c__notebookName).
Tests live in __tests__/ inside each LWC folder. The jest config extends @salesforce/sfdx-lwc-jest. Apex imports are auto-mocked via moduleNameMapper in jest config — see the mock patterns in jest.config.js.
ESLint uses flat config (eslint.config.js). LWC files use @salesforce/eslint-config-lwc/recommended; test files disable no-unexpected-wire-adapter-usages.
A pre-commit hook (lint-staged) runs Prettier, ESLint, and related Jest tests on staged files automatically.