ai-dev-harness 0.1.2 → 0.1.3

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/dist/agent.js CHANGED
@@ -2,6 +2,13 @@ import { appendFile, readFile, writeFile } from "node:fs/promises";
2
2
  import { git, runCommand, truncate } from "./utils.js";
3
3
  function renderPrompt(input, contextPack) {
4
4
  return `你正在一个可审计的 AI 研发 Harness 中执行任务。请把它当作公司级研发任务,而不是随意聊天。
5
+ 输出格式是硬性契约:最终回答必须包含下面 5 个英文顶级二级标题,且标题文本必须完全一致。不要只用三级标题替代,不要省略任何一项。
6
+
7
+ ## Impact Analysis
8
+ ## Plan
9
+ ## Execution Notes
10
+ ## Verification Notes
11
+ ## Final Report
5
12
 
6
13
  当前循环轮次:
7
14
  ${input.iteration ?? 1}
package/dist/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
2
3
  import { copyFile, readFile, writeFile } from "node:fs/promises";
3
4
  import path from "node:path";
4
5
  import { AuditLogger, prepareRunFiles, writeJson } from "./audit.js";
@@ -21,6 +22,36 @@ import { writeSummary } from "./summarize.js";
21
22
  import { runVerify } from "./verify.js";
22
23
  import { ensureDir, git, pathExists } from "./utils.js";
23
24
  const booleanArgs = new Set(["dry", "json", "live", "no-integration"]);
25
+ const require = createRequire(import.meta.url);
26
+ const packageVersion = String(require("../package.json").version);
27
+ function normalizeRel(file) {
28
+ return file.replace(/\\/g, "/").replace(/^\.\//, "");
29
+ }
30
+ function statusFiles(status) {
31
+ return new Set(status
32
+ .split(/\r?\n/)
33
+ .map((line) => line.trim())
34
+ .filter(Boolean)
35
+ .map((line) => {
36
+ const rename = line.match(/^R.?\s+(.+)\s+->\s+(.+)$/);
37
+ if (rename)
38
+ return normalizeRel(rename[2]);
39
+ return normalizeRel(line.slice(3).trim());
40
+ })
41
+ .filter(Boolean));
42
+ }
43
+ function underRoot(file, root) {
44
+ const normalized = normalizeRel(file);
45
+ const normalizedRoot = normalizeRel(root).replace(/\/?$/, "/");
46
+ return normalized === normalizedRoot.slice(0, -1) || normalized.startsWith(normalizedRoot);
47
+ }
48
+ function excludeBaselineChangedFiles(changedFiles, baselineStatus, excludedRoots = []) {
49
+ const baselineFiles = statusFiles(baselineStatus);
50
+ return changedFiles.filter((file) => {
51
+ const normalized = normalizeRel(file);
52
+ return !baselineFiles.has(normalized) && !excludedRoots.some((root) => underRoot(normalized, root));
53
+ });
54
+ }
24
55
  function parseArgs(argv) {
25
56
  const [command = "help", ...rest] = argv;
26
57
  const args = { _: [] };
@@ -47,6 +78,7 @@ function usage() {
47
78
  用法:
48
79
  harness init
49
80
  harness init --no-integration
81
+ harness --version
50
82
  harness doctor
51
83
  harness smoke --agent <codex|claude|cursor|gemini> [--live]
52
84
  harness run --task <text> --skill <name> --agent <codex|claude|cursor|gemini>
@@ -70,7 +102,7 @@ async function commandSmoke(cwd, args) {
70
102
  const agentName = requireAgent(requireString(args, "agent"));
71
103
  const live = Boolean(args.live);
72
104
  await commandRun(cwd, {
73
- task: "Smoke test only. Analyze repository context and do not modify repository files.",
105
+ task: "Smoke test only. Analyze repository context and do not modify repository files. You must output these exact top-level headings in this order: ## Impact Analysis, ## Plan, ## Execution Notes, ## Verification Notes, ## Final Report.",
74
106
  skill: "update_docs",
75
107
  agent: agentName,
76
108
  live
@@ -263,6 +295,7 @@ Agent 必须:
263
295
  iteration,
264
296
  previousFeedback
265
297
  });
298
+ agentResult.changedFiles = excludeBaselineChangedFiles(agentResult.changedFiles, checkpoint.gitStatusBefore, checkpoint.excludedStatusRoots);
266
299
  await audit.event({
267
300
  stage: "execute",
268
301
  event: "agent_finished",
@@ -474,6 +507,10 @@ async function commandSummarize(cwd, args) {
474
507
  async function main() {
475
508
  const cwd = process.cwd();
476
509
  const { command, args } = parseArgs(process.argv.slice(2));
510
+ if (command === "--version" || command === "-v" || command === "version") {
511
+ console.log(packageVersion);
512
+ return;
513
+ }
477
514
  if (command === "help" || command === "--help" || command === "-h") {
478
515
  console.log(usage());
479
516
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-dev-harness",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Auditable AI development harness for Codex, Claude Code, Cursor Agent, and Gemini CLI.",
5
5
  "license": "MIT",
6
6
  "keywords": [