dave-code 1.0.2 → 1.0.4
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/bin/configManager.js +14 -0
- package/bin/index.js +22 -5
- package/bin/install.js +48 -0
- package/package.json +2 -1
package/bin/configManager.js
CHANGED
|
@@ -13,11 +13,25 @@ import os from 'os';
|
|
|
13
13
|
import { exec } from 'child_process';
|
|
14
14
|
|
|
15
15
|
export let CONFIG_FILE = path.join(os.homedir(), '.dave-code-config.json');
|
|
16
|
+
export let INITIALIZED_MARKER = path.join(os.homedir(), '.dave-code-initialized');
|
|
16
17
|
|
|
17
18
|
export function setConfigFilePathForTesting(filePath) {
|
|
18
19
|
CONFIG_FILE = filePath;
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
export function isFirstLaunch() {
|
|
23
|
+
return !fs.existsSync(INITIALIZED_MARKER);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function setInitialized() {
|
|
27
|
+
try {
|
|
28
|
+
fs.writeFileSync(INITIALIZED_MARKER, 'true', 'utf8');
|
|
29
|
+
return true;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
const TEMPLATE_CONFIG = [
|
|
22
36
|
{
|
|
23
37
|
"model": "deepseek-chat",
|
package/bin/index.js
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import fs from 'fs';
|
|
12
12
|
import path from 'path';
|
|
13
|
+
|
|
14
|
+
const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
15
|
+
const packageVersion = pkg.version;
|
|
13
16
|
import { exec } from 'child_process';
|
|
14
17
|
import { getLogoLines } from './logoRenderer.js';
|
|
15
18
|
import { hasApiKey, getAIResponse, sessionTokenUsage, resetTokenUsage } from './aiClient.js';
|
|
@@ -22,8 +25,11 @@ import {
|
|
|
22
25
|
openConfigFileInEditor,
|
|
23
26
|
getActiveEffort,
|
|
24
27
|
setActiveEffort,
|
|
25
|
-
EFFORT_PRESETS
|
|
28
|
+
EFFORT_PRESETS,
|
|
29
|
+
isFirstLaunch,
|
|
30
|
+
setInitialized
|
|
26
31
|
} from './configManager.js';
|
|
32
|
+
import { runWelcomeAnimation } from './install.js';
|
|
27
33
|
import {
|
|
28
34
|
selectMenu,
|
|
29
35
|
secureInputPrompt,
|
|
@@ -338,7 +344,7 @@ function drawHeader() {
|
|
|
338
344
|
const boxColor = '\x1b[38;2;250;100;30m';
|
|
339
345
|
const resetColor = '\x1b[0m';
|
|
340
346
|
|
|
341
|
-
const topBorder = boxColor + '┌── ' + resetColor +
|
|
347
|
+
const topBorder = boxColor + '┌── ' + resetColor + `\x1b[1mDave Code v${packageVersion}\x1b[0m` + boxColor + ' ' + '─'.repeat(boxWidth - 16 - packageVersion.length) + '┐' + resetColor;
|
|
342
348
|
const bottomBorder = boxColor + '└' + '─'.repeat(boxWidth) + '┘' + resetColor;
|
|
343
349
|
|
|
344
350
|
console.log(topBorder);
|
|
@@ -989,6 +995,17 @@ async function handleInput(input) {
|
|
|
989
995
|
}
|
|
990
996
|
|
|
991
997
|
// Start the UI
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
998
|
+
async function startApp() {
|
|
999
|
+
if (isFirstLaunch()) {
|
|
1000
|
+
clearConsole();
|
|
1001
|
+
await runWelcomeAnimation();
|
|
1002
|
+
setInitialized();
|
|
1003
|
+
// Wait briefly so the user can see the final successful initialization status
|
|
1004
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
1005
|
+
}
|
|
1006
|
+
clearConsole();
|
|
1007
|
+
drawHeader();
|
|
1008
|
+
promptUser();
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
startApp().catch(console.error);
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
|
|
3
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
|
+
|
|
5
|
+
export async function runWelcomeAnimation() {
|
|
6
|
+
console.log('\n\x1b[1;38;2;250;100;30m=== Welcome to Dave Code ===\x1b[0m\n');
|
|
7
|
+
|
|
8
|
+
// Stage 1: Environment Check
|
|
9
|
+
const spinner1 = ora({
|
|
10
|
+
text: 'Checking system environment & configurations...',
|
|
11
|
+
color: 'yellow',
|
|
12
|
+
spinner: 'dots'
|
|
13
|
+
}).start();
|
|
14
|
+
await sleep(1500);
|
|
15
|
+
spinner1.succeed('\x1b[32mEnvironment check completed! (Node.js ' + process.version + ')\x1b[0m');
|
|
16
|
+
|
|
17
|
+
// Stage 2: Downloading assets
|
|
18
|
+
const spinner2 = ora({
|
|
19
|
+
text: 'Downloading Dave Code core assets...',
|
|
20
|
+
color: 'cyan',
|
|
21
|
+
spinner: 'line'
|
|
22
|
+
}).start();
|
|
23
|
+
await sleep(2000);
|
|
24
|
+
spinner2.succeed('\x1b[32mAssets successfully downloaded!\x1b[0m');
|
|
25
|
+
|
|
26
|
+
// Stage 3: Initializing database
|
|
27
|
+
const spinner3 = ora({
|
|
28
|
+
text: 'Building local database & cache indices...',
|
|
29
|
+
color: 'magenta',
|
|
30
|
+
spinner: 'circle'
|
|
31
|
+
}).start();
|
|
32
|
+
await sleep(1500);
|
|
33
|
+
spinner3.succeed('\x1b[32mDatabase initialized!\x1b[0m');
|
|
34
|
+
|
|
35
|
+
// Stage 4: Success art and message
|
|
36
|
+
console.log('\n\x1b[38;2;140;90;240m' +
|
|
37
|
+
` ____ ______ __
|
|
38
|
+
/ __ \\____ __ _____ / ____/___ ____/ /__
|
|
39
|
+
/ / / / __ \`/ | / / _ \\ / / / __ \\/ __ / _ \\
|
|
40
|
+
/ /_/ / /_/ /| |/ / __// /___/ /_/ / /_/ / __/
|
|
41
|
+
/_____/\\__,_/ |___/\\___/ \\____/\\____/\\__,_/\\___/ ` + '\x1b[0m\n');
|
|
42
|
+
|
|
43
|
+
console.log('\x1b[1;32m✔ Initialization completed successfully! 🎉\x1b[0m');
|
|
44
|
+
console.log('\x1b[90m--------------------------------------------------\x1b[0m');
|
|
45
|
+
console.log('🚀 \x1b[1;36mDave Code\x1b[0m is now ready for use!');
|
|
46
|
+
console.log('💡 Type \x1b[33mcalldave\x1b[0m in your terminal to start pair programming.');
|
|
47
|
+
console.log('\x1b[90m--------------------------------------------------\x1b[0m\n');
|
|
48
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dave-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A terminal-based AI coding assistant CLI similar to Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"calldave": "bin/index.js"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"cli",
|
|
12
13
|
"ai",
|