mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-13 16:13:03 +08:00
fix: tune machine learning workflow routing
This commit is contained in:
committed by
Affaan Mustafa
parent
240d52d27f
commit
ab6e998383
@@ -22,6 +22,14 @@ function parseJson(stdout) {
|
||||
return JSON.parse(stdout.trim());
|
||||
}
|
||||
|
||||
function findMatch(payload, componentId) {
|
||||
return payload.matches.find(match => match.componentId === componentId);
|
||||
}
|
||||
|
||||
function findMatchIndex(payload, componentId) {
|
||||
return payload.matches.findIndex(match => match.componentId === componentId);
|
||||
}
|
||||
|
||||
function test(name, fn) {
|
||||
try {
|
||||
fn();
|
||||
@@ -88,9 +96,13 @@ function runTests() {
|
||||
|
||||
assert.strictEqual(result.status, 0, result.stderr);
|
||||
const payload = parseJson(result.stdout);
|
||||
assert.strictEqual(payload.matches[0].componentId, 'capability:machine-learning');
|
||||
assert.ok(payload.matches[0].installCommand.includes('--with capability:machine-learning'));
|
||||
assert.ok(payload.matches.some(match => match.componentId === 'agent:mle-reviewer'));
|
||||
const capabilityIndex = findMatchIndex(payload, 'capability:machine-learning');
|
||||
const reviewerIndex = findMatchIndex(payload, 'agent:mle-reviewer');
|
||||
assert.ok(capabilityIndex >= 0, 'Should include capability:machine-learning');
|
||||
assert.ok(reviewerIndex >= 0, 'Should include agent:mle-reviewer');
|
||||
assert.ok(capabilityIndex < reviewerIndex,
|
||||
'The workflow capability should rank ahead of the reviewer agent for broad MLE setup queries');
|
||||
assert.ok(findMatch(payload, 'capability:machine-learning').installCommand.includes('--with capability:machine-learning'));
|
||||
assert.ok(!payload.profiles.some(profile => profile.id === 'mle'));
|
||||
})) passed++; else failed++;
|
||||
|
||||
@@ -99,10 +111,41 @@ function runTests() {
|
||||
|
||||
assert.strictEqual(result.status, 0, result.stderr);
|
||||
const payload = parseJson(result.stdout);
|
||||
const reviewer = payload.matches.find(match => match.componentId === 'agent:mle-reviewer');
|
||||
const capabilityIndex = findMatchIndex(payload, 'capability:machine-learning');
|
||||
const securityIndex = findMatchIndex(payload, 'capability:security');
|
||||
const reviewerIndex = findMatchIndex(payload, 'agent:mle-reviewer');
|
||||
const codeReviewerIndex = findMatchIndex(payload, 'agent:code-reviewer');
|
||||
const reviewer = findMatch(payload, 'agent:mle-reviewer');
|
||||
assert.ok(reviewer, 'Should include agent:mle-reviewer');
|
||||
assert.ok(reviewer.reasons.includes('matched "model"'));
|
||||
assert.ok(!reviewer.reasons.includes('matched "review"'));
|
||||
assert.ok(!reviewer.reasons.includes('fuzzy matched "review"'));
|
||||
assert.ok(capabilityIndex >= 0, 'Should include capability:machine-learning');
|
||||
assert.ok(securityIndex < 0 || capabilityIndex < securityIndex,
|
||||
'Model review queries should prefer the MLE capability over generic security review');
|
||||
assert.ok(codeReviewerIndex < 0 || reviewerIndex < codeReviewerIndex,
|
||||
'Model review queries should prefer the MLE reviewer over generic code review');
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('surfaces MLE reviewer for PyTorch model review queries', () => {
|
||||
const result = run(['pytorch', 'model', 'review', '--json']);
|
||||
|
||||
assert.strictEqual(result.status, 0, result.stderr);
|
||||
const payload = parseJson(result.stdout);
|
||||
const reviewer = findMatch(payload, 'agent:mle-reviewer');
|
||||
assert.ok(findMatch(payload, 'capability:machine-learning'), 'Should include capability:machine-learning');
|
||||
assert.ok(reviewer, 'Should include agent:mle-reviewer');
|
||||
assert.ok(reviewer.reasons.includes('matched "pytorch"'));
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('does not route generic review queries to MLE components', () => {
|
||||
const result = run(['review', '--json']);
|
||||
|
||||
assert.strictEqual(result.status, 0, result.stderr);
|
||||
const payload = parseJson(result.stdout);
|
||||
assert.ok(!findMatch(payload, 'capability:machine-learning'));
|
||||
assert.ok(!findMatch(payload, 'agent:mle-reviewer'));
|
||||
assert.ok(!payload.profiles.some(profile => profile.id === 'mle'));
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('works from outside the ECC repository', () => {
|
||||
|
||||
Reference in New Issue
Block a user