aura-basetools 0.0.0-stage → 0.13.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/LICENSE +21 -0
- package/README.md +236 -2
- package/THIRD-PARTY-NOTICES.md +9 -0
- package/bin/aura-mcp.mjs +566 -0
- package/bin/aura.mjs +616 -0
- package/lib/fs-provider.mjs +355 -0
- package/lib/observation-store.mjs +369 -0
- package/lib/ops.mjs +662 -0
- package/lib/transaction-store.mjs +350 -0
- package/lib/workspace-lock.mjs +151 -0
- package/locator-lab/anchor-core.mjs +586 -0
- package/locator-lab/args.mjs +588 -0
- package/locator-lab/handle-core.mjs +207 -0
- package/locator-lab/locator-api.mjs +1159 -0
- package/locator-lab/read-core.mjs +3084 -0
- package/locator-lab/repo-map.mjs +768 -0
- package/locator-lab/struct-core.mjs +3084 -0
- package/locator-lab/write-path.mjs +3995 -0
- package/package.json +50 -4
- package/test/argument-surface-test.mjs +119 -0
- package/test/doctor-test.mjs +73 -0
- package/test/observation-concurrency-test.mjs +90 -0
- package/test/standalone-test.mjs +1649 -0
- package/test/write-test.mjs +294 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aura-basetools contributors
|
|
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
CHANGED
|
@@ -1,3 +1,237 @@
|
|
|
1
|
-
#
|
|
1
|
+
# aura-basetools 0.13.0
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Byte-exact file tools for coding agents: read by intent, edit by intent, and write whole files without corrupting bytes. One engine shared by a standalone CLI and an MCP server.
|
|
4
|
+
|
|
5
|
+
面向 coding agent 的逐字节文件工具:按意图读取、按意图编辑、整文件写入;CLI 与 MCP 共用同一套引擎。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## English
|
|
10
|
+
|
|
11
|
+
### What it is
|
|
12
|
+
|
|
13
|
+
`aura-basetools` is a Node.js (>=18) package with no runtime dependencies. It provides:
|
|
14
|
+
|
|
15
|
+
- **CLI** — `aura basetools <verb>`
|
|
16
|
+
- **MCP server** — five tools over stdio
|
|
17
|
+
- **No DSH requirement** — the DeepSeek Harness adapter is a separate optional package, `aura-basetools-dsh`
|
|
18
|
+
|
|
19
|
+
The engine is intentionally not a general file manager: it reads and edits UTF-8 text, preserves byte-level formatting, and refuses edits when the addressed region changed after the read that authorized them.
|
|
20
|
+
|
|
21
|
+
### Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm i -g aura-basetools@0.13.0
|
|
25
|
+
aura --version
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### CLI
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
aura basetools read --file src/app.ts --mode map
|
|
32
|
+
aura basetools edit --file src/app.ts --hunks '[{"target":"main","replace":"..."}]'
|
|
33
|
+
aura basetools write --file generated.ts --content @body.ts
|
|
34
|
+
aura basetools undo
|
|
35
|
+
aura basetools transactions
|
|
36
|
+
aura basetools mcp
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Top-level legacy verbs (`aura read`, `aura edit`, `aura write`, `aura mcp`, ...) are rejected with exit code 1 and `shape: "CLI_NAMESPACE_REQUIRED"`. Migration is mechanical: insert `basetools` after `aura`.
|
|
40
|
+
|
|
41
|
+
### MCP
|
|
42
|
+
|
|
43
|
+
Installed globally:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"aura": {
|
|
49
|
+
"command": "aura",
|
|
50
|
+
"args": ["basetools", "mcp"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Without a global install, the one-line form is:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx -y --package aura-basetools aura basetools mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Equivalent client configuration:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"mcpServers": {
|
|
67
|
+
"aura": {
|
|
68
|
+
"command": "npx",
|
|
69
|
+
"args": ["-y", "--package", "aura-basetools", "aura", "basetools", "mcp"]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The server exposes:
|
|
76
|
+
|
|
77
|
+
| Tool | Purpose |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `aura_basetools_read` | Intent-based views: `map`, `digest`, `full`, `around`, `lines`, `search`, `changed`, `auto` |
|
|
80
|
+
| `aura_basetools_edit` | Anchored multi-hunk edits; `old` + `replace_all`; optional transaction |
|
|
81
|
+
| `aura_basetools_write` | Whole-file create/overwrite with read-before-write and read-back verification |
|
|
82
|
+
| `aura_basetools_undo` | Undo the latest or a named write transaction |
|
|
83
|
+
| `aura_basetools_transactions` | List write transactions for the current workspace |
|
|
84
|
+
|
|
85
|
+
The older tool names (`aura_read`, `aura_edit`, `aura_write`, ...) are no longer exposed by MCP or DSH.
|
|
86
|
+
|
|
87
|
+
### Guarantees and verification
|
|
88
|
+
|
|
89
|
+
The 0.13.0 release gate was run on Windows and reported:
|
|
90
|
+
|
|
91
|
+
| Suite | Result |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `standalone` | 228 / 0 |
|
|
94
|
+
| `range-bytes` | 218 / 218 |
|
|
95
|
+
| `write` | 66 / 66 |
|
|
96
|
+
| `argument-surface` | 18 / 18 |
|
|
97
|
+
| `split-package` | 75 / 75 |
|
|
98
|
+
| `upgrade` | 94 / 94 |
|
|
99
|
+
|
|
100
|
+
The guarantees the tests exercise:
|
|
101
|
+
|
|
102
|
+
- UTF-8 decoding is fatal; invalid UTF-8 is rejected rather than silently replaced.
|
|
103
|
+
- Leading BOM and per-line endings are preserved.
|
|
104
|
+
- Writes go through a temporary file, flush, rename, and a byte-for-byte read-back check.
|
|
105
|
+
- A region-level stale gate and an optional strict read-before-write policy reject edits whose basis changed.
|
|
106
|
+
- Write transactions record original bytes, support rollback/undo, and reject undo when a file changed after the transaction.
|
|
107
|
+
- Multi-target writes plan first; if planning fails, no file is written.
|
|
108
|
+
|
|
109
|
+
Linux CI is configured but was not executed on the local Windows machine used for the 0.13.0 gate. Do not read that sentence as a Linux pass.
|
|
110
|
+
|
|
111
|
+
### Boundaries
|
|
112
|
+
|
|
113
|
+
- UTF-8 text only; binary editing and encoding conversion are out of scope.
|
|
114
|
+
- Image reading is not provided; keep the host's image tool.
|
|
115
|
+
- No root-directory confinement or capability sandbox: the tool operates on the paths it is given.
|
|
116
|
+
- DSH requires a host restart after installation; MCP clients must refresh `tools/list` after upgrading.
|
|
117
|
+
- A non-cooperating writer can still race outside the workspace lock; the stale gate and post-write verification reduce, but do not eliminate, that class of conflict.
|
|
118
|
+
|
|
119
|
+
### License
|
|
120
|
+
|
|
121
|
+
MIT.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 中文
|
|
126
|
+
|
|
127
|
+
### 是什么
|
|
128
|
+
|
|
129
|
+
`aura-basetools` 是一个 Node.js(>=18)包,运行时零依赖,提供:
|
|
130
|
+
|
|
131
|
+
- **CLI**:`aura basetools <verb>`
|
|
132
|
+
- **MCP 服务**:stdio 上的五个工具
|
|
133
|
+
- **不依赖 DSH**:DeepSeek Harness 适配器是独立的可选包 `aura-basetools-dsh`
|
|
134
|
+
|
|
135
|
+
它不是通用文件管理器:只处理 UTF-8 文本,保留字节级格式;如果被寻址区域在“授权读取”之后被改动,编辑会被拒绝。
|
|
136
|
+
|
|
137
|
+
### 安装
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
npm i -g aura-basetools@0.13.0
|
|
141
|
+
aura --version
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### CLI
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
aura basetools read --file src/app.ts --mode map
|
|
148
|
+
aura basetools edit --file src/app.ts --hunks '[{"target":"main","replace":"..."}]'
|
|
149
|
+
aura basetools write --file generated.ts --content @body.ts
|
|
150
|
+
aura basetools undo
|
|
151
|
+
aura basetools transactions
|
|
152
|
+
aura basetools mcp
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
顶层旧动词(`aura read`、`aura edit`、`aura write`、`aura mcp` 等)不再执行;会返回 exit 1 和 `shape: "CLI_NAMESPACE_REQUIRED"`。迁移方式是在 `aura` 后插入 `basetools`。
|
|
156
|
+
|
|
157
|
+
### MCP
|
|
158
|
+
|
|
159
|
+
全局安装后:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"mcpServers": {
|
|
164
|
+
"aura": {
|
|
165
|
+
"command": "aura",
|
|
166
|
+
"args": ["basetools", "mcp"]
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
未全局安装时,一行命令是:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npx -y --package aura-basetools aura basetools mcp
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
等价的客户端配置:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"mcpServers": {
|
|
183
|
+
"aura": {
|
|
184
|
+
"command": "npx",
|
|
185
|
+
"args": ["-y", "--package", "aura-basetools", "aura", "basetools", "mcp"]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
工具标识:
|
|
192
|
+
|
|
193
|
+
| 工具 | 作用 |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `aura_basetools_read` | `map` / `digest` / `full` / `around` / `lines` / `search` / `changed` / `auto` |
|
|
196
|
+
| `aura_basetools_edit` | 多 hunk 锚点编辑;`old` + `replace_all`;可选事务 |
|
|
197
|
+
| `aura_basetools_write` | 整文件新建/覆写;覆写默认要求先读,写后回读校验 |
|
|
198
|
+
| `aura_basetools_undo` | 撤销最近一次或指定写事务 |
|
|
199
|
+
| `aura_basetools_transactions` | 列出当前工作区写事务 |
|
|
200
|
+
|
|
201
|
+
旧工具名(`aura_read`、`aura_edit`、`aura_write` 等)不再由 MCP/DSH 暴露。
|
|
202
|
+
|
|
203
|
+
### 保证与验证
|
|
204
|
+
|
|
205
|
+
0.13.0 发布闸在 Windows 上实跑,读数:
|
|
206
|
+
|
|
207
|
+
| 套件 | 结果 |
|
|
208
|
+
|---|---|
|
|
209
|
+
| `standalone` | 228 / 0 |
|
|
210
|
+
| `range-bytes` | 218 / 218 |
|
|
211
|
+
| `write` | 66 / 66 |
|
|
212
|
+
| `argument-surface` | 18 / 18 |
|
|
213
|
+
| `split-package` | 75 / 75 |
|
|
214
|
+
| `upgrade` | 94 / 94 |
|
|
215
|
+
|
|
216
|
+
这些套件实际检查:
|
|
217
|
+
|
|
218
|
+
- UTF-8 解码使用 fatal 模式;非法字节被拒绝,不做静默替换。
|
|
219
|
+
- 保留前导 BOM 与逐行行尾。
|
|
220
|
+
- 写入走同目录临时文件、flush、rename,并做逐字节回读校验。
|
|
221
|
+
- 区域级陈旧闸门;可选的严格“先读后写”策略会拒绝依据已变化的编辑。
|
|
222
|
+
- 写事务记录原始字节,支持回滚/undo;事务后文件又被改过时拒绝 undo。
|
|
223
|
+
- 多目标写入先全量规划;规划失败则一个文件都不写。
|
|
224
|
+
|
|
225
|
+
Linux CI 已配置,但本机 0.13.0 发布闸是 Windows 实跑;不能据此声称 Linux 已通过。
|
|
226
|
+
|
|
227
|
+
### 边界
|
|
228
|
+
|
|
229
|
+
- 只支持 UTF-8 文本;不编辑二进制,不做编码转换。
|
|
230
|
+
- 不提供图片读取;保留宿主的图片工具。
|
|
231
|
+
- 不做根目录约束或 capability sandbox;工具作用于调用方给出的路径。
|
|
232
|
+
- DSH 安装后需要重启宿主;MCP 客户端升级后需要重新拉取 `tools/list`。
|
|
233
|
+
- 不遵守协议的并发写者仍可能绕开工作区锁;陈旧闸门与写后校验降低风险,但不会消除该冲突。
|
|
234
|
+
|
|
235
|
+
### 许可证
|
|
236
|
+
|
|
237
|
+
MIT.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
本仓主体按 **MIT** 许可分发(全文见 [`LICENSE`](./LICENSE))。
|
|
4
|
+
|
|
5
|
+
This repository is MIT-licensed (see `LICENSE`).
|
|
6
|
+
|
|
7
|
+
当前源码中没有内联的第三方代码;`src/`、`dsh/`、`build/` 已排查。若后续引入第三方代码,按各自许可在此登记,MIT 不覆盖对应部分。
|
|
8
|
+
|
|
9
|
+
No third-party code is currently inlined in this repository; `src/`, `dsh/`, and `build/` have been checked. If third-party code is added later, it will be listed here with its own license; MIT does not cover those parts.
|