{"_id":"@advance-labs/scoring","_rev":"3-510a6eba539b76e2a63b3e451be7f9b9","name":"@advance-labs/scoring","dist-tags":{"latest":"0.2.2"},"versions":{"0.2.0":{"name":"@advance-labs/scoring","version":"0.2.0","license":"MIT","_id":"@advance-labs/scoring@0.2.0","maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"homepage":"https://github.com/Advance-Labs/aeo-toolkit#readme","bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"dist":{"shasum":"62af6babb3b4d1e694025505ddeee41bbf3b41b7","tarball":"https://registry.npmjs.org/@advance-labs/scoring/-/scoring-0.2.0.tgz","fileCount":6,"integrity":"sha512-myYSGm9Sym+AwbYPw2czkx5TsvpxYl7K+6HdYgl+yRkf0zMCRuGLCQJbcXujf5sYBN401faufYjpcDPxFo9TQg==","signatures":[{"sig":"MEYCIQC3fdwSwstDo0GvZLyRwZsO/v89BVpa3PeyZysP2L74LwIhAJmWAVCn2IXo5atFhUN+Ahs02+ZCn7Q8BFKTP1Baictu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":180343},"main":"./dist/index.js","type":"module","_from":"file:advance-labs-scoring-0.2.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rimraf dist .turbo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"zordhalo","email":"lucas@advancelabs.dev"},"_resolved":"/private/var/folders/lc/qg6736_d3pxb5ds7q4x5gtf80000gn/T/700e384f09ff57bddb1376183e2f2847/advance-labs-scoring-0.2.0.tgz","_integrity":"sha512-myYSGm9Sym+AwbYPw2czkx5TsvpxYl7K+6HdYgl+yRkf0zMCRuGLCQJbcXujf5sYBN401faufYjpcDPxFo9TQg==","repository":{"url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","type":"git","directory":"packages/scoring"},"_npmVersion":"11.18.0","description":"Declarative weighted rule engine plus technical-SEO, AEO, and E-E-A-T rule sets and report builders — the keystone scorer of the AEO Toolkit.","directories":{},"_nodeVersion":"25.8.1","dependencies":{"@advance-labs/types":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","rimraf":"^6.0.1","vitest":"^3.2.6","typescript":"^5.7.2","@advance-labs/config":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/scoring_0.2.0_1788059629905_0.6901806744909864","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@advance-labs/scoring","version":"0.2.1","keywords":["aeo","seo","answer-engine-optimization","e-e-a-t","audit","rule-engine","scoring"],"license":"Apache-2.0","_id":"@advance-labs/scoring@0.2.1","maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"homepage":"https://github.com/Advance-Labs/aeo-toolkit#readme","bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"dist":{"shasum":"9fba89b4289c58757dad35193bb5174f2ed3e018","tarball":"https://registry.npmjs.org/@advance-labs/scoring/-/scoring-0.2.1.tgz","fileCount":6,"integrity":"sha512-I61NjX4oz2ipbavNhxJVyBHf9xlq0SKpEFo7CMEYBDxfumXOrb2EaHrIcn/bruX8eX+6zwvrLvW7Mxw2kNktTQ==","signatures":[{"sig":"MEUCIQDOBe/SrJcN1MAF+CAnUCyqv8/jX+yYl+JsTG+yCEubqQIgGoJTUZL1mQezgIb7gdjTyxOadJw95SRCMD9y5aeCYcY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":193491},"main":"./dist/index.js","type":"module","_from":"file:advance-labs-scoring-0.2.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsup --watch","lint":"eslint src","test":"vitest run","build":"tsup","clean":"rimraf dist .turbo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"zordhalo","email":"lucas@advancelabs.dev"},"_resolved":"/tmp/b9add7cd8e327f9e6d57ac693be77560/advance-labs-scoring-0.2.1.tgz","_integrity":"sha512-I61NjX4oz2ipbavNhxJVyBHf9xlq0SKpEFo7CMEYBDxfumXOrb2EaHrIcn/bruX8eX+6zwvrLvW7Mxw2kNktTQ==","repository":{"url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","type":"git","directory":"packages/scoring"},"_npmVersion":"11.19.0","description":"Declarative weighted rule engine plus technical-SEO, AEO, and E-E-A-T rule sets and report builders — the keystone scorer of the AEO Toolkit.","directories":{},"_nodeVersion":"24.20.0","dependencies":{"@advance-labs/types":"0.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.5","rimraf":"^6.0.1","vitest":"^3.2.6","typescript":"^5.7.2","@advance-labs/config":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/scoring_0.2.1_1789019425776_0.3109282616968536","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@advance-labs/scoring","version":"0.2.2","type":"module","description":"Declarative weighted rule engine plus technical-SEO, AEO, and E-E-A-T rule sets and report builders — the keystone scorer of the AEO Toolkit.","keywords":["aeo","seo","answer-engine-optimization","e-e-a-t","audit","rule-engine","scoring"],"license":"Apache-2.0","author":{"name":"Lucas Krawczak","email":"lucas@advancelabs.dev","url":"https://advancelabs.dev/lucas"},"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"@advance-labs/types":"0.2.2"},"devDependencies":{"rimraf":"^6.0.1","tsup":"^8.3.5","typescript":"^5.7.2","vitest":"^3.2.6","@advance-labs/config":"0.1.0"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","directory":"packages/scoring"},"homepage":"https://docs.advancelabs.dev/aeo-toolkit","scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","lint":"eslint src","test":"vitest run","clean":"rimraf dist .turbo"},"_id":"@advance-labs/scoring@0.2.2","bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"_integrity":"sha512-uMkdYx5cwsqRDiV5VNBVdMdll496b8iZANR6ztyOWIBm4UNTd9uX88rpNqjU4RMsuha4qoknoI1ogL/99xNtXA==","_resolved":"/tmp/104e382698fcaec4204b3c6539d2afe1/advance-labs-scoring-0.2.2.tgz","_from":"file:advance-labs-scoring-0.2.2.tgz","_nodeVersion":"24.20.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-uMkdYx5cwsqRDiV5VNBVdMdll496b8iZANR6ztyOWIBm4UNTd9uX88rpNqjU4RMsuha4qoknoI1ogL/99xNtXA==","shasum":"5ac20ef29f88347532211e1a44e5139cee1b1057","tarball":"https://registry.npmjs.org/@advance-labs/scoring/-/scoring-0.2.2.tgz","fileCount":6,"unpackedSize":193567,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDV0hU5WMFHdy34Dxul+ybeKAYj0Bk4zJzdCpOz/Pj5JwIgdK8Ug+1tZkRbHlM+OxI3dxvMA5gcnxmj/ZO09vDBLO8="}]},"_npmUser":{"name":"zordhalo","email":"lucas@advancelabs.dev"},"directories":{},"maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/scoring_0.2.2_1789020711689_0.48414868410477085"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-30T03:13:49.757Z","modified":"2026-09-10T06:11:52.057Z","0.2.0":"2026-08-30T03:13:50.048Z","0.2.1":"2026-09-10T05:50:25.903Z","0.2.2":"2026-09-10T06:11:51.822Z"},"bugs":{"url":"https://github.com/Advance-Labs/aeo-toolkit/issues"},"license":"Apache-2.0","homepage":"https://docs.advancelabs.dev/aeo-toolkit","keywords":["aeo","seo","answer-engine-optimization","e-e-a-t","audit","rule-engine","scoring"],"repository":{"type":"git","url":"git+https://github.com/Advance-Labs/aeo-toolkit.git","directory":"packages/scoring"},"description":"Declarative weighted rule engine plus technical-SEO, AEO, and E-E-A-T rule sets and report builders — the keystone scorer of the AEO Toolkit.","maintainers":[{"name":"zordhalo","email":"lucas@advancelabs.dev"}],"readme":"# @advance-labs/scoring\n\nThe keystone scorer of the AEO Toolkit: a declarative, weighted rule engine plus three rule\nsets (technical SEO, AEO, E-E-A-T) and the report builders that four downstream tools render.\nIt is pure TypeScript with no runtime dependencies beyond `@advance-labs/types` — all crawl, parse, and\nschema data arrives via an injected `ScoringContext`, so every function is unit-testable without\nany network or filesystem access.\n\n## Usage\n\n```ts\nimport {\n  auditScore,\n  buildAuditReport,\n  eeatScore,\n  scoreToGrade,\n  technicalSeoRules,\n  aeoRules,\n  runRules,\n  generateTemplates,\n} from '@advance-labs/scoring';\nimport type { ScoringContext } from '@advance-labs/types';\n\n// `ctx` is assembled by @advance-labs/crawler + @advance-labs/html-parser + @advance-labs/schema-validator.\ndeclare const ctx: ScoringContext;\n\nconst score = await auditScore(ctx); // combined technical + AEO Score\nconst report = await buildAuditReport(ctx, { durationMs: 4200, version: '0.1.0' });\nconst eeat = eeatScore(ctx); // four-pillar E-E-A-T report\nconst templates = generateTemplates(ctx); // starter files for anything missing\n\n// Run a custom rule set directly:\nconst { categories, score: custom } = await runRules(ctx, [...technicalSeoRules, ...aeoRules]);\n```\n\n## How scoring works\n\n- Each `Rule.evaluate(ctx)` returns `{ passed }` (sync or async). A throwing rule is treated as a\n  non-fatal failure so one bad rule can never crash an audit.\n- **Category score** = weighted pass-ratio × 100 (`Σ passed-weight / Σ weight`). A category with no\n  weighted rules scores 100.\n- **Overall score** = weighted mean across categories, rounded; grade via `scoreToGrade`\n  (≥90 A, ≥80 B, ≥70 C, ≥60 D, else F).\n- **`topFixes`** = failed findings sorted by severity (`critical → info`), then descending weight.\n- **Single-page mode** (`ctx.mode === 'single-page'`): rules that need multi-page crawl data (e.g.\n  title uniqueness) pass/skip gracefully instead of penalizing the page.\n\n## Public API\n\n| Export | Kind | Purpose |\n|--------|------|---------|\n| `runRules(ctx, rules)` | async fn | Evaluate rules → `{ categories, score }` |\n| `aggregateScore(categories)` | fn | Combine categories into an overall `Score` |\n| `scoreToGrade(n)` | fn | 0–100 → `ScoreGrade` letter |\n| `clampScore(n)` | fn | Clamp arbitrary number into 0–100 |\n| `technicalSeoRules` | `Rule[]` | 24 technical-SEO + on-page rules across 8 categories |\n| `aeoRules` | `Rule[]` | 10 answer-engine-optimization heuristics |\n| `eeatScore(ctx)` | fn | Four-pillar `EeatReport` (Experience/Expertise/Authoritativeness/Trust) |\n| `eeatSignalDefs` | array | Inspectable E-E-A-T signal metadata (no detect fns) |\n| `auditScore(ctx)` | async fn | `runRules` with technical + AEO rules → `Score` |\n| `auditRules` | `Rule[]` | The combined technical + AEO rule set |\n| `buildAuditReport(ctx, opts)` | async fn | Full `AuditReport`: score, topFixes, templates, meta |\n| `prioritizeFixes(findings)` | fn | Sort failed findings by severity then weight |\n| `generateTemplates(ctx)` | fn | Starter `robots.txt` / `llms.txt` / `sitemap.xml` for missing files |\n| `KEY_AI_BOTS` | array | The AI user-agents whose access matters most |\n\nAll domain shapes (`Score`, `Finding`, `ScoreCategory`, `ScoringContext`, `AuditReport`,\n`EeatReport`, `GeneratedTemplate`, …) come from `@advance-labs/types` — never redefined here.\n\n## Status\n\nImplemented. Pure, deterministic, dependency-free scoring logic with full Vitest coverage\n(happy path + edge cases for every export, including empty and single-page contexts). No stubs —\nthis package requires no live third-party credentials.\n","readmeFilename":"README.md","author":{"name":"Lucas Krawczak","email":"lucas@advancelabs.dev","url":"https://advancelabs.dev/lucas"}}