mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-26 18:35:05 +00:00
fix(catalog): reject unmarked agent-tree skill undercounts
This commit is contained in:
2 files changed
+40
-2
No files matched your search
@@ -294,7 +294,7 @@ function parseAgentsDocExpectations(agentsContent) {
|
||||
|
||||
expectations.push({
|
||||
category: pattern.category,
|
||||
mode: pattern.mode === 'minimum' && match[2] ? 'minimum' : pattern.mode,
|
||||
mode: pattern.mode === 'minimum' ? (match[2] ? 'minimum' : 'exact') : pattern.mode,
|
||||
expected: Number(match[1]),
|
||||
source: `${pattern.source} (${pattern.category})`
|
||||
});
|
||||
@@ -373,7 +373,7 @@ function parseZhAgentsDocExpectations(agentsContent) {
|
||||
|
||||
expectations.push({
|
||||
category: pattern.category,
|
||||
mode: pattern.mode === 'minimum' && match[2] ? 'minimum' : pattern.mode,
|
||||
mode: pattern.mode === 'minimum' ? (match[2] ? 'minimum' : 'exact') : pattern.mode,
|
||||
expected: Number(match[1]),
|
||||
source: `${pattern.source} (${pattern.category})`
|
||||
});
|
||||
|
||||
@@ -225,6 +225,44 @@ function runTests() {
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('rejects unmarked skill undercounts in English and Chinese agent trees', () => {
|
||||
const testDir = createTestDir();
|
||||
try {
|
||||
writeCatalogFixture(testDir, { actualCounts: { agents: 1, skills: 2, commands: 1 } });
|
||||
for (const relativePath of ['AGENTS.md', 'docs/zh-CN/AGENTS.md']) {
|
||||
const filePath = path.join(testDir, relativePath);
|
||||
fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace('skills/ - 2 ', 'skills/ - 1 '));
|
||||
}
|
||||
const result = runCatalogCheck({ root: testDir });
|
||||
for (const source of ['AGENTS.md project structure (skills)', 'docs/zh-CN/AGENTS.md project structure (skills)']) {
|
||||
const check = result.checks.find(entry => entry.source === source);
|
||||
assert.ok(check, `Missing check for ${source}`);
|
||||
assert.strictEqual(check.ok, false, `${source} must reject an exact undercount`);
|
||||
}
|
||||
} finally {
|
||||
cleanupTestDir(testDir);
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('accepts explicitly marked lower-bound skill counts in agent trees', () => {
|
||||
const testDir = createTestDir();
|
||||
try {
|
||||
writeCatalogFixture(testDir, { actualCounts: { agents: 1, skills: 2, commands: 1 } });
|
||||
for (const relativePath of ['AGENTS.md', 'docs/zh-CN/AGENTS.md']) {
|
||||
const filePath = path.join(testDir, relativePath);
|
||||
fs.writeFileSync(filePath, fs.readFileSync(filePath, 'utf8').replace('skills/ - 2 ', 'skills/ - 1+ '));
|
||||
}
|
||||
const result = runCatalogCheck({ root: testDir });
|
||||
for (const source of ['AGENTS.md project structure (skills)', 'docs/zh-CN/AGENTS.md project structure (skills)']) {
|
||||
const check = result.checks.find(entry => entry.source === source);
|
||||
assert.ok(check, `Missing check for ${source}`);
|
||||
assert.strictEqual(check.ok, true, `${source} must preserve explicit lower-bound semantics`);
|
||||
}
|
||||
} finally {
|
||||
cleanupTestDir(testDir);
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('reports mismatches from every tracked catalog document', () => {
|
||||
const testDir = createTestDir();
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user