feat(hive): add extra_dirs support for passing additional directories to agents#13
Merged
feat(hive): add extra_dirs support for passing additional directories to agents#13
Conversation
… to agents Add a top-level `extra_dirs` config list and per-agent `extra_dirs_flag` field so `hive run` automatically injects directory arguments into the agent command. Relative paths resolve against the main repo root, ensuring correct behavior when running from worktrees. Supported flags: Claude/Copilot/Codex `--add-dir`, Gemini `--include-directories`. Cursor agent CLI has no multi-dir support. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for passing additional directories to AI coding agents via the extra_dirs configuration. The feature enables users to specify directories (e.g., shared libraries) that agents should include in their context, with relative paths automatically resolving against the main repository root to ensure consistent behavior when running from worktrees.
Changes:
- Added top-level
extra_dirsconfiguration field and per-agentextra_dirs_flagfield - Made
expand_pathfunction public for reuse and added.resolve()call for relative paths - Implemented
get_extra_dirs_argshelper to build CLI arguments with proper path resolution - Integrated extra_dirs injection into the
hive runcommand's dynamic runner
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/hive_cli/config/schema.py |
Added extra_dirs_flag field to AgentConfig and extra_dirs list to HiveConfig |
src/hive_cli/config/settings.py |
Added extra_dirs field to HiveSettings |
src/hive_cli/config/default.yml |
Set default extra_dirs_flag for each agent (Claude/Copilot/Codex: --add-dir, Gemini: --include-directories, Cursor: none) |
src/hive_cli/config/__init__.py |
Implemented get_extra_dirs_args helper function to build CLI arguments with resolved paths |
src/hive_cli/git/worktree.py |
Renamed _expand_path to expand_path (public), added .resolve() for relative paths |
src/hive_cli/git/__init__.py |
Exported expand_path function |
src/hive_cli/commands/run.py |
Integrated extra_dirs arguments into dynamic runner and initial command building |
tests/test_config.py |
Added comprehensive tests for extra_dirs config parsing and get_extra_dirs_args helper |
tests/test_worktree.py |
Added tests for expand_path function covering absolute, relative, tilde, and env var expansion |
tests/test_run.py |
Added integration tests for extra_dirs injection in hive run command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extra_dirsconfig list and per-agentextra_dirs_flagfield sohive runautomatically injects directory arguments into the agent command--add-dir, Gemini--include-directories; Cursor agent CLI has no multi-dir supportTest plan
extra_dirs,extra_dirs_flag)expand_pathresolution (absolute, relative, tilde, env vars)get_extra_dirs_argshelperhive runcommand injectionMade with Cursor