@qazuor/claude-code-config 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1248 -0
- package/dist/bin.cjs +11886 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +11869 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.cjs +3887 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1325 -0
- package/dist/index.d.ts +1325 -0
- package/dist/index.js +3835 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
- package/templates/.log/notifications.log +1775 -0
- package/templates/agents/README.md +164 -0
- package/templates/agents/_registry.json +443 -0
- package/templates/agents/design/content-writer.md +353 -0
- package/templates/agents/design/ux-ui-designer.md +382 -0
- package/templates/agents/engineering/astro-engineer.md +293 -0
- package/templates/agents/engineering/db-drizzle-engineer.md +360 -0
- package/templates/agents/engineering/express-engineer.md +316 -0
- package/templates/agents/engineering/fastify-engineer.md +399 -0
- package/templates/agents/engineering/hono-engineer.md +263 -0
- package/templates/agents/engineering/mongoose-engineer.md +473 -0
- package/templates/agents/engineering/nestjs-engineer.md +429 -0
- package/templates/agents/engineering/nextjs-engineer.md +451 -0
- package/templates/agents/engineering/node-typescript-engineer.md +347 -0
- package/templates/agents/engineering/prisma-engineer.md +432 -0
- package/templates/agents/engineering/react-senior-dev.md +394 -0
- package/templates/agents/engineering/tanstack-start-engineer.md +447 -0
- package/templates/agents/engineering/tech-lead.md +269 -0
- package/templates/agents/product/product-functional.md +329 -0
- package/templates/agents/product/product-technical.md +578 -0
- package/templates/agents/quality/debugger.md +514 -0
- package/templates/agents/quality/qa-engineer.md +390 -0
- package/templates/agents/specialized/enrichment-agent.md +277 -0
- package/templates/agents/specialized/i18n-specialist.md +322 -0
- package/templates/agents/specialized/seo-ai-specialist.md +387 -0
- package/templates/agents/specialized/tech-writer.md +300 -0
- package/templates/code-style/.editorconfig +27 -0
- package/templates/code-style/.prettierignore +25 -0
- package/templates/code-style/.prettierrc +12 -0
- package/templates/code-style/biome.json +78 -0
- package/templates/code-style/commitlint.config.js +44 -0
- package/templates/commands/README.md +175 -0
- package/templates/commands/_registry.json +420 -0
- package/templates/commands/add-new-entity.md +211 -0
- package/templates/commands/audit/accessibility-audit.md +360 -0
- package/templates/commands/audit/performance-audit.md +290 -0
- package/templates/commands/audit/security-audit.md +231 -0
- package/templates/commands/code-check.md +127 -0
- package/templates/commands/five-why.md +225 -0
- package/templates/commands/formatting/format-markdown.md +197 -0
- package/templates/commands/git/commit.md +247 -0
- package/templates/commands/meta/create-agent.md +257 -0
- package/templates/commands/meta/create-command.md +312 -0
- package/templates/commands/meta/create-skill.md +321 -0
- package/templates/commands/meta/help.md +318 -0
- package/templates/commands/planning/check-completed-tasks.md +224 -0
- package/templates/commands/planning/cleanup-issues.md +248 -0
- package/templates/commands/planning/planning-cleanup.md +251 -0
- package/templates/commands/planning/sync-planning-github.md +133 -0
- package/templates/commands/planning/sync-todos-github.md +203 -0
- package/templates/commands/quality-check.md +211 -0
- package/templates/commands/run-tests.md +159 -0
- package/templates/commands/start-feature-plan.md +232 -0
- package/templates/commands/start-refactor-plan.md +244 -0
- package/templates/commands/sync-planning.md +176 -0
- package/templates/commands/update-docs.md +242 -0
- package/templates/docs/CHECKPOINT-SYSTEM.md +504 -0
- package/templates/docs/INDEX.md +677 -0
- package/templates/docs/RECOMMENDED-HOOKS.md +415 -0
- package/templates/docs/_registry.json +329 -0
- package/templates/docs/diagrams/README.md +220 -0
- package/templates/docs/diagrams/agent-hierarchy.mmd +55 -0
- package/templates/docs/diagrams/documentation-map.mmd +61 -0
- package/templates/docs/diagrams/tools-relationship.mmd +55 -0
- package/templates/docs/diagrams/workflow-decision-tree.mmd +38 -0
- package/templates/docs/doc-sync.md +533 -0
- package/templates/docs/examples/end-to-end-workflow.md +1505 -0
- package/templates/docs/glossary.md +495 -0
- package/templates/docs/guides/mockup-prompt-engineering.md +644 -0
- package/templates/docs/guides/mockup-setup.md +737 -0
- package/templates/docs/learnings/README.md +250 -0
- package/templates/docs/learnings/common-architectural-patterns.md +123 -0
- package/templates/docs/learnings/common-mistakes-to-avoid.md +149 -0
- package/templates/docs/learnings/markdown-formatting-standards.md +104 -0
- package/templates/docs/learnings/monorepo-command-execution.md +64 -0
- package/templates/docs/learnings/optimization-tips.md +146 -0
- package/templates/docs/learnings/planning-linear-sync-workflow.md +70 -0
- package/templates/docs/learnings/shell-compatibility-fish.md +46 -0
- package/templates/docs/learnings/test-organization-structure.md +68 -0
- package/templates/docs/mcp-installation.md +613 -0
- package/templates/docs/mcp-servers.md +989 -0
- package/templates/docs/notification-installation.md +570 -0
- package/templates/docs/quick-start.md +354 -0
- package/templates/docs/standards/architecture-patterns.md +1064 -0
- package/templates/docs/standards/atomic-commits.md +513 -0
- package/templates/docs/standards/code-standards.md +993 -0
- package/templates/docs/standards/design-standards.md +656 -0
- package/templates/docs/standards/documentation-standards.md +1160 -0
- package/templates/docs/standards/testing-standards.md +969 -0
- package/templates/docs/system-maintenance.md +604 -0
- package/templates/docs/templates/PDR-template.md +561 -0
- package/templates/docs/templates/TODOs-template.md +534 -0
- package/templates/docs/templates/tech-analysis-template.md +800 -0
- package/templates/docs/workflows/README.md +519 -0
- package/templates/docs/workflows/atomic-task-protocol.md +955 -0
- package/templates/docs/workflows/decision-tree.md +482 -0
- package/templates/docs/workflows/edge-cases.md +856 -0
- package/templates/docs/workflows/phase-1-planning.md +957 -0
- package/templates/docs/workflows/phase-2-implementation.md +896 -0
- package/templates/docs/workflows/phase-3-validation.md +792 -0
- package/templates/docs/workflows/phase-4-finalization.md +927 -0
- package/templates/docs/workflows/quick-fix-protocol.md +505 -0
- package/templates/docs/workflows/task-atomization.md +537 -0
- package/templates/docs/workflows/task-completion-protocol.md +448 -0
- package/templates/hooks/on-notification.sh +28 -0
- package/templates/schemas/checkpoint.schema.json +97 -0
- package/templates/schemas/code-registry.schema.json +84 -0
- package/templates/schemas/pdr.schema.json +314 -0
- package/templates/schemas/problems.schema.json +55 -0
- package/templates/schemas/tech-analysis.schema.json +404 -0
- package/templates/schemas/telemetry.schema.json +298 -0
- package/templates/schemas/todos.schema.json +234 -0
- package/templates/schemas/workflows.schema.json +69 -0
- package/templates/scripts/add-changelogs.sh +105 -0
- package/templates/scripts/generate-code-registry.ts +270 -0
- package/templates/scripts/health-check.sh +343 -0
- package/templates/scripts/sync-registry.sh +40 -0
- package/templates/scripts/telemetry-report.ts +36 -0
- package/templates/scripts/validate-docs.sh +224 -0
- package/templates/scripts/validate-registry.sh +225 -0
- package/templates/scripts/validate-schemas.ts +283 -0
- package/templates/scripts/validate-structure.sh +165 -0
- package/templates/scripts/worktree-cleanup.sh +81 -0
- package/templates/scripts/worktree-create.sh +63 -0
- package/templates/sessions/planning/.gitkeep +0 -0
- package/templates/sessions/planning/archived/.gitkeep +0 -0
- package/templates/settings.json +202 -0
- package/templates/settings.local.json +138 -0
- package/templates/skills/README.md +197 -0
- package/templates/skills/_registry.json +473 -0
- package/templates/skills/audit/accessibility-audit.md +309 -0
- package/templates/skills/audit/performance-audit.md +257 -0
- package/templates/skills/audit/security-audit.md +217 -0
- package/templates/skills/auth/nextauth-patterns.md +308 -0
- package/templates/skills/brand-guidelines.md +240 -0
- package/templates/skills/documentation/markdown-formatter.md +302 -0
- package/templates/skills/git/git-commit-helper.md +321 -0
- package/templates/skills/i18n/i18n-patterns.md +251 -0
- package/templates/skills/patterns/error-handling-patterns.md +242 -0
- package/templates/skills/patterns/tdd-methodology.md +342 -0
- package/templates/skills/qa/qa-criteria-validator.md +383 -0
- package/templates/skills/qa/web-app-testing.md +398 -0
- package/templates/skills/react/react-hook-form-patterns.md +359 -0
- package/templates/skills/state/redux-toolkit-patterns.md +272 -0
- package/templates/skills/state/tanstack-query-patterns.md +299 -0
- package/templates/skills/state/zustand-patterns.md +301 -0
- package/templates/skills/tech/mermaid-diagram-specialist.md +195 -0
- package/templates/skills/tech/shadcn-specialist.md +252 -0
- package/templates/skills/tech/vercel-specialist.md +297 -0
- package/templates/skills/testing/api-app-testing.md +254 -0
- package/templates/skills/testing/performance-testing.md +275 -0
- package/templates/skills/testing/security-testing.md +348 -0
- package/templates/skills/utils/add-memory.md +295 -0
- package/templates/skills/utils/json-data-auditor.md +283 -0
- package/templates/skills/utils/pdf-creator-editor.md +342 -0
- package/templates/tools/format-markdown.sh +185 -0
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
# Mockup Generation Setup Guide
|
|
2
|
+
|
|
3
|
+
> **Complete guide to setting up AI-powered mockup generation for the the project project**
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This guide walks you through setting up the AI mockup generation system, from creating a Replicate account to configuring your local environment. Follow these steps to start generating UI mockups for your planning sessions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
1. [Prerequisites](#prerequisites)
|
|
14
|
+
2. [Replicate Account Setup](#replicate-account-setup)
|
|
15
|
+
3. [API Token Generation](#api-token-generation)
|
|
16
|
+
4. [Environment Configuration](#environment-configuration)
|
|
17
|
+
5. [Verification](#verification)
|
|
18
|
+
6. [Optional Configuration](#optional-configuration)
|
|
19
|
+
7. [Troubleshooting](#troubleshooting)
|
|
20
|
+
8. [Cost Management](#cost-management)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
Before you begin, ensure you have:
|
|
27
|
+
|
|
28
|
+
- [ ] Node.js 18+ installed
|
|
29
|
+
- [ ] PNPM package manager installed
|
|
30
|
+
- [ ] the project project cloned and dependencies installed
|
|
31
|
+
- [ ] Credit/debit card for Replicate billing (free tier available)
|
|
32
|
+
- [ ] Internet connection for API calls
|
|
33
|
+
|
|
34
|
+
**Check your Node.js version:**
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
node --version
|
|
38
|
+
# Should output v18.x.x or higher
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Check PNPM:**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm --version
|
|
45
|
+
# Should output 8.x.x or higher
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Replicate Account Setup
|
|
51
|
+
|
|
52
|
+
### Step 1: Create Account
|
|
53
|
+
|
|
54
|
+
1. Visit [replicate.com](https://replicate.com)
|
|
55
|
+
2. Click **"Sign Up"** in the top right
|
|
56
|
+
3. Choose sign-up method:
|
|
57
|
+
- **GitHub** (recommended - fastest)
|
|
58
|
+
- **Google**
|
|
59
|
+
- **Email + Password**
|
|
60
|
+
|
|
61
|
+
**Screenshot Reference:**
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
┌─────────────────────────────────────┐
|
|
65
|
+
│ Welcome to Replicate │
|
|
66
|
+
│ │
|
|
67
|
+
│ Sign up with: │
|
|
68
|
+
│ ┌─────────────────────┐ │
|
|
69
|
+
│ │ Continue with GitHub │ │
|
|
70
|
+
│ └─────────────────────┘ │
|
|
71
|
+
│ ┌─────────────────────┐ │
|
|
72
|
+
│ │ Continue with Google │ │
|
|
73
|
+
│ └─────────────────────┘ │
|
|
74
|
+
│ ┌─────────────────────┐ │
|
|
75
|
+
│ │ Sign up with Email │ │
|
|
76
|
+
│ └─────────────────────┘ │
|
|
77
|
+
└─────────────────────────────────────┘
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Step 2: Verify Email
|
|
81
|
+
|
|
82
|
+
If you signed up with email:
|
|
83
|
+
|
|
84
|
+
1. Check your inbox for verification email from Replicate
|
|
85
|
+
2. Click the verification link
|
|
86
|
+
3. You'll be redirected to your Replicate dashboard
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## API Token Generation
|
|
91
|
+
|
|
92
|
+
### Step 1: Navigate to API Tokens
|
|
93
|
+
|
|
94
|
+
1. Log in to your Replicate account
|
|
95
|
+
2. Click your **profile avatar** in the top right
|
|
96
|
+
3. Select **"API Tokens"** from the dropdown menu
|
|
97
|
+
|
|
98
|
+
**Or direct link:** [replicate.com/account/api-tokens](https://replicate.com/account/api-tokens)
|
|
99
|
+
|
|
100
|
+
### Step 2: Generate New Token
|
|
101
|
+
|
|
102
|
+
1. Click **"Create Token"** button
|
|
103
|
+
2. Give your token a descriptive name:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Name: the project Mockup Generation
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
3. Click **"Create"**
|
|
110
|
+
|
|
111
|
+
**Important:** The token will only be shown ONCE. Copy it immediately!
|
|
112
|
+
|
|
113
|
+
### Step 3: Copy Your Token
|
|
114
|
+
|
|
115
|
+
Your token will look like:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
r8_AbCdEfGhIjKlMnOpQrStUvWxYz1234567890
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Token Format:**
|
|
122
|
+
|
|
123
|
+
- Starts with `r8_`
|
|
124
|
+
- Followed by 40 alphanumeric characters
|
|
125
|
+
- Total length: 43 characters
|
|
126
|
+
|
|
127
|
+
⚠️ **Security Warning:**
|
|
128
|
+
|
|
129
|
+
- Never commit your token to git
|
|
130
|
+
- Never share your token publicly
|
|
131
|
+
- Don't include it in screenshots or documentation
|
|
132
|
+
- Treat it like a password
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Environment Configuration
|
|
137
|
+
|
|
138
|
+
### Step 1: Locate .env.local File
|
|
139
|
+
|
|
140
|
+
The the project project uses `.env.local` for local environment variables:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
cd /path/to/project
|
|
144
|
+
ls -la | grep .env
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
You should see:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
.env.local # Your local config (git-ignored)
|
|
151
|
+
.env.example # Example template
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**If .env.local doesn't exist:**
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Copy from example
|
|
158
|
+
cp .env.example .env.local
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Step 2: Add Replicate Token
|
|
162
|
+
|
|
163
|
+
Open `.env.local` in your editor:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Using VS Code
|
|
167
|
+
code .env.local
|
|
168
|
+
|
|
169
|
+
# Or any editor
|
|
170
|
+
nano .env.local
|
|
171
|
+
vim .env.local
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Add your Replicate API token:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# AI Image Generation (Replicate)
|
|
178
|
+
REPLICATE_API_TOKEN=r8_YOUR_ACTUAL_TOKEN_HERE
|
|
179
|
+
|
|
180
|
+
# Optional: Specify model (defaults to flux-schnell)
|
|
181
|
+
# REPLICATE_MODEL=black-forest-labs/flux-schnell
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Example .env.local:**
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Database
|
|
188
|
+
DATABASE_URL=postgresql://user:password@localhost:5432/project
|
|
189
|
+
|
|
190
|
+
# Authentication
|
|
191
|
+
CLERK_SECRET_KEY=sk_test_...
|
|
192
|
+
|
|
193
|
+
# AI Image Generation (Replicate)
|
|
194
|
+
REPLICATE_API_TOKEN=r8_AbCdEfGhIjKlMnOpQrStUvWxYz1234567890
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Step 3: Verify .gitignore
|
|
198
|
+
|
|
199
|
+
Ensure `.env.local` is in `.gitignore` (it should already be there):
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Check if .env.local is ignored
|
|
203
|
+
git check-ignore .env.local
|
|
204
|
+
# Should output: .env.local
|
|
205
|
+
|
|
206
|
+
# If not, add to .gitignore
|
|
207
|
+
echo ".env.local" >> .gitignore
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Verification
|
|
213
|
+
|
|
214
|
+
### Step 1: Run End-to-End Test
|
|
215
|
+
|
|
216
|
+
The project includes a comprehensive E2E test to verify your setup:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# From project root
|
|
220
|
+
pnpm tsx packages/ai-image-generation/examples/e2e-test.ts
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Expected Output:**
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
╔════════════════════════════════════════════════════════════════════╗
|
|
227
|
+
║ MOCKUP GENERATION SYSTEM - E2E TEST ║
|
|
228
|
+
║ ║
|
|
229
|
+
║ This test validates the complete mockup generation workflow ║
|
|
230
|
+
╚════════════════════════════════════════════════════════════════════╝
|
|
231
|
+
|
|
232
|
+
🔍 STEP 1: Validating Environment
|
|
233
|
+
═══════════════════════════════════════════════════════════════════
|
|
234
|
+
|
|
235
|
+
✓ REPLICATE_API_TOKEN found: r8_AbCdEf...
|
|
236
|
+
|
|
237
|
+
🎨 STEP 2: Generating Mockup
|
|
238
|
+
═══════════════════════════════════════════════════════════════════
|
|
239
|
+
|
|
240
|
+
ℹ Prompt: "Modern hotel landing page with hero section, booking form, and room gallery"
|
|
241
|
+
ℹ Filename: "hotel-landing-page.png"
|
|
242
|
+
ℹ Calling Replicate API...
|
|
243
|
+
|
|
244
|
+
✓ Mockup generated successfully!
|
|
245
|
+
ℹ Image path: .claude/sessions/planning/P-005-test/mockups/hotel-landing-page-20251104-143022.png
|
|
246
|
+
ℹ Generation time: 2748ms
|
|
247
|
+
ℹ Model: black-forest-labs/flux-schnell
|
|
248
|
+
ℹ Cost: $0.0030
|
|
249
|
+
|
|
250
|
+
📁 STEP 3: Verifying File Outputs
|
|
251
|
+
═══════════════════════════════════════════════════════════════════
|
|
252
|
+
|
|
253
|
+
✓ Image file exists: ...
|
|
254
|
+
ℹ Image size: 412.34 KB
|
|
255
|
+
|
|
256
|
+
✓ Metadata registry exists: ...
|
|
257
|
+
ℹ Total mockups: 1
|
|
258
|
+
|
|
259
|
+
💰 STEP 4: Verifying Cost Tracking
|
|
260
|
+
═══════════════════════════════════════════════════════════════════
|
|
261
|
+
|
|
262
|
+
✓ Usage tracking file exists
|
|
263
|
+
ℹ Current month: 2025-11
|
|
264
|
+
ℹ Mockup count: 1
|
|
265
|
+
ℹ Total cost: $0.0030
|
|
266
|
+
✓ 49 mockups remaining (1/50 used)
|
|
267
|
+
|
|
268
|
+
📊 FINAL RESULTS
|
|
269
|
+
═══════════════════════════════════════════════════════════════════
|
|
270
|
+
|
|
271
|
+
✓ Environment Configuration
|
|
272
|
+
✓ Mockup Generation
|
|
273
|
+
✓ File Outputs
|
|
274
|
+
✓ Cost Tracking
|
|
275
|
+
|
|
276
|
+
✓ ALL CHECKS PASSED
|
|
277
|
+
The mockup generation system is working correctly!
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Step 2: Check Generated Files
|
|
281
|
+
|
|
282
|
+
Verify the mockup was created:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
# List generated mockups
|
|
286
|
+
ls .claude/sessions/planning/P-005-test/mockups/
|
|
287
|
+
|
|
288
|
+
# Expected output:
|
|
289
|
+
# hotel-landing-page-20251104-143022.png
|
|
290
|
+
# .registry.json
|
|
291
|
+
# README.md
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Step 3: View Mockup
|
|
295
|
+
|
|
296
|
+
Open the generated image to verify quality:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
# macOS
|
|
300
|
+
open .claude/sessions/planning/P-005-test/mockups/hotel-landing-page-*.png
|
|
301
|
+
|
|
302
|
+
# Linux
|
|
303
|
+
xdg-open .claude/sessions/planning/P-005-test/mockups/hotel-landing-page-*.png
|
|
304
|
+
|
|
305
|
+
# Windows (Git Bash)
|
|
306
|
+
start .claude/sessions/planning/P-005-test/mockups/hotel-landing-page-*.png
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
✅ **Setup complete if:**
|
|
310
|
+
|
|
311
|
+
- E2E test passes all 4 checks
|
|
312
|
+
- Mockup image file exists
|
|
313
|
+
- Image opens and looks reasonable
|
|
314
|
+
- Cost tracking file updated
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Optional Configuration
|
|
319
|
+
|
|
320
|
+
### 1. Model Selection
|
|
321
|
+
|
|
322
|
+
Change the AI model used for generation:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# .env.local
|
|
326
|
+
|
|
327
|
+
# Recommended: Fast and cheap (default)
|
|
328
|
+
REPLICATE_MODEL=black-forest-labs/flux-schnell
|
|
329
|
+
|
|
330
|
+
# Alternative: Better quality, slower, more expensive
|
|
331
|
+
REPLICATE_MODEL=black-forest-labs/flux-dev
|
|
332
|
+
|
|
333
|
+
# Pro: Best quality, most expensive
|
|
334
|
+
REPLICATE_MODEL=black-forest-labs/flux-pro
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Model Comparison:**
|
|
338
|
+
|
|
339
|
+
| Model | Speed | Quality | Cost/Image | Use Case |
|
|
340
|
+
|-------|-------|---------|-----------|----------|
|
|
341
|
+
| **flux-schnell** | ⚡⚡⚡ Very Fast | ✨✨ Good | $0.003 | Wireframes, planning mockups |
|
|
342
|
+
| **flux-dev** | ⚡⚡ Medium | ✨✨✨ Excellent | $0.055 | High-fidelity designs |
|
|
343
|
+
| **flux-pro** | ⚡⚡ Medium | ✨✨✨ Excellent | $0.055 | Client presentations |
|
|
344
|
+
|
|
345
|
+
**Recommendation:** Use `flux-schnell` (default) for planning mockups.
|
|
346
|
+
|
|
347
|
+
### 2. Output Path Customization
|
|
348
|
+
|
|
349
|
+
Customize where mockups are saved:
|
|
350
|
+
|
|
351
|
+
```ts
|
|
352
|
+
// packages/ai-image-generation/src/config.ts
|
|
353
|
+
export const loadEnvConfig = (): MockupConfig => ({
|
|
354
|
+
// ...
|
|
355
|
+
outputPath: process.env.MOCKUP_OUTPUT_PATH || '.claude/sessions/planning',
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
Then in `.env.local`:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
MOCKUP_OUTPUT_PATH=/custom/path/to/mockups
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### 3. Retry Configuration
|
|
366
|
+
|
|
367
|
+
Adjust API retry behavior:
|
|
368
|
+
|
|
369
|
+
```ts
|
|
370
|
+
const generator = new MockupGenerator({
|
|
371
|
+
replicateApiToken: config.replicateApiToken,
|
|
372
|
+
maxRetries: 5, // Default: 3, Max: 10
|
|
373
|
+
retryDelay: 2000, // Default: 1000ms
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### 4. Cost Limits
|
|
378
|
+
|
|
379
|
+
The system has built-in cost protection:
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
// Default limits (packages/ai-image-generation/src/utils/cost-tracker.ts)
|
|
383
|
+
const MONTHLY_LIMIT = 50; // mockups per month
|
|
384
|
+
const THRESHOLD_ALERT = 0.8; // 80% usage alert
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
To customize limits, modify in code or wrap with your own logic:
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
const result = await generator.generate({ /* ... */ });
|
|
391
|
+
|
|
392
|
+
// Custom limit check
|
|
393
|
+
const usage = await costTracker.load(sessionPath);
|
|
394
|
+
if (usage.mockupCount >= 30) { // Custom limit: 30
|
|
395
|
+
console.warn('Custom monthly limit reached!');
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Troubleshooting
|
|
403
|
+
|
|
404
|
+
### Issue 1: Token Not Found
|
|
405
|
+
|
|
406
|
+
**Error:**
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
✗ REPLICATE_API_TOKEN not found in environment
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Solutions:**
|
|
413
|
+
|
|
414
|
+
1. **Verify .env.local exists:**
|
|
415
|
+
|
|
416
|
+
```bash
|
|
417
|
+
ls -la .env.local
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
2. **Check token is in .env.local:**
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
grep REPLICATE_API_TOKEN .env.local
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
3. **Verify token format:**
|
|
427
|
+
- Should start with `r8_`
|
|
428
|
+
- Should be 43 characters total
|
|
429
|
+
- No spaces or quotes around the value
|
|
430
|
+
|
|
431
|
+
4. **Restart your terminal/IDE:**
|
|
432
|
+
Environment variables may not reload until restart.
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
### Issue 2: Invalid Token
|
|
437
|
+
|
|
438
|
+
**Error:**
|
|
439
|
+
|
|
440
|
+
```
|
|
441
|
+
status 401: "Invalid API token"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
**Solutions:**
|
|
445
|
+
|
|
446
|
+
1. **Regenerate token:**
|
|
447
|
+
- Go to [replicate.com/account/api-tokens](https://replicate.com/account/api-tokens)
|
|
448
|
+
- Delete old token
|
|
449
|
+
- Create new token
|
|
450
|
+
- Update .env.local
|
|
451
|
+
|
|
452
|
+
2. **Check for extra characters:**
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# Should be exactly 43 characters
|
|
456
|
+
echo -n "$REPLICATE_API_TOKEN" | wc -c
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
3. **Verify no quotes in .env.local:**
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# ✅ Correct
|
|
463
|
+
REPLICATE_API_TOKEN=r8_AbCdEf...
|
|
464
|
+
|
|
465
|
+
# ❌ Incorrect
|
|
466
|
+
REPLICATE_API_TOKEN="r8_AbCdEf..."
|
|
467
|
+
REPLICATE_API_TOKEN='r8_AbCdEf...'
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
### Issue 3: Insufficient Credit
|
|
473
|
+
|
|
474
|
+
**Error:**
|
|
475
|
+
|
|
476
|
+
```
|
|
477
|
+
status 402: "You have insufficient credit to run this model."
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
**Solutions:**
|
|
481
|
+
|
|
482
|
+
1. **Add billing information:**
|
|
483
|
+
- Go to [replicate.com/billing](https://replicate.com/billing)
|
|
484
|
+
- Click **"Add payment method"**
|
|
485
|
+
- Enter credit/debit card details
|
|
486
|
+
- Add initial credit ($5 minimum recommended)
|
|
487
|
+
|
|
488
|
+
2. **Check current balance:**
|
|
489
|
+
- Visit [replicate.com/billing](https://replicate.com/billing)
|
|
490
|
+
- View "Current Balance" and "Usage This Month"
|
|
491
|
+
|
|
492
|
+
3. **Enable auto-recharge (recommended):**
|
|
493
|
+
- In billing settings
|
|
494
|
+
- Set threshold (e.g., $1)
|
|
495
|
+
- Set recharge amount (e.g., $10)
|
|
496
|
+
- Never run out of credit during generation
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
### Issue 4: Network Errors
|
|
501
|
+
|
|
502
|
+
**Error:**
|
|
503
|
+
|
|
504
|
+
```
|
|
505
|
+
ECONNREFUSED, ETIMEDOUT, DNS_ERROR
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
**Solutions:**
|
|
509
|
+
|
|
510
|
+
1. **Check internet connection:**
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
ping replicate.com
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
2. **Verify proxy settings (if applicable):**
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
# Check proxy environment variables
|
|
520
|
+
echo $HTTP_PROXY
|
|
521
|
+
echo $HTTPS_PROXY
|
|
522
|
+
|
|
523
|
+
# If behind corporate proxy, add to .env.local
|
|
524
|
+
HTTP_PROXY=http://proxy.company.com:8080
|
|
525
|
+
HTTPS_PROXY=http://proxy.company.com:8080
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
3. **Check firewall:**
|
|
529
|
+
- Ensure outbound HTTPS (443) is allowed
|
|
530
|
+
- Whitelist `*.replicate.com` if needed
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
### Issue 5: Slow Generation
|
|
535
|
+
|
|
536
|
+
**Problem:** Mockup takes too long to generate (>15 seconds)
|
|
537
|
+
|
|
538
|
+
**Solutions:**
|
|
539
|
+
|
|
540
|
+
1. **Check model:**
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
# flux-schnell is fastest (~2-4s)
|
|
544
|
+
# flux-dev and flux-pro are slower (~8-15s)
|
|
545
|
+
grep REPLICATE_MODEL .env.local
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
2. **Verify Replicate service status:**
|
|
549
|
+
- Visit [status.replicate.com](https://status.replicate.com)
|
|
550
|
+
- Check for ongoing incidents
|
|
551
|
+
|
|
552
|
+
3. **Simplify prompt:**
|
|
553
|
+
- Shorter prompts may generate faster
|
|
554
|
+
- Remove unnecessary details
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
### Issue 6: Poor Mockup Quality
|
|
559
|
+
|
|
560
|
+
**Problem:** Generated mockup doesn't match expectations
|
|
561
|
+
|
|
562
|
+
**Solutions:**
|
|
563
|
+
|
|
564
|
+
1. **Improve your prompt:**
|
|
565
|
+
- Read [Prompt Engineering Guide](./mockup-prompt-engineering.md)
|
|
566
|
+
- Be more specific about layout and elements
|
|
567
|
+
- Add visual style descriptors
|
|
568
|
+
|
|
569
|
+
2. **Try different model:**
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
# Better quality but more expensive
|
|
573
|
+
REPLICATE_MODEL=black-forest-labs/flux-dev
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
3. **Regenerate with refined prompt:**
|
|
577
|
+
- Analyze what's wrong with current mockup
|
|
578
|
+
- Adjust prompt to address specific issues
|
|
579
|
+
- Generate again
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
## Cost Management
|
|
584
|
+
|
|
585
|
+
### Understanding Costs
|
|
586
|
+
|
|
587
|
+
**Per-Image Costs:**
|
|
588
|
+
|
|
589
|
+
- **flux-schnell:** $0.003 per image
|
|
590
|
+
- **flux-dev:** $0.055 per image
|
|
591
|
+
- **flux-pro:** $0.055 per image
|
|
592
|
+
|
|
593
|
+
**Monthly Budget Examples:**
|
|
594
|
+
|
|
595
|
+
- $10/month → ~3,333 mockups (flux-schnell)
|
|
596
|
+
- $10/month → ~181 mockups (flux-dev)
|
|
597
|
+
- $25/month → ~8,333 mockups (flux-schnell)
|
|
598
|
+
|
|
599
|
+
### Built-In Protection
|
|
600
|
+
|
|
601
|
+
The system includes automatic cost protection:
|
|
602
|
+
|
|
603
|
+
**1. Monthly Limit (50 mockups/month default):**
|
|
604
|
+
|
|
605
|
+
```
|
|
606
|
+
✓ 42 mockups remaining (8/50 used)
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
**2. Threshold Alert (80% usage):**
|
|
610
|
+
|
|
611
|
+
```
|
|
612
|
+
⚠ Only 10 mockups remaining before threshold!
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
**3. Hard Limit Enforcement:**
|
|
616
|
+
|
|
617
|
+
```
|
|
618
|
+
✗ Monthly mockup limit (50) reached!
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
### Tracking Usage
|
|
622
|
+
|
|
623
|
+
**Check current usage:**
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
# View usage file
|
|
627
|
+
cat .claude/sessions/planning/P-005/.usage-tracking.json
|
|
628
|
+
|
|
629
|
+
# Example output:
|
|
630
|
+
{
|
|
631
|
+
"currentMonth": "2025-11",
|
|
632
|
+
"mockupCount": 8,
|
|
633
|
+
"totalCost": 0.024,
|
|
634
|
+
"lastReset": "2025-11-01T00:00:00.000Z"
|
|
635
|
+
}
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
**Monthly reset:**
|
|
639
|
+
|
|
640
|
+
- Usage resets automatically on the 1st of each month
|
|
641
|
+
- Old usage is archived for reference
|
|
642
|
+
- Limits restart at 0/50
|
|
643
|
+
|
|
644
|
+
### Best Practices
|
|
645
|
+
|
|
646
|
+
1. **Use flux-schnell for planning:**
|
|
647
|
+
- 18x cheaper than flux-dev/pro
|
|
648
|
+
- Sufficient quality for wireframes
|
|
649
|
+
- Reserve expensive models for final designs
|
|
650
|
+
|
|
651
|
+
2. **Generate selectively:**
|
|
652
|
+
- Don't mockup every screen
|
|
653
|
+
- Focus on complex/novel UI flows
|
|
654
|
+
- Use text wireframes for simple layouts
|
|
655
|
+
|
|
656
|
+
3. **Set billing alerts:**
|
|
657
|
+
- In Replicate dashboard: Settings → Billing
|
|
658
|
+
- Set alert at your monthly budget
|
|
659
|
+
- Get email when approaching limit
|
|
660
|
+
|
|
661
|
+
4. **Review usage regularly:**
|
|
662
|
+
|
|
663
|
+
```bash
|
|
664
|
+
# Quick usage check
|
|
665
|
+
pnpm tsx packages/ai-image-generation/examples/cost-tracker-usage.ts
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
---
|
|
669
|
+
|
|
670
|
+
## Next Steps
|
|
671
|
+
|
|
672
|
+
Now that your environment is set up:
|
|
673
|
+
|
|
674
|
+
1. **Read the Prompt Engineering Guide:**
|
|
675
|
+
- [Mockup Prompt Engineering Guide](./mockup-prompt-engineering.md)
|
|
676
|
+
- Learn to craft effective prompts
|
|
677
|
+
- Study good/bad examples
|
|
678
|
+
|
|
679
|
+
2. **Try generating mockups:**
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
# Interactive example
|
|
683
|
+
pnpm tsx packages/ai-image-generation/examples/basic-usage.ts
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
3. **Integrate in planning:**
|
|
687
|
+
- Use MockupGenerator in PDR creation
|
|
688
|
+
- See [UX/UI Designer Agent](../../agents/design/ux-ui-designer.md)
|
|
689
|
+
|
|
690
|
+
4. **Explore advanced features:**
|
|
691
|
+
- Custom presets
|
|
692
|
+
- Batch generation
|
|
693
|
+
- Metadata querying
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
## Additional Resources
|
|
698
|
+
|
|
699
|
+
**Documentation:**
|
|
700
|
+
|
|
701
|
+
- [AI Image Generation Package README](../../../packages/ai-image-generation/README.md)
|
|
702
|
+
- [UX/UI Designer Agent](../../agents/design/ux-ui-designer.md)
|
|
703
|
+
- [Prompt Engineering Guide](./mockup-prompt-engineering.md)
|
|
704
|
+
|
|
705
|
+
**Replicate Resources:**
|
|
706
|
+
|
|
707
|
+
- [Replicate Documentation](https://replicate.com/docs)
|
|
708
|
+
- [FLUX Models](https://replicate.com/collections/flux)
|
|
709
|
+
- [API Reference](https://replicate.com/docs/reference/http)
|
|
710
|
+
|
|
711
|
+
**Example Code:**
|
|
712
|
+
|
|
713
|
+
- `packages/ai-image-generation/examples/` - Working examples
|
|
714
|
+
- `packages/ai-image-generation/test/` - Test cases showing usage patterns
|
|
715
|
+
|
|
716
|
+
---
|
|
717
|
+
|
|
718
|
+
## Support
|
|
719
|
+
|
|
720
|
+
**Issues with setup?**
|
|
721
|
+
|
|
722
|
+
1. Check [Troubleshooting](#troubleshooting) section above
|
|
723
|
+
2. Review [E2E test output](#step-1-run-end-to-end-test) for specific errors
|
|
724
|
+
3. Consult [Replicate documentation](https://replicate.com/docs)
|
|
725
|
+
4. Check the project project issues on GitHub
|
|
726
|
+
|
|
727
|
+
**Security concerns?**
|
|
728
|
+
|
|
729
|
+
- Never commit `.env.local` to git
|
|
730
|
+
- Rotate tokens if accidentally exposed
|
|
731
|
+
- Report security issues privately
|
|
732
|
+
|
|
733
|
+
---
|
|
734
|
+
|
|
735
|
+
**Last Updated:** 2025-11-04
|
|
736
|
+
**Version:** 1.0.0
|
|
737
|
+
**Related:** P-005, PF-005-19
|