toolflow 3.1.4
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/.github/workflows/ci.yml +31 -0
- package/README.md +106 -0
- package/README_zh.md +109 -0
- package/docs/reports/ADVANCED_EVOLUTION_REPORT.md +44 -0
- package/docs/reports/AUDIT_AND_OPTIMIZATION_REPORT.md +645 -0
- package/docs/reports/COLD_START_REVIEW_EVOLUTION.md +51 -0
- package/docs/reports/DEEP_ECOSYSTEM_EVOLUTION.md +43 -0
- package/docs/reports/MEMORY.md +18 -0
- package/docs/reports/MICHAEL_DISPATCH_RESULT.md +36 -0
- package/docs/reports/OPENSOURCE_INTEGRATION_REPORT.md +43 -0
- package/docs/reports/PHASE_1_OPTIMIZATION_REPORT.md +87 -0
- package/docs/reports/PHASE_2_OPTIMIZATION_REPORT.md +50 -0
- package/docs/reports/PHASE_3_OPTIMIZATION_REPORT.md +24 -0
- package/docs/reports/PHASE_4_OPTIMIZATION_REPORT.md +28 -0
- package/docs/reports/REPORT_TO_MICHAEL.md +101 -0
- package/docs/reports/SIGNOFF_AND_RELEASE_REPORT.md +85 -0
- package/docs/reports/STAFF_ASSIGNMENTS.md +26 -0
- package/docs/reports/TASK_ASSIGNMENTS.md +59 -0
- package/docs/reports/V1_6_0_EVOLUTION_REPORT.md +48 -0
- package/docs/reports/V1_9_0_HOTFIX_REPORT.md +30 -0
- package/docs/reports/V2_0_0_RELEASE_REPORT.md +18 -0
- package/docs/reports/V2_2_0_ZERO_SPECIALIZATION_REPORT.md +24 -0
- package/docs/reports/V2_3_0_EVOLUTION_REPORT.md +12 -0
- package/ecosystem_taxonomy.json +798 -0
- package/package.json +46 -0
- package/src/blast_radius.ts +302 -0
- package/src/deep_ecosystem.ts +523 -0
- package/src/degradation_matrix.ts +180 -0
- package/src/dehydrator.ts +532 -0
- package/src/ecosystem_taxonomy.json +803 -0
- package/src/engine.ts +1510 -0
- package/src/i18n.ts +89 -0
- package/src/index.ts +983 -0
- package/src/json_extractor.ts +57 -0
- package/src/memory.ts +151 -0
- package/src/prompts_manager.ts +262 -0
- package/src/review_isolation.ts +188 -0
- package/src/state.ts +810 -0
- package/src/taxonomy.ts +580 -0
- package/src/types.ts +341 -0
- package/src/ui.ts +1036 -0
- package/src/worker_orchestrator.ts +60 -0
- package/tests/challenger_stress_harness.ts +265 -0
- package/tests/monorepo_multilang_stress.ts +404 -0
- package/tests/sandbox_e2e.ts +167 -0
- package/tests/test_json_extractor.ts +44 -0
- package/tests/test_modules_1_to_4.ts +106 -0
- package/tests/test_suite.ts +1689 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import * as os from "os";
|
|
4
|
+
import assert from "assert";
|
|
5
|
+
|
|
6
|
+
console.log("\n================================================================================");
|
|
7
|
+
console.log("[TOOLFLOW] Module 1 ~ 4 新增专项自动化断言测试 (TEST-26 ~ TEST-29)");
|
|
8
|
+
console.log("================================================================================");
|
|
9
|
+
|
|
10
|
+
async function run() {
|
|
11
|
+
console.log("\n[TEST-26] 验证 ReadCache 穿透门禁与极速代码骨架索引...");
|
|
12
|
+
{
|
|
13
|
+
const { ReadCacheManager } = await import("../src/dehydrator.js");
|
|
14
|
+
const cacheMgr = new ReadCacheManager();
|
|
15
|
+
const tmpTs = path.join(os.tmpdir(), "toolflow_skeleton_test.ts");
|
|
16
|
+
const tsCode = [
|
|
17
|
+
'import { foo } from "bar";',
|
|
18
|
+
"export interface MyConfig { name: string; }",
|
|
19
|
+
"export class WorkManager {",
|
|
20
|
+
" public doJob(): void {}",
|
|
21
|
+
"}",
|
|
22
|
+
"// 填充行至 85 行",
|
|
23
|
+
...Array(80).fill("const x = 1;")
|
|
24
|
+
].join("\n");
|
|
25
|
+
fs.writeFileSync(tmpTs, tsCode, "utf8");
|
|
26
|
+
|
|
27
|
+
// 1. 带有 offset/limit 时必须穿透
|
|
28
|
+
const sliceHit = cacheMgr.checkOrUpdate(tmpTs, tsCode, 1, { path: tmpTs, offset: 10, limit: 20 });
|
|
29
|
+
assert.strictEqual(sliceHit.isDuplicate, false, "26.1 slice 读取必须强制穿透");
|
|
30
|
+
|
|
31
|
+
// 2. 首次全量读取建立缓存
|
|
32
|
+
cacheMgr.checkOrUpdate(tmpTs, tsCode, 1);
|
|
33
|
+
|
|
34
|
+
// 3. 再次读取输出缓存提示
|
|
35
|
+
const repeatHit = cacheMgr.checkOrUpdate(tmpTs, tsCode, 2);
|
|
36
|
+
assert.strictEqual(repeatHit.isDuplicate, true, "26.2 重复读取命中缓存");
|
|
37
|
+
assert(repeatHit.notice && repeatHit.notice.includes("ToolFlow Read Cache"), "26.3 必须输出极简缓存提示头部");
|
|
38
|
+
assert(repeatHit.notice && repeatHit.notice.includes("offset"), "26.4 提示必须引导使用 offset/limit 局部读取");
|
|
39
|
+
|
|
40
|
+
// 4. 模拟 edit 失败记录,下一次读取必须强制穿透
|
|
41
|
+
cacheMgr.recordEditFailure(tmpTs, 3);
|
|
42
|
+
const retryHit = cacheMgr.checkOrUpdate(tmpTs, tsCode, 3);
|
|
43
|
+
assert.strictEqual(retryHit.isDuplicate, false, "26.5 edit 失败后重读必须 100% 穿透");
|
|
44
|
+
fs.rmSync(tmpTs, { force: true });
|
|
45
|
+
console.log(" [OK] 26.1 - 26.5 ReadCache 穿透门禁 100% 验证通过!");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log("\n[TEST-27] 验证产物物理非空与内容门禁...");
|
|
49
|
+
{
|
|
50
|
+
const { verifyArtifactHeuristics } = await import("../src/state.js");
|
|
51
|
+
|
|
52
|
+
// 1. 0 字节拦截
|
|
53
|
+
const emptyRes = verifyArtifactHeuristics("a.ts", "");
|
|
54
|
+
assert.strictEqual(emptyRes.valid, false, "27.1 0 字节文件必须被拦截");
|
|
55
|
+
|
|
56
|
+
// 2. 纯空白字符拦截
|
|
57
|
+
const blankRes = verifyArtifactHeuristics("a.ts", " \n\n\t ");
|
|
58
|
+
assert.strictEqual(blankRes.valid, false, "27.2 纯空白字符必须被拦截");
|
|
59
|
+
|
|
60
|
+
// 3. 合法代码通过
|
|
61
|
+
const validRes = verifyArtifactHeuristics("src/version.ts", 'export const VERSION = "1.0.0";\n');
|
|
62
|
+
assert.strictEqual(validRes.valid, true, "27.3 合法有效代码通过");
|
|
63
|
+
|
|
64
|
+
console.log(" [OK] 27.1 - 27.3 产物物理非空门禁 100% 验证通过!");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
console.log("\n[TEST-28] 验证双模路由意图判断器 (Fast-Track vs Blueprint)...");
|
|
68
|
+
{
|
|
69
|
+
const { diagnoseTaskExecutionMode } = await import("../src/engine.js");
|
|
70
|
+
|
|
71
|
+
const fast1 = diagnoseTaskExecutionMode("修复 ui.ts 中的拼写错误");
|
|
72
|
+
assert.strictEqual(fast1.mode, "FAST_TRACK", "28.1 单文件局部修复走 Fast-Track");
|
|
73
|
+
|
|
74
|
+
const fast2 = diagnoseTaskExecutionMode("改一下第 15 行的背景颜色");
|
|
75
|
+
assert.strictEqual(fast2.mode, "FAST_TRACK", "28.2 具体行号修改走 Fast-Track");
|
|
76
|
+
|
|
77
|
+
const bp1 = diagnoseTaskExecutionMode("重构系统认证模块并搭建全套端到端测试");
|
|
78
|
+
assert.strictEqual(bp1.mode, "BLUEPRINT", "28.3 全局重构强制走 Blueprint");
|
|
79
|
+
|
|
80
|
+
console.log(" [OK] 28.1 - 28.3 任务双模路由判断 100% 验证通过!");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
console.log("\n[TEST-29] 验证 TUI CJK 宽字符滑动视口与列宽断言...");
|
|
84
|
+
{
|
|
85
|
+
const { renderCJKSafeInputBox } = await import("../src/ui.js");
|
|
86
|
+
const { visibleWidth } = await import("@earendil-works/pi-tui");
|
|
87
|
+
const mockTheme = { fg: (_c: string, s: string) => s };
|
|
88
|
+
|
|
89
|
+
// 输入超长汉字(30 个汉字 = 60 列宽),视口窗口限定为 20 列
|
|
90
|
+
const cjkText = "这是一段非常非常长的中文任务输入目标用于测试视口滑动";
|
|
91
|
+
const rendered = renderCJKSafeInputBox("> ", cjkText, 20, mockTheme, true);
|
|
92
|
+
const width = visibleWidth(rendered);
|
|
93
|
+
assert.strictEqual(width, 20, "29.1 超长中文输入下物理列宽必须恒等于 windowWidth (20)");
|
|
94
|
+
|
|
95
|
+
console.log(" [OK] 29.1 TUI CJK 滑动视口列宽稳定性 100% 验证通过!");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log("\n================================================================================");
|
|
99
|
+
console.log("[ALL-EXTENDED-PASSED] Module 1 ~ 4 新增专项断言 100% 全部绿灯通过!");
|
|
100
|
+
console.log("================================================================================\n");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
run().catch(err => {
|
|
104
|
+
console.error("测试异常:", err);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
});
|