anymorph 0.2.5 → 0.2.6

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 (2) hide show
  1. package/dist/index.js +57 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7366,6 +7366,23 @@ async function findRepoForRun(runId) {
7366
7366
  }
7367
7367
  return null;
7368
7368
  }
7369
+ async function hasLocalGeoActionRuns(repoPath) {
7370
+ let entries;
7371
+ try {
7372
+ entries = await readdir(join3(resolve(repoPath), "agent", "runs"), {
7373
+ withFileTypes: true
7374
+ });
7375
+ } catch {
7376
+ return false;
7377
+ }
7378
+ for (const entry of entries) {
7379
+ if (!entry.isDirectory()) continue;
7380
+ const runPath = join3(resolve(repoPath), "agent", "runs", entry.name);
7381
+ if (await exists(join3(runPath, "actions.json"))) return true;
7382
+ if (await exists(join3(runPath, "manifest.json"))) return true;
7383
+ }
7384
+ return false;
7385
+ }
7369
7386
  async function gitInfo(repoPath) {
7370
7387
  return {
7371
7388
  branch: await gitOutput(repoPath, ["branch", "--show-current"]),
@@ -7397,6 +7414,9 @@ async function ensureDirectory(path2) {
7397
7414
  const s = await stat(path2);
7398
7415
  if (!s.isDirectory()) throw new Error(`${path2} is not a directory`);
7399
7416
  }
7417
+ async function exists(path2) {
7418
+ return stat(path2).then(() => true).catch(() => false);
7419
+ }
7400
7420
  async function gitOutput(repoPath, args) {
7401
7421
  try {
7402
7422
  const { stdout } = await execFileAsync5("git", args, { cwd: repoPath });
@@ -7453,7 +7473,7 @@ async function doctorGeoScaffold(input) {
7453
7473
  "agent/archive/.gitkeep",
7454
7474
  "agent/skillpack.json"
7455
7475
  ]) {
7456
- if (!await exists(join4(repoPath, path2))) problems.push(`Missing ${path2}`);
7476
+ if (!await exists2(join4(repoPath, path2))) problems.push(`Missing ${path2}`);
7457
7477
  }
7458
7478
  const lock = await readJson(join4(repoPath, "agent", "skillpack.json"));
7459
7479
  if (lock && typeof lock === "object") {
@@ -7597,7 +7617,7 @@ async function compareDirectories(sourceDir, targetDir, displayPrefix, problems)
7597
7617
  for (const file of sourceFiles) {
7598
7618
  const source = await readFile(join4(sourceDir, file), "utf8");
7599
7619
  const targetPath = join4(targetDir, file);
7600
- if (!await exists(targetPath)) {
7620
+ if (!await exists2(targetPath)) {
7601
7621
  problems.push(`Missing ${displayPrefix}/${file}`);
7602
7622
  continue;
7603
7623
  }
@@ -7635,7 +7655,7 @@ async function listFiles(dir, base = "") {
7635
7655
  return files.sort();
7636
7656
  }
7637
7657
  async function writeIfMissing(path2, content, changed) {
7638
- if (await exists(path2)) return;
7658
+ if (await exists2(path2)) return;
7639
7659
  await mkdir3(dirname(path2), { recursive: true });
7640
7660
  await writeFile2(path2, content);
7641
7661
  changed.push(relative(process.cwd(), path2) || path2);
@@ -7698,7 +7718,7 @@ async function ensureDirectory2(path2) {
7698
7718
  async function isDirectory(path2) {
7699
7719
  return stat2(path2).then((s) => s.isDirectory()).catch(() => false);
7700
7720
  }
7701
- async function exists(path2) {
7721
+ async function exists2(path2) {
7702
7722
  return stat2(path2).then(() => true).catch(() => false);
7703
7723
  }
7704
7724
  var ACTIONS_SCHEMA = {
@@ -7974,12 +7994,17 @@ async function geoDoctorCommand(opts) {
7974
7994
  }
7975
7995
  }
7976
7996
  async function geoPrepareCommand(workspace, opts) {
7997
+ const hasActionRuns = opts.repo ? await hasLocalGeoActionRuns(opts.repo) : void 0;
7977
7998
  const res = await apiRequest("POST", "/api/cli/geo-strategy/prepare", {
7978
7999
  workspace,
7979
- days: opts.days
8000
+ days: opts.days,
8001
+ hasActionRuns
7980
8002
  });
7981
8003
  if (!res.ok) {
7982
- await printApiFailure(res, "Couldn't prepare GEO strategy package");
8004
+ await printApiFailure(res, "Couldn't prepare GEO strategy package", {
8005
+ method: "POST",
8006
+ path: "/api/cli/geo-strategy/prepare"
8007
+ });
7983
8008
  process.exit(1);
7984
8009
  }
7985
8010
  const pkg = await res.json();
@@ -8095,7 +8120,10 @@ async function geoIntentsCommand(runId, opts) {
8095
8120
  async function geoStatusCommand(runId, opts) {
8096
8121
  const res = await apiRequest("GET", `/api/cli/geo-strategy/runs/${encodeURIComponent(runId)}`);
8097
8122
  if (!res.ok) {
8098
- await printApiFailure(res, "Couldn't fetch GEO strategy run status");
8123
+ await printApiFailure(res, "Couldn't fetch GEO strategy run status", {
8124
+ method: "GET",
8125
+ path: `/api/cli/geo-strategy/runs/${encodeURIComponent(runId)}`
8126
+ });
8099
8127
  process.exit(1);
8100
8128
  }
8101
8129
  const payload = await res.json();
@@ -8146,9 +8174,28 @@ function numberValue(value) {
8146
8174
  function formatPct(value) {
8147
8175
  return `${(value * 100).toFixed(1)}%`;
8148
8176
  }
8149
- async function printApiFailure(res, fallback2) {
8177
+ function formatApiFailure(body, fallback2, meta = {}) {
8178
+ const message = typeof body?.message === "string" ? body.message : typeof body?.error === "string" ? body.error : fallback2;
8179
+ const details = [];
8180
+ if (typeof body?.requestId === "string") details.push(`Request ID: ${body.requestId}`);
8181
+ const status = typeof body?.statusCode === "number" ? body.statusCode : meta.status;
8182
+ if (typeof status === "number") details.push(`Status: ${status}`);
8183
+ if (meta.method && meta.path) details.push(`Endpoint: ${meta.method} ${meta.path}`);
8184
+ return details.length > 0 ? `${message}
8185
+ ${details.join("\n")}` : message;
8186
+ }
8187
+ async function printApiFailure(res, fallback2, meta = {}) {
8150
8188
  const body = await res.json().catch(() => null);
8151
- console.error(source_default.red(body?.message ?? body?.error ?? fallback2));
8189
+ const url = res.url ? new URL(res.url) : null;
8190
+ console.error(
8191
+ source_default.red(
8192
+ formatApiFailure(body, fallback2, {
8193
+ method: meta.method,
8194
+ path: meta.path ?? (url ? `${url.pathname}${url.search}` : void 0),
8195
+ status: res.status
8196
+ })
8197
+ )
8198
+ );
8152
8199
  }
8153
8200
  function printScaffoldResult(title, result, json) {
8154
8201
  if (json) {
@@ -8178,7 +8225,7 @@ function printScaffoldError(prefix, err) {
8178
8225
 
8179
8226
  // src/index.ts
8180
8227
  var program2 = new Command();
8181
- program2.name("anymorph").description("Check your brand's AI visibility \u2014 powered by Anymorph").version("0.2.5");
8228
+ program2.name("anymorph").description("Check your brand's AI visibility \u2014 powered by Anymorph").version("0.2.6");
8182
8229
  program2.command("login").description("Sign in to your Anymorph account").action(loginCommand);
8183
8230
  program2.command("check <domain>").description("Check AI visibility for a domain").option("--json", "Output as JSON").action(checkCommand);
8184
8231
  program2.command("status").description("Show current auth status").action(statusCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymorph",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Check your brand's AI visibility across ChatGPT, Perplexity, Gemini, and more",
5
5
  "type": "module",
6
6
  "private": false,