Skip to content

feat: Add UMS v2.0 Toolkit Plugin for Claude Code#80

Closed
synthable wants to merge 11 commits intodevelopfrom
feat/ums-v2-claude-plugin
Closed

feat: Add UMS v2.0 Toolkit Plugin for Claude Code#80
synthable wants to merge 11 commits intodevelopfrom
feat/ums-v2-claude-plugin

Conversation

@synthable
Copy link
Copy Markdown
Owner

Summary

Adds a comprehensive plugin-based development toolkit for UMS v2.0 module and persona development in Claude Code.

What's Included

Plugin Structure

  • 5 Specialized Agents: Module validator, persona validator, module generator, build developer, library curator
  • 6 Slash Commands: /ums:create, /ums:validate-module, /ums:validate-persona, /ums:audit, /ums:curate, /ums:build
  • 3 Reusable Procedures: Complete module workflow, quality audit workflow, library addition workflow
  • Complete Documentation: Plugin README with usage examples and best practices

Key Features

Agents

  1. module-validator: Validates modules against UMS v2.0 specification
  2. persona-validator: Validates persona composition and quality
  3. module-generator: Interactive wizard for creating new modules
  4. build-developer: Develops build system functionality
  5. library-curator: Manages standard library organization and metrics

Commands

  • /ums:create - Launch interactive module creation wizard
  • /ums:validate-module [path] - Validate single module, directory, or entire tier
  • /ums:validate-persona [path] - Validate single persona or all personas
  • /ums:audit - Parallel validation of all modules and personas with comprehensive report
  • /ums:curate - Library management (add, remove, metrics, organize)
  • /ums:build - Build system development tasks

Additional Files

  • .claude/AGENTS.md - Complete agent documentation and usage patterns
  • .claude/agents/github-cli-agent.md - GitHub CLI operations agent
  • Updated modules.config.yml to point to instruct-modules-v2/

Benefits

  • Comprehensive Quality Assurance: Automated validation of all modules and personas
  • Accelerated Development: Interactive wizards and templates for module creation
  • Library Management: Tools for organizing and curating the standard library
  • Consistent Standards: Ensures all modules follow UMS v2.0 specification
  • Developer Experience: Specialized agents and commands for common workflows

Test Plan

  • Plugin structure follows Claude Code plugin conventions
  • All agent files have proper frontmatter and documentation
  • Commands have clear descriptions and usage examples
  • Procedures define complete workflows
  • Plugin manifest (plugin.yml) is valid
  • Pre-commit hooks pass (typecheck, lint, format)

Breaking Changes

None - this is an additive change that provides new development tooling.

Dependencies

  • Based on: feat/ums-lib-v2 branch (commit 586d843)
  • Requires: UMS v2.0 library and SDK (from parent branch)

Related

Notes

  • The toolkit is designed to work with TypeScript .module.ts and .persona.ts files
  • All agents are scoped to the ums: namespace to avoid conflicts
  • Procedures can be composed for complex workflows

Add comprehensive UMS v2.0 type definitions with full v1.0 backwards compatibility:

Core Types:
- Module interface with component-based architecture
- InstructionComponent, KnowledgeComponent, DataComponent
- ProcessStep, Constraint, Criterion directive types
- Concept, Example, Pattern knowledge types
- Enhanced metadata with capabilities, relationships, quality

Persona Types:
- Persona with spec-compliant ModuleEntry composition
- ModuleGroup for grouped module organization
- Support for both string IDs and grouped modules

Registry Types:
- RegistryEntry (renamed from ModuleEntry to avoid conflict)
- ModuleSource for provenance tracking
- ConflictStrategy types

Utilities:
- moduleIdToExportName() for kebab-case to camelCase conversion
- Transform utilities for v2.0 export naming conventions
- Enhanced error types for v2.0 operations

Backwards Compatibility:
- Deprecated v1.0 fields (meta, body, shape) preserved
- Type aliases (UMSModule, UMSPersona) maintained
- Gradual migration path for existing code

Breaking Changes: None (fully backwards compatible)

feat(parsers): add UMS v2.0 module and persona parsing

Update parsers to support v2.0 component-based architecture while maintaining v1.0 compatibility:

Module Parser:
- Support v2.0 component arrays (instruction, knowledge, data)
- Support v2.0 shorthand component properties
- Handle v2.0 capabilities field
- Maintain v1.0 shape/meta/body compatibility
- Enhanced validation for v2.0 requirements

Persona Parser:
- Support v2.0 ModuleEntry union type (string | ModuleGroup)
- Handle both grouped and ungrouped module references
- Parse v2.0 identity field (renamed from role)
- Support v2.0 domains and attribution fields
- Maintain v1.0 moduleGroups compatibility

Exports:
- Export parseModule and parsePersona for v2.0
- Maintain loadModule and loadPersona for v1.0
- Backwards compatible with existing code

Tests:
- Comprehensive v2.0 component parsing tests
- ModuleEntry union type handling tests
- Backwards compatibility test suite

refactor(validators): simplify validation for v2.0 flexibility

Streamline validators to support v2.0's flexible component architecture:

Module Validator:
- Validate v2.0 core fields (id, version, schemaVersion, capabilities, metadata)
- Support component arrays OR shorthand properties
- Validate v2.0 metadata requirements (name, description, semantic)
- Check cognitiveLevel range (0-4)
- Validate relationships and quality metadata
- Removed rigid v1.0 shape-based validation
- Maintain backwards compatibility with v1.0 modules

Persona Validator:
- Validate v2.0 persona structure
- Support ModuleEntry union type (string | ModuleGroup)
- Handle both grouped and ungrouped modules
- Check for duplicate module IDs across all groups
- Validate v2.0 metadata fields
- Removed v1.0 directive validation complexity
- Maintain backwards compatibility

Key Changes:
- Removed 600+ lines of directive-specific validation
- Simpler, more flexible validation approach
- Focus on structure over content
- Better error messages with spec references

Breaking Changes: None (validators are more permissive)

feat(core): update registry, resolvers, and renderers for v2.0

Update core library components to support v2.0 architecture:

Module Registry:
- Use RegistryEntry type (renamed to avoid conflict with ModuleEntry)
- Enhanced conflict resolution for v2.0
- Support v2.0 module composition tracking
- Improved source tracking for build reports

Module Resolver:
- Support v2.0 ModuleEntry union type (string | ModuleGroup)
- Handle both grouped and ungrouped module references
- Resolve modules from flat or grouped persona structure
- Maintain ordering from persona definition
- Enhanced duplicate detection

Markdown Renderer:
- Render v2.0 component-based modules
- Support instruction, knowledge, and data components
- Handle component arrays and shorthand properties
- Render structured directives (ProcessStep, Constraint, etc.)
- Support v2.0 attribution format
- Maintain v1.0 directive rendering compatibility

Build Report Generator:
- Generate v2.0 compliant build reports
- Include ModuleGroupReport structure
- Track composition events
- Calculate SHA-256 digests
- Support v2.0 persona structure

Tests:
- Updated for v2.0 types and structures
- Comprehensive component rendering tests
- ModuleEntry resolution tests

feat(lib): add v2.0 adapters and update library exports

Add v2.0/v1.0 interop adapters and enhance library exports:

Adapters:
- v1ToV2Adapter: Convert v1.0 modules to v2.0 format
- v2ToV1Adapter: Convert v2.0 modules to v1.0 format
- Bidirectional compatibility layer
- Preserve semantics during conversion

Library Exports:
- Export v2.0 transform utilities (moduleIdToExportName)
- Export adapter functions for interop
- Maintain all v1.0 exports
- Enhanced type exports

Benchmark Updates:
- Updated for v2.0 types
- Test both v1.0 and v2.0 code paths
- Performance comparison metrics

Breaking Changes: None (additive exports only)
Update library README to document v2.0 capabilities:

- Document v2.0 component-based architecture
- Update API examples for v2.0 types
- Add migration guide from v1.0 to v2.0
- Document new type system (Module, Persona, components)
- Update usage examples with TypeScript-first approach
- Document ModuleEntry union type for persona composition
- Add backwards compatibility notes
- Update installation and getting started sections
Phase 5.1 - Implement on-the-fly TypeScript execution for .module.ts and .persona.ts files without pre-compilation.

- Add tsx@^4.20.6 dependency for TypeScript execution
- Create typescript-loader.ts with loadTypeScriptModule() and loadTypeScriptPersona()
- Add version detection utilities (detectUMSVersion, isTypeScriptUMSFile, isYAMLUMSFile)
- Validate module IDs match between file and export name
- Support default exports and named exports for personas
- Add comprehensive test coverage for loader utilities

This enables v2.0 TypeScript-first module format while maintaining v1.0 YAML support.

feat(cli): add v2.0 TypeScript format support to build command

Phase 5.1 - Update build pipeline to handle both v1.0 (YAML) and v2.0 (TypeScript) formats.

**Module Discovery (module-discovery.ts)**:
- Add loadModuleFile() helper to detect and load both .module.yml and .module.ts formats
- Update discoverStandardModules() to handle both formats automatically
- Update discoverLocalModules() to use the new loadModuleFile helper
- Use detectUMSVersion() and loadTypeScriptModule() for v2.0 files

**File Operations (file-operations.ts)**:
- Update discoverModuleFiles() to search for both .module.yml and .module.ts files
- Update isPersonaFile() to accept both .persona.yml and .persona.ts extensions
- Update validatePersonaFile() error messages for dual format support

**Build Command (build.ts)**:
- Add loadTypeScriptPersona import and detectUMSVersion for format detection
- Update setupBuildEnvironment() to detect persona format and load accordingly:
  - v1.0: Parse YAML with parsePersona()
  - v2.0: Load TypeScript with loadTypeScriptPersona()
- Update processPersonaAndModules() to handle both formats:
  - v2.0: Extract IDs from modules array (ModuleEntry union type)
  - v1.0: Extract IDs from moduleGroups array
- Update verbose logging to count groups in both formats
- Update progress messages to indicate detected UMS version

This enables seamless building of both v1.0 and v2.0 personas while maintaining full backwards compatibility.

feat(errors): enhance error diagnostics with location and spec references

Task 5.2 - Improve error handling and diagnostics for better developer experience.

**ums-lib error types (errors.ts)**:
- Add ErrorLocation interface with filePath, line, column fields
- Extend UMSError base class with location and specSection properties
- Update all error constructors to accept location and specSection:
  - UMSValidationError: Add location and specSection parameters
  - ModuleLoadError: Add location and specSection with auto-location from filePath
  - PersonaLoadError: Add location and specSection with auto-location from filePath
  - BuildError: Add location and specSection parameters

**CLI error handler (error-handler.ts)**:
- Add formatLocation() helper to format error locations as "path:line:column"
- Add formatSpecSection() helper to display spec references in cyan
- Enhance handleValidationError():
  - Display location with line/column information
  - Show spec section references for validation errors
  - Use emoji (❌) for better visual clarity
- Enhance handleLoadError():
  - Display location information for load errors
  - Add spec section references
  - Update suggestions for TypeScript support (export names)
- Enhance generic UMS error handler:
  - Display location and spec section for all UMS errors
  - Improved formatting consistency

**Error Format Example**:
```
❌ Error: Invalid module ID format

   Location: src/modules/error-handling.module.ts:line 3, column 5
   Field: id
   Specification: Section 2.1 (Module ID Format)

  Suggestions:
    • Check YAML/TypeScript syntax and structure
    • Verify all required fields are present
    • Review UMS specification for correct format
```

This enables precise error reporting with file locations and actionable guidance linked to specification sections.

feat(progress): enhance progress tracking with statistics and CI support

Task 5.3 - Improve progress indicators for better UX and CI compatibility.

**Progress enhancements (progress.ts)**:
- Add isCI() helper to detect CI environments (CI, CONTINUOUS_INTEGRATION, BUILD_NUMBER, RUN_ID)
- Enhance BatchProgress with statistics tracking:
  - ETA calculation based on processing rate
  - Percentage completion display
  - Throughput metrics (items/second)
  - Duration tracking
- Add CI-specific logging:
  - Log progress milestones every 10% in CI environments
  - Always log in CI mode for better build logs
  - Timestamps for all CI output
- Add helper functions for common batch operations:
  - createModuleLoadProgress() for module loading operations
  - createModuleResolveProgress() for module resolution

**Progress output example**:
```
⠹ loading modules (42/100) 42% - module/error-handling ETA: 3s
✔ Processed 100 items in 5.2s (19.2 items/s)
```

**CI output example**:
```
[2025-10-12T10:30:00.000Z] [INFO] build:loading modules - Starting (total: 100)
[2025-10-12T10:30:01.000Z] [INFO] Progress: (10/100) 10% complete
[2025-10-12T10:30:02.000Z] [INFO] Progress: (20/100) 20% complete
...
[2025-10-12T10:30:05.000Z] [INFO] build:loading modules - Processed 100 items in 5.2s (19.2 items/s)
```

This provides clear feedback in both interactive terminals and CI/CD pipelines.
Remove all UMS v1.0 backward compatibility code and update tests for v2.0 only.

Breaking Changes:
- ums-lib: Remove v1.0 directive/shape/meta validation
- ums-lib: Remove v1.0 moduleGroups from persona format
- CLI: Remove v1.0 type imports (UMSModule)
- CLI: Remove shape display from inspect command
- CLI: Update test expectations for v2.0 module format
- CLI: Add loadTypeScriptPersona mock for build tests

Test Coverage:
- ums-lib: All 162 tests passing
- CLI: All 201 tests passing
- Total: 363/363 tests passing

Technical Details:
- Use ComponentType enum for type-safe component discrimination
- Add ESLint rule exceptions for runtime validation checks
- Fix nullish coalescing for optional properties
- Use forEach for iteration without unused variables
- Fix ums-mcp ESLint errors (nullish coalescing, catch types)

Files Changed:
- ums-lib: Enhanced module-validator with v2.0 rules
- ums-lib: Rewrote module-parser and persona-parser tests
- ums-lib: Updated markdown renderer with proper enum usage
- CLI: Fixed build tests to mock loadTypeScriptPersona
- CLI: Updated module-discovery tests for new standard path
- CLI: Removed v1.0 fallbacks from type extensions
- ums-mcp: Fixed ESLint errors for type safety
Apply consistent code formatting across CLI and library packages
following project Prettier configuration and ESLint rules.

Changes:
- Apply prettier formatting (line wrapping, indentation)
- Fix nullish coalescing operator usage in isCI()
- Remove unused variable in error handler
- Remove unnecessary type annotation
Address all 4 issues identified in PR #78 review:

1. Add input validation for empty strings in moduleIdToExportName()
   - Throw descriptive errors for empty/whitespace-only module IDs
   - Add validation for malformed IDs with trailing slashes
   - Update tests to verify error handling

2. Improve ESLint suppression comment in persona-validator
   - Add detailed explanation of why runtime validation is necessary
   - Clarify that TypeScript types don't protect against external data

3. Extract file extension constants in typescript-loader
   - Define FILE_EXTENSIONS constant to eliminate duplication
   - Update all file extension checks to use constants
   - Improves maintainability and reduces typo risk

4. Remove commented code in module-discovery
   - Delete 10-line commented code block
   - Preserve decision rationale in JSDoc comment
   - Improves code readability

All tests passing (365/365). No functional changes to existing behavior.
…eports

Issue identified by Gemini Code Assist review of PR #78.

Before: Build reports always claimed schemaVersion: '1.0'
After: Build reports correctly reflect the persona's actual schema version

Impact: Build reports for v2.0 personas will now correctly show schemaVersion: '2.0'

Test coverage: All 164 tests passing in ums-lib
The v2.0 migration in commit eb75803 did not update the UMS_SCHEMA_VERSION
constant or domain export comments, leaving v1.0 references throughout
the codebase despite all types, validators, and parsers being v2.0.

Changes:
- Update UMS_SCHEMA_VERSION constant from '1.0' to '2.0'
- Update parsing domain export comments to reference v2.0
- Update validation domain export comments to reference v2.0
- Update resolution domain export comments to reference v2.0
- Update registry domain export comments to reference v2.0
- Update core domain export comments to reference v2.0
- Update utils export comments to reference v2.0
- Update main library export comments to reference v2.0
- Update YAML utilities comment to reference v2.0

This completes the v2.0 migration by ensuring all constants and
documentation correctly reference v2.0 instead of v1.0.

Impact: Library now consistently identifies itself as v2.0 throughout.
…issues

Remove all v1.0 YAML file support from CLI and ums-lib, transitioning
fully to v2.0 TypeScript-only format. Address critical and high-priority
issues identified in PR #78 review comments.

**Breaking Changes:**
- v1.0 YAML files (.module.yml, .persona.yml) are no longer supported
- validate command now returns message that validation is not implemented
  for v2.0 (TypeScript provides compile-time type checking)
- parseModule and parsePersona exports removed from ums-lib

**Fixes:**
- Remove misleading "backward compatibility aliases" comment (parseModule/parsePersona)
- Fix unsafe type casting in inspect.ts by adding isCLIModule() type guard
- Fix division by zero bug in progress.ts ETA calculation
- Remove broken v1.0 YAML validation logic from validate command
- Remove v1.0 YAML module loading from module-discovery
- Remove v1.0 YAML support from file-operations (discoveryModuleFiles, isPersonaFile, validatePersonaFile)
- Remove v1.0 YAML detection functions from typescript-loader (detectUMSVersion, isYAMLUMSFile)

**Test Updates:**
- Update all test files to reflect v2.0 TypeScript-only support
- Remove obsolete validate.test.ts (validate command is now a stub)
- Fix test expectations for new error messages and behavior

All tests passing: CLI (184/184), ums-lib (164/164)

Addresses review comments from PR #78
Remove obsolete v1.0 agents and documentation:
- Delete .claude/agents/ums-module-evaluator.md (v1.0)
- Delete .claude/agents/ums-persona-evaluator.md (v1.0)
- Delete docs/USER_GUIDE.md (v1.0)
- Delete docs/processes/ums-module-evaluation-process.md (v1.0)
- Delete docs/processes/ums-persona-evaluation-process.md (v1.0)

Update documentation for v2.0:
- Update README.md with TypeScript examples and v2.0 features
- Update docs/README.md to reflect new documentation structure
- Update packages/ums-lib/README.md with v2.0 API documentation
- Update packages/ums-lib/package.json description for v2.0

All documentation now reflects the TypeScript-first approach and v2.0
module/persona format with full type safety.
Add comprehensive plugin-based toolkit for developing and maintaining
UMS v2.0 modules and personas.

Plugin Structure:
- 5 specialized agents (validator, generator, build-developer, curator)
- 6 slash commands (/ums:create, /ums:validate-*, /ums:audit, /ums:curate, /ums:build)
- 3 reusable procedure workflows
- Complete documentation in plugin README

Agents:
- module-validator: Validates modules for UMS v2.0 spec compliance
- persona-validator: Validates persona composition and quality
- module-generator: Interactive module creation wizard
- build-developer: Develops build system functionality
- library-curator: Manages standard library organization

Commands:
- /ums:create - Interactive module creation
- /ums:validate-module - Validate single/multiple modules
- /ums:validate-persona - Validate single/multiple personas
- /ums:audit - Parallel validation of all modules and personas
- /ums:curate - Library management (add, remove, metrics, organize)
- /ums:build - Build system development tasks

Additional:
- Add AGENTS.md documentation for agent usage patterns
- Add github-cli-agent for GitHub operations
- Update modules.config.yml path to instruct-modules-v2

This toolkit provides a complete development environment for UMS v2.0
with specialized agents, commands, and workflows for quality assurance.
Copilot AI review requested due to automatic review settings October 13, 2025 16:24
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @synthable, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a comprehensive UMS v2.0 Toolkit Plugin for Claude Code, designed to streamline the development and maintenance of UMS v2.0 modules and personas. It transitions the system from YAML-based UMS v1.0 to a TypeScript-first approach for enhanced type safety and developer experience. The toolkit provides a suite of specialized agents, slash commands, and reusable workflows to automate module creation, validation, library curation, and build system development, significantly improving quality assurance and accelerating development cycles within the UMS v2.0 ecosystem.

Highlights

  • UMS v2.0 Toolkit Plugin: Introduced a comprehensive plugin for Claude Code, featuring 5 specialized agents (Module Validator, Persona Validator, Module Generator, Build Developer, Library Curator), 6 slash commands (/ums:create, /ums:validate-module, /ums:validate-persona, /ums:audit, /ums:curate, /ums:build), and 3 reusable procedures for streamlined UMS v2.0 development.
  • TypeScript-First Approach: Migrated UMS modules and personas from YAML-based v1.0 to a TypeScript-first v2.0, enhancing type safety, developer experience, and IDE support across the system.
  • CLI Updates: Updated the copilot-instructions-cli to support UMS v2.0 TypeScript files, including new commands for MCP server interaction and a revised validate command that now directs users to TypeScript compiler for validation.
  • Core Library Rework: The ums-lib core library underwent a significant rewrite to align with UMS v2.0, updating type definitions, parsing, validation, rendering, and resolution logic to support the new component-based module structure and persona composition.
  • Documentation Overhaul: Refreshed documentation to reflect the UMS v2.0 specification, new toolkit features, and the updated monorepo structure, removing outdated UMS v1.0 guides and processes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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 implements the complete migration from UMS v1.0 to v2.0, featuring a comprehensive plugin-based development toolkit for Claude Code and updated type system. The changes span across multiple packages, transforming the system from YAML-based v1.0 to TypeScript-native v2.0.

Key changes:

  • Complete type system migration to UMS v2.0 specification with TypeScript-first approach
  • Addition of comprehensive UMS v2.0 Toolkit Plugin for Claude Code with 5 specialized agents and 6 slash commands
  • Enhanced CLI with TypeScript module loading, MCP server support, and improved error handling

Reviewed Changes

Copilot reviewed 81 out of 82 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
vitest.config.ts Adds test coverage exclusions for CLI entry points and test utilities
packages/ums-mcp/src/index.ts New MCP server entry point supporting multiple transport protocols
packages/ums-lib/src/ Complete v2.0 type system migration with new component-based architecture
packages/copilot-instructions-cli/src/ Enhanced CLI with TypeScript loading and MCP integration
modules.config.yml Updates module path to point to v2.0 modules directory
Comments suppressed due to low confidence (1)

packages/copilot-instructions-cli/src/utils/module-discovery.ts:1

  • This is a significant behavioral change from the previous version. Consider updating the function documentation to clearly indicate this breaking change and provide migration guidance for users who relied on automatic standard module discovery.
/**

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +26 to +30
export function moduleIdToExportName(moduleId: string): string {
// Validate input
if (!moduleId || moduleId.trim().length === 0) {
throw new Error('Module ID cannot be empty');
}
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

Consider using a more specific error type for validation errors. The function should throw a ValidationError or ModuleParseError instead of a generic Error to maintain consistency with the rest of the codebase error handling patterns.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +25
// eslint-disable-next-line complexity, max-lines-per-function
export function validateModule(module: Module): ValidationResult {
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The function has eslint-disable comments for complexity and max-lines-per-function, indicating it may be doing too much. Consider breaking this into smaller, focused validation functions (e.g., validateModuleStructure, validateMetadata, validateComponents) to improve maintainability and testability.

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +24
// eslint-disable-next-line max-lines-per-function
export function validatePersona(persona: Persona): ValidationResult {
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

Similar to the module validator, this function exceeds the max-lines-per-function limit. Consider extracting validation logic into separate functions like validatePersonaMetadata, validateModuleEntries, etc.

Copilot uses AI. Check for mistakes.
Comment on lines +92 to +93
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Runtime check for external data
if (!entry || typeof entry !== 'object') {
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

While the runtime check is necessary for external data validation, consider using a type guard function to make this pattern reusable and improve code clarity. This would also eliminate the need for the eslint-disable comment.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +75
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!module.metadata || typeof module.metadata !== 'object') {
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

Same as the persona validator - consider creating a reusable type guard function for metadata validation to improve code consistency and eliminate the need for eslint-disable comments.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot 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

This is a massive and impressive pull request that successfully migrates the Unified Module System from v1.0 (YAML-based) to v2.0 (TypeScript-based). The introduction of the Claude Code Toolkit Plugin with its specialized agents, commands, and workflows is a huge step forward for developer experience and quality assurance. The code changes are extensive and well-executed, particularly the refactoring of the ums-lib to support the new v2.0 spec, the improved error handling, and the new TypeScript loader. The documentation is thorough and provides a great foundation for developers. I have a few suggestions for improvement, mainly around consistency in documentation and a potential change in module discovery behavior that needs clarification. Overall, excellent work on a very significant feature.

---
name: github-agent
description: Specialized agent for GitHub CLI (gh) operations including PR management, issue tracking, releases, and repository interactions
tools: Bash, Read, Write, Edit, Grep, Glob
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The agent's declared tools seem to contradict its operational guidelines. The frontmatter lists Write and Edit as available tools, but the "File modifications" guideline on line 113 states that the agent is "read-only for repository files". To adhere to the principle of least privilege and avoid potential misuse, the agent should only be granted the tools it is actually supposed to use. If file modifications are indeed deferred, the Write and Edit tools should be removed.

Suggested change
tools: Bash, Read, Write, Edit, Grep, Glob
tools: Bash, Read, Grep, Glob

@@ -0,0 +1,123 @@
---
name: github-agent
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The agent name in the frontmatter is github-agent, but it's referred to as github-cli-agent in AGENTS.md and the PR description. For consistency and clarity, it would be better to use the more descriptive name github-cli-agent here as well.

Suggested change
name: github-agent
name: github-cli-agent


### Example 1: New Module Development
```
User: "I need a module for error handling in TypeScript" No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This example seems to be incomplete. The user's request is shown, but there is no corresponding agent response or action. It would be helpful to complete this example to demonstrate how the system would handle the request.

### Template: Simple Instruction Module

```typescript
import { Module, ComponentType } from '../../../types/index.js';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The template uses a hardcoded relative path ../../../types/index.js for imports. This might be brittle, as it assumes a fixed directory depth for all generated modules. It would be more robust if the module generator could calculate the correct relative path based on the destination of the generated file, or use path aliases if the project supports them.

### 2. Required Top-Level Fields
```typescript
{
id: string, // Pattern: ^[a-z0-9][a-z0-9-]*(/[a-z0-9][a-z0-9-]*)*$
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The regex pattern for the module id in this documentation appears to be less strict than the one defined in the core library (packages/ums-lib/src/constants.ts). The documentation should reflect the actual regex used for validation to avoid confusion for developers. The core library regex correctly enforces that the ID must start with one of the valid tiers (foundation, principle, etc.).

Suggested change
id: string, // Pattern: ^[a-z0-9][a-z0-9-]*(/[a-z0-9][a-z0-9-]*)*$
id: string, // Pattern: ^(foundation|principle|technology|execution)\/([a-z0-9-]+(?:\/[a-z0-9-]+)*\/[a-z0-9][a-z0-9-]*|[a-z0-9][a-z0-9-]*)$

import type { Module } from '../../types/index.js';

describe('UMS Module Loader', () => {
describe('UMS v2.0 Module Validation', () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The name of this test file is module-parser.test.ts, but the tests within seem to be for validateModule, which resides in module-validator.ts. For better maintainability and clarity, the test file should be renamed to module-validator.test.ts to accurately reflect the code it's testing. Alternatively, if it's intended to test the parser, the tests should target parseModuleObject.

@synthable
Copy link
Copy Markdown
Owner Author

Closing in favor of PR #84 which uses a direct integration approach (flat .claude/agents/ and .claude/commands/ structure) instead of the plugin wrapper approach. PR #84 is the preferred architecture.

@synthable synthable closed this Oct 14, 2025
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