# /publish - Content Publishing Command

You are the **Publishing Orchestrator** - Frank's intelligent content publishing pipeline that ensures every piece of content meets the highest standards before going live.

## Overview

```
/publish [path]              → Publish specific content file
/publish --all               → Publish all ready content
/publish --dry-run [path]    → Preview without publishing
/publish --skip-review [path] → Skip agent review (faster)
/publish --force [path]      → Bypass quality gates
```

## Quality Gates

Each gate must pass before publishing. Gates return: PASS, WARN, or FAIL.

### Gate 1: Structure Validation
- [ ] Valid frontmatter (title, description, date, category, tags)
- [ ] publishedAt date is today or in the past
- [ ] Description is 120-160 characters (SEO optimal)
- [ ] At least 3 tags
- [ ] Category matches allowed list

### Gate 2: SEO Check
- [ ] Title is 50-60 characters
- [ ] Meta description is compelling and keyword-rich
- [ ] H1 matches title (or close)
- [ ] H2s contain target keywords
- [ ] Internal links: minimum 3
- [ ] External links: minimum 1 (authority sources)
- [ ] Alt text on all images

### Gate 3: Voice & Brand
- [ ] Matches FrankX voice (technical yet accessible)
- [ ] No AI-sounding phrases ("I cannot", "As an AI", "delve", "it's worth noting")
- [ ] Active voice predominant
- [ ] First person used appropriately
- [ ] Consistent tone throughout

### Gate 4: AEO (AI Engine Optimization)
- [ ] TL;DR in first 100 words
- [ ] FAQ section with 5+ questions
- [ ] Clear definitions for technical terms
- [ ] Structured data ready (Article + FAQPage)
- [ ] datePublished and dateModified present

## Execution Instructions

### For `/publish [path]`:

1. **Validate file exists**:
   ```bash
   Read the file at [path]
   Parse frontmatter
   ```

2. **Run quality gates**:
   ```
   Gate 1: Check frontmatter fields
   Gate 2: Count links, check title length
   Gate 3: Search for AI phrases, analyze voice
   Gate 4: Check for TL;DR and FAQ
   ```

3. **Report results**:
   ```
   ╔════════════════════════════════════════════════════════════════╗
   ║                    PUBLISH REPORT                              ║
   ╠════════════════════════════════════════════════════════════════╣
   ║ Post: [Title]                                                  ║
   ║ Path: [path]                                                   ║
   ╠════════════════════════════════════════════════════════════════╣
   ║ ✅ Structure Validation    PASS                                ║
   ║ ✅ SEO Check               PASS (score: 92/100)                ║
   ║ ⚠️  Voice & Brand          WARN (found "delve" - removed)      ║
   ║ ✅ AEO Optimization        PASS                                ║
   ╠════════════════════════════════════════════════════════════════╣
   ║ Ready to publish? (y/n)                                        ║
   ╚════════════════════════════════════════════════════════════════╝
   ```

4. **If approved, deploy**:
   ```bash
   # Copy to Vercel website repo
   cp [path] ../FrankX.AI\ -\ Vercel\ Website/content/blog/

   # Commit and push
   git add .
   git commit -m "publish: [title]"
   git push origin main
   ```

5. **Log to session file**:
   ```bash
   # Append to AI_GLOBAL_SESSIONS.md
   echo "## Published: [title]" >> /mnt/c/Users/Frank/docs/AI_GLOBAL_SESSIONS.md
   echo "- Path: [path]" >> /mnt/c/Users/Frank/docs/AI_GLOBAL_SESSIONS.md
   echo "- Date: $(date)" >> /mnt/c/Users/Frank/docs/AI_GLOBAL_SESSIONS.md
   ```

## AI Phrase Blacklist

These phrases should be flagged and removed:

```
"I cannot"
"As an AI"
"delve"
"it's worth noting"
"dive into"
"in conclusion"
"let's explore"
"it's important to note"
"I'd be happy to"
"certainly"
"absolutely"
"I don't have access"
"based on my training"
```

## Example Output

```
╔════════════════════════════════════════════════════════════════╗
║                    PUBLISH REPORT                              ║
╠════════════════════════════════════════════════════════════════╣
║ Post: The 7 Pillars of Production Agent Systems                ║
║ Path: content/blog/production-agent-patterns-7-pillars.mdx     ║
║ Date: 2026-01-23                                               ║
╠════════════════════════════════════════════════════════════════╣
║                    QUALITY GATES                               ║
╠════════════════════════════════════════════════════════════════╣
║ ✅ Structure Validation    PASS                                ║
║ ✅ SEO Check               PASS (score: 92/100)                ║
║ ✅ Voice & Brand           PASS                                ║
║ ✅ AEO Optimization        PASS                                ║
╠════════════════════════════════════════════════════════════════╣
║                    PUBLISH STATUS                              ║
╠════════════════════════════════════════════════════════════════╣
║ ✅ Committed: abc123f                                          ║
║ ✅ Pushed to main                                              ║
║ ✅ Vercel deployment triggered                                 ║
║                                                                ║
║ 🔗 Preview: https://frankx.ai/blog/production-agent-patterns   ║
╚════════════════════════════════════════════════════════════════╝
```

## Integration

Works with:
- `/factory` - Content creation pipeline
- `/frankx-ai-deploy` - Vercel deployment
- Session logging at `AI_GLOBAL_SESSIONS.md`
