niceeval 0.5.0 → 0.5.1

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.
@@ -82,9 +82,9 @@ niceeval show fixtures/button --diff # sandbox 里的文件改动
82
82
 
83
83
  榜单、单个 eval 与各证据切面的输出长什么样、历史与抖动怎么看(`--history`)、多次 run 的合成口径,都在[查看结果](/zh/guides/viewing-results);要项目自己的口径(考试成绩单、代码行数榜),写一个打到 stdout 的报告脚本,见[自定义报告](/zh/guides/custom-reports)——给 agent 的指引只多一行:跑 `npx tsx scripts/report.ts`,读 stdout。
84
84
 
85
- ## AGENTS.md 指引区块
85
+ ## AGENTS.md / CLAUDE.md 指引区块
86
86
 
87
- 模型的训练数据里没有 NiceEval。`npx niceeval init` 会在项目的 `AGENTS.md` 里写入一个托管区块,告诉 agent 先读随包文档再动手:
87
+ 模型的训练数据里没有 NiceEval。`npx niceeval init` 会写入一个托管区块,告诉 agent 先读随包文档再动手:项目已有 `AGENTS.md` 就写那份;只有 `CLAUDE.md`(没有 `AGENTS.md`)就直接写进 `CLAUDE.md`,不另建重复文件;两者都没有则新建 `AGENTS.md`。`CLAUDE.md` 是指向 `AGENTS.md` 的符号链接时,写入自动落到链接目标,不会分裂成两份内容。
88
88
 
89
89
  ```md
90
90
  <!-- BEGIN:niceeval-agent-rules -->
@@ -100,7 +100,7 @@ artifact files it references are the structured source of truth.
100
100
  <!-- END:niceeval-agent-rules -->
101
101
  ```
102
102
 
103
- 标记之外的内容不会被改动;升级 NiceEval 后重跑 `npx niceeval init` 会刷新标记之内的指引。npm 包只随包发布中文文档(`node_modules/niceeval/docs-site/zh/`)——中文是唯一始终与代码同步的准绳版本,agent 读中文没有障碍,读到的永远是和安装版本一致的行为,而不是训练数据里的旧记忆。
103
+ 标记之外的内容不会被改动;升级 NiceEval 后重跑 `npx niceeval init` 会刷新标记之内的指引,且每次都会重新按上述规则判断该写哪份文件。npm 包只随包发布中文文档(`node_modules/niceeval/docs-site/zh/`)——中文是唯一始终与代码同步的准绳版本,agent 读中文没有障碍,读到的永远是和安装版本一致的行为,而不是训练数据里的旧记忆。
104
104
 
105
105
  ## 报错自带修法
106
106
 
@@ -13,7 +13,7 @@ description: "NiceEval CLI 参考:exp、init、list、clean 和 view 命令,
13
13
  运行命名实验组或配置。可选尾随位置参数按 eval ID 前缀过滤。
14
14
  </Card>
15
15
  <Card title="npx niceeval init" icon="wand-magic-sparkles">
16
- 创建空的 `evals/` 目录和最小的 `niceeval.config.ts`;不生成示例 eval 文件。同时在 `AGENTS.md` 写入/刷新 niceeval 指引区块(见[Agent 反馈闭环](/zh/guides/agent-feedback-loop))。
16
+ 创建空的 `evals/` 目录和最小的 `niceeval.config.ts`;不生成示例 eval 文件。同时写入/刷新 niceeval 指引区块——项目已有 `AGENTS.md` 就写那份,只有 `CLAUDE.md` 就写进 `CLAUDE.md`,都没有则新建 `AGENTS.md`(见[Agent 反馈闭环](/zh/guides/agent-feedback-loop))。
17
17
  </Card>
18
18
  <Card title="npx niceeval list" icon="list">
19
19
  发现并打印所有 eval,不运行。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "niceeval",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Agent-native eval tool — eval agents, services, functions, and coding-agent fixtures",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/cli.ts CHANGED
@@ -239,7 +239,7 @@ async function loadConfig(cwd: string): Promise<Config> {
239
239
  return mod.default;
240
240
  }
241
241
 
242
- // AGENTS.md 托管区块:告诉在这个项目里干活的 coding agent「niceeval 不在你的训练数据里,
242
+ // AGENTS.md/CLAUDE.md 托管区块:告诉在这个项目里干活的 coding agent「niceeval 不在你的训练数据里,
243
243
  // 先读随包文档,跑完读结构化结果」。随包只发中文准绳版文档(英文站是手工同步、可能滞后,
244
244
  // 不进包,见 package.json 的 files);init 时写入/刷新;标记之外的用户内容永不触碰。
245
245
  const AGENT_RULES_BEGIN = "<!-- BEGIN:niceeval-agent-rules -->";
@@ -256,6 +256,18 @@ const AGENT_RULES_CONTENT = [
256
256
  "artifact files it references are the structured source of truth.",
257
257
  ].join("\n");
258
258
 
259
+ // 优先复用已有的 AGENTS.md;项目只有 CLAUDE.md(没有 AGENTS.md)时改写 CLAUDE.md 本身,
260
+ // 不再另建一份重复文件;两者都没有则新建 AGENTS.md。CLAUDE.md 是指向 AGENTS.md 的符号链接时,
261
+ // existsSync 会 follow 链接——目标存在则直接算作「AGENTS.md 已存在」,写入的还是同一份内容,
262
+ // 不会产生分裂;目标不存在(悬空链接)则落回新建 AGENTS.md,写入后链接自然生效。
263
+ function resolveAgentDocPath(cwd: string): string {
264
+ const agentsPath = join(cwd, "AGENTS.md");
265
+ if (existsSync(agentsPath)) return agentsPath;
266
+ const claudePath = join(cwd, "CLAUDE.md");
267
+ if (existsSync(claudePath)) return claudePath;
268
+ return agentsPath;
269
+ }
270
+
259
271
  async function initProject(cwd: string): Promise<void> {
260
272
  await mkdir(join(cwd, "evals"), { recursive: true });
261
273
  const configPath = join(cwd, "niceeval.config.ts");
@@ -273,10 +285,10 @@ async function initProject(cwd: string): Promise<void> {
273
285
  "utf-8",
274
286
  );
275
287
  }
276
- const agentsPath = join(cwd, "AGENTS.md");
277
- const existing = existsSync(agentsPath) ? await readFile(agentsPath, "utf-8") : "";
288
+ const agentDocPath = resolveAgentDocPath(cwd);
289
+ const existing = existsSync(agentDocPath) ? await readFile(agentDocPath, "utf-8") : "";
278
290
  const next = upsertManagedBlock(existing, AGENT_RULES_BEGIN, AGENT_RULES_END, AGENT_RULES_CONTENT);
279
- if (next !== existing) await writeFile(agentsPath, next, "utf-8");
291
+ if (next !== existing) await writeFile(agentDocPath, next, "utf-8");
280
292
  }
281
293
 
282
294
  async function openBrowser(url: string): Promise<boolean> {