create-vibe-maestro 0.3.0-beta.3 → 0.3.0-beta.4

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 (35) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +53 -62
  3. package/dist/cli/create-run.js +17 -0
  4. package/dist/cli/create.js +3 -3
  5. package/dist/cli/desktop.js +10 -1
  6. package/dist/cli/doctor-run.js +4 -0
  7. package/dist/cli/preflight-run.js +4 -2
  8. package/dist/cli/upgrade-run.js +5 -3
  9. package/dist/core/doctor/git.js +1 -1
  10. package/dist/core/doctor/index.js +68 -6
  11. package/dist/core/fs-errors.js +32 -0
  12. package/dist/core/init.js +38 -4
  13. package/dist/core/meta.js +5 -2
  14. package/dist/core/platform-paths.js +16 -1
  15. package/dist/core/preflight.js +11 -0
  16. package/dist/core/template.js +2 -1
  17. package/dist/core/upgrade/analyze.js +155 -84
  18. package/dist/core/upgrade/index.js +20 -5
  19. package/dist/core/upgrade/instance.js +12 -2
  20. package/dist/core/upgrade/releases.js +168 -0
  21. package/dist/core/version.js +60 -0
  22. package/docs/MIGRATION_V1.md +2 -1
  23. package/docs/ROADMAP.md +59 -0
  24. package/docs/USER_GUIDE.md +52 -98
  25. package/package.json +3 -2
  26. package/registry/baseline/0.3-beta/project/.claude/commands/build.md +3 -0
  27. package/registry/baseline/0.3-beta/project/AGENTS.md +10 -0
  28. package/registry/baseline/0.3-beta/project/CLAUDE.md +10 -0
  29. package/registry/baseline/0.3-beta/project/protocols/build.md +15 -0
  30. package/registry/baseline/0.3-beta/project/protocols/plan.md +132 -0
  31. package/templates/project/.claude/commands/build.md +1 -1
  32. package/templates/project/AGENTS.md +1 -1
  33. package/templates/project/CLAUDE.md +1 -1
  34. package/templates/project/protocols/build.md +1 -1
  35. package/templates/project/protocols/plan.md +2 -2
package/CHANGELOG.md CHANGED
@@ -4,6 +4,36 @@ 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
8
+
9
+ 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
+
11
+ ### Added
12
+
13
+ - `vibe-maestro upgrade` updates a project from any published version: 0.2.0-beta.1 and 0.3.0-beta.1 – 0.3.0-beta.3 (beta.1 was never on npm, but the first 0.3 projects were created with it). Each known version is recorded in the package together with the exact old copies of the files that changed since, so the upgrade can still prove a file was not edited by hand before replacing it. Tests use projects generated by the real published 0.3.0-beta.2 and beta.3 packages.
14
+ - `npm run check` (tests, type check, build) — the one command to run before pushing; `prepack` uses it too.
15
+
16
+ ### Changed
17
+
18
+ - **Generated projects pin the exact Maestro version.** `CLAUDE.md`, `AGENTS.md`, `/build` and the build and plan protocols now call `npx --package create-vibe-maestro@0.3.0-beta.4 vibe-maestro …` instead of `@latest`, so a new release — or a bad one — cannot change a project's checks until someone runs `upgrade`. `upgrade` rewrites the version itself. Hints printed by the CLI use the running version.
19
+ - The `vibe-maestro` companion package (0.1.1) depends on exactly `create-vibe-maestro@0.3.0-beta.4` instead of `latest`.
20
+ - When the project and the running Maestro are different versions, `doctor` says so instead of a wall of `manifest-*` errors: `project-outdated` or `project-newer` (error) prints the command to check the project with its own version and the command to upgrade it; `project-version-older` / `project-version-newer` (info) mark a project whose file set matches. A renamed or re-cloned folder gets a message naming both the folder and the project name.
21
+ - CI is cheaper: a new push cancels the outdated run of the same branch or pull request; a branch push runs one quick Ubuntu job; the full 3 OS × Node 20/22 matrix, acceptance and `npm audit` run on pull requests and `main`.
22
+ - README, the user guide and the companion README describe the `npx` flow only; building from source moved to `CONTRIBUTING.md`. The one-line clone command that hid errors is gone.
23
+
24
+ ### Fixed
25
+
26
+ - `create-vibe-maestro` no longer prints a Node.js stack trace when it cannot write: missing permissions, a full or read-only disk, or a wrong path produce one sentence with the reason and what to do; an interrupted create in a previously empty folder says the folder can be deleted and the command repeated. Running `create` on a project of an older version with a different file set points to `upgrade`.
27
+ - `doctor` on a missing folder says «Папка не найдена» (`project-path-missing`) and on a folder without Maestro says so (`manifest-missing`) instead of a raw `ENOENT`; `preflight` reports `preflight-path-missing` / `preflight-not-project` instead of sending the user to `protocols/plan.md`.
28
+ - A path dragged into the terminal on macOS or Linux (`My\ Project`) is unescaped in the guided setup.
29
+ - `create` no longer changes the version of an existing project, up or down: a project of another version is refused with the matching `upgrade` or `doctor` command. Before, it silently rewrote files of a project with the same file set.
30
+ - A failed rollback in `upgrade --apply` is reported as failed, names the files it could not restore, and keeps `.maestro/upgrade-staging/backup/`; it no longer deletes the only copy of the previous files and reports success. The leftover-staging message tells you to compare with `backup/` before deleting it.
31
+ - On a project of another canon, `doctor` still checks managed checksums, tracked secrets, sources and inbox instead of reporting only the version; it does not suggest checking with a version that was never on npm (0.2.0-beta.1, 0.3.0-beta.1).
32
+ - On case-insensitive file systems (macOS, Windows) a path typed in a different case is no longer treated as a renamed folder.
33
+ - An edit in a managed file that `upgrade` does not touch never blocks it, even when the file contains the project name.
34
+ - A failed `create` in a folder that holds only `.git` no longer advises deleting the folder.
35
+ - Documentation no longer claims that an AI agent cannot record a plan approval: the protocol forbids it, but Maestro cannot tell mechanically who filled in `approved_by` and `approved_at`. The 0.3.0-beta.1 entry below overstated this.
36
+
7
37
  ## 0.3.0-beta.3 — 2026-10-31
8
38
 
9
39
  ### Added
@@ -59,7 +89,7 @@ First release published to npm. `npx create-vibe-maestro@latest` and `npx --pack
59
89
 
60
90
  - Existing source projects are read-only inputs; source inventory is not an importer or converter.
61
91
  - Non-canonical projects are not modified by `create` or `upgrade`.
62
- - Human approval cannot be supplied automatically by an AI agent.
92
+ - Human approval cannot be supplied automatically by an AI agent. *(Corrected in 0.3.0-beta.4: this is a protocol rule, not a mechanical guarantee.)*
63
93
  - No automatic Git push, deployment, third-party skill execution, or release publication was added.
64
94
 
65
95
  ### Verification
package/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  <p align="center">
18
18
  <a href="docs/USER_GUIDE.md">Подробное руководство на русском</a>
19
19
  ·
20
- <a href="#quick-start-from-source">Quick start</a>
20
+ <a href="#quick-start">Quick start</a>
21
21
  ·
22
22
  <a href="#safety-by-default">Safety</a>
23
23
  ·
@@ -25,7 +25,7 @@
25
25
  </p>
26
26
 
27
27
  > [!IMPORTANT]
28
- > **0.3.0-beta.3 is a public beta on npm.** Create a project with `npx create-vibe-maestro@latest` and check one with `npx --package create-vibe-maestro@latest vibe-maestro doctor --path .`. Interfaces may still change between beta versions; the source install below remains available. The current CLI and generated project templates are Russian-first; English localization is planned before a global release.
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.
29
29
 
30
30
  When an AI-assisted project lasts longer than one chat, the same problems keep returning:
31
31
 
@@ -45,61 +45,45 @@ It is **not another coding agent or IDE**. Keep using Claude Code, Codex, Cursor
45
45
 
46
46
  The recording shows the real create-and-`doctor` surface of the beta CLI; the Planning Gate flow below was added after it.
47
47
 
48
- ## Quick start from source
48
+ ## Quick start
49
49
 
50
- **Requirements:** Node.js 20.10 or newer, npm, and Git.
50
+ **Requirements:** Node.js 20.10 or newer, npm, and Git. Nothing to clone or build.
51
51
 
52
- > [!TIP]
53
- > ## 🚀 One command to start
54
- >
55
- > Copy this into your terminal and press Enter:
56
- >
57
- > ```bash
58
- > git clone https://github.com/omikhaylov76-commits/vibe-coding-maestro.git 2>/dev/null || true && cd vibe-coding-maestro && git checkout main && git pull && npm ci && npm run build && node dist/bin/create-vibe-maestro.js
59
- > ```
52
+ Run the guided setup:
60
53
 
61
54
  ```bash
62
- # 1. Get the beta source
63
- git clone https://github.com/omikhaylov76-commits/vibe-coding-maestro.git && cd vibe-coding-maestro
64
-
65
- # 2. Install and build
66
- npm ci && npm run build
67
-
68
- # 3. Create a new canonical project
69
- node dist/bin/create-vibe-maestro.js \
70
- --yes \
71
- --target "../My Project" \
72
- --name "My Project" \
73
- --start idea \
74
- --depth standard
55
+ npx create-vibe-maestro@latest
75
56
  ```
76
57
 
77
- Maestro creates the project, initializes Git on `main`, makes the initial commit, and runs `doctor`. Then verify it again at any time:
58
+ The Guided First Run explains where files will be created and asks for no more than three decisions. A simple project name creates the folder on your Desktop; an explicit path always wins. Set `NO_COLOR=1` if you need plain output.
59
+
60
+ Or pass every decision explicitly:
78
61
 
79
62
  ```bash
80
- node dist/bin/vibe-maestro.js doctor --path "../My Project"
63
+ npx create-vibe-maestro@latest --yes --target "My Project" --name "My Project" --start idea --depth standard
81
64
  ```
82
65
 
83
- Expected result:
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):
84
67
 
85
- ```text
86
- Vibe Coding Maestro doctor: всё сходится.
68
+ ```bash
69
+ cd "My Project"
70
+ npx --package create-vibe-maestro@latest vibe-maestro doctor --path .
87
71
  ```
88
72
 
89
- Prefer a guided setup? Run the CLI without flags:
73
+ Expected result:
90
74
 
91
- ```bash
92
- node dist/bin/create-vibe-maestro.js
75
+ ```text
76
+ Vibe Coding Maestro doctor: всё сходится.
93
77
  ```
94
78
 
95
- The Guided First Run explains where files will be created and asks for no more than three decisions. A simple project name creates the folder on your Desktop; an explicit path always wins. Set `NO_COLOR=1` if you need plain output.
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.
96
80
 
97
81
  > [!WARNING]
98
- > **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 0.2 project. 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.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.
99
83
 
100
84
  ## Что дальше после создания проекта: Planning Gate
101
85
 
102
- Проект создан — **откройте созданную папку** (`../My Project`) в Claude Code или Cowork. Дальше работа идёт по одному маршруту: сначала план, который утверждает человек, и только потом код.
86
+ Проект создан — **откройте созданную папку** (`My Project`) в Claude Code или Cowork. Дальше работа идёт по одному маршруту: сначала план, который утверждает человек, и только потом код.
103
87
 
104
88
  ```text
105
89
  обсудить идею → /plan → классификация → черновик плана
@@ -111,19 +95,19 @@ The Guided First Run explains where files will be created and asks for no more t
111
95
  3. **Проверьте классификацию.** Агент называет масштаб, режим, глубину гарантий, риск и профили с причинами. Вы можете принять её, изменить или сузить объём.
112
96
  4. **Покажите существующий код**, если он есть: команда `sources` читает его read-only и по умолчанию ничего не пишет.
113
97
  5. **Получите черновик** в `wiki/plans/<номер>-<слаг>.md`. Пока он `draft`, гейт показывает `CODE_ALLOWED: NO`.
114
- 6. **Утвердите план сами** — словами «план утверждаю». Агент не утверждает план за вас; утверждение проставляет `approved_by` и `approved_at`.
98
+ 6. **Утвердите план сами** — словами «план утверждаю». Утверждение записывается в поля `approved_by` и `approved_at`. Maestro не может механически отличить, кто их заполнил — человек или агент: следите, чтобы они появлялись только после ваших слов.
115
99
  7. **Проверьте право на код** механическим гейтом `preflight` (команды ниже).
116
100
  8. **`/build` ровно одной порции** → тесты → `doctor` → `/handoff`.
117
101
 
118
102
  ### Откуда запускать команды
119
103
 
120
104
  - `/plan`, `/build`, `/status`, `/wiki`, `/handoff` — внутри **папки проекта**, открытой в Claude Code.
121
- - `doctor`, `preflight`, `sources`, `upgrade` — из **папки исходников Maestro**, с явным `--path` до проекта:
105
+ - `doctor`, `preflight`, `sources`, `upgrade` — тоже из **папки проекта**, через `npx`, с `--path .`. Точная команда с версией вашего проекта записана в его `CLAUDE.md` и `AGENTS.md`; ниже — общая форма:
122
106
 
123
107
  ```bash
124
- # из vibe-coding-maestro
125
- node dist/bin/vibe-maestro.js preflight --path "../My Project"
126
- node dist/bin/vibe-maestro.js doctor --path "../My Project"
108
+ # из папки проекта
109
+ npx --package create-vibe-maestro@latest vibe-maestro preflight --path .
110
+ npx --package create-vibe-maestro@latest vibe-maestro doctor --path .
127
111
  ```
128
112
 
129
113
  ### Глубина планирования подстраивается под масштаб
@@ -147,7 +131,7 @@ node dist/bin/vibe-maestro.js doctor --path "../My Project"
147
131
  | Закрывает блокирующие вопросы | Исполняет одну разрешённую порцию и останавливается на её стоп-гейте |
148
132
  | Просматривает diff и решает, что мержить | Прогоняет тесты, `doctor` и готовит `/handoff` |
149
133
 
150
- Два законченных примера — простой лендинг и портал из двух существующих игр — разобраны в [руководстве](docs/USER_GUIDE.md#два-примера-от-идеи-до-первой-порции). Там же — разделы про [`sources`](docs/USER_GUIDE.md#инвентаризация-существующих-исходников), [`preflight`](docs/USER_GUIDE.md#preflight-механический-гейт-перед-кодом), [`upgrade`](docs/USER_GUIDE.md#обновление-проекта-с-02-на-03) и [что делать, если гейт закрыт](docs/USER_GUIDE.md#если-что-то-пошло-не-так).
134
+ Два законченных примера — простой лендинг и портал из двух существующих игр — разобраны в [руководстве](docs/USER_GUIDE.md#два-примера-от-идеи-до-первой-порции). Там же — разделы про [`sources`](docs/USER_GUIDE.md#инвентаризация-существующих-исходников), [`preflight`](docs/USER_GUIDE.md#preflight-механический-гейт-перед-кодом), [`upgrade`](docs/USER_GUIDE.md#обновление-проекта-на-новую-версию) и [что делать, если гейт закрыт](docs/USER_GUIDE.md#если-что-то-пошло-не-так).
151
135
 
152
136
  Всё состояние проекта живёт в Markdown внутри Git. Новая сессия агента начинает не с нуля, а с `wiki/hot.md`, активного плана и последнего handoff.
153
137
 
@@ -215,6 +199,7 @@ Maestro is deliberately conservative around existing data and Git state:
215
199
  - audit findings must be resolved with evidence; `waived` is not accepted by the 0.3 beta contract;
216
200
  - `sources` reads existing code read-only and writes nothing without an explicit `--write`;
217
201
  - `upgrade` is a dry run without `--apply`, refuses a modified managed file, and rolls back a failed apply;
202
+ - generated projects pin the exact Maestro version instead of `@latest`, so a new release cannot change a project's checks until someone runs `upgrade`;
218
203
  - there is intentionally no `doctor --fix` that could overwrite useful work.
219
204
 
220
205
  `doctor` checks known mechanical boundaries such as manifest identity, ownership inventory, managed checksums, protocol contracts, wiki links, source integrity, tracked environment files, audit structure, blocking findings, and protected-path symlinks.
@@ -269,45 +254,50 @@ Claude Code and Cowork are two different doors into the same `protocols/plan.md`
269
254
 
270
255
  “Generic” means the shared files are usable; it does not claim the same tested UX as the native Claude Code adapter.
271
256
 
257
+ ## Updating a project
258
+
259
+ Run the preview from the project folder; it writes nothing:
260
+
261
+ ```bash
262
+ npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
263
+ ```
264
+
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.
266
+
272
267
  ## Automation and CI
273
268
 
274
269
  For scripts, pass every decision explicitly:
275
270
 
276
271
  ```bash
277
- node dist/bin/create-vibe-maestro.js \
278
- --yes \
279
- --target "../My Project" \
280
- --name "My Project" \
281
- --start materials \
282
- --depth standard \
283
- --json
272
+ npx create-vibe-maestro@latest --yes --target "My Project" --name "My Project" --start materials --depth standard --json
284
273
  ```
285
274
 
286
- Useful service commands:
275
+ Useful service commands (run from the project folder; in a real project use the exact version from its `CLAUDE.md`):
287
276
 
288
277
  ```bash
289
- node dist/bin/vibe-maestro.js doctor --path "../My Project" --json
290
- node dist/bin/vibe-maestro.js doctor --path "../My Project" --strict
291
- node dist/bin/vibe-maestro.js skills --path "../My Project"
292
- node dist/bin/vibe-maestro.js preflight --path "../My Project" --json
293
- node dist/bin/vibe-maestro.js sources --path "../My Project" --source "../durak" --source "../dice-poker"
294
- node dist/bin/vibe-maestro.js upgrade --path "../My 0.2 Project"
278
+ npx --package create-vibe-maestro@latest vibe-maestro doctor --path . --json
279
+ npx --package create-vibe-maestro@latest vibe-maestro doctor --path . --strict
280
+ npx --package create-vibe-maestro@latest vibe-maestro skills --path .
281
+ npx --package create-vibe-maestro@latest vibe-maestro preflight --path . --json
282
+ npx --package create-vibe-maestro@latest vibe-maestro sources --path . --source "../durak" --source "../dice-poker"
283
+ npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
295
284
  ```
296
285
 
297
286
  `preflight` and `doctor` exit `0` when the check passes and `1` when it blocks; `sources` and `upgrade` write nothing at all unless you add `--write` or `--apply`.
298
287
 
299
- 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, and symlink boundaries. CI is configured for Ubuntu, macOS, and Windows with Node.js 20 and 22.
288
+ 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.
300
289
 
301
290
  ## Current beta scope
302
291
 
303
- Available now in the source beta:
292
+ Available now in the npm beta:
304
293
 
305
294
  - Guided First Run;
306
295
  - fresh canonical project creation;
307
296
  - Planning Gate: `/plan`, Cowork plan runbook, project plans, and the human approval gate;
308
297
  - mechanical `preflight` before the first line of code;
309
298
  - read-only `sources` inventory of existing code;
310
- - safe `upgrade` of a provably canonical 0.2 project;
299
+ - safe `upgrade` of a provably canonical project from an earlier published version;
300
+ - exact Maestro version pinned in every generated project;
311
301
  - `light`, `standard`, and `advanced` depth projections;
312
302
  - shared project memory and handoffs;
313
303
  - canonical protocols with thin adapters;
@@ -320,13 +310,13 @@ Available now in the source beta:
320
310
 
321
311
  Not available yet:
322
312
 
323
- - safe conversion of existing non-canonical projects (`upgrade` covers only a canonical 0.2 project);
313
+ - safe conversion of existing non-canonical projects (`upgrade` covers only canonical projects of known versions);
324
314
  - English-generated templates;
325
315
  - cloud sync, accounts, team dashboard, or billing;
326
316
  - automatic installation or execution of third-party skills;
327
317
  - a guarantee that an AI agent will not make mistakes.
328
318
 
329
- The 0.3 beta feature set is complete and locally release-verified. Broader dogfooding — including the real two-game integration on the user's Mac — continues as post-release validation and feedback for the next beta. Since 0.3.0-beta.2 the package is published on npm as a beta; the source installation above remains available.
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).
330
320
 
331
321
  ## Documentation
332
322
 
@@ -334,7 +324,8 @@ The 0.3 beta feature set is complete and locally release-verified. Broader dogfo
334
324
  - [Changelog](CHANGELOG.md)
335
325
  - [Threat model](docs/THREAT_MODEL.md)
336
326
  - [Canonical-only boundary and future Converter](docs/MIGRATION_V1.md)
337
- - [Contributing and local release gates](CONTRIBUTING.md)
327
+ - [Roadmap](docs/ROADMAP.md)
328
+ - [Contributing, building from source, and local release gates](CONTRIBUTING.md)
338
329
 
339
330
  Found a confusing step or a safety problem? Please [open an issue](https://github.com/omikhaylov76-commits/vibe-coding-maestro/issues/new) with the command you ran, expected result, actual result, OS, Node version, and a redacted tree or log. Never include credentials or private source material.
340
331
 
@@ -1,8 +1,25 @@
1
1
  import { basename } from 'node:path';
2
2
  import { doctorProject } from '../core/doctor.js';
3
+ import { describeFsError } from '../core/fs-errors.js';
3
4
  import { initProject } from '../core/init.js';
4
5
  import { EXIT_FAILED, EXIT_OK } from './io.js';
5
6
  export async function executeCreate(options, io, renderer) {
7
+ try {
8
+ return await createAndCheck(options, io, renderer);
9
+ }
10
+ catch (cause) {
11
+ // initProject сам переводит ошибки записи; сюда доходит только непредвиденное.
12
+ const message = describeFsError(cause, options.target);
13
+ if (options.json)
14
+ io.out(JSON.stringify({ ok: false, error: message }, null, 2));
15
+ else if (renderer)
16
+ renderer.failure(message);
17
+ else
18
+ io.err(message);
19
+ return EXIT_FAILED;
20
+ }
21
+ }
22
+ async function createAndCheck(options, io, renderer) {
6
23
  const result = await initProject({
7
24
  target: options.target,
8
25
  startingPoint: options.startingPoint,
@@ -18,7 +18,7 @@ const HELP = `${PRODUCT_NAME} — подготовка проекта одной
18
18
  --version, -v версия
19
19
 
20
20
  После создания проект проверяется командой:
21
- ${serviceInvocation()} doctor --path <путь>`;
21
+ ${serviceInvocation(VERSION)} doctor --path <путь>`;
22
22
  export function parseCreateArgs(argv) {
23
23
  const options = {
24
24
  target: '',
@@ -89,7 +89,7 @@ export function parseCreateArgs(argv) {
89
89
  if (options.target === '') {
90
90
  return {
91
91
  kind: 'error',
92
- message: `Не указана папка проекта. Передайте --target <путь> (интерактивное меню появится позже).`,
92
+ message: `Не указана папка проекта. Передайте --target <путь> или запустите команду без аргументов в терминале — откроется пошаговый мастер.`,
93
93
  };
94
94
  }
95
95
  return { kind: 'run', options };
@@ -133,7 +133,7 @@ export async function runCreateCli(argv, io = processIo, runtime = { isTty: Bool
133
133
  return code;
134
134
  }
135
135
  const { executeCreate } = await import('./create-run.js');
136
- return executeCreate({
136
+ return await executeCreate({
137
137
  target: answers.target,
138
138
  name: answers.name,
139
139
  startingPoint: answers.startingPoint,
@@ -45,8 +45,17 @@ export async function resolveDesktopDirectory(options) {
45
45
  }
46
46
  return posix.join(home, 'Desktop');
47
47
  }
48
+ /**
49
+ * Терминалы macOS и Linux при перетаскивании папки экранируют пробелы и скобки
50
+ * обратной косой (`My\ Project`). На этих ОС обратная косая в пути не встречается,
51
+ * поэтому снимаем экранирование так же, как это сделал бы shell. На Windows
52
+ * обратная косая — разделитель пути и остаётся как есть.
53
+ */
54
+ function unescapeDroppedPath(value, platform) {
55
+ return platform === 'win32' ? value : value.replace(/\\(.)/g, '$1');
56
+ }
48
57
  export async function resolveProjectInput(raw, options) {
49
- const value = stripOuterQuotes(raw);
58
+ const value = unescapeDroppedPath(stripOuterQuotes(raw), options.platform);
50
59
  if (!value)
51
60
  throw new Error('Введите название проекта или путь.');
52
61
  const paths = options.platform === 'win32' ? win32 : posix;
@@ -7,6 +7,10 @@ export async function executeDoctorCommand(options, io) {
7
7
  }
8
8
  else if (report.ok) {
9
9
  io.out('Vibe Coding Maestro doctor: всё сходится.');
10
+ for (const item of report.findings) {
11
+ if (item.level === 'warning' || item.level === 'info')
12
+ io.out(`- ${item.code}${item.path ? ` (${item.path})` : ''}: ${item.message}`);
13
+ }
10
14
  }
11
15
  else {
12
16
  io.err(`Vibe Coding Maestro doctor: найдено проблем — ${report.findings.length}.`);
@@ -1,4 +1,4 @@
1
- import { buildPreflight } from '../core/preflight.js';
1
+ import { buildPreflight, LOCATION_CODES } from '../core/preflight.js';
2
2
  import { EXIT_FAILED, EXIT_OK } from './io.js';
3
3
  const ROUTE_HINT = {
4
4
  build: 'Разрешено продолжать по protocols/build.md.',
@@ -19,7 +19,9 @@ export async function executePreflightCommand(options, io) {
19
19
  io.out(line);
20
20
  else
21
21
  io.err(line); };
22
- write(`Build preflight: ${decision.ok ? 'разрешено' : 'заблокировано'}. ${ROUTE_HINT[decision.route] ?? ''}`.trimEnd());
22
+ const located = !decision.findings.some((item) => LOCATION_CODES.includes(item.code));
23
+ const hint = located ? ROUTE_HINT[decision.route] ?? '' : '';
24
+ write(`Build preflight: ${decision.ok ? 'разрешено' : 'заблокировано'}. ${hint}`.trimEnd());
23
25
  if (decision.plan !== null)
24
26
  write(`План: ${decision.plan}`);
25
27
  if (decision.slice !== null)
@@ -39,15 +39,17 @@ export async function executeUpgradeCommand(options, io) {
39
39
  io.out(` ${path}`);
40
40
  };
41
41
  if (result.applied) {
42
- io.out(`Обновление применено: ${analysis.baselineId} → ${analysis.toVersion}.`);
42
+ io.out(`Обновление применено: ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion}.`);
43
43
  list('Добавлено', result.createdFiles);
44
44
  list('Обновлено', result.updatedFiles);
45
45
  list('Сохранено без изменений', analysis.preserves);
46
+ // До коммита doctor честно покажет git-managed-dirty: сначала diff и коммит, потом проверка.
47
+ io.out('Просмотрите git diff и закоммитьте изменённые файлы: до коммита doctor покажет git-managed-dirty.');
46
48
  // Та же версия, что применила обновление: doctor проверяет ровно её канон.
47
- io.out(`Проверьте полный diff и запустите: ${serviceInvocation(VERSION)} doctor --path ${quotePathArg(options.path)} --strict`);
49
+ io.out(`Затем проверьте: ${serviceInvocation(VERSION)} doctor --path ${quotePathArg(options.path)} --strict`);
48
50
  return EXIT_OK;
49
51
  }
50
- io.out(`Предложение обновления ${analysis.baselineId} → ${analysis.toVersion} (ни один байт не записан).`);
52
+ io.out(`Предложение обновления ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion} (ни один байт не записан).`);
51
53
  list('Будет добавлено', analysis.creates.map((item) => item.path));
52
54
  list('Будет обновлено', analysis.updates.map((item) => item.path));
53
55
  list('Уже совпадает', analysis.unchanged);
@@ -36,7 +36,7 @@ export async function checkGit(root, managedDocs, findings) {
36
36
  continue;
37
37
  const path = entry.path;
38
38
  if (managedDocs.has(path))
39
- findings.push(error('git-managed-dirty', 'Управляемый документ имеет незакоммиченные изменения.', path));
39
+ findings.push(error('git-managed-dirty', 'Управляемый документ имеет незакоммиченные изменения. Если это результат upgrade — просмотрите diff и закоммитьте; если правка ручная — верните файл.', path));
40
40
  }
41
41
  }
42
42
  catch (cause) {
@@ -1,6 +1,10 @@
1
- import { basename, resolve } from 'node:path';
1
+ import { existsSync, statSync } from 'node:fs';
2
+ import { join, resolve } from 'node:path';
2
3
  import { CHECKSUMS_PATH, isCanonicalManifest, loadChecksums, loadManifest, MANIFEST_PATH } from '../manifest.js';
3
- import { canonicalizeSystemTempPrefix } from '../platform-paths.js';
4
+ import { CREATE_COMMAND, FIRST_NPM_VERSION, quotePathArg, serviceInvocation, VERSION } from '../meta.js';
5
+ import { readPackageJson } from '../paths.js';
6
+ import { canonicalizeSystemTempPrefix, onDiskBasename } from '../platform-paths.js';
7
+ import { compareVersions } from '../version.js';
4
8
  import { absolutePathHasSymlink, pathHasSymlink } from './fs-utils.js';
5
9
  import { checkGit } from './git.js';
6
10
  import { checkInbox } from './inbox.js';
@@ -9,14 +13,47 @@ import { checkPlans } from './plans.js';
9
13
  import { checkProtocols } from './protocols.js';
10
14
  import { checkSources } from './sources.js';
11
15
  import { checkWiki } from './wiki.js';
12
- import { critical, error, findingsPass, sortFindings } from './types.js';
16
+ import { critical, error, findingsPass, info, sortFindings } from './types.js';
13
17
  const report = (root, findings, strict = false) => {
14
18
  const sorted = sortFindings(findings);
15
19
  return { reportVersion: 1, ok: findingsPass(sorted, strict), root, findings: sorted };
16
20
  };
21
+ /**
22
+ * Проект и запущенный Maestro разных версий. Вердикт только объясняет, какой
23
+ * командой проверить или обновить проект: права на запись версия не даёт.
24
+ */
25
+ function versionFinding(rootInput, manifest, canonical) {
26
+ const projectVersion = manifest.product.version;
27
+ const order = compareVersions(projectVersion, VERSION);
28
+ if (order === null || order === 0)
29
+ return null;
30
+ // Путь в подсказке — как его набрал человек: команду можно скопировать из того же места.
31
+ const path = quotePathArg(rootInput);
32
+ const published = (compareVersions(projectVersion, FIRST_NPM_VERSION) ?? -1) >= 0;
33
+ const checkSame = published
34
+ ? `${serviceInvocation(projectVersion)} doctor --path ${path}`
35
+ : `версия ${projectVersion} не публиковалась в npm, поэтому проверить проект его же версией нельзя`;
36
+ const upgrade = `${serviceInvocation(VERSION)} upgrade --path ${path}`;
37
+ if (canonical) {
38
+ return order < 0
39
+ ? info('project-version-older', `Проект создан Vibe Coding Maestro ${projectVersion}; состав файлов совпадает с ${VERSION}. Перевести проект на ${VERSION}: ${upgrade} (без --apply только показывает изменения).`, MANIFEST_PATH)
40
+ : info('project-version-newer', `Проект обновлён более новой версией ${projectVersion}, а проверяет ${VERSION}. Точная проверка: ${checkSame}`, MANIFEST_PATH);
41
+ }
42
+ return order < 0
43
+ ? error('project-outdated', `Проект создан Vibe Coding Maestro ${projectVersion}, а запущена ${VERSION}: у этих версий разный состав файлов. Проверить проект его версией: ${checkSame}. Обновить проект до ${VERSION}: ${upgrade} (без --apply только показывает изменения).`, MANIFEST_PATH)
44
+ : error('project-newer', `Проект создан более новой версией ${projectVersion}, а запущена ${VERSION}. Проверьте проект его версией: ${checkSame}`, MANIFEST_PATH);
45
+ }
17
46
  export async function doctorProject(rootInput, options = {}) {
18
47
  const root = await canonicalizeSystemTempPrefix(resolve(rootInput));
19
48
  const findings = [];
49
+ if (!existsSync(root)) {
50
+ findings.push(error('project-path-missing', `Папка не найдена: ${root}. Проверьте путь; путь с пробелами возьмите в кавычки.`));
51
+ return report(root, findings, options.strict);
52
+ }
53
+ if (!statSync(root).isDirectory()) {
54
+ findings.push(error('project-path-not-directory', `Это файл, а не папка проекта: ${root}.`));
55
+ return report(root, findings, options.strict);
56
+ }
20
57
  if (await absolutePathHasSymlink(root)) {
21
58
  findings.push(critical('project-root-symlink', 'Путь к корню проекта не должен содержать symbolic link.', root));
22
59
  return report(root, findings, options.strict);
@@ -28,16 +65,41 @@ export async function doctorProject(rootInput, options = {}) {
28
65
  }
29
66
  if (findings.length > 0)
30
67
  return report(root, findings, options.strict);
68
+ if (!existsSync(join(root, MANIFEST_PATH))) {
69
+ findings.push(error('manifest-missing', `В папке нет ${MANIFEST_PATH}: это не проект Vibe Coding Maestro или указана не та папка. Новый проект создаётся командой npx ${CREATE_COMMAND}@latest.`, MANIFEST_PATH));
70
+ return report(root, findings, options.strict);
71
+ }
31
72
  let manifest;
32
73
  try {
33
74
  manifest = await loadManifest(root);
34
75
  }
35
76
  catch (cause) {
36
- findings.push(error('manifest-invalid', `Манифест отсутствует или повреждён: ${cause instanceof Error ? cause.message : String(cause)}`, MANIFEST_PATH));
77
+ findings.push(error('manifest-invalid', `Манифест повреждён: ${cause instanceof Error ? cause.message : String(cause)}`, MANIFEST_PATH));
37
78
  return report(root, findings, options.strict);
38
79
  }
39
- if (!isCanonicalManifest(manifest) || manifest.project.name !== basename(root)) {
40
- findings.push(error('manifest-canonical-mismatch', 'Manifest не принадлежит этому canonical project.', MANIFEST_PATH));
80
+ const ours = manifest.product.name === readPackageJson().name && manifest.product.createdBy === CREATE_COMMAND;
81
+ const canonical = isCanonicalManifest(manifest);
82
+ const version = ours ? versionFinding(rootInput, manifest, canonical) : null;
83
+ if (version !== null && version.level === 'error') {
84
+ // Канон другой версии этой версией не сверить: inventory, протоколы и wiki дали бы шум.
85
+ // Проверки, которые опираются только на данные самого проекта, остаются в силе.
86
+ findings.push(version);
87
+ const checksums = await loadChecksums(root);
88
+ if (checksums === null)
89
+ findings.push(error('checksums-invalid', 'Контрольные суммы отсутствуют или повреждены.', CHECKSUMS_PATH));
90
+ const { managedDocs } = await checkManagedFiles(root, manifest, checksums, findings);
91
+ await checkGit(root, managedDocs, findings);
92
+ await checkInbox(root, findings);
93
+ await checkSources(root, findings);
94
+ return report(root, findings, options.strict);
95
+ }
96
+ if (version !== null)
97
+ findings.push(version);
98
+ if (!canonical) {
99
+ findings.push(error('manifest-canonical-mismatch', `Manifest не совпадает с каноном Vibe Coding Maestro ${VERSION}.`, MANIFEST_PATH));
100
+ }
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));
41
103
  }
42
104
  const checksums = await loadChecksums(root);
43
105
  if (checksums === null)
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Ошибки файловой системы человеческими словами.
3
+ *
4
+ * Пользователь Maestro не обязан знать, что такое EACCES: ему нужна причина и
5
+ * следующее действие. Код ошибки остаётся в скобках — по нему легко искать помощь.
6
+ */
7
+ export function describeFsError(cause, fallbackPath) {
8
+ const errno = cause;
9
+ const code = typeof errno?.code === 'string' ? errno.code : undefined;
10
+ const path = typeof errno?.path === 'string' ? errno.path : fallbackPath;
11
+ switch (code) {
12
+ case 'EACCES':
13
+ case 'EPERM':
14
+ return `Нет прав на запись: ${path}. Выберите папку внутри своей домашней папки или проверьте права доступа (${code}).`;
15
+ case 'ENOSPC':
16
+ case 'EDQUOT':
17
+ return `На диске закончилось место при записи ${path}. Освободите место и повторите (${code}).`;
18
+ case 'EROFS':
19
+ return `Диск доступен только для чтения: ${path}. Выберите другую папку (${code}).`;
20
+ case 'ENOENT':
21
+ return `Путь не найден: ${path}. Проверьте, что папка существует и путь набран верно (${code}).`;
22
+ case 'ENOTDIR':
23
+ return `Часть пути — файл, а не папка: ${path} (${code}).`;
24
+ case 'ENAMETOOLONG':
25
+ return `Слишком длинный путь: ${path}. Выберите папку ближе к корню диска (${code}).`;
26
+ case 'EMFILE':
27
+ case 'ENFILE':
28
+ return `Система не даёт открыть столько файлов сразу. Закройте лишние программы и повторите (${code}).`;
29
+ default:
30
+ return `Не удалось подготовить проект: ${cause instanceof Error ? cause.message : String(cause)}`;
31
+ }
32
+ }