@contractspec/example.content-generation 3.7.6 → 3.7.7

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.
@@ -3,7 +3,7 @@ $ bun run prebuild && bun run build:bundle && bun run build:types
3
3
  $ contractspec-bun-build prebuild
4
4
  $ contractspec-bun-build transpile
5
5
  [contractspec-bun-build] transpile target=bun root=src entries=6 noBundle=false
6
- Bundled 6 modules in 18ms
6
+ Bundled 6 modules in 35ms
7
7
 
8
8
  ./content-generation.feature.js 0.62 KB (entry point)
9
9
  ./index.js 4.65 KB (entry point)
@@ -13,7 +13,7 @@ Bundled 6 modules in 18ms
13
13
  ./generate.js 1.72 KB (entry point)
14
14
 
15
15
  [contractspec-bun-build] transpile target=node root=src entries=6 noBundle=false
16
- Bundled 6 modules in 22ms
16
+ Bundled 6 modules in 20ms
17
17
 
18
18
  ./content-generation.feature.js 0.61 KB (entry point)
19
19
  ./index.js 4.63 KB (entry point)
@@ -23,7 +23,7 @@ Bundled 6 modules in 22ms
23
23
  ./generate.js 1.71 KB (entry point)
24
24
 
25
25
  [contractspec-bun-build] transpile target=browser root=src entries=6 noBundle=false
26
- Bundled 6 modules in 25ms
26
+ Bundled 6 modules in 49ms
27
27
 
28
28
  ./content-generation.feature.js 0.61 KB (entry point)
29
29
  ./index.js 4.63 KB (entry point)
package/AGENTS.md CHANGED
@@ -1,31 +1,52 @@
1
- # AI Agent Guide -- `@contractspec/example.content-generation`
1
+ # AI Agent Guide `@contractspec/example.content-generation`
2
2
 
3
3
  Scope: `packages/examples/content-generation/*`
4
4
 
5
- Demonstrates AI-powered content generation using the content-gen lib with structured logging.
5
+ Content generation example using @contractspec/lib.content-gen.
6
6
 
7
7
  ## Quick Context
8
8
 
9
- - **Layer**: example
10
- - **Related Packages**: `lib.contracts-spec`, `lib.content-gen`, `lib.logger`
9
+ - Layer: `example`.
10
+ - Package visibility: published package.
11
+ - Primary consumers are example explorers, template authors, and documentation readers.
12
+ - Related packages: `@contractspec/lib.content-gen`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.logger`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
11
13
 
12
- ## What This Demonstrates
14
+ ## Architecture
13
15
 
14
- - Content generation pipeline with typed contracts
15
- - Integration with the content-gen library
16
- - Structured logging for generation steps
17
- - DocBlock documentation for the generation flow
16
+ - `src/content-generation.feature.ts` defines a feature entrypoint.
17
+ - `src/docs/` contains docblocks and documentation-facing exports.
18
+ - `src/example.ts` is the runnable example entrypoint.
19
+ - `src/generate.ts` is part of the package's public or composition surface.
20
+ - `src/index.ts` is the root public barrel and package entrypoint.
18
21
 
19
- ## Public Exports
22
+ ## Public Surface
20
23
 
21
- - `.` -- root barrel
22
- - `./docs` -- DocBlock documentation
23
- - `./example` -- runnable example entry point
24
- - `./generate` -- generation logic
24
+ - Export `.` resolves through `./src/index.ts`.
25
+ - Export `./content-generation.feature` resolves through `./src/content-generation.feature.ts`.
26
+ - Export `./docs` resolves through `./src/docs/index.ts`.
27
+ - Export `./docs/content-generation.docblock` resolves through `./src/docs/content-generation.docblock.ts`.
28
+ - Export `./example` resolves through `./src/example.ts`.
29
+ - Export `./generate` resolves through `./src/generate.ts`.
30
+
31
+ ## Guardrails
32
+
33
+ - Keep the example package demonstrative, buildable, and aligned with the exported feature surface.
34
+ - Do not add hidden production assumptions that are not actually implemented in the example.
35
+ - Changes here can affect downstream packages such as `@contractspec/lib.content-gen`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.logger`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
36
+ - Changes here can affect downstream packages such as `@contractspec/lib.content-gen`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.logger`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
25
37
 
26
38
  ## Local Commands
27
39
 
28
- - Build: `bun run build`
29
- - Dev: `bun run dev`
30
- - Test: `bun test`
31
- - Typecheck: `bun run typecheck`
40
+ - `bun run dev` — contractspec-bun-build dev
41
+ - `bun run build`bun run prebuild && bun run build:bundle && bun run build:types
42
+ - `bun run test`bun test --pass-with-no-tests
43
+ - `bun run lint` — bun lint:fix
44
+ - `bun run lint:check` — biome check .
45
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
46
+ - `bun run typecheck` — tsc --noEmit
47
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
48
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
49
+ - `bun run clean` — rimraf dist .turbo
50
+ - `bun run build:bundle` — contractspec-bun-build transpile
51
+ - `bun run build:types` — contractspec-bun-build types
52
+ - `bun run prebuild` — contractspec-bun-build prebuild
package/README.md CHANGED
@@ -1,14 +1,68 @@
1
- # Content Generation Example
1
+ # @contractspec/example.content-generation
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
+ **Content generation example using @contractspec/lib.content-gen.**
5
6
 
6
- Shows how to take a ContractSpec content brief and produce marketing assets with `@contractspec/lib.content-gen`.
7
+ ## What This Demonstrates
7
8
 
8
- ## Generates
9
+ - Content generation pipeline with typed contracts.
10
+ - Integration with the content-gen library.
11
+ - Structured logging for generation steps.
12
+ - DocBlock documentation for the generation flow.
13
+ - `src/docs/` contains docblocks and documentation-facing exports.
14
+ - `src/docs/` contains docblocks and documentation-facing exports.
9
15
 
10
- - Long-form blog post
11
- - Landing page hero copy
12
- - Email announcement
13
- - Social posts
14
- - SEO metadata
16
+ ## Running Locally
17
+
18
+ From `packages/examples/content-generation`:
19
+ - `bun run dev`
20
+ - `bun run build`
21
+ - `bun run test`
22
+ - `bun run typecheck`
23
+
24
+ ## Usage
25
+
26
+ Use `@contractspec/example.content-generation` as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
27
+
28
+ ## Architecture
29
+
30
+ - `src/content-generation.feature.ts` defines a feature entrypoint.
31
+ - `src/docs/` contains docblocks and documentation-facing exports.
32
+ - `src/example.ts` is the runnable example entrypoint.
33
+ - `src/generate.ts` is part of the package's public or composition surface.
34
+ - `src/index.ts` is the root public barrel and package entrypoint.
35
+
36
+ ## Public Entry Points
37
+
38
+ - Export `.` resolves through `./src/index.ts`.
39
+ - Export `./content-generation.feature` resolves through `./src/content-generation.feature.ts`.
40
+ - Export `./docs` resolves through `./src/docs/index.ts`.
41
+ - Export `./docs/content-generation.docblock` resolves through `./src/docs/content-generation.docblock.ts`.
42
+ - Export `./example` resolves through `./src/example.ts`.
43
+ - Export `./generate` resolves through `./src/generate.ts`.
44
+
45
+ ## Local Commands
46
+
47
+ - `bun run dev` — contractspec-bun-build dev
48
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
49
+ - `bun run test` — bun test --pass-with-no-tests
50
+ - `bun run lint` — bun lint:fix
51
+ - `bun run lint:check` — biome check .
52
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
53
+ - `bun run typecheck` — tsc --noEmit
54
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
55
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
56
+ - `bun run clean` — rimraf dist .turbo
57
+ - `bun run build:bundle` — contractspec-bun-build transpile
58
+ - `bun run build:types` — contractspec-bun-build types
59
+ - `bun run prebuild` — contractspec-bun-build prebuild
60
+
61
+ ## Recent Updates
62
+
63
+ - Replace eslint+prettier by biomejs to optimize speed.
64
+ - Missing contract layers.
65
+
66
+ ## Notes
67
+
68
+ - Works alongside `@contractspec/lib.content-gen`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.logger`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './generate';
2
1
  export * from './content-generation.feature';
3
2
  export { default as example } from './example';
3
+ export * from './generate';
4
4
  import './docs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/example.content-generation",
3
- "version": "3.7.6",
3
+ "version": "3.7.7",
4
4
  "description": "Content generation example using @contractspec/lib.content-gen.",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -57,15 +57,15 @@
57
57
  "dev": "contractspec-bun-build dev",
58
58
  "clean": "rimraf dist .turbo",
59
59
  "lint": "bun lint:fix",
60
- "lint:fix": "eslint src --fix",
61
- "lint:check": "eslint src",
60
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
61
+ "lint:check": "biome check .",
62
62
  "test": "bun test --pass-with-no-tests",
63
63
  "prebuild": "contractspec-bun-build prebuild",
64
64
  "typecheck": "tsc --noEmit"
65
65
  },
66
66
  "dependencies": {
67
- "@contractspec/lib.contracts-spec": "3.7.6",
68
- "@contractspec/lib.content-gen": "3.7.6",
67
+ "@contractspec/lib.contracts-spec": "4.0.0",
68
+ "@contractspec/lib.content-gen": "3.7.7",
69
69
  "@contractspec/lib.logger": "3.7.6"
70
70
  },
71
71
  "devDependencies": {
@@ -1,20 +1,20 @@
1
1
  import { defineFeature } from '@contractspec/lib.contracts-spec';
2
2
 
3
3
  export const ContentGenerationFeature = defineFeature({
4
- meta: {
5
- key: 'content-generation',
6
- version: '1.0.0',
7
- title: 'Content Generation',
8
- description:
9
- 'AI content generation for blog posts, landing pages, emails, and social media',
10
- domain: 'content',
11
- owners: ['@examples'],
12
- tags: ['content', 'ai', 'generation'],
13
- stability: 'experimental',
14
- },
4
+ meta: {
5
+ key: 'content-generation',
6
+ version: '1.0.0',
7
+ title: 'Content Generation',
8
+ description:
9
+ 'AI content generation for blog posts, landing pages, emails, and social media',
10
+ domain: 'content',
11
+ owners: ['@examples'],
12
+ tags: ['content', 'ai', 'generation'],
13
+ stability: 'experimental',
14
+ },
15
15
 
16
- docs: [
17
- 'docs.examples.content-generation',
18
- 'docs.examples.content-generation.usage',
19
- ],
16
+ docs: [
17
+ 'docs.examples.content-generation',
18
+ 'docs.examples.content-generation.usage',
19
+ ],
20
20
  });
@@ -2,27 +2,27 @@ import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
2
2
  import { registerDocBlocks } from '@contractspec/lib.contracts-spec/docs';
3
3
 
4
4
  const blocks: DocBlock[] = [
5
- {
6
- id: 'docs.examples.content-generation',
7
- title: 'Content Generation (example)',
8
- summary:
9
- 'Generate a consistent set of marketing assets from a typed ContentBrief (blog, landing hero, email, social, SEO).',
10
- kind: 'reference',
11
- visibility: 'public',
12
- route: '/docs/examples/content-generation',
13
- tags: ['content', 'marketing', 'example'],
14
- body: `## What this example shows\n- A spec-first-ish interface for content brief inputs (typed, validated).\n- Deterministic orchestration of generators (same input → same structure).\n\n## Outputs\n- Blog intro\n- Landing hero\n- Email subject/body\n- Social post bodies\n- SEO metadata`,
15
- },
16
- {
17
- id: 'docs.examples.content-generation.usage',
18
- title: 'Content Generation — Usage',
19
- summary: 'How to run the example and extend the brief.',
20
- kind: 'usage',
21
- visibility: 'public',
22
- route: '/docs/examples/content-generation/usage',
23
- tags: ['content', 'usage'],
24
- body: `## Usage\n- Call \`runContentGenerationExample()\`.\n- Modify the \`ContentBrief\` fields to drive different outputs.\n\n## Guardrails\n- Avoid PII in briefs.\n- Keep output logging structured; no raw \`console.log\` in library code.`,
25
- },
5
+ {
6
+ id: 'docs.examples.content-generation',
7
+ title: 'Content Generation (example)',
8
+ summary:
9
+ 'Generate a consistent set of marketing assets from a typed ContentBrief (blog, landing hero, email, social, SEO).',
10
+ kind: 'reference',
11
+ visibility: 'public',
12
+ route: '/docs/examples/content-generation',
13
+ tags: ['content', 'marketing', 'example'],
14
+ body: `## What this example shows\n- A spec-first-ish interface for content brief inputs (typed, validated).\n- Deterministic orchestration of generators (same input → same structure).\n\n## Outputs\n- Blog intro\n- Landing hero\n- Email subject/body\n- Social post bodies\n- SEO metadata`,
15
+ },
16
+ {
17
+ id: 'docs.examples.content-generation.usage',
18
+ title: 'Content Generation — Usage',
19
+ summary: 'How to run the example and extend the brief.',
20
+ kind: 'usage',
21
+ visibility: 'public',
22
+ route: '/docs/examples/content-generation/usage',
23
+ tags: ['content', 'usage'],
24
+ body: `## Usage\n- Call \`runContentGenerationExample()\`.\n- Modify the \`ContentBrief\` fields to drive different outputs.\n\n## Guardrails\n- Avoid PII in briefs.\n- Keep output logging structured; no raw \`console.log\` in library code.`,
25
+ },
26
26
  ];
27
27
 
28
28
  registerDocBlocks(blocks);
package/src/example.ts CHANGED
@@ -1,32 +1,32 @@
1
1
  import { defineExample } from '@contractspec/lib.contracts-spec';
2
2
 
3
3
  const example = defineExample({
4
- meta: {
5
- key: 'content-generation',
6
- version: '1.0.0',
7
- title: 'Content Generation',
8
- description:
9
- 'Generate blog/landing/email/social/SEO assets from a typed ContentBrief using @contractspec/lib.content-gen.',
10
- kind: 'script',
11
- visibility: 'public',
12
- stability: 'experimental',
13
- owners: ['@platform.core'],
14
- tags: ['content', 'marketing', 'generation', 'ai'],
15
- },
16
- docs: {
17
- rootDocId: 'docs.examples.content-generation',
18
- usageDocId: 'docs.examples.content-generation.usage',
19
- },
20
- entrypoints: {
21
- packageName: '@contractspec/example.content-generation',
22
- docs: './docs',
23
- },
24
- surfaces: {
25
- templates: true,
26
- sandbox: { enabled: true, modes: ['markdown'] },
27
- studio: { enabled: true, installable: true },
28
- mcp: { enabled: true },
29
- },
4
+ meta: {
5
+ key: 'content-generation',
6
+ version: '1.0.0',
7
+ title: 'Content Generation',
8
+ description:
9
+ 'Generate blog/landing/email/social/SEO assets from a typed ContentBrief using @contractspec/lib.content-gen.',
10
+ kind: 'script',
11
+ visibility: 'public',
12
+ stability: 'experimental',
13
+ owners: ['@platform.core'],
14
+ tags: ['content', 'marketing', 'generation', 'ai'],
15
+ },
16
+ docs: {
17
+ rootDocId: 'docs.examples.content-generation',
18
+ usageDocId: 'docs.examples.content-generation.usage',
19
+ },
20
+ entrypoints: {
21
+ packageName: '@contractspec/example.content-generation',
22
+ docs: './docs',
23
+ },
24
+ surfaces: {
25
+ templates: true,
26
+ sandbox: { enabled: true, modes: ['markdown'] },
27
+ studio: { enabled: true, installable: true },
28
+ mcp: { enabled: true },
29
+ },
30
30
  });
31
31
 
32
32
  export default example;
package/src/generate.ts CHANGED
@@ -1,54 +1,54 @@
1
+ import type { ContentBrief } from '@contractspec/lib.content-gen';
1
2
  import {
2
- BlogGenerator,
3
- EmailCampaignGenerator,
4
- LandingPageGenerator,
5
- SocialPostGenerator,
3
+ BlogGenerator,
4
+ EmailCampaignGenerator,
5
+ LandingPageGenerator,
6
+ SocialPostGenerator,
6
7
  } from '@contractspec/lib.content-gen/generators';
7
8
  import { SeoOptimizer } from '@contractspec/lib.content-gen/seo';
8
- import type { ContentBrief } from '@contractspec/lib.content-gen';
9
9
  import { Logger, LogLevel } from '@contractspec/lib.logger';
10
10
  import type { LoggerConfig } from '@contractspec/lib.logger/types';
11
11
 
12
12
  const logger = new Logger({
13
- level: process.env.NODE_ENV === 'production' ? LogLevel.INFO : LogLevel.DEBUG,
14
- environment:
15
- (process.env.NODE_ENV as LoggerConfig['environment']) || 'development',
16
- enableColors: process.env.NODE_ENV !== 'production',
13
+ level: process.env.NODE_ENV === 'production' ? LogLevel.INFO : LogLevel.DEBUG,
14
+ environment:
15
+ (process.env.NODE_ENV as LoggerConfig['environment']) || 'development',
16
+ enableColors: process.env.NODE_ENV !== 'production',
17
17
  });
18
18
 
19
19
  export async function runContentGenerationExample(): Promise<void> {
20
- const brief: ContentBrief = {
21
- title: 'AI-Native Operations Copilot',
22
- summary:
23
- 'Automates support resolutions, growth playbooks, and DevOps rituals.',
24
- problems: [
25
- 'Support queues pile up after hours',
26
- 'Growth teams lack fresh experiments',
27
- ],
28
- solutions: [
29
- 'Stateful AI agents grounded in your knowledge spaces',
30
- 'CI-safe approval workflows for human review',
31
- 'Analytics + experimentation stack built into ContractSpec',
32
- ],
33
- metrics: ['80% auto-resolution rate', '10+ experiments shipped weekly'],
34
- audience: { role: 'COO', industry: 'Fintech', maturity: 'scaleup' },
35
- callToAction: 'Book a 15‑minute pilot run',
36
- };
20
+ const brief: ContentBrief = {
21
+ title: 'AI-Native Operations Copilot',
22
+ summary:
23
+ 'Automates support resolutions, growth playbooks, and DevOps rituals.',
24
+ problems: [
25
+ 'Support queues pile up after hours',
26
+ 'Growth teams lack fresh experiments',
27
+ ],
28
+ solutions: [
29
+ 'Stateful AI agents grounded in your knowledge spaces',
30
+ 'CI-safe approval workflows for human review',
31
+ 'Analytics + experimentation stack built into ContractSpec',
32
+ ],
33
+ metrics: ['80% auto-resolution rate', '10+ experiments shipped weekly'],
34
+ audience: { role: 'COO', industry: 'Fintech', maturity: 'scaleup' },
35
+ callToAction: 'Book a 15‑minute pilot run',
36
+ };
37
37
 
38
- const blog = await new BlogGenerator().generate(brief);
39
- const landing = await new LandingPageGenerator().generate(brief);
40
- const email = await new EmailCampaignGenerator().generate({
41
- brief,
42
- variant: 'announcement',
43
- });
44
- const social = await new SocialPostGenerator().generate(brief);
45
- const seo = new SeoOptimizer().optimize(brief);
38
+ const blog = await new BlogGenerator().generate(brief);
39
+ const landing = await new LandingPageGenerator().generate(brief);
40
+ const email = await new EmailCampaignGenerator().generate({
41
+ brief,
42
+ variant: 'announcement',
43
+ });
44
+ const social = await new SocialPostGenerator().generate(brief);
45
+ const seo = new SeoOptimizer().optimize(brief);
46
46
 
47
- logger.info('Generated content assets', {
48
- blogIntro: blog.intro,
49
- landingHero: landing.hero,
50
- emailSubject: email.subject,
51
- socialPosts: social.map((post) => post.body),
52
- seo,
53
- });
47
+ logger.info('Generated content assets', {
48
+ blogIntro: blog.intro,
49
+ landingHero: landing.hero,
50
+ emailSubject: email.subject,
51
+ socialPosts: social.map((post) => post.body),
52
+ seo,
53
+ });
54
54
  }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './generate';
2
1
  export * from './content-generation.feature';
3
2
  export { default as example } from './example';
3
+ export * from './generate';
4
4
  import './docs';
package/tsconfig.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
- "extends": "@contractspec/tool.typescript/react-library.json",
3
- "include": ["src"],
4
- "exclude": ["node_modules", "dist"],
5
- "compilerOptions": {
6
- "rootDir": "src",
7
- "outDir": "dist"
8
- }
2
+ "extends": "@contractspec/tool.typescript/react-library.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules", "dist"],
5
+ "compilerOptions": {
6
+ "rootDir": "src",
7
+ "outDir": "dist"
8
+ }
9
9
  }
10
-
11
-
package/tsdown.config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineConfig, moduleLibrary } from '@contractspec/tool.bun';
2
2
 
3
3
  export default defineConfig(() => ({
4
- ...moduleLibrary,
4
+ ...moduleLibrary,
5
5
  }));