Skip to content

feat(junie): import subagents from the shared .agents directory - #1875

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-1821-junie-agents-import
Jun 16, 2026
Merged

feat(junie): import subagents from the shared .agents directory#1875
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-1821-junie-agents-import

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Junie discovers custom subagents from the cross-tool .agents/ directory (project .agents/ and user ~/.agents/) in addition to .junie/agents/, per the Junie CLI subagents docs. rulesync previously imported subagents only from .junie/agents/, so subagents authored under the shared .agents/ root were silently skipped on import.

This resolves the last remaining gap in #1821. (The subagent frontmatter field set already landed via #1845, and the command frontmatter fields were confirmed by the docs to be description-only, i.e. no change needed.)

Changes

  • Add an optional importDirPaths to ToolSubagentSettablePaths describing extra import-only discovery roots.
  • Teach SubagentsProcessor.loadToolFiles to scan those extra roots when importing, passing the per-root relativeDirPath to fromFile.
  • JunieSubagent.getSettablePaths now advertises .agents as an import root; JunieSubagent.fromFile honors an explicit relativeDirPath override.
  • Update docs/reference/file-formats.md (synced to skills/rulesync/).

Safety

  • Generation and orphan deletion still target only the canonical relativeDirPath (.junie/agents/). The .agents/ root is read-only on import, so user-owned .agents/ files are never overwritten or removed.
  • Other tools omit importDirPaths, so their single-directory behavior is unchanged (verified: full suite of 6371 tests passes).

Tests

  • Unit: JunieSubagent.fromFile loads from .agents; processor imports from both roots and excludes .agents/ from deletion.
  • E2E: import a Junie subagent from the shared .agents/ directory.

Closes #1821

🤖 Generated with Claude Code

cm-dyoshikawa and others added 2 commits June 15, 2026 21:57
Junie discovers custom subagents from the cross-tool `.agents/` directory
(project `.agents/` and user `~/.agents/`) in addition to `.junie/agents/`,
per the Junie CLI docs. rulesync previously imported only from
`.junie/agents/`.

Add an optional `importDirPaths` to `ToolSubagentSettablePaths` describing
extra import-only discovery roots, and teach the subagents processor to scan
them when importing. Generation and orphan deletion still target only the
canonical `relativeDirPath` (`.junie/agents/`), so user-owned `.agents/`
files are never overwritten or removed. Other tools omit `importDirPaths`
and keep their single-directory behavior unchanged.

Closes #1821

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…clarify load log

Address review feedback on multi-root subagent import:
- Warn (and keep the higher-precedence copy) when the same subagent
  relative path is found in more than one import root, instead of
  silently overwriting downstream.
- Make the load debug log report the tool target and all scanned
  directories rather than only the canonical one.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dyoshikawa
dyoshikawa merged commit abc25ce into main Jun 16, 2026
8 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-scrap-issue-1821-junie-agents-import branch June 16, 2026 05:49
@dyoshikawa dyoshikawa mentioned this pull request Jun 17, 2026
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.

Follow up JetBrains Junie upstream updates: subagent/command frontmatter fields and .agents discovery

2 participants