@cloudcreate/adsense-check 1.2.1 → 1.3.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.
@@ -1425,7 +1425,15 @@ function buildPageDetails(pages, aiAnalyses, siteType) {
1425
1425
  const { score } = scorePage(pageType, contentChars, contentRatio, issues, siteType, aiStatus);
1426
1426
  const detail = { url: page.url, title: page.title, pageType, totalChars, contentChars, contentRatio, contentStatus, issues, score };
1427
1427
  if (relevance) detail.relevance = relevance;
1428
- if (ai) detail.ai = { status: ai.status, assessment: ai.assessment, suggestions: ai.suggestions };
1428
+ if (ai) detail.ai = {
1429
+ status: ai.status,
1430
+ valueScore: ai.valueScore,
1431
+ originalityScore: ai.originalityScore,
1432
+ relevanceScore: ai.relevanceScore,
1433
+ complianceScore: ai.complianceScore,
1434
+ assessment: ai.assessment,
1435
+ suggestions: ai.suggestions
1436
+ };
1429
1437
  return detail;
1430
1438
  });
1431
1439
  }
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  getSupportedLangs,
11
11
  isValidLang,
12
12
  t
13
- } from "./chunk-PGQWYP7I.js";
13
+ } from "./chunk-LMW7JCER.js";
14
14
 
15
15
  // src/cli.ts
16
16
  import "dotenv/config";
@@ -204,6 +204,145 @@ function truncate(s, max) {
204
204
  function renderJsonReport(report) {
205
205
  return JSON.stringify(report, null, 2);
206
206
  }
207
+ var MD_ICONS = {
208
+ pass: "\u2705",
209
+ warn: "\u26A0\uFE0F",
210
+ fail: "\u274C",
211
+ skip: "\u23ED\uFE0F"
212
+ };
213
+ function renderMarkdownReport(report) {
214
+ const lines = [];
215
+ const lang = report.lang;
216
+ const typeKey = `detector.type.${report.siteType}`;
217
+ const typeLabel = t(typeKey, lang);
218
+ lines.push(`# AdSense \u5BA1\u6838\u62A5\u544A`);
219
+ lines.push("");
220
+ lines.push(`| \u9879\u76EE | \u503C |`);
221
+ lines.push(`|------|-----|`);
222
+ lines.push(`| URL | ${report.url} |`);
223
+ lines.push(`| \u65F6\u95F4 | ${report.timestamp} |`);
224
+ lines.push(`| \u7AD9\u70B9\u7C7B\u578B | ${typeLabel} (${report.siteTypeConfidence}) |`);
225
+ if (report.siteTopic) {
226
+ lines.push(`| \u4E3B\u9898 | ${report.siteTopic.topic} |`);
227
+ lines.push(`| \u63CF\u8FF0 | ${report.siteTopic.description} |`);
228
+ }
229
+ if (report.samplingInfo) {
230
+ const s = report.samplingInfo;
231
+ lines.push(`| \u62BD\u6837 | ${s.totalDiscovered} total, ${s.recentCount} recent (6mo), ${s.sampledCount} sampled (${s.samplePct}%, ${s.confidence}) |`);
232
+ }
233
+ lines.push("");
234
+ lines.push(`## \u7EFC\u5408\u8BC4\u5206: ${report.compositeScore}/100`);
235
+ lines.push("");
236
+ const hardFailCount = report.hardCategories.flatMap((c) => c.items).filter((i) => i.status === "fail").length;
237
+ const hardWarnCount = report.hardCategories.flatMap((c) => c.items).filter((i) => i.status === "warn").length;
238
+ const hardLabel = report.hardStatus === "ready" ? "\u2705 PASS" : report.hardStatus === "warn" ? "\u26A0\uFE0F WARN" : "\u274C FAIL";
239
+ lines.push(`### \u786C\u6027\u8981\u6C42 ${hardLabel}`);
240
+ lines.push("");
241
+ for (const cat of report.hardCategories) {
242
+ for (const item of cat.items) {
243
+ lines.push(`- ${MD_ICONS[item.status]} **${item.name}**: ${item.message}`);
244
+ if (item.detail) lines.push(` - ${item.detail}`);
245
+ }
246
+ }
247
+ lines.push("");
248
+ lines.push(`### \u67D4\u6027\u8BC4\u5206 ${report.softScore}/100`);
249
+ lines.push("");
250
+ for (const cat of report.softCategories) {
251
+ const isAiCat = cat.name.includes("AI") || cat.name.includes("ai");
252
+ const score = isAiCat && report.siteAiScore > 0 ? report.siteAiScore : categoryScore(cat);
253
+ lines.push(`- **${cat.name}**: ${score}%`);
254
+ for (const item of cat.items) {
255
+ lines.push(` - ${MD_ICONS[item.status]} ${item.name}: ${item.message}`);
256
+ if (item.detail) lines.push(` - ${item.detail}`);
257
+ }
258
+ }
259
+ lines.push("");
260
+ if (report.aiDimensionAverages) {
261
+ const d = report.aiDimensionAverages;
262
+ lines.push(`### AI \u4EF7\u503C\u5206\u6790`);
263
+ lines.push("");
264
+ lines.push(`| \u7EF4\u5EA6 | \u5747\u5206 |`);
265
+ lines.push(`|------|------|`);
266
+ lines.push(`| Value\uFF08\u4EF7\u503C\uFF09 | ${d.value}/10 |`);
267
+ lines.push(`| Originality\uFF08\u539F\u521B\uFF09 | ${d.originality}/10 |`);
268
+ lines.push(`| Relevance\uFF08\u76F8\u5173\uFF09 | ${d.relevance}/10 |`);
269
+ lines.push(`| Compliance\uFF08\u5408\u89C4\uFF09 | ${d.compliance}/10 |`);
270
+ lines.push("");
271
+ lines.push(`**\u7AD9\u70B9 AI \u8BC4\u5206**: ${report.siteAiScore}/100\uFF08\u51E0\u4F55\u5747\u503C \xD7 \u9875\u9762\u7C7B\u578B\u52A0\u6743\uFF09`);
272
+ lines.push("");
273
+ }
274
+ const hardContrib = Math.round(report.hardStatus === "ready" ? 100 * 0.4 : report.hardCategories.flatMap((c) => c.items).filter((i) => i.status === "pass").length / Math.max(1, report.hardCategories.flatMap((c) => c.items).length) * 100 * 0.4);
275
+ lines.push(`> Hard ${Math.round(hardContrib)}% \xD7 0.4 + Soft ${report.softScore}% \xD7 0.6 - Penalty ${report.warningPenalty} = ${report.compositeScore}`);
276
+ lines.push("");
277
+ if (report.pages.length > 0) {
278
+ lines.push(`### \u9010\u9875\u8BE6\u60C5 (${report.pages.length} pages)`);
279
+ lines.push("");
280
+ const problems = report.pages.filter((p) => p.contentStatus !== "pass" || p.issues.length > 0 || p.ai && p.ai.status !== "pass");
281
+ const ok = report.pages.filter((p) => p.contentStatus === "pass" && p.issues.length === 0 && (!p.ai || p.ai.status === "pass"));
282
+ lines.push(`| \u72B6\u6001 | \u7C7B\u578B | \u8DEF\u5F84 | \u8BC4\u5206 | \u6B63\u6587\u6BD4 | V | O | R | C | \u6807\u9898 |`);
283
+ lines.push(`|------|------|------|------|--------|---|---|---|---|------|`);
284
+ for (const p of [...problems, ...ok]) {
285
+ const path = (() => {
286
+ try {
287
+ return new URL(p.url).pathname;
288
+ } catch {
289
+ return p.url;
290
+ }
291
+ })();
292
+ const status = MD_ICONS[p.contentStatus];
293
+ const ai = p.ai;
294
+ const v = ai?.valueScore != null ? ai.valueScore : "-";
295
+ const o = ai?.originalityScore != null ? ai.originalityScore : "-";
296
+ const r = ai?.relevanceScore != null ? ai.relevanceScore : "-";
297
+ const c = ai?.complianceScore != null ? ai.complianceScore : "-";
298
+ lines.push(`| ${status} | ${p.pageType} | \`${path}\` | ${p.score}/100 | ${p.contentRatio}% | ${v} | ${o} | ${r} | ${c} | ${p.title} |`);
299
+ }
300
+ lines.push("");
301
+ const detailPages = problems.filter((p) => p.issues.length > 0 || p.ai && p.ai.status !== "pass");
302
+ if (detailPages.length > 0) {
303
+ lines.push(`#### \u95EE\u9898\u9875\u9762\u8BE6\u60C5`);
304
+ lines.push("");
305
+ for (const p of detailPages) {
306
+ const path = (() => {
307
+ try {
308
+ return new URL(p.url).pathname;
309
+ } catch {
310
+ return p.url;
311
+ }
312
+ })();
313
+ lines.push(`**${path}** (mechanical: ${p.score}/100)`);
314
+ lines.push("");
315
+ for (const issue of p.issues) lines.push(`- \u26A0\uFE0F ${issue}`);
316
+ if (p.ai) {
317
+ const ai = p.ai;
318
+ lines.push(`- AI \u72B6\u6001: ${MD_ICONS[ai.status]} ${ai.status}`);
319
+ if (ai.valueScore != null) {
320
+ lines.push(`- \u56DB\u7EF4\u8BC4\u5206: **Value ${ai.valueScore}** | **Originality ${ai.originalityScore}** | **Relevance ${ai.relevanceScore}** | **Compliance ${ai.complianceScore}**`);
321
+ const geoMean = Math.round(Math.pow((ai.valueScore ?? 5) * (ai.originalityScore ?? 5) * (ai.relevanceScore ?? 5) * (ai.complianceScore ?? 5), 0.25) * 10);
322
+ lines.push(`- AI \u7EFC\u5408\u5206: ${geoMean}/100\uFF08\u51E0\u4F55\u5747\u503C\uFF09`);
323
+ }
324
+ lines.push(`- \u8BC4\u4F30: ${ai.assessment}`);
325
+ if (ai.suggestions.length > 0) {
326
+ lines.push(`- \u6539\u8FDB\u5EFA\u8BAE:`);
327
+ for (const s of ai.suggestions.slice(0, 3)) lines.push(` - ${s}`);
328
+ }
329
+ }
330
+ lines.push("");
331
+ }
332
+ }
333
+ }
334
+ if (report.hardStatus === "fail") {
335
+ lines.push(`**\u274C NOT READY** \u2014 ${hardFailCount} \u9879\u5931\u8D25\u9700\u8981\u4FEE\u590D`);
336
+ } else if (report.hardStatus === "warn") {
337
+ lines.push(`**\u26A0\uFE0F NEEDS FIXES** \u2014 ${hardWarnCount} \u9879\u8B66\u544A\u5F85\u4FEE\u590D`);
338
+ } else if (report.warned > 0) {
339
+ lines.push(`**\u26A0\uFE0F MOSTLY READY** \u2014 \u4FEE\u590D ${report.warned} \u9879\u8B66\u544A\u540E\u53EF\u63D0\u4EA4`);
340
+ } else {
341
+ lines.push(`**\u2705 READY** \u2014 \u53EF\u4EE5\u63D0\u4EA4 AdSense \u5BA1\u6838`);
342
+ }
343
+ lines.push("");
344
+ return lines.join("\n");
345
+ }
207
346
 
208
347
  // src/cli.ts
209
348
  function formatTimestamp() {
@@ -397,9 +536,12 @@ program.name("adsense-check").description("Check if a website meets Google AdSen
397
536
  const outDir = join(process.cwd(), opts.output);
398
537
  try {
399
538
  mkdirSync(outDir, { recursive: true });
400
- const path = join(outDir, `${domain}-${ts}.json`);
401
- writeFileSync(path, renderJsonReport(report), "utf-8");
402
- console.log(chalk2.gray(` ${t("report.saved", lang)}: ${path}`));
539
+ const jsonPath = join(outDir, `${domain}-${ts}.json`);
540
+ writeFileSync(jsonPath, renderJsonReport(report), "utf-8");
541
+ const mdPath = join(outDir, `${domain}-${ts}.md`);
542
+ writeFileSync(mdPath, renderMarkdownReport(report), "utf-8");
543
+ console.log(chalk2.gray(` ${t("report.saved", lang)}: ${jsonPath}`));
544
+ console.log(chalk2.gray(` ${t("report.saved", lang)}: ${mdPath}`));
403
545
  } catch {
404
546
  }
405
547
  }
package/dist/index.d.ts CHANGED
@@ -27,6 +27,10 @@ interface PageDetail {
27
27
  relevance?: 'relevant' | 'tangential' | 'off-topic';
28
28
  ai?: {
29
29
  status: CheckStatus;
30
+ valueScore?: number;
31
+ originalityScore?: number;
32
+ relevanceScore?: number;
33
+ complianceScore?: number;
30
34
  assessment: string;
31
35
  suggestions: string[];
32
36
  };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  check
3
- } from "./chunk-PGQWYP7I.js";
3
+ } from "./chunk-LMW7JCER.js";
4
4
  export {
5
5
  check
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcreate/adsense-check",
3
- "version": "1.2.1",
3
+ "version": "1.3.1",
4
4
  "description": "Check if a website meets Google AdSense review requirements",
5
5
  "homepage": "https://cloudcreate.ai",
6
6
  "repository": {