create-hq 6.0.0 → 7.0.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 (315) hide show
  1. package/dist/__tests__/scaffold.test.d.ts +2 -0
  2. package/dist/__tests__/scaffold.test.d.ts.map +1 -0
  3. package/dist/__tests__/scaffold.test.js +150 -0
  4. package/dist/__tests__/scaffold.test.js.map +1 -0
  5. package/dist/cloud-sync.d.ts +11 -0
  6. package/dist/cloud-sync.d.ts.map +1 -0
  7. package/dist/cloud-sync.js +25 -0
  8. package/dist/cloud-sync.js.map +1 -0
  9. package/dist/deps.d.ts.map +1 -1
  10. package/dist/deps.js +7 -1
  11. package/dist/deps.js.map +1 -1
  12. package/dist/fetch-template.d.ts +14 -0
  13. package/dist/fetch-template.d.ts.map +1 -0
  14. package/dist/fetch-template.js +136 -0
  15. package/dist/fetch-template.js.map +1 -0
  16. package/dist/index.js +8 -7
  17. package/dist/index.js.map +1 -1
  18. package/dist/scaffold.d.ts +2 -2
  19. package/dist/scaffold.d.ts.map +1 -1
  20. package/dist/scaffold.js +95 -286
  21. package/dist/scaffold.js.map +1 -1
  22. package/dist/ui.d.ts +2 -3
  23. package/dist/ui.d.ts.map +1 -1
  24. package/dist/ui.js +90 -44
  25. package/dist/ui.js.map +1 -1
  26. package/package.json +48 -40
  27. package/template/.claude/CLAUDE.md +0 -202
  28. package/template/.claude/commands/checkpoint.md +0 -127
  29. package/template/.claude/commands/cleanup.md +0 -307
  30. package/template/.claude/commands/execute-task.md +0 -440
  31. package/template/.claude/commands/exit-plan.md +0 -41
  32. package/template/.claude/commands/handoff.md +0 -97
  33. package/template/.claude/commands/learn.md +0 -218
  34. package/template/.claude/commands/metrics.md +0 -118
  35. package/template/.claude/commands/newworker.md +0 -162
  36. package/template/.claude/commands/nexttask.md +0 -67
  37. package/template/.claude/commands/prd.md +0 -238
  38. package/template/.claude/commands/reanchor.md +0 -51
  39. package/template/.claude/commands/remember.md +0 -126
  40. package/template/.claude/commands/run-project.md +0 -348
  41. package/template/.claude/commands/run.md +0 -110
  42. package/template/.claude/commands/search-reindex.md +0 -62
  43. package/template/.claude/commands/search.md +0 -100
  44. package/template/.claude/commands/setup.md +0 -381
  45. package/template/.claude/scripts/pure-ralph-loop.ps1 +0 -312
  46. package/template/.claude/scripts/pure-ralph-loop.sh +0 -859
  47. package/template/CHANGELOG.md +0 -220
  48. package/template/LICENSE +0 -21
  49. package/template/MIGRATION.md +0 -259
  50. package/template/README.md +0 -368
  51. package/template/data/journal/.gitkeep +0 -0
  52. package/template/docs/images/ascii-banner-options.md +0 -122
  53. package/template/docs/images/hq-banner.svg +0 -105
  54. package/template/knowledge/Ralph/01-overview.md +0 -71
  55. package/template/knowledge/Ralph/02-core-concepts.md +0 -114
  56. package/template/knowledge/Ralph/03-how-ralph-works.md +0 -184
  57. package/template/knowledge/Ralph/04-back-pressure.md +0 -222
  58. package/template/knowledge/Ralph/05-specifications.md +0 -210
  59. package/template/knowledge/Ralph/06-agents-md.md +0 -222
  60. package/template/knowledge/Ralph/07-implementation.md +0 -316
  61. package/template/knowledge/Ralph/08-economics.md +0 -182
  62. package/template/knowledge/Ralph/09-resources.md +0 -145
  63. package/template/knowledge/Ralph/10-claude-code-workflow.md +0 -212
  64. package/template/knowledge/Ralph/11-team-training-guide.md +0 -383
  65. package/template/knowledge/Ralph/README.md +0 -40
  66. package/template/knowledge/ai-security-framework/CONTRIBUTING.md +0 -139
  67. package/template/knowledge/ai-security-framework/GLOSSARY.md +0 -176
  68. package/template/knowledge/ai-security-framework/LICENSE +0 -21
  69. package/template/knowledge/ai-security-framework/QUICK-START.md +0 -172
  70. package/template/knowledge/ai-security-framework/README.md +0 -232
  71. package/template/knowledge/ai-security-framework/checklists/browser-security.md +0 -301
  72. package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +0 -322
  73. package/template/knowledge/ai-security-framework/checklists/incident-response.md +0 -288
  74. package/template/knowledge/ai-security-framework/checklists/pre-flight.md +0 -249
  75. package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +0 -159
  76. package/template/knowledge/ai-security-framework/configs/audit-logging.md +0 -372
  77. package/template/knowledge/ai-security-framework/configs/kill-switches.md +0 -354
  78. package/template/knowledge/ai-security-framework/docs/01-core-principles.md +0 -256
  79. package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +0 -326
  80. package/template/knowledge/ai-security-framework/docs/03-security-posture.md +0 -250
  81. package/template/knowledge/ai-security-framework/templates/agents-security.md +0 -233
  82. package/template/knowledge/design-styles/README.md +0 -42
  83. package/template/knowledge/design-styles/american-industrial.md +0 -136
  84. package/template/knowledge/design-styles/ethereal-abstract.md +0 -133
  85. package/template/knowledge/design-styles/liminal-portal.md +0 -111
  86. package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
  87. package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
  88. package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
  89. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
  90. package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
  91. package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
  92. package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
  93. package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
  94. package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
  95. package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
  96. package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
  97. package/template/knowledge/design-styles/swipes/american-industrial/README.md +0 -31
  98. package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
  99. package/template/knowledge/dev-team/README.md +0 -35
  100. package/template/knowledge/dev-team/patterns/README.md +0 -34
  101. package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +0 -178
  102. package/template/knowledge/dev-team/troubleshooting/README.md +0 -31
  103. package/template/knowledge/dev-team/workflows/README.md +0 -49
  104. package/template/knowledge/hq/checkpoint-schema.json +0 -51
  105. package/template/knowledge/hq/index-md-spec.md +0 -74
  106. package/template/knowledge/hq/thread-schema.md +0 -153
  107. package/template/knowledge/hq-core/checkpoint-schema.json +0 -51
  108. package/template/knowledge/hq-core/index-md-spec.md +0 -74
  109. package/template/knowledge/hq-core/thread-schema.md +0 -153
  110. package/template/knowledge/loom/README.md +0 -51
  111. package/template/knowledge/loom/architecture.md +0 -125
  112. package/template/knowledge/loom/code-style.md +0 -169
  113. package/template/knowledge/loom/llm-proxy.md +0 -132
  114. package/template/knowledge/loom/state-machine.md +0 -131
  115. package/template/knowledge/loom/thread-system.md +0 -117
  116. package/template/knowledge/loom/tools.md +0 -94
  117. package/template/knowledge/loom/weaver.md +0 -96
  118. package/template/knowledge/loom/web-frontend.md +0 -131
  119. package/template/knowledge/projects/README.md +0 -72
  120. package/template/knowledge/projects/templates/README.template.md +0 -28
  121. package/template/knowledge/workers/README.md +0 -195
  122. package/template/knowledge/workers/ralph-loop-pattern.md +0 -157
  123. package/template/knowledge/workers/skill-schema.md +0 -182
  124. package/template/knowledge/workers/state-machine.md +0 -102
  125. package/template/knowledge/workers/templates/base-worker.yaml +0 -73
  126. package/template/knowledge/workers/templates/code-worker.yaml +0 -85
  127. package/template/knowledge/workers/templates/skill.yaml +0 -49
  128. package/template/knowledge/workers/templates/social-worker.yaml +0 -70
  129. package/template/modules/examples/full-manifest.yaml +0 -92
  130. package/template/modules/examples/minimal.yaml +0 -14
  131. package/template/modules/modules.yaml +0 -59
  132. package/template/projects/.gitkeep +0 -0
  133. package/template/projects/incorporate-workers-into-pure-ralph/prd.json +0 -88
  134. package/template/projects/pure-ralph-branch-isolation/README.md +0 -114
  135. package/template/projects/pure-ralph-branch-isolation/prd.json +0 -123
  136. package/template/projects/purist-ralph-loop/README.md +0 -148
  137. package/template/projects/purist-ralph-loop/prd.json +0 -135
  138. package/template/projects/ralph-test/prd.json +0 -50
  139. package/template/prompts/pure-ralph-base.md +0 -551
  140. package/template/settings/.gitkeep +0 -0
  141. package/template/settings/pure-ralph.json +0 -42
  142. package/template/social-content/drafts/INDEX.md +0 -21
  143. package/template/social-content/drafts/linkedin/.gitkeep +0 -1
  144. package/template/social-content/drafts/x/.gitkeep +0 -1
  145. package/template/social-content/images/.gitkeep +0 -1
  146. package/template/starter-projects/code-worker/README.md +0 -97
  147. package/template/starter-projects/code-worker/prd.json +0 -45
  148. package/template/starter-projects/personal-assistant/README.md +0 -42
  149. package/template/starter-projects/personal-assistant/prd.json +0 -43
  150. package/template/starter-projects/social-media/README.md +0 -60
  151. package/template/starter-projects/social-media/prd.json +0 -43
  152. package/template/workers/content-brand/README.md +0 -59
  153. package/template/workers/content-brand/skills/messaging-alignment.md +0 -91
  154. package/template/workers/content-brand/skills/tone-check.md +0 -76
  155. package/template/workers/content-brand/skills/voice-analysis.md +0 -68
  156. package/template/workers/content-brand/worker.yaml +0 -81
  157. package/template/workers/content-legal/README.md +0 -80
  158. package/template/workers/content-legal/skills/claim-substantiation.md +0 -150
  159. package/template/workers/content-legal/skills/compliance-scan.md +0 -123
  160. package/template/workers/content-legal/skills/disclaimer-check.md +0 -146
  161. package/template/workers/content-legal/worker.yaml +0 -118
  162. package/template/workers/content-product/README.md +0 -77
  163. package/template/workers/content-product/skills/claim-verification.md +0 -96
  164. package/template/workers/content-product/skills/feature-accuracy.md +0 -117
  165. package/template/workers/content-product/skills/stats-check.md +0 -128
  166. package/template/workers/content-product/worker.yaml +0 -97
  167. package/template/workers/content-sales/README.md +0 -70
  168. package/template/workers/content-sales/skills/conversion-analysis.md +0 -96
  169. package/template/workers/content-sales/skills/cta-audit.md +0 -107
  170. package/template/workers/content-sales/skills/value-prop-check.md +0 -114
  171. package/template/workers/content-sales/worker.yaml +0 -93
  172. package/template/workers/content-shared/cli.ts +0 -242
  173. package/template/workers/content-shared/index.ts +0 -234
  174. package/template/workers/content-shared/lib/accuracy-analyzer.ts +0 -661
  175. package/template/workers/content-shared/lib/analyze.ts +0 -370
  176. package/template/workers/content-shared/lib/brand-analyzer.ts +0 -526
  177. package/template/workers/content-shared/lib/cms-integration.ts +0 -446
  178. package/template/workers/content-shared/lib/compliance-analyzer.ts +0 -655
  179. package/template/workers/content-shared/lib/conversion-analyzer.ts +0 -555
  180. package/template/workers/content-shared/lib/github-integration.ts +0 -582
  181. package/template/workers/content-shared/lib/output.ts +0 -373
  182. package/template/workers/content-shared/lib/parser.ts +0 -771
  183. package/template/workers/content-shared/lib/priority.ts +0 -439
  184. package/template/workers/content-shared/lib/recommendations.ts +0 -512
  185. package/template/workers/content-shared/lib/reporter.ts +0 -749
  186. package/template/workers/content-shared/lib/restructure.ts +0 -664
  187. package/template/workers/content-shared/lib/scorer.ts +0 -140
  188. package/template/workers/content-shared/lib/types.ts +0 -227
  189. package/template/workers/content-shared/lib/variants.ts +0 -595
  190. package/template/workers/content-shared/package.json +0 -51
  191. package/template/workers/content-shared/pnpm-lock.yaml +0 -39
  192. package/template/workers/content-shared/test/sample-page.json +0 -115
  193. package/template/workers/content-shared/tsconfig.json +0 -20
  194. package/template/workers/dev-team/README.md +0 -166
  195. package/template/workers/dev-team/_template.yaml +0 -70
  196. package/template/workers/dev-team/architect/package.json +0 -27
  197. package/template/workers/dev-team/architect/skills/api-design.md +0 -89
  198. package/template/workers/dev-team/architect/skills/refactor-plan.md +0 -96
  199. package/template/workers/dev-team/architect/skills/system-design.md +0 -100
  200. package/template/workers/dev-team/architect/src/index.ts +0 -49
  201. package/template/workers/dev-team/architect/src/mcp-server.ts +0 -122
  202. package/template/workers/dev-team/architect/src/skills/api-design.ts +0 -316
  203. package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +0 -264
  204. package/template/workers/dev-team/architect/src/skills/system-design.ts +0 -212
  205. package/template/workers/dev-team/architect/tsconfig.json +0 -19
  206. package/template/workers/dev-team/architect/worker.yaml +0 -128
  207. package/template/workers/dev-team/backend-dev/package-lock.json +0 -1252
  208. package/template/workers/dev-team/backend-dev/package.json +0 -27
  209. package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +0 -70
  210. package/template/workers/dev-team/backend-dev/skills/implement-service.md +0 -62
  211. package/template/workers/dev-team/backend-dev/src/index.ts +0 -51
  212. package/template/workers/dev-team/backend-dev/src/mcp-server.ts +0 -109
  213. package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +0 -122
  214. package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +0 -126
  215. package/template/workers/dev-team/backend-dev/tsconfig.json +0 -19
  216. package/template/workers/dev-team/backend-dev/worker.yaml +0 -128
  217. package/template/workers/dev-team/code-reviewer/package-lock.json +0 -1080
  218. package/template/workers/dev-team/code-reviewer/package.json +0 -24
  219. package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +0 -61
  220. package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +0 -54
  221. package/template/workers/dev-team/code-reviewer/skills/request-changes.md +0 -63
  222. package/template/workers/dev-team/code-reviewer/skills/review-pr.md +0 -77
  223. package/template/workers/dev-team/code-reviewer/src/index.ts +0 -56
  224. package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +0 -101
  225. package/template/workers/dev-team/code-reviewer/tsconfig.json +0 -19
  226. package/template/workers/dev-team/code-reviewer/worker.yaml +0 -90
  227. package/template/workers/dev-team/database-dev/package.json +0 -22
  228. package/template/workers/dev-team/database-dev/skills/create-schema.md +0 -48
  229. package/template/workers/dev-team/database-dev/src/index.ts +0 -50
  230. package/template/workers/dev-team/database-dev/src/mcp-server.ts +0 -76
  231. package/template/workers/dev-team/database-dev/tsconfig.json +0 -18
  232. package/template/workers/dev-team/database-dev/worker.yaml +0 -90
  233. package/template/workers/dev-team/frontend-dev/package.json +0 -22
  234. package/template/workers/dev-team/frontend-dev/skills/create-component.md +0 -26
  235. package/template/workers/dev-team/frontend-dev/src/index.ts +0 -50
  236. package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +0 -77
  237. package/template/workers/dev-team/frontend-dev/tsconfig.json +0 -18
  238. package/template/workers/dev-team/frontend-dev/worker.yaml +0 -132
  239. package/template/workers/dev-team/infra-dev/package.json +0 -24
  240. package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +0 -73
  241. package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +0 -80
  242. package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +0 -62
  243. package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +0 -63
  244. package/template/workers/dev-team/infra-dev/src/index.ts +0 -55
  245. package/template/workers/dev-team/infra-dev/src/mcp-server.ts +0 -82
  246. package/template/workers/dev-team/infra-dev/tsconfig.json +0 -19
  247. package/template/workers/dev-team/infra-dev/worker.yaml +0 -92
  248. package/template/workers/dev-team/knowledge-curator/package.json +0 -24
  249. package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +0 -63
  250. package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +0 -61
  251. package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +0 -76
  252. package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +0 -63
  253. package/template/workers/dev-team/knowledge-curator/src/index.ts +0 -53
  254. package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +0 -92
  255. package/template/workers/dev-team/knowledge-curator/tsconfig.json +0 -19
  256. package/template/workers/dev-team/knowledge-curator/worker.yaml +0 -80
  257. package/template/workers/dev-team/motion-designer/package.json +0 -22
  258. package/template/workers/dev-team/motion-designer/skills/add-animation.md +0 -25
  259. package/template/workers/dev-team/motion-designer/skills/generate-image.md +0 -36
  260. package/template/workers/dev-team/motion-designer/src/index.ts +0 -63
  261. package/template/workers/dev-team/motion-designer/src/mcp-server.ts +0 -79
  262. package/template/workers/dev-team/motion-designer/tsconfig.json +0 -18
  263. package/template/workers/dev-team/motion-designer/worker.yaml +0 -84
  264. package/template/workers/dev-team/product-planner/queue.json +0 -4
  265. package/template/workers/dev-team/product-planner/worker.yaml +0 -220
  266. package/template/workers/dev-team/project-manager/package-lock.json +0 -1252
  267. package/template/workers/dev-team/project-manager/package.json +0 -27
  268. package/template/workers/dev-team/project-manager/skills/create-prd.md +0 -66
  269. package/template/workers/dev-team/project-manager/skills/next-issue.md +0 -51
  270. package/template/workers/dev-team/project-manager/skills/project-status.md +0 -59
  271. package/template/workers/dev-team/project-manager/skills/update-learnings.md +0 -65
  272. package/template/workers/dev-team/project-manager/src/index.ts +0 -54
  273. package/template/workers/dev-team/project-manager/src/mcp-server.ts +0 -207
  274. package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +0 -86
  275. package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +0 -137
  276. package/template/workers/dev-team/project-manager/src/skills/project-status.ts +0 -131
  277. package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +0 -94
  278. package/template/workers/dev-team/project-manager/tsconfig.json +0 -19
  279. package/template/workers/dev-team/project-manager/worker.yaml +0 -96
  280. package/template/workers/dev-team/qa-tester/package.json +0 -24
  281. package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +0 -36
  282. package/template/workers/dev-team/qa-tester/skills/run-tests.md +0 -36
  283. package/template/workers/dev-team/qa-tester/skills/write-test.md +0 -27
  284. package/template/workers/dev-team/qa-tester/src/index.ts +0 -61
  285. package/template/workers/dev-team/qa-tester/src/mcp-server.ts +0 -88
  286. package/template/workers/dev-team/qa-tester/tsconfig.json +0 -18
  287. package/template/workers/dev-team/qa-tester/worker.yaml +0 -116
  288. package/template/workers/dev-team/task-executor/package-lock.json +0 -1252
  289. package/template/workers/dev-team/task-executor/package.json +0 -27
  290. package/template/workers/dev-team/task-executor/skills/analyze-issue.md +0 -101
  291. package/template/workers/dev-team/task-executor/skills/execute.md +0 -133
  292. package/template/workers/dev-team/task-executor/skills/report-learnings.md +0 -106
  293. package/template/workers/dev-team/task-executor/skills/validate-completion.md +0 -121
  294. package/template/workers/dev-team/task-executor/src/index.ts +0 -54
  295. package/template/workers/dev-team/task-executor/src/mcp-server.ts +0 -139
  296. package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +0 -219
  297. package/template/workers/dev-team/task-executor/src/skills/execute.ts +0 -132
  298. package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +0 -119
  299. package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +0 -142
  300. package/template/workers/dev-team/task-executor/tsconfig.json +0 -19
  301. package/template/workers/dev-team/task-executor/worker.yaml +0 -110
  302. package/template/workers/registry.yaml +0 -171
  303. package/template/workers/security-scanner/README.md +0 -73
  304. package/template/workers/security-scanner/skills/pre-deploy-check.md +0 -205
  305. package/template/workers/security-scanner/worker.yaml +0 -26
  306. package/template/workspace/checkpoints/.gitkeep +0 -0
  307. package/template/workspace/content-ideas/inbox.jsonl +0 -0
  308. package/template/workspace/drafts/.gitkeep +0 -0
  309. package/template/workspace/learnings/.gitkeep +0 -3
  310. package/template/workspace/orchestrator/.gitkeep +0 -0
  311. package/template/workspace/ralph-test/COMPLETE.md +0 -18
  312. package/template/workspace/ralph-test/hello.txt +0 -2
  313. package/template/workspace/reports/.gitkeep +0 -0
  314. package/template/workspace/scratch/.gitkeep +0 -0
  315. 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
- }