codemap_macro_list

List all shell macros with their commands and configurations.

macroshelllist

Usage Examples

MCP Usage (for AI Agents like Claude)

json
{
  "name": "codemap_macro_list"
}

Example Output

JSON Response

json
{
  "success": true,
  "data": {
    "macros": [
      {
        "name": "build",
        "description": "Build the project",
        "cmd": "npm run build",
        "shell": "cmd",
        "cwd": null
      },
      {
        "name": "test",
        "description": "Run all tests",
        "cmd": "npm test",
        "shell": "bash",
        "cwd": null
      },
      {
        "name": "deploy",
        "description": "Deploy to production",
        "cmd": "npm run deploy",
        "shell": "bash",
        "cwd": null
      }
    ],
    "formatted": "Macros (3):\\n\\n## build\\nBuild the project\\n\\n**Command:** `npm run build`\\n**Shell:** cmd\\n\\n---\\n\\n## test\\nRun all tests\\n\\n**Command:** `npm test`\\n**Shell:** bash\\n\\n---\\n\\n## deploy\\nDeploy to production\\n\\n**Command:** `npm run deploy`\\n**Shell:** bash\\n\\n---\\n"
  }
}
â„šī¸When to Use This Tool
    Use codemap_macro_list to view and manage your macro collection:
  • Discover available macros - See what shortcuts are configured
  • Before creating macros - Check if a macro name is already taken
  • Macro audits - Review all configured macros for cleanup
  • Team onboarding - Show new team members available development shortcuts
  • Documentation - Export macro list for team documentation
  • Validation - Ensure required macros are configured
  • Debugging - Verify macro configurations when troubleshooting
💡Common Patterns
Check Before Creating
// Avoid duplicate names
const macros = await codemap.macros.list();
const exists = macros.some(m => m.name === 'build');

if (!exists) {
await codemap.macros.create({
name: 'build',
cmd: 'npm run build'
});
}


Find Macro by Name
// Get specific macro details
const macros = await codemap.macros.list();
const buildMacro = macros.find(m => m.name === 'build');

if (buildMacro) {
console.log(Build command: ${buildMacro.cmd});
}


Filter by Pattern
// Find all test-related macros
const macros = await codemap.macros.list();
const testMacros = macros.filter(m =>
m.name.startsWith('test-') || m.name === 'test'
);

console.log(Found ${testMacros.length} test macros);


Export Configuration
// Save macro definitions
const macros = await codemap.macros.list();
const config = JSON.stringify({ macros }, null, 2);
await fs.writeFile('macros.json', config);
💡Pro Tips
List before operations - Always list macros before creating, deleting, or running to see what's available.

Use for discovery - New team members should run this first to see available development shortcuts.

Regular audits - Periodically list and review macros to remove obsolete ones.

Document in README - Export macro list to team README so everyone knows available shortcuts.

Validate setup - In CI or setup scripts, list macros and verify required ones exist.

Check configurations - Use list to verify shell types, working directories, and environment variables are correct.
✅Best Practices
Keep list organized - Use consistent naming conventions so the list is easy to scan (e.g., 'test-unit', 'test-integration', 'test-e2e').

Document purpose - Use descriptive macro descriptions so the list serves as documentation.

Review regularly - Make macro review part of quarterly codebase cleanup.

Export for onboarding - Include macro list in onboarding documentation.

Validate after changes - After creating or deleting macros, list them to confirm changes.

Use for debugging - If a macro isn't working, list to verify its configuration.
âš ī¸Common Mistakes
❌ Mistake: Creating without checking if name exists
// Will fail if 'build' already exists
await codemap.macros.create({
name: 'build',
cmd: 'npm run build'
});

✅ Instead: Check first
const macros = await codemap.macros.list();
if (!macros.some(m => m.name === 'build')) {
await codemap.macros.create({
name: 'build',
cmd: 'npm run build'
});
}


---

❌ Mistake: Not validating required macros
// Assumes 'deploy' macro exists
await codemap.macros.run('deploy');
// Error if macro doesn't exist

✅ Instead: Validate first
const macros = await codemap.macros.list();
if (macros.some(m => m.name === 'deploy')) {
await codemap.macros.run('deploy');
} else {
console.error('Deploy macro not configured');
}


---

❌ Mistake: Searching by exact match only
const macros = await codemap.macros.list();
const testMacro = macros.find(m => m.name === 'test');
// Misses 'test-unit', 'test-integration', etc.

✅ Instead: Use pattern matching
const testMacros = macros.filter(m => 
m.name.includes('test')
);


---

❌ Mistake: Not handling empty lists
const macros = await codemap.macros.list();
const firstMacro = macros[0].name; // Error if no macros!

✅ Instead: Check length
const macros = await codemap.macros.list();
if (macros.length > 0) {
const firstMacro = macros[0].name;
} else {
console.log('No macros configured');
}


---

❌ Mistake: Assuming specific macros exist
// Hard-codes assumption about available macros
await codemap.macros.run('build');
await codemap.macros.run('test');
await codemap.macros.run('deploy');

✅ Instead: Validate availability
const macros = await codemap.macros.list();
const required = ['build', 'test', 'deploy'];

for (const name of required) {
if (macros.some(m => m.name === name)) {
await codemap.macros.run(name);
} else {
console.warn(Skipping ${name} - macro not found);
}
}