fix: verify and correct Augment tool mappings based on auggie CLI

This commit is contained in:
Victor Carvalho Tavernari
2026-04-01 22:16:20 +01:00
parent 5a43437bc0
commit 7e71fac76f

View File

@@ -1112,60 +1112,44 @@ function convertClaudeAgentToWindsurfAgent(content) {
// Augment (auggie CLI) uses a tool set similar to Cursor/Windsurf (VS Code-based). // Augment (auggie CLI) uses a tool set similar to Cursor/Windsurf (VS Code-based).
// Config lives in .augment/ (local) and ~/.augment/ (global). // Config lives in .augment/ (local) and ~/.augment/ (global).
// Tool name mapping from Claude Code to Augment
const claudeToAugmentTools = { const claudeToAugmentTools = {
Bash: 'launch-process', Bash: 'launch-process',
Edit: 'str-replace-editor', Edit: 'str-replace-editor',
AskUserQuestion: null, // No direct equivalent — use conversational prompting AskUserQuestion: null,
SlashCommand: null, // No equivalent — skills are auto-discovered SlashCommand: null,
TodoWrite: 'add_tasks',
}; };
/**
* Convert a Claude Code tool name to Augment format
* @returns {string|null} Augment tool name, or null if tool should be excluded
*/
function convertAugmentToolName(claudeTool) { function convertAugmentToolName(claudeTool) {
if (claudeTool in claudeToAugmentTools) { if (claudeTool in claudeToAugmentTools) {
return claudeToAugmentTools[claudeTool]; return claudeToAugmentTools[claudeTool];
} }
// MCP tools keep their format (Augment supports MCP)
if (claudeTool.startsWith('mcp__')) { if (claudeTool.startsWith('mcp__')) {
return claudeTool; return claudeTool;
} }
// Most tools share similar names
// Read → view (file viewing)
// Write → save-file
// Grep → codebase-retrieval
// Glob → view (directory listing)
// Task → use subagent spawning
// WebSearch → web-search
// WebFetch → web-fetch
// TodoWrite → write-todos
const toolMapping = { const toolMapping = {
Read: 'view', Read: 'view',
Write: 'save-file', Write: 'save-file',
Glob: 'view', Glob: 'view',
Grep: 'codebase-retrieval', Grep: 'grep',
Task: null, // Use subagent spawning instead Task: null,
WebSearch: 'web-search', WebSearch: 'web-search',
WebFetch: 'web-fetch', WebFetch: 'web-fetch',
TodoWrite: 'write-todos',
}; };
return toolMapping[claudeTool] || claudeTool; return toolMapping[claudeTool] || claudeTool;
} }
function convertSlashCommandsToAugmentSkillMentions(content) { function convertSlashCommandsToAugmentSkillMentions(content) {
// Keep leading "/" for slash commands; only normalize gsd: -> gsd-.
return content.replace(/gsd:/gi, 'gsd-'); return content.replace(/gsd:/gi, 'gsd-');
} }
function convertClaudeToAugmentMarkdown(content) { function convertClaudeToAugmentMarkdown(content) {
let converted = convertSlashCommandsToAugmentSkillMentions(content); let converted = convertSlashCommandsToAugmentSkillMentions(content);
// Replace tool name references in body text
converted = converted.replace(/\bBash\(/g, 'launch-process('); converted = converted.replace(/\bBash\(/g, 'launch-process(');
converted = converted.replace(/\bEdit\(/g, 'str-replace-editor('); converted = converted.replace(/\bEdit\(/g, 'str-replace-editor(');
converted = converted.replace(/\bRead\(/g, 'view('); converted = converted.replace(/\bRead\(/g, 'view(');
converted = converted.replace(/\bWrite\(/g, 'save-file('); converted = converted.replace(/\bWrite\(/g, 'save-file(');
converted = converted.replace(/\bTodoWrite\(/g, 'add_tasks(');
converted = converted.replace(/\bAskUserQuestion\b/g, 'conversational prompting'); converted = converted.replace(/\bAskUserQuestion\b/g, 'conversational prompting');
// Replace subagent_type from Claude to Augment format // Replace subagent_type from Claude to Augment format
converted = converted.replace(/subagent_type="general-purpose"/g, 'subagent_type="generalPurpose"'); converted = converted.replace(/subagent_type="general-purpose"/g, 'subagent_type="generalPurpose"');
@@ -1203,9 +1187,9 @@ Use these Augment tools when executing GSD workflows:
- \`str-replace-editor\` for editing existing files - \`str-replace-editor\` for editing existing files
- \`view\` for reading files and listing directories - \`view\` for reading files and listing directories
- \`save-file\` for creating new files - \`save-file\` for creating new files
- \`codebase-retrieval\` for searching code - \`grep\` for searching code (or use MCP servers for advanced search)
- \`web-search\`, \`web-fetch\` for web queries - \`web-search\`, \`web-fetch\` for web queries
- \`write-todos\` for task management - \`add_tasks\`, \`view_tasklist\`, \`update_tasks\` for task management
## D. Subagent Spawning ## D. Subagent Spawning
When the workflow needs to spawn a subagent: When the workflow needs to spawn a subagent: