Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cmdauto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CMDauto
CMDauto is a TypeScript CLI that turns natural-language requests into shell commands using your choice of large language model (Google Gemini, OpenAI GPT, or Anthropic Claude).
Requirements
- Node.js 18 or newer
- An API key for one of the supported LLM providers (unless you rely on the bundled Gemini key)
Installation
npm install -g cmdautoAfter installation the CLI exposes two entry points:
cmdauto– initializes or updates credentialsca– asks for command suggestions
Quickstart
1. Initialize credentials
cmdautoChoose one of the credential strategies when prompted:
- Use the bundled Google Gemini key (reads
DEFAULT_GEMINI_API_KEYandDEFAULT_GEMINI_MODELfrom.env). - Supply your own key for OpenAI, Google Gemini, or Anthropic Claude. Keys are stored locally at
~/.cmdauto/config.json. - Reuse the previously saved configuration.
2. Request a command suggestion
ca "deploy the docker compose project"CMDauto will query the configured LLM, show a dropdown of suggested shell commands, and execute the selection in your current working directory. The executed command and a snippet of its output are logged to history.
Command reference
cmdauto– interactive credential setup flowcmdauto --remove– delete saved credentials and historyca "<task>"– generate suggestions for a natural-language taskca --history– display the stored history entriesca --remove– delete saved credentials and historyca --exit– clear credentials/history and exitca --help– show CLI usage informationca --version– print the package version
Note:
carequires a successfulcmdautorun first. If credentials are missing, it instructs you to initialize them before proceeding.
Environment variables
For production use, we strongly recommend supplying your own provider keys via cmdauto so usage stays under your account. If you need a quick start with the bundled Gemini credential, copy .env.example to .env and populate:
DEFAULT_GEMINI_API_KEY=your-key-here
DEFAULT_GEMINI_MODEL=gemini-2.5-flash-liteThe DEFAULT_GEMINI_MODEL variable is optional; it falls back to the project default when omitted.
History and configuration storage
- Configuration:
~/.cmdauto/config.json - Command history:
~/.cmdauto/history.json(keeps the 30 most recent entries)
Each history entry stores the original input, the executed command (if any), exit code, and a trimmed output snippet. This context is also sent to the LLM (last five entries) when generating new suggestions.
Development workflow
npm install
npm run build
npm run devnpm run buildcompiles TypeScript todist/.npm run devstarts the CLI in watch mode usingtsx.npm pack --dry-runshows the files that would ship to npm.
Before submitting code changes, please review the contribution guidelines in CONTRIBUTING.md.
License
MIT