How techstack-ujjwal/dolphin works
DOLPHIN is an AI-powered CLI with chat, tool-calling, and application-generation modes, plus a web-assisted device-authentication flow. The CLI workflow authenticates the user, offers a mode, then persists conversations and exchanges messages with the AI; agent mode additionally generates files in the working directory. The tree and excerpts also show a Next.js sign-in/device-approval client. Some client-to-server wiring and the internals of tool and application generation were not sampled, so those connections are not inferred.
Main entry points: wakeup.js Mode selection · chat-with-ai-tool.js Tool calling · openai-service.js AI service · main.js CLI commands
Components 23
CLI workflow
- CLI commands
server/src/cli/main.js - Login commands
server/src/cli/commander/auth/auth/login.js - Mode selection
server/src/cli/commander/auth/ai/wakeup.js
AI modes
- Chat mode
server/src/cli/chat/chat-with-ai.js - Tool calling
server/src/cli/chat/chat-with-ai-tool.js - Agent mode
server/src/cli/chat/chat-with-aiagent.js - AI service
server/src/cli/ai/openai-service.js - Model config
server/src/config/gpt.config.js - Tool config
server/src/config/tool.config.js - Generation config
server/src/config/agent.config.js - Search, execution, URL context
- Generated application files
Identity and conversation state
- Conversation service
server/src/service/chat.service.js - PostgreSQL data
server/src/lib/db.js - Auth service
server/src/lib/auth.js
Web authentication
- Sign-in and device pages
client/my-app/app/auth/sign-in/page.tsx - Login form
client/my-app/components/login-form.tsx - Browser auth client
client/my-app/lib/auth-client.ts - Device approval
client/my-app/app/device/page.tsx - Approval page
client/my-app/app/approve/page.tsx
Other components
- CLI user
- GitHub
- OpenAI
Connections 26
- CLI user → CLI commands: runs commands
server/src/cli/main.js - CLI commands → Login commands: registers auth
server/src/cli/main.js - CLI commands → Mode selection: registers mode command
server/src/cli/main.js - CLI commands → Chat mode: loads direct chat
server/src/cli/main.js - Mode selection → Login commands: reads token
server/src/cli/commander/auth/ai/wakeup.js - Mode selection → PostgreSQL data: looks up user
server/src/cli/commander/auth/ai/wakeup.js - Mode selection → Chat mode: dispatches chat
server/src/cli/commander/auth/ai/wakeup.js - Mode selection → Tool calling: dispatches tools
server/src/cli/commander/auth/ai/wakeup.js - Mode selection → Agent mode: dispatches agent
server/src/cli/commander/auth/ai/wakeup.js - Chat mode → Conversation service: loads and saves messages
server/src/cli/chat/chat-with-ai.js - Tool calling → Conversation service: loads and saves messages
server/src/cli/chat/chat-with-ai-tool.js - Agent mode → Conversation service: loads and saves messages
server/src/cli/chat/chat-with-aiagent.js - Conversation service → PostgreSQL data: reads and writes
server/src/service/chat.service.js - Chat mode → AI service: requests responses
server/src/cli/chat/chat-with-ai.js - Tool calling → AI service: requests tool responses
server/src/cli/chat/chat-with-ai-tool.js - Agent mode → AI service: requests generation
server/src/cli/chat/chat-with-aiagent.js - AI service → Model config: reads model settings
server/src/cli/ai/openai-service.js - AI service → OpenAI: calls model API
- Tool calling → Tool config: gets available tools
server/src/cli/chat/chat-with-ai-tool.js - Tool calling → Search, execution, URL context: offers tool capabilities
README.md - Agent mode → Generation config: generates application
server/src/cli/chat/chat-with-aiagent.js - Generation config → Generated application files: writes project files
README.md - Auth service → PostgreSQL data: uses Prisma adapter
server/src/lib/auth.js - Login commands → Auth service: polls device authorization
server/src/cli/commander/auth/auth/login.js - Login form → Browser auth client: starts GitHub sign-in
client/my-app/components/login-form.tsx - Auth service → GitHub: configures OAuth provider
server/src/lib/auth.js