{"id":35550617,"url":"https://github.com/jlevy/tryscript","last_synced_at":"2026-01-13T23:01:40.589Z","repository":{"id":331311480,"uuid":"1126125106","full_name":"jlevy/tryscript","owner":"jlevy","description":"Golden testing for CLI applications","archived":false,"fork":false,"pushed_at":"2026-01-08T19:07:17.000Z","size":951,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-13T19:44:37.571Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jlevy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-01T07:01:17.000Z","updated_at":"2026-01-08T19:07:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jlevy/tryscript","commit_stats":null,"previous_names":["jlevy/tryscript"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jlevy/tryscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Ftryscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Ftryscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Ftryscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Ftryscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlevy","download_url":"https://codeload.github.com/jlevy/tryscript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlevy%2Ftryscript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-04T07:01:43.060Z","updated_at":"2026-01-13T23:01:40.584Z","avatar_url":"https://github.com/jlevy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tryscript\n\n[![CI](https://github.com/jlevy/tryscript/actions/workflows/ci.yml/badge.svg)](https://github.com/jlevy/tryscript/actions/runs/20828507667)\n[![Coverage](https://raw.githubusercontent.com/jlevy/tryscript/main/badges/packages/tryscript/coverage-total.svg)](https://github.com/jlevy/tryscript/actions/runs/20828507667)\n[![npm version](https://img.shields.io/npm/v/tryscript)](https://www.npmjs.com/package/tryscript)\n[![X Follow](https://img.shields.io/twitter/follow/ojoshe)](https://x.com/ojoshe)\n\nGolden testing for CLI applications - a TypeScript port of [trycmd](https://github.com/assert-rs/trycmd).\n\n\u003e [!NOTE]\n\u003e 100% of the code and specs in this repository were written by Claude Code.\n\u003e The design and management and prompting was by me ([jlevy](https://github.com/jlevy)) supported by  the workflows, agent rules,\n\u003e and other research docs in [Speculate](https://github.com/jlevy/speculate).\n\u003e \n\u003e You can see what you think, but I find the code quality higher than most agent-written code I've\n\u003e seen because of the spec-driven process.\n\u003e You can review the architecture doc and all of the specs all of the specs in [docs/project](docs/project).\n\u003e The general research, guideline, and rules docs I use are in [docs/general](docs/general).\n\n## What It Does\n\nWrite CLI tests as Markdown. tryscript runs commands, captures output, and compares against expected results. Tests become documentation; documentation becomes tests.\n\n````markdown\n---\nenv:\n  NO_COLOR: \"1\"\nsandbox: true\n---\n\n# Test: CLI help\n\n```console\n$ my-cli --help\nUsage: my-cli [options] \u003ccommand\u003e\n\nOptions:\n  --version  Show version\n  --help     Show this help\n...\n? 0\n```\n\n# Test: Version output\n\n```console\n$ my-cli --version\nmy-cli v[..]\n? 0\n```\n\n# Test: Error handling\n\n```console\n$ my-cli unknown-command 2\u003e\u00261\nError: unknown command 'unknown-command'\n? 1\n```\n\n# Test: Check output file contents\n\n```console\n$ my-cli process data.json \u003e output.txt \u0026\u0026 grep \"success\" output.txt\n[..]success[..]\n? 0\n```\n````\n\nThe `[..]` matches any text on that line. The `...` matches zero or more lines. These \"elision patterns\" let tests handle dynamic output gracefully. Any shell command works - pipes, redirects, environment variables, etc.\n\n## Quick Start\n\n```bash\n# Install\npnpm add -D tryscript\n\n# For coverage support (optional)\npnpm add -D c8\n\n# For accurate line counts when merging with vitest (optional)\npnpm add -D c8 monocart-coverage-reports\n\n# Run tests\nnpx tryscript run tests/\n\n# Update expected output when behavior changes\nnpx tryscript run --update tests/\n```\n\n## Features\n\n- **Markdown format** - Tests are readable documentation\n- **Elision patterns** - Handle variable output: `[..]`, `...`, `[CWD]`, `[ROOT]`, `[EXE]`\n- **Custom patterns** - Define regex patterns for timestamps, versions, UUIDs\n- **Update mode** - Regenerate expected output with `--update`\n- **Sandbox mode** - Isolate tests in temp directories\n- **Code coverage** - Track coverage from subprocess execution with `--coverage` (experimental; use `--coverage-monocart` for best accuracy)\n\n## CLI Reference\n\n```bash\ntryscript run [files...]          # Run golden tests\ntryscript coverage \u003ccommands...\u003e  # Run commands with merged coverage\ntryscript docs                    # Show syntax quick reference\ntryscript readme                  # Show this documentation\ntryscript --help                  # Show all options\n```\n\nFor complete syntax reference, run `tryscript docs` or see the [reference documentation](https://github.com/jlevy/tryscript/blob/main/docs/tryscript-reference.md).\n\n### Common Options\n\n| Option | Description |\n| --- | --- |\n| `--update` | Update test files with actual output |\n| `--fail-fast` | Stop on first failure |\n| `--filter \u003cregex\u003e` | Filter tests by name |\n| `--verbose` | Show detailed output |\n| `--coverage` | Collect code coverage (requires c8) |\n| `--coverage-monocart` | Use monocart for accurate line counts (requires monocart-coverage-reports) |\n| `--coverage-exclude-node-modules` | Exclude node_modules from coverage (default: true) |\n| `--coverage-exclude \u003cpattern\u003e` | Exclude patterns from coverage |\n\n\u003e **Note**: Coverage features are experimental. See the [reference documentation](packages/tryscript/docs/tryscript-reference.md#code-coverage) for details on merged coverage, monocart integration, and sourcemap requirements.\n\n## Development\n\n```bash\n# Clone and install\ngit clone https://github.com/jlevy/tryscript.git\ncd tryscript\npnpm install\n\n# Build and test\npnpm build\npnpm test\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlevy%2Ftryscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlevy%2Ftryscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlevy%2Ftryscript/lists"}