@secondlayer/cli 3.1.2-alpha.0 → 3.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 CHANGED
@@ -4705,12 +4705,12 @@ __export(exports_dev_state, {
4705
4705
  clearDevState: () => clearDevState
4706
4706
  });
4707
4707
  import { homedir as homedir5 } from "node:os";
4708
- import { join as join5 } from "node:path";
4708
+ import { join as join6 } from "node:path";
4709
4709
  function getLogsDir() {
4710
4710
  return LOGS_DIR;
4711
4711
  }
4712
4712
  function getLogFile(service) {
4713
- return join5(LOGS_DIR, `${service}.log`);
4713
+ return join6(LOGS_DIR, `${service}.log`);
4714
4714
  }
4715
4715
  async function ensureDirs() {
4716
4716
  await Bun.$`mkdir -p ${STATE_DIR}`.quiet();
@@ -4767,9 +4767,9 @@ async function isDevRunning() {
4767
4767
  }
4768
4768
  var STATE_DIR, DEV_STATE_PATH, LOGS_DIR;
4769
4769
  var init_dev_state = __esm(() => {
4770
- STATE_DIR = join5(homedir5(), ".secondlayer");
4771
- DEV_STATE_PATH = join5(STATE_DIR, "dev.json");
4772
- LOGS_DIR = join5(STATE_DIR, "logs");
4770
+ STATE_DIR = join6(homedir5(), ".secondlayer");
4771
+ DEV_STATE_PATH = join6(STATE_DIR, "dev.json");
4772
+ LOGS_DIR = join6(STATE_DIR, "logs");
4773
4773
  });
4774
4774
 
4775
4775
  // src/utils/format.ts
@@ -5488,9 +5488,9 @@ var init_dist = __esm(() => {
5488
5488
  class PCancelable {
5489
5489
  static fn(userFunction) {
5490
5490
  return (...arguments_) => {
5491
- return new PCancelable((resolve2, reject, onCancel) => {
5491
+ return new PCancelable((resolve3, reject, onCancel) => {
5492
5492
  arguments_.push(onCancel);
5493
- userFunction(...arguments_).then(resolve2, reject);
5493
+ userFunction(...arguments_).then(resolve3, reject);
5494
5494
  });
5495
5495
  };
5496
5496
  }
@@ -5499,12 +5499,12 @@ class PCancelable {
5499
5499
  this._isPending = true;
5500
5500
  this._isCanceled = false;
5501
5501
  this._rejectOnCancel = true;
5502
- this._promise = new Promise((resolve2, reject) => {
5502
+ this._promise = new Promise((resolve3, reject) => {
5503
5503
  this._reject = reject;
5504
5504
  const onResolve = (value) => {
5505
5505
  if (!this._isCanceled || !onCancel.shouldReject) {
5506
5506
  this._isPending = false;
5507
- resolve2(value);
5507
+ resolve3(value);
5508
5508
  }
5509
5509
  };
5510
5510
  const onReject = (error2) => {
@@ -6148,7 +6148,7 @@ var require_get_stream = __commonJS((exports, module) => {
6148
6148
  };
6149
6149
  const { maxBuffer } = options;
6150
6150
  const stream2 = bufferStream(options);
6151
- await new Promise((resolve2, reject) => {
6151
+ await new Promise((resolve3, reject) => {
6152
6152
  const rejectPromise = (error2) => {
6153
6153
  if (error2 && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
6154
6154
  error2.bufferedData = stream2.getBufferedValue();
@@ -6158,7 +6158,7 @@ var require_get_stream = __commonJS((exports, module) => {
6158
6158
  (async () => {
6159
6159
  try {
6160
6160
  await streamPipelinePromisified(inputStream, stream2);
6161
- resolve2();
6161
+ resolve3();
6162
6162
  } catch (error2) {
6163
6163
  rejectPromise(error2);
6164
6164
  }
@@ -7060,11 +7060,11 @@ class CacheableRequest {
7060
7060
  madeRequest = true;
7061
7061
  let requestErrored = false;
7062
7062
  let requestErrorCallback = () => {};
7063
- const requestErrorPromise = new Promise((resolve2) => {
7063
+ const requestErrorPromise = new Promise((resolve3) => {
7064
7064
  requestErrorCallback = () => {
7065
7065
  if (!requestErrored) {
7066
7066
  requestErrored = true;
7067
- resolve2();
7067
+ resolve3();
7068
7068
  }
7069
7069
  };
7070
7070
  });
@@ -7074,8 +7074,8 @@ class CacheableRequest {
7074
7074
  const revalidatedPolicy = import_http_cache_semantics.default.fromObject(revalidate.cachePolicy).revalidatedPolicy(options_, response);
7075
7075
  if (!revalidatedPolicy.modified) {
7076
7076
  response.resume();
7077
- await new Promise((resolve2) => {
7078
- response.once("end", resolve2);
7077
+ await new Promise((resolve3) => {
7078
+ response.once("end", resolve3);
7079
7079
  });
7080
7080
  const headers = convertHeaders(revalidatedPolicy.policy.responseHeaders());
7081
7081
  response = new Response({ statusCode: revalidate.statusCode, headers, body: revalidate.body, url: revalidate.url });
@@ -7095,8 +7095,8 @@ class CacheableRequest {
7095
7095
  const bodyPromise = import_get_stream.default.buffer(response);
7096
7096
  await Promise.race([
7097
7097
  requestErrorPromise,
7098
- new Promise((resolve2) => response.once("end", resolve2)),
7099
- new Promise((resolve2) => response.once("close", resolve2))
7098
+ new Promise((resolve3) => response.once("end", resolve3)),
7099
+ new Promise((resolve3) => response.once("close", resolve3))
7100
7100
  ]);
7101
7101
  const body = await bodyPromise;
7102
7102
  let value = {
@@ -7427,7 +7427,7 @@ var require_get_stream2 = __commonJS((exports, module) => {
7427
7427
  };
7428
7428
  const { maxBuffer } = options;
7429
7429
  const stream3 = bufferStream(options);
7430
- await new Promise((resolve2, reject) => {
7430
+ await new Promise((resolve3, reject) => {
7431
7431
  const rejectPromise = (error2) => {
7432
7432
  if (error2 && stream3.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
7433
7433
  error2.bufferedData = stream3.getBufferedValue();
@@ -7437,7 +7437,7 @@ var require_get_stream2 = __commonJS((exports, module) => {
7437
7437
  (async () => {
7438
7438
  try {
7439
7439
  await streamPipelinePromisified(inputStream, stream3);
7440
- resolve2();
7440
+ resolve3();
7441
7441
  } catch (error2) {
7442
7442
  rejectPromise(error2);
7443
7443
  }
@@ -8623,12 +8623,12 @@ var require_agent = __commonJS((exports, module) => {
8623
8623
  }
8624
8624
  }
8625
8625
  getSession(origin, options, listeners) {
8626
- return new Promise((resolve2, reject) => {
8626
+ return new Promise((resolve3, reject) => {
8627
8627
  if (Array.isArray(listeners) && listeners.length > 0) {
8628
8628
  listeners = [...listeners];
8629
- resolve2();
8629
+ resolve3();
8630
8630
  } else {
8631
- listeners = [{ resolve: resolve2, reject }];
8631
+ listeners = [{ resolve: resolve3, reject }];
8632
8632
  }
8633
8633
  try {
8634
8634
  if (typeof origin === "string") {
@@ -8907,14 +8907,14 @@ var require_agent = __commonJS((exports, module) => {
8907
8907
  });
8908
8908
  }
8909
8909
  request(origin, options, headers, streamOptions) {
8910
- return new Promise((resolve2, reject) => {
8910
+ return new Promise((resolve3, reject) => {
8911
8911
  this.getSession(origin, options, [{
8912
8912
  reject,
8913
8913
  resolve: (session) => {
8914
8914
  try {
8915
8915
  const stream2 = session.request(headers, streamOptions);
8916
8916
  delayAsyncDestroy(stream2);
8917
- resolve2(stream2);
8917
+ resolve3(stream2);
8918
8918
  } catch (error2) {
8919
8919
  reject(error2);
8920
8920
  }
@@ -9254,23 +9254,23 @@ var require_client_request = __commonJS((exports, module) => {
9254
9254
  var kPendingAgentPromise = Symbol("pendingAgentPromise");
9255
9255
 
9256
9256
  class ClientRequest extends Writable {
9257
- constructor(input, options, callback) {
9257
+ constructor(input2, options, callback) {
9258
9258
  super({
9259
9259
  autoDestroy: false,
9260
9260
  emitClose: false
9261
9261
  });
9262
- if (typeof input === "string") {
9263
- input = urlToHttpOptions(new URL2(input));
9264
- } else if (input instanceof URL2) {
9265
- input = urlToHttpOptions(input);
9262
+ if (typeof input2 === "string") {
9263
+ input2 = urlToHttpOptions(new URL2(input2));
9264
+ } else if (input2 instanceof URL2) {
9265
+ input2 = urlToHttpOptions(input2);
9266
9266
  } else {
9267
- input = { ...input };
9267
+ input2 = { ...input2 };
9268
9268
  }
9269
9269
  if (typeof options === "function" || options === undefined) {
9270
9270
  callback = options;
9271
- options = input;
9271
+ options = input2;
9272
9272
  } else {
9273
- options = Object.assign(input, options);
9273
+ options = Object.assign(input2, options);
9274
9274
  }
9275
9275
  if (options.h2session) {
9276
9276
  this[kSession] = options.h2session;
@@ -9635,7 +9635,7 @@ var require_client_request = __commonJS((exports, module) => {
9635
9635
  // ../../node_modules/resolve-alpn/index.js
9636
9636
  var require_resolve_alpn = __commonJS((exports, module) => {
9637
9637
  var tls2 = __require("tls");
9638
- module.exports = (options = {}, connect = tls2.connect) => new Promise((resolve2, reject) => {
9638
+ module.exports = (options = {}, connect = tls2.connect) => new Promise((resolve3, reject) => {
9639
9639
  let timeout = false;
9640
9640
  let socket;
9641
9641
  const callback = async () => {
@@ -9643,14 +9643,14 @@ var require_resolve_alpn = __commonJS((exports, module) => {
9643
9643
  socket.off("timeout", onTimeout);
9644
9644
  socket.off("error", reject);
9645
9645
  if (options.resolveSocket) {
9646
- resolve2({ alpnProtocol: socket.alpnProtocol, socket, timeout });
9646
+ resolve3({ alpnProtocol: socket.alpnProtocol, socket, timeout });
9647
9647
  if (timeout) {
9648
9648
  await Promise.resolve();
9649
9649
  socket.emit("timeout");
9650
9650
  }
9651
9651
  } else {
9652
9652
  socket.destroy();
9653
- resolve2({ alpnProtocol: socket.alpnProtocol, timeout });
9653
+ resolve3({ alpnProtocol: socket.alpnProtocol, timeout });
9654
9654
  }
9655
9655
  };
9656
9656
  const onTimeout = async () => {
@@ -9765,19 +9765,19 @@ var require_auto = __commonJS((exports, module) => {
9765
9765
  };
9766
9766
  };
9767
9767
  var defaultResolveProtocol = createResolveProtocol(cache, queue);
9768
- module.exports = async (input, options, callback) => {
9769
- if (typeof input === "string") {
9770
- input = urlToHttpOptions(new URL2(input));
9771
- } else if (input instanceof URL2) {
9772
- input = urlToHttpOptions(input);
9768
+ module.exports = async (input2, options, callback) => {
9769
+ if (typeof input2 === "string") {
9770
+ input2 = urlToHttpOptions(new URL2(input2));
9771
+ } else if (input2 instanceof URL2) {
9772
+ input2 = urlToHttpOptions(input2);
9773
9773
  } else {
9774
- input = { ...input };
9774
+ input2 = { ...input2 };
9775
9775
  }
9776
9776
  if (typeof options === "function" || options === undefined) {
9777
9777
  callback = options;
9778
- options = input;
9778
+ options = input2;
9779
9779
  } else {
9780
- options = Object.assign(input, options);
9780
+ options = Object.assign(input2, options);
9781
9781
  }
9782
9782
  options.ALPNProtocols = options.ALPNProtocols || ["h2", "http/1.1"];
9783
9783
  if (!Array.isArray(options.ALPNProtocols) || options.ALPNProtocols.length === 0) {
@@ -10053,11 +10053,11 @@ var require_h2_over_h2 = __commonJS((exports, module) => {
10053
10053
  var { globalAgent } = require_agent();
10054
10054
  var Http2OverHttpX = require_h2_over_hx();
10055
10055
  var getAuthorizationHeaders = require_get_auth_headers();
10056
- var getStatusCode = (stream2) => new Promise((resolve2, reject) => {
10056
+ var getStatusCode = (stream2) => new Promise((resolve3, reject) => {
10057
10057
  stream2.once("error", reject);
10058
10058
  stream2.once("response", (headers) => {
10059
10059
  stream2.off("error", reject);
10060
- resolve2(headers[":status"]);
10060
+ resolve3(headers[":status"]);
10061
10061
  });
10062
10062
  });
10063
10063
 
@@ -10084,11 +10084,11 @@ var require_h2_over_h1 = __commonJS((exports, module) => {
10084
10084
  var https = __require("https");
10085
10085
  var Http2OverHttpX = require_h2_over_hx();
10086
10086
  var getAuthorizationHeaders = require_get_auth_headers();
10087
- var getStream2 = (request2) => new Promise((resolve2, reject) => {
10087
+ var getStream2 = (request2) => new Promise((resolve3, reject) => {
10088
10088
  const onConnect = (response, socket, head) => {
10089
10089
  socket.unshift(head);
10090
10090
  request2.off("error", reject);
10091
- resolve2([socket, response.statusCode, response.statusMessage]);
10091
+ resolve3([socket, response.statusCode, response.statusMessage]);
10092
10092
  };
10093
10093
  request2.once("error", reject);
10094
10094
  request2.once("connect", onConnect);
@@ -10490,7 +10490,7 @@ var init_options = __esm(() => {
10490
10490
  enableUnixSockets: false
10491
10491
  };
10492
10492
  Options = class Options {
10493
- constructor(input, options, defaults) {
10493
+ constructor(input2, options, defaults) {
10494
10494
  Object.defineProperty(this, "_unixOptions", {
10495
10495
  enumerable: true,
10496
10496
  configurable: true,
@@ -10515,10 +10515,10 @@ var init_options = __esm(() => {
10515
10515
  writable: true,
10516
10516
  value: undefined
10517
10517
  });
10518
- assert.any([dist_default.string, dist_default.urlInstance, dist_default.object, dist_default.undefined], input);
10518
+ assert.any([dist_default.string, dist_default.urlInstance, dist_default.object, dist_default.undefined], input2);
10519
10519
  assert.any([dist_default.object, dist_default.undefined], options);
10520
10520
  assert.any([dist_default.object, dist_default.undefined], defaults);
10521
- if (input instanceof Options || options instanceof Options) {
10521
+ if (input2 instanceof Options || options instanceof Options) {
10522
10522
  throw new TypeError("The defaults must be passed as the third argument");
10523
10523
  }
10524
10524
  this._internals = cloneInternals(defaults?._internals ?? defaults ?? defaultInternals);
@@ -10526,25 +10526,25 @@ var init_options = __esm(() => {
10526
10526
  this._merging = false;
10527
10527
  this._unixOptions = undefined;
10528
10528
  try {
10529
- if (dist_default.plainObject(input)) {
10529
+ if (dist_default.plainObject(input2)) {
10530
10530
  try {
10531
- this.merge(input);
10531
+ this.merge(input2);
10532
10532
  this.merge(options);
10533
10533
  } finally {
10534
- this.url = input.url;
10534
+ this.url = input2.url;
10535
10535
  }
10536
10536
  } else {
10537
10537
  try {
10538
10538
  this.merge(options);
10539
10539
  } finally {
10540
10540
  if (options?.url !== undefined) {
10541
- if (input === undefined) {
10541
+ if (input2 === undefined) {
10542
10542
  this.url = options.url;
10543
10543
  } else {
10544
10544
  throw new TypeError("The `url` option is mutually exclusive with the `input` argument");
10545
10545
  }
10546
- } else if (input !== undefined) {
10547
- this.url = input;
10546
+ } else if (input2 !== undefined) {
10547
+ this.url = input2;
10548
10548
  }
10549
10549
  }
10550
10550
  }
@@ -11713,11 +11713,11 @@ var init_core = __esm(() => {
11713
11713
  return;
11714
11714
  }
11715
11715
  if (backoff2) {
11716
- await new Promise((resolve2) => {
11717
- const timeout = setTimeout(resolve2, backoff2);
11716
+ await new Promise((resolve3) => {
11717
+ const timeout = setTimeout(resolve3, backoff2);
11718
11718
  this._stopRetry = () => {
11719
11719
  clearTimeout(timeout);
11720
- resolve2();
11720
+ resolve3();
11721
11721
  };
11722
11722
  });
11723
11723
  if (this.destroyed) {
@@ -12093,13 +12093,13 @@ var init_core = __esm(() => {
12093
12093
  this.emit("request", request2);
12094
12094
  }
12095
12095
  async _asyncWrite(chunk) {
12096
- return new Promise((resolve2, reject) => {
12096
+ return new Promise((resolve3, reject) => {
12097
12097
  super.write(chunk, (error2) => {
12098
12098
  if (error2) {
12099
12099
  reject(error2);
12100
12100
  return;
12101
12101
  }
12102
- resolve2();
12102
+ resolve3();
12103
12103
  });
12104
12104
  });
12105
12105
  }
@@ -12159,7 +12159,7 @@ var init_core = __esm(() => {
12159
12159
  }
12160
12160
  }
12161
12161
  async _createCacheableRequest(url, options) {
12162
- return new Promise((resolve2, reject) => {
12162
+ return new Promise((resolve3, reject) => {
12163
12163
  Object.assign(options, urlToOptions(url));
12164
12164
  let request2;
12165
12165
  const cacheRequest = cacheableStore.get(options.cache)(options, async (response) => {
@@ -12174,12 +12174,12 @@ var init_core = __esm(() => {
12174
12174
  fix();
12175
12175
  (await request2).emit("cacheableResponse", response);
12176
12176
  }
12177
- resolve2(response);
12177
+ resolve3(response);
12178
12178
  });
12179
12179
  cacheRequest.once("error", reject);
12180
12180
  cacheRequest.once("request", async (requestOrPromise) => {
12181
12181
  request2 = requestOrPromise;
12182
- resolve2(request2);
12182
+ resolve3(request2);
12183
12183
  });
12184
12184
  });
12185
12185
  }
@@ -12357,7 +12357,7 @@ function asPromise(firstRequest) {
12357
12357
  let globalResponse;
12358
12358
  let normalizedOptions;
12359
12359
  const emitter = new EventEmitter2;
12360
- const promise = new PCancelable((resolve2, reject, onCancel) => {
12360
+ const promise = new PCancelable((resolve3, reject, onCancel) => {
12361
12361
  onCancel(() => {
12362
12362
  globalRequest.destroy();
12363
12363
  });
@@ -12414,7 +12414,7 @@ function asPromise(firstRequest) {
12414
12414
  return;
12415
12415
  }
12416
12416
  request2.destroy();
12417
- resolve2(request2.options.resolveBodyOnly ? response.body : response);
12417
+ resolve3(request2.options.resolveBodyOnly ? response.body : response);
12418
12418
  });
12419
12419
  const onError = (error2) => {
12420
12420
  if (promise.isCanceled) {
@@ -12424,7 +12424,7 @@ function asPromise(firstRequest) {
12424
12424
  if (error2 instanceof HTTPError && !options.throwHttpErrors) {
12425
12425
  const { response } = error2;
12426
12426
  request2.destroy();
12427
- resolve2(request2.options.resolveBodyOnly ? response.body : response);
12427
+ resolve3(request2.options.resolveBodyOnly ? response.body : response);
12428
12428
  return;
12429
12429
  }
12430
12430
  reject(error2);
@@ -12497,8 +12497,8 @@ var init_as_promise = __esm(() => {
12497
12497
  });
12498
12498
 
12499
12499
  // ../../node_modules/got/dist/source/create.js
12500
- var delay = async (ms) => new Promise((resolve2) => {
12501
- setTimeout(resolve2, ms);
12500
+ var delay = async (ms) => new Promise((resolve3) => {
12501
+ setTimeout(resolve3, ms);
12502
12502
  }), isGotInstance = (value) => dist_default.function_(value), aliases, create = (defaults) => {
12503
12503
  defaults = {
12504
12504
  options: new Options(undefined, undefined, defaults.options),
@@ -13178,11 +13178,11 @@ var init_manager = __esm(() => {
13178
13178
  });
13179
13179
 
13180
13180
  // src/services/indexer.ts
13181
- import { dirname as dirname3, resolve as resolve3 } from "node:path";
13181
+ import { dirname as dirname4, resolve as resolve4 } from "node:path";
13182
13182
  async function startIndexer(options2) {
13183
13183
  const port = options2.port ?? 3700;
13184
- const rootDir = dirname3(dirname3(dirname3(dirname3(import.meta.dir))));
13185
- const indexerPath = resolve3(rootDir, "packages/indexer/src/index.ts");
13184
+ const rootDir = dirname4(dirname4(dirname4(dirname4(import.meta.dir))));
13185
+ const indexerPath = resolve4(rootDir, "packages/indexer/src/index.ts");
13186
13186
  await serviceManager.start(SERVICE_NAME, ["bun", "run", "--watch", indexerPath], {
13187
13187
  port,
13188
13188
  env: {
@@ -13198,10 +13198,10 @@ var init_indexer = __esm(() => {
13198
13198
  });
13199
13199
 
13200
13200
  // src/services/worker.ts
13201
- import { dirname as dirname4, resolve as resolve4 } from "node:path";
13201
+ import { dirname as dirname5, resolve as resolve5 } from "node:path";
13202
13202
  async function startWorker(options2) {
13203
- const rootDir = dirname4(dirname4(dirname4(dirname4(import.meta.dir))));
13204
- const workerPath = resolve4(rootDir, "packages/worker/src/index.ts");
13203
+ const rootDir = dirname5(dirname5(dirname5(dirname5(import.meta.dir))));
13204
+ const workerPath = resolve5(rootDir, "packages/worker/src/index.ts");
13205
13205
  await serviceManager.start(SERVICE_NAME2, ["bun", "run", "--watch", workerPath], {
13206
13206
  onStdout: options2.onLog,
13207
13207
  onStderr: options2.onLog
@@ -13213,11 +13213,11 @@ var init_worker = __esm(() => {
13213
13213
  });
13214
13214
 
13215
13215
  // src/services/api.ts
13216
- import { dirname as dirname5, resolve as resolve5 } from "node:path";
13216
+ import { dirname as dirname6, resolve as resolve6 } from "node:path";
13217
13217
  async function startApi(options2) {
13218
13218
  const port = options2.port ?? 3800;
13219
- const rootDir = dirname5(dirname5(dirname5(dirname5(import.meta.dir))));
13220
- const apiPath = resolve5(rootDir, "packages/api/src/index.ts");
13219
+ const rootDir = dirname6(dirname6(dirname6(dirname6(import.meta.dir))));
13220
+ const apiPath = resolve6(rootDir, "packages/api/src/index.ts");
13221
13221
  await serviceManager.start(SERVICE_NAME3, ["bun", "run", "--watch", apiPath], {
13222
13222
  port,
13223
13223
  env: {
@@ -13233,10 +13233,10 @@ var init_api2 = __esm(() => {
13233
13233
  });
13234
13234
 
13235
13235
  // src/services/subgraph-processor.ts
13236
- import { dirname as dirname6, resolve as resolve6 } from "node:path";
13236
+ import { dirname as dirname7, resolve as resolve7 } from "node:path";
13237
13237
  async function startSubgraphProcessor(options2) {
13238
- const rootDir = dirname6(dirname6(dirname6(dirname6(import.meta.dir))));
13239
- const servicePath = resolve6(rootDir, "packages/subgraphs/src/service.ts");
13238
+ const rootDir = dirname7(dirname7(dirname7(dirname7(import.meta.dir))));
13239
+ const servicePath = resolve7(rootDir, "packages/subgraphs/src/service.ts");
13240
13240
  await serviceManager.start(SERVICE_NAME4, ["bun", "run", "--watch", servicePath], {
13241
13241
  env: {
13242
13242
  SUBGRAPH_CONCURRENCY: String(options2.concurrency ?? 5)
@@ -13270,8 +13270,8 @@ __export(exports_dev_impl, {
13270
13270
  restartDev: () => restartDev,
13271
13271
  isDevAlreadyRunning: () => isDevAlreadyRunning
13272
13272
  });
13273
- import { mkdirSync as mkdirSync2 } from "node:fs";
13274
- import { dirname as dirname7, join as join6, resolve as resolve7 } from "node:path";
13273
+ import { mkdirSync as mkdirSync3 } from "node:fs";
13274
+ import { dirname as dirname8, join as join7, resolve as resolve8 } from "node:path";
13275
13275
  async function isDevAlreadyRunning() {
13276
13276
  if (await isDevRunning()) {
13277
13277
  const running = await getRunningServices();
@@ -13349,10 +13349,10 @@ async function runBackground(options2) {
13349
13349
  startedAt: new Date().toISOString()
13350
13350
  };
13351
13351
  try {
13352
- const packagesDir = dirname7(dirname7(dirname7(dirname7(import.meta.dir))));
13352
+ const packagesDir = dirname8(dirname8(dirname8(dirname8(import.meta.dir))));
13353
13353
  const env = { DATABASE_URL: databaseUrl, DEV_MODE: "true" };
13354
13354
  const apiLogFile = getLogFile("api");
13355
- const apiProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/api/src/index.ts")], {
13355
+ const apiProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/api/src/index.ts")], {
13356
13356
  env: { ...process.env, ...env, PORT: String(apiPort) },
13357
13357
  stdout: Bun.file(apiLogFile),
13358
13358
  stderr: Bun.file(apiLogFile)
@@ -13365,7 +13365,7 @@ async function runBackground(options2) {
13365
13365
  };
13366
13366
  console.log(green(" ✓ API"), dim(`http://localhost:${apiPort}`));
13367
13367
  const indexerLogFile = getLogFile("indexer");
13368
- const indexerProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/indexer/src/index.ts")], {
13368
+ const indexerProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/indexer/src/index.ts")], {
13369
13369
  env: { ...process.env, ...env, PORT: String(indexerPort) },
13370
13370
  stdout: Bun.file(indexerLogFile),
13371
13371
  stderr: Bun.file(indexerLogFile)
@@ -13379,7 +13379,7 @@ async function runBackground(options2) {
13379
13379
  console.log(green(" ✓ Indexer"), dim(`http://localhost:${indexerPort}`));
13380
13380
  if (options2.worker) {
13381
13381
  const workerLogFile = getLogFile("worker");
13382
- const workerProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/worker/src/index.ts")], {
13382
+ const workerProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/worker/src/index.ts")], {
13383
13383
  env: { ...process.env, ...env },
13384
13384
  stdout: Bun.file(workerLogFile),
13385
13385
  stderr: Bun.file(workerLogFile)
@@ -13397,7 +13397,7 @@ async function runBackground(options2) {
13397
13397
  const subgraphsProc = Bun.spawn([
13398
13398
  "bun",
13399
13399
  "run",
13400
- resolve7(packagesDir, "packages/subgraphs/src/service.ts")
13400
+ resolve8(packagesDir, "packages/subgraphs/src/service.ts")
13401
13401
  ], {
13402
13402
  env: { ...process.env, ...env },
13403
13403
  stdout: Bun.file(subgraphsLogFile),
@@ -13696,7 +13696,7 @@ async function restartDev() {
13696
13696
  await clearDevState();
13697
13697
  await clearLogs();
13698
13698
  const config = await loadConfig();
13699
- const packagesDir = dirname7(dirname7(dirname7(dirname7(import.meta.dir))));
13699
+ const packagesDir = dirname8(dirname8(dirname8(dirname8(import.meta.dir))));
13700
13700
  const env = state.env;
13701
13701
  const newState = {
13702
13702
  services: {},
@@ -13706,7 +13706,7 @@ async function restartDev() {
13706
13706
  };
13707
13707
  const apiPort = config.ports.api;
13708
13708
  const apiLogFile = getLogFile("api");
13709
- const apiProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/api/src/index.ts")], {
13709
+ const apiProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/api/src/index.ts")], {
13710
13710
  env: { ...process.env, ...env, PORT: String(apiPort) },
13711
13711
  stdout: Bun.file(apiLogFile),
13712
13712
  stderr: Bun.file(apiLogFile)
@@ -13720,7 +13720,7 @@ async function restartDev() {
13720
13720
  console.log(green(" ✓ API"), dim(`http://localhost:${apiPort}`));
13721
13721
  const indexerPort = config.ports.indexer;
13722
13722
  const indexerLogFile = getLogFile("indexer");
13723
- const indexerProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/indexer/src/index.ts")], {
13723
+ const indexerProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/indexer/src/index.ts")], {
13724
13724
  env: { ...process.env, ...env, PORT: String(indexerPort) },
13725
13725
  stdout: Bun.file(indexerLogFile),
13726
13726
  stderr: Bun.file(indexerLogFile)
@@ -13734,7 +13734,7 @@ async function restartDev() {
13734
13734
  console.log(green(" ✓ Indexer"), dim(`http://localhost:${indexerPort}`));
13735
13735
  if (state.services.worker) {
13736
13736
  const workerLogFile = getLogFile("worker");
13737
- const workerProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/worker/src/index.ts")], {
13737
+ const workerProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/worker/src/index.ts")], {
13738
13738
  env: { ...process.env, ...env },
13739
13739
  stdout: Bun.file(workerLogFile),
13740
13740
  stderr: Bun.file(workerLogFile)
@@ -13749,7 +13749,7 @@ async function restartDev() {
13749
13749
  }
13750
13750
  if (state.services.subgraphs) {
13751
13751
  const subgraphsLogFile = getLogFile("subgraphs");
13752
- const subgraphsProc = Bun.spawn(["bun", "run", resolve7(packagesDir, "packages/subgraphs/src/service.ts")], {
13752
+ const subgraphsProc = Bun.spawn(["bun", "run", resolve8(packagesDir, "packages/subgraphs/src/service.ts")], {
13753
13753
  env: { ...process.env, ...env },
13754
13754
  stdout: Bun.file(subgraphsLogFile),
13755
13755
  stderr: Bun.file(subgraphsLogFile)
@@ -13877,8 +13877,8 @@ async function ensureDevPostgres(dataDir) {
13877
13877
  if (check.stdout.toString().trim()) {
13878
13878
  return false;
13879
13879
  }
13880
- const pgDataDir = join6(dataDir, "postgres");
13881
- mkdirSync2(pgDataDir, { recursive: true });
13880
+ const pgDataDir = join7(dataDir, "postgres");
13881
+ mkdirSync3(pgDataDir, { recursive: true });
13882
13882
  const stopped = await Bun.$`docker ps -aq -f name=secondlayer-dev-postgres`.quiet().nothrow();
13883
13883
  if (stopped.stdout.toString().trim()) {
13884
13884
  await Bun.$`docker rm secondlayer-dev-postgres`.quiet().nothrow();
@@ -13893,8 +13893,8 @@ async function ensureDevPostgres(dataDir) {
13893
13893
  throw new Error("PostgreSQL failed to start");
13894
13894
  }
13895
13895
  async function runMigrations(databaseUrl) {
13896
- const packagesDir = dirname7(dirname7(dirname7(dirname7(import.meta.dir))));
13897
- const migrateScript = resolve7(packagesDir, "packages/shared/src/db/migrate.ts");
13896
+ const packagesDir = dirname8(dirname8(dirname8(dirname8(import.meta.dir))));
13897
+ const migrateScript = resolve8(packagesDir, "packages/shared/src/db/migrate.ts");
13898
13898
  const result = await Bun.$`DATABASE_URL=${databaseUrl} bun run ${migrateScript}`.quiet().nothrow();
13899
13899
  if (result.exitCode !== 0) {
13900
13900
  throw new Error(`Migration failed: ${result.stderr.toString()}`);
@@ -13927,7 +13927,7 @@ __export(exports_node_impl, {
13927
13927
  runSetupWizard: () => runSetupWizard,
13928
13928
  restartNode: () => restartNode
13929
13929
  });
13930
- import { confirm as confirm3, input, select as select2 } from "@inquirer/prompts";
13930
+ import { confirm as confirm3, input as input2, select as select3 } from "@inquirer/prompts";
13931
13931
  async function runSetupWizard() {
13932
13932
  console.log("");
13933
13933
  console.log(blue("Stacks Node Setup Wizard"));
@@ -13945,7 +13945,7 @@ async function runSetupWizard() {
13945
13945
  }
13946
13946
  success("Docker is running");
13947
13947
  console.log("");
13948
- const installPath = await input({
13948
+ const installPath = await input2({
13949
13949
  message: "Where is stacks-blockchain-docker installed?",
13950
13950
  validate: async (value) => {
13951
13951
  if (!value.trim())
@@ -13956,7 +13956,7 @@ async function runSetupWizard() {
13956
13956
  return true;
13957
13957
  }
13958
13958
  });
13959
- const network = await select2({
13959
+ const network = await select3({
13960
13960
  message: "Which network?",
13961
13961
  choices: [
13962
13962
  { name: "mainnet", value: "mainnet" },
@@ -13975,7 +13975,7 @@ async function runSetupWizard() {
13975
13975
  default: true
13976
13976
  });
13977
13977
  if (!customPort) {
13978
- const portInput = await input({
13978
+ const portInput = await input2({
13979
13979
  message: "Enter custom indexer port:",
13980
13980
  default: "3700",
13981
13981
  validate: (value) => {
@@ -15456,8 +15456,8 @@ var require_fill_range = __commonJS((exports, module) => {
15456
15456
  return typeof value === "number" || typeof value === "string" && value !== "";
15457
15457
  };
15458
15458
  var isNumber = (num) => Number.isInteger(+num);
15459
- var zeros = (input5) => {
15460
- let value = `${input5}`;
15459
+ var zeros = (input6) => {
15460
+ let value = `${input6}`;
15461
15461
  let index = -1;
15462
15462
  if (value[0] === "-")
15463
15463
  value = value.slice(1);
@@ -15473,27 +15473,27 @@ var require_fill_range = __commonJS((exports, module) => {
15473
15473
  }
15474
15474
  return options2.stringify === true;
15475
15475
  };
15476
- var pad = (input5, maxLength, toNumber) => {
15476
+ var pad = (input6, maxLength, toNumber) => {
15477
15477
  if (maxLength > 0) {
15478
- let dash = input5[0] === "-" ? "-" : "";
15478
+ let dash = input6[0] === "-" ? "-" : "";
15479
15479
  if (dash)
15480
- input5 = input5.slice(1);
15481
- input5 = dash + input5.padStart(dash ? maxLength - 1 : maxLength, "0");
15480
+ input6 = input6.slice(1);
15481
+ input6 = dash + input6.padStart(dash ? maxLength - 1 : maxLength, "0");
15482
15482
  }
15483
15483
  if (toNumber === false) {
15484
- return String(input5);
15484
+ return String(input6);
15485
15485
  }
15486
- return input5;
15486
+ return input6;
15487
15487
  };
15488
- var toMaxLen = (input5, maxLength) => {
15489
- let negative = input5[0] === "-" ? "-" : "";
15488
+ var toMaxLen = (input6, maxLength) => {
15489
+ let negative = input6[0] === "-" ? "-" : "";
15490
15490
  if (negative) {
15491
- input5 = input5.slice(1);
15491
+ input6 = input6.slice(1);
15492
15492
  maxLength--;
15493
15493
  }
15494
- while (input5.length < maxLength)
15495
- input5 = "0" + input5;
15496
- return negative ? "-" + input5 : input5;
15494
+ while (input6.length < maxLength)
15495
+ input6 = "0" + input6;
15496
+ return negative ? "-" + input6 : input6;
15497
15497
  };
15498
15498
  var toSequence = (parts, options2, maxLen) => {
15499
15499
  parts.negatives.sort((a, b2) => a < b2 ? -1 : a > b2 ? 1 : 0);
@@ -15862,25 +15862,25 @@ var require_parse = __commonJS((exports, module) => {
15862
15862
  CHAR_NO_BREAK_SPACE,
15863
15863
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
15864
15864
  } = require_constants();
15865
- var parse2 = (input5, options2 = {}) => {
15866
- if (typeof input5 !== "string") {
15865
+ var parse2 = (input6, options2 = {}) => {
15866
+ if (typeof input6 !== "string") {
15867
15867
  throw new TypeError("Expected a string");
15868
15868
  }
15869
15869
  const opts = options2 || {};
15870
15870
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
15871
- if (input5.length > max) {
15872
- throw new SyntaxError(`Input length (${input5.length}), exceeds max characters (${max})`);
15871
+ if (input6.length > max) {
15872
+ throw new SyntaxError(`Input length (${input6.length}), exceeds max characters (${max})`);
15873
15873
  }
15874
- const ast = { type: "root", input: input5, nodes: [] };
15874
+ const ast = { type: "root", input: input6, nodes: [] };
15875
15875
  const stack = [ast];
15876
15876
  let block = ast;
15877
15877
  let prev = ast;
15878
15878
  let brackets = 0;
15879
- const length = input5.length;
15879
+ const length = input6.length;
15880
15880
  let index = 0;
15881
15881
  let depth = 0;
15882
15882
  let value;
15883
- const advance = () => input5[index++];
15883
+ const advance = () => input6[index++];
15884
15884
  const push = (node) => {
15885
15885
  if (node.type === "text" && prev.type === "dot") {
15886
15886
  prev.type = "text";
@@ -16075,10 +16075,10 @@ var require_braces = __commonJS((exports, module) => {
16075
16075
  var compile = require_compile();
16076
16076
  var expand = require_expand();
16077
16077
  var parse2 = require_parse();
16078
- var braces = (input5, options2 = {}) => {
16078
+ var braces = (input6, options2 = {}) => {
16079
16079
  let output = [];
16080
- if (Array.isArray(input5)) {
16081
- for (const pattern of input5) {
16080
+ if (Array.isArray(input6)) {
16081
+ for (const pattern of input6) {
16082
16082
  const result = braces.create(pattern, options2);
16083
16083
  if (Array.isArray(result)) {
16084
16084
  output.push(...result);
@@ -16087,31 +16087,31 @@ var require_braces = __commonJS((exports, module) => {
16087
16087
  }
16088
16088
  }
16089
16089
  } else {
16090
- output = [].concat(braces.create(input5, options2));
16090
+ output = [].concat(braces.create(input6, options2));
16091
16091
  }
16092
16092
  if (options2 && options2.expand === true && options2.nodupes === true) {
16093
16093
  output = [...new Set(output)];
16094
16094
  }
16095
16095
  return output;
16096
16096
  };
16097
- braces.parse = (input5, options2 = {}) => parse2(input5, options2);
16098
- braces.stringify = (input5, options2 = {}) => {
16099
- if (typeof input5 === "string") {
16100
- return stringify2(braces.parse(input5, options2), options2);
16097
+ braces.parse = (input6, options2 = {}) => parse2(input6, options2);
16098
+ braces.stringify = (input6, options2 = {}) => {
16099
+ if (typeof input6 === "string") {
16100
+ return stringify2(braces.parse(input6, options2), options2);
16101
16101
  }
16102
- return stringify2(input5, options2);
16102
+ return stringify2(input6, options2);
16103
16103
  };
16104
- braces.compile = (input5, options2 = {}) => {
16105
- if (typeof input5 === "string") {
16106
- input5 = braces.parse(input5, options2);
16104
+ braces.compile = (input6, options2 = {}) => {
16105
+ if (typeof input6 === "string") {
16106
+ input6 = braces.parse(input6, options2);
16107
16107
  }
16108
- return compile(input5, options2);
16108
+ return compile(input6, options2);
16109
16109
  };
16110
- braces.expand = (input5, options2 = {}) => {
16111
- if (typeof input5 === "string") {
16112
- input5 = braces.parse(input5, options2);
16110
+ braces.expand = (input6, options2 = {}) => {
16111
+ if (typeof input6 === "string") {
16112
+ input6 = braces.parse(input6, options2);
16113
16113
  }
16114
- let result = expand(input5, options2);
16114
+ let result = expand(input6, options2);
16115
16115
  if (options2.noempty === true) {
16116
16116
  result = result.filter(Boolean);
16117
16117
  }
@@ -16120,11 +16120,11 @@ var require_braces = __commonJS((exports, module) => {
16120
16120
  }
16121
16121
  return result;
16122
16122
  };
16123
- braces.create = (input5, options2 = {}) => {
16124
- if (input5 === "" || input5.length < 3) {
16125
- return [input5];
16123
+ braces.create = (input6, options2 = {}) => {
16124
+ if (input6 === "" || input6.length < 3) {
16125
+ return [input6];
16126
16126
  }
16127
- return options2.expand !== true ? braces.compile(input5, options2) : braces.expand(input5, options2);
16127
+ return options2.expand !== true ? braces.compile(input6, options2) : braces.expand(input6, options2);
16128
16128
  };
16129
16129
  module.exports = braces;
16130
16130
  });
@@ -16302,26 +16302,26 @@ var require_utils2 = __commonJS((exports) => {
16302
16302
  }
16303
16303
  return win32 === true || path.sep === "\\";
16304
16304
  };
16305
- exports.escapeLast = (input5, char, lastIdx) => {
16306
- const idx = input5.lastIndexOf(char, lastIdx);
16305
+ exports.escapeLast = (input6, char, lastIdx) => {
16306
+ const idx = input6.lastIndexOf(char, lastIdx);
16307
16307
  if (idx === -1)
16308
- return input5;
16309
- if (input5[idx - 1] === "\\")
16310
- return exports.escapeLast(input5, char, idx - 1);
16311
- return `${input5.slice(0, idx)}\\${input5.slice(idx)}`;
16308
+ return input6;
16309
+ if (input6[idx - 1] === "\\")
16310
+ return exports.escapeLast(input6, char, idx - 1);
16311
+ return `${input6.slice(0, idx)}\\${input6.slice(idx)}`;
16312
16312
  };
16313
- exports.removePrefix = (input5, state = {}) => {
16314
- let output = input5;
16313
+ exports.removePrefix = (input6, state = {}) => {
16314
+ let output = input6;
16315
16315
  if (output.startsWith("./")) {
16316
16316
  output = output.slice(2);
16317
16317
  state.prefix = "./";
16318
16318
  }
16319
16319
  return output;
16320
16320
  };
16321
- exports.wrapOutput = (input5, state = {}, options2 = {}) => {
16321
+ exports.wrapOutput = (input6, state = {}, options2 = {}) => {
16322
16322
  const prepend = options2.contains ? "" : "^";
16323
16323
  const append = options2.contains ? "" : "$";
16324
- let output = `${prepend}(?:${input5})${append}`;
16324
+ let output = `${prepend}(?:${input6})${append}`;
16325
16325
  if (state.negated === true) {
16326
16326
  output = `(?:^(?!${output}).*$)`;
16327
16327
  }
@@ -16357,14 +16357,14 @@ var require_scan = __commonJS((exports, module) => {
16357
16357
  token.depth = token.isGlobstar ? Infinity : 1;
16358
16358
  }
16359
16359
  };
16360
- var scan = (input5, options2) => {
16360
+ var scan = (input6, options2) => {
16361
16361
  const opts = options2 || {};
16362
- const length = input5.length - 1;
16362
+ const length = input6.length - 1;
16363
16363
  const scanToEnd = opts.parts === true || opts.scanToEnd === true;
16364
16364
  const slashes = [];
16365
16365
  const tokens = [];
16366
16366
  const parts = [];
16367
- let str = input5;
16367
+ let str = input6;
16368
16368
  let index = -1;
16369
16369
  let start = 0;
16370
16370
  let lastIndex = 0;
@@ -16587,7 +16587,7 @@ var require_scan = __commonJS((exports, module) => {
16587
16587
  }
16588
16588
  const state = {
16589
16589
  prefix,
16590
- input: input5,
16590
+ input: input6,
16591
16591
  start,
16592
16592
  base,
16593
16593
  glob,
@@ -16611,7 +16611,7 @@ var require_scan = __commonJS((exports, module) => {
16611
16611
  for (let idx = 0;idx < slashes.length; idx++) {
16612
16612
  const n = prevIndex ? prevIndex + 1 : start;
16613
16613
  const i = slashes[idx];
16614
- const value = input5.slice(n, i);
16614
+ const value = input6.slice(n, i);
16615
16615
  if (opts.tokens) {
16616
16616
  if (idx === 0 && start !== 0) {
16617
16617
  tokens[idx].isPrefix = true;
@@ -16627,8 +16627,8 @@ var require_scan = __commonJS((exports, module) => {
16627
16627
  }
16628
16628
  prevIndex = i;
16629
16629
  }
16630
- if (prevIndex && prevIndex + 1 < input5.length) {
16631
- const value = input5.slice(prevIndex + 1);
16630
+ if (prevIndex && prevIndex + 1 < input6.length) {
16631
+ const value = input6.slice(prevIndex + 1);
16632
16632
  parts.push(value);
16633
16633
  if (opts.tokens) {
16634
16634
  tokens[tokens.length - 1].value = value;
@@ -16671,14 +16671,14 @@ var require_parse2 = __commonJS((exports, module) => {
16671
16671
  var syntaxError = (type, char) => {
16672
16672
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
16673
16673
  };
16674
- var parse2 = (input5, options2) => {
16675
- if (typeof input5 !== "string") {
16674
+ var parse2 = (input6, options2) => {
16675
+ if (typeof input6 !== "string") {
16676
16676
  throw new TypeError("Expected a string");
16677
16677
  }
16678
- input5 = REPLACEMENTS[input5] || input5;
16678
+ input6 = REPLACEMENTS[input6] || input6;
16679
16679
  const opts = { ...options2 };
16680
16680
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
16681
- let len = input5.length;
16681
+ let len = input6.length;
16682
16682
  if (len > max) {
16683
16683
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
16684
16684
  }
@@ -16715,7 +16715,7 @@ var require_parse2 = __commonJS((exports, module) => {
16715
16715
  opts.noextglob = opts.noext;
16716
16716
  }
16717
16717
  const state = {
16718
- input: input5,
16718
+ input: input6,
16719
16719
  index: -1,
16720
16720
  start: 0,
16721
16721
  dot: opts.dot === true,
@@ -16731,17 +16731,17 @@ var require_parse2 = __commonJS((exports, module) => {
16731
16731
  globstar: false,
16732
16732
  tokens
16733
16733
  };
16734
- input5 = utils.removePrefix(input5, state);
16735
- len = input5.length;
16734
+ input6 = utils.removePrefix(input6, state);
16735
+ len = input6.length;
16736
16736
  const extglobs = [];
16737
16737
  const braces = [];
16738
16738
  const stack = [];
16739
16739
  let prev = bos;
16740
16740
  let value;
16741
16741
  const eos = () => state.index === len - 1;
16742
- const peek = state.peek = (n = 1) => input5[state.index + n];
16743
- const advance = state.advance = () => input5[++state.index] || "";
16744
- const remaining = () => input5.slice(state.index + 1);
16742
+ const peek = state.peek = (n = 1) => input6[state.index + n];
16743
+ const advance = state.advance = () => input6[++state.index] || "";
16744
+ const remaining = () => input6.slice(state.index + 1);
16745
16745
  const consume = (value2 = "", num = 0) => {
16746
16746
  state.consumed += value2;
16747
16747
  state.index += num;
@@ -16831,9 +16831,9 @@ var require_parse2 = __commonJS((exports, module) => {
16831
16831
  push({ type: "paren", extglob: true, value, output });
16832
16832
  decrement("parens");
16833
16833
  };
16834
- if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input5)) {
16834
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input6)) {
16835
16835
  let backslashes = false;
16836
- let output = input5.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
16836
+ let output = input6.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
16837
16837
  if (first === "\\") {
16838
16838
  backslashes = true;
16839
16839
  return m;
@@ -16867,8 +16867,8 @@ var require_parse2 = __commonJS((exports, module) => {
16867
16867
  });
16868
16868
  }
16869
16869
  }
16870
- if (output === input5 && opts.contains === true) {
16871
- state.output = input5;
16870
+ if (output === input6 && opts.contains === true) {
16871
+ state.output = input6;
16872
16872
  return state;
16873
16873
  }
16874
16874
  state.output = utils.wrapOutput(output, state, options2);
@@ -17227,7 +17227,7 @@ var require_parse2 = __commonJS((exports, module) => {
17227
17227
  continue;
17228
17228
  }
17229
17229
  while (rest.slice(0, 3) === "/**") {
17230
- const after = input5[state.index + 4];
17230
+ const after = input6[state.index + 4];
17231
17231
  if (after && after !== "/") {
17232
17232
  break;
17233
17233
  }
@@ -17350,14 +17350,14 @@ var require_parse2 = __commonJS((exports, module) => {
17350
17350
  }
17351
17351
  return state;
17352
17352
  };
17353
- parse2.fastpaths = (input5, options2) => {
17353
+ parse2.fastpaths = (input6, options2) => {
17354
17354
  const opts = { ...options2 };
17355
17355
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
17356
- const len = input5.length;
17356
+ const len = input6.length;
17357
17357
  if (len > max) {
17358
17358
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
17359
17359
  }
17360
- input5 = REPLACEMENTS[input5] || input5;
17360
+ input6 = REPLACEMENTS[input6] || input6;
17361
17361
  const win32 = utils.isWindows(options2);
17362
17362
  const {
17363
17363
  DOT_LITERAL,
@@ -17412,7 +17412,7 @@ var require_parse2 = __commonJS((exports, module) => {
17412
17412
  }
17413
17413
  }
17414
17414
  };
17415
- const output = utils.removePrefix(input5, state);
17415
+ const output = utils.removePrefix(input6, state);
17416
17416
  let source = create2(output);
17417
17417
  if (source && opts.strictSlashes !== true) {
17418
17418
  source += `${SLASH_LITERAL}?`;
@@ -17432,7 +17432,7 @@ var require_picomatch = __commonJS((exports, module) => {
17432
17432
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
17433
17433
  var picomatch = (glob, options2, returnState = false) => {
17434
17434
  if (Array.isArray(glob)) {
17435
- const fns = glob.map((input5) => picomatch(input5, options2, returnState));
17435
+ const fns = glob.map((input6) => picomatch(input6, options2, returnState));
17436
17436
  const arrayMatcher = (str) => {
17437
17437
  for (const isMatch of fns) {
17438
17438
  const state2 = isMatch(str);
@@ -17457,9 +17457,9 @@ var require_picomatch = __commonJS((exports, module) => {
17457
17457
  const ignoreOpts = { ...options2, ignore: null, onMatch: null, onResult: null };
17458
17458
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
17459
17459
  }
17460
- const matcher = (input5, returnObject = false) => {
17461
- const { isMatch, match, output } = picomatch.test(input5, regex, options2, { glob, posix });
17462
- const result = { glob, state, regex, posix, input: input5, output, match, isMatch };
17460
+ const matcher = (input6, returnObject = false) => {
17461
+ const { isMatch, match, output } = picomatch.test(input6, regex, options2, { glob, posix });
17462
+ const result = { glob, state, regex, posix, input: input6, output, match, isMatch };
17463
17463
  if (typeof opts.onResult === "function") {
17464
17464
  opts.onResult(result);
17465
17465
  }
@@ -17467,7 +17467,7 @@ var require_picomatch = __commonJS((exports, module) => {
17467
17467
  result.isMatch = false;
17468
17468
  return returnObject ? result : false;
17469
17469
  }
17470
- if (isIgnored(input5)) {
17470
+ if (isIgnored(input6)) {
17471
17471
  if (typeof opts.onIgnore === "function") {
17472
17472
  opts.onIgnore(result);
17473
17473
  }
@@ -17484,33 +17484,33 @@ var require_picomatch = __commonJS((exports, module) => {
17484
17484
  }
17485
17485
  return matcher;
17486
17486
  };
17487
- picomatch.test = (input5, regex, options2, { glob, posix } = {}) => {
17488
- if (typeof input5 !== "string") {
17487
+ picomatch.test = (input6, regex, options2, { glob, posix } = {}) => {
17488
+ if (typeof input6 !== "string") {
17489
17489
  throw new TypeError("Expected input to be a string");
17490
17490
  }
17491
- if (input5 === "") {
17491
+ if (input6 === "") {
17492
17492
  return { isMatch: false, output: "" };
17493
17493
  }
17494
17494
  const opts = options2 || {};
17495
17495
  const format = opts.format || (posix ? utils.toPosixSlashes : null);
17496
- let match = input5 === glob;
17497
- let output = match && format ? format(input5) : input5;
17496
+ let match = input6 === glob;
17497
+ let output = match && format ? format(input6) : input6;
17498
17498
  if (match === false) {
17499
- output = format ? format(input5) : input5;
17499
+ output = format ? format(input6) : input6;
17500
17500
  match = output === glob;
17501
17501
  }
17502
17502
  if (match === false || opts.capture === true) {
17503
17503
  if (opts.matchBase === true || opts.basename === true) {
17504
- match = picomatch.matchBase(input5, regex, options2, posix);
17504
+ match = picomatch.matchBase(input6, regex, options2, posix);
17505
17505
  } else {
17506
17506
  match = regex.exec(output);
17507
17507
  }
17508
17508
  }
17509
17509
  return { isMatch: Boolean(match), match, output };
17510
17510
  };
17511
- picomatch.matchBase = (input5, glob, options2, posix = utils.isWindows(options2)) => {
17511
+ picomatch.matchBase = (input6, glob, options2, posix = utils.isWindows(options2)) => {
17512
17512
  const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options2);
17513
- return regex.test(path.basename(input5));
17513
+ return regex.test(path.basename(input6));
17514
17514
  };
17515
17515
  picomatch.isMatch = (str, patterns, options2) => picomatch(patterns, options2)(str);
17516
17516
  picomatch.parse = (pattern, options2) => {
@@ -17518,7 +17518,7 @@ var require_picomatch = __commonJS((exports, module) => {
17518
17518
  return pattern.map((p) => picomatch.parse(p, options2));
17519
17519
  return parse2(pattern, { ...options2, fastpaths: false });
17520
17520
  };
17521
- picomatch.scan = (input5, options2) => scan(input5, options2);
17521
+ picomatch.scan = (input6, options2) => scan(input6, options2);
17522
17522
  picomatch.compileRe = (state, options2, returnOutput = false, returnState = false) => {
17523
17523
  if (returnOutput === true) {
17524
17524
  return state.output;
@@ -17536,16 +17536,16 @@ var require_picomatch = __commonJS((exports, module) => {
17536
17536
  }
17537
17537
  return regex;
17538
17538
  };
17539
- picomatch.makeRe = (input5, options2 = {}, returnOutput = false, returnState = false) => {
17540
- if (!input5 || typeof input5 !== "string") {
17539
+ picomatch.makeRe = (input6, options2 = {}, returnOutput = false, returnState = false) => {
17540
+ if (!input6 || typeof input6 !== "string") {
17541
17541
  throw new TypeError("Expected a non-empty string");
17542
17542
  }
17543
17543
  let parsed = { negated: false, fastpaths: true };
17544
- if (options2.fastpaths !== false && (input5[0] === "." || input5[0] === "*")) {
17545
- parsed.output = parse2.fastpaths(input5, options2);
17544
+ if (options2.fastpaths !== false && (input6[0] === "." || input6[0] === "*")) {
17545
+ parsed.output = parse2.fastpaths(input6, options2);
17546
17546
  }
17547
17547
  if (!parsed.output) {
17548
- parsed = parse2(input5, options2);
17548
+ parsed = parse2(input6, options2);
17549
17549
  }
17550
17550
  return picomatch.compileRe(parsed, options2, returnOutput, returnState);
17551
17551
  };
@@ -17691,10 +17691,10 @@ var require_micromatch = __commonJS((exports, module) => {
17691
17691
  }
17692
17692
  return [].concat(patterns).every((p) => picomatch(p, options2)(str));
17693
17693
  };
17694
- micromatch.capture = (glob, input5, options2) => {
17694
+ micromatch.capture = (glob, input6, options2) => {
17695
17695
  let posix = utils.isWindows(options2);
17696
17696
  let regex = picomatch.makeRe(String(glob), { ...options2, capture: true });
17697
- let match = regex.exec(posix ? utils.toPosixSlashes(input5) : input5);
17697
+ let match = regex.exec(posix ? utils.toPosixSlashes(input6) : input6);
17698
17698
  if (match) {
17699
17699
  return match.slice(1).map((v) => v === undefined ? "" : v);
17700
17700
  }
@@ -17872,15 +17872,15 @@ var require_pattern = __commonJS((exports) => {
17872
17872
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
17873
17873
  function partitionAbsoluteAndRelative(patterns) {
17874
17874
  const absolute = [];
17875
- const relative = [];
17875
+ const relative2 = [];
17876
17876
  for (const pattern of patterns) {
17877
17877
  if (isAbsolute(pattern)) {
17878
17878
  absolute.push(pattern);
17879
17879
  } else {
17880
- relative.push(pattern);
17880
+ relative2.push(pattern);
17881
17881
  }
17882
17882
  }
17883
- return [absolute, relative];
17883
+ return [absolute, relative2];
17884
17884
  }
17885
17885
  exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
17886
17886
  function isAbsolute(pattern) {
@@ -18029,12 +18029,12 @@ var require_stream = __commonJS((exports) => {
18029
18029
  var require_string = __commonJS((exports) => {
18030
18030
  Object.defineProperty(exports, "__esModule", { value: true });
18031
18031
  exports.isEmpty = exports.isString = undefined;
18032
- function isString(input5) {
18033
- return typeof input5 === "string";
18032
+ function isString(input6) {
18033
+ return typeof input6 === "string";
18034
18034
  }
18035
18035
  exports.isString = isString;
18036
- function isEmpty(input5) {
18037
- return input5 === "";
18036
+ function isEmpty(input6) {
18037
+ return input6 === "";
18038
18038
  }
18039
18039
  exports.isEmpty = isEmpty;
18040
18040
  });
@@ -18064,8 +18064,8 @@ var require_tasks = __commonJS((exports) => {
18064
18064
  Object.defineProperty(exports, "__esModule", { value: true });
18065
18065
  exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = undefined;
18066
18066
  var utils = require_utils3();
18067
- function generate(input5, settings) {
18068
- const patterns = processPatterns(input5, settings);
18067
+ function generate(input6, settings) {
18068
+ const patterns = processPatterns(input6, settings);
18069
18069
  const ignore = processPatterns(settings.ignore, settings);
18070
18070
  const positivePatterns = getPositivePatterns(patterns);
18071
18071
  const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
@@ -18076,8 +18076,8 @@ var require_tasks = __commonJS((exports) => {
18076
18076
  return staticTasks.concat(dynamicTasks);
18077
18077
  }
18078
18078
  exports.generate = generate;
18079
- function processPatterns(input5, settings) {
18080
- let patterns = input5;
18079
+ function processPatterns(input6, settings) {
18080
+ let patterns = input6;
18081
18081
  if (settings.braceExpansion) {
18082
18082
  patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
18083
18083
  }
@@ -18262,11 +18262,11 @@ var require_out = __commonJS((exports) => {
18262
18262
  async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
18263
18263
  }
18264
18264
  exports.stat = stat2;
18265
- function statSync(path, optionsOrSettings) {
18265
+ function statSync2(path, optionsOrSettings) {
18266
18266
  const settings = getSettings(optionsOrSettings);
18267
18267
  return sync.read(path, settings);
18268
18268
  }
18269
- exports.statSync = statSync;
18269
+ exports.statSync = statSync2;
18270
18270
  function getSettings(settingsOrOptions = {}) {
18271
18271
  if (settingsOrOptions instanceof settings_1.default) {
18272
18272
  return settingsOrOptions;
@@ -18879,42 +18879,42 @@ var require_queue = __commonJS((exports, module) => {
18879
18879
  queue.drained = drained;
18880
18880
  return queue;
18881
18881
  function push(value) {
18882
- var p = new Promise(function(resolve8, reject) {
18882
+ var p = new Promise(function(resolve9, reject) {
18883
18883
  pushCb(value, function(err, result) {
18884
18884
  if (err) {
18885
18885
  reject(err);
18886
18886
  return;
18887
18887
  }
18888
- resolve8(result);
18888
+ resolve9(result);
18889
18889
  });
18890
18890
  });
18891
18891
  p.catch(noop5);
18892
18892
  return p;
18893
18893
  }
18894
18894
  function unshift(value) {
18895
- var p = new Promise(function(resolve8, reject) {
18895
+ var p = new Promise(function(resolve9, reject) {
18896
18896
  unshiftCb(value, function(err, result) {
18897
18897
  if (err) {
18898
18898
  reject(err);
18899
18899
  return;
18900
18900
  }
18901
- resolve8(result);
18901
+ resolve9(result);
18902
18902
  });
18903
18903
  });
18904
18904
  p.catch(noop5);
18905
18905
  return p;
18906
18906
  }
18907
18907
  function drained() {
18908
- var p = new Promise(function(resolve8) {
18908
+ var p = new Promise(function(resolve9) {
18909
18909
  process.nextTick(function() {
18910
18910
  if (queue.idle()) {
18911
- resolve8();
18911
+ resolve9();
18912
18912
  } else {
18913
18913
  var previousDrain = queue.drain;
18914
18914
  queue.drain = function() {
18915
18915
  if (typeof previousDrain === "function")
18916
18916
  previousDrain();
18917
- resolve8();
18917
+ resolve9();
18918
18918
  queue.drain = previousDrain;
18919
18919
  };
18920
18920
  }
@@ -19375,9 +19375,9 @@ var require_stream3 = __commonJS((exports) => {
19375
19375
  });
19376
19376
  }
19377
19377
  _getStat(filepath) {
19378
- return new Promise((resolve8, reject) => {
19378
+ return new Promise((resolve9, reject) => {
19379
19379
  this._stat(filepath, this._fsStatSettings, (error2, stats) => {
19380
- return error2 === null ? resolve8(stats) : reject(error2);
19380
+ return error2 === null ? resolve9(stats) : reject(error2);
19381
19381
  });
19382
19382
  });
19383
19383
  }
@@ -19399,10 +19399,10 @@ var require_async5 = __commonJS((exports) => {
19399
19399
  this._readerStream = new stream_1.default(this._settings);
19400
19400
  }
19401
19401
  dynamic(root, options2) {
19402
- return new Promise((resolve8, reject) => {
19402
+ return new Promise((resolve9, reject) => {
19403
19403
  this._walkAsync(root, options2, (error2, entries2) => {
19404
19404
  if (error2 === null) {
19405
- resolve8(entries2);
19405
+ resolve9(entries2);
19406
19406
  } else {
19407
19407
  reject(error2);
19408
19408
  }
@@ -19412,10 +19412,10 @@ var require_async5 = __commonJS((exports) => {
19412
19412
  async static(patterns, options2) {
19413
19413
  const entries2 = [];
19414
19414
  const stream2 = this._readerStream.static(patterns, options2);
19415
- return new Promise((resolve8, reject) => {
19415
+ return new Promise((resolve9, reject) => {
19416
19416
  stream2.once("error", reject);
19417
19417
  stream2.on("data", (entry) => entries2.push(entry));
19418
- stream2.once("end", () => resolve8(entries2));
19418
+ stream2.once("end", () => resolve9(entries2));
19419
19419
  });
19420
19420
  }
19421
19421
  }
@@ -20033,8 +20033,8 @@ var require_out4 = __commonJS((exports, module) => {
20033
20033
  const provider = new _Provider(settings);
20034
20034
  return tasks.map(provider.read, provider);
20035
20035
  }
20036
- function assertPatternsInput(input5) {
20037
- const source = [].concat(input5);
20036
+ function assertPatternsInput(input6) {
20037
+ const source = [].concat(input6);
20038
20038
  const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
20039
20039
  if (!isValidSource) {
20040
20040
  throw new TypeError("Patterns must be a string (non empty) or an array of strings");
@@ -21880,11 +21880,11 @@ var init_commands = __esm(() => {
21880
21880
  });
21881
21881
 
21882
21882
  // ../../node_modules/@antfu/ni/dist/shared/ni.B5qNAuoI.mjs
21883
- import path3, { join as join7, dirname as dirname8, resolve as resolve8 } from "node:path";
21883
+ import path3, { join as join8, dirname as dirname9, resolve as resolve9 } from "node:path";
21884
21884
  import process$1 from "node:process";
21885
21885
  import require$$0 from "readline";
21886
21886
  import require$$2 from "events";
21887
- import fs5, { promises, existsSync as existsSync3 } from "node:fs";
21887
+ import fs5, { promises, existsSync as existsSync4 } from "node:fs";
21888
21888
  import require$$0$1 from "os";
21889
21889
  import require$$1 from "tty";
21890
21890
  import os4 from "node:os";
@@ -22402,10 +22402,10 @@ function requireStyle() {
22402
22402
  const c2 = requireKleur();
22403
22403
  const figures = requireFigures();
22404
22404
  const styles3 = Object.freeze({
22405
- password: { scale: 1, render: (input5) => "*".repeat(input5.length) },
22406
- emoji: { scale: 2, render: (input5) => "\uD83D\uDE03".repeat(input5.length) },
22407
- invisible: { scale: 0, render: (input5) => "" },
22408
- default: { scale: 1, render: (input5) => `${input5}` }
22405
+ password: { scale: 1, render: (input6) => "*".repeat(input6.length) },
22406
+ emoji: { scale: 2, render: (input6) => "\uD83D\uDE03".repeat(input6.length) },
22407
+ invisible: { scale: 0, render: (input6) => "" },
22408
+ default: { scale: 1, render: (input6) => `${input6}` }
22409
22409
  });
22410
22410
  const render = (type) => styles3[type] || styles3.default;
22411
22411
  const symbols = Object.freeze({
@@ -22745,7 +22745,7 @@ ${i2 ? " " : figures.pointerSmall} ${color.red().italic(l2)}`, ``);
22745
22745
  }
22746
22746
  function requireSelect() {
22747
22747
  if (hasRequiredSelect)
22748
- return select4;
22748
+ return select5;
22749
22749
  hasRequiredSelect = 1;
22750
22750
  const color = requireKleur();
22751
22751
  const Prompt = requirePrompt();
@@ -22891,8 +22891,8 @@ function requireSelect() {
22891
22891
  this.out.write(this.outputText);
22892
22892
  }
22893
22893
  }
22894
- select4 = SelectPrompt;
22895
- return select4;
22894
+ select5 = SelectPrompt;
22895
+ return select5;
22896
22896
  }
22897
22897
  function requireToggle() {
22898
22898
  if (hasRequiredToggle)
@@ -24413,7 +24413,7 @@ function requirePrompts$1() {
24413
24413
  onSubmit: toSelected
24414
24414
  });
24415
24415
  };
24416
- const byTitle = (input5, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input5.length).toLowerCase() === input5.toLowerCase()));
24416
+ const byTitle = (input6, choices) => Promise.resolve(choices.filter((item) => item.title.slice(0, input6.length).toLowerCase() === input6.toLowerCase()));
24417
24417
  $.autocomplete = (args) => {
24418
24418
  args.suggest = args.suggest || byTitle;
24419
24419
  args.choices = [].concat(args.choices || []);
@@ -24895,7 +24895,7 @@ function requireLib() {
24895
24895
  return lib;
24896
24896
  hasRequiredLib = 1;
24897
24897
  const { isexe, sync: isexeSync } = requireCjs();
24898
- const { join: join8, delimiter, sep, posix: posix2 } = require$$1$2;
24898
+ const { join: join9, delimiter, sep, posix: posix2 } = require$$1$2;
24899
24899
  const isWindows = process.platform === "win32";
24900
24900
  const rSlash = new RegExp(`[${posix2.sep}${sep === posix2.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
24901
24901
  const rRel = new RegExp(`^\\.${rSlash.source}`);
@@ -24922,7 +24922,7 @@ function requireLib() {
24922
24922
  const getPathPart = (raw, cmd) => {
24923
24923
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
24924
24924
  const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
24925
- return prefix + join8(pathPart, cmd);
24925
+ return prefix + join9(pathPart, cmd);
24926
24926
  };
24927
24927
  const which = async (cmd, opt = {}) => {
24928
24928
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -25018,7 +25018,7 @@ async function detect2({ autoInstall, programmatic, cwd } = {}) {
25018
25018
  }
25019
25019
  return agent;
25020
25020
  }
25021
- 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, confirm5, hasRequiredConfirm, elements, hasRequiredElements, hasRequiredPrompts$1, lib$1, hasRequiredLib$1, prompts$1, hasRequiredPrompts, promptsExports, prompts, isBrowser, platform, OSC = "\x1B]", BEL = "\x07", SEP = ";", link = (text2, url) => [
25021
+ 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, select5, 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, confirm5, hasRequiredConfirm, elements, hasRequiredElements, hasRequiredPrompts$1, lib$1, hasRequiredLib$1, prompts$1, hasRequiredPrompts, promptsExports, prompts, isBrowser, platform, OSC = "\x1B]", BEL = "\x07", SEP = ";", link = (text2, url) => [
25022
25022
  OSC,
25023
25023
  "8",
25024
25024
  SEP,
@@ -25071,7 +25071,7 @@ var init_ni_B5qNAuoI = __esm(() => {
25071
25071
  options2 = {};
25072
25072
  libExports = requireLib();
25073
25073
  which = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
25074
- CLI_TEMP_DIR = join7(os4.tmpdir(), "antfu-ni");
25074
+ CLI_TEMP_DIR = join8(os4.tmpdir(), "antfu-ni");
25075
25075
  customRcPath = process$1.env.NI_CONFIG_FILE;
25076
25076
  home = process$1.platform === "win32" ? process$1.env.USERPROFILE : process$1.env.HOME;
25077
25077
  defaultRcPath = path3.join(home || "~/", ".nirc");
@@ -25108,14 +25108,14 @@ function isPlainObject2(value) {
25108
25108
  }
25109
25109
 
25110
25110
  // ../../node_modules/execa/lib/arguments/file-url.js
25111
- import { fileURLToPath } from "node:url";
25111
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
25112
25112
  var safeNormalizeFileUrl = (file, name) => {
25113
25113
  const fileString = normalizeFileUrl(normalizeDenoExecPath(file));
25114
25114
  if (typeof fileString !== "string") {
25115
25115
  throw new TypeError(`${name} must be a string or a file URL: ${fileString}.`);
25116
25116
  }
25117
25117
  return fileString;
25118
- }, normalizeDenoExecPath = (file) => isDenoExecPath(file) ? file.toString() : file, isDenoExecPath = (file) => typeof file !== "string" && file && Object.getPrototypeOf(file) === String.prototype, normalizeFileUrl = (file) => file instanceof URL ? fileURLToPath(file) : file;
25118
+ }, normalizeDenoExecPath = (file) => isDenoExecPath(file) ? file.toString() : file, isDenoExecPath = (file) => typeof file !== "string" && file && Object.getPrototypeOf(file) === String.prototype, normalizeFileUrl = (file) => file instanceof URL ? fileURLToPath2(file) : file;
25119
25119
  var init_file_url = () => {};
25120
25120
 
25121
25121
  // ../../node_modules/execa/lib/methods/parameters.js
@@ -25702,12 +25702,12 @@ var init_figures = __esm(() => {
25702
25702
  import tty2 from "node:tty";
25703
25703
  var hasColors, format = (open, close) => {
25704
25704
  if (!hasColors) {
25705
- return (input5) => input5;
25705
+ return (input6) => input6;
25706
25706
  }
25707
25707
  const openCode = `\x1B[${open}m`;
25708
25708
  const closeCode = `\x1B[${close}m`;
25709
- return (input5) => {
25710
- const string = input5 + "";
25709
+ return (input6) => {
25710
+ const string = input6 + "";
25711
25711
  let index = string.indexOf(closeCode);
25712
25712
  if (index === -1) {
25713
25713
  return openCode + string + closeCode;
@@ -26029,12 +26029,12 @@ var require_isexe = __commonJS((exports, module) => {
26029
26029
  if (typeof Promise !== "function") {
26030
26030
  throw new TypeError("callback not provided");
26031
26031
  }
26032
- return new Promise(function(resolve9, reject) {
26032
+ return new Promise(function(resolve10, reject) {
26033
26033
  isexe(path4, options3 || {}, function(er, is2) {
26034
26034
  if (er) {
26035
26035
  reject(er);
26036
26036
  } else {
26037
- resolve9(is2);
26037
+ resolve10(is2);
26038
26038
  }
26039
26039
  });
26040
26040
  });
@@ -26096,27 +26096,27 @@ var require_which = __commonJS((exports, module) => {
26096
26096
  opt = {};
26097
26097
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
26098
26098
  const found = [];
26099
- const step = (i2) => new Promise((resolve9, reject) => {
26099
+ const step = (i2) => new Promise((resolve10, reject) => {
26100
26100
  if (i2 === pathEnv.length)
26101
- return opt.all && found.length ? resolve9(found) : reject(getNotFoundError(cmd));
26101
+ return opt.all && found.length ? resolve10(found) : reject(getNotFoundError(cmd));
26102
26102
  const ppRaw = pathEnv[i2];
26103
26103
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
26104
26104
  const pCmd = path4.join(pathPart, cmd);
26105
26105
  const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
26106
- resolve9(subStep(p2, i2, 0));
26106
+ resolve10(subStep(p2, i2, 0));
26107
26107
  });
26108
- const subStep = (p2, i2, ii) => new Promise((resolve9, reject) => {
26108
+ const subStep = (p2, i2, ii) => new Promise((resolve10, reject) => {
26109
26109
  if (ii === pathExt.length)
26110
- return resolve9(step(i2 + 1));
26110
+ return resolve10(step(i2 + 1));
26111
26111
  const ext = pathExt[ii];
26112
26112
  isexe(p2 + ext, { pathExt: pathExtExe }, (er, is2) => {
26113
26113
  if (!er && is2) {
26114
26114
  if (opt.all)
26115
26115
  found.push(p2 + ext);
26116
26116
  else
26117
- return resolve9(p2 + ext);
26117
+ return resolve10(p2 + ext);
26118
26118
  }
26119
- return resolve9(subStep(p2, i2, ii + 1));
26119
+ return resolve10(subStep(p2, i2, ii + 1));
26120
26120
  });
26121
26121
  });
26122
26122
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -26411,9 +26411,9 @@ function pathKey(options3 = {}) {
26411
26411
  import { promisify as promisify4 } from "node:util";
26412
26412
  import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
26413
26413
  import path4 from "node:path";
26414
- import { fileURLToPath as fileURLToPath2 } from "node:url";
26414
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
26415
26415
  function toPath(urlOrPath) {
26416
- return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
26416
+ return urlOrPath instanceof URL ? fileURLToPath3(urlOrPath) : urlOrPath;
26417
26417
  }
26418
26418
  function traversePathUp(startPath) {
26419
26419
  return {
@@ -27054,8 +27054,8 @@ var init_validation = __esm(() => {
27054
27054
  // ../../node_modules/execa/lib/utils/deferred.js
27055
27055
  var createDeferred = () => {
27056
27056
  const methods = {};
27057
- const promise = new Promise((resolve9, reject) => {
27058
- Object.assign(methods, { resolve: resolve9, reject });
27057
+ const promise = new Promise((resolve10, reject) => {
27058
+ Object.assign(methods, { resolve: resolve10, reject });
27059
27059
  });
27060
27060
  return Object.assign(promise, methods);
27061
27061
  };
@@ -27690,7 +27690,7 @@ var init_encoding_option = __esm(() => {
27690
27690
  });
27691
27691
 
27692
27692
  // ../../node_modules/execa/lib/arguments/cwd.js
27693
- import { statSync } from "node:fs";
27693
+ import { statSync as statSync2 } from "node:fs";
27694
27694
  import path7 from "node:path";
27695
27695
  import process8 from "node:process";
27696
27696
  var normalizeCwd = (cwd = getDefaultCwd()) => {
@@ -27710,7 +27710,7 @@ ${error2.message}`;
27710
27710
  }
27711
27711
  let cwdStat;
27712
27712
  try {
27713
- cwdStat = statSync(cwd);
27713
+ cwdStat = statSync2(cwd);
27714
27714
  } catch (error2) {
27715
27715
  return `The "cwd" option is invalid: ${cwd}.
27716
27716
  ${error2.message}
@@ -27816,16 +27816,16 @@ var init_options2 = __esm(() => {
27816
27816
  var concatenateShell = (file, commandArguments, options3) => options3.shell && commandArguments.length > 0 ? [[file, ...commandArguments].join(" "), [], options3] : [file, commandArguments, options3];
27817
27817
 
27818
27818
  // ../../node_modules/strip-final-newline/index.js
27819
- function stripFinalNewline(input5) {
27820
- if (typeof input5 === "string") {
27821
- return stripFinalNewlineString(input5);
27819
+ function stripFinalNewline(input6) {
27820
+ if (typeof input6 === "string") {
27821
+ return stripFinalNewlineString(input6);
27822
27822
  }
27823
- if (!(ArrayBuffer.isView(input5) && input5.BYTES_PER_ELEMENT === 1)) {
27823
+ if (!(ArrayBuffer.isView(input6) && input6.BYTES_PER_ELEMENT === 1)) {
27824
27824
  throw new Error("Input must be a string or a Uint8Array");
27825
27825
  }
27826
- return stripFinalNewlineBinary(input5);
27826
+ return stripFinalNewlineBinary(input6);
27827
27827
  }
27828
- var stripFinalNewlineString = (input5) => input5.at(-1) === LF ? input5.slice(0, input5.at(-2) === CR ? -2 : -1) : input5, stripFinalNewlineBinary = (input5) => input5.at(-1) === LF_BINARY ? input5.subarray(0, input5.at(-2) === CR_BINARY ? -2 : -1) : input5, LF = `
27828
+ var stripFinalNewlineString = (input6) => input6.at(-1) === LF ? input6.slice(0, input6.at(-2) === CR ? -2 : -1) : input6, stripFinalNewlineBinary = (input6) => input6.at(-1) === LF_BINARY ? input6.subarray(0, input6.at(-2) === CR_BINARY ? -2 : -1) : input6, LF = `
27829
27829
  `, LF_BINARY, CR = "\r", CR_BINARY;
27830
27830
  var init_strip_final_newline = __esm(() => {
27831
27831
  LF_BINARY = LF.codePointAt(0);
@@ -28795,7 +28795,7 @@ var init_stdio_option = __esm(() => {
28795
28795
  });
28796
28796
 
28797
28797
  // ../../node_modules/execa/lib/stdio/native.js
28798
- import { readFileSync } from "node:fs";
28798
+ import { readFileSync as readFileSync2 } from "node:fs";
28799
28799
  import tty3 from "node:tty";
28800
28800
  var handleNativeStream = ({ stdioItem, stdioItem: { type }, isStdioArray, fdNumber, direction, isSync }) => {
28801
28801
  if (!isStdioArray || type !== "native") {
@@ -28827,7 +28827,7 @@ var handleNativeStream = ({ stdioItem, stdioItem: { type }, isStdioArray, fdNumb
28827
28827
  if (tty3.isatty(targetFdNumber)) {
28828
28828
  throw new TypeError(`The \`${optionName}: ${serializeOptionValue(value)}\` option is invalid: it cannot be a TTY with synchronous methods.`);
28829
28829
  }
28830
- return { type: "uint8Array", value: bufferToUint8Array(readFileSync(targetFdNumber)), optionName };
28830
+ return { type: "uint8Array", value: bufferToUint8Array(readFileSync2(targetFdNumber)), optionName };
28831
28831
  }, getTargetFdNumber = (value, fdNumber) => {
28832
28832
  if (value === "inherit") {
28833
28833
  return fdNumber;
@@ -28864,21 +28864,21 @@ var init_native = __esm(() => {
28864
28864
  });
28865
28865
 
28866
28866
  // ../../node_modules/execa/lib/stdio/input-option.js
28867
- var handleInputOptions = ({ input: input5, inputFile }, fdNumber) => fdNumber === 0 ? [
28868
- ...handleInputOption(input5),
28867
+ var handleInputOptions = ({ input: input6, inputFile }, fdNumber) => fdNumber === 0 ? [
28868
+ ...handleInputOption(input6),
28869
28869
  ...handleInputFileOption(inputFile)
28870
- ] : [], handleInputOption = (input5) => input5 === undefined ? [] : [{
28871
- type: getInputType(input5),
28872
- value: input5,
28870
+ ] : [], handleInputOption = (input6) => input6 === undefined ? [] : [{
28871
+ type: getInputType(input6),
28872
+ value: input6,
28873
28873
  optionName: "input"
28874
- }], getInputType = (input5) => {
28875
- if (isReadableStream(input5, { checkOpen: false })) {
28874
+ }], getInputType = (input6) => {
28875
+ if (isReadableStream(input6, { checkOpen: false })) {
28876
28876
  return "nodeStream";
28877
28877
  }
28878
- if (typeof input5 === "string") {
28878
+ if (typeof input6 === "string") {
28879
28879
  return "string";
28880
28880
  }
28881
- if (isUint8Array(input5)) {
28881
+ if (isUint8Array(input6)) {
28882
28882
  return "uint8Array";
28883
28883
  }
28884
28884
  throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
@@ -29130,7 +29130,7 @@ var init_handle = __esm(() => {
29130
29130
  });
29131
29131
 
29132
29132
  // ../../node_modules/execa/lib/stdio/handle-sync.js
29133
- import { readFileSync as readFileSync2 } from "node:fs";
29133
+ import { readFileSync as readFileSync3 } from "node:fs";
29134
29134
  var handleStdioSync = (options3, verboseInfo) => handleStdio(addPropertiesSync, options3, verboseInfo, true), forbiddenIfSync = ({ type, optionName }) => {
29135
29135
  throwInvalidSyncValue(optionName, TYPE_TO_MESSAGE[type]);
29136
29136
  }, forbiddenNativeIfSync = ({ optionName, value }) => {
@@ -29158,8 +29158,8 @@ var init_handle_sync = __esm(() => {
29158
29158
  addPropertiesSync = {
29159
29159
  input: {
29160
29160
  ...addProperties,
29161
- fileUrl: ({ value }) => ({ contents: [bufferToUint8Array(readFileSync2(value))] }),
29162
- filePath: ({ value: { file } }) => ({ contents: [bufferToUint8Array(readFileSync2(file))] }),
29161
+ fileUrl: ({ value }) => ({ contents: [bufferToUint8Array(readFileSync3(value))] }),
29162
+ filePath: ({ value: { file } }) => ({ contents: [bufferToUint8Array(readFileSync3(file))] }),
29163
29163
  fileNumber: forbiddenIfSync,
29164
29164
  iterable: ({ value }) => ({ contents: [...value] }),
29165
29165
  string: ({ value }) => ({ contents: [value] }),
@@ -29528,7 +29528,7 @@ var init_output2 = __esm(() => {
29528
29528
  });
29529
29529
 
29530
29530
  // ../../node_modules/execa/lib/io/output-sync.js
29531
- import { writeFileSync, appendFileSync } from "node:fs";
29531
+ import { writeFileSync as writeFileSync2, appendFileSync } from "node:fs";
29532
29532
  var transformOutputSync = ({ fileDescriptors, syncResult: { output }, options: options3, isMaxBuffer, verboseInfo }) => {
29533
29533
  if (output === null) {
29534
29534
  return { output: Array.from({ length: 3 }) };
@@ -29621,7 +29621,7 @@ var transformOutputSync = ({ fileDescriptors, syncResult: { output }, options: o
29621
29621
  appendFileSync(path9, serializedResult);
29622
29622
  } else {
29623
29623
  outputFiles.add(pathString);
29624
- writeFileSync(path9, serializedResult);
29624
+ writeFileSync2(path9, serializedResult);
29625
29625
  }
29626
29626
  }
29627
29627
  };
@@ -31398,10 +31398,10 @@ var initializeConcurrentStreams = () => ({
31398
31398
  const promises2 = weakMap.get(stream2);
31399
31399
  const promise = createDeferred();
31400
31400
  promises2.push(promise);
31401
- const resolve9 = promise.resolve.bind(promise);
31402
- return { resolve: resolve9, promises: promises2 };
31403
- }, waitForConcurrentStreams = async ({ resolve: resolve9, promises: promises2 }, subprocess) => {
31404
- resolve9();
31401
+ const resolve10 = promise.resolve.bind(promise);
31402
+ return { resolve: resolve10, promises: promises2 };
31403
+ }, waitForConcurrentStreams = async ({ resolve: resolve10, promises: promises2 }, subprocess) => {
31404
+ resolve10();
31405
31405
  const [isSubprocessExit] = await Promise.race([
31406
31406
  Promise.allSettled([true, subprocess]),
31407
31407
  Promise.all([false, ...promises2])
@@ -31994,7 +31994,7 @@ var init_command2 = __esm(() => {
31994
31994
  var setScriptSync = (boundExeca, createNested, boundOptions) => {
31995
31995
  boundExeca.sync = createNested(mapScriptSync, boundOptions);
31996
31996
  boundExeca.s = boundExeca.sync;
31997
- }, mapScriptAsync = ({ options: options3 }) => getScriptOptions(options3), mapScriptSync = ({ options: options3 }) => ({ ...getScriptOptions(options3), isSync: true }), getScriptOptions = (options3) => ({ options: { ...getScriptStdinOption(options3), ...options3 } }), getScriptStdinOption = ({ input: input5, inputFile, stdio }) => input5 === undefined && inputFile === undefined && stdio === undefined ? { stdin: "inherit" } : {}, deepScriptOptions;
31997
+ }, mapScriptAsync = ({ options: options3 }) => getScriptOptions(options3), mapScriptSync = ({ options: options3 }) => ({ ...getScriptOptions(options3), isSync: true }), getScriptOptions = (options3) => ({ options: { ...getScriptStdinOption(options3), ...options3 } }), getScriptStdinOption = ({ input: input6, inputFile, stdio }) => input6 === undefined && inputFile === undefined && stdio === undefined ? { stdin: "inherit" } : {}, deepScriptOptions;
31998
31998
  var init_script = __esm(() => {
31999
31999
  deepScriptOptions = { preferLocal: true };
32000
32000
  });
@@ -32105,20 +32105,20 @@ __export(exports_generate, {
32105
32105
  import path10 from "path";
32106
32106
  import { getErrorMessage as getErrorMessage2 } from "@secondlayer/shared";
32107
32107
  import { toCamelCase as toCamelCase8 } from "@secondlayer/stacks/clarity";
32108
- function isContractAddress(input5) {
32108
+ function isContractAddress(input6) {
32109
32109
  const contractIdPattern = /^(SP|ST|SM|SN)[A-Z0-9]{38,}\.[a-zA-Z][a-zA-Z0-9-]*$/;
32110
- return contractIdPattern.test(input5);
32110
+ return contractIdPattern.test(input6);
32111
32111
  }
32112
32112
  async function parseInputs(inputs) {
32113
32113
  const files = [];
32114
32114
  const contractIds = [];
32115
- for (const input5 of inputs) {
32116
- if (isContractAddress(input5)) {
32117
- contractIds.push(input5);
32115
+ for (const input6 of inputs) {
32116
+ if (isContractAddress(input6)) {
32117
+ contractIds.push(input6);
32118
32118
  continue;
32119
32119
  }
32120
- if (input5.includes("*") || input5.includes("?")) {
32121
- const matches = await import_fast_glob.default(input5, { cwd: process.cwd(), absolute: true });
32120
+ if (input6.includes("*") || input6.includes("?")) {
32121
+ const matches = await import_fast_glob.default(input6, { cwd: process.cwd(), absolute: true });
32122
32122
  for (const file of matches) {
32123
32123
  if (file.endsWith(".clar")) {
32124
32124
  files.push(file);
@@ -32126,8 +32126,8 @@ async function parseInputs(inputs) {
32126
32126
  }
32127
32127
  continue;
32128
32128
  }
32129
- if (input5.endsWith(".clar")) {
32130
- const absolutePath = path10.resolve(process.cwd(), input5);
32129
+ if (input6.endsWith(".clar")) {
32130
+ const absolutePath = path10.resolve(process.cwd(), input6);
32131
32131
  files.push(absolutePath);
32132
32132
  }
32133
32133
  }
@@ -32410,7 +32410,7 @@ var {
32410
32410
  // package.json
32411
32411
  var package_default = {
32412
32412
  name: "@secondlayer/cli",
32413
- version: "3.1.2-alpha.0",
32413
+ version: "3.2.0",
32414
32414
  description: "CLI for subgraphs and blockchain indexing on Stacks",
32415
32415
  type: "module",
32416
32416
  bin: {
@@ -32452,11 +32452,11 @@ var package_default = {
32452
32452
  license: "MIT",
32453
32453
  dependencies: {
32454
32454
  "@inquirer/prompts": "^8.2.0",
32455
- "@secondlayer/bundler": "^0.3.1-alpha.0",
32456
- "@secondlayer/sdk": "^3.0.0-alpha.0",
32457
- "@secondlayer/shared": "^3.0.0-alpha.0",
32458
- "@secondlayer/stacks": "^1.0.0-alpha.0",
32459
- "@secondlayer/subgraphs": "^1.0.0-alpha.0",
32455
+ "@secondlayer/bundler": "^0.3.1",
32456
+ "@secondlayer/sdk": "^3.0.0",
32457
+ "@secondlayer/shared": "^3.0.0",
32458
+ "@secondlayer/stacks": "^1.0.0",
32459
+ "@secondlayer/subgraphs": "^1.0.0",
32460
32460
  "@biomejs/js-api": "^0.7.0",
32461
32461
  "@biomejs/wasm-nodejs": "^1.9.0",
32462
32462
  esbuild: "^0.19.0",
@@ -32962,6 +32962,148 @@ async function validateDatabaseConnection(url) {
32962
32962
  console.log(dim("The URL was saved but connection failed. Check your database settings."));
32963
32963
  }
32964
32964
  }
32965
+ // src/commands/create.ts
32966
+ init_output();
32967
+ import {
32968
+ copyFileSync,
32969
+ existsSync as existsSync2,
32970
+ mkdirSync,
32971
+ readFileSync,
32972
+ readdirSync,
32973
+ statSync,
32974
+ writeFileSync
32975
+ } from "node:fs";
32976
+ import { dirname as dirname3, join as join5, relative, resolve as resolve2 } from "node:path";
32977
+ import { fileURLToPath } from "node:url";
32978
+ import { input, select as select2 } from "@inquirer/prompts";
32979
+ import { SecondLayer as SecondLayer2 } from "@secondlayer/sdk";
32980
+ var RUNTIMES = ["inngest", "trigger", "cloudflare", "node"];
32981
+ var FORMAT_BY_RUNTIME = {
32982
+ inngest: "inngest",
32983
+ trigger: "trigger",
32984
+ cloudflare: "cloudflare",
32985
+ node: "standard-webhooks"
32986
+ };
32987
+ function templatesRoot() {
32988
+ const here = dirname3(fileURLToPath(import.meta.url));
32989
+ const candidateDist = resolve2(here, "..", "templates", "subscriptions");
32990
+ if (existsSync2(candidateDist))
32991
+ return candidateDist;
32992
+ return resolve2(here, "..", "..", "templates", "subscriptions");
32993
+ }
32994
+ function copyTemplate(src, dest, vars) {
32995
+ if (!existsSync2(src)) {
32996
+ throw new Error(`template dir missing: ${src}`);
32997
+ }
32998
+ mkdirSync(dest, { recursive: true });
32999
+ const entries = readdirSync(src);
33000
+ for (const entry of entries) {
33001
+ const from = join5(src, entry);
33002
+ const to = join5(dest, entry);
33003
+ const st = statSync(from);
33004
+ if (st.isDirectory()) {
33005
+ copyTemplate(from, to, vars);
33006
+ } else {
33007
+ const raw = readFileSync(from, "utf8");
33008
+ const rendered = raw.replace(/\{\{([A-Z_]+)\}\}/g, (match, key) => vars[key] ?? match);
33009
+ writeFileSync(to, rendered);
33010
+ }
33011
+ }
33012
+ }
33013
+ async function promptFor(_name, opts) {
33014
+ const runtime = opts.runtime ?? await select2({
33015
+ message: "Runtime?",
33016
+ choices: RUNTIMES.map((r) => ({ name: r, value: r }))
33017
+ });
33018
+ const subgraph = opts.subgraph ?? await input({
33019
+ message: "Subgraph name (must already be deployed):",
33020
+ validate: (v) => v.trim().length > 0 ? true : "required"
33021
+ });
33022
+ const table = opts.table ?? await input({
33023
+ message: "Table to subscribe to:",
33024
+ validate: (v) => v.trim().length > 0 ? true : "required"
33025
+ });
33026
+ const url = opts.url ?? await input({
33027
+ message: runtime === "inngest" ? "Inngest event endpoint URL (e.g. https://inn.gs/e/<KEY> or http://localhost:8288/e/<KEY>):" : runtime === "trigger" ? "Trigger.dev task URL (e.g. https://api.trigger.dev/api/v1/tasks/<TASK_ID>/trigger):" : runtime === "cloudflare" ? "Cloudflare Workflows instances URL:" : "Your HTTP receiver URL (e.g. https://yourapp.example/webhook):",
33028
+ validate: (v) => v.startsWith("http://") || v.startsWith("https://") ? true : "must be http(s) URL"
33029
+ });
33030
+ return { runtime, subgraph, table, url };
33031
+ }
33032
+ async function createSubscription(name, opts) {
33033
+ const { runtime, subgraph, table, url } = await promptFor(name, opts);
33034
+ const eventName = `${subgraph}.${table}.created`;
33035
+ const targetDir = resolve2(process.cwd(), name);
33036
+ if (existsSync2(targetDir)) {
33037
+ error(`Directory already exists: ${relative(process.cwd(), targetDir)}`);
33038
+ process.exit(1);
33039
+ }
33040
+ const tplRoot = templatesRoot();
33041
+ const tplDir = join5(tplRoot, runtime);
33042
+ info(`Scaffolding ${blue(runtime)} template at ${blue(targetDir)}`);
33043
+ copyTemplate(tplDir, targetDir, {
33044
+ NAME: name,
33045
+ EVENT_NAME: eventName,
33046
+ TASK_ID: `${subgraph}-${table}`
33047
+ });
33048
+ let signingSecret = null;
33049
+ if (!opts.skipApi) {
33050
+ try {
33051
+ const serviceKey = opts.serviceKey ?? process.env.SL_SERVICE_KEY;
33052
+ const baseUrl = opts.baseUrl ?? process.env.SL_API_URL;
33053
+ if (!serviceKey) {
33054
+ warn("SL_SERVICE_KEY not set — template copied but subscription not provisioned.");
33055
+ info("Provision it from the dashboard or re-run with SL_SERVICE_KEY set.");
33056
+ } else {
33057
+ const sl = new SecondLayer2({
33058
+ apiKey: serviceKey,
33059
+ ...baseUrl ? { baseUrl } : {}
33060
+ });
33061
+ const res = await sl.subscriptions.create({
33062
+ name,
33063
+ subgraphName: subgraph,
33064
+ tableName: table,
33065
+ url,
33066
+ format: FORMAT_BY_RUNTIME[runtime],
33067
+ runtime
33068
+ });
33069
+ signingSecret = res.signingSecret;
33070
+ success(`Subscription provisioned: ${blue(res.subscription.id)}`);
33071
+ }
33072
+ } catch (err) {
33073
+ warn(`Subscription provisioning failed: ${err instanceof Error ? err.message : String(err)}`);
33074
+ info("Template copied — fix auth + run again, or provision via dashboard.");
33075
+ }
33076
+ }
33077
+ if (signingSecret) {
33078
+ const envTarget = join5(targetDir, ".env");
33079
+ const envExample = join5(targetDir, ".env.example");
33080
+ if (existsSync2(envExample) && !existsSync2(envTarget)) {
33081
+ copyFileSync(envExample, envTarget);
33082
+ }
33083
+ if (existsSync2(envTarget)) {
33084
+ const cur = readFileSync(envTarget, "utf8");
33085
+ const next = cur.replace(/^SIGNING_SECRET=.*/m, `SIGNING_SECRET=${signingSecret}`);
33086
+ writeFileSync(envTarget, next.includes("SIGNING_SECRET=") ? next : `${cur}
33087
+ SIGNING_SECRET=${signingSecret}
33088
+ `);
33089
+ success(`Signing secret written to ${relative(process.cwd(), envTarget)}`);
33090
+ } else {
33091
+ info(`Signing secret (copy this — won't be shown again):
33092
+ ${dim(" ")}${signingSecret}`);
33093
+ }
33094
+ }
33095
+ console.log();
33096
+ success(`Done. Next:
33097
+ cd ${name}
33098
+ bun install
33099
+ bun run dev`);
33100
+ }
33101
+ function registerCreateCommand(program2) {
33102
+ const create = program2.command("create").description("Scaffold new resources (subscription receivers, etc.)");
33103
+ create.command("subscription <name>").description("Scaffold a subscription receiver for a runtime").option("-r, --runtime <runtime>", "inngest | trigger | cloudflare | node").option("-s, --subgraph <name>", "Subgraph to subscribe to").option("-t, --table <name>", "Table to subscribe to").option("-u, --url <url>", "Webhook URL").option("--service-key <key>", "SL_SERVICE_KEY override").option("--base-url <url>", "SL_API_URL override").option("--skip-api", "Copy template only, don't call the API").action(async (name, options) => {
33104
+ await createSubscription(name, options);
33105
+ });
33106
+ }
32965
33107
  // src/commands/status.ts
32966
33108
  init_config();
32967
33109
  init_http();
@@ -33405,8 +33547,8 @@ async function resyncDatabase(skipConfirm, backfill) {
33405
33547
  }
33406
33548
  }
33407
33549
  // src/commands/subgraphs.ts
33408
- import { existsSync as existsSync2, mkdirSync, watch } from "node:fs";
33409
- import { resolve as resolve2 } from "node:path";
33550
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, watch } from "node:fs";
33551
+ import { resolve as resolve3 } from "node:path";
33410
33552
  import { confirm as confirm2 } from "@inquirer/prompts";
33411
33553
 
33412
33554
  // src/generators/subgraph-scaffold.ts
@@ -33463,11 +33605,11 @@ function mapType(abiType, nullable) {
33463
33605
  function toCamelCase(str) {
33464
33606
  return str.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
33465
33607
  }
33466
- async function generateSubgraphScaffold(input) {
33467
- const { contractId, functions } = input;
33608
+ async function generateSubgraphScaffold(input2) {
33609
+ const { contractId, functions } = input2;
33468
33610
  const contractParts = contractId.split(".");
33469
33611
  const contractName = contractParts[contractParts.length - 1] ?? contractId;
33470
- const subgraphName = input.subgraphName ?? contractName;
33612
+ const subgraphName = input2.subgraphName ?? contractName;
33471
33613
  const publicFunctions = functions.filter((f) => f.access === "public");
33472
33614
  if (publicFunctions.length === 0) {
33473
33615
  throw new Error(`No public functions found in ${contractId}`);
@@ -33671,14 +33813,14 @@ init_api();
33671
33813
  function registerSubgraphsCommand(program2) {
33672
33814
  const subgraphs = program2.command("subgraphs").description("Manage materialized subgraphs");
33673
33815
  subgraphs.command("new <name>").description("Scaffold a new subgraph definition file").action(async (name) => {
33674
- const dir = resolve2("subgraphs");
33675
- const filePath = resolve2(dir, `${name}.ts`);
33676
- if (existsSync2(filePath)) {
33816
+ const dir = resolve3("subgraphs");
33817
+ const filePath = resolve3(dir, `${name}.ts`);
33818
+ if (existsSync3(filePath)) {
33677
33819
  error(`File already exists: ${filePath}`);
33678
33820
  process.exit(1);
33679
33821
  }
33680
- if (!existsSync2(dir)) {
33681
- mkdirSync(dir, { recursive: true });
33822
+ if (!existsSync3(dir)) {
33823
+ mkdirSync2(dir, { recursive: true });
33682
33824
  }
33683
33825
  const content = generateSubgraphTemplate(name);
33684
33826
  await writeTextFile(filePath, content);
@@ -33687,8 +33829,8 @@ function registerSubgraphsCommand(program2) {
33687
33829
  });
33688
33830
  subgraphs.command("dev <file>").description("Watch a subgraph file and auto-redeploy on change").action(async (file) => {
33689
33831
  await requireLocalNetwork();
33690
- const absPath = resolve2(file);
33691
- if (!existsSync2(absPath)) {
33832
+ const absPath = resolve3(file);
33833
+ if (!existsSync3(absPath)) {
33692
33834
  error(`File not found: ${absPath}`);
33693
33835
  process.exit(1);
33694
33836
  }
@@ -33748,7 +33890,7 @@ Stopped watching.`);
33748
33890
  });
33749
33891
  subgraphs.command("deploy <file>").description("Deploy a subgraph definition file").option("--version <semver>", "Explicit version (default: auto-increment patch)").option("--force", "Skip confirmation prompt for reindex operations").action(async (file, options2) => {
33750
33892
  try {
33751
- const absPath = resolve2(file);
33893
+ const absPath = resolve3(file);
33752
33894
  const config = await loadConfig();
33753
33895
  info(`Loading subgraph from ${absPath}`);
33754
33896
  const mod = await import(absPath);
@@ -34051,7 +34193,7 @@ ${rows.length} row(s)`));
34051
34193
  error("--output <path> is required");
34052
34194
  process.exit(1);
34053
34195
  }
34054
- const outPath = resolve2(options2.output);
34196
+ const outPath = resolve3(options2.output);
34055
34197
  const network = inferNetwork(contractAddress) ?? "mainnet";
34056
34198
  const apiKey = options2.apiKey ?? process.env.HIRO_API_KEY;
34057
34199
  info(`Fetching ABI for ${contractAddress}...`);
@@ -34063,9 +34205,9 @@ ${rows.length} row(s)`));
34063
34205
  contractId: contractAddress,
34064
34206
  functions: abi.functions
34065
34207
  });
34066
- const dir = resolve2(outPath, "..");
34067
- if (!existsSync2(dir))
34068
- mkdirSync(dir, { recursive: true });
34208
+ const dir = resolve3(outPath, "..");
34209
+ if (!existsSync3(dir))
34210
+ mkdirSync2(dir, { recursive: true });
34069
34211
  await writeTextFile(outPath, content);
34070
34212
  success(`Created ${outPath}`);
34071
34213
  info(`Next: sl subgraphs deploy ${options2.output}`);
@@ -34080,14 +34222,14 @@ ${rows.length} row(s)`));
34080
34222
  error("--output <path> is required");
34081
34223
  process.exit(1);
34082
34224
  }
34083
- const outPath = resolve2(options2.output);
34225
+ const outPath = resolve3(options2.output);
34084
34226
  info(`Fetching subgraph metadata for "${subgraphName}"...`);
34085
34227
  const subgraphDetail = await getSubgraphApi(subgraphName);
34086
34228
  info("Generating typed client...");
34087
34229
  const content = await generateSubgraphConsumer(subgraphName, subgraphDetail);
34088
- const dir = resolve2(outPath, "..");
34089
- if (!existsSync2(dir))
34090
- mkdirSync(dir, { recursive: true });
34230
+ const dir = resolve3(outPath, "..");
34231
+ if (!existsSync3(dir))
34232
+ mkdirSync2(dir, { recursive: true });
34091
34233
  await writeTextFile(outPath, content);
34092
34234
  success(`Created ${outPath}`);
34093
34235
  } catch (err) {
@@ -34945,10 +35087,10 @@ function registerWhoamiCommand(program2) {
34945
35087
  init_http();
34946
35088
  init_output();
34947
35089
  init_session();
34948
- import { input as input2 } from "@inquirer/prompts";
35090
+ import { input as input3 } from "@inquirer/prompts";
34949
35091
  function registerLoginCommand(program2) {
34950
35092
  program2.command("login").description("Log in to Secondlayer (magic-link email)").action(async () => {
34951
- const email = await input2({
35093
+ const email = await input3({
34952
35094
  message: "Email",
34953
35095
  validate: (v) => /^.+@.+\..+$/.test(v) ? true : "Invalid email"
34954
35096
  });
@@ -34969,7 +35111,7 @@ function registerLoginCommand(program2) {
34969
35111
  }
34970
35112
  process.exit(1);
34971
35113
  }
34972
- const code = await input2({
35114
+ const code = await input3({
34973
35115
  message: "Enter the 6-digit code",
34974
35116
  validate: (v) => /^\d{6}$/.test(v) ? true : "Expected 6 digits"
34975
35117
  });
@@ -35025,7 +35167,7 @@ init_http();
35025
35167
  init_output();
35026
35168
  init_project_file();
35027
35169
  init_resolve_tenant();
35028
- import { confirm as confirm4, input as input3, select as select3 } from "@inquirer/prompts";
35170
+ import { confirm as confirm4, input as input4, select as select4 } from "@inquirer/prompts";
35029
35171
  function registerInstanceCommand(program2) {
35030
35172
  const instance = program2.command("instance").description("Manage your dedicated Secondlayer instance");
35031
35173
  instance.command("create").description("Provision a new dedicated instance for the active project").option("--plan <plan>", "Plan: hobby (free) | launch | grow | scale", "hobby").action(async (opts) => {
@@ -35055,7 +35197,7 @@ function registerInstanceCommand(program2) {
35055
35197
  guardOssMode();
35056
35198
  let target = opts.plan;
35057
35199
  if (!target) {
35058
- const answer = await select3({
35200
+ const answer = await select4({
35059
35201
  message: "Target plan",
35060
35202
  choices: [
35061
35203
  {
@@ -35122,7 +35264,7 @@ function registerInstanceCommand(program2) {
35122
35264
  }
35123
35265
  const slug = info_.tenant.slug;
35124
35266
  if (!opts.yes) {
35125
- const typed = await input3({
35267
+ const typed = await input4({
35126
35268
  message: `Type the slug "${slug}" to confirm permanent deletion`,
35127
35269
  validate: (v) => v === slug ? true : "Slug must match exactly"
35128
35270
  });
@@ -35147,7 +35289,7 @@ function registerInstanceCommand(program2) {
35147
35289
  else if (opts.anon)
35148
35290
  type = "anon";
35149
35291
  else {
35150
- const answer = await select3({
35292
+ const answer = await select4({
35151
35293
  message: "Which key(s) to rotate?",
35152
35294
  choices: [
35153
35295
  {
@@ -35319,11 +35461,11 @@ init_config();
35319
35461
  init_http();
35320
35462
  init_output();
35321
35463
  init_project_file();
35322
- import { input as input4 } from "@inquirer/prompts";
35464
+ import { input as input5 } from "@inquirer/prompts";
35323
35465
  function registerProjectCommand(program2) {
35324
35466
  const project = program2.command("project").description("Manage Secondlayer projects");
35325
35467
  project.command("create [name]").description("Create a new project").action(async (nameArg) => {
35326
- const name = nameArg ?? await input4({
35468
+ const name = nameArg ?? await input5({
35327
35469
  message: "Project name",
35328
35470
  validate: (v) => v.length >= 2 ? true : "Name must be at least 2 characters"
35329
35471
  });
@@ -35427,6 +35569,7 @@ registerWhoamiCommand(program);
35427
35569
  registerProjectCommand(program);
35428
35570
  registerInstanceCommand(program);
35429
35571
  registerSubgraphsCommand(program);
35572
+ registerCreateCommand(program);
35430
35573
  registerStatusCommand(program);
35431
35574
  registerStackCommand(program);
35432
35575
  registerDbCommand(program);
@@ -35436,5 +35579,5 @@ registerLocalCommand(program);
35436
35579
  registerAccountCommand(program);
35437
35580
  program.parse();
35438
35581
 
35439
- //# debugId=2929270B62E4733C64756E2164756E21
35582
+ //# debugId=607C1655F119463164756E2164756E21
35440
35583
  //# sourceMappingURL=cli.js.map