dr-code-cli 1.0.0 → 1.0.3

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.
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  /**
2
3
  * Dr-Code CLI - Main Entry Point
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;GAEG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA;;GAEG"}
package/dist/cli/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
  /**
3
4
  * Dr-Code CLI - Main Entry Point
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,yCAAoC;AACpC,sEAA6C;AAE7C,kBAAkB;AAClB,8CAAkD;AAElD,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,mBAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,8BAA8B,CAAC;SAC3C,OAAO,CAAC,sBAAW,CAAC,OAAO,CAAC,CAAC;IAEhC,oBAAoB;IACpB,mBAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;IAElC,2BAA2B;IAC3B,mBAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,kCAAkC;IACpC,CAAC,CAAC,CAAC;IAEL,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,mCAAmC;IACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAClC,mBAAO,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;AAEA;;GAEG;;;;;AAEH,yCAAoC;AACpC,sEAA6C;AAE7C,kBAAkB;AAClB,8CAAkD;AAElD,MAAM,IAAI,GAAG,KAAK,IAAmB,EAAE;IACrC,mBAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,8BAA8B,CAAC;SAC3C,OAAO,CAAC,sBAAW,CAAC,OAAO,CAAC,CAAC;IAEhC,oBAAoB;IACpB,mBAAO,CAAC,UAAU,CAAC,sBAAa,CAAC,CAAC;IAElC,2BAA2B;IAC3B,mBAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,kCAAkC;IACpC,CAAC,CAAC,CAAC;IAEL,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,mCAAmC;IACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAClC,mBAAO,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;AAEF,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ // Uru ni rwo rugendo rugana kuri index.js yawe ya nyuma
5
+ const filePath = path.join(__dirname, 'dist/cli/index.js');
6
+
7
+ if (fs.existsSync(filePath)) {
8
+ const content = fs.readFileSync(filePath, 'utf8');
9
+ if (!content.startsWith('#!')) {
10
+ fs.writeFileSync(filePath, '#!/usr/bin/env node\n' + content);
11
+ console.log('Shebang added successfully to index.js!');
12
+ }
13
+ } else {
14
+ console.error('File not found, make sure you ran "npm run build" first.');
15
+ }
package/package.json CHANGED
@@ -1,28 +1,27 @@
1
1
  {
2
2
  "name": "dr-code-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Dr-Code: AI Terminal Coding Assistant - No Authentication Required!",
5
5
  "main": "dist/cli/index.js",
6
6
  "bin": {
7
- "dr-code": "./dist/cli/index.js"
7
+ "dr-code": "dist/cli/index.js"
8
8
  },
9
+ "files": [
10
+ "dist"
11
+ ],
9
12
  "scripts": {
10
- "build": "tsc",
13
+ "build": "tsc && node -e \"const fs=require('fs'); const f='dist/cli/index.js'; const c=fs.readFileSync(f,'utf8'); if(!c.startsWith('#!')) fs.writeFileSync(f,'#!/usr/bin/env node\\n'+c);\"",
11
14
  "start": "node dist/cli/index.js",
12
- "dev": "ts-node src/cli/index.js",
15
+ "dev": "ts-node src/cli/index.ts",
13
16
  "test": "jest",
14
17
  "lint": "eslint src/",
15
- "web:dev": "vite web-auth/src",
16
- "web:build": "vite build web-auth/src",
17
18
  "prepare": "npm run build"
18
19
  },
19
20
  "keywords": [
20
21
  "ai",
21
22
  "terminal",
22
23
  "cli",
23
- "coding-assistant",
24
- "tui",
25
- "no-authentication"
24
+ "coding-assistant"
26
25
  ],
27
26
  "author": "Seleman Lab",
28
27
  "license": "MIT",
@@ -53,4 +52,4 @@
53
52
  "engines": {
54
53
  "node": ">=18.0.0"
55
54
  }
56
- }
55
+ }
package/.env.example DELETED
@@ -1,10 +0,0 @@
1
- # API Keys (Add your provider keys here - no authentication required!)
2
-
3
- DR_CODE_GITHUB_KEY=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
4
- DR_CODE_GOOGLE_KEY=AQ.Ab8RN6KVlYddFqQHOEWBQv2RUsgG-cE_qOQERwAOIaigNxScxA
5
- DR_CODE_OPENROUTER_KEY=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
6
- DR_CODE_GROQ_KEY=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
7
- DR_CODE_HUGGINGFACE_KEY=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
8
-
9
- # Environment
10
- NODE_ENV=development
package/.eslintrc.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "extends": [
4
- "eslint:recommended",
5
- "plugin:@typescript-eslint/recommended"
6
- ],
7
- "env": {
8
- "node": true,
9
- "es2020": true
10
- },
11
- "rules": {
12
- "@typescript-eslint/no-explicit-any": "warn",
13
- "@typescript-eslint/explicit-function-return-types": "warn",
14
- "no-console": "off",
15
- "@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }]
16
- }
17
- }
package/instraction.txt DELETED
@@ -1,406 +0,0 @@
1
- # Build Dr-Code: AI Terminal Coding Assistant
2
-
3
- ## Project Overview
4
- Create **Dr-Code** - a terminal-based AI coding assistant with a polished TUI (Terminal User Interface) similar to Claude Code, OpenCode, and Codex CLI. Users must authenticate via Firebase before using the tool. It supports multiple AI APIs (GitHub, Google AI Studio, OpenRouter, Groq, Hugging Face) and makes it easy for users to insert their own API keys.
5
-
6
- ## Core Requirements
7
-
8
- ### 1. **Technology Stack**
9
- - **Language**: Node.js (TypeScript preferred)
10
- - **CLI Framework**: `commander.js` or `yargs` for CLI commands
11
- - **TUI Framework**: `ink` (React for CLI) or `blessed`/`terminal-kit` for beautiful terminal UI
12
- - **Authentication**: Firebase Authentication (Email/Password + OAuth providers)
13
- - **API Management**: Store API keys securely using environment variables + encrypted local storage
14
- - **Package Manager**: npm/yarn
15
- - **Build Tool**: TypeScript + ts-node or esbuild
16
-
17
- ### 2. **Authentication System**
18
-
19
- Users MUST sign up/sign in before using Dr-Code
20
-
21
- Sign-up/Sign-in happens via Dr-Code's web portal: https://dr-code.ai/auth
22
-
23
- Firebase Authentication with:
24
-
25
- Email/Password
26
-
27
- Google OAuth
28
-
29
- GitHub OAuth
30
-
31
- Firebase UI library for web auth page
32
-
33
- After auth, user gets Firebase ID token
34
-
35
- CLI validates token on first run and stores it securely (~/.dr-code/auth-token)
36
-
37
- Token refresh mechanism for long sessions
38
-
39
-
40
- ### 3. **Installation Commands**
41
- ```bash
42
- # Install globally
43
- npm install -g @dr-code/cli
44
-
45
- # Verify installation
46
- dr-code --version
47
-
48
- # First-time setup (triggers auth flow)
49
- dr-code login
50
-
51
- # Open web auth page
52
- dr-code login --web
53
- ```
54
-
55
- ### 4. **API Key Management**
56
- Users can configure multiple AI APIs easily:
57
-
58
- ```bash
59
- # Interactive API setup (recommended)
60
- dr-code config
61
-
62
- # Set individual API keys
63
- dr-code config add github # GitHub Models
64
- dr-code config add google # Google AI Studio (Gemini)
65
- dr-code config add openrouter # OpenRouter
66
- dr-code config add groq # Groq
67
- dr-code config add huggingface # Hugging Face
68
-
69
- # Set active API
70
- dr-code config set-active github
71
-
72
- # List configured APIs
73
- dr-code config list
74
-
75
- # Remove API key
76
- dr-code config remove github
77
-
78
- # Quick env var setup (alternative)
79
- export DR_CODE_GITHUB_KEY=xxx
80
- export DR_CODE_GOOGLE_KEY=xxx
81
- export DR_CODE_OPENROUTER_KEY=xxx
82
- export DR_CODE_GROQ_KEY=xxx
83
- export DR_CODE_HUGGINGFACE_KEY=xxx
84
- ```
85
-
86
- **API Configuration File** (~/.dr-code/config.json):
87
- ```json
88
- {
89
- "active_provider": "github",
90
- "providers": {
91
- "github": {
92
- "api_key": "encrypted_key_here",
93
- "model": "gpt-4o",
94
- "base_url": "https://models.github.ai/inference"
95
- },
96
- "google": {
97
- "api_key": "encrypted_key_here",
98
- "model": "gemini-2.5-pro",
99
- "base_url": "https://generativelanguage.googleapis.com"
100
- },
101
- "openrouter": {
102
- "api_key": "encrypted_key_here",
103
- "model": "anthropic/claude-3.5-sonnet",
104
- "base_url": "https://openrouter.ai/api/v1"
105
- },
106
- "groq": {
107
- "api_key": "encrypted_key_here",
108
- "model": "llama-3.1-70b",
109
- "base_url": "https://api.groq.com/openai/v1"
110
- },
111
- "huggingface": {
112
- "api_key": "encrypted_key_here",
113
- "model": "mistralai/Mixtral-8x7B",
114
- "base_url": "https://api-inference.huggingface.co"
115
- }
116
- },
117
- "user_id": "firebase_uid_here"
118
- }
119
- ```
120
-
121
- ### 5. **Terminal Interface (TUI)**
122
- Design a beautiful, interactive terminal UI similar to Claude Code/Codex:
123
-
124
- **Features:**
125
- - **Chat-like interface** with streaming responses
126
- - **Syntax highlighting** for code (using `chalk` + `kleur`)
127
- - **Code blocks** with copy functionality
128
- - **Progress indicators** for API calls
129
- - **Keyboard shortcuts**:
130
- - `Ctrl+C` - Cancel current operation
131
- - `Ctrl+L` - Clear screen
132
- - `Tab` - Auto-complete
133
- - `/help` - Show help menu
134
- - `/model` - Switch AI model
135
- - `/config` - Open config menu
136
- - `/status` - Show usage/stats
137
- - **Multi-line input** with `Enter` to submit, `Shift+Enter` for new line
138
- - **History** of previous prompts (up arrow navigation)
139
- - **File tree view** for current directory
140
- - **Diff preview** before applying code changes
141
-
142
- **UI Layout:**
143
-
144
- ┌─────────────────────────────────────────────────────────────┐
145
- │ Dr-Code v1.0.0 | Provider: GitHub (GPT-4o) | User: celi │
146
- ├─────────────────────────────────────────────────────────────┤
147
- │ ───────────────── MESSAGE HISTORY ───────────────────────── │
148
- │ │
149
- │ ❯ You: │
150
- │ Create a React component for a todo list │
151
- │ │
152
- │ ✦ Dr-Code: [typing...] │
153
- │ Here's a todo list component: │
154
- │ ┌─────────────────────────────────────────────────────┐ │
155
- │ │ import React, { useState } from 'react'; │ │
156
- │ │ │ │
157
- │ │ const TodoList = () => { │ │
158
- │ │ const [todos, setTodos] = useState([]); │ │
159
- │ │ ... │ │
160
- │ │ }; │ │
161
- │ └─────────────────────────────────────────────────────┘ │
162
- │ Want me to add features like delete/complete? │
163
- │ │
164
- ├─────────────────────────────────────────────────────────────┤
165
- │ ❯ [input cursor here...] │
166
- │ ┌─ /model /config /status /help ──────────────────┐ │
167
- └─────────────────────────────────────────────────────────────┘
168
-
169
-
170
- ### 6. **Core Features**
171
-
172
- ✅ Interactive chat mode: dr-code (default)
173
- ✅ One-liner mode: dr-code "create a python script that..."
174
- ✅ File-aware coding (reads current directory)
175
- ✅ Code generation & editing
176
- ✅ Code review mode: dr-code review
177
- ✅ Debug mode: dr-code debug "error message"
178
- ✅ Web search integration
179
- ✅ Multi-file editing
180
- ✅ Command execution (with user approval)
181
- ✅ Git integration (show diffs, commit messages)
182
- ✅ Model switching on-the-fly
183
- ✅ Token usage tracking
184
- ✅ Rate limit warnings
185
- ✅ Offline mode (cached responses)
186
-
187
-
188
- ### 7. **AI Provider Integration**
189
- Each provider must implement the same interface:
190
-
191
- ```typescript
192
- interface AIClient {
193
- name: string;
194
- sendMessage(prompt: string, context?: FileContext): Promise<StreamResponse>;
195
- getModel(): string;
196
- setModel(model: string): void;
197
- getStatus(): ProviderStatus;
198
- }
199
-
200
- // Providers to implement:
201
- - GitHubClient (GitHub Models API)
202
- - GoogleClient (Gemini API)
203
- - OpenRouterClient (OpenRouter API)
204
- - GroqClient (Groq API)
205
- - HuggingFaceClient (Hugging Face Inference API)
206
- ```
207
-
208
- **API Endpoints:**
209
- - **GitHub Models**: `https://models.github.ai/inference/chat/completions`
210
- - **Google AI Studio**: `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent`
211
- - **OpenRouter**: `https://openrouter.ai/api/v1/chat/completions`
212
- - **Groq**: `https://api.groq.com/openai/v1/chat/completions`
213
- - **Hugging Face**: `https://api-inference.huggingface.co/models/{model}`
214
-
215
- ### 8. **Project Structure**
216
-
217
- dr-code/
218
- ├── src/
219
- │ ├── cli/
220
- │ │ ├── commands/
221
- │ │ │ ├── login.ts
222
- │ │ │ ├── config.ts
223
- │ │ │ ├── review.ts
224
- │ │ │ └── debug.ts
225
- │ │ ├── tui/
226
- │ │ │ ├── App.tsx # Main TUI component (React + Ink)
227
- │ │ │ ├── ChatInterface.tsx
228
- │ │ │ ├── ConfigMenu.tsx
229
- │ │ │ └── StatusBar.tsx
230
- │ │ └── index.ts # CLI entry point
231
- │ ├── auth/
232
- │ │ ├── firebase.ts # Firebase config
233
- │ │ ├── auth-manager.ts # Auth token handling
234
- │ │ └── token-verifier.ts
235
- │ ├── ai/
236
- │ │ ├── clients/
237
- │ │ │ ├── base-client.ts
238
- │ │ │ ├── github-client.ts
239
- │ │ │ ├── google-client.ts
240
- │ │ │ ├── openrouter-client.ts
241
- │ │ │ ├── groq-client.ts
242
- │ │ │ └── huggingface-client.ts
243
- │ │ └── factory.ts # Client factory
244
- │ ├── config/
245
- │ │ ├── config-manager.ts # Config file handling
246
- │ │ └── api-key-store.ts # Encrypted key storage
247
- │ ├── utils/
248
- │ │ ├── logger.ts
249
- │ │ ├── spinner.ts
250
- │ │ └── code-highlighter.ts
251
- │ └── types/
252
- │ └── index.ts
253
- ├── web-auth/
254
- │ ├── src/
255
- │ │ ├── App.tsx # Firebase UI web app
256
- │ │ ├── components/
257
- │ │ │ ├── SignIn.tsx
258
- │ │ │ ├── SignUp.tsx
259
- │ │ │ └── Dashboard.tsx
260
- │ │ └── firebase-config.ts
261
- │ └── public/
262
- ├── package.json
263
- ├── tsconfig.json
264
- ├── firebase.json # Firebase config
265
- ├── .env.example
266
- └── README.md
267
-
268
-
269
- ### 9. **Firebase Setup**
270
- ```javascript
271
- // web-auth/src/firebase-config.ts
272
- import { initializeApp } from 'firebase/app';
273
- import { getAuth } from 'firebase/auth';
274
-
275
- export const firebaseConfig = {
276
- apiKey: process.env.FIREBASE_API_KEY,
277
- authDomain: process.env.FIREBASE_AUTH_DOMAIN,
278
- projectId: process.env.FIREBASE_PROJECT_ID,
279
- storageBucket: process.env.FIREBASE_STORAGE_BUCKET,
280
- messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID,
281
- appId: process.env.FIREBASE_APP_ID
282
- };
283
-
284
- const app = initializeApp(firebaseConfig);
285
- export const auth = getAuth(app);
286
- ```
287
-
288
- ### 10. **Security Requirements**
289
-
290
- ✅ Encrypt API keys at rest (use crypto.createCipher)
291
- ✅ Store keys in ~/.dr-code/ with 600 permissions
292
- ✅ Never log API keys
293
- ✅ Validate Firebase tokens server-side
294
- ✅ Use HTTPS for all API calls
295
- ✅ Implement rate limiting per user
296
- ✅ Token expiration and refresh
297
- ✅ No API keys in git repos
298
- ✅ .gitignore for sensitive files
299
-
300
-
301
- ### 11. **Package.json Scripts**
302
- ```json
303
- {
304
- "name": "@dr-code/cli",
305
- "version": "1.0.0",
306
- "description": "Dr-Code AI Terminal Assistant",
307
- "bin": {
308
- "dr-code": "./dist/cli/index.js"
309
- },
310
- "scripts": {
311
- "build": "tsc",
312
- "start": "node dist/cli/index.js",
313
- "dev": "ts-node src/cli/index.js",
314
- "test": "jest",
315
- "lint": "eslint src/",
316
- "web:dev": "vite web-auth/src",
317
- "web:build": "vite build web-auth/src"
318
- },
319
- "dependencies": {
320
- "commander": "^12.0.0",
321
- "ink": "^4.4.0",
322
- "react": "^18.2.0",
323
- "firebase": "^10.8.0",
324
- "chalk": "^5.3.0",
325
- "ora": "^8.0.0",
326
- "inquirer": "^9.2.12",
327
- "axios": "^1.6.0",
328
- "crypto-js": "^4.2.0"
329
- },
330
- "engines": {
331
- "node": ">=18.0.0"
332
- }
333
- }
334
- ```
335
-
336
- ### 12. **User Experience Flow**
337
-
338
- User installs: npm install -g @dr-code/cli
339
-
340
- User runs: dr-code
341
-
342
- If not authenticated → Shows "Welcome to Dr-Code!" + "Run 'dr-code login' to start"
343
-
344
- User runs: dr-code login
345
-
346
- Opens browser to https://dr-code.ai/auth
347
-
348
- User signs up/signs in with Firebase
349
-
350
- Browser shows success + automatic CLI token detection
351
-
352
- CLI confirms: "✅ Welcome, Celine! You're all set!"
353
-
354
- User runs: dr-code config
355
-
356
- Interactive menu to add API keys (paste from GitHub/Gemini/etc.)
357
-
358
- User selects active provider
359
-
360
- User runs: dr-code
361
-
362
- Beautiful TUI opens → Start coding!
363
-
364
-
365
- ### 13. **Error Handling**
366
-
367
- Invalid API key → Clear message + link to get new key
368
- ✅ Rate limit exceeded → Show remaining quota + wait time
369
- ✅ Network error → Retry with exponential backoff
370
- ✅ Auth token expired → Auto-redirect to login
371
- ✅ Missing Node.js → Show installation guide
372
- ✅ Invalid provider → List available providers
373
-
374
-
375
- ### 14. **Documentation**
376
- Create comprehensive README.md with:
377
- - Installation guide
378
- - Quickstart (5-minute setup)
379
- - API provider setup guides (GitHub, Google, OpenRouter, Groq, Hugging Face)
380
- - Command reference
381
- - FAQ
382
- - Troubleshooting
383
- - Security best practices
384
-
385
- ---
386
-
387
- ## Deliverables
388
-
389
- 1. **CLI Package** (`@dr-code/cli`) - Installable via npm
390
- 2. **Web Auth Portal** - Firebase UI for sign-up/sign-in
391
- 3. **Documentation** - Complete README + guides
392
- 4. **Example .env** - Environment variable template
393
- 5. **Test Suite** - Unit tests for auth, API clients, config
394
-
395
- ## Success Criteria
396
- - ✅ User can install and run in < 5 minutes
397
- - ✅ Beautiful, intuitive TUI (Claude Code-like)
398
- - ✅ Easy API key management (interactive config)
399
- - ✅ Firebase auth works seamlessly
400
- - ✅ All 5 AI providers work correctly
401
- - ✅ No security vulnerabilities
402
- - ✅ Cross-platform (Windows, macOS, Linux)
403
-
404
- ---
405
-
406
- **Start building Dr-Code now. Begin with the project setup, Firebase authentication, and the core TUI interface.**
package/jest.config.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- preset: 'ts-jest',
3
- testEnvironment: 'node',
4
- roots: ['<rootDir>/src'],
5
- testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'],
6
- collectCoverageFrom: [
7
- 'src/**/*.ts',
8
- '!src/**/*.d.ts',
9
- '!src/**/index.ts'
10
- ]
11
- };
@@ -1,54 +0,0 @@
1
- /**
2
- * Config Command - API Key Management (No authentication required)
3
- */
4
-
5
- import { Command } from 'commander';
6
- import * as fs from 'fs';
7
- import * as path from 'path';
8
-
9
- const CONFIG_DIR = path.join(process.env.HOME || process.env.USERPROFILE || '', '.dr-code');
10
- const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
11
-
12
- export const configCommand = new Command('config')
13
- .description('Manage API provider configuration')
14
- .option('add <provider>', 'Add a new API provider')
15
- .option('list', 'List configured providers')
16
- .option('remove <provider>', 'Remove an API provider')
17
- .option('set-active <provider>', 'Set active provider')
18
- .action(async (options) => {
19
- // Ensure config directory exists
20
- if (!fs.existsSync(CONFIG_DIR)) {
21
- fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 });
22
- }
23
-
24
- if (options.add) {
25
- console.log(`📝 Adding API key for provider: ${options.add}`);
26
- console.log(`Enter your API key for ${options.add}:`);
27
- // Key entry logic will go here
28
- } else if (options.list) {
29
- console.log('📋 Configured API providers:');
30
- if (fs.existsSync(CONFIG_FILE)) {
31
- const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf-8'));
32
- Object.keys(config.providers || {}).forEach((provider) => {
33
- const isActive = provider === config.active_provider ? '✅' : ' ';
34
- console.log(`${isActive} ${provider}`);
35
- });
36
- } else {
37
- console.log('No providers configured yet. Run: dr-code config add <provider>');
38
- }
39
- } else if (options.remove) {
40
- console.log(`🗑️ Removing provider: ${options.remove}`);
41
- // Remove logic will go here
42
- } else if (options.setActive) {
43
- console.log(`✅ Setting active provider: ${options.setActive}`);
44
- // Set active logic will go here
45
- } else {
46
- console.log('⚙️ Interactive configuration mode');
47
- console.log('\nUsage:');
48
- console.log(' dr-code config add <provider> - Add API key for a provider');
49
- console.log(' dr-code config list - List configured providers');
50
- console.log(' dr-code config set-active <name> - Set active provider');
51
- console.log(' dr-code config remove <provider> - Remove a provider');
52
- console.log('\nSupported providers: github, google, openrouter, groq, huggingface');
53
- }
54
- });
@@ -1,22 +0,0 @@
1
- /**
2
- * Login Command - Firebase Authentication
3
- */
4
-
5
- import { Command } from 'commander';
6
-
7
- export const loginCommand = new Command('login')
8
- .description('Authenticate with Firebase')
9
- .option('--web', 'Open web browser for authentication')
10
- .action(async (options) => {
11
- console.log('🔐 Initiating Firebase authentication...');
12
-
13
- if (options.web) {
14
- console.log('📱 Opening browser for web authentication...');
15
- console.log('Visit: https://dr-code.ai/auth');
16
- } else {
17
- console.log('Attempting CLI-based authentication...');
18
- }
19
-
20
- // Firebase auth implementation will go here
21
- console.log('✅ Authentication successful!');
22
- });
package/src/cli/index.ts DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * Dr-Code CLI - Main Entry Point
3
- */
4
-
5
- import { program } from 'commander';
6
- import packageJson from '../../package.json';
7
-
8
- // Import commands
9
- import { configCommand } from './commands/config';
10
-
11
- const main = async (): Promise<void> => {
12
- program
13
- .name('dr-code')
14
- .description('AI Terminal Coding Assistant')
15
- .version(packageJson.version);
16
-
17
- // Register commands
18
- program.addCommand(configCommand);
19
-
20
- // Default interactive mode
21
- program
22
- .command('chat')
23
- .description('Start interactive chat mode (default)')
24
- .action(async () => {
25
- console.log('🚀 Starting Dr-Code interactive mode...');
26
- console.log('Type /help for available commands');
27
- // TUI implementation will go here
28
- });
29
-
30
- program.parse(process.argv);
31
-
32
- // Show help if no command provided
33
- if (!process.argv.slice(2).length) {
34
- program.outputHelp();
35
- }
36
- };
37
-
38
- main().catch((error) => {
39
- console.error('Fatal error:', error);
40
- process.exit(1);
41
- });
@@ -1,45 +0,0 @@
1
- /**
2
- * Type Definitions for Dr-Code
3
- */
4
-
5
- export interface AIClient {
6
- name: string;
7
- sendMessage(prompt: string, context?: FileContext): Promise<StreamResponse>;
8
- getModel(): string;
9
- setModel(model: string): void;
10
- getStatus(): ProviderStatus;
11
- }
12
-
13
- export interface FileContext {
14
- path: string;
15
- content: string;
16
- language?: string;
17
- }
18
-
19
- export interface StreamResponse {
20
- content: string;
21
- isStreaming: boolean;
22
- usage?: {
23
- inputTokens: number;
24
- outputTokens: number;
25
- };
26
- }
27
-
28
- export interface ProviderStatus {
29
- name: string;
30
- isConfigured: boolean;
31
- currentModel: string;
32
- rateLimitRemaining?: number;
33
- }
34
-
35
- export interface ProviderConfig {
36
- active_provider: string;
37
- providers: Record<string, ProviderSettings>;
38
- user_id: string;
39
- }
40
-
41
- export interface ProviderSettings {
42
- api_key: string;
43
- model: string;
44
- base_url: string;
45
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Logger Utility
3
- */
4
-
5
- export enum LogLevel {
6
- DEBUG = 'DEBUG',
7
- INFO = 'INFO',
8
- WARN = 'WARN',
9
- ERROR = 'ERROR',
10
- }
11
-
12
- export class Logger {
13
- private level: LogLevel;
14
-
15
- constructor(level: LogLevel = LogLevel.INFO) {
16
- this.level = level;
17
- }
18
-
19
- debug(message: string, ...args: unknown[]): void {
20
- if (this.level === LogLevel.DEBUG) {
21
- console.log(`[DEBUG] ${message}`, ...args);
22
- }
23
- }
24
-
25
- info(message: string, ...args: unknown[]): void {
26
- console.log(`[INFO] ${message}`, ...args);
27
- }
28
-
29
- warn(message: string, ...args: unknown[]): void {
30
- console.warn(`[WARN] ${message}`, ...args);
31
- }
32
-
33
- error(message: string, ...args: unknown[]): void {
34
- console.error(`[ERROR] ${message}`, ...args);
35
- }
36
- }
37
-
38
- export const logger = new Logger();
package/tsconfig.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "lib": ["ES2020"],
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true,
16
- "removeComments": false,
17
- "noImplicitAny": true,
18
- "strictNullChecks": true,
19
- "strictFunctionTypes": true,
20
- "noUnusedLocals": true,
21
- "noUnusedParameters": true,
22
- "noImplicitReturns": true,
23
- "noFallthroughCasesInSwitch": true,
24
- "moduleResolution": "node",
25
- "allowSyntheticDefaultImports": true,
26
- "jsx": "react"
27
- },
28
- "include": ["src"],
29
- "exclude": ["node_modules", "dist", "**/*.test.ts"]
30
- }