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,330 +0,0 @@
1
- #!/bin/bash
2
- # Post Comment Script for Issue Sync
3
- # Posts formatted comments to GitHub issues
4
-
5
- set -euo pipefail
6
-
7
- # Load libraries
8
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
- source "${SCRIPT_DIR}/../../lib/logging-utils.sh"
10
- source "${SCRIPT_DIR}/../../lib/github-utils.sh"
11
- source "${SCRIPT_DIR}/../../lib/validation-utils.sh"
12
- source "${SCRIPT_DIR}/../../lib/datetime-utils.sh"
13
-
14
- # Script configuration
15
- readonly ISSUE_NUMBER="${1:-}"
16
- readonly COMMENT_FILE="${2:-}"
17
- readonly IS_COMPLETION="${3:-false}"
18
-
19
- # Global variables
20
- declare -g comment_id=""
21
- declare -g comment_url=""
22
-
23
- # Main function
24
- main() {
25
- print_banner "GitHub Comment Poster" "1.0.0"
26
-
27
- # Validate inputs
28
- log_info "Posting comment to issue #$ISSUE_NUMBER"
29
- validate_inputs || exit 1
30
-
31
- # Check GitHub authentication
32
- with_error_handling "GitHub authentication check" \
33
- check_github_authentication
34
-
35
- # Check if issue exists
36
- with_error_handling "Issue validation" \
37
- validate_issue_exists
38
-
39
- # Post comment to GitHub
40
- with_error_handling "Post comment to GitHub" \
41
- post_github_comment
42
-
43
- # Verify comment was posted
44
- with_error_handling "Verify comment posted" \
45
- verify_comment_posted
46
-
47
- # Display results
48
- display_results
49
-
50
- # Return comment URL
51
- echo "$comment_url"
52
- }
53
-
54
- # Validate script inputs
55
- validate_inputs() {
56
- log_function_entry "validate_inputs"
57
-
58
- if [[ -z "$ISSUE_NUMBER" ]]; then
59
- log_error "Issue number is required"
60
- return 1
61
- fi
62
-
63
- if [[ ! -f "$COMMENT_FILE" ]]; then
64
- log_error "Comment file not found: $COMMENT_FILE"
65
- return 1
66
- fi
67
-
68
- # Validate issue number format
69
- if ! [[ "$ISSUE_NUMBER" =~ ^[0-9]+$ ]]; then
70
- log_error "Invalid issue number format: $ISSUE_NUMBER"
71
- return 1
72
- fi
73
-
74
- log_function_exit "validate_inputs"
75
- return 0
76
- }
77
-
78
- # Check GitHub authentication
79
- check_github_authentication() {
80
- log_function_entry "check_github_authentication"
81
-
82
- log_info "Verifying GitHub CLI authentication"
83
-
84
- if ! validate_github_auth; then
85
- log_error "GitHub CLI authentication failed"
86
- echo "❌ GitHub CLI is not authenticated"
87
- echo "Please run: gh auth login"
88
- return 1
89
- fi
90
-
91
- log_success "GitHub CLI authenticated"
92
- log_function_exit "check_github_authentication"
93
- return 0
94
- }
95
-
96
- # Validate that the issue exists
97
- validate_issue_exists() {
98
- log_function_entry "validate_issue_exists"
99
-
100
- log_info "Validating issue #$ISSUE_NUMBER exists"
101
-
102
- local issue_state
103
- issue_state=$(check_issue_exists "$ISSUE_NUMBER")
104
-
105
- if [[ $? -ne 0 ]]; then
106
- log_error "Issue #$ISSUE_NUMBER not found"
107
- echo "❌ Issue #$ISSUE_NUMBER not found"
108
- return 1
109
- fi
110
-
111
- log_info "Issue #$ISSUE_NUMBER exists with state: $issue_state"
112
-
113
- # Warn if issue is closed
114
- if [[ "$issue_state" == "closed" ]]; then
115
- log_warning "Issue #$ISSUE_NUMBER is closed"
116
- echo "⚠️ Issue #$ISSUE_NUMBER is closed"
117
-
118
- # Interactive confirmation for closed issues
119
- if [[ -t 0 ]] && [[ "${AUTOPM_FORCE_SYNC:-}" != "true" ]]; then
120
- if ! confirm "Post comment to closed issue?"; then
121
- echo "Comment posting cancelled"
122
- exit 0
123
- fi
124
- fi
125
- fi
126
-
127
- log_function_exit "validate_issue_exists"
128
- return 0
129
- }
130
-
131
- # Post comment to GitHub issue
132
- post_github_comment() {
133
- log_function_entry "post_github_comment"
134
-
135
- log_info "Posting comment to issue #$ISSUE_NUMBER"
136
-
137
- # Check for dry run mode
138
- if [[ "${AUTOPM_DRY_RUN:-false}" == "true" ]]; then
139
- log_warning "DRY RUN mode - not posting comment"
140
- echo "🔸 DRY RUN: Would post comment to issue #$ISSUE_NUMBER"
141
- echo "Comment preview:"
142
- head -20 "$COMMENT_FILE" | sed 's/^/ /'
143
- echo " ..."
144
- comment_id="DRY-RUN"
145
- comment_url="https://github.com/DRYRUN/issues/$ISSUE_NUMBER#issuecomment-DRYRUN"
146
- log_function_exit "post_github_comment"
147
- return 0
148
- fi
149
-
150
- # Post the comment using GitHub CLI
151
- local response
152
- response=$(gh issue comment "$ISSUE_NUMBER" \
153
- --body-file "$COMMENT_FILE" \
154
- --json id,url 2>&1) || {
155
- log_error "Failed to post comment: $response"
156
- echo "❌ Failed to post comment to issue #$ISSUE_NUMBER"
157
- echo "Error: $response"
158
- return 1
159
- }
160
-
161
- # Extract comment ID and URL from response
162
- comment_id=$(echo "$response" | jq -r '.id' 2>/dev/null || echo "")
163
- comment_url=$(echo "$response" | jq -r '.url' 2>/dev/null || echo "")
164
-
165
- if [[ -z "$comment_id" ]] || [[ "$comment_id" == "null" ]]; then
166
- # Try alternative parsing for non-JSON response
167
- log_debug "Attempting alternative response parsing"
168
-
169
- # GitHub CLI sometimes returns just the URL
170
- if [[ "$response" =~ https://github.com/.*/issues/.*#issuecomment-.* ]]; then
171
- comment_url="$response"
172
- comment_id=$(echo "$response" | sed 's/.*#issuecomment-//')
173
- else
174
- log_error "Could not parse comment response: $response"
175
- echo "⚠️ Comment may have been posted but could not parse response"
176
- # Continue anyway as the comment might have been posted
177
- fi
178
- fi
179
-
180
- log_success "Comment posted successfully"
181
- log_debug "Comment ID: $comment_id"
182
- log_debug "Comment URL: $comment_url"
183
-
184
- log_function_exit "post_github_comment"
185
- return 0
186
- }
187
-
188
- # Verify comment was posted
189
- verify_comment_posted() {
190
- log_function_entry "verify_comment_posted"
191
-
192
- # Skip verification in dry run mode
193
- if [[ "${AUTOPM_DRY_RUN:-false}" == "true" ]]; then
194
- log_debug "Skipping verification in dry run mode"
195
- log_function_exit "verify_comment_posted"
196
- return 0
197
- fi
198
-
199
- log_info "Verifying comment was posted"
200
-
201
- # If we don't have a comment URL, try to get the latest comment
202
- if [[ -z "$comment_url" ]] || [[ "$comment_url" == "null" ]]; then
203
- log_debug "No comment URL, checking latest comments"
204
-
205
- # Get the last comment on the issue
206
- local latest_comment
207
- latest_comment=$(gh issue view "$ISSUE_NUMBER" \
208
- --json comments \
209
- --jq '.comments[-1].url' 2>/dev/null || echo "")
210
-
211
- if [[ -n "$latest_comment" ]]; then
212
- comment_url="$latest_comment"
213
- log_info "Found latest comment: $comment_url"
214
- else
215
- log_warning "Could not verify comment was posted"
216
- # Not a fatal error - comment might still have been posted
217
- fi
218
- else
219
- # Verify the comment exists by trying to view it
220
- local verify_response
221
- verify_response=$(gh api "${comment_url#https://github.com}" \
222
- --jq '.id' 2>/dev/null || echo "")
223
-
224
- if [[ -n "$verify_response" ]]; then
225
- log_success "Comment verified: exists at $comment_url"
226
- else
227
- log_warning "Could not verify comment at URL: $comment_url"
228
- fi
229
- fi
230
-
231
- log_function_exit "verify_comment_posted"
232
- return 0
233
- }
234
-
235
- # Display posting results
236
- display_results() {
237
- print_section "✅ Comment Posting Results"
238
-
239
- echo "Issue: #$ISSUE_NUMBER"
240
-
241
- if [[ "$IS_COMPLETION" == "true" ]]; then
242
- echo "Comment Type: Completion Comment"
243
- else
244
- echo "Comment Type: Progress Update"
245
- fi
246
-
247
- # Show comment size
248
- local comment_size
249
- comment_size=$(wc -c < "$COMMENT_FILE" 2>/dev/null || echo "0")
250
- echo "Comment Size: $comment_size characters"
251
-
252
- # Show posting status
253
- if [[ "${AUTOPM_DRY_RUN:-false}" == "true" ]]; then
254
- echo ""
255
- echo "🔸 DRY RUN - No actual comment posted"
256
- echo "Review the formatted comment at: $COMMENT_FILE"
257
- else
258
- if [[ -n "$comment_url" ]] && [[ "$comment_url" != "null" ]]; then
259
- echo ""
260
- echo "✅ Comment posted successfully"
261
- echo "🔗 View comment: $comment_url"
262
- else
263
- echo ""
264
- echo "⚠️ Comment posting status uncertain"
265
- echo "Please check issue #$ISSUE_NUMBER manually"
266
- fi
267
- fi
268
-
269
- # Show timestamp
270
- local current_time
271
- current_time=$(get_current_datetime)
272
- echo ""
273
- echo "Posted at: $current_time"
274
- }
275
-
276
- # Error handling
277
- handle_error() {
278
- local exit_code=$?
279
- log_error "Comment posting failed with exit code: $exit_code"
280
- log_error "Failed to post comment to issue: #$ISSUE_NUMBER"
281
-
282
- # Provide recovery suggestions
283
- echo ""
284
- echo "Recovery options:"
285
- echo "1. Check GitHub authentication: gh auth status"
286
- echo "2. Verify issue exists: gh issue view $ISSUE_NUMBER"
287
- echo "3. Try manual posting: gh issue comment $ISSUE_NUMBER --body-file $COMMENT_FILE"
288
- echo "4. Check network connectivity"
289
-
290
- exit "$exit_code"
291
- }
292
-
293
- # Set up error handling
294
- trap handle_error ERR
295
-
296
- # Validate arguments
297
- if [[ $# -lt 2 ]]; then
298
- echo "Usage: $0 <issue_number> <comment_file> [is_completion]"
299
- echo ""
300
- echo "Posts a formatted comment to a GitHub issue."
301
- echo ""
302
- echo "Arguments:"
303
- echo " issue_number GitHub issue number to post comment to"
304
- echo " comment_file Path to formatted comment file"
305
- echo " is_completion Optional: 'true' if completion comment (default: false)"
306
- echo ""
307
- echo "Environment Variables:"
308
- echo " AUTOPM_DRY_RUN=true Perform dry run without posting"
309
- echo " AUTOPM_FORCE_SYNC=true Skip confirmations for closed issues"
310
- echo " AUTOPM_LOG_LEVEL=0 Enable debug logging"
311
- echo ""
312
- echo "Examples:"
313
- echo " $0 123 /tmp/formatted-comment.md"
314
- echo " $0 456 /tmp/completion-comment.md true"
315
- echo " AUTOPM_DRY_RUN=true $0 789 /tmp/test-comment.md"
316
- echo ""
317
- echo "Output:"
318
- echo " Prints comment URL on success"
319
- echo " Returns 0 on success, non-zero on failure"
320
- echo ""
321
- echo "Error Recovery:"
322
- echo " - If posting fails, the formatted comment is preserved"
323
- echo " - You can manually post using: gh issue comment <number> --body-file <file>"
324
- echo " - Check GitHub status: gh auth status"
325
- echo ""
326
- exit 1
327
- fi
328
-
329
- # Run main function
330
- main "$@"
@@ -1,348 +0,0 @@
1
- #!/bin/bash
2
- # Preflight Validation Script for Issue Sync
3
- # Performs all necessary checks before syncing issue updates
4
-
5
- set -euo pipefail
6
-
7
- # Load libraries
8
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
- source "${SCRIPT_DIR}/../../lib/logging-utils.sh"
10
- source "${SCRIPT_DIR}/../../lib/github-utils.sh"
11
- source "${SCRIPT_DIR}/../../lib/frontmatter-utils.sh"
12
- source "${SCRIPT_DIR}/../../lib/validation-utils.sh"
13
- source "${SCRIPT_DIR}/../../lib/datetime-utils.sh"
14
-
15
- # Script configuration
16
- readonly ISSUE_NUMBER="${1:-}"
17
-
18
- # Global variables
19
- declare -g epic_name=""
20
- declare -g updates_dir=""
21
- declare -g progress_file=""
22
-
23
- # Main function
24
- main() {
25
- print_banner "Issue Sync Preflight Validation" "1.0.0"
26
-
27
- # Validate inputs
28
- log_info "Validating issue: #$ISSUE_NUMBER"
29
- validate_inputs || exit 1
30
-
31
- # Run all preflight checks
32
- with_error_handling "Repository protection check" \
33
- check_repository_protection
34
-
35
- with_error_handling "GitHub authentication check" \
36
- check_github_authentication
37
-
38
- with_error_handling "Issue validation" \
39
- validate_issue_exists
40
-
41
- with_error_handling "Local updates check" \
42
- check_local_updates
43
-
44
- with_error_handling "Sync timing check" \
45
- check_sync_timing
46
-
47
- with_error_handling "Changes verification" \
48
- verify_changes_exist
49
-
50
- # Output validation results
51
- display_validation_results
52
-
53
- log_success "All preflight checks passed successfully"
54
- }
55
-
56
- # Validate script inputs
57
- validate_inputs() {
58
- log_function_entry "validate_inputs"
59
-
60
- validate_issue_number "$ISSUE_NUMBER" || return 1
61
-
62
- log_function_exit "validate_inputs"
63
- return 0
64
- }
65
-
66
- # Check repository protection
67
- check_repository_protection() {
68
- log_function_entry "check_repository_protection"
69
-
70
- log_info "Checking repository protection against template repos"
71
- check_repo_protection
72
-
73
- log_function_exit "check_repository_protection"
74
- }
75
-
76
- # Check GitHub authentication
77
- check_github_authentication() {
78
- log_function_entry "check_github_authentication"
79
-
80
- log_info "Verifying GitHub CLI authentication"
81
- validate_github_auth
82
-
83
- log_function_exit "check_github_authentication"
84
- }
85
-
86
- # Validate that the issue exists and get its state
87
- validate_issue_exists() {
88
- log_function_entry "validate_issue_exists"
89
-
90
- log_info "Validating issue #$ISSUE_NUMBER exists"
91
-
92
- local issue_state
93
- issue_state=$(check_issue_exists "$ISSUE_NUMBER")
94
-
95
- if [[ $? -ne 0 ]]; then
96
- log_error "Issue #$ISSUE_NUMBER not found"
97
- echo "❌ Issue #$ISSUE_NUMBER not found"
98
- echo "Please verify the issue number and try again."
99
- return 1
100
- fi
101
-
102
- log_info "Issue #$ISSUE_NUMBER exists with state: $issue_state"
103
-
104
- # Warn if issue is closed but we're still syncing
105
- if [[ "$issue_state" == "closed" ]]; then
106
- log_warning "Issue #$ISSUE_NUMBER is closed"
107
- echo "⚠️ Issue #$ISSUE_NUMBER is closed but you're syncing updates."
108
- echo "This is unusual but allowed - the sync will proceed."
109
- fi
110
-
111
- log_function_exit "validate_issue_exists"
112
- return 0
113
- }
114
-
115
- # Check for local updates directory and files
116
- check_local_updates() {
117
- log_function_entry "check_local_updates"
118
-
119
- log_info "Checking for local updates directory"
120
-
121
- # Find the epic that contains this issue
122
- local found_epic=""
123
- for epic_dir in .claude/epics/*/; do
124
- [[ -d "$epic_dir" ]] || continue
125
-
126
- local epic_updates_dir="$epic_dir/updates/$ISSUE_NUMBER"
127
- if [[ -d "$epic_updates_dir" ]]; then
128
- found_epic=$(basename "$epic_dir")
129
- updates_dir="$epic_updates_dir"
130
- progress_file="$epic_updates_dir/progress.md"
131
- break
132
- fi
133
- done
134
-
135
- if [[ -z "$found_epic" ]]; then
136
- log_error "No local updates found for issue #$ISSUE_NUMBER"
137
- echo "❌ No local updates found for issue #$ISSUE_NUMBER"
138
- echo "Initialize issue tracking with: /pm:issue-start $ISSUE_NUMBER"
139
- return 1
140
- fi
141
-
142
- epic_name="$found_epic"
143
- log_info "Found updates in epic: $epic_name"
144
- log_debug "Updates directory: $updates_dir"
145
-
146
- # Check if progress.md exists
147
- if [[ ! -f "$progress_file" ]]; then
148
- log_error "No progress tracking found"
149
- echo "❌ No progress tracking found for issue #$ISSUE_NUMBER"
150
- echo "Initialize with: /pm:issue-start $ISSUE_NUMBER"
151
- return 1
152
- fi
153
-
154
- log_success "Local updates directory found: $updates_dir"
155
- log_function_exit "check_local_updates"
156
- return 0
157
- }
158
-
159
- # Check timing of last sync to avoid too frequent syncs
160
- check_sync_timing() {
161
- log_function_entry "check_sync_timing"
162
-
163
- log_info "Checking last sync timing"
164
-
165
- local last_sync
166
- last_sync=$(get_frontmatter_field "$progress_file" "last_sync" 2>/dev/null || echo "")
167
-
168
- if [[ -n "$last_sync" ]]; then
169
- local current_time
170
- current_time=$(get_current_datetime)
171
-
172
- local time_diff
173
- time_diff=$(datetime_diff_minutes "$last_sync" "$current_time" 2>/dev/null || echo "999")
174
-
175
- log_debug "Last sync: $last_sync, Current: $current_time, Diff: ${time_diff}m"
176
-
177
- if [[ "$time_diff" -lt 5 ]]; then
178
- log_warning "Recent sync detected (${time_diff} minutes ago)"
179
- echo "⚠️ Issue was synced recently (${time_diff} minutes ago at $last_sync)"
180
-
181
- # Interactive confirmation in non-automated environments
182
- if [[ -t 0 ]] && [[ "${AUTOPM_FORCE_SYNC:-}" != "true" ]]; then
183
- echo "Force sync anyway? Set AUTOPM_FORCE_SYNC=true to skip this check."
184
- if ! confirm "Continue with sync?"; then
185
- echo "Sync cancelled by user"
186
- exit 0
187
- fi
188
- fi
189
- fi
190
- else
191
- log_info "No previous sync timestamp found - this appears to be the first sync"
192
- fi
193
-
194
- log_function_exit "check_sync_timing"
195
- return 0
196
- }
197
-
198
- # Verify that there are actually changes to sync
199
- verify_changes_exist() {
200
- log_function_entry "verify_changes_exist"
201
-
202
- log_info "Verifying that changes exist to sync"
203
-
204
- # Get last sync timestamp
205
- local last_sync
206
- last_sync=$(get_frontmatter_field "$progress_file" "last_sync" 2>/dev/null || echo "")
207
-
208
- local has_changes=false
209
-
210
- # Check if progress.md has been modified since last sync
211
- if [[ -f "$progress_file" ]]; then
212
- if [[ -z "$last_sync" ]]; then
213
- # No previous sync, so there are changes
214
- has_changes=true
215
- log_debug "No previous sync - treating as changes exist"
216
- else
217
- # Check file modification time vs last sync
218
- local file_mtime_iso
219
- if command -v gstat >/dev/null 2>&1; then
220
- # GNU stat (macOS with coreutils)
221
- file_mtime_iso=$(gstat -c %Y "$progress_file" | xargs -I {} date -u -d "@{}" +"%Y-%m-%dT%H:%M:%SZ")
222
- else
223
- # BSD stat (macOS default) or Linux stat
224
- file_mtime_iso=$(stat -f %m "$progress_file" 2>/dev/null | xargs -I {} date -u -r {} +"%Y-%m-%dT%H:%M:%SZ" ||
225
- stat -c %Y "$progress_file" | xargs -I {} date -u -d "@{}" +"%Y-%m-%dT%H:%M:%SZ")
226
- fi
227
-
228
- if datetime_is_after "$file_mtime_iso" "$last_sync" 2>/dev/null; then
229
- has_changes=true
230
- log_debug "Progress file modified after last sync"
231
- fi
232
- fi
233
- fi
234
-
235
- # Check for other update files
236
- if [[ -d "$updates_dir" ]]; then
237
- local update_files
238
- update_files=$(find "$updates_dir" -name "*.md" -type f | wc -l)
239
- if [[ "$update_files" -gt 1 ]]; then # More than just progress.md
240
- has_changes=true
241
- log_debug "Found $update_files update files"
242
- fi
243
- fi
244
-
245
- if [[ "$has_changes" != "true" ]]; then
246
- local last_sync_formatted
247
- last_sync_formatted=$(echo "$last_sync" | sed 's/T/ /' | sed 's/Z//')
248
-
249
- log_info "No new updates found since last sync"
250
- echo "ℹ️ No new updates to sync since $last_sync_formatted"
251
- echo "All changes have already been synchronized to GitHub."
252
- exit 0
253
- fi
254
-
255
- log_success "Changes detected - sync can proceed"
256
- log_function_exit "verify_changes_exist"
257
- return 0
258
- }
259
-
260
- # Display validation results summary
261
- display_validation_results() {
262
- print_section "✅ Preflight Validation Results"
263
-
264
- echo "Issue: #$ISSUE_NUMBER"
265
- echo "Epic: $epic_name"
266
- echo "Updates Directory: $updates_dir"
267
- echo "Progress File: $progress_file"
268
-
269
- # Show basic issue info if possible
270
- if command -v gh >/dev/null 2>&1; then
271
- local issue_title
272
- issue_title=$(gh issue view "$ISSUE_NUMBER" --json title -q .title 2>/dev/null || echo "Unknown")
273
- echo "Issue Title: $issue_title"
274
- fi
275
-
276
- # Show completion status
277
- local completion
278
- completion=$(get_frontmatter_field "$progress_file" "completion" 2>/dev/null || echo "Unknown")
279
- echo "Current Completion: $completion"
280
-
281
- # Show last sync info
282
- local last_sync
283
- last_sync=$(get_frontmatter_field "$progress_file" "last_sync" 2>/dev/null || echo "Never")
284
- echo "Last Sync: $last_sync"
285
-
286
- echo ""
287
- echo "✅ All preflight checks passed"
288
- echo "✅ Ready to sync updates to GitHub"
289
- }
290
-
291
- # Get epic name for the issue
292
- get_epic_name() {
293
- echo "$epic_name"
294
- }
295
-
296
- # Get updates directory path
297
- get_updates_directory() {
298
- echo "$updates_dir"
299
- }
300
-
301
- # Get progress file path
302
- get_progress_file() {
303
- echo "$progress_file"
304
- }
305
-
306
- # Error handling
307
- handle_error() {
308
- local exit_code=$?
309
- log_error "Preflight validation failed with exit code: $exit_code"
310
- log_error "Issue sync preflight failed for: #$ISSUE_NUMBER"
311
- exit "$exit_code"
312
- }
313
-
314
- # Set up error handling
315
- trap handle_error ERR
316
-
317
- # Validate arguments
318
- if [[ $# -ne 1 ]]; then
319
- echo "Usage: $0 <issue_number>"
320
- echo ""
321
- echo "Performs preflight validation for issue sync operation."
322
- echo ""
323
- echo "Checks performed:"
324
- echo " 1. Repository protection (prevents syncing to template repos)"
325
- echo " 2. GitHub CLI authentication"
326
- echo " 3. Issue existence and state validation"
327
- echo " 4. Local updates directory and files"
328
- echo " 5. Sync timing (prevents too frequent syncs)"
329
- echo " 6. Changes verification (ensures there's something to sync)"
330
- echo ""
331
- echo "Environment Variables:"
332
- echo " AUTOPM_FORCE_SYNC=true Skip timing checks and force sync"
333
- echo " AUTOPM_LOG_LEVEL=0 Enable debug logging"
334
- echo ""
335
- echo "Examples:"
336
- echo " $0 123"
337
- echo " AUTOPM_FORCE_SYNC=true $0 456"
338
- echo ""
339
- echo "Output Functions (for use by other scripts):"
340
- echo " get_epic_name Returns the epic name containing the issue"
341
- echo " get_updates_directory Returns the path to updates directory"
342
- echo " get_progress_file Returns the path to progress.md file"
343
- echo ""
344
- exit 1
345
- fi
346
-
347
- # Run main function
348
- main "$@"