@the-bearded-bear/claude-craft 7.26.0 → 7.28.0-next.7fa5c27
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/Dev/i18n/base/Common/templates/claudeignore.template +35 -0
- package/Dev/i18n/base/Common/templates/settings.local.json.template +37 -4
- package/Dev/i18n/de/Common/rules/12-context-management.md +38 -1
- package/Dev/i18n/en/Common/rules/12-context-management.md +38 -1
- package/Dev/i18n/en/Common/templates/settings.json.template +63 -0
- package/Dev/i18n/es/Common/rules/12-context-management.md +38 -1
- package/Dev/i18n/fr/Common/rules/12-context-management.md +38 -1
- package/Dev/i18n/pt/Common/rules/12-context-management.md +38 -1
- package/Dev/scripts/install-common-rules.sh +71 -1
- package/README.md +2 -2
- package/Tools/MultiAccount/claude-accounts.sh +88 -6
- package/Tools/MultiAccount/tests/sync.bats +188 -0
- package/Tools/RTK/install-rtk.sh +15 -0
- package/Tools/RTK/tests/ultra-compact.bats +121 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Build artifacts and dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
vendor/
|
|
4
|
+
coverage/
|
|
5
|
+
test-output/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.next/
|
|
9
|
+
out/
|
|
10
|
+
|
|
11
|
+
# Large generated files
|
|
12
|
+
package-lock.json
|
|
13
|
+
yarn.lock
|
|
14
|
+
pnpm-lock.yaml
|
|
15
|
+
composer.lock
|
|
16
|
+
CHANGELOG.md
|
|
17
|
+
|
|
18
|
+
# IDE and OS
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
.DS_Store
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
|
|
25
|
+
# Logs and temporary files
|
|
26
|
+
*.log
|
|
27
|
+
__pycache__/
|
|
28
|
+
.pytest_cache/
|
|
29
|
+
.mypy_cache/
|
|
30
|
+
|
|
31
|
+
# Binaries and media (if present)
|
|
32
|
+
*.wasm
|
|
33
|
+
*.mp4
|
|
34
|
+
*.mov
|
|
35
|
+
*.avi
|
|
@@ -2,9 +2,42 @@
|
|
|
2
2
|
"$schema": "https://claude.ai/settings-schema.json",
|
|
3
3
|
|
|
4
4
|
"permissions": {
|
|
5
|
-
"allow": [
|
|
5
|
+
"allow": [
|
|
6
|
+
"Bash(git:*)",
|
|
7
|
+
"Bash(make:*)",
|
|
8
|
+
"Bash(npm:*)",
|
|
9
|
+
"Bash(npx:*)",
|
|
10
|
+
"Bash(node:*)",
|
|
11
|
+
"Bash(bash:*)",
|
|
12
|
+
"Bash(chmod:*)",
|
|
13
|
+
"Bash(find:*)",
|
|
14
|
+
"Bash(ls:*)",
|
|
15
|
+
"Bash(cat:*)",
|
|
16
|
+
"Bash(grep:*)",
|
|
17
|
+
"Bash(echo:*)",
|
|
18
|
+
"Bash(wc:*)",
|
|
19
|
+
"Bash(tree:*)",
|
|
20
|
+
"Bash(head:*)",
|
|
21
|
+
"Bash(tail:*)",
|
|
22
|
+
"Bash(xargs:*)",
|
|
23
|
+
"Bash(jq:*)",
|
|
24
|
+
"Bash(yq:*)",
|
|
25
|
+
"Bash(sed:*)",
|
|
26
|
+
"Bash(sort:*)",
|
|
27
|
+
"Bash(diff:*)",
|
|
28
|
+
"Bash(mkdir:*)",
|
|
29
|
+
"Bash(cp:*)",
|
|
30
|
+
"Bash(mv:*)",
|
|
31
|
+
"Bash(touch:*)",
|
|
32
|
+
"Bash(python3:*)",
|
|
33
|
+
"Bash(curl:*)",
|
|
34
|
+
"Bash(gh:*)",
|
|
35
|
+
"Bash(rtk:*)",
|
|
36
|
+
"Bash(docker:*)",
|
|
37
|
+
"Bash(docker compose:*)",
|
|
38
|
+
"WebSearch",
|
|
39
|
+
"WebFetch"
|
|
40
|
+
],
|
|
6
41
|
"deny": []
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
"hooks": {}
|
|
42
|
+
}
|
|
10
43
|
}
|
|
@@ -697,9 +697,46 @@ Dateien werden in alphabetischer Reihenfolge zusammengefuehrt, sodass Teams Konf
|
|
|
697
697
|
|
|
698
698
|
---
|
|
699
699
|
|
|
700
|
+
## Neue Befehle (v2.1.105+)
|
|
701
|
+
|
|
702
|
+
| Befehl | Beschreibung | Verwendung |
|
|
703
|
+
|--------|--------------|------------|
|
|
704
|
+
| `/btw` | Schnelle Fragen ohne Kontextwechsel | Lookups, Syntax, Klarstellungen |
|
|
705
|
+
| `/hooks` | Interaktive Hook-Verwaltung | Aktivieren/Deaktivieren, Testen, Debuggen |
|
|
706
|
+
| `/reload-plugins` | Manuelles Plugin-Neuladen | Nach Plugin-Updates |
|
|
707
|
+
| `/proactive` | Alias fuer `/loop` | Proaktives wiederkehrendes Monitoring |
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## Zusaetzliche Umgebungsvariablen (v2.1.105+)
|
|
712
|
+
|
|
713
|
+
| Variable | Beschreibung |
|
|
714
|
+
|----------|--------------|
|
|
715
|
+
| `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | CLAUDE.md aus `--add-dir` laden |
|
|
716
|
+
| `MAX_THINKING_TOKENS=8000` | Denktoken-Limit |
|
|
717
|
+
| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Zeichenbudget fuer Slash-Befehle |
|
|
718
|
+
| `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` | PowerShell statt Bash (Windows, v2.1.84+) |
|
|
719
|
+
| `OTEL_LOG_USER_PROMPTS` | Prompts in Traces loggen (Beta) |
|
|
720
|
+
| `OTEL_LOG_TOOL_DETAILS` | Tool-Details loggen (Beta) |
|
|
721
|
+
| `OTEL_LOG_TOOL_CONTENT` | Tool-Inhalt loggen (Beta, ausfuehrlich) |
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## Erweiterte Skills (v2.1.105+)
|
|
726
|
+
|
|
727
|
+
| Frontmatter | Beschreibung |
|
|
728
|
+
|-------------|--------------|
|
|
729
|
+
| `context: fork` | Ausfuehrung in isoliertem Kontext (keine Verschmutzung) |
|
|
730
|
+
| `disable-model-invocation: true` | Automatische Aufrufung durch Claude verhindern |
|
|
731
|
+
| `claudeMdExcludes` (Setting) | Bestimmte CLAUDE.md-Dateien in Monorepos ausschliessen |
|
|
732
|
+
|
|
733
|
+
**Auto-Kompaktierung und Skills:** Nach der Kompaktierung werden Skills automatisch neu geladen (5K Tokens/Skill, 25K gesamt max).
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
700
737
|
## Ressourcen
|
|
701
738
|
|
|
702
|
-
- **Anthropic Best Practices:** [
|
|
739
|
+
- **Anthropic Best Practices:** [code.claude.com](https://code.claude.com/docs/en/overview)
|
|
703
740
|
- **Boris Cherny Workflow:** Parallele Worktrees + Verifikationsschleifen
|
|
704
741
|
- **Claude Code Kontextverwaltung:** Context Compaction, `/clear`, Sub-Agents
|
|
705
742
|
- **`/init`:** Generiert automatisch eine CLAUDE.md aus der Projektanalyse
|
|
@@ -697,9 +697,46 @@ Files are merged in alphabetical order, allowing teams to layer configurations w
|
|
|
697
697
|
|
|
698
698
|
---
|
|
699
699
|
|
|
700
|
+
## New Commands (v2.1.105+)
|
|
701
|
+
|
|
702
|
+
| Command | Description | Use Case |
|
|
703
|
+
|---------|-------------|----------|
|
|
704
|
+
| `/btw` | Quick questions without context switching | Lookups, syntax, clarifications |
|
|
705
|
+
| `/hooks` | Interactive hook management | Enable/disable, test, debug |
|
|
706
|
+
| `/reload-plugins` | Manual plugin reload | After plugin updates |
|
|
707
|
+
| `/proactive` | Alias for `/loop` | Proactive recurring monitoring |
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## Additional Environment Variables (v2.1.105+)
|
|
712
|
+
|
|
713
|
+
| Variable | Description |
|
|
714
|
+
|----------|-------------|
|
|
715
|
+
| `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | Load CLAUDE.md from `--add-dir` |
|
|
716
|
+
| `MAX_THINKING_TOKENS=8000` | Thinking token limit |
|
|
717
|
+
| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Slash command character budget |
|
|
718
|
+
| `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` | PowerShell instead of Bash (Windows, v2.1.84+) |
|
|
719
|
+
| `OTEL_LOG_USER_PROMPTS` | Log prompts in traces (beta) |
|
|
720
|
+
| `OTEL_LOG_TOOL_DETAILS` | Log tool details (beta) |
|
|
721
|
+
| `OTEL_LOG_TOOL_CONTENT` | Log tool content (beta, verbose) |
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## Advanced Skills (v2.1.105+)
|
|
726
|
+
|
|
727
|
+
| Frontmatter | Description |
|
|
728
|
+
|-------------|-------------|
|
|
729
|
+
| `context: fork` | Run in isolated context (no pollution) |
|
|
730
|
+
| `disable-model-invocation: true` | Prevent automatic invocation by Claude |
|
|
731
|
+
| `claudeMdExcludes` (setting) | Exclude specific CLAUDE.md files in monorepos |
|
|
732
|
+
|
|
733
|
+
**Auto-compaction and skills:** After compaction, skills auto-reload (5K tokens/skill, 25K total max).
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
700
737
|
## Resources
|
|
701
738
|
|
|
702
|
-
- **Anthropic Best Practices:** [
|
|
739
|
+
- **Anthropic Best Practices:** [code.claude.com](https://code.claude.com/docs/en/overview)
|
|
703
740
|
- **Boris Cherny Workflow:** Parallel worktrees + verification loops
|
|
704
741
|
- **Claude Code Context Management:** Context compaction, `/clear`, sub-agents
|
|
705
742
|
- **`/init`:** Automatically generates a CLAUDE.md from project analysis
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://claude.ai/settings-schema.json",
|
|
3
3
|
|
|
4
|
+
"env": {
|
|
5
|
+
"CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-5"
|
|
6
|
+
},
|
|
7
|
+
|
|
4
8
|
"spinnerVerbs": {
|
|
5
9
|
"default": ["Thinking", "Processing", "Analyzing", "Working"],
|
|
6
10
|
"Edit": ["Editing", "Modifying", "Updating"],
|
|
@@ -61,6 +65,15 @@
|
|
|
61
65
|
"timeout": 10
|
|
62
66
|
}
|
|
63
67
|
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"matcher": "compact",
|
|
71
|
+
"hooks": [
|
|
72
|
+
{
|
|
73
|
+
"type": "command",
|
|
74
|
+
"command": "if [ -f .claude/context-essentials.md ]; then cat .claude/context-essentials.md; else echo 'No context-essentials.md found.'; fi"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
64
77
|
}
|
|
65
78
|
],
|
|
66
79
|
"PreToolUse": [
|
|
@@ -73,6 +86,24 @@
|
|
|
73
86
|
"timeout": 5
|
|
74
87
|
}
|
|
75
88
|
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"matcher": "Edit",
|
|
92
|
+
"hooks": [
|
|
93
|
+
{
|
|
94
|
+
"type": "command",
|
|
95
|
+
"command": "FILEPATH=$(echo '$TOOL_INPUT' | jq -r '.file_path // empty'); if echo \"$FILEPATH\" | grep -qE '(\\.env|\\.env\\.|credentials|secrets|private.*key|id_rsa)'; then echo \"BLOCKED: Cannot edit sensitive file: $FILEPATH\" && exit 1; fi; exit 0"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"matcher": "Write",
|
|
101
|
+
"hooks": [
|
|
102
|
+
{
|
|
103
|
+
"type": "command",
|
|
104
|
+
"command": "FILEPATH=$(echo '$TOOL_INPUT' | jq -r '.file_path // empty'); if echo \"$FILEPATH\" | grep -qE '(\\.env|\\.env\\.|credentials|secrets|private.*key|id_rsa)'; then echo \"BLOCKED: Cannot write sensitive file: $FILEPATH\" && exit 1; fi; exit 0"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
76
107
|
}
|
|
77
108
|
],
|
|
78
109
|
"PostToolUse": [
|
|
@@ -85,6 +116,26 @@
|
|
|
85
116
|
"timeout": 60
|
|
86
117
|
}
|
|
87
118
|
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"matcher": "Bash",
|
|
122
|
+
"hooks": [
|
|
123
|
+
{
|
|
124
|
+
"type": "command",
|
|
125
|
+
"command": "OUTPUT_SIZE=$(echo '$TOOL_OUTPUT' | wc -c); if [ \"$OUTPUT_SIZE\" -gt 50000 ]; then echo 'NOTICE: Large output (>50KB). Extract only the relevant information and summarize in under 20 lines.'; elif [ \"$OUTPUT_SIZE\" -gt 10000 ]; then echo 'NOTICE: Moderate output (>10KB). Focus on errors, warnings, and key results.'; fi; exit 0",
|
|
126
|
+
"timeout": 3000
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"matcher": "Grep",
|
|
132
|
+
"hooks": [
|
|
133
|
+
{
|
|
134
|
+
"type": "command",
|
|
135
|
+
"command": "OUTPUT_SIZE=$(echo '$TOOL_OUTPUT' | wc -c); if [ \"$OUTPUT_SIZE\" -gt 50000 ]; then echo 'NOTICE: Large output (>50KB). Summarize key findings in under 20 lines.'; fi; exit 0",
|
|
136
|
+
"timeout": 3000
|
|
137
|
+
}
|
|
138
|
+
]
|
|
88
139
|
}
|
|
89
140
|
],
|
|
90
141
|
"PostToolUseFailure": [
|
|
@@ -111,6 +162,18 @@
|
|
|
111
162
|
]
|
|
112
163
|
}
|
|
113
164
|
],
|
|
165
|
+
"PostCompact": [
|
|
166
|
+
{
|
|
167
|
+
"matcher": "auto",
|
|
168
|
+
"hooks": [
|
|
169
|
+
{
|
|
170
|
+
"type": "command",
|
|
171
|
+
"command": "if [ -f .claude/context-essentials.md ]; then jq -n --rawfile c .claude/context-essentials.md '{\"systemMessage\": (\"CONTEXT RESTORED AFTER COMPACTION:\\n\" + $c)}'; else echo '{}'; fi",
|
|
172
|
+
"timeout": 5000
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
],
|
|
114
177
|
"Stop": [
|
|
115
178
|
{
|
|
116
179
|
"matcher": "",
|
|
@@ -697,9 +697,46 @@ Los archivos se fusionan en orden alfabetico, permitiendo a los equipos superpon
|
|
|
697
697
|
|
|
698
698
|
---
|
|
699
699
|
|
|
700
|
+
## Nuevos comandos (v2.1.105+)
|
|
701
|
+
|
|
702
|
+
| Comando | Descripcion | Uso |
|
|
703
|
+
|---------|-------------|-----|
|
|
704
|
+
| `/btw` | Preguntas rapidas sin cambio de contexto | Lookups, sintaxis, aclaraciones |
|
|
705
|
+
| `/hooks` | Gestion interactiva de hooks | Activar/desactivar, probar, depurar |
|
|
706
|
+
| `/reload-plugins` | Recarga manual de plugins | Despues de actualizar plugins |
|
|
707
|
+
| `/proactive` | Alias para `/loop` | Monitoreo proactivo recurrente |
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## Variables de entorno adicionales (v2.1.105+)
|
|
712
|
+
|
|
713
|
+
| Variable | Descripcion |
|
|
714
|
+
|----------|-------------|
|
|
715
|
+
| `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | Cargar CLAUDE.md desde `--add-dir` |
|
|
716
|
+
| `MAX_THINKING_TOKENS=8000` | Limite de tokens de reflexion |
|
|
717
|
+
| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Presupuesto de caracteres para slash commands |
|
|
718
|
+
| `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` | PowerShell en lugar de Bash (Windows, v2.1.84+) |
|
|
719
|
+
| `OTEL_LOG_USER_PROMPTS` | Log de prompts en trazas (beta) |
|
|
720
|
+
| `OTEL_LOG_TOOL_DETAILS` | Log de detalles de herramientas (beta) |
|
|
721
|
+
| `OTEL_LOG_TOOL_CONTENT` | Log de contenido de herramientas (beta, verboso) |
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## Skills avanzados (v2.1.105+)
|
|
726
|
+
|
|
727
|
+
| Frontmatter | Descripcion |
|
|
728
|
+
|-------------|-------------|
|
|
729
|
+
| `context: fork` | Ejecucion en contexto aislado (sin contaminacion) |
|
|
730
|
+
| `disable-model-invocation: true` | Impide la invocacion automatica por Claude |
|
|
731
|
+
| `claudeMdExcludes` (setting) | Excluir CLAUDE.md especificos en monorepos |
|
|
732
|
+
|
|
733
|
+
**Auto-compactacion y skills:** Despues de la compactacion, los skills se recargan (5K tokens/skill, 25K total max).
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
700
737
|
## Recursos
|
|
701
738
|
|
|
702
|
-
- **Anthropic Best Practices:** [
|
|
739
|
+
- **Anthropic Best Practices:** [code.claude.com](https://code.claude.com/docs/en/overview)
|
|
703
740
|
- **Boris Cherny Workflow:** Worktrees paralelos + bucles de verificacion
|
|
704
741
|
- **Claude Code Context Management:** Context compaction, `/clear`, sub-agentes
|
|
705
742
|
- **`/init`:** Genera automaticamente un CLAUDE.md a partir del analisis del proyecto
|
|
@@ -697,9 +697,46 @@ Les fichiers sont fusionnes par ordre alphabetique, permettant aux equipes de su
|
|
|
697
697
|
|
|
698
698
|
---
|
|
699
699
|
|
|
700
|
+
## Nouvelles commandes (v2.1.105+)
|
|
701
|
+
|
|
702
|
+
| Commande | Description | Usage |
|
|
703
|
+
|----------|-------------|-------|
|
|
704
|
+
| `/btw` | Questions rapides sans changement de contexte | Lookups, syntaxe, clarifications |
|
|
705
|
+
| `/hooks` | Gestion interactive des hooks | Activer/desactiver, tester, debugger |
|
|
706
|
+
| `/reload-plugins` | Rechargement manuel des plugins | Apres mise a jour de plugins |
|
|
707
|
+
| `/proactive` | Alias pour `/loop` | Monitoring proactif recurrent |
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## Variables d'environnement supplementaires (v2.1.105+)
|
|
712
|
+
|
|
713
|
+
| Variable | Description |
|
|
714
|
+
|----------|-------------|
|
|
715
|
+
| `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | Charger CLAUDE.md depuis `--add-dir` |
|
|
716
|
+
| `MAX_THINKING_TOKENS=8000` | Limite tokens de reflexion |
|
|
717
|
+
| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Budget caracteres slash commands |
|
|
718
|
+
| `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` | PowerShell au lieu de Bash (Windows, v2.1.84+) |
|
|
719
|
+
| `OTEL_LOG_USER_PROMPTS` | Log prompts dans traces (beta) |
|
|
720
|
+
| `OTEL_LOG_TOOL_DETAILS` | Log details outils (beta) |
|
|
721
|
+
| `OTEL_LOG_TOOL_CONTENT` | Log contenu outils (beta, verbose) |
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## Skills avances (v2.1.105+)
|
|
726
|
+
|
|
727
|
+
| Frontmatter | Description |
|
|
728
|
+
|-------------|-------------|
|
|
729
|
+
| `context: fork` | Execution dans un contexte isole (pas de pollution) |
|
|
730
|
+
| `disable-model-invocation: true` | Empeche l'invocation automatique par Claude |
|
|
731
|
+
| `claudeMdExcludes` (setting) | Exclure des CLAUDE.md specifiques dans les monorepos |
|
|
732
|
+
|
|
733
|
+
**Auto-compaction et skills :** Apres compaction, les skills se rechargent (5K tokens/skill, 25K total max).
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
700
737
|
## Ressources
|
|
701
738
|
|
|
702
|
-
- **Anthropic Best Practices:** [
|
|
739
|
+
- **Anthropic Best Practices:** [code.claude.com](https://code.claude.com/docs/en/overview)
|
|
703
740
|
- **Boris Cherny Workflow:** Parallel worktrees + verification loops
|
|
704
741
|
- **Claude Code Context Management:** Context compaction, `/clear`, sub-agents
|
|
705
742
|
- **`/init`:** Genere automatiquement un CLAUDE.md a partir de l'analyse du projet
|
|
@@ -697,9 +697,46 @@ Os arquivos sao fundidos em ordem alfabetica, permitindo que as equipes sobrepon
|
|
|
697
697
|
|
|
698
698
|
---
|
|
699
699
|
|
|
700
|
+
## Novos comandos (v2.1.105+)
|
|
701
|
+
|
|
702
|
+
| Comando | Descricao | Uso |
|
|
703
|
+
|---------|-----------|-----|
|
|
704
|
+
| `/btw` | Perguntas rapidas sem troca de contexto | Lookups, sintaxe, esclarecimentos |
|
|
705
|
+
| `/hooks` | Gestao interativa de hooks | Ativar/desativar, testar, depurar |
|
|
706
|
+
| `/reload-plugins` | Recarregamento manual de plugins | Apos atualizacao de plugins |
|
|
707
|
+
| `/proactive` | Alias para `/loop` | Monitoramento proativo recorrente |
|
|
708
|
+
|
|
709
|
+
---
|
|
710
|
+
|
|
711
|
+
## Variaveis de ambiente adicionais (v2.1.105+)
|
|
712
|
+
|
|
713
|
+
| Variavel | Descricao |
|
|
714
|
+
|----------|-----------|
|
|
715
|
+
| `CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1` | Carregar CLAUDE.md de `--add-dir` |
|
|
716
|
+
| `MAX_THINKING_TOKENS=8000` | Limite de tokens de reflexao |
|
|
717
|
+
| `SLASH_COMMAND_TOOL_CHAR_BUDGET` | Orcamento de caracteres para slash commands |
|
|
718
|
+
| `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` | PowerShell em vez de Bash (Windows, v2.1.84+) |
|
|
719
|
+
| `OTEL_LOG_USER_PROMPTS` | Log de prompts em traces (beta) |
|
|
720
|
+
| `OTEL_LOG_TOOL_DETAILS` | Log de detalhes de ferramentas (beta) |
|
|
721
|
+
| `OTEL_LOG_TOOL_CONTENT` | Log de conteudo de ferramentas (beta, verboso) |
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
## Skills avancados (v2.1.105+)
|
|
726
|
+
|
|
727
|
+
| Frontmatter | Descricao |
|
|
728
|
+
|-------------|-----------|
|
|
729
|
+
| `context: fork` | Execucao em contexto isolado (sem poluicao) |
|
|
730
|
+
| `disable-model-invocation: true` | Impede invocacao automatica pelo Claude |
|
|
731
|
+
| `claudeMdExcludes` (setting) | Excluir CLAUDE.md especificos em monorepos |
|
|
732
|
+
|
|
733
|
+
**Auto-compactacao e skills:** Apos compactacao, os skills recarregam automaticamente (5K tokens/skill, 25K total max).
|
|
734
|
+
|
|
735
|
+
---
|
|
736
|
+
|
|
700
737
|
## Recursos
|
|
701
738
|
|
|
702
|
-
- **Anthropic Best Practices:** [
|
|
739
|
+
- **Anthropic Best Practices:** [code.claude.com](https://code.claude.com/docs/en/overview)
|
|
703
740
|
- **Boris Cherny Workflow:** Worktrees paralelas + loops de verificacao
|
|
704
741
|
- **Claude Code Context Management:** Context compaction, `/clear`, sub-agentes
|
|
705
742
|
- **`/init`:** Gera automaticamente um CLAUDE.md a partir da analise do projeto
|
|
@@ -526,6 +526,75 @@ install_checklists() {
|
|
|
526
526
|
fi
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
+
install_config() {
|
|
530
|
+
log_info "${MSG_INSTALLING_CONFIG:-Installing configuration files...}"
|
|
531
|
+
|
|
532
|
+
local base_templates="$I18N_DIR/base/Common/templates"
|
|
533
|
+
local lang_templates="$I18N_DIR/$lang/Common/templates"
|
|
534
|
+
|
|
535
|
+
# Install .claudeignore (only if not exists — never overwrite user customizations)
|
|
536
|
+
local claudeignore_src="$base_templates/claudeignore.template"
|
|
537
|
+
local claudeignore_dest="$target_dir/.claudeignore"
|
|
538
|
+
if [[ -f "$claudeignore_src" && ! -f "$claudeignore_dest" ]]; then
|
|
539
|
+
if $dry_run; then
|
|
540
|
+
log_dry_run "${MSG_CREATING:-Creating} .claudeignore"
|
|
541
|
+
else
|
|
542
|
+
cp "$claudeignore_src" "$claudeignore_dest"
|
|
543
|
+
log_success "${MSG_CREATING:-Creating} .claudeignore"
|
|
544
|
+
fi
|
|
545
|
+
((++files_created))
|
|
546
|
+
fi
|
|
547
|
+
|
|
548
|
+
# Install settings.json (only if not exists OR --force)
|
|
549
|
+
local settings_src="$lang_templates/settings.json.template"
|
|
550
|
+
[[ ! -f "$settings_src" ]] && settings_src="$base_templates/settings.json.template"
|
|
551
|
+
local settings_dest="$target_dir/.claude/settings.json"
|
|
552
|
+
if [[ -f "$settings_src" ]]; then
|
|
553
|
+
if [[ ! -f "$settings_dest" ]] || $force; then
|
|
554
|
+
if $dry_run; then
|
|
555
|
+
log_dry_run "${MSG_CREATING:-Creating} .claude/settings.json"
|
|
556
|
+
else
|
|
557
|
+
mkdir -p "$(dirname "$settings_dest")"
|
|
558
|
+
cp "$settings_src" "$settings_dest"
|
|
559
|
+
log_success "${MSG_CREATING:-Creating} .claude/settings.json"
|
|
560
|
+
fi
|
|
561
|
+
((++files_created))
|
|
562
|
+
else
|
|
563
|
+
log_info "Skipped: .claude/settings.json (already exists, use --force to overwrite)"
|
|
564
|
+
((++files_skipped))
|
|
565
|
+
fi
|
|
566
|
+
fi
|
|
567
|
+
|
|
568
|
+
# Install settings.local.json (only if not exists — never overwrite)
|
|
569
|
+
local local_settings_src="$base_templates/settings.local.json.template"
|
|
570
|
+
local local_settings_dest="$target_dir/.claude/settings.local.json"
|
|
571
|
+
if [[ -f "$local_settings_src" && ! -f "$local_settings_dest" ]]; then
|
|
572
|
+
if $dry_run; then
|
|
573
|
+
log_dry_run "${MSG_CREATING:-Creating} .claude/settings.local.json"
|
|
574
|
+
else
|
|
575
|
+
mkdir -p "$(dirname "$local_settings_dest")"
|
|
576
|
+
cp "$local_settings_src" "$local_settings_dest"
|
|
577
|
+
log_success "${MSG_CREATING:-Creating} .claude/settings.local.json"
|
|
578
|
+
fi
|
|
579
|
+
((++files_created))
|
|
580
|
+
fi
|
|
581
|
+
|
|
582
|
+
# Install context-essentials.md (only if not exists)
|
|
583
|
+
local context_src="$lang_templates/context-essentials.md"
|
|
584
|
+
[[ ! -f "$context_src" ]] && context_src="$base_templates/context-essentials.md"
|
|
585
|
+
local context_dest="$target_dir/.claude/context-essentials.md"
|
|
586
|
+
if [[ -f "$context_src" && ! -f "$context_dest" ]]; then
|
|
587
|
+
if $dry_run; then
|
|
588
|
+
log_dry_run "${MSG_CREATING:-Creating} .claude/context-essentials.md"
|
|
589
|
+
else
|
|
590
|
+
mkdir -p "$(dirname "$context_dest")"
|
|
591
|
+
cp "$context_src" "$context_dest"
|
|
592
|
+
log_success "${MSG_CREATING:-Creating} .claude/context-essentials.md"
|
|
593
|
+
fi
|
|
594
|
+
((++files_created))
|
|
595
|
+
fi
|
|
596
|
+
}
|
|
597
|
+
|
|
529
598
|
install_claude_md() {
|
|
530
599
|
log_info "${MSG_INSTALLING_CLAUDE_MD:-Installing CLAUDE.md...}"
|
|
531
600
|
|
|
@@ -763,8 +832,9 @@ main() {
|
|
|
763
832
|
install_checklists
|
|
764
833
|
fi
|
|
765
834
|
|
|
766
|
-
# Always install CLAUDE.md template (if rules are installed)
|
|
835
|
+
# Always install config and CLAUDE.md template (if rules are installed)
|
|
767
836
|
if $rules_only; then
|
|
837
|
+
install_config
|
|
768
838
|
install_claude_md
|
|
769
839
|
fi
|
|
770
840
|
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
A comprehensive framework for AI-assisted development with [Claude Code](https://claude.ai/code). Install standardized rules, agents, and commands for your projects across multiple technology stacks.
|
|
8
8
|
|
|
9
|
-
## What's New in v7.
|
|
9
|
+
## What's New in v7.28
|
|
10
10
|
|
|
11
|
-
- **Claude Code v2.1.
|
|
11
|
+
- **Claude Code v2.1.107 compatibility** -- 45 new versions (v2.1.63-v2.1.107) fully documented
|
|
12
12
|
- **Auto Mode** -- AI-powered permission classifier replacing `--dangerously-skip-permissions`
|
|
13
13
|
- **New commands** -- /loop, /effort, /context, /powerup, /proactive, /team-onboarding
|
|
14
14
|
- **8 new hook events** -- PostCompact, StopFailure, TaskCreated, CwdChanged, FileChanged, PermissionDenied, Elicitation, ElicitationResult
|
|
@@ -631,6 +631,7 @@ show_usage() {
|
|
|
631
631
|
echo -e " ${C_BOLD}claude-accounts list${C_RESET} ${MSG_USAGE_LIST_DESC}"
|
|
632
632
|
echo -e " ${C_BOLD}claude-accounts auth <name>${C_RESET} ${MSG_USAGE_AUTH_DESC}"
|
|
633
633
|
echo -e " ${C_BOLD}claude-accounts run <name>${C_RESET} ${MSG_USAGE_RUN_DESC}"
|
|
634
|
+
echo -e " ${C_BOLD}claude-accounts sync${C_RESET} ${MSG_USAGE_SYNC_DESC:-Sync isolated profiles with ~/.claude}"
|
|
634
635
|
echo -e " ${C_BOLD}claude-accounts migrate${C_RESET} ${MSG_USAGE_MIGRATE_DESC}"
|
|
635
636
|
echo -e " ${C_BOLD}claude-accounts doctor${C_RESET} ${MSG_USAGE_DOCTOR_DESC:-Check profile health}"
|
|
636
637
|
echo -e " ${C_BOLD}claude-accounts --json list${C_RESET} ${MSG_USAGE_JSON_DESC:-JSON output for scripting}"
|
|
@@ -698,6 +699,82 @@ ccsp() {
|
|
|
698
699
|
echo -e " ${C_BOLD}ccsp pro${C_RESET} ${MSG_CC_PROFILE} 'pro'"
|
|
699
700
|
}
|
|
700
701
|
|
|
702
|
+
# =============================================================================
|
|
703
|
+
# Sync - Synchronize isolated profiles with ~/.claude
|
|
704
|
+
# =============================================================================
|
|
705
|
+
|
|
706
|
+
cmd_sync() {
|
|
707
|
+
echo -e "\n${C_BOLD}${MSG_SYNC_TITLE:-Sync isolated profiles with ~/.claude}${C_RESET}\n"
|
|
708
|
+
|
|
709
|
+
if [[ ! -d "$CLAUDE_PROFILES_DIR" ]] || [[ -z "$(ls -A "$CLAUDE_PROFILES_DIR" 2>/dev/null)" ]]; then
|
|
710
|
+
print_warning "${MSG_NO_PROFILE}"
|
|
711
|
+
return
|
|
712
|
+
fi
|
|
713
|
+
|
|
714
|
+
local synced=0
|
|
715
|
+
local skipped=0
|
|
716
|
+
|
|
717
|
+
for profile_dir in "$CLAUDE_PROFILES_DIR"/*/; do
|
|
718
|
+
[[ ! -d "$profile_dir" ]] && continue
|
|
719
|
+
local profile_name
|
|
720
|
+
profile_name=$(basename "$profile_dir")
|
|
721
|
+
local mode
|
|
722
|
+
mode=$(get_profile_mode "$profile_name")
|
|
723
|
+
|
|
724
|
+
if [[ "$mode" == "shared" ]]; then
|
|
725
|
+
print_info "$profile_name: ${MSG_SYNC_SHARED_SKIP:-shared mode, already synced via symlink}"
|
|
726
|
+
skipped=$((skipped + 1))
|
|
727
|
+
continue
|
|
728
|
+
fi
|
|
729
|
+
|
|
730
|
+
if [[ "$mode" == "isolated" ]]; then
|
|
731
|
+
print_info "${MSG_SYNC_SYNCING:-Syncing} $profile_name..."
|
|
732
|
+
|
|
733
|
+
# Sync hooks directory
|
|
734
|
+
if [[ -d "$HOME/.claude/hooks" ]]; then
|
|
735
|
+
mkdir -p "$profile_dir/hooks"
|
|
736
|
+
for hook_file in "$HOME/.claude/hooks"/*; do
|
|
737
|
+
[[ -e "$hook_file" ]] || continue
|
|
738
|
+
local hook_name
|
|
739
|
+
hook_name=$(basename "$hook_file")
|
|
740
|
+
cp "$hook_file" "$profile_dir/hooks/$hook_name"
|
|
741
|
+
done
|
|
742
|
+
print_success " hooks/ -> $profile_name/hooks/"
|
|
743
|
+
fi
|
|
744
|
+
|
|
745
|
+
# Sync settings.json (merge env block, preserve profile-specific settings)
|
|
746
|
+
if [[ -f "$HOME/.claude/settings.json" && -f "$profile_dir/settings.json" ]]; then
|
|
747
|
+
# Merge: take env and hooks from source, preserve profile permissions
|
|
748
|
+
if command -v jq &>/dev/null; then
|
|
749
|
+
local merged
|
|
750
|
+
merged=$(jq -s '.[0] * .[1] | .env = (.[0].env // {} ) * (.[1].env // {})' \
|
|
751
|
+
"$profile_dir/settings.json" "$HOME/.claude/settings.json" 2>/dev/null) || true
|
|
752
|
+
if [[ -n "$merged" ]]; then
|
|
753
|
+
echo "$merged" > "$profile_dir/settings.json"
|
|
754
|
+
print_success " settings.json merged"
|
|
755
|
+
fi
|
|
756
|
+
else
|
|
757
|
+
cp "$HOME/.claude/settings.json" "$profile_dir/settings.json"
|
|
758
|
+
print_success " settings.json copied"
|
|
759
|
+
fi
|
|
760
|
+
elif [[ -f "$HOME/.claude/settings.json" ]]; then
|
|
761
|
+
cp "$HOME/.claude/settings.json" "$profile_dir/settings.json"
|
|
762
|
+
print_success " settings.json copied"
|
|
763
|
+
fi
|
|
764
|
+
|
|
765
|
+
# Sync RTK.md
|
|
766
|
+
if [[ -f "$HOME/.claude/RTK.md" ]]; then
|
|
767
|
+
cp "$HOME/.claude/RTK.md" "$profile_dir/RTK.md"
|
|
768
|
+
fi
|
|
769
|
+
|
|
770
|
+
synced=$((synced + 1))
|
|
771
|
+
fi
|
|
772
|
+
done
|
|
773
|
+
|
|
774
|
+
echo ""
|
|
775
|
+
print_success "${MSG_SYNC_DONE:-Sync complete}: $synced ${MSG_SYNC_SYNCED:-synced}, $skipped ${MSG_SYNC_SKIPPED:-skipped (shared)}"
|
|
776
|
+
}
|
|
777
|
+
|
|
701
778
|
# =============================================================================
|
|
702
779
|
# Doctor - Profile health check
|
|
703
780
|
# =============================================================================
|
|
@@ -817,9 +894,10 @@ show_menu() {
|
|
|
817
894
|
echo -e " ${C_CYAN}4)${C_RESET} 🔐 ${MSG_MENU_AUTH}"
|
|
818
895
|
echo -e " ${C_CYAN}5)${C_RESET} 🚀 ${MSG_MENU_LAUNCH}"
|
|
819
896
|
echo -e " ${C_CYAN}6)${C_RESET} ⚡ ${MSG_MENU_CCSP_FUNC}"
|
|
820
|
-
echo -e " ${C_CYAN}7)${C_RESET}
|
|
821
|
-
echo -e " ${C_CYAN}8)${C_RESET}
|
|
822
|
-
echo -e " ${C_CYAN}9)${C_RESET}
|
|
897
|
+
echo -e " ${C_CYAN}7)${C_RESET} 🔁 ${MSG_MENU_SYNC:-Sync isolated profiles}"
|
|
898
|
+
echo -e " ${C_CYAN}8)${C_RESET} 🔄 ${MSG_MENU_MIGRATE}"
|
|
899
|
+
echo -e " ${C_CYAN}9)${C_RESET} 🩺 ${MSG_MENU_DOCTOR:-Profile health check}"
|
|
900
|
+
echo -e " ${C_CYAN}0)${C_RESET} 📖 ${MSG_MENU_HELP}"
|
|
823
901
|
echo -e " ${C_CYAN}q)${C_RESET} ${MSG_MENU_QUIT}"
|
|
824
902
|
echo ""
|
|
825
903
|
}
|
|
@@ -839,9 +917,10 @@ main_menu() {
|
|
|
839
917
|
4) authenticate_profile ;;
|
|
840
918
|
5) launch_profile ;;
|
|
841
919
|
6) install_ccsp_function ;;
|
|
842
|
-
7)
|
|
843
|
-
8)
|
|
844
|
-
9)
|
|
920
|
+
7) cmd_sync ;;
|
|
921
|
+
8) migrate_profile ;;
|
|
922
|
+
9) cmd_doctor ;;
|
|
923
|
+
0) show_usage ;;
|
|
845
924
|
q|Q) echo -e "\n${C_GREEN}${MSG_GOODBYE}${C_RESET}\n"; exit $EXIT_OK ;;
|
|
846
925
|
*) print_error "${MSG_INVALID_CHOICE}" ;;
|
|
847
926
|
esac
|
|
@@ -946,6 +1025,9 @@ cli_mode() {
|
|
|
946
1025
|
launch_profile
|
|
947
1026
|
fi
|
|
948
1027
|
;;
|
|
1028
|
+
sync|s)
|
|
1029
|
+
cmd_sync
|
|
1030
|
+
;;
|
|
949
1031
|
migrate|m)
|
|
950
1032
|
migrate_profile
|
|
951
1033
|
;;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# MultiAccount Sync Command — Tests
|
|
4
|
+
# =============================================================================
|
|
5
|
+
#
|
|
6
|
+
# Run with: docker run --rm -v "$(pwd)/Tools:/mnt" bats/bats:latest /mnt/MultiAccount/tests/sync.bats
|
|
7
|
+
# =============================================================================
|
|
8
|
+
|
|
9
|
+
SCRIPT="/mnt/MultiAccount/claude-accounts.sh"
|
|
10
|
+
|
|
11
|
+
setup() {
|
|
12
|
+
if ! command -v jq &>/dev/null; then
|
|
13
|
+
apk add --no-cache jq >/dev/null 2>&1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
export HOME="$(mktemp -d)"
|
|
17
|
+
export CLAUDE_PROFILES_DIR="$HOME/.claude-profiles"
|
|
18
|
+
mkdir -p "$HOME/.claude/hooks"
|
|
19
|
+
|
|
20
|
+
# Create source hooks and settings
|
|
21
|
+
cat > "$HOME/.claude/hooks/rtk-rewrite.sh" <<'EOF'
|
|
22
|
+
#!/bin/bash
|
|
23
|
+
REWRITTEN=$(rtk rewrite --ultra-compact "$CMD" 2>/dev/null)
|
|
24
|
+
EOF
|
|
25
|
+
chmod +x "$HOME/.claude/hooks/rtk-rewrite.sh"
|
|
26
|
+
|
|
27
|
+
cat > "$HOME/.claude/settings.json" <<'EOF'
|
|
28
|
+
{
|
|
29
|
+
"env": { "CLAUDE_CODE_SUBAGENT_MODEL": "claude-sonnet-4-5" },
|
|
30
|
+
"hooks": {}
|
|
31
|
+
}
|
|
32
|
+
EOF
|
|
33
|
+
|
|
34
|
+
echo "# RTK Meta Commands" > "$HOME/.claude/RTK.md"
|
|
35
|
+
|
|
36
|
+
# Create a fake claude binary
|
|
37
|
+
mkdir -p "$HOME/.local/bin"
|
|
38
|
+
echo '#!/bin/bash' > "$HOME/.local/bin/claude"
|
|
39
|
+
chmod +x "$HOME/.local/bin/claude"
|
|
40
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
teardown() {
|
|
44
|
+
rm -rf "$HOME"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Helper: create a profile
|
|
48
|
+
create_profile() {
|
|
49
|
+
local name="$1"
|
|
50
|
+
local mode="$2"
|
|
51
|
+
local profile_path="$CLAUDE_PROFILES_DIR/$name"
|
|
52
|
+
mkdir -p "$profile_path"
|
|
53
|
+
echo "$mode" > "$profile_path/.mode"
|
|
54
|
+
|
|
55
|
+
if [ "$mode" = "shared" ]; then
|
|
56
|
+
ln -sf "$HOME/.claude" "$profile_path/config"
|
|
57
|
+
elif [ "$mode" = "isolated" ]; then
|
|
58
|
+
mkdir -p "$profile_path/hooks"
|
|
59
|
+
echo '{"old": true}' > "$profile_path/settings.json"
|
|
60
|
+
fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# ============================================================
|
|
64
|
+
# SYNC COMMAND
|
|
65
|
+
# ============================================================
|
|
66
|
+
|
|
67
|
+
@test "sync skips shared profiles" {
|
|
68
|
+
create_profile "shared-profile" "shared"
|
|
69
|
+
|
|
70
|
+
# Source functions and run sync
|
|
71
|
+
run bash -c "
|
|
72
|
+
export HOME='$HOME'
|
|
73
|
+
export CLAUDE_PROFILES_DIR='$CLAUDE_PROFILES_DIR'
|
|
74
|
+
# Source minimal dependencies
|
|
75
|
+
C_BOLD='' C_RESET='' C_GREEN='' C_CYAN='' C_MAGENTA='' C_YELLOW='' C_RED=''
|
|
76
|
+
MSG_NO_PROFILE='No profiles'
|
|
77
|
+
|
|
78
|
+
get_profile_mode() {
|
|
79
|
+
cat \"\$CLAUDE_PROFILES_DIR/\$1/.mode\" 2>/dev/null || echo 'legacy'
|
|
80
|
+
}
|
|
81
|
+
print_info() { echo \"[INFO] \$1\"; }
|
|
82
|
+
print_success() { echo \"[OK] \$1\"; }
|
|
83
|
+
print_warning() { echo \"[WARN] \$1\"; }
|
|
84
|
+
|
|
85
|
+
# Inline cmd_sync
|
|
86
|
+
synced=0
|
|
87
|
+
skipped=0
|
|
88
|
+
for profile_dir in \"\$CLAUDE_PROFILES_DIR\"/*/; do
|
|
89
|
+
profile_name=\$(basename \"\$profile_dir\")
|
|
90
|
+
mode=\$(get_profile_mode \"\$profile_name\")
|
|
91
|
+
if [ \"\$mode\" = 'shared' ]; then
|
|
92
|
+
skipped=\$((skipped + 1))
|
|
93
|
+
fi
|
|
94
|
+
done
|
|
95
|
+
echo \"skipped=\$skipped\"
|
|
96
|
+
"
|
|
97
|
+
[ "$status" -eq 0 ]
|
|
98
|
+
[[ "$output" == *"skipped=1"* ]]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@test "sync copies hooks to isolated profiles" {
|
|
102
|
+
create_profile "isolated-profile" "isolated"
|
|
103
|
+
|
|
104
|
+
# Verify isolated profile initially does not have our hook
|
|
105
|
+
[ ! -f "$CLAUDE_PROFILES_DIR/isolated-profile/hooks/rtk-rewrite.sh" ]
|
|
106
|
+
|
|
107
|
+
# Perform sync (copy hooks)
|
|
108
|
+
for hook_file in "$HOME/.claude/hooks"/*; do
|
|
109
|
+
[ -e "$hook_file" ] || continue
|
|
110
|
+
cp "$hook_file" "$CLAUDE_PROFILES_DIR/isolated-profile/hooks/"
|
|
111
|
+
done
|
|
112
|
+
|
|
113
|
+
# Verify hook was synced
|
|
114
|
+
[ -f "$CLAUDE_PROFILES_DIR/isolated-profile/hooks/rtk-rewrite.sh" ]
|
|
115
|
+
grep -q -- '--ultra-compact' "$CLAUDE_PROFILES_DIR/isolated-profile/hooks/rtk-rewrite.sh"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@test "sync merges settings.json for isolated profiles" {
|
|
119
|
+
create_profile "isolated-profile" "isolated"
|
|
120
|
+
|
|
121
|
+
# Verify old settings exist
|
|
122
|
+
run jq -e '.old' "$CLAUDE_PROFILES_DIR/isolated-profile/settings.json"
|
|
123
|
+
[ "$status" -eq 0 ]
|
|
124
|
+
|
|
125
|
+
# Merge settings using jq (* operator does recursive deep merge of env too)
|
|
126
|
+
merged=$(jq -s '.[0] * .[1]' \
|
|
127
|
+
"$CLAUDE_PROFILES_DIR/isolated-profile/settings.json" \
|
|
128
|
+
"$HOME/.claude/settings.json" 2>/dev/null)
|
|
129
|
+
|
|
130
|
+
echo "$merged" > "$CLAUDE_PROFILES_DIR/isolated-profile/settings.json"
|
|
131
|
+
|
|
132
|
+
# Verify env was merged
|
|
133
|
+
run jq -e '.env.CLAUDE_CODE_SUBAGENT_MODEL' "$CLAUDE_PROFILES_DIR/isolated-profile/settings.json"
|
|
134
|
+
[ "$status" -eq 0 ]
|
|
135
|
+
[[ "$output" == *"claude-sonnet-4-5"* ]]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@test "sync copies RTK.md to isolated profiles" {
|
|
139
|
+
create_profile "isolated-profile" "isolated"
|
|
140
|
+
|
|
141
|
+
# Before sync
|
|
142
|
+
[ ! -f "$CLAUDE_PROFILES_DIR/isolated-profile/RTK.md" ]
|
|
143
|
+
|
|
144
|
+
# Copy RTK.md
|
|
145
|
+
cp "$HOME/.claude/RTK.md" "$CLAUDE_PROFILES_DIR/isolated-profile/RTK.md"
|
|
146
|
+
|
|
147
|
+
# After sync
|
|
148
|
+
[ -f "$CLAUDE_PROFILES_DIR/isolated-profile/RTK.md" ]
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@test "sync handles multiple profiles" {
|
|
152
|
+
create_profile "shared1" "shared"
|
|
153
|
+
create_profile "isolated1" "isolated"
|
|
154
|
+
create_profile "isolated2" "isolated"
|
|
155
|
+
|
|
156
|
+
local synced=0
|
|
157
|
+
local skipped=0
|
|
158
|
+
|
|
159
|
+
for profile_dir in "$CLAUDE_PROFILES_DIR"/*/; do
|
|
160
|
+
local profile_name
|
|
161
|
+
profile_name=$(basename "$profile_dir")
|
|
162
|
+
local mode
|
|
163
|
+
mode=$(cat "$profile_dir/.mode" 2>/dev/null || echo "legacy")
|
|
164
|
+
|
|
165
|
+
if [ "$mode" = "shared" ]; then
|
|
166
|
+
skipped=$((skipped + 1))
|
|
167
|
+
elif [ "$mode" = "isolated" ]; then
|
|
168
|
+
# Sync hooks
|
|
169
|
+
for hook_file in "$HOME/.claude/hooks"/*; do
|
|
170
|
+
[ -e "$hook_file" ] || continue
|
|
171
|
+
cp "$hook_file" "$profile_dir/hooks/"
|
|
172
|
+
done
|
|
173
|
+
synced=$((synced + 1))
|
|
174
|
+
fi
|
|
175
|
+
done
|
|
176
|
+
|
|
177
|
+
[ "$synced" -eq 2 ]
|
|
178
|
+
[ "$skipped" -eq 1 ]
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@test "sync handles empty profiles directory" {
|
|
182
|
+
mkdir -p "$CLAUDE_PROFILES_DIR"
|
|
183
|
+
|
|
184
|
+
# Count profiles
|
|
185
|
+
local count
|
|
186
|
+
count=$(find "$CLAUDE_PROFILES_DIR" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
|
|
187
|
+
[ "$count" -eq 0 ]
|
|
188
|
+
}
|
package/Tools/RTK/install-rtk.sh
CHANGED
|
@@ -176,6 +176,21 @@ configure_rtk_hooks() {
|
|
|
176
176
|
exit 1
|
|
177
177
|
fi
|
|
178
178
|
fi
|
|
179
|
+
|
|
180
|
+
# Enable --ultra-compact mode for maximum token savings (+5-10%)
|
|
181
|
+
if [[ -f "$HOOK_SCRIPT" ]] && ! grep -q -- '--ultra-compact' "$HOOK_SCRIPT"; then
|
|
182
|
+
sed -i 's/rtk rewrite "\$CMD"/rtk rewrite --ultra-compact "\$CMD"/' "$HOOK_SCRIPT" 2>/dev/null || true
|
|
183
|
+
# Update RTK integrity hash after patching
|
|
184
|
+
if command -v sha256sum &>/dev/null; then
|
|
185
|
+
local hash_file="$HOOKS_DIR/.rtk-hook.sha256"
|
|
186
|
+
if [[ -f "$hash_file" ]]; then
|
|
187
|
+
chmod 644 "$hash_file" 2>/dev/null || true
|
|
188
|
+
sha256sum "$HOOK_SCRIPT" > "$hash_file"
|
|
189
|
+
chmod 444 "$hash_file" 2>/dev/null || true
|
|
190
|
+
fi
|
|
191
|
+
fi
|
|
192
|
+
print_success "Enabled --ultra-compact mode for RTK hook"
|
|
193
|
+
fi
|
|
179
194
|
}
|
|
180
195
|
|
|
181
196
|
# ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env bats
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# RTK Ultra-Compact Patch — Tests
|
|
4
|
+
# =============================================================================
|
|
5
|
+
#
|
|
6
|
+
# Run with: docker run --rm -v "$(pwd)/Tools:/mnt" bats/bats:latest /mnt/RTK/tests/ultra-compact.bats
|
|
7
|
+
# =============================================================================
|
|
8
|
+
|
|
9
|
+
SCRIPT="/mnt/RTK/install-rtk.sh"
|
|
10
|
+
I18N_DIR="/mnt/i18n/rtk"
|
|
11
|
+
|
|
12
|
+
setup() {
|
|
13
|
+
if ! command -v jq &>/dev/null; then
|
|
14
|
+
apk add --no-cache jq >/dev/null 2>&1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
export HOME="$(mktemp -d)"
|
|
18
|
+
export CLAUDE_DIR="$HOME/.claude"
|
|
19
|
+
mkdir -p "$CLAUDE_DIR/hooks"
|
|
20
|
+
|
|
21
|
+
# Create a fake rtk binary
|
|
22
|
+
mkdir -p "$HOME/.local/bin"
|
|
23
|
+
cat > "$HOME/.local/bin/rtk" <<'EOF'
|
|
24
|
+
#!/bin/bash
|
|
25
|
+
case "$1" in
|
|
26
|
+
--version) echo "rtk 0.36.0" ;;
|
|
27
|
+
gain) echo "Saved 1.2M tokens (85%)" ;;
|
|
28
|
+
init)
|
|
29
|
+
mkdir -p ~/.claude/hooks
|
|
30
|
+
cat > ~/.claude/hooks/rtk-rewrite.sh <<'HOOK'
|
|
31
|
+
#!/bin/bash
|
|
32
|
+
INPUT=$(cat)
|
|
33
|
+
CMD=$(jq -r '.tool_input.command // empty' <<<"$INPUT")
|
|
34
|
+
if [ -z "$CMD" ]; then exit 0; fi
|
|
35
|
+
REWRITTEN=$(rtk rewrite "$CMD" 2>/dev/null)
|
|
36
|
+
EXIT_CODE=$?
|
|
37
|
+
echo "$REWRITTEN"
|
|
38
|
+
HOOK
|
|
39
|
+
chmod +x ~/.claude/hooks/rtk-rewrite.sh
|
|
40
|
+
# Create hash file
|
|
41
|
+
sha256sum ~/.claude/hooks/rtk-rewrite.sh > ~/.claude/hooks/.rtk-hook.sha256
|
|
42
|
+
chmod 444 ~/.claude/hooks/.rtk-hook.sha256
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
EOF
|
|
46
|
+
chmod +x "$HOME/.local/bin/rtk"
|
|
47
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
teardown() {
|
|
51
|
+
rm -rf "$HOME"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# ============================================================
|
|
55
|
+
# ULTRA-COMPACT PATCH
|
|
56
|
+
# ============================================================
|
|
57
|
+
|
|
58
|
+
@test "install-rtk.sh patches hook with --ultra-compact" {
|
|
59
|
+
# Run rtk init to create the hook
|
|
60
|
+
rtk init
|
|
61
|
+
|
|
62
|
+
# Verify hook exists without --ultra-compact
|
|
63
|
+
[ -f "$CLAUDE_DIR/hooks/rtk-rewrite.sh" ]
|
|
64
|
+
grep -q 'rtk rewrite "$CMD"' "$CLAUDE_DIR/hooks/rtk-rewrite.sh"
|
|
65
|
+
! grep -q -- '--ultra-compact' "$CLAUDE_DIR/hooks/rtk-rewrite.sh"
|
|
66
|
+
|
|
67
|
+
# Source the install script functions and run the patch
|
|
68
|
+
HOOKS_DIR="$CLAUDE_DIR/hooks"
|
|
69
|
+
HOOK_SCRIPT="$CLAUDE_DIR/hooks/rtk-rewrite.sh"
|
|
70
|
+
|
|
71
|
+
# Apply the sed patch (same logic as install-rtk.sh)
|
|
72
|
+
sed -i 's/rtk rewrite "\$CMD"/rtk rewrite --ultra-compact "\$CMD"/' "$HOOK_SCRIPT"
|
|
73
|
+
|
|
74
|
+
# Verify --ultra-compact is now present
|
|
75
|
+
grep -q -- '--ultra-compact' "$HOOK_SCRIPT"
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@test "ultra-compact patch is idempotent" {
|
|
79
|
+
# Create hook with --ultra-compact already present
|
|
80
|
+
cat > "$CLAUDE_DIR/hooks/rtk-rewrite.sh" <<'EOF'
|
|
81
|
+
#!/bin/bash
|
|
82
|
+
REWRITTEN=$(rtk rewrite --ultra-compact "$CMD" 2>/dev/null)
|
|
83
|
+
EOF
|
|
84
|
+
|
|
85
|
+
# Apply patch again (should not create double flag)
|
|
86
|
+
if ! grep -q -- '--ultra-compact' "$CLAUDE_DIR/hooks/rtk-rewrite.sh"; then
|
|
87
|
+
sed -i 's/rtk rewrite "\$CMD"/rtk rewrite --ultra-compact "\$CMD"/' "$CLAUDE_DIR/hooks/rtk-rewrite.sh"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Count occurrences of --ultra-compact
|
|
91
|
+
local count
|
|
92
|
+
count=$(grep -c -- '--ultra-compact' "$CLAUDE_DIR/hooks/rtk-rewrite.sh")
|
|
93
|
+
[ "$count" -eq 1 ]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@test "hash file is updated after patching" {
|
|
97
|
+
# Create hook
|
|
98
|
+
rtk init
|
|
99
|
+
local original_hash
|
|
100
|
+
original_hash=$(cat "$CLAUDE_DIR/hooks/.rtk-hook.sha256")
|
|
101
|
+
|
|
102
|
+
# Patch the hook
|
|
103
|
+
HOOK_SCRIPT="$CLAUDE_DIR/hooks/rtk-rewrite.sh"
|
|
104
|
+
HOOKS_DIR="$CLAUDE_DIR/hooks"
|
|
105
|
+
sed -i 's/rtk rewrite "\$CMD"/rtk rewrite --ultra-compact "\$CMD"/' "$HOOK_SCRIPT"
|
|
106
|
+
|
|
107
|
+
# Update hash
|
|
108
|
+
local hash_file="$HOOKS_DIR/.rtk-hook.sha256"
|
|
109
|
+
chmod 644 "$hash_file" 2>/dev/null || true
|
|
110
|
+
sha256sum "$HOOK_SCRIPT" > "$hash_file"
|
|
111
|
+
chmod 444 "$hash_file" 2>/dev/null || true
|
|
112
|
+
|
|
113
|
+
# Verify hash changed
|
|
114
|
+
local new_hash
|
|
115
|
+
new_hash=$(cat "$hash_file")
|
|
116
|
+
[ "$original_hash" != "$new_hash" ]
|
|
117
|
+
|
|
118
|
+
# Verify hash matches actual file
|
|
119
|
+
run sha256sum -c "$hash_file"
|
|
120
|
+
[ "$status" -eq 0 ]
|
|
121
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the-bearded-bear/claude-craft",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0-next.7fa5c27",
|
|
4
4
|
"description": "A comprehensive framework for AI-assisted development with Claude Code. Install standardized rules, agents, and commands for your projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cli/index.js",
|