@secondlayer/cli 19.2.2 → 19.3.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 +81 -12
- package/dist/cli.js.map +3 -3
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -29440,7 +29440,7 @@ var init_git_status = () => {};
|
|
|
29440
29440
|
|
|
29441
29441
|
// ../../node_modules/typescript/lib/typescript.js
|
|
29442
29442
|
var require_typescript = __commonJS(function(exports, module) {
|
|
29443
|
-
var __dirname = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-
|
|
29443
|
+
var __dirname = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-a5aea7deee5fef330/node_modules/typescript/lib", __filename = "/Users/ryan/projects/secondlayer/.claude/worktrees/agent-a5aea7deee5fef330/node_modules/typescript/lib/typescript.js";
|
|
29444
29444
|
/*! *****************************************************************************
|
|
29445
29445
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
29446
29446
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -198790,7 +198790,7 @@ import {
|
|
|
198790
198790
|
watch,
|
|
198791
198791
|
writeFileSync as writeFileSync3
|
|
198792
198792
|
} from "node:fs";
|
|
198793
|
-
import { basename, dirname as dirname5, extname, join as join7, resolve as resolve5 } from "node:path";
|
|
198793
|
+
import { basename, dirname as dirname5, extname, join as join7, relative, resolve as resolve5 } from "node:path";
|
|
198794
198794
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
198795
198795
|
import { confirm as confirm2 } from "@inquirer/prompts";
|
|
198796
198796
|
import {
|
|
@@ -198802,6 +198802,10 @@ import {
|
|
|
198802
198802
|
billingPausedCode
|
|
198803
198803
|
} from "@secondlayer/shared/schemas";
|
|
198804
198804
|
import { TRAIT_STANDARDS } from "@secondlayer/stacks/clarity";
|
|
198805
|
+
import {
|
|
198806
|
+
deriveVerification,
|
|
198807
|
+
isDeterminismViolation
|
|
198808
|
+
} from "@secondlayer/subgraphs/verification";
|
|
198805
198809
|
function webhookHint(apiUrl, name, firstTable) {
|
|
198806
198810
|
if (!firstTable || isMerchantUrl(apiUrl))
|
|
198807
198811
|
return null;
|
|
@@ -199121,6 +199125,36 @@ function createSubgraphDeployPreview(def, options = {}) {
|
|
|
199121
199125
|
...options.bundleBytes !== undefined ? { bundleSize: `${options.bundleBytes} bytes` } : {}
|
|
199122
199126
|
};
|
|
199123
199127
|
}
|
|
199128
|
+
function formatVerificationLines(verification, pin) {
|
|
199129
|
+
if (!verification)
|
|
199130
|
+
return [];
|
|
199131
|
+
const head = [
|
|
199132
|
+
verification.level,
|
|
199133
|
+
...pin ? [`pin ${pin.slice(0, 4)}…${pin.slice(-4)}`] : [],
|
|
199134
|
+
...verification.reasons
|
|
199135
|
+
].join(" · ");
|
|
199136
|
+
return [
|
|
199137
|
+
`verification ${head}`,
|
|
199138
|
+
...verification.unproven.map((u) => `unproven ${u}`)
|
|
199139
|
+
];
|
|
199140
|
+
}
|
|
199141
|
+
function formatVerificationStatus(verification) {
|
|
199142
|
+
if (!verification)
|
|
199143
|
+
return "unknown (deployed before levels were derived)";
|
|
199144
|
+
const head = [verification.level, ...verification.reasons].join(" · ");
|
|
199145
|
+
return verification.unproven.length > 0 ? `${head} (unproven: ${verification.unproven.join("; ")})` : head;
|
|
199146
|
+
}
|
|
199147
|
+
function checkDeterminism(def, findings) {
|
|
199148
|
+
const verification = deriveVerification(def, findings);
|
|
199149
|
+
if (isDeterminismViolation(verification)) {
|
|
199150
|
+
error("Nondeterministic handler. This subgraph's sources are provable, so its handlers must give the same rows on every run:");
|
|
199151
|
+
for (const r of verification.reasons)
|
|
199152
|
+
error(` ✗ ${r}`);
|
|
199153
|
+
info("Derive values from event, ctx.block and ctx.tx only (no Date, Math.random, fetch, timers or locale formatting).");
|
|
199154
|
+
process.exit(1);
|
|
199155
|
+
}
|
|
199156
|
+
return verification;
|
|
199157
|
+
}
|
|
199124
199158
|
function printSubgraphDeployPreview(preview, context) {
|
|
199125
199159
|
success("Subgraph deploy dry run passed");
|
|
199126
199160
|
const pairs = [
|
|
@@ -199493,8 +199527,11 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199493
199527
|
info(`${dryRun ? "Bundling for remote deploy dry run" : "Bundling for remote deploy"} (${config.network})...`);
|
|
199494
199528
|
const source = derived?.source ?? await readFile(absPath, "utf8");
|
|
199495
199529
|
const { bundleSubgraphCode } = await import("@secondlayer/bundler");
|
|
199496
|
-
const bundled = await bundleSubgraphCode(source
|
|
199530
|
+
const bundled = await bundleSubgraphCode(source, {
|
|
199531
|
+
fileName: relative(process.cwd(), absPath)
|
|
199532
|
+
});
|
|
199497
199533
|
const handlerCode = bundled.handlerCode;
|
|
199534
|
+
const localVerification = checkDeterminism(effectiveDef, bundled.findings);
|
|
199498
199535
|
if (dryRun) {
|
|
199499
199536
|
printSubgraphDeployPreview(createSubgraphDeployPreview(validated, {
|
|
199500
199537
|
bundleBytes: Buffer.byteLength(handlerCode, "utf8")
|
|
@@ -199503,6 +199540,9 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199503
199540
|
file: absPath,
|
|
199504
199541
|
bundled: true
|
|
199505
199542
|
});
|
|
199543
|
+
for (const line of formatVerificationLines(localVerification)) {
|
|
199544
|
+
info(` ${line}`);
|
|
199545
|
+
}
|
|
199506
199546
|
return;
|
|
199507
199547
|
}
|
|
199508
199548
|
const deployStartBlock = startBlock ?? effectiveDef.startBlock;
|
|
@@ -199544,6 +199584,11 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199544
199584
|
});
|
|
199545
199585
|
for (const w of result.warnings ?? [])
|
|
199546
199586
|
warn(w);
|
|
199587
|
+
const printVerification = () => {
|
|
199588
|
+
for (const line of formatVerificationLines(result.verification ?? localVerification, result.pin)) {
|
|
199589
|
+
info(` ${line}`);
|
|
199590
|
+
}
|
|
199591
|
+
};
|
|
199547
199592
|
const printDeployFooter = async () => {
|
|
199548
199593
|
try {
|
|
199549
199594
|
const { apiUrl } = await resolveAuth();
|
|
@@ -199563,10 +199608,13 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199563
199608
|
};
|
|
199564
199609
|
if (result.action === "unchanged") {
|
|
199565
199610
|
info(`Subgraph "${effectiveDef.name}" is up to date (v${result.version} — no changes)`);
|
|
199611
|
+
printVerification();
|
|
199566
199612
|
} else if (result.action === "handler_updated") {
|
|
199567
199613
|
success(`Subgraph "${effectiveDef.name}" handler updated (v${result.version} — schema unchanged, no reindex needed)`);
|
|
199614
|
+
printVerification();
|
|
199568
199615
|
} else if (result.action === "created") {
|
|
199569
199616
|
success(`Subgraph "${effectiveDef.name}" created → v${result.version}`);
|
|
199617
|
+
printVerification();
|
|
199570
199618
|
await printDeployFooter();
|
|
199571
199619
|
} else if (result.action === "reindexed") {
|
|
199572
199620
|
if (result.diff) {
|
|
@@ -199583,6 +199631,7 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199583
199631
|
}
|
|
199584
199632
|
}
|
|
199585
199633
|
success(`Subgraph "${effectiveDef.name}" updated → v${result.version} (reindexing)`);
|
|
199634
|
+
printVerification();
|
|
199586
199635
|
await printDeployFooter();
|
|
199587
199636
|
} else {
|
|
199588
199637
|
if (result.diff) {
|
|
@@ -199594,22 +199643,37 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199594
199643
|
}
|
|
199595
199644
|
}
|
|
199596
199645
|
success(`Subgraph "${effectiveDef.name}" updated → v${result.version}`);
|
|
199646
|
+
printVerification();
|
|
199597
199647
|
await printDeployFooter();
|
|
199598
199648
|
}
|
|
199599
199649
|
} else {
|
|
199650
|
+
let findings;
|
|
199651
|
+
try {
|
|
199652
|
+
const { bundleSubgraphCode } = await import("@secondlayer/bundler");
|
|
199653
|
+
findings = (await bundleSubgraphCode(await readFile(absPath, "utf8"), {
|
|
199654
|
+
fileName: relative(process.cwd(), absPath)
|
|
199655
|
+
})).findings;
|
|
199656
|
+
} catch {
|
|
199657
|
+
findings = undefined;
|
|
199658
|
+
}
|
|
199659
|
+
const verification = findings ? checkDeterminism(effectiveDef, findings) : undefined;
|
|
199600
199660
|
if (dryRun) {
|
|
199601
199661
|
printSubgraphDeployPreview(createSubgraphDeployPreview(validated), {
|
|
199602
199662
|
network: config.network,
|
|
199603
199663
|
file: absPath,
|
|
199604
199664
|
bundled: false
|
|
199605
199665
|
});
|
|
199666
|
+
for (const line of formatVerificationLines(verification)) {
|
|
199667
|
+
info(` ${line}`);
|
|
199668
|
+
}
|
|
199606
199669
|
return;
|
|
199607
199670
|
}
|
|
199608
199671
|
const { deploySchema } = await import("@secondlayer/subgraphs");
|
|
199609
199672
|
const { getDb, closeDb } = await import("@secondlayer/shared/db");
|
|
199610
199673
|
const db = getDb();
|
|
199611
199674
|
const result = await deploySchema(db, effectiveDef, absPath, {
|
|
199612
|
-
forceReindex: startBlock !== undefined
|
|
199675
|
+
forceReindex: startBlock !== undefined,
|
|
199676
|
+
verification
|
|
199613
199677
|
});
|
|
199614
199678
|
if (result.action === "unchanged") {
|
|
199615
199679
|
info(`Subgraph "${effectiveDef.name}" is up to date (v${result.version} — no changes)`);
|
|
@@ -199622,6 +199686,9 @@ deploy does not backfill from genesis.`).action(async (file, options) => {
|
|
|
199622
199686
|
} else {
|
|
199623
199687
|
success(`Subgraph "${effectiveDef.name}" updated → v${result.version}`);
|
|
199624
199688
|
}
|
|
199689
|
+
for (const line of formatVerificationLines(verification)) {
|
|
199690
|
+
info(` ${line}`);
|
|
199691
|
+
}
|
|
199625
199692
|
await closeDb();
|
|
199626
199693
|
}
|
|
199627
199694
|
} catch (err) {
|
|
@@ -199675,6 +199742,8 @@ ${data.length} subgraph(s) total`));
|
|
|
199675
199742
|
console.log(formatKeyValue([
|
|
199676
199743
|
["Name", subgraph.name],
|
|
199677
199744
|
["Version", subgraph.version],
|
|
199745
|
+
["Pin", subgraph.pin ?? "none (deployed before pins)"],
|
|
199746
|
+
["Verification", formatVerificationStatus(subgraph.verification)],
|
|
199678
199747
|
[
|
|
199679
199748
|
"Status",
|
|
199680
199749
|
formatSubgraphStatus(subgraph.status, subgraph.health.lastError)
|
|
@@ -202526,7 +202595,7 @@ var {
|
|
|
202526
202595
|
// package.json
|
|
202527
202596
|
var package_default = {
|
|
202528
202597
|
name: "@secondlayer/cli",
|
|
202529
|
-
version: "19.
|
|
202598
|
+
version: "19.3.0",
|
|
202530
202599
|
description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
|
|
202531
202600
|
repository: {
|
|
202532
202601
|
type: "git",
|
|
@@ -202563,12 +202632,12 @@ var package_default = {
|
|
|
202563
202632
|
"@biomejs/wasm-nodejs": "^1.9.0",
|
|
202564
202633
|
"@dsnp/parquetjs": "~1.8.8",
|
|
202565
202634
|
"@inquirer/prompts": "^8.2.0",
|
|
202566
|
-
"@secondlayer/bundler": "^0.
|
|
202635
|
+
"@secondlayer/bundler": "^0.7.0",
|
|
202567
202636
|
"@secondlayer/scaffold": "^1.6.1",
|
|
202568
202637
|
"@secondlayer/sdk": "^14.3.0",
|
|
202569
|
-
"@secondlayer/shared": "^11.
|
|
202638
|
+
"@secondlayer/shared": "^11.22.0",
|
|
202570
202639
|
"@secondlayer/stacks": "^6.1.1",
|
|
202571
|
-
"@secondlayer/subgraphs": "^6.
|
|
202640
|
+
"@secondlayer/subgraphs": "^6.4.0",
|
|
202572
202641
|
"@secondlayer/verify": "^0.2.0",
|
|
202573
202642
|
esbuild: "^0.28.2",
|
|
202574
202643
|
"smol-toml": "^1.8.0",
|
|
@@ -205301,7 +205370,7 @@ import {
|
|
|
205301
205370
|
statSync as statSync2,
|
|
205302
205371
|
writeFileSync as writeFileSync4
|
|
205303
205372
|
} from "node:fs";
|
|
205304
|
-
import { dirname as dirname6, join as join9, relative, resolve as resolve7 } from "node:path";
|
|
205373
|
+
import { dirname as dirname6, join as join9, relative as relative2, resolve as resolve7 } from "node:path";
|
|
205305
205374
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
205306
205375
|
import { input, select as select3 } from "@inquirer/prompts";
|
|
205307
205376
|
import { SecondLayer as SecondLayer4 } from "@secondlayer/sdk";
|
|
@@ -205483,7 +205552,7 @@ async function createWebhook(name, opts) {
|
|
|
205483
205552
|
const targetDir = resolve7(process.cwd(), name);
|
|
205484
205553
|
if (opts.scaffold !== false) {
|
|
205485
205554
|
if (existsSync5(targetDir)) {
|
|
205486
|
-
error(`Directory already exists: ${
|
|
205555
|
+
error(`Directory already exists: ${relative2(process.cwd(), targetDir)}`);
|
|
205487
205556
|
process.exit(1);
|
|
205488
205557
|
}
|
|
205489
205558
|
const tplRoot = templatesRoot();
|
|
@@ -205530,7 +205599,7 @@ async function createWebhook(name, opts) {
|
|
|
205530
205599
|
}
|
|
205531
205600
|
if (signingSecret && opts.scaffold !== false) {
|
|
205532
205601
|
const envTarget = writeSigningSecretEnv(targetDir, signingSecret);
|
|
205533
|
-
success(`Signing secret written to ${
|
|
205602
|
+
success(`Signing secret written to ${relative2(process.cwd(), envTarget)}`);
|
|
205534
205603
|
} else if (signingSecret && opts.scaffold === false) {
|
|
205535
205604
|
info(`Signing secret (store securely): ${signingSecret}`);
|
|
205536
205605
|
}
|
|
@@ -209529,5 +209598,5 @@ registerCreditsCommand(program);
|
|
|
209529
209598
|
registerArchiveCommand(program);
|
|
209530
209599
|
program.parse();
|
|
209531
209600
|
|
|
209532
|
-
//# debugId=
|
|
209601
|
+
//# debugId=ECF90476FCFF9CB564756E2164756E21
|
|
209533
209602
|
//# sourceMappingURL=cli.js.map
|