@llmist/cli 9.1.1 → 9.1.2
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/dist/cli.js +5 -3
- package/dist/cli.js.map +1 -1
- package/package.json +5 -3
- package/scripts/postinstall.js +66 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmist/cli",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "CLI for llmist - run LLM agents from the command line",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cli.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"build": "tsup",
|
|
13
13
|
"typecheck": "tsc --noEmit",
|
|
14
14
|
"test": "bun test src",
|
|
15
|
-
"clean": "rimraf dist"
|
|
15
|
+
"clean": "rimraf dist",
|
|
16
|
+
"postinstall": "node scripts/postinstall.js"
|
|
16
17
|
},
|
|
17
18
|
"repository": {
|
|
18
19
|
"type": "git",
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
"access": "public"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
|
-
"dist"
|
|
27
|
+
"dist",
|
|
28
|
+
"scripts"
|
|
27
29
|
],
|
|
28
30
|
"keywords": [
|
|
29
31
|
"llmist",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall script to fix @unblessed/core data path bug.
|
|
4
|
+
*
|
|
5
|
+
* Bug: @unblessed/core's getDataPath() resolves to dist/data but actual
|
|
6
|
+
* data files are at package root's data/ directory.
|
|
7
|
+
*
|
|
8
|
+
* Fix: Create symlink dist/data -> ../data
|
|
9
|
+
*/
|
|
10
|
+
import {
|
|
11
|
+
existsSync,
|
|
12
|
+
symlinkSync,
|
|
13
|
+
mkdirSync,
|
|
14
|
+
readdirSync,
|
|
15
|
+
copyFileSync,
|
|
16
|
+
statSync,
|
|
17
|
+
} from "node:fs";
|
|
18
|
+
import { join, dirname } from "node:path";
|
|
19
|
+
import { createRequire } from "node:module";
|
|
20
|
+
|
|
21
|
+
// Use require.resolve to find @unblessed/core regardless of hoisting
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
// Find the actual location of @unblessed/core
|
|
26
|
+
const coreIndexPath = require.resolve("@unblessed/core");
|
|
27
|
+
const coreDir = dirname(coreIndexPath);
|
|
28
|
+
|
|
29
|
+
// Handle both dist/index.js and top-level index.js layouts
|
|
30
|
+
const packageRoot = coreDir.endsWith("dist")
|
|
31
|
+
? dirname(coreDir)
|
|
32
|
+
: coreDir;
|
|
33
|
+
|
|
34
|
+
const distDir = join(packageRoot, "dist");
|
|
35
|
+
const dataDir = join(packageRoot, "data");
|
|
36
|
+
const targetPath = join(distDir, "data");
|
|
37
|
+
|
|
38
|
+
// Only run if data directory exists but dist/data doesn't
|
|
39
|
+
if (existsSync(dataDir) && existsSync(distDir) && !existsSync(targetPath)) {
|
|
40
|
+
try {
|
|
41
|
+
// Try symlink first (works on Unix, may fail on Windows without admin)
|
|
42
|
+
symlinkSync("../data", targetPath, "junction");
|
|
43
|
+
} catch {
|
|
44
|
+
// Fall back to directory copy on Windows or if symlink fails
|
|
45
|
+
copyDir(dataDir, targetPath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
// @unblessed/core not found - this is fine, postinstall runs for all installs
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Recursively copy a directory.
|
|
54
|
+
*/
|
|
55
|
+
function copyDir(src, dest) {
|
|
56
|
+
mkdirSync(dest, { recursive: true });
|
|
57
|
+
for (const entry of readdirSync(src)) {
|
|
58
|
+
const srcPath = join(src, entry);
|
|
59
|
+
const destPath = join(dest, entry);
|
|
60
|
+
if (statSync(srcPath).isDirectory()) {
|
|
61
|
+
copyDir(srcPath, destPath);
|
|
62
|
+
} else {
|
|
63
|
+
copyFileSync(srcPath, destPath);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|