Skip to content

Commit 35b4678

Browse files
committed
fix: improve Missing compiled prompt error with file path and add regression tests
- Add entry.name to error messages in subagent, rule, command collectors/builders - Strengthen unit test assertions to verify file paths in error output - Copy missing .src.mdx to .mdx compiled prompts in aindex - Add trae smoke test file
1 parent 661bb37 commit 35b4678

26 files changed

Lines changed: 461 additions & 80 deletions

File tree

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ members = [
2929
]
3030

3131
[workspace.package]
32-
version = "2026.10425.10151"
32+
version = "2026.10425.10602"
3333
edition = "2024"
3434
rust-version = "1.88"
3535
license = "AGPL-3.0-only"

cli/local-tests/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ impl LocalTestRunner {
216216
fs::read_to_string(home_dir().join(".claude").join("CLAUDE.md")).ok()
217217
}
218218

219+
/// 检查项目级 .trae/steering/GLOBAL.md 是否存在。
220+
pub fn trae_steering_file_exists(&self) -> bool {
221+
self.cwd.join(".trae").join("steering").join("GLOBAL.md").is_file()
222+
}
223+
224+
/// 检查项目级 .trae-cn/user_rules/GLOBAL.md 是否存在。
225+
pub fn trae_cn_file_exists(&self) -> bool {
226+
self.cwd.join(".trae-cn").join("user_rules").join("GLOBAL.md").is_file()
227+
}
228+
219229
/// 检查项目级 CLAUDE.md 是否存在。
220230
pub fn claude_project_file_exists(&self) -> bool {
221231
self.cwd.join("CLAUDE.md").is_file()
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
//! 本地裸机 Trae 测试:验证 .trae/steering/GLOBAL.md 正确生成,
2+
//! .trae-cn/ 不被输出,且清理时兼容清理旧的 .trae-cn/。
3+
4+
use std::fs;
5+
6+
use tnmsc_local_tests::LocalTestRunner;
7+
8+
#[test]
9+
fn binary_exists_before_tests() {
10+
let binary = tnmsc_local_tests::binary_path();
11+
assert!(
12+
binary.is_file(),
13+
"binary not found at: {}\n\nplease compile it first:\n cargo build -p tnmsc\n",
14+
binary.display()
15+
);
16+
}
17+
18+
#[test]
19+
fn local_trae_steering_generated_after_install() {
20+
let runner = LocalTestRunner::new();
21+
runner.assert_project_ready();
22+
23+
let clean = runner.clean();
24+
clean.assert_success("tnmsc clean before install");
25+
26+
let install = runner.install();
27+
install.assert_success("tnmsc install");
28+
29+
assert!(
30+
runner.trae_steering_file_exists(),
31+
".trae/steering/GLOBAL.md should be generated after install, stdout:\n{}\nstderr:\n{}",
32+
install.stdout,
33+
install.stderr
34+
);
35+
36+
assert!(
37+
!runner.trae_cn_file_exists(),
38+
".trae-cn/user_rules/GLOBAL.md must NOT be generated after install"
39+
);
40+
}
41+
42+
#[test]
43+
fn local_trae_steering_idempotent() {
44+
let runner = LocalTestRunner::new();
45+
runner.assert_project_ready();
46+
47+
let clean = runner.clean();
48+
clean.assert_success("tnmsc clean before install");
49+
50+
let first = runner.install();
51+
first.assert_success("first tnmsc install");
52+
assert!(runner.trae_steering_file_exists());
53+
54+
let content_first =
55+
fs::read_to_string(runner.cwd().join(".trae").join("steering").join("GLOBAL.md")).unwrap();
56+
57+
let second = runner.install();
58+
second.assert_success("second tnmsc install");
59+
60+
let content_second =
61+
fs::read_to_string(runner.cwd().join(".trae").join("steering").join("GLOBAL.md")).unwrap();
62+
63+
assert_eq!(
64+
content_first, content_second,
65+
"consecutive installs should produce identical .trae/steering/GLOBAL.md"
66+
);
67+
}
68+
69+
#[test]
70+
fn local_trae_steering_removed_after_clean() {
71+
let runner = LocalTestRunner::new();
72+
runner.assert_project_ready();
73+
74+
let clean = runner.clean();
75+
clean.assert_success("tnmsc clean before install");
76+
77+
let install = runner.install();
78+
install.assert_success("tnmsc install");
79+
assert!(runner.trae_steering_file_exists());
80+
81+
let clean = runner.clean();
82+
clean.assert_success("tnmsc clean");
83+
84+
assert!(
85+
!runner.trae_steering_file_exists(),
86+
".trae/steering/GLOBAL.md should be removed after clean"
87+
);
88+
}
89+
90+
#[test]
91+
fn local_trae_cn_cleaned_for_compatibility() {
92+
let runner = LocalTestRunner::new();
93+
runner.assert_project_ready();
94+
95+
let clean = runner.clean();
96+
clean.assert_success("tnmsc clean before install");
97+
98+
let install = runner.install();
99+
install.assert_success("tnmsc install");
100+
assert!(runner.trae_steering_file_exists());
101+
102+
// Simulate old-style .trae-cn/ output (should be cleaned up)
103+
let trae_cn_path = runner.cwd().join(".trae-cn").join("user_rules").join("GLOBAL.md");
104+
fs::create_dir_all(trae_cn_path.parent().unwrap()).unwrap();
105+
fs::write(&trae_cn_path, "# legacy\n").unwrap();
106+
assert!(runner.trae_cn_file_exists(), "fake .trae-cn should exist before clean");
107+
108+
let clean = runner.clean();
109+
clean.assert_success("tnmsc clean removes legacy .trae-cn");
110+
111+
assert!(
112+
!runner.trae_cn_file_exists(),
113+
"legacy .trae-cn/user_rules/GLOBAL.md should be removed during clean for compatibility"
114+
);
115+
116+
// .trae/steering/GLOBAL.md should also be removed
117+
assert!(
118+
!runner.trae_steering_file_exists(),
119+
".trae/steering/GLOBAL.md should also be removed after clean"
120+
);
121+
}

cli/npm/darwin-arm64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truenine/memory-sync-cli-darwin-arm64",
3-
"version": "2026.10425.10151",
3+
"version": "2026.10425.10602",
44
"description": "tnmsc native binary for macOS arm64",
55
"author": "TrueNine",
66
"license": "AGPL-3.0-only",

cli/npm/darwin-x64/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truenine/memory-sync-cli-darwin-x64",
3-
"version": "2026.10425.10151",
3+
"version": "2026.10425.10602",
44
"description": "tnmsc native binary for macOS x64",
55
"author": "TrueNine",
66
"license": "AGPL-3.0-only",

cli/npm/linux-arm64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truenine/memory-sync-cli-linux-arm64-gnu",
3-
"version": "2026.10425.10151",
3+
"version": "2026.10425.10602",
44
"description": "tnmsc native binary for Linux arm64 (glibc)",
55
"author": "TrueNine",
66
"license": "AGPL-3.0-only",

cli/npm/linux-x64-gnu/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truenine/memory-sync-cli-linux-x64-gnu",
3-
"version": "2026.10425.10151",
3+
"version": "2026.10425.10602",
44
"description": "tnmsc native binary for Linux x64 (glibc)",
55
"author": "TrueNine",
66
"license": "AGPL-3.0-only",

cli/npm/win32-x64-msvc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truenine/memory-sync-cli-win32-x64-msvc",
3-
"version": "2026.10425.10151",
3+
"version": "2026.10425.10602",
44
"description": "tnmsc native binary for Windows x64",
55
"author": "TrueNine",
66
"license": "AGPL-3.0-only",

cli/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@truenine/memory-sync-cli",
3-
"version": "2026.10425.10151",
3+
"version": "2026.10425.10602",
44
"description": "TrueNine Memory Synchronization CLI metadata package",
55
"author": "TrueNine",
66
"license": "AGPL-3.0-only",
@@ -34,10 +34,10 @@
3434
"test": "cargo test --manifest-path Cargo.toml"
3535
},
3636
"optionalDependencies": {
37-
"@truenine/memory-sync-cli-darwin-arm64": "2026.10425.10151",
38-
"@truenine/memory-sync-cli-darwin-x64": "2026.10425.10151",
39-
"@truenine/memory-sync-cli-linux-arm64-gnu": "2026.10425.10151",
40-
"@truenine/memory-sync-cli-linux-x64-gnu": "2026.10425.10151",
41-
"@truenine/memory-sync-cli-win32-x64-msvc": "2026.10425.10151"
37+
"@truenine/memory-sync-cli-darwin-arm64": "2026.10425.10602",
38+
"@truenine/memory-sync-cli-darwin-x64": "2026.10425.10602",
39+
"@truenine/memory-sync-cli-linux-arm64-gnu": "2026.10425.10602",
40+
"@truenine/memory-sync-cli-linux-x64-gnu": "2026.10425.10602",
41+
"@truenine/memory-sync-cli-win32-x64-msvc": "2026.10425.10602"
4242
}
4343
}

0 commit comments

Comments
 (0)