mycontext-cli 2.0.37 → 3.0.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.
Files changed (50) hide show
  1. package/README.md +53 -266
  2. package/dist/cli.js +15 -202
  3. package/dist/cli.js.map +1 -1
  4. package/dist/clients/XAIClient.d.ts.map +1 -1
  5. package/dist/clients/XAIClient.js +6 -2
  6. package/dist/clients/XAIClient.js.map +1 -1
  7. package/dist/commands/analyze-screenshot.d.ts +8 -0
  8. package/dist/commands/analyze-screenshot.d.ts.map +1 -0
  9. package/dist/commands/analyze-screenshot.js +101 -0
  10. package/dist/commands/analyze-screenshot.js.map +1 -0
  11. package/dist/commands/analyze.d.ts +5 -0
  12. package/dist/commands/analyze.d.ts.map +1 -1
  13. package/dist/commands/analyze.js +59 -0
  14. package/dist/commands/analyze.js.map +1 -1
  15. package/dist/commands/generate-actions.d.ts +23 -0
  16. package/dist/commands/generate-actions.d.ts.map +1 -0
  17. package/dist/commands/generate-actions.js +342 -0
  18. package/dist/commands/generate-actions.js.map +1 -0
  19. package/dist/commands/generate-components-manifest.d.ts +25 -0
  20. package/dist/commands/generate-components-manifest.d.ts.map +1 -0
  21. package/dist/commands/generate-components-manifest.js +288 -0
  22. package/dist/commands/generate-components-manifest.js.map +1 -0
  23. package/dist/commands/generate-screens-list.d.ts +23 -0
  24. package/dist/commands/generate-screens-list.d.ts.map +1 -0
  25. package/dist/commands/generate-screens-list.js +282 -0
  26. package/dist/commands/generate-screens-list.js.map +1 -0
  27. package/dist/commands/generate.d.ts.map +1 -1
  28. package/dist/commands/generate.js +5 -1
  29. package/dist/commands/generate.js.map +1 -1
  30. package/dist/commands/init.d.ts.map +1 -1
  31. package/dist/commands/init.js +26 -70
  32. package/dist/commands/init.js.map +1 -1
  33. package/dist/package.json +4 -2
  34. package/dist/services/gemini-vision.d.ts +57 -0
  35. package/dist/services/gemini-vision.d.ts.map +1 -0
  36. package/dist/services/gemini-vision.js +282 -0
  37. package/dist/services/gemini-vision.js.map +1 -0
  38. package/dist/utils/geminiClient.d.ts +21 -24
  39. package/dist/utils/geminiClient.d.ts.map +1 -1
  40. package/dist/utils/geminiClient.js +213 -159
  41. package/dist/utils/geminiClient.js.map +1 -1
  42. package/dist/utils/hybridAIClient.d.ts +1 -1
  43. package/dist/utils/hybridAIClient.d.ts.map +1 -1
  44. package/dist/utils/hybridAIClient.js +40 -23
  45. package/dist/utils/hybridAIClient.js.map +1 -1
  46. package/dist/utils/visionUtils.d.ts +19 -0
  47. package/dist/utils/visionUtils.d.ts.map +1 -0
  48. package/dist/utils/visionUtils.js +86 -0
  49. package/dist/utils/visionUtils.js.map +1 -0
  50. package/package.json +4 -2
package/README.md CHANGED
@@ -12,302 +12,89 @@
12
12
 
13
13
  **The missing piece:** Start with an idea, get comprehensive specs + visual screens, then let AI tools build your app.
14
14
 
15
- **What makes us different:**
16
- - 🎯 **Context-First**: Only tool that generates PRD/brand/flows/types BEFORE design
17
- - 🏠 **Local-First**: Everything runs on your machine, you own the data
18
- - 🔄 **Full Workflow**: Idea → Context → Screens → Code in ONE tool
19
- - 📋 **Spec-Driven**: Comprehensive specifications drive both design AND development
20
- - 🤝 **Tool-Agnostic**: Use with Stitch, v0, Claude Code, Cursor - or ANY AI tool
15
+ ## 🚀 Two Paths to Code
21
16
 
22
- ## 🚀 Quick Start Complete Workflow
23
-
24
- ### The Complete Workflow: Idea → Screens → Code
17
+ ### Path 1: Screenshot Spec (🔥 NEW)
18
+ *Best for reverse-engineering designs or cloning styles.*
25
19
 
26
20
  ```bash
27
- # 1. Install globally
28
- npm install -g mycontext-cli
29
-
30
- # 2. Initialize project with your idea
31
- mycontext init my-saas-app --description "B2B project management tool"
32
- cd my-saas-app
33
-
34
- # 3. Configure AI provider (Gemini free tier recommended!)
35
- echo 'GEMINI_API_KEY=your-key' > .mycontext/.env
36
- # Get free key: https://aistudio.google.com/apikey
37
-
38
- # 4. Generate comprehensive context (PRD, brand, flows, types)
39
- mycontext generate context --full
40
-
41
- # 5. Generate realistic sample data for screens
42
- mycontext generate:sample-data --count 20
43
-
44
- # 6. Generate visual screens (HTML + screenshots)
45
- mycontext generate:screens --all
21
+ # 1. Initialize project (with interactive setup)
22
+ mycontext init my-app --yes
46
23
 
47
- # 7. Review screens in browser (auto-opens)
48
- # Screens saved to .mycontext/screens/
24
+ # 2. Analyze Screenshot (Powered by Gemini 2.0 Flash)
25
+ mycontext analyze mockup.png
26
+ # → Generates .mycontext/context.md
27
+ # → Extracts Design System (colors, fonts, spacing)
28
+ # → Identifies components & layout
49
29
 
50
- # 8A. Export for design tools (optional)
51
- mycontext generate:design-prompt --format stitch
52
-
53
- # 8B. OR use screens as reference and code with Claude/Cursor
54
- # All context files in .mycontext/ are ready for AI coding tools
30
+ # 3. Code (with full context)
31
+ pnpm dev
55
32
  ```
56
33
 
57
- ### For Existing Projects
34
+ ### Path 2: Idea → Full Context
35
+ *Best for new projects from scratch.*
58
36
 
59
37
  ```bash
60
- # Analyze existing project and generate full context
61
- mycontext analyze --generate-context --include-brand
38
+ # 1. Initialize with description
39
+ mycontext init my-saas-app --description "AI-powered code review SaaS"
62
40
 
63
- # Generate sample data from your existing types/schema
64
- mycontext generate:sample-data
41
+ # 2. Generate Full Context (PRD, Features, Flows, Specs)
42
+ mycontext generate context --full
65
43
 
66
- # Generate screens for specific pages
67
- mycontext generate:screens login
68
- mycontext generate:screens dashboard
44
+ # 3. Generate UI Artifacts
45
+ mycontext generate:screens-list # Extract screens from flows
46
+ mycontext generate:sample-data # Generate realistic test data
47
+ mycontext generate:components-manifest # Component specs with props
48
+ mycontext generate:actions # Backend connection hooks
69
49
 
70
- # Or generate all screens at once
71
- mycontext generate:screens --all
50
+ # 4. Use context with Claude/Cursor
51
+ # All files in .mycontext/ are ready for AI coding tools
72
52
  ```
73
53
 
74
- ## ✨ What You Get
75
-
76
- ### 📋 **1. Comprehensive Context Files**
77
-
78
- - **PRD (Product Requirements Document)** - Complete product specification
79
- - **Brand Guidelines** - Colors, typography, design system, tone
80
- - **User Flows** - Step-by-step user journeys
81
- - **Features & User Actions** - Detailed feature documentation
82
- - **Technical Specs** - Constraints and requirements
83
- - **Edge Cases** - Error states and edge scenarios
84
- - **Types & Schema** - TypeScript interfaces and database schema
85
-
86
- ### 🎨 **2. Visual Screens (NEW!)**
87
-
88
- - **HTML Screens** - Production-ready HTML with inline CSS
89
- - **Screenshots** - PNG previews for each screen
90
- - **Realistic Data** - Screens populated with AI-generated sample data
91
- - **Context-Aware** - Screens match your brand, flows, and features
92
- - **Browser Preview** - Auto-opens for instant review
93
-
94
- ### 📦 **3. Sample Data**
95
-
96
- - **AI-Generated** - Realistic users, content based on your types
97
- - **Type-Safe** - Matches your schema and TypeScript definitions
98
- - **Contextual** - Relevant to your project domain
99
- - **Customizable** - Generate as many items as you need
54
+ ## ✨ Key Features
100
55
 
101
- ### 🚀 **4. Export Options**
56
+ ### 📋 **1. Comprehensive Context Generation**
57
+ - **PRD**: Complete product specification
58
+ - **Brand System**: Colors, typography, tokens
59
+ - **User Flows**: Step-by-step journeys
60
+ - **Technical Specs**: Constraints & requirements
61
+ - **Types & Schema**: TypeScript/Database definitions
102
62
 
103
- - **Design Prompts** - Optimized for Stitch, v0, and other AI design tools
104
- - **Screen References** - Use generated screens as visual references
105
- - **Context Packs** - Complete `.mycontext/` directory for Claude Code/Cursor
106
- - **Figma Export** (coming soon) - Import screens directly into Figma
63
+ ### 🎨 **2. Visual Screens (Gemini Vision)**
64
+ - **HTML Screens**: Production-ready HTML/Tailwind
65
+ - **Screenshots**: High-res PNG previews
66
+ - **Realistic Data**: Context-aware sample content
67
+ - **Browser Preview**: Instant visual validation
107
68
 
108
- ### 💡 **The Complete Workflow**
69
+ ### 📦 **3. Export & Integrate**
70
+ - **Claude Code / Cursor**: Optimized context packs
71
+ - **Stitch / v0**: Dedicated design prompts
72
+ - **Figma**: (Coming soon) Direct export
109
73
 
110
- 1. **Generate Context** `mycontext generate context --full` (PRD, brand, flows, types)
111
- 2. **Generate Sample Data** → `mycontext generate:sample-data` (realistic test data)
112
- 3. **Generate Screens** → `mycontext generate:screens --all` (visual HTML screens)
113
- 4. **Review & Refine** → View screens in browser, iterate if needed
114
- 5. **Code with AI** → Use `.mycontext/` files + screens with Claude Code/Cursor
115
- 6. **Ship** → Production-ready app with consistent design
74
+ ## 🤖 AI Provider Setup
116
75
 
117
- <!-- ## 🎨 MyContext Studio - Coming Soon
118
-
119
- **Bundled component preview and prototyping tool included with every project!**
120
-
121
- - **Live Preview** - See components in real-time as you generate them
122
- - **Responsive Testing** - Mobile, tablet, and desktop previews
123
- - **Component Library** - Browse, search, and manage generated components
124
- - **Copy & Export** - One-click code copying and component export
125
- - **Real-time Updates** - Components auto-appear when generated by CLI
126
-
127
- ```bash
128
- # Start Studio preview
129
- pnpm studio:dev
130
- # Opens at http://localhost:3001
131
-
132
- # Studio automatically watches for new components
133
- mycontext generate:components
134
- # Components instantly appear in Studio!
135
- ``` -->
136
-
137
- ## 🎯 Why MyContext CLI?
138
-
139
- **The Problem:** AI tools are powerful but need context. Without comprehensive specs, you get:
140
- - ❌ Inconsistent designs across screens
141
- - ❌ Missing edge cases and error states
142
- - ❌ Incomplete requirements
143
- - ❌ Prompt fatigue from writing the same context repeatedly
144
-
145
- **The Solution:** MyContext CLI generates comprehensive specifications FIRST, then uses them to:
146
- 1. Generate context-aware visual screens (HTML/PNG)
147
- 2. Create optimized prompts for AI design tools (Stitch, v0)
148
- 3. Provide complete context for AI coding tools (Claude Code, Cursor)
149
-
150
- **The Result:**
151
- - ✅ Comprehensive specs drive everything (PRD, brand, flows, types)
152
- - ✅ Visual screens with realistic data for stakeholder review
153
- - ✅ Better outputs from AI tools (they have full context)
154
- - ✅ Consistent design and code across your app
155
- - ✅ Full local workflow, you own everything
156
-
157
- **We're building the missing context layer that makes ALL AI development tools work better.**
158
-
159
- ## 💰 Pricing
160
-
161
- - **MyContext CLI** - Free and open source (MIT License)
162
-
163
- Use the CLI with your own AI provider keys (Claude, OpenAI, XAI) for free.
164
-
165
- ## 📚 Full Documentation
166
-
167
- **Complete guides, tutorials, and API reference available on GitHub:**
168
-
169
- 👉 **[View Full Documentation](https://github.com/farajabien/mycontext-cli/tree/main/docs)**
170
-
171
- - [Getting Started Guide](https://github.com/farajabien/mycontext-cli/blob/main/docs/01-getting-started/quick-start.md)
172
- - [AI Agents System](https://github.com/farajabien/mycontext-cli/blob/main/docs/02-core-features/ai-agents.md)
173
- - [Intent Dictionary](https://github.com/farajabien/mycontext-cli/blob/main/docs/02-core-features/intent-dictionary-system.md)
174
- - [Command Reference](https://github.com/farajabien/mycontext-cli/blob/main/docs/03-reference/commands.md)
175
- - [Architecture](https://github.com/farajabien/mycontext-cli/blob/main/docs/06-architecture/system-overview.md)
176
-
177
- ## 🎯 Key Features
178
-
179
- ### **Context Generation**
180
- - **Comprehensive PRD** - Product requirements from your project analysis
181
- - **Brand Guidelines** - Colors, typography, design tokens, tone of voice
182
- - **User Flows** - Complete user journeys and interactions
183
- - **Feature Documentation** - Detailed feature specifications
184
- - **Technical Constraints** - What's possible, what's not
185
-
186
- ### **Design Prompt Optimization**
187
- - **Stitch-Optimized** - Format specifically tuned for Google Stitch
188
- - **General Format** - Works with v0, Framer AI, and other design tools
189
- - **API Format** - JSON output for programmatic integration
190
- - **Smart Concatenation** - Combines all context into one powerful prompt
191
-
192
- ### **Project Analysis**
193
- - **Existing Project Support** - Analyze and extract context from any project
194
- - **Gap Detection** - Identifies missing information
195
- - **Auto-Generation** - Fills in gaps with intelligent defaults
196
-
197
- ## 🤖 AI Provider Setup (Required)
198
-
199
- **MyContext supports multiple AI providers.** Choose based on your needs:
200
-
201
- ### 🎯 Recommended: Gemini (Free + Visual Generation)
76
+ **MyContext works best with Gemini (Free Tier + Vision).**
202
77
 
203
78
  ```bash
204
79
  # 1. Get free API key: https://aistudio.google.com/apikey
205
- # 2. Add to your project:
80
+ # 2. Configure project
206
81
  echo 'GEMINI_API_KEY=your-key' > .mycontext/.env
207
- # 3. Start generating!
208
- mycontext generate context --full
209
- mycontext generate:screens --all
210
82
  ```
211
83
 
212
- **Why Gemini?**
213
- - ✅ **FREE with generous limits**
214
- - ✅ Multimodal support (text + visual generation)
215
- - ✅ Fast and high-quality outputs
216
- - ✅ **Perfect for screen generation** with nanobanana-style HTML output
217
- - ✅ No credit card required
218
-
219
- ### Alternative Providers
220
-
221
- **OpenRouter (Free Tier, DeepSeek R1)**
222
-
223
- ```bash
224
- # Get free API key: https://openrouter.ai/keys
225
- echo 'MYCONTEXT_OPENROUTER_API_KEY=sk-or-xxx' > .mycontext/.env
226
- ```
84
+ *Also supports: Anthropic (Claude), OpenRouter (DeepSeek), xAI (Grok)*
227
85
 
228
- - Free tier with generous limits
229
- - ✅ DeepSeek R1 (powerful reasoning)
230
- - ✅ No credit card required
86
+ ## 📚 Documentation
231
87
 
232
- **Claude (Best Quality)**
233
-
234
- ```bash
235
- # Get key: https://console.anthropic.com/
236
- echo 'ANTHROPIC_API_KEY=sk-ant-xxx' > .mycontext/.env
237
- ```
238
-
239
- - ✅ Highest quality results
240
- - ⚠️ Paid only
241
-
242
- **XAI/Grok**
243
-
244
- ```bash
245
- # Get key: https://console.x.ai/
246
- echo 'XAI_API_KEY=xai-xxx' > .mycontext/.env
247
- ```
248
-
249
- - ✅ Good for creative outputs
250
- - ⚠️ Paid only
251
-
252
- **Provider Priority:** Claude → OpenRouter → Gemini → XAI (automatic fallback)
88
+ Detailed guides available in the [`docs/`](docs/) directory:
89
+ - [Getting Started](docs/01-getting-started/quick-start.md)
90
+ - [Core Features](docs/02-core-features/ai-agents.md)
91
+ - [Command Reference](docs/03-reference/commands.md)
92
+ - [Architecture](docs/06-architecture/system-overview.md)
253
93
 
254
94
  ## 🤝 Contributing
255
95
 
256
- Contributions welcome! See our [Contributing Guide](https://github.com/farajabien/mycontext-cli/blob/main/CONTRIBUTING.md).
96
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
257
97
 
258
98
  ## 📄 License
259
99
 
260
- MIT © MyContext - See [LICENSE](https://github.com/farajabien/mycontext-cli/blob/main/LICENSE) for details.
261
-
262
- ---
263
-
264
- ## 🔄 The Complete Workflow
265
-
266
- ```
267
- ┌─────────────────────────────────────┐
268
- │ 1. Start with Idea │
269
- │ mycontext init my-app │
270
- └──────────────┬──────────────────────┘
271
-
272
-
273
- ┌─────────────────────────────────────┐
274
- │ 2. Generate Context Files │
275
- │ mycontext generate context --full │
276
- │ PRD • Brand • Flows • Types │
277
- └──────────────┬──────────────────────┘
278
-
279
-
280
- ┌─────────────────────────────────────┐
281
- │ 3. Generate Sample Data │
282
- │ mycontext generate:sample-data │
283
- │ Realistic test data │
284
- └──────────────┬──────────────────────┘
285
-
286
-
287
- ┌─────────────────────────────────────┐
288
- │ 4. Generate Visual Screens │
289
- │ mycontext generate:screens --all │
290
- │ HTML + PNG previews │
291
- └──────────────┬──────────────────────┘
292
-
293
- ┌──────────────┴──────────────┐
294
- │ │
295
- ▼ ▼
296
- ┌───────────────────────────┐ ┌──────────────────────────┐
297
- │ 5A. Use with AI Tools │ │ 5B. Code Directly │
298
- │ Stitch • v0 • Designers │ │ Claude Code • Cursor │
299
- │ (design-prompt.txt) │ │ (.mycontext/ + screens) │
300
- └───────────────┬───────────┘ └──────────┬───────────────┘
301
- │ │
302
- └───────────┬───────────────┘
303
-
304
-
305
- ┌─────────────────────────────────────┐
306
- │ 6. Ship Production App │
307
- │ Complete • Consistent • Quality │
308
- └─────────────────────────────────────┘
309
- ```
310
-
311
- **Spec-driven development for the AI era. Your code, your data, your machine.** 🚀
312
-
313
- [Full Documentation](https://github.com/farajabien/mycontext-cli/tree/main/docs) • [GitHub](https://github.com/farajabien/mycontext-cli) • [Issues](https://github.com/farajabien/mycontext-cli/issues)
100
+ MIT © MyContext - See [LICENSE](LICENSE) for details.