clawdcode 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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/main.js +61910 -0
  4. package/package.json +66 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # ClawdCode
2
+
3
+ A CLI Coding Agent inspired by Claude Code - An AI-powered coding assistant that can read, write, and execute code directly in your terminal.
4
+
5
+ ## Features
6
+
7
+ - **Interactive CLI** - Natural language interface for coding tasks
8
+ - **File Operations** - Read, write, and edit files automatically
9
+ - **Code Search** - Find files and search code with Glob and Grep
10
+ - **Command Execution** - Run shell commands safely
11
+ - **Context Aware** - Understands your project structure
12
+ - **Permission Control** - Safe execution with user confirmation for write operations
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install -g clawdcode
18
+ ```
19
+
20
+ Or using other package managers:
21
+
22
+ ```bash
23
+ # yarn
24
+ yarn global add clawdcode
25
+
26
+ # pnpm
27
+ pnpm add -g clawdcode
28
+
29
+ # bun
30
+ bun add -g clawdcode
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ### 1. Configure API Key
36
+
37
+ Create a config file:
38
+
39
+ ```bash
40
+ clawdcode --init
41
+ ```
42
+
43
+ Or set environment variable:
44
+
45
+ ```bash
46
+ export OPENAI_API_KEY=sk-your-api-key
47
+ ```
48
+
49
+ ### 2. Start Using
50
+
51
+ ```bash
52
+ # Start interactive mode
53
+ clawdcode
54
+
55
+ # Start with an initial message
56
+ clawdcode "帮我分析这个项目"
57
+
58
+ # Use a specific model
59
+ clawdcode --model gpt-4
60
+ ```
61
+
62
+ ## Configuration
63
+
64
+ ClawdCode supports multiple configuration methods (in priority order):
65
+
66
+ 1. **CLI arguments** - `--api-key`, `--base-url`, `--model`
67
+ 2. **Environment variables** - `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_MODEL`
68
+ 3. **Project config** - `./.clawdcode/config.json`
69
+ 4. **User config** - `~/.clawdcode/config.json`
70
+
71
+ ### Config File Example
72
+
73
+ ```json
74
+ {
75
+ "defaultModel": {
76
+ "provider": "openai",
77
+ "apiKey": "sk-your-api-key",
78
+ "baseURL": "https://api.openai.com/v1",
79
+ "model": "gpt-4"
80
+ }
81
+ }
82
+ ```
83
+
84
+ ## Usage
85
+
86
+ ### CLI Options
87
+
88
+ ```
89
+ Options:
90
+ --api-key OpenAI API key
91
+ --base-url OpenAI API base URL
92
+ --model Model to use (default: gpt-4)
93
+ --debug, -d Enable debug mode
94
+ --init Create default config file
95
+ --help, -h Show help
96
+ --version, -v Show version
97
+ ```
98
+
99
+ ### Examples
100
+
101
+ ```bash
102
+ # Analyze project structure
103
+ clawdcode "分析这个项目的结构"
104
+
105
+ # Fix TypeScript errors
106
+ clawdcode "帮我修复 TypeScript 类型错误"
107
+
108
+ # Create a new feature
109
+ clawdcode "添加一个用户登录功能"
110
+
111
+ # Debug mode
112
+ clawdcode --debug "为什么这个测试失败了"
113
+ ```
114
+
115
+ ## Architecture
116
+
117
+ ```
118
+ Coding Agent = LLM + System Prompt + Context + Tools
119
+ ```
120
+
121
+ ClawdCode follows the Agentic Loop pattern:
122
+
123
+ ```
124
+ User Input → Build Messages → Call LLM → Tool Calls?
125
+ ↓ Yes
126
+ Execute Tools → Inject Results → Continue Loop
127
+ ↓ No
128
+ Return Response (Task Complete)
129
+ ```
130
+
131
+ ## Requirements
132
+
133
+ - Node.js >= 18.0.0
134
+ - OpenAI API key (or compatible API)
135
+
136
+ ## License
137
+
138
+ MIT