create-hq 5.1.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.
- package/dist/deps.d.ts +2 -2
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +138 -29
- package/dist/deps.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +16 -26
- package/dist/scaffold.js.map +1 -1
- package/dist/ui.js +1 -1
- package/package.json +3 -6
- package/template/.claude/CLAUDE.md +0 -202
- package/template/.claude/commands/checkpoint.md +0 -127
- package/template/.claude/commands/cleanup.md +0 -307
- package/template/.claude/commands/execute-task.md +0 -440
- package/template/.claude/commands/exit-plan.md +0 -41
- package/template/.claude/commands/handoff.md +0 -97
- package/template/.claude/commands/learn.md +0 -218
- package/template/.claude/commands/metrics.md +0 -118
- package/template/.claude/commands/newworker.md +0 -162
- package/template/.claude/commands/nexttask.md +0 -67
- package/template/.claude/commands/prd.md +0 -238
- package/template/.claude/commands/reanchor.md +0 -51
- package/template/.claude/commands/remember.md +0 -126
- package/template/.claude/commands/run-project.md +0 -348
- package/template/.claude/commands/run.md +0 -110
- package/template/.claude/commands/search-reindex.md +0 -62
- package/template/.claude/commands/search.md +0 -100
- package/template/.claude/commands/setup.md +0 -381
- package/template/.claude/scripts/pure-ralph-loop.ps1 +0 -312
- package/template/.claude/scripts/pure-ralph-loop.sh +0 -859
- package/template/CHANGELOG.md +0 -220
- package/template/LICENSE +0 -21
- package/template/MIGRATION.md +0 -259
- package/template/README.md +0 -368
- package/template/data/journal/.gitkeep +0 -0
- package/template/docs/images/ascii-banner-options.md +0 -122
- package/template/docs/images/hq-banner.svg +0 -105
- package/template/knowledge/Ralph/01-overview.md +0 -71
- package/template/knowledge/Ralph/02-core-concepts.md +0 -114
- package/template/knowledge/Ralph/03-how-ralph-works.md +0 -184
- package/template/knowledge/Ralph/04-back-pressure.md +0 -222
- package/template/knowledge/Ralph/05-specifications.md +0 -210
- package/template/knowledge/Ralph/06-agents-md.md +0 -222
- package/template/knowledge/Ralph/07-implementation.md +0 -316
- package/template/knowledge/Ralph/08-economics.md +0 -182
- package/template/knowledge/Ralph/09-resources.md +0 -145
- package/template/knowledge/Ralph/10-claude-code-workflow.md +0 -212
- package/template/knowledge/Ralph/11-team-training-guide.md +0 -383
- package/template/knowledge/Ralph/README.md +0 -40
- package/template/knowledge/ai-security-framework/CONTRIBUTING.md +0 -139
- package/template/knowledge/ai-security-framework/GLOSSARY.md +0 -176
- package/template/knowledge/ai-security-framework/LICENSE +0 -21
- package/template/knowledge/ai-security-framework/QUICK-START.md +0 -172
- package/template/knowledge/ai-security-framework/README.md +0 -232
- package/template/knowledge/ai-security-framework/checklists/browser-security.md +0 -301
- package/template/knowledge/ai-security-framework/checklists/credential-isolation.md +0 -322
- package/template/knowledge/ai-security-framework/checklists/incident-response.md +0 -288
- package/template/knowledge/ai-security-framework/checklists/pre-flight.md +0 -249
- package/template/knowledge/ai-security-framework/checklists/weekly-audit.md +0 -159
- package/template/knowledge/ai-security-framework/configs/audit-logging.md +0 -372
- package/template/knowledge/ai-security-framework/configs/kill-switches.md +0 -354
- package/template/knowledge/ai-security-framework/docs/01-core-principles.md +0 -256
- package/template/knowledge/ai-security-framework/docs/02-threat-landscape.md +0 -326
- package/template/knowledge/ai-security-framework/docs/03-security-posture.md +0 -250
- package/template/knowledge/ai-security-framework/templates/agents-security.md +0 -233
- package/template/knowledge/design-styles/README.md +0 -42
- package/template/knowledge/design-styles/american-industrial.md +0 -136
- package/template/knowledge/design-styles/ethereal-abstract.md +0 -133
- package/template/knowledge/design-styles/liminal-portal.md +0 -111
- package/template/knowledge/design-styles/swipes/american-industrial/G-3m4YPW0AADdu2.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-JJlt5WwAABK3K.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G-JJmj5W0AEbJ-7.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ (1).jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G59fgNuXkAAKLJQ.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G7fVkn3WEAAM-ST.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G8ECO5JWEAIksyn.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G9-3GQSWoAA8eqZ.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G9xEOqrXkAEZRcs.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G_MVeJrXQAA8sx4.jpeg +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/G_RSkmGXkAAgAVZ.png +0 -0
- package/template/knowledge/design-styles/swipes/american-industrial/README.md +0 -31
- package/template/knowledge/design-styles/swipes/american-industrial/qyqtg7Dq.png +0 -0
- package/template/knowledge/dev-team/README.md +0 -35
- package/template/knowledge/dev-team/patterns/README.md +0 -34
- package/template/knowledge/dev-team/patterns/frontend/react-best-practices.md +0 -178
- package/template/knowledge/dev-team/troubleshooting/README.md +0 -31
- package/template/knowledge/dev-team/workflows/README.md +0 -49
- package/template/knowledge/hq/checkpoint-schema.json +0 -51
- package/template/knowledge/hq/index-md-spec.md +0 -74
- package/template/knowledge/hq/thread-schema.md +0 -153
- package/template/knowledge/hq-core/checkpoint-schema.json +0 -51
- package/template/knowledge/hq-core/index-md-spec.md +0 -74
- package/template/knowledge/hq-core/thread-schema.md +0 -153
- package/template/knowledge/loom/README.md +0 -51
- package/template/knowledge/loom/architecture.md +0 -125
- package/template/knowledge/loom/code-style.md +0 -169
- package/template/knowledge/loom/llm-proxy.md +0 -132
- package/template/knowledge/loom/state-machine.md +0 -131
- package/template/knowledge/loom/thread-system.md +0 -117
- package/template/knowledge/loom/tools.md +0 -94
- package/template/knowledge/loom/weaver.md +0 -96
- package/template/knowledge/loom/web-frontend.md +0 -131
- package/template/knowledge/projects/README.md +0 -72
- package/template/knowledge/projects/templates/README.template.md +0 -28
- package/template/knowledge/workers/README.md +0 -195
- package/template/knowledge/workers/ralph-loop-pattern.md +0 -157
- package/template/knowledge/workers/skill-schema.md +0 -182
- package/template/knowledge/workers/state-machine.md +0 -102
- package/template/knowledge/workers/templates/base-worker.yaml +0 -73
- package/template/knowledge/workers/templates/code-worker.yaml +0 -85
- package/template/knowledge/workers/templates/skill.yaml +0 -49
- package/template/knowledge/workers/templates/social-worker.yaml +0 -70
- package/template/modules/examples/full-manifest.yaml +0 -92
- package/template/modules/examples/minimal.yaml +0 -14
- package/template/modules/modules.yaml +0 -59
- package/template/projects/.gitkeep +0 -0
- package/template/projects/incorporate-workers-into-pure-ralph/prd.json +0 -88
- package/template/projects/pure-ralph-branch-isolation/README.md +0 -114
- package/template/projects/pure-ralph-branch-isolation/prd.json +0 -123
- package/template/projects/purist-ralph-loop/README.md +0 -148
- package/template/projects/purist-ralph-loop/prd.json +0 -135
- package/template/projects/ralph-test/prd.json +0 -50
- package/template/prompts/pure-ralph-base.md +0 -551
- package/template/settings/.gitkeep +0 -0
- package/template/settings/pure-ralph.json +0 -42
- package/template/social-content/drafts/INDEX.md +0 -21
- package/template/social-content/drafts/linkedin/.gitkeep +0 -1
- package/template/social-content/drafts/x/.gitkeep +0 -1
- package/template/social-content/images/.gitkeep +0 -1
- package/template/starter-projects/code-worker/README.md +0 -97
- package/template/starter-projects/code-worker/prd.json +0 -45
- package/template/starter-projects/personal-assistant/README.md +0 -42
- package/template/starter-projects/personal-assistant/prd.json +0 -43
- package/template/starter-projects/social-media/README.md +0 -60
- package/template/starter-projects/social-media/prd.json +0 -43
- package/template/workers/content-brand/README.md +0 -59
- package/template/workers/content-brand/skills/messaging-alignment.md +0 -91
- package/template/workers/content-brand/skills/tone-check.md +0 -76
- package/template/workers/content-brand/skills/voice-analysis.md +0 -68
- package/template/workers/content-brand/worker.yaml +0 -81
- package/template/workers/content-legal/README.md +0 -80
- package/template/workers/content-legal/skills/claim-substantiation.md +0 -150
- package/template/workers/content-legal/skills/compliance-scan.md +0 -123
- package/template/workers/content-legal/skills/disclaimer-check.md +0 -146
- package/template/workers/content-legal/worker.yaml +0 -118
- package/template/workers/content-product/README.md +0 -77
- package/template/workers/content-product/skills/claim-verification.md +0 -96
- package/template/workers/content-product/skills/feature-accuracy.md +0 -117
- package/template/workers/content-product/skills/stats-check.md +0 -128
- package/template/workers/content-product/worker.yaml +0 -97
- package/template/workers/content-sales/README.md +0 -70
- package/template/workers/content-sales/skills/conversion-analysis.md +0 -96
- package/template/workers/content-sales/skills/cta-audit.md +0 -107
- package/template/workers/content-sales/skills/value-prop-check.md +0 -114
- package/template/workers/content-sales/worker.yaml +0 -93
- package/template/workers/content-shared/cli.ts +0 -242
- package/template/workers/content-shared/index.ts +0 -234
- package/template/workers/content-shared/lib/accuracy-analyzer.ts +0 -661
- package/template/workers/content-shared/lib/analyze.ts +0 -370
- package/template/workers/content-shared/lib/brand-analyzer.ts +0 -526
- package/template/workers/content-shared/lib/cms-integration.ts +0 -446
- package/template/workers/content-shared/lib/compliance-analyzer.ts +0 -655
- package/template/workers/content-shared/lib/conversion-analyzer.ts +0 -555
- package/template/workers/content-shared/lib/github-integration.ts +0 -582
- package/template/workers/content-shared/lib/output.ts +0 -373
- package/template/workers/content-shared/lib/parser.ts +0 -771
- package/template/workers/content-shared/lib/priority.ts +0 -439
- package/template/workers/content-shared/lib/recommendations.ts +0 -512
- package/template/workers/content-shared/lib/reporter.ts +0 -749
- package/template/workers/content-shared/lib/restructure.ts +0 -664
- package/template/workers/content-shared/lib/scorer.ts +0 -140
- package/template/workers/content-shared/lib/types.ts +0 -227
- package/template/workers/content-shared/lib/variants.ts +0 -595
- package/template/workers/content-shared/package.json +0 -51
- package/template/workers/content-shared/pnpm-lock.yaml +0 -39
- package/template/workers/content-shared/test/sample-page.json +0 -115
- package/template/workers/content-shared/tsconfig.json +0 -20
- package/template/workers/dev-team/README.md +0 -166
- package/template/workers/dev-team/_template.yaml +0 -70
- package/template/workers/dev-team/architect/package.json +0 -27
- package/template/workers/dev-team/architect/skills/api-design.md +0 -89
- package/template/workers/dev-team/architect/skills/refactor-plan.md +0 -96
- package/template/workers/dev-team/architect/skills/system-design.md +0 -100
- package/template/workers/dev-team/architect/src/index.ts +0 -49
- package/template/workers/dev-team/architect/src/mcp-server.ts +0 -122
- package/template/workers/dev-team/architect/src/skills/api-design.ts +0 -316
- package/template/workers/dev-team/architect/src/skills/refactor-plan.ts +0 -264
- package/template/workers/dev-team/architect/src/skills/system-design.ts +0 -212
- package/template/workers/dev-team/architect/tsconfig.json +0 -19
- package/template/workers/dev-team/architect/worker.yaml +0 -128
- package/template/workers/dev-team/backend-dev/package-lock.json +0 -1252
- package/template/workers/dev-team/backend-dev/package.json +0 -27
- package/template/workers/dev-team/backend-dev/skills/implement-endpoint.md +0 -70
- package/template/workers/dev-team/backend-dev/skills/implement-service.md +0 -62
- package/template/workers/dev-team/backend-dev/src/index.ts +0 -51
- package/template/workers/dev-team/backend-dev/src/mcp-server.ts +0 -109
- package/template/workers/dev-team/backend-dev/src/skills/implement-endpoint.ts +0 -122
- package/template/workers/dev-team/backend-dev/src/skills/implement-service.ts +0 -126
- package/template/workers/dev-team/backend-dev/tsconfig.json +0 -19
- package/template/workers/dev-team/backend-dev/worker.yaml +0 -128
- package/template/workers/dev-team/code-reviewer/package-lock.json +0 -1080
- package/template/workers/dev-team/code-reviewer/package.json +0 -24
- package/template/workers/dev-team/code-reviewer/skills/merge-to-production.md +0 -61
- package/template/workers/dev-team/code-reviewer/skills/merge-to-staging.md +0 -54
- package/template/workers/dev-team/code-reviewer/skills/request-changes.md +0 -63
- package/template/workers/dev-team/code-reviewer/skills/review-pr.md +0 -77
- package/template/workers/dev-team/code-reviewer/src/index.ts +0 -56
- package/template/workers/dev-team/code-reviewer/src/mcp-server.ts +0 -101
- package/template/workers/dev-team/code-reviewer/tsconfig.json +0 -19
- package/template/workers/dev-team/code-reviewer/worker.yaml +0 -90
- package/template/workers/dev-team/database-dev/package.json +0 -22
- package/template/workers/dev-team/database-dev/skills/create-schema.md +0 -48
- package/template/workers/dev-team/database-dev/src/index.ts +0 -50
- package/template/workers/dev-team/database-dev/src/mcp-server.ts +0 -76
- package/template/workers/dev-team/database-dev/tsconfig.json +0 -18
- package/template/workers/dev-team/database-dev/worker.yaml +0 -90
- package/template/workers/dev-team/frontend-dev/package.json +0 -22
- package/template/workers/dev-team/frontend-dev/skills/create-component.md +0 -26
- package/template/workers/dev-team/frontend-dev/src/index.ts +0 -50
- package/template/workers/dev-team/frontend-dev/src/mcp-server.ts +0 -77
- package/template/workers/dev-team/frontend-dev/tsconfig.json +0 -18
- package/template/workers/dev-team/frontend-dev/worker.yaml +0 -132
- package/template/workers/dev-team/infra-dev/package.json +0 -24
- package/template/workers/dev-team/infra-dev/skills/add-monitoring.md +0 -73
- package/template/workers/dev-team/infra-dev/skills/configure-deployment.md +0 -80
- package/template/workers/dev-team/infra-dev/skills/create-dockerfile.md +0 -62
- package/template/workers/dev-team/infra-dev/skills/setup-cicd.md +0 -63
- package/template/workers/dev-team/infra-dev/src/index.ts +0 -55
- package/template/workers/dev-team/infra-dev/src/mcp-server.ts +0 -82
- package/template/workers/dev-team/infra-dev/tsconfig.json +0 -19
- package/template/workers/dev-team/infra-dev/worker.yaml +0 -92
- package/template/workers/dev-team/knowledge-curator/package.json +0 -24
- package/template/workers/dev-team/knowledge-curator/skills/curate-troubleshooting.md +0 -63
- package/template/workers/dev-team/knowledge-curator/skills/process-learnings.md +0 -61
- package/template/workers/dev-team/knowledge-curator/skills/sync-documentation.md +0 -76
- package/template/workers/dev-team/knowledge-curator/skills/update-patterns.md +0 -63
- package/template/workers/dev-team/knowledge-curator/src/index.ts +0 -53
- package/template/workers/dev-team/knowledge-curator/src/mcp-server.ts +0 -92
- package/template/workers/dev-team/knowledge-curator/tsconfig.json +0 -19
- package/template/workers/dev-team/knowledge-curator/worker.yaml +0 -80
- package/template/workers/dev-team/motion-designer/package.json +0 -22
- package/template/workers/dev-team/motion-designer/skills/add-animation.md +0 -25
- package/template/workers/dev-team/motion-designer/skills/generate-image.md +0 -36
- package/template/workers/dev-team/motion-designer/src/index.ts +0 -63
- package/template/workers/dev-team/motion-designer/src/mcp-server.ts +0 -79
- package/template/workers/dev-team/motion-designer/tsconfig.json +0 -18
- package/template/workers/dev-team/motion-designer/worker.yaml +0 -84
- package/template/workers/dev-team/product-planner/queue.json +0 -4
- package/template/workers/dev-team/product-planner/worker.yaml +0 -220
- package/template/workers/dev-team/project-manager/package-lock.json +0 -1252
- package/template/workers/dev-team/project-manager/package.json +0 -27
- package/template/workers/dev-team/project-manager/skills/create-prd.md +0 -66
- package/template/workers/dev-team/project-manager/skills/next-issue.md +0 -51
- package/template/workers/dev-team/project-manager/skills/project-status.md +0 -59
- package/template/workers/dev-team/project-manager/skills/update-learnings.md +0 -65
- package/template/workers/dev-team/project-manager/src/index.ts +0 -54
- package/template/workers/dev-team/project-manager/src/mcp-server.ts +0 -207
- package/template/workers/dev-team/project-manager/src/skills/create-prd.ts +0 -86
- package/template/workers/dev-team/project-manager/src/skills/next-issue.ts +0 -137
- package/template/workers/dev-team/project-manager/src/skills/project-status.ts +0 -131
- package/template/workers/dev-team/project-manager/src/skills/update-learnings.ts +0 -94
- package/template/workers/dev-team/project-manager/tsconfig.json +0 -19
- package/template/workers/dev-team/project-manager/worker.yaml +0 -96
- package/template/workers/dev-team/qa-tester/package.json +0 -24
- package/template/workers/dev-team/qa-tester/skills/create-demo-account.md +0 -36
- package/template/workers/dev-team/qa-tester/skills/run-tests.md +0 -36
- package/template/workers/dev-team/qa-tester/skills/write-test.md +0 -27
- package/template/workers/dev-team/qa-tester/src/index.ts +0 -61
- package/template/workers/dev-team/qa-tester/src/mcp-server.ts +0 -88
- package/template/workers/dev-team/qa-tester/tsconfig.json +0 -18
- package/template/workers/dev-team/qa-tester/worker.yaml +0 -116
- package/template/workers/dev-team/task-executor/package-lock.json +0 -1252
- package/template/workers/dev-team/task-executor/package.json +0 -27
- package/template/workers/dev-team/task-executor/skills/analyze-issue.md +0 -101
- package/template/workers/dev-team/task-executor/skills/execute.md +0 -133
- package/template/workers/dev-team/task-executor/skills/report-learnings.md +0 -106
- package/template/workers/dev-team/task-executor/skills/validate-completion.md +0 -121
- package/template/workers/dev-team/task-executor/src/index.ts +0 -54
- package/template/workers/dev-team/task-executor/src/mcp-server.ts +0 -139
- package/template/workers/dev-team/task-executor/src/skills/analyze-issue.ts +0 -219
- package/template/workers/dev-team/task-executor/src/skills/execute.ts +0 -132
- package/template/workers/dev-team/task-executor/src/skills/report-learnings.ts +0 -119
- package/template/workers/dev-team/task-executor/src/skills/validate-completion.ts +0 -142
- package/template/workers/dev-team/task-executor/tsconfig.json +0 -19
- package/template/workers/dev-team/task-executor/worker.yaml +0 -110
- package/template/workers/registry.yaml +0 -171
- package/template/workers/security-scanner/README.md +0 -73
- package/template/workers/security-scanner/skills/pre-deploy-check.md +0 -205
- package/template/workers/security-scanner/worker.yaml +0 -26
- package/template/workspace/checkpoints/.gitkeep +0 -0
- package/template/workspace/content-ideas/inbox.jsonl +0 -0
- package/template/workspace/drafts/.gitkeep +0 -0
- package/template/workspace/learnings/.gitkeep +0 -3
- package/template/workspace/orchestrator/.gitkeep +0 -0
- package/template/workspace/ralph-test/COMPLETE.md +0 -18
- package/template/workspace/ralph-test/hello.txt +0 -2
- package/template/workspace/reports/.gitkeep +0 -0
- package/template/workspace/scratch/.gitkeep +0 -0
- package/template/workspace/threads/.gitkeep +0 -3
|
@@ -1,595 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A/B Copy Variants Generator (US-013)
|
|
3
|
-
* Generates alternative copy options for testing and optimization
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// ============================================
|
|
7
|
-
// Types
|
|
8
|
-
// ============================================
|
|
9
|
-
|
|
10
|
-
export type VariantApproach = 'emotional' | 'logical' | 'urgent' | 'social-proof' | 'benefit-focused';
|
|
11
|
-
|
|
12
|
-
export interface CopyVariant {
|
|
13
|
-
id: string;
|
|
14
|
-
approach: VariantApproach;
|
|
15
|
-
text: string;
|
|
16
|
-
rationale: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface VariantContext {
|
|
20
|
-
pageSlug: string;
|
|
21
|
-
sectionId?: string;
|
|
22
|
-
sectionType?: string;
|
|
23
|
-
targetAudience?: string;
|
|
24
|
-
productName?: string;
|
|
25
|
-
keyBenefit?: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface VariantSet {
|
|
29
|
-
original: string;
|
|
30
|
-
sectionId?: string;
|
|
31
|
-
pageSlug: string;
|
|
32
|
-
variants: CopyVariant[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ============================================
|
|
36
|
-
// Variant ID Generation
|
|
37
|
-
// ============================================
|
|
38
|
-
|
|
39
|
-
let variantCounter = 0;
|
|
40
|
-
|
|
41
|
-
function generateVariantId(approach: VariantApproach): string {
|
|
42
|
-
variantCounter++;
|
|
43
|
-
return `var-${approach}-${Date.now()}-${variantCounter}`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ============================================
|
|
47
|
-
// Main Variant Generation
|
|
48
|
-
// ============================================
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Generate A/B copy variants for a text
|
|
52
|
-
*/
|
|
53
|
-
export function generateVariants(text: string, context: VariantContext): VariantSet {
|
|
54
|
-
const variants: CopyVariant[] = [];
|
|
55
|
-
|
|
56
|
-
// Generate variants for each approach
|
|
57
|
-
const emotional = generateEmotionalVariant(text, context);
|
|
58
|
-
const logical = generateLogicalVariant(text, context);
|
|
59
|
-
const urgent = generateUrgentVariant(text, context);
|
|
60
|
-
const socialProof = generateSocialProofVariant(text, context);
|
|
61
|
-
const benefitFocused = generateBenefitFocusedVariant(text, context);
|
|
62
|
-
|
|
63
|
-
// Only include variants that are meaningfully different from original
|
|
64
|
-
if (emotional.text !== text) variants.push(emotional);
|
|
65
|
-
if (logical.text !== text) variants.push(logical);
|
|
66
|
-
if (urgent.text !== text) variants.push(urgent);
|
|
67
|
-
if (socialProof.text !== text) variants.push(socialProof);
|
|
68
|
-
if (benefitFocused.text !== text) variants.push(benefitFocused);
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
original: text,
|
|
72
|
-
sectionId: context.sectionId,
|
|
73
|
-
pageSlug: context.pageSlug,
|
|
74
|
-
variants,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Generate variants for a specific approach only
|
|
80
|
-
*/
|
|
81
|
-
export function generateVariantForApproach(
|
|
82
|
-
text: string,
|
|
83
|
-
approach: VariantApproach,
|
|
84
|
-
context: VariantContext
|
|
85
|
-
): CopyVariant {
|
|
86
|
-
switch (approach) {
|
|
87
|
-
case 'emotional':
|
|
88
|
-
return generateEmotionalVariant(text, context);
|
|
89
|
-
case 'logical':
|
|
90
|
-
return generateLogicalVariant(text, context);
|
|
91
|
-
case 'urgent':
|
|
92
|
-
return generateUrgentVariant(text, context);
|
|
93
|
-
case 'social-proof':
|
|
94
|
-
return generateSocialProofVariant(text, context);
|
|
95
|
-
case 'benefit-focused':
|
|
96
|
-
return generateBenefitFocusedVariant(text, context);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ============================================
|
|
101
|
-
// Specific Variant Generators
|
|
102
|
-
// ============================================
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Generate emotional variant
|
|
106
|
-
* Focuses on feelings, aspirations, and connection
|
|
107
|
-
*/
|
|
108
|
-
export function generateEmotionalVariant(text: string, context?: VariantContext): CopyVariant {
|
|
109
|
-
let variant = text;
|
|
110
|
-
|
|
111
|
-
// Transform technical/neutral language to emotional
|
|
112
|
-
const emotionalTransforms: [RegExp, string][] = [
|
|
113
|
-
// Product descriptors
|
|
114
|
-
[/provides secure/gi, 'gives you peace of mind with'],
|
|
115
|
-
[/offers? (?:the )?solution/gi, 'transforms how you'],
|
|
116
|
-
[/enables you to/gi, 'empowers you to'],
|
|
117
|
-
[/allows you to/gi, 'frees you to'],
|
|
118
|
-
[/helps you/gi, 'supports you in'],
|
|
119
|
-
|
|
120
|
-
// Feature language
|
|
121
|
-
[/\bplatform\b/gi, 'partner'],
|
|
122
|
-
[/\btool\b/gi, 'ally'],
|
|
123
|
-
[/\bsoftware\b/gi, 'solution you can trust'],
|
|
124
|
-
|
|
125
|
-
// Outcome language
|
|
126
|
-
[/increase (?:your )?efficiency/gi, 'reclaim your time'],
|
|
127
|
-
[/reduce costs/gi, 'invest in what matters'],
|
|
128
|
-
[/improve productivity/gi, 'achieve more of what you love'],
|
|
129
|
-
|
|
130
|
-
// Generic CTA transforms
|
|
131
|
-
[/^learn more$/i, 'Discover Your Potential'],
|
|
132
|
-
[/^get started$/i, 'Begin Your Journey'],
|
|
133
|
-
[/^contact us$/i, 'Let\'s Connect'],
|
|
134
|
-
[/^sign up$/i, 'Join Our Community'],
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
for (const [pattern, replacement] of emotionalTransforms) {
|
|
138
|
-
variant = variant.replace(pattern, replacement);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Add emotional opener if short text
|
|
142
|
-
if (text.length < 100 && variant === text) {
|
|
143
|
-
const emotionalOpeners = [
|
|
144
|
-
'Finally, ',
|
|
145
|
-
'Imagine ',
|
|
146
|
-
'Experience ',
|
|
147
|
-
'Discover ',
|
|
148
|
-
];
|
|
149
|
-
const opener = emotionalOpeners[Math.floor(text.length % emotionalOpeners.length)];
|
|
150
|
-
variant = opener + text.charAt(0).toLowerCase() + text.slice(1);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
id: generateVariantId('emotional'),
|
|
155
|
-
approach: 'emotional',
|
|
156
|
-
text: variant,
|
|
157
|
-
rationale: 'Emotional variant focuses on feelings, aspirations, and personal connection to drive engagement.',
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Generate logical variant
|
|
163
|
-
* Focuses on facts, data, and rational arguments
|
|
164
|
-
*/
|
|
165
|
-
export function generateLogicalVariant(text: string, context?: VariantContext): CopyVariant {
|
|
166
|
-
let variant = text;
|
|
167
|
-
|
|
168
|
-
// Transform emotional/vague language to logical
|
|
169
|
-
const logicalTransforms: [RegExp, string][] = [
|
|
170
|
-
// Vague claims to specific
|
|
171
|
-
[/\bsave time\b/gi, 'reduce processing time by up to 40%'],
|
|
172
|
-
[/\bboost productivity\b/gi, 'increase output by an average of 25%'],
|
|
173
|
-
[/\bimprove efficiency\b/gi, 'streamline workflows with measurable results'],
|
|
174
|
-
[/\breduce errors\b/gi, 'achieve 99.9% accuracy rates'],
|
|
175
|
-
|
|
176
|
-
// Emotional to factual
|
|
177
|
-
[/\bamazing\b/gi, 'proven'],
|
|
178
|
-
[/\bincredible\b/gi, 'significant'],
|
|
179
|
-
[/\bpowerful\b/gi, 'comprehensive'],
|
|
180
|
-
[/\bseamless\b/gi, 'integrated'],
|
|
181
|
-
[/\bworld-class\b/gi, 'enterprise-grade'],
|
|
182
|
-
|
|
183
|
-
// Add specificity
|
|
184
|
-
[/\bmany companies\b/gi, 'over 500 companies'],
|
|
185
|
-
[/\bthousands of\b/gi, '10,000+'],
|
|
186
|
-
[/\bleading\b/gi, 'top-ranked'],
|
|
187
|
-
|
|
188
|
-
// CTA transforms
|
|
189
|
-
[/^learn more$/i, 'See the Data'],
|
|
190
|
-
[/^get started$/i, 'Start Your Free Trial'],
|
|
191
|
-
[/^contact us$/i, 'Request a Technical Demo'],
|
|
192
|
-
];
|
|
193
|
-
|
|
194
|
-
for (const [pattern, replacement] of logicalTransforms) {
|
|
195
|
-
variant = variant.replace(pattern, replacement);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Add logical framing if unchanged
|
|
199
|
-
if (variant === text && text.length < 150) {
|
|
200
|
-
const logicalFrames = [
|
|
201
|
-
'The data shows: ',
|
|
202
|
-
'Research confirms: ',
|
|
203
|
-
'Based on our analysis, ',
|
|
204
|
-
'Studies demonstrate that ',
|
|
205
|
-
];
|
|
206
|
-
const frame = logicalFrames[Math.floor(text.length % logicalFrames.length)];
|
|
207
|
-
variant = frame + text.charAt(0).toLowerCase() + text.slice(1);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return {
|
|
211
|
-
id: generateVariantId('logical'),
|
|
212
|
-
approach: 'logical',
|
|
213
|
-
text: variant,
|
|
214
|
-
rationale: 'Logical variant emphasizes facts, data, and rational arguments for analytical decision-makers.',
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Generate urgent variant
|
|
220
|
-
* Creates sense of scarcity and time pressure
|
|
221
|
-
*/
|
|
222
|
-
export function generateUrgentVariant(text: string, context?: VariantContext): CopyVariant {
|
|
223
|
-
let variant = text;
|
|
224
|
-
|
|
225
|
-
// Add urgency to CTAs and statements
|
|
226
|
-
const urgentTransforms: [RegExp, string][] = [
|
|
227
|
-
// CTA urgency
|
|
228
|
-
[/^learn more$/i, 'Get Access Now'],
|
|
229
|
-
[/^get started$/i, 'Start Today - Limited Spots'],
|
|
230
|
-
[/^contact us$/i, 'Schedule Your Demo Today'],
|
|
231
|
-
[/^sign up$/i, 'Claim Your Spot Now'],
|
|
232
|
-
[/^try it free$/i, 'Start Your Free Trial Now'],
|
|
233
|
-
[/^request demo$/i, 'Book Your Demo - Slots Filling Fast'],
|
|
234
|
-
|
|
235
|
-
// Statement urgency
|
|
236
|
-
[/you can/gi, 'you can now'],
|
|
237
|
-
[/we offer/gi, 'for a limited time, we offer'],
|
|
238
|
-
[/available/gi, 'available now'],
|
|
239
|
-
|
|
240
|
-
// Outcome urgency
|
|
241
|
-
[/\bstart saving\b/gi, 'start saving immediately'],
|
|
242
|
-
[/\bget results\b/gi, 'get results within days'],
|
|
243
|
-
[/\bsee improvements\b/gi, 'see improvements this week'],
|
|
244
|
-
];
|
|
245
|
-
|
|
246
|
-
for (const [pattern, replacement] of urgentTransforms) {
|
|
247
|
-
variant = variant.replace(pattern, replacement);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Add urgency suffix if unchanged
|
|
251
|
-
if (variant === text) {
|
|
252
|
-
const urgentSuffixes = [
|
|
253
|
-
' - Act Now',
|
|
254
|
-
' - Limited Time Offer',
|
|
255
|
-
' - Don\'t Wait',
|
|
256
|
-
' - Start Today',
|
|
257
|
-
];
|
|
258
|
-
// Only add to short texts (CTAs)
|
|
259
|
-
if (text.length < 50) {
|
|
260
|
-
const suffix = urgentSuffixes[Math.floor(text.length % urgentSuffixes.length)];
|
|
261
|
-
variant = text + suffix;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return {
|
|
266
|
-
id: generateVariantId('urgent'),
|
|
267
|
-
approach: 'urgent',
|
|
268
|
-
text: variant,
|
|
269
|
-
rationale: 'Urgent variant creates scarcity and time pressure to drive immediate action.',
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Generate social proof variant
|
|
275
|
-
* Leverages credibility, testimonials, and peer validation
|
|
276
|
-
*/
|
|
277
|
-
export function generateSocialProofVariant(text: string, context?: VariantContext): CopyVariant {
|
|
278
|
-
let variant = text;
|
|
279
|
-
|
|
280
|
-
// Add social proof elements
|
|
281
|
-
const socialProofTransforms: [RegExp, string][] = [
|
|
282
|
-
// Trust signals
|
|
283
|
-
[/\bsecure\b/gi, 'trusted by 1000+ companies'],
|
|
284
|
-
[/\breliable\b/gi, 'relied upon by industry leaders'],
|
|
285
|
-
[/\bproven\b/gi, 'proven by customer success stories'],
|
|
286
|
-
|
|
287
|
-
// CTA social proof
|
|
288
|
-
[/^learn more$/i, 'See Why Teams Choose Us'],
|
|
289
|
-
[/^get started$/i, 'Join 10,000+ Happy Customers'],
|
|
290
|
-
[/^contact us$/i, 'Talk to Our Award-Winning Team'],
|
|
291
|
-
[/^sign up$/i, 'Join Industry Leaders'],
|
|
292
|
-
[/^try it free$/i, 'See What Everyone\'s Talking About'],
|
|
293
|
-
|
|
294
|
-
// Outcome validation
|
|
295
|
-
[/\bimprove\b/gi, 'improve (like our 500+ customers have)'],
|
|
296
|
-
[/\bachieve\b/gi, 'achieve (as verified by our users)'],
|
|
297
|
-
];
|
|
298
|
-
|
|
299
|
-
for (const [pattern, replacement] of socialProofTransforms) {
|
|
300
|
-
variant = variant.replace(pattern, replacement);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// Add social proof framing if unchanged
|
|
304
|
-
if (variant === text && text.length < 200) {
|
|
305
|
-
const socialFrames = [
|
|
306
|
-
'Trusted by industry leaders: ',
|
|
307
|
-
'What our customers already know: ',
|
|
308
|
-
'Join thousands who have discovered: ',
|
|
309
|
-
'As our customers will tell you: ',
|
|
310
|
-
];
|
|
311
|
-
const frame = socialFrames[Math.floor(text.length % socialFrames.length)];
|
|
312
|
-
variant = frame + text.charAt(0).toLowerCase() + text.slice(1);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return {
|
|
316
|
-
id: generateVariantId('social-proof'),
|
|
317
|
-
approach: 'social-proof',
|
|
318
|
-
text: variant,
|
|
319
|
-
rationale: 'Social proof variant leverages credibility and peer validation to build trust.',
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Generate benefit-focused variant
|
|
325
|
-
* Emphasizes outcomes and value to the user
|
|
326
|
-
*/
|
|
327
|
-
export function generateBenefitFocusedVariant(text: string, context?: VariantContext): CopyVariant {
|
|
328
|
-
let variant = text;
|
|
329
|
-
|
|
330
|
-
// Transform features to benefits
|
|
331
|
-
const benefitTransforms: [RegExp, string][] = [
|
|
332
|
-
// Feature to benefit
|
|
333
|
-
[/\bautomation\b/gi, 'hours saved every week'],
|
|
334
|
-
[/\bintegration\b/gi, 'all your tools working together'],
|
|
335
|
-
[/\banalytics\b/gi, 'insights that drive growth'],
|
|
336
|
-
[/\breporting\b/gi, 'clarity on what matters'],
|
|
337
|
-
[/\bsecurity\b/gi, 'protection for what matters most'],
|
|
338
|
-
[/\bcompliance\b/gi, 'worry-free operations'],
|
|
339
|
-
|
|
340
|
-
// Process to outcome
|
|
341
|
-
[/we (?:will )?process/gi, 'you\'ll get'],
|
|
342
|
-
[/we (?:will )?handle/gi, 'you\'ll enjoy'],
|
|
343
|
-
[/we (?:will )?manage/gi, 'you\'ll control'],
|
|
344
|
-
|
|
345
|
-
// Technical to benefit
|
|
346
|
-
[/\bAI-powered\b/gi, 'smarter'],
|
|
347
|
-
[/\bcloud-based\b/gi, 'accessible anywhere'],
|
|
348
|
-
[/\breal-time\b/gi, 'instant'],
|
|
349
|
-
[/\bscalable\b/gi, 'grows with you'],
|
|
350
|
-
|
|
351
|
-
// CTA benefits
|
|
352
|
-
[/^learn more$/i, 'See What You\'ll Gain'],
|
|
353
|
-
[/^get started$/i, 'Start Seeing Results'],
|
|
354
|
-
[/^contact us$/i, 'Discover Your Benefits'],
|
|
355
|
-
[/^sign up$/i, 'Unlock Your Potential'],
|
|
356
|
-
];
|
|
357
|
-
|
|
358
|
-
for (const [pattern, replacement] of benefitTransforms) {
|
|
359
|
-
variant = variant.replace(pattern, replacement);
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Add benefit framing if unchanged
|
|
363
|
-
if (variant === text && text.length < 150) {
|
|
364
|
-
// Try to identify the implied benefit and make it explicit
|
|
365
|
-
const keyBenefit = context?.keyBenefit ?? 'results';
|
|
366
|
-
variant = `Get the ${keyBenefit} you need: ${text.charAt(0).toLowerCase()}${text.slice(1)}`;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
return {
|
|
370
|
-
id: generateVariantId('benefit-focused'),
|
|
371
|
-
approach: 'benefit-focused',
|
|
372
|
-
text: variant,
|
|
373
|
-
rationale: 'Benefit-focused variant emphasizes outcomes and value to the user, not features.',
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// ============================================
|
|
378
|
-
// CTA-Specific Variants
|
|
379
|
-
// ============================================
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Generate variants specifically for CTA buttons
|
|
383
|
-
*/
|
|
384
|
-
export function generateCTAVariants(ctaText: string, context: VariantContext): VariantSet {
|
|
385
|
-
const variants: CopyVariant[] = [];
|
|
386
|
-
|
|
387
|
-
// Action-oriented
|
|
388
|
-
variants.push({
|
|
389
|
-
id: generateVariantId('benefit-focused'),
|
|
390
|
-
approach: 'benefit-focused',
|
|
391
|
-
text: transformCTAToAction(ctaText),
|
|
392
|
-
rationale: 'Action-oriented CTA that clearly states what the user will do.',
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// Value-oriented
|
|
396
|
-
variants.push({
|
|
397
|
-
id: generateVariantId('benefit-focused'),
|
|
398
|
-
approach: 'benefit-focused',
|
|
399
|
-
text: transformCTAToValue(ctaText, context),
|
|
400
|
-
rationale: 'Value-oriented CTA that emphasizes what the user will gain.',
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
// Urgency-oriented
|
|
404
|
-
variants.push({
|
|
405
|
-
id: generateVariantId('urgent'),
|
|
406
|
-
approach: 'urgent',
|
|
407
|
-
text: transformCTAToUrgent(ctaText),
|
|
408
|
-
rationale: 'Urgency-oriented CTA that creates time pressure.',
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
// Social-oriented
|
|
412
|
-
variants.push({
|
|
413
|
-
id: generateVariantId('social-proof'),
|
|
414
|
-
approach: 'social-proof',
|
|
415
|
-
text: transformCTAToSocial(ctaText),
|
|
416
|
-
rationale: 'Social-oriented CTA that leverages peer validation.',
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
// Filter duplicates and variants identical to original
|
|
420
|
-
const uniqueVariants = variants.filter((v, i, arr) =>
|
|
421
|
-
v.text !== ctaText && arr.findIndex(x => x.text === v.text) === i
|
|
422
|
-
);
|
|
423
|
-
|
|
424
|
-
return {
|
|
425
|
-
original: ctaText,
|
|
426
|
-
sectionId: context.sectionId,
|
|
427
|
-
pageSlug: context.pageSlug,
|
|
428
|
-
variants: uniqueVariants,
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function transformCTAToAction(cta: string): string {
|
|
433
|
-
const actionMap: Record<string, string> = {
|
|
434
|
-
'learn more': 'Explore Features',
|
|
435
|
-
'get started': 'Create Account',
|
|
436
|
-
'contact us': 'Send Message',
|
|
437
|
-
'sign up': 'Create Free Account',
|
|
438
|
-
'subscribe': 'Join Newsletter',
|
|
439
|
-
'download': 'Get Your Copy',
|
|
440
|
-
'try free': 'Start Free Trial',
|
|
441
|
-
'request demo': 'Schedule Demo',
|
|
442
|
-
'buy now': 'Complete Purchase',
|
|
443
|
-
'add to cart': 'Add to Cart',
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
const lower = cta.toLowerCase().trim();
|
|
447
|
-
return actionMap[lower] ?? cta;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
function transformCTAToValue(cta: string, context: VariantContext): string {
|
|
451
|
-
const valueMap: Record<string, string> = {
|
|
452
|
-
'learn more': 'See How It Works',
|
|
453
|
-
'get started': 'Start Saving Time',
|
|
454
|
-
'contact us': 'Get Expert Help',
|
|
455
|
-
'sign up': 'Unlock All Features',
|
|
456
|
-
'subscribe': 'Get Exclusive Updates',
|
|
457
|
-
'download': 'Get Your Free Guide',
|
|
458
|
-
'try free': 'Try Risk-Free',
|
|
459
|
-
'request demo': 'See It In Action',
|
|
460
|
-
'buy now': 'Get Instant Access',
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
const lower = cta.toLowerCase().trim();
|
|
464
|
-
return valueMap[lower] ?? cta;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
function transformCTAToUrgent(cta: string): string {
|
|
468
|
-
const urgentMap: Record<string, string> = {
|
|
469
|
-
'learn more': 'Discover Now',
|
|
470
|
-
'get started': 'Start Now',
|
|
471
|
-
'contact us': 'Talk to Us Today',
|
|
472
|
-
'sign up': 'Sign Up Now',
|
|
473
|
-
'subscribe': 'Subscribe Today',
|
|
474
|
-
'download': 'Download Now',
|
|
475
|
-
'try free': 'Try Free Today',
|
|
476
|
-
'request demo': 'Book Demo Now',
|
|
477
|
-
'buy now': 'Buy Now - Limited Offer',
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
const lower = cta.toLowerCase().trim();
|
|
481
|
-
return urgentMap[lower] ?? `${cta} Now`;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
function transformCTAToSocial(cta: string): string {
|
|
485
|
-
const socialMap: Record<string, string> = {
|
|
486
|
-
'learn more': 'See Why Teams Love Us',
|
|
487
|
-
'get started': 'Join 10,000+ Users',
|
|
488
|
-
'contact us': 'Talk to Our Team',
|
|
489
|
-
'sign up': 'Join the Community',
|
|
490
|
-
'subscribe': 'Join 50,000+ Subscribers',
|
|
491
|
-
'download': 'Get the Popular Guide',
|
|
492
|
-
'try free': 'See What Others Discovered',
|
|
493
|
-
'request demo': 'See the Award-Winner',
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
const lower = cta.toLowerCase().trim();
|
|
497
|
-
return socialMap[lower] ?? cta;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// ============================================
|
|
501
|
-
// Formatting
|
|
502
|
-
// ============================================
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Format variants for easy comparison
|
|
506
|
-
*/
|
|
507
|
-
export function formatVariantComparison(variantSet: VariantSet): string {
|
|
508
|
-
const lines: string[] = [
|
|
509
|
-
`## Copy Variants for: ${variantSet.pageSlug}${variantSet.sectionId ? ` (${variantSet.sectionId})` : ''}`,
|
|
510
|
-
'',
|
|
511
|
-
'### Original',
|
|
512
|
-
`> ${variantSet.original}`,
|
|
513
|
-
'',
|
|
514
|
-
'### Variants',
|
|
515
|
-
];
|
|
516
|
-
|
|
517
|
-
for (const variant of variantSet.variants) {
|
|
518
|
-
lines.push('');
|
|
519
|
-
lines.push(`**${formatApproach(variant.approach)}**`);
|
|
520
|
-
lines.push(`> ${variant.text}`);
|
|
521
|
-
lines.push(`_${variant.rationale}_`);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return lines.join('\n');
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function formatApproach(approach: VariantApproach): string {
|
|
528
|
-
const labels: Record<VariantApproach, string> = {
|
|
529
|
-
'emotional': 'Emotional Appeal',
|
|
530
|
-
'logical': 'Logical/Data-Driven',
|
|
531
|
-
'urgent': 'Urgency',
|
|
532
|
-
'social-proof': 'Social Proof',
|
|
533
|
-
'benefit-focused': 'Benefit-Focused',
|
|
534
|
-
};
|
|
535
|
-
return labels[approach];
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
/**
|
|
539
|
-
* Format multiple variant sets as markdown
|
|
540
|
-
*/
|
|
541
|
-
export function formatAllVariantsMarkdown(variantSets: VariantSet[]): string {
|
|
542
|
-
const sections = variantSets.map(vs => formatVariantComparison(vs));
|
|
543
|
-
return ['# A/B Copy Variants\n', ...sections].join('\n---\n');
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Format variants as a comparison table
|
|
548
|
-
*/
|
|
549
|
-
export function formatVariantTable(variantSet: VariantSet): string {
|
|
550
|
-
const lines: string[] = [
|
|
551
|
-
'| Approach | Copy | Rationale |',
|
|
552
|
-
'|----------|------|-----------|',
|
|
553
|
-
`| Original | ${variantSet.original} | Current version |`,
|
|
554
|
-
];
|
|
555
|
-
|
|
556
|
-
for (const variant of variantSet.variants) {
|
|
557
|
-
const approach = formatApproach(variant.approach);
|
|
558
|
-
lines.push(`| ${approach} | ${variant.text} | ${variant.rationale} |`);
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return lines.join('\n');
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// ============================================
|
|
565
|
-
// Batch Processing
|
|
566
|
-
// ============================================
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* Generate variants for multiple texts
|
|
570
|
-
*/
|
|
571
|
-
export function generateVariantsForTexts(
|
|
572
|
-
texts: Array<{ text: string; context: VariantContext }>
|
|
573
|
-
): VariantSet[] {
|
|
574
|
-
return texts.map(({ text, context }) => generateVariants(text, context));
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Get all unique variant texts from a set
|
|
579
|
-
*/
|
|
580
|
-
export function getAllVariantTexts(variantSet: VariantSet): string[] {
|
|
581
|
-
return [variantSet.original, ...variantSet.variants.map(v => v.text)];
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Filter variants by approach
|
|
586
|
-
*/
|
|
587
|
-
export function filterVariantsByApproach(
|
|
588
|
-
variantSets: VariantSet[],
|
|
589
|
-
approaches: VariantApproach[]
|
|
590
|
-
): VariantSet[] {
|
|
591
|
-
return variantSets.map(vs => ({
|
|
592
|
-
...vs,
|
|
593
|
-
variants: vs.variants.filter(v => approaches.includes(v.approach)),
|
|
594
|
-
}));
|
|
595
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hq/content-shared",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Shared utilities for content analysis workers",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"bin": {
|
|
9
|
-
"content-analyze": "./dist/cli.js"
|
|
10
|
-
},
|
|
11
|
-
"exports": {
|
|
12
|
-
".": "./dist/index.js",
|
|
13
|
-
"./parser": "./dist/lib/parser.js",
|
|
14
|
-
"./scorer": "./dist/lib/scorer.js",
|
|
15
|
-
"./reporter": "./dist/lib/reporter.js",
|
|
16
|
-
"./types": "./dist/lib/types.js",
|
|
17
|
-
"./brand-analyzer": "./dist/lib/brand-analyzer.js",
|
|
18
|
-
"./conversion-analyzer": "./dist/lib/conversion-analyzer.js",
|
|
19
|
-
"./accuracy-analyzer": "./dist/lib/accuracy-analyzer.js",
|
|
20
|
-
"./compliance-analyzer": "./dist/lib/compliance-analyzer.js",
|
|
21
|
-
"./analyze": "./dist/lib/analyze.js",
|
|
22
|
-
"./recommendations": "./dist/lib/recommendations.js",
|
|
23
|
-
"./priority": "./dist/lib/priority.js",
|
|
24
|
-
"./variants": "./dist/lib/variants.js",
|
|
25
|
-
"./restructure": "./dist/lib/restructure.js",
|
|
26
|
-
"./github-integration": "./dist/lib/github-integration.js",
|
|
27
|
-
"./cms-integration": "./dist/lib/cms-integration.js",
|
|
28
|
-
"./output": "./dist/lib/output.js",
|
|
29
|
-
"./cli": "./dist/cli.js"
|
|
30
|
-
},
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build": "tsc",
|
|
33
|
-
"typecheck": "tsc --noEmit"
|
|
34
|
-
},
|
|
35
|
-
"keywords": [
|
|
36
|
-
"content",
|
|
37
|
-
"analysis",
|
|
38
|
-
"worker",
|
|
39
|
-
"shared",
|
|
40
|
-
"typescript"
|
|
41
|
-
],
|
|
42
|
-
"author": "Your Name",
|
|
43
|
-
"license": "MIT",
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/node": "^22.10.0",
|
|
46
|
-
"typescript": "^5.7.0"
|
|
47
|
-
},
|
|
48
|
-
"engines": {
|
|
49
|
-
"node": ">=20.0.0"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
lockfileVersion: '9.0'
|
|
2
|
-
|
|
3
|
-
settings:
|
|
4
|
-
autoInstallPeers: true
|
|
5
|
-
excludeLinksFromLockfile: false
|
|
6
|
-
|
|
7
|
-
importers:
|
|
8
|
-
|
|
9
|
-
.:
|
|
10
|
-
devDependencies:
|
|
11
|
-
'@types/node':
|
|
12
|
-
specifier: ^22.10.0
|
|
13
|
-
version: 22.19.7
|
|
14
|
-
typescript:
|
|
15
|
-
specifier: ^5.7.0
|
|
16
|
-
version: 5.9.3
|
|
17
|
-
|
|
18
|
-
packages:
|
|
19
|
-
|
|
20
|
-
'@types/node@22.19.7':
|
|
21
|
-
resolution: {integrity: sha512-MciR4AKGHWl7xwxkBa6xUGxQJ4VBOmPTF7sL+iGzuahOFaO0jHCsuEfS80pan1ef4gWId1oWOweIhrDEYLuaOw==}
|
|
22
|
-
|
|
23
|
-
typescript@5.9.3:
|
|
24
|
-
resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
|
|
25
|
-
engines: {node: '>=14.17'}
|
|
26
|
-
hasBin: true
|
|
27
|
-
|
|
28
|
-
undici-types@6.21.0:
|
|
29
|
-
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
|
30
|
-
|
|
31
|
-
snapshots:
|
|
32
|
-
|
|
33
|
-
'@types/node@22.19.7':
|
|
34
|
-
dependencies:
|
|
35
|
-
undici-types: 6.21.0
|
|
36
|
-
|
|
37
|
-
typescript@5.9.3: {}
|
|
38
|
-
|
|
39
|
-
undici-types@6.21.0: {}
|