@lssm/lib.content-gen 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217073102
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/generators/blog.js +68 -1
- package/dist/generators/email.js +96 -9
- package/dist/generators/index.js +6 -1
- package/dist/generators/landing-page.js +76 -2
- package/dist/generators/social.js +73 -1
- package/dist/index.js +7 -1
- package/dist/seo/index.js +3 -1
- package/dist/seo/optimizer.js +48 -1
- package/package.json +4 -4
package/dist/generators/blog.js
CHANGED
|
@@ -1 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/generators/blog.ts
|
|
2
|
+
var BlogGenerator = class {
|
|
3
|
+
llm;
|
|
4
|
+
model;
|
|
5
|
+
temperature;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.llm = options?.llm;
|
|
8
|
+
this.model = options?.model;
|
|
9
|
+
this.temperature = options?.temperature ?? .4;
|
|
10
|
+
}
|
|
11
|
+
async generate(brief) {
|
|
12
|
+
if (this.llm) return this.generateWithLlm(brief);
|
|
13
|
+
return this.generateDeterministic(brief);
|
|
14
|
+
}
|
|
15
|
+
async generateWithLlm(brief) {
|
|
16
|
+
const jsonPart = (await this.llm.chat([{
|
|
17
|
+
role: "system",
|
|
18
|
+
content: [{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: "You are a product marketing writer. Produce JSON with title, subtitle, intro, sections[].heading/body/bullets, outro."
|
|
21
|
+
}]
|
|
22
|
+
}, {
|
|
23
|
+
role: "user",
|
|
24
|
+
content: [{
|
|
25
|
+
type: "text",
|
|
26
|
+
text: JSON.stringify({ brief })
|
|
27
|
+
}]
|
|
28
|
+
}], {
|
|
29
|
+
responseFormat: "json",
|
|
30
|
+
model: this.model,
|
|
31
|
+
temperature: this.temperature
|
|
32
|
+
})).message.content.find((part) => "text" in part);
|
|
33
|
+
if (jsonPart && "text" in jsonPart) return JSON.parse(jsonPart.text);
|
|
34
|
+
return this.generateDeterministic(brief);
|
|
35
|
+
}
|
|
36
|
+
generateDeterministic(brief) {
|
|
37
|
+
const intro = `Operators like ${brief.audience.role} teams face ${brief.problems.slice(0, 2).join(" and ")}. ${brief.title} changes that by ${brief.summary}.`;
|
|
38
|
+
const sections = [
|
|
39
|
+
{
|
|
40
|
+
heading: "Why now",
|
|
41
|
+
body: this.renderWhyNow(brief)
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
heading: "What you get",
|
|
45
|
+
body: "A focused stack built for policy-safe automation.",
|
|
46
|
+
bullets: brief.solutions
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
heading: "Proof it works",
|
|
50
|
+
body: "Teams using the blueprint report measurable wins.",
|
|
51
|
+
bullets: brief.metrics ?? ["Launch workflows in minutes", "Cut review time by 60%"]
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
return {
|
|
55
|
+
title: brief.title,
|
|
56
|
+
subtitle: brief.summary,
|
|
57
|
+
intro,
|
|
58
|
+
sections,
|
|
59
|
+
outro: brief.callToAction ?? "Ready to see it live? Spin up a sandbox in under 5 minutes."
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
renderWhyNow(brief) {
|
|
63
|
+
return `${`${brief.audience.role}${brief.audience.industry ? ` in ${brief.audience.industry}` : ""}`} teams are stuck with ${brief.problems.slice(0, 2).join("; ")}. ${brief.title} delivers guardrails without slowing shipping.`;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { BlogGenerator };
|
package/dist/generators/email.js
CHANGED
|
@@ -1,13 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/generators/email.ts
|
|
2
|
+
var EmailCampaignGenerator = class {
|
|
3
|
+
llm;
|
|
4
|
+
model;
|
|
5
|
+
temperature;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.llm = options?.llm;
|
|
8
|
+
this.model = options?.model;
|
|
9
|
+
this.temperature = options?.temperature ?? .6;
|
|
10
|
+
}
|
|
11
|
+
async generate(input) {
|
|
12
|
+
if (this.llm) {
|
|
13
|
+
const draft = await this.generateWithLlm(input);
|
|
14
|
+
if (draft) return draft;
|
|
15
|
+
}
|
|
16
|
+
return this.generateFallback(input);
|
|
17
|
+
}
|
|
18
|
+
async generateWithLlm(input) {
|
|
19
|
+
const jsonPart = (await this.llm.chat([{
|
|
20
|
+
role: "system",
|
|
21
|
+
content: [{
|
|
22
|
+
type: "text",
|
|
23
|
+
text: "Draft product marketing email as JSON {subject, previewText, body, cta}."
|
|
24
|
+
}]
|
|
25
|
+
}, {
|
|
26
|
+
role: "user",
|
|
27
|
+
content: [{
|
|
28
|
+
type: "text",
|
|
29
|
+
text: JSON.stringify(input)
|
|
30
|
+
}]
|
|
31
|
+
}], {
|
|
32
|
+
responseFormat: "json",
|
|
33
|
+
model: this.model,
|
|
34
|
+
temperature: this.temperature
|
|
35
|
+
})).message.content.find((chunk) => "text" in chunk);
|
|
36
|
+
if (!jsonPart || !("text" in jsonPart)) return null;
|
|
37
|
+
const parsed = JSON.parse(jsonPart.text);
|
|
38
|
+
if (!parsed.subject || !parsed.body || !parsed.cta) return null;
|
|
39
|
+
return {
|
|
40
|
+
subject: parsed.subject,
|
|
41
|
+
previewText: parsed.previewText ?? this.defaultPreview(input),
|
|
42
|
+
body: parsed.body,
|
|
43
|
+
cta: parsed.cta,
|
|
44
|
+
variant: input.variant
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
generateFallback(input) {
|
|
48
|
+
const { brief, variant } = input;
|
|
49
|
+
return {
|
|
50
|
+
subject: this.subjects(brief.title, variant)[0] ?? `${brief.title} update`,
|
|
51
|
+
previewText: this.defaultPreview(input),
|
|
52
|
+
body: this.renderBody(input),
|
|
53
|
+
cta: brief.callToAction ?? "Explore the sandbox",
|
|
54
|
+
variant
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
subjects(title, variant) {
|
|
58
|
+
switch (variant) {
|
|
59
|
+
case "announcement": return [
|
|
60
|
+
`Launch: ${title}`,
|
|
61
|
+
`${title} is live`,
|
|
62
|
+
`New: ${title}`
|
|
63
|
+
];
|
|
64
|
+
case "onboarding": return [`Get started with ${title}`, `Your ${title} guide`];
|
|
65
|
+
case "nurture":
|
|
66
|
+
default: return [`How ${title} speeds ops`, `Proof ${title} works`];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
defaultPreview(input) {
|
|
70
|
+
return `See how teams ${input.brief.metrics?.[0] ?? "ship faster without policy gaps"}.`;
|
|
71
|
+
}
|
|
72
|
+
renderBody(input) {
|
|
73
|
+
const { brief, variant } = input;
|
|
74
|
+
const greeting = "Hi there,";
|
|
75
|
+
const hook = this.variantHook(variant, brief);
|
|
76
|
+
const proof = brief.metrics?.map((metric) => `• ${metric}`).join("\n") ?? "";
|
|
77
|
+
return `${greeting}
|
|
3
78
|
|
|
4
|
-
${
|
|
79
|
+
${hook}
|
|
5
80
|
|
|
6
|
-
Top reasons teams adopt ${
|
|
7
|
-
${
|
|
8
|
-
`)}
|
|
81
|
+
Top reasons teams adopt ${brief.title}:
|
|
82
|
+
${brief.solutions.map((solution) => `• ${solution}`).join("\n")}
|
|
9
83
|
|
|
10
|
-
${
|
|
84
|
+
${proof}
|
|
11
85
|
|
|
12
|
-
${
|
|
13
|
-
|
|
86
|
+
${brief.callToAction ?? "Spin up a sandbox"} → ${(input.cadenceDay ?? 0) + 1}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
variantHook(variant, brief) {
|
|
90
|
+
switch (variant) {
|
|
91
|
+
case "announcement": return `${brief.title} is live. ${brief.summary}`;
|
|
92
|
+
case "onboarding": return `Here is your next step to unlock ${brief.title}.`;
|
|
93
|
+
case "nurture":
|
|
94
|
+
default: return `Operators like ${brief.audience.role} keep asking how to automate policy checks. Here is what works.`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { EmailCampaignGenerator };
|
package/dist/generators/index.js
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BlogGenerator } from "./blog.js";
|
|
2
|
+
import { LandingPageGenerator } from "./landing-page.js";
|
|
3
|
+
import { EmailCampaignGenerator } from "./email.js";
|
|
4
|
+
import { SocialPostGenerator } from "./social.js";
|
|
5
|
+
|
|
6
|
+
export { BlogGenerator, EmailCampaignGenerator, LandingPageGenerator, SocialPostGenerator };
|
|
@@ -1,2 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/generators/landing-page.ts
|
|
2
|
+
var LandingPageGenerator = class {
|
|
3
|
+
llm;
|
|
4
|
+
model;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
this.llm = options?.llm;
|
|
8
|
+
this.model = options?.model;
|
|
9
|
+
}
|
|
10
|
+
async generate(brief) {
|
|
11
|
+
if (this.llm) return this.generateWithLlm(brief);
|
|
12
|
+
return this.generateFallback(brief);
|
|
13
|
+
}
|
|
14
|
+
async generateWithLlm(brief) {
|
|
15
|
+
const part = (await this.llm.chat([{
|
|
16
|
+
role: "system",
|
|
17
|
+
content: [{
|
|
18
|
+
type: "text",
|
|
19
|
+
text: "Write JSON landing page copy with hero/highlights/socialProof/faq arrays."
|
|
20
|
+
}]
|
|
21
|
+
}, {
|
|
22
|
+
role: "user",
|
|
23
|
+
content: [{
|
|
24
|
+
type: "text",
|
|
25
|
+
text: JSON.stringify({ brief })
|
|
26
|
+
}]
|
|
27
|
+
}], {
|
|
28
|
+
responseFormat: "json",
|
|
29
|
+
model: this.model,
|
|
30
|
+
temperature: this.options?.temperature ?? .5
|
|
31
|
+
})).message.content.find((chunk) => "text" in chunk);
|
|
32
|
+
if (part && "text" in part) return JSON.parse(part.text);
|
|
33
|
+
return this.generateFallback(brief);
|
|
34
|
+
}
|
|
35
|
+
generateFallback(brief) {
|
|
36
|
+
return {
|
|
37
|
+
hero: {
|
|
38
|
+
eyebrow: `${brief.audience.industry ?? "Operations"} teams`,
|
|
39
|
+
title: brief.title,
|
|
40
|
+
subtitle: brief.summary,
|
|
41
|
+
primaryCta: brief.callToAction ?? "Launch a sandbox",
|
|
42
|
+
secondaryCta: "View docs"
|
|
43
|
+
},
|
|
44
|
+
highlights: brief.solutions.slice(0, 3).map((solution, index) => ({
|
|
45
|
+
heading: [
|
|
46
|
+
"Policy-safe by default",
|
|
47
|
+
"Auto-adapts per tenant",
|
|
48
|
+
"Launch-ready in days"
|
|
49
|
+
][index] ?? "Key capability",
|
|
50
|
+
body: solution
|
|
51
|
+
})),
|
|
52
|
+
socialProof: {
|
|
53
|
+
heading: "Teams using ContractSpec",
|
|
54
|
+
body: brief.proofPoints?.join("\n") ?? "“We ship compliant workflows 5x faster while cutting ops toil in half.”"
|
|
55
|
+
},
|
|
56
|
+
faq: this.buildFaq(brief)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
buildFaq(brief) {
|
|
60
|
+
const faqs = [{
|
|
61
|
+
heading: "How does this keep policies enforced?",
|
|
62
|
+
body: "All workflows compile from TypeScript specs and pass through PDP checks before execution, so no shadow logic slips through."
|
|
63
|
+
}, {
|
|
64
|
+
heading: "Will it fit our existing stack?",
|
|
65
|
+
body: "Runtime adapters plug into REST, GraphQL, or MCP. Integrations stay vendor agnostic."
|
|
66
|
+
}];
|
|
67
|
+
if (brief.complianceNotes?.length) faqs.push({
|
|
68
|
+
heading: "What about compliance requirements?",
|
|
69
|
+
body: brief.complianceNotes.join(" ")
|
|
70
|
+
});
|
|
71
|
+
return faqs;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { LandingPageGenerator };
|
|
@@ -1 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/generators/social.ts
|
|
2
|
+
var SocialPostGenerator = class {
|
|
3
|
+
llm;
|
|
4
|
+
model;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.llm = options?.llm;
|
|
7
|
+
this.model = options?.model;
|
|
8
|
+
}
|
|
9
|
+
async generate(brief) {
|
|
10
|
+
if (this.llm) {
|
|
11
|
+
const posts = await this.generateWithLlm(brief);
|
|
12
|
+
if (posts.length) return posts;
|
|
13
|
+
}
|
|
14
|
+
return this.generateFallback(brief);
|
|
15
|
+
}
|
|
16
|
+
async generateWithLlm(brief) {
|
|
17
|
+
const part = (await this.llm.chat([{
|
|
18
|
+
role: "system",
|
|
19
|
+
content: [{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: "Create JSON array of social posts for twitter/linkedin/threads with body, hashtags, cta."
|
|
22
|
+
}]
|
|
23
|
+
}, {
|
|
24
|
+
role: "user",
|
|
25
|
+
content: [{
|
|
26
|
+
type: "text",
|
|
27
|
+
text: JSON.stringify(brief)
|
|
28
|
+
}]
|
|
29
|
+
}], {
|
|
30
|
+
responseFormat: "json",
|
|
31
|
+
model: this.model
|
|
32
|
+
})).message.content.find((chunk) => "text" in chunk);
|
|
33
|
+
if (!part || !("text" in part)) return [];
|
|
34
|
+
return JSON.parse(part.text);
|
|
35
|
+
}
|
|
36
|
+
generateFallback(brief) {
|
|
37
|
+
const hashtags = this.buildHashtags(brief);
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
channel: "linkedin",
|
|
41
|
+
body: `${brief.title}: ${brief.summary}\n${brief.problems[0]} → ${brief.solutions[0]}`,
|
|
42
|
+
hashtags,
|
|
43
|
+
cta: brief.callToAction ?? "Book a 15-min run-through"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
channel: "twitter",
|
|
47
|
+
body: `${brief.solutions[0]} in <60s. ${brief.solutions[1] ?? ""}`.trim(),
|
|
48
|
+
hashtags: hashtags.slice(0, 3),
|
|
49
|
+
cta: "→ contractspec.lssm.tech/sandbox"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
channel: "threads",
|
|
53
|
+
body: `Ops + policy can move fast. ${brief.title} automates guardrails so teams ship daily.`,
|
|
54
|
+
hashtags: hashtags.slice(1, 4)
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
buildHashtags(brief) {
|
|
59
|
+
const base = [
|
|
60
|
+
brief.audience.industry ? `#${camel(brief.audience.industry)}` : "#operations",
|
|
61
|
+
"#automation",
|
|
62
|
+
"#aiops",
|
|
63
|
+
"#compliance"
|
|
64
|
+
];
|
|
65
|
+
return [...new Set(base.map((tag) => tag.replace(/\s+/g, "")))].slice(0, 5);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
function camel(text) {
|
|
69
|
+
return text.split(/\s|-/).filter(Boolean).map((word) => word[0]?.toUpperCase() + word.slice(1)).join("");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { SocialPostGenerator };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BlogGenerator } from "./generators/blog.js";
|
|
2
|
+
import { LandingPageGenerator } from "./generators/landing-page.js";
|
|
3
|
+
import { EmailCampaignGenerator } from "./generators/email.js";
|
|
4
|
+
import { SocialPostGenerator } from "./generators/social.js";
|
|
5
|
+
import { SeoOptimizer } from "./seo/optimizer.js";
|
|
6
|
+
|
|
7
|
+
export { BlogGenerator, EmailCampaignGenerator, LandingPageGenerator, SeoOptimizer, SocialPostGenerator };
|
package/dist/seo/index.js
CHANGED
package/dist/seo/optimizer.js
CHANGED
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/seo/optimizer.ts
|
|
2
|
+
var SeoOptimizer = class {
|
|
3
|
+
optimize(brief) {
|
|
4
|
+
const keywords = this.keywords(brief);
|
|
5
|
+
const metaTitle = `${brief.title} | ContractSpec`;
|
|
6
|
+
const metaDescription = `${brief.summary} — built for ${brief.audience.role}${brief.audience.industry ? ` in ${brief.audience.industry}` : ""}.`;
|
|
7
|
+
return {
|
|
8
|
+
metaTitle,
|
|
9
|
+
metaDescription,
|
|
10
|
+
keywords,
|
|
11
|
+
slug: this.slugify(brief.title),
|
|
12
|
+
schemaMarkup: this.schema(brief, metaDescription, keywords)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
keywords(brief) {
|
|
16
|
+
const base = [
|
|
17
|
+
brief.title,
|
|
18
|
+
...brief.problems,
|
|
19
|
+
...brief.solutions
|
|
20
|
+
];
|
|
21
|
+
return [...new Set(base.flatMap((entry) => entry.toLowerCase().split(/\s+/)))].filter((word) => word.length > 3).slice(0, 12);
|
|
22
|
+
}
|
|
23
|
+
slugify(text) {
|
|
24
|
+
return text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
25
|
+
}
|
|
26
|
+
schema(brief, description, keywords) {
|
|
27
|
+
return {
|
|
28
|
+
"@context": "https://schema.org",
|
|
29
|
+
"@type": "Product",
|
|
30
|
+
name: brief.title,
|
|
31
|
+
description,
|
|
32
|
+
audience: {
|
|
33
|
+
"@type": "Audience",
|
|
34
|
+
audienceType: brief.audience.role,
|
|
35
|
+
industry: brief.audience.industry
|
|
36
|
+
},
|
|
37
|
+
offers: {
|
|
38
|
+
"@type": "Offer",
|
|
39
|
+
description: brief.callToAction ?? "Start building with ContractSpec"
|
|
40
|
+
},
|
|
41
|
+
keywords: keywords.join(", "),
|
|
42
|
+
citation: brief.references?.map((ref) => ref.url)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { SeoOptimizer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.content-gen",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251217073102",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"test": "bun run"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lssm/lib.contracts": "0.0.0-canary-
|
|
26
|
+
"@lssm/lib.contracts": "0.0.0-canary-20251217073102"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@lssm/tool.tsdown": "0.0.0-canary-
|
|
30
|
-
"@lssm/tool.typescript": "0.0.0-canary-
|
|
29
|
+
"@lssm/tool.tsdown": "0.0.0-canary-20251217073102",
|
|
30
|
+
"@lssm/tool.typescript": "0.0.0-canary-20251217073102",
|
|
31
31
|
"tsdown": "^0.17.4",
|
|
32
32
|
"typescript": "^5.9.3"
|
|
33
33
|
},
|