@lssm-tech/lib.content-gen
Website: https://contractspec.io
AI-powered content generation for blog, email, and social.
What It Provides
- Couche: lib.
- Consumers: image-gen, voice, video-gen, bundles.
- Related ContractSpec packages include
@lssm-tech/lib.ai-providers, @lssm-tech/lib.contracts-integrations, @lssm-tech/lib.contracts-spec, @lssm-tech/tool.bun, @lssm-tech/tool.typescript.
- Related ContractSpec packages include
@lssm-tech/lib.ai-providers, @lssm-tech/lib.contracts-integrations, @lssm-tech/lib.contracts-spec, @lssm-tech/tool.bun, @lssm-tech/tool.typescript.
Installation
npm install @lssm-tech/lib.content-gen
or
bun add @lssm-tech/lib.content-gen
Usage
Import the root entrypoint from @lssm-tech/lib.content-gen, or choose a documented subpath when you only need one part of the package surface.
SocialPostGenerator drafts LinkedIn content without requiring a connected LinkedIn account. LLM JSON is parsed through parseSocialPosts; malformed posts, unsafe links, invalid channels, and invalid hashtags are discarded before a caller can approve or publish them through the separate LinkedIn provider runtime.
The optimization surfaces distinguish generative-engine optimization (./geo) from local-market adaptation (./geographic). ./social-optimization provides deterministic platform checks. All three return reports; they do not publish or make campaign decisions.
Architecture
src/generators is part of the package's public or composition surface.
src/i18n is part of the package's public or composition surface.
src/index.ts is the root public barrel and package entrypoint.
src/seo is part of the package's public or composition surface.
src/types.ts is shared public type definitions.
Public Entry Points
- Export
. resolves through ./src/index.ts.
- Export
./generators resolves through ./src/generators/index.ts.
- Export
./generators/blog resolves through ./src/generators/blog.ts.
- Export
./generators/email resolves through ./src/generators/email.ts.
- Export
./generators/landing-page resolves through ./src/generators/landing-page.ts.
- Export
./generators/social resolves through ./src/generators/social.ts.
- Export
./i18n resolves through ./src/i18n/index.ts.
- Export
./i18n/catalogs resolves through ./src/i18n/catalogs/index.ts.
- Export
./i18n/catalogs/en resolves through ./src/i18n/catalogs/en.ts.
- Export
./i18n/catalogs/es resolves through ./src/i18n/catalogs/es.ts.
- The package publishes 17 total export subpaths; keep docs aligned with
package.json.
Local Commands
bun run dev — contractspec-bun-build dev
bun run build — contractspec-bun-build build
bun run test — bun test --pass-with-no-tests
bun run lint — bun lint:fix
bun run lint:check — biome check .
bun run lint:fix — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
bun run typecheck — tsgo --noEmit
bun run publish:pkg — bun publish --tolerate-republish --ignore-scripts --verbose
bun run publish:pkg:canary — bun publish:pkg --tag canary
bun run clean — rimraf dist .turbo
bun run build:bundle — contractspec-bun-build transpile
bun run build:types — contractspec-bun-build types
bun run prebuild — contractspec-bun-build prebuild
Recent Updates
- Replace eslint+prettier by biomejs to optimize speed.
- Resolve lint, build, and test failures across voice, workspace, library, and composio.
- Add first-class transport, auth, versioning, and BYOK support across all integrations.
- Add AI provider ranking system with ranking-driven model selection.
- Add full i18n support across all 10 packages (en/fr/es, 460 keys).
Notes
Utiliser ./generators/marketing-copy for strictly parsed, review-required drafts across ads, blogs, landing pages, LinkedIn and X. It requires an explicit qualified LLM, brand revision, brief and clock; it has no silent fallback to fabricated output.
Utiliser ./media/workflow for durable asynchronous generation with explicit authority, idempotent cost reservation, storage, provider and asset-import ports. It persists provider job IDs before importing assets and can resume after import failure. An uncertain submission without a job ID remains unresolved and is not resubmitted.
./generators/marketing-plan provides durable goal-to-plan generation. It reserves a request ID before inference, validates suggested inputs against registered operation schemas, derives approval requirements from those contracts, and never executes suggested work. Hosts authorize inference cost, sanitize knowledge, validate referenced resources and own proposal storage. Missing prerequisites become reviewable questions.
- Generator interface is shared across media libs (image-gen, voice, video-gen); keep it stable.
- i18n keys must stay in sync with consuming packages.
media/rights provides ContentRightsService for scoped asset/likeness/voice/music/paid amplification permissions. The service authorizes grant, use, revocation and withdrawal actions through host policy. Revocation atomically queues existing uses for withdrawal and blocks future registration. Host execution must recheck current rights immediately before provider use; registration alone is not a publishing mandate.
media/withdrawal provides ContentWithdrawalWorker. It authorizes removal, persists a claim before the first provider call, and uses read-only reconciliation thereafter. Missing or ambiguous receipts remain unknown. Confirmed/unavailable outcomes require evidence and update the registered use atomically. Provider adapters must independently verify publication ownership and current removal authority.
The native X withdrawal integration test exercises the complete rights-to-removal path through SQL claims, a lost DELETE response and read-only absence confirmation. No second DELETE is sent. Native HTTP responses remain simulated pending account qualification.
Call assertRegisteredUse immediately before provider use to re-read the current grant and withdrawal state. A previously registered use is rejected after revocation. The check supplements, rather than grants, publication/generation authority; it is not a lease over a later external request.
MediaGenerationWorkflow persists each completed output import immediately. Running jobs may expose a partial ordered artifactRefs prefix after later ingestion fails. Recovery reuses the idempotent ingestor and rejects changed artifact identities without issuing another paid generation.
Completed provider output cardinality is persisted before ingestion. Later polling cannot shrink or expand that set; partial imports cannot become falsely complete because an output disappears from a response.
Media workflow callbacks receive isolated request/generation snapshots. Returned persisted generation records are parsed before use, and mutations by authorization/provider/storage adapters cannot alter the approved request or in-flight job identity.
Use MediaGenerationWorkflow.get for authorized persisted status and partial artifact inspection without provider calls. Use refresh only when explicitly reconciling provider progress and ingesting completed outputs.