From 86ec09511760ecad15db369695c723b617f6aa83 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 17:23:18 +0000 Subject: [PATCH 1/2] test(cli): pin that os doctor makes no --verbose promise for fix-less warnings Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude --- .../doctor-deprecation-hint-commands.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/cli/src/commands/doctor-deprecation-hint-commands.test.ts b/packages/cli/src/commands/doctor-deprecation-hint-commands.test.ts index 6b947d6671c..b361b1c6774 100644 --- a/packages/cli/src/commands/doctor-deprecation-hint-commands.test.ts +++ b/packages/cli/src/commands/doctor-deprecation-hint-commands.test.ts @@ -369,5 +369,20 @@ describe('os doctor --scan-deprecations, end to end', () => { // What the advice pointed at is printed: the → replacement per finding. expect(run.out).toContain('Use maxLength (camelCase)'); }, E2E_TIMEOUT); + + // The advice is a promise that `--verbose` prints a fix the plain run hid. + // A missing `*.test.ts` beside a `*.zod.ts` warns with no fix line in + // either mode, so when it is the only warning the promise has nothing + // behind it and the summary must not make it. + it('makes no such advice when the only warnings carry no fix to reveal', async () => { + const specSrc = path.join(tmp, 'packages', 'spec', 'src'); + fs.mkdirSync(specSrc, { recursive: true }); + fs.writeFileSync(path.join(specSrc, 'a.zod.ts'), 'export const a = 1;\n', 'utf8'); + + const run = await runDoctor([]); + + expect(run.out).toContain('Missing test: a.test.ts (for a.zod.ts)'); + expect(summaryTail(run.out)).not.toContain('--verbose'); + }, E2E_TIMEOUT); }); }); From 1dc43d70779ec36f278d0847cda991e09f7b1ef0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 17:36:57 +0000 Subject: [PATCH 2/2] fix(cli): os doctor advises --verbose only when a warning has a fix for it to show Claude-Session: https://claude.ai/code/session_01L6bhgTyMahdAdhXSzgy2nt Co-authored-by: Claude --- .../35454-doctor-verbose-hint-fixless.md | 10 +++++++++ packages/cli/src/commands/doctor.ts | 22 ++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 .changeset/35454-doctor-verbose-hint-fixless.md diff --git a/.changeset/35454-doctor-verbose-hint-fixless.md b/.changeset/35454-doctor-verbose-hint-fixless.md new file mode 100644 index 00000000000..2c99264aa43 --- /dev/null +++ b/.changeset/35454-doctor-verbose-hint-fixless.md @@ -0,0 +1,10 @@ +--- +'@objectstack/cli': patch +--- + +fix(cli): `os doctor` no longer advises `--verbose` when no warning has a fix for it to show + +Clause-②: no +Metadata-protocol: none + +When `os doctor` finished with warnings it closed with "Run with --verbose to see fix suggestions." whenever any warning fired. Several warnings have no fix suggestion in either mode (a missing `*.test.ts` beside a `*.zod.ts`, `@deprecated` usages, circular dependencies, unused objects, orphan views), so for those the re-run printed nothing new. The line is now printed only when at least one warning that fired carries a fix that `--verbose` would reveal. The warnings themselves, and exit codes, are unchanged. diff --git a/packages/cli/src/commands/doctor.ts b/packages/cli/src/commands/doctor.ts index 5b130dc6f94..975d2c65dae 100644 --- a/packages/cli/src/commands/doctor.ts +++ b/packages/cli/src/commands/doctor.ts @@ -2442,6 +2442,13 @@ export default class Doctor extends Command { // Display environment results let hasErrors = false; let hasWarnings = false; + // Whether some warning that fired carries a fix that only `--verbose` + // prints. The summary's re-run advice promises exactly that, so it follows + // this, not `hasWarnings`: a bare `printWarning` (missing tests, + // `@deprecated` usages, circular dependencies, unused objects, orphan + // views) has no fix in either mode, and a fix printed unasked (the + // protocol-gap hint, the unique-scope prescription) is already on screen. + let hasVerboseOnlyFix = false; console.log(''); results.forEach((result) => { @@ -2451,7 +2458,10 @@ export default class Doctor extends Command { renderHealthCheckResult(result, flags.verbose); if (result.status === 'error') hasErrors = true; - if (result.status === 'warning') hasWarnings = true; + if (result.status === 'warning') { + hasWarnings = true; + if (result.fix) hasVerboseOnlyFix = true; + } }); // ── Extended Checks ────────────────────────────────────────────── @@ -2641,6 +2651,7 @@ export default class Doctor extends Command { printError(`${f.where}: ${f.message}`); } else { hasWarnings = true; + if (f.hint) hasVerboseOnlyFix = true; printWarning(`${f.where}: ${f.message}`); } if (flags.verbose) { @@ -2677,6 +2688,7 @@ export default class Doctor extends Command { // above a warning. Inert today: that list filters on `error`. results.push(finding); hasWarnings = true; + if (finding.fix) hasVerboseOnlyFix = true; } } @@ -2687,6 +2699,7 @@ export default class Doctor extends Command { const deprecations = scanDeprecatedPatterns(scanDir); if (deprecations.length > 0) { hasWarnings = true; + hasVerboseOnlyFix = true; for (const dep of deprecations) { printWarning(`${dep.file}:${dep.line} — ${dep.description}`); if (flags.verbose) { @@ -2743,8 +2756,11 @@ export default class Doctor extends Command { console.log(chalk.yellow('⚠️ Environment is functional but has some warnings.')); // Only when the flag is off: under `--verbose` the fix suggestions this // line points at are already printed above, so advising the operator to - // pass the flag they just passed sends them to re-run for nothing. - if (!flags.verbose) { + // pass the flag they just passed sends them to re-run for nothing. And + // only when there is such a suggestion: a re-run whose warnings carry no + // hidden fix prints nothing more, so the advice would send them for + // nothing just the same. + if (!flags.verbose && hasVerboseOnlyFix) { console.log(chalk.dim(' Run with --verbose to see fix suggestions.')); } } else {