aura-basetools 0.13.2 → 0.14.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.
@@ -4,7 +4,7 @@
4
4
  * 覆盖:
5
5
  * A 新建:真正建盘、回执 operation=create、dry-run 不建盘、事务可撤销(撤销后文件消失)
6
6
  * B 覆写:整份替换、BOM 与文件既有行尾保留、有无尾换行精确、no-overwrite、dry-run、
7
- * 事务 + undo 逐字节恢复、`--content @file`
7
+ * `--content @file`(0.14.0 移除公开事务/undo)
8
8
  * C MCP:aura_basetools_write 出现在 tools/list,create/overwrite/no_overwrite/dry_run/坏参数都走同一引擎
9
9
  * D 能力清单:commands 与 tools 都包含 write
10
10
  *
@@ -55,7 +55,7 @@ process.on('exit', () => {
55
55
  })
56
56
 
57
57
  // ── A 新建 ────────────────────────────────────────────────────────────────
58
- say('A 新建:整份建盘,dry-run 不建盘,事务可撤销')
58
+ say('A 新建:整份建盘,dry-run 不建盘')
59
59
  {
60
60
  const created = json(run(['basetools', 'write', '--file', 'created.txt', '--content', 'alpha\nbeta\n']))
61
61
  check(created.ok === true && created.result?.operation === 'create', 'A1 新建回执 operation=create', JSON.stringify(created).slice(0, 160))
@@ -66,13 +66,6 @@ say('A 新建:整份建盘,dry-run 不建盘,事务可撤销')
66
66
  check(dry.ok === true && dry.result?.operation === 'create' && dry.result?.dryRun === true && dry.result?.bytes === 1, 'A4 新建 dry-run 回执给 create/bytes,但不落盘', JSON.stringify(dry).slice(0, 160))
67
67
  check(fs.existsSync(file('dry-new.txt')) === false, 'A5 新建 dry-run 之后文件仍不存在')
68
68
 
69
- const tx = json(run(['basetools', 'write', '--file', 'tx-created.txt', '--content', 'gone\n', '--transaction']))
70
- const txId = tx.result?.transaction?.id
71
- check(tx.ok === true && typeof txId === 'string' && tx.result.transaction.status === 'committed', 'A6 --transaction 返回 committed 事务', JSON.stringify(tx.result?.transaction))
72
- const undone = json(run(['basetools', 'undo', '--id', txId]))
73
- check(undone.ok === true && undone.status === 'undone', 'A7 undo 成功', JSON.stringify(undone).slice(0, 160))
74
- check(fs.existsSync(file('tx-created.txt')) === false, 'A8 撤销“新建”后文件消失(不留下空文件)')
75
-
76
69
  const missingFile = json(run(['basetools', 'write', '--content', 'x']))
77
70
  const missingContent = json(run(['basetools', 'write', '--file', 'x.txt']))
78
71
  check(missingFile.ok === false && missingFile.code === 'USAGE', 'A9 缺 --file ⇒ USAGE', JSON.stringify(missingFile).slice(0, 140))
@@ -119,14 +112,6 @@ say('B 覆写:整份替换,BOM / 既有行尾 / 尾换行精确')
119
112
  const newNoOverwrite = json(run(['basetools', 'write', '--file', 'brand-new.txt', '--content', 'ok\n', '--no-overwrite']))
120
113
  check(newNoOverwrite.ok === true, 'B11 no-overwrite 对不存在的文件照常创建')
121
114
 
122
- fs.writeFileSync(file('tx-restore.txt'), Buffer.concat([BOM, Buffer.from('orig\r\nbytes\r\n', 'utf8')]))
123
- prime('tx-restore.txt')
124
- const original = fs.readFileSync(file('tx-restore.txt'))
125
- const tx = json(run(['basetools', 'write', '--file', 'tx-restore.txt', '--content', 'changed\n', '--transaction']))
126
- check(!fs.readFileSync(file('tx-restore.txt')).equals(original), 'B12 覆写真的改了盘')
127
- const undone = json(run(['basetools', 'undo', '--id', tx.result?.transaction?.id]))
128
- check(undone.ok === true && fs.readFileSync(file('tx-restore.txt')).equals(original), 'B13 undo 逐字节恢复覆写前的原文(含 BOM/CRLF)')
129
-
130
115
  fs.writeFileSync(file('content-source.txt'), 'from @file\nsecond line\n')
131
116
  const atFile = json(run(['basetools', 'write', '--file', 'from-at.txt', '--content', '@' + file('content-source.txt')]))
132
117
  check(atFile.ok === true && fs.readFileSync(file('from-at.txt'), 'utf8') === fs.readFileSync(file('content-source.txt'), 'utf8'), 'B14 --content @file 读入整份内容')
@@ -225,7 +210,7 @@ say('C MCP:aura_basetools_write 声明面与调用面')
225
210
 
226
211
  const tools = byId.get(2)?.result?.tools ?? []
227
212
  const writeTool = tools.find((tool) => tool.name === 'aura_basetools_write')
228
- check(tools.length === 5 && writeTool !== undefined, `C1 tools/list 五个工具且含 aura_basetools_write(${tools.map((tool) => tool.name).join(',')})`)
213
+ check(tools.length === 3 && writeTool !== undefined, `C1 tools/list 三个工具且含 aura_basetools_write(${tools.map((tool) => tool.name).join(',')})`)
229
214
  check(JSON.stringify(writeTool?.inputSchema?.required) === JSON.stringify(['file_path', 'content']), 'C2 aura_basetools_write schema 必填 file_path + content', JSON.stringify(writeTool?.inputSchema?.required))
230
215
  check(envOf(3).ok === true && envOf(3).result?.operation === 'create', 'C3 经 MCP 新建成功', JSON.stringify(envOf(3)).slice(0, 160))
231
216
  check(fs.readFileSync(file('mcp-created.txt'), 'utf8') === 'mcp\ncreate\n', 'C4 MCP 新建的内容真的落盘')