@vellumai/cli 0.3.4 → 0.3.5
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/package.json +3 -2
- package/src/lib/assistant-config.ts +18 -15
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vellumai/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "CLI tools for vellum-assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./src/index.ts",
|
|
8
8
|
"./package.json": "./package.json",
|
|
9
9
|
"./src/components/DefaultMainScreen": "./src/components/DefaultMainScreen.tsx",
|
|
10
|
-
"./src/lib/constants": "./src/lib/constants.ts"
|
|
10
|
+
"./src/lib/constants": "./src/lib/constants.ts",
|
|
11
|
+
"./src/commands/*": "./src/commands/*.ts"
|
|
11
12
|
},
|
|
12
13
|
"bin": {
|
|
13
14
|
"vellum-cli": "./src/index.ts"
|
|
@@ -22,30 +22,33 @@ interface LockfileData {
|
|
|
22
22
|
[key: string]: unknown;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function
|
|
26
|
-
return
|
|
25
|
+
function getBaseDir(): string {
|
|
26
|
+
return process.env.BASE_DATA_DIR?.trim() || homedir();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function readLockfile(): LockfileData {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
const base = getBaseDir();
|
|
31
|
+
const candidates = [
|
|
32
|
+
join(base, ".vellum.lock.json"),
|
|
33
|
+
join(base, ".vellum.lockfile.json"),
|
|
34
|
+
];
|
|
35
|
+
for (const lockfilePath of candidates) {
|
|
36
|
+
if (!existsSync(lockfilePath)) continue;
|
|
37
|
+
try {
|
|
38
|
+
const raw = readFileSync(lockfilePath, "utf-8");
|
|
39
|
+
const parsed = JSON.parse(raw) as unknown;
|
|
40
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
41
|
+
return parsed as LockfileData;
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
// Malformed lockfile; try next
|
|
40
45
|
}
|
|
41
|
-
} catch {
|
|
42
|
-
// Malformed lockfile; return empty
|
|
43
46
|
}
|
|
44
47
|
return {};
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
function writeLockfile(data: LockfileData): void {
|
|
48
|
-
const lockfilePath =
|
|
51
|
+
const lockfilePath = join(getBaseDir(), ".vellum.lock.json");
|
|
49
52
|
writeFileSync(lockfilePath, JSON.stringify(data, null, 2) + "\n");
|
|
50
53
|
}
|
|
51
54
|
|