Skip to content

feat: add run workspace option#71

Merged
shreyas-lyzr merged 1 commit intoopen-gitagent:mainfrom
haosenwang1018:feat/run-workspace
May 4, 2026
Merged

feat: add run workspace option#71
shreyas-lyzr merged 1 commit intoopen-gitagent:mainfrom
haosenwang1018:feat/run-workspace

Conversation

@haosenwang1018
Copy link
Copy Markdown

What

Adds gitagent run --workspace <dir> so an agent definition can live separately from the repository or directory it operates on.

Why

Refs #58.

The main use case is running a reusable agent definition, such as a reviewer or autoresearch agent, against a separate target repo without making the agent operate on its own agent.yaml, SOUL.md, and skills directory.

How

  • Adds -w, --workspace <dir> to gitagent run.
  • Passes the workspace through the normal run path and the -a git delegated path.
  • Applies the resolved workspace as the spawned process cwd for direct process runners: Claude, OpenAI, CrewAI, Nanobot, and OpenClaw.
  • Documents the behavior and notes that temp-workspace adapters (opencode, gemini, gitclaw) keep using their prepared workspace to avoid overwriting target repo files like AGENTS.md, GEMINI.md, or agent.yaml.

How Tested

  • npm run build passes
  • npm test passes
  • git diff --check passes
  • node dist/index.js run --help shows --workspace

Checklist

  • My code follows the existing style of this project
  • I have added/updated tests (if applicable)
  • I have updated documentation (if applicable)
  • I have read the CONTRIBUTING.md

@shreyas-lyzr
Copy link
Copy Markdown
Contributor

shreyas-lyzr commented May 4, 2026

Apologies for the slow review — and honestly, this is one of the cleanest PRs we've had. Thank you.

Review:

  • All 11 runners are updated consistently — each gets a workspace?: string field added to its options interface, and cwd (or equivalent) is set to resolve(options.workspace ?? agentDir). Single, predictable pattern.
  • The --workspace option is correctly threaded from run.ts through every dispatch site.
  • Documentation in README.md and docs.md is accurate about which adapters honor workspace directly (claude, openai, crewai, openclaw, nanobot) versus which generate an isolated workspace and shouldn't (opencode, gemini, gitclaw). That distinction is exactly right and is the part I would have asked about if it weren't already documented.
  • New runWithCrewAI and runWithOpenAI interfaces (CrewAIRunOptions, the existing OpenAIRunOptions) are non-breaking additions — the option arg has a default = {}.
  • No tests touched, but the change is mechanical enough that I'm comfortable with that.

Tiny nits (non-blocking):

  1. docs.md paragraph about --workspace could note that git (the auto-detect runner) inherits whatever the resolved adapter does — minor, the reader will figure it out.
  2. Consider a short paragraph in RUN.md or wherever the spec describes runner contracts that an adapter MUST honor workspace if present, OR document why it deliberately doesn't (the case for opencode/gemini/gitclaw). Not blocking.

Approving and merging. Genuine thanks for both the design and the patience.

@shreyas-lyzr
Copy link
Copy Markdown
Contributor

Merged. Thank you — --workspace was one of the most-asked-for ergonomics gaps and you closed it cleanly across all 11 runners. Appreciated.

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