hunter-harness 0.2.16 → 0.2.17
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/README.md +3 -3
- package/dist/bin.js +113 -0
- package/package.json +1 -1
- package/LICENSE +0 -21
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
|
@@ -3003,6 +3003,111 @@ async function refreshProject(options) {
|
|
|
3003
3003
|
conflicts: sortByTarget(conflicts)
|
|
3004
3004
|
};
|
|
3005
3005
|
}
|
|
3006
|
+
function freshnessEntry(agent, profile, status, identity) {
|
|
3007
|
+
return { agent, profile, status, identity, driftedFiles: [], missingFiles: [] };
|
|
3008
|
+
}
|
|
3009
|
+
var BUILD_MARKER_BUNDLE_PATH = ".harness-build.json";
|
|
3010
|
+
function buildMarkerCoreHash(text) {
|
|
3011
|
+
if (text === null || text === "")
|
|
3012
|
+
return null;
|
|
3013
|
+
try {
|
|
3014
|
+
const parsed = JSON.parse(text);
|
|
3015
|
+
return typeof parsed.coreHash === "string" && parsed.coreHash.length > 0 ? parsed.coreHash : null;
|
|
3016
|
+
} catch {
|
|
3017
|
+
return null;
|
|
3018
|
+
}
|
|
3019
|
+
}
|
|
3020
|
+
async function collectFreshness(options) {
|
|
3021
|
+
const root = resolve4(options.projectRoot);
|
|
3022
|
+
const installed = await readInstalledState(root);
|
|
3023
|
+
const codebuddySurface2 = options.codebuddySurface ?? "both";
|
|
3024
|
+
const agents = [];
|
|
3025
|
+
for (const agent of sortHarnessAgents(options.agents)) {
|
|
3026
|
+
const installedProfile = installed.profiles.get(agent) ?? installed.profile;
|
|
3027
|
+
const requestedProfile = options.profile ?? installedProfile ?? "general";
|
|
3028
|
+
const installedManifest = installed.manifests.find((entry) => entry.adapter === agent);
|
|
3029
|
+
const identity = {
|
|
3030
|
+
adapter: agent,
|
|
3031
|
+
bundleVersion: null,
|
|
3032
|
+
installedBundleVersion: installedManifest?.bundle_version ?? null,
|
|
3033
|
+
manifestHash: null,
|
|
3034
|
+
installedManifestHash: installedManifest?.bundle_manifest_hash ?? null,
|
|
3035
|
+
coreHash: null,
|
|
3036
|
+
installedCoreHash: null,
|
|
3037
|
+
adapterHash: null,
|
|
3038
|
+
installedAdapterHash: null
|
|
3039
|
+
};
|
|
3040
|
+
let officialHash = null;
|
|
3041
|
+
let officialVersion = null;
|
|
3042
|
+
let bundle;
|
|
3043
|
+
try {
|
|
3044
|
+
bundle = await loadAgentBundle(options.resourcesRoot, requestedProfile, agent);
|
|
3045
|
+
officialHash = sha256Bytes(canonicalJson(bundle.manifest.files));
|
|
3046
|
+
officialVersion = bundle.manifest.bundle_version;
|
|
3047
|
+
identity.bundleVersion = officialVersion;
|
|
3048
|
+
identity.manifestHash = officialHash;
|
|
3049
|
+
const markerBytes = bundle.files.get(BUILD_MARKER_BUNDLE_PATH);
|
|
3050
|
+
identity.coreHash = markerBytes === void 0 ? null : buildMarkerCoreHash(new TextDecoder().decode(markerBytes));
|
|
3051
|
+
} catch {
|
|
3052
|
+
bundle = null;
|
|
3053
|
+
}
|
|
3054
|
+
if (installed.schemaVersion === null || !installed.adapters.includes(agent) || installedProfile === null || installedProfile === void 0 || installedManifest === void 0 || bundle === null) {
|
|
3055
|
+
agents.push(freshnessEntry(agent, installedProfile ?? null, "UNVERIFIABLE", identity));
|
|
3056
|
+
continue;
|
|
3057
|
+
}
|
|
3058
|
+
const targets = managedTargetsFor(getAdapter(agent), bundle, {
|
|
3059
|
+
profile: installedProfile,
|
|
3060
|
+
codebuddySurface: codebuddySurface2
|
|
3061
|
+
});
|
|
3062
|
+
identity.adapterHash = sha256Bytes(canonicalJson(targets.map((target) => ({ path: target.target_path.replace(/\\/g, "/"), sha256: target.sha256 })).sort((a, b) => a.path.localeCompare(b.path))));
|
|
3063
|
+
const installedProjection = await Promise.all(targets.map(async (target) => ({
|
|
3064
|
+
path: target.target_path.replace(/\\/g, "/"),
|
|
3065
|
+
sha256: await fileHex(join6(root, target.target_path))
|
|
3066
|
+
})));
|
|
3067
|
+
identity.installedAdapterHash = sha256Bytes(canonicalJson(installedProjection.sort((a, b) => a.path.localeCompare(b.path))));
|
|
3068
|
+
const markerTarget = targets.find((target) => target.target_path.replace(/\\/g, "/").endsWith(`/${BUILD_MARKER_BUNDLE_PATH}`) || target.target_path === BUILD_MARKER_BUNDLE_PATH);
|
|
3069
|
+
if (markerTarget !== void 0) {
|
|
3070
|
+
identity.installedCoreHash = buildMarkerCoreHash(await readOptionalText(join6(root, markerTarget.target_path)));
|
|
3071
|
+
}
|
|
3072
|
+
if (requestedProfile !== installedProfile) {
|
|
3073
|
+
agents.push(freshnessEntry(agent, installedProfile, "PROFILE_MISMATCH", identity));
|
|
3074
|
+
continue;
|
|
3075
|
+
}
|
|
3076
|
+
if (installedManifest.bundle_manifest_hash !== officialHash || installedManifest.bundle_version !== officialVersion) {
|
|
3077
|
+
agents.push(freshnessEntry(agent, installedProfile, "VERSION_BEHIND", identity));
|
|
3078
|
+
continue;
|
|
3079
|
+
}
|
|
3080
|
+
const drifted = [];
|
|
3081
|
+
const missing = [];
|
|
3082
|
+
for (const target of targets) {
|
|
3083
|
+
const current = await fileHex(join6(root, target.target_path));
|
|
3084
|
+
if (current === null) {
|
|
3085
|
+
missing.push(target.target_path);
|
|
3086
|
+
} else if (current !== target.sha256) {
|
|
3087
|
+
drifted.push(target.target_path);
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
if (missing.length > 0) {
|
|
3091
|
+
const entry = freshnessEntry(agent, installedProfile, "MISSING", identity);
|
|
3092
|
+
entry.missingFiles = missing.sort();
|
|
3093
|
+
entry.driftedFiles = drifted.sort();
|
|
3094
|
+
agents.push(entry);
|
|
3095
|
+
continue;
|
|
3096
|
+
}
|
|
3097
|
+
if (drifted.length > 0) {
|
|
3098
|
+
const entry = freshnessEntry(agent, installedProfile, "LOCALLY_MODIFIED", identity);
|
|
3099
|
+
entry.driftedFiles = drifted.sort();
|
|
3100
|
+
agents.push(entry);
|
|
3101
|
+
continue;
|
|
3102
|
+
}
|
|
3103
|
+
agents.push(freshnessEntry(agent, installedProfile, "CURRENT", identity));
|
|
3104
|
+
}
|
|
3105
|
+
return {
|
|
3106
|
+
schema_version: 1,
|
|
3107
|
+
generated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3108
|
+
agents
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3006
3111
|
|
|
3007
3112
|
// ../core/dist/proposal/diff.js
|
|
3008
3113
|
function operationPath(operation) {
|
|
@@ -5554,6 +5659,14 @@ async function runRefresh(options, dependencies) {
|
|
|
5554
5659
|
forceManaged: options.forceManaged === true
|
|
5555
5660
|
});
|
|
5556
5661
|
const output = summarize(result);
|
|
5662
|
+
const freshness = await collectFreshness({
|
|
5663
|
+
projectRoot: dependencies.cwd,
|
|
5664
|
+
resourcesRoot: dependencies.resourcesRoot,
|
|
5665
|
+
...targetProfile === void 0 ? {} : { profile: targetProfile },
|
|
5666
|
+
agents: targetAgents,
|
|
5667
|
+
codebuddySurface: codebuddySurface(detection.config, options.codebuddySurface)
|
|
5668
|
+
});
|
|
5669
|
+
output.freshness = freshness.agents;
|
|
5557
5670
|
if (options.json === true) {
|
|
5558
5671
|
dependencies.stdout(serializeCliResult({ ...output, request_id: requestId }));
|
|
5559
5672
|
} else {
|
package/package.json
CHANGED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.
|