@lssm/lib.content-gen 0.0.0-canary-20251206160926

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/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @lssm/lib.content-gen
2
+
3
+ Composable generators that turn ContractSpec briefs, specs, and telemetry into publish-ready marketing artifacts: blogs, landing pages, SEO metadata, email drips, and social posts.
4
+
5
+ ## Modules
6
+
7
+ - `BlogGenerator` – creates narrative posts from feature briefs and spec metadata.
8
+ - `LandingPageGenerator` – builds hero copy, feature bullets, proof points, and CTAs.
9
+ - `EmailCampaignGenerator` – drafts onboarding, announcement, and nurture emails.
10
+ - `SocialPostGenerator` – outputs multi-channel snippets with hashtags and CTAs.
11
+ - `SeoOptimizer` – extracts keywords, meta tags, slugs, and Schema.org markup.
12
+
13
+ Each generator accepts a `ContentBrief` that captures audience, value props, proof points, and compliance notes. If an `LLMProvider` is supplied, outputs blend AI creativity with deterministic templates; otherwise a deterministic fallback ensures consistent copy.
14
+
15
+ ## Quickstart
16
+
17
+ ```ts
18
+ import {
19
+ BlogGenerator,
20
+ LandingPageGenerator,
21
+ EmailCampaignGenerator,
22
+ SocialPostGenerator,
23
+ } from '@lssm/lib.content-gen/generators';
24
+ import { SeoOptimizer } from '@lssm/lib.content-gen/seo';
25
+
26
+ const brief = {
27
+ title: 'Policy-safe Workflow Automation',
28
+ summary: 'Automatically compiles intents into auditable workflows.',
29
+ problems: ['Manual reviews slow compliance', 'Engineers rebuild flows for every tenant'],
30
+ solutions: ['Spec-first workflows', 'Policy enforcement', 'Multi-tenant guardrails'],
31
+ audience: { role: 'COO', industry: 'Fintech', maturity: 'scaleup' },
32
+ };
33
+
34
+ const blog = await new BlogGenerator().generate(brief);
35
+ const landing = await new LandingPageGenerator().generate(brief);
36
+ const email = await new EmailCampaignGenerator().generate({ brief, variant: 'announcement' });
37
+ const social = await new SocialPostGenerator().generate(brief);
38
+ const seo = new SeoOptimizer().optimize(brief);
39
+ ```
40
+
41
+ Outputs return structured blocks that can be rendered directly in the marketing site or exported to CMS tools.
@@ -0,0 +1,15 @@
1
+ import { ContentBrief, GeneratedContent, GeneratorOptions } from "../types.js";
2
+
3
+ //#region src/generators/blog.d.ts
4
+ declare class BlogGenerator {
5
+ private readonly llm?;
6
+ private readonly model?;
7
+ private readonly temperature;
8
+ constructor(options?: GeneratorOptions);
9
+ generate(brief: ContentBrief): Promise<GeneratedContent>;
10
+ private generateWithLlm;
11
+ private generateDeterministic;
12
+ private renderWhyNow;
13
+ }
14
+ //#endregion
15
+ export { BlogGenerator };
@@ -0,0 +1 @@
1
+ var e=class{llm;model;temperature;constructor(e){this.llm=e?.llm,this.model=e?.model,this.temperature=e?.temperature??.4}async generate(e){return this.llm?this.generateWithLlm(e):this.generateDeterministic(e)}async generateWithLlm(e){let t=(await this.llm.chat([{role:`system`,content:[{type:`text`,text:`You are a product marketing writer. Produce JSON with title, subtitle, intro, sections[].heading/body/bullets, outro.`}]},{role:`user`,content:[{type:`text`,text:JSON.stringify({brief:e})}]}],{responseFormat:`json`,model:this.model,temperature:this.temperature})).message.content.find(e=>`text`in e);return t&&`text`in t?JSON.parse(t.text):this.generateDeterministic(e)}generateDeterministic(e){let t=`Operators like ${e.audience.role} teams face ${e.problems.slice(0,2).join(` and `)}. ${e.title} changes that by ${e.summary}.`,n=[{heading:`Why now`,body:this.renderWhyNow(e)},{heading:`What you get`,body:`A focused stack built for policy-safe automation.`,bullets:e.solutions},{heading:`Proof it works`,body:`Teams using the blueprint report measurable wins.`,bullets:e.metrics??[`Launch workflows in minutes`,`Cut review time by 60%`]}];return{title:e.title,subtitle:e.summary,intro:t,sections:n,outro:e.callToAction??`Ready to see it live? Spin up a sandbox in under 5 minutes.`}}renderWhyNow(e){return`${`${e.audience.role}${e.audience.industry?` in ${e.audience.industry}`:``}`} teams are stuck with ${e.problems.slice(0,2).join(`; `)}. ${e.title} delivers guardrails without slowing shipping.`}};export{e as BlogGenerator};
@@ -0,0 +1,18 @@
1
+ import { EmailCampaignBrief, EmailDraft, GeneratorOptions } from "../types.js";
2
+
3
+ //#region src/generators/email.d.ts
4
+ declare class EmailCampaignGenerator {
5
+ private readonly llm?;
6
+ private readonly model?;
7
+ private readonly temperature;
8
+ constructor(options?: GeneratorOptions);
9
+ generate(input: EmailCampaignBrief): Promise<EmailDraft>;
10
+ private generateWithLlm;
11
+ private generateFallback;
12
+ private subjects;
13
+ private defaultPreview;
14
+ private renderBody;
15
+ private variantHook;
16
+ }
17
+ //#endregion
18
+ export { EmailCampaignGenerator };
@@ -0,0 +1,13 @@
1
+ var e=class{llm;model;temperature;constructor(e){this.llm=e?.llm,this.model=e?.model,this.temperature=e?.temperature??.6}async generate(e){if(this.llm){let t=await this.generateWithLlm(e);if(t)return t}return this.generateFallback(e)}async generateWithLlm(e){let t=(await this.llm.chat([{role:`system`,content:[{type:`text`,text:`Draft product marketing email as JSON {subject, previewText, body, cta}.`}]},{role:`user`,content:[{type:`text`,text:JSON.stringify(e)}]}],{responseFormat:`json`,model:this.model,temperature:this.temperature})).message.content.find(e=>`text`in e);if(!t||!(`text`in t))return null;let n=JSON.parse(t.text);return!n.subject||!n.body||!n.cta?null:{subject:n.subject,previewText:n.previewText??this.defaultPreview(e),body:n.body,cta:n.cta,variant:e.variant}}generateFallback(e){let{brief:t,variant:n}=e;return{subject:this.subjects(t.title,n)[0]??`${t.title} update`,previewText:this.defaultPreview(e),body:this.renderBody(e),cta:t.callToAction??`Explore the sandbox`,variant:n}}subjects(e,t){switch(t){case`announcement`:return[`Launch: ${e}`,`${e} is live`,`New: ${e}`];case`onboarding`:return[`Get started with ${e}`,`Your ${e} guide`];case`nurture`:default:return[`How ${e} speeds ops`,`Proof ${e} works`]}}defaultPreview(e){return`See how teams ${e.brief.metrics?.[0]??`ship faster without policy gaps`}.`}renderBody(e){let{brief:t,variant:n}=e,r=this.variantHook(n,t),i=t.metrics?.map(e=>`• ${e}`).join(`
2
+ `)??``;return`Hi there,
3
+
4
+ ${r}
5
+
6
+ Top reasons teams adopt ${t.title}:
7
+ ${t.solutions.map(e=>`• ${e}`).join(`
8
+ `)}
9
+
10
+ ${i}
11
+
12
+ ${t.callToAction??`Spin up a sandbox`} → ${(e.cadenceDay??0)+1}
13
+ `}variantHook(e,t){switch(e){case`announcement`:return`${t.title} is live. ${t.summary}`;case`onboarding`:return`Here is your next step to unlock ${t.title}.`;case`nurture`:default:return`Operators like ${t.audience.role} keep asking how to automate policy checks. Here is what works.`}}};export{e as EmailCampaignGenerator};
@@ -0,0 +1,5 @@
1
+ import { BlogGenerator } from "./blog.js";
2
+ import { EmailCampaignGenerator } from "./email.js";
3
+ import { LandingPageCopy, LandingPageGenerator } from "./landing-page.js";
4
+ import { SocialPostGenerator } from "./social.js";
5
+ export { BlogGenerator, EmailCampaignGenerator, LandingPageCopy, LandingPageGenerator, SocialPostGenerator };
@@ -0,0 +1 @@
1
+ import{BlogGenerator as e}from"./blog.js";import{LandingPageGenerator as t}from"./landing-page.js";import{EmailCampaignGenerator as n}from"./email.js";import{SocialPostGenerator as r}from"./social.js";export{e as BlogGenerator,n as EmailCampaignGenerator,t as LandingPageGenerator,r as SocialPostGenerator};
@@ -0,0 +1,27 @@
1
+ import { ContentBlock, ContentBrief, GeneratorOptions } from "../types.js";
2
+
3
+ //#region src/generators/landing-page.d.ts
4
+ interface LandingPageCopy {
5
+ hero: {
6
+ eyebrow?: string;
7
+ title: string;
8
+ subtitle: string;
9
+ primaryCta: string;
10
+ secondaryCta?: string;
11
+ };
12
+ highlights: ContentBlock[];
13
+ socialProof: ContentBlock;
14
+ faq: ContentBlock[];
15
+ }
16
+ declare class LandingPageGenerator {
17
+ private readonly options?;
18
+ private readonly llm?;
19
+ private readonly model?;
20
+ constructor(options?: GeneratorOptions | undefined);
21
+ generate(brief: ContentBrief): Promise<LandingPageCopy>;
22
+ private generateWithLlm;
23
+ private generateFallback;
24
+ private buildFaq;
25
+ }
26
+ //#endregion
27
+ export { LandingPageCopy, LandingPageGenerator };
@@ -0,0 +1,2 @@
1
+ var e=class{llm;model;constructor(e){this.options=e,this.llm=e?.llm,this.model=e?.model}async generate(e){return this.llm?this.generateWithLlm(e):this.generateFallback(e)}async generateWithLlm(e){let t=(await this.llm.chat([{role:`system`,content:[{type:`text`,text:`Write JSON landing page copy with hero/highlights/socialProof/faq arrays.`}]},{role:`user`,content:[{type:`text`,text:JSON.stringify({brief:e})}]}],{responseFormat:`json`,model:this.model,temperature:this.options?.temperature??.5})).message.content.find(e=>`text`in e);return t&&`text`in t?JSON.parse(t.text):this.generateFallback(e)}generateFallback(e){return{hero:{eyebrow:`${e.audience.industry??`Operations`} teams`,title:e.title,subtitle:e.summary,primaryCta:e.callToAction??`Launch a sandbox`,secondaryCta:`View docs`},highlights:e.solutions.slice(0,3).map((e,t)=>({heading:[`Policy-safe by default`,`Auto-adapts per tenant`,`Launch-ready in days`][t]??`Key capability`,body:e})),socialProof:{heading:`Teams using ContractSpec`,body:e.proofPoints?.join(`
2
+ `)??`“We ship compliant workflows 5x faster while cutting ops toil in half.”`},faq:this.buildFaq(e)}}buildFaq(e){let t=[{heading:`How does this keep policies enforced?`,body:`All workflows compile from TypeScript specs and pass through PDP checks before execution, so no shadow logic slips through.`},{heading:`Will it fit our existing stack?`,body:`Runtime adapters plug into REST, GraphQL, or MCP. Integrations stay vendor agnostic.`}];return e.complianceNotes?.length&&t.push({heading:`What about compliance requirements?`,body:e.complianceNotes.join(` `)}),t}};export{e as LandingPageGenerator};
@@ -0,0 +1,14 @@
1
+ import { ContentBrief, GeneratorOptions, SocialPost } from "../types.js";
2
+
3
+ //#region src/generators/social.d.ts
4
+ declare class SocialPostGenerator {
5
+ private readonly llm?;
6
+ private readonly model?;
7
+ constructor(options?: GeneratorOptions);
8
+ generate(brief: ContentBrief): Promise<SocialPost[]>;
9
+ private generateWithLlm;
10
+ private generateFallback;
11
+ private buildHashtags;
12
+ }
13
+ //#endregion
14
+ export { SocialPostGenerator };
@@ -0,0 +1 @@
1
+ var e=class{llm;model;constructor(e){this.llm=e?.llm,this.model=e?.model}async generate(e){if(this.llm){let t=await this.generateWithLlm(e);if(t.length)return t}return this.generateFallback(e)}async generateWithLlm(e){let t=(await this.llm.chat([{role:`system`,content:[{type:`text`,text:`Create JSON array of social posts for twitter/linkedin/threads with body, hashtags, cta.`}]},{role:`user`,content:[{type:`text`,text:JSON.stringify(e)}]}],{responseFormat:`json`,model:this.model})).message.content.find(e=>`text`in e);return!t||!(`text`in t)?[]:JSON.parse(t.text)}generateFallback(e){let t=this.buildHashtags(e);return[{channel:`linkedin`,body:`${e.title}: ${e.summary}\n${e.problems[0]} → ${e.solutions[0]}`,hashtags:t,cta:e.callToAction??`Book a 15-min run-through`},{channel:`twitter`,body:`${e.solutions[0]} in <60s. ${e.solutions[1]??``}`.trim(),hashtags:t.slice(0,3),cta:`→ contractspec.chaman.ventures/sandbox`},{channel:`threads`,body:`Ops + policy can move fast. ${e.title} automates guardrails so teams ship daily.`,hashtags:t.slice(1,4)}]}buildHashtags(e){let n=[e.audience.industry?`#${t(e.audience.industry)}`:`#operations`,`#automation`,`#aiops`,`#compliance`];return[...new Set(n.map(e=>e.replace(/\s+/g,``)))].slice(0,5)}};function t(e){return e.split(/\s|-/).filter(Boolean).map(e=>e[0]?.toUpperCase()+e.slice(1)).join(``)}export{e as SocialPostGenerator};
@@ -0,0 +1,7 @@
1
+ import { AudienceProfile, ContentBlock, ContentBrief, EmailCampaignBrief, EmailDraft, GeneratedContent, GeneratorOptions, SeoMetadata, SocialPost } from "./types.js";
2
+ import { BlogGenerator } from "./generators/blog.js";
3
+ import { EmailCampaignGenerator } from "./generators/email.js";
4
+ import { LandingPageCopy, LandingPageGenerator } from "./generators/landing-page.js";
5
+ import { SocialPostGenerator } from "./generators/social.js";
6
+ import { SeoOptimizer } from "./seo/optimizer.js";
7
+ export { AudienceProfile, BlogGenerator, ContentBlock, ContentBrief, EmailCampaignBrief, EmailCampaignGenerator, EmailDraft, GeneratedContent, GeneratorOptions, LandingPageCopy, LandingPageGenerator, SeoMetadata, SeoOptimizer, SocialPost, SocialPostGenerator };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{BlogGenerator as e}from"./generators/blog.js";import{LandingPageGenerator as t}from"./generators/landing-page.js";import{EmailCampaignGenerator as n}from"./generators/email.js";import{SocialPostGenerator as r}from"./generators/social.js";import{SeoOptimizer as i}from"./seo/optimizer.js";export{e as BlogGenerator,n as EmailCampaignGenerator,t as LandingPageGenerator,i as SeoOptimizer,r as SocialPostGenerator};
@@ -0,0 +1,2 @@
1
+ import { SeoOptimizer } from "./optimizer.js";
2
+ export { SeoOptimizer };
@@ -0,0 +1 @@
1
+ import{SeoOptimizer as e}from"./optimizer.js";export{e as SeoOptimizer};
@@ -0,0 +1,11 @@
1
+ import { ContentBrief, SeoMetadata } from "../types.js";
2
+
3
+ //#region src/seo/optimizer.d.ts
4
+ declare class SeoOptimizer {
5
+ optimize(brief: ContentBrief): SeoMetadata;
6
+ private keywords;
7
+ private slugify;
8
+ private schema;
9
+ }
10
+ //#endregion
11
+ export { SeoOptimizer };
@@ -0,0 +1 @@
1
+ var e=class{optimize(e){let t=this.keywords(e),n=`${e.title} | ContractSpec`,r=`${e.summary} — built for ${e.audience.role}${e.audience.industry?` in ${e.audience.industry}`:``}.`;return{metaTitle:n,metaDescription:r,keywords:t,slug:this.slugify(e.title),schemaMarkup:this.schema(e,r,t)}}keywords(e){let t=[e.title,...e.problems,...e.solutions];return[...new Set(t.flatMap(e=>e.toLowerCase().split(/\s+/)))].filter(e=>e.length>3).slice(0,12)}slugify(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}schema(e,t,n){return{"@context":`https://schema.org`,"@type":`Product`,name:e.title,description:t,audience:{"@type":`Audience`,audienceType:e.audience.role,industry:e.audience.industry},offers:{"@type":`Offer`,description:e.callToAction??`Start building with ContractSpec`},keywords:n.join(`, `),citation:e.references?.map(e=>e.url)}}};export{e as SeoOptimizer};
@@ -0,0 +1,71 @@
1
+ import { LLMProvider } from "@lssm/lib.contracts/integrations/providers/llm";
2
+
3
+ //#region src/types.d.ts
4
+ interface AudienceProfile {
5
+ role: string;
6
+ industry?: string;
7
+ region?: string;
8
+ maturity?: 'early' | 'scaleup' | 'enterprise';
9
+ painPoints?: string[];
10
+ }
11
+ interface ContentBrief {
12
+ title: string;
13
+ summary: string;
14
+ problems: string[];
15
+ solutions: string[];
16
+ metrics?: string[];
17
+ proofPoints?: string[];
18
+ complianceNotes?: string[];
19
+ audience: AudienceProfile;
20
+ callToAction?: string;
21
+ references?: {
22
+ label: string;
23
+ url: string;
24
+ }[];
25
+ }
26
+ interface ContentBlock {
27
+ heading: string;
28
+ body: string;
29
+ bullets?: string[];
30
+ cta?: string;
31
+ }
32
+ interface GeneratedContent {
33
+ title: string;
34
+ subtitle?: string;
35
+ intro: string;
36
+ sections: ContentBlock[];
37
+ outro?: string;
38
+ }
39
+ interface GeneratorOptions {
40
+ llm?: LLMProvider;
41
+ model?: string;
42
+ temperature?: number;
43
+ }
44
+ interface EmailCampaignBrief {
45
+ brief: ContentBrief;
46
+ variant: 'announcement' | 'onboarding' | 'nurture';
47
+ cadenceDay?: number;
48
+ }
49
+ interface EmailDraft {
50
+ subject: string;
51
+ previewText: string;
52
+ body: string;
53
+ cta: string;
54
+ variant: EmailCampaignBrief['variant'];
55
+ }
56
+ interface SocialPost {
57
+ channel: 'twitter' | 'linkedin' | 'threads';
58
+ body: string;
59
+ hashtags: string[];
60
+ cta?: string;
61
+ link?: string;
62
+ }
63
+ interface SeoMetadata {
64
+ metaTitle: string;
65
+ metaDescription: string;
66
+ keywords: string[];
67
+ slug: string;
68
+ schemaMarkup: Record<string, unknown>;
69
+ }
70
+ //#endregion
71
+ export { AudienceProfile, ContentBlock, ContentBrief, EmailCampaignBrief, EmailDraft, GeneratedContent, GeneratorOptions, SeoMetadata, SocialPost };
package/dist/types.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@lssm/lib.content-gen",
3
+ "version": "0.0.0-canary-20251206160926",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "scripts": {
13
+ "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
14
+ "build": "bun build:bundle && bun build:types",
15
+ "build:bundle": "tsdown",
16
+ "build:types": "tsc --noEmit",
17
+ "dev": "bun build:bundle --watch",
18
+ "clean": "rimraf dist .turbo",
19
+ "lint": "bun lint:fix",
20
+ "lint:fix": "eslint src --fix",
21
+ "lint:check": "eslint src",
22
+ "test": "bun run"
23
+ },
24
+ "dependencies": {
25
+ "@lssm/lib.contracts": "workspace:*"
26
+ },
27
+ "devDependencies": {
28
+ "@lssm/tool.tsdown": "workspace:*",
29
+ "@lssm/tool.typescript": "workspace:*",
30
+ "tsdown": "^0.17.0",
31
+ "typescript": "^5.9.3"
32
+ },
33
+ "exports": {
34
+ ".": "./dist/index.js",
35
+ "./generators": "./dist/generators/index.js",
36
+ "./generators/blog": "./dist/generators/blog.js",
37
+ "./generators/email": "./dist/generators/email.js",
38
+ "./generators/landing-page": "./dist/generators/landing-page.js",
39
+ "./generators/social": "./dist/generators/social.js",
40
+ "./seo": "./dist/seo/index.js",
41
+ "./seo/optimizer": "./dist/seo/optimizer.js",
42
+ "./types": "./dist/types.js",
43
+ "./*": "./*"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }