create-hq 5.0.0 → 5.2.0

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 (301) hide show
  1. package/dist/deps.d.ts +2 -2
  2. package/dist/deps.d.ts.map +1 -1
  3. package/dist/deps.js +138 -29
  4. package/dist/deps.js.map +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/scaffold.d.ts +1 -1
  8. package/dist/scaffold.d.ts.map +1 -1
  9. package/dist/scaffold.js +125 -26
  10. package/dist/scaffold.js.map +1 -1
  11. package/dist/ui.js +1 -1
  12. package/package.json +4 -8
  13. package/template/.claude/CLAUDE.md +0 -202
  14. package/template/.claude/commands/checkpoint.md +0 -127
  15. package/template/.claude/commands/cleanup.md +0 -307
  16. package/template/.claude/commands/execute-task.md +0 -440
  17. package/template/.claude/commands/exit-plan.md +0 -41
  18. package/template/.claude/commands/handoff.md +0 -97
  19. package/template/.claude/commands/learn.md +0 -218
  20. package/template/.claude/commands/metrics.md +0 -118
  21. package/template/.claude/commands/newworker.md +0 -162
  22. package/template/.claude/commands/nexttask.md +0 -67
  23. package/template/.claude/commands/prd.md +0 -238
  24. package/template/.claude/commands/reanchor.md +0 -51
  25. package/template/.claude/commands/remember.md +0 -126
  26. package/template/.claude/commands/run-project.md +0 -348
  27. package/template/.claude/commands/run.md +0 -110
  28. package/template/.claude/commands/search-reindex.md +0 -62
  29. package/template/.claude/commands/search.md +0 -100
  30. package/template/.claude/commands/setup.md +0 -381
  31. package/template/.claude/scripts/pure-ralph-loop.ps1 +0 -312
  32. package/template/.claude/scripts/pure-ralph-loop.sh +0 -859
  33. package/template/CHANGELOG.md +0 -220
  34. package/template/LICENSE +0 -21
  35. package/template/MIGRATION.md +0 -259
  36. package/template/README.md +0 -368
  37. package/template/data/journal/.gitkeep +0 -0
  38. package/template/docs/images/ascii-banner-options.md +0 -122
  39. package/template/docs/images/hq-banner.svg +0 -105
  40. package/template/knowledge/Ralph/01-overview.md +0 -71
  41. package/template/knowledge/Ralph/02-core-concepts.md +0 -114
  42. package/template/knowledge/Ralph/03-how-ralph-works.md +0 -184
  43. package/template/knowledge/Ralph/04-back-pressure.md +0 -222
  44. package/template/knowledge/Ralph/05-specifications.md +0 -210
  45. package/template/knowledge/Ralph/06-agents-md.md +0 -222
  46. package/template/knowledge/Ralph/07-implementation.md +0 -316
  47. package/template/knowledge/Ralph/08-economics.md +0 -182
  48. package/template/knowledge/Ralph/09-resources.md +0 -145
  49. package/template/knowledge/Ralph/10-claude-code-workflow.md +0 -212
  50. package/template/knowledge/Ralph/11-team-training-guide.md +0 -383
  51. package/template/knowledge/Ralph/README.md +0 -40
  52. package/template/knowledge/ai-security-framework/CONTRIBUTING.md +0 -139
  53. package/template/knowledge/ai-security-framework/GLOSSARY.md +0 -176
  54. package/template/knowledge/ai-security-framework/LICENSE +0 -21
  55. package/template/knowledge/ai-security-framework/QUICK-START.md +0 -172
  56. package/template/knowledge/ai-security-framework/README.md +0 -232
  57. package/template/knowledge/ai-security-framework/checklists/browser-security.md +0 -301
  58. package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +0 -322
  59. package/template/knowledge/ai-security-framework/checklists/incident-response.md +0 -288
  60. package/template/knowledge/ai-security-framework/checklists/pre-flight.md +0 -249
  61. package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +0 -159
  62. package/template/knowledge/ai-security-framework/configs/audit-logging.md +0 -372
  63. package/template/knowledge/ai-security-framework/configs/kill-switches.md +0 -354
  64. package/template/knowledge/ai-security-framework/docs/01-core-principles.md +0 -256
  65. package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +0 -326
  66. package/template/knowledge/ai-security-framework/docs/03-security-posture.md +0 -250
  67. package/template/knowledge/ai-security-framework/templates/agents-security.md +0 -233
  68. package/template/knowledge/design-styles/README.md +0 -42
  69. package/template/knowledge/design-styles/american-industrial.md +0 -136
  70. package/template/knowledge/design-styles/ethereal-abstract.md +0 -133
  71. package/template/knowledge/design-styles/liminal-portal.md +0 -111
  72. package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
  73. package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
  74. package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
  75. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
  76. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
  77. package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
  78. package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
  79. package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
  80. package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
  81. package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
  82. package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
  83. package/template/knowledge/design-styles/swipes/american-industrial/README.md +0 -31
  84. package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
  85. package/template/knowledge/dev-team/README.md +0 -35
  86. package/template/knowledge/dev-team/patterns/README.md +0 -34
  87. package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +0 -178
  88. package/template/knowledge/dev-team/troubleshooting/README.md +0 -31
  89. package/template/knowledge/dev-team/workflows/README.md +0 -49
  90. package/template/knowledge/hq/checkpoint-schema.json +0 -51
  91. package/template/knowledge/hq/index-md-spec.md +0 -74
  92. package/template/knowledge/hq/thread-schema.md +0 -153
  93. package/template/knowledge/hq-core/checkpoint-schema.json +0 -51
  94. package/template/knowledge/hq-core/index-md-spec.md +0 -74
  95. package/template/knowledge/hq-core/thread-schema.md +0 -153
  96. package/template/knowledge/loom/README.md +0 -51
  97. package/template/knowledge/loom/architecture.md +0 -125
  98. package/template/knowledge/loom/code-style.md +0 -169
  99. package/template/knowledge/loom/llm-proxy.md +0 -132
  100. package/template/knowledge/loom/state-machine.md +0 -131
  101. package/template/knowledge/loom/thread-system.md +0 -117
  102. package/template/knowledge/loom/tools.md +0 -94
  103. package/template/knowledge/loom/weaver.md +0 -96
  104. package/template/knowledge/loom/web-frontend.md +0 -131
  105. package/template/knowledge/projects/README.md +0 -72
  106. package/template/knowledge/projects/templates/README.template.md +0 -28
  107. package/template/knowledge/workers/README.md +0 -195
  108. package/template/knowledge/workers/ralph-loop-pattern.md +0 -157
  109. package/template/knowledge/workers/skill-schema.md +0 -182
  110. package/template/knowledge/workers/state-machine.md +0 -102
  111. package/template/knowledge/workers/templates/base-worker.yaml +0 -73
  112. package/template/knowledge/workers/templates/code-worker.yaml +0 -85
  113. package/template/knowledge/workers/templates/skill.yaml +0 -49
  114. package/template/knowledge/workers/templates/social-worker.yaml +0 -70
  115. package/template/modules/examples/full-manifest.yaml +0 -92
  116. package/template/modules/examples/minimal.yaml +0 -14
  117. package/template/modules/modules.yaml +0 -59
  118. package/template/projects/.gitkeep +0 -0
  119. package/template/projects/incorporate-workers-into-pure-ralph/prd.json +0 -88
  120. package/template/projects/pure-ralph-branch-isolation/README.md +0 -114
  121. package/template/projects/pure-ralph-branch-isolation/prd.json +0 -123
  122. package/template/projects/purist-ralph-loop/README.md +0 -148
  123. package/template/projects/purist-ralph-loop/prd.json +0 -135
  124. package/template/projects/ralph-test/prd.json +0 -50
  125. package/template/prompts/pure-ralph-base.md +0 -551
  126. package/template/settings/.gitkeep +0 -0
  127. package/template/settings/pure-ralph.json +0 -42
  128. package/template/social-content/drafts/INDEX.md +0 -21
  129. package/template/social-content/drafts/linkedin/.gitkeep +0 -1
  130. package/template/social-content/drafts/x/.gitkeep +0 -1
  131. package/template/social-content/images/.gitkeep +0 -1
  132. package/template/starter-projects/code-worker/README.md +0 -97
  133. package/template/starter-projects/code-worker/prd.json +0 -45
  134. package/template/starter-projects/personal-assistant/README.md +0 -42
  135. package/template/starter-projects/personal-assistant/prd.json +0 -43
  136. package/template/starter-projects/social-media/README.md +0 -60
  137. package/template/starter-projects/social-media/prd.json +0 -43
  138. package/template/workers/content-brand/README.md +0 -59
  139. package/template/workers/content-brand/skills/messaging-alignment.md +0 -91
  140. package/template/workers/content-brand/skills/tone-check.md +0 -76
  141. package/template/workers/content-brand/skills/voice-analysis.md +0 -68
  142. package/template/workers/content-brand/worker.yaml +0 -81
  143. package/template/workers/content-legal/README.md +0 -80
  144. package/template/workers/content-legal/skills/claim-substantiation.md +0 -150
  145. package/template/workers/content-legal/skills/compliance-scan.md +0 -123
  146. package/template/workers/content-legal/skills/disclaimer-check.md +0 -146
  147. package/template/workers/content-legal/worker.yaml +0 -118
  148. package/template/workers/content-product/README.md +0 -77
  149. package/template/workers/content-product/skills/claim-verification.md +0 -96
  150. package/template/workers/content-product/skills/feature-accuracy.md +0 -117
  151. package/template/workers/content-product/skills/stats-check.md +0 -128
  152. package/template/workers/content-product/worker.yaml +0 -97
  153. package/template/workers/content-sales/README.md +0 -70
  154. package/template/workers/content-sales/skills/conversion-analysis.md +0 -96
  155. package/template/workers/content-sales/skills/cta-audit.md +0 -107
  156. package/template/workers/content-sales/skills/value-prop-check.md +0 -114
  157. package/template/workers/content-sales/worker.yaml +0 -93
  158. package/template/workers/content-shared/cli.ts +0 -242
  159. package/template/workers/content-shared/index.ts +0 -234
  160. package/template/workers/content-shared/lib/accuracy-analyzer.ts +0 -661
  161. package/template/workers/content-shared/lib/analyze.ts +0 -370
  162. package/template/workers/content-shared/lib/brand-analyzer.ts +0 -526
  163. package/template/workers/content-shared/lib/cms-integration.ts +0 -446
  164. package/template/workers/content-shared/lib/compliance-analyzer.ts +0 -655
  165. package/template/workers/content-shared/lib/conversion-analyzer.ts +0 -555
  166. package/template/workers/content-shared/lib/github-integration.ts +0 -582
  167. package/template/workers/content-shared/lib/output.ts +0 -373
  168. package/template/workers/content-shared/lib/parser.ts +0 -771
  169. package/template/workers/content-shared/lib/priority.ts +0 -439
  170. package/template/workers/content-shared/lib/recommendations.ts +0 -512
  171. package/template/workers/content-shared/lib/reporter.ts +0 -749
  172. package/template/workers/content-shared/lib/restructure.ts +0 -664
  173. package/template/workers/content-shared/lib/scorer.ts +0 -140
  174. package/template/workers/content-shared/lib/types.ts +0 -227
  175. package/template/workers/content-shared/lib/variants.ts +0 -595
  176. package/template/workers/content-shared/package.json +0 -51
  177. package/template/workers/content-shared/pnpm-lock.yaml +0 -39
  178. package/template/workers/content-shared/test/sample-page.json +0 -115
  179. package/template/workers/content-shared/tsconfig.json +0 -20
  180. package/template/workers/dev-team/README.md +0 -166
  181. package/template/workers/dev-team/_template.yaml +0 -70
  182. package/template/workers/dev-team/architect/package.json +0 -27
  183. package/template/workers/dev-team/architect/skills/api-design.md +0 -89
  184. package/template/workers/dev-team/architect/skills/refactor-plan.md +0 -96
  185. package/template/workers/dev-team/architect/skills/system-design.md +0 -100
  186. package/template/workers/dev-team/architect/src/index.ts +0 -49
  187. package/template/workers/dev-team/architect/src/mcp-server.ts +0 -122
  188. package/template/workers/dev-team/architect/src/skills/api-design.ts +0 -316
  189. package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +0 -264
  190. package/template/workers/dev-team/architect/src/skills/system-design.ts +0 -212
  191. package/template/workers/dev-team/architect/tsconfig.json +0 -19
  192. package/template/workers/dev-team/architect/worker.yaml +0 -128
  193. package/template/workers/dev-team/backend-dev/package-lock.json +0 -1252
  194. package/template/workers/dev-team/backend-dev/package.json +0 -27
  195. package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +0 -70
  196. package/template/workers/dev-team/backend-dev/skills/implement-service.md +0 -62
  197. package/template/workers/dev-team/backend-dev/src/index.ts +0 -51
  198. package/template/workers/dev-team/backend-dev/src/mcp-server.ts +0 -109
  199. package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +0 -122
  200. package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +0 -126
  201. package/template/workers/dev-team/backend-dev/tsconfig.json +0 -19
  202. package/template/workers/dev-team/backend-dev/worker.yaml +0 -128
  203. package/template/workers/dev-team/code-reviewer/package-lock.json +0 -1080
  204. package/template/workers/dev-team/code-reviewer/package.json +0 -24
  205. package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +0 -61
  206. package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +0 -54
  207. package/template/workers/dev-team/code-reviewer/skills/request-changes.md +0 -63
  208. package/template/workers/dev-team/code-reviewer/skills/review-pr.md +0 -77
  209. package/template/workers/dev-team/code-reviewer/src/index.ts +0 -56
  210. package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +0 -101
  211. package/template/workers/dev-team/code-reviewer/tsconfig.json +0 -19
  212. package/template/workers/dev-team/code-reviewer/worker.yaml +0 -90
  213. package/template/workers/dev-team/database-dev/package.json +0 -22
  214. package/template/workers/dev-team/database-dev/skills/create-schema.md +0 -48
  215. package/template/workers/dev-team/database-dev/src/index.ts +0 -50
  216. package/template/workers/dev-team/database-dev/src/mcp-server.ts +0 -76
  217. package/template/workers/dev-team/database-dev/tsconfig.json +0 -18
  218. package/template/workers/dev-team/database-dev/worker.yaml +0 -90
  219. package/template/workers/dev-team/frontend-dev/package.json +0 -22
  220. package/template/workers/dev-team/frontend-dev/skills/create-component.md +0 -26
  221. package/template/workers/dev-team/frontend-dev/src/index.ts +0 -50
  222. package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +0 -77
  223. package/template/workers/dev-team/frontend-dev/tsconfig.json +0 -18
  224. package/template/workers/dev-team/frontend-dev/worker.yaml +0 -132
  225. package/template/workers/dev-team/infra-dev/package.json +0 -24
  226. package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +0 -73
  227. package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +0 -80
  228. package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +0 -62
  229. package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +0 -63
  230. package/template/workers/dev-team/infra-dev/src/index.ts +0 -55
  231. package/template/workers/dev-team/infra-dev/src/mcp-server.ts +0 -82
  232. package/template/workers/dev-team/infra-dev/tsconfig.json +0 -19
  233. package/template/workers/dev-team/infra-dev/worker.yaml +0 -92
  234. package/template/workers/dev-team/knowledge-curator/package.json +0 -24
  235. package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +0 -63
  236. package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +0 -61
  237. package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +0 -76
  238. package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +0 -63
  239. package/template/workers/dev-team/knowledge-curator/src/index.ts +0 -53
  240. package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +0 -92
  241. package/template/workers/dev-team/knowledge-curator/tsconfig.json +0 -19
  242. package/template/workers/dev-team/knowledge-curator/worker.yaml +0 -80
  243. package/template/workers/dev-team/motion-designer/package.json +0 -22
  244. package/template/workers/dev-team/motion-designer/skills/add-animation.md +0 -25
  245. package/template/workers/dev-team/motion-designer/skills/generate-image.md +0 -36
  246. package/template/workers/dev-team/motion-designer/src/index.ts +0 -63
  247. package/template/workers/dev-team/motion-designer/src/mcp-server.ts +0 -79
  248. package/template/workers/dev-team/motion-designer/tsconfig.json +0 -18
  249. package/template/workers/dev-team/motion-designer/worker.yaml +0 -84
  250. package/template/workers/dev-team/product-planner/queue.json +0 -4
  251. package/template/workers/dev-team/product-planner/worker.yaml +0 -220
  252. package/template/workers/dev-team/project-manager/package-lock.json +0 -1252
  253. package/template/workers/dev-team/project-manager/package.json +0 -27
  254. package/template/workers/dev-team/project-manager/skills/create-prd.md +0 -66
  255. package/template/workers/dev-team/project-manager/skills/next-issue.md +0 -51
  256. package/template/workers/dev-team/project-manager/skills/project-status.md +0 -59
  257. package/template/workers/dev-team/project-manager/skills/update-learnings.md +0 -65
  258. package/template/workers/dev-team/project-manager/src/index.ts +0 -54
  259. package/template/workers/dev-team/project-manager/src/mcp-server.ts +0 -207
  260. package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +0 -86
  261. package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +0 -137
  262. package/template/workers/dev-team/project-manager/src/skills/project-status.ts +0 -131
  263. package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +0 -94
  264. package/template/workers/dev-team/project-manager/tsconfig.json +0 -19
  265. package/template/workers/dev-team/project-manager/worker.yaml +0 -96
  266. package/template/workers/dev-team/qa-tester/package.json +0 -24
  267. package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +0 -36
  268. package/template/workers/dev-team/qa-tester/skills/run-tests.md +0 -36
  269. package/template/workers/dev-team/qa-tester/skills/write-test.md +0 -27
  270. package/template/workers/dev-team/qa-tester/src/index.ts +0 -61
  271. package/template/workers/dev-team/qa-tester/src/mcp-server.ts +0 -88
  272. package/template/workers/dev-team/qa-tester/tsconfig.json +0 -18
  273. package/template/workers/dev-team/qa-tester/worker.yaml +0 -116
  274. package/template/workers/dev-team/task-executor/package-lock.json +0 -1252
  275. package/template/workers/dev-team/task-executor/package.json +0 -27
  276. package/template/workers/dev-team/task-executor/skills/analyze-issue.md +0 -101
  277. package/template/workers/dev-team/task-executor/skills/execute.md +0 -133
  278. package/template/workers/dev-team/task-executor/skills/report-learnings.md +0 -106
  279. package/template/workers/dev-team/task-executor/skills/validate-completion.md +0 -121
  280. package/template/workers/dev-team/task-executor/src/index.ts +0 -54
  281. package/template/workers/dev-team/task-executor/src/mcp-server.ts +0 -139
  282. package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +0 -219
  283. package/template/workers/dev-team/task-executor/src/skills/execute.ts +0 -132
  284. package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +0 -119
  285. package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +0 -142
  286. package/template/workers/dev-team/task-executor/tsconfig.json +0 -19
  287. package/template/workers/dev-team/task-executor/worker.yaml +0 -110
  288. package/template/workers/registry.yaml +0 -171
  289. package/template/workers/security-scanner/README.md +0 -73
  290. package/template/workers/security-scanner/skills/pre-deploy-check.md +0 -205
  291. package/template/workers/security-scanner/worker.yaml +0 -26
  292. package/template/workspace/checkpoints/.gitkeep +0 -0
  293. package/template/workspace/content-ideas/inbox.jsonl +0 -0
  294. package/template/workspace/drafts/.gitkeep +0 -0
  295. package/template/workspace/learnings/.gitkeep +0 -3
  296. package/template/workspace/orchestrator/.gitkeep +0 -0
  297. package/template/workspace/ralph-test/COMPLETE.md +0 -18
  298. package/template/workspace/ralph-test/hello.txt +0 -2
  299. package/template/workspace/reports/.gitkeep +0 -0
  300. package/template/workspace/scratch/.gitkeep +0 -0
  301. package/template/workspace/threads/.gitkeep +0 -3
@@ -1,661 +0,0 @@
1
- /**
2
- * Technical Accuracy Analyzer (US-009)
3
- * Verifies product claims and features against known product data
4
- */
5
-
6
- import type {
7
- AnalysisInput,
8
- ProductData,
9
- AccuracyAnalysis,
10
- Finding,
11
- Recommendation,
12
- } from './types.js';
13
-
14
- // ============================================
15
- // Default Product Data Template
16
- // ============================================
17
-
18
- export const DEFAULT_PRODUCT_DATA: ProductData = {
19
- productName: 'Product',
20
- features: [],
21
- stats: {},
22
- certifications: [],
23
- integrations: [],
24
- lastUpdated: new Date().toISOString(),
25
- };
26
-
27
- // ============================================
28
- // Scoring Weights
29
- // ============================================
30
-
31
- const WEIGHTS = {
32
- claimsVerification: 0.40,
33
- statsAccuracy: 0.35,
34
- featureConsistency: 0.25,
35
- };
36
-
37
- // ============================================
38
- // Main Analysis Function
39
- // ============================================
40
-
41
- /**
42
- * Analyze content for technical accuracy against known product data
43
- */
44
- export function analyzeAccuracy(
45
- content: AnalysisInput,
46
- productData: ProductData = DEFAULT_PRODUCT_DATA
47
- ): AccuracyAnalysis {
48
- const findings: Finding[] = [];
49
- const recommendations: Recommendation[] = [];
50
-
51
- // Verify claims
52
- const claimsResult = verifyClaims(content, productData, findings, recommendations);
53
-
54
- // Check stats accuracy
55
- const statsResult = checkStatsAccuracy(content, productData, findings, recommendations);
56
-
57
- // Check feature consistency
58
- const featureResult = checkFeatureConsistency(content, productData, findings, recommendations);
59
-
60
- // Calculate overall score
61
- const overallScore = Math.round(
62
- claimsResult.score * WEIGHTS.claimsVerification +
63
- statsResult.score * WEIGHTS.statsAccuracy +
64
- featureResult.score * WEIGHTS.featureConsistency
65
- );
66
-
67
- return {
68
- overallScore,
69
- claimsVerified: claimsResult.verified,
70
- claimsUnverified: claimsResult.unverified,
71
- statsFound: statsResult.found,
72
- statsOutdated: statsResult.outdated,
73
- findings,
74
- recommendations,
75
- };
76
- }
77
-
78
- // ============================================
79
- // Claims Verification
80
- // ============================================
81
-
82
- interface ClaimsResult {
83
- score: number;
84
- verified: number;
85
- unverified: number;
86
- }
87
-
88
- function verifyClaims(
89
- content: AnalysisInput,
90
- productData: ProductData,
91
- findings: Finding[],
92
- recommendations: Recommendation[]
93
- ): ClaimsResult {
94
- let verified = 0;
95
- let unverified = 0;
96
-
97
- if (content.claims.length === 0) {
98
- findings.push({
99
- severity: 'info',
100
- category: 'Accuracy - Claims',
101
- message: 'No verifiable claims detected in content',
102
- });
103
- return { score: 100, verified: 0, unverified: 0 };
104
- }
105
-
106
- // Categorize claims
107
- const claimCategories = categorizeClaims(content.claims);
108
-
109
- // Check superlative claims (highest risk)
110
- for (const claim of claimCategories.superlatives) {
111
- const isSubstantiated = checkSuperlativeClaim(claim, productData);
112
- if (isSubstantiated) {
113
- verified++;
114
- findings.push({
115
- severity: 'pass',
116
- category: 'Accuracy - Claims',
117
- message: 'Superlative claim may be supported by data',
118
- evidence: truncate(claim, 100),
119
- });
120
- } else {
121
- unverified++;
122
- findings.push({
123
- severity: 'warning',
124
- category: 'Accuracy - Claims',
125
- message: 'Superlative claim lacks verification',
126
- evidence: truncate(claim, 100),
127
- });
128
- recommendations.push({
129
- priority: 'high',
130
- category: 'Claims',
131
- current: truncate(claim, 80),
132
- suggested: 'Add supporting data or soften to "one of the leading" or similar',
133
- rationale: 'Unsubstantiated superlatives can damage credibility and raise legal concerns',
134
- });
135
- }
136
- }
137
-
138
- // Check quantitative claims
139
- for (const claim of claimCategories.quantitative) {
140
- const isVerifiable = checkQuantitativeClaim(claim, productData);
141
- if (isVerifiable.verified) {
142
- verified++;
143
- findings.push({
144
- severity: 'pass',
145
- category: 'Accuracy - Claims',
146
- message: 'Quantitative claim appears verifiable',
147
- evidence: truncate(claim, 100),
148
- });
149
- } else {
150
- unverified++;
151
- findings.push({
152
- severity: isVerifiable.severity,
153
- category: 'Accuracy - Claims',
154
- message: isVerifiable.reason,
155
- evidence: truncate(claim, 100),
156
- });
157
- if (isVerifiable.suggestion) {
158
- recommendations.push({
159
- priority: 'medium',
160
- category: 'Claims',
161
- current: truncate(claim, 80),
162
- suggested: isVerifiable.suggestion,
163
- rationale: 'Quantitative claims should be verifiable and up-to-date',
164
- });
165
- }
166
- }
167
- }
168
-
169
- // Check certification/compliance claims
170
- for (const claim of claimCategories.certifications) {
171
- const certFound = productData.certifications.some(cert =>
172
- claim.toLowerCase().includes(cert.toLowerCase())
173
- );
174
- if (certFound) {
175
- verified++;
176
- findings.push({
177
- severity: 'pass',
178
- category: 'Accuracy - Claims',
179
- message: 'Certification claim matches known certifications',
180
- evidence: truncate(claim, 100),
181
- });
182
- } else {
183
- unverified++;
184
- findings.push({
185
- severity: 'warning',
186
- category: 'Accuracy - Claims',
187
- message: 'Certification claim not found in product data',
188
- evidence: truncate(claim, 100),
189
- });
190
- recommendations.push({
191
- priority: 'high',
192
- category: 'Claims',
193
- current: truncate(claim, 80),
194
- suggested: 'Verify certification status and update product data',
195
- rationale: 'False certification claims can have serious legal consequences',
196
- });
197
- }
198
- }
199
-
200
- // Count general claims (lower priority)
201
- verified += claimCategories.general.length;
202
-
203
- const total = verified + unverified;
204
- const verificationRate = total > 0 ? verified / total : 1;
205
- const score = Math.round(verificationRate * 100);
206
-
207
- return { score, verified, unverified };
208
- }
209
-
210
- // ============================================
211
- // Stats Accuracy Check
212
- // ============================================
213
-
214
- interface StatsResult {
215
- score: number;
216
- found: number;
217
- outdated: number;
218
- }
219
-
220
- function checkStatsAccuracy(
221
- content: AnalysisInput,
222
- productData: ProductData,
223
- findings: Finding[],
224
- recommendations: Recommendation[]
225
- ): StatsResult {
226
- let found = content.stats.length;
227
- let outdated = 0;
228
- let score = 100;
229
-
230
- if (content.stats.length === 0) {
231
- findings.push({
232
- severity: 'info',
233
- category: 'Accuracy - Statistics',
234
- message: 'No statistics found in content',
235
- });
236
- return { score: 100, found: 0, outdated: 0 };
237
- }
238
-
239
- // Check stats against known product data
240
- for (const stat of content.stats) {
241
- const validity = checkStatValidity(stat.value, productData.stats);
242
-
243
- if (validity.status === 'verified') {
244
- findings.push({
245
- severity: 'pass',
246
- category: 'Accuracy - Statistics',
247
- message: `Statistic verified: ${stat.value}`,
248
- evidence: stat.label,
249
- });
250
- } else if (validity.status === 'outdated') {
251
- outdated++;
252
- findings.push({
253
- severity: 'warning',
254
- category: 'Accuracy - Statistics',
255
- message: `Statistic may be outdated: ${stat.value}`,
256
- evidence: `Current value: ${validity.currentValue}`,
257
- });
258
- score -= 15;
259
- recommendations.push({
260
- priority: 'high',
261
- category: 'Statistics',
262
- current: `${stat.value} (${stat.label})`,
263
- suggested: `Update to ${validity.currentValue}`,
264
- rationale: 'Outdated statistics undermine credibility',
265
- });
266
- } else if (validity.status === 'unverified') {
267
- findings.push({
268
- severity: 'info',
269
- category: 'Accuracy - Statistics',
270
- message: `Statistic not in known data: ${stat.value}`,
271
- evidence: stat.label,
272
- });
273
- // Minor deduction for unverified stats
274
- score -= 5;
275
- }
276
- }
277
-
278
- // Check for stale data indicators
279
- const lastUpdated = new Date(productData.lastUpdated);
280
- const monthsOld = (Date.now() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24 * 30);
281
-
282
- if (monthsOld > 6) {
283
- findings.push({
284
- severity: 'warning',
285
- category: 'Accuracy - Statistics',
286
- message: `Product data is ${Math.round(monthsOld)} months old`,
287
- });
288
- score -= 10;
289
- recommendations.push({
290
- priority: 'medium',
291
- category: 'Statistics',
292
- current: `Product data last updated ${Math.round(monthsOld)} months ago`,
293
- suggested: 'Review and update product statistics',
294
- rationale: 'Regular data updates ensure accuracy',
295
- });
296
- }
297
-
298
- // Check for missing source attribution
299
- const statsWithoutSource = content.stats.filter(s =>
300
- !s.label.toLowerCase().includes('source') &&
301
- !s.label.toLowerCase().includes('study') &&
302
- !s.label.toLowerCase().includes('report')
303
- );
304
-
305
- if (statsWithoutSource.length > content.stats.length * 0.5) {
306
- findings.push({
307
- severity: 'info',
308
- category: 'Accuracy - Statistics',
309
- message: 'Most statistics lack source attribution',
310
- });
311
- recommendations.push({
312
- priority: 'low',
313
- category: 'Statistics',
314
- current: 'Statistics without sources',
315
- suggested: 'Add source attribution for third-party statistics',
316
- rationale: 'Cited sources increase credibility',
317
- });
318
- }
319
-
320
- return { score: Math.max(0, score), found, outdated };
321
- }
322
-
323
- /**
324
- * Check if a statistic is valid against known product stats
325
- */
326
- export function checkStatValidity(
327
- stat: string,
328
- knownStats: Record<string, string>
329
- ): { status: 'verified' | 'outdated' | 'unverified'; currentValue?: string } {
330
- // Extract numeric value from stat
331
- const numericMatch = stat.match(/[\d,.]+/);
332
- if (!numericMatch) {
333
- return { status: 'unverified' };
334
- }
335
-
336
- const statValue = numericMatch[0];
337
-
338
- // Check against known stats
339
- for (const [key, knownValue] of Object.entries(knownStats)) {
340
- // Check if the stat matches this category
341
- if (stat.toLowerCase().includes(key.toLowerCase())) {
342
- if (knownValue === statValue || knownValue.includes(statValue)) {
343
- return { status: 'verified' };
344
- } else {
345
- return { status: 'outdated', currentValue: knownValue };
346
- }
347
- }
348
- }
349
-
350
- return { status: 'unverified' };
351
- }
352
-
353
- // ============================================
354
- // Feature Consistency Check
355
- // ============================================
356
-
357
- interface FeatureResult {
358
- score: number;
359
- }
360
-
361
- function checkFeatureConsistency(
362
- content: AnalysisInput,
363
- productData: ProductData,
364
- findings: Finding[],
365
- recommendations: Recommendation[]
366
- ): FeatureResult {
367
- let score = 100;
368
-
369
- if (productData.features.length === 0) {
370
- findings.push({
371
- severity: 'info',
372
- category: 'Accuracy - Features',
373
- message: 'No product features defined for verification',
374
- });
375
- return { score: 100 };
376
- }
377
-
378
- const allText = [
379
- content.title,
380
- ...content.headings,
381
- ...content.paragraphs,
382
- ].join(' ').toLowerCase();
383
-
384
- // Check for mentioned features
385
- const mentionedFeatures: string[] = [];
386
- const unmentionedFeatures: string[] = [];
387
-
388
- for (const feature of productData.features) {
389
- // Create variations of the feature name for matching
390
- const variations = [
391
- feature.toLowerCase(),
392
- feature.toLowerCase().replace(/-/g, ' '),
393
- feature.toLowerCase().replace(/_/g, ' '),
394
- ];
395
-
396
- const isMentioned = variations.some(v => allText.includes(v));
397
-
398
- if (isMentioned) {
399
- mentionedFeatures.push(feature);
400
- } else {
401
- unmentionedFeatures.push(feature);
402
- }
403
- }
404
-
405
- // Report findings
406
- const coverage = mentionedFeatures.length / productData.features.length;
407
-
408
- if (coverage >= 0.7) {
409
- findings.push({
410
- severity: 'pass',
411
- category: 'Accuracy - Features',
412
- message: `Good feature coverage: ${Math.round(coverage * 100)}%`,
413
- evidence: `${mentionedFeatures.length}/${productData.features.length} features mentioned`,
414
- });
415
- } else if (coverage >= 0.4) {
416
- findings.push({
417
- severity: 'info',
418
- category: 'Accuracy - Features',
419
- message: `Moderate feature coverage: ${Math.round(coverage * 100)}%`,
420
- evidence: `Missing: ${unmentionedFeatures.slice(0, 3).join(', ')}`,
421
- });
422
- score -= 15;
423
- } else {
424
- findings.push({
425
- severity: 'warning',
426
- category: 'Accuracy - Features',
427
- message: `Low feature coverage: ${Math.round(coverage * 100)}%`,
428
- evidence: `Many key features not mentioned`,
429
- });
430
- score -= 30;
431
- recommendations.push({
432
- priority: 'medium',
433
- category: 'Features',
434
- current: `Only ${mentionedFeatures.length} of ${productData.features.length} features mentioned`,
435
- suggested: `Consider adding content about: ${unmentionedFeatures.slice(0, 3).join(', ')}`,
436
- rationale: 'Comprehensive feature coverage improves page value',
437
- });
438
- }
439
-
440
- // Check for potentially incorrect feature claims
441
- const featureClaims = extractFeatureClaims(content);
442
- const invalidClaims = featureClaims.filter(claim => {
443
- const normalized = claim.toLowerCase();
444
- return !productData.features.some(f =>
445
- normalized.includes(f.toLowerCase()) ||
446
- f.toLowerCase().includes(normalized)
447
- ) && !productData.integrations.some(i =>
448
- normalized.includes(i.toLowerCase())
449
- );
450
- });
451
-
452
- if (invalidClaims.length > 0) {
453
- findings.push({
454
- severity: 'warning',
455
- category: 'Accuracy - Features',
456
- message: `${invalidClaims.length} feature claim(s) not in product data`,
457
- evidence: invalidClaims.slice(0, 2).join('; '),
458
- });
459
- score -= invalidClaims.length * 5;
460
- recommendations.push({
461
- priority: 'medium',
462
- category: 'Features',
463
- current: `Claims about: ${invalidClaims.slice(0, 2).join(', ')}`,
464
- suggested: 'Verify these features exist or update product data',
465
- rationale: 'Feature claims should match actual product capabilities',
466
- });
467
- }
468
-
469
- // Check integrations mentions
470
- if (productData.integrations.length > 0) {
471
- const integrationsMatch = productData.integrations.filter(integration =>
472
- allText.includes(integration.toLowerCase())
473
- );
474
-
475
- if (integrationsMatch.length > 0) {
476
- findings.push({
477
- severity: 'pass',
478
- category: 'Accuracy - Features',
479
- message: `Integrations mentioned: ${integrationsMatch.length}`,
480
- evidence: integrationsMatch.slice(0, 5).join(', '),
481
- });
482
- }
483
- }
484
-
485
- return { score: Math.max(0, score) };
486
- }
487
-
488
- // ============================================
489
- // Helper Functions
490
- // ============================================
491
-
492
- interface CategorizedClaims {
493
- superlatives: string[];
494
- quantitative: string[];
495
- certifications: string[];
496
- general: string[];
497
- }
498
-
499
- /**
500
- * Categorize claims by type
501
- */
502
- function categorizeClaims(claims: string[]): CategorizedClaims {
503
- const result: CategorizedClaims = {
504
- superlatives: [],
505
- quantitative: [],
506
- certifications: [],
507
- general: [],
508
- };
509
-
510
- const superlativePatterns = [
511
- /\b(best|leading|top|#1|number one|premier|fastest|only|first|most|largest)\b/i,
512
- /\b(award-winning|industry-leading|world-class|best-in-class)\b/i,
513
- ];
514
-
515
- const quantitativePatterns = [
516
- /\d+(?:\.\d+)?%/,
517
- /\$[\d,]+/,
518
- /\d+x/i,
519
- /\d+(?:,\d{3})+/,
520
- ];
521
-
522
- const certificationPatterns = [
523
- /\b(SOC\s*2|HIPAA|GDPR|ISO\s*\d+|PCI|FedRAMP|CCPA)\b/i,
524
- /\b(certified|compliant|accredited)\b/i,
525
- ];
526
-
527
- for (const claim of claims) {
528
- if (superlativePatterns.some(p => p.test(claim))) {
529
- result.superlatives.push(claim);
530
- } else if (quantitativePatterns.some(p => p.test(claim))) {
531
- result.quantitative.push(claim);
532
- } else if (certificationPatterns.some(p => p.test(claim))) {
533
- result.certifications.push(claim);
534
- } else {
535
- result.general.push(claim);
536
- }
537
- }
538
-
539
- return result;
540
- }
541
-
542
- /**
543
- * Check if a superlative claim is substantiated
544
- */
545
- function checkSuperlativeClaim(claim: string, productData: ProductData): boolean {
546
- // Check if there's supporting data for the claim
547
- const claimLower = claim.toLowerCase();
548
-
549
- // If we have relevant stats, it might be substantiated
550
- for (const [key, value] of Object.entries(productData.stats)) {
551
- if (claimLower.includes(key.toLowerCase())) {
552
- return true;
553
- }
554
- }
555
-
556
- // Check certifications
557
- for (const cert of productData.certifications) {
558
- if (claimLower.includes(cert.toLowerCase())) {
559
- return true;
560
- }
561
- }
562
-
563
- return false;
564
- }
565
-
566
- interface QuantitativeCheckResult {
567
- verified: boolean;
568
- severity: 'warning' | 'info';
569
- reason: string;
570
- suggestion?: string;
571
- }
572
-
573
- /**
574
- * Check if a quantitative claim is verifiable
575
- */
576
- function checkQuantitativeClaim(
577
- claim: string,
578
- productData: ProductData
579
- ): QuantitativeCheckResult {
580
- // Extract the number from the claim
581
- const numbers = claim.match(/[\d,.]+(?:%|x|K|M|B)?/gi);
582
-
583
- if (!numbers || numbers.length === 0) {
584
- return {
585
- verified: false,
586
- severity: 'info',
587
- reason: 'No quantitative value found in claim',
588
- };
589
- }
590
-
591
- // Check against known stats
592
- for (const [key, value] of Object.entries(productData.stats)) {
593
- if (claim.toLowerCase().includes(key.toLowerCase())) {
594
- // Check if values match
595
- if (numbers.some(n => value.includes(n) || n.includes(value.replace(/[^\d.]/g, '')))) {
596
- return { verified: true, severity: 'info', reason: 'Verified' };
597
- } else {
598
- return {
599
- verified: false,
600
- severity: 'warning',
601
- reason: `Value ${numbers[0]} doesn't match known value: ${value}`,
602
- suggestion: `Update to current value: ${value}`,
603
- };
604
- }
605
- }
606
- }
607
-
608
- // Check if it's a round number (potentially fabricated)
609
- const roundNumberPattern = /^(10|25|50|100|1000)0*$/;
610
- if (numbers.some(n => roundNumberPattern.test(n.replace(/[^0-9]/g, '')))) {
611
- return {
612
- verified: false,
613
- severity: 'info',
614
- reason: 'Round number may appear less credible',
615
- suggestion: 'Use specific numbers when available for more credibility',
616
- };
617
- }
618
-
619
- return {
620
- verified: false,
621
- severity: 'info',
622
- reason: 'Quantitative claim not found in product data',
623
- };
624
- }
625
-
626
- /**
627
- * Extract feature-related claims from content
628
- */
629
- function extractFeatureClaims(content: AnalysisInput): string[] {
630
- const featureClaims: string[] = [];
631
-
632
- // Look for "integrates with", "supports", "works with", etc.
633
- const featurePatterns = [
634
- /integrates?\s+with\s+([^.]+)/gi,
635
- /supports?\s+([^.]+)/gi,
636
- /works?\s+with\s+([^.]+)/gi,
637
- /compatible\s+with\s+([^.]+)/gi,
638
- /connects?\s+to\s+([^.]+)/gi,
639
- ];
640
-
641
- const allText = content.paragraphs.join(' ');
642
-
643
- for (const pattern of featurePatterns) {
644
- const matches = allText.matchAll(pattern);
645
- for (const match of matches) {
646
- if (match[1] && match[1].length < 100) {
647
- featureClaims.push(match[1].trim());
648
- }
649
- }
650
- }
651
-
652
- return featureClaims;
653
- }
654
-
655
- /**
656
- * Truncate string with ellipsis
657
- */
658
- function truncate(str: string, maxLength: number): string {
659
- if (str.length <= maxLength) return str;
660
- return str.slice(0, maxLength - 3) + '...';
661
- }