@secondlayer/cli 8.0.0 → 8.2.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 +115 -61
- package/dist/cli.js.map +4 -4
- 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.2.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": "^5.
|
|
32407
|
-
"@secondlayer/shared": "^6.
|
|
32406
|
+
"@secondlayer/sdk": "^5.9.0",
|
|
32407
|
+
"@secondlayer/shared": "^6.11.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,6 +36367,18 @@ function client() {
|
|
|
36365
36367
|
apiKey: readApiKey()
|
|
36366
36368
|
});
|
|
36367
36369
|
}
|
|
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
|
+
}
|
|
36368
36382
|
function parseTypes(value) {
|
|
36369
36383
|
if (!value)
|
|
36370
36384
|
return;
|
|
@@ -36470,6 +36484,39 @@ Examples:
|
|
|
36470
36484
|
process.exit(1);
|
|
36471
36485
|
}
|
|
36472
36486
|
});
|
|
36487
|
+
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", `
|
|
36488
|
+
Examples:
|
|
36489
|
+
$ sl streams pull --to ./dump
|
|
36490
|
+
$ sl streams pull --to ./dump --from-block 150000 --to-block 200000`).action(async (options2) => {
|
|
36491
|
+
try {
|
|
36492
|
+
const fromBlock = parseHeight(options2.fromBlock, "--from-block");
|
|
36493
|
+
const toBlock = parseHeight(options2.toBlock, "--to-block");
|
|
36494
|
+
const dumps = dumpsClient(options2.dumpsUrl).dumps;
|
|
36495
|
+
const manifest = await dumps.list();
|
|
36496
|
+
const files = manifest.files.filter((f) => (fromBlock === undefined || f.to_block >= fromBlock) && (toBlock === undefined || f.from_block <= toBlock));
|
|
36497
|
+
if (files.length === 0) {
|
|
36498
|
+
note("# no dump files match the requested range");
|
|
36499
|
+
return;
|
|
36500
|
+
}
|
|
36501
|
+
note(`# downloading ${files.length} file(s) to ${options2.to}`);
|
|
36502
|
+
for (const file of files) {
|
|
36503
|
+
const bytes = await dumps.download(file);
|
|
36504
|
+
const dest = join8(options2.to, file.path);
|
|
36505
|
+
await mkdir3(dirname6(dest), { recursive: true });
|
|
36506
|
+
await writeFile3(dest, bytes);
|
|
36507
|
+
process.stderr.write(`# ${file.path} (${file.row_count} rows, ${bytes.byteLength} bytes)
|
|
36508
|
+
`);
|
|
36509
|
+
}
|
|
36510
|
+
writeData(JSON.stringify({
|
|
36511
|
+
files: files.length,
|
|
36512
|
+
to: options2.to,
|
|
36513
|
+
latest_finalized_cursor: manifest.latest_finalized_cursor
|
|
36514
|
+
}, null, 2));
|
|
36515
|
+
} catch (err) {
|
|
36516
|
+
error(err instanceof Error ? err.message : String(err));
|
|
36517
|
+
process.exit(1);
|
|
36518
|
+
}
|
|
36519
|
+
});
|
|
36473
36520
|
streams.command("canonical <height>").description("Canonical block metadata at a given height").action(async (heightArg) => {
|
|
36474
36521
|
try {
|
|
36475
36522
|
const height = parseHeight(heightArg, "<height>");
|
|
@@ -37420,6 +37467,29 @@ init_dev_state();
|
|
|
37420
37467
|
init_node_manager();
|
|
37421
37468
|
init_output();
|
|
37422
37469
|
var DEV_SERVICES = ["api", "indexer", "worker", "subgraphs"];
|
|
37470
|
+
async function startStack(options2) {
|
|
37471
|
+
if (options2.devnet) {
|
|
37472
|
+
await connect({
|
|
37473
|
+
project: options2.project,
|
|
37474
|
+
imageTag: options2.imageTag ?? DEFAULT_IMAGE_TAG,
|
|
37475
|
+
owner: options2.owner,
|
|
37476
|
+
up: options2.up ?? true
|
|
37477
|
+
});
|
|
37478
|
+
} else {
|
|
37479
|
+
await stackStart({ node: options2.node, dev: options2.dev });
|
|
37480
|
+
}
|
|
37481
|
+
}
|
|
37482
|
+
async function stopStack(options2) {
|
|
37483
|
+
if (options2.devnet) {
|
|
37484
|
+
await down({ project: options2.project, purge: options2.purge });
|
|
37485
|
+
} else {
|
|
37486
|
+
await stackStop({
|
|
37487
|
+
node: options2.node,
|
|
37488
|
+
dev: options2.dev,
|
|
37489
|
+
wait: options2.wait
|
|
37490
|
+
});
|
|
37491
|
+
}
|
|
37492
|
+
}
|
|
37423
37493
|
function registerLocalCommand(program2) {
|
|
37424
37494
|
const local = program2.command("local").description("Manage local development environment and Stacks node").hook("preAction", async (_thisCommand, actionCommand) => {
|
|
37425
37495
|
if (actionCommand.name() === "help")
|
|
@@ -37441,32 +37511,16 @@ function registerLocalCommand(program2) {
|
|
|
37441
37511
|
const { stopDev: stopDev2 } = await Promise.resolve().then(() => (init_dev_impl(), exports_dev_impl));
|
|
37442
37512
|
await stopDev2();
|
|
37443
37513
|
});
|
|
37444
|
-
local.command("
|
|
37445
|
-
|
|
37446
|
-
|
|
37447
|
-
|
|
37448
|
-
|
|
37449
|
-
|
|
37450
|
-
|
|
37451
|
-
project: options2.project,
|
|
37452
|
-
imageTag: options2.imageTag ?? DEFAULT_IMAGE_TAG,
|
|
37453
|
-
owner: options2.owner,
|
|
37454
|
-
up: options2.up
|
|
37455
|
-
});
|
|
37456
|
-
} else {
|
|
37457
|
-
await stackStart({ node: options2.node, dev: options2.dev });
|
|
37458
|
-
}
|
|
37459
|
-
});
|
|
37460
|
-
local.command("down").description("Stop the full local stack").option("--devnet", "Stop a local Clarinet devnet instead").option("--no-node", "Skip stopping the Stacks node").option("--no-dev", "Skip stopping dev services").option("--wait", "Wait for in-flight work to drain before stopping").option("--project <dir>", "[--devnet] Clarinet project directory").option("--purge", "[--devnet] Also remove volumes (wipes the local index)").action(async (options2) => {
|
|
37461
|
-
if (options2.devnet) {
|
|
37462
|
-
await down({ project: options2.project, purge: options2.purge });
|
|
37463
|
-
} else {
|
|
37464
|
-
await stackStop({
|
|
37465
|
-
node: options2.node,
|
|
37466
|
-
dev: options2.dev,
|
|
37467
|
-
wait: options2.wait
|
|
37468
|
-
});
|
|
37514
|
+
local.command("up").description("Start the full local stack (Stacks node + dev services)").option("--devnet", "Run against a local Clarinet devnet instead").option("--no-node", "Skip starting the Stacks node").option("--no-dev", "Skip starting dev services").option("--project <dir>", "[--devnet] Clarinet project directory").option("--image-tag <tag>", "[--devnet] Published image tag to run").option("--owner <owner>", "[--devnet] ghcr image owner to pull from").option("--no-up", "[--devnet] Patch config + write compose without starting").action((options2) => startStack(options2));
|
|
37515
|
+
local.command("down").description("Stop the full local stack").option("--devnet", "Stop a local Clarinet devnet instead").option("--no-node", "Skip stopping the Stacks node").option("--no-dev", "Skip stopping dev services").option("--wait", "Wait for in-flight work to drain before stopping").option("--project <dir>", "[--devnet] Clarinet project directory").option("--purge", "[--devnet] Also remove volumes (wipes the local index)").action((options2) => stopStack(options2));
|
|
37516
|
+
local.command("restart").description("Restart the full local stack (stop then start)").option("--devnet", "Restart a local Clarinet devnet instead").option("--no-node", "Skip the Stacks node (restart dev services only)").option("--no-dev", "Skip dev services").option("--wait", "Wait for in-flight work to drain before stopping").option("--project <dir>", "[--devnet] Clarinet project directory").option("--image-tag <tag>", "[--devnet] Published image tag to run").option("--owner <owner>", "[--devnet] ghcr image owner to pull from").action(async (options2) => {
|
|
37517
|
+
if (options2.node === false && !options2.devnet) {
|
|
37518
|
+
const { restartDev: restartDev2 } = await Promise.resolve().then(() => (init_dev_impl(), exports_dev_impl));
|
|
37519
|
+
await restartDev2();
|
|
37520
|
+
return;
|
|
37469
37521
|
}
|
|
37522
|
+
await stopStack(options2);
|
|
37523
|
+
await startStack(options2);
|
|
37470
37524
|
});
|
|
37471
37525
|
local.command("status").description("Show local environment status").action(async () => {
|
|
37472
37526
|
await showLocalStatus();
|
|
@@ -37715,9 +37769,9 @@ init_output();
|
|
|
37715
37769
|
|
|
37716
37770
|
// src/lib/project-file.ts
|
|
37717
37771
|
import { existsSync as existsSync5 } from "node:fs";
|
|
37718
|
-
import { mkdir as
|
|
37772
|
+
import { mkdir as mkdir4, readFile as readFile3, writeFile as writeFile4 } from "node:fs/promises";
|
|
37719
37773
|
import { homedir as homedir5 } from "node:os";
|
|
37720
|
-
import { dirname as
|
|
37774
|
+
import { dirname as dirname12, join as join11, parse as parsePath2, resolve as resolve8 } from "node:path";
|
|
37721
37775
|
import { z as z3 } from "zod/v4";
|
|
37722
37776
|
var ProjectFileSchema = z3.object({
|
|
37723
37777
|
slug: z3.string().min(1)
|
|
@@ -37729,7 +37783,7 @@ async function readActiveProject(cwd, globalDefault) {
|
|
|
37729
37783
|
const home = resolve8(homedir5());
|
|
37730
37784
|
const fsRoot = parsePath2(dir).root;
|
|
37731
37785
|
while (true) {
|
|
37732
|
-
const candidate =
|
|
37786
|
+
const candidate = join11(dir, DIRNAME, FILENAME);
|
|
37733
37787
|
if (existsSync5(candidate)) {
|
|
37734
37788
|
try {
|
|
37735
37789
|
const raw = await readFile3(candidate, "utf8");
|
|
@@ -37737,11 +37791,11 @@ async function readActiveProject(cwd, globalDefault) {
|
|
|
37737
37791
|
return { slug: parsed.slug, resolvedFrom: candidate };
|
|
37738
37792
|
} catch {}
|
|
37739
37793
|
}
|
|
37740
|
-
if (existsSync5(
|
|
37794
|
+
if (existsSync5(join11(dir, ".git")))
|
|
37741
37795
|
break;
|
|
37742
37796
|
if (dir === home || dir === fsRoot)
|
|
37743
37797
|
break;
|
|
37744
|
-
const parent =
|
|
37798
|
+
const parent = dirname12(dir);
|
|
37745
37799
|
if (parent === dir)
|
|
37746
37800
|
break;
|
|
37747
37801
|
dir = parent;
|
|
@@ -37749,16 +37803,16 @@ async function readActiveProject(cwd, globalDefault) {
|
|
|
37749
37803
|
if (globalDefault) {
|
|
37750
37804
|
return {
|
|
37751
37805
|
slug: globalDefault,
|
|
37752
|
-
resolvedFrom:
|
|
37806
|
+
resolvedFrom: join11(homedir5(), ".secondlayer", "config.json")
|
|
37753
37807
|
};
|
|
37754
37808
|
}
|
|
37755
37809
|
return null;
|
|
37756
37810
|
}
|
|
37757
37811
|
async function writeActiveProject(slug, cwd) {
|
|
37758
|
-
const dir =
|
|
37759
|
-
await
|
|
37760
|
-
const file =
|
|
37761
|
-
await
|
|
37812
|
+
const dir = join11(resolve8(cwd), DIRNAME);
|
|
37813
|
+
await mkdir4(dir, { recursive: true });
|
|
37814
|
+
const file = join11(dir, FILENAME);
|
|
37815
|
+
await writeFile4(file, `${JSON.stringify({ slug }, null, 2)}
|
|
37762
37816
|
`, "utf8");
|
|
37763
37817
|
return file;
|
|
37764
37818
|
}
|
|
@@ -38013,5 +38067,5 @@ program.commandsGroup("Account:");
|
|
|
38013
38067
|
registerAccountCommand(program);
|
|
38014
38068
|
program.parse();
|
|
38015
38069
|
|
|
38016
|
-
//# debugId=
|
|
38070
|
+
//# debugId=D600955BDB8E00F064756E2164756E21
|
|
38017
38071
|
//# sourceMappingURL=cli.js.map
|