mirror of
https://github.com/HKUDS/CLI-Anything.git
synced 2026-08-28 23:27:04 +08:00
fix: classify harness docs as documentation (#349)
This commit is contained in:
@@ -52,10 +52,15 @@ function isDocumentationFile(path) {
|
||||
/^README(?:_[A-Z]+)?\.md$/.test(path) ||
|
||||
/^(CONTRIBUTING|SECURITY)\.md$/.test(path) ||
|
||||
/^docs\//.test(path) ||
|
||||
/^[^/]+\/agent-harness\/.*\.md$/i.test(path) ||
|
||||
/^[^/]+\.md$/i.test(path)
|
||||
);
|
||||
}
|
||||
|
||||
function isHarnessImplementationFile(path) {
|
||||
return isHarnessFile(path) && !isDocumentationFile(path);
|
||||
}
|
||||
|
||||
function titleLooksLikeRegistryCli(title) {
|
||||
return /\b(add|introduce|new)\b/i.test(title) && /\b(cli|harness|registry)\b/i.test(title);
|
||||
}
|
||||
@@ -64,7 +69,7 @@ function computeScriptLabels(files, title) {
|
||||
const paths = files.map((file) => file.filename);
|
||||
const labelsToApply = new Set();
|
||||
|
||||
const hasHarnessChange = paths.some(isHarnessFile);
|
||||
const hasHarnessImplementationChange = paths.some(isHarnessImplementationFile);
|
||||
const hasNewHarness = files.some(isNewHarnessManifest);
|
||||
const registryOnly = paths.length > 0 && paths.every((path) => REGISTRY_FILES.has(path));
|
||||
const registryNewCli = registryOnly && titleLooksLikeRegistryCli(title || "");
|
||||
@@ -72,7 +77,7 @@ function computeScriptLabels(files, title) {
|
||||
|
||||
if (hasNewHarness || registryNewCli) {
|
||||
labelsToApply.add("new-cli");
|
||||
} else if (hasHarnessChange) {
|
||||
} else if (hasHarnessImplementationChange) {
|
||||
labelsToApply.add("existing-cli-fix");
|
||||
}
|
||||
|
||||
|
||||
@@ -197,3 +197,12 @@ test("mixed README and harness changes are not documentation-only", () => {
|
||||
|
||||
assert.deepStrictEqual(labels, ["existing-cli-fix"]);
|
||||
});
|
||||
|
||||
test("harness README-only changes are documentation", () => {
|
||||
const labels = computeAllLabels({
|
||||
title: "docs(firefly-iii): clarify setup notes",
|
||||
files: [{filename: "firefly-iii/agent-harness/README.md", status: "modified"}],
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(labels, ["documentation"]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user