Skip to content

feat: implement missing ddx templates command #22

@mehdipiraee

Description

@mehdipiraee

Summary

The README documents ddx templates commands that don't exist in the CLI implementation, causing user confusion and broken workflows.

Problem

The README clearly documents these commands under "Resource Commands":

ddx templates list         # List available templates
ddx templates apply <name> # Apply template to project

However, running these commands results in:

$ ddx templates --help
Error: unknown command "templates" for "ddx"

Documentation vs Implementation Gap

README Claims:

  • ddx templates list - List available templates ❌
  • ddx templates apply <name> - Apply template to project ❌

CLI Actually Has:

  • ddx list - Lists all resources (templates, patterns, prompts, etc.) ✅
  • ddx apply <name> - Apply any resource ✅

Root Cause Analysis

Looking at the codebase:

  • ddx prompts command IS implemented (prompts.go, factory functions, registration)
  • ddx templates command is NOT implemented (no templates.go, no factory functions)
  • ddx patterns command is NOT implemented (no patterns.go, no factory functions)

Only the prompts resource command was actually built - templates and patterns were documented but never implemented.

Expected Implementation

Following the same pattern as ddx prompts:

  1. Create cli/cmd/templates.go with:

    func runTemplatesList(cmd *cobra.Command, args []string) error
    func runTemplatesShow(cmd *cobra.Command, args []string) error
  2. Add factory functions in cli/cmd/command_factory_commands.go:

    func (f *CommandFactory) newTemplatesListCommand() *cobra.Command
    func (f *CommandFactory) newTemplatesShowCommand() *cobra.Command
  3. Register commands in cli/cmd/command_factory.go:

    templatesCmd := &cobra.Command{
        Use:     "templates",
        Short:   "Manage project templates",
        Aliases: []string{"template"},
    }
    templatesCmd.AddCommand(f.newTemplatesListCommand())
    templatesCmd.AddCommand(f.newTemplatesShowCommand())
    rootCmd.AddCommand(templatesCmd)

User Impact

Current Workaround:
Users must use generic commands:

  • ddx list (shows all resources mixed together)
  • ddx apply template-name

With Implementation:
Users can use documented, intuitive commands:

  • ddx templates list (shows only templates)
  • ddx templates show <name> (display template content)

Acceptance Criteria

  • ddx templates --help shows help text
  • ddx templates list lists available templates from library/templates/
  • ddx templates list --search <term> filters templates
  • ddx templates show <name> displays template content
  • Commands follow same pattern as ddx prompts
  • Error handling for missing templates directory
  • Proper test coverage

Related Issues

This is part of a broader documentation-implementation gap:

  • Missing ddx patterns command (separate issue)
  • README needs to be aligned with actual CLI capabilities

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions