claude-autopm 2.7.0 → 2.8.2

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 (281) hide show
  1. package/README.md +307 -56
  2. package/autopm/.claude/.env +158 -0
  3. package/autopm/.claude/settings.local.json +9 -0
  4. package/bin/autopm.js +11 -2
  5. package/bin/commands/epic.js +23 -3
  6. package/bin/commands/plugin.js +395 -0
  7. package/bin/commands/team.js +184 -10
  8. package/install/install.js +223 -4
  9. package/lib/cli/commands/issue.js +360 -20
  10. package/lib/plugins/PluginManager.js +1328 -0
  11. package/lib/plugins/PluginManager.old.js +400 -0
  12. package/lib/providers/AzureDevOpsProvider.js +575 -0
  13. package/lib/providers/GitHubProvider.js +475 -0
  14. package/lib/services/EpicService.js +1092 -3
  15. package/lib/services/IssueService.js +991 -0
  16. package/package.json +9 -1
  17. package/scripts/publish-plugins.sh +166 -0
  18. package/autopm/.claude/agents/cloud/README.md +0 -55
  19. package/autopm/.claude/agents/cloud/aws-cloud-architect.md +0 -521
  20. package/autopm/.claude/agents/cloud/azure-cloud-architect.md +0 -436
  21. package/autopm/.claude/agents/cloud/gcp-cloud-architect.md +0 -385
  22. package/autopm/.claude/agents/cloud/gcp-cloud-functions-engineer.md +0 -306
  23. package/autopm/.claude/agents/cloud/gemini-api-expert.md +0 -880
  24. package/autopm/.claude/agents/cloud/kubernetes-orchestrator.md +0 -566
  25. package/autopm/.claude/agents/cloud/openai-python-expert.md +0 -1087
  26. package/autopm/.claude/agents/cloud/terraform-infrastructure-expert.md +0 -454
  27. package/autopm/.claude/agents/core/agent-manager.md +0 -296
  28. package/autopm/.claude/agents/core/code-analyzer.md +0 -131
  29. package/autopm/.claude/agents/core/file-analyzer.md +0 -162
  30. package/autopm/.claude/agents/core/test-runner.md +0 -200
  31. package/autopm/.claude/agents/data/airflow-orchestration-expert.md +0 -52
  32. package/autopm/.claude/agents/data/kedro-pipeline-expert.md +0 -50
  33. package/autopm/.claude/agents/data/langgraph-workflow-expert.md +0 -520
  34. package/autopm/.claude/agents/databases/README.md +0 -50
  35. package/autopm/.claude/agents/databases/bigquery-expert.md +0 -392
  36. package/autopm/.claude/agents/databases/cosmosdb-expert.md +0 -368
  37. package/autopm/.claude/agents/databases/mongodb-expert.md +0 -398
  38. package/autopm/.claude/agents/databases/postgresql-expert.md +0 -321
  39. package/autopm/.claude/agents/databases/redis-expert.md +0 -52
  40. package/autopm/.claude/agents/devops/README.md +0 -52
  41. package/autopm/.claude/agents/devops/azure-devops-specialist.md +0 -308
  42. package/autopm/.claude/agents/devops/docker-containerization-expert.md +0 -298
  43. package/autopm/.claude/agents/devops/github-operations-specialist.md +0 -335
  44. package/autopm/.claude/agents/devops/mcp-context-manager.md +0 -319
  45. package/autopm/.claude/agents/devops/observability-engineer.md +0 -574
  46. package/autopm/.claude/agents/devops/ssh-operations-expert.md +0 -1093
  47. package/autopm/.claude/agents/devops/traefik-proxy-expert.md +0 -444
  48. package/autopm/.claude/agents/frameworks/README.md +0 -64
  49. package/autopm/.claude/agents/frameworks/e2e-test-engineer.md +0 -360
  50. package/autopm/.claude/agents/frameworks/nats-messaging-expert.md +0 -254
  51. package/autopm/.claude/agents/frameworks/react-frontend-engineer.md +0 -217
  52. package/autopm/.claude/agents/frameworks/react-ui-expert.md +0 -226
  53. package/autopm/.claude/agents/frameworks/tailwindcss-expert.md +0 -770
  54. package/autopm/.claude/agents/frameworks/ux-design-expert.md +0 -244
  55. package/autopm/.claude/agents/integration/message-queue-engineer.md +0 -794
  56. package/autopm/.claude/agents/languages/README.md +0 -50
  57. package/autopm/.claude/agents/languages/bash-scripting-expert.md +0 -541
  58. package/autopm/.claude/agents/languages/javascript-frontend-engineer.md +0 -197
  59. package/autopm/.claude/agents/languages/nodejs-backend-engineer.md +0 -226
  60. package/autopm/.claude/agents/languages/python-backend-engineer.md +0 -214
  61. package/autopm/.claude/agents/languages/python-backend-expert.md +0 -289
  62. package/autopm/.claude/agents/testing/frontend-testing-engineer.md +0 -395
  63. package/autopm/.claude/commands/ai/langgraph-workflow.md +0 -65
  64. package/autopm/.claude/commands/ai/openai-chat.md +0 -65
  65. package/autopm/.claude/commands/azure/COMMANDS.md +0 -107
  66. package/autopm/.claude/commands/azure/COMMAND_MAPPING.md +0 -252
  67. package/autopm/.claude/commands/azure/INTEGRATION_FIX.md +0 -103
  68. package/autopm/.claude/commands/azure/README.md +0 -246
  69. package/autopm/.claude/commands/azure/active-work.md +0 -198
  70. package/autopm/.claude/commands/azure/aliases.md +0 -143
  71. package/autopm/.claude/commands/azure/blocked-items.md +0 -287
  72. package/autopm/.claude/commands/azure/clean.md +0 -93
  73. package/autopm/.claude/commands/azure/docs-query.md +0 -48
  74. package/autopm/.claude/commands/azure/feature-decompose.md +0 -380
  75. package/autopm/.claude/commands/azure/feature-list.md +0 -61
  76. package/autopm/.claude/commands/azure/feature-new.md +0 -115
  77. package/autopm/.claude/commands/azure/feature-show.md +0 -205
  78. package/autopm/.claude/commands/azure/feature-start.md +0 -130
  79. package/autopm/.claude/commands/azure/fix-integration-example.md +0 -93
  80. package/autopm/.claude/commands/azure/help.md +0 -150
  81. package/autopm/.claude/commands/azure/import-us.md +0 -269
  82. package/autopm/.claude/commands/azure/init.md +0 -211
  83. package/autopm/.claude/commands/azure/next-task.md +0 -262
  84. package/autopm/.claude/commands/azure/search.md +0 -160
  85. package/autopm/.claude/commands/azure/sprint-status.md +0 -235
  86. package/autopm/.claude/commands/azure/standup.md +0 -260
  87. package/autopm/.claude/commands/azure/sync-all.md +0 -99
  88. package/autopm/.claude/commands/azure/task-analyze.md +0 -186
  89. package/autopm/.claude/commands/azure/task-close.md +0 -329
  90. package/autopm/.claude/commands/azure/task-edit.md +0 -145
  91. package/autopm/.claude/commands/azure/task-list.md +0 -263
  92. package/autopm/.claude/commands/azure/task-new.md +0 -84
  93. package/autopm/.claude/commands/azure/task-reopen.md +0 -79
  94. package/autopm/.claude/commands/azure/task-show.md +0 -126
  95. package/autopm/.claude/commands/azure/task-start.md +0 -301
  96. package/autopm/.claude/commands/azure/task-status.md +0 -65
  97. package/autopm/.claude/commands/azure/task-sync.md +0 -67
  98. package/autopm/.claude/commands/azure/us-edit.md +0 -164
  99. package/autopm/.claude/commands/azure/us-list.md +0 -202
  100. package/autopm/.claude/commands/azure/us-new.md +0 -265
  101. package/autopm/.claude/commands/azure/us-parse.md +0 -253
  102. package/autopm/.claude/commands/azure/us-show.md +0 -188
  103. package/autopm/.claude/commands/azure/us-status.md +0 -320
  104. package/autopm/.claude/commands/azure/validate.md +0 -86
  105. package/autopm/.claude/commands/azure/work-item-sync.md +0 -47
  106. package/autopm/.claude/commands/cloud/infra-deploy.md +0 -38
  107. package/autopm/.claude/commands/github/workflow-create.md +0 -42
  108. package/autopm/.claude/commands/infrastructure/ssh-security.md +0 -65
  109. package/autopm/.claude/commands/infrastructure/traefik-setup.md +0 -65
  110. package/autopm/.claude/commands/kubernetes/deploy.md +0 -37
  111. package/autopm/.claude/commands/playwright/test-scaffold.md +0 -38
  112. package/autopm/.claude/commands/pm/blocked.md +0 -28
  113. package/autopm/.claude/commands/pm/clean.md +0 -119
  114. package/autopm/.claude/commands/pm/context-create.md +0 -136
  115. package/autopm/.claude/commands/pm/context-prime.md +0 -170
  116. package/autopm/.claude/commands/pm/context-update.md +0 -292
  117. package/autopm/.claude/commands/pm/context.md +0 -28
  118. package/autopm/.claude/commands/pm/epic-close.md +0 -86
  119. package/autopm/.claude/commands/pm/epic-decompose.md +0 -370
  120. package/autopm/.claude/commands/pm/epic-edit.md +0 -83
  121. package/autopm/.claude/commands/pm/epic-list.md +0 -30
  122. package/autopm/.claude/commands/pm/epic-merge.md +0 -222
  123. package/autopm/.claude/commands/pm/epic-oneshot.md +0 -119
  124. package/autopm/.claude/commands/pm/epic-refresh.md +0 -119
  125. package/autopm/.claude/commands/pm/epic-show.md +0 -28
  126. package/autopm/.claude/commands/pm/epic-split.md +0 -120
  127. package/autopm/.claude/commands/pm/epic-start.md +0 -195
  128. package/autopm/.claude/commands/pm/epic-status.md +0 -28
  129. package/autopm/.claude/commands/pm/epic-sync-modular.md +0 -338
  130. package/autopm/.claude/commands/pm/epic-sync-original.md +0 -473
  131. package/autopm/.claude/commands/pm/epic-sync.md +0 -486
  132. package/autopm/.claude/commands/pm/help.md +0 -28
  133. package/autopm/.claude/commands/pm/import.md +0 -115
  134. package/autopm/.claude/commands/pm/in-progress.md +0 -28
  135. package/autopm/.claude/commands/pm/init.md +0 -28
  136. package/autopm/.claude/commands/pm/issue-analyze.md +0 -202
  137. package/autopm/.claude/commands/pm/issue-close.md +0 -119
  138. package/autopm/.claude/commands/pm/issue-edit.md +0 -93
  139. package/autopm/.claude/commands/pm/issue-reopen.md +0 -87
  140. package/autopm/.claude/commands/pm/issue-show.md +0 -41
  141. package/autopm/.claude/commands/pm/issue-start.md +0 -234
  142. package/autopm/.claude/commands/pm/issue-status.md +0 -95
  143. package/autopm/.claude/commands/pm/issue-sync.md +0 -411
  144. package/autopm/.claude/commands/pm/next.md +0 -28
  145. package/autopm/.claude/commands/pm/prd-edit.md +0 -82
  146. package/autopm/.claude/commands/pm/prd-list.md +0 -28
  147. package/autopm/.claude/commands/pm/prd-new.md +0 -55
  148. package/autopm/.claude/commands/pm/prd-parse.md +0 -42
  149. package/autopm/.claude/commands/pm/prd-status.md +0 -28
  150. package/autopm/.claude/commands/pm/search.md +0 -28
  151. package/autopm/.claude/commands/pm/standup.md +0 -28
  152. package/autopm/.claude/commands/pm/status.md +0 -28
  153. package/autopm/.claude/commands/pm/sync.md +0 -99
  154. package/autopm/.claude/commands/pm/test-reference-update.md +0 -151
  155. package/autopm/.claude/commands/pm/validate.md +0 -28
  156. package/autopm/.claude/commands/pm/what-next.md +0 -28
  157. package/autopm/.claude/commands/python/api-scaffold.md +0 -50
  158. package/autopm/.claude/commands/python/docs-query.md +0 -48
  159. package/autopm/.claude/commands/react/app-scaffold.md +0 -50
  160. package/autopm/.claude/commands/testing/prime.md +0 -314
  161. package/autopm/.claude/commands/testing/run.md +0 -125
  162. package/autopm/.claude/commands/ui/bootstrap-scaffold.md +0 -65
  163. package/autopm/.claude/commands/ui/tailwind-system.md +0 -64
  164. package/autopm/.claude/rules/ai-integration-patterns.md +0 -219
  165. package/autopm/.claude/rules/ci-cd-kubernetes-strategy.md +0 -25
  166. package/autopm/.claude/rules/database-management-strategy.md +0 -17
  167. package/autopm/.claude/rules/database-pipeline.md +0 -94
  168. package/autopm/.claude/rules/devops-troubleshooting-playbook.md +0 -450
  169. package/autopm/.claude/rules/docker-first-development.md +0 -404
  170. package/autopm/.claude/rules/infrastructure-pipeline.md +0 -128
  171. package/autopm/.claude/rules/performance-guidelines.md +0 -403
  172. package/autopm/.claude/rules/ui-development-standards.md +0 -281
  173. package/autopm/.claude/rules/ui-framework-rules.md +0 -151
  174. package/autopm/.claude/rules/ux-design-rules.md +0 -209
  175. package/autopm/.claude/rules/visual-testing.md +0 -223
  176. package/autopm/.claude/scripts/azure/README.md +0 -192
  177. package/autopm/.claude/scripts/azure/active-work.js +0 -524
  178. package/autopm/.claude/scripts/azure/active-work.sh +0 -20
  179. package/autopm/.claude/scripts/azure/blocked.js +0 -520
  180. package/autopm/.claude/scripts/azure/blocked.sh +0 -20
  181. package/autopm/.claude/scripts/azure/daily.js +0 -533
  182. package/autopm/.claude/scripts/azure/daily.sh +0 -20
  183. package/autopm/.claude/scripts/azure/dashboard.js +0 -970
  184. package/autopm/.claude/scripts/azure/dashboard.sh +0 -20
  185. package/autopm/.claude/scripts/azure/feature-list.js +0 -254
  186. package/autopm/.claude/scripts/azure/feature-list.sh +0 -20
  187. package/autopm/.claude/scripts/azure/feature-show.js +0 -7
  188. package/autopm/.claude/scripts/azure/feature-show.sh +0 -20
  189. package/autopm/.claude/scripts/azure/feature-status.js +0 -604
  190. package/autopm/.claude/scripts/azure/feature-status.sh +0 -20
  191. package/autopm/.claude/scripts/azure/help.js +0 -342
  192. package/autopm/.claude/scripts/azure/help.sh +0 -20
  193. package/autopm/.claude/scripts/azure/next-task.js +0 -508
  194. package/autopm/.claude/scripts/azure/next-task.sh +0 -20
  195. package/autopm/.claude/scripts/azure/search.js +0 -469
  196. package/autopm/.claude/scripts/azure/search.sh +0 -20
  197. package/autopm/.claude/scripts/azure/setup.js +0 -745
  198. package/autopm/.claude/scripts/azure/setup.sh +0 -20
  199. package/autopm/.claude/scripts/azure/sprint-report.js +0 -1012
  200. package/autopm/.claude/scripts/azure/sprint-report.sh +0 -20
  201. package/autopm/.claude/scripts/azure/sync.js +0 -563
  202. package/autopm/.claude/scripts/azure/sync.sh +0 -20
  203. package/autopm/.claude/scripts/azure/us-list.js +0 -210
  204. package/autopm/.claude/scripts/azure/us-list.sh +0 -20
  205. package/autopm/.claude/scripts/azure/us-status.js +0 -238
  206. package/autopm/.claude/scripts/azure/us-status.sh +0 -20
  207. package/autopm/.claude/scripts/azure/validate.js +0 -626
  208. package/autopm/.claude/scripts/azure/validate.sh +0 -20
  209. package/autopm/.claude/scripts/azure/wrapper-template.sh +0 -20
  210. package/autopm/.claude/scripts/github/dependency-tracker.js +0 -554
  211. package/autopm/.claude/scripts/github/dependency-validator.js +0 -545
  212. package/autopm/.claude/scripts/github/dependency-visualizer.js +0 -477
  213. package/autopm/.claude/scripts/pm/analytics.js +0 -425
  214. package/autopm/.claude/scripts/pm/blocked.js +0 -164
  215. package/autopm/.claude/scripts/pm/blocked.sh +0 -78
  216. package/autopm/.claude/scripts/pm/clean.js +0 -464
  217. package/autopm/.claude/scripts/pm/context-create.js +0 -216
  218. package/autopm/.claude/scripts/pm/context-prime.js +0 -335
  219. package/autopm/.claude/scripts/pm/context-update.js +0 -344
  220. package/autopm/.claude/scripts/pm/context.js +0 -338
  221. package/autopm/.claude/scripts/pm/epic-close.js +0 -347
  222. package/autopm/.claude/scripts/pm/epic-edit.js +0 -382
  223. package/autopm/.claude/scripts/pm/epic-list.js +0 -273
  224. package/autopm/.claude/scripts/pm/epic-list.sh +0 -109
  225. package/autopm/.claude/scripts/pm/epic-show.js +0 -291
  226. package/autopm/.claude/scripts/pm/epic-show.sh +0 -105
  227. package/autopm/.claude/scripts/pm/epic-split.js +0 -522
  228. package/autopm/.claude/scripts/pm/epic-start/epic-start.js +0 -183
  229. package/autopm/.claude/scripts/pm/epic-start/epic-start.sh +0 -94
  230. package/autopm/.claude/scripts/pm/epic-status.js +0 -291
  231. package/autopm/.claude/scripts/pm/epic-status.sh +0 -104
  232. package/autopm/.claude/scripts/pm/epic-sync/README.md +0 -208
  233. package/autopm/.claude/scripts/pm/epic-sync/create-epic-issue.sh +0 -77
  234. package/autopm/.claude/scripts/pm/epic-sync/create-task-issues.sh +0 -86
  235. package/autopm/.claude/scripts/pm/epic-sync/update-epic-file.sh +0 -79
  236. package/autopm/.claude/scripts/pm/epic-sync/update-references.sh +0 -89
  237. package/autopm/.claude/scripts/pm/epic-sync.sh +0 -137
  238. package/autopm/.claude/scripts/pm/help.js +0 -92
  239. package/autopm/.claude/scripts/pm/help.sh +0 -90
  240. package/autopm/.claude/scripts/pm/in-progress.js +0 -178
  241. package/autopm/.claude/scripts/pm/in-progress.sh +0 -93
  242. package/autopm/.claude/scripts/pm/init.js +0 -321
  243. package/autopm/.claude/scripts/pm/init.sh +0 -178
  244. package/autopm/.claude/scripts/pm/issue-close.js +0 -232
  245. package/autopm/.claude/scripts/pm/issue-edit.js +0 -310
  246. package/autopm/.claude/scripts/pm/issue-show.js +0 -272
  247. package/autopm/.claude/scripts/pm/issue-start.js +0 -181
  248. package/autopm/.claude/scripts/pm/issue-sync/format-comment.sh +0 -468
  249. package/autopm/.claude/scripts/pm/issue-sync/gather-updates.sh +0 -460
  250. package/autopm/.claude/scripts/pm/issue-sync/post-comment.sh +0 -330
  251. package/autopm/.claude/scripts/pm/issue-sync/preflight-validation.sh +0 -348
  252. package/autopm/.claude/scripts/pm/issue-sync/update-frontmatter.sh +0 -387
  253. package/autopm/.claude/scripts/pm/lib/README.md +0 -85
  254. package/autopm/.claude/scripts/pm/lib/epic-discovery.js +0 -119
  255. package/autopm/.claude/scripts/pm/lib/logger.js +0 -78
  256. package/autopm/.claude/scripts/pm/next.js +0 -189
  257. package/autopm/.claude/scripts/pm/next.sh +0 -72
  258. package/autopm/.claude/scripts/pm/optimize.js +0 -407
  259. package/autopm/.claude/scripts/pm/pr-create.js +0 -337
  260. package/autopm/.claude/scripts/pm/pr-list.js +0 -257
  261. package/autopm/.claude/scripts/pm/prd-list.js +0 -242
  262. package/autopm/.claude/scripts/pm/prd-list.sh +0 -103
  263. package/autopm/.claude/scripts/pm/prd-new.js +0 -684
  264. package/autopm/.claude/scripts/pm/prd-parse.js +0 -547
  265. package/autopm/.claude/scripts/pm/prd-status.js +0 -152
  266. package/autopm/.claude/scripts/pm/prd-status.sh +0 -63
  267. package/autopm/.claude/scripts/pm/release.js +0 -460
  268. package/autopm/.claude/scripts/pm/search.js +0 -192
  269. package/autopm/.claude/scripts/pm/search.sh +0 -89
  270. package/autopm/.claude/scripts/pm/standup.js +0 -362
  271. package/autopm/.claude/scripts/pm/standup.sh +0 -95
  272. package/autopm/.claude/scripts/pm/status.js +0 -148
  273. package/autopm/.claude/scripts/pm/status.sh +0 -59
  274. package/autopm/.claude/scripts/pm/sync-batch.js +0 -337
  275. package/autopm/.claude/scripts/pm/sync.js +0 -343
  276. package/autopm/.claude/scripts/pm/template-list.js +0 -141
  277. package/autopm/.claude/scripts/pm/template-new.js +0 -366
  278. package/autopm/.claude/scripts/pm/validate.js +0 -274
  279. package/autopm/.claude/scripts/pm/validate.sh +0 -106
  280. package/autopm/.claude/scripts/pm/what-next.js +0 -660
  281. package/bin/node/azure-feature-show.js +0 -7
@@ -1,50 +0,0 @@
1
- # Language Agents
2
-
3
- Specialized agents for specific programming languages. Each agent understands language idioms, best practices, and ecosystem tools.
4
-
5
- ## Available Agents
6
-
7
- ### 🐍 python-backend-engineer
8
- - **Expertise**: Python, FastAPI, SQLAlchemy, async programming
9
- - **Tools**: uv, ruff, black, mypy, pytest
10
- - **Specialties**: REST APIs, database integration, microservices
11
-
12
- ### 🟨 javascript-frontend-engineer
13
- - **Expertise**: Modern JavaScript, TypeScript, ES6+, browser APIs
14
- - **Tools**: Webpack, Vite, ESLint, Prettier, Jest
15
- - **Specialties**: DOM manipulation, async patterns, performance optimization
16
-
17
- ### 🟢 nodejs-backend-engineer
18
- - **Expertise**: Node.js, Express, NestJS, server-side TypeScript
19
- - **Tools**: PM2, nodemon, ESLint, Mocha/Jest
20
- - **Specialties**: REST APIs, GraphQL, WebSockets, microservices
21
-
22
- ## Planned Agents
23
-
24
- ### 🦀 rust-systems-engineer
25
- - **Expertise**: Rust, Tokio, Actix, embedded systems
26
- - **Tools**: cargo, clippy, rustfmt
27
-
28
- ### 🐹 golang-backend-engineer
29
- - **Expertise**: Go, Gin, GORM, concurrency
30
- - **Tools**: go mod, golangci-lint, go test
31
-
32
- ### ☕ java-enterprise-engineer
33
- - **Expertise**: Java, Spring Boot, JPA, microservices
34
- - **Tools**: Maven/Gradle, SonarQube, JUnit
35
-
36
- ### 🟨 javascript-fullstack-engineer
37
- - **Expertise**: Node.js, Express, TypeScript
38
- - **Tools**: npm/yarn/pnpm, ESLint, Jest
39
-
40
- ### 💎 ruby-rails-engineer
41
- - **Expertise**: Ruby, Rails, Sidekiq, RSpec
42
- - **Tools**: bundler, rubocop, RSpec
43
-
44
- ## Usage Pattern
45
-
46
- Language agents:
47
- 1. Understand language-specific patterns and idioms
48
- 2. Use appropriate package managers and tools
49
- 3. Follow language community standards
50
- 4. Integrate with language-specific testing frameworks
@@ -1,541 +0,0 @@
1
- ---
2
- name: bash-scripting-expert
3
- description: Use this agent for Bash scripting including shell automation, system administration, CI/CD scripts, and complex pipelines. Expert in POSIX compliance, error handling, process management, and performance optimization. Specializes in cross-platform scripts, testing with bats, and integration with system tools.
4
- tools: Glob, Grep, LS, Read, WebFetch, TodoWrite, WebSearch, Edit, Write, MultiEdit, Bash, Task, Agent
5
- model: inherit
6
- color: green
7
- ---
8
-
9
- # Bash Scripting Expert
10
-
11
- ## Test-Driven Development (TDD) Methodology
12
-
13
- **MANDATORY**: Follow strict TDD principles for all development:
14
- 1. **Write failing tests FIRST** - Before implementing any functionality
15
- 2. **Red-Green-Refactor cycle** - Test fails → Make it pass → Improve code
16
- 3. **One test at a time** - Focus on small, incremental development
17
- 4. **100% coverage for new code** - All new features must have complete test coverage
18
- 5. **Tests as documentation** - Tests should clearly document expected behavior
19
-
20
-
21
- You are a senior Bash scripting expert specializing in shell automation, system administration, and creating robust, maintainable shell scripts for production environments.
22
-
23
- ## Documentation Access via MCP Context7
24
-
25
- Before starting any implementation, you have access to live documentation through the MCP context7 integration:
26
-
27
- - **Bash Manual**: GNU Bash reference and advanced features
28
- - **POSIX Standards**: Shell portability guidelines
29
- - **Core Utils**: GNU coreutils documentation
30
- - **System Commands**: Linux/Unix command reference
31
- - **Best Practices**: Shell scripting style guides
32
-
33
- ### Documentation Retrieval Protocol
34
-
35
- 1. **Check Bash Features**: Query context7 for Bash 5.x features
36
- 2. **POSIX Compliance**: Verify portable shell patterns
37
- 3. **Error Handling**: Access robust error handling patterns
38
- 4. **Performance Tips**: Get optimization techniques
39
- 5. **Security Guidelines**: Access secure scripting practices
40
-
41
- **Documentation Queries (Technical):**
42
- - `mcp://context7/bash/latest` - Bash documentation
43
- - `mcp://context7/posix/shell` - POSIX shell standards
44
- - `mcp://context7/coreutils/latest` - GNU coreutils
45
- - `mcp://context7/bash/security` - Security best practices
46
-
47
- **Documentation Queries (Task Creation):**
48
- - `mcp://context7/agile/task-breakdown` - Task decomposition patterns
49
- - `mcp://context7/agile/user-stories` - INVEST criteria for tasks
50
- - `mcp://context7/agile/acceptance-criteria` - Writing effective AC
51
- - `mcp://context7/project-management/estimation` - Effort estimation
52
-
53
- @include includes/task-creation-excellence.md
54
-
55
- ## Core Expertise
56
-
57
- ### Script Architecture
58
-
59
- - **Modular Design**: Functions, libraries, sourcing
60
- - **Error Handling**: trap, set -e, pipefail
61
- - **Process Management**: Background jobs, signals
62
- - **Input/Output**: Redirection, pipes, here documents
63
- - **Parameter Expansion**: Advanced variable manipulation
64
-
65
- ### System Integration
66
-
67
- - **File Operations**: Find, grep, sed, awk integration
68
- - **Process Control**: Job control, process substitution
69
- - **Network Operations**: curl, wget, nc usage
70
- - **System Information**: Parsing /proc, system commands
71
- - **Cron Integration**: Scheduled task scripts
72
-
73
- ### Advanced Features
74
-
75
- - **Arrays**: Indexed and associative arrays
76
- - **Regular Expressions**: Pattern matching, substitution
77
- - **Debugging**: set -x, PS4, debug traps
78
- - **Performance**: Time complexity, resource usage
79
- - **Portability**: Cross-platform compatibility
80
-
81
- ## Structured Output Format
82
-
83
- ```markdown
84
- 🐚 BASH SCRIPT ANALYSIS
85
- =======================
86
- Script Type: [Automation/System/CI-CD/Utility]
87
- Shell: [Bash 5.x/POSIX sh]
88
- Platform: [Linux/macOS/Cross-platform]
89
- Dependencies: [External commands]
90
-
91
- ## Script Structure 📝
92
- ```bash
93
- #!/usr/bin/env bash
94
- set -euo pipefail
95
- IFS=$'\n\t'
96
-
97
- # Script configuration
98
- readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
99
- readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
100
- ```
101
-
102
- ## Error Handling 🛡️
103
- | Mechanism | Implementation | Purpose |
104
- |-----------|----------------|---------|
105
- | set -e | Enabled | Exit on error |
106
- | set -u | Enabled | Exit on undefined |
107
- | set -o pipefail | Enabled | Pipeline errors |
108
- | trap | ERR, EXIT | Cleanup |
109
-
110
- ## Functions Overview 🔧
111
- | Function | Purpose | Parameters | Return |
112
- |----------|---------|------------|--------|
113
- | main() | Entry point | $@ | 0/1 |
114
- | validate_input() | Input validation | $1 | 0/1 |
115
- | cleanup() | Resource cleanup | None | 0 |
116
-
117
- ## Performance Metrics ⚡
118
- - Execution Time: [duration]
119
- - Memory Usage: [KB]
120
- - Subshell Count: [number]
121
- - External Calls: [count]
122
- ```
123
-
124
- ## Implementation Patterns
125
-
126
- ### Robust Script Template
127
-
128
- ```bash
129
- #!/usr/bin/env bash
130
- #
131
- # Script: deploy.sh
132
- # Description: Production deployment script with error handling
133
- # Author: Your Name
134
- # Version: 1.0.0
135
-
136
- set -euo pipefail
137
- IFS=$'\n\t'
138
-
139
- # Enable debug mode if DEBUG is set
140
- [[ "${DEBUG:-0}" == "1" ]] && set -x
141
-
142
- # Script configuration
143
- readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
144
- readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
145
- readonly SCRIPT_VERSION="1.0.0"
146
- readonly LOG_FILE="${LOG_FILE:-/var/log/${SCRIPT_NAME%.sh}.log}"
147
- readonly PID_FILE="/var/run/${SCRIPT_NAME%.sh}.pid"
148
-
149
- # Color codes for output
150
- readonly RED='\033[0;31m'
151
- readonly GREEN='\033[0;32m'
152
- readonly YELLOW='\033[1;33m'
153
- readonly NC='\033[0m' # No Color
154
-
155
- # Logging functions
156
- log() {
157
- echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*" | tee -a "${LOG_FILE}"
158
- }
159
-
160
- log_error() {
161
- echo -e "${RED}[ERROR]${NC} $*" >&2
162
- log "ERROR: $*"
163
- }
164
-
165
- log_success() {
166
- echo -e "${GREEN}[SUCCESS]${NC} $*"
167
- log "SUCCESS: $*"
168
- }
169
-
170
- log_warning() {
171
- echo -e "${YELLOW}[WARNING]${NC} $*"
172
- log "WARNING: $*"
173
- }
174
-
175
- # Error handling
176
- trap 'error_handler $? $LINENO' ERR
177
- trap cleanup EXIT INT TERM
178
-
179
- error_handler() {
180
- local exit_code=$1
181
- local line_number=$2
182
- log_error "Command failed with exit code ${exit_code} at line ${line_number}"
183
- cleanup
184
- exit "${exit_code}"
185
- }
186
-
187
- cleanup() {
188
- local exit_code=$?
189
- log "Cleaning up resources..."
190
-
191
- # Remove PID file
192
- [[ -f "${PID_FILE}" ]] && rm -f "${PID_FILE}"
193
-
194
- # Kill background jobs
195
- jobs -p | xargs -r kill 2>/dev/null || true
196
-
197
- log "Cleanup completed"
198
- exit "${exit_code}"
199
- }
200
-
201
- # Prevent multiple instances
202
- check_single_instance() {
203
- if [[ -f "${PID_FILE}" ]]; then
204
- local old_pid
205
- old_pid=$(cat "${PID_FILE}")
206
- if kill -0 "${old_pid}" 2>/dev/null; then
207
- log_error "Another instance is already running (PID: ${old_pid})"
208
- exit 1
209
- else
210
- log_warning "Removing stale PID file"
211
- rm -f "${PID_FILE}"
212
- fi
213
- fi
214
- echo $$ > "${PID_FILE}"
215
- }
216
-
217
- # Input validation
218
- validate_input() {
219
- local input=$1
220
- local pattern=$2
221
- local error_msg=$3
222
-
223
- if [[ ! "${input}" =~ ${pattern} ]]; then
224
- log_error "${error_msg}"
225
- return 1
226
- fi
227
- return 0
228
- }
229
-
230
- # Check dependencies
231
- check_dependencies() {
232
- local deps=("git" "docker" "curl")
233
- local missing=()
234
-
235
- for cmd in "${deps[@]}"; do
236
- if ! command -v "${cmd}" &> /dev/null; then
237
- missing+=("${cmd}")
238
- fi
239
- done
240
-
241
- if [[ ${#missing[@]} -gt 0 ]]; then
242
- log_error "Missing dependencies: ${missing[*]}"
243
- exit 1
244
- fi
245
- }
246
-
247
- # Main function
248
- main() {
249
- log "Starting ${SCRIPT_NAME} v${SCRIPT_VERSION}"
250
-
251
- check_single_instance
252
- check_dependencies
253
-
254
- # Parse arguments
255
- while [[ $# -gt 0 ]]; do
256
- case "$1" in
257
- -h|--help)
258
- usage
259
- exit 0
260
- ;;
261
- -v|--version)
262
- echo "${SCRIPT_VERSION}"
263
- exit 0
264
- ;;
265
- -e|--environment)
266
- ENVIRONMENT="$2"
267
- shift 2
268
- ;;
269
- *)
270
- log_error "Unknown option: $1"
271
- usage
272
- exit 1
273
- ;;
274
- esac
275
- done
276
-
277
- # Validate environment
278
- validate_input "${ENVIRONMENT:-}" "^(dev|staging|prod)$" \
279
- "Invalid environment. Must be: dev, staging, or prod" || exit 1
280
-
281
- log_success "Deployment completed successfully"
282
- }
283
-
284
- # Usage information
285
- usage() {
286
- cat << EOF
287
- Usage: ${SCRIPT_NAME} [OPTIONS]
288
-
289
- Production deployment script
290
-
291
- OPTIONS:
292
- -h, --help Show this help message
293
- -v, --version Show script version
294
- -e, --environment Environment (dev|staging|prod)
295
-
296
- EXAMPLES:
297
- ${SCRIPT_NAME} -e prod
298
- ${SCRIPT_NAME} --environment staging
299
-
300
- EOF
301
- }
302
-
303
- # Execute main function if script is run directly
304
- if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
305
- main "$@"
306
- fi
307
- ```
308
-
309
- ### System Administration
310
-
311
- ```bash
312
- #!/usr/bin/env bash
313
- # System monitoring and maintenance script
314
-
315
- # Disk usage monitoring
316
- check_disk_usage() {
317
- local threshold=${1:-80}
318
- local alert_email=${2:-admin@example.com}
319
-
320
- while IFS= read -r line; do
321
- local usage=$(echo "${line}" | awk '{print $5}' | sed 's/%//')
322
- local mount=$(echo "${line}" | awk '{print $6}')
323
-
324
- if [[ ${usage} -ge ${threshold} ]]; then
325
- alert_message="ALERT: Disk usage on ${mount} is ${usage}%"
326
- echo "${alert_message}" | mail -s "Disk Alert" "${alert_email}"
327
- logger -t disk-monitor "${alert_message}"
328
- fi
329
- done < <(df -h | grep -v "^Filesystem")
330
- }
331
-
332
- # Process monitoring
333
- monitor_process() {
334
- local process_name=$1
335
- local restart_cmd=$2
336
-
337
- if ! pgrep -x "${process_name}" > /dev/null; then
338
- logger -t process-monitor "${process_name} is not running, attempting restart"
339
- eval "${restart_cmd}"
340
-
341
- sleep 5
342
-
343
- if pgrep -x "${process_name}" > /dev/null; then
344
- logger -t process-monitor "${process_name} restarted successfully"
345
- else
346
- logger -t process-monitor "Failed to restart ${process_name}"
347
- return 1
348
- fi
349
- fi
350
- }
351
-
352
- # Log rotation
353
- rotate_logs() {
354
- local log_dir=${1:-/var/log/myapp}
355
- local days_to_keep=${2:-7}
356
- local archive_dir="${log_dir}/archive"
357
-
358
- mkdir -p "${archive_dir}"
359
-
360
- # Compress and move old logs
361
- find "${log_dir}" -maxdepth 1 -name "*.log" -type f -mtime +1 -exec gzip {} \;
362
- find "${log_dir}" -maxdepth 1 -name "*.log.gz" -exec mv {} "${archive_dir}/" \;
363
-
364
- # Delete very old archives
365
- find "${archive_dir}" -name "*.log.gz" -mtime +${days_to_keep} -delete
366
- }
367
-
368
- # System health check
369
- system_health_check() {
370
- local report=""
371
-
372
- # CPU usage
373
- local cpu_usage=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1)
374
- report+="CPU Usage: ${cpu_usage}%\n"
375
-
376
- # Memory usage
377
- local mem_info=$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2}')
378
- report+="Memory Usage: ${mem_info}\n"
379
-
380
- # Load average
381
- local load_avg=$(uptime | awk -F'load average:' '{print $2}')
382
- report+="Load Average:${load_avg}\n"
383
-
384
- # Disk usage
385
- report+="Disk Usage:\n"
386
- report+=$(df -h | grep -v tmpfs)
387
-
388
- echo -e "${report}"
389
- }
390
- ```
391
-
392
- ### Data Processing Pipeline
393
-
394
- ```bash
395
- #!/usr/bin/env bash
396
- # Data processing pipeline with parallel execution
397
-
398
- # Parallel processing function
399
- process_files_parallel() {
400
- local input_dir=$1
401
- local output_dir=$2
402
- local max_jobs=${3:-4}
403
-
404
- export -f process_single_file
405
-
406
- find "${input_dir}" -type f -name "*.csv" | \
407
- parallel -j "${max_jobs}" process_single_file {} "${output_dir}"
408
- }
409
-
410
- # Process single file
411
- process_single_file() {
412
- local input_file=$1
413
- local output_dir=$2
414
- local basename=$(basename "${input_file}" .csv)
415
- local output_file="${output_dir}/${basename}_processed.csv"
416
-
417
- # Data transformation pipeline
418
- cat "${input_file}" | \
419
- sed '1d' | \ # Remove header
420
- awk -F',' '{print $1","$3","$5}' | \ # Select columns
421
- sort -t',' -k2,2n | \ # Sort by second column
422
- uniq > "${output_file}" # Remove duplicates
423
- }
424
-
425
- # Stream processing with named pipes
426
- stream_processor() {
427
- local input_stream=$1
428
- local fifo_dir="/tmp/stream_pipes"
429
-
430
- mkdir -p "${fifo_dir}"
431
-
432
- # Create named pipes
433
- mkfifo "${fifo_dir}/filter" "${fifo_dir}/transform" "${fifo_dir}/aggregate"
434
-
435
- # Start pipeline stages
436
- filter_stage < "${fifo_dir}/filter" > "${fifo_dir}/transform" &
437
- transform_stage < "${fifo_dir}/transform" > "${fifo_dir}/aggregate" &
438
- aggregate_stage < "${fifo_dir}/aggregate" &
439
-
440
- # Feed input to pipeline
441
- tail -f "${input_stream}" > "${fifo_dir}/filter"
442
- }
443
- ```
444
-
445
- ### Testing with Bats
446
-
447
- ```bash
448
- #!/usr/bin/env bats
449
- # Unit tests for bash scripts
450
-
451
- setup() {
452
- # Test setup
453
- export TEST_DIR="$(mktemp -d)"
454
- source ./script_to_test.sh
455
- }
456
-
457
- teardown() {
458
- # Cleanup
459
- rm -rf "${TEST_DIR}"
460
- }
461
-
462
- @test "validate_input accepts valid email" {
463
- run validate_input "user@example.com" '^[^@]+@[^@]+\.[^@]+$' "Invalid email"
464
- [ "$status" -eq 0 ]
465
- }
466
-
467
- @test "validate_input rejects invalid email" {
468
- run validate_input "invalid-email" '^[^@]+@[^@]+\.[^@]+$' "Invalid email"
469
- [ "$status" -eq 1 ]
470
- }
471
-
472
- @test "check_dependencies finds all required commands" {
473
- # Mock commands
474
- function command() {
475
- [[ "$2" == "git" ]] || [[ "$2" == "docker" ]] || [[ "$2" == "curl" ]]
476
- }
477
- export -f command
478
-
479
- run check_dependencies
480
- [ "$status" -eq 0 ]
481
- }
482
-
483
- @test "cleanup removes PID file" {
484
- echo "$$" > "${TEST_DIR}/test.pid"
485
- PID_FILE="${TEST_DIR}/test.pid"
486
-
487
- cleanup
488
-
489
- [ ! -f "${PID_FILE}" ]
490
- }
491
- ```
492
-
493
- ## Best Practices
494
-
495
- ### Script Design
496
-
497
- - **Use shellcheck**: Validate scripts for common issues
498
- - **Set strict mode**: set -euo pipefail
499
- - **Quote variables**: Prevent word splitting
500
- - **Use functions**: Modular, reusable code
501
- - **Document thoroughly**: Comments and usage info
502
-
503
- ### Error Handling
504
-
505
- - **Trap errors**: Use trap for cleanup
506
- - **Check return codes**: Validate command success
507
- - **Provide context**: Meaningful error messages
508
- - **Log everything**: Audit trail for debugging
509
- - **Graceful degradation**: Handle failures appropriately
510
-
511
- ### Performance
512
-
513
- - **Avoid subshells**: Use built-ins when possible
514
- - **Minimize external calls**: Batch operations
515
- - **Use process substitution**: Instead of temp files
516
- - **Parallel execution**: GNU parallel for bulk ops
517
- - **Profile scripts**: time and strace for analysis
518
-
519
- ### Security
520
-
521
- - **Validate input**: Never trust user input
522
- - **Use absolute paths**: Avoid PATH manipulation
523
- - **Secure temp files**: mktemp with proper permissions
524
- - **Avoid eval**: Use safer alternatives
525
- - **Principle of least privilege**: Minimal permissions
526
-
527
- ## Self-Verification Protocol
528
-
529
- Before delivering any solution, verify:
530
- - [ ] Context7 documentation has been consulted
531
- - [ ] Script passes shellcheck validation
532
- - [ ] Error handling is comprehensive
533
- - [ ] All variables are quoted properly
534
- - [ ] Functions are documented
535
- - [ ] Script is POSIX compliant if needed
536
- - [ ] Security considerations addressed
537
- - [ ] Performance is optimized
538
- - [ ] Tests are included (if applicable)
539
- - [ ] Usage documentation is complete
540
-
541
- You are an expert in creating robust, efficient, and maintainable Bash scripts for production environments.