Command line utility for querying Vala VAPIs
|
|
1 місяць тому | |
|---|---|---|
| .kilocode | 1 місяць тому | |
| man | 1 місяць тому | |
| scripts | 1 місяць тому | |
| src | 1 місяць тому | |
| tests | 1 місяць тому | |
| .gitignore | 1 місяць тому | |
| LICENSE | 1 місяць тому | |
| MANIFEST.usm | 1 місяць тому | |
| README.md | 1 місяць тому | |
| architecture-plan.md | 1 місяць тому | |
| mcp-mode-design.md | 1 місяць тому | |
| meson.build | 1 місяць тому | |
| test_enums.vapi | 1 місяць тому | |
| test_mcp_client.py | 1 місяць тому | |
| test_namespace_methods.vapi | 1 місяць тому | |
| test_nested.vapi | 1 місяць тому | |
| test_root_only.vapi | 1 місяць тому |
Valaq is a powerful command-line tool for querying and exploring VAPI (Vala API) files. It provides hierarchical navigation of symbols within VAPI files with support for both human-readable and JSON output formats. Built with libvala for accurate VAPI parsing and symbol extraction.
Valaq requires the following dependencies:
On Ubuntu/Debian systems:
sudo apt-get install valac libvala-0.56-dev libglib2.0-dev libjson-glib-dev libgee-0.8-dev meson ninja-build
On Fedora/RHEL systems:
sudo dnf install vala libvala-devel glib2-devel json-glib-devel libgee-devel meson ninja
# Clone the repository
git clone https://github.com/your-repo/valaq.git
cd valaq
# Setup build directory
meson setup builddir
# Compile
meson compile -C builddir
# Run tests (optional)
meson test -C builddir
# Install
sudo meson install -C builddir
# List all available VAPI files in text format
valaq
# List VAPI files in JSON format
valaq --json
# List top-level symbols using basename without extension
valaq gtk+-3.0
# List top-level symbols using basename with extension
valaq gtk+-3.0.vapi
# List top-level symbols using full path
valaq /usr/share/vala/vapi/gtk+-3.0.vapi
# Navigate to a class (space-separated)
valaq gtk+-3.0 Gtk Window
# Navigate to a method (dot-separated)
valaq gtk+-3.0 Gtk.Window.show
# Navigate using mixed separators
valaq gtk+-3.0 Gtk.Window show
# Get JSON output for symbol details
valaq json-glib-1.0 Json.Object --json
-h, --help: Show help message and exit-v, --version: Show version information and exit-j, --json: Output in JSON format instead of human-readable textSymbol paths can be specified using spaces or dots as separators:
Space-separated:
valaq gtk+-3.0 Gtk Window show
# Navigates to Gtk -> Window -> show
Dot-separated:
valaq gtk+-3.0 Gtk.Window.show
# Same navigation using dot notation
Mixed separators:
valaq gtk+-3.0 Gtk.Window show
# Combines both formats
Valaq supports all major Vala language constructs:
Valaq automatically searches for VAPI files in standard directories:
/usr/share/vala-0.56/vapi/usr/share/vala/vapi/usr/share/vala-0.54/vapi, /usr/share/vala/vapiRun valaq with no arguments to see all available VAPI files.
# List all available VAPI files
valaq
# Explore GLib namespace
valaq glib-2.0
# View method details with parameters
valaq glib-2.0 GLib.Timeout.add
# Examine enum values
valaq glib-2.0 GLib.FileType
# Get VAPI file list in JSON
valaq --json
# Get symbol details in JSON format
valaq json-glib-1.0 Json.Object --json
# JSON output for method with full signature
valaq gtk+-3.0 Gtk.Window.show --json
# Navigate to nested symbols with dots in names
valaq package-name Namespace.Class
# Explore namespace contents
valaq gio-2.0 GLib
# Drill down into specific class methods
valaq gtk+-3.0 Gtk.Button Button_clicked
Human-readable output with hierarchical symbol listing:
VAPI file: gtk+-3.0.vapi
Symbols:
Gtk
Window
show() -> void
hide() -> void
destroy() -> void
Button
clicked() -> void
set_label(string) -> void
Structured JSON output for programmatic use:
{
"result_type": "symbol_details",
"vapi_file": "gtk+-3.0.vapi",
"query_path": ["Gtk", "Window"],
"symbol": {
"name": "Window",
"type": "class",
"access": "public",
"base_types": ["Bin"],
"methods": [
{
"name": "show",
"return_type": "void",
"parameters": []
}
],
"properties": [...],
"fields": [...]
},
"metadata": {
"vala_version": "0.56",
"timestamp": "2023-..."
}
}
0: Success1: General error (invalid arguments, file not found, etc.)2: Parse error (invalid VAPI file syntax)If VAPI files are not found:
# Run 'valaq' with no arguments to see available files
valaq
# Use full path to specific file
valaq /path/to/your/file.vapi
# Check if vala development packages are installed
dpkg -l | grep libvala
If symbols are not found:
# Check symbol name case (case-sensitive)
valaq gtk+-3.0 Gtk.Window
# List top-level symbols first to verify names
valaq gtk+-3.0
# Verify symbol path hierarchy
valaq gtk+-3.0 Gtk
valaq gtk+-3.0 Gtk.Window
valaq gtk+-3.0 Gtk.Window.show
Valaq supports multiple file reference formats:
/usr/share/vala/vapi/gtk+-3.0.vapigtk+-3.0.vapigtk+-3.0The tool searches in standard VAPI directories and current working directory.
# Run all tests
meson test -C builddir
# Run specific test
meson test -C builddir test-vapi-parser
valaq/
├── src/
│ ├── main.vala # Application entry point
│ ├── cli/
│ │ ├── argument-parser.vala # Command-line argument parsing
│ │ └── command-handler.vala # Command processing logic
│ ├── core/
│ │ ├── vapi-parser.vala # VAPI file parsing using libvala
│ │ ├── symbol-navigator.vala # Symbol hierarchy navigation
│ │ └── symbol-model.vala # Data models for symbols
│ ├── output/
│ │ ├── formatter.vala # Output formatting interface
│ │ ├── text-formatter.vala # Human-readable output
│ │ └── json-formatter.vala # JSON output formatting
│ └── utils/
│ ├── file-utils.vala # File system operations
│ └── error-handling.vala # Error handling utilities
├── tests/ # Unit tests
├── meson.build # Build configuration
└── README.md
This project is licensed under the GPLv3 License. See the LICENSE file for details.