@contractspec/lib.content-gen 1.46.2 → 1.47.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landing-page.js","names":[
|
|
1
|
+
{"version":3,"file":"landing-page.js","names":[],"sources":["../../src/generators/landing-page.ts"],"sourcesContent":["import type { ContentBrief, ContentBlock, GeneratorOptions } from '../types';\nimport type { LLMProvider } from '@contractspec/lib.contracts/integrations/providers/llm';\n\nexport interface LandingPageCopy {\n hero: {\n eyebrow?: string;\n title: string;\n subtitle: string;\n primaryCta: string;\n secondaryCta?: string;\n };\n highlights: ContentBlock[];\n socialProof: ContentBlock;\n faq: ContentBlock[];\n}\n\nexport class LandingPageGenerator {\n private readonly llm?: LLMProvider;\n private readonly model?: string;\n\n constructor(private readonly options?: GeneratorOptions) {\n this.llm = options?.llm;\n this.model = options?.model;\n }\n\n async generate(brief: ContentBrief): Promise<LandingPageCopy> {\n if (this.llm) {\n return this.generateWithLlm(brief);\n }\n return this.generateFallback(brief);\n }\n\n private async generateWithLlm(brief: ContentBrief): Promise<LandingPageCopy> {\n if (!this.llm) {\n return this.generateFallback(brief);\n }\n const response = await this.llm.chat(\n [\n {\n role: 'system',\n content: [\n {\n type: 'text',\n text: 'Write JSON landing page copy with hero/highlights/socialProof/faq arrays.',\n },\n ],\n },\n {\n role: 'user',\n content: [{ type: 'text', text: JSON.stringify({ brief }) }],\n },\n ],\n {\n responseFormat: 'json',\n model: this.model,\n temperature: this.options?.temperature ?? 0.5,\n }\n );\n const part = response.message.content.find((chunk) => 'text' in chunk);\n if (part && 'text' in part) {\n return JSON.parse(part.text) as LandingPageCopy;\n }\n return this.generateFallback(brief);\n }\n\n private generateFallback(brief: ContentBrief): LandingPageCopy {\n return {\n hero: {\n eyebrow: `${brief.audience.industry ?? 'Operations'} teams`,\n title: brief.title,\n subtitle: brief.summary,\n primaryCta: brief.callToAction ?? 'Launch a sandbox',\n secondaryCta: 'View docs',\n },\n highlights: brief.solutions.slice(0, 3).map((solution, index) => ({\n heading:\n [\n 'Policy-safe by default',\n 'Auto-adapts per tenant',\n 'Launch-ready in days',\n ][index] ?? 'Key capability',\n body: solution,\n })),\n socialProof: {\n heading: 'Teams using ContractSpec',\n body:\n brief.proofPoints?.join('\\n') ??\n '“We ship compliant workflows 5x faster while cutting ops toil in half.”',\n },\n faq: this.buildFaq(brief),\n };\n }\n\n private buildFaq(brief: ContentBrief): ContentBlock[] {\n const faqs: ContentBlock[] = [\n {\n heading: 'How does this keep policies enforced?',\n body: 'All workflows compile from TypeScript specs and pass through PDP checks before execution, so no shadow logic slips through.',\n },\n {\n heading: 'Will it fit our existing stack?',\n body: 'Runtime adapters plug into REST, GraphQL, or MCP. Integrations stay vendor agnostic.',\n },\n ];\n if (brief.complianceNotes?.length) {\n faqs.push({\n heading: 'What about compliance requirements?',\n body: brief.complianceNotes.join(' '),\n });\n }\n return faqs;\n }\n}\n"],"mappings":";AAgBA,IAAa,uBAAb,MAAkC;CAChC,AAAiB;CACjB,AAAiB;CAEjB,YAAY,AAAiB,SAA4B;EAA5B;AAC3B,OAAK,MAAM,SAAS;AACpB,OAAK,QAAQ,SAAS;;CAGxB,MAAM,SAAS,OAA+C;AAC5D,MAAI,KAAK,IACP,QAAO,KAAK,gBAAgB,MAAM;AAEpC,SAAO,KAAK,iBAAiB,MAAM;;CAGrC,MAAc,gBAAgB,OAA+C;AAC3E,MAAI,CAAC,KAAK,IACR,QAAO,KAAK,iBAAiB,MAAM;EAwBrC,MAAM,QAtBW,MAAM,KAAK,IAAI,KAC9B,CACE;GACE,MAAM;GACN,SAAS,CACP;IACE,MAAM;IACN,MAAM;IACP,CACF;GACF,EACD;GACE,MAAM;GACN,SAAS,CAAC;IAAE,MAAM;IAAQ,MAAM,KAAK,UAAU,EAAE,OAAO,CAAC;IAAE,CAAC;GAC7D,CACF,EACD;GACE,gBAAgB;GAChB,OAAO,KAAK;GACZ,aAAa,KAAK,SAAS,eAAe;GAC3C,CACF,EACqB,QAAQ,QAAQ,MAAM,UAAU,UAAU,MAAM;AACtE,MAAI,QAAQ,UAAU,KACpB,QAAO,KAAK,MAAM,KAAK,KAAK;AAE9B,SAAO,KAAK,iBAAiB,MAAM;;CAGrC,AAAQ,iBAAiB,OAAsC;AAC7D,SAAO;GACL,MAAM;IACJ,SAAS,GAAG,MAAM,SAAS,YAAY,aAAa;IACpD,OAAO,MAAM;IACb,UAAU,MAAM;IAChB,YAAY,MAAM,gBAAgB;IAClC,cAAc;IACf;GACD,YAAY,MAAM,UAAU,MAAM,GAAG,EAAE,CAAC,KAAK,UAAU,WAAW;IAChE,SACE;KACE;KACA;KACA;KACD,CAAC,UAAU;IACd,MAAM;IACP,EAAE;GACH,aAAa;IACX,SAAS;IACT,MACE,MAAM,aAAa,KAAK,KAAK,IAC7B;IACH;GACD,KAAK,KAAK,SAAS,MAAM;GAC1B;;CAGH,AAAQ,SAAS,OAAqC;EACpD,MAAM,OAAuB,CAC3B;GACE,SAAS;GACT,MAAM;GACP,EACD;GACE,SAAS;GACT,MAAM;GACP,CACF;AACD,MAAI,MAAM,iBAAiB,OACzB,MAAK,KAAK;GACR,SAAS;GACT,MAAM,MAAM,gBAAgB,KAAK,IAAI;GACtC,CAAC;AAEJ,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.content-gen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "AI-powered content generation for blog, email, and social",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
"typescript"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
|
-
"main": "./dist/index.js",
|
|
15
|
-
"module": "./dist/index.js",
|
|
16
14
|
"types": "./dist/index.d.ts",
|
|
17
15
|
"files": [
|
|
18
16
|
"dist",
|
|
@@ -29,15 +27,15 @@
|
|
|
29
27
|
"lint": "bun lint:fix",
|
|
30
28
|
"lint:fix": "eslint src --fix",
|
|
31
29
|
"lint:check": "eslint src",
|
|
32
|
-
"test": "bun
|
|
30
|
+
"test": "bun test"
|
|
33
31
|
},
|
|
34
32
|
"dependencies": {
|
|
35
|
-
"@contractspec/lib.contracts": "1.
|
|
33
|
+
"@contractspec/lib.contracts": "1.47.0"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
38
|
-
"@contractspec/tool.tsdown": "1.
|
|
39
|
-
"@contractspec/tool.typescript": "1.
|
|
40
|
-
"tsdown": "^0.
|
|
36
|
+
"@contractspec/tool.tsdown": "1.47.0",
|
|
37
|
+
"@contractspec/tool.typescript": "1.47.0",
|
|
38
|
+
"tsdown": "^0.19.0",
|
|
41
39
|
"typescript": "^5.9.3"
|
|
42
40
|
},
|
|
43
41
|
"exports": {
|