mycontext-cli 0.4.10 → 0.4.12

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/README.md CHANGED
@@ -15,10 +15,10 @@ mycontext init my-app --description "Your project description"
15
15
  cd my-app
16
16
 
17
17
  # Generate context and components
18
- mycontext generate context
19
- mycontext generate types
20
- mycontext generate brand
21
- mycontext generate components-list
18
+ mycontext generate context # → 01-prd.md, 01a-brief.md, 01b-requirements.md, 01c-flows.md
19
+ mycontext generate types # → types/ folder with complete type system (index.ts, database.ts, enums.ts, ui.ts, utils.ts)
20
+ mycontext generate brand # → brand/ folder with CSS custom properties (globals.css, colors.md, typography.md)
21
+ mycontext generate components-list # → 04-component-list.json
22
22
  mycontext generate-components all --local --with-tests
23
23
  ```
24
24
 
@@ -28,19 +28,27 @@ mycontext generate-components all --local --with-tests
28
28
 
29
29
  ```bash
30
30
  mycontext generate context # PRD, user stories, technical specs
31
- mycontext generate types # TypeScript interfaces
32
- mycontext generate brand # Design system and branding
31
+ mycontext generate types # Complete TypeScript type system (5 files)
32
+ mycontext generate brand # Design system with CSS custom properties
33
33
  mycontext generate components-list # Component planning
34
34
  ```
35
35
 
36
- ### 2. Component Generation
36
+ ### 2. Core Component (Design Anchor)
37
+
38
+ ```bash
39
+ mycontext core generate # Generate BrandComp (design anchor)
40
+ mycontext core refine # Refine as needed
41
+ mycontext core ready # Mark ready for component generation
42
+ ```
43
+
44
+ ### 3. Component Generation
37
45
 
38
46
  ```bash
39
47
  mycontext generate-components all --local --with-tests # Generate all components
40
48
  mycontext generate-components <group> --local # Generate specific group
41
49
  ```
42
50
 
43
- ### 3. Preview & Iterate
51
+ ### 4. Preview & Iterate
44
52
 
45
53
  ```bash
46
54
  mycontext preview components # Preview generated components
@@ -68,11 +76,22 @@ mycontext model test # Test generation
68
76
 
69
77
  ## 📦 What You Get
70
78
 
71
- - **`.mycontext/prd.md`** — Product Requirements Document
72
- - **`.mycontext/types.ts`** — TypeScript type definitions
73
- - **`.mycontext/branding.md`** — Design system specifications
74
- - **`.mycontext/component-list.json`** — Component architecture plan
75
- - **`components/.mycontext/`** — Generated React components with shadcn/ui
79
+ - **`.mycontext/01-prd.md`** — Product Requirements Document
80
+ - **`.mycontext/01a-brief.md`** — Project brief summary
81
+ - **`.mycontext/01b-requirements.md`** — Detailed requirements
82
+ - **`.mycontext/01c-flows.md`** — User flows & interactions
83
+ - **`.mycontext/types/`** — Complete TypeScript type system (5 files)
84
+ - `index.ts` — Main type exports
85
+ - `database.ts` — Database schema types
86
+ - `enums.ts` — Enum constants & type guards
87
+ - `ui.ts` — UI component types
88
+ - `utils.ts` — Utility types & helpers
89
+ - **`.mycontext/brand/`** — Complete design system
90
+ - `globals.css` — CSS custom properties
91
+ - `colors.md` — Color palette documentation
92
+ - `typography.md` — Typography specifications
93
+ - **`.mycontext/04-component-list.json`** — Component architecture plan
94
+ - **`components/`** — Generated React components with shadcn/ui
76
95
 
77
96
  ## Environment Setup
78
97
 
@@ -93,173 +112,46 @@ ollama pull llama3.2:3b
93
112
  mycontext model status
94
113
  ```
95
114
 
96
- ## Key Features
97
-
98
- - **Context-Aware Generation**: Components that match your existing codebase patterns
99
- - **Brand Consistency**: Automatic adherence to your design system
100
- - **Type Safety**: Full TypeScript integration with generated interfaces
101
- - **Production Ready**: Includes tests, documentation, and best practices
102
- - **Local AI Support**: Ollama fallback for unlimited generation without API costs
103
-
104
- ## Support
105
-
106
- - **GitHub Issues**: Report bugs and request features
107
- - **Documentation**: Full CLI reference and guides
108
- - **Community**: Share components and patterns
109
-
110
- ---
111
-
112
- **Built for developers who want AI that understands their project context.**
113
-
114
- # Core Component (Brand Anchor)
115
-
116
- mycontext core generate [name] [--group core] # Generate BrandComp
117
- mycontext core refine [--desc "improvements"] # Record refinements
118
- mycontext core ready # Mark ready for use
119
- mycontext core status # Check core status
115
+ ## 🎯 **Integration Guide**
120
116
 
121
- # Component Generation
122
-
123
- mycontext generate-components all [--local] [--with-tests] [--check]
124
- mycontext generate-components <group> [--local] # Single group
125
- mycontext generate-components all --core-first # Core only, then stop
126
-
127
- ````
128
-
129
- ### **AI Enhancement Commands**
117
+ ### Using Generated Types
130
118
 
131
119
  ```bash
132
- # Component Enhancement & Refinement
133
- mycontext enhance <component.tsx> [--prompt "improvements"]
134
- mycontext enhance <group-name> [--interactive] # Group enhancement
135
- mycontext refine <component.tsx> [--prompt "changes"] # Focused refinement
136
- mycontext refine <component.tsx> --rollback # Rollback changes
137
-
138
- # Enhancement Options
139
- --output-format <format> # structured, diff, preview, apply
140
- --show-changes # Show detailed change breakdown
141
- --preserve-history # Keep refinement history
142
- --interactive # VS Code extension mode
143
- ````
120
+ # Move the types folder to your lib directory
121
+ mv .mycontext/types ./lib/
144
122
 
145
- ### **Project Management**
146
-
147
- ```bash
148
- # Status & Information
149
- mycontext status [--detailed] [--check-health] # Project status
150
- mycontext list [type] [--format table|json] [--local] # List resources
151
- mycontext preview <type> [--port 3000] # Preview components
152
-
153
- # List Types: components, projects, files, all
154
- # Preview Types: brand, components, generated, <group-name>
155
-
156
- # Authentication
157
- mycontext auth [--email] [--code] [--non-interactive] # Magic code auth
158
- mycontext auth:status # Check auth status
159
- mycontext auth:logout # Logout
123
+ # Import types in your components
124
+ import type { User, ApiResponse } from "@/lib/types";
125
+ import { USER_ROLES } from "@/lib/types/enums";
160
126
  ```
161
127
 
162
- ### **Model & AI Management**
128
+ ### Using Generated Brand System
163
129
 
164
130
  ```bash
165
- # Local Model Management
166
- mycontext model status [--detailed] # Model health check
167
- mycontext model list # Available models
168
- mycontext model test [--prompt "text"] [--verbose] # Test generation
169
- mycontext model update [--backup] # Update model
170
- mycontext model reset [--force] # Reset to clean state
171
- mycontext model stats [--detailed] [--last 30d] # Usage statistics
172
- ```
131
+ # Copy the CSS to your globals.css
132
+ cp .mycontext/brand/globals.css ./src/app/globals.css
173
133
 
174
- ### **🧠 Enhanced Intelligence Commands**
175
-
176
- ```bash
177
- # Predictive Development (Production Ready)
178
- mycontext predict next # Predict next development steps
179
- mycontext predict dependencies # Suggest optimal packages and tools
180
- mycontext predict patterns # Identify architectural patterns
181
- mycontext predict issues # Forecast potential problems
182
- mycontext predict optimization # Recommend performance improvements
183
-
184
- # Agent Communication & Auto-Generation
185
- mycontext agent-flow generate-context # Multi-agent context generation
186
- mycontext agent-flow validate-workflow # Test agent communication system
187
- mycontext clean # Auto-fix malformed files and issues
188
-
189
- # Intelligence Options
190
- --detailed # Show comprehensive analysis
191
- --format json|table # Output format
192
- --scope next|dependencies|patterns|issues|optimization # Prediction scope
134
+ # Use the design tokens
135
+ <div className="bg-primary text-primary-foreground p-4 rounded-lg">
136
+ Hello World
137
+ </div>
193
138
  ```
194
139
 
195
- ### **Utilities & Maintenance**
196
-
197
- ```bash
198
- # Utilities
199
- mycontext normalize preview # Build preview layout
200
- mycontext update # Update CLI
201
- mycontext help # Detailed help
202
-
203
- # Global Options
204
- --verbose # Detailed output
205
- --yes # Skip prompts (non-interactive)
206
- --project <name> # Specify project
207
- --model <name> # Override model
208
- --models <list> # Fallback models (comma-separated)
209
- ```
210
-
211
- ### **Key Options & Behavior**
212
-
213
- - `--description`, `--context-file`: Supply input context for generation
214
- - `--model`, `--models`/`--use-models`: Model override and fallback candidates
215
- - `--local`: Generate components without auth; remote storage skipped silently
216
- - `--with-tests`: Scaffold Jest + RTL and generate per-component tests
217
- - `--check`: Run typecheck, lint, and tests after generation
218
- - `--core-first`: Generate only core BrandComp, then exit
219
- - `--interactive`: VS Code extension mode with structured output
220
- - `--preserve-history`: Keep enhancement/refinement history for rollback
221
-
222
- ### **Important Behaviors**
223
-
224
- - Component list saves to `.mycontext/component-list.json` and merges by name when re-generated
225
- - Post-generation scan installs missing `@/components/ui/*` shadcn primitives automatically
226
- - Neutral fallback: if AI times out, valid skeleton written for manual editing
227
- - Core-first workflow: components-list generation prompts for core selection
228
-
229
- ## 🛠 Environment & Configuration
230
-
231
- ### **Authentication & Models**
232
-
233
- ```bash
234
- # GitHub Models (optional - provides faster generation when available)
235
- MYCONTEXT_GITHUB_TOKEN=ghp_xxx # Set in .mycontext/.env for faster generation
236
-
237
- # Ollama (automatic fallback - works without API keys)
238
- # Install Ollama locally for unlimited component generation
239
- # No API keys required - works offline when GitHub Models is rate-limited
140
+ ## Key Features
240
141
 
241
- # Alternative providers (optional)
242
- HUGGINGFACE_API_KEY=hf_xxx # Hugging Face fallback
243
- XAI_API_KEY=xai_xxx # X.AI (Grok) fallback
244
- ```
142
+ - **Context-Aware Generation**: Components that match your existing codebase patterns
143
+ - **Brand Consistency**: Complete design system with CSS custom properties
144
+ - **Type Safety**: Comprehensive TypeScript type system (5 specialized files)
145
+ - **Production Ready**: Includes tests, documentation, and best practices
146
+ - **Local AI Support**: Ollama fallback for unlimited generation without API costs
147
+ - **Design System**: Ready-to-use brand system with complete CSS custom properties
245
148
 
246
- ### **Model Configuration**
149
+ ## Support
247
150
 
248
- ```bash
249
- # Model selection
250
- MYCONTEXT_MODEL=deepseek/DeepSeek-V3-0324 # Override default model
251
- MYCONTEXT_MODEL_CANDIDATES=gpt-4o,claude-3-5 # Fallback list
252
- MYCONTEXT_PROVIDER=github # Force provider
253
-
254
- # Rate limiting & retries
255
- MYCONTEXT_GITHUB_RETRIES=3 # Retry attempts
256
- MYCONTEXT_MODEL_PASSES=2 # Model fallback passes
257
- MYCONTEXT_MODEL_COOLDOWN_SECONDS=30 # Cooldown between retries
258
- ```
151
+ - **GitHub Issues**: Report bugs and request features
152
+ - **Documentation**: Full CLI reference and guides
153
+ - **Community**: Share components and patterns
259
154
 
260
- ### **Setup Notes**
155
+ ---
261
156
 
262
- - Init creates `.mycontext/.env.example` with suggested environment variables
263
- - Standardized naming ensures clean imports and shadcn/ui compatibility
264
- - Components generated in `components/.mycontext/` to avoid overriding user code
265
- - Preview system auto-updates with live component registry
157
+ **Built for developers who want AI that understands their project context.**
@@ -18,6 +18,12 @@ export declare class GenerateCommand {
18
18
  private resolveInputContext;
19
19
  generateContext(projectContext: any, options: GenerateOptions): Promise<GenerationResult>;
20
20
  generateTypes(projectContext: any, options: GenerateOptions): Promise<GenerationResult>;
21
+ private parseAndStructureTypes;
22
+ private generateTypesIndex;
23
+ private generateTypesDatabase;
24
+ private generateTypesEnums;
25
+ private generateTypesUI;
26
+ private generateTypesUtils;
21
27
  private sanitizeTypeScriptOutput;
22
28
  generateBrand(projectContext: any, options: GenerateOptions): Promise<GenerationResult>;
23
29
  generateProjectStructure(projectContext: any, options: GenerateOptions): Promise<GenerationResult>;
@@ -27,6 +33,11 @@ export declare class GenerateCommand {
27
33
  private saveGeneratedContent;
28
34
  private mergeComponentLists;
29
35
  private mergeComponentsByName;
36
+ private parseAndCreateBrandSystem;
37
+ private generateBrandCSS;
38
+ private generateBrandGuide;
39
+ private generateBrandColors;
40
+ private generateBrandTypography;
30
41
  private sanitizeMarkdownOutput;
31
42
  private splitPrdContent;
32
43
  private buildSkeleton;
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAqB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA2F/E,UAAU,eAAgB,SAAQ,cAAc;IAC9C,IAAI,CAAC,EACD,SAAS,GACT,OAAO,GACP,OAAO,GACP,iBAAiB,GACjB,mBAAmB,GACnB,KAAK,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;CACrC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,EAAE,CAA2B;IACrC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,EAAE,CAAiB;;IAOrB,OAAO,CAAC,OAAO,EAAE,eAAe,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