@bakapiano/ccsm 0.10.3 → 0.11.0

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 (48) hide show
  1. package/CLAUDE.md +475 -475
  2. package/README.md +190 -190
  3. package/bin/ccsm.js +194 -194
  4. package/lib/cliSessionWatcher.js +249 -249
  5. package/lib/config.js +185 -185
  6. package/lib/folders.js +96 -96
  7. package/lib/localCliSessions.js +489 -177
  8. package/lib/persistedSessions.js +134 -134
  9. package/lib/webTerminal.js +208 -208
  10. package/lib/workspace.js +230 -255
  11. package/package.json +57 -57
  12. package/public/css/base.css +99 -99
  13. package/public/css/cards.css +183 -183
  14. package/public/css/feedback.css +303 -303
  15. package/public/css/forms.css +405 -405
  16. package/public/css/layout.css +160 -160
  17. package/public/css/modal.css +190 -183
  18. package/public/css/responsive.css +10 -10
  19. package/public/css/sidebar.css +616 -601
  20. package/public/css/terminals.css +294 -294
  21. package/public/css/tokens.css +81 -79
  22. package/public/css/wco.css +98 -98
  23. package/public/css/widgets.css +1596 -1375
  24. package/public/index.html +105 -103
  25. package/public/js/api.js +272 -260
  26. package/public/js/components/AdoptModal.js +343 -171
  27. package/public/js/components/App.js +35 -35
  28. package/public/js/components/DirectoryPicker.js +203 -203
  29. package/public/js/components/EntityFormModal.js +105 -105
  30. package/public/js/components/Modal.js +51 -51
  31. package/public/js/components/OfflineBanner.js +93 -93
  32. package/public/js/components/PageTitleBar.js +13 -13
  33. package/public/js/components/Picker.js +179 -179
  34. package/public/js/components/Popover.js +55 -55
  35. package/public/js/components/Sidebar.js +270 -270
  36. package/public/js/components/TerminalView.js +298 -298
  37. package/public/js/components/useDragSort.js +67 -67
  38. package/public/js/dialog.js +67 -67
  39. package/public/js/icons.js +177 -177
  40. package/public/js/main.js +140 -140
  41. package/public/js/pages/AboutPage.js +165 -165
  42. package/public/js/pages/ConfigurePage.js +475 -487
  43. package/public/js/pages/LaunchPage.js +369 -369
  44. package/public/js/pages/SessionsPage.js +97 -97
  45. package/public/js/state.js +231 -231
  46. package/public/manifest.webmanifest +15 -15
  47. package/scripts/install.js +137 -137
  48. package/server.js +1126 -1117
@@ -1,51 +1,51 @@
1
- // Centered modal dialog with backdrop. Closes via Esc, the corner X,
2
- // or a click on the backdrop.
3
- //
4
- // <${Modal} onClose=${close} title="Choose CLI" width=${440}>
5
- // ...body...
6
- // </${Modal}>
7
-
8
- import { html } from '../html.js';
9
- import { useEffect, useRef } from 'preact/hooks';
10
- import { createPortal } from 'preact/compat';
11
-
12
- export function Modal({ title, width = 440, onClose, children }) {
13
- const panelRef = useRef(null);
14
-
15
- useEffect(() => {
16
- const onKey = (ev) => { if (ev.key === 'Escape') onClose?.(); };
17
- document.addEventListener('keydown', onKey, true);
18
- const prev = document.body.style.overflow;
19
- document.body.style.overflow = 'hidden';
20
- return () => {
21
- document.removeEventListener('keydown', onKey, true);
22
- document.body.style.overflow = prev;
23
- };
24
- }, [onClose]);
25
-
26
- const onBackdrop = (ev) => {
27
- if (ev.target === ev.currentTarget) onClose?.();
28
- };
29
-
30
- return createPortal(
31
- html`<div class="modal-backdrop" onMouseDown=${onBackdrop}>
32
- <div ref=${panelRef} class="modal modal-picker"
33
- style=${`width:${width}px;max-width:calc(100vw - 32px);`}
34
- role="dialog" aria-modal="true">
35
- ${title ? html`
36
- <div class="modal-head">
37
- <h2>${title}</h2>
38
- <button class="modal-close" type="button"
39
- aria-label="Close" onClick=${onClose}>
40
- <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
41
- <line x1="3" y1="3" x2="13" y2="13"/>
42
- <line x1="13" y1="3" x2="3" y2="13"/>
43
- </svg>
44
- </button>
45
- </div>` : null}
46
- <div class="modal-body">${children}</div>
47
- </div>
48
- </div>`,
49
- document.body
50
- );
51
- }
1
+ // Centered modal dialog with backdrop. Closes via Esc, the corner X,
2
+ // or a click on the backdrop.
3
+ //
4
+ // <${Modal} onClose=${close} title="Choose CLI" width=${440}>
5
+ // ...body...
6
+ // </${Modal}>
7
+
8
+ import { html } from '../html.js';
9
+ import { useEffect, useRef } from 'preact/hooks';
10
+ import { createPortal } from 'preact/compat';
11
+
12
+ export function Modal({ title, width = 440, onClose, children }) {
13
+ const panelRef = useRef(null);
14
+
15
+ useEffect(() => {
16
+ const onKey = (ev) => { if (ev.key === 'Escape') onClose?.(); };
17
+ document.addEventListener('keydown', onKey, true);
18
+ const prev = document.body.style.overflow;
19
+ document.body.style.overflow = 'hidden';
20
+ return () => {
21
+ document.removeEventListener('keydown', onKey, true);
22
+ document.body.style.overflow = prev;
23
+ };
24
+ }, [onClose]);
25
+
26
+ const onBackdrop = (ev) => {
27
+ if (ev.target === ev.currentTarget) onClose?.();
28
+ };
29
+
30
+ return createPortal(
31
+ html`<div class="modal-backdrop" onMouseDown=${onBackdrop}>
32
+ <div ref=${panelRef} class="modal modal-picker"
33
+ style=${`width:${width}px;max-width:calc(100vw - 32px);`}
34
+ role="dialog" aria-modal="true">
35
+ ${title ? html`
36
+ <div class="modal-head">
37
+ <h2>${title}</h2>
38
+ <button class="modal-close" type="button"
39
+ aria-label="Close" onClick=${onClose}>
40
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
41
+ <line x1="3" y1="3" x2="13" y2="13"/>
42
+ <line x1="13" y1="3" x2="3" y2="13"/>
43
+ </svg>
44
+ </button>
45
+ </div>` : null}
46
+ <div class="modal-body">${children}</div>
47
+ </div>
48
+ </div>`,
49
+ document.body
50
+ );
51
+ }
@@ -1,93 +1,93 @@
1
- // Fullscreen overlay shown when the backend is offline. Blocks
2
- // interaction with the rest of the UI until backend comes back.
3
- //
4
- // The hosted frontend (https://bakapiano.github.io/ccsm/v1/) can't
5
- // spawn processes directly, so we surface a ccsm://start link instead.
6
- // Windows hands that off to the registered protocol handler
7
- // (ccsm.cmd), which spawns the backend silently. Our health probe
8
- // picks it up on the next tick and the overlay auto-hides.
9
- //
10
- // First click triggers a Windows confirmation dialog ("Open ccsm.cmd?").
11
- // User can check "Always allow" to suppress future prompts.
12
-
13
- import { html } from '../html.js';
14
- import { useEffect, useState } from 'preact/hooks';
15
- import { serverHealth } from '../state.js';
16
- import { refreshAll, pollHealth } from '../api.js';
17
- import { BrandMark } from '../icons.js';
18
-
19
- // Silent ccsm:// launch via hidden iframe. Same trick as the router.
20
- // If the protocol is registered AND the user has already OK'd the
21
- // Windows confirmation prompt, ccsm wakes up within ~2s and the
22
- // banner auto-dismisses on the next health poll. On a cold first
23
- // visit (protocol not registered, or "Always allow" not yet ticked),
24
- // the iframe noops silently and the manual "Start ccsm" button is
25
- // still there as fallback.
26
- function silentProtocolLaunch() {
27
- try {
28
- const f = document.createElement('iframe');
29
- f.style.display = 'none';
30
- f.src = 'ccsm://start';
31
- document.body.appendChild(f);
32
- setTimeout(() => { try { f.remove(); } catch {} }, 1500);
33
- } catch {}
34
- }
35
-
36
- export function OfflineBanner() {
37
- const h = serverHealth.value;
38
- const offline = h.state === 'offline';
39
- const [clicked, setClicked] = useState(false);
40
- const [autoTried, setAutoTried] = useState(false);
41
-
42
- // First time we see offline state, try a silent ccsm:// launch and
43
- // tighten the health-poll cadence for a few seconds so the redirect
44
- // happens within ~2-3s without any visible UI flash.
45
- useEffect(() => {
46
- if (!offline || autoTried) return;
47
- setAutoTried(true);
48
- silentProtocolLaunch();
49
- let n = 0;
50
- const tick = async () => {
51
- if (n++ > 12) return; // ~6s of tight polling
52
- await pollHealth();
53
- if (serverHealth.value.state === 'online') return;
54
- setTimeout(tick, 500);
55
- };
56
- setTimeout(tick, 500);
57
- }, [offline]);
58
-
59
- useEffect(() => {
60
- if (h.state === 'online' && clicked) {
61
- refreshAll().catch(() => {});
62
- setClicked(false);
63
- }
64
- }, [h.state, clicked]);
65
-
66
- if (!offline) return null;
67
-
68
- return html`
69
- <div class="offline-overlay" role="dialog" aria-modal="true" aria-labelledby="offline-title">
70
- <div class="offline-card">
71
- <div class="offline-brand"><${BrandMark} /></div>
72
- <h1 id="offline-title" class="offline-title">Backend not running</h1>
73
- <p class="offline-copy">
74
- ccsm's local backend isn't reachable. Click Start to launch it —
75
- Windows may ask for permission once. Tick <em>Always allow</em>
76
- to silence future prompts.
77
- </p>
78
- <div class="offline-actions">
79
- <a class="action primary big" href="ccsm://start"
80
- onClick=${() => setClicked(true)}>Start ccsm</a>
81
- </div>
82
- <details class="offline-fallback">
83
- <summary>Don't have ccsm installed?</summary>
84
- <div class="offline-fallback-body">
85
- <p>Install once via npm, then come back here:</p>
86
- <pre><code>npm i -g @bakapiano/ccsm</code></pre>
87
- <p>Or run a one-shot trial without installing:</p>
88
- <pre><code>npx @bakapiano/ccsm</code></pre>
89
- </div>
90
- </details>
91
- </div>
92
- </div>`;
93
- }
1
+ // Fullscreen overlay shown when the backend is offline. Blocks
2
+ // interaction with the rest of the UI until backend comes back.
3
+ //
4
+ // The hosted frontend (https://bakapiano.github.io/ccsm/v1/) can't
5
+ // spawn processes directly, so we surface a ccsm://start link instead.
6
+ // Windows hands that off to the registered protocol handler
7
+ // (ccsm.cmd), which spawns the backend silently. Our health probe
8
+ // picks it up on the next tick and the overlay auto-hides.
9
+ //
10
+ // First click triggers a Windows confirmation dialog ("Open ccsm.cmd?").
11
+ // User can check "Always allow" to suppress future prompts.
12
+
13
+ import { html } from '../html.js';
14
+ import { useEffect, useState } from 'preact/hooks';
15
+ import { serverHealth } from '../state.js';
16
+ import { refreshAll, pollHealth } from '../api.js';
17
+ import { BrandMark } from '../icons.js';
18
+
19
+ // Silent ccsm:// launch via hidden iframe. Same trick as the router.
20
+ // If the protocol is registered AND the user has already OK'd the
21
+ // Windows confirmation prompt, ccsm wakes up within ~2s and the
22
+ // banner auto-dismisses on the next health poll. On a cold first
23
+ // visit (protocol not registered, or "Always allow" not yet ticked),
24
+ // the iframe noops silently and the manual "Start ccsm" button is
25
+ // still there as fallback.
26
+ function silentProtocolLaunch() {
27
+ try {
28
+ const f = document.createElement('iframe');
29
+ f.style.display = 'none';
30
+ f.src = 'ccsm://start';
31
+ document.body.appendChild(f);
32
+ setTimeout(() => { try { f.remove(); } catch {} }, 1500);
33
+ } catch {}
34
+ }
35
+
36
+ export function OfflineBanner() {
37
+ const h = serverHealth.value;
38
+ const offline = h.state === 'offline';
39
+ const [clicked, setClicked] = useState(false);
40
+ const [autoTried, setAutoTried] = useState(false);
41
+
42
+ // First time we see offline state, try a silent ccsm:// launch and
43
+ // tighten the health-poll cadence for a few seconds so the redirect
44
+ // happens within ~2-3s without any visible UI flash.
45
+ useEffect(() => {
46
+ if (!offline || autoTried) return;
47
+ setAutoTried(true);
48
+ silentProtocolLaunch();
49
+ let n = 0;
50
+ const tick = async () => {
51
+ if (n++ > 12) return; // ~6s of tight polling
52
+ await pollHealth();
53
+ if (serverHealth.value.state === 'online') return;
54
+ setTimeout(tick, 500);
55
+ };
56
+ setTimeout(tick, 500);
57
+ }, [offline]);
58
+
59
+ useEffect(() => {
60
+ if (h.state === 'online' && clicked) {
61
+ refreshAll().catch(() => {});
62
+ setClicked(false);
63
+ }
64
+ }, [h.state, clicked]);
65
+
66
+ if (!offline) return null;
67
+
68
+ return html`
69
+ <div class="offline-overlay" role="dialog" aria-modal="true" aria-labelledby="offline-title">
70
+ <div class="offline-card">
71
+ <div class="offline-brand"><${BrandMark} /></div>
72
+ <h1 id="offline-title" class="offline-title">Backend not running</h1>
73
+ <p class="offline-copy">
74
+ ccsm's local backend isn't reachable. Click Start to launch it —
75
+ Windows may ask for permission once. Tick <em>Always allow</em>
76
+ to silence future prompts.
77
+ </p>
78
+ <div class="offline-actions">
79
+ <a class="action primary big" href="ccsm://start"
80
+ onClick=${() => setClicked(true)}>Start ccsm</a>
81
+ </div>
82
+ <details class="offline-fallback">
83
+ <summary>Don't have ccsm installed?</summary>
84
+ <div class="offline-fallback-body">
85
+ <p>Install once via npm, then come back here:</p>
86
+ <pre><code>npm i -g @bakapiano/ccsm</code></pre>
87
+ <p>Or run a one-shot trial without installing:</p>
88
+ <pre><code>npx @bakapiano/ccsm</code></pre>
89
+ </div>
90
+ </details>
91
+ </div>
92
+ </div>`;
93
+ }
@@ -1,13 +1,13 @@
1
- // Thin page-title strip rendered at the top of every page's main panel.
2
- // Matches the sidebar collapse-toggle height so the eye sees a single
3
- // 28px-tall row spanning the top of the whole window.
4
-
5
- import { html } from '../html.js';
6
-
7
- export function PageTitleBar({ title, children }) {
8
- return html`
9
- <header class="page-title-bar">
10
- <div class="page-title-bar-title">${title}</div>
11
- ${children ? html`<div class="page-title-bar-actions">${children}</div>` : null}
12
- </header>`;
13
- }
1
+ // Thin page-title strip rendered at the top of every page's main panel.
2
+ // Matches the sidebar collapse-toggle height so the eye sees a single
3
+ // 28px-tall row spanning the top of the whole window.
4
+
5
+ import { html } from '../html.js';
6
+
7
+ export function PageTitleBar({ title, children }) {
8
+ return html`
9
+ <header class="page-title-bar">
10
+ <div class="page-title-bar-title">${title}</div>
11
+ ${children ? html`<div class="page-title-bar-actions">${children}</div>` : null}
12
+ </header>`;
13
+ }