@secondlayer/cli 5.5.0 → 5.6.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 +72 -23
- package/dist/cli.js.map +4 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14097,7 +14097,7 @@ __export(exports_node_impl, {
|
|
|
14097
14097
|
runSetupWizard: () => runSetupWizard,
|
|
14098
14098
|
restartNode: () => restartNode
|
|
14099
14099
|
});
|
|
14100
|
-
import { confirm as
|
|
14100
|
+
import { confirm as confirm5, input as input3, select as select3 } from "@inquirer/prompts";
|
|
14101
14101
|
async function runSetupWizard() {
|
|
14102
14102
|
console.log("");
|
|
14103
14103
|
console.log(blue("Stacks Node Setup Wizard"));
|
|
@@ -14134,13 +14134,13 @@ async function runSetupWizard() {
|
|
|
14134
14134
|
],
|
|
14135
14135
|
default: "mainnet"
|
|
14136
14136
|
});
|
|
14137
|
-
const autoStartIndexer = await
|
|
14137
|
+
const autoStartIndexer = await confirm5({
|
|
14138
14138
|
message: "Auto-start indexer when node starts?",
|
|
14139
14139
|
default: true
|
|
14140
14140
|
});
|
|
14141
14141
|
let indexerPort = 3700;
|
|
14142
14142
|
if (autoStartIndexer) {
|
|
14143
|
-
const customPort = await
|
|
14143
|
+
const customPort = await confirm5({
|
|
14144
14144
|
message: "Use default indexer port (3700)?",
|
|
14145
14145
|
default: true
|
|
14146
14146
|
});
|
|
@@ -14246,7 +14246,7 @@ async function stopNode(_pathOverride, force, _wait) {
|
|
|
14246
14246
|
return;
|
|
14247
14247
|
}
|
|
14248
14248
|
if (!force) {
|
|
14249
|
-
const proceed = await
|
|
14249
|
+
const proceed = await confirm5({
|
|
14250
14250
|
message: "Stop the Stacks node?",
|
|
14251
14251
|
default: false
|
|
14252
14252
|
});
|
|
@@ -14276,7 +14276,7 @@ async function restartNode(pathOverride, force, _wait) {
|
|
|
14276
14276
|
const wasRunning = await isNodeRunning();
|
|
14277
14277
|
if (wasRunning) {
|
|
14278
14278
|
if (!force) {
|
|
14279
|
-
const proceed = await
|
|
14279
|
+
const proceed = await confirm5({
|
|
14280
14280
|
message: "Restart the Stacks node?",
|
|
14281
14281
|
default: false
|
|
14282
14282
|
});
|
|
@@ -24175,7 +24175,7 @@ Filtered results for: ${this.inputValue ? this.inputValue : color.gray("Enter so
|
|
|
24175
24175
|
}
|
|
24176
24176
|
function requireConfirm() {
|
|
24177
24177
|
if (hasRequiredConfirm)
|
|
24178
|
-
return
|
|
24178
|
+
return confirm6;
|
|
24179
24179
|
hasRequiredConfirm = 1;
|
|
24180
24180
|
const color = requireKleur();
|
|
24181
24181
|
const Prompt = requirePrompt();
|
|
@@ -24248,8 +24248,8 @@ function requireConfirm() {
|
|
|
24248
24248
|
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
|
24249
24249
|
}
|
|
24250
24250
|
}
|
|
24251
|
-
|
|
24252
|
-
return
|
|
24251
|
+
confirm6 = ConfirmPrompt;
|
|
24252
|
+
return confirm6;
|
|
24253
24253
|
}
|
|
24254
24254
|
function requireElements() {
|
|
24255
24255
|
if (hasRequiredElements)
|
|
@@ -24929,7 +24929,7 @@ async function detect2({ autoInstall, programmatic, cwd } = {}) {
|
|
|
24929
24929
|
}
|
|
24930
24930
|
return agent;
|
|
24931
24931
|
}
|
|
24932
|
-
var ini$1, hasRequiredIni, iniExports, prompts$2, kleur, hasRequiredKleur, action, hasRequiredAction, strip, hasRequiredStrip, src, hasRequiredSrc, clear, hasRequiredClear, figures_1, hasRequiredFigures, style, hasRequiredStyle, lines, hasRequiredLines, wrap, hasRequiredWrap, entriesToDisplay, hasRequiredEntriesToDisplay, util, hasRequiredUtil, prompt, hasRequiredPrompt, text, hasRequiredText, select4, hasRequiredSelect, toggle, hasRequiredToggle, datepart, hasRequiredDatepart, meridiem, hasRequiredMeridiem, day, hasRequiredDay, hours, hasRequiredHours, milliseconds, hasRequiredMilliseconds, minutes, hasRequiredMinutes, month, hasRequiredMonth, seconds, hasRequiredSeconds, year, hasRequiredYear, dateparts, hasRequiredDateparts, date, hasRequiredDate, number, hasRequiredNumber, multiselect, hasRequiredMultiselect, autocomplete, hasRequiredAutocomplete, autocompleteMultiselect, hasRequiredAutocompleteMultiselect,
|
|
24932
|
+
var ini$1, hasRequiredIni, iniExports, prompts$2, kleur, hasRequiredKleur, action, hasRequiredAction, strip, hasRequiredStrip, src, hasRequiredSrc, clear, hasRequiredClear, figures_1, hasRequiredFigures, style, hasRequiredStyle, lines, hasRequiredLines, wrap, hasRequiredWrap, entriesToDisplay, hasRequiredEntriesToDisplay, util, hasRequiredUtil, prompt, hasRequiredPrompt, text, hasRequiredText, select4, hasRequiredSelect, toggle, hasRequiredToggle, datepart, hasRequiredDatepart, meridiem, hasRequiredMeridiem, day, hasRequiredDay, hours, hasRequiredHours, milliseconds, hasRequiredMilliseconds, minutes, hasRequiredMinutes, month, hasRequiredMonth, seconds, hasRequiredSeconds, year, hasRequiredYear, dateparts, hasRequiredDateparts, date, hasRequiredDate, number, hasRequiredNumber, multiselect, hasRequiredMultiselect, autocomplete, hasRequiredAutocomplete, autocompleteMultiselect, hasRequiredAutocompleteMultiselect, confirm6, hasRequiredConfirm, elements, hasRequiredElements, hasRequiredPrompts$1, lib$1, hasRequiredLib$1, prompts$1, hasRequiredPrompts, promptsExports, prompts, isBrowser, platform, OSC = "\x1B]", BEL = "\x07", SEP = ";", link = (text2, url) => [
|
|
24933
24933
|
OSC,
|
|
24934
24934
|
"8",
|
|
24935
24935
|
SEP,
|
|
@@ -32321,7 +32321,7 @@ var {
|
|
|
32321
32321
|
// package.json
|
|
32322
32322
|
var package_default = {
|
|
32323
32323
|
name: "@secondlayer/cli",
|
|
32324
|
-
version: "5.
|
|
32324
|
+
version: "5.6.0",
|
|
32325
32325
|
description: "CLI for subgraphs and blockchain indexing on Stacks",
|
|
32326
32326
|
type: "module",
|
|
32327
32327
|
bin: {
|
|
@@ -32901,8 +32901,11 @@ function registerConfigCommand(program2) {
|
|
|
32901
32901
|
process.exit(1);
|
|
32902
32902
|
}
|
|
32903
32903
|
});
|
|
32904
|
-
config.command("reset").description("Reset configuration to defaults").action(async () => {
|
|
32904
|
+
config.command("reset").description("Reset configuration to defaults").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
32905
32905
|
try {
|
|
32906
|
+
if (!opts.yes && !await confirmDestructive("Reset configuration to defaults?")) {
|
|
32907
|
+
return;
|
|
32908
|
+
}
|
|
32906
32909
|
await resetConfig();
|
|
32907
32910
|
success("Configuration reset to defaults");
|
|
32908
32911
|
} catch (err) {
|
|
@@ -32910,8 +32913,11 @@ function registerConfigCommand(program2) {
|
|
|
32910
32913
|
process.exit(1);
|
|
32911
32914
|
}
|
|
32912
32915
|
});
|
|
32913
|
-
config.command("clear").description("Clear all configuration (delete config file)").action(async () => {
|
|
32916
|
+
config.command("clear").description("Clear all configuration (delete config file)").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
32914
32917
|
try {
|
|
32918
|
+
if (!opts.yes && !await confirmDestructive("Delete the config file?")) {
|
|
32919
|
+
return;
|
|
32920
|
+
}
|
|
32915
32921
|
await clearConfig();
|
|
32916
32922
|
success("Configuration cleared");
|
|
32917
32923
|
} catch (err) {
|
|
@@ -32920,6 +32926,26 @@ function registerConfigCommand(program2) {
|
|
|
32920
32926
|
}
|
|
32921
32927
|
});
|
|
32922
32928
|
}
|
|
32929
|
+
async function confirmDestructive(message) {
|
|
32930
|
+
if (!process.stdin.isTTY) {
|
|
32931
|
+
error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
|
|
32932
|
+
process.exit(1);
|
|
32933
|
+
}
|
|
32934
|
+
const { confirm } = await import("@inquirer/prompts");
|
|
32935
|
+
try {
|
|
32936
|
+
const ok = await confirm({ message, default: false });
|
|
32937
|
+
if (!ok)
|
|
32938
|
+
console.log("Cancelled.");
|
|
32939
|
+
return ok;
|
|
32940
|
+
} catch (promptErr) {
|
|
32941
|
+
const m = promptErr instanceof Error ? promptErr.message : String(promptErr);
|
|
32942
|
+
if (m.includes("ExitPromptError") || m.includes("force closed")) {
|
|
32943
|
+
error("Interactive prompt unavailable. Re-run with -y to skip confirmation.");
|
|
32944
|
+
process.exit(1);
|
|
32945
|
+
}
|
|
32946
|
+
throw promptErr;
|
|
32947
|
+
}
|
|
32948
|
+
}
|
|
32923
32949
|
async function printConfigTree(cfg) {
|
|
32924
32950
|
const defaults = getDefaultConfig();
|
|
32925
32951
|
printValue("network", cfg.network, isDefaultValue(cfg, "network"));
|
|
@@ -34405,7 +34431,7 @@ import {
|
|
|
34405
34431
|
} from "node:fs";
|
|
34406
34432
|
import { dirname as dirname3, join as join6, resolve as resolve2 } from "node:path";
|
|
34407
34433
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
34408
|
-
import { confirm as
|
|
34434
|
+
import { confirm as confirm4 } from "@inquirer/prompts";
|
|
34409
34435
|
|
|
34410
34436
|
// src/generators/subgraph-scaffold.ts
|
|
34411
34437
|
init_format();
|
|
@@ -34611,10 +34637,33 @@ init_fs();
|
|
|
34611
34637
|
init_output();
|
|
34612
34638
|
|
|
34613
34639
|
// src/commands/login.ts
|
|
34614
|
-
import { input as input2 } from "@inquirer/prompts";
|
|
34640
|
+
import { confirm as confirm3, input as input2 } from "@inquirer/prompts";
|
|
34615
34641
|
init_output();
|
|
34616
34642
|
init_session();
|
|
34617
|
-
async function runLoginFlow() {
|
|
34643
|
+
async function runLoginFlow(options = {}) {
|
|
34644
|
+
if (!options.force) {
|
|
34645
|
+
const existing = await readSession();
|
|
34646
|
+
if (existing) {
|
|
34647
|
+
info(`Already logged in as ${existing.email}.`);
|
|
34648
|
+
if (!process.stdin.isTTY) {
|
|
34649
|
+
info(dim("Run 'sl logout' first, or re-run with --force to switch accounts."));
|
|
34650
|
+
return;
|
|
34651
|
+
}
|
|
34652
|
+
try {
|
|
34653
|
+
const proceed = await confirm3({
|
|
34654
|
+
message: "Log in as a different user?",
|
|
34655
|
+
default: false
|
|
34656
|
+
});
|
|
34657
|
+
if (!proceed) {
|
|
34658
|
+
info(dim("Run 'sl logout' to sign out."));
|
|
34659
|
+
return;
|
|
34660
|
+
}
|
|
34661
|
+
} catch {
|
|
34662
|
+
info(dim("Run 'sl logout' first, or re-run with --force to switch accounts."));
|
|
34663
|
+
return;
|
|
34664
|
+
}
|
|
34665
|
+
}
|
|
34666
|
+
}
|
|
34618
34667
|
const email = await input2({
|
|
34619
34668
|
message: "Email",
|
|
34620
34669
|
validate: (v) => /^.+@.+\..+$/.test(v) ? true : "Invalid email"
|
|
@@ -34664,7 +34713,7 @@ async function runLoginFlow() {
|
|
|
34664
34713
|
}
|
|
34665
34714
|
}
|
|
34666
34715
|
function registerLoginCommand(program2) {
|
|
34667
|
-
program2.command("login").description("Log in to Secondlayer (magic-link email)").action(runLoginFlow);
|
|
34716
|
+
program2.command("login").description("Log in to Secondlayer (magic-link email)").option("-f, --force", "Skip the already-logged-in check and re-run the flow").action((opts) => runLoginFlow({ force: opts.force }));
|
|
34668
34717
|
}
|
|
34669
34718
|
|
|
34670
34719
|
// src/lib/require-auth.ts
|
|
@@ -35068,7 +35117,7 @@ async function loadSubgraphWithDepCheck(absPath) {
|
|
|
35068
35117
|
if (!missingSdk)
|
|
35069
35118
|
throw err;
|
|
35070
35119
|
warn("Missing dependency: @secondlayer/subgraphs");
|
|
35071
|
-
const install = await
|
|
35120
|
+
const install = await confirm4({
|
|
35072
35121
|
message: "Install with `bun add @secondlayer/subgraphs`?",
|
|
35073
35122
|
default: true
|
|
35074
35123
|
});
|
|
@@ -35501,7 +35550,7 @@ Stopped watching.`);
|
|
|
35501
35550
|
info(` + columns: ${t}.${cols.join(", ")}`);
|
|
35502
35551
|
}
|
|
35503
35552
|
}
|
|
35504
|
-
const confirmed = options2.force || await
|
|
35553
|
+
const confirmed = options2.force || await confirm4({
|
|
35505
35554
|
message: "⚠ This will drop all data and reindex from scratch. Continue?"
|
|
35506
35555
|
});
|
|
35507
35556
|
if (!confirmed) {
|
|
@@ -35721,11 +35770,11 @@ Synced — exiting watch.`));
|
|
|
35721
35770
|
error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
|
|
35722
35771
|
process.exit(1);
|
|
35723
35772
|
}
|
|
35724
|
-
const { confirm:
|
|
35773
|
+
const { confirm: confirm5 } = await import("@inquirer/prompts");
|
|
35725
35774
|
const range = fromBlock !== undefined && toBlock !== undefined ? ` for blocks [${fromBlock}, ${toBlock}]` : fromBlock !== undefined ? ` from block ${fromBlock}` : toBlock !== undefined ? ` up to block ${toBlock}` : "";
|
|
35726
35775
|
let ok = false;
|
|
35727
35776
|
try {
|
|
35728
|
-
ok = await
|
|
35777
|
+
ok = await confirm5({
|
|
35729
35778
|
message: `Reindex subgraph "${name}"${range}? Existing rows in this range will be dropped and reprocessed.`,
|
|
35730
35779
|
default: false
|
|
35731
35780
|
});
|
|
@@ -35868,10 +35917,10 @@ ${rows.length} row(s)`));
|
|
|
35868
35917
|
error("Interactive prompt unavailable (stdin is not a TTY). Re-run with -y to skip confirmation.");
|
|
35869
35918
|
process.exit(1);
|
|
35870
35919
|
}
|
|
35871
|
-
const { confirm:
|
|
35920
|
+
const { confirm: confirm5 } = await import("@inquirer/prompts");
|
|
35872
35921
|
let ok = false;
|
|
35873
35922
|
try {
|
|
35874
|
-
ok = await
|
|
35923
|
+
ok = await confirm5({
|
|
35875
35924
|
message: `Delete subgraph "${name}" and all its data? This cannot be undone.`
|
|
35876
35925
|
});
|
|
35877
35926
|
} catch (promptErr) {
|
|
@@ -37169,5 +37218,5 @@ registerAccountCommand(program);
|
|
|
37169
37218
|
registerBillingCommand(program);
|
|
37170
37219
|
program.parse();
|
|
37171
37220
|
|
|
37172
|
-
//# debugId=
|
|
37221
|
+
//# debugId=7970B15474D6504C64756E2164756E21
|
|
37173
37222
|
//# sourceMappingURL=cli.js.map
|