mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-15 13:23:13 +08:00
fix: tune machine learning workflow routing
This commit is contained in:
committed by
Affaan Mustafa
parent
240d52d27f
commit
ab6e998383
@@ -301,6 +301,43 @@ function runTests() {
|
||||
)), 'Should install the MLE workflow skill');
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('resolves machine-learning component on JoyCode and Qwen targets', () => {
|
||||
for (const target of ['joycode', 'qwen']) {
|
||||
const plan = resolveInstallPlan({
|
||||
includeComponentIds: ['capability:machine-learning'],
|
||||
target,
|
||||
projectRoot: '/workspace/ml-app',
|
||||
homeDir: '/Users/example',
|
||||
});
|
||||
|
||||
assert.ok(plan.selectedModuleIds.includes('machine-learning'),
|
||||
`Should include machine-learning module for ${target}`);
|
||||
assert.ok(!plan.skippedModuleIds.includes('machine-learning'),
|
||||
`Should not skip machine-learning module for ${target}`);
|
||||
assert.ok(plan.operations.some(operation => (
|
||||
operation.sourceRelativePath === 'skills/mle-workflow'
|
||||
)), `Should install the MLE workflow skill for ${target}`);
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('minimal machine-learning install includes MLE reviewer agent surface', () => {
|
||||
const plan = resolveInstallPlan({
|
||||
profileId: 'minimal',
|
||||
includeComponentIds: ['capability:machine-learning'],
|
||||
target: 'claude',
|
||||
projectRoot: '/workspace/ml-app',
|
||||
});
|
||||
|
||||
assert.ok(plan.selectedModuleIds.includes('agents-core'),
|
||||
'Minimal install should keep the agent surface available');
|
||||
assert.ok(plan.operations.some(operation => (
|
||||
operation.sourceRelativePath === 'agents'
|
||||
)), 'Should install the agent directory that contains mle-reviewer.md');
|
||||
assert.ok(plan.operations.some(operation => (
|
||||
operation.sourceRelativePath === 'skills/mle-workflow'
|
||||
)), 'Should install the MLE workflow skill');
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('resolves explicit modules with dependency expansion', () => {
|
||||
const plan = resolveInstallPlan({ moduleIds: ['security'] });
|
||||
assert.ok(plan.selectedModuleIds.includes('security'), 'Should include requested module');
|
||||
|
||||
@@ -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