Skip to content

refactor: consolidate dry-run checks onto isDryRun() helper; fix init command banner#77

Merged
sroussey merged 2 commits intoclaude/add-cli-dry-run-LnTeNfrom
copilot/sub-pr-75
Mar 12, 2026
Merged

refactor: consolidate dry-run checks onto isDryRun() helper; fix init command banner#77
sroussey merged 2 commits intoclaude/add-cli-dry-run-LnTeNfrom
copilot/sub-pr-75

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

Three files duplicated the globalServiceRegistry.has(SEC_DRY_RUN) && globalServiceRegistry.get(SEC_DRY_RUN) pattern instead of using the existing isDryRun() helper. Additionally, the init command was skipped in the preAction hook, so SEC_DRY_RUN was never registered — causing runCommand's dry-run banner to be silently suppressed for init --dry-run.

Changes

  • BootstrapDownloadTask.ts, SecFetchFileOutputCache.ts, createStorage.ts — replace inline registry checks with isDryRun(); remove now-unused SEC_DRY_RUN token imports
  • init.ts — call globalServiceRegistry.registerInstance(SEC_DRY_RUN, dryRun) before runCommand so the banner renders and isDryRun() behaves correctly throughout the init action
// before (duplicated in 3 places)
if (globalServiceRegistry.has(SEC_DRY_RUN) && globalServiceRegistry.get(SEC_DRY_RUN)) {  }

// after
if (isDryRun()) {  }

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: sroussey <127349+sroussey@users.noreply.github.com>
Copilot AI changed the title [WIP] Add --dry-run flag to prevent write operations refactor: consolidate dry-run checks onto isDryRun() helper; fix init command banner Mar 12, 2026
@sroussey sroussey marked this pull request as ready for review March 12, 2026 04:34
@sroussey sroussey merged commit 940942a into claude/add-cli-dry-run-LnTeN Mar 12, 2026
sroussey added a commit that referenced this pull request Mar 12, 2026
* feat: wire up --dry-run flag to prevent all writes

When --dry-run is passed, the CLI now runs commands normally (fetches,
processing) but suppresses all write operations:

- Database writes: ReadOnlyTabularStorage wraps real storage, forwarding
  reads and no-oping puts/deletes/setupDatabase
- File downloads: BootstrapDownloadTask logs what it would download and
  exits early
- Cache writes: SecFetchFileOutputCache.saveOutput skips file writes
- Init command: shows what config/dirs would be created without writing

The SEC_DRY_RUN DI token is set in the preAction hook from the global
--dry-run option, and createStorage wraps repositories automatically.
runCommand prints a "Dry run" banner when active.

https://claude.ai/code/session_01G4XE6pxyLRhiM2wAepVTZj

* refactor: consolidate dry-run checks onto isDryRun() helper; fix init command banner (#77)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants