@isarai/maestro 0.1.2 → 0.1.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.
- package/README.md +5 -0
- package/dist/index.js +178 -1
- package/dist/index.js.map +3 -3
- package/dist/server.js +11 -318
- package/dist/server.js.map +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
|
-
import { spawn } from "node:child_process";
|
|
5
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
var PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
var PACKAGE_JSON_PATH = path.join(PACKAGE_ROOT, "package.json");
|
|
8
9
|
var MAESTRO_DIR = path.join(os.homedir(), ".maestro");
|
|
9
10
|
var PID_PATH = path.join(MAESTRO_DIR, "server.pid");
|
|
10
11
|
var META_PATH = path.join(MAESTRO_DIR, "server-meta.json");
|
|
@@ -21,6 +22,13 @@ function fail(message) {
|
|
|
21
22
|
console.error(message);
|
|
22
23
|
process.exit(1);
|
|
23
24
|
}
|
|
25
|
+
function readPackageMeta() {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, "utf8"));
|
|
28
|
+
} catch {
|
|
29
|
+
fail(`Maestro package metadata not found at ${PACKAGE_JSON_PATH}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
24
32
|
function preflight() {
|
|
25
33
|
if (!fs.existsSync(SERVER_PATH)) {
|
|
26
34
|
fail(`Maestro server bundle not found at ${SERVER_PATH}`);
|
|
@@ -92,6 +100,67 @@ function displayHost(host) {
|
|
|
92
100
|
}
|
|
93
101
|
return host;
|
|
94
102
|
}
|
|
103
|
+
function isContainerManagedInstall() {
|
|
104
|
+
return fs.existsSync("/.dockerenv") || Boolean(process.env.KUBERNETES_SERVICE_HOST);
|
|
105
|
+
}
|
|
106
|
+
function getNpmCommand() {
|
|
107
|
+
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
108
|
+
try {
|
|
109
|
+
execFileSync(npmCommand, ["--version"], { stdio: ["ignore", "ignore", "ignore"] });
|
|
110
|
+
return npmCommand;
|
|
111
|
+
} catch {
|
|
112
|
+
fail("npm is required for `maestro update`, but it was not found in PATH.");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function getGlobalNpmRoot(npmCommand) {
|
|
116
|
+
try {
|
|
117
|
+
return execFileSync(npmCommand, ["root", "-g"], {
|
|
118
|
+
encoding: "utf8",
|
|
119
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
120
|
+
}).trim();
|
|
121
|
+
} catch {
|
|
122
|
+
fail("Failed to determine the global npm install directory.");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function ensureGlobalNpmInstall(npmCommand, packageName) {
|
|
126
|
+
const globalRoot = path.resolve(getGlobalNpmRoot(npmCommand));
|
|
127
|
+
const expectedRoot = path.resolve(globalRoot, packageName);
|
|
128
|
+
const installedRoot = path.resolve(PACKAGE_ROOT);
|
|
129
|
+
if (installedRoot !== expectedRoot) {
|
|
130
|
+
fail(
|
|
131
|
+
`maestro update only supports global npm installs. Expected package path ${expectedRoot}, found ${installedRoot}.`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function getLatestPublishedVersion(npmCommand, packageName) {
|
|
136
|
+
try {
|
|
137
|
+
const raw = execFileSync(npmCommand, ["view", `${packageName}@latest`, "version"], {
|
|
138
|
+
encoding: "utf8",
|
|
139
|
+
stdio: ["ignore", "pipe", "inherit"]
|
|
140
|
+
}).trim();
|
|
141
|
+
if (!raw) {
|
|
142
|
+
throw new Error("empty version response");
|
|
143
|
+
}
|
|
144
|
+
return raw;
|
|
145
|
+
} catch {
|
|
146
|
+
fail(`Failed to query the latest published version for ${packageName}.`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function version() {
|
|
150
|
+
const meta = readPackageMeta();
|
|
151
|
+
console.log(meta.version);
|
|
152
|
+
}
|
|
153
|
+
function runNpmInstallGlobal(npmCommand, packageName, versionSpec) {
|
|
154
|
+
try {
|
|
155
|
+
execFileSync(
|
|
156
|
+
npmCommand,
|
|
157
|
+
["install", "-g", `${packageName}@${versionSpec}`],
|
|
158
|
+
{ stdio: "inherit" }
|
|
159
|
+
);
|
|
160
|
+
} catch {
|
|
161
|
+
throw new Error(`Failed to update ${packageName}@${versionSpec}.`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
95
164
|
function getStatus() {
|
|
96
165
|
const pid = readPid();
|
|
97
166
|
const meta = readMeta();
|
|
@@ -192,6 +261,97 @@ function auth() {
|
|
|
192
261
|
console.log(`API token: ${token}`);
|
|
193
262
|
console.log(`Token path: ${tokenPath}`);
|
|
194
263
|
}
|
|
264
|
+
function logs(args) {
|
|
265
|
+
const follow = args.includes("-f") || args.includes("--follow");
|
|
266
|
+
if (!fs.existsSync(LOG_PATH)) {
|
|
267
|
+
fail(`Maestro log file not found at ${LOG_PATH}. Start Maestro first.`);
|
|
268
|
+
}
|
|
269
|
+
let position = 0;
|
|
270
|
+
const printChunk = (start2, end) => {
|
|
271
|
+
if (end <= start2) return;
|
|
272
|
+
const fd = fs.openSync(LOG_PATH, "r");
|
|
273
|
+
try {
|
|
274
|
+
const length = end - start2;
|
|
275
|
+
const buffer = Buffer.alloc(length);
|
|
276
|
+
fs.readSync(fd, buffer, 0, length, start2);
|
|
277
|
+
process.stdout.write(buffer);
|
|
278
|
+
} finally {
|
|
279
|
+
fs.closeSync(fd);
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const stat = fs.statSync(LOG_PATH);
|
|
283
|
+
printChunk(0, stat.size);
|
|
284
|
+
position = stat.size;
|
|
285
|
+
if (!follow) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const stopWatching = () => {
|
|
289
|
+
fs.unwatchFile(LOG_PATH, onChange);
|
|
290
|
+
};
|
|
291
|
+
const onChange = (curr, prev) => {
|
|
292
|
+
if (curr.size < position) {
|
|
293
|
+
position = 0;
|
|
294
|
+
}
|
|
295
|
+
if (curr.size > position) {
|
|
296
|
+
printChunk(position, curr.size);
|
|
297
|
+
position = curr.size;
|
|
298
|
+
} else if (prev.size > curr.size) {
|
|
299
|
+
position = curr.size;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
process.on("SIGINT", () => {
|
|
303
|
+
stopWatching();
|
|
304
|
+
process.exit(0);
|
|
305
|
+
});
|
|
306
|
+
process.on("SIGTERM", () => {
|
|
307
|
+
stopWatching();
|
|
308
|
+
process.exit(0);
|
|
309
|
+
});
|
|
310
|
+
fs.watchFile(LOG_PATH, { interval: 500 }, onChange);
|
|
311
|
+
}
|
|
312
|
+
async function update(args) {
|
|
313
|
+
if (isContainerManagedInstall()) {
|
|
314
|
+
fail("maestro update is only supported for bare-metal npm installs. Redeploy the container image instead.");
|
|
315
|
+
}
|
|
316
|
+
const meta = readPackageMeta();
|
|
317
|
+
const npmCommand = getNpmCommand();
|
|
318
|
+
ensureGlobalNpmInstall(npmCommand, meta.name);
|
|
319
|
+
const latestVersion = getLatestPublishedVersion(npmCommand, meta.name);
|
|
320
|
+
const currentVersion = meta.version;
|
|
321
|
+
const checkOnly = args.includes("--check");
|
|
322
|
+
console.log(`Installed: ${currentVersion}`);
|
|
323
|
+
console.log(`Latest: ${latestVersion}`);
|
|
324
|
+
if (currentVersion === latestVersion) {
|
|
325
|
+
console.log("Maestro is already up to date.");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
if (checkOnly) {
|
|
329
|
+
console.log(`Update available: ${currentVersion} -> ${latestVersion}`);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
const current = getStatus();
|
|
333
|
+
const wasRunning = current.running;
|
|
334
|
+
if (wasRunning) {
|
|
335
|
+
console.log("Stopping Maestro before update...");
|
|
336
|
+
await stop();
|
|
337
|
+
}
|
|
338
|
+
console.log(`Updating ${meta.name} to ${latestVersion}...`);
|
|
339
|
+
try {
|
|
340
|
+
runNpmInstallGlobal(npmCommand, meta.name, "latest");
|
|
341
|
+
} catch (error) {
|
|
342
|
+
if (wasRunning) {
|
|
343
|
+
console.log("Update failed; attempting to restart the previous Maestro process...");
|
|
344
|
+
start();
|
|
345
|
+
}
|
|
346
|
+
fail(error instanceof Error ? error.message : "Maestro update failed.");
|
|
347
|
+
}
|
|
348
|
+
if (wasRunning) {
|
|
349
|
+
console.log("Starting Maestro after update...");
|
|
350
|
+
start();
|
|
351
|
+
} else {
|
|
352
|
+
console.log("Update complete.");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
195
355
|
function help() {
|
|
196
356
|
console.log("Usage: maestro <command>");
|
|
197
357
|
console.log("");
|
|
@@ -200,9 +360,17 @@ function help() {
|
|
|
200
360
|
console.log(" stop Stop the background Maestro server");
|
|
201
361
|
console.log(" status Show whether the Maestro server is running");
|
|
202
362
|
console.log(" auth Print the local Maestro API token");
|
|
363
|
+
console.log(" logs Print the Maestro server log");
|
|
364
|
+
console.log(" version Print the installed Maestro CLI version");
|
|
365
|
+
console.log(" update Update the globally installed Maestro CLI");
|
|
366
|
+
console.log("");
|
|
367
|
+
console.log("Options:");
|
|
368
|
+
console.log(" maestro logs -f Follow the Maestro server log");
|
|
369
|
+
console.log(" maestro update --check Check whether an update is available");
|
|
203
370
|
}
|
|
204
371
|
async function main() {
|
|
205
372
|
const cmd = process.argv[2];
|
|
373
|
+
const args = process.argv.slice(3);
|
|
206
374
|
switch (cmd) {
|
|
207
375
|
case "start":
|
|
208
376
|
start();
|
|
@@ -216,6 +384,15 @@ async function main() {
|
|
|
216
384
|
case "auth":
|
|
217
385
|
auth();
|
|
218
386
|
break;
|
|
387
|
+
case "logs":
|
|
388
|
+
logs(args);
|
|
389
|
+
break;
|
|
390
|
+
case "version":
|
|
391
|
+
version();
|
|
392
|
+
break;
|
|
393
|
+
case "update":
|
|
394
|
+
await update(args);
|
|
395
|
+
break;
|
|
219
396
|
case "help":
|
|
220
397
|
case "--help":
|
|
221
398
|
case "-h":
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { spawn } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\nconst MAESTRO_DIR = path.join(os.homedir(), \".maestro\");\nconst PID_PATH = path.join(MAESTRO_DIR, \"server.pid\");\nconst META_PATH = path.join(MAESTRO_DIR, \"server-meta.json\");\nconst LOG_PATH = path.join(MAESTRO_DIR, \"server.log\");\nconst TOKEN_PATH = path.join(MAESTRO_DIR, \"token\");\nconst LEGACY_TOKEN_PATH = path.join(MAESTRO_DIR, \"api-token\");\nconst SERVER_PATH = path.join(PACKAGE_ROOT, \"dist\", \"server.js\");\nconst DEFAULT_HOST = process.env.HOST || \"0.0.0.0\";\nconst DEFAULT_PORT = process.env.PORT || \"4800\";\n\ninterface ServerMeta {\n pid: number;\n host: string;\n port: string;\n logPath: string;\n startedAt: string;\n cwd: string;\n}\n\nfunction ensureMaestroDir(): void {\n fs.mkdirSync(MAESTRO_DIR, { recursive: true });\n}\n\nfunction fail(message: string): never {\n console.error(message);\n process.exit(1);\n}\n\nfunction preflight(): void {\n if (!fs.existsSync(SERVER_PATH)) {\n fail(`Maestro server bundle not found at ${SERVER_PATH}`);\n }\n}\n\nfunction readPid(): number | null {\n try {\n const raw = fs.readFileSync(PID_PATH, \"utf8\").trim();\n if (!raw) return null;\n const pid = Number(raw);\n return Number.isInteger(pid) && pid > 0 ? pid : null;\n } catch {\n return null;\n }\n}\n\nfunction isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n if (process.platform === \"linux\") {\n try {\n const stat = fs.readFileSync(`/proc/${pid}/stat`, \"utf8\");\n const fields = stat.trim().split(\" \");\n if (fields[2] === \"Z\") {\n return false;\n }\n } catch {\n // Ignore /proc read failures and fall back to kill(0).\n }\n }\n return true;\n } catch (error) {\n return Boolean(\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n (error as NodeJS.ErrnoException).code === \"EPERM\"\n );\n }\n}\n\nfunction readMeta(): ServerMeta | null {\n try {\n return JSON.parse(fs.readFileSync(META_PATH, \"utf8\")) as ServerMeta;\n } catch {\n return null;\n }\n}\n\nfunction writeMeta(meta: ServerMeta): void {\n ensureMaestroDir();\n fs.writeFileSync(META_PATH, JSON.stringify(meta, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction cleanupState(): void {\n try {\n fs.unlinkSync(PID_PATH);\n } catch {}\n try {\n fs.unlinkSync(META_PATH);\n } catch {}\n}\n\nfunction resolveTokenPath(): string | null {\n if (fs.existsSync(TOKEN_PATH)) {\n return TOKEN_PATH;\n }\n if (fs.existsSync(LEGACY_TOKEN_PATH)) {\n return LEGACY_TOKEN_PATH;\n }\n return null;\n}\n\nfunction displayHost(host: string | undefined): string {\n if (!host || host === \"0.0.0.0\" || host === \"::\") {\n return \"127.0.0.1\";\n }\n return host;\n}\n\nfunction getStatus(): { running: boolean; pid: number | null; meta: ServerMeta | null } {\n const pid = readPid();\n const meta = readMeta();\n\n if (!pid) {\n return { running: false, pid: null, meta };\n }\n\n if (!isProcessAlive(pid)) {\n cleanupState();\n return { running: false, pid: null, meta };\n }\n\n return { running: true, pid, meta };\n}\n\nfunction start(): void {\n preflight();\n ensureMaestroDir();\n\n const current = getStatus();\n if (current.running) {\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is already running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n return;\n }\n\n const out = fs.openSync(LOG_PATH, \"a\");\n const env = {\n ...process.env,\n NODE_ENV: process.env.NODE_ENV || \"production\",\n HOST: DEFAULT_HOST,\n PORT: DEFAULT_PORT,\n MAESTRO_INSTALL_ROOT: PACKAGE_ROOT,\n };\n\n const child = spawn(process.execPath, [SERVER_PATH], {\n cwd: process.cwd(),\n detached: true,\n stdio: [\"ignore\", out, out],\n env,\n });\n\n child.unref();\n\n fs.writeFileSync(PID_PATH, `${child.pid}\\n`, \"utf8\");\n writeMeta({\n pid: child.pid ?? 0,\n host: env.HOST,\n port: env.PORT,\n logPath: LOG_PATH,\n startedAt: new Date().toISOString(),\n cwd: process.cwd(),\n });\n\n console.log(`Started Maestro (pid ${child.pid})`);\n console.log(`URL: http://${displayHost(env.HOST)}:${env.PORT}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function stop(): Promise<void> {\n const status = getStatus();\n if (!status.running || !status.pid) {\n console.log(\"Maestro is not running\");\n cleanupState();\n return;\n }\n\n process.kill(status.pid, \"SIGTERM\");\n\n const deadline = Date.now() + 10_000;\n while (Date.now() < deadline) {\n if (!isProcessAlive(status.pid)) {\n cleanupState();\n console.log(`Stopped Maestro (pid ${status.pid})`);\n return;\n }\n await sleep(200);\n }\n\n fail(`Timed out waiting for Maestro (pid ${status.pid}) to stop`);\n}\n\nfunction status(): void {\n const current = getStatus();\n if (!current.running) {\n console.log(\"Maestro is not running\");\n return;\n }\n\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction auth(): void {\n const tokenPath = resolveTokenPath();\n if (!tokenPath) {\n fail(`Maestro API token not found at ${TOKEN_PATH}. Start Maestro first.`);\n }\n\n const token = fs.readFileSync(tokenPath, \"utf8\").trim();\n const current = getStatus();\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n\n console.log(`Server URL: http://${host}:${port}`);\n console.log(`API token: ${token}`);\n console.log(`Token path: ${tokenPath}`);\n}\n\nfunction help(): void {\n console.log(\"Usage: maestro <command>\");\n console.log(\"\");\n console.log(\"Commands:\");\n console.log(\" start Start the Maestro server in the background\");\n console.log(\" stop Stop the background Maestro server\");\n console.log(\" status Show whether the Maestro server is running\");\n console.log(\" auth Print the local Maestro API token\");\n}\n\nasync function main(): Promise<void> {\n const cmd = process.argv[2];\n\n switch (cmd) {\n case \"start\":\n start();\n break;\n case \"stop\":\n await stop();\n break;\n case \"status\":\n status();\n break;\n case \"auth\":\n auth();\n break;\n case \"help\":\n case \"--help\":\n case \"-h\":\n case undefined:\n help();\n break;\n default:\n fail(`Unknown command: ${cmd}`);\n }\n}\n\nvoid main();\n"],
|
|
5
|
-
"mappings": ";AAAA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,aAAa;
|
|
6
|
-
"names": ["resolve", "status"]
|
|
4
|
+
"sourcesContent": ["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { execFileSync, spawn } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\n\nconst PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), \"..\");\nconst PACKAGE_JSON_PATH = path.join(PACKAGE_ROOT, \"package.json\");\nconst MAESTRO_DIR = path.join(os.homedir(), \".maestro\");\nconst PID_PATH = path.join(MAESTRO_DIR, \"server.pid\");\nconst META_PATH = path.join(MAESTRO_DIR, \"server-meta.json\");\nconst LOG_PATH = path.join(MAESTRO_DIR, \"server.log\");\nconst TOKEN_PATH = path.join(MAESTRO_DIR, \"token\");\nconst LEGACY_TOKEN_PATH = path.join(MAESTRO_DIR, \"api-token\");\nconst SERVER_PATH = path.join(PACKAGE_ROOT, \"dist\", \"server.js\");\nconst DEFAULT_HOST = process.env.HOST || \"0.0.0.0\";\nconst DEFAULT_PORT = process.env.PORT || \"4800\";\n\ninterface ServerMeta {\n pid: number;\n host: string;\n port: string;\n logPath: string;\n startedAt: string;\n cwd: string;\n}\n\ninterface PackageMeta {\n name: string;\n version: string;\n}\n\nfunction ensureMaestroDir(): void {\n fs.mkdirSync(MAESTRO_DIR, { recursive: true });\n}\n\nfunction fail(message: string): never {\n console.error(message);\n process.exit(1);\n}\n\nfunction readPackageMeta(): PackageMeta {\n try {\n return JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, \"utf8\")) as PackageMeta;\n } catch {\n fail(`Maestro package metadata not found at ${PACKAGE_JSON_PATH}`);\n }\n}\n\nfunction preflight(): void {\n if (!fs.existsSync(SERVER_PATH)) {\n fail(`Maestro server bundle not found at ${SERVER_PATH}`);\n }\n}\n\nfunction readPid(): number | null {\n try {\n const raw = fs.readFileSync(PID_PATH, \"utf8\").trim();\n if (!raw) return null;\n const pid = Number(raw);\n return Number.isInteger(pid) && pid > 0 ? pid : null;\n } catch {\n return null;\n }\n}\n\nfunction isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n if (process.platform === \"linux\") {\n try {\n const stat = fs.readFileSync(`/proc/${pid}/stat`, \"utf8\");\n const fields = stat.trim().split(\" \");\n if (fields[2] === \"Z\") {\n return false;\n }\n } catch {\n // Ignore /proc read failures and fall back to kill(0).\n }\n }\n return true;\n } catch (error) {\n return Boolean(\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n (error as NodeJS.ErrnoException).code === \"EPERM\"\n );\n }\n}\n\nfunction readMeta(): ServerMeta | null {\n try {\n return JSON.parse(fs.readFileSync(META_PATH, \"utf8\")) as ServerMeta;\n } catch {\n return null;\n }\n}\n\nfunction writeMeta(meta: ServerMeta): void {\n ensureMaestroDir();\n fs.writeFileSync(META_PATH, JSON.stringify(meta, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction cleanupState(): void {\n try {\n fs.unlinkSync(PID_PATH);\n } catch {}\n try {\n fs.unlinkSync(META_PATH);\n } catch {}\n}\n\nfunction resolveTokenPath(): string | null {\n if (fs.existsSync(TOKEN_PATH)) {\n return TOKEN_PATH;\n }\n if (fs.existsSync(LEGACY_TOKEN_PATH)) {\n return LEGACY_TOKEN_PATH;\n }\n return null;\n}\n\nfunction displayHost(host: string | undefined): string {\n if (!host || host === \"0.0.0.0\" || host === \"::\") {\n return \"127.0.0.1\";\n }\n return host;\n}\n\nfunction isContainerManagedInstall(): boolean {\n return fs.existsSync(\"/.dockerenv\") || Boolean(process.env.KUBERNETES_SERVICE_HOST);\n}\n\nfunction getNpmCommand(): string {\n const npmCommand = process.platform === \"win32\" ? \"npm.cmd\" : \"npm\";\n try {\n execFileSync(npmCommand, [\"--version\"], { stdio: [\"ignore\", \"ignore\", \"ignore\"] });\n return npmCommand;\n } catch {\n fail(\"npm is required for `maestro update`, but it was not found in PATH.\");\n }\n}\n\nfunction getGlobalNpmRoot(npmCommand: string): string {\n try {\n return execFileSync(npmCommand, [\"root\", \"-g\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n fail(\"Failed to determine the global npm install directory.\");\n }\n}\n\nfunction ensureGlobalNpmInstall(npmCommand: string, packageName: string): void {\n const globalRoot = path.resolve(getGlobalNpmRoot(npmCommand));\n const expectedRoot = path.resolve(globalRoot, packageName);\n const installedRoot = path.resolve(PACKAGE_ROOT);\n\n if (installedRoot !== expectedRoot) {\n fail(\n `maestro update only supports global npm installs. Expected package path ${expectedRoot}, found ${installedRoot}.`\n );\n }\n}\n\nfunction getLatestPublishedVersion(npmCommand: string, packageName: string): string {\n try {\n const raw = execFileSync(npmCommand, [\"view\", `${packageName}@latest`, \"version\"], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"inherit\"],\n }).trim();\n if (!raw) {\n throw new Error(\"empty version response\");\n }\n return raw;\n } catch {\n fail(`Failed to query the latest published version for ${packageName}.`);\n }\n}\n\nfunction version(): void {\n const meta = readPackageMeta();\n console.log(meta.version);\n}\n\nfunction runNpmInstallGlobal(npmCommand: string, packageName: string, versionSpec: string): void {\n try {\n execFileSync(\n npmCommand,\n [\"install\", \"-g\", `${packageName}@${versionSpec}`],\n { stdio: \"inherit\" }\n );\n } catch {\n throw new Error(`Failed to update ${packageName}@${versionSpec}.`);\n }\n}\n\nfunction getStatus(): { running: boolean; pid: number | null; meta: ServerMeta | null } {\n const pid = readPid();\n const meta = readMeta();\n\n if (!pid) {\n return { running: false, pid: null, meta };\n }\n\n if (!isProcessAlive(pid)) {\n cleanupState();\n return { running: false, pid: null, meta };\n }\n\n return { running: true, pid, meta };\n}\n\nfunction start(): void {\n preflight();\n ensureMaestroDir();\n\n const current = getStatus();\n if (current.running) {\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is already running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n return;\n }\n\n const out = fs.openSync(LOG_PATH, \"a\");\n const env = {\n ...process.env,\n NODE_ENV: process.env.NODE_ENV || \"production\",\n HOST: DEFAULT_HOST,\n PORT: DEFAULT_PORT,\n MAESTRO_INSTALL_ROOT: PACKAGE_ROOT,\n };\n\n const child = spawn(process.execPath, [SERVER_PATH], {\n cwd: process.cwd(),\n detached: true,\n stdio: [\"ignore\", out, out],\n env,\n });\n\n child.unref();\n\n fs.writeFileSync(PID_PATH, `${child.pid}\\n`, \"utf8\");\n writeMeta({\n pid: child.pid ?? 0,\n host: env.HOST,\n port: env.PORT,\n logPath: LOG_PATH,\n startedAt: new Date().toISOString(),\n cwd: process.cwd(),\n });\n\n console.log(`Started Maestro (pid ${child.pid})`);\n console.log(`URL: http://${displayHost(env.HOST)}:${env.PORT}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function stop(): Promise<void> {\n const status = getStatus();\n if (!status.running || !status.pid) {\n console.log(\"Maestro is not running\");\n cleanupState();\n return;\n }\n\n process.kill(status.pid, \"SIGTERM\");\n\n const deadline = Date.now() + 10_000;\n while (Date.now() < deadline) {\n if (!isProcessAlive(status.pid)) {\n cleanupState();\n console.log(`Stopped Maestro (pid ${status.pid})`);\n return;\n }\n await sleep(200);\n }\n\n fail(`Timed out waiting for Maestro (pid ${status.pid}) to stop`);\n}\n\nfunction status(): void {\n const current = getStatus();\n if (!current.running) {\n console.log(\"Maestro is not running\");\n return;\n }\n\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n console.log(`Maestro is running (pid ${current.pid})`);\n console.log(`URL: http://${host}:${port}`);\n console.log(`Log: ${LOG_PATH}`);\n}\n\nfunction auth(): void {\n const tokenPath = resolveTokenPath();\n if (!tokenPath) {\n fail(`Maestro API token not found at ${TOKEN_PATH}. Start Maestro first.`);\n }\n\n const token = fs.readFileSync(tokenPath, \"utf8\").trim();\n const current = getStatus();\n const host = displayHost(current.meta?.host || DEFAULT_HOST);\n const port = current.meta?.port || DEFAULT_PORT;\n\n console.log(`Server URL: http://${host}:${port}`);\n console.log(`API token: ${token}`);\n console.log(`Token path: ${tokenPath}`);\n}\n\nfunction logs(args: string[]): void {\n const follow = args.includes(\"-f\") || args.includes(\"--follow\");\n\n if (!fs.existsSync(LOG_PATH)) {\n fail(`Maestro log file not found at ${LOG_PATH}. Start Maestro first.`);\n }\n\n let position = 0;\n\n const printChunk = (start: number, end: number) => {\n if (end <= start) return;\n\n const fd = fs.openSync(LOG_PATH, \"r\");\n try {\n const length = end - start;\n const buffer = Buffer.alloc(length);\n fs.readSync(fd, buffer, 0, length, start);\n process.stdout.write(buffer);\n } finally {\n fs.closeSync(fd);\n }\n };\n\n const stat = fs.statSync(LOG_PATH);\n printChunk(0, stat.size);\n position = stat.size;\n\n if (!follow) {\n return;\n }\n\n const stopWatching = () => {\n fs.unwatchFile(LOG_PATH, onChange);\n };\n\n const onChange = (curr: fs.Stats, prev: fs.Stats) => {\n if (curr.size < position) {\n position = 0;\n }\n if (curr.size > position) {\n printChunk(position, curr.size);\n position = curr.size;\n } else if (prev.size > curr.size) {\n position = curr.size;\n }\n };\n\n process.on(\"SIGINT\", () => {\n stopWatching();\n process.exit(0);\n });\n\n process.on(\"SIGTERM\", () => {\n stopWatching();\n process.exit(0);\n });\n\n fs.watchFile(LOG_PATH, { interval: 500 }, onChange);\n}\n\nasync function update(args: string[]): Promise<void> {\n if (isContainerManagedInstall()) {\n fail(\"maestro update is only supported for bare-metal npm installs. Redeploy the container image instead.\");\n }\n\n const meta = readPackageMeta();\n const npmCommand = getNpmCommand();\n ensureGlobalNpmInstall(npmCommand, meta.name);\n\n const latestVersion = getLatestPublishedVersion(npmCommand, meta.name);\n const currentVersion = meta.version;\n const checkOnly = args.includes(\"--check\");\n\n console.log(`Installed: ${currentVersion}`);\n console.log(`Latest: ${latestVersion}`);\n\n if (currentVersion === latestVersion) {\n console.log(\"Maestro is already up to date.\");\n return;\n }\n\n if (checkOnly) {\n console.log(`Update available: ${currentVersion} -> ${latestVersion}`);\n return;\n }\n\n const current = getStatus();\n const wasRunning = current.running;\n\n if (wasRunning) {\n console.log(\"Stopping Maestro before update...\");\n await stop();\n }\n\n console.log(`Updating ${meta.name} to ${latestVersion}...`);\n try {\n runNpmInstallGlobal(npmCommand, meta.name, \"latest\");\n } catch (error) {\n if (wasRunning) {\n console.log(\"Update failed; attempting to restart the previous Maestro process...\");\n start();\n }\n fail(error instanceof Error ? error.message : \"Maestro update failed.\");\n }\n\n if (wasRunning) {\n console.log(\"Starting Maestro after update...\");\n start();\n } else {\n console.log(\"Update complete.\");\n }\n}\n\nfunction help(): void {\n console.log(\"Usage: maestro <command>\");\n console.log(\"\");\n console.log(\"Commands:\");\n console.log(\" start Start the Maestro server in the background\");\n console.log(\" stop Stop the background Maestro server\");\n console.log(\" status Show whether the Maestro server is running\");\n console.log(\" auth Print the local Maestro API token\");\n console.log(\" logs Print the Maestro server log\");\n console.log(\" version Print the installed Maestro CLI version\");\n console.log(\" update Update the globally installed Maestro CLI\");\n console.log(\"\");\n console.log(\"Options:\");\n console.log(\" maestro logs -f Follow the Maestro server log\");\n console.log(\" maestro update --check Check whether an update is available\");\n}\n\nasync function main(): Promise<void> {\n const cmd = process.argv[2];\n const args = process.argv.slice(3);\n\n switch (cmd) {\n case \"start\":\n start();\n break;\n case \"stop\":\n await stop();\n break;\n case \"status\":\n status();\n break;\n case \"auth\":\n auth();\n break;\n case \"logs\":\n logs(args);\n break;\n case \"version\":\n version();\n break;\n case \"update\":\n await update(args);\n break;\n case \"help\":\n case \"--help\":\n case \"-h\":\n case undefined:\n help();\n break;\n default:\n fail(`Unknown command: ${cmd}`);\n }\n}\n\nvoid main();\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,cAAc,aAAa;AACpC,SAAS,qBAAqB;AAE9B,IAAM,eAAoB,aAAa,aAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,IAAI;AACpF,IAAM,oBAAyB,UAAK,cAAc,cAAc;AAChE,IAAM,cAAmB,UAAQ,WAAQ,GAAG,UAAU;AACtD,IAAM,WAAgB,UAAK,aAAa,YAAY;AACpD,IAAM,YAAiB,UAAK,aAAa,kBAAkB;AAC3D,IAAM,WAAgB,UAAK,aAAa,YAAY;AACpD,IAAM,aAAkB,UAAK,aAAa,OAAO;AACjD,IAAM,oBAAyB,UAAK,aAAa,WAAW;AAC5D,IAAM,cAAmB,UAAK,cAAc,QAAQ,WAAW;AAC/D,IAAM,eAAe,QAAQ,IAAI,QAAQ;AACzC,IAAM,eAAe,QAAQ,IAAI,QAAQ;AAgBzC,SAAS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