Skip to main content

Action Language Interpreter - One command for every tool

Project description

ALI - Action Language Interpreter

PyPI version Python 3.12+ License: MIT

Compose complex tmux commands from regular phrases. Pure command aggregator - outputs commands, never executes them.

Quickstart

# Install
uv tool install ali-tool  # Recommended
# OR
pip install ali-tool

# Initialize tmux integration
ali --init tmux
# Then reload tmux: tmux source ~/.tmux.conf

# Use
ali GO .2              # → tmux select-pane -t .2
ali SPLIT pop          # → tmux display-popup -w 80% -h 80% -d "$PWD" -E 'bash'
ali EDIT file.txt pop  # → tmux display-popup ... 'micro file.txt'
ali WIDTH 012          # → Distribute panes evenly
ali ECHO ed?           # → Popup editor, pipe output to send-keys

Press C-b a in tmux to open ALI prompt after initialization.

Architecture

ALI is a pure command aggregator - it only outputs commands, never executes them.

Input → Parser → Router → Resolver → Output
         ↓         ↓         ↓
      Grammar  Commands  Templates

Core Components

  • Parser - Tokenizes input using plugin grammars
  • Router - Matches patterns to find commands
  • Resolver - Expands templates with conditionals and services
  • Registry - Manages plugins and their services

Template Engine

# Conditionals
exec: "{?target:tmux select-pane -t {target} && }command"

# Array lookups  
exec: "{direction[left:-h -b,right:-h,up:-v -b,down:-v,pop:display-popup]}"

# Service composition
exec: "{split} 'micro {file}'"  # Uses split service from tmux

Plugin Development

Plugins are YAML-only data files that define grammar, commands, and services.

# plugin.yaml
name: example
version: 1.0
description: Example plugin
# Grammar
grammar:
  item: {type: string}
  direction: {values: [left, right, up, down, pop]}
# Commands  
commands:
  - match: {verb: ACTION, item: present}
    exec: "{split} '{item}'"
# Services
services:
  process: "tool --process"
# Selectors
selectors:
  item?:
    type: stream
    exec: "selector"

See the plugin documentation for more patterns.

Examples

Navigation

ali GO .2          # Go to pane 2
ali GO :3          # Go to window 3
ali GO ?           # Visual pane selector

Splits & Layout

ali SPLIT          # Split right (default)
ali SPLIT left     # Split left
ali SPLIT pop      # Open popup shell
ali WIDTH 012      # Distribute panes evenly

Editing

ali EDIT file.txt       # Edit in right split
ali EDIT file.txt pop   # Edit in popup
ali VIEW file.txt       # Read-only view

Layout

ali LAYOUT         # Interactive layout picker
ali LAYOUT '1|23'  # Apply layout expression
ali TERMTAP        # Open termtap companion popup

Stream Operations

ali ECHO ed?       # Edit in popup, pipe to send-keys
ali COPY br?       # Browse in popup, copy to clipboard

Ideas

  • Multi-stage selectors — Pipe selectors together: br? | ed? (browse, then edit the result)
  • Shell completions — Generate from verb/grammar data for bash/zsh/fish

Development

# Clone and install dev version
git clone https://github.com/angelsen/ali.git
cd ali
uv tool install -e .

# Test — ALI outputs commands, never executes
ali GO .2
ali SPLIT right | cat   # verify clean stdout

REPL Debugging

from pathlib import Path
from ali_tool.core import ServiceRegistry, Router

registry = ServiceRegistry()
registry.load_plugins(Path('./src/ali_tool/plugins'))
router = Router(registry)

router.execute("SPLIT right")  # see output
router.last_state               # inspect parsed state

License

MIT - see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ali_tool-0.2.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ali_tool-0.2.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file ali_tool-0.2.1.tar.gz.

File metadata

  • Download URL: ali_tool-0.2.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ali_tool-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d45534a5250501054baa1ca036c809f7ddca09161ef46547ca8c34e24a9d2f03
MD5 0c7faeaaae4664a0b9dd5b1429da2610
BLAKE2b-256 795f5e06f89f4633e496f33b47aafcec6b49de901d1df756e10d2db08f916448

See more details on using hashes here.

File details

Details for the file ali_tool-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ali_tool-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"EndeavourOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for ali_tool-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3111cceb337a10f5f62b88a1084cd0db448b8d96abaf60a6f8f2d659fc4aae73
MD5 a95bd804e82df6c4498a44928a21402c
BLAKE2b-256 3cb5c47acf5171495107b65eccd0eeac5db2f004ec1d9ca5ecff40feaa7ab6e0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page