dave-code 1.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.
- package/LICENSE +15 -0
- package/README.md +53 -0
- package/assets/dave-octopus.ico +0 -0
- package/assets/dave-octopus.png +0 -0
- package/bin/aiClient.js +243 -0
- package/bin/cliMenu.js +496 -0
- package/bin/configManager.js +220 -0
- package/bin/index.js +994 -0
- package/bin/logoRenderer.js +71 -0
- package/package.json +29 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
import { PNG } from 'pngjs';
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
|
|
9
|
+
export function getLogoLines() {
|
|
10
|
+
try {
|
|
11
|
+
const logoPath = join(__dirname, '..', 'assets', 'dave-octopus.png');
|
|
12
|
+
const fileBuffer = fs.readFileSync(logoPath);
|
|
13
|
+
const png = PNG.sync.read(fileBuffer);
|
|
14
|
+
|
|
15
|
+
const { width, height, data } = png;
|
|
16
|
+
const lines = [];
|
|
17
|
+
|
|
18
|
+
const targetWidth = 32;
|
|
19
|
+
const targetHeight = 32;
|
|
20
|
+
const scaleX = width / targetWidth;
|
|
21
|
+
const scaleY = height / targetHeight;
|
|
22
|
+
|
|
23
|
+
// Process 2 rows at a time
|
|
24
|
+
for (let y = 0; y < targetHeight; y += 2) {
|
|
25
|
+
let line = '';
|
|
26
|
+
for (let x = 0; x < targetWidth; x++) {
|
|
27
|
+
// Map target coordinate to source coordinate
|
|
28
|
+
const srcX = Math.floor(x * scaleX);
|
|
29
|
+
const srcY1 = Math.floor(y * scaleY);
|
|
30
|
+
const srcY2 = Math.floor((y + 1) * scaleY);
|
|
31
|
+
|
|
32
|
+
const idx1 = (srcY1 * width + srcX) * 4;
|
|
33
|
+
const idx2 = (srcY2 * width + srcX) * 4;
|
|
34
|
+
|
|
35
|
+
const r1 = data[idx1];
|
|
36
|
+
const g1 = data[idx1 + 1];
|
|
37
|
+
const b1 = data[idx1 + 2];
|
|
38
|
+
const a1 = data[idx1 + 3];
|
|
39
|
+
|
|
40
|
+
let r2 = 0, g2 = 0, b2 = 0, a2 = 0;
|
|
41
|
+
if (srcY2 < height) {
|
|
42
|
+
r2 = data[idx2];
|
|
43
|
+
g2 = data[idx2 + 1];
|
|
44
|
+
b2 = data[idx2 + 2];
|
|
45
|
+
a2 = data[idx2 + 3];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const topTransparent = a1 < 128;
|
|
49
|
+
const bottomTransparent = a2 < 128;
|
|
50
|
+
|
|
51
|
+
if (topTransparent && bottomTransparent) {
|
|
52
|
+
line += ' '; // Transparent space
|
|
53
|
+
} else if (!topTransparent && bottomTransparent) {
|
|
54
|
+
// Top color, bottom transparent -> use top half block '▀'
|
|
55
|
+
line += `\x1b[38;2;${r1};${g1};${b1}m▀\x1b[0m`;
|
|
56
|
+
} else if (topTransparent && !bottomTransparent) {
|
|
57
|
+
// Top transparent, bottom color -> use bottom half block '▄'
|
|
58
|
+
line += `\x1b[38;2;${r2};${g2};${b2}m▄\x1b[0m`;
|
|
59
|
+
} else {
|
|
60
|
+
// Both colored -> foreground = bottom, background = top, character = '▄'
|
|
61
|
+
line += `\x1b[38;2;${r2};${g2};${b2};48;2;${r1};${g1};${b1}m▄\x1b[0m`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
lines.push(line);
|
|
65
|
+
}
|
|
66
|
+
return lines;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
// Return empty array if file reading fails
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dave-code",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A terminal-based AI coding assistant CLI similar to Claude Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "bin/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"calldave": "bin/index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"cli",
|
|
12
|
+
"ai",
|
|
13
|
+
"assistant",
|
|
14
|
+
"agent"
|
|
15
|
+
],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"assets",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"https-proxy-agent": "^9.1.0",
|
|
26
|
+
"pngjs": "^7.0.0",
|
|
27
|
+
"undici": "^8.5.0"
|
|
28
|
+
}
|
|
29
|
+
}
|