ReviewOS

also looking at this

stacks/buddy

fix(cli): let packages.strategy reach its flags, and sync CLAUDE.md's embedded README

#1441
Merged glennmichael123 wants to merge fix/strategy-flag-default into main
4 files +182 -64

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

bin/cli.tsmodified+4-4
Changes to bin/cli.ts
@@ -657,7 +657,7 @@ cli
657657 .option('--verbose, -v', 'Enable verbose logging')
658658 .option('--packages <names>', 'Comma-separated list of packages to check')
659659 .option('--pattern <pattern>', 'Glob pattern to match packages')
660 .option('--strategy <type>', 'Update strategy: major|minor|patch|all', { default: 'all' })
660 .option('--strategy <type>', 'Update strategy: major|minor|patch|all (default: packages.strategy from config, else all)')
661661 .option('--ignore <names>', 'Comma-separated list of packages to ignore')
662662 .option('--respect-latest', 'Respect "latest", "*", and other dynamic version indicators (default: true)')
663663 .option('--no-respect-latest', 'Allow updating "latest", "*", and other dynamic version indicators')
@@ -847,7 +847,7 @@ cli
847847cli
848848 .command('update', 'Update dependencies and create PRs')
849849 .option('--verbose, -v', 'Enable verbose logging')
850 .option('--strategy <type>', 'Update strategy: major|minor|patch|all', { default: 'all' })
850 .option('--strategy <type>', 'Update strategy: major|minor|patch|all (default: packages.strategy from config, else all)')
851851 .option('--ignore <names>', 'Comma-separated list of packages to ignore')
852852 .option('--dry-run', 'Preview changes without making them')
853853 .option('--reviewers <names>', 'Comma-separated reviewers to assign (overrides pullRequest.reviewers)')
@@ -1766,7 +1766,7 @@ cli
17661766cli
17671767 .command('check <packages...>', 'Check specific packages for updates')
17681768 .option('--verbose, -v', 'Enable verbose logging')
1769 .option('--strategy <type>', 'Update strategy: major|minor|patch|all', { default: 'all' })
1769 .option('--strategy <type>', 'Update strategy: major|minor|patch|all (default: packages.strategy from config, else all)')
17701770 .example('buddy check react typescript')
17711771 .example('buddy check react --verbose')
17721772 .action(async (...args: any[]) => {
@@ -1816,7 +1816,7 @@ cli
18161816cli
18171817 .command('schedule', 'Run automated dependency updates on schedule')
18181818 .option('--verbose, -v', 'Enable verbose logging')
1819 .option('--strategy <type>', 'Update strategy: major|minor|patch|all', { default: 'all' })
1819 .option('--strategy <type>', 'Update strategy: major|minor|patch|all (default: packages.strategy from config, else all)')
18201820 .example('buddy schedule')
18211821 .example('buddy schedule --verbose')
18221822 .example('buddy schedule --strategy patch')
docs/cli/update.mdmodified+2-2
Changes to docs/cli/update.md
@@ -17,7 +17,7 @@ buddy scan [options]
1717- `--verbose, -v` - Enable verbose logging
1818- `--packages <names>` - Comma-separated list of packages to check
1919- `--pattern <pattern>` - Glob pattern to match packages
20- `--strategy <type>` - Update strategy: major|minor|patch|all (default: all)
20- `--strategy <type>` - Update strategy: major|minor|patch|all (default: `packages.strategy` from config, else all)
2121- `--ignore <names>` - Comma-separated list of packages to ignore
2222- `--respect-latest` - Leave `latest`, `*` and other dynamic ranges alone (default)
2323- `--no-respect-latest` - Propose updates for dynamic ranges too
@@ -75,7 +75,7 @@ buddy update [options]
7575### Options
7676
7777- `--verbose, -v` - Enable verbose logging
78- `--strategy <type>` - Update strategy: major|minor|patch|all (default: all)
78- `--strategy <type>` - Update strategy: major|minor|patch|all (default: `packages.strategy` from config, else all)
7979- `--ignore <names>` - Comma-separated list of packages to ignore
8080- `--dry-run` - Preview changes without making them
8181- `--reviewers <names>` - Comma-separated reviewers to assign, overriding `pullRequest.reviewers`
test/cli-surface.test.tsmodified+12-0
Changes to test/cli-surface.test.ts
@@ -93,6 +93,18 @@ describe('CLI surface', () => {
9393 }
9494 }, 30000)
9595
96 it('success case - the strategy flag no longer shadows the config', async () => {
97 // `--strategy` carried `{ default: 'all' }`, so the option was always
98 // "set" and the handler's `options.strategy ?? config.packages?.strategy`
99 // chain never reached the config — packages.strategy was dead on the
100 // scan/update/check/schedule paths unless a flag was typed.
101 const { code, output } = await run(['update', '--help'])
102
103 expect(code).toBe(0)
104 expect(output).toContain('packages.strategy from config')
105 expect(output).not.toContain('(default: all)')
106 }, 30000)
107
96108 it('failure case - an unknown flag is rejected rather than ignored', async () => {
97109 // clapp hard-errors on unknown options, which is why a documented-but-
98110 // unimplemented flag crashed rather than degrading.