gencode-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +11 -0
- package/CLAUDE.md +70 -0
- package/LICENSE +21 -0
- package/README.md +117 -0
- package/dist/agent/agent.d.ts +84 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +233 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/index.d.ts +6 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +6 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/types.d.ts +47 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +5 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/cli/components/App.d.ts +14 -0
- package/dist/cli/components/App.d.ts.map +1 -0
- package/dist/cli/components/App.js +395 -0
- package/dist/cli/components/App.js.map +1 -0
- package/dist/cli/components/CommandSuggestions.d.ts +13 -0
- package/dist/cli/components/CommandSuggestions.d.ts.map +1 -0
- package/dist/cli/components/CommandSuggestions.js +32 -0
- package/dist/cli/components/CommandSuggestions.js.map +1 -0
- package/dist/cli/components/Header.d.ts +9 -0
- package/dist/cli/components/Header.d.ts.map +1 -0
- package/dist/cli/components/Header.js +13 -0
- package/dist/cli/components/Header.js.map +1 -0
- package/dist/cli/components/Input.d.ts +13 -0
- package/dist/cli/components/Input.d.ts.map +1 -0
- package/dist/cli/components/Input.js +27 -0
- package/dist/cli/components/Input.js.map +1 -0
- package/dist/cli/components/Logo.d.ts +2 -0
- package/dist/cli/components/Logo.d.ts.map +1 -0
- package/dist/cli/components/Logo.js +8 -0
- package/dist/cli/components/Logo.js.map +1 -0
- package/dist/cli/components/Messages.d.ts +37 -0
- package/dist/cli/components/Messages.d.ts.map +1 -0
- package/dist/cli/components/Messages.js +106 -0
- package/dist/cli/components/Messages.js.map +1 -0
- package/dist/cli/components/ModelSelector.d.ts +13 -0
- package/dist/cli/components/ModelSelector.d.ts.map +1 -0
- package/dist/cli/components/ModelSelector.js +72 -0
- package/dist/cli/components/ModelSelector.js.map +1 -0
- package/dist/cli/components/Spinner.d.ts +12 -0
- package/dist/cli/components/Spinner.d.ts.map +1 -0
- package/dist/cli/components/Spinner.js +45 -0
- package/dist/cli/components/Spinner.js.map +1 -0
- package/dist/cli/components/index.d.ts +12 -0
- package/dist/cli/components/index.d.ts.map +1 -0
- package/dist/cli/components/index.js +12 -0
- package/dist/cli/components/index.js.map +1 -0
- package/dist/cli/components/theme.d.ts +31 -0
- package/dist/cli/components/theme.d.ts.map +1 -0
- package/dist/cli/components/theme.js +36 -0
- package/dist/cli/components/theme.js.map +1 -0
- package/dist/cli/index-legacy.d.ts +7 -0
- package/dist/cli/index-legacy.d.ts.map +1 -0
- package/dist/cli/index-legacy.js +431 -0
- package/dist/cli/index-legacy.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +116 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ink-cli.d.ts +7 -0
- package/dist/cli/ink-cli.d.ts.map +1 -0
- package/dist/cli/ink-cli.js +105 -0
- package/dist/cli/ink-cli.js.map +1 -0
- package/dist/cli/session-picker.d.ts +16 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +280 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/ui.d.ts +61 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +364 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +31 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +65 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/types.d.ts +22 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +6 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/index.d.ts +10 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +9 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/init.d.ts +20 -0
- package/dist/memory/init.d.ts.map +1 -0
- package/dist/memory/init.js +332 -0
- package/dist/memory/init.js.map +1 -0
- package/dist/memory/manager.d.ts +85 -0
- package/dist/memory/manager.d.ts.map +1 -0
- package/dist/memory/manager.js +234 -0
- package/dist/memory/manager.js.map +1 -0
- package/dist/memory/types.d.ts +74 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +6 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/permissions/index.d.ts +7 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +6 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/permissions/manager.d.ts +32 -0
- package/dist/permissions/manager.d.ts.map +1 -0
- package/dist/permissions/manager.js +79 -0
- package/dist/permissions/manager.js.map +1 -0
- package/dist/permissions/types.d.ts +14 -0
- package/dist/permissions/types.d.ts.map +1 -0
- package/dist/permissions/types.js +17 -0
- package/dist/permissions/types.js.map +1 -0
- package/dist/providers/anthropic.d.ts +20 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +185 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/gemini.d.ts +21 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +241 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +34 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +72 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/openai.d.ts +19 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +221 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/types.d.ts +125 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +6 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/session/index.d.ts +6 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +6 -0
- package/dist/session/index.js.map +1 -0
- package/dist/session/manager.d.ts +101 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +295 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/session/types.d.ts +39 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +10 -0
- package/dist/session/types.js.map +1 -0
- package/dist/tools/builtin/bash.d.ts +7 -0
- package/dist/tools/builtin/bash.d.ts.map +1 -0
- package/dist/tools/builtin/bash.js +80 -0
- package/dist/tools/builtin/bash.js.map +1 -0
- package/dist/tools/builtin/edit.d.ts +7 -0
- package/dist/tools/builtin/edit.d.ts.map +1 -0
- package/dist/tools/builtin/edit.js +32 -0
- package/dist/tools/builtin/edit.js.map +1 -0
- package/dist/tools/builtin/glob.d.ts +7 -0
- package/dist/tools/builtin/glob.d.ts.map +1 -0
- package/dist/tools/builtin/glob.js +36 -0
- package/dist/tools/builtin/glob.js.map +1 -0
- package/dist/tools/builtin/grep.d.ts +7 -0
- package/dist/tools/builtin/grep.d.ts.map +1 -0
- package/dist/tools/builtin/grep.js +59 -0
- package/dist/tools/builtin/grep.js.map +1 -0
- package/dist/tools/builtin/read.d.ts +7 -0
- package/dist/tools/builtin/read.d.ts.map +1 -0
- package/dist/tools/builtin/read.js +29 -0
- package/dist/tools/builtin/read.js.map +1 -0
- package/dist/tools/builtin/write.d.ts +7 -0
- package/dist/tools/builtin/write.d.ts.map +1 -0
- package/dist/tools/builtin/write.js +24 -0
- package/dist/tools/builtin/write.js.map +1 -0
- package/dist/tools/index.d.ts +38 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +32 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +22 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +71 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +62 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +126 -0
- package/dist/tools/types.js.map +1 -0
- package/docs/README.md +16 -0
- package/docs/proposals/0001-web-fetch-tool.md +293 -0
- package/docs/proposals/0002-web-search-tool.md +306 -0
- package/docs/proposals/0003-task-subagents.md +333 -0
- package/docs/proposals/0004-plan-mode.md +338 -0
- package/docs/proposals/0005-todo-system.md +299 -0
- package/docs/proposals/0006-memory-system.md +539 -0
- package/docs/proposals/0007-context-management.md +429 -0
- package/docs/proposals/0008-checkpointing.md +327 -0
- package/docs/proposals/0009-hooks-system.md +343 -0
- package/docs/proposals/0010-mcp-integration.md +382 -0
- package/docs/proposals/0011-custom-commands.md +374 -0
- package/docs/proposals/0012-ask-user-question.md +317 -0
- package/docs/proposals/0013-multi-edit-tool.md +345 -0
- package/docs/proposals/0014-lsp-tool.md +478 -0
- package/docs/proposals/0015-ls-tool.md +407 -0
- package/docs/proposals/0016-kill-shell-tool.md +455 -0
- package/docs/proposals/0017-background-tasks.md +489 -0
- package/docs/proposals/0018-parallel-tool-execution.md +415 -0
- package/docs/proposals/0019-session-enhancements.md +462 -0
- package/docs/proposals/0020-session-summarization.md +447 -0
- package/docs/proposals/0021-skills-system.md +409 -0
- package/docs/proposals/0022-plugin-system.md +467 -0
- package/docs/proposals/0023-permission-enhancements.md +470 -0
- package/docs/proposals/0024-keyboard-shortcuts.md +443 -0
- package/docs/proposals/0025-cost-tracking.md +447 -0
- package/docs/proposals/0026-git-integration.md +475 -0
- package/docs/proposals/0027-enhanced-read-tool.md +514 -0
- package/docs/proposals/0028-enhanced-bash-tool.md +511 -0
- package/docs/proposals/0029-notebook-edit-tool.md +413 -0
- package/docs/proposals/0030-plugin-marketplace.md +360 -0
- package/docs/proposals/0031-command-suggestions.md +295 -0
- package/docs/proposals/0032-ide-integrations.md +328 -0
- package/docs/proposals/0033-enterprise-deployment.md +221 -0
- package/docs/proposals/0034-sandboxing.md +273 -0
- package/docs/proposals/0035-auto-updater.md +311 -0
- package/docs/proposals/0036-enhanced-glob-tool.md +267 -0
- package/docs/proposals/0037-enhanced-grep-tool.md +360 -0
- package/docs/proposals/0038-interactive-cli-ui.md +373 -0
- package/docs/proposals/0039-streaming-enhancements.md +359 -0
- package/docs/proposals/0040-multi-provider-enhancements.md +369 -0
- package/docs/proposals/README.md +84 -0
- package/docs/proposals/TEMPLATE.md +57 -0
- package/docs/proposals/research/claude-code-research.md +307 -0
- package/examples/agent-demo.ts +115 -0
- package/examples/basic.ts +166 -0
- package/package.json +50 -0
- package/src/agent/agent.ts +276 -0
- package/src/agent/index.ts +6 -0
- package/src/agent/types.ts +62 -0
- package/src/cli/components/App.tsx +565 -0
- package/src/cli/components/CommandSuggestions.tsx +58 -0
- package/src/cli/components/Header.tsx +36 -0
- package/src/cli/components/Input.tsx +60 -0
- package/src/cli/components/Logo.tsx +16 -0
- package/src/cli/components/Messages.tsx +210 -0
- package/src/cli/components/ModelSelector.tsx +135 -0
- package/src/cli/components/Spinner.tsx +72 -0
- package/src/cli/components/index.ts +21 -0
- package/src/cli/components/theme.ts +36 -0
- package/src/cli/index.tsx +136 -0
- package/src/config/index.ts +7 -0
- package/src/config/manager.ts +77 -0
- package/src/config/types.ts +25 -0
- package/src/index.ts +86 -0
- package/src/permissions/index.ts +7 -0
- package/src/permissions/manager.ts +97 -0
- package/src/permissions/types.ts +29 -0
- package/src/providers/anthropic.ts +224 -0
- package/src/providers/gemini.ts +295 -0
- package/src/providers/index.ts +97 -0
- package/src/providers/openai.ts +261 -0
- package/src/providers/types.ts +181 -0
- package/src/session/index.ts +6 -0
- package/src/session/manager.ts +354 -0
- package/src/session/types.ts +49 -0
- package/src/tools/builtin/bash.ts +92 -0
- package/src/tools/builtin/edit.ts +37 -0
- package/src/tools/builtin/glob.ts +42 -0
- package/src/tools/builtin/grep.ts +67 -0
- package/src/tools/builtin/read.ts +34 -0
- package/src/tools/builtin/write.ts +27 -0
- package/src/tools/index.ts +36 -0
- package/src/tools/registry.ts +83 -0
- package/src/tools/types.ts +172 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Claude Code Research Summary
|
|
2
|
+
|
|
3
|
+
This document preserves research findings from analyzing Claude Code's implementation, used to inform mycode's enhancement proposals.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Memory System Research](#1-memory-system-research)
|
|
8
|
+
2. [Context Management Research](#2-context-management-research)
|
|
9
|
+
3. [Session Management Research](#3-session-management-research)
|
|
10
|
+
4. [Cross-Tool Comparison](#4-cross-tool-comparison)
|
|
11
|
+
5. [References](#5-references)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. Memory System Research
|
|
16
|
+
|
|
17
|
+
### CLAUDE.md File Hierarchy
|
|
18
|
+
|
|
19
|
+
Claude Code uses a **4-level hierarchical memory system** (lowest to highest priority):
|
|
20
|
+
|
|
21
|
+
| Level | Location | Purpose | Version Control |
|
|
22
|
+
|-------|----------|---------|-----------------|
|
|
23
|
+
| 1. User/Global | `~/.claude/CLAUDE.md` | Personal preferences across all projects | Personal, not shared |
|
|
24
|
+
| 2. Project | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared project standards | Checked into git |
|
|
25
|
+
| 3. Rules | `./.claude/rules/*.md` | Modular rule organization | Checked into git |
|
|
26
|
+
| 4. Enterprise | Organization-defined location | Organization-wide policies | Managed by org |
|
|
27
|
+
|
|
28
|
+
### /init Command Internal Mechanism
|
|
29
|
+
|
|
30
|
+
The /init command uses a two-part system:
|
|
31
|
+
|
|
32
|
+
**1. Context Gathering Phase** - Uses BatchTool with GlobTool:
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"type": "tool_use",
|
|
36
|
+
"name": "BatchTool",
|
|
37
|
+
"input": {
|
|
38
|
+
"description": "Gather repository information",
|
|
39
|
+
"invocations": [
|
|
40
|
+
{ "tool_name": "GlobTool", "input": { "pattern": "package*.json" } },
|
|
41
|
+
{ "tool_name": "GlobTool", "input": { "pattern": "*.md" } },
|
|
42
|
+
{ "tool_name": "GlobTool", "input": { "pattern": ".cursor/rules/**" } },
|
|
43
|
+
{ "tool_name": "GlobTool", "input": { "pattern": ".cursorrules/**" } },
|
|
44
|
+
{ "tool_name": "GlobTool", "input": { "pattern": ".github/copilot-instructions.md" } }
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**2. Generation Phase** - Uses this prompt (384 tokens):
|
|
51
|
+
```
|
|
52
|
+
Please analyze this codebase and create a CLAUDE.md file, which will be
|
|
53
|
+
given to future instances of Claude Code to operate in this repository.
|
|
54
|
+
|
|
55
|
+
Include:
|
|
56
|
+
1. Commands that will be commonly used, such as how to build, lint, and
|
|
57
|
+
run tests. Include the necessary commands to develop in this codebase,
|
|
58
|
+
such as how to run a single test.
|
|
59
|
+
|
|
60
|
+
2. High-level code architecture and structure so that future instances
|
|
61
|
+
can be productive more quickly. Focus on the "big picture" architecture
|
|
62
|
+
that requires reading multiple files to understand.
|
|
63
|
+
|
|
64
|
+
Guidelines:
|
|
65
|
+
- If there's already a CLAUDE.md, suggest improvements to it.
|
|
66
|
+
- Do NOT repeat obvious instructions like "Write unit tests for all new
|
|
67
|
+
utilities" or "Never include sensitive information in code".
|
|
68
|
+
- Do NOT list every component or file structure that can be easily discovered.
|
|
69
|
+
- If there is a README.md, include the important parts.
|
|
70
|
+
- Do NOT make up sections like "Tips for Development" unless this is
|
|
71
|
+
expressly included in other files.
|
|
72
|
+
- If there are Cursor rules (.cursor/rules/ or .cursorrules) or Copilot
|
|
73
|
+
rules (.github/copilot-instructions.md), make sure to include them.
|
|
74
|
+
|
|
75
|
+
The file must begin with:
|
|
76
|
+
"This file provides guidance to Claude Code (claude.ai/code) when working
|
|
77
|
+
with code in this repository."
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Context Injection Method
|
|
81
|
+
|
|
82
|
+
**Critical Finding**: Memory content is NOT directly prepended to the system prompt.
|
|
83
|
+
|
|
84
|
+
Instead, Claude Code uses a specific pattern:
|
|
85
|
+
1. Memory content is wrapped in `<system-reminder>` tags
|
|
86
|
+
2. Placed as the **first user message** in the conversation (after system prompt)
|
|
87
|
+
3. Includes explicit instruction that content "may or may not be relevant"
|
|
88
|
+
|
|
89
|
+
```xml
|
|
90
|
+
<system-reminder>
|
|
91
|
+
As you answer the user's questions, you can use the following context:
|
|
92
|
+
# claudeMd
|
|
93
|
+
Codebase and user instructions are shown below. Be sure to adhere to these instructions.
|
|
94
|
+
IMPORTANT: These instructions OVERRIDE any default behavior and you MUST follow them exactly as written.
|
|
95
|
+
|
|
96
|
+
Contents of /path/to/CLAUDE.md (project instructions, checked into the codebase):
|
|
97
|
+
|
|
98
|
+
[CLAUDE.md content here]
|
|
99
|
+
|
|
100
|
+
IMPORTANT: this context may or may not be relevant to your tasks.
|
|
101
|
+
You should not respond to this context unless it is highly relevant to your task.
|
|
102
|
+
</system-reminder>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Import Syntax Rules
|
|
106
|
+
|
|
107
|
+
- Syntax: `@path/to/file` at beginning of a line
|
|
108
|
+
- Supports relative paths, absolute paths, and `~` expansion
|
|
109
|
+
- Max import depth: 5 levels (prevents circular references)
|
|
110
|
+
- Imports are NOT evaluated inside markdown code blocks or inline code spans
|
|
111
|
+
- Imported files can recursively import other files
|
|
112
|
+
|
|
113
|
+
### Size Limits
|
|
114
|
+
|
|
115
|
+
| Metric | Recommended Limit |
|
|
116
|
+
|--------|-------------------|
|
|
117
|
+
| Total memory content | < 40,000 characters |
|
|
118
|
+
| Warning threshold | ~44.7k characters |
|
|
119
|
+
| Individual rule files | < 500 lines |
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 2. Context Management Research
|
|
124
|
+
|
|
125
|
+
### Memory Tool API (Beta)
|
|
126
|
+
|
|
127
|
+
Claude Code's Memory Tool (beta API `context-management-2025-06-27`) enables agents to store and retrieve information across conversations.
|
|
128
|
+
|
|
129
|
+
**Commands:**
|
|
130
|
+
|
|
131
|
+
| Command | Description | Input |
|
|
132
|
+
|---------|-------------|-------|
|
|
133
|
+
| `view` | Shows directory or file contents | `path`, optional `view_range` |
|
|
134
|
+
| `create` | Creates a new file | `path`, `file_text` |
|
|
135
|
+
| `str_replace` | Replaces text in file | `path`, `old_str`, `new_str` |
|
|
136
|
+
| `insert` | Inserts at line | `path`, `insert_line`, `insert_text` |
|
|
137
|
+
| `delete` | Deletes file/directory | `path` |
|
|
138
|
+
| `rename` | Renames/moves file | `old_path`, `new_path` |
|
|
139
|
+
|
|
140
|
+
**System Prompt Injection:**
|
|
141
|
+
```
|
|
142
|
+
IMPORTANT: ALWAYS VIEW YOUR MEMORY DIRECTORY BEFORE DOING ANYTHING ELSE.
|
|
143
|
+
MEMORY PROTOCOL:
|
|
144
|
+
1. Use the `view` command of your `memory` tool to check for earlier progress.
|
|
145
|
+
2. ... (work on the task) ...
|
|
146
|
+
- As you make progress, record status / progress / thoughts etc in your memory.
|
|
147
|
+
ASSUME INTERRUPTION: Your context window might be reset at any moment, so you
|
|
148
|
+
risk losing any progress that is not recorded in your memory directory.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Context Editing Configuration
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
context_management: {
|
|
155
|
+
edits: [
|
|
156
|
+
{
|
|
157
|
+
type: "clear_tool_uses_20250919",
|
|
158
|
+
trigger: {
|
|
159
|
+
type: "input_tokens",
|
|
160
|
+
value: 100000 // Trigger at 100K tokens
|
|
161
|
+
},
|
|
162
|
+
keep: {
|
|
163
|
+
type: "tool_uses",
|
|
164
|
+
value: 3 // Keep last 3 tool results
|
|
165
|
+
},
|
|
166
|
+
exclude_tools: ["memory"] // Never clear memory operations
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Context Compaction SDK Configuration
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
compaction_control: {
|
|
176
|
+
enabled: true,
|
|
177
|
+
context_token_threshold: 100000, // Default: 100k tokens
|
|
178
|
+
summary_prompt: "Custom summary instructions...",
|
|
179
|
+
model: "claude-haiku-4-5" // Use cheaper model for summarization
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Threshold Guidelines:**
|
|
184
|
+
|
|
185
|
+
| Threshold | Use Case |
|
|
186
|
+
|-----------|----------|
|
|
187
|
+
| Low (5k-20k) | Sequential entity processing with clear boundaries |
|
|
188
|
+
| Medium (50k-100k) | Multi-phase workflows with fewer checkpoints |
|
|
189
|
+
| High (100k-150k) | Tasks requiring substantial historical context |
|
|
190
|
+
|
|
191
|
+
### Token Cost Analysis
|
|
192
|
+
|
|
193
|
+
**Before (No Context Management):**
|
|
194
|
+
|
|
195
|
+
| Turn | Input Tokens | Cost (Claude) |
|
|
196
|
+
|------|--------------|---------------|
|
|
197
|
+
| 1 | 1,000 | $0.003 |
|
|
198
|
+
| 10 | 10,000 | $0.03 |
|
|
199
|
+
| 25 | 50,000 | $0.15 |
|
|
200
|
+
| 50 | 100,000 | $0.30 |
|
|
201
|
+
| 100 | 200,000 | Context Error |
|
|
202
|
+
|
|
203
|
+
**After (With Context Editing - 84% reduction):**
|
|
204
|
+
|
|
205
|
+
| Turn | Input Tokens | Notes |
|
|
206
|
+
|------|--------------|-------|
|
|
207
|
+
| 1 | 1,000 | |
|
|
208
|
+
| 10 | 10,000 | |
|
|
209
|
+
| 25 | 50,000 | |
|
|
210
|
+
| 50 | 30,000 | Cleared at turn 40 |
|
|
211
|
+
| 100 | 40,000 | Cleared at turn 80 |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## 3. Session Management Research
|
|
216
|
+
|
|
217
|
+
### Session Resume Options
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
claude -c # Continue most recent conversation
|
|
221
|
+
claude -r "abc123" # Resume specific session by ID
|
|
222
|
+
claude --resume # Interactive conversation picker
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Fork Behavior
|
|
226
|
+
|
|
227
|
+
| Behavior | `forkSession: false` (default) | `forkSession: true` |
|
|
228
|
+
|----------|-------------------------------|---------------------|
|
|
229
|
+
| **Session ID** | Same as original | New session ID generated |
|
|
230
|
+
| **History** | Appends to original | Creates new branch from resume point |
|
|
231
|
+
| **Original Session** | Modified | Preserved unchanged |
|
|
232
|
+
|
|
233
|
+
### Permission Persistence
|
|
234
|
+
|
|
235
|
+
File creation permissions, previously approved commands, and MCP servers enabled in the original session remain active when resuming.
|
|
236
|
+
|
|
237
|
+
**Key Insight**: Permission decisions are session-scoped, not conversation-turn-scoped.
|
|
238
|
+
|
|
239
|
+
### Todo Persistence
|
|
240
|
+
|
|
241
|
+
Claude has access to a persistent todo list that survives:
|
|
242
|
+
- Context compaction (included in summary)
|
|
243
|
+
- Session resume
|
|
244
|
+
- Multiple compaction cycles
|
|
245
|
+
|
|
246
|
+
### Known Limitations
|
|
247
|
+
|
|
248
|
+
From GitHub issue discussions:
|
|
249
|
+
|
|
250
|
+
1. **Context Loss on Crash**: Unlike web chat, CLI sessions can lose context on interruption
|
|
251
|
+
2. **Summary Quality Degradation**: Multiple compactions can cause "off the rails" behavior
|
|
252
|
+
3. **Missing Debug Information**: Auto-compact summaries may omit critical debugging details
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 4. Cross-Tool Comparison
|
|
257
|
+
|
|
258
|
+
### Memory/Rules Comparison
|
|
259
|
+
|
|
260
|
+
| Feature | Claude Code | Cursor | GitHub Copilot | mycode (Target) |
|
|
261
|
+
|---------|-------------|--------|----------------|-----------------|
|
|
262
|
+
| **Config File** | `CLAUDE.md` | `.cursorrules` | `.github/copilot-instructions.md` | `MYCODE.md` / `CLAUDE.md` |
|
|
263
|
+
| **User Global** | `~/.claude/CLAUDE.md` | `~/.cursor/rules/` | N/A | `~/.mycode/MYCODE.md` |
|
|
264
|
+
| **Rules Directory** | `.claude/rules/` | `.cursor/rules/` | `.github/instructions/` | `.mycode/rules/` |
|
|
265
|
+
| **Path Scoping** | `paths:` frontmatter | `globs:` frontmatter | `applyTo:` frontmatter | Add `paths:` |
|
|
266
|
+
| **Quick Add** | `#` prefix | N/A | N/A | Add `#` prefix |
|
|
267
|
+
| **AI Init** | `/init` with LLM | N/A | N/A | Add `--ai` flag |
|
|
268
|
+
| **Import Syntax** | `@path/to/file` | N/A | N/A | Add `@path` |
|
|
269
|
+
|
|
270
|
+
### Context Compaction Comparison
|
|
271
|
+
|
|
272
|
+
| Tool | Trigger | Mechanism | Distinct Feature |
|
|
273
|
+
|------|---------|-----------|------------------|
|
|
274
|
+
| **Claude Code** | Manual `/compact` or auto at ~95% | LLM summary, fresh start | Custom instructions support |
|
|
275
|
+
| **OpenAI Codex CLI** | Token threshold (180k-244k) | Summary + recent messages (~20k tokens) | Preserves recent messages alongside summary |
|
|
276
|
+
| **OpenCode (SST)** | Auto on overflow | Summary marked as assistant message | Separate pruning of old tool outputs |
|
|
277
|
+
| **Amp (Sourcegraph)** | Manual only | Fork, handoff, thread reference | Philosophy: "keep conversations short" |
|
|
278
|
+
|
|
279
|
+
**Best Practice**: Trigger at 85-90% (earlier than Claude Code's 95%) with user warnings and disable options.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 5. References
|
|
284
|
+
|
|
285
|
+
### Official Documentation
|
|
286
|
+
- [Claude Code Memory Documentation](https://code.claude.com/docs/en/memory)
|
|
287
|
+
- [Session Management - Claude Docs](https://platform.claude.com/docs/en/agent-sdk/sessions)
|
|
288
|
+
- [Automatic Context Compaction - Claude Cookbook](https://platform.claude.com/cookbook/tool-use-automatic-context-compaction)
|
|
289
|
+
- [Memory Tool Documentation](https://platform.claude.com/docs/en/agents-and-tools/tool-use/memory-tool)
|
|
290
|
+
|
|
291
|
+
### Engineering Blog Posts
|
|
292
|
+
- [Claude Code Best Practices](https://www.anthropic.com/engineering/claude-code-best-practices)
|
|
293
|
+
- [Context Engineering for AI Agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
|
|
294
|
+
- [Using CLAUDE.MD Files](https://claude.com/blog/using-claude-md-files)
|
|
295
|
+
|
|
296
|
+
### Community Resources
|
|
297
|
+
- [Build your own /init command](https://kau.sh/blog/build-ai-init-command/)
|
|
298
|
+
- [Reverse engineering Claude Code](https://kirshatrov.com/posts/claude-code-internals)
|
|
299
|
+
- [The Complete Guide to CLAUDE.md](https://www.builder.io/blog/claude-md-guide)
|
|
300
|
+
- [Claude Code System Prompts Repository](https://github.com/Piebald-AI/claude-code-system-prompts)
|
|
301
|
+
- [Context Compaction Research](https://gist.github.com/badlogic/cd2ef65b0697c4dbe2d13fbecb0a0a5f)
|
|
302
|
+
|
|
303
|
+
### GitHub Issues
|
|
304
|
+
- [Local Session History and Context Persistence #12646](https://github.com/anthropics/claude-code/issues/12646)
|
|
305
|
+
- [Persistent Memory Between Sessions #14227](https://github.com/anthropics/claude-code/issues/14227)
|
|
306
|
+
- [Pre-Compact Auto-Save and Improved Summarization #13239](https://github.com/anthropics/claude-code/issues/13239)
|
|
307
|
+
- [Path Resolution Issues #4754](https://github.com/anthropics/claude-code/issues/4754)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Demo - Demonstrates the full agent loop with tools
|
|
3
|
+
*
|
|
4
|
+
* Run with: npx tsx examples/agent-demo.ts
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import 'dotenv/config';
|
|
8
|
+
import { Agent } from '../src/agent/index.js';
|
|
9
|
+
import type { AgentEvent } from '../src/agent/types.js';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
|
|
12
|
+
// Setup proxy if configured
|
|
13
|
+
const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
14
|
+
if (proxyUrl) {
|
|
15
|
+
const { setGlobalDispatcher, ProxyAgent } = await import('undici');
|
|
16
|
+
setGlobalDispatcher(new ProxyAgent(proxyUrl));
|
|
17
|
+
console.log(chalk.dim(`Using proxy: ${proxyUrl}\n`));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Detect provider
|
|
21
|
+
function getConfig() {
|
|
22
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
23
|
+
return { provider: 'anthropic' as const, model: 'claude-sonnet-4-20250514' };
|
|
24
|
+
} else if (process.env.OPENAI_API_KEY) {
|
|
25
|
+
return { provider: 'openai' as const, model: 'gpt-4o' };
|
|
26
|
+
} else if (process.env.GOOGLE_API_KEY || process.env.GEMINI_API_KEY) {
|
|
27
|
+
return { provider: 'gemini' as const, model: 'gemini-2.0-flash' };
|
|
28
|
+
}
|
|
29
|
+
throw new Error('No API key found. Set OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function main() {
|
|
33
|
+
console.log(chalk.cyan.bold('\n╭─────────────────────────────────────╮'));
|
|
34
|
+
console.log(chalk.cyan.bold('│') + ' ' + chalk.white.bold('Recode Agent Demo') + ' ' + chalk.cyan.bold('│'));
|
|
35
|
+
console.log(chalk.cyan.bold('╰─────────────────────────────────────╯\n'));
|
|
36
|
+
|
|
37
|
+
const config = getConfig();
|
|
38
|
+
console.log(chalk.blue('ℹ') + ` Provider: ${chalk.bold(config.provider)} | Model: ${chalk.bold(config.model)}`);
|
|
39
|
+
console.log(chalk.blue('ℹ') + ` Working directory: ${chalk.dim(process.cwd())}\n`);
|
|
40
|
+
|
|
41
|
+
const agent = new Agent({
|
|
42
|
+
...config,
|
|
43
|
+
cwd: process.cwd(),
|
|
44
|
+
maxTurns: 10,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Auto-approve all tools for demo (no confirmation prompts)
|
|
48
|
+
agent.setConfirmCallback(async (tool, input) => {
|
|
49
|
+
console.log(chalk.yellow('⚡') + ` Auto-approved: ${chalk.bold(tool)}`);
|
|
50
|
+
return true;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Demo prompt - ask agent to explore the project
|
|
54
|
+
const prompt = `Please explore this project and tell me:
|
|
55
|
+
1. What is the project structure?
|
|
56
|
+
2. What are the main source files?
|
|
57
|
+
3. Give me a brief summary of what this project does.
|
|
58
|
+
|
|
59
|
+
Use the Glob and Read tools to explore.`;
|
|
60
|
+
|
|
61
|
+
console.log(chalk.blue('▶ User:'));
|
|
62
|
+
console.log(chalk.white(' ' + prompt.split('\n').join('\n ')));
|
|
63
|
+
console.log();
|
|
64
|
+
|
|
65
|
+
let responseText = '';
|
|
66
|
+
|
|
67
|
+
// Run the agent
|
|
68
|
+
for await (const event of agent.run(prompt)) {
|
|
69
|
+
switch (event.type) {
|
|
70
|
+
case 'text':
|
|
71
|
+
responseText += event.text;
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
case 'tool_start':
|
|
75
|
+
console.log(chalk.magenta('⚙ Tool:') + ` ${chalk.bold(event.name)}`);
|
|
76
|
+
const inputStr = JSON.stringify(event.input);
|
|
77
|
+
console.log(chalk.dim(' Input: ' + inputStr.slice(0, 80) + (inputStr.length > 80 ? '...' : '')));
|
|
78
|
+
break;
|
|
79
|
+
|
|
80
|
+
case 'tool_result':
|
|
81
|
+
const status = event.result.success ? chalk.green('✓') : chalk.red('✗');
|
|
82
|
+
console.log(status + chalk.dim(` ${event.name} completed`));
|
|
83
|
+
// Show first few lines of output
|
|
84
|
+
const lines = event.result.output.split('\n').slice(0, 5);
|
|
85
|
+
for (const line of lines) {
|
|
86
|
+
console.log(chalk.dim(' │ ') + line.slice(0, 80));
|
|
87
|
+
}
|
|
88
|
+
if (event.result.output.split('\n').length > 5) {
|
|
89
|
+
console.log(chalk.dim(' │ ...'));
|
|
90
|
+
}
|
|
91
|
+
console.log();
|
|
92
|
+
break;
|
|
93
|
+
|
|
94
|
+
case 'error':
|
|
95
|
+
console.log(chalk.red('✗ Error:') + ` ${event.error.message}`);
|
|
96
|
+
break;
|
|
97
|
+
|
|
98
|
+
case 'done':
|
|
99
|
+
console.log(chalk.green('◀ Assistant:'));
|
|
100
|
+
const respLines = responseText.split('\n');
|
|
101
|
+
for (const line of respLines) {
|
|
102
|
+
console.log(' ' + line);
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
console.log(chalk.dim('\n─'.repeat(50)));
|
|
109
|
+
console.log(chalk.green('✓') + ' Demo completed!\n');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
main().catch((error) => {
|
|
113
|
+
console.error(chalk.red('Error:'), error.message);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic example demonstrating multi-LLM support
|
|
3
|
+
*
|
|
4
|
+
* Run with: npx tsx examples/basic.ts
|
|
5
|
+
*
|
|
6
|
+
* Create a .env file with your API keys (see .env.example)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import 'dotenv/config';
|
|
10
|
+
|
|
11
|
+
// Setup proxy if configured
|
|
12
|
+
const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
|
|
13
|
+
if (proxyUrl) {
|
|
14
|
+
const { setGlobalDispatcher, ProxyAgent } = await import('undici');
|
|
15
|
+
setGlobalDispatcher(new ProxyAgent(proxyUrl));
|
|
16
|
+
console.log(`Using proxy: ${proxyUrl}\n`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
OpenAIProvider,
|
|
21
|
+
AnthropicProvider,
|
|
22
|
+
GeminiProvider,
|
|
23
|
+
createProvider,
|
|
24
|
+
inferProvider,
|
|
25
|
+
type LLMProvider,
|
|
26
|
+
type Message,
|
|
27
|
+
type ToolDefinition,
|
|
28
|
+
} from '../src/index.js';
|
|
29
|
+
|
|
30
|
+
// Simple tool definition for testing
|
|
31
|
+
const tools: ToolDefinition[] = [
|
|
32
|
+
{
|
|
33
|
+
name: 'get_weather',
|
|
34
|
+
description: 'Get the current weather for a location',
|
|
35
|
+
parameters: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
location: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'The city and state, e.g., San Francisco, CA',
|
|
41
|
+
},
|
|
42
|
+
unit: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
enum: ['celsius', 'fahrenheit'],
|
|
45
|
+
description: 'Temperature unit',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ['location'],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
async function testProvider(provider: LLMProvider, model: string) {
|
|
54
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
55
|
+
console.log(`Testing ${provider.name} with model: ${model}`);
|
|
56
|
+
console.log('='.repeat(60));
|
|
57
|
+
|
|
58
|
+
const messages: Message[] = [{ role: 'user', content: 'What is the weather in Tokyo?' }];
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
// Test non-streaming completion
|
|
62
|
+
console.log('\n--- Non-streaming completion ---');
|
|
63
|
+
const response = await provider.complete({
|
|
64
|
+
model,
|
|
65
|
+
messages,
|
|
66
|
+
tools,
|
|
67
|
+
systemPrompt: 'You are a helpful assistant. Use tools when appropriate.',
|
|
68
|
+
maxTokens: 1024,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
console.log('Stop reason:', response.stopReason);
|
|
72
|
+
console.log('Content:');
|
|
73
|
+
for (const content of response.content) {
|
|
74
|
+
if (content.type === 'text') {
|
|
75
|
+
console.log(` [text] ${content.text}`);
|
|
76
|
+
} else if (content.type === 'tool_use') {
|
|
77
|
+
console.log(` [tool_use] ${content.name}(${JSON.stringify(content.input)})`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (response.usage) {
|
|
81
|
+
console.log(`Usage: ${response.usage.inputTokens} input, ${response.usage.outputTokens} output`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Test streaming completion
|
|
85
|
+
console.log('\n--- Streaming completion ---');
|
|
86
|
+
process.stdout.write('Response: ');
|
|
87
|
+
for await (const chunk of provider.stream({
|
|
88
|
+
model,
|
|
89
|
+
messages: [{ role: 'user', content: 'Say "hello world" in Japanese.' }],
|
|
90
|
+
maxTokens: 100,
|
|
91
|
+
})) {
|
|
92
|
+
if (chunk.type === 'text') {
|
|
93
|
+
process.stdout.write(chunk.text);
|
|
94
|
+
} else if (chunk.type === 'tool_start') {
|
|
95
|
+
process.stdout.write(`\n[Tool: ${chunk.name}]`);
|
|
96
|
+
} else if (chunk.type === 'done') {
|
|
97
|
+
console.log(`\n(Stop: ${chunk.response.stopReason})`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error(`Error: ${error instanceof Error ? error.message : error}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function main() {
|
|
106
|
+
console.log('Recode - Multi-LLM Agent SDK Demo\n');
|
|
107
|
+
|
|
108
|
+
// Test each provider if API key is available
|
|
109
|
+
const tests: Array<{ provider: LLMProvider; model: string; envKey: string }> = [];
|
|
110
|
+
|
|
111
|
+
if (process.env.OPENAI_API_KEY) {
|
|
112
|
+
tests.push({
|
|
113
|
+
provider: new OpenAIProvider(),
|
|
114
|
+
model: 'gpt-4o-mini',
|
|
115
|
+
envKey: 'OPENAI_API_KEY',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
120
|
+
tests.push({
|
|
121
|
+
provider: new AnthropicProvider(),
|
|
122
|
+
model: 'claude-3-5-sonnet-20241022',
|
|
123
|
+
envKey: 'ANTHROPIC_API_KEY',
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (process.env.GOOGLE_API_KEY || process.env.GEMINI_API_KEY) {
|
|
128
|
+
tests.push({
|
|
129
|
+
provider: new GeminiProvider(),
|
|
130
|
+
model: 'gemini-2.0-flash',
|
|
131
|
+
envKey: 'GOOGLE_API_KEY',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (tests.length === 0) {
|
|
136
|
+
console.log('No API keys found. Please set at least one of:');
|
|
137
|
+
console.log(' - OPENAI_API_KEY');
|
|
138
|
+
console.log(' - ANTHROPIC_API_KEY');
|
|
139
|
+
console.log(' - GOOGLE_API_KEY (or GEMINI_API_KEY)');
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
console.log(`Found ${tests.length} provider(s) with API keys.\n`);
|
|
144
|
+
|
|
145
|
+
// Test provider inference
|
|
146
|
+
console.log('--- Provider Inference Test ---');
|
|
147
|
+
console.log(`gpt-4o -> ${inferProvider('gpt-4o')}`);
|
|
148
|
+
console.log(`claude-3-opus -> ${inferProvider('claude-3-opus')}`);
|
|
149
|
+
console.log(`gemini-1.5-pro -> ${inferProvider('gemini-1.5-pro')}`);
|
|
150
|
+
|
|
151
|
+
// Test createProvider factory (use first available provider)
|
|
152
|
+
console.log('\n--- Factory Test ---');
|
|
153
|
+
const firstProvider = tests[0];
|
|
154
|
+
const providerName = firstProvider.provider.name as 'openai' | 'anthropic' | 'gemini';
|
|
155
|
+
const factoryProvider = createProvider({ provider: providerName });
|
|
156
|
+
console.log(`Created provider via factory: ${factoryProvider.name}`);
|
|
157
|
+
|
|
158
|
+
// Run provider tests
|
|
159
|
+
for (const test of tests) {
|
|
160
|
+
await testProvider(test.provider, test.model);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
console.log('\n\nAll tests completed!');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
main().catch(console.error);
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gencode-ai",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "GenCode - An open-source, provider-agnostic AI coding assistant",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"gencode": "./dist/cli/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"dev": "tsc --watch",
|
|
14
|
+
"start": "npx tsx src/cli/index.tsx",
|
|
15
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
16
|
+
"example": "npx tsx examples/basic.ts"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"agent",
|
|
20
|
+
"llm",
|
|
21
|
+
"openai",
|
|
22
|
+
"anthropic",
|
|
23
|
+
"gemini",
|
|
24
|
+
"ai"
|
|
25
|
+
],
|
|
26
|
+
"author": "Meng Yan",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@anthropic-ai/sdk": "^0.71.2",
|
|
30
|
+
"@google/generative-ai": "^0.24.1",
|
|
31
|
+
"chalk": "^5.6.2",
|
|
32
|
+
"dotenv": "^17.2.3",
|
|
33
|
+
"fast-glob": "^3.3.3",
|
|
34
|
+
"glob": "^13.0.0",
|
|
35
|
+
"ink": "^6.6.0",
|
|
36
|
+
"ink-spinner": "^5.0.0",
|
|
37
|
+
"ink-text-input": "^6.0.0",
|
|
38
|
+
"openai": "^6.16.0",
|
|
39
|
+
"ora": "^9.0.0",
|
|
40
|
+
"react": "^19.2.3",
|
|
41
|
+
"undici": "^7.18.2",
|
|
42
|
+
"zod": "^4.3.5"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^25.0.8",
|
|
46
|
+
"@types/react": "^19.2.8",
|
|
47
|
+
"tsx": "^4.21.0",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
}
|
|
50
|
+
}
|