Skip to content

Adds junie skills and subagents#1260

Open
dacgray wants to merge 9 commits intodyoshikawa:mainfrom
dacgray:add-skills-for-junie
Open

Adds junie skills and subagents#1260
dacgray wants to merge 9 commits intodyoshikawa:mainfrom
dacgray:add-skills-for-junie

Conversation

@dacgray
Copy link
Contributor

@dacgray dacgray commented Mar 4, 2026

dacgray added 6 commits March 3, 2026 22:36
Introduces the `JunieSkill` class and integrates it into the skill processing framework.

This enables the system to:
- Manage and validate skills located in `.junie/skills` directories.
- Convert between generic `RulesyncSkill` and `JunieSkill` formats.
- Support both project-level and global Junie skills.

Updates the README to reflect the added support and global capability for Junie.
Implements the `JunieSubagent` class to represent and manage Junie-specific agents.

Enables bi-directional conversion between `JunieSubagent` and `RulesyncSubagent` formats, facilitating interoperability and preserving Junie-specific frontmatter.

Integrates Junie into the subagent processing system, allowing Rulesync subagents to target Junie for operations.

Adds frontmatter validation, file loading, and path resolution capabilities for Junie subagents.

Updates the `README.md` to reflect Junie's support for conversion from Rulesync.
Adds Junie to the lists of recognized subagents within skill and subagent processing tests.
Includes the necessary `relativeDirPath` configuration when initializing Junie subagents from Rulesync, ensuring proper setup.
Updates documentation to reflect Junie's capabilities for Retrieval Augmented Generation and conversational interactions.

Enforces local-only configuration for Junie skills and subagents by throwing an error when global mode is requested for settable paths. This clarifies that Junie does not support global path configurations, ensuring correct usage.
@dyoshikawa-claw

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

PR #1260 Review Complete

Overall Verdict: ✅ MERGEABLE

Both code quality and security reviews found only low-severity or informational issues - no blockers for merging.


Code Review Findings

  1. Code Quality: Excellent - Implementation follows all project conventions and patterns established by existing tool implementations (Copilot)

  2. Consistency: Excellent - junie-skill.ts and junie-subagent.ts correctly mirror the Copilot implementations, maintaining codebase consistency

  3. Test Coverage: Comprehensive - 244 lines of tests for skills, 325 lines for subagents covering all major functionality

  4. Minor Gap (Low Severity): Missing forDeletion test in junie-subagent.test.ts for complete parity with junie-skill.test.ts

  5. Documentation: Good - All three documentation files consistently updated to show Junie support


Security Review Findings

  1. Input Validation: ✅ Pass - Zod schemas properly validate all frontmatter fields

  2. Path Traversal Protection: ✅ Pass - Inherits robust security controls from base classes (AiDir, AiFile)

  3. Injection Vulnerabilities: ✅ Pass - No command execution, code evaluation, or unsafe parsing

  4. Error Handling: ✅ Pass - Appropriate error messages with context, no sensitive data exposure

  5. File Operations: ✅ Pass - Uses secure utility functions with symlink protection and dangerous path checks

  6. Global Mode: ✅ Pass - Correctly throws error for unsupported global mode


Summary

  • Code Quality Issues: 0 critical, 0 high, 0 medium, 2 low (both cosmetic/optional)
  • Security Issues: 0 critical, 0 high, 0 medium, 0 low
  • Merge Status: Ready to merge

The PR is well-implemented, follows established patterns, has comprehensive test coverage, and introduces no security vulnerabilities.

github run

Copy link
Owner

@dyoshikawa dyoshikawa left a comment

Choose a reason for hiding this comment

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

Code Review

🔴 High: JunieSubagentFrontmatterSchemaname/description required/optional appears inverted from official docs

File: src/features/subagents/junie-subagent.ts

The current schema defines name as required and description as optional:

export const JunieSubagentFrontmatterSchema = z.looseObject({
  name: z.string(),
  description: z.optional(z.string()),
});

However, according to the Junie CLI subagents documentation:

  • name: Not required (defaults to the filename when omitted)
  • description: Required (used by the main agent to decide task delegation)

The test cases in junie-subagent.test.ts follow this inverted logic as well ("should accept valid frontmatter without description", "should reject frontmatter missing name").

How to fix:

Update the schema to match the official spec:

export const JunieSubagentFrontmatterSchema = z.looseObject({
  name: z.optional(z.string()),
  description: z.string(),
});

And update the corresponding test cases accordingly. If the current behavior is intentional (e.g., Rulesync requires name for its own internal processing), please add a comment explaining why it diverges from the official spec.


🟡 Medium: fromRulesyncSubagent should use filterToolSpecificSection to prevent field overwriting

File: src/features/subagents/junie-subagent.tsfromRulesyncSubagent()

The current implementation spreads junieSection directly into rawJunieFrontmatter:

const junieSection = rulesyncFrontmatter.junie ?? {};

const rawJunieFrontmatter = {
  name: rulesyncFrontmatter.name,
  description: rulesyncFrontmatter.description,
  ...junieSection,  // If junieSection contains "name" or "description", they silently overwrite the above
};

If a user places name or description inside the junie: section of a rulesync file, those values will silently overwrite the top-level rulesync values. The existing KiroSubagent implementation avoids this by using filterToolSpecificSection:

// kiro-subagent.ts
const kiroSection = this.filterToolSpecificSection(rawSection, [
  "name",
  "description",
  "prompt",
]);

How to fix:

Use filterToolSpecificSection to strip common fields from junieSection before spreading:

const junieSection = this.filterToolSpecificSection(
  rulesyncFrontmatter.junie ?? {},
  ["name", "description"],
);

const rawJunieFrontmatter = {
  name: rulesyncFrontmatter.name,
  description: rulesyncFrontmatter.description,
  ...junieSection,
};

🟡 Medium: Missing .junie/skills/ and .junie/agents/ entries in gitignore.ts

File: src/cli/commands/gitignore.ts

Per feature-change-guidelines.md: "Evaluate whether gitignore.ts needs additions or changes in its generated output."

This PR adds Junie skills (.junie/skills/) and subagents (.junie/agents/) as generated output directories, but the gitignore entries were not updated. Currently only the following Junie entries exist:

// Junie
"**/.junie/guidelines.md",
"**/.junie/mcp.json",

Other tools (e.g., Kiro, Copilot) include their corresponding directories:

// Kiro
"**/.kiro/skills/",
"**/.kiro/agents/",

How to fix:

Add the new entries to gitignore.ts:

// Junie
"**/.junie/guidelines.md",
"**/.junie/mcp.json",
"**/.junie/skills/",
"**/.junie/agents/",

Then run pnpm dev gitignore to regenerate .gitignore, and update gitignore.test.ts accordingly.

dacgray added 3 commits March 4, 2026 15:26
Makes the description field mandatory and the name field optional for Junie subagents. If a name is not provided, it now defaults to the filename without the extension. Tests have been updated to reflect these validation changes.
Filters out the name and description fields from tool-specific configuration sections like claudecode and junie during subagent conversion. This ensures that top-level metadata takes precedence and is not accidentally overwritten by tool-specific blocks.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Thank you for your contribution! Unfortunately, this PR has 1073 added lines, which exceeds the limit of 1000 lines for external contributors.

Please split your changes into smaller PRs. See CONTRIBUTING.md for details.

This PR has been automatically closed.

@github-actions github-actions bot closed this Mar 4, 2026
@dacgray
Copy link
Contributor Author

dacgray commented Mar 4, 2026

@dyoshikawa requested changes implemented - but pushed the PR above the 1000 line threshold. Do you really need this split into 2 prs?

@dyoshikawa
Copy link
Owner

@dacgray sorry, I'll review it later. up to 1000 is too strict, isn't it 🤔

@dyoshikawa dyoshikawa reopened this Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Thank you for your contribution! Unfortunately, this PR has 1073 added lines, which exceeds the limit of 1000 lines for external contributors.

Please split your changes into smaller PRs. See CONTRIBUTING.md for details.

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.

3 participants