hunter-harness 0.2.15 → 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 +147 -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
|
@@ -1566,6 +1566,9 @@ function classifyFile(input) {
|
|
|
1566
1566
|
if (under(path, ".harness/knowledge/")) {
|
|
1567
1567
|
return USER_DIFF;
|
|
1568
1568
|
}
|
|
1569
|
+
if (/^\.harness\/archive\/[^/]+\/reports\/final\/summary-data\.json$/u.test(path)) {
|
|
1570
|
+
return GENERATED_REVIEWABLE;
|
|
1571
|
+
}
|
|
1569
1572
|
if (under(path, ".harness/codebase/map/") || path === ".harness/codebase/map-summary.md" || path === ".harness/codebase/map-manifest.json") {
|
|
1570
1573
|
return GENERATED_REVIEWABLE;
|
|
1571
1574
|
}
|
|
@@ -3000,6 +3003,111 @@ async function refreshProject(options) {
|
|
|
3000
3003
|
conflicts: sortByTarget(conflicts)
|
|
3001
3004
|
};
|
|
3002
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
|
+
}
|
|
3003
3111
|
|
|
3004
3112
|
// ../core/dist/proposal/diff.js
|
|
3005
3113
|
function operationPath(operation) {
|
|
@@ -4196,6 +4304,7 @@ var SHARED_MANAGED_FILES = [
|
|
|
4196
4304
|
".harness/project.yaml",
|
|
4197
4305
|
".harness/context-index.json"
|
|
4198
4306
|
];
|
|
4307
|
+
var ARCHIVE_SUMMARY_PATH = /^\.harness\/archive\/[^/]+\/reports\/final\/summary-data\.json$/u;
|
|
4199
4308
|
async function exists3(path) {
|
|
4200
4309
|
try {
|
|
4201
4310
|
await lstat3(path);
|
|
@@ -4223,6 +4332,35 @@ async function walkFiles(root, current, output) {
|
|
|
4223
4332
|
}
|
|
4224
4333
|
}
|
|
4225
4334
|
}
|
|
4335
|
+
async function walkArchiveSummaries(root, output) {
|
|
4336
|
+
const archiveRoot = join11(root, ".harness", "archive");
|
|
4337
|
+
if (!await exists3(archiveRoot))
|
|
4338
|
+
return;
|
|
4339
|
+
for (const item2 of await readdir4(archiveRoot, { withFileTypes: true })) {
|
|
4340
|
+
if (item2.isSymbolicLink()) {
|
|
4341
|
+
throw new PushWorkflowError("symlink is not pushable", 6, "UNSAFE_SYMLINK");
|
|
4342
|
+
}
|
|
4343
|
+
if (!item2.isDirectory())
|
|
4344
|
+
continue;
|
|
4345
|
+
const summaryPath = join11(archiveRoot, item2.name, "reports", "final", "summary-data.json");
|
|
4346
|
+
try {
|
|
4347
|
+
const stats = await lstat3(summaryPath);
|
|
4348
|
+
if (stats.isSymbolicLink()) {
|
|
4349
|
+
throw new PushWorkflowError("symlink is not pushable", 6, "UNSAFE_SYMLINK");
|
|
4350
|
+
}
|
|
4351
|
+
if (!stats.isFile())
|
|
4352
|
+
continue;
|
|
4353
|
+
} catch (error) {
|
|
4354
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
4355
|
+
continue;
|
|
4356
|
+
throw error;
|
|
4357
|
+
}
|
|
4358
|
+
const relativePath = normalizeManagedPath(relative(root, summaryPath).replaceAll("\\", "/"));
|
|
4359
|
+
if (ARCHIVE_SUMMARY_PATH.test(relativePath)) {
|
|
4360
|
+
output.push(relativePath);
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4226
4364
|
function enabledHarnessAgents(project) {
|
|
4227
4365
|
return project.adapters.enabled.flatMap((agent) => {
|
|
4228
4366
|
const parsed = harnessAgentSchema.safeParse(agent);
|
|
@@ -4260,6 +4398,7 @@ async function managedFiles(projectRoot, project) {
|
|
|
4260
4398
|
for (const path of SHARED_MANAGED_ROOTS) {
|
|
4261
4399
|
await walkFiles(root, join11(root, path), paths);
|
|
4262
4400
|
}
|
|
4401
|
+
await walkArchiveSummaries(root, paths);
|
|
4263
4402
|
for (const adapter of adapters) {
|
|
4264
4403
|
if (adapter.rulesRoot !== null) {
|
|
4265
4404
|
await walkFiles(root, join11(root, adapter.rulesRoot), paths);
|
|
@@ -5520,6 +5659,14 @@ async function runRefresh(options, dependencies) {
|
|
|
5520
5659
|
forceManaged: options.forceManaged === true
|
|
5521
5660
|
});
|
|
5522
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;
|
|
5523
5670
|
if (options.json === true) {
|
|
5524
5671
|
dependencies.stdout(serializeCliResult({ ...output, request_id: requestId }));
|
|
5525
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.
|