create-vibe-maestro 0.4.0 → 0.4.2

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 (57) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +34 -30
  3. package/dist/cli/context-run.js +38 -0
  4. package/dist/cli/create-run.js +74 -9
  5. package/dist/cli/create.js +21 -2
  6. package/dist/cli/doctor-run.js +2 -1
  7. package/dist/cli/maestro.js +67 -1
  8. package/dist/cli/pack-run.js +44 -0
  9. package/dist/cli/prompt.js +12 -4
  10. package/dist/cli/renderer.js +5 -4
  11. package/dist/cli/upgrade-run.js +4 -0
  12. package/dist/core/context.js +169 -0
  13. package/dist/core/doctor/git.js +41 -1
  14. package/dist/core/doctor/inbox.js +5 -11
  15. package/dist/core/doctor/sources.js +1 -1
  16. package/dist/core/github.js +107 -0
  17. package/dist/core/init.js +37 -10
  18. package/dist/core/inventory.js +4 -0
  19. package/dist/core/pack.js +379 -0
  20. package/dist/core/readme.js +21 -0
  21. package/dist/core/settings.js +39 -0
  22. package/dist/core/upgrade/analyze.js +61 -8
  23. package/dist/core/upgrade/baseline.js +4 -0
  24. package/dist/core/upgrade/releases.js +73 -3
  25. package/dist/core/zip.js +133 -0
  26. package/docs/ROADMAP.md +74 -47
  27. package/docs/USER_GUIDE.md +113 -60
  28. package/package.json +1 -1
  29. package/registry/baseline/0.4.0/project/.claude/rules/maestro.md +35 -0
  30. package/registry/baseline/0.4.0/project/protocols/completion.md +22 -0
  31. package/registry/baseline/0.4.0/project/protocols/handoff.md +15 -0
  32. package/registry/baseline/0.4.1/project/.claude/commands/plan.md +2 -0
  33. package/registry/baseline/0.4.1/project/.claude/rules/maestro.md +35 -0
  34. package/registry/baseline/0.4.1/project/maestro/inbox/README.md +16 -0
  35. package/registry/baseline/0.4.1/project/maestro/runbooks/cowork-discovery.md +30 -0
  36. package/registry/baseline/0.4.1/project/protocols/discovery.md +5 -0
  37. package/registry/baseline/0.4.1/project/protocols/plan.md +142 -0
  38. package/registry/capabilities.v1.json +13 -1
  39. package/templates/project/.claude/commands/plan.md +1 -0
  40. package/templates/project/.claude/commands/start.md +2 -0
  41. package/templates/project/.claude/rules/maestro.md +6 -4
  42. package/templates/project/.claude/rules/project.md +6 -0
  43. package/templates/project/.claude/settings.json +2 -0
  44. package/templates/project/README.md +11 -0
  45. package/templates/project/maestro/inbox/README.md +6 -6
  46. package/templates/project/maestro/runbooks/cowork-discovery.md +1 -1
  47. package/templates/project/protocols/completion.md +1 -1
  48. package/templates/project/protocols/discovery.md +1 -3
  49. package/templates/project/protocols/handoff.md +1 -1
  50. package/templates/project/protocols/plan.md +14 -7
  51. package/templates/project/protocols/start.md +64 -0
  52. package/templates/project/wiki/concepts/discovery.md +30 -11
  53. package/templates/project/wiki/hot.md +2 -2
  54. package/templates/project/wiki/index.md +1 -0
  55. package/templates/project/wiki/passport.md +2 -0
  56. package/templates/project/wiki/plans/0001-starter.md +4 -3
  57. package/templates/project/wiki/restore.md +32 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,58 @@ 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.4.2 — 2026-11-01
8
+
9
+ The third part of 0.4: starting a project. One first step everywhere — create → `/start` → `/plan`; materials in one place, kept byte for byte; a private copy in the cloud from day one. The set of project files changes; `vibe-maestro upgrade` migrates projects from 0.4.1, 0.4.0, 0.3.1, 0.3.0, 0.3.0-beta.1 – beta.4 and 0.2.0-beta.1.
10
+
11
+ ### Added
12
+
13
+ - **`/start` with its own protocol `protocols/start.md`** (managed, command `.claude/commands/start.md`). The first session reads what already exists — the starting point from `create --start`, materials in `maestro/inbox/` (large files through the `explorer` subagent), what the human said, code in another folder only read-only through `sources`, asking for the path. Then it asks one question at a time, in plain words: seven about the task (what we make; for whom; who gets the result — kept or handed to a customer, team, employer; what «done» means; what else exists; what we do not do; constraints — laws, platform rules, other people's personal data) and six about how we work (who decides and on whose behalf the agent may write; what only after a separate «да»; code right after plan approval or on «начинай»; how to talk; how to hand over keys; where the copy lives and how to restore), each with the agent's proposal as the default. Deadlines and budget are not asked; if named, they are written down. Found answers are shown with their source and a «верно?»; «не знаю» is recorded as UNKNOWN. A draft is kept in the project, so the human can stop and continue; `/start` can be run again to revise one agreement. A one-screen summary with the rhythm of slices, then writing only after «да»: the task to `wiki/concepts/discovery.md`, how we work to the «Как работаем» section of `.claude/rules/project.md` (other sections untouched), the copy and restore to `wiki/restore.md`, the cloud address to the passport. Protections in `settings.json` change only on a separate «да». `protocols/discovery.md` now points to the start; the capabilities `discovery-before-code` and new `project-start` live in `start.md`.
14
+ - **Start flag** `start:` in the `wiki/concepts/discovery.md` header: `not_started` → `in_progress` → `done`; `skipped` when the human declines. `protocols/plan.md` Stage A reads the start answers and does not ask again; if the start is not done it offers it once, and after a refusal asks only what the plan needs.
15
+ - **`wiki/restore.md`** (belongs to the project): what is in the cloud (address in the passport), what is not (`.env`, key values, personal settings), what to install, how to get the project, how to check it.
16
+ - **`README.md`** for a new project, only when the folder has no README of any name; it says the file is read first, also by the recipient, and asks to rewrite it. It is not in the inventory `doctor` checks and may be deleted.
17
+ - **A copy in the cloud from day one.** The wizard offers «Создать новый проект и закрытую копию на GitHub» as the last option of its first question, only when the GitHub CLI `gh` is installed and logged in (checked while the welcome is shown, 3 s timeout); still three decisions. For scripts: `create --github`. After the first commit: `gh repo create <name> --private --source <folder> --remote origin --push`; the name is Latin from the folder name (Cyrillic transliterated, empty → `project-YYYYMMDD`). Any `gh` failure is a warning with the command for later; the project stays and the exit code is 0. `--github` with `--no-git` is an error before writing.
18
+ - **`create --push-without-asking`** for new projects: `settings.json` gets the guide recipe — plain `git push` allowed; force pushes (`--force`, `-f`, `+branch`) and deleting in the cloud (`--delete`, `-d`, `--mirror`, `--prune`) still ask; one `ask` key. `.claude/rules/maestro.md` names this exception to «push only after a separate „да“».
19
+ - `doctor` `info` findings from local Git data only, no network: `git-no-remote`, `git-no-upstream`, `git-unpushed`. They do not fail `--strict` or `preflight`.
20
+ - `maestro/inbox/.gitattributes` (managed, `* -text`, written by code like the root `.gitattributes`): Git keeps materials byte for byte, a fresh clone returns the original bytes on any `core.autocrlf`.
21
+ - Rules for everyone in `.claude/rules/maestro.md`: check a person's proposal against what already exists and say so if it is not needed or done; plain words, a technical term only with its meaning. «Выбор навыков» in `protocols/plan.md`: installed, GitHub and official Anthropic catalogs; compare several, check `SKILL.md`, `allowed-tools`, hooks; pick the best; install only after «да». Maestro installs nothing itself.
22
+
23
+ ### Changed
24
+
25
+ - One first step in five places — the create screen, `wiki/hot.md`, `wiki/plans/0001-starter.md`, `.claude/rules/maestro.md`, the README — and in the user guide: create → `/start` → `/plan`. Section names of `wiki/hot.md` are unchanged.
26
+ - **Materials without a red check.** `inbox-not-empty` is removed: files in `maestro/inbox/` are not a finding, even with `--strict`. `source-hashes-missing` (still critical) now says that `maestro/sources/` holds only `sources --write` snapshots and points to `maestro/inbox/`. The create screen, `maestro/inbox/README.md` and `protocols/plan.md` say the same.
27
+ - `maestro/runbooks/cowork-discovery.md` no longer says Claude Code does not rewrite discovery: Cowork prepares material for `maestro/inbox/`, `/start` writes the answers.
28
+ - The passport template says it goes to the recipient in `HANDOVER.md` and should be written for them.
29
+ - The `vibe-maestro` companion package (0.1.6) depends on exactly `create-vibe-maestro@0.4.2`.
30
+ - Upgrade tests use projects generated by the real published 0.4.1 package.
31
+
32
+ ### For those who create projects with their own scripts
33
+
34
+ - **Place for materials** — `maestro/inbox/`. Files there no longer give `inbox-not-empty` (it is gone). `maestro/sources/` is only for `vibe-maestro sources --write` snapshots; your own files there are still critical (`source-hashes-missing`).
35
+ - **The `-text` rule.** `create` and `upgrade` write `maestro/inbox/.gitattributes` with `* -text`: Git does not change line endings, a fresh clone returns the original bytes. Your own folder for other people's files — put the same `.gitattributes` there. Materials that were committed before the rule are not re-read by Git on their own: run `git add --renormalize maestro/inbox` and commit (checked on Git 2.54: a file Git has already seen is not shown as modified after the rule appears). If a file was already normalized (for example, taken from a fresh clone on another computer), the original bytes exist only in its source.
36
+ - **The start flag** — `start: done` in the `wiki/concepts/discovery.md` header. Set it right after `create`, and `/plan` will not offer the start. Values: `not_started`, `in_progress`, `done`, `skipped`. No field = not done.
37
+ - **Section names of `wiki/hot.md` do not change:** «Сейчас в работе», «Открытые вопросы», «Следующий шаг». Only the text inside changes for new projects.
38
+ - **`create --yes` creates no repository.** A private GitHub repository only with `--github`; push without asking only with `--push-without-asking`. Neither flag acts on a repeated `create` of an existing project.
39
+ - **New project files:** `protocols/start.md`, `.claude/commands/start.md`, `maestro/inbox/.gitattributes` (Maestro); `wiki/restore.md` (project). `README.md` only when the root has no README; `doctor` does not require it.
40
+ - **`doctor`:** new findings `git-no-remote`, `git-no-upstream`, `git-unpushed` are `info` and block neither `--strict` nor `preflight`.
41
+ - **Your own `.claude/commands/start.md`** stops `upgrade` with a clear message: rename it (for example, to `my-start.md`) and run again.
42
+ - **Projects before 0.4.2:** `.claude/settings.json` belongs to the project and `upgrade` does not change it — add `Edit(/.claude/commands/start.md)` and `Edit(/maestro/inbox/.gitattributes)` to `deny` if you want the same protection.
43
+
44
+ ## 0.4.1 — 2026-10-31
45
+
46
+ The second part of 0.4: packing a project for the customer and measuring the session. The set of project files is unchanged; `upgrade` from 0.4.0 rewrites the pinned version, `.claude/rules/maestro.md`, `protocols/handoff.md` and `protocols/completion.md`.
47
+
48
+ ### Added
49
+
50
+ - **`vibe-maestro pack --tag <tag>`** — a deterministic zip of the delivery tag, with no dependencies. Everything comes from the tag (`git archive`), not from the working folder, so the same tag always gives the same bytes; the command prints the sha256. Maestro and agent files at the root (`wiki/`, `maestro/`, `.claude/`, `protocols/`, `.maestro/`, `CLAUDE.md`, `AGENTS.md`, `.mcp.json`) are left out; `HANDOVER.md` is added with «смените все пароли и ключи» and the project passport from the tag. It refuses on likely secrets — `.env`/`.envrc`/`secrets.*`/key and keystore files/SQLite databases by name; private keys, OpenAI, Anthropic, GitHub, AWS, Telegram bot, Supabase service_role, Stripe, npm and Slack tokens, passwords in database URLs and in code by content (values are never printed; public Google browser keys, Supabase anon keys, `…EXAMPLE` keys, placeholders and local database URLs pass) — on agent files nested in the product, on symlinks leading outside the project, on an incomplete passport (a section with the «пока нет» placeholder or no entry), and when a different file is already at the output path. `--allow <path>` skips the check for a file the human has looked at. Submodules are reported as not included. Git settings that would change bytes (`core.autocrlf`, `log.showSignature`) are pinned. Files are stored uncompressed with a Unix timestamp field; modes are normalized to 644/755. Default output is the Desktop; `--out` takes a file or a folder.
51
+ - **`vibe-maestro context`** — the size of the current Claude Code session from its transcript (`~/.claude/projects/…`, `$CLAUDE_CONFIG_DIR` respected; only usage numbers are read). It picks the session from `$CLAUDE_CODE_SESSION_ID` when Claude Code provides it, otherwise the newest transcript of the folder. When `$CLAUDE_CODE_SESSION_ID` names a transcript that is missing, it refuses instead of measuring another session. It prints the context size as a share of the model window — 200 000 tokens, or 1 000 000 once the session is larger (`--window` to set) — the total input the session has sent, and plain advice: under 40% continue, from 40% start the next slice in a new session, from 70% hand off now. Entries without usage (`<synthetic>`) are skipped. The thresholds are a hypothesis to be checked by measurement.
52
+ - `.claude/rules/maestro.md` and `protocols/handoff.md`: after the handoff of a closed slice the agent runs `context` and tells the human in plain words whether to start a new session. `protocols/completion.md` names the `pack` command.
53
+
54
+ ### Changed
55
+
56
+ - The `vibe-maestro` companion package (0.1.5) depends on exactly `create-vibe-maestro@0.4.1`.
57
+ - Upgrade tests use projects generated by the real published 0.4.0 package.
58
+
7
59
  ## 0.4.0 — 2026-10-31
8
60
 
9
61
  The first part of 0.4: finishing a project and keeping sessions short. The set of project files changes; `vibe-maestro upgrade` migrates projects from 0.3.1, 0.3.0, 0.3.0-beta.1 – beta.4 and 0.2.0-beta.1.
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  </p>
26
26
 
27
27
  > [!IMPORTANT]
28
- > **0.4.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.
28
+ > **0.4.2 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
 
@@ -47,15 +47,13 @@ The recording shows the create-and-`doctor` surface of an earlier beta; the Plan
47
47
 
48
48
  ## Quick start
49
49
 
50
- **Requirements:** Node.js 20.10 or newer, npm, and Git. Nothing to clone or build.
51
-
52
- Run the guided setup:
50
+ **Requirements:** Node.js 20.10 or newer, npm, and Git. Nothing to clone or build. Run the guided setup:
53
51
 
54
52
  ```bash
55
53
  npx create-vibe-maestro@latest
56
54
  ```
57
55
 
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.
56
+ 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. When the GitHub CLI (`gh`) is installed and you are logged in, the first question also offers «Создать новый проект и закрытую копию на GitHub». Set `NO_COLOR=1` if you need plain output.
59
57
 
60
58
  Or pass every decision explicitly:
61
59
 
@@ -63,7 +61,7 @@ Or pass every decision explicitly:
63
61
  npx create-vibe-maestro@latest --yes --target "My Project" --name "My Project" --start idea --depth standard
64
62
  ```
65
63
 
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):
64
+ Maestro creates the project, initializes Git on `main`, makes the initial commit, and runs `doctor`. Two optional flags for scripts: `--github` creates a private GitHub repository after the first commit (`gh repo create … --private --source … --remote origin --push`; any `gh` failure is only a warning with the command for later), and `--push-without-asking` lets the agent run a plain `git push` without a question while force pushes still ask. Without them `create --yes` creates no repository and keeps the default protections. 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
65
 
68
66
  ```bash
69
67
  cd "My Project"
@@ -74,34 +72,36 @@ Expected result:
74
72
 
75
73
  ```text
76
74
  Vibe Coding Maestro doctor: всё сходится.
75
+ - git-no-remote: Копии проекта в облаке нет: у репозитория нет remote. …
77
76
  ```
78
77
 
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.
78
+ The second line is `info` (from local Git data only; it never fails `doctor`, `--strict` or `preflight`) and disappears once the project has a copy in the cloud. `@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
79
 
81
80
  > [!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.4, 0.3.0). 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.
81
+ > **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, 0.3.0, 0.3.1, 0.4.0, 0.4.1). 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
82
 
84
83
  ## Что дальше после создания проекта: Planning Gate
85
84
 
86
- Проект создан — **откройте созданную папку** (`My Project`) в Claude Code или Cowork. Дальше работа идёт по одному маршруту: сначала план, который утверждает человек, и только потом код.
85
+ Проект создан — **откройте созданную папку** (`My Project`) в Claude Code. Первый шаг один: `/start`, потом `/plan`. Дальше работа идёт по одному маршруту: сначала план, который утверждает человек, и только потом код.
87
86
 
88
87
  ```text
89
- обсудить идею → /plan → классификация → черновик плана
88
+ создание → /start → /plan → классификация → черновик плана
90
89
  → человек утверждает → preflight → /build одной порции → тесты и doctor → /handoff
91
90
  ```
92
91
 
93
- 1. **Обсудите идею** обычными словами прямо в чате агента. Материалы — заметки, требования, скриншоты — положите в `maestro/inbox/`.
94
- 2. **Попросите план.** В Claude Code это команда `/plan`, в Cowork — фраза «план» по runbook `maestro/runbooks/cowork-plan.md`. Это две разные двери в один и тот же канонический `protocols/plan.md`.
95
- 3. **Проверьте классификацию.** Агент называет масштаб, режим, глубину гарантий, риск и профили с причинами. Вы можете принять её, изменить или сузить объём.
96
- 4. **Покажите существующий код**, если он есть: команда `sources` читает его read-only и по умолчанию ничего не пишет.
97
- 5. **Получите черновик** в `wiki/plans/<номер>-<слаг>.md`. Пока он `draft`, гейт показывает `CODE_ALLOWED: NO`.
98
- 6. **Утвердите план сами** — словами «план утверждаю». После этих слов агент сам записывает поля плана, объявляет его в `wiki/hot.md` и ставит отпечаток утверждения: если текст плана потом изменится, `doctor` и `preflight` это заметят. Maestro не может механически отличить, кто заполнил поля — человек или агент: следите, чтобы они появлялись только после ваших слов.
99
- 7. **Проверьте право на код** механическим гейтом `preflight` (команды ниже).
100
- 8. **`/build` ровно одной порции — лучше в новой сессии** → тесты → `doctor` → `/handoff`. Агент правит только файлы из раздела плана «Где правим».
92
+ 1. **Материалы**, если есть, — заметки, требования, скриншоты — положите в `maestro/inbox/`. Готовый код оставьте, где лежит: `/start` спросит путь и прочитает его только на чтение.
93
+ 2. **Напишите `/start`** — знакомство с задачей. Агент сначала читает, что уже есть, потом спрашивает по одному вопросу: о задаче (что делаем, для кого, кому отдаём результат, что значит «готово», что ещё есть, чего не делаем, ограничения) и о том, как работаем (кто решает, что только после вашего «да», когда начинать код, как говорить, как отдавать ключи, где копия проекта). «Не знаю» — нормальный ответ. Можно прерваться и продолжить. После вашего «да» на сводку ответы записываются в проект. Агент без команд (Codex и другие) проходит старт по `protocols/start.md`.
94
+ 3. **Попросите план.** В Claude Code это команда `/plan`, в Cowork — фраза «план» по runbook `maestro/runbooks/cowork-plan.md`. Это две разные двери в один и тот же канонический `protocols/plan.md`. План не переспрашивает ответы старта.
95
+ 4. **Проверьте классификацию.** Агент называет масштаб, режим, глубину гарантий, риск и профили с причинами. Вы можете принять её, изменить или сузить объём.
96
+ 5. **Покажите существующий код**, если он есть: команда `sources` читает его read-only и по умолчанию ничего не пишет.
97
+ 6. **Получите черновик** в `wiki/plans/<номер>-<слаг>.md`. Пока он `draft`, гейт показывает `CODE_ALLOWED: NO`.
98
+ 7. **Утвердите план сами** — словами «план утверждаю». После этих слов агент сам записывает поля плана, объявляет его в `wiki/hot.md` и ставит отпечаток утверждения: если текст плана потом изменится, `doctor` и `preflight` это заметят. Maestro не может механически отличить, кто заполнил поля — человек или агент: следите, чтобы они появлялись только после ваших слов.
99
+ 8. **Проверьте право на код** механическим гейтом `preflight` (команды ниже).
100
+ 9. **`/build` ровно одной порции — лучше в новой сессии** → тесты → `doctor` → `/handoff`. Агент правит только файлы из раздела плана «Где правим».
101
101
 
102
102
  ### Откуда запускать команды
103
103
 
104
- - `/plan`, `/build`, `/status`, `/wiki`, `/handoff` — внутри **папки проекта**, открытой в Claude Code.
104
+ - `/start`, `/plan`, `/build`, `/status`, `/wiki`, `/handoff` — внутри **папки проекта**, открытой в Claude Code.
105
105
  - `doctor`, `preflight`, `sources`, `upgrade` — тоже из **папки проекта**, через `npx`, с `--path .`. Точная команда с версией вашего проекта записана в его `.claude/rules/maestro.md`; ниже — общая форма:
106
106
 
107
107
  ```bash
@@ -143,13 +143,14 @@ A Standard project starts with a structure like this:
143
143
  My Project/
144
144
  ├── AGENTS.md # yours: entry for Codex and other AGENTS.md tools
145
145
  ├── CLAUDE.md # yours: project instructions for Claude Code
146
+ ├── README.md # yours: only when the folder had no README; rewrite it for your reader
146
147
  ├── .claude/rules/ # maestro.md (Maestro rules, loaded every session) + project.md (yours)
147
148
  ├── .claude/settings.json # yours: default deny/ask rules (Maestro files, push, publish)
148
- ├── .claude/commands/ # /status, /plan, /build, /wiki, /handoff adapters
149
+ ├── .claude/commands/ # /start, /status, /plan, /build, /wiki, /handoff adapters
149
150
  ├── .claude/agents/ # read-only code-reviewer and explorer
150
151
  ├── protocols/ # canonical rules for planning, building, handoff and project completion
151
- ├── wiki/ # shared memory: plans, decisions, progress, audits and the project passport
152
- ├── maestro/ # inbox, runbooks, and templates for handoff, ADR and progress
152
+ ├── wiki/ # shared memory: start answers, plans, decisions, progress, audits, passport, restore page
153
+ ├── maestro/ # inbox for your materials (kept byte for byte), runbooks, and templates
153
154
  └── .maestro/ # manifest, ownership inventory and integrity metadata
154
155
  ```
155
156
 
@@ -177,10 +178,11 @@ From there, `protocols/build.md` routes the agent through the relevant rules, pl
177
178
 
178
179
  ## A normal working cycle
179
180
 
180
- The guided path above is the whole cycle: material in `maestro/inbox/` → plan → human approval → one bounded build with tests and live evidence → `doctor` → handoff, then a new session for the next slice. When the last slice is done, `protocols/completion.md` walks through delivery or closing: criteria checked, tests green, a delivery tag, a complete project passport (`wiki/passport.md`: where everything lives, names of environment variables but never their values), customer documents, a final handoff. Independent audit findings are recorded with stable IDs; open `high` or `critical` findings block a green doctor result.
181
+ The guided path above is the whole cycle: material in `maestro/inbox/` → `/start` (getting to know the task) → plan → human approval → one bounded build with tests and live evidence → `doctor` → handoff, then a new session for the next slice (`vibe-maestro context` tells the agent how large the session has grown). When the last slice is done, `protocols/completion.md` walks through delivery or closing: criteria checked, tests green, a delivery tag, a complete project passport (`wiki/passport.md`: where everything lives, names of environment variables but never their values), customer documents, a final handoff; `vibe-maestro pack` builds the customer archive from the delivery tag. Independent audit findings are recorded with stable IDs; open `high` or `critical` findings block a green doctor result.
181
182
 
182
- Claude Code projects receive five thin commands:
183
+ Claude Code projects receive six thin commands:
183
184
 
185
+ - `/start` — the first session: read what already exists, then agree on the task and on how we work, one question at a time;
184
186
  - `/status` — read current context without changing files;
185
187
  - `/plan` — follow the canonical planning protocol up to the human approval gate;
186
188
  - `/build` — follow the canonical build protocol;
@@ -204,6 +206,7 @@ Maestro is deliberately conservative around existing data and Git state:
204
206
  - `.claude/settings.json` ships default rules for Claude Code: its file tools are denied Maestro files, and `git push`, `npm publish`, `rm -rf` and `git reset --hard` ask first; this is not a sandbox, and the file belongs to the project, so a team can change the rules — see [how to tune protections for a project](docs/USER_GUIDE.md#как-подстроить-защиты-под-проект) (Russian);
205
207
  - API keys live only in `.env`, which `.gitignore` excludes and `doctor` reports if Git tracks it; the agent writes a key you paste into `.env` itself, or opens `.env` in an editor for you to paste it (a key typed into the chat stays in the session history);
206
208
  - `sources` reads existing code read-only and writes nothing without an explicit `--write`;
209
+ - `pack` builds the customer archive only from a delivery tag, leaves Maestro and agent folders out, adds `HANDOVER.md` with «change all passwords and keys», refuses on common kinds of secrets (a sieve, not a guarantee) or an incomplete passport, and gives the same bytes for the same tag;
207
210
  - `upgrade` is a dry run without `--apply`, refuses a modified managed file, and rolls back a failed apply;
208
211
  - generated projects pin the exact Maestro version instead of `@latest`, so a new release cannot change a project's checks until someone runs `upgrade`;
209
212
  - there is intentionally no `doctor --fix` that could overwrite useful work.
@@ -251,7 +254,7 @@ The core format is vendor-neutral; integration depth is not identical across too
251
254
  | Interface | Level in 0.3 | What is available |
252
255
  |---|---|---|
253
256
  | Humans | Native | Plain Markdown, Git diffs, explicit ownership, runbooks |
254
- | Claude Code | Native adapter | `.claude/rules/` loaded every session, five project commands including `/plan`, read-only reviewer and explorer, default `settings.json` |
257
+ | Claude Code | Native adapter | `.claude/rules/` loaded every session, six project commands including `/start` and `/plan`, read-only reviewer and explorer, default `settings.json` |
255
258
  | Codex and other `AGENTS.md` tools | Generic adapter | Universal `AGENTS.md` entry into canonical protocols |
256
259
  | Cursor and other filesystem-aware tools | Generic | They can read the same Markdown; no dedicated adapter yet |
257
260
  | Cowork-style research/audit | Runbook | Copyable plan, discovery, and independent-audit workflows; human imports the result |
@@ -268,7 +271,7 @@ Run the preview from the project folder; it writes nothing:
268
271
  npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
269
272
  ```
270
273
 
271
- 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.
274
+ 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. Moving to 0.4.2 adds the `/start` command and protocol, `maestro/inbox/.gitattributes` and `wiki/restore.md`, and a `README.md` only if the project has no README of any name; if materials already sit in `maestro/inbox/`, run `git add --renormalize maestro/inbox` before committing so Git keeps them byte for byte. 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.
272
275
 
273
276
  ## Automation and CI
274
277
 
@@ -291,14 +294,15 @@ npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
291
294
 
292
295
  `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`.
293
296
 
294
- 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.
297
+ 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, 0.3.x, 0.4.0 and 0.4.1. Pull requests and `main` run on Ubuntu, macOS, and Windows with Node.js 20 and 22; a branch push runs one quick Ubuntu job.
295
298
 
296
299
  ## Current scope
297
300
 
298
301
  Available now:
299
302
 
300
- - Guided First Run;
301
- - fresh canonical project creation;
303
+ - Guided First Run, with an optional private GitHub copy when `gh` is logged in;
304
+ - fresh canonical project creation, then `/start`: the first session reads what exists and agrees on the task and on how we work, one question at a time;
305
+ - `maestro/inbox/` as the one place for materials, kept byte for byte by Git;
302
306
  - Planning Gate: `/plan`, Cowork plan runbook, project plans, and the human approval gate;
303
307
  - mechanical `preflight` before the first line of code;
304
308
  - read-only `sources` inventory of existing code;
@@ -326,7 +330,7 @@ Not available yet:
326
330
  - automatic installation or execution of third-party skills;
327
331
  - a guarantee that an AI agent will not make mistakes.
328
332
 
329
- 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).
333
+ What comes next — checks with a cutoff, one set of labels, and project memory that does not grow — is listed in the [roadmap](docs/ROADMAP.md).
330
334
 
331
335
  ## Documentation
332
336
 
@@ -0,0 +1,38 @@
1
+ import { FINISH_SLICE_SHARE, measureContext, NEW_SESSION_SHARE } from '../core/context.js';
2
+ import { EXIT_FAILED, EXIT_OK } from './io.js';
3
+ /** Тысячи через пробел, без зависимости от локали машины. */
4
+ export function formatTokens(value) {
5
+ return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
6
+ }
7
+ /** «1 токен», «2 токена», «5 токенов». */
8
+ export function tokensWord(value) {
9
+ const n = Math.abs(Math.round(value));
10
+ if (n % 10 === 1 && n % 100 !== 11)
11
+ return 'токен';
12
+ if ([2, 3, 4].includes(n % 10) && ![12, 13, 14].includes(n % 100))
13
+ return 'токена';
14
+ return 'токенов';
15
+ }
16
+ const ADVICE = {
17
+ continue: 'Можно продолжать в этой сессии.',
18
+ 'finish-slice': 'Порцию лучше закончить в этой сессии, а следующую начать в новой — после передачи дел (/handoff).',
19
+ 'new-session': 'Пора в новую сессию: сделайте передачу дел (/handoff) сейчас и продолжайте в новой.',
20
+ };
21
+ export async function executeContextCommand(options, io) {
22
+ const report = await measureContext({ root: options.path, ...(options.window === undefined ? {} : { budget: options.window }) });
23
+ if (options.json) {
24
+ io.out(JSON.stringify(report, null, 2));
25
+ return report.ok ? EXIT_OK : EXIT_FAILED;
26
+ }
27
+ if (!report.ok || report.level === undefined) {
28
+ io.err(`Vibe Coding Maestro context: ${report.message ?? 'размер сессии не измерен.'}`);
29
+ return EXIT_FAILED;
30
+ }
31
+ const tokens = report.contextTokens ?? 0;
32
+ io.out(`Размер сессии: ${formatTokens(tokens)} ${tokensWord(tokens)} (${report.percent}% окна модели в ${formatTokens(report.budget)}).`);
33
+ io.out(ADVICE[report.level]);
34
+ const total = report.totalInputTokens ?? 0;
35
+ io.out(`За сессию модель получила на вход ${formatTokens(total)} ${tokensWord(total)} (шагов модели: ${report.requests}): каждый шаг заново пересылает всю историю.`);
36
+ io.out(`Пороги ${Math.round(FINISH_SLICE_SHARE * 100)}% и ${Math.round(NEW_SESSION_SHARE * 100)}% — гипотеза; их уточнит замер.`);
37
+ return EXIT_OK;
38
+ }
@@ -1,11 +1,16 @@
1
+ import { execFile } from 'node:child_process';
1
2
  import { basename } from 'node:path';
3
+ import { promisify } from 'node:util';
2
4
  import { doctorProject } from '../core/doctor.js';
3
5
  import { describeFsError } from '../core/fs-errors.js';
6
+ import { createGithubCopy, displayRemoteUrl, githubCreateCommand, githubRepoName } from '../core/github.js';
4
7
  import { initProject } from '../core/init.js';
8
+ import { onDiskBasename } from '../core/platform-paths.js';
5
9
  import { EXIT_FAILED, EXIT_OK } from './io.js';
6
- export async function executeCreate(options, io, renderer) {
10
+ const execFileAsync = promisify(execFile);
11
+ export async function executeCreate(options, io, renderer, gh) {
7
12
  try {
8
- return await createAndCheck(options, io, renderer);
13
+ return await createAndCheck(options, io, renderer, gh);
9
14
  }
10
15
  catch (cause) {
11
16
  // initProject сам переводит ошибки записи; сюда доходит только непредвиденное.
@@ -19,12 +24,60 @@ export async function executeCreate(options, io, renderer) {
19
24
  return EXIT_FAILED;
20
25
  }
21
26
  }
22
- async function createAndCheck(options, io, renderer) {
27
+ async function hasRemote(root) {
28
+ const remotes = await execFileAsync('git', ['remote'], { cwd: root, encoding: 'utf8' }).catch(() => null);
29
+ return remotes !== null && remotes.stdout.trim() !== '';
30
+ }
31
+ /** Адрес копии в облаке по локальным данным Git: origin, иначе первый remote; нет — null. */
32
+ async function remoteUrl(root) {
33
+ const remotes = await execFileAsync('git', ['remote'], { cwd: root, encoding: 'utf8' }).catch(() => null);
34
+ const names = (remotes?.stdout ?? '').split(/\r?\n/).filter(Boolean);
35
+ const name = names.includes('origin') ? 'origin' : names[0];
36
+ if (name === undefined)
37
+ return null;
38
+ const url = await execFileAsync('git', ['remote', 'get-url', name], { cwd: root, encoding: 'utf8' }).catch(() => null);
39
+ const shown = url?.stdout.trim();
40
+ return shown ? displayRemoteUrl(shown) : null;
41
+ }
42
+ /**
43
+ * Копия на GitHub — только для проекта, чей репозиторий и первый коммит сделал этот create.
44
+ * Сбой gh не отменяет созданный проект: человек получает причину и команду на потом.
45
+ */
46
+ async function cloudStep(options, result, gh) {
47
+ if (options.github !== true)
48
+ return { status: 'none' };
49
+ if (result.existingProject === true) {
50
+ return {
51
+ status: 'skipped',
52
+ reason: (await hasRemote(result.target))
53
+ ? 'Копию на GitHub не завожу: это готовый проект, и копия в облаке (remote) у него уже есть. Create не меняет готовый проект.'
54
+ : 'Копию на GitHub не завожу: create не меняет готовый проект. Завести копию в облаке поможет `/start`.',
55
+ };
56
+ }
57
+ const name = githubRepoName(onDiskBasename(result.target));
58
+ if (result.gitCreated !== true) {
59
+ return {
60
+ status: 'skipped',
61
+ reason: `Копию на GitHub не завожу: первый коммит не сделан (репозиторий Git уже был или шаги Git пропущены). Когда коммит будет, из папки проекта: ${githubCreateCommand(name)}`,
62
+ };
63
+ }
64
+ const copy = await createGithubCopy(result.target, name, gh);
65
+ if (copy.ok)
66
+ return { status: 'created', url: copy.url };
67
+ // Репозиторий мог успеть появиться, а отправка — нет: тогда нужна только отправка.
68
+ const later = (await hasRemote(result.target)) ? 'git push -u origin main' : githubCreateCommand(name);
69
+ return { status: 'failed', reason: copy.reason, later };
70
+ }
71
+ function cloudLine(url) {
72
+ return url !== null ? `Копия в облаке: ${url}` : 'Копии в облаке нет — завести её поможет /start.';
73
+ }
74
+ async function createAndCheck(options, io, renderer, gh) {
23
75
  const result = await initProject({
24
76
  target: options.target,
25
77
  startingPoint: options.startingPoint,
26
78
  git: options.git,
27
79
  depth: options.depth,
80
+ ...(options.pushWithoutAsking === true ? { pushWithoutAsking: true } : {}),
28
81
  requested: {
29
82
  ...(options.explicit?.depth === true ? { depth: options.depth } : {}),
30
83
  ...(options.explicit?.startingPoint === true ? { startingPoint: options.startingPoint } : {}),
@@ -40,15 +93,25 @@ async function createAndCheck(options, io, renderer) {
40
93
  io.err(result.error ?? 'Не удалось подготовить проект.');
41
94
  return EXIT_FAILED;
42
95
  }
96
+ const cloud = await cloudStep(options, result, gh);
97
+ const warnings = [...result.warnings];
98
+ if (cloud.status === 'skipped')
99
+ warnings.push(cloud.reason);
100
+ if (cloud.status === 'failed')
101
+ warnings.push(`Копию на GitHub завести не удалось: ${cloud.reason}. Проект создан и работает на этом компьютере. Повторить можно из папки проекта: ${cloud.later}`);
102
+ // Строка о копии — по фактическому remote: у готового проекта копия могла появиться раньше.
103
+ const cloudUrl = cloud.status === 'created' ? cloud.url : await remoteUrl(result.target);
43
104
  const report = await doctorProject(result.target);
44
- const output = { init: result, doctor: report };
105
+ // Пометки info — не проблемы.
106
+ const problems = report.findings.filter((item) => item.level !== 'info').length;
107
+ const output = { init: result, ...(options.github === true ? { github: cloud } : {}), doctor: report };
45
108
  if (options.json) {
46
109
  io.out(JSON.stringify(output, null, 2));
47
110
  }
48
111
  else {
49
112
  if (!renderer)
50
113
  io.out(`Проект подготовлен: ${result.target}`);
51
- for (const warning of result.warnings) {
114
+ for (const warning of warnings) {
52
115
  if (renderer)
53
116
  renderer.warning(warning);
54
117
  else
@@ -56,12 +119,14 @@ async function createAndCheck(options, io, renderer) {
56
119
  }
57
120
  if (renderer) {
58
121
  if (report.ok)
59
- renderer.success({ action: 'create', target: result.target, name: options.name ?? basename(result.target), doctorOk: true });
122
+ renderer.success({ action: 'create', target: result.target, name: options.name ?? basename(result.target), doctorOk: true, cloud: cloudUrl });
60
123
  else
61
- renderer.failure(`Проверка нашла проблем: ${report.findings.length}.`);
124
+ renderer.failure(`Проверка нашла проблем: ${problems}.`);
125
+ }
126
+ else {
127
+ io.out(cloudLine(cloudUrl));
128
+ io.out(report.ok ? 'Doctor: всё сходится.' : `Doctor: найдено проблем — ${problems}.`);
62
129
  }
63
- else
64
- io.out(report.ok ? 'Doctor: всё сходится.' : `Doctor: найдено проблем — ${report.findings.length}.`);
65
130
  }
66
131
  return report.ok ? EXIT_OK : EXIT_FAILED;
67
132
  }
@@ -12,6 +12,10 @@ const HELP = `${PRODUCT_NAME} — подготовка проекта одной
12
12
  --start <состояние> исходное состояние идеи: ${STARTING_POINTS.join(' | ')} (по умолчанию idea)
13
13
  --depth <глубина> canonical depth: ${DEPTHS.join(' | ')} (по умолчанию standard)
14
14
  --no-git не выполнять git init и стартовый commit
15
+ --github после первого коммита завести закрытую копию на GitHub
16
+ (нужны GitHub CLI gh и выполненный вход; без флага --yes её не заводит)
17
+ --push-without-asking новый проект: обычный git push без вопроса, принудительная отправка
18
+ по-прежнему с вопросом; без флага защиты прежние
15
19
  --yes, -y неинтерактивный режим (все ответы взяты из флагов)
16
20
  --json машиночитаемый отчёт
17
21
  --help, -h эта справка
@@ -26,6 +30,8 @@ export function parseCreateArgs(argv) {
26
30
  git: true,
27
31
  json: false,
28
32
  depth: 'standard',
33
+ github: false,
34
+ pushWithoutAsking: false,
29
35
  explicit: {},
30
36
  };
31
37
  for (let i = 0; i < argv.length; i += 1) {
@@ -40,6 +46,12 @@ export function parseCreateArgs(argv) {
40
46
  case '--no-git':
41
47
  options.git = false;
42
48
  break;
49
+ case '--github':
50
+ options.github = true;
51
+ break;
52
+ case '--push-without-asking':
53
+ options.pushWithoutAsking = true;
54
+ break;
43
55
  case '--yes':
44
56
  case '-y':
45
57
  break;
@@ -89,6 +101,12 @@ export function parseCreateArgs(argv) {
89
101
  return { kind: 'error', message: `Лишний аргумент: ${arg}` };
90
102
  }
91
103
  }
104
+ if (options.github && !options.git) {
105
+ return {
106
+ kind: 'error',
107
+ message: 'Флаг --github отправляет на GitHub первый коммит, а --no-git отключает Git: оставьте один из них. Проект не создан.',
108
+ };
109
+ }
92
110
  if (options.target === '') {
93
111
  return {
94
112
  kind: 'error',
@@ -143,7 +161,8 @@ export async function runCreateCli(argv, io = processIo, runtime = { isTty: Bool
143
161
  git: true,
144
162
  json: false,
145
163
  depth: 'standard',
146
- }, io, prompt.renderer);
164
+ github: answers.github,
165
+ }, io, prompt.renderer, runtime.gh);
147
166
  }
148
167
  catch (error) {
149
168
  io.err(error instanceof Error ? error.message : 'Интерактивный ввод прерван.');
@@ -155,5 +174,5 @@ export async function runCreateCli(argv, io = processIo, runtime = { isTty: Bool
155
174
  return EXIT_USAGE;
156
175
  }
157
176
  const { executeCreate } = await import('./create-run.js');
158
- return executeCreate(parsed.options, io);
177
+ return executeCreate(parsed.options, io, undefined, runtime.gh);
159
178
  }
@@ -13,7 +13,8 @@ export async function executeDoctorCommand(options, io) {
13
13
  }
14
14
  }
15
15
  else {
16
- io.err(`Vibe Coding Maestro doctor: найдено проблем — ${report.findings.length}.`);
16
+ // Пометки info — не проблемы: в числе их нет, но в списке они видны.
17
+ io.err(`Vibe Coding Maestro doctor: найдено проблем — ${report.findings.filter((item) => item.level !== 'info').length}.`);
17
18
  for (const item of report.findings) {
18
19
  io.err(`- ${item.code}${item.path ? ` (${item.path})` : ''}: ${item.message}`);
19
20
  }
@@ -13,6 +13,8 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
13
13
  sources read-only инвентаризация существующих исходников для планирования
14
14
  upgrade предложение обновления канонического проекта прошлой версии
15
15
  preflight механическая проверка права начинать код по активному плану
16
+ pack архив тега сдачи для заказчика: без папок Maestro, с HANDOVER.md
17
+ context размер текущей сессии Claude Code: пора ли в новую сессию
16
18
 
17
19
  Общие опции команд:
18
20
  --path <путь> корень проверяемого проекта (по умолчанию текущая папка)
@@ -30,6 +32,14 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
30
32
  Опции upgrade:
31
33
  --apply выполнить обновление; без флага это только dry-run
32
34
 
35
+ Опции pack:
36
+ --tag <тег> тег сдачи (обязательно)
37
+ --out <файл> куда записать архив (по умолчанию — Рабочий стол)
38
+ --allow <путь> файл, который человек проверил: не секрет; флаг можно повторять
39
+
40
+ Опции context:
41
+ --window <токены> окно модели в токенах (по умолчанию 200000, у длинной сессии 1000000)
42
+
33
43
  Опции preflight:
34
44
  --scale <масштаб> ${PLAN_SCALES.join(' | ')} (по умолчанию feature)
35
45
  --quick <критерии> через запятую: ${QUICK_CRITERIA.join(', ')}
@@ -37,7 +47,7 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
37
47
  Общие опции:
38
48
  --help, -h эта справка
39
49
  --version, -v версия`;
40
- const COMMANDS = ['doctor', 'skills', 'sources', 'upgrade', 'preflight'];
50
+ const COMMANDS = ['doctor', 'skills', 'sources', 'upgrade', 'preflight', 'pack', 'context'];
41
51
  const isCommand = (value) => COMMANDS.includes(value);
42
52
  export function parseMaestroArgs(argv) {
43
53
  if (argv.length === 0)
@@ -138,6 +148,51 @@ export function parseMaestroArgs(argv) {
138
148
  i += 1;
139
149
  break;
140
150
  }
151
+ case '--tag': {
152
+ const message = only(arg, 'pack');
153
+ if (message !== null)
154
+ return { kind: 'error', message };
155
+ const tag = value();
156
+ if (tag === undefined)
157
+ return { kind: 'error', message: `Флаг ${arg} требует значение.` };
158
+ options.tag = tag;
159
+ i += 1;
160
+ break;
161
+ }
162
+ case '--out': {
163
+ const message = only(arg, 'pack');
164
+ if (message !== null)
165
+ return { kind: 'error', message };
166
+ const out = value();
167
+ if (out === undefined)
168
+ return { kind: 'error', message: `Флаг ${arg} требует значение.` };
169
+ options.out = out;
170
+ i += 1;
171
+ break;
172
+ }
173
+ case '--allow': {
174
+ const message = only(arg, 'pack');
175
+ if (message !== null)
176
+ return { kind: 'error', message };
177
+ const allow = value();
178
+ if (allow === undefined)
179
+ return { kind: 'error', message: `Флаг ${arg} требует значение.` };
180
+ options.allow = [...(options.allow ?? []), allow.split('\\').join('/')];
181
+ i += 1;
182
+ break;
183
+ }
184
+ case '--window': {
185
+ const message = only(arg, 'context');
186
+ if (message !== null)
187
+ return { kind: 'error', message };
188
+ const raw = value();
189
+ const window = raw === undefined ? Number.NaN : Number(raw);
190
+ if (!Number.isInteger(window) || window <= 0)
191
+ return { kind: 'error', message: `Флаг ${arg} требует целое число токенов больше нуля.` };
192
+ options.window = window;
193
+ i += 1;
194
+ break;
195
+ }
141
196
  case '--path': {
142
197
  const path = value();
143
198
  if (path === undefined)
@@ -152,6 +207,9 @@ export function parseMaestroArgs(argv) {
152
207
  return { kind: 'error', message: `Лишний аргумент: ${arg}` };
153
208
  }
154
209
  }
210
+ if (first === 'pack' && options.tag === undefined) {
211
+ return { kind: 'error', message: 'Команда pack требует --tag <тег сдачи>.' };
212
+ }
155
213
  if (first === 'sources') {
156
214
  if ((options.sources ?? []).length === 0) {
157
215
  return { kind: 'error', message: 'Команда sources требует хотя бы один --source <путь>.' };
@@ -193,6 +251,14 @@ export async function runMaestroCli(argv, io = processIo) {
193
251
  const { executeSourcesCommand } = await import('./sources-run.js');
194
252
  return executeSourcesCommand({ ...parsed.options, sources: parsed.options.sources ?? [] }, io);
195
253
  }
254
+ if (parsed.kind === 'pack') {
255
+ const { executePackCommand } = await import('./pack-run.js');
256
+ return executePackCommand({ ...parsed.options, tag: parsed.options.tag }, io);
257
+ }
258
+ if (parsed.kind === 'context') {
259
+ const { executeContextCommand } = await import('./context-run.js');
260
+ return executeContextCommand(parsed.options, io);
261
+ }
196
262
  if (parsed.kind === 'preflight') {
197
263
  const { executePreflightCommand } = await import('./preflight-run.js');
198
264
  return executePreflightCommand(parsed.options, io);