Skip to content

refactor: consolidate command runtime and injected dependencies - #193

Merged
qwrobins merged 3 commits into
mainfrom
qwrobins/refactor-consolidate-shared-command-runtime-opti
Sep 5, 2026
Merged

qwrobins merged 3 commits into
mainfrom
qwrobins/refactor-consolidate-shared-command-runtime-opti

Conversation

@qwrobins

@qwrobins qwrobins commented Sep 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Consolidate common command/runtime options, context construction, and retry normalization.
  • Forward injected stdout/stderr across handlers and diagnostics, and use the injected transport for OAuth refresh as well as GraphQL.
  • Split issue commands by responsibility while retaining registry dispatch and existing public exports/contracts.
  • Add runtime documentation and regression coverage for injected streams, transport, profile precedence, and concurrent invocations.

Closes #183

Validation

  • bun run typecheck
  • bun run build
  • bun run test — 933 passed, 1 skipped
  • git diff --check

Greptile Summary

This PR consolidates command execution around a shared runtime context while preserving command contracts.

  • Centralizes profile resolution, retry normalization, GraphQL execution, injected transport, and output streams.
  • Splits issue handling into responsibility-focused modules while retaining registry dispatch and public exports.
  • Routes diagnostics, pagination, file-transfer output, and schema freshness warnings through injected streams.
  • Defines last-occurrence precedence for the --max and --limit aliases and documents the download commit boundary.
  • Adds regression coverage for injected dependencies, concurrent invocation isolation, pagination aliases, and file-transfer cancellation behavior.

Confidence Score: 5/5

The PR appears safe to merge, with no outstanding actionable defects identified in the changes since the previous review.

The pagination follow-up keeps each winning value paired with its alias metadata across option segments, and the file-transfer follow-up accurately documents the existing atomic commit behavior. No repository-rule violations or accepted new security findings remain.

Important Files Changed

Filename Overview
src/cli/main.ts Forwards injected runtime dependencies and normalizes pagination aliases according to argument order.
src/core/runtime/command-context.ts Provides the shared command lifecycle for profile resolution, transport, retries, and output.
src/commands/issue.ts Retains issue registry dispatch and public contracts while delegating implementation to focused modules.
src/core/io/file-transfer.ts Documents the non-cancellable atomic rename boundary without changing its established success semantics.
tests/cli/runtime.test.ts Covers injected runtime behavior and pagination-alias precedence across option positions.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI[CLI argument parsing] --> Registry[Command registry]
  Registry --> Options[Shared command options]
  Options --> Context[CommandContext]
  Context --> Profile[Profile resolution]
  Context --> Retry[Retry normalization]
  Context --> Transport[Injected transport]
  Context --> IO[Injected stdout and stderr]
  Context --> Handler[Curated or generated handler]
  Handler --> Output[Stable command output]
Loading

Reviews (3): Last reviewed commit: "address greptile review feedback (greplo..." | Re-trigger Greptile

@qwrobins

qwrobins commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

@greptile review

@qwrobins

qwrobins commented Sep 5, 2026

Copy link
Copy Markdown
Owner Author

Addressed the pagination-alias finding: aliases now normalize in token order before merging leading and command-position options, so the last --max/--limit wins. Regression tests cover both orders, both positions, equals syntax, repetitions, and validation diagnostics. Docs and bundled skills are updated.

For the summary's final-rename observation: the existing cancellation check immediately before rename is intentional. Node/filesystem rename has no cancellation API, and racing it against abort would allow a destination replacement after reporting failure. The atomic commit must report its actual result once dispatched. Added an explicit code/docs contract and a regression test proving cancellation during rename still reports the successful committed replacement. No unsafe rollback or misleading post-commit abort was introduced.

Validation after merging current main and these changes: typecheck/build pass; 933 tests passed, 1 skipped.

@qwrobins
qwrobins merged commit b46d546 into main Sep 5, 2026
5 checks passed
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.

refactor: consolidate shared command runtime options, I/O, and transport injection

1 participant