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,335 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Context Prime - Prime context for current work
4
- * PM command for context management
5
- */
6
-
7
- const fs = require('fs').promises;
8
- const path = require('path');
9
-
10
- class ContextPrimer {
11
- constructor() {
12
- this.contextsDir = path.join('.claude', 'contexts');
13
- this.sessionFile = path.join('.claude', 'contexts', '.current-session.json');
14
- }
15
-
16
- showUsage() {
17
- console.log('Usage: pm context-prime [name] [options]');
18
- console.log('\nOptions:');
19
- console.log(' --list, -l List available contexts');
20
- console.log(' --chunked Use chunked loading for large contexts');
21
- console.log(' --verbose Show detailed output');
22
- console.log(' --dry-run Preview without actually priming');
23
- console.log('\nExamples:');
24
- console.log(' pm context-prime feature-auth');
25
- console.log(' pm context-prime --list');
26
- console.log(' pm context-prime project-overview --verbose');
27
- console.log(' pm context-prime large-context --chunked');
28
- console.log(' pm context-prime test-context --dry-run');
29
- }
30
-
31
- formatSize(bytes) {
32
- if (bytes < 1024) return `${bytes} bytes`;
33
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
34
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
35
- }
36
-
37
- async getCurrentSession() {
38
- try {
39
- const sessionData = await fs.readFile(this.sessionFile, 'utf8');
40
- const session = JSON.parse(sessionData);
41
- if (session && session.context) {
42
- return session;
43
- }
44
- } catch {
45
- // No current session or file doesn't exist
46
- }
47
- return null;
48
- }
49
-
50
- async saveSession(contextName, contextSize) {
51
- const session = {
52
- context: contextName,
53
- timestamp: new Date().toISOString(),
54
- size: contextSize
55
- };
56
-
57
- // Ensure directory exists
58
- await fs.mkdir(path.dirname(this.sessionFile), { recursive: true });
59
- await fs.writeFile(this.sessionFile, JSON.stringify(session, null, 2));
60
- return session;
61
- }
62
-
63
- async showContextDetails(name) {
64
- try {
65
- const contextPath = path.join(this.contextsDir, `${name}.md`);
66
- const content = await fs.readFile(contextPath, 'utf8');
67
- const size = Buffer.byteLength(content, 'utf8');
68
-
69
- console.log('\nšŸ“Š Context Details:');
70
- console.log(` • Name: ${name}`);
71
- console.log(` • Size: ${this.formatSize(size)}`);
72
-
73
- // Extract sections from content
74
- const sections = content.split('\n## ').length - 1;
75
- if (sections > 0) {
76
- console.log(` • Sections: ${sections}`);
77
- }
78
-
79
- // Check for specific markers
80
- if (content.includes('# Context:')) {
81
- console.log(' • Structure: āœ… Standard format');
82
- } else {
83
- console.log(' • Structure: āš ļø Non-standard format');
84
- }
85
-
86
- // Estimate tokens (rough approximation)
87
- const estimatedTokens = Math.ceil(size / 4);
88
- console.log(` • Estimated tokens: ~${estimatedTokens.toLocaleString()}`);
89
-
90
- return { size, content };
91
- } catch (error) {
92
- console.error(`āŒ Error reading context: ${error.message}`);
93
- return null;
94
- }
95
- }
96
-
97
- async listAvailableContexts() {
98
- try {
99
- const files = await fs.readdir(this.contextsDir);
100
- return files
101
- .filter(file => file.endsWith('.md') && !file.includes('backup'))
102
- .map(file => file.replace('.md', ''));
103
- } catch {
104
- return [];
105
- }
106
- }
107
-
108
- async listContextsWithDetails() {
109
- const contexts = await this.listAvailableContexts();
110
-
111
- if (contexts.length === 0) {
112
- console.log('\nšŸ“­ No contexts found.');
113
- console.log('\nšŸ’” Create one with: pm context-create <name>');
114
- return;
115
- }
116
-
117
- console.log('\nšŸ“š Available Contexts:');
118
- console.log(`${'═'.repeat(50)}`);
119
-
120
- // Get current session if any
121
- const currentSession = await this.getCurrentSession();
122
- const currentContext = currentSession ? currentSession.context : null;
123
-
124
- for (const contextName of contexts) {
125
- try {
126
- const contextPath = path.join(this.contextsDir, `${contextName}.md`);
127
- const content = await fs.readFile(contextPath, 'utf8');
128
- const size = Buffer.byteLength(content, 'utf8');
129
- const isCurrent = contextName === currentContext;
130
-
131
- console.log(`\n ${isCurrent ? 'ā–¶ ' : '• '}${contextName}${isCurrent ? ' (current)' : ''}`);
132
- console.log(` Size: ${this.formatSize(size)}`);
133
-
134
- // Show first line of description if available
135
- const lines = content.split('\n');
136
- const descLine = lines.find(line => line.trim() && !line.startsWith('#'));
137
- if (descLine) {
138
- const preview = descLine.substring(0, 50);
139
- console.log(` Preview: ${preview}${descLine.length > 50 ? '...' : ''}`);
140
- }
141
- } catch {
142
- console.log(`\n • ${contextName}`);
143
- console.log(' Status: āš ļø Unable to read');
144
- }
145
- }
146
-
147
- console.log(`\n${'═'.repeat(50)}`);
148
- console.log(`Total: ${contexts.length} context${contexts.length !== 1 ? 's' : ''}`);
149
-
150
- if (currentContext) {
151
- console.log(`\nCurrently primed: ${currentContext}`);
152
- }
153
- }
154
-
155
- async primeContext(name, options = {}) {
156
- // Handle list option specially
157
- if (options.list && !name) {
158
- await this.listContextsWithDetails();
159
- return;
160
- }
161
-
162
- if (!name) {
163
- console.error('āŒ Error: Context name is required');
164
- this.showUsage();
165
- await this.listContextsWithDetails();
166
- process.exit(1);
167
- }
168
-
169
- console.log(`šŸŽÆ Priming Context: ${name}`);
170
- console.log(`${'═'.repeat(50)}\n`);
171
-
172
- // Show current session if exists
173
- const currentSession = await this.getCurrentSession();
174
- if (currentSession && currentSession.context !== name) {
175
- console.log(`šŸ“Œ Current context: ${currentSession.context}`);
176
- console.log(` Switching to: ${name}\n`);
177
- }
178
-
179
- // Check if context exists
180
- const contextPath = path.join(this.contextsDir, `${name}.md`);
181
- let contextExists = false;
182
- try {
183
- await fs.access(contextPath);
184
- contextExists = true;
185
- } catch {
186
- contextExists = false;
187
- }
188
-
189
- if (!contextExists) {
190
- console.error(`āŒ Error: Context "${name}" not found`);
191
- const contexts = await this.listAvailableContexts();
192
- if (contexts.length > 0) {
193
- console.log('\nAvailable contexts:');
194
- contexts.forEach(ctx => {
195
- console.log(` • ${ctx}`);
196
- });
197
- }
198
- process.exit(1);
199
- }
200
-
201
- // Display context details
202
- const details = await this.showContextDetails(name);
203
- if (!details) {
204
- console.error(`āŒ Error: Unable to read context "${name}"`);
205
- process.exit(1);
206
- }
207
-
208
- // Check if large and suggest chunked loading
209
- if (details.size > 100 * 1024 && !options.chunked) {
210
- console.log('\nšŸ’” Tip: This is a large context. Consider using --chunked for better loading.');
211
- }
212
-
213
- console.log();
214
-
215
- try {
216
- // Load context content
217
- const contextPath = path.join(this.contextsDir, `${name}.md`);
218
- const content = await fs.readFile(contextPath, 'utf8');
219
-
220
- if (!options.dryRun) {
221
- // Save session
222
- await this.saveSession(name, details.size);
223
-
224
- // Update history (append to history file)
225
- const historyFile = path.join(this.contextsDir, '.history.json');
226
- let history = [];
227
- try {
228
- const historyData = await fs.readFile(historyFile, 'utf8');
229
- history = JSON.parse(historyData);
230
- } catch {
231
- // History file doesn't exist yet
232
- }
233
-
234
- history.unshift({
235
- context: name,
236
- timestamp: new Date().toISOString(),
237
- size: details.size
238
- });
239
-
240
- // Keep only last 50 entries
241
- if (history.length > 50) {
242
- history = history.slice(0, 50);
243
- }
244
-
245
- await fs.writeFile(historyFile, JSON.stringify(history, null, 2));
246
-
247
- console.log(`āœ… Context loaded successfully: ${name}`);
248
- console.log(`Size: ${this.formatSize(details.size)}`);
249
-
250
- if (options.verbose) {
251
- console.log(`Session created at: ${new Date().toISOString()}`);
252
- }
253
- } else {
254
- console.log(`Dry run: Would load context "${name}"`);
255
- console.log(`Size: ${this.formatSize(details.size)}`);
256
- }
257
-
258
- // Validate structure and warn if needed
259
- if (!content.includes('# Context:')) {
260
- console.warn('āš ļø Warning: Context may not have standard structure');
261
- }
262
-
263
- // Show success banner
264
- if (!options.dryRun) {
265
- console.log(`\n${'═'.repeat(50)}`);
266
- console.log('✨ Context successfully primed!');
267
- console.log(`${'═'.repeat(50)}`);
268
-
269
- console.log('\nšŸ“ The AI now has access to:');
270
- const contentPreview = details.content.split('\n').slice(0, 5);
271
- contentPreview.forEach(line => {
272
- if (line.trim()) {
273
- console.log(` ${line.substring(0, 60)}${line.length > 60 ? '...' : ''}`);
274
- }
275
- });
276
-
277
- console.log('\nšŸ’” Next Steps:');
278
- console.log(' • Start working with the primed context');
279
- console.log(` • Update context: pm context-update ${name} --file <file>`);
280
- console.log(' • Switch context: pm context-prime <other-context>');
281
- console.log(' • List all: pm context-prime --list');
282
- }
283
-
284
- } catch (error) {
285
- // Error is already handled by the library
286
- process.exit(1);
287
- }
288
- }
289
-
290
- async run(args) {
291
- // Check for help flag
292
- if (args.includes('--help') || args.includes('-h')) {
293
- this.showUsage();
294
- await this.listContextsWithDetails();
295
- process.exit(0);
296
- }
297
-
298
- // Parse options
299
- const options = {};
300
- let name = null;
301
-
302
- for (let i = 0; i < args.length; i++) {
303
- const arg = args[i];
304
-
305
- if (arg === '--list' || arg === '-l') {
306
- options.list = true;
307
- } else if (arg === '--chunked') {
308
- options.chunked = true;
309
- } else if (arg === '--verbose' || arg === '-v') {
310
- options.verbose = true;
311
- } else if (arg === '--dry-run') {
312
- options.dryRun = true;
313
- } else if (!arg.startsWith('-') && !name) {
314
- name = arg;
315
- } else if (arg.startsWith('--')) {
316
- console.error(`āŒ Unknown option: ${arg}`);
317
- this.showUsage();
318
- process.exit(1);
319
- }
320
- }
321
-
322
- await this.primeContext(name, options);
323
- }
324
- }
325
-
326
- // Main execution
327
- if (require.main === module) {
328
- const primer = new ContextPrimer();
329
- primer.run(process.argv.slice(2)).catch(error => {
330
- console.error('āŒ Error:', error.message);
331
- process.exit(1);
332
- });
333
- }
334
-
335
- module.exports = ContextPrimer;
@@ -1,344 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Context Update - Update existing context file
4
- * PM command for context management
5
- */
6
-
7
- const fs = require('fs').promises;
8
- const path = require('path');
9
- const readline = require('readline');
10
-
11
- class ContextUpdater {
12
- constructor() {
13
- this.contextsDir = path.join('.claude', 'contexts');
14
- }
15
-
16
- showUsage() {
17
- console.log('Usage: pm context-update <name> [options]');
18
- console.log('\nContent Sources (one required):');
19
- console.log(' --file <path> Read content from file');
20
- console.log(' --stdin Read content from stdin');
21
- console.log(' --content <text> Provide content inline');
22
- console.log('\nUpdate Modes:');
23
- console.log(' --replace Replace entire content (default: append)');
24
- console.log(' --merge Merge by sections (smart merge)');
25
- console.log('\nOther Options:');
26
- console.log(' --verbose Show detailed output');
27
- console.log('\nExamples:');
28
- console.log(' pm context-update feature-auth --file notes.md');
29
- console.log(' pm context-update bug-fix --stdin < error-log.txt');
30
- console.log(' pm context-update project --content "New requirement added"');
31
- console.log(' pm context-update api-docs --file new-api.md --replace');
32
- console.log(' pm context-update specs --file update.md --merge');
33
- }
34
-
35
- async listAvailableContexts() {
36
- try {
37
- const files = await fs.readdir(this.contextsDir);
38
- const contexts = files
39
- .filter(file => file.endsWith('.md'))
40
- .map(file => file.replace('.md', ''));
41
-
42
- if (contexts.length > 0) {
43
- console.log('\nAvailable contexts:');
44
- contexts.forEach(ctx => {
45
- console.log(` • ${ctx}`);
46
- });
47
- }
48
- return contexts;
49
- } catch {
50
- // Directory doesn't exist or other error
51
- return [];
52
- }
53
- }
54
-
55
- formatFileSize(bytes) {
56
- if (bytes < 1024) return `${bytes} bytes`;
57
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
58
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
59
- }
60
-
61
- async readFromStdin() {
62
- return new Promise((resolve) => {
63
- let content = '';
64
- const rl = readline.createInterface({
65
- input: process.stdin,
66
- output: process.stdout,
67
- terminal: false
68
- });
69
-
70
- rl.on('line', (line) => {
71
- content += line + '\n';
72
- });
73
-
74
- rl.on('close', () => {
75
- resolve(content.trim());
76
- });
77
- });
78
- }
79
-
80
- appendContent(existing, newContent) {
81
- return `${existing}\n\n${newContent}`;
82
- }
83
-
84
- replaceContent(existing, newContent) {
85
- // Replace entirely with new content (existing is intentionally unused)
86
- return newContent;
87
- }
88
-
89
- mergeContent(existing, newContent) {
90
- // Simple merge by sections
91
- const parseSections = (content) => {
92
- const sections = {};
93
- const lines = content.split('\n');
94
- let currentSection = '_header';
95
- let sectionContent = [];
96
-
97
- for (const line of lines) {
98
- if (line.startsWith('## ')) {
99
- if (sectionContent.length > 0) {
100
- sections[currentSection] = sectionContent.join('\n').trim();
101
- }
102
- currentSection = line;
103
- sectionContent = [];
104
- } else {
105
- sectionContent.push(line);
106
- }
107
- }
108
-
109
- if (sectionContent.length > 0) {
110
- sections[currentSection] = sectionContent.join('\n').trim();
111
- }
112
-
113
- return sections;
114
- };
115
-
116
- const existingSections = parseSections(existing);
117
- const newSections = parseSections(newContent);
118
-
119
- const merged = { ...existingSections };
120
-
121
- for (const [section, content] of Object.entries(newSections)) {
122
- if (merged[section] && section !== '_header') {
123
- if (content !== merged[section] && merged[section].length > 0) {
124
- console.warn(`āš ļø Merge conflict detected in section: ${section}`);
125
- }
126
- }
127
- merged[section] = content;
128
- }
129
-
130
- // Reconstruct content
131
- let result = [];
132
-
133
- if (merged._header) {
134
- result.push(merged._header);
135
- delete merged._header;
136
- }
137
-
138
- for (const [section, content] of Object.entries(merged)) {
139
- if (section.startsWith('## ')) {
140
- result.push('');
141
- result.push(section);
142
- result.push(content);
143
- }
144
- }
145
-
146
- return result.join('\n');
147
- }
148
-
149
- async createBackup(contextPath) {
150
- const content = await fs.readFile(contextPath, 'utf8');
151
- const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
152
- const backupPath = contextPath.replace('.md', `-backup-${timestamp}.md`);
153
- await fs.writeFile(backupPath, content);
154
- return backupPath;
155
- }
156
-
157
- async updateContext(name, options = {}) {
158
- console.log(`šŸ”„ Updating Context: ${name}`);
159
- console.log(`${'═'.repeat(50)}\n`);
160
-
161
- const contextPath = path.join(this.contextsDir, `${name}.md`);
162
-
163
- // Check if context exists
164
- let contextExists = false;
165
- try {
166
- await fs.access(contextPath);
167
- contextExists = true;
168
- } catch {
169
- contextExists = false;
170
- }
171
-
172
- if (!contextExists) {
173
- console.error(`āŒ Error: Context "${name}" not found at ${contextPath}`);
174
- await this.listAvailableContexts();
175
- process.exit(1);
176
- }
177
-
178
- // Display update configuration
179
- console.log('šŸ“‹ Update Configuration:');
180
- console.log(` • Context: ${name}`);
181
-
182
- let sourceDesc = 'Unknown';
183
- if (options.file) {
184
- sourceDesc = `File (${path.basename(options.file)})`;
185
- } else if (options.stdin) {
186
- sourceDesc = 'Standard Input';
187
- } else if (options.content) {
188
- sourceDesc = `Inline (${options.content.substring(0, 30)}...)`;
189
- }
190
- console.log(` • Source: ${sourceDesc}`);
191
-
192
- let modeDesc = 'Append';
193
- if (options.replace) modeDesc = 'Replace';
194
- else if (options.merge) modeDesc = 'Smart Merge';
195
- console.log(` • Mode: ${modeDesc}`);
196
- console.log();
197
-
198
- // Get size information if from file
199
- if (options.file) {
200
- try {
201
- const stats = await fs.stat(path.resolve(options.file));
202
- console.log(`šŸ“ Input file size: ${this.formatFileSize(stats.size)}`);
203
- } catch {
204
- // Ignore stat errors
205
- }
206
- }
207
-
208
- try {
209
- // Read existing content
210
- const existingContent = await fs.readFile(contextPath, 'utf8');
211
-
212
- // Get new content from appropriate source
213
- let newContent = '';
214
-
215
- if (options.stdin) {
216
- console.log('šŸ“„ Reading from stdin (press Ctrl+D when done)...');
217
- newContent = await this.readFromStdin();
218
- } else if (options.file) {
219
- const filePath = path.resolve(options.file);
220
- newContent = await fs.readFile(filePath, 'utf8');
221
- } else if (options.content) {
222
- newContent = options.content;
223
- }
224
-
225
- if (!newContent) {
226
- console.error('āŒ Error: No content provided');
227
- process.exit(1);
228
- }
229
-
230
- // Create backup
231
- const backupPath = await this.createBackup(contextPath);
232
- console.log(`šŸ’¾ Backup created: ${path.basename(backupPath)}`);
233
-
234
- // Apply update based on mode
235
- let updatedContent;
236
- let updateMode = 'append';
237
-
238
- if (options.replace) {
239
- updatedContent = this.replaceContent(existingContent, newContent);
240
- updateMode = 'replace';
241
- } else if (options.merge) {
242
- updatedContent = this.mergeContent(existingContent, newContent);
243
- updateMode = 'merge';
244
- } else {
245
- updatedContent = this.appendContent(existingContent, newContent);
246
- updateMode = 'append';
247
- }
248
-
249
- // Write updated content
250
- await fs.writeFile(contextPath, updatedContent);
251
-
252
- // Show success
253
- console.log(`\nāœ… Context updated successfully: ${name}`);
254
- console.log(` • Mode: ${updateMode}`);
255
- console.log(` • Content added: ${newContent.length} characters`);
256
- console.log(` • Total size: ${updatedContent.length} characters`);
257
-
258
- if (options.verbose) {
259
- console.log(`\nšŸ“Š Details:`);
260
- console.log(` • Original size: ${existingContent.length} characters`);
261
- console.log(` • New content size: ${newContent.length} characters`);
262
- console.log(` • Final size: ${updatedContent.length} characters`);
263
- }
264
-
265
- // Show next steps
266
- console.log('\nšŸ’” Next Steps:');
267
- console.log(` • Prime context: pm context-prime ${name}`);
268
- console.log(` • View context: cat ${path.join(this.contextsDir, name + '.md')}`);
269
- console.log(` • Update again: pm context-update ${name} --file <file>`);
270
- console.log(` • Create new: pm context-create <new-name>`);
271
-
272
- } catch (error) {
273
- // Error is already handled by the library
274
- process.exit(1);
275
- }
276
- }
277
-
278
- async run(args) {
279
- const name = args[0];
280
-
281
- if (!name || name === '--help' || name === '-h') {
282
- this.showUsage();
283
-
284
- if (name === '--help' || name === '-h') {
285
- await this.listAvailableContexts();
286
- process.exit(0);
287
- }
288
-
289
- console.error('\nāŒ Error: Context name is required');
290
- await this.listAvailableContexts();
291
- process.exit(1);
292
- }
293
-
294
- // Parse options
295
- const options = {};
296
- for (let i = 1; i < args.length; i++) {
297
- const arg = args[i];
298
-
299
- if ((arg === '--file' || arg === '-f') && args[i + 1]) {
300
- options.file = args[++i];
301
- } else if (arg === '--stdin') {
302
- options.stdin = true;
303
- } else if ((arg === '--content' || arg === '-c') && args[i + 1]) {
304
- options.content = args[++i];
305
- } else if (arg === '--replace' || arg === '-r') {
306
- options.replace = true;
307
- } else if (arg === '--merge' || arg === '-m') {
308
- options.merge = true;
309
- } else if (arg === '--verbose' || arg === '-v') {
310
- options.verbose = true;
311
- } else if (arg.startsWith('--')) {
312
- console.error(`āŒ Unknown option: ${arg}`);
313
- this.showUsage();
314
- process.exit(1);
315
- }
316
- }
317
-
318
- // Validate options
319
- if (!options.file && !options.stdin && !options.content) {
320
- console.error('āŒ Error: Content source required (--file, --stdin, or --content)');
321
- this.showUsage();
322
- process.exit(1);
323
- }
324
-
325
- if (options.replace && options.merge) {
326
- console.error('āŒ Error: Cannot use both --replace and --merge');
327
- this.showUsage();
328
- process.exit(1);
329
- }
330
-
331
- await this.updateContext(name, options);
332
- }
333
- }
334
-
335
- // Main execution
336
- if (require.main === module) {
337
- const updater = new ContextUpdater();
338
- updater.run(process.argv.slice(2)).catch(error => {
339
- console.error('āŒ Error:', error.message);
340
- process.exit(1);
341
- });
342
- }
343
-
344
- module.exports = ContextUpdater;