| 196 | } |
| 197 | |
| 198 | func exportReadme() string { |
| 199 | var b strings.Builder |
| 200 | b.WriteString("# ghmock export\n\n" + |
| 201 | "- `report.txt`: what each `ghmock run` printed, after its full command and the schema files it checked against.\n" + |
| 202 | "- `requests.jsonl`: every request gh made, one JSON object per line, with the response gh got after trimming.\n" + |
| 203 | "- `responses.json`: the stored responses when this was exported. Responses marked `\"off_schema\": true` were saved without passing the schema check.\n" + |
| 204 | "- `runs.jsonl`: each run's command, gh's output and exit code, and the SHA-256 of each schema file.\n" + |
| 205 | "- `git/`, when present: the prepared fixture, each run's starting state and independent per-build workspaces. Git worktree links are relocated for this export. Each workspace's `commands.jsonl` records Git setup or inspection commands, output and requests.\n\n" + |
| 206 | "- `config/`, when present: the supplied configuration before each run and each build's resulting configuration. These files include fixture credentials; supply synthetic credentials only. Paths in `config_baseline` and each result's `config.directory` are relative to this export.\n\n" + |
| 207 | "Archive exports preserve hidden Git metadata and use relative worktree links. Extract into an empty folder before inspection. Linked worktrees in portable archives need Git 2.48 or newer. Directory exports are prepared for their original destination.\n\n" + |
| 208 | "To read the requests with ghmock:\n\n" + |
| 209 | "```sh\nGHMOCK_DIR=<this folder> ghmock log --all --full\n```\n\n" + |
| 210 | "To inspect retained Git state, select a build by its one-based position in the run:\n\n" + |
| 211 | "```sh\nGHMOCK_DIR=<this folder> ghmock git --run latest --build 1 --in <checkout> -- status --porcelain=v1\n" + |
| 212 | "GHMOCK_DIR=<this folder> ghmock git --run latest --before --in <checkout> -- status --porcelain=v1\n```\n" + |
| 213 | "\nThese are real repositories containing untrusted fixture data. Inspect their configuration and hooks before running Git commands; Git can execute programs as well as modify the repositories. No GitHub API mutation is automatically mirrored into a Git repository.\n") |
| 214 | if rev := buildRevision(); rev != "" { |
| 215 | fmt.Fprintf(&b, "\nMade by ghmock from cli/cli %s.\n", rev) |
| 216 | } |
| 217 | return b.String() |
| 218 | } |
| 219 | |
| 220 | // buildRevision is the commit ghmock was built from, if Go recorded it. |
| 221 | func buildRevision() string { |