@ebowwa/coder 0.2.0 → 0.2.1
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/README.md +56 -24
- package/native/index.d.ts +0 -150
- package/native/index.darwin-arm64.node +0 -0
- package/native/package.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
# @ebowwa/
|
|
1
|
+
# @ebowwa/coder
|
|
2
2
|
|
|
3
3
|
A reimplementation of Claude Code CLI using TypeScript + Bun + Rust.
|
|
4
4
|
|
|
5
5
|
Based on binary analysis of Claude Code v2.1.50 (~92% feature parity).
|
|
6
6
|
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **API Client**: SSE streaming for Anthropic API with cost calculation
|
|
10
|
-
- **Agent Loop**: Turn-based processing with tool execution
|
|
11
|
-
- **Built-in Tools**: Read, Write, Edit, Bash, Glob, Grep
|
|
12
|
-
- **MCP Client**: Model Context Protocol support (stdio, HTTP, SSE, WebSocket)
|
|
13
|
-
- **Hook System**: 10 lifecycle events for customization
|
|
14
|
-
- **Skill System**: YAML frontmatter skills with `/skillname` invocation
|
|
15
|
-
- **Teammate System**: Multi-agent coordination with tmux backend
|
|
16
|
-
- **Native Module**: Rust-based performance for search, tokens, diff, compact
|
|
17
|
-
|
|
18
7
|
## Installation
|
|
19
8
|
|
|
20
9
|
```bash
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
# Install globally
|
|
11
|
+
npm install -g @ebowwa/coder
|
|
12
|
+
|
|
13
|
+
# Or with bun
|
|
14
|
+
bun add -g @ebowwa/coder
|
|
23
15
|
```
|
|
24
16
|
|
|
25
17
|
## Usage
|
|
@@ -28,22 +20,22 @@ bun run build
|
|
|
28
20
|
|
|
29
21
|
```bash
|
|
30
22
|
# Interactive mode
|
|
31
|
-
|
|
23
|
+
coder
|
|
32
24
|
|
|
33
25
|
# Single query
|
|
34
|
-
|
|
26
|
+
coder "What files are in this directory?"
|
|
35
27
|
|
|
36
28
|
# With specific model
|
|
37
|
-
|
|
29
|
+
coder -m claude-opus-4-6 "Explain this codebase"
|
|
38
30
|
|
|
39
31
|
# With permission mode
|
|
40
|
-
|
|
32
|
+
coder --permission-mode acceptEdits "Add a test"
|
|
41
33
|
```
|
|
42
34
|
|
|
43
35
|
### Programmatic
|
|
44
36
|
|
|
45
37
|
```typescript
|
|
46
|
-
import { createMessageStream, agentLoop, tools } from "@ebowwa/
|
|
38
|
+
import { createMessageStream, agentLoop, tools } from "@ebowwa/coder";
|
|
47
39
|
|
|
48
40
|
// Stream API messages
|
|
49
41
|
const result = await createMessageStream(messages, {
|
|
@@ -62,13 +54,37 @@ const agentResult = await agentLoop(messages, {
|
|
|
62
54
|
});
|
|
63
55
|
```
|
|
64
56
|
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- **API Client**: SSE streaming for Anthropic API with cost calculation
|
|
60
|
+
- **Agent Loop**: Turn-based processing with tool execution
|
|
61
|
+
- **Built-in Tools**: Read, Write, Edit, Bash, Glob, Grep
|
|
62
|
+
- **MCP Client**: Model Context Protocol support (stdio, HTTP, SSE, WebSocket)
|
|
63
|
+
- **Hook System**: 10 lifecycle events for customization
|
|
64
|
+
- **Skill System**: YAML frontmatter skills with `/skillname` invocation
|
|
65
|
+
- **Teammate System**: Multi-agent coordination with tmux backend
|
|
66
|
+
- **Native Module**: Rust-based performance for critical operations
|
|
67
|
+
|
|
68
|
+
## Native Modules (Rust)
|
|
69
|
+
|
|
70
|
+
The `@ebowwa/coder-native` package provides high-performance operations:
|
|
71
|
+
|
|
72
|
+
| Module | Description |
|
|
73
|
+
|--------|-------------|
|
|
74
|
+
| **grep** | Ripgrep-based file search with regex support |
|
|
75
|
+
| **hash** | xxHash3/SHA-256 content hashing |
|
|
76
|
+
| **highlight** | Syntax highlighting with syntect |
|
|
77
|
+
| **structure** | Tree-sitter code structure parsing |
|
|
78
|
+
| **patterns** | Tool usage pattern analysis |
|
|
79
|
+
| **multi_edit** | Batch file editing with validation |
|
|
80
|
+
|
|
65
81
|
## Project Structure
|
|
66
82
|
|
|
67
83
|
```
|
|
68
84
|
claude-code-remake/
|
|
69
85
|
├── src/
|
|
70
86
|
│ ├── types/ # TypeScript type definitions
|
|
71
|
-
│ ├── core/ # API client, agent loop
|
|
87
|
+
│ ├── core/ # API client, agent loop, checkpoints
|
|
72
88
|
│ ├── tools/ # Built-in tools (Read, Write, Edit, Bash, etc.)
|
|
73
89
|
│ ├── mcp/ # MCP client implementation
|
|
74
90
|
│ ├── hooks/ # Hook system for lifecycle events
|
|
@@ -78,10 +94,13 @@ claude-code-remake/
|
|
|
78
94
|
│ └── cli.ts # CLI entry point
|
|
79
95
|
├── rust/
|
|
80
96
|
│ └── src/
|
|
81
|
-
│ ├──
|
|
82
|
-
│ ├──
|
|
83
|
-
│ ├──
|
|
84
|
-
│
|
|
97
|
+
│ ├── grep.rs # Ripgrep-based file search
|
|
98
|
+
│ ├── hash.rs # Content hashing (xxHash3, SHA-256)
|
|
99
|
+
│ ├── highlight.rs # Syntax highlighting
|
|
100
|
+
│ ├── structure.rs # Tree-sitter parsing
|
|
101
|
+
│ ├── patterns.rs # Tool pattern analysis
|
|
102
|
+
│ ├── multi_edit.rs # Batch file operations
|
|
103
|
+
│ └── diff.rs # Diff calculation
|
|
85
104
|
├── native/ # Compiled native modules
|
|
86
105
|
└── dist/ # Build output
|
|
87
106
|
```
|
|
@@ -105,6 +124,9 @@ claude-code-remake/
|
|
|
105
124
|
## Development
|
|
106
125
|
|
|
107
126
|
```bash
|
|
127
|
+
# Install dependencies
|
|
128
|
+
bun install
|
|
129
|
+
|
|
108
130
|
# Build TypeScript
|
|
109
131
|
bun run build:ts
|
|
110
132
|
|
|
@@ -116,8 +138,18 @@ bun run build
|
|
|
116
138
|
|
|
117
139
|
# Development mode with watch
|
|
118
140
|
bun run dev
|
|
141
|
+
|
|
142
|
+
# Run tests
|
|
143
|
+
bun test
|
|
119
144
|
```
|
|
120
145
|
|
|
146
|
+
## Packages
|
|
147
|
+
|
|
148
|
+
| Package | Version | Description |
|
|
149
|
+
|---------|---------|-------------|
|
|
150
|
+
| [@ebowwa/coder](https://www.npmjs.com/package/@ebowwa/coder) | 0.2.0 | Main CLI package |
|
|
151
|
+
| [@ebowwa/coder-native](https://www.npmjs.com/package/@ebowwa/coder-native) | 0.2.0 | Native Rust modules |
|
|
152
|
+
|
|
121
153
|
## License
|
|
122
154
|
|
|
123
155
|
MIT
|
package/native/index.d.ts
CHANGED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
/* auto-generated by NAPI-RS */
|
|
5
|
-
|
|
6
|
-
export interface GrepMatch {
|
|
7
|
-
path: string
|
|
8
|
-
line: number
|
|
9
|
-
column: number
|
|
10
|
-
content: string
|
|
11
|
-
contextBefore: Array<string>
|
|
12
|
-
contextAfter: Array<string>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface GrepOptions {
|
|
16
|
-
caseSensitive?: boolean
|
|
17
|
-
caseInsensitive?: boolean
|
|
18
|
-
contextLines?: number
|
|
19
|
-
maxResults?: number
|
|
20
|
-
includePatterns: Array<string>
|
|
21
|
-
excludePatterns: Array<string>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface GrepResult {
|
|
25
|
-
matches: Array<GrepMatch>
|
|
26
|
-
totalCount: number
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface HashResult {
|
|
30
|
-
hash: string
|
|
31
|
-
algorithm: string
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface HighlightResult {
|
|
35
|
-
html: string
|
|
36
|
-
theme: string
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface HighlightDiffResult {
|
|
40
|
-
/** ANSI-colored diff output */
|
|
41
|
-
output: string
|
|
42
|
-
/** Number of added lines */
|
|
43
|
-
additions: number
|
|
44
|
-
/** Number of deleted lines */
|
|
45
|
-
deletions: number
|
|
46
|
-
/** Number of hunks */
|
|
47
|
-
hunks: number
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface DiffOptions {
|
|
51
|
-
/** File path to display in header */
|
|
52
|
-
filePath?: string
|
|
53
|
-
/** Number of context lines around changes */
|
|
54
|
-
contextLines?: number
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface StructureItem {
|
|
58
|
-
kind: string
|
|
59
|
-
name: string
|
|
60
|
-
line: number
|
|
61
|
-
column: number
|
|
62
|
-
endLine?: number
|
|
63
|
-
endColumn?: number
|
|
64
|
-
children: Array<StructureItem>
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface StructureOptions {
|
|
68
|
-
includeComments?: boolean
|
|
69
|
-
maxDepth?: number
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface StructureResult {
|
|
73
|
-
items: Array<StructureItem>
|
|
74
|
-
language: string
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ToolPair {
|
|
78
|
-
tool1: string
|
|
79
|
-
tool2: string
|
|
80
|
-
target1: string
|
|
81
|
-
target2: string
|
|
82
|
-
similarity: number
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface ToolPairsResult {
|
|
86
|
-
pairs: Array<ToolPair>
|
|
87
|
-
totalCalls: number
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface DiffHunk {
|
|
91
|
-
oldStart: number
|
|
92
|
-
oldLines: number
|
|
93
|
-
newStart: number
|
|
94
|
-
newLines: number
|
|
95
|
-
content: string
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export interface PatternResult {
|
|
99
|
-
tools: Array<string>
|
|
100
|
-
support: number
|
|
101
|
-
confidence: number
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface ToolCountEntry {
|
|
105
|
-
toolName: string
|
|
106
|
-
count: number
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export interface ContextStatsResult {
|
|
110
|
-
totalTokens: number
|
|
111
|
-
userTokens: number
|
|
112
|
-
assistantTokens: number
|
|
113
|
-
toolResultTokens: number
|
|
114
|
-
messageCount: number
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface MultiEditEntry {
|
|
118
|
-
filePath: string
|
|
119
|
-
oldText: string
|
|
120
|
-
newText: string
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface MultiEditPreviewEntry {
|
|
124
|
-
filePath: string
|
|
125
|
-
diff: string
|
|
126
|
-
additions: number
|
|
127
|
-
deletions: number
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface MultiEditResult {
|
|
131
|
-
success: boolean
|
|
132
|
-
errors: Array<string>
|
|
133
|
-
modifiedFiles: Array<string>
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export function analyzePatterns(messages: Array<string>, minSupport?: number): Array<PatternResult>
|
|
137
|
-
export function countToolUsesNative(messages: Array<string>): Array<ToolCountEntry>
|
|
138
|
-
export function calculateContextStats(messages: Array<string>): ContextStatsResult
|
|
139
|
-
export function grepSearch(pattern: string, path: string, options?: GrepOptions): Promise<GrepResult>
|
|
140
|
-
export function calculateHash(content: string, algorithm?: string): HashResult
|
|
141
|
-
export function countTokens(text: string): number
|
|
142
|
-
export function highlightCode(code: string, language: string): HighlightResult
|
|
143
|
-
export function highlightMarkdown(markdown: string): HighlightResult
|
|
144
|
-
export function analyzeStructure(filePath: string, content: string): StructureResult
|
|
145
|
-
export function findToolPairs(logs: Array<string>, threshold?: number): ToolPairsResult
|
|
146
|
-
export function highlightDiff(oldText: string, newText: string, options?: DiffOptions): HighlightDiffResult
|
|
147
|
-
export function calculateDiff(oldText: string, newText: string): Array<DiffHunk>
|
|
148
|
-
export function validateMultiEdits(edits: Array<MultiEditEntry>): Array<string>
|
|
149
|
-
export function previewMultiEdits(edits: Array<MultiEditEntry>): Array<MultiEditPreviewEntry>
|
|
150
|
-
export function applyMultiEdits(edits: Array<MultiEditEntry>): MultiEditResult
|
|
Binary file
|
package/native/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ebowwa/coder",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Claude Code CLI reimplementation in TypeScript + Rust",
|
|
5
5
|
"author": "ebowwa",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@anthropic-ai/sdk": "^0.39.0",
|
|
38
|
-
"@ebowwa/coder-native": "^0.2.
|
|
38
|
+
"@ebowwa/coder-native": "^0.2.1",
|
|
39
39
|
"@ebowwa/quant-rust": "^0.2.2",
|
|
40
40
|
"@modelcontextprotocol/sdk": "^1.10.0",
|
|
41
41
|
"chalk": "^5.4.1",
|