{"id":50289722,"url":"https://github.com/fentas/atty","last_synced_at":"2026-05-28T05:04:11.990Z","repository":{"id":357180469,"uuid":"1235776300","full_name":"fentas/atty","owner":"fentas","description":"Suckless-style PTY proxy in Zig that drops an LLM exec dialog, atuin autosuggest, and guardrail confirmations between your terminal and shell.","archived":false,"fork":false,"pushed_at":"2026-05-26T06:49:49.000Z","size":7462,"stargazers_count":2,"open_issues_count":4,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-26T07:23:54.831Z","etag":null,"topics":["access-control","alacritty","atuin","autocomplete","bash","chat","chatgpt","claude","cli","ghostty","kitty-keyboard-protocol","llm","osc-133","productivity","pty","shell","suckless","terminal","zig"],"latest_commit_sha":null,"homepage":"https://atty.sh","language":"Zig","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/fentas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security-guard-design.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"fentas"}},"created_at":"2026-05-11T16:37:25.000Z","updated_at":"2026-05-26T06:49:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fentas/atty","commit_stats":null,"previous_names":["fentas/atty"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/fentas/atty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fentas%2Fatty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fentas%2Fatty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fentas%2Fatty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fentas%2Fatty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fentas","download_url":"https://codeload.github.com/fentas/atty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fentas%2Fatty/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33594863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["access-control","alacritty","atuin","autocomplete","bash","chat","chatgpt","claude","cli","ghostty","kitty-keyboard-protocol","llm","osc-133","productivity","pty","shell","suckless","terminal","zig"],"created_at":"2026-05-28T05:04:04.609Z","updated_at":"2026-05-28T05:04:11.984Z","avatar_url":"https://github.com/fentas.png","language":"Zig","funding_links":["https://github.com/sponsors/fentas"],"categories":[],"sub_categories":[],"readme":"\u003ch3 align=\"center\"\u003e\n\t\u003cimg width=\"240\" alt=\"atty\" src=\"./logo.svg\"\u003e\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/fentas/atty/stargazers\"\u003e\n\t\t\u003cimg alt=\"Stargazers\" src=\"https://img.shields.io/github/stars/fentas/atty?style=for-the-badge\u0026logo=starship\u0026color=C9CBFF\u0026logoColor=D9E0EE\u0026labelColor=302D41\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/fentas/atty/releases/latest\"\u003e\n\t\t\u003cimg alt=\"Latest release\" src=\"https://img.shields.io/github/v/release/fentas/atty?style=for-the-badge\u0026logo=github\u0026color=F2CDCD\u0026logoColor=D9E0EE\u0026labelColor=302D41\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://github.com/fentas/atty/actions/workflows/ci.yml\"\u003e\n\t\t\u003cimg alt=\"CI\" src=\"https://img.shields.io/github/actions/workflow/status/fentas/atty/ci.yml?style=for-the-badge\u0026logo=github\u0026logoColor=D9E0EE\u0026labelColor=302D41\u0026color=A6E3A1\u0026label=ci\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://atty.sh\"\u003e\n\t\t\u003cimg alt=\"atty.sh\" src=\"https://img.shields.io/badge/site-atty.sh-89DCEB?style=for-the-badge\u0026logo=googlechrome\u0026logoColor=D9E0EE\u0026labelColor=302D41\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://ziglang.org/\"\u003e\n\t\t\u003cimg alt=\"Zig 0.16\" src=\"https://img.shields.io/badge/zig-0.16.0-F2CDCD?style=for-the-badge\u0026logo=zig\u0026logoColor=D9E0EE\u0026labelColor=302D41\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u0026nbsp;\n\n\u003cp align=\"left\"\u003e\n\n`atty` is a **Suckless-style PTY proxy** in Zig. It sits between your terminal emulator (Ghostty, Alacritty, kitty…) and your shell, and composes its middleware **at compile time** instead of loading plugins at runtime. Edit `src/config.zig`, recompile — that is the entire configuration model.\n\nFeatures:\n\n- **Comptime module dispatch** — `inline for` over your config tuple; disabled modules contribute *zero bytes* to the binary\n- **Atuin autosuggestions** — fish-style dim/italic ghost text from your shell history, via an async worker thread\n- **Dangerous-command guardrail** — swallows Enter on `rm -rf /`, `dd if=…`, `… | sh`, fork bombs, and friends, then waits for a confirm\n- **Five hooks per module**: `attach` / `detach` / `onInput` / `onOutput` / `provideGhostText` / `onTick` — implement what you need, the rest is statically dropped\n- **Single static binary** — musl-linked, no libutil, no runtime deps; `ghcr.io/fentas/atty:latest` is ~14 MB\n- **Zero-allocation hot path** — per-keystroke dispatch does no heap traffic; Atuin lookups happen on a worker thread\n\n\u003c/p\u003e\n\n\u0026nbsp;\n\n#### Disclaimer\n\nAn LLM primarily generated this code and has not yet been fully reviewed or tested by a human maintainer. It may contain bugs, security issues, or non-idiomatic patterns.\n\n\u0026nbsp;\n\n### 🐚 What it looks like\n\n```text\n$ git checkout featu re/auth-refactor                     ← dim italic ghost text\n                    ^^^^^^^^^^^^^^^^^\n\n$ rm -rf /home/work/\n! atty guardrail: rm -rf invocation [user]\n        line: rm -rf /home/work/\n        press Enter again to confirm, any other key to cancel.\n```\n\nA live, animated demo lives on [atty.sh](https://atty.sh).\n\n\u0026nbsp;\n\n### 🚀 Install\n\nTwo installers, two philosophies. Pick one.\n\n```bash\n# 🛠  The Suckless way — get the source, edit src/config.zig, compile.\n#    Bootstraps Zig if you don't have it. Prompts before opening config.\ncurl -fsSL https://get.atty.sh | sh\n\n# 📦 Just give me the binary — no toolchain, no source, default modules.\n#    Resolves arch, verifies sha256, chmods, hints at $PATH.\ncurl -fsSL https://bin.atty.sh | sh\n```\n\nEither one installs to `~/.local/bin/atty` by default. Both honor\n`INSTALL_DIR=…`. The binary installer additionally honors\n`ATTY_VERSION=…`; the source installer honors `ATTY_SRC=…`,\n`ATTY_NONINTERACTIVE=1`, and `REPO_URL=…`.\n\nFor container use:\n\n```bash\ndocker pull ghcr.io/fentas/atty:latest\n```\n\nSupported pre-built targets: `linux-x86_64`, `linux-aarch64`\n(musl-static). The source flow works anywhere Zig 0.16 does.\n\nThen make it your terminal's startup command. Ghostty\n(`~/.config/ghostty/config`):\n\n```\n# Ghostty starts atty, which then starts your shell.\ncommand = atty bash\n```\n\nPin the shell explicitly (`atty bash`/`atty zsh`/…) in your terminal\nconfig rather than relying on `$SHELL` — when the terminal is what\nspawns atty, the environment is minimal and `$SHELL` may not yet be\nset. Inside the shell that atty spawns, your `.bashrc`/`.zshrc` will\nof course see `$SHELL` normally.\n\nOr invoke ad-hoc:\n\n```bash\natty                       # spawn $SHELL through the proxy\natty bash                  # spawn bash explicitly\natty bash -l               # bash with -l\natty zsh -c 'echo hi'      # zsh -c 'echo hi'\n```\n\nThe first non-flag positional is the shell binary; everything after it\nis passed to that shell verbatim — same convention as `env(1)` or\n`sudo(1)`. Use `--` only if your shell's name starts with a dash.\n\n#### Detecting atty from your shell\n\natty injects three env vars into every spawned shell. Use them in your\n`.bashrc`/`.zshrc` to avoid double-wrapping:\n\n```bash\n# Only run atty if we aren't already inside an atty session,\n# and only if the binary is actually on PATH (so a missing install\n# never locks you out of your shell).\nif [[ -z \"${ATTY}\" ]] \u0026\u0026 command -v atty \u003e/dev/null; then\n    exec atty bash\nfi\n```\n\n| Variable       | Value                                |\n|----------------|--------------------------------------|\n| `ATTY`         | `1`                                  |\n| `ATTY_PID`     | pid of the atty proxy (parent)       |\n| `ATTY_VERSION` | semver string (e.g. `0.1.0`)         |\n\nThe `command -v` guard is a footgun saver: if atty disappears (uninstall,\nupgrade gone wrong, fresh machine), your shell still starts normally\ninstead of bailing on `exec` failure.\n\n\u0026nbsp;\n\n### 🛠 Configure\n\n`atty` has no runtime config file. dwm-style two-file split:\n\n- [`src/config.def.zig`](src/config.def.zig) — committed template with commented examples (atty maintains).\n- **`src/config.zig`** — your file. Gitignored. `build.zig` copies the template across on first build.\n- [`src/defaults.zig`](src/defaults.zig) — atty-shipped value for every knob.\n\nEdit `src/config.zig`. Recompile. Your edits never conflict on `git pull` because the file isn't tracked, and your config only contains what you override — every other knob falls through to `defaults.zig`, so new tunables added upstream just appear.\n\n```zig\nconst atty = @import(\"atty\");\n\n// Pick your modules. Default = { guardrail, history } — dependency-free.\npub const modules = .{\n    atty.modules.guardrail.configure(.{}),\n    atty.modules.atuin.configure(.{\n        .suggestion_ttl_ms  = 0,          // 0 = fish-style (no fade)\n        .sync_after_records = 10,\n    }),\n    atty.modules.history.configure(.{}),  // shell-native fallback\n};\n\n// Override the visual style if you don't want the dim-only default.\npub const ghost: atty.Ghost = .{ .style = atty.style.presets.muted_italic };\n\n// Override the accept keys if Right / End / Ctrl+F isn't what you want.\npub const keymap: atty.Keymap = .{\n    .bindings = \u0026.{\n        .{ .bytes = atty.keymap.key(\"Tab\"), .action = .ghost_accept },\n    },\n};\n```\n\nEvery subsystem (`proxy`, `ghost`, `terminal`, `keymap`, `statusbar`) is a struct with per-field defaults — your `pub const xxx: atty.Xxx = .{ … }` only spells out the fields you want different. Anything you don't declare picks up `defaults.zig`.\n\nTo track a config outside the repo:\n\n```bash\nmake CONFIG=/path/to/mine.zig build\n# or\nzig build -Dconfig=/path/to/mine.zig\n```\n\n\u0026nbsp;\n\n### ✍️ Writing a module\n\nA module is a Zig type — typically returned from `configure(comptime cfg) type` — with some subset of these decls:\n\n| Hook                 | Called when                                | Hot path |\n|----------------------|--------------------------------------------|----------|\n| `attach(allocator)`  | once at startup                            | no       |\n| `detach(rt)`         | once at shutdown                           | no       |\n| `onInput`            | every keystroke from the user              | **yes**  |\n| `onOutput`           | every chunk from the shell                 | **yes**  |\n| `onLineCommit`       | Enter pressed on a non-empty, certain line | no       |\n| `provideGhostText`   | when atty wants to render an overlay       | yes      |\n| `onTick`             | on poll() timeout (default 100 ms)         | no       |\n\nMinimal example — uppercase every keystroke:\n\n```zig\npub fn configure(comptime _: Config) type {\n    return struct {\n        pub const Runtime = struct { buf: [256]u8 = undefined };\n        pub fn attach(_: std.mem.Allocator) !Runtime { return .{}; }\n        pub fn detach(_: *Runtime) void {}\n        pub fn onInput(rt: *Runtime, _: *m.Context, in: []const u8) m.Error!m.Action {\n            for (in, 0..) |b, i| rt.buf[i] = std.ascii.toUpper(b);\n            return .{ .replace = rt.buf[0..in.len] };\n        }\n    };\n}\n```\n\nFull walkthrough: [docs/modules.md](docs/modules.md) or [atty.sh/modules](https://atty.sh/modules/).\n\n\u0026nbsp;\n\n### 🐳 Using Docker\n\n```bash\n# Run atty inside a container\ndocker run --rm -it ghcr.io/fentas/atty:latest\n\n# Copy the binary out of the image\ndocker create --name atty-tmp ghcr.io/fentas/atty:latest \u0026\u0026 \\\n  docker cp atty-tmp:/usr/local/bin/atty ./atty \u0026\u0026 \\\n  docker rm atty-tmp\n```\n\nOr use it as a base layer in your own image:\n\n```dockerfile\nFROM alpine:3.20\nCOPY --from=ghcr.io/fentas/atty:latest /usr/local/bin/atty /usr/local/bin/atty\nENTRYPOINT [\"atty\"]\n```\n\nThe image is multi-arch (`linux/amd64`, `linux/arm64`) and the binary is musl-static.\n\n\u0026nbsp;\n\n### 📦 Built-in modules\n\n| Module                                                | Hook surface                                              | Purpose                                                                |\n|-------------------------------------------------------|-----------------------------------------------------------|------------------------------------------------------------------------|\n| [`guardrail`](src/modules/guardrail.zig)              | `onInput`                                                 | Confirm-on-Enter for `rm -rf /`, `dd`, `mkfs`, fork bombs, curl-pipe-sh |\n| [`history`](src/modules/history.zig) *(default)*      | `onInput`, `onLineCommit`, `provideGhostText`, `onTick`   | Shell-native suggestions from `~/.bash_history` / `~/.zsh_history`     |\n| [`atuin`](src/modules/atuin.zig) *(opt-in)*           | `onInput`, `onLineCommit`, `provideGhostText`, `onTick`   | Fish-style autosuggestions from your Atuin history + record on Enter   |\n\nAdd your own under `src/modules/` and wire it into `config.modules`. Reference docs: [atty.sh/providers](https://atty.sh/providers/).\n\n\u0026nbsp;\n\n### 🧪 Build from source\n\n```bash\nmise use zig@0.16.0           # any other Zig 0.16.0 install also works\nzig build                     # → ./zig-out/bin/atty\nzig build test --summary all  # 33 unit tests\nzig build itest --summary all # PTY round-trip integration test\n```\n\nOr via Make:\n\n```bash\nmake build         # ReleaseSafe\nmake test itest\nmake install       # → ~/.local/bin/atty\nmake docker        # local image\nmake docker-binary # build in docker, copy binary to ./dist/atty\n```\n\n`make help` lists every target.\n\n\u0026nbsp;\n\n### 🎯 Roadmap\n\n- [ ] OSC 133 prompt-marker awareness (drop guesswork from the line-state model)\n- [ ] Atuin daemon socket backend (replace the subprocess fallback once IPC stabilises)\n- [ ] Bracketed-paste detection (suppress ghost text during a paste burst)\n- [ ] Ring buffer for `onOutput` parsers that span read boundaries\n- [ ] BSD / macOS support (currently Linux-only; PTY dance needs `ioctl(TIOCPTYGRANT)` glue on Darwin)\n\n\u0026nbsp;\n\n### 🤝 Contributing\n\nPRs welcome. The flow is **feat/fix conventional-commit PR → release-please opens a release PR → merging the release PR cuts a tag and ships binaries**. Details and PR-title rules in [CONTRIBUTING.md](CONTRIBUTING.md).\n\nBefore pushing: `make fmt \u0026\u0026 make test`.\n\n\u0026nbsp;\n\n### 📜 License\n\n[MIT](LICENSE). Use it, ship it, fork it, sell it — keep the copyright notice intact.\n\n\u0026nbsp;\n\n### ❤️ Gratitude\n\n- [Atuin](https://github.com/atuinsh/atuin) — the history daemon this proxies for.\n- [Suckless](https://suckless.org) — for the *config.h, recompile, ship* aesthetic this whole project apes.\n- [Ghostty](https://ghostty.org), [Alacritty](https://alacritty.org), [kitty](https://sw.kovidgoyal.net/kitty/) — the terminal emulators atty plays in front of.\n- [Zig](https://ziglang.org) — for making `inline for` + `@hasDecl` a viable plugin model.\n- Inspiration on the README treatment and conventional-commit release flow lifted from [fentas/b](https://github.com/fentas/b).\n\n\u0026nbsp;\n\n\u003cp align=\"center\"\u003eCopyright \u0026copy; 2026-present \u003ca href=\"https://github.com/fentas\" target=\"_blank\"\u003efentas\u003c/a\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003ca href=\"https://atty.sh\"\u003e\u003cimg src=\"https://img.shields.io/static/v1.svg?style=for-the-badge\u0026label=atty\u0026message=.sh\u0026logoColor=d9e0ee\u0026colorA=302d41\u0026colorB=89dceb\"/\u003e\u003c/a\u003e\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffentas%2Fatty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffentas%2Fatty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffentas%2Fatty/lists"}