hunter-harness 0.2.17 → 0.2.19

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hunter Zheng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -21,8 +21,8 @@ npx hunter-harness update
21
21
  | Claude Code | `.claude/skills/` | `.claude/rules/*.md` | `.claude/agents/` |
22
22
  | Codex | `.agents/skills/` | `AGENTS.md` | 不生成 |
23
23
  | Cursor | `.cursor/skills/` | `.cursor/rules/*.mdc` | 不生成 |
24
- | CodeBuddy `both` | `.codebuddy/skills/` | `CODEBUDDY.md` + `.codebuddy/.rules/*.mdc` + `.codebuddy/rules/*.md` | `.codebuddy/agents/` |
24
+ | CodeBuddy `both` | `.codebuddy/skills/` | `CODEBUDDY.md` + `.codebuddy/.rules/*.mdc` + `.codebuddy/rules/*.md` | `.codebuddy/agents/` |
25
25
 
26
- 需要 Node.js 22.12 或更高版本。选择 CodeBuddy 时,可将已有 `.claude/rules` 非破坏性同步到 CodeBuddy,并在检测到 `.codegraph/` 时合并项目级 `.mcp.json`;疑似凭据内容会跳过。token 只通过 `--token-env` 指定的环境变量读取,不要写入项目文件或命令参数。
26
+ 需要 Node.js 22.12 或更高版本。选择 CodeBuddy 时,可将已有 `.claude/rules` 非破坏性同步到 CodeBuddy,并在检测到 `.codegraph/` 时合并项目级 `.mcp.json`;疑似凭据内容会跳过。token 只通过 `--token-env` 指定的环境变量读取,不要写入项目文件或命令参数。
27
27
 
28
- 本包使用 MIT License。
28
+ 本包使用 MIT License。
package/dist/bin.js CHANGED
@@ -1929,6 +1929,11 @@ function validateRelativeBundlePath(path) {
1929
1929
  throw new Error("invalid Harness Bundle path");
1930
1930
  }
1931
1931
  }
1932
+ function validateChangeId(changeId) {
1933
+ if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(changeId) || changeId === "." || changeId === "..") {
1934
+ throw new Error(`invalid Harness change id: ${changeId}`);
1935
+ }
1936
+ }
1932
1937
  function ruleTarget(sourcePath, targetPath, content) {
1933
1938
  return {
1934
1939
  source_path: sourcePath,
@@ -1981,6 +1986,15 @@ function makeAdapter(spec) {
1981
1986
  agentsRoot: spec.agentsRoot,
1982
1987
  commandsRoot: spec.commandsRoot,
1983
1988
  supportsExecutableHooks: false,
1989
+ worktreeFor(changeId) {
1990
+ validateChangeId(changeId);
1991
+ return {
1992
+ root: spec.worktreeRoot,
1993
+ path: `${spec.worktreeRoot}/${changeId}`,
1994
+ branchPrefix: spec.branchPrefix,
1995
+ branch: `${spec.branchPrefix}${changeId}`
1996
+ };
1997
+ },
1984
1998
  projectInstructionTargets() {
1985
1999
  return ["AGENTS.md", ...spec.extraInstructionFiles];
1986
2000
  },
@@ -2032,6 +2046,8 @@ var ADAPTERS = {
2032
2046
  agentsRoot: ".claude/agents",
2033
2047
  commandsRoot: null,
2034
2048
  instructions: "CLAUDE.md",
2049
+ worktreeRoot: ".claude/worktrees",
2050
+ branchPrefix: "claude/",
2035
2051
  extraInstructionFiles: ["CLAUDE.md"],
2036
2052
  ruleExt: ".md"
2037
2053
  }),
@@ -2042,6 +2058,8 @@ var ADAPTERS = {
2042
2058
  agentsRoot: null,
2043
2059
  commandsRoot: null,
2044
2060
  instructions: "AGENTS.md",
2061
+ worktreeRoot: ".codex/worktrees",
2062
+ branchPrefix: "codex/",
2045
2063
  extraInstructionFiles: [],
2046
2064
  ruleExt: null
2047
2065
  }),
@@ -2052,6 +2070,8 @@ var ADAPTERS = {
2052
2070
  agentsRoot: null,
2053
2071
  commandsRoot: ".cursor/commands",
2054
2072
  instructions: "AGENTS.md",
2073
+ worktreeRoot: ".cursor/worktrees",
2074
+ branchPrefix: "cursor/",
2055
2075
  extraInstructionFiles: [],
2056
2076
  ruleExt: ".mdc"
2057
2077
  }),
@@ -2062,6 +2082,8 @@ var ADAPTERS = {
2062
2082
  agentsRoot: ".codebuddy/agents",
2063
2083
  commandsRoot: ".codebuddy/commands",
2064
2084
  instructions: "CODEBUDDY.md",
2085
+ worktreeRoot: ".codebuddy/worktrees",
2086
+ branchPrefix: "codebuddy/",
2065
2087
  extraInstructionFiles: ["CODEBUDDY.md"],
2066
2088
  ruleExt: null
2067
2089
  })
@@ -2693,6 +2715,18 @@ function sortByTarget(items) {
2693
2715
  }
2694
2716
  async function reconcileContextIndex(root, agents, profiles, manifests, codebuddySurface2) {
2695
2717
  const existing = await readOptionalText(join6(root, CONTEXT_INDEX_PATH));
2718
+ let codebase = {
2719
+ map: ".harness/codebase/map",
2720
+ status: "missing"
2721
+ };
2722
+ try {
2723
+ const parsed = JSON.parse(existing);
2724
+ const current = parsed.codebase;
2725
+ if (typeof current?.map === "string" && (current.status === "missing" || current.status === "stale" || current.status === "fresh")) {
2726
+ codebase = { map: current.map, status: current.status };
2727
+ }
2728
+ } catch {
2729
+ }
2696
2730
  const record = {
2697
2731
  schema_version: 2,
2698
2732
  project: {
@@ -2706,7 +2740,7 @@ async function reconcileContextIndex(root, agents, profiles, manifests, codebudd
2706
2740
  ]))
2707
2741
  },
2708
2742
  knowledge: { index: ".harness/knowledge/index.json" },
2709
- codebase: { map: ".harness/codebase/map", status: "missing" },
2743
+ codebase,
2710
2744
  skill_bundles: Object.fromEntries(manifests.map((manifest) => [
2711
2745
  manifest.adapter,
2712
2746
  { registry_version: manifest.bundle_version, bundle_hash: manifest.bundle_manifest_hash }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hunter-harness",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "Local-first, server-governed agent harness",
5
5
  "license": "MIT",
6
6
  "type": "module",