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 Next.js Example

This is a complete example of integrating AI-Native CMS into a Next.js application.

🚀 Features

  • Suggestion Widget: Floating button that allows visitors to suggest changes
  • Admin Dashboard: Full-featured dashboard to manage suggestions and generate AI instructions
  • Real-time Updates: Live updates when suggestions are submitted
  • AI Instruction Generation: Automatic conversion of suggestions to actionable instructions
  • Multi-provider Notifications: Email, console, and webhook notifications

📦 What's Included

nextjs-basic/
├── pages/
│   ├── index.tsx          # Main homepage with suggestion widget
│   ├── admin.tsx          # Admin dashboard page
│   └── api/
│       └── suggestions.ts # API endpoint for handling suggestions
├── styles/
│   └── globals.css        # Global styles
├── package.json
├── next.config.js
└── README.md

🛠️ Setup

  1. Install dependencies:
npm install
  1. Environment variables: Create .env.local file:
# Database (PostgreSQL)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=ai_cms
DB_USER=postgres
DB_PASSWORD=your_password

# Email notifications (optional)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
EMAIL_FROM=AI CMS <noreply@yourdomain.com>
EMAIL_TO=admin@yourdomain.com,dev@yourdomain.com

# Slack notifications (optional)
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...

# Discord notifications (optional)
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
  1. Set up database (if using PostgreSQL):
CREATE DATABASE ai_cms;
-- Tables will be created automatically by the CMS
  1. Run the development server:
npm run dev
  1. Open your browser:

🎯 How It Works

1. User Submits Suggestion

  • Visitor clicks the floating suggestion button
  • Fills out a form describing what they want changed
  • Suggestion is submitted and stored in the database

2. AI Processes Suggestion

  • AI-Native CMS analyzes the suggestion
  • Generates specific, actionable instructions
  • Instructions are tailored to your framework (Next.js in this case)

3. Developer Gets Notified

  • Email/Slack/Discord notifications sent
  • Admin can review suggestions in the dashboard
  • AI instructions can be copied and pasted into AI agents

4. Implementation

  • Developer uses AI instructions with Claude Code, Cursor, or other AI tools
  • Changes are implemented quickly and accurately
  • Suggestion status can be updated to track progress

💡 Example AI Instructions

When a user suggests "Make the header bigger", the AI generates:

# AI Agent Instructions: Visual/Styling Changes

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

## 🔧 Styling Implementation Steps

1. **Identify Target Elements**
   - Locate the header section in pages/index.tsx
   - Current header uses: `py-6` (1.5rem top/bottom padding)
   - Check for responsive design considerations

2. **Implement Visual Changes**
   - Increase header padding from `py-6` to `py-8` or `py-12`
   - Consider increasing font sizes in the header
   - Ensure mobile responsiveness is maintained

3. **Next.js Specific Notes**
   - File to modify: `pages/index.tsx`
   - Look for the `<header>` element with Tailwind classes
   - Test on different screen sizes after changes

4. **Testing Checklist**
   - [ ] Desktop view (1920x1080)
   - [ ] Tablet view (768px width)  
   - [ ] Mobile view (375px width)
   - [ ] Navigation functionality maintained

This styling request was processed by AI-Native CMS for My Next.js Website.

🔧 Customization

Modify AI Templates

Edit the CMS configuration in pages/index.tsx:

cmsConfig.aiInstructions = {
  provider: 'template',
  config: {
    customPrompts: {
      siteName: 'Your Website Name',
      additionalContext: 'We use Tailwind CSS and custom components'
    }
  }
}

Add Custom Storage

import { CustomStorageAdapter } from './lib/CustomStorageAdapter'

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

Configure Notifications

cmsConfig.notifications = {
  providers: [
    {
      name: 'email',
      config: {
        host: 'smtp.sendgrid.net',
        port: 587,
        auth: { user: 'apikey', pass: process.env.SENDGRID_API_KEY },
        from: 'noreply@yourdomain.com',
        to: ['admin@yourdomain.com']
      },
      enabled: true
    },
    {
      name: 'slack',
      config: {
        webhookUrl: process.env.SLACK_WEBHOOK_URL,
        channel: '#dev-notifications'
      },
      enabled: !!process.env.SLACK_WEBHOOK_URL
    }
  ]
}

🎨 Styling

The example uses Tailwind CSS for styling. The suggestion widget comes with built-in styles that can be customized:

/* In your CSS file */
:root {
  --ai-cms-primary-color: #your-brand-color;
  --ai-cms-primary-hover: #your-brand-hover-color;
}

Or pass custom styles as props:

<SuggestionWidget
  buttonStyle={{
    backgroundColor: '#your-color',
    borderRadius: '12px'
  }}
  modalStyle={{
    borderRadius: '16px',
    boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)'
  }}
/>

📊 Admin Dashboard Features

  • Statistics Overview: Total suggestions, status breakdown
  • Filtering & Search: Filter by status, page, date range
  • AI Generation: Generate instructions for any suggestion
  • Status Management: Update suggestion status
  • Copy Instructions: One-click copy for AI agents
  • Real-time Updates: Live updates as new suggestions come in

🚀 Deployment

  1. Push code to GitHub
  2. On your server (or via CI), pull and npm ci && npm run build
  3. Set environment variables in the server's .env
  4. Serve the standalone build behind a reverse proxy (e.g. Caddy/nginx)

Manual Deployment

  1. Build the project:
npm run build
  1. Start the production server:
npm start

🔍 Troubleshooting

Common Issues

  1. Database connection fails:

    • Check environment variables
    • Ensure PostgreSQL is running
    • Verify database exists
  2. Suggestions not saving:

    • Check browser console for errors
    • Verify API endpoint is working
    • Check database permissions
  3. AI instructions not generating:

    • Check template configuration
    • Verify suggestion has content
    • Look at server logs for errors
  4. Notifications not working:

    • Check email/Slack credentials
    • Verify provider configuration
    • Test with console provider first

Debug Mode

Enable verbose logging:

cmsConfig.notifications.providers.push({
  name: 'console',
  config: { verbose: true },
  enabled: true
})

📚 Learn More

🤝 Contributing

Found a bug or want to improve this example? Please open an issue or submit a pull request!

📄 License

MIT © AI-Native CMS Team