hinacode 0.2.0-alpha.9 → 0.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,37 +1,183 @@
1
- <img src="assets/icon.svg" width="64" height="64" alt="">
1
+ <div align="center">
2
+
3
+ <img src="assets/icon.svg" width="96" height="96" alt="HinaCode logo" />
2
4
 
3
5
  # HinaCode
4
6
 
5
- HinaCode is an Electron app built for coding agents. It currently supports Claude Code, Codex and Muse Code.
7
+ **Run many agents. Know which one needs you.**
8
+
9
+ A delightful workstation for running Claude Code, Codex, Muse Code, and opencode in parallel, each in its own worktree, each visible at a glance.
10
+
11
+ [![CI](https://github.com/hinadev-ai/hinacode/actions/workflows/ci.yml/badge.svg)](https://github.com/hinadev-ai/hinacode/actions/workflows/ci.yml)
12
+ [![Build](https://github.com/hinadev-ai/hinacode/actions/workflows/build.yml/badge.svg)](https://github.com/hinadev-ai/hinacode/actions/workflows/build.yml)
13
+ [![Release](https://img.shields.io/github/v/release/hinadev-ai/hinacode?sort=semver)](https://github.com/hinadev-ai/hinacode/releases/latest)
14
+ [![Downloads](https://img.shields.io/github/downloads/hinadev-ai/hinacode/total)](https://github.com/hinadev-ai/hinacode/releases)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
16
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-lightgrey)](#download)
17
+ [![Stars](https://img.shields.io/github/stars/hinadev-ai/hinacode?style=social)](https://github.com/hinadev-ai/hinacode/stargazers)
18
+
19
+ [Download](https://github.com/hinadev-ai/hinacode/releases/latest) · [Documentation](docs/README.md) · [Report a bug](https://github.com/hinadev-ai/hinacode/issues/new) · [Request a feature](https://github.com/hinadev-ai/hinacode/issues/new) · [Releases](https://github.com/hinadev-ai/hinacode/releases)
20
+
21
+ **English** · [繁體中文](README.zh-TW.md)
22
+
23
+ </div>
24
+
25
+ <!-- Replace with a product screenshot or short demo GIF -->
26
+ <!-- <p align="center"><img src="assets/screenshot.png" alt="HinaCode" width="90%" /></p> -->
27
+ <p align="center">
28
+ <img src="site/public/og.png" alt="HinaCode: run coding agents in parallel" width="90%" />
29
+ </p>
6
30
 
7
31
  > [!WARNING]
8
- > HinaCode is still in development. Expect bugs.
32
+ > HinaCode is in alpha and ships several times a day. Expect bugs, and please [report them](https://github.com/hinadev-ai/hinacode/issues).
33
+
34
+ ---
35
+
36
+ ## Why HinaCode?
37
+
38
+ Running one agent in a terminal works. Running five stops working: you lose track of which checkout each agent owns, which one is waiting for approval, and which pull request each one shipped.
39
+
40
+ HinaCode is a **delightful workstation for coding agents**. It handles the work around each agent: where it runs, when it needs you, what it changed, and how it ships. That way you can run agents in parallel and stay in control.
41
+
42
+ - **Free and open source** under the MIT license. No markup, no proxy.
43
+ - **Uses the agents you already pay for.** HinaCode runs the `claude`, `codex`, `muse`, and `opencode` CLIs you are signed in to. Usage goes to those plans or API keys, exactly as it does in a terminal.
44
+ - **Local by default.** Your code only goes where those CLIs already send it. HinaCode keeps its data in a single SQLite file on your machine.
45
+ - **Built with HinaCode, every day.** If the workflow hurts, we feel it first.
46
+
47
+ ---
48
+
49
+ ## Features
50
+
51
+ - **A worktree per thread.** Branch from `main`, any branch, or an open pull request. Your setup script runs before the agent starts.
52
+ - **Four agents, one sidebar.** Pick Claude Code, Codex, Muse Code, or opencode per thread, and switch mid-thread.
53
+ - **Inbox.** Every active thread in one list, with approvals and questions marked.
54
+ - **Inline approvals and questions.** Allow, deny with a note, or answer without leaving the thread.
55
+ - **Steer or queue.** Change the agent's course mid-turn, or queue the next task behind it.
56
+ - **Diffs per turn.** Comment on a line and the agent gets the exact spot.
57
+ - **Browser, terminal, and ports.** Open the dev server, a shell, and the ports an agent left open beside the thread. Mention a terminal with `@` or send its selected output to the thread, and the agent reads it.
58
+ - **Linked pull requests.** See checks and review state next to the thread. HinaCode tells the agent when checks fail or a review lands.
59
+ - **Merge and clean up.** Squash and merge from the thread, and HinaCode removes the worktree.
60
+ - **Automations.** Start a thread from a webhook, a GitHub issue, a Linear ticket, or a Slack mention.
61
+ - **Built-in MCP server.** Agents can ask you for secrets, hand work to other threads, drive a disposable VM or mobile simulators, and use Linear.
62
+ - **Remote machines and your phone.** Run `npx hinacode serve` on another machine, then approve, steer, and merge from the phone app.
63
+
64
+ ---
65
+
66
+ ## Supported agents
67
+
68
+ Install each CLI you want to use, sign in, and keep it on your `PATH`. HinaCode never sits between you and the provider.
69
+
70
+ | Agent | CLI | Sign in | Protocol |
71
+ | ----------------------------------------------------- | ---------- | -------------------------------- | --------------------------- |
72
+ | [Claude Code](https://claude.com/product/claude-code) | `claude` | `claude` (follow the login flow) | Agent SDK |
73
+ | [Codex](https://openai.com/codex/) | `codex` | `codex` (follow the login flow) | App-server protocol |
74
+ | Muse Code | `muse` | `muse login` | MSP |
75
+ | [opencode](https://opencode.ai) | `opencode` | `opencode auth login` | Agent Client Protocol (ACP) |
76
+
77
+ Adding a backend takes one `AgentProvider` implementation in `src/main/agents/` plus registration in the runner. See the [agent provider guide](docs/agent-providers.md).
78
+
79
+ ---
80
+
81
+ ## Download
82
+
83
+ Download the latest build for your platform from [**Releases**](https://github.com/hinadev-ai/hinacode/releases/latest):
84
+
85
+ | Platform | Format |
86
+ | --------------------- | --------- |
87
+ | macOS (Apple silicon) | `.dmg` |
88
+ | Windows | Installer |
89
+ | Linux | AppImage |
90
+
91
+ The headless server runs anywhere Node 24 does (see [Remote and headless](#remote-and-headless)).
92
+
93
+ ---
94
+
95
+ ## Quick start
96
+
97
+ 1. **Install and sign in to at least one agent CLI.** See [Supported agents](#supported-agents).
98
+ 2. **Download and open HinaCode.**
99
+ 3. **Add a project.** Pick a local repository, or create one from GitHub.
100
+ 4. **Start a thread.** Choose an agent and a model, write a prompt, and send it. HinaCode creates a worktree, runs your setup script, and starts the agent.
101
+ 5. **Watch the sidebar.** Answer approvals and questions in place, review the diff, and merge the pull request from the thread when it is green.
102
+
103
+ > Importing a project trusts it: its `.claude` settings, hooks, and `CLAUDE.md` load the same way they do in the CLI. See [ADR 0008](docs/adr/0008-import-trusts-the-project.md).
104
+
105
+ ---
106
+
107
+ ## Remote and headless
108
+
109
+ Run HinaCode as a headless daemon on another machine, then drive it from your desktop or phone:
110
+
111
+ ```sh
112
+ npx hinacode serve
113
+ ```
114
+
115
+ The daemon prints pairing URLs on startup. Add the machine in **Settings** on the desktop, or scan the QR code with the phone app. It keeps its own data directory (`~/.hinacode-cloud` by default, override with `HINACODE_USER_DATA`) and therefore its own projects and threads.
116
+
117
+ ---
9
118
 
10
119
  ## Development
11
120
 
12
- Requires Node 24.22.1 or later (26.12.1 or later on Node 26), pnpm, and the `claude` and `codex` CLIs on your PATH and logged in. Muse Code threads need the `muse` CLI, signed in with `muse login`. Global file search and its integration tests require ripgrep (`rg`) on your PATH.
121
+ ### Prerequisites
122
+
123
+ - **Node** 24.22.1 or later (26.12.1 or later on Node 26) and **pnpm**
124
+ - The agent CLIs you want to run (`claude`, `codex`, `muse`, and/or `opencode`), signed in and on your `PATH`
125
+ - **ripgrep** (`rg`) on your `PATH`, for global file search and its integration tests
126
+ - Chrome or Chromium, only for Remote Browser tabs and their integration tests (`pnpm exec playwright install --with-deps chromium`)
127
+
128
+ ### Run it locally
13
129
 
14
130
  ```sh
15
131
  pnpm install
16
132
  pnpm dev
17
133
  ```
18
134
 
135
+ ### Common commands
136
+
19
137
  ```sh
20
- pnpm build # bundles main, preload and renderer into out/
21
- pnpm build:server # bundles only the headless daemon into out/server/
22
- pnpm typecheck
23
- pnpm lint
24
- pnpm format
25
- pnpm test # node --test for the pure logic (pollers, templates, signatures)
138
+ pnpm build # bundle main, preload, and renderer into out/
139
+ pnpm build:server # bundle only the headless daemon into out/server/
140
+ pnpm dev:remote # headless dev app with DevTools on http://<tailscale-ip>:9333
141
+ pnpm typecheck # tsrs over the node, web, web-test, e2e, and scripts configs
142
+ pnpm lint # oxlint (run `pnpm lint --fix` to sort Tailwind classes)
143
+ pnpm format # oxfmt, no semicolons, width 120
144
+ pnpm test # unit + integration (Vitest)
145
+ pnpm test:e2e # Playwright + Gherkin scenarios against the built Electron app
146
+ pnpm check:specs # TLC over specs/*.cfg (needs Java 11+)
26
147
  ```
27
148
 
149
+ Run `pnpm typecheck && pnpm lint && pnpm test` before you call work done. CI runs the same checks on every pull request, plus `pnpm test:e2e` on `ubuntu-latest`.
150
+
28
151
  Run a built app with its own data directory, for example to keep a test profile apart from your real one:
29
152
 
30
153
  ```sh
31
154
  HINACODE_USER_DATA=/tmp/hinacode-test pnpm exec electron out/main/index.js
32
155
  ```
33
156
 
34
- Unpackaged runs (`pnpm dev`, e2e and the command above) never touch the login Keychain. They seal secrets with Chromium's public mock key, so save only dummy secrets in them. Without `HINACODE_USER_DATA` they use `~/.hinacode-dev`, not the release app's `~/.hinacode`. A data directory holds the database, `chats/` and `attachments/` at the top and Chromium's profile in `chromium/`.
157
+ Unpackaged runs (`pnpm dev`, e2e, and the command above) never touch the login Keychain. They seal secrets with Chromium's public mock key, so save only dummy secrets in them. Without `HINACODE_USER_DATA` they use `~/.hinacode-dev`, not the release app's `~/.hinacode`. A data directory holds the database, `chats/`, and `attachments/` at the top and Chromium's profile in `chromium/`.
158
+
159
+ <details>
160
+ <summary><b>Testing</b></summary>
161
+
162
+ | Command | What runs |
163
+ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
164
+ | `pnpm test:unit` | Vitest, in-process: pure helpers, stores, event mapping. Files named `*.test.ts`. |
165
+ | `pnpm test:integration` | Vitest against real SQLite files, git, child processes, and the MCP HTTP server. Files named `*.integration.test.ts`. |
166
+ | `pnpm test` | Both Vitest projects. |
167
+ | `pnpm test:e2e` | Playwright drives the built Electron app through Gherkin scenarios in `e2e/features`. Needs a display: `DISPLAY` or an `Xvfb :99`, or run under `xvfb-run -a`. |
168
+
169
+ Effect code is tested with `@effect/vitest`: `it.effect` runs under the test clock, `it.live` on the real one, and `layer(...)` shares a built layer across a block. Every e2e worker starts its own HinaCode on a throwaway `HINACODE_USER_DATA`, seeds preconditions through `window.hinacode.rpc` or straight into SQLite, and drives the behavior under test through the UI.
170
+
171
+ Remote Browser tabs and their integration tests need Chrome or Chromium on the host. To install Playwright's Chromium and its Linux dependencies, run `pnpm exec playwright install --with-deps chromium`. A cloud installed from npm can use `npx playwright install --with-deps chromium`. Set `HINACODE_BROWSER_EXECUTABLE_PATH` when the browser lives elsewhere. The browser runs on the thread's machine, so its `localhost` reaches that machine's services.
172
+
173
+ Scenarios that depend on native pointer capture, scrolling, or window focus carry `@desktop`. They run with one worker after the parallel scenarios finish, because separate app profiles still share the desktop's focus and input. Run selected desktop scenarios with `pnpm test:e2e --project desktop --no-deps -g 'Resizable'`.
174
+
175
+ Tests never wait on wall-clock timers; oxlint rejects `setTimeout`, `setInterval`, and the `timers` modules in test files. Wait on the thing itself instead: a push event, a `PubSub` the service publishes to, a file change, a Playwright locator assertion, or `TestClock.adjust` for code that sleeps. The verification skill in `.agents/skills/verify-hinacode` picks up where e2e stops: real agent turns, GitHub through `gh`, and native dialogs.
176
+
177
+ </details>
178
+
179
+ <details>
180
+ <summary><b>Simulate limits and verify headlessly</b></summary>
35
181
 
36
182
  Simulate an exhausted Claude account without using the account:
37
183
 
@@ -39,7 +185,7 @@ Simulate an exhausted Claude account without using the account:
39
185
  HINACODE_USER_DATA=/tmp/kk-limit-demo HINACODE_MOCK_CLAUDE=usage-limit pnpm dev
40
186
  ```
41
187
 
42
- The first message in each thread reaches the limit. The next attempt succeeds. The callout offers **Resume at reset**, which retries once at the provider's reset time and survives restart. Set `HINACODE_MOCK_RESET_MS=5000` for a five-second reset. Use `HINACODE_MOCK_CLAUDE=org-spend-limit` to simulate the organization monthly spend cap and its `/usage-credits` guidance. That case has no automatic reset action.
188
+ The first message in each thread reaches the limit. The next attempt succeeds. The callout offers **Resume at reset**, which retries once at the provider's reset time and survives restart. Set `HINACODE_MOCK_RESET_MS=5000` for a five-second reset. Use `HINACODE_MOCK_CLAUDE=org-spend-limit` to simulate the organization monthly spend cap and its `/usage-credits` guidance. That case has no automatic reset action. See [docs/operations/mock-claude.md](docs/operations/mock-claude.md) for the other scenarios, each one `/mock-<scenario>` message away.
43
189
 
44
190
  Headless verification on a machine without a display uses Xvfb and Chrome DevTools:
45
191
 
@@ -48,48 +194,78 @@ Xvfb :99 -screen 0 1600x1000x24 &
48
194
  HINACODE_USER_DATA=/tmp/hinacode-test DISPLAY=:99 pnpm exec electron --no-sandbox --disable-gpu --remote-debugging-port=9222 out/main/index.js
49
195
  ```
50
196
 
51
- ## Layout
197
+ To verify in the real app, use the `verify-hinacode` skill (`.agents/skills/verify-hinacode/`), which launches an isolated instance over Xvfb and CDP and drives it with screenshots. To stress-test the UI with worst-case data (long names, RTL text, missing files, huge lists), start with `scripts/break-ui/launch.sh` instead. See `scripts/break-ui/README.md`.
52
198
 
53
- The marketing site in [`site/`](site/README.md) uses Astro and Tailwind, with English, Traditional Chinese, and Japanese pages. Run it with `pnpm --dir site dev` and deploy it to Cloudflare Workers with `pnpm --dir site deploy`.
199
+ </details>
54
200
 
55
- ```
56
- src/main Electron main process. One Effect runtime, services under services/, agents under agents/,
57
- the MCP server under mcp/, SQLite client and migrations under db/.
58
- src/preload contextBridge exposing window.hinacode (rpc, onEvent, pathForFile).
59
- src/renderer React 19 + TanStack Router. components/, routes/, stores/ (zustand), keybindings/, paraglide/ (generated).
60
- src/shared Effect Schema contracts shared by all three: domain types, the rpc method map, agent events.
61
- messages/ Paraglide catalogs: en.json, zh-TW.json and ja.json. Every UI string lives here.
62
- ```
201
+ ---
63
202
 
64
- Renderer and main talk over a single `rpc` IPC channel. Each method in `src/shared/contract.ts` has a request and response schema that both sides decode. Main pushes live updates on the `event` channel.
203
+ ## Architecture
65
204
 
66
- Adding an agent backend means one implementation of `AgentProvider` in `src/main/agents/` and one line in the runner's provider registry.
205
+ HinaCode is an Electron app. The main process runs the agents, the React renderer talks to it over one `rpc` channel, and everything durable lives in one SQLite file. The same main process runs headless as `hinacode serve`. See [docs/arch.md](docs/arch.md) for diagrams and [docs/adr/](docs/adr/) for the decisions behind them.
67
206
 
68
- ## Testing
207
+ ---
69
208
 
70
- | Command | What runs |
71
- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
72
- | `pnpm test:unit` | Vitest, in-process: pure helpers, stores, event mapping. Files named `*.test.ts`. |
73
- | `pnpm test:integration` | Vitest against real SQLite files, git, child processes and the MCP HTTP server. Files named `*.integration.test.ts`. |
74
- | `pnpm test` | Both Vitest projects. |
75
- | `pnpm test:e2e` | Playwright drives the built Electron app through Gherkin scenarios in `e2e/features`. Needs a display: `DISPLAY` or an `Xvfb :99`, or run under `xvfb-run -a`. |
209
+ ## Contributing
76
210
 
77
- Effect code is tested with `@effect/vitest`: `it.effect` runs under the test clock, `it.live` on the real one, and `layer(...)` shares a built layer across a block. Every e2e worker starts its own HinaCode on a throwaway `HINACODE_USER_DATA`, seeds preconditions through `window.hinacode.rpc` or straight into SQLite, and drives the behavior under test through the UI.
211
+ Contributions are welcome. Read [AGENTS.md](AGENTS.md) first, then:
78
212
 
79
- Remote Browser tabs and their integration tests need Chrome or Chromium on the host. To install Playwright's Chromium and its Linux dependencies, run `pnpm exec playwright install --with-deps chromium`. A cloud installed from npm can use `npx playwright install --with-deps chromium`. Set `HINACODE_BROWSER_EXECUTABLE_PATH` when the browser lives elsewhere. The browser runs on the thread's machine, so its `localhost` reaches that machine's services.
213
+ - Name branches `feat/*` or `fix/*`, and write [Conventional Commits](https://www.conventionalcommits.org/) with a scope.
214
+ - Write a design in `docs/features/` before a non-trivial feature, and a failing test before a bug fix.
215
+ - Run `pnpm typecheck && pnpm lint && pnpm test` before you open a pull request.
216
+
217
+ ---
218
+
219
+ ## FAQ
220
+
221
+ **What does HinaCode cost?**
222
+ Nothing. Every feature is free, and the code is open source under the MIT license.
223
+
224
+ **Which agents does it run?**
225
+ Claude Code, Codex, Muse Code, and opencode. Install each CLI you want to use and sign in to it.
226
+
227
+ **Does my code leave my machine?**
228
+ Only where the agent CLIs already send it. HinaCode runs locally and keeps its data in a SQLite file on your machine.
80
229
 
81
- Scenarios that depend on native pointer capture, scrolling or window focus carry `@desktop`. They run with one worker after the parallel scenarios finish, because separate app profiles still share the desktop's focus and input.
230
+ **Is it ready for daily use?**
231
+ It is in alpha. We build HinaCode with HinaCode every day, and new versions ship several times a day. Expect bugs, and report them on GitHub.
82
232
 
83
- Run selected desktop scenarios with `pnpm test:e2e --project desktop --no-deps -g 'Resizable'`. The `--no-deps` flag skips the parallel project for a focused run.
233
+ **Which platforms are supported?**
234
+ macOS on Apple silicon, Windows, and Linux as an AppImage. The server runs anywhere Node 24 does.
84
235
 
85
- Tests never wait on wall-clock timers; oxlint rejects `setTimeout`, `setInterval` and the `timers` modules in test files. Wait on the thing itself instead: a push event, a `PubSub` the service publishes to, a file change, a Playwright locator assertion, or `TestClock.adjust` for code that sleeps. The verification skill in `.agents/skills/verify-hinacode` picks up where e2e stops: real agent turns, GitHub through `gh`, and native dialogs.
236
+ ---
237
+
238
+ ## Security
239
+
240
+ HinaCode runs agents that execute code on your machine, so a few boundaries are held firmly:
241
+
242
+ - The renderer is sandboxed, and only the top-level app frame may call `rpc`.
243
+ - `shell.openExternal` only opens `http(s)` URLs.
244
+ - The MCP server listens on loopback only, and its credential scopes each call to one thread.
245
+ - Webhooks require an HMAC signature, checked with `timingSafeEqual`.
246
+ - The attachment protocol refuses paths outside its root.
247
+ - Secrets go through `services/Secrets.ts`, sealed by the OS keyring. They are never logged, put in a URL, or sent to the renderer.
248
+
249
+ This is a single-user local app by design: no RBAC, audit logs, or extra encryption layers on top of the OS keyring.
250
+
251
+ ---
86
252
 
87
253
  ## Acknowledgements
88
254
 
89
255
  Several designs in HinaCode follow [T3 Code](https://github.com/pingdotgg/t3code) (MIT, copyright 2026 T3 Tools Inc.), reimplemented here rather than copied:
90
256
 
91
257
  - Effect services as `Context.Service` classes with a `make` effect and a `layer` export, and migrations registered through `Migrator.fromRecord`.
92
- - The MCP server design: Effect's `McpServer.layerHttp` behind bearer auth, one random credential per thread, injected into the agent's MCP config. The pull request tools (`link_pull_request`, `unlink_pull_request`, `list_thread_pull_requests`) and `request_secret` share T3 Code's names.
258
+ - The MCP server design: Effect's `McpServer.layerHttp` behind a bearer credential, one random credential per thread, injected into the agent's MCP config. The pull request tools (`link_pull_request`, `unlink_pull_request`, `list_thread_pull_requests`) and `request_secret` share T3 Code's names.
93
259
  - The pull request checks rollup: `null` when a PR has no checks, failing before pending before passing, and `workflow / name` as the check label.
94
260
  - Webhook automations verified with a `sha256=` HMAC in `x-hub-signature-256`, with `{{path}}` placeholders filled into the prompt.
95
261
  - Remote browser tabs run headless Chromium on the thread's host and send screencasts to the client. We compared Orca's local network proxy and server streaming before choosing this design for the Node daemon. See [the remote browser design](docs/features/2026-10-26-remote-browser.md).
262
+
263
+ ---
264
+
265
+ ## License
266
+
267
+ [MIT](LICENSE) © 2026 Kalan
268
+
269
+ <div align="center">
270
+ <sub>Built with HinaCode.</sub>
271
+ </div>
package/bin/hinacode.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- await import("../out/server/daemon.js")
2
+ await import("../out/server/cli.js")