Skip to content

Conversation

@mattpodwysocki
Copy link
Contributor

Summary

Comprehensive improvements to the plop code generator to support:

  • Dual input/output schemas (matching public/private repos)
  • Proper test directory structure (test/tools/ not src/tools/)
  • Non-interactive mode for AI agents and CI
  • Vitest instead of Jest
  • Complete template fixes

Changes

Schema Structure

  • ✅ Split single schema into *.input.schema.ts and *.output.schema.ts
  • ✅ Updated tool templates to import both schemas
  • ✅ Fixed schema naming bug: ExampleSchemaExampleInputSchema
  • ✅ Added comprehensive JSDoc examples

Test Organization

  • ✅ Tests now generated in test/tools/ directory (not src/tools/)
  • ✅ Migrated templates from Jest to Vitest syntax
  • ✅ Added proper httpRequest mocking for API tools
  • ✅ Three core test cases: metadata, success, error handling

Tool Templates

  • ✅ API tool template includes output schema and CallToolResult
  • ✅ Local tool template includes output schema
  • ✅ Proper execute() signatures with context parameter
  • ✅ Annotations property added
  • ✅ Improved JSDoc and examples

Non-Interactive Mode

  • ✅ Updated plopfile.cjs with comprehensive JSDoc
  • ✅ Documented CLI usage: npx plop create-tool "api-based" "ToolName"
  • ✅ Updated CLAUDE.md with examples for AI agents
  • ✅ Clear guidance on when to use each mode

Testing

# Tested generator
npx plop create-tool "api-based" "Example"

# Verified build
npm run build  # ✓ Success

# Verified generated files compile correctly

Documentation Updates

  • Updated CLAUDE.md with non-interactive mode examples
  • Added architecture description for dual schemas
  • Updated constraints to reflect new file structure

🤖 Generated with Claude Code

…tive mode

Major improvements to plop code generator:

Schema Structure:
- Split single schema file into input.schema.ts and output.schema.ts
- Updated all tool templates to import both schemas
- Fixed schema naming: ExampleSchema → ExampleInputSchema
- Added comprehensive JSDoc examples for both schema types

Test Organization:
- Moved tests from src/tools/ to test/tools/ directory
- Updated all test templates to use Vitest (not Jest)
- Added proper mock setup for httpRequest in API tool tests
- Added three core test cases: metadata, success, and error handling

Tool Templates:
- Updated API tool template to include output schema and CallToolResult
- Updated local tool template to include output schema
- Added proper execute() signatures with context parameter
- Added annotations property to all generated tools
- Improved JSDoc documentation and examples

Non-Interactive Mode:
- Updated plopfile.cjs with comprehensive JSDoc
- Documented command-line arguments: npx plop create-tool "api-based" "ToolName"
- Updated CLAUDE.md with usage examples for AI agents and CI
- Explained when to use interactive vs non-interactive modes

Documentation:
- Updated CLAUDE.md architecture section to mention dual schemas
- Updated tool creation workflow with both modes
- Added note about non-TTY environments requiring non-interactive mode

Build & Testing:
- Verified generator works with test tool creation
- Confirmed build succeeds with updated templates
- All templates generate compilable, testable code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mattpodwysocki mattpodwysocki requested a review from a team as a code owner January 6, 2026 03:59
@mattpodwysocki mattpodwysocki merged commit f4b3dbe into main Jan 6, 2026
1 check passed
@mattpodwysocki mattpodwysocki deleted the fix-plop-template-non-interactive branch January 6, 2026 21:24
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