cubefarm 0.3.2 → 0.3.4

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Leon van Zyl
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Leon van Zyl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,94 +1,94 @@
1
- # ✻ cubefarm
2
-
3
- A cartoon 3D office where a team of AI coding agents works through your GitHub issues. You walk the floors, look over their shoulders and watch their pull requests get tested and merged.
4
-
5
- ## Get started
6
-
7
- ```bash
8
- npx cubefarm
9
- ```
10
-
11
- That's it. cubefarm checks your machine, starts the office and opens it in your browser. The first time, `npx` asks whether to install cubefarm: say yes.
12
-
13
- ### What you need
14
-
15
- - **Node.js 22 or newer**: [nodejs.org](https://nodejs.org)
16
- - **git**
17
- - **The GitHub CLI**, signed in: install it from [cli.github.com](https://cli.github.com), then run `gh auth login`
18
- - **A coding agent subscription**: cubefarm brings Claude Code, the default agent and the one your CEO runs: sign in once with `npx cubefarm login`. You don't need to install it. Agents can also run Codex or OpenCode, if you have them installed and signed in.
19
- - **Google Chrome**, for agents that test your app in a browser.
20
-
21
- It runs on Windows, macOS and Linux. Not sure you're ready? `npx cubefarm doctor` checks all of it.
22
-
23
- ### Just want to look around?
24
-
25
- ```bash
26
- npx cubefarm --demo
27
- ```
28
-
29
- Demo mode fakes GitHub and the agents, so it costs nothing and changes nothing.
30
-
31
- ## Your first five minutes
32
-
33
- 1. **Set up your company.** A short wizard asks your name, names your company and introduces your CEO.
34
- 2. **Move in a project.** Pick one of your project folders or a GitHub repo, or start a new one. It gets its own floor. Every project needs to be on GitHub, because issues and pull requests are how the team works.
35
- 3. **Let the CEO plan.** The CEO studies the project, writes its QA checklist, plans the work as GitHub issues and proposes who to hire. Press `P` for your phone to chat with them and approve hires.
36
- 4. **Watch the work.** Developers pick up issues and open pull requests. QA testers review and test each one in a real browser, then post a report with screenshots. With auto-merge on, a pull request merges itself once QA passes and GitHub's checks are green.
37
-
38
- ## What's in the office
39
-
40
- - **Floors**: one per project. Ride the elevator between them.
41
- - **Desks**: walk up behind an agent to watch their monitor. Open it to see their real terminal: every agent is an actual coding agent running on your machine, and you can type into it. It also shows a live browser when they test the UI. Pick the coding agent, model and effort for the whole team or per agent.
42
- - **The QA lab**: every floor has at least one QA tester.
43
- - **The whiteboard**: the Kanban board, from backlog to merged.
44
- - **The lobby**: the manager's office, where you connect projects, hire, file issues and change settings, and the CEO's corner office.
45
-
46
- ## Controls
47
-
48
- | Key | Action |
49
- | --- | --- |
50
- | `W A S D` / arrows | walk |
51
- | `Shift` | run |
52
- | mouse | look around (click the view first) |
53
- | `E` | use what you're looking at: a desk, the whiteboard, the elevator, the manager's computer |
54
- | `P` | your phone |
55
- | `H` | help |
56
- | `Esc` | let go of the mouse, or close a panel |
57
-
58
- ## Commands
59
-
60
- | Command | What it does |
61
- | --- | --- |
62
- | `npx cubefarm` | start the office and open it in your browser |
63
- | `npx cubefarm login` | sign in to Claude Code, the built-in coding agent |
64
- | `npx cubefarm doctor` | check that your machine is ready |
65
- | `npx cubefarm --demo` | fake GitHub and fake agents |
66
- | `npx cubefarm --port 4400` | use another port (the default is 4317) |
67
- | `npx cubefarm --no-open` | don't open the browser |
68
-
69
- ## Updating
70
-
71
- `npx` keeps using the version it downloaded first. When a newer one is out, cubefarm tells you as it starts. To update:
72
-
73
- ```bash
74
- npx cubefarm@latest
75
- ```
76
-
77
- Prefer a permanent install? Run `npm install -g cubefarm`, then start it with `cubefarm`.
78
-
79
- Running it from a clone of this repo (`npm start`)? Then the office updates itself from GitHub once its agents are done: see [Updating the office](docs/how-it-works.md#updating-the-office).
80
-
81
- ## Good to know
82
-
83
- - **It runs on your coding agents' subscriptions.** Agents on the same coding agent draw on the same usage limits. To cap how many work at once, set a session limit in the manager's console.
84
- - **Agents work on your machine, like your own coding agents**: with your skills, MCP servers and settings, each in its own copy of the repo. They can't push to your main branch or merge: the office merges, after QA.
85
- - **Your office lives in `~/.cubefarm`**: settings, clones of your repos and one working copy per agent. Set `SWARM_HOME` to use another folder.
86
-
87
- ## Learn more
88
-
89
- - [How it works](docs/how-it-works.md): the life of an issue, QA, auto-merge, models and usage, the safety model and floor previews
90
- - [Contributing](CONTRIBUTING.md): run it from source, tests, architecture and publishing
91
-
92
- ## License
93
-
94
- [MIT](LICENSE)
1
+ # ✻ cubefarm
2
+
3
+ A cartoon 3D office where a team of AI coding agents works through your GitHub issues. You walk the floors, look over their shoulders and watch their pull requests get tested and merged.
4
+
5
+ ## Get started
6
+
7
+ ```bash
8
+ npx cubefarm
9
+ ```
10
+
11
+ That's it. cubefarm checks your machine, starts the office and opens it in your browser. The first time, `npx` asks whether to install cubefarm: say yes.
12
+
13
+ ### What you need
14
+
15
+ - **Node.js 22 or newer**: [nodejs.org](https://nodejs.org)
16
+ - **git**
17
+ - **The GitHub CLI**, signed in: install it from [cli.github.com](https://cli.github.com), then run `gh auth login`
18
+ - **A coding agent subscription**: cubefarm brings Claude Code, the default agent and the one your CEO runs: sign in once with `npx cubefarm login`. You don't need to install it. Agents can also run Codex or OpenCode, if you have them installed and signed in.
19
+ - **Google Chrome**, for agents that test your app in a browser.
20
+
21
+ It runs on Windows, macOS and Linux. Not sure you're ready? `npx cubefarm doctor` checks all of it.
22
+
23
+ ### Just want to look around?
24
+
25
+ ```bash
26
+ npx cubefarm --demo
27
+ ```
28
+
29
+ Demo mode fakes GitHub and the agents, so it costs nothing and changes nothing.
30
+
31
+ ## Your first five minutes
32
+
33
+ 1. **Set up your company.** A short wizard asks your name, names your company and introduces your CEO.
34
+ 2. **Move in a project.** Pick one of your project folders or a GitHub repo, or start a new one. It gets its own floor. Every project needs to be on GitHub, because issues and pull requests are how the team works.
35
+ 3. **Let the CEO plan.** The CEO studies the project, writes its QA checklist, plans the work as GitHub issues and proposes who to hire. Press `P` for your phone to chat with them and approve hires.
36
+ 4. **Watch the work.** Developers pick up issues and open pull requests. QA testers review and test each one in a real browser, then post a report with screenshots. With auto-merge on, a pull request merges itself once QA passes and GitHub's checks are green.
37
+
38
+ ## What's in the office
39
+
40
+ - **Floors**: one per project. Ride the elevator between them.
41
+ - **Desks**: walk up behind an agent to watch their monitor. Open it to see their real terminal: every agent is an actual coding agent running on your machine, and you can type into it. It also shows a live browser when they test the UI. Pick the coding agent, model and effort for the whole team or per agent.
42
+ - **The QA lab**: every floor has at least one QA tester.
43
+ - **The whiteboard**: the Kanban board, from backlog to merged.
44
+ - **The lobby**: the manager's office, where you connect projects, hire, file issues and change settings, and the CEO's corner office.
45
+
46
+ ## Controls
47
+
48
+ | Key | Action |
49
+ | --- | --- |
50
+ | `W A S D` / arrows | walk |
51
+ | `Shift` | run |
52
+ | mouse | look around (click the view first) |
53
+ | `E` | use what you're looking at: a desk, the whiteboard, the elevator, the manager's computer |
54
+ | `P` | your phone |
55
+ | `H` | help |
56
+ | `Esc` | let go of the mouse, or close a panel |
57
+
58
+ ## Commands
59
+
60
+ | Command | What it does |
61
+ | --- | --- |
62
+ | `npx cubefarm` | start the office and open it in your browser |
63
+ | `npx cubefarm login` | sign in to Claude Code, the built-in coding agent |
64
+ | `npx cubefarm doctor` | check that your machine is ready |
65
+ | `npx cubefarm --demo` | fake GitHub and fake agents |
66
+ | `npx cubefarm --port 4400` | use another port (the default is 4317) |
67
+ | `npx cubefarm --no-open` | don't open the browser |
68
+
69
+ ## Updating
70
+
71
+ `npx` keeps using the version it downloaded first. When a newer one is out, cubefarm tells you as it starts. To update:
72
+
73
+ ```bash
74
+ npx cubefarm@latest
75
+ ```
76
+
77
+ Prefer a permanent install? Run `npm install -g cubefarm`, then start it with `cubefarm`.
78
+
79
+ Running it from a clone of this repo (`npm start`)? Then the office updates itself from GitHub once its agents are done: see [Updating the office](docs/how-it-works.md#updating-the-office).
80
+
81
+ ## Good to know
82
+
83
+ - **It runs on your coding agents' subscriptions.** Agents on the same coding agent draw on the same usage limits. To cap how many work at once, set a session limit in the manager's console.
84
+ - **Agents work on your machine, like your own coding agents**: with your skills, MCP servers and settings, each in its own copy of the repo. They can't push to your main branch or merge: the office merges, after QA.
85
+ - **Your office lives in `~/.cubefarm`**: settings, clones of your repos and one working copy per agent. Set `SWARM_HOME` to use another folder.
86
+
87
+ ## Learn more
88
+
89
+ - [How it works](docs/how-it-works.md): the life of an issue, QA, auto-merge, models and usage, the safety model and floor previews
90
+ - [Contributing](CONTRIBUTING.md): run it from source, tests, architecture and publishing
91
+
92
+ ## License
93
+
94
+ [MIT](LICENSE)
package/dist/index.html CHANGED
@@ -1,17 +1,17 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>cubefarm</title>
7
- <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50 6 92 30 50 54 8 30z' fill='%23ffc2a6'/><path d='M8 30 50 54v42L8 72z' fill='%23ff8a5b'/><path d='M92 30 50 54v42l42-24z' fill='%23d9602f'/></svg>" />
8
- <link rel="preconnect" href="https://fonts.googleapis.com" />
9
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
- <link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet" />
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>cubefarm</title>
7
+ <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M50 6 92 30 50 54 8 30z' fill='%23ffc2a6'/><path d='M8 30 50 54v42L8 72z' fill='%23ff8a5b'/><path d='M92 30 50 54v42l42-24z' fill='%23d9602f'/></svg>" />
8
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10
+ <link href="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet" />
11
11
  <script type="module" crossorigin src="/assets/index-BCFM-9fU.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-BU33ZUhQ.css">
13
- </head>
14
- <body>
15
- <div id="root"></div>
16
- </body>
17
- </html>
13
+ </head>
14
+ <body>
15
+ <div id="root"></div>
16
+ </body>
17
+ </html>
@@ -1588,6 +1588,12 @@ function idleHook(live, b) {
1588
1588
  }
1589
1589
  return {};
1590
1590
  }
1591
+ function resumableSession(b, exists2) {
1592
+ const id = typeof b.session_id === "string" ? b.session_id : "";
1593
+ const file = typeof b.transcript_path === "string" ? b.transcript_path : "";
1594
+ return id && file && exists2(file) ? id : null;
1595
+ }
1596
+ var lostConversation = (screen) => /No conversation found with session ID/i.test(screen);
1591
1597
  function startCliSession(opts, callbacks) {
1592
1598
  const term = opts.terminal;
1593
1599
  const prev = lives.get(term);
@@ -1606,6 +1612,7 @@ function startCliSession(opts, callbacks) {
1606
1612
  const officePrompts = [];
1607
1613
  const launched = [];
1608
1614
  let mainThread = opts.resumeSessionId ?? null;
1615
+ let kept = opts.resumeSessionId ?? null;
1609
1616
  const usageResets = /* @__PURE__ */ new Map();
1610
1617
  const warned = /* @__PURE__ */ new Set();
1611
1618
  let done = false;
@@ -1699,6 +1706,13 @@ function startCliSession(opts, callbacks) {
1699
1706
  const hook = (b) => {
1700
1707
  const event = String(b.hook_event_name ?? "");
1701
1708
  const sub = typeof b.agent_id === "string" && b.agent_id !== "";
1709
+ if (cli === "claude" && !sub && b.session_id !== kept) {
1710
+ const id = resumableSession(b, fs6.existsSync);
1711
+ if (id) {
1712
+ kept = id;
1713
+ cb.sessionId(id);
1714
+ }
1715
+ }
1702
1716
  switch (event) {
1703
1717
  case "PreToolUse": {
1704
1718
  const name = String(b.tool_name ?? "");
@@ -1797,6 +1811,11 @@ function startCliSession(opts, callbacks) {
1797
1811
  return {};
1798
1812
  };
1799
1813
  const exited = (exitCode) => {
1814
+ if (cli === "claude" && opts.resumeSessionId && !begun && lostConversation(term.screen())) {
1815
+ cb.sessionId(null);
1816
+ finish({ ok: false, text: "", errors: [`${label} couldn't find the conversation it was resuming, so the next session starts a new one.`] });
1817
+ return;
1818
+ }
1800
1819
  const ok = exitCode === 0 && (lastText !== "" || cli !== "claude" && Date.now() - started > 2e4);
1801
1820
  finish({ ok, text: lastText, errors: ok ? [] : [`${label} exited${exitCode ? ` with code ${exitCode}` : ""} before finishing.`] });
1802
1821
  };
@@ -1898,7 +1917,7 @@ ${JSON.stringify(opts.outputSchema)}`;
1898
1917
  env[k] = v;
1899
1918
  }
1900
1919
  Object.assign(env, { TERM: "xterm-256color", COLORTERM: "truecolor" }, launch2.env);
1901
- if (cli === "claude") cb.sessionId(sessionId);
1920
+ if (cli === "claude" && opts.resumeSessionId) cb.sessionId(sessionId);
1902
1921
  term.note(`\u2500\u2500 ${label}${opts.label ? ` \xB7 ${opts.label}` : ""} \u2500\u2500`);
1903
1922
  const resumeId = cli === "claude" ? sessionId : opts.resumeSessionId ?? null;
1904
1923
  const l = { agentId: opts.agentId ?? "", cli, term, proc: null, token, dir, resumeId, statusLine, shots: /* @__PURE__ */ new Set(), session: { hook, exited } };
@@ -5205,7 +5224,7 @@ Note from the manager: ${note}` : ""
5205
5224
  },
5206
5225
  sessionId: (id) => {
5207
5226
  a.sessionId = id;
5208
- a.sessionCli = how.cli ?? "claude";
5227
+ a.sessionCli = id ? how.cli ?? "claude" : null;
5209
5228
  },
5210
5229
  browserUrl: (url) => {
5211
5230
  rt.browserUrl = url;
@@ -6131,7 +6150,7 @@ ${job.text}` } : job;
6131
6150
  },
6132
6151
  sessionId: (id) => {
6133
6152
  a.sessionId = id;
6134
- a.sessionCli = "claude";
6153
+ a.sessionCli = id ? "claude" : null;
6135
6154
  },
6136
6155
  browserUrl: () => void 0,
6137
6156
  screenshot: () => void 0,