Skip to content

feat(hive): add extra_dirs support for passing additional directories to agents#13

Merged
igrybkov merged 1 commit intomainfrom
feat/hive-extra-dirs
Feb 25, 2026
Merged

feat(hive): add extra_dirs support for passing additional directories to agents#13
igrybkov merged 1 commit intomainfrom
feat/hive-extra-dirs

Conversation

@igrybkov
Copy link
Owner

Summary

  • 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

Test plan

  • Unit tests for config parsing (extra_dirs, extra_dirs_flag)
  • Unit tests for expand_path resolution (absolute, relative, tilde, env vars)
  • Unit tests for get_extra_dirs_args helper
  • Integration tests for hive run command injection
  • All 187 existing tests pass

Made with Cursor

… 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>
Copilot AI review requested due to automatic review settings February 25, 2026 22:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_dirs configuration field and per-agent extra_dirs_flag field
  • Made expand_path function public for reuse and added .resolve() call for relative paths
  • Implemented get_extra_dirs_args helper to build CLI arguments with proper path resolution
  • Integrated extra_dirs injection into the hive run command'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.

@igrybkov igrybkov merged commit e069d7d into main Feb 25, 2026
23 checks passed
@igrybkov igrybkov deleted the feat/hive-extra-dirs branch February 25, 2026 22:31
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