Promptr CLI
Promptr sends a plain-language task to an OpenAI model and writes the proposed changes straight into your project files from the terminal
- 950 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- Writes, overwrites and deletes files, including directories, from the model's reply and without asking
- Sends the contents of the listed files and of files whose paths appear in the task text to OpenAI
- Uses the text fetched from an http or https address as the task when the task is passed as a link
Install
In your terminal, with SkillFoxx CLI
npx skillfoxx add cli/promptrDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Writes, overwrites and deletes files, including directories, from the model's reply and without asking
- Sends the contents of the listed files and of files whose paths appear in the task text to OpenAI
- Uses the text fetched from an http or https address as the task when the task is passed as a link
This is third-party code. Review the repository files before installing.
What it does
Promptr installs from npm as the `@ifnotnowwhen/promptr` package and runs as `promptr -p "task" file1 file2`. The task can be a string, a file path or an http or https address, in which case Promptr downloads the text itself. Files passed as arguments go into the request as context. Paths that appear in the task text are found with a regular expression and added too, and the `-dac` flag turns that off. The task text passes through a liquidjs template. The built-in templates are `empty`, `refactor`, `swe` and `test-first`, with `refactor` as the default, and your own template is set with `-t` by path or address. Shared project rules go into a separate file that tasks pull in with `render`, so they are not repeated in every prompt. The finished request goes to OpenAI Chat Completions: the default model is `gpt-4o`, the key comes from `OPENAI_API_KEY`, and the code reads the API address from `OPENAI_API_BASE`. The model must answer with a function call holding a list of file operations, and Promptr applies them at once: it creates and overwrites files, deletes files and directories, and the handler can also move files. There is one request and one reply, with no loop of edits checked by tests. The `-d` flag prints the request and the token count and leaves the disk untouched. The `-i` flag starts an interactive mode.
Who it is for. For Node.js developers who are ready to pay for the OpenAI API and want to change code from a plain-language task with one terminal command.
Good fit when
- You need one change across several files: a rename, moving logic, bringing code in line with the project standard
- You want project rules in a shared `_project.liquid` file that every task pulls in with `render`
- Before a run you need to see what the model will receive: `promptr -d` prints the request and token count without writing to disk
- The task lives in a file or at a repository address and is convenient to rerun with the `-p` flag
- You need the model's answer in a file rather than a code edit: the `-o` flag with your own template writes the output to the given path
Not a fit when
- You have no OpenAI key or need another model provider: Promptr talks only to an API in the OpenAI format, and the OpenAI API is unavailable from Russia
- You want a dialogue with a repository map, git auto-commits and test runs after edits: Aider does that
- The project is not under git and has no backup: Promptr writes and deletes files without asking
- You need a ready binary for Linux or Windows: it is declared for macOS only, on other systems you need Node 18 and an npm install
Example request
Rename the Order class to Invoice in src/order.js and src/invoice.js with Promptr, but first show me the request that will go to the modelLimitations
- Promptr applies the model's reply without asking. The author advises committing changes in git before a run and reviewing the result in a git interface.
- It needs Node 18, a key in `OPENAI_API_KEY` and billing set up at OpenAI. The OpenAI API is unavailable from Russia.
- Ready binaries are declared for macOS only. The latest release tag on GitHub, v6.0.7, dates from May 2024, while `package.json` says version 6.1.0.
- Auto context takes any string that looks like a file path from the task, so an extra file can also be sent to the model. The `-dac` flag turns this off.
- The `-o` flag does not work with the built-in `refactor` template. License MIT.
How to disable. Remove the package with `npm uninstall -g @ifnotnowwhen/promptr` (for yarn `yarn global remove @ifnotnowwhen/promptr`) and drop `OPENAI_API_KEY` from the environment. Delete `~/.promptr.json` by hand if you created it.
FAQ
How does Promptr choose which files to send to the model?
The request carries the files listed as arguments plus any files whose paths a regular expression finds in the task text. The `-dac` flag turns off the second part, so only the listed files are sent.
How do I check what goes to OpenAI before it is sent?
Run the command with `-d`: Promptr prints the finished request and the token count and changes nothing on disk. The same check works for a template before the first real run.
Which model is the default and how do I change it?
The default is `gpt-4o`. The `-m` flag sets another model, and the value `gpt3` selects `gpt-3.5-turbo`. The code takes the API address from `OPENAI_API_BASE`, which defaults to `https://api.openai.com/v1`.
Can I keep shared project rules in one file?
Yes. Put the rules in a file such as `_project.liquid` and pull it in at the start of the task with `{% render '_project.liquid' %}`. That way the Node version, the package manager and the code style are not repeated in every prompt.
What happens if the model returns broken JSON?
Promptr tries to repair quotes and line breaks and then pull the object out with a regular expression. If the reply still cannot be parsed, it prints a parse error message and the model's reply.
How do I run a task from a file or an address?
Pass the path or link to `-p`: `promptr -p my_prompt.txt` reads the file, and for a value starting with http or https Promptr downloads it and uses the text as the task.
Discussion
No questions or reviews yet.
Related
CLI toolsSingle-file Python script that runs .prompt files from the shell: templates, JSON output, tools, chat and prompt-to-prompt pipelines
29 ready-made prompts in Chinese: a five-step dev flow, code review, Draw.io diagrams, reports, WeChat articles and thesis chapters
A console chat with ChatGPT, Claude, Gemini and Cohere: custom assistants in YAML, one-shot prompts from scripts and shell commands you edit before running
A terminal coding agent that picks a model for each request on its own and shows spend in real time
A Python terminal coding agent in the manner of Claude Code: reads the repository, edits files, runs commands, with memory, sub-agents and MCP
An MCP server on your machine that lets ChatGPT and Claude edit code, run tests and check Git in a local repository
README in short
The repository holds JavaScript sources in `src`, the entry point `bin/index.js`, a webpack and pkg build for binaries and a mocha test for templates. The documentation is a single file: the workflow, a table of flags, a liquidjs templating section with an example shared rules file, requirements and installation methods. It also links two pull requests whose descriptions contain the prompts that produced the commits.