gencode-ai 0.2.0 → 0.3.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/dist/agent/agent.d.ts +9 -2
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +37 -8
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/cli/components/App.d.ts.map +1 -1
- package/dist/cli/components/App.js +15 -9
- package/dist/cli/components/App.js.map +1 -1
- package/dist/cli/components/Messages.js +1 -1
- package/dist/cli/components/Messages.js.map +1 -1
- package/dist/cli/components/ModelSelector.d.ts +4 -3
- package/dist/cli/components/ModelSelector.d.ts.map +1 -1
- package/dist/cli/components/ModelSelector.js +54 -37
- package/dist/cli/components/ModelSelector.js.map +1 -1
- package/dist/cli/components/ProviderManager.d.ts +2 -2
- package/dist/cli/components/ProviderManager.d.ts.map +1 -1
- package/dist/cli/components/ProviderManager.js +137 -156
- package/dist/cli/components/ProviderManager.js.map +1 -1
- package/dist/cli/index.js +30 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/levels.d.ts +5 -5
- package/dist/config/levels.d.ts.map +1 -1
- package/dist/config/levels.js +20 -20
- package/dist/config/levels.js.map +1 -1
- package/dist/config/merger.js +1 -1
- package/dist/config/merger.js.map +1 -1
- package/dist/config/providers-config.d.ts +8 -5
- package/dist/config/providers-config.d.ts.map +1 -1
- package/dist/config/providers-config.js +19 -22
- package/dist/config/providers-config.js.map +1 -1
- package/dist/config/test-utils.d.ts +2 -2
- package/dist/config/test-utils.d.ts.map +1 -1
- package/dist/config/test-utils.js +4 -4
- package/dist/config/test-utils.js.map +1 -1
- package/dist/config/types.d.ts +23 -17
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +14 -14
- package/dist/config/types.js.map +1 -1
- package/dist/memory/memory-manager.d.ts +25 -12
- package/dist/memory/memory-manager.d.ts.map +1 -1
- package/dist/memory/memory-manager.js +241 -112
- package/dist/memory/memory-manager.js.map +1 -1
- package/dist/memory/test-utils.d.ts +1 -1
- package/dist/memory/test-utils.d.ts.map +1 -1
- package/dist/memory/test-utils.js +3 -3
- package/dist/memory/test-utils.js.map +1 -1
- package/dist/memory/types.d.ts +20 -10
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/memory/types.js +13 -13
- package/dist/memory/types.js.map +1 -1
- package/dist/migration/migrate.d.ts +24 -0
- package/dist/migration/migrate.d.ts.map +1 -0
- package/dist/migration/migrate.js +164 -0
- package/dist/migration/migrate.js.map +1 -0
- package/dist/permissions/persistence.d.ts +2 -2
- package/dist/permissions/persistence.js +4 -4
- package/dist/permissions/persistence.js.map +1 -1
- package/dist/planning/plan-file.d.ts +1 -1
- package/dist/planning/plan-file.js +2 -2
- package/dist/planning/plan-file.js.map +1 -1
- package/dist/prompts/index.d.ts +5 -4
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +11 -8
- package/dist/prompts/index.js.map +1 -1
- package/dist/providers/anthropic.d.ts +2 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +7 -0
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/gemini.d.ts +2 -1
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +7 -0
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.d.ts +20 -10
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +48 -24
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/openai.d.ts +2 -1
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +7 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/registry.d.ts +48 -34
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +72 -88
- package/dist/providers/registry.js.map +1 -1
- package/dist/providers/store.d.ts +43 -17
- package/dist/providers/store.d.ts.map +1 -1
- package/dist/providers/store.js +112 -19
- package/dist/providers/store.js.map +1 -1
- package/dist/providers/types.d.ts +23 -0
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/vertex-ai.d.ts +15 -7
- package/dist/providers/vertex-ai.d.ts.map +1 -1
- package/dist/providers/vertex-ai.js +46 -13
- package/dist/providers/vertex-ai.js.map +1 -1
- package/dist/session/types.js +1 -1
- package/dist/session/types.js.map +1 -1
- package/docs/config-system-comparison.md +50 -50
- package/docs/cost-tracking-comparison.md +2 -2
- package/docs/memory-system.md +124 -31
- package/docs/permissions.md +2 -2
- package/docs/proposals/0006-memory-system.md +4 -4
- package/docs/proposals/0008-checkpointing.md +109 -2
- package/docs/proposals/0011-custom-commands.md +2 -1
- package/docs/proposals/0021-skills-system.md +2 -1
- package/docs/proposals/0023-permission-enhancements.md +2 -2
- package/docs/proposals/0033-enterprise-deployment.md +1 -1
- package/docs/proposals/0041-configuration-system.md +17 -19
- package/docs/proposals/0042-prompt-optimization.md +17 -9
- package/docs/proposals/README.md +5 -5
- package/docs/providers.md +94 -9
- package/package.json +3 -2
- package/scripts/migrate.ts +449 -0
- package/src/agent/agent.ts +51 -9
- package/src/agent/types.ts +5 -1
- package/src/cli/components/App.tsx +17 -8
- package/src/cli/components/Messages.tsx +1 -1
- package/src/cli/components/ModelSelector.tsx +62 -43
- package/src/cli/components/ProviderManager.tsx +278 -323
- package/src/cli/index.tsx +36 -17
- package/src/config/index.ts +5 -3
- package/src/config/levels.test.ts +22 -22
- package/src/config/levels.ts +22 -22
- package/src/config/loader.test.ts +14 -14
- package/src/config/manager.test.ts +19 -19
- package/src/config/merger.test.ts +23 -23
- package/src/config/merger.ts +1 -1
- package/src/config/providers-config.ts +23 -21
- package/src/config/test-utils.ts +6 -6
- package/src/config/types.ts +30 -20
- package/src/memory/memory-manager.test.ts +242 -24
- package/src/memory/memory-manager.ts +270 -141
- package/src/memory/test-utils.ts +4 -4
- package/src/memory/types.ts +28 -17
- package/src/permissions/persistence.ts +4 -4
- package/src/planning/plan-file.ts +2 -2
- package/src/prompts/index.ts +13 -9
- package/src/providers/anthropic.ts +9 -0
- package/src/providers/gemini.ts +9 -0
- package/src/providers/index.ts +76 -33
- package/src/providers/openai.ts +9 -0
- package/src/providers/registry.ts +116 -111
- package/src/providers/store.ts +130 -28
- package/src/providers/types.ts +33 -1
- package/src/providers/vertex-ai.ts +49 -13
- package/src/session/types.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Proposal: Memory System (
|
|
1
|
+
# Proposal: Memory System (GEN.md) with /init Command
|
|
2
2
|
|
|
3
3
|
- **Proposal ID**: 0006
|
|
4
4
|
- **Author**: mycode team
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
12
|
Implement a comprehensive memory system inspired by Claude Code, including:
|
|
13
|
-
1. **
|
|
13
|
+
1. **GEN.md files** - Project-specific context that persists across sessions (with CLAUDE.md fallback for compatibility)
|
|
14
14
|
2. **Hierarchical memory loading** - User → Project → Local with rules directories
|
|
15
|
-
3. **/init command** - Automatic project analysis and
|
|
15
|
+
3. **/init command** - Automatic project analysis and GEN.md generation
|
|
16
16
|
4. **# prefix** - Quick memory adds during sessions (`# note` for project, `## note` for user)
|
|
17
17
|
5. **/memory command** - View loaded memory files
|
|
18
18
|
6. **@import syntax** - Include other files into memory (max 5 levels)
|
|
19
|
-
7. **.
|
|
19
|
+
7. **.gen/rules/ directory** - Modular, path-scoped rules with frontmatter
|
|
20
20
|
|
|
21
21
|
## Motivation
|
|
22
22
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
- **Proposal ID**: 0008
|
|
4
4
|
- **Author**: mycode team
|
|
5
|
-
- **Status**:
|
|
5
|
+
- **Status**: Partially Implemented
|
|
6
6
|
- **Created**: 2025-01-15
|
|
7
|
-
- **Updated**: 2025-01-
|
|
7
|
+
- **Updated**: 2025-01-17
|
|
8
8
|
|
|
9
9
|
## Summary
|
|
10
10
|
|
|
@@ -325,3 +325,110 @@ No breaking changes to existing functionality.
|
|
|
325
325
|
|
|
326
326
|
- [Claude Code Checkpointing](https://code.claude.com/docs/en/checkpointing)
|
|
327
327
|
- [Git Reset and Revert](https://git-scm.com/docs/git-reset)
|
|
328
|
+
|
|
329
|
+
## Implementation Status
|
|
330
|
+
|
|
331
|
+
### ✅ Implemented (Phase 1-2)
|
|
332
|
+
|
|
333
|
+
**Core Checkpointing System**:
|
|
334
|
+
- ✅ `CheckpointManager` class with full API
|
|
335
|
+
- `recordChange()` - Record file changes
|
|
336
|
+
- `getCheckpoints()` - Get all checkpoints
|
|
337
|
+
- `getFileHistory()` - Get file-specific history
|
|
338
|
+
- `rewind()` - Rewind with multiple options (checkpointId, path, all, count)
|
|
339
|
+
- `getSummary()` - Get change summary
|
|
340
|
+
- `clearCheckpoints()` - Clear checkpoints
|
|
341
|
+
- `formatCheckpointList()` - Format for display
|
|
342
|
+
|
|
343
|
+
**Tool Integration**:
|
|
344
|
+
- ✅ Automatic tracking in `ToolRegistry`
|
|
345
|
+
- Pre-execution file state capture
|
|
346
|
+
- Post-execution checkpoint recording
|
|
347
|
+
- Support for Write and Edit tools
|
|
348
|
+
- Automatic detection of create/modify/delete operations
|
|
349
|
+
|
|
350
|
+
**CLI Commands**:
|
|
351
|
+
- ✅ `/changes` - List all file changes in session
|
|
352
|
+
- ✅ `/rewind [n]` - Rewind specific checkpoint by index
|
|
353
|
+
- ✅ `/rewind all` - Rewind all changes
|
|
354
|
+
- ✅ `/rewind` - Show changes list with usage info
|
|
355
|
+
|
|
356
|
+
**Type System**:
|
|
357
|
+
- ✅ Complete type definitions (`src/checkpointing/types.ts`)
|
|
358
|
+
- ✅ All interfaces from the proposal
|
|
359
|
+
|
|
360
|
+
**Testing**:
|
|
361
|
+
- ✅ Test example (`examples/test-checkpointing.ts`)
|
|
362
|
+
|
|
363
|
+
### ❌ Not Implemented (Phase 3-5)
|
|
364
|
+
|
|
365
|
+
**Session Persistence**:
|
|
366
|
+
- ❌ Checkpoints not saved to session files
|
|
367
|
+
- ❌ No checkpoint restoration when resuming sessions
|
|
368
|
+
- ❌ Session type doesn't include checkpoint data
|
|
369
|
+
- **Impact**: Checkpoints are lost when the session ends
|
|
370
|
+
|
|
371
|
+
**User Experience Enhancements**:
|
|
372
|
+
- ❌ Confirmation prompt for `/rewind all`
|
|
373
|
+
- Currently executes immediately without confirmation
|
|
374
|
+
- Proposal shows interactive confirmation UI
|
|
375
|
+
- ❌ Inline change indicators
|
|
376
|
+
- Proposal shows checkpoint saved message after each file modification
|
|
377
|
+
- Currently no visual feedback when checkpoint is created
|
|
378
|
+
- ❌ Formatted change list UI with boxes/borders
|
|
379
|
+
- Current implementation uses simple text list
|
|
380
|
+
- Proposal shows fancy bordered display
|
|
381
|
+
|
|
382
|
+
**Git Integration** (Phase 3):
|
|
383
|
+
- ❌ Optional git-based versioning
|
|
384
|
+
- ❌ Git commits as checkpoints
|
|
385
|
+
- ❌ Integration with git workflow
|
|
386
|
+
|
|
387
|
+
**Advanced Features** (Phase 4-5):
|
|
388
|
+
- ❌ Selective rewind by time range
|
|
389
|
+
- ❌ Checkpoint browsing UI
|
|
390
|
+
- ❌ Diff viewing between checkpoints
|
|
391
|
+
- ❌ Storage limits and cleanup policies
|
|
392
|
+
- ❌ Large file optimization
|
|
393
|
+
|
|
394
|
+
### 📋 Remaining Work
|
|
395
|
+
|
|
396
|
+
To complete this proposal, the following tasks are needed:
|
|
397
|
+
|
|
398
|
+
1. **Session Persistence** (High Priority):
|
|
399
|
+
- Add `checkpoints` field to `SessionMetadata` or `Session` type
|
|
400
|
+
- Save/load checkpoints in `SessionManager`
|
|
401
|
+
- Restore checkpoint manager state when resuming sessions
|
|
402
|
+
|
|
403
|
+
2. **Confirmation UI** (Medium Priority):
|
|
404
|
+
- Add confirmation prompt for `/rewind all` command
|
|
405
|
+
- Show list of files that will be affected
|
|
406
|
+
- Allow user to confirm or cancel
|
|
407
|
+
|
|
408
|
+
3. **Visual Feedback** (Medium Priority):
|
|
409
|
+
- Show checkpoint saved message after Write/Edit operations
|
|
410
|
+
- Improve `/changes` display with better formatting
|
|
411
|
+
- Add color coding for different change types
|
|
412
|
+
|
|
413
|
+
4. **Git Integration** (Low Priority):
|
|
414
|
+
- Optional: Use git for checkpoint storage
|
|
415
|
+
- Optional: Create git commits as checkpoints
|
|
416
|
+
- Optional: Integrate with existing git workflow
|
|
417
|
+
|
|
418
|
+
5. **Advanced Features** (Future):
|
|
419
|
+
- Time-based rewind
|
|
420
|
+
- Diff viewing
|
|
421
|
+
- Storage optimization
|
|
422
|
+
|
|
423
|
+
### 📁 Implementation Files
|
|
424
|
+
|
|
425
|
+
| File | Status | Notes |
|
|
426
|
+
|------|--------|-------|
|
|
427
|
+
| `src/checkpointing/types.ts` | ✅ Complete | All types defined |
|
|
428
|
+
| `src/checkpointing/checkpoint-manager.ts` | ✅ Complete | Core logic implemented |
|
|
429
|
+
| `src/checkpointing/index.ts` | ✅ Complete | Module exports |
|
|
430
|
+
| `src/tools/registry.ts` | ✅ Modified | Checkpoint tracking added |
|
|
431
|
+
| `src/cli/components/App.tsx` | ✅ Modified | `/changes` and `/rewind` commands |
|
|
432
|
+
| `examples/test-checkpointing.ts` | ✅ Complete | Test coverage |
|
|
433
|
+
| `src/session/types.ts` | ❌ Not Modified | Missing checkpoint fields |
|
|
434
|
+
| `src/session/manager.ts` | ❌ Not Modified | No persistence logic |
|
|
@@ -487,7 +487,7 @@ Backward compatible with existing rules.
|
|
|
487
487
|
|
|
488
488
|
1. **Pattern-Based Rules**: Supports Claude Code format like `Bash(git add:*)` with glob-style wildcards
|
|
489
489
|
2. **Prompt-Based Permissions**: ExitPlanMode style with semantic matching for common operations (run tests, install dependencies, etc.)
|
|
490
|
-
3. **Multi-Scope Permissions**: Session (in-memory), Project (.
|
|
490
|
+
3. **Multi-Scope Permissions**: Session (in-memory), Project (.gen/permissions.json), Global (~/.gen/permissions.json)
|
|
491
491
|
4. **Approval Options**: Allow once, Allow for session, Always allow (persistent), Deny
|
|
492
492
|
5. **Audit Logging**: In-memory audit trail with optional file persistence
|
|
493
493
|
6. **CLI Commands**: `/permissions` shows rules, `/permissions audit` shows decision history, `/permissions stats` shows statistics
|
|
@@ -507,7 +507,7 @@ Backward compatible with existing rules.
|
|
|
507
507
|
|
|
508
508
|
### Settings Configuration
|
|
509
509
|
|
|
510
|
-
Add to `~/.
|
|
510
|
+
Add to `~/.gen/settings.json`:
|
|
511
511
|
```json
|
|
512
512
|
{
|
|
513
513
|
"permissions": {
|
|
@@ -179,7 +179,7 @@ Enterprise Mode: Acme Corp
|
|
|
179
179
|
Authenticating via SSO...
|
|
180
180
|
|
|
181
181
|
Opening browser for authentication...
|
|
182
|
-
✓ Authenticated as
|
|
182
|
+
✓ Authenticated as user@company.com
|
|
183
183
|
|
|
184
184
|
Session policies:
|
|
185
185
|
- Allowed providers: anthropic, openai
|
|
@@ -49,9 +49,7 @@ Claude Code supports extensive environment variables:
|
|
|
49
49
|
|
|
50
50
|
**Cloud Providers:**
|
|
51
51
|
- `CLAUDE_CODE_USE_BEDROCK` - Enable AWS Bedrock
|
|
52
|
-
- `CLAUDE_CODE_USE_VERTEX` - Enable Google Vertex AI
|
|
53
52
|
- `CLAUDE_CODE_SKIP_BEDROCK_AUTH` - Bypass AWS auth
|
|
54
|
-
- `CLAUDE_CODE_SKIP_VERTEX_AUTH` - Bypass Vertex auth
|
|
55
53
|
|
|
56
54
|
**Operational:**
|
|
57
55
|
- `CLAUDE_CODE_MAX_OUTPUT_TOKENS` - Token limit
|
|
@@ -121,7 +119,7 @@ OpenCode provides additional patterns worth adopting:
|
|
|
121
119
|
### Directory Structure
|
|
122
120
|
|
|
123
121
|
```
|
|
124
|
-
~/.
|
|
122
|
+
~/.gen/ # User-level configuration
|
|
125
123
|
├── settings.json # Main user config
|
|
126
124
|
├── settings.local.json # User local overrides (gitignored pattern)
|
|
127
125
|
├── GENCODE.md # User context (like CLAUDE.md)
|
|
@@ -135,7 +133,7 @@ OpenCode provides additional patterns worth adopting:
|
|
|
135
133
|
└── sessions/ # Session data
|
|
136
134
|
|
|
137
135
|
./gencode.json # Project config (like opencode.json)
|
|
138
|
-
./.
|
|
136
|
+
./.gen/ # Project directory
|
|
139
137
|
├── settings.local.json # Project local overrides (gitignored)
|
|
140
138
|
├── GENCODE.md # Project context
|
|
141
139
|
├── rules/ # Path-scoped rules
|
|
@@ -146,10 +144,10 @@ OpenCode provides additional patterns worth adopting:
|
|
|
146
144
|
|
|
147
145
|
1. **Environment variables** (`GENCODE_*`, provider API keys)
|
|
148
146
|
2. **CLI arguments** (`--model`, `--provider`)
|
|
149
|
-
3. **Project local** (`./.
|
|
147
|
+
3. **Project local** (`./.gen/settings.local.json`)
|
|
150
148
|
4. **Project shared** (`./gencode.json`)
|
|
151
|
-
5. **User local** (`~/.
|
|
152
|
-
6. **User global** (`~/.
|
|
149
|
+
5. **User local** (`~/.gen/settings.local.json`)
|
|
150
|
+
6. **User global** (`~/.gen/settings.json`)
|
|
153
151
|
7. **Defaults**
|
|
154
152
|
|
|
155
153
|
### API Design
|
|
@@ -227,8 +225,8 @@ interface EnvHandler {
|
|
|
227
225
|
### Environment Variables
|
|
228
226
|
|
|
229
227
|
**Provider Selection:**
|
|
230
|
-
- `
|
|
231
|
-
- `
|
|
228
|
+
- `GEN_PROVIDER` - Provider name (anthropic, openai, gemini, bedrock, vertex)
|
|
229
|
+
- `GEN_MODEL` - Model ID
|
|
232
230
|
- `GENCODE_CONFIG` - Custom config file path
|
|
233
231
|
|
|
234
232
|
**Provider API Keys (Auto-detect):**
|
|
@@ -300,7 +298,7 @@ const ConfigSchema = z.object({
|
|
|
300
298
|
});
|
|
301
299
|
|
|
302
300
|
export class ConfigLoader {
|
|
303
|
-
private userConfigDir = path.join(os.homedir(), '.
|
|
301
|
+
private userConfigDir = path.join(os.homedir(), '.gen');
|
|
304
302
|
|
|
305
303
|
async load(): Promise<GencodeConfig> {
|
|
306
304
|
const configs = await Promise.all([
|
|
@@ -349,7 +347,7 @@ export class EnvHandler {
|
|
|
349
347
|
};
|
|
350
348
|
|
|
351
349
|
getProviderFromEnv(): string | undefined {
|
|
352
|
-
return process.env.
|
|
350
|
+
return process.env.GEN_PROVIDER;
|
|
353
351
|
}
|
|
354
352
|
|
|
355
353
|
getApiKey(provider: string): string | undefined {
|
|
@@ -442,7 +440,7 @@ $ gencode
|
|
|
442
440
|
# Uses OpenAI automatically
|
|
443
441
|
|
|
444
442
|
# Or specify explicitly
|
|
445
|
-
$ export
|
|
443
|
+
$ export GEN_PROVIDER=anthropic
|
|
446
444
|
$ export ANTHROPIC_API_KEY=sk-ant-...
|
|
447
445
|
$ gencode
|
|
448
446
|
```
|
|
@@ -480,7 +478,7 @@ $ gencode config deny "Read(.env)"
|
|
|
480
478
|
|
|
481
479
|
### Single Config File
|
|
482
480
|
|
|
483
|
-
A single `~/.
|
|
481
|
+
A single `~/.genrc` file would be simpler but lacks:
|
|
484
482
|
- Project-specific overrides
|
|
485
483
|
- Team-shareable settings
|
|
486
484
|
- Local-only sensitive settings
|
|
@@ -526,7 +524,7 @@ Simpler implementation but:
|
|
|
526
524
|
|
|
527
525
|
## Migration Path
|
|
528
526
|
|
|
529
|
-
1. **From mycode**: Migrate `~/.mycode/` to `~/.
|
|
527
|
+
1. **From mycode**: Migrate `~/.mycode/` to `~/.gen/`
|
|
530
528
|
2. **Version Detection**: Check for legacy config locations and prompt migration
|
|
531
529
|
3. **Backward Compatibility**: Support reading old config format for one major version
|
|
532
530
|
|
|
@@ -570,9 +568,9 @@ Simpler implementation but:
|
|
|
570
568
|
|
|
571
569
|
### Key Implementation Details
|
|
572
570
|
|
|
573
|
-
1. **Multi-level Loading**: User (`~/.
|
|
571
|
+
1. **Multi-level Loading**: User (`~/.gen/`) → Project (`./.gen/`) with proper merge
|
|
574
572
|
2. **Claude Code Compatibility**: Supports both `GENCODE.md` and `CLAUDE.md` for memory files
|
|
575
|
-
3. **Environment Variables**: `
|
|
573
|
+
3. **Environment Variables**: `GEN_PROVIDER`, `GEN_MODEL`, and provider API key auto-detection
|
|
576
574
|
4. **Deep Merge**: Arrays concatenate, objects merge recursively
|
|
577
575
|
5. **JSONC Support**: Configuration files support comments and trailing commas
|
|
578
576
|
|
|
@@ -580,8 +578,8 @@ Simpler implementation but:
|
|
|
580
578
|
|
|
581
579
|
1. Environment variables (`GENCODE_*`)
|
|
582
580
|
2. CLI arguments
|
|
583
|
-
3. Project local (`./.
|
|
581
|
+
3. Project local (`./.gen/settings.local.json`)
|
|
584
582
|
4. Project shared (`./gencode.json`)
|
|
585
|
-
5. User local (`~/.
|
|
586
|
-
6. User global (`~/.
|
|
583
|
+
5. User local (`~/.gen/settings.local.json`)
|
|
584
|
+
6. User global (`~/.gen/settings.json`)
|
|
587
585
|
7. Defaults
|
|
@@ -199,7 +199,7 @@ src/prompts/
|
|
|
199
199
|
|
|
200
200
|
### 4.2 Prompt Loading Strategy
|
|
201
201
|
|
|
202
|
-
The prompt loading system uses a **model → provider → prompt** flow, leveraging the `~/.
|
|
202
|
+
The prompt loading system uses a **model → provider → prompt** flow, leveraging the `~/.gen/providers.json` configuration to automatically determine which prompt to use.
|
|
203
203
|
|
|
204
204
|
#### 4.2.1 Loading Flow
|
|
205
205
|
|
|
@@ -209,7 +209,7 @@ model ID (e.g., "claude-sonnet-4-5@20250929")
|
|
|
209
209
|
▼
|
|
210
210
|
┌─────────────────────────────────────┐
|
|
211
211
|
│ Look up provider in providers.json │
|
|
212
|
-
│ (search models
|
|
212
|
+
│ (search models[provider:*].list) │
|
|
213
213
|
└──────────────┬──────────────────────┘
|
|
214
214
|
│
|
|
215
215
|
┌──────────┴──────────┐
|
|
@@ -242,18 +242,26 @@ model ID (e.g., "claude-sonnet-4-5@20250929")
|
|
|
242
242
|
|
|
243
243
|
#### 4.2.2 Provider Lookup from providers.json
|
|
244
244
|
|
|
245
|
-
The `~/.
|
|
245
|
+
The `~/.gen/providers.json` file stores cached models for each provider using `"provider:authMethod"` keys:
|
|
246
246
|
|
|
247
247
|
```json
|
|
248
248
|
{
|
|
249
249
|
"models": {
|
|
250
|
-
"anthropic": {
|
|
250
|
+
"anthropic:api_key": {
|
|
251
|
+
"cachedAt": "2025-01-17T10:00:00Z",
|
|
251
252
|
"list": [
|
|
252
253
|
{ "id": "claude-sonnet-4-5@20250929", "name": "Claude Sonnet 4.5" },
|
|
253
254
|
{ "id": "claude-opus-4-1@20250805", "name": "Claude Opus 4.1" }
|
|
254
255
|
]
|
|
255
256
|
},
|
|
256
|
-
"
|
|
257
|
+
"anthropic:vertex": {
|
|
258
|
+
"cachedAt": "2025-01-17T09:00:00Z",
|
|
259
|
+
"list": [
|
|
260
|
+
{ "id": "claude-3-5-sonnet@20241022", "name": "Claude 3.5 Sonnet" }
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
"gemini:api_key": {
|
|
264
|
+
"cachedAt": "2025-01-17T08:00:00Z",
|
|
257
265
|
"list": [
|
|
258
266
|
{ "id": "gemini-2.5-pro", "name": "Gemini 2.5 Pro" }
|
|
259
267
|
]
|
|
@@ -262,7 +270,7 @@ The `~/.gencode/providers.json` file stores cached models for each connected pro
|
|
|
262
270
|
}
|
|
263
271
|
```
|
|
264
272
|
|
|
265
|
-
Given a model ID, the system searches through each provider's model list to find the owning provider.
|
|
273
|
+
Given a model ID, the system searches through each provider's model list to find the owning provider. The key format is `"provider:authMethod"` to support multiple authentication methods for the same provider.
|
|
266
274
|
|
|
267
275
|
#### 4.2.3 Provider to Prompt Type Mapping
|
|
268
276
|
|
|
@@ -293,7 +301,7 @@ This ensures the system always has a valid prompt to use.
|
|
|
293
301
|
// 5.1.1 Provider Type Definition
|
|
294
302
|
export type ProviderType = 'anthropic' | 'openai' | 'gemini' | 'generic';
|
|
295
303
|
|
|
296
|
-
// 5.1.2 Look up provider for a model from ~/.
|
|
304
|
+
// 5.1.2 Look up provider for a model from ~/.gen/providers.json
|
|
297
305
|
export function getProviderForModel(model: string): string | null {
|
|
298
306
|
const config = loadProvidersConfig();
|
|
299
307
|
if (!config?.models) return null;
|
|
@@ -462,7 +470,7 @@ User starts GenCode CLI
|
|
|
462
470
|
│
|
|
463
471
|
▼
|
|
464
472
|
┌─────────────────────┐ ┌─────────────────────────────┐
|
|
465
|
-
│ 3. Memory Loading │────▶│ Load ~/.
|
|
473
|
+
│ 3. Memory Loading │────▶│ Load ~/.gen/GENCODE.md │
|
|
466
474
|
│ (if exists) │ │ Load ./CLAUDE.md (fallback) │
|
|
467
475
|
└──────────┬──────────┘ └─────────────────────────────┘
|
|
468
476
|
│
|
|
@@ -480,7 +488,7 @@ User starts GenCode CLI
|
|
|
480
488
|
│ │
|
|
481
489
|
│ ┌─────────────────────────────────────────────────┐ │
|
|
482
490
|
│ │ a. getPromptTypeForModel(model, fallback) │ │
|
|
483
|
-
│ │ - Look up provider in ~/.
|
|
491
|
+
│ │ - Look up provider in ~/.gen/providers.json│
|
|
484
492
|
│ │ - Map provider → prompt type │ │
|
|
485
493
|
│ │ - Fallback to 'generic' if not found │ │
|
|
486
494
|
│ └─────────────────────────────────────────────────┘ │
|
package/docs/proposals/README.md
CHANGED
|
@@ -19,15 +19,14 @@ This directory contains enhancement proposals for the gencode project. Each prop
|
|
|
19
19
|
| [0001](./0001-web-fetch-tool.md) | WebFetch Tool | Implemented |
|
|
20
20
|
| [0002](./0002-web-search-tool.md) | WebSearch Tool | Implemented |
|
|
21
21
|
| [0003](./0003-task-subagents.md) | Task Tool & Subagents | Draft |
|
|
22
|
-
| [0004](./0004-plan-mode.md) | Plan Mode |
|
|
22
|
+
| [0004](./0004-plan-mode.md) | Plan Mode | Implemented |
|
|
23
23
|
| [0005](./0005-todo-system.md) | Todo System | Implemented |
|
|
24
24
|
| [0006](./0006-memory-system.md) | Memory System (MYCODE.md) | Implemented |
|
|
25
25
|
| [0007](./0007-context-management.md) | Context Management | Draft |
|
|
26
|
-
| [0008](./0008-checkpointing.md) | Checkpointing |
|
|
26
|
+
| [0008](./0008-checkpointing.md) | Checkpointing | Partially Implemented |
|
|
27
27
|
| [0009](./0009-hooks-system.md) | Hooks System | Draft |
|
|
28
28
|
| [0010](./0010-mcp-integration.md) | MCP Integration | Draft |
|
|
29
|
-
| [
|
|
30
|
-
| [0012](./0012-ask-user-question.md) | AskUserQuestion Tool | Implemented |
|
|
29
|
+
| [0021](./0021-skills-system.md) | Skills System | Draft |
|
|
31
30
|
| [0041](./0041-configuration-system.md) | Configuration System | Implemented |
|
|
32
31
|
| [0042](./0042-prompt-optimization.md) | Prompt System Optimization | Implemented |
|
|
33
32
|
|
|
@@ -35,6 +34,8 @@ This directory contains enhancement proposals for the gencode project. Each prop
|
|
|
35
34
|
|
|
36
35
|
| ID | Title | Status |
|
|
37
36
|
|----|-------|--------|
|
|
37
|
+
| [0011](./0011-custom-commands.md) | Custom Commands | Draft |
|
|
38
|
+
| [0012](./0012-ask-user-question.md) | AskUserQuestion Tool | Implemented |
|
|
38
39
|
| [0013](./0013-multi-edit-tool.md) | MultiEdit Tool | Draft |
|
|
39
40
|
| [0014](./0014-lsp-tool.md) | LSP Tool | Draft |
|
|
40
41
|
| [0015](./0015-ls-tool.md) | LS Tool | Draft |
|
|
@@ -43,7 +44,6 @@ This directory contains enhancement proposals for the gencode project. Each prop
|
|
|
43
44
|
| [0018](./0018-parallel-tool-execution.md) | Parallel Tool Execution | Draft |
|
|
44
45
|
| [0019](./0019-session-enhancements.md) | Session Enhancements | Draft |
|
|
45
46
|
| [0020](./0020-session-summarization.md) | Session Summarization | Draft |
|
|
46
|
-
| [0021](./0021-skills-system.md) | Skills System | Draft |
|
|
47
47
|
| [0022](./0022-plugin-system.md) | Plugin System | Draft |
|
|
48
48
|
| [0023](./0023-permission-enhancements.md) | Permission Enhancements | Draft |
|
|
49
49
|
| [0024](./0024-keyboard-shortcuts.md) | Keyboard Shortcuts | Draft |
|
package/docs/providers.md
CHANGED
|
@@ -131,16 +131,25 @@ To use Claude models via Google Vertex AI:
|
|
|
131
131
|
### 1. Set Environment Variables
|
|
132
132
|
|
|
133
133
|
```bash
|
|
134
|
+
# Required: Enable Vertex AI
|
|
135
|
+
export CLAUDE_CODE_USE_VERTEX=1
|
|
136
|
+
|
|
134
137
|
# Required: Your GCP project ID
|
|
135
138
|
export ANTHROPIC_VERTEX_PROJECT_ID="your-project-id"
|
|
136
139
|
|
|
137
|
-
#
|
|
138
|
-
export
|
|
140
|
+
# Required: Region (use 'global' or specific region)
|
|
141
|
+
export CLOUD_ML_REGION=global
|
|
139
142
|
```
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
**Environment Variable Details:**
|
|
145
|
+
|
|
146
|
+
| Variable | Required | Default | Description |
|
|
147
|
+
|----------|----------|---------|-------------|
|
|
148
|
+
| `CLAUDE_CODE_USE_VERTEX` | Yes | - | Set to `1` to enable Vertex AI |
|
|
149
|
+
| `ANTHROPIC_VERTEX_PROJECT_ID` | Yes | - | Your GCP project ID (also accepts `GCLOUD_PROJECT` or `GOOGLE_CLOUD_PROJECT`) |
|
|
150
|
+
| `CLOUD_ML_REGION` | Yes | `us-east5` | Region (use `global` or specific region like `us-east5`) |
|
|
151
|
+
|
|
152
|
+
**Documentation:** https://code.claude.com/docs/en/google-vertex-ai
|
|
144
153
|
|
|
145
154
|
### 2. Authenticate with Google Cloud
|
|
146
155
|
|
|
@@ -169,12 +178,24 @@ gcloud services enable aiplatform.googleapis.com
|
|
|
169
178
|
# Press Enter to connect
|
|
170
179
|
```
|
|
171
180
|
|
|
181
|
+
## Architecture
|
|
182
|
+
|
|
183
|
+
GenCode uses a two-layer provider architecture:
|
|
184
|
+
|
|
185
|
+
- **Layer 1: Provider** (Semantic layer) - `anthropic` | `openai` | `gemini`
|
|
186
|
+
- **Layer 2: AuthMethod** (Implementation layer) - `api_key` | `vertex` | `bedrock` | `azure`
|
|
187
|
+
|
|
188
|
+
Each provider can support multiple authentication methods. For example, Anthropic supports:
|
|
189
|
+
- `api_key` - Direct API access
|
|
190
|
+
- `vertex` - Google Vertex AI
|
|
191
|
+
- `bedrock` - Amazon Bedrock (coming soon)
|
|
192
|
+
|
|
172
193
|
## Configuration Storage
|
|
173
194
|
|
|
174
195
|
Provider connections and cached models are stored in:
|
|
175
196
|
|
|
176
197
|
```
|
|
177
|
-
~/.
|
|
198
|
+
~/.gen/
|
|
178
199
|
├── settings.json # Current model and provider settings
|
|
179
200
|
└── providers.json # Provider connections and model cache
|
|
180
201
|
```
|
|
@@ -185,23 +206,87 @@ Provider connections and cached models are stored in:
|
|
|
185
206
|
{
|
|
186
207
|
"connections": {
|
|
187
208
|
"anthropic": {
|
|
188
|
-
"
|
|
209
|
+
"authMethod": "vertex",
|
|
210
|
+
"method": "Google Vertex AI",
|
|
189
211
|
"connectedAt": "2025-01-15T10:00:00Z"
|
|
212
|
+
},
|
|
213
|
+
"openai": {
|
|
214
|
+
"authMethod": "api_key",
|
|
215
|
+
"method": "Direct API",
|
|
216
|
+
"connectedAt": "2025-01-15T09:00:00Z"
|
|
190
217
|
}
|
|
191
218
|
},
|
|
192
219
|
"models": {
|
|
193
|
-
"anthropic": {
|
|
220
|
+
"anthropic:vertex": {
|
|
194
221
|
"cachedAt": "2025-01-15T10:00:00Z",
|
|
222
|
+
"list": [
|
|
223
|
+
{ "id": "claude-3-5-sonnet@20241022", "name": "Claude 3.5 Sonnet" }
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
"anthropic:api_key": {
|
|
227
|
+
"cachedAt": "2025-01-15T11:00:00Z",
|
|
195
228
|
"list": [
|
|
196
229
|
{ "id": "claude-sonnet-4-5@20250929", "name": "Claude Sonnet 4.5" }
|
|
197
230
|
]
|
|
231
|
+
},
|
|
232
|
+
"openai:api_key": {
|
|
233
|
+
"cachedAt": "2025-01-15T09:00:00Z",
|
|
234
|
+
"list": [
|
|
235
|
+
{ "id": "gpt-4", "name": "GPT-4" }
|
|
236
|
+
]
|
|
198
237
|
}
|
|
199
238
|
},
|
|
200
239
|
"searchProvider": "exa"
|
|
201
240
|
}
|
|
202
241
|
```
|
|
203
242
|
|
|
204
|
-
|
|
243
|
+
**Key points:**
|
|
244
|
+
- `connections` stores the active connection for each provider
|
|
245
|
+
- `authMethod` - Authentication method being used
|
|
246
|
+
- `method` - Display name (optional, legacy field)
|
|
247
|
+
- `models` uses `"provider:authMethod"` as the key
|
|
248
|
+
- Supports multiple auth methods for the same provider
|
|
249
|
+
- Each auth method has its own cached model list
|
|
250
|
+
- `searchProvider` - Selected search provider (`exa`, `serper`, `brave`)
|
|
251
|
+
|
|
252
|
+
### Migration from Old Format
|
|
253
|
+
|
|
254
|
+
If you're upgrading from an older version, run the migration script to update your configuration:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
npm run migrate
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The script will:
|
|
261
|
+
1. Convert old format models keys (e.g., `"anthropic"`) to new format (e.g., `"anthropic:vertex"`)
|
|
262
|
+
2. Add `authMethod` field to connections
|
|
263
|
+
3. Create a backup of your old configuration
|
|
264
|
+
|
|
265
|
+
**Old format:**
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"models": {
|
|
269
|
+
"anthropic": {
|
|
270
|
+
"provider": "anthropic",
|
|
271
|
+
"authMethod": "vertex",
|
|
272
|
+
"cachedAt": "...",
|
|
273
|
+
"list": [...]
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**New format:**
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"models": {
|
|
283
|
+
"anthropic:vertex": {
|
|
284
|
+
"cachedAt": "...",
|
|
285
|
+
"list": [...]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
```
|
|
205
290
|
|
|
206
291
|
## Troubleshooting
|
|
207
292
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gencode-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "An open-source AI assistant for your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"start": "node dist/cli/index.js",
|
|
15
15
|
"start:dev": "npx tsx src/cli/index.tsx",
|
|
16
16
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
17
|
-
"example": "npx tsx examples/basic.ts"
|
|
17
|
+
"example": "npx tsx examples/basic.ts",
|
|
18
|
+
"migrate": "npx tsx scripts/migrate.ts"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|
|
20
21
|
"agent",
|