pikiloom 0.4.2 → 0.4.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.
Files changed (2) hide show
  1. package/dist/cli/main.js +15 -4
  2. package/package.json +3 -2
package/dist/cli/main.js CHANGED
@@ -319,9 +319,10 @@ Docs: https://github.com/xiaotonng/pikiloom
319
319
  /**
320
320
  * For a fresh CLI launch (not a daemon-managed child), persist the working
321
321
  * directory into setting.json so the bot defaults to where the user invoked
322
- * the command. Without `-w`, fall back to the cwd; this is preserved across
323
- * non-daemon self-restarts because process-control inherits cwd when spawning
324
- * the replacement process.
322
+ * the command. An explicit `-w` always wins and is saved. Without `-w`, a
323
+ * previously saved workdir (including one chosen later in the dashboard) is
324
+ * kept as-is; we only fall back to the launch cwd on first run, when nothing
325
+ * has been saved yet, so relaunching never silently reverts the workdir.
325
326
  */
326
327
  function persistWorkdir(args, userConfig) {
327
328
  if (process.env.PIKILOOM_DAEMON_CHILD)
@@ -331,7 +332,17 @@ function persistWorkdir(args, userConfig) {
331
332
  // whatever the user previously chose interactively.
332
333
  if (process.env[FROM_LAUNCHD_ENV])
333
334
  return userConfig;
334
- const nextWorkdir = path.resolve(args.workdir || process.cwd());
335
+ // An explicit `-w` is a deliberate choice and always wins. Without it, a
336
+ // workdir the user already saved (e.g. picked in the dashboard via
337
+ // `/api/switch-workdir`) must survive relaunch — otherwise every fresh
338
+ // `npx pikiloom` silently reverts the workdir to its launch cwd. Only fall
339
+ // back to cwd on first run, when nothing has been saved yet.
340
+ const explicitWorkdir = typeof args.workdir === 'string' && args.workdir.trim()
341
+ ? args.workdir.trim()
342
+ : '';
343
+ if (!explicitWorkdir && userConfig.workdir)
344
+ return userConfig;
345
+ const nextWorkdir = path.resolve(explicitWorkdir || process.cwd());
335
346
  if (userConfig.workdir === nextWorkdir)
336
347
  return userConfig;
337
348
  updateUserConfig({ workdir: nextWorkdir });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pikiloom",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Put the world's smartest AI agents in your pocket. Command local Claude & Gemini via IM. | 让最好用的 IM 变成你电脑上的顶级 Agent 控制台",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,8 @@
31
31
  "dev": "bash scripts/dev.sh",
32
32
  "command": "set -ae && . ./.env && set +a && tsx src/cli/run.ts",
33
33
  "build:dashboard": "vite build --config dashboard/vite.config.ts",
34
- "build": "npm run build:dashboard && tsc",
34
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
35
+ "build": "npm run clean && npm run build:dashboard && tsc",
35
36
  "prepack": "npm run build",
36
37
  "test": "vitest run",
37
38
  "test:watch": "vitest"