agentimization 0.2.0 → 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 (2) hide show
  1. package/dist/index.js +64 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7670,31 +7670,57 @@ import { Box as Box4, Text as Text4, useApp, useInput } from "ink";
7670
7670
  // src/ui/agent-prompt.ts
7671
7671
  import { execSync } from "child_process";
7672
7672
  import { platform } from "os";
7673
- var CATEGORY_LABELS2 = {
7674
- "content-discoverability": "Content Discoverability",
7675
- "markdown-availability": "Markdown Availability",
7676
- "content-structure": "Content Structure",
7677
- "page-size": "Page Size & Rendering",
7678
- "url-stability": "URL Stability",
7679
- "authentication": "Authentication & Access",
7680
- "geo-signals": "GEO Signals",
7681
- "agent-protocols": "Agent Protocols"
7682
- };
7683
- var statusEmoji = (status) => {
7673
+ var statusMarker = (status) => {
7684
7674
  switch (status) {
7685
7675
  case "pass":
7686
- return "\u2705";
7676
+ return "PASS";
7687
7677
  case "warn":
7688
- return "\u26A0\uFE0F";
7678
+ return "WARN";
7689
7679
  case "fail":
7690
- return "\u274C";
7680
+ return "FAIL";
7691
7681
  case "skip":
7692
- return "\u23ED\uFE0F";
7682
+ return "SKIP";
7693
7683
  case "info":
7694
- return "\u2139\uFE0F";
7695
- }
7696
- };
7697
- var buildIssuesBlock = (result, opts) => {
7684
+ return "INFO";
7685
+ }
7686
+ };
7687
+ var RATIONALE_LEAD = /^(generative engines|ai (agents|engines|crawlers|search)|this |these |without (it|this)|used by|some agents|blocked agents|missing content|each redirect|citing sources|shorter descriptions|the more context)\b/i;
7688
+ var terseSuggestion = (suggestion) => {
7689
+ const sentences = suggestion.split(/(?<=\.)\s+(?=[A-Z])/);
7690
+ const kept = [];
7691
+ const rescuedUrls = [];
7692
+ for (const raw of sentences) {
7693
+ const s = raw.trim();
7694
+ if (!s) continue;
7695
+ if (RATIONALE_LEAD.test(s)) {
7696
+ const url = s.match(/https?:\/\/\S+/)?.[0];
7697
+ if (url && !suggestion.slice(0, suggestion.indexOf(s)).includes(url)) rescuedUrls.push(url.replace(/[.)]+$/, ""));
7698
+ continue;
7699
+ }
7700
+ kept.push(s);
7701
+ }
7702
+ const base = (kept.join(" ") || suggestion).trim();
7703
+ return rescuedUrls.length > 0 ? `${base} ${rescuedUrls.join(" ")}` : base;
7704
+ };
7705
+ var asciiPunct = (s) => s.replace(/[—–]/g, "-").replace(/·/g, "-").replace(/→/g, "->").replace(/;/g, ",");
7706
+ var SUCCESS_TABLE = {
7707
+ "llms-txt-exists": { success: "GET /llms.txt returns 200 with an H1, a blockquote summary, and >=1 ## link section." },
7708
+ "sitemap-exists": { success: "GET /sitemap.xml returns 200 valid XML listing all public pages." },
7709
+ "markdown-url-support": (m) => ({ success: `appending .md to each page URL returns 200 text/markdown (now ${m.supported ?? 0}/${m.total ?? "?"}).` }),
7710
+ "structured-data-coverage": { success: "every sampled page has a valid schema.org JSON-LD block." },
7711
+ "topical-authority-signals": (m) => ({ success: `avg >=5 internal links/page and >=70% of pages have >=3 (now avg ${m.avgLinks ?? 0}/page).` }),
7712
+ "content-freshness": { success: ">=80% of pages expose a machine-readable date (Last-Modified, meta, or JSON-LD)." },
7713
+ "eeat-signals": { success: "each content page names an author with credentials and links to an about/team page." },
7714
+ "canonical-url-consistency": { success: 'every page has a self-referencing <link rel="canonical">.' },
7715
+ "mcp-server-card": { success: "GET /.well-known/mcp/server-card.json returns valid JSON with name + description + >=1 tool." },
7716
+ "section-header-quality": { success: "every page has exactly one H1 and no skipped heading levels." }
7717
+ };
7718
+ var resolveSuccess = (issue) => {
7719
+ const entry = SUCCESS_TABLE[issue.id];
7720
+ if (!entry) return void 0;
7721
+ return (typeof entry === "function" ? entry(issue.metadata ?? {}) : entry).success;
7722
+ };
7723
+ var buildIssuesBlock = (result, opts, terse = false) => {
7698
7724
  const failures = result.checks.filter((c) => c.status === "fail");
7699
7725
  const warnings = result.checks.filter((c) => c.status === "warn");
7700
7726
  const issues = [...failures, ...warnings];
@@ -7703,8 +7729,10 @@ var buildIssuesBlock = (result, opts) => {
7703
7729
  lines.push(`All checks passed! No fixes needed.`);
7704
7730
  return lines;
7705
7731
  }
7706
- lines.push(`Fix the following GEO issues to make this ${opts.mode === "local" ? "project" : "website"} more discoverable by AI agents:`);
7707
- lines.push(``);
7732
+ if (!terse) {
7733
+ lines.push(`Fix the following GEO issues to make this ${opts.mode === "local" ? "project" : "website"} more discoverable by AI agents:`);
7734
+ lines.push(``);
7735
+ }
7708
7736
  const byCategory = /* @__PURE__ */ new Map();
7709
7737
  for (const issue of issues) {
7710
7738
  const existing = byCategory.get(issue.category) ?? [];
@@ -7712,15 +7740,20 @@ var buildIssuesBlock = (result, opts) => {
7712
7740
  byCategory.set(issue.category, existing);
7713
7741
  }
7714
7742
  for (const [cat, catIssues] of byCategory) {
7715
- const label = CATEGORY_LABELS2[cat] ?? cat;
7743
+ const label = CATEGORY_LABELS[cat] ?? cat;
7716
7744
  const catScore = result.categories[cat]?.score ?? "?";
7717
- lines.push(`### ${label} (${catScore}/100)`);
7745
+ lines.push(terse ? label : `### ${label} (${catScore}/100)`);
7718
7746
  lines.push(``);
7719
7747
  for (const issue of catIssues) {
7720
- lines.push(`- ${statusEmoji(issue.status)} **${issue.id}**: ${issue.message}`);
7721
- if (issue.suggestion) {
7722
- lines.push(` - **Fix:** ${issue.suggestion}`);
7748
+ if (terse) {
7749
+ lines.push(`- ${issue.id} (${statusMarker(issue.status)}): ${asciiPunct(issue.message)}`);
7750
+ if (issue.suggestion) lines.push(` -> ${asciiPunct(terseSuggestion(issue.suggestion))}`);
7751
+ continue;
7723
7752
  }
7753
+ lines.push(`- ${statusMarker(issue.status)} **${issue.id}**: ${issue.message}`);
7754
+ if (issue.suggestion) lines.push(` - **Fix:** ${issue.suggestion}`);
7755
+ const success = resolveSuccess(issue);
7756
+ if (success) lines.push(` - **Success:** ${success}`);
7724
7757
  }
7725
7758
  lines.push(``);
7726
7759
  }
@@ -7728,15 +7761,12 @@ var buildIssuesBlock = (result, opts) => {
7728
7761
  };
7729
7762
  var generateClipboardPrompt = (result, opts) => {
7730
7763
  const lines = [];
7731
- lines.push(`# Fix GEO issues \u2014 ${opts.target}`);
7732
- lines.push(``);
7733
- lines.push(`Score: ${result.grade} (${result.overall_score}/100) \xB7 ${result.summary.failed} failed, ${result.summary.warned} warnings`);
7764
+ const subject = opts.mode === "local" ? "project" : "website";
7765
+ lines.push(`Fix these GEO issues on ${opts.target} so AI agents can discover this ${subject}. Fixes are grouped by area. Do FAIL before WARN.`);
7734
7766
  lines.push(``);
7735
- lines.push(...buildIssuesBlock(result, opts));
7767
+ lines.push(...buildIssuesBlock(result, opts, true));
7736
7768
  if (opts.mode === "local") {
7737
7769
  lines.push(`Files are at \`${opts.target}\`. Fix the issues above, then re-run \`agentimization ${opts.target}\` to verify.`);
7738
- } else {
7739
- lines.push(`Prioritize failures (\u274C) over warnings (\u26A0\uFE0F). Suggest specific code changes.`);
7740
7770
  }
7741
7771
  return lines.join("\n");
7742
7772
  };
@@ -7759,7 +7789,7 @@ var generateAgentPrompt = (result, opts) => {
7759
7789
  lines.push(`These checks are already good (don't break them while fixing the issues above):`);
7760
7790
  lines.push(``);
7761
7791
  for (const pass of passes) {
7762
- lines.push(`- \u2705 **${pass.id}**: ${pass.message}`);
7792
+ lines.push(`- PASS **${pass.id}**: ${pass.message}`);
7763
7793
  }
7764
7794
  lines.push(``);
7765
7795
  }
@@ -7772,7 +7802,7 @@ var generateAgentPrompt = (result, opts) => {
7772
7802
  } else {
7773
7803
  lines.push(`This is a remote site audit of ${opts.target}.`);
7774
7804
  lines.push(`Please suggest the specific code changes needed to fix each issue.`);
7775
- lines.push(`Prioritize failures (\u274C) over warnings (\u26A0\uFE0F).`);
7805
+ lines.push(`Prioritize FAIL over WARN.`);
7776
7806
  }
7777
7807
  lines.push(``);
7778
7808
  lines.push(`Focus on the highest-impact fixes first. The goal is to maximize the GEO score so AI agents can discover, parse, and cite this content effectively.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentimization",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "GEO audit CLI — check if your website is agent-ready",
5
5
  "license": "MIT",
6
6
  "author": "Anthony Lio <hello@antl.io>",