@caoyacheng/tclaw 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/README.md +197 -0
- package/dist/cli.js +17 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# T-Claw
|
|
2
|
+
|
|
3
|
+
T-Claw 是一个基于 [pi-mono](https://github.com/badlogic/pi-mono) 项目构建的智能编码助手 CLI 工具。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 🤖 集成多个 AI 模型提供商(Anthropic、OpenAI、Google 等)
|
|
8
|
+
- 💻 内置代码编辑工具(read、bash、edit、write)
|
|
9
|
+
- 📁 会话管理和恢复
|
|
10
|
+
- 🎨 可定制的主题和扩展
|
|
11
|
+
- 🔧 插件系统支持
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
### 使用 npm 全局安装
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g tclaw
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 使用 pnpm
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -g tclaw
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 使用 yarn
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn global add tclaw
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 快速开始
|
|
34
|
+
|
|
35
|
+
### 基本用法
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# 交互模式
|
|
39
|
+
tclaw
|
|
40
|
+
|
|
41
|
+
# 指定初始消息
|
|
42
|
+
tclaw "帮我写一个 Hello World 程序"
|
|
43
|
+
|
|
44
|
+
# 非交互模式(处理后退出)
|
|
45
|
+
tclaw -p "列出 src 目录下所有 .ts 文件"
|
|
46
|
+
|
|
47
|
+
# 继续上一个会话
|
|
48
|
+
tclaw --continue
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 命令行选项
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# 显示帮助
|
|
55
|
+
tclaw --help
|
|
56
|
+
|
|
57
|
+
# 显示版本
|
|
58
|
+
tclaw --version
|
|
59
|
+
|
|
60
|
+
# 列出可用模型
|
|
61
|
+
tclaw --list-models
|
|
62
|
+
|
|
63
|
+
# 指定模型
|
|
64
|
+
tclaw --provider anthropic --model claude-sonnet-4-20250514 --message "解释这段代码"
|
|
65
|
+
|
|
66
|
+
# 使用不同的思考级别
|
|
67
|
+
tclaw --thinking high "解决这个复杂问题"
|
|
68
|
+
|
|
69
|
+
# 模型循环切换(Ctrl+P)
|
|
70
|
+
tclaw --models claude-sonnet,claude-haiku,gpt-4o
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 环境变量配置
|
|
74
|
+
|
|
75
|
+
在使用 T-Claw 之前,你需要设置相应的 API 密钥:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Anthropic (Claude)
|
|
79
|
+
export ANTHROPIC_API_KEY="your-anthropic-api-key"
|
|
80
|
+
|
|
81
|
+
# OpenAI (GPT)
|
|
82
|
+
export OPENAI_API_KEY="your-openai-api-key"
|
|
83
|
+
|
|
84
|
+
# Google (Gemini)
|
|
85
|
+
export GEMINI_API_KEY="your-google-api-key"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 配置
|
|
89
|
+
|
|
90
|
+
T-Claw 的配置文件位于 `~/.tclaw/agent/` 目录下:
|
|
91
|
+
|
|
92
|
+
| 文件 | 描述 |
|
|
93
|
+
|------|------|
|
|
94
|
+
| `models.json` | 模型配置 |
|
|
95
|
+
| `auth.json` | 认证信息 |
|
|
96
|
+
| `settings.json` | 用户设置 |
|
|
97
|
+
| `sessions/` | 对话会话存储 |
|
|
98
|
+
|
|
99
|
+
### 自定义配置目录
|
|
100
|
+
|
|
101
|
+
可以通过环境变量指定配置目录:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export TCLAW_CODING_AGENT_DIR="/path/to/config"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 可用工具
|
|
108
|
+
|
|
109
|
+
默认启用的工具:
|
|
110
|
+
|
|
111
|
+
| 工具 | 描述 |
|
|
112
|
+
|------|------|
|
|
113
|
+
| `read` | 读取文件内容 |
|
|
114
|
+
| `bash` | 执行 bash 命令 |
|
|
115
|
+
| `edit` | 编辑文件(查找/替换) |
|
|
116
|
+
| `write` | 写入文件(创建/覆盖) |
|
|
117
|
+
|
|
118
|
+
可选工具(需要显式启用):
|
|
119
|
+
|
|
120
|
+
| 工具 | 描述 |
|
|
121
|
+
|------|------|
|
|
122
|
+
| `grep` | 搜索文件内容(只读) |
|
|
123
|
+
| `find` | 按 glob 模式查找文件(只读) |
|
|
124
|
+
| `ls` | 列出目录内容(只读) |
|
|
125
|
+
|
|
126
|
+
使用示例:
|
|
127
|
+
```bash
|
|
128
|
+
# 只读模式(不允许文件修改)
|
|
129
|
+
tclaw --tools read,grep,find,ls -p "审查 src 目录中的代码"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 扩展
|
|
133
|
+
|
|
134
|
+
T-Claw 支持通过安装扩展来添加额外的功能:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# 安装扩展
|
|
138
|
+
tclaw install npm:@foo/bar
|
|
139
|
+
tclaw install git:github.com/user/repo
|
|
140
|
+
|
|
141
|
+
# 列出已安装的扩展
|
|
142
|
+
tclaw list
|
|
143
|
+
|
|
144
|
+
# 移除扩展
|
|
145
|
+
tclaw remove npm:@foo/bar
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 开发
|
|
149
|
+
|
|
150
|
+
### 本地开发
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 克隆项目
|
|
154
|
+
git clone https://github.com/your-username/tclaw.git
|
|
155
|
+
cd tclaw
|
|
156
|
+
|
|
157
|
+
# 安装依赖
|
|
158
|
+
npm install
|
|
159
|
+
|
|
160
|
+
# 开发模式运行
|
|
161
|
+
npm run dev
|
|
162
|
+
|
|
163
|
+
# 构建生产版本
|
|
164
|
+
npm run build
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 构建发布版本
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm run clean
|
|
171
|
+
npm run build
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## 发布到 npm
|
|
175
|
+
|
|
176
|
+
1. 更新 `package.json` 中的版本号
|
|
177
|
+
2. 确保 `repository.url` 指向你的仓库
|
|
178
|
+
3. 登录 npm:
|
|
179
|
+
```bash
|
|
180
|
+
npm login
|
|
181
|
+
```
|
|
182
|
+
4. 发布包:
|
|
183
|
+
```bash
|
|
184
|
+
npm publish --access public
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 基于的项目
|
|
188
|
+
|
|
189
|
+
T-Claw 基于 [pi-mono](https://github.com/badlogic/pi-mono) 项目构建,使用了以下核心包:
|
|
190
|
+
|
|
191
|
+
- [@mariozechner/pi-ai](https://www.npmjs.com/package/@mariozechner/pi-ai) - 统一的 LLM API
|
|
192
|
+
- [@mariozechner/pi-agent-core](https://www.npmjs.com/package/@mariozechner/pi-agent-core) - Agent 运行时
|
|
193
|
+
- [@mariozechner/pi-tui](https://www.npmjs.com/package/@mariozechner/pi-tui) - 终端 UI 库
|
|
194
|
+
|
|
195
|
+
## 许可证
|
|
196
|
+
|
|
197
|
+
MIT
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* T-Claw:包装 @mariozechner/pi-coding-agent。
|
|
4
|
+
* 在加载前设置 PI_PACKAGE_DIR,使 APP_NAME / 配置目录来自本包 package.json 的 piConfig
|
|
5
|
+
*(见 pi-mono packages/coding-agent/src/config.ts)。
|
|
6
|
+
*/
|
|
7
|
+
process.title = "tclaw";
|
|
8
|
+
process.emitWarning = (() => { });
|
|
9
|
+
import { dirname } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { EnvHttpProxyAgent, setGlobalDispatcher } from "undici";
|
|
12
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
13
|
+
process.env.PI_PACKAGE_DIR = packageRoot;
|
|
14
|
+
setGlobalDispatcher(new EnvHttpProxyAgent());
|
|
15
|
+
const { main } = await import("@mariozechner/pi-coding-agent");
|
|
16
|
+
main(process.argv.slice(2));
|
|
17
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AACH,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;AACxB,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,GAAE,CAAC,CAA+B,CAAC;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAEhE,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrE,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,WAAW,CAAC;AAEzC,mBAAmB,CAAC,IAAI,iBAAiB,EAAE,CAAC,CAAC;AAE7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAC/D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Session Export</title>
|
|
7
|
+
<style>
|
|
8
|
+
{{CSS}}
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<button id="hamburger" title="Open sidebar"><svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="6" cy="6" r="2.5"/><circle cx="6" cy="18" r="2.5"/><circle cx="18" cy="12" r="2.5"/><rect x="5" y="6" width="2" height="12"/><path d="M6 12h10c1 0 2 0 2-2V8"/></svg></button>
|
|
13
|
+
<div id="sidebar-overlay"></div>
|
|
14
|
+
<div id="app">
|
|
15
|
+
<aside id="sidebar">
|
|
16
|
+
<div class="sidebar-header">
|
|
17
|
+
<div class="sidebar-controls">
|
|
18
|
+
<input type="text" class="sidebar-search" id="tree-search" placeholder="Search...">
|
|
19
|
+
</div>
|
|
20
|
+
<div class="sidebar-filters">
|
|
21
|
+
<button class="filter-btn active" data-filter="default" title="Hide settings entries">Default</button>
|
|
22
|
+
<button class="filter-btn" data-filter="no-tools" title="Default minus tool results">No-tools</button>
|
|
23
|
+
<button class="filter-btn" data-filter="user-only" title="Only user messages">User</button>
|
|
24
|
+
<button class="filter-btn" data-filter="labeled-only" title="Only labeled entries">Labeled</button>
|
|
25
|
+
<button class="filter-btn" data-filter="all" title="Show everything">All</button>
|
|
26
|
+
<button class="sidebar-close" id="sidebar-close" title="Close">✕</button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="tree-container" id="tree-container"></div>
|
|
30
|
+
<div class="tree-status" id="tree-status"></div>
|
|
31
|
+
</aside>
|
|
32
|
+
<div id="sidebar-resizer" role="separator" aria-orientation="vertical" aria-label="Resize session tree sidebar"></div>
|
|
33
|
+
<main id="content">
|
|
34
|
+
<div id="header-container"></div>
|
|
35
|
+
<div id="messages"></div>
|
|
36
|
+
</main>
|
|
37
|
+
<div id="image-modal" class="image-modal">
|
|
38
|
+
<img id="modal-image" src="" alt="">
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<script id="session-data" type="application/json">{{SESSION_DATA}}</script>
|
|
43
|
+
|
|
44
|
+
<!-- Vendored libraries -->
|
|
45
|
+
<script>{{MARKED_JS}}</script>
|
|
46
|
+
|
|
47
|
+
<!-- highlight.js -->
|
|
48
|
+
<script>{{HIGHLIGHT_JS}}</script>
|
|
49
|
+
|
|
50
|
+
<!-- Main application code -->
|
|
51
|
+
<script>
|
|
52
|
+
{{JS}}
|
|
53
|
+
</script>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "dark",
|
|
4
|
+
"vars": {
|
|
5
|
+
"cyan": "#00d7ff",
|
|
6
|
+
"blue": "#5f87ff",
|
|
7
|
+
"green": "#b5bd68",
|
|
8
|
+
"red": "#cc6666",
|
|
9
|
+
"yellow": "#ffff00",
|
|
10
|
+
"gray": "#808080",
|
|
11
|
+
"dimGray": "#666666",
|
|
12
|
+
"darkGray": "#505050",
|
|
13
|
+
"accent": "#8abeb7",
|
|
14
|
+
"selectedBg": "#3a3a4a",
|
|
15
|
+
"userMsgBg": "#343541",
|
|
16
|
+
"toolPendingBg": "#282832",
|
|
17
|
+
"toolSuccessBg": "#283228",
|
|
18
|
+
"toolErrorBg": "#3c2828",
|
|
19
|
+
"customMsgBg": "#2d2838"
|
|
20
|
+
},
|
|
21
|
+
"colors": {
|
|
22
|
+
"accent": "accent",
|
|
23
|
+
"border": "blue",
|
|
24
|
+
"borderAccent": "cyan",
|
|
25
|
+
"borderMuted": "darkGray",
|
|
26
|
+
"success": "green",
|
|
27
|
+
"error": "red",
|
|
28
|
+
"warning": "yellow",
|
|
29
|
+
"muted": "gray",
|
|
30
|
+
"dim": "dimGray",
|
|
31
|
+
"text": "",
|
|
32
|
+
"thinkingText": "gray",
|
|
33
|
+
|
|
34
|
+
"selectedBg": "selectedBg",
|
|
35
|
+
"userMessageBg": "userMsgBg",
|
|
36
|
+
"userMessageText": "",
|
|
37
|
+
"customMessageBg": "customMsgBg",
|
|
38
|
+
"customMessageText": "",
|
|
39
|
+
"customMessageLabel": "#9575cd",
|
|
40
|
+
"toolPendingBg": "toolPendingBg",
|
|
41
|
+
"toolSuccessBg": "toolSuccessBg",
|
|
42
|
+
"toolErrorBg": "toolErrorBg",
|
|
43
|
+
"toolTitle": "",
|
|
44
|
+
"toolOutput": "gray",
|
|
45
|
+
|
|
46
|
+
"mdHeading": "#f0c674",
|
|
47
|
+
"mdLink": "#81a2be",
|
|
48
|
+
"mdLinkUrl": "dimGray",
|
|
49
|
+
"mdCode": "accent",
|
|
50
|
+
"mdCodeBlock": "green",
|
|
51
|
+
"mdCodeBlockBorder": "gray",
|
|
52
|
+
"mdQuote": "gray",
|
|
53
|
+
"mdQuoteBorder": "gray",
|
|
54
|
+
"mdHr": "gray",
|
|
55
|
+
"mdListBullet": "accent",
|
|
56
|
+
|
|
57
|
+
"toolDiffAdded": "green",
|
|
58
|
+
"toolDiffRemoved": "red",
|
|
59
|
+
"toolDiffContext": "gray",
|
|
60
|
+
|
|
61
|
+
"syntaxComment": "#6A9955",
|
|
62
|
+
"syntaxKeyword": "#569CD6",
|
|
63
|
+
"syntaxFunction": "#DCDCAA",
|
|
64
|
+
"syntaxVariable": "#9CDCFE",
|
|
65
|
+
"syntaxString": "#CE9178",
|
|
66
|
+
"syntaxNumber": "#B5CEA8",
|
|
67
|
+
"syntaxType": "#4EC9B0",
|
|
68
|
+
"syntaxOperator": "#D4D4D4",
|
|
69
|
+
"syntaxPunctuation": "#D4D4D4",
|
|
70
|
+
|
|
71
|
+
"thinkingOff": "darkGray",
|
|
72
|
+
"thinkingMinimal": "#6e6e6e",
|
|
73
|
+
"thinkingLow": "#5f87af",
|
|
74
|
+
"thinkingMedium": "#81a2be",
|
|
75
|
+
"thinkingHigh": "#b294bb",
|
|
76
|
+
"thinkingXhigh": "#d183e8",
|
|
77
|
+
|
|
78
|
+
"bashMode": "green"
|
|
79
|
+
},
|
|
80
|
+
"export": {
|
|
81
|
+
"pageBg": "#18181e",
|
|
82
|
+
"cardBg": "#1e1e24",
|
|
83
|
+
"infoBg": "#3c3728"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/badlogic/pi-mono/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "light",
|
|
4
|
+
"vars": {
|
|
5
|
+
"teal": "#5a8080",
|
|
6
|
+
"blue": "#547da7",
|
|
7
|
+
"green": "#588458",
|
|
8
|
+
"red": "#aa5555",
|
|
9
|
+
"yellow": "#9a7326",
|
|
10
|
+
"mediumGray": "#6c6c6c",
|
|
11
|
+
"dimGray": "#767676",
|
|
12
|
+
"lightGray": "#b0b0b0",
|
|
13
|
+
"selectedBg": "#d0d0e0",
|
|
14
|
+
"userMsgBg": "#e8e8e8",
|
|
15
|
+
"toolPendingBg": "#e8e8f0",
|
|
16
|
+
"toolSuccessBg": "#e8f0e8",
|
|
17
|
+
"toolErrorBg": "#f0e8e8",
|
|
18
|
+
"customMsgBg": "#ede7f6"
|
|
19
|
+
},
|
|
20
|
+
"colors": {
|
|
21
|
+
"accent": "teal",
|
|
22
|
+
"border": "blue",
|
|
23
|
+
"borderAccent": "teal",
|
|
24
|
+
"borderMuted": "lightGray",
|
|
25
|
+
"success": "green",
|
|
26
|
+
"error": "red",
|
|
27
|
+
"warning": "yellow",
|
|
28
|
+
"muted": "mediumGray",
|
|
29
|
+
"dim": "dimGray",
|
|
30
|
+
"text": "",
|
|
31
|
+
"thinkingText": "mediumGray",
|
|
32
|
+
|
|
33
|
+
"selectedBg": "selectedBg",
|
|
34
|
+
"userMessageBg": "userMsgBg",
|
|
35
|
+
"userMessageText": "",
|
|
36
|
+
"customMessageBg": "customMsgBg",
|
|
37
|
+
"customMessageText": "",
|
|
38
|
+
"customMessageLabel": "#7e57c2",
|
|
39
|
+
"toolPendingBg": "toolPendingBg",
|
|
40
|
+
"toolSuccessBg": "toolSuccessBg",
|
|
41
|
+
"toolErrorBg": "toolErrorBg",
|
|
42
|
+
"toolTitle": "",
|
|
43
|
+
"toolOutput": "mediumGray",
|
|
44
|
+
|
|
45
|
+
"mdHeading": "yellow",
|
|
46
|
+
"mdLink": "blue",
|
|
47
|
+
"mdLinkUrl": "dimGray",
|
|
48
|
+
"mdCode": "teal",
|
|
49
|
+
"mdCodeBlock": "green",
|
|
50
|
+
"mdCodeBlockBorder": "mediumGray",
|
|
51
|
+
"mdQuote": "mediumGray",
|
|
52
|
+
"mdQuoteBorder": "mediumGray",
|
|
53
|
+
"mdHr": "mediumGray",
|
|
54
|
+
"mdListBullet": "green",
|
|
55
|
+
|
|
56
|
+
"toolDiffAdded": "green",
|
|
57
|
+
"toolDiffRemoved": "red",
|
|
58
|
+
"toolDiffContext": "mediumGray",
|
|
59
|
+
|
|
60
|
+
"syntaxComment": "#008000",
|
|
61
|
+
"syntaxKeyword": "#0000FF",
|
|
62
|
+
"syntaxFunction": "#795E26",
|
|
63
|
+
"syntaxVariable": "#001080",
|
|
64
|
+
"syntaxString": "#A31515",
|
|
65
|
+
"syntaxNumber": "#098658",
|
|
66
|
+
"syntaxType": "#267F99",
|
|
67
|
+
"syntaxOperator": "#000000",
|
|
68
|
+
"syntaxPunctuation": "#000000",
|
|
69
|
+
|
|
70
|
+
"thinkingOff": "lightGray",
|
|
71
|
+
"thinkingMinimal": "#767676",
|
|
72
|
+
"thinkingLow": "blue",
|
|
73
|
+
"thinkingMedium": "teal",
|
|
74
|
+
"thinkingHigh": "#875f87",
|
|
75
|
+
"thinkingXhigh": "#8b008b",
|
|
76
|
+
|
|
77
|
+
"bashMode": "green"
|
|
78
|
+
},
|
|
79
|
+
"export": {
|
|
80
|
+
"pageBg": "#f8f8f8",
|
|
81
|
+
"cardBg": "#ffffff",
|
|
82
|
+
"infoBg": "#fffae6"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "Pi Coding Agent Theme",
|
|
4
|
+
"description": "Theme schema for Pi coding agent",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["name", "colors"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "JSON schema reference"
|
|
11
|
+
},
|
|
12
|
+
"name": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "Theme name"
|
|
15
|
+
},
|
|
16
|
+
"vars": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"description": "Reusable color variables",
|
|
19
|
+
"additionalProperties": {
|
|
20
|
+
"oneOf": [
|
|
21
|
+
{
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "Hex color (#RRGGBB), variable reference, or empty string for terminal default"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "integer",
|
|
27
|
+
"minimum": 0,
|
|
28
|
+
"maximum": 255,
|
|
29
|
+
"description": "256-color palette index (0-255)"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"colors": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"description": "Theme color definitions (all required)",
|
|
37
|
+
"required": [
|
|
38
|
+
"accent",
|
|
39
|
+
"border",
|
|
40
|
+
"borderAccent",
|
|
41
|
+
"borderMuted",
|
|
42
|
+
"success",
|
|
43
|
+
"error",
|
|
44
|
+
"warning",
|
|
45
|
+
"muted",
|
|
46
|
+
"dim",
|
|
47
|
+
"text",
|
|
48
|
+
"thinkingText",
|
|
49
|
+
"selectedBg",
|
|
50
|
+
"userMessageBg",
|
|
51
|
+
"userMessageText",
|
|
52
|
+
"customMessageBg",
|
|
53
|
+
"customMessageText",
|
|
54
|
+
"customMessageLabel",
|
|
55
|
+
"toolPendingBg",
|
|
56
|
+
"toolSuccessBg",
|
|
57
|
+
"toolErrorBg",
|
|
58
|
+
"toolTitle",
|
|
59
|
+
"toolOutput",
|
|
60
|
+
"mdHeading",
|
|
61
|
+
"mdLink",
|
|
62
|
+
"mdLinkUrl",
|
|
63
|
+
"mdCode",
|
|
64
|
+
"mdCodeBlock",
|
|
65
|
+
"mdCodeBlockBorder",
|
|
66
|
+
"mdQuote",
|
|
67
|
+
"mdQuoteBorder",
|
|
68
|
+
"mdHr",
|
|
69
|
+
"mdListBullet",
|
|
70
|
+
"toolDiffAdded",
|
|
71
|
+
"toolDiffRemoved",
|
|
72
|
+
"toolDiffContext",
|
|
73
|
+
"syntaxComment",
|
|
74
|
+
"syntaxKeyword",
|
|
75
|
+
"syntaxFunction",
|
|
76
|
+
"syntaxVariable",
|
|
77
|
+
"syntaxString",
|
|
78
|
+
"syntaxNumber",
|
|
79
|
+
"syntaxType",
|
|
80
|
+
"syntaxOperator",
|
|
81
|
+
"syntaxPunctuation",
|
|
82
|
+
"thinkingOff",
|
|
83
|
+
"thinkingMinimal",
|
|
84
|
+
"thinkingLow",
|
|
85
|
+
"thinkingMedium",
|
|
86
|
+
"thinkingHigh",
|
|
87
|
+
"thinkingXhigh",
|
|
88
|
+
"bashMode"
|
|
89
|
+
],
|
|
90
|
+
"properties": {
|
|
91
|
+
"accent": {
|
|
92
|
+
"$ref": "#/$defs/colorValue",
|
|
93
|
+
"description": "Primary accent color (logo, selected items, cursor)"
|
|
94
|
+
},
|
|
95
|
+
"border": {
|
|
96
|
+
"$ref": "#/$defs/colorValue",
|
|
97
|
+
"description": "Normal borders"
|
|
98
|
+
},
|
|
99
|
+
"borderAccent": {
|
|
100
|
+
"$ref": "#/$defs/colorValue",
|
|
101
|
+
"description": "Highlighted borders"
|
|
102
|
+
},
|
|
103
|
+
"borderMuted": {
|
|
104
|
+
"$ref": "#/$defs/colorValue",
|
|
105
|
+
"description": "Subtle borders"
|
|
106
|
+
},
|
|
107
|
+
"success": {
|
|
108
|
+
"$ref": "#/$defs/colorValue",
|
|
109
|
+
"description": "Success states"
|
|
110
|
+
},
|
|
111
|
+
"error": {
|
|
112
|
+
"$ref": "#/$defs/colorValue",
|
|
113
|
+
"description": "Error states"
|
|
114
|
+
},
|
|
115
|
+
"warning": {
|
|
116
|
+
"$ref": "#/$defs/colorValue",
|
|
117
|
+
"description": "Warning states"
|
|
118
|
+
},
|
|
119
|
+
"muted": {
|
|
120
|
+
"$ref": "#/$defs/colorValue",
|
|
121
|
+
"description": "Secondary/dimmed text"
|
|
122
|
+
},
|
|
123
|
+
"dim": {
|
|
124
|
+
"$ref": "#/$defs/colorValue",
|
|
125
|
+
"description": "Very dimmed text (more subtle than muted)"
|
|
126
|
+
},
|
|
127
|
+
"text": {
|
|
128
|
+
"$ref": "#/$defs/colorValue",
|
|
129
|
+
"description": "Default text color (usually empty string)"
|
|
130
|
+
},
|
|
131
|
+
"thinkingText": {
|
|
132
|
+
"$ref": "#/$defs/colorValue",
|
|
133
|
+
"description": "Thinking block text color"
|
|
134
|
+
},
|
|
135
|
+
"selectedBg": {
|
|
136
|
+
"$ref": "#/$defs/colorValue",
|
|
137
|
+
"description": "Selected item background"
|
|
138
|
+
},
|
|
139
|
+
"userMessageBg": {
|
|
140
|
+
"$ref": "#/$defs/colorValue",
|
|
141
|
+
"description": "User message background"
|
|
142
|
+
},
|
|
143
|
+
"userMessageText": {
|
|
144
|
+
"$ref": "#/$defs/colorValue",
|
|
145
|
+
"description": "User message text color"
|
|
146
|
+
},
|
|
147
|
+
"customMessageBg": {
|
|
148
|
+
"$ref": "#/$defs/colorValue",
|
|
149
|
+
"description": "Custom message background (hook-injected messages)"
|
|
150
|
+
},
|
|
151
|
+
"customMessageText": {
|
|
152
|
+
"$ref": "#/$defs/colorValue",
|
|
153
|
+
"description": "Custom message text color"
|
|
154
|
+
},
|
|
155
|
+
"customMessageLabel": {
|
|
156
|
+
"$ref": "#/$defs/colorValue",
|
|
157
|
+
"description": "Custom message type label color"
|
|
158
|
+
},
|
|
159
|
+
"toolPendingBg": {
|
|
160
|
+
"$ref": "#/$defs/colorValue",
|
|
161
|
+
"description": "Tool execution box (pending state)"
|
|
162
|
+
},
|
|
163
|
+
"toolSuccessBg": {
|
|
164
|
+
"$ref": "#/$defs/colorValue",
|
|
165
|
+
"description": "Tool execution box (success state)"
|
|
166
|
+
},
|
|
167
|
+
"toolErrorBg": {
|
|
168
|
+
"$ref": "#/$defs/colorValue",
|
|
169
|
+
"description": "Tool execution box (error state)"
|
|
170
|
+
},
|
|
171
|
+
"toolTitle": {
|
|
172
|
+
"$ref": "#/$defs/colorValue",
|
|
173
|
+
"description": "Tool execution box title color"
|
|
174
|
+
},
|
|
175
|
+
"toolOutput": {
|
|
176
|
+
"$ref": "#/$defs/colorValue",
|
|
177
|
+
"description": "Tool execution box output text color"
|
|
178
|
+
},
|
|
179
|
+
"mdHeading": {
|
|
180
|
+
"$ref": "#/$defs/colorValue",
|
|
181
|
+
"description": "Markdown heading text"
|
|
182
|
+
},
|
|
183
|
+
"mdLink": {
|
|
184
|
+
"$ref": "#/$defs/colorValue",
|
|
185
|
+
"description": "Markdown link text"
|
|
186
|
+
},
|
|
187
|
+
"mdLinkUrl": {
|
|
188
|
+
"$ref": "#/$defs/colorValue",
|
|
189
|
+
"description": "Markdown link URL"
|
|
190
|
+
},
|
|
191
|
+
"mdCode": {
|
|
192
|
+
"$ref": "#/$defs/colorValue",
|
|
193
|
+
"description": "Markdown inline code"
|
|
194
|
+
},
|
|
195
|
+
"mdCodeBlock": {
|
|
196
|
+
"$ref": "#/$defs/colorValue",
|
|
197
|
+
"description": "Markdown code block content"
|
|
198
|
+
},
|
|
199
|
+
"mdCodeBlockBorder": {
|
|
200
|
+
"$ref": "#/$defs/colorValue",
|
|
201
|
+
"description": "Markdown code block fences"
|
|
202
|
+
},
|
|
203
|
+
"mdQuote": {
|
|
204
|
+
"$ref": "#/$defs/colorValue",
|
|
205
|
+
"description": "Markdown blockquote text"
|
|
206
|
+
},
|
|
207
|
+
"mdQuoteBorder": {
|
|
208
|
+
"$ref": "#/$defs/colorValue",
|
|
209
|
+
"description": "Markdown blockquote border"
|
|
210
|
+
},
|
|
211
|
+
"mdHr": {
|
|
212
|
+
"$ref": "#/$defs/colorValue",
|
|
213
|
+
"description": "Markdown horizontal rule"
|
|
214
|
+
},
|
|
215
|
+
"mdListBullet": {
|
|
216
|
+
"$ref": "#/$defs/colorValue",
|
|
217
|
+
"description": "Markdown list bullets/numbers"
|
|
218
|
+
},
|
|
219
|
+
"toolDiffAdded": {
|
|
220
|
+
"$ref": "#/$defs/colorValue",
|
|
221
|
+
"description": "Added lines in tool diffs"
|
|
222
|
+
},
|
|
223
|
+
"toolDiffRemoved": {
|
|
224
|
+
"$ref": "#/$defs/colorValue",
|
|
225
|
+
"description": "Removed lines in tool diffs"
|
|
226
|
+
},
|
|
227
|
+
"toolDiffContext": {
|
|
228
|
+
"$ref": "#/$defs/colorValue",
|
|
229
|
+
"description": "Context lines in tool diffs"
|
|
230
|
+
},
|
|
231
|
+
"syntaxComment": {
|
|
232
|
+
"$ref": "#/$defs/colorValue",
|
|
233
|
+
"description": "Syntax highlighting: comments"
|
|
234
|
+
},
|
|
235
|
+
"syntaxKeyword": {
|
|
236
|
+
"$ref": "#/$defs/colorValue",
|
|
237
|
+
"description": "Syntax highlighting: keywords"
|
|
238
|
+
},
|
|
239
|
+
"syntaxFunction": {
|
|
240
|
+
"$ref": "#/$defs/colorValue",
|
|
241
|
+
"description": "Syntax highlighting: function names"
|
|
242
|
+
},
|
|
243
|
+
"syntaxVariable": {
|
|
244
|
+
"$ref": "#/$defs/colorValue",
|
|
245
|
+
"description": "Syntax highlighting: variable names"
|
|
246
|
+
},
|
|
247
|
+
"syntaxString": {
|
|
248
|
+
"$ref": "#/$defs/colorValue",
|
|
249
|
+
"description": "Syntax highlighting: string literals"
|
|
250
|
+
},
|
|
251
|
+
"syntaxNumber": {
|
|
252
|
+
"$ref": "#/$defs/colorValue",
|
|
253
|
+
"description": "Syntax highlighting: number literals"
|
|
254
|
+
},
|
|
255
|
+
"syntaxType": {
|
|
256
|
+
"$ref": "#/$defs/colorValue",
|
|
257
|
+
"description": "Syntax highlighting: type names"
|
|
258
|
+
},
|
|
259
|
+
"syntaxOperator": {
|
|
260
|
+
"$ref": "#/$defs/colorValue",
|
|
261
|
+
"description": "Syntax highlighting: operators"
|
|
262
|
+
},
|
|
263
|
+
"syntaxPunctuation": {
|
|
264
|
+
"$ref": "#/$defs/colorValue",
|
|
265
|
+
"description": "Syntax highlighting: punctuation"
|
|
266
|
+
},
|
|
267
|
+
"thinkingOff": {
|
|
268
|
+
"$ref": "#/$defs/colorValue",
|
|
269
|
+
"description": "Thinking level border: off"
|
|
270
|
+
},
|
|
271
|
+
"thinkingMinimal": {
|
|
272
|
+
"$ref": "#/$defs/colorValue",
|
|
273
|
+
"description": "Thinking level border: minimal"
|
|
274
|
+
},
|
|
275
|
+
"thinkingLow": {
|
|
276
|
+
"$ref": "#/$defs/colorValue",
|
|
277
|
+
"description": "Thinking level border: low"
|
|
278
|
+
},
|
|
279
|
+
"thinkingMedium": {
|
|
280
|
+
"$ref": "#/$defs/colorValue",
|
|
281
|
+
"description": "Thinking level border: medium"
|
|
282
|
+
},
|
|
283
|
+
"thinkingHigh": {
|
|
284
|
+
"$ref": "#/$defs/colorValue",
|
|
285
|
+
"description": "Thinking level border: high"
|
|
286
|
+
},
|
|
287
|
+
"thinkingXhigh": {
|
|
288
|
+
"$ref": "#/$defs/colorValue",
|
|
289
|
+
"description": "Thinking level border: xhigh (OpenAI codex-max only)"
|
|
290
|
+
},
|
|
291
|
+
"bashMode": {
|
|
292
|
+
"$ref": "#/$defs/colorValue",
|
|
293
|
+
"description": "Editor border color in bash mode"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
"additionalProperties": false
|
|
297
|
+
},
|
|
298
|
+
"export": {
|
|
299
|
+
"type": "object",
|
|
300
|
+
"description": "Optional colors for HTML export (defaults derived from userMessageBg if not specified)",
|
|
301
|
+
"properties": {
|
|
302
|
+
"pageBg": {
|
|
303
|
+
"$ref": "#/$defs/colorValue",
|
|
304
|
+
"description": "Page background color"
|
|
305
|
+
},
|
|
306
|
+
"cardBg": {
|
|
307
|
+
"$ref": "#/$defs/colorValue",
|
|
308
|
+
"description": "Card/container background color"
|
|
309
|
+
},
|
|
310
|
+
"infoBg": {
|
|
311
|
+
"$ref": "#/$defs/colorValue",
|
|
312
|
+
"description": "Info sections background (system prompt, notices)"
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"additionalProperties": false
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"additionalProperties": false,
|
|
319
|
+
"$defs": {
|
|
320
|
+
"colorValue": {
|
|
321
|
+
"oneOf": [
|
|
322
|
+
{
|
|
323
|
+
"type": "string",
|
|
324
|
+
"description": "Hex color (#RRGGBB), variable reference, or empty string for terminal default"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"type": "integer",
|
|
328
|
+
"minimum": 0,
|
|
329
|
+
"maximum": 255,
|
|
330
|
+
"description": "256-color palette index (0-255)"
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@caoyacheng/tclaw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "T-Claw Coding Agent CLI - 基于 pi-mono 的智能编码助手",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"piConfig": {
|
|
7
|
+
"name": "@caoyacheng/tclaw",
|
|
8
|
+
"configDir": ".tclaw"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"tclaw": "./dist/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"clean": "shx rm -rf dist",
|
|
19
|
+
"build": "tsc -p tsconfig.build.json && shx chmod +x dist/cli.js",
|
|
20
|
+
"postbuild": "shx mkdir -p dist/modes/interactive/theme && shx cp node_modules/@mariozechner/pi-coding-agent/dist/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html && shx cp node_modules/@mariozechner/pi-coding-agent/dist/core/export-html/template.html dist/core/export-html/",
|
|
21
|
+
"dev": "tsx src/cli.ts",
|
|
22
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@mariozechner/pi-coding-agent": "^0.64.0",
|
|
26
|
+
"undici": "^7.19.1"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^22.10.5",
|
|
30
|
+
"shx": "^0.4.0",
|
|
31
|
+
"tsx": "^4.20.0",
|
|
32
|
+
"typescript": "^5.7.3"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": ">=20.6.0"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"coding-agent",
|
|
39
|
+
"ai",
|
|
40
|
+
"llm",
|
|
41
|
+
"cli",
|
|
42
|
+
"tui",
|
|
43
|
+
"tclaw"
|
|
44
|
+
],
|
|
45
|
+
"author": "caoyacheng",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/your-username/tclaw"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/your-username/tclaw/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/your-username/tclaw#readme"
|
|
55
|
+
}
|