engine7 7.0.5 → 7.0.6

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.mjs +43 -10
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -474,10 +474,20 @@ engine7 start \u2014 \u542F\u52A8 Engine
474
474
  configPath2 = homeCfg;
475
475
  console.log(` \u4F7F\u7528\u9ED8\u8BA4 config: ${homeCfg}`);
476
476
  } else {
477
- console.error("\u274C \u627E\u4E0D\u5230 config \u6587\u4EF6");
478
- console.error(" \u7528\u6CD5: engine7 start --config <path>");
479
- console.error(" \u6216\u5148\u8FD0\u884C: engine7 init\uFF08\u9ED8\u8BA4\u521B\u5EFA ~/.engine7\uFF09");
480
- process.exit(1);
477
+ const ptr = readHomePointer();
478
+ if (ptr?.stateDir) {
479
+ const ptrCfg = path.join(ptr.stateDir, "configs", "main7.json");
480
+ if (fs.existsSync(ptrCfg)) {
481
+ configPath2 = ptrCfg;
482
+ console.log(` \u4F7F\u7528 config: ${ptrCfg}`);
483
+ }
484
+ }
485
+ if (!configPath2) {
486
+ console.error("\u274C \u627E\u4E0D\u5230 config \u6587\u4EF6");
487
+ console.error(" \u7528\u6CD5: engine7 start --config <path>");
488
+ console.error(" \u6216\u5148\u8FD0\u884C: engine7 init");
489
+ process.exit(1);
490
+ }
481
491
  }
482
492
  }
483
493
  const { execSync, spawn } = await import("node:child_process");
@@ -550,10 +560,20 @@ engine7 service \u2014 \u5F00\u673A\u81EA\u542F\u52A8\u7BA1\u7406
550
560
  configPath2 = homeCfg;
551
561
  cwd = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7");
552
562
  } else {
553
- console.error("\u274C \u627E\u4E0D\u5230 config \u6587\u4EF6");
554
- console.error(" \u7528\u6CD5: engine7 service install --config <path>");
555
- console.error(" \u6216\u5148\u8FD0\u884C: engine7 init\uFF08\u9ED8\u8BA4\u521B\u5EFA ~/.engine7\uFF09");
556
- process.exit(1);
563
+ const ptr = readHomePointer();
564
+ if (ptr?.stateDir) {
565
+ const ptrCfg = path.join(ptr.stateDir, "configs", "main7.json");
566
+ if (fs.existsSync(ptrCfg)) {
567
+ configPath2 = ptrCfg;
568
+ cwd = ptr.stateDir;
569
+ }
570
+ }
571
+ if (!configPath2) {
572
+ console.error("\u274C \u627E\u4E0D\u5230 config \u6587\u4EF6");
573
+ console.error(" \u7528\u6CD5: engine7 service install --config <path>");
574
+ console.error(" \u6216\u5148\u8FD0\u884C: engine7 init");
575
+ process.exit(1);
576
+ }
557
577
  }
558
578
  }
559
579
  const { execSync } = await import("node:child_process");
@@ -749,10 +769,15 @@ WantedBy=default.target`;
749
769
  console.log(`
750
770
  \u2705 \u521D\u59CB\u5316\u5B8C\u6210\uFF01
751
771
  `);
772
+ const homePointer = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7.json");
773
+ const pointerData = { stateDir: opts.stateDir };
774
+ fs.writeFileSync(homePointer, JSON.stringify(pointerData, null, 2) + "\n");
775
+ console.log(` \u{1F4C4} ${homePointer}\uFF08\u4ECE\u4EFB\u610F\u76EE\u5F55\u90FD\u80FD\u627E\u5230\u6B64 agent\uFF09`);
752
776
  console.log(`\u4E0B\u4E00\u6B65\uFF1A`);
753
777
  console.log(` 1. \u68C0\u67E5\u5E76\u4FEE\u6539 ${opts.stateDir}/configs/main7.json`);
754
- console.log(` 2. \u542F\u52A8 Engine: cd ${opts.stateDir} && engine7 start`);
755
- console.log(` 3. \u67E5\u770B workspace: ${path.join(opts.stateDir, "workspace")}`);
778
+ console.log(` 2. \u542F\u52A8 Engine: engine7 start\uFF08\u5728\u4EFB\u610F\u76EE\u5F55\u90FD\u884C\uFF09`);
779
+ console.log(` 3. \u5F00\u673A\u81EA\u542F: engine7 service install\uFF08\u5728\u4EFB\u610F\u76EE\u5F55\u90FD\u884C\uFF09`);
780
+ console.log(` 4. \u67E5\u770B workspace: ${path.join(opts.stateDir, "workspace")}`);
756
781
  }
757
782
  }
758
783
  function copyDirRecursive(src, dest) {
@@ -778,6 +803,14 @@ function findTemplateDir(name) {
778
803
  }
779
804
  return null;
780
805
  }
806
+ function readHomePointer() {
807
+ const ptrPath = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7.json");
808
+ try {
809
+ return JSON.parse(fs.readFileSync(ptrPath, "utf-8"));
810
+ } catch {
811
+ return null;
812
+ }
813
+ }
781
814
  main().catch((err) => {
782
815
  console.error(`
783
816
  \u274C \u5931\u8D25: ${err.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "engine7",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
4
4
  "type": "module",
5
5
  "description": "Engine 7 — Self-hosted AI agent engine",
6
6
  "main": "dist/main.mjs",