How yashdev9274/supercli works
1. Repository Purpose and Topology
Supercode is a Bun/Turborepo TypeScript monorepo for an AI software-engineering platform. Its primary product is an installable coding-agent CLI, supplemented by a dashboard, terminal browser client, documentation site, and a separate design-generation application. Workspace orchestration starts at package.json and turbo.json.
2. AI Coding-Agent CLI
The main execution entry point is the Bun CLI at apps/supercode-cli/server/src/index.ts, with command dispatch in apps/supercode-cli/server/src/cli/main.ts and command registration in apps/supercode-cli/server/src/cli/commands/index.ts. The interactive chat loop under apps/supercode-cli/server/src/cli/ai/chat/chat.ts gathers workspace context, sends model requests, renders streaming terminal output, and coordinates tool calls.
3. Agent Orchestration and Provider Boundary
Agent modes, prompts, subagents, and execution are concentrated in apps/supercode-cli/server/src/agent/agent.ts, apps/supercode-cli/server/src/agent/agent-service.ts, and apps/supercode-cli/server/src/agent/runner.ts. Prompt templates split work into build, explore, plan, compaction, and summary flows in apps/supercode-cli/server/src/agent/prompts/. Provider adapters isolate model-specific APIs—OpenRouter, Google, Minimax, NVIDIA, and server proxy—from chat orchestration in apps/supercode-cli/server/src/cli/ai/provider.ts and adjacent *-service.ts files.
4. Tooling, Permissions, and Local Boundary
The agent invokes a registry of filesystem, shell, web-search, scraping, delegation, and user-question tools through apps/supercode-cli/server/src/tools/registry.ts and apps/supercode-cli/server/src/cli/ai/tool-executor.ts. Mutating or sensitive operations are gated by apps/supercode-cli/server/src/tools/permission-manager.ts and agent sub-permission policy in apps/supercode-cli/server/src/agent/subagent-permissions.ts. Tool definitions such as apps/supercode-cli/server/src/tools/definitions/edit-file.ts, run-command.ts, and delegate.ts form the critical boundary between LLM decisions and the local developer workspace.
5. Web Platform and Async Processing
The public/dashboard Next.js App Router application begins in apps/web/app/layout.tsx and apps/web/app/page.tsx; authenticated product views live in apps/web/app/dashboard/page.tsx and feature modules. Better Auth is exposed through apps/web/app/api/auth/[...all]/route.ts, with shared auth/database layers in packages/auth/src/server.ts and packages/db/src/client.ts. GitHub events enter via apps/web/app/api/webhooks/github/route.ts; the Inngest route and AI-review job provide asynchronous repository processing at apps/web/app/api/inngest/route.ts and apps/web/inngest/functions/ai-review.ts.
6. Persistence, Retrieval, and External Services
PostgreSQL/Prisma is split deliberately: dashboard data uses packages/db/prisma/schema.prisma, while CLI/terminal identity or device-flow data uses apps/supercode-cli/server/prisma/schema.prisma and packages/db-terminal/prisma/schema.prisma. Pinecone-backed RAG is encapsulated by apps/web/lib/pinecone/pinecone.ts and apps/web/modules/pinecone/rag/index.ts. Material integrations include GitHub OAuth/API, Better Auth, Inngest, Pinecone, Anthropic/Claude, OpenRouter, Google/Gemini, Exa, Firecrawl, MCP/Composio, and optional Slack/Linear/GitHub agent connectors.
7. Supporting Product Surfaces and Shared Domain
The terminal browser UI is a distinct Next.js client with auth/device-approval flows in apps/supercode-cli/client/app/device/page.tsx and apps/supercode-cli/client/app/approve/page.tsx; it complements rather than replaces the local CLI. Documentation is an MDX-driven Next.js site routed through apps/docs/app/docs/[slug]/page.tsx. Superdesign is an independent authenticated Next.js app that exposes project/artifact generation APIs at apps/superdesign/app/api/projects/[id]/generate/route.ts, using reusable design prompts, systems, and skills from packages/design-core/src/prompt-builder.ts and packages/design-core/src/design-systems/index.ts. Open-model fine-tuning is a parallel Python workload, with data preparation and Tinker Qwen3 training in supercode-openmodel/training/data/prepare_dataset.py and supercode-openmodel/training/tinker_qwen3/train.py.
Main entry points: registry.ts Tool registry & executor · package.json Bun/Turbo workspace · chat.ts Interactive chat · agent-service.ts Agent runtime
Components 21
Coding Agent CLI
- CLI entry
apps/supercode-cli/server/src/index.ts - Command dispatch
apps/supercode-cli/server/src/cli/main.ts - Interactive chat · Builds context, streams output, and coordinates tool calls.
apps/supercode-cli/server/src/cli/ai/chat/chat.ts - Agent runtime · Modes, subagents, prompts, and execution.
apps/supercode-cli/server/src/agent/agent-service.ts - Model providers · Routes requests to hosted models and server proxy.
apps/supercode-cli/server/src/cli/ai/provider.ts - Tool registry & executor · Filesystem, shell, web, delegation, and question tools.
apps/supercode-cli/server/src/tools/registry.ts - Permission policy · Approves sensitive or mutating tool operations.
apps/supercode-cli/server/src/tools/permission-manager.ts - Developer workspace
Web Platform
- Dashboard & public app
apps/web/app/layout.tsx - Auth service
packages/auth/src/server.ts - Dashboard database
packages/db/prisma/schema.prisma - GitHub webhook
apps/web/app/api/webhooks/github/route.ts - AI review job · Asynchronously processes repository events.
apps/web/inngest/functions/ai-review.ts - Pinecone RAG
apps/web/modules/pinecone/rag/index.ts
Other Product Surfaces
- Terminal browser client · Handles device approval for the local CLI.
apps/supercode-cli/client/app/device/page.tsx - Documentation site
apps/docs/app/docs/[slug]/page.tsx - Superdesign · Authenticated project and artifact generation.
apps/superdesign/app/api/projects/[id]/generate/route.ts - Design core
packages/design-core/src/prompt-builder.ts
Open Model Training
- Training data preparation
supercode-openmodel/training/data/prepare_dataset.py - Qwen3 fine-tuning
supercode-openmodel/training/tinker_qwen3/train.py
Other components
- Bun/Turbo workspace
package.json
Connections 19
- Bun/Turbo workspace → CLI entry: builds and runs
- Bun/Turbo workspace → Dashboard & public app: orchestrates
- Bun/Turbo workspace → Superdesign: orchestrates
- CLI entry → Command dispatch: starts
- Command dispatch → Interactive chat: opens chat
- Interactive chat → Agent runtime: requests execution
- Agent runtime → Model providers: sends model requests
- Agent runtime → Tool registry & executor: selects tools
- Interactive chat → Tool registry & executor: coordinates calls
- Tool registry & executor → Permission policy: checks mutations
- Permission policy → Developer workspace: authorizes access
- Tool registry & executor → Developer workspace: reads and changes
- Dashboard & public app → Auth service: authenticates users
- Dashboard & public app → Dashboard database: persists product data
- GitHub webhook → AI review job: triggers
- AI review job → Pinecone RAG: retrieves context
- Terminal browser client → Auth service: device approval
- Superdesign → Design core: uses prompts and systems
- Training data preparation → Qwen3 fine-tuning: produces training data