litclaude-ai 0.3.1 → 0.3.6

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 (56) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/README.md +5 -5
  3. package/README_ko-KR.md +5 -5
  4. package/RELEASE_CHECKLIST.md +8 -6
  5. package/cover.png +0 -0
  6. package/generate_cover.py +1 -1
  7. package/package.json +1 -1
  8. package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
  9. package/plugins/litclaude/bin/litclaude-hook.js +34 -4
  10. package/plugins/litclaude/commands/dynamic-workflow.md +6 -6
  11. package/plugins/litclaude/commands/review-work.md +5 -5
  12. package/plugins/litclaude/hooks/hooks.json +12 -0
  13. package/plugins/litclaude/lib/litgoal/autoloop.mjs +78 -0
  14. package/plugins/litclaude/lib/litgoal/cli.mjs +8 -0
  15. package/plugins/litclaude/skills/git-master/SKILL.md +130 -0
  16. package/plugins/litclaude/skills/init-deep/SKILL.md +196 -0
  17. package/plugins/litclaude/skills/lit-loop/SKILL.md +12 -10
  18. package/plugins/litclaude/skills/lit-plan/SKILL.md +9 -10
  19. package/plugins/litclaude/skills/litgoal/SKILL.md +41 -5
  20. package/plugins/litclaude/skills/lsp-setup/SKILL.md +151 -0
  21. package/plugins/litclaude/skills/lsp-setup/references/bash/README.md +63 -0
  22. package/plugins/litclaude/skills/lsp-setup/references/c-cpp/README.md +72 -0
  23. package/plugins/litclaude/skills/lsp-setup/references/csharp/README.md +81 -0
  24. package/plugins/litclaude/skills/lsp-setup/references/dart/README.md +53 -0
  25. package/plugins/litclaude/skills/lsp-setup/references/elixir/README.md +57 -0
  26. package/plugins/litclaude/skills/lsp-setup/references/go/README.md +59 -0
  27. package/plugins/litclaude/skills/lsp-setup/references/haskell/README.md +64 -0
  28. package/plugins/litclaude/skills/lsp-setup/references/java/README.md +66 -0
  29. package/plugins/litclaude/skills/lsp-setup/references/julia/README.md +62 -0
  30. package/plugins/litclaude/skills/lsp-setup/references/kotlin/README.md +68 -0
  31. package/plugins/litclaude/skills/lsp-setup/references/lua/README.md +64 -0
  32. package/plugins/litclaude/skills/lsp-setup/references/php/README.md +56 -0
  33. package/plugins/litclaude/skills/lsp-setup/references/python/README.md +68 -0
  34. package/plugins/litclaude/skills/lsp-setup/references/ruby/README.md +62 -0
  35. package/plugins/litclaude/skills/lsp-setup/references/rust/README.md +61 -0
  36. package/plugins/litclaude/skills/lsp-setup/references/swift/README.md +60 -0
  37. package/plugins/litclaude/skills/lsp-setup/references/terraform/README.md +61 -0
  38. package/plugins/litclaude/skills/lsp-setup/references/typescript/README.md +77 -0
  39. package/plugins/litclaude/skills/lsp-setup/references/yaml/README.md +60 -0
  40. package/plugins/litclaude/skills/lsp-setup/references/zig/README.md +55 -0
  41. package/plugins/litclaude/skills/lsp-setup/scripts/detect-lsp.ts +220 -0
  42. package/plugins/litclaude/skills/lsp-setup/scripts/lsp-server-table.ts +146 -0
  43. package/plugins/litclaude/skills/lsp-setup/scripts/tsconfig.json +18 -0
  44. package/plugins/litclaude/skills/lsp-setup/scripts/verify-lsp.ts +242 -0
  45. package/plugins/litclaude/skills/start-work/SKILL.md +12 -13
  46. package/plugins/litclaude/skills/visual-qa/SKILL.md +259 -0
  47. package/plugins/litclaude/skills/visual-qa/scripts/ansi.ts +17 -0
  48. package/plugins/litclaude/skills/visual-qa/scripts/cli.ts +96 -0
  49. package/plugins/litclaude/skills/visual-qa/scripts/east-asian-width.ts +72 -0
  50. package/plugins/litclaude/skills/visual-qa/scripts/image-diff.ts +109 -0
  51. package/plugins/litclaude/skills/visual-qa/scripts/png-crc.ts +27 -0
  52. package/plugins/litclaude/skills/visual-qa/scripts/png-decode.ts +206 -0
  53. package/plugins/litclaude/skills/visual-qa/scripts/png-synth.ts +57 -0
  54. package/plugins/litclaude/skills/visual-qa/scripts/tui-grid.ts +88 -0
  55. package/plugins/litclaude/skills/visual-qa/scripts/types.ts +54 -0
  56. package/scripts/qa-portable-install.sh +1 -1
@@ -0,0 +1,196 @@
1
+ ---
2
+ name: init-deep
3
+ description: "Initialize a hierarchical AGENTS.md knowledge base for a repository — a root AGENTS.md plus complexity-scored subdirectory files. Use when the user wants to bootstrap or refresh project knowledge for Claude Code, onboard a codebase, generate AGENTS.md/CLAUDE.md guidance, or map an unfamiliar repo. Adapted for the Claude Code host: discovery via background explore subagents + the LSP tool, parallel generation via Dynamic workflow."
4
+ ---
5
+
6
+ # Init-Deep — hierarchical AGENTS.md generator (Claude Code)
7
+
8
+ Generate hierarchical `AGENTS.md` files: a root knowledge base plus complexity-scored subdirectory
9
+ files. This is the LitClaude onboarding/knowledge-base skill, re-authored for Claude Code surfaces
10
+ (`Agent`/`Task` subagents, the `LSP` tool, `Workflow` for parallel generation, `TodoWrite`).
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ init-deep # Update mode: modify existing AGENTS.md + create new where warranted
16
+ init-deep --create-new # Read existing → remove all → regenerate from scratch
17
+ init-deep --max-depth=2 # Limit directory depth (default: 3)
18
+ ```
19
+
20
+ ## Workflow (high level)
21
+
22
+ 1. **Discovery + analysis** (concurrent) — background explore subagents + local bash structure + LSP
23
+ codemap + read existing AGENTS.md.
24
+ 2. **Score & decide** — determine AGENTS.md locations from merged findings.
25
+ 3. **Generate** — root first, then subdirectories in parallel.
26
+ 4. **Review** — deduplicate, trim, validate.
27
+
28
+ Track all four phases with `TodoWrite` and flip each `pending → in_progress → completed` in real time.
29
+
30
+ ## Phase 1 — Discovery + analysis (concurrent)
31
+
32
+ Mark "discovery" in_progress.
33
+
34
+ ### Fire background explore subagents immediately
35
+
36
+ Spawn read-only explore subagents with the `Agent` tool (`subagent_type: "explore"`,
37
+ `run_in_background: true`) so they run while the main session works. Claude notifies you when each
38
+ finishes; collect their final messages before scoring. Launch independent agents in one message so
39
+ they run concurrently. Suggested lanes (one agent each):
40
+
41
+ - **Structure** — predict standard patterns for the detected language; report deviations only.
42
+ - **Entry points** — find main/entry files; report non-standard organization.
43
+ - **Conventions** — find config files (`.eslintrc`, `pyproject.toml`, `.editorconfig`, …); report
44
+ project-specific rules.
45
+ - **Anti-patterns** — find `DO NOT` / `NEVER` / `ALWAYS` / `DEPRECATED` markers; list forbidden patterns.
46
+ - **Build/CI** — find `.github/workflows`, `Makefile`, `Taskfile`; report non-standard patterns.
47
+ - **Tests** — find test configs and structure; report unique conventions.
48
+
49
+ **Dynamic subagent scaling** — after the bash pass below, spawn ADDITIONAL explore agents based on
50
+ project scale (never a static count):
51
+
52
+ | Factor | Threshold | Additional agents |
53
+ |--------|-----------|-------------------|
54
+ | Total files | >100 | +1 per 100 files |
55
+ | Total lines | >10k | +1 per 10k lines |
56
+ | Directory depth | ≥4 | +2 for deep exploration |
57
+ | Large files (>500 lines) | >10 files | +1 for complexity hotspots |
58
+ | Monorepo | detected | +1 per package/workspace |
59
+ | Multiple languages | >1 | +1 per language |
60
+
61
+ ```bash
62
+ total_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)
63
+ total_lines=$(find . -type f \( -name "*.ts" -o -name "*.py" -o -name "*.go" \) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')
64
+ large_files=$(find . -type f \( -name "*.ts" -o -name "*.py" \) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {c++} END {print c+0}')
65
+ max_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)
66
+ ```
67
+
68
+ For very broad repos, run the discovery fan-out as a Dynamic workflow (call the `Workflow` tool when
69
+ Claude Code exposes it) instead of many manual `Agent` calls.
70
+
71
+ ### Main session: concurrent local analysis
72
+
73
+ While background agents run, the main session does:
74
+
75
+ **1. Bash structural analysis**
76
+ ```bash
77
+ # Directory depth distribution
78
+ find . -type d -not -path '*/.*' -not -path '*/node_modules/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c
79
+ # Files per directory (top 30)
80
+ find . -type f -not -path '*/.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30
81
+ # Existing knowledge bases
82
+ find . -type f \( -name "AGENTS.md" -o -name "CLAUDE.md" \) -not -path '*/node_modules/*' 2>/dev/null
83
+ ```
84
+
85
+ **2. Read existing AGENTS.md** — for each file found, `Read` it and extract key insights,
86
+ conventions, and anti-patterns into an EXISTING map. With `--create-new`, read ALL existing files
87
+ first (preserve context), THEN delete, THEN regenerate.
88
+
89
+ **3. LSP codemap (if available)** — use the Claude `LSP` tool: list configured servers, then request
90
+ document symbols for entry points and workspace symbols for `class` / `interface` / `function`, and
91
+ references for the top exports to gauge centrality. If no server is configured, fall back to the
92
+ explore subagents + plain search.
93
+
94
+ Merge bash + LSP + existing + explore findings. Mark "discovery" completed.
95
+
96
+ ## Phase 2 — Scoring & location decision
97
+
98
+ Mark "scoring" in_progress.
99
+
100
+ ### Scoring matrix
101
+
102
+ | Factor | Weight | High threshold | Source |
103
+ |--------|--------|----------------|--------|
104
+ | File count | 3× | >20 | bash |
105
+ | Subdir count | 2× | >5 | bash |
106
+ | Code ratio | 2× | >70% | bash |
107
+ | Unique patterns | 1× | has own config | explore |
108
+ | Module boundary | 2× | has `index.ts`/`__init__.py` | bash |
109
+ | Symbol density | 2× | >30 symbols | LSP |
110
+ | Export count | 2× | >10 exports | LSP |
111
+ | Reference centrality | 3× | >20 refs | LSP |
112
+
113
+ ### Decision rules
114
+
115
+ | Score | Action |
116
+ |-------|--------|
117
+ | Root (`.`) | ALWAYS create |
118
+ | >15 | Create AGENTS.md |
119
+ | 8–15 | Create if it is a distinct domain |
120
+ | <8 | Skip (parent covers it) |
121
+
122
+ Mark "scoring" completed.
123
+
124
+ ## Phase 3 — Generate AGENTS.md
125
+
126
+ Mark "generate" in_progress.
127
+
128
+ **File-writing rule:** if `AGENTS.md` already exists at the target path, use `Edit`; if not, use
129
+ `Write`. NEVER `Write` over an existing file — check existence first (via the discovery results or a
130
+ `Read`).
131
+
132
+ ### Root AGENTS.md (full treatment)
133
+
134
+ ```markdown
135
+ # PROJECT KNOWLEDGE BASE
136
+ **Generated:** {TIMESTAMP} **Commit:** {SHORT_SHA} **Branch:** {BRANCH}
137
+
138
+ ## OVERVIEW
139
+ {1–2 sentences: what + core stack}
140
+
141
+ ## STRUCTURE
142
+ {tree with non-obvious purposes only}
143
+
144
+ ## WHERE TO LOOK
145
+ | Task | Location | Notes |
146
+
147
+ ## CODE MAP
148
+ {from LSP — skip if unavailable or project <10 files}
149
+
150
+ ## CONVENTIONS
151
+ {ONLY deviations from standard}
152
+
153
+ ## ANTI-PATTERNS (THIS PROJECT)
154
+ {explicitly forbidden here}
155
+
156
+ ## COMMANDS
157
+ {dev / test / build}
158
+
159
+ ## NOTES
160
+ {gotchas}
161
+ ```
162
+
163
+ Quality gate: 50–150 lines, no generic advice, no obvious info.
164
+
165
+ ### Subdirectory AGENTS.md (parallel)
166
+
167
+ Generate each non-root location in parallel — spawn one writing subagent per location with the `Agent`
168
+ tool, or run them as a Dynamic workflow. Each child gets a `TASK:` line plus `DELIVERABLE` (the
169
+ AGENTS.md), `SCOPE` (this directory only), and `VERIFY` (30–80 lines, never repeats parent content;
170
+ sections: OVERVIEW 1 line, STRUCTURE if >5 subdirs, WHERE TO LOOK, CONVENTIONS if different,
171
+ ANTI-PATTERNS). Wait for all. Mark "generate" completed.
172
+
173
+ ## Phase 4 — Review & deduplicate
174
+
175
+ Mark "review" in_progress. For each generated file: remove generic advice, remove parent duplicates,
176
+ trim to the size limits, verify telegraphic style. Mark "review" completed.
177
+
178
+ ## Final report
179
+
180
+ ```
181
+ === init-deep complete ===
182
+ Mode: {update | create-new}
183
+ Files: [OK] ./AGENTS.md (root, {N} lines) · [OK] ./src/hooks/AGENTS.md ({N} lines)
184
+ Dirs analyzed: {N} · Created: {N} · Updated: {N}
185
+ Hierarchy: ./AGENTS.md └── src/hooks/AGENTS.md
186
+ ```
187
+
188
+ ## Anti-patterns
189
+
190
+ - **Static agent count** — vary explore subagents by project size/depth (see the scaling table).
191
+ - **Sequential execution** — run explore + LSP concurrently; generate subdirectories in parallel.
192
+ - **Ignoring existing** — ALWAYS read existing AGENTS.md first, even with `--create-new`.
193
+ - **Over-documenting** — not every directory needs an AGENTS.md.
194
+ - **Redundancy** — a child file never repeats its parent.
195
+ - **Generic content** — remove anything that applies to all projects.
196
+ - **Verbose style** — telegraphic or die.
@@ -39,16 +39,18 @@ Before implementation:
39
39
 
40
40
  ## Native Goal + Dynamic Workflow
41
41
 
42
- Use Claude Code's native goal surface when available:
43
-
44
- - If model-facing tools exist, call `get_goal`, call `create_goal` only when no
45
- matching active goal exists, and call `update_goal` only after every success
46
- criterion has evidence or the work is genuinely blocked.
47
- - If the user chooses `/goal`, treat it as the native Claude Code session goal.
48
- LitClaude must not auto-type or send `/goal` text.
49
- - If model-facing goal tools are not exposed, continue quietly with the local
50
- evidence ledger. Mention `/goal <completion condition>` only when it helps a
51
- long-running task; do not spam fallback status.
42
+ Claude Code's `/goal` (v2.1.139+) is a **user-typed slash command** that sets an autonomous
43
+ completion condition; a hook or skill **cannot invoke it**, and Claude Code exposes no
44
+ model-facing goal tools today. Bind goals like this:
45
+
46
+ - When a goal is worth binding, **propose a concrete, ready-to-paste `/goal <completion
47
+ condition>`** for the user, and keep driving the local evidence ledger meanwhile. LitClaude
48
+ must not auto-type or send `/goal` text.
49
+ - Forward-compat only: if a future Claude Code build exposes model-facing goal tools, prefer
50
+ them call `get_goal`, call `create_goal` only when no matching active goal exists, and call
51
+ `update_goal` only after every success criterion has evidence or the work is genuinely blocked.
52
+ - While model-facing goal tools are not exposed (the case today), the local litgoal ledger is the
53
+ durable record; surface the `/goal` proposal for long-running goals and don't spam fallback status.
52
54
 
53
55
  Dynamic workflow orchestration is mandatory for broad, risky, parallel, or
54
56
  long-running work: call `Workflow` when exposed instead of merely mentioning it.
@@ -44,16 +44,15 @@ and do not pretend the skill can silently execute it.
44
44
 
45
45
  ## Native Goal + Dynamic Workflow
46
46
 
47
- Include native goal handling:
48
-
49
- - If model-facing goal tools are exposed, call `get_goal`, create with
50
- `create_goal` only when no matching active goal exists, and delay
51
- `update_goal` until verified completion or a real blocker.
52
- - If goal tools are not exposed, plan a quiet local ledger and a user-visible
53
- `/goal <completion condition>` option instead of claiming native activation.
54
- - If only the `/goal` UI surface is available, include an exact
55
- `/goal <completion condition>` line for the user or wrapper to run.
56
- - Do not auto-type or send `/goal` text from a skill.
47
+ Include native goal handling. Claude Code's `/goal` (v2.1.139+) is a **user-typed slash command**,
48
+ not a model-facing tool, and a hook/skill **cannot invoke it**:
49
+
50
+ - Include an exact, ready-to-paste `/goal <completion condition>` line in the plan for the user to
51
+ run this is the real way to bind the native goal — plus a quiet local ledger for tracking.
52
+ - Forward-compat only: if a future Claude Code build exposes model-facing goal tools, call
53
+ `get_goal`, create with `create_goal` only when no matching active goal exists, and delay
54
+ `update_goal` until verified completion or a real blocker. These goal tools are not exposed today.
55
+ - Do not auto-type or send `/goal` text from a skill, and never claim native activation without evidence.
57
56
 
58
57
  For broad, risky, parallel, or long-running implementation, include Dynamic workflow
59
58
  and Dynamic worktree instructions:
@@ -50,11 +50,47 @@ Represent every litgoal run as:
50
50
  - checkpoint history
51
51
  - final quality gate
52
52
 
53
- If model-facing goal tools are exposed, inspect them before creating a new
54
- active goal. Treat `/goal` as a user-visible Claude Code slash command. Never
55
- auto-type `/goal`, never claim slash-command activation without evidence, and
56
- never mark a goal complete through native goal tooling until the local
57
- litgoal criteria have passed.
53
+ ### Binding the native Claude Code goal
54
+
55
+ Claude Code's `/goal` (v2.1.139+) is a **user-typed slash command** that sets an autonomous
56
+ completion condition; it is **not a model-facing tool**, and a hook or skill **cannot invoke
57
+ it**. So when this skill activates, derive the objective into a crisp completion condition and
58
+ **offer the user a ready-to-paste `/goal <completion condition>`** (e.g. ``/goal all litgoal
59
+ criteria pass and `litclaude litgoal status` shows complete``). Then keep the durable record in
60
+ the local litgoal ledger. Never auto-type `/goal`, never claim slash-command activation without
61
+ evidence, and never mark a goal complete until the local litgoal criteria have passed.
62
+
63
+ Forward-compat only: if a future Claude Code build exposes model-facing goal tools, inspect
64
+ `get_goal` before creating a new active goal, use `create_goal` for the objective, and
65
+ `update_goal` only on verified completion. These are not exposed today — the `/goal` proposal is
66
+ the actual mechanism.
67
+
68
+ ### Autoloop — a plugin-controlled `/goal`-equivalent (no `/goal` typing)
69
+
70
+ LitClaude ships its own **`Stop` hook** that reproduces `/goal`'s keep-running behavior **under
71
+ plugin control**, driven by this ledger — so an autonomous completion loop can start without the
72
+ user typing `/goal`. Opt in per goal:
73
+
74
+ ```bash
75
+ litclaude-ai litgoal create-goals --brief "<objective>" --autoloop --json
76
+ ```
77
+
78
+ This sets `autoloop: true` on the goal. On every Stop event the LitClaude Stop hook reads
79
+ `.litclaude/litgoal/goals.json` and, while any criterion is not `pass`, returns `decision: block`
80
+ with a snapshot of the remaining criteria — Claude keeps working and advancing them with
81
+ `record-evidence` until **all criteria pass**, at which point the hook allows the session to stop.
82
+ Completion is **deterministic** (a pure function of recorded evidence), so it cannot be faked.
83
+
84
+ Safety (the loop can never trap a session):
85
+ - **Default off** — only the explicit `--autoloop` flag arms the hook; ordinary goals never block.
86
+ - **Hard cap** — a durable counter at `.litclaude/litgoal/autoloop.json` stops the loop after
87
+ 8 blocks or 30 minutes (emits `continue:false`); if the counter can't be written, the hook
88
+ fails safe and allows stopping.
89
+ - **Escape hatches** — `LITCLAUDE_GOAL_OFF=1` (env kill switch), or
90
+ `litclaude-ai litgoal checkpoint --status blocked` / `--status complete` to end the loop.
91
+
92
+ Prefer `--autoloop` when the user wants hands-off autonomous completion of a multi-criteria goal;
93
+ otherwise the user-typed `/goal` proposal above remains available and they compose cleanly.
58
94
 
59
95
  ## Bootstrap
60
96
 
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: lsp-setup
3
+ description: "Configure a Language Server (LSP) for a specific language so Claude Code tooling — diagnostics, go-to-definition, find-references, rename — works in LitClaude. Use when you need to set up or install a language server, fix 'no LSP server configured' / 'server not installed', choose between servers (basedpyright vs pyright vs ruff), or add a language to plugins/litclaude/.lsp.json. Routes by file extension to references/<language>/README.md for the server choice, per-OS install commands, the .lsp.json config snippet, and troubleshooting. Ships scripts: detect-lsp.ts (scan a project for languages + report each server's install/config status against .lsp.json) and verify-lsp.ts (real diagnostics roundtrip). Covers typescript, python, go, rust, c/c++, java, kotlin, c#/razor, swift, ruby, php, dart, elixir, zig, lua, bash, yaml, terraform, haskell, julia."
4
+ ---
5
+
6
+ # LSP Setup
7
+
8
+ Configure the right Language Server for a project so Claude Code's LSP tools
9
+ (`diagnostics`, `goto_definition`, `find_references`, `symbols`, `rename`)
10
+ actually work in LitClaude. This skill is an index: detect what a project needs,
11
+ install the server, declare it in `plugins/litclaude/.lsp.json`, then verify with
12
+ a real diagnostics roundtrip.
13
+
14
+ This is the multi-language configurator. For a quick post-edit diagnostics pass
15
+ on an already-configured language, use the lighter `lsp` skill instead — `lsp` is
16
+ the quick path, `lsp-setup` is the configurator that wires new languages in.
17
+
18
+ The recommended server per language is the source of truth in
19
+ `scripts/lsp-server-table.ts`; each `references/<language>/README.md` mirrors it.
20
+
21
+ ## Runtime
22
+
23
+ The scripts are dependency-free TypeScript. Run them with either:
24
+
25
+ - **Node 22.6+:** `node --experimental-strip-types scripts/detect-lsp.ts <dir>`
26
+ - **Bun:** `bun scripts/detect-lsp.ts <dir>`
27
+
28
+ No `npm install` is required; the scripts import only Node built-ins and the
29
+ embedded `lsp-server-table.ts`.
30
+
31
+ ## Phase 0 — Language Gate (run first)
32
+
33
+ Identify the language from the file extension, then read the matching reference
34
+ before installing or configuring anything.
35
+
36
+ | Extension(s) | Reference |
37
+ |---|---|
38
+ | `.ts .tsx .js .jsx .mjs .cjs .mts .cts` | `references/typescript/README.md` |
39
+ | `.py .pyi` | `references/python/README.md` |
40
+ | `.go` | `references/go/README.md` |
41
+ | `.rs` | `references/rust/README.md` |
42
+ | `.c .cpp .cc .cxx .h .hpp .hh .hxx` | `references/c-cpp/README.md` |
43
+ | `.java` | `references/java/README.md` |
44
+ | `.kt .kts` | `references/kotlin/README.md` |
45
+ | `.cs .razor .cshtml` | `references/csharp/README.md` |
46
+ | `.swift` | `references/swift/README.md` |
47
+ | `.rb .rake .gemspec .ru` | `references/ruby/README.md` |
48
+ | `.php` | `references/php/README.md` |
49
+ | `.dart` | `references/dart/README.md` |
50
+ | `.ex .exs` | `references/elixir/README.md` |
51
+ | `.zig .zon` | `references/zig/README.md` |
52
+ | `.lua` | `references/lua/README.md` |
53
+ | `.sh .bash .zsh .ksh` | `references/bash/README.md` |
54
+ | `.yaml .yml` | `references/yaml/README.md` |
55
+ | `.tf .tfvars` | `references/terraform/README.md` |
56
+ | `.hs .lhs` | `references/haskell/README.md` |
57
+ | `.jl` | `references/julia/README.md` |
58
+
59
+ ## Workflow — detect, install, configure, verify
60
+
61
+ ### 1. Detect
62
+
63
+ Scan the project to see which languages are present and whether each server is
64
+ installed and already declared in `.lsp.json`:
65
+
66
+ ```bash
67
+ node --experimental-strip-types scripts/detect-lsp.ts <projectDir>
68
+ node --experimental-strip-types scripts/detect-lsp.ts <projectDir> --json
69
+ ```
70
+
71
+ For each detected language it prints the recommended server, the executable it
72
+ needs on `PATH`, whether that executable is installed, an install hint, and
73
+ whether `plugins/litclaude/.lsp.json` already declares the language. Use
74
+ `--config=<path>` to point at a different `.lsp.json` copy.
75
+
76
+ ### 2. Install
77
+
78
+ Open `references/<language>/README.md` and run the install command for your OS,
79
+ then confirm the executable resolves:
80
+
81
+ ```bash
82
+ command -v <server-executable> # e.g. typescript-language-server, gopls, rust-analyzer
83
+ ```
84
+
85
+ ### 3. Configure (LitClaude `.lsp.json`)
86
+
87
+ LitClaude declares servers in `plugins/litclaude/.lsp.json`. The schema is keyed
88
+ by **language name**; each entry holds a `command` array and an
89
+ `extensionToLanguage` map that tells Claude Code which file extensions route to
90
+ that server:
91
+
92
+ ```json
93
+ {
94
+ "<language>": {
95
+ "command": ["<bin>", "<arg>"],
96
+ "extensionToLanguage": {
97
+ ".ext": "<languageId>"
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ Rules:
104
+
105
+ - One entry per server, keyed by language name. The `command` is the full argv.
106
+ - `extensionToLanguage` maps each owned extension to the LSP `languageId`. Claude
107
+ Code resolves the server for an edited file by matching its extension here.
108
+ - The shipped default declares only `typescript`. Add a language by copying the
109
+ block from its reference README into `.lsp.json`.
110
+ - Server-specific tuning (schemas, licence keys, check commands) travels through
111
+ the editor's LSP `initializationOptions` or a project config file (for example
112
+ `.clangd`, `.rubocop.yml`, `pyrightconfig.json`), not through `.lsp.json`.
113
+
114
+ If a language also needs an MCP wiring (for example a server exposed through an
115
+ MCP stdio bridge rather than a direct binary), declare that bridge in `.mcp.json`
116
+ and keep `.lsp.json` pointed at the resulting command. Most servers here are
117
+ direct binaries and need only `.lsp.json`.
118
+
119
+ Each language reference gives a ready-to-paste `.lsp.json` snippet.
120
+
121
+ ### 4. Verify
122
+
123
+ Run a real diagnostics roundtrip against a source file. The script resolves the
124
+ server for the file extension (from `.lsp.json` when present, else the embedded
125
+ table), spawns it, runs the JSON-RPC `initialize` -> `initialized` -> `didOpen`
126
+ handshake over stdio, waits for `textDocument/publishDiagnostics`, and reports:
127
+
128
+ ```bash
129
+ node --experimental-strip-types scripts/verify-lsp.ts <path/to/file.ext>
130
+ node --experimental-strip-types scripts/verify-lsp.ts <file> --timeout=90000
131
+ ```
132
+
133
+ `OK` = the server started and answered with diagnostics. `FAIL: language server
134
+ not installed` = go back to step 2. Other `FAIL` text carries the server or
135
+ timeout error. `SKIP` = no server is known for that extension; add one via the
136
+ reference and `.lsp.json`. Exit codes: 0 OK, 1 FAIL, 2 usage, 3 SKIP.
137
+
138
+ ## Scripts
139
+
140
+ | Script | Purpose |
141
+ |---|---|
142
+ | `scripts/detect-lsp.ts` | Scan a directory; per detected language report the recommended server, install status, install hint, and whether `.lsp.json` declares it. `--json` for machine output, `--config=<path>` to target a config. |
143
+ | `scripts/verify-lsp.ts` | Real LSP diagnostics roundtrip for one file over stdio JSON-RPC; `OK`/`FAIL`/`SKIP` + exit code 0/1/2/3. Dependency-free. |
144
+ | `scripts/lsp-server-table.ts` | Embedded snapshot of the recommended server per language, mirrored by the references. |
145
+
146
+ ## When LSP tooling is unavailable
147
+
148
+ If Claude Code does not expose LSP tools and a server is not installed, do not
149
+ fabricate a passing diagnostics result. Fall back to the project's own commands
150
+ (`tsc --noEmit`, `ruff`, `cargo check`, `go test`, etc.), label the LSP gap as a
151
+ controlled skip, and report it — consistent with the `lsp` skill's failure rules.
@@ -0,0 +1,63 @@
1
+ # Bash — LSP setup (Claude Code / LitClaude)
2
+
3
+ - **Recommended server:** `bash-language-server start`
4
+ - **Extensions:** `.sh .bash .zsh .ksh`
5
+ - **Install hint:** `npm install -g bash-language-server`
6
+
7
+ ## Install
8
+
9
+ - **macOS:** `npm install -g bash-language-server`
10
+ - **Linux:** `npm install -g bash-language-server`
11
+ - **Windows:** `npm install -g bash-language-server` (PowerShell)
12
+
13
+ For real diagnostics, also install `shellcheck`:
14
+
15
+ - **macOS:** `brew install shellcheck`
16
+ - **Linux:** `apt install shellcheck` (or `dnf install ShellCheck`)
17
+ - **Windows:** `scoop install shellcheck`
18
+
19
+ Confirm it resolves:
20
+
21
+ ```bash
22
+ command -v bash-language-server
23
+ command -v shellcheck
24
+ ```
25
+
26
+ ## Configure
27
+
28
+ Add a `bash` entry to `plugins/litclaude/.lsp.json`:
29
+
30
+ ```json
31
+ {
32
+ "bash": {
33
+ "command": ["bash-language-server", "start"],
34
+ "extensionToLanguage": {
35
+ ".sh": "shellscript",
36
+ ".bash": "shellscript",
37
+ ".zsh": "shellscript",
38
+ ".ksh": "shellscript"
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ Claude Code routes these extensions to `bash-language-server` via the map.
45
+ `bash-language-server` discovers `shellcheck` on PATH automatically; to point at a
46
+ non-PATH binary, export `SHELLCHECK_PATH` in the launching shell.
47
+
48
+ ## Alternatives
49
+
50
+ - `shellcheck` standalone as a linter-only flow (no LSP).
51
+ - `shfmt` for formatting (complements, does not replace, the LSP).
52
+
53
+ ## Troubleshooting
54
+ - **PATH:** `bash-language-server` on PATH; reopen shell after `npm -g` install.
55
+ - **No diagnostics:** `shellcheck` missing — diagnostics are powered by it; install and reopen.
56
+ - **Wrong shell dialect:** `.zsh`/`.ksh` are linted as bash; shellcheck may flag shell-specific syntax.
57
+
58
+ ## Verify
59
+
60
+ ```bash
61
+ node --experimental-strip-types ../../scripts/verify-lsp.ts path/to/file.sh
62
+ # or: bun ../../scripts/verify-lsp.ts path/to/file.sh
63
+ ```
@@ -0,0 +1,72 @@
1
+ # C / C++ — LSP setup (Claude Code / LitClaude)
2
+
3
+ - **Recommended server:** `clangd --background-index --clang-tidy`
4
+ - **Extensions:** `.c .cpp .cc .cxx .c++ .h .hpp .hh .hxx .h++`
5
+ - **Install hint:** `https://clangd.llvm.org/installation`
6
+
7
+ ## Install
8
+
9
+ - **macOS:** `brew install llvm` (clangd ships in the LLVM keg; add its `bin` to PATH)
10
+ - **Linux:** `apt install clangd` (Debian/Ubuntu); use your distro package elsewhere
11
+ - **Windows:** install LLVM from `https://releases.llvm.org` or `winget install LLVM.LLVM`
12
+
13
+ See `https://clangd.llvm.org/installation` for other platforms.
14
+
15
+ Confirm it resolves:
16
+
17
+ ```bash
18
+ command -v clangd
19
+ ```
20
+
21
+ ## Configure
22
+
23
+ Add a `c-cpp` entry to `plugins/litclaude/.lsp.json`:
24
+
25
+ ```json
26
+ {
27
+ "c-cpp": {
28
+ "command": ["clangd", "--background-index", "--clang-tidy"],
29
+ "extensionToLanguage": {
30
+ ".c": "c",
31
+ ".h": "c",
32
+ ".cpp": "cpp",
33
+ ".cc": "cpp",
34
+ ".cxx": "cpp",
35
+ ".hpp": "cpp",
36
+ ".hh": "cpp",
37
+ ".hxx": "cpp"
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ Claude Code routes these extensions to `clangd` via the map. clangd reads
44
+ build flags from a project `.clangd` file, not from `.lsp.json`; the `command`
45
+ above already passes `--background-index --clang-tidy`.
46
+
47
+ ## Compile commands
48
+
49
+ clangd needs a `compile_commands.json` at the project root (or in `build/`) for
50
+ accurate diagnostics and cross-file navigation. Generate it with:
51
+
52
+ - **CMake:** `cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON` (symlink/copy `build/compile_commands.json` to the root)
53
+ - **Make / other:** `bear -- make`
54
+
55
+ Without it, clangd falls back to heuristic flags and reports spurious errors.
56
+
57
+ ## Alternatives
58
+
59
+ `ccls` exists as a third-party server — set the `command` to `["ccls"]` in the
60
+ `c-cpp` entry if you prefer it.
61
+
62
+ ## Troubleshooting
63
+ - **PATH:** `clangd` must be on PATH; reopen shell after install. Homebrew LLVM is keg-only — add `$(brew --prefix llvm)/bin` to PATH.
64
+ - **Spurious "file not found" / unknown flags:** missing or stale `compile_commands.json` — regenerate it after changing the build.
65
+ - **Header-only diagnostics wrong:** ensure the header's translation unit appears in the compile database, or add a `.clangd` `CompileFlags` block.
66
+
67
+ ## Verify
68
+
69
+ ```bash
70
+ node --experimental-strip-types ../../scripts/verify-lsp.ts path/to/file.cpp
71
+ # or: bun ../../scripts/verify-lsp.ts path/to/file.cpp
72
+ ```