claude-autopm 2.8.1 → 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 (273) hide show
  1. package/README.md +116 -8
  2. package/bin/autopm.js +2 -0
  3. package/bin/commands/plugin.js +395 -0
  4. package/bin/commands/team.js +184 -10
  5. package/install/install.js +223 -4
  6. package/lib/plugins/PluginManager.js +1328 -0
  7. package/lib/plugins/PluginManager.old.js +400 -0
  8. package/package.json +4 -1
  9. package/scripts/publish-plugins.sh +166 -0
  10. package/autopm/.claude/agents/cloud/README.md +0 -55
  11. package/autopm/.claude/agents/cloud/aws-cloud-architect.md +0 -521
  12. package/autopm/.claude/agents/cloud/azure-cloud-architect.md +0 -436
  13. package/autopm/.claude/agents/cloud/gcp-cloud-architect.md +0 -385
  14. package/autopm/.claude/agents/cloud/gcp-cloud-functions-engineer.md +0 -306
  15. package/autopm/.claude/agents/cloud/gemini-api-expert.md +0 -880
  16. package/autopm/.claude/agents/cloud/kubernetes-orchestrator.md +0 -566
  17. package/autopm/.claude/agents/cloud/openai-python-expert.md +0 -1087
  18. package/autopm/.claude/agents/cloud/terraform-infrastructure-expert.md +0 -454
  19. package/autopm/.claude/agents/core/agent-manager.md +0 -296
  20. package/autopm/.claude/agents/core/code-analyzer.md +0 -131
  21. package/autopm/.claude/agents/core/file-analyzer.md +0 -162
  22. package/autopm/.claude/agents/core/test-runner.md +0 -200
  23. package/autopm/.claude/agents/data/airflow-orchestration-expert.md +0 -52
  24. package/autopm/.claude/agents/data/kedro-pipeline-expert.md +0 -50
  25. package/autopm/.claude/agents/data/langgraph-workflow-expert.md +0 -520
  26. package/autopm/.claude/agents/databases/README.md +0 -50
  27. package/autopm/.claude/agents/databases/bigquery-expert.md +0 -392
  28. package/autopm/.claude/agents/databases/cosmosdb-expert.md +0 -368
  29. package/autopm/.claude/agents/databases/mongodb-expert.md +0 -398
  30. package/autopm/.claude/agents/databases/postgresql-expert.md +0 -321
  31. package/autopm/.claude/agents/databases/redis-expert.md +0 -52
  32. package/autopm/.claude/agents/devops/README.md +0 -52
  33. package/autopm/.claude/agents/devops/azure-devops-specialist.md +0 -308
  34. package/autopm/.claude/agents/devops/docker-containerization-expert.md +0 -298
  35. package/autopm/.claude/agents/devops/github-operations-specialist.md +0 -335
  36. package/autopm/.claude/agents/devops/mcp-context-manager.md +0 -319
  37. package/autopm/.claude/agents/devops/observability-engineer.md +0 -574
  38. package/autopm/.claude/agents/devops/ssh-operations-expert.md +0 -1093
  39. package/autopm/.claude/agents/devops/traefik-proxy-expert.md +0 -444
  40. package/autopm/.claude/agents/frameworks/README.md +0 -64
  41. package/autopm/.claude/agents/frameworks/e2e-test-engineer.md +0 -360
  42. package/autopm/.claude/agents/frameworks/nats-messaging-expert.md +0 -254
  43. package/autopm/.claude/agents/frameworks/react-frontend-engineer.md +0 -217
  44. package/autopm/.claude/agents/frameworks/react-ui-expert.md +0 -226
  45. package/autopm/.claude/agents/frameworks/tailwindcss-expert.md +0 -770
  46. package/autopm/.claude/agents/frameworks/ux-design-expert.md +0 -244
  47. package/autopm/.claude/agents/integration/message-queue-engineer.md +0 -794
  48. package/autopm/.claude/agents/languages/README.md +0 -50
  49. package/autopm/.claude/agents/languages/bash-scripting-expert.md +0 -541
  50. package/autopm/.claude/agents/languages/javascript-frontend-engineer.md +0 -197
  51. package/autopm/.claude/agents/languages/nodejs-backend-engineer.md +0 -226
  52. package/autopm/.claude/agents/languages/python-backend-engineer.md +0 -214
  53. package/autopm/.claude/agents/languages/python-backend-expert.md +0 -289
  54. package/autopm/.claude/agents/testing/frontend-testing-engineer.md +0 -395
  55. package/autopm/.claude/commands/ai/langgraph-workflow.md +0 -65
  56. package/autopm/.claude/commands/ai/openai-chat.md +0 -65
  57. package/autopm/.claude/commands/azure/COMMANDS.md +0 -107
  58. package/autopm/.claude/commands/azure/COMMAND_MAPPING.md +0 -252
  59. package/autopm/.claude/commands/azure/INTEGRATION_FIX.md +0 -103
  60. package/autopm/.claude/commands/azure/README.md +0 -246
  61. package/autopm/.claude/commands/azure/active-work.md +0 -198
  62. package/autopm/.claude/commands/azure/aliases.md +0 -143
  63. package/autopm/.claude/commands/azure/blocked-items.md +0 -287
  64. package/autopm/.claude/commands/azure/clean.md +0 -93
  65. package/autopm/.claude/commands/azure/docs-query.md +0 -48
  66. package/autopm/.claude/commands/azure/feature-decompose.md +0 -380
  67. package/autopm/.claude/commands/azure/feature-list.md +0 -61
  68. package/autopm/.claude/commands/azure/feature-new.md +0 -115
  69. package/autopm/.claude/commands/azure/feature-show.md +0 -205
  70. package/autopm/.claude/commands/azure/feature-start.md +0 -130
  71. package/autopm/.claude/commands/azure/fix-integration-example.md +0 -93
  72. package/autopm/.claude/commands/azure/help.md +0 -150
  73. package/autopm/.claude/commands/azure/import-us.md +0 -269
  74. package/autopm/.claude/commands/azure/init.md +0 -211
  75. package/autopm/.claude/commands/azure/next-task.md +0 -262
  76. package/autopm/.claude/commands/azure/search.md +0 -160
  77. package/autopm/.claude/commands/azure/sprint-status.md +0 -235
  78. package/autopm/.claude/commands/azure/standup.md +0 -260
  79. package/autopm/.claude/commands/azure/sync-all.md +0 -99
  80. package/autopm/.claude/commands/azure/task-analyze.md +0 -186
  81. package/autopm/.claude/commands/azure/task-close.md +0 -329
  82. package/autopm/.claude/commands/azure/task-edit.md +0 -145
  83. package/autopm/.claude/commands/azure/task-list.md +0 -263
  84. package/autopm/.claude/commands/azure/task-new.md +0 -84
  85. package/autopm/.claude/commands/azure/task-reopen.md +0 -79
  86. package/autopm/.claude/commands/azure/task-show.md +0 -126
  87. package/autopm/.claude/commands/azure/task-start.md +0 -301
  88. package/autopm/.claude/commands/azure/task-status.md +0 -65
  89. package/autopm/.claude/commands/azure/task-sync.md +0 -67
  90. package/autopm/.claude/commands/azure/us-edit.md +0 -164
  91. package/autopm/.claude/commands/azure/us-list.md +0 -202
  92. package/autopm/.claude/commands/azure/us-new.md +0 -265
  93. package/autopm/.claude/commands/azure/us-parse.md +0 -253
  94. package/autopm/.claude/commands/azure/us-show.md +0 -188
  95. package/autopm/.claude/commands/azure/us-status.md +0 -320
  96. package/autopm/.claude/commands/azure/validate.md +0 -86
  97. package/autopm/.claude/commands/azure/work-item-sync.md +0 -47
  98. package/autopm/.claude/commands/cloud/infra-deploy.md +0 -38
  99. package/autopm/.claude/commands/github/workflow-create.md +0 -42
  100. package/autopm/.claude/commands/infrastructure/ssh-security.md +0 -65
  101. package/autopm/.claude/commands/infrastructure/traefik-setup.md +0 -65
  102. package/autopm/.claude/commands/kubernetes/deploy.md +0 -37
  103. package/autopm/.claude/commands/playwright/test-scaffold.md +0 -38
  104. package/autopm/.claude/commands/pm/blocked.md +0 -28
  105. package/autopm/.claude/commands/pm/clean.md +0 -119
  106. package/autopm/.claude/commands/pm/context-create.md +0 -136
  107. package/autopm/.claude/commands/pm/context-prime.md +0 -170
  108. package/autopm/.claude/commands/pm/context-update.md +0 -292
  109. package/autopm/.claude/commands/pm/context.md +0 -28
  110. package/autopm/.claude/commands/pm/epic-close.md +0 -86
  111. package/autopm/.claude/commands/pm/epic-decompose.md +0 -370
  112. package/autopm/.claude/commands/pm/epic-edit.md +0 -83
  113. package/autopm/.claude/commands/pm/epic-list.md +0 -30
  114. package/autopm/.claude/commands/pm/epic-merge.md +0 -222
  115. package/autopm/.claude/commands/pm/epic-oneshot.md +0 -119
  116. package/autopm/.claude/commands/pm/epic-refresh.md +0 -119
  117. package/autopm/.claude/commands/pm/epic-show.md +0 -28
  118. package/autopm/.claude/commands/pm/epic-split.md +0 -120
  119. package/autopm/.claude/commands/pm/epic-start.md +0 -195
  120. package/autopm/.claude/commands/pm/epic-status.md +0 -28
  121. package/autopm/.claude/commands/pm/epic-sync-modular.md +0 -338
  122. package/autopm/.claude/commands/pm/epic-sync-original.md +0 -473
  123. package/autopm/.claude/commands/pm/epic-sync.md +0 -486
  124. package/autopm/.claude/commands/pm/help.md +0 -28
  125. package/autopm/.claude/commands/pm/import.md +0 -115
  126. package/autopm/.claude/commands/pm/in-progress.md +0 -28
  127. package/autopm/.claude/commands/pm/init.md +0 -28
  128. package/autopm/.claude/commands/pm/issue-analyze.md +0 -202
  129. package/autopm/.claude/commands/pm/issue-close.md +0 -119
  130. package/autopm/.claude/commands/pm/issue-edit.md +0 -93
  131. package/autopm/.claude/commands/pm/issue-reopen.md +0 -87
  132. package/autopm/.claude/commands/pm/issue-show.md +0 -41
  133. package/autopm/.claude/commands/pm/issue-start.md +0 -234
  134. package/autopm/.claude/commands/pm/issue-status.md +0 -95
  135. package/autopm/.claude/commands/pm/issue-sync.md +0 -411
  136. package/autopm/.claude/commands/pm/next.md +0 -28
  137. package/autopm/.claude/commands/pm/prd-edit.md +0 -82
  138. package/autopm/.claude/commands/pm/prd-list.md +0 -28
  139. package/autopm/.claude/commands/pm/prd-new.md +0 -55
  140. package/autopm/.claude/commands/pm/prd-parse.md +0 -42
  141. package/autopm/.claude/commands/pm/prd-status.md +0 -28
  142. package/autopm/.claude/commands/pm/search.md +0 -28
  143. package/autopm/.claude/commands/pm/standup.md +0 -28
  144. package/autopm/.claude/commands/pm/status.md +0 -28
  145. package/autopm/.claude/commands/pm/sync.md +0 -99
  146. package/autopm/.claude/commands/pm/test-reference-update.md +0 -151
  147. package/autopm/.claude/commands/pm/validate.md +0 -28
  148. package/autopm/.claude/commands/pm/what-next.md +0 -28
  149. package/autopm/.claude/commands/python/api-scaffold.md +0 -50
  150. package/autopm/.claude/commands/python/docs-query.md +0 -48
  151. package/autopm/.claude/commands/react/app-scaffold.md +0 -50
  152. package/autopm/.claude/commands/testing/prime.md +0 -314
  153. package/autopm/.claude/commands/testing/run.md +0 -125
  154. package/autopm/.claude/commands/ui/bootstrap-scaffold.md +0 -65
  155. package/autopm/.claude/commands/ui/tailwind-system.md +0 -64
  156. package/autopm/.claude/rules/ai-integration-patterns.md +0 -219
  157. package/autopm/.claude/rules/ci-cd-kubernetes-strategy.md +0 -25
  158. package/autopm/.claude/rules/database-management-strategy.md +0 -17
  159. package/autopm/.claude/rules/database-pipeline.md +0 -94
  160. package/autopm/.claude/rules/devops-troubleshooting-playbook.md +0 -450
  161. package/autopm/.claude/rules/docker-first-development.md +0 -404
  162. package/autopm/.claude/rules/infrastructure-pipeline.md +0 -128
  163. package/autopm/.claude/rules/performance-guidelines.md +0 -403
  164. package/autopm/.claude/rules/ui-development-standards.md +0 -281
  165. package/autopm/.claude/rules/ui-framework-rules.md +0 -151
  166. package/autopm/.claude/rules/ux-design-rules.md +0 -209
  167. package/autopm/.claude/rules/visual-testing.md +0 -223
  168. package/autopm/.claude/scripts/azure/README.md +0 -192
  169. package/autopm/.claude/scripts/azure/active-work.js +0 -524
  170. package/autopm/.claude/scripts/azure/active-work.sh +0 -20
  171. package/autopm/.claude/scripts/azure/blocked.js +0 -520
  172. package/autopm/.claude/scripts/azure/blocked.sh +0 -20
  173. package/autopm/.claude/scripts/azure/daily.js +0 -533
  174. package/autopm/.claude/scripts/azure/daily.sh +0 -20
  175. package/autopm/.claude/scripts/azure/dashboard.js +0 -970
  176. package/autopm/.claude/scripts/azure/dashboard.sh +0 -20
  177. package/autopm/.claude/scripts/azure/feature-list.js +0 -254
  178. package/autopm/.claude/scripts/azure/feature-list.sh +0 -20
  179. package/autopm/.claude/scripts/azure/feature-show.js +0 -7
  180. package/autopm/.claude/scripts/azure/feature-show.sh +0 -20
  181. package/autopm/.claude/scripts/azure/feature-status.js +0 -604
  182. package/autopm/.claude/scripts/azure/feature-status.sh +0 -20
  183. package/autopm/.claude/scripts/azure/help.js +0 -342
  184. package/autopm/.claude/scripts/azure/help.sh +0 -20
  185. package/autopm/.claude/scripts/azure/next-task.js +0 -508
  186. package/autopm/.claude/scripts/azure/next-task.sh +0 -20
  187. package/autopm/.claude/scripts/azure/search.js +0 -469
  188. package/autopm/.claude/scripts/azure/search.sh +0 -20
  189. package/autopm/.claude/scripts/azure/setup.js +0 -745
  190. package/autopm/.claude/scripts/azure/setup.sh +0 -20
  191. package/autopm/.claude/scripts/azure/sprint-report.js +0 -1012
  192. package/autopm/.claude/scripts/azure/sprint-report.sh +0 -20
  193. package/autopm/.claude/scripts/azure/sync.js +0 -563
  194. package/autopm/.claude/scripts/azure/sync.sh +0 -20
  195. package/autopm/.claude/scripts/azure/us-list.js +0 -210
  196. package/autopm/.claude/scripts/azure/us-list.sh +0 -20
  197. package/autopm/.claude/scripts/azure/us-status.js +0 -238
  198. package/autopm/.claude/scripts/azure/us-status.sh +0 -20
  199. package/autopm/.claude/scripts/azure/validate.js +0 -626
  200. package/autopm/.claude/scripts/azure/validate.sh +0 -20
  201. package/autopm/.claude/scripts/azure/wrapper-template.sh +0 -20
  202. package/autopm/.claude/scripts/github/dependency-tracker.js +0 -554
  203. package/autopm/.claude/scripts/github/dependency-validator.js +0 -545
  204. package/autopm/.claude/scripts/github/dependency-visualizer.js +0 -477
  205. package/autopm/.claude/scripts/pm/analytics.js +0 -425
  206. package/autopm/.claude/scripts/pm/blocked.js +0 -164
  207. package/autopm/.claude/scripts/pm/blocked.sh +0 -78
  208. package/autopm/.claude/scripts/pm/clean.js +0 -464
  209. package/autopm/.claude/scripts/pm/context-create.js +0 -216
  210. package/autopm/.claude/scripts/pm/context-prime.js +0 -335
  211. package/autopm/.claude/scripts/pm/context-update.js +0 -344
  212. package/autopm/.claude/scripts/pm/context.js +0 -338
  213. package/autopm/.claude/scripts/pm/epic-close.js +0 -347
  214. package/autopm/.claude/scripts/pm/epic-edit.js +0 -382
  215. package/autopm/.claude/scripts/pm/epic-list.js +0 -273
  216. package/autopm/.claude/scripts/pm/epic-list.sh +0 -109
  217. package/autopm/.claude/scripts/pm/epic-show.js +0 -291
  218. package/autopm/.claude/scripts/pm/epic-show.sh +0 -105
  219. package/autopm/.claude/scripts/pm/epic-split.js +0 -522
  220. package/autopm/.claude/scripts/pm/epic-start/epic-start.js +0 -183
  221. package/autopm/.claude/scripts/pm/epic-start/epic-start.sh +0 -94
  222. package/autopm/.claude/scripts/pm/epic-status.js +0 -291
  223. package/autopm/.claude/scripts/pm/epic-status.sh +0 -104
  224. package/autopm/.claude/scripts/pm/epic-sync/README.md +0 -208
  225. package/autopm/.claude/scripts/pm/epic-sync/create-epic-issue.sh +0 -77
  226. package/autopm/.claude/scripts/pm/epic-sync/create-task-issues.sh +0 -86
  227. package/autopm/.claude/scripts/pm/epic-sync/update-epic-file.sh +0 -79
  228. package/autopm/.claude/scripts/pm/epic-sync/update-references.sh +0 -89
  229. package/autopm/.claude/scripts/pm/epic-sync.sh +0 -137
  230. package/autopm/.claude/scripts/pm/help.js +0 -92
  231. package/autopm/.claude/scripts/pm/help.sh +0 -90
  232. package/autopm/.claude/scripts/pm/in-progress.js +0 -178
  233. package/autopm/.claude/scripts/pm/in-progress.sh +0 -93
  234. package/autopm/.claude/scripts/pm/init.js +0 -321
  235. package/autopm/.claude/scripts/pm/init.sh +0 -178
  236. package/autopm/.claude/scripts/pm/issue-close.js +0 -232
  237. package/autopm/.claude/scripts/pm/issue-edit.js +0 -310
  238. package/autopm/.claude/scripts/pm/issue-show.js +0 -272
  239. package/autopm/.claude/scripts/pm/issue-start.js +0 -181
  240. package/autopm/.claude/scripts/pm/issue-sync/format-comment.sh +0 -468
  241. package/autopm/.claude/scripts/pm/issue-sync/gather-updates.sh +0 -460
  242. package/autopm/.claude/scripts/pm/issue-sync/post-comment.sh +0 -330
  243. package/autopm/.claude/scripts/pm/issue-sync/preflight-validation.sh +0 -348
  244. package/autopm/.claude/scripts/pm/issue-sync/update-frontmatter.sh +0 -387
  245. package/autopm/.claude/scripts/pm/lib/README.md +0 -85
  246. package/autopm/.claude/scripts/pm/lib/epic-discovery.js +0 -119
  247. package/autopm/.claude/scripts/pm/lib/logger.js +0 -78
  248. package/autopm/.claude/scripts/pm/next.js +0 -189
  249. package/autopm/.claude/scripts/pm/next.sh +0 -72
  250. package/autopm/.claude/scripts/pm/optimize.js +0 -407
  251. package/autopm/.claude/scripts/pm/pr-create.js +0 -337
  252. package/autopm/.claude/scripts/pm/pr-list.js +0 -257
  253. package/autopm/.claude/scripts/pm/prd-list.js +0 -242
  254. package/autopm/.claude/scripts/pm/prd-list.sh +0 -103
  255. package/autopm/.claude/scripts/pm/prd-new.js +0 -684
  256. package/autopm/.claude/scripts/pm/prd-parse.js +0 -547
  257. package/autopm/.claude/scripts/pm/prd-status.js +0 -152
  258. package/autopm/.claude/scripts/pm/prd-status.sh +0 -63
  259. package/autopm/.claude/scripts/pm/release.js +0 -460
  260. package/autopm/.claude/scripts/pm/search.js +0 -192
  261. package/autopm/.claude/scripts/pm/search.sh +0 -89
  262. package/autopm/.claude/scripts/pm/standup.js +0 -362
  263. package/autopm/.claude/scripts/pm/standup.sh +0 -95
  264. package/autopm/.claude/scripts/pm/status.js +0 -148
  265. package/autopm/.claude/scripts/pm/status.sh +0 -59
  266. package/autopm/.claude/scripts/pm/sync-batch.js +0 -337
  267. package/autopm/.claude/scripts/pm/sync.js +0 -343
  268. package/autopm/.claude/scripts/pm/template-list.js +0 -141
  269. package/autopm/.claude/scripts/pm/template-new.js +0 -366
  270. package/autopm/.claude/scripts/pm/validate.js +0 -274
  271. package/autopm/.claude/scripts/pm/validate.sh +0 -106
  272. package/autopm/.claude/scripts/pm/what-next.js +0 -660
  273. package/bin/node/azure-feature-show.js +0 -7
@@ -1,464 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Clean - Archive completed work and maintain project hygiene
4
- */
5
-
6
- const fs = require('fs');
7
- const path = require('path');
8
-
9
- class ProjectCleaner {
10
- constructor() {
11
- this.claudeDir = '.claude';
12
- this.archiveDir = path.join(this.claudeDir, 'archive');
13
- this.completedFile = path.join(this.claudeDir, 'completed-work.json');
14
- this.activeWorkFile = path.join(this.claudeDir, 'active-work.json');
15
- this.issuesDir = path.join(this.claudeDir, 'issues');
16
- this.epicsDir = path.join(this.claudeDir, 'epics');
17
- this.prdsDir = path.join(this.claudeDir, 'prds');
18
- }
19
-
20
- ensureArchiveDir() {
21
- if (!fs.existsSync(this.archiveDir)) {
22
- fs.mkdirSync(this.archiveDir, { recursive: true });
23
- }
24
-
25
- // Create subdirectories
26
- ['issues', 'epics', 'prds', 'logs'].forEach(subdir => {
27
- const dir = path.join(this.archiveDir, subdir);
28
- if (!fs.existsSync(dir)) {
29
- fs.mkdirSync(dir, { recursive: true });
30
- }
31
- });
32
- }
33
-
34
- loadCompletedWork() {
35
- if (!fs.existsSync(this.completedFile)) {
36
- return { issues: [], epics: [] };
37
- }
38
- try {
39
- return JSON.parse(fs.readFileSync(this.completedFile, 'utf8'));
40
- } catch {
41
- return { issues: [], epics: [] };
42
- }
43
- }
44
-
45
- async cleanProject(options = {}) {
46
- console.log(`\n🧹 Cleaning Project`);
47
- console.log(`${'═'.repeat(50)}\n`);
48
-
49
- this.ensureArchiveDir();
50
-
51
- const stats = {
52
- archivedIssues: 0,
53
- archivedEpics: 0,
54
- archivedPrds: 0,
55
- cleanedLogs: 0,
56
- freedSpace: 0
57
- };
58
-
59
- // 1. Archive completed issues
60
- if (!options.skipIssues) {
61
- stats.archivedIssues = await this.archiveCompletedIssues(options.daysOld || 30);
62
- }
63
-
64
- // 2. Archive completed epics
65
- if (!options.skipEpics) {
66
- stats.archivedEpics = await this.archiveCompletedEpics(options.daysOld || 60);
67
- }
68
-
69
- // 3. Archive old PRDs
70
- if (!options.skipPrds) {
71
- stats.archivedPrds = await this.archiveOldPrds(options.daysOld || 90);
72
- }
73
-
74
- // 4. Clean old logs
75
- if (!options.skipLogs) {
76
- stats.cleanedLogs = await this.cleanOldLogs(options.daysOld || 7);
77
- }
78
-
79
- // 5. Compact completed work file
80
- if (!options.skipCompact) {
81
- await this.compactCompletedWork(options.maxCompleted || 100);
82
- }
83
-
84
- // 6. Remove empty directories
85
- await this.removeEmptyDirectories();
86
-
87
- // Calculate freed space
88
- stats.freedSpace = this.calculateFreedSpace(stats);
89
-
90
- // Display summary
91
- this.displaySummary(stats);
92
-
93
- return stats;
94
- }
95
-
96
- async archiveCompletedIssues(daysOld) {
97
- console.log('šŸ“‹ Archiving completed issues...');
98
-
99
- const completedWork = this.loadCompletedWork();
100
- const cutoffDate = new Date();
101
- cutoffDate.setDate(cutoffDate.getDate() - daysOld);
102
-
103
- let archived = 0;
104
-
105
- // Archive from completed work tracking
106
- const remainingIssues = [];
107
- for (const issue of completedWork.issues) {
108
- const completedDate = new Date(issue.completedAt);
109
- if (completedDate < cutoffDate) {
110
- // Archive issue file if exists
111
- const issueFile = path.join(this.issuesDir, `${issue.id}.md`);
112
- if (fs.existsSync(issueFile)) {
113
- const archivePath = path.join(this.archiveDir, 'issues', `${issue.id}.md`);
114
- fs.renameSync(issueFile, archivePath);
115
- archived++;
116
- }
117
-
118
- // Archive to JSON
119
- this.archiveToJson('issues', issue);
120
- } else {
121
- remainingIssues.push(issue);
122
- }
123
- }
124
-
125
- // Update completed work
126
- completedWork.issues = remainingIssues;
127
- fs.writeFileSync(this.completedFile, JSON.stringify(completedWork, null, 2));
128
-
129
- console.log(` āœ… Archived ${archived} completed issues older than ${daysOld} days`);
130
- return archived;
131
- }
132
-
133
- async archiveCompletedEpics(daysOld) {
134
- console.log('šŸ“š Archiving completed epics...');
135
-
136
- const cutoffDate = new Date();
137
- cutoffDate.setDate(cutoffDate.getDate() - daysOld);
138
-
139
- let archived = 0;
140
-
141
- // Check epics directory
142
- if (fs.existsSync(this.epicsDir)) {
143
- const epics = fs.readdirSync(this.epicsDir).filter(f => f.endsWith('.md'));
144
-
145
- for (const epicFile of epics) {
146
- const epicPath = path.join(this.epicsDir, epicFile);
147
- const content = fs.readFileSync(epicPath, 'utf8');
148
-
149
- // Check if epic is completed
150
- if (content.includes('status: completed')) {
151
- const stats = fs.statSync(epicPath);
152
- if (stats.mtime < cutoffDate) {
153
- const archivePath = path.join(this.archiveDir, 'epics', epicFile);
154
- fs.renameSync(epicPath, archivePath);
155
- archived++;
156
- }
157
- }
158
- }
159
- }
160
-
161
- console.log(` āœ… Archived ${archived} completed epics older than ${daysOld} days`);
162
- return archived;
163
- }
164
-
165
- async archiveOldPrds(daysOld) {
166
- console.log('šŸ“„ Archiving old PRDs...');
167
-
168
- const cutoffDate = new Date();
169
- cutoffDate.setDate(cutoffDate.getDate() - daysOld);
170
-
171
- let archived = 0;
172
-
173
- // Check PRDs directory
174
- if (fs.existsSync(this.prdsDir)) {
175
- const prds = fs.readdirSync(this.prdsDir).filter(f => f.endsWith('.md'));
176
-
177
- for (const prdFile of prds) {
178
- const prdPath = path.join(this.prdsDir, prdFile);
179
- const content = fs.readFileSync(prdPath, 'utf8');
180
-
181
- // Check if PRD is implemented or deprecated
182
- if (content.includes('status: implemented') || content.includes('status: deprecated')) {
183
- const stats = fs.statSync(prdPath);
184
- if (stats.mtime < cutoffDate) {
185
- const archivePath = path.join(this.archiveDir, 'prds', prdFile);
186
- fs.renameSync(prdPath, archivePath);
187
- archived++;
188
- }
189
- }
190
- }
191
- }
192
-
193
- console.log(` āœ… Archived ${archived} old PRDs older than ${daysOld} days`);
194
- return archived;
195
- }
196
-
197
- async cleanOldLogs(daysOld) {
198
- console.log('šŸ—‘ļø Cleaning old logs...');
199
-
200
- const cutoffDate = new Date();
201
- cutoffDate.setDate(cutoffDate.getDate() - daysOld);
202
-
203
- let cleaned = 0;
204
- const logPatterns = ['*.log', '*.tmp', '.DS_Store', '*.swp'];
205
-
206
- // Clean logs in .claude directory
207
- const findOldFiles = (dir) => {
208
- if (!fs.existsSync(dir)) return;
209
-
210
- const files = fs.readdirSync(dir);
211
- for (const file of files) {
212
- const filePath = path.join(dir, file);
213
- const stats = fs.statSync(filePath);
214
-
215
- if (stats.isDirectory() && !filePath.includes('archive')) {
216
- findOldFiles(filePath);
217
- } else if (stats.isFile()) {
218
- // Check if it's a log file and old
219
- const isLog = logPatterns.some(pattern => {
220
- const regex = new RegExp(pattern.replace('*', '.*'));
221
- return regex.test(file);
222
- });
223
-
224
- if (isLog && stats.mtime < cutoffDate) {
225
- // Archive or delete
226
- if (file.endsWith('.log') && stats.size > 1024 * 1024) {
227
- // Archive large log files
228
- const archivePath = path.join(this.archiveDir, 'logs', file);
229
- fs.renameSync(filePath, archivePath);
230
- } else {
231
- // Delete small/temporary files
232
- fs.unlinkSync(filePath);
233
- }
234
- cleaned++;
235
- }
236
- }
237
- }
238
- };
239
-
240
- findOldFiles(this.claudeDir);
241
- console.log(` āœ… Cleaned ${cleaned} old log files older than ${daysOld} days`);
242
- return cleaned;
243
- }
244
-
245
- async compactCompletedWork(maxItems) {
246
- console.log('šŸ“¦ Compacting completed work history...');
247
-
248
- const completedWork = this.loadCompletedWork();
249
- let compacted = 0;
250
-
251
- // Compact issues
252
- if (completedWork.issues.length > maxItems) {
253
- const toArchive = completedWork.issues.slice(maxItems);
254
- completedWork.issues = completedWork.issues.slice(0, maxItems);
255
-
256
- // Archive excess to JSON
257
- toArchive.forEach(issue => {
258
- this.archiveToJson('issues', issue);
259
- compacted++;
260
- });
261
- }
262
-
263
- // Compact epics
264
- if (completedWork.epics && completedWork.epics.length > maxItems) {
265
- const toArchive = completedWork.epics.slice(maxItems);
266
- completedWork.epics = completedWork.epics.slice(0, maxItems);
267
-
268
- // Archive excess to JSON
269
- toArchive.forEach(epic => {
270
- this.archiveToJson('epics', epic);
271
- compacted++;
272
- });
273
- }
274
-
275
- // Save compacted work
276
- fs.writeFileSync(this.completedFile, JSON.stringify(completedWork, null, 2));
277
-
278
- console.log(` āœ… Compacted ${compacted} old entries`);
279
- return compacted;
280
- }
281
-
282
- archiveToJson(type, data) {
283
- const archiveFile = path.join(this.archiveDir, `${type}-archive.json`);
284
- let archive = [];
285
-
286
- if (fs.existsSync(archiveFile)) {
287
- try {
288
- archive = JSON.parse(fs.readFileSync(archiveFile, 'utf8'));
289
- } catch {
290
- archive = [];
291
- }
292
- }
293
-
294
- // Add with timestamp
295
- archive.push({
296
- ...data,
297
- archivedAt: new Date().toISOString()
298
- });
299
-
300
- // Keep only last 1000 entries
301
- if (archive.length > 1000) {
302
- archive = archive.slice(-1000);
303
- }
304
-
305
- fs.writeFileSync(archiveFile, JSON.stringify(archive, null, 2));
306
- }
307
-
308
- async removeEmptyDirectories() {
309
- console.log('šŸ—‚ļø Removing empty directories...');
310
-
311
- const removeEmpty = (dir) => {
312
- if (!fs.existsSync(dir)) return false;
313
-
314
- const files = fs.readdirSync(dir);
315
-
316
- if (files.length === 0) {
317
- fs.rmdirSync(dir);
318
- return true;
319
- }
320
-
321
- let hasFiles = false;
322
- for (const file of files) {
323
- const filePath = path.join(dir, file);
324
- const stats = fs.statSync(filePath);
325
-
326
- if (stats.isDirectory()) {
327
- if (!removeEmpty(filePath)) {
328
- hasFiles = true;
329
- }
330
- } else {
331
- hasFiles = true;
332
- }
333
- }
334
-
335
- if (!hasFiles && !dir.includes('archive')) {
336
- fs.rmdirSync(dir);
337
- return true;
338
- }
339
-
340
- return false;
341
- };
342
-
343
- const removed = removeEmpty(this.claudeDir);
344
- console.log(` āœ… Cleaned directory structure`);
345
- return removed;
346
- }
347
-
348
- calculateFreedSpace(stats) {
349
- // Rough estimation in KB
350
- const issueSize = 5; // Average 5KB per issue
351
- const epicSize = 10; // Average 10KB per epic
352
- const prdSize = 8; // Average 8KB per PRD
353
- const logSize = 100; // Average 100KB per log
354
-
355
- const freed = (stats.archivedIssues * issueSize) +
356
- (stats.archivedEpics * epicSize) +
357
- (stats.archivedPrds * prdSize) +
358
- (stats.cleanedLogs * logSize);
359
-
360
- return freed;
361
- }
362
-
363
- displaySummary(stats) {
364
- console.log(`\n${'═'.repeat(50)}`);
365
- console.log('šŸ“Š Cleanup Summary:');
366
- console.log(` • Archived Issues: ${stats.archivedIssues}`);
367
- console.log(` • Archived Epics: ${stats.archivedEpics}`);
368
- console.log(` • Archived PRDs: ${stats.archivedPrds}`);
369
- console.log(` • Cleaned Logs: ${stats.cleanedLogs}`);
370
- console.log(` • Freed Space: ~${Math.round(stats.freedSpace / 1024)}MB`);
371
-
372
- console.log('\nāœ… Project cleaned successfully!');
373
-
374
- // Show archive location
375
- console.log('\nšŸ“ Archives stored in:');
376
- console.log(` ${this.archiveDir}/`);
377
-
378
- // Show next steps
379
- console.log('\nšŸ’” Tips:');
380
- console.log(' • View archives: ls -la .claude/archive/');
381
- console.log(' • Restore item: mv .claude/archive/TYPE/FILE .claude/TYPE/');
382
- console.log(' • Schedule cleanup: Add to cron or CI/CD');
383
- }
384
-
385
- async run(args) {
386
- const options = {};
387
-
388
- // Parse arguments
389
- args.forEach(arg => {
390
- if (arg === '--dry-run') {
391
- options.dryRun = true;
392
- } else if (arg.startsWith('--days=')) {
393
- options.daysOld = parseInt(arg.split('=')[1]);
394
- } else if (arg === '--skip-issues') {
395
- options.skipIssues = true;
396
- } else if (arg === '--skip-epics') {
397
- options.skipEpics = true;
398
- } else if (arg === '--skip-prds') {
399
- options.skipPrds = true;
400
- } else if (arg === '--skip-logs') {
401
- options.skipLogs = true;
402
- } else if (arg === '--skip-compact') {
403
- options.skipCompact = true;
404
- } else if (arg === '--force') {
405
- options.force = true;
406
- } else if (arg === '--help') {
407
- console.log('Usage: pm clean [options]');
408
- console.log('\nOptions:');
409
- console.log(' --days=N Archive items older than N days (default: 30/60/90)');
410
- console.log(' --skip-issues Skip archiving issues');
411
- console.log(' --skip-epics Skip archiving epics');
412
- console.log(' --skip-prds Skip archiving PRDs');
413
- console.log(' --skip-logs Skip cleaning logs');
414
- console.log(' --skip-compact Skip compacting completed work');
415
- console.log(' --dry-run Show what would be done without doing it');
416
- console.log(' --force Clean without confirmation');
417
- console.log('\nExamples:');
418
- console.log(' pm clean # Clean with defaults');
419
- console.log(' pm clean --days=7 # Archive items older than 7 days');
420
- console.log(' pm clean --skip-logs # Skip log cleanup');
421
- console.log(' pm clean --dry-run # Preview cleanup');
422
- process.exit(0);
423
- }
424
- });
425
-
426
- // Confirmation prompt unless forced
427
- if (!options.force && !options.dryRun) {
428
- const readline = require('readline');
429
- const rl = readline.createInterface({
430
- input: process.stdin,
431
- output: process.stdout
432
- });
433
-
434
- const confirm = await new Promise(resolve => {
435
- rl.question('āš ļø This will archive old items. Continue? (y/N): ', answer => {
436
- rl.close();
437
- resolve(answer.toLowerCase() === 'y');
438
- });
439
- });
440
-
441
- if (!confirm) {
442
- console.log('Cleanup cancelled.');
443
- process.exit(0);
444
- }
445
- }
446
-
447
- if (options.dryRun) {
448
- console.log('šŸ” DRY RUN MODE - No changes will be made\n');
449
- }
450
-
451
- await this.cleanProject(options);
452
- }
453
- }
454
-
455
- // Main execution
456
- if (require.main === module) {
457
- const cleaner = new ProjectCleaner();
458
- cleaner.run(process.argv.slice(2)).catch(error => {
459
- console.error('āŒ Error:', error.message);
460
- process.exit(1);
461
- });
462
- }
463
-
464
- module.exports = ProjectCleaner;
@@ -1,216 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Context Create - Create new context file from template
4
- * PM command for context management
5
- */
6
-
7
- const fs = require('fs').promises;
8
- const path = require('path');
9
-
10
- class ContextCreator {
11
- constructor() {
12
- this.contextsDir = path.join('.claude', 'contexts');
13
- this.templatesDir = path.join(__dirname, '..', '..', 'templates', 'context-templates');
14
- }
15
-
16
- showUsage() {
17
- console.log('Usage: pm context-create <name> [options]');
18
- console.log('\nOptions:');
19
- console.log(' --template <name> Template to use (default: default)');
20
- console.log(' --type <type> Type of context (default: general)');
21
- console.log(' --description <desc> Description for the context');
22
- console.log('\nExamples:');
23
- console.log(' pm context-create feature-auth --type feature');
24
- console.log(' pm context-create bug-fix --template bug --description "Fixing login issues"');
25
- console.log(' pm context-create project-overview');
26
- }
27
-
28
- validateContextName(name) {
29
- return /^[a-zA-Z0-9_-]+$/.test(name);
30
- }
31
-
32
- getDefaultTemplate() {
33
- return `# Context: {{name}}
34
-
35
- ## Type: {{type}}
36
-
37
- ## Description
38
- {{description}}
39
-
40
- ## Created
41
- {{date}}
42
-
43
- ## Overview
44
- [Provide a high-level overview of this context]
45
-
46
- ## Key Components
47
- - Component 1
48
- - Component 2
49
- - Component 3
50
-
51
- ## Technical Details
52
- [Add specific technical details relevant to this context]
53
-
54
- ## Related Files
55
- - file1.js
56
- - file2.py
57
- - file3.md
58
-
59
- ## Current State
60
- [Describe the current state of the work]
61
-
62
- ## Next Steps
63
- 1. Step 1
64
- 2. Step 2
65
- 3. Step 3
66
-
67
- ## Notes
68
- [Any additional notes or considerations]
69
- `;
70
- }
71
-
72
- processTemplate(template, variables) {
73
- let content = template;
74
- for (const [key, value] of Object.entries(variables)) {
75
- const regex = new RegExp(`{{${key}}}`, 'g');
76
- content = content.replace(regex, value);
77
- }
78
- return content;
79
- }
80
-
81
- async loadTemplate(templateName) {
82
- try {
83
- const templatePath = path.join(this.templatesDir, `${templateName}.md`);
84
- return await fs.readFile(templatePath, 'utf8');
85
- } catch {
86
- // Return null if template not found
87
- return null;
88
- }
89
- }
90
-
91
- async createContext(name, options = {}) {
92
- console.log(`šŸ“ Creating Context: ${name}`);
93
- console.log(`${'═'.repeat(50)}\n`);
94
-
95
- // Validate name
96
- if (!this.validateContextName(name)) {
97
- console.error('āŒ Error: Invalid context name. Use only alphanumeric characters, hyphens, and underscores.');
98
- process.exit(1);
99
- }
100
-
101
- // Display configuration
102
- console.log('šŸ“‹ Configuration:');
103
- console.log(` • Name: ${name}`);
104
- console.log(` • Template: ${options.template || 'default'}`);
105
- console.log(` • Type: ${options.type || 'general'}`);
106
- if (options.description) {
107
- console.log(` • Description: ${options.description}`);
108
- }
109
- console.log();
110
-
111
- // Ensure contexts directory exists
112
- await fs.mkdir(this.contextsDir, { recursive: true });
113
-
114
- const contextPath = path.join(this.contextsDir, `${name}.md`);
115
-
116
- // Check if context already exists
117
- try {
118
- await fs.access(contextPath);
119
- console.error(`āŒ Error: Context "${name}" already exists at ${contextPath}`);
120
- process.exit(1);
121
- } catch {
122
- // File doesn't exist, which is what we want
123
- }
124
-
125
- // Load template
126
- let template = null;
127
- if (options.template && options.template !== 'default') {
128
- template = await this.loadTemplate(options.template);
129
- if (!template) {
130
- console.warn(`āš ļø Template "${options.template}" not found, using default template`);
131
- }
132
- }
133
-
134
- if (!template) {
135
- template = this.getDefaultTemplate();
136
- }
137
-
138
- // Prepare variables
139
- const variables = {
140
- name: name,
141
- date: new Date().toISOString(),
142
- type: options.type || 'general',
143
- description: options.description || 'Context description'
144
- };
145
-
146
- // Process template
147
- const content = this.processTemplate(template, variables);
148
-
149
- // Write file
150
- try {
151
- await fs.writeFile(contextPath, content, { mode: 0o644 });
152
- console.log(`āœ… Context created successfully at: ${contextPath}`);
153
-
154
- // Show success and next steps
155
- console.log('\nšŸ’” Next Steps:');
156
- console.log(` • Update context: pm context-update ${name} --file <file>`);
157
- console.log(` • Prime context: pm context-prime ${name}`);
158
- console.log(' • List contexts: pm context-prime --list');
159
- console.log(` • View context: cat ${contextPath}`);
160
-
161
- } catch (error) {
162
- if (error.code === 'EACCES') {
163
- console.error('āŒ Error: Permission denied. Failed to create context file.');
164
- } else {
165
- console.error(`āŒ Error: Failed to create context: ${error.message}`);
166
- }
167
- process.exit(1);
168
- }
169
- }
170
-
171
- async run(args) {
172
- const name = args[0];
173
-
174
- if (!name || name === '--help' || name === '-h') {
175
- this.showUsage();
176
-
177
- if (name === '--help' || name === '-h') {
178
- process.exit(0);
179
- }
180
-
181
- console.error('\nāŒ Error: Context name is required');
182
- process.exit(1);
183
- }
184
-
185
- // Parse options
186
- const options = {};
187
- for (let i = 1; i < args.length; i++) {
188
- const arg = args[i];
189
-
190
- if (arg === '--template' && args[i + 1]) {
191
- options.template = args[++i];
192
- } else if (arg === '--type' && args[i + 1]) {
193
- options.type = args[++i];
194
- } else if (arg === '--description' && args[i + 1]) {
195
- options.description = args[++i];
196
- } else if (arg.startsWith('--')) {
197
- console.error(`āŒ Unknown option: ${arg}`);
198
- this.showUsage();
199
- process.exit(1);
200
- }
201
- }
202
-
203
- await this.createContext(name, options);
204
- }
205
- }
206
-
207
- // Main execution
208
- if (require.main === module) {
209
- const creator = new ContextCreator();
210
- creator.run(process.argv.slice(2)).catch(error => {
211
- console.error('āŒ Error:', error.message);
212
- process.exit(1);
213
- });
214
- }
215
-
216
- module.exports = ContextCreator;