revdeck 0.5.0 → 0.6.0

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 (40) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/README.md +57 -8
  3. package/README.ru.md +58 -11
  4. package/dist/cli.js +1202 -481
  5. package/dist/cli.js.map +4 -4
  6. package/dist/daemon.js +1389 -203
  7. package/dist/daemon.js.map +4 -4
  8. package/dist/mcp.js +947 -112
  9. package/dist/mcp.js.map +4 -4
  10. package/dist/ui/assets/index-BH0dNFhd.css +1 -0
  11. package/dist/ui/assets/index-Wz1DYbiv.js +14 -0
  12. package/dist/ui/index.html +2 -2
  13. package/docs/README.md +1 -1
  14. package/docs/architecture.md +51 -6
  15. package/docs/capabilities.md +227 -0
  16. package/docs/configuration.md +63 -0
  17. package/docs/integrations.md +35 -0
  18. package/docs/protocol.md +52 -2
  19. package/docs/ru/README.md +1 -1
  20. package/docs/ru/architecture.md +51 -5
  21. package/docs/ru/capabilities.md +227 -0
  22. package/docs/ru/configuration.md +54 -0
  23. package/docs/ru/integrations.md +36 -0
  24. package/docs/ru/protocol.md +51 -2
  25. package/docs/ru/threat-model.md +28 -0
  26. package/docs/screenshot.png +0 -0
  27. package/docs/screenshot.ru.png +0 -0
  28. package/docs/threat-model.md +29 -0
  29. package/examples/analytics-platform.yml +40 -0
  30. package/examples/monorepo.yml +1 -1
  31. package/package.json +1 -1
  32. package/skills/revdeck/en/Feature.md +61 -0
  33. package/skills/revdeck/en/SKILL.md +17 -1
  34. package/skills/revdeck/ru/Feature.md +61 -0
  35. package/skills/revdeck/ru/SKILL.md +18 -1
  36. package/dist/ui/assets/index-CcmcJhhu.css +0 -1
  37. package/dist/ui/assets/index-CuvK5owY.js +0 -10
  38. package/docs/adr/0001-daemon-first.md +0 -65
  39. package/docs/ru/adr/0001-daemon-first.md +0 -63
  40. package/examples/web-chat-core.yml +0 -45
@@ -7,8 +7,8 @@
7
7
  <meta name="referrer" content="no-referrer" />
8
8
  <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
9
9
  <title>revdeck</title>
10
- <script type="module" crossorigin src="/assets/index-CuvK5owY.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-CcmcJhhu.css">
10
+ <script type="module" crossorigin src="/assets/index-Wz1DYbiv.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-BH0dNFhd.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="app"></div>
package/docs/README.md CHANGED
@@ -7,11 +7,11 @@ slightly behind.
7
7
 
8
8
  | Document | English | Русский |
9
9
  |---|---|---|
10
+ | Capabilities and decisions | [capabilities.md](capabilities.md) | [ru/capabilities.md](ru/capabilities.md) |
10
11
  | Overview and design | [architecture.md](architecture.md) | [ru/architecture.md](ru/architecture.md) |
11
12
  | Configuration and rules | [configuration.md](configuration.md) | [ru/configuration.md](ru/configuration.md) |
12
13
  | RPC and HTTP protocol | [protocol.md](protocol.md) | [ru/protocol.md](ru/protocol.md) |
13
14
  | Threat model | [threat-model.md](threat-model.md) | [ru/threat-model.md](ru/threat-model.md) |
14
15
  | Harness integrations | [integrations.md](integrations.md) | [ru/integrations.md](ru/integrations.md) |
15
- | ADR-0001: daemon-first | [adr/0001-daemon-first.md](adr/0001-daemon-first.md) | [ru/adr/0001-daemon-first.md](ru/adr/0001-daemon-first.md) |
16
16
 
17
17
  Start with the [README](../README.md) for installation, commands and MCP setup.
@@ -15,8 +15,8 @@
15
15
 
16
16
  - Replacing GitLab/GitHub's native diff viewer. The UI is optimized for triage and approval.
17
17
  - Built-in static analysis. Checks are delegated to the project's linter, types, and tests.
18
- - A multi-user server. The model is one user, several reviews, and a
19
- [daemon on the host](adr/0001-daemon-first.md).
18
+ - A multi-user server. The model is one user, several repositories and reviews, and a
19
+ [daemon on the host](capabilities.md#daemon-first).
20
20
 
21
21
  ## Components
22
22
 
@@ -26,14 +26,14 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
26
26
  SQLite + UI ◀── human
27
27
  ```
28
28
 
29
- - `src/core` — pure functions and models: unified diff parser, rules, finding fingerprints,
29
+ - `src/core` — pure functions and models: project identity and keys, unified diff parser, rules, finding fingerprints,
30
30
  [publication sanitizer](threat-model.md), secret redaction, safe process execution.
31
31
  - `src/providers` — the only place that knows about platforms. `Provider` normalizes MR/PR, diff,
32
32
  threads, replies, resolution, and comment creation.
33
33
  - `src/daemon/service.ts` — orchestrator: review refresh, drafts, decisions, publication plan,
34
34
  approval, idempotent writes, background sync.
35
- - `src/daemon/store.ts` — SQLite (`node:sqlite`): reviews, diff/thread snapshot, drafts, findings,
36
- decisions, comments, approvals, audit.
35
+ - `src/daemon/store.ts` — SQLite (`node:sqlite`): projects and their roots, reviews, diff/thread snapshot,
36
+ drafts, findings, decisions, comments, approvals, audit.
37
37
  - `src/daemon/rpc.ts` — [JSON-RPC](protocol.md) over a Unix socket (0600) for the CLI and MCP.
38
38
  - `src/daemon/bridge.ts` — an additional RPC socket in a stable home-based directory for devcontainers.
39
39
  - `src/daemon/http.ts` — UI and `/api/*`, SSE events, cookie session with a one-time token.
@@ -43,7 +43,7 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
43
43
 
44
44
  ## Data flow
45
45
 
46
- 1. `revdeck open 42` → RPC `reviews.open` with the working copy `root`.
46
+ 1. `revdeck open 42` → RPC `reviews.open` with the working copy `root`; the project is resolved from the config/remote and registered.
47
47
  2. The daemon determines the platform/host/project (arguments → config → git remote), creates a
48
48
  provider, reads the MR, diff, and threads, and saves a snapshot and synthetic drafts.
49
49
  3. The agent requests `revdeck_context`: the daemon assembles effective rules (documents and sections
@@ -55,6 +55,10 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
55
55
 
56
56
  ## Data model
57
57
 
58
+ - `Project` — a repository: `key = platform:host/project` (normalized for comparison), display values,
59
+ and one or more working-copy roots. Reviews carry the same `projectKey`.
60
+ - `Feature` — an explicit bundle of reviews with a brief, contract and notes; `FeatureReview` adds a
61
+ role and order; `FeatureNote` holds non-published cross-project notes/findings.
58
62
  - `ReviewRef` — platform, host, project, number. `reviewId` — `platform:host/project!number`.
59
63
  - `DiffFile`/`Hunk`/`DiffLine` — line numbers in the old and new versions; a finding's `line` always
60
64
  refers to the new file.
@@ -64,6 +68,47 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
64
68
  - `Approval` — a one-time id tied to `hash = sha256(canonicalJson({reviewId, kind, items}))`,
65
69
  with a 10-minute TTL.
66
70
 
71
+ ## Projects and isolation
72
+
73
+ One daemon serves several repositories. A **project** is one repository, identified by
74
+ `platform:host/project`; a review stores its project key and its own working-copy root. The daemon
75
+ registry (`projects`, `project_roots`) is populated when a review is opened or when a project is
76
+ registered explicitly (`revdeck projects add <path>`).
77
+
78
+ - The UI selects one project at a time: a switcher, a projects home, and a review queue scoped to the
79
+ selection. The selection is kept in the URL and in local storage.
80
+ - The MCP server is the isolation point. It resolves its project from `REVDECK_ROOT` (or the current
81
+ directory), lists only that project, and rejects review ids/URLs from other projects. The agent gets
82
+ no `root` or project overrides.
83
+ - `reviews.list` accepts `project` or `root`; this is a filter for the UI/CLI, not a security boundary.
84
+ One daemon and one database remain; a process with access to the user's home can read the database.
85
+ - Cross-project work is not implicit. A human-created feature links reviews from several projects; a
86
+ foreign review is rejected outside it. See [capabilities](capabilities.md#project-scopes) and [Features](#features).
87
+
88
+ ## Features
89
+
90
+ A **feature** is a human-created bundle of reviews across projects. It is not a project and not a
91
+ permanent project link: projects appear in it only while at least one of their reviews is a member.
92
+ The `features` table holds the title, Markdown brief, a separate Markdown/OpenAPI contract, status
93
+ and human/agent feature notes; `feature_reviews` holds membership, a free-form role and order. Several
94
+ reviews from one project are allowed. OpenAPI contracts are parsed into operations and schemas, and
95
+ the context marks which changed reviews mention each operation. Application profiles are background
96
+ documents declared in `context.sources` of each repository (`context.maxBytes` caps them).
97
+
98
+ - The UI and CLI create/edit features; MCP exposes read-only discovery/context and, in a feature session,
99
+ `revdeck_feature_note` for agent-authored notes (never published).
100
+ - A **project session** sees features that include its project, may read the combined context, and
101
+ writes only in its project.
102
+ - A **feature session** is explicit (`REVDECK_FEATURE=<id>`): the current repository must be a member,
103
+ the scope covers only members, and drafts may be written to any member. Publishing remains per
104
+ review and requires human approval.
105
+ - The combined context contains the brief, the contract (parsed OpenAPI or raw Markdown), application
106
+ profiles, feature notes, an overview matrix and one section per review with its own project rules.
107
+ Rules are never merged. The budget is split across reviews.
108
+ - There is no feature-level publish. Findings and summaries belong to reviews; feature notes/findings
109
+ are a non-published cross-project scratchpad. The feature aggregates reviews for navigation. See
110
+ [capabilities](capabilities.md#features).
111
+
67
112
  ## Idempotency and concurrency
68
113
 
69
114
  - Draft and finding writes go through a single process; SQLite in WAL mode.
@@ -0,0 +1,227 @@
1
+ # Capabilities and design decisions
2
+
3
+ [English](capabilities.md) | [Русский](ru/capabilities.md)
4
+
5
+ This document is the single, current description of what revdeck can do and why the product is built
6
+ this way. It also records the decisions behind the daemon-first architecture, project scopes and
7
+ cross-project features.
8
+
9
+ ## Product model
10
+
11
+ revdeck is a local, agent-first code review tool for GitLab and GitHub. One user runs one daemon on the
12
+ host; agents, the CLI and the browser UI are clients.
13
+
14
+ ```text
15
+ agent (MCP/CLI) ──unix socket──▶ revdeck daemon ──glab/gh──▶ GitLab / GitHub
16
+ │
17
+ SQLite + Svelte UI ◀── human
18
+ ```
19
+
20
+ The core guarantees:
21
+
22
+ - **The human publishes.** Agents write drafts (summaries, findings, replies, line comments). A human
23
+ approves the exact plan in the UI or CLI; the daemon then posts it. An agent cannot create an
24
+ approval.
25
+ - **Tokens stay on the host.** The daemon calls `glab`/`gh`; platform tokens are not passed over RPC
26
+ and are scrubbed from child environments.
27
+ - **Project rules are explicit.** For changed paths revdeck selects repository documents and exact
28
+ sections (`AGENTS.md`, architecture, style guides, ADRs).
29
+ - **One local database.** Reviews, projects, features, drafts, approvals and audit live in SQLite in
30
+ the user's state directory.
31
+ - **Agent work is review-only.** Checks are planned by the agent and run only after human consent.
32
+ Publishing, resolving and approvals remain human actions.
33
+
34
+ ## Reviews
35
+
36
+ - GitLab MR and GitHub PR are normalized into one model: ref, description, author, state, branches,
37
+ commits, diff, threads, notes and reactions.
38
+ - Open a review by number, URL, project reference or the current branch; multiple reviews can be
39
+ opened in one call.
40
+ - Local triage queue with cached snapshots; background sync and SSE keep the UI fresh.
41
+ - Unified diff with per-file hunks, line numbers in old/new versions, changed-file filters and
42
+ viewed-state per review.
43
+ - Threads: read, reply, resolve, react; line comments from the human; reactions on MR/PR and notes.
44
+ - Edit and delete your own platform comments.
45
+ - Attachments: upload raster images and videos to GitLab project uploads and insert a markdown link;
46
+ GitHub attachments are not supported by its public API.
47
+ - Review summary, findings with severity (`blocker`/`major`/`minor`/`question`), stable finding ids,
48
+ decisions (`accept`/`reject`/`discuss`), private agent notes and publish status.
49
+ - Multi-agent review roles and shards (`review.agents`, `review.roles`, custom roles); the daemon
50
+ stores the lead's merged result.
51
+ - Analytics: accepted/rejected/pending findings, acceptance rate, threads, drafts, rejected
52
+ suggestions.
53
+ - Optional secret scan with masked previews only.
54
+ - Optional review version history by head/base SHA.
55
+ - Change groups: explicit or derived by file kind/module.
56
+ - Project checks: argv without a shell, path scoping, explicit `--run --yes` confirmation.
57
+ - Read-only reviews: drafts, findings, comments, reactions, checks and publishing are disabled.
58
+ - Export/import of the legacy file format.
59
+
60
+ ## Agent interfaces
61
+
62
+ - **MCP server** over stdio with tools for status, list, open, context, threads, diff, rules, draft
63
+ replies, draft findings, summary, line notes, feature context/notes, publish preview and publish.
64
+ - **CLI** with the same capabilities for harnesses without MCP.
65
+ - **Skill** (`skills/revdeck`) carrying the review procedure, criteria, feedback workflow and
66
+ cross-project feature workflow.
67
+ - MCP prompts `review-mr`, `close-feedback` and `review-feature`.
68
+ - Context is deterministic and size-limited: summary, changed files, effective rules, threads,
69
+ findings, drafts and next actions.
70
+ - The agent cannot publish, resolve threads, approve/merge or call platform CLIs directly.
71
+ - Publication requires an approval bound to a hash of the exact plan; `publish.commit` is idempotent
72
+ and skips already-posted items.
73
+
74
+ ## Projects
75
+
76
+ A project is a repository, not a "frontend" or "backend" kind.
77
+
78
+ - Stable key `platform:host/project`, normalized for comparison; display values are kept separately.
79
+ - Project registry and working-copy roots (`projects`, `project_roots`); one project can have several
80
+ clones/worktrees.
81
+ - Reviews carry `projectKey`; the UI, HTTP API and CLI can filter by project or working-copy root.
82
+ - `revdeck projects` lists projects, roots and review counts; `revdeck projects add <path>` registers a
83
+ project before its first review.
84
+ - The UI has a project switcher and a projects home; only the selected project's reviews are shown.
85
+ The selection is stored in the URL and local storage.
86
+ - An MCP server is scoped to the repository it runs in: status/list/open only see that project, and a
87
+ review id or URL from another project is rejected. `REVDECK_ROOT` supports multi-root workspaces.
88
+ - Devcontainers mount a stable bridge to the host daemon; the container never starts its own daemon.
89
+ - Cross-project work is possible only through an explicit feature.
90
+
91
+ ## Features
92
+
93
+ A feature is a human-created bundle of reviews from one or more projects. It is not a project and not
94
+ a permanent project link; a project appears in a feature while at least one of its reviews is a member.
95
+
96
+ - Title, Markdown brief (goal, non-goals, rollout order, acceptance criteria), separate Markdown or
97
+ OpenAPI contract, status (`open`/`archived`).
98
+ - Ordered reviews with free-form roles (`api`, `ui`, `worker`, `mobile`); several reviews from one
99
+ project are allowed.
100
+ - **OpenAPI contract:** parsed into operations, parameters, request bodies, responses and schemas. The
101
+ feature context marks which changed reviews mention each operation path.
102
+ - **Application profiles:** `context.sources` / `context.maxBytes` in each repository; included once
103
+ per project as background, never as review criteria.
104
+ - **Feature notes/findings:** cross-project notes stored on the feature, visible in the UI and context.
105
+ They are never published. Humans write them in the UI/CLI; an agent may write them only in a feature
106
+ session through `revdeck_feature_note`, and may change/delete only notes authored by an agent.
107
+ Note and profile text is treated as data, not instructions.
108
+ - **Project session:** sees its project and features that include it; may read the combined feature
109
+ context, but writes drafts only in its own project.
110
+ - **Feature session:** started explicitly with `REVDECK_FEATURE=<id>`. The current repository must be a
111
+ member; the scope covers only members. Drafts may be written to any member. Publishing remains per
112
+ review and requires human approval. Feature notes may be written.
113
+ - Feature membership is revalidated on tool calls: removing the current project/review revokes access.
114
+ - Combined context contains the brief, parsed contract or raw Markdown, application profiles, feature
115
+ notes, an overview matrix and one section per review with its own project rules. Rules are never
116
+ merged; the budget is split across reviews.
117
+ - UI: feature list, feature page with project groups, roles, contract, notes, context preview, agent
118
+ command, archive, delete, reorder and add-review flows.
119
+ - CLI: `revdeck feature list|create|get|add|remove|reorder|notes|note|note-delete|context|update|archive|delete`.
120
+ - MCP: `revdeck_feature` (read-only list/get/context/notes) and `revdeck_feature_note` (feature session
121
+ only, never published).
122
+ - Removing a tracked review that belongs to a feature is blocked until it is removed from the feature.
123
+ - There is no feature-level publish; findings and summaries belong to their reviews.
124
+
125
+ ## User interface
126
+
127
+ - Local Svelte 5 SPA served by the daemon with a one-time launch token and cookie session.
128
+ - Project switcher, projects home, feature list and feature page.
129
+ - Review tabs: Overview, Threads, Findings, Diff, Rules, Analytics.
130
+ - Keyboard shortcuts (`1`–`5`, `o`, `r`, `s`, `p`, `?`), command palette, deep links to threads,
131
+ findings and diff lines with browser Back/Forward.
132
+ - Markdown preview, attachment button, reactions, line comments, publish dialog with exact plan.
133
+ - Russian and English interface; language is independent from the language of review output.
134
+ - Responsive sidebar and mobile backdrop; dark/light theme via CSS variables.
135
+
136
+ ## Security and trust
137
+
138
+ - Unix socket with `0700` directory and `0600` socket; loopback UI only; `Host`/`Origin` checks,
139
+ `HttpOnly` `SameSite=Strict` cookie, CSP.
140
+ - Platform CLI calls without a shell, outside the working copy, with a scrubbed environment; secrets
141
+ redacted in logs and errors.
142
+ - MR text, comments and diff are untrusted data; the skill and context say so.
143
+ - Comment sanitizer blocks HTML, control/bidi characters, GitLab quick actions and mass mentions;
144
+ external images are links, not loads.
145
+ - Approvals are random, single-use, TTL-bound and tied to the review and plan hash.
146
+ - Project and feature scopes are **context isolation**, not a security boundary: one daemon and one
147
+ database remain; a process with access to the user's home can read them.
148
+ - Hard isolation would require a separate daemon/state directory under another user/container; that is
149
+ outside the current model and breaks cross-project review.
150
+
151
+ ## Configuration
152
+
153
+ `.revdeck.yml` (or `.revdeck.yaml`) at the repository root, with personal `.revdeck.local.yml`
154
+ overrides:
155
+
156
+ - `version`, `provider` (`type`, `host`, `project`, `base`), `output.language`.
157
+ - `review`: agents, roles, custom roles, groups, secrets, history, readOnly.
158
+ - `context`: application-profile sources and `maxBytes`.
159
+ - `rules`: sources, path map, ignore, document/total limits.
160
+ - `checks`: id, name, argv, path conditions, consent, timeout.
161
+ - `publish`: approval requirement, max comments.
162
+
163
+ Explicit CLI arguments override config, config overrides the git remote; this prevents redirecting a
164
+ review by tampering with `.git/config`. The schema is validated by zod and unknown fields fail with a
165
+ path.
166
+
167
+ ## Operations
168
+
169
+ - `revdeck init`: config, skill, harness adapters and MCP config; idempotent, never overwrites foreign
170
+ keys.
171
+ - `revdeck eject`: inverse operation; plan by default, `--yes` to apply, `--keep-config` to keep the
172
+ config.
173
+ - `revdeck doctor`: Node, git, `glab`/`gh` auth, daemon, adapters; knows about devcontainers.
174
+ - Daemon lifecycle: start/stop/restart/status/logs/install/uninstall; systemd user unit on Linux,
175
+ launchd on macOS.
176
+ - Devcontainer bridge: stable socket/state mounts; host-side `glab`/`gh`; no daemon in the container.
177
+ - HTTP transport for containers where the socket is not forwarded (`REVDECK_URL`, `REVDECK_TOKEN`).
178
+ - Export/import for sandboxes without a socket.
179
+ - Linux and macOS autostart; Windows runs manually.
180
+
181
+ ## Architecture decisions
182
+
183
+ ### Daemon-first
184
+
185
+ A long-lived user-owned daemon holds credentials, SQLite, providers, RPC, HTTP/SSE and the UI. CLI and
186
+ MCP are thin clients. The alternative — an MCP process per session without a daemon — was rejected
187
+ because the UI would not survive the session, agents would compete for state, tokens would end up in
188
+ the agent process and containers would still need a host process. File exchange remains only as
189
+ `export`/`import`.
190
+
191
+ Consequences: daemon lifecycle, socket permissions, a bridge for containers, version-matched clients,
192
+ background sync and SSE. One daemon serves several repositories; `root` is passed on open and config is
193
+ read from that root.
194
+
195
+ ### Project scopes
196
+
197
+ A project is a repository. The key is `platform:host/project`; reviews carry it and the daemon keeps a
198
+ registry with working-copy roots. The UI and CLI are project-scoped; the MCP server is scoped to the
199
+ repository it runs in. A per-project daemon/database was rejected: it breaks cross-project review,
200
+ adds ports/services/backups and is still not a security boundary against the same user.
201
+
202
+ Consequences: migration/backfill, project-scoped MCP errors, multi-root workspace configuration, and
203
+ explicit context-only isolation.
204
+
205
+ ### Explicit features
206
+
207
+ Because projects are isolated, cross-project work needs an explicit human-created feature. The feature
208
+ is the only door: membership is chosen per task; project sessions read the combined context but write
209
+ only in their project; a feature session may write across members, with per-review publishing. A
210
+ permanent project link or automatic cross-project discovery was rejected because it leaks contexts into
211
+ unrelated tasks.
212
+
213
+ Consequences: feature notes are non-published, contracts and profiles are human-provided, feature
214
+ sessions are explicit, and removing membership revokes access on the next tool call.
215
+
216
+ ## Non-goals and limitations
217
+
218
+ - Replacing the native GitLab/GitHub diff viewer; the UI is for triage and approval.
219
+ - Built-in static analysis; checks are delegated to the project's tools.
220
+ - A multi-user server or role-based authorization.
221
+ - Hard security isolation between projects; see the caveat above.
222
+ - Native draft notes/pending reviews (providers are ready, publishing uses regular comments).
223
+ - GitHub attachment upload via public API.
224
+ - Automatic OpenAPI-based static validation of client code: the contract is parsed and given to the
225
+ agent; the agent validates the implementation.
226
+ - Feature-level publishing or automatically publishing a whole feature.
227
+ - Source checkout of other repositories in a feature context: only review data, profiles and contracts.
@@ -17,6 +17,9 @@ output:
17
17
  review:
18
18
  agents: 3
19
19
  roles: [correctness, architecture, tests]
20
+ context:
21
+ sources: [docs/AppContext.md] # application profile, not review rules
22
+ maxBytes: 30000
20
23
  rules:
21
24
  sources: [AGENTS.md]
22
25
  map:
@@ -72,6 +75,59 @@ Explicit CLI arguments (`--platform`, `--project`, `--host`) take precedence ove
72
75
  config takes precedence over the git remote. This way, tampering with `.git/config` cannot redirect the
73
76
  review to a different project.
74
77
 
78
+ ## Project identity
79
+
80
+ A project is a repository. Its key is `platform:host/project`, normalized for comparison (host and
81
+ path are lower-cased; the original values are kept for display). One repository can have several
82
+ working-copy roots, but they are one project.
83
+
84
+ The key is derived from `provider` (or the git remote) and stored in the daemon registry. There is no
85
+ `kind` field: "api", "web" or "mobile" are not project types, and a project does not need them. A
86
+ review always uses the config and rules from its own working-copy root, so several roots of the same
87
+ project do not mix their rules.
88
+
89
+ ```bash
90
+ revdeck projects # list projects, review counts and roots
91
+ revdeck projects add /path/repo # register a project before its first review
92
+ ```
93
+
94
+ The UI and agent scope are described in [architecture.md](architecture.md) and
95
+ [capabilities](capabilities.md#project-scopes).
96
+
97
+ ## Features and contracts
98
+
99
+ Features are not `.revdeck.yml` settings: they are local daemon records created by a human in the UI
100
+ or CLI. A feature has a title, a Markdown **brief**, a separate **contract** (Markdown or OpenAPI) and
101
+ an ordered set of reviews. Put the task goal, non-goals, rollout order and acceptance criteria into the
102
+ brief; put the API/event contract into the contract field. OpenAPI is parsed into operations and
103
+ schemas, and the feature context marks which changed reviews mention each path. Each member review
104
+ keeps its own `.revdeck.yml` and rules; the brief and contract never override them.
105
+
106
+ Application profiles are background documents, not review criteria. Declare them per repository:
107
+
108
+ ```yaml
109
+ context:
110
+ sources: [docs/AppContext.md, docs/API.md]
111
+ maxBytes: 30000
112
+ ```
113
+
114
+ `maxBytes` is the aggregate limit for the project profile; `0` uses the feature-context budget. The
115
+ feature context itself is capped by `revdeck feature context --max-bytes` (or the MCP `max_bytes`).
116
+ Profile and note text is quoted and treated as data, not instructions.
117
+
118
+ Feature notes/findings are stored on the feature and are never published. Publishing remains per
119
+ review.
120
+
121
+ ```bash
122
+ revdeck feature create "Checkout v2" --brief brief.md --contract openapi.yaml \
123
+ <review-id> <review-id>
124
+ revdeck feature context ft-a1b2c3
125
+ revdeck feature note ft-a1b2c3 --title "Contract gap" --body "Client is missing a header" --kind finding --level major
126
+ ```
127
+
128
+ To start a feature-scoped agent session, run the MCP server from a repository that is a feature
129
+ member with `REVDECK_FEATURE=<feature id>`. Project rules are still read from each member's own root.
130
+
75
131
  ## output
76
132
 
77
133
  - `language: auto` — findings and replies are written in the language of the MR description and
@@ -283,6 +339,7 @@ confirmation. Read-only reviews disable the runner. The MCP tool only shows the
283
339
  | `REVDECK_DEV_CONTAINER=1` | do not start a local daemon; fail with a host-daemon hint instead |
284
340
  | `REVDECK_UI_HOST` | host used by `revdeck ui` from a container (for example `host.docker.internal`) |
285
341
  | `REVDECK_ROOT` | project root for the MCP server |
342
+ | `REVDECK_FEATURE` | feature id for a feature-scoped MCP session; the current project must be a member |
286
343
  | `REVDECK_LANG` | CLI/MCP/daemon language: `ru` or `en` (default: system locale) |
287
344
  | `REVDECK_GLAB` | absolute path to `glab` when the daemon PATH does not contain it |
288
345
  | `REVDECK_GH` | absolute path to `gh` when the daemon PATH does not contain it |
@@ -291,3 +348,9 @@ confirmation. Read-only reviews disable the runner. The MCP tool only shows the
291
348
 
292
349
  `revdeck config --json` shows the effective config, the path where it was found, and warnings.
293
350
  `revdeck rules --explain src/app.ts` shows which documents and sections were selected for the file.
351
+
352
+ ## Example configurations
353
+
354
+ Runnable examples live in [examples](../examples/): `simple.yml`, `monorepo.yml` and
355
+ `analytics-platform.yml`. The test suite parses every example, checks its path map and checks, and
356
+ verifies that each example selects at least one check for a changed source file.
@@ -75,6 +75,8 @@ For Claude Code, add the tools to `.claude/settings.local.json` (personal) or `.
75
75
  "mcp__revdeck__revdeck_diff",
76
76
  "mcp__revdeck__revdeck_rules",
77
77
  "mcp__revdeck__revdeck_notes",
78
+ "mcp__revdeck__revdeck_feature",
79
+ "mcp__revdeck__revdeck_feature_note",
78
80
  "mcp__revdeck__revdeck_set_summary",
79
81
  "mcp__revdeck__revdeck_draft_findings",
80
82
  "mcp__revdeck__revdeck_draft_reply",
@@ -173,6 +175,39 @@ Fallbacks:
173
175
  with the daemon started on the host with `--host 0.0.0.0`.
174
176
  2. `revdeck export <N>` on the host and `revdeck import <N>` in the container — a file bridge.
175
177
 
178
+ ## Several projects and devcontainers
179
+
180
+ Each repository is its own project. A `.mcp.json` (or `.cursor/mcp.json`) inside the repository pins
181
+ the MCP server to that repository; the server resolves the project from its root and lists only that
182
+ project's reviews. With one devcontainer per repository, each container mounts the same host daemon
183
+ bridge and stays scoped to its own working copy.
184
+
185
+ For a multi-root workspace with several repositories, add one MCP server entry per project with an
186
+ explicit `REVDECK_ROOT` and a unique server name. The server does not accept a `root` or project
187
+ override from the agent, so one session cannot open another project's review. `revdeck projects`
188
+ lists the registry; `revdeck projects add <path>` registers a repository before its first review.
189
+
190
+ Cross-project work goes through an explicit feature (above); outside a feature a foreign review is
191
+ rejected with a hint to open a separate session. See [capabilities](capabilities.md#features).
192
+
193
+ ## Feature sessions
194
+
195
+ A project session is scoped to one repository. To let one agent review a feature that spans several
196
+ projects, start the MCP server from a repository that is a feature member with:
197
+
198
+ ```bash
199
+ REVDECK_FEATURE=ft-a1b2c3 revdeck mcp
200
+ ```
201
+
202
+ In an MCP config this is the `REVDECK_FEATURE` value in the `revdeck` server's `env`. The server
203
+ validates that the current project is a member and expands the scope only to the feature's reviews. Drafts may be written to any member; publishing still needs a separate human approval for
204
+ each review. Feature membership is created by the human in the UI or CLI, never by the agent.
205
+
206
+ In a devcontainer the same rule applies: the container's repository must be a feature member, and the
207
+ server talks to the host daemon over the same bridge. The combined context is review data plus the
208
+ declared `context.sources` profile files from member checkouts; symlinked paths outside a member root
209
+ are rejected. Arbitrary source trees of other repositories are not read.
210
+
176
211
  ## Verification
177
212
 
178
213
  ```bash
package/docs/protocol.md CHANGED
@@ -41,7 +41,22 @@ authorization is enforced by the socket file's permissions.
41
41
  | Method | Parameters | Result |
42
42
  |---|---|---|
43
43
  | `ping` | — | version, protocol, pid |
44
- | `reviews.list` | — | saved reviews |
44
+ | `projects.list` | — | registered projects with review counts and roots |
45
+ | `projects.register` | `root` | project resolved from that working copy |
46
+ | `reviews.list` | `project?` / `root?` | saved reviews, optionally scoped to one project |
47
+ | `features.list` | `project?`, `includeArchived?` | feature summaries |
48
+ | `features.get` | `feature` | feature with ordered members and roles |
49
+ | `features.create` | `title`, `brief?`, `contract?`, `reviews?` | create a human feature |
50
+ | `features.update` | `feature`, `title?`, `brief?`, `contract?`, `status?` | edit/archive a feature |
51
+ | `features.addReviews` | `feature`, `reviews[{review, role?}]` | add/update members |
52
+ | `features.removeReview` | `feature`, `review` | remove a member |
53
+ | `features.reorder` | `feature`, `reviews[]` | set member order |
54
+ | `features.delete` | `feature` | delete a feature (not its reviews) |
55
+ | `features.addNote` | `feature`, `kind?`, `level?`, `title`, `body`, `author?` | non-published feature note/finding |
56
+ | `features.updateNote` | `feature`, `note`, `kind?`, `level?`, `title?`, `body?` | update a note |
57
+ | `features.deleteNote` | `feature`, `note` | delete a note |
58
+ | `features.forReview` | `review` | features containing a review |
59
+ | `features.context` | `feature`, `maxBytes?` | combined brief + review context |
45
60
  | `reviews.remoteList` | `root`, `scope`, `limit` | open reviews from the platform |
46
61
  | `reviews.open` | `root`, `input`/`platform`/`project`/`host`/`branch` | review snapshot |
47
62
  | `reviews.refresh` | `review` | refreshed snapshot |
@@ -69,6 +84,39 @@ authorization is enforced by the socket file's permissions.
69
84
  | `checks.run` | `review`, `allowRun`, `ids[]` | check results |
70
85
  | `audit.tail` | `limit` | latest actions |
71
86
 
87
+ ## Project scope
88
+
89
+ A project is a repository, identified by `platform:host/project`. `projects.list` returns the
90
+ registry (`key`, display fields, `roots`, review count, last activity). `reviews.list` with `project`
91
+ or `root` returns only that project's reviews; without either it returns everything (for humans and
92
+ debugging).
93
+
94
+ This filter is an API convenience, not a security boundary: the daemon serves one local user. The
95
+ isolation for agents is enforced by the MCP server, which resolves its project from the working copy
96
+ at startup, passes `project` on every list and rejects a review id/URL from another project. The MCP
97
+ tools do not accept `root` or project overrides.
98
+
99
+ ## Feature scope
100
+
101
+ A feature is a human-created bundle of reviews (`features`, `feature_reviews`) with a title, brief, a
102
+ separate Markdown/OpenAPI contract, application profiles from `context.sources`, and non-published
103
+ notes/findings. `features.context` returns a Markdown document with the brief, parsed contract (or raw
104
+ Markdown), profiles, notes, an overview matrix and one section per member review, using each review's
105
+ own rules. It is read-only.
106
+
107
+ The MCP server has two scopes:
108
+
109
+ - **Project session** (default): lists reviews of one project and features that include it; a foreign
110
+ review id/URL is rejected. `revdeck_feature` can read a feature's combined context, but review tools
111
+ write only in the current project.
112
+ - **Feature session** (`REVDECK_FEATURE=<feature id>`): the current repository must be a member. The
113
+ scope covers only members; review tools may write drafts to any member. Publishing remains per
114
+ review and requires the usual human approval. Feature notes are writable only in a feature session,
115
+ and MCP can change only notes authored by an agent.
116
+
117
+ The daemon does not enforce the MCP scope; it is a local single-user service. The MCP server is the
118
+ isolation boundary. Feature membership is the only explicit cross-project door.
119
+
72
120
  ## Approval
73
121
 
74
122
  1. `publish.preview` builds `items` — the exact bodies, paths, lines, and resolve flags — and
@@ -88,7 +136,9 @@ in the CLI with `--yes`.
88
136
  | GET | `/` | SPA; `?t=<token>` sets the cookie and redirects |
89
137
  | GET | `/assets/*` | static build assets |
90
138
  | GET | `/api/health` | liveness |
91
- | GET | `/api/reviews` | review list |
139
+ | GET | `/api/projects` | registered projects |
140
+ | GET | `/api/reviews?project=` | review list, optionally scoped |
141
+ | POST | `/api/projects/register` | register the project of a working copy |
92
142
  | GET | `/api/state?review=` | snapshot for the UI |
93
143
  | GET | `/api/diff?review=&file=` | file hunks |
94
144
  | GET | `/api/rules?review=` | rules |
package/docs/ru/README.md CHANGED
@@ -7,11 +7,11 @@
7
7
 
8
8
  | Документ | Английский | Русский |
9
9
  |---|---|---|
10
+ | Возможности и решения | [../capabilities.md](../capabilities.md) | [capabilities.md](capabilities.md) |
10
11
  | Архитектура | [../architecture.md](../architecture.md) | [architecture.md](architecture.md) |
11
12
  | Конфигурация и правила | [../configuration.md](../configuration.md) | [configuration.md](configuration.md) |
12
13
  | Протокол RPC и HTTP | [../protocol.md](../protocol.md) | [protocol.md](protocol.md) |
13
14
  | Модель угроз | [../threat-model.md](../threat-model.md) | [threat-model.md](threat-model.md) |
14
15
  | Интеграции с харнессами | [../integrations.md](../integrations.md) | [integrations.md](integrations.md) |
15
- | ADR-0001: демон-first | [../adr/0001-daemon-first.md](../adr/0001-daemon-first.md) | [adr/0001-daemon-first.md](adr/0001-daemon-first.md) |
16
16
 
17
17
  Начните с [README](../../README.ru.md): установка, команды и настройка MCP.