@vibe-lark/larkpal 0.1.16 → 0.1.18
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/main.mjs +23 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { basename, dirname, join } from "node:path";
|
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import "dotenv/config";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
|
+
import { access, lstat, mkdir, readFile, readdir, readlink, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
10
11
|
import { execSync, spawn } from "node:child_process";
|
|
11
|
-
import { access, mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
12
12
|
import { createInterface } from "node:readline";
|
|
13
13
|
import { v4, v5 } from "uuid";
|
|
14
14
|
import { EventEmitter } from "node:events";
|
|
@@ -12227,6 +12227,28 @@ async function main() {
|
|
|
12227
12227
|
delete process.env.LARK_APP_SECRET;
|
|
12228
12228
|
logger.info("已从 process.env 清除 LARK_APP_SECRET(CC 子进程不可继承)");
|
|
12229
12229
|
}
|
|
12230
|
+
const workspaceEnv = process.env.LARKPAL_WORKSPACE;
|
|
12231
|
+
if (workspaceEnv) {
|
|
12232
|
+
const claudeDir = join(homedir(), ".claude");
|
|
12233
|
+
const persistentClaudeDir = join(workspaceEnv, ".claude");
|
|
12234
|
+
await mkdir(persistentClaudeDir, { recursive: true });
|
|
12235
|
+
let needsLink = true;
|
|
12236
|
+
try {
|
|
12237
|
+
if ((await lstat(claudeDir)).isSymbolicLink()) if (await readlink(claudeDir) === persistentClaudeDir) needsLink = false;
|
|
12238
|
+
else await rm(claudeDir, { force: true });
|
|
12239
|
+
else await rm(claudeDir, {
|
|
12240
|
+
recursive: true,
|
|
12241
|
+
force: true
|
|
12242
|
+
});
|
|
12243
|
+
} catch {}
|
|
12244
|
+
if (needsLink) {
|
|
12245
|
+
await symlink(persistentClaudeDir, claudeDir);
|
|
12246
|
+
logger.info("~/.claude 已链接到持久卷", {
|
|
12247
|
+
from: claudeDir,
|
|
12248
|
+
to: persistentClaudeDir
|
|
12249
|
+
});
|
|
12250
|
+
}
|
|
12251
|
+
}
|
|
12230
12252
|
await ensureDefaults();
|
|
12231
12253
|
logger.info("默认配置检查完成");
|
|
12232
12254
|
const workspaceRoot = process.env.LARKPAL_WORKSPACE ?? join(homedir(), ".larkpal", "workspace");
|