@lssm/lib.content-gen 0.0.0-canary-20251217083314 → 0.0.0-canary-20251219202229

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chaman Ventures, SASU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -12,4 +12,5 @@ declare class BlogGenerator {
12
12
  private renderWhyNow;
13
13
  }
14
14
  //#endregion
15
- export { BlogGenerator };
15
+ export { BlogGenerator };
16
+ //# sourceMappingURL=blog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog.d.ts","names":[],"sources":["../../src/generators/blog.ts"],"sourcesContent":[],"mappings":";;;cAOa,aAAA;;EAAA,iBAAa,KAAA;EAKF,iBAAA,WAAA;EAMA,WAAA,CAAA,OAAA,CAAA,EANA,gBAMA;EAAuB,QAAA,CAAA,KAAA,EAAvB,YAAuB,CAAA,EAAR,OAAQ,CAAA,gBAAA,CAAA;EAAR,QAAA,eAAA;EAAO,QAAA,qBAAA"}
@@ -65,4 +65,5 @@ var BlogGenerator = class {
65
65
  };
66
66
 
67
67
  //#endregion
68
- export { BlogGenerator };
68
+ export { BlogGenerator };
69
+ //# sourceMappingURL=blog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog.js","names":[],"sources":["../../src/generators/blog.ts"],"sourcesContent":["import type { LLMProvider } from '@lssm/lib.contracts/integrations/providers/llm';\nimport type {\n ContentBrief,\n GeneratedContent,\n GeneratorOptions,\n} from '../types';\n\nexport class BlogGenerator {\n private readonly llm?: LLMProvider;\n private readonly model?: string;\n private readonly temperature: number;\n\n constructor(options?: GeneratorOptions) {\n this.llm = options?.llm;\n this.model = options?.model;\n this.temperature = options?.temperature ?? 0.4;\n }\n\n async generate(brief: ContentBrief): Promise<GeneratedContent> {\n if (this.llm) {\n return this.generateWithLlm(brief);\n }\n return this.generateDeterministic(brief);\n }\n\n private async generateWithLlm(\n brief: ContentBrief\n ): Promise<GeneratedContent> {\n const response = await this.llm!.chat(\n [\n {\n role: 'system',\n content: [\n {\n type: 'text',\n text: 'You are a product marketing writer. Produce JSON with title, subtitle, intro, sections[].heading/body/bullets, outro.',\n },\n ],\n },\n {\n role: 'user',\n content: [\n {\n type: 'text',\n text: JSON.stringify({ brief }),\n },\n ],\n },\n ],\n {\n responseFormat: 'json',\n model: this.model,\n temperature: this.temperature,\n }\n );\n const jsonPart = response.message.content.find((part) => 'text' in part);\n if (jsonPart && 'text' in jsonPart) {\n return JSON.parse(jsonPart.text) as GeneratedContent;\n }\n return this.generateDeterministic(brief);\n }\n\n private generateDeterministic(brief: ContentBrief): GeneratedContent {\n const intro = `Operators like ${brief.audience.role} teams face ${brief.problems\n .slice(0, 2)\n .join(' and ')}. ${brief.title} changes that by ${brief.summary}.`;\n\n const sections = [\n {\n heading: 'Why now',\n body: this.renderWhyNow(brief),\n },\n {\n heading: 'What you get',\n body: 'A focused stack built for policy-safe automation.',\n bullets: brief.solutions,\n },\n {\n heading: 'Proof it works',\n body: 'Teams using the blueprint report measurable wins.',\n bullets: brief.metrics ?? [\n 'Launch workflows in minutes',\n 'Cut review time by 60%',\n ],\n },\n ];\n\n return {\n title: brief.title,\n subtitle: brief.summary,\n intro,\n sections,\n outro:\n brief.callToAction ??\n 'Ready to see it live? Spin up a sandbox in under 5 minutes.',\n };\n }\n\n private renderWhyNow(brief: ContentBrief): string {\n const audience = `${brief.audience.role}${brief.audience.industry ? ` in ${brief.audience.industry}` : ''}`;\n const pains = brief.problems.slice(0, 2).join('; ');\n return `${audience} teams are stuck with ${pains}. ${brief.title} delivers guardrails without slowing shipping.`;\n }\n}\n"],"mappings":";AAOA,IAAa,gBAAb,MAA2B;CACzB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAA4B;AACtC,OAAK,MAAM,SAAS;AACpB,OAAK,QAAQ,SAAS;AACtB,OAAK,cAAc,SAAS,eAAe;;CAG7C,MAAM,SAAS,OAAgD;AAC7D,MAAI,KAAK,IACP,QAAO,KAAK,gBAAgB,MAAM;AAEpC,SAAO,KAAK,sBAAsB,MAAM;;CAG1C,MAAc,gBACZ,OAC2B;EA4B3B,MAAM,YA3BW,MAAM,KAAK,IAAK,KAC/B,CACE;GACE,MAAM;GACN,SAAS,CACP;IACE,MAAM;IACN,MAAM;IACP,CACF;GACF,EACD;GACE,MAAM;GACN,SAAS,CACP;IACE,MAAM;IACN,MAAM,KAAK,UAAU,EAAE,OAAO,CAAC;IAChC,CACF;GACF,CACF,EACD;GACE,gBAAgB;GAChB,OAAO,KAAK;GACZ,aAAa,KAAK;GACnB,CACF,EACyB,QAAQ,QAAQ,MAAM,SAAS,UAAU,KAAK;AACxE,MAAI,YAAY,UAAU,SACxB,QAAO,KAAK,MAAM,SAAS,KAAK;AAElC,SAAO,KAAK,sBAAsB,MAAM;;CAG1C,AAAQ,sBAAsB,OAAuC;EACnE,MAAM,QAAQ,kBAAkB,MAAM,SAAS,KAAK,cAAc,MAAM,SACrE,MAAM,GAAG,EAAE,CACX,KAAK,QAAQ,CAAC,IAAI,MAAM,MAAM,mBAAmB,MAAM,QAAQ;EAElE,MAAM,WAAW;GACf;IACE,SAAS;IACT,MAAM,KAAK,aAAa,MAAM;IAC/B;GACD;IACE,SAAS;IACT,MAAM;IACN,SAAS,MAAM;IAChB;GACD;IACE,SAAS;IACT,MAAM;IACN,SAAS,MAAM,WAAW,CACxB,+BACA,yBACD;IACF;GACF;AAED,SAAO;GACL,OAAO,MAAM;GACb,UAAU,MAAM;GAChB;GACA;GACA,OACE,MAAM,gBACN;GACH;;CAGH,AAAQ,aAAa,OAA6B;AAGhD,SAAO,GAFU,GAAG,MAAM,SAAS,OAAO,MAAM,SAAS,WAAW,OAAO,MAAM,SAAS,aAAa,KAEpF,wBADL,MAAM,SAAS,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,CACF,IAAI,MAAM,MAAM"}
@@ -15,4 +15,5 @@ declare class EmailCampaignGenerator {
15
15
  private variantHook;
16
16
  }
17
17
  //#endregion
18
- export { EmailCampaignGenerator };
18
+ export { EmailCampaignGenerator };
19
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","names":[],"sources":["../../src/generators/email.ts"],"sourcesContent":[],"mappings":";;;cAOa,sBAAA;;EAAA,iBAAA,KAAA;EAKW,iBAAA,WAAA;EAMA,WAAA,CAAA,OAAA,CAAA,EANA,gBAMA;EAA6B,QAAA,CAAA,KAAA,EAA7B,kBAA6B,CAAA,EAAR,OAAQ,CAAA,UAAA,CAAA;EAAR,QAAA,eAAA;EAAO,QAAA,gBAAA"}
@@ -97,4 +97,5 @@ ${brief.callToAction ?? "Spin up a sandbox"} → ${(input.cadenceDay ?? 0) + 1}
97
97
  };
98
98
 
99
99
  //#endregion
100
- export { EmailCampaignGenerator };
100
+ export { EmailCampaignGenerator };
101
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","names":[],"sources":["../../src/generators/email.ts"],"sourcesContent":["import type {\n EmailCampaignBrief,\n EmailDraft,\n GeneratorOptions,\n} from '../types';\nimport type { LLMProvider } from '@lssm/lib.contracts/integrations/providers/llm';\n\nexport class EmailCampaignGenerator {\n private readonly llm?: LLMProvider;\n private readonly model?: string;\n private readonly temperature: number;\n\n constructor(options?: GeneratorOptions) {\n this.llm = options?.llm;\n this.model = options?.model;\n this.temperature = options?.temperature ?? 0.6;\n }\n\n async generate(input: EmailCampaignBrief): Promise<EmailDraft> {\n if (this.llm) {\n const draft = await this.generateWithLlm(input);\n if (draft) return draft;\n }\n return this.generateFallback(input);\n }\n\n private async generateWithLlm(\n input: EmailCampaignBrief\n ): Promise<EmailDraft | null> {\n const response = await this.llm!.chat(\n [\n {\n role: 'system',\n content: [\n {\n type: 'text',\n text: 'Draft product marketing email as JSON {subject, previewText, body, cta}.',\n },\n ],\n },\n {\n role: 'user',\n content: [{ type: 'text', text: JSON.stringify(input) }],\n },\n ],\n {\n responseFormat: 'json',\n model: this.model,\n temperature: this.temperature,\n }\n );\n const jsonPart = response.message.content.find((chunk) => 'text' in chunk);\n if (!jsonPart || !('text' in jsonPart)) return null;\n const parsed = JSON.parse(jsonPart.text) as Partial<EmailDraft>;\n if (!parsed.subject || !parsed.body || !parsed.cta) return null;\n return {\n subject: parsed.subject,\n previewText: parsed.previewText ?? this.defaultPreview(input),\n body: parsed.body,\n cta: parsed.cta,\n variant: input.variant,\n };\n }\n\n private generateFallback(input: EmailCampaignBrief): EmailDraft {\n const { brief, variant } = input;\n const subject =\n this.subjects(brief.title, variant)[0] ?? `${brief.title} update`;\n const previewText = this.defaultPreview(input);\n const body = this.renderBody(input);\n const cta = brief.callToAction ?? 'Explore the sandbox';\n return { subject, previewText, body, cta, variant };\n }\n\n private subjects(\n title: string,\n variant: EmailCampaignBrief['variant']\n ): string[] {\n switch (variant) {\n case 'announcement':\n return [`Launch: ${title}`, `${title} is live`, `New: ${title}`];\n case 'onboarding':\n return [`Get started with ${title}`, `Your ${title} guide`];\n case 'nurture':\n default:\n return [`How ${title} speeds ops`, `Proof ${title} works`];\n }\n }\n\n private defaultPreview(input: EmailCampaignBrief) {\n const win = input.brief.metrics?.[0] ?? 'ship faster without policy gaps';\n return `See how teams ${win}.`;\n }\n\n private renderBody(input: EmailCampaignBrief): string {\n const { brief, variant } = input;\n const greeting = 'Hi there,';\n const hook = this.variantHook(variant, brief);\n const proof =\n brief.metrics?.map((metric) => `• ${metric}`).join('\\n') ?? '';\n return `${greeting}\n\n${hook}\n\nTop reasons teams adopt ${brief.title}:\n${brief.solutions.map((solution) => `• ${solution}`).join('\\n')}\n\n${proof}\n\n${brief.callToAction ?? 'Spin up a sandbox'} → ${(input.cadenceDay ?? 0) + 1}\n`;\n }\n\n private variantHook(\n variant: EmailCampaignBrief['variant'],\n brief: EmailCampaignBrief['brief']\n ): string {\n switch (variant) {\n case 'announcement':\n return `${brief.title} is live. ${brief.summary}`;\n case 'onboarding':\n return `Here is your next step to unlock ${brief.title}.`;\n case 'nurture':\n default:\n return `Operators like ${brief.audience.role} keep asking how to automate policy checks. Here is what works.`;\n }\n }\n}\n"],"mappings":";AAOA,IAAa,yBAAb,MAAoC;CAClC,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,YAAY,SAA4B;AACtC,OAAK,MAAM,SAAS;AACpB,OAAK,QAAQ,SAAS;AACtB,OAAK,cAAc,SAAS,eAAe;;CAG7C,MAAM,SAAS,OAAgD;AAC7D,MAAI,KAAK,KAAK;GACZ,MAAM,QAAQ,MAAM,KAAK,gBAAgB,MAAM;AAC/C,OAAI,MAAO,QAAO;;AAEpB,SAAO,KAAK,iBAAiB,MAAM;;CAGrC,MAAc,gBACZ,OAC4B;EAuB5B,MAAM,YAtBW,MAAM,KAAK,IAAK,KAC/B,CACE;GACE,MAAM;GACN,SAAS,CACP;IACE,MAAM;IACN,MA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AC7C,MAAM,QACJ,MAAM,SAAS,KAAK,WAAW,KAAK,SAAS,CAAC,KAAK,KAAK,IAAI;AAC9D,SAAO,GAAG,SAAS;;EAErB,KAAK;;0BAEmB,MAAM,MAAM;EACpC,MAAM,UAAU,KAAK,aAAa,KAAK,WAAW,CAAC,KAAK,KAAK,CAAC;;EAE9D,MAAM;;EAEN,MAAM,gBAAgB,oBAAoB,MAAM,MAAM,cAAc,KAAK,EAAE;;;CAI3E,AAAQ,YACN,SACA,OACQ;AACR,UAAQ,SAAR;GACE,KAAK,eACH,QAAO,GAAG,MAAM,MAAM,YAAY,MAAM;GAC1C,KAAK,aACH,QAAO,oCAAoC,MAAM,MAAM;GACzD,KAAK;GACL,QACE,QAAO,kBAAkB,MAAM,SAAS,KAAK"}
@@ -24,4 +24,5 @@ declare class LandingPageGenerator {
24
24
  private buildFaq;
25
25
  }
26
26
  //#endregion
27
- export { LandingPageCopy, LandingPageGenerator };
27
+ export { LandingPageCopy, LandingPageGenerator };
28
+ //# sourceMappingURL=landing-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landing-page.d.ts","names":[],"sources":["../../src/generators/landing-page.ts"],"sourcesContent":[],"mappings":";;;UAGiB,eAAA;;IAAA,OAAA,CAAA,EAAA,MAAe;IAQlB,KAAA,EAAA,MAAA;IACC,QAAA,EAAA,MAAA;IACR,UAAA,EAAA,MAAA;IAAY,YAAA,CAAA,EAAA,MAAA;EAGN,CAAA;EAI4B,UAAA,EAT3B,YAS2B,EAAA;EAKjB,WAAA,EAbT,YAaS;EAAuB,GAAA,EAZxC,YAYwC,EAAA;;AAAD,cATjC,oBAAA,CASiC;;;;wBALL;kBAKjB,eAAe,QAAQ"}
@@ -73,4 +73,5 @@ var LandingPageGenerator = class {
73
73
  };
74
74
 
75
75
  //#endregion
76
- export { LandingPageGenerator };
76
+ export { LandingPageGenerator };
77
+ //# sourceMappingURL=landing-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"landing-page.js","names":["options?: GeneratorOptions","faqs: ContentBlock[]"],"sources":["../../src/generators/landing-page.ts"],"sourcesContent":["import type { ContentBrief, ContentBlock, GeneratorOptions } from '../types';\nimport type { LLMProvider } from '@lssm/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 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,AAAiBA,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;EAuB3E,MAAM,QAtBW,MAAM,KAAK,IAAK,KAC/B,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,MAAMC,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"}
@@ -11,4 +11,5 @@ declare class SocialPostGenerator {
11
11
  private buildHashtags;
12
12
  }
13
13
  //#endregion
14
- export { SocialPostGenerator };
14
+ export { SocialPostGenerator };
15
+ //# sourceMappingURL=social.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.d.ts","names":[],"sources":["../../src/generators/social.ts"],"sourcesContent":[],"mappings":";;;cAGa,mBAAA;;EAAA,iBAAA,KAAmB;EAIR,WAAA,CAAA,OAAA,CAAA,EAAA,gBAAA;EAKA,QAAA,CAAA,KAAA,EAAA,YAAA,CAAA,EAAe,OAAf,CAAuB,UAAvB,EAAA,CAAA;EAAuB,QAAA,eAAA;EAAR,QAAA,gBAAA;EAAO,QAAA,aAAA"}
@@ -70,4 +70,5 @@ function camel(text) {
70
70
  }
71
71
 
72
72
  //#endregion
73
- export { SocialPostGenerator };
73
+ export { SocialPostGenerator };
74
+ //# sourceMappingURL=social.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.js","names":[],"sources":["../../src/generators/social.ts"],"sourcesContent":["import type { ContentBrief, GeneratorOptions, SocialPost } from '../types';\nimport type { LLMProvider } from '@lssm/lib.contracts/integrations/providers/llm';\n\nexport class SocialPostGenerator {\n private readonly llm?: LLMProvider;\n private readonly model?: string;\n\n constructor(options?: GeneratorOptions) {\n this.llm = options?.llm;\n this.model = options?.model;\n }\n\n async generate(brief: ContentBrief): Promise<SocialPost[]> {\n if (this.llm) {\n const posts = await this.generateWithLlm(brief);\n if (posts.length) return posts;\n }\n return this.generateFallback(brief);\n }\n\n private async generateWithLlm(brief: ContentBrief): Promise<SocialPost[]> {\n const response = await this.llm!.chat(\n [\n {\n role: 'system',\n content: [\n {\n type: 'text',\n text: 'Create JSON array of social posts for twitter/linkedin/threads with body, hashtags, cta.',\n },\n ],\n },\n {\n role: 'user',\n content: [{ type: 'text', text: JSON.stringify(brief) }],\n },\n ],\n { responseFormat: 'json', model: this.model }\n );\n const part = response.message.content.find((chunk) => 'text' in chunk);\n if (!part || !('text' in part)) return [];\n return JSON.parse(part.text) as SocialPost[];\n }\n\n private generateFallback(brief: ContentBrief): SocialPost[] {\n const hashtags = this.buildHashtags(brief);\n return [\n {\n channel: 'linkedin',\n body: `${brief.title}: ${brief.summary}\\n${brief.problems[0]} → ${brief.solutions[0]}`,\n hashtags,\n cta: brief.callToAction ?? 'Book a 15-min run-through',\n },\n {\n channel: 'twitter',\n body: `${brief.solutions[0]} in <60s. ${brief.solutions[1] ?? ''}`.trim(),\n hashtags: hashtags.slice(0, 3),\n cta: '→ contractspec.lssm.tech/sandbox',\n },\n {\n channel: 'threads',\n body: `Ops + policy can move fast. ${brief.title} automates guardrails so teams ship daily.`,\n hashtags: hashtags.slice(1, 4),\n },\n ];\n }\n\n private buildHashtags(brief: ContentBrief): string[] {\n const base = [\n brief.audience.industry\n ? `#${camel(brief.audience.industry)}`\n : '#operations',\n '#automation',\n '#aiops',\n '#compliance',\n ];\n return [...new Set(base.map((tag) => tag.replace(/\\s+/g, '')))].slice(0, 5);\n }\n}\n\nfunction camel(text: string) {\n return text\n .split(/\\s|-/)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G,EAAE;IAC/B;GACF;;CAGH,AAAQ,cAAc,OAA+B;EACnD,MAAM,OAAO;GACX,MAAM,SAAS,WACX,IAAI,MAAM,MAAM,SAAS,SAAS,KAClC;GACJ;GACA;GACA;GACD;AACD,SAAO,CAAC,GAAG,IAAI,IAAI,KAAK,KAAK,QAAQ,IAAI,QAAQ,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,EAAE;;;AAI/E,SAAS,MAAM,MAAc;AAC3B,QAAO,KACJ,MAAM,OAAO,CACb,OAAO,QAAQ,CACf,KAAK,SAAS,KAAK,IAAI,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,CACrD,KAAK,GAAG"}
@@ -8,4 +8,5 @@ declare class SeoOptimizer {
8
8
  private schema;
9
9
  }
10
10
  //#endregion
11
- export { SeoOptimizer };
11
+ export { SeoOptimizer };
12
+ //# sourceMappingURL=optimizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimizer.d.ts","names":[],"sources":["../../src/seo/optimizer.ts"],"sourcesContent":[],"mappings":";;;cAEa,YAAA;kBACK,eAAe;EADpB,QAAA,QAAY"}
@@ -45,4 +45,5 @@ var SeoOptimizer = class {
45
45
  };
46
46
 
47
47
  //#endregion
48
- export { SeoOptimizer };
48
+ export { SeoOptimizer };
49
+ //# sourceMappingURL=optimizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"optimizer.js","names":[],"sources":["../../src/seo/optimizer.ts"],"sourcesContent":["import type { ContentBrief, SeoMetadata } from '../types';\n\nexport class SeoOptimizer {\n optimize(brief: ContentBrief): SeoMetadata {\n const keywords = this.keywords(brief);\n const metaTitle = `${brief.title} | ContractSpec`;\n const metaDescription = `${brief.summary} — built for ${brief.audience.role}${brief.audience.industry ? ` in ${brief.audience.industry}` : ''}.`;\n const slug = this.slugify(brief.title);\n const schemaMarkup = this.schema(brief, metaDescription, keywords);\n return { metaTitle, metaDescription, keywords, slug, schemaMarkup };\n }\n\n private keywords(brief: ContentBrief): string[] {\n const base = [brief.title, ...brief.problems, ...brief.solutions];\n return [\n ...new Set(base.flatMap((entry) => entry.toLowerCase().split(/\\s+/))),\n ]\n .filter((word) => word.length > 3)\n .slice(0, 12);\n }\n\n private slugify(text: string): string {\n return text\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n }\n\n private schema(\n brief: ContentBrief,\n description: string,\n keywords: string[]\n ): Record<string, unknown> {\n return {\n '@context': 'https://schema.org',\n '@type': 'Product',\n name: brief.title,\n description,\n audience: {\n '@type': 'Audience',\n audienceType: brief.audience.role,\n industry: brief.audience.industry,\n },\n offers: {\n '@type': 'Offer',\n description: brief.callToAction ?? 'Start building with ContractSpec',\n },\n keywords: keywords.join(', '),\n citation: brief.references?.map((ref) => ref.url),\n };\n }\n}\n"],"mappings":";AAEA,IAAa,eAAb,MAA0B;CACxB,SAAS,OAAkC;EACzC,MAAM,WAAW,KAAK,SAAS,MAAM;EACrC,MAAM,YAAY,GAAG,MAAM,MAAM;EACjC,MAAM,kBAAkB,GAAG,MAAM,QAAQ,eAAe,MAAM,SAAS,OAAO,MAAM,SAAS,WAAW,OAAO,MAAM,SAAS,aAAa,GAAG;AAG9I,SAAO;GAAE;GAAW;GAAiB;GAAU,MAFlC,KAAK,QAAQ,MAAM,MAAM;GAEe,cADhC,KAAK,OAAO,OAAO,iBAAiB,SAAS;GACC;;CAGrE,AAAQ,SAAS,OAA+B;EAC9C,MAAM,OAAO;GAAC,MAAM;GAAO,GAAG,MAAM;GAAU,GAAG,MAAM;GAAU;AACjE,SAAO,CACL,GAAG,IAAI,IAAI,KAAK,SAAS,UAAU,MAAM,aAAa,CAAC,MAAM,MAAM,CAAC,CAAC,CACtE,CACE,QAAQ,SAAS,KAAK,SAAS,EAAE,CACjC,MAAM,GAAG,GAAG;;CAGjB,AAAQ,QAAQ,MAAsB;AACpC,SAAO,KACJ,aAAa,CACb,QAAQ,eAAe,IAAI,CAC3B,QAAQ,YAAY,GAAG;;CAG5B,AAAQ,OACN,OACA,aACA,UACyB;AACzB,SAAO;GACL,YAAY;GACZ,SAAS;GACT,MAAM,MAAM;GACZ;GACA,UAAU;IACR,SAAS;IACT,cAAc,MAAM,SAAS;IAC7B,UAAU,MAAM,SAAS;IAC1B;GACD,QAAQ;IACN,SAAS;IACT,aAAa,MAAM,gBAAgB;IACpC;GACD,UAAU,SAAS,KAAK,KAAK;GAC7B,UAAU,MAAM,YAAY,KAAK,QAAQ,IAAI,IAAI;GAClD"}
package/dist/types.d.ts CHANGED
@@ -68,4 +68,5 @@ interface SeoMetadata {
68
68
  schemaMarkup: Record<string, unknown>;
69
69
  }
70
70
  //#endregion
71
- export { AudienceProfile, ContentBlock, ContentBrief, EmailCampaignBrief, EmailDraft, GeneratedContent, GeneratorOptions, SeoMetadata, SocialPost };
71
+ export { AudienceProfile, ContentBlock, ContentBrief, EmailCampaignBrief, EmailDraft, GeneratedContent, GeneratorOptions, SeoMetadata, SocialPost };
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;UAEiB,eAAA;;EAAA,QAAA,CAAA,EAAA,MAAA;EAQA,MAAA,CAAA,EAAA,MAAY;EAaZ,QAAA,CAAA,EAAA,OAAY,GAAA,SAAA,GAAA,YAAA;EAOZ,UAAA,CAAA,EAAA,MAAgB,EAAA;AAQjC;AAMiB,UAlCA,YAAA,CAkCkB;EAMlB,KAAA,EAAA,MAAU;EAQV,OAAA,EAAA,MAAU;EAQV,QAAA,EAAA,MAAW,EAAA;;;;;YAhDhB;;;;;;;UAKK,YAAA;;;;;;UAOA,gBAAA;;;;YAIL;;;UAIK,gBAAA;QACT;;;;UAKS,kBAAA;SACR;;;;UAKQ,UAAA;;;;;WAKN;;UAGM,UAAA;;;;;;;UAQA,WAAA;;;;;gBAKD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.content-gen",
3
- "version": "0.0.0-canary-20251217083314",
3
+ "version": "0.0.0-canary-20251219202229",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -23,12 +23,12 @@
23
23
  "test": "bun run"
24
24
  },
25
25
  "dependencies": {
26
- "@lssm/lib.contracts": "0.0.0-canary-20251217083314"
26
+ "@lssm/lib.contracts": "0.0.0-canary-20251219202229"
27
27
  },
28
28
  "devDependencies": {
29
- "@lssm/tool.tsdown": "0.0.0-canary-20251217083314",
30
- "@lssm/tool.typescript": "0.0.0-canary-20251217083314",
31
- "tsdown": "^0.17.4",
29
+ "@lssm/tool.tsdown": "0.0.0-canary-20251219202229",
30
+ "@lssm/tool.typescript": "0.0.0-canary-20251219202229",
31
+ "tsdown": "^0.18.1",
32
32
  "typescript": "^5.9.3"
33
33
  },
34
34
  "exports": {
@@ -57,5 +57,6 @@
57
57
  "./types": "./dist/types.js",
58
58
  "./*": "./*"
59
59
  }
60
- }
60
+ },
61
+ "license": "MIT"
61
62
  }