codevf 1.0.0 → 1.0.2
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/LICENSE +30 -21
- package/README.md +7 -2
- package/bin/codevf-mcp.js +11 -0
- package/dist/commands/fix.d.ts +5 -1
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +170 -13
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +72 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mcp-tools.d.ts +17 -0
- package/dist/commands/mcp-tools.d.ts.map +1 -0
- package/dist/commands/mcp-tools.js +237 -0
- package/dist/commands/mcp-tools.js.map +1 -0
- package/dist/commands/setup.d.ts +8 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +250 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/welcome.d.ts +9 -0
- package/dist/commands/welcome.d.ts.map +1 -0
- package/dist/commands/welcome.js +175 -0
- package/dist/commands/welcome.js.map +1 -0
- package/dist/index.js +263 -207
- package/dist/index.js.map +1 -1
- package/dist/lib/api/client.d.ts +28 -0
- package/dist/lib/api/client.d.ts.map +1 -0
- package/dist/lib/api/client.js +66 -0
- package/dist/lib/api/client.js.map +1 -0
- package/dist/lib/api/projects.d.ts +32 -0
- package/dist/lib/api/projects.d.ts.map +1 -0
- package/dist/lib/api/projects.js +61 -0
- package/dist/lib/api/projects.js.map +1 -0
- package/dist/lib/api/tasks.d.ts +36 -0
- package/dist/lib/api/tasks.d.ts.map +1 -0
- package/dist/lib/api/tasks.js +62 -0
- package/dist/lib/api/tasks.js.map +1 -0
- package/dist/lib/api/websocket.d.ts +50 -0
- package/dist/lib/api/websocket.d.ts.map +1 -0
- package/dist/lib/api/websocket.js +153 -0
- package/dist/lib/api/websocket.js.map +1 -0
- package/dist/lib/auth/oauth-flow.d.ts +37 -0
- package/dist/lib/auth/oauth-flow.d.ts.map +1 -0
- package/dist/lib/auth/oauth-flow.js +119 -0
- package/dist/lib/auth/oauth-flow.js.map +1 -0
- package/dist/lib/auth/token-manager.d.ts +26 -0
- package/dist/lib/auth/token-manager.d.ts.map +1 -0
- package/dist/lib/auth/token-manager.js +87 -0
- package/dist/lib/auth/token-manager.js.map +1 -0
- package/dist/lib/config/manager.d.ts +50 -0
- package/dist/lib/config/manager.d.ts.map +1 -0
- package/dist/lib/config/manager.js +84 -0
- package/dist/lib/config/manager.js.map +1 -0
- package/dist/lib/utils/errors.d.ts +28 -0
- package/dist/lib/utils/errors.d.ts.map +1 -0
- package/dist/lib/utils/errors.js +44 -0
- package/dist/lib/utils/errors.js.map +1 -0
- package/dist/lib/utils/logger.d.ts +20 -0
- package/dist/lib/utils/logger.d.ts.map +1 -0
- package/dist/lib/utils/logger.js +40 -0
- package/dist/lib/utils/logger.js.map +1 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +160 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/tools/chat.d.ts +30 -0
- package/dist/mcp/tools/chat.d.ts.map +1 -0
- package/dist/mcp/tools/chat.js +82 -0
- package/dist/mcp/tools/chat.js.map +1 -0
- package/dist/mcp/tools/instant.d.ts +38 -0
- package/dist/mcp/tools/instant.d.ts.map +1 -0
- package/dist/mcp/tools/instant.js +106 -0
- package/dist/mcp/tools/instant.js.map +1 -0
- package/dist/modules/aiAgent.d.ts +75 -0
- package/dist/modules/aiAgent.d.ts.map +1 -0
- package/dist/modules/aiAgent.js +707 -0
- package/dist/modules/aiAgent.js.map +1 -0
- package/dist/modules/api.d.ts +7 -0
- package/dist/modules/api.d.ts.map +1 -1
- package/dist/modules/api.js +13 -4
- package/dist/modules/api.js.map +1 -1
- package/dist/modules/commandHandler.d.ts +40 -0
- package/dist/modules/commandHandler.d.ts.map +1 -0
- package/dist/modules/commandHandler.js +328 -0
- package/dist/modules/commandHandler.js.map +1 -0
- package/dist/modules/config.d.ts +2 -0
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +9 -0
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +83 -0
- package/dist/modules/constants.d.ts.map +1 -0
- package/dist/modules/constants.js +75 -0
- package/dist/modules/constants.js.map +1 -0
- package/dist/modules/permissions.d.ts +14 -0
- package/dist/modules/permissions.d.ts.map +1 -1
- package/dist/modules/permissions.js +94 -0
- package/dist/modules/permissions.js.map +1 -1
- package/dist/modules/toolRegistry.d.ts +50 -0
- package/dist/modules/toolRegistry.d.ts.map +1 -0
- package/dist/modules/toolRegistry.js +114 -0
- package/dist/modules/toolRegistry.js.map +1 -0
- package/dist/modules/tunnel.d.ts +33 -0
- package/dist/modules/tunnel.d.ts.map +1 -0
- package/dist/modules/tunnel.js +79 -0
- package/dist/modules/tunnel.js.map +1 -0
- package/dist/modules/vibeHelper.d.ts +16 -0
- package/dist/modules/vibeHelper.d.ts.map +1 -0
- package/dist/modules/vibeHelper.js +38 -0
- package/dist/modules/vibeHelper.js.map +1 -0
- package/dist/modules/websocket.d.ts +9 -0
- package/dist/modules/websocket.d.ts.map +1 -1
- package/dist/modules/websocket.js +70 -0
- package/dist/modules/websocket.js.map +1 -1
- package/dist/tools/consultEngineer.d.ts +13 -0
- package/dist/tools/consultEngineer.d.ts.map +1 -0
- package/dist/tools/consultEngineer.js +161 -0
- package/dist/tools/consultEngineer.js.map +1 -0
- package/dist/tools/realtimeChat.d.ts +9 -0
- package/dist/tools/realtimeChat.d.ts.map +1 -0
- package/dist/tools/realtimeChat.js +101 -0
- package/dist/tools/realtimeChat.js.map +1 -0
- package/dist/types/index.d.ts +183 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/ui/InteractiveApp.d.ts +13 -0
- package/dist/ui/InteractiveApp.d.ts.map +1 -0
- package/dist/ui/InteractiveApp.js +84 -0
- package/dist/ui/InteractiveApp.js.map +1 -0
- package/dist/ui/InteractivePrompt.d.ts +53 -0
- package/dist/ui/InteractivePrompt.d.ts.map +1 -0
- package/dist/ui/InteractivePrompt.js +422 -0
- package/dist/ui/InteractivePrompt.js.map +1 -0
- package/dist/ui/LiveSession.d.ts +2 -0
- package/dist/ui/LiveSession.d.ts.map +1 -1
- package/dist/ui/LiveSession.js +461 -180
- package/dist/ui/LiveSession.js.map +1 -1
- package/dist/ui/PromptInput.d.ts +14 -0
- package/dist/ui/PromptInput.d.ts.map +1 -0
- package/dist/ui/PromptInput.js +206 -0
- package/dist/ui/PromptInput.js.map +1 -0
- package/dist/ui/SessionUI.d.ts +40 -0
- package/dist/ui/SessionUI.d.ts.map +1 -0
- package/dist/ui/SessionUI.js +218 -0
- package/dist/ui/SessionUI.js.map +1 -0
- package/dist/ui/input/Command.d.ts +22 -0
- package/dist/ui/input/Command.d.ts.map +1 -0
- package/dist/ui/input/Command.js +30 -0
- package/dist/ui/input/Command.js.map +1 -0
- package/dist/ui/input/CustomInput.d.ts +15 -0
- package/dist/ui/input/CustomInput.d.ts.map +1 -0
- package/dist/ui/input/CustomInput.js +182 -0
- package/dist/ui/input/CustomInput.js.map +1 -0
- package/dist/ui/input/handlers/handleCursor.d.ts +22 -0
- package/dist/ui/input/handlers/handleCursor.d.ts.map +1 -0
- package/dist/ui/input/handlers/handleCursor.js +53 -0
- package/dist/ui/input/handlers/handleCursor.js.map +1 -0
- package/dist/ui/input/handlers/handleEdit.d.ts +18 -0
- package/dist/ui/input/handlers/handleEdit.d.ts.map +1 -0
- package/dist/ui/input/handlers/handleEdit.js +55 -0
- package/dist/ui/input/handlers/handleEdit.js.map +1 -0
- package/dist/ui/input/handlers/handleHistory.d.ts +18 -0
- package/dist/ui/input/handlers/handleHistory.d.ts.map +1 -0
- package/dist/ui/input/handlers/handleHistory.js +85 -0
- package/dist/ui/input/handlers/handleHistory.js.map +1 -0
- package/dist/ui/input/handlers/handlePaste.d.ts +19 -0
- package/dist/ui/input/handlers/handlePaste.d.ts.map +1 -0
- package/dist/ui/input/handlers/handlePaste.js +49 -0
- package/dist/ui/input/handlers/handlePaste.js.map +1 -0
- package/dist/ui/input/handlers/handleSubmit.d.ts +18 -0
- package/dist/ui/input/handlers/handleSubmit.d.ts.map +1 -0
- package/dist/ui/input/handlers/handleSubmit.js +39 -0
- package/dist/ui/input/handlers/handleSubmit.js.map +1 -0
- package/dist/ui/input/helpers.d.ts +4 -0
- package/dist/ui/input/helpers.d.ts.map +1 -0
- package/dist/ui/input/helpers.js +13 -0
- package/dist/ui/input/helpers.js.map +1 -0
- package/dist/ui/input/keyMatchers.d.ts +14 -0
- package/dist/ui/input/keyMatchers.d.ts.map +1 -0
- package/dist/ui/input/keyMatchers.js +49 -0
- package/dist/ui/input/keyMatchers.js.map +1 -0
- package/dist/ui/input/types.d.ts +33 -0
- package/dist/ui/input/types.d.ts.map +1 -0
- package/dist/ui/input/types.js +2 -0
- package/dist/ui/input/types.js.map +1 -0
- package/dist/ui/promptWithModes.d.ts +12 -0
- package/dist/ui/promptWithModes.d.ts.map +1 -0
- package/dist/ui/promptWithModes.js +24 -0
- package/dist/ui/promptWithModes.js.map +1 -0
- package/dist/ui/renderPrompt.d.ts +12 -0
- package/dist/ui/renderPrompt.d.ts.map +1 -0
- package/dist/ui/renderPrompt.js +14 -0
- package/dist/ui/renderPrompt.js.map +1 -0
- package/dist/ui/simplePrompt.d.ts +7 -0
- package/dist/ui/simplePrompt.d.ts.map +1 -0
- package/dist/ui/simplePrompt.js +38 -0
- package/dist/ui/simplePrompt.js.map +1 -0
- package/dist/ui/spinner.d.ts +7 -0
- package/dist/ui/spinner.d.ts.map +1 -0
- package/dist/ui/spinner.js +13 -0
- package/dist/ui/spinner.js.map +1 -0
- package/package.json +36 -26
- package/ARCHITECTURE.md +0 -285
- package/BUILD_SUMMARY.md +0 -340
- package/QUICKSTART.md +0 -180
package/ARCHITECTURE.md
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
# Architecture Overview
|
|
2
|
-
|
|
3
|
-
This document describes the internal architecture of the CodeVF CLI.
|
|
4
|
-
|
|
5
|
-
## High-Level Design
|
|
6
|
-
|
|
7
|
-
The CLI is designed as a **transport layer** between the customer and the CodeVF backend. It does not contain business logic - all intelligence lives in the backend.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
┌──────────────┐
|
|
11
|
-
│ Customer │
|
|
12
|
-
└──────┬───────┘
|
|
13
|
-
│
|
|
14
|
-
├─ Commands (login, init, sync, fix)
|
|
15
|
-
│
|
|
16
|
-
┌──────▼───────────────────────────────────────┐
|
|
17
|
-
│ CodeVF CLI (Transport Layer) │
|
|
18
|
-
├──────────────────────────────────────────────┤
|
|
19
|
-
│ • Authentication │
|
|
20
|
-
│ • Configuration Management │
|
|
21
|
-
│ • WebSocket Client │
|
|
22
|
-
│ • Permission Manager │
|
|
23
|
-
│ • Terminal UI (Ink/React) │
|
|
24
|
-
└──────┬───────────────────────────────────────┘
|
|
25
|
-
│
|
|
26
|
-
│ HTTPS/WSS
|
|
27
|
-
│
|
|
28
|
-
┌──────▼───────────────────────────────────────┐
|
|
29
|
-
│ CodeVF Backend (Business Logic) │
|
|
30
|
-
├──────────────────────────────────────────────┤
|
|
31
|
-
│ • Engineer Matching │
|
|
32
|
-
│ • Task Management │
|
|
33
|
-
│ • Billing │
|
|
34
|
-
│ • Code Analysis │
|
|
35
|
-
│ • AI Tool Integration │
|
|
36
|
-
└──────────────────────────────────────────────┘
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Module Structure
|
|
40
|
-
|
|
41
|
-
### Commands Layer (`src/commands/`)
|
|
42
|
-
Entry points for CLI commands. Thin wrappers that orchestrate modules.
|
|
43
|
-
|
|
44
|
-
- **login.ts**: OAuth flow initiation and polling
|
|
45
|
-
- **logout.ts**: Clear local authentication
|
|
46
|
-
- **init.ts**: Project initialization wizard
|
|
47
|
-
- **sync.ts**: Git sync workflow
|
|
48
|
-
- **fix.tsx**: Live debugging session orchestration
|
|
49
|
-
|
|
50
|
-
### Modules Layer (`src/modules/`)
|
|
51
|
-
Core business logic and external integrations.
|
|
52
|
-
|
|
53
|
-
#### AuthManager (`auth.ts`)
|
|
54
|
-
- Manages authentication tokens
|
|
55
|
-
- Stores in `~/.config/codevf/auth.json` with 0600 permissions
|
|
56
|
-
- Token expiration checking
|
|
57
|
-
- Auto-refresh (future)
|
|
58
|
-
|
|
59
|
-
#### ConfigManager (`config.ts`)
|
|
60
|
-
- Manages project configuration
|
|
61
|
-
- Stores in `.codevf/config.json`
|
|
62
|
-
- Tracks last sync metadata
|
|
63
|
-
- Cache management
|
|
64
|
-
|
|
65
|
-
#### ApiClient (`api.ts`)
|
|
66
|
-
- HTTP client wrapper around axios
|
|
67
|
-
- Automatic auth token injection
|
|
68
|
-
- Error handling and retry logic
|
|
69
|
-
- All backend API endpoints
|
|
70
|
-
|
|
71
|
-
#### WebSocketClient (`websocket.ts`)
|
|
72
|
-
- Real-time communication channel
|
|
73
|
-
- Auto-reconnection with exponential backoff
|
|
74
|
-
- Event-based message handling
|
|
75
|
-
- Connection state management
|
|
76
|
-
|
|
77
|
-
#### GitManager (`git.ts`)
|
|
78
|
-
- Git operations wrapper
|
|
79
|
-
- Branch management
|
|
80
|
-
- Commit tracking
|
|
81
|
-
- Status checking
|
|
82
|
-
|
|
83
|
-
#### PermissionManager (`permissions.ts`)
|
|
84
|
-
- Interactive permission prompts
|
|
85
|
-
- Command approval
|
|
86
|
-
- File access approval
|
|
87
|
-
- Warning for sensitive files
|
|
88
|
-
|
|
89
|
-
### UI Layer (`src/ui/`)
|
|
90
|
-
Terminal-based user interfaces built with Ink (React for terminals).
|
|
91
|
-
|
|
92
|
-
#### LiveSession (`LiveSession.tsx`)
|
|
93
|
-
Real-time chat interface with:
|
|
94
|
-
- Message history display
|
|
95
|
-
- Input handling
|
|
96
|
-
- Engineer info display
|
|
97
|
-
- Billing display
|
|
98
|
-
- Permission request overlays
|
|
99
|
-
|
|
100
|
-
### Types Layer (`src/types/`)
|
|
101
|
-
TypeScript type definitions for:
|
|
102
|
-
- API contracts
|
|
103
|
-
- WebSocket messages
|
|
104
|
-
- Configuration schemas
|
|
105
|
-
- Error types
|
|
106
|
-
|
|
107
|
-
### Utils Layer (`src/utils/`)
|
|
108
|
-
Utility functions:
|
|
109
|
-
- **errors.ts**: Error handling and formatting
|
|
110
|
-
- **detect.ts**: Project type detection
|
|
111
|
-
- **upload.ts**: Repo archiving and upload
|
|
112
|
-
|
|
113
|
-
## Data Flow
|
|
114
|
-
|
|
115
|
-
### 1. Authentication Flow
|
|
116
|
-
```
|
|
117
|
-
Customer CLI Backend
|
|
118
|
-
│ │ │
|
|
119
|
-
│─ codevf login ─▶│ │
|
|
120
|
-
│ │─ POST /auth/init ─▶│
|
|
121
|
-
│ │◀─ {authUrl, poll} ─│
|
|
122
|
-
│◀─ Open browser ─│ │
|
|
123
|
-
│ │ │
|
|
124
|
-
│─ Authorize ─────────────────────────▶│
|
|
125
|
-
│ │ │
|
|
126
|
-
│ │─ Poll /auth/token ─▶│
|
|
127
|
-
│ │◀─ {tokens} ────────│
|
|
128
|
-
│ │ │
|
|
129
|
-
│◀─ Success ──────│ │
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### 2. Init Flow
|
|
133
|
-
```
|
|
134
|
-
Customer CLI Backend
|
|
135
|
-
│ │ │
|
|
136
|
-
│─ codevf init ──▶│ │
|
|
137
|
-
│ │─ Detect project ──│
|
|
138
|
-
│◀─ Wizard ───────│ │
|
|
139
|
-
│─ Answers ───────▶│ │
|
|
140
|
-
│ │─ POST /project/init▶│
|
|
141
|
-
│ │◀─ {projectId} ─────│
|
|
142
|
-
│ │─ Upload code ──────▶│
|
|
143
|
-
│ │─ Save config ──────│
|
|
144
|
-
│◀─ Summary ──────│ │
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### 3. Fix Session Flow
|
|
148
|
-
```
|
|
149
|
-
Customer CLI Backend Engineer
|
|
150
|
-
│ │ │ │
|
|
151
|
-
│─ codevf fix ───▶│ │ │
|
|
152
|
-
│ │─ POST /tasks/create▶│ │
|
|
153
|
-
│ │◀─ {taskId} ────────│ │
|
|
154
|
-
│ │─ WS Connect ───────▶│ │
|
|
155
|
-
│ │ │◀─ Accept task ─│
|
|
156
|
-
│ │◀─ engineer_connected◀───────────────│
|
|
157
|
-
│◀─ UI renders ──│ │ │
|
|
158
|
-
│ │ │ │
|
|
159
|
-
│◀─ Message ─────│◀─ engineer_message◀───────────────│
|
|
160
|
-
│─ Reply ────────▶│─ customer_message ──▶───────────▶│
|
|
161
|
-
│ │ │ │
|
|
162
|
-
│ │◀─ request_command ◀───────────────│
|
|
163
|
-
│◀─ Approve? ────│ │ │
|
|
164
|
-
│─ Yes ──────────▶│─ Run command ──────│ │
|
|
165
|
-
│ │─ command_output ────▶──────────────▶│
|
|
166
|
-
│ │ │ │
|
|
167
|
-
│─ CTRL+C ───────▶│─ end_session ──────▶│ │
|
|
168
|
-
│◀─ Rate ────────│ │ │
|
|
169
|
-
│─ Rating ───────▶│─ POST /tasks/rate ─▶│ │
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
## Security Model
|
|
173
|
-
|
|
174
|
-
### Authentication
|
|
175
|
-
- OAuth 2.0 with PKCE (backend handles)
|
|
176
|
-
- JWT access tokens
|
|
177
|
-
- Refresh tokens for long-lived sessions
|
|
178
|
-
- Tokens stored with 0600 file permissions
|
|
179
|
-
|
|
180
|
-
### Permission System
|
|
181
|
-
- **Command Execution**: Explicit approval required
|
|
182
|
-
- **File Access**: Per-file approval
|
|
183
|
-
- **Git Access**: Restricted to `codevf` branch
|
|
184
|
-
- **Code Upload**: Opt-in only
|
|
185
|
-
|
|
186
|
-
### Network Security
|
|
187
|
-
- All HTTP over TLS (HTTPS)
|
|
188
|
-
- All WebSocket over TLS (WSS)
|
|
189
|
-
- Certificate pinning (future)
|
|
190
|
-
- Request signing for sensitive ops (future)
|
|
191
|
-
|
|
192
|
-
## Error Handling
|
|
193
|
-
|
|
194
|
-
### Error Hierarchy
|
|
195
|
-
```
|
|
196
|
-
CodeVFError (base)
|
|
197
|
-
├── AuthError
|
|
198
|
-
├── NetworkError
|
|
199
|
-
├── ConfigError
|
|
200
|
-
├── PermissionError
|
|
201
|
-
└── GitError
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Error Recovery
|
|
205
|
-
- **Network errors**: Auto-retry with backoff
|
|
206
|
-
- **Auth errors**: Prompt to re-login
|
|
207
|
-
- **Config errors**: Guide to initialization
|
|
208
|
-
- **Git errors**: Provide git commands to fix
|
|
209
|
-
|
|
210
|
-
## Extension Points
|
|
211
|
-
|
|
212
|
-
### Future Enhancements
|
|
213
|
-
1. **Plugin System**: Custom commands via plugins
|
|
214
|
-
2. **Hooks**: Pre/post command hooks
|
|
215
|
-
3. **Custom UI Themes**: Terminal color schemes
|
|
216
|
-
4. **Local AI**: Optional local AI assistance
|
|
217
|
-
5. **Multi-Project**: Manage multiple projects
|
|
218
|
-
6. **Session Recording**: Record/replay sessions
|
|
219
|
-
|
|
220
|
-
## Performance Considerations
|
|
221
|
-
|
|
222
|
-
### Optimization Strategies
|
|
223
|
-
- **Lazy Loading**: Load modules on-demand
|
|
224
|
-
- **Streaming**: Stream large file uploads
|
|
225
|
-
- **Compression**: Gzip HTTP responses
|
|
226
|
-
- **Caching**: Cache project metadata
|
|
227
|
-
- **Debouncing**: Debounce rapid WebSocket messages
|
|
228
|
-
|
|
229
|
-
### Resource Limits
|
|
230
|
-
- Max file size: 10MB per file
|
|
231
|
-
- Max message size: 64KB
|
|
232
|
-
- WebSocket timeout: 5 minutes idle
|
|
233
|
-
- HTTP timeout: 30 seconds default, 2 minutes for uploads
|
|
234
|
-
|
|
235
|
-
## Testing Strategy
|
|
236
|
-
|
|
237
|
-
### Unit Tests
|
|
238
|
-
- Pure functions in utils/
|
|
239
|
-
- Module methods with mocked dependencies
|
|
240
|
-
- React components with ink-testing-library
|
|
241
|
-
|
|
242
|
-
### Integration Tests
|
|
243
|
-
- Command flows with mocked API
|
|
244
|
-
- WebSocket message handling
|
|
245
|
-
- Git operations with test repo
|
|
246
|
-
|
|
247
|
-
### E2E Tests (future)
|
|
248
|
-
- Full command flows against staging backend
|
|
249
|
-
- Real OAuth flow
|
|
250
|
-
- Real WebSocket connections
|
|
251
|
-
|
|
252
|
-
## Deployment
|
|
253
|
-
|
|
254
|
-
### Build Process
|
|
255
|
-
```bash
|
|
256
|
-
npm run build # TypeScript → JavaScript
|
|
257
|
-
npm link # Symlink for local testing
|
|
258
|
-
npm publish # Publish to NPM registry
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Distribution
|
|
262
|
-
- **NPM Registry**: Primary distribution
|
|
263
|
-
- **Homebrew**: macOS package manager
|
|
264
|
-
- **apt/yum**: Linux package managers
|
|
265
|
-
- **Scoop/Chocolatey**: Windows package managers
|
|
266
|
-
|
|
267
|
-
### Versioning
|
|
268
|
-
- Semantic Versioning (semver)
|
|
269
|
-
- Breaking changes: Major version bump
|
|
270
|
-
- New features: Minor version bump
|
|
271
|
-
- Bug fixes: Patch version bump
|
|
272
|
-
|
|
273
|
-
## Monitoring & Telemetry
|
|
274
|
-
|
|
275
|
-
### Metrics (opt-in)
|
|
276
|
-
- Command usage
|
|
277
|
-
- Error rates
|
|
278
|
-
- Session duration
|
|
279
|
-
- Platform distribution
|
|
280
|
-
|
|
281
|
-
### Privacy
|
|
282
|
-
- No PII collected
|
|
283
|
-
- No code sent without consent
|
|
284
|
-
- Anonymized metrics only
|
|
285
|
-
- Opt-out available
|
package/BUILD_SUMMARY.md
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
# CodeVF CLI - Build Summary
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
Successfully built a fully-functional CLI tool for CodeVF that enables customers to:
|
|
6
|
-
- Authenticate with OAuth
|
|
7
|
-
- Initialize projects
|
|
8
|
-
- Upload code metadata
|
|
9
|
-
- Start live debugging sessions with engineers
|
|
10
|
-
- Safely interact with engineers in the terminal
|
|
11
|
-
- Manage Git branches
|
|
12
|
-
- Track credit usage
|
|
13
|
-
|
|
14
|
-
## What Was Built
|
|
15
|
-
|
|
16
|
-
### 1. Core Infrastructure ✅
|
|
17
|
-
- **TypeScript Project**: Full TypeScript setup with ESM modules
|
|
18
|
-
- **Package Configuration**: Modern Node.js package with all dependencies
|
|
19
|
-
- **Build System**: TypeScript compilation to dist/
|
|
20
|
-
- **CLI Framework**: yargs-based command routing
|
|
21
|
-
|
|
22
|
-
### 2. Authentication System ✅
|
|
23
|
-
- **AuthManager**: Token storage and management
|
|
24
|
-
- **OAuth Flow**: Browser-based authentication
|
|
25
|
-
- **Secure Storage**: ~/.config/codevf/auth.json with 0600 permissions
|
|
26
|
-
- **Token Expiration**: Automatic expiration checking
|
|
27
|
-
|
|
28
|
-
### 3. Project Management ✅
|
|
29
|
-
- **ConfigManager**: .codevf/config.json management
|
|
30
|
-
- **Project Detection**: Auto-detect Node, Python, Go, Ruby, Java, Rust
|
|
31
|
-
- **Init Wizard**: Interactive project setup with prompts
|
|
32
|
-
- **Code Upload**: Zip and upload project snapshot
|
|
33
|
-
|
|
34
|
-
### 4. Git Integration ✅
|
|
35
|
-
- **GitManager**: Wrapper around simple-git
|
|
36
|
-
- **Branch Management**: Create and switch to codevf branch
|
|
37
|
-
- **Sync Command**: Sync commits with backend
|
|
38
|
-
- **Dirty State Detection**: Prevent sync with uncommitted changes
|
|
39
|
-
|
|
40
|
-
### 5. Live Debugging Session ✅
|
|
41
|
-
- **WebSocket Client**: Real-time bidirectional communication
|
|
42
|
-
- **Live UI**: Ink/React-based terminal interface
|
|
43
|
-
- **Chat Interface**: Engineer ↔ Customer messaging
|
|
44
|
-
- **Permission System**: Approve commands and file access
|
|
45
|
-
- **Billing Display**: Real-time credit tracking
|
|
46
|
-
- **Session Management**: Start, run, end with rating
|
|
47
|
-
|
|
48
|
-
### 6. API Client ✅
|
|
49
|
-
- **HTTP Client**: axios-based wrapper
|
|
50
|
-
- **All Endpoints**: login, init, sync, tasks, upload
|
|
51
|
-
- **Error Handling**: Network, auth, and API errors
|
|
52
|
-
- **Auto-retry**: Connection retry logic
|
|
53
|
-
|
|
54
|
-
### 7. Security Features ✅
|
|
55
|
-
- **Permission Requests**: Every command requires approval
|
|
56
|
-
- **File Warnings**: Warn about sensitive files
|
|
57
|
-
- **Secure Storage**: Proper file permissions
|
|
58
|
-
- **Branch Isolation**: Engineers limited to codevf branch
|
|
59
|
-
|
|
60
|
-
## File Structure
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
CodeVF-CLI/
|
|
64
|
-
├── src/
|
|
65
|
-
│ ├── commands/ # CLI command implementations
|
|
66
|
-
│ │ ├── login.ts # OAuth authentication
|
|
67
|
-
│ │ ├── logout.ts # Clear auth
|
|
68
|
-
│ │ ├── init.ts # Project initialization wizard
|
|
69
|
-
│ │ ├── sync.ts # Git sync
|
|
70
|
-
│ │ └── fix.tsx # Live debug session
|
|
71
|
-
│ ├── modules/ # Core modules
|
|
72
|
-
│ │ ├── auth.ts # Auth token management
|
|
73
|
-
│ │ ├── config.ts # Config file management
|
|
74
|
-
│ │ ├── api.ts # HTTP API client
|
|
75
|
-
│ │ ├── git.ts # Git operations
|
|
76
|
-
│ │ ├── websocket.ts # WebSocket client
|
|
77
|
-
│ │ └── permissions.ts # Permission manager
|
|
78
|
-
│ ├── ui/ # Terminal UI
|
|
79
|
-
│ │ └── LiveSession.tsx # Ink-based live session UI
|
|
80
|
-
│ ├── types/
|
|
81
|
-
│ │ └── index.ts # TypeScript types
|
|
82
|
-
│ ├── utils/
|
|
83
|
-
│ │ ├── errors.ts # Error handling
|
|
84
|
-
│ │ ├── detect.ts # Project detection
|
|
85
|
-
│ │ └── upload.ts # File upload utilities
|
|
86
|
-
│ └── index.ts # CLI entry point
|
|
87
|
-
├── dist/ # Compiled JavaScript
|
|
88
|
-
├── claude.md # Technical specification
|
|
89
|
-
├── ARCHITECTURE.md # Architecture documentation
|
|
90
|
-
├── QUICKSTART.md # Quick start guide
|
|
91
|
-
├── CONTRIBUTING.md # Contribution guide
|
|
92
|
-
├── README.md # User documentation
|
|
93
|
-
├── package.json # NPM package config
|
|
94
|
-
├── tsconfig.json # TypeScript config
|
|
95
|
-
└── jest.config.js # Test configuration
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Commands Implemented
|
|
99
|
-
|
|
100
|
-
### ✅ `codevf login`
|
|
101
|
-
- Opens browser for OAuth
|
|
102
|
-
- Polls backend for token
|
|
103
|
-
- Saves to ~/.config/codevf/auth.json
|
|
104
|
-
- Validates and shows success
|
|
105
|
-
|
|
106
|
-
### ✅ `codevf logout`
|
|
107
|
-
- Clears auth.json
|
|
108
|
-
- Shows confirmation
|
|
109
|
-
|
|
110
|
-
### ✅ `codevf init`
|
|
111
|
-
- Detects project type
|
|
112
|
-
- Interactive wizard with prompts
|
|
113
|
-
- Configures test/build commands
|
|
114
|
-
- Allows AI tool selection
|
|
115
|
-
- Optional code upload
|
|
116
|
-
- Creates .codevf/config.json
|
|
117
|
-
- Registers with backend
|
|
118
|
-
|
|
119
|
-
### ✅ `codevf sync`
|
|
120
|
-
- Checks git status
|
|
121
|
-
- Validates branch
|
|
122
|
-
- Gets commit hash
|
|
123
|
-
- Syncs with backend
|
|
124
|
-
- Saves last sync metadata
|
|
125
|
-
- Shows summary
|
|
126
|
-
|
|
127
|
-
### ✅ `codevf fix "<issue>"`
|
|
128
|
-
- Creates task in backend
|
|
129
|
-
- Connects WebSocket
|
|
130
|
-
- Renders live UI with Ink
|
|
131
|
-
- Handles chat messages
|
|
132
|
-
- Manages permission requests
|
|
133
|
-
- Executes approved commands
|
|
134
|
-
- Uploads approved files
|
|
135
|
-
- Displays screenshare links
|
|
136
|
-
- Shows real-time billing
|
|
137
|
-
- Handles CTRL+C gracefully
|
|
138
|
-
- Collects engineer rating
|
|
139
|
-
|
|
140
|
-
## Technology Stack
|
|
141
|
-
|
|
142
|
-
### Dependencies Installed
|
|
143
|
-
```json
|
|
144
|
-
{
|
|
145
|
-
"yargs": "^17.7.2", // CLI framework
|
|
146
|
-
"ink": "^4.4.1", // Terminal UI
|
|
147
|
-
"react": "^18.2.0", // UI components
|
|
148
|
-
"ws": "^8.16.0", // WebSocket client
|
|
149
|
-
"axios": "^1.6.7", // HTTP client
|
|
150
|
-
"ora": "^8.0.1", // Loading spinners
|
|
151
|
-
"chalk": "^5.3.0", // Terminal colors
|
|
152
|
-
"prompts": "^2.4.2", // Interactive prompts
|
|
153
|
-
"archiver": "^6.0.1", // Zip creation
|
|
154
|
-
"open": "^10.0.3", // Browser opener
|
|
155
|
-
"simple-git": "^3.22.0", // Git operations
|
|
156
|
-
"ignore": "^5.3.0", // .gitignore parsing
|
|
157
|
-
"uuid": "^9.0.1", // UUID generation
|
|
158
|
-
"date-fns": "^3.3.1" // Date formatting
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Dev Dependencies
|
|
163
|
-
- TypeScript 5.3.3
|
|
164
|
-
- tsx (development runner)
|
|
165
|
-
- ESLint + TypeScript plugin
|
|
166
|
-
- Prettier
|
|
167
|
-
- Jest + ts-jest
|
|
168
|
-
- @types/* for all packages
|
|
169
|
-
|
|
170
|
-
## Build & Test
|
|
171
|
-
|
|
172
|
-
### Build Successfully ✅
|
|
173
|
-
```bash
|
|
174
|
-
npm run build
|
|
175
|
-
# Compiles TypeScript to dist/
|
|
176
|
-
# Generates .d.ts type definitions
|
|
177
|
-
# Creates source maps
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### CLI Works ✅
|
|
181
|
-
```bash
|
|
182
|
-
node dist/index.js --help
|
|
183
|
-
# Shows all commands
|
|
184
|
-
|
|
185
|
-
node dist/index.js --version
|
|
186
|
-
# Shows version 1.0.0
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Key Features Implemented
|
|
190
|
-
|
|
191
|
-
### 🎯 Core Requirements Met
|
|
192
|
-
- ✅ Works on macOS, Linux, Windows (Node.js cross-platform)
|
|
193
|
-
- ✅ No root/admin required
|
|
194
|
-
- ✅ HTTPS for all API calls
|
|
195
|
-
- ✅ Secure local token storage
|
|
196
|
-
- ✅ Simple transport layer (no business logic)
|
|
197
|
-
|
|
198
|
-
### 🔒 Security
|
|
199
|
-
- ✅ File permissions (0600 for auth.json)
|
|
200
|
-
- ✅ Permission requests for all actions
|
|
201
|
-
- ✅ Sensitive file warnings
|
|
202
|
-
- ✅ Branch isolation (codevf branch)
|
|
203
|
-
- ✅ Opt-in code upload
|
|
204
|
-
|
|
205
|
-
### 🎨 User Experience
|
|
206
|
-
- ✅ Interactive wizards
|
|
207
|
-
- ✅ Auto-detection of project type
|
|
208
|
-
- ✅ Beautiful terminal UI with Ink
|
|
209
|
-
- ✅ Loading spinners and progress
|
|
210
|
-
- ✅ Color-coded messages
|
|
211
|
-
- ✅ Clear error messages
|
|
212
|
-
- ✅ Helpful hints and next steps
|
|
213
|
-
|
|
214
|
-
### 🔌 Backend Integration
|
|
215
|
-
- ✅ All API endpoints implemented
|
|
216
|
-
- ✅ WebSocket for real-time communication
|
|
217
|
-
- ✅ Auto-reconnection logic
|
|
218
|
-
- ✅ Error handling and retry
|
|
219
|
-
- ✅ Token refresh preparation
|
|
220
|
-
|
|
221
|
-
## What's Not Included (Non-Goals)
|
|
222
|
-
|
|
223
|
-
As per specification:
|
|
224
|
-
- ❌ PR creation from CLI (backend handles)
|
|
225
|
-
- ❌ Local AI models
|
|
226
|
-
- ❌ Code generation
|
|
227
|
-
- ❌ Async task queues
|
|
228
|
-
- ❌ Engineer assignment logic
|
|
229
|
-
- ❌ GitHub/GitLab token management
|
|
230
|
-
- ❌ Business logic (all in backend)
|
|
231
|
-
|
|
232
|
-
## Testing Status
|
|
233
|
-
|
|
234
|
-
### Ready for Testing
|
|
235
|
-
- ✅ Build succeeds
|
|
236
|
-
- ✅ CLI entry point works
|
|
237
|
-
- ✅ All commands registered
|
|
238
|
-
- ✅ Help system works
|
|
239
|
-
- ✅ Version display works
|
|
240
|
-
|
|
241
|
-
### Needs Backend
|
|
242
|
-
The CLI is a complete transport layer but requires the backend API to be running for full functionality:
|
|
243
|
-
- Authentication endpoints
|
|
244
|
-
- Project management endpoints
|
|
245
|
-
- Task creation and WebSocket
|
|
246
|
-
- File upload endpoint
|
|
247
|
-
|
|
248
|
-
### Test Checklist
|
|
249
|
-
- [ ] Login flow with real OAuth
|
|
250
|
-
- [ ] Init wizard with actual project
|
|
251
|
-
- [ ] Code upload to real backend
|
|
252
|
-
- [ ] Sync with real Git repo
|
|
253
|
-
- [ ] Live session with WebSocket
|
|
254
|
-
- [ ] Permission workflows
|
|
255
|
-
- [ ] Error scenarios
|
|
256
|
-
- [ ] Cross-platform testing (macOS, Linux, Windows)
|
|
257
|
-
|
|
258
|
-
## Installation Methods
|
|
259
|
-
|
|
260
|
-
### Development
|
|
261
|
-
```bash
|
|
262
|
-
npm install
|
|
263
|
-
npm run build
|
|
264
|
-
npm link
|
|
265
|
-
codevf --help
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Production (when published)
|
|
269
|
-
```bash
|
|
270
|
-
npm install -g codevf-cli
|
|
271
|
-
codevf --help
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## Documentation Created
|
|
275
|
-
|
|
276
|
-
1. **claude.md** - Complete technical specification
|
|
277
|
-
2. **README.md** - User-facing documentation
|
|
278
|
-
3. **QUICKSTART.md** - 5-minute quick start guide
|
|
279
|
-
4. **ARCHITECTURE.md** - Internal architecture details
|
|
280
|
-
5. **CONTRIBUTING.md** - Contribution guidelines
|
|
281
|
-
6. **BUILD_SUMMARY.md** - This file
|
|
282
|
-
|
|
283
|
-
## Next Steps
|
|
284
|
-
|
|
285
|
-
### Before Production
|
|
286
|
-
1. **Backend Development**: Implement all API endpoints
|
|
287
|
-
2. **Integration Testing**: Test CLI against real backend
|
|
288
|
-
3. **Error Scenarios**: Test all error paths
|
|
289
|
-
4. **Cross-platform**: Test on Windows and Linux
|
|
290
|
-
5. **Security Audit**: Review auth and permission flows
|
|
291
|
-
6. **Performance**: Test with large repos
|
|
292
|
-
7. **Documentation**: Add API examples
|
|
293
|
-
|
|
294
|
-
### Future Enhancements
|
|
295
|
-
1. **Unit Tests**: Add Jest tests for modules
|
|
296
|
-
2. **E2E Tests**: Full workflow tests
|
|
297
|
-
3. **CI/CD**: GitHub Actions for build and test
|
|
298
|
-
4. **Plugin System**: Allow custom commands
|
|
299
|
-
5. **Local Cache**: Cache engineer profiles
|
|
300
|
-
6. **Session Recording**: Record/replay sessions
|
|
301
|
-
7. **Multiple Projects**: Switch between projects
|
|
302
|
-
8. **Offline Mode**: Basic commands without internet
|
|
303
|
-
|
|
304
|
-
## Success Metrics
|
|
305
|
-
|
|
306
|
-
### Technical ✅
|
|
307
|
-
- ✅ Zero TypeScript errors
|
|
308
|
-
- ✅ All dependencies installed
|
|
309
|
-
- ✅ Builds successfully
|
|
310
|
-
- ✅ CLI executable works
|
|
311
|
-
- ✅ Modular architecture
|
|
312
|
-
- ✅ Type-safe codebase
|
|
313
|
-
|
|
314
|
-
### User Experience ✅
|
|
315
|
-
- ✅ Clear command structure
|
|
316
|
-
- ✅ Helpful error messages
|
|
317
|
-
- ✅ Interactive wizards
|
|
318
|
-
- ✅ Real-time UI
|
|
319
|
-
- ✅ Permission prompts
|
|
320
|
-
- ✅ Billing transparency
|
|
321
|
-
|
|
322
|
-
### Security ✅
|
|
323
|
-
- ✅ Secure token storage
|
|
324
|
-
- ✅ Permission system
|
|
325
|
-
- ✅ File warnings
|
|
326
|
-
- ✅ Branch isolation
|
|
327
|
-
- ✅ No credential leaks
|
|
328
|
-
|
|
329
|
-
## Contact & Support
|
|
330
|
-
|
|
331
|
-
- **Issues**: Create a GitHub issue
|
|
332
|
-
- **Email**: support@codevf.com
|
|
333
|
-
- **Docs**: https://docs.codevf.com
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
**Built with**: TypeScript, Node.js, Ink, React, yargs
|
|
338
|
-
**License**: MIT
|
|
339
|
-
**Version**: 1.0.0
|
|
340
|
-
**Status**: Ready for backend integration ✅
|