@secondlayer/cli 10.3.2 → 10.4.0
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 +64 -3
- package/dist/cli.js.map +7 -6
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -34789,7 +34789,7 @@ init_esm();
|
|
|
34789
34789
|
// package.json
|
|
34790
34790
|
var package_default = {
|
|
34791
34791
|
name: "@secondlayer/cli",
|
|
34792
|
-
version: "10.
|
|
34792
|
+
version: "10.4.0",
|
|
34793
34793
|
repository: {
|
|
34794
34794
|
type: "git",
|
|
34795
34795
|
url: "git+https://github.com/ryanwaits/secondlayer.git",
|
|
@@ -34833,7 +34833,7 @@ var package_default = {
|
|
|
34833
34833
|
"@secondlayer/bundler": "^0.5.0",
|
|
34834
34834
|
"@secondlayer/scaffold": "^1.5.1",
|
|
34835
34835
|
"@secondlayer/sdk": "^6.54.1",
|
|
34836
|
-
"@secondlayer/shared": "^7.11.
|
|
34836
|
+
"@secondlayer/shared": "^7.11.2",
|
|
34837
34837
|
"@secondlayer/stacks": "^3.3.1",
|
|
34838
34838
|
"@secondlayer/subgraphs": "^3.26.4",
|
|
34839
34839
|
esbuild: "^0.27.4",
|
|
@@ -35497,6 +35497,65 @@ async function validateDatabaseConnection(url) {
|
|
|
35497
35497
|
console.log(dim("The URL was saved but connection failed. Check your database settings."));
|
|
35498
35498
|
}
|
|
35499
35499
|
}
|
|
35500
|
+
// src/commands/console.ts
|
|
35501
|
+
init_output();
|
|
35502
|
+
init_resolve_auth();
|
|
35503
|
+
import { spawn as spawn3 } from "node:child_process";
|
|
35504
|
+
var DEFAULT_CONSOLE_URL = "http://localhost:3801/console";
|
|
35505
|
+
var CONSOLE_PORT = 3801;
|
|
35506
|
+
function resolveConsoleUrl(override) {
|
|
35507
|
+
if (override)
|
|
35508
|
+
return override.replace(/\/+$/, "");
|
|
35509
|
+
const apiUrl = process.env.SL_API_URL;
|
|
35510
|
+
if (apiUrl && isOssMode()) {
|
|
35511
|
+
try {
|
|
35512
|
+
const { protocol, hostname } = new URL(apiUrl);
|
|
35513
|
+
return `${protocol}//${hostname}:${CONSOLE_PORT}/console`;
|
|
35514
|
+
} catch {}
|
|
35515
|
+
}
|
|
35516
|
+
return DEFAULT_CONSOLE_URL;
|
|
35517
|
+
}
|
|
35518
|
+
async function isReachable(url) {
|
|
35519
|
+
try {
|
|
35520
|
+
await fetch(url, { signal: AbortSignal.timeout(2000) });
|
|
35521
|
+
return true;
|
|
35522
|
+
} catch {
|
|
35523
|
+
return false;
|
|
35524
|
+
}
|
|
35525
|
+
}
|
|
35526
|
+
function openBrowser(url) {
|
|
35527
|
+
const opener = process.platform === "darwin" ? "open" : process.platform === "linux" ? "xdg-open" : undefined;
|
|
35528
|
+
if (!opener)
|
|
35529
|
+
return Promise.resolve(false);
|
|
35530
|
+
return new Promise((resolve5) => {
|
|
35531
|
+
const child = spawn3(opener, [url], { stdio: "ignore", detached: true });
|
|
35532
|
+
child.once("error", () => resolve5(false));
|
|
35533
|
+
child.once("spawn", () => {
|
|
35534
|
+
child.unref();
|
|
35535
|
+
resolve5(true);
|
|
35536
|
+
});
|
|
35537
|
+
});
|
|
35538
|
+
}
|
|
35539
|
+
function registerConsoleCommand(program2) {
|
|
35540
|
+
program2.command("console").description("Open the console UI in a browser").option("--url <url>", `Console URL (default ${DEFAULT_CONSOLE_URL})`).option("--no-open", "Print the console URL instead of opening a browser").action(async (options3) => {
|
|
35541
|
+
const url = resolveConsoleUrl(options3.url);
|
|
35542
|
+
if (options3.open === false) {
|
|
35543
|
+
writeData(url);
|
|
35544
|
+
return;
|
|
35545
|
+
}
|
|
35546
|
+
if (!await isReachable(url)) {
|
|
35547
|
+
printError(`Console not reachable at ${url}`, {
|
|
35548
|
+
hint: "docker compose --profile console up -d"
|
|
35549
|
+
});
|
|
35550
|
+
process.exit(1);
|
|
35551
|
+
}
|
|
35552
|
+
if (await openBrowser(url)) {
|
|
35553
|
+
success(`console: ${url}`);
|
|
35554
|
+
} else {
|
|
35555
|
+
writeData(url);
|
|
35556
|
+
}
|
|
35557
|
+
});
|
|
35558
|
+
}
|
|
35500
35559
|
// src/commands/context.ts
|
|
35501
35560
|
init_output();
|
|
35502
35561
|
init_resolve_auth();
|
|
@@ -39873,6 +39932,7 @@ function registerStartCommand(program2) {
|
|
|
39873
39932
|
}
|
|
39874
39933
|
success(`config ok (${parsed.config.NETWORK}, ${parsed.config.NODE_MODE})`);
|
|
39875
39934
|
console.log(cmd);
|
|
39935
|
+
note(" console UI (optional): add --profile console, then `secondlayer console`");
|
|
39876
39936
|
});
|
|
39877
39937
|
}
|
|
39878
39938
|
// src/cli.ts
|
|
@@ -39899,6 +39959,7 @@ registerInitCommand(program);
|
|
|
39899
39959
|
registerBootstrapCommand(program);
|
|
39900
39960
|
registerObserverCommand(program);
|
|
39901
39961
|
registerStartCommand(program);
|
|
39962
|
+
registerConsoleCommand(program);
|
|
39902
39963
|
registerLoginCommand(program);
|
|
39903
39964
|
registerLogoutCommand(program);
|
|
39904
39965
|
registerWhoamiCommand(program);
|
|
@@ -39939,5 +40000,5 @@ registerAccountCommand(program);
|
|
|
39939
40000
|
registerKeysCommand(program);
|
|
39940
40001
|
program.parse();
|
|
39941
40002
|
|
|
39942
|
-
//# debugId=
|
|
40003
|
+
//# debugId=1A69CC6C65B95E8B64756E2164756E21
|
|
39943
40004
|
//# sourceMappingURL=cli.js.map
|