krims-code-cli 1.5.2__py3-none-any.whl
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.
- krims_code_cli-1.5.2.dist-info/METADATA +336 -0
- krims_code_cli-1.5.2.dist-info/RECORD +43 -0
- krims_code_cli-1.5.2.dist-info/WHEEL +5 -0
- krims_code_cli-1.5.2.dist-info/entry_points.txt +2 -0
- krims_code_cli-1.5.2.dist-info/licenses/LICENSE +21 -0
- krims_code_cli-1.5.2.dist-info/top_level.txt +1 -0
- krims_pip/__init__.py +1 -0
- krims_pip/cli.py +50 -0
- krims_pip/node_project/bin/krims-code.js +10 -0
- krims_pip/node_project/package-lock.json +793 -0
- krims_pip/node_project/package.json +46 -0
- krims_pip/node_project/src/agent.js +415 -0
- krims_pip/node_project/src/ai/fallback.js +239 -0
- krims_pip/node_project/src/ai/google.js +87 -0
- krims_pip/node_project/src/ai/providers.js +203 -0
- krims_pip/node_project/src/ai/router.js +146 -0
- krims_pip/node_project/src/ai/search.js +94 -0
- krims_pip/node_project/src/ai/telemetry.js +125 -0
- krims_pip/node_project/src/ai/tokens.js +101 -0
- krims_pip/node_project/src/ai/universal.js +507 -0
- krims_pip/node_project/src/ai/xai.js +50 -0
- krims_pip/node_project/src/chat.js +2543 -0
- krims_pip/node_project/src/cli.js +632 -0
- krims_pip/node_project/src/commands/commit.js +157 -0
- krims_pip/node_project/src/commands/dashboard.js +59 -0
- krims_pip/node_project/src/commands/github.js +349 -0
- krims_pip/node_project/src/commands/index.js +67 -0
- krims_pip/node_project/src/commands/status.js +66 -0
- krims_pip/node_project/src/commands/teamwork-preview.js +326 -0
- krims_pip/node_project/src/commands/theme.js +42 -0
- krims_pip/node_project/src/commands/themes.js +30 -0
- krims_pip/node_project/src/config.js +400 -0
- krims_pip/node_project/src/dashboard.js +112 -0
- krims_pip/node_project/src/file-parser.js +164 -0
- krims_pip/node_project/src/git.js +41 -0
- krims_pip/node_project/src/mic.js +220 -0
- krims_pip/node_project/src/modes.js +92 -0
- krims_pip/node_project/src/telemetry-server.js +855 -0
- krims_pip/node_project/src/ui/banner.js +204 -0
- krims_pip/node_project/src/ui/dashboard.html +834 -0
- krims_pip/node_project/src/ui/spinner.js +43 -0
- krims_pip/node_project/src/ui/theme.js +624 -0
- krims_pip/node_project/src/updater.js +196 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════
|
|
2
|
+
// Krims Code AI CLI — ASCII Art Welcome Banner
|
|
3
|
+
// ═══════════════════════════════════════════════════════════
|
|
4
|
+
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import { colors, separator, modeBadge, getIcon } from "./theme.js";
|
|
11
|
+
import { getActiveProviders } from "../ai/providers.js";
|
|
12
|
+
import { MODES } from "../modes.js";
|
|
13
|
+
import { getConfigPath } from "../config.js";
|
|
14
|
+
|
|
15
|
+
// ANSI escape code strip regex
|
|
16
|
+
const ANSI_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
17
|
+
|
|
18
|
+
function getVisibleLength(str) {
|
|
19
|
+
return str.replace(ANSI_REGEX, "").length;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function loadConfigSync() {
|
|
23
|
+
try {
|
|
24
|
+
const configPath = getConfigPath();
|
|
25
|
+
if (existsSync(configPath)) {
|
|
26
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
27
|
+
return JSON.parse(raw);
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
// Ignore
|
|
31
|
+
}
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Displays the cyberpunk-styled Krims Code ASCII art banner and OpenCode-style system info.
|
|
37
|
+
* @param {string} [currentMode='titan'] - The currently active mode name
|
|
38
|
+
*/
|
|
39
|
+
export function showBanner(currentMode = "titan") {
|
|
40
|
+
const c1 = colors.accent;
|
|
41
|
+
const c2 = colors.accent2;
|
|
42
|
+
const c3 = colors.accent3;
|
|
43
|
+
const dim = colors.dim;
|
|
44
|
+
|
|
45
|
+
// 1. ASCII Art Logo
|
|
46
|
+
const logo = [
|
|
47
|
+
"",
|
|
48
|
+
c1(" ╔═══════════════════════════════════════════════════════════╗"),
|
|
49
|
+
c1(" ║") + c2(" ██╗ ██╗██████╗ ██╗███╗ ███╗███████╗ ") + c1("║"),
|
|
50
|
+
c1(" ║") + c2(" ██║ ██╔╝██╔══██╗██║████╗ ████║██╔════╝ ") + c1("║"),
|
|
51
|
+
c1(" ║") + c1(" █████╔╝ ██████╔╝██║██╔████╔██║███████╗ ") + c1("║"),
|
|
52
|
+
c1(" ║") + c3(" ██╔═██╗ ██╔══██╗██║██║╚██╔╝██║╚════██║ ") + c1("║"),
|
|
53
|
+
c1(" ║") + c3(" ██║ ██╗██║ ██║██║██║ ╚═╝ ██║███████║ ") + c1("║"),
|
|
54
|
+
c1(" ║") + dim(" ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝ ") + c1("║"),
|
|
55
|
+
c1(" ╚═══════════════════════════════════════════════════════════╝"),
|
|
56
|
+
].join("\n");
|
|
57
|
+
|
|
58
|
+
console.log(logo);
|
|
59
|
+
|
|
60
|
+
// 2. Fetch User & System Context
|
|
61
|
+
let username = "Explorer";
|
|
62
|
+
try {
|
|
63
|
+
username = os.userInfo().username;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
username = process.env.USER || process.env.USERNAME || "Explorer";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const cwd = process.cwd();
|
|
69
|
+
const home = homedir();
|
|
70
|
+
let displayCwd = cwd;
|
|
71
|
+
if (cwd.startsWith(home)) {
|
|
72
|
+
displayCwd = "~" + cwd.slice(home.length);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const config = loadConfigSync();
|
|
76
|
+
const active = getActiveProviders(config);
|
|
77
|
+
|
|
78
|
+
const activeNames = active.length > 0
|
|
79
|
+
? [...new Set(active.map(a => a.provider.name))].join(", ")
|
|
80
|
+
: "Local math & offline logic only";
|
|
81
|
+
|
|
82
|
+
const meshStatusText = active.length > 0
|
|
83
|
+
? colors.success(`● Online (${active.length} active node${active.length === 1 ? "" : "s"})`)
|
|
84
|
+
: colors.warning(`○ Offline (Local fallbacks active)`);
|
|
85
|
+
|
|
86
|
+
const modeDetails = MODES[currentMode.toLowerCase()] || MODES.titan;
|
|
87
|
+
const modeText = modeBadge(currentMode) || colors.accent.bold(modeDetails.label);
|
|
88
|
+
|
|
89
|
+
const shortDescriptions = {
|
|
90
|
+
synthesis: "Balanced reasoning with clean structure.",
|
|
91
|
+
research: "Deep analysis with evidence-based reasoning.",
|
|
92
|
+
architect: "Systems thinking with build plans.",
|
|
93
|
+
titan: "Ultimate reasoning fusion of Codex & Claude Code.",
|
|
94
|
+
};
|
|
95
|
+
const desc = shortDescriptions[currentMode.toLowerCase()] || shortDescriptions.titan;
|
|
96
|
+
|
|
97
|
+
let version = "1.3.8";
|
|
98
|
+
try {
|
|
99
|
+
const pkgUrl = new URL("../../package.json", import.meta.url);
|
|
100
|
+
const pkg = JSON.parse(readFileSync(pkgUrl, "utf-8"));
|
|
101
|
+
version = pkg.version || "1.3.8";
|
|
102
|
+
} catch (e) {
|
|
103
|
+
// Fallback
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 3. Render System Status Box
|
|
107
|
+
const columns = process.stdout.columns || 80;
|
|
108
|
+
const boxWidth = Math.max(76, Math.min(90, columns - 4));
|
|
109
|
+
const maxValueWidth = boxWidth - 20;
|
|
110
|
+
|
|
111
|
+
// Truncate values to fit the box cleanly
|
|
112
|
+
let workspaceValue = displayCwd;
|
|
113
|
+
if (workspaceValue.length > maxValueWidth) {
|
|
114
|
+
workspaceValue = "..." + workspaceValue.slice(-(maxValueWidth - 3));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let engineValue = activeNames;
|
|
118
|
+
if (engineValue.length > maxValueWidth) {
|
|
119
|
+
engineValue = engineValue.slice(0, maxValueWidth - 3) + "...";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Truncate description to ensure total mode value (badge + sep + desc) fits within maxValueWidth
|
|
123
|
+
const modeBadgeText = getVisibleLength(modeText);
|
|
124
|
+
const maxDescWidth = maxValueWidth - modeBadgeText - 3; // 3 for " — "
|
|
125
|
+
let descValue = desc;
|
|
126
|
+
if (descValue.length > maxDescWidth) {
|
|
127
|
+
descValue = descValue.slice(0, Math.max(10, maxDescWidth - 3)) + "...";
|
|
128
|
+
}
|
|
129
|
+
const modeRowValue = `${modeText} ${colors.dim(`— ${descValue}`)}`;
|
|
130
|
+
|
|
131
|
+
function formatRow(label, value) {
|
|
132
|
+
const spaces = " ".repeat(Math.max(0, 14 - getVisibleLength(label)));
|
|
133
|
+
return `${label}${spaces}${value}`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const packagerText = process.env.KRIMS_PACKAGER === "pip"
|
|
137
|
+
? "pip (krims-code-cli)"
|
|
138
|
+
: "npm (@krishivpb60/krims-code-cli)";
|
|
139
|
+
|
|
140
|
+
const rows = [
|
|
141
|
+
formatRow(` ${colors.muted(getIcon("workspace", config) + "Workspace")}`, colors.text(workspaceValue)),
|
|
142
|
+
formatRow(` ${colors.muted(getIcon("mode", config) + "Mode")}`, modeRowValue),
|
|
143
|
+
formatRow(` ${colors.muted(getIcon("network", config) + "Network")}`, meshStatusText),
|
|
144
|
+
formatRow(` ${colors.muted(getIcon("engine", config) + "Engine")}`, colors.text(engineValue)),
|
|
145
|
+
formatRow(` ${colors.muted(getIcon("package", config) + "Packager")}`, colors.text(packagerText)),
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
console.log(`\n ⚡ ${colors.brand("KRIMS CODE COMMAND STATION v" + version)} • Welcome back, ${colors.accent(username)}`);
|
|
149
|
+
|
|
150
|
+
// Draw Box
|
|
151
|
+
const leftLine = "═".repeat(2);
|
|
152
|
+
const rightLine = "═".repeat(boxWidth - 21);
|
|
153
|
+
const top = dim(` ╔${leftLine} `) + colors.brand("SYSTEM STATE") + dim(` ${rightLine}╗`);
|
|
154
|
+
console.log(top);
|
|
155
|
+
for (const row of rows) {
|
|
156
|
+
const visibleLen = getVisibleLength(row);
|
|
157
|
+
const padding = " ".repeat(Math.max(0, boxWidth - visibleLen - 2));
|
|
158
|
+
console.log(dim(" ║ ") + row + padding + dim(" ║"));
|
|
159
|
+
}
|
|
160
|
+
console.log(dim(` ╚${"═".repeat(boxWidth - 2)}╝`));
|
|
161
|
+
|
|
162
|
+
// 4. Quick Starter Cards (two columns)
|
|
163
|
+
const starters = [
|
|
164
|
+
{ cmd: "/explain", desc: "Analyze files in workspace" },
|
|
165
|
+
{ cmd: "/review", desc: "Review git changes (diffs)" },
|
|
166
|
+
{ cmd: "/diagnose",desc: "Auto-heal failing tests" },
|
|
167
|
+
{ cmd: "/dashboard",desc: "Launch visual telemetry HUD" },
|
|
168
|
+
{ cmd: "/autopilot",desc: "Start autonomous debug loop" },
|
|
169
|
+
{ cmd: "/game", desc: "Play mainframe hacking game" },
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
console.log(`\n ⚡ ${colors.brand("QUICK COMMAND STARTERS")}`);
|
|
173
|
+
if (boxWidth >= 80) {
|
|
174
|
+
// Print 2 columns
|
|
175
|
+
for (let i = 0; i < starters.length; i += 2) {
|
|
176
|
+
const s1 = starters[i];
|
|
177
|
+
const s2 = starters[i + 1];
|
|
178
|
+
|
|
179
|
+
const col1 = ` ${colors.accent(s1.cmd.padEnd(11))} ${colors.text(s1.desc.padEnd(28))}`;
|
|
180
|
+
const col2 = s2 ? ` ${colors.accent(s2.cmd.padEnd(11))} ${colors.text(s2.desc)}` : "";
|
|
181
|
+
|
|
182
|
+
console.log(col1 + col2);
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
// Print 1 column
|
|
186
|
+
for (const s of starters) {
|
|
187
|
+
console.log(` ${colors.accent(s.cmd.padEnd(11))} ${colors.text(s.desc)}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 5. Help / Footer info
|
|
192
|
+
console.log("\n" + separator("─"));
|
|
193
|
+
const footer = [
|
|
194
|
+
colors.dim(" Press "),
|
|
195
|
+
colors.accent("Tab"),
|
|
196
|
+
colors.dim(" to autocomplete file paths • Type "),
|
|
197
|
+
colors.accent("/help"),
|
|
198
|
+
colors.dim(" for all commands • "),
|
|
199
|
+
colors.accent("Ctrl+C"),
|
|
200
|
+
colors.dim(" to exit session")
|
|
201
|
+
].join("");
|
|
202
|
+
console.log(footer);
|
|
203
|
+
console.log(separator("─") + "\n");
|
|
204
|
+
}
|