@emqo/claudebridge 0.1.2 → 0.1.3
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 +9 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -36,6 +36,7 @@ const cmd = args.find(a => !a.startsWith("-")) || "start";
|
|
|
36
36
|
const cfgIdx = args.indexOf("--config");
|
|
37
37
|
const cfgPath = cfgIdx !== -1 ? args[cfgIdx + 1] : undefined;
|
|
38
38
|
const daemon = args.includes("--daemon") || args.includes("-d");
|
|
39
|
+
const DEFAULT_CFG = join(DIR, "config.yaml");
|
|
39
40
|
switch (cmd) {
|
|
40
41
|
case "start": {
|
|
41
42
|
const existing = readPid();
|
|
@@ -43,7 +44,8 @@ switch (cmd) {
|
|
|
43
44
|
console.log(`Already running (PID ${existing})`);
|
|
44
45
|
process.exit(0);
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
+
const resolvedCfg = cfgPath || DEFAULT_CFG;
|
|
48
|
+
const childArgs = [ENTRY, "--config", resolvedCfg];
|
|
47
49
|
if (daemon) {
|
|
48
50
|
ensureDir();
|
|
49
51
|
const { openSync } = await import("fs");
|
|
@@ -96,8 +98,10 @@ switch (cmd) {
|
|
|
96
98
|
break;
|
|
97
99
|
}
|
|
98
100
|
case "init": {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
ensureDir();
|
|
102
|
+
const target = cfgPath || DEFAULT_CFG;
|
|
103
|
+
if (existsSync(target)) {
|
|
104
|
+
console.log(`${target} already exists`);
|
|
101
105
|
process.exit(0);
|
|
102
106
|
}
|
|
103
107
|
const example = join(__dirname, "..", "config.yaml.example");
|
|
@@ -105,8 +109,8 @@ switch (cmd) {
|
|
|
105
109
|
console.error("config.yaml.example not found");
|
|
106
110
|
process.exit(1);
|
|
107
111
|
}
|
|
108
|
-
copyFileSync(example,
|
|
109
|
-
console.log(
|
|
112
|
+
copyFileSync(example, target);
|
|
113
|
+
console.log(`Created ${target} from template`);
|
|
110
114
|
break;
|
|
111
115
|
}
|
|
112
116
|
default:
|