ast-index
This skill should be used when the user asks to "find a class", "search for symbol", "find usages", "find implementations", "search codebase", "find file", "class hierarchy", "find callers", "module dependencies", "unused dependencies", "project map", "project conventions", "project structure", "what frameworks", "what architecture", "find Perl subs", "Perl exports", "find Python class", "Go struct", "Go interface", "find React component", "find TypeScript interface", "find Rust struct", "find Ruby class", "find C# controller", "find Dart class", "find Flutter widget", "find mixin", "find Scala trait", "find case class", "find object", "find PHP class", "find Laravel model", "find PHP trait", or needs fast code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, or Protocol Buffers projects. Also triggered by mentions of "ast-index" CLI tool.
Packaged view
This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.
Install command
npx @skill-hub/cli install defendend-ast-index
Repository
Skill path: plugin/skills/ast-index
This skill should be used when the user asks to "find a class", "search for symbol", "find usages", "find implementations", "search codebase", "find file", "class hierarchy", "find callers", "module dependencies", "unused dependencies", "project map", "project conventions", "project structure", "what frameworks", "what architecture", "find Perl subs", "Perl exports", "find Python class", "Go struct", "Go interface", "find React component", "find TypeScript interface", "find Rust struct", "find Ruby class", "find C# controller", "find Dart class", "find Flutter widget", "find mixin", "find Scala trait", "find case class", "find object", "find PHP class", "find Laravel model", "find PHP trait", or needs fast code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, or Protocol Buffers projects. Also triggered by mentions of "ast-index" CLI tool.
Open repositoryBest for
Primary workflow: Build Mobile.
Technical facets: Full Stack, Frontend, Mobile.
Target audience: everyone.
License: Unknown.
Original source
Catalog source: SkillHub Club.
Repository owner: defendend.
This is still a mirrored public skill entry. Review the repository before installing into production workflows.
What it helps with
- Install ast-index into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
- Review https://github.com/defendend/Claude-ast-index-search before adding ast-index to shared team environments
- Use ast-index for development workflows
Works across
Favorites: 0.
Sub-skills: 0.
Aggregator: No.
Original source / Raw SKILL.md
---
name: ast-index
description: This skill should be used when the user asks to "find a class", "search for symbol", "find usages", "find implementations", "search codebase", "find file", "class hierarchy", "find callers", "module dependencies", "unused dependencies", "project map", "project conventions", "project structure", "what frameworks", "what architecture", "find Perl subs", "Perl exports", "find Python class", "Go struct", "Go interface", "find React component", "find TypeScript interface", "find Rust struct", "find Ruby class", "find C# controller", "find Dart class", "find Flutter widget", "find mixin", "find Scala trait", "find case class", "find object", "find PHP class", "find Laravel model", "find PHP trait", or needs fast code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, or Protocol Buffers projects. Also triggered by mentions of "ast-index" CLI tool.
---
# ast-index - Code Search for Multi-Platform Projects
Fast native Rust CLI for structural code search in Android/Kotlin/Java, iOS/Swift/ObjC, Dart/Flutter, TypeScript/JavaScript, Rust, Ruby, C#, Scala, PHP, Perl, Python, Go, C++, and Proto projects using SQLite + FTS5 index.
## Critical Rules
**ALWAYS use ast-index FIRST for any code search task.** These rules are mandatory:
1. **ast-index is the PRIMARY search tool** — use it before grep, ripgrep, or Search tool
2. **DO NOT duplicate results** — if ast-index found usages/implementations, that IS the complete answer
3. **DO NOT run grep "for completeness"** after ast-index returns results
4. **Use grep/Search ONLY when:**
- ast-index returns empty results
- Searching for regex patterns (ast-index uses literal match)
- Searching for string literals inside code (`"some text"`)
- Searching in comments content
**Why:** ast-index is 17-69x faster than grep (1-10ms vs 200ms-3s) and returns structured, accurate results.
## Prerequisites
Install the CLI before use:
```bash
brew tap defendend/ast-index
brew install ast-index
```
Initialize index in project root:
```bash
cd /path/to/project
ast-index rebuild
```
The index is stored at `~/Library/Caches/ast-index/<project-hash>/index.db` (macOS) or `~/.cache/ast-index/<project-hash>/index.db` (Linux). Rebuild deletes the DB file entirely and creates a fresh index.
## Supported Projects
| Platform | Languages | Module System |
|----------|-----------|---------------|
| Android/Java | Kotlin, Java | Gradle (build.gradle.kts), Maven (pom.xml) |
| iOS | Swift, Objective-C | SPM (Package.swift) |
| Web | TypeScript, JavaScript, React, Vue, Svelte | package.json |
| Rust | Rust | Cargo.toml |
| Ruby | Ruby, Rails, RSpec | Gemfile |
| .NET | C#, ASP.NET, Unity | *.csproj |
| Dart/Flutter | Dart | pubspec.yaml |
| Scala | Scala | Bazel (WORKSPACE, BUILD) |
| PHP | PHP | composer.json |
| Perl | Perl | Makefile.PL, Build.PL |
| Python | Python | None (*.py files) |
| Go | Go | None (*.go files) |
| Proto | Protocol Buffers (proto2/proto3) | None (*.proto files) |
| WSDL | WSDL, XSD | None (*.wsdl, *.xsd files) |
| C/C++ | C, C++ (JNI, uservices) | None (*.cpp, *.h, *.hpp files) |
| Mixed | All above | All |
Project type is auto-detected by marker files (build.gradle.kts, Package.swift, Makefile.PL, etc.). Python, Go, Proto, WSDL, and C++ files are indexed alongside main project type.
## JSON Output
Most commands support `--format json` for structured output:
```bash
ast-index search "Query" --format json
ast-index symbol "Name" --format json
ast-index class "Name" --format json
ast-index usages "Symbol" --format json
ast-index implementations "Parent" --format json
ast-index refs "Symbol" --format json
ast-index stats --format json
ast-index unused-symbols --format json
ast-index map --format json
ast-index conventions --format json
```
## Core Commands
### Universal Search
**`search`** - Perform universal search across files, symbols, and modules simultaneously.
```bash
ast-index search "Payment" # Finds files, classes, functions matching "Payment"
ast-index search "ViewModel" # Returns files, symbols, modules in ranked order
ast-index search "Store" --fuzzy # Fuzzy: exact → prefix → contains matching
ast-index search "Handler" --module "core/" # Search within a module
ast-index search "UserService" # Find Java/Spring services
ast-index search "@RestController" # Find Spring REST controllers (annotation search)
ast-index search "@GetMapping" # Find GET endpoint mappings
```
### File Search
**`file`** - Find files by name pattern.
```bash
ast-index file "Fragment.kt" # Find files ending with Fragment.kt
ast-index file "ViewController" # Find iOS view controllers
```
### Symbol Search
**`symbol`** - Find symbols (classes, interfaces, functions, properties) by name.
```bash
ast-index symbol "PaymentInteractor" # Find exact symbol
ast-index symbol "Presenter" # Find all presenters
ast-index symbol "Store" --fuzzy # Fuzzy: exact → prefix → contains matching
ast-index symbol "Mapper" --in-file "payments/" --limit 10 # Scoped search
ast-index symbol "@Service" # Find all @Service annotations
```
### Class Search
**`class`** - Find class, interface, or protocol definitions.
```bash
ast-index class "BaseFragment" # Find Android base fragment
ast-index class "UIViewController" # Find iOS view controller subclass
ast-index class "Store" --fuzzy # Find all classes containing "Store"
ast-index class "Repository" --module "features/payments" # Filter by module
ast-index class "UserController" # Find Java/Spring controller class
```
### Usage Search
**`usages`** - Find all places where a symbol is used. Critical for refactoring.
```bash
ast-index usages "PaymentRepository" # Find all usages of repository
ast-index usages "onClick" # Find all click handler usages
ast-index usages "fetchData" --in-file "src/api/" # Scoped to file path
ast-index usages "Repository" --module "features/auth" --limit 100
```
Performance: ~8ms for indexed symbols.
### Cross-References
**`refs`** - Show cross-references for a symbol: definitions, imports, and usages in one view.
```bash
ast-index refs "PaymentRepository" # Definitions + imports + usages
ast-index refs "BaseFragment" --limit 10 # Limit results per section
```
### Implementation Search
**`implementations`** - Find all classes that extend or implement a given class/interface/protocol. Supports partial name matching with relevance ranking (exact → suffix → contains).
```bash
ast-index implementations "BasePresenter" # Find all presenter implementations
ast-index implementations "Repository" # Find repository implementations (exact match)
ast-index implementations "Service" # Partial: finds UserService, PaymentService impls too
ast-index implementations "ViewModel" --module "features/" # Scoped to module
```
### Class Hierarchy
**`hierarchy`** - Display complete class hierarchy tree.
```bash
ast-index hierarchy "BaseFragment" # Show fragment inheritance tree
```
### Caller Search
**`callers`** - Find all places that call a specific function.
```bash
ast-index callers "onClick" # Find all onClick calls
ast-index callers "fetchUser" # Find API call sites
```
### Call Tree
**`call-tree`** - Show complete call hierarchy going UP (who calls the callers). Supports Kotlin, Java, Swift, Perl, ObjC.
```bash
ast-index call-tree "processPayment" --depth 3 --limit 10
ast-index call-tree "getUsers" # Java: finds callers of getUsers() method
```
### File Analysis
**`imports`** - List all imports in a specific file.
```bash
ast-index imports "path/to/File.kt" # Show Kotlin file imports
```
**`outline`** - Show all symbols defined in a file. Uses tree-sitter for accurate parsing of all supported languages.
```bash
ast-index outline "PaymentFragment.kt" # Show Kotlin fragment structure
ast-index outline "UserController.java" # Show Java controller methods
ast-index outline "App.tsx" # Show TypeScript/React components and functions
ast-index outline "handler.rs" # Show Rust structs, impls, functions
```
### Code Quality
**`todo`** - Find TODO/FIXME/HACK comments in code.
```bash
ast-index todo # Find all TODO comments
ast-index todo --limit 10 # Limit results
```
**`deprecated`** - Find @Deprecated annotations.
```bash
ast-index deprecated # Find deprecated items
```
**`unused-symbols`** - Find potentially unused exported symbols.
```bash
ast-index unused-symbols --module path/to/module # In specific module
ast-index unused-symbols --export-only # Only exported (public) symbols
```
### Git/Arc Integration
**`changed`** - Show symbols changed in git/arc diff. Auto-detects VCS and base branch.
```bash
ast-index changed # Auto: trunk (arc) or origin/main (git)
ast-index changed --base main # Explicit base branch
ast-index changed --base trunk # For arc projects
```
### Public API
**`api`** - Show public API of a module. Accepts module path or module name (dots converted to slashes).
```bash
ast-index api "path/to/module" # By path
ast-index api "module.name" # By module name (dots → slashes)
```
## Project Insights
### Project Map
**`map`** - Show compact project overview: top directories by size with symbol kind counts. Use `--module` to drill down into a specific area with full class/inheritance details.
```bash
ast-index map # Summary: top 50 dirs with kind counts (~54 lines)
ast-index map --limit 20 # Show only top 20 directories
ast-index map --module features/payments # Detailed: classes with inheritance for a module
ast-index map --module src/core --per-dir 10 # More symbols per directory in detailed mode
ast-index map --format json # JSON output
```
Summary mode output (default, no `--module`):
```
Project: Android (Kotlin/Java) | 29144 files | 859 modules | top 50 of 728 dirs
features/taxi_order/impl/ 1626 files | 371 iface, 94 obj, 1834 cls
features/masstransit/impl/ 862 files | 165 obj, 1261 cls, 280 iface
```
Detailed mode output (with `--module`):
```
features/payments/impl/ (250 files)
PaymentInteractor : class > BaseInteractor
PaymentRepository : interface
PaymentMapper : class
```
### Project Conventions
**`conventions`** - Auto-detect architecture patterns, frameworks, and naming conventions from the indexed codebase. Runs read-only SQL queries — no file scanning needed.
```bash
ast-index conventions # Text output (~30 lines)
ast-index conventions --format json # JSON output
```
Detects:
- **Architecture**: Clean Architecture, Feature-sliced, BLoC, MVC, MVVM, MVP, Redux, Composition API, Hooks
- **Frameworks**: DI (Hilt, Dagger, Koin), Async (Coroutines, RxJava, Combine), Network (Retrofit, OkHttp), DB (Room, Realm), UI (Compose, SwiftUI, React, Flutter), Testing (JUnit, Kotest, XCTest, pytest, Jest)
- **Naming patterns**: ViewModel, Repository, UseCase, Service, Controller, Fragment, etc. (with counts)
## Common Flags
Most search commands (`search`, `symbol`, `class`, `usages`, `implementations`) support:
| Flag | Description |
|------|-------------|
| `--fuzzy` | Fuzzy search: exact match → prefix match → contains match |
| `--in-file <PATH>` | Filter results by file path (substring match) |
| `--module <PATH>` | Filter results by module path (substring match) |
| `--limit <N>` | Max results to return |
| `--format json` | JSON output for structured processing |
**When to use `--fuzzy`:** When you don't know the exact name. `ast-index class "Store" --fuzzy` finds `Store`, `StoreImpl`, `AppStore`, `DataStoreRepository`, etc. The `--fuzzy` flag performs three-stage matching: exact match first, then prefix match, then contains match.
## Index Management
```bash
ast-index rebuild # Full rebuild with dependencies
ast-index rebuild --no-deps # Skip module dependency indexing
ast-index rebuild --no-ignore # Include gitignored files (build/, etc.)
ast-index rebuild --sub-projects # Index each sub-project separately (large monorepos)
ast-index rebuild -j 32 # Use 32 threads (for network/FUSE filesystems)
ast-index rebuild -v # Verbose logging with timing per step
ast-index update # Incremental update (changed files only)
ast-index stats # Show index statistics
ast-index clear # Delete index for current project
ast-index restore /path/to/index.db # Restore index from a .db file
ast-index watch # Watch for file changes and auto-update index
```
### Directory-Scoped Search
When running search from a subdirectory, results are automatically limited to that subtree (the index DB in cache is used to detect the project root):
```bash
cd /project/root
ast-index rebuild # Index entire project, creates .ast-index-root
ast-index search "Payment" # Finds results across entire project
cd /project/root/services/payments
ast-index search "Payment" # Only finds results within services/payments/
ast-index class "PaymentService" # Only classes in services/payments/ subtree
```
This works with all search commands: `search`, `symbol`, `class`, `implementations`, `usages`.
## Multi-Root Projects
Add additional source roots for monorepos or multi-project setups. Extra roots are indexed alongside the primary project and their module dependencies are included.
```bash
ast-index add-root /path/to/other/source # Add source root (warns on overlap)
ast-index add-root ./subdir --force # Force add even if inside project root
ast-index remove-root /path/to/other/source # Remove source root
ast-index list-roots # List configured roots
```
## Utility Commands
```bash
ast-index version # Show CLI version
ast-index help # Show help message
ast-index help <command> # Show help for specific command
ast-index install-claude-plugin # Install Claude Code plugin to ~/.claude/plugins/
```
## Programmatic Access (SQL & SDK)
For complex analysis that requires combining multiple queries, filtering, or aggregation — use direct SQL access instead of chaining multiple commands.
### Structural Search (ast-grep)
Structural code search using AST patterns. Requires `sg` (ast-grep) installed.
```bash
# Simple pattern matching
ast-index agrep "router.launch($$$)" --lang kotlin
ast-index agrep "@Inject constructor($$$)" --lang kotlin
ast-index agrep "suspend fun $NAME($$$)" --lang kotlin
# Find classes extending a specific base
ast-index agrep "class $NAME : BasePresenter($$$)" --lang kotlin
# Find async functions (Swift)
ast-index agrep "func $NAME($$$) async" --lang swift
# Find React components
ast-index agrep "export default function $NAME($$$)" --lang typescript
# JSON output for programmatic use
ast-index agrep "@Composable fun $NAME($$$)" --lang kotlin --json
```
**Pattern syntax** (ast-grep):
- `$NAME` — matches a single AST node (captures as metavariable)
- `$$$` — matches zero or more AST nodes (variadic)
- Everything else is literal pattern matching against the AST
**When to use `agrep` vs built-in commands:**
- `composables`, `inject`, `suspend` → use built-in (faster, pre-configured)
- Custom structural patterns, negative matching, context queries → use `agrep`
### Raw SQL Query
```bash
# Execute any SELECT query against the index database (JSON output)
ast-index query "SELECT s.name, s.kind, f.path FROM symbols s JOIN files f ON s.file_id = f.id WHERE s.kind = 'class'"
# With limit
ast-index query "SELECT * FROM symbols WHERE name LIKE '%Service%'" --limit 50
# Complex joins — find classes that implement an interface but have no usages
ast-index query "SELECT s.name, f.path FROM symbols s JOIN files f ON s.file_id = f.id JOIN inheritance i ON s.id = i.child_id WHERE i.parent_name = 'Repository' AND s.name NOT IN (SELECT name FROM refs)"
# Find files with most symbols (complexity hotspots)
ast-index query "SELECT f.path, COUNT(*) as sym_count FROM symbols s JOIN files f ON s.file_id = f.id GROUP BY f.id ORDER BY sym_count DESC LIMIT 20"
# Find unused classes (defined but never referenced)
ast-index query "SELECT s.name, s.kind, f.path FROM symbols s JOIN files f ON s.file_id = f.id WHERE s.kind IN ('class', 'interface') AND s.name NOT IN (SELECT name FROM refs) AND s.name NOT IN (SELECT parent_name FROM inheritance)"
# Module dependency analysis — find modules with most dependencies
ast-index query "SELECT m.name, COUNT(*) as dep_count FROM module_deps md JOIN modules m ON md.module_id = m.id GROUP BY m.id ORDER BY dep_count DESC"
# CTE — transitive dependency chain
ast-index query "WITH RECURSIVE chain AS (SELECT md.dep_module_id, m.name, 1 as depth FROM module_deps md JOIN modules m ON md.dep_module_id = m.id WHERE md.module_id = (SELECT id FROM modules WHERE name LIKE '%payments%') UNION ALL SELECT md.dep_module_id, m.name, c.depth + 1 FROM chain c JOIN module_deps md ON md.module_id = c.dep_module_id JOIN modules m ON md.dep_module_id = m.id WHERE c.depth < 5) SELECT DISTINCT name, depth FROM chain ORDER BY depth, name"
```
**Security**: Only `SELECT`, `WITH`, and `EXPLAIN` queries allowed. Mutations (`INSERT`, `UPDATE`, `DELETE`, `DROP`) are blocked.
### Database Schema
```bash
# Show all tables with columns and row counts (JSON)
ast-index schema
```
Key tables:
| Table | Description | Key columns |
|-------|-------------|-------------|
| `files` | Indexed source files | `path`, `mtime`, `size` |
| `symbols` | Classes, functions, properties, etc. | `name`, `kind`, `line`, `file_id`, `signature` |
| `symbols_fts` | FTS5 full-text search on symbols | `name`, `signature` |
| `inheritance` | Parent-child type relationships | `child_id`, `parent_name`, `kind` |
| `refs` | Symbol references/usages | `name`, `line`, `file_id`, `context` |
| `modules` | Build modules (Gradle, Maven, etc.) | `name`, `path`, `kind` |
| `module_deps` | Module → module dependencies | `module_id`, `dep_module_id` |
| `transitive_deps` | Pre-computed transitive deps | `module_id`, `dependency_id`, `depth` |
| `xml_usages` | Android XML layout class usages | `class_name`, `file_path` |
| `resources` | Android resource definitions | `type`, `name`, `file_path` |
### Direct Database Access (SDK / Scripting)
```bash
# Get the SQLite database path for external tools
ast-index db-path
# Output: /Users/me/.cache/ast-index/abc123/index.db
```
Use this path with any language that supports SQLite:
```python
import sqlite3, json
db_path = subprocess.check_output(["ast-index", "db-path"]).decode().strip()
conn = sqlite3.connect(db_path)
# Example: find all classes implementing an interface with no references
unused_impls = conn.execute("""
SELECT s.name, f.path, i.parent_name
FROM symbols s
JOIN files f ON s.file_id = f.id
JOIN inheritance i ON s.id = i.child_id
WHERE s.name NOT IN (SELECT name FROM refs)
ORDER BY i.parent_name, s.name
""").fetchall()
for name, path, parent in unused_impls:
print(f" {name} implements {parent} — {path}")
```
**When to use `query` vs predefined commands:**
- Simple lookups → use `search`, `class`, `usages` (faster, formatted output)
- Complex joins, aggregation, negative conditions → use `query` (one call instead of N)
- Batch analysis, scripting, CI pipelines → use `db-path` + direct SQLite access
## Performance Reference
| Command | Time | Notes |
|---------|------|-------|
| search | ~10ms | Indexed FTS5 search |
| class | ~1ms | Direct index lookup |
| usages | ~8ms | Indexed reference search |
| imports | ~0.3ms | File-based lookup |
| callers | ~1s | Grep-based search |
| map | ~1-3s | SQL aggregation (scales with project size) |
| conventions | ~1-4s | SQL aggregation + import matching |
| rebuild | ~25s–5m | Full project indexing (depends on size) |
## Platform-Specific Commands
### Android/Kotlin/Java/Spring
Consult: `references/android-commands.md`
Java parser indexes: classes, interfaces, enums, methods, constructors, fields, and significant annotations (@RestController, @Service, @Repository, @Component, @Entity, @GetMapping, @PostMapping, @Autowired, @Override, @Transactional, @SpringBootApplication, @Test, @Inject, @Data, @Builder, etc.).
Maven modules (pom.xml) are fully supported alongside Gradle modules.
- **DI Commands**: `provides`, `inject` (@Inject + @Autowired), `annotations`
- **Compose Commands**: `composables`, `previews`
- **Coroutines Commands**: `suspend`, `flows`
- **XML Commands**: `xml-usages`, `resource-usages`
- **Code Quality**: `deprecated`, `suppress`, `todo`
- **Extensions**: `extensions`
- **Navigation**: `deeplinks`
### iOS/Swift/ObjC
Consult: `references/ios-commands.md`
- **Storyboard & XIB**: `storyboard-usages`
- **Assets**: `asset-usages`
- **SwiftUI**: `swiftui`
- **Swift Concurrency**: `async-funcs`, `main-actor`
- **Combine**: `publishers`
### TypeScript/JavaScript
Consult: `references/typescript-commands.md`
- Index: `class`, `interface`, `type`, `function`, `const`, decorators
- Supports: React (hooks, components), Vue SFC, Svelte, NestJS, Angular
- `outline` and `imports` work with TS/JS files
### Rust
Consult: `references/rust-commands.md`
- Index: `struct`, `enum`, `trait`, `impl`, `fn`, `macro_rules!`, `mod`
- Supports: Derives, attributes (`#[test]`, `#[derive]`)
- `outline` and `imports` work with Rust files
### Ruby
Consult: `references/ruby-commands.md`
- Index: `class`, `module`, `def`, Rails DSL
- Supports: RSpec (`describe`, `it`, `let`), Rails (associations, validations)
- `outline` and `imports` work with Ruby files
### C#/.NET
Consult: `references/csharp-commands.md`
- Index: `class`, `interface`, `struct`, `record`, `enum`, methods, properties
- Supports: ASP.NET attributes, Unity (`MonoBehaviour`, `SerializeField`)
- `outline` and `imports` work with C# files
### Dart/Flutter
Consult: `references/dart-commands.md`
- Index: `class`, `mixin`, `extension`, `extension type`, `enum`, `typedef`, functions, constructors
- Supports: Dart 3 modifiers (sealed, final, base, interface, mixin class)
- `outline` and `imports` work with Dart files
### Python
Consult: `references/python-commands.md`
- Index: `class`, `def`, `async def`, decorators
- `outline` and `imports` work with Python files
### Go
Consult: `references/go-commands.md`
- Index: `package`, `type struct`, `type interface`, `func`
- `outline` and `imports` work with Go files
### Scala
- Index: `class`, `case class`, `object`, `trait`, `enum` (Scala 3), `def`, `val`, `var`, `type`, `given`
- Supports: Inheritance (`extends`/`with`), companion objects
- `outline` and `imports` work with Scala files
### PHP
- Index: `namespace`, `class`, `interface`, `trait`, `enum`, `function`, `method`, `const`, `property`, `use`
- Supports: Laravel (models, traits, facades), `extends`/`implements`, namespace imports
- `outline` and `imports` work with PHP files
### Perl
Consult: `references/perl-commands.md`
- **Exports**: `perl-exports`
- **Subroutines**: `perl-subs`
- **POD**: `perl-pod`
- **Imports**: `perl-imports`
- **Tests**: `perl-tests`
### Module Analysis
Consult: `references/module-commands.md`
- **Module Search**: `module`
- **Dependencies**: `deps`, `dependents`
- **Unused Dependencies**: `unused-deps`
- **Unused Symbols**: `unused-symbols`
- **Public API**: `api`
## Workflow Recommendations
1. Run `ast-index rebuild` once in project root to build the index
2. **Start a session** with `ast-index conventions` + `ast-index map` to understand project structure (~80 lines, ~500 tokens)
3. Use `ast-index map --module <path>` to drill down into specific areas
4. Use `ast-index search` for quick universal search when exploring
5. Use `ast-index class` for precise class/interface lookup
6. Use `ast-index usages` to find all references before refactoring
7. Use `ast-index implementations` to understand inheritance
8. Use `ast-index changed --base main` before code review
9. Run `ast-index update` periodically to keep index fresh
## Additional Resources
For detailed platform-specific commands, consult:
- **`references/android-commands.md`** - DI, Compose, Coroutines, XML
- **`references/ios-commands.md`** - Storyboard, SwiftUI, Combine
- **`references/typescript-commands.md`** - React, Vue, Svelte, NestJS, Angular
- **`references/rust-commands.md`** - Structs, traits, impl blocks, macros
- **`references/ruby-commands.md`** - Rails, RSpec, classes, modules
- **`references/csharp-commands.md`** - ASP.NET, Unity, controllers, interfaces
- **`references/dart-commands.md`** - Dart/Flutter classes, mixins, extensions
- **`references/perl-commands.md`** - Perl exports, subs, POD
- **`references/python-commands.md`** - Python classes, functions
- **`references/go-commands.md`** - Go structs, interfaces
- **`references/cpp-commands.md`** - C/C++ classes, JNI functions
- **`references/proto-commands.md`** - Protocol Buffers messages, services
- **`references/wsdl-commands.md`** - WSDL services, XSD types
- **`references/module-commands.md`** - Module dependencies
---
## Referenced Files
> The following files are referenced in this skill and included for context.
### references/android-commands.md
```markdown
# Android-Specific Commands
Commands for Android/Kotlin/Java projects.
## DI Commands (Dagger/Spring)
**Find @Provides/@Binds** for a type:
```bash
ast-index provides "UserRepository"
```
**Find @Inject/@Autowired** points for a type:
```bash
ast-index inject "UserInteractor" # Finds @Inject and @Autowired usages
ast-index inject "UserService" # Spring @Autowired constructor injection
```
**Find classes with annotation**:
```bash
ast-index annotations "Module"
ast-index annotations "Inject"
```
## Compose Commands
**Find @Composable functions**:
```bash
ast-index composables
ast-index composables "Button"
```
**Find @Preview functions**:
```bash
ast-index previews
```
## Coroutines Commands
**Find suspend functions**:
```bash
ast-index suspend
ast-index suspend "fetch"
```
**Find Flow/StateFlow/SharedFlow**:
```bash
ast-index flows
ast-index flows "user"
```
## XML & Resource Commands
**Find class usages in XML layouts**:
```bash
ast-index xml-usages "PaymentIconView"
ast-index xml-usages "ImageView" --module "features.payments.impl"
```
**Find resource usages**:
```bash
ast-index resource-usages "@drawable/ic_payment"
ast-index resource-usages "R.string.payment_title"
```
**Find unused resources in module**:
```bash
ast-index resource-usages --unused --module "features.payments.impl"
```
## Indexed Kotlin/Java Constructs
- `class`, `interface`, `object`, `enum`
- `fun`, `val`, `var`
- Inheritance and interface implementation
- Annotations (@Inject, @Provides, @Composable, etc.)
```
### references/ios-commands.md
```markdown
# iOS-Specific Commands
Commands for iOS/Swift/Objective-C projects.
## Storyboard & XIB Commands
**Find class usages in storyboards/xibs**:
```bash
ast-index storyboard-usages "MyViewController"
ast-index storyboard-usages "TableViewCell" --module "Features"
```
## Asset Commands (xcassets)
**Find iOS asset usages**:
```bash
ast-index asset-usages "AppIcon"
ast-index asset-usages --unused --module "MainApp" # find unused assets
```
Supported asset types: imageset, colorset, appiconset, dataset
## SwiftUI Commands
**Find SwiftUI state properties**:
```bash
ast-index swiftui # all @State/@Binding/@Published
ast-index swiftui "State" # filter by type
ast-index swiftui "userName" # filter by name
```
Finds: @State, @Binding, @Published, @ObservedObject, @StateObject, @EnvironmentObject
## Swift Concurrency Commands
**Find async functions**:
```bash
ast-index async-funcs
ast-index async-funcs "fetch"
```
**Find @MainActor usages**:
```bash
ast-index main-actor
ast-index main-actor "ViewModel"
```
## Combine Commands
**Find Combine publishers**:
```bash
ast-index publishers # PassthroughSubject, CurrentValueSubject, AnyPublisher
ast-index publishers "state"
```
## Indexed Swift Constructs
- `class`, `struct`, `enum`, `protocol`, `actor`
- `extension` (indexed as `TypeName+Extension`)
- `func`, `init`, `var`, `let`, `typealias`
- Inheritance and protocol conformance
## Indexed Objective-C Constructs
- `@interface` with superclass and protocols
- `@protocol` definitions
- `@implementation`
- Methods (`-`/`+`), `@property`, `typedef`
- Categories (indexed as `TypeName+Category`)
## Module Detection
**SPM** - Parses `Package.swift`:
- `.target(name: "...")`, `.testTarget(name: "...")`, `.binaryTarget(name: "...")`
**CocoaPods** - Parses `Podfile` and `Podfile.lock`
**Carthage** - Parses `Cartfile` and `Cartfile.resolved`
```
### references/typescript-commands.md
```markdown
# TypeScript/JavaScript Commands Reference
ast-index supports parsing and indexing TypeScript and JavaScript files:
- `.ts`, `.tsx` - TypeScript and TSX (React)
- `.js`, `.jsx` - JavaScript and JSX (React)
- `.mjs`, `.cjs` - ES modules and CommonJS
- `.vue` - Vue Single File Components
- `.svelte` - Svelte components
## Supported Elements
| Element | Symbol Kind | Example |
|---------|-------------|---------|
| `class ClassName` | Class | `UserService` |
| `interface IName` | Interface | `IUserRepository` |
| `type TypeName = ...` | TypeAlias | `UserDTO` |
| `enum EnumName` | Enum | `UserStatus` |
| `function funcName()` | Function | `processData` |
| `const func = () => {}` | Function | Arrow functions |
| `const Component = () => <div/>` | Class | React components (PascalCase) |
| `function useHook()` | Function | React hooks (useXxx) |
| `@Decorator` | Annotation | NestJS/Angular decorators |
| `namespace NS` | Namespace | TypeScript namespaces |
| `const CONST = value` | Constant | Module constants |
| `import/export` | Import/Export | Module imports/exports |
## Core Commands
### Search Classes and Components
```bash
ast-index class "Service" # Find service classes
ast-index class "Component" # Find React/Vue components
ast-index class "Controller" # Find NestJS controllers
ast-index search "Repository" # Find repository classes
```
### Search Interfaces and Types
```bash
ast-index class "Props" # Find prop interfaces
ast-index symbol "DTO" # Find DTOs
ast-index symbol "Response" # Find type aliases
```
### Search Functions
```bash
ast-index symbol "fetch" # Find fetch functions
ast-index symbol "handle" # Find handlers
ast-index callers "processOrder" # Find function callers
```
### Search React-Specific
```bash
ast-index search "use" # Find React hooks (useXxx)
ast-index class "Button" # Find Button component
ast-index class "Modal" # Find Modal component
ast-index usages "useState" # Find useState usages
```
### Search Decorators (NestJS/Angular)
```bash
ast-index search "@Controller" # Find controllers
ast-index search "@Injectable" # Find services
ast-index search "@Component" # Find Angular components
ast-index search "@Module" # Find modules
```
### File Analysis
```bash
ast-index outline "service.ts" # Show file structure
ast-index imports "component.tsx" # Show all imports
ast-index exports "index.ts" # Show all exports
```
## Framework-Specific Patterns
### React
```typescript
// Functional component - indexed as Class
const UserCard: FC<UserCardProps> = ({ user }) => {
return <div>{user.name}</div>;
};
// Hook - indexed as Function
function useUser(id: string) {
const [user, setUser] = useState<User | null>(null);
return user;
}
// Component with forwardRef
const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
return <button ref={ref} {...props} />;
});
```
Indexed as:
- `UserCard` [class] - React component
- `useUser` [function] - React hook
- `Button` [class] - React component
### Vue 3 (Composition API)
```vue
<script setup lang="ts">
import { ref, computed } from 'vue';
interface Props {
title: string;
}
const props = defineProps<Props>();
const count = ref(0);
const doubled = computed(() => count.value * 2);
</script>
```
ast-index extracts the `<script>` section and indexes:
- `Props` [interface]
- `count` [constant]
- `doubled` [constant]
### Svelte
```svelte
<script lang="ts">
export let name: string;
export let count = 0;
function increment() {
count += 1;
}
</script>
```
Indexed as:
- `name` [property] - exported prop
- `count` [property] - exported prop
- `increment` [function]
### NestJS
```typescript
@Controller('users')
@Injectable()
export class UserController {
constructor(private readonly userService: UserService) {}
@Get(':id')
async findOne(@Param('id') id: string): Promise<User> {
return this.userService.findById(id);
}
}
```
Indexed as:
- `@Controller` [annotation]
- `@Injectable` [annotation]
- `UserController` [class]
- `findOne` [function]
- `@Get` [annotation]
### Angular
```typescript
@Component({
selector: 'app-user',
templateUrl: './user.component.html'
})
export class UserComponent implements OnInit {
@Input() userId!: string;
ngOnInit(): void {
this.loadUser();
}
}
```
Indexed as:
- `@Component` [annotation]
- `UserComponent` [class] extends `OnInit`
- `ngOnInit` [function]
## Example Workflow
```bash
# 1. Index web project
cd /path/to/react/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all components
ast-index search "Component" --kind class
# 4. Find all hooks
ast-index search "use" --kind function
# 5. Find usages of a hook
ast-index usages "useAuth"
# 6. Show component structure
ast-index outline "UserProfile.tsx"
# 7. Find implementations of interface
ast-index implementations "UserRepository"
# 8. Find who calls a function
ast-index callers "fetchUser"
```
## Import/Export Handling
Both named and default exports are tracked:
```typescript
// Named exports
export { UserService, UserController };
export type { UserDTO, UserResponse };
// Default export
export default class App extends Component {}
// Re-exports
export * from './user';
export { default as Button } from './Button';
```
Use `ast-index exports "index.ts"` to see all exports with line numbers.
## TypeScript-Specific
### Type Aliases
```typescript
type UserID = string;
type UserMap = Map<UserID, User>;
type AsyncResult<T> = Promise<Result<T, Error>>;
```
Search with:
```bash
ast-index symbol "ID"
ast-index symbol "Map"
ast-index symbol "Result"
```
### Enums
```typescript
enum UserStatus {
Active = 'ACTIVE',
Inactive = 'INACTIVE',
Pending = 'PENDING'
}
```
Search with:
```bash
ast-index symbol "Status"
ast-index symbol "UserStatus"
```
### Namespaces
```typescript
namespace API {
export interface Request {}
export interface Response {}
export function call() {}
}
```
Search with:
```bash
ast-index symbol "API"
ast-index search "API.Request"
```
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (1000 TS files) | ~800ms |
| Search class/component | ~1ms |
| Find usages | ~5ms |
| File outline | ~1ms |
| Find implementations | ~5ms |
```
### references/rust-commands.md
```markdown
# Rust Commands Reference
ast-index supports parsing and indexing Rust source files (`.rs`).
## Supported Elements
| Rust Element | Symbol Kind | Example |
|--------------|-------------|---------|
| `struct Name` | Class | `User` |
| `enum Name` | Enum | `Status` |
| `trait Name` | Interface | `Repository` |
| `impl Trait for Type` | Class | Implementation |
| `impl Type` | Class | Self implementation |
| `fn name()` | Function | `process_data` |
| `macro_rules! name` | Function | `vec_of_strings!` |
| `type Name = ...` | TypeAlias | `UserId` |
| `const NAME` | Constant | `MAX_SIZE` |
| `static NAME` | Constant | `GLOBAL_COUNTER` |
| `mod name` | Package | `utils` |
| `use path` | Import | `use std::io` |
| `#[derive(...)]` | Annotation | `#[derive(Debug)]` |
| `#[test]`, etc. | Annotation | Attributes |
## Core Commands
### Search Structs and Enums
```bash
ast-index class "User" # Find struct User
ast-index class "Service" # Find service structs
ast-index symbol "Status" # Find Status enum
ast-index search "Repository" # Find repositories
```
### Search Traits
```bash
ast-index class "Repository" # Find Repository trait
ast-index class "Handler" # Find handler traits
ast-index implementations "Trait" # Find trait implementations
```
### Search Functions
```bash
ast-index symbol "process" # Find functions containing "process"
ast-index symbol "new" # Find constructors
ast-index callers "handle_request" # Find function callers
```
### Search Implementations
```bash
ast-index search "impl" # Find all impl blocks
ast-index search "impl Repository" # Find Repository implementations
ast-index usages "UserService" # Find usages of UserService
```
### Search Macros
```bash
ast-index search "macro_rules" # Find all macro definitions
ast-index symbol "vec_of_strings!" # Find specific macro
```
### File Analysis
```bash
ast-index outline "lib.rs" # Show file structure
ast-index imports "main.rs" # Show all use statements
```
## Example Workflow
```bash
# 1. Index Rust project
cd /path/to/rust/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all structs
ast-index search "struct" --kind class
# 4. Find all traits
ast-index search "trait" --kind interface
# 5. Find implementations of a trait
ast-index implementations "Repository"
# 6. Show file structure
ast-index outline "src/lib.rs"
# 7. Find usages
ast-index usages "UserService"
# 8. Find callers
ast-index callers "process_request"
```
## Indexed Rust Patterns
### Struct Definition
```rust
#[derive(Debug, Clone, Serialize)]
pub struct User {
pub id: u64,
pub name: String,
}
```
Indexed as:
- `#[derive(Debug)]` [annotation]
- `#[derive(Clone)]` [annotation]
- `#[derive(Serialize)]` [annotation]
- `User` [class]
### Enum Definition
```rust
pub enum Status {
Active,
Inactive,
Pending,
}
```
Indexed as:
- `Status` [enum]
### Trait Definition
```rust
pub trait Repository {
fn find(&self, id: u64) -> Option<User>;
fn save(&mut self, user: User);
}
```
Indexed as:
- `Repository` [interface]
- `find` [function]
- `save` [function]
### Implementation
```rust
impl Repository for SqlUserRepository {
fn find(&self, id: u64) -> Option<User> {
// ...
}
}
impl User {
pub fn new(name: String) -> Self {
Self { id: 0, name }
}
}
```
Indexed as:
- `impl Repository for SqlUserRepository` [class] with parent `Repository`
- `impl User` [class]
- `find` [function]
- `new` [function]
### Functions
```rust
pub fn process_data(data: &[u8]) -> Result<(), Error> {
Ok(())
}
pub async fn fetch_user(id: u64) -> User {
todo!()
}
const fn compute() -> i32 {
42
}
```
All indexed as [function].
### Macros
```rust
#[macro_export]
macro_rules! vec_of_strings {
($($x:expr),*) => (vec![$($x.to_string()),*]);
}
```
Indexed as:
- `#[macro_export]` [annotation]
- `vec_of_strings!` [function]
### Modules and Imports
```rust
mod tests;
pub mod utils;
use std::collections::HashMap;
use crate::db::{Database, Connection};
```
Indexed as:
- `tests` [package]
- `utils` [package]
- `std::collections::HashMap` [import]
- `crate::db` [import]
## Attributes Tracked
The following attributes are indexed:
- `#[test]` - Test functions
- `#[bench]` - Benchmark functions
- `#[cfg]` - Conditional compilation
- `#[derive(...)]` - Derive macros (each derive is separate)
- `#[macro_export]` - Exported macros
- `#[inline]`, `#[cold]`, `#[must_use]` - Optimization hints
- `#[tokio]` - Tokio runtime
- `#[async_trait]` - Async trait macro
- `#[serde]` - Serde attributes
- Framework attributes: `#[rocket]`, `#[actix]`, `#[axum]`
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (1000 Rust files) | ~700ms |
| Search struct | ~1ms |
| Find usages | ~5ms |
| Find implementations | ~5ms |
| File outline | ~1ms |
```
### references/ruby-commands.md
```markdown
# Ruby Commands Reference
ast-index supports parsing and indexing Ruby source files (`.rb`).
## Supported Elements
| Ruby Element | Symbol Kind | Example |
|--------------|-------------|---------|
| `class ClassName` | Class | `User`, `Admin::Dashboard` |
| `module ModuleName` | Package | `Authenticatable` |
| `def method_name` | Function | `initialize`, `valid?`, `save!` |
| `def self.method_name` | Function | `self.call` |
| `attr_reader/writer/accessor` | Property | `:name`, `:email` |
| `CONSTANT` | Constant | `VERSION` |
| `require/require_relative` | Import | Imports |
| `include/extend/prepend` | Import | Mixins |
## Rails-Specific Elements
| Rails Element | Symbol Kind | Example |
|---------------|-------------|---------|
| `has_many/has_one/belongs_to` | Property | Associations |
| `scope :name` | Function | Scopes |
| `validates :field` | Annotation | Validations |
| `before_action :method` | Annotation | Callbacks |
## RSpec-Specific Elements
| RSpec Element | Symbol Kind | Example |
|---------------|-------------|---------|
| `describe "..."` | Class | Test suite |
| `context "..."` | Class | Nested context |
| `it "..."` | Function | Test case |
| `let(:name)` | Property | Test helper |
## Core Commands
### Search Classes
```bash
ast-index class "User" # Find User class
ast-index class "Controller" # Find controller classes
ast-index class "Service" # Find service objects
ast-index search "ApplicationRecord" # Find AR models
```
### Search Modules
```bash
ast-index search "module" # Find all modules
ast-index search "Authenticatable" # Find specific module
ast-index search "Concerns" # Find Rails concerns
```
### Search Methods
```bash
ast-index symbol "initialize" # Find constructors
ast-index symbol "call" # Find call methods
ast-index callers "process" # Find method callers
```
### Search Rails Patterns
```bash
ast-index search "has_many" # Find associations
ast-index search "belongs_to" # Find belongs_to
ast-index search "validates" # Find validations
ast-index search "scope" # Find scopes
ast-index search "before_action" # Find callbacks
```
### Search RSpec Tests
```bash
ast-index search "describe" # Find test suites
ast-index search "it" # Find test cases
ast-index search "let" # Find test helpers
```
### File Analysis
```bash
ast-index outline "user.rb" # Show file structure
ast-index imports "controller.rb" # Show require statements
```
## Example Workflow
```bash
# 1. Index Ruby project
cd /path/to/rails/app
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all models
ast-index search "ApplicationRecord"
# 4. Find all controllers
ast-index class "Controller"
# 5. Find usages of a class
ast-index usages "UserService"
# 6. Show model structure
ast-index outline "app/models/user.rb"
# 7. Find test files
ast-index search "RSpec.describe"
```
## Indexed Ruby Patterns
### Class Definition
```ruby
class User < ApplicationRecord
attr_accessor :name
def initialize(name)
@name = name
end
end
```
Indexed as:
- `User` [class] extends `ApplicationRecord`
- `:name` [property]
- `initialize` [function]
### Module Definition
```ruby
module Authenticatable
def authenticate
true
end
end
```
Indexed as:
- `Authenticatable` [package]
- `authenticate` [function]
### Rails Model
```ruby
class Post < ApplicationRecord
belongs_to :author
has_many :comments
validates :title
validates :content
scope :published, -> { where(published: true) }
before_save :normalize_title
end
```
Indexed as:
- `Post` [class]
- `belongs_to :author` [property]
- `has_many :comments` [property]
- `validates :title` [annotation]
- `scope :published` [function]
- `before_save :normalize_title` [annotation]
### RSpec Test
```ruby
RSpec.describe User do
describe "#valid?" do
let(:user) { build(:user) }
it "returns true for valid user" do
expect(user).to be_valid
end
end
end
```
Indexed as:
- `describe "#valid?"` [class]
- `let(:user)` [property]
- `it "returns true for valid user"` [function]
### Service Object
```ruby
class CreateUserService
def self.call(params)
new(params).call
end
def initialize(params)
@params = params
end
def call
User.create(@params)
end
end
```
Indexed as:
- `CreateUserService` [class]
- `self.call` [function]
- `initialize` [function]
- `call` [function]
## Import Handling
Both `require` and `require_relative` are tracked:
```ruby
require 'json'
require 'net/http'
require_relative './helpers'
require_relative '../models/user'
```
Use `ast-index imports "file.rb"` to see all imports.
## Mixins
Include, extend, and prepend are tracked:
```ruby
class User
include Authenticatable
extend ClassMethods
prepend Trackable
end
```
Indexed as imports showing the relationship.
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (500 Ruby files) | ~400ms |
| Search class | ~1ms |
| Find usages | ~5ms |
| File outline | ~1ms |
```
### references/csharp-commands.md
```markdown
# C# Commands Reference
ast-index supports parsing and indexing C# source files (`.cs`).
## Supported Elements
| C# Element | Symbol Kind | Example |
|------------|-------------|---------|
| `namespace Name` | Package | `MyApp.Services` |
| `class ClassName` | Class | `UserService` |
| `interface IName` | Interface | `IRepository<T>` |
| `struct StructName` | Class | `Point` |
| `record RecordName` | Class | `Person` |
| `enum EnumName` | Enum | `Status` |
| `ReturnType Method()` | Function | `GetUserAsync` |
| `Type Property { get; }` | Property | `Name`, `Id` |
| `_fieldName` | Property | `_logger` |
| `const TYPE NAME` | Constant | `MAX_SIZE` |
| `delegate Type Name` | TypeAlias | `EventHandler` |
| `event Type Name` | Property | `OnDataReceived` |
| `using Namespace` | Import | `using System` |
| `[Attribute]` | Annotation | `[ApiController]` |
## Core Commands
### Search Classes and Interfaces
```bash
ast-index class "Service" # Find service classes
ast-index class "Controller" # Find controllers
ast-index class "IRepository" # Find repository interfaces
ast-index search "Record" # Find record types
```
### Search Methods
```bash
ast-index symbol "GetUser" # Find GetUser methods
ast-index symbol "Async" # Find async methods
ast-index callers "ProcessOrder" # Find method callers
```
### Search Properties and Fields
```bash
ast-index search "{ get;" # Find properties
ast-index search "_logger" # Find private fields
```
### File Analysis
```bash
ast-index outline "UserService.cs" # Show file structure
ast-index imports "Program.cs" # Show using statements
```
## ASP.NET Core Commands
```bash
ast-index search "[ApiController]" # Find API controllers
ast-index search "[HttpGet]" # Find GET endpoints
ast-index search "[HttpPost]" # Find POST endpoints
ast-index search "[Authorize]" # Find authorized endpoints
ast-index search "[Route" # Find route definitions
```
## Unity Commands
```bash
ast-index search "MonoBehaviour" # Find Unity scripts
ast-index search "ScriptableObject" # Find scriptable objects
ast-index search "[SerializeField]" # Find serialized fields
ast-index search "Start" # Find Start methods
ast-index search "Update" # Find Update methods
```
## Test Framework Commands
```bash
# xUnit
ast-index search "[Fact]" # Find test methods
ast-index search "[Theory]" # Find parameterized tests
# NUnit
ast-index search "[Test]" # Find NUnit tests
ast-index search "[TestCase]" # Find test cases
# MSTest
ast-index search "[TestMethod]" # Find MSTest methods
```
## Example Workflow
```bash
# 1. Index .NET project
cd /path/to/dotnet/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all controllers
ast-index class "Controller"
# 4. Find all interfaces
ast-index class "I"
# 5. Find implementations
ast-index implementations "IUserRepository"
# 6. Show file structure
ast-index outline "Services/UserService.cs"
# 7. Find usages
ast-index usages "UserService"
```
## Indexed C# Patterns
### Class with Inheritance
```csharp
public class UserService : BaseService, IUserService
{
private readonly ILogger _logger;
public UserService(ILogger logger)
{
_logger = logger;
}
public async Task<User> GetUserAsync(int id)
{
return await _repository.GetByIdAsync(id);
}
}
```
Indexed as:
- `UserService` [class] extends `BaseService`, implements `IUserService`
- `_logger` [property]
- `GetUserAsync` [function]
### Interface
```csharp
public interface IRepository<T> : IDisposable
{
T GetById(int id);
void Save(T entity);
}
```
Indexed as:
- `IRepository` [interface] extends `IDisposable`
- `GetById` [function]
- `Save` [function]
### Record
```csharp
public record Person(string FirstName, string LastName);
public record Employee(string Name, string Department)
: Person(Name, "");
```
Indexed as:
- `Person` [class]
- `Employee` [class] extends `Person`
### ASP.NET Controller
```csharp
[ApiController]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
[HttpGet("{id}")]
public async Task<ActionResult<User>> GetById(int id)
{
return await _service.GetByIdAsync(id);
}
[HttpPost]
[Authorize]
public async Task<ActionResult<User>> Create(UserDto dto)
{
return await _service.CreateAsync(dto);
}
}
```
Indexed as:
- `[ApiController]` [annotation]
- `UsersController` [class]
- `[HttpGet]` [annotation]
- `GetById` [function]
- `[HttpPost]` [annotation]
- `[Authorize]` [annotation]
- `Create` [function]
### Unity MonoBehaviour
```csharp
public class PlayerController : MonoBehaviour
{
[SerializeField] private float _speed;
[Header("Settings")]
public int health = 100;
void Start()
{
Initialize();
}
void Update()
{
HandleInput();
}
}
```
Indexed as:
- `[SerializeField]` [annotation]
- `PlayerController` [class]
- `_speed` [property]
- `Start` [function]
- `Update` [function]
## Namespace Handling
Both namespace styles are supported:
```csharp
// Traditional
namespace MyApp.Services
{
public class UserService { }
}
// File-scoped (C# 10+)
namespace MyApp.Services;
public class UserService { }
```
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (500 C# files) | ~500ms |
| Search class | ~1ms |
| Find usages | ~5ms |
| Find implementations | ~5ms |
| File outline | ~1ms |
```
### references/dart-commands.md
```markdown
# Dart/Flutter Commands Reference
ast-index supports parsing and indexing Dart source files (`.dart`).
## Supported Elements
| Dart Element | Symbol Kind | Example |
|--------------|-------------|---------|
| `class ClassName` | Class | `MyWidget`, `AppState` |
| `abstract class` | Class | `BaseRepository` |
| `sealed class` | Class | `Result` |
| `final class` | Class | `ImmutableConfig` |
| `base class` | Class | `BaseService` |
| `interface class` | Interface | `AppScope` |
| `mixin MixinName` | Interface | `ScrollMixin` |
| `extension ExtName on Type` | Object | `StringExtension` |
| `extension type Name(Type _)` | Class | `UserId` |
| `enum EnumName` | Enum | `Status`, `Theme` |
| `typedef Name = ...` | TypeAlias | `JsonMap` |
| `ReturnType funcName(params)` | Function | `build`, `initState` |
| `ClassName(params)` | Function | Constructor |
| `factory ClassName.named()` | Function | Named constructor |
| `get propertyName` | Function | Getter |
| `set propertyName` | Function | Setter |
| `final/const/late/var` | Property | Top-level variables |
| `import '...'` | Import | Package imports |
| `export '...'` | Import | Re-exports |
## Dart 3 Class Modifiers
All Dart 3 class modifiers are supported:
```dart
abstract class Animal {} // Class
sealed class Shape {} // Class
final class Config {} // Class
base class BaseWidget {} // Class
interface class Disposable {} // Interface
mixin class Loggable {} // Class
abstract interface class Scope {} // Interface
abstract base class Entity {} // Class
```
## Inheritance Tracking
Parent relationships are extracted from `extends`, `with`, and `implements`:
```dart
class MyWidget extends StatefulWidget with TickerProviderMixin implements Disposable {}
```
Indexed parents:
- `StatefulWidget` (extends)
- `TickerProviderMixin` (with)
- `Disposable` (implements)
Mixin parents from `on` and `implements`:
```dart
mixin ScrollMixin on State implements TickerProvider {}
```
Indexed parents:
- `State` (on)
- `TickerProvider` (implements)
## Core Commands
### Search Classes
```bash
ast-index class "Widget" # Find widget classes
ast-index class "State" # Find State subclasses
ast-index class "Provider" # Find provider classes
ast-index search "Repository" # Find repositories
```
### Search Mixins
```bash
ast-index search "mixin" # Find all mixins
ast-index class "Mixin" # Find mixin classes
```
### Find Implementations
```bash
ast-index implementations "StatelessWidget" # Find all stateless widgets
ast-index implementations "ChangeNotifier" # Find all notifiers
ast-index implementations "Bloc" # Find all BLoC classes
```
### Class Hierarchy
```bash
ast-index hierarchy "Widget" # Show widget inheritance tree
ast-index hierarchy "State" # Show state hierarchy
```
### Find Usages
```bash
ast-index usages "BuildContext" # Find BuildContext usages
ast-index usages "Navigator" # Find navigation calls
ast-index usages "Provider" # Find provider usages
```
### Search Functions
```bash
ast-index symbol "build" # Find build methods
ast-index symbol "initState" # Find initState overrides
ast-index callers "dispose" # Find dispose callers
```
### File Analysis
```bash
ast-index outline "main.dart" # Show file structure
ast-index imports "app.dart" # Show import statements
```
## Example Workflow
```bash
# 1. Index Flutter project
cd /path/to/flutter/app
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all widgets
ast-index class "Widget"
# 4. Find all BLoC implementations
ast-index implementations "Bloc"
# 5. Find usages of a class
ast-index usages "UserRepository"
# 6. Show widget structure
ast-index outline "lib/src/widgets/custom_button.dart"
# 7. Find all screens
ast-index class "Screen"
```
## Indexed Dart Patterns
### StatefulWidget
```dart
class CounterWidget extends StatefulWidget {
const CounterWidget({super.key});
@override
State<CounterWidget> createState() => _CounterWidgetState();
}
class _CounterWidgetState extends State<CounterWidget> {
int _count = 0;
@override
Widget build(BuildContext context) {
return Text('$_count');
}
}
```
Indexed as:
- `CounterWidget` [class] extends `StatefulWidget`
- `_CounterWidgetState` [class] extends `State`
- `createState` [function]
- `build` [function]
### Enhanced Enum
```dart
enum Status implements Comparable<Status> {
active,
inactive;
@override
int compareTo(Status other) => index - other.index;
}
```
Indexed as:
- `Status` [enum] implements `Comparable`
- `compareTo` [function]
### Extension
```dart
extension StringExtension on String {
String capitalize() => '${this[0].toUpperCase()}${substring(1)}';
}
```
Indexed as:
- `StringExtension` [object] on `String`
- `capitalize` [function]
### Extension Type (Dart 3.3)
```dart
extension type UserId(int id) {
UserId.fromString(String s) : id = int.parse(s);
}
```
Indexed as:
- `UserId` [class]
- `UserId.fromString` [function]
### Mixin
```dart
mixin Loggable on Object {
void log(String message) => print('[$runtimeType] $message');
}
```
Indexed as:
- `Loggable` [interface] on `Object`
- `log` [function]
## Import Handling
Both `import` and `export` statements are tracked:
```dart
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../models/user.dart';
export 'src/widgets.dart';
```
Use `ast-index imports "file.dart"` to see all imports.
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (2700 Dart files) | ~3s |
| Search class | ~1ms |
| Find usages | ~5ms |
| File outline | ~1ms |
```
### references/python-commands.md
```markdown
# Python Commands Reference
ast-index supports parsing and indexing Python source files (`.py`).
## Supported Elements
| Python Element | Symbol Kind | Example |
|----------------|-------------|---------|
| `class ClassName` | Class | `UserService` → Class |
| `def function_name` | Function | `process_data` → Function |
| `async def function_name` | Function | `fetch_user` → Function |
| `@decorator` | Decorator | `@dataclass` → Decorator |
| `import module` | Import | `import os` → Import |
| `from module import name` | Import | `from typing import List` → Import |
## Core Commands
### Search Classes
Find Python class definitions:
```bash
ast-index class "Service" # Find service classes
ast-index class "Handler" # Find handler classes
ast-index search "Repository" # Find repositories
```
### Search Functions
Find functions and async functions:
```bash
ast-index symbol "process" # Find functions containing "process"
ast-index symbol "fetch" # Find fetch functions
ast-index callers "handle_request" # Find callers of handle_request
```
### File Analysis
Show file structure:
```bash
ast-index outline "service.py" # Show classes and functions
ast-index imports "handler.py" # Show all imports (including from X import Y)
```
## Example Workflow
```bash
# 1. Index Python project
cd /path/to/python/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all classes
ast-index search "class"
# 4. Find async functions
ast-index symbol "async"
# 5. Show file structure
ast-index outline "main.py"
# 6. Find usages
ast-index usages "UserService"
```
## Indexed Python Patterns
### Class Definition
```python
class UserService:
def __init__(self, db: Database):
self.db = db
async def get_user(self, user_id: int) -> User:
return await self.db.fetch_user(user_id)
```
Indexed as:
- `UserService` [class]
- `__init__` [function]
- `get_user` [function]
### Decorators
```python
@dataclass
class Config:
host: str
port: int
@router.get("/users")
async def get_users():
pass
```
Indexed as:
- `@dataclass` [decorator]
- `Config` [class]
- `@router.get` [decorator]
- `get_users` [function]
## Import Handling
Both import styles are tracked:
```python
import os
import sys
from typing import List, Optional
from fastapi import FastAPI, Depends
```
Use `ast-index imports "file.py"` to see all imports with line numbers.
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (500 Python files) | ~500ms |
| Search class | ~1ms |
| Find usages | ~5ms |
| File outline | ~1ms |
```
### references/go-commands.md
```markdown
# Go Commands Reference
ast-index supports parsing and indexing Go source files (`.go`).
## Supported Elements
| Go Element | Symbol Kind | Example |
|------------|-------------|---------|
| `package name` | Package | `main` → Package |
| `type Name struct` | Class | `DeleteAction` → Class |
| `type Name interface` | Interface | `Repository` → Interface |
| `func Name()` | Function | `NewService` → Function |
| `func (r *T) Method()` | Function | `Do` → Function (with receiver) |
| `import "module"` | Import | `context` → Import |
| `const Name = value` | Constant | `MaxRetries` → Constant |
| `type Name = OtherType` | TypeAlias | `Handler` → TypeAlias |
| `var Name Type` | Property | `Logger` → Property |
## Core Commands
### Search Types
Find struct and interface definitions:
```bash
ast-index class "Service" # Find service structs
ast-index class "Action" # Find action structs
ast-index search "Repository" # Find repositories
```
### Search Interfaces
Find interface definitions:
```bash
ast-index search "interface" # Find all interfaces
ast-index class "Handler" # Find handler types
```
### Search Functions
Find functions and methods:
```bash
ast-index symbol "New" # Find constructor functions
ast-index symbol "Do" # Find Do methods
ast-index callers "Handle" # Find Handle callers
```
### File Analysis
```bash
ast-index outline "handler.go" # Show structs, interfaces, functions
ast-index imports "service.go" # Show imports (including import blocks)
```
## Example Workflow
```bash
# 1. Index Go service
cd /path/to/go/service
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all structs
ast-index search "struct"
# 4. Find constructor functions
ast-index symbol "New"
# 5. Show file structure
ast-index outline "internal/handler.go"
# 6. Find usages
ast-index usages "Service"
```
## Go Patterns
### Action Pattern
```go
type DeleteAction struct {
avaSrv AvatarsMDS
tmpStorageSrv TmpStorage
filesRepo FilesRepo
}
func NewDeleteAction(
avaSrv *avatarsmds.Service,
tmpStorageSrv *tmpstorage.FileUploader,
storage *repositories.Storage,
) *DeleteAction {
return &DeleteAction{...}
}
func (a *DeleteAction) Do(ctx context.Context, task *entities.TaskToProcess) error {
// ...
}
```
Indexed as:
- `DeleteAction` [class]
- `NewDeleteAction` [function]
- `Do` [function] with parent `DeleteAction`
### Interface Definition
```go
type AvatarsMDS interface {
Delete(ctx context.Context, groupID int, name string) error
Upload(ctx context.Context, data []byte) (int, error)
}
```
Indexed as: `AvatarsMDS` [interface]
## Import Handling
Imports are tracked with their full path:
```go
import (
"context"
"fmt"
"github.com/example/backend-go/services/files-uploads/internal/entities"
)
```
```bash
ast-index imports "handler.go" # Shows all imports with aliases
ast-index usages "context" # Find context usage
```
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (100 Go files) | ~250ms |
| Search class | ~1ms |
| Find usages | ~5ms |
```
### references/perl-commands.md
```markdown
# Perl Commands Reference
Commands for Perl projects (.pm, .pl, .t, .pod files).
## Perl-Specific Commands
### Find Exports
```bash
ast-index perl-exports # Find all @EXPORT/@EXPORT_OK
ast-index perl-exports "function" # Filter by name
```
### Find Subroutines
```bash
ast-index perl-subs # Find all subroutine definitions
ast-index perl-subs "process" # Filter by name
```
### Find POD Documentation
```bash
ast-index perl-pod # Find =head1, =item, etc.
ast-index perl-pod "SYNOPSIS" # Filter by section
```
### Find Tests
```bash
ast-index perl-tests # Find Test::More assertions
ast-index perl-tests "ok" # Find specific assertion type
```
### Find Imports
```bash
ast-index perl-imports # Find use/require statements
ast-index perl-imports "DBI" # Find specific module usage
```
## Indexed Perl Constructs
- `package` declarations
- `sub` definitions
- `use constant` constants
- `our` variables
- Inheritance: `use base`, `use parent`, `@ISA`
## Module Detection
Perl packages are indexed as modules for `module` command:
```bash
ast-index module "MyApp::Utils" # Find Perl module
ast-index deps "MyApp::Utils" # Module dependencies
```
## Project Detection
Auto-detected by marker files:
- `Makefile.PL`
- `Build.PL`
- `cpanfile`
```
### references/module-commands.md
```markdown
# Module Analysis Commands
Commands for analyzing module structure and dependencies. Works for both Android (Gradle) and iOS (SPM) projects.
## Find Modules
**Find modules by name** (Gradle or SPM):
```bash
ast-index module "payments"
ast-index module "NetworkKit"
```
## Module Dependencies
**Get module dependencies**:
```bash
ast-index deps "features.payments.impl"
```
**Find modules depending on this module**:
```bash
ast-index dependents "features.payments.api"
```
## Unused Dependencies
**Find unused dependencies** (with transitive, XML, resource checks):
```bash
ast-index unused-deps "features.payments.impl"
ast-index unused-deps "features.payments.impl" --verbose
ast-index unused-deps "features.payments.impl" --strict # only direct imports
```
Available flags:
- `--verbose` — show detailed analysis
- `--strict` — only check direct imports (skip transitive)
- `--no-transitive` — skip transitive dependency checking
- `--no-xml` — skip XML layout usage checking (Android)
- `--no-resources` — skip resource usage checking (Android)
## Public API
**Show public API of a module**:
```bash
ast-index api "features/payments/api"
```
## Performance
| Command | Time |
|---------|------|
| module | ~10ms |
| deps | ~2ms |
| dependents | ~2ms |
| unused-deps | ~12s |
| api | ~30ms |
```
### references/cpp-commands.md
```markdown
# C/C++ Commands Reference
ast-index supports parsing and indexing C/C++ source files (`.cpp`, `.c`, `.h`, `.hpp`, `.cc`, `.cxx`).
## Supported Elements
| C/C++ Element | Symbol Kind | Example |
|---------------|-------------|---------|
| `class ClassName` | Class | `FileHandler` → Class |
| `struct Name` | Class | `RequestData` → Class |
| `namespace Name` | Namespace | `utils` → Namespace |
| `void function()` | Function | `ProcessRequest` → Function |
| `void Class::method()` | Function | `Handle` → Function (with parent) |
| `#include "header"` | Import | `handler.h` → Import |
| `typedef` | TypeAlias | `Handler` → TypeAlias |
| `enum Name` | Enum | `Status` → Enum |
| `#define MACRO` | Macro | `MAX_SIZE` → Macro |
## Core Commands
### Search Classes and Structs
Find class and struct definitions:
```bash
ast-index class "Handler" # Find handler classes
ast-index class "Request" # Find request structs
ast-index search "Service" # Find service classes
```
### Search Functions
Find functions and methods:
```bash
ast-index symbol "Process" # Find process functions
ast-index symbol "Handle" # Find handle methods
ast-index callers "Init" # Find Init callers
```
### Search Namespaces
```bash
ast-index search "namespace" # Find all namespaces
ast-index symbol "utils" # Find utils namespace
```
### File Analysis
```bash
ast-index outline "handler.cpp" # Show classes, functions, structs
ast-index imports "service.cpp" # Show #include statements
```
## Example Workflow
```bash
# 1. Index C++ project
cd /path/to/cpp/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all classes
ast-index search "class"
# 4. Find header usages
ast-index usages "RequestHandler"
# 5. Show file structure
ast-index outline "src/handler.cpp"
```
## C++ Patterns
### Class Definition
```cpp
namespace myapp {
class RequestHandler {
public:
RequestHandler(Database* db);
~RequestHandler();
bool Handle(const Request& req, Response* resp);
private:
Database* db_;
};
} // namespace myapp
```
Indexed as:
- `myapp` [namespace]
- `RequestHandler` [class]
- `RequestHandler` [function] (constructor)
- `~RequestHandler` [function] (destructor)
- `Handle` [function] with parent `RequestHandler`
### JNI Functions
```cpp
extern "C" JNIEXPORT jstring JNICALL
Java_com_example_MyClass_nativeMethod(JNIEnv* env, jobject obj) {
return env->NewStringUTF("Hello from JNI");
}
```
Indexed as: `Java_com_example_MyClass_nativeMethod` [function]
Find JNI functions:
```bash
ast-index symbol "Java_" # Find all JNI functions
ast-index search "JNICALL" # Find JNI exports
```
## Include Handling
Both include styles are tracked:
```cpp
#include <iostream>
#include <vector>
#include "myheader.h"
#include "utils/helpers.h"
```
```bash
ast-index imports "main.cpp" # Shows all includes
ast-index usages "myheader.h" # Find where header is included
```
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (200 C++ files) | ~400ms |
| Search class | ~1ms |
| Find usages | ~5ms |
| File outline | ~1ms |
```
### references/proto-commands.md
```markdown
# Protocol Buffers Commands Reference
ast-index supports parsing and indexing Protocol Buffer files (`.proto`) for both proto2 and proto3 syntax.
## Supported Elements
| Proto Element | Symbol Kind | Example |
|---------------|-------------|---------|
| `message Name` | Class | `UserRequest` → Class |
| `enum Name` | Enum | `Status` → Enum |
| `service Name` | Interface | `UserService` → Interface |
| `rpc Method()` | Function | `GetUser` → Function |
| `import "file.proto"` | Import | `common.proto` → Import |
| `package name` | Package | `api.v1` → Package |
| `field type name = N` | Property | `user_id` → Property |
| `oneof name` | Property | `payload` → Property |
## Core Commands
### Search Messages
Find message definitions:
```bash
ast-index class "Request" # Find request messages
ast-index class "Response" # Find response messages
ast-index search "User" # Find user-related types
```
### Search Services
Find gRPC service definitions:
```bash
ast-index search "Service" # Find all services
ast-index class "UserService" # Find specific service
```
### Search RPC Methods
```bash
ast-index symbol "Get" # Find Get* methods
ast-index symbol "Create" # Find Create* methods
ast-index usages "GetUser" # Find RPC usages
```
### Search Enums
```bash
ast-index search "enum" # Find all enums
ast-index class "Status" # Find status enum
```
### File Analysis
```bash
ast-index outline "user.proto" # Show messages, services, enums
ast-index imports "api.proto" # Show import statements
```
## Example Workflow
```bash
# 1. Index proto files
cd /path/to/proto/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all messages
ast-index search "message"
# 4. Find service definitions
ast-index search "Service"
# 5. Show proto file structure
ast-index outline "api/v1/user.proto"
# 6. Find usages of message
ast-index usages "UserRequest"
```
## Proto Patterns
### Message Definition (proto3)
```protobuf
syntax = "proto3";
package api.v1;
message UserRequest {
string user_id = 1;
repeated string fields = 2;
oneof filter {
string name = 3;
int32 age = 4;
}
}
message UserResponse {
User user = 1;
Status status = 2;
}
```
Indexed as:
- `api.v1` [package]
- `UserRequest` [class]
- `user_id` [property]
- `fields` [property]
- `filter` [property] (oneof)
- `UserResponse` [class]
### Service Definition
```protobuf
service UserService {
rpc GetUser(UserRequest) returns (UserResponse);
rpc CreateUser(CreateUserRequest) returns (UserResponse);
rpc ListUsers(ListUsersRequest) returns (stream UserResponse);
}
```
Indexed as:
- `UserService` [interface]
- `GetUser` [function] with parent `UserService`
- `CreateUser` [function] with parent `UserService`
- `ListUsers` [function] with parent `UserService`
### Enum Definition
```protobuf
enum Status {
STATUS_UNSPECIFIED = 0;
STATUS_ACTIVE = 1;
STATUS_INACTIVE = 2;
}
```
Indexed as:
- `Status` [enum]
- `STATUS_UNSPECIFIED`, `STATUS_ACTIVE`, `STATUS_INACTIVE` [property]
## Import Handling
```protobuf
import "google/protobuf/timestamp.proto";
import "common/types.proto";
import public "shared.proto";
```
```bash
ast-index imports "service.proto" # Shows all imports
ast-index usages "common/types.proto" # Find where proto is imported
```
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (50 proto files) | ~100ms |
| Search message | ~1ms |
| Find usages | ~3ms |
| File outline | ~1ms |
```
### references/wsdl-commands.md
```markdown
# WSDL/XSD Commands Reference
ast-index supports parsing and indexing WSDL and XSD files (`.wsdl`, `.xsd`).
## Supported Elements
### WSDL Elements
| WSDL Element | Symbol Kind | Example |
|--------------|-------------|---------|
| `<service name="...">` | Interface | `UserService` → Interface |
| `<portType name="...">` | Interface | `UserPortType` → Interface |
| `<operation name="...">` | Function | `getUser` → Function |
| `<binding name="...">` | Class | `UserBinding` → Class |
| `<message name="...">` | Class | `GetUserRequest` → Class |
| `<import location="...">` | Import | `types.xsd` → Import |
### XSD Elements
| XSD Element | Symbol Kind | Example |
|-------------|-------------|---------|
| `<complexType name="...">` | Class | `UserType` → Class |
| `<simpleType name="...">` | Class | `StatusType` → Class |
| `<element name="...">` | Property | `userId` → Property |
| `<attribute name="...">` | Property | `version` → Property |
| `<import schemaLocation="...">` | Import | `common.xsd` → Import |
## Core Commands
### Search Services
Find WSDL service definitions:
```bash
ast-index class "Service" # Find all services
ast-index search "UserService" # Find user service
```
### Search Operations
Find WSDL operations:
```bash
ast-index symbol "get" # Find get* operations
ast-index symbol "create" # Find create* operations
ast-index usages "getUser" # Find operation usages
```
### Search Types
Find XSD type definitions:
```bash
ast-index class "Type" # Find all types
ast-index search "Request" # Find request types
ast-index search "Response" # Find response types
```
### File Analysis
```bash
ast-index outline "service.wsdl" # Show services, operations, messages
ast-index outline "types.xsd" # Show complex/simple types
ast-index imports "api.wsdl" # Show imports and includes
```
## Example Workflow
```bash
# 1. Index WSDL/XSD files
cd /path/to/wsdl/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all services
ast-index search "Service"
# 4. Find all operations
ast-index symbol "operation"
# 5. Show WSDL structure
ast-index outline "api/UserService.wsdl"
# 6. Find type usages
ast-index usages "UserType"
```
## WSDL Patterns
### Service Definition
```xml
<wsdl:service name="UserService">
<wsdl:port name="UserPort" binding="tns:UserBinding">
<soap:address location="http://example.com/user"/>
</wsdl:port>
</wsdl:service>
```
Indexed as:
- `UserService` [interface]
- `UserPort` [property]
### Port Type and Operations
```xml
<wsdl:portType name="UserPortType">
<wsdl:operation name="getUser">
<wsdl:input message="tns:GetUserRequest"/>
<wsdl:output message="tns:GetUserResponse"/>
</wsdl:operation>
<wsdl:operation name="createUser">
<wsdl:input message="tns:CreateUserRequest"/>
<wsdl:output message="tns:CreateUserResponse"/>
</wsdl:operation>
</wsdl:portType>
```
Indexed as:
- `UserPortType` [interface]
- `getUser` [function] with parent `UserPortType`
- `createUser` [function] with parent `UserPortType`
### Messages
```xml
<wsdl:message name="GetUserRequest">
<wsdl:part name="userId" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="GetUserResponse">
<wsdl:part name="user" element="tns:User"/>
</wsdl:message>
```
Indexed as:
- `GetUserRequest` [class]
- `GetUserResponse` [class]
## XSD Patterns
### Complex Type
```xml
<xsd:complexType name="UserType">
<xsd:sequence>
<xsd:element name="id" type="xsd:string"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="email" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="version" type="xsd:int"/>
</xsd:complexType>
```
Indexed as:
- `UserType` [class]
- `id`, `name`, `email` [property]
- `version` [property]
### Simple Type with Restriction
```xml
<xsd:simpleType name="StatusType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ACTIVE"/>
<xsd:enumeration value="INACTIVE"/>
</xsd:restriction>
</xsd:simpleType>
```
Indexed as:
- `StatusType` [class]
## Import Handling
```xml
<!-- WSDL imports -->
<wsdl:import namespace="http://example.com/types" location="types.wsdl"/>
<!-- XSD imports -->
<xsd:import namespace="http://example.com/common" schemaLocation="common.xsd"/>
<xsd:include schemaLocation="local-types.xsd"/>
```
```bash
ast-index imports "service.wsdl" # Shows all imports
ast-index usages "common.xsd" # Find where XSD is imported
```
## Performance
| Operation | Time |
|-----------|------|
| Rebuild (20 WSDL/XSD files) | ~80ms |
| Search type | ~1ms |
| Find usages | ~3ms |
| File outline | ~1ms |
```
---
## Skill Companion Files
> Additional files collected from the skill directory layout.
### references/matlab-commands.md
```markdown
# Matlab Commands Reference
ast-index supports parsing and indexing Matlab source files (`.m`).
## Supported Elements
| Matlab Element | Symbol Kind | Example |
|----------------|-------------|---------|
| `classdef ClassName` | Class | `Vehicle` → Class |
| `function name` | Function | `calculate` → Function |
| `properties` block members | Property | `Speed` → Property |
| `enumeration` members | Constant | `Red` → Constant |
| `events` block members | Property | `ButtonPressed` → Property |
## File Detection
`.m` files are shared between Matlab and Objective-C. ast-index automatically detects the language by inspecting file content:
- **Matlab markers**: `classdef`, `function`, `%` comments
- **ObjC markers**: `#import`, `@interface`, `//` comments
Mixed projects with both Matlab and ObjC `.m` files are handled correctly.
## Core Commands
### Search Classes
Find Matlab class definitions:
```bash
ast-index class "Vehicle" # Find Vehicle class
ast-index class "handle" # Find handle-derived classes
ast-index implementations "handle" # Find all classes extending handle
```
### Search Functions
Find functions and methods:
```bash
ast-index symbol "calculate" # Find functions containing "calculate"
ast-index callers "processData" # Find callers of processData
```
### Class Hierarchy
```bash
ast-index hierarchy "Vehicle" # Show Vehicle class hierarchy
ast-index implementations "handle" # Find all handle subclasses
```
### File Analysis
Show file structure:
```bash
ast-index outline "Vehicle.m" # Show class, properties, methods
ast-index usages "Vehicle" # Find usages of Vehicle
```
## Example Workflow
```bash
# 1. Index Matlab project
cd /path/to/matlab/project
ast-index rebuild
# 2. Check index statistics
ast-index stats
# 3. Find all classes
ast-index search "classdef"
# 4. Find all functions
ast-index search "function"
# 5. Show file structure
ast-index outline "Vehicle.m"
# 6. Find implementations of a base class
ast-index implementations "handle"
# 7. Find usages
ast-index usages "Vehicle"
```
## Indexed Matlab Patterns
### Class Definition with Inheritance
```matlab
classdef Vehicle < handle
properties
Make
Model
Year
end
methods
function obj = Vehicle(make, model, year)
obj.Make = make;
obj.Model = model;
obj.Year = year;
end
end
enumeration
Car, Truck, SUV
end
end
```
Indexed as:
- `Vehicle` [class] extends `handle`
- `Make`, `Model`, `Year` [property] member_of `Vehicle`
- `Vehicle` [function] member_of `Vehicle` (constructor)
- `Car`, `Truck`, `SUV` [constant] member_of `Vehicle`
### Standalone Function
```matlab
function result = myFunction(x, y)
result = x + y;
end
```
Indexed as:
- `myFunction` [function]
```