@agentmarkup/audit 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-VYQOM2ID.js";
4
+ } from "./chunk-EVNL3WJN.js";
5
5
 
6
6
  // src/bin.ts
7
7
  import { createRequire } from "module";
@@ -117,6 +117,26 @@ function analyzeJsDependence(control) {
117
117
  }
118
118
  ];
119
119
  }
120
+ var CONTENT_SIGNAL_USE_VALUES = /* @__PURE__ */ new Set(["immediate", "reference", "full"]);
121
+ function parseContentSignal(body) {
122
+ const raw = [];
123
+ const directives = {};
124
+ const re = /^[ \t]*content-signal[ \t]*:[ \t]*(.+?)[ \t]*$/gim;
125
+ let match;
126
+ while ((match = re.exec(body)) !== null) {
127
+ const value = match[1].trim();
128
+ if (!value) continue;
129
+ raw.push(value);
130
+ for (const pair of value.split(",")) {
131
+ const eq = pair.indexOf("=");
132
+ if (eq === -1) continue;
133
+ const key = pair.slice(0, eq).trim().toLowerCase();
134
+ const val = pair.slice(eq + 1).trim().toLowerCase();
135
+ if (key) directives[key] = val;
136
+ }
137
+ }
138
+ return { present: raw.length > 0, directives, raw };
139
+ }
120
140
  function analyzeRobots(robots) {
121
141
  const findings = [];
122
142
  const has = isRealTextResource(robots);
@@ -151,12 +171,30 @@ function analyzeRobots(robots) {
151
171
  detail: "None of the checked AI crawlers are shadowed by a wildcard disallow."
152
172
  });
153
173
  }
154
- if (/^\s*content-signal\s*:/im.test(body)) {
174
+ const contentSignal = parseContentSignal(body);
175
+ if (contentSignal.present) {
176
+ const declared = Object.entries(contentSignal.directives).map(([key, value]) => `${key}=${value}`).join(", ");
177
+ const useValue = contentSignal.directives["use"];
178
+ const hasUse = typeof useValue === "string";
179
+ const useRecognized = hasUse && CONTENT_SIGNAL_USE_VALUES.has(useValue);
180
+ const detail = [
181
+ "The canonical Content-Signal directive is in robots.txt, where the Content Signals Policy and Lighthouse look for it."
182
+ ];
183
+ if (useRecognized) {
184
+ detail.push(
185
+ `It also declares the extended content-use preference use=${useValue} (immediate/reference/full), the field Cloudflare added to Content Signals for how AI may reuse the content.`
186
+ );
187
+ } else if (hasUse) {
188
+ detail.push(
189
+ `A use=${useValue} field is present but is not one of the recognized values (immediate, reference, full).`
190
+ );
191
+ }
155
192
  findings.push({
156
193
  code: "robots.content-signal",
157
194
  level: "pass",
158
- title: "Content-Signal policy present in robots.txt",
159
- detail: "The canonical Content-Signal directive is in robots.txt, where the Content Signals Policy and Lighthouse look for it."
195
+ title: hasUse ? "Content-Signal policy present (with content-use preference)" : "Content-Signal policy present in robots.txt",
196
+ detail: detail.join(" "),
197
+ evidence: declared || contentSignal.raw.join(" | ")
160
198
  });
161
199
  } else {
162
200
  findings.push({
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  run,
20
20
  safeFetch,
21
21
  worstLevel
22
- } from "./chunk-VYQOM2ID.js";
22
+ } from "./chunk-EVNL3WJN.js";
23
23
  export {
24
24
  ALL_AGENTS,
25
25
  BROWSER_CONTROL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentmarkup/audit",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Audit a live URL the way AI crawlers see it: fetch as GPTBot, ClaudeBot, PerplexityBot and more, diff against a browser to catch accidental CDN blocks and JS-gated content, plus llms.txt, JSON-LD, robots.txt intent, Content-Signal, markdown mirror, sitemap, and page-metadata checks",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,15 +46,6 @@
46
46
  "files": [
47
47
  "dist"
48
48
  ],
49
- "dependencies": {
50
- "@agentmarkup/core": "0.5.3"
51
- },
52
- "devDependencies": {
53
- "eslint": "^9.0.0",
54
- "tsup": "^8.4.0",
55
- "typescript": "^5.7.0",
56
- "vitest": "^3.0.0"
57
- },
58
49
  "scripts": {
59
50
  "prebuild": "pnpm -C ../core build",
60
51
  "build": "tsup",
@@ -66,5 +57,14 @@
66
57
  "lint": "eslint src/ test/",
67
58
  "pretypecheck": "pnpm -C ../core build",
68
59
  "typecheck": "tsc --noEmit"
60
+ },
61
+ "dependencies": {
62
+ "@agentmarkup/core": "workspace:*"
63
+ },
64
+ "devDependencies": {
65
+ "eslint": "^9.0.0",
66
+ "tsup": "^8.4.0",
67
+ "typescript": "^5.7.0",
68
+ "vitest": "^3.0.0"
69
69
  }
70
- }
70
+ }