revdeck 0.5.0 → 0.7.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 (60) hide show
  1. package/CHANGELOG.md +105 -2
  2. package/README.md +102 -22
  3. package/README.ru.md +105 -29
  4. package/SECURITY.md +1 -1
  5. package/dist/cli.js +1484 -593
  6. package/dist/cli.js.map +4 -4
  7. package/dist/daemon.js +1768 -283
  8. package/dist/daemon.js.map +4 -4
  9. package/dist/mcp.js +980 -117
  10. package/dist/mcp.js.map +4 -4
  11. package/dist/ui/assets/index-BIVPy49b.css +1 -0
  12. package/dist/ui/assets/index-BcvEWwhI.js +18 -0
  13. package/dist/ui/favicon.svg +8 -3
  14. package/dist/ui/icon-128.png +0 -0
  15. package/dist/ui/icon-32.png +0 -0
  16. package/dist/ui/index.html +4 -2
  17. package/docs/README.md +4 -1
  18. package/docs/architecture.md +60 -11
  19. package/docs/assets/brand/README.md +49 -0
  20. package/docs/assets/brand/icon-1024.png +0 -0
  21. package/docs/assets/brand/icon-128.png +0 -0
  22. package/docs/assets/brand/icon-256.png +0 -0
  23. package/docs/assets/brand/icon-32.png +0 -0
  24. package/docs/assets/brand/icon-512.png +0 -0
  25. package/docs/assets/brand/icon-64.png +0 -0
  26. package/docs/assets/brand/icon.svg +9 -0
  27. package/docs/assets/brand/logo-dark.png +0 -0
  28. package/docs/assets/brand/logo-dark.svg +13 -0
  29. package/docs/assets/brand/logo.png +0 -0
  30. package/docs/assets/brand/logo.svg +13 -0
  31. package/docs/capabilities.md +238 -0
  32. package/docs/configuration.md +87 -8
  33. package/docs/integrations.md +52 -14
  34. package/docs/protocol.md +85 -14
  35. package/docs/ru/README.md +4 -1
  36. package/docs/ru/architecture.md +60 -10
  37. package/docs/ru/capabilities.md +240 -0
  38. package/docs/ru/configuration.md +74 -6
  39. package/docs/ru/integrations.md +52 -14
  40. package/docs/ru/protocol.md +83 -13
  41. package/docs/ru/threat-model.md +34 -5
  42. package/docs/screenshot.png +0 -0
  43. package/docs/screenshot.ru.png +0 -0
  44. package/docs/threat-model.md +36 -5
  45. package/examples/analytics-platform.yml +40 -0
  46. package/examples/monorepo.yml +1 -1
  47. package/package.json +1 -1
  48. package/skills/revdeck/en/Feature.md +61 -0
  49. package/skills/revdeck/en/Feedback.md +3 -2
  50. package/skills/revdeck/en/Review.md +3 -2
  51. package/skills/revdeck/en/SKILL.md +17 -1
  52. package/skills/revdeck/ru/Feature.md +61 -0
  53. package/skills/revdeck/ru/Feedback.md +3 -2
  54. package/skills/revdeck/ru/Review.md +2 -2
  55. package/skills/revdeck/ru/SKILL.md +18 -1
  56. package/dist/ui/assets/index-CcmcJhhu.css +0 -1
  57. package/dist/ui/assets/index-CuvK5owY.js +0 -10
  58. package/docs/adr/0001-daemon-first.md +0 -65
  59. package/docs/ru/adr/0001-daemon-first.md +0 -63
  60. package/examples/web-chat-core.yml +0 -45
@@ -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:
@@ -40,7 +43,8 @@ publish:
40
43
 
41
44
  `revdeck` also reads `.revdeck.local.yml` (or `.revdeck.local.yaml`) next to the base config. Use it for
42
45
  local roles, checks, output language or provider settings without changing the shared file. `init`
43
- adds both local names to `.gitignore`.
46
+ adds both local names to `.gitignore`. If the file is **tracked by git**, it came from the repository
47
+ (not from the user) and is ignored as personal overrides; a warning is shown.
44
48
 
45
49
  Merge rules:
46
50
 
@@ -50,6 +54,13 @@ Merge rules:
50
54
  - local file alone is allowed, but a base `.revdeck.yml` is recommended for the team;
51
55
  - YAML/schema errors in the local file are reported, never silently ignored.
52
56
 
57
+ Rule and `context.sources` documents are read only if they are **tracked by git**, have a safe
58
+ extension (`.md`, `.mdx`, `.rst`, `.txt`, `.adoc`; profiles may also be `.yaml`, `.yml`, `.json`) and
59
+ do not match the secret deny-list (`.env*`, `.git/**`, `.npmrc`, `.revdeck.local.*`, `*.pem`, keys).
60
+ The opened file descriptor's realpath is checked inside the root, so a parent symlink swap cannot
61
+ escape the repository. In a directory without `.git` (tests, scratch dirs) the tracked check is
62
+ skipped.
63
+
53
64
  ```yaml
54
65
  # .revdeck.local.yml — do not commit
55
66
  review:
@@ -63,7 +74,7 @@ output:
63
74
 
64
75
  | Field | Default | Meaning |
65
76
  |---|---|---|
66
- | `type` | `auto` | `auto` — inferred from the git remote; otherwise an explicit platform |
77
+ | `type` | `auto` | `auto` — inferred from the git remote; otherwise an explicit platform. `revdeck init` writes the remote platform, or `gitlab` when the host is not recognized (`--provider` overrides it) |
67
78
  | `host` | from the remote | host without a scheme |
68
79
  | `project` | from the remote | GitLab `group/project`, GitHub `owner/repo` |
69
80
  | `base` | `develop`/`main` | base for the local diff |
@@ -72,6 +83,63 @@ Explicit CLI arguments (`--platform`, `--project`, `--host`) take precedence ove
72
83
  config takes precedence over the git remote. This way, tampering with `.git/config` cannot redirect the
73
84
  review to a different project.
74
85
 
86
+ ## Project identity
87
+
88
+ A project is a repository. Its key is `platform:host/project`, normalized for comparison (host and
89
+ path are lower-cased; the original values are kept for display). One repository can have several
90
+ working-copy roots, but they are one project.
91
+
92
+ The key is derived from `provider` (or the git remote) and stored in the daemon registry. There is no
93
+ `kind` field: "api", "web" or "mobile" are not project types, and a project does not need them. A
94
+ review always uses the config and rules from its own working-copy root, so several roots of the same
95
+ project do not mix their rules.
96
+
97
+ ```bash
98
+ revdeck projects # list projects, review counts and roots
99
+ revdeck projects add /path/repo # register a project before its first review
100
+ ```
101
+
102
+ In the projects home, **Add project** registers a working copy, **Edit** changes the display title
103
+ and the working-copy roots, and **Delete** removes the project and its cached reviews from revdeck.
104
+ MRs/PRs and comments on the platform are never touched by project deletion.
105
+
106
+ The UI and agent scope are described in [architecture.md](architecture.md) and
107
+ [capabilities](capabilities.md#project-scopes).
108
+
109
+ ## Features and contracts
110
+
111
+ Features are not `.revdeck.yml` settings: they are local daemon records created by a human in the UI
112
+ or CLI. A feature has a title, a Markdown **brief**, a separate **contract** (Markdown or OpenAPI) and
113
+ an ordered set of reviews. Put the task goal, non-goals, rollout order and acceptance criteria into the
114
+ brief; put the API/event contract into the contract field. OpenAPI is parsed into operations and
115
+ schemas, and the feature context marks which changed reviews mention each path. Each member review
116
+ keeps its own `.revdeck.yml` and rules; the brief and contract never override them.
117
+
118
+ Application profiles are background documents, not review criteria. Declare them per repository:
119
+
120
+ ```yaml
121
+ context:
122
+ sources: [docs/AppContext.md, docs/API.md]
123
+ maxBytes: 30000
124
+ ```
125
+
126
+ `maxBytes` is the aggregate limit for the project profile; `0` uses the feature-context budget. The
127
+ feature context itself is capped by `revdeck feature context --max-bytes` (or the MCP `max_bytes`).
128
+ Profile and note text is quoted and treated as data, not instructions.
129
+
130
+ Feature notes/findings are stored on the feature and are never published. Publishing remains per
131
+ review.
132
+
133
+ ```bash
134
+ revdeck feature create "Checkout v2" --brief brief.md --contract openapi.yaml \
135
+ <review-id> <review-id>
136
+ revdeck feature context ft-a1b2c3
137
+ revdeck feature note ft-a1b2c3 --title "Contract gap" --body "Client is missing a header" --kind finding --level major
138
+ ```
139
+
140
+ To start a feature-scoped agent session, run the MCP server from a repository that is a feature
141
+ member with `REVDECK_FEATURE=<feature id>`. Project rules are still read from each member's own root.
142
+
75
143
  ## output
76
144
 
77
145
  - `language: auto` — findings and replies are written in the language of the MR description and
@@ -252,8 +320,10 @@ alternative. Examples: `src/**/*.ts`, `docs/{guides,adr}/**`, `**/*.test.ts`.
252
320
 
253
321
  ## checks
254
322
 
255
- Checks are argv arrays, not shell strings. This matters: the config lives in the repository, and a shell
256
- string would allow arbitrary code to be executed during a review.
323
+ Checks are argv arrays that execute code on the host. The repository controls them, so they are
324
+ human-only: the devcontainer bridge denies `checks.run`, and the CLI refuses `--run` inside a
325
+ container. `argv: ["sh","-c","…"]` is still an argv array and executes arbitrary code — read the full
326
+ command before confirming.
257
327
 
258
328
  | Field | Meaning |
259
329
  |---|---|
@@ -261,11 +331,13 @@ string would allow arbitrary code to be executed during a review.
261
331
  | `name` | display name |
262
332
  | `argv` | command and arguments; the executable comes first |
263
333
  | `when` | glob paths: run only if the diff touched them; empty — always |
264
- | `consent` | requires explicit confirmation (default `true`) |
334
+ | `consent` | deprecated and ignored: checks always require a human UI/host-CLI run |
265
335
  | `timeoutMs` | timeout (default 300,000) |
266
336
 
267
- Running: `revdeck checks <N> --run --yes`, or **Run matching** in the Rules tab with an explicit
268
- confirmation. Read-only reviews disable the runner. The MCP tool only shows the plan.
337
+ Running: a human uses **Run matching** in the Rules tab (the dialog shows the full argv) or
338
+ `revdeck checks <N> --run --yes` on the host; `revdeck checks` prints the commands first. Read-only
339
+ reviews disable the runner. The agent can only show the plan; the bridge returns `CAPABILITY` for
340
+ `checks.run`. Host checks are not sandboxed yet.
269
341
 
270
342
  ## publish
271
343
 
@@ -279,10 +351,11 @@ confirmation. Read-only reviews disable the runner. The MCP tool only shows the
279
351
  |---|---|
280
352
  | `REVDECK_STATE_DIR` | state directory (default `~/.local/state/revdeck`) |
281
353
  | `REVDECK_RUNTIME_DIR` | socket directory (default `$XDG_RUNTIME_DIR/revdeck`) |
282
- | `REVDECK_URL` + `REVDECK_TOKEN` | connect to the daemon over HTTP (container/port forwarding) |
354
+ | `REVDECK_URL` + `REVDECK_TOKEN` | connect to the daemon over HTTP (container/port forwarding); the token is agent-scoped, not the UI token |
283
355
  | `REVDECK_DEV_CONTAINER=1` | do not start a local daemon; fail with a host-daemon hint instead |
284
356
  | `REVDECK_UI_HOST` | host used by `revdeck ui` from a container (for example `host.docker.internal`) |
285
357
  | `REVDECK_ROOT` | project root for the MCP server |
358
+ | `REVDECK_FEATURE` | feature id for a feature-scoped MCP session; the current project must be a member |
286
359
  | `REVDECK_LANG` | CLI/MCP/daemon language: `ru` or `en` (default: system locale) |
287
360
  | `REVDECK_GLAB` | absolute path to `glab` when the daemon PATH does not contain it |
288
361
  | `REVDECK_GH` | absolute path to `gh` when the daemon PATH does not contain it |
@@ -291,3 +364,9 @@ confirmation. Read-only reviews disable the runner. The MCP tool only shows the
291
364
 
292
365
  `revdeck config --json` shows the effective config, the path where it was found, and warnings.
293
366
  `revdeck rules --explain src/app.ts` shows which documents and sections were selected for the file.
367
+
368
+ ## Example configurations
369
+
370
+ Runnable examples live in [examples](../examples/): `simple.yml`, `monorepo.yml` and
371
+ `analytics-platform.yml`. The test suite parses every example, checks its path map and checks, and
372
+ 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",
@@ -129,8 +131,8 @@ revdeck devcontainer # print the mounts and environment
129
131
  revdeck devcontainer --write # merge them into .devcontainer/devcontainer.json
130
132
  ```
131
133
 
132
- `--write` mounts the stable bridge `~/.local/state/revdeck/devcontainer/run` (socket) and
133
- `~/.local/state/revdeck/devcontainer/state` (read-only `daemon.json`) and sets:
134
+ `--write` mounts the stable bridge `~/.local/state/revdeck/devcontainer/run` (agent-scoped socket) and
135
+ `~/.local/state/revdeck/devcontainer/state` (read-only info `daemon.json`: capabilities and an agent-scoped token, no UI token) and sets:
134
136
 
135
137
  ```json
136
138
  {
@@ -151,28 +153,64 @@ the container. Inside the container `revdeck` never starts its own daemon: if th
151
153
  it fails with a `DEVCONTAINER` error and a hint. `revdeck doctor` does not look for `glab`/`gh` in the
152
154
  container.
153
155
 
154
- On macOS with Docker Desktop the host Unix socket is not proxied. The bridge `daemon.json` is readable
155
- by the container user (`run`/`state` are `0755`, the file is `0644`, while the private parent stays
156
- `0700`), and the loopback HTTP server accepts `Host: host.docker.internal`; `revdeck daemon restart` is
157
- enough. On Linux, if the socket is not reachable, use `revdeck daemon restart --host 0.0.0.0` (or
158
- `revdeck daemon install --host 0.0.0.0` for a service); this exposes the HTTP port to the network, so
159
- use it only on a trusted network. The container reads `daemon.json`, falls back to HTTP with the same
160
- session token, and no token is written to the repository.
156
+ On macOS with Docker Desktop the host Unix socket is not proxied. The bridge is agent-scoped: it allows
157
+ `read`/`draft` only, and its `daemon.json` contains no UI token. The UI is opened on the host; the
158
+ container uses the mounted socket. If the socket is not reachable, set `REVDECK_URL` +
159
+ `REVDECK_TOKEN` from the user's environment (an agent-scoped token); there is no automatic HTTP
160
+ fallback with the UI token.
161
+
162
+ On Linux, if the socket is not reachable, the same `REVDECK_URL` + `REVDECK_TOKEN` path applies. Do not
163
+ expose the UI token to the container; `--host 0.0.0.0` is for a browser on another trusted machine,
164
+ not for giving the agent more rights.
161
165
 
162
166
  `revdeck devcontainer --write` adds the `REVDECK_*` variables to the `revdeck` MCP server in `.mcp.json`
163
167
  and `.cursor/mcp.json` inside the repository. A user-level MCP configuration outside the repository
164
168
  needs the same variables manually, otherwise it may start a second daemon in the container.
165
169
 
166
- The container user must be able to connect to the host socket (normally the same UID; the socket is
167
- 0600). To open the UI from the container, start the host daemon with `revdeck daemon start --host
168
- 0.0.0.0` and use `host.docker.internal`; otherwise open the UI on the host.
170
+ The container user must be able to connect to the host bridge socket (the bridge socket is `0666`
171
+ inside the mounted directory `0755`; its methods are limited by the `read`/`draft` capability). The UI
172
+ is opened on the host with `revdeck ui`; the UI token is not passed to the container.
169
173
 
170
174
  Fallbacks:
171
175
 
172
- 1. `REVDECK_URL=http://host.docker.internal:<port>` and `REVDECK_TOKEN=<token>` — the HTTP transport,
173
- with the daemon started on the host with `--host 0.0.0.0`.
176
+ 1. `REVDECK_URL=http://host.docker.internal:<port>` and `REVDECK_TOKEN=<agent-scoped-token>` — the
177
+ HTTP transport, with the daemon started on the host with `--host 0.0.0.0`; the token is
178
+ agent-scoped and must not be the UI token.
174
179
  2. `revdeck export <N>` on the host and `revdeck import <N>` in the container — a file bridge.
175
180
 
181
+ ## Several projects and devcontainers
182
+
183
+ Each repository is its own project. A `.mcp.json` (or `.cursor/mcp.json`) inside the repository pins
184
+ the MCP server to that repository; the server resolves the project from its root and lists only that
185
+ project's reviews. With one devcontainer per repository, each container mounts the same host daemon
186
+ bridge and stays scoped to its own working copy.
187
+
188
+ For a multi-root workspace with several repositories, add one MCP server entry per project with an
189
+ explicit `REVDECK_ROOT` and a unique server name. The server does not accept a `root` or project
190
+ override from the agent, so one session cannot open another project's review. `revdeck projects`
191
+ lists the registry; `revdeck projects add <path>` registers a repository before its first review.
192
+
193
+ Cross-project work goes through an explicit feature (above); outside a feature a foreign review is
194
+ rejected with a hint to open a separate session. See [capabilities](capabilities.md#features).
195
+
196
+ ## Feature sessions
197
+
198
+ A project session is scoped to one repository. To let one agent review a feature that spans several
199
+ projects, start the MCP server from a repository that is a feature member with:
200
+
201
+ ```bash
202
+ REVDECK_FEATURE=ft-a1b2c3 revdeck mcp
203
+ ```
204
+
205
+ In an MCP config this is the `REVDECK_FEATURE` value in the `revdeck` server's `env`. The server
206
+ 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
207
+ each review. Feature membership is created by the human in the UI or CLI, never by the agent.
208
+
209
+ In a devcontainer the same rule applies: the container's repository must be a feature member, and the
210
+ server talks to the host daemon over the same bridge. The combined context is review data plus the
211
+ declared `context.sources` profile files from member checkouts; symlinked paths outside a member root
212
+ are rejected. Arbitrary source trees of other repositories are not read.
213
+
176
214
  ## Verification
177
215
 
178
216
  ```bash
package/docs/protocol.md CHANGED
@@ -8,9 +8,12 @@
8
8
  JSON lines, one request/response per line.
9
9
  2. **Devcontainer bridge socket**: `~/.local/state/revdeck/devcontainer/run/daemon.sock`, the same
10
10
  protocol on a stable home-based path. The daemon serves it in addition to the primary socket and
11
- writes a copy of `daemon.json` to `~/.local/state/revdeck/devcontainer/state/`.
12
- 3. **HTTP**: `POST /api/rpc` on loopback with a cookie session. Needed for containers where the socket
13
- is not forwarded (`REVDECK_URL` + `REVDECK_TOKEN`).
11
+ writes an info file to `~/.local/state/revdeck/devcontainer/state/daemon.json`. The bridge is
12
+ **agent-scoped**: only the `read`/`draft` capability set is allowed. The info file contains an
13
+ `agentToken` for the restricted `/api/rpc` transport; the UI token is not in that file.
14
+ 3. **HTTP**: `POST /api/rpc` on loopback with a cookie session. The UI token lives on the host; it is
15
+ not mounted into the container. For a container where the socket is not forwarded, set
16
+ `REVDECK_URL` + `REVDECK_TOKEN` from the user's environment; the token is agent-scoped.
14
17
  4. **UI HTTP**: `/api/*` and SSE `/api/events` for the browser.
15
18
 
16
19
  ## Messages
@@ -33,15 +36,33 @@ Error:
33
36
  {"id": 1, "error": {"message": "...", "code": "APPROVAL", "hint": "..."}}
34
37
  ```
35
38
 
36
- `id` is a number. A connection is considered untrusted until the first successful request:
37
- authorization is enforced by the socket file's permissions.
39
+ `id` is a number. The primary socket is authorized by its file permissions (0600). The devcontainer
40
+ bridge is authorized by transport capability: `agent` may read and draft, but human-only methods return
41
+ `{"error":{"code":"CAPABILITY"}}` even if the socket is reachable.
38
42
 
39
43
  ## Methods
40
44
 
41
45
  | Method | Parameters | Result |
42
46
  |---|---|---|
43
47
  | `ping` | — | version, protocol, pid |
44
- | `reviews.list` | — | saved reviews |
48
+ | `projects.list` | — | registered projects with review counts and roots |
49
+ | `projects.register` | `root` | project resolved from that working copy |
50
+ | `projects.update` | `project`, `title?`, `roots?` | rename a project or replace its working-copy roots |
51
+ | `projects.remove` | `project` | delete a project and its cached reviews (platform untouched) |
52
+ | `reviews.list` | `project?` / `root?` | saved reviews, optionally scoped to one project |
53
+ | `features.list` | `project?`, `includeArchived?` | feature summaries |
54
+ | `features.get` | `feature` | feature with ordered members and roles |
55
+ | `features.create` | `title`, `brief?`, `contract?`, `reviews?` | create a human feature |
56
+ | `features.update` | `feature`, `title?`, `brief?`, `contract?`, `status?` | edit/archive a feature |
57
+ | `features.addReviews` | `feature`, `reviews[{review, role?}]` | add/update members |
58
+ | `features.removeReview` | `feature`, `review` | remove a member |
59
+ | `features.reorder` | `feature`, `reviews[]` | set member order |
60
+ | `features.delete` | `feature` | delete a feature (not its reviews) |
61
+ | `features.addNote` | `feature`, `kind?`, `level?`, `title`, `body`, `author?` | non-published feature note/finding |
62
+ | `features.updateNote` | `feature`, `note`, `kind?`, `level?`, `title?`, `body?` | update a note |
63
+ | `features.deleteNote` | `feature`, `note` | delete a note |
64
+ | `features.forReview` | `review` | features containing a review |
65
+ | `features.context` | `feature`, `maxBytes?` | combined brief + review context |
45
66
  | `reviews.remoteList` | `root`, `scope`, `limit` | open reviews from the platform |
46
67
  | `reviews.open` | `root`, `input`/`platform`/`project`/`host`/`branch` | review snapshot |
47
68
  | `reviews.refresh` | `review` | refreshed snapshot |
@@ -66,8 +87,54 @@ authorization is enforced by the socket file's permissions.
66
87
  | `publish.approve` | `review`, `kind`, `ids[]`, `hash` | `approvalId`, `expiresAt` |
67
88
  | `publish.commit` | `review`, `approvalId` | per-item results |
68
89
  | `rules.get` | `review` | rules markdown, checks, warnings |
69
- | `checks.run` | `review`, `allowRun`, `ids[]` | check results |
70
- | `audit.tail` | `limit` | latest actions |
90
+ | `checks.run` | `review`, `allowRun`, `ids[]` | check results (human-only) |
91
+
92
+ ## Capabilities
93
+
94
+ - **human** — primary socket (0600), UI session on the host, host CLI. All methods.
95
+ - **agent** — devcontainer bridge and any restricted HTTP token. Read/draft methods only:
96
+ `reviews.*` (read/open/refresh), `diff.get`, `rules.get`, `features.list/get/context/forReview`,
97
+ `features.addNote/updateNote/deleteNote` (author forced to `agent`; only own notes),
98
+ `drafts.put`, `findings.put/list`, `summary.put`, `notes.*` (server-only publication fields ignored),
99
+ `publish.preview`, `projects.list`, `versions.*`, `analytics.get`, `secrets.get`.
100
+
101
+ Human-only methods return `CAPABILITY` on the bridge: `publish.approve`, `publish.commit`,
102
+ `checks.run`, `decisions.put`, `comments.update/delete`, `reactions.*`, `attachments.upload`,
103
+ `reviews.remove`, `projects.register/update/remove`, and feature administration
104
+ (`features.create/update/delete/addReviews/removeReview/reorder`).
105
+
106
+ ## Project scope
107
+
108
+ A project is a repository, identified by `platform:host/project`. `projects.list` returns the
109
+ registry (`key`, display fields, `roots`, review count, last activity). `reviews.list` with `project`
110
+ or `root` returns only that project's reviews; without either it returns everything (for humans and
111
+ debugging).
112
+
113
+ This filter is an API convenience, not a security boundary: the daemon serves one local user. The
114
+ isolation for agents is enforced by the MCP server, which resolves its project from the working copy
115
+ at startup, passes `project` on every list and rejects a review id/URL from another project. The MCP
116
+ tools do not accept `root` or project overrides.
117
+
118
+ ## Feature scope
119
+
120
+ A feature is a human-created bundle of reviews (`features`, `feature_reviews`) with a title, brief, a
121
+ separate Markdown/OpenAPI contract, application profiles from `context.sources`, and non-published
122
+ notes/findings. `features.context` returns a Markdown document with the brief, parsed contract (or raw
123
+ Markdown), profiles, notes, an overview matrix and one section per member review, using each review's
124
+ own rules. It is read-only.
125
+
126
+ The MCP server has two scopes:
127
+
128
+ - **Project session** (default): lists reviews of one project and features that include it; a foreign
129
+ review id/URL is rejected. `revdeck_feature` can read a feature's combined context, but review tools
130
+ write only in the current project.
131
+ - **Feature session** (`REVDECK_FEATURE=<feature id>`): the current repository must be a member. The
132
+ scope covers only members; review tools may write drafts to any member. Publishing remains per
133
+ review and requires the usual human approval. Feature notes are writable only in a feature session,
134
+ and MCP can change only notes authored by an agent.
135
+
136
+ The daemon does not enforce the MCP scope; it is a local single-user service. The MCP server is the
137
+ isolation boundary. Feature membership is the only explicit cross-project door.
71
138
 
72
139
  ## Approval
73
140
 
@@ -78,8 +145,9 @@ authorization is enforced by the socket file's permissions.
78
145
  3. `publish.commit` verifies that the approval has not been used and has not expired, marks it as used,
79
146
  and executes only `items`. Items that have already been posted are skipped.
80
147
 
81
- The agent cannot call `publish.approve`: the MCP tool does not expose it. A human confirms in the UI or
82
- in the CLI with `--yes`.
148
+ The agent cannot call `publish.approve`: the MCP tool does not expose it, and the bridge denies it with
149
+ `CAPABILITY`. A human confirms in the UI or in the host CLI (`--yes`); the host CLI uses the primary
150
+ human socket.
83
151
 
84
152
  ## HTTP API (UI)
85
153
 
@@ -88,11 +156,13 @@ in the CLI with `--yes`.
88
156
  | GET | `/` | SPA; `?t=<token>` sets the cookie and redirects |
89
157
  | GET | `/assets/*` | static build assets |
90
158
  | GET | `/api/health` | liveness |
91
- | GET | `/api/reviews` | review list |
159
+ | GET | `/api/projects` | registered projects |
160
+ | GET | `/api/reviews?project=` | review list, optionally scoped |
161
+ | POST | `/api/projects/register`, `/update`, `/remove` | register, edit or delete a project |
92
162
  | GET | `/api/state?review=` | snapshot for the UI |
93
163
  | GET | `/api/diff?review=&file=` | file hunks |
94
164
  | GET | `/api/rules?review=` | rules |
95
- | GET | `/api/events` | SSE: `review` |
165
+ | GET | `/api/events` | SSE: `review`, `feature`, `project` |
96
166
  | POST | `/api/reviews/open`, `/api/reviews/refresh` | open/refresh |
97
167
  | POST | `/api/drafts`, `/api/findings`, `/api/summary`, `/api/decisions` | drafts |
98
168
  | POST | `/api/notes` | `action: add/update/delete` |
@@ -108,5 +178,6 @@ in the CLI with `--yes`.
108
178
 
109
179
  ## Versioning
110
180
 
111
- `PROTOCOL_VERSION` in `src/version.ts` is checked during the handshake; the client and daemon must be
112
- the same package version. A method mismatch returns `METHOD` with a hint to update revdeck.
181
+ `PROTOCOL_VERSION` in `src/version.ts` is reported in `ping` and in the bridge info; the client and
182
+ daemon must be the same package version. A method mismatch returns `METHOD` with a hint to update
183
+ revdeck. Version 2 is the agent-scoped bridge.
package/docs/ru/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <p align="center"><img src="../assets/brand/icon-128.png" alt="revdeck" width="72"></p>
2
+
1
3
  # Документация revdeck
2
4
 
3
5
  [English](../README.md) | Русский
@@ -7,11 +9,12 @@
7
9
 
8
10
  | Документ | Английский | Русский |
9
11
  |---|---|---|
12
+ | Возможности и решения | [../capabilities.md](../capabilities.md) | [capabilities.md](capabilities.md) |
10
13
  | Архитектура | [../architecture.md](../architecture.md) | [architecture.md](architecture.md) |
11
14
  | Конфигурация и правила | [../configuration.md](../configuration.md) | [configuration.md](configuration.md) |
12
15
  | Протокол RPC и HTTP | [../protocol.md](../protocol.md) | [protocol.md](protocol.md) |
13
16
  | Модель угроз | [../threat-model.md](../threat-model.md) | [threat-model.md](threat-model.md) |
14
17
  | Интеграции с харнессами | [../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) |
18
+ | Бренд-ассеты | [(EN)](../assets/brand/README.md) | [(EN)](../assets/brand/README.md) |
16
19
 
17
20
  Начните с [README](../../README.ru.md): установка, команды и настройка MCP.
@@ -15,7 +15,7 @@
15
15
 
16
16
  - Замена нативного diff-вьюера GitLab/GitHub. UI оптимизирован под триаж и подтверждение.
17
17
  - Собственный статический анализ. Проверки делегируются линту, типам и тестам проекта.
18
- - Многопользовательский сервер. Модель — один пользователь, несколько ревью, демон на хосте.
18
+ - Многопользовательский сервер. Модель — один пользователь, несколько репозиториев и ревью, демон на хосте.
19
19
 
20
20
  ## Компоненты
21
21
 
@@ -25,35 +25,40 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
25
25
  SQLite + UI ◀── human
26
26
  ```
27
27
 
28
- - `src/core` — чистые функции и модели: парсер unified diff, правила, fingerprints замечаний,
28
+ - `src/core` — чистые функции и модели: идентичность и ключи проектов, парсер unified diff, правила, fingerprints замечаний,
29
29
  санитайзер публикации, редакция секретов, безопасный запуск процессов.
30
30
  - `src/providers` — единственное место, знающее о платформах. `Provider` нормализует MR/PR, diff,
31
31
  треды, ответы, резолв и создание комментариев.
32
32
  - `src/daemon/service.ts` — оркестратор: обновление ревью, черновики, решения, план публикации,
33
33
  approval, идемпотентная запись, фоновый sync.
34
- - `src/daemon/store.ts` — SQLite (`node:sqlite`): ревью, снимок diff/тредов, черновики, замечания,
35
- решения, комментарии, approvals, аудит.
34
+ - `src/daemon/store.ts` — SQLite (`node:sqlite`): проекты и их root'ы, ревью, снимок diff/тредов,
35
+ черновики, замечания, решения, комментарии, approvals, аудит.
36
36
  - `src/daemon/rpc.ts` — JSON-RPC поверх unix-сокета (0600) для CLI и MCP.
37
- - `src/daemon/bridge.ts` — дополнительный RPC-сокет в стабильном домашнем каталоге для devcontainer.
38
- - `src/daemon/http.ts` — UI и `/api/*`, SSE-события, cookie-сессия с одноразовым токеном.
37
+ - `src/daemon/bridge.ts` — дополнительный agent-scoped RPC-сокет в стабильном домашнем каталоге для devcontainer (без publish/checks/admin и без токена UI).
38
+ - `src/daemon/http.ts` — UI и `/api/*`, SSE-события, cookie-сессия с launch-токеном (в контейнер не монтируется).
39
39
  - `src/cli` — команды, `init`, `doctor`, экспорт/импорт старого файлового формата.
40
40
  - `src/mcp` — MCP-сервер: инструменты и промпты, тонкая обёртка над RPC.
41
41
  - `ui` — Svelte 5 SPA, собирается в `dist/ui`.
42
42
 
43
43
  ## Поток данных
44
44
 
45
- 1. `revdeck open 42` → RPC `reviews.open` с `root` рабочей копии.
45
+ 1. `revdeck open 42` → RPC `reviews.open` с `root` рабочей копии; проект определяется по конфигу/remote и регистрируется.
46
46
  2. Демон определяет платформу/хост/проект (аргументы → конфиг → git remote), создаёт провайдер,
47
47
  читает MR, diff и треды, сохраняет снимок и синтетические черновики.
48
48
  3. Агент запрашивает `revdeck_context`: демон собирает эффективные правила (документы и секции для
49
49
  изменённых путей), сниппеты, треды и замечания.
50
50
  4. Агент пишет черновики (`drafts.put`, `findings.put`, `summary.put`, `notes.update`).
51
- 5. Человек в UI вызывает `publish.preview` → видит точный план и хеш → `publish.approve` →
52
- `publish.commit`. Демон выполняет только пункты, вошедшие в подтверждённый план.
51
+ 5. Человек в UI или CLI на хосте вызывает `publish.preview` → видит точный план и хеш →
52
+ `publish.approve` → `publish.commit`. У моста нет approve/commit (`CAPABILITY`); демон выполняет
53
+ только пункты, вошедшие в подтверждённый план.
53
54
  6. Фоновый sync раз в 2 минуты обновляет открытые ревью и рассылает SSE-события UI.
54
55
 
55
56
  ## Модель данных
56
57
 
58
+ - `Project` — репозиторий: `key = platform:host/project` (нормализован для сравнения), отображаемые
59
+ значения и один или несколько root'ов рабочей копии. У ревью тот же `projectKey`.
60
+ - `Feature` — явный набор ревью с брифом, контрактом и заметками; `FeatureReview` добавляет роль и
61
+ порядок; `FeatureNote` хранит непубликуемые кросс-проектные заметки/находки.
57
62
  - `ReviewRef` — платформа, хост, проект, номер. `reviewId` — `platform:host/project!number`.
58
63
  - `DiffFile`/`Hunk`/`DiffLine` — номера строк по старой и новой версии; `line` замечания всегда по
59
64
  новому файлу.
@@ -63,6 +68,50 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
63
68
  - `Approval` — одноразовый id, привязанный к `hash = sha256(canonicalJson({reviewId, kind, items}))`,
64
69
  TTL 10 минут.
65
70
 
71
+ ## Проекты и изоляция
72
+
73
+ Один демон обслуживает несколько репозиториев. **Проект** — это один репозиторий с ключом
74
+ `platform:host/project`; ревью хранит ключ проекта и свой root рабочей копии. Реестр демона
75
+ (`projects`, `project_roots`) заполняется при открытии ревью или при явной регистрации
76
+ (`revdeck projects add <path>`).
77
+
78
+ - UI выбирает один проект за раз: переключатель, домашний экран и очередь ревью в скоупе выбора.
79
+ Выбор хранится в URL и localStorage. На домашнем экране можно зарегистрировать рабочую копию,
80
+ изменить название и root'ы, удалить проект вместе с локальными ревью; удаление не обращается к
81
+ платформе.
82
+ - MCP-сервер — точка изоляции. Он определяет проект по `REVDECK_ROOT` (или текущему каталогу),
83
+ показывает только этот проект и отклоняет id/URL чужих ревью. Агенту не доступны `root` и
84
+ override проекта.
85
+ - `reviews.list` принимает `project` или `root`; это фильтр для UI/CLI, а не security boundary.
86
+ Остаются один демон и одна база; процесс с доступом к домашнему каталогу может прочитать базу.
87
+ - Кросс-проектная работа не подразумевается. Созданная человеком фича связывает ревью из
88
+ нескольких проектов; вне неё чужое ревью отклоняется. См. [возможности](capabilities.md#скоупы-проектов)
89
+ и [Фичи](capabilities.md#фичи).
90
+
91
+ ## Фичи
92
+
93
+ **Фича** — созданный человеком набор ревью из разных проектов. Это не проект и не постоянная связь
94
+ проектов: проект присутствует, пока в фиче есть хотя бы одно его ревью. `features` хранит название,
95
+ Markdown-бриф, отдельный контракт Markdown/OpenAPI, статус и заметки человека/агента;
96
+ `feature_reviews` — состав, свободную роль и порядок. Несколько ревью одного проекта разрешены.
97
+ OpenAPI разбирается на операции и схемы, а контекст отмечает, какие изменённые ревью упоминают
98
+ операцию. Профили приложений — фоновые документы в `context.sources` каждого репозитория
99
+ (`context.maxBytes` ограничивает размер).
100
+
101
+ - UI и CLI создают/редактируют фичи; MCP даёт read-only обнаружение/контекст, а в feature-сессии —
102
+ `revdeck_feature_note` для заметок, созданных агентом (никогда не публикуются).
103
+ - **Project session** видит фичи, куда входит его проект, может читать общий контекст, но пишет
104
+ только в свой проект.
105
+ - **Feature session** запускается явно (`REVDECK_FEATURE=<id>`): текущий репозиторий должен быть
106
+ участником, скоуп ограничен участниками, черновики можно писать в любого. Публикация остаётся по
107
+ каждому ревью и требует подтверждения.
108
+ - Общий контекст: бриф, контракт (разобранный OpenAPI или Markdown), профили приложений, заметки
109
+ фичи, матрица обзора и секция на каждое ревью с его правилами. Правила не смешиваются. Бюджет
110
+ делится между ревью.
111
+ - Публикации на уровне фичи нет. Замечания и выжимки принадлежат ревью; заметки/находки фичи — не
112
+ публикуемый блокнот для кросс-проектных наблюдений. Фича агрегирует ревью для навигации. См.
113
+ [возможности](capabilities.md#фичи).
114
+
66
115
  ## Идемпотентность и конкурентность
67
116
 
68
117
  - Записи черновиков и замечаний идут через один процесс; SQLite в WAL.
@@ -83,7 +132,8 @@ agent (MCP/CLI) ──▶ revdeck daemon ──glab/gh──▶ GitLab/GitHub
83
132
  харнессов без MCP используется CLI.
84
133
  - **Правила**: `rules.map`/`rules.sources` в `.revdeck.yml`; паки правил можно распространять как
85
134
  обычный файл конфигурации.
86
- - **Проверки**: `checks` с argv без shell; запуск только по явному подтверждению.
135
+ - **Проверки**: `checks` с argv; агент только планирует, человек запускает в UI или CLI на хосте;
136
+ мост запрещает `checks.run`.
87
137
 
88
138
  ## Производительность
89
139