truecourse 0.6.0-next.0 → 0.6.0-next.1

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.
package/README.md CHANGED
@@ -14,51 +14,39 @@
14
14
  <a href="https://github.com/truecourse-ai/truecourse/actions/workflows/test.yml"><img src="https://github.com/truecourse-ai/truecourse/actions/workflows/test.yml/badge.svg" alt="Tests" /></a>
15
15
  <a href="https://www.npmjs.com/package/truecourse"><img src="https://img.shields.io/npm/v/truecourse" alt="npm version" /></a>
16
16
  <a href="https://github.com/truecourse-ai/truecourse/blob/main/LICENSE"><img src="https://img.shields.io/github/license/truecourse-ai/truecourse" alt="License" /></a>
17
- <a href="https://discord.gg/8AYwf26A"><img src="https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white" alt="Discord" /></a>
17
+ <a href="https://discord.gg/TanxB63arz"><img src="https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white" alt="Discord" /></a>
18
18
  </p>
19
19
 
20
- TrueCourse catches two classes of defect:
20
+ TrueCourse catches two classes of defect, through two independent tools — use either on its own or both together:
21
21
 
22
- - **Code defects** — from the same categories linters cover (unused code, style, missing types) through to ones they don't reach: circular dependencies, layer violations, dead modules, race conditions, security anti-patterns, performance footguns. Tree-sitter analysis combined with LLM review.
23
- - **Business-logic drift** — when the implementation no longer matches what the docs say it should do. Wrong response codes, missing entity fields, illegal state transitions, bypassed auth, silently-dropped effects, formulas that have lost an input. TrueCourse extracts the contract from your PRDs/ADRs/READMEs and checks the code against it.
22
+ - **Code defects** (`truecourse analyze`) — from the categories linters cover (unused code, style, missing types) through to ones they don't reach: circular dependencies, layer violations, dead modules, race conditions, security anti-patterns, performance footguns. Tree-sitter analysis combined with LLM review.
23
+ - **Business-logic drift** (`truecourse verify`) — when the implementation no longer matches what the docs say it should do. Wrong response codes, missing entity fields, illegal state transitions, bypassed auth, silently-dropped effects, formulas that have lost an input. TrueCourse extracts a contract from your PRDs/ADRs/READMEs and checks the code against it.
24
24
 
25
- Two commands, two concerns. `truecourse analyze` produces code findings. `truecourse verify` produces drift findings, once you've materialised the canonical spec and extracted contracts. Both kinds of output are structured — queryable as JSON for agent workflows, rendered in a dashboard for human review.
25
+ Both store their results under `.truecourse/` and surface them in a shared [dashboard](#dashboard-web-ui) for human review, with plain-text CLI output an agent can read directly.
26
26
 
27
27
  <p align="center">
28
28
  <img src="assets/demo.gif" alt="TrueCourse Screenshot" width="100%" />
29
29
  </p>
30
30
 
31
- ## What it catches
32
-
33
- **Architecture** — Circular dependencies, layer violations, god modules, dead modules, tight coupling, cross-service imports
34
-
35
- **Code quality** — Magic numbers, empty catch, console.log, cognitive complexity, unused variables, redundant code, missing type hints
36
-
37
- **Security** — SQL injection, hardcoded secrets, eval usage, insecure random, XSS, path traversal, unsafe deserialization
38
-
39
- **Bugs** — Race conditions, type mismatches, mutable defaults, implicit optional, off-by-one, unchecked returns
31
+ Jump to: **[1. Analyze](#1-analyze--code-intelligence)** · **[2. Spec → Verify](#2-spec--verify--business-logic-drift)** · **[Dashboard](#dashboard-web-ui)**
40
32
 
41
- **Performance** N+1 queries, O() string concat, unnecessary allocations, missing pagination, sync I/O in async
42
-
43
- **Reliability** — Unhandled promises, resource leaks, missing timeouts, swallowed exceptions, unsafe error handling
33
+ No setup step and no database: TrueCourse creates `.truecourse/` in your repo on first use and stores everything there as plain JSON files. It uses the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) for LLM-powered work if `claude` isn't on your PATH, deterministic analysis still runs and LLM-dependent features are skipped.
44
34
 
45
- **Database** — Missing indexes, missing transactions, lazy loading in loops, raw SQL bypassing ORM, schema issues
35
+ ---
46
36
 
47
- **Style** Import ordering, naming conventions, docstring completeness, formatting preferences
37
+ # 1. Analyze code intelligence
48
38
 
49
- **Spec / BL drift** Operations whose responses, status codes, or headers don't match the spec. Entities with missing or mistyped fields. Immutability and lifecycle violations on state machines. Missing or forbidden side-effect emissions. Auth requirements bypassed. Pagination, idempotency, and error-envelope contracts violated. Formulas producing wrong results from drifted inputs.
39
+ Static + LLM analysis of your code: architecture, security, bugs, performance, and more.
50
40
 
51
41
  ## Quick Start
52
42
 
53
43
  ```bash
54
44
  cd <your-repo>
55
45
  npx truecourse analyze # Runs the full analysis in-process
56
- npx truecourse dashboard # Opens the web UI in your browser
46
+ npx truecourse list # Show the violations it found
57
47
  ```
58
48
 
59
- No setup step. TrueCourse creates `.truecourse/` in your repo on first analyze and stores everything there as plain JSON files no database, no daemon.
60
-
61
- TrueCourse uses the [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) for LLM-powered rules. If `claude` isn't on your PATH, deterministic rules still run and LLM rules are skipped.
49
+ The first analyze creates `.truecourse/` and stores results as plain JSON. View them visually with [`truecourse dashboard`](#dashboard-web-ui).
62
50
 
63
51
  ## Setup
64
52
 
@@ -86,10 +74,44 @@ git commit -m "add truecourse baseline"
86
74
 
87
75
  `LATEST.json` is tracked, so `git worktree add ../feat-x` and fresh clones inherit the baseline through git. `truecourse analyze --diff` and the pre-commit hook both work on the first commit in a new worktree — no per-checkout cold-start. Inside a worktree, run `truecourse analyze --diff` to see what your in-flight changes introduce relative to `main`'s committed baseline; the diff result lands in `.truecourse/diff.json` (gitignored, per-checkout).
88
76
 
89
- ## CLI Commands
77
+ ## What it catches
78
+
79
+ **Architecture** — Circular dependencies, layer violations, god modules, dead modules, tight coupling, cross-service imports
80
+
81
+ **Code quality** — Magic numbers, empty catch, console.log, cognitive complexity, unused variables, redundant code, missing type hints
82
+
83
+ **Security** — SQL injection, hardcoded secrets, eval usage, insecure random, XSS, path traversal, unsafe deserialization
84
+
85
+ **Bugs** — Race conditions, type mismatches, mutable defaults, implicit optional, off-by-one, unchecked returns
86
+
87
+ **Performance** — N+1 queries, O(n²) string concat, unnecessary allocations, missing pagination, sync I/O in async
88
+
89
+ **Reliability** — Unhandled promises, resource leaks, missing timeouts, swallowed exceptions, unsafe error handling
90
+
91
+ **Database** — Missing indexes, missing transactions, lazy loading in loops, raw SQL bypassing ORM, schema issues
92
+
93
+ **Style** — Import ordering, naming conventions, docstring completeness, formatting preferences
94
+
95
+ ### Rule coverage
96
+
97
+ TrueCourse ships with **1,200+ deterministic rules** and **100 LLM rules** across 8 categories:
98
+
99
+ | Category | Deterministic | LLM | Total |
100
+ |---|---:|---:|---:|
101
+ | Security | 150+ | 1 | 150+ |
102
+ | Bugs | 250+ | 4 | 250+ |
103
+ | Architecture | 30+ | 7 | 40+ |
104
+ | Code Quality | 500+ | 3 | 500+ |
105
+ | Performance | 50+ | 10 | 60+ |
106
+ | Reliability | 40+ | 10 | 50+ |
107
+ | Database | 30+ | 5 | 35+ |
108
+ | Style | 50+ | — | 50+ |
109
+
110
+ **Deterministic rules** run via tree-sitter AST visitors — fast, zero-cost, no API calls. **LLM rules** send source code to the configured LLM for semantic analysis — deeper but requires an LLM provider.
111
+
112
+ ## Commands
90
113
 
91
114
  ```bash
92
- # Analysis
93
115
  truecourse analyze # Analyze current repo (prompts before stashing dirty trees)
94
116
  truecourse analyze --stash # Pre-approve stashing pending changes (CI-friendly)
95
117
  truecourse analyze --no-stash # Analyze working tree as-is, no stash
@@ -98,45 +120,6 @@ truecourse list # Show violations from latest analysis
98
120
  truecourse list --all # Show all violations (no pagination)
99
121
  truecourse list --diff # Show diff check results
100
122
  truecourse add # Register repo without analyzing
101
-
102
- # Dashboard (web UI)
103
- truecourse dashboard # Start + open the dashboard
104
- truecourse dashboard --reconfigure # Re-prompt for console vs background service mode
105
- truecourse dashboard stop # Stop the dashboard
106
- truecourse dashboard status # Show dashboard status
107
- truecourse dashboard logs # Tail dashboard logs (service mode only)
108
- truecourse dashboard uninstall # Remove the background service
109
-
110
- # Spec consolidation (docs → canonical spec)
111
- truecourse spec scan # Read docs, extract claims, surface conflicts, write claims.json
112
- truecourse spec resolve --all-defaults # Accept the engine's recommended pick on every open conflict
113
- truecourse spec status # Summary: docs, claims, modules, pending decisions
114
-
115
- # Agent-friendly conflict surface (all support --json)
116
- truecourse spec conflicts list # List open conflicts (add --decided / --all)
117
- truecourse spec conflicts show <id> # Full detail for one conflict
118
- truecourse spec conflicts pick <id> <index> # Resolve by picking a candidate
119
- truecourse spec conflicts custom <id> --text "…" # Resolve with a custom answer
120
- truecourse spec conflicts revoke <id> # Re-open a decided conflict
121
- truecourse spec chains add --older A --newer B # Manually mark a version chain (escape hatch)
122
- truecourse spec chains list / remove …
123
- truecourse spec docs skipped # Docs the LLM relevance filter excluded
124
- truecourse spec docs include <path> # Force-include a skipped doc
125
- truecourse spec docs uninclude <path>
126
-
127
- # Contract extraction (canonical spec → .tc artifacts)
128
- truecourse contracts generate # Extract / re-extract TC contract files
129
- truecourse contracts list # List generated contracts
130
- truecourse contracts validate # Parse + resolve TC files; report unresolved refs
131
-
132
- # Verification (code against contracts) — separate command, not part of `analyze`
133
- truecourse verify # Full run: stashes dirty tree (prompts), writes verifier/runs + LATEST + history
134
- truecourse verify --diff # Git diff: working-tree drifts vs committed baseline (added/resolved/unchanged)
135
- truecourse verify --stash / --no-stash # Pre-approve / skip stashing on a full run
136
-
137
- # Inference (code → inferred contracts) — reverse-engineer undocumented decisions
138
- truecourse infer # Write inferred .tc files to contracts/_inferred/
139
- truecourse infer --dry-run # Report what would be written, touch nothing
140
123
  ```
141
124
 
142
125
  ### Rules
@@ -162,84 +145,9 @@ truecourse rules enable <ruleKey> # Re-enable a single rule
162
145
  truecourse rules reset [ruleKey] # Clear per-rule overrides (one or all)
163
146
  ```
164
147
 
165
- Disabled rules are skipped at analyze time (no detection cost, no LLM
166
- calls) and any existing violations from them are hidden from the
167
- dashboard and `truecourse list` until re-enabled. The list of disabled
168
- rule keys lives in `<repo>/.truecourse/config.json` under
169
- `disabledRules`, which is intended to be committed.
170
-
171
- In the dashboard you can also toggle rules from the Rules panel
172
- (Shield icon in the top-right) or silence a noisy rule directly from
173
- any violation card via the **⋮** menu → **Disable rule for this repo**.
174
-
175
- ### Spec → Contracts → Verify (BL drift detection)
176
-
177
- In addition to the rule-based static analysis, TrueCourse builds a
178
- machine-readable spec from your docs and verifies the code against it.
179
- Three stages run in order, each producing artifacts the next stage
180
- consumes:
181
-
182
- **1. Spec consolidation** — Walks every `.md` file in the repo (PRDs,
183
- ADRs, RFCs, READMEs, design notes; `.truecourse/`, `node_modules/`,
184
- `.git/` etc. are skipped). An LLM relevance filter drops obvious
185
- non-spec material (task lists, research logs, AI agent prompts). For
186
- the docs that remain, an LLM extracts structured claims per block and
187
- groups them by `(topic, subject)`. Agreements auto-merge; genuine
188
- disagreements surface as **conflicts** in the dashboard with a plain-
189
- English explanation of what differs. Output:
190
- `.truecourse/specs/claims.json` (the structured snapshot every
191
- downstream stage consumes — modules + per-claim content + provenance)
192
- and `.truecourse/specs/decisions.json` (the user's resolutions, version
193
- chains, and overrides — committable).
194
-
195
- Auto-resolve rules cut the conflict count substantially: byte-
196
- identical content, status-tolerant duplicates, same-file consolidation,
197
- docKind-dominance pickups, and detected version chains.
198
- [Plan](docs/contracts/PLAN_CONFLICT_RESOLUTION.md).
199
-
200
- **2. Contract extraction** — Reads `claims.json` and emits
201
- `.truecourse/contracts/*.tc` files in a hand-written DSL
202
- covering 13 artifact kinds: `operation`, `entity`, `enum`,
203
- `state-machine`, `auth-requirement`, `authorization-rule`,
204
- `error-envelope`, `pagination-contract`, `idempotency-contract`,
205
- `effect-group`, `formula`, plus `unenforceable-obligation` for prose
206
- the verifier can't structurally check. A post-extraction **repair
207
- pass** validates structural completeness and re-prompts the LLM to fix
208
- deficient artifacts (missing forbids clauses, broad role selectors,
209
- unresolved cross-references). On the bundled fixture this hits
210
- **22/22 planted bugs with 0 false positives**.
211
-
212
- **3. Verification** — Parses the contracts, walks the source tree, and runs per-kind comparators (operations, entities, state machines, etc.). Drifts surface in the dashboard alongside code violations and from the CLI as JSON. Verification is its own command — `truecourse verify` — not a stage of `truecourse analyze`, because the two pipelines answer different questions, have different prerequisites, and run on different time scales.
213
-
214
- **4. Inference** — The mirror image of verification. `verify` asks "the spec says X — does the code do X?"; `truecourse infer` asks "the code does X — does any spec mention X?". It runs code-side extractors *un-driven by a spec*, subtracts whatever the authored contracts already cover, and writes the remainder to `.truecourse/contracts/_inferred/` as `.tc` artifacts tagged with an `inferred-from "<code-path>" a..b` provenance line and a `confidence` level (instead of the authored `origin SOURCE "section" a..b`). It covers the full artifact spread — undocumented endpoints, entities (from ORM schema), enums, named constants, query policies, emitted events, computed formulas, architecture choices, and the cross-cutting conventions (auth, pagination, idempotency, error envelope). Confidence reflects fidelity: a value read straight from code is `high`; a synthesized convention (e.g. an assumed auth scheme, or a state machine whose transitions can't be reconstructed) is a `low`-confidence draft to confirm. Because coverage is computed from authored contracts only, a decision drops out of `_inferred/` the moment it's documented — the directory is a shrinking backlog of "decisions your code made that your docs never recorded". Inferred contracts are descriptive, not prescriptive, so `verify` skips `_inferred/` by default.
215
-
216
- **Storage layout** (per repo, under `.truecourse/`):
148
+ Disabled rules are skipped at analyze time (no detection cost, no LLM calls) and any existing violations from them are hidden from the dashboard and `truecourse list` until re-enabled. The list of disabled rule keys lives in `<repo>/.truecourse/config.json` under `disabledRules`, which is intended to be committed.
217
149
 
218
- ```
219
- .truecourse/
220
- ├── specs/ ← canonical spec (committable)
221
- │ ├── claims.json ← structured snapshot: modules + claims + provenance
222
- │ └── decisions.json ← user resolutions + version chains + manual includes
223
- ├── contracts/ ← generated TC contract artifacts (gitignored by default)
224
- │ └── _inferred/ ← reverse-engineered, undocumented decisions (`truecourse infer`)
225
- ├── analyses/ ← analysis snapshots (gitignored)
226
- ├── LATEST.json ← analyze current-state view (committable)
227
- ├── verifier/ ← drift store (mirrors analyze; `truecourse verify`)
228
- │ ├── runs/ ← per-run drift snapshots (gitignored)
229
- │ ├── LATEST.json ← current drift state + diff baseline (committable)
230
- │ ├── history.json ← per-run summaries (gitignored)
231
- │ └── diff.json ← current-vs-baseline drift diff (gitignored)
232
- └── .cache/ ← LLM + slice cache (gitignored)
233
- ```
234
-
235
- The dashboard's Spec tab walks you through resolving each conflict
236
- (pick / write custom / mark superseded / include skipped doc). The
237
- same actions are also available via the CLI subcommands shown above
238
- (every command supports `--json` for agent-driven workflows).
239
-
240
- **Prerequisite:** the contract extractor and the conflict resolver
241
- shell out to the Claude Code CLI (`claude -p`). Install Claude Code
242
- and sign in once before running `spec scan` or `contracts generate`.
150
+ In the dashboard you can also toggle rules from the Rules panel (Shield icon in the top-right) or silence a noisy rule directly from any violation card via the **⋮** menu → **Disable rule for this repo**.
243
151
 
244
152
  ### Git Hooks
245
153
 
@@ -265,34 +173,121 @@ pre-commit:
265
173
  llm: false # run LLM rules on every commit (tokens per commit)
266
174
  ```
267
175
 
268
- ### Telemetry
176
+ ---
177
+
178
+ # 2. Spec → Verify — business-logic drift
179
+
180
+ TrueCourse builds a machine-readable spec from your docs and verifies the code against it — catching where the implementation has drifted from documented intent. This is a separate pipeline from `analyze`: it answers a different question, has different prerequisites (it reads your docs), and runs on a different time scale.
181
+
182
+ > **Prerequisite:** the contract extractor and conflict resolver shell out to the Claude Code CLI (`claude -p`). Install Claude Code and sign in once before running `spec scan` or `contracts generate`.
183
+
184
+ ## Quick Start
185
+
186
+ ```bash
187
+ cd <your-repo>
188
+ truecourse spec scan # Read docs → extract claims → surface conflicts
189
+ truecourse spec resolve --all-defaults # Accept the recommended pick on each conflict
190
+ truecourse contracts generate # Canonical spec → .tc contract artifacts
191
+ truecourse verify # Check code against the contracts → drifts
192
+ ```
193
+
194
+ Resolve conflicts and review drifts visually in the [dashboard](#dashboard-web-ui)'s BL Drift section, or drive every step from the CLI.
195
+
196
+ ## How it works
197
+
198
+ Three stages run in order, each producing artifacts the next consumes:
199
+
200
+ **1. Spec consolidation** — Walks every `.md` file in the repo (PRDs, ADRs, RFCs, READMEs, design notes; `.truecourse/`, `node_modules/`, `.git/` etc. are skipped). An LLM relevance filter drops obvious non-spec material (task lists, research logs, AI agent prompts). For the docs that remain, an LLM extracts structured claims per block and groups them by `(topic, subject)`. Agreements auto-merge; genuine disagreements surface as **conflicts** in the dashboard with a plain-English explanation of what differs. Output: `.truecourse/specs/claims.json` (the structured snapshot every downstream stage consumes — modules + per-claim content + provenance) and `.truecourse/specs/decisions.json` (the user's resolutions, version chains, and overrides — committable).
201
+
202
+ Auto-resolve rules cut the conflict count substantially: byte-identical content, status-tolerant duplicates, same-file consolidation, docKind-dominance pickups, and detected version chains. [Plan](docs/contracts/PLAN_CONFLICT_RESOLUTION.md).
203
+
204
+ **2. Contract extraction** — Reads `claims.json` and emits `.truecourse/contracts/*.tc` files in a hand-written DSL covering 13 artifact kinds: `operation`, `entity`, `enum`, `state-machine`, `auth-requirement`, `authorization-rule`, `error-envelope`, `pagination-contract`, `idempotency-contract`, `effect-group`, `formula`, plus `unenforceable-obligation` for prose the verifier can't structurally check. A post-extraction **repair pass** validates structural completeness and re-prompts the LLM to fix deficient artifacts (missing forbids clauses, broad role selectors, unresolved cross-references). On the bundled fixture this hits **22/22 planted bugs with 0 false positives**.
205
+
206
+ **3. Verification** — Parses the contracts, walks the source tree, and runs per-kind comparators (operations, entities, state machines, etc.). Drifts surface in the dashboard alongside code violations, and on the CLI through `truecourse verify`. It's its own command — not a stage of `truecourse analyze`.
207
+
208
+ **4. Inference** — The mirror image of verification. `verify` asks "the spec says X — does the code do X?"; `truecourse infer` asks "the code does X — does any spec mention X?". It runs the code-side extractors *un-driven by a spec*, subtracts whatever the authored contracts already cover, and writes the remainder to `.truecourse/contracts/_inferred/` as `.tc` artifacts tagged with an `inferred-from "<code-path>" a..b` provenance line and a `confidence` level (instead of the authored `origin SOURCE "section" a..b`). It covers the full artifact spread — undocumented endpoints, entities (from ORM schema), enums, named constants, query policies, emitted events, computed formulas, architecture choices, and the cross-cutting conventions (auth, pagination, idempotency, error envelope). Confidence reflects fidelity: a value read straight from code is `high`; a synthesized convention (e.g. an assumed auth scheme) is a `low`-confidence draft to confirm. Because coverage is computed from authored contracts only, a decision drops out of `_inferred/` the moment it's documented — the directory is a shrinking backlog of "decisions your code made that your docs never recorded". Inferred contracts are descriptive, not prescriptive, so `verify` skips `_inferred/` by default.
209
+
210
+ ## What it catches
211
+
212
+ Operations whose responses, status codes, or headers don't match the spec. Entities with missing or mistyped fields. Immutability and lifecycle violations on state machines. Missing or forbidden side-effect emissions. Auth requirements bypassed. Pagination, idempotency, and error-envelope contracts violated. Formulas producing wrong results from drifted inputs.
213
+
214
+ ## Setup
215
+
216
+ The spec and a verify baseline are committable so they travel with the repo; everything else is local-only. Per-repo layout under `.truecourse/`:
217
+
218
+ ```
219
+ .truecourse/
220
+ ├── specs/ ← canonical spec (committable)
221
+ │ ├── claims.json ← structured snapshot: modules + claims + provenance
222
+ │ └── decisions.json ← user resolutions + version chains + manual includes
223
+ ├── contracts/ ← generated TC contract artifacts (gitignored by default)
224
+ │ └── _inferred/ ← reverse-engineered, undocumented decisions (`truecourse infer`)
225
+ ├── verifier/ ← drift store (mirrors analyze; `truecourse verify`)
226
+ │ ├── runs/ ← per-run drift snapshots (gitignored)
227
+ │ ├── LATEST.json ← current drift state + diff baseline (committable)
228
+ │ ├── history.json ← per-run summaries (gitignored)
229
+ │ └── diff.json ← current-vs-baseline drift diff (gitignored)
230
+ └── .cache/ ← LLM + slice cache (gitignored)
231
+ ```
232
+
233
+ Like analyze, `verifier/LATEST.json` is the committable baseline — commit it after merging to `main` (re-run `truecourse verify`, commit the result), not from feature branches. `truecourse verify --diff` then shows the drifts your uncommitted changes add or resolve against it.
269
234
 
270
- TrueCourse collects anonymous usage data to improve the product. It is automatically disabled in CI environments.
235
+ ## Commands
271
236
 
272
237
  ```bash
273
- truecourse telemetry status # Check telemetry status
274
- truecourse telemetry disable # Opt out of anonymous telemetry
275
- truecourse telemetry enable # Opt back in
238
+ # Spec consolidation (docs canonical spec)
239
+ truecourse spec scan # Read docs, extract claims, surface conflicts, write claims.json
240
+ truecourse spec resolve --all-defaults # Accept the engine's recommended pick on every open conflict
241
+ truecourse spec status # Summary: docs, claims, modules, pending decisions
242
+
243
+ # Conflict resolution (also available in the dashboard Spec tab)
244
+ truecourse spec conflicts list # List open conflicts (add --decided / --all)
245
+ truecourse spec conflicts show <id> # Full detail for one conflict
246
+ truecourse spec conflicts pick <id> <index> # Resolve by picking a candidate
247
+ truecourse spec conflicts custom <id> --text "…" # Resolve with a custom answer
248
+ truecourse spec conflicts revoke <id> # Re-open a decided conflict
249
+ truecourse spec chains add --older A --newer B # Manually mark a version chain (escape hatch)
250
+ truecourse spec chains list / remove …
251
+ truecourse spec docs skipped # Docs the LLM relevance filter excluded
252
+ truecourse spec docs include <path> # Force-include a skipped doc
253
+ truecourse spec docs uninclude <path>
254
+
255
+ # Contract extraction (canonical spec → .tc artifacts)
256
+ truecourse contracts generate # Extract / re-extract TC contract files
257
+ truecourse contracts list # List generated contracts
258
+ truecourse contracts validate # Parse + resolve TC files; report unresolved refs
259
+
260
+ # Verification (code against contracts)
261
+ truecourse verify # Full run: stashes dirty tree (prompts), writes verifier/runs + LATEST + history
262
+ truecourse verify --diff # Git diff: working-tree drifts vs committed baseline (added/resolved/unchanged)
263
+ truecourse verify --stash / --no-stash # Pre-approve / skip stashing on a full run
264
+
265
+ # Inference (code → inferred contracts) — reverse-engineer undocumented decisions
266
+ truecourse infer # Write inferred .tc files to contracts/_inferred/
267
+ truecourse infer --dry-run # Report what would be written, touch nothing
276
268
  ```
277
269
 
278
- ## Analysis Rules
270
+ ---
279
271
 
280
- TrueCourse ships with **1,200+ deterministic rules** and **100 LLM rules** across 8 categories:
272
+ # Dashboard (web UI)
281
273
 
282
- | Category | Deterministic | LLM | Total |
283
- |---|---:|---:|---:|
284
- | Security | 150+ | 1 | 150+ |
285
- | Bugs | 250+ | 4 | 250+ |
286
- | Architecture | 30+ | 7 | 40+ |
287
- | Code Quality | 500+ | 3 | 500+ |
288
- | Performance | 50+ | 10 | 60+ |
289
- | Reliability | 40+ | 10 | 50+ |
290
- | Database | 30+ | 5 | 35+ |
291
- | Style | 50+ | — | 50+ |
274
+ One web UI for both capabilities browse code findings and business-logic drift side by side, with the architecture graph, analytics, and the spec/contracts/verify workflow.
292
275
 
293
- **Deterministic rules** run via tree-sitter AST visitors — fast, zero-cost, no API calls.
276
+ ```bash
277
+ truecourse dashboard # Start + open the dashboard
278
+ truecourse dashboard --reconfigure # Re-prompt for console vs background service mode
279
+ truecourse dashboard stop # Stop the dashboard
280
+ truecourse dashboard status # Show dashboard status
281
+ truecourse dashboard logs # Tail dashboard logs (service mode only)
282
+ truecourse dashboard uninstall # Remove the background service
283
+ ```
284
+
285
+ - **Code Analysis** — architecture graph, violations list, severity/category analytics, code hotspots, trend over time; toggle rules and silence noisy ones inline.
286
+ - **BL Drift** — the Spec tab walks you through resolving each conflict (pick / write custom / mark superseded / include skipped doc); Contracts shows the generated `.tc` artifacts; Verify shows the drift analytics + list, with a Runs history and a Normal / Git-Diff toggle.
294
287
 
295
- **LLM rules** send source code to the configured LLM for semantic analysis — deeper but requires an LLM provider.
288
+ ---
289
+
290
+ # Common
296
291
 
297
292
  ## Claude Code Skills
298
293
 
@@ -321,7 +316,7 @@ The first `truecourse analyze` (or `truecourse add`) in a fresh repo asks whethe
321
316
  ## Prerequisites
322
317
 
323
318
  - Node.js >= 20
324
- - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI on your PATH. Deterministic rules run without it, LLM-powered rules need it.
319
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI on your PATH. Deterministic rules run without it; LLM-powered rules and the Spec → Verify pipeline need it.
325
320
 
326
321
  ## Configuration
327
322
 
@@ -337,7 +332,7 @@ CLAUDE_CODE_MAX_RETRIES=2 # retry attempts on parse/validation failu
337
332
  CLAUDE_CODE_MAX_CONCURRENCY=10 # max concurrent `claude` processes per run
338
333
  ```
339
334
 
340
- **`CLAUDE_CODE_MAX_CONCURRENCY`** caps how many Claude CLI processes TrueCourse spawns in parallel during a single analyze. Default `10`. Raise it on CI runners with spare headroom; lower it on resource-constrained machines (e.g. 8 GB laptops, shared VMs) to avoid OOM on large repos. Must be a positive integer.
335
+ **`CLAUDE_CODE_MAX_CONCURRENCY`** caps how many Claude CLI processes TrueCourse spawns in parallel during a single run. Default `10`. Raise it on CI runners with spare headroom; lower it on resource-constrained machines (e.g. 8 GB laptops, shared VMs) to avoid OOM on large repos. Must be a positive integer.
341
336
 
342
337
  For a one-off override, prefix the command:
343
338
 
@@ -362,6 +357,18 @@ scripts/ingest-epub.js
362
357
 
363
358
  Patterns are anchored to the file's location, so `src/generated/` matches the top-level directory only; use `**/generated/` to match at any depth.
364
359
 
360
+ ## Telemetry
361
+
362
+ TrueCourse collects anonymous usage data (event type, language, file count range, OS) to improve the product. No source code, file paths, or violation details are collected. It is automatically disabled in CI environments.
363
+
364
+ ```bash
365
+ truecourse telemetry status # Check telemetry status
366
+ truecourse telemetry disable # Opt out of anonymous telemetry
367
+ truecourse telemetry enable # Opt back in
368
+ ```
369
+
370
+ Or set `TRUECOURSE_TELEMETRY=0` to opt out.
371
+
365
372
  ## Development
366
373
 
367
374
  ```bash
@@ -375,13 +382,9 @@ pnpm build # Build all packages
375
382
 
376
383
  `pnpm dev` expects a `.truecourse/` folder at the repo root — created automatically on the first `truecourse analyze` against the repo (or simply `mkdir -p .truecourse`).
377
384
 
378
- ## Telemetry
379
-
380
- TrueCourse collects anonymous usage data (event type, language, file count range, OS). No source code, file paths, or violation details are collected. Opt out with `truecourse telemetry disable` or `TRUECOURSE_TELEMETRY=0`.
381
-
382
385
  ## Community
383
386
 
384
- Join the [TrueCourse Discord](https://discord.gg/8AYwf26A) to ask questions, share feedback, and follow what's shipping.
387
+ Join the [TrueCourse Discord](https://discord.gg/TanxB63arz) to ask questions, share feedback, and follow what's shipping.
385
388
 
386
389
  ## Contact
387
390