seshat-scribe
v3.0.1
Published
AI-powered blog content generation for Sanity CMS using Google Gemini
Maintainers
Readme
Seshat
AI-powered automatic content generation for Sanity CMS. Seshat analyzes your existing content, generates new blog posts using Google Gemini, and publishes directly to Sanity. Automatic generation and publication via GitHub Actions on a schedule.
Features
- Free to Use: Works with Google's free Gemini API tier for text generation, use paid tier for image generation
- AI-Powered Planning: Analyzes existing content to generate unique, non-duplicate topics
- BYOK - Bring Your Own Key, it will use your Gemini key to generate posts
- Sanity Integration: Automatic image upload and document creation in Portable Text format
- Smart Generation: Creates complete articles as Portable Text with optional hero images
- GitHub Actions Integration: Automate content creation on a schedule
- Type-Safe: Built with TypeScript and Zod for runtime validation
Installation
npm install -g seshat-scribeOr use directly:
npx seshat-scribe initQuick Start
1. Initialize
cd your-blog-project
seshat initThe interactive wizard will guide you through Sanity CMS configuration:
- Choose between quick setup (recommended defaults) or custom configuration
- Enter your Sanity project ID, dataset, and API version
- Configure content generation options (optional)
2. Configure API Keys
Get a free Google Gemini API key and add to your environment:
export GEMINI_API_KEY="your_api_key_here"Free vs Paid API Keys:
- Free tier: Generates text-only blog posts (no images)
- Paid tier: Generates blog posts with AI-generated hero images
By default, Seshat will attempt to generate images. To create text-only posts (for free tier), set enableImageGeneration: false in your config (see Configuration below).
Sanity Write Token (required):
export SANITY_WRITE_TOKEN="your_sanity_token_here"3. Generate Content
seshat writePreview without saving:
seshat write --dry-runConfiguration
Seshat uses seshat.config.json for configuration. The wizard creates this automatically, but you can also edit it manually.
Example Configuration
{
"topic": "Software Engineering and Technology",
"tone": "Professional yet approachable",
"sanity": {
"projectId": "your-project-id",
"dataset": "production",
"apiVersion": "2024-01-01",
"documentType": "post"
},
"generation": {
"enableImageGeneration": true,
"targetWordCount": 1500
}
}Core Settings
topic: Global topic constraint for content generationtone: Writing style and voicesanity: Sanity CMS configuration (required)projectId: Your Sanity project IDdataset: Dataset name (default: "production")apiVersion: API version (default: "2024-01-01")documentType: Document type to create (default: "post")
Content Generation
generation.enableImageGeneration: Enable/disable AI image generation (default:true). Set tofalsefor text-only posts if using free Gemini API tiergeneration.targetWordCount: Target word count (optional)generation.includeCodeExamples: Emphasize code examplesgeneration.seoOptimized: Generate SEO-optimized contentgeneration.customInstructions: Additional instructions for AI
Example for free tier (text-only):
{
"generation": {
"enableImageGeneration": false,
"targetWordCount": 1500,
"includeCodeExamples": true
}
}Image Format
imageFormat:png,jpg, orsvg(default:png)
GitHub Actions Automation
Automate content generation on a schedule:
Setup
seshat setup-workflowThis creates .github/workflows/seshat.yml based on your configuration.
Configure Secrets
Add these to your repository secrets (Settings → Secrets and Variables → Actions):
GEMINI_API_KEY: Your Google Gemini API key (required)SANITY_WRITE_TOKEN: Your Sanity write token (required)
Customize Schedule
This will run the GitHub action workflow to generate and publish posts automatically according to the defined schedule.
Edit the schedule field in seshat.config.json:
{
"schedule": "0 9 * * 1"
}Then run seshat setup-workflow again to update the workflow file.
CLI Commands
seshat init
Initialize configuration with interactive wizard:
seshat initseshat write
Generate a new blog post:
seshat write
seshat write --dry-run # Preview without saving
seshat write -t "Custom Topic" # Override topic for this postseshat setup-workflow
Create or update GitHub Actions workflow:
seshat setup-workflowHow It Works
- Analysis: Scans existing content from Sanity CMS to understand what you've written
- Planning: Uses Google Gemini to propose a new, non-duplicate topic
- Writing: Generates complete article as Portable Text
- Illustration (optional): Creates a hero image using Gemini's image generation (if enabled and API supports it)
- Publishing: Uploads content and images to Sanity CMS
Requirements
- Node.js v20+
- Free Google Gemini API key (Get one here - no credit card required)
- Free tier: Text generation only
- Paid tier: Text + AI image generation
- Sanity write token (required)
- Sanity CMS project
Migrating from 0.x
Version 1.0.0 is a breaking change that removes local file support and focuses exclusively on Sanity CMS.
If you're upgrading from 0.x:
- Run
seshat initto create a new Sanity-only configuration - Remove old config fields:
outputMode,contentDir,assetsDir,publicAssetPath,framework,fileExtension,fileNameTemplate,nestedDirectories,frontmatter - Ensure
sanityconfiguration is present and valid - Set
SANITY_WRITE_TOKENenvironment variable
License
MIT
