asl-parser
v1.0.2
Published
A CLI tool to parse and analyze codebases, generating agent specifications in agents.md
Downloads
319
Maintainers
Readme
ASL Parser
A powerful CLI tool to parse and analyze codebases, generating comprehensive agent specifications in agents.md.
Installation
Global Installation (Recommended)
npm install -g asl-parserUse the asl command from anywhere:
asl parse ./Local Installation
npm install asl-parserUse via npx:
npx asl parse ./Quick Start
Parse Command
Parse the current directory:
asl parseOr specify a custom path:
asl parse ./my-projectOptions:
| Option | Description | Default |
|--------|-------------|---------|
| -o, --output <file> | Output file name | agents.md |
Example with custom output:
asl parse ./ -o my-agents.mdPrompt Command
Analyze a prompt to identify impacted files, functions, and lines. Results print to terminal only—no file created.
asl prompt "Add authentication to the login function"With custom path:
asl prompt "Update the API endpoint handler" ./my-projectRAG Search Search codebase using natural language:
asl rag "your search query"Examples: bash
asl rag "database connection" -p ./src
asl rag "error handling" -k 20Options:
-p, --path – Codebase path (default: .)
-k, --topk – Number of results (default: 10)Returns: Relevant code sections with line numbers and relevance scores.
What It Does:
- Extracts keywords, function names, file paths, and tech terms from your prompt
- Scans the codebase for relevant files, functions, and classes
- Prints a focused impact report to the terminal
Output Includes:
- Files affected and relevance scores
- Functions/classes impacted
- Specific line numbers (e.g., L42, L87)
- File metadata (extension, line count)
Benefits:
- Save tokens by analyzing only relevant code sections
- Quickly identify what needs to be changed
- See impacted functions and classes at a glance
- Get specific line numbers for pinpoint edits
Output
The parse command generates an agents.md file containing:
- Summary Statistics – Total files, lines of code, and file sizes
- Files by Extension – Breakdown of file types in your codebase
- File Analysis – Detailed breakdown for each file:
- File paths and sizes
- Code vs. comment line counts
- Detected classes and functions
- Agent Specifications – Structured JSON data ready for AI agents
Features
✨ Multi-Language Support – JavaScript, TypeScript, Python, Java, C++, Go, Rust, and more
🔍 Smart Detection – Automatically detects functions and classes in code files
📊 Comprehensive Docs – Generates markdown documentation and structured JSON output
⚡ Impact Analysis – Prompt-based impact analysis to identify affected files and lines without full codebase scans
🚀 Auto-Ignored Directories – Skips common directories like node_modules, .git, dist, and more
🔍 RAG Search – Natural language code search without API keys
Supported Languages
| Language | Extensions |
|----------|-----------|
| JavaScript/TypeScript | .js, .jsx, .ts, .tsx |
| Python | .py |
| Java | .java |
| C/C++ | .c, .cpp, .h |
| Go | .go |
| Rust | .rs |
| Ruby | .rb |
| PHP | .php |
| Swift | .swift |
| Kotlin | .kt |
| And more... | — |
Ignored Directories
The following directories are automatically skipped during analysis:
node_modules,vendor.git,.vscode,.idea.next,.nuxtdist,build,target.cache,coverage__pycache__,bin,obj
Example
asl rag "how does rag works"
>>
🔍 RAG Search: "how does rag works"
📚 Indexing codebase...
✅ Indexed 114 code sections
✅ Found 10 relevant sections:
📍 Query: "how does rag works"
1. 📄 lib\commands\rag-command.js
Lines 181-200 | Relevance: 30%
process.exit(1);
... }
2. 📄 lib\rag\minimal-rag.js
Lines 1-20 | Relevance: 22%
// src/rag/minimal-rag.js
...Drop-in RAG module for asl-parser
3. 📄 lib\commands\rag-command.js
Lines 1-20 | Relevance: 15%
// lib/rag-command.js
...Simple RAG search command for asl-parser
4. 📄 lib\commands\rag-command.js
Lines 166-185 | Relevance: 15%
console.log(chalk.white(` ${snippet}...`));
console.log...
5. 📄 lib\commands\rag-command.js
Lines 16-35 | Relevance: 14%
...st CODE_EXTENSIONS = [
6. 📄 lib\commands\rag-command.js
Lines 196-204 | Relevance: 11%
rag.displayResults(results, query);
...
7. 📄 lib\rag\minimal-rag.js
Lines 76-95 | Relevance: 7%
}
...
8. 📄 lib\promptAnalyzer.js
Lines 31-50 | Relevance: 4%
});
...
9. 📄 lib\promptAnalyzer.js
Lines 91-110 | Relevance: 4%
if (filePath.includes(term) || fileName.includes(term)) {
s...
10. 📄 lib\promptAnalyzer.js
Lines 106-125 | Relevance: 4%
/**
...Score how relevant a function/class is to the prompt 