@pi-chamber/web 1.0.4 → 1.0.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/cli.js +21 -2
- package/bin/cli.test.js +164 -4
- package/bin/lib/DOCUMENTATION.md +3 -3
- package/bin/lib/cli-args.js +96 -13
- package/bin/lib/commands-connect-url-tailscale.test.js +136 -0
- package/bin/lib/commands-connect-url.js +146 -39
- package/bin/lib/commands-connect-url.test.js +126 -0
- package/bin/lib/commands-serve.js +45 -2
- package/bin/lib/commands-status.js +28 -5
- package/bin/lib/commands-status.test.js +107 -0
- package/bin/lib/commands-tunnel.js +36 -10
- package/dist/assets/{DiagramView-BpG1c3Hi.js → DiagramView-D-OSWTbO.js} +1 -1
- package/dist/assets/DiffView-BKT-MIH4.js +18 -0
- package/dist/assets/{FileSaveConflictDialog-DP7k9a-i.js → FileSaveConflictDialog-DBkVFssC.js} +2 -2
- package/dist/assets/FilesView-B7GIuRlh.js +6 -0
- package/dist/assets/{GitHubDetailScaffold-UxLAMAOl.js → GitHubDetailScaffold-C9rCZMUT.js} +2 -2
- package/dist/assets/{GitHubLinkPicker-Bh9RO1yK.js → GitHubLinkPicker-Bm09hvhJ.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-DQyhT5wG.js → GitHubListPrimitives-DlhAlxI6.js} +1 -1
- package/dist/assets/{GitView-XBBheKRM.js → GitView-BgqdMb0m.js} +4 -4
- package/dist/assets/{IssuesSurface-BA1kpvAJ.js → IssuesSurface-BZXAvt49.js} +3 -3
- package/dist/assets/{JsonTreeView-BAaEPL4O.js → JsonTreeView-BKgCQjh_.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DzgDmUsL.js → MarkdownRendererImpl-BdcyMPw-.js} +1 -1
- package/dist/assets/{PatchDiff-BMEUsgXH.js → PatchDiff-2MmWXcGe.js} +1 -1
- package/dist/assets/PierreDiffViewer-D1F2WvD0.js +135 -0
- package/dist/assets/PullRequestsSurface-CN2z3DFv.js +2 -0
- package/dist/assets/SessionSwitcherContent-CCljxAZb.js +1 -0
- package/dist/assets/SessionSwitcherDropdown-DtNt3qw4.js +2 -0
- package/dist/assets/SessionUnreadDot-B9bHMy5q.js +1 -0
- package/dist/assets/SettingsView-DaZVCInW.js +6 -0
- package/dist/assets/{SettingsWindow-j0e99YI0.js → SettingsWindow-C-ydfopH.js} +1 -1
- package/dist/assets/StickyHorizontalScrollbar-BMITjK4e.js +8 -0
- package/dist/assets/{ToolOutputDialog-VlS12Xyq.js → ToolOutputDialog-DJUAx_Oj.js} +4 -4
- package/dist/assets/{ToolPartDiffPreview-DdSneZws.js → ToolPartDiffPreview-DFyuJM4c.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-BqiXjvP6.js → VirtualizedFileDiff-BS-af6rn.js} +4 -4
- package/dist/assets/{Virtualizer-Cp_cJWbI.js → Virtualizer-DP6HbEeC.js} +1 -1
- package/dist/assets/{collapsible-C7oyikVm.js → collapsible-BOcd0lzY.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-BJjC-tXV.js → computeVirtualFileMetrics-BI6wORhM.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-BBzqKGei.js → contextFileOpenGuard-DUMSGR4M.js} +1 -1
- package/dist/assets/{gitStatusPredicates-Dq-E5DaH.js → gitStatusPredicates-FdKYDZe3.js} +1 -1
- package/dist/assets/{githubLink-Cryd7GkG.js → githubLink-B3-BaGpb.js} +5 -5
- package/dist/assets/index-DWSrsQWl.js +11 -0
- package/dist/assets/{index-BbhXFTId.js → index-Df-vmvzu.js} +1 -1
- package/dist/assets/index-DsQIBAWK.css +1 -0
- package/dist/assets/main-61_cd7S7.js +2 -0
- package/dist/assets/main-q43jqZ2I.js +136 -0
- package/dist/assets/{markdownCore-B9AuEyYi.js → markdownCore-CqHYlXi_.js} +2 -2
- package/dist/assets/{miniChat-CgOaJfD8.js → miniChat-vOuWN5pV.js} +2 -2
- package/dist/assets/mobile-mrXWV5ky.js +2 -0
- package/dist/assets/{nativeFileSave-BzhtrDoD.js → nativeFileSave-CFuugNKV.js} +1 -1
- package/dist/assets/pi-session-focus-preference-BEufpwC6.js +9 -0
- package/dist/assets/{renderDiffWithHighlighter-CVLsdtQ5.js → renderDiffWithHighlighter-BD9CAhZU.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-QQFXkY5Y.js +2 -0
- package/dist/assets/{renderFileWithHighlighter-DJ9mk2bZ.js → renderFileWithHighlighter-KiEWMtzI.js} +1 -1
- package/dist/assets/renderMobileApp-DIZYvrhi.js +11 -0
- package/dist/assets/runtimeEndpointReset-BA2uP2rj.js +62 -0
- package/dist/assets/{runtimeSurface-DBiUWYK2.js → runtimeSurface-Der4qUnI.js} +1 -1
- package/dist/assets/useAppFontEffects-Bfw_d5eB.js +212 -0
- package/dist/assets/{useFilesViewSearch-D2Au5Xgt.js → useFilesViewSearch-Budwejnx.js} +3 -3
- package/dist/assets/useGitHubRemoteSearch-gUdylYy3.js +1 -0
- package/dist/assets/{useSwitcherItems-Dej8BzXI.js → useSwitcherItems-yHSMduoo.js} +1 -1
- package/dist/assets/{vendor-aparajita-capacitor-secure-storage-BYohCVY0.js → vendor-aparajita-capacitor-secure-storage-BDrMx_CE.js} +1 -1
- package/dist/assets/{vendor-base-ui-BscvGUFt.js → vendor-base-ui-CKRUCG-f.js} +1 -1
- package/dist/assets/{vendor-boot-Dgb9NVFe.js → vendor-boot-EC6IyLt1.js} +13 -13
- package/dist/assets/{vendor-capacitor-app-BjdQVib9.js → vendor-capacitor-app-BaupizkW.js} +1 -1
- package/dist/assets/{vendor-capacitor-keyboard-eTtI5go3.js → vendor-capacitor-keyboard-9BVxykO7.js} +1 -1
- package/dist/assets/{vendor-capacitor-status-bar-9rNIGxlO.js → vendor-capacitor-status-bar-BsrUwiaA.js} +1 -1
- package/dist/assets/{vendor-codemirror-autocomplete-DxS3jwvE.js → vendor-codemirror-autocomplete-CGpAsPWp.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-angular-DdjXl9e2.js → vendor-codemirror-lang-angular-CDJoHJSY.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp--aMr7NVt.js → vendor-codemirror-lang-cpp-BmHofQls.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-CZ_qxZY9.js → vendor-codemirror-lang-css-RM2HqXZ0.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-Ca-y2Alu.js → vendor-codemirror-lang-go-Crwca_X7.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-html-COZ0L5wT.js → vendor-codemirror-lang-html-CHSHUpwq.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-java-D3Rf3QNJ.js → vendor-codemirror-lang-java-lhQXgWu0.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-javascript-DwJ-IvCs.js → vendor-codemirror-lang-javascript-Dw4kFO4e.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-jinja-D_5lod6k.js → vendor-codemirror-lang-jinja-_pAC3UTN.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-BG8C7OpC.js → vendor-codemirror-lang-json-B-b1vAv-.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-CVEkoaTw.js → vendor-codemirror-lang-less-xIgOi1ze.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-U9vj0m8w.js → vendor-codemirror-lang-liquid-CP49m5dB.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-markdown-DqlYH9gY.js → vendor-codemirror-lang-markdown-BTht2ATe.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-php-BFEiEVA1.js → vendor-codemirror-lang-php-BguZDhaO.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-Cz1dQXQd.js → vendor-codemirror-lang-python-CH6_em9L.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-C_CoD9mj.js → vendor-codemirror-lang-rust-EG_DtGyi.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-BuR0aKh5.js → vendor-codemirror-lang-sass-BknY5Qpo.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-DggNUjdM.js → vendor-codemirror-lang-sql-B0f-qCZo.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-DFZHi2J3.js → vendor-codemirror-lang-vue-CyGn9snv.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-zuTN3SHT.js → vendor-codemirror-lang-wast-CsFfSyyB.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-CrcvhI-k.js → vendor-codemirror-lang-xml-Cdan_Jp1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-DcVWsakb.js → vendor-codemirror-lang-yaml-COI5hck8.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CCLITgCF.js → vendor-codemirror-language-data-CqU7kHmg.js} +2 -2
- package/dist/assets/{vendor-codemirror-search-H7NOEdbX.js → vendor-codemirror-search-DUfSCF9S.js} +1 -1
- package/dist/assets/{vendor-lezer-cpp-C8aD2KAr.js → vendor-lezer-cpp-DMZOJzBa.js} +1 -1
- package/dist/assets/{vendor-lezer-css-2lbTJF-Y.js → vendor-lezer-css-DUkkbMp7.js} +1 -1
- package/dist/assets/{vendor-lezer-go-Bw6LFTrZ.js → vendor-lezer-go-CHIhCNY6.js} +1 -1
- package/dist/assets/{vendor-lezer-html-D7ym2z7S.js → vendor-lezer-html-B3h0MOrG.js} +1 -1
- package/dist/assets/{vendor-lezer-java-CZhK7w21.js → vendor-lezer-java-tMazV_6X.js} +1 -1
- package/dist/assets/{vendor-lezer-javascript-rpKeTHZp.js → vendor-lezer-javascript-ctwLWf4v.js} +1 -1
- package/dist/assets/{vendor-lezer-json-C7jwsd2G.js → vendor-lezer-json-BP_UAzLL.js} +1 -1
- package/dist/assets/{vendor-lezer-lr-DR-ylqNN.js → vendor-lezer-lr-B8TQctNw.js} +1 -1
- package/dist/assets/{vendor-lezer-markdown-Bir0m5nB.js → vendor-lezer-markdown-aGLZf_3h.js} +1 -1
- package/dist/assets/{vendor-lezer-php-y0hIEfo1.js → vendor-lezer-php-D5zCNzlt.js} +1 -1
- package/dist/assets/{vendor-lezer-python-D64A9lNV.js → vendor-lezer-python-EJ4Im4y2.js} +1 -1
- package/dist/assets/{vendor-lezer-rust-E3ZA9T2L.js → vendor-lezer-rust-DO5c7OtA.js} +1 -1
- package/dist/assets/{vendor-lezer-sass-C5UFI9SP.js → vendor-lezer-sass-CMi6zfXI.js} +1 -1
- package/dist/assets/{vendor-lezer-xml-DOy7FzCR.js → vendor-lezer-xml-0MHMeZDp.js} +1 -1
- package/dist/assets/{vendor-lezer-yaml-kEjaSCvZ.js → vendor-lezer-yaml-BE2EFjpA.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-BLfh0LPy.js → vendor-replit-codemirror-vim-AnOuN8yJ.js} +1 -1
- package/dist/assets/{web-components-C7CmoFxi.js → web-components-CeHLxvED.js} +3 -3
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/dist/sw.js +1 -1
- package/package.json +1 -2
- package/server/index.js +69 -30
- package/server/lib/client-auth/DOCUMENTATION.md +15 -1
- package/server/lib/client-auth/pairing.js +2 -12
- package/server/lib/client-auth/remote-clients.js +2 -12
- package/server/lib/cloudflare-tunnel.js +0 -132
- package/server/lib/fs/DOCUMENTATION.md +8 -0
- package/server/lib/fs/atomic-write.js +111 -0
- package/server/lib/fs/atomic-write.test.js +133 -0
- package/server/lib/notifications/DOCUMENTATION.md +43 -32
- package/server/lib/notifications/pi-notification-watcher.js +8 -7
- package/server/lib/notifications/pi-notification-watcher.test.js +88 -2
- package/server/lib/pi/routes-extension-events.test.js +231 -0
- package/server/lib/pi/routes.js +137 -4
- package/server/lib/pi/routes.test.js +248 -2
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +17 -4
- package/server/lib/pi/session-daemon/daemon-process.js +2 -0
- package/server/lib/pi/session-daemon/engines/index.js +6 -0
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +1 -1
- package/server/lib/pi/session-daemon/extension-bridge.js +24 -0
- package/server/lib/pi/session-daemon/extension-message-render.js +74 -0
- package/server/lib/pi/session-daemon/extension-message-render.test.js +164 -0
- package/server/lib/pi/session-daemon/extension-tool-render.js +13 -6
- package/server/lib/pi/session-daemon/pending-input.js +188 -0
- package/server/lib/pi/session-daemon/pending-input.test.js +202 -0
- package/server/lib/pi/session-daemon/session-daemon-engines.test.js +828 -0
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +296 -6
- package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +9 -0
- package/server/lib/pi/session-daemon/session-daemon.js +219 -19
- package/server/lib/pi/session-daemon/session-daemon.test.js +30 -2
- package/server/lib/pi/session-daemon/session-engine-router.js +390 -0
- package/server/lib/pi/session-daemon/session-engine-router.test.js +515 -0
- package/server/lib/pi/session-daemon/session-engines.js +467 -0
- package/server/lib/pi/session-daemon/session-engines.test.js +383 -0
- package/server/lib/pi/snippets-store.js +8 -17
- package/server/lib/pi/ui-settings-store.js +6 -10
- package/server/lib/pi/ui-settings-store.test.js +37 -1
- package/server/lib/relay/DOCUMENTATION.md +6 -4
- package/server/lib/relay/identity-store.js +116 -0
- package/server/lib/relay/identity-store.test.js +169 -0
- package/server/lib/relay/identity.js +6 -4
- package/server/lib/relay/server-id.js +63 -0
- package/server/lib/relay/server-id.test.js +132 -0
- package/server/lib/relay/signing-key.js +14 -11
- package/server/lib/security/bind-host.js +6 -2
- package/server/lib/security/bind-host.test.js +17 -0
- package/server/lib/server/core-routes.js +27 -1
- package/server/lib/server/lan-addresses.js +18 -6
- package/server/lib/server/lan-addresses.test.js +28 -0
- package/server/lib/server/tunnel-auth.js +47 -7
- package/server/lib/server/tunnel-auth.rate-limit.test.js +164 -0
- package/server/lib/server/tunnel-service.DOCUMENTATION.md +3 -4
- package/server/lib/server/tunnel-service.js +23 -20
- package/server/lib/server/tunnel-service.test.js +19 -2
- package/server/lib/stt/config-store.js +5 -15
- package/server/lib/tailscale/DOCUMENTATION.md +264 -0
- package/server/lib/tailscale/routes.js +45 -0
- package/server/lib/tailscale/service.js +959 -0
- package/server/lib/tailscale/tailscale.js +302 -0
- package/server/lib/tailscale/tailscale.test.js +1861 -0
- package/server/lib/tunnels/DOCUMENTATION.md +3 -4
- package/server/lib/tunnels/providers/cloudflare.js +1 -22
- package/server/lib/tunnels/types.js +0 -2
- package/server/lib/ui-auth/DOCUMENTATION.md +31 -0
- package/server/lib/ui-auth/ui-auth.js +80 -6
- package/server/lib/ui-auth/ui-auth.test.js +136 -0
- package/server/lib/ui-auth/ui-passkeys.js +2 -13
- package/server/lib/update-job-store.js +4 -6
- package/dist/assets/DiffView-BxwoRCYx.js +0 -18
- package/dist/assets/FilesView-D_2QcdUt.js +0 -6
- package/dist/assets/PierreDiffViewer-BW8MO-O6.js +0 -134
- package/dist/assets/PullRequestsSurface-B3ictm4I.js +0 -2
- package/dist/assets/SessionSwitcherContent-rLoyVqgs.js +0 -1
- package/dist/assets/SessionSwitcherDropdown-CfySKnUu.js +0 -2
- package/dist/assets/SessionUnreadDot-CmEF9sxM.js +0 -1
- package/dist/assets/SettingsView-BiwlwnTK.js +0 -6
- package/dist/assets/index-BnZVqcki.js +0 -11
- package/dist/assets/index-BnieExes.css +0 -1
- package/dist/assets/main-9O5IAtT_.js +0 -136
- package/dist/assets/main-DWGwALIw.js +0 -2
- package/dist/assets/mobile-BbJcYVym.js +0 -2
- package/dist/assets/pi-session-focus-preference-Bmk1iOvn.js +0 -10
- package/dist/assets/renderElectronMiniChatApp-R5o9NwFC.js +0 -2
- package/dist/assets/renderMobileApp-CQ9tWYIj.js +0 -11
- package/dist/assets/runtimeEndpointReset-CtK4C_5h.js +0 -62
- package/dist/assets/useAppFontEffects-DviRbaCJ.js +0 -212
- package/dist/assets/useGitHubRemoteSearch-D-K7aolk.js +0 -1
- package/dist/assets/vendor-capacitor-push-notifications-CBKq2Arn.js +0 -1
- package/server/lib/notifications/delivery-runtime.js +0 -314
- package/server/lib/notifications/delivery-runtime.test.js +0 -85
- package/server/lib/notifications/routes.js +0 -74
- package/server/lib/relay/service.js +0 -9
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Run `pichamber --help` for the current flags.
|
|
|
60
60
|
| `stop` / `restart` | Stop or restart instances (broad stops confirm when more than one is affected; `--force` skips) |
|
|
61
61
|
| `startup` | Run at login or boot (`enable` is guided; `status` / `disable` to inspect or remove) |
|
|
62
62
|
| `tunnel` | Expose the server via Cloudflare Tunnel (`start` is guided; profiles cover repeatable runs) |
|
|
63
|
-
| `
|
|
63
|
+
| `pair` | Create a one-time pairing link for another client (`--qr` in interactive terminals; starts the server if needed; `--tailscale` adds Tailscale remote access) |
|
|
64
64
|
| `update` | Install updates (reviews before changing anything; `--yes` skips confirmation, `--channel stable\|rc` overrides once) |
|
|
65
65
|
| `version` | Print the installed version |
|
|
66
66
|
|
package/bin/cli.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
showHelp,
|
|
26
26
|
showStartupHelp,
|
|
27
27
|
showConnectUrlHelp,
|
|
28
|
+
showPairHelp,
|
|
28
29
|
showTunnelHelp,
|
|
29
30
|
generateCompletionScript,
|
|
30
31
|
findClosestMatch,
|
|
@@ -119,6 +120,11 @@ function resolveServerExecutable() {
|
|
|
119
120
|
const commands = {
|
|
120
121
|
serve: null,
|
|
121
122
|
|
|
123
|
+
pair: null,
|
|
124
|
+
|
|
125
|
+
// Hidden alias of `pair`: same handler, with a one-line deprecation
|
|
126
|
+
// notice on stderr in human mode (suppressed under --quiet, and never on
|
|
127
|
+
// --json stdout).
|
|
122
128
|
'connect-url': null,
|
|
123
129
|
|
|
124
130
|
stop: null,
|
|
@@ -155,10 +161,19 @@ commands.tunnel = createTunnelCommand({
|
|
|
155
161
|
ensureTunnelProfilesMigrated,
|
|
156
162
|
});
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
const pairHandler = createConnectUrlCommand({
|
|
159
165
|
serveCommand: commands.serve.bind(commands),
|
|
160
166
|
});
|
|
161
167
|
|
|
168
|
+
commands.pair = pairHandler;
|
|
169
|
+
|
|
170
|
+
commands['connect-url'] = async (options = {}) => {
|
|
171
|
+
if (!isJsonMode(options) && !isQuietMode(options)) {
|
|
172
|
+
console.error('Note: `connect-url` is deprecated, use `pichamber pair` instead.');
|
|
173
|
+
}
|
|
174
|
+
return pairHandler(options);
|
|
175
|
+
};
|
|
176
|
+
|
|
162
177
|
commands.update = createUpdateCommand({
|
|
163
178
|
importFromFilePath,
|
|
164
179
|
packageManagerPath: path.join(__dirname, '..', 'server', 'lib', 'package-manager.js'),
|
|
@@ -211,6 +226,8 @@ async function main() {
|
|
|
211
226
|
showTunnelHelp();
|
|
212
227
|
} else if (command === 'startup') {
|
|
213
228
|
showStartupHelp();
|
|
229
|
+
} else if (command === 'pair') {
|
|
230
|
+
showPairHelp();
|
|
214
231
|
} else if (command === 'connect-url') {
|
|
215
232
|
showConnectUrlHelp();
|
|
216
233
|
} else {
|
|
@@ -230,7 +247,7 @@ async function main() {
|
|
|
230
247
|
}
|
|
231
248
|
|
|
232
249
|
if (!commands[command]) {
|
|
233
|
-
const knownCommands = ['serve', 'stop', 'restart', 'status', 'tunnel', 'startup', 'logs', 'connect-url', 'update', 'version'];
|
|
250
|
+
const knownCommands = ['serve', 'stop', 'restart', 'status', 'tunnel', 'startup', 'logs', 'pair', 'connect-url', 'update', 'version'];
|
|
234
251
|
const suggestion = findClosestMatch(command, knownCommands);
|
|
235
252
|
const hint = suggestion ? ` Did you mean '${suggestion}'?` : '';
|
|
236
253
|
if (isJsonMode(options)) {
|
|
@@ -313,11 +330,13 @@ if (isCliExecution) {
|
|
|
313
330
|
|
|
314
331
|
main().catch((error) => {
|
|
315
332
|
const message = error instanceof Error ? error.message : String(error);
|
|
333
|
+
const errorCode = typeof error?.code === 'string' && error.code.length > 0 ? error.code : null;
|
|
316
334
|
if (isJsonMode(activeCommandOptions)) {
|
|
317
335
|
printJson({
|
|
318
336
|
status: 'error',
|
|
319
337
|
error: {
|
|
320
338
|
message,
|
|
339
|
+
...(errorCode ? { code: errorCode } : {}),
|
|
321
340
|
},
|
|
322
341
|
});
|
|
323
342
|
} else if (process.stdout?.isTTY && !HAS_PLAIN_FLAG) {
|
package/bin/cli.test.js
CHANGED
|
@@ -9,6 +9,7 @@ import { pathToFileURL } from 'url';
|
|
|
9
9
|
|
|
10
10
|
import { isModuleCliExecution, normalizeCliEntryPath } from './cli-entry.js';
|
|
11
11
|
import { requestJson } from './lib/cli-http.js';
|
|
12
|
+
import { writeTunnelProfilesToDisk } from './lib/cli-tunnel-profiles.js';
|
|
12
13
|
import { inspectTunnelAttachability } from './lib/cli-lifecycle.js';
|
|
13
14
|
import { resolveTargetPort } from './lib/cli-api-target.js';
|
|
14
15
|
import { DEFAULT_TUNNEL_PROVIDER_CAPABILITIES } from './lib/cli-tunnel-capabilities.js';
|
|
@@ -278,6 +279,41 @@ describe('cli args', () => {
|
|
|
278
279
|
expect(parsed.helpRequested).toBe(true);
|
|
279
280
|
});
|
|
280
281
|
|
|
282
|
+
it('parses the pair command with tailscale flags', () => {
|
|
283
|
+
const parsed = parseArgs(['pair', '--tailscale', '--qr']);
|
|
284
|
+
|
|
285
|
+
expect(parsed.command).toBe('pair');
|
|
286
|
+
expect(parsed.options.tailscale).toBe(true);
|
|
287
|
+
expect(commands.pair).toBeTypeOf('function');
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('keeps connect-url as a wired alias of pair', () => {
|
|
291
|
+
expect(commands['connect-url']).toBeTypeOf('function');
|
|
292
|
+
expect(parseArgs(['connect-url', '--relay']).options.relay).toBe(true);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('parses pair --tailscale --public --https-port flags', () => {
|
|
296
|
+
const parsed = parseArgs(['pair', '--tailscale', '--public', '--https-port', '8443']);
|
|
297
|
+
|
|
298
|
+
expect(parsed.command).toBe('pair');
|
|
299
|
+
expect(parsed.options.tailscale).toBe(true);
|
|
300
|
+
expect(parsed.options.public).toBe(true);
|
|
301
|
+
expect(parsed.options.httpsPort).toBe(8443);
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
it('parses serve --tailscale flags', () => {
|
|
305
|
+
const parsed = parseArgs(['serve', '--tailscale', '--https-port=10000']);
|
|
306
|
+
|
|
307
|
+
expect(parsed.command).toBe('serve');
|
|
308
|
+
expect(parsed.options.tailscale).toBe(true);
|
|
309
|
+
expect(parsed.options.httpsPort).toBe(10000);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it('rejects invalid --https-port values', () => {
|
|
313
|
+
expect(() => parseArgs(['pair', '--https-port', '3000'])).toThrow(/https-port/);
|
|
314
|
+
expect(() => parseArgs(['serve', '--https-port', 'bogus'])).toThrow(/https-port/);
|
|
315
|
+
});
|
|
316
|
+
|
|
281
317
|
it('parses startup api-only option', () => {
|
|
282
318
|
const parsed = parseArgs(['startup', 'enable', '--api-only', '--port', '3002']);
|
|
283
319
|
|
|
@@ -384,6 +420,46 @@ describe('serve command helper', () => {
|
|
|
384
420
|
expect(hasExplicitServeConfiguration({ apiOnly: true })).toBe(true);
|
|
385
421
|
expect(hasExplicitServeConfiguration({ port: 3000 })).toBe(false);
|
|
386
422
|
});
|
|
423
|
+
|
|
424
|
+
it('persists tailscale config for serve --tailscale with a UI password', async () => {
|
|
425
|
+
const { persistTailscaleConfigForStartup } = await import('../server/lib/tailscale/service.js');
|
|
426
|
+
await withTempPiChamberDataDir(async (dir) => {
|
|
427
|
+
const merged = await persistTailscaleConfigForStartup({
|
|
428
|
+
dataDir: dir,
|
|
429
|
+
patch: { enabled: true, mode: 'private', httpsPort: 443 },
|
|
430
|
+
uiPasswordConfigured: true,
|
|
431
|
+
});
|
|
432
|
+
expect(merged).toEqual({ enabled: true, mode: 'private', httpsPort: 443 });
|
|
433
|
+
const stored = JSON.parse(fs.readFileSync(path.join(dir, 'tailscale-config.json'), 'utf8'));
|
|
434
|
+
expect(stored).toEqual(merged);
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
it('rejects persisting an enabled tailscale config without a UI password', async () => {
|
|
439
|
+
const { persistTailscaleConfigForStartup } = await import('../server/lib/tailscale/service.js');
|
|
440
|
+
await withTempPiChamberDataDir(async (dir) => {
|
|
441
|
+
await expect(persistTailscaleConfigForStartup({
|
|
442
|
+
dataDir: dir,
|
|
443
|
+
patch: { enabled: true, mode: 'private', httpsPort: 443 },
|
|
444
|
+
uiPasswordConfigured: false,
|
|
445
|
+
})).rejects.toMatchObject({ code: 'auth_required' });
|
|
446
|
+
expect(fs.existsSync(path.join(dir, 'tailscale-config.json'))).toBe(false);
|
|
447
|
+
});
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
it('rejects serve --public without --tailscale at the gate', async () => {
|
|
451
|
+
const { checkTailscaleAuthGate } = await import('../server/lib/tailscale/tailscale.js');
|
|
452
|
+
// Public mode has no escape hatch: no UI password means blocked even
|
|
453
|
+
// with the unauthenticated-LAN env override.
|
|
454
|
+
const blocked = checkTailscaleAuthGate({
|
|
455
|
+
enabled: true,
|
|
456
|
+
mode: 'public',
|
|
457
|
+
uiPasswordConfigured: false,
|
|
458
|
+
unsafeUnauthenticatedLanAllowed: true,
|
|
459
|
+
});
|
|
460
|
+
expect(blocked.allowed).toBe(false);
|
|
461
|
+
expect(blocked.code).toBe('auth_required');
|
|
462
|
+
});
|
|
387
463
|
});
|
|
388
464
|
|
|
389
465
|
describe('startup enable command helper', () => {
|
|
@@ -531,6 +607,41 @@ describe('version command', () => {
|
|
|
531
607
|
expect(JSON.parse(result.stdout)).toMatchObject({ status: 'ok', version: packageJson.version });
|
|
532
608
|
expect(result.stderr).toBe('');
|
|
533
609
|
});
|
|
610
|
+
|
|
611
|
+
it('rejects removed quick tunnel mode with a stable JSON code', () => {
|
|
612
|
+
const result = spawnSync(process.execPath, [new URL('./cli.js', import.meta.url).pathname, 'tunnel', 'start', '--mode', 'quick', '--json'], {
|
|
613
|
+
encoding: 'utf8',
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
expect(result.status).toBe(2);
|
|
617
|
+
expect(result.stderr).toBe('');
|
|
618
|
+
expect(JSON.parse(result.stdout)).toMatchObject({
|
|
619
|
+
status: 'error',
|
|
620
|
+
error: { code: 'quick_tunnel_removed' },
|
|
621
|
+
});
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
it('rejects removed quick tunnel mode in human output', () => {
|
|
625
|
+
const result = spawnSync(process.execPath, [new URL('./cli.js', import.meta.url).pathname, 'tunnel', 'start', '--mode', 'quick', '--port', '3003'], {
|
|
626
|
+
encoding: 'utf8',
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
expect(result.status).toBe(2);
|
|
630
|
+
expect(result.stderr).toContain('Quick tunnels were removed');
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
it('requires an explicit managed mode for non-interactive JSON start', () => {
|
|
634
|
+
const result = spawnSync(process.execPath, [new URL('./cli.js', import.meta.url).pathname, 'tunnel', 'start', '--json'], {
|
|
635
|
+
encoding: 'utf8',
|
|
636
|
+
});
|
|
637
|
+
|
|
638
|
+
expect(result.status).toBe(2);
|
|
639
|
+
expect(result.stderr).toBe('');
|
|
640
|
+
expect(JSON.parse(result.stdout)).toMatchObject({
|
|
641
|
+
status: 'error',
|
|
642
|
+
error: { code: 'tunnel_mode_required' },
|
|
643
|
+
});
|
|
644
|
+
});
|
|
534
645
|
});
|
|
535
646
|
|
|
536
647
|
describe('cli API target resolution', () => {
|
|
@@ -697,7 +808,7 @@ describe('compatibility exports', () => {
|
|
|
697
808
|
});
|
|
698
809
|
});
|
|
699
810
|
|
|
700
|
-
it('supports cloudflare
|
|
811
|
+
it('supports cloudflare managed-remote dry-run with an explicit port', async () => {
|
|
701
812
|
await withTempPiChamberDataDir(async () => {
|
|
702
813
|
const output = await captureStdout(async () => {
|
|
703
814
|
await commands.tunnel({
|
|
@@ -706,7 +817,9 @@ describe('compatibility exports', () => {
|
|
|
706
817
|
explicitPort: true,
|
|
707
818
|
port: 3003,
|
|
708
819
|
provider: 'cloudflare',
|
|
709
|
-
mode: '
|
|
820
|
+
mode: 'managed-remote',
|
|
821
|
+
hostname: 'tunnel.example.com',
|
|
822
|
+
token: 'test-token',
|
|
710
823
|
}, 'start');
|
|
711
824
|
});
|
|
712
825
|
|
|
@@ -715,10 +828,57 @@ describe('compatibility exports', () => {
|
|
|
715
828
|
ok: true,
|
|
716
829
|
dryRun: true,
|
|
717
830
|
provider: 'cloudflare',
|
|
718
|
-
mode: '
|
|
831
|
+
mode: 'managed-remote',
|
|
719
832
|
}));
|
|
720
833
|
});
|
|
721
834
|
});
|
|
835
|
+
|
|
836
|
+
it('rejects quick mode with a stable removal code', async () => {
|
|
837
|
+
await withTempPiChamberDataDir(async () => {
|
|
838
|
+
await expect(commands.tunnel({
|
|
839
|
+
json: true,
|
|
840
|
+
explicitPort: true,
|
|
841
|
+
port: 3003,
|
|
842
|
+
provider: 'cloudflare',
|
|
843
|
+
mode: 'quick',
|
|
844
|
+
}, 'start')).rejects.toMatchObject({ code: 'quick_tunnel_removed' });
|
|
845
|
+
});
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
it('rejects quick mode from a stored profile with the same removal code', async () => {
|
|
849
|
+
await withTempPiChamberDataDir(async () => {
|
|
850
|
+
writeTunnelProfilesToDisk({
|
|
851
|
+
version: 1,
|
|
852
|
+
profiles: [{
|
|
853
|
+
id: 'legacy-quick-id',
|
|
854
|
+
name: 'legacy-quick',
|
|
855
|
+
provider: 'cloudflare',
|
|
856
|
+
mode: 'quick',
|
|
857
|
+
hostname: 'old.example.com',
|
|
858
|
+
token: 'old-token',
|
|
859
|
+
createdAt: Date.now(),
|
|
860
|
+
updatedAt: Date.now(),
|
|
861
|
+
}],
|
|
862
|
+
});
|
|
863
|
+
await expect(commands.tunnel({
|
|
864
|
+
json: true,
|
|
865
|
+
explicitPort: true,
|
|
866
|
+
port: 3003,
|
|
867
|
+
profile: 'legacy-quick',
|
|
868
|
+
}, 'start')).rejects.toMatchObject({ code: 'quick_tunnel_removed' });
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
it('requires an explicit managed mode for non-interactive start', async () => {
|
|
873
|
+
await withTempPiChamberDataDir(async () => {
|
|
874
|
+
await expect(commands.tunnel({
|
|
875
|
+
json: true,
|
|
876
|
+
explicitPort: true,
|
|
877
|
+
port: 3003,
|
|
878
|
+
provider: 'cloudflare',
|
|
879
|
+
}, 'start')).rejects.toMatchObject({ code: 'tunnel_mode_required' });
|
|
880
|
+
});
|
|
881
|
+
});
|
|
722
882
|
});
|
|
723
883
|
|
|
724
884
|
describe('CLI HTTP helpers', () => {
|
|
@@ -751,7 +911,7 @@ describe('CLI HTTP helpers', () => {
|
|
|
751
911
|
try {
|
|
752
912
|
const { response, body } = await requestJson(port, '/api/pichamber/tunnel/start', {
|
|
753
913
|
method: 'POST',
|
|
754
|
-
body: JSON.stringify({ provider: 'cloudflare', mode: '
|
|
914
|
+
body: JSON.stringify({ provider: 'cloudflare', mode: 'managed-remote', token: 'test-token', hostname: 'tunnel.example.com' }),
|
|
755
915
|
});
|
|
756
916
|
|
|
757
917
|
expect(response.ok).toBe(true);
|
package/bin/lib/DOCUMENTATION.md
CHANGED
|
@@ -4,12 +4,12 @@ This directory contains non-entrypoint PiChamber CLI implementation. `../cli.js`
|
|
|
4
4
|
|
|
5
5
|
## Commands
|
|
6
6
|
|
|
7
|
-
- `commands-serve.js`: server startup, PID/instance registry, and foreground/background lifecycle. Explicit `pichamber serve` with no setup flags opens an interactive access, port, authentication, content, and process-mode wizard. Bare `pichamber`, flag-driven runs, non-TTY, `--quiet`, and `--json` remain non-interactive.
|
|
7
|
+
- `commands-serve.js`: server startup, PID/instance registry, and foreground/background lifecycle. Explicit `pichamber serve` with no setup flags opens an interactive access, port, authentication, content, and process-mode wizard. Bare `pichamber`, flag-driven runs, non-TTY, `--quiet`, and `--json` remain non-interactive. `serve --tailscale [--public] [--https-port N]` persists the Tailscale config server-side before start (auth gate enforced in the CLI for a fast failure and again in the service); `--public` / `--https-port` without `--tailscale` fail deterministically.
|
|
8
8
|
- `commands-lifecycle.js`: stop and restart behavior. Interactive broad stops require confirmation when more than one instance will be affected; `--force` skips it.
|
|
9
|
-
- `commands-status.js`: running-instance and
|
|
9
|
+
- `commands-status.js`: running-instance, tunnel, and Tailscale status presentation. Tailscale state is fetched best-effort per instance (unknown on failure, never failing the whole status) and shown in human detail lines, quiet `tailscale:<state>` plus `tailscale-url:<url>` tokens (separate whitespace-delimited tokens, since the URL itself contains `:`), and per-instance JSON.
|
|
10
10
|
- `commands-logs.js`: log discovery, tailing, and follow behavior. Quiet mode emits raw log lines, while multi-instance output retains port prefixes.
|
|
11
11
|
- `commands-startup.js`: native startup service management. Interactive `startup enable` walks through access, port, authentication, and confirmation when no setup flags are supplied. Flag-driven, non-TTY, `--quiet`, and `--json` runs remain non-interactive. The command stores serve flags (`--port`, `--lan`/`--host`, `--ui-password`, `--api-only`) in the native service. Re-running enable rewrites and restarts a systemd unit so the new settings take effect immediately. LAN binds require a UI password, matching `pichamber serve`.
|
|
12
|
-
- `commands-connect-url.js`:
|
|
12
|
+
- `commands-connect-url.js`: `pair` command plus the hidden `connect-url` alias (one-line stderr deprecation notice in human mode only; suppressed under `--quiet`, never on `--json` stdout). Authenticated direct/relay/Tailscale pairing links. Auto-started servers run silently inside the command; `--json` and non-TTY output contain only the requested machine-readable/link result, and QR art is interactive-terminal-only. `pair --tailscale [--public] [--https-port N]` asks the RUNNING server via `PUT /api/pichamber/tailscale/config` to enable Tailscale (persisted server-side), waits with a spinner (non-TTY safe) for a terminal state, prints the approval URL for `needs-approval`, then prints the pairing link/QR including the ts.net candidate. Under `--quiet`, stdout stays link-only while a non-active Tailscale outcome is reported as one stderr line (`[TAILSCALE_APPROVAL]` with the approval URL, otherwise `[TAILSCALE_NOT_ACTIVE]` with the state). `--public` / `--https-port` without `--tailscale` fail deterministically. Relay candidates require an explicitly configured relay URL (`PICHAMBER_RELAY_URL` env override, then stored `settings.privateRelay.relayUrl`); with no relay URL the link carries no relay candidate and no relay identity keys are generated. `--relay` with no relay URL configured fails deterministically in every mode with a usage error naming `PICHAMBER_RELAY_URL`.
|
|
13
13
|
- `pichamber version` and `pichamber --version`: print the installed package version; `--json` returns the same value as JSON.
|
|
14
14
|
- `commands-update.js`: package update and restart coordination. Interactive updates review the old and target versions, selected server channel, and restart impact before installation; `--yes` skips confirmation. The host-local default channel is `stable`; `--channel stable|rc` overrides it for one run, and RC subscribers receive the highest available version across stable and numbered RC releases. Updates only a writable global install owned by the running CLI. Deployment preflight reports stable reason codes and instructions for containers, source checkouts, custom systemd units, ownership mismatches, and unsupported installs before changing files. Package-manager output is suppressed for `--quiet`/`--json`; results distinguish the previous, installed, and latest versions and report partial restart failures with a non-zero CLI exit. An update requested from the managed PiChamber systemd service, including its browser terminal, moves into a transient systemd unit before replacing the package and restarting `pichamber.service`. Update jobs persist non-secret progress, channel, and an exact registry-validated target version in the PiChamber run directory so clients can resume status polling after restart without a moving dist-tag changing the installation target. Installation must verify that exact version before any managed service or instance restart. Terminal job state is persisted before JSON, quiet, or interactive output, and status reads mark dead workers or workers that miss the startup grace period as failed.
|
|
15
15
|
- `commands-tunnel.js`: tunnel lifecycle and profile management. Interactive tunnel setup ends with a review and confirmation; fully specified flag and profile runs remain direct. Auto-started servers never write nested output into the parent command's `--quiet` or `--json` result.
|
package/bin/lib/cli-args.js
CHANGED
|
@@ -79,6 +79,9 @@ function parseArgs(argv = process.argv.slice(2)) {
|
|
|
79
79
|
sessionTtl: undefined,
|
|
80
80
|
qr: false,
|
|
81
81
|
explicitQr: false,
|
|
82
|
+
tailscale: false,
|
|
83
|
+
public: false,
|
|
84
|
+
httpsPort: undefined,
|
|
82
85
|
force: false,
|
|
83
86
|
showSecrets: false,
|
|
84
87
|
dryRun: false,
|
|
@@ -386,6 +389,25 @@ function parseArgs(argv = process.argv.slice(2)) {
|
|
|
386
389
|
case 'relay':
|
|
387
390
|
options.relay = true;
|
|
388
391
|
break;
|
|
392
|
+
case 'tailscale':
|
|
393
|
+
options.tailscale = true;
|
|
394
|
+
break;
|
|
395
|
+
case 'public':
|
|
396
|
+
options.public = true;
|
|
397
|
+
break;
|
|
398
|
+
case 'https-port': {
|
|
399
|
+
const { value, nextIndex } = consumeValue(i, inlineValue);
|
|
400
|
+
i = nextIndex;
|
|
401
|
+
if (typeof value !== 'string' || !/^\d+$/.test(value.trim())) {
|
|
402
|
+
throw new TunnelCliError('Invalid --https-port value. Use 443, 8443, or 10000.', EXIT_CODE.USAGE_ERROR);
|
|
403
|
+
}
|
|
404
|
+
const parsed = Number(value);
|
|
405
|
+
if (![443, 8443, 10000].includes(parsed)) {
|
|
406
|
+
throw new TunnelCliError('Invalid --https-port value. Use 443, 8443, or 10000.', EXIT_CODE.USAGE_ERROR);
|
|
407
|
+
}
|
|
408
|
+
options.httpsPort = parsed;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
389
411
|
case 'qr':
|
|
390
412
|
options.qr = true;
|
|
391
413
|
options.explicitQr = true;
|
|
@@ -456,7 +478,7 @@ function parseArgs(argv = process.argv.slice(2)) {
|
|
|
456
478
|
// may still pass this when starting a remote server.
|
|
457
479
|
break;
|
|
458
480
|
case 'try-cf-tunnel':
|
|
459
|
-
removedFlagErrors.push('`--try-cf-tunnel` was removed.
|
|
481
|
+
removedFlagErrors.push('`--try-cf-tunnel` was removed. Quick tunnels were removed; use `pichamber pair --tailscale` or `pichamber tunnel start --mode managed-remote --token-file <path> --hostname <host>`.');
|
|
460
482
|
break;
|
|
461
483
|
case 'tunnel-qr':
|
|
462
484
|
removedFlagErrors.push('`--tunnel-qr` was removed. Use: pichamber tunnel start ... --qr');
|
|
@@ -528,7 +550,7 @@ COMMANDS:
|
|
|
528
550
|
tunnel Tunnel lifecycle commands
|
|
529
551
|
startup Manage launch at system startup
|
|
530
552
|
logs Tail PiChamber logs
|
|
531
|
-
|
|
553
|
+
pair Generate URL/QR for connecting another client
|
|
532
554
|
update Check for and install updates
|
|
533
555
|
version Show the installed PiChamber version
|
|
534
556
|
|
|
@@ -537,8 +559,11 @@ OPTIONS:
|
|
|
537
559
|
--host Bind address (default: 127.0.0.1)
|
|
538
560
|
--hostname Alias for --host outside tunnel commands
|
|
539
561
|
--lan Bind to 0.0.0.0 for LAN access
|
|
540
|
-
--server <url> Public/server URL for
|
|
541
|
-
--relay
|
|
562
|
+
--server <url> Public/server URL for pairing links
|
|
563
|
+
--relay pair: also include the end-to-end-encrypted relay transport (requires PICHAMBER_RELAY_URL)
|
|
564
|
+
--tailscale pair/serve: enable Tailscale remote access (tailnet-only serve)
|
|
565
|
+
--public With --tailscale: public internet via Funnel instead of tailnet-only
|
|
566
|
+
--https-port <port> Tailscale HTTPS port: 443, 8443, or 10000 (default: 443)
|
|
542
567
|
--ui-password [password] Protect browser UI with a password (generates one when omitted)
|
|
543
568
|
--api-only Start API routes only, without serving browser UI assets
|
|
544
569
|
--foreground Run server in foreground (use with systemd/process managers)
|
|
@@ -562,8 +587,9 @@ EXAMPLES:
|
|
|
562
587
|
pichamber --lan --port 3002 # Start on LAN at 0.0.0.0:3002
|
|
563
588
|
pichamber serve # Walk through interactive server setup
|
|
564
589
|
pichamber serve --foreground # Start in foreground without setup prompts
|
|
565
|
-
pichamber
|
|
566
|
-
pichamber
|
|
590
|
+
pichamber pair --port 3000 --qr
|
|
591
|
+
pichamber pair --server https://pichamber.example.com
|
|
592
|
+
pichamber pair --tailscale --qr
|
|
567
593
|
pichamber startup enable --lan --port 3002 --ui-password
|
|
568
594
|
# Login service on LAN at 0.0.0.0:3002
|
|
569
595
|
pichamber tunnel help # Show tunnel lifecycle help
|
|
@@ -628,16 +654,17 @@ EXAMPLES:
|
|
|
628
654
|
`);
|
|
629
655
|
}
|
|
630
656
|
|
|
631
|
-
function
|
|
657
|
+
function showPairHelp() {
|
|
632
658
|
console.log(`
|
|
633
|
-
PiChamber
|
|
659
|
+
PiChamber Pairing Links
|
|
634
660
|
|
|
635
661
|
USAGE:
|
|
636
|
-
pichamber
|
|
662
|
+
pichamber pair [OPTIONS]
|
|
637
663
|
|
|
638
664
|
DESCRIPTION:
|
|
639
665
|
Generate an pichamber:// connection link for adding this server to another
|
|
640
666
|
PiChamber app. If no server is running on the selected port, it starts one.
|
|
667
|
+
(The previous name \`connect-url\` still works as a hidden alias.)
|
|
641
668
|
|
|
642
669
|
OPTIONS:
|
|
643
670
|
-p, --port <port> Server port to use or start (default: ${DEFAULT_PORT})
|
|
@@ -651,6 +678,53 @@ OPTIONS:
|
|
|
651
678
|
device prefers the direct connection when reachable;
|
|
652
679
|
the instance brings the relay up on its own. Set
|
|
653
680
|
PICHAMBER_RELAY_URL to use a self-hosted relay.
|
|
681
|
+
--tailscale Enable Tailscale remote access on the running server
|
|
682
|
+
(tailnet-only serve) and include its URL in the link.
|
|
683
|
+
--public With --tailscale: public internet via Tailscale Funnel
|
|
684
|
+
instead of tailnet-only. Requires a UI password.
|
|
685
|
+
--https-port <port> Tailscale HTTPS port: 443, 8443, or 10000 (default: 443)
|
|
686
|
+
--name <label> Label saved with the remote client token
|
|
687
|
+
--ui-password <value> Protect browser access when UI routes are enabled
|
|
688
|
+
--api-only Start in headless/API-only mode when starting
|
|
689
|
+
--qr Print a QR code for the connection link
|
|
690
|
+
--json Output machine-readable JSON
|
|
691
|
+
-q, --quiet Print only the connection link
|
|
692
|
+
-h, --help Show this help
|
|
693
|
+
|
|
694
|
+
EXAMPLES:
|
|
695
|
+
pichamber pair --port 3000 --qr
|
|
696
|
+
pichamber pair --port 3000 --api-only --lan --server http://workstation.local:3000 --qr
|
|
697
|
+
pichamber pair --server https://pichamber.example.com --name Workstation
|
|
698
|
+
pichamber pair --relay --name "My laptop"
|
|
699
|
+
pichamber pair --tailscale --qr
|
|
700
|
+
pichamber pair --tailscale --public --https-port 8443
|
|
701
|
+
`);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function showConnectUrlHelp() {
|
|
705
|
+
console.log(`
|
|
706
|
+
PiChamber Connect URL
|
|
707
|
+
|
|
708
|
+
USAGE:
|
|
709
|
+
pichamber connect-url [OPTIONS]
|
|
710
|
+
|
|
711
|
+
DESCRIPTION:
|
|
712
|
+
Generate an pichamber:// connection link for adding this server to another
|
|
713
|
+
PiChamber app. If no server is running on the selected port, it starts one.
|
|
714
|
+
NOTE: \`connect-url\` is a deprecated alias of \`pichamber pair\`.
|
|
715
|
+
|
|
716
|
+
OPTIONS:
|
|
717
|
+
-p, --port <port> Server port to use or start (default: ${DEFAULT_PORT})
|
|
718
|
+
--host <address> Bind address when starting the server
|
|
719
|
+
--hostname <address> Alias for --host
|
|
720
|
+
--lan Bind to 0.0.0.0 for LAN access when starting
|
|
721
|
+
--server <url> Public URL saved into the connection link
|
|
722
|
+
--server-url <url> Alias for --server
|
|
723
|
+
--relay Also include the end-to-end-encrypted relay transport
|
|
724
|
+
so the link works away from the local network. The
|
|
725
|
+
device prefers the direct connection when reachable.
|
|
726
|
+
Requires a relay URL via PICHAMBER_RELAY_URL
|
|
727
|
+
(self-hosted relay).
|
|
654
728
|
--name <label> Label saved with the remote client token
|
|
655
729
|
--ui-password <value> Protect browser access when UI routes are enabled
|
|
656
730
|
--api-only Start in headless/API-only mode when starting
|
|
@@ -695,7 +769,7 @@ COMMON OPTIONS:
|
|
|
695
769
|
|
|
696
770
|
START OPTIONS:
|
|
697
771
|
--provider <id> Tunnel provider id (default: cloudflare)
|
|
698
|
-
--mode <id> Tunnel mode (
|
|
772
|
+
--mode <id> Tunnel mode (required: managed-remote or managed-local)
|
|
699
773
|
--profile <name> Start tunnel from saved profile name
|
|
700
774
|
--config [path] Managed-local config path (optional)
|
|
701
775
|
--token <token> Managed-remote token (visible in process list)
|
|
@@ -760,10 +834,11 @@ _pichamber_tunnel() {
|
|
|
760
834
|
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
761
835
|
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
762
836
|
|
|
763
|
-
commands="serve stop restart status tunnel startup logs connect-url update version"
|
|
837
|
+
commands="serve stop restart status tunnel startup logs pair connect-url update version"
|
|
764
838
|
tunnel_commands="help providers ready doctor status start stop profile completion"
|
|
765
839
|
profile_commands="list show add remove"
|
|
766
840
|
common_flags="--port --host --lan --ui-password --api-only --foreground --no-daemon --json --all --help --version --plain --quiet --yes"
|
|
841
|
+
pair_flags="--server --server-url --relay --tailscale --public --https-port --name --qr --no-qr"
|
|
767
842
|
start_flags="--provider --mode --profile --config --token --token-file --token-stdin --hostname --connect-ttl --session-ttl --qr --no-qr --dry-run --show-secrets"
|
|
768
843
|
update_flags="--channel --yes"
|
|
769
844
|
|
|
@@ -802,6 +877,11 @@ _pichamber_tunnel() {
|
|
|
802
877
|
return 0
|
|
803
878
|
fi
|
|
804
879
|
|
|
880
|
+
if [[ "\${COMP_WORDS[1]}" == "pair" || "\${COMP_WORDS[1]}" == "connect-url" ]]; then
|
|
881
|
+
COMPREPLY=( $(compgen -W "\${pair_flags} \${common_flags}" -- "\${cur}") )
|
|
882
|
+
return 0
|
|
883
|
+
fi
|
|
884
|
+
|
|
805
885
|
COMPREPLY=( $(compgen -W "\${common_flags}" -- "\${cur}") )
|
|
806
886
|
return 0
|
|
807
887
|
}
|
|
@@ -825,7 +905,8 @@ _pichamber() {
|
|
|
825
905
|
'tunnel:Tunnel lifecycle commands'
|
|
826
906
|
'startup:Manage launch at system startup'
|
|
827
907
|
'logs:Tail PiChamber logs'
|
|
828
|
-
'
|
|
908
|
+
'pair:Generate a client pairing URL'
|
|
909
|
+
'connect-url:Generate a client pairing URL (deprecated alias)'
|
|
829
910
|
'update:Check for and install updates'
|
|
830
911
|
'version:Show the installed version'
|
|
831
912
|
)
|
|
@@ -893,7 +974,8 @@ complete -c pichamber -n '__fish_use_subcommand' -a 'status' -d 'Show server sta
|
|
|
893
974
|
complete -c pichamber -n '__fish_use_subcommand' -a 'tunnel' -d 'Tunnel lifecycle commands'
|
|
894
975
|
complete -c pichamber -n '__fish_use_subcommand' -a 'startup' -d 'Manage launch at system startup'
|
|
895
976
|
complete -c pichamber -n '__fish_use_subcommand' -a 'logs' -d 'Tail logs'
|
|
896
|
-
complete -c pichamber -n '__fish_use_subcommand' -a '
|
|
977
|
+
complete -c pichamber -n '__fish_use_subcommand' -a 'pair' -d 'Generate a client pairing URL'
|
|
978
|
+
complete -c pichamber -n '__fish_use_subcommand' -a 'connect-url' -d 'Generate a client pairing URL (deprecated alias)'
|
|
897
979
|
complete -c pichamber -n '__fish_use_subcommand' -a 'update' -d 'Check for updates'
|
|
898
980
|
complete -c pichamber -n '__fish_use_subcommand' -a 'version' -d 'Show installed version'
|
|
899
981
|
|
|
@@ -932,6 +1014,7 @@ export {
|
|
|
932
1014
|
showHelp,
|
|
933
1015
|
showStartupHelp,
|
|
934
1016
|
showConnectUrlHelp,
|
|
1017
|
+
showPairHelp,
|
|
935
1018
|
showTunnelHelp,
|
|
936
1019
|
generateCompletionScript,
|
|
937
1020
|
findClosestMatch,
|