anymorph 0.1.1 → 0.2.1

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.
Files changed (3) hide show
  1. package/README.md +85 -0
  2. package/dist/index.js +1211 -781
  3. package/package.json +4 -3
package/dist/index.js CHANGED
@@ -1151,7 +1151,7 @@ var require_command = __commonJS({
1151
1151
  var EventEmitter = __require("node:events").EventEmitter;
1152
1152
  var childProcess2 = __require("node:child_process");
1153
1153
  var path2 = __require("node:path");
1154
- var fs7 = __require("node:fs");
1154
+ var fs6 = __require("node:fs");
1155
1155
  var process16 = __require("node:process");
1156
1156
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1157
1157
  var { CommanderError: CommanderError2 } = require_error();
@@ -2132,7 +2132,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2132
2132
  * @param {string} subcommandName
2133
2133
  */
2134
2134
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
2135
- if (fs7.existsSync(executableFile)) return;
2135
+ if (fs6.existsSync(executableFile)) return;
2136
2136
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
2137
2137
  const executableMissing = `'${executableFile}' does not exist
2138
2138
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
@@ -2151,10 +2151,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
2151
2151
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2152
2152
  function findFile(baseDir, baseName) {
2153
2153
  const localBin = path2.resolve(baseDir, baseName);
2154
- if (fs7.existsSync(localBin)) return localBin;
2154
+ if (fs6.existsSync(localBin)) return localBin;
2155
2155
  if (sourceExt.includes(path2.extname(baseName))) return void 0;
2156
2156
  const foundExt = sourceExt.find(
2157
- (ext) => fs7.existsSync(`${localBin}${ext}`)
2157
+ (ext) => fs6.existsSync(`${localBin}${ext}`)
2158
2158
  );
2159
2159
  if (foundExt) return `${localBin}${foundExt}`;
2160
2160
  return void 0;
@@ -2166,7 +2166,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2166
2166
  if (this._scriptPath) {
2167
2167
  let resolvedScriptPath;
2168
2168
  try {
2169
- resolvedScriptPath = fs7.realpathSync(this._scriptPath);
2169
+ resolvedScriptPath = fs6.realpathSync(this._scriptPath);
2170
2170
  } catch {
2171
2171
  resolvedScriptPath = this._scriptPath;
2172
2172
  }
@@ -3326,9 +3326,9 @@ var require_commander = __commonJS({
3326
3326
  }
3327
3327
  });
3328
3328
 
3329
- // node_modules/.pnpm/ora@8.2.0/node_modules/cli-spinners/spinners.json
3329
+ // node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/spinners.json
3330
3330
  var require_spinners = __commonJS({
3331
- "node_modules/.pnpm/ora@8.2.0/node_modules/cli-spinners/spinners.json"(exports, module) {
3331
+ "node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/spinners.json"(exports, module) {
3332
3332
  module.exports = {
3333
3333
  dots: {
3334
3334
  interval: 80,
@@ -4954,9 +4954,9 @@ var require_spinners = __commonJS({
4954
4954
  }
4955
4955
  });
4956
4956
 
4957
- // node_modules/.pnpm/ora@8.2.0/node_modules/cli-spinners/index.js
4957
+ // node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/index.js
4958
4958
  var require_cli_spinners = __commonJS({
4959
- "node_modules/.pnpm/ora@8.2.0/node_modules/cli-spinners/index.js"(exports, module) {
4959
+ "node_modules/.pnpm/cli-spinners@2.9.2/node_modules/cli-spinners/index.js"(exports, module) {
4960
4960
  "use strict";
4961
4961
  var spinners = Object.assign({}, require_spinners());
4962
4962
  var spinnersList = Object.keys(spinners);
@@ -4971,9 +4971,9 @@ var require_cli_spinners = __commonJS({
4971
4971
  }
4972
4972
  });
4973
4973
 
4974
- // node_modules/.pnpm/node_modules/emoji-regex/index.js
4974
+ // node_modules/.pnpm/emoji-regex@10.6.0/node_modules/emoji-regex/index.js
4975
4975
  var require_emoji_regex = __commonJS({
4976
- "node_modules/.pnpm/node_modules/emoji-regex/index.js"(exports, module) {
4976
+ "node_modules/.pnpm/emoji-regex@10.6.0/node_modules/emoji-regex/index.js"(exports, module) {
4977
4977
  module.exports = () => {
4978
4978
  return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
4979
4979
  };
@@ -5004,21 +5004,21 @@ import path from "node:path";
5004
5004
  import { fileURLToPath } from "node:url";
5005
5005
  import { promisify as promisify5 } from "node:util";
5006
5006
  import childProcess from "node:child_process";
5007
- import fs6, { constants as fsConstants2 } from "node:fs/promises";
5007
+ import fs5, { constants as fsConstants2 } from "node:fs/promises";
5008
5008
 
5009
- // node_modules/.pnpm/open@10.2.0/node_modules/wsl-utils/index.js
5009
+ // node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
5010
5010
  import process3 from "node:process";
5011
5011
  import fs4, { constants as fsConstants } from "node:fs/promises";
5012
5012
 
5013
- // node_modules/.pnpm/node_modules/is-wsl/index.js
5013
+ // node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
5014
5014
  import process2 from "node:process";
5015
5015
  import os from "node:os";
5016
5016
  import fs3 from "node:fs";
5017
5017
 
5018
- // node_modules/.pnpm/node_modules/is-inside-container/index.js
5018
+ // node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
5019
5019
  import fs2 from "node:fs";
5020
5020
 
5021
- // node_modules/.pnpm/node_modules/is-docker/index.js
5021
+ // node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js
5022
5022
  import fs from "node:fs";
5023
5023
  var isDockerCached;
5024
5024
  function hasDockerEnv() {
@@ -5043,7 +5043,7 @@ function isDocker() {
5043
5043
  return isDockerCached;
5044
5044
  }
5045
5045
 
5046
- // node_modules/.pnpm/node_modules/is-inside-container/index.js
5046
+ // node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js
5047
5047
  var cachedResult;
5048
5048
  var hasContainerEnv = () => {
5049
5049
  try {
@@ -5060,7 +5060,7 @@ function isInsideContainer() {
5060
5060
  return cachedResult;
5061
5061
  }
5062
5062
 
5063
- // node_modules/.pnpm/node_modules/is-wsl/index.js
5063
+ // node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js
5064
5064
  var isWsl = () => {
5065
5065
  if (process2.platform !== "linux") {
5066
5066
  return false;
@@ -5084,7 +5084,7 @@ var isWsl = () => {
5084
5084
  };
5085
5085
  var is_wsl_default = process2.env.__IS_WSL_TEST__ ? isWsl : isWsl();
5086
5086
 
5087
- // node_modules/.pnpm/open@10.2.0/node_modules/wsl-utils/index.js
5087
+ // node_modules/.pnpm/wsl-utils@0.1.0/node_modules/wsl-utils/index.js
5088
5088
  var wslDrivesMountPoint = /* @__PURE__ */ (() => {
5089
5089
  const defaultMountPoint = "/mnt/";
5090
5090
  let mountPoint;
@@ -5123,7 +5123,7 @@ var powerShellPath = async () => {
5123
5123
  return `${process3.env.SYSTEMROOT || process3.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
5124
5124
  };
5125
5125
 
5126
- // node_modules/.pnpm/open@10.2.0/node_modules/define-lazy-prop/index.js
5126
+ // node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js
5127
5127
  function defineLazyProperty(object, propertyName, valueGetter) {
5128
5128
  const define = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
5129
5129
  Object.defineProperty(object, propertyName, {
@@ -5141,12 +5141,12 @@ function defineLazyProperty(object, propertyName, valueGetter) {
5141
5141
  return object;
5142
5142
  }
5143
5143
 
5144
- // node_modules/.pnpm/open@10.2.0/node_modules/default-browser/index.js
5144
+ // node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
5145
5145
  import { promisify as promisify4 } from "node:util";
5146
5146
  import process6 from "node:process";
5147
5147
  import { execFile as execFile4 } from "node:child_process";
5148
5148
 
5149
- // node_modules/.pnpm/node_modules/default-browser-id/index.js
5149
+ // node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js
5150
5150
  import { promisify } from "node:util";
5151
5151
  import process4 from "node:process";
5152
5152
  import { execFile } from "node:child_process";
@@ -5164,7 +5164,7 @@ async function defaultBrowserId() {
5164
5164
  return browserId;
5165
5165
  }
5166
5166
 
5167
- // node_modules/.pnpm/node_modules/run-applescript/index.js
5167
+ // node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js
5168
5168
  import process5 from "node:process";
5169
5169
  import { promisify as promisify2 } from "node:util";
5170
5170
  import { execFile as execFile2, execFileSync } from "node:child_process";
@@ -5182,13 +5182,13 @@ async function runAppleScript(script, { humanReadableOutput = true, signal } = {
5182
5182
  return stdout.trim();
5183
5183
  }
5184
5184
 
5185
- // node_modules/.pnpm/node_modules/bundle-name/index.js
5185
+ // node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js
5186
5186
  async function bundleName(bundleId) {
5187
5187
  return runAppleScript(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
5188
5188
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
5189
5189
  }
5190
5190
 
5191
- // node_modules/.pnpm/open@10.2.0/node_modules/default-browser/windows.js
5191
+ // node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js
5192
5192
  import { promisify as promisify3 } from "node:util";
5193
5193
  import { execFile as execFile3 } from "node:child_process";
5194
5194
  var execFileAsync3 = promisify3(execFile3);
@@ -5233,7 +5233,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
5233
5233
  return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
5234
5234
  }
5235
5235
 
5236
- // node_modules/.pnpm/open@10.2.0/node_modules/default-browser/index.js
5236
+ // node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
5237
5237
  var execFileAsync4 = promisify4(execFile4);
5238
5238
  var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
5239
5239
  async function defaultBrowser2() {
@@ -5254,24 +5254,6 @@ async function defaultBrowser2() {
5254
5254
  throw new Error("Only macOS, Linux, and Windows are supported");
5255
5255
  }
5256
5256
 
5257
- // node_modules/.pnpm/open@10.2.0/node_modules/is-inside-container/index.js
5258
- import fs5 from "node:fs";
5259
- var cachedResult2;
5260
- var hasContainerEnv2 = () => {
5261
- try {
5262
- fs5.statSync("/run/.containerenv");
5263
- return true;
5264
- } catch {
5265
- return false;
5266
- }
5267
- };
5268
- function isInsideContainer2() {
5269
- if (cachedResult2 === void 0) {
5270
- cachedResult2 = hasContainerEnv2() || isDocker();
5271
- }
5272
- return cachedResult2;
5273
- }
5274
-
5275
5257
  // node_modules/.pnpm/open@10.2.0/node_modules/open/index.js
5276
5258
  var execFile5 = promisify5(childProcess.execFile);
5277
5259
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -5389,7 +5371,7 @@ var baseOpen = async (options) => {
5389
5371
  if (app) {
5390
5372
  cliArguments.push("-a", app);
5391
5373
  }
5392
- } else if (platform === "win32" || is_wsl_default && !isInsideContainer2() && !app) {
5374
+ } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
5393
5375
  command = await powerShellPath();
5394
5376
  cliArguments.push(
5395
5377
  "-NoProfile",
@@ -5425,7 +5407,7 @@ var baseOpen = async (options) => {
5425
5407
  const isBundled = !__dirname || __dirname === "/";
5426
5408
  let exeLocalXdgOpen = false;
5427
5409
  try {
5428
- await fs6.access(localXdgOpenPath, fsConstants2.X_OK);
5410
+ await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
5429
5411
  exeLocalXdgOpen = true;
5430
5412
  } catch {
5431
5413
  }
@@ -5448,14 +5430,14 @@ var baseOpen = async (options) => {
5448
5430
  }
5449
5431
  const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
5450
5432
  if (options.wait) {
5451
- return new Promise((resolve, reject) => {
5433
+ return new Promise((resolve3, reject) => {
5452
5434
  subprocess.once("error", reject);
5453
5435
  subprocess.once("close", (exitCode) => {
5454
5436
  if (!options.allowNonzeroExitCode && exitCode > 0) {
5455
5437
  reject(new Error(`Exited with code ${exitCode}`));
5456
5438
  return;
5457
5439
  }
5458
- resolve(subprocess);
5440
+ resolve3(subprocess);
5459
5441
  });
5460
5442
  });
5461
5443
  }
@@ -5530,9 +5512,9 @@ defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
5530
5512
  var open_default = open;
5531
5513
 
5532
5514
  // node_modules/.pnpm/ora@8.2.0/node_modules/ora/index.js
5533
- import process14 from "node:process";
5515
+ import process15 from "node:process";
5534
5516
 
5535
- // node_modules/.pnpm/ora@8.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
5517
+ // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
5536
5518
  var ANSI_BACKGROUND_OFFSET = 10;
5537
5519
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
5538
5520
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -5718,7 +5700,7 @@ function assembleStyles() {
5718
5700
  var ansiStyles = assembleStyles();
5719
5701
  var ansi_styles_default = ansiStyles;
5720
5702
 
5721
- // node_modules/.pnpm/ora@8.2.0/node_modules/chalk/source/vendor/supports-color/index.js
5703
+ // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
5722
5704
  import process8 from "node:process";
5723
5705
  import os2 from "node:os";
5724
5706
  import tty from "node:tty";
@@ -5850,7 +5832,7 @@ var supportsColor = {
5850
5832
  };
5851
5833
  var supports_color_default = supportsColor;
5852
5834
 
5853
- // node_modules/.pnpm/ora@8.2.0/node_modules/chalk/source/utilities.js
5835
+ // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
5854
5836
  function stringReplaceAll(string, substring, replacer) {
5855
5837
  let index = string.indexOf(substring);
5856
5838
  if (index === -1) {
@@ -5880,7 +5862,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
5880
5862
  return returnValue;
5881
5863
  }
5882
5864
 
5883
- // node_modules/.pnpm/ora@8.2.0/node_modules/chalk/source/index.js
5865
+ // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
5884
5866
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
5885
5867
  var GENERATOR = Symbol("GENERATOR");
5886
5868
  var STYLER = Symbol("STYLER");
@@ -5900,10 +5882,10 @@ var applyOptions = (object, options = {}) => {
5900
5882
  object.level = options.level === void 0 ? colorLevel : options.level;
5901
5883
  };
5902
5884
  var chalkFactory = (options) => {
5903
- const chalk3 = (...strings) => strings.join(" ");
5904
- applyOptions(chalk3, options);
5905
- Object.setPrototypeOf(chalk3, createChalk.prototype);
5906
- return chalk3;
5885
+ const chalk2 = (...strings) => strings.join(" ");
5886
+ applyOptions(chalk2, options);
5887
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
5888
+ return chalk2;
5907
5889
  };
5908
5890
  function createChalk(options) {
5909
5891
  return chalkFactory(options);
@@ -6027,13 +6009,13 @@ var chalk = createChalk();
6027
6009
  var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
6028
6010
  var source_default = chalk;
6029
6011
 
6030
- // node_modules/.pnpm/ora@8.2.0/node_modules/cli-cursor/index.js
6012
+ // node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
6031
6013
  import process11 from "node:process";
6032
6014
 
6033
- // node_modules/.pnpm/node_modules/restore-cursor/index.js
6015
+ // node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
6034
6016
  import process10 from "node:process";
6035
6017
 
6036
- // node_modules/.pnpm/node_modules/mimic-function/index.js
6018
+ // node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js
6037
6019
  var copyProperty = (to, from, property, ignoreNonConfigurable) => {
6038
6020
  if (property === "length" || property === "prototype") {
6039
6021
  return;
@@ -6079,7 +6061,7 @@ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
6079
6061
  return to;
6080
6062
  }
6081
6063
 
6082
- // node_modules/.pnpm/node_modules/onetime/index.js
6064
+ // node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js
6083
6065
  var calledFunctions = /* @__PURE__ */ new WeakMap();
6084
6066
  var onetime = (function_, options = {}) => {
6085
6067
  if (typeof function_ !== "function") {
@@ -6110,7 +6092,7 @@ onetime.callCount = (function_) => {
6110
6092
  };
6111
6093
  var onetime_default = onetime;
6112
6094
 
6113
- // node_modules/.pnpm/node_modules/signal-exit/dist/mjs/signals.js
6095
+ // node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
6114
6096
  var signals = [];
6115
6097
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
6116
6098
  if (process.platform !== "win32") {
@@ -6134,7 +6116,7 @@ if (process.platform === "linux") {
6134
6116
  signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
6135
6117
  }
6136
6118
 
6137
- // node_modules/.pnpm/node_modules/signal-exit/dist/mjs/index.js
6119
+ // node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
6138
6120
  var processOk = (process16) => !!process16 && typeof process16 === "object" && typeof process16.removeListener === "function" && typeof process16.emit === "function" && typeof process16.reallyExit === "function" && typeof process16.listeners === "function" && typeof process16.kill === "function" && typeof process16.pid === "number" && typeof process16.on === "function";
6139
6121
  var kExitEmitter = Symbol.for("signal-exit emitter");
6140
6122
  var global = globalThis;
@@ -6361,7 +6343,7 @@ var {
6361
6343
  unload
6362
6344
  } = signalExitWrap(processOk(process9) ? new SignalExit(process9) : new SignalExitFallback());
6363
6345
 
6364
- // node_modules/.pnpm/node_modules/restore-cursor/index.js
6346
+ // node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js
6365
6347
  var terminal = process10.stderr.isTTY ? process10.stderr : process10.stdout.isTTY ? process10.stdout : void 0;
6366
6348
  var restoreCursor = terminal ? onetime_default(() => {
6367
6349
  onExit(() => {
@@ -6371,7 +6353,7 @@ var restoreCursor = terminal ? onetime_default(() => {
6371
6353
  };
6372
6354
  var restore_cursor_default = restoreCursor;
6373
6355
 
6374
- // node_modules/.pnpm/ora@8.2.0/node_modules/cli-cursor/index.js
6356
+ // node_modules/.pnpm/cli-cursor@5.0.0/node_modules/cli-cursor/index.js
6375
6357
  var isHidden = false;
6376
6358
  var cliCursor = {};
6377
6359
  cliCursor.show = (writableStream = process11.stderr) => {
@@ -6404,18 +6386,16 @@ var cli_cursor_default = cliCursor;
6404
6386
  // node_modules/.pnpm/ora@8.2.0/node_modules/ora/index.js
6405
6387
  var import_cli_spinners = __toESM(require_cli_spinners(), 1);
6406
6388
 
6407
- // node_modules/.pnpm/ora@8.2.0/node_modules/is-unicode-supported/index.js
6389
+ // node_modules/.pnpm/is-unicode-supported@1.3.0/node_modules/is-unicode-supported/index.js
6408
6390
  import process12 from "node:process";
6409
6391
  function isUnicodeSupported() {
6410
- const { env: env3 } = process12;
6411
- const { TERM, TERM_PROGRAM } = env3;
6412
6392
  if (process12.platform !== "win32") {
6413
- return TERM !== "linux";
6393
+ return process12.env.TERM !== "linux";
6414
6394
  }
6415
- return Boolean(env3.WT_SESSION) || Boolean(env3.TERMINUS_SUBLIME) || env3.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env3.TERMINAL_EMULATOR === "JetBrains-JediTerm";
6395
+ return Boolean(process12.env.CI) || Boolean(process12.env.WT_SESSION) || Boolean(process12.env.TERMINUS_SUBLIME) || process12.env.ConEmuTask === "{cmd::Cmder}" || process12.env.TERM_PROGRAM === "Terminus-Sublime" || process12.env.TERM_PROGRAM === "vscode" || process12.env.TERM === "xterm-256color" || process12.env.TERM === "alacritty" || process12.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
6416
6396
  }
6417
6397
 
6418
- // node_modules/.pnpm/ora@8.2.0/node_modules/log-symbols/index.js
6398
+ // node_modules/.pnpm/log-symbols@6.0.0/node_modules/log-symbols/index.js
6419
6399
  var main = {
6420
6400
  info: source_default.blue("\u2139"),
6421
6401
  success: source_default.green("\u2714"),
@@ -6431,7 +6411,7 @@ var fallback = {
6431
6411
  var logSymbols = isUnicodeSupported() ? main : fallback;
6432
6412
  var log_symbols_default = logSymbols;
6433
6413
 
6434
- // node_modules/.pnpm/node_modules/ansi-regex/index.js
6414
+ // node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
6435
6415
  function ansiRegex({ onlyFirst = false } = {}) {
6436
6416
  const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
6437
6417
  const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
@@ -6440,7 +6420,7 @@ function ansiRegex({ onlyFirst = false } = {}) {
6440
6420
  return new RegExp(pattern, onlyFirst ? void 0 : "g");
6441
6421
  }
6442
6422
 
6443
- // node_modules/.pnpm/ora@8.2.0/node_modules/strip-ansi/index.js
6423
+ // node_modules/.pnpm/strip-ansi@7.2.0/node_modules/strip-ansi/index.js
6444
6424
  var regex = ansiRegex();
6445
6425
  function stripAnsi(string) {
6446
6426
  if (typeof string !== "string") {
@@ -6452,14 +6432,14 @@ function stripAnsi(string) {
6452
6432
  return string.replace(regex, "");
6453
6433
  }
6454
6434
 
6455
- // node_modules/.pnpm/node_modules/get-east-asian-width/lookup-data.js
6435
+ // node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup-data.js
6456
6436
  var ambiguousRanges = [161, 161, 164, 164, 167, 168, 170, 170, 173, 174, 176, 180, 182, 186, 188, 191, 198, 198, 208, 208, 215, 216, 222, 225, 230, 230, 232, 234, 236, 237, 240, 240, 242, 243, 247, 250, 252, 252, 254, 254, 257, 257, 273, 273, 275, 275, 283, 283, 294, 295, 299, 299, 305, 307, 312, 312, 319, 322, 324, 324, 328, 331, 333, 333, 338, 339, 358, 359, 363, 363, 462, 462, 464, 464, 466, 466, 468, 468, 470, 470, 472, 472, 474, 474, 476, 476, 593, 593, 609, 609, 708, 708, 711, 711, 713, 715, 717, 717, 720, 720, 728, 731, 733, 733, 735, 735, 768, 879, 913, 929, 931, 937, 945, 961, 963, 969, 1025, 1025, 1040, 1103, 1105, 1105, 8208, 8208, 8211, 8214, 8216, 8217, 8220, 8221, 8224, 8226, 8228, 8231, 8240, 8240, 8242, 8243, 8245, 8245, 8251, 8251, 8254, 8254, 8308, 8308, 8319, 8319, 8321, 8324, 8364, 8364, 8451, 8451, 8453, 8453, 8457, 8457, 8467, 8467, 8470, 8470, 8481, 8482, 8486, 8486, 8491, 8491, 8531, 8532, 8539, 8542, 8544, 8555, 8560, 8569, 8585, 8585, 8592, 8601, 8632, 8633, 8658, 8658, 8660, 8660, 8679, 8679, 8704, 8704, 8706, 8707, 8711, 8712, 8715, 8715, 8719, 8719, 8721, 8721, 8725, 8725, 8730, 8730, 8733, 8736, 8739, 8739, 8741, 8741, 8743, 8748, 8750, 8750, 8756, 8759, 8764, 8765, 8776, 8776, 8780, 8780, 8786, 8786, 8800, 8801, 8804, 8807, 8810, 8811, 8814, 8815, 8834, 8835, 8838, 8839, 8853, 8853, 8857, 8857, 8869, 8869, 8895, 8895, 8978, 8978, 9312, 9449, 9451, 9547, 9552, 9587, 9600, 9615, 9618, 9621, 9632, 9633, 9635, 9641, 9650, 9651, 9654, 9655, 9660, 9661, 9664, 9665, 9670, 9672, 9675, 9675, 9678, 9681, 9698, 9701, 9711, 9711, 9733, 9734, 9737, 9737, 9742, 9743, 9756, 9756, 9758, 9758, 9792, 9792, 9794, 9794, 9824, 9825, 9827, 9829, 9831, 9834, 9836, 9837, 9839, 9839, 9886, 9887, 9919, 9919, 9926, 9933, 9935, 9939, 9941, 9953, 9955, 9955, 9960, 9961, 9963, 9969, 9972, 9972, 9974, 9977, 9979, 9980, 9982, 9983, 10045, 10045, 10102, 10111, 11094, 11097, 12872, 12879, 57344, 63743, 65024, 65039, 65533, 65533, 127232, 127242, 127248, 127277, 127280, 127337, 127344, 127373, 127375, 127376, 127387, 127404, 917760, 917999, 983040, 1048573, 1048576, 1114109];
6457
6437
  var fullwidthRanges = [12288, 12288, 65281, 65376, 65504, 65510];
6458
6438
  var halfwidthRanges = [8361, 8361, 65377, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500, 65512, 65518];
6459
6439
  var narrowRanges = [32, 126, 162, 163, 165, 166, 172, 172, 175, 175, 10214, 10221, 10629, 10630];
6460
6440
  var wideRanges = [4352, 4447, 8986, 8987, 9001, 9002, 9193, 9196, 9200, 9200, 9203, 9203, 9725, 9726, 9748, 9749, 9776, 9783, 9800, 9811, 9855, 9855, 9866, 9871, 9875, 9875, 9889, 9889, 9898, 9899, 9917, 9918, 9924, 9925, 9934, 9934, 9940, 9940, 9962, 9962, 9970, 9971, 9973, 9973, 9978, 9978, 9981, 9981, 9989, 9989, 9994, 9995, 10024, 10024, 10060, 10060, 10062, 10062, 10067, 10069, 10071, 10071, 10133, 10135, 10160, 10160, 10175, 10175, 11035, 11036, 11088, 11088, 11093, 11093, 11904, 11929, 11931, 12019, 12032, 12245, 12272, 12287, 12289, 12350, 12353, 12438, 12441, 12543, 12549, 12591, 12593, 12686, 12688, 12773, 12783, 12830, 12832, 12871, 12880, 42124, 42128, 42182, 43360, 43388, 44032, 55203, 63744, 64255, 65040, 65049, 65072, 65106, 65108, 65126, 65128, 65131, 94176, 94180, 94192, 94198, 94208, 101589, 101631, 101662, 101760, 101874, 110576, 110579, 110581, 110587, 110589, 110590, 110592, 110882, 110898, 110898, 110928, 110930, 110933, 110933, 110948, 110951, 110960, 111355, 119552, 119638, 119648, 119670, 126980, 126980, 127183, 127183, 127374, 127374, 127377, 127386, 127488, 127490, 127504, 127547, 127552, 127560, 127568, 127569, 127584, 127589, 127744, 127776, 127789, 127797, 127799, 127868, 127870, 127891, 127904, 127946, 127951, 127955, 127968, 127984, 127988, 127988, 127992, 128062, 128064, 128064, 128066, 128252, 128255, 128317, 128331, 128334, 128336, 128359, 128378, 128378, 128405, 128406, 128420, 128420, 128507, 128591, 128640, 128709, 128716, 128716, 128720, 128722, 128725, 128728, 128732, 128735, 128747, 128748, 128756, 128764, 128992, 129003, 129008, 129008, 129292, 129338, 129340, 129349, 129351, 129535, 129648, 129660, 129664, 129674, 129678, 129734, 129736, 129736, 129741, 129756, 129759, 129770, 129775, 129784, 131072, 196605, 196608, 262141];
6461
6441
 
6462
- // node_modules/.pnpm/node_modules/get-east-asian-width/utilities.js
6442
+ // node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/utilities.js
6463
6443
  var isInRange = (ranges, codePoint) => {
6464
6444
  let low = 0;
6465
6445
  let high = Math.floor(ranges.length / 2) - 1;
@@ -6477,7 +6457,7 @@ var isInRange = (ranges, codePoint) => {
6477
6457
  return false;
6478
6458
  };
6479
6459
 
6480
- // node_modules/.pnpm/node_modules/get-east-asian-width/lookup.js
6460
+ // node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/lookup.js
6481
6461
  var minimumAmbiguousCodePoint = ambiguousRanges[0];
6482
6462
  var maximumAmbiguousCodePoint = ambiguousRanges.at(-1);
6483
6463
  var minimumFullWidthCodePoint = fullwidthRanges[0];
@@ -6528,7 +6508,7 @@ var isWide = (codePoint) => {
6528
6508
  return isInRange(wideRanges, codePoint);
6529
6509
  };
6530
6510
 
6531
- // node_modules/.pnpm/node_modules/get-east-asian-width/index.js
6511
+ // node_modules/.pnpm/get-east-asian-width@1.5.0/node_modules/get-east-asian-width/index.js
6532
6512
  function validate(codePoint) {
6533
6513
  if (!Number.isSafeInteger(codePoint)) {
6534
6514
  throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
@@ -6542,7 +6522,7 @@ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
6542
6522
  return 1;
6543
6523
  }
6544
6524
 
6545
- // node_modules/.pnpm/ora@8.2.0/node_modules/string-width/index.js
6525
+ // node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
6546
6526
  var import_emoji_regex = __toESM(require_emoji_regex(), 1);
6547
6527
  var segmenter = new Intl.Segmenter();
6548
6528
  var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
@@ -6591,15 +6571,26 @@ function stringWidth(string, options = {}) {
6591
6571
  return width;
6592
6572
  }
6593
6573
 
6594
- // node_modules/.pnpm/ora@8.2.0/node_modules/is-interactive/index.js
6574
+ // node_modules/.pnpm/is-interactive@2.0.0/node_modules/is-interactive/index.js
6595
6575
  function isInteractive({ stream = process.stdout } = {}) {
6596
6576
  return Boolean(
6597
6577
  stream && stream.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env)
6598
6578
  );
6599
6579
  }
6600
6580
 
6601
- // node_modules/.pnpm/ora@8.2.0/node_modules/stdin-discarder/index.js
6581
+ // node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
6602
6582
  import process13 from "node:process";
6583
+ function isUnicodeSupported2() {
6584
+ const { env: env2 } = process13;
6585
+ const { TERM, TERM_PROGRAM } = env2;
6586
+ if (process13.platform !== "win32") {
6587
+ return TERM !== "linux";
6588
+ }
6589
+ return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
6590
+ }
6591
+
6592
+ // node_modules/.pnpm/stdin-discarder@0.2.2/node_modules/stdin-discarder/index.js
6593
+ import process14 from "node:process";
6603
6594
  var ASCII_ETX_CODE = 3;
6604
6595
  var StdinDiscarder = class {
6605
6596
  #activeCount = 0;
@@ -6619,24 +6610,24 @@ var StdinDiscarder = class {
6619
6610
  }
6620
6611
  }
6621
6612
  #realStart() {
6622
- if (process13.platform === "win32" || !process13.stdin.isTTY) {
6613
+ if (process14.platform === "win32" || !process14.stdin.isTTY) {
6623
6614
  return;
6624
6615
  }
6625
- process13.stdin.setRawMode(true);
6626
- process13.stdin.on("data", this.#handleInput);
6627
- process13.stdin.resume();
6616
+ process14.stdin.setRawMode(true);
6617
+ process14.stdin.on("data", this.#handleInput);
6618
+ process14.stdin.resume();
6628
6619
  }
6629
6620
  #realStop() {
6630
- if (!process13.stdin.isTTY) {
6621
+ if (!process14.stdin.isTTY) {
6631
6622
  return;
6632
6623
  }
6633
- process13.stdin.off("data", this.#handleInput);
6634
- process13.stdin.pause();
6635
- process13.stdin.setRawMode(false);
6624
+ process14.stdin.off("data", this.#handleInput);
6625
+ process14.stdin.pause();
6626
+ process14.stdin.setRawMode(false);
6636
6627
  }
6637
6628
  #handleInput(chunk) {
6638
6629
  if (chunk[0] === ASCII_ETX_CODE) {
6639
- process13.emit("SIGINT");
6630
+ process14.emit("SIGINT");
6640
6631
  }
6641
6632
  }
6642
6633
  };
@@ -6671,7 +6662,7 @@ var Ora = class {
6671
6662
  }
6672
6663
  this.#options = {
6673
6664
  color: "cyan",
6674
- stream: process14.stderr,
6665
+ stream: process15.stderr,
6675
6666
  discardStdin: true,
6676
6667
  hideCursor: true,
6677
6668
  ...options
@@ -6686,7 +6677,7 @@ var Ora = class {
6686
6677
  this.prefixText = this.#options.prefixText;
6687
6678
  this.suffixText = this.#options.suffixText;
6688
6679
  this.indent = this.#options.indent;
6689
- if (process14.env.NODE_ENV === "test") {
6680
+ if (process15.env.NODE_ENV === "test") {
6690
6681
  this._stream = this.#stream;
6691
6682
  this._isEnabled = this.#isEnabled;
6692
6683
  Object.defineProperty(this, "_linesToClear", {
@@ -6733,7 +6724,7 @@ var Ora = class {
6733
6724
  throw new Error("The given spinner must have a `frames` property");
6734
6725
  }
6735
6726
  this.#spinner = spinner;
6736
- } else if (!isUnicodeSupported()) {
6727
+ } else if (!isUnicodeSupported2()) {
6737
6728
  this.#spinner = import_cli_spinners.default.line;
6738
6729
  } else if (spinner === void 0) {
6739
6730
  this.#spinner = import_cli_spinners.default.dots;
@@ -6876,7 +6867,7 @@ var Ora = class {
6876
6867
  if (this.#options.hideCursor) {
6877
6868
  cli_cursor_default.hide(this.#stream);
6878
6869
  }
6879
- if (this.#options.discardStdin && process14.stdin.isTTY) {
6870
+ if (this.#options.discardStdin && process15.stdin.isTTY) {
6880
6871
  this.#isDiscardingStdin = true;
6881
6872
  stdin_discarder_default.start();
6882
6873
  }
@@ -6895,7 +6886,7 @@ var Ora = class {
6895
6886
  if (this.#options.hideCursor) {
6896
6887
  cli_cursor_default.show(this.#stream);
6897
6888
  }
6898
- if (this.#options.discardStdin && process14.stdin.isTTY && this.#isDiscardingStdin) {
6889
+ if (this.#options.discardStdin && process15.stdin.isTTY && this.#isDiscardingStdin) {
6899
6890
  stdin_discarder_default.stop();
6900
6891
  this.#isDiscardingStdin = false;
6901
6892
  }
@@ -6935,804 +6926,1243 @@ function ora(options) {
6935
6926
  return new Ora(options);
6936
6927
  }
6937
6928
 
6938
- // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
6939
- var ANSI_BACKGROUND_OFFSET2 = 10;
6940
- var wrapAnsi162 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
6941
- var wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
6942
- var wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
6943
- var styles3 = {
6944
- modifier: {
6945
- reset: [0, 0],
6946
- // 21 isn't widely supported and 22 does the same thing
6947
- bold: [1, 22],
6948
- dim: [2, 22],
6949
- italic: [3, 23],
6950
- underline: [4, 24],
6951
- overline: [53, 55],
6952
- inverse: [7, 27],
6953
- hidden: [8, 28],
6954
- strikethrough: [9, 29]
6955
- },
6956
- color: {
6957
- black: [30, 39],
6958
- red: [31, 39],
6959
- green: [32, 39],
6960
- yellow: [33, 39],
6961
- blue: [34, 39],
6962
- magenta: [35, 39],
6963
- cyan: [36, 39],
6964
- white: [37, 39],
6965
- // Bright color
6966
- blackBright: [90, 39],
6967
- gray: [90, 39],
6968
- // Alias of `blackBright`
6969
- grey: [90, 39],
6970
- // Alias of `blackBright`
6971
- redBright: [91, 39],
6972
- greenBright: [92, 39],
6973
- yellowBright: [93, 39],
6974
- blueBright: [94, 39],
6975
- magentaBright: [95, 39],
6976
- cyanBright: [96, 39],
6977
- whiteBright: [97, 39]
6978
- },
6979
- bgColor: {
6980
- bgBlack: [40, 49],
6981
- bgRed: [41, 49],
6982
- bgGreen: [42, 49],
6983
- bgYellow: [43, 49],
6984
- bgBlue: [44, 49],
6985
- bgMagenta: [45, 49],
6986
- bgCyan: [46, 49],
6987
- bgWhite: [47, 49],
6988
- // Bright color
6989
- bgBlackBright: [100, 49],
6990
- bgGray: [100, 49],
6991
- // Alias of `bgBlackBright`
6992
- bgGrey: [100, 49],
6993
- // Alias of `bgBlackBright`
6994
- bgRedBright: [101, 49],
6995
- bgGreenBright: [102, 49],
6996
- bgYellowBright: [103, 49],
6997
- bgBlueBright: [104, 49],
6998
- bgMagentaBright: [105, 49],
6999
- bgCyanBright: [106, 49],
7000
- bgWhiteBright: [107, 49]
6929
+ // src/lib/config.ts
6930
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
6931
+ import { homedir } from "node:os";
6932
+ import { join } from "node:path";
6933
+ var CONFIG_DIR = join(homedir(), ".anymorph");
6934
+ var CRED_FILE = join(CONFIG_DIR, "credentials.json");
6935
+ function readCredentials() {
6936
+ if (!existsSync(CRED_FILE)) return null;
6937
+ try {
6938
+ return JSON.parse(readFileSync(CRED_FILE, "utf-8"));
6939
+ } catch {
6940
+ return null;
7001
6941
  }
7002
- };
7003
- var modifierNames2 = Object.keys(styles3.modifier);
7004
- var foregroundColorNames2 = Object.keys(styles3.color);
7005
- var backgroundColorNames2 = Object.keys(styles3.bgColor);
7006
- var colorNames2 = [...foregroundColorNames2, ...backgroundColorNames2];
7007
- function assembleStyles2() {
7008
- const codes = /* @__PURE__ */ new Map();
7009
- for (const [groupName, group] of Object.entries(styles3)) {
7010
- for (const [styleName, style] of Object.entries(group)) {
7011
- styles3[styleName] = {
7012
- open: `\x1B[${style[0]}m`,
7013
- close: `\x1B[${style[1]}m`
7014
- };
7015
- group[styleName] = styles3[styleName];
7016
- codes.set(style[0], style[1]);
6942
+ }
6943
+ function writeCredentials(creds) {
6944
+ mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
6945
+ writeFileSync(CRED_FILE, JSON.stringify(creds, null, 2), { mode: 384 });
6946
+ }
6947
+ function clearCredentials() {
6948
+ if (existsSync(CRED_FILE)) unlinkSync(CRED_FILE);
6949
+ }
6950
+ function getApiUrl() {
6951
+ const creds = readCredentials();
6952
+ return creds?.api_url ?? process.env.ANYMORPH_API_URL ?? "https://api.anymorph.ai";
6953
+ }
6954
+
6955
+ // src/lib/api-client.ts
6956
+ async function apiRequest(method, path2, body, auth = true) {
6957
+ const baseUrl = getApiUrl();
6958
+ const headers = { "Content-Type": "application/json" };
6959
+ if (auth) {
6960
+ const creds = readCredentials();
6961
+ if (!creds) throw new Error("Not logged in. Run `anymorph login` first.");
6962
+ if (Date.now() / 1e3 > creds.expires_at - 300) {
6963
+ await refreshToken(creds.refresh_token);
6964
+ const fresh = readCredentials();
6965
+ if (fresh) headers.Authorization = `Bearer ${fresh.access_token}`;
6966
+ } else {
6967
+ headers.Authorization = `Bearer ${creds.access_token}`;
7017
6968
  }
7018
- Object.defineProperty(styles3, groupName, {
7019
- value: group,
7020
- enumerable: false
7021
- });
7022
6969
  }
7023
- Object.defineProperty(styles3, "codes", {
7024
- value: codes,
7025
- enumerable: false
6970
+ return fetch(`${baseUrl}${path2}`, {
6971
+ method,
6972
+ headers,
6973
+ body: body ? JSON.stringify(body) : void 0
7026
6974
  });
7027
- styles3.color.close = "\x1B[39m";
7028
- styles3.bgColor.close = "\x1B[49m";
7029
- styles3.color.ansi = wrapAnsi162();
7030
- styles3.color.ansi256 = wrapAnsi2562();
7031
- styles3.color.ansi16m = wrapAnsi16m2();
7032
- styles3.bgColor.ansi = wrapAnsi162(ANSI_BACKGROUND_OFFSET2);
7033
- styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET2);
7034
- styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET2);
7035
- Object.defineProperties(styles3, {
7036
- rgbToAnsi256: {
7037
- value(red, green, blue) {
7038
- if (red === green && green === blue) {
7039
- if (red < 8) {
7040
- return 16;
7041
- }
7042
- if (red > 248) {
7043
- return 231;
7044
- }
7045
- return Math.round((red - 8) / 247 * 24) + 232;
7046
- }
7047
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
7048
- },
7049
- enumerable: false
7050
- },
7051
- hexToRgb: {
7052
- value(hex) {
7053
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
7054
- if (!matches) {
7055
- return [0, 0, 0];
7056
- }
7057
- let [colorString] = matches;
7058
- if (colorString.length === 3) {
7059
- colorString = [...colorString].map((character) => character + character).join("");
7060
- }
7061
- const integer = Number.parseInt(colorString, 16);
7062
- return [
7063
- /* eslint-disable no-bitwise */
7064
- integer >> 16 & 255,
7065
- integer >> 8 & 255,
7066
- integer & 255
7067
- /* eslint-enable no-bitwise */
7068
- ];
7069
- },
7070
- enumerable: false
7071
- },
7072
- hexToAnsi256: {
7073
- value: (hex) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex)),
7074
- enumerable: false
7075
- },
7076
- ansi256ToAnsi: {
7077
- value(code) {
7078
- if (code < 8) {
7079
- return 30 + code;
7080
- }
7081
- if (code < 16) {
7082
- return 90 + (code - 8);
7083
- }
7084
- let red;
7085
- let green;
7086
- let blue;
7087
- if (code >= 232) {
7088
- red = ((code - 232) * 10 + 8) / 255;
7089
- green = red;
7090
- blue = red;
7091
- } else {
7092
- code -= 16;
7093
- const remainder = code % 36;
7094
- red = Math.floor(code / 36) / 5;
7095
- green = Math.floor(remainder / 6) / 5;
7096
- blue = remainder % 6 / 5;
7097
- }
7098
- const value = Math.max(red, green, blue) * 2;
7099
- if (value === 0) {
7100
- return 30;
7101
- }
7102
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
7103
- if (value === 2) {
7104
- result += 60;
7105
- }
7106
- return result;
7107
- },
7108
- enumerable: false
7109
- },
7110
- rgbToAnsi: {
7111
- value: (red, green, blue) => styles3.ansi256ToAnsi(styles3.rgbToAnsi256(red, green, blue)),
7112
- enumerable: false
7113
- },
7114
- hexToAnsi: {
7115
- value: (hex) => styles3.ansi256ToAnsi(styles3.hexToAnsi256(hex)),
7116
- enumerable: false
7117
- }
6975
+ }
6976
+ async function refreshToken(token) {
6977
+ const baseUrl = getApiUrl();
6978
+ const res = await fetch(`${baseUrl}/api/cli/refresh`, {
6979
+ method: "POST",
6980
+ headers: { "Content-Type": "application/json" },
6981
+ body: JSON.stringify({ refresh_token: token })
6982
+ });
6983
+ if (!res.ok) throw new Error("Session expired. Run `anymorph login` again.");
6984
+ const data = await res.json();
6985
+ const creds = readCredentials();
6986
+ writeCredentials({
6987
+ ...creds,
6988
+ access_token: data.access_token,
6989
+ refresh_token: data.refresh_token,
6990
+ expires_at: Math.floor(Date.now() / 1e3) + data.expires_in
7118
6991
  });
7119
- return styles3;
7120
6992
  }
7121
- var ansiStyles2 = assembleStyles2();
7122
- var ansi_styles_default2 = ansiStyles2;
7123
6993
 
7124
- // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
7125
- import process15 from "node:process";
7126
- import os3 from "node:os";
7127
- import tty2 from "node:tty";
7128
- function hasFlag2(flag, argv = globalThis.Deno ? globalThis.Deno.args : process15.argv) {
7129
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
7130
- const position = argv.indexOf(prefix + flag);
7131
- const terminatorPosition = argv.indexOf("--");
7132
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
7133
- }
7134
- var { env: env2 } = process15;
7135
- var flagForceColor2;
7136
- if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
7137
- flagForceColor2 = 0;
7138
- } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
7139
- flagForceColor2 = 1;
7140
- }
7141
- function envForceColor2() {
7142
- if ("FORCE_COLOR" in env2) {
7143
- if (env2.FORCE_COLOR === "true") {
7144
- return 1;
7145
- }
7146
- if (env2.FORCE_COLOR === "false") {
7147
- return 0;
7148
- }
7149
- return env2.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env2.FORCE_COLOR, 10), 3);
6994
+ // src/commands/login.ts
6995
+ async function loginCommand() {
6996
+ console.log();
6997
+ const spinner = ora("Requesting device code...").start();
6998
+ let res;
6999
+ try {
7000
+ res = await apiRequest("POST", "/api/cli/device-code", {}, false);
7001
+ } catch {
7002
+ spinner.fail("Failed to connect. Check your internet connection.");
7003
+ process.exit(1);
7150
7004
  }
7151
- }
7152
- function translateLevel2(level) {
7153
- if (level === 0) {
7154
- return false;
7005
+ if (!res.ok) {
7006
+ spinner.fail("Failed to get device code");
7007
+ process.exit(1);
7155
7008
  }
7156
- return {
7157
- level,
7158
- hasBasic: true,
7159
- has256: level >= 2,
7160
- has16m: level >= 3
7161
- };
7162
- }
7163
- function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
7164
- const noFlagForceColor = envForceColor2();
7165
- if (noFlagForceColor !== void 0) {
7166
- flagForceColor2 = noFlagForceColor;
7167
- }
7168
- const forceColor = sniffFlags ? flagForceColor2 : noFlagForceColor;
7169
- if (forceColor === 0) {
7170
- return 0;
7009
+ const deviceCode = await res.json();
7010
+ spinner.stop();
7011
+ console.log(source_default.bold("\n Your code: ") + source_default.cyan.bold(deviceCode.user_code));
7012
+ console.log(`
7013
+ Opening ${source_default.underline(deviceCode.verification_uri)}`);
7014
+ console.log(source_default.dim(" If browser doesn't open, visit the URL above.\n"));
7015
+ try {
7016
+ await open_default(deviceCode.verification_uri);
7017
+ } catch {
7171
7018
  }
7172
- if (sniffFlags) {
7173
- if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
7174
- return 3;
7019
+ const pollSpinner = ora("Waiting for authorization...").start();
7020
+ const startTime = Date.now();
7021
+ const timeoutMs = deviceCode.expires_in * 1e3;
7022
+ while (Date.now() - startTime < timeoutMs) {
7023
+ await sleep(deviceCode.interval * 1e3);
7024
+ const pollRes = await apiRequest(
7025
+ "POST",
7026
+ "/api/cli/token",
7027
+ { device_code: deviceCode.device_code, grant_type: "device_code" },
7028
+ false
7029
+ );
7030
+ if (pollRes.status === 428) continue;
7031
+ if (pollRes.status === 410) {
7032
+ pollSpinner.fail("Device code expired. Please try again.");
7033
+ process.exit(1);
7175
7034
  }
7176
- if (hasFlag2("color=256")) {
7177
- return 2;
7035
+ if (pollRes.ok) {
7036
+ const token = await pollRes.json();
7037
+ writeCredentials({
7038
+ access_token: token.access_token,
7039
+ refresh_token: token.refresh_token,
7040
+ expires_at: Math.floor(Date.now() / 1e3) + token.expires_in,
7041
+ api_url: getApiUrl(),
7042
+ email: token.email
7043
+ });
7044
+ pollSpinner.succeed(source_default.green(`Logged in as ${source_default.bold(token.email)}`));
7045
+ return;
7178
7046
  }
7047
+ pollSpinner.fail("Unexpected error during login");
7048
+ process.exit(1);
7179
7049
  }
7180
- if ("TF_BUILD" in env2 && "AGENT_NAME" in env2) {
7181
- return 1;
7182
- }
7183
- if (haveStream && !streamIsTTY && forceColor === void 0) {
7184
- return 0;
7185
- }
7186
- const min = forceColor || 0;
7187
- if (env2.TERM === "dumb") {
7188
- return min;
7189
- }
7190
- if (process15.platform === "win32") {
7191
- const osRelease = os3.release().split(".");
7192
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
7193
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
7050
+ pollSpinner.fail("Timed out waiting for authorization");
7051
+ process.exit(1);
7052
+ }
7053
+ function sleep(ms) {
7054
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
7055
+ }
7056
+
7057
+ // src/lib/display.ts
7058
+ function printVisibility(domain, data) {
7059
+ const { dashboard, competitors, citations } = data;
7060
+ const score = dashboard.visibilityScore?.value ?? 0;
7061
+ const sov = dashboard.shareOfVoice?.value ?? 0;
7062
+ const sentiment = dashboard.avgSentiment?.value ?? 0;
7063
+ const mentions = dashboard.mentionCount?.value ?? 0;
7064
+ console.log();
7065
+ console.log(source_default.bold(` AI Visibility \u2014 ${domain}`));
7066
+ console.log(source_default.dim(` ${"\u2500".repeat(40)}`));
7067
+ console.log(` ${source_default.bold("Score")} ${scoreColor(score)(source_default.bold(String(Math.round(score))))} / 100`);
7068
+ console.log(` ${source_default.bold("Share of Voice")} ${source_default.white(Math.round(sov * 100) + "%")}`);
7069
+ console.log(` ${source_default.bold("Mentions")} ${source_default.white(String(mentions))}`);
7070
+ console.log(` ${source_default.bold("Sentiment")} ${sentimentLabel(sentiment)}`);
7071
+ if (dashboard.engineVisibility?.length) {
7072
+ console.log();
7073
+ console.log(source_default.bold(" Engine Breakdown"));
7074
+ for (const eng of dashboard.engineVisibility) {
7075
+ const barLen = Math.round((eng.score ?? 0) / 10);
7076
+ const bar = "\u2588".repeat(barLen);
7077
+ const empty = "\u2591".repeat(10 - barLen);
7078
+ console.log(` ${bar}${empty} ${eng.engine}`);
7194
7079
  }
7195
- return 1;
7196
7080
  }
7197
- if ("CI" in env2) {
7198
- if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env2)) {
7199
- return 3;
7200
- }
7201
- if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
7202
- return 1;
7081
+ if (competitors?.length) {
7082
+ console.log();
7083
+ console.log(source_default.bold(" Competitors"));
7084
+ for (const comp of competitors) {
7085
+ const marker = comp.isPrimary ? source_default.cyan(" \u2190 you") : "";
7086
+ console.log(` ${comp.name.padEnd(20)} ${Math.round(comp.sov * 100)}% SoV${marker}`);
7203
7087
  }
7204
- return min;
7205
7088
  }
7206
- if ("TEAMCITY_VERSION" in env2) {
7207
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
7208
- }
7209
- if (env2.COLORTERM === "truecolor") {
7210
- return 3;
7089
+ if (citations?.length) {
7090
+ console.log();
7091
+ console.log(source_default.bold(" Citations"));
7092
+ for (const cit of citations.slice(0, 5)) {
7093
+ console.log(` ${cit.url.padEnd(35)} ${cit.count}x`);
7094
+ }
7211
7095
  }
7212
- if (env2.TERM === "xterm-kitty") {
7213
- return 3;
7096
+ console.log();
7097
+ }
7098
+ function scoreColor(score) {
7099
+ if (score >= 85) return source_default.green;
7100
+ if (score >= 70) return source_default.greenBright;
7101
+ if (score >= 50) return source_default.yellow;
7102
+ if (score >= 30) return source_default.hex("#FF8800");
7103
+ return source_default.red;
7104
+ }
7105
+ function sentimentLabel(score) {
7106
+ if (score > 0.3) return source_default.green("Positive");
7107
+ if (score > -0.3) return source_default.yellow("Neutral");
7108
+ return source_default.red("Negative");
7109
+ }
7110
+
7111
+ // src/commands/check.ts
7112
+ var STEPS = ["Setting up workspace", "Generating prompts", "Querying AI engines", "Analyzing responses"];
7113
+ async function checkCommand(domain, opts) {
7114
+ let spinner = ora(`Checking AI visibility for ${source_default.bold(domain)}...`).start();
7115
+ let res;
7116
+ try {
7117
+ res = await apiRequest("POST", "/api/cli/check", { domain });
7118
+ } catch (err) {
7119
+ spinner.fail(err instanceof Error ? err.message : "Failed to connect. Check your internet connection.");
7120
+ process.exit(1);
7214
7121
  }
7215
- if (env2.TERM === "xterm-ghostty") {
7216
- return 3;
7122
+ if (!res.ok) {
7123
+ const body = await res.json().catch(() => ({}));
7124
+ spinner.fail(
7125
+ res.status === 401 ? "Not authenticated. Run `anymorph login` first." : res.status === 403 || body.error === "EMAIL_DOMAIN_MISMATCH" ? body.message || "Domain doesn't match your email." : body.status === "limit_exceeded" ? body.message || "Free check used. Upgrade to continue." : "Check failed."
7126
+ );
7127
+ process.exit(1);
7217
7128
  }
7218
- if (env2.TERM === "wezterm") {
7219
- return 3;
7129
+ const result = await res.json();
7130
+ if (result.status === "complete") {
7131
+ spinner.stop();
7132
+ if (opts.json) {
7133
+ console.log(JSON.stringify(result, null, 2));
7134
+ } else {
7135
+ printVisibility(domain, result.data);
7136
+ console.log(source_default.dim(` Dashboard: https://dashboard.anymorph.ai/w/${result.workspaceId}/overview
7137
+ `));
7138
+ }
7139
+ return;
7220
7140
  }
7221
- if ("TERM_PROGRAM" in env2) {
7222
- const version = Number.parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
7223
- switch (env2.TERM_PROGRAM) {
7224
- case "iTerm.app": {
7225
- return version >= 3 ? 3 : 2;
7141
+ if (result.status === "analyzing" && result.jobId) {
7142
+ spinner.text = `${STEPS[0]}...`;
7143
+ let currentStep = 0;
7144
+ while (true) {
7145
+ await sleep2(5e3);
7146
+ const pollRes = await apiRequest("GET", `/api/cli/check/${result.jobId}`);
7147
+ if (!pollRes.ok) {
7148
+ spinner.fail("Failed to check analysis status.");
7149
+ process.exit(1);
7226
7150
  }
7227
- case "Apple_Terminal": {
7228
- return 2;
7151
+ const status = await pollRes.json();
7152
+ if (status.status === "complete") {
7153
+ spinner.succeed(STEPS[currentStep]);
7154
+ console.log();
7155
+ if (opts.json) {
7156
+ console.log(JSON.stringify(status, null, 2));
7157
+ } else {
7158
+ printVisibility(domain, status.data);
7159
+ console.log(source_default.dim(` Dashboard: https://dashboard.anymorph.ai/w/${status.workspaceId}/overview
7160
+ `));
7161
+ }
7162
+ return;
7163
+ }
7164
+ if (status.status === "failed") {
7165
+ spinner.fail(status.message || "Analysis failed.");
7166
+ process.exit(1);
7167
+ }
7168
+ if (status.progress) {
7169
+ const pct = Math.round(status.progress.completed / Math.max(status.progress.total, 1) * 100);
7170
+ const stepIdx = pct < 10 ? 0 : pct < 30 ? 1 : pct < 90 ? 2 : 3;
7171
+ if (stepIdx !== currentStep) {
7172
+ spinner.succeed(STEPS[currentStep]);
7173
+ currentStep = stepIdx;
7174
+ spinner = ora(`${STEPS[currentStep]}...`).start();
7175
+ }
7176
+ spinner.text = `${STEPS[currentStep]}... (${status.progress.completed}/${status.progress.total} tasks)`;
7229
7177
  }
7230
7178
  }
7231
7179
  }
7232
- if (/-256(color)?$/i.test(env2.TERM)) {
7233
- return 2;
7180
+ spinner.fail(result.message || "Unexpected response.");
7181
+ process.exit(1);
7182
+ }
7183
+ function sleep2(ms) {
7184
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
7185
+ }
7186
+
7187
+ // src/commands/status.ts
7188
+ async function statusCommand() {
7189
+ const creds = readCredentials();
7190
+ if (!creds) {
7191
+ console.log(source_default.yellow("\n Not logged in. Run `anymorph login` to get started.\n"));
7192
+ return;
7234
7193
  }
7235
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
7236
- return 1;
7194
+ console.log(`
7195
+ ${source_default.bold("Email:")} ${creds.email}`);
7196
+ console.log(` ${source_default.bold("API:")} ${creds.api_url}`);
7197
+ const expiresIn = creds.expires_at - Math.floor(Date.now() / 1e3);
7198
+ if (expiresIn > 0) {
7199
+ const hours = Math.floor(expiresIn / 3600);
7200
+ console.log(` ${source_default.bold("Token:")} valid (${hours}h remaining)`);
7201
+ } else {
7202
+ console.log(` ${source_default.bold("Token:")} ${source_default.yellow("expired (will auto-refresh)")}`);
7237
7203
  }
7238
- if ("COLORTERM" in env2) {
7239
- return 1;
7204
+ try {
7205
+ const res = await apiRequest("GET", "/api/cli/status");
7206
+ if (res.ok) {
7207
+ const data = await res.json();
7208
+ if (data.workspaces?.length) {
7209
+ console.log(`
7210
+ ${source_default.bold("Workspaces:")}`);
7211
+ for (const ws of data.workspaces) {
7212
+ console.log(` ${ws.domain} ${source_default.dim(`(${ws.name})`)}`);
7213
+ }
7214
+ }
7215
+ }
7216
+ } catch {
7240
7217
  }
7241
- return min;
7218
+ console.log();
7242
7219
  }
7243
- function createSupportsColor2(stream, options = {}) {
7244
- const level = _supportsColor2(stream, {
7245
- streamIsTTY: stream && stream.isTTY,
7246
- ...options
7247
- });
7248
- return translateLevel2(level);
7220
+
7221
+ // src/commands/logout.ts
7222
+ function logoutCommand() {
7223
+ clearCredentials();
7224
+ console.log(source_default.green("\n Logged out.\n"));
7249
7225
  }
7250
- var supportsColor2 = {
7251
- stdout: createSupportsColor2({ isTTY: tty2.isatty(1) }),
7252
- stderr: createSupportsColor2({ isTTY: tty2.isatty(2) })
7253
- };
7254
- var supports_color_default2 = supportsColor2;
7255
7226
 
7256
- // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
7257
- function stringReplaceAll2(string, substring, replacer) {
7258
- let index = string.indexOf(substring);
7259
- if (index === -1) {
7260
- return string;
7227
+ // src/commands/workspaces.ts
7228
+ async function workspacesCommand(opts) {
7229
+ const res = await apiRequest("GET", "/api/cli/status");
7230
+ if (!res.ok) {
7231
+ console.error(source_default.red("Couldn't fetch workspaces. Run `anymorph login` first."));
7232
+ process.exit(1);
7261
7233
  }
7262
- const substringLength = substring.length;
7263
- let endIndex = 0;
7264
- let returnValue = "";
7265
- do {
7266
- returnValue += string.slice(endIndex, index) + substring + replacer;
7267
- endIndex = index + substringLength;
7268
- index = string.indexOf(substring, endIndex);
7269
- } while (index !== -1);
7270
- returnValue += string.slice(endIndex);
7271
- return returnValue;
7234
+ const data = await res.json();
7235
+ if (opts.json) {
7236
+ console.log(JSON.stringify(data.workspaces ?? [], null, 2));
7237
+ return;
7238
+ }
7239
+ console.log();
7240
+ console.log(source_default.bold(" Workspaces"));
7241
+ for (const workspace of data.workspaces ?? []) {
7242
+ console.log(` ${workspace.domain}`);
7243
+ console.log(source_default.dim(` id: ${workspace.id}`));
7244
+ console.log(source_default.dim(` name: ${workspace.name}`));
7245
+ }
7246
+ console.log();
7272
7247
  }
7273
- function stringEncaseCRLFWithFirstIndex2(string, prefix, postfix, index) {
7274
- let endIndex = 0;
7275
- let returnValue = "";
7276
- do {
7277
- const gotCR = string[index - 1] === "\r";
7278
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
7279
- endIndex = index + 1;
7280
- index = string.indexOf("\n", endIndex);
7281
- } while (index !== -1);
7282
- returnValue += string.slice(endIndex);
7283
- return returnValue;
7248
+
7249
+ // src/commands/geo.ts
7250
+ import { readFile as readFile3 } from "node:fs/promises";
7251
+ import { join as join6 } from "node:path";
7252
+
7253
+ // src/geo/package-writer.ts
7254
+ import { mkdir, writeFile } from "node:fs/promises";
7255
+ import { join as join2 } from "node:path";
7256
+ async function writeGeoRunPackage(input) {
7257
+ const runDir = join2(input.repoPath, "agent", "runs", input.package.runId);
7258
+ await mkdir(runDir, { recursive: true });
7259
+ await writeJson(join2(runDir, "manifest.json"), input.package.manifest);
7260
+ await writeJson(join2(runDir, "context.json"), {
7261
+ runId: input.package.runId,
7262
+ workspaceId: input.package.workspaceId,
7263
+ workspaceDomain: input.package.workspaceDomain,
7264
+ tenantRepo: input.package.tenantRepo,
7265
+ branch: input.package.branch,
7266
+ execution: input.package.execution,
7267
+ mode: input.package.mode,
7268
+ signals: buildContextSignals(input.package.signals),
7269
+ systemContext: input.package.systemContext,
7270
+ schemaCatalog: input.package.schemaCatalog,
7271
+ intentsPath: `agent/runs/${input.package.runId}/intents.json`
7272
+ });
7273
+ await writeJson(join2(runDir, "intents.json"), buildIntentList(input.package));
7274
+ await writeJson(
7275
+ join2(runDir, "crawl_logs.json"),
7276
+ buildCrawlLogAggregate(input.package)
7277
+ );
7278
+ await writeJson(join2(runDir, "status.json"), {
7279
+ status: "pending",
7280
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
7281
+ });
7282
+ return { runDir };
7283
+ }
7284
+ function buildIntentList(pkg) {
7285
+ return {
7286
+ runId: pkg.runId,
7287
+ workspaceId: pkg.workspaceId,
7288
+ workspaceDomain: pkg.workspaceDomain,
7289
+ source: "signals.intents",
7290
+ intents: extractIntents(pkg.signals)
7291
+ };
7292
+ }
7293
+ function buildCrawlLogAggregate(pkg) {
7294
+ return {
7295
+ runId: pkg.runId,
7296
+ workspaceId: pkg.workspaceId,
7297
+ workspaceDomain: pkg.workspaceDomain,
7298
+ source: "signals.crawlLogs",
7299
+ crawlLogs: extractCrawlLogs(pkg.signals)
7300
+ };
7301
+ }
7302
+ function extractIntents(signals2) {
7303
+ if (!signals2 || typeof signals2 !== "object") return [];
7304
+ const intents = signals2.intents;
7305
+ return Array.isArray(intents) ? intents : [];
7306
+ }
7307
+ function extractCrawlLogs(signals2) {
7308
+ if (!signals2 || typeof signals2 !== "object") return null;
7309
+ return signals2.crawlLogs ?? null;
7310
+ }
7311
+ function buildContextSignals(signals2) {
7312
+ if (!signals2 || typeof signals2 !== "object" || Array.isArray(signals2))
7313
+ return signals2;
7314
+ const record = signals2;
7315
+ const { crawlLogs: _crawlLogs, ...rest } = record;
7316
+ const { crawlLogsSummary: _crawlLogsSummary, ...contextSignals } = rest;
7317
+ return contextSignals;
7318
+ }
7319
+ async function writeJson(path2, value) {
7320
+ await writeFile(path2, `${JSON.stringify(value, null, 2)}
7321
+ `);
7284
7322
  }
7285
7323
 
7286
- // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
7287
- var { stdout: stdoutColor2, stderr: stderrColor2 } = supports_color_default2;
7288
- var GENERATOR2 = Symbol("GENERATOR");
7289
- var STYLER2 = Symbol("STYLER");
7290
- var IS_EMPTY2 = Symbol("IS_EMPTY");
7291
- var levelMapping2 = [
7292
- "ansi",
7293
- "ansi",
7294
- "ansi256",
7295
- "ansi16m"
7296
- ];
7297
- var styles4 = /* @__PURE__ */ Object.create(null);
7298
- var applyOptions2 = (object, options = {}) => {
7299
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
7300
- throw new Error("The `level` option should be an integer from 0 to 3");
7324
+ // src/geo/repo.ts
7325
+ import { execFile as execFile6 } from "node:child_process";
7326
+ import { mkdir as mkdir2, readdir, stat } from "node:fs/promises";
7327
+ import { homedir as homedir2 } from "node:os";
7328
+ import { join as join3, resolve } from "node:path";
7329
+ import { promisify as promisify6 } from "node:util";
7330
+ var execFileAsync5 = promisify6(execFile6);
7331
+ function managedRepoPath(domain) {
7332
+ return join3(homedir2(), ".anymorph", "repos", domain);
7333
+ }
7334
+ async function prepareTenantRepo(input) {
7335
+ const repoPath = input.repo ? resolve(input.repo) : managedRepoPath(input.package.workspaceDomain);
7336
+ if (input.repo) {
7337
+ await ensureDirectory(repoPath);
7338
+ await syncRepo(repoPath, input.package.branch);
7339
+ return repoPath;
7340
+ }
7341
+ await mkdir2(join3(homedir2(), ".anymorph", "repos"), { recursive: true, mode: 448 });
7342
+ try {
7343
+ await ensureDirectory(repoPath);
7344
+ await syncRepo(repoPath, input.package.branch);
7345
+ } catch {
7346
+ await cloneRepo(input.package.tenantRepo, repoPath, input.package.branch);
7301
7347
  }
7302
- const colorLevel = stdoutColor2 ? stdoutColor2.level : 0;
7303
- object.level = options.level === void 0 ? colorLevel : options.level;
7304
- };
7305
- var chalkFactory2 = (options) => {
7306
- const chalk3 = (...strings) => strings.join(" ");
7307
- applyOptions2(chalk3, options);
7308
- Object.setPrototypeOf(chalk3, createChalk2.prototype);
7309
- return chalk3;
7310
- };
7311
- function createChalk2(options) {
7312
- return chalkFactory2(options);
7348
+ return repoPath;
7313
7349
  }
7314
- Object.setPrototypeOf(createChalk2.prototype, Function.prototype);
7315
- for (const [styleName, style] of Object.entries(ansi_styles_default2)) {
7316
- styles4[styleName] = {
7317
- get() {
7318
- const builder = createBuilder2(this, createStyler2(style.open, style.close, this[STYLER2]), this[IS_EMPTY2]);
7319
- Object.defineProperty(this, styleName, { value: builder });
7320
- return builder;
7350
+ async function findRepoForRun(runId) {
7351
+ const root = join3(homedir2(), ".anymorph", "repos");
7352
+ let entries;
7353
+ try {
7354
+ entries = await readdir(root);
7355
+ } catch {
7356
+ return null;
7357
+ }
7358
+ for (const entry of entries) {
7359
+ const repoPath = join3(root, entry);
7360
+ try {
7361
+ await stat(join3(repoPath, "agent", "runs", runId, "manifest.json"));
7362
+ return repoPath;
7363
+ } catch {
7364
+ continue;
7321
7365
  }
7366
+ }
7367
+ return null;
7368
+ }
7369
+ async function gitInfo(repoPath) {
7370
+ return {
7371
+ branch: await gitOutput(repoPath, ["branch", "--show-current"]),
7372
+ origin: await gitOutput(repoPath, ["remote", "get-url", "origin"]),
7373
+ headSha: await gitOutput(repoPath, ["rev-parse", "HEAD"])
7322
7374
  };
7323
7375
  }
7324
- styles4.visible = {
7325
- get() {
7326
- const builder = createBuilder2(this, this[STYLER2], true);
7327
- Object.defineProperty(this, "visible", { value: builder });
7328
- return builder;
7329
- }
7330
- };
7331
- var getModelAnsi2 = (model, level, type, ...arguments_) => {
7332
- if (model === "rgb") {
7333
- if (level === "ansi16m") {
7334
- return ansi_styles_default2[type].ansi16m(...arguments_);
7335
- }
7336
- if (level === "ansi256") {
7337
- return ansi_styles_default2[type].ansi256(ansi_styles_default2.rgbToAnsi256(...arguments_));
7338
- }
7339
- return ansi_styles_default2[type].ansi(ansi_styles_default2.rgbToAnsi(...arguments_));
7376
+ async function cloneRepo(repo, repoPath, branch) {
7377
+ await execFileAsync5("git", [
7378
+ "clone",
7379
+ "--branch",
7380
+ branch,
7381
+ `https://github.com/${repo.owner}/${repo.repo}.git`,
7382
+ repoPath
7383
+ ]);
7384
+ }
7385
+ async function syncRepo(repoPath, branch) {
7386
+ await execFileAsync5("git", ["fetch", "origin"], { cwd: repoPath });
7387
+ try {
7388
+ await execFileAsync5("git", ["checkout", branch], { cwd: repoPath });
7389
+ } catch {
7390
+ await execFileAsync5("git", ["checkout", "-B", branch, `origin/${branch}`], {
7391
+ cwd: repoPath
7392
+ });
7340
7393
  }
7341
- if (model === "hex") {
7342
- return getModelAnsi2("rgb", level, type, ...ansi_styles_default2.hexToRgb(...arguments_));
7394
+ await execFileAsync5("git", ["pull", "--ff-only", "origin", branch], { cwd: repoPath });
7395
+ }
7396
+ async function ensureDirectory(path2) {
7397
+ const s = await stat(path2);
7398
+ if (!s.isDirectory()) throw new Error(`${path2} is not a directory`);
7399
+ }
7400
+ async function gitOutput(repoPath, args) {
7401
+ try {
7402
+ const { stdout } = await execFileAsync5("git", args, { cwd: repoPath });
7403
+ return stdout.trim() || null;
7404
+ } catch {
7405
+ return null;
7343
7406
  }
7344
- return ansi_styles_default2[type][model](...arguments_);
7345
- };
7346
- var usedModels2 = ["rgb", "hex", "ansi256"];
7347
- for (const model of usedModels2) {
7348
- styles4[model] = {
7349
- get() {
7350
- const { level } = this;
7351
- return function(...arguments_) {
7352
- const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "color", ...arguments_), ansi_styles_default2.color.close, this[STYLER2]);
7353
- return createBuilder2(this, styler, this[IS_EMPTY2]);
7354
- };
7355
- }
7356
- };
7357
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
7358
- styles4[bgModel] = {
7359
- get() {
7360
- const { level } = this;
7361
- return function(...arguments_) {
7362
- const styler = createStyler2(getModelAnsi2(model, levelMapping2[level], "bgColor", ...arguments_), ansi_styles_default2.bgColor.close, this[STYLER2]);
7363
- return createBuilder2(this, styler, this[IS_EMPTY2]);
7364
- };
7407
+ }
7408
+
7409
+ // src/geo/scaffold.ts
7410
+ import { execFile as execFile7 } from "node:child_process";
7411
+ import {
7412
+ cp,
7413
+ mkdir as mkdir3,
7414
+ readdir as readdir2,
7415
+ readFile,
7416
+ rm,
7417
+ stat as stat2,
7418
+ writeFile as writeFile2
7419
+ } from "node:fs/promises";
7420
+ import { createHash } from "node:crypto";
7421
+ import { dirname, join as join4, relative, resolve as resolve2 } from "node:path";
7422
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
7423
+ import { promisify as promisify7 } from "node:util";
7424
+ var execFileAsync6 = promisify7(execFile7);
7425
+ var DEFAULT_SKILLPACK_RELATIVE_PATH = join4(
7426
+ "apps",
7427
+ "anymorph-geo-skills",
7428
+ "plugins",
7429
+ "anymorph-geo",
7430
+ "skills"
7431
+ );
7432
+ var MANAGED_PATHS = [".claude/skills", ".agents/skills", "agent/contracts"];
7433
+ async function initGeoScaffold(input) {
7434
+ return applyGeoScaffold(input, { createMemory: true });
7435
+ }
7436
+ async function syncGeoScaffold(input) {
7437
+ return applyGeoScaffold(input, { createMemory: false });
7438
+ }
7439
+ async function doctorGeoScaffold(input) {
7440
+ const repoPath = resolve2(input.repoPath);
7441
+ const skillsSourceDir = await resolveSkillSourceDir(input.skillsSourceDir);
7442
+ const manifestHash = await hashDirectory(skillsSourceDir);
7443
+ const problems = [];
7444
+ for (const target of [".claude/skills", ".agents/skills"]) {
7445
+ await compareDirectories(skillsSourceDir, join4(repoPath, target), target, problems);
7446
+ }
7447
+ for (const path2 of [
7448
+ "agent/BRAND.md",
7449
+ "agent/STRATEGY.md",
7450
+ "agent/LEARNINGS.md",
7451
+ "agent/runs/.gitkeep",
7452
+ "agent/archive/.gitkeep",
7453
+ "agent/skillpack.json"
7454
+ ]) {
7455
+ if (!await exists(join4(repoPath, path2))) problems.push(`Missing ${path2}`);
7456
+ }
7457
+ const lock = await readJson(join4(repoPath, "agent", "skillpack.json"));
7458
+ if (lock && typeof lock === "object") {
7459
+ const actual = lock.manifestHash;
7460
+ if (actual !== manifestHash) {
7461
+ problems.push("agent/skillpack.json manifestHash does not match current skillpack");
7365
7462
  }
7463
+ }
7464
+ return {
7465
+ ok: problems.length === 0,
7466
+ repoPath,
7467
+ skillsSourceDir,
7468
+ changed: [],
7469
+ problems,
7470
+ manifestHash
7366
7471
  };
7367
7472
  }
7368
- var proto2 = Object.defineProperties(() => {
7369
- }, {
7370
- ...styles4,
7371
- level: {
7372
- enumerable: true,
7373
- get() {
7374
- return this[GENERATOR2].level;
7473
+ async function resolveSkillSourceDir(explicit) {
7474
+ if (explicit) {
7475
+ const resolved = resolve2(explicit);
7476
+ await ensureDirectory2(resolved);
7477
+ return resolved;
7478
+ }
7479
+ for (const root of searchRoots()) {
7480
+ const candidate = join4(root, DEFAULT_SKILLPACK_RELATIVE_PATH);
7481
+ if (await isDirectory(candidate)) return candidate;
7482
+ }
7483
+ throw new Error(
7484
+ `Could not find GEO skillpack. Pass --skills-source <path> pointing to ${DEFAULT_SKILLPACK_RELATIVE_PATH}.`
7485
+ );
7486
+ }
7487
+ async function applyGeoScaffold(input, options) {
7488
+ const repoPath = resolve2(input.repoPath);
7489
+ const skillsSourceDir = await resolveSkillSourceDir(input.skillsSourceDir);
7490
+ await ensureDirectory2(repoPath);
7491
+ const changed = [];
7492
+ const problems = [];
7493
+ const manifestHash = await hashDirectory(skillsSourceDir);
7494
+ await syncManagedDirectory(skillsSourceDir, join4(repoPath, ".claude", "skills"), changed);
7495
+ await syncManagedDirectory(skillsSourceDir, join4(repoPath, ".agents", "skills"), changed);
7496
+ await syncContracts(repoPath, changed);
7497
+ await ensureRunDirs(repoPath, changed);
7498
+ if (options.createMemory) await ensureMemoryFiles(repoPath, changed);
7499
+ await writeSkillpackLock(
7500
+ {
7501
+ repoPath,
7502
+ skillsSourceDir,
7503
+ ref: input.ref ?? "local",
7504
+ manifestHash
7375
7505
  },
7376
- set(level) {
7377
- this[GENERATOR2].level = level;
7378
- }
7379
- }
7380
- });
7381
- var createStyler2 = (open2, close, parent) => {
7382
- let openAll;
7383
- let closeAll;
7384
- if (parent === void 0) {
7385
- openAll = open2;
7386
- closeAll = close;
7387
- } else {
7388
- openAll = parent.openAll + open2;
7389
- closeAll = close + parent.closeAll;
7390
- }
7506
+ changed
7507
+ );
7391
7508
  return {
7392
- open: open2,
7393
- close,
7394
- openAll,
7395
- closeAll,
7396
- parent
7509
+ ok: problems.length === 0,
7510
+ repoPath,
7511
+ skillsSourceDir,
7512
+ changed,
7513
+ problems,
7514
+ manifestHash
7397
7515
  };
7398
- };
7399
- var createBuilder2 = (self, _styler, _isEmpty) => {
7400
- const builder = (...arguments_) => applyStyle2(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
7401
- Object.setPrototypeOf(builder, proto2);
7402
- builder[GENERATOR2] = self;
7403
- builder[STYLER2] = _styler;
7404
- builder[IS_EMPTY2] = _isEmpty;
7405
- return builder;
7406
- };
7407
- var applyStyle2 = (self, string) => {
7408
- if (self.level <= 0 || !string) {
7409
- return self[IS_EMPTY2] ? "" : string;
7410
- }
7411
- let styler = self[STYLER2];
7412
- if (styler === void 0) {
7413
- return string;
7516
+ }
7517
+ async function syncManagedDirectory(sourceDir, targetDir, changed) {
7518
+ await rm(targetDir, { recursive: true, force: true });
7519
+ await mkdir3(dirname(targetDir), { recursive: true });
7520
+ await cp(sourceDir, targetDir, { recursive: true });
7521
+ changed.push(relative(process.cwd(), targetDir) || targetDir);
7522
+ }
7523
+ async function syncContracts(repoPath, changed) {
7524
+ const contractsDir = join4(repoPath, "agent", "contracts");
7525
+ await mkdir3(contractsDir, { recursive: true });
7526
+ await writeIfChanged(
7527
+ join4(contractsDir, "actions.schema.json"),
7528
+ `${JSON.stringify(ACTIONS_SCHEMA, null, 2)}
7529
+ `,
7530
+ changed
7531
+ );
7532
+ await writeIfChanged(
7533
+ join4(contractsDir, "memory-item.schema.json"),
7534
+ `${JSON.stringify(MEMORY_ITEM_SCHEMA, null, 2)}
7535
+ `,
7536
+ changed
7537
+ );
7538
+ }
7539
+ async function ensureRunDirs(repoPath, changed) {
7540
+ for (const path2 of [join4(repoPath, "agent", "runs"), join4(repoPath, "agent", "archive")]) {
7541
+ await mkdir3(path2, { recursive: true });
7542
+ await writeIfMissing(join4(path2, ".gitkeep"), "", changed);
7414
7543
  }
7415
- const { openAll, closeAll } = styler;
7416
- if (string.includes("\x1B")) {
7417
- while (styler !== void 0) {
7418
- string = stringReplaceAll2(string, styler.close, styler.open);
7419
- styler = styler.parent;
7544
+ }
7545
+ async function ensureMemoryFiles(repoPath, changed) {
7546
+ await mkdir3(join4(repoPath, "agent"), { recursive: true });
7547
+ await writeIfMissing(
7548
+ join4(repoPath, "agent", "BRAND.md"),
7549
+ "# Brand\n\nInitial local scaffold. Replace with workspace brand context before serious runs.\n",
7550
+ changed
7551
+ );
7552
+ await writeIfMissing(
7553
+ join4(repoPath, "agent", "STRATEGY.md"),
7554
+ "# GEO Strategy\n\n## Current Priorities\n\n- Initial local scaffold.\n",
7555
+ changed
7556
+ );
7557
+ await writeIfMissing(
7558
+ join4(repoPath, "agent", "LEARNINGS.md"),
7559
+ "# Learnings\n\n## Stable Learnings\n\n- Initial local scaffold.\n",
7560
+ changed
7561
+ );
7562
+ }
7563
+ async function writeSkillpackLock(input, changed) {
7564
+ const sourceCommit = await gitOutput2(input.skillsSourceDir, ["rev-parse", "HEAD"]);
7565
+ const lock = {
7566
+ name: "anymorph-geo",
7567
+ source: input.skillsSourceDir,
7568
+ sourceRepo: "opactor-dev/anymorph-geo-skills",
7569
+ requestedRef: input.ref,
7570
+ resolvedCommit: sourceCommit,
7571
+ manifestHash: input.manifestHash,
7572
+ installedAt: (/* @__PURE__ */ new Date()).toISOString(),
7573
+ managedPaths: MANAGED_PATHS
7574
+ };
7575
+ await writeIfChanged(
7576
+ join4(input.repoPath, "agent", "skillpack.json"),
7577
+ `${JSON.stringify(lock, null, 2)}
7578
+ `,
7579
+ changed
7580
+ );
7581
+ }
7582
+ async function compareDirectories(sourceDir, targetDir, displayPrefix, problems) {
7583
+ const sourceFiles = await listFiles(sourceDir);
7584
+ const targetFiles = await listFiles(targetDir);
7585
+ const targetSet = new Set(targetFiles);
7586
+ for (const file of sourceFiles) {
7587
+ const source = await readFile(join4(sourceDir, file), "utf8");
7588
+ const targetPath = join4(targetDir, file);
7589
+ if (!await exists(targetPath)) {
7590
+ problems.push(`Missing ${displayPrefix}/${file}`);
7591
+ continue;
7420
7592
  }
7593
+ const target = await readFile(targetPath, "utf8");
7594
+ if (source !== target) problems.push(`Drifted ${displayPrefix}/${file}`);
7595
+ targetSet.delete(file);
7421
7596
  }
7422
- const lfIndex = string.indexOf("\n");
7423
- if (lfIndex !== -1) {
7424
- string = stringEncaseCRLFWithFirstIndex2(string, closeAll, openAll, lfIndex);
7597
+ for (const extra of targetSet) problems.push(`Extra managed file ${displayPrefix}/${extra}`);
7598
+ }
7599
+ async function hashDirectory(dir) {
7600
+ const files = await listFiles(dir);
7601
+ const hash = createHash("sha256");
7602
+ for (const file of files) {
7603
+ hash.update(file);
7604
+ hash.update("\0");
7605
+ hash.update(await readFile(join4(dir, file)));
7606
+ hash.update("\0");
7607
+ }
7608
+ return `sha256:${hash.digest("hex")}`;
7609
+ }
7610
+ async function listFiles(dir, base = "") {
7611
+ let entries;
7612
+ try {
7613
+ entries = await readdir2(join4(dir, base), { withFileTypes: true });
7614
+ } catch {
7615
+ return [];
7425
7616
  }
7426
- return openAll + string + closeAll;
7427
- };
7428
- Object.defineProperties(createChalk2.prototype, styles4);
7429
- var chalk2 = createChalk2();
7430
- var chalkStderr2 = createChalk2({ level: stderrColor2 ? stderrColor2.level : 0 });
7431
- var source_default2 = chalk2;
7432
-
7433
- // src/lib/config.ts
7434
- import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
7435
- import { homedir } from "node:os";
7436
- import { join } from "node:path";
7437
- var CONFIG_DIR = join(homedir(), ".anymorph");
7438
- var CRED_FILE = join(CONFIG_DIR, "credentials.json");
7439
- function readCredentials() {
7440
- if (!existsSync(CRED_FILE)) return null;
7617
+ const files = [];
7618
+ for (const entry of entries) {
7619
+ const name = String(entry.name);
7620
+ const path2 = base ? `${base}/${name}` : name;
7621
+ if (entry.isDirectory()) files.push(...await listFiles(dir, path2));
7622
+ else if (entry.isFile()) files.push(path2);
7623
+ }
7624
+ return files.sort();
7625
+ }
7626
+ async function writeIfMissing(path2, content, changed) {
7627
+ if (await exists(path2)) return;
7628
+ await mkdir3(dirname(path2), { recursive: true });
7629
+ await writeFile2(path2, content);
7630
+ changed.push(relative(process.cwd(), path2) || path2);
7631
+ }
7632
+ async function writeIfChanged(path2, content, changed) {
7633
+ const current = await readFile(path2, "utf8").catch(() => null);
7634
+ if (current === content) return;
7635
+ await mkdir3(dirname(path2), { recursive: true });
7636
+ await writeFile2(path2, content);
7637
+ changed.push(relative(process.cwd(), path2) || path2);
7638
+ }
7639
+ async function readJson(path2) {
7640
+ const raw = await readFile(path2, "utf8").catch(() => null);
7641
+ if (!raw) return null;
7441
7642
  try {
7442
- return JSON.parse(readFileSync(CRED_FILE, "utf-8"));
7643
+ return JSON.parse(raw);
7443
7644
  } catch {
7444
7645
  return null;
7445
7646
  }
7446
7647
  }
7447
- function writeCredentials(creds) {
7448
- mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
7449
- writeFileSync(CRED_FILE, JSON.stringify(creds, null, 2), { mode: 384 });
7648
+ async function gitOutput2(cwd, args) {
7649
+ try {
7650
+ const { stdout } = await execFileAsync6("git", args, { cwd });
7651
+ return stdout.trim() || null;
7652
+ } catch {
7653
+ return null;
7654
+ }
7450
7655
  }
7451
- function clearCredentials() {
7452
- if (existsSync(CRED_FILE)) unlinkSync(CRED_FILE);
7656
+ function searchRoots() {
7657
+ const roots = /* @__PURE__ */ new Set();
7658
+ let cwd = resolve2(process.cwd());
7659
+ for (; ; ) {
7660
+ roots.add(cwd);
7661
+ const parent = dirname(cwd);
7662
+ if (parent === cwd) break;
7663
+ cwd = parent;
7664
+ }
7665
+ let here = dirname(fileURLToPath2(import.meta.url));
7666
+ for (; ; ) {
7667
+ roots.add(here);
7668
+ const parent = dirname(here);
7669
+ if (parent === here) break;
7670
+ here = parent;
7671
+ }
7672
+ return [...roots];
7453
7673
  }
7454
- function getApiUrl() {
7455
- const creds = readCredentials();
7456
- return creds?.api_url ?? process.env.ANYMORPH_API_URL ?? "https://api.anymorph.ai";
7674
+ async function ensureDirectory2(path2) {
7675
+ const s = await stat2(path2);
7676
+ if (!s.isDirectory()) throw new Error(`${path2} is not a directory`);
7457
7677
  }
7458
-
7459
- // src/lib/api-client.ts
7460
- async function apiRequest(method, path2, body, auth = true) {
7461
- const baseUrl = getApiUrl();
7462
- const headers = { "Content-Type": "application/json" };
7463
- if (auth) {
7464
- const creds = readCredentials();
7465
- if (!creds) throw new Error("Not logged in. Run `anymorph login` first.");
7466
- if (Date.now() / 1e3 > creds.expires_at - 300) {
7467
- await refreshToken(creds.refresh_token);
7468
- const fresh = readCredentials();
7469
- if (fresh) headers.Authorization = `Bearer ${fresh.access_token}`;
7470
- } else {
7471
- headers.Authorization = `Bearer ${creds.access_token}`;
7472
- }
7473
- }
7474
- return fetch(`${baseUrl}${path2}`, {
7475
- method,
7476
- headers,
7477
- body: body ? JSON.stringify(body) : void 0
7478
- });
7678
+ async function isDirectory(path2) {
7679
+ return stat2(path2).then((s) => s.isDirectory()).catch(() => false);
7479
7680
  }
7480
- async function refreshToken(token) {
7481
- const baseUrl = getApiUrl();
7482
- const res = await fetch(`${baseUrl}/api/cli/refresh`, {
7483
- method: "POST",
7484
- headers: { "Content-Type": "application/json" },
7485
- body: JSON.stringify({ refresh_token: token })
7486
- });
7487
- if (!res.ok) throw new Error("Session expired. Run `anymorph login` again.");
7488
- const data = await res.json();
7489
- const creds = readCredentials();
7490
- writeCredentials({
7491
- ...creds,
7492
- access_token: data.access_token,
7493
- refresh_token: data.refresh_token,
7494
- expires_at: Math.floor(Date.now() / 1e3) + data.expires_in
7495
- });
7681
+ async function exists(path2) {
7682
+ return stat2(path2).then(() => true).catch(() => false);
7496
7683
  }
7497
-
7498
- // src/commands/login.ts
7499
- async function loginCommand() {
7500
- console.log();
7501
- const spinner = ora("Requesting device code...").start();
7502
- let res;
7503
- try {
7504
- res = await apiRequest("POST", "/api/cli/device-code", {}, false);
7505
- } catch {
7506
- spinner.fail("Failed to connect. Check your internet connection.");
7507
- process.exit(1);
7684
+ var ACTIONS_SCHEMA = {
7685
+ $schema: "https://json-schema.org/draft/2020-12/schema",
7686
+ title: "Anymorph GEO actions artifact",
7687
+ type: "object",
7688
+ required: ["runId", "actions"],
7689
+ properties: {
7690
+ runId: { type: "string" },
7691
+ actions: { type: "array", items: { type: "object" } },
7692
+ artifactPaths: { type: "array", items: { type: "string" } }
7508
7693
  }
7509
- if (!res.ok) {
7510
- spinner.fail("Failed to get device code");
7511
- process.exit(1);
7694
+ };
7695
+ var MEMORY_ITEM_SCHEMA = {
7696
+ $schema: "https://json-schema.org/draft/2020-12/schema",
7697
+ title: "Anymorph GEO memory item",
7698
+ type: "object",
7699
+ required: ["summary"],
7700
+ properties: {
7701
+ summary: { type: "string" },
7702
+ evidence: { type: "array", items: { type: "string" } }
7512
7703
  }
7513
- const deviceCode = await res.json();
7514
- spinner.stop();
7515
- console.log(source_default2.bold("\n Your code: ") + source_default2.cyan.bold(deviceCode.user_code));
7516
- console.log(`
7517
- Opening ${source_default2.underline(deviceCode.verification_uri)}`);
7518
- console.log(source_default2.dim(" If browser doesn't open, visit the URL above.\n"));
7704
+ };
7705
+
7706
+ // src/geo/validate.ts
7707
+ import { access, readFile as readFile2 } from "node:fs/promises";
7708
+ import { join as join5 } from "node:path";
7709
+ async function validateGeoRunArtifacts(input) {
7710
+ const runDir = join5(input.repoPath, "agent", "runs", input.runId);
7711
+ const errors = [];
7712
+ const warnings = [];
7713
+ const manifest = await readJson2(join5(runDir, "manifest.json"), errors);
7714
+ const actions = await readJson2(join5(runDir, "actions.json"), errors);
7715
+ const status = await readJson2(join5(runDir, "status.json"), errors);
7716
+ await requireFile(join5(runDir, "rationale.md"), errors);
7717
+ if (manifest) validateManifest(manifest, input.runId, errors);
7718
+ if (actions) validateActions(actions, input.runId, errors);
7719
+ if (status) validateStatus(status, errors);
7720
+ return {
7721
+ ok: errors.length === 0,
7722
+ errors,
7723
+ warnings,
7724
+ runDir
7725
+ };
7726
+ }
7727
+ async function requireFile(path2, errors) {
7519
7728
  try {
7520
- await open_default(deviceCode.verification_uri);
7729
+ await access(path2);
7521
7730
  } catch {
7731
+ errors.push(`Missing ${shortPath(path2)}`);
7522
7732
  }
7523
- const pollSpinner = ora("Waiting for authorization...").start();
7524
- const startTime = Date.now();
7525
- const timeoutMs = deviceCode.expires_in * 1e3;
7526
- while (Date.now() - startTime < timeoutMs) {
7527
- await sleep(deviceCode.interval * 1e3);
7528
- const pollRes = await apiRequest(
7529
- "POST",
7530
- "/api/cli/token",
7531
- { device_code: deviceCode.device_code, grant_type: "device_code" },
7532
- false
7533
- );
7534
- if (pollRes.status === 428) continue;
7535
- if (pollRes.status === 410) {
7536
- pollSpinner.fail("Device code expired. Please try again.");
7537
- process.exit(1);
7733
+ }
7734
+ async function readJson2(path2, errors) {
7735
+ try {
7736
+ const raw = await readFile2(path2, "utf8");
7737
+ return JSON.parse(raw);
7738
+ } catch (err) {
7739
+ const message = err instanceof SyntaxError ? "Invalid JSON" : "Missing";
7740
+ errors.push(`${message} ${shortPath(path2)}`);
7741
+ return null;
7742
+ }
7743
+ }
7744
+ function validateManifest(value, runId, errors) {
7745
+ if (!isRecord(value)) {
7746
+ errors.push("manifest.json must be an object");
7747
+ return;
7748
+ }
7749
+ if (value.schemaVersion !== 1) errors.push("manifest.json schemaVersion must be 1");
7750
+ if (value.runId !== runId) errors.push(`manifest.json runId must be ${runId}`);
7751
+ if (typeof value.workspaceId !== "string") errors.push("manifest.json workspaceId is required");
7752
+ if (typeof value.workspaceDomain !== "string") {
7753
+ errors.push("manifest.json workspaceDomain is required");
7754
+ }
7755
+ if (value.execution !== "local") errors.push('manifest.json execution must be "local"');
7756
+ if (value.mode !== "bootstrap" && value.mode !== "normal") {
7757
+ errors.push('manifest.json mode must be "bootstrap" or "normal"');
7758
+ }
7759
+ if (typeof value.signature !== "string" || !value.signature.startsWith("sha256=")) {
7760
+ errors.push("manifest.json signature must start with sha256=");
7761
+ }
7762
+ if (!isRecord(value.tenantRepo)) {
7763
+ errors.push("manifest.json tenantRepo is required");
7764
+ return;
7765
+ }
7766
+ for (const key of ["owner", "repo", "branch"]) {
7767
+ if (typeof value.tenantRepo[key] !== "string") {
7768
+ errors.push(`manifest.json tenantRepo.${key} is required`);
7538
7769
  }
7539
- if (pollRes.ok) {
7540
- const token = await pollRes.json();
7541
- writeCredentials({
7542
- access_token: token.access_token,
7543
- refresh_token: token.refresh_token,
7544
- expires_at: Math.floor(Date.now() / 1e3) + token.expires_in,
7545
- api_url: getApiUrl(),
7546
- email: token.email
7547
- });
7548
- pollSpinner.succeed(source_default2.green(`Logged in as ${source_default2.bold(token.email)}`));
7549
- return;
7770
+ }
7771
+ }
7772
+ function validateActions(value, runId, errors) {
7773
+ if (!isRecord(value)) {
7774
+ errors.push("actions.json must be an object");
7775
+ return;
7776
+ }
7777
+ if (value.runId !== runId) errors.push(`actions.json runId must be ${runId}`);
7778
+ if (!Array.isArray(value.actions)) errors.push("actions.json actions must be an array");
7779
+ if (Array.isArray(value.actions)) validateActionItems(value.actions, errors);
7780
+ if (!Array.isArray(value.artifactPaths)) {
7781
+ errors.push("actions.json artifactPaths must be an array");
7782
+ return;
7783
+ }
7784
+ for (const path2 of value.artifactPaths) {
7785
+ if (typeof path2 !== "string") {
7786
+ errors.push("actions.json artifactPaths must contain strings only");
7787
+ continue;
7788
+ }
7789
+ if (!path2.startsWith(`agent/runs/${runId}/`) && !path2.startsWith("agent/archive/")) {
7790
+ errors.push(`actions.json artifact path is outside allowed GEO paths: ${path2}`);
7550
7791
  }
7551
- pollSpinner.fail("Unexpected error during login");
7552
- process.exit(1);
7553
7792
  }
7554
- pollSpinner.fail("Timed out waiting for authorization");
7555
- process.exit(1);
7556
7793
  }
7557
- function sleep(ms) {
7558
- return new Promise((resolve) => setTimeout(resolve, ms));
7794
+ function validateActionItems(actions, errors) {
7795
+ if (actions.length > 20) errors.push("actions.json actions must contain at most 20 items");
7796
+ actions.forEach((action, index) => validateActionItem(action, index, errors));
7559
7797
  }
7560
-
7561
- // src/lib/display.ts
7562
- function printVisibility(domain, data) {
7563
- const { dashboard, competitors, citations } = data;
7564
- const score = dashboard.visibilityScore?.value ?? 0;
7565
- const sov = dashboard.shareOfVoice?.value ?? 0;
7566
- const sentiment = dashboard.avgSentiment?.value ?? 0;
7567
- const mentions = dashboard.mentionCount?.value ?? 0;
7568
- console.log();
7569
- console.log(source_default2.bold(` AI Visibility \u2014 ${domain}`));
7570
- console.log(source_default2.dim(` ${"\u2500".repeat(40)}`));
7571
- console.log(` ${source_default2.bold("Score")} ${scoreColor(score)(source_default2.bold(String(Math.round(score))))} / 100`);
7572
- console.log(` ${source_default2.bold("Share of Voice")} ${source_default2.white(Math.round(sov * 100) + "%")}`);
7573
- console.log(` ${source_default2.bold("Mentions")} ${source_default2.white(String(mentions))}`);
7574
- console.log(` ${source_default2.bold("Sentiment")} ${sentimentLabel(sentiment)}`);
7575
- if (dashboard.engineVisibility?.length) {
7576
- console.log();
7577
- console.log(source_default2.bold(" Engine Breakdown"));
7578
- for (const eng of dashboard.engineVisibility) {
7579
- const barLen = Math.round((eng.score ?? 0) / 10);
7580
- const bar = "\u2588".repeat(barLen);
7581
- const empty = "\u2591".repeat(10 - barLen);
7582
- console.log(` ${bar}${empty} ${eng.engine}`);
7798
+ function validateActionItem(action, index, errors) {
7799
+ const prefix = `actions.json actions[${index}]`;
7800
+ if (!isRecord(action)) {
7801
+ errors.push(`${prefix} must be an object`);
7802
+ return;
7803
+ }
7804
+ requireString(action, "id", prefix, errors);
7805
+ requireEnum(action, "operation", ["create", "update"], prefix, errors);
7806
+ requireEnum(action, "surface", ["on_page", "off_page"], prefix, errors);
7807
+ requireEnum(action, "assetType", ["brand_owned", "geo_page", "third_party"], prefix, errors);
7808
+ validateIntentRef(action, prefix, errors);
7809
+ validateTarget(action, prefix, errors);
7810
+ requireString(action, "objective", prefix, errors);
7811
+ requireString(action, "changeBrief", prefix, errors);
7812
+ requireString(action, "reason", prefix, errors);
7813
+ requireString(action, "expectedOutcome", prefix, errors);
7814
+ validateEvidence(action.evidence, prefix, errors);
7815
+ requireEnum(action, "priority", ["high", "medium", "low"], prefix, errors);
7816
+ requireEnum(action, "confidence", ["high", "medium", "low"], prefix, errors);
7817
+ }
7818
+ function validateIntentRef(action, prefix, errors) {
7819
+ if (action.intentId !== null && typeof action.intentId !== "string") {
7820
+ errors.push(`${prefix}.intentId must be a string or null`);
7821
+ }
7822
+ if (action.intentId === null) {
7823
+ if (!isRecord(action.proposedIntent)) {
7824
+ errors.push(`${prefix}.proposedIntent is required when intentId is null`);
7825
+ return;
7583
7826
  }
7827
+ requireString(action.proposedIntent, "name", `${prefix}.proposedIntent`, errors);
7828
+ requireString(action.proposedIntent, "reason", `${prefix}.proposedIntent`, errors);
7584
7829
  }
7585
- if (competitors?.length) {
7586
- console.log();
7587
- console.log(source_default2.bold(" Competitors"));
7588
- for (const comp of competitors) {
7589
- const marker = comp.isPrimary ? source_default2.cyan(" \u2190 you") : "";
7590
- console.log(` ${comp.name.padEnd(20)} ${Math.round(comp.sov * 100)}% SoV${marker}`);
7830
+ }
7831
+ function validateTarget(action, prefix, errors) {
7832
+ const target = action.target;
7833
+ if (!isRecord(target)) {
7834
+ errors.push(`${prefix}.target must be an object`);
7835
+ return;
7836
+ }
7837
+ if (action.operation === "create") {
7838
+ if (typeof target.url === "string" && target.url.length > 0) {
7839
+ errors.push(`${prefix}.target.url must be omitted for create actions`);
7840
+ }
7841
+ if (typeof target.pageId === "string" && target.pageId.length > 0) {
7842
+ errors.push(`${prefix}.target.pageId must be omitted for create actions`);
7843
+ }
7844
+ if (!Array.isArray(target.queryCluster) && typeof target.description !== "string") {
7845
+ errors.push(`${prefix}.target needs queryCluster or description for create actions`);
7591
7846
  }
7592
7847
  }
7593
- if (citations?.length) {
7594
- console.log();
7595
- console.log(source_default2.bold(" Citations"));
7596
- for (const cit of citations.slice(0, 5)) {
7597
- console.log(` ${cit.url.padEnd(35)} ${cit.count}x`);
7848
+ if (action.operation === "update") {
7849
+ const hasUrl = typeof target.url === "string" && target.url.length > 0;
7850
+ const hasPageId = typeof target.pageId === "string" && target.pageId.length > 0;
7851
+ if (!hasUrl && !hasPageId) {
7852
+ errors.push(`${prefix}.target needs pageId or url for update actions`);
7598
7853
  }
7599
7854
  }
7600
- console.log();
7601
7855
  }
7602
- function scoreColor(score) {
7603
- if (score >= 85) return source_default2.green;
7604
- if (score >= 70) return source_default2.greenBright;
7605
- if (score >= 50) return source_default2.yellow;
7606
- if (score >= 30) return source_default2.hex("#FF8800");
7607
- return source_default2.red;
7856
+ function validateEvidence(value, prefix, errors) {
7857
+ if (!Array.isArray(value)) {
7858
+ errors.push(`${prefix}.evidence must be an array`);
7859
+ return;
7860
+ }
7861
+ value.forEach((item, index) => {
7862
+ const evidencePrefix = `${prefix}.evidence[${index}]`;
7863
+ if (!isRecord(item)) {
7864
+ errors.push(`${evidencePrefix} must be an object`);
7865
+ return;
7866
+ }
7867
+ requireEnum(item, "type", ["signal", "workspace", "source", "research"], evidencePrefix, errors);
7868
+ requireString(item, "ref", evidencePrefix, errors);
7869
+ requireString(item, "summary", evidencePrefix, errors);
7870
+ });
7608
7871
  }
7609
- function sentimentLabel(score) {
7610
- if (score > 0.3) return source_default2.green("Positive");
7611
- if (score > -0.3) return source_default2.yellow("Neutral");
7612
- return source_default2.red("Negative");
7872
+ function requireString(record, key, prefix, errors) {
7873
+ if (typeof record[key] !== "string" || record[key].length === 0) {
7874
+ errors.push(`${prefix}.${key} must be a non-empty string`);
7875
+ }
7876
+ }
7877
+ function requireEnum(record, key, allowed, prefix, errors) {
7878
+ if (typeof record[key] !== "string" || !allowed.includes(record[key])) {
7879
+ errors.push(`${prefix}.${key} must be one of ${allowed.join(", ")}`);
7880
+ }
7881
+ }
7882
+ function validateStatus(value, errors) {
7883
+ if (!isRecord(value)) {
7884
+ errors.push("status.json must be an object");
7885
+ return;
7886
+ }
7887
+ if (value.status !== "proposed") errors.push('status.json status must be "proposed"');
7888
+ }
7889
+ function isRecord(value) {
7890
+ return value !== null && typeof value === "object" && !Array.isArray(value);
7891
+ }
7892
+ function shortPath(path2) {
7893
+ const marker = `${String.raw`agent/runs`}/`;
7894
+ const index = path2.indexOf(marker);
7895
+ return index >= 0 ? path2.slice(index) : path2;
7613
7896
  }
7614
7897
 
7615
- // src/commands/check.ts
7616
- var STEPS = ["Setting up workspace", "Generating prompts", "Querying AI engines", "Analyzing responses"];
7617
- async function checkCommand(domain, opts) {
7618
- let spinner = ora(`Checking AI visibility for ${source_default2.bold(domain)}...`).start();
7619
- let res;
7898
+ // src/commands/geo.ts
7899
+ function buildGeoCommand() {
7900
+ const geo = new Command("geo").description("Manage local GEO repo setup and strategy runs");
7901
+ geo.command("init").description("Initialize GEO scaffold and skills in a tenant repo").option("--repo <path>", "Tenant repo path", ".").option("--skills-source <path>", "Use an explicit GEO skillpack source directory").option("--ref <ref>", "Skillpack ref label to write into agent/skillpack.json", "local").option("--json", "Output as JSON").action(geoInitCommand);
7902
+ geo.command("sync").description("Sync managed GEO scaffold files without touching memory or run artifacts").option("--repo <path>", "Tenant repo path", ".").option("--skills-source <path>", "Use an explicit GEO skillpack source directory").option("--ref <ref>", "Skillpack ref label to write into agent/skillpack.json", "local").option("--json", "Output as JSON").action(geoSyncCommand);
7903
+ geo.command("doctor").description("Check whether a tenant repo GEO scaffold matches the installed skillpack").option("--repo <path>", "Tenant repo path", ".").option("--skills-source <path>", "Use an explicit GEO skillpack source directory").option("--json", "Output as JSON").action(geoDoctorCommand);
7904
+ geo.command("prepare <workspace>").description("Prepare a local GEO strategy run package").option("--repo <path>", "Use an explicit tenant repo path").option("--days <days>", "Signal lookback window in days", parsePositiveInt).option("--skills-source <path>", "Use an explicit GEO skillpack source directory").option("--skip-scaffold", "Skip GEO scaffold sync before writing the run package").option("--json", "Output as JSON").action(geoPrepareCommand);
7905
+ geo.command("validate <runId>").description("Validate local GEO strategy run artifacts before pushing").option("--repo <path>", "Use an explicit tenant repo path").option("--json", "Output as JSON").action(geoValidateCommand);
7906
+ geo.command("intents <runId>").description("Show the pre-fetched intents for a local GEO strategy run").option("--repo <path>", "Use an explicit tenant repo path").option("--json", "Output as JSON").action(geoIntentsCommand);
7907
+ geo.command("status <runId>").description("Show backend sync status for a GEO strategy run").option("--json", "Output as JSON").action(geoStatusCommand);
7908
+ return geo;
7909
+ }
7910
+ async function geoInitCommand(opts) {
7620
7911
  try {
7621
- res = await apiRequest("POST", "/api/cli/check", { domain });
7912
+ const result = await initGeoScaffold({
7913
+ repoPath: opts.repo,
7914
+ skillsSourceDir: opts.skillsSource,
7915
+ ref: opts.ref
7916
+ });
7917
+ printScaffoldResult("Initialized GEO scaffold", result, opts.json);
7622
7918
  } catch (err) {
7623
- spinner.fail(err instanceof Error ? err.message : "Failed to connect. Check your internet connection.");
7919
+ printScaffoldError("Couldn't initialize GEO scaffold", err);
7920
+ }
7921
+ }
7922
+ async function geoSyncCommand(opts) {
7923
+ try {
7924
+ const result = await syncGeoScaffold({
7925
+ repoPath: opts.repo,
7926
+ skillsSourceDir: opts.skillsSource,
7927
+ ref: opts.ref
7928
+ });
7929
+ printScaffoldResult("Synced GEO scaffold", result, opts.json);
7930
+ } catch (err) {
7931
+ printScaffoldError("Couldn't sync GEO scaffold", err);
7932
+ }
7933
+ }
7934
+ async function geoDoctorCommand(opts) {
7935
+ try {
7936
+ const result = await doctorGeoScaffold({
7937
+ repoPath: opts.repo,
7938
+ skillsSourceDir: opts.skillsSource
7939
+ });
7940
+ if (opts.json) {
7941
+ console.log(JSON.stringify(result, null, 2));
7942
+ process.exit(result.ok ? 0 : 1);
7943
+ }
7944
+ if (result.ok) {
7945
+ console.log(source_default.green("\n GEO scaffold is healthy.\n"));
7946
+ return;
7947
+ }
7948
+ console.error(source_default.red("\n GEO scaffold has drift\n"));
7949
+ for (const problem of result.problems) console.error(` - ${problem}`);
7950
+ console.error();
7624
7951
  process.exit(1);
7952
+ } catch (err) {
7953
+ printScaffoldError("Couldn't check GEO scaffold", err);
7625
7954
  }
7955
+ }
7956
+ async function geoPrepareCommand(workspace, opts) {
7957
+ const res = await apiRequest("POST", "/api/cli/geo-strategy/prepare", {
7958
+ workspace,
7959
+ days: opts.days
7960
+ });
7626
7961
  if (!res.ok) {
7627
- const body = await res.json().catch(() => ({}));
7628
- spinner.fail(
7629
- res.status === 401 ? "Not authenticated. Run `anymorph login` first." : res.status === 403 || body.error === "EMAIL_DOMAIN_MISMATCH" ? body.message || "Domain doesn't match your email." : body.status === "limit_exceeded" ? body.message || "Free check used. Upgrade to continue." : "Check failed."
7630
- );
7962
+ await printApiFailure(res, "Couldn't prepare GEO strategy package");
7631
7963
  process.exit(1);
7632
7964
  }
7633
- const result = await res.json();
7634
- if (result.status === "complete") {
7635
- spinner.stop();
7636
- if (opts.json) {
7637
- console.log(JSON.stringify(result, null, 2));
7638
- } else {
7639
- printVisibility(domain, result.data);
7640
- console.log(source_default2.dim(` Dashboard: https://dashboard.anymorph.ai/w/${result.workspaceId}/overview
7641
- `));
7965
+ const pkg = await res.json();
7966
+ let repoPath;
7967
+ let runDir;
7968
+ try {
7969
+ repoPath = await prepareTenantRepo({ package: pkg, repo: opts.repo });
7970
+ if (!opts.skipScaffold) {
7971
+ await initGeoScaffold({
7972
+ repoPath,
7973
+ skillsSourceDir: opts.skillsSource,
7974
+ ref: pkg.branch
7975
+ });
7642
7976
  }
7977
+ ({ runDir } = await writeGeoRunPackage({ repoPath, package: pkg }));
7978
+ } catch (err) {
7979
+ const message = err instanceof Error ? err.message : String(err);
7980
+ console.error(source_default.red(`Couldn't initialize local tenant repo: ${message}`));
7981
+ process.exit(1);
7982
+ }
7983
+ const output = {
7984
+ runId: pkg.runId,
7985
+ workspaceId: pkg.workspaceId,
7986
+ workspaceDomain: pkg.workspaceDomain,
7987
+ repoPath,
7988
+ runDir
7989
+ };
7990
+ if (opts.json) {
7991
+ console.log(JSON.stringify(output, null, 2));
7643
7992
  return;
7644
7993
  }
7645
- if (result.status === "analyzing" && result.jobId) {
7646
- spinner.text = `${STEPS[0]}...`;
7647
- let currentStep = 0;
7648
- while (true) {
7649
- await sleep2(5e3);
7650
- const pollRes = await apiRequest("GET", `/api/cli/check/${result.jobId}`);
7651
- if (!pollRes.ok) {
7652
- spinner.fail("Failed to check analysis status.");
7653
- process.exit(1);
7654
- }
7655
- const status = await pollRes.json();
7656
- if (status.status === "complete") {
7657
- spinner.succeed(STEPS[currentStep]);
7658
- console.log();
7659
- if (opts.json) {
7660
- console.log(JSON.stringify(status, null, 2));
7661
- } else {
7662
- printVisibility(domain, status.data);
7663
- console.log(source_default2.dim(` Dashboard: https://dashboard.anymorph.ai/w/${status.workspaceId}/overview
7994
+ console.log();
7995
+ console.log(source_default.green.bold(" Prepared GEO package"));
7996
+ console.log(` ${source_default.bold("Workspace:")} ${pkg.workspaceDomain}`);
7997
+ console.log(` ${source_default.bold("Run ID:")} ${pkg.runId}`);
7998
+ console.log(` ${source_default.bold("Repo:")} ${repoPath}`);
7999
+ console.log(` ${source_default.bold("Path:")} agent/runs/${pkg.runId}`);
8000
+ console.log();
8001
+ console.log(source_default.bold(" Next:"));
8002
+ console.log(source_default.dim(` cd ${repoPath}`));
8003
+ console.log(source_default.dim(" codex"));
8004
+ console.log(source_default.dim(` anymorph geo validate ${pkg.runId} --repo .`));
8005
+ console.log(source_default.dim(" git push origin main"));
8006
+ console.log();
8007
+ }
8008
+ async function geoValidateCommand(runId, opts) {
8009
+ const repoPath = opts.repo ?? await findRepoForRun(runId);
8010
+ if (!repoPath) {
8011
+ console.error(source_default.red(`Could not find local repo for run ${runId}. Pass --repo <path>.`));
8012
+ process.exit(1);
8013
+ }
8014
+ const result = await validateGeoRunArtifacts({ repoPath, runId });
8015
+ const git = await gitInfo(repoPath);
8016
+ const errors = [...result.errors];
8017
+ if (git.branch && git.branch !== "main") {
8018
+ errors.push(`Current branch is ${git.branch}, expected main`);
8019
+ }
8020
+ const ok = result.ok && errors.length === 0;
8021
+ if (opts.json) {
8022
+ console.log(JSON.stringify({ ...result, ok, errors, git, repoPath }, null, 2));
8023
+ process.exit(ok ? 0 : 1);
8024
+ }
8025
+ if (ok) {
8026
+ console.log(source_default.green(`
8027
+ GEO run ${runId} is valid for push.
7664
8028
  `));
7665
- }
7666
- return;
7667
- }
7668
- if (status.status === "failed") {
7669
- spinner.fail(status.message || "Analysis failed.");
7670
- process.exit(1);
7671
- }
7672
- if (status.progress) {
7673
- const pct = Math.round(status.progress.completed / Math.max(status.progress.total, 1) * 100);
7674
- const stepIdx = pct < 10 ? 0 : pct < 30 ? 1 : pct < 90 ? 2 : 3;
7675
- if (stepIdx !== currentStep) {
7676
- spinner.succeed(STEPS[currentStep]);
7677
- currentStep = stepIdx;
7678
- spinner = ora(`${STEPS[currentStep]}...`).start();
7679
- }
7680
- spinner.text = `${STEPS[currentStep]}... (${status.progress.completed}/${status.progress.total} tasks)`;
7681
- }
7682
- }
8029
+ return;
7683
8030
  }
7684
- spinner.fail(result.message || "Unexpected response.");
8031
+ console.error(source_default.red("\n Validation failed\n"));
8032
+ for (const error of errors) console.error(` - ${error}`);
8033
+ console.error();
7685
8034
  process.exit(1);
7686
8035
  }
7687
- function sleep2(ms) {
7688
- return new Promise((resolve) => setTimeout(resolve, ms));
8036
+ async function geoIntentsCommand(runId, opts) {
8037
+ const repoPath = opts.repo ?? await findRepoForRun(runId);
8038
+ if (!repoPath) {
8039
+ console.error(source_default.red(`Could not find local repo for run ${runId}. Pass --repo <path>.`));
8040
+ process.exit(1);
8041
+ }
8042
+ let payload;
8043
+ try {
8044
+ payload = await readGeoIntentList(join6(repoPath, "agent", "runs", runId));
8045
+ } catch (err) {
8046
+ const message = err instanceof Error ? err.message : String(err);
8047
+ console.error(source_default.red(`Couldn't read intents for run ${runId}: ${message}`));
8048
+ process.exit(1);
8049
+ }
8050
+ if (opts.json) {
8051
+ console.log(JSON.stringify(payload, null, 2));
8052
+ return;
8053
+ }
8054
+ console.log();
8055
+ console.log(source_default.bold(` GEO intents for ${runId}`));
8056
+ console.log(` ${source_default.bold("Workspace:")} ${payload.workspaceDomain ?? payload.workspaceId ?? "unknown"}`);
8057
+ console.log(` ${source_default.bold("Count:")} ${payload.intents.length}`);
8058
+ console.log();
8059
+ for (const intent of payload.intents) {
8060
+ const row = intent && typeof intent === "object" ? intent : {};
8061
+ const id = stringValue(row.id ?? row.intentId ?? row.intent_id) ?? "unknown";
8062
+ const name = stringValue(row.name ?? row.intentName ?? row.intent_name) ?? "(unnamed)";
8063
+ const type = stringValue(row.type ?? row.intentType ?? row.intent_type);
8064
+ const visibility = numberValue(row.currentVisibility ?? row.current_visibility);
8065
+ const competitor = numberValue(row.competitorVisibility ?? row.competitor_visibility);
8066
+ const details = [
8067
+ type ? `type=${type}` : null,
8068
+ visibility !== null ? `visibility=${formatPct(visibility)}` : null,
8069
+ competitor !== null ? `competitor=${formatPct(competitor)}` : null
8070
+ ].filter(Boolean).join(", ");
8071
+ console.log(` - ${name} ${source_default.dim(`(${id})`)}${details ? source_default.dim(` - ${details}`) : ""}`);
8072
+ }
8073
+ console.log();
7689
8074
  }
7690
-
7691
- // src/commands/status.ts
7692
- async function statusCommand() {
7693
- const creds = readCredentials();
7694
- if (!creds) {
7695
- console.log(source_default2.yellow("\n Not logged in. Run `anymorph login` to get started.\n"));
8075
+ async function geoStatusCommand(runId, opts) {
8076
+ const res = await apiRequest("GET", `/api/cli/geo-strategy/runs/${encodeURIComponent(runId)}`);
8077
+ if (!res.ok) {
8078
+ await printApiFailure(res, "Couldn't fetch GEO strategy run status");
8079
+ process.exit(1);
8080
+ }
8081
+ const payload = await res.json();
8082
+ if (opts.json) {
8083
+ console.log(JSON.stringify(payload, null, 2));
7696
8084
  return;
7697
8085
  }
7698
- console.log(`
7699
- ${source_default2.bold("Email:")} ${creds.email}`);
7700
- console.log(` ${source_default2.bold("API:")} ${creds.api_url}`);
7701
- const expiresIn = creds.expires_at - Math.floor(Date.now() / 1e3);
7702
- if (expiresIn > 0) {
7703
- const hours = Math.floor(expiresIn / 3600);
7704
- console.log(` ${source_default2.bold("Token:")} valid (${hours}h remaining)`);
7705
- } else {
7706
- console.log(` ${source_default2.bold("Token:")} ${source_default2.yellow("expired (will auto-refresh)")}`);
8086
+ console.log();
8087
+ console.log(source_default.bold(` GEO run ${runId}`));
8088
+ console.log(` ${source_default.bold("Status:")} ${payload.status ?? "unknown"}`);
8089
+ const commitSha = payload.commitSha;
8090
+ if (commitSha) console.log(` ${source_default.bold("Commit:")} ${commitSha}`);
8091
+ console.log();
8092
+ }
8093
+ function parsePositiveInt(value) {
8094
+ const parsed = Number(value);
8095
+ if (!Number.isInteger(parsed) || parsed <= 0) {
8096
+ throw new Error(`Expected a positive integer, got ${value}`);
7707
8097
  }
8098
+ return parsed;
8099
+ }
8100
+ async function readGeoIntentList(runDir) {
7708
8101
  try {
7709
- const res = await apiRequest("GET", "/api/cli/status");
7710
- if (res.ok) {
7711
- const data = await res.json();
7712
- if (data.workspaces?.length) {
7713
- console.log(`
7714
- ${source_default2.bold("Workspaces:")}`);
7715
- for (const ws of data.workspaces) {
7716
- console.log(` ${ws.domain} ${source_default2.dim(`(${ws.name})`)}`);
7717
- }
7718
- }
8102
+ const raw = await readFile3(join6(runDir, "intents.json"), "utf8");
8103
+ const parsed = JSON.parse(raw);
8104
+ if (parsed && typeof parsed === "object" && Array.isArray(parsed.intents)) {
8105
+ return parsed;
7719
8106
  }
7720
- } catch {
8107
+ throw new Error("intents.json does not contain an intents array");
8108
+ } catch (err) {
8109
+ const contextRaw = await readFile3(join6(runDir, "context.json"), "utf8").catch(() => null);
8110
+ if (!contextRaw) throw err;
8111
+ const context = JSON.parse(contextRaw);
8112
+ return {
8113
+ runId: context.runId,
8114
+ workspaceId: context.workspaceId,
8115
+ workspaceDomain: context.workspaceDomain,
8116
+ intents: Array.isArray(context.signals?.intents) ? context.signals.intents : []
8117
+ };
8118
+ }
8119
+ }
8120
+ function stringValue(value) {
8121
+ return typeof value === "string" && value.length > 0 ? value : null;
8122
+ }
8123
+ function numberValue(value) {
8124
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
8125
+ }
8126
+ function formatPct(value) {
8127
+ return `${(value * 100).toFixed(1)}%`;
8128
+ }
8129
+ async function printApiFailure(res, fallback2) {
8130
+ const body = await res.json().catch(() => null);
8131
+ console.error(source_default.red(body?.message ?? body?.error ?? fallback2));
8132
+ }
8133
+ function printScaffoldResult(title, result, json) {
8134
+ if (json) {
8135
+ console.log(JSON.stringify(result, null, 2));
8136
+ process.exit(result.ok ? 0 : 1);
8137
+ }
8138
+ console.log();
8139
+ console.log(source_default.green.bold(` ${title}`));
8140
+ console.log(` ${source_default.bold("Repo:")} ${result.repoPath}`);
8141
+ console.log(` ${source_default.bold("Skillpack:")} ${result.skillsSourceDir}`);
8142
+ console.log(` ${source_default.bold("Hash:")} ${result.manifestHash}`);
8143
+ if (result.changed.length > 0) {
8144
+ console.log();
8145
+ console.log(source_default.bold(" Changed:"));
8146
+ for (const path2 of result.changed) console.log(` - ${path2}`);
8147
+ } else {
8148
+ console.log();
8149
+ console.log(source_default.dim(" No file changes."));
7721
8150
  }
7722
8151
  console.log();
7723
8152
  }
7724
-
7725
- // src/commands/logout.ts
7726
- function logoutCommand() {
7727
- clearCredentials();
7728
- console.log(source_default2.green("\n Logged out.\n"));
8153
+ function printScaffoldError(prefix, err) {
8154
+ const message = err instanceof Error ? err.message : String(err);
8155
+ console.error(source_default.red(`${prefix}: ${message}`));
8156
+ process.exit(1);
7729
8157
  }
7730
8158
 
7731
8159
  // src/index.ts
7732
8160
  var program2 = new Command();
7733
- program2.name("anymorph").description("Check your brand's AI visibility \u2014 powered by Anymorph").version("0.1.0");
8161
+ program2.name("anymorph").description("Check your brand's AI visibility \u2014 powered by Anymorph").version("0.2.0");
7734
8162
  program2.command("login").description("Sign in to your Anymorph account").action(loginCommand);
7735
8163
  program2.command("check <domain>").description("Check AI visibility for a domain").option("--json", "Output as JSON").action(checkCommand);
7736
8164
  program2.command("status").description("Show current auth status").action(statusCommand);
8165
+ program2.command("workspaces").description("List workspaces available to the current account").option("--json", "Output as JSON").action(workspacesCommand);
7737
8166
  program2.command("logout").description("Sign out and clear credentials").action(logoutCommand);
8167
+ program2.addCommand(buildGeoCommand());
7738
8168
  program2.parse();