@secondlayer/cli 8.1.0 → 8.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 +107 -46
- package/dist/cli.js.map +3 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -12923,12 +12923,12 @@ __export(exports_dev_state, {
|
|
|
12923
12923
|
clearDevState: () => clearDevState
|
|
12924
12924
|
});
|
|
12925
12925
|
import { homedir as homedir4 } from "node:os";
|
|
12926
|
-
import { join as
|
|
12926
|
+
import { join as join9 } from "node:path";
|
|
12927
12927
|
function getLogsDir() {
|
|
12928
12928
|
return LOGS_DIR;
|
|
12929
12929
|
}
|
|
12930
12930
|
function getLogFile(service) {
|
|
12931
|
-
return
|
|
12931
|
+
return join9(LOGS_DIR, `${service}.log`);
|
|
12932
12932
|
}
|
|
12933
12933
|
async function ensureDirs() {
|
|
12934
12934
|
await Bun.$`mkdir -p ${STATE_DIR}`.quiet();
|
|
@@ -12985,9 +12985,9 @@ async function isDevRunning() {
|
|
|
12985
12985
|
}
|
|
12986
12986
|
var STATE_DIR, DEV_STATE_PATH, LOGS_DIR;
|
|
12987
12987
|
var init_dev_state = __esm(() => {
|
|
12988
|
-
STATE_DIR =
|
|
12989
|
-
DEV_STATE_PATH =
|
|
12990
|
-
LOGS_DIR =
|
|
12988
|
+
STATE_DIR = join9(homedir4(), ".secondlayer");
|
|
12989
|
+
DEV_STATE_PATH = join9(STATE_DIR, "dev.json");
|
|
12990
|
+
LOGS_DIR = join9(STATE_DIR, "logs");
|
|
12991
12991
|
});
|
|
12992
12992
|
|
|
12993
12993
|
// src/lib/network.ts
|
|
@@ -13378,10 +13378,10 @@ var init_manager = __esm(() => {
|
|
|
13378
13378
|
});
|
|
13379
13379
|
|
|
13380
13380
|
// src/services/indexer.ts
|
|
13381
|
-
import { dirname as
|
|
13381
|
+
import { dirname as dirname7, resolve as resolve3 } from "node:path";
|
|
13382
13382
|
async function startIndexer(options2) {
|
|
13383
13383
|
const port = options2.port ?? 3700;
|
|
13384
|
-
const rootDir =
|
|
13384
|
+
const rootDir = dirname7(dirname7(dirname7(dirname7(import.meta.dir))));
|
|
13385
13385
|
const indexerPath = resolve3(rootDir, "packages/indexer/src/index.ts");
|
|
13386
13386
|
await serviceManager.start(SERVICE_NAME, ["bun", "run", "--watch", indexerPath], {
|
|
13387
13387
|
port,
|
|
@@ -13398,9 +13398,9 @@ var init_indexer = __esm(() => {
|
|
|
13398
13398
|
});
|
|
13399
13399
|
|
|
13400
13400
|
// src/services/worker.ts
|
|
13401
|
-
import { dirname as
|
|
13401
|
+
import { dirname as dirname8, resolve as resolve4 } from "node:path";
|
|
13402
13402
|
async function startWorker(options2) {
|
|
13403
|
-
const rootDir =
|
|
13403
|
+
const rootDir = dirname8(dirname8(dirname8(dirname8(import.meta.dir))));
|
|
13404
13404
|
const workerPath = resolve4(rootDir, "packages/worker/src/index.ts");
|
|
13405
13405
|
await serviceManager.start(SERVICE_NAME2, ["bun", "run", "--watch", workerPath], {
|
|
13406
13406
|
onStdout: options2.onLog,
|
|
@@ -13413,10 +13413,10 @@ var init_worker = __esm(() => {
|
|
|
13413
13413
|
});
|
|
13414
13414
|
|
|
13415
13415
|
// src/services/api.ts
|
|
13416
|
-
import { dirname as
|
|
13416
|
+
import { dirname as dirname9, resolve as resolve5 } from "node:path";
|
|
13417
13417
|
async function startApi(options2) {
|
|
13418
13418
|
const port = options2.port ?? 3800;
|
|
13419
|
-
const rootDir =
|
|
13419
|
+
const rootDir = dirname9(dirname9(dirname9(dirname9(import.meta.dir))));
|
|
13420
13420
|
const apiPath = resolve5(rootDir, "packages/api/src/index.ts");
|
|
13421
13421
|
await serviceManager.start(SERVICE_NAME3, ["bun", "run", "--watch", apiPath], {
|
|
13422
13422
|
port,
|
|
@@ -13433,9 +13433,9 @@ var init_api2 = __esm(() => {
|
|
|
13433
13433
|
});
|
|
13434
13434
|
|
|
13435
13435
|
// src/services/subgraph-processor.ts
|
|
13436
|
-
import { dirname as
|
|
13436
|
+
import { dirname as dirname10, resolve as resolve6 } from "node:path";
|
|
13437
13437
|
async function startSubgraphProcessor(options2) {
|
|
13438
|
-
const rootDir =
|
|
13438
|
+
const rootDir = dirname10(dirname10(dirname10(dirname10(import.meta.dir))));
|
|
13439
13439
|
const servicePath = resolve6(rootDir, "packages/subgraphs/src/service.ts");
|
|
13440
13440
|
await serviceManager.start(SERVICE_NAME4, ["bun", "run", "--watch", servicePath], {
|
|
13441
13441
|
env: {
|
|
@@ -13471,7 +13471,7 @@ __export(exports_dev_impl, {
|
|
|
13471
13471
|
isDevAlreadyRunning: () => isDevAlreadyRunning
|
|
13472
13472
|
});
|
|
13473
13473
|
import { mkdirSync as mkdirSync4 } from "node:fs";
|
|
13474
|
-
import { dirname as
|
|
13474
|
+
import { dirname as dirname11, join as join10, resolve as resolve7 } from "node:path";
|
|
13475
13475
|
async function isDevAlreadyRunning() {
|
|
13476
13476
|
if (await isDevRunning()) {
|
|
13477
13477
|
const running = await getRunningServices();
|
|
@@ -13549,7 +13549,7 @@ async function runBackground(options2) {
|
|
|
13549
13549
|
startedAt: new Date().toISOString()
|
|
13550
13550
|
};
|
|
13551
13551
|
try {
|
|
13552
|
-
const packagesDir =
|
|
13552
|
+
const packagesDir = dirname11(dirname11(dirname11(dirname11(import.meta.dir))));
|
|
13553
13553
|
const env = { DATABASE_URL: databaseUrl, DEV_MODE: "true" };
|
|
13554
13554
|
const apiLogFile = getLogFile("api");
|
|
13555
13555
|
const apiProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/api/src/index.ts")], {
|
|
@@ -13899,7 +13899,7 @@ async function restartDev() {
|
|
|
13899
13899
|
await clearDevState();
|
|
13900
13900
|
await clearLogs();
|
|
13901
13901
|
const config = await loadConfig();
|
|
13902
|
-
const packagesDir =
|
|
13902
|
+
const packagesDir = dirname11(dirname11(dirname11(dirname11(import.meta.dir))));
|
|
13903
13903
|
const env = state.env;
|
|
13904
13904
|
const newState = {
|
|
13905
13905
|
services: {},
|
|
@@ -14080,7 +14080,7 @@ async function ensureDevPostgres(dataDir) {
|
|
|
14080
14080
|
if (check.stdout.toString().trim()) {
|
|
14081
14081
|
return false;
|
|
14082
14082
|
}
|
|
14083
|
-
const pgDataDir =
|
|
14083
|
+
const pgDataDir = join10(dataDir, "postgres");
|
|
14084
14084
|
mkdirSync4(pgDataDir, { recursive: true });
|
|
14085
14085
|
const stopped = await Bun.$`docker ps -aq -f name=secondlayer-dev-postgres`.quiet().nothrow();
|
|
14086
14086
|
if (stopped.stdout.toString().trim()) {
|
|
@@ -14096,7 +14096,7 @@ async function ensureDevPostgres(dataDir) {
|
|
|
14096
14096
|
throw new Error("PostgreSQL failed to start");
|
|
14097
14097
|
}
|
|
14098
14098
|
async function runMigrations(databaseUrl) {
|
|
14099
|
-
const packagesDir =
|
|
14099
|
+
const packagesDir = dirname11(dirname11(dirname11(dirname11(import.meta.dir))));
|
|
14100
14100
|
const migrateScript = resolve7(packagesDir, "packages/shared/src/db/migrate.ts");
|
|
14101
14101
|
const result = await Bun.$`DATABASE_URL=${databaseUrl} bun run ${migrateScript}`.quiet().nothrow();
|
|
14102
14102
|
if (result.exitCode !== 0) {
|
|
@@ -21874,7 +21874,7 @@ var init_commands = __esm(() => {
|
|
|
21874
21874
|
});
|
|
21875
21875
|
|
|
21876
21876
|
// ../../node_modules/@antfu/ni/dist/shared/ni.B5qNAuoI.mjs
|
|
21877
|
-
import path4, { join as
|
|
21877
|
+
import path4, { join as join12, dirname as dirname13, resolve as resolve9 } from "node:path";
|
|
21878
21878
|
import process$1 from "node:process";
|
|
21879
21879
|
import require$$0 from "readline";
|
|
21880
21880
|
import require$$2 from "events";
|
|
@@ -24889,7 +24889,7 @@ function requireLib() {
|
|
|
24889
24889
|
return lib;
|
|
24890
24890
|
hasRequiredLib = 1;
|
|
24891
24891
|
const { isexe, sync: isexeSync } = requireCjs();
|
|
24892
|
-
const { join:
|
|
24892
|
+
const { join: join13, delimiter, sep, posix: posix2 } = require$$1$2;
|
|
24893
24893
|
const isWindows = process.platform === "win32";
|
|
24894
24894
|
const rSlash = new RegExp(`[${posix2.sep}${sep === posix2.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
|
|
24895
24895
|
const rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
@@ -24916,7 +24916,7 @@ function requireLib() {
|
|
|
24916
24916
|
const getPathPart = (raw, cmd) => {
|
|
24917
24917
|
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
24918
24918
|
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
24919
|
-
return prefix +
|
|
24919
|
+
return prefix + join13(pathPart, cmd);
|
|
24920
24920
|
};
|
|
24921
24921
|
const which = async (cmd, opt = {}) => {
|
|
24922
24922
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
@@ -25065,7 +25065,7 @@ var init_ni_B5qNAuoI = __esm(() => {
|
|
|
25065
25065
|
options2 = {};
|
|
25066
25066
|
libExports = requireLib();
|
|
25067
25067
|
which = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
|
|
25068
|
-
CLI_TEMP_DIR =
|
|
25068
|
+
CLI_TEMP_DIR = join12(os4.tmpdir(), "antfu-ni");
|
|
25069
25069
|
customRcPath = process$1.env.NI_CONFIG_FILE;
|
|
25070
25070
|
home = process$1.platform === "win32" ? process$1.env.USERPROFILE : process$1.env.HOME;
|
|
25071
25071
|
defaultRcPath = path4.join(home || "~/", ".nirc");
|
|
@@ -32354,7 +32354,7 @@ var {
|
|
|
32354
32354
|
// package.json
|
|
32355
32355
|
var package_default = {
|
|
32356
32356
|
name: "@secondlayer/cli",
|
|
32357
|
-
version: "8.
|
|
32357
|
+
version: "8.3.0",
|
|
32358
32358
|
repository: {
|
|
32359
32359
|
type: "git",
|
|
32360
32360
|
url: "git+https://github.com/ryanwaits/secondlayer.git",
|
|
@@ -32403,8 +32403,8 @@ var package_default = {
|
|
|
32403
32403
|
dependencies: {
|
|
32404
32404
|
"@inquirer/prompts": "^8.2.0",
|
|
32405
32405
|
"@secondlayer/bundler": "^0.3.7",
|
|
32406
|
-
"@secondlayer/sdk": "^
|
|
32407
|
-
"@secondlayer/shared": "^6.
|
|
32406
|
+
"@secondlayer/sdk": "^6.0.0",
|
|
32407
|
+
"@secondlayer/shared": "^6.12.0",
|
|
32408
32408
|
"@secondlayer/stacks": "^2.3.0",
|
|
32409
32409
|
"@secondlayer/subgraphs": "^3.5.0",
|
|
32410
32410
|
"@biomejs/js-api": "^0.7.0",
|
|
@@ -36336,6 +36336,8 @@ Examples:
|
|
|
36336
36336
|
// src/commands/streams.ts
|
|
36337
36337
|
init_output();
|
|
36338
36338
|
init_resolve_auth();
|
|
36339
|
+
import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
36340
|
+
import { dirname as dirname6, join as join8 } from "node:path";
|
|
36339
36341
|
import { createStreamsClient } from "@secondlayer/sdk";
|
|
36340
36342
|
var DEFAULT_BASE_URL = "https://api.secondlayer.tools";
|
|
36341
36343
|
var VALID_TYPES = [
|
|
@@ -36365,17 +36367,37 @@ function client() {
|
|
|
36365
36367
|
apiKey: readApiKey()
|
|
36366
36368
|
});
|
|
36367
36369
|
}
|
|
36368
|
-
function
|
|
36370
|
+
function dumpsClient(dumpsUrl) {
|
|
36371
|
+
const dumpsBaseUrl = dumpsUrl ?? process.env.SL_STREAMS_DUMPS_URL;
|
|
36372
|
+
if (!dumpsBaseUrl) {
|
|
36373
|
+
error("No dumps URL. Pass --dumps-url <url> or set SL_STREAMS_DUMPS_URL (the public bulk bucket base; see GET /public/streams/dumps/manifest).");
|
|
36374
|
+
process.exit(1);
|
|
36375
|
+
}
|
|
36376
|
+
return createStreamsClient({
|
|
36377
|
+
baseUrl: process.env.SL_API_URL ?? DEFAULT_BASE_URL,
|
|
36378
|
+
apiKey: resolveEnvKey() ?? "",
|
|
36379
|
+
dumpsBaseUrl
|
|
36380
|
+
});
|
|
36381
|
+
}
|
|
36382
|
+
function parseTypes(value, flag = "--types") {
|
|
36369
36383
|
if (!value)
|
|
36370
36384
|
return;
|
|
36371
36385
|
const parts = value.split(",").map((s) => s.trim());
|
|
36372
36386
|
for (const p of parts) {
|
|
36373
36387
|
if (!VALID_TYPES.includes(p)) {
|
|
36374
|
-
throw new Error(`invalid
|
|
36388
|
+
throw new Error(`invalid ${flag} value "${p}"; expected one of: ${VALID_TYPES.join(", ")}`);
|
|
36375
36389
|
}
|
|
36376
36390
|
}
|
|
36377
36391
|
return parts;
|
|
36378
36392
|
}
|
|
36393
|
+
function parseList(value) {
|
|
36394
|
+
if (value === undefined)
|
|
36395
|
+
return;
|
|
36396
|
+
const parts = value.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
36397
|
+
if (parts.length === 0)
|
|
36398
|
+
return;
|
|
36399
|
+
return parts.length === 1 ? parts[0] : parts;
|
|
36400
|
+
}
|
|
36379
36401
|
function parseLimit(value) {
|
|
36380
36402
|
if (value === undefined)
|
|
36381
36403
|
return;
|
|
@@ -36405,15 +36427,19 @@ function registerStreamsCommand(program2) {
|
|
|
36405
36427
|
process.exit(1);
|
|
36406
36428
|
}
|
|
36407
36429
|
});
|
|
36408
|
-
streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--
|
|
36430
|
+
streams.command("events").description("List events (cursor-paginated; one page per call)").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--from-block <n>", "filter to blocks >= n").option("--to-block <n>", "filter to blocks <= n").option("--limit <n>", "page size (1-1000, default 100)", "100").addHelpText("after", `
|
|
36409
36431
|
Examples:
|
|
36410
36432
|
$ sl streams events --types stx_transfer,print --limit 50
|
|
36411
|
-
$ sl streams events --contract-id SP00....token
|
|
36433
|
+
$ sl streams events --not-types print --contract-id SP00....token,SP01....token
|
|
36434
|
+
$ sl streams events --sender SP1...,SP2... --from-block 150000 --to-block 160000
|
|
36412
36435
|
$ sl streams events --cursor 150000:3`).action(async (options2) => {
|
|
36413
36436
|
try {
|
|
36414
36437
|
const envelope = await client().events.list({
|
|
36415
36438
|
types: parseTypes(options2.types),
|
|
36416
|
-
|
|
36439
|
+
notTypes: parseTypes(options2.notTypes, "--not-types"),
|
|
36440
|
+
contractId: parseList(options2.contractId),
|
|
36441
|
+
sender: parseList(options2.sender),
|
|
36442
|
+
recipient: parseList(options2.recipient),
|
|
36417
36443
|
cursor: options2.cursor,
|
|
36418
36444
|
fromHeight: parseHeight(options2.fromBlock, "--from-block"),
|
|
36419
36445
|
toHeight: parseHeight(options2.toBlock, "--to-block"),
|
|
@@ -36425,19 +36451,21 @@ Examples:
|
|
|
36425
36451
|
process.exit(1);
|
|
36426
36452
|
}
|
|
36427
36453
|
});
|
|
36428
|
-
streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--
|
|
36454
|
+
streams.command("consume").description("Long-running pull from a cursor; emits one event per line (jsonl) until SIGINT or --max-pages").option("--types <types>", `comma-separated event types (${VALID_TYPES.join(", ")})`).option("--not-types <types>", "comma-separated event types to exclude").option("--contract-id <ids>", "comma-separated contract identifier(s)").option("--sender <addrs>", "comma-separated sender principal(s)").option("--recipient <addrs>", "comma-separated recipient principal(s)").option("--cursor <cursor>", "start cursor (block_height:event_index)").option("--batch-size <n>", "events per batch (1-1000, default 100)", "100").option("--max-pages <n>", "stop after N pages (default: run until SIGINT)").addHelpText("after", `
|
|
36429
36455
|
Examples:
|
|
36430
36456
|
$ sl streams consume --types print --cursor 150000:0
|
|
36431
|
-
$ sl streams consume --types
|
|
36457
|
+
$ sl streams consume --not-types print --sender SP1...,SP2... --batch-size 500 --max-pages 10`).action(async (options2) => {
|
|
36432
36458
|
try {
|
|
36433
|
-
const types6 = parseTypes(options2.types);
|
|
36434
36459
|
const batchSize = parseLimit(options2.batchSize) ?? 100;
|
|
36435
36460
|
const maxPages = options2.maxPages ? Number.parseInt(options2.maxPages, 10) : undefined;
|
|
36436
36461
|
note("# streaming events to stdout (jsonl); next_cursor printed to stderr");
|
|
36437
36462
|
await client().events.consume({
|
|
36438
36463
|
fromCursor: options2.cursor,
|
|
36439
|
-
types:
|
|
36440
|
-
|
|
36464
|
+
types: parseTypes(options2.types),
|
|
36465
|
+
notTypes: parseTypes(options2.notTypes, "--not-types"),
|
|
36466
|
+
contractId: parseList(options2.contractId),
|
|
36467
|
+
sender: parseList(options2.sender),
|
|
36468
|
+
recipient: parseList(options2.recipient),
|
|
36441
36469
|
batchSize,
|
|
36442
36470
|
mode: "tail",
|
|
36443
36471
|
maxPages,
|
|
@@ -36470,6 +36498,39 @@ Examples:
|
|
|
36470
36498
|
process.exit(1);
|
|
36471
36499
|
}
|
|
36472
36500
|
});
|
|
36501
|
+
streams.command("pull").description("Download finalized bulk parquet dumps to a local dir (verifies sha256)").requiredOption("--to <dir>", "output directory").option("--dumps-url <url>", "public dumps base URL (or SL_STREAMS_DUMPS_URL)").option("--from-block <n>", "only files covering blocks >= n").option("--to-block <n>", "only files covering blocks <= n").addHelpText("after", `
|
|
36502
|
+
Examples:
|
|
36503
|
+
$ sl streams pull --to ./dump
|
|
36504
|
+
$ sl streams pull --to ./dump --from-block 150000 --to-block 200000`).action(async (options2) => {
|
|
36505
|
+
try {
|
|
36506
|
+
const fromBlock = parseHeight(options2.fromBlock, "--from-block");
|
|
36507
|
+
const toBlock = parseHeight(options2.toBlock, "--to-block");
|
|
36508
|
+
const dumps = dumpsClient(options2.dumpsUrl).dumps;
|
|
36509
|
+
const manifest = await dumps.list();
|
|
36510
|
+
const files = manifest.files.filter((f) => (fromBlock === undefined || f.to_block >= fromBlock) && (toBlock === undefined || f.from_block <= toBlock));
|
|
36511
|
+
if (files.length === 0) {
|
|
36512
|
+
note("# no dump files match the requested range");
|
|
36513
|
+
return;
|
|
36514
|
+
}
|
|
36515
|
+
note(`# downloading ${files.length} file(s) to ${options2.to}`);
|
|
36516
|
+
for (const file of files) {
|
|
36517
|
+
const bytes = await dumps.download(file);
|
|
36518
|
+
const dest = join8(options2.to, file.path);
|
|
36519
|
+
await mkdir3(dirname6(dest), { recursive: true });
|
|
36520
|
+
await writeFile3(dest, bytes);
|
|
36521
|
+
process.stderr.write(`# ${file.path} (${file.row_count} rows, ${bytes.byteLength} bytes)
|
|
36522
|
+
`);
|
|
36523
|
+
}
|
|
36524
|
+
writeData(JSON.stringify({
|
|
36525
|
+
files: files.length,
|
|
36526
|
+
to: options2.to,
|
|
36527
|
+
latest_finalized_cursor: manifest.latest_finalized_cursor
|
|
36528
|
+
}, null, 2));
|
|
36529
|
+
} catch (err) {
|
|
36530
|
+
error(err instanceof Error ? err.message : String(err));
|
|
36531
|
+
process.exit(1);
|
|
36532
|
+
}
|
|
36533
|
+
});
|
|
36473
36534
|
streams.command("canonical <height>").description("Canonical block metadata at a given height").action(async (heightArg) => {
|
|
36474
36535
|
try {
|
|
36475
36536
|
const height = parseHeight(heightArg, "<height>");
|
|
@@ -37722,9 +37783,9 @@ init_output();
|
|
|
37722
37783
|
|
|
37723
37784
|
// src/lib/project-file.ts
|
|
37724
37785
|
import { existsSync as existsSync5 } from "node:fs";
|
|
37725
|
-
import { mkdir as
|
|
37786
|
+
import { mkdir as mkdir4, readFile as readFile3, writeFile as writeFile4 } from "node:fs/promises";
|
|
37726
37787
|
import { homedir as homedir5 } from "node:os";
|
|
37727
|
-
import { dirname as
|
|
37788
|
+
import { dirname as dirname12, join as join11, parse as parsePath2, resolve as resolve8 } from "node:path";
|
|
37728
37789
|
import { z as z3 } from "zod/v4";
|
|
37729
37790
|
var ProjectFileSchema = z3.object({
|
|
37730
37791
|
slug: z3.string().min(1)
|
|
@@ -37736,7 +37797,7 @@ async function readActiveProject(cwd, globalDefault) {
|
|
|
37736
37797
|
const home = resolve8(homedir5());
|
|
37737
37798
|
const fsRoot = parsePath2(dir).root;
|
|
37738
37799
|
while (true) {
|
|
37739
|
-
const candidate =
|
|
37800
|
+
const candidate = join11(dir, DIRNAME, FILENAME);
|
|
37740
37801
|
if (existsSync5(candidate)) {
|
|
37741
37802
|
try {
|
|
37742
37803
|
const raw = await readFile3(candidate, "utf8");
|
|
@@ -37744,11 +37805,11 @@ async function readActiveProject(cwd, globalDefault) {
|
|
|
37744
37805
|
return { slug: parsed.slug, resolvedFrom: candidate };
|
|
37745
37806
|
} catch {}
|
|
37746
37807
|
}
|
|
37747
|
-
if (existsSync5(
|
|
37808
|
+
if (existsSync5(join11(dir, ".git")))
|
|
37748
37809
|
break;
|
|
37749
37810
|
if (dir === home || dir === fsRoot)
|
|
37750
37811
|
break;
|
|
37751
|
-
const parent =
|
|
37812
|
+
const parent = dirname12(dir);
|
|
37752
37813
|
if (parent === dir)
|
|
37753
37814
|
break;
|
|
37754
37815
|
dir = parent;
|
|
@@ -37756,16 +37817,16 @@ async function readActiveProject(cwd, globalDefault) {
|
|
|
37756
37817
|
if (globalDefault) {
|
|
37757
37818
|
return {
|
|
37758
37819
|
slug: globalDefault,
|
|
37759
|
-
resolvedFrom:
|
|
37820
|
+
resolvedFrom: join11(homedir5(), ".secondlayer", "config.json")
|
|
37760
37821
|
};
|
|
37761
37822
|
}
|
|
37762
37823
|
return null;
|
|
37763
37824
|
}
|
|
37764
37825
|
async function writeActiveProject(slug, cwd) {
|
|
37765
|
-
const dir =
|
|
37766
|
-
await
|
|
37767
|
-
const file =
|
|
37768
|
-
await
|
|
37826
|
+
const dir = join11(resolve8(cwd), DIRNAME);
|
|
37827
|
+
await mkdir4(dir, { recursive: true });
|
|
37828
|
+
const file = join11(dir, FILENAME);
|
|
37829
|
+
await writeFile4(file, `${JSON.stringify({ slug }, null, 2)}
|
|
37769
37830
|
`, "utf8");
|
|
37770
37831
|
return file;
|
|
37771
37832
|
}
|
|
@@ -38020,5 +38081,5 @@ program.commandsGroup("Account:");
|
|
|
38020
38081
|
registerAccountCommand(program);
|
|
38021
38082
|
program.parse();
|
|
38022
38083
|
|
|
38023
|
-
//# debugId=
|
|
38084
|
+
//# debugId=67F4C351C45DEDAA64756E2164756E21
|
|
38024
38085
|
//# sourceMappingURL=cli.js.map
|