Skip to content

Add a dispatch new command to start a fresh session from the CLI#228

Open
jongio wants to merge 1 commit into
mainfrom
idea/new-session-cli
Open

Add a dispatch new command to start a fresh session from the CLI#228
jongio wants to merge 1 commit into
mainfrom
idea/new-session-cli

Conversation

@jongio

@jongio jongio commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a dispatch new [dir] subcommand that starts a brand-new Copilot session directly from the command line, without opening the TUI.

Today the only way to start a fresh session is to launch the TUI or invoke the Copilot CLI by hand. This adds a first-class command that mirrors the TUI's launch behavior for new sessions.

What it does

  • dispatch new starts a new session in the current directory
  • dispatch new <dir> starts a new session in the given directory
  • dispatch new --mode <mode> overrides the launch mode (inplace, tab, window, pane)

The session reuses the configured agent, model, custom command, terminal, and launch mode. It relies on the existing resume builders, which treat an empty session ID as a new session (no --resume flag).

Changes

  • New cmd/dispatch/new.go with runNew, parseNewArgs, resolveNewDir, and defaultNewLaunch. Reuses the launch helpers from open.go.
  • Wired the new case into handleArgs and added new to the bash, zsh, and PowerShell completion scripts and to usage output.
  • Directory validation: a missing path resolves to the working directory; a nonexistent path or a file gives a clear error.
  • Tests in cmd/dispatch/new_test.go cover arg parsing, directory resolution, and the launch seam.
  • README documents the command under Usage.

Testing

  • go build ./...
  • go test ./cmd/dispatch/... -count=1
  • go vet ./...
  • golangci-lint run ./cmd/dispatch/...

Closes #223

Add a 'dispatch new [dir]' subcommand that starts a brand-new Copilot
session directly from the command line, mirroring the TUI launch path.
It reuses the existing resume builders, which treat an empty session ID
as a new session, and honors the configured agent, model, and launch
mode. Supports an optional directory argument and a --mode override.

Wired into handleArgs, the three shell completion scripts, and usage
output. Documented in the README.

Closes #223

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 4, 2026
@jongio jongio self-assigned this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a dispatch new command to start a fresh session from the CLI

1 participant