@paulduvall/claude-dev-toolkit 0.0.1-alpha.2 → 0.0.1-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -37
  3. package/bin/claude-commands +307 -65
  4. package/commands/active/xarchitecture.md +393 -0
  5. package/commands/active/xconfig.md +127 -0
  6. package/commands/active/xcontinue.md +92 -0
  7. package/commands/active/xdebug.md +130 -0
  8. package/commands/active/xdocs.md +178 -0
  9. package/commands/active/xexplore.md +94 -0
  10. package/commands/active/xgit.md +149 -0
  11. package/commands/active/xpipeline.md +152 -0
  12. package/commands/active/xquality.md +96 -0
  13. package/commands/active/xrefactor.md +198 -0
  14. package/commands/active/xrelease.md +142 -0
  15. package/commands/active/xsecurity.md +92 -0
  16. package/commands/active/xspec.md +174 -0
  17. package/commands/active/xtdd.md +151 -0
  18. package/commands/active/xtest.md +89 -0
  19. package/commands/active/xverify.md +80 -0
  20. package/commands/experiments/xact.md +742 -0
  21. package/commands/experiments/xanalytics.md +113 -0
  22. package/commands/experiments/xanalyze.md +70 -0
  23. package/commands/experiments/xapi.md +161 -0
  24. package/commands/experiments/xatomic.md +112 -0
  25. package/commands/experiments/xaws.md +85 -0
  26. package/commands/experiments/xcicd.md +337 -0
  27. package/commands/experiments/xcommit.md +122 -0
  28. package/commands/experiments/xcompliance.md +182 -0
  29. package/commands/experiments/xconstraints.md +89 -0
  30. package/commands/experiments/xcoverage.md +90 -0
  31. package/commands/experiments/xdb.md +102 -0
  32. package/commands/experiments/xdesign.md +121 -0
  33. package/commands/experiments/xdevcontainer.md +238 -0
  34. package/commands/experiments/xevaluate.md +111 -0
  35. package/commands/experiments/xfootnote.md +12 -0
  36. package/commands/experiments/xgenerate.md +117 -0
  37. package/commands/experiments/xgovernance.md +149 -0
  38. package/commands/experiments/xgreen.md +66 -0
  39. package/commands/experiments/xiac.md +118 -0
  40. package/commands/experiments/xincident.md +137 -0
  41. package/commands/experiments/xinfra.md +115 -0
  42. package/commands/experiments/xknowledge.md +115 -0
  43. package/commands/experiments/xmaturity.md +120 -0
  44. package/commands/experiments/xmetrics.md +118 -0
  45. package/commands/experiments/xmonitoring.md +128 -0
  46. package/commands/experiments/xnew.md +903 -0
  47. package/commands/experiments/xobservable.md +114 -0
  48. package/commands/experiments/xoidc.md +165 -0
  49. package/commands/experiments/xoptimize.md +115 -0
  50. package/commands/experiments/xperformance.md +112 -0
  51. package/commands/experiments/xplanning.md +131 -0
  52. package/commands/experiments/xpolicy.md +115 -0
  53. package/commands/experiments/xproduct.md +98 -0
  54. package/commands/experiments/xreadiness.md +75 -0
  55. package/commands/experiments/xred.md +55 -0
  56. package/commands/experiments/xrisk.md +128 -0
  57. package/commands/experiments/xrules.md +124 -0
  58. package/commands/experiments/xsandbox.md +120 -0
  59. package/commands/experiments/xscan.md +102 -0
  60. package/commands/experiments/xsetup.md +123 -0
  61. package/commands/experiments/xtemplate.md +116 -0
  62. package/commands/experiments/xtrace.md +212 -0
  63. package/commands/experiments/xux.md +171 -0
  64. package/commands/experiments/xvalidate.md +104 -0
  65. package/commands/experiments/xworkflow.md +113 -0
  66. package/hooks/.smellrc.example.json +19 -0
  67. package/hooks/README.md +263 -0
  68. package/hooks/check-commit-signing.py +127 -0
  69. package/hooks/check-complexity.py +38 -0
  70. package/hooks/check-security.py +37 -0
  71. package/hooks/claude-wrapper.sh +29 -0
  72. package/hooks/config.py +110 -0
  73. package/hooks/file-logger.sh +100 -0
  74. package/hooks/lib/argument-parser.sh +427 -0
  75. package/hooks/lib/config-constants.sh +230 -0
  76. package/hooks/lib/context-manager.sh +560 -0
  77. package/hooks/lib/error-handler.sh +423 -0
  78. package/hooks/lib/execution-engine.sh +444 -0
  79. package/hooks/lib/execution-results.sh +113 -0
  80. package/hooks/lib/execution-simulation.sh +114 -0
  81. package/hooks/lib/field-validators.sh +104 -0
  82. package/hooks/lib/file-utils.sh +398 -0
  83. package/hooks/lib/subagent-discovery.sh +468 -0
  84. package/hooks/lib/subagent-validator.sh +407 -0
  85. package/hooks/lib/validation-reporter.sh +134 -0
  86. package/hooks/on-error-debug.sh +226 -0
  87. package/hooks/pre-commit-quality.sh +204 -0
  88. package/hooks/pre-commit-test-runner.sh +132 -0
  89. package/hooks/pre-write-security.sh +115 -0
  90. package/hooks/prevent-credential-exposure.sh +279 -0
  91. package/hooks/security_bandit.py +177 -0
  92. package/hooks/security_checks.py +97 -0
  93. package/hooks/security_secrets.py +81 -0
  94. package/hooks/security_trojan.py +61 -0
  95. package/hooks/settings.example.json +52 -0
  96. package/hooks/smell_checks.py +238 -0
  97. package/hooks/smell_javascript.py +231 -0
  98. package/hooks/smell_python.py +110 -0
  99. package/hooks/smell_ruff.py +70 -0
  100. package/hooks/smell_types.py +72 -0
  101. package/hooks/subagent-trigger-simple.sh +202 -0
  102. package/hooks/subagent-trigger.sh +253 -0
  103. package/hooks/suppression.py +82 -0
  104. package/hooks/tab-color.sh +70 -0
  105. package/hooks/verify-before-edit.sh +135 -0
  106. package/lib/backup-restore-command.js +140 -0
  107. package/lib/base/base-command.js +252 -0
  108. package/lib/base/command-result.js +184 -0
  109. package/lib/config/constants.js +255 -0
  110. package/lib/config.js +48 -6
  111. package/lib/configure-command.js +428 -0
  112. package/lib/dependency-validator.js +64 -5
  113. package/lib/hook-installer-core.js +2 -2
  114. package/lib/installation-instruction-generator.js +213 -495
  115. package/lib/installer.js +134 -56
  116. package/lib/oidc-command.js +740 -0
  117. package/lib/services/backup-list-service.js +226 -0
  118. package/lib/services/backup-service.js +230 -0
  119. package/lib/services/command-installer-service.js +217 -0
  120. package/lib/services/logger-service.js +201 -0
  121. package/lib/services/package-manager-service.js +319 -0
  122. package/lib/services/platform-instruction-service.js +294 -0
  123. package/lib/services/recovery-instruction-service.js +348 -0
  124. package/lib/services/restore-service.js +221 -0
  125. package/lib/setup-command.js +359 -0
  126. package/lib/setup-wizard.js +155 -262
  127. package/lib/uninstall-command.js +100 -0
  128. package/lib/utils/claude-path-config.js +184 -0
  129. package/lib/utils/file-system-utils.js +152 -0
  130. package/lib/utils.js +8 -4
  131. package/lib/verify-command.js +430 -0
  132. package/package.json +7 -3
  133. package/scripts/postinstall.js +172 -157
  134. package/subagents/debug-specialist.md +7 -0
  135. package/templates/README.md +115 -0
  136. package/templates/basic-settings.json +30 -0
  137. package/templates/comprehensive-settings.json +57 -0
  138. package/templates/global-claude.md +344 -0
  139. package/templates/hybrid-hook-config.yaml +132 -0
  140. package/templates/security-focused-settings.json +62 -0
  141. package/templates/subagent-hooks.yaml +188 -0
  142. package/lib/package-manager-service.js +0 -270
  143. package/subagents/debug-context.md +0 -197
@@ -0,0 +1,120 @@
1
+ ---
2
+ description: Create secure, isolated development environments for safe coding, testing, and experimentation
3
+ tags: [security, sandbox, isolation, containers, testing, development]
4
+ ---
5
+
6
+ Create and manage secure sandbox environments based on the arguments provided in $ARGUMENTS.
7
+
8
+ First, examine the current environment and security setup:
9
+ !which docker 2>/dev/null && docker --version || echo "Docker not available"
10
+ !which podman 2>/dev/null && podman --version || echo "Podman not available"
11
+ !ls -la Dockerfile docker-compose.yml 2>/dev/null | head -2
12
+ !ps aux | grep -E "(docker|podman|sandbox)" | grep -v grep | head -3
13
+
14
+ Based on $ARGUMENTS, perform the appropriate sandbox operation:
15
+
16
+ ## 1. Sandbox Creation and Setup
17
+
18
+ If creating sandbox environments (--create, --template, --isolated, --container):
19
+ !docker info 2>/dev/null | head -5 || echo "Docker daemon not running"
20
+ !ls -la .devcontainer/ .docker/ sandbox/ 2>/dev/null | head -3
21
+ !find . -name "Dockerfile*" -o -name "docker-compose*" | head -3
22
+ !id -u 2>/dev/null && echo "Current user ID available" || echo "User ID not available"
23
+
24
+ Create secure environments:
25
+ - Containerized development sandboxes
26
+ - Isolated network environments
27
+ - Resource-limited execution spaces
28
+ - Template-based sandbox creation
29
+ - Security-hardened environments
30
+
31
+ ## 2. Environment Configuration
32
+
33
+ If configuring sandbox (--configure, --resources, --network, --storage):
34
+ !docker network ls 2>/dev/null || echo "Docker networks not available"
35
+ !df -h 2>/dev/null | head -5
36
+ !free -h 2>/dev/null || vm_stat 2>/dev/null || echo "Memory info not available"
37
+ !ulimit -a | head -10
38
+
39
+ Configure sandbox parameters:
40
+ - Resource limits and quotas
41
+ - Network isolation policies
42
+ - Storage access controls
43
+ - Security constraints
44
+ - Environment variables
45
+
46
+ ## 3. Security and Isolation
47
+
48
+ If managing isolation (--isolate, --security-scan, --validate, --compliance):
49
+ !ps aux --forest 2>/dev/null | head -10 || ps aux | head -10
50
+ !netstat -tuln 2>/dev/null | head -5 || ss -tuln | head -5
51
+ !find /proc -name "*namespace*" 2>/dev/null | head -3 || echo "Namespace info not accessible"
52
+ !which firejail 2>/dev/null && firejail --version || echo "Firejail not available"
53
+
54
+ Implement security measures:
55
+ - Process and namespace isolation
56
+ - Network traffic filtering
57
+ - File system access controls
58
+ - Security vulnerability scanning
59
+ - Compliance validation
60
+
61
+ ## 4. Monitoring and Logging
62
+
63
+ If monitoring sandbox (--monitor, --logs, --alerts, --forensics):
64
+ !docker logs --help 2>/dev/null | head -1 || echo "Docker logging not available"
65
+ !find /var/log -name "*docker*" -o -name "*container*" 2>/dev/null | head -3
66
+ !journalctl --version 2>/dev/null || echo "systemd journal not available"
67
+ !ps aux | grep -E "(syslog|rsyslog|journald)" | grep -v grep
68
+
69
+ Set up monitoring:
70
+ - Activity and behavior monitoring
71
+ - Security event logging
72
+ - Resource usage tracking
73
+ - Anomaly detection
74
+ - Forensic evidence collection
75
+
76
+ ## 5. Resource and Access Management
77
+
78
+ If managing resources (--cleanup, --backup, --restore, --access, --permissions):
79
+ !docker system df 2>/dev/null || echo "Docker system info not available"
80
+ !find . -name "*backup*" -o -name "*snapshot*" | head -5 2>/dev/null
81
+ !ls -la /tmp/sandbox* /var/tmp/sandbox* 2>/dev/null | head -5
82
+ !which tar 2>/dev/null && echo "Backup tools available" || echo "Backup tools not available"
83
+
84
+ Manage sandbox lifecycle:
85
+ - Resource cleanup and optimization
86
+ - Data backup and restoration
87
+ - Access control and permissions
88
+ - User and authentication management
89
+ - Environment lifecycle management
90
+
91
+ Think step by step about sandbox security requirements and provide:
92
+
93
+ 1. **Security Assessment**:
94
+ - Current environment security posture
95
+ - Isolation requirements and constraints
96
+ - Risk assessment and threat modeling
97
+ - Compliance and regulatory considerations
98
+
99
+ 2. **Sandbox Strategy**:
100
+ - Isolation level selection and implementation
101
+ - Resource allocation and limits
102
+ - Network security and access controls
103
+ - Monitoring and logging requirements
104
+
105
+ 3. **Implementation Plan**:
106
+ - Sandbox creation and configuration
107
+ - Security controls and validation
108
+ - Monitoring and alerting setup
109
+ - Backup and recovery procedures
110
+
111
+ 4. **Operational Security**:
112
+ - Access management and authentication
113
+ - Incident response procedures
114
+ - Forensic capabilities and evidence collection
115
+ - Continuous security improvement
116
+
117
+ Generate comprehensive sandbox security framework with isolation controls, monitoring capabilities, access management, and operational procedures.
118
+
119
+ If no specific operation is provided, assess current environment security and recommend sandbox implementation strategy based on security requirements and available technologies.
120
+
@@ -0,0 +1,102 @@
1
+ # `/xscan` - Repository Scanning Command
2
+
3
+ Comprehensive repository scanning for patterns, security issues, compliance violations, and code quality problems.
4
+
5
+ ## Purpose
6
+ Advanced repository scanning capabilities for finding specific patterns, security vulnerabilities, compliance issues, and infrastructure components.
7
+
8
+ ## Options
9
+
10
+ ### Pattern Scanning
11
+ ```bash
12
+ /xscan --patterns <regex> # Scan for specific patterns using regex
13
+ /xscan --text <string> # Search for specific text strings
14
+ /xscan --files <pattern> # Find files matching pattern
15
+ /xscan --extensions <ext> # Scan files by extension
16
+ /xscan --keywords <terms> # Search for specific keywords
17
+ ```
18
+
19
+ ### Security Scanning
20
+ ```bash
21
+ /xscan --secrets # Scan for hardcoded secrets and credentials
22
+ /xscan --vulnerabilities # Scan for known vulnerabilities
23
+ /xscan --sensitive-data # Scan for sensitive data patterns
24
+ /xscan --api-keys # Scan for exposed API keys
25
+ /xscan --passwords # Scan for hardcoded passwords
26
+ ```
27
+
28
+ ### Infrastructure Scanning
29
+ ```bash
30
+ /xscan --roles # Find IAM roles and policies
31
+ /xscan --iac-files # Find Infrastructure as Code files
32
+ /xscan --docker # Scan Docker files and configurations
33
+ /xscan --kubernetes # Scan Kubernetes manifests
34
+ /xscan --terraform # Scan Terraform configurations
35
+ ```
36
+
37
+ ### Compliance Scanning
38
+ ```bash
39
+ /xscan --compliance <standard> # Scan for compliance violations
40
+ /xscan --license # Scan for license compliance issues
41
+ /xscan --copyright # Check copyright compliance
42
+ /xscan --gdpr # Scan for GDPR compliance issues
43
+ /xscan --pii # Scan for personally identifiable information
44
+ ```
45
+
46
+ ### Code Quality Scanning
47
+ ```bash
48
+ /xscan --code-smells # Scan for code smell patterns
49
+ /xscan --todo-comments # Find TODO and FIXME comments
50
+ /xscan --deprecated # Find deprecated code usage
51
+ /xscan --duplicate # Find duplicate code blocks
52
+ /xscan --complexity # Scan for overly complex code
53
+ ```
54
+
55
+ ### Dependency Scanning
56
+ ```bash
57
+ /xscan --dependencies # Scan project dependencies
58
+ /xscan --outdated # Find outdated dependencies
59
+ /xscan --licenses # Scan dependency licenses
60
+ /xscan --security-advisories # Check for security advisories
61
+ /xscan --package-vulnerabilities # Scan for vulnerable packages
62
+ ```
63
+
64
+ ### Configuration Scanning
65
+ ```bash
66
+ /xscan --config-files # Find configuration files
67
+ /xscan --env-files # Scan environment files
68
+ /xscan --database-configs # Find database configurations
69
+ /xscan --api-configs # Scan API configurations
70
+ /xscan --deployment-configs # Find deployment configurations
71
+ ```
72
+
73
+ Think step by step about scanning requirements and provide:
74
+
75
+ 1. **Scan Strategy**:
76
+ - Repository structure and scope analysis
77
+ - Scanning pattern selection and prioritization
78
+ - Performance and efficiency considerations
79
+ - False positive mitigation strategies
80
+
81
+ 2. **Security Assessment**:
82
+ - Vulnerability identification and classification
83
+ - Risk assessment and impact analysis
84
+ - Security configuration evaluation
85
+ - Compliance gap identification
86
+
87
+ 3. **Analysis Framework**:
88
+ - Pattern matching and search optimization
89
+ - Multi-dimensional scanning approach
90
+ - Result correlation and validation
91
+ - Trend analysis and historical comparison
92
+
93
+ 4. **Reporting and Remediation**:
94
+ - Comprehensive finding documentation
95
+ - Prioritized remediation recommendations
96
+ - Compliance mapping and validation
97
+ - Continuous monitoring setup
98
+
99
+ Generate comprehensive scanning analysis with pattern detection, security assessment, compliance validation, and remediation guidance.
100
+
101
+ If no specific operation is provided, perform comprehensive repository health scan and recommend scanning strategy based on detected languages, frameworks, and security requirements.
102
+
@@ -0,0 +1,123 @@
1
+ ---
2
+ description: Comprehensive development environment setup with automated installation and configuration
3
+ tags: [setup, environment, configuration, dependencies, tools, automation]
4
+ ---
5
+
6
+ Set up and configure development environments based on the arguments provided in $ARGUMENTS.
7
+
8
+ First, detect the current system and environment:
9
+ !uname -s
10
+ !ls -la | grep -E "(package.json|requirements.txt|pyproject.toml|Cargo.toml|go.mod)"
11
+ !python3 --version 2>/dev/null || python --version 2>/dev/null || echo "Python not available"
12
+
13
+ Based on $ARGUMENTS, perform the appropriate setup operation:
14
+
15
+ ## 1. Environment Setup
16
+
17
+ If setting up environment (--env, --dev, --test, --production):
18
+ !which brew 2>/dev/null || which apt-get 2>/dev/null || which yum 2>/dev/null || echo "No package manager detected"
19
+ !docker --version 2>/dev/null || echo "Docker not installed"
20
+ !git --version 2>/dev/null || echo "Git not installed"
21
+
22
+ Set up comprehensive development environment:
23
+ - Detect and configure package managers
24
+ - Install essential development tools
25
+ - Configure version control systems
26
+ - Set up containerization tools
27
+ - Install language-specific tools and runtimes
28
+
29
+ ## 2. Dependency Management
30
+
31
+ If managing dependencies (--deps, --python, --node):
32
+ !find . -name "requirements.txt" -o -name "package.json" -o -name "pyproject.toml" | head -5
33
+ !python3 -m pip --version 2>/dev/null || echo "pip not available"
34
+ !npm --version 2>/dev/null || echo "npm not available"
35
+
36
+ Install and manage project dependencies:
37
+ - Python: pip, poetry, conda environments
38
+ - Node.js: npm, yarn, pnpm package management
39
+ - Language-specific dependency resolution
40
+ - Virtual environment configuration
41
+ - Dependency security scanning
42
+
43
+ ## 3. Tool Installation and Configuration
44
+
45
+ If installing tools (--tools, --cli-tools, --editors):
46
+ !which code 2>/dev/null || which vim 2>/dev/null || echo "No editors detected"
47
+ !which kubectl 2>/dev/null || echo "Kubernetes tools not installed"
48
+ !which terraform 2>/dev/null || echo "Terraform not installed"
49
+
50
+ Install and configure development tools:
51
+ - Code editors and IDEs
52
+ - Command-line utilities
53
+ - Infrastructure tools
54
+ - Security scanners
55
+ - Monitoring and debugging tools
56
+
57
+ ## 4. Validation and Health Checks
58
+
59
+ If validating setup (--validate, --health-check, --doctor):
60
+ !python3 -c "import sys; print(f'Python {sys.version}')" 2>/dev/null || echo "Python validation failed"
61
+ !node --version 2>/dev/null || echo "Node.js validation failed"
62
+ !docker ps 2>/dev/null || echo "Docker validation failed"
63
+
64
+ Perform comprehensive environment validation:
65
+ - Verify tool installations and versions
66
+ - Check configuration file validity
67
+ - Test network connectivity
68
+ - Validate security settings
69
+ - Generate health report
70
+
71
+ ## 5. Platform-Specific Setup
72
+
73
+ If setting up platform-specific environment (--macos, --linux, --windows):
74
+ !sw_vers 2>/dev/null || lsb_release -a 2>/dev/null || systeminfo 2>/dev/null || echo "Platform detection failed"
75
+ !which brew 2>/dev/null && echo "macOS detected" || echo "Non-macOS platform"
76
+
77
+ Configure platform-specific tools and settings:
78
+ - macOS: Homebrew, Xcode tools, system preferences
79
+ - Linux: Package managers, development libraries
80
+ - Windows: WSL, PowerShell, development tools
81
+ - Cross-platform: Environment standardization
82
+
83
+ ## 6. Project-Specific Configuration
84
+
85
+ If setting up project-specific environment (--web, --api, --data):
86
+ @package.json 2>/dev/null || @requirements.txt 2>/dev/null || echo "No project files detected"
87
+ !find . -name "Dockerfile" -o -name "docker-compose.yml" | head -3
88
+
89
+ Configure project-specific development environment:
90
+ - Web development: Frontend frameworks, build tools
91
+ - API development: Backend frameworks, testing tools
92
+ - Data science: Jupyter, data libraries, visualization
93
+ - Mobile development: Platform SDKs, simulators
94
+
95
+ Think step by step about environment setup requirements and provide:
96
+
97
+ 1. **Environment Analysis**:
98
+ - Current system and platform detection
99
+ - Existing tool and dependency inventory
100
+ - Configuration file validation
101
+ - Environment variable assessment
102
+
103
+ 2. **Setup Strategy**:
104
+ - Platform-specific installation approach
105
+ - Dependency resolution and management
106
+ - Tool configuration and integration
107
+ - Security and compliance setup
108
+
109
+ 3. **Validation and Testing**:
110
+ - Installation verification procedures
111
+ - Configuration testing protocols
112
+ - Health check implementations
113
+ - Performance benchmarking
114
+
115
+ 4. **Documentation and Maintenance**:
116
+ - Setup documentation generation
117
+ - Troubleshooting guides
118
+ - Update and maintenance procedures
119
+ - Team onboarding workflows
120
+
121
+ Generate comprehensive environment setup with automated installation, configuration validation, and complete documentation for team collaboration and maintenance.
122
+
123
+ If no specific operation is provided, perform complete environment analysis and recommend setup priorities based on project requirements and current system state.
@@ -0,0 +1,116 @@
1
+ ---
2
+ description: Generate code templates, boilerplate, and standardized patterns for consistent development practices
3
+ tags: [templates, boilerplate, code-generation, patterns, scaffolding]
4
+ ---
5
+
6
+ Generate templates and boilerplate code based on the arguments provided in $ARGUMENTS.
7
+
8
+ First, examine the current project structure to understand context:
9
+ !ls -la package.json requirements.txt setup.py pyproject.toml 2>/dev/null | head -3
10
+ !find . -name "*.template" -o -name "*.tmpl" -o -name "*template*" | head -5 2>/dev/null
11
+ !ls -la templates/ scaffolds/ generators/ 2>/dev/null || echo "No template directories found"
12
+ !git remote -v 2>/dev/null | head -1 || echo "No git remote configured"
13
+
14
+ Based on $ARGUMENTS, perform the appropriate template generation operation:
15
+
16
+ ## 1. Code Template Generation
17
+
18
+ If generating code templates (--code, --component, --service, --model):
19
+ !find . -name "*.py" -o -name "*.js" -o -name "*.ts" | head -10
20
+ !ls -la src/ app/ lib/ components/ services/ models/ 2>/dev/null | head -5
21
+ !which python 2>/dev/null && python --version || echo "Python not available"
22
+ !which node 2>/dev/null && node --version || echo "Node.js not available"
23
+
24
+ Generate code templates:
25
+ - Class and function templates
26
+ - Component and service templates
27
+ - Data model and schema templates
28
+ - API controller and endpoint templates
29
+ - Module and package structures
30
+
31
+ ## 2. Test Template Generation
32
+
33
+ If generating test templates (--test, --mock, --fixture, --spec-test):
34
+ !find . -name "*test*" -o -name "*spec*" | head -10 2>/dev/null
35
+ !ls -la tests/ test/ spec/ __tests__/ 2>/dev/null | head -3
36
+ !python -c "import pytest; print('pytest available')" 2>/dev/null || npm test --version 2>/dev/null || echo "No test framework detected"
37
+
38
+ Generate test templates:
39
+ - Unit and integration test templates
40
+ - Mock object and service templates
41
+ - Test fixture and data templates
42
+ - Assertion and expectation templates
43
+ - Specification-driven test templates
44
+
45
+ ## 3. Project Structure Templates
46
+
47
+ If generating project templates (--project, --microservice, --api, --library):
48
+ !ls -la README.md LICENSE .gitignore 2>/dev/null | head -3
49
+ !find . -name "Dockerfile" -o -name "docker-compose.yml" | head -2
50
+ !ls -la .github/ .gitlab/ .circleci/ 2>/dev/null | head -2
51
+
52
+ Generate project structures:
53
+ - Complete project scaffolding
54
+ - Microservice architecture templates
55
+ - API and web service templates
56
+ - Library and package templates
57
+ - CLI application templates
58
+
59
+ ## 4. Configuration Templates
60
+
61
+ If generating configuration templates (--config, --docker, --ci-cd, --infrastructure):
62
+ !find . -name "*.yml" -o -name "*.yaml" -o -name "*.json" | grep -E "(config|docker|ci|cd)" | head -5
63
+ !ls -la config/ configs/ .env* docker-compose.yml Dockerfile 2>/dev/null | head -5
64
+ !which docker 2>/dev/null && docker --version || echo "Docker not available"
65
+
66
+ Generate configuration templates:
67
+ - Application configuration files
68
+ - Docker and container templates
69
+ - CI/CD pipeline configurations
70
+ - Infrastructure as code templates
71
+ - Environment-specific configurations
72
+
73
+ ## 5. Documentation Templates
74
+
75
+ If generating documentation templates (--docs, --readme, --api-docs, --architecture):
76
+ !find . -name "*.md" | head -10
77
+ !ls -la docs/ documentation/ README.md 2>/dev/null | head -3
78
+ !find . -name "openapi.yml" -o -name "swagger.yml" -o -name "api.yml" | head -2 2>/dev/null
79
+
80
+ Generate documentation templates:
81
+ - README and project documentation
82
+ - API documentation templates
83
+ - Architecture documentation
84
+ - User guides and tutorials
85
+ - Technical specifications
86
+
87
+ Think step by step about template generation requirements and provide:
88
+
89
+ 1. **Template Analysis**:
90
+ - Current project structure assessment
91
+ - Language and framework detection
92
+ - Existing template identification
93
+ - Template requirements gathering
94
+
95
+ 2. **Generation Strategy**:
96
+ - Template type selection and customization
97
+ - Variable substitution and parameterization
98
+ - Best practice integration
99
+ - Consistency and standardization
100
+
101
+ 3. **Implementation Plan**:
102
+ - Template creation and validation
103
+ - Integration with existing codebase
104
+ - Documentation and usage guidelines
105
+ - Maintenance and update procedures
106
+
107
+ 4. **Quality Assurance**:
108
+ - Template testing and validation
109
+ - Code quality and standard compliance
110
+ - Reusability and maintainability
111
+ - Team adoption and feedback
112
+
113
+ Generate comprehensive templates with proper structure, documentation, best practices, and customization options.
114
+
115
+ If no specific operation is provided, analyze current project structure and recommend appropriate template generation strategy based on detected languages, frameworks, and project patterns.
116
+
@@ -0,0 +1,212 @@
1
+ # `/xtrace` - SpecDriven AI Traceability Analysis
2
+
3
+ Comprehensive traceability tracking and analysis for SpecDriven AI development with end-to-end requirement tracking.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ /xtrace --spec <spec-id> # Trace specification to implementation
9
+ /xtrace --test <test-name> # Trace test to specifications
10
+ /xtrace --code <file> # Trace code to requirements
11
+ /xtrace --coverage # Traceability coverage analysis
12
+ /xtrace --gaps # Identify traceability gaps
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ### `--spec <spec-id>`
18
+ Trace specification through implementation chain.
19
+
20
+ **Examples:**
21
+ ```bash
22
+ /xtrace --spec cli1a # Full trace for specification cli1a
23
+ /xtrace --spec auth2c --tests # Show implementing tests
24
+ /xtrace --spec api3b --code # Show implementing code
25
+ /xtrace --spec cli1a --commits # Show related commits
26
+ ```
27
+
28
+ ### `--test <test-name>`
29
+ Trace test back to originating specifications.
30
+
31
+ **Examples:**
32
+ ```bash
33
+ /xtrace --test test_user_auth # Trace test to specifications
34
+ /xtrace --test TestCLIInterface --coverage
35
+ /xtrace --test test_api_validation --authority
36
+ ```
37
+
38
+ ### `--code <file>`
39
+ Trace code implementation to requirements.
40
+
41
+ **Examples:**
42
+ ```bash
43
+ /xtrace --code src/auth.py # Trace file to specifications
44
+ /xtrace --code src/cli/ --recursive # Trace directory
45
+ /xtrace --code --changed # Trace recent changes
46
+ ```
47
+
48
+ ### `--coverage`
49
+ Analyze traceability coverage across the project.
50
+
51
+ **Examples:**
52
+ ```bash
53
+ /xtrace --coverage # Overall traceability coverage
54
+ /xtrace --coverage --authority system # System-level coverage
55
+ /xtrace --coverage --component auth # Component coverage
56
+ /xtrace --coverage --gaps # Coverage gap analysis
57
+ ```
58
+
59
+ ### `--gaps`
60
+ Identify and analyze traceability gaps.
61
+
62
+ **Examples:**
63
+ ```bash
64
+ /xtrace --gaps # All traceability gaps
65
+ /xtrace --gaps --specs # Specifications without tests
66
+ /xtrace --gaps --tests # Tests without specifications
67
+ /xtrace --gaps --critical # Critical authority gaps
68
+ ```
69
+
70
+ ## SpecDriven AI Traceability
71
+
72
+ ### Specification Traceability
73
+ - **Forward Tracing**: Specification → Tests → Code → Commits
74
+ - **Backward Tracing**: Code → Tests → Specifications → Requirements
75
+ - **Authority Tracking**: Authority level propagation through chain
76
+ - **Coverage Validation**: Ensure all specifications have implementations
77
+
78
+ ### Test Traceability
79
+ - **Test-to-Spec Mapping**: Direct links between tests and specifications
80
+ - **Coverage Tracking**: Which specifications are tested
81
+ - **Authority Validation**: Test authority matches specification authority
82
+ - **Gap Identification**: Untested specifications
83
+
84
+ ### Code Traceability
85
+ - **Implementation Tracking**: Code implementing specific specifications
86
+ - **Change Impact**: How code changes affect specifications
87
+ - **Commit Traceability**: Commits implementing specifications
88
+ - **Review Traceability**: Code reviews linked to specifications
89
+
90
+ ## Traceability Matrix
91
+
92
+ ### Specification → Implementation Matrix
93
+ ```
94
+ ┌─────────────┬──────────────┬──────────────┬──────────────┐
95
+ │ Spec ID │ Tests │ Code │ Coverage │
96
+ ├─────────────┼──────────────┼──────────────┼──────────────┤
97
+ │ cli1a │ ✓ Complete │ ✓ Complete │ 95% │
98
+ │ auth2c │ ✓ Complete │ ⚠ Partial │ 70% │
99
+ │ api3b │ ✗ Missing │ ✗ Missing │ 0% │
100
+ └─────────────┴──────────────┴──────────────┴──────────────┘
101
+ ```
102
+
103
+ ### Authority Level Traceability
104
+ ```
105
+ ┌─────────────┬──────────────┬──────────────┬──────────────┐
106
+ │ Authority │ Specs │ Tests │ Implementation│
107
+ ├─────────────┼──────────────┼──────────────┼──────────────┤
108
+ │ System │ 12 │ 11 (92%) │ 10 (83%) │
109
+ │ Platform │ 45 │ 42 (93%) │ 38 (84%) │
110
+ │ Developer │ 123 │ 118 (96%) │ 115 (93%) │
111
+ └─────────────┴──────────────┴──────────────┴──────────────┘
112
+ ```
113
+
114
+ ## Advanced Traceability Analysis
115
+
116
+ ### Impact Analysis
117
+ - **Change Impact**: How specification changes affect implementation
118
+ - **Ripple Effect**: Cascading effects of requirement changes
119
+ - **Dependency Mapping**: Inter-specification dependencies
120
+ - **Risk Assessment**: Risk of specification changes
121
+
122
+ ### Coverage Analysis
123
+ - **Specification Coverage**: Percentage of specs with tests
124
+ - **Implementation Coverage**: Percentage of specs with code
125
+ - **Authority Coverage**: Coverage breakdown by authority level
126
+ - **Component Coverage**: Coverage by system component
127
+
128
+ ### Gap Analysis
129
+ - **Missing Tests**: Specifications without implementing tests
130
+ - **Missing Implementation**: Specifications without code
131
+ - **Orphaned Tests**: Tests without linked specifications
132
+ - **Orphaned Code**: Code without specification links
133
+
134
+ ## Traceability Metrics
135
+
136
+ ### Coverage Metrics
137
+ - **Forward Coverage**: Specs → Tests → Code completion rate
138
+ - **Backward Coverage**: Code → Specs linkage rate
139
+ - **Authority Compliance**: Authority level consistency rate
140
+ - **Update Synchronization**: Spec-implementation synchronization rate
141
+
142
+ ### Quality Metrics
143
+ - **Link Quality**: Strength and accuracy of traceability links
144
+ - **Maintenance Rate**: How well links are maintained
145
+ - **Automation Rate**: Percentage of automated traceability
146
+ - **Validation Rate**: Regular traceability validation frequency
147
+
148
+ ### Process Metrics
149
+ - **Traceability Velocity**: Speed of establishing traceability
150
+ - **Gap Resolution Time**: Time to resolve traceability gaps
151
+ - **Review Coverage**: Traceability review completeness
152
+ - **Compliance Rate**: Adherence to traceability standards
153
+
154
+ ## Visualization
155
+
156
+ ### Traceability Graphs
157
+ - **Dependency Graphs**: Visual representation of spec dependencies
158
+ - **Coverage Heatmaps**: Visual coverage analysis
159
+ - **Impact Diagrams**: Change impact visualization
160
+ - **Gap Analysis Charts**: Visual gap identification
161
+
162
+ ### Interactive Exploration
163
+ - **Drill-Down Navigation**: Navigate through traceability chains
164
+ - **Filter Views**: Filter by authority, component, or status
165
+ - **Search Capabilities**: Find specific traceability relationships
166
+ - **Export Options**: Export traceability data
167
+
168
+ ## Automated Traceability
169
+
170
+ ### Link Detection
171
+ - **Comment Parsing**: Extract specification IDs from code comments
172
+ - **Test Name Analysis**: Identify specs from test naming patterns
173
+ - **Commit Message Analysis**: Extract spec references from commits
174
+ - **Documentation Scanning**: Find spec references in documentation
175
+
176
+ ### Link Validation
177
+ - **Existence Validation**: Verify linked specifications exist
178
+ - **Format Validation**: Check specification ID format compliance
179
+ - **Authority Validation**: Ensure authority level consistency
180
+ - **Scope Validation**: Verify implementation scope matches specification
181
+
182
+ ### Maintenance Automation
183
+ - **Broken Link Detection**: Identify and report broken links
184
+ - **Orphan Detection**: Find orphaned code and tests
185
+ - **Update Notifications**: Alert when specifications change
186
+ - **Sync Validation**: Ensure implementation stays in sync
187
+
188
+ ## Integration
189
+
190
+ - **Specifications**: Deep integration with `/xspec` for specification management
191
+ - **Testing**: Works with `/xtest` for test traceability
192
+ - **Coverage**: Uses `/xcoverage` for dual coverage tracking
193
+ - **Quality**: Integrates with `/xquality` for quality validation
194
+ - **Version Control**: Tracks commits and changes
195
+
196
+ ## Compliance Reporting
197
+
198
+ ### Regulatory Compliance
199
+ - **Audit Trails**: Complete audit trail from requirement to implementation
200
+ - **Change Documentation**: Document all requirement changes
201
+ - **Approval Tracking**: Track specification approvals
202
+ - **Compliance Metrics**: Measure compliance with standards
203
+
204
+ ### Quality Assurance
205
+ - **Review Traceability**: Link code reviews to specifications
206
+ - **Testing Traceability**: Link test results to requirements
207
+ - **Defect Traceability**: Link bugs to specifications
208
+ - **Resolution Tracking**: Track issue resolution to specs
209
+
210
+ ## Output
211
+
212
+ Traceability matrices, coverage reports, gap analyses, impact assessments, and interactive traceability visualizations.