Skip to content
Minoo7Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

lastout

lastout captures the output of interactive shell commands and lets you fetch the last completed command output directly with lastout.

Value prop

  • Gives automation and LLM tools a stable way to read terminal output after a command runs.
  • Lets you include the original command with lastout -wc when you want better AI context.

Status/support matrix

Current scope for v1 is intentionally narrow.

Shell Terminal Status
Fish Ghostty Supported
Fish Other terminals Not supported
Bash/Zsh Any terminal Not supported

Install (local install now)

No package manager release yet. Install from this repo locally.

  1. Put bin/lastout on your PATH and make it executable.
  2. Copy or symlink fish/conf.d/lastout.fish into your Fish conf.d directory.

Example paths:

install -m 755 bin/lastout ~/.local/bin/lastout
ln -sf "$PWD/fish/conf.d/lastout.fish" ~/.config/fish/conf.d/lastout.fish

Start a new Ghostty Fish session after installation.

Quick start

# Run something that fails
python docs/demo/bugtrace.py

# Get plain output for the last completed command
lastout

# Include the original command too
lastout -wc

# Pipe it into an AI CLI for a fast fix suggestion
lastout -wc | aichat "Find the bug and give me the exact fix."

Demo (GIF)

lastout demo

The demo shows this flow:

  1. Run a realistic Python traceback.
  2. Grab the exact output plus command with lastout -wc.
  3. Pipe it into an LLM CLI to get a fix suggestion immediately.
  4. Confirm that lastout now points at the AI answer.

The demo asset is generated from docs/demo.tape with VHS so it stays reproducible.

Conceptual examples

Use these patterns when you want a fast diagnosis from terminal output.

1) Python traceback -> exact fix

python app.py
lastout -wc | aichat "Find the bug, tell me the exact line to change, and give me one verify command."

2) Build/test failure summary

bun test
lastout -wc | aichat "Summarize only failing tests and likely root cause. Return a minimal fix plan."

3) Git conflict / merge problem

git pull
lastout -wc | aichat "Explain what git is asking me to do, then list exact commands to resolve safely."

4) Runtime stack trace triage

python app.py
lastout -wc | aichat "Extract exception type, failing file:line, and the first fix I should try."

Pipe to LLM tools

aichat

lastout -wc | aichat "Give me the fastest fix. Format: cause, commands to run, verification command."

llm (Simon Willison's CLI)

lastout -wc | llm "You are a senior terminal troubleshooter. Return: root cause, exact fix commands, and one verify command."

For stricter output (easy to copy/paste into scripts), ask for JSON:

lastout -wc | llm "Return valid JSON with keys: root_cause, fix_commands, verify_command."

Optional: pass a sequence number to inspect an older captured command.

lastout 1
lastout -wc 1

Command reference (concise)

  • lastout [seq]: prints captured output for the last completed command (or specific sequence).
  • lastout --with-command [seq]: prints the original command plus captured output.
  • lastout -wc [seq]: shorthand for --with-command.

How it works

  • In Ghostty + Fish, startup bootstrap runs script and writes a raw session log to an ephemeral directory.
  • Fish fish_preexec and fish_postexec hooks call hidden lastout --internal ... subcommands around each command.
  • lastout slices the raw log between captured start/end byte offsets and strips terminal control sequences.
  • Carriage-return spinners and transient Generating... updates are collapsed so you only keep the final visible text.
  • On shell exit, lastout cleans up the ephemeral session directory.

Troubleshooting

  • lastout not found: verify ~/.local/bin is on your PATH and restart Fish.
  • No output captured: confirm you are in Ghostty and TERM_PROGRAM is ghostty.
  • Capture never starts: check command -q lastout and command -q script succeed in Fish.
  • Empty lastout: run a command first, then call lastout after it finishes.
  • Permission issues: ensure bin/lastout is executable (chmod +x).
  • If aichat or llm is not found, install the CLI first and retry the same pipeline.
  • If you want both the command and output for AI prompts, use lastout -wc instead of plain lastout.

Development/testing

  • Run tests: bun test
  • Shell syntax checks:
bash -n bin/lastout
fish -n fish/conf.d/lastout.fish

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages