|
4 | 4 |
|
5 | 5 | # Hack |
6 | 6 |
|
7 | | -Hack is a local-first developer runtime for repo environments. |
8 | | - |
9 | | -It gives each project a predictable local runtime, stable HTTPS hostnames, resolved environment |
10 | | -variables, persistent work sessions, diagnostics, and optional git-backed tickets without requiring a |
11 | | -hosted Hack service. |
12 | | - |
13 | | -## What Hack Does |
14 | | - |
15 | | -Hack is built for local development on machines that run many projects, branches, agents, and |
16 | | -supporting services at the same time. |
17 | | - |
18 | | -- Start and stop project runtimes with `hack up`, `hack down`, and `hack restart`. |
19 | | -- Open stable local HTTPS URLs like `https://myapp.hack` with `hack open`. |
20 | | -- Route service subdomains through local Caddy and trusted development TLS. |
21 | | -- Resolve env overlays and secrets from `.hack/` and inject them into compose, host commands, and sessions. |
22 | | -- In a linked git worktree, `hack up` defaults to a branch instance named after the worktree's git |
23 | | - branch (opt out with `worktree.auto_branch=false`, or target one explicitly with `--branch <name>`). |
24 | | -- Keep tmux-backed project workspaces alive with `hack session`. |
25 | | -- Diagnose Docker, DNS, TLS, env, lifecycle, and stale runtime state with `hack doctor` / |
26 | | - `hack doctor --fix`. |
27 | | -- Script and automate against a stable surface: `--no-interactive` (or `HACK_NO_INTERACTIVE=1`) |
28 | | - never prompts, and `up`/`down`/`restart`/`doctor --json` emit a `{ok, data | error: {code, |
29 | | - message}}` envelope; `NO_COLOR` disables ANSI output. |
30 | | -- Track optional repo-local work with the opt-in `hack tickets` extension. |
31 | | -- Use a slim macOS companion for local project status, controls, logs, and quick actions. |
32 | | - |
33 | | -Hack v3 is intentionally self-contained. The supported product is the local CLI/runtime and macOS |
34 | | -companion. Hosted auth, account/org/team management, the web dashboard, built-in GitHub workflows, |
35 | | -and built-in Linear sync are not part of the v3 product. |
36 | | - |
37 | | -## Install |
38 | | - |
39 | | -Homebrew: |
| 7 | +Run every project on your machine at once, each at its own local HTTPS URL. |
40 | 8 |
|
41 | 9 | ```bash |
42 | | -brew tap hack-dance/tap |
43 | | -brew install hack-dance/tap/hack |
| 10 | +cd any-repo && hack up |
| 11 | +# → https://myapp.hack is live, TLS trusted, env injected |
44 | 12 | ``` |
45 | 13 |
|
46 | | -Shell installer: |
| 14 | +Local development breaks down when one machine runs many things. Two projects fight |
| 15 | +over port 3000. A repo you haven't touched in a month needs an afternoon of |
| 16 | +archaeology to start. Secrets live in `.env` files passed around in Slack. Testing a |
| 17 | +PR means tearing down the branch you were working on. |
47 | 18 |
|
48 | | -```bash |
49 | | -curl -fsSL \ |
50 | | - https://github.com/hack-dance/hack/releases/latest/download/hack-install.sh \ |
51 | | - | bash |
52 | | -``` |
| 19 | +Hack fixes this by giving each repo a small committed config (`.hack/`) and running |
| 20 | +it against shared local infrastructure — Docker Compose for services, Caddy for DNS |
| 21 | +and trusted TLS. Nothing is hosted. Your machine is the platform. |
53 | 22 |
|
54 | | -Codex or managed container installer: |
55 | | - |
56 | | -```bash |
57 | | -curl -fsSL \ |
58 | | - https://github.com/hack-dance/hack/releases/latest/download/hack-codex-install.sh \ |
59 | | - | bash |
60 | | -``` |
61 | | - |
62 | | -## Quick Start |
63 | | - |
64 | | -Bootstrap the global local infrastructure once: |
65 | | - |
66 | | -```bash |
67 | | -hack global install |
68 | | -``` |
| 23 | +## What you get |
69 | 24 |
|
70 | | -Initialize a repo: |
| 25 | +**A real URL for every project.** `https://myapp.hack`, with per-service subdomains |
| 26 | +like `api.myapp.hack` and locally-trusted certificates. No ports to remember, no |
| 27 | +collisions, and OAuth-friendly alias hosts when a provider rejects `.hack`. |
71 | 28 |
|
72 | | -```bash |
73 | | -cd /path/to/project |
74 | | -hack init |
75 | | -``` |
| 29 | +**`hack up` is the whole answer to "how do I run this repo".** Services, env, |
| 30 | +lifecycle hooks, and host-side helpers (tunnels, SSO, proxies) are declared in |
| 31 | +`.hack/` and committed. Anyone who clones the repo — teammate or agent — is one |
| 32 | +command from a running environment. |
76 | 33 |
|
77 | | -Prefer an agent to drive setup? `hack init --with claude|codex|both` hands the onboarding prompt to |
78 | | -an agent CLI for a new repo; `hack agent onboard` does the same for an existing project. |
| 34 | +**Env that travels with the repo.** Values live in committed YAML; secrets are |
| 35 | +encrypted per-value, so they're safe to commit. One gitignored key decrypts them — |
| 36 | +linked worktrees inherit it automatically, CI passes `HACK_ENV_SECRET_KEY`. Scripts |
| 37 | +get injected env through `hack host exec` instead of reading `.env` files. |
79 | 38 |
|
80 | | -Run it: |
| 39 | +**Parallel everything.** Branch instances run side by side with their own URLs. In a |
| 40 | +linked git worktree, `hack up` automatically becomes a separate instance named after |
| 41 | +the branch — review a PR while your main checkout keeps running. |
81 | 42 |
|
82 | | -```bash |
83 | | -hack up --detach |
84 | | -hack open |
85 | | -hack logs --pretty |
86 | | -``` |
| 43 | +**Built for agents.** `hack init --with claude|codex` hands setup to an agent. |
| 44 | +Machine surfaces are first-class: `--json` envelopes with stable error codes, |
| 45 | +`--no-interactive`, and agent instructions that sync themselves into |
| 46 | +AGENTS.md/CLAUDE.md, Cursor rules, and Codex skills. |
87 | 47 |
|
88 | | -Stop it: |
| 48 | +## Install |
89 | 49 |
|
90 | 50 | ```bash |
91 | | -hack down |
| 51 | +brew tap hack-dance/tap |
| 52 | +brew install hack-dance/tap/hack |
92 | 53 | ``` |
93 | 54 |
|
94 | | -If anything looks wrong, start with: |
| 55 | +Or without Homebrew: |
95 | 56 |
|
96 | 57 | ```bash |
97 | | -hack doctor |
98 | | -hack doctor --fix |
| 58 | +curl -fsSL \ |
| 59 | + https://github.com/hack-dance/hack/releases/latest/download/hack-install.sh \ |
| 60 | + | bash |
99 | 61 | ``` |
100 | 62 |
|
101 | | -## Daily Commands |
| 63 | +## Quick start |
102 | 64 |
|
103 | 65 | ```bash |
104 | | -hack status |
105 | | -hack ps |
106 | | -hack restart |
| 66 | +hack global install # once per machine: DNS, TLS, proxy |
| 67 | +cd /path/to/project |
| 68 | +hack init # or: hack init --with claude |
| 69 | +hack up --detach |
107 | 70 | hack open |
108 | | -hack logs --pretty |
109 | | -hack logs <service> |
110 | | -hack exec <service> -- bun test |
111 | | -hack run <service> -- bun db:migrate |
112 | | -hack projects prune |
113 | 71 | ``` |
114 | 72 |
|
115 | | -`hack projects prune` removes stale entries from the local project registry and stops orphaned |
116 | | -containers. |
117 | | - |
118 | | -Host-side commands can use the same resolved project env: |
119 | | - |
120 | | -```bash |
121 | | -hack host exec --scope api -- bun test |
122 | | -hack host shell --env qa --scope api |
123 | | -``` |
124 | | - |
125 | | -Persistent workspaces: |
| 73 | +When something looks wrong: |
126 | 74 |
|
127 | 75 | ```bash |
128 | | -hack session |
129 | | -hack session start <project> |
130 | | -hack session exec <workspace> "bun test" |
| 76 | +hack doctor |
| 77 | +hack doctor --fix |
131 | 78 | ``` |
132 | 79 |
|
133 | | -Optional repo-local tickets (opt-in extension, not part of default agent instructions — `hack tickets |
134 | | -setup` is the one subcommand that bypasses the enable check and auto-enables the extension): |
| 80 | +## Everyday commands |
135 | 81 |
|
136 | 82 | ```bash |
137 | | -hack tickets setup |
138 | | -hack tickets create --title "Fix lifecycle cleanup" |
139 | | -hack tickets list |
140 | | -hack tickets show T-00001 |
141 | | -hack tickets status T-00001 in_progress |
142 | | -``` |
143 | | - |
144 | | -## Env And Secrets |
145 | | - |
146 | | -Hack uses YAML env files in `.hack/` as the source of truth: |
147 | | - |
148 | | -```text |
149 | | -.hack/hack.env.default.yaml |
150 | | -.hack/hack.env.<overlay>.yaml |
151 | | -.hack/hack.env.local.yaml |
152 | | -.hack/hack.env.<overlay>.local.yaml |
153 | | -``` |
154 | | - |
155 | | -Shared files can be committed. `*.local.yaml` files are worktree-local overrides. Hack owns a |
156 | | -committed `.hack/.gitignore` that keeps machine-local generated files (`.internal/`, `.branch/`, |
157 | | -`.env`, `.env.state.json`, `hack.env*.local.yaml`) out of git; it self-heals on `init`/`up`, and if |
158 | | -generated files ever leak into git, `hack doctor --fix` untracks them (files stay on disk). |
159 | | - |
160 | | -Runtime commands read the YAML model directly. Use `hack env materialize` only when an external tool |
161 | | -needs a compatibility `.hack/.env` file on disk. |
162 | | - |
163 | | -Secret key lookup is local-first: |
164 | | - |
165 | | -1. current checkout `.hack.secret.key` |
166 | | -2. shared key under the git common dir for linked worktrees |
167 | | -3. key inherited from the primary checkout's `.hack.secret.key` (linked worktrees) |
168 | | -4. `HACK_ENV_SECRET_KEY` |
169 | | - |
170 | | -Use `HACK_ENV_SECRET_KEY` in CI and managed containers instead of copying `.hack.secret.key` into an |
171 | | -image. |
172 | | - |
173 | | -Read more in [Env & secrets](./docs/env.md). |
174 | | - |
175 | | -## Lifecycle Processes |
176 | | - |
177 | | -Projects often need host-side setup before the compose stack starts: AWS SSO, SSM tunnels, local |
178 | | -proxies, database forwards, or one-off bootstrap commands. |
179 | | - |
180 | | -Put that work in `.hack/hack.config.json` under `lifecycle` or `startup` so Hack can run it |
181 | | -consistently during `hack up` and clean up the processes it owns during `hack down`. |
182 | | - |
183 | | -For fixed-port helpers, use `singleton.ports` and usually `onConflict: "adopt"` when an existing |
184 | | -healthy listener set should be reused instead of starting duplicate tunnel stacks. |
185 | | - |
186 | | -Read more in [Lifecycle](./docs/lifecycle.md). |
187 | | - |
188 | | -## Portable Containers |
189 | | - |
190 | | -Hack publishes runtime images to Docker Hub and GHCR. |
191 | | - |
192 | | -```bash |
193 | | -docker pull hackdance/hack:latest |
194 | | -docker pull hackdance/hack:slim |
| 83 | +hack status # what's running |
| 84 | +hack logs --pretty # tail logs (or: hack logs <service>) |
| 85 | +hack exec api -- bun test # run inside a running service |
| 86 | +hack run api -- bun db:migrate # one-off container command |
| 87 | +hack host exec --scope api -- bun db:seed # host command with injected env |
| 88 | +hack up --branch review # parallel branch instance |
| 89 | +hack session start myapp # persistent tmux workspace |
| 90 | +hack down |
195 | 91 | ``` |
196 | 92 |
|
197 | | -Use `hackdance/hack:latest` when you want the fuller runtime image with Docker CLI, compose, and |
198 | | -remote-node support available. |
199 | | - |
200 | | -Use `hackdance/hack:slim` as a smaller base for Codex, CI, or managed containers where you want |
201 | | -`hack`, Bun, env resolution, sessions, and tickets without the full host stack. |
202 | | - |
203 | | -For reproducible remote or managed environments, install project dependencies normally, install Hack, |
204 | | -and pass `HACK_ENV_SECRET_KEY` at runtime so encrypted project env can be resolved. Set `HACK_HOME` |
205 | | -alongside it when you also want to redirect global state (registry, daemon, secrets) to an isolated |
206 | | -root instead of `~/.hack`. |
207 | | - |
208 | | -Start with [Codex managed environments](./docs/guides/codex-managed-environments.md) for a concrete |
209 | | -setup guide. |
210 | | - |
211 | | -## macOS Companion |
212 | | - |
213 | | -The macOS app is a thin local companion for Hack-managed projects. |
214 | | - |
215 | | -It provides: |
216 | | - |
217 | | -- project list and project detail |
218 | | -- global runtime and daemon status |
219 | | -- `up`, `down`, `restart`, and `open` actions |
220 | | -- log entrypoints and a Ghostty-backed bottom panel |
221 | | -- doctor and trust guidance |
222 | | -- menu bar quick actions |
223 | | - |
224 | | -The CLI remains the source of truth. The app is there to make local runtime state easier to see and |
225 | | -operate. |
226 | | - |
227 | | -## Documentation |
| 93 | +Every command works from the repo root, or anywhere with `--project <name>`. |
228 | 94 |
|
229 | | -Start here: |
| 95 | +## Learn more |
230 | 96 |
|
231 | | -- [Core docs](./docs/core.md) |
232 | | -- [CLI reference](./docs/cli.md) |
233 | | -- [Initialize a project](./docs/guides/init-project.md) |
234 | | -- [Env & secrets](./docs/env.md) |
235 | | -- [Lifecycle](./docs/lifecycle.md) |
236 | | -- [Sessions](./docs/sessions.md) |
237 | | -- [Tickets](./docs/guides/tickets.md) |
238 | | -- [Portable Codex environments](./docs/guides/codex-managed-environments.md) |
239 | | -- [Architecture](./docs/architecture.md) |
| 97 | +- [Docs index](./docs/README.md) — concepts, guides, and reference |
| 98 | +- [CLI overview](./docs/cli.md) and the [generated command reference](./docs/reference/cli.md) |
| 99 | +- [Env & secrets](./docs/env.md) · [Lifecycle](./docs/lifecycle.md) · [Sessions](./docs/sessions.md) |
| 100 | +- [Agent-first setup](./docs/guides/agent-first-setup.md) |
240 | 101 |
|
241 | | -Reference and advanced material: |
| 102 | +A slim macOS companion app shows project status and quick actions; the CLI stays the |
| 103 | +source of truth. Runtime container images (`hackdance/hack:latest`, `:slim`) and |
| 104 | +optional extensions are covered in the docs. Remote/gateway/node/dispatch commands |
| 105 | +are source-available but unsupported experimental — hidden behind `hack help --all`. |
242 | 106 |
|
243 | | -- [Docs index](./docs/README.md) |
244 | | -- [Extensions and reference](./docs/reference.md) |
245 | | -- [Integrations boundary](./docs/integrations.md) |
246 | | -- [Unsupported experimental beta workflows](./docs/beta.md) |
| 107 | +## License |
247 | 108 |
|
248 | | -Remote, gateway, node, and dispatch commands remain source-available but unsupported experimental. |
249 | | -They are not required for the default local development path. |
| 109 | +See [LICENSE](./LICENSE). |
0 commit comments