Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lx

A deterministic line-addressed CLI document editor for AI agents, shell automation, Linux, and Windows.

Created by CE-OS.

lx gives an agent or human a small grammar for inspecting and changing text files by line address. Instead of requiring an interactive editor, a caller can read exact coordinates, insert text at an exact line, delete exact ranges, create files, and normalize text from the command line.

The Linux and Windows implementations are separate host implementations of the same observable CLI contract.

Why lx

Text editing is easy for a human with a screen and editor. It is less convenient for an autonomous process that needs bounded, inspectable mutations.

lx makes the edit itself explicit:

lx app.py 42
lx app.py 40-60
lx app.py 42 + 'print("hello")'
lx app.py - 42
lx app.py - 42-50

Line coordinates make the requested operation visible before and after execution. The grammar is intentionally small.

Contract

lx - line-addressed file tool

READ
  lx FILE                  whole file
  lx FILE LINE             one line
  lx FILE START-END        line range
  lx FILE -N               last N lines

INSERT
  lx FILE LINE + TEXT      insert TEXT before LINE
  lx FILE LINE + ml        insert stdin before LINE
  lx FILE LINE + tb        type lines; close with ||

DELETE
  lx FILE - LINE           delete one line
  lx FILE - START-END      delete range

CREATE
  lx c FILE                create empty file
  lx c FILE ml             create from stdin
  lx c FILE tb             type file; close with ||

CLEAN
  lx clean                 clean files in current directory
  lx clean PATH            clean one file or files in one directory

ml reads until EOF and works with shell heredocs for multiline automation.

tb is interactive and ends on a line containing exactly ||.

clean is nonrecursive. It collapses blank runs, removes leading and trailing blank lines, skips binary files, and reports only files actually changed.

Additional commands

The repository also includes directory inspection, function/declaration discovery, and the permanent LX test suite:

lx dir
lx dir DEPTH
lx dir PATH
lx dir PATH DEPTH

lx func FILE
lx func FILE NAME

lx test

lx dir emits a deterministic directory view with directories first, files second, stable case-insensitive ordering, and logical line counts for files.

lx func provides lightweight source landmarks for supported Python, shell, QPS, C, and C++ files.

Agent use

A tool-using agent can use lx as a bounded document mutation interface:

# inspect the target
lx engine.py 80-110

# insert at an explicit coordinate
lx engine.py 96 + 'initialize_engine()'

# inspect the resulting region
lx engine.py 90-105

# remove an exact range
lx engine.py - 96-98

The important property is not that an AI must use lx. The property is that the operation can be expressed as a small deterministic command with observable output, validation, failures, and exit status.

Linux

The Linux implementation is under:

linux/
  lx
  lx.d/
    core/errors
    file
    dir
    func
    test

Install it anywhere you prefer, keeping lx and lx.d together. For example, copy them into a directory on your PATH and make lx executable.

Windows

The PowerShell implementation is under:

windows/
  lx.ps1
  lx/
    core/errors.ps1
    file.ps1
    dir.ps1
    func.ps1
    test.ps1

Keep lx.ps1 and its lx module directory together. Invoke it with PowerShell directly or expose it through your preferred command wrapper.

Host parity

Linux and Windows intentionally use different host implementations while exposing the same public terminal grammar and observable behavior.

The parity target includes:

  • commands and arguments
  • output
  • validation
  • failure behavior
  • exit codes

Test

Both host implementations carry a permanent test command:

lx test

A successful complete suite ends with:

LX_TEST_PASS

The publication payload was tested on both Linux and Windows before release.

Repository layout

lx/
  README.md
  LICENSE
  linux/
  windows/

No CE-OS simulation source is part of this repository. lx is an independent public tool.

License

MIT. lx is intentionally free to use, modify, redistribute, and incorporate into other software.

Created by CE-OS.

About

A deterministic line-addressed CLI document editor for AI agents, shell automation, Linux, and Windows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages