codemap_macro_list
List all shell macros with their commands and configurations.
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
- 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
codemap_macro_list to view and manage your macro collection:
Common Patterns
Check Before Creating
Find Macro by Name
Filter by Pattern
Export Configuration
// 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.
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.
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
â Instead: Check first
---
â Mistake: Not validating required macros
â Instead: Validate first
---
â Mistake: Searching by exact match only
â Instead: Use pattern matching
---
â Mistake: Not handling empty lists
â Instead: Check length
---
â Mistake: Assuming specific macros exist
â Instead: Validate availability
// 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);
}
}