create-vibe-maestro 0.4.2 → 0.4.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 (94) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +11 -11
  3. package/dist/cli/archive-run.js +75 -0
  4. package/dist/cli/context-run.js +10 -0
  5. package/dist/cli/maestro.js +46 -4
  6. package/dist/cli/pack-run.js +42 -3
  7. package/dist/cli/upgrade-run.js +44 -5
  8. package/dist/core/archive/audits.js +37 -0
  9. package/dist/core/archive/disk.js +38 -0
  10. package/dist/core/archive/index.js +286 -0
  11. package/dist/core/archive/limits.js +27 -0
  12. package/dist/core/archive/links.js +65 -0
  13. package/dist/core/archive/log.js +83 -0
  14. package/dist/core/archive/markdown.js +28 -0
  15. package/dist/core/archive/plan.js +183 -0
  16. package/dist/core/archive/types.js +1 -0
  17. package/dist/core/audits.js +37 -0
  18. package/dist/core/context.js +47 -2
  19. package/dist/core/doctor/fs-utils.js +3 -2
  20. package/dist/core/doctor/index.js +5 -2
  21. package/dist/core/doctor/memory.js +52 -0
  22. package/dist/core/doctor/plans.js +4 -4
  23. package/dist/core/doctor/wiki.js +9 -33
  24. package/dist/core/gitignore.js +3 -1
  25. package/dist/core/inventory.js +2 -10
  26. package/dist/core/pack.js +130 -12
  27. package/dist/core/plan.js +43 -2
  28. package/dist/core/preflight.js +6 -5
  29. package/dist/core/template.js +2 -1
  30. package/dist/core/text-diff.js +108 -0
  31. package/dist/core/transaction.js +132 -0
  32. package/dist/core/upgrade/analyze.js +82 -5
  33. package/dist/core/upgrade/baseline.js +12 -0
  34. package/dist/core/upgrade/index.js +31 -87
  35. package/dist/core/upgrade/releases.js +143 -2
  36. package/dist/core/wiki-links.js +27 -0
  37. package/docs/ROADMAP.md +8 -4
  38. package/docs/USER_GUIDE.md +117 -35
  39. package/package.json +1 -1
  40. package/registry/baseline/0.4.2/project/.claude/agents/code-reviewer.md +13 -0
  41. package/registry/baseline/0.4.2/project/.claude/rules/maestro.md +37 -0
  42. package/registry/baseline/0.4.2/project/maestro/runbooks/cowork-audit.md +11 -0
  43. package/registry/baseline/0.4.2/project/maestro/templates/handoff.md +25 -0
  44. package/registry/baseline/0.4.2/project/protocols/audit.md +5 -0
  45. package/registry/baseline/0.4.2/project/protocols/build.md +18 -0
  46. package/registry/baseline/0.4.2/project/protocols/completion.md +22 -0
  47. package/registry/baseline/0.4.2/project/protocols/handoff.md +15 -0
  48. package/registry/baseline/0.4.2/project/protocols/plan.md +149 -0
  49. package/registry/baseline/0.4.2/project/protocols/start.md +64 -0
  50. package/registry/baseline/0.4.2/project/protocols/wiki.md +9 -0
  51. package/registry/baseline/0.4.2/project/wiki/plans/README.md +131 -0
  52. package/registry/baseline/0.4.2/project/wiki/plans/TEMPLATE.md +75 -0
  53. package/registry/baseline/0.4.3/project/.claude/rules/maestro.md +40 -0
  54. package/registry/baseline/0.4.3/project/maestro/templates/handoff.md +29 -0
  55. package/registry/baseline/0.4.3/project/protocols/build.md +120 -0
  56. package/registry/baseline/0.4.3/project/protocols/completion.md +23 -0
  57. package/registry/baseline/0.4.3/project/protocols/handoff.md +17 -0
  58. package/registry/baseline/0.4.3/project/protocols/plan.md +159 -0
  59. package/registry/baseline/0.4.3/project/protocols/status.md +5 -0
  60. package/registry/baseline/0.4.3/project/protocols/wiki.md +17 -0
  61. package/registry/baseline/0.4.3/project/wiki/plans/README.md +135 -0
  62. package/registry/baseline/0.4.3/project/wiki/plans/TEMPLATE.md +83 -0
  63. package/registry/capabilities.v1.json +19 -19
  64. package/templates/project/.claude/agents/code-reviewer.md +18 -7
  65. package/templates/project/.claude/rules/maestro.md +7 -3
  66. package/templates/project/.claude/settings.json +1 -0
  67. package/templates/project/maestro/runbooks/cowork-audit.md +9 -2
  68. package/templates/project/maestro/templates/audit.md +31 -0
  69. package/templates/project/maestro/templates/handoff.md +6 -2
  70. package/templates/project/protocols/audit.md +70 -1
  71. package/templates/project/protocols/build.md +111 -9
  72. package/templates/project/protocols/completion.md +8 -7
  73. package/templates/project/protocols/handoff.md +7 -4
  74. package/templates/project/protocols/plan.md +34 -23
  75. package/templates/project/protocols/start.md +1 -1
  76. package/templates/project/protocols/status.md +1 -1
  77. package/templates/project/protocols/wiki.md +10 -2
  78. package/templates/project/wiki/icebox.md +12 -0
  79. package/templates/project/wiki/index.md +5 -0
  80. package/templates/project/wiki/log.md +1 -0
  81. package/templates/project/wiki/passport.md +1 -1
  82. package/templates/project/wiki/plans/0001-starter.md +15 -4
  83. package/templates/project/wiki/plans/README.md +27 -3
  84. package/templates/project/wiki/plans/TEMPLATE.md +23 -6
  85. /package/{templates → registry/baseline/0.4.2}/project/protocols/build/audit-phase.md +0 -0
  86. /package/{templates → registry/baseline/0.4.2}/project/protocols/build/audit-plan.md +0 -0
  87. /package/{templates → registry/baseline/0.4.2}/project/protocols/build/step-1-rules.md +0 -0
  88. /package/{templates → registry/baseline/0.4.2}/project/protocols/build/step-2-spec.md +0 -0
  89. /package/{templates → registry/baseline/0.4.2}/project/protocols/build/step-3-architecture.md +0 -0
  90. /package/{templates → registry/baseline/0.4.2}/project/protocols/build/step-5-feature-loop.md +0 -0
  91. /package/{templates → registry/baseline/0.4.2}/project/protocols/context-budget.md +0 -0
  92. /package/{templates → registry/baseline/0.4.2}/project/protocols/discovery.md +0 -0
  93. /package/{templates → registry/baseline/0.4.2}/project/protocols/lessons.md +0 -0
  94. /package/{templates → registry/baseline/0.4.2}/project/protocols/seams.md +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,98 @@ 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.4 — 2026-11-04
8
+
9
+ The fifth part of 0.4: project memory stops growing. A slice result goes to its handoff and the plan keeps one line; old log entries, closed check reports and closed plan edits move to an archive inside the project, and the agent reads the archive by search; `doctor` says when memory gets long. Nothing is deleted: the moved text stays byte for byte, only link addresses change.
10
+
11
+ ### Added
12
+
13
+ - **`vibe-maestro archive`** moves old memory into an archive inside the project in one transaction with a backup and rollback. Without `--apply` it only shows what it would move, with sizes; `--json` reports what moved, what stayed and why. It works only on a project of its own version (otherwise «first `upgrade`»), and refuses on a symbolic link on its paths, on a leftover staging folder of its own or of `upgrade`, and on a destination that git ignores. It never overwrites a file whose name differs only in case or Unicode form: a report stays with the reason, anything else is refused.
14
+ - **Log:** `wiki/log.md` over 20 000 characters — the last entries worth 10 000 characters stay (at least one), older ones go to `wiki/log/YYYY-MM.md` in their order. A pointer line is added to the log header once.
15
+ - **Check reports:** closed ones (`status: resolved`, all findings resolved) go to `wiki/audits/archive/`. Open reports, reports `doctor` cannot read and reports named in a plan's `sources` stay, with the reason.
16
+ - **Plan edits:** `--section "<heading start>"` (repeatable) moves a closed edit of the active plan to `wiki/plans/archive/<plan>.md`; the heading and a line «В архиве: …» stay in the plan. Only sections below «Правки после утверждения» or «Изменения после утверждения» can move; the main part of the plan, the collection itself, «Утверждение» and a section with the current slice in a heading are refused. A wrong name is refused with a list, not a byte written.
17
+ - **Links:** relative links in moved text are rebased, and links in `wiki/**` to a moved report lead to the new place. One link search for `doctor` and `archive`.
18
+ - **Approval digest:** when a plan has one, `archive` works only if the text matches it, then writes the new digest and a line with the date and both digests to the plan's archive. An unapproved edit cannot be laundered this way: a changed plan is refused, and a report it links to stays.
19
+ - **`doctor` reports memory length** as `info`, which never fails `--strict` or `preflight`, because the limits are a hypothesis from three live projects: `memory-hot-long` (6 000 characters), `memory-plan-long` (60 000), `memory-log-long` (20 000), `memory-handoff-long` (6 000, the handoffs with the latest date in the name). Each message gives the number, the guide and what to do.
20
+
21
+ ### Changed
22
+
23
+ - **A slice result lives in the handoff; the plan keeps one line.** Closing a slice: `[ ]` → `[x]` in «Порядок работ» or in the slice's edit, and the tail ` → [итог](../handoffs/<file>.md)` at the end of that line. Only where a `[ ]` exists: slices of older plans have no mark and get none. The result, acceptance and the move to the next slice are not written to the plan. `protocols/handoff.md`, `protocols/build.md`, `wiki/plans/README.md` and `wiki/plans/TEMPLATE.md` say the same.
24
+ - **The tail does not break the approval digest.** Exactly one tail of exactly this form at the end of a checked item is left out of the digest; another link text, another folder, a second tail, a tail on `[ ]` or on a continuation line is plan text. Without tails the digest equals 0.4.3, and plans approved with the 0.4.3 or the earlier digest stay green.
25
+ - **The agent runs `archive` itself** at the handoff of a closed slice and before the final handoff, without asking: it is a move inside the project. The human gets half a line in the summary. The agent names closed plan edits itself.
26
+ - **The archive is read by search.** `.claude/rules/maestro.md`, `protocols/wiki.md`, `protocols/build.md`, `protocols/plan.md` and `protocols/status.md`: find by name or word, read the piece found. To redo a closed part: a new edit mid-plan with a link to the archived one, with the human's «да». The archive is not edited by hand and not copied back. `wiki/attic/` holds outdated and replaced documents; the archive holds closed history.
27
+ - **«Правки после утверждения»** is a section of the plan template: an edit is `### Правка N — суть (дата)`. New plans list slices as `1. [ ]`.
28
+ - `wiki/hot.md`: the guide is now up to 6 000 characters, about 60 lines.
29
+ - `wiki/log.md` and `wiki/index.md` of new projects name the archive as plain paths; existing projects keep theirs, and `upgrade` reminds about the line in `wiki/index.md`.
30
+ - The `vibe-maestro` companion package (0.1.8) depends on exactly `create-vibe-maestro@0.4.4`.
31
+ - Upgrade tests use projects generated by the real published 0.4.3 package.
32
+
33
+ ### For those who create projects with their own scripts
34
+
35
+ - **New command `vibe-maestro archive`:** without `--apply` it writes nothing; `--json` gives the report (what moved, what stayed and why; `logNote` says why a long log has nothing to move, `partial: true` means a rollback failed and the project is changed in part); a refusal is exit code 1 with not a byte written. Works only on a project of its own version.
36
+ - **Log:** entries over the limit go to `wiki/log/YYYY-MM.md`; `wiki/log.md` stays the main file, with a line about months in the header. If a script reads the log, it should read `wiki/log/` too.
37
+ - **Check reports:** closed ones (`status: resolved`) go to `wiki/audits/archive/`; open ones stay in `wiki/audits/`; `doctor` checks both folders.
38
+ - **Plan archive** is `wiki/plans/archive/<plan>.md`, not a plan; the heading and a line with a link stay in the plan; `archive` rewrites `approved_digest` only for an unchanged approved plan.
39
+ - **Links:** `archive` fixes link addresses inside `wiki/`; links to moved files from `README.md`, `docs/` and other places outside `wiki/` are not touched. Paths written as plain text stay old: the file is found by name.
40
+ - **Digest:** on a `[x]` item the tail ` → [итог](../handoffs/<file>.md)` is left out; without tails the digest is the same.
41
+ - **`doctor`:** new `info` codes `memory-hot-long`, `memory-plan-long`, `memory-log-long`, `memory-handoff-long`; they do not fail `--strict` or `preflight`.
42
+ - **Do not change:** the section names of `wiki/hot.md`; the place and names of handoffs `wiki/handoffs/YYYY-MM-DD-….md`; `create --yes`; the set of Maestro files; `.claude/settings.json` of the template.
43
+ - **Projects before 0.4.4:** `wiki/index.md` belongs to the project; add the line about the archive if you want it.
44
+ - The `vibe-maestro` companion 0.1.8 is exactly `create-vibe-maestro@0.4.4`. `upgrade` works from 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, 0.4.2 and 0.4.3.
45
+
46
+ ## 0.4.3 — 2026-11-01
47
+
48
+ The fourth part of 0.4: checks, protocols and command fixes. Checks run once and only the fixes are re-checked; small tasks follow the same path as any plan; eight protocols instead of eighteen; `upgrade` shows its changes and can remove retired Maestro files; `pack` shows what goes to the customer before packing. The set of project files changes; `vibe-maestro upgrade` migrates projects from 0.4.2, 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.
49
+
50
+ ### Added
51
+
52
+ - **`upgrade --diff`** prints the changes themselves as unified-diff hunks: what is added, what changes line by line, what is removed. The plain proposal now shows the number of changed lines next to every file and points to `--diff`. `--diff` writes nothing and does not combine with `--apply` or `--json`. Line diff of its own, no dependencies.
53
+ - **`upgrade` removes retired Maestro files** — only those in its explicit list and only untouched ones (the previous source and the checksum match). A modified file stops the upgrade with a clear hint (bring it back or move your edits to your own file); a file already gone is skipped. Removal is part of the same transaction: bytes go to `backup/` first, a rollback brings them back; a folder emptied by removal goes away. Any other path missing from the new canon still stops the upgrade.
54
+ - **`maestro/templates/audit.md`** (managed): a check report in the format `doctor` accepts — header, `## Finding` with one-line fields, the fix check inside `resolution`, a new finding of the fix check as a new `## Finding`, «не исправляем» left `open`. IDs must be Latin letters, digits, `.`, `-`, `_` — `doctor` does not see a finding with another ID; the sample and the Cowork runbook say so.
55
+ - **`wiki/icebox.md`** (belongs to the project): ideas set aside — why and when to come back; unfixed check findings may point here.
56
+ - **`pack --dry-run`** shows what goes into the archive and highlights what to look at, without writing a byte. Highlights: service files (`.gitignore`, `.gitattributes`, `.DS_Store`, `.vscode/`, `.idea/`, `.github/`, `*.log`), home, project and temporary paths, Maestro names, internal folders (`wiki/`, `maestro/`, `protocols/`, `.claude/`), plan numbers. A highlight is a warning: packing is not refused and the exit code is unchanged. Plain `pack` prints the highlights too; JSON gets `highlights` when there are any and `noAccess` when the passport has no accesses; `--dry-run` reports `dryRun`, `entries` and, before the tag exists, `untagged`. The root `.gitattributes` and `.gitignore` that Maestro writes are marked «оставьте» instead of «убрать».
57
+ - «Проверки на GitHub» in `protocols/build.md` and a short rule in `.claude/rules/maestro.md`: check locally with the same commands first, push in a batch after a closed slice, do not push while the previous run is going, run a GitHub check by hand only for what cannot be checked locally (at most once per slice, never instead of the local run), and after a push keep working instead of waiting; the result is looked at once — at the start of the next slice or before merging. An economical workflow sample: `concurrency` with `cancel-in-progress`, a quick job on branches, the full set on pull requests, `paths-ignore` for `wiki/`, `maestro/` and documents, a schedule only by the human's decision about cost.
58
+
59
+ ### Changed
60
+
61
+ - **Eight protocols instead of eighteen.** The text of ten small protocols moved verbatim, anchors included: working rules, specification, architecture, the task capsule and the TDD loop into `protocols/build.md`; plan audit, seams and council reconciliation into `protocols/audit.md`; lessons into `protocols/wiki.md`. `protocols/discovery.md` (only a pointer to the start since 0.4.2) is gone. Contract IDs `VCM-…` are unchanged; the capability ledger names the new owners.
62
+ - **Checks without an extra round** (owner's decision of 2026-11-01). `protocols/audit.md` is the single owner of check rules: what each check is for, when it runs (plan audit before approval and `preflight`, code review after a slice with green tests), strictness — the stricter of the plan's classification and the project depth, one scale for plans and code, one full round and then one check of the fixes only, what to hand the read-only reviewer, how to write the report. A plan draft is always checked against the real situation (`plan.md` Stage D: every FACT by a file, code or command output, a guess by experience or HYPOTHESIS), for every scale. Critical/high are fixed and only the fix is checked; medium/low are fixed or written down with a reason, and the work stops. The human's «проверь ещё раз» always means a check.
63
+ - **One scale** — `critical | high | medium | low` with meanings for plans and code, word for word the same in `protocols/audit.md`, `.claude/agents/code-reviewer.md` and the Cowork runbook. `doctor`'s own message levels (`critical`, `error`, `warning`, `info`) are a different thing and do not change.
64
+ - `code-reviewer` knows three kinds of work — slice review, plan audit, fix check — returns findings in the sample's format and writes no file: the author writes the report without changing the reviewer's words, IDs or evidence.
65
+ - `governance` of a plan is never below the project depth; below it, the depth applies. The starter `governance: light` plan in a `standard` project is no longer a contradiction.
66
+ - **A small task** (`QUICK`) has its mini-plan in `wiki/plans/` (`kind: mini`, `scale: quick`: goal, files, check, risk, stop gate, what was checked) and is approved and closed like any plan; one confirmed red test per set. A small edit while another plan is active becomes a new slice of that plan after the human's «да» and a new digest. «The plan must define…» applies to FEATURE and up.
67
+ - **Labels:** one table in `protocols/plan.md` with Russian names and when to use each; the plan template uses the same six; three are enough in conversation.
68
+ - **New session:** one sentence in four places — `.claude/rules/maestro.md`, `protocols/build.md`, `protocols/handoff.md`, `protocols/plan.md` — advised by `context`, also after plan approval (no longer «always a new session»).
69
+ - **Ask the human only about what they understand and own** — what we do, money, sending to people and publishing, deleting what cannot be restored, their accounts and settings. Tests, plan and code checks, fix checks and GitHub checks run inside the work. At the end of a slice, a plain-words summary in two or three lines; the handoff template has a «Итог для человека» section. No new confirmations.
70
+ - **Ticks do not break the approval digest:** `[x]`/`[X]` in list items count as `[ ]`; editing an item's text still closes the gate. Plans approved before keep working: the previous digest of unchanged text is accepted. The plan template lists «done» criteria as `- [ ]`.
71
+ - **`pack --out dist/`** (or `dist\`) is a folder: it is created and the archive goes inside under the default name (it used to become a file named `dist`).
72
+ - **`HANDOVER.md`** says «доступов не было, менять нечего» instead of «смените все пароли и ключи» only when every access section of the passport — «Где работает», «Домен и DNS», «Данные, базы, резервные копии», «Внешние сервисы и чей аккаунт», «Переменные окружения» — is «не применимо». Any doubt keeps the old step.
73
+ - **`context` takes the window from the model** named in the transcript: 200 000 for a closed list of past models (Claude 3.x, Opus 4/4.1/4.5, Sonnet 4/4.5, Haiku 4.5; a session already larger means 1 000 000, as before), 1 000 000 for newer Claude models. An unknown name is said plainly with a hint to use `--window`, which still wins. A «Модель … — окно …» line; JSON gains `model` and `windowSource`.
74
+ - `protocols/completion.md`: `pack --dry-run` first; the agent checks and cleans the list and gives the human a summary; packing and sending stay behind «да». What stays open, including findings «не исправляем», is named in the final handoff.
75
+ - The template engine leaves GitHub `${{ … }}` expressions alone; any other unknown `{{…}}` still fails.
76
+ - The `vibe-maestro` companion package (0.1.7) depends on exactly `create-vibe-maestro@0.4.3`.
77
+ - Upgrade tests use projects generated by the real published 0.4.2 package.
78
+ - From the independent review: a small edit mid-plan needs a corner check of the new slice and the usual slice review, not a new audit of the whole plan, unless it changes approach, boundaries, classification, data, security or deployment (one «new risk» list everywhere); deleting or rewriting a file in a normal commit is an edit, not a destructive action — a confirmation is for what cannot be restored; the GitHub workflow sample runs the quick job on every push, `main` included; `upgrade` reminds to add `wiki/icebox.md` to the project's own `wiki/index.md` and gives a complete hint for a modified retired file; `context` reads Bedrock `global.` model names and judges a session larger than 200 000 by the current model only; `pack` does not take a URL path for an internal folder or a year for a plan number and catches «по плану 0002»; the starter mini-plan has the QUICK shape.
79
+ - From the live run of a small task: a medium/low fixed after the last fix check closes without a new round; a review with no findings is written in the slice handoff, not in `wiki/audits/` (doctor needs at least one finding); `preflight` and `doctor` name both kinds of «да» for a changed plan — a repeated «план утверждаю» or the «да» to a small edit mid-plan; `pack --dry-run` works before the delivery tag (it shows the last commit), so the list is cleaned before the tag is set once; the tag name goes into the passport before tagging; the passport template and `pack` say that «не применимо» with an explanation counts as an access record.
80
+
81
+ ### For those who create projects with their own scripts
82
+
83
+ - **Fewer protocols.** Removed: `protocols/discovery.md`, `seams.md`, `lessons.md`, `context-budget.md` and the `protocols/build/` folder. Their text is in `protocols/build.md`, `protocols/audit.md`, `protocols/wiki.md`; the `VCM-…` anchors are unchanged. If you link to the old paths, replace them.
84
+ - **`upgrade` removes** untouched Maestro files that left the canon; a modified one stops it (`upgrade-removed-modified`). `--json` gains the field `removes`; the rest is unchanged. `upgrade --diff` shows the changes themselves. A project's own `maestro/templates/audit.md` stops the upgrade (`upgrade-template-collision`): rename it.
85
+ - **New files:** `maestro/templates/audit.md` (Maestro), `wiki/icebox.md` (project). Projects before 0.4.3: `.claude/settings.json` belongs to the project — add `Edit(/maestro/templates/audit.md)` to `deny` if you want the same protection.
86
+ - **Labels do not change:** FACT, HYPOTHESIS, UNKNOWN, HUMAN_DECISION, AGENT_PROPOSAL, OPEN_QUESTION.
87
+ - **The report scale is the same** — `critical|high|medium|low`; there is now a sample. `doctor`'s rules for `wiki/audits/` do not change; finding IDs must be Latin letters, digits, `.`, `-`, `_`. Medium/low left unfixed stay `status: open` with `resolution: не исправляем — причина; где записано` — `doctor` stays green; critical/high are closed only after a verified fix. `doctor`'s own message levels do not change.
88
+ - **Checks:** the plan is always checked against the real situation; after code review only the fixes are checked. A hub rule like «a clean plan — one round; only medium/low — write down and go on» agrees with this and may stay.
89
+ - **QUICK mini-plan** lives in `wiki/plans/` (`kind: mini`, `scale: quick`) and is approved like any plan. `preflight --scale quick --quick …` works as before, but the protocols no longer offer it.
90
+ - **Strictness — the stricter of two:** the plan's classification and the project depth. Small tasks run lighter in a `--depth light` project; whoever creates the project chooses.
91
+ - **Plan digest:** `[x]` ticks in lists are not counted; old digests of unchanged plans are accepted.
92
+ - **`pack`:** `--out` ending with `/` or `\` is a folder; `--dry-run` shows the list without writing (before the tag it shows the last commit); highlights are warnings, the exit code is unchanged, JSON gains `highlights`, `noAccess`, and in dry-run `dryRun`, `entries`, `untagged`; without accesses in the passport `HANDOVER.md` says «доступов не было» instead of «смените все пароли и ключи» — if your script looks for that line, take it into account.
93
+ - **`context`:** the window comes from the model in the transcript; the line «За сессию модель получила на вход …» and the `totalInputTokens` field are unchanged; JSON gains `model` and `windowSource`.
94
+ - **GitHub checks:** the agent's rule — check locally before pushing, push in a batch, run a GitHub check by hand only for what cannot be checked locally, do not wait after a push. The template's `.claude/settings.json` gains no `ask` rule for it.
95
+ - **Asking the human:** only about what they understand and own; technical checks run without questions, the slice summary is in plain words. No new confirmations.
96
+ - **Unchanged:** section names of `wiki/hot.md`, the `start:` flag in `wiki/concepts/discovery.md`, the materials place `maestro/inbox/` and the `-text` rule, `create --yes` without a repository.
97
+ - The `vibe-maestro` companion 0.1.7 depends on exactly `create-vibe-maestro@0.4.3`.
98
+
7
99
  ## 0.4.2 — 2026-11-01
8
100
 
9
101
  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.
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  </p>
26
26
 
27
27
  > [!IMPORTANT]
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.
28
+ > **0.4.4 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
 
@@ -78,7 +78,7 @@ Vibe Coding Maestro doctor: всё сходится.
78
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.
79
79
 
80
80
  > [!WARNING]
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.
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, 0.4.2, 0.4.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
82
 
83
83
  ## Что дальше после создания проекта: Planning Gate
84
84
 
@@ -114,7 +114,7 @@ npx --package create-vibe-maestro@latest vibe-maestro doctor --path .
114
114
 
115
115
  | Масштаб | Что создаётся |
116
116
  |---|---|
117
- | `QUICK` | mini-plan в `wiki/progress/`, без тяжёлого пакета планирования |
117
+ | `QUICK` | mini-plan в `wiki/plans/` — тот же путь, что у любого плана, без тяжёлого пакета планирования |
118
118
  | `FEATURE` | один план `wiki/plans/<номер>-<слаг>.md` |
119
119
  | `PROJECT` | полный пакет планирования в одном основном плане |
120
120
  | `PROGRAM` / `INTEGRATION` | `wiki/programs/<слаг>/`: программа, фазы и source inventory |
@@ -148,7 +148,7 @@ My Project/
148
148
  ├── .claude/settings.json # yours: default deny/ask rules (Maestro files, push, publish)
149
149
  ├── .claude/commands/ # /start, /status, /plan, /build, /wiki, /handoff adapters
150
150
  ├── .claude/agents/ # read-only code-reviewer and explorer
151
- ├── protocols/ # canonical rules for planning, building, handoff and project completion
151
+ ├── protocols/ # eight canonical protocols: start, plan, build, audit, wiki, status, handoff, completion
152
152
  ├── wiki/ # shared memory: start answers, plans, decisions, progress, audits, passport, restore page
153
153
  ├── maestro/ # inbox for your materials (kept byte for byte), runbooks, and templates
154
154
  └── .maestro/ # manifest, ownership inventory and integrity metadata
@@ -178,7 +178,7 @@ From there, `protocols/build.md` routes the agent through the relevant rules, pl
178
178
 
179
179
  ## A normal working cycle
180
180
 
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
+ 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. Checks run once: the plan is always checked against the real situation, a plan audit before approval, one code review per slice, then only the fixes are re-checked; the agent runs tests and checks itself and asks the human only about what they understand and own. Independent audit findings are recorded with stable IDs on one `critical | high | medium | low` scale (sample: `maestro/templates/audit.md`); open `high` or `critical` findings block a green doctor result.
182
182
 
183
183
  Claude Code projects receive six thin commands:
184
184
 
@@ -206,8 +206,8 @@ Maestro is deliberately conservative around existing data and Git state:
206
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);
207
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);
208
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;
210
- - `upgrade` is a dry run without `--apply`, refuses a modified managed file, and rolls back a failed apply;
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» (or «there were no accesses» when every access section of the passport is «не применимо»), refuses on common kinds of secrets (a sieve, not a guarantee) or an incomplete passport, and gives the same bytes for the same tag; `pack --dry-run` shows the archive list first and highlights service files, personal paths, Maestro names, internal folders and plan numbers;
210
+ - `upgrade` is a dry run without `--apply` (`--diff` prints the changes themselves), refuses a modified managed file, removes only untouched Maestro files that left the canon, and rolls back a failed apply; `archive` moves old memory inside the project the same way — nothing deleted, text byte for byte except link addresses, a plan's approval digest rewritten only when the text matched it;
211
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`;
212
212
  - there is intentionally no `doctor --fix` that could overwrite useful work.
213
213
 
@@ -271,7 +271,7 @@ Run the preview from the project folder; it writes nothing:
271
271
  npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
272
272
  ```
273
273
 
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.
274
+ It lists every file it would add, update or remove, with changed line counts, and prints the exact command, with the exact version, that applies the change (`--apply`); `--diff` prints the changes line by line. A file you edited by hand is never overwritten or removed: the upgrade stops and names it. Moving to 0.4.3 removes ten small protocols whose text moved into `protocols/build.md`, `protocols/audit.md` and `protocols/wiki.md`, and adds `maestro/templates/audit.md` and `wiki/icebox.md`. 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.
275
275
 
276
276
  ## Automation and CI
277
277
 
@@ -289,12 +289,12 @@ npx --package create-vibe-maestro@latest vibe-maestro doctor --path . --strict
289
289
  npx --package create-vibe-maestro@latest vibe-maestro skills --path .
290
290
  npx --package create-vibe-maestro@latest vibe-maestro preflight --path . --json
291
291
  npx --package create-vibe-maestro@latest vibe-maestro sources --path . --source "../durak" --source "../dice-poker"
292
- npx --package create-vibe-maestro@latest vibe-maestro upgrade --path .
292
+ npx --package create-vibe-maestro@latest vibe-maestro archive --path .
293
293
  ```
294
294
 
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`.
295
+ `preflight` and `doctor` exit `0` when the check passes and `1` when it blocks; `sources`, `upgrade` and `archive` write nothing at all unless you add `--write` or `--apply`.
296
296
 
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.
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, 0.4.1, 0.4.2 and 0.4.3. Pull requests and `main` run on Ubuntu, macOS, and Windows with Node.js 20 and 22; a branch push runs one quick Ubuntu job.
298
298
 
299
299
  ## Current scope
300
300
 
@@ -0,0 +1,75 @@
1
+ import { AUDITS_ARCHIVE_DIR } from '../core/archive/audits.js';
2
+ import { formatChars } from '../core/archive/limits.js';
3
+ import { archiveProject } from '../core/archive/index.js';
4
+ import { plainTitle } from '../core/archive/plan.js';
5
+ import { quotePathArg, serviceInvocation, VERSION } from '../core/meta.js';
6
+ import { EXIT_FAILED, EXIT_OK } from './io.js';
7
+ const DIGEST_SHOWN = 12;
8
+ function describe(report, io) {
9
+ const { log, audits } = report;
10
+ if (log !== null) {
11
+ const months = log.months.map((month) => `${month.path} (${month.entries})`).join(', ');
12
+ io.out(`- Журнал wiki/log.md: ${formatChars(log.chars)} знаков при пороге ${formatChars(log.limit)} — записей в архив: ${log.movedEntries} → ${months}; в wiki/log.md остаются последние ${log.keptEntries} (до ${formatChars(log.keep)} знаков).`);
13
+ }
14
+ if (audits.moved.length > 0)
15
+ io.out(`- Закрытые отчёты проверок: ${audits.moved.length} → ${AUDITS_ARCHIVE_DIR}/.`);
16
+ for (const section of report.sections) {
17
+ if (section.status === 'already') {
18
+ io.out(`- Раздел «${section.heading}» уже в архиве.`);
19
+ continue;
20
+ }
21
+ io.out(`- Раздел плана «${section.heading}»: ${formatChars(section.chars)} знаков → ${report.planArchive}; в плане остаются заголовок и строка со ссылкой.`);
22
+ for (const nested of section.nested)
23
+ io.out(` - внутри «${nested.heading}»: ${formatChars(nested.chars)} знаков.`);
24
+ for (const warning of section.warnings)
25
+ io.out(` - Проверьте: ${warning}`);
26
+ }
27
+ if (report.logNote !== null)
28
+ io.out(`- ${report.logNote}`);
29
+ for (const digest of report.digests)
30
+ io.out(`- Отпечаток ${digest.plan}: ${digest.before.slice(0, DIGEST_SHOWN)}… → ${digest.after.slice(0, DIGEST_SHOWN)}…; оба записаны в архиве плана.`);
31
+ if (report.relinked.length > 0)
32
+ io.out(`- Адреса ссылок поправлены в файлах: ${report.relinked.length}.`);
33
+ for (const item of audits.kept)
34
+ io.out(`- Остаётся ${item.path}: ${item.reason}`);
35
+ }
36
+ /**
37
+ * Без `--apply` команда только показывает, что перенесёт: ни байта не пишет.
38
+ * Перенос — внутри проекта, ничего не удаляется.
39
+ */
40
+ export async function executeArchiveCommand(options, io) {
41
+ const report = await archiveProject(options.path, {
42
+ apply: options.apply === true,
43
+ ...(options.sections === undefined ? {} : { sections: options.sections }),
44
+ ...(options.hooks === undefined ? {} : { hooks: options.hooks }),
45
+ });
46
+ if (options.json) {
47
+ io.out(JSON.stringify(report, null, 2));
48
+ return report.ok ? EXIT_OK : EXIT_FAILED;
49
+ }
50
+ if (!report.ok) {
51
+ io.err(report.partial ? 'Vibe Coding Maestro archive: перенос прерван, и откатить удалось не всё: проект изменён частично.' : 'Vibe Coding Maestro archive: перенос не выполнен (изменений на диске нет).');
52
+ if (report.error !== undefined)
53
+ io.err(`- ${report.error}`);
54
+ for (const item of report.blockers)
55
+ io.err(`- ${item.code}${item.path ? ` (${item.path})` : ''}: ${item.message}`);
56
+ return EXIT_FAILED;
57
+ }
58
+ if (report.writes.length === 0) {
59
+ const reasons = [report.logNote === null ? 'журнал не больше порога' : null, report.audits.kept.length === 0 ? 'закрытых отчётов нет' : null].filter((reason) => reason !== null);
60
+ io.out(`Переносить в архив нечего${reasons.length > 0 ? `: ${reasons.join(', ')}` : ''}.`);
61
+ describe(report, io);
62
+ return EXIT_OK;
63
+ }
64
+ if (report.applied) {
65
+ io.out('Vibe Coding Maestro archive: перенесено в архив.');
66
+ describe(report, io);
67
+ io.out('Ничего не удалено: перенесённый текст — в файлах архива. Проект в git — закоммитьте изменения.');
68
+ return EXIT_OK;
69
+ }
70
+ io.out('Vibe Coding Maestro archive: будет перенесено в архив (пробный запуск, ни байта не записано).');
71
+ describe(report, io);
72
+ const named = (options.sections ?? []).map((section) => ` --section "${plainTitle(section)}"`).join('');
73
+ io.out(`Перенести: ${serviceInvocation(VERSION)} archive --path ${quotePathArg(options.path)}${named} --apply`);
74
+ return EXIT_OK;
75
+ }
@@ -18,6 +18,15 @@ const ADVICE = {
18
18
  'finish-slice': 'Порцию лучше закончить в этой сессии, а следующую начать в новой — после передачи дел (/handoff).',
19
19
  'new-session': 'Пора в новую сессию: сделайте передачу дел (/handoff) сейчас и продолжайте в новой.',
20
20
  };
21
+ /** Откуда взято окно — одной строкой. */
22
+ function windowLine(source, model, budget) {
23
+ if (source === 'option')
24
+ return `Окно задано вручную (--window): ${formatTokens(budget)} ${tokensWord(budget)}.`;
25
+ if (source === 'model' && model !== undefined)
26
+ return `Модель ${model} — окно ${formatTokens(budget)} ${tokensWord(budget)}.`;
27
+ const name = model === undefined ? 'в журнале не названа' : `«${model}» мне незнакома`;
28
+ return `Модель ${name}: окно взято ${formatTokens(budget)} ${tokensWord(budget)} по размеру сессии. Знаете окно этой модели — задайте его: --window <токены>.`;
29
+ }
21
30
  export async function executeContextCommand(options, io) {
22
31
  const report = await measureContext({ root: options.path, ...(options.window === undefined ? {} : { budget: options.window }) });
23
32
  if (options.json) {
@@ -30,6 +39,7 @@ export async function executeContextCommand(options, io) {
30
39
  }
31
40
  const tokens = report.contextTokens ?? 0;
32
41
  io.out(`Размер сессии: ${formatTokens(tokens)} ${tokensWord(tokens)} (${report.percent}% окна модели в ${formatTokens(report.budget)}).`);
42
+ io.out(windowLine(report.windowSource, report.model, report.budget));
33
43
  io.out(ADVICE[report.level]);
34
44
  const total = report.totalInputTokens ?? 0;
35
45
  io.out(`За сессию модель получила на вход ${formatTokens(total)} ${tokensWord(total)} (шагов модели: ${report.requests}): каждый шаг заново пересылает всю историю.`);
@@ -15,6 +15,7 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
15
15
  preflight механическая проверка права начинать код по активному плану
16
16
  pack архив тега сдачи для заказчика: без папок Maestro, с HANDOVER.md
17
17
  context размер текущей сессии Claude Code: пора ли в новую сессию
18
+ archive перенос старой памяти проекта в архив внутри проекта (ничего не удаляет)
18
19
 
19
20
  Общие опции команд:
20
21
  --path <путь> корень проверяемого проекта (по умолчанию текущая папка)
@@ -31,14 +32,20 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
31
32
 
32
33
  Опции upgrade:
33
34
  --apply выполнить обновление; без флага это только dry-run
35
+ --diff показать сами правки построчно (только просмотр, ни байта не пишет)
34
36
 
35
37
  Опции pack:
36
38
  --tag <тег> тег сдачи (обязательно)
37
- --out <файл> куда записать архив (по умолчанию — Рабочий стол)
39
+ --out <файл> куда записать архив (по умолчанию — Рабочий стол); путь с / или \ на конце — папка
38
40
  --allow <путь> файл, который человек проверил: не секрет; флаг можно повторять
41
+ --dry-run состав архива с подсветкой внутреннего; ничего не пишет
42
+
43
+ Опции archive:
44
+ --apply перенести; без флага только показывает, что перенесёт
45
+ --section <начало> закрытая правка активного плана по началу заголовка; флаг можно повторять
39
46
 
40
47
  Опции context:
41
- --window <токены> окно модели в токенах (по умолчанию 200000, у длинной сессии 1000000)
48
+ --window <токены> окно модели в токенах (по умолчанию — по модели из журнала сессии)
42
49
 
43
50
  Опции preflight:
44
51
  --scale <масштаб> ${PLAN_SCALES.join(' | ')} (по умолчанию feature)
@@ -47,7 +54,7 @@ const HELP = `${PRODUCT_NAME} — служебный CLI проекта.
47
54
  Общие опции:
48
55
  --help, -h эта справка
49
56
  --version, -v версия`;
50
- const COMMANDS = ['doctor', 'skills', 'sources', 'upgrade', 'preflight', 'pack', 'context'];
57
+ const COMMANDS = ['doctor', 'skills', 'sources', 'upgrade', 'preflight', 'pack', 'context', 'archive'];
51
58
  const isCommand = (value) => COMMANDS.includes(value);
52
59
  export function parseMaestroArgs(argv) {
53
60
  if (argv.length === 0)
@@ -81,10 +88,27 @@ export function parseMaestroArgs(argv) {
81
88
  break;
82
89
  }
83
90
  case '--apply': {
91
+ if (first !== 'upgrade' && first !== 'archive')
92
+ return { kind: 'error', message: `Флаг ${arg} доступен только для upgrade и archive.` };
93
+ options.apply = true;
94
+ break;
95
+ }
96
+ case '--section': {
97
+ const message = only(arg, 'archive');
98
+ if (message !== null)
99
+ return { kind: 'error', message };
100
+ const section = value();
101
+ if (section === undefined || section.trim() === '')
102
+ return { kind: 'error', message: `Флаг ${arg} требует значение: начало заголовка раздела.` };
103
+ options.sections = [...(options.sections ?? []), section];
104
+ i += 1;
105
+ break;
106
+ }
107
+ case '--diff': {
84
108
  const message = only(arg, 'upgrade');
85
109
  if (message !== null)
86
110
  return { kind: 'error', message };
87
- options.apply = true;
111
+ options.diff = true;
88
112
  break;
89
113
  }
90
114
  case '--scale': {
@@ -170,6 +194,13 @@ export function parseMaestroArgs(argv) {
170
194
  i += 1;
171
195
  break;
172
196
  }
197
+ case '--dry-run': {
198
+ const message = only(arg, 'pack');
199
+ if (message !== null)
200
+ return { kind: 'error', message };
201
+ options.dryRun = true;
202
+ break;
203
+ }
173
204
  case '--allow': {
174
205
  const message = only(arg, 'pack');
175
206
  if (message !== null)
@@ -207,6 +238,13 @@ export function parseMaestroArgs(argv) {
207
238
  return { kind: 'error', message: `Лишний аргумент: ${arg}` };
208
239
  }
209
240
  }
241
+ if (first === 'upgrade' && options.diff === true) {
242
+ if (options.apply === true)
243
+ return { kind: 'error', message: 'Флаг --diff только показывает правки и не сочетается с --apply: сначала посмотрите, затем примените отдельной командой.' };
244
+ // Отчёт --json по договору не содержит текста файлов.
245
+ if (options.json)
246
+ return { kind: 'error', message: 'Флаг --diff показывает правки текстом и не сочетается с --json: отчёт --json содержимого файлов не содержит.' };
247
+ }
210
248
  if (first === 'pack' && options.tag === undefined) {
211
249
  return { kind: 'error', message: 'Команда pack требует --tag <тег сдачи>.' };
212
250
  }
@@ -255,6 +293,10 @@ export async function runMaestroCli(argv, io = processIo) {
255
293
  const { executePackCommand } = await import('./pack-run.js');
256
294
  return executePackCommand({ ...parsed.options, tag: parsed.options.tag }, io);
257
295
  }
296
+ if (parsed.kind === 'archive') {
297
+ const { executeArchiveCommand } = await import('./archive-run.js');
298
+ return executeArchiveCommand(parsed.options, io);
299
+ }
258
300
  if (parsed.kind === 'context') {
259
301
  const { executeContextCommand } = await import('./context-run.js');
260
302
  return executeContextCommand(parsed.options, io);
@@ -1,9 +1,18 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { dirname, join, resolve } from 'node:path';
3
+ import { quotePathArg, serviceInvocation, VERSION } from '../core/meta.js';
3
4
  import { defaultArchiveName, packProject } from '../core/pack.js';
4
5
  import { resolveDesktopDirectory } from './desktop.js';
5
6
  import { homedir } from 'node:os';
6
7
  import { EXIT_FAILED, EXIT_OK } from './io.js';
8
+ /** `--out dist/` или `--out dist\` — папка: архив ложится в неё под именем по умолчанию, папка создаётся. */
9
+ function outPath(out, root, tag) {
10
+ if (!/[\\/]$/.test(out))
11
+ return resolve(out);
12
+ return join(resolve(out.replace(/[\\/]+$/, '') || out), defaultArchiveName(root, tag));
13
+ }
14
+ /** Строка подсветки: путь, что найдено и где. */
15
+ const highlightLine = (item) => `${item.path} — ${item.reason}${item.line === undefined ? '' : ` (строка ${item.line})`}`;
7
16
  /** Архив по умолчанию кладётся на Рабочий стол: его оттуда отправляют заказчику. Нет Рабочего стола — рядом с проектом. */
8
17
  async function defaultOut(root, tag) {
9
18
  const name = defaultArchiveName(root, tag);
@@ -18,8 +27,8 @@ async function defaultOut(root, tag) {
18
27
  return join(dirname(resolve(root)), name);
19
28
  }
20
29
  export async function executePackCommand(options, io) {
21
- const out = options.out === undefined ? await defaultOut(options.path, options.tag) : resolve(options.out);
22
- const result = await packProject({ root: options.path, tag: options.tag, out, allow: options.allow ?? [] });
30
+ const out = options.out === undefined ? await defaultOut(options.path, options.tag) : outPath(options.out, options.path, options.tag);
31
+ const result = await packProject({ root: options.path, tag: options.tag, out, allow: options.allow ?? [], dryRun: options.dryRun === true });
23
32
  if (options.json) {
24
33
  io.out(JSON.stringify({ reportVersion: 1, ...result }, null, 2));
25
34
  return result.ok ? EXIT_OK : EXIT_FAILED;
@@ -30,11 +39,41 @@ export async function executePackCommand(options, io) {
30
39
  io.err(`- ${item.code}${item.path ? ` (${item.path})` : ''}: ${item.message}`);
31
40
  return EXIT_FAILED;
32
41
  }
42
+ const highlights = result.highlights ?? [];
43
+ if (result.dryRun === true) {
44
+ const marks = new Map();
45
+ for (const item of highlights)
46
+ marks.set(item.path, [...(marks.get(item.path) ?? []), `${item.reason}${item.line === undefined ? '' : ` (строка ${item.line})`}`]);
47
+ io.out(result.untagged === true
48
+ ? `Метки ${result.tag} ещё нет: показан состав последнего коммита (${(result.commit ?? '').slice(0, 7)}), ничего не записано; файлов — ${result.files}. Метку ставят на этот коммит — архив будет таким же; незакоммиченное в архив не попадёт.`
49
+ : `Состав архива тега ${result.tag} (ничего не записано): файлов — ${result.files}.`);
50
+ for (const path of result.entries ?? [])
51
+ io.out(` ${path}${marks.has(path) ? ` ← ${(marks.get(path) ?? []).join('; ')}` : ''}`);
52
+ for (const note of result.notes ?? [])
53
+ io.out(note);
54
+ const toCheck = highlights.filter((item) => !item.reason.includes('оставьте')).length;
55
+ io.out(toCheck === 0
56
+ ? `Убирать нечего${highlights.length > 0 ? ': подсвечены только файлы с пометкой «оставьте»' : ''}.`
57
+ : `Подсвечено к проверке — ${toCheck}: внутреннее уберите до упаковки (правка, коммит${result.untagged === true ? '' : ', новый тег'}); помеченное «оставьте» не трогайте. Подсветка — предупреждение, упаковку она не запрещает.`);
58
+ io.out(result.noAccess === true
59
+ ? 'HANDOVER.md: доступов не было — в паспорте все разделы о доступах «не применимо», менять заказчику нечего.'
60
+ : 'HANDOVER.md: первым делом заказчик меняет все пароли и ключи — в разделах паспорта о доступах есть записи. «Доступов не было» пишется, только если в каждом из них ровно «не применимо», без пояснений.');
61
+ const packCommand = `${serviceInvocation(VERSION)} pack --path ${quotePathArg(options.path)} --tag ${options.tag}${options.out === undefined ? '' : ` --out ${quotePathArg(options.out)}`}`;
62
+ io.out(result.untagged === true
63
+ ? `Дальше: имя метки ${options.tag} — в паспорт, коммит; метка (git tag -a ${options.tag}) — после «да» человека; затем упаковать: ${packCommand} — тоже после «да».`
64
+ : `Упаковать: ${packCommand} — только после «да» человека.`);
65
+ return EXIT_OK;
66
+ }
33
67
  io.out(result.reused === true
34
68
  ? `Архив тега ${result.tag} уже лежит здесь и совпадает побайтово: ${result.archive}`
35
69
  : `Архив тега ${result.tag} готов: ${result.archive}`);
36
70
  io.out(`Файлов: ${result.files}, размер: ${result.bytes} байт, sha256: ${result.sha256}`);
37
- io.out('Не вошли: wiki/, maestro/, .claude/, protocols/, .maestro/, CLAUDE.md, AGENTS.md, .mcp.json. В корне архива — HANDOVER.md: первым делом заказчик меняет все пароли и ключи.');
71
+ io.out(`Не вошли: wiki/, maestro/, .claude/, protocols/, .maestro/, CLAUDE.md, AGENTS.md, .mcp.json. В корне архива — HANDOVER.md: ${result.noAccess === true ? 'доступов не было, менять заказчику нечего' : 'первым делом заказчик меняет все пароли и ключи'}.`);
72
+ if (highlights.length > 0) {
73
+ io.out(`Подсвечено — проверьте перед отправкой (предупреждение, не отказ):`);
74
+ for (const item of highlights)
75
+ io.out(` ${highlightLine(item)}`);
76
+ }
38
77
  for (const note of result.notes ?? [])
39
78
  io.out(note);
40
79
  if ((options.allow ?? []).length > 0)
@@ -1,6 +1,19 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
1
3
  import { quotePathArg, serviceInvocation, VERSION } from '../core/meta.js';
2
- import { upgradeProject } from '../core/upgrade/index.js';
4
+ import { formatHunk } from '../core/text-diff.js';
5
+ import { upgradeDiffs, upgradeProject } from '../core/upgrade/index.js';
3
6
  import { EXIT_FAILED, EXIT_OK } from './io.js';
7
+ /** Сколько строк добавится и уберётся: «строк: +12 -5». */
8
+ function lineCounts({ added, removed }) {
9
+ const parts = [...(added > 0 ? [`+${added}`] : []), ...(removed > 0 ? [`-${removed}`] : [])];
10
+ return parts.length === 0 ? '' : ` (строк: ${parts.join(' ')})`;
11
+ }
12
+ const DIFF_TITLES = {
13
+ create: 'Будет добавлено',
14
+ update: 'Будет обновлено',
15
+ remove: 'Будет удалено',
16
+ };
4
17
  /**
5
18
  * Без `--apply` команда только показывает предложение: это dry-run по умолчанию,
6
19
  * а запись требует отдельного человеческого намерения.
@@ -42,6 +55,8 @@ export async function executeUpgradeCommand(options, io) {
42
55
  io.out(`Обновление применено: ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion}.`);
43
56
  list('Добавлено', result.createdFiles);
44
57
  list('Обновлено', result.updatedFiles);
58
+ // Без Git удалённый текст остаётся только в пакете Maestro прошлой версии.
59
+ list(`Удалено (файлы Maestro, которых больше нет в составе; прежний текст — ${existsSync(join(analysis.root, '.git')) ? 'в истории Git' : 'в пакете Maestro прошлой версии'})`, result.removedFiles);
45
60
  list('Передано проекту (дальше файл ваш, Maestro его не проверяет и не перезаписывает)', analysis.handedOver);
46
61
  const keptAsIs = analysis.handedOver.filter((path) => !result.updatedFiles.includes(path));
47
62
  if (keptAsIs.length > 0)
@@ -50,21 +65,45 @@ export async function executeUpgradeCommand(options, io) {
50
65
  for (const note of analysis.notes)
51
66
  io.out(`Важно: ${note}`);
52
67
  // До коммита doctor честно покажет git-managed-dirty: сначала diff и коммит, потом проверка.
53
- io.out('Добавьте в Git все изменения, включая новые файлы (git add -A), просмотрите их (git diff --cached) и закоммитьте: до коммита doctor покажет git-managed-dirty и git-managed-untracked.');
68
+ io.out('Добавьте в Git все изменения, включая новые и удалённые файлы (git add -A), просмотрите их (git diff --cached) и закоммитьте: до коммита doctor покажет git-managed-dirty и git-managed-untracked.');
54
69
  // Та же версия, что применила обновление: doctor проверяет ровно её канон.
55
70
  io.out(`Затем проверьте: ${serviceInvocation(VERSION)} doctor --path ${quotePathArg(options.path)} --strict`);
56
71
  return EXIT_OK;
57
72
  }
73
+ const diffs = await upgradeDiffs(result.plan);
74
+ const counted = new Map(diffs.map((item) => [item.path, lineCounts(item.diff)]));
75
+ const apply = `Применить: ${serviceInvocation(VERSION)} upgrade --path ${quotePathArg(options.path)} --apply`;
76
+ if (options.diff === true) {
77
+ io.out(`Предложение обновления ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion} (ни один байт не записан). Правки построчно: «+» — строка добавится, «-» — уберётся.`);
78
+ for (const item of diffs) {
79
+ io.out('');
80
+ io.out(`=== ${DIFF_TITLES[item.action]}: ${item.path}${counted.get(item.path) ?? ''}`);
81
+ for (const hunk of item.diff.hunks)
82
+ for (const line of formatHunk(hunk))
83
+ io.out(line);
84
+ }
85
+ io.out('');
86
+ list('Перейдёт к проекту (дальше файл ваш, Maestro его не проверяет и не перезаписывает)', analysis.handedOver);
87
+ list('Служебные файлы (пересчитываются)', analysis.metadata);
88
+ for (const note of analysis.notes)
89
+ io.out(`Важно: ${note}`);
90
+ io.out(apply);
91
+ return EXIT_OK;
92
+ }
58
93
  io.out(`Предложение обновления ${analysis.fromVersion ?? analysis.baselineId} → ${analysis.toVersion} (ни один байт не записан).`);
59
- list('Будет добавлено', analysis.creates.map((item) => item.path));
60
- list('Будет обновлено', analysis.updates.map((item) => item.appends === undefined ? item.path : `${item.path} — допишет строки: ${item.appends.join(', ')}`));
94
+ list('Будет добавлено', analysis.creates.map((item) => `${item.path}${counted.get(item.path) ?? ''}`));
95
+ list('Будет обновлено', analysis.updates.map((item) => item.appends === undefined
96
+ ? `${item.path}${counted.get(item.path) ?? ''}`
97
+ : `${item.path} — допишет строки: ${item.appends.join(', ')}`));
98
+ list('Будет удалено (файлы Maestro без ваших правок, которых больше нет в составе)', analysis.removes.map((path) => `${path}${counted.get(path) ?? ''}`));
61
99
  list('Перейдёт к проекту (дальше файл ваш, Maestro его не проверяет и не перезаписывает)', analysis.handedOver);
62
100
  list('Уже совпадает', analysis.unchanged);
63
101
  list('Останется без изменений', analysis.preserves);
64
102
  list('Служебные файлы', analysis.metadata);
65
103
  for (const note of analysis.notes)
66
104
  io.out(`Важно: ${note}`);
105
+ io.out(`Сами правки построчно: ${serviceInvocation(VERSION)} upgrade --path ${quotePathArg(options.path)} --diff (полный показ — сотни строк). Их читает агент и пересказывает человеку простыми словами, что изменится для него.`);
67
106
  // Применять обязана та же версия, что показала это предложение, а не новая @latest.
68
- io.out(`Применить: ${serviceInvocation(VERSION)} upgrade --path ${quotePathArg(options.path)} --apply`);
107
+ io.out(apply);
69
108
  return EXIT_OK;
70
109
  }