Files
GandClaude Opus 5 a21d8906af chore: add a formatter, and close a CSS comment that was never closed (#419)
* chore: add a formatter, matching the style this repo already writes

singleQuote=true was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier, and close a comment that was never closed

The formatter refused this repo outright, which turned out to be a real defect
rather than a tooling complaint. kivitendo-intake.css opens a header comment,
and line 17 contains an inner /* ⚠ PRÜFEN */ — CSS comments do not nest, so
that inner terminator CLOSES the header. Everything after it is parsed as CSS
until the stray */ on line 20. A browser mis-parses it the same way.

The file exists in two places (public/presentations/ and deliverables/), both
carrying the same defect; fixing one still failed the gate, which is how the
duplicate surfaced at all.

Mechanical otherwise. This SHA is listed in .git-blame-ignore-revs.

* chore: teach git blame to skip the reformat

* fix: undo a 3-way merge duplication in AdminSidebar.tsx

Merging main with -X theirs duplicated a 30-line block: main's currency-sweep
commit and this branch's prettier reformat both touched overlapping lines in
the single-destination-group render path, and the -X theirs strategy inserted
rather than replaced, leaving two near-identical copies and a dangling closing
brace — SyntaxError: ',' expected at line 298.

The branch has no legitimate change to this file's logic, only formatting, so
main's content is correct outright. Took it wholesale rather than hand-editing
the merge result.

* fix(lint): reattach 5 directives the reformat detached

Four eslint-disable-next-line sites for react-hooks/set-state-in-effect and one
@ts-expect-error, all the same defect: the directive sat above useEffect( (or
above a JSX element), while the statement that actually errors is 1-2 lines
further down inside the block. eslint/tsc report at the real statement; the
directive, still bound to its original line number, protects nothing there.

TimecardReviewDrawer.tsx (x2), DataEntryTabs.tsx, AppointmentBookingForm.tsx,
CreatePoolModal.tsx. Same root cause documented for hirnli, fleetcrown and
ivy-portal earlier today — a positional directive is a hidden dependency on
formatting, and this is the fourth distinct shape it's taken.

* fix(i18n): restore a same-line audit-exemption marker

Fifth shape of today's positional-directive defect, this time the repo's own
i18n-hardcoded-audit convention rather than eslint or tsc: a // i18n-ok comment
exempts a hardcoded string only when it trails the SAME line. prettier wrapped
this one if-statement's long condition onto its own line, leaving the marker
on the return statement below — the exact sibling one line down
('fortgeschrittene bis experten') stayed on one line because it was short
enough not to wrap, and it alone kept passing.

Restored the one-line form and added // prettier-ignore so a future reformat
cannot re-split it. Verified against the real audit script locally: 0 new
violations.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 13:35:50 +00:00
..

@ai-native-cms/core

Transform user suggestions into AI agent instructions - The core engine for AI-Native Content Management

npm version TypeScript License: MIT

🎯 What is AI-Native CMS?

AI-Native CMS is a revolutionary approach to content management where site visitors can propose changes that get automatically translated into actionable instructions for AI agents (Claude Code, Cursor, etc.).

Instead of complex admin interfaces, users simply describe what they want changed, and AI generates the exact implementation steps for developers.

⭐ Key Features

  • 🤖 AI Instruction Generation: Convert natural language suggestions into detailed technical instructions
  • 🔧 Modular Architecture: Plug-and-play storage adapters, notification providers, and AI generators
  • 📊 Multiple Storage Options: Memory, PostgreSQL, MySQL, MongoDB, or custom adapters
  • 📧 Rich Notifications: Email, Slack, Discord, Webhook, or custom providers
  • 🎨 Customizable Templates: Framework-specific instruction templates (Next.js, React, Vue, etc.)
  • ⚡ Rate Limiting: Built-in protection against abuse
  • 🔒 TypeScript First: Full type safety and excellent DX

🚀 Quick Start

npm install @ai-native-cms/core

Basic Usage

import { AINativeCMS, createDefaultConfig } from '@ai-native-cms/core'

// Create configuration
const config = createDefaultConfig({
  name: 'My Website',
  domain: 'example.com',
  framework: 'nextjs',
  aiProvider: 'template'
})

// Initialize CMS
const cms = new AINativeCMS(config)
await cms.init()

// Submit a suggestion
const suggestion = await cms.submitSuggestion({
  content: 'Make the header bigger and add more spacing',
  contact: 'user@example.com',
  page: '/about',
  url: 'https://example.com/about'
}, '192.168.1.1')

// Generate AI instructions
const instructions = await cms.generateAIInstructions(suggestion.id)
console.log(instructions)

🏗️ Architecture

Storage Adapters

Choose how suggestions are stored:

// Memory (development)
storage: {
  adapter: 'memory',
  config: {}
}

// PostgreSQL (production)
storage: {
  adapter: 'postgres',
  config: {
    host: 'localhost',
    port: 5432,
    database: 'cms',
    username: 'user',
    password: 'pass'
  }
}

Notification Providers

Get notified of new suggestions:

notifications: {
  providers: [
    {
      name: 'email',
      config: {
        host: 'smtp.gmail.com',
        port: 587,
        auth: { user: 'admin@example.com', pass: 'password' },
        from: 'AI CMS <admin@example.com>',
        to: ['dev@example.com']
      },
      enabled: true
    },
    {
      name: 'slack',
      config: {
        webhookUrl: 'https://hooks.slack.com/services/...',
        channel: '#dev'
      },
      enabled: true
    }
  ]
}

AI Instruction Generation

Transform suggestions into actionable instructions:

aiInstructions: {
  provider: 'template', // or 'openai', 'anthropic'
  config: {
    customPrompts: {
      siteName: 'My Amazing Website',
      additionalContext: 'We use Tailwind CSS for styling'
    }
  }
}

📝 AI Instruction Templates

The core comes with built-in templates for different types of changes:

General Content Changes

User suggestion: "Make the services section bigger"

Generated instructions:
# AI Agent Instructions: Visual/Styling Changes

## 🎨 Visual Modification Request
**Page:** /services
**User Request:** "Make the services section bigger"

## 🔧 Styling Implementation Steps

1. **Identify Target Elements**
   - Locate the services section in /services page
   - Check current CSS/styling implementation
   - Review design system consistency

2. **Implement Visual Changes**
   - Increase section height/padding
   - Consider responsive design implications
   - Maintain accessibility standards

3. **Files to Consider**
   - src/components/sections/ServicesSection.tsx
   - src/styles/services.css
   - Check responsive breakpoints

...

Navigation Changes

User suggestion: "Add a Blog link to the main menu"

Generated instructions:
# AI Agent Instructions: Navigation Modification

## 🧭 Navigation Change Request
**Navigation Request:** "Add a Blog link to the main menu"

## 🔗 Implementation Steps

1. **Update Navigation Component**
   - Add "Blog" link to main navigation array
   - Ensure proper routing to /blog
   - Update mobile navigation if applicable

2. **Files to Modify**
   - src/components/layout/Header.tsx
   - src/components/navigation/Navigation.tsx
   - Check routing configuration

...

🔧 Advanced Configuration

Custom Storage Adapter

import { StorageAdapter, Suggestion } from '@ai-native-cms/core'

class CustomStorageAdapter implements StorageAdapter {
  async create(input: SuggestionInput, ip: string): Promise<Suggestion> {
    // Your custom storage logic
  }
  
  async findById(id: string): Promise<Suggestion | null> {
    // Your custom retrieval logic
  }
  
  // ... implement other methods
}

const config = {
  storage: {
    adapter: 'custom',
    config: {
      customAdapter: new CustomStorageAdapter()
    }
  }
}

Custom AI Generator

import { AIInstructionGenerator, AIInstructionContext } from '@ai-native-cms/core'

class CustomAIGenerator implements AIInstructionGenerator {
  name = 'my-ai'
  
  async generate(context: AIInstructionContext): Promise<string> {
    // Your custom AI generation logic
    return `Custom instructions for: ${context.suggestion.content}`
  }
  
  configure(config: Record<string, any>): void {
    // Configure your generator
  }
}

Event System

Listen to CMS events for custom logic:

cms.on('suggestion:created', ({ suggestion }) => {
  console.log('New suggestion:', suggestion.content)
})

cms.on('suggestion:ai_generated', ({ suggestion, instructions }) => {
  console.log('AI instructions ready:', instructions)
})

cms.on('rate_limit:exceeded', ({ ip, attempts }) => {
  console.log(`Rate limit exceeded for IP ${ip}: ${attempts} attempts`)
})

📊 Statistics and Monitoring

const stats = await cms.getStats()

console.log(stats)
/*
{
  total: 156,
  byStatus: {
    pending: 12,
    processing: 3,
    ai_generated: 89,
    in_progress: 25,
    completed: 24,
    rejected: 3
  },
  byPage: {
    '/': 45,
    '/about': 23,
    '/services': 18,
    '/contact': 12
  },
  recentActivity: [...]
}
*/

🔒 Rate Limiting

Protect your API from abuse:

rateLimit: {
  windowMs: 5 * 60 * 1000, // 5 minutes
  maxRequests: 3, // 3 requests per window
  skipSuccessfulRequests: false,
  skipFailedRequests: true
}

// Check rate limit manually
const result = await cms.checkRateLimit('192.168.1.1')
console.log(result.allowed) // true/false
console.log(result.remaining) // requests remaining
console.log(result.resetTime) // when window resets

🛠️ Development

# Install dependencies
npm install

# Run tests
npm test

# Build package
npm run build

# Type checking
npm run typecheck

# Linting
npm run lint

📚 API Reference

AINativeCMS

Main CMS class for managing suggestions and AI instructions.

Methods

  • init(): Promise<void> - Initialize the CMS
  • submitSuggestion(input, ip): Promise<Suggestion> - Submit a new suggestion
  • getSuggestions(filters?): Promise<Suggestion[]> - Get suggestions with optional filters
  • updateSuggestionStatus(id, status): Promise<Suggestion> - Update suggestion status
  • generateAIInstructions(id): Promise<string> - Generate AI instructions
  • getStats(): Promise<SuggestionStats> - Get system statistics
  • destroy(): Promise<void> - Cleanup and destroy CMS instance

Events

  • suggestion:created - New suggestion submitted
  • suggestion:updated - Suggestion updated
  • suggestion:ai_generated - AI instructions generated
  • rate_limit:exceeded - Rate limit exceeded
  • notification:sent - Notification sent successfully

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

MIT © AI-Native CMS Team


Ready to make your website AI-native? 🚀

Get started with our Quick Start Guide or check out the live examples.