mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-29 13:05:18 +02:00
fix: use scalar Claude agent tools
This commit is contained in:
@@ -125,6 +125,23 @@ test('readFrontmatter parses array tools field', () => {
|
||||
cleanup(testRoot);
|
||||
});
|
||||
|
||||
test('readFrontmatter normalizes comma-separated scalar tools to an array', () => {
|
||||
const { readFrontmatter } = require(SCRIPT);
|
||||
testRoot = createTempDir('ecc-test-');
|
||||
writeFile(testRoot, 'agent.md', [
|
||||
'---',
|
||||
'name: test-agent',
|
||||
'tools: Bash, Read, Write',
|
||||
'---',
|
||||
'# Body',
|
||||
].join('\n'));
|
||||
|
||||
const fm = readFrontmatter(path.join(testRoot, 'agent.md'));
|
||||
assert.ok(Array.isArray(fm.tools));
|
||||
assert.deepStrictEqual(fm.tools, ['Bash', 'Read', 'Write']);
|
||||
cleanup(testRoot);
|
||||
});
|
||||
|
||||
test('readFrontmatter handles quoted values', () => {
|
||||
const { readFrontmatter } = require(SCRIPT);
|
||||
testRoot = createTempDir('ecc-test-');
|
||||
@@ -202,7 +219,7 @@ test('loadAgents loads agent markdown files', () => {
|
||||
'name: typescript-reviewer',
|
||||
'description: Reviews TypeScript code',
|
||||
'model: claude-sonnet-4-6',
|
||||
'tools: [Bash, Read, Write, Grep]',
|
||||
'tools: Bash, Read, Write, Grep',
|
||||
'---',
|
||||
'# TypeScript Reviewer',
|
||||
'You are a TypeScript code reviewer.',
|
||||
@@ -212,7 +229,7 @@ test('loadAgents loads agent markdown files', () => {
|
||||
'name: python-reviewer',
|
||||
'description: Reviews Python code',
|
||||
'model: claude-opus-4-8',
|
||||
'tools: [Bash, Read]',
|
||||
'tools: Bash, Read',
|
||||
'---',
|
||||
'# Python Reviewer',
|
||||
].join('\n'));
|
||||
|
||||
@@ -99,6 +99,36 @@ function runTests() {
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('adapts comma-separated scalar Claude Code tools', () => {
|
||||
const tempDir = createTempDir();
|
||||
const agentsDir = path.join(tempDir, '.gemini', 'agents');
|
||||
|
||||
try {
|
||||
writeAgent(
|
||||
agentsDir,
|
||||
'docs-lookup.md',
|
||||
[
|
||||
'---',
|
||||
'name: docs-lookup',
|
||||
'description: Documentation lookup agent',
|
||||
'tools: Read, Grep, mcp__context7__resolve-library-id, mcp__context7__query-docs',
|
||||
'model: sonnet',
|
||||
'---',
|
||||
'',
|
||||
'Body'
|
||||
].join('\n')
|
||||
);
|
||||
|
||||
const result = run([agentsDir]);
|
||||
assert.strictEqual(result.code, 0, result.stderr);
|
||||
|
||||
const updated = fs.readFileSync(path.join(agentsDir, 'docs-lookup.md'), 'utf8');
|
||||
assert.ok(updated.includes('tools: ["read_file", "grep_search", "mcp_context7_resolve_library_id", "mcp_context7_query_docs"]'));
|
||||
} finally {
|
||||
cleanupTempDir(tempDir);
|
||||
}
|
||||
})) passed++; else failed++;
|
||||
|
||||
if (test('defaults to the cwd .gemini/agents directory', () => {
|
||||
const tempDir = createTempDir();
|
||||
const agentsDir = path.join(tempDir, '.gemini', 'agents');
|
||||
|
||||
Reference in New Issue
Block a user