gitspace 0.2.0-rc.2 → 0.2.0-rc.20

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 (316) hide show
  1. package/.claude/settings.local.json +4 -15
  2. package/.gitspace/events.json +11 -0
  3. package/.gitspace/processes.json +23 -0
  4. package/.gitspace/{select → scripts/select}/01-status.sh +6 -7
  5. package/AGENTS.md +58 -28
  6. package/README.md +68 -38
  7. package/bun.lock +199 -52
  8. package/docs/CONNECTION.md +1 -1
  9. package/docs/QUICKSTART.md +11 -2
  10. package/docs/REMOTE-DESIGN.md +15 -10
  11. package/docs/ROADMAP.md +1 -1
  12. package/docs/SITE_DOCS_FIGMA_MAKE.md +63 -54
  13. package/docs/UNIFIED_ARCHITECTURE.md +135 -289
  14. package/landing-page/src/components/docs/DocsContent.tsx +106 -23
  15. package/landing-page/src/components/docs/DocsSidebar.tsx +7 -1
  16. package/landing-page/src/components/landing/CTA.tsx +1 -1
  17. package/landing-page/src/components/landing/Features.tsx +2 -2
  18. package/landing-page/src/components/landing/UseCases.tsx +1 -1
  19. package/package.json +30 -24
  20. package/scripts/GHOSTTY_TAB_BUG.md +106 -0
  21. package/scripts/build.ts +3 -3
  22. package/scripts/migrate-secrets.ts +77 -0
  23. package/scripts/sample-events.ts +263 -0
  24. package/scripts/test-tabs-minimal.ts +68 -0
  25. package/scripts/test-tabs-workaround.ts +95 -0
  26. package/scripts/test-tabs.ts +171 -0
  27. package/src/app/input/__tests__/sessionCommands.test.ts +40 -0
  28. package/src/app/input/sessionCommands.ts +94 -0
  29. package/src/app/session/__tests__/useAttachController.test.ts +229 -0
  30. package/src/app/session/createSessionBackend.bun.ts +76 -0
  31. package/src/app/session/createSessionBackend.web.ts +104 -0
  32. package/src/app/session/types.ts +16 -0
  33. package/src/app/session/useAttachController.ts +220 -0
  34. package/src/app/session/useProcessActions.ts +201 -0
  35. package/src/app/session/useSessionClient.ts +35 -0
  36. package/src/app/session/useWorkspaceDeleteFlow.ts +170 -0
  37. package/src/app.tui.tsx +2929 -0
  38. package/src/app.web.tsx +1454 -0
  39. package/src/commands/__tests__/connect-key.test.ts +10 -0
  40. package/src/commands/__tests__/events.test.ts +201 -0
  41. package/src/commands/__tests__/notifications.test.ts +349 -0
  42. package/src/commands/__tests__/process.test.ts +251 -0
  43. package/src/commands/__tests__/serve-process-hosting.test.ts +63 -0
  44. package/src/commands/add.ts +78 -75
  45. package/src/commands/auth.ts +5 -0
  46. package/src/commands/bundle.ts +232 -0
  47. package/src/commands/config.ts +242 -0
  48. package/src/commands/connect-key.ts +1 -0
  49. package/src/commands/connect.ts +363 -74
  50. package/src/commands/events.ts +157 -0
  51. package/src/commands/host.ts +183 -13
  52. package/src/commands/linear.ts +717 -0
  53. package/src/commands/list.ts +6 -25
  54. package/src/commands/migrate.ts +52 -0
  55. package/src/commands/notifications.ts +351 -0
  56. package/src/commands/process.ts +104 -0
  57. package/src/commands/remove.ts +88 -50
  58. package/src/commands/review.ts +787 -0
  59. package/src/commands/serve.ts +475 -22
  60. package/src/commands/share.ts +0 -5
  61. package/src/commands/switch.ts +9 -1
  62. package/src/components/DPad.web.tsx +343 -0
  63. package/src/components/DiffViewer.web.tsx +1192 -0
  64. package/src/components/Events.tsx +137 -0
  65. package/src/components/Events.tui.tsx +129 -0
  66. package/src/components/Events.web.tsx +386 -0
  67. package/src/components/FloatingControls.web.tsx +112 -0
  68. package/src/components/FloatingJogWheel.web.tsx +240 -0
  69. package/src/{shared/components → components}/Flow.tsx +12 -7
  70. package/src/{shared/components → components}/Flow.web.tsx +53 -53
  71. package/src/{shared/components → components}/Inbox.tsx +3 -1
  72. package/src/{shared/components → components}/Inbox.web.tsx +32 -32
  73. package/src/{shared/components → components}/MachineList.tsx +4 -4
  74. package/src/{shared/components → components}/MachineList.web.tsx +27 -27
  75. package/src/components/NumPad.web.tsx +270 -0
  76. package/src/{shared/components → components}/ProjectList.tsx +4 -5
  77. package/src/components/ProjectOnboardingStep.ts +23 -0
  78. package/src/components/ProjectOnboardingStep.tui.tsx +88 -0
  79. package/src/components/ProjectOnboardingStep.web.tsx +59 -0
  80. package/src/components/RemoteMachineScreen.tui.tsx +690 -0
  81. package/src/components/ScriptTerminal.tui.tsx +160 -0
  82. package/src/components/ScriptTerminal.web.tsx +89 -0
  83. package/src/components/SessionTerminal.tui.tsx +406 -0
  84. package/src/components/SessionTerminal.web.tsx +467 -0
  85. package/src/components/SpacesBrowser.tsx +540 -0
  86. package/src/{shared/components → components}/SpacesBrowser.tui.tsx +97 -2
  87. package/src/components/SpacesBrowser.web.tsx +332 -0
  88. package/src/components/TerminalControls.web.tsx +464 -0
  89. package/src/components/ThreadPanel.web.tsx +798 -0
  90. package/src/components/__tests__/SpacesBrowser.test.ts +541 -0
  91. package/src/components/__tests__/SpacesBrowser.tui.test.tsx +249 -0
  92. package/src/components/__tests__/script-terminal-buffer.tui.test.ts +72 -0
  93. package/src/{shared/components → components}/index.ts +2 -0
  94. package/src/components/review-decision-colors.ts +11 -0
  95. package/src/components/script-terminal-buffer.tui.ts +37 -0
  96. package/src/components/session-terminal-page-navigation.ts +48 -0
  97. package/src/{tui/terminal-bracketed-paste.test.ts → components/terminal-bracketed-paste.tui.test.ts} +1 -3
  98. package/src/{tui/terminal-bracketed-paste.ts → components/terminal-bracketed-paste.tui.ts} +0 -1
  99. package/src/core/__tests__/bundle-refresh.test.ts +567 -0
  100. package/src/core/__tests__/bundle.test.ts +209 -0
  101. package/src/core/__tests__/github-review.test.ts +781 -0
  102. package/src/core/__tests__/project-lifecycle.test.ts +137 -0
  103. package/src/core/__tests__/workspace-lifecycle.test.ts +159 -0
  104. package/src/core/__tests__/workspace.test.ts +149 -0
  105. package/src/core/bundle-refresh.ts +1064 -0
  106. package/src/core/bundle.ts +68 -84
  107. package/src/core/config.ts +70 -175
  108. package/src/core/git.ts +452 -1
  109. package/src/core/github-review.ts +761 -0
  110. package/src/core/linear.ts +180 -2
  111. package/src/core/preferences-service.ts +17 -0
  112. package/src/core/project-catalog.ts +52 -0
  113. package/src/core/project-lifecycle.ts +163 -0
  114. package/src/core/review-executor.ts +316 -0
  115. package/src/core/review.ts +407 -0
  116. package/src/core/secret-runtime.ts +167 -0
  117. package/src/core/shell.ts +28 -72
  118. package/src/core/workspace-lifecycle.ts +216 -0
  119. package/src/core/workspace.ts +363 -0
  120. package/src/hooks/__tests__/useLocalSession.tui.test.ts +557 -0
  121. package/src/hooks/index.ts +8 -0
  122. package/src/{tui/hooks/index.ts → hooks/index.tui.ts} +8 -11
  123. package/src/{tui/hooks/useDaemonStatus.ts → hooks/useDaemonStatus.tui.ts} +2 -2
  124. package/src/hooks/useLocalSession.tui.ts +395 -0
  125. package/src/hooks/useRelayConnection.web.ts +54 -0
  126. package/src/hooks/useRemoteMachines.tui.ts +166 -0
  127. package/src/hooks/useRemoteTerminal.tui.ts +22 -0
  128. package/src/hooks/useReview.web.ts +248 -0
  129. package/src/hooks/useTerminal.web.ts +36 -0
  130. package/src/hooks/useUserActivity.ts +61 -0
  131. package/src/hooks/useVisualViewport.web.ts +104 -0
  132. package/src/index.ts +581 -15
  133. package/src/lib/events/__tests__/collector-filter.test.ts +105 -0
  134. package/src/lib/events/__tests__/store-query.test.ts +103 -0
  135. package/src/lib/events/collector.ts +494 -0
  136. package/src/lib/events/filters.ts +26 -0
  137. package/src/lib/events/index.ts +11 -0
  138. package/src/lib/events/indexer.ts +14 -0
  139. package/src/lib/events/paths.ts +69 -0
  140. package/src/lib/events/reader.ts +212 -0
  141. package/src/lib/events/store.ts +141 -0
  142. package/src/lib/preferences-service.web.ts +41 -0
  143. package/src/lib/processes/__tests__/config.test.ts +83 -0
  144. package/src/lib/processes/__tests__/names.test.ts +125 -0
  145. package/src/lib/processes/__tests__/schema.test.ts +208 -0
  146. package/src/lib/processes/__tests__/watchdog.test.ts +210 -0
  147. package/src/lib/processes/autostart.ts +16 -0
  148. package/src/lib/processes/config.ts +187 -0
  149. package/src/lib/processes/control.ts +53 -0
  150. package/src/lib/processes/editor.ts +32 -0
  151. package/src/lib/processes/events-config.ts +37 -0
  152. package/src/lib/processes/index.ts +14 -0
  153. package/src/lib/processes/instances.ts +20 -0
  154. package/src/lib/processes/manager.ts +131 -0
  155. package/src/lib/processes/names.ts +71 -0
  156. package/src/lib/processes/registry.ts +26 -0
  157. package/src/lib/processes/runner.ts +211 -0
  158. package/src/lib/processes/scheduler.ts +17 -0
  159. package/src/lib/processes/schema.ts +74 -0
  160. package/src/lib/processes/session-list.ts +15 -0
  161. package/src/lib/processes/state.ts +82 -0
  162. package/src/lib/processes/watchdog.test.ts +79 -0
  163. package/src/lib/processes/watchdog.ts +106 -0
  164. package/src/lib/remote-session/__tests__/protocol.test.ts +291 -0
  165. package/src/lib/remote-session/index.ts +1 -1
  166. package/src/lib/remote-session/protocol.ts +181 -5
  167. package/src/lib/remote-session/session-handler.ts +776 -59
  168. package/src/lib/remote-session/workspace-scanner.ts +1 -7
  169. package/src/lib/sonner.web.ts +1 -0
  170. package/src/{web/src/lib/storage/identity-store.ts → lib/storage/identity-store.web.ts} +1 -1
  171. package/src/lib/tmux-lite/cli.ts +81 -22
  172. package/src/lib/tmux-lite/process-run.integration.test.ts +266 -0
  173. package/src/lib/tmux-lite/protocol.ts +28 -3
  174. package/src/lib/tmux-lite/server-lifecycle.test.ts +212 -0
  175. package/src/lib/tmux-lite/server.ts +183 -21
  176. package/src/notifications/__tests__/useNotifications.test.ts +739 -0
  177. package/src/notifications/index.ts +32 -0
  178. package/src/notifications/policy.test.ts +424 -0
  179. package/src/notifications/policy.ts +139 -0
  180. package/src/notifications/types.ts +82 -0
  181. package/src/notifications/useNotifications.ts +350 -0
  182. package/src/pages/ReviewPage.web.tsx +511 -0
  183. package/src/preferences/index.ts +1 -0
  184. package/src/preferences/types.ts +9 -0
  185. package/src/relay/server.ts +59 -23
  186. package/src/relay-client/__tests__/machine-directory-client.test.ts +152 -0
  187. package/src/relay-client/__tests__/useMachineDirectory.test.ts +172 -0
  188. package/src/relay-client/adapters/browser.ts +27 -0
  189. package/src/relay-client/adapters/node.ts +29 -0
  190. package/src/relay-client/index.ts +33 -0
  191. package/src/relay-client/machine-directory-client.ts +244 -0
  192. package/src/relay-client/useMachineDirectory.ts +175 -0
  193. package/src/serve/client-session-manager.ts +16 -3
  194. package/src/serve/types.ts +5 -0
  195. package/src/session/__tests__/backend-manager.test.ts +101 -0
  196. package/src/session/__tests__/local-session-backend.test.ts +1129 -0
  197. package/src/session/__tests__/reducer.test.ts +80 -0
  198. package/src/session/__tests__/remote-session-backend.test.ts +995 -0
  199. package/src/session/__tests__/session-name.test.ts +35 -0
  200. package/src/session/__tests__/useBundleRefreshAttachFlow.test.ts +431 -0
  201. package/src/session/__tests__/useRemoteSessionClient.test.ts +424 -0
  202. package/src/session/__tests__/workspace-shell-hooks.integration.test.ts +268 -0
  203. package/src/session/__tests__/workspace-shell-hooks.test.ts +24 -0
  204. package/src/session/adapters/browser-remote.ts +101 -0
  205. package/src/session/adapters/node-remote.ts +135 -0
  206. package/src/session/backend-key.ts +5 -0
  207. package/src/session/backend-manager.ts +80 -0
  208. package/src/session/backend.ts +93 -0
  209. package/src/session/backends/local-session-backend.ts +1119 -0
  210. package/src/session/backends/remote-session-backend.ts +1378 -0
  211. package/src/{web/src/lib → session}/crypto/__tests__/web-terminal.test.ts +13 -13
  212. package/src/{web/src/lib/crypto/handshake.ts → session/crypto/handshake.web.ts} +2 -2
  213. package/src/{web/src/lib/crypto/identity.ts → session/crypto/identity.web.ts} +6 -1
  214. package/src/{web/src/lib/crypto/relay-signing.ts → session/crypto/relay-signing.web.ts} +1 -1
  215. package/src/session/events.ts +38 -0
  216. package/src/session/index.ts +116 -0
  217. package/src/session/reducer.ts +274 -0
  218. package/src/session/selectors.ts +28 -0
  219. package/src/session/session-name.ts +50 -0
  220. package/src/session/types.ts +101 -0
  221. package/src/session/useBundleRefreshAttachFlow.ts +608 -0
  222. package/src/session/useRemoteSessionClient.ts +424 -0
  223. package/src/session/useSessionEngine.ts +432 -0
  224. package/src/session/workspace-shell-hooks.ts +35 -0
  225. package/src/tui/__tests__/input-text.test.ts +24 -0
  226. package/src/tui/__tests__/local-terminal-sync.test.ts +82 -0
  227. package/src/tui/__tests__/session-terminal-page-navigation.test.ts +94 -0
  228. package/src/tui/app.tsx +2 -1816
  229. package/src/tui/index.ts +7 -13
  230. package/src/tui/input-text.ts +38 -0
  231. package/src/tui/local-terminal-sync.ts +41 -0
  232. package/src/types/bundle-refresh.ts +42 -0
  233. package/src/types/bundle.ts +21 -3
  234. package/src/types/config.ts +217 -19
  235. package/src/types/errors.ts +88 -2
  236. package/src/types/events.ts +91 -0
  237. package/src/types/processes.ts +45 -0
  238. package/src/types/review.ts +349 -0
  239. package/src/types/script-phase.ts +3 -0
  240. package/src/utils/__tests__/onboarding.test.ts +358 -0
  241. package/src/utils/__tests__/run-scripts.test.ts +535 -0
  242. package/src/utils/__tests__/run-workspace-scripts.test.ts +406 -0
  243. package/src/utils/__tests__/workspace-setup.integration.test.ts +633 -0
  244. package/src/utils/__tests__/workspace-state.test.ts +78 -0
  245. package/src/utils/clipboard.ts +53 -0
  246. package/src/utils/deps.test.ts +31 -0
  247. package/src/utils/deps.ts +20 -2
  248. package/src/utils/device.web.ts +163 -0
  249. package/src/utils/hostnames.ts +43 -0
  250. package/src/utils/hunk-header.ts +17 -0
  251. package/src/utils/id.ts +9 -0
  252. package/src/utils/normalize-env-key.ts +13 -0
  253. package/src/utils/onboarding.ts +95 -45
  254. package/src/utils/prompts.ts +63 -1
  255. package/src/utils/run-scripts.ts +210 -15
  256. package/src/utils/run-workspace-scripts.ts +355 -0
  257. package/src/utils/sanitize.test.ts +149 -0
  258. package/src/utils/sanitize.ts +64 -0
  259. package/src/utils/secrets.ts +743 -29
  260. package/src/utils/workspace-id.ts +55 -0
  261. package/src/utils/workspace-state.ts +408 -28
  262. package/src/version.generated.d.ts +2 -0
  263. package/tsconfig.json +7 -1
  264. package/{src/web → web}/bun.lock +100 -0
  265. package/web/index.css +249 -0
  266. package/{src/web → web}/index.html +1 -1
  267. package/{src/web/src → web}/main.tsx +1 -1
  268. package/{src/web → web}/package.json +3 -1
  269. package/{src/web → web}/public/vite.svg +1 -1
  270. package/{src/web → web}/tsconfig.app.json +8 -1
  271. package/{src/web → web}/vite.config.ts +8 -0
  272. package/npm/darwin-arm64/bin/gssh +0 -0
  273. package/npm/darwin-arm64/package.json +0 -20
  274. package/src/shared/components/SpacesBrowser.tsx +0 -332
  275. package/src/shared/components/SpacesBrowser.web.tsx +0 -221
  276. package/src/shared/hooks/index.ts +0 -16
  277. package/src/shared/hooks/useNavigation.ts +0 -226
  278. package/src/shared/index.ts +0 -122
  279. package/src/shared/providers/LocalMachineProvider.ts +0 -425
  280. package/src/shared/providers/MachineProvider.ts +0 -165
  281. package/src/shared/providers/RemoteMachineProvider.ts +0 -444
  282. package/src/shared/providers/index.ts +0 -26
  283. package/src/shared/types.ts +0 -145
  284. package/src/tui/adapters.ts +0 -120
  285. package/src/tui/components/Terminal.tsx +0 -580
  286. package/src/tui/hooks/useAppState.ts +0 -314
  287. package/src/tui/hooks/useInboxTUI.ts +0 -113
  288. package/src/tui/hooks/useRemoteMachines.ts +0 -209
  289. package/src/tui/state.ts +0 -299
  290. package/src/web/src/App.tsx +0 -604
  291. package/src/web/src/assets/react.svg +0 -1
  292. package/src/web/src/components/Terminal.tsx +0 -207
  293. package/src/web/src/hooks/useRelayConnection.ts +0 -224
  294. package/src/web/src/hooks/useTerminal.ts +0 -699
  295. package/src/web/src/index.css +0 -55
  296. package/src/web/src/types/identity.ts +0 -45
  297. package/worker/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/12b7107e435bf1b9a8713a7f320472a63e543104d633d89a26f8d21f4e4ef182.sqlite +0 -0
  298. package/worker/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/12b7107e435bf1b9a8713a7f320472a63e543104d633d89a26f8d21f4e4ef182.sqlite-shm +0 -0
  299. package/worker/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/12b7107e435bf1b9a8713a7f320472a63e543104d633d89a26f8d21f4e4ef182.sqlite-wal +0 -0
  300. package/worker/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/1a1ac3db1ab86ecf712f90322868a9aabc2c7dc9fe2dfbe94f9b075096276b0f.sqlite +0 -0
  301. package/worker/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/1a1ac3db1ab86ecf712f90322868a9aabc2c7dc9fe2dfbe94f9b075096276b0f.sqlite-shm +0 -0
  302. package/worker/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/1a1ac3db1ab86ecf712f90322868a9aabc2c7dc9fe2dfbe94f9b075096276b0f.sqlite-wal +0 -0
  303. /package/.gitspace/{setup → scripts/setup}/01-install-deps.sh +0 -0
  304. /package/.gitspace/{setup → scripts/setup}/02-typecheck.sh +0 -0
  305. /package/src/{shared/components → components}/Flow.tui.tsx +0 -0
  306. /package/src/{shared/components → components}/Inbox.tui.tsx +0 -0
  307. /package/src/{shared/components → components}/MachineList.tui.tsx +0 -0
  308. /package/src/{shared/components → components}/ProjectList.tui.tsx +0 -0
  309. /package/src/{shared/components → components}/ProjectList.web.tsx +0 -0
  310. /package/src/{web/src/lib/invite.ts → lib/invite.web.ts} +0 -0
  311. /package/src/{web/src/lib/crypto/frames.ts → session/crypto/frames.web.ts} +0 -0
  312. /package/src/{web/src/lib/crypto/keyexchange.ts → session/crypto/keyexchange.web.ts} +0 -0
  313. /package/{src/web → web}/README.md +0 -0
  314. /package/{src/web → web}/eslint.config.js +0 -0
  315. /package/{src/web → web}/tsconfig.json +0 -0
  316. /package/{src/web → web}/tsconfig.node.json +0 -0
@@ -1,21 +1,10 @@
1
1
  {
2
2
  "permissions": {
3
3
  "allow": [
4
- "Bash(bun test:*)",
5
- "Bash(xargs ls:*)",
6
- "Bash(bun pm:*)",
7
- "Bash(node -e:*)",
8
- "Bash(bun run typecheck:*)",
9
- "Bash(bun -e:*)",
10
- "Bash(bun:*)",
11
- "Bash(xargs:*)",
12
- "Bash(timeout 2 bash -c 'echo \"\"invalid-base64\"\" | bun src/index.ts access add \"\"not-valid-base64-data\"\" 2>&1')",
13
- "Bash(wc:*)",
14
- "WebFetch(domain:ghostty.org)",
15
- "Bash(xxd:*)",
16
- "WebFetch(domain:ast-grep.github.io)",
17
- "WebFetch(domain:developers.cloudflare.com)",
18
- "WebFetch(domain:gitspace.sh)"
4
+ "Bash(gh api:*)",
5
+ "Bash(gh search code:*)",
6
+ "Bash(curl:*)",
7
+ "Bash(bun scripts/build.ts:*)"
19
8
  ]
20
9
  }
21
10
  }
@@ -0,0 +1,11 @@
1
+ {
2
+ "savedFilters": [
3
+ {
4
+ "name": "Sample process events",
5
+ "filter": {
6
+ "processName": "sample-events"
7
+ },
8
+ "sinceMinutes": 60
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "processes": [
3
+ {
4
+ "name": "sample-events",
5
+ "command": "bun",
6
+ "args": ["scripts/sample-events.ts"],
7
+ "autostart": false,
8
+ "events": {
9
+ "keepRawOutput": false,
10
+ "correlationField": "requestId",
11
+ "aggregateMode": "stream",
12
+ "updateIntervalMs": 200,
13
+ "maxTimeline": 50
14
+ },
15
+ "restart": {
16
+ "policy": "always",
17
+ "maxAttempts": 10,
18
+ "backoffMs": 2000,
19
+ "maxBackoffMs": 15000
20
+ }
21
+ }
22
+ ]
23
+ }
@@ -3,9 +3,8 @@
3
3
  #
4
4
  # This runs every time you switch to an existing workspace.
5
5
  #
6
- # Bundle values are available as environment variables:
7
- # SPACE_VALUE_<KEY> - Regular values from input steps
8
- # SPACE_SECRET_<KEY> - Secret values from secret steps
6
+ # Bundle values are available using exact keys and uppercase snake-case aliases.
7
+ # Example aliases: DEVELOPER_NAME, EXAMPLE_API_TOKEN
9
8
 
10
9
  WORKSPACE_NAME=$1
11
10
  REPOSITORY=$2
@@ -15,14 +14,14 @@ echo "=== Workspace: $WORKSPACE_NAME ==="
15
14
  echo ""
16
15
 
17
16
  # Show bundle values (proof of concept)
18
- if [ -n "$SPACE_VALUE_DEVELOPERNAME" ]; then
19
- echo "Welcome back, $SPACE_VALUE_DEVELOPERNAME!"
17
+ if [ -n "$DEVELOPER_NAME" ]; then
18
+ echo "Welcome back, $DEVELOPER_NAME!"
20
19
  fi
21
20
 
22
21
  # Show that we have access to the secret (masked)
23
- if [ -n "$SPACE_SECRET_EXAMPLEAPITOKEN" ]; then
22
+ if [ -n "$EXAMPLE_API_TOKEN" ]; then
24
23
  # Only show first 4 characters to prove we have access
25
- TOKEN_PREVIEW="${SPACE_SECRET_EXAMPLEAPITOKEN:0:4}..."
24
+ TOKEN_PREVIEW="${EXAMPLE_API_TOKEN:0:4}..."
26
25
  echo "API Token available: $TOKEN_PREVIEW (stored in OS keychain)"
27
26
  fi
28
27
 
package/AGENTS.md CHANGED
@@ -14,7 +14,7 @@ This document provides comprehensive information for AI assistants working on th
14
14
  - **X3DH handshake** for forward-secret session encryption
15
15
  - Web terminal interface (React + xterm.js)
16
16
  - Linear issue integration for workspace creation
17
- - Convention-based custom scripts (pre, setup, select phases)
17
+ - Convention-based custom scripts in `.gitspace/scripts/` (pre, setup, select, remove phases)
18
18
 
19
19
  ## Architecture
20
20
 
@@ -22,11 +22,12 @@ This document provides comprehensive information for AI assistants working on th
22
22
 
23
23
  1. **Projects**: Top-level containers for a GitHub repository
24
24
  - Located at `~/gitspace/<project-name>/`
25
- - Contains: base repo clone, workspaces, scripts, config
25
+ - Contains: base repo clone, workspaces, config
26
26
 
27
27
  2. **Workspaces**: Individual git worktrees for features/branches
28
28
  - Located at `~/gitspace/<project-name>/workspaces/<workspace-name>/`
29
29
  - Each workspace has its own branch
30
+ - Scripts are sourced from `.gitspace/scripts/<phase>/` in the workspace (version-controlled)
30
31
 
31
32
  3. **Sessions**: PTY terminal sessions managed by tmux-lite
32
33
  - Can be attached from multiple clients
@@ -50,7 +51,7 @@ This document provides comprehensive information for AI assistants working on th
50
51
  ```
51
52
  src/
52
53
  ├── index.ts # Entry point (TUI or CLI dispatch)
53
- ├── commands/ # CLI command implementations (16 files)
54
+ ├── commands/ # CLI command implementations (17 files)
54
55
  │ ├── access.ts # Access control list (add/list/remove)
55
56
  │ ├── add.ts # Add projects/workspaces
56
57
  │ ├── auth.ts # GitHub OAuth for gitspace.sh
@@ -58,6 +59,7 @@ src/
58
59
  │ ├── directory.ts # Get project directory path
59
60
  │ ├── host.ts # Subdomain hosting (reserve/release/list)
60
61
  │ ├── identity.ts # Identity management (init/show)
62
+ │ ├── linear.ts # Linear integration (setup/show/clear)
61
63
  │ ├── list.ts # List projects/workspaces
62
64
  │ ├── machine.ts # Remote machine management (invite/list)
63
65
  │ ├── relay.ts # Relay server (start/token)
@@ -126,22 +128,21 @@ src/
126
128
  │ │ └── ProjectList.tui.tsx
127
129
  │ ├── providers/ # Machine access abstraction
128
130
  │ │ ├── MachineProvider.ts # Interface definition
129
- │ │ ├── LocalMachineProvider.ts # Direct tmux-lite access
130
- │ │ └── RemoteMachineProvider.ts # Via relay
131
+ │ │ └── LocalMachineProvider.ts # Direct tmux-lite access
131
132
  │ ├── hooks/
132
- │ │ └── useNavigation.ts # Navigation state management
133
+ │ │ └── useUserActivity.ts # Activity tracking for notifications
133
134
  │ └── types.ts # Shared type definitions
134
135
  ├── tui/ # Terminal UI (OpenTUI)
135
136
  │ ├── index.ts # TUI entry point
136
137
  │ ├── app.tsx # Main TUI application
137
- │ ├── state.ts # State management
138
- │ ├── adapters.ts # Local/remote machine adapters
139
138
  │ ├── components/
140
- │ │ └── Terminal.tsx # Embedded terminal
139
+ │ │ ├── RemoteMachineScreen.tsx # Remote machine browser screen
140
+ │ │ └── RemoteTerminal.tsx # Embedded session terminal
141
141
  │ └── hooks/
142
- │ ├── useAppState.ts
143
142
  │ ├── useRemoteMachines.ts
144
- └── useInboxTUI.ts
143
+ ├── useRemoteTerminal.ts
144
+ │ ├── useLocalSession.ts
145
+ │ └── useDaemonStatus.ts
145
146
  ├── web/ # Web application (Vite + React)
146
147
  │ └── src/
147
148
  │ ├── App.tsx # Main web app
@@ -215,10 +216,11 @@ src/
215
216
  | Command | Description |
216
217
  |---------|-------------|
217
218
  | `gssh relay start` | Start relay server |
218
- | `gssh relay token` | Create account JWT (HMAC) |
219
- | `gssh relay authorize <pubkey>` | Authorize a client on relay |
220
- | `gssh relay revoke <id>` | Revoke client authorization |
219
+ | `gssh relay authorize <pubkey>` | Authorize a machine on relay |
220
+ | `gssh relay revoke <id>` | Revoke machine authorization |
221
221
  | `gssh relay machines` | List authorized machines |
222
+ | `gssh relay trusted` | List trusted relays |
223
+ | `gssh relay untrust <url>` | Remove relay from trusted list |
222
224
 
223
225
  ### tmux-lite Daemon
224
226
  | Command | Description |
@@ -251,6 +253,23 @@ src/
251
253
  | `gssh host set-primary <name>` | Set primary subdomain |
252
254
  | `gssh host status` | Show hosting status |
253
255
 
256
+ ### Linear Integration
257
+ | Command | Description |
258
+ |---------|-------------|
259
+ | `gssh linear setup` | Configure Linear integration (API key + teams) |
260
+ | `gssh linear setup --project <name>` | Configure Linear for a specific project |
261
+ | `gssh linear show` | Show user-level Linear configuration |
262
+ | `gssh linear show --project <name>` | Show project-specific Linear configuration |
263
+ | `gssh linear clear` | Clear user-level Linear configuration |
264
+ | `gssh linear clear --project <name>` | Clear project-specific Linear configuration |
265
+
266
+ ### Bundle Management
267
+ | Command | Description |
268
+ |---------|-------------|
269
+ | `gssh bundle status` | Show bundle status for current project |
270
+ | `gssh bundle refresh` | Re-run bundle onboarding (keeps previous values as defaults) |
271
+ | `gssh bundle refresh --force` | Force refresh even if no changes detected |
272
+
254
273
  ## Remote Access Architecture
255
274
 
256
275
  ```
@@ -263,10 +282,19 @@ src/
263
282
  └─────────────────┘ └─────────────────┘ └─────────────────┘
264
283
  ```
265
284
 
266
- ### Connection Flow
285
+ ### Connection Flow (gitspace.sh Hosting)
267
286
 
268
- 1. Machine runs `gssh serve --relay <url> --token <jwt>`
269
- 2. Machine registers with relay (sends public keys)
287
+ 1. User logs in: `gssh auth login` (GitHub OAuth)
288
+ 2. User reserves subdomain: `gssh host reserve <name>`
289
+ 3. Machine runs `gssh serve start` (auto-starts local relay + cloudflared tunnel)
290
+ 4. Client connects via web: `https://<name>.gitspace.sh`
291
+ 5. X3DH handshake establishes session keys
292
+ 6. All terminal I/O is E2E encrypted
293
+
294
+ ### Connection Flow (Self-Hosted Relay)
295
+
296
+ 1. Machine runs `gssh serve start --relay ws://relay:4480/ws`
297
+ 2. Machine registers with relay (Ed25519 challenge-response auth)
270
298
  3. Machine creates invite: `gssh share create`
271
299
  4. Client connects with invite: `gssh connect <token>`
272
300
  5. X3DH handshake establishes session keys
@@ -280,7 +308,7 @@ src/
280
308
  | Key exchange | X25519 |
281
309
  | Symmetric encryption | AES-256-GCM |
282
310
  | Key derivation | HKDF-SHA256 |
283
- | JWT signing | HMAC-SHA256 |
311
+ | Relay authentication | Ed25519 challenge-response |
284
312
 
285
313
  ## TUI/Web Shared Component Pattern
286
314
 
@@ -306,7 +334,7 @@ interface MachineProvider {
306
334
  ```
307
335
 
308
336
  - `LocalMachineProvider`: Direct filesystem + tmux-lite CLI
309
- - `RemoteMachineProvider`: Via relay WebSocket
337
+ - Remote machine access in UI now uses shared relay/session hooks + backend adapters (`shared/relay/*`, `shared/session/*`)
310
338
 
311
339
  ## Development Workflow
312
340
 
@@ -322,11 +350,14 @@ bun run build
322
350
  # Run TUI
323
351
  bun src/index.ts
324
352
 
325
- # Run relay
326
- RELAY_SIGNING_SECRET=secret bun src/index.ts relay start
353
+ # Run relay (uses Ed25519 identity from keychain)
354
+ bun src/index.ts relay start
355
+
356
+ # Run serve with gitspace.sh hosting (requires auth login + host reserve)
357
+ bun src/index.ts serve start
327
358
 
328
- # Run serve
329
- bun src/index.ts serve --relay ws://localhost:8080/ws --token <jwt>
359
+ # Run serve with self-hosted relay
360
+ bun src/index.ts serve start --relay ws://localhost:4480/ws
330
361
  ```
331
362
 
332
363
  ### Code Style
@@ -409,6 +440,7 @@ bun src/index.ts serve --relay ws://localhost:8080/ws --token <jwt>
409
440
  | Access list | `~/gitspace/.access.json` | Authorized client public keys |
410
441
  | Machine info | `~/gitspace/.machine.json` | Machine registration |
411
442
  | Relay config | `~/gitspace/.relay.json` | Relay configuration cache |
443
+ | Host config | `~/gitspace/host.json` | gitspace.sh subdomain config |
412
444
  | Daemon state | `~/gitspace/.serve/` | PID files, status sockets |
413
445
  | tmux-lite state | `/tmp/` | Session data (configurable via `TMUX_LITE_SESSION_DIR`) |
414
446
 
@@ -418,9 +450,8 @@ bun src/index.ts serve --relay ws://localhost:8080/ws --token <jwt>
418
450
  |----------|-------------|---------|
419
451
  | `RELAY_PORT` | Relay server port | `4480` |
420
452
  | `RELAY_BIND` | Relay bind address | `0.0.0.0` |
421
- | `RELAY_SIGNING_SECRET` | Secret for HMAC JWT signing | Required |
422
453
  | `RELAY_PRIVATE_KEY` | Base64 Ed25519 private key | Uses keychain |
423
- | `SPACES_CURRENT_PROJECT` | Override current project | From config |
454
+ | `RELAY_LABEL` | Label for relay identity | None |
424
455
  | `GITSPACE_API_URL` | gitspace.sh API URL | `https://api.gitspace.sh` |
425
456
 
426
457
  ### Default Values
@@ -431,9 +462,8 @@ bun src/index.ts serve --relay ws://localhost:8080/ws --token <jwt>
431
462
  | Base branch | `main` | Global/project config |
432
463
  | Stale workspace days | `30` | Global config |
433
464
  | Relay port | `4480` | CLI/env |
434
- | Default relay URL | `wss://relay.gitspace.sh` | CLI |
435
465
 
436
466
  ---
437
467
 
438
- **Last Updated**: 2025-01
439
- **Runtime**: Bun / Node.js 18+
468
+ **Last Updated**: 2026-01
469
+ **Runtime**: Bun 1.3+
package/README.md CHANGED
@@ -20,7 +20,6 @@ The following tools must be installed and available in your PATH:
20
20
  - [GitHub CLI (`gh`)](https://cli.github.com/) - for listing repositories
21
21
  - [Git](https://git-scm.com/) - for worktree management
22
22
  - [jq](https://stedolan.github.io/jq/) - for JSON processing
23
- - [Bun](https://bun.sh) - runtime for the CLI
24
23
 
25
24
  **GitHub Authentication**: You must authenticate the GitHub CLI before using GitSpace:
26
25
 
@@ -31,7 +30,17 @@ gh auth login
31
30
  ## Installation
32
31
 
33
32
  ```bash
34
- bun install -g https://github.com/inkibra/gitspace.sh
33
+ # npm
34
+ npm install -g gitspace
35
+
36
+ # bun
37
+ bun install -g gitspace
38
+
39
+ # pnpm
40
+ pnpm install -g gitspace
41
+
42
+ # yarn
43
+ yarn global add gitspace
35
44
 
36
45
  # Verify installation
37
46
  gssh --version
@@ -97,6 +106,22 @@ gssh switch
97
106
  gssh switch my-feature
98
107
  ```
99
108
 
109
+ ### Workspace Session Mode (`space`)
110
+
111
+ When GitSpace opens a workspace-scoped terminal session, it injects a `space` shell function (bash/zsh).
112
+
113
+ - Use `space ...` for workspace operations without repeating `--project` and `--workspace`
114
+ - `gssh` commands are restricted in this mode to avoid cross-workspace mistakes
115
+ - `gssh tmux ...` is blocked inside workspace sessions
116
+
117
+ Examples:
118
+
119
+ ```bash
120
+ space context --json
121
+ space review hunks src/app.ts --format json
122
+ space review add-hunk src/app.ts --index 1 --approve --body "Looks good"
123
+ ```
124
+
100
125
  ## Repo Config Bundles
101
126
 
102
127
  Repo config bundles allow repository owners to share onboarding configurations with their team. When someone clones a project that contains a bundle, they'll be guided through setup steps and have scripts automatically installed.
@@ -108,14 +133,15 @@ A bundle is a directory (typically `.gitspace/`) containing:
108
133
  ```
109
134
  .gitspace/
110
135
  ├── bundle.json # Bundle manifest with onboarding steps
111
- ├── pre/ # Scripts to run before setup
112
- │ └── 01-copy-env.sh
113
- ├── setup/ # Scripts to run on first workspace creation
114
- │ └── 01-install-deps.sh
115
- ├── select/ # Scripts to run every time workspace is opened
116
- │ └── 01-status.sh
117
- └── remove/ # Scripts to run before workspace deletion
118
- └── 01-cleanup.sh
136
+ └── scripts/
137
+ ├── pre/ # Deprecated: migrate scripts into ordered setup/
138
+ │ └── 01-copy-env.sh
139
+ ├── setup/ # Scripts for setup runs (when bundle/value state changes)
140
+ │ └── 01-install-deps.sh
141
+ ├── select/ # Scripts to run on each new terminal attach
142
+ └── 01-status.sh
143
+ └── remove/ # Scripts to run before workspace deletion
144
+ └── 01-cleanup.sh
119
145
  ```
120
146
 
121
147
  ### Bundle Manifest (`bundle.json`)
@@ -170,27 +196,27 @@ A bundle is a directory (typically `.gitspace/`) containing:
170
196
 
171
197
  ### Using Bundle Values in Scripts
172
198
 
173
- Bundle values are passed to scripts as environment variables:
199
+ Bundle values are passed to scripts as environment variables using the configured bundle keys:
174
200
 
175
- - `SPACE_VALUE_<KEY>` - Regular values from input steps
176
- - `SPACE_SECRET_<KEY>` - Secret values from secret steps (fetched from OS keychain)
201
+ - `<KEY>` - Regular or secret value using the exact `configKey` from `bundle.json`
202
+ - `<NORMALIZED_KEY>` - Uppercase snake-case alias (for example, `teamName` -> `TEAM_NAME`)
177
203
 
178
204
  **Example script:**
179
205
 
180
206
  ```bash
181
207
  #!/bin/bash
182
- # .gitspace/select/01-status.sh
208
+ # .gitspace/scripts/select/01-status.sh
183
209
 
184
210
  WORKSPACE_NAME=$1
185
211
  REPOSITORY=$2
186
212
 
187
213
  # Access bundle values
188
- if [ -n "$SPACE_VALUE_TEAMNAME" ]; then
189
- echo "Welcome, $SPACE_VALUE_TEAMNAME team!"
214
+ if [ -n "$TEAM_NAME" ]; then
215
+ echo "Welcome, $TEAM_NAME team!"
190
216
  fi
191
217
 
192
218
  # Access secrets (stored securely in OS keychain)
193
- if [ -n "$SPACE_SECRET_APIKEY" ]; then
219
+ if [ -n "$API_KEY" ]; then
194
220
  echo "API Key configured"
195
221
  fi
196
222
  ```
@@ -199,7 +225,7 @@ fi
199
225
 
200
226
  Bundles can be loaded from:
201
227
 
202
- 1. **In-repo** (automatic): `.gitspace/`, `.gitspace-config/`, `.spaces-config/`, or `.spaces/` in the cloned repository
228
+ 1. **In-repo** (automatic): `.gitspace/` directory in the cloned repository
203
229
  2. **Local path**: `gssh add project --bundle-path /path/to/bundle/`
204
230
  3. **Remote URL**: `gssh add project --bundle-url https://example.com/bundle.zip`
205
231
 
@@ -347,14 +373,16 @@ Located at `~/gitspace/<project-name>/.config.json`:
347
373
 
348
374
  ### Custom Scripts
349
375
 
350
- GitSpace uses **convention over configuration** for custom scripts:
376
+ GitSpace uses **convention over configuration** for custom scripts. Scripts live
377
+ inside each workspace so they can vary by branch:
351
378
 
352
379
  ```
353
- ~/gitspace/<project-name>/scripts/
354
- ├── pre/ # Run before setup (terminal)
355
- ├── setup/ # Run once on workspace creation
356
- ├── select/ # Run every time workspace is opened
357
- └── remove/ # Run before workspace deletion
380
+ ~/gitspace/<project-name>/workspaces/<workspace-name>/.gitspace/
381
+ └── scripts/
382
+ ├── pre/ # Deprecated: run before setup (migrate to setup/)
383
+ ├── setup/ # Run when setup state requires refresh
384
+ ├── select/ # Run on each new terminal attach
385
+ └── remove/ # Run before workspace deletion
358
386
  ```
359
387
 
360
388
  #### Script Execution Rules
@@ -363,15 +391,15 @@ GitSpace uses **convention over configuration** for custom scripts:
363
391
  2. Scripts run **alphabetically** (use `01-`, `02-` prefixes)
364
392
  3. **Working directory**: The workspace directory
365
393
  4. **Arguments**: `$1` = workspace name, `$2` = repository name
366
- 5. **Environment**: Bundle values available as `SPACE_VALUE_*` and `SPACE_SECRET_*`
394
+ 5. **Environment**: Bundle values available by key name (for example `REGION`, `PULUMI_ACCESS_TOKEN`)
367
395
 
368
396
  #### Script Phases
369
397
 
370
398
  | Phase | When | Use Case |
371
399
  |-------|------|----------|
372
- | `pre/` | Once, before setup | Copy .env files, create directories |
373
- | `setup/` | Once, on workspace creation | Install dependencies, initial build |
374
- | `select/` | Every workspace open | Git fetch, status checks |
400
+ | `pre/` | Deprecated | Move scripts into ordered `setup/` files |
401
+ | `setup/` | When setup state changes | Install dependencies, initial build |
402
+ | `select/` | Every new terminal attach | Git fetch, status checks |
375
403
  | `remove/` | Before deletion | Cleanup, notifications |
376
404
 
377
405
  ### Environment Variables
@@ -381,8 +409,8 @@ GitSpace uses **convention over configuration** for custom scripts:
381
409
  export SPACES_CURRENT_PROJECT="my-app"
382
410
 
383
411
  # Available in scripts (from bundle onboarding):
384
- # SPACE_VALUE_<KEY> - Regular values
385
- # SPACE_SECRET_<KEY> - Secret values (from OS keychain)
412
+ # <KEY> - Value by exact bundle config key name
413
+ # <NORMALIZED_KEY> - Uppercase snake-case alias (e.g. teamName -> TEAM_NAME)
386
414
  ```
387
415
 
388
416
  ## Directory Structure
@@ -396,13 +424,15 @@ export SPACES_CURRENT_PROJECT="my-app"
396
424
  │ ├── workspaces/ # Git worktrees
397
425
  │ │ └── <workspace-name>/
398
426
  │ │ ├── gitspace.lock # Setup completion marker
399
- │ │ └── .prompt/ # Linear issue details (if applicable)
400
- │ │ └── issue.md
401
- │ └── scripts/ # Custom scripts
402
- ├── pre/
403
- ├── setup/
404
- ├── select/
405
- └── remove/
427
+ │ │ ├── .prompt/ # Linear issue details (if applicable)
428
+ │ │└── issue.md
429
+ └── .gitspace/
430
+ ├── bundle.json
431
+ │ └── scripts/ # Custom scripts (per worktree)
432
+ ├── pre/
433
+ │ ├── setup/
434
+ │ │ ├── select/
435
+ │ │ └── remove/
406
436
  ```
407
437
 
408
438
  ## Remote Access
@@ -578,7 +608,7 @@ Error: GitHub CLI is not authenticated
578
608
 
579
609
  ### Bundle secrets not available
580
610
 
581
- If `SPACE_SECRET_*` variables are empty, ensure:
611
+ If expected bundle key environment variables are empty, ensure:
582
612
  1. You completed the onboarding secret steps
583
613
  2. Your OS keychain service is running (libsecret on Linux, Keychain on macOS)
584
614