mycontext-cli
v4.2.26
Published
The Context Engine for AI-Native Development - Generate high-fidelity scaffolds and Living Brains for AI-powered coding
Downloads
1,935
Maintainers
Readme
mycontext-cli
The Context Engine for AI-Native Development.
Generate high-fidelity scaffolds, maintain a Living Brain, and drive your entire codebase with a single source of truth.
Table of Contents
- What is MyContext?
- Installation
- Quick Start
- Core Concepts
- Command Reference
- Typical Workflow
- Environment Variables
- Configuration
What is MyContext?
MyContext treats your project spec as a Living Brain — a structured JSON document (.mycontext/context.json) that describes your app's goals, architecture, components, and design system.
Every CLI command — such as screen mapping or component discovery — automatically synchronizes its results back into this central Brain, ensuring your documentation and your code remain perfectly aligned.
Installation
npm install -g mycontext-cli
# or
pnpm add -g mycontext-cliVerify:
mycontext --versionQuick Start
# 1. Go to your project folder (or an empty directory)
cd my-app
# 2. Initialise the Living Brain
mycontext init
# 3. Configure your AI provider
mycontext setup
# 4. Generate the full context from your PRD
mycontext generate context --full
# 5. Scaffold the entire application
mycontext buildCore Concepts
| Concept | What it is |
|---|---|
| Living Brain | .mycontext/context.json — single source of truth for your project |
| Deterministic Runtime | MyContext ensures your code never drifts from your architectural spec |
| PRD | .mycontext/01-prd.md — your product requirements document |
| UX Brain (i18n) | Internationalization layer synchronized with the Living Brain |
| Design Manifest | AI-derived design system snapshot |
| Sub-agents | Specialised AI workers (CodeGen, QA, Architect, Security, …) |
| FSR | Feature Spec Record — structured description of a single feature |
Command Reference
Project Setup
mycontext init [project-name]
Initialise a new MyContext project. Creates .mycontext/ with your PRD template, context skeleton, and (optionally) a framework scaffold.
mycontext init my-saas-app
mycontext init --framework nextjs # Next.js + shadcn/ui + i18n
mycontext init --framework instantdb # Next.js + InstantDB + shadcn (default)
mycontext init --interactive # Guided 100%-complete spec wizard
mycontext init --i18n # Enable internationalization wizard
mycontext init --scope apps/my-app # Scope context to a specific directory
mycontext init --ignore tests,docs # Ignore specific patterns during scanIn a monorepo, running mycontext init at the root will trigger an interactive workspace selector and context scoping wizard.
mycontext setup
Configure AI providers (Anthropic, OpenAI, xAI) and your development stack.
mycontext setup
mycontext setup --stack nextjs-tailwind-shadcnmycontext auth
Authenticate with the MyContext AI cloud service.
mycontext auth --login
mycontext auth --status
mycontext auth --logoutmycontext setup-shadcn
Add shadcn/ui to an existing project and wire it to the Living Brain.
mycontext setup-database
Set up a database provider (InstantDB, Supabase, Firebase) with schema and auth components.
mycontext setup-database --provider instantdbmycontext setup-instantdb
Full InstantDB + MCP integration wizard.
mycontext setup-instantdb --app-id <id> --token <token>mycontext setup-mcp
Configure a Model Context Protocol (MCP) server for AI-powered tooling.
mycontext setup-mcp --provider instantdb
mycontext setup-mcp --provider github
mycontext setup-mcp --provider custom --server <url>Living Brain
mycontext generate [type]
Orchestrate the Living Brain — generate context files, types, brand tokens, and more. All generation commands automatically synchronize their results into .mycontext/context.json.
mycontext generate context --full # Full PRD + A/B/C/D context files
mycontext generate context # Incremental update
mycontext generate:screens-list # Sync routes to the Brain
mycontext generate:components-manifest # Sync component specs to the Brain
mycontext generate design-prompt # AI design brief for UI designer
mycontext generate actions # UI→backend action hooks
mycontext generate assets # Planned asset list
mycontext generate sample-data # Seed data for developmentmycontext sync
Auto-update context.json and README.md by scanning the live codebase.
mycontext sync # Sync both
mycontext sync --context # context.json only
mycontext sync --readme # README.md only
mycontext sync --dry-run # Preview changes without writingmycontext sync-readme
Synchronise the root README.md with your design manifest.
mycontext validate <target>
Validate your PRD or context files for completeness.
mycontext validate prd
mycontext validate context
mycontext validate --interactivemycontext status
Show current project status and progress against the Living Brain.
mycontext status
mycontext status --detailedAI Agent & Planning
mycontext agent [prompt]
Assess a natural-language prompt against the Living Brain and propose (or apply) changes.
mycontext agent "Add a dark mode toggle to the nav"
mycontext agent "Add a dark mode toggle" --execute # Apply changes
mycontext agent "..." --execute --yes # Skip confirmationmycontext plan
Interactive feature planning session — produces an FSR (Feature Spec Record).
mycontext planmycontext build-strategy
Generate an AI-powered build strategy and execution plan from the current Brain state.
mycontext ideate
Generate creative UI/UX concepts based on project context.
mycontext ideate --industry fintech --count 5Code Generation
mycontext build
Scaffold the entire application from the Living Brain in one shot.
mycontext build
mycontext build --force # Regenerate all componentsmycontext build-feature
Build a single feature end-to-end from an FSR.
mycontext generate-components [target]
Generate React components from the component manifest.
mycontext generate-components all
mycontext generate-components --core-only # First 10 components only
mycontext generate-components --group forms
mycontext generate-components all --with-testsmycontext add <component>
Add a context-aware component (shadcn primitive or custom).
mycontext add button
mycontext add UserCard --group cards
mycontext add dialog --shadcnmycontext enhance
Enhance the project or specific components with AI suggestions.
mycontext refine
Refine context or components.
mycontext refine:component <componentName>
Refine a single component with targeted AI feedback.
mycontext refine:component HeroSection --variant mobile
mycontext refine:component NavBar --in-placemycontext migrate [target]
Migrate components to new standards.
mycontext migrate rtl # RTL-friendly logical CSS properties
mycontext migrate rtl --path src/components/Nav.tsx
mycontext migrate radix --all # Refactor to Radix/shadcn primitivesAnalysis & Diagnostics
mycontext analyze
Analyse an existing project and generate context files from the live codebase.
mycontext analyze
mycontext analyze --image ./screenshot.png # Analyse a mockup instead
mycontext analyze --verbosemycontext design
Design system analysis and manifest generation.
mycontext design --analyze
mycontext design --validate
mycontext design --summary
mycontext design --regeneratemycontext scan
Scan the project tree and assess progress against the Living Brain.
mycontext scan
mycontext scan --assess # AI progress assessment
mycontext scan --assess --json # Machine-readable outputmycontext health-check
Run health checks across the project.
mycontext doctor
Full diagnostic check with auto-fix suggestions. Now includes deterministic checks for:
- Structure Drift: Ensures code exists for all features defined in the Brain.
- i18n Coverage: Detects hardcoded strings and missing dictionary keys.
- Project Integrity: Validates monorepo scoping and workspace boundaries.
mycontext doctor
mycontext doctor --scope apps/my-app # Limit checks to a specific scope
mycontext doctor --project my-pkg # Filter by workspace project name
mycontext doctor --fix # Apply all safe fixesmycontext sanitize
Find and optionally remove redundant, duplicate, or unreachable code.
mycontext sanitize
mycontext sanitize --fix
mycontext sanitize --verbosemycontext generate-todos
Generate a contextual todo list from the project's current state.
mycontext generate-todos --count 10 --energy high --complexity moderateMaintenance
mycontext update
Update the CLI to the latest published version.
mycontext updatemycontext clean
Clean and repair malformed context files.
mycontext clean
mycontext clean --project ./path/to/projectmycontext help [topic]
Context-aware help for any topic or command.
mycontext help
mycontext help agent
mycontext help generate --verboseMonorepo Support
MyContext is designed for modern, multi-app monorepos. It intelligently handles workspace boundaries and shared packages.
Smart Scoping
When you initialize MyContext for a specific application within a monorepo (e.g., apps/admin), it:
- Detects Dependencies: Analyzes
package.jsonto see which workspace packages (e.g.,packages/ui) the app uses. - Suggests Context: Offers to include those related packages in the context scope automatically.
- Isolates Context: Keeps the Living Brain focused on what matters for that specific service, while maintaining awareness of shared workspace rules.
Workspace Detection
Supports:
- pnpm: Native
pnpm-workspace.yamlparsing. - Turborepo: Automatic
turbo.jsondetection. - npm/yarn: Standard
workspacesfield inpackage.json.
Typical Workflow
Starting a new project
mkdir my-app && cd my-app
mycontext init --spec-only # Context files only
mycontext setup # Configure AI keys (Gemini, Claude, etc.)
mycontext generate context --full # Build the Living Brain
mycontext generate:screens-list # Map routes to Brain
mycontext generate:components-manifest # Map component specs to Brain
mycontext generate:design-prompt # Ready for UI designer handoffAdding a feature to an existing project
mycontext plan # Describe the feature interactively
mycontext build-feature # Generate code from the FSR
mycontext sync # Keep context.json in syncAdopting MyContext on an existing codebase
cd existing-project
mycontext analyze # Reverse-engineer context from code
mycontext generate context # Fill gaps with AI
mycontext status # See what's coveredEnvironment Variables
MyContext loads .env files from your project automatically. You can also set these directly:
| Variable | Description |
|---|---|
| ANTHROPIC_API_KEY | Anthropic Claude API key |
| OPENAI_API_KEY | OpenAI API key |
| XAI_API_KEY | xAI (Grok) API key |
| MYCONTEXT_API_KEY | MyContext cloud service key |
| INSTANTDB_APP_ID | InstantDB application ID |
Loaded in order (first match wins):.mycontext/.env.local → .mycontext/.env → .env.local → .env
Configuration
All project configuration lives in .mycontext/:
.mycontext/
├── context.json ← Living Brain (source of truth)
├── 01-prd.md ← Product Requirements Document
├── .env.local ← Local secrets (git-ignored)
└── ... ← Generated context filesLinks
Built with MyContext — spec-driven development for the AI era.
