Skip to content

dev: pnpm dev transcript shows a CLI change before and after #792

Closed

Description

@allisonmahmood

A CLI change has no screenshots to show. Its output, flags, errors and exit codes are its interface, and agents read them more than people do (ADR-0004). Reviewing one today means running it.

Fix

pnpm dev transcript <script> [--base <ref>] [--scenario <name>] [--timeout <s>] [--pr <number>] [--json]

The script

  • Format. A plain text file. Each non-blank line is a command, and a # line captions the commands after it.
  • Where it runs. On each side's evidence instance (dev: PRs show what changed, with before/after screenshots and recordings #725), on fresh scenario data, as that instance's signed-in CLI.
  • How a line runs. Each line runs in its own non-interactive bash -c, with stdin closed, from the environment's agent workspace.
    • Nothing carries between lines except files, so chain with && on one line.
  • Failures and timeouts.
    • A non-zero exit is recorded and the script continues, because refusals are often the point.
    • A line past its timeout (60 s by default) is killed and recorded as timed out.
    • The command fails only when the runner can't run, or when a line times out on the after side.

Closed environment

  • Lines get the runner's closed environment, with nothing inherited from the developer's shell. The side's bin comes first on PATH, and its PATCHY_STATE_DIR is set.
  • An ambient PATCHY_API_TOKEN or PATCHY_API_URL would otherwise override the instance's login.
  • The agent workspace's rules hold: no patchy setup, and no global installs.

What each line records: exit code, stdout, stderr and time.

In the PR

  • For each line, the after side's output and, when before differs, a diff.
  • Identical output says "No change". Long output is cut with a note.

Normalize narrowly

  • Before comparing, replace only each instance's origin and filesystem paths, and say so.
  • Leave every other difference visible: an id or time that changes may be the change.

One sanitizer, shared with #793

It collects secrets for the whole run and keeps every value it has seen until the last write. It collects from:

  • both instances' CLI state, read before the run and after every line, so a login code that a later patchy logout clears is still known;
  • anything shaped like a machine token (pp_…);
  • the values of any variable the runner passes whose name marks it as secret.

It runs over everything before it's written: commands, outputs, errors, the JSON and the PR section. The section says which sources were redacted.

Docs and skills

Done means

  • A CLI change's PR shows the lines it changed, before and after, with nothing secret in it.
  • A script that logs in and then logs out publishes no login code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cienhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions