revdeck 0.0.0-stage → 0.1.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 (48) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/CONTRIBUTING.md +98 -0
  3. package/LICENSE +21 -0
  4. package/README.md +223 -2
  5. package/README.ru.md +210 -0
  6. package/SECURITY.md +45 -0
  7. package/dist/cli.js +2669 -0
  8. package/dist/cli.js.map +7 -0
  9. package/dist/daemon.js +3715 -0
  10. package/dist/daemon.js.map +7 -0
  11. package/dist/mcp.js +885 -0
  12. package/dist/mcp.js.map +7 -0
  13. package/dist/ui/assets/index-ByfGHwCb.css +1 -0
  14. package/dist/ui/assets/index-mvPA8Avw.js +10 -0
  15. package/dist/ui/favicon.svg +4 -0
  16. package/dist/ui/index.html +16 -0
  17. package/docs/README.md +17 -0
  18. package/docs/adr/0001-daemon-first.md +63 -0
  19. package/docs/architecture.md +91 -0
  20. package/docs/configuration.md +121 -0
  21. package/docs/integrations.md +84 -0
  22. package/docs/protocol.md +96 -0
  23. package/docs/ru/README.md +17 -0
  24. package/docs/ru/adr/0001-daemon-first.md +61 -0
  25. package/docs/ru/architecture.md +91 -0
  26. package/docs/ru/configuration.md +119 -0
  27. package/docs/ru/integrations.md +82 -0
  28. package/docs/ru/protocol.md +96 -0
  29. package/docs/ru/threat-model.md +50 -0
  30. package/docs/screenshot.png +0 -0
  31. package/docs/screenshot.ru.png +0 -0
  32. package/docs/threat-model.md +51 -0
  33. package/examples/monorepo.yml +38 -0
  34. package/examples/simple.yml +36 -0
  35. package/examples/web-chat-core.yml +45 -0
  36. package/package.json +79 -4
  37. package/skills/revdeck/en/Criteria.md +265 -0
  38. package/skills/revdeck/en/Feedback.md +64 -0
  39. package/skills/revdeck/en/Review.md +157 -0
  40. package/skills/revdeck/en/Rules.md +75 -0
  41. package/skills/revdeck/en/SKILL.md +78 -0
  42. package/skills/revdeck/en/Sources.md +47 -0
  43. package/skills/revdeck/ru/Criteria.md +249 -0
  44. package/skills/revdeck/ru/Feedback.md +64 -0
  45. package/skills/revdeck/ru/Review.md +148 -0
  46. package/skills/revdeck/ru/Rules.md +69 -0
  47. package/skills/revdeck/ru/SKILL.md +73 -0
  48. package/skills/revdeck/ru/Sources.md +46 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-11
10
+
11
+ First public release.
12
+
13
+ ### Added
14
+
15
+ - Daemon-first architecture: local daemon over a unix socket, SQLite state, multiple reviews.
16
+ - Providers for GitLab and GitHub via `glab`/`gh`: MR/PR info, unified diff, threads, replies,
17
+ resolve, reactions, line comments, general comments.
18
+ - Approval-gated, idempotent publishing: preview → plan hash → approve → commit.
19
+ - CLI: `init`, `doctor`, `daemon`, `list`, `open`, `context`, `diff`, `threads`, `summary`,
20
+ `findings`, `reply`, `notes`, `publish`, `rules`, `checks`, `export`, `import`, `ui`, `mcp`.
21
+ - MCP server with 13 tools, `review-mr` and `close-feedback` prompts.
22
+ - Svelte 5 UI: review queue, summary, threads with autosave, findings triage, virtualized-free diff
23
+ with line comments, rules, publish dialog, command palette, SSE updates.
24
+ - Configurable per-project rules: path → document/section mapping, auto-discovery, checks.
25
+ - Harness adapters for Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Copilot and DSH (MCP).
26
+ - Bilingual product: Russian and English UI with a switch, localized CLI/MCP/context, and separate
27
+ Russian/English skill packs selected by `revdeck init --lang`.
28
+ - `output.language: auto | ru | en` for review output, independent of the interface language.
29
+ - English documentation as the canonical set under `docs/`, with Russian translations under `docs/ru/`.
30
+ - Security: token scrubbing, redaction, publish sanitizer, loopback-only UI, one-time launch token,
31
+ cookie/Origin/Host checks, CSP.
32
+ - Docs: architecture, configuration, protocol, threat model, integrations, ADR.
33
+ - Tests: diff parser, core helpers, providers with recorded responses, service with a fake provider.
@@ -0,0 +1,98 @@
1
+ # Contributing to revdeck
2
+
3
+ Thanks for taking the time to contribute. revdeck is a small, dependency-light project: a review
4
+ procedure, a local daemon, platform providers, an MCP server, a CLI and a Svelte UI.
5
+
6
+ ## Good first issues
7
+
8
+ - A new `Provider` (Bitbucket, Forgejo, Azure DevOps).
9
+ - A harness adapter (Gemini, Zed, JetBrains, a DSH host command).
10
+ - Native drafts for GitLab/GitHub.
11
+ - English translations of `docs/` and `skills/`.
12
+ - UI: reactions panel, review opening dialog, virtualized diff.
13
+
14
+ ## Setup
15
+
16
+ ```bash
17
+ git clone https://github.com/katrov/revdeck.git
18
+ cd revdeck
19
+ npm ci
20
+ npm run typecheck # tsc + svelte-check
21
+ npm test
22
+ npm run build
23
+ ```
24
+
25
+ For manual testing, `npm run dev:daemon` starts the daemon from source; `npm run dev:ui` starts Vite.
26
+ The daemon serves the built UI from `dist/ui`, so run `npm run build:ui` before checking the full app.
27
+
28
+ `glab`/`gh` are optional for development: provider tests use recorded CLI responses. To test against a
29
+ real platform, authenticate the CLI and run `revdeck doctor`.
30
+
31
+ ## Project layout
32
+
33
+ | Path | Responsibility |
34
+ |---|---|
35
+ | `src/core` | Pure functions: diff parser, config, rules, findings, sanitizer, redaction, exec |
36
+ | `src/providers` | Platform-specific code; the only place that knows GitLab/GitHub JSON |
37
+ | `src/daemon` | SQLite store, review service, approvals, RPC, HTTP/SSE |
38
+ | `src/cli` | Commands and installers |
39
+ | `src/mcp` | MCP tools and prompts |
40
+ | `ui` | Svelte 5 SPA |
41
+ | `skills/revdeck` | Review procedures shipped to user projects |
42
+
43
+ Rules of thumb:
44
+
45
+ - Keep `src/core` free of network and platform assumptions.
46
+ - A provider returns normalized types from `src/core/types.ts`; no UI or CLI concerns.
47
+ - Publishing must stay approval-gated: never add a path that posts without an `approval_id`.
48
+ - Untrusted text (comments, diff, MR description) never becomes an instruction or a shell command.
49
+
50
+ ## Adding a provider
51
+
52
+ 1. Implement `Provider` from `src/providers/provider.ts`.
53
+ 2. Add a branch to `createProvider`.
54
+ 3. Add fixture-based tests in `tests/providers.test.ts` using a fake `Runner`.
55
+ 4. Document platform quirks (resolve, drafts, line comments) in `docs/architecture.md`.
56
+
57
+ ## Adding a harness adapter
58
+
59
+ Add a `SPECS` entry in `src/cli/init.ts` with the skill target, MCP config path or command file, then
60
+ document it in `docs/integrations.md`. `init` must never overwrite files it does not own.
61
+
62
+ ## Translations
63
+
64
+ - UI strings live next to their components: `t('русский', 'English')` in `ui/src/lib/i18n.svelte.ts`'s
65
+ `t` helper. Keep both languages in the same edit.
66
+ - CLI strings use `tr('русский', 'English')` from `src/core/locale.ts`.
67
+ - The skill has two human-maintained packs: `skills/revdeck/ru/` and `skills/revdeck/en/`. They must
68
+ keep the same structure and semantics; do not machine-translate the review procedure.
69
+ - Tests that assert message text should pin the locale with `setLocale('ru')` or be language-agnostic.
70
+ - Docs: `docs/` is English and canonical, `docs/ru/` is Russian. Keep headings, commands, code blocks
71
+ and file paths identical between the two; translate prose only.
72
+
73
+ ## Pull requests
74
+
75
+ - One logical change per PR; include tests for behavior changes.
76
+ - `npm run typecheck`, `npm test` and `npm run build` must pass.
77
+ - Do not commit secrets, `.env` files, tokens, or generated `dist/` artifacts.
78
+ - UI changes: include a screenshot and check light/dark themes.
79
+ - Commits: imperative mood, short subject, explain the *why* in the body. Conventional Commits
80
+ prefixes (`feat:`, `fix:`, `docs:`, `test:`, `refactor:`) are welcome but not required.
81
+ - By contributing you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
82
+
83
+ ## Release (maintainers)
84
+
85
+ ```bash
86
+ npm version minor
87
+ git push --follow-tags
88
+ ```
89
+
90
+ The `release` workflow publishes to npm with provenance and creates a GitHub release. It needs an
91
+ `NPM_TOKEN` repository secret: a granular npm token with read/write access to `revdeck` and
92
+ **Bypass 2FA** enabled (or a classic Automation token). Without it the publish step fails with
93
+ `ENEEDAUTH`; the workflow now reports that explicitly before publishing. The version in
94
+ `src/version.ts` must match `package.json`. `prepublishOnly` re-runs build, typecheck and tests.
95
+
96
+ ## Security
97
+
98
+ Please do not open a public issue for a vulnerability. See [SECURITY.md](SECURITY.md).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 revdeck contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,224 @@
1
- # Temporary Holding Version
1
+ # revdeck
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/revdeck.svg)](https://www.npmjs.com/package/revdeck)
4
+ [![CI](https://github.com/katrov/revdeck/actions/workflows/ci.yml/badge.svg)](https://github.com/katrov/revdeck/actions/workflows/ci.yml)
5
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+ [![node](https://img.shields.io/node/v/revdeck.svg)](https://nodejs.org)
7
+
8
+ **Agent-first code review for GitLab and GitHub.**
9
+
10
+ revdeck gives an agent the review context and the project's own rules, lets it write findings and
11
+ replies, and keeps publishing under human control. It runs as a local daemon with a CLI, an MCP server
12
+ and a web UI. Platform tokens stay on the host.
13
+
14
+ ![revdeck UI](docs/screenshot.png)
15
+
16
+ [Русская версия](README.ru.md) · [Documentation](docs/README.md) (English and Russian)
17
+
18
+ ## Why
19
+
20
+ - **Rules, not vibes.** For every changed path revdeck selects the repository documents and the exact
21
+ sections (`AGENTS.md`, architecture, style guides, ADRs). The agent gets a deterministic, size-limited
22
+ context instead of generic “review this PR” instructions.
23
+ - **Humans publish.** The agent writes drafts. The UI shows exactly what will be posted; publishing is
24
+ bound to a hash of the plan and is idempotent. There is no “agent approved its own comment” path.
25
+ - **Tokens never reach the agent.** The daemon calls `glab`/`gh` on the host and scrubs platform tokens
26
+ from child environments. A sandboxed agent only gets an RPC.
27
+ - **GitLab and GitHub.** One model: MR/PR, threads, diff, resolve, reactions, line comments.
28
+ - **Many reviews.** The daemon keeps them in SQLite; the UI is a triage queue with keyboard shortcuts.
29
+ - **Any harness.** MCP tools for MCP clients, the same capabilities over CLI, and a skill that carries
30
+ the review procedure.
31
+
32
+ ## How it works
33
+
34
+ ```
35
+ agent (MCP/CLI) ──unix socket──▶ revdeck daemon ──glab/gh──▶ GitLab / GitHub
36
+ │
37
+ SQLite + Svelte UI ◀── human
38
+ ```
39
+
40
+ ## Install
41
+
42
+ Requirements: Node.js ≥ 22.13 (Node 24 LTS recommended — `node:sqlite` is experimental in 22.x), `git`, and an authenticated platform CLI
43
+ (`glab auth login` or `gh auth login`). revdeck never reads or stores their tokens.
44
+
45
+ ```bash
46
+ # one-off
47
+ npx revdeck@latest init
48
+
49
+ # or install globally for daily use
50
+ npm install -g revdeck
51
+ revdeck init
52
+ ```
53
+
54
+ In a repository:
55
+
56
+ ```bash
57
+ cd /path/to/repo
58
+ revdeck init # .revdeck.yml, skill for your harnesses, MCP config
59
+ revdeck doctor # node, glab/gh auth, daemon, adapters
60
+ revdeck open 42 # load an MR/PR
61
+ revdeck ui # open the local UI
62
+ ```
63
+
64
+ `init` never overwrites an existing config without `--force`, and it merges `.mcp.json` instead of
65
+ replacing it. Auto-start on login: `revdeck daemon install` (systemd user unit on Linux, launchd plist
66
+ on macOS). Use a global install for this — an `npx` cache path can be evicted.
67
+
68
+ ## Languages
69
+
70
+ The product is bilingual (Russian and English), and the two languages are independent:
71
+
72
+ - **Interface and CLI**: follow `--lang ru|en`, then `REVDECK_LANG`, then the system locale. The UI has
73
+ a RU/EN switch in the sidebar and remembers your choice.
74
+ - **Review output** (findings, replies, summary): `output.language: auto | ru | en` in `.revdeck.yml`.
75
+ `auto` follows the language of the MR description and threads, so a Russian team can review an
76
+ English repo and still get Russian comments (or the other way round).
77
+ - **Skill**: `revdeck init --lang en` installs the English procedure; without the flag init follows
78
+ `REVDECK_LANG`/the system locale and defaults to English.
79
+ - **Project rules** can be written in any language: revdeck reads UTF-8 documents and matches headings
80
+ (including Cyrillic) without translation. Rules are quoted as-is.
81
+
82
+ MCP tool descriptions are English — that is the model-facing layer; prompt text follows
83
+ `REVDECK_LANG`. The daemon reads the language at startup, so restart it after changing the language
84
+ (`revdeck daemon restart`).
85
+
86
+ Documentation is available in English (`docs/`, canonical) and Russian (`docs/ru/`). English and
87
+ Russian READMEs live in this repository; translation fixes are welcome.
88
+
89
+ ## Commands
90
+
91
+ | Command | What it does |
92
+ |---|---|
93
+ | `revdeck init` | config, harness adapters, MCP |
94
+ | `revdeck doctor` | environment, `glab`/`gh` auth, daemon, adapters |
95
+ | `revdeck list [--remote]` | tracked reviews or open ones from the platform |
96
+ | `revdeck open <N\|URL>` | load a review |
97
+ | `revdeck context <N>` | agent context: rules, files, threads, findings |
98
+ | `revdeck diff <N> [--file]` | files and hunks |
99
+ | `revdeck threads <N>` | discussions |
100
+ | `revdeck findings <N> set --file f.json` | write findings |
101
+ | `revdeck reply <N> --thread <id> --body …` | draft a reply |
102
+ | `revdeck publish <N> [--yes]` | preview or publish after confirmation |
103
+ | `revdeck notes <N> …` | line comments from the human |
104
+ | `revdeck rules [--explain <path>]` | effective rules |
105
+ | `revdeck checks <N> [--run --yes]` | project checks |
106
+ | `revdeck export/import <N>` | legacy file exchange |
107
+ | `revdeck ui [N]` | local web UI |
108
+ | `revdeck daemon <start\|stop\|status\|logs\|install>` | daemon lifecycle |
109
+ | `revdeck mcp` | MCP server over stdio |
110
+
111
+ Common flags: `--json`, `--root`, `--review`, `--platform`, `--project`, `--host`, `--lang ru|en`.
112
+
113
+ ## MCP
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "revdeck": {
119
+ "command": "npx",
120
+ "args": ["-y", "revdeck", "mcp"],
121
+ "env": { "REVDECK_LANG": "en" }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ Tools: `revdeck_status`, `revdeck_list`, `revdeck_open`, `revdeck_context`, `revdeck_threads`,
128
+ `revdeck_diff`, `revdeck_rules`, `revdeck_draft_reply`, `revdeck_draft_findings`,
129
+ `revdeck_set_summary`, `revdeck_notes`, `revdeck_publish_preview`, `revdeck_publish`.
130
+
131
+ Publishing requires an `approval_id` that only a human can create (UI or CLI `--yes`). The MCP tool
132
+ does not create one. Prompts `review-mr` and `close-feedback` are available in clients that support
133
+ MCP prompts.
134
+
135
+ Harness matrix and slash commands: [docs/integrations.md](docs/integrations.md).
136
+
137
+ ## Rules
138
+
139
+ `.revdeck.yml` at the repository root:
140
+
141
+ ```yaml
142
+ version: 1
143
+ output:
144
+ language: auto # auto | ru | en — язык замечаний и ответов
145
+ provider:
146
+ type: gitlab # auto | gitlab | github
147
+ host: gitlab.example.com
148
+ project: group/project
149
+ base: develop
150
+ rules:
151
+ sources: [AGENTS.md, CONTRIBUTING.md]
152
+ map:
153
+ - match: "src/**"
154
+ docs: [docs/Architecture.md, "docs/Styleguide.md#Базовый стиль"]
155
+ - match: "src/state/**"
156
+ docs: [docs/StateManagement.md]
157
+ ignore: ["**/generated/**"]
158
+ checks:
159
+ - id: lint
160
+ argv: [npm, run, lint]
161
+ when: ["src/**"]
162
+ publish:
163
+ requireApproval: true
164
+ maxComments: 50
165
+ ```
166
+
167
+ Document selectors: `docs/File.md`, `docs/File.md#Heading`, `docs/File.md#L10-L25`. Without a config,
168
+ revdeck discovers `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md` and `docs/*` and warns when nothing is
169
+ found. Full schema: [docs/configuration.md](docs/configuration.md).
170
+
171
+ ## Security
172
+
173
+ - The daemon listens on loopback and a unix socket (0600). The UI uses a one-time launch token, an
174
+ `HttpOnly`/`SameSite=Strict` cookie, `Host`/`Origin` checks and CSP.
175
+ - `glab`/`gh` run without a shell, with `cwd` outside the working copy and a scrubbed environment;
176
+ secrets are redacted from logs and errors.
177
+ - Comments are checked for GitLab quick actions, HTML, hidden/bidi characters, mass mentions and
178
+ external images.
179
+ - Review text is untrusted data; agent instructions say so explicitly.
180
+
181
+ Details: [docs/threat-model.md](docs/threat-model.md). The guarantee is: the token does not cross the
182
+ sandbox boundary and is not returned over RPC. If a process can read the user's home directory, it can
183
+ read the CLI configuration — isolate the agent.
184
+
185
+ ## Architecture
186
+
187
+ | Path | Contents |
188
+ |---|---|
189
+ | `src/core` | models, diff parser, rules compiler, findings, sanitizer, safe exec |
190
+ | `src/providers` | GitLab and GitHub via `glab`/`gh`, normalized |
191
+ | `src/daemon` | SQLite, service, unix-socket RPC, HTTP/SSE, approvals |
192
+ | `src/cli` | commands, `init`, `doctor`, export/import |
193
+ | `src/mcp` | MCP server over stdio |
194
+ | `ui` | Svelte 5 + Vite |
195
+ | `skills/revdeck` | review procedures (SKILL, Review, Feedback, Criteria, Rules, Sources) |
196
+
197
+ More: [docs/architecture.md](docs/architecture.md), [docs/protocol.md](docs/protocol.md),
198
+ [ADR-0001](docs/adr/0001-daemon-first.md).
199
+
200
+ ## Development
201
+
202
+ ```bash
203
+ npm ci
204
+ npm run typecheck # tsc + svelte-check
205
+ npm test # vitest
206
+ npm run build # dist/cli.js, dist/daemon.js, dist/mcp.js, dist/ui
207
+ npm run dev:daemon # daemon from source
208
+ npm run dev:ui # Vite dev server (the daemon serves dist/ui)
209
+ ```
210
+
211
+ Provider tests use recorded CLI responses and need no network. See [CONTRIBUTING.md](CONTRIBUTING.md).
212
+
213
+ ## Status
214
+
215
+ - Publishing uses regular comments; native drafts (GitLab draft notes, GitHub pending review) are not
216
+ used yet, though the provider interface is ready.
217
+ - Project checks are planned by the agent; running them requires `revdeck checks --run --yes`.
218
+ - The UI does not open a new review by number; use the CLI and the review appears in the list.
219
+ - Thread resolution is in the thread card; reactions exist in providers but are not exposed in the UI.
220
+ - Auto-start is supported on Linux and macOS; on Windows run the daemon manually.
221
+
222
+ ## License
223
+
224
+ [MIT](LICENSE)
package/README.ru.md ADDED
@@ -0,0 +1,210 @@
1
+ # revdeck
2
+
3
+ [English](README.md) | Русский · [Документация](docs/ru/README.md)
4
+
5
+ Локальный код-ревью для GitLab и GitHub, сделанный вокруг агента: агент читает контекст и пишет
6
+ черновики, человек подтверждает и публикует. Работает как MCP-сервер, CLI и веб-интерфейс; токены
7
+ платформ остаются на хосте.
8
+
9
+ ```
10
+ агент (MCP/CLI) ──unix socket──▶ revdeck daemon ──glab/gh──▶ GitLab / GitHub
11
+ │
12
+ SQLite + Svelte UI ◀── человек
13
+ ```
14
+
15
+ ![Интерфейс revdeck](docs/screenshot.ru.png)
16
+
17
+ ## Зачем
18
+
19
+ - **Правила вместо догадок.** Для каждого изменённого пути revdeck выбирает документы репозитория и
20
+ конкретные секции (`AGENTS.md`, архитектура, гайды, ADR). Агент получает детерминированный контекст,
21
+ а не «отревьюй PR по best practices».
22
+ - **Публикация только человеком.** Агент пишет черновики ответов и замечаний. В UI видно ровно то, что
23
+ уйдёт в платформу; публикация выполняется по подтверждению, привязанному к хешу плана, и повторно
24
+ не отправляет уже отправленное.
25
+ - **Токены не уезжают агенту.** Демон вызывает `glab`/`gh` на хосте и вычищает токены из окружения
26
+ дочерних процессов. Агент в песочнице получает только RPC и не видит ни токена, ни конфигурации
27
+ платформы.
28
+ - **GitLab и GitHub.** Одна модель: MR/PR, треды, diff, резолв, реакции, комментарии к строкам.
29
+ - **Несколько ревью.** Демон хранит открытые ревью в SQLite; UI — очередь с поиском и горячими
30
+ клавишами.
31
+
32
+ ## Установка
33
+
34
+ ```bash
35
+ npm install -g revdeck
36
+ # или разово:
37
+ npx revdeck@latest init
38
+ ```
39
+
40
+ Требования: Node.js ≥ 22.13 (рекомендуется Node 24 LTS: в 22.x `node:sqlite` экспериментален), `git`, для GitLab — `glab` с выполненным `glab auth login`, для
41
+ GitHub — `gh` с `gh auth login`. Токены revdeck не читает и не хранит.
42
+
43
+ В проекте:
44
+
45
+ ```bash
46
+ cd /path/to/repo
47
+ revdeck init # .revdeck.yml, skill в .agents/.claude, MCP-конфиг
48
+ revdeck doctor # проверка окружения и адаптеров
49
+ revdeck open 42 # открыть MR/PR по номеру
50
+ revdeck ui # ссылка на локальный интерфейс
51
+ ```
52
+
53
+ `revdeck init` не перезаписывает существующий конфиг без `--force` и не трогает чужие ключи в
54
+ `.mcp.json`. Автозапуск демона при входе в систему — `revdeck daemon install`: создаёт systemd user unit
55
+ (Linux) или launchd plist (macOS) и печатает команду включения. Для автозапуска ставьте пакет глобально:
56
+ путь в кеше `npx` может быть очищен.
57
+
58
+ ## Языки
59
+
60
+ Продукт двуязычный (русский и английский), причём языки независимы:
61
+
62
+ - **Интерфейс и CLI** следуют `--lang ru|en`, затем `REVDECK_LANG`, затем системной локали. В UI есть
63
+ переключатель RU/EN в сайдбаре, выбор запоминается.
64
+ - **Язык результатов ревью** (замечания, ответы, выжимка) — `output.language: auto | ru | en` в
65
+ `.revdeck.yml`. `auto` следует языку описания MR и обсуждений: русская команда может ревьюить
66
+ английский репозиторий и получать русские комментарии (и наоборот).
67
+ - **Skill**: `revdeck init --lang en` ставит английскую процедуру; без флага язык берётся из
68
+ `REVDECK_LANG`/системной локали, по умолчанию английский.
69
+ - **Правила проекта** могут быть на любом языке: revdeck читает UTF-8 и сопоставляет заголовки
70
+ (включая кириллицу) без перевода. Правила цитируются как есть.
71
+ - **MCP-описания инструментов** на английском — это машинный слой для модели; тексты промптов
72
+ следуют `REVDECK_LANG`. Демон читает язык при старте: после смены языка перезапустите его
73
+ (`revdeck daemon restart`).
74
+
75
+ ## Команды
76
+
77
+ | Команда | Что делает |
78
+ |---|---|
79
+ | `revdeck init` | конфиг, адаптеры, MCP |
80
+ | `revdeck doctor` | окружение, `glab`/`gh`, демон, адаптеры |
81
+ | `revdeck list [--remote]` | локальные или открытые на платформе ревью |
82
+ | `revdeck open <N│URL>` | загрузить ревью |
83
+ | `revdeck context <N>` | контекст для агента: правила, файлы, треды, замечания |
84
+ | `revdeck diff <N> [--file]` | файлы и hunks |
85
+ | `revdeck threads <N>` | обсуждения |
86
+ | `revdeck findings <N> set --file f.json` | записать замечания |
87
+ | `revdeck reply <N> --thread <id> --body …` | черновик ответа |
88
+ | `revdeck publish <N> [--yes]` | план или публикация после подтверждения |
89
+ | `revdeck notes <N> …` | комментарии человека к строкам |
90
+ | `revdeck rules [--explain <path>]` | эффективные правила |
91
+ | `revdeck checks <N> [--run --yes]` | проверки проекта |
92
+ | `revdeck export/import <N>` | обмен с файловым форматом |
93
+ | `revdeck ui [N]` | локальный интерфейс |
94
+ | `revdeck daemon <start│stop│status│logs│install>` | управление демоном |
95
+ | `revdeck mcp` | MCP-сервер (stdio) |
96
+
97
+ Общие флаги: `--json`, `--root`, `--review`, `--platform`, `--project`, `--host`, `--lang ru|en`.
98
+
99
+ ## MCP
100
+
101
+ ```json
102
+ {
103
+ "mcpServers": {
104
+ "revdeck": {
105
+ "command": "npx",
106
+ "args": ["-y", "revdeck", "mcp"],
107
+ "env": { "REVDECK_LANG": "en" }
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ Инструменты: `revdeck_status`, `revdeck_list`, `revdeck_open`, `revdeck_context`,
114
+ `revdeck_threads`, `revdeck_diff`, `revdeck_rules`, `revdeck_draft_reply`,
115
+ `revdeck_draft_findings`, `revdeck_set_summary`, `revdeck_notes`, `revdeck_publish_preview`,
116
+ `revdeck_publish`. Публикация требует `approval_id`, который агент получить не может: его выдаёт
117
+ человек в UI или CLI с `--yes`.
118
+
119
+ Промпты `review-mr` и `close-feedback` доступны в клиентах, поддерживающих MCP prompts. В харнессах
120
+ без MCP используйте CLI — возможности те же. Матрица адаптеров и `/`-команд: [docs/ru/integrations.md](docs/ru/integrations.md).
121
+
122
+ ## Правила проекта
123
+
124
+ `.revdeck.yml` в корне репозитория:
125
+
126
+ ```yaml
127
+ version: 1
128
+ output:
129
+ language: auto # auto | ru | en — язык замечаний и ответов
130
+ provider:
131
+ type: gitlab # auto | gitlab | github
132
+ host: gitlab.example.com
133
+ project: group/project
134
+ base: develop
135
+ rules:
136
+ sources: [AGENTS.md, CONTRIBUTING.md]
137
+ map:
138
+ - match: "src/**"
139
+ docs: [docs/Architecture.md, docs/Styleguide.md#Базовый стиль]
140
+ - match: "src/state/**"
141
+ docs: [docs/StateManagement.md]
142
+ - match: "docs/**"
143
+ docs: [AGENTS.md#Размещение-технических-знаний]
144
+ ignore: ["**/generated/**"]
145
+ checks:
146
+ - id: lint
147
+ argv: [npm, run, lint]
148
+ when: ["src/**"]
149
+ publish:
150
+ requireApproval: true
151
+ maxComments: 50
152
+ ```
153
+
154
+ Селектор документа: `docs/File.md`, `docs/File.md#Заголовок` или `docs/File.md#L10-L25`. Без конфига
155
+ revdeck ищет `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md` и `docs/*` и предупреждает, если правил не
156
+ нашлось. Полная схема — [docs/ru/configuration.md](docs/ru/configuration.md).
157
+
158
+ ## Безопасность
159
+
160
+ - Демон слушает только loopback и unix-сокет (0600), UI — с одноразовым токеном запуска, cookie
161
+ `HttpOnly`/`SameSite=Strict`, проверкой `Host`/`Origin` и CSP.
162
+ - `glab`/`gh` вызываются без shell, с `cwd` вне рабочей копии и вычищенным окружением; секреты
163
+ редактируются в логах и ошибках.
164
+ - Комментарии проверяются на быстрые команды GitLab, HTML, скрытые/bidi-символы, `@all` и внешние
165
+ картинки.
166
+ - Текст MR — недоверенные данные; агентские инструкции это оговаривают.
167
+
168
+ Подробно: [docs/ru/threat-model.md](docs/ru/threat-model.md). Гарантия формулируется так: токен не
169
+ пересекает границу песочницы и не отдаётся по RPC. Если у процесса есть чтение домашнего каталога
170
+ пользователя, он может прочитать конфигурацию `glab`/`gh` — для этого и нужна изоляция агента.
171
+
172
+ ## Архитектура
173
+
174
+ | Путь | Что внутри |
175
+ |---|---|
176
+ | `src/core` | модели, парсер diff, правила, findings, санитайзер, безопасный exec |
177
+ | `src/providers` | GitLab и GitHub через `glab`/`gh`, нормализация в общую модель |
178
+ | `src/daemon` | SQLite, сервис, RPC по сокету, HTTP/SSE, одобрения |
179
+ | `src/cli` | команды, `init`, `doctor`, экспорт/импорт |
180
+ | `src/mcp` | MCP-сервер (stdio) |
181
+ | `ui` | Svelte 5 + Vite |
182
+ | `skills/revdeck` | процедуры ревью (SKILL, Review, Feedback, Criteria, Rules, Sources) |
183
+
184
+ Подробно: [docs/ru/architecture.md](docs/ru/architecture.md), [docs/ru/protocol.md](docs/ru/protocol.md),
185
+ [ADR-0001](docs/ru/adr/0001-daemon-first.md).
186
+
187
+ ## Разработка
188
+
189
+ ```bash
190
+ npm install
191
+ npm run typecheck # tsc + svelte-check
192
+ npm test # vitest
193
+ npm run build # dist/cli.js, dist/daemon.js, dist/mcp.js, dist/ui
194
+ ```
195
+
196
+ Демон в разработке: `npm run dev:daemon`, UI: `npm run dev:ui` (сборка UI отдаётся демоном из
197
+ `dist/ui`). Тесты провайдеров работают на записанных ответах CLI и не требуют сети.
198
+
199
+ ## Ограничения текущей версии
200
+
201
+ - Публикация идёт обычными комментариями; native drafts (GitLab draft notes, GitHub pending review)
202
+ ещё не используются, хотя провайдеры к этому готовы.
203
+ - Проверки проекта агент только планирует; запуск — `revdeck checks --run --yes`.
204
+ - UI не открывает новое ревью по номеру: это делает CLI, ревью появляется в списке.
205
+ - Резолв тредов есть в карточке треда; реакции реализованы в провайдерах, но пока не выведены в UI.
206
+ - Поддержаны Linux и macOS для автозапуска; Windows — запуск вручную.
207
+
208
+ ## Лицензия
209
+
210
+ MIT.
package/SECURITY.md ADDED
@@ -0,0 +1,45 @@
1
+ # Security policy
2
+
3
+ ## Supported versions
4
+
5
+ | Version | Supported |
6
+ |---|---|
7
+ | 0.1.x | yes |
8
+
9
+ Pre-1.0 releases get fixes on the latest minor line.
10
+
11
+ ## Reporting a vulnerability
12
+
13
+ Please **do not** open a public issue. Use GitHub's private vulnerability reporting:
14
+
15
+ <https://github.com/katrov/revdeck/security/advisories/new>
16
+
17
+ Include:
18
+
19
+ - affected version (`revdeck --version`) and Node.js version;
20
+ - platform (GitLab/GitHub) and, if relevant, the provider configuration;
21
+ - steps to reproduce, expected and actual behavior;
22
+ - whether a token, a published comment, or repository content is involved;
23
+ - logs with secrets removed (`revdeck daemon logs`).
24
+
25
+ You will get an acknowledgement within a few days. Please give us time to ship a fix before public
26
+ disclosure.
27
+
28
+ ## Scope
29
+
30
+ In scope:
31
+
32
+ - token handling and redaction, daemon/socket permissions, UI authentication (launch token, cookie,
33
+ `Host`/`Origin`, CSP);
34
+ - the approval and idempotency model for publishing;
35
+ - prompt injection in review text that leads to unintended actions;
36
+ - path traversal, symlink handling, unsafe `exec`, malicious repository config;
37
+ - supply-chain issues in the published package.
38
+
39
+ Out of scope:
40
+
41
+ - an attacker who already controls the user's OS account or can read `$HOME` — isolate the agent;
42
+ - vulnerabilities in `glab`, `gh`, GitLab or GitHub themselves;
43
+ - denial of service by a local user against their own daemon.
44
+
45
+ The design assumptions and residual risks are documented in [docs/threat-model.md](docs/threat-model.md).