Skip to content

Commit 15fa0be

Browse files
committed
docs
1 parent 930d1b2 commit 15fa0be

2 files changed

Lines changed: 124 additions & 121 deletions

File tree

Lines changed: 124 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,127 @@
1-
# Plan Command
1+
# Chorale Plan Command
22

3-
For the full Plan command reference, see the dedicated page:
3+
The `plan` command is an advanced dry‑run that inspects your monorepo and prints exactly what would change — without writing anything. Use it to understand and validate changes before applying them.
44

5-
- Plan reference: ../plan.md
5+
## Summary
66

7-
Key points:
8-
- Default output is concise; increase detail with `-v`, `-vv`, `-vvv`.
9-
- Use `--json` to export a machine‑readable plan for `apply`.
7+
- Checks package versions against the monorepo root version
8+
- Computes package `composer.json` edits via the rule engine
9+
- Updates the root `composer.json` (require/replace) as an aggregator
10+
- Merges package dependencies into the root (with conflicts reported)
11+
- Decides which packages need a split (and why)
12+
13+
## Usage
14+
15+
```bash
16+
chorale plan [<vendor/name>] [options]
17+
```
18+
19+
- `<vendor/name>`: Optional composer package name to focus on a single package
20+
(e.g., `sonsofphp/cache`). This reduces noise for large monorepos.
21+
22+
## Options
23+
24+
- Verbosity levels control detail:
25+
- default: concise one‑line summaries
26+
- `-v`: detailed blocks (per‑section details)
27+
- `-vv`: detailed blocks + no‑op summaries
28+
- `-vvv`: everything above plus full JSON plan printed at the end
29+
- `--show-all`: Include no‑op summaries (same as `-vv` or higher)
30+
- `--json`: Output as JSON; ideal for `apply` or external tooling
31+
- `--project-root=PATH`: Explicit project root (defaults to current directory)
32+
- `--paths=DIR ...`: Limit discovery to specific package path(s)
33+
- `--force-split`: Plan split steps even if content appears unchanged
34+
- `--verify-remote`: Verify remote state if local lockfiles are missing/stale
35+
- `--strict`: Exit non‑zero when issues are detected (e.g., conflicts, missing root version)
36+
37+
## Examples
38+
39+
```bash
40+
# Concise one‑liners (default)
41+
chorale plan
42+
43+
# Detailed output
44+
chorale plan -v
45+
46+
# Detailed + show no‑ops
47+
chorale plan -vv
48+
49+
# Show full JSON at the end (also printed as human output first)
50+
chorale plan -vvv
51+
52+
# JSON output for apply
53+
chorale plan --json > plan.json
54+
55+
# Focus on one package by composer name
56+
chorale plan sonsofphp/cache
57+
58+
# Focused + detailed
59+
chorale plan sonsofphp/cache -v
60+
61+
# Limit discovery to a folder (path)
62+
chorale plan --paths src/SonsOfPHP/Component/Cache
63+
```
64+
65+
## Output Breakdown
66+
67+
Plan output is grouped by step type:
68+
69+
- `Split steps`: Shows package path → repo, splitter, branch, tag strategy, and reasons
70+
- `Package versions`: Shows the package name, target version, previous version, and reason
71+
- `Package metadata`: Lists keys to mirror and pretty‑prints the exact `apply` JSON block
72+
- `Root composer: aggregator`: Prints the final `require` and `replace` maps
73+
- `Root composer: dependency merge`: Prints merged `require` and `require‑dev`, plus conflicts
74+
- `Root composer: maintenance`: Maintenance actions like `validate`
75+
76+
### Delta Notation
77+
78+
Composer maps show a delta summary:
79+
80+
```
81+
[+added/-removed/~changed]
82+
```
83+
84+
This is printed inline in summaries and also included in JSON under `meta` as
85+
`delta_require`, `delta_replace`, and `delta_require_dev` where applicable.
86+
87+
## JSON Schema (version 1)
88+
89+
The `--json` output contains:
90+
91+
- `steps`: Array of step objects with type‑specific fields
92+
- `noop`: Optional summary of skipped groups when `--show-all` is used
93+
- `meta`: For root steps, delta objects summarizing changes
94+
95+
Example snippet (root update):
96+
97+
```json
98+
{
99+
"type": "composer-root-update",
100+
"root": "sonsofphp/monorepo",
101+
"root_version": "1.2.3",
102+
"require": {
103+
"sonsofphp/cache": "1.2.3"
104+
},
105+
"replace": {
106+
"sonsofphp/cache": "1.2.3"
107+
},
108+
"meta": {
109+
"delta_require": {
110+
"added": 1,
111+
"removed": 0,
112+
"changed": 0
113+
},
114+
"delta_replace": {
115+
"added": 1,
116+
"removed": 0,
117+
"changed": 0
118+
}
119+
}
120+
}
121+
```
122+
123+
## Tips
124+
125+
- Use `--concise` for quick scans, and omit it to see exact JSON diffs.
126+
- Combine the positional `<vendor/name>` with `--json` to isolate and export a single package’s plan.
127+
- For CI checks, run with `--strict` so the command exits non‑zero when action is required.

docs/tools/chorale/plan.md

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)