@codemieai/code 0.0.37 → 0.0.40

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 (77) hide show
  1. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  2. package/dist/agents/core/AgentCLI.js +9 -1
  3. package/dist/agents/core/AgentCLI.js.map +1 -1
  4. package/dist/agents/core/BaseAgentAdapter.d.ts +15 -1
  5. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  6. package/dist/agents/core/BaseAgentAdapter.js +80 -12
  7. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  8. package/dist/agents/core/types.d.ts +34 -0
  9. package/dist/agents/core/types.d.ts.map +1 -1
  10. package/dist/agents/plugins/claude/claude.plugin.d.ts +18 -0
  11. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  12. package/dist/agents/plugins/claude/claude.plugin.js +104 -3
  13. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  14. package/dist/agents/plugins/claude/plugin/.claude-plugin/local-install.json +1 -0
  15. package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
  16. package/dist/agents/plugins/claude/plugin/README.md +96 -0
  17. package/dist/agents/plugins/claude/plugin/commands/README.md +103 -22
  18. package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +329 -18
  19. package/dist/agents/plugins/claude/plugin/hooks/hooks.json +16 -0
  20. package/dist/agents/plugins/claude/plugin/sounds/play-random-sound.ps1 +112 -0
  21. package/dist/agents/plugins/claude/plugin/sounds/play-random-sound.sh +58 -0
  22. package/dist/agents/plugins/claude/sounds-installer.d.ts +19 -0
  23. package/dist/agents/plugins/claude/sounds-installer.d.ts.map +1 -0
  24. package/dist/agents/plugins/claude/sounds-installer.js +164 -0
  25. package/dist/agents/plugins/claude/sounds-installer.js.map +1 -0
  26. package/dist/cli/commands/hook.d.ts +72 -0
  27. package/dist/cli/commands/hook.d.ts.map +1 -1
  28. package/dist/cli/commands/hook.js +290 -110
  29. package/dist/cli/commands/hook.js.map +1 -1
  30. package/dist/cli/commands/install.d.ts.map +1 -1
  31. package/dist/cli/commands/install.js +13 -0
  32. package/dist/cli/commands/install.js.map +1 -1
  33. package/dist/cli/commands/log/cleaner.d.ts +4 -0
  34. package/dist/cli/commands/log/cleaner.d.ts.map +1 -1
  35. package/dist/cli/commands/log/cleaner.js +4 -0
  36. package/dist/cli/commands/log/cleaner.js.map +1 -1
  37. package/dist/cli/commands/log/formatter.d.ts +1 -0
  38. package/dist/cli/commands/log/formatter.d.ts.map +1 -1
  39. package/dist/cli/commands/log/formatter.js +4 -13
  40. package/dist/cli/commands/log/formatter.js.map +1 -1
  41. package/dist/cli/commands/log/index.js +2 -0
  42. package/dist/cli/commands/log/index.js.map +1 -1
  43. package/dist/cli/commands/log/reader.d.ts +5 -0
  44. package/dist/cli/commands/log/reader.d.ts.map +1 -1
  45. package/dist/cli/commands/log/reader.js +47 -10
  46. package/dist/cli/commands/log/reader.js.map +1 -1
  47. package/dist/cli/commands/profile/display.d.ts +1 -0
  48. package/dist/cli/commands/profile/display.d.ts.map +1 -1
  49. package/dist/cli/commands/profile/display.js +10 -2
  50. package/dist/cli/commands/profile/display.js.map +1 -1
  51. package/dist/cli/commands/profile/index.js +58 -22
  52. package/dist/cli/commands/profile/index.js.map +1 -1
  53. package/dist/cli/commands/setup.js +296 -24
  54. package/dist/cli/commands/setup.js.map +1 -1
  55. package/dist/env/types.d.ts +12 -1
  56. package/dist/env/types.d.ts.map +1 -1
  57. package/dist/env/types.js.map +1 -1
  58. package/dist/hooks/types.d.ts +2 -0
  59. package/dist/hooks/types.d.ts.map +1 -1
  60. package/dist/index.d.ts +5 -0
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +10 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/providers/plugins/bedrock/bedrock.template.d.ts.map +1 -1
  65. package/dist/providers/plugins/bedrock/bedrock.template.js +12 -0
  66. package/dist/providers/plugins/bedrock/bedrock.template.js.map +1 -1
  67. package/dist/utils/config.d.ts +35 -8
  68. package/dist/utils/config.d.ts.map +1 -1
  69. package/dist/utils/config.js +249 -33
  70. package/dist/utils/config.js.map +1 -1
  71. package/dist/utils/logger.d.ts +8 -0
  72. package/dist/utils/logger.d.ts.map +1 -1
  73. package/dist/utils/logger.js +42 -0
  74. package/dist/utils/logger.js.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/agents/plugins/claude/plugin/commands/memory-add.md +0 -325
  77. package/dist/agents/plugins/claude/plugin/commands/memory-init.md +0 -18
@@ -1,6 +1,6 @@
1
1
  # Refresh and Audit Project Documentation
2
2
 
3
- **Purpose**: Verify and update project documentation to reflect current implementation.
3
+ **Purpose**: Intelligently detect code changes and update documentation to reflect current implementation.
4
4
 
5
5
  **CRITICAL**: Not every code change requires documentation updates. Only update documentation when:
6
6
  - Implementation patterns have actually changed
@@ -10,34 +10,174 @@
10
10
 
11
11
  If documentation accurately reflects the current codebase, no changes are needed.
12
12
 
13
-
13
+ ---
14
14
 
15
15
  ## Additional user's input
16
16
  Additional context/input from user: $ARGUMENTS. Might be empty by default.
17
17
 
18
+ ---
19
+
20
+ ## Workflow Overview
21
+
22
+ This command supports two modes based on documentation type:
23
+
24
+ **🚀 Smart Mode (Codemie Docs)**:
25
+ - Detects `.codemie/guides/` directory
26
+ - Uses git to identify changed files
27
+ - Maps changes to affected guide categories
28
+ - Updates only impacted guides (selective)
29
+ - Fast and efficient for regular updates
30
+
31
+ **📋 Traditional Mode (All Documentation)**:
32
+ - Works with any documentation structure
33
+ - Comprehensive audit of all docs
34
+ - Reviews all guides vs implementation
35
+ - Updates as needed
36
+ - Thorough for major refactors
37
+
38
+ **Decision Flow**:
39
+ ```
40
+ Step 1: Discover docs
41
+ ├─ Codemie docs found → Step 2A (Smart Mode)
42
+ └─ Other docs found → Step 2B (Traditional Mode)
43
+ ```
44
+
45
+ User can override and request full audit at any point.
46
+
47
+ ---
48
+
18
49
  ## Step 1: Discover What Documentation Exists
19
50
 
20
51
  Identify documentation systems in this project:
21
52
 
22
- **A. Structured Guides** (if present):
23
- Common locations to check:
24
- - `docs/`, `.claude/guides/`, `.codemie/guides/`, `documentation/`
53
+ **A. Codemie-Generated Documentation** (if present):
54
+ - `CLAUDE.md` in project root
55
+ - `.codemie/guides/` directory with structured guides
56
+ - Check if generated by `/codemie-init` (mentions template structure)
57
+
58
+ **B. Structured Guides** (if present):
59
+ - `docs/`, `.claude/guides/`, `documentation/`
25
60
  - Look for topical organization (architecture, development, testing, etc.)
26
61
 
27
- **B. CLAUDE.md Files** (if present):
62
+ **C. CLAUDE.md Files** (if present):
28
63
  - Root `CLAUDE.md` (project overview)
29
64
  - Component-specific `CLAUDE.md` in subdirectories
30
65
  - Common in: `src/`, `lib/`, feature directories
31
66
 
32
- **C. Other Documentation**:
67
+ **D. Other Documentation**:
33
68
  - `README.md`, `CONTRIBUTING.md`, `ARCHITECTURE.md`
34
69
  - Wiki, Confluence, or external docs (mentioned in README)
35
70
 
36
71
  **Note**: Projects may have any combination of these, or none at all.
37
72
 
73
+ **Decision Point**:
74
+ - ✅ Codemie docs found → Use smart change detection (Step 2A)
75
+ - ✅ Other docs found → Use traditional audit (Step 2B)
76
+
77
+ ---
78
+
79
+ ## Step 2A: Smart Change Detection (For Codemie Docs)
80
+
81
+ **Use this workflow when `.codemie/guides/` exists**
82
+
83
+ ### Step 2A.1: Detect Changed Files
84
+
85
+ **Ask user** which timeframe to analyze:
86
+ - Recent uncommitted changes (default)
87
+ - Last N commits (e.g., 5, 10)
88
+ - Changes since specific date
89
+ - All changes (comprehensive audit)
90
+
91
+ **Git Commands**:
92
+ ```bash
93
+ # Option 1: Uncommitted changes
94
+ git status --short
95
+ git diff HEAD --name-only
96
+
97
+ # Option 2: Last N commits
98
+ git diff HEAD~5 HEAD --name-only
99
+
100
+ # Option 3: Since date
101
+ git log --since="2 weeks ago" --name-only --pretty=format: | sort -u
102
+
103
+ # Option 4: All staged/unstaged
104
+ git diff --name-only && git diff --cached --name-only
105
+ ```
106
+
107
+ **Filter relevant changes** (exclude):
108
+ - Test files (unless testing patterns changed)
109
+ - Build artifacts, dependencies
110
+ - Documentation files themselves
111
+ - Config files (unless tools changed)
112
+
113
+ **Output**: List of changed source files
114
+
115
+ **Decision Point**:
116
+ - ✅ Changes detected → Continue to Step 2A.2
117
+ - ❌ No changes → Skip to Step 6 (validation only)
118
+
38
119
  ---
39
120
 
40
- ## Step 2: Review Recent Changes
121
+ ### Step 2A.2: Map Changes to Guide Categories
122
+
123
+ **For each changed file**, determine which guides are affected:
124
+
125
+ | Changed File Pattern | Affected Guide Category | Example Guides |
126
+ |----------------------|-------------------------|----------------|
127
+ | `src/api/`, `routes/`, `controllers/` | API Development | api/api-patterns.md |
128
+ | `src/models/`, `repositories/`, `schemas/` | Data & Database | data/database-patterns.md |
129
+ | `src/services/`, `domain/`, `business/` | Architecture | architecture/architecture.md |
130
+ | `src/components/`, `ui/`, `views/` | Development Practices | development/frontend-patterns.md |
131
+ | `src/utils/errors.`, `exceptions/` | Development Practices | development/error-handling.md |
132
+ | `src/utils/logger.`, `logging/` | Development Practices | development/logging.md |
133
+ | `src/auth/`, `security/`, `middleware/auth` | Security | security/security-patterns.md |
134
+ | `tests/`, `*.test.`, `*.spec.` | Testing | testing/testing-patterns.md |
135
+ | `src/integrations/`, `clients/`, `adapters/` | Integrations | integration/external-integrations.md |
136
+ | Root directory changes (new folders) | Architecture | architecture/architecture.md |
137
+
138
+ **Assess impact**:
139
+ - **High impact**: Multiple files in same category changed
140
+ - **Low impact**: Single file changed
141
+ - **No impact**: Only tests changed, no pattern shifts
142
+
143
+ **List existing guides**:
144
+ ```bash
145
+ find .codemie/guides -name "*.md" -type f
146
+ ```
147
+
148
+ **Cross-reference**:
149
+ - Guide exists + impacted → Update candidate
150
+ - Guide exists + not impacted → Skip
151
+ - Guide missing + impacted → Note for user
152
+
153
+ **Present to user**:
154
+ ```
155
+ 📊 Change Impact Analysis
156
+
157
+ 🔴 HIGH IMPACT (multiple files, pattern changes):
158
+ ✏️ api/api-patterns.md (3 files changed)
159
+ ✏️ security/security-patterns.md (2 files changed)
160
+
161
+ 🟡 LOW IMPACT (single file, minor updates):
162
+ ✏️ development/development-practices.md (1 file)
163
+
164
+ ⏭️ SKIPPED (no pattern changes):
165
+ - testing/testing-patterns.md
166
+ - data/database-patterns.md
167
+
168
+ Proceed with selective update? (Yes / Full Audit / Cancel)
169
+ ```
170
+
171
+ **Decision Point**:
172
+ - User selects "Yes" → Continue to Step 3A (selective update)
173
+ - User selects "Full Audit" → Jump to Step 2B (traditional audit)
174
+ - User selects "Cancel" → Exit
175
+
176
+ ---
177
+
178
+ ## Step 2B: Traditional Audit (For All Documentation)
179
+
180
+ **Use this workflow for non-Codemie docs or when user requests full audit**
41
181
 
42
182
  Before reviewing documentation, understand what changed:
43
183
 
@@ -54,7 +194,73 @@ Before reviewing documentation, understand what changed:
54
194
 
55
195
  ---
56
196
 
57
- ## Step 3: Audit Structured Guides (if present)
197
+ ## Step 3A: Selective Update (For Codemie Docs)
198
+
199
+ **For each guide identified in Step 2A.2**:
200
+
201
+ ### Step 3A.1: Analyze Changed Code
202
+
203
+ **For files mapped to this guide**:
204
+ 1. Read the changed files
205
+ 2. Identify what patterns changed (new, modified, or removed)
206
+ 3. Extract updated code examples (5-15 lines max)
207
+ 4. Note file paths with line numbers
208
+
209
+ ### Step 3A.2: Compare Current Guide vs Code
210
+
211
+ **Load current guide**:
212
+ ```bash
213
+ Read .codemie/guides/[category]/[guide].md
214
+ ```
215
+
216
+ **Load template** (for structural reference):
217
+ ```bash
218
+ Read .codemie/claude-templates/templates/guides/[category]/[template].md.template
219
+ ```
220
+
221
+ **Check**:
222
+ - [ ] Are documented patterns still used?
223
+ - [ ] Are code examples still accurate?
224
+ - [ ] Are file references still valid?
225
+ - [ ] Are new patterns present that should be documented?
226
+ - [ ] Are any documented patterns now obsolete?
227
+
228
+ ### Step 3A.3: Execute Selective Updates
229
+
230
+ **Determine update scope**:
231
+
232
+ | Finding | Action |
233
+ |---------|--------|
234
+ | Code example outdated | Update specific example, preserve structure |
235
+ | Pattern evolved | Update pattern description and example |
236
+ | New pattern introduced | Add new pattern section (if space allows) |
237
+ | Pattern removed | Remove or mark as deprecated |
238
+ | File path changed | Update reference path |
239
+ | Everything accurate | Skip update (no changes needed) |
240
+
241
+ **Update strategy**:
242
+ - ✅ Use Edit tool for selective updates (NOT Write)
243
+ - ✅ Update specific sections that changed
244
+ - ✅ Preserve guide structure (maintain template alignment)
245
+ - ✅ Keep existing examples that are still valid
246
+ - ✅ Update file:line references
247
+ - ❌ Don't rewrite entire guide
248
+ - ❌ Don't change structure unnecessarily
249
+
250
+ **Validate size**:
251
+ ```bash
252
+ wc -l .codemie/guides/[category]/[guide].md # Must be ≤400 lines
253
+ ```
254
+
255
+ If exceeded → Condense: remove redundant examples, use tables, tighten prose.
256
+
257
+ **Skip to Step 6** (validation) after updating impacted guides.
258
+
259
+ ---
260
+
261
+ ## Step 3B: Traditional Audit of Structured Guides
262
+
263
+ **Use for non-Codemie docs or full audit mode**
58
264
 
59
265
  For each guide/doc file that exists:
60
266
 
@@ -115,7 +321,7 @@ find . -name "CLAUDE.md" -not -path "*/node_modules/*" -not -path "*/.git/*"
115
321
 
116
322
  ---
117
323
 
118
- ## Step 5: Determine What Needs Updating
324
+ ## Step 5: Determine What Needs Updating (Traditional Mode)
119
325
 
120
326
  Categorize findings:
121
327
 
@@ -141,7 +347,14 @@ Categorize findings:
141
347
 
142
348
  ---
143
349
 
144
- ## Step 6: Execute Selective Updates
350
+ ## Step 6: Execute Updates
351
+
352
+ **For Codemie Docs** (if using selective update from Step 3A):
353
+ - Updates already completed in Step 3A.3
354
+ - Skip to Step 7 (validation)
355
+
356
+ **For Traditional Audit** (if using Step 3B-5):
357
+ - Continue with updates below
145
358
 
146
359
  Only modify files where changes are actually needed:
147
360
 
@@ -159,11 +372,19 @@ Only modify files where changes are actually needed:
159
372
  4. Remove obsolete patterns
160
373
  5. Ensure info is in most appropriate file
161
374
 
375
+ **For Codemie Guides** (if updating in traditional mode):
376
+ 1. Maintain template structure from `.codemie/claude-templates/`
377
+ 2. Update specific sections that are outdated
378
+ 3. Preserve existing valid examples
379
+ 4. Keep guides within size limits (200-400 lines)
380
+ 5. Update file:line references if paths changed
381
+
162
382
  **Content Placement**:
163
383
  - **Broad patterns** (used across project) → Root docs or main CLAUDE.md
164
384
  - **Component-specific** (local to one area) → Component CLAUDE.md or specific guide section
165
385
  - **Project-wide conventions** → Root README or CLAUDE.md
166
386
  - **Module implementation details** → Module-level CLAUDE.md
387
+ - **Codemie guides** → Category-specific guides in `.codemie/guides/[category]/`
167
388
 
168
389
  ---
169
390
 
@@ -173,10 +394,34 @@ Before finalizing:
173
394
 
174
395
  **Accuracy Check**:
175
396
  - [ ] All technical claims verified against current code
176
- - [ ] Examples reference existing files/functions
397
+ - [ ] Examples reference existing files/functions (check with actual file paths)
177
398
  - [ ] Patterns match actual implementation
178
399
  - [ ] No contradictions between different docs
179
400
 
401
+ **For Codemie Docs** (additional checks):
402
+ - [ ] All file:line references are valid
403
+ ```bash
404
+ # Verify referenced files exist
405
+ grep -o '\[.*\..*:.*\]' .codemie/guides/**/*.md | while read ref; do
406
+ file=$(echo $ref | cut -d: -f1 | tr -d '[]')
407
+ [ -f "$file" ] || echo "Missing: $file"
408
+ done
409
+ ```
410
+ - [ ] No placeholders remain ([PLACEHOLDER], FILL IN, TODO)
411
+ ```bash
412
+ grep -r '\[.*\]' .codemie/guides/ | grep -v '.git'
413
+ grep -r 'FILL IN\|TODO\|PLACEHOLDER' .codemie/guides/
414
+ ```
415
+ - [ ] Guide structure matches template conventions
416
+ - [ ] Size limits maintained (≤400 lines per guide)
417
+ ```bash
418
+ for guide in .codemie/guides/**/*.md; do
419
+ lines=$(wc -l < "$guide")
420
+ [ $lines -gt 400 ] && echo "⚠️ $guide exceeds 400 lines ($lines)"
421
+ done
422
+ ```
423
+ - [ ] CLAUDE.md guide references are current (if guides added/removed)
424
+
180
425
  **Relevance Check**:
181
426
  - [ ] Information is actionable
182
427
  - [ ] Content helps future understanding
@@ -191,6 +436,61 @@ Before finalizing:
191
436
 
192
437
  ---
193
438
 
439
+ ## Summary Report
440
+
441
+ After completing updates, provide a summary:
442
+
443
+ **For Selective Updates (Codemie Docs)**:
444
+ ```markdown
445
+ # Documentation Refresh Complete
446
+
447
+ ## Updated Guides (3)
448
+
449
+ ### High Impact Updates
450
+ **api/api-patterns.md** ✅
451
+ - Updated: Validation middleware pattern
452
+ - Updated: Error response format examples
453
+ - References: 3 files updated, all verified
454
+
455
+ **security/security-patterns.md** ✅
456
+ - Updated: JWT token generation example
457
+ - References: 2 files updated, all verified
458
+
459
+ ### Low Impact Updates
460
+ **development/development-practices.md** ✅
461
+ - Updated: Validation helper reference
462
+ - References: 1 file updated, verified
463
+
464
+ ## Skipped Guides (5)
465
+ - testing/testing-patterns.md (no pattern changes)
466
+ - data/database-patterns.md (no changes)
467
+ - architecture/architecture.md (structure unchanged)
468
+
469
+ ## Validation Status
470
+ - ✅ All file references verified
471
+ - ✅ No placeholders remain
472
+ - ✅ Size limits maintained
473
+ - ✅ Template structure preserved
474
+ ```
475
+
476
+ **For Traditional Audit**:
477
+ ```markdown
478
+ # Documentation Audit Complete
479
+
480
+ ## Files Updated
481
+ - CLAUDE.md (updated commands section)
482
+ - .codemie/guides/api/api-patterns.md (new pattern added)
483
+ - src/services/CLAUDE.md (updated integration points)
484
+
485
+ ## Validation Status
486
+ - ✅ All technical claims verified
487
+ - ✅ Examples reference existing code
488
+ - ✅ No contradictions found
489
+ - ✅ Links validated
490
+ ```
491
+
492
+ ---
493
+
194
494
  ## Key Principles
195
495
 
196
496
  **Accuracy Over Completeness**:
@@ -221,12 +521,23 @@ Before finalizing:
221
521
 
222
522
  Before making changes, ask:
223
523
 
224
- 1. **Is this change needed?** (Does doc mismatch implementation?)
225
- 2. **Is it significant?** (Will this help future understanding?)
226
- 3. **Where should it go?** (Most specific applicable location)
227
- 4. **What's the scope?** (Component-specific or project-wide?)
228
- 5. **Is it accurate?** (Verified against current code?)
229
- 6. **Is it clear?** (Would someone else understand this?)
524
+ 1. **Which mode applies?** (Codemie docs Smart Mode | Other docs → Traditional)
525
+ 2. **Is this change needed?** (Does doc mismatch implementation?)
526
+ 3. **Is it significant?** (Will this help future understanding?)
527
+ 4. **Where should it go?** (Most specific applicable location)
528
+ 5. **What's the scope?** (Component-specific or project-wide?)
529
+ 6. **Is it accurate?** (Verified against current code?)
530
+ 7. **Is it clear?** (Would someone else understand this?)
531
+
532
+ **Smart Mode Benefits**:
533
+ - Faster: Only checks changed areas
534
+ - Targeted: Updates specific guides
535
+ - Efficient: Good for regular maintenance
536
+
537
+ **Traditional Mode Benefits**:
538
+ - Comprehensive: Reviews all docs
539
+ - Thorough: Catches subtle issues
540
+ - Complete: Good for major refactors
230
541
 
231
542
  **If unsure**: Verify implementation first, then update documentation.
232
543
 
@@ -8,6 +8,10 @@
8
8
  "type": "command",
9
9
  "command": "codemie hook",
10
10
  "timeout": 5
11
+ },
12
+ {
13
+ "type": "command",
14
+ "command": "~/.codemie/claude-plugin/sounds/play-random-sound.sh ~/.codemie/sounds/SessionStart"
11
15
  }
12
16
  ]
13
17
  }
@@ -30,6 +34,10 @@
30
34
  "type": "command",
31
35
  "command": "codemie hook",
32
36
  "timeout": 2
37
+ },
38
+ {
39
+ "type": "command",
40
+ "command": "~/.codemie/claude-plugin/sounds/play-random-sound.sh ~/.codemie/sounds/PermissionRequest"
33
41
  }
34
42
  ]
35
43
  }
@@ -52,6 +60,10 @@
52
60
  "type": "command",
53
61
  "command": "codemie hook",
54
62
  "timeout": 2
63
+ },
64
+ {
65
+ "type": "command",
66
+ "command": "~/.codemie/claude-plugin/sounds/play-random-sound.sh ~/.codemie/sounds/Stop"
55
67
  }
56
68
  ]
57
69
  }
@@ -63,6 +75,10 @@
63
75
  "type": "command",
64
76
  "command": "codemie hook",
65
77
  "timeout": 2
78
+ },
79
+ {
80
+ "type": "command",
81
+ "command": "~/.codemie/claude-plugin/sounds/play-random-sound.sh ~/.codemie/sounds/UserPromptSubmit"
66
82
  }
67
83
  ]
68
84
  }
@@ -0,0 +1,112 @@
1
+ # play-random-sound.ps1
2
+ # Plays a random WAV or MP3 file from the specified directory (Windows)
3
+ # Usage: .\play-random-sound.ps1 <directory>
4
+
5
+ param(
6
+ [Parameter(Mandatory=$true, Position=0)]
7
+ [string]$Directory
8
+ )
9
+
10
+ # Set error action preference to stop on errors
11
+ $ErrorActionPreference = "Stop"
12
+
13
+ # Expand environment variables in the path (e.g., %USERPROFILE%)
14
+ $SoundDir = [System.Environment]::ExpandEnvironmentVariables($Directory)
15
+
16
+ # Check if directory exists - exit silently if not found
17
+ if (-not (Test-Path -Path $SoundDir -PathType Container)) {
18
+ exit 0
19
+ }
20
+
21
+ # Find all audio files (WAV and MP3)
22
+ $AudioFiles = Get-ChildItem -Path $SoundDir -File -Include *.wav,*.mp3 -ErrorAction SilentlyContinue
23
+
24
+ # Check if any audio files were found
25
+ if ($AudioFiles.Count -eq 0) {
26
+ exit 0
27
+ }
28
+
29
+ # Select a random file
30
+ $SelectedFile = $AudioFiles | Get-Random
31
+
32
+ # Function to play audio using mpg123 (if available)
33
+ function Play-WithMpg123 {
34
+ param([string]$FilePath)
35
+
36
+ try {
37
+ $mpg123 = Get-Command mpg123 -ErrorAction Stop
38
+ Start-Process -FilePath $mpg123.Source -ArgumentList "-q", "`"$FilePath`"" -NoNewWindow -Wait:$false
39
+ return $true
40
+ } catch {
41
+ return $false
42
+ }
43
+ }
44
+
45
+ # Function to play audio using Windows Media Player COM
46
+ function Play-WithWMP {
47
+ param([string]$FilePath)
48
+
49
+ try {
50
+ $wmp = New-Object -ComObject WMPlayer.OCX
51
+ $wmp.URL = $FilePath
52
+ $wmp.controls.play()
53
+
54
+ # Start playback in background (don't wait for completion)
55
+ Start-Sleep -Milliseconds 500
56
+ return $true
57
+ } catch {
58
+ return $false
59
+ }
60
+ }
61
+
62
+ # Function to play audio using .NET SoundPlayer (WAV only)
63
+ function Play-WithSoundPlayer {
64
+ param([string]$FilePath)
65
+
66
+ # SoundPlayer only supports WAV files
67
+ if ($FilePath -notmatch '\.wav$') {
68
+ return $false
69
+ }
70
+
71
+ try {
72
+ Add-Type -AssemblyName System.Windows.Forms
73
+ $player = New-Object System.Media.SoundPlayer
74
+ $player.SoundLocation = $FilePath
75
+ $player.PlaySync() # Play asynchronously
76
+
77
+ # Start in background job to avoid blocking
78
+ Start-Job -ScriptBlock {
79
+ param($path)
80
+ Add-Type -AssemblyName System.Windows.Forms
81
+ $p = New-Object System.Media.SoundPlayer
82
+ $p.SoundLocation = $path
83
+ $p.PlaySync()
84
+ } -ArgumentList $FilePath | Out-Null
85
+
86
+ return $true
87
+ } catch {
88
+ return $false
89
+ }
90
+ }
91
+
92
+ # Try audio players in order of preference
93
+ $played = $false
94
+
95
+ # 1. Try mpg123 (best option, cross-platform)
96
+ if (Play-WithMpg123 -FilePath $SelectedFile.FullName) {
97
+ $played = $true
98
+ }
99
+ # 2. Try Windows Media Player COM
100
+ elseif (Play-WithWMP -FilePath $SelectedFile.FullName) {
101
+ $played = $true
102
+ }
103
+ # 3. Try .NET SoundPlayer (WAV only)
104
+ elseif (Play-WithSoundPlayer -FilePath $SelectedFile.FullName) {
105
+ $played = $true
106
+ }
107
+
108
+ if (-not $played) {
109
+ exit 0
110
+ }
111
+
112
+ exit 0
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+
3
+ # play-random-sound.sh
4
+ # Plays a random WAV file from the specified directory
5
+ # Usage: ./play-random-sound.sh <directory>
6
+
7
+ set -e
8
+
9
+ # Check if directory argument is provided
10
+ if [ $# -eq 0 ]; then
11
+ echo "Usage: $0 <directory>" >&2
12
+ echo "Example: $0 ~/.codemie/claude-plugin/sounds/acolyte" >&2
13
+ exit 0
14
+ fi
15
+
16
+ # Expand tilde in the directory path
17
+ SOUND_DIR="${1/#\~/$HOME}"
18
+
19
+ # Check if directory exists - exit silently if not found
20
+ if [ ! -d "$SOUND_DIR" ]; then
21
+ exit 0
22
+ fi
23
+
24
+ # Find all audio files and store in array (compatible way)
25
+ WAV_FILES=()
26
+ while IFS= read -r -d '' file; do
27
+ WAV_FILES+=("$file")
28
+ done < <(find "$SOUND_DIR" -maxdepth 1 -type f \( -iname "*.wav" -o -iname "*.mp3" \) -print0 2>/dev/null)
29
+
30
+ # Check if any audio files were found
31
+ if [ ${#WAV_FILES[@]} -eq 0 ]; then
32
+ echo "Error: No WAV or MP3 files found in $SOUND_DIR" >&2
33
+ exit 0
34
+ fi
35
+
36
+ # Select a random file
37
+ RANDOM_INDEX=$((RANDOM % ${#WAV_FILES[@]}))
38
+ SELECTED_FILE="${WAV_FILES[$RANDOM_INDEX]}"
39
+
40
+ # Detect platform and use appropriate audio player
41
+ if command -v afplay &> /dev/null; then
42
+ # macOS
43
+ afplay "$SELECTED_FILE" &
44
+ elif command -v aplay &> /dev/null; then
45
+ # Linux with ALSA
46
+ aplay -q "$SELECTED_FILE" &
47
+ elif command -v paplay &> /dev/null; then
48
+ # Linux with PulseAudio
49
+ paplay "$SELECTED_FILE" &
50
+ elif command -v mpg123 &> /dev/null; then
51
+ # Cross-platform mpg123
52
+ mpg123 -q "$SELECTED_FILE" &
53
+ else
54
+ echo "Error: No audio player found. Install afplay (macOS), aplay, paplay, or mpg123" >&2
55
+ exit 0
56
+ fi
57
+
58
+ exit 0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Sounds Installer
3
+ *
4
+ * Automated installation of the sound hooks system for Claude Code.
5
+ * Creates hook directories, installs play-random-sound.sh script, and configures hooks.
6
+ */
7
+ /**
8
+ * Install fun sounds system
9
+ * Creates directories, installs script, and saves hooks configuration to ~/.claude/settings.json
10
+ *
11
+ * @returns Hooks configuration object if successful, null if installation failed
12
+ */
13
+ export declare function installSounds(): Promise<string | null>;
14
+ /**
15
+ * Check if sounds are already installed
16
+ * @returns true if exist sounds directory
17
+ */
18
+ export declare function isSoundsInstalled(): boolean;
19
+ //# sourceMappingURL=sounds-installer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sounds-installer.d.ts","sourceRoot":"","sources":["../../../../src/agents/plugins/claude/sounds-installer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2GH;;;;;GAKG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAqD5D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C"}