# VibeBusiness

AI-powered autonomous product manager. Research. Build. Ship. Grow — on autopilot.

## Install

```bash
npm install -g vibebusiness
```

Requires Node.js 18+.

## Quick Start

```bash
# Build a new AI-powered app from a one-sentence idea (interactive)
vibebusiness build

# Or jump straight in with your idea
vibebusiness build --idea="AI recipe generator"

# Or go to your existing project directory and set up the analyst
cd ~/my-project

# Interactive setup wizard (configures AI provider, license, repos)
vibebusiness init

# Preview what the analyst would do (no changes made)
vibebusiness heartbeat --dry-run

# Run a single autonomous heartbeat
vibebusiness heartbeat

# Run continuous session (heartbeats every 5 min for 60 min)
vibebusiness heartbeat --session --duration=60 --interval=5
```

### Improve an existing project

Point VibeBusiness at any existing codebase to generate an investor-grade improvement roadmap:

```bash
mkdir my-project-analysis && cd my-project-analysis
vibebusiness init          # 5-question setup: project name, repo path, AI provider
vibebusiness scan          # auto-reads README/docs to enrich product context (optional but recommended)
vibebusiness refine        # runs quality loop → investor-grade kanban (4 lenses, up to 3 passes)
vibebusiness start         # open dashboard at http://localhost:3001
```

The quality loop evaluates your roadmap against 4 stakeholder lenses (VC investor, engineering squad,
customer advocate, CEO) and iterates until every lens scores ≥6 and the average reaches 7/10.

See [docs/roadmap-quality-framework.md](docs/roadmap-quality-framework.md) for full scoring rubric.

You can also point commands at an existing workspace from anywhere:

```bash
vibebusiness refine --data=./my-project-analysis --dry-run   # evaluate quality without running analysis
vibebusiness start --data=./my-project-analysis              # view dashboard for that workspace
vibebusiness capture --data=./my-project-analysis --port=3001 # take demo screenshots
```

## Commands

| Command | Description |
|---------|-------------|
| `vibebusiness init` | Interactive setup wizard |
| `vibebusiness init --reset` | Re-detect repos without re-running full setup |
| `vibebusiness start` | Start local dashboard (default port 3001) |
| `vibebusiness start --port=4000` | Start dashboard on custom port |
| `vibebusiness heartbeat` | Run autonomous heartbeat cycle |
| `vibebusiness heartbeat --dry-run` | Preview without executing changes |
| `vibebusiness heartbeat --skip-reasoning` | Skip Claude reasoning step (faster) |
| `vibebusiness heartbeat --session` | Run continuous heartbeat session |
| `vibebusiness heartbeat --session --duration=60 --interval=5` | Run for 60 min, heartbeat every 5 min |
| `vibebusiness analyze --type=<type>` | Run codebase analysis (quick, deep, metrics, seo, research) |
| `vibebusiness analyze --type=research --topic="..."` | Run deep research on a specific topic |
| `vibebusiness build` | Build a full AI-powered app from a one-sentence idea (interactive) |
| `vibebusiness build --idea="..."` | Build app from a specific idea |
| `vibebusiness scan` | Auto-populate workspace data from docs & code |
| `vibebusiness refine` | Quality loop → investor-grade kanban (4 lenses, up to 3 passes) |
| `vibebusiness refine --data=<dir>` | Run refine against a specific workspace directory |
| `vibebusiness capture --data=<dir>` | Take showcase screenshots of the dashboard |
| `vibebusiness implement --idea=<id>` | Implement an approved idea |
| `vibebusiness status` | Show current status and idea counts |
| `vibebusiness telemetry --enable\|--disable` | Manage anonymous telemetry |
| `vibebusiness version` | Show version |
| `vibebusiness help` | Show all available commands |

## How It Works

VibeBusiness acts as an AI employee that:

1. **Monitors** your codebase and KPIs continuously
2. **Reasons** about what to improve using Claude Code
3. **Generates** improvement ideas through analysis
4. **Implements** approved ideas with safe branch-based workflows
5. **Learns** patterns over time via MEMORY.md

```
Heartbeat Cycle:
┌─────────────────────────────────────────────┐
│ 1. Load State (ideas, goals, TODO, STATUS)  │
│ 2. Check Alerts (stale KPIs, stuck ideas)   │
│ 3. Fetch Live Data from your APIs           │
│ 4. INVOKE CLAUDE to reason about state      │
│ 5. Execute Claude's recommendations         │
│ 6. Update TODO.md, MEMORY.md, STATUS.md     │
└─────────────────────────────────────────────┘
```

## Features

- **Idea Pipeline** — Generate, research, approve, implement, ship, and evaluate improvement ideas end-to-end
- **Autonomous Implementation** — Branch creation, sub-task decomposition, PR creation, auto-merge
- **Post-Ship Evaluation** — Automatically evaluates shipped ideas against success metrics after 7 days
- **Marketing Visuals** — Generates 1080×1080 ship announcement cards (PNG) when ideas ship
- **Business Intelligence** — Competitor research, positioning, growth audits, pricing analysis
- **Content Marketing** — Keyword research, blog generation, social carousels, email nurture (via ContentFlow)
- **Social Media** — Twitter/X build-in-public: auto-draft tweets from shipped features, KPI milestones, and weekly digests; review and publish from the dashboard
- **Web Dashboard** — Kanban board, goals tracking, hypothesis management, session logs

## Slash Commands

Available as Claude Code skills when working inside a VibeBusiness project:

| Command | Description |
|---------|-------------|
| `/research-competitors` | Discover and research competitors |
| `/positioning` | Generate brand positioning & copy bank |
| `/build-page` | Build landing, pricing, or comparison pages |
| `/measure-page` | Measure live page performance metrics |
| `/growth-audit` | Audit growth channels (SEO, paid, content, referral) |
| `/pricing-analysis` | Competitive pricing analysis |
| `/validate-idea` | Pre-build feasibility research |
| `/manage` | Interactive data editor (query, create, update, delete) |
| `/social-media` | Twitter/X setup, draft generation, status check |
| `/status-summary` | Generate status report |

## Analysis Modes

```bash
vibebusiness analyze --type=<mode>
```

| Mode | Description |
|------|-------------|
| `quick` | Fast codebase scan for obvious improvements |
| `deep` | Comprehensive multi-repo analysis |
| `metrics` | Performance metrics extraction & anomaly detection |
| `seo` | Technical SEO audit |
| `research` | Deep research on a specific topic (`--topic="..."`) |

## Ship Workflow

When an idea is moved to `shipped`:

1. PR merged to main, idea moved to `shipped` stage
2. KPI values snapshotted for future evaluation
3. Git metrics tracked (files changed, lines added/removed)
4. Ship announcement card generated (1080×1080 PNG) → `data/reports/visuals/`
5. Post-ship evaluation scheduled (auto-runs after 7 days)

## Social Media (Twitter/X)

Build in public with automated tweet drafts:

1. **Connect** — Add X API keys to `.env`, run `social-setup-x`
2. **Draft** — Heartbeat auto-generates tweets when you ship features or hit KPI milestones
3. **Review** — Browse drafts at `/social` dashboard, edit text, check character count
4. **Publish** — One-click publish to X, streak tracked automatically

Environment variables (get from https://developer.x.com):
- `X_API_KEY` / `X_API_SECRET` — Consumer API key and secret
- `X_ACCESS_TOKEN` / `X_ACCESS_SECRET` — User access token and secret

> Free tier: 500 posts/month. OAuth 1.0a, text-only (media support planned).

## Dashboard

```bash
vibebusiness start        # http://localhost:3001
```

Pages: Kanban board (drag-drop ideas across stages), Goals & KPIs, Hypotheses, Session history, Settings.

## Project Files

After running `vibebusiness init`, these files are created in your project:

```
data/
├── config.json           # Repository paths and schedules
├── business-context.json # Product info, competitors, constraints
├── ideas.json            # Improvement ideas by stage
├── goals.json            # Business goals with KPIs
├── sessions.json         # Analysis session logs
├── competitors.json      # Competitor research data
├── positioning.json      # Brand positioning & copy bank
├── hypotheses.json       # Growth hypotheses
├── pages.json            # Tracked landing pages
├── social.json           # Social media drafts and metrics
├── implementations.json  # Implementation details per idea
└── reports/
    └── visuals/          # Generated ship announcement cards (PNG)
STATUS.md                 # Current system status (auto-updated)
TODO.md                   # Autonomous task queue
MEMORY.md                 # Learned patterns and context
```

## AI Provider

VibeBusiness uses Claude Code CLI as its primary AI provider (requires Claude Max or Pro subscription).

**Fallback:** Bring your own API keys:
- `ANTHROPIC_API_KEY` — Anthropic Claude API
- `OPENAI_API_KEY` — OpenAI API
- `GOOGLE_API_KEY` — Google Gemini API

## SSH Setup (for autonomous Git operations)

Heartbeat sessions push branches and create PRs autonomously. If your GitHub repo uses SSH, add your key to the agent so git operations don't block on passphrase prompts:

```bash
# One-time (persists across reboots on macOS)
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
```

Without this, `git fetch`/`git push` will hang waiting for input and eventually timeout.

## Cron Setup

```bash
# Heartbeat every hour
0 * * * * cd /path/to/project && vibebusiness heartbeat

# Quick analysis daily at 6am
0 6 * * * cd /path/to/project && vibebusiness analyze --type=quick

# Deep analysis Sunday at 3am
0 3 * * 0 cd /path/to/project && vibebusiness analyze --type=deep
```

## License

See [LICENSE](LICENSE) for details.
