@staticpayload/zai-code 1.0.0 → 1.0.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 +205 -66
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,115 +1,254 @@
|
|
|
1
1
|
# Z.ai Code
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```
|
|
4
|
+
███████╗ █████╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
|
|
5
|
+
╚══███╔╝██╔══██╗██║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
|
6
|
+
███╔╝ ███████║██║ ██║ ██║ ██║██║ ██║█████╗
|
|
7
|
+
███╔╝ ██╔══██║██║ ██║ ██║ ██║██║ ██║██╔══╝
|
|
8
|
+
███████╗██║ ██║██║ ╚██████╗╚██████╔╝██████╔╝███████╗
|
|
9
|
+
╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
10
|
+
```
|
|
4
11
|
|
|
5
|
-
**
|
|
12
|
+
**A Z.ai-native AI code editor — CLI-first, interactive editor shell.**
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
> ⚠️ **DISCLAIMER**: This project is **NOT** affiliated with, endorsed by, or sponsored by Z.ai or Anthropic. It is an independent, open-source project that uses the Z.ai API.
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
- **Plan → Diff → Apply workflow** — no auto-execution
|
|
11
|
-
- **Keyboard-driven settings menu** — BIOS-style configuration
|
|
12
|
-
- **Model switching** — select from available Z.ai models
|
|
13
|
-
- **Execution profiles** — safe, balanced, fast presets
|
|
14
|
-
- **Git awareness** — branch, dirty state, warnings
|
|
15
|
-
- **Dry-run mode** — preview without applying
|
|
16
|
-
- **Undo/rollback** — revert last operation
|
|
17
|
-
- **Task history** — audit log of all operations
|
|
18
|
-
- **Safe file operations** — binary blocked, large files warned
|
|
16
|
+
---
|
|
19
17
|
|
|
20
|
-
##
|
|
18
|
+
## ✨ Features
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
```
|
|
21
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
22
|
+
│ ► Interactive editor shell — not a chatbot │
|
|
23
|
+
│ ► Plan → Diff → Apply workflow — no auto-execution │
|
|
24
|
+
│ ► Keyboard-driven settings — BIOS-style config │
|
|
25
|
+
│ ► Model switching — select Z.ai models │
|
|
26
|
+
│ ► Execution profiles — safe / balanced / fast │
|
|
27
|
+
│ ► Git awareness — branch, dirty state, warnings │
|
|
28
|
+
│ ► Dry-run mode — preview without applying │
|
|
29
|
+
│ ► Undo/rollback — revert last operation │
|
|
30
|
+
│ ► Task history — audit log of all operations │
|
|
31
|
+
│ ► Safe file ops — binary blocked, large files warned │
|
|
32
|
+
└─────────────────────────────────────────────────────────────┘
|
|
33
|
+
```
|
|
24
34
|
|
|
25
|
-
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📦 Installation
|
|
26
38
|
|
|
27
39
|
```bash
|
|
28
40
|
npm install -g @staticpayload/zai-code
|
|
29
41
|
```
|
|
30
42
|
|
|
31
|
-
Or run directly:
|
|
43
|
+
Or run directly with npx:
|
|
32
44
|
|
|
33
45
|
```bash
|
|
34
46
|
npx @staticpayload/zai-code
|
|
35
47
|
```
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🚀 Quick Start
|
|
38
52
|
|
|
39
53
|
```bash
|
|
40
54
|
zcode
|
|
41
55
|
```
|
|
42
56
|
|
|
43
|
-
This opens the interactive editor shell
|
|
57
|
+
This opens the interactive editor shell:
|
|
44
58
|
|
|
45
59
|
```
|
|
60
|
+
_____ ___ ___
|
|
61
|
+
|__ // _ |/ /
|
|
62
|
+
/ // __ | __|
|
|
63
|
+
/___\___|___| code
|
|
64
|
+
|
|
65
|
+
Z.ai Code — project: my-project
|
|
66
|
+
Mode: edit | State: clean
|
|
67
|
+
|
|
46
68
|
[edit][clean]>
|
|
47
69
|
```
|
|
48
70
|
|
|
49
|
-
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 📋 Commands
|
|
74
|
+
|
|
75
|
+
### Navigation
|
|
76
|
+
```
|
|
77
|
+
┌────────────┬──────────────────────────────────┐
|
|
78
|
+
│ Command │ Description │
|
|
79
|
+
├────────────┼──────────────────────────────────┤
|
|
80
|
+
│ /help │ Show all commands │
|
|
81
|
+
│ /context │ Show current context │
|
|
82
|
+
│ /files │ List open files │
|
|
83
|
+
│ /open │ Add file to context │
|
|
84
|
+
│ /workspace │ Show workspace info │
|
|
85
|
+
└────────────┴──────────────────────────────────┘
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Execution
|
|
89
|
+
```
|
|
90
|
+
┌────────────┬──────────────────────────────────┐
|
|
91
|
+
│ Command │ Description │
|
|
92
|
+
├────────────┼──────────────────────────────────┤
|
|
93
|
+
│ /plan │ Generate execution plan │
|
|
94
|
+
│ /generate │ Create file changes │
|
|
95
|
+
│ /diff │ Review pending changes │
|
|
96
|
+
│ /apply │ Apply changes │
|
|
97
|
+
│ /undo │ Rollback last operation │
|
|
98
|
+
└────────────┴──────────────────────────────────┘
|
|
99
|
+
```
|
|
50
100
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
101
|
+
### Modes & Profiles
|
|
102
|
+
```
|
|
103
|
+
┌─────────────────┬──────────────────────────────────┐
|
|
104
|
+
│ Command │ Description │
|
|
105
|
+
├─────────────────┼──────────────────────────────────┤
|
|
106
|
+
│ /mode <name> │ Set mode (edit/explain/review) │
|
|
107
|
+
│ /dry-run on|off │ Toggle dry-run mode │
|
|
108
|
+
│ /profile list │ List execution profiles │
|
|
109
|
+
│ /profile set │ Apply a profile │
|
|
110
|
+
└─────────────────┴──────────────────────────────────┘
|
|
111
|
+
```
|
|
56
112
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
113
|
+
### Multi-Step Tasks
|
|
114
|
+
```
|
|
115
|
+
┌────────────┬──────────────────────────────────┐
|
|
116
|
+
│ Command │ Description │
|
|
117
|
+
├────────────┼──────────────────────────────────┤
|
|
118
|
+
│ /decompose │ Break task into steps │
|
|
119
|
+
│ /step │ Plan current step │
|
|
120
|
+
│ /next │ Complete and advance │
|
|
121
|
+
│ /skip │ Skip current step │
|
|
122
|
+
│ /progress │ Show task progress │
|
|
123
|
+
└────────────┴──────────────────────────────────┘
|
|
124
|
+
```
|
|
63
125
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
126
|
+
### System
|
|
127
|
+
```
|
|
128
|
+
┌────────────┬──────────────────────────────────┐
|
|
129
|
+
│ Command │ Description │
|
|
130
|
+
├────────────┼──────────────────────────────────┤
|
|
131
|
+
│ /settings │ Open interactive settings menu │
|
|
132
|
+
│ /git │ Show repository status │
|
|
133
|
+
│ /exec │ Run allowed shell command │
|
|
134
|
+
│ /history │ View task history │
|
|
135
|
+
│ /doctor │ System health check │
|
|
136
|
+
│ /reset │ Reset session │
|
|
137
|
+
│ /exit │ Exit zcode │
|
|
138
|
+
└────────────┴──────────────────────────────────┘
|
|
139
|
+
```
|
|
68
140
|
|
|
69
|
-
|
|
70
|
-
- `/decompose` — break task into steps
|
|
71
|
-
- `/step` — plan current step
|
|
72
|
-
- `/next` — complete step and advance
|
|
141
|
+
---
|
|
73
142
|
|
|
74
|
-
|
|
75
|
-
- `/settings` — open interactive settings menu
|
|
76
|
-
- `/git` — show repository status
|
|
77
|
-
- `/exec <cmd>` — run allowed shell command
|
|
78
|
-
- `/history` — view task history
|
|
79
|
-
- `/doctor` — system health check
|
|
143
|
+
## 🔧 Workflow
|
|
80
144
|
|
|
81
|
-
|
|
145
|
+
```
|
|
146
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
147
|
+
│ │
|
|
148
|
+
│ 1. Enter a task │
|
|
149
|
+
│ └── "add error handling to auth.ts" │
|
|
150
|
+
│ │
|
|
151
|
+
│ 2. System detects intent │
|
|
152
|
+
│ └── Intent: CODE_EDIT │
|
|
153
|
+
│ │
|
|
154
|
+
│ 3. Run /plan │
|
|
155
|
+
│ └── Plan generated. Steps: 3 │
|
|
156
|
+
│ │
|
|
157
|
+
│ 4. Run /generate │
|
|
158
|
+
│ └── Changes generated. Files: 2 │
|
|
159
|
+
│ │
|
|
160
|
+
│ 5. Run /diff │
|
|
161
|
+
│ └── Review changes before applying │
|
|
162
|
+
│ │
|
|
163
|
+
│ 6. Run /apply │
|
|
164
|
+
│ └── Applied. Session clean. │
|
|
165
|
+
│ │
|
|
166
|
+
└──────────────────────────────────────────────────────────────┘
|
|
167
|
+
```
|
|
82
168
|
|
|
83
|
-
|
|
84
|
-
2. System detects intent: `Intent: CODE_EDIT`
|
|
85
|
-
3. Run `/plan` to generate a plan
|
|
86
|
-
4. Run `/generate` to create changes
|
|
87
|
-
5. Run `/diff` to review
|
|
88
|
-
6. Run `/apply` to execute
|
|
169
|
+
**No changes are made without explicit `/apply`.**
|
|
89
170
|
|
|
90
|
-
|
|
171
|
+
---
|
|
91
172
|
|
|
92
|
-
## Settings
|
|
173
|
+
## ⚙️ Settings Menu
|
|
93
174
|
|
|
94
175
|
Run `/settings` to open the interactive menu:
|
|
95
176
|
|
|
96
|
-
|
|
177
|
+
```
|
|
178
|
+
┌────────────────────────────────────────────────┐
|
|
179
|
+
│ Settings │
|
|
180
|
+
├────────────────────────────────────────────────┤
|
|
181
|
+
│ [Model] UI Execution Context Debug Exit │
|
|
182
|
+
├────────────────────────────────────────────────┤
|
|
183
|
+
│ Select AI model for execution │
|
|
184
|
+
│ > Model: [claude-sonnet-4] claude-3-5-sonnet │
|
|
185
|
+
│ │
|
|
186
|
+
│ │
|
|
187
|
+
├────────────────────────────────────────────────┤
|
|
188
|
+
│ │
|
|
189
|
+
├────────────────────────────────────────────────┤
|
|
190
|
+
│ ↑↓ navigate ←→ change Tab section Esc exit │
|
|
191
|
+
└────────────────────────────────────────────────┘
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Sections:
|
|
195
|
+
- **Model** — Select AI model
|
|
97
196
|
- **UI** — ASCII logo, colors, prompt style
|
|
98
|
-
- **Execution** —
|
|
99
|
-
- **Context** —
|
|
100
|
-
- **Debug** —
|
|
197
|
+
- **Execution** — Confirmation mode, iteration limits
|
|
198
|
+
- **Context** — File scope, token limits
|
|
199
|
+
- **Debug** — Logging options
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 📁 Configuration
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
~/.zai/
|
|
207
|
+
├── settings.json # Global settings
|
|
208
|
+
├── config.json # API configuration
|
|
209
|
+
├── state.json # Session state
|
|
210
|
+
└── history.log # Task history
|
|
211
|
+
|
|
212
|
+
.zai/
|
|
213
|
+
└── settings.json # Project-specific overrides
|
|
214
|
+
```
|
|
101
215
|
|
|
102
|
-
|
|
216
|
+
---
|
|
103
217
|
|
|
104
|
-
##
|
|
218
|
+
## 🔒 Safety Features
|
|
105
219
|
|
|
106
|
-
|
|
107
|
-
|
|
220
|
+
```
|
|
221
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
222
|
+
│ ✓ No auto-execution — explicit /apply required │
|
|
223
|
+
│ ✓ Dry-run mode — preview changes without applying │
|
|
224
|
+
│ ✓ Undo/rollback — revert last operation │
|
|
225
|
+
│ ✓ Git warnings — alerts on dirty working tree │
|
|
226
|
+
│ ✓ Binary blocked — prevents binary file modifications │
|
|
227
|
+
│ ✓ Large file warnings — alerts on files >50KB │
|
|
228
|
+
│ ✓ Shell allowlist — only safe commands permitted │
|
|
229
|
+
│ ✓ Bounded loops — max iterations enforced │
|
|
230
|
+
└─────────────────────────────────────────────────────────────┘
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
108
234
|
|
|
109
|
-
##
|
|
235
|
+
## 📜 Requirements
|
|
236
|
+
|
|
237
|
+
- Node.js 18 or higher
|
|
238
|
+
- Z.ai API key
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 📄 License
|
|
110
243
|
|
|
111
244
|
GPL-3.0
|
|
112
245
|
|
|
113
|
-
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 👤 Author
|
|
249
|
+
|
|
250
|
+
**StaticPayload** — [GitHub](https://github.com/staticpayload)
|
|
251
|
+
|
|
252
|
+
---
|
|
114
253
|
|
|
115
|
-
|
|
254
|
+
> ⚠️ **DISCLAIMER**: This project is an independent, open-source tool. It is **NOT** affiliated with, endorsed by, or sponsored by Z.ai, Anthropic, or any related entities. Use of this tool requires your own Z.ai API key and is subject to Z.ai's terms of service.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@staticpayload/zai-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Z.ai-native AI code editor - CLI-first, interactive editor shell with keyboard-driven settings, plan-diff-apply workflow, and safety-first design",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"keytar": "^7.9.0"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|