claude-all-config 2.0.0

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 (167) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.md +70 -0
  3. package/README.md +133 -0
  4. package/VERSION +1 -0
  5. package/agents/accessibility-reviewer.md +96 -0
  6. package/agents/ai-prompt-optimizer.md +94 -0
  7. package/agents/api-tester.md +102 -0
  8. package/agents/code-generator.md +94 -0
  9. package/agents/code-reviewer.md +47 -0
  10. package/agents/component-generator.md +102 -0
  11. package/agents/doc-generator.md +91 -0
  12. package/agents/migration-generator.md +94 -0
  13. package/agents/performance-analyzer.md +90 -0
  14. package/agents/proactive-mode.md +91 -0
  15. package/agents/readme-generator.md +101 -0
  16. package/agents/security-auditor.md +86 -0
  17. package/agents/terraform-generator.md +94 -0
  18. package/agents/test-generator.md +76 -0
  19. package/bin/agentrouter.json +36 -0
  20. package/bin/ai-chat +20 -0
  21. package/bin/antigravity.json +76 -0
  22. package/bin/api-manager +340 -0
  23. package/bin/claude-launcher +19 -0
  24. package/bin/claude-master +15 -0
  25. package/bin/claude_master.py +295 -0
  26. package/bin/cohere.json +7 -0
  27. package/bin/deepseek.json +44 -0
  28. package/bin/gemini.json +56 -0
  29. package/bin/glm.json +21 -0
  30. package/bin/groq.json +41 -0
  31. package/bin/minimax.json +26 -0
  32. package/bin/mistral.json +7 -0
  33. package/bin/moonshot.json +7 -0
  34. package/bin/ollama.json +36 -0
  35. package/bin/openai.json +46 -0
  36. package/bin/openrouter.json +38 -0
  37. package/bin/perplexity.json +12 -0
  38. package/bin/qwen.json +7 -0
  39. package/bin/switch-provider +73 -0
  40. package/bin/test.json +7 -0
  41. package/bin/xai.json +41 -0
  42. package/claude-all +2707 -0
  43. package/claude-config.json +340 -0
  44. package/claude-suite/REFACTORING_SUMMARY.md +88 -0
  45. package/claude-suite/auth/.antigravity_proxy.py +78 -0
  46. package/claude-suite/auth/__pycache__/openai_auth.cpython-312.pyc +0 -0
  47. package/claude-suite/auth/gemini_auth.py +80 -0
  48. package/claude-suite/auth/openai_auth.py +138 -0
  49. package/claude-suite/backups/claude-all-before-refactor +1075 -0
  50. package/claude-suite/backups/claude-all.backup +840 -0
  51. package/claude-suite/backups/claude-all.original +840 -0
  52. package/claude-suite/models/add-model-manual.sh +588 -0
  53. package/claude-suite/models/add-model.sh +114 -0
  54. package/claude-suite/models/model-switcher.sh +69 -0
  55. package/claude-suite/providers/claude-glm +89 -0
  56. package/claude-suite/providers/claude-glm-wrapper.sh +55 -0
  57. package/claude-suite/providers/claude-minimax +12 -0
  58. package/claude-suite/providers/claude-smart +132 -0
  59. package/claude-suite/providers/xai_chat.sh +56 -0
  60. package/claude-suite/utils/__pycache__/claude_master.cpython-312.pyc +0 -0
  61. package/claude-suite/utils/antigravity_proxy_server.py +168 -0
  62. package/claude-suite/utils/claude-all-help.txt +83 -0
  63. package/claude-suite/utils/claude_master.py +408 -0
  64. package/commands/brainstorm.md +5 -0
  65. package/commands/execute-plan.md +5 -0
  66. package/commands/write-plan.md +5 -0
  67. package/docs/ANTIGRAVITY-SETUP.md +176 -0
  68. package/docs/AUTH_CREDENTIALS.md +54 -0
  69. package/docs/NPM-INSTALLATION.md +166 -0
  70. package/hooks/hooks.json +15 -0
  71. package/hooks/run-hook.cmd +19 -0
  72. package/hooks/session-start.sh +52 -0
  73. package/install.sh +155 -0
  74. package/mcp.json +34 -0
  75. package/model/perplexity.json +12 -0
  76. package/package.json +69 -0
  77. package/plugins/README.md +47 -0
  78. package/plugins/installed_plugins.json +317 -0
  79. package/plugins/known_marketplaces.json +10 -0
  80. package/plugins/marketplace-info/marketplace.json +517 -0
  81. package/postinstall.js +100 -0
  82. package/scripts/antigravity_proxy_server.py +168 -0
  83. package/scripts/get_gemini_api_key.py +96 -0
  84. package/scripts/setup_antigravity_auth.py +171 -0
  85. package/skills/api-development/SKILL.md +11 -0
  86. package/skills/api-development/openapi/api-documentation.yaml +108 -0
  87. package/skills/brainstorming/SKILL.md +54 -0
  88. package/skills/code-quality/SKILL.md +196 -0
  89. package/skills/condition-based-waiting/SKILL.md +120 -0
  90. package/skills/condition-based-waiting/example.ts +158 -0
  91. package/skills/database-development/SKILL.md +11 -0
  92. package/skills/database-development/migrations/migration.template.sql +49 -0
  93. package/skills/defense-in-depth/SKILL.md +127 -0
  94. package/skills/deployment/SKILL.md +11 -0
  95. package/skills/deployment/ci-cd/github-actions.yml +95 -0
  96. package/skills/deployment/docker/Dockerfile.template +39 -0
  97. package/skills/dispatching-parallel-agents/SKILL.md +180 -0
  98. package/skills/documentation-generation/SKILL.md +8 -0
  99. package/skills/documentation-generation/templates/README.template.md +60 -0
  100. package/skills/error-handling/SKILL.md +267 -0
  101. package/skills/executing-plans/SKILL.md +76 -0
  102. package/skills/finishing-a-development-branch/SKILL.md +200 -0
  103. package/skills/frontend-design/frontend-design/SKILL.md +42 -0
  104. package/skills/integration-testing/SKILL.md +13 -0
  105. package/skills/integration-testing/examples/contract-test.py +317 -0
  106. package/skills/integration-testing/examples/e2e-test.js +147 -0
  107. package/skills/integration-testing/examples/test-isolation.md +94 -0
  108. package/skills/logging-monitoring/SKILL.md +66 -0
  109. package/skills/mobile-development/SKILL.md +11 -0
  110. package/skills/mobile-development/responsive/responsive.css +80 -0
  111. package/skills/performance-optimization/SKILL.md +9 -0
  112. package/skills/performance-optimization/profiling/profile.template.js +21 -0
  113. package/skills/receiving-code-review/SKILL.md +209 -0
  114. package/skills/refactoring/SKILL.md +11 -0
  115. package/skills/refactoring/code-smells/common-smells.md +115 -0
  116. package/skills/requesting-code-review/SKILL.md +105 -0
  117. package/skills/requesting-code-review/code-reviewer.md +146 -0
  118. package/skills/root-cause-tracing/SKILL.md +174 -0
  119. package/skills/root-cause-tracing/find-polluter.sh +63 -0
  120. package/skills/security-review/SKILL.md +11 -0
  121. package/skills/security-review/checklists/owasp-checklist.md +31 -0
  122. package/skills/sharing-skills/SKILL.md +194 -0
  123. package/skills/subagent-driven-development/SKILL.md +240 -0
  124. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
  125. package/skills/subagent-driven-development/implementer-prompt.md +78 -0
  126. package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  127. package/skills/systematic-debugging/CREATION-LOG.md +119 -0
  128. package/skills/systematic-debugging/SKILL.md +295 -0
  129. package/skills/systematic-debugging/test-academic.md +14 -0
  130. package/skills/systematic-debugging/test-pressure-1.md +58 -0
  131. package/skills/systematic-debugging/test-pressure-2.md +68 -0
  132. package/skills/systematic-debugging/test-pressure-3.md +69 -0
  133. package/skills/test-driven-development/SKILL.md +364 -0
  134. package/skills/testing-anti-patterns/SKILL.md +302 -0
  135. package/skills/testing-skills-with-subagents/SKILL.md +387 -0
  136. package/skills/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +189 -0
  137. package/skills/ui-ux-review/SKILL.md +13 -0
  138. package/skills/ui-ux-review/checklists/ux-heuristics.md +61 -0
  139. package/skills/using-git-worktrees/SKILL.md +213 -0
  140. package/skills/using-superpowers/SKILL.md +101 -0
  141. package/skills/verification-before-completion/SKILL.md +139 -0
  142. package/skills/writing-plans/SKILL.md +116 -0
  143. package/skills/writing-skills/SKILL.md +622 -0
  144. package/skills/writing-skills/anthropic-best-practices.md +1150 -0
  145. package/skills/writing-skills/graphviz-conventions.dot +172 -0
  146. package/skills/writing-skills/persuasion-principles.md +187 -0
  147. package/update.sh +36 -0
  148. package/utils/check-superpowers.sh +114 -0
  149. package/utils/claude-branding.md +166 -0
  150. package/utils/config.js +185 -0
  151. package/utils/custom-claude-config.sh +89 -0
  152. package/utils/custom-claude-hooks.md +129 -0
  153. package/utils/custom-claude-lib.js +222 -0
  154. package/utils/customize-claude-ui.sh +162 -0
  155. package/utils/fix-claude-integration.sh +133 -0
  156. package/utils/help.js +125 -0
  157. package/utils/install-curl.ps1 +135 -0
  158. package/utils/install-curl.sh +525 -0
  159. package/utils/install-superpowers.js +411 -0
  160. package/utils/install.js +298 -0
  161. package/utils/install.sh +182 -0
  162. package/utils/postinstall.js +63 -0
  163. package/utils/rename-claude.sh +96 -0
  164. package/utils/uninstall-superpowers.js +273 -0
  165. package/utils/uninstall.ps1 +136 -0
  166. package/utils/uninstall.sh +163 -0
  167. package/utils/update.sh +160 -0
@@ -0,0 +1,588 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Add Model Manual - Tambah Model Baru ke Claude-All
4
+ # Cara manual tanpa bantuan AI
5
+
6
+ set -e
7
+
8
+ # Ensure tput is available for colors
9
+ if ! command -v tput &> /dev/null; then
10
+ # Try to install ncurses-utils (Termux)
11
+ if command -v pkg &> /dev/null && [[ "$PLATFORM" != "Windows" ]]; then
12
+ echo -e "${YELLOW}Installing ncurses-utils for color support...${NC}" >&2
13
+ pkg install -y ncurses-utils &>/dev/null || true
14
+ fi
15
+ fi
16
+
17
+ # Colors with terminal detection
18
+ if [[ -t 1 ]] && command -v tput &> /dev/null; then
19
+ # Use tput for better compatibility
20
+ GREEN=$(tput setaf 2 2>/dev/null || echo "")
21
+ BLUE=$(tput setaf 4 2>/dev/null || echo "")
22
+ YELLOW=$(tput setaf 3 2>/dev/null || echo "")
23
+ RED=$(tput setaf 1 2>/dev/null || echo "")
24
+ CYAN=$(tput setaf 6 2>/dev/null || echo "")
25
+ BOLD=$(tput bold 2>/dev/null || echo "")
26
+ NC=$(tput sgr0 2>/dev/null || echo "")
27
+ else
28
+ # No color support
29
+ GREEN=''
30
+ BLUE=''
31
+ YELLOW=''
32
+ RED=''
33
+ CYAN=''
34
+ BOLD=''
35
+ NC=''
36
+ fi
37
+
38
+ # Configuration
39
+ # Detect platform and set temp directory
40
+ if [[ "$(uname -s)" == "CYGWIN"* ]] || [[ "$(uname -s)" == "MINGW"* ]] || [[ "$(uname -s)" == "MSYS"* ]]; then
41
+ PLATFORM="Windows"
42
+ TEMP_FILE="$TEMP/claude-model.json"
43
+ elif [[ "$(uname -o)" == "Android" ]]; then
44
+ # Termux - use HOME directory for temp
45
+ PLATFORM="Termux"
46
+ TEMP_FILE="$HOME/.local/tmp/claude-model.json"
47
+ mkdir -p "$(dirname "$TEMP_FILE")"
48
+ else
49
+ PLATFORM="Unix"
50
+ # Check if /tmp is writable
51
+ if [[ -w "/tmp" ]]; then
52
+ TEMP_FILE="/tmp/claude-model.json"
53
+ else
54
+ # Fallback to HOME
55
+ TEMP_FILE="$HOME/.local/tmp/claude-model.json"
56
+ mkdir -p "$(dirname "$TEMP_FILE")"
57
+ fi
58
+ fi
59
+
60
+ # Get script directory
61
+ if command -v realpath &> /dev/null; then
62
+ SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
63
+ else
64
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
65
+ fi
66
+
67
+ MODEL_DIR="$SCRIPT_DIR/model"
68
+
69
+ # Preset templates for common providers
70
+ declare -A PRESET_TEMPLATES
71
+ PRESET_TEMPLATES["perplexity"]='{
72
+ "provider_name": "Perplexity AI",
73
+ "description": "Search-powered AI",
74
+ "api_base": "https://api.perplexity.ai/",
75
+ "model": "llama-3.1-sonar-small-128k-online",
76
+ "api_key": "pplx-xxxxxxxx",
77
+ "docs": "https://docs.perplexity.ai/api-reference/chat-completions"
78
+ }'
79
+
80
+ PRESET_TEMPLATES["mistral"]='{
81
+ "provider_name": "Mistral AI",
82
+ "description": "European AI models",
83
+ "api_base": "https://api.mistral.ai/v1/",
84
+ "model": "mistral-large-latest",
85
+ "api_key": "xxxxxxxx",
86
+ "docs": "https://docs.mistral.ai/api/"
87
+ }'
88
+
89
+ PRESET_TEMPLATES["cohere"]='{
90
+ "provider_name": "Cohere",
91
+ "description": "Enterprise AI models",
92
+ "api_base": "https://api.cohere.ai/v1/",
93
+ "model": "command-r-plus",
94
+ "api_key": "xxxxxxxx",
95
+ "docs": "https://docs.cohere.com/reference/chat"
96
+ }'
97
+
98
+ PRESET_TEMPLATES["anthropic"]='{
99
+ "provider_name": "Anthropic",
100
+ "description": "Claude API Direct",
101
+ "api_base": "https://api.anthropic.com/v1/messages",
102
+ "model": "claude-3-5-sonnet-20241022",
103
+ "api_key": "sk-ant-api03-xxxxxxxx",
104
+ "docs": "https://docs.anthropic.com/en/api/messages"
105
+ }'
106
+
107
+ PRESET_TEMPLATES["azure-openai"]='{
108
+ "provider_name": "Azure OpenAI",
109
+ "description": "Microsoft Azure OpenAI",
110
+ "api_base": "https://your-resource.openai.azure.com/",
111
+ "model": "gpt-4",
112
+ "api_key": "xxxxxxxx",
113
+ "api_version": "2024-02-15-preview",
114
+ "docs": "https://learn.microsoft.com/en-us/azure/ai-services/openai/reference"
115
+ }'
116
+
117
+ PRESET_TEMPLATES["together"]='{
118
+ "provider_name": "Together AI",
119
+ "description": "Open Source Models",
120
+ "api_base": "https://api.together.xyz/v1/",
121
+ "model": "meta-llama/Llama-3.1-8B-Instruct-Turbo",
122
+ "api_key": "xxxxxxxx",
123
+ "docs": "https://docs.together.ai/reference/chat-completions"
124
+ }'
125
+
126
+ PRESET_TEMPLATES["fireworks"]='{
127
+ "provider_name": "Fireworks AI",
128
+ "description": "Fast Inference",
129
+ "api_base": "https://api.fireworks.ai/v1/",
130
+ "model": "accounts/fireworks/models/llama-v3p1-8b-instruct",
131
+ "api_key": "xxxxxxxx",
132
+ "docs": "https://readme.fireworks.ai/docs/chat-completions"
133
+ }'
134
+
135
+ # Functions
136
+ clear_screen() {
137
+ clear
138
+ }
139
+
140
+ show_header() {
141
+ clear_screen
142
+ printf "%s=========================================%s\n" "${BOLD}${GREEN}" "${NC}"
143
+ printf "%s Add Model Manual ke Claude-All %s\n" "${BOLD}${GREEN}" "${NC}"
144
+ printf "%s=========================================%s\n" "${BOLD}${GREEN}" "${NC}"
145
+ echo ""
146
+ }
147
+
148
+ show_menu() {
149
+ echo -e "${BOLD}${BLUE}Pilih Cara Tambah Model:${NC}"
150
+ echo ""
151
+ printf "1) %sPake Template Siap Pakai%s (perplexity, mistral, dll)\n" "$YELLOW" "$NC"
152
+ printf "2) %sBuat Manual Dari Awal%s (custom provider)\n" "$YELLOW" "$NC"
153
+ printf "3) %sEdit Model Yang Ada%s\n" "$YELLOW" "$NC"
154
+ printf "4) %sList Semua Model%s\n" "$YELLOW" "$NC"
155
+ printf "5) %sHapus Model%s\n" "$YELLOW" "$NC"
156
+ printf "6) %sBackup Model Config%s\n" "$YELLOW" "$NC"
157
+ printf "0) %sKeluar%s\n" "$RED" "$NC"
158
+ echo ""
159
+ }
160
+
161
+ show_template_menu() {
162
+ echo -e "${BOLD}${BLUE}Pilih Provider Template:${NC}"
163
+ echo ""
164
+ echo "1) Perplexity AI (Search AI)"
165
+ echo "2) Mistral AI (European AI)"
166
+ echo "3) Cohere (Enterprise AI)"
167
+ echo "4) Anthropic (Claude Direct)"
168
+ echo "5) Azure OpenAI (Microsoft)"
169
+ echo "6) Together AI (Open Source)"
170
+ echo "7) Fireworks AI (Fast AI)"
171
+ echo "8) Lihat semua template"
172
+ echo "0) Kembali"
173
+ echo ""
174
+ }
175
+
176
+ list_models() {
177
+ clear_screen
178
+ echo -e "${BOLD}${BLUE}Daftar Model Claude-All:${NC}"
179
+ echo ""
180
+
181
+ echo -e "${YELLOW}Model Bawaan:${NC}"
182
+ echo "1) MiniMax (Direct Anthropic)"
183
+ echo "2) Google Gemini (API Key)"
184
+ echo "3) Google Gemini (OAuth)"
185
+ echo "4) OpenAI (API Key)"
186
+ echo "5) OpenAI (OAuth)"
187
+ echo "6) xAI / Grok"
188
+ echo "7) ZhipuAI / GLM"
189
+ echo "8) Groq"
190
+ echo "9) Ollama (Local)"
191
+ echo ""
192
+
193
+ echo -e "${YELLOW}Model Custom:${NC}"
194
+ local count=10
195
+ local found_custom=false
196
+
197
+ for json_file in "$MODEL_DIR"/*.json; do
198
+ if [[ -f "$json_file" ]]; then
199
+ local filename=$(basename "$json_file" .json)
200
+
201
+ # Skip default models
202
+ case "$filename" in
203
+ "glm"|"groq"|"minimax"|"openai"|"gemini"|"xai"|"ollama")
204
+ continue
205
+ ;;
206
+ esac
207
+
208
+ found_custom=true
209
+
210
+ # Parse JSON if jq available
211
+ if command -v jq &> /dev/null; then
212
+ local provider=$(jq -r '.provider_name // "Unknown"' "$json_file" 2>/dev/null)
213
+ local description=$(jq -r '.description // ""' "$json_file" 2>/dev/null)
214
+ local model=$(jq -r '.model // ""' "$json_file" 2>/dev/null)
215
+
216
+ echo "$count) $provider"
217
+ [[ -n "$description" ]] && echo " Deskripsi: $description"
218
+ [[ -n "$model" ]] && echo " Model: $model"
219
+ else
220
+ echo "$count) $filename"
221
+ fi
222
+ echo ""
223
+ ((count++))
224
+ fi
225
+ done
226
+
227
+ if [[ "$found_custom" == false ]]; then
228
+ echo -e "${RED}Belum ada model custom${NC}"
229
+ echo ""
230
+ fi
231
+
232
+ echo -e "${CYAN}Total: $(($count - 10)) model custom${NC}"
233
+ echo ""
234
+ read -p "Press Enter to continue..."
235
+ }
236
+
237
+ create_from_template() {
238
+ while true; do
239
+ show_template_menu
240
+ read -p "Pilihan [0-8]: " choice
241
+
242
+ case $choice in
243
+ 1) template_key="perplexity"; break ;;
244
+ 2) template_key="mistral"; break ;;
245
+ 3) template_key="cohere"; break ;;
246
+ 4) template_key="anthropic"; break ;;
247
+ 5) template_key="azure-openai"; break ;;
248
+ 6) template_key="together"; break ;;
249
+ 7) template_key="fireworks"; break ;;
250
+ 8)
251
+ clear_screen
252
+ echo -e "${BOLD}${BLUE}Semua Template:${NC}"
253
+ echo ""
254
+ for key in "${!PRESET_TEMPLATES[@]}"; do
255
+ echo -e "${YELLOW}$key:${NC}"
256
+ if command -v jq &> /dev/null; then
257
+ echo "${PRESET_TEMPLATES[$key]}" | jq . 2>/dev/null || echo "${PRESET_TEMPLATES[$key]}"
258
+ else
259
+ echo "${PRESET_TEMPLATES[$key]}"
260
+ fi
261
+ echo ""
262
+ done
263
+ read -p "Press Enter to continue..."
264
+ continue
265
+ ;;
266
+ 0) return ;;
267
+ *)
268
+ echo -e "${RED}Pilihan tidak valid!${NC}"
269
+ sleep 1
270
+ continue
271
+ ;;
272
+ esac
273
+ done
274
+
275
+ # Get template
276
+ local template_json="${PRESET_TEMPLATES[$template_key]}"
277
+
278
+ # Parse provider name for filename
279
+ local provider_name
280
+ if command -v jq &> /dev/null; then
281
+ provider_name=$(echo "$template_json" | jq -r '.provider_name' 2>/dev/null)
282
+ else
283
+ provider_name=$template_key
284
+ fi
285
+
286
+ # Create filename
287
+ local filename=$(echo "$provider_name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g')
288
+ local json_file="$MODEL_DIR/${filename}.json"
289
+
290
+ clear_screen
291
+ echo -e "${BOLD}${BLUE}Edit Template: $provider_name${NC}"
292
+ echo ""
293
+ echo -e "${YELLOW}File: $json_file${NC}"
294
+ echo ""
295
+ echo -e "${CYAN}Tips: Edit nilai yang diperlukan, lalu save (Ctrl+O) dan exit (Ctrl+X)${NC}"
296
+ echo ""
297
+
298
+ # Create temp file with template
299
+ echo "$template_json" > "$TEMP_FILE"
300
+
301
+ # Open in nano
302
+ if command -v nano &> /dev/null; then
303
+ nano "$TEMP_FILE"
304
+ elif command -v vim &> /dev/null; then
305
+ vim "$TEMP_FILE"
306
+ else
307
+ echo -e "${RED}Error: No text editor found${NC}"
308
+ echo "Install nano: pkg install nano"
309
+ rm -f "$TEMP_FILE"
310
+ return
311
+ fi
312
+
313
+ # Validate JSON
314
+ if command -v jq &> /dev/null; then
315
+ if ! jq . "$TEMP_FILE" > /dev/null 2>&1; then
316
+ echo -e "${RED}Error: JSON tidak valid!${NC}"
317
+ read -p "Coba lagi? [y/N]: " retry
318
+ if [[ "$retry" =~ ^[Yy]$ ]]; then
319
+ create_from_template
320
+ return
321
+ fi
322
+ rm -f "$TEMP_FILE"
323
+ return
324
+ fi
325
+
326
+ # Format JSON
327
+ jq . "$TEMP_FILE" > "$TEMP_FILE.formatted" && mv "$TEMP_FILE.formatted" "$TEMP_FILE"
328
+ fi
329
+
330
+ # Save to model directory
331
+ cp "$TEMP_FILE" "$json_file"
332
+ rm -f "$TEMP_FILE"
333
+
334
+ echo ""
335
+ echo -e "${GREEN}✅ Model berhasil ditambahkan!${NC}"
336
+ echo -e "${YELLOW}File: $json_file${NC}"
337
+ echo ""
338
+ read -p "Press Enter to continue..."
339
+ }
340
+
341
+ create_manual() {
342
+ clear_screen
343
+ echo -e "${BOLD}${BLUE}Buat Model Manual${NC}"
344
+ echo ""
345
+ echo -e "${CYAN}Ikuti format JSON berikut:${NC}"
346
+ echo ""
347
+ echo "{"
348
+ echo ' "provider_name": "Nama Provider",'
349
+ echo ' "description": "Deskripsi singkat",'
350
+ echo ' "api_base": "https://api.example.com/",'
351
+ echo ' "model": "model-name",'
352
+ echo ' "api_key": "your-api-key"'
353
+ echo "}"
354
+ echo ""
355
+ echo -e "${YELLOW}Field opsional (tambahkan jika perlu):${NC}"
356
+ echo '"api_version": "v1",'
357
+ echo '"headers": {"Custom-Header": "value"},'
358
+ echo '"docs": "https://docs.example.com"'
359
+ echo ""
360
+
361
+ read -p "Masukkan nama provider (tanpa spasi): " provider_raw
362
+ local filename=$(echo "$provider_raw" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g')
363
+ local json_file="$MODEL_DIR/${filename}.json"
364
+
365
+ echo ""
366
+ echo -e "${YELLOW}Membuat file: $json_file${NC}"
367
+ echo ""
368
+
369
+ # Create basic template
370
+ cat > "$TEMP_FILE" <<EOF
371
+ {
372
+ "provider_name": "$provider_raw",
373
+ "description": "Custom AI Provider",
374
+ "api_base": "https://api.example.com/",
375
+ "model": "default-model",
376
+ "api_key": "your-api-key-here"
377
+ }
378
+ EOF
379
+
380
+ # Open editor
381
+ if command -v nano &> /dev/null; then
382
+ nano "$TEMP_FILE"
383
+ elif command -v vim &> /dev/null; then
384
+ vim "$TEMP_FILE"
385
+ else
386
+ echo -e "${RED}Error: Tidak ada editor${NC}"
387
+ rm -f "$TEMP_FILE"
388
+ return
389
+ fi
390
+
391
+ # Save
392
+ mv "$TEMP_FILE" "$json_file"
393
+
394
+ echo ""
395
+ echo -e "${GREEN}✅ Model manual berhasil dibuat!${NC}"
396
+ read -p "Press Enter to continue..."
397
+ }
398
+
399
+ edit_model() {
400
+ clear_screen
401
+ echo -e "${BOLD}${BLUE}Edit Model${NC}"
402
+ echo ""
403
+
404
+ # List models with numbers
405
+ local count=1
406
+ local models=()
407
+
408
+ for json_file in "$MODEL_DIR"/*.json; do
409
+ if [[ -f "$json_file" ]]; then
410
+ local filename=$(basename "$json_file" .json)
411
+
412
+ # Skip defaults
413
+ case "$filename" in
414
+ "glm"|"groq"|"minimax"|"openai"|"gemini"|"xai"|"ollama")
415
+ continue
416
+ ;;
417
+ esac
418
+
419
+ models+=("$json_file")
420
+
421
+ if command -v jq &> /dev/null; then
422
+ local provider=$(jq -r '.provider_name // "Unknown"' "$json_file" 2>/dev/null)
423
+ echo "$count) $provider ($filename)"
424
+ else
425
+ echo "$count) $filename"
426
+ fi
427
+ ((count++))
428
+ fi
429
+ done
430
+
431
+ if [[ ${#models[@]} -eq 0 ]]; then
432
+ echo -e "${RED}Tidak ada model custom untuk diedit${NC}"
433
+ read -p "Press Enter to continue..."
434
+ return
435
+ fi
436
+
437
+ echo ""
438
+ read -p "Pilih model [1-$((${#models[@]}))]: " choice
439
+
440
+ if [[ "$choice" =~ ^[0-9]+$ ]] && [[ $choice -ge 1 ]] && [[ $choice -le ${#models[@]} ]]; then
441
+ local selected_file="${models[$((choice-1))]}"
442
+
443
+ # Backup original
444
+ cp "$selected_file" "$selected_file.backup"
445
+
446
+ # Open editor
447
+ if command -v nano &> /dev/null; then
448
+ nano "$selected_file"
449
+ elif command -v vim &> /dev/null; then
450
+ vim "$selected_file"
451
+ fi
452
+
453
+ echo ""
454
+ echo -e "${GREEN}✅ Model updated!${NC}"
455
+ echo -e "${YELLOW}Backup: $selected_file.backup${NC}"
456
+ else
457
+ echo -e "${RED}Pilihan tidak valid!${NC}"
458
+ fi
459
+
460
+ read -p "Press Enter to continue..."
461
+ }
462
+
463
+ delete_model() {
464
+ clear_screen
465
+ echo -e "${BOLD}${RED}Hapus Model${NC}"
466
+ echo ""
467
+
468
+ # List models
469
+ local count=1
470
+ local models=()
471
+
472
+ for json_file in "$MODEL_DIR"/*.json; do
473
+ if [[ -f "$json_file" ]]; then
474
+ local filename=$(basename "$json_file" .json)
475
+
476
+ # Skip defaults
477
+ case "$filename" in
478
+ "glm"|"groq"|"minimax"|"openai"|"gemini"|"xai"|"ollama")
479
+ continue
480
+ ;;
481
+ esac
482
+
483
+ models+=("$json_file")
484
+
485
+ if command -v jq &> /dev/null; then
486
+ local provider=$(jq -r '.provider_name // "Unknown"' "$json_file" 2>/dev/null)
487
+ echo "$count) $provider ($filename)"
488
+ else
489
+ echo "$count) $filename"
490
+ fi
491
+ ((count++))
492
+ fi
493
+ done
494
+
495
+ if [[ ${#models[@]} -eq 0 ]]; then
496
+ echo -e "${RED}Tidak ada model custom untuk dihapus${NC}"
497
+ read -p "Press Enter to continue..."
498
+ return
499
+ fi
500
+
501
+ echo ""
502
+ read -p "Pilih model untuk dihapus [1-$((${#models[@]}))]: " choice
503
+
504
+ if [[ "$choice" =~ ^[0-9]+$ ]] && [[ $choice -ge 1 ]] && [[ $choice -le ${#models[@]} ]]; then
505
+ local selected_file="${models[$((choice-1))]}"
506
+ local filename=$(basename "$selected_file")
507
+
508
+ echo ""
509
+ echo -e "${RED}Yakin ingin hapus $filename? [y/N]:${NC}" -n 1 -r
510
+ echo
511
+
512
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
513
+ rm "$selected_file"
514
+ echo -e "${GREEN}✅ Model dihapus!${NC}"
515
+ else
516
+ echo -e "${YELLOW}Dibatalkan${NC}"
517
+ fi
518
+ else
519
+ echo -e "${RED}Pilihan tidak valid!${NC}"
520
+ fi
521
+
522
+ read -p "Press Enter to continue..."
523
+ }
524
+
525
+ backup_models() {
526
+ clear_screen
527
+ echo -e "${BOLD}${BLUE}Backup Model Config${NC}"
528
+ echo ""
529
+
530
+ local backup_dir="$HOME/claude-model-backup-$(date +%Y%m%d-%H%M%S)"
531
+ mkdir -p "$backup_dir"
532
+
533
+ # Copy all custom models
534
+ local count=0
535
+ for json_file in "$MODEL_DIR"/*.json; do
536
+ if [[ -f "$json_file" ]]; then
537
+ local filename=$(basename "$json_file" .json)
538
+
539
+ # Skip defaults
540
+ case "$filename" in
541
+ "glm"|"groq"|"minimax"|"openai"|"gemini"|"xai"|"ollama")
542
+ continue
543
+ ;;
544
+ esac
545
+
546
+ cp "$json_file" "$backup_dir/"
547
+ ((count++))
548
+ fi
549
+ done
550
+
551
+ if [[ $count -gt 0 ]]; then
552
+ echo -e "${GREEN}✅ $count model berhasil dibackup!${NC}"
553
+ echo -e "${YELLOW}Folder: $backup_dir${NC}"
554
+ echo ""
555
+ echo "Restore dengan:"
556
+ echo "cp $backup_dir/*.json ~/.local/bin/model/"
557
+ else
558
+ echo -e "${RED}Tidak ada model custom untuk backup${NC}"
559
+ rmdir "$backup_dir" 2>/dev/null
560
+ fi
561
+
562
+ read -p "Press Enter to continue..."
563
+ }
564
+
565
+ # Main loop
566
+ while true; do
567
+ show_header
568
+ show_menu
569
+ read -p "Pilihan [0-6]: " choice
570
+
571
+ case $choice in
572
+ 1) create_from_template ;;
573
+ 2) create_manual ;;
574
+ 3) edit_model ;;
575
+ 4) list_models ;;
576
+ 5) delete_model ;;
577
+ 6) backup_models ;;
578
+ 0)
579
+ clear_screen
580
+ echo -e "${GREEN}Bye! 👋${NC}"
581
+ exit 0
582
+ ;;
583
+ *)
584
+ echo -e "${RED}Pilihan tidak valid!${NC}"
585
+ sleep 1
586
+ ;;
587
+ esac
588
+ done
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Add Model Script for Claude-All Dynamic
4
+ # Cara mudah nambah model baru ke Claude-All
5
+
6
+ set -e
7
+
8
+ # Colors
9
+ GREEN='\033[0;32m'
10
+ BLUE='\033[0;34m'
11
+ YELLOW='\033[1;33m'
12
+ RED='\033[0;31m'
13
+ NC='\033[0m'
14
+
15
+ SCRIPT_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
16
+ MODEL_DIR="$SCRIPT_DIR/model"
17
+
18
+ clear
19
+ echo -e "${GREEN}===================================${NC}"
20
+ echo -e "${GREEN} Add New Model to Claude-All ${NC}"
21
+ echo -e "${GREEN}===================================${NC}"
22
+ echo ""
23
+
24
+ # Check if jq is installed
25
+ if ! command -v jq &> /dev/null; then
26
+ echo -e "${YELLOW}Note: Install jq for better JSON formatting: pkg install jq${NC}"
27
+ echo ""
28
+ fi
29
+
30
+ # Get provider details
31
+ echo -e "${BLUE}Enter Provider Details:${NC}"
32
+ read -p "Provider Name (e.g., Perplexity AI): " provider_name
33
+ read -p "Short Description (e.g., Search-powered AI): " description
34
+ read -p "API Base URL (e.g., https://api.perplexity.ai/): " api_base
35
+ read -p "Default Model (e.g., llama-3.1-sonar-small-128k-online): " model
36
+ read -p "API Key (optional, can set later): " api_key
37
+
38
+ # Create filename from provider name
39
+ filename=$(echo "$provider_name" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-\|-$//g')
40
+ json_file="$MODEL_DIR/${filename}.json"
41
+
42
+ # Check if file already exists
43
+ if [[ -f "$json_file" ]]; then
44
+ echo ""
45
+ read -p "File already exists. Overwrite? [y/N]: " overwrite
46
+ if [[ ! "$overwrite" =~ ^[Yy]$ ]]; then
47
+ echo "Cancelled."
48
+ exit 0
49
+ fi
50
+ fi
51
+
52
+ # Create JSON
53
+ echo ""
54
+ echo -e "${BLUE}Creating model configuration...${NC}"
55
+
56
+ # Build JSON
57
+ json_content=$(cat <<EOF
58
+ {
59
+ "provider_name": "$provider_name",
60
+ "description": "$description",
61
+ "api_base": "$api_base",
62
+ "model": "$model"
63
+ EOF
64
+ )
65
+
66
+ # Add API key if provided
67
+ if [[ -n "$api_key" ]]; then
68
+ json_content+=",
69
+ \"api_key\": \"$api_key\""
70
+ fi
71
+
72
+ json_content+=$'\n}'
73
+
74
+ # Write to file
75
+ echo "$json_content" > "$json_file"
76
+
77
+ # Format JSON if jq is available
78
+ if command -v jq &> /dev/null; then
79
+ jq . "$json_file" > "$json_file.tmp" && mv "$json_file.tmp" "$json_file"
80
+ fi
81
+
82
+ echo ""
83
+ echo -e "${GREEN}✅ Model added successfully!${NC}"
84
+ echo ""
85
+ echo -e "${YELLOW}File created:${NC} $json_file"
86
+ echo ""
87
+ echo -e "${YELLOW}To update API key later:${NC}"
88
+ echo "claude-all-dynamic → API Key Manager"
89
+ echo ""
90
+ echo -e "${YELLOW}To use the model:${NC}"
91
+ echo "claude-all-dynamic → Select option for $provider_name"
92
+
93
+ # Show current models
94
+ echo ""
95
+ echo -e "${BLUE}Current custom models:${NC}"
96
+ count=10
97
+ for json_file in "$MODEL_DIR"/*.json; do
98
+ if [[ -f "$json_file" ]]; then
99
+ filename=$(basename "$json_file" .json)
100
+ case "$filename" in
101
+ "glm"|"groq"|"minimax"|"openai"|"gemini"|"xai"|"ollama")
102
+ continue
103
+ ;;
104
+ esac
105
+
106
+ if command -v jq &> /dev/null; then
107
+ provider=$(jq -r '.provider_name // "Unknown"' "$json_file" 2>/dev/null)
108
+ else
109
+ provider=$filename
110
+ fi
111
+ echo " $count) $provider"
112
+ ((count++))
113
+ fi
114
+ done