Skip to content

[#154] Support subagents as a component type#200

Merged
bguidolim merged 2 commits intomainfrom
feature/154-subagent-component-type
Mar 2, 2026
Merged

[#154] Support subagents as a component type#200
bguidolim merged 2 commits intomainfrom
feature/154-subagent-component-type

Conversation

@bguidolim
Copy link
Copy Markdown
Collaborator

Summary

  • Add first-class agent: shorthand support in techpack.yaml for Claude Code custom subagents (.md files in .claude/agents/)
  • Follow the established CopyFileType pattern used by skill:, hook:, and command: — zero changes needed in executor, doctor, dry-run display, or artifact tracking (all generic)
  • Full export pipeline support: discovery, interactive selection, manifest building, and YAML rendering

Test plan

  • swift build compiles cleanly
  • swift test — all 593 tests pass (5 new tests added)
  • Create a test pack with agent: shorthand and run mcs sync --dry-run
  • Run mcs sync and verify .md files land in .claude/agents/
  • Run mcs doctor and verify agent file check passes
  • Run mcs export and verify agents are discovered and round-trip correctly

Closes #154

Copilot AI review requested due to automatic review settings March 2, 2026 01:03
- Add `agent` case to ComponentType, CopyFileType, ExternalComponentType,
  ExternalCopyFileType, and ShorthandKeys with `agent:` shorthand in
  techpack.yaml
- Add agentsDirectory to Environment and agent discovery/export in
  ConfigurationDiscovery, ManifestBuilder, and ExportCommand
- Add tests for shorthand parsing, adapter conversion, doctor checks,
  manifest round-trip, and project file installation
- Add agent: shorthand section, fileType value, and auto-derived check row to techpack-schema.md
- Add Agents subsection, doctor check row, and artifact location to creating-tech-packs.md
- Add agent to component type list and per-project paths in architecture.md
Copy link
Copy Markdown

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

Adds first-class support for Claude Code custom subagents (.claude/agents/*.md) as a tech pack component type, aligning with the existing CopyFileType-driven install/export pipeline.

Changes:

  • Introduces agent as a ComponentType + CopyFileType, including global (~/.claude/agents/) and project (.claude/agents/) target directories.
  • Extends external manifest parsing and shorthand YAML support to accept agent: and type: agent / fileType: agent.
  • Updates export discovery, interactive selection, and manifest building/rendering to include agent files; adds/updates tests accordingly.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Sources/mcs/Core/Environment.swift Adds agentsDirectory to the environment path set.
Sources/mcs/TechPack/Component.swift Adds .agent to ComponentType and CopyFileType, wiring directory resolution for install/doctor.
Sources/mcs/ExternalPack/ExternalPackManifest.swift Adds agent component type + agent: shorthand resolution and ExternalCopyFileType.agent.
Sources/mcs/Export/ConfigurationDiscovery.swift Discovers agent files from agents/ for both global and project scopes.
Sources/mcs/Export/ManifestBuilder.swift Includes agent files in build specs, YAML rendering, and doctor hint comments.
Sources/mcs/Commands/ExportCommand.swift Adds agents to discovery summary and interactive/non-interactive selection, passing through to BuildOptions.
Tests/MCSTests/ManifestBuilderTests.swift Ensures manifest building includes agent components and updates expected component/file copy counts.
Tests/MCSTests/ExternalPackManifestTests.swift Verifies YAML deserialization and agent: shorthand behavior for external manifests.
Tests/MCSTests/ExternalPackAdapterTests.swift Verifies adapter converts external agent copyPackFile components to internal definitions.
Tests/MCSTests/DerivedDoctorCheckTests.swift Verifies derived file existence paths cover .agent correctly.
Tests/MCSTests/ComponentExecutorTests.swift Verifies project-scoped install places agent files under .claude/agents/.
Comments suppressed due to low confidence (1)

Sources/mcs/ExternalPack/ExternalPackManifest.swift:316

  • The shorthand-key doc comment above this type still lists hook, command, skill, etc. but not agent. Since agent is now supported, update that comment so the manifest authoring guide stays accurate.
        case hook          // Map — CopyFileShorthand (fileType: .hook)
        case command       // Map — CopyFileShorthand (fileType: .command)
        case skill         // Map — CopyFileShorthand (fileType: .skill)
        case agent         // Map — CopyFileShorthand (fileType: .agent)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bguidolim bguidolim force-pushed the feature/154-subagent-component-type branch from 3d26924 to 73720f4 Compare March 2, 2026 01:09
@bguidolim bguidolim merged commit 2338ad1 into main Mar 2, 2026
3 checks passed
@bguidolim bguidolim deleted the feature/154-subagent-component-type branch March 2, 2026 01:11
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.

Support subagents as a component type

2 participants