# Build the main CLI
go build ./cmd/restish
# Build plugins
go build ./cmd/restish-bulk
go build ./cmd/restish-csv
go build ./cmd/restish-mcp
go build ./cmd/restish-pkcs11
# Regenerate docs-site regions derived from CLI help and flags.
# Run --write after changing CLI surface (commands, flags, help text);
# CI fails on stale regions via --check.
go run ./cmd/restish-docgen --write
go run ./cmd/restish-docgen --check
# Validate the docs site after changes under site/ (quick check)
hugo --source site --quiet
# Full CI parity for the docs job (npm ci needed once; social-images parses
# content front matter and can fail independently of Hugo)
npm --prefix site ci
npm --prefix site run social-images
hugo --source site --quiet --gc --minify --cacheDir /tmp/hugo_cache
# Validate docs examples and links (CI runs both)
scripts/check-doc-examples.rb
scripts/check-doc-links.rbRun the narrowest meaningful test first, then widen:
go test ./internal/cli/... # or another touched package
go test ./... # fast suite; default development loop
go test -tags=integration ./... # full suite, including slow plugin and CLI
# integration tests; run before commits that
# touch CLI/plugin behavior and final commits
go test -race ./... # when touching concurrency, streaming,
# subprocess lifecycle, or shared buffersCI requires all of: go test ./..., go test -tags=integration ./..., building all five binaries above, go run ./cmd/restish-docgen --check, scripts/check-doc-links.rb, scripts/check-doc-examples.rb, and the docs-site build (npm --prefix site ci, npm --prefix site run social-images, then Hugo). A weekly job also executes every docs restish-example live against api.rest.sh.
go build -o /tmp/restish ./cmd/restish
/tmp/restish api.rest.sh/types # safe public test APIRestish is a CLI for interacting with REST-ish HTTP APIs. It generates commands from OpenAPI 3.x specs and supports generic HTTP verbs, content negotiation, authentication, pagination, caching, filtering, and plugins.
The core design is a CLI struct in internal/cli/cli.go that owns all state — I/O handles, config, content registry, spec loaders, link parsers, formatters, and plugins. Tests instantiate CLI directly with bytes.Buffer for I/O and httptest.Server for HTTP.
Entry point: cmd/restish/main.go creates a CLI and calls Run(os.Args).
internal/cli— command tree, flags, generated commands, pagination, help; theCLIstruct lives hereinternal/request— HTTP execution: retries, redirects, TLS, redactioninternal/spec,internal/openapi— spec discovery/loading/caching and OpenAPI → command generationinternal/output— response formatters (JSON, YAML, tables, TOON, …); regression fixtures intestdata/auth,config— public Go API for Restish config structs/loading and OAuth token cache sharinginternal/auth,internal/secrets— bundled auth handler implementations; credential-recognition allow-listsinternal/config— v1 migration, embedder read helpers, comment-preserving JSONC editsinternal/fileutil— internal file locking and atomic-write helpersinternal/content,internal/input,internal/filter,internal/hypermedia— content negotiation, shorthand request bodies, shorthand/jq filtering, link parsinginternal/cache— size-bounded disk cache for specs and responsesinternal/plugin,internal/procutil— plugin discovery/manifests; subprocess lifecycleplugin/(top level) — public plugin API contract; wire compatibility is a public promise
docs/design/ contains architectural design documents covering each subsystem in detail. Read these before making changes to core systems. Before writing a significant new feature or change, write a design doc and get feedback. See docs/design/README.md for a list of design docs and what they cover.
site/ contains the source for the documentation site at https://rest.sh/. This is user-facing documentation and should be updated with new features and changes.
TODO.md and review.md are local working files for planning, code reviews, and in-progress implementation notes only. They must never be committed to git history. Keep them ignored/untracked, and if they are accidentally staged, unstage them before committing.
Keep review and fix loops scoped to the current PR's behavioral surface unless the user explicitly asks for broader cleanup. After substantial review loops, do a simplification pass before final handoff: reduce repeated scaffolding, table-drive genuinely similar cases, and consolidate helpers where that preserves readability. Do not shrink a PR by deleting important coverage or making security/auth/cache behavior harder to audit.
Use Conventional Commits for all commits:
<type>(optional-scope): <description>
Prefer these types: feat, fix, docs, test, refactor, perf, build, ci, chore, and security. Use a concise imperative description, such as fix: preserve JSONC edit directory modes or docs: update plugin quickstart.
Invoke these skills when relevant:
rsh-productfor shaping features, CLI UX, naming, scope, and compatibility decisions before or during implementationrsh-reviewfor code review feedback on code changesrsh-testfor writing concise, behavior-focused Restish testsrsh-docsfor writing and maintaining documentation, blog posts, and design docsrsh-simplifyfor approved simplification and dead-code cleanup workrsh-release-qafor release readiness QA frommain
If you find a stale fact in this file or a skill — a command that fails, a path or package that no longer exists — fix it as part of your change.