Skip to content

Commit fd145bd

Browse files
committed
fix: 4 Kiro compatibility issues found by codex/opencode debate
1. Invalid file:// URI in agent resources - removed file:// prefix, use relative glob '.kiro/steering/**/*.md' (RFC 3986 compliant) 2. Kiro detection too strict - now checks for .kiro/ existence alone, not just .kiro/steering|skills|agents subdirs (fresh workspaces) 3. Silent tool stripping - added task/agent, web/fetch, notebook, lsp to Kiro tool mapping (were silently dropped from agent JSON) 4. Fix also in combined reviewer agent resources (same file:// issue)
1 parent a4303e2 commit fd145bd

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

__tests__/cli-args.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ describe('installForKiro', () => {
569569
expect(parsed.description).toBe('A test agent');
570570
expect(parsed.prompt).toContain('Agent instructions here');
571571
expect(parsed.tools).toEqual(expect.arrayContaining(['read', 'write', 'shell']));
572-
expect(parsed.resources).toEqual(['file://.kiro/steering/**/*.md']);
572+
expect(parsed.resources).toEqual(['.kiro/steering/**/*.md']);
573573
});
574574

575575
test('cleans up old steering files on reinstall', () => {

__tests__/gen-adapters.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ describe('Kiro transforms', () => {
698698
const input = '---\nname: test\n---\nPrompt';
699699
const result = transforms.transformAgentForKiro(input);
700700
const parsed = JSON.parse(result);
701-
expect(parsed.resources).toEqual(['file://.kiro/steering/**/*.md']);
701+
expect(parsed.resources).toEqual(['.kiro/steering/**/*.md']);
702702
});
703703

704704
test('replaces PLUGIN_ROOT in body', () => {
@@ -743,7 +743,7 @@ describe('Kiro transforms', () => {
743743
expect(parsed.prompt).toContain('Error handling, naming');
744744
expect(parsed.prompt).toContain('Injection, auth');
745745
expect(parsed.tools).toEqual(['read']);
746-
expect(parsed.resources).toEqual(['file://.kiro/steering/**/*.md']);
746+
expect(parsed.resources).toEqual(['.kiro/steering/**/*.md']);
747747
});
748748

749749
test('includes JSON output instruction', () => {

bin/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,9 @@ function detectInstalledPlatforms() {
949949
// Cursor rules are project-scoped; detect only if Cursor rules/commands/skills exist in CWD
950950
const cursorDir = path.join(process.cwd(), '.cursor');
951951
if (fs.existsSync(path.join(cursorDir, 'rules')) || fs.existsSync(path.join(cursorDir, 'commands')) || fs.existsSync(path.join(cursorDir, 'skills'))) platforms.push('cursor');
952-
// Kiro is project-scoped; detect if .kiro/ directory exists in CWD
952+
// Kiro is project-scoped; detect .kiro/ directory in CWD (any content, including fresh workspaces)
953953
const kiroDir = path.join(process.cwd(), '.kiro');
954-
if (fs.existsSync(path.join(kiroDir, 'steering')) || fs.existsSync(path.join(kiroDir, 'skills')) || fs.existsSync(path.join(kiroDir, 'agents'))) platforms.push('kiro');
954+
if (fs.existsSync(kiroDir)) platforms.push('kiro');
955955
return platforms;
956956
}
957957

lib/adapter-transforms.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,17 @@ function transformAgentForKiro(content, options) {
612612
if (toolStr.includes('bash') || toolStr.includes('shell')) tools.push('shell');
613613
if (toolStr.includes('glob')) tools.push('read');
614614
if (toolStr.includes('grep')) tools.push('read');
615+
if (toolStr.includes('task') || toolStr.includes('agent')) tools.push('shell');
616+
if (toolStr.includes('web') || toolStr.includes('fetch')) tools.push('shell');
617+
if (toolStr.includes('notebook')) tools.push('write');
618+
if (toolStr.includes('lsp')) tools.push('read');
615619
const deduped = [...new Set(tools)];
616620
agent.tools = deduped.length > 0 ? deduped : ['read'];
617621
} else {
618622
agent.tools = ['read'];
619623
}
620624

621-
agent.resources = ['file://.kiro/steering/**/*.md'];
625+
agent.resources = ['.kiro/steering/**/*.md'];
622626

623627
return JSON.stringify(agent, null, 2);
624628
}
@@ -642,7 +646,7 @@ function generateCombinedReviewerAgent(roles, name, description) {
642646
description,
643647
prompt: `You are a combined code reviewer covering multiple review passes in a single session.\n\n${sections}\n\nFor each file you review, check ALL of the above review dimensions. Return findings as a JSON array with objects containing: pass (which review), file, line, severity (critical/high/medium/low), description, suggestion.`,
644648
tools: ['read'],
645-
resources: ['file://.kiro/steering/**/*.md'],
649+
resources: ['.kiro/steering/**/*.md'],
646650
};
647651

648652
return JSON.stringify(agent, null, 2);

0 commit comments

Comments
 (0)