teamroom 0.1.1 → 0.2.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.
Files changed (68) hide show
  1. package/README.md +149 -70
  2. package/dist/cli/index.js +202 -106
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/client/agents-md.d.ts +14 -0
  5. package/dist/client/agents-md.js +53 -0
  6. package/dist/client/agents-md.js.map +1 -0
  7. package/dist/client/api-client.d.ts +4 -0
  8. package/dist/client/backend.d.ts +60 -0
  9. package/dist/client/backend.js +103 -0
  10. package/dist/client/backend.js.map +1 -0
  11. package/dist/client/claude-events.d.ts +18 -0
  12. package/dist/client/claude-events.js +172 -0
  13. package/dist/client/claude-events.js.map +1 -0
  14. package/dist/client/claude-hook.d.ts +19 -12
  15. package/dist/client/claude-hook.js +90 -48
  16. package/dist/client/claude-hook.js.map +1 -1
  17. package/dist/client/config.d.ts +13 -4
  18. package/dist/client/config.js +25 -6
  19. package/dist/client/config.js.map +1 -1
  20. package/dist/client/doctor.js +60 -7
  21. package/dist/client/doctor.js.map +1 -1
  22. package/dist/client/git.d.ts +0 -2
  23. package/dist/client/git.js +2 -6
  24. package/dist/client/git.js.map +1 -1
  25. package/dist/client/ignore.d.ts +12 -0
  26. package/dist/client/ignore.js +96 -0
  27. package/dist/client/ignore.js.map +1 -0
  28. package/dist/client/invite-link.d.ts +3 -1
  29. package/dist/client/invite-link.js +19 -4
  30. package/dist/client/invite-link.js.map +1 -1
  31. package/dist/client/mcp-config.d.ts +39 -6
  32. package/dist/client/mcp-config.js +81 -26
  33. package/dist/client/mcp-config.js.map +1 -1
  34. package/dist/client/workspace.d.ts +34 -7
  35. package/dist/client/workspace.js +81 -39
  36. package/dist/client/workspace.js.map +1 -1
  37. package/dist/core/agents.d.ts +6 -0
  38. package/dist/core/agents.js +7 -0
  39. package/dist/core/agents.js.map +1 -1
  40. package/dist/core/overlap.d.ts +12 -3
  41. package/dist/core/overlap.js +51 -8
  42. package/dist/core/overlap.js.map +1 -1
  43. package/dist/core/room.d.ts +3 -1
  44. package/dist/core/room.js +37 -1
  45. package/dist/core/room.js.map +1 -1
  46. package/dist/core/schemas.d.ts +9 -0
  47. package/dist/core/schemas.js +10 -2
  48. package/dist/core/schemas.js.map +1 -1
  49. package/dist/core/types.d.ts +7 -1
  50. package/dist/dashboard/Dashboard.d.ts +2 -1
  51. package/dist/dashboard/Dashboard.js +3 -3
  52. package/dist/dashboard/Dashboard.js.map +1 -1
  53. package/dist/dashboard/model.d.ts +10 -3
  54. package/dist/dashboard/model.js +38 -7
  55. package/dist/dashboard/model.js.map +1 -1
  56. package/dist/dashboard/run.js +2 -2
  57. package/dist/dashboard/run.js.map +1 -1
  58. package/dist/mcp/auto-report.d.ts +43 -0
  59. package/dist/mcp/auto-report.js +118 -0
  60. package/dist/mcp/auto-report.js.map +1 -0
  61. package/dist/mcp/server.d.ts +18 -4
  62. package/dist/mcp/server.js +44 -29
  63. package/dist/mcp/server.js.map +1 -1
  64. package/dist/server/app.js +7 -9
  65. package/dist/server/app.js.map +1 -1
  66. package/dist/store/file-store.js +1 -1
  67. package/dist/store/file-store.js.map +1 -1
  68. package/package.json +9 -2
package/README.md CHANGED
@@ -1,104 +1,178 @@
1
1
  # teamroom
2
2
 
3
- Know what your teammates (and their coding agents) are touching before the merge conflict does.
3
+ Run coding agents in parallel without them stepping on each other's files.
4
4
 
5
- Each checkout shares a snapshot of the files it is changing: commits on its branch that are not merged yet, uncommitted edits and untracked files. Before editing, you or your agent ask "is anyone else in these files?" and get an answer in milliseconds.
5
+ You have Claude Code refactoring auth in one worktree, Codex building a feature in another, and Gemini CLI fixing tests in a third. Nothing tells them they are about to change the same file, until you merge. teamroom does: every session shares what it is changing, and each agent learns who else is in a file before it edits it.
6
6
 
7
- Pushed branches are only part of the picture. Teamroom also sees work that is still local, and intent that is not code yet ("about to rename the User model").
7
+ - **Any agent.** Claude Code, Codex, Cursor, Gemini CLI, Mistral Vibe, or anything else that speaks MCP.
8
+ - **One command, no server.** `teamroom init` and you are done. Worktrees on one machine share a file in `.git`.
9
+ - **Sees work that is not pushed yet.** Uncommitted edits, untracked files, and plans that are not code yet ("renaming User to Account").
10
+ - **Optional team mode.** Point the repo at a small server and teammates' agents join the same room.
8
11
 
9
- ## How it works
10
-
11
- - **Sessions, not people.** Every checkout (worktree, clone, agent box) is its own session. Two agents of the same developer in two worktrees warn each other.
12
- - **Snapshots replace each other.** A session's newest `wip` snapshot replaces its previous one, so once you merge, revert or switch branches, the warnings go away.
13
- - **Merged commits are ignored.** Commit entries already in the default branch are filtered out on your machine using your local git.
14
- - **Nothing blocks git.** Hooks run in the background and never fail a commit, even when the server is down.
12
+ ## What it looks like
15
13
 
16
- ## Requirements
14
+ A Claude Code session in `app-login` tries to edit `src/auth.ts` while another session in `app-auth` is changing it. teamroom pauses the edit once and tells the agent who and why:
17
15
 
18
- - Node.js 22 or newer (24 LTS recommended)
19
- - git
16
+ ```text
17
+ teamroom: src/auth.ts is also being changed in another checkout:
18
+ src/auth.ts
19
+ - Vasiliki (app-auth on feat/auth), wip just now: Changing 1 file on feat/auth. Plan: moving auth to sessions
20
20
 
21
- ## Setup
21
+ This edit was paused once so you can decide. If it is still the right move, retry the same edit and it will go through.
22
+ Otherwise tell the user who else is in this file, or do other parts of the task first.
23
+ ```
22
24
 
23
- Run a server somewhere your team can reach:
25
+ Agents without hooks (Codex, Cursor, Gemini CLI) get the same news through the MCP server. The next teamroom tool result starts with:
24
26
 
25
- ```sh
26
- npx teamroom serve --host 0.0.0.0 --port 8787 --data-dir /var/lib/teamroom
27
+ ```text
28
+ Heads up: another session just started changing files you are changing. Tell the user before you go further.
27
29
  ```
28
30
 
29
- The server binds to `127.0.0.1` by default. Put it behind HTTPS (a reverse proxy) before exposing it, and pass `--trust-proxy` only when that proxy sets `X-Forwarded-For`.
31
+ And you can always ask from the shell:
30
32
 
31
- To host it for a team (Fly.io, Docker, the environment variables it reads, and how to restrict who can create rooms), see [docs/hosting.md](docs/hosting.md).
33
+ ```console
34
+ $ teamroom check src/auth.ts
35
+ src/auth.ts
36
+ - Vasiliki (app-auth on feat/auth), wip just now: Changing 1 file on feat/auth. Plan: moving auth to sessions
37
+ ```
32
38
 
33
- In your repo, one person creates the room:
39
+ ## Quick start
40
+
41
+ Requires Node.js 22 or newer and git.
34
42
 
35
43
  ```sh
36
44
  npm install --global teamroom
37
- teamroom create --server https://teamroom.example.com
38
- git add .mcp.json && git commit -m "chore: add teamroom for coding agents"
45
+ cd your-repo
46
+ teamroom init
47
+ git add .mcp.json AGENTS.md && git commit -m "chore: coordinate parallel agents with teamroom"
39
48
  ```
40
49
 
41
- `create` names the room after the repo folder and you after your git `user.name` (override with `--room-name` and `--name`). It also installs the git hooks and writes `.mcp.json` so Claude Code picks up the tools. It prints an invite link:
50
+ Then give each agent its own worktree and start them:
42
51
 
43
- ```
44
- https://teamroom.example.com/join/room_...#tri_...
52
+ ```sh
53
+ git worktree add ../app-auth -b feat/auth && (cd ../app-auth && claude)
54
+ git worktree add ../app-billing -b feat/billing && (cd ../app-billing && codex)
55
+ teamroom watch # live view: every session, its agent, and files in more than one place
45
56
  ```
46
57
 
47
- Anyone who has the link can join, so share it privately. Teammates run, inside their clone:
58
+ `teamroom doctor` checks every piece and prints the command that fixes each problem.
59
+
60
+ ## Try it in two minutes
61
+
62
+ No agent needed. After `teamroom init`, make two worktrees and change the same file in both:
48
63
 
49
64
  ```sh
50
- teamroom join 'https://teamroom.example.com/join/room_...#tri_...'
65
+ git worktree add ../try-a -b try-a
66
+ git worktree add ../try-b -b try-b
67
+
68
+ cd ../try-a
69
+ echo "// a" >> README.md
70
+ teamroom note "trying teamroom" --files README.md
71
+ teamroom report
72
+
73
+ cd ../try-b
74
+ echo "// b" >> README.md
75
+ teamroom report
76
+ teamroom check README.md # lists try-a and its plan, exits 3
51
77
  ```
52
78
 
53
- That's it. If something doesn't work, `teamroom doctor` checks every piece (repo, hooks, agent config, server, token) and prints the command that fixes each problem.
54
-
55
- Membership is saved to `.git/teamroom.json` (mode `600`, never committed). Every worktree of the repo shares it. The invite code sits after the `#`, which browsers never send, so it stays out of server logs even if someone opens the link.
79
+ Clean up from the main checkout with `git worktree remove --force ../try-a && git worktree remove --force ../try-b && git branch -D try-a try-b`. The warnings disappear on their own once a session's newest snapshot no longer includes the file.
56
80
 
57
- To try it alone first, run `teamroom serve` in one terminal and `teamroom create --server localhost:8787` in your repo.
81
+ ## How it works
58
82
 
59
- ## Daily use
83
+ - **Sessions, not people.** Every checkout (worktree, clone, agent box) is its own session. Two agents of the same developer in two worktrees warn each other.
84
+ - **Snapshots replace each other.** A session's newest snapshot replaces its previous one and the agent edits before it, so once you merge, revert or switch branches, the warnings go away.
85
+ - **Hooks are enforced, tools are a request.** The git hooks, the MCP server's background reports and the Claude Code hooks run whatever the model decides, so the room stays accurate even when an agent ignores its instructions.
86
+ - **Noise stays out.** Lockfiles never count as overlap. Add your own patterns (generated code, snapshots) to a `.teamroomignore` at the repo root, gitignore style, with `!` to re-include.
87
+ - **Nothing blocks git, and nothing blocks an agent for good.** A paused Claude edit goes through on retry; hooks exit cleanly when the room cannot be read.
60
88
 
61
- ```sh
62
- teamroom check # who else is touching the files you changed
63
- teamroom check src/auth.ts # or specific files; exits 3 when there is overlap
64
- teamroom note "about to rename User" --files src/user.ts,src/db/schema.ts
65
- teamroom report # share your snapshot now (hooks do this on commit, checkout, merge, rebase)
66
- teamroom status # members and recent activity
67
- teamroom watch # live dashboard: who is working, their agents, files in more than one place
68
- ```
89
+ ## What `init` sets up
69
90
 
70
- ## Coding agents (MCP)
91
+ | Piece | Works with | What it does |
92
+ | --- | --- | --- |
93
+ | Git hooks | everything | After each commit, checkout, merge and rebase, shares the files this checkout changed compared with `main`, including uncommitted and untracked ones. Runs in the background and never fails a commit. |
94
+ | MCP server | any MCP agent | Runs for as long as the agent does. Shares the checkout's changes every few seconds without being asked, and puts a **heads-up** in front of the next tool result when another session starts changing a file this one is changing. Also gives the agent tools to announce a plan and check before editing. |
95
+ | `AGENTS.md` block | Codex, Cursor, and most agents | Tells the agent to announce its plan with `teamroom_post_note` and to call `teamroom_check_overlap` before editing. |
96
+ | Claude Code hooks | Claude Code | See the list below. |
71
97
 
72
- `teamroom mcp` runs a stdio MCP server with four tools:
98
+ The Claude Code hooks go in `.claude/settings.local.json`, which Claude Code does not commit:
73
99
 
74
- | Tool | What it does |
75
- | --- | --- |
76
- | `teamroom_check_overlap` | Who else is changing these files (default: everything this checkout changed) |
77
- | `teamroom_report_work` | Share this checkout's snapshot, with an optional one-line note |
78
- | `teamroom_post_note` | Announce an intent before acting on it |
79
- | `teamroom_recent_activity` | Recent activity in the room |
100
+ - **Session start:** briefs each new session on what the others are changing.
101
+ - **Before an edit:** pauses the edit once when another session is in that file, with who and why. The retry goes through.
102
+ - **After an edit:** shares the edited file the moment it changes.
103
+ - **New worktrees** get these hooks automatically, and teamroom's own tools are pre-approved so they run without a prompt.
80
104
 
81
- `teamroom create` (or `teamroom agents install`) adds the server to `.mcp.json`, which Claude Code reads for the whole team. For Codex, add this to `~/.codex/config.toml`:
105
+ MCP config is written for Claude Code (`.mcp.json`) always, and for Cursor (`.cursor/mcp.json`), Gemini CLI (`.gemini/settings.json`) and Codex (`.codex/config.toml`) when the repo already has that folder. Force one with `teamroom init --agents codex,gemini`. For anything else, add a stdio MCP server with command `teamroom` and args `["mcp"]`. Examples:
82
106
 
83
107
  ```toml
108
+ # Codex, ~/.codex/config.toml (a project .codex/config.toml only loads in trusted projects)
84
109
  [mcp_servers.teamroom]
85
110
  command = "teamroom"
86
111
  args = ["mcp"]
112
+
113
+ # Mistral Vibe, ~/.vibe/config.toml
114
+ [[mcp_servers]]
115
+ name = "teamroom"
116
+ transport = "stdio"
117
+ command = "teamroom"
118
+ args = ["mcp"]
87
119
  ```
88
120
 
89
- Git hooks only see changes when you commit or switch branches. To share each file Claude Code edits as it happens, run:
121
+ ## MCP tools
122
+
123
+ | Tool | What it does |
124
+ | --- | --- |
125
+ | `teamroom_post_note` | Announce a plan and the files it will touch, before editing |
126
+ | `teamroom_check_overlap` | Who else is changing these files (default: everything this checkout changed) |
127
+ | `teamroom_report_work` | Share this checkout's changes now, with an optional one-line note |
128
+ | `teamroom_recent_activity` | What other sessions and agents did recently |
129
+
130
+ Activity is labeled with the agent that sent it, from the name it gives in the MCP handshake.
131
+
132
+ ## Daily use
133
+
134
+ ```sh
135
+ teamroom watch # live dashboard
136
+ teamroom check # who else is changing the files you changed
137
+ teamroom check src/auth.ts # or specific files
138
+ teamroom note "renaming User to Account" --files src/user.ts,src/db/schema.ts
139
+ teamroom report # share your changes now (hooks do this on commit and checkout)
140
+ teamroom status # recent activity
141
+ ```
142
+
143
+ `teamroom check` exits `3` when someone else is changing one of the files, so scripts and CI can act on it:
144
+
145
+ ```sh
146
+ teamroom check || echo "someone else is in these files"
147
+ ```
148
+
149
+ ## Team mode
150
+
151
+ Local mode covers every worktree on one machine. To include teammates and their agents on other machines, run a server somewhere your team can reach:
152
+
153
+ ```sh
154
+ npx teamroom serve --host 0.0.0.0 --port 8787 --data-dir /var/lib/teamroom
155
+ ```
156
+
157
+ Put it behind HTTPS, and pass `--trust-proxy` only when that proxy sets `X-Forwarded-For`. [docs/hosting.md](docs/hosting.md) covers Fly.io, Docker, the environment variables, and how to restrict who can create rooms.
158
+
159
+ In your repo, one person creates the room:
90
160
 
91
161
  ```sh
92
- teamroom hooks install --claude
162
+ teamroom create --server https://teamroom.example.com
93
163
  ```
94
164
 
95
- This adds a `PostToolUse` hook to `.claude/settings.local.json` (local to you, not committed). Activity from agents is labeled with the agent that posted it, such as Claude Code or Codex.
165
+ It names the room after the repo folder and you after your git `user.name` (override with `--room-name` and `--name`), sets up the repo like `init`, and prints an invite link. Anyone who has the link can join, so share it privately. Teammates run, inside their clone:
96
166
 
97
- Tell agents to use it, for example in `AGENTS.md` or `CLAUDE.md`:
167
+ ```sh
168
+ teamroom join 'https://teamroom.example.com/join/room_...#tri_...'
169
+ ```
98
170
 
99
- > Before editing files, call `teamroom_check_overlap` with the files you plan to change. If someone else is in them, tell me before continuing.
171
+ Membership is saved to `.git/teamroom.json` (mode `600`, never committed) and every worktree shares it. The invite code sits after the `#`, which browsers never send, so it stays out of server logs. Without a scheme, `--server` defaults to `https://` (and `http://` for localhost).
100
172
 
101
- ## Room admin
173
+ `teamroom leave` removes you from the room and returns the repo to local mode.
174
+
175
+ Room admin:
102
176
 
103
177
  ```sh
104
178
  teamroom invite rotate # owner only; the old invite stops working
@@ -106,38 +180,43 @@ teamroom member remove bo # owner only, or yourself; revokes the token
106
180
  teamroom token rotate # replace your own token, for example after a leak
107
181
  ```
108
182
 
183
+ ## How it compares
184
+
185
+ - **Worktree orchestrators** give each agent its own checkout, which stops agents from overwriting each other's files but leaves the conflict for merge time. teamroom adds the missing warning on top of worktrees.
186
+ - **Claim and intent protocols** such as [Foremerge](https://github.com/naw103/foremerge) and [agent-claim-mcp](https://github.com/vk0dev/agent-claim-mcp) work when agents declare what they will change. Foremerge in particular reasons about symbols and plans, not just files. teamroom instead watches what agents actually change, through git and Claude Code hooks, so an agent that forgets to declare still shows up. It also works across machines. The two approaches combine well.
187
+ - **Editor tools for people** such as [GitLive](https://git.live) show teammates' changes in your editor. teamroom is built for agents: it speaks MCP, and it can pause an agent's edit before the conflict happens.
188
+
189
+ ## What is shared
190
+
191
+ File paths, branch names, commit ids, short notes, member and agent names. Never file contents. In local mode nothing leaves your machine: the room is `.git/teamroom/`, readable only by you. On a server, tokens and invite codes are stored as SHA-256 hashes.
192
+
109
193
  ## Environment variables
110
194
 
111
195
  | Variable | Purpose |
112
196
  | --- | --- |
113
- | `TEAMROOM_SERVER`, `TEAMROOM_ROOM`, `TEAMROOM_MEMBER`, `TEAMROOM_TOKEN` | Override `.git/teamroom.json`, for CI or shared agent machines |
114
197
  | `TEAMROOM_SESSION` | Name this checkout's session (default: folder name plus a short hash of its path) |
198
+ | `TEAMROOM_MEMBER` | Your name (default: git `user.name`) |
199
+ | `TEAMROOM_AUTO_REPORT=0` | Stop `teamroom mcp` from sharing changes in the background |
200
+ | `TEAMROOM_SERVER`, `TEAMROOM_ROOM`, `TEAMROOM_TOKEN` | Override `.git/teamroom.json`, for CI or shared agent machines |
115
201
 
116
202
  ## Limits
117
203
 
118
- - Activity is kept per room up to the latest 1000 entries. Overlap looks back 72 hours by default (`--since-hours`, up to 90 days).
204
+ - The room keeps the latest 1000 entries. Overlap looks back 72 hours by default (`--since-hours`, up to 90 days).
119
205
  - A snapshot holds up to 200 files. Larger change sets are truncated and the CLI says so.
120
- - Rate limits are kept in memory per server process. If you run several processes over one data directory, each enforces its own limits.
121
- - Rooms are stored as one JSON file each. That is fine for teams, not for thousands of active rooms.
122
-
123
- ## Development
206
+ - On a server, rate limits are kept in memory per process, and rooms are stored as one JSON file each. That is fine for teams, not for thousands of active rooms.
124
207
 
125
- Requires Node 22+ (`nvm use` picks the version in `.nvmrc`).
208
+ ## Uninstall
126
209
 
127
210
  ```sh
128
- npm install
129
- npm run dev # rebuild on change and restart a local server on :8787
130
- npm run check # typecheck, lint and tests, the same as CI
131
- npm run format # fix formatting and import order
211
+ teamroom leave # team mode only: leave the room first
212
+ teamroom hooks uninstall # removes the git hooks and the Claude Code hooks
132
213
  ```
133
214
 
134
- Other scripts: `build`, `typecheck`, `lint`, `test`, `test:watch`. CI runs `check` and `build` on Node 22 and 24 for every pull request.
135
-
136
- Tooling: TypeScript 7 for type checking and builds, Vitest for tests, and Biome for linting and formatting (one dependency instead of ESLint plus Prettier).
215
+ Then remove what `init` wrote to tracked files: the `teamroom` entry in `.mcp.json` (and in `.cursor/mcp.json`, `.gemini/settings.json` or `.codex/config.toml` if it added one), and the block between `<!-- teamroom:start -->` and `<!-- teamroom:end -->` in `AGENTS.md`. Delete `.git/teamroom/` to drop the local room.
137
216
 
138
- ## Releasing
217
+ ## Contributing
139
218
 
140
- Publish a GitHub release with a tag like `v0.1.2` (Releases, then Draft a new release). The `Release` workflow sets the package version from the tag, runs the full check, and publishes to npm with provenance. npm trusts the workflow directly (trusted publishing), so no token or 2FA code is involved. The version in `package.json` is only a placeholder between releases.
219
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and releases.
141
220
 
142
221
  ## License
143
222