A full-featured CRM built with React, shadcn/ui, and Supabase.
Feat: add claude LSP for TypeScript
Jonathan ARNAULT88c5824e97f8
diff --git a/.claude/agents/developer.md b/.claude/agents/developer.mdindex 87ff930b..c09fad24 100644--- a/.claude/agents/developer.md+++ b/.claude/agents/developer.md@@ -21,6 +21,7 @@ tools:- mcp__playwright__browser_take_screenshot- mcp__playwright__browser_console_messages- mcp__playwright__browser_close+ - LSP---# DEVELOPER — Implementation Agent@@ -207,6 +208,8 @@ From `files_to_modify`, build a reuse registry:**Exploration depth — stay scope-bound**: read the files listed in `files_to_modify` plus their direct imports if a specific pattern is unclear. Do not expand to the full dependency graph by default. If you hit an unknown pattern that blocks you, read one additional file to resolve it — then stop. Grep broadly only if `files_to_modify` is missing or clearly incomplete.+**Use the `LSP` tool for semantic navigation — do not `grep` for symbols.** To find where a TypeScript identifier (type, component, hook, function, exported const) is defined or used in `.ts/.tsx/.js/.jsx`, call `LSP`: `goToDefinition`, `findReferences` (size the blast radius before changing a signature), `hover` (confirm a type), `workspaceSymbol` (locate a symbol), `incomingCalls` (who calls it). Never `grep -rn "<Symbol>" src/` in Bash for this — it misses re-exports and aliased imports and can't tell a definition from a comment. Reserve `grep`/`rg` for text and domain-word sweeps (e.g. deleting all mentions of a resource), database column/view names, and non-TS files (`.sql`, `.md`, `.json`, `.css`). See `.claude/rules/lsp-usage.md`.+## Plan format```diff --git a/.claude/agents/planner.md b/.claude/agents/planner.mdindex 29e283e0..1fe2f765 100644--- a/.claude/agents/planner.md+++ b/.claude/agents/planner.md@@ -10,6 +10,7 @@ tools:- Glob- Read- Bash+ - LSP---# PLANNER — Product Task Planner@@ -20,7 +21,7 @@ Translate a natural-language product description into a structured, ordered listYou think like a product manager who understands software delivery. You do NOT make technical decisions (frameworks, algorithms, abstractions — DEVELOPER's job).-You DO a light codebase discovery to identify probable files DEVELOPER will touch — saves search time downstream. Use Grep / Glob only, no deep reading.+You DO a light codebase discovery to identify probable files DEVELOPER will touch — saves search time downstream. Use Grep / Glob, or the `LSP` tool's `workspaceSymbol` to locate a named symbol's file faster than grepping (see `.claude/rules/lsp-usage.md`). Light discovery only — no deep reading.---diff --git a/.claude/agents/quality-reviewer.md b/.claude/agents/quality-reviewer.mdindex e6ab8303..b1c06e8a 100644--- a/.claude/agents/quality-reviewer.md+++ b/.claude/agents/quality-reviewer.md@@ -19,6 +19,7 @@ tools:- mcp__playwright__browser_take_screenshot- mcp__playwright__browser_console_messages- mcp__playwright__browser_close+ - LSP---# QUALITY-REVIEWER — Code Quality & Security Review@@ -112,7 +113,7 @@ Read the ticket spec at `TICKET_FILE`, read the diff in `WORKTREE_PATH`. Apply ygit -C <WORKTREE_PATH> diff "session-base/$SHORT"..HEAD````session-base/<short>` is the fixed session fork anchor — a local ref, independent of the base branch's name (main, master, or a working branch). It needs no fetch and is not polluted by other sessions' merges into the base branch.-2. **Apply the rubric** below (Parts A and B). Also apply `coding-style.md` and `security-triggers.md` rules.+2. **Apply the rubric** below (Parts A and B). Also apply `coding-style.md` and `security-triggers.md` rules. Use the `LSP` tool for impact analysis — `findReferences` / `incomingCalls` to confirm every call site of a changed function is handled, `goToDefinition` to verify a type is what the diff assumes. See `.claude/rules/lsp-usage.md` (it is read-only intelligence, not a forbidden validation command).3. **Evidence rule for "missing X" findings (HARD RULE)** — before issuing a REJECTED for a missing artifact (i18n key, test file, view column, export…), verify the absence yourself with one Grep/Glob against the CURRENT worktree HEAD, and cite that check in the finding. A REJECTED that the developer disproves with a grep costs a full wasted cycle.4. **Emit verdict** as the final line of output using the OUTPUT CONTRACT format above.diff --git a/.claude/rules/lsp-usage.md b/.claude/rules/lsp-usage.mdnew file mode 100644index 00000000..840d8efc--- /dev/null+++ b/.claude/rules/lsp-usage.md@@ -0,0 +1,82 @@+# LSP — use semantic code intelligence when possible++Applies to: developer, quality-reviewer, planner.++This repo has an `LSP` tool backed by a TypeScript language server (configured in+`.claude/settings.json`, covering `.ts`, `.tsx`, `.mjs`, `.js`, and `.jsx`). Use it+for any **semantic** question about TypeScript/JavaScript code. It resolves symbols+through the type system, so it is exact where text search only guesses.++## The reflex to break: `grep`/`rg` in Bash to find a symbol++In practice the `Grep` tool is rarely used — code search here happens through+`grep`/`rg` **inside `Bash`** (`grep -rn "DealStage" src/`). That reflex is the+thing to stop for symbol questions. `grep` matches strings: it can't tell a+definition from a comment, a type from a same-named variable, or one `handleSubmit`+from another, and it silently misses re-exports and aliased imports. The `LSP` tool+resolves the actual symbol.++**Hard rule:** to find where a TypeScript identifier (a PascalCase type/component,+a camelCase function/hook, an exported const) is **defined** or **used** in+`.ts/.tsx/.js/.jsx`, call `LSP` — never `grep -rn "<Symbol>" src/` in Bash and never+the `Grep` tool. Reach for LSP first whenever the question is "where / what / who",+not "which files contain this string".++| Instead of this bash-grep… | …use this LSP call |+|---|---|+| `grep -rn "DealStage" src/` (every use of a type) | `findReferences` (impact/blast radius) |+| `grep -rn "mergeContacts" src/` (where defined) | `goToDefinition` |+| `grep -rn "LatestNotes\|useContactImport" src/` (locate a symbol) | `workspaceSymbol` |+| `grep -n "export" file.tsx` (what a file exports) | `documentSymbol` |+| `grep -rn "buildActivityLog" src/` (who calls it) | `incomingCalls` |++| Operation | Use it to |+|---|---|+| `goToDefinition` | jump to where a symbol is declared (type, function, component, prop) |+| `findReferences` | find every real use of a symbol before changing or renaming it — impact analysis |+| `hover` | get a symbol's resolved type / signature / JSDoc without opening its file |+| `documentSymbol` | outline a file's exports/functions/components before reading it whole |+| `workspaceSymbol` | locate a symbol by name across the repo (`query` required) — faster than grepping for a file path |+| `goToImplementation` | find concrete implementations of an interface or abstract member |+| `prepareCallHierarchy` | get the call-hierarchy anchor at a position (precedes incoming/outgoing calls) |+| `incomingCalls` / `outgoingCalls` | trace the call graph into / out of a function |++Positions are **1-based** (`line`, `character`), exactly as shown in `Read` output+and editors.++## Per-agent fit++- **developer** — before editing a symbol's signature,+ `findReferences` to size the blast radius; `hover` to confirm a type;+ `goToDefinition` to reach the source. Do not `grep -rn "<Symbol>" src/` in Bash+ to answer these — that is the exact reflex this rule replaces.+- **quality-reviewer** — `findReferences` / `incomingCalls` to check that every+ call site of a changed function is handled; `goToDefinition` to confirm a type+ is what the diff assumes; `findReferences` / `workspaceSymbol` to confirm a new+ component or resource is actually wired into the app (imported, registered),+ not merely created.+- **planner** — `workspaceSymbol` to locate probable `files_to_modify` faster than+ grep. Still light discovery — no deep reading.++## When `grep`/`rg` IS the right tool++LSP is for TS/JS symbols. Keep using `grep`/`rg` (in Bash) — and do not try LSP — for:++- **Non-TS/JS files**: `.sql`, `.md`, `.json`, `.css` — no server covers them.+- **Text / domain-word sweeps** that deliberately include strings, comments, and+ non-code: e.g. deleting a resource with `grep -rniE "\bdeals?\b|deal_notes?"`,+ which must catch SQL, fixtures, and labels — not just the TS symbol.+- **Database identifiers** (column / view names like `company_id`,+ `contacts_summary`) that live in SQL and string literals, not as TS symbols.+- Plain "which files mention 'boulangerie'" lookups.++LSP is **read-only code intelligence, not a validation command** — it does not run+`tsc`, so it is exempt from `validation-commands.md` and you may use it freely. It+does not replace the hook-run typecheck.++## Worktree note++Pass **absolute paths inside your own worktree** (`<WORKTREE_PATH>/src/...`), per+`worktree-scope.md` — never the base-branch checkout under `$CLAUDE_PROJECT_DIR`.+Fall back to `grep` / `Read` only when LSP returns an actual error or empty result+for a worktree file — not as the default. Do not block on it.diff --git a/.claude/settings.json b/.claude/settings.jsonindex 182c27fa..8ababe53 100644--- a/.claude/settings.json+++ b/.claude/settings.json@@ -5,7 +5,7 @@"playwright@claude-plugins-official": false,"security-guidance@claude-plugins-official": false,"supabase@claude-plugins-official": false,- "typescript-lsp@claude-plugins-official": false,+ "typescript-lsp@claude-plugins-official": true,"code-review@claude-plugins-official": false,"commit-commands@claude-plugins-official": false,"frontend-design@claude-plugins-official": false,@@ -14,6 +14,9 @@"ralph-loop@claude-plugins-official": false},"skillListingMaxDescChars": 512,+ "env": {+ "ENABLE_LSP_TOOL": "1"+ },"permissions": {"allow": []},@@ -130,5 +133,12 @@]}]+ },+ "lspServers": {+ "typescript": {+ "command": "typescript-language-server",+ "args": ["--stdio"],+ "fileTypes": [".ts", ".tsx", ".mjs", ".js", ".jsx"]+ }}}diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.shindex cf7fefbb..b32a062d 100755--- a/.devcontainer/post-create.sh+++ b/.devcontainer/post-create.sh@@ -1,3 +1,7 @@#!/usr/bin/env bash-sudo npm install -g supabase+claude plugin marketplace add anthropics/claude-plugins-official+claude plugin marketplace update claude-plugins-official+claude plugin install typescript-lsp++sudo npm install -g supabase typescript-language-serverdiff --git a/CLAUDE.md b/CLAUDE.mdindex c34d1b00..3573e75d 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -29,4 +29,4 @@ The **developer** is a single agent with no modes: it implements the ticket in `## Rules & hooks-Mechanics live in `.claude/rules/` (worktree-scope, agent-output-format, validation-commands, security-triggers). Hooks in `.claude/settings.json` / `.claude/hooks/` are `.mjs` ES modules.+Mechanics live in `.claude/rules/` (worktree-scope, agent-output-format, validation-commands, lsp-usage, security-triggers). Hooks in `.claude/settings.json` / `.claude/hooks/` are `.mjs` ES modules.diff --git a/makefile b/makefileindex f18ae9b1..ba7537cf 100644--- a/makefile+++ b/makefile@@ -19,6 +19,13 @@ install: package.json ## install dependenciesinstall-playwright-browsers: install ## install the playwright browsers (chromium, firefox, webkit)npx playwright install chromium+install-claude-plugins:+ claude plugin marketplace update claude-plugins-official+ claude plugin install typescript-lsp@claude-plugins-official++install-lsp:+ npm install -g typescript-language-server+start-supabase: ## start supabase locallynpx supabase start