@ch4p/cli 0.1.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.
- package/LICENSE +190 -0
- package/dist/agent-LRE3CXL3.js +761 -0
- package/dist/audit-BIGXGJSQ.js +12 -0
- package/dist/canvas-OIXBPYUL.js +313 -0
- package/dist/chunk-6BURGD2Y.js +290 -0
- package/dist/chunk-7EUURDQ5.js +6987 -0
- package/dist/chunk-CNLYUY2K.js +220 -0
- package/dist/chunk-GEFQONOB.js +1720 -0
- package/dist/chunk-IRNN57EQ.js +1810 -0
- package/dist/chunk-NMGPBPNU.js +154 -0
- package/dist/chunk-NRFRTZVP.js +289 -0
- package/dist/chunk-P6OXQDX2.js +4359 -0
- package/dist/chunk-PGZ24EFT.js +3388 -0
- package/dist/chunk-TEVLTQYT.js +185 -0
- package/dist/chunk-WL32AHUY.js +655 -0
- package/dist/chunk-YSCX2QQQ.js +88 -0
- package/dist/dist-VZE4JK7Q.js +25 -0
- package/dist/doctor-D6CEAUAC.js +274 -0
- package/dist/gateway-KZYTXCIQ.js +2062 -0
- package/dist/identity-S45KJKEO.js +215 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +200 -0
- package/dist/install-WROGJA5J.js +378 -0
- package/dist/message-JHZX6JBD.js +189 -0
- package/dist/onboard-ZVZLMMZP.js +849 -0
- package/dist/pairing-UOUSOB7K.js +147 -0
- package/dist/skills-UPJVALNY.js +138 -0
- package/dist/status-6HMA7CDS.js +94 -0
- package/dist/tools-2X5MBDEX.js +50 -0
- package/package.json +79 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BOLD,
|
|
3
|
+
DIM,
|
|
4
|
+
GREEN,
|
|
5
|
+
RESET,
|
|
6
|
+
TEAL,
|
|
7
|
+
WHITE,
|
|
8
|
+
centerPad,
|
|
9
|
+
termWidth
|
|
10
|
+
} from "./chunk-NMGPBPNU.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/splash.ts
|
|
13
|
+
var HIDE_CURSOR = "\x1B[?25l";
|
|
14
|
+
var SHOW_CURSOR = "\x1B[?25h";
|
|
15
|
+
var CLEAR_LINE = "\x1B[2K";
|
|
16
|
+
var MOVE_UP = (n) => `\x1B[${n}A`;
|
|
17
|
+
function getVersion() {
|
|
18
|
+
try {
|
|
19
|
+
if (typeof CH4P_VERSION === "string") return CH4P_VERSION;
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
return "0.1.0";
|
|
23
|
+
}
|
|
24
|
+
var CHAPPIE_ART = [
|
|
25
|
+
"@@@@@@@@*=#@@@@@@@@@@@@@@@@%%@@@@@@@@@@@@@@@",
|
|
26
|
+
"@@@@@@@@*==#@@@@@@@@@@@@@@@@*==@@@@@@@@@@@@@",
|
|
27
|
+
"@@@@@@@@#+==@@@@@@@%@@@@@@@@@@*==*@@@@@@@@@@",
|
|
28
|
+
"@@@@@@@@@++-*@@@@@%%@@@@@@@@@@@*-=+@@@@@@@@@",
|
|
29
|
+
"@@@@@@@@@%+=-@@@@@%#%@@@@@@@@@@@*-++%@@@@@@@",
|
|
30
|
+
"@@@@@@%%@@@@@@@#+=*@#+====++==-=#%@@#+*+%@@@",
|
|
31
|
+
"@@@@#***+=++@@@@%#+=***+**++===-++=+*+=+@@@@",
|
|
32
|
+
"@@@@###++*%%%@@@#*+++*****++=====+==----=#@@@",
|
|
33
|
+
"@@@@%@@@%@@@@@@#+**##%@@@@@@@%%#+++==-=#+@@@",
|
|
34
|
+
"@@@@@@@@%@@@@@@@*#%@@@@%%%%%%%%%%%%#++=%%@@@",
|
|
35
|
+
"@@@@%@@#*%@@@@@%##%##************#*#**=@@@@@",
|
|
36
|
+
"@@%####**#@@@@@%%#%#*+*+*###*+*=**#***+@@@@@",
|
|
37
|
+
"@@%####*##@@@@@@#%###%%%%%%#######%####@@@@@",
|
|
38
|
+
"@@@****+++%@@@@@@%#@@%@@@@@%%%@%@@###%%@@@@@",
|
|
39
|
+
"@@#***+==+*@@@@@@@%%%%%@@@@@@%%%#+=#%@@@@@@@",
|
|
40
|
+
"@@########%@@@%%@@@%#*##########=#%%@@@@@@@@",
|
|
41
|
+
"@@#%%%@%%##%@%#@@@@@@@%#######%%@%@@@@@@@@@@",
|
|
42
|
+
"@@%%%%%%%%%@@@%%##%@@@@@@%%%@@@%##%@@@@@@@@@",
|
|
43
|
+
"@@@@@@@@@@@@##*+**%%@@@@@@@%@@%%%%#*#@@@@@@@",
|
|
44
|
+
"@@%@%%%@@%#*%@%##%@@@@@@@@@@@@@%@@#*##====+#",
|
|
45
|
+
"@@%@@@@@@%%#%%%#*+*##@@@@@%**++**+===**-====",
|
|
46
|
+
"@@%@@%@@%%@@@@%##*+++**#%@%%####**+===-=++++",
|
|
47
|
+
"@@%%%@@@@@@@@@%%##**+*****++===--==---=-+%%%",
|
|
48
|
+
"@@@@@@@@@@@@@%%%#%%#=====-+*-****--*=-=*+@%*",
|
|
49
|
+
"@@@@@@@@@@%%@%%#####+=**==+==++===+*-=*%*@@@",
|
|
50
|
+
"@@@@@@@@@@@@@@%%%%%%%%%%%%#*********==***@%@",
|
|
51
|
+
"@@@@@@@@@@@@@@%**#@@@@@@@@@@@@@@@%#%%%%%%@@%",
|
|
52
|
+
"@@@@@@@@@@@@@@@@@%%%@@@@%%%%@%@@@@@@@%%@@@%#",
|
|
53
|
+
"@@@@@@@@@@@@@@@@@%*#%@%%%#+=#+=#%@@@@@@%%#*+"
|
|
54
|
+
];
|
|
55
|
+
function isTTY() {
|
|
56
|
+
return Boolean(process.stdout.isTTY);
|
|
57
|
+
}
|
|
58
|
+
function delay(ms, skip) {
|
|
59
|
+
return Promise.race([
|
|
60
|
+
new Promise((r) => setTimeout(() => r(false), ms)),
|
|
61
|
+
skip.then(() => true)
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
function createSkipController() {
|
|
65
|
+
let resolve;
|
|
66
|
+
const skipped = new Promise((r) => {
|
|
67
|
+
resolve = r;
|
|
68
|
+
});
|
|
69
|
+
let wasRaw;
|
|
70
|
+
const stdin = process.stdin;
|
|
71
|
+
if (stdin.isTTY) {
|
|
72
|
+
wasRaw = stdin.isRaw;
|
|
73
|
+
stdin.setRawMode(true);
|
|
74
|
+
stdin.resume();
|
|
75
|
+
}
|
|
76
|
+
const onData = () => resolve();
|
|
77
|
+
stdin.once("data", onData);
|
|
78
|
+
const cleanup = () => {
|
|
79
|
+
stdin.removeListener("data", onData);
|
|
80
|
+
if (stdin.isTTY) {
|
|
81
|
+
stdin.setRawMode(wasRaw ?? false);
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
stdin.pause();
|
|
85
|
+
} catch {
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return { skipped, cleanup };
|
|
89
|
+
}
|
|
90
|
+
function withCursorHidden(fn) {
|
|
91
|
+
process.stdout.write(HIDE_CURSOR);
|
|
92
|
+
const restore = () => process.stdout.write(SHOW_CURSOR);
|
|
93
|
+
const onExit = () => {
|
|
94
|
+
restore();
|
|
95
|
+
};
|
|
96
|
+
process.on("exit", onExit);
|
|
97
|
+
return fn().finally(() => {
|
|
98
|
+
process.removeListener("exit", onExit);
|
|
99
|
+
restore();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async function typewrite(text, skip, charDelay = 20, punctuationDelay = 40) {
|
|
103
|
+
for (let i = 0; i < text.length; i++) {
|
|
104
|
+
const char = text[i];
|
|
105
|
+
process.stdout.write(char);
|
|
106
|
+
if (char === "\x1B") {
|
|
107
|
+
const rest = text.slice(i + 1);
|
|
108
|
+
const match = rest.match(/^\[[0-9;]*m/);
|
|
109
|
+
if (match) {
|
|
110
|
+
process.stdout.write(match[0]);
|
|
111
|
+
i += match[0].length;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
let ms = charDelay;
|
|
116
|
+
if (".!,;:".includes(char)) ms = punctuationDelay;
|
|
117
|
+
if (char === "\n") ms = 100;
|
|
118
|
+
const wasSkipped = await delay(ms, skip);
|
|
119
|
+
if (wasSkipped) {
|
|
120
|
+
process.stdout.write(text.slice(i + 1));
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
function renderArtStatic(color) {
|
|
127
|
+
const width = termWidth();
|
|
128
|
+
for (const line of CHAPPIE_ART) {
|
|
129
|
+
const colored = `${color}${line}${RESET}`;
|
|
130
|
+
console.log(centerPad(colored, width));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function playFullAnimation() {
|
|
134
|
+
if (!isTTY()) {
|
|
135
|
+
console.log("");
|
|
136
|
+
renderArtStatic(TEAL);
|
|
137
|
+
console.log("");
|
|
138
|
+
console.log(` ${TEAL}${BOLD}ch4p${RESET} ${DIM}v${getVersion()}${RESET}`);
|
|
139
|
+
console.log(` ${DIM}Hello! I'm ch4p, your personal AI assistant.${RESET}`);
|
|
140
|
+
console.log(` ${DIM}Security-first. BEAM-inspired. Zero-dependency memory.${RESET}`);
|
|
141
|
+
console.log("");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
await withCursorHidden(async () => {
|
|
145
|
+
const { skipped, cleanup } = createSkipController();
|
|
146
|
+
try {
|
|
147
|
+
const width = termWidth();
|
|
148
|
+
const lineCount = CHAPPIE_ART.length;
|
|
149
|
+
console.log("");
|
|
150
|
+
for (let i = 0; i < lineCount; i++) {
|
|
151
|
+
const line = CHAPPIE_ART[i];
|
|
152
|
+
if (i > 0) {
|
|
153
|
+
process.stdout.write(MOVE_UP(1));
|
|
154
|
+
process.stdout.write(CLEAR_LINE);
|
|
155
|
+
const dimmed = `${TEAL}${CHAPPIE_ART[i - 1]}${RESET}`;
|
|
156
|
+
process.stdout.write(centerPad(dimmed, width) + "\n");
|
|
157
|
+
}
|
|
158
|
+
const bright = `${WHITE}${BOLD}${line}${RESET}`;
|
|
159
|
+
process.stdout.write(centerPad(bright, width) + "\n");
|
|
160
|
+
const wasSkipped = await delay(70, skipped);
|
|
161
|
+
if (wasSkipped) {
|
|
162
|
+
process.stdout.write(MOVE_UP(i + 2));
|
|
163
|
+
for (let j = 0; j <= i; j++) {
|
|
164
|
+
process.stdout.write(CLEAR_LINE + "\n");
|
|
165
|
+
}
|
|
166
|
+
process.stdout.write(MOVE_UP(i + 2));
|
|
167
|
+
console.log("");
|
|
168
|
+
renderArtStatic(TEAL);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (lineCount > 0) {
|
|
173
|
+
process.stdout.write(MOVE_UP(1));
|
|
174
|
+
process.stdout.write(CLEAR_LINE);
|
|
175
|
+
const lastDimmed = `${TEAL}${CHAPPIE_ART[lineCount - 1]}${RESET}`;
|
|
176
|
+
process.stdout.write(centerPad(lastDimmed, width) + "\n");
|
|
177
|
+
}
|
|
178
|
+
if (await delay(400, skipped)) {
|
|
179
|
+
cleanup();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
console.log("");
|
|
183
|
+
const welcome = ` ${TEAL}${BOLD}ch4p${RESET} ${DIM}v${getVersion()}${RESET}
|
|
184
|
+
${DIM}Hello! I'm ch4p, your personal AI assistant.${RESET}
|
|
185
|
+
${DIM}Security-first. BEAM-inspired. Zero-dependency memory.${RESET}
|
|
186
|
+
`;
|
|
187
|
+
await typewrite(welcome, skipped);
|
|
188
|
+
await delay(300, skipped);
|
|
189
|
+
console.log("");
|
|
190
|
+
} finally {
|
|
191
|
+
cleanup();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
async function playBriefSplash() {
|
|
196
|
+
if (!isTTY()) return;
|
|
197
|
+
await withCursorHidden(async () => {
|
|
198
|
+
const { skipped, cleanup } = createSkipController();
|
|
199
|
+
try {
|
|
200
|
+
console.log("");
|
|
201
|
+
renderArtStatic(DIM);
|
|
202
|
+
if (await delay(200, skipped)) {
|
|
203
|
+
cleanup();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
console.log("");
|
|
207
|
+
const versionLine = ` ${TEAL}${BOLD}ch4p${RESET} ${DIM}v${getVersion()}${RESET} ${GREEN}ready.${RESET}
|
|
208
|
+
`;
|
|
209
|
+
await typewrite(versionLine, skipped, 15);
|
|
210
|
+
await delay(100, skipped);
|
|
211
|
+
} finally {
|
|
212
|
+
cleanup();
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export {
|
|
218
|
+
playFullAnimation,
|
|
219
|
+
playBriefSplash
|
|
220
|
+
};
|