Skip to content

Share --session/--file flags via @OptionGroup; drop dead PreviewHost.Mode#114

Merged
obj-p merged 1 commit intocli-mcp-parityfrom
session-options-and-mode-cleanup
Apr 15, 2026
Merged

Share --session/--file flags via @OptionGroup; drop dead PreviewHost.Mode#114
obj-p merged 1 commit intocli-mcp-parityfrom
session-options-and-mode-cleanup

Conversation

@obj-p
Copy link
Copy Markdown
Owner

@obj-p obj-p commented Apr 15, 2026

Summary

Two cleanups deferred on PR #113.

SessionTargetingOptions

  • Shared @OptionGroup with --session <uuid> and --file <path>.
  • Adopted by configure, switch, elements, touch, stop — 5 commands whose session-resolution flags were literally duplicated with identical help text.
  • Variants and Snapshot keep their positional file argument (doubles as source-for-ephemeral-session) plus their own --session Option; the OptionGroup's --file Option would collide with the positional.

PreviewHost.Mode cleanup

  • .interactive and .snapshot became unreachable after the variants migration in Migrate variants to daemon client #109; only .serve was ever constructed.
  • Delete the Mode enum entirely. PreviewHost is now a zero-argument init.
  • headless collapses to a constant true; keepAliveWithoutWindows collapses into applicationShouldTerminateAfterLastWindowClosed returning false unconditionally.
  • Updated the one remaining test call site.

Test plan

  • swift build
  • swift test --filter 'ElementsCommandTests|SwitchCommandTests|ConfigureCommandTests|TouchCommandTests|StopCommandTests|PreviewHostTests' — 28 tests all green.

🤖 Generated with Claude Code

…Mode

Two cleanups to the CLI/MCP-parity refactor work that were deferred
on the main PR.

SessionTargetingOptions:
- Introduce a shared @OptionGroup with --session <uuid> and
  --file <path>. Adopted by configure, switch, elements, touch, and
  stop — 5 commands whose session-resolution flags were literally
  duplicated with identical help text.
- VariantsCommand and SnapshotCommand keep their positional `file`
  argument (it doubles as source-for-ephemeral-session) and their
  own --session Option, since the @OptionGroup's --file Option
  would collide with the positional.

PreviewHost.Mode cleanup:
- `.interactive` and `.snapshot` became unreachable after the
  variants migration in #109; only `.serve` was ever constructed.
- Delete the Mode enum entirely. PreviewHost is now a zero-argument
  init. `headless` is a constant true; `keepAliveWithoutWindows`
  collapses into `applicationShouldTerminateAfterLastWindowClosed`
  returning false unconditionally.
- Updated the one remaining test call site to use `PreviewHost()`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@obj-p obj-p merged commit f73544d into cli-mcp-parity Apr 15, 2026
@obj-p obj-p deleted the session-options-and-mode-cleanup branch April 15, 2026 22:53
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.

1 participant