aura-basetools 0.19.0 → 0.21.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 +4 -3
- package/bin/aura-mcp.mjs +62 -14
- package/bin/aura.mjs +28 -4
- package/lib/encoding-memory.mjs +87 -0
- package/lib/encoding.mjs +410 -0
- package/lib/fs-provider.mjs +60 -6
- package/lib/observation-store.mjs +21 -4
- package/lib/ops.mjs +50 -14
- package/locator-lab/doc-structure.mjs +382 -0
- package/locator-lab/read-core.mjs +136 -12
- package/locator-lab/write-path.mjs +22 -3
- package/package.json +1 -1
- package/test/doctor-test.mjs +6 -0
- package/test/standalone-test.mjs +6 -0
- package/test/write-test.mjs +7 -2
package/test/standalone-test.mjs
CHANGED
|
@@ -375,6 +375,12 @@ say('F MCP:initialize / tools/list / tools/call')
|
|
|
375
375
|
const byId = new Map(replies.map((r) => [r.id, r]))
|
|
376
376
|
check(byId.get(1)?.result?.protocolVersion === '2025-06-18', 'initialize 回显协议版本', JSON.stringify(byId.get(1)).slice(0, 120))
|
|
377
377
|
check(byId.get(1)?.result?.serverInfo?.name === 'aura-basetools', 'serverInfo.name = aura-basetools')
|
|
378
|
+
const instructions = byId.get(1)?.result?.instructions
|
|
379
|
+
check(
|
|
380
|
+
typeof instructions === 'string' && instructions.includes('Prefer the aura_basetools_*') && instructions.includes('aura_basetools_tx'),
|
|
381
|
+
'initialize 带服务器 instructions(优先 aura + tx)',
|
|
382
|
+
String(instructions ?? '').slice(0, 120),
|
|
383
|
+
)
|
|
378
384
|
// 版本号曾经写死在 bin 里(包到 0.4.0,服务对外还报 0.2.1)—— 这里钉住它跟包清单一致
|
|
379
385
|
const manifest = (() => {
|
|
380
386
|
try {
|
package/test/write-test.mjs
CHANGED
|
@@ -169,10 +169,15 @@ say('B 覆写:整份替换,BOM / 既有行尾 / 尾换行精确')
|
|
|
169
169
|
const atMissing = json(run(['basetools', 'write', '--file', 'at-missing-out.txt', '--content', '@missing-content.txt']))
|
|
170
170
|
check(atMissing.ok === false && atMissing.code === 'USAGE' && !fs.existsSync(file('at-missing-out.txt')), 'B28 --content @不存在 ⇒ JSON 回执(不是 Node 栈)', JSON.stringify(atMissing).slice(0, 160))
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* 0.21 起非 UTF-8 **可写**:`caf\xe9` 被探测成 windows-1252,写回沿用同一编码。
|
|
174
|
+
* 旧断言(拒绝)对应的是“只支持 UTF-8”的年代;拒绝现在只在“不可逆/猜不准/表示不了”时发生,
|
|
175
|
+
* 那三条分别在 `encoding-test` 的 E 段与 `encoding-refusal-test` 里。
|
|
176
|
+
*/
|
|
172
177
|
fs.writeFileSync(file('latin1.txt'), Buffer.from([0x63, 0x61, 0x66, 0xe9, 0x0a]))
|
|
173
178
|
const nonUtf8 = json(run(['basetools', 'write', '--file', 'latin1.txt', '--content', 'x\n', '--allow-unobserved']))
|
|
174
|
-
check(nonUtf8.ok ===
|
|
175
|
-
check(fs.readFileSync(file('latin1.txt')).equals(Buffer.from([
|
|
179
|
+
check(nonUtf8.ok === true, 'B29 非 UTF-8(windows-1252)覆写成功(不再拒绝)', JSON.stringify(nonUtf8).slice(0, 160))
|
|
180
|
+
check(fs.readFileSync(file('latin1.txt')).equals(Buffer.from([0x78, 0x0a])), 'B30 非 UTF-8 覆写:用同一编码写回(ASCII 子集)')
|
|
176
181
|
|
|
177
182
|
fs.writeFileSync(file('stale-force.txt'), 'v1\n')
|
|
178
183
|
prime('stale-force.txt')
|