Skip to content

Commit 09c9682

Browse files
committed
meh
1 parent 089f730 commit 09c9682

File tree

2 files changed

+49
-17
lines changed

2 files changed

+49
-17
lines changed

docs/tools/chorale/plan.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ chorale plan [<vendor/name>] [options]
2121

2222
## Options
2323

24-
- `--concise`: One‑line summaries only; omit detailed blocks
25-
- `--show-all`: Include no‑op summaries for debugging decisions
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)
2630
- `--json`: Output as JSON; ideal for `apply` or external tooling
2731
- `--project-root=PATH`: Explicit project root (defaults to current directory)
2832
- `--paths=DIR ...`: Limit discovery to specific package path(s)
@@ -33,23 +37,26 @@ chorale plan [<vendor/name>] [options]
3337
## Examples
3438

3539
```bash
36-
# All packages, detailed output
40+
# Concise one‑liners (default)
3741
chorale plan
3842

39-
# Concise one‑liners
40-
chorale plan --concise
43+
# Detailed output
44+
chorale plan -v
4145

42-
# Show no‑ops too
43-
chorale plan --show-all
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
4451

4552
# JSON output for apply
4653
chorale plan --json > plan.json
4754

4855
# Focus on one package by composer name
4956
chorale plan sonsofphp/cache
5057

51-
# Focused + concise
52-
chorale plan sonsofphp/cache --concise
58+
# Focused + detailed
59+
chorale plan sonsofphp/cache -v
5360

5461
# Limit discovery to a folder (path)
5562
chorale plan --paths src/SonsOfPHP/Component/Cache

tools/chorale/src/Console/PlanCommand.php

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ protected function configure(): void
5252
on a single package. Useful to inspect exact diffs in large monorepos.
5353
5454
Common options
55-
- --concise: One-line summaries only (suppresses detailed blocks).
56-
- --show-all: Include no-op summaries for debugging plan decisions.
55+
- Verbosity controls detail:
56+
- default: concise one-line summaries
57+
- -v: detailed blocks
58+
- -vv: detailed + include no-op summaries
59+
- -vvv: everything above plus full JSON plan at end
60+
- --show-all: Include no-op summaries (same as -vv or higher).
5761
- --json: Output as JSON for apply or tooling (includes delta metadata).
5862
- --project-root=PATH: Project root (defaults to current directory).
5963
- --paths=DIR ...: Limit discovery to specific package paths (directories).
@@ -64,11 +68,11 @@ protected function configure(): void
6468
6569
Examples
6670
chorale plan
67-
chorale plan --concise
68-
chorale plan --show-all
71+
chorale plan -v
72+
chorale plan -vv
6973
chorale plan --json > plan.json
7074
chorale plan sonsofphp/cache
71-
chorale plan sonsofphp/cache --concise
75+
chorale plan sonsofphp/cache -v
7276
chorale plan --paths src/SonsOfPHP/Component/Cache
7377
7478
Notes
@@ -81,7 +85,8 @@ protected function configure(): void
8185
->addOption('project-root', null, InputOption::VALUE_REQUIRED, 'Project root (default: CWD).')
8286
->addOption('paths', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Limit to specific package paths', [])
8387
->addOption('json', null, InputOption::VALUE_NONE, 'Output as JSON instead of human-readable.')
84-
->addOption('concise', null, InputOption::VALUE_NONE, 'One-line summaries only; omit detailed blocks.')
88+
// --concise retained for compatibility; default output is concise
89+
->addOption('concise', null, InputOption::VALUE_NONE, 'Force one-line summaries only; omit detailed blocks.')
8590
->addOption('show-all', null, InputOption::VALUE_NONE, 'Show no-op summaries (does not turn them into steps).')
8691
->addOption('force-split', null, InputOption::VALUE_NONE, 'Force split steps even if unchanged.')
8792
->addOption('verify-remote', null, InputOption::VALUE_NONE, 'Verify remote state if lockfile is missing/stale.')
@@ -96,8 +101,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
96101
/** @var list<string> $paths */
97102
$paths = (array) $input->getOption('paths');
98103
$json = (bool) $input->getOption('json');
99-
$concise = (bool) $input->getOption('concise');
100-
$showAll = (bool) $input->getOption('show-all');
104+
$verbosity = $output->getVerbosity();
105+
$explicitConcise = (bool) $input->getOption('concise');
106+
// Concise by default; -v or higher switches to detailed unless --concise is given
107+
$concise = $explicitConcise || ($verbosity <= OutputInterface::VERBOSITY_NORMAL);
108+
// Show no-op summaries at -vv or when explicitly requested
109+
$showAll = (bool) $input->getOption('show-all') || ($verbosity >= OutputInterface::VERBOSITY_VERY_VERBOSE);
101110
$force = (bool) $input->getOption('force-split');
102111
$verify = (bool) $input->getOption('verify-remote');
103112
$strict = (bool) $input->getOption('strict');
@@ -139,6 +148,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int
139148
}
140149

141150
$this->renderHuman($io, $steps, $showAll ? $noop : [], $concise);
151+
152+
// At -vvv print the full JSON payload after human output
153+
if ($verbosity >= OutputInterface::VERBOSITY_DEBUG) {
154+
$io->newLine();
155+
$io->section('Full JSON plan');
156+
$payload = [
157+
'version' => 1,
158+
'steps' => array_map(static fn(PlanStepInterface $s): array => $s->toArray(), $steps),
159+
'noop' => $showAll ? $noop : [],
160+
];
161+
$encoded = json_encode($payload, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
162+
if ($encoded !== false) {
163+
$output->writeln($encoded);
164+
}
165+
}
166+
142167
return (int) ($result['exit_code'] ?? 0);
143168
}
144169

0 commit comments

Comments
 (0)