@kelceyp/caw 1.0.17 → 1.0.19
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/README.md +1 -1
- package/dist/caw.js +385 -114
- package/package.json +3 -5
package/README.md
CHANGED
|
@@ -192,7 +192,7 @@ All optional integrations are configured via Preferences > Infrastructure in the
|
|
|
192
192
|
|
|
193
193
|
## Links
|
|
194
194
|
|
|
195
|
-
- [Report an Issue or request a Feature](https://github.com/kelceyp/caw-feedback/issues)
|
|
195
|
+
- [Report an Issue or request a Feature](https://github.com/kelceyp-mcp-servers/caw-feedback/issues)
|
|
196
196
|
|
|
197
197
|
## License
|
|
198
198
|
|
package/dist/caw.js
CHANGED
|
@@ -10494,6 +10494,17 @@ var globalHandlerRegistry = new Map;
|
|
|
10494
10494
|
import fs2 from "node:fs";
|
|
10495
10495
|
import path from "node:path";
|
|
10496
10496
|
import { execSync } from "node:child_process";
|
|
10497
|
+
var NVM_INSTALLER_VERSION = "v0.40.3";
|
|
10498
|
+
function buildPrefixWritableMessage(prefix) {
|
|
10499
|
+
return `The npm global prefix directory is not writable: ${prefix}
|
|
10500
|
+
` + `This may prevent installing or updating caw-server.
|
|
10501
|
+
|
|
10502
|
+
` + `Options:
|
|
10503
|
+
` + ` 1. Continue anyway (installation may fail; sudo installs work
|
|
10504
|
+
` + " day 1 but require `sudo npm install -g …` at every future\n" + " `caw upgrade`)\n" + ` 2. Use nvm to get a user-owned prefix (recommended)
|
|
10505
|
+
` + ` After reloading your shell you may see a
|
|
10506
|
+
` + " `zsh compinit: insecure directories` warning — run\n" + " `compaudit` (full guidance printed after you pick this option)\n" + " 3. Exit and fix permissions manually";
|
|
10507
|
+
}
|
|
10497
10508
|
function checkGlobalInstall() {
|
|
10498
10509
|
const scriptPath = process.argv[1];
|
|
10499
10510
|
if (!scriptPath) {
|
|
@@ -10544,22 +10555,76 @@ function checkPrefixWritable() {
|
|
|
10544
10555
|
} catch {
|
|
10545
10556
|
return {
|
|
10546
10557
|
ok: false,
|
|
10547
|
-
message:
|
|
10548
|
-
` + `This may prevent installing or updating caw-server.
|
|
10549
|
-
|
|
10550
|
-
` + `Options:
|
|
10551
|
-
` + ` 1. Continue anyway (installation may fail)
|
|
10552
|
-
` + ` 2. Use nvm to get a user-owned prefix (recommended)
|
|
10553
|
-
` + ` curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
|
10554
|
-
` + " 3. Exit and fix permissions manually"
|
|
10558
|
+
message: buildPrefixWritableMessage(prefix)
|
|
10555
10559
|
};
|
|
10556
10560
|
}
|
|
10557
10561
|
}
|
|
10558
10562
|
|
|
10559
10563
|
// src/server-info.js
|
|
10560
10564
|
import fs3 from "node:fs";
|
|
10561
|
-
import
|
|
10565
|
+
import path3 from "node:path";
|
|
10562
10566
|
import { execSync as execSync2 } from "node:child_process";
|
|
10567
|
+
|
|
10568
|
+
// src/package-version.js
|
|
10569
|
+
import { readFileSync } from "fs";
|
|
10570
|
+
import path2 from "path";
|
|
10571
|
+
import { fileURLToPath } from "url";
|
|
10572
|
+
var MAX_WALK_LEVELS = 10;
|
|
10573
|
+
|
|
10574
|
+
class VersionResolutionError extends Error {
|
|
10575
|
+
constructor(message, { cause, code } = {}) {
|
|
10576
|
+
super(message);
|
|
10577
|
+
this.name = "VersionResolutionError";
|
|
10578
|
+
if (cause !== undefined)
|
|
10579
|
+
this.cause = cause;
|
|
10580
|
+
if (code !== undefined)
|
|
10581
|
+
this.code = code;
|
|
10582
|
+
}
|
|
10583
|
+
}
|
|
10584
|
+
var readPackageVersionFromFile = ({ packageJsonPath, expectedName }) => {
|
|
10585
|
+
const raw = readFileSync(packageJsonPath, "utf8");
|
|
10586
|
+
let pkg;
|
|
10587
|
+
try {
|
|
10588
|
+
pkg = JSON.parse(raw);
|
|
10589
|
+
} catch (cause) {
|
|
10590
|
+
throw new VersionResolutionError(`Malformed package.json for '${expectedName}' at ${packageJsonPath}: ${cause.message}`, { cause, code: "MALFORMED_JSON" });
|
|
10591
|
+
}
|
|
10592
|
+
if (pkg.name !== expectedName) {
|
|
10593
|
+
throw new VersionResolutionError(`Package name mismatch at ${packageJsonPath}: expected '${expectedName}', found '${pkg.name}'`, { code: "NAME_MISMATCH" });
|
|
10594
|
+
}
|
|
10595
|
+
if (pkg.version === undefined) {
|
|
10596
|
+
throw new VersionResolutionError(`Missing 'version' field for '${expectedName}' at ${packageJsonPath}`, { code: "MISSING_VERSION" });
|
|
10597
|
+
}
|
|
10598
|
+
if (typeof pkg.version !== "string" || pkg.version === "") {
|
|
10599
|
+
throw new VersionResolutionError(`Invalid 'version' field for '${expectedName}' at ${packageJsonPath}: expected non-empty string, got ${typeof pkg.version}`, { code: "INVALID_VERSION_TYPE" });
|
|
10600
|
+
}
|
|
10601
|
+
return pkg.version;
|
|
10602
|
+
};
|
|
10603
|
+
var resolvePackageVersion = ({ importMetaUrl, packageName }) => {
|
|
10604
|
+
const startDir = path2.dirname(fileURLToPath(importMetaUrl));
|
|
10605
|
+
let dir = startDir;
|
|
10606
|
+
for (let level = 0;level < MAX_WALK_LEVELS; level++) {
|
|
10607
|
+
const candidate = path2.join(dir, "package.json");
|
|
10608
|
+
let version;
|
|
10609
|
+
try {
|
|
10610
|
+
version = readPackageVersionFromFile({ packageJsonPath: candidate, expectedName: packageName });
|
|
10611
|
+
} catch (err) {
|
|
10612
|
+
if (err instanceof VersionResolutionError && err.code === "NAME_MISMATCH") {} else if (err.code === "ENOENT") {} else {
|
|
10613
|
+
throw err;
|
|
10614
|
+
}
|
|
10615
|
+
const parent = path2.dirname(dir);
|
|
10616
|
+
if (parent === dir)
|
|
10617
|
+
break;
|
|
10618
|
+
dir = parent;
|
|
10619
|
+
continue;
|
|
10620
|
+
}
|
|
10621
|
+
return { version, packageJsonPath: candidate };
|
|
10622
|
+
}
|
|
10623
|
+
throw new VersionResolutionError(`Unable to resolve version for '${packageName}': no matching package.json found walking up from ${startDir} (max ${MAX_WALK_LEVELS} levels).`, { code: "WALK_EXHAUSTED" });
|
|
10624
|
+
};
|
|
10625
|
+
var package_version_default = Object.freeze({ resolvePackageVersion, readPackageVersionFromFile, VersionResolutionError });
|
|
10626
|
+
|
|
10627
|
+
// src/server-info.js
|
|
10563
10628
|
function resolve(overrideBinPath) {
|
|
10564
10629
|
let binPath;
|
|
10565
10630
|
if (overrideBinPath) {
|
|
@@ -10579,10 +10644,10 @@ function resolve(overrideBinPath) {
|
|
|
10579
10644
|
} catch {
|
|
10580
10645
|
return null;
|
|
10581
10646
|
}
|
|
10582
|
-
let dir =
|
|
10647
|
+
let dir = path3.dirname(realPath);
|
|
10583
10648
|
let packageRoot = null;
|
|
10584
10649
|
for (let i = 0;i < 10; i++) {
|
|
10585
|
-
const candidate =
|
|
10650
|
+
const candidate = path3.join(dir, "package.json");
|
|
10586
10651
|
if (fs3.existsSync(candidate)) {
|
|
10587
10652
|
try {
|
|
10588
10653
|
const pkg = JSON.parse(fs3.readFileSync(candidate, "utf8"));
|
|
@@ -10592,22 +10657,24 @@ function resolve(overrideBinPath) {
|
|
|
10592
10657
|
}
|
|
10593
10658
|
} catch {}
|
|
10594
10659
|
}
|
|
10595
|
-
const parent =
|
|
10660
|
+
const parent = path3.dirname(dir);
|
|
10596
10661
|
if (parent === dir)
|
|
10597
10662
|
break;
|
|
10598
10663
|
dir = parent;
|
|
10599
10664
|
}
|
|
10600
10665
|
if (!packageRoot)
|
|
10601
10666
|
return null;
|
|
10602
|
-
const packageJsonPath =
|
|
10667
|
+
const packageJsonPath = path3.join(packageRoot, "package.json");
|
|
10603
10668
|
let version;
|
|
10604
10669
|
try {
|
|
10605
|
-
|
|
10606
|
-
|
|
10670
|
+
version = readPackageVersionFromFile({
|
|
10671
|
+
packageJsonPath,
|
|
10672
|
+
expectedName: "@kelceyp/caw-server"
|
|
10673
|
+
});
|
|
10607
10674
|
} catch {
|
|
10608
10675
|
return null;
|
|
10609
10676
|
}
|
|
10610
|
-
const mainJsPath =
|
|
10677
|
+
const mainJsPath = path3.join(packageRoot, "dist", "main.js");
|
|
10611
10678
|
if (!fs3.existsSync(mainJsPath))
|
|
10612
10679
|
return null;
|
|
10613
10680
|
return { mainJsPath, version, packageRoot };
|
|
@@ -10615,13 +10682,13 @@ function resolve(overrideBinPath) {
|
|
|
10615
10682
|
|
|
10616
10683
|
// src/commands/start.js
|
|
10617
10684
|
import fs6 from "node:fs";
|
|
10618
|
-
import
|
|
10685
|
+
import path6 from "node:path";
|
|
10619
10686
|
import os2 from "node:os";
|
|
10620
10687
|
import { execSync as execSync4 } from "node:child_process";
|
|
10621
10688
|
|
|
10622
10689
|
// src/config.js
|
|
10623
10690
|
import fs4 from "node:fs";
|
|
10624
|
-
import
|
|
10691
|
+
import path4 from "node:path";
|
|
10625
10692
|
var CONFIG_FILENAME = "config.json";
|
|
10626
10693
|
var PENDING_FILENAME = "config.pending.json";
|
|
10627
10694
|
var DEFAULTS = Object.freeze({
|
|
@@ -10633,10 +10700,10 @@ var DEFAULTS = Object.freeze({
|
|
|
10633
10700
|
})
|
|
10634
10701
|
});
|
|
10635
10702
|
function configPath(envDir) {
|
|
10636
|
-
return
|
|
10703
|
+
return path4.join(envDir, CONFIG_FILENAME);
|
|
10637
10704
|
}
|
|
10638
10705
|
function pendingPath(envDir) {
|
|
10639
|
-
return
|
|
10706
|
+
return path4.join(envDir, PENDING_FILENAME);
|
|
10640
10707
|
}
|
|
10641
10708
|
function atomicWrite(filePath, data) {
|
|
10642
10709
|
const tmpPath = filePath + ".tmp";
|
|
@@ -10649,7 +10716,7 @@ function readJsonFile(filePath) {
|
|
|
10649
10716
|
try {
|
|
10650
10717
|
return JSON.parse(raw);
|
|
10651
10718
|
} catch (e) {
|
|
10652
|
-
throw new Error(`Malformed JSON in ${
|
|
10719
|
+
throw new Error(`Malformed JSON in ${path4.basename(filePath)}: ${e.message}`);
|
|
10653
10720
|
}
|
|
10654
10721
|
}
|
|
10655
10722
|
function readConfig(envDir) {
|
|
@@ -10682,15 +10749,15 @@ function deletePendingConfig(envDir) {
|
|
|
10682
10749
|
|
|
10683
10750
|
// src/process-manager.js
|
|
10684
10751
|
import fs5 from "node:fs";
|
|
10685
|
-
import
|
|
10752
|
+
import path5 from "node:path";
|
|
10686
10753
|
import { spawn, execSync as execSync3 } from "node:child_process";
|
|
10687
10754
|
var PID_FILENAME = "server.pid";
|
|
10688
10755
|
var LOG_FILENAME = "server.log";
|
|
10689
10756
|
function pidFilePath(envDir) {
|
|
10690
|
-
return
|
|
10757
|
+
return path5.join(envDir, PID_FILENAME);
|
|
10691
10758
|
}
|
|
10692
10759
|
function logFilePath(envDir) {
|
|
10693
|
-
return
|
|
10760
|
+
return path5.join(envDir, LOG_FILENAME);
|
|
10694
10761
|
}
|
|
10695
10762
|
function readPid(envDir) {
|
|
10696
10763
|
const filePath = pidFilePath(envDir);
|
|
@@ -10720,7 +10787,7 @@ function isProcessAlive(pid) {
|
|
|
10720
10787
|
}
|
|
10721
10788
|
}
|
|
10722
10789
|
function getPm2Name(envDir) {
|
|
10723
|
-
const base =
|
|
10790
|
+
const base = path5.basename(envDir).replace(/^\./, "");
|
|
10724
10791
|
if (base === "caw")
|
|
10725
10792
|
return "caw";
|
|
10726
10793
|
return `caw-${base}`;
|
|
@@ -10877,15 +10944,15 @@ async function waitForExit(pm, intervalMs, maxWaitMs) {
|
|
|
10877
10944
|
// src/commands/start.js
|
|
10878
10945
|
function resolveEnvDir(rawEnvDir) {
|
|
10879
10946
|
if (rawEnvDir.startsWith("~")) {
|
|
10880
|
-
rawEnvDir =
|
|
10947
|
+
rawEnvDir = path6.join(os2.homedir(), rawEnvDir.slice(1));
|
|
10881
10948
|
}
|
|
10882
|
-
return
|
|
10949
|
+
return path6.resolve(rawEnvDir);
|
|
10883
10950
|
}
|
|
10884
10951
|
function configExists(envDir) {
|
|
10885
|
-
return fs6.existsSync(
|
|
10952
|
+
return fs6.existsSync(path6.join(envDir, "config.json"));
|
|
10886
10953
|
}
|
|
10887
10954
|
function validateEnvFile(envDir) {
|
|
10888
|
-
const envFilePath =
|
|
10955
|
+
const envFilePath = path6.join(envDir, ".env");
|
|
10889
10956
|
if (!fs6.existsSync(envFilePath)) {
|
|
10890
10957
|
return {
|
|
10891
10958
|
ok: false,
|
|
@@ -10915,7 +10982,7 @@ var MAX_LOG_SIZE = 10 * 1024 * 1024;
|
|
|
10915
10982
|
var LOG_RETAIN = 5;
|
|
10916
10983
|
function rotateLogIfNeeded(envDir) {
|
|
10917
10984
|
try {
|
|
10918
|
-
const logPath =
|
|
10985
|
+
const logPath = path6.join(envDir, "server.log");
|
|
10919
10986
|
if (!fs6.existsSync(logPath))
|
|
10920
10987
|
return;
|
|
10921
10988
|
const stats = fs6.statSync(logPath);
|
|
@@ -10934,23 +11001,23 @@ function rotateLogIfNeeded(envDir) {
|
|
|
10934
11001
|
].join("-");
|
|
10935
11002
|
fs6.renameSync(logPath, `${logPath}.${timestamp}`);
|
|
10936
11003
|
console.log(`Rotated server.log (was ${(stats.size / 1024 / 1024).toFixed(1)} MB)`);
|
|
10937
|
-
const rotated = fs6.readdirSync(envDir).filter((f) => f.startsWith("server.log.")).map((f) => ({ name: f, mtime: fs6.statSync(
|
|
11004
|
+
const rotated = fs6.readdirSync(envDir).filter((f) => f.startsWith("server.log.")).map((f) => ({ name: f, mtime: fs6.statSync(path6.join(envDir, f)).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
|
|
10938
11005
|
for (const file of rotated.slice(LOG_RETAIN)) {
|
|
10939
|
-
fs6.unlinkSync(
|
|
11006
|
+
fs6.unlinkSync(path6.join(envDir, file.name));
|
|
10940
11007
|
}
|
|
10941
11008
|
} catch (err) {
|
|
10942
11009
|
console.warn(`Warning: log rotation failed: ${err.message}`);
|
|
10943
11010
|
}
|
|
10944
11011
|
}
|
|
10945
11012
|
function buildEnvNodeArgs(envDir) {
|
|
10946
|
-
const envFilePath =
|
|
11013
|
+
const envFilePath = path6.join(envDir, ".env");
|
|
10947
11014
|
return [`--env-file=${envFilePath}`];
|
|
10948
11015
|
}
|
|
10949
11016
|
function bootstrap(envDir) {
|
|
10950
11017
|
fs6.mkdirSync(envDir, { recursive: true });
|
|
10951
|
-
fs6.mkdirSync(
|
|
11018
|
+
fs6.mkdirSync(path6.join(envDir, "assets"), { recursive: true });
|
|
10952
11019
|
writeConfig(envDir, { ...DEFAULTS });
|
|
10953
|
-
const envFilePath =
|
|
11020
|
+
const envFilePath = path6.join(envDir, ".env");
|
|
10954
11021
|
if (!fs6.existsSync(envFilePath)) {
|
|
10955
11022
|
fs6.writeFileSync(envFilePath, [
|
|
10956
11023
|
"# CAW environment configuration",
|
|
@@ -11025,10 +11092,23 @@ How would you like to proceed?`,
|
|
|
11025
11092
|
});
|
|
11026
11093
|
if (choice === "nvm") {
|
|
11027
11094
|
console.log(`
|
|
11028
|
-
To install nvm and get a user-owned prefix
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11095
|
+
To install nvm and get a user-owned prefix:
|
|
11096
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_INSTALLER_VERSION}/install.sh | bash
|
|
11097
|
+
nvm install 24
|
|
11098
|
+
npm install -g @kelceyp/caw
|
|
11099
|
+
|
|
11100
|
+
For a newer nvm release, check https://github.com/nvm-sh/nvm/releases
|
|
11101
|
+
and substitute the tag into the curl URL above.
|
|
11102
|
+
|
|
11103
|
+
After reloading your shell you may see a \`zsh compinit: insecure
|
|
11104
|
+
directories\` warning — a pre-existing insecure entry on your zsh
|
|
11105
|
+
fpath that compinit surfaces on the next shell (not caused by nvm).
|
|
11106
|
+
To fix:
|
|
11107
|
+
1. Run \`compaudit\` to list offending paths.
|
|
11108
|
+
2. For each path, apply whichever is appropriate:
|
|
11109
|
+
- chmod g-w,o-w <path> (if group/world writable)
|
|
11110
|
+
- chown <you> <path> (if not owned by root or you)
|
|
11111
|
+
Do not blanket-chmod without inspecting compaudit's output.`);
|
|
11032
11112
|
process.exit(0);
|
|
11033
11113
|
}
|
|
11034
11114
|
if (choice === "exit") {
|
|
@@ -11105,7 +11185,7 @@ To install nvm and get a user-owned prefix:`);
|
|
|
11105
11185
|
const started = await pollHealth(activeConfig.port);
|
|
11106
11186
|
if (!started) {
|
|
11107
11187
|
console.error(`Server did not become healthy within 10 seconds.`);
|
|
11108
|
-
console.error(`Check logs with: caw logs${envDir !==
|
|
11188
|
+
console.error(`Check logs with: caw logs${envDir !== path6.join(os2.homedir(), ".caw") ? ` --env-dir ${envDir}` : ""}`);
|
|
11109
11189
|
process.exit(1);
|
|
11110
11190
|
}
|
|
11111
11191
|
console.log(`Server started successfully on http://localhost:${activeConfig.port}`);
|
|
@@ -11115,16 +11195,16 @@ var start_default = Object.freeze({ create: create2 });
|
|
|
11115
11195
|
|
|
11116
11196
|
// src/commands/stop.js
|
|
11117
11197
|
import fs7 from "node:fs";
|
|
11118
|
-
import
|
|
11198
|
+
import path7 from "node:path";
|
|
11119
11199
|
import os3 from "node:os";
|
|
11120
11200
|
function resolveEnvDir2(rawEnvDir) {
|
|
11121
11201
|
if (rawEnvDir.startsWith("~")) {
|
|
11122
|
-
rawEnvDir =
|
|
11202
|
+
rawEnvDir = path7.join(os3.homedir(), rawEnvDir.slice(1));
|
|
11123
11203
|
}
|
|
11124
|
-
return
|
|
11204
|
+
return path7.resolve(rawEnvDir);
|
|
11125
11205
|
}
|
|
11126
11206
|
function configExists2(envDir) {
|
|
11127
|
-
return fs7.existsSync(
|
|
11207
|
+
return fs7.existsSync(path7.join(envDir, "config.json"));
|
|
11128
11208
|
}
|
|
11129
11209
|
async function checkHealth2(port) {
|
|
11130
11210
|
try {
|
|
@@ -11138,6 +11218,55 @@ async function checkHealth2(port) {
|
|
|
11138
11218
|
return { reachable: false, healthy: false, data: null };
|
|
11139
11219
|
}
|
|
11140
11220
|
}
|
|
11221
|
+
async function executeStop(pm, config, force, promptFn) {
|
|
11222
|
+
const runState = pm.isRunning();
|
|
11223
|
+
if (!runState.running) {
|
|
11224
|
+
return { stopped: false, wasRunning: false };
|
|
11225
|
+
}
|
|
11226
|
+
const health = await checkHealth2(config.port);
|
|
11227
|
+
if (health.reachable && health.healthy) {
|
|
11228
|
+
const safeToStop = health.data?.safeToStop;
|
|
11229
|
+
if (safeToStop === false && !force) {
|
|
11230
|
+
const message = health.data?.safeToStopMessage || "There are active jobs running.";
|
|
11231
|
+
console.log(message);
|
|
11232
|
+
const confirm = await promptFn({
|
|
11233
|
+
type: "confirm",
|
|
11234
|
+
message: "Stop anyway?",
|
|
11235
|
+
default: false
|
|
11236
|
+
});
|
|
11237
|
+
if (!confirm) {
|
|
11238
|
+
return { stopped: false, wasRunning: true, userDeclined: true };
|
|
11239
|
+
}
|
|
11240
|
+
}
|
|
11241
|
+
} else if (!health.reachable) {
|
|
11242
|
+
if (!force) {
|
|
11243
|
+
console.error(`Server process is running (PID ${runState.pid}) but not responding.`);
|
|
11244
|
+
console.error("Cannot verify job safety. Use --force to stop anyway.");
|
|
11245
|
+
return { stopped: false, wasRunning: true, error: "not-responding" };
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
pm.stop();
|
|
11249
|
+
const exited = await waitForExit(pm, 500, 1e4);
|
|
11250
|
+
if (exited) {
|
|
11251
|
+
pm.cleanup();
|
|
11252
|
+
console.log("Server stopped.");
|
|
11253
|
+
return { stopped: true, wasRunning: true };
|
|
11254
|
+
}
|
|
11255
|
+
if (!force) {
|
|
11256
|
+
console.error("Server did not stop within 10 seconds. Run `caw stop --force` to force kill.");
|
|
11257
|
+
return { stopped: false, wasRunning: true, error: "timeout" };
|
|
11258
|
+
}
|
|
11259
|
+
console.log("Server did not stop gracefully. Sending SIGKILL...");
|
|
11260
|
+
pm.forceStop();
|
|
11261
|
+
const killed = await waitForExit(pm, 500, 5000);
|
|
11262
|
+
pm.cleanup();
|
|
11263
|
+
if (killed) {
|
|
11264
|
+
console.log("Server force-killed.");
|
|
11265
|
+
return { stopped: true, wasRunning: true };
|
|
11266
|
+
}
|
|
11267
|
+
console.error("Server process could not be stopped.");
|
|
11268
|
+
return { stopped: false, wasRunning: true, error: "unkillable" };
|
|
11269
|
+
}
|
|
11141
11270
|
var create3 = () => {
|
|
11142
11271
|
return createCommand("stop").summary("Stop the caw server").param((p) => p.name("env-dir").type("string").flag("env-dir").default("~/.caw/")).param((p) => p.name("force").type("boolean").flag("force").default(false)).run(async (ctx) => {
|
|
11143
11272
|
const envDir = resolveEnvDir2(ctx.params["env-dir"]);
|
|
@@ -11148,53 +11277,14 @@ var create3 = () => {
|
|
|
11148
11277
|
}
|
|
11149
11278
|
const config = readConfigWithDefaults(envDir);
|
|
11150
11279
|
const pm = createProcessManager(config, envDir);
|
|
11151
|
-
const
|
|
11152
|
-
if (!
|
|
11280
|
+
const result = await executeStop(pm, config, force, ctx.prompt);
|
|
11281
|
+
if (!result.wasRunning) {
|
|
11153
11282
|
console.log("Server is not running.");
|
|
11154
11283
|
process.exit(0);
|
|
11155
11284
|
}
|
|
11156
|
-
|
|
11157
|
-
if (health.reachable && health.healthy) {
|
|
11158
|
-
const safeToStop = health.data?.safeToStop;
|
|
11159
|
-
if (safeToStop === false && !force) {
|
|
11160
|
-
const message = health.data?.safeToStopMessage || "There are active jobs running.";
|
|
11161
|
-
console.log(message);
|
|
11162
|
-
const confirm = await ctx.prompt({
|
|
11163
|
-
type: "confirm",
|
|
11164
|
-
message: "Stop anyway?",
|
|
11165
|
-
default: false
|
|
11166
|
-
});
|
|
11167
|
-
if (!confirm) {
|
|
11168
|
-
process.exit(0);
|
|
11169
|
-
}
|
|
11170
|
-
}
|
|
11171
|
-
} else if (!health.reachable) {
|
|
11172
|
-
if (!force) {
|
|
11173
|
-
console.error(`Server process is running (PID ${runState.pid}) but not responding.`);
|
|
11174
|
-
console.error("Cannot verify job safety. Use --force to stop anyway.");
|
|
11175
|
-
process.exit(1);
|
|
11176
|
-
}
|
|
11177
|
-
}
|
|
11178
|
-
pm.stop();
|
|
11179
|
-
const exited = await waitForExit(pm, 500, 1e4);
|
|
11180
|
-
if (exited) {
|
|
11181
|
-
pm.cleanup();
|
|
11182
|
-
console.log("Server stopped.");
|
|
11183
|
-
process.exit(0);
|
|
11184
|
-
}
|
|
11185
|
-
if (!force) {
|
|
11186
|
-
console.error("Server did not stop within 10 seconds. Run `caw stop --force` to force kill.");
|
|
11187
|
-
process.exit(1);
|
|
11188
|
-
}
|
|
11189
|
-
console.log("Server did not stop gracefully. Sending SIGKILL...");
|
|
11190
|
-
pm.forceStop();
|
|
11191
|
-
const killed = await waitForExit(pm, 500, 5000);
|
|
11192
|
-
pm.cleanup();
|
|
11193
|
-
if (killed) {
|
|
11194
|
-
console.log("Server force-killed.");
|
|
11285
|
+
if (result.userDeclined || result.stopped) {
|
|
11195
11286
|
process.exit(0);
|
|
11196
11287
|
}
|
|
11197
|
-
console.error("Server process could not be stopped.");
|
|
11198
11288
|
process.exit(1);
|
|
11199
11289
|
}).onError({ exitCode: 1 }).build();
|
|
11200
11290
|
};
|
|
@@ -11203,12 +11293,12 @@ var stop_default = Object.freeze({ create: create3 });
|
|
|
11203
11293
|
// src/commands/status.js
|
|
11204
11294
|
var import_semver = __toESM(require_semver2(), 1);
|
|
11205
11295
|
import fs9 from "node:fs";
|
|
11206
|
-
import
|
|
11296
|
+
import path9 from "node:path";
|
|
11207
11297
|
import os4 from "node:os";
|
|
11208
11298
|
|
|
11209
11299
|
// src/registry.js
|
|
11210
11300
|
import fs8 from "node:fs";
|
|
11211
|
-
import
|
|
11301
|
+
import path8 from "node:path";
|
|
11212
11302
|
var CACHE_FILENAME = "caw-cache.json";
|
|
11213
11303
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
11214
11304
|
var DEFAULT_TTL_MS = 60 * 60 * 1000;
|
|
@@ -11224,7 +11314,7 @@ async function fetchLatestVersion(packageName, { timeoutMs = DEFAULT_TIMEOUT_MS
|
|
|
11224
11314
|
return data["dist-tags"].latest;
|
|
11225
11315
|
}
|
|
11226
11316
|
function readCache(envDir) {
|
|
11227
|
-
const cachePath =
|
|
11317
|
+
const cachePath = path8.join(envDir, CACHE_FILENAME);
|
|
11228
11318
|
try {
|
|
11229
11319
|
return JSON.parse(fs8.readFileSync(cachePath, "utf8"));
|
|
11230
11320
|
} catch {
|
|
@@ -11232,7 +11322,7 @@ function readCache(envDir) {
|
|
|
11232
11322
|
}
|
|
11233
11323
|
}
|
|
11234
11324
|
function writeCache(envDir, cache) {
|
|
11235
|
-
const cachePath =
|
|
11325
|
+
const cachePath = path8.join(envDir, CACHE_FILENAME);
|
|
11236
11326
|
const tmp = cachePath + ".tmp";
|
|
11237
11327
|
fs8.writeFileSync(tmp, JSON.stringify(cache, null, 2));
|
|
11238
11328
|
fs8.renameSync(tmp, cachePath);
|
|
@@ -11252,12 +11342,12 @@ function isCacheStale(cache, ttlMs = DEFAULT_TTL_MS) {
|
|
|
11252
11342
|
// src/commands/status.js
|
|
11253
11343
|
function resolveEnvDir3(rawEnvDir) {
|
|
11254
11344
|
if (rawEnvDir.startsWith("~")) {
|
|
11255
|
-
rawEnvDir =
|
|
11345
|
+
rawEnvDir = path9.join(os4.homedir(), rawEnvDir.slice(1));
|
|
11256
11346
|
}
|
|
11257
|
-
return
|
|
11347
|
+
return path9.resolve(rawEnvDir);
|
|
11258
11348
|
}
|
|
11259
11349
|
function configExists3(envDir) {
|
|
11260
|
-
return fs9.existsSync(
|
|
11350
|
+
return fs9.existsSync(path9.join(envDir, "config.json"));
|
|
11261
11351
|
}
|
|
11262
11352
|
async function fetchHealth(port) {
|
|
11263
11353
|
try {
|
|
@@ -11381,19 +11471,19 @@ var status_default = Object.freeze({ create: create4 });
|
|
|
11381
11471
|
|
|
11382
11472
|
// src/commands/logs.js
|
|
11383
11473
|
import fs10 from "node:fs";
|
|
11384
|
-
import
|
|
11474
|
+
import path10 from "node:path";
|
|
11385
11475
|
import os5 from "node:os";
|
|
11386
11476
|
import { spawn as spawn2 } from "node:child_process";
|
|
11387
11477
|
function resolveEnvDir4(rawEnvDir) {
|
|
11388
11478
|
if (rawEnvDir.startsWith("~")) {
|
|
11389
|
-
rawEnvDir =
|
|
11479
|
+
rawEnvDir = path10.join(os5.homedir(), rawEnvDir.slice(1));
|
|
11390
11480
|
}
|
|
11391
|
-
return
|
|
11481
|
+
return path10.resolve(rawEnvDir);
|
|
11392
11482
|
}
|
|
11393
11483
|
var create5 = () => {
|
|
11394
11484
|
return createCommand("logs").summary("Tail the caw server logs").param((p) => p.name("env-dir").type("string").flag("env-dir").default("~/.caw/")).run(async (ctx) => {
|
|
11395
11485
|
const envDir = resolveEnvDir4(ctx.params["env-dir"]);
|
|
11396
|
-
const logPath =
|
|
11486
|
+
const logPath = path10.join(envDir, "server.log");
|
|
11397
11487
|
if (!fs10.existsSync(logPath)) {
|
|
11398
11488
|
console.log(`No log file found at ${logPath}`);
|
|
11399
11489
|
process.exit(0);
|
|
@@ -11417,18 +11507,18 @@ var logs_default = Object.freeze({ create: create5 });
|
|
|
11417
11507
|
// src/commands/upgrade.js
|
|
11418
11508
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
11419
11509
|
import fs11 from "node:fs";
|
|
11420
|
-
import
|
|
11510
|
+
import path11 from "node:path";
|
|
11421
11511
|
import os6 from "node:os";
|
|
11422
11512
|
import { execSync as execSync5 } from "node:child_process";
|
|
11423
11513
|
var COMPATIBLE_SERVER_RANGE = "^1";
|
|
11424
11514
|
function resolveEnvDir5(rawEnvDir) {
|
|
11425
11515
|
if (rawEnvDir.startsWith("~")) {
|
|
11426
|
-
rawEnvDir =
|
|
11516
|
+
rawEnvDir = path11.join(os6.homedir(), rawEnvDir.slice(1));
|
|
11427
11517
|
}
|
|
11428
|
-
return
|
|
11518
|
+
return path11.resolve(rawEnvDir);
|
|
11429
11519
|
}
|
|
11430
11520
|
function configExists4(envDir) {
|
|
11431
|
-
return fs11.existsSync(
|
|
11521
|
+
return fs11.existsSync(path11.join(envDir, "config.json"));
|
|
11432
11522
|
}
|
|
11433
11523
|
async function checkHealth3(port) {
|
|
11434
11524
|
try {
|
|
@@ -11463,15 +11553,6 @@ async function pollHealth2(port, maxRetries = 10, intervalMs = 1000) {
|
|
|
11463
11553
|
}
|
|
11464
11554
|
return false;
|
|
11465
11555
|
}
|
|
11466
|
-
function resolveInstalledLauncherVersion() {
|
|
11467
|
-
try {
|
|
11468
|
-
const pkgPath = path10.join(import.meta.dirname, "..", "package.json");
|
|
11469
|
-
const pkg = JSON.parse(fs11.readFileSync(pkgPath, "utf8"));
|
|
11470
|
-
return pkg.version;
|
|
11471
|
-
} catch {
|
|
11472
|
-
return null;
|
|
11473
|
-
}
|
|
11474
|
-
}
|
|
11475
11556
|
var create6 = () => {
|
|
11476
11557
|
return createCommand("upgrade").summary("Upgrade caw-server to the latest version").param((p) => p.name("env-dir").type("string").flag("env-dir").default("~/.caw/")).param((p) => p.name("force").type("boolean").flag("force").default(false)).run(async (ctx) => {
|
|
11477
11558
|
const envDir = resolveEnvDir5(ctx.params["env-dir"]);
|
|
@@ -11479,7 +11560,15 @@ var create6 = () => {
|
|
|
11479
11560
|
const prefixCheck = checkPrefixWritable();
|
|
11480
11561
|
if (!prefixCheck.ok) {
|
|
11481
11562
|
console.error("Error: npm global prefix is not writable.");
|
|
11482
|
-
console.error(
|
|
11563
|
+
console.error(`
|
|
11564
|
+
To upgrade with sudo, run:
|
|
11565
|
+
sudo npm install -g @kelceyp/caw-server@latest
|
|
11566
|
+
sudo npm install -g @kelceyp/caw@latest (only if the target server requires a newer launcher)
|
|
11567
|
+
|
|
11568
|
+
Before running sudo, compare \`node --version\` with \`sudo node --version\`.
|
|
11569
|
+
If they differ, sudo resolves a different Node — often an older, system-supplied one — and the packages install for a Node version you are not using.
|
|
11570
|
+
|
|
11571
|
+
The recommended alternative is a user-owned prefix (e.g. via nvm), which removes the need for sudo on every future upgrade.`);
|
|
11483
11572
|
process.exit(1);
|
|
11484
11573
|
}
|
|
11485
11574
|
const serverInfo = resolve();
|
|
@@ -11533,7 +11622,16 @@ var create6 = () => {
|
|
|
11533
11622
|
console.log(`Server update available: ${installedVersion} → ${latestServerVersion}`);
|
|
11534
11623
|
}
|
|
11535
11624
|
if (!skipInstall && !import_semver2.default.satisfies(latestServerVersion, COMPATIBLE_SERVER_RANGE)) {
|
|
11536
|
-
|
|
11625
|
+
let installedLauncherVersion = null;
|
|
11626
|
+
try {
|
|
11627
|
+
installedLauncherVersion = resolvePackageVersion({
|
|
11628
|
+
importMetaUrl: import.meta.url,
|
|
11629
|
+
packageName: "@kelceyp/caw"
|
|
11630
|
+
}).version;
|
|
11631
|
+
} catch (err) {
|
|
11632
|
+
if (!(err instanceof VersionResolutionError))
|
|
11633
|
+
throw err;
|
|
11634
|
+
}
|
|
11537
11635
|
if (installedLauncherVersion && installedLauncherVersion === latestLauncherVersion) {
|
|
11538
11636
|
console.error(`Error: Launcher is already at the latest version (${installedLauncherVersion}) but does not support server version ${latestServerVersion}. A new launcher version is needed before upgrading.`);
|
|
11539
11637
|
process.exit(1);
|
|
@@ -11631,6 +11729,170 @@ var create6 = () => {
|
|
|
11631
11729
|
};
|
|
11632
11730
|
var upgrade_default = Object.freeze({ create: create6 });
|
|
11633
11731
|
|
|
11732
|
+
// src/commands/restart.js
|
|
11733
|
+
import fs12 from "node:fs";
|
|
11734
|
+
import path12 from "node:path";
|
|
11735
|
+
import os7 from "node:os";
|
|
11736
|
+
import { execSync as execSync6 } from "node:child_process";
|
|
11737
|
+
function resolveEnvDir6(rawEnvDir) {
|
|
11738
|
+
if (rawEnvDir.startsWith("~")) {
|
|
11739
|
+
rawEnvDir = path12.join(os7.homedir(), rawEnvDir.slice(1));
|
|
11740
|
+
}
|
|
11741
|
+
return path12.resolve(rawEnvDir);
|
|
11742
|
+
}
|
|
11743
|
+
function configExists5(envDir) {
|
|
11744
|
+
return fs12.existsSync(path12.join(envDir, "config.json"));
|
|
11745
|
+
}
|
|
11746
|
+
function buildChangeSummary2(active, pending) {
|
|
11747
|
+
const changes = [];
|
|
11748
|
+
for (const key of Object.keys(pending)) {
|
|
11749
|
+
const oldVal = JSON.stringify(active[key]);
|
|
11750
|
+
const newVal = JSON.stringify(pending[key]);
|
|
11751
|
+
if (oldVal !== newVal) {
|
|
11752
|
+
changes.push(` ${key}: ${oldVal} → ${newVal}`);
|
|
11753
|
+
}
|
|
11754
|
+
}
|
|
11755
|
+
return changes;
|
|
11756
|
+
}
|
|
11757
|
+
function attemptInstallServer2() {
|
|
11758
|
+
try {
|
|
11759
|
+
execSync6("npm install -g @kelceyp/caw-server@^1 --loglevel=error", { stdio: "inherit" });
|
|
11760
|
+
return true;
|
|
11761
|
+
} catch {
|
|
11762
|
+
return false;
|
|
11763
|
+
}
|
|
11764
|
+
}
|
|
11765
|
+
var create7 = () => {
|
|
11766
|
+
return createCommand("restart").summary("Restart the caw server (stop then start)").param((p) => p.name("env-dir").type("string").flag("env-dir").default("~/.caw/")).param((p) => p.name("force").type("boolean").flag("force").default(false)).run(async (ctx) => {
|
|
11767
|
+
const envDir = resolveEnvDir6(ctx.params["env-dir"]);
|
|
11768
|
+
const force = ctx.params.force;
|
|
11769
|
+
if (fs12.existsSync(envDir) && configExists5(envDir)) {
|
|
11770
|
+
const config2 = readConfigWithDefaults(envDir);
|
|
11771
|
+
const pm3 = createProcessManager(config2, envDir);
|
|
11772
|
+
const result = await executeStop(pm3, config2, force, ctx.prompt);
|
|
11773
|
+
if (result.wasRunning && !result.stopped) {
|
|
11774
|
+
if (result.userDeclined) {
|
|
11775
|
+
process.exit(0);
|
|
11776
|
+
}
|
|
11777
|
+
process.exit(1);
|
|
11778
|
+
}
|
|
11779
|
+
}
|
|
11780
|
+
const prefixCheck = checkPrefixWritable();
|
|
11781
|
+
if (!prefixCheck.ok) {
|
|
11782
|
+
const choice = await ctx.prompt({
|
|
11783
|
+
type: "select",
|
|
11784
|
+
message: `${prefixCheck.message}
|
|
11785
|
+
|
|
11786
|
+
How would you like to proceed?`,
|
|
11787
|
+
choices: [
|
|
11788
|
+
{ label: "Continue anyway", value: "continue" },
|
|
11789
|
+
{ label: "Switch to nvm (recommended)", value: "nvm" },
|
|
11790
|
+
{ label: "Exit", value: "exit" }
|
|
11791
|
+
]
|
|
11792
|
+
});
|
|
11793
|
+
if (choice === "nvm") {
|
|
11794
|
+
console.log(`
|
|
11795
|
+
To install nvm and get a user-owned prefix:
|
|
11796
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${NVM_INSTALLER_VERSION}/install.sh | bash
|
|
11797
|
+
nvm install 24
|
|
11798
|
+
npm install -g @kelceyp/caw
|
|
11799
|
+
|
|
11800
|
+
For a newer nvm release, check https://github.com/nvm-sh/nvm/releases
|
|
11801
|
+
and substitute the tag into the curl URL above.
|
|
11802
|
+
|
|
11803
|
+
After reloading your shell you may see a \`zsh compinit: insecure
|
|
11804
|
+
directories\` warning — a pre-existing insecure entry on your zsh
|
|
11805
|
+
fpath that compinit surfaces on the next shell (not caused by nvm).
|
|
11806
|
+
To fix:
|
|
11807
|
+
1. Run \`compaudit\` to list offending paths.
|
|
11808
|
+
2. For each path, apply whichever is appropriate:
|
|
11809
|
+
- chmod g-w,o-w <path> (if group/world writable)
|
|
11810
|
+
- chown <you> <path> (if not owned by root or you)
|
|
11811
|
+
Do not blanket-chmod without inspecting compaudit's output.`);
|
|
11812
|
+
process.exit(0);
|
|
11813
|
+
}
|
|
11814
|
+
if (choice === "exit") {
|
|
11815
|
+
process.exit(0);
|
|
11816
|
+
}
|
|
11817
|
+
}
|
|
11818
|
+
if (!configExists5(envDir)) {
|
|
11819
|
+
console.log(`Creating environment directory: ${envDir}`);
|
|
11820
|
+
bootstrap(envDir);
|
|
11821
|
+
console.log("Wrote default config.json");
|
|
11822
|
+
}
|
|
11823
|
+
const config = readConfigWithDefaults(envDir);
|
|
11824
|
+
const pm = createProcessManager(config, envDir);
|
|
11825
|
+
const runState = pm.isRunning();
|
|
11826
|
+
if (runState.running) {
|
|
11827
|
+
const healthy = await fetch(`http://localhost:${config.port}/health`).then((r) => r.ok).catch(() => false);
|
|
11828
|
+
if (!healthy) {
|
|
11829
|
+
console.error(`Server process is running (PID ${runState.pid}) but not responding on port ${config.port}.`);
|
|
11830
|
+
console.error("Consider running `caw stop --force` and restarting.");
|
|
11831
|
+
process.exit(1);
|
|
11832
|
+
}
|
|
11833
|
+
if (hasPendingConfig(envDir)) {
|
|
11834
|
+
console.log(`Server is already running on port ${config.port}.`);
|
|
11835
|
+
console.log("There are pending configuration changes. Stop the server first to apply them.");
|
|
11836
|
+
process.exit(0);
|
|
11837
|
+
}
|
|
11838
|
+
console.log(`Server is already running on port ${config.port}.`);
|
|
11839
|
+
process.exit(0);
|
|
11840
|
+
}
|
|
11841
|
+
let activeConfig = config;
|
|
11842
|
+
if (hasPendingConfig(envDir)) {
|
|
11843
|
+
const active = readConfig(envDir);
|
|
11844
|
+
const pending = readPendingConfig(envDir);
|
|
11845
|
+
const changes = buildChangeSummary2(active, pending);
|
|
11846
|
+
const merged = mergeConfig(envDir);
|
|
11847
|
+
activeConfig = { ...DEFAULTS, ...merged };
|
|
11848
|
+
if (changes.length > 0) {
|
|
11849
|
+
console.log("Applied pending configuration changes:");
|
|
11850
|
+
for (const change of changes) {
|
|
11851
|
+
console.log(change);
|
|
11852
|
+
}
|
|
11853
|
+
} else {
|
|
11854
|
+
console.log("Pending configuration merged (no effective changes).");
|
|
11855
|
+
}
|
|
11856
|
+
}
|
|
11857
|
+
let serverInfo = resolve();
|
|
11858
|
+
if (!serverInfo) {
|
|
11859
|
+
console.log("caw-server not found. Attempting installation...");
|
|
11860
|
+
attemptInstallServer2();
|
|
11861
|
+
serverInfo = resolve();
|
|
11862
|
+
if (!serverInfo) {
|
|
11863
|
+
console.error("Failed to install caw-server. Install manually with:");
|
|
11864
|
+
console.error(" npm install -g @kelceyp/caw-server@^1");
|
|
11865
|
+
process.exit(1);
|
|
11866
|
+
}
|
|
11867
|
+
console.log(`Installed caw-server v${serverInfo.version}`);
|
|
11868
|
+
}
|
|
11869
|
+
const envCheck = validateEnvFile(envDir);
|
|
11870
|
+
if (!envCheck.ok) {
|
|
11871
|
+
console.error(envCheck.message);
|
|
11872
|
+
process.exit(1);
|
|
11873
|
+
}
|
|
11874
|
+
console.log(`Found environment file: ${envCheck.path}`);
|
|
11875
|
+
rotateLogIfNeeded(envDir);
|
|
11876
|
+
const envVars = {
|
|
11877
|
+
CAW_PORT: String(activeConfig.port),
|
|
11878
|
+
CAW_ENV_DIR: envDir
|
|
11879
|
+
};
|
|
11880
|
+
const nodeArgs = buildEnvNodeArgs(envDir);
|
|
11881
|
+
const pm2 = createProcessManager(activeConfig, envDir);
|
|
11882
|
+
const id = pm2.start(serverInfo.mainJsPath, envVars, nodeArgs);
|
|
11883
|
+
const modeLabel = pm2.mode === "pm2" ? `pm2: ${id}` : `PID: ${id}`;
|
|
11884
|
+
console.log(`Starting server (${modeLabel})...`);
|
|
11885
|
+
const started = await pollHealth(activeConfig.port);
|
|
11886
|
+
if (!started) {
|
|
11887
|
+
console.error(`Server did not become healthy within 10 seconds.`);
|
|
11888
|
+
console.error(`Check logs with: caw logs${envDir !== path12.join(os7.homedir(), ".caw") ? ` --env-dir ${envDir}` : ""}`);
|
|
11889
|
+
process.exit(1);
|
|
11890
|
+
}
|
|
11891
|
+
console.log(`Server started successfully on http://localhost:${activeConfig.port}`);
|
|
11892
|
+
}).onError({ exitCode: 1 }).build();
|
|
11893
|
+
};
|
|
11894
|
+
var restart_default = Object.freeze({ create: create7 });
|
|
11895
|
+
|
|
11634
11896
|
// src/main.js
|
|
11635
11897
|
var [major] = process.versions.node.split(".").map(Number);
|
|
11636
11898
|
if (major < 24) {
|
|
@@ -11643,10 +11905,19 @@ if (!globalCheck.ok) {
|
|
|
11643
11905
|
console.error(globalCheck.message);
|
|
11644
11906
|
process.exit(1);
|
|
11645
11907
|
}
|
|
11646
|
-
var LAUNCHER_VERSION
|
|
11908
|
+
var LAUNCHER_VERSION;
|
|
11909
|
+
try {
|
|
11910
|
+
LAUNCHER_VERSION = resolvePackageVersion({
|
|
11911
|
+
importMetaUrl: import.meta.url,
|
|
11912
|
+
packageName: "@kelceyp/caw"
|
|
11913
|
+
}).version;
|
|
11914
|
+
} catch (err) {
|
|
11915
|
+
console.error(err.message);
|
|
11916
|
+
process.exit(1);
|
|
11917
|
+
}
|
|
11647
11918
|
var serverInfo = resolve();
|
|
11648
11919
|
var serverVersion = serverInfo ? serverInfo.version : "not installed";
|
|
11649
11920
|
var versionString = `Launcher: ${LAUNCHER_VERSION}
|
|
11650
11921
|
Server: ${serverVersion}`;
|
|
11651
|
-
var app = create().name("caw").version(versionString).command(start_default.create()).command(stop_default.create()).command(status_default.create()).command(logs_default.create()).command(upgrade_default.create());
|
|
11922
|
+
var app = create().name("caw").version(versionString).command(start_default.create()).command(stop_default.create()).command(status_default.create()).command(logs_default.create()).command(upgrade_default.create()).command(restart_default.create());
|
|
11652
11923
|
await app.run(process.argv.slice(2));
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelceyp/caw",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "CAW launcher — server lifecycle management CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"caw": "dist/caw.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "
|
|
10
|
+
"build": "bun build src/main.js --outfile dist/caw.js --target node --format esm",
|
|
11
11
|
"test": "bun test --isolate",
|
|
12
12
|
"postinstall": "node scripts/postinstall.js"
|
|
13
13
|
},
|
|
@@ -16,11 +16,9 @@
|
|
|
16
16
|
"scripts/postinstall.js",
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@kelceyp/clibuilder": "^0.2.2"
|
|
21
|
-
},
|
|
22
19
|
"license": "UNLICENSED",
|
|
23
20
|
"devDependencies": {
|
|
21
|
+
"@kelceyp/clibuilder": "^0.2.2",
|
|
24
22
|
"semver": "^7"
|
|
25
23
|
}
|
|
26
24
|
}
|