create-vibe-maestro 0.3.0-beta.4 → 0.3.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 (61) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +28 -19
  3. package/dist/cli/maestro.js +1 -1
  4. package/dist/cli/preflight-run.js +2 -0
  5. package/dist/cli/skills-run.js +0 -1
  6. package/dist/cli/upgrade-run.js +6 -1
  7. package/dist/core/doctor/entries.js +41 -0
  8. package/dist/core/doctor/git.js +9 -4
  9. package/dist/core/doctor/index.js +14 -7
  10. package/dist/core/doctor/managed.js +6 -2
  11. package/dist/core/doctor/plans.js +23 -6
  12. package/dist/core/doctor/text.js +40 -3
  13. package/dist/core/doctor/wiki.js +18 -7
  14. package/dist/core/init.js +63 -9
  15. package/dist/core/inventory.js +10 -3
  16. package/dist/core/manifest.js +2 -0
  17. package/dist/core/plan.js +42 -1
  18. package/dist/core/preflight.js +48 -14
  19. package/dist/core/skills.js +2 -13
  20. package/dist/core/template-recover.js +82 -0
  21. package/dist/core/upgrade/analyze.js +46 -10
  22. package/dist/core/upgrade/baseline.js +6 -0
  23. package/dist/core/upgrade/releases.js +128 -1
  24. package/docs/MIGRATION_V1.md +1 -1
  25. package/docs/ROADMAP.md +2 -2
  26. package/docs/USER_GUIDE.md +57 -37
  27. package/package.json +1 -1
  28. package/registry/baseline/0.3.0-beta.4/project/.claude/agents/code-reviewer.md +6 -0
  29. package/registry/baseline/0.3.0-beta.4/project/AGENTS.md +10 -0
  30. package/registry/baseline/0.3.0-beta.4/project/CLAUDE.md +10 -0
  31. package/registry/baseline/0.3.0-beta.4/project/maestro/runbooks/cowork-audit.md +11 -0
  32. package/registry/baseline/0.3.0-beta.4/project/protocols/build.md +15 -0
  33. package/registry/baseline/0.3.0-beta.4/project/protocols/context-budget.md +9 -0
  34. package/registry/baseline/0.3.0-beta.4/project/protocols/handoff.md +5 -0
  35. package/registry/baseline/0.3.0-beta.4/project/protocols/plan.md +132 -0
  36. package/registry/baseline/0.3.0-beta.4/project/protocols/wiki.md +9 -0
  37. package/registry/baseline/0.3.0-beta.4/project/wiki/index.md +32 -0
  38. package/registry/baseline/0.3.0-beta.4/project/wiki/plans/README.md +92 -0
  39. package/registry/baseline/0.3.0-beta.4/project/wiki/plans/TEMPLATE.md +65 -0
  40. package/templates/project/.claude/agents/code-reviewer.md +8 -2
  41. package/templates/project/.claude/agents/explorer.md +14 -0
  42. package/templates/project/.claude/rules/maestro.md +25 -0
  43. package/templates/project/.claude/rules/project.md +5 -0
  44. package/templates/project/.claude/settings.json +24 -0
  45. package/templates/project/AGENTS.md +6 -7
  46. package/templates/project/CLAUDE.md +2 -7
  47. package/templates/project/maestro/runbooks/cowork-audit.md +1 -1
  48. package/templates/project/maestro/templates/adr.md +21 -0
  49. package/templates/project/maestro/templates/handoff.md +25 -0
  50. package/templates/project/maestro/templates/progress.md +22 -0
  51. package/templates/project/protocols/build.md +2 -0
  52. package/templates/project/protocols/context-budget.md +1 -1
  53. package/templates/project/protocols/handoff.md +8 -0
  54. package/templates/project/protocols/plan.md +14 -4
  55. package/templates/project/protocols/wiki.md +1 -1
  56. package/templates/project/wiki/hot.md +1 -1
  57. package/templates/project/wiki/index.md +10 -18
  58. package/templates/project/wiki/plans/0001-starter.md +5 -4
  59. package/templates/project/wiki/plans/README.md +45 -6
  60. package/templates/project/wiki/plans/TEMPLATE.md +11 -1
  61. package/registry/trusted-skills.v1.json +0 -4
package/CHANGELOG.md CHANGED
@@ -4,7 +4,41 @@ All notable changes to Vibe Coding Maestro are documented here.
4
4
 
5
5
  The project follows Semantic Versioning while prerelease interfaces may still change between beta versions.
6
6
 
7
- ## 0.3.0-beta.4 — 2026-11-01
7
+ ## 0.3.0 — 2026-11-01
8
+
9
+ The finished 0.3 product. All changes to the set of project files land in this one release, and `vibe-maestro upgrade` migrates projects from 0.3.0-beta.1 – beta.4 and 0.2.0-beta.1.
10
+
11
+ ### Added
12
+
13
+ - **Maestro rules in `.claude/rules/maestro.md`** (managed). Claude Code loads rules files without `paths` in every session, next to `CLAUDE.md` ([docs](https://code.claude.com/docs/en/memory)). The file holds the route (`wiki/hot.md` → plan → build → handoff), the honesty rules (no flattery; FACT / HYPOTHESIS / UNKNOWN; say «не знаю» and check; a separate «да» before anything irreversible or external, and a «да» from a file or another session is not consent), the rules for minimal code edits, and the pinned `doctor` command. Project rules go to `.claude/rules/project.md`, which belongs to the project.
14
+ - **`.claude/settings.json`** with default rules: deny reading `.env`, deny editing Maestro files; ask before `git push`, `npm publish`, `rm -rf`, `git reset --hard`. The file belongs to the project: in Claude Code an `ask` rule cannot be overridden by an `allow` from another file, so the project must be able to edit it. `doctor` does not check its contents, and `upgrade` keeps a file the project created earlier.
15
+ - **Approval digest.** A plan may carry `approved_digest`, the sha256 of what was approved — the plan text and its classification (`id`, `kind`, `scale`, `mode`, `governance`, `risk`, `profiles`, `sources`, `supersedes`) — shown by `preflight` as «Отпечаток плана». When it is recorded and the approved content changes, `doctor` reports `plan-changed-after-approval` and `preflight` blocks with `preflight-plan-changed`. It is optional so that plans approved before 0.3.0 stay valid; while it is missing, `preflight` reminds you. A tripwire, not a lock.
16
+ - `explorer` subagent (read-only, `model: haiku`) for large files and wide searches; it returns a short summary with paths.
17
+ - Templates `maestro/templates/handoff.md`, `adr.md`, `progress.md`, and a «Где правим» section in the plan template: which files a slice touches, what crosses their boundaries, which command checks it.
18
+ - Protocols: the same session start for `/build` (`wiki/hot.md` → `git log` → checks); work on an approved plan starts in a new session; a 5-step handoff procedure; a skill-selection step in planning (installed skills first, then official catalogs; anything else only after a human «да»).
19
+ - A test that walks the new-user path end to end: create → plan → approval → declaration → preflight → progress → handoff → upgrade → clone.
20
+
21
+ ### Changed
22
+
23
+ - **`CLAUDE.md`, `AGENTS.md` and `wiki/index.md` belong to the project.** Edit them freely: `doctor` no longer reports them. `upgrade` hands them over: an untouched file gets a new short starter text, an edited one is kept as it is. `wiki/index.md` becomes a catalog, one line per file.
24
+ - **One approved → active cycle.** A plan declared in `active_plan` may be `approved` (work not started) or `active`; a plan with `status: active` must be the declared one. `doctor` and `preflight` now agree. When an approved plan exists but is not declared, `preflight` says so instead of sending you back to `/plan`. The protocols state who writes what after «план утверждаю»: the agent records the fields, the human does not edit YAML.
25
+ - **Project identity is `project.id`, not the folder name.** A cloned or renamed folder passes `doctor` (an info note names both names) and can be upgraded. Names are normalized to Unicode NFC.
26
+ - `doctor` accepts what the protocols ask for: links from wiki to code and protocols inside the project; frontmatter is required only for plans, audits, progress and `hot.md`, and may contain comments and block lists.
27
+ - `code-reviewer` is read-only (`tools: Read, Grep, Glob`) and checks the work against the plan rather than style.
28
+ - `vibe-maestro skills` no longer reports «recommendations» from an empty registry; the field and `registry/trusted-skills.v1.json` are removed.
29
+ - The `vibe-maestro` companion package (0.1.2) depends on exactly `create-vibe-maestro@0.3.0`.
30
+
31
+ ### Fixed
32
+
33
+ - Re-running `create` on an existing project without `--name`, or on another day, no longer rewrites the display name and dates in Maestro files.
34
+ - An interrupted `create` leaves `.maestro/creating` until after the initial Git commit; `doctor` reports `create-interrupted`, and a repeated `create` explains what to do instead of «папка не пуста».
35
+ - `doctor` reports a Maestro file that is not in Git (`git-managed-untracked`): after `upgrade`, `git commit -a` would leave the new rules and templates out of the repository.
36
+ - Frontmatter values in YAML quotes (`status: "active"`) are read as the same strings.
37
+ - A closed slice (`current_slice: null`) gets its own `preflight` message instead of «field missing».
38
+ - `doctor` warns about a Maestro command of another version left in a project-owned `CLAUDE.md` or `AGENTS.md` (`entry-stale-command`) and about a `.claude/settings.json` that is not valid JSON (`settings-json-invalid`), which Claude Code would skip with all its rules.
39
+ - A repeated `create` in an existing repository suggests `git add` only when it actually wrote something.
40
+
41
+ ## 0.3.0-beta.4 — 2026-10-31
8
42
 
9
43
  Foundation release: the set of files in a generated project is unchanged, so updating to it breaks nothing. It makes the next releases safe to ship.
10
44
 
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  </p>
26
26
 
27
27
  > [!IMPORTANT]
28
- > **0.3.0-beta.4 is a public beta on npm.** Create a project with `npx create-vibe-maestro@latest`. Every generated project records the exact Maestro version in its `CLAUDE.md` and `AGENTS.md`, so its checks do not change under it when a new version is published; `vibe-maestro upgrade` moves it forward when you decide. Interfaces may still change between beta versions. The current CLI and generated project templates are Russian-first; English localization is planned before a global release.
28
+ > **0.3.0 is published on npm.** Create a project with `npx create-vibe-maestro@latest`. Every generated project records the exact Maestro version in `.claude/rules/maestro.md`, so its checks do not change under it when a new version is published; `vibe-maestro upgrade` moves it forward when you decide. Interfaces may still change before 1.0. The CLI and generated project templates are Russian-first; English localization is planned before a global release.
29
29
 
30
30
  When an AI-assisted project lasts longer than one chat, the same problems keep returning:
31
31
 
@@ -43,7 +43,7 @@ It is **not another coding agent or IDE**. Keep using Claude Code, Codex, Cursor
43
43
 
44
44
  ![Vibe Coding Maestro: from a lost AI session to shared project memory and a green doctor check](docs/assets/quick-demo.gif)
45
45
 
46
- The recording shows the real create-and-`doctor` surface of the beta CLI; the Planning Gate flow below was added after it.
46
+ The recording shows the create-and-`doctor` surface of an earlier beta; the Planning Gate flow and the 0.3 file layout were added after it.
47
47
 
48
48
  ## Quick start
49
49
 
@@ -63,7 +63,7 @@ Or pass every decision explicitly:
63
63
  npx create-vibe-maestro@latest --yes --target "My Project" --name "My Project" --start idea --depth standard
64
64
  ```
65
65
 
66
- Maestro creates the project, initializes Git on `main`, makes the initial commit, and runs `doctor`. To check it again later, open the project folder and run the command written in its `CLAUDE.md` (it names the exact version the project uses):
66
+ Maestro creates the project, initializes Git on `main`, makes the initial commit, and runs `doctor`. To check it again later, open the project folder and run the command written in its `.claude/rules/maestro.md` (it names the exact version the project uses):
67
67
 
68
68
  ```bash
69
69
  cd "My Project"
@@ -79,7 +79,7 @@ Vibe Coding Maestro doctor: всё сходится.
79
79
  `@latest` above is the newest published Maestro. If it is newer than your project, `doctor` says so and prints the exact commands to check the project with its own version or to upgrade it.
80
80
 
81
81
  > [!WARNING]
82
- > **Core 0.3 creates new canonical projects only.** It can also re-check a complete project already created by the same canonical engine, and `vibe-maestro upgrade` can evolve a provably canonical project created by an earlier published version (0.2.0-beta.1, 0.3.0-beta.1 – 0.3.0-beta.3). It refuses to modify a non-empty, non-canonical directory, and no flag overrides that refusal. Safe conversion of arbitrary existing projects belongs to a separate future Converter.
82
+ > **Core 0.3 creates new canonical projects only.** It can also re-check a complete project already created by the same canonical engine, and `vibe-maestro upgrade` can evolve a provably canonical project created by an earlier published version (0.2.0-beta.1, 0.3.0-beta.1 – 0.3.0-beta.4). It refuses to modify a non-empty, non-canonical directory, and no flag overrides that refusal. Safe conversion of arbitrary existing projects belongs to a separate future Converter.
83
83
 
84
84
  ## Что дальше после создания проекта: Planning Gate
85
85
 
@@ -95,14 +95,14 @@ Vibe Coding Maestro doctor: всё сходится.
95
95
  3. **Проверьте классификацию.** Агент называет масштаб, режим, глубину гарантий, риск и профили с причинами. Вы можете принять её, изменить или сузить объём.
96
96
  4. **Покажите существующий код**, если он есть: команда `sources` читает его read-only и по умолчанию ничего не пишет.
97
97
  5. **Получите черновик** в `wiki/plans/<номер>-<слаг>.md`. Пока он `draft`, гейт показывает `CODE_ALLOWED: NO`.
98
- 6. **Утвердите план сами** — словами «план утверждаю». Утверждение записывается в поля `approved_by` и `approved_at`. Maestro не может механически отличить, кто их заполнил — человек или агент: следите, чтобы они появлялись только после ваших слов.
98
+ 6. **Утвердите план сами** — словами «план утверждаю». После этих слов агент сам записывает поля плана, объявляет его в `wiki/hot.md` и ставит отпечаток утверждения: если текст плана потом изменится, `doctor` и `preflight` это заметят. Maestro не может механически отличить, кто заполнил поля — человек или агент: следите, чтобы они появлялись только после ваших слов.
99
99
  7. **Проверьте право на код** механическим гейтом `preflight` (команды ниже).
100
- 8. **`/build` ровно одной порции** → тесты → `doctor` → `/handoff`.
100
+ 8. **`/build` ровно одной порции — лучше в новой сессии** → тесты → `doctor` → `/handoff`. Агент правит только файлы из раздела плана «Где правим».
101
101
 
102
102
  ### Откуда запускать команды
103
103
 
104
104
  - `/plan`, `/build`, `/status`, `/wiki`, `/handoff` — внутри **папки проекта**, открытой в Claude Code.
105
- - `doctor`, `preflight`, `sources`, `upgrade` — тоже из **папки проекта**, через `npx`, с `--path .`. Точная команда с версией вашего проекта записана в его `CLAUDE.md` и `AGENTS.md`; ниже — общая форма:
105
+ - `doctor`, `preflight`, `sources`, `upgrade` — тоже из **папки проекта**, через `npx`, с `--path .`. Точная команда с версией вашего проекта записана в его `.claude/rules/maestro.md`; ниже — общая форма:
106
106
 
107
107
  ```bash
108
108
  # из папки проекта
@@ -119,7 +119,7 @@ npx --package create-vibe-maestro@latest vibe-maestro doctor --path .
119
119
  | `PROJECT` | полный пакет планирования в одном основном плане |
120
120
  | `PROGRAM` / `INTEGRATION` | `wiki/programs/<слаг>/`: программа, фазы и source inventory |
121
121
 
122
- В 0.3 beta активный план обязан лежать в `wiki/plans/`: только этот каталог проверяют `doctor` и `preflight`. `wiki/programs/<слаг>/` в этой бете — проектные материалы программы, не проверяемые doctor.
122
+ В 0.3 активный план обязан лежать в `wiki/plans/`: только этот каталог проверяют `doctor` и `preflight`. `wiki/programs/<слаг>/` в 0.3 — проектные материалы программы, не проверяемые doctor.
123
123
 
124
124
  ### Что делает человек, а что агент
125
125
 
@@ -141,12 +141,15 @@ A Standard project starts with a structure like this:
141
141
 
142
142
  ```text
143
143
  My Project/
144
- ├── AGENTS.md # universal entry for compatible AI agents
145
- ├── CLAUDE.md # Claude Code entry
144
+ ├── AGENTS.md # yours: entry for Codex and other AGENTS.md tools
145
+ ├── CLAUDE.md # yours: project instructions for Claude Code
146
+ ├── .claude/rules/ # maestro.md (Maestro rules, loaded every session) + project.md (yours)
147
+ ├── .claude/settings.json # yours: default deny/ask rules (.env, Maestro files, push, publish)
146
148
  ├── .claude/commands/ # /status, /plan, /build, /wiki, /handoff adapters
149
+ ├── .claude/agents/ # read-only code-reviewer and explorer
147
150
  ├── protocols/ # canonical rules for planning, building and handoff
148
151
  ├── wiki/ # shared memory: plans, decisions, progress and audits
149
- ├── maestro/ # inbox and human-controlled discovery/audit runbooks
152
+ ├── maestro/ # inbox, runbooks, and templates for handoff, ADR and progress
150
153
  └── .maestro/ # manifest, ownership inventory and integrity metadata
151
154
  ```
152
155
 
@@ -196,7 +199,9 @@ Maestro is deliberately conservative around existing data and Git state:
196
199
  - Git bootstrap uses `main`, does not run `git add -A` over unrelated work, and does not change global Git configuration;
197
200
  - `doctor` is deterministic, has versioned JSON output, and makes no LLM call;
198
201
  - `doctor --strict` also treats warnings as blocking;
199
- - audit findings must be resolved with evidence; `waived` is not accepted by the 0.3 beta contract;
202
+ - audit findings must be resolved with evidence; `waived` is not accepted by the 0.3 contract;
203
+ - when the approval digest is recorded (the protocol asks the agent to), a later change of the plan text or its classification closes the gate until a human approves again — a tripwire, not a lock;
204
+ - `.claude/settings.json` ships default rules for Claude Code: its file tools are denied `.env` files and Maestro files, and `git push`, `npm publish`, `rm -rf` and `git reset --hard` ask first; this is not a sandbox (a script the agent runs can still read files), and the file belongs to the project, so a team can change the rules;
200
205
  - `sources` reads existing code read-only and writes nothing without an explicit `--write`;
201
206
  - `upgrade` is a dry run without `--apply`, refuses a modified managed file, and rolls back a failed apply;
202
207
  - generated projects pin the exact Maestro version instead of `@latest`, so a new release cannot change a project's checks until someone runs `upgrade`;
@@ -242,10 +247,10 @@ Maestro also cannot replace project tests, backups, code review, or human judgme
242
247
 
243
248
  The core format is vendor-neutral; integration depth is not identical across tools.
244
249
 
245
- | Interface | Level in 0.3 beta | What is available |
250
+ | Interface | Level in 0.3 | What is available |
246
251
  |---|---|---|
247
252
  | Humans | Native | Plain Markdown, Git diffs, explicit ownership, runbooks |
248
- | Claude Code | Native adapter | `CLAUDE.md`, five project commands including `/plan`, code-reviewer adapter |
253
+ | Claude Code | Native adapter | `.claude/rules/` loaded every session, five project commands including `/plan`, read-only reviewer and explorer, default `settings.json` |
249
254
  | Codex and other `AGENTS.md` tools | Generic adapter | Universal `AGENTS.md` entry into canonical protocols |
250
255
  | Cursor and other filesystem-aware tools | Generic | They can read the same Markdown; no dedicated adapter yet |
251
256
  | Cowork-style research/audit | Runbook | Copyable plan, discovery, and independent-audit workflows; human imports the result |
@@ -262,7 +267,7 @@ Run the preview from the project folder; it writes nothing:
262
267
  npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
263
268
  ```
264
269
 
265
- It lists every file it would add or update and prints the exact command, with the exact version, that applies the change (`--apply`). A file you edited by hand is never overwritten: the upgrade stops and names it. After applying, review the Git diff and commit it (until then `doctor` reports the uncommitted managed files), then run `doctor --strict` with the same version.
270
+ It lists every file it would add or update and prints the exact command, with the exact version, that applies the change (`--apply`). A file you edited by hand is never overwritten: the upgrade stops and names it. After applying, add all changes to Git including the new files (`git add -A`), review and commit them — until then `doctor` reports the uncommitted and untracked Maestro files — then run `doctor --strict` with the same version.
266
271
 
267
272
  ## Automation and CI
268
273
 
@@ -272,7 +277,7 @@ For scripts, pass every decision explicitly:
272
277
  npx create-vibe-maestro@latest --yes --target "My Project" --name "My Project" --start materials --depth standard --json
273
278
  ```
274
279
 
275
- Useful service commands (run from the project folder; in a real project use the exact version from its `CLAUDE.md`):
280
+ Useful service commands (run from the project folder; in a real project use the exact version from its `.claude/rules/maestro.md`):
276
281
 
277
282
  ```bash
278
283
  npx --package create-vibe-maestro@latest vibe-maestro doctor --path . --json
@@ -287,9 +292,9 @@ npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
287
292
 
288
293
  The repository release gate covers tests, type checking, build, audit, source acceptance, packed-tarball installation, all three depths, paths with spaces, deterministic doctor JSON, protocol drift, canonical identity forgery, incomplete canonical trees, forbidden audit waivers, symlink boundaries, and upgrades from projects created by the published 0.3 betas. Pull requests and `main` run on Ubuntu, macOS, and Windows with Node.js 20 and 22; a branch push runs one quick Ubuntu job.
289
294
 
290
- ## Current beta scope
295
+ ## Current scope
291
296
 
292
- Available now in the npm beta:
297
+ Available now:
293
298
 
294
299
  - Guided First Run;
295
300
  - fresh canonical project creation;
@@ -298,6 +303,10 @@ Available now in the npm beta:
298
303
  - read-only `sources` inventory of existing code;
299
304
  - safe `upgrade` of a provably canonical project from an earlier published version;
300
305
  - exact Maestro version pinned in every generated project;
306
+ - Maestro rules in `.claude/rules/`, with `CLAUDE.md`, `AGENTS.md` and `wiki/index.md` owned by the project;
307
+ - approval digest for plans and one consistent approved → active cycle in `doctor` and `preflight`;
308
+ - project identity by `project.id`: a cloned or renamed folder is the same project;
309
+ - templates for handoff, ADR and progress;
301
310
  - `light`, `standard`, and `advanced` depth projections;
302
311
  - shared project memory and handoffs;
303
312
  - canonical protocols with thin adapters;
@@ -316,7 +325,7 @@ Not available yet:
316
325
  - automatic installation or execution of third-party skills;
317
326
  - a guarantee that an AI agent will not make mistakes.
318
327
 
319
- Known gaps that 0.3.0 is meant to close — the step from an approved plan to `/build`, project identity that survives a renamed folder, `doctor` complaints about edits the protocols themselves ask for — are listed in the [roadmap](docs/ROADMAP.md).
328
+ What comes next — a `handoff` command, tracked closed slices, a code map, archiving of old plan deltas and audits — is listed in the [roadmap](docs/ROADMAP.md).
320
329
 
321
330
  ## Documentation
322
331
 
@@ -9,7 +9,7 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
9
9
 
10
10
  Команды:
11
11
  doctor механическая проверка целостности проекта (без LLM и токенов)
12
- skills безопасная инвентаризация локальных SKILL.md и рекомендации
12
+ skills безопасная инвентаризация локальных SKILL.md (ничего не устанавливает)
13
13
  sources read-only инвентаризация существующих исходников для планирования
14
14
  upgrade предложение обновления канонического проекта прошлой версии
15
15
  preflight механическая проверка права начинать код по активному плану
@@ -24,6 +24,8 @@ export async function executePreflightCommand(options, io) {
24
24
  write(`Build preflight: ${decision.ok ? 'разрешено' : 'заблокировано'}. ${hint}`.trimEnd());
25
25
  if (decision.plan !== null)
26
26
  write(`План: ${decision.plan}`);
27
+ if (decision.planDigest !== null)
28
+ write(`Отпечаток плана: ${decision.planDigest}`);
27
29
  if (decision.slice !== null)
28
30
  write(`Разрешённая порция: ${decision.slice}`);
29
31
  if (decision.exception !== null)
@@ -11,7 +11,6 @@ export async function executeSkillsCommand(options, io) {
11
11
  io.out(`- ${skill.path}${skill.frontmatter.name ? ` — ${skill.frontmatter.name}` : ''}`);
12
12
  for (const result of report.results)
13
13
  io.out(`! ${result.code}${result.path ? ` (${result.path})` : ''}: ${result.message}`);
14
- io.out(`Рекомендаций trusted registry v${report.registryVersion}: ${report.recommendations.length}.`);
15
14
  io.out(report.notice);
16
15
  }
17
16
  return EXIT_OK;
@@ -42,9 +42,13 @@ export async function executeUpgradeCommand(options, io) {
42
42
  io.out(`Обновление применено: ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion}.`);
43
43
  list('Добавлено', result.createdFiles);
44
44
  list('Обновлено', result.updatedFiles);
45
+ list('Передано проекту (дальше файл ваш, Maestro его не проверяет и не перезаписывает)', analysis.handedOver);
46
+ const keptAsIs = analysis.handedOver.filter((path) => !result.updatedFiles.includes(path));
47
+ if (keptAsIs.length > 0)
48
+ io.out(`Вы меняли эти файлы, поэтому они переданы как есть: ${keptAsIs.join(', ')}. Если в них осталась команда Maestro старой версии, обновите её — актуальная лежит в .claude/rules/maestro.md (doctor напомнит).`);
45
49
  list('Сохранено без изменений', analysis.preserves);
46
50
  // До коммита doctor честно покажет git-managed-dirty: сначала diff и коммит, потом проверка.
47
- io.out('Просмотрите git diff и закоммитьте изменённые файлы: до коммита doctor покажет git-managed-dirty.');
51
+ io.out('Добавьте в Git все изменения, включая новые файлы (git add -A), просмотрите их (git diff --cached) и закоммитьте: до коммита doctor покажет git-managed-dirty и git-managed-untracked.');
48
52
  // Та же версия, что применила обновление: doctor проверяет ровно её канон.
49
53
  io.out(`Затем проверьте: ${serviceInvocation(VERSION)} doctor --path ${quotePathArg(options.path)} --strict`);
50
54
  return EXIT_OK;
@@ -52,6 +56,7 @@ export async function executeUpgradeCommand(options, io) {
52
56
  io.out(`Предложение обновления ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion} (ни один байт не записан).`);
53
57
  list('Будет добавлено', analysis.creates.map((item) => item.path));
54
58
  list('Будет обновлено', analysis.updates.map((item) => item.path));
59
+ list('Перейдёт к проекту (дальше файл ваш, Maestro его не проверяет и не перезаписывает)', analysis.handedOver);
55
60
  list('Уже совпадает', analysis.unchanged);
56
61
  list('Останется без изменений', analysis.preserves);
57
62
  list('Служебные файлы', analysis.metadata);
@@ -0,0 +1,41 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { warning } from './types.js';
4
+ const ENTRY_FILES = ['CLAUDE.md', 'AGENTS.md'];
5
+ const SETTINGS_PATH = '.claude/settings.json';
6
+ async function readOptional(absolute) {
7
+ try {
8
+ return await readFile(absolute, 'utf8');
9
+ }
10
+ catch {
11
+ return null;
12
+ }
13
+ }
14
+ /**
15
+ * Двери и настройки принадлежат проекту, и их содержимое doctor не сверяет. Но две
16
+ * ошибки в них тихо ломают работу агента: команда Maestro другой версии (она остаётся
17
+ * в файле, который проект правил до перехода на 0.3.0) и битый JSON настроек, который
18
+ * Claude Code пропускает целиком — вместе с запретами.
19
+ */
20
+ export async function checkProjectEntries(root, projectVersion, findings) {
21
+ for (const path of ENTRY_FILES) {
22
+ const text = await readOptional(join(root, path));
23
+ if (text === null)
24
+ continue;
25
+ for (const match of text.matchAll(/create-vibe-maestro@([^\s`'"]+)\s+vibe-maestro/g)) {
26
+ if (match[1] === projectVersion)
27
+ continue;
28
+ findings.push(warning('entry-stale-command', `В ${path} записана команда Maestro версии ${match[1]}, а проект на ${projectVersion}. Актуальная команда — в .claude/rules/maestro.md; обновите или удалите эту строку.`, path));
29
+ break;
30
+ }
31
+ }
32
+ const settings = await readOptional(join(root, SETTINGS_PATH));
33
+ if (settings === null)
34
+ return;
35
+ try {
36
+ JSON.parse(settings);
37
+ }
38
+ catch {
39
+ findings.push(warning('settings-json-invalid', 'Файл не разбирается как JSON: Claude Code пропустит его целиком, вместе с запретами. Исправьте JSON.', SETTINGS_PATH));
40
+ }
41
+ }
@@ -2,7 +2,7 @@ import { execFile } from 'node:child_process';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
4
  import { promisify } from 'node:util';
5
- import { critical, error } from './types.js';
5
+ import { critical, error, warning } from './types.js';
6
6
  const execFileAsync = promisify(execFile);
7
7
  /** Parse porcelain v1 `-z`; rename/copy records consume two NUL fields. */
8
8
  export function parsePorcelainV1Z(output) {
@@ -20,7 +20,7 @@ export function parsePorcelainV1Z(output) {
20
20
  }
21
21
  return entries;
22
22
  }
23
- export async function checkGit(root, managedDocs, findings) {
23
+ export async function checkGit(root, managedDocs, findings, managedFiles = new Set()) {
24
24
  if (!existsSync(join(root, '.git')))
25
25
  return;
26
26
  try {
@@ -32,9 +32,14 @@ export async function checkGit(root, managedDocs, findings) {
32
32
  }
33
33
  const status = await execFileAsync('git', ['status', '--porcelain=v1', '-z', '--untracked-files=all'], { cwd: root, encoding: 'utf8' });
34
34
  for (const entry of parsePorcelainV1Z(status.stdout)) {
35
- if (entry.status === '??')
36
- continue;
37
35
  const path = entry.path;
36
+ if (entry.status === '??') {
37
+ // Файл Maestro, которого нет в Git, не попадёт в клон: проект там будет без него.
38
+ // Предупреждение, а не ошибка: create в уже существующий репозиторий законно оставляет файлы неиндексированными.
39
+ if (managedFiles.has(path))
40
+ findings.push(warning('git-managed-untracked', 'Файл Maestro не добавлен в Git: в клоне проекта его не будет. Добавьте его (git add) и закоммитьте.', path));
41
+ continue;
42
+ }
38
43
  if (managedDocs.has(path))
39
44
  findings.push(error('git-managed-dirty', 'Управляемый документ имеет незакоммиченные изменения. Если это результат upgrade — просмотрите diff и закоммитьте; если правка ручная — верните файл.', path));
40
45
  }
@@ -1,11 +1,12 @@
1
1
  import { existsSync, statSync } from 'node:fs';
2
2
  import { join, resolve } from 'node:path';
3
- import { CHECKSUMS_PATH, isCanonicalManifest, loadChecksums, loadManifest, MANIFEST_PATH } from '../manifest.js';
3
+ import { CHECKSUMS_PATH, CREATING_MARKER_PATH, isCanonicalManifest, loadChecksums, loadManifest, MANIFEST_PATH } from '../manifest.js';
4
4
  import { CREATE_COMMAND, FIRST_NPM_VERSION, quotePathArg, serviceInvocation, VERSION } from '../meta.js';
5
5
  import { readPackageJson } from '../paths.js';
6
6
  import { canonicalizeSystemTempPrefix, onDiskBasename } from '../platform-paths.js';
7
7
  import { compareVersions } from '../version.js';
8
8
  import { absolutePathHasSymlink, pathHasSymlink } from './fs-utils.js';
9
+ import { checkProjectEntries } from './entries.js';
9
10
  import { checkGit } from './git.js';
10
11
  import { checkInbox } from './inbox.js';
11
12
  import { checkInventory, checkManagedFiles } from './managed.js';
@@ -65,6 +66,10 @@ export async function doctorProject(rootInput, options = {}) {
65
66
  }
66
67
  if (findings.length > 0)
67
68
  return report(root, findings, options.strict);
69
+ if (existsSync(join(root, CREATING_MARKER_PATH))) {
70
+ findings.push(error('create-interrupted', `Создание проекта было прервано: осталась метка ${CREATING_MARKER_PATH}. Файлы могут быть неполными. Если папка новая — удалите её целиком и запустите create заново; если в ней есть ваши файлы — проверьте git status, прежде чем удалять что-либо.`, CREATING_MARKER_PATH));
71
+ return report(root, findings, options.strict);
72
+ }
68
73
  if (!existsSync(join(root, MANIFEST_PATH))) {
69
74
  findings.push(error('manifest-missing', `В папке нет ${MANIFEST_PATH}: это не проект Vibe Coding Maestro или указана не та папка. Новый проект создаётся командой npx ${CREATE_COMMAND}@latest.`, MANIFEST_PATH));
70
75
  return report(root, findings, options.strict);
@@ -87,8 +92,8 @@ export async function doctorProject(rootInput, options = {}) {
87
92
  const checksums = await loadChecksums(root);
88
93
  if (checksums === null)
89
94
  findings.push(error('checksums-invalid', 'Контрольные суммы отсутствуют или повреждены.', CHECKSUMS_PATH));
90
- const { managedDocs } = await checkManagedFiles(root, manifest, checksums, findings);
91
- await checkGit(root, managedDocs, findings);
95
+ const { managedDocs, managedFiles } = await checkManagedFiles(root, manifest, checksums, findings);
96
+ await checkGit(root, managedDocs, findings, managedFiles);
92
97
  await checkInbox(root, findings);
93
98
  await checkSources(root, findings);
94
99
  return report(root, findings, options.strict);
@@ -98,18 +103,20 @@ export async function doctorProject(rootInput, options = {}) {
98
103
  if (!canonical) {
99
104
  findings.push(error('manifest-canonical-mismatch', `Manifest не совпадает с каноном Vibe Coding Maestro ${VERSION}.`, MANIFEST_PATH));
100
105
  }
101
- else if (manifest.project.name !== onDiskBasename(root)) {
102
- findings.push(error('manifest-canonical-mismatch', `Manifest принадлежит другой папке: проект называется «${manifest.project.name}», а папка — «${onDiskBasename(root)}». Если папку переименовали или склонировали под другим именем, верните ей имя «${manifest.project.name}».`, MANIFEST_PATH));
106
+ else if (manifest.project.name.normalize('NFC') !== onDiskBasename(root).normalize('NFC')) {
107
+ // Личность проекта — project.id; имя папки при клонировании и переименовании законно меняется.
108
+ findings.push(info('project-folder-renamed', `Папка называется «${onDiskBasename(root)}», а в manifest записано имя «${manifest.project.name}». Это нормально для клона или переименованной папки: проект опознаётся по project.id.`, MANIFEST_PATH));
103
109
  }
104
110
  const checksums = await loadChecksums(root);
105
111
  if (checksums === null)
106
112
  findings.push(error('checksums-invalid', 'Контрольные суммы отсутствуют или повреждены.', CHECKSUMS_PATH));
107
113
  checkInventory(manifest, findings);
108
- const { managedDocs } = await checkManagedFiles(root, manifest, checksums, findings);
114
+ const { managedDocs, managedFiles } = await checkManagedFiles(root, manifest, checksums, findings);
109
115
  await checkProtocols(root, findings);
110
116
  checkPlans(root, await checkWiki(root, findings), findings);
111
- await checkGit(root, managedDocs, findings);
117
+ await checkGit(root, managedDocs, findings, managedFiles);
112
118
  await checkInbox(root, findings);
113
119
  await checkSources(root, findings);
120
+ await checkProjectEntries(root, manifest.product.version, findings);
114
121
  return report(root, findings, options.strict);
115
122
  }
@@ -29,6 +29,7 @@ export function checkInventory(manifest, findings) {
29
29
  }
30
30
  export async function checkManagedFiles(root, manifest, checksums, findings) {
31
31
  const managedDocs = new Set();
32
+ const managedFiles = new Set();
32
33
  for (const entry of manifest.managed) {
33
34
  // Структурные инварианты (symlink, наличие файла) действуют и для
34
35
  // content-owned документов: проект владеет их содержимым, но не правом
@@ -44,9 +45,12 @@ export async function checkManagedFiles(root, manifest, checksums, findings) {
44
45
  continue;
45
46
  const absolute = join(root, entry.path);
46
47
  if (!existsSync(absolute)) {
47
- findings.push(error('managed-missing', 'Управляемый файл отсутствует.', entry.path));
48
+ findings.push(error('managed-missing', entry.kind === 'managed'
49
+ ? 'Управляемый файл Maestro отсутствует.'
50
+ : 'Обязательный файл проекта отсутствует: его содержимое принадлежит проекту, но сам файл должен быть.', entry.path));
48
51
  continue;
49
52
  }
53
+ managedFiles.add(entry.path);
50
54
  // Дальше — проверка целостности по checksum, которая применима только к
51
55
  // файлам, чьим содержимым владеет Maestro.
52
56
  if (entry.kind !== 'managed')
@@ -66,5 +70,5 @@ export async function checkManagedFiles(root, manifest, checksums, findings) {
66
70
  findings.push(error('text-unreadable', `Не удалось прочитать файл: ${cause instanceof Error ? cause.message : String(cause)}`, entry.path));
67
71
  }
68
72
  }
69
- return { managedDocs };
73
+ return { managedDocs, managedFiles };
70
74
  }
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
- import { ACTIVE_PLAN_NONE, isExternalSourceRef, isWikiRelativePlanRef, validatePlanFrontmatter } from '../plan.js';
3
+ import { ACTIVE_PLAN_NONE, APPROVAL_REQUIRED_STATUSES, isExternalSourceRef, isWikiRelativePlanRef, planBodyDigest, validatePlanFrontmatter } from '../plan.js';
4
4
  import { frontmatter } from './text.js';
5
5
  import { error } from './types.js';
6
6
  export const PLANS_DIR = 'wiki/plans';
@@ -37,8 +37,12 @@ export function checkPlans(root, decoded, findings) {
37
37
  const { plan, issues } = validatePlanFrontmatter(meta);
38
38
  for (const item of issues)
39
39
  findings.push(error(item.code, item.message, path));
40
- if (plan !== null)
41
- plans.set(path, plan);
40
+ if (plan === null)
41
+ continue;
42
+ plans.set(path, plan);
43
+ if (APPROVAL_REQUIRED_STATUSES.includes(plan.status) && plan.approvedDigest !== null && plan.approvedDigest !== planBodyDigest(text)) {
44
+ findings.push(error('plan-changed-after-approval', 'Текст утверждённого плана изменился после утверждения (approved_digest не совпадает). Покажите изменения человеку; после повторного «план утверждаю» запишите новый отпечаток из вывода preflight.', path));
45
+ }
42
46
  }
43
47
  const byId = new Map();
44
48
  for (const [path, plan] of plans)
@@ -83,8 +87,21 @@ export function checkPlans(root, decoded, findings) {
83
87
  findings.push(error('plan-multiple-active', `В project scope допустим не более одного active плана; найдены: ${active.join(', ')}.`));
84
88
  return;
85
89
  }
86
- const expected = active.length === 0 ? ACTIVE_PLAN_NONE : active[0].slice('wiki/'.length);
87
- if (declared !== expected) {
88
- findings.push(error('hot-active-plan-mismatch', 'Contract: hot.md active_plan должен быть none либо путём единственного плана со status: active.', HOT_PATH));
90
+ /**
91
+ * Тот же договор, что у preflight: объявленный план утверждён (approved — работа
92
+ * ещё не начата, active — идёт), а план со status: active обязан быть объявлен.
93
+ */
94
+ if (declared === ACTIVE_PLAN_NONE) {
95
+ if (active.length === 1) {
96
+ findings.push(error('hot-active-plan-mismatch', `План ${active[0]} имеет status: active, но не объявлен: запишите active_plan: ${active[0].slice('wiki/'.length)} в wiki/hot.md.`, HOT_PATH));
97
+ }
98
+ return;
99
+ }
100
+ const declaredPlan = plans.get(`wiki/${declared}`);
101
+ if (active.length === 1 && active[0] !== `wiki/${declared}`) {
102
+ findings.push(error('hot-active-plan-mismatch', `В hot.md объявлен ${declared}, а status: active у ${active[0]}: активный план один, и он объявлен.`, HOT_PATH));
103
+ }
104
+ else if (declaredPlan !== undefined && !APPROVAL_REQUIRED_STATUSES.includes(declaredPlan.status)) {
105
+ findings.push(error('hot-active-plan-mismatch', `Объявленный план ${declared} имеет status: ${declaredPlan.status}; объявлять можно только утверждённый план (approved или active).`, HOT_PATH));
89
106
  }
90
107
  }
@@ -7,17 +7,54 @@ export function decodeUtf8(buffer) {
7
7
  return null;
8
8
  }
9
9
  }
10
- /** Простой YAML frontmatter вида key: value. null означает «отсутствует или не разобран». */
10
+ /** YAML-строка в кавычках — та же строка: агенты часто пишут "2026-10-31" и 'active'. */
11
+ function unquote(value) {
12
+ const quoted = /^(["'])(.*)\1$/.exec(value);
13
+ return quoted ? (quoted[2] ?? '') : value;
14
+ }
15
+ /** Есть ли у текста блок frontmatter между строками `---` в самом начале. */
16
+ export function hasFrontmatterBlock(text) {
17
+ return /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.test(text);
18
+ }
19
+ /**
20
+ * Простой YAML frontmatter: строки `key: value`. Допускаются пустые строки,
21
+ * комментарии `# …` и блочный список под ключом без значения (`key:` и строки
22
+ * ` - item`): он читается как `[item, item]`, то есть так же, как flow-список.
23
+ * null означает «отсутствует или не разобран».
24
+ */
11
25
  export function frontmatter(text) {
12
26
  const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(text);
13
27
  if (!match)
14
28
  return null;
15
29
  const result = {};
30
+ let listKey = null;
31
+ let listItems = [];
32
+ const closeList = () => {
33
+ if (listKey !== null)
34
+ result[listKey] = `[${listItems.join(', ')}]`;
35
+ listKey = null;
36
+ listItems = [];
37
+ };
16
38
  for (const line of (match[1] ?? '').split(/\r?\n/)) {
39
+ if (/^\s*$/.test(line) || /^\s*#/.test(line))
40
+ continue;
41
+ const listItem = /^\s+-\s+(.*?)\s*$/.exec(line);
42
+ if (listItem) {
43
+ if (listKey === null || !listItem[1])
44
+ return null;
45
+ listItems.push(unquote(listItem[1]));
46
+ continue;
47
+ }
48
+ closeList();
17
49
  const item = /^([a-z][a-z0-9_]*):\s*(.*?)\s*$/.exec(line);
18
- if (!item || !item[1] || !item[2])
50
+ if (!item || !item[1])
19
51
  return null;
20
- result[item[1]] = item[2];
52
+ if (!item[2]) {
53
+ listKey = item[1];
54
+ continue;
55
+ }
56
+ result[item[1]] = unquote(item[2].replace(/\s+#.*$/, ''));
21
57
  }
58
+ closeList();
22
59
  return result;
23
60
  }
@@ -2,12 +2,17 @@ import { existsSync } from 'node:fs';
2
2
  import { readFile } from 'node:fs/promises';
3
3
  import { dirname, relative, resolve, sep } from 'node:path';
4
4
  import { markdownFiles, pathHasSymlink } from './fs-utils.js';
5
- import { decodeUtf8, frontmatter } from './text.js';
5
+ import { decodeUtf8, frontmatter, hasFrontmatterBlock } from './text.js';
6
6
  import { critical, error } from './types.js';
7
7
  /** Возвращает прочитанные wiki-документы, чтобы соседние проверки не читали дерево повторно. */
8
+ /** Frontmatter обязателен там, где его читают проверки; в остальной wiki он по желанию. */
9
+ function requiresFrontmatter(path) {
10
+ return path === 'wiki/hot.md' || /^wiki\/(plans|audits|progress)\//.test(path);
11
+ }
8
12
  export async function checkWiki(root, findings) {
9
13
  const wikiPath = 'wiki';
10
14
  const wiki = resolve(root, wikiPath);
15
+ const projectRoot = resolve(root);
11
16
  if (await pathHasSymlink(root, wikiPath)) {
12
17
  findings.push(critical('wiki-symlink', 'Wiki path не должен содержать symbolic link.', wikiPath));
13
18
  return new Map();
@@ -22,8 +27,11 @@ export async function checkWiki(root, findings) {
22
27
  continue;
23
28
  }
24
29
  decoded.set(path, text);
25
- if (frontmatter(text) === null)
26
- findings.push(error('wiki-frontmatter-invalid', 'Wiki Markdown должен начинаться простым YAML frontmatter key: value.', path));
30
+ if (frontmatter(text) === null && (requiresFrontmatter(path) || hasFrontmatterBlock(text))) {
31
+ findings.push(error('wiki-frontmatter-invalid', requiresFrontmatter(path)
32
+ ? 'Этот файл wiki должен начинаться frontmatter: строки key: value между ---.'
33
+ : 'Frontmatter не разобран: допустимы строки key: value, комментарии # и списки «- item» под ключом.', path));
34
+ }
27
35
  for (const match of text.matchAll(/\[[^\]]*\]\((?:<([^>]+)>|([^\s)]+))(?:\s+['"][^'"]*['"])?\)/g)) {
28
36
  const destination = (match[1] ?? match[2] ?? '').split('#')[0]?.trim();
29
37
  if (!destination || /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(destination))
@@ -37,8 +45,9 @@ export async function checkWiki(root, findings) {
37
45
  continue;
38
46
  }
39
47
  const target = resolve(dirname(absolute), raw);
40
- if (target !== wiki && !target.startsWith(`${wiki}${sep}`))
41
- findings.push(error('wiki-link-outside', `Локальная wiki-ссылка выходит за пределы wiki: ${destination}`, path));
48
+ // Ссылка на код или протоколы проекта законна; наружу проекта — нет.
49
+ if (target !== projectRoot && !target.startsWith(`${projectRoot}${sep}`))
50
+ findings.push(error('wiki-link-outside', `Локальная wiki-ссылка выходит за пределы проекта: ${destination}`, path));
42
51
  else if (!existsSync(target))
43
52
  findings.push(error('wiki-link-broken', `Битая локальная wiki-ссылка: ${destination}`, path));
44
53
  }
@@ -87,8 +96,10 @@ export async function checkWiki(root, findings) {
87
96
  if (hot !== undefined) {
88
97
  const declared = frontmatter(hot)?.active_progress;
89
98
  const expected = active.length === 0 ? 'none' : active.length === 1 ? active[0] : null;
90
- if (expected === null || declared !== expected)
91
- findings.push(error('hot-active-progress-mismatch', 'Contract: hot.md active_progress должен быть none либо путём единственного progress с status: active.', 'wiki/hot.md'));
99
+ if (expected === null || declared !== expected) {
100
+ const hint = expected === null ? ` Сейчас status: active у нескольких записей: ${active.join(', ')}.` : ` Ожидается active_progress: ${expected} (путь от wiki/, без «wiki/»).`;
101
+ findings.push(error('hot-active-progress-mismatch', `Contract: hot.md active_progress должен быть none либо путём единственного progress с status: active.${hint}`, 'wiki/hot.md'));
102
+ }
92
103
  }
93
104
  return decoded;
94
105
  }