sproutkit-code 0.3.0 → 0.4.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/index.js CHANGED
@@ -29,19 +29,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  // ../../node_modules/electron/index.js
30
30
  var require_electron = __commonJS({
31
31
  "../../node_modules/electron/index.js"(exports2, module2) {
32
- var fs2 = require("fs");
33
- var path2 = require("path");
34
- var pathFile = path2.join(__dirname, "path.txt");
32
+ var fs3 = require("fs");
33
+ var path3 = require("path");
34
+ var pathFile = path3.join(__dirname, "path.txt");
35
35
  function getElectronPath() {
36
36
  let executablePath;
37
- if (fs2.existsSync(pathFile)) {
38
- executablePath = fs2.readFileSync(pathFile, "utf-8");
37
+ if (fs3.existsSync(pathFile)) {
38
+ executablePath = fs3.readFileSync(pathFile, "utf-8");
39
39
  }
40
40
  if (process.env.ELECTRON_OVERRIDE_DIST_PATH) {
41
- return path2.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
41
+ return path3.join(process.env.ELECTRON_OVERRIDE_DIST_PATH, executablePath || "electron");
42
42
  }
43
43
  if (executablePath) {
44
- return path2.join(__dirname, "dist", executablePath);
44
+ return path3.join(__dirname, "dist", executablePath);
45
45
  } else {
46
46
  throw new Error("Electron failed to install correctly, please delete node_modules/electron and try installing again");
47
47
  }
@@ -982,14 +982,14 @@ var require_url_state_machine = __commonJS({
982
982
  return url.replace(/\u0009|\u000A|\u000D/g, "");
983
983
  }
984
984
  function shortenPath(url) {
985
- const path2 = url.path;
986
- if (path2.length === 0) {
985
+ const path3 = url.path;
986
+ if (path3.length === 0) {
987
987
  return;
988
988
  }
989
- if (url.scheme === "file" && path2.length === 1 && isNormalizedWindowsDriveLetter(path2[0])) {
989
+ if (url.scheme === "file" && path3.length === 1 && isNormalizedWindowsDriveLetter(path3[0])) {
990
990
  return;
991
991
  }
992
- path2.pop();
992
+ path3.pop();
993
993
  }
994
994
  function includesCredentials(url) {
995
995
  return url.username !== "" || url.password !== "";
@@ -10824,14 +10824,14 @@ var require_fileFromPath = __commonJS({
10824
10824
  return "File";
10825
10825
  }
10826
10826
  };
10827
- function createFileFromPath(path2, { mtimeMs, size }, filenameOrOptions, options = {}) {
10827
+ function createFileFromPath(path3, { mtimeMs, size }, filenameOrOptions, options = {}) {
10828
10828
  let filename;
10829
10829
  if ((0, isPlainObject_1.default)(filenameOrOptions)) {
10830
10830
  [options, filename] = [filenameOrOptions, void 0];
10831
10831
  } else {
10832
10832
  filename = filenameOrOptions;
10833
10833
  }
10834
- const file = new FileFromPath({ path: path2, size, lastModified: mtimeMs });
10834
+ const file = new FileFromPath({ path: path3, size, lastModified: mtimeMs });
10835
10835
  if (!filename) {
10836
10836
  filename = file.name;
10837
10837
  }
@@ -10840,14 +10840,14 @@ var require_fileFromPath = __commonJS({
10840
10840
  lastModified: file.lastModified
10841
10841
  });
10842
10842
  }
10843
- function fileFromPathSync(path2, filenameOrOptions, options = {}) {
10844
- const stats = (0, fs_1.statSync)(path2);
10845
- return createFileFromPath(path2, stats, filenameOrOptions, options);
10843
+ function fileFromPathSync(path3, filenameOrOptions, options = {}) {
10844
+ const stats = (0, fs_1.statSync)(path3);
10845
+ return createFileFromPath(path3, stats, filenameOrOptions, options);
10846
10846
  }
10847
10847
  exports2.fileFromPathSync = fileFromPathSync;
10848
- async function fileFromPath(path2, filenameOrOptions, options) {
10849
- const stats = await fs_1.promises.stat(path2);
10850
- return createFileFromPath(path2, stats, filenameOrOptions, options);
10848
+ async function fileFromPath(path3, filenameOrOptions, options) {
10849
+ const stats = await fs_1.promises.stat(path3);
10850
+ return createFileFromPath(path3, stats, filenameOrOptions, options);
10851
10851
  }
10852
10852
  exports2.fileFromPath = fileFromPath;
10853
10853
  }
@@ -10899,13 +10899,13 @@ var require_node_runtime = __commonJS({
10899
10899
  var MultipartBody_1 = require_MultipartBody();
10900
10900
  var web_1 = require("node:stream/web");
10901
10901
  var fileFromPathWarned = false;
10902
- async function fileFromPath(path2, ...args) {
10902
+ async function fileFromPath(path3, ...args) {
10903
10903
  const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => __importStar(require_fileFromPath()));
10904
10904
  if (!fileFromPathWarned) {
10905
- console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path2)}) instead`);
10905
+ console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path3)}) instead`);
10906
10906
  fileFromPathWarned = true;
10907
10907
  }
10908
- return await _fileFromPath(path2, ...args);
10908
+ return await _fileFromPath(path3, ...args);
10909
10909
  }
10910
10910
  var defaultHttpAgent = new agentkeepalive_1.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
10911
10911
  var defaultHttpsAgent = new agentkeepalive_1.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
@@ -11670,29 +11670,29 @@ var require_core = __commonJS({
11670
11670
  defaultIdempotencyKey() {
11671
11671
  return `stainless-node-retry-${uuid4()}`;
11672
11672
  }
11673
- get(path2, opts) {
11674
- return this.methodRequest("get", path2, opts);
11673
+ get(path3, opts) {
11674
+ return this.methodRequest("get", path3, opts);
11675
11675
  }
11676
- post(path2, opts) {
11677
- return this.methodRequest("post", path2, opts);
11676
+ post(path3, opts) {
11677
+ return this.methodRequest("post", path3, opts);
11678
11678
  }
11679
- patch(path2, opts) {
11680
- return this.methodRequest("patch", path2, opts);
11679
+ patch(path3, opts) {
11680
+ return this.methodRequest("patch", path3, opts);
11681
11681
  }
11682
- put(path2, opts) {
11683
- return this.methodRequest("put", path2, opts);
11682
+ put(path3, opts) {
11683
+ return this.methodRequest("put", path3, opts);
11684
11684
  }
11685
- delete(path2, opts) {
11686
- return this.methodRequest("delete", path2, opts);
11685
+ delete(path3, opts) {
11686
+ return this.methodRequest("delete", path3, opts);
11687
11687
  }
11688
- methodRequest(method, path2, opts) {
11688
+ methodRequest(method, path3, opts) {
11689
11689
  return this.request(Promise.resolve(opts).then(async (opts2) => {
11690
11690
  const body = opts2 && (0, uploads_1.isBlobLike)(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
11691
- return { method, path: path2, ...opts2, body };
11691
+ return { method, path: path3, ...opts2, body };
11692
11692
  }));
11693
11693
  }
11694
- getAPIList(path2, Page, opts) {
11695
- return this.requestAPIList(Page, { method: "get", path: path2, ...opts });
11694
+ getAPIList(path3, Page, opts) {
11695
+ return this.requestAPIList(Page, { method: "get", path: path3, ...opts });
11696
11696
  }
11697
11697
  calculateContentLength(body) {
11698
11698
  if (typeof body === "string") {
@@ -11710,10 +11710,10 @@ var require_core = __commonJS({
11710
11710
  return null;
11711
11711
  }
11712
11712
  buildRequest(options, { retryCount = 0 } = {}) {
11713
- const { method, path: path2, query, headers = {} } = options;
11713
+ const { method, path: path3, query, headers = {} } = options;
11714
11714
  const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : (0, uploads_1.isMultipartBody)(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
11715
11715
  const contentLength = this.calculateContentLength(body);
11716
- const url = this.buildURL(path2, query);
11716
+ const url = this.buildURL(path3, query);
11717
11717
  if ("timeout" in options)
11718
11718
  validatePositiveInteger("timeout", options.timeout);
11719
11719
  const timeout = options.timeout ?? this.timeout;
@@ -11826,8 +11826,8 @@ var require_core = __commonJS({
11826
11826
  const request = this.makeRequest(options, null);
11827
11827
  return new PagePromise(this, request, Page);
11828
11828
  }
11829
- buildURL(path2, query) {
11830
- const url = isAbsoluteURL(path2) ? new URL(path2) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path2.startsWith("/") ? path2.slice(1) : path2));
11829
+ buildURL(path3, query) {
11830
+ const url = isAbsoluteURL(path3) ? new URL(path3) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path3.startsWith("/") ? path3.slice(1) : path3));
11831
11831
  const defaultQuery = this.defaultQuery();
11832
11832
  if (!isEmptyObj(defaultQuery)) {
11833
11833
  query = { ...defaultQuery, ...query };
@@ -23164,11 +23164,11 @@ var require_mime_types = __commonJS({
23164
23164
  }
23165
23165
  return exts[0];
23166
23166
  }
23167
- function lookup(path2) {
23168
- if (!path2 || typeof path2 !== "string") {
23167
+ function lookup(path3) {
23168
+ if (!path3 || typeof path3 !== "string") {
23169
23169
  return false;
23170
23170
  }
23171
- var extension2 = extname("x." + path2).toLowerCase().substr(1);
23171
+ var extension2 = extname("x." + path3).toLowerCase().substr(1);
23172
23172
  if (!extension2) {
23173
23173
  return false;
23174
23174
  }
@@ -24273,11 +24273,11 @@ var require_form_data = __commonJS({
24273
24273
  "use strict";
24274
24274
  var CombinedStream = require_combined_stream();
24275
24275
  var util = require("util");
24276
- var path2 = require("path");
24276
+ var path3 = require("path");
24277
24277
  var http = require("http");
24278
24278
  var https = require("https");
24279
24279
  var parseUrl = require("url").parse;
24280
- var fs2 = require("fs");
24280
+ var fs3 = require("fs");
24281
24281
  var Stream = require("stream").Stream;
24282
24282
  var crypto2 = require("crypto");
24283
24283
  var mime = require_mime_types();
@@ -24344,7 +24344,7 @@ var require_form_data = __commonJS({
24344
24344
  if (value.end != void 0 && value.end != Infinity && value.start != void 0) {
24345
24345
  callback(null, value.end + 1 - (value.start ? value.start : 0));
24346
24346
  } else {
24347
- fs2.stat(value.path, function(err, stat) {
24347
+ fs3.stat(value.path, function(err, stat) {
24348
24348
  if (err) {
24349
24349
  callback(err);
24350
24350
  return;
@@ -24401,11 +24401,11 @@ var require_form_data = __commonJS({
24401
24401
  FormData2.prototype._getContentDisposition = function(value, options) {
24402
24402
  var filename;
24403
24403
  if (typeof options.filepath === "string") {
24404
- filename = path2.normalize(options.filepath).replace(/\\/g, "/");
24404
+ filename = path3.normalize(options.filepath).replace(/\\/g, "/");
24405
24405
  } else if (options.filename || value && (value.name || value.path)) {
24406
- filename = path2.basename(options.filename || value && (value.name || value.path));
24406
+ filename = path3.basename(options.filename || value && (value.name || value.path));
24407
24407
  } else if (value && value.readable && hasOwn(value, "httpVersion")) {
24408
- filename = path2.basename(value.client._httpMessage.path || "");
24408
+ filename = path3.basename(value.client._httpMessage.path || "");
24409
24409
  }
24410
24410
  if (filename) {
24411
24411
  return 'filename="' + filename + '"';
@@ -24950,7 +24950,7 @@ var require_has_flag = __commonJS({
24950
24950
  var require_supports_color = __commonJS({
24951
24951
  "../../node_modules/supports-color/index.js"(exports2, module2) {
24952
24952
  "use strict";
24953
- var os3 = require("os");
24953
+ var os4 = require("os");
24954
24954
  var tty = require("tty");
24955
24955
  var hasFlag = require_has_flag();
24956
24956
  var { env } = process;
@@ -24998,7 +24998,7 @@ var require_supports_color = __commonJS({
24998
24998
  return min;
24999
24999
  }
25000
25000
  if (process.platform === "win32") {
25001
- const osRelease = os3.release().split(".");
25001
+ const osRelease = os4.release().split(".");
25002
25002
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
25003
25003
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
25004
25004
  }
@@ -26226,7 +26226,7 @@ var require_axios = __commonJS({
26226
26226
  var https = require("https");
26227
26227
  var http2 = require("http2");
26228
26228
  var util = require("util");
26229
- var path2 = require("path");
26229
+ var path3 = require("path");
26230
26230
  var followRedirects = require_follow_redirects();
26231
26231
  var zlib = require("zlib");
26232
26232
  var stream = require("stream");
@@ -27113,9 +27113,9 @@ var require_axios = __commonJS({
27113
27113
  function removeBrackets(key) {
27114
27114
  return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
27115
27115
  }
27116
- function renderKey(path3, key, dots) {
27117
- if (!path3) return key;
27118
- return path3.concat(key).map(function each(token, i) {
27116
+ function renderKey(path4, key, dots) {
27117
+ if (!path4) return key;
27118
+ return path4.concat(key).map(function each(token, i) {
27119
27119
  token = removeBrackets(token);
27120
27120
  return !dots && i ? "[" + token + "]" : token;
27121
27121
  }).join(dots ? "." : "");
@@ -27164,13 +27164,13 @@ var require_axios = __commonJS({
27164
27164
  }
27165
27165
  return value;
27166
27166
  }
27167
- function defaultVisitor(value, key, path3) {
27167
+ function defaultVisitor(value, key, path4) {
27168
27168
  let arr = value;
27169
27169
  if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
27170
- formData.append(renderKey(path3, key, dots), convertValue(value));
27170
+ formData.append(renderKey(path4, key, dots), convertValue(value));
27171
27171
  return false;
27172
27172
  }
27173
- if (value && !path3 && typeof value === "object") {
27173
+ if (value && !path4 && typeof value === "object") {
27174
27174
  if (utils$1.endsWith(key, "{}")) {
27175
27175
  key = metaTokens ? key : key.slice(0, -2);
27176
27176
  value = JSON.stringify(value);
@@ -27189,7 +27189,7 @@ var require_axios = __commonJS({
27189
27189
  if (isVisitable(value)) {
27190
27190
  return true;
27191
27191
  }
27192
- formData.append(renderKey(path3, key, dots), convertValue(value));
27192
+ formData.append(renderKey(path4, key, dots), convertValue(value));
27193
27193
  return false;
27194
27194
  }
27195
27195
  const stack = [];
@@ -27198,19 +27198,19 @@ var require_axios = __commonJS({
27198
27198
  convertValue,
27199
27199
  isVisitable
27200
27200
  });
27201
- function build(value, path3, depth = 0) {
27201
+ function build(value, path4, depth = 0) {
27202
27202
  if (utils$1.isUndefined(value)) return;
27203
27203
  if (depth > maxDepth) {
27204
27204
  throw new AxiosError("Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
27205
27205
  }
27206
27206
  if (stack.indexOf(value) !== -1) {
27207
- throw Error("Circular reference detected in " + path3.join("."));
27207
+ throw Error("Circular reference detected in " + path4.join("."));
27208
27208
  }
27209
27209
  stack.push(value);
27210
27210
  utils$1.forEach(value, function each(el, key) {
27211
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path3, exposedHelpers);
27211
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path4, exposedHelpers);
27212
27212
  if (result === true) {
27213
- build(el, path3 ? path3.concat(key) : [key], depth + 1);
27213
+ build(el, path4 ? path4.concat(key) : [key], depth + 1);
27214
27214
  }
27215
27215
  });
27216
27216
  stack.pop();
@@ -27398,7 +27398,7 @@ var require_axios = __commonJS({
27398
27398
  };
27399
27399
  function toURLEncodedForm(data, options) {
27400
27400
  return toFormData(data, new platform.classes.URLSearchParams(), {
27401
- visitor: function(value, key, path3, helpers) {
27401
+ visitor: function(value, key, path4, helpers) {
27402
27402
  if (platform.isNode && utils$1.isBuffer(value)) {
27403
27403
  this.append(key, value.toString("base64"));
27404
27404
  return false;
@@ -27426,11 +27426,11 @@ var require_axios = __commonJS({
27426
27426
  return obj;
27427
27427
  }
27428
27428
  function formDataToJSON(formData) {
27429
- function buildPath(path3, value, target, index) {
27430
- let name = path3[index++];
27429
+ function buildPath(path4, value, target, index) {
27430
+ let name = path4[index++];
27431
27431
  if (name === "__proto__") return true;
27432
27432
  const isNumericKey = Number.isFinite(+name);
27433
- const isLast = index >= path3.length;
27433
+ const isLast = index >= path4.length;
27434
27434
  name = !name && utils$1.isArray(target) ? target.length : name;
27435
27435
  if (isLast) {
27436
27436
  if (utils$1.hasOwnProp(target, name)) {
@@ -27443,7 +27443,7 @@ var require_axios = __commonJS({
27443
27443
  if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
27444
27444
  target[name] = [];
27445
27445
  }
27446
- const result = buildPath(path3, value, target[name], index);
27446
+ const result = buildPath(path4, value, target[name], index);
27447
27447
  if (result && utils$1.isArray(target[name])) {
27448
27448
  target[name] = arrayToObject(target[name]);
27449
27449
  }
@@ -28813,8 +28813,8 @@ var require_axios = __commonJS({
28813
28813
  }
28814
28814
  if (config.allowedSocketPaths != null) {
28815
28815
  const allowed = Array.isArray(config.allowedSocketPaths) ? config.allowedSocketPaths : [config.allowedSocketPaths];
28816
- const resolvedSocket = path2.resolve(config.socketPath);
28817
- const isAllowed = allowed.some((entry) => typeof entry === "string" && path2.resolve(entry) === resolvedSocket);
28816
+ const resolvedSocket = path3.resolve(config.socketPath);
28817
+ const isAllowed = allowed.some((entry) => typeof entry === "string" && path3.resolve(entry) === resolvedSocket);
28818
28818
  if (!isAllowed) {
28819
28819
  return reject(new AxiosError(`socketPath "${config.socketPath}" is not permitted by allowedSocketPaths`, AxiosError.ERR_BAD_OPTION_VALUE, config));
28820
28820
  }
@@ -29068,14 +29068,14 @@ var require_axios = __commonJS({
29068
29068
  var cookies = platform.hasStandardBrowserEnv ? (
29069
29069
  // Standard browser envs support document.cookie
29070
29070
  {
29071
- write(name, value, expires, path3, domain, secure, sameSite) {
29071
+ write(name, value, expires, path4, domain, secure, sameSite) {
29072
29072
  if (typeof document === "undefined") return;
29073
29073
  const cookie = [`${name}=${encodeURIComponent(value)}`];
29074
29074
  if (utils$1.isNumber(expires)) {
29075
29075
  cookie.push(`expires=${new Date(expires).toUTCString()}`);
29076
29076
  }
29077
- if (utils$1.isString(path3)) {
29078
- cookie.push(`path=${path3}`);
29077
+ if (utils$1.isString(path4)) {
29078
+ cookie.push(`path=${path4}`);
29079
29079
  }
29080
29080
  if (utils$1.isString(domain)) {
29081
29081
  cookie.push(`domain=${domain}`);
@@ -30384,8 +30384,10 @@ var require_llm = __commonJS({
30384
30384
  };
30385
30385
  })();
30386
30386
  Object.defineProperty(exports2, "__esModule", { value: true });
30387
+ exports2.CLAUDE_CODE_MODELS = void 0;
30387
30388
  exports2.getBackend = getBackend2;
30388
30389
  exports2.claudeBin = claudeBin2;
30390
+ exports2.getClaudeCodeModel = getClaudeCodeModel2;
30389
30391
  exports2.visionUnavailable = visionUnavailable;
30390
30392
  exports2.generateText = generateText;
30391
30393
  exports2.checkClaudeCodeAuth = checkClaudeCodeAuth2;
@@ -30409,6 +30411,16 @@ var require_llm = __commonJS({
30409
30411
  function claudeBin2() {
30410
30412
  return process.env.SPROUTKIT_CLAUDE_BIN || "claude";
30411
30413
  }
30414
+ exports2.CLAUDE_CODE_MODELS = [
30415
+ { alias: "opus", label: "Opus \u2014 most capable" },
30416
+ { alias: "sonnet", label: "Sonnet \u2014 balanced (default)" },
30417
+ { alias: "haiku", label: "Haiku \u2014 fastest / cheapest on your plan" },
30418
+ { alias: "fable", label: "Fable \u2014 frontier (needs 30-day data retention)" }
30419
+ ];
30420
+ function getClaudeCodeModel2() {
30421
+ const v = readSetting("claude_code_model");
30422
+ return v && exports2.CLAUDE_CODE_MODELS.some((m) => m.alias === v) ? v : null;
30423
+ }
30412
30424
  function visionUnavailable(hasImages) {
30413
30425
  return hasImages && getBackend2() === "claude_code";
30414
30426
  }
@@ -30429,14 +30441,20 @@ var require_llm = __commonJS({
30429
30441
  }
30430
30442
  }))
30431
30443
  ] : args.prompt;
30432
- const res = await anthropic.messages.create({
30444
+ const req = {
30433
30445
  model: args.model || "claude-sonnet-4-6",
30434
30446
  max_tokens: args.maxTokens ?? 8192,
30435
30447
  messages: [{ role: "user", content }]
30436
- });
30437
- const textBlock = res.content.find((b) => b.type === "text");
30448
+ };
30449
+ if (args.allowWebSearch) {
30450
+ req.tools = [
30451
+ { type: "web_search_20250305", name: "web_search", max_uses: 3 }
30452
+ ];
30453
+ }
30454
+ const res = await anthropic.messages.create(req);
30455
+ const text = res.content.filter((b) => b.type === "text").map((b) => b.text).join("\n").trim();
30438
30456
  return {
30439
- text: textBlock?.text ?? "",
30457
+ text,
30440
30458
  stopReason: res.stop_reason ?? null,
30441
30459
  backend: "api"
30442
30460
  };
@@ -30446,8 +30464,11 @@ var require_llm = __commonJS({
30446
30464
  throw new Error("Image input isn't supported on the Claude subscription backend. This step needs an Anthropic API key.");
30447
30465
  }
30448
30466
  const cliArgs = ["-p", "--output-format", "json"];
30449
- if (args.model)
30450
- cliArgs.push("--model", args.model);
30467
+ const alias = getClaudeCodeModel2();
30468
+ if (alias)
30469
+ cliArgs.push("--model", alias);
30470
+ if (args.allowWebSearch)
30471
+ cliArgs.push("--allowedTools", "WebSearch");
30451
30472
  const bin = claudeBin2();
30452
30473
  const timeoutMs = args.timeoutMs ?? 18e4;
30453
30474
  return new Promise((resolve, reject) => {
@@ -34862,8 +34883,8 @@ var require_windows = __commonJS({
34862
34883
  "../../node_modules/isexe/windows.js"(exports2, module2) {
34863
34884
  module2.exports = isexe;
34864
34885
  isexe.sync = sync;
34865
- var fs2 = require("fs");
34866
- function checkPathExt(path2, options) {
34886
+ var fs3 = require("fs");
34887
+ function checkPathExt(path3, options) {
34867
34888
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
34868
34889
  if (!pathext) {
34869
34890
  return true;
@@ -34874,25 +34895,25 @@ var require_windows = __commonJS({
34874
34895
  }
34875
34896
  for (var i = 0; i < pathext.length; i++) {
34876
34897
  var p = pathext[i].toLowerCase();
34877
- if (p && path2.substr(-p.length).toLowerCase() === p) {
34898
+ if (p && path3.substr(-p.length).toLowerCase() === p) {
34878
34899
  return true;
34879
34900
  }
34880
34901
  }
34881
34902
  return false;
34882
34903
  }
34883
- function checkStat(stat, path2, options) {
34904
+ function checkStat(stat, path3, options) {
34884
34905
  if (!stat.isSymbolicLink() && !stat.isFile()) {
34885
34906
  return false;
34886
34907
  }
34887
- return checkPathExt(path2, options);
34908
+ return checkPathExt(path3, options);
34888
34909
  }
34889
- function isexe(path2, options, cb) {
34890
- fs2.stat(path2, function(er, stat) {
34891
- cb(er, er ? false : checkStat(stat, path2, options));
34910
+ function isexe(path3, options, cb) {
34911
+ fs3.stat(path3, function(er, stat) {
34912
+ cb(er, er ? false : checkStat(stat, path3, options));
34892
34913
  });
34893
34914
  }
34894
- function sync(path2, options) {
34895
- return checkStat(fs2.statSync(path2), path2, options);
34915
+ function sync(path3, options) {
34916
+ return checkStat(fs3.statSync(path3), path3, options);
34896
34917
  }
34897
34918
  }
34898
34919
  });
@@ -34902,14 +34923,14 @@ var require_mode = __commonJS({
34902
34923
  "../../node_modules/isexe/mode.js"(exports2, module2) {
34903
34924
  module2.exports = isexe;
34904
34925
  isexe.sync = sync;
34905
- var fs2 = require("fs");
34906
- function isexe(path2, options, cb) {
34907
- fs2.stat(path2, function(er, stat) {
34926
+ var fs3 = require("fs");
34927
+ function isexe(path3, options, cb) {
34928
+ fs3.stat(path3, function(er, stat) {
34908
34929
  cb(er, er ? false : checkStat(stat, options));
34909
34930
  });
34910
34931
  }
34911
- function sync(path2, options) {
34912
- return checkStat(fs2.statSync(path2), options);
34932
+ function sync(path3, options) {
34933
+ return checkStat(fs3.statSync(path3), options);
34913
34934
  }
34914
34935
  function checkStat(stat, options) {
34915
34936
  return stat.isFile() && checkMode(stat, options);
@@ -34933,7 +34954,7 @@ var require_mode = __commonJS({
34933
34954
  // ../../node_modules/isexe/index.js
34934
34955
  var require_isexe = __commonJS({
34935
34956
  "../../node_modules/isexe/index.js"(exports2, module2) {
34936
- var fs2 = require("fs");
34957
+ var fs3 = require("fs");
34937
34958
  var core;
34938
34959
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
34939
34960
  core = require_windows();
@@ -34942,7 +34963,7 @@ var require_isexe = __commonJS({
34942
34963
  }
34943
34964
  module2.exports = isexe;
34944
34965
  isexe.sync = sync;
34945
- function isexe(path2, options, cb) {
34966
+ function isexe(path3, options, cb) {
34946
34967
  if (typeof options === "function") {
34947
34968
  cb = options;
34948
34969
  options = {};
@@ -34952,7 +34973,7 @@ var require_isexe = __commonJS({
34952
34973
  throw new TypeError("callback not provided");
34953
34974
  }
34954
34975
  return new Promise(function(resolve, reject) {
34955
- isexe(path2, options || {}, function(er, is) {
34976
+ isexe(path3, options || {}, function(er, is) {
34956
34977
  if (er) {
34957
34978
  reject(er);
34958
34979
  } else {
@@ -34961,7 +34982,7 @@ var require_isexe = __commonJS({
34961
34982
  });
34962
34983
  });
34963
34984
  }
34964
- core(path2, options || {}, function(er, is) {
34985
+ core(path3, options || {}, function(er, is) {
34965
34986
  if (er) {
34966
34987
  if (er.code === "EACCES" || options && options.ignoreErrors) {
34967
34988
  er = null;
@@ -34971,9 +34992,9 @@ var require_isexe = __commonJS({
34971
34992
  cb(er, is);
34972
34993
  });
34973
34994
  }
34974
- function sync(path2, options) {
34995
+ function sync(path3, options) {
34975
34996
  try {
34976
- return core.sync(path2, options || {});
34997
+ return core.sync(path3, options || {});
34977
34998
  } catch (er) {
34978
34999
  if (options && options.ignoreErrors || er.code === "EACCES") {
34979
35000
  return false;
@@ -34989,7 +35010,7 @@ var require_isexe = __commonJS({
34989
35010
  var require_which = __commonJS({
34990
35011
  "../../node_modules/which/which.js"(exports2, module2) {
34991
35012
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
34992
- var path2 = require("path");
35013
+ var path3 = require("path");
34993
35014
  var COLON = isWindows ? ";" : ":";
34994
35015
  var isexe = require_isexe();
34995
35016
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
@@ -35027,7 +35048,7 @@ var require_which = __commonJS({
35027
35048
  return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
35028
35049
  const ppRaw = pathEnv[i];
35029
35050
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
35030
- const pCmd = path2.join(pathPart, cmd);
35051
+ const pCmd = path3.join(pathPart, cmd);
35031
35052
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
35032
35053
  resolve(subStep(p, i, 0));
35033
35054
  });
@@ -35054,7 +35075,7 @@ var require_which = __commonJS({
35054
35075
  for (let i = 0; i < pathEnv.length; i++) {
35055
35076
  const ppRaw = pathEnv[i];
35056
35077
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
35057
- const pCmd = path2.join(pathPart, cmd);
35078
+ const pCmd = path3.join(pathPart, cmd);
35058
35079
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
35059
35080
  for (let j = 0; j < pathExt.length; j++) {
35060
35081
  const cur = p + pathExt[j];
@@ -35102,7 +35123,7 @@ var require_path_key = __commonJS({
35102
35123
  var require_resolveCommand = __commonJS({
35103
35124
  "../../node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
35104
35125
  "use strict";
35105
- var path2 = require("path");
35126
+ var path3 = require("path");
35106
35127
  var which = require_which();
35107
35128
  var getPathKey = require_path_key();
35108
35129
  function resolveCommandAttempt(parsed, withoutPathExt) {
@@ -35120,7 +35141,7 @@ var require_resolveCommand = __commonJS({
35120
35141
  try {
35121
35142
  resolved = which.sync(parsed.command, {
35122
35143
  path: env[getPathKey({ env })],
35123
- pathExt: withoutPathExt ? path2.delimiter : void 0
35144
+ pathExt: withoutPathExt ? path3.delimiter : void 0
35124
35145
  });
35125
35146
  } catch (e) {
35126
35147
  } finally {
@@ -35129,7 +35150,7 @@ var require_resolveCommand = __commonJS({
35129
35150
  }
35130
35151
  }
35131
35152
  if (resolved) {
35132
- resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
35153
+ resolved = path3.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
35133
35154
  }
35134
35155
  return resolved;
35135
35156
  }
@@ -35183,8 +35204,8 @@ var require_shebang_command = __commonJS({
35183
35204
  if (!match) {
35184
35205
  return null;
35185
35206
  }
35186
- const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
35187
- const binary = path2.split("/").pop();
35207
+ const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
35208
+ const binary = path3.split("/").pop();
35188
35209
  if (binary === "env") {
35189
35210
  return argument;
35190
35211
  }
@@ -35197,16 +35218,16 @@ var require_shebang_command = __commonJS({
35197
35218
  var require_readShebang = __commonJS({
35198
35219
  "../../node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
35199
35220
  "use strict";
35200
- var fs2 = require("fs");
35221
+ var fs3 = require("fs");
35201
35222
  var shebangCommand = require_shebang_command();
35202
35223
  function readShebang(command) {
35203
35224
  const size = 150;
35204
35225
  const buffer = Buffer.alloc(size);
35205
35226
  let fd;
35206
35227
  try {
35207
- fd = fs2.openSync(command, "r");
35208
- fs2.readSync(fd, buffer, 0, size, 0);
35209
- fs2.closeSync(fd);
35228
+ fd = fs3.openSync(command, "r");
35229
+ fs3.readSync(fd, buffer, 0, size, 0);
35230
+ fs3.closeSync(fd);
35210
35231
  } catch (e) {
35211
35232
  }
35212
35233
  return shebangCommand(buffer.toString());
@@ -35219,7 +35240,7 @@ var require_readShebang = __commonJS({
35219
35240
  var require_parse = __commonJS({
35220
35241
  "../../node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
35221
35242
  "use strict";
35222
- var path2 = require("path");
35243
+ var path3 = require("path");
35223
35244
  var resolveCommand = require_resolveCommand();
35224
35245
  var escape = require_escape();
35225
35246
  var readShebang = require_readShebang();
@@ -35244,7 +35265,7 @@ var require_parse = __commonJS({
35244
35265
  const needsShell = !isExecutableRegExp.test(commandFile);
35245
35266
  if (parsed.options.forceShell || needsShell) {
35246
35267
  const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
35247
- parsed.command = path2.normalize(parsed.command);
35268
+ parsed.command = path3.normalize(parsed.command);
35248
35269
  parsed.command = escape.command(parsed.command);
35249
35270
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
35250
35271
  const shellCommand = [parsed.command].concat(parsed.args).join(" ");
@@ -35376,7 +35397,7 @@ var require_strip_final_newline = __commonJS({
35376
35397
  var require_npm_run_path = __commonJS({
35377
35398
  "../../node_modules/npm-run-path/index.js"(exports2, module2) {
35378
35399
  "use strict";
35379
- var path2 = require("path");
35400
+ var path3 = require("path");
35380
35401
  var pathKey = require_path_key();
35381
35402
  var npmRunPath = (options) => {
35382
35403
  options = {
@@ -35386,16 +35407,16 @@ var require_npm_run_path = __commonJS({
35386
35407
  ...options
35387
35408
  };
35388
35409
  let previous;
35389
- let cwdPath = path2.resolve(options.cwd);
35410
+ let cwdPath = path3.resolve(options.cwd);
35390
35411
  const result = [];
35391
35412
  while (previous !== cwdPath) {
35392
- result.push(path2.join(cwdPath, "node_modules/.bin"));
35413
+ result.push(path3.join(cwdPath, "node_modules/.bin"));
35393
35414
  previous = cwdPath;
35394
- cwdPath = path2.resolve(cwdPath, "..");
35415
+ cwdPath = path3.resolve(cwdPath, "..");
35395
35416
  }
35396
- const execPathDir = path2.resolve(options.cwd, options.execPath, "..");
35417
+ const execPathDir = path3.resolve(options.cwd, options.execPath, "..");
35397
35418
  result.push(execPathDir);
35398
- return result.concat(options.path).join(path2.delimiter);
35419
+ return result.concat(options.path).join(path3.delimiter);
35399
35420
  };
35400
35421
  module2.exports = npmRunPath;
35401
35422
  module2.exports.default = npmRunPath;
@@ -35405,9 +35426,9 @@ var require_npm_run_path = __commonJS({
35405
35426
  ...options
35406
35427
  };
35407
35428
  const env = { ...options.env };
35408
- const path3 = pathKey({ env });
35409
- options.path = env[path3];
35410
- env[path3] = module2.exports(options);
35429
+ const path4 = pathKey({ env });
35430
+ options.path = env[path4];
35431
+ env[path4] = module2.exports(options);
35411
35432
  return env;
35412
35433
  };
35413
35434
  }
@@ -36183,7 +36204,7 @@ var require_signal_exit = __commonJS({
36183
36204
  var require_kill = __commonJS({
36184
36205
  "../../node_modules/execa/lib/kill.js"(exports2, module2) {
36185
36206
  "use strict";
36186
- var os3 = require("os");
36207
+ var os4 = require("os");
36187
36208
  var onExit = require_signal_exit();
36188
36209
  var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
36189
36210
  var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
@@ -36207,7 +36228,7 @@ var require_kill = __commonJS({
36207
36228
  return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
36208
36229
  };
36209
36230
  var isSigterm = (signal) => {
36210
- return signal === os3.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
36231
+ return signal === os4.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
36211
36232
  };
36212
36233
  var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
36213
36234
  if (forceKillAfterTimeout === true) {
@@ -36589,7 +36610,7 @@ var require_command = __commonJS({
36589
36610
  var require_execa = __commonJS({
36590
36611
  "../../node_modules/execa/index.js"(exports2, module2) {
36591
36612
  "use strict";
36592
- var path2 = require("path");
36613
+ var path3 = require("path");
36593
36614
  var childProcess = require("child_process");
36594
36615
  var crossSpawn = require_cross_spawn();
36595
36616
  var stripFinalNewline = require_strip_final_newline();
@@ -36631,7 +36652,7 @@ var require_execa = __commonJS({
36631
36652
  };
36632
36653
  options.env = getEnv(options);
36633
36654
  options.stdio = normalizeStdio(options);
36634
- if (process.platform === "win32" && path2.basename(file, ".exe") === "cmd") {
36655
+ if (process.platform === "win32" && path3.basename(file, ".exe") === "cmd") {
36635
36656
  args.unshift("/q");
36636
36657
  }
36637
36658
  return { file, args, options, parsed };
@@ -38077,10 +38098,10 @@ var require_util = __commonJS({
38077
38098
  function cloneDef(schema) {
38078
38099
  return mergeDefs(schema._zod.def);
38079
38100
  }
38080
- function getElementAtPath(obj, path2) {
38081
- if (!path2)
38101
+ function getElementAtPath(obj, path3) {
38102
+ if (!path3)
38082
38103
  return obj;
38083
- return path2.reduce((acc, key) => acc?.[key], obj);
38104
+ return path3.reduce((acc, key) => acc?.[key], obj);
38084
38105
  }
38085
38106
  function promiseAllObject(promisesObj) {
38086
38107
  const keys = Object.keys(promisesObj);
@@ -38442,11 +38463,11 @@ var require_util = __commonJS({
38442
38463
  }
38443
38464
  return false;
38444
38465
  }
38445
- function prefixIssues(path2, issues) {
38466
+ function prefixIssues(path3, issues) {
38446
38467
  return issues.map((iss) => {
38447
38468
  var _a;
38448
38469
  (_a = iss).path ?? (_a.path = []);
38449
- iss.path.unshift(path2);
38470
+ iss.path.unshift(path3);
38450
38471
  return iss;
38451
38472
  });
38452
38473
  }
@@ -38656,7 +38677,7 @@ var require_errors2 = __commonJS({
38656
38677
  return issue.message;
38657
38678
  };
38658
38679
  const result = { errors: [] };
38659
- const processError = (error2, path2 = []) => {
38680
+ const processError = (error2, path3 = []) => {
38660
38681
  var _a, _b;
38661
38682
  for (const issue of error2.issues) {
38662
38683
  if (issue.code === "invalid_union" && issue.errors.length) {
@@ -38666,7 +38687,7 @@ var require_errors2 = __commonJS({
38666
38687
  } else if (issue.code === "invalid_element") {
38667
38688
  processError({ issues: issue.issues }, issue.path);
38668
38689
  } else {
38669
- const fullpath = [...path2, ...issue.path];
38690
+ const fullpath = [...path3, ...issue.path];
38670
38691
  if (fullpath.length === 0) {
38671
38692
  result.errors.push(mapper(issue));
38672
38693
  continue;
@@ -38698,8 +38719,8 @@ var require_errors2 = __commonJS({
38698
38719
  }
38699
38720
  function toDotPath(_path) {
38700
38721
  const segs = [];
38701
- const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
38702
- for (const seg of path2) {
38722
+ const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
38723
+ for (const seg of path3) {
38703
38724
  if (typeof seg === "number")
38704
38725
  segs.push(`[${seg}]`);
38705
38726
  else if (typeof seg === "symbol")
@@ -52543,27 +52564,27 @@ var require_schema = __commonJS({
52543
52564
  var require_lib5 = __commonJS({
52544
52565
  "../../node_modules/os-paths/src/lib/index.js"(exports2, module2) {
52545
52566
  "use strict";
52546
- var os3 = require("os");
52567
+ var os4 = require("os");
52547
52568
  var paths = require("path");
52548
52569
  var isWinOS = /^win/i.test(process.platform);
52549
- function normalize_path(path2) {
52550
- return paths.normalize(paths.join(path2, "."));
52570
+ function normalize_path(path3) {
52571
+ return paths.normalize(paths.join(path3, "."));
52551
52572
  }
52552
52573
  var base = () => {
52553
52574
  const { env } = process;
52554
52575
  const object = {};
52555
- object.home = () => normalize_path(os3.homedir ? os3.homedir() : env.HOME);
52556
- object.temp = () => normalize_path(os3.tmpdir ? os3.tmpdir() : env.TMPDIR || env.TEMP || env.TMP);
52576
+ object.home = () => normalize_path(os4.homedir ? os4.homedir() : env.HOME);
52577
+ object.temp = () => normalize_path(os4.tmpdir ? os4.tmpdir() : env.TMPDIR || env.TEMP || env.TMP);
52557
52578
  return object;
52558
52579
  };
52559
52580
  var windows = () => {
52560
52581
  const { env } = process;
52561
52582
  const object = {};
52562
52583
  object.home = () => normalize_path(
52563
- os3.homedir ? os3.homedir() : env.USERPROFILE || paths.join(env.HOMEDRIVE, env.HOMEPATH) || env.HOME
52584
+ os4.homedir ? os4.homedir() : env.USERPROFILE || paths.join(env.HOMEDRIVE, env.HOMEPATH) || env.HOME
52564
52585
  );
52565
52586
  object.temp = () => normalize_path(
52566
- os3.tmpdir ? os3.tmpdir() : env.TEMP || env.TMP || paths.join(env.LOCALAPPDATA || env.SystemRoot || env.windir, "Temp")
52587
+ os4.tmpdir ? os4.tmpdir() : env.TEMP || env.TMP || paths.join(env.LOCALAPPDATA || env.SystemRoot || env.windir, "Temp")
52567
52588
  );
52568
52589
  return object;
52569
52590
  };
@@ -52588,44 +52609,44 @@ var require_lib5 = __commonJS({
52588
52609
  var require_lib6 = __commonJS({
52589
52610
  "../../node_modules/xdg-portable/src/lib/index.js"(exports2, module2) {
52590
52611
  "use strict";
52591
- var path2 = require("path");
52612
+ var path3 = require("path");
52592
52613
  var osPaths = require_lib5();
52593
52614
  var linux = () => {
52594
52615
  const object = {};
52595
- object.cache = () => process.env.XDG_CACHE_HOME || path2.join(osPaths.home() || osPaths.temp(), ".cache");
52596
- object.config = () => process.env.XDG_CONFIG_HOME || path2.join(osPaths.home() || osPaths.temp(), ".config");
52597
- object.data = () => process.env.XDG_DATA_HOME || path2.join(osPaths.home() || osPaths.temp(), ".local", "share");
52616
+ object.cache = () => process.env.XDG_CACHE_HOME || path3.join(osPaths.home() || osPaths.temp(), ".cache");
52617
+ object.config = () => process.env.XDG_CONFIG_HOME || path3.join(osPaths.home() || osPaths.temp(), ".config");
52618
+ object.data = () => process.env.XDG_DATA_HOME || path3.join(osPaths.home() || osPaths.temp(), ".local", "share");
52598
52619
  object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
52599
- object.state = () => process.env.XDG_STATE_HOME || path2.join(osPaths.home() || osPaths.temp(), ".local", "state");
52620
+ object.state = () => process.env.XDG_STATE_HOME || path3.join(osPaths.home() || osPaths.temp(), ".local", "state");
52600
52621
  return object;
52601
52622
  };
52602
52623
  var macos = () => {
52603
52624
  const object = {};
52604
- object.cache = () => process.env.XDG_CACHE_HOME || path2.join(path2.join(osPaths.home() || osPaths.temp(), "Library"), "Caches");
52605
- object.config = () => process.env.XDG_CONFIG_HOME || path2.join(path2.join(osPaths.home() || osPaths.temp(), "Library"), "Preferences");
52606
- object.data = () => process.env.XDG_DATA_HOME || path2.join(path2.join(osPaths.home() || osPaths.temp(), "Library"), "Application Support");
52625
+ object.cache = () => process.env.XDG_CACHE_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Caches");
52626
+ object.config = () => process.env.XDG_CONFIG_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Preferences");
52627
+ object.data = () => process.env.XDG_DATA_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "Application Support");
52607
52628
  object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
52608
- object.state = () => process.env.XDG_STATE_HOME || path2.join(path2.join(osPaths.home() || osPaths.temp(), "Library"), "State");
52629
+ object.state = () => process.env.XDG_STATE_HOME || path3.join(path3.join(osPaths.home() || osPaths.temp(), "Library"), "State");
52609
52630
  return object;
52610
52631
  };
52611
52632
  var windows = () => {
52612
52633
  const object = {};
52613
52634
  object.cache = () => {
52614
- const localAppData = process.env.LOCALAPPDATA || path2.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
52615
- return process.env.XDG_CACHE_HOME || path2.join(localAppData, "xdg.cache");
52635
+ const localAppData = process.env.LOCALAPPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
52636
+ return process.env.XDG_CACHE_HOME || path3.join(localAppData, "xdg.cache");
52616
52637
  };
52617
52638
  object.config = () => {
52618
- const appData = process.env.APPDATA || path2.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
52619
- return process.env.XDG_CONFIG_HOME || path2.join(appData, "xdg.config");
52639
+ const appData = process.env.APPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
52640
+ return process.env.XDG_CONFIG_HOME || path3.join(appData, "xdg.config");
52620
52641
  };
52621
52642
  object.data = () => {
52622
- const appData = process.env.APPDATA || path2.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
52623
- return process.env.XDG_DATA_HOME || path2.join(appData, "xdg.data");
52643
+ const appData = process.env.APPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Roaming");
52644
+ return process.env.XDG_DATA_HOME || path3.join(appData, "xdg.data");
52624
52645
  };
52625
52646
  object.runtime = () => process.env.XDG_RUNTIME_DIR || void 0;
52626
52647
  object.state = () => {
52627
- const localAppData = process.env.LOCALAPPDATA || path2.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
52628
- return process.env.XDG_STATE_HOME || path2.join(localAppData, "xdg.state");
52648
+ const localAppData = process.env.LOCALAPPDATA || path3.join(osPaths.home() || osPaths.temp(), "AppData", "Local");
52649
+ return process.env.XDG_STATE_HOME || path3.join(localAppData, "xdg.state");
52629
52650
  };
52630
52651
  return object;
52631
52652
  };
@@ -52645,7 +52666,7 @@ var require_lib6 = __commonJS({
52645
52666
  const dirs = [];
52646
52667
  dirs.push(extension.config());
52647
52668
  if (process.env.XDG_CONFIG_DIRS) {
52648
- dirs.push(...process.env.XDG_CONFIG_DIRS.split(path2.delimiter));
52669
+ dirs.push(...process.env.XDG_CONFIG_DIRS.split(path3.delimiter));
52649
52670
  }
52650
52671
  return dirs;
52651
52672
  };
@@ -52653,7 +52674,7 @@ var require_lib6 = __commonJS({
52653
52674
  const dirs = [];
52654
52675
  dirs.push(extension.data());
52655
52676
  if (process.env.XDG_DATA_DIRS) {
52656
- dirs.push(...process.env.XDG_DATA_DIRS.split(path2.delimiter));
52677
+ dirs.push(...process.env.XDG_DATA_DIRS.split(path3.delimiter));
52657
52678
  }
52658
52679
  return dirs;
52659
52680
  };
@@ -52670,7 +52691,7 @@ var require_lib6 = __commonJS({
52670
52691
  var require_lib7 = __commonJS({
52671
52692
  "../../node_modules/xdg-app-paths/src/lib/index.js"(exports2, module2) {
52672
52693
  "use strict";
52673
- var path2 = require("path");
52694
+ var path3 = require("path");
52674
52695
  var xdg = require_lib6();
52675
52696
  function normalizeOptions_(options, isolated) {
52676
52697
  if (!isObject(options)) {
@@ -52722,38 +52743,38 @@ var require_lib7 = __commonJS({
52722
52743
  throw new TypeError(`Expected string for "name" argument, got ${typeOf(name_)}`);
52723
52744
  }
52724
52745
  if (!name_) {
52725
- name_ = path2.parse(require.main && require.main.filename || process.execPath).name;
52746
+ name_ = path3.parse(require.main && require.main.filename || process.execPath).name;
52726
52747
  }
52727
52748
  name_ += suffix_ || "";
52728
52749
  XDGAppPaths.$name = () => name_;
52729
52750
  XDGAppPaths.$isolated = () => isolated_;
52730
52751
  XDGAppPaths.cache = (dirOptions = null) => {
52731
52752
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52732
- return path2.join(xdg.cache(), dirOptions.isolated ? name_ : "");
52753
+ return path3.join(xdg.cache(), dirOptions.isolated ? name_ : "");
52733
52754
  };
52734
52755
  XDGAppPaths.config = function(dirOptions = null) {
52735
52756
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52736
- return path2.join(xdg.config(), dirOptions.isolated ? name_ : "");
52757
+ return path3.join(xdg.config(), dirOptions.isolated ? name_ : "");
52737
52758
  };
52738
52759
  XDGAppPaths.data = function(dirOptions = null) {
52739
52760
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52740
- return path2.join(xdg.data(), dirOptions.isolated ? name_ : "");
52761
+ return path3.join(xdg.data(), dirOptions.isolated ? name_ : "");
52741
52762
  };
52742
52763
  XDGAppPaths.runtime = function(dirOptions = null) {
52743
52764
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52744
- return xdg.runtime() ? path2.join(xdg.runtime(), dirOptions.isolated ? name_ : "") : void 0;
52765
+ return xdg.runtime() ? path3.join(xdg.runtime(), dirOptions.isolated ? name_ : "") : void 0;
52745
52766
  };
52746
52767
  XDGAppPaths.state = function(dirOptions = null) {
52747
52768
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52748
- return path2.join(xdg.state(), dirOptions.isolated ? name_ : "");
52769
+ return path3.join(xdg.state(), dirOptions.isolated ? name_ : "");
52749
52770
  };
52750
52771
  XDGAppPaths.configDirs = function(dirOptions = null) {
52751
52772
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52752
- return xdg.configDirs().map((s) => path2.join(s, dirOptions.isolated ? name_ : ""));
52773
+ return xdg.configDirs().map((s) => path3.join(s, dirOptions.isolated ? name_ : ""));
52753
52774
  };
52754
52775
  XDGAppPaths.dataDirs = function(dirOptions = null) {
52755
52776
  dirOptions = normalizeOptions_(dirOptions, isolated_);
52756
- return xdg.dataDirs().map((s) => path2.join(s, dirOptions.isolated ? name_ : ""));
52777
+ return xdg.dataDirs().map((s) => path3.join(s, dirOptions.isolated ? name_ : ""));
52757
52778
  };
52758
52779
  this.fn = XDGAppPaths;
52759
52780
  }
@@ -53074,19 +53095,19 @@ var require_token_io = __commonJS({
53074
53095
  getUserDataDir: () => getUserDataDir
53075
53096
  });
53076
53097
  module2.exports = __toCommonJS(token_io_exports);
53077
- var import_path2 = __toESM2(require("path"));
53078
- var import_fs2 = __toESM2(require("fs"));
53079
- var import_os3 = __toESM2(require("os"));
53098
+ var import_path3 = __toESM2(require("path"));
53099
+ var import_fs3 = __toESM2(require("fs"));
53100
+ var import_os4 = __toESM2(require("os"));
53080
53101
  var import_token_error = require_token_error();
53081
53102
  function findRootDir() {
53082
53103
  try {
53083
53104
  let dir = process.cwd();
53084
- while (dir !== import_path2.default.dirname(dir)) {
53085
- const pkgPath = import_path2.default.join(dir, ".vercel");
53086
- if (import_fs2.default.existsSync(pkgPath)) {
53105
+ while (dir !== import_path3.default.dirname(dir)) {
53106
+ const pkgPath = import_path3.default.join(dir, ".vercel");
53107
+ if (import_fs3.default.existsSync(pkgPath)) {
53087
53108
  return dir;
53088
53109
  }
53089
- dir = import_path2.default.dirname(dir);
53110
+ dir = import_path3.default.dirname(dir);
53090
53111
  }
53091
53112
  } catch (_e) {
53092
53113
  throw new import_token_error.VercelOidcTokenError(
@@ -53099,11 +53120,11 @@ var require_token_io = __commonJS({
53099
53120
  if (process.env.XDG_DATA_HOME) {
53100
53121
  return process.env.XDG_DATA_HOME;
53101
53122
  }
53102
- switch (import_os3.default.platform()) {
53123
+ switch (import_os4.default.platform()) {
53103
53124
  case "darwin":
53104
- return import_path2.default.join(import_os3.default.homedir(), "Library/Application Support");
53125
+ return import_path3.default.join(import_os4.default.homedir(), "Library/Application Support");
53105
53126
  case "linux":
53106
- return import_path2.default.join(import_os3.default.homedir(), ".local/share");
53127
+ return import_path3.default.join(import_os4.default.homedir(), ".local/share");
53107
53128
  case "win32":
53108
53129
  if (process.env.LOCALAPPDATA) {
53109
53130
  return process.env.LOCALAPPDATA;
@@ -53143,10 +53164,10 @@ var require_oauth = __commonJS({
53143
53164
  refreshTokenRequest: () => refreshTokenRequest
53144
53165
  });
53145
53166
  module2.exports = __toCommonJS(oauth_exports);
53146
- var import_os3 = require("os");
53167
+ var import_os4 = require("os");
53147
53168
  var VERCEL_ISSUER = "https://vercel.com";
53148
53169
  var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
53149
- var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os3.platform)()} (${(0, import_os3.arch)()}) ${(0, import_os3.hostname)()}`;
53170
+ var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os4.platform)()} (${(0, import_os4.arch)()}) ${(0, import_os4.hostname)()}`;
53150
53171
  var _tokenEndpoint = null;
53151
53172
  async function getTokenEndpoint() {
53152
53173
  if (_tokenEndpoint) {
@@ -53296,8 +53317,8 @@ var require_token_util = __commonJS({
53296
53317
  saveToken: () => saveToken
53297
53318
  });
53298
53319
  module2.exports = __toCommonJS(token_util_exports);
53299
- var path2 = __toESM2(require("path"));
53300
- var fs2 = __toESM2(require("fs"));
53320
+ var path3 = __toESM2(require("path"));
53321
+ var fs3 = __toESM2(require("fs"));
53301
53322
  var import_cli_exec = require_dist2();
53302
53323
  var import_cli_config = require_dist3();
53303
53324
  var import_token_error = require_token_error();
@@ -53421,13 +53442,13 @@ ${stderr}`.trim();
53421
53442
  "Unable to find project root directory. Have you linked your project with `vc link?`"
53422
53443
  );
53423
53444
  }
53424
- const prjPath = path2.join(dir, ".vercel", "project.json");
53425
- if (!fs2.existsSync(prjPath)) {
53445
+ const prjPath = path3.join(dir, ".vercel", "project.json");
53446
+ if (!fs3.existsSync(prjPath)) {
53426
53447
  throw new import_token_error.VercelOidcTokenError(
53427
53448
  "project.json not found, have you linked your project with `vc link?`"
53428
53449
  );
53429
53450
  }
53430
- const prj = JSON.parse(fs2.readFileSync(prjPath, "utf8"));
53451
+ const prj = JSON.parse(fs3.readFileSync(prjPath, "utf8"));
53431
53452
  if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") {
53432
53453
  throw new TypeError(
53433
53454
  "Expected a string-valued projectId property. Try running `vc link` to re-link your project."
@@ -53442,11 +53463,11 @@ ${stderr}`.trim();
53442
53463
  "Unable to find user data directory. Please reach out to Vercel support."
53443
53464
  );
53444
53465
  }
53445
- const tokenPath = path2.join(dir, "com.vercel.token", `${projectId}.json`);
53466
+ const tokenPath = path3.join(dir, "com.vercel.token", `${projectId}.json`);
53446
53467
  const tokenJson = JSON.stringify(token);
53447
- fs2.mkdirSync(path2.dirname(tokenPath), { mode: 504, recursive: true });
53448
- fs2.writeFileSync(tokenPath, tokenJson);
53449
- fs2.chmodSync(tokenPath, 432);
53468
+ fs3.mkdirSync(path3.dirname(tokenPath), { mode: 504, recursive: true });
53469
+ fs3.writeFileSync(tokenPath, tokenJson);
53470
+ fs3.chmodSync(tokenPath, 432);
53450
53471
  return;
53451
53472
  }
53452
53473
  function loadToken(projectId) {
@@ -53456,11 +53477,11 @@ ${stderr}`.trim();
53456
53477
  "Unable to find user data directory. Please reach out to Vercel support."
53457
53478
  );
53458
53479
  }
53459
- const tokenPath = path2.join(dir, "com.vercel.token", `${projectId}.json`);
53460
- if (!fs2.existsSync(tokenPath)) {
53480
+ const tokenPath = path3.join(dir, "com.vercel.token", `${projectId}.json`);
53481
+ if (!fs3.existsSync(tokenPath)) {
53461
53482
  return null;
53462
53483
  }
53463
- const token = JSON.parse(fs2.readFileSync(tokenPath, "utf8"));
53484
+ const token = JSON.parse(fs3.readFileSync(tokenPath, "utf8"));
53464
53485
  assertVercelOidcTokenResponse(token);
53465
53486
  return token;
53466
53487
  }
@@ -59280,14 +59301,14 @@ var require_util2 = __commonJS({
59280
59301
  }
59281
59302
  const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
59282
59303
  let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
59283
- let path2 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
59304
+ let path3 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
59284
59305
  if (origin[origin.length - 1] === "/") {
59285
59306
  origin = origin.slice(0, origin.length - 1);
59286
59307
  }
59287
- if (path2 && path2[0] !== "/") {
59288
- path2 = `/${path2}`;
59308
+ if (path3 && path3[0] !== "/") {
59309
+ path3 = `/${path3}`;
59289
59310
  }
59290
- return new URL(`${origin}${path2}`);
59311
+ return new URL(`${origin}${path3}`);
59291
59312
  }
59292
59313
  if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
59293
59314
  throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
@@ -59738,39 +59759,39 @@ var require_diagnostics = __commonJS({
59738
59759
  });
59739
59760
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
59740
59761
  const {
59741
- request: { method, path: path2, origin }
59762
+ request: { method, path: path3, origin }
59742
59763
  } = evt;
59743
- debuglog("sending request to %s %s/%s", method, origin, path2);
59764
+ debuglog("sending request to %s %s/%s", method, origin, path3);
59744
59765
  });
59745
59766
  diagnosticsChannel.channel("undici:request:headers").subscribe((evt) => {
59746
59767
  const {
59747
- request: { method, path: path2, origin },
59768
+ request: { method, path: path3, origin },
59748
59769
  response: { statusCode }
59749
59770
  } = evt;
59750
59771
  debuglog(
59751
59772
  "received response to %s %s/%s - HTTP %d",
59752
59773
  method,
59753
59774
  origin,
59754
- path2,
59775
+ path3,
59755
59776
  statusCode
59756
59777
  );
59757
59778
  });
59758
59779
  diagnosticsChannel.channel("undici:request:trailers").subscribe((evt) => {
59759
59780
  const {
59760
- request: { method, path: path2, origin }
59781
+ request: { method, path: path3, origin }
59761
59782
  } = evt;
59762
- debuglog("trailers received from %s %s/%s", method, origin, path2);
59783
+ debuglog("trailers received from %s %s/%s", method, origin, path3);
59763
59784
  });
59764
59785
  diagnosticsChannel.channel("undici:request:error").subscribe((evt) => {
59765
59786
  const {
59766
- request: { method, path: path2, origin },
59787
+ request: { method, path: path3, origin },
59767
59788
  error
59768
59789
  } = evt;
59769
59790
  debuglog(
59770
59791
  "request to %s %s/%s errored - %s",
59771
59792
  method,
59772
59793
  origin,
59773
- path2,
59794
+ path3,
59774
59795
  error.message
59775
59796
  );
59776
59797
  });
@@ -59819,9 +59840,9 @@ var require_diagnostics = __commonJS({
59819
59840
  });
59820
59841
  diagnosticsChannel.channel("undici:client:sendHeaders").subscribe((evt) => {
59821
59842
  const {
59822
- request: { method, path: path2, origin }
59843
+ request: { method, path: path3, origin }
59823
59844
  } = evt;
59824
- debuglog("sending request to %s %s/%s", method, origin, path2);
59845
+ debuglog("sending request to %s %s/%s", method, origin, path3);
59825
59846
  });
59826
59847
  }
59827
59848
  diagnosticsChannel.channel("undici:websocket:open").subscribe((evt) => {
@@ -59884,7 +59905,7 @@ var require_request = __commonJS({
59884
59905
  var kHandler = Symbol("handler");
59885
59906
  var Request2 = class {
59886
59907
  constructor(origin, {
59887
- path: path2,
59908
+ path: path3,
59888
59909
  method,
59889
59910
  body,
59890
59911
  headers,
@@ -59899,11 +59920,11 @@ var require_request = __commonJS({
59899
59920
  expectContinue,
59900
59921
  servername
59901
59922
  }, handler) {
59902
- if (typeof path2 !== "string") {
59923
+ if (typeof path3 !== "string") {
59903
59924
  throw new InvalidArgumentError("path must be a string");
59904
- } else if (path2[0] !== "/" && !(path2.startsWith("http://") || path2.startsWith("https://")) && method !== "CONNECT") {
59925
+ } else if (path3[0] !== "/" && !(path3.startsWith("http://") || path3.startsWith("https://")) && method !== "CONNECT") {
59905
59926
  throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
59906
- } else if (invalidPathRegex.test(path2)) {
59927
+ } else if (invalidPathRegex.test(path3)) {
59907
59928
  throw new InvalidArgumentError("invalid request path");
59908
59929
  }
59909
59930
  if (typeof method !== "string") {
@@ -59969,7 +59990,7 @@ var require_request = __commonJS({
59969
59990
  this.completed = false;
59970
59991
  this.aborted = false;
59971
59992
  this.upgrade = upgrade || null;
59972
- this.path = query ? buildURL(path2, query) : path2;
59993
+ this.path = query ? buildURL(path3, query) : path3;
59973
59994
  this.origin = origin;
59974
59995
  this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
59975
59996
  this.blocking = blocking == null ? false : blocking;
@@ -64591,7 +64612,7 @@ var require_client_h1 = __commonJS({
64591
64612
  return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
64592
64613
  }
64593
64614
  function writeH1(client, request) {
64594
- const { method, path: path2, host, upgrade, blocking, reset } = request;
64615
+ const { method, path: path3, host, upgrade, blocking, reset } = request;
64595
64616
  let { body, headers, contentLength } = request;
64596
64617
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
64597
64618
  if (util.isFormDataLike(body)) {
@@ -64658,7 +64679,7 @@ var require_client_h1 = __commonJS({
64658
64679
  if (blocking) {
64659
64680
  socket[kBlocking] = true;
64660
64681
  }
64661
- let header = `${method} ${path2} HTTP/1.1\r
64682
+ let header = `${method} ${path3} HTTP/1.1\r
64662
64683
  `;
64663
64684
  if (typeof host === "string") {
64664
64685
  header += `host: ${host}\r
@@ -65184,7 +65205,7 @@ var require_client_h2 = __commonJS({
65184
65205
  }
65185
65206
  function writeH2(client, request) {
65186
65207
  const session = client[kHTTP2Session];
65187
- const { method, path: path2, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
65208
+ const { method, path: path3, host, upgrade, expectContinue, signal, headers: reqHeaders } = request;
65188
65209
  let { body } = request;
65189
65210
  if (upgrade) {
65190
65211
  util.errorRequest(client, request, new Error("Upgrade not supported for H2"));
@@ -65251,7 +65272,7 @@ var require_client_h2 = __commonJS({
65251
65272
  });
65252
65273
  return true;
65253
65274
  }
65254
- headers[HTTP2_HEADER_PATH] = path2;
65275
+ headers[HTTP2_HEADER_PATH] = path3;
65255
65276
  headers[HTTP2_HEADER_SCHEME] = "https";
65256
65277
  const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
65257
65278
  if (body && typeof body.read === "function") {
@@ -65604,9 +65625,9 @@ var require_redirect_handler = __commonJS({
65604
65625
  return this.handler.onHeaders(statusCode, headers, resume, statusText);
65605
65626
  }
65606
65627
  const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
65607
- const path2 = search ? `${pathname}${search}` : pathname;
65628
+ const path3 = search ? `${pathname}${search}` : pathname;
65608
65629
  this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
65609
- this.opts.path = path2;
65630
+ this.opts.path = path3;
65610
65631
  this.opts.origin = origin;
65611
65632
  this.opts.maxRedirections = 0;
65612
65633
  this.opts.query = null;
@@ -66841,10 +66862,10 @@ var require_proxy_agent = __commonJS({
66841
66862
  };
66842
66863
  const {
66843
66864
  origin,
66844
- path: path2 = "/",
66865
+ path: path3 = "/",
66845
66866
  headers = {}
66846
66867
  } = opts;
66847
- opts.path = origin + path2;
66868
+ opts.path = origin + path3;
66848
66869
  if (!("host" in headers) && !("Host" in headers)) {
66849
66870
  const { host } = new URL2(origin);
66850
66871
  headers.host = host;
@@ -68765,20 +68786,20 @@ var require_mock_utils = __commonJS({
68765
68786
  }
68766
68787
  return true;
68767
68788
  }
68768
- function safeUrl(path2) {
68769
- if (typeof path2 !== "string") {
68770
- return path2;
68789
+ function safeUrl(path3) {
68790
+ if (typeof path3 !== "string") {
68791
+ return path3;
68771
68792
  }
68772
- const pathSegments = path2.split("?");
68793
+ const pathSegments = path3.split("?");
68773
68794
  if (pathSegments.length !== 2) {
68774
- return path2;
68795
+ return path3;
68775
68796
  }
68776
68797
  const qp = new URLSearchParams(pathSegments.pop());
68777
68798
  qp.sort();
68778
68799
  return [...pathSegments, qp.toString()].join("?");
68779
68800
  }
68780
- function matchKey(mockDispatch2, { path: path2, method, body, headers }) {
68781
- const pathMatch = matchValue(mockDispatch2.path, path2);
68801
+ function matchKey(mockDispatch2, { path: path3, method, body, headers }) {
68802
+ const pathMatch = matchValue(mockDispatch2.path, path3);
68782
68803
  const methodMatch = matchValue(mockDispatch2.method, method);
68783
68804
  const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
68784
68805
  const headersMatch = matchHeaders(mockDispatch2, headers);
@@ -68800,7 +68821,7 @@ var require_mock_utils = __commonJS({
68800
68821
  function getMockDispatch(mockDispatches, key) {
68801
68822
  const basePath = key.query ? buildURL(key.path, key.query) : key.path;
68802
68823
  const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
68803
- let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path2 }) => matchValue(safeUrl(path2), resolvedPath));
68824
+ let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path3 }) => matchValue(safeUrl(path3), resolvedPath));
68804
68825
  if (matchedMockDispatches.length === 0) {
68805
68826
  throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
68806
68827
  }
@@ -68838,9 +68859,9 @@ var require_mock_utils = __commonJS({
68838
68859
  }
68839
68860
  }
68840
68861
  function buildKey(opts) {
68841
- const { path: path2, method, body, headers, query } = opts;
68862
+ const { path: path3, method, body, headers, query } = opts;
68842
68863
  return {
68843
- path: path2,
68864
+ path: path3,
68844
68865
  method,
68845
68866
  body,
68846
68867
  headers,
@@ -69303,10 +69324,10 @@ var require_pending_interceptors_formatter = __commonJS({
69303
69324
  }
69304
69325
  format(pendingInterceptors) {
69305
69326
  const withPrettyHeaders = pendingInterceptors.map(
69306
- ({ method, path: path2, data: { statusCode }, persist: persist2, times, timesInvoked, origin }) => ({
69327
+ ({ method, path: path3, data: { statusCode }, persist: persist2, times, timesInvoked, origin }) => ({
69307
69328
  Method: method,
69308
69329
  Origin: origin,
69309
- Path: path2,
69330
+ Path: path3,
69310
69331
  "Status code": statusCode,
69311
69332
  Persistent: persist2 ? PERSISTENT : NOT_PERSISTENT,
69312
69333
  Invocations: timesInvoked,
@@ -74187,9 +74208,9 @@ var require_util7 = __commonJS({
74187
74208
  }
74188
74209
  }
74189
74210
  }
74190
- function validateCookiePath(path2) {
74191
- for (let i = 0; i < path2.length; ++i) {
74192
- const code = path2.charCodeAt(i);
74211
+ function validateCookiePath(path3) {
74212
+ for (let i = 0; i < path3.length; ++i) {
74213
+ const code = path3.charCodeAt(i);
74193
74214
  if (code < 32 || // exclude CTLs (0-31)
74194
74215
  code === 127 || // DEL
74195
74216
  code === 59) {
@@ -76882,11 +76903,11 @@ var require_undici = __commonJS({
76882
76903
  if (typeof opts.path !== "string") {
76883
76904
  throw new InvalidArgumentError("invalid opts.path");
76884
76905
  }
76885
- let path2 = opts.path;
76906
+ let path3 = opts.path;
76886
76907
  if (!opts.path.startsWith("/")) {
76887
- path2 = `/${path2}`;
76908
+ path3 = `/${path3}`;
76888
76909
  }
76889
- url = new URL(util.parseOrigin(url).origin + path2);
76910
+ url = new URL(util.parseOrigin(url).origin + path3);
76890
76911
  } else {
76891
76912
  if (!opts) {
76892
76913
  opts = typeof url === "object" ? url : {};
@@ -79465,8 +79486,8 @@ var require_builder = __commonJS({
79465
79486
  var axios_1 = __importDefault(require_axios());
79466
79487
  var runtime_1 = require_runtime();
79467
79488
  var llm_1 = require_llm();
79468
- var fs2 = __importStar(require("fs"));
79469
- var path2 = __importStar(require("path"));
79489
+ var fs3 = __importStar(require("fs"));
79490
+ var path3 = __importStar(require("path"));
79470
79491
  var models_1 = require_models();
79471
79492
  var cms_template_1 = require_cms_template();
79472
79493
  var cms_runtime_1 = require_cms_runtime();
@@ -79535,44 +79556,44 @@ var require_builder = __commonJS({
79535
79556
  return code.replace(pattern, "");
79536
79557
  }
79537
79558
  function snapshotDir(leadId) {
79538
- return path2.join((0, runtime_1.userDataDir)(), "data", "sites", String(leadId));
79559
+ return path3.join((0, runtime_1.userDataDir)(), "data", "sites", String(leadId));
79539
79560
  }
79540
79561
  function saveSnapshot(leadId, files) {
79541
79562
  const dir = snapshotDir(leadId);
79542
79563
  try {
79543
- fs2.mkdirSync(dir, { recursive: true });
79564
+ fs3.mkdirSync(dir, { recursive: true });
79544
79565
  for (const f of files) {
79545
- const target = path2.join(dir, f.file);
79546
- fs2.mkdirSync(path2.dirname(target), { recursive: true });
79566
+ const target = path3.join(dir, f.file);
79567
+ fs3.mkdirSync(path3.dirname(target), { recursive: true });
79547
79568
  if (f.encoding === "base64") {
79548
- fs2.writeFileSync(target, Buffer.from(f.data, "base64"));
79569
+ fs3.writeFileSync(target, Buffer.from(f.data, "base64"));
79549
79570
  } else {
79550
- fs2.writeFileSync(target, f.data, "utf-8");
79571
+ fs3.writeFileSync(target, f.data, "utf-8");
79551
79572
  }
79552
79573
  }
79553
- fs2.writeFileSync(path2.join(dir, ".snapshot.json"), JSON.stringify({ savedAt: Date.now() }));
79574
+ fs3.writeFileSync(path3.join(dir, ".snapshot.json"), JSON.stringify({ savedAt: Date.now() }));
79554
79575
  } catch {
79555
79576
  }
79556
79577
  }
79557
79578
  function loadSnapshot(leadId) {
79558
79579
  const dir = snapshotDir(leadId);
79559
- if (!fs2.existsSync(dir))
79580
+ if (!fs3.existsSync(dir))
79560
79581
  return null;
79561
79582
  const out = [];
79562
79583
  function walk(rel) {
79563
- const abs = path2.join(dir, rel);
79564
- const stat = fs2.statSync(abs);
79584
+ const abs = path3.join(dir, rel);
79585
+ const stat = fs3.statSync(abs);
79565
79586
  if (stat.isDirectory()) {
79566
- for (const child of fs2.readdirSync(abs)) {
79587
+ for (const child of fs3.readdirSync(abs)) {
79567
79588
  if (child.startsWith("."))
79568
79589
  continue;
79569
79590
  walk(rel ? `${rel}/${child}` : child);
79570
79591
  }
79571
79592
  } else if (stat.isFile()) {
79572
79593
  if (/\.(jpg|jpeg|png|gif|webp|avif)$/i.test(rel)) {
79573
- out.push({ file: rel, data: fs2.readFileSync(abs).toString("base64"), encoding: "base64" });
79594
+ out.push({ file: rel, data: fs3.readFileSync(abs).toString("base64"), encoding: "base64" });
79574
79595
  } else {
79575
- out.push({ file: rel, data: fs2.readFileSync(abs, "utf-8"), encoding: "utf-8" });
79596
+ out.push({ file: rel, data: fs3.readFileSync(abs, "utf-8"), encoding: "utf-8" });
79576
79597
  }
79577
79598
  }
79578
79599
  }
@@ -80708,6 +80729,39 @@ var require_lead_search = __commonJS({
80708
80729
  exports2.searchAndSaveLeads = searchAndSaveLeads;
80709
80730
  var db_1 = require_db();
80710
80731
  var places_1 = require_places();
80732
+ var llm_1 = require_llm();
80733
+ async function hasRealWebsite(cand, anthropicKey) {
80734
+ const prompt = `Search the web to determine whether this specific local business has its OWN real, live website (a site they control \u2014 e.g. a .com/.co.uk, Wix, Squarespace, or self-hosted site).
80735
+
80736
+ Business: "${cand.name}"
80737
+ Address: ${cand.address}${cand.city ? `, ${cand.city}` : ""}
80738
+
80739
+ Rules for your judgement:
80740
+ - A Facebook, Instagram, or other social-media page is NOT a website.
80741
+ - A directory listing (Yelp, Yell, TripAdvisor, Google profile, JustEat, Deliveroo, Treatwell, Fresha, etc.) is NOT their own website.
80742
+ - A parked, for-sale, or dead domain with no real content is NOT a live website.
80743
+ - Only answer true if you find a genuine website that clearly belongs to THIS business.
80744
+ - If you are unsure, or can't confirm, answer false.
80745
+
80746
+ Respond with ONLY compact JSON, no prose: {"hasWebsite": boolean, "url": string|null}`;
80747
+ try {
80748
+ const res = await (0, llm_1.generateText)({
80749
+ apiKey: anthropicKey,
80750
+ prompt,
80751
+ allowWebSearch: true,
80752
+ maxTokens: 1024,
80753
+ timeoutMs: 9e4
80754
+ });
80755
+ const raw = res.text.replace(/^```(?:json)?\s*/i, "").replace(/\s*```\s*$/, "").trim();
80756
+ const match = raw.match(/\{[\s\S]*\}/);
80757
+ if (!match)
80758
+ return false;
80759
+ const parsed = JSON.parse(match[0]);
80760
+ return parsed.hasWebsite === true;
80761
+ } catch {
80762
+ return false;
80763
+ }
80764
+ }
80711
80765
  async function searchAndSaveLeads(args) {
80712
80766
  const db2 = (0, db_1.getDb)();
80713
80767
  const results = await (0, places_1.searchPlaces)({
@@ -80719,10 +80773,20 @@ var require_lead_search = __commonJS({
80719
80773
  radiusMeters: args.radiusMeters
80720
80774
  });
80721
80775
  let saved = 0;
80776
+ let verifiedOut = 0;
80722
80777
  for (const r of results) {
80723
80778
  const before = db2.all("SELECT id FROM leads WHERE place_id = ?", [r.place_id]);
80724
80779
  if (before.length > 0)
80725
80780
  continue;
80781
+ if (args.verifyNoWebsite) {
80782
+ args.onProgress?.(`Checking ${r.name} has no website\u2026`);
80783
+ const real = await hasRealWebsite({ name: r.name, address: r.address, city: args.city }, args.anthropicKey);
80784
+ if (real) {
80785
+ verifiedOut++;
80786
+ args.onProgress?.(`${r.name} already has a website \u2014 skipping.`);
80787
+ continue;
80788
+ }
80789
+ }
80726
80790
  db2.run(`INSERT INTO leads
80727
80791
  (place_id, name, type, city, address, phone, website, rating, review_count, lat, lng, score, price_level, business_status, status)
80728
80792
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'discovered')`, [
@@ -80743,7 +80807,7 @@ var require_lead_search = __commonJS({
80743
80807
  ]);
80744
80808
  saved++;
80745
80809
  }
80746
- return { found: results.length, saved };
80810
+ return { found: results.length, saved, verifiedOut };
80747
80811
  }
80748
80812
  }
80749
80813
  });
@@ -80754,7 +80818,7 @@ var require_chat_tools = __commonJS({
80754
80818
  "use strict";
80755
80819
  Object.defineProperty(exports2, "__esModule", { value: true });
80756
80820
  exports2.TOOLS = void 0;
80757
- exports2.runTool = runTool;
80821
+ exports2.runTool = runTool2;
80758
80822
  var db_1 = require_db();
80759
80823
  var runtime_1 = require_runtime();
80760
80824
  var builder_1 = require_builder();
@@ -81054,7 +81118,7 @@ Interested?`;
81054
81118
  }
81055
81119
  return `sms:${e164}?&body=${encodeURIComponent(message)}`;
81056
81120
  }
81057
- async function runTool(name, input, ctx) {
81121
+ async function runTool2(name, input, ctx) {
81058
81122
  const db2 = (0, db_1.getDb)();
81059
81123
  switch (name) {
81060
81124
  case "find_leads": {
@@ -81082,7 +81146,12 @@ Interested?`;
81082
81146
  types: categories,
81083
81147
  maxResults: Math.min(Number(input.maxResults ?? 25), 100),
81084
81148
  center: place ? { lat: place.lat, lng: place.lng } : void 0,
81085
- radiusMeters: Number(input.radiusMeters ?? 3e3)
81149
+ radiusMeters: Number(input.radiusMeters ?? 3e3),
81150
+ // Web-search each candidate to confirm no real website exists before
81151
+ // saving. Skippable via verify:false. Fails open on any error.
81152
+ verifyNoWebsite: input.verify !== false,
81153
+ anthropicKey: getDecryptedSetting("anthropic_key"),
81154
+ onProgress: (msg) => ctx.emitProgress?.({ channel: "leads:searching", payload: { msg } })
81086
81155
  });
81087
81156
  ctx.emitProgress?.({
81088
81157
  channel: "leads:changed",
@@ -82251,7 +82320,7 @@ var require_package = __commonJS({
82251
82320
  "package.json"(exports2, module2) {
82252
82321
  module2.exports = {
82253
82322
  name: "sproutkit-code",
82254
- version: "0.3.0",
82323
+ version: "0.4.0",
82255
82324
  description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
82256
82325
  bin: {
82257
82326
  sproutkit: "./dist/index.js"
@@ -82293,6 +82362,7 @@ var require_package = __commonJS({
82293
82362
  // src/engine.ts
82294
82363
  var db = require_db();
82295
82364
  var chat = require_chat();
82365
+ var chatTools = require_chat_tools();
82296
82366
  var autoMode = require_auto_mode();
82297
82367
  var cms = require_cms_provision();
82298
82368
  var bookingPreset = require_booking_preset();
@@ -82302,6 +82372,7 @@ var llm = require_llm();
82302
82372
  var initDatabase = db.initDatabase;
82303
82373
  var getDb = db.getDb;
82304
82374
  var chatWithTools = chat.chatWithTools;
82375
+ var runTool = chatTools.runTool;
82305
82376
  var startAutoJob = autoMode.startAutoJob;
82306
82377
  var provisionCmsForLead = cms.provisionCmsForLead;
82307
82378
  var generatePreset = bookingPreset.generatePreset;
@@ -82313,6 +82384,8 @@ var getPreferredModel = models.getPreferredModel;
82313
82384
  var checkClaudeCodeAuth = llm.checkClaudeCodeAuth;
82314
82385
  var llmBackend = llm.getBackend;
82315
82386
  var claudeBin = llm.claudeBin;
82387
+ var CLAUDE_CODE_MODELS = llm.CLAUDE_CODE_MODELS;
82388
+ var getClaudeCodeModel = llm.getClaudeCodeModel;
82316
82389
 
82317
82390
  // src/config.ts
82318
82391
  var REQUIRED_KEYS = [
@@ -82504,6 +82577,44 @@ var Status = class {
82504
82577
  }
82505
82578
  };
82506
82579
 
82580
+ // src/skill-install.ts
82581
+ var import_fs = __toESM(require("fs"));
82582
+ var import_path = __toESM(require("path"));
82583
+ var import_os2 = __toESM(require("os"));
82584
+ function bundledSkillDir() {
82585
+ const candidates = [
82586
+ import_path.default.join(__dirname, "skill"),
82587
+ import_path.default.join(__dirname, "..", "dist", "skill"),
82588
+ import_path.default.join(__dirname, "..", "skill")
82589
+ ];
82590
+ for (const c2 of candidates) {
82591
+ if (import_fs.default.existsSync(import_path.default.join(c2, "SKILL.md"))) return c2;
82592
+ }
82593
+ return candidates[0];
82594
+ }
82595
+ function skillTargetDir() {
82596
+ return import_path.default.join(import_os2.default.homedir(), ".claude", "skills", "sproutkit");
82597
+ }
82598
+ function skillInstalled() {
82599
+ return import_fs.default.existsSync(import_path.default.join(skillTargetDir(), "SKILL.md"));
82600
+ }
82601
+ function installSkill() {
82602
+ try {
82603
+ const src = bundledSkillDir();
82604
+ if (!import_fs.default.existsSync(import_path.default.join(src, "SKILL.md"))) {
82605
+ return { ok: false, error: `Skill source not found (looked in ${src}).` };
82606
+ }
82607
+ const dest = skillTargetDir();
82608
+ import_fs.default.mkdirSync(dest, { recursive: true });
82609
+ for (const f of import_fs.default.readdirSync(src)) {
82610
+ import_fs.default.copyFileSync(import_path.default.join(src, f), import_path.default.join(dest, f));
82611
+ }
82612
+ return { ok: true, path: dest };
82613
+ } catch (e) {
82614
+ return { ok: false, error: e.message };
82615
+ }
82616
+ }
82617
+
82507
82618
  // src/onboarding.ts
82508
82619
  var import_child_process = require("child_process");
82509
82620
  function claudeCliPresent() {
@@ -82556,8 +82667,35 @@ async function chooseBackend(force) {
82556
82667
  setBackend("claude_code");
82557
82668
  say(c.green(" \u2713 Using your Claude subscription \u2014 no API key needed for generation."));
82558
82669
  say();
82670
+ await offerSkillInstall(force);
82559
82671
  return "claude_code";
82560
82672
  }
82673
+ async function offerSkillInstall(force) {
82674
+ const already = skillInstalled();
82675
+ say(` ${c.bold("Conversational mode (optional)")}`);
82676
+ say(
82677
+ c.dim(
82678
+ " Install a Claude Code skill so you can just talk to `claude` \u2014 \u201Cfind barbers"
82679
+ )
82680
+ );
82681
+ say(c.dim(" in Leeds and build the best two\u201D \u2014 and it drives Sproutkit for you."));
82682
+ const prompt = already ? c.green(" Skill already installed \u2014 reinstall/update it? [y/N] ") : c.green(" Install it now? [Y/n] ");
82683
+ const ans = (await ask(prompt)).trim().toLowerCase();
82684
+ const wants = already ? ans === "y" || ans === "yes" : ans !== "n" && ans !== "no";
82685
+ if (!wants) {
82686
+ say(c.dim(" Skipped \u2014 you can add it later by re-running 'sproutkit setup'."));
82687
+ say();
82688
+ return;
82689
+ }
82690
+ const res = installSkill();
82691
+ if (res.ok) {
82692
+ say(c.green(` \u2713 Skill installed to ${res.path}`));
82693
+ say(c.dim(" Now run `claude` in any terminal and ask it to find or build leads."));
82694
+ } else {
82695
+ say(c.amber(` Couldn't install the skill: ${res.error}`));
82696
+ }
82697
+ say();
82698
+ }
82561
82699
  async function onboardLicense(force) {
82562
82700
  if (!force) {
82563
82701
  const state = await check();
@@ -82720,9 +82858,9 @@ function makeInvokeIpc(emit) {
82720
82858
  }
82721
82859
 
82722
82860
  // src/sync.ts
82723
- var import_os2 = __toESM(require("os"));
82724
- var import_path = __toESM(require("path"));
82725
- var import_fs = __toESM(require("fs"));
82861
+ var import_os3 = __toESM(require("os"));
82862
+ var import_path2 = __toESM(require("path"));
82863
+ var import_fs2 = __toESM(require("fs"));
82726
82864
  var COLS = [
82727
82865
  "place_id",
82728
82866
  "name",
@@ -82745,18 +82883,18 @@ var COLS = [
82745
82883
  "business_status"
82746
82884
  ];
82747
82885
  function desktopDbPath() {
82748
- const home = import_os2.default.homedir();
82886
+ const home = import_os3.default.homedir();
82749
82887
  const candidates = [];
82750
82888
  if (process.platform === "darwin") {
82751
- candidates.push(import_path.default.join(home, "Library", "Application Support", "Sproutkit", "data", "sproutio.db"));
82889
+ candidates.push(import_path2.default.join(home, "Library", "Application Support", "Sproutkit", "data", "sproutio.db"));
82752
82890
  } else if (process.platform === "win32") {
82753
- const appData = process.env.APPDATA || import_path.default.join(home, "AppData", "Roaming");
82754
- candidates.push(import_path.default.join(appData, "Sproutkit", "data", "sproutio.db"));
82891
+ const appData = process.env.APPDATA || import_path2.default.join(home, "AppData", "Roaming");
82892
+ candidates.push(import_path2.default.join(appData, "Sproutkit", "data", "sproutio.db"));
82755
82893
  } else {
82756
- const cfg = process.env.XDG_CONFIG_HOME || import_path.default.join(home, ".config");
82757
- candidates.push(import_path.default.join(cfg, "Sproutkit", "data", "sproutio.db"));
82894
+ const cfg = process.env.XDG_CONFIG_HOME || import_path2.default.join(home, ".config");
82895
+ candidates.push(import_path2.default.join(cfg, "Sproutkit", "data", "sproutio.db"));
82758
82896
  }
82759
- return candidates.find((p) => import_fs.default.existsSync(p)) ?? null;
82897
+ return candidates.find((p) => import_fs2.default.existsSync(p)) ?? null;
82760
82898
  }
82761
82899
  function syncToDesktop(opts = {}) {
82762
82900
  const dest = desktopDbPath();
@@ -82998,7 +83136,39 @@ async function notifyIfOutdated() {
82998
83136
  }
82999
83137
 
83000
83138
  // src/models-cmd.ts
83139
+ async function runModelsClaudeCode() {
83140
+ const current = getClaudeCodeModel();
83141
+ say();
83142
+ say(c.bold(" Model (Claude subscription):"));
83143
+ say(c.dim(" Uses your Claude Code login \u2014 pick which model builds run on."));
83144
+ CLAUDE_CODE_MODELS.forEach((m, i) => {
83145
+ const active = m.alias === current ? c.green(" \u2190 current") : "";
83146
+ const isDefault = !current && m.alias === "sonnet" ? c.dim(" (CLI default)") : "";
83147
+ say(` ${c.greenBold(String(i + 1).padStart(2))} ${m.label} ${c.dim(m.alias)}${active}${isDefault}`);
83148
+ });
83149
+ say();
83150
+ const pick = await ask(c.green(" Pick a number to switch (or Enter to keep current): "));
83151
+ if (!pick) {
83152
+ say(c.dim(" No change."));
83153
+ return;
83154
+ }
83155
+ const idx = Number(pick) - 1;
83156
+ if (Number.isNaN(idx) || idx < 0 || idx >= CLAUDE_CODE_MODELS.length) {
83157
+ say(c.amber(" Not a valid choice \u2014 no change made."));
83158
+ return;
83159
+ }
83160
+ const chosen = CLAUDE_CODE_MODELS[idx];
83161
+ setSetting("claude_code_model", chosen.alias);
83162
+ say(c.green(` \u2713 Builds will now use ${chosen.alias}.`));
83163
+ if (chosen.alias === "fable") {
83164
+ say(c.dim(" Note: Fable needs 30-day data retention on your Claude account, or it'll error."));
83165
+ }
83166
+ }
83001
83167
  async function runModels() {
83168
+ if (getBackend() === "claude_code") {
83169
+ await runModelsClaudeCode();
83170
+ return;
83171
+ }
83002
83172
  const apiKey = getSetting("anthropic_key");
83003
83173
  if (!apiKey) {
83004
83174
  say(c.red(" No Anthropic key set. Run 'sproutkit setup' first."));
@@ -83038,6 +83208,169 @@ async function runModels() {
83038
83208
  say(c.green(` \u2713 Now using ${models2[idx].display_name ?? models2[idx].id}.`));
83039
83209
  }
83040
83210
 
83211
+ // src/commands.ts
83212
+ function makeCtx(opts) {
83213
+ const emit = (channel, payload) => {
83214
+ if (opts.json) return;
83215
+ const p = payload;
83216
+ if (p?.msg && opts.status) opts.status.update(p.msg);
83217
+ };
83218
+ return {
83219
+ invokeIpc: makeInvokeIpc(emit),
83220
+ emitProgress: (e) => emit(e.channel, e.payload)
83221
+ };
83222
+ }
83223
+ function parseArgs(argv) {
83224
+ const flags = {};
83225
+ const rest = [];
83226
+ for (let i = 0; i < argv.length; i++) {
83227
+ const a = argv[i];
83228
+ if (a.startsWith("--")) {
83229
+ const body = a.slice(2);
83230
+ const eq = body.indexOf("=");
83231
+ if (eq >= 0) {
83232
+ flags[body.slice(0, eq)] = body.slice(eq + 1);
83233
+ } else if (i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
83234
+ flags[body] = argv[++i];
83235
+ } else {
83236
+ flags[body] = true;
83237
+ }
83238
+ } else {
83239
+ rest.push(a);
83240
+ }
83241
+ }
83242
+ return { flags, rest };
83243
+ }
83244
+ function emitJson(v) {
83245
+ process.stdout.write(JSON.stringify(v, null, 2) + "\n");
83246
+ }
83247
+ async function cmdFind(argv) {
83248
+ const { flags, rest } = parseArgs(argv);
83249
+ const json = !!flags.json;
83250
+ const location = String(flags.location ?? rest.join(" ")).trim();
83251
+ if (!location) {
83252
+ const err = 'Usage: sproutkit find "<location>" --categories "barber shop,cafe"';
83253
+ json ? emitJson({ ok: false, error: err }) : say(c.red(" " + err));
83254
+ return;
83255
+ }
83256
+ const categories = String(flags.categories ?? "").split(",").map((s) => s.trim()).filter(Boolean);
83257
+ const status = json ? void 0 : new Status();
83258
+ if (status) status.start(`Finding leads in ${location}`);
83259
+ try {
83260
+ const result = await runTool(
83261
+ "find_leads",
83262
+ {
83263
+ location,
83264
+ categories: categories.length ? categories : [location],
83265
+ maxResults: flags.max ? Number(flags.max) : void 0,
83266
+ radiusMeters: flags.radius ? Number(flags.radius) : void 0
83267
+ },
83268
+ makeCtx({ json, status })
83269
+ );
83270
+ if (status) status.done(true, `Found ${result.found ?? 0}, saved ${result.saved ?? 0} new`);
83271
+ autoSync();
83272
+ if (json) emitJson(result);
83273
+ else if (result.note) say(c.dim(" " + result.note));
83274
+ } catch (e) {
83275
+ if (status) status.done(false, "Find failed");
83276
+ json ? emitJson({ ok: false, error: e.message }) : say(c.red(" " + e.message));
83277
+ process.exitCode = 1;
83278
+ }
83279
+ }
83280
+ async function cmdList(argv) {
83281
+ const { flags } = parseArgs(argv);
83282
+ const json = !!flags.json;
83283
+ const rows = await runTool(
83284
+ "list_leads",
83285
+ {
83286
+ status: flags.status ? String(flags.status) : void 0,
83287
+ city: flags.city ? String(flags.city) : void 0,
83288
+ limit: flags.limit ? Number(flags.limit) : void 0
83289
+ },
83290
+ makeCtx({ json })
83291
+ );
83292
+ if (json) {
83293
+ emitJson(rows);
83294
+ return;
83295
+ }
83296
+ if (rows.length === 0) {
83297
+ say(c.dim(' No leads yet. Try: sproutkit find "barbers in <area>"'));
83298
+ return;
83299
+ }
83300
+ say();
83301
+ for (const r of rows) {
83302
+ const site = r.site_url ? c.dim(` ${r.site_url}`) : "";
83303
+ say(` ${c.greenBold("#" + r.id)} ${c.bold(r.name)} ${c.dim(`\xB7 ${r.status} \xB7 ${r.type}, ${r.city}`)}${site}`);
83304
+ }
83305
+ say();
83306
+ }
83307
+ async function cmdBuild(argv) {
83308
+ const { flags, rest } = parseArgs(argv);
83309
+ const json = !!flags.json;
83310
+ const id = Number(flags.id ?? rest[0]);
83311
+ if (!id || Number.isNaN(id)) {
83312
+ const err = 'Usage: sproutkit build <leadId> [--instructions "..."] [--cms]';
83313
+ json ? emitJson({ ok: false, error: err }) : say(c.red(" " + err));
83314
+ process.exitCode = 1;
83315
+ return;
83316
+ }
83317
+ const status = json ? void 0 : new Status();
83318
+ if (status) status.start(`Building website for lead #${id}`);
83319
+ try {
83320
+ const result = await runTool(
83321
+ "build_site",
83322
+ {
83323
+ id,
83324
+ instructions: flags.instructions ? String(flags.instructions) : void 0,
83325
+ includeCms: !!flags.cms
83326
+ },
83327
+ makeCtx({ json, status })
83328
+ );
83329
+ if (result && result.ok === false) {
83330
+ if (status) status.done(false, result.error ?? "Build failed");
83331
+ if (json) emitJson(result);
83332
+ process.exitCode = 1;
83333
+ return;
83334
+ }
83335
+ if (status) status.done(true, result.url ? `Live at ${result.url}` : `Built lead #${id}`);
83336
+ autoSync();
83337
+ if (json) emitJson(result);
83338
+ } catch (e) {
83339
+ if (status) status.done(false, "Build failed");
83340
+ json ? emitJson({ ok: false, error: e.message }) : say(c.red(" " + e.message));
83341
+ process.exitCode = 1;
83342
+ }
83343
+ }
83344
+ async function cmdOutreach(argv) {
83345
+ const { flags } = parseArgs(argv);
83346
+ const json = !!flags.json;
83347
+ const ids = String(flags.ids ?? "").split(",").map((s) => Number(s.trim())).filter((n) => !Number.isNaN(n) && n > 0);
83348
+ const result = await runTool(
83349
+ "prepare_outreach",
83350
+ { ids: ids.length ? ids : void 0 },
83351
+ makeCtx({ json })
83352
+ );
83353
+ if (json) {
83354
+ emitJson(result);
83355
+ if (!result.ok) process.exitCode = 1;
83356
+ return;
83357
+ }
83358
+ if (!result.ok) {
83359
+ say(c.red(" " + (result.error ?? "Nothing to send.")));
83360
+ process.exitCode = 1;
83361
+ return;
83362
+ }
83363
+ autoSync();
83364
+ say();
83365
+ say(c.green(` ${result.count} lead${result.count === 1 ? "" : "s"} moved to Contacted (${result.channel}).`));
83366
+ for (const o of result.outreach ?? []) {
83367
+ if (o.url) say(` ${c.greenBold("#" + o.id)} ${c.bold(o.name)} \u2014 open: ${c.dim(o.url)}`);
83368
+ else say(` ${c.greenBold("#" + o.id)} ${c.bold(o.name)} \u2014 ${c.amber("no phone on file")}`);
83369
+ }
83370
+ if (result.noPhone) say(c.dim(` ${result.noPhone} had no phone number and were skipped for messaging.`));
83371
+ say();
83372
+ }
83373
+
83041
83374
  // src/index.ts
83042
83375
  process.env.SPROUTKIT_HEADLESS = "1";
83043
83376
  async function main() {
@@ -83072,19 +83405,42 @@ async function main() {
83072
83405
  closeTty();
83073
83406
  return;
83074
83407
  }
83408
+ if (arg === "find" || arg === "list" || arg === "build" || arg === "outreach") {
83409
+ const subArgs = process.argv.slice(3);
83410
+ const lic2 = await check();
83411
+ if (lic2.status !== "active") {
83412
+ const msg = lic2.status === "offline_grace_expired" ? "Licence check offline and grace expired \u2014 reconnect and retry." : "No active licence. Run 'sproutkit setup' first.";
83413
+ if (subArgs.includes("--json")) process.stdout.write(JSON.stringify({ ok: false, error: msg }) + "\n");
83414
+ else say(c.red(` ${msg}`));
83415
+ closeTty();
83416
+ process.exitCode = 1;
83417
+ return;
83418
+ }
83419
+ if (arg === "find") await cmdFind(subArgs);
83420
+ else if (arg === "list") await cmdList(subArgs);
83421
+ else if (arg === "build") await cmdBuild(subArgs);
83422
+ else await cmdOutreach(subArgs);
83423
+ closeTty();
83424
+ return;
83425
+ }
83075
83426
  if (arg === "--help" || arg === "-h") {
83076
83427
  say();
83077
83428
  say(c.greenBold(" Sproutkit Code"));
83078
83429
  say(" Find leads, build sites and run outreach from your terminal.");
83079
83430
  say();
83080
- say(` ${c.bold("sproutkit")} start the chat`);
83081
- say(` ${c.bold("sproutkit setup")} set or update your keys and licence`);
83082
- say(` ${c.bold("sproutkit models")} list Claude models and pick one`);
83083
- say(` ${c.bold("sproutkit sync")} push your leads into the desktop app`);
83084
- say(` ${c.bold("sproutkit update")} update to the latest version`);
83085
- say(` ${c.bold("sproutkit version")} show the installed version`);
83086
- say(` ${c.bold('sproutkit "..."')} run a single message and exit`);
83431
+ say(` ${c.bold("sproutkit")} start the chat`);
83432
+ say(` ${c.bold('sproutkit find "<area>"')} find leads (--categories "barber shop,cafe")`);
83433
+ say(` ${c.bold("sproutkit list")} list leads (--status, --city, --json)`);
83434
+ say(` ${c.bold("sproutkit build <id>")} build a website (--instructions, --cms)`);
83435
+ say(` ${c.bold("sproutkit outreach")} prep outreach links (--ids 3,5)`);
83436
+ say(` ${c.bold("sproutkit setup")} set or update keys, licence, backend`);
83437
+ say(` ${c.bold("sproutkit models")} list Claude models and pick one`);
83438
+ say(` ${c.bold("sproutkit sync")} push your leads into the desktop app`);
83439
+ say(` ${c.bold("sproutkit update")} update to the latest version`);
83440
+ say(` ${c.bold("sproutkit version")} show the installed version`);
83441
+ say(` ${c.bold('sproutkit "..."')} run a single message and exit`);
83087
83442
  say();
83443
+ say(c.dim(" Add --json to find/list/build/outreach for machine-readable output."));
83088
83444
  say(c.dim(" In chat: type a request, Ctrl+C to quit. Actions that spend money ask y/N first."));
83089
83445
  say();
83090
83446
  closeTty();