start-vibing 2.0.17 → 2.0.19
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.
package/dist/cli.js
CHANGED
|
@@ -129,8 +129,8 @@ async function copyClaudeSetup(targetDir, options = {}) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// src/cli.ts
|
|
132
|
-
import { existsSync as
|
|
133
|
-
import { join as
|
|
132
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
133
|
+
import { join as join4, dirname as dirname2 } from "path";
|
|
134
134
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
135
135
|
|
|
136
136
|
// src/update.ts
|
|
@@ -317,6 +317,9 @@ function getUpdateCommand() {
|
|
|
317
317
|
|
|
318
318
|
// src/claude.ts
|
|
319
319
|
import { spawn, execSync as execSync2, spawnSync } from "child_process";
|
|
320
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
321
|
+
import { join as join3 } from "path";
|
|
322
|
+
import { homedir } from "os";
|
|
320
323
|
function isClaudeInstalled() {
|
|
321
324
|
return commandExists("claude");
|
|
322
325
|
}
|
|
@@ -432,6 +435,33 @@ function launchClaude(cwd) {
|
|
|
432
435
|
process.exit(code || 0);
|
|
433
436
|
});
|
|
434
437
|
}
|
|
438
|
+
function ensureHooksEnabled() {
|
|
439
|
+
try {
|
|
440
|
+
const home = homedir();
|
|
441
|
+
const globalSettingsPath = join3(home, ".claude", "settings.json");
|
|
442
|
+
if (!existsSync3(globalSettingsPath)) {
|
|
443
|
+
return { modified: false };
|
|
444
|
+
}
|
|
445
|
+
const content = readFileSync3(globalSettingsPath, "utf-8");
|
|
446
|
+
let settings;
|
|
447
|
+
try {
|
|
448
|
+
settings = JSON.parse(content);
|
|
449
|
+
} catch {
|
|
450
|
+
return { modified: false };
|
|
451
|
+
}
|
|
452
|
+
if ("disableAllHooks" in settings) {
|
|
453
|
+
delete settings["disableAllHooks"];
|
|
454
|
+
writeFileSync3(globalSettingsPath, JSON.stringify(settings, null, "\t"), "utf-8");
|
|
455
|
+
return { modified: true };
|
|
456
|
+
}
|
|
457
|
+
return { modified: false };
|
|
458
|
+
} catch (error) {
|
|
459
|
+
return {
|
|
460
|
+
modified: false,
|
|
461
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
}
|
|
435
465
|
|
|
436
466
|
// src/mcp.ts
|
|
437
467
|
import { spawnSync as spawnSync2, spawn as spawn2 } from "child_process";
|
|
@@ -693,12 +723,12 @@ var __dirname3 = dirname2(__filename3);
|
|
|
693
723
|
function getVersion() {
|
|
694
724
|
try {
|
|
695
725
|
const paths = [
|
|
696
|
-
|
|
697
|
-
|
|
726
|
+
join4(__dirname3, "..", "package.json"),
|
|
727
|
+
join4(__dirname3, "..", "..", "package.json")
|
|
698
728
|
];
|
|
699
729
|
for (const pkgPath of paths) {
|
|
700
|
-
if (
|
|
701
|
-
const pkg = JSON.parse(
|
|
730
|
+
if (existsSync4(pkgPath)) {
|
|
731
|
+
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
702
732
|
return pkg.version || "1.0.0";
|
|
703
733
|
}
|
|
704
734
|
}
|
|
@@ -800,8 +830,8 @@ async function main() {
|
|
|
800
830
|
console.log(" Then just run: start-vibing");
|
|
801
831
|
console.log("");
|
|
802
832
|
}
|
|
803
|
-
const claudeDir =
|
|
804
|
-
if (
|
|
833
|
+
const claudeDir = join4(targetDir, ".claude");
|
|
834
|
+
if (existsSync4(claudeDir) && !force) {
|
|
805
835
|
console.log(" Found existing .claude/ folder.");
|
|
806
836
|
console.log(" Will preserve your custom domains and merge with new files.\n");
|
|
807
837
|
}
|
|
@@ -816,6 +846,10 @@ async function main() {
|
|
|
816
846
|
if (result.preserved > 0) {
|
|
817
847
|
console.log(`\n Preserved ${result.preserved} custom file(s) (domains, etc.)`);
|
|
818
848
|
}
|
|
849
|
+
const hooksResult = ensureHooksEnabled();
|
|
850
|
+
if (hooksResult.modified) {
|
|
851
|
+
console.log("\n Fixed global settings: removed disableAllHooks (hooks now enabled)");
|
|
852
|
+
}
|
|
819
853
|
if (!skipClaude) {
|
|
820
854
|
console.log("");
|
|
821
855
|
console.log(" ========================================");
|
package/package.json
CHANGED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# Claude MD Compactor Agent
|
|
2
|
+
|
|
3
|
+
> **Purpose:** Intelligently compact CLAUDE.md when it exceeds 40,000 characters while preserving critical project knowledge.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Trigger
|
|
8
|
+
|
|
9
|
+
AUTOMATICALLY invoke when:
|
|
10
|
+
|
|
11
|
+
- CLAUDE.md exceeds 40,000 characters
|
|
12
|
+
- Stop hook blocks with `CLAUDE_MD_SIZE_EXCEEDED` error
|
|
13
|
+
- User says "compact", "reduce", "shrink" CLAUDE.md
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Execution Steps
|
|
18
|
+
|
|
19
|
+
### Step 1: Analyze Current State
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Get current size
|
|
23
|
+
wc -m CLAUDE.md
|
|
24
|
+
|
|
25
|
+
# Get section breakdown
|
|
26
|
+
grep -n "^## " CLAUDE.md
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Step 2: Research Best Practices
|
|
30
|
+
|
|
31
|
+
Use MCP servers to get latest recommendations:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
1. context7 - Query Claude Code documentation patterns
|
|
35
|
+
2. WebSearch - "Anthropic Claude system prompt best practices 2024 2025"
|
|
36
|
+
3. WebSearch - "Claude context window optimization techniques"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Step 3: Read Template for Structure
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Read: .claude/skills/codebase-knowledge/TEMPLATE.md
|
|
43
|
+
Read: .claude/CLAUDE.md (agent context file for reference)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Step 4: Apply Compaction Rules
|
|
47
|
+
|
|
48
|
+
#### MUST KEEP (Critical Sections)
|
|
49
|
+
|
|
50
|
+
| Section | Max Size | Notes |
|
|
51
|
+
| -------------------- | -------- | ---------------------------- |
|
|
52
|
+
| # Project Title | 1 line | Just the name |
|
|
53
|
+
| ## Last Change | 200 char | ONLY latest, no history |
|
|
54
|
+
| ## 30 Seconds | 300 char | 2-3 sentences max |
|
|
55
|
+
| ## Stack | 500 char | Table format only |
|
|
56
|
+
| ## Architecture | 800 char | Tree structure, no prose |
|
|
57
|
+
| ## Critical Rules | 2000 char | Bullet points only |
|
|
58
|
+
| ## FORBIDDEN Actions | 1000 char | Table format |
|
|
59
|
+
| ## Quality Gates | 500 char | Commands only |
|
|
60
|
+
|
|
61
|
+
#### MUST REMOVE/CONDENSE
|
|
62
|
+
|
|
63
|
+
| Remove | Why |
|
|
64
|
+
| --------------------------- | ------------------------------------ |
|
|
65
|
+
| Verbose explanations | Use bullet points instead |
|
|
66
|
+
| Code examples > 5 lines | Reference file paths instead |
|
|
67
|
+
| Duplicate information | Keep only in most relevant section |
|
|
68
|
+
| Old "Last Change" entries | Git history has this |
|
|
69
|
+
| Long tables with examples | Keep headers + 1-2 rows max |
|
|
70
|
+
| Commented-out sections | Delete completely |
|
|
71
|
+
| Multiple H1 headers | Only one allowed |
|
|
72
|
+
| Nested sub-sub-sections | Flatten to H2 max |
|
|
73
|
+
|
|
74
|
+
#### CONDENSE TECHNIQUES
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
# BAD (verbose)
|
|
78
|
+
## Authentication
|
|
79
|
+
The authentication system uses JWT tokens for secure session management.
|
|
80
|
+
When a user logs in, the server generates a token that contains...
|
|
81
|
+
[50 more lines of explanation]
|
|
82
|
+
|
|
83
|
+
# GOOD (compact)
|
|
84
|
+
## Auth
|
|
85
|
+
- JWT tokens via `lib/auth.ts`
|
|
86
|
+
- Session: 7 days, refresh: 30 days
|
|
87
|
+
- Middleware: `middleware/auth.ts`
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Step 5: Rewrite File
|
|
91
|
+
|
|
92
|
+
Create new CLAUDE.md with:
|
|
93
|
+
|
|
94
|
+
1. **Header** - Project name only
|
|
95
|
+
2. **Last Change** - Latest only (branch, date, 1-line summary)
|
|
96
|
+
3. **30 Seconds** - What it does in 2 sentences
|
|
97
|
+
4. **Stack** - Technology table (no descriptions)
|
|
98
|
+
5. **Architecture** - Tree only, no explanations
|
|
99
|
+
6. **Workflow** - Numbered steps, no prose
|
|
100
|
+
7. **Critical Rules** - Bullets, max 10 rules
|
|
101
|
+
8. **FORBIDDEN** - Table format
|
|
102
|
+
9. **Quality Gates** - Commands only
|
|
103
|
+
|
|
104
|
+
### Step 6: Validate Size
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Must be under 40,000
|
|
108
|
+
wc -m CLAUDE.md
|
|
109
|
+
|
|
110
|
+
# If still over, remove more:
|
|
111
|
+
# 1. Reduce examples
|
|
112
|
+
# 2. Shorten rule descriptions
|
|
113
|
+
# 3. Remove optional sections
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Compaction Template
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
# {Project Name}
|
|
122
|
+
|
|
123
|
+
> Max 40k chars. Validate: `wc -m CLAUDE.md`
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Last Change
|
|
128
|
+
|
|
129
|
+
**Branch:** {branch}
|
|
130
|
+
**Date:** {YYYY-MM-DD}
|
|
131
|
+
**Summary:** {1 sentence}
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Overview
|
|
136
|
+
|
|
137
|
+
{2-3 sentences max}
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Stack
|
|
142
|
+
|
|
143
|
+
| Component | Tech |
|
|
144
|
+
|-----------|------|
|
|
145
|
+
| Runtime | Bun |
|
|
146
|
+
| Language | TS |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Architecture
|
|
151
|
+
|
|
152
|
+
\`\`\`
|
|
153
|
+
project/
|
|
154
|
+
├── app/ # Routes
|
|
155
|
+
├── lib/ # Utils
|
|
156
|
+
└── types/ # Types
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Rules
|
|
162
|
+
|
|
163
|
+
- Rule 1
|
|
164
|
+
- Rule 2
|
|
165
|
+
- Rule 3
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## FORBIDDEN
|
|
170
|
+
|
|
171
|
+
| Action | Reason |
|
|
172
|
+
|--------|--------|
|
|
173
|
+
| X | Y |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Commands
|
|
178
|
+
|
|
179
|
+
\`\`\`bash
|
|
180
|
+
bun run typecheck
|
|
181
|
+
bun run lint
|
|
182
|
+
bun run test
|
|
183
|
+
\`\`\`
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Research Queries (MCP)
|
|
189
|
+
|
|
190
|
+
When compacting, query these for best practices:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
context7: "Claude Code CLAUDE.md structure"
|
|
194
|
+
WebSearch: "Anthropic system prompt optimization 2025"
|
|
195
|
+
WebSearch: "Claude context efficiency best practices"
|
|
196
|
+
WebSearch: "LLM prompt compression techniques"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Output
|
|
202
|
+
|
|
203
|
+
After compaction:
|
|
204
|
+
|
|
205
|
+
1. Show before/after character count
|
|
206
|
+
2. List removed sections
|
|
207
|
+
3. Confirm all critical sections preserved
|
|
208
|
+
4. Verify file validates with stop hook
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Integration
|
|
213
|
+
|
|
214
|
+
The stop hook will:
|
|
215
|
+
|
|
216
|
+
1. Detect CLAUDE.md > 40k chars
|
|
217
|
+
2. Block with message suggesting this agent
|
|
218
|
+
3. Agent compacts file
|
|
219
|
+
4. Stop hook re-validates
|
|
220
|
+
5. Task completes if under limit
|
|
@@ -400,39 +400,63 @@ function validateClaudeMdSize(): ValidationError | null {
|
|
|
400
400
|
if (content.length <= MAX_CHARACTERS) return null;
|
|
401
401
|
|
|
402
402
|
const excess = content.length - MAX_CHARACTERS;
|
|
403
|
+
const percentOver = ((excess / MAX_CHARACTERS) * 100).toFixed(1);
|
|
403
404
|
|
|
404
405
|
return {
|
|
405
406
|
type: 'CLAUDE_MD_SIZE_EXCEEDED',
|
|
406
|
-
message: `CLAUDE.md exceeds 40,000 character limit by ${excess} characters (
|
|
407
|
+
message: `CLAUDE.md exceeds 40,000 character limit by ${excess} characters (${percentOver}% over).`,
|
|
407
408
|
action: `
|
|
408
409
|
================================================================================
|
|
409
|
-
CLAUDE.MD MUST BE COMPACTED
|
|
410
|
+
CLAUDE.MD MUST BE COMPACTED - RUN COMPACTOR AGENT (MANDATORY)
|
|
410
411
|
================================================================================
|
|
411
412
|
|
|
412
413
|
Current size: ${content.length} characters
|
|
413
414
|
Maximum allowed: ${MAX_CHARACTERS} characters
|
|
414
|
-
Excess: ${excess} characters
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
415
|
+
Excess: ${excess} characters (${percentOver}% over limit)
|
|
416
|
+
|
|
417
|
+
--------------------------------------------------------------------------------
|
|
418
|
+
REQUIRED ACTION: Run the claude-md-compactor agent
|
|
419
|
+
--------------------------------------------------------------------------------
|
|
420
|
+
|
|
421
|
+
Task(subagent_type="claude-md-compactor", prompt="Compact CLAUDE.md to under 40k characters while preserving critical project knowledge")
|
|
422
|
+
|
|
423
|
+
The compactor agent will:
|
|
424
|
+
1. Research best practices via context7 and web search
|
|
425
|
+
2. Analyze current CLAUDE.md structure
|
|
426
|
+
3. Apply intelligent compaction rules:
|
|
427
|
+
- Keep: Title, Last Change, Overview, Stack, Architecture, Rules
|
|
428
|
+
- Remove: Verbose prose, old history, long examples, duplicates
|
|
429
|
+
4. Rewrite file in compact format
|
|
430
|
+
5. Validate final size < 40,000 chars
|
|
431
|
+
|
|
432
|
+
--------------------------------------------------------------------------------
|
|
433
|
+
COMPACTION PRIORITIES (agent follows these)
|
|
434
|
+
--------------------------------------------------------------------------------
|
|
435
|
+
|
|
436
|
+
MUST KEEP (max sizes):
|
|
437
|
+
- # Project Title (1 line)
|
|
438
|
+
- ## Last Change (200 chars, ONLY latest)
|
|
439
|
+
- ## 30 Seconds Overview (300 chars)
|
|
440
|
+
- ## Stack (500 chars, table only)
|
|
441
|
+
- ## Architecture (800 chars, tree only)
|
|
442
|
+
- ## Critical Rules (2000 chars, bullets)
|
|
443
|
+
- ## FORBIDDEN (1000 chars, table)
|
|
444
|
+
|
|
445
|
+
MUST REMOVE:
|
|
446
|
+
- Verbose explanations → bullet points
|
|
447
|
+
- Code examples > 5 lines → file references
|
|
448
|
+
- Old "Last Change" entries → git has history
|
|
449
|
+
- Duplicate information → keep in one place
|
|
450
|
+
- Long tables → header + 2 rows max
|
|
451
|
+
|
|
452
|
+
--------------------------------------------------------------------------------
|
|
453
|
+
MANUAL VERIFICATION (after agent runs)
|
|
454
|
+
--------------------------------------------------------------------------------
|
|
455
|
+
|
|
456
|
+
wc -m CLAUDE.md # Must show < 40000
|
|
457
|
+
|
|
458
|
+
================================================================================
|
|
459
|
+
The stop hook will BLOCK until CLAUDE.md is under 40,000 characters.
|
|
436
460
|
================================================================================`,
|
|
437
461
|
};
|
|
438
462
|
}
|
|
@@ -151,6 +151,11 @@
|
|
|
151
151
|
"file": "agents/domain-updater.md",
|
|
152
152
|
"description": "Updates domain documentation with session learnings and problems solved. FINAL step after commit.",
|
|
153
153
|
"priority": 11
|
|
154
|
+
},
|
|
155
|
+
"claude-md-compactor": {
|
|
156
|
+
"file": "agents/07-documentation/claude-md-compactor.md",
|
|
157
|
+
"description": "Compacts CLAUDE.md when it exceeds 40k chars. Uses research + template to intelligently reduce size while preserving critical knowledge.",
|
|
158
|
+
"priority": 12
|
|
154
159
|
}
|
|
155
160
|
},
|
|
156
161
|
|