thinkncollab-shell 0.0.20 → 2.0.0-beta.1.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 (201) hide show
  1. package/LICENSE +82 -0
  2. package/Readme.md +246 -502
  3. package/dist/bin/thinknsh.js +8 -0
  4. package/dist/src/commands/auth/login.js +7 -0
  5. package/dist/src/commands/auth/logout.js +7 -0
  6. package/dist/src/commands/auth/register.js +7 -0
  7. package/dist/src/commands/auth/whoami.js +7 -0
  8. package/dist/src/commands/dock/bench.js +7 -0
  9. package/dist/src/commands/dock/ci.js +7 -0
  10. package/dist/src/commands/dock/cluster.js +7 -0
  11. package/dist/src/commands/dock/containers.js +7 -0
  12. package/dist/src/commands/dock/dock.js +7 -0
  13. package/dist/src/commands/github/commits.js +7 -0
  14. package/dist/src/commands/github/issue-create.js +7 -0
  15. package/dist/src/commands/github/issues.js +7 -0
  16. package/dist/src/commands/github/pulls.js +7 -0
  17. package/dist/src/commands/github/statusgh.js +7 -0
  18. package/dist/src/commands/index.js +7 -0
  19. package/dist/src/commands/message/say.js +7 -0
  20. package/dist/src/commands/room/join.js +7 -0
  21. package/dist/src/commands/room/leave.js +7 -0
  22. package/dist/src/commands/room/rooms.js +7 -0
  23. package/dist/src/commands/room/sync.js +7 -0
  24. package/dist/src/commands/sandbox/console.js +7 -0
  25. package/dist/src/commands/sandbox/dep.js +7 -0
  26. package/dist/src/commands/sandbox/deploy.js +7 -0
  27. package/dist/src/commands/sandbox/dev.js +7 -0
  28. package/dist/src/commands/sandbox/exec.js +7 -0
  29. package/dist/src/commands/sandbox/freeze.js +7 -0
  30. package/dist/src/commands/sandbox/push.js +7 -0
  31. package/dist/src/commands/sandbox/resume.js +7 -0
  32. package/dist/src/commands/sandbox/sandbox.js +7 -0
  33. package/dist/src/commands/sandbox/share.js +7 -0
  34. package/dist/src/commands/sandbox/snapshot.js +7 -0
  35. package/dist/src/commands/sandbox/sync-deps.js +7 -0
  36. package/dist/src/commands/shell/doctor.js +7 -0
  37. package/dist/src/commands/shell/notifications.js +7 -0
  38. package/dist/src/commands/shell/notify.js +7 -0
  39. package/dist/src/commands/shell/status.js +7 -0
  40. package/dist/src/commands/shell/version.js +7 -0
  41. package/dist/src/commands/tasks/build.js +7 -0
  42. package/dist/src/commands/tasks/complete.js +7 -0
  43. package/dist/src/commands/tasks/create-task.js +7 -0
  44. package/dist/src/commands/tasks/loadtest.js +7 -0
  45. package/dist/src/commands/tasks/task-status.js +7 -0
  46. package/dist/src/commands/tasks/task.js +7 -0
  47. package/dist/src/commands/tasks/tasks.js +7 -0
  48. package/dist/src/commands/team/invite.js +7 -0
  49. package/dist/src/commands/team/myteam.js +7 -0
  50. package/dist/src/commands/team/teammates.js +7 -0
  51. package/dist/src/commands/terminal/share.js +7 -0
  52. package/dist/src/core/api-client.js +7 -0
  53. package/dist/src/core/crypto/e2ee-vault.js +7 -0
  54. package/dist/src/core/dep-store.js +7 -0
  55. package/dist/src/core/dependency-tracker.js +7 -0
  56. package/dist/src/core/geekload.js +7 -0
  57. package/dist/src/core/local-runner.js +7 -0
  58. package/dist/src/core/multi-lang-scanner.js +7 -0
  59. package/dist/src/core/notification-window.js +8 -0
  60. package/dist/src/core/notify-auth.js +7 -0
  61. package/dist/src/core/project-config.js +7 -0
  62. package/dist/src/core/sandbox/arch-shim.js +7 -0
  63. package/dist/src/core/sandbox/capsule-builder.js +7 -0
  64. package/dist/src/core/sandbox/cgroups.js +7 -0
  65. package/dist/src/core/sandbox/container-monitor.js +7 -0
  66. package/dist/src/core/sandbox/crun-manager.js +7 -0
  67. package/dist/src/core/sandbox/engine.js +7 -0
  68. package/dist/src/core/sandbox/image-manager.js +7 -0
  69. package/dist/src/core/sandbox/image-store.js +7 -0
  70. package/dist/src/core/sandbox/index.js +7 -0
  71. package/dist/src/core/sandbox/macos-sandbox.js +7 -0
  72. package/dist/src/core/sandbox/microvm-manager.js +7 -0
  73. package/dist/src/core/sandbox/native-service-manager.js +7 -0
  74. package/dist/src/core/sandbox/network.js +7 -0
  75. package/dist/src/core/sandbox/oci-exporter.js +7 -0
  76. package/dist/src/core/sandbox/oci-puller.js +7 -0
  77. package/dist/src/core/sandbox/oci-runtime-spec.js +7 -0
  78. package/dist/src/core/sandbox/policy-engine.js +7 -0
  79. package/dist/src/core/sandbox/port-proxy-daemon.js +7 -0
  80. package/dist/src/core/sandbox/room-sync-manager.js +7 -0
  81. package/dist/src/core/sandbox/runtime-manager.js +7 -0
  82. package/dist/src/core/sandbox/snapshot-manager.js +7 -0
  83. package/dist/src/core/sandbox/storage.js +7 -0
  84. package/dist/src/core/sandbox/supervisor.js +7 -0
  85. package/dist/src/core/sandbox/tunnel-daemon.js +7 -0
  86. package/dist/src/core/sandbox/tunnel.js +7 -0
  87. package/dist/src/core/sandbox/window-launcher.js +7 -0
  88. package/dist/src/core/sandbox/windows-wsl2.js +7 -0
  89. package/dist/src/core/sandbox-window.js +8 -0
  90. package/dist/src/core/shell.js +7 -0
  91. package/dist/src/core/websocket.js +7 -0
  92. package/dist/src/dock/api/routes.js +7 -0
  93. package/dist/src/dock/api/server.js +7 -0
  94. package/dist/src/dock/api/wire.js +7 -0
  95. package/dist/src/dock/bench/memory.js +7 -0
  96. package/dist/src/dock/bench/runner.js +7 -0
  97. package/dist/src/dock/build/builder.js +7 -0
  98. package/dist/src/dock/build/buildfile.js +7 -0
  99. package/dist/src/dock/build/buildkit.js +7 -0
  100. package/dist/src/dock/build/changes.js +7 -0
  101. package/dist/src/dock/ci/actions.js +7 -0
  102. package/dist/src/dock/ci/runner.js +7 -0
  103. package/dist/src/dock/ci/workflow.js +7 -0
  104. package/dist/src/dock/cli/api.js +7 -0
  105. package/dist/src/dock/cli/args.js +7 -0
  106. package/dist/src/dock/cli/commands.js +7 -0
  107. package/dist/src/dock/cli/compose.js +7 -0
  108. package/dist/src/dock/cli/context.js +7 -0
  109. package/dist/src/dock/cli/files.js +7 -0
  110. package/dist/src/dock/cli/format.js +7 -0
  111. package/dist/src/dock/cli/manage.js +7 -0
  112. package/dist/src/dock/cli/moved.js +7 -0
  113. package/dist/src/dock/cli/services.js +7 -0
  114. package/dist/src/dock/cli/session.js +7 -0
  115. package/dist/src/dock/cli/workspace.js +7 -0
  116. package/dist/src/dock/client.js +7 -0
  117. package/dist/src/dock/compat/cases.js +7 -0
  118. package/dist/src/dock/compat/runner.js +7 -0
  119. package/dist/src/dock/config.js +7 -0
  120. package/dist/src/dock/daemon-main.js +7 -0
  121. package/dist/src/dock/daemon.js +7 -0
  122. package/dist/src/dock/deploy/compose.js +7 -0
  123. package/dist/src/dock/engine.js +7 -0
  124. package/dist/src/dock/image/archive.js +7 -0
  125. package/dist/src/dock/image/auth.js +7 -0
  126. package/dist/src/dock/image/reference.js +7 -0
  127. package/dist/src/dock/image/registry.js +7 -0
  128. package/dist/src/dock/image/tar.js +7 -0
  129. package/dist/src/dock/index.js +7 -0
  130. package/dist/src/dock/linux/host.js +7 -0
  131. package/dist/src/dock/paths.js +7 -0
  132. package/dist/src/dock/runtime/emulation.js +7 -0
  133. package/dist/src/dock/runtime/fsevents.js +7 -0
  134. package/dist/src/dock/runtime/fsops.js +7 -0
  135. package/dist/src/dock/runtime/hostfwd.js +7 -0
  136. package/dist/src/dock/runtime/logs.js +7 -0
  137. package/dist/src/dock/runtime/network.js +7 -0
  138. package/dist/src/dock/runtime/ports.js +7 -0
  139. package/dist/src/dock/runtime/rootfs.js +7 -0
  140. package/dist/src/dock/runtime/seccomp-profile.LICENSE +202 -0
  141. package/dist/src/dock/runtime/seccomp-profile.json +1227 -0
  142. package/dist/src/dock/runtime/seccomp.js +7 -0
  143. package/dist/src/dock/runtime/spec.js +7 -0
  144. package/dist/src/dock/runtime/stats.js +7 -0
  145. package/dist/src/dock/runtime/volumes.js +7 -0
  146. package/dist/src/dock/selftest.js +7 -0
  147. package/dist/src/dock/setup/app.js +7 -0
  148. package/dist/src/dock/setup/autostart.js +7 -0
  149. package/dist/src/dock/setup/index.js +7 -0
  150. package/dist/src/dock/setup/integrate.js +7 -0
  151. package/dist/src/dock/setup/migrate.js +7 -0
  152. package/dist/src/dock/state/store.js +7 -0
  153. package/dist/src/dock/ui/page.js +385 -0
  154. package/dist/src/dock/ui/server.js +7 -0
  155. package/dist/src/dock/version.js +7 -0
  156. package/dist/src/dock/workspace/apps.js +7 -0
  157. package/dist/src/dock/workspace/workspace.js +7 -0
  158. package/dist/src/events/notifications.js +7 -0
  159. package/dist/src/utils/logger.js +7 -0
  160. package/dist/src/utils/terminalCrypto.js +7 -0
  161. package/package.json +41 -16
  162. package/bin/thinknsh.js +0 -71
  163. package/src/commands/auth/login.js +0 -84
  164. package/src/commands/auth/logout.js +0 -32
  165. package/src/commands/auth/register.js +0 -52
  166. package/src/commands/auth/whoami.js +0 -52
  167. package/src/commands/github/commits.js +0 -58
  168. package/src/commands/github/issue-create.js +0 -59
  169. package/src/commands/github/issues.js +0 -57
  170. package/src/commands/github/pulls.js +0 -58
  171. package/src/commands/github/statusgh.js +0 -50
  172. package/src/commands/index.js +0 -136
  173. package/src/commands/message/say.js +0 -49
  174. package/src/commands/room/join.js +0 -142
  175. package/src/commands/room/leave.js +0 -24
  176. package/src/commands/room/rooms.js +0 -66
  177. package/src/commands/shell/notify.js +0 -88
  178. package/src/commands/shell/status.js +0 -73
  179. package/src/commands/shell/version.js +0 -18
  180. package/src/commands/tasks/build.js +0 -190
  181. package/src/commands/tasks/complete.js +0 -940
  182. package/src/commands/tasks/create-task.js +0 -101
  183. package/src/commands/tasks/loadtest.js +0 -101
  184. package/src/commands/tasks/suggestTask.js +0 -0
  185. package/src/commands/tasks/task-status.js +0 -72
  186. package/src/commands/tasks/task.js +0 -182
  187. package/src/commands/tasks/tasks.js +0 -184
  188. package/src/commands/team/invite.js +0 -46
  189. package/src/commands/team/myteam.js +0 -78
  190. package/src/commands/team/teammates.js +0 -52
  191. package/src/commands/terminal/share.js +0 -261
  192. package/src/core/api-client.js +0 -246
  193. package/src/core/geekload.js +0 -524
  194. package/src/core/local-runner.js +0 -861
  195. package/src/core/notification-window.js +0 -165
  196. package/src/core/project-config.js +0 -100
  197. package/src/core/shell.js +0 -734
  198. package/src/core/websocket.js +0 -657
  199. package/src/events/notifications.js +0 -184
  200. package/src/utils/logger.js +0 -159
  201. package/src/utils/terminalCrypto.js +0 -47
package/Readme.md CHANGED
@@ -1,577 +1,321 @@
1
- # ThinkNCollab Shell (`thinknsh`)
1
+ # ThinkNCollab Shell V2 (`thinknsh`)
2
2
 
3
- A real-time collaborative terminal shell with WebSocket integration, built on top of the ThinkNCollab platform. Run commands, join rooms, chat with teammates, manage tasks, share terminals — all from your CLI.
3
+ > **The Native-First Collaborative Developer OS: Lightweight MicroVM Sandbox & Zero-Daemon Dev Runner with Live Database Snapshots, P2P Terminal Multiplexing, and OCI Compatibility.**
4
4
 
5
- ---
6
-
7
- ## Table of Contents
8
-
9
- - [Features](#features)
10
- - [Installation](#installation)
11
- - [Quick Start](#quick-start)
12
- - [Configuration](#configuration)
13
- - [Environment Variables](#environment-variables)
14
- - [CLI Flags](#cli-flags)
15
- - [Interactive Shell](#interactive-shell)
16
- - [Commands Reference](#commands-reference)
17
- - [Auth Commands](#auth-commands)
18
- - [Room Commands](#room-commands)
19
- - [Message Commands](#message-commands)
20
- - [Task Commands](#task-commands)
21
- - [Terminal Share Commands](#terminal-share-commands)
22
- - [Notification Commands](#notification-commands)
23
- - [Shell Commands](#shell-commands)
24
- - [GitHub Integration Commands](#github-integration-commands)
25
- - [`tncproject` Auto-Boot](#tncproject-auto-boot)
26
- - [Notification Window](#notification-window)
27
- - [Built-in Shell Features](#built-in-shell-features)
28
- - [Single-Command Mode](#single-command-mode)
29
- - [Examples](#examples)
5
+ [![npm version](https://img.shields.io/npm/v/thinkncollab-shell.svg)](https://www.npmjs.com/package/thinkncollab-shell)
6
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
7
+ [![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20Windows%20(WSL2)-brightgreen.svg)](#platform-isolation-matrix)
8
+ [![Runtime](https://img.shields.io/badge/Runtime-Apple_Virtualization_%7C_crun_OCI-blueviolet.svg)](#core-capabilities)
30
9
 
31
10
  ---
32
11
 
33
- ## Features
12
+ ## 🌟 What is ThinkNCollab Shell?
34
13
 
35
- - 🚀 **Custom Shell** — Full-featured interactive REPL with persistent history
36
- - 🔌 **WebSocket Integration** — Real-time bidirectional sync with ThinkNCollab servers
37
- - 👥 **Room Collaboration** — Join rooms, chat, and see who's online in real time
38
- - 📋 **Task Management** — Accept, start, complete, and reject tasks from the CLI
39
- - 📺 **Terminal Sharing** — Share your live terminal session with teammates (read + write access)
40
- - 🔔 **Notification Window** — Background TCP-based popup window for live events
41
- - 🔑 **`tncproject` Auto-Boot** — Drop a config file in your project root to auto-login and join a room on shell start
42
- - 🛡️ **Shell Token Auth** — Secure HMAC-SHA256 token validation for shell connections
43
- - 📁 **File System** — Built-in `ls`, `cd`, `pwd`, plus passthrough to your system shell
44
- - 📜 **History** — Persisted command history at `~/.thinknsh_history`
45
- - 🎨 **Colored Output** — chalk-powered terminal output
46
-
47
- ---
14
+ **ThinkNCollab Shell (`thinknsh`)** is a native-first development shell, process sandbox, and collaborative runtime built to eliminate everyday developer environment friction.
48
15
 
49
- ## Installation
50
-
51
- ```bash
52
- # Install globally (recommended)
53
- npm install -g thinkncollab-shell
54
-
55
- # Or install locally in a project
56
- npm install thinkncollab-shell
57
- ```
58
-
59
- After a global install the `thinknsh` binary is available everywhere on your system.
16
+ Instead of running a heavy 4GB+ RAM virtual machine daemon just to boot a local database, wrestling with teammate database migration drift, or sharing laggy video screens, **ThinkNCollab unifies your code, database, and terminal into a single peer-to-peer developer shell.**
60
17
 
61
18
  ---
62
19
 
63
- ## Quick Start
64
-
65
- ```bash
66
- # 1. Start the interactive shell
67
- thinknsh
68
-
69
- # 2. Log in
70
- thinknsh> login
20
+ ## 📦 Containers: `thinknsh run`, `build`, `compose`
71
21
 
72
- # 3. Join a room
73
- thinknsh> join <room-id>
74
-
75
- # 4. Send a message
76
- thinknsh> say Hello team!
77
-
78
- # 5. Check session status
79
- thinknsh> status
80
- ```
81
-
82
- ---
83
-
84
- ## Configuration
85
-
86
- By default `thinknsh` connects to `https://thinkncollab.com`. Override the server in any session using environment variables:
22
+ thinknsh has its own container engine, **dock**. You run, build and compose OCI containers with thinknsh commands. No other tool is needed. Images come from any OCI registry (the public one that hosts alpine, postgres and nginx works out of the box), containers run with `crun` on a real Linux kernel, and all state lives in one SQLite file. The daemon starts by itself on the first command.
87
23
 
88
24
  ```bash
89
- export THINKNCOLLAB_SERVER=https://thinkncollab.com
90
- export THINKNCOLLAB_API_URL=https://thinkncollab.com
91
- export THINKNCOLLAB_WS_URL=https://thinkncollab.com
92
- thinknsh
93
- ```
94
-
95
- Or inline for a single run:
25
+ thinknsh run --rm -it alpine sh # interactive shell (Ctrl-P Ctrl-Q detaches)
26
+ thinknsh run -d --name db -e POSTGRES_PASSWORD=dev -p 5432:5432 postgres:16
27
+ thinknsh ps # -a for stopped ones too
28
+ thinknsh logs -f db
29
+ thinknsh exec -it db psql -U postgres
30
+ thinknsh build -t myapp . # Containerfile (or the classic build file name)
31
+ thinknsh compose up -d # compose.yaml in this folder
32
+ thinknsh compose logs -f
33
+ thinknsh compose down -v
34
+ thinknsh login -u me ghcr.io # asks for the password (or --password-stdin)
35
+ thinknsh tag myapp ghcr.io/me/myapp:1.0 && thinknsh push ghcr.io/me/myapp:1.0
36
+ thinknsh logout ghcr.io
37
+ ```
38
+
39
+ Registry logins are checked with the registry, then saved per registry host in `~/.tnc/dock/auth.json` (mode 0600, read only by the dock daemon, never shown by any command). `thinknsh login` with an email, or with no arguments, still signs you in to ThinkNCollab; with `-u`, `--password-stdin` or a registry host it logs in to a container registry. `thinknsh push ecr://…` and `push --export` still go to the sandbox exporter. Registries on `localhost`/`127.0.0.1` use plain HTTP; for another plain-HTTP registry (a LAN registry for `thinknsh cluster`), list its host:port in `TNC_DOCK_INSECURE_REGISTRIES`.
40
+
41
+ Every command has its own help, for example `thinknsh run --help`. The full list:
42
+
43
+ | Area | Commands |
44
+ | :--- | :--- |
45
+ | Containers | `run`, `create`, `start`, `stop`, `restart`, `kill`, `rm`, `ps`, `logs`, `exec`, `wait`, `inspect` |
46
+ | Images | `images`, `pull`, `push`, `build`, `tag`, `rmi`, `image prune` |
47
+ | Registries | `login [-u USER] [--password-stdin] [REGISTRY]`, `logout [REGISTRY]` |
48
+ | Agent workspaces | `workspace up / open / apps / ls / shell / exec / ssh-config / stop / rm` |
49
+ | Dev services | `service start postgres\|redis\|mysql [-p PORT]`, `service stop / restart / status / logs / rm [-v]` |
50
+ | Local registry | `registry start [PORT] / stop / status / push IMAGE / pull IMAGE` |
51
+ | Apps | `compose up / down / ps / logs / exec / build / pull / start / stop / restart / rm / config` |
52
+ | Storage and networks | `volume ls / create / rm / inspect / prune`, `network ls / create / rm / connect / disconnect / prune` |
53
+ | Files and state | `cp`, `diff`, `export`, `commit`, `save`, `load`, `import`, `history`, `stats`, `top`, `pause` / `unpause`, `rename`, `update`, `port` |
54
+ | Engine | `system info / df / prune`, `dock setup / start / stop / status / selftest / check / config`, `dock autostart [--off]` (macOS: start at login) |
55
+ | Other tools and engines | `dock use [--system] [--off]` (engine CLI, compose, buildx, VS Code Dev Containers, testcontainers, the standard socket path), `dock env`, `dock migrate` |
56
+ | Dashboard | `dock ui` — containers, logs, live stats, images, volumes, networks in the browser; `dock app` — TNC Dock in the macOS menu bar |
57
+ | CI on this machine | `ci run [WORKFLOW] [--job ID]`, `ci list` — `.tnc/workflows` jobs, matrix legs for amd64 and arm64, services, JavaScript / composite / container actions, artifacts, each in a fresh container |
58
+
59
+ ### One container for all your coding agents: `thinknsh workspace`
60
+
61
+ Instead of a separate sandbox for every AI tool, run one secure TNC container and point every agent and editor at it: Claude desktop, the Codex app, Cursor, Antigravity IDE, VS Code, and the `claude` / `codex` CLIs.
96
62
 
97
63
  ```bash
98
- THINKNCOLLAB_SERVER=https://thinkncollab.com thinknsh
64
+ thinknsh workspace up ~/code/myapp # one project → /work
65
+ thinknsh workspace up ~/web ~/api ~/infra --name main # several → /work/web, /work/api, /work/infra
66
+ thinknsh workspace apps # which apps are installed and how each connects
67
+ thinknsh workspace open main --app cursor # editors open straight onto it (cursor, antigravity, vscode)
68
+ ssh tnc-main # terminal; then claude, codex, npm test, …
99
69
  ```
100
70
 
101
- Session credentials are saved to `~/.thinkncollab/session.json` and are automatically restored on the next launch — you only need to `login` once.
71
+ | App | How it connects |
72
+ | :--- | :--- |
73
+ | Claude desktop | Code tab → environment picker → SSH → `tnc-<name>` → folder `/work` |
74
+ | Codex app | Settings → Connections → enable `tnc-<name>` → folder `/work` (log in once: `thinknsh workspace exec <name> codex login --device-auth`) |
75
+ | Cursor, Antigravity IDE, VS Code | `thinknsh workspace open <name> --app …`, or Remote-SSH → `tnc-<name>` |
76
+ | Terminal | `ssh tnc-<name>` or `thinknsh workspace shell <name>` |
102
77
 
103
- ---
78
+ Antigravity: only the IDE has SSH; the Antigravity agent manager app does not. VS Code needs the Remote - SSH extension.
104
79
 
105
- ## Environment Variables
80
+ What you get: your folders inside the container (edits land on your Mac at once), a home volume that keeps agent logins and editor servers across rebuilds, and one set of RAM/CPU limits (`-m 2g --cpus 2` by default) for all the tools together. With several folders, editors open `/run/tnc-workspace/<name>.code-workspace` (a multi-root workspace).
106
81
 
107
- | Variable | Default | Description |
108
- |---|---|---|
109
- | `THINKNCOLLAB_SERVER` | `https://thinkncollab.com` | Base URL for both REST and WebSocket |
110
- | `THINKNCOLLAB_API_URL` | `https://thinkncollab.com` | REST API base URL (overrides SERVER for API calls) |
111
- | `THINKNCOLLAB_WS_URL` | `https://thinkncollab.com` | WebSocket server URL |
112
- | `THINKNCOLLAB_AUTO_CONNECT` | `false` | Set to `true` to auto-connect WebSocket on shell start |
113
- | `THINKNSH_NOTIFY_PORT` | auto-assigned | TCP port for the notification window (set automatically) |
82
+ Security: SSH listens on `127.0.0.1` only, with a per-workspace key and a pinned host key (no trust-on-first-use, no passwords, no root login). Sessions run as user `tnc` with **zero Linux capabilities**, `no-new-privileges`, no sudo and no setuid binaries, so an agent cannot become root inside the container. Process and memory limits apply. For a system package, you (not the agent) run `thinknsh workspace exec --root <name> apt-get install …`. Apps that connect run their own engine inside the workspace with your login for that app (Claude, Codex), stored in the workspace's home volume. `workspace up` writes the `tnc-<name>` host entries into a marked block at the end of `~/.ssh/config` (skip with `--no-ssh-config`); `workspace rm` removes them and never touches your folders.
114
83
 
115
- In production all three URL variables typically point to the same host:
84
+ What runs where:
116
85
 
117
- ```bash
118
- export THINKNCOLLAB_SERVER=https://thinkncollab.com
119
- export THINKNCOLLAB_API_URL=https://thinkncollab.com
120
- export THINKNCOLLAB_WS_URL=https://thinkncollab.com
121
- export THINKNCOLLAB_AUTO_CONNECT=true
122
- ```
86
+ | Where | What |
87
+ | :--- | :--- |
88
+ | Inside the workspace (one per project, or one per `--name` for several folders) | Every agent and editor server, your code under `/work`, language tools, tests, `npm` / `pip` installs in the home volume |
89
+ | Next to it, as separate containers | Databases and services you start with `thinknsh compose up` or `thinknsh run`; the workspace joins their networks and reaches them by name |
90
+ | On your machine | The dock engine itself (and, on macOS, the Linux VM it runs containers in) |
123
91
 
124
- ---
125
-
126
- ## CLI Flags
127
-
128
- These flags are used **before** entering the interactive shell.
129
-
130
- | Flag | Alias | Description |
131
- |---|---|---|
132
- | `--help` | `-h` | Show help and exit |
133
- | `--version` | `-v` | Print installed version and exit |
92
+ The workspace cannot start containers itself: it has no access to the engine and no Linux capabilities, which is what keeps an agent from escaping it. Start services from your own terminal; the workspace joins their network so agents reach them by service name:
134
93
 
135
94
  ```bash
136
- thinknsh --help
137
- thinknsh --version
138
- ```
139
-
140
- ---
141
-
142
- ## Interactive Shell
143
-
144
- Running `thinknsh` with no arguments starts the interactive shell. A notification window opens automatically in a new terminal (on macOS, Windows, and most Linux DEs).
145
-
146
- ```
147
- $ thinknsh
148
-
149
- ████████╗██╗ ██╗██╗███╗ ██╗██╗ ██╗███╗ ██╗ ...
150
- ╔══════════════════════════════════════════════════════╗
151
- ║ ThinkNCollab Shell v0.0.5 ║
152
- ║ Type 'help' for commands ║
153
- ╚══════════════════════════════════════════════════════╝
154
-
155
- Notification server ready on port 7379
156
- Notification window opening...
157
-
158
- username@thinknsh:~ $
159
- ```
160
-
161
- The prompt shows your current room and connection state:
162
-
163
- ```
164
- [room-abc123] ● username@thinknsh:~/projects $
165
- ```
166
-
167
- Type `help` at any time to list all available commands.
168
-
169
- ---
170
-
171
- ## Commands Reference
172
-
173
- ### Auth Commands
174
-
175
- #### `login`
176
- Authenticate interactively with your ThinkNCollab account. Credentials are saved and restored automatically on subsequent launches.
177
-
178
- ```
179
- thinknsh> login
180
- Email : you@example.com
181
- Password: ********
182
- ✅ Logged in as You
183
- ```
184
-
185
- #### `logout`
186
- End the current session and clear saved credentials.
187
-
188
- ```
189
- thinknsh> logout
190
- ✅ Logged out successfully
191
- ```
192
-
193
- #### `whoami`
194
- Display the currently authenticated user.
195
-
196
- ```
197
- thinknsh> whoami
198
- 👤 Logged in as: Raman Singh (raman@thinkncollab.com)
199
- ```
200
-
201
- ---
202
-
203
- ### Room Commands
204
-
205
- #### `join <room-id>`
206
- Join a collaboration room. Establishes a WebSocket connection, loads the last 30 messages, and starts streaming live events.
207
-
208
- ```
209
- thinknsh> join room-abc123
210
- ✅ Joined: My Project Room
211
- ```
212
-
213
- #### `leave`
214
- Leave the current room and disconnect from its event stream.
215
-
216
- ```
217
- thinknsh> leave
218
- ```
219
-
220
- #### `rooms`
221
- List all rooms you have access to.
222
-
223
- ```
224
- thinknsh> rooms
225
- [1] frontend-team (ID: room-abc123) 👥 4 members
226
- [2] backend-infra (ID: room-def456) 👥 2 members
227
- ```
228
-
229
- ---
230
-
231
- ### Message Commands
232
-
233
- #### `say <message>` / `msg <message>`
234
- Send a message to the room you are currently in. No quotes needed for multi-word messages.
235
-
236
- ```
237
- thinknsh> say PR is up for review — branch feature/auth-fix
238
- ```
239
-
240
- ---
241
-
242
- ### Task Commands
243
-
244
- These commands require you to be logged in and in a room. They emit real-time events to all room members and update the [Shell Users presence page](https://thinkncollab.com) instantly.
245
-
246
- #### `task list`
247
- Show tasks assigned to you in the current room.
248
-
249
- ```
250
- thinknsh> task list
251
- [1] Fix login redirect bug — high · pending
252
- [2] Write API documentation — medium · in-progress
253
- [3] Review onboarding flow — low · pending
254
- ```
255
-
256
- #### `task accept <task-id>`
257
- Mark a task as accepted. Emits a `task:accepted` event to the room — teammates see it live on the board.
258
-
259
- ```
260
- thinknsh> task accept 64f1a2b3c4d5e6f7a8b9c0d1
261
- ✅ Task accepted: Fix login redirect bug
262
- ```
263
-
264
- #### `task start <task-id>`
265
- Mark a task as in-progress and broadcast a `task:started` event. Your active task appears on the Shell Users presence page for all teammates to see.
95
+ thinknsh compose up -d # in the project folder: db, redis, … on <project>_default
96
+ thinknsh workspace up # finds compose.yaml in the folder and joins that project's networks
97
+ thinknsh workspace exec myapp getent hosts db # agents use postgres://db:5432, http://api:3000, …
98
+ ```
99
+
100
+ `--compose FILE|DIR` picks another compose project, `--no-compose` joins none, and `--network NET` (repeatable) joins any other network. The choice is remembered for the next `workspace up`, and `workspace ls` shows the networks. The order of `compose up` and `workspace up` does not matter: a compose network that does not exist yet is created then, the way `compose up` would. Joining a network only adds reach to the containers on it; the workspace keeps zero capabilities and still has no engine access. While the workspace is on a compose network, `compose down` leaves that network in place (it is in use) and the next `compose up` reuses it.
101
+
102
+ New here? Read the step-by-step guide: [`docs/HOW-TO-USE.md`](docs/HOW-TO-USE.md).
103
+
104
+ ### What works today
105
+
106
+ | Feature | Status |
107
+ | :--- | :--- |
108
+ | Run, attach, interactive terminals, exec, logs, exit codes, signals | ✅ |
109
+ | Pull from public and private OCI registries (token and basic auth) | ✅ |
110
+ | Build: Containerfile, multi-stage, build args, targets, layer cache, `.tncignore`, `RUN --mount` (cache, secret, bind, tmpfs), heredocs | ✅ |
111
+ | BuildKit: buildx and BuildKit-mode builds through the engine CLI (`--secret`, cache mounts, and SSH-agent forwarding in BuildKit mode) | ✅ |
112
+ | Compose: build, depends_on with `service_healthy`, healthchecks, profiles, `.env`, `extends`, `secrets`, `configs`, recreate on change | ✅ |
113
+ | Networks with name resolution, named volumes, bind mounts, published TCP and UDP ports, `host.tnc.internal` | ✅ |
114
+ | `linux/amd64` images on Apple Silicon (Rosetta 2; P8 compatibility check is optional) | ✅ |
115
+ | Copy files in and out (`cp`), commit, save/load, export/import, stats, top | ✅ |
116
+ | Unmodified tools: engine CLI, compose, VS Code Dev Containers (incl. Features), testcontainers | ✅ checked by `tests/ecosystem` |
117
+ | Move images and volumes over from another engine (`dock migrate`) | ✅ |
118
+ | Dashboard in the browser (`dock ui`) | ✅ |
119
+ | Local CI (`ci run`, and TNC CI/CD runs from the dashboard): jobs, `needs`, matrix, both CPUs on one machine, `services` on localhost, `GITHUB_ENV`/`GITHUB_OUTPUT` | ✅ (macOS/Windows jobs and third-party actions are skipped) |
120
+ | `--network container:<name>` and compose `network_mode: service:<name>` | ✅ |
121
+ | GPUs | ❌ not yet (not possible on macOS) |
122
+ | Push to a registry (skips existing layers, cross-repo mount), registry login/logout | ✅ |
123
+ | Agent workspaces over SSH (key-only, loopback, no capabilities) | ✅ |
124
+ | Rootless mode | ❌ not yet |
125
+ | Deploy compose apps to your own servers | ✅ `thinknsh cluster deploy` |
126
+
127
+ ### Platforms
128
+
129
+ | Platform | How containers run | Status |
130
+ | :--- | :--- | :--- |
131
+ | macOS, Apple Silicon | Small Linux VM on Apple Virtualization.framework (`tnc-vz`). It boots on the first container and sleeps after 5 idle minutes. | ✅ Verified: unit, check suite, e2e, cluster and selftest |
132
+ | macOS, Intel | Same VM, x86_64 kernel | 🟡 Built, waiting for selftest reports |
133
+ | Windows 10/11, x64 or ARM64 | Dedicated WSL2 distro `tnc-dock`. `C:\` paths work in `-v`. The distro stops when idle. | 🟡 Built, waiting for selftest reports |
134
+ | Linux, x86_64 or aarch64 | Native namespaces and cgroups, no VM | 🟡 CI job set up, first results pending |
135
+
136
+ ### Memory (measured, not estimated)
137
+
138
+ Measured on an Apple Silicon Mac with `thinknsh bench`. Run the same command on your machine to measure it there:
139
+
140
+ | State | Memory |
141
+ | :--- | :--- |
142
+ | dock running, VM asleep | ≈ 18 MB |
143
+ | VM awake, idle | ≈ 306 MB |
144
+ | postgres + redis running | ≈ 491–563 MB |
145
+
146
+ ### Install
147
+
148
+ Downloads and the full guide are at **https://thinkncollab.com/dock**.
149
+
150
+ 1. **Node.js 22.5 or newer.** dock stores its state with `node:sqlite`.
151
+ 2. **Windows only:** turn on WSL2 in an administrator PowerShell, then reboot. If WSL is already installed, run `wsl --update` instead.
152
+ ```powershell
153
+ wsl --install --no-distribution
154
+ ```
155
+ 3. **Install thinknsh and the runtime.** `setup` picks the right files for your OS and CPU, checks every sha256 against the bundle manifest, and installs them:
156
+ ```bash
157
+ npm install -g https://thinkncollab.com/downloads/dock/0.2.0/thinkncollab-shell.tgz
158
+ thinknsh dock setup
159
+ ```
160
+ On Linux, dock runs containers natively as root: run `sudo thinknsh dock setup` and `sudo thinknsh dock start`, then `sudo groupadd tnc-dock && sudo usermod -aG tnc-dock $USER` and restart dock to use the commands without sudo.
161
+ On a machine without internet, download the files for your platform and `manifest.json` from the downloads page into one folder, then run `thinknsh dock setup --from <folder>`.
162
+ 4. **Run something:**
163
+ ```bash
164
+ thinknsh run --rm -p 8080:80 nginx:alpine
165
+ ```
166
+ Then open http://localhost:8080.
167
+
168
+ ### Check it works on your machine
266
169
 
170
+ ```bash
171
+ thinknsh dock selftest # 12 real checks; writes ~/.tnc/dock/selftest-<os>-<cpu>-<time>.json
172
+ thinknsh dock check # all API/CLI compatibility cases; P8 is reported but is not required at the current P7 phase
173
+ thinknsh bench idle # memory, measured on this machine
267
174
  ```
268
- thinknsh> task start 64f1a2b3c4d5e6f7a8b9c0d1
269
- ▶ Started: Fix login redirect bug
270
- ```
271
-
272
- #### `task complete <task-id>`
273
- Mark a task as completed. Emits `task:completed` — the card on the board animates green for all viewers and your active task slot clears on the presence page.
274
-
275
- ```
276
- thinknsh> task complete 64f1a2b3c4d5e6f7a8b9c0d1
277
- ✓ Completed: Fix login redirect bug
278
- ```
279
-
280
- #### `task reject <task-id>`
281
- Reject a task assignment. Emits `task:rejected` to the room.
282
-
283
- ```
284
- thinknsh> task reject 64f1a2b3c4d5e6f7a8b9c0d1
285
- ✕ Rejected: Fix login redirect bug
286
- ```
287
-
288
- ---
289
-
290
- ### Terminal Share Commands
291
-
292
- Terminal sharing lets you stream your live shell session to teammates. Viewers watch in real time; you can optionally grant write access to specific users.
293
-
294
- #### `share start`
295
- Start sharing your terminal in the current room. A session ID is created and room members are notified.
296
-
297
- ```
298
- thinknsh> share start
299
- 📺 Terminal share started
300
- Session : ts-7x9k2m
301
- Room : frontend-team
302
- ```
303
-
304
- #### `share stop`
305
- End the current sharing session. All viewers are disconnected.
306
-
307
- ```
308
- thinknsh> share stop
309
- 📺 Terminal share ended
310
- ```
311
-
312
- #### `share grant <user-id>`
313
- Grant write access to a viewer. They can now send input to your shell.
314
-
315
- ```
316
- thinknsh> share grant 64f1a2b3c4d5e6f7a8b9c0d1
317
- ✍️ Write access granted
318
- ```
319
-
320
- #### `share revoke <user-id>`
321
- Revoke write access from a user (they remain a read-only viewer).
322
-
323
- ```
324
- thinknsh> share revoke 64f1a2b3c4d5e6f7a8b9c0d1
325
- ```
326
-
327
- #### `share kick <user-id>`
328
- Remove a viewer from the session entirely.
329
-
330
- ```
331
- thinknsh> share kick 64f1a2b3c4d5e6f7a8b9c0d1
332
- ```
333
-
334
- #### `share status`
335
- List current viewers and which ones have write access.
336
-
337
- ```
338
- thinknsh> share status
339
- Viewers : 2
340
- 👁 Priya Sharma (read-only)
341
- ✍ Alex Kumar (write)
342
- ```
343
-
344
- ---
345
175
 
346
- ### Notification Commands
176
+ If a check fails, send the selftest JSON file. It contains the machine details and the exact error of each check.
347
177
 
348
- #### `notify <message>`
349
- Send a push notification to all other members in the current room. The message appears in their notification feed instantly.
178
+ ### For contributors: build and test from source
350
179
 
351
- ```
352
- thinknsh> notify Staging deploy complete — please re-test
353
- 📢 Notification sent to 3 member(s)
180
+ ```bash
181
+ git clone -b shell/dock <repo> && cd ThinkNCollab-Shell-V2 && npm install
182
+ native/bundle/build.sh aarch64 dist-bundles # also: x86_64, darwin (macOS only)
183
+ native/bundle/build.sh manifest dist-bundles 0.2.2
184
+ node bin/thinknsh.js dock setup --from dist-bundles
185
+ npm test # unit tests (CLI, compose, engine, Windows backend)
186
+ node tests/dock-e2e.js # end to end against the running daemon
187
+ node bin/thinknsh.js dock check # every command against the running daemon
354
188
  ```
355
189
 
356
- Supports optional type and title:
357
-
358
- ```
359
- thinknsh> notify type=task_progress title="Build Done" All tests passing
360
- ```
190
+ Architecture and the runtime layout are documented in [`src/dock/README.md`](src/dock/README.md).
191
+ A step-by-step guide for users is in [`docs/HOW-TO-USE.md`](docs/HOW-TO-USE.md).
361
192
 
362
193
  ---
363
194
 
364
- ### Shell Commands
365
-
366
- #### `status`
367
- Show a full overview of your session.
368
-
369
- ```
370
- thinknsh> status
371
- WebSocket : ✓ Connected
372
- Socket ID : abc123...
373
- Room : frontend-team
374
- Auth : ✓ Logged in
375
- User : Raman Singh
376
- ```
377
-
378
- #### `help`
379
- List all registered commands grouped by category.
380
-
381
- #### `clear`
382
- Clear the terminal screen.
383
-
384
- #### `cd <path>`
385
- Change the working directory. Supports `~`, `..`, absolute and relative paths.
386
-
387
- #### `ls [-a]`
388
- List files in the current directory. Pass `-a` to include hidden files.
389
-
390
- #### `pwd`
391
- Print the current working directory.
392
-
393
- #### `history`
394
- Show the full command history for this session.
395
-
396
- #### `set [key value]`
397
- Set a shell variable. Run with no arguments to list all variables.
398
-
399
- ```
400
- thinknsh> set ROOM room-abc123
401
- thinknsh> join $ROOM
402
- ```
403
-
404
- #### `unset <key>`
405
- Delete a shell variable.
406
-
407
- #### `connect` / `disconnect`
408
- Manually connect or disconnect the WebSocket.
409
-
410
- #### `exit` / `quit`
411
- Exit the shell gracefully (saves history, closes TCP notification server, disconnects WebSocket).
195
+ ## ⚡ Core Capabilities
196
+
197
+ ### 1. One container engine for everything
198
+ * **Containers, apps and services through dock:** `run`, `build`, `compose`, `workspace`, `service` and `registry` all run on the same engine (see the containers section above). On macOS that is one small Linux VM (`tnc-vz`) that sleeps when idle; on Windows one WSL2 distro; on Linux the host kernel.
199
+ * **Dev databases in one command:** `thinknsh service start postgres` (also `redis`, `mysql`) runs it as a container on `127.0.0.1`, waits until it is healthy, prints the connection URL, and keeps its data in a volume across restarts and upgrades.
200
+ * **Bind mounts from your folders:** `-v ./src:/app` shares files both ways (VirtioFS on macOS, `/mnt/c` on Windows).
201
+ * **Port conflict protection:** publishing a port that is already in use fails with a message instead of taking over the running program.
202
+ * **Older names still work:** `capsule`, `vault`, `mesh`, `stack` and `vm` run `build`/`images`, `volume`, `network`, `compose` and `dock`, and print the new command each time. `vault backup` / `restore` copy a volume to or from a `.tar.gz` file. `dev`, `sandbox`, `snapshot`, `freeze` and `resume` still use the older sandbox engine (`src/core/sandbox`, frozen).
203
+
204
+ ### 2. Multi-Layer Collaborative State Sync (`room share` / `room pull`)
205
+ * Share entire development environments between teammates in seconds without third-party registries.
206
+ * **Encrypted Multi-Layer Bundle:** Packages workspace code, live database snapshots (Postgres, Mongo, Redis), and sanitized `.env` secrets into a single AES-256-GCM encrypted bundle.
207
+ * **Hybrid Transport:** Direct Gigabit Wi-Fi LAN P2P mesh (zero cloud bandwidth) with automatic fallback to ephemeral in-memory cloud socket relays.
208
+
209
+ ### 3. Smart 3-Way Code & Secret Merge Engine
210
+ * **Non-Destructive:** Local files created by developers are never deleted during sync.
211
+ * **Git 3-Way Line Merge (`git merge-file`):** Non-conflicting edits auto-merge with zero conflicts. Overlapping edits receive standard conflict markers (`<<<<<<< LOCAL` ... `>>>>>>> INCOMING`), activating VS Code's interactive CodeLens UI.
212
+ * **Smart `.env` Reconciliation:** Preserves local developer overrides (custom ports, local keys) while appending missing teammate secrets.
213
+ * **1-Click Safety Undo (`room undo`):** Pre-merge safety snapshots allow instant rollback if desired.
214
+
215
+ ### 4. Low-Bandwidth Terminal Multiplexing
216
+ * **Semantic ANSI Text vs Video Pixels:** Streams UTF-8 terminal text chunks over WebSockets instead of rendering video frames, eliminating screen sharing latency and blur.
217
+ * **Sub-Millisecond Dynamic RBAC:** Grant and revoke peer keyboard input access in real-time.
218
+ * **AAD Replay Defense:** Cryptographically binds Additional Authenticated Data (`term-input:${sessionId}:${senderId}:${roomId}:${seq}`) to prevent keystroke replay attacks.
219
+ * **Emergency Host Lock:** Instantly drop all remote input with one command.
220
+
221
+ ### 5. Signal-Grade E2EE Security
222
+ * **60-Digit Out-of-Band Safety Numbers:** Verify channels on calls to guarantee zero MITM interception.
223
+ * **TOFU Registry:** Trust-On-First-Use cryptographic registry for peer public keys.
224
+ * **Forward Secrecy Key Rotation (`room rotate-key`):** Automatically rekeys rooms when members leave, preventing evicted members from decrypting future streams or states.
412
225
 
413
226
  ---
414
227
 
415
- ### GitHub Integration Commands
416
-
417
- These commands let you interact with the GitHub repository linked to your current room. Requires connecting your GitHub account and repository on the Web Dashboard first.
418
-
419
- #### `statusgh`
420
- Show GitHub connection status and linked repository details.
421
- * **Aliases:** `statusgt`, `gh-status`
422
- * **Example:** `statusgh`
423
-
424
- #### `issues`
425
- List open issues in the linked GitHub repository.
426
- * **Aliases:** `gh-issues`
427
- * **Example:** `issues`
428
-
429
- #### `pulls`
430
- List open pull requests in the linked GitHub repository.
431
- * **Aliases:** `prs`, `gh-pulls`, `gh-prs`
432
- * **Example:** `pulls`
228
+ ## 🖥️ Terminal Sharing Architecture
433
229
 
434
- #### `commits`
435
- List the last 15 commits in the linked GitHub repository.
436
- * **Aliases:** `gh-commits`
437
- * **Example:** `commits`
230
+ ThinkNCollab terminal pair programming operates on semantic text streams rather than video capture:
438
231
 
439
- #### `issue-create <title> <body>`
440
- Create a new issue in the linked GitHub repository. If arguments are missing, the shell prompts for them interactively.
441
- * **Aliases:** `create-issue`, `gh-issue-create`, `gh-create-issue`
442
- * **Example:** `issue-create "API Timeout" "GET /thinknsh is failing under load"`
232
+ * **Text Streams Over WebSocket:** Raw PTY output (ANSI escape sequences and UTF-8 characters) is encrypted and streamed directly to connected peers, rendering natively in their local terminal client.
233
+ * **Zero Video Overhead:** Avoids high-bandwidth video encoding/decoding, delivering sharp text reproduction and minimal latency even over constrained networks.
234
+ * **Cryptographic Session Integrity:** Every keystroke packet is tagged with an incremental sequence counter and AES-256-GCM authentication tag bound to the active room, session, and peer identity.
443
235
 
444
236
  ---
445
237
 
446
- ## `tncproject` Auto-Boot
447
-
448
- Place a `tncproject` file in your project root to auto-login and auto-join a room when `thinknsh` starts in that directory — no manual `login` or `join` needed.
449
-
450
- ```
451
- .tncproject
452
- ```
453
-
454
- On startup the shell sends the encrypted config to the server, receives a shell token, saves the session, connects WebSocket, and joins the project room automatically:
455
-
456
- ```
457
- 📄 tncproject found
458
- Room : room-abc123
459
- File : /home/user/myproject/tncproject
460
-
461
- ✅ Raman Singh → room "My Project Room"
462
- ```
238
+ ## 📋 Platform Isolation Matrix
463
239
 
464
- If `tncproject` auth fails, the shell falls back to manual login.
240
+ | Capability | macOS | Linux | Windows (WSL2) |
241
+ | :--- | :--- | :--- | :--- |
242
+ | **Isolation Primitive** | Apple Virtualization (`tnc-vz` MicroVM + `crun`) / Seatbelt fallback | Kernel namespaces (`unshare` / `crun`) | WSL2 utility environment |
243
+ | **Resource Caps** | Dynamic Memory Ballooning + VirtioFS | `cgroups v2` (memory, CPU, pids) | WSL2 cgroups v2 |
244
+ | **Networking & Discovery** | Native `vsock` relay + Virtio-Net | Virtual bridge + veth + iptables | Netsh port proxy + localhost |
245
+ | **Snapshot Strategy** | APFS Copy-on-Write (`cp -cR`) | Btrfs / XFS reflink (`--reflink=auto`) | VSS / Directory copy fallback |
465
246
 
466
247
  ---
467
248
 
468
- ## Notification Window
249
+ ## 🚀 Installation & Quick Start
469
250
 
470
- When `thinknsh` starts it launches a background TCP notification server on an auto-assigned port (default start: `7379`) and opens a second terminal window to display live events — messages, task updates, user joins/leaves — without interrupting your main shell prompt.
471
-
472
- On **VS Code** (Windows) the notification window cannot be auto-spawned. The shell prints the command to run it manually:
251
+ ```bash
252
+ # Install globally via npm
253
+ npm install -g thinkncollab-shell
473
254
 
255
+ # Or run instantly via npx
256
+ npx thinkncollab-shell
474
257
  ```
475
- VS Code detected — open a new terminal tab and run:
476
- $env:THINKNSH_NOTIFY_PORT=7379; node "path/to/notification-window.js"
477
- ```
478
-
479
- On **macOS** it opens in a new Terminal.app window. On **Linux** it tries `gnome-terminal`, `xterm`, and `konsole` in order.
480
-
481
- ---
482
-
483
- ## Built-in Shell Features
484
-
485
- ### Persistent History
486
- Command history is saved to `~/.thinknsh_history` (up to 1000 entries) and restored on every launch. Use **Up/Down arrows** to navigate.
487
258
 
488
- ### Session Persistence
489
- After `login`, your session token is saved to `~/.thinkncollab/session.json`. The next time you start `thinknsh` you are already authenticated — no password prompt.
259
+ Both `thinknsh` and `tnc` command shortcuts are registered:
490
260
 
491
- ### Shell Variables
492
261
  ```bash
493
- thinknsh> set ROOM room-abc123
494
- thinknsh> join $ROOM
262
+ thinknsh --version
263
+ # 2.0.0
495
264
  ```
496
265
 
497
- ### Aliases
498
- Built-in aliases: `ll` → `ls -la`, `..` → `cd ..`, `~` → `cd ~`.
266
+ ---
499
267
 
500
- ### System Shell Passthrough
501
- Any command that is not a `thinknsh` built-in runs directly in your system shell (`bash` / `cmd.exe`):
268
+ ## 💻 CLI Cheat Sheet
502
269
 
270
+ ### Containers
503
271
  ```bash
504
- thinknsh> git status
505
- thinknsh> npm install
506
- thinknsh> python manage.py migrate
272
+ thinknsh run -d --name pg -p 5433:5432 -e POSTGRES_PASSWORD=secret postgres:alpine
273
+ thinknsh run -d --name cache -p 6379:6379 -m 512m redis:alpine
274
+ thinknsh ps
275
+ thinknsh exec pg psql -U postgres -c "SELECT version();"
276
+ thinknsh logs -f pg
277
+ thinknsh stop pg && thinknsh rm pg
278
+ thinknsh compose up -d
507
279
  ```
508
280
 
509
- > **Note:** On Windows, `open`, `which`, `grep`, `touch`, and `cat` are blocked (not available in cmd.exe) — use Windows equivalents or WSL.
510
-
511
- ### Quote Parsing
512
- Single and double quotes are supported for arguments with spaces:
513
-
281
+ ### Room State & Database Sync
514
282
  ```bash
515
- thinknsh> say "Deployment done — all green ✅"
516
- thinknsh> notify "title=Release v2.1" Pushed to prod
283
+ thinknsh room share [name] # Publish code, Postgres, Mongo & Redis state
284
+ thinknsh room share --no-code # Publish database & environment only
285
+ thinknsh room pull [state-id] # Smart-merge teammate state into workspace
286
+ thinknsh room merge [state-id] # Explicit 3-way merge
287
+ thinknsh room undo # Rollback last merge from safety backup
288
+ thinknsh room states # List shared states with service & code indicators
289
+ thinknsh room verify # Display 60-digit E2EE safety number & TOFU peers
290
+ thinknsh room rotate-key # Rekey room for forward secrecy
517
291
  ```
518
292
 
519
- ---
520
-
521
- ## Single-Command Mode
522
-
523
- Run any command as a one-liner without entering the interactive shell:
524
-
293
+ ### Real-Time Terminal Pair Programming
525
294
  ```bash
526
- thinknsh status
527
- thinknsh whoami
528
- thinknsh rooms
529
- thinknsh join room-abc123
530
- thinknsh say "Deployment complete ✅"
531
- thinknsh task list
532
- thinknsh notify "All tests passing"
295
+ thinknsh share # Start real-time PTY terminal sharing session
296
+ thinknsh share --readonly # Start in read-only broadcast mode
533
297
  ```
534
298
 
535
- Chain with `&&` for scripting:
536
-
299
+ ### Native Sandboxes & Process Control
537
300
  ```bash
538
- thinknsh login && thinknsh join room-abc123 && thinknsh say "I'm online"
301
+ thinknsh dev --port 3000 # Launch service in native process sandbox
302
+ thinknsh ps # Inspect active sandboxes & memory usage
303
+ thinknsh freeze <name> # Pause sandbox process (0% CPU/RAM)
304
+ thinknsh resume <name> # Resume paused sandbox instantly
305
+ thinknsh snapshot create <name> # Create sub-second CoW volume snapshot
306
+ thinknsh snapshot restore <name> # Restore volume state
539
307
  ```
540
308
 
541
- ---
542
-
543
- ## Examples
544
-
309
+ ### Multi-Language Package Manager (`dep`)
545
310
  ```bash
546
- # Full interactive session
547
- thinknsh
548
- thinknsh> login
549
- thinknsh> rooms
550
- thinknsh> join room-abc123
551
- thinknsh> say Good morning everyone 🚀
552
- thinknsh> task list
553
- thinknsh> task accept 64f1a...
554
- thinknsh> task start 64f1a...
555
- thinknsh> task complete 64f1a...
556
- thinknsh> share start
557
- thinknsh> share grant 64f2b...
558
- thinknsh> share stop
559
- thinknsh> notify "Daily standup in 5 mins"
560
- thinknsh> status
561
- thinknsh> exit
562
-
563
- # tncproject auto-boot (no login needed)
564
- cd ~/myproject # contains tncproject
565
- thinknsh # auto-logs in + auto-joins room
566
-
567
- # Quick one-liners from CI / scripts
568
- thinknsh say "Build #142 passed ✅"
569
- thinknsh notify "Hotfix deployed to production"
570
- thinknsh task complete $TASK_ID
311
+ thinknsh dep install <pkg> # Track & install package across npm/pip/cargo/go
312
+ thinknsh dep list # List all tracked dependencies
313
+ thinknsh dep sync # Reconcile environment from thinkncollab.yml
571
314
  ```
572
315
 
573
316
  ---
574
317
 
575
- ## License
318
+ ## 📄 License
576
319
 
577
- © ThinkNCollab
320
+ Apache License 2.0. See [LICENSE](LICENSE) for details.
321
+ Copyright (c) 2024-2026 ThinkNCollab Systems Inc. All rights reserved.