@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,130 @@
1
+ ---
2
+ description: Interactive debugging support with error analysis and fix suggestions - integrates with Debug Specialist sub-agent for complex issues
3
+ tags: [debugging, troubleshooting, errors, sub-agent]
4
+ ---
5
+
6
+ Debug and analyze errors with root cause identification and fix suggestions. For complex debugging sessions, automatically delegates to the Debug Specialist sub-agent for persistent context and deep analysis.
7
+
8
+ ## Usage Examples
9
+
10
+ **Analyze recent errors:**
11
+ ```
12
+ /xdebug
13
+ ```
14
+
15
+ **Debug specific error:**
16
+ ```
17
+ /xdebug "ImportError: No module named 'requests'"
18
+ ```
19
+
20
+ **Debug failing test:**
21
+ ```
22
+ /xdebug test_user_login
23
+ ```
24
+
25
+ **Help and debugging options:**
26
+ ```
27
+ /xdebug --help
28
+ ```
29
+
30
+ ## Implementation
31
+
32
+ If $ARGUMENTS contains "help" or "--help":
33
+ Display this usage information and exit.
34
+
35
+ Parse the error or issue from $ARGUMENTS. If no specific error is provided, check for recent errors:
36
+ !tail -50 *.log 2>/dev/null | grep -i "error\|exception\|failed" || echo "No recent errors in log files"
37
+
38
+ **Decision Point: Quick Analysis vs Deep Debugging**
39
+
40
+ Determine if this requires simple analysis or complex debugging session:
41
+
42
+ **Simple/Quick Issues** (handle directly):
43
+ - Single error messages with clear solutions
44
+ - Common environment issues (missing dependencies, path problems)
45
+ - Basic syntax errors
46
+ - Simple configuration problems
47
+
48
+ **Complex Issues** (delegate to Debug Specialist sub-agent):
49
+ - Multi-step debugging requiring persistent context
50
+ - Performance problems needing profiling
51
+ - Intermittent issues requiring investigation over time
52
+ - Complex stack traces with multiple potential causes
53
+ - Issues requiring environment analysis and hypothesis testing
54
+
55
+ **For Complex Issues:** Use Task tool to delegate to debug-specialist:
56
+ ```
57
+ Use the Task tool with:
58
+ description: "Complex debugging analysis"
59
+ prompt: "Acting as Debug Specialist sub-agent, analyze this error: [ERROR_DETAILS]. Provide comprehensive root cause analysis, systematic troubleshooting steps, and solution validation."
60
+ subagent_type: "debug-specialist"
61
+ ```
62
+
63
+ **For Simple Issues, continue with direct analysis:**
64
+
65
+ Based on the error context, perform the following debugging steps:
66
+
67
+ 1. **Error Classification**:
68
+ - Identify the error type (syntax, runtime, logic, configuration)
69
+ - Determine the severity and impact
70
+ - Check if this is a known issue pattern
71
+
72
+ 2. **Root Cause Analysis**:
73
+ - Trace the error back to its source
74
+ - Examine the stack trace if available
75
+ - Check related code sections using @<relevant_file> references
76
+ - Look for similar patterns in the codebase
77
+
78
+ 3. **Environmental Factors**:
79
+ - Check environment variables and configuration
80
+ - Verify dependencies are installed correctly
81
+ - Look for version mismatches
82
+
83
+ 4. **Test Isolation**:
84
+ - Identify which tests are failing
85
+ - Check if the error is reproducible
86
+ - Determine if it's environment-specific
87
+
88
+ For Python errors, gather additional context:
89
+ !python --version
90
+ !pip list | grep -E "(package1|package2)" 2>/dev/null
91
+
92
+ For JavaScript/Node errors:
93
+ !node --version
94
+ !npm list --depth=0 2>/dev/null
95
+
96
+ Think step by step about the debugging process:
97
+
98
+ 1. What is the exact error message and where does it occur?
99
+ 2. What are the possible causes based on the error type?
100
+ 3. What code changes or environmental factors might have triggered this?
101
+ 4. What are the most likely solutions?
102
+
103
+ Provide debugging assistance in this format:
104
+
105
+ ```
106
+ 🔍 DEBUG ANALYSIS
107
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
108
+ Error: [Error type and message]
109
+ Location: [File:line or component]
110
+
111
+ 📍 ROOT CAUSE
112
+ [Detailed explanation of why this error occurs]
113
+
114
+ 🔧 SUGGESTED FIX
115
+ [Step-by-step fix with code examples]
116
+
117
+ 📋 VERIFICATION
118
+ [Commands or steps to verify the fix works]
119
+
120
+ 💡 PREVENTION
121
+ [How to prevent this error in the future]
122
+ ```
123
+
124
+ If the error involves a specific file mentioned in the error message, examine it:
125
+ @<error_file_path>
126
+
127
+ For test failures, run relevant tests:
128
+ !python -m pytest <test_file> -v 2>/dev/null || npm test <test_file> 2>/dev/null
129
+
130
+ Provide specific, actionable debugging steps rather than generic advice.
@@ -0,0 +1,178 @@
1
+ ---
2
+ description: Generate and maintain comprehensive documentation from code
3
+ tags: [documentation, generation, maintenance]
4
+ ---
5
+
6
+ Generate and maintain documentation from code, keeping it in sync with implementation.
7
+
8
+ ## Usage Examples
9
+
10
+ **Basic documentation generation:**
11
+ ```
12
+ /xdocs
13
+ ```
14
+
15
+ **Generate API documentation:**
16
+ ```
17
+ /xdocs --api
18
+ ```
19
+
20
+ **Check documentation coverage:**
21
+ ```
22
+ /xdocs --check
23
+ ```
24
+
25
+ **Generate README:**
26
+ ```
27
+ /xdocs --readme
28
+ ```
29
+
30
+ **Help and options:**
31
+ ```
32
+ /xdocs --help
33
+ ```
34
+
35
+ ## Implementation
36
+
37
+ If $ARGUMENTS contains "help" or "--help":
38
+ Display this usage information and exit.
39
+
40
+ Parse documentation options from $ARGUMENTS (--generate, --api, --readme, --check, or specific module/file).
41
+
42
+ ## 1. Analyze Current Documentation
43
+
44
+ Check existing documentation:
45
+ !find . -name "*.md" | grep -v node_modules | head -20
46
+ !test -f README.md && echo "README exists" || echo "No README.md found"
47
+ !find . -name "*.py" -exec grep -l '"""' {} \; | wc -l
48
+
49
+ ## 2. Generate Documentation
50
+
51
+ Based on the arguments and project type, generate appropriate documentation.
52
+
53
+ For Python projects, extract docstrings:
54
+ !python -c "import ast; import os; [print(f'{f}: {len([n for n in ast.walk(ast.parse(open(f).read())) if isinstance(n, ast.FunctionDef) and ast.get_docstring(n)])} documented functions') for f in os.listdir('.') if f.endswith('.py')]" 2>/dev/null
55
+
56
+ For JavaScript/TypeScript projects:
57
+ !grep -E "^(export |const |function |class )" *.js *.ts 2>/dev/null | head -20
58
+
59
+ ## 3. API Documentation
60
+
61
+ If --api flag is present, analyze API endpoints:
62
+ !grep -r -E "@(app|router)\.(get|post|put|delete|patch)" . --include="*.py" 2>/dev/null | head -20
63
+ !grep -r -E "(app|router)\.(get|post|put|delete|patch)" . --include="*.js" 2>/dev/null | head -20
64
+
65
+ ## 4. Check Documentation Coverage
66
+
67
+ Count undocumented functions:
68
+ !find . -name "*.py" -exec grep -E "^def |^class " {} \; | wc -l
69
+ !find . -name "*.py" -exec grep -A1 -E "^def |^class " {} \; | grep '"""' | wc -l
70
+
71
+ Think step by step about documentation needs and:
72
+
73
+ 1. Identify what documentation is missing
74
+ 2. Generate appropriate documentation based on code analysis
75
+ 3. Create templates for missing documentation
76
+ 4. Ensure examples are included where helpful
77
+
78
+ Generate documentation in this format:
79
+
80
+ For README.md:
81
+ ```markdown
82
+ # Project Name
83
+
84
+ Brief description of what this project does.
85
+
86
+ ## Installation
87
+
88
+ ```bash
89
+ # Installation commands based on package.json or requirements.txt
90
+ ```
91
+
92
+ ## Usage
93
+
94
+ ```python
95
+ # Example usage based on main entry points
96
+ ```
97
+
98
+ ## API Reference
99
+
100
+ ### [Function/Class Name]
101
+ [Description from docstring or inferred from code]
102
+
103
+ **Parameters:**
104
+ - `param_name` (type): Description
105
+
106
+ **Returns:**
107
+ - type: Description
108
+
109
+ **Example:**
110
+ ```python
111
+ # Example usage
112
+ ```
113
+
114
+ ## Contributing
115
+
116
+ See CONTRIBUTING.md for details.
117
+
118
+ ## License
119
+
120
+ [License information]
121
+ ```
122
+
123
+ For API documentation:
124
+ ```markdown
125
+ # API Documentation
126
+
127
+ ## Endpoints
128
+
129
+ ### GET /endpoint
130
+ Description of what this endpoint does.
131
+
132
+ **Parameters:**
133
+ - `param` (query/path/body): Description
134
+
135
+ **Response:**
136
+ ```json
137
+ {
138
+ "field": "example"
139
+ }
140
+ ```
141
+
142
+ **Example:**
143
+ ```bash
144
+ curl -X GET http://localhost:8000/endpoint
145
+ ```
146
+ ```
147
+
148
+ If --check flag is present, generate a documentation coverage report:
149
+ ```
150
+ 📚 DOCUMENTATION COVERAGE REPORT
151
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
152
+ Overall Coverage: X%
153
+
154
+ ✅ DOCUMENTED (X/Y)
155
+ ─────────────────
156
+ ✓ module.py: X/Y functions
157
+ ✓ api.py: X/Y endpoints
158
+
159
+ ❌ MISSING DOCUMENTATION (X/Y)
160
+ ─────────────────────────────
161
+ ✗ utils.py: functionName (line X)
162
+ ✗ models.py: ClassName (line X)
163
+
164
+ 🔧 QUICK FIXES
165
+ ────────────
166
+ 1. Add docstring to functionName in utils.py
167
+ 2. Document ClassName in models.py
168
+ 3. Create API documentation for /endpoint
169
+
170
+ 📝 TEMPLATES TO ADD
171
+ ────────────────
172
+ - README.md sections: Usage, Examples
173
+ - API.md: Missing endpoint documentation
174
+ - CONTRIBUTING.md: Development setup
175
+ ```
176
+
177
+ If --generate flag with specific file, create documentation for that file.
178
+ If --update flag, update existing documentation to match code changes.
@@ -0,0 +1,94 @@
1
+ ---
2
+ description: Explore a codebase topic before making changes (read-only)
3
+ tags: [exploration, codebase, discovery, read-only]
4
+ ---
5
+
6
+ # Codebase Exploration
7
+
8
+ Comprehensively search the codebase for a topic before making any changes. Read-only — no files are modified.
9
+
10
+ ## Usage Examples
11
+
12
+ **Explore a topic:**
13
+ ```
14
+ /xexplore authentication
15
+ ```
16
+
17
+ **Explore a specific area:**
18
+ ```
19
+ /xexplore database migrations
20
+ ```
21
+
22
+ **Help and options:**
23
+ ```
24
+ /xexplore help
25
+ /xexplore --help
26
+ ```
27
+
28
+ ## Implementation
29
+
30
+ If $ARGUMENTS contains "help" or "--help":
31
+ Display this usage information and exit.
32
+
33
+ If $ARGUMENTS is empty:
34
+ Tell the user: "Please provide a topic to explore. Example: /xexplore authentication"
35
+ Stop and wait for input.
36
+
37
+ ### Step 1: Search by File Name
38
+
39
+ Find files whose names match the topic:
40
+
41
+ ```bash
42
+ find . -iname "*$ARGUMENTS*" ! -path "*/node_modules/*" ! -path "*/.git/*" ! -path "*/vendor/*" 2>/dev/null | head -30
43
+ ```
44
+
45
+ ### Step 2: Search by Content
46
+
47
+ Grep the codebase for the topic keyword:
48
+ - Search all source files for content matching $ARGUMENTS
49
+ - Capture file paths and line numbers for key matches
50
+ - Limit to first 20 matches per file to avoid flooding
51
+
52
+ ### Step 3: Search Configuration
53
+
54
+ Check config files specifically:
55
+ - `*.json`, `*.yaml`, `*.yml`, `*.toml`, `*.env*`, `*.ini`
56
+ - Look for the topic in config values, keys, and comments
57
+
58
+ ### Step 4: Search Tests
59
+
60
+ Find test files related to the topic:
61
+ - Patterns: `*test*`, `*spec*`, `__tests__/`
62
+ - Check both file names and file content
63
+
64
+ ### Step 5: Search Documentation
65
+
66
+ Check docs for the topic:
67
+ - `*.md` files, `docs/` directory, `README*`
68
+ - Wiki or guide references
69
+
70
+ ### Step 6: Report
71
+
72
+ Present findings in a structured inventory:
73
+
74
+ ```
75
+ ## Exploration Report: [topic]
76
+
77
+ ### Source Files (N found)
78
+ - path/to/file.ts:42 — [matching line preview]
79
+
80
+ ### Tests (N found)
81
+ - tests/path/to/test.ts:15 — [matching line preview]
82
+
83
+ ### Configuration (N found)
84
+ - config/settings.json:8 — [matching line preview]
85
+
86
+ ### Documentation (N found)
87
+ - docs/guide.md:23 — [matching line preview]
88
+ ```
89
+
90
+ If nothing is found:
91
+ - Tell the user: "No matches found for '[topic]'."
92
+ - Suggest broadening the search or trying alternate terms.
93
+
94
+ **Do NOT make any changes to any files. This command is read-only.**
@@ -0,0 +1,149 @@
1
+ ---
2
+ description: Automate git workflow - stage, commit with smart messages, and push to specified branch
3
+ tags: [git, commit, automation, workflow, branching]
4
+ ---
5
+
6
+ Automate the complete git workflow with intelligent commit message generation and branch management.
7
+
8
+ ## Usage Examples
9
+
10
+ **Basic automated workflow:**
11
+ ```
12
+ /xgit
13
+ ```
14
+
15
+ **Push to specific branch:**
16
+ ```
17
+ /xgit --branch feature-123
18
+ ```
19
+
20
+ **Create new branch and push:**
21
+ ```
22
+ /xgit --create-branch fix-bug
23
+ ```
24
+
25
+ **Custom commit message:**
26
+ ```
27
+ /xgit --message "Custom commit"
28
+ ```
29
+
30
+ **Help and options:**
31
+ ```
32
+ /xgit --help
33
+ ```
34
+
35
+ ## Implementation
36
+
37
+ If $ARGUMENTS contains "help" or "--help":
38
+ Display this usage information and exit.
39
+
40
+ First, verify this is a git repository and sync with remote:
41
+ !git rev-parse --git-dir 2>/dev/null || echo "Not a git repository"
42
+ !git pull 2>/dev/null || echo "Pull failed or no upstream configured"
43
+ !git status --porcelain
44
+
45
+ Parse arguments to determine branch operations and custom messages:
46
+ Based on $ARGUMENTS, extract:
47
+ - **Target branch**: `--branch <branch-name>` or current branch if not specified
48
+ - **Branch creation**: `--create-branch <branch-name>` to create and switch to new branch
49
+ - **Custom message**: `--message "<message>"` to override automatic commit message generation
50
+ - **Force push**: `--force` to enable force push (use with caution)
51
+
52
+ Check if there are any changes to commit:
53
+ !git diff --quiet && git diff --cached --quiet && [ -z "$(git ls-files --others --exclude-standard)" ] && echo "No changes to commit" || echo "Changes detected"
54
+
55
+ If no changes are found, exit. Otherwise, stage all changes:
56
+ !git add .
57
+
58
+ ## Branch Management
59
+
60
+ Handle branch operations based on arguments:
61
+
62
+ **If creating new branch (--create-branch):**
63
+ !git checkout -b "${TARGET_BRANCH}" 2>/dev/null || echo "Branch creation failed"
64
+ !echo "Created and switched to new branch: ${TARGET_BRANCH}"
65
+
66
+ **If switching to existing branch (--branch):**
67
+ !git pull 2>/dev/null || echo "Pull failed for current branch"
68
+ !git checkout "${TARGET_BRANCH}" 2>/dev/null || echo "Branch switch failed - branch may not exist"
69
+ !git pull 2>/dev/null || echo "Pull failed for target branch"
70
+ !echo "Switched to branch: ${TARGET_BRANCH}"
71
+
72
+ **Current branch status:**
73
+ !git branch --show-current
74
+
75
+ ## Commit Message Generation
76
+
77
+ Analyze the staged changes to generate an intelligent commit message:
78
+ !git diff --cached --stat
79
+ !git diff --cached --name-only | head -10
80
+
81
+ **If custom message provided (--message):**
82
+ Use the provided custom commit message directly.
83
+
84
+ **Otherwise, generate intelligent commit message:**
85
+ Think step by step about the changes to determine the appropriate commit type:
86
+ - Check for documentation files (.md, README, docs/) → docs
87
+ - Check for test files (test/, spec/, .test., .spec.) → test
88
+ - Check for dependency files (package.json, requirements.txt) → chore
89
+ - Check for new functionality (new files with functions/classes) → feat
90
+ - Check for bug fixes (fix, bug, error in diff) → fix
91
+ - Check for refactoring (refactor, rename, move) → refactor
92
+ - Default for new files → feat
93
+ - Default for modifications → chore
94
+
95
+ Generate commit message following Conventional Commits format:
96
+ - type: description (under 50 chars)
97
+ - Include file change summary in body
98
+ - Add standard Claude Code footer
99
+
100
+ Execute the commit with generated or custom message:
101
+ !git commit -m "Generated commit message based on changes" -m "📋 Change summary:
102
+ * List of changed files and modifications" -m "🤖 Generated with [Claude Code](https://claude.ai/code)
103
+
104
+ Co-Authored-By: Claude <noreply@anthropic.com>"
105
+
106
+ ## Remote Push Operations
107
+
108
+ Check remote configuration and current branch:
109
+ !git remote -v | grep origin || echo "No origin remote configured"
110
+ !git branch --show-current
111
+
112
+ **Determine target branch for push:**
113
+ - Use `--branch <branch-name>` if specified
114
+ - Use `--create-branch <branch-name>` if creating new branch
115
+ - Default to current branch
116
+
117
+ **Push to remote with upstream tracking:**
118
+
119
+ **If force push requested (--force):**
120
+ !git push --force-with-lease origin ${TARGET_BRANCH} 2>/dev/null || echo "Force push failed - check remote configuration and conflicts"
121
+
122
+ **Standard push operation:**
123
+ !git push --follow-tags --set-upstream origin ${TARGET_BRANCH} 2>/dev/null || git push --follow-tags 2>/dev/null || echo "Push failed - check remote configuration"
124
+
125
+ **If new branch creation:**
126
+ !echo "New branch '${TARGET_BRANCH}' has been created and pushed to remote"
127
+
128
+ **Report results:**
129
+ !git log -1 --oneline
130
+ !echo "✅ Successfully staged, committed, and pushed changes to branch: $(git branch --show-current)"
131
+
132
+ ## Error Handling and Guidance
133
+
134
+ If any step fails, provide clear error messages with troubleshooting guidance:
135
+
136
+ **Branch Issues:**
137
+ - Branch doesn't exist: Suggest using `--create-branch` instead of `--branch`
138
+ - Branch already exists: Confirm if you want to switch to existing branch
139
+ - No upstream: Automatically set upstream tracking on first push
140
+
141
+ **Push Issues:**
142
+ - Remote conflicts: Suggest `--force` flag if appropriate, or manual conflict resolution
143
+ - Authentication: Check git credentials and remote configuration
144
+ - Network issues: Retry or check internet connection
145
+
146
+ **Validation:**
147
+ - Ensure all staged changes are committed
148
+ - Verify remote branch tracking is properly configured
149
+ - Confirm successful push with remote branch status
@@ -0,0 +1,152 @@
1
+ ---
2
+ description: Advanced CI/CD pipeline configuration, build automation, deployment orchestration, and optimization
3
+ tags: [pipeline, cicd, automation, deployment, orchestration, optimization, artifacts]
4
+ ---
5
+
6
+ Configure and manage CI/CD pipelines based on the arguments provided in $ARGUMENTS.
7
+
8
+ ## Usage Examples
9
+
10
+ **Basic pipeline analysis:**
11
+ ```
12
+ /xpipeline
13
+ ```
14
+
15
+ **Initialize new pipeline:**
16
+ ```
17
+ /xpipeline --init
18
+ ```
19
+
20
+ **Configure deployment stage:**
21
+ ```
22
+ /xpipeline --deploy-stage production
23
+ ```
24
+
25
+ **Help and options:**
26
+ ```
27
+ /xpipeline --help
28
+ ```
29
+
30
+ ## Implementation
31
+
32
+ If $ARGUMENTS contains "help" or "--help":
33
+ Display this usage information and exit.
34
+
35
+ First, examine the current pipeline configuration and environment:
36
+ !find . -name "*.yml" -o -name "*.yaml" | grep -E "(pipeline|workflow|ci|cd)" | head -10
37
+ !ls -la .github/workflows/ .gitlab-ci.yml Jenkinsfile azure-pipelines.yml 2>/dev/null || echo "No CI/CD configurations found"
38
+ !git branch --show-current 2>/dev/null || echo "No git repository"
39
+
40
+ Based on $ARGUMENTS, perform the appropriate pipeline operation:
41
+
42
+ ## 1. Pipeline Initialization and Setup
43
+
44
+ If initializing pipeline (--init):
45
+ !find . -name "package.json" -o -name "requirements.txt" -o -name "pom.xml" -o -name "go.mod" | head -3
46
+ !which docker 2>/dev/null || echo "Docker not available"
47
+ !git remote -v 2>/dev/null || echo "No git remotes configured"
48
+
49
+ Initialize CI/CD pipeline configuration:
50
+ - Detect project type and language
51
+ - Generate platform-specific pipeline configuration
52
+ - Configure basic build, test, and deploy stages
53
+ - Set up environment variables and secrets
54
+ - Configure artifact management and caching
55
+
56
+ ## 2. Stage Configuration and Management
57
+
58
+ If configuring stages (--stage, --build, --test-stage):
59
+ !find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "stage\|job\|step" 2>/dev/null | head -5
60
+ !python -c "import pytest; print('pytest available')" 2>/dev/null || npm test --version 2>/dev/null || echo "No test framework detected"
61
+
62
+ Configure pipeline stages:
63
+ - Define stage dependencies and execution order
64
+ - Configure parallel execution for independent stages
65
+ - Set up conditional stage execution criteria
66
+ - Implement manual approval gates
67
+ - Configure stage timeout and retry policies
68
+
69
+ ## 3. Build and Compilation Configuration
70
+
71
+ If configuring build (--build, --compile):
72
+ !find . -name "Dockerfile" -o -name "docker-compose.yml" | head -3
73
+ !find . -name "Makefile" -o -name "build.gradle" -o -name "webpack.config.js" | head -3
74
+ !ls -la package.json setup.py pyproject.toml 2>/dev/null || echo "No build configuration files"
75
+
76
+ Configure build automation:
77
+ - Set up compilation and build processes
78
+ - Configure build caching strategies
79
+ - Implement build matrix for multiple variants
80
+ - Optimize build performance and parallelization
81
+ - Configure artifact packaging and versioning
82
+
83
+ ## 4. Testing Pipeline Integration
84
+
85
+ If configuring testing (--test-stage, --coverage):
86
+ !find . -name "*test*" -type d | head -5
87
+ !find . -name "*.test.js" -o -name "test_*.py" | wc -l
88
+ !python -m pytest --collect-only 2>/dev/null | grep "test" | wc -l || echo "0"
89
+
90
+ Integrate comprehensive testing:
91
+ - Configure unit, integration, and end-to-end tests
92
+ - Set up code coverage requirements and reporting
93
+ - Implement test parallelization and optimization
94
+ - Configure test environment setup and teardown
95
+ - Integrate security and performance testing
96
+
97
+ ## 5. Deployment and Orchestration
98
+
99
+ If configuring deployment (--deploy-stage, --strategy):
100
+ !find . -name "*.yml" -o -name "*.yaml" | xargs grep -l "deploy\|release" 2>/dev/null | head -3
101
+ !kubectl version --client 2>/dev/null || docker --version 2>/dev/null || echo "No deployment tools detected"
102
+
103
+ Configure deployment automation:
104
+ - Set up environment-specific deployment configurations
105
+ - Implement deployment strategies (blue-green, canary, rolling)
106
+ - Configure automated rollback and health checks
107
+ - Set up approval workflows and quality gates
108
+ - Integrate monitoring and observability
109
+
110
+ ## 6. Artifact and Registry Management
111
+
112
+ If managing artifacts (--artifact, --registry):
113
+ !find . -name "*.tar.gz" -o -name "*.zip" -o -name "*.jar" | head -5 2>/dev/null
114
+ !docker images --format "table {{.Repository}}:{{.Tag}}" 2>/dev/null | head -5
115
+ !npm whoami 2>/dev/null || echo "Not logged into npm registry"
116
+
117
+ Configure artifact management:
118
+ - Set up artifact registry integration
119
+ - Configure versioning and tagging strategies
120
+ - Implement artifact promotion pipelines
121
+ - Configure retention policies and cleanup
122
+ - Set up artifact security scanning
123
+
124
+ Think step by step about pipeline configuration and optimization requirements and provide:
125
+
126
+ 1. **Pipeline Analysis**:
127
+ - Current pipeline configuration assessment
128
+ - Platform compatibility evaluation
129
+ - Performance bottleneck identification
130
+ - Security vulnerability scanning
131
+
132
+ 2. **Configuration Strategy**:
133
+ - Stage dependency optimization
134
+ - Parallel execution opportunities
135
+ - Resource allocation improvements
136
+ - Cache strategy implementation
137
+
138
+ 3. **Implementation Plan**:
139
+ - Platform-specific configuration generation
140
+ - Security integration requirements
141
+ - Monitoring and observability setup
142
+ - Quality gate configuration
143
+
144
+ 4. **Optimization Recommendations**:
145
+ - Build time reduction strategies
146
+ - Resource utilization improvements
147
+ - Cost optimization opportunities
148
+ - Performance monitoring setup
149
+
150
+ Generate comprehensive pipeline configuration with platform-specific optimizations, security integrations, monitoring setup, and performance recommendations.
151
+
152
+ If no specific operation is provided, perform pipeline health assessment and recommend configuration improvements based on current setup and best practices.