Currently just a proof-of-concept. Really fragile and probably doesn't work for you without modifications.
-
You are using
tmux. -
You are using
bashwith a relatively boring prompt ($PS1). -
You are using
opencode.
You may be going about your business in the terminal, when you encounter an error.
What you might do, is to simply copy-paste the entire output of the failed command, including the command and prompt at the top, into some AI service, and that AI service will give you hints about what's wrong.
The problem with this is simply the constant copy-ing and pasting from terminal to browser, and then having to copy-paste things back into the terminal.
This utility is currently an experiment to see how far we can get with automating this process. It captures the last run command, including the prompt, and the output, and prints out an instruction intended to be digested by some AI.
It's currently an experiment so it's not obvious where it will lead, if anywhere.
[someuser@somehost ~/code/some-project]$ npm run start
> start
> yarn workspace $START_COMMAND
sh: 1: yarn: not found
[someuser@somehost ~/code/some-project]$ cmdcatch | opencode run
| Read package.json
The `yarn` command is not installed or available in your system's PATH. This project uses Yarn 3.3.1 (as specified in `package.json`), which requires Yarn to be installed globally or the local Yarn binary to be used.
To fix this, install Yarn globally with `npm install -g yarn`, or run the start command using the local Yarn binary: `node .yarn/releases/yarn-3.3.1.cjs workspace $START_COMMAND`.
[someuser@somehost ~/code/some-project]$