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.2.tar.gz (19.0 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.2-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ali_tool-0.2.2.tar.gz
  • Upload date:
  • Size: 19.0 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.2.tar.gz
Algorithm Hash digest
SHA256 2a3306d0cd58150129c4d5e363161ac7094ded345329d33029f9bdba0cbd4034
MD5 f7f4f2a48aac5185ccdb4eb949611c28
BLAKE2b-256 a142322488052532716682ef303e0f62b273a5a3af1881b19bd13d4a7511dba8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ali_tool-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 25.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 60c201dc16edc5b189f2628473e5602466fbac4569c18cff3e763af8b57de972
MD5 ca3f2473c4a555f262aee4a5e9bebc40
BLAKE2b-256 a6d731ce43b885221b5bcf09fe0b3e4a8851fa2f577d2c2706ceac1414db8360

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