CLI AI

From one-liner to checked-in script: when to graduate

2026-04-15

CliAI shines on the I-need-this-once category of work. The 80% case. But there's a quieter category: the same shaped command you keep regenerating. At some point that command earns a name, a code review, and a place under scripts/.

Three signs of maturity

You've run the same shape three times in a week. Not the exact same command — the same shape. "Tail the staging logs and grep for FAILED" on Monday, "… and grep for ERROR" on Wednesday, "… and grep for timeout" on Friday. The shape is what wants a script.

A teammate asks you for the command. If your colleague is going to copy your one-liner into Slack, save them the round trip and check it in.

The command runs in CI. Unreviewed shell in a CI pipeline is a slow-motion incident. The moment a CliAI-generated one-liner enters CI, write it down properly.

The graduation pattern

Start with the prompt. Run it. Copy the result.

clai
$ clai for each pod in staging that's not Ready, print its name and last 20 log lines→ kubectl -n staging get pods -o json \    | jq -r '.items[] | select(.status.containerStatuses[0].ready==false) | .metadata.name' \    | xargs -I{} sh -c 'echo "── {} ──"; kubectl -n staging logs {} --tail=20'

Then turn it into something diff-able:

#!/usr/bin/env bash
# scripts/staging-unready-pods.sh
# Print name + last 20 log lines for every pod in staging that's not Ready.
set -euo pipefail

NAMESPACE="${1:-staging}"

kubectl -n "$NAMESPACE" get pods -o json \
  | jq -r '.items[] | select(.status.containerStatuses[0].ready==false) | .metadata.name' \
  | while read -r pod; do
      echo "── $pod ──"
      kubectl -n "$NAMESPACE" logs "$pod" --tail=20
    done

The diff is small but real: set -euo pipefail, a parameter for the namespace, a one-line comment, a header for each pod. None of those need an LLM, and once committed, every future run is reproducible without using a request.

What stays in CliAI's lane

Don't graduate everything. The one-time tasks — onboarding into a new repo, debugging an incident, reading a stranger's config — are exactly the ad-hoc work CliAI was built for. If you script those prematurely, you've added clutter to the repo without adding leverage.

See also