engine7 7.0.4 → 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.
- package/dist/cli.mjs +57 -10
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -26,9 +26,8 @@ function parseArgs() {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (!stateDir) {
|
|
29
|
-
|
|
30
|
-
console.
|
|
31
|
-
process.exit(1);
|
|
29
|
+
stateDir = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7");
|
|
30
|
+
console.log(` \u4F7F\u7528\u9ED8\u8BA4\u76EE\u5F55: ${stateDir}`);
|
|
32
31
|
}
|
|
33
32
|
stateDir = path.resolve(stateDir);
|
|
34
33
|
return { stateDir, quick, dryRun: dryRun2 };
|
|
@@ -468,13 +467,27 @@ engine7 start \u2014 \u542F\u52A8 Engine
|
|
|
468
467
|
}
|
|
469
468
|
if (!configPath2) {
|
|
470
469
|
const defaultCfg = path.join("configs", "main7.json");
|
|
470
|
+
const homeCfg = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7", "configs", "main7.json");
|
|
471
471
|
if (fs.existsSync(defaultCfg)) {
|
|
472
472
|
configPath2 = defaultCfg;
|
|
473
|
+
} else if (fs.existsSync(homeCfg)) {
|
|
474
|
+
configPath2 = homeCfg;
|
|
475
|
+
console.log(` \u4F7F\u7528\u9ED8\u8BA4 config: ${homeCfg}`);
|
|
473
476
|
} else {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
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
|
+
}
|
|
478
491
|
}
|
|
479
492
|
}
|
|
480
493
|
const { execSync, spawn } = await import("node:child_process");
|
|
@@ -540,7 +553,28 @@ engine7 service \u2014 \u5F00\u673A\u81EA\u542F\u52A8\u7BA1\u7406
|
|
|
540
553
|
}
|
|
541
554
|
if (!configPath2) {
|
|
542
555
|
const defaultCfg = path.join(cwd, "configs", "main7.json");
|
|
543
|
-
|
|
556
|
+
const homeCfg = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7", "configs", "main7.json");
|
|
557
|
+
if (fs.existsSync(defaultCfg)) {
|
|
558
|
+
configPath2 = defaultCfg;
|
|
559
|
+
} else if (fs.existsSync(homeCfg)) {
|
|
560
|
+
configPath2 = homeCfg;
|
|
561
|
+
cwd = path.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7");
|
|
562
|
+
} else {
|
|
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
|
+
}
|
|
577
|
+
}
|
|
544
578
|
}
|
|
545
579
|
const { execSync } = await import("node:child_process");
|
|
546
580
|
const engine7Bin = process.argv[1];
|
|
@@ -735,10 +769,15 @@ WantedBy=default.target`;
|
|
|
735
769
|
console.log(`
|
|
736
770
|
\u2705 \u521D\u59CB\u5316\u5B8C\u6210\uFF01
|
|
737
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`);
|
|
738
776
|
console.log(`\u4E0B\u4E00\u6B65\uFF1A`);
|
|
739
777
|
console.log(` 1. \u68C0\u67E5\u5E76\u4FEE\u6539 ${opts.stateDir}/configs/main7.json`);
|
|
740
|
-
console.log(` 2. \u542F\u52A8 Engine:
|
|
741
|
-
console.log(` 3. \
|
|
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")}`);
|
|
742
781
|
}
|
|
743
782
|
}
|
|
744
783
|
function copyDirRecursive(src, dest) {
|
|
@@ -764,6 +803,14 @@ function findTemplateDir(name) {
|
|
|
764
803
|
}
|
|
765
804
|
return null;
|
|
766
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
|
+
}
|
|
767
814
|
main().catch((err) => {
|
|
768
815
|
console.error(`
|
|
769
816
|
\u274C \u5931\u8D25: ${err.message}`);
|