krims-code-cli 1.5.6__tar.gz → 1.5.8__tar.gz

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 (51) hide show
  1. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/PKG-INFO +5 -3
  2. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/krims_code_cli.egg-info/PKG-INFO +5 -3
  3. krims_code_cli-1.5.8/krims_code_cli.egg-info/SOURCES.txt +11 -0
  4. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/krims_code_cli.egg-info/entry_points.txt +1 -0
  5. krims_code_cli-1.5.8/krims_code_cli.egg-info/requires.txt +1 -0
  6. krims_code_cli-1.5.8/krims_pip/cli.py +392 -0
  7. krims_code_cli-1.5.8/setup.py +29 -0
  8. krims_code_cli-1.5.6/krims_code_cli.egg-info/SOURCES.txt +0 -45
  9. krims_code_cli-1.5.6/krims_pip/cli.py +0 -50
  10. krims_code_cli-1.5.6/krims_pip/node_project/bin/krims-code.js +0 -10
  11. krims_code_cli-1.5.6/krims_pip/node_project/package-lock.json +0 -793
  12. krims_code_cli-1.5.6/krims_pip/node_project/package.json +0 -46
  13. krims_code_cli-1.5.6/krims_pip/node_project/src/agent.js +0 -415
  14. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/fallback.js +0 -239
  15. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/google.js +0 -87
  16. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/providers.js +0 -203
  17. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/router.js +0 -146
  18. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/search.js +0 -94
  19. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/telemetry.js +0 -125
  20. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/tokens.js +0 -101
  21. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/universal.js +0 -507
  22. krims_code_cli-1.5.6/krims_pip/node_project/src/ai/xai.js +0 -50
  23. krims_code_cli-1.5.6/krims_pip/node_project/src/chat.js +0 -2543
  24. krims_code_cli-1.5.6/krims_pip/node_project/src/cli.js +0 -632
  25. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/commit.js +0 -157
  26. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/dashboard.js +0 -59
  27. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/github.js +0 -349
  28. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/index.js +0 -67
  29. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/status.js +0 -66
  30. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/teamwork-preview.js +0 -326
  31. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/theme.js +0 -42
  32. krims_code_cli-1.5.6/krims_pip/node_project/src/commands/themes.js +0 -30
  33. krims_code_cli-1.5.6/krims_pip/node_project/src/config.js +0 -400
  34. krims_code_cli-1.5.6/krims_pip/node_project/src/dashboard.js +0 -112
  35. krims_code_cli-1.5.6/krims_pip/node_project/src/file-parser.js +0 -164
  36. krims_code_cli-1.5.6/krims_pip/node_project/src/git.js +0 -41
  37. krims_code_cli-1.5.6/krims_pip/node_project/src/mic.js +0 -220
  38. krims_code_cli-1.5.6/krims_pip/node_project/src/modes.js +0 -92
  39. krims_code_cli-1.5.6/krims_pip/node_project/src/telemetry-server.js +0 -855
  40. krims_code_cli-1.5.6/krims_pip/node_project/src/ui/banner.js +0 -191
  41. krims_code_cli-1.5.6/krims_pip/node_project/src/ui/dashboard.html +0 -834
  42. krims_code_cli-1.5.6/krims_pip/node_project/src/ui/spinner.js +0 -43
  43. krims_code_cli-1.5.6/krims_pip/node_project/src/ui/theme.js +0 -624
  44. krims_code_cli-1.5.6/krims_pip/node_project/src/updater.js +0 -196
  45. krims_code_cli-1.5.6/setup.py +0 -62
  46. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/LICENSE +0 -0
  47. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/README.md +0 -0
  48. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/krims_code_cli.egg-info/dependency_links.txt +0 -0
  49. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/krims_code_cli.egg-info/top_level.txt +0 -0
  50. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/krims_pip/__init__.py +0 -0
  51. {krims_code_cli-1.5.6 → krims_code_cli-1.5.8}/setup.cfg +0 -0
@@ -1,16 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: krims-code-cli
3
- Version: 1.5.6
4
- Summary: Krims Code AI — Universal AI Gateway CLI (Python Wrapper)
3
+ Version: 1.5.8
4
+ Summary: Krims Code AI — Universal AI Gateway CLI (Native Python Edition)
5
5
  Home-page: https://github.com/Krylo-60/krims-code-cli
6
6
  Author: Krishiv PB
7
7
  Author-email: krylobloxyt@gmail.com
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
11
+ Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: krims-code-sdk>=0.1.0
14
15
  Dynamic: author
15
16
  Dynamic: author-email
16
17
  Dynamic: classifier
@@ -18,6 +19,7 @@ Dynamic: description
18
19
  Dynamic: description-content-type
19
20
  Dynamic: home-page
20
21
  Dynamic: license-file
22
+ Dynamic: requires-dist
21
23
  Dynamic: requires-python
22
24
  Dynamic: summary
23
25
 
@@ -1,16 +1,17 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: krims-code-cli
3
- Version: 1.5.6
4
- Summary: Krims Code AI — Universal AI Gateway CLI (Python Wrapper)
3
+ Version: 1.5.8
4
+ Summary: Krims Code AI — Universal AI Gateway CLI (Native Python Edition)
5
5
  Home-page: https://github.com/Krylo-60/krims-code-cli
6
6
  Author: Krishiv PB
7
7
  Author-email: krylobloxyt@gmail.com
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.6
11
+ Requires-Python: >=3.7
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
+ Requires-Dist: krims-code-sdk>=0.1.0
14
15
  Dynamic: author
15
16
  Dynamic: author-email
16
17
  Dynamic: classifier
@@ -18,6 +19,7 @@ Dynamic: description
18
19
  Dynamic: description-content-type
19
20
  Dynamic: home-page
20
21
  Dynamic: license-file
22
+ Dynamic: requires-dist
21
23
  Dynamic: requires-python
22
24
  Dynamic: summary
23
25
 
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ krims_code_cli.egg-info/PKG-INFO
5
+ krims_code_cli.egg-info/SOURCES.txt
6
+ krims_code_cli.egg-info/dependency_links.txt
7
+ krims_code_cli.egg-info/entry_points.txt
8
+ krims_code_cli.egg-info/requires.txt
9
+ krims_code_cli.egg-info/top_level.txt
10
+ krims_pip/__init__.py
11
+ krims_pip/cli.py
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ krims-code = krims_pip.cli:main
2
3
  krims-pip = krims_pip.cli:main
@@ -0,0 +1 @@
1
+ krims-code-sdk>=0.1.0
@@ -0,0 +1,392 @@
1
+ import sys
2
+ import os
3
+ import json
4
+ import getpass
5
+ import urllib.request
6
+ import urllib.error
7
+ from krims_code_sdk import KrimsClient, PROVIDERS
8
+
9
+ if hasattr(sys.stdout, 'reconfigure'):
10
+ try:
11
+ sys.stdout.reconfigure(encoding='utf-8')
12
+ except Exception:
13
+ pass
14
+ if hasattr(sys.stderr, 'reconfigure'):
15
+ try:
16
+ sys.stderr.reconfigure(encoding='utf-8')
17
+ except Exception:
18
+ pass
19
+
20
+ API_BASE = "https://krims-discord-bot-d57m.onrender.com"
21
+
22
+ # ANSI color helper matching chalk
23
+ class Colors:
24
+ RED = "\033[31m"
25
+ CYAN = "\033[36m"
26
+ GREEN = "\033[32m"
27
+ YELLOW = "\033[33m"
28
+ BLUE = "\033[34m"
29
+ MAGENTA = "\033[35m"
30
+ WHITE = "\033[37m"
31
+ RESET = "\033[0m"
32
+ BOLD = "\033[1m"
33
+ DIM = "\033[2m"
34
+
35
+ @staticmethod
36
+ def hex(code):
37
+ h = code.lstrip('#')
38
+ r, g, b = tuple(int(h[i:i+2], 16) for i in (0, 2, 4))
39
+ return f"\033[38;2;{r};{g};{b}m"
40
+
41
+ # Config Path Resolver
42
+ def get_config_path():
43
+ home = os.path.expanduser("~")
44
+ # Check ~/.krims/config.json first for parity with Node CLI
45
+ node_config = os.path.join(home, ".krims", "config.json")
46
+ if os.path.exists(node_config):
47
+ return node_config
48
+ return os.path.join(home, ".aether", "config.json")
49
+
50
+ def load_config():
51
+ config_path = get_config_path()
52
+ if os.path.exists(config_path):
53
+ try:
54
+ with open(config_path, "r", encoding="utf-8") as f:
55
+ return json.load(f)
56
+ except Exception:
57
+ pass
58
+ return {}
59
+
60
+ def save_config(config):
61
+ config_path = get_config_path()
62
+ os.makedirs(os.path.dirname(config_path), exist_ok=True)
63
+ with open(config_path, "w", encoding="utf-8") as f:
64
+ json.dump(config, f, indent=2)
65
+
66
+ def handle_discord(args, config):
67
+ action = args[0].lower() if len(args) > 0 else "status"
68
+ subarg = args[1] if len(args) > 1 else ""
69
+
70
+ if action in ["link", "connect"]:
71
+ target_id = subarg or (args[0] if len(args) == 1 and args[0].isdigit() else "")
72
+ if not target_id:
73
+ print(f"\n{Colors.YELLOW}Usage: krims-pip discord connect <your_discord_id>{Colors.RESET}")
74
+ print(f"{Colors.DIM}Enable Developer Mode in Discord, right-click your profile, and select 'Copy User ID'.{Colors.RESET}\n")
75
+ return
76
+
77
+ print(f"\n{Colors.CYAN}Connecting Discord identity [{target_id}] to Krims Fleet...{Colors.RESET}")
78
+ try:
79
+ req_data = json.dumps({"discordId": target_id, "username": getpass.getuser()}).encode("utf-8")
80
+ req = urllib.request.Request(
81
+ f"{API_BASE}/api/cli/connect",
82
+ data=req_data,
83
+ headers={"Content-Type": "application/json", "User-Agent": "KrimsCodeCLI-Python/1.5.8"}
84
+ )
85
+ with urllib.request.urlopen(req, timeout=15) as resp:
86
+ data = json.loads(resp.read().decode("utf-8"))
87
+
88
+ if not data.get("ok"):
89
+ print(f"{Colors.RED}Connection failed: {data.get('error', 'Unknown error')}{Colors.RESET}")
90
+ return
91
+
92
+ config["discord_id"] = data.get("discordId")
93
+ config["discord_user"] = data.get("username")
94
+ config["discord_linked_at"] = os.times().elapsed
95
+ save_config(config)
96
+
97
+ bonus_msg = f"{Colors.GREEN} (+1,000 KC Link Bonus Awarded!){Colors.RESET}" if data.get("bonusAwarded") else ""
98
+ print(f"\n{Colors.CYAN}⚡ DISCORD IDENTITY LINKED SUCCESSFULLY!{Colors.RESET}")
99
+ print("─" * 60)
100
+ print(f" Account : {Colors.CYAN}@{data.get('username')}{Colors.RESET}")
101
+ print(f" Discord ID : {data.get('discordId')}")
102
+ print(f" KC Vault : {Colors.YELLOW}{data.get('balance', 0):,} KC{Colors.RESET}{bonus_msg}")
103
+ print("─" * 60)
104
+ print(f"{Colors.DIM}Use /claim for daily rewards directly in your terminal.{Colors.RESET}\n")
105
+ except Exception as e:
106
+ print(f"{Colors.RED}Failed to reach Krims rewards server: {e}{Colors.RESET}\n")
107
+
108
+ elif action == "unlink":
109
+ if "discord_id" not in config:
110
+ print(f"\n{Colors.YELLOW}No Discord account currently linked.{Colors.RESET}\n")
111
+ return
112
+ old_id = config.pop("discord_id", None)
113
+ config.pop("discord_user", None)
114
+ save_config(config)
115
+ print(f"\n{Colors.GREEN}✓ Disconnected Discord identity ({old_id}).{Colors.RESET}\n")
116
+
117
+ else:
118
+ # Status
119
+ disc_id = config.get("discord_id")
120
+ if not disc_id:
121
+ print(f"\n{Colors.YELLOW}⚡ KRIMS CODE • DISCORD IDENTITY{Colors.RESET}")
122
+ print("─" * 60)
123
+ print(f" Status: {Colors.RED}✗ Not Linked{Colors.RESET}")
124
+ print("─" * 60)
125
+ print(" Link your account to earn +1,000 KC and claim daily terminal drops:")
126
+ print(f" {Colors.CYAN}krims-pip discord connect <discord_id>{Colors.RESET}\n")
127
+ return
128
+
129
+ try:
130
+ req = urllib.request.Request(
131
+ f"{API_BASE}/api/cli/balance?discordId={disc_id}",
132
+ headers={"User-Agent": "KrimsCodeCLI-Python/1.5.8"}
133
+ )
134
+ with urllib.request.urlopen(req, timeout=10) as resp:
135
+ data = json.loads(resp.read().decode("utf-8"))
136
+ bal = data.get("balance", 0)
137
+ except Exception:
138
+ bal = "Unavailable"
139
+
140
+ print(f"\n{Colors.CYAN}⚡ KRIMS CODE • DISCORD IDENTITY{Colors.RESET}")
141
+ print("─" * 60)
142
+ print(f" Status : {Colors.GREEN}✓ Connected{Colors.RESET}")
143
+ print(f" Account : {Colors.CYAN}@{config.get('discord_user', disc_id)}{Colors.RESET}")
144
+ print(f" Discord ID : {disc_id}")
145
+ print(f" KC Vault : {Colors.YELLOW}{bal:,} KC{Colors.RESET}" if isinstance(bal, int) else f" KC Vault : {bal}")
146
+ print("─" * 60)
147
+ print(f"{Colors.DIM}Type /claim for daily rewards, or krims-pip discord unlink to disconnect.{Colors.RESET}\n")
148
+
149
+ def handle_claim(config):
150
+ disc_id = config.get("discord_id")
151
+ if not disc_id:
152
+ print(f"\n{Colors.YELLOW}⚠️ No Discord Account Linked!{Colors.RESET}")
153
+ print("─" * 60)
154
+ print("Link your Discord ID first to claim KC drops directly into your vault:")
155
+ print(f" {Colors.CYAN}krims-pip discord connect <your_discord_id>{Colors.RESET}")
156
+ print("─" * 60)
157
+ print(f"{Colors.DIM}First-time linking grants an instant +1,000 KC bonus!{Colors.RESET}\n")
158
+ return
159
+
160
+ print(f"\n{Colors.CYAN}🔄 Contacting the Krims Fleet Rewards Server...{Colors.RESET}")
161
+ try:
162
+ req_data = json.dumps({"discordId": disc_id}).encode("utf-8")
163
+ req = urllib.request.Request(
164
+ f"{API_BASE}/api/cli/claim",
165
+ data=req_data,
166
+ headers={"Content-Type": "application/json", "User-Agent": "KrimsCodeCLI-Python/1.5.8"}
167
+ )
168
+ with urllib.request.urlopen(req, timeout=15) as resp:
169
+ data = json.loads(resp.read().decode("utf-8"))
170
+
171
+ if not data.get("ok"):
172
+ print(f"{Colors.RED}Claim failed: {data.get('error', 'Unknown error')}{Colors.RESET}")
173
+ return
174
+
175
+ if data.get("claimed"):
176
+ reward = data.get("reward", 250)
177
+ streak = data.get("streak", 1)
178
+ bal = data.get("balance", 0)
179
+ print(f"\n{Colors.GREEN}═════════════════════════════════════════════════════════════════{Colors.RESET}")
180
+ print(f"{Colors.GREEN}🎉 DAILY KC REWARD CLAIMED SUCCESSFULLY! 🚀{Colors.RESET}")
181
+ print("─" * 60)
182
+ print(f" Account : {Colors.CYAN}@{config.get('discord_user', disc_id)}{Colors.RESET}")
183
+ print(f" Reward Earned : {Colors.YELLOW}+{reward:,} KC{Colors.RESET}")
184
+ print(f" Daily Streak : {Colors.CYAN}{streak} Day(s) Multiplier{Colors.RESET}")
185
+ print(f" Total Vault : {Colors.YELLOW}{bal:,} KC{Colors.RESET}")
186
+ print("─" * 60)
187
+ print(f"{Colors.DIM}Next claim available in 24 hours. View rewards: https://krims-bot-dashboard.vercel.app/rewards{Colors.RESET}")
188
+ print(f"{Colors.GREEN}═════════════════════════════════════════════════════════════════{Colors.RESET}\n")
189
+ else:
190
+ time_rem = data.get("timeRemaining", 0)
191
+ hrs = time_rem // (1000 * 60 * 60)
192
+ mins = (time_rem % (1000 * 60 * 60)) // (1000 * 60)
193
+ bal = data.get("balance", 0)
194
+ streak = data.get("streak", 1)
195
+ print(f"\n{Colors.YELLOW}⏳ DAILY COOLDOWN ACTIVE{Colors.RESET}")
196
+ print("─" * 60)
197
+ print(f" Account : {Colors.CYAN}@{config.get('discord_user', disc_id)}{Colors.RESET}")
198
+ print(f" Cooldown : {Colors.YELLOW}{hrs}h {mins}m remaining{Colors.RESET}")
199
+ print(f" Current KC : {Colors.YELLOW}{bal:,} KC{Colors.RESET}")
200
+ print(f" Saved Streak: {streak} Day(s)")
201
+ print("─" * 60)
202
+ print(f"{Colors.DIM}Chat in the Discord server or use Krims Code to level up and earn passive KC!{Colors.RESET}\n")
203
+
204
+ except Exception as e:
205
+ print(f"{Colors.RED}Could not reach rewards server: {e}{Colors.RESET}\n")
206
+
207
+ def print_banner(config, current_mode="titan"):
208
+ c1 = Colors.hex('#FF3E3E') # Red-Orange
209
+ c2 = Colors.hex('#FF8500') # Orange
210
+ c3 = Colors.hex('#FFD000') # Yellow
211
+ c4 = Colors.hex('#00F2FF') # Cyan
212
+ c5 = Colors.hex('#0085FF') # Blue
213
+ c6 = Colors.hex('#7000FF') # Violet
214
+ c7 = Colors.hex('#B000FF') # Purple
215
+ dim = Colors.DIM
216
+ reset = Colors.RESET
217
+
218
+ username = getpass.getuser() or "Explorer"
219
+ cwd = os.getcwd()
220
+ home = os.path.expanduser("~")
221
+ display_cwd = cwd
222
+ if cwd.startswith(home):
223
+ display_cwd = "~" + cwd[len(home):]
224
+
225
+ # Resolve active providers
226
+ active_providers = []
227
+ for k, p in PROVIDERS.items():
228
+ env_key = p.get('envKey')
229
+ if env_key and os.environ.get(env_key):
230
+ active_providers.append(k)
231
+ elif env_key and config.get(env_key):
232
+ active_providers.append(k)
233
+
234
+ if active_providers:
235
+ active_names = ", ".join(set(active_providers))
236
+ mesh_status = f"{Colors.GREEN}● Online ({len(active_providers)} active node(s)){reset}"
237
+ else:
238
+ active_names = "Local math & offline logic only"
239
+ mesh_status = f"{Colors.YELLOW}○ Offline (Local fallbacks active){reset}"
240
+
241
+ # Truncate values to fit screen
242
+ max_val_width = 46
243
+ if len(display_cwd) > max_val_width:
244
+ display_cwd = "..." + display_cwd[-(max_val_width - 3):]
245
+ if len(active_names) > max_val_width:
246
+ active_names = active_names[:max_val_width - 3] + "..."
247
+
248
+ logo = [
249
+ c1(" █▄ ▄█"),
250
+ c2(" ██ ██ "),
251
+ c3(" ██ ▄█ "),
252
+ c4(" ███▀ "),
253
+ c5(" ██ ▀█ "),
254
+ c6(" ██ ██ "),
255
+ c7(" █▀ ▀█")
256
+ ]
257
+
258
+ info = [
259
+ f" ⚡ {c4}KRIMS CODE COMMAND STATION v1.5.8{reset} • Welcome back, {c4}{username}{reset}",
260
+ dim(" " + "─" * 58),
261
+ f" {dim}Workspace{reset} : {display_cwd}",
262
+ f" {dim}Mode{reset} : {c4}{current_mode.upper()}{reset} {dim}— Ultimate reasoning fusion of Codex & Claude Code.{reset}",
263
+ f" {dim}Network{reset} : {mesh_status}",
264
+ f" {dim}Engine{reset} : {active_names}",
265
+ f" {dim}Packager{reset} : pip (krims-code-cli)"
266
+ ]
267
+
268
+ print("")
269
+ for i in range(7):
270
+ print(logo[i] + info[i] + reset)
271
+ print("")
272
+
273
+ def run_chat(config, model=None, provider=None):
274
+ # Resolve default provider
275
+ prov_key = provider or config.get("DEFAULT_PROVIDER") or "google"
276
+ model_name = model or config.get("DEFAULT_MODEL") or ""
277
+
278
+ # Resolve key
279
+ prov_config = PROVIDERS.get(prov_key.lower(), {})
280
+ env_key = prov_config.get("envKey", "")
281
+ api_key = config.get(env_key) or os.environ.get(env_key) or ""
282
+
283
+ client = KrimsClient(provider=prov_key, model=model_name, api_key=api_key)
284
+ session = client.create_session()
285
+
286
+ print_banner(config)
287
+ print(f"{Colors.DIM}Type 'exit' or 'quit' to terminate session. /claim for daily KC, /discord connect <id> to link.{Colors.RESET}\n")
288
+
289
+ while True:
290
+ try:
291
+ prompt = input(f"{Colors.hex('#00F2FF')}you > {Colors.RESET}").strip()
292
+ if not prompt:
293
+ continue
294
+ if prompt.lower() in ['exit', 'quit']:
295
+ break
296
+
297
+ # Slash commands in chat
298
+ if prompt.startswith("/discord"):
299
+ parts = prompt.split()
300
+ handle_discord(parts[1:], config)
301
+ continue
302
+ if prompt.lower() in ["/claim", "/daily", "/kc", "/balance"]:
303
+ handle_claim(config)
304
+ continue
305
+
306
+ print(f"{Colors.DIM}krims is composing response...{Colors.RESET}")
307
+ res = session.ask(prompt)
308
+ print(f"\n{Colors.hex('#7000FF')}krims > {Colors.RESET}{res['text']}\n")
309
+ except KeyboardInterrupt:
310
+ print("\nSession terminated.")
311
+ break
312
+ except Exception as e:
313
+ print(f"\n{Colors.RED}Error: {e}{Colors.RESET}\n")
314
+
315
+ def run_ask(prompt, config):
316
+ prov_key = config.get("DEFAULT_PROVIDER") or "google"
317
+ model_name = config.get("DEFAULT_MODEL") or ""
318
+ prov_config = PROVIDERS.get(prov_key.lower(), {})
319
+ env_key = prov_config.get("envKey", "")
320
+ api_key = config.get(env_key) or os.environ.get(env_key) or ""
321
+
322
+ client = KrimsClient(provider=prov_key, model=model_name, api_key=api_key)
323
+ try:
324
+ res = client.ask(prompt)
325
+ print(res['text'])
326
+ except Exception as e:
327
+ print(f"Error: {e}", file=sys.stderr)
328
+ sys.exit(1)
329
+
330
+ def handle_config(args, config):
331
+ if len(args) == 0:
332
+ print("Usage: krims-pip config <get/set/list/delete> [key] [value]")
333
+ return
334
+
335
+ action = args[0].lower()
336
+ if action == "list":
337
+ for k, v in config.items():
338
+ print(f"{k}={v}")
339
+ elif action == "get" and len(args) >= 2:
340
+ print(config.get(args[1], ""))
341
+ elif action == "set" and len(args) >= 3:
342
+ config[args[1]] = args[2]
343
+ save_config(config)
344
+ print(f"Set {args[1]}={args[2]}")
345
+ elif action == "delete" and len(args) >= 2:
346
+ if args[1] in config:
347
+ del config[args[1]]
348
+ save_config(config)
349
+ print(f"Deleted {args[1]}")
350
+ else:
351
+ print(f"Key {args[1]} not found")
352
+ else:
353
+ print("Invalid config arguments.")
354
+
355
+ def main():
356
+ config = load_config()
357
+ args = sys.argv[1:]
358
+
359
+ if not args:
360
+ run_chat(config)
361
+ return
362
+
363
+ cmd = args[0].lower()
364
+ if cmd == "chat":
365
+ run_chat(config)
366
+ elif cmd in ["claim", "daily", "balance", "kc"]:
367
+ handle_claim(config)
368
+ elif cmd in ["discord", "link"]:
369
+ handle_discord(args[1:], config)
370
+ elif cmd == "ask" and len(args) >= 2:
371
+ run_ask(args[1], config)
372
+ elif cmd == "config":
373
+ handle_config(args[1:], config)
374
+ elif cmd in ["version", "-v", "--version"]:
375
+ print("Krims Code CLI v1.5.8 (Native Python Edition)")
376
+ elif cmd in ["help", "-h", "--help"]:
377
+ print("Krims Code CLI — Native Python Edition")
378
+ print("\nCommands:")
379
+ print(" chat Start stateful chat loop (default)")
380
+ print(" claim | daily Claim daily KC rewards (+250 KC)")
381
+ print(" discord connect <id> Link Discord account to Krims Fleet (+1,000 KC bonus)")
382
+ print(" discord View linked Discord account and KC vault")
383
+ print(" ask <prompt> Get single answer for prompt")
384
+ print(" config <get/set/list> Get or set keys")
385
+ print(" version Display version info")
386
+ else:
387
+ # Fallback to ask if they just write a prompt directly
388
+ run_ask(" ".join(args), config)
389
+ run_ask(" ".join(args), config)
390
+
391
+ if __name__ == "__main__":
392
+ main()
@@ -0,0 +1,29 @@
1
+ from setuptools import setup, find_packages
2
+ import os
3
+
4
+ setup(
5
+ name="krims-code-cli",
6
+ version="1.5.8",
7
+ author="Krishiv PB",
8
+ author_email="krylobloxyt@gmail.com",
9
+ description="Krims Code AI — Universal AI Gateway CLI (Native Python Edition)",
10
+ long_description=open("README.md", "r", encoding="utf-8").read() if os.path.exists("README.md") else "",
11
+ long_description_content_type="text/markdown",
12
+ url="https://github.com/Krylo-60/krims-code-cli",
13
+ packages=find_packages(),
14
+ install_requires=[
15
+ "krims-code-sdk>=0.1.0"
16
+ ],
17
+ entry_points={
18
+ "console_scripts": [
19
+ "krims-pip=krims_pip.cli:main",
20
+ "krims-code=krims_pip.cli:main",
21
+ ],
22
+ },
23
+ classifiers=[
24
+ "Programming Language :: Python :: 3",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Operating System :: OS Independent",
27
+ ],
28
+ python_requires=">=3.7",
29
+ )
@@ -1,45 +0,0 @@
1
- LICENSE
2
- README.md
3
- setup.py
4
- krims_code_cli.egg-info/PKG-INFO
5
- krims_code_cli.egg-info/SOURCES.txt
6
- krims_code_cli.egg-info/dependency_links.txt
7
- krims_code_cli.egg-info/entry_points.txt
8
- krims_code_cli.egg-info/top_level.txt
9
- krims_pip/__init__.py
10
- krims_pip/cli.py
11
- krims_pip/node_project/package-lock.json
12
- krims_pip/node_project/package.json
13
- krims_pip/node_project/bin/krims-code.js
14
- krims_pip/node_project/src/agent.js
15
- krims_pip/node_project/src/chat.js
16
- krims_pip/node_project/src/cli.js
17
- krims_pip/node_project/src/config.js
18
- krims_pip/node_project/src/dashboard.js
19
- krims_pip/node_project/src/file-parser.js
20
- krims_pip/node_project/src/git.js
21
- krims_pip/node_project/src/mic.js
22
- krims_pip/node_project/src/modes.js
23
- krims_pip/node_project/src/telemetry-server.js
24
- krims_pip/node_project/src/updater.js
25
- krims_pip/node_project/src/ai/fallback.js
26
- krims_pip/node_project/src/ai/google.js
27
- krims_pip/node_project/src/ai/providers.js
28
- krims_pip/node_project/src/ai/router.js
29
- krims_pip/node_project/src/ai/search.js
30
- krims_pip/node_project/src/ai/telemetry.js
31
- krims_pip/node_project/src/ai/tokens.js
32
- krims_pip/node_project/src/ai/universal.js
33
- krims_pip/node_project/src/ai/xai.js
34
- krims_pip/node_project/src/commands/commit.js
35
- krims_pip/node_project/src/commands/dashboard.js
36
- krims_pip/node_project/src/commands/github.js
37
- krims_pip/node_project/src/commands/index.js
38
- krims_pip/node_project/src/commands/status.js
39
- krims_pip/node_project/src/commands/teamwork-preview.js
40
- krims_pip/node_project/src/commands/theme.js
41
- krims_pip/node_project/src/commands/themes.js
42
- krims_pip/node_project/src/ui/banner.js
43
- krims_pip/node_project/src/ui/dashboard.html
44
- krims_pip/node_project/src/ui/spinner.js
45
- krims_pip/node_project/src/ui/theme.js
@@ -1,50 +0,0 @@
1
- import sys
2
- import os
3
- import subprocess
4
- import shutil
5
-
6
- def main():
7
- # Find the Node.js entry point absolute path inside KRIMS CODE_pip/node_project
8
- script_dir = os.path.dirname(os.path.abspath(__file__))
9
- node_project_dir = os.path.join(script_dir, "node_project")
10
- krims_code_js = os.path.join(node_project_dir, "bin", "krims-code.js")
11
-
12
- # If not found globally, check dev layout relative to current working directory
13
- if not os.path.exists(krims_code_js):
14
- krims_code_js = os.path.join(os.getcwd(), "bin", "krims-code.js")
15
- node_project_dir = os.getcwd()
16
-
17
- if not shutil.which("node"):
18
- print("Error: Node.js is required to run Krims Code CLI.", file=sys.stderr)
19
- print("Please install Node.js (https://nodejs.org) and try again.", file=sys.stderr)
20
- sys.exit(1)
21
-
22
- # Check if node_modules exists in the node_project directory.
23
- # If not, automatically run npm install inside that directory!
24
- node_modules_dir = os.path.join(node_project_dir, "node_modules")
25
- if not os.path.exists(node_modules_dir):
26
- print("First-time launch check: Installing node dependencies via npm...")
27
- npm_cmd = shutil.which("npm")
28
- if not npm_cmd:
29
- print("Error: npm is required to install Node dependencies.", file=sys.stderr)
30
- print("Please install Node.js/npm and try again.", file=sys.stderr)
31
- sys.exit(1)
32
-
33
- # On Windows, run npm using shell=True to handle cmd/bat resolution
34
- subprocess.run([npm_cmd, "install", "--no-audit", "--no-fund"], cwd=node_project_dir, shell=(os.name == "nt"))
35
-
36
- try:
37
- # Run node krims-code.js passing all command line arguments
38
- os.environ["KRIMS_PACKAGER"] = "pip"
39
- cmd = ["node", krims_code_js] + sys.argv[1:]
40
- result = subprocess.run(cmd, check=False)
41
- sys.exit(result.returncode)
42
- except KeyboardInterrupt:
43
- print("\nSession terminated by user.")
44
- sys.exit(0)
45
- except Exception as e:
46
- print(f"Error running Krims Code: {e}", file=sys.stderr)
47
- sys.exit(1)
48
-
49
- if __name__ == "__main__":
50
- main()
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // ═══════════════════════════════════════════════════════════
4
- // KRIMS CODE AI CLI — Entry Point
5
- // Universal AI Gateway — 13+ Providers, Free & Paid
6
- // ═══════════════════════════════════════════════════════════
7
-
8
- import { createCLI } from "../src/cli.js";
9
-
10
- createCLI(process.argv);