@hienlh/ppm 0.1.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.
- package/.claude/agent-memory/tester/MEMORY.md +3 -0
- package/.claude/agent-memory/tester/project-ppm-test-conventions.md +32 -0
- package/.env.example +1 -0
- package/.github/workflows/release.yml +46 -0
- package/README.md +349 -0
- package/bun.lock +1217 -0
- package/components.json +21 -0
- package/docs/code-standards.md +574 -0
- package/docs/codebase-summary.md +294 -0
- package/docs/deployment-guide.md +631 -0
- package/docs/design-guidelines.md +661 -0
- package/docs/project-overview-pdr.md +142 -0
- package/docs/project-roadmap.md +400 -0
- package/docs/system-architecture.md +459 -0
- package/package.json +68 -0
- package/plans/260314-2009-ppm-implementation/phase-01-project-skeleton.md +81 -0
- package/plans/260314-2009-ppm-implementation/phase-02-backend-core.md +148 -0
- package/plans/260314-2009-ppm-implementation/phase-03-frontend-shell.md +256 -0
- package/plans/260314-2009-ppm-implementation/phase-04-file-explorer-editor.md +120 -0
- package/plans/260314-2009-ppm-implementation/phase-05-web-terminal.md +174 -0
- package/plans/260314-2009-ppm-implementation/phase-06-git-integration.md +244 -0
- package/plans/260314-2009-ppm-implementation/phase-07-ai-chat.md +242 -0
- package/plans/260314-2009-ppm-implementation/phase-08-cli-commands.md +143 -0
- package/plans/260314-2009-ppm-implementation/phase-09-pwa-build-deploy.md +209 -0
- package/plans/260314-2009-ppm-implementation/phase-10-testing.md +311 -0
- package/plans/260314-2009-ppm-implementation/plan.md +202 -0
- package/plans/260315-0356-project-scoped-api-refactor/phase-01-backend-project-router.md +145 -0
- package/plans/260315-0356-project-scoped-api-refactor/phase-02-frontend-api-migration.md +107 -0
- package/plans/260315-0356-project-scoped-api-refactor/phase-03-per-project-tabs.md +100 -0
- package/plans/260315-0356-project-scoped-api-refactor/phase-04-websocket-migration.md +66 -0
- package/plans/260315-0356-project-scoped-api-refactor/plan.md +87 -0
- package/plans/reports/brainstorm-260314-1938-final-techstack.md +342 -0
- package/plans/reports/docs-manager-260315-1314-documentation-creation.md +386 -0
- package/plans/reports/fullstack-developer-260314-2252-phase-02-backend-core.md +57 -0
- package/plans/reports/fullstack-developer-260314-2253-phase-03-frontend-shell.md +70 -0
- package/plans/reports/fullstack-developer-260314-2300-phase-04-05-file-api-terminal-ws.md +49 -0
- package/plans/reports/fullstack-developer-260314-2300-phase-04-05-file-explorer-editor-terminal.md +52 -0
- package/plans/reports/fullstack-developer-260314-2307-ai-chat-phase7.md +58 -0
- package/plans/reports/fullstack-developer-260314-2307-phase-06-git-integration.md +33 -0
- package/plans/reports/research-260314-1911-ppm-tech-stack.md +318 -0
- package/plans/reports/research-260314-1930-claude-code-integration.md +293 -0
- package/plans/reports/researcher-260314-2232-node-pty-bun-crash-analysis.md +305 -0
- package/plans/reports/researcher-260314-2232-ui-style.md +942 -0
- package/plans/reports/researcher-260315-0300-opcode-claude-interaction.md +745 -0
- package/plans/reports/researcher-260315-0303-opcode-deep-analysis.md +742 -0
- package/plans/reports/researcher-260315-0305-claude-agent-sdk-github-research.md +423 -0
- package/plans/reports/tester-260314-2053-initial-test-suite.md +81 -0
- package/ppm.example.yaml +14 -0
- package/repomix-output.xml +23745 -0
- package/scripts/build.ts +13 -0
- package/src/cli/commands/chat-cmd.ts +259 -0
- package/src/cli/commands/config-cmd.ts +121 -0
- package/src/cli/commands/git-cmd.ts +315 -0
- package/src/cli/commands/init.ts +57 -0
- package/src/cli/commands/open.ts +19 -0
- package/src/cli/commands/projects.ts +100 -0
- package/src/cli/commands/start.ts +3 -0
- package/src/cli/commands/stop.ts +33 -0
- package/src/cli/utils/project-resolver.ts +27 -0
- package/src/index.ts +59 -0
- package/src/providers/claude-agent-sdk.ts +499 -0
- package/src/providers/claude-binary-finder.ts +256 -0
- package/src/providers/claude-code-cli.ts +413 -0
- package/src/providers/claude-process-registry.ts +106 -0
- package/src/providers/mock-provider.ts +171 -0
- package/src/providers/provider.interface.ts +10 -0
- package/src/providers/registry.ts +45 -0
- package/src/server/helpers/resolve-project.ts +22 -0
- package/src/server/index.ts +181 -0
- package/src/server/middleware/auth.ts +30 -0
- package/src/server/routes/chat.ts +153 -0
- package/src/server/routes/files.ts +168 -0
- package/src/server/routes/git.ts +261 -0
- package/src/server/routes/project-scoped.ts +27 -0
- package/src/server/routes/projects.ts +57 -0
- package/src/server/routes/static.ts +26 -0
- package/src/server/ws/chat.ts +130 -0
- package/src/server/ws/terminal.ts +89 -0
- package/src/services/chat.service.ts +110 -0
- package/src/services/claude-usage.service.ts +113 -0
- package/src/services/config.service.ts +90 -0
- package/src/services/file.service.ts +261 -0
- package/src/services/git-dirs.service.ts +112 -0
- package/src/services/git.service.ts +372 -0
- package/src/services/project.service.ts +107 -0
- package/src/services/slash-items.service.ts +184 -0
- package/src/services/terminal.service.ts +212 -0
- package/src/types/api.ts +37 -0
- package/src/types/chat.ts +92 -0
- package/src/types/config.ts +41 -0
- package/src/types/git.ts +50 -0
- package/src/types/project.ts +18 -0
- package/src/types/terminal.ts +20 -0
- package/src/web/app.tsx +168 -0
- package/src/web/components/auth/login-screen.tsx +88 -0
- package/src/web/components/chat/attachment-chips.tsx +55 -0
- package/src/web/components/chat/chat-placeholder.tsx +10 -0
- package/src/web/components/chat/chat-tab.tsx +301 -0
- package/src/web/components/chat/file-picker.tsx +126 -0
- package/src/web/components/chat/message-input.tsx +420 -0
- package/src/web/components/chat/message-list.tsx +838 -0
- package/src/web/components/chat/session-picker.tsx +139 -0
- package/src/web/components/chat/slash-command-picker.tsx +135 -0
- package/src/web/components/chat/usage-badge.tsx +186 -0
- package/src/web/components/editor/code-editor.tsx +329 -0
- package/src/web/components/editor/diff-viewer.tsx +276 -0
- package/src/web/components/editor/editor-placeholder.tsx +10 -0
- package/src/web/components/explorer/file-actions.tsx +191 -0
- package/src/web/components/explorer/file-tree.tsx +298 -0
- package/src/web/components/git/git-graph.tsx +727 -0
- package/src/web/components/git/git-placeholder.tsx +55 -0
- package/src/web/components/git/git-status-panel.tsx +850 -0
- package/src/web/components/layout/mobile-drawer.tsx +137 -0
- package/src/web/components/layout/mobile-nav.tsx +103 -0
- package/src/web/components/layout/sidebar.tsx +90 -0
- package/src/web/components/layout/tab-bar.tsx +152 -0
- package/src/web/components/layout/tab-content.tsx +85 -0
- package/src/web/components/projects/dir-suggest.tsx +152 -0
- package/src/web/components/projects/project-list.tsx +187 -0
- package/src/web/components/settings/settings-tab.tsx +57 -0
- package/src/web/components/terminal/terminal-placeholder.tsx +10 -0
- package/src/web/components/terminal/terminal-tab.tsx +133 -0
- package/src/web/components/ui/button.tsx +64 -0
- package/src/web/components/ui/context-menu.tsx +250 -0
- package/src/web/components/ui/dialog.tsx +156 -0
- package/src/web/components/ui/dropdown-menu.tsx +257 -0
- package/src/web/components/ui/input.tsx +21 -0
- package/src/web/components/ui/scroll-area.tsx +56 -0
- package/src/web/components/ui/separator.tsx +26 -0
- package/src/web/components/ui/sonner.tsx +40 -0
- package/src/web/components/ui/tabs.tsx +91 -0
- package/src/web/components/ui/tooltip.tsx +57 -0
- package/src/web/hooks/use-chat.ts +420 -0
- package/src/web/hooks/use-terminal.ts +182 -0
- package/src/web/hooks/use-url-sync.ts +66 -0
- package/src/web/hooks/use-websocket.ts +48 -0
- package/src/web/index.html +16 -0
- package/src/web/lib/api-client.ts +90 -0
- package/src/web/lib/file-support.ts +68 -0
- package/src/web/lib/utils.ts +6 -0
- package/src/web/lib/ws-client.ts +100 -0
- package/src/web/main.tsx +10 -0
- package/src/web/public/icon-192.svg +5 -0
- package/src/web/public/icon-512.svg +5 -0
- package/src/web/stores/file-store.ts +81 -0
- package/src/web/stores/project-store.ts +50 -0
- package/src/web/stores/settings-store.ts +65 -0
- package/src/web/stores/tab-store.ts +187 -0
- package/src/web/styles/globals.css +227 -0
- package/src/web/vite-env.d.ts +1 -0
- package/tests/integration/api/chat-routes.test.ts +95 -0
- package/tests/integration/claude-agent-sdk-integration.test.ts +228 -0
- package/tests/integration/ws/chat-websocket.test.ts +312 -0
- package/tests/test-setup.ts +5 -0
- package/tests/unit/providers/claude-agent-sdk.test.ts +339 -0
- package/tests/unit/providers/mock-provider.test.ts +143 -0
- package/tests/unit/services/chat-service.test.ts +100 -0
- package/tsconfig.json +32 -0
- package/vite.config.ts +62 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# PPM Codebase Summary
|
|
2
|
+
|
|
3
|
+
Generated from repomix analysis of 96 TypeScript files, 14K LOC, 194K tokens.
|
|
4
|
+
|
|
5
|
+
## Directory Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
ppm/
|
|
9
|
+
├── src/
|
|
10
|
+
│ ├── index.ts # CLI entry point (Commander.js program)
|
|
11
|
+
│ ├── cli/
|
|
12
|
+
│ │ ├── commands/ # CLI command implementations (8 files, 907 LOC)
|
|
13
|
+
│ │ │ ├── start.ts # Start server (Hono + Bun.serve)
|
|
14
|
+
│ │ │ ├── stop.ts # Stop daemon (graceful shutdown)
|
|
15
|
+
│ │ │ ├── open.ts # Open browser to http://localhost:PORT
|
|
16
|
+
│ │ │ ├── init.ts # Initialize ppm.yaml config (scan git repos)
|
|
17
|
+
│ │ │ ├── projects.ts # Add/remove/list projects
|
|
18
|
+
│ │ │ ├── config-cmd.ts # View/set config values
|
|
19
|
+
│ │ │ ├── git-cmd.ts # Git operations (status, diff, log, commit)
|
|
20
|
+
│ │ │ └── chat-cmd.ts # Chat CLI (send messages, manage sessions)
|
|
21
|
+
│ │ └── utils/
|
|
22
|
+
│ │ └── project-resolver.ts # Resolve project name -> path
|
|
23
|
+
│ ├── server/
|
|
24
|
+
│ │ ├── index.ts # Hono server setup, Bun.serve, WebSocket upgrade
|
|
25
|
+
│ │ ├── middleware/
|
|
26
|
+
│ │ │ └── auth.ts # Token validation middleware
|
|
27
|
+
│ │ ├── routes/
|
|
28
|
+
│ │ │ ├── projects.ts # GET/POST /api/projects, DELETE /:name
|
|
29
|
+
│ │ │ ├── project-scoped.ts # Mount chat, git, files under /api/project/:name/*
|
|
30
|
+
│ │ │ ├── chat.ts # GET/POST/DELETE sessions, GET messages, usage, slash-items
|
|
31
|
+
│ │ │ ├── git.ts # GET status, diff, log, graph; POST commit, stage, discard
|
|
32
|
+
│ │ │ ├── files.ts # GET tree, read, diff; PUT write; POST mkdir, delete
|
|
33
|
+
│ │ │ └── static.ts # Serve dist/web/index.html (frontend)
|
|
34
|
+
│ │ ├── helpers/
|
|
35
|
+
│ │ │ └── resolve-project.ts # Helper to resolve project from request params
|
|
36
|
+
│ │ └── ws/
|
|
37
|
+
│ │ ├── chat.ts # WebSocket chat streaming (220 LOC)
|
|
38
|
+
│ │ └── terminal.ts # WebSocket terminal I/O (terminal.service.ts integration)
|
|
39
|
+
│ ├── providers/ # AI Provider adapters (7 files, 1444 LOC)
|
|
40
|
+
│ │ ├── provider.interface.ts # AIProvider interface (createSession, sendMessage, onToolApproval)
|
|
41
|
+
│ │ ├── claude-agent-sdk.ts # Primary: @anthropic-ai/claude-agent-sdk (444 LOC)
|
|
42
|
+
│ │ ├── claude-code-cli.ts # Fallback: claude CLI binary (412 LOC)
|
|
43
|
+
│ │ ├── mock-provider.ts # Test provider
|
|
44
|
+
│ │ ├── claude-binary-finder.ts # Find claude CLI in PATH
|
|
45
|
+
│ │ ├── claude-process-registry.ts # Track running claude processes
|
|
46
|
+
│ │ └── registry.ts # ProviderRegistry (singleton, router to active provider)
|
|
47
|
+
│ ├── services/ # Business logic (9 files, 1561 LOC)
|
|
48
|
+
│ │ ├── chat.service.ts # Session lifecycle, message streaming, streaming to clients
|
|
49
|
+
│ │ ├── git.service.ts # Git operations (372 LOC): status, diff, log, graph, branches
|
|
50
|
+
│ │ ├── file.service.ts # File ops (261 LOC): tree, read, write, delete, mkdir, path validation
|
|
51
|
+
│ │ ├── project.service.ts # YAML project registry (108 LOC)
|
|
52
|
+
│ │ ├── terminal.service.ts # PTY management (200+ LOC), Bun.spawn native shell
|
|
53
|
+
│ │ ├── config.service.ts # YAML config loading (91 LOC)
|
|
54
|
+
│ │ ├── slash-items.service.ts # /slash command detection & completion
|
|
55
|
+
│ │ ├── claude-usage.service.ts # Token usage via ccburn library
|
|
56
|
+
│ │ └── git-dirs.service.ts # Cached git directory discovery
|
|
57
|
+
│ ├── types/ # TypeScript interfaces (6 files, 258 LOC)
|
|
58
|
+
│ │ ├── api.ts # ApiResponse envelope, WebSocket message types
|
|
59
|
+
│ │ ├── chat.ts # Session, Message, ChatEvent types
|
|
60
|
+
│ │ ├── config.ts # Config schema
|
|
61
|
+
│ │ ├── git.ts # GitStatus, GitDiff, GitCommit types
|
|
62
|
+
│ │ ├── project.ts # Project interface
|
|
63
|
+
│ │ └── terminal.ts # Terminal types
|
|
64
|
+
│ └── web/ # React frontend (Vite)
|
|
65
|
+
│ ├── main.tsx # React mount (<App> into #root)
|
|
66
|
+
│ ├── app.tsx # Root component (auth check, project load, theme)
|
|
67
|
+
│ ├── stores/ # Zustand state stores (4 files, 383 LOC)
|
|
68
|
+
│ │ ├── project-store.ts # Active project, projects list
|
|
69
|
+
│ │ ├── tab-store.ts # Open tabs (chat, editor, git, terminal)
|
|
70
|
+
│ │ ├── file-store.ts # Open files, selections
|
|
71
|
+
│ │ └── settings-store.ts # Theme, auth token
|
|
72
|
+
│ ├── hooks/ # Custom React hooks (4 files, 716 LOC)
|
|
73
|
+
│ │ ├── use-chat.ts # Chat streaming, WebSocket, message history (420 LOC)
|
|
74
|
+
│ │ ├── use-websocket.ts # Generic WebSocket adapter
|
|
75
|
+
│ │ ├── use-terminal.ts # Terminal I/O over WebSocket
|
|
76
|
+
│ │ └── use-url-sync.ts # Sync state to URL (project, tab, file selections)
|
|
77
|
+
│ ├── lib/ # Utilities (4 files, 264 LOC)
|
|
78
|
+
│ │ ├── api-client.ts # Fetch wrapper with auth token
|
|
79
|
+
│ │ ├── ws-client.ts # WebSocket wrapper
|
|
80
|
+
│ │ ├── file-support.ts # File type detection (language -> icon)
|
|
81
|
+
│ │ └── utils.ts # Utility functions (clsx, classname merging)
|
|
82
|
+
│ ├── styles/
|
|
83
|
+
│ │ └── globals.css # Tailwind directives, custom CSS
|
|
84
|
+
│ └── components/ # React components (organized by feature)
|
|
85
|
+
│ ├── auth/ # Login screen (88 LOC)
|
|
86
|
+
│ ├── chat/ # Chat UI (2202 LOC, 9 files)
|
|
87
|
+
│ │ ├── chat-tab.tsx # Main chat interface
|
|
88
|
+
│ │ ├── message-list.tsx # Scrollable messages with tool display
|
|
89
|
+
│ │ ├── message-input.tsx # Input with file attach, slash command picker
|
|
90
|
+
│ │ ├── session-picker.tsx # Switch between sessions
|
|
91
|
+
│ │ ├── usage-badge.tsx # Token usage display
|
|
92
|
+
│ │ └── ... 4 more
|
|
93
|
+
│ ├── editor/ # Code editor (615 LOC, 3 files)
|
|
94
|
+
│ │ ├── code-editor.tsx # CodeMirror integration
|
|
95
|
+
│ │ ├── diff-viewer.tsx # Diff2HTML for git diffs
|
|
96
|
+
│ │ └── editor-placeholder.tsx
|
|
97
|
+
│ ├── explorer/ # File tree (489 LOC, 2 files)
|
|
98
|
+
│ │ ├── file-tree.tsx # Directory tree view
|
|
99
|
+
│ │ └── file-actions.tsx # Create/delete/rename context menu
|
|
100
|
+
│ ├── git/ # Git UI (1632 LOC, 3 files)
|
|
101
|
+
│ │ ├── git-status-panel.tsx # Status, staging UI
|
|
102
|
+
│ │ ├── git-graph.tsx # Mermaid-based commit graph
|
|
103
|
+
│ │ └── git-placeholder.tsx
|
|
104
|
+
│ ├── layout/ # Layout components (567 LOC, 5 files)
|
|
105
|
+
│ │ ├── sidebar.tsx # Left sidebar (project, file tree, sections)
|
|
106
|
+
│ │ ├── tab-bar.tsx # Top tab bar (chat, editor, git, terminal)
|
|
107
|
+
│ │ ├── tab-content.tsx # Router for tab content
|
|
108
|
+
│ │ ├── mobile-nav.tsx # Mobile hamburger navigation
|
|
109
|
+
│ │ └── mobile-drawer.tsx # Offcanvas drawer
|
|
110
|
+
│ ├── projects/ # Project management (339 LOC, 2 files)
|
|
111
|
+
│ ├── settings/ # Settings panel (57 LOC)
|
|
112
|
+
│ ├── terminal/ # xterm.js wrapper (143 LOC, 2 files)
|
|
113
|
+
│ └── ui/ # Radix + shadcn primitives (1018 LOC, 10 files)
|
|
114
|
+
│ └── button.tsx, dialog.tsx, dropdown-menu.tsx, ... (base components)
|
|
115
|
+
├── tests/
|
|
116
|
+
│ ├── test-setup.ts # Disable auth for tests
|
|
117
|
+
│ ├── unit/
|
|
118
|
+
│ │ ├── providers/ # Mock provider, SDK tests
|
|
119
|
+
│ │ └── services/ # Chat service tests
|
|
120
|
+
│ └── integration/
|
|
121
|
+
│ ├── claude-agent-sdk-integration.test.ts
|
|
122
|
+
│ ├── api/ # Chat route tests
|
|
123
|
+
│ └── ws/ # WebSocket tests
|
|
124
|
+
├── scripts/
|
|
125
|
+
│ ├── build.ts # Build CLI binary (bun build --compile)
|
|
126
|
+
│ └── dev.ts # Dev server helpers
|
|
127
|
+
├── dist/ # Build output
|
|
128
|
+
│ ├── ppm # Compiled CLI binary
|
|
129
|
+
│ └── web/ # Frontend bundle
|
|
130
|
+
├── node_modules/
|
|
131
|
+
├── .env.example # Environment template
|
|
132
|
+
├── ppm.yaml # Auto-generated project config
|
|
133
|
+
├── tsconfig.json # TS config (strict mode, path aliases)
|
|
134
|
+
├── vite.config.ts # Vite config (React, PWA, proxy to :8080)
|
|
135
|
+
├── tailwind.config.ts # Tailwind (dark mode, custom colors)
|
|
136
|
+
├── package.json # Dependencies
|
|
137
|
+
├── bunfig.toml # Bun config (root directory)
|
|
138
|
+
└── README.md # Project overview
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Key Module Responsibilities
|
|
142
|
+
|
|
143
|
+
### CLI Layer (src/cli/)
|
|
144
|
+
- **Responsibility:** Command-line interface for managing PPM
|
|
145
|
+
- **Key Functions:**
|
|
146
|
+
- `start` — Start Hono server on configurable port
|
|
147
|
+
- `stop` — Graceful shutdown of daemon process
|
|
148
|
+
- `open` — Launch browser to active server
|
|
149
|
+
- `init` — Scan filesystem for git repos, create ppm.yaml
|
|
150
|
+
- `projects` — Add/remove/list projects in config
|
|
151
|
+
- `config` — View/edit config values
|
|
152
|
+
- `git` — Run git operations on active project
|
|
153
|
+
- `chat` — Send messages to chat session (CLI mode)
|
|
154
|
+
- **Pattern:** Command handler pattern (Commander.js)
|
|
155
|
+
|
|
156
|
+
### Server Layer (src/server/)
|
|
157
|
+
- **Responsibility:** HTTP REST API + WebSocket server
|
|
158
|
+
- **Key Routes:**
|
|
159
|
+
- `/api/health` — Health check
|
|
160
|
+
- `/api/auth/check` — Verify token validity
|
|
161
|
+
- `/api/projects` — CRUD projects
|
|
162
|
+
- `/api/project/:name/*` — Project-scoped routes (chat, git, files)
|
|
163
|
+
- `/ws/project/:name/chat/:sessionId` — Chat streaming
|
|
164
|
+
- `/ws/project/:name/terminal/:id` — Terminal I/O
|
|
165
|
+
- **Pattern:** Project-scoped routing via ProviderRegistry
|
|
166
|
+
|
|
167
|
+
### Service Layer (src/services/)
|
|
168
|
+
- **Responsibility:** Business logic, data operations
|
|
169
|
+
- **Services:**
|
|
170
|
+
- **ChatService** — Session lifecycle, message queueing, streaming
|
|
171
|
+
- **GitService** — Git commands via simple-git
|
|
172
|
+
- **FileService** — File ops with path validation
|
|
173
|
+
- **ProjectService** — YAML registry management
|
|
174
|
+
- **TerminalService** — PTY lifecycle, shell spawning
|
|
175
|
+
- **ConfigService** — Config file loading
|
|
176
|
+
- **Pattern:** Singleton services, dependency injection via imports
|
|
177
|
+
|
|
178
|
+
### Provider Layer (src/providers/)
|
|
179
|
+
- **Responsibility:** AI model abstraction
|
|
180
|
+
- **Providers:**
|
|
181
|
+
- **claude-agent-sdk** — Primary (official SDK, streaming, tool use)
|
|
182
|
+
- **claude-code-cli** — Fallback (subprocess-based)
|
|
183
|
+
- **mock** — Test provider
|
|
184
|
+
- **Interface:** Async generator streaming, tool approval callback
|
|
185
|
+
- **Pattern:** Registry pattern for pluggable AI providers
|
|
186
|
+
|
|
187
|
+
### Frontend Layer (src/web/)
|
|
188
|
+
- **Responsibility:** React UI for project management, chat, terminal, editor
|
|
189
|
+
- **Key Stores:**
|
|
190
|
+
- **ProjectStore** — Active project, project list
|
|
191
|
+
- **TabStore** — Open tabs per project
|
|
192
|
+
- **FileStore** — File selections
|
|
193
|
+
- **SettingsStore** — Auth, theme
|
|
194
|
+
- **Pattern:** Zustand for state, React.lazy() for tab content splitting
|
|
195
|
+
|
|
196
|
+
## Data Flow Diagrams
|
|
197
|
+
|
|
198
|
+
### Chat Streaming Flow
|
|
199
|
+
```
|
|
200
|
+
User types message
|
|
201
|
+
↓
|
|
202
|
+
MessageInput captures text
|
|
203
|
+
↓
|
|
204
|
+
useChat hook calls POST /api/project/:name/chat/sessions/:id/messages
|
|
205
|
+
↓
|
|
206
|
+
ChatService streams AI response
|
|
207
|
+
↓
|
|
208
|
+
WebSocket connection streams ChatEvent objects
|
|
209
|
+
↓
|
|
210
|
+
useChat accumulates message
|
|
211
|
+
↓
|
|
212
|
+
MessageList renders streamed content
|
|
213
|
+
↓
|
|
214
|
+
User approves tool use (if needed)
|
|
215
|
+
↓
|
|
216
|
+
ChatWsClientMessage sent with approval_response
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Terminal I/O Flow
|
|
220
|
+
```
|
|
221
|
+
User types in terminal
|
|
222
|
+
↓
|
|
223
|
+
xterm.js captures keypress
|
|
224
|
+
↓
|
|
225
|
+
useTerminal sends {type: "input", data: "..."} via WebSocket
|
|
226
|
+
↓
|
|
227
|
+
TerminalService writes to PTY stdin
|
|
228
|
+
↓
|
|
229
|
+
Shell output captured from PTY stdout
|
|
230
|
+
↓
|
|
231
|
+
{type: "output", data: "..."} sent back via WebSocket
|
|
232
|
+
↓
|
|
233
|
+
xterm.js renders output
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Git Operation Flow
|
|
237
|
+
```
|
|
238
|
+
User stages file in UI
|
|
239
|
+
↓
|
|
240
|
+
FileActions calls POST /api/project/:name/git/stage
|
|
241
|
+
↓
|
|
242
|
+
GitService runs git add <file>
|
|
243
|
+
↓
|
|
244
|
+
GitStatusPanel refreshes: GET /api/project/:name/git/status
|
|
245
|
+
↓
|
|
246
|
+
UI updates staged/unstaged lists
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Critical Types
|
|
250
|
+
|
|
251
|
+
| Type | Location | Purpose |
|
|
252
|
+
|---|---|---|
|
|
253
|
+
| `ApiResponse<T>` | types/api.ts | Standard envelope for all REST responses |
|
|
254
|
+
| `AIProvider` | providers/provider.interface.ts | Interface for AI model adapters |
|
|
255
|
+
| `ChatEvent` | types/chat.ts | Union of streaming message types |
|
|
256
|
+
| `GitStatus` | types/git.ts | Current branch, staged, unstaged, untracked files |
|
|
257
|
+
| `Session` | types/chat.ts | Chat session with ID, projectName, title, createdAt |
|
|
258
|
+
| `Project` | types/project.ts | Project config (name, path) |
|
|
259
|
+
|
|
260
|
+
## External Dependencies
|
|
261
|
+
|
|
262
|
+
| Package | Purpose | Version |
|
|
263
|
+
|---------|---------|---------|
|
|
264
|
+
| hono | HTTP framework | 4.12.8 |
|
|
265
|
+
| simple-git | Git CLI wrapper | 3.33 |
|
|
266
|
+
| @uiw/react-codemirror | Code editor | 4.25.8 |
|
|
267
|
+
| xterm | Terminal emulator | 6.0 |
|
|
268
|
+
| zustand | State management | 5.0.11 |
|
|
269
|
+
| @anthropic-ai/claude-agent-sdk | AI provider | 0.2.76 |
|
|
270
|
+
| vite | Frontend bundler | 8.0 |
|
|
271
|
+
| tailwindcss | Utility CSS | 4.2 |
|
|
272
|
+
| radix-ui | Accessible components | 1.4.3 |
|
|
273
|
+
| next-themes | Theme switcher | 0.4.6 |
|
|
274
|
+
|
|
275
|
+
## Build Output
|
|
276
|
+
|
|
277
|
+
**CLI Binary:** `dist/ppm` (compiled via `bun build --compile`)
|
|
278
|
+
- Single-file executable
|
|
279
|
+
- Includes embedded server + frontend assets
|
|
280
|
+
- Runnable on Linux/macOS without Bun installed
|
|
281
|
+
|
|
282
|
+
**Frontend:** `dist/web/` (Vite bundle)
|
|
283
|
+
- index.html + chunks
|
|
284
|
+
- PWA manifest, service worker
|
|
285
|
+
- Assets (~500KB gzipped)
|
|
286
|
+
|
|
287
|
+
## Testing Strategy
|
|
288
|
+
|
|
289
|
+
| Test Type | Location | Coverage |
|
|
290
|
+
|-----------|----------|----------|
|
|
291
|
+
| Unit | tests/unit/ | Services, utilities |
|
|
292
|
+
| Integration | tests/integration/ | API routes, WebSocket |
|
|
293
|
+
| E2E | None yet | Planned for v3 |
|
|
294
|
+
|