dave-code 1.0.3 → 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 +3 -5
- package/package.json +2 -4
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
CHANGED
|
@@ -2,8 +2,8 @@ import ora from 'ora';
|
|
|
2
2
|
|
|
3
3
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
4
|
|
|
5
|
-
async function
|
|
6
|
-
console.log('\n\x1b[1;38;2;250;100;30m=== Dave Code
|
|
5
|
+
export async function runWelcomeAnimation() {
|
|
6
|
+
console.log('\n\x1b[1;38;2;250;100;30m=== Welcome to Dave Code ===\x1b[0m\n');
|
|
7
7
|
|
|
8
8
|
// Stage 1: Environment Check
|
|
9
9
|
const spinner1 = ora({
|
|
@@ -40,11 +40,9 @@ async function runInstallationAnimation() {
|
|
|
40
40
|
/ /_/ / /_/ /| |/ / __// /___/ /_/ / /_/ / __/
|
|
41
41
|
/_____/\\__,_/ |___/\\___/ \\____/\\____/\\__,_/\\___/ ` + '\x1b[0m\n');
|
|
42
42
|
|
|
43
|
-
console.log('\x1b[1;32m✔
|
|
43
|
+
console.log('\x1b[1;32m✔ Initialization completed successfully! 🎉\x1b[0m');
|
|
44
44
|
console.log('\x1b[90m--------------------------------------------------\x1b[0m');
|
|
45
45
|
console.log('🚀 \x1b[1;36mDave Code\x1b[0m is now ready for use!');
|
|
46
46
|
console.log('💡 Type \x1b[33mcalldave\x1b[0m in your terminal to start pair programming.');
|
|
47
47
|
console.log('\x1b[90m--------------------------------------------------\x1b[0m\n');
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
runInstallationAnimation().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,15 +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": {
|
|
11
|
-
"postinstall": "node bin/install.js"
|
|
12
|
-
},
|
|
10
|
+
"scripts": {},
|
|
13
11
|
"keywords": [
|
|
14
12
|
"cli",
|
|
15
13
|
"ai",
|