Skip to content

inline and fix

asksh [flags] [prompt...]

Launches the interactive inline TUI or runs in headless pipe mode. asksh inline [flags] [prompt...] is the explicit subcommand form of the default command.

asksh "compress all logs older than 7 days"
asksh -p -x "print the largest 5 files in this directory"

Flags

Flag Type Description
--base-url string Provider base URL (overrides config.toml and ASKSH_BASE_URL)
--api-key string API key string (overrides config.toml and ASKSH_API_KEY)
--model string Model ID or alias (overrides config.toml and ASKSH_MODEL; disables routing)
--config string Path to config.toml
--target string Execution target URI (local, ssh://, docker://, k8s://)
--buffer string Current shell command line buffer for mid-buffer assist
--yolo bool Auto-approve all tool calls and permit high-danger -x execution
-p, --pipe bool Run non-interactively in pipe mode
-x, --exec bool Execute the suggested command non-interactively (refuses high danger without --yolo)
--json bool Emit structured JSON output in pipe mode
-v, --verbose bool Write debug logs to ~/.local/share/asksh/asksh.log

Shell hooks pass the internal --hook flag so asksh emits shell directives on stderr.

JSON output schema

When --json is passed, asksh writes a single JSON object (headless.Result):

{
  "text": "Summary or explanation text",
  "command": "find . -maxdepth 1 -type f",
  "danger": "low",
  "danger_notes": "",
  "confidence": "high",
  "preflight": {
    "level": "low",
    "findings": [
      {
        "rule": "string",
        "reason": "string",
        "level": "low"
      }
    ],
    "expanded_targets": ["string"],
    "truncated_targets": false
  },
  "executed": false,
  "exit_code": 0,
  "stdout": "",
  "stderr": "",
  "tool_calls": 1
}

Fields marked omitempty (text, command, danger, danger_notes, confidence, preflight, stdout, stderr) are omitted when empty.

Exit codes

  • 0: completed without an asksh error (including when -x runs a command whose own exit_code is non-zero).
  • 1: CLI usage error, missing configuration, LLM request failure, invalid --target, or a refused high-danger command under -x.

asksh fix [--last] [flags...]

Looks up the most recent failed shell command recorded for the current VCS repository (or current directory outside a repository) and opens an interactive or headless fix request.

asksh fix accepts --last (for readability; always enabled) and all flags supported by asksh inline. If no failed command is recorded in ~/.local/share/asksh/sessions.db, it prints No failed command recorded. and exits 0.