@aednzxy/smith-tui 0.0.0-stage → 0.1.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.
- package/README.md +160 -2
- package/dist/app/commands.js +58 -0
- package/dist/app/commands.js.map +1 -0
- package/dist/app/controller.js +5129 -0
- package/dist/app/controller.js.map +1 -0
- package/dist/app/state.js +266 -0
- package/dist/app/state.js.map +1 -0
- package/dist/cli.js +154 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/config.js +110 -0
- package/dist/client/config.js.map +1 -0
- package/dist/client/http.js +796 -0
- package/dist/client/http.js.map +1 -0
- package/dist/client/reducer.js +623 -0
- package/dist/client/reducer.js.map +1 -0
- package/dist/client/session-start.js +39 -0
- package/dist/client/session-start.js.map +1 -0
- package/dist/client/shell-ws.js +126 -0
- package/dist/client/shell-ws.js.map +1 -0
- package/dist/client/types.js +22 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/ws.js +233 -0
- package/dist/client/ws.js.map +1 -0
- package/dist/engine/color.js +142 -0
- package/dist/engine/color.js.map +1 -0
- package/dist/engine/editor.js +350 -0
- package/dist/engine/editor.js.map +1 -0
- package/dist/engine/input.js +351 -0
- package/dist/engine/input.js.map +1 -0
- package/dist/engine/screen.js +513 -0
- package/dist/engine/screen.js.map +1 -0
- package/dist/engine/terminal.js +163 -0
- package/dist/engine/terminal.js.map +1 -0
- package/dist/format/diff.js +85 -0
- package/dist/format/diff.js.map +1 -0
- package/dist/format/markdown.js +438 -0
- package/dist/format/markdown.js.map +1 -0
- package/dist/format/questions.js +78 -0
- package/dist/format/questions.js.map +1 -0
- package/dist/format/sessions.js +310 -0
- package/dist/format/sessions.js.map +1 -0
- package/dist/format/time.js +217 -0
- package/dist/format/time.js.map +1 -0
- package/dist/format/tools.js +169 -0
- package/dist/format/tools.js.map +1 -0
- package/dist/format/vt.js +233 -0
- package/dist/format/vt.js.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/theme/palettes.js +1651 -0
- package/dist/theme/palettes.js.map +1 -0
- package/dist/views/activity-view.js +212 -0
- package/dist/views/activity-view.js.map +1 -0
- package/dist/views/auth-view.js +85 -0
- package/dist/views/auth-view.js.map +1 -0
- package/dist/views/boards-view.js +163 -0
- package/dist/views/boards-view.js.map +1 -0
- package/dist/views/chat-view.js +626 -0
- package/dist/views/chat-view.js.map +1 -0
- package/dist/views/compute-view.js +281 -0
- package/dist/views/compute-view.js.map +1 -0
- package/dist/views/files-skills-view.js +209 -0
- package/dist/views/files-skills-view.js.map +1 -0
- package/dist/views/fleet-view.js +282 -0
- package/dist/views/fleet-view.js.map +1 -0
- package/dist/views/inspector-view.js +612 -0
- package/dist/views/inspector-view.js.map +1 -0
- package/dist/views/memory-view.js +316 -0
- package/dist/views/memory-view.js.map +1 -0
- package/dist/views/modals-view.js +709 -0
- package/dist/views/modals-view.js.map +1 -0
- package/dist/views/notes-view.js +133 -0
- package/dist/views/notes-view.js.map +1 -0
- package/dist/views/select-agent-view.js +153 -0
- package/dist/views/select-agent-view.js.map +1 -0
- package/dist/views/settings-view.js +538 -0
- package/dist/views/settings-view.js.map +1 -0
- package/dist/views/shell-layout.js +802 -0
- package/dist/views/shell-layout.js.map +1 -0
- package/package.json +46 -4
package/README.md
CHANGED
|
@@ -1,3 +1,161 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Smith TUI (`@aednzxy/smith-tui`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Calm, keyboard-first terminal client for Smith with full feature parity across Smith's Workbench surfaces. Built as a standalone Node.js + TypeScript package with **zero third-party runtime dependencies** and canonical type safety against `@smith/protocol`.
|
|
4
|
+
|
|
5
|
+
Every request goes strictly through Smith's host gateway (ADR 122 bearer auth and `/api/agent/<dir>/worker/...` passthrough) — the client never dials worker ports directly and sits outside `pnpm-workspace.yaml` so it has zero effect on container compatibility hashes or `pnpm-lock.yaml`.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Node.js 22+** (uses native `fetch`, `WebSocket`, `node:crypto`, and `node:test`)
|
|
10
|
+
- A running Smith gateway (`http://host:3100` or `https://...`)
|
|
11
|
+
|
|
12
|
+
## Install & Update (Anywhere with Node 22+)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install globally from npm
|
|
16
|
+
npm install -g @aednzxy/smith-tui
|
|
17
|
+
|
|
18
|
+
# Run against your Smith gateway
|
|
19
|
+
smith-tui --server smith:3100
|
|
20
|
+
|
|
21
|
+
# Jump straight into a specific agent
|
|
22
|
+
smith-tui smith --server smith:3100
|
|
23
|
+
|
|
24
|
+
# Update anytime to the latest published build
|
|
25
|
+
npm install -g @aednzxy/smith-tui@latest
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Merging any change under `clients/tui/` into `main` automatically runs tests, bumps the patch version against npm, and publishes a new `@aednzxy/smith-tui` release via [`.github/workflows/tui-npm-publish.yml`](../../.github/workflows/tui-npm-publish.yml).
|
|
29
|
+
|
|
30
|
+
## Build from Source
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cd clients/tui
|
|
34
|
+
npm install
|
|
35
|
+
npm run build
|
|
36
|
+
node dist/cli.js --server http://127.0.0.1:3100
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or link your local checkout as `smith-tui`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cd clients/tui
|
|
43
|
+
npm link
|
|
44
|
+
smith-tui --server https://smith.example
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## CLI Options & Environment Variables
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Usage:
|
|
51
|
+
smith-tui [agent] [options]
|
|
52
|
+
|
|
53
|
+
Options:
|
|
54
|
+
-s, --server <addr> Gateway address (e.g. 127.0.0.1:3100 or https://smith.example)
|
|
55
|
+
--host <host> Gateway hostname (default: saved or 127.0.0.1)
|
|
56
|
+
-p, --port <port> Gateway port (default: 3100)
|
|
57
|
+
--https Use HTTPS / WSS
|
|
58
|
+
-a, --agent <dir> Open directly on this agent
|
|
59
|
+
--session <id> Open directly on this conversation
|
|
60
|
+
-t, --theme <name> Palette: terminal, smith (default), dracula, catppuccin, nord, ...
|
|
61
|
+
-m, --mode <mode> Color mode: dark (default) or light
|
|
62
|
+
--token <token> Use an explicit gateway bearer token (overrides saved token)
|
|
63
|
+
--logout Clear saved local session token and exit
|
|
64
|
+
-v, --version Print version
|
|
65
|
+
-h, --help Show this help
|
|
66
|
+
|
|
67
|
+
Environment variables:
|
|
68
|
+
SMITH_SERVER Default gateway address
|
|
69
|
+
SMITH_AGENT Default agent directory or name (skips Select Agent screen)
|
|
70
|
+
SMITH_TOKEN Explicit bearer token
|
|
71
|
+
SMITH_THEME Default palette name
|
|
72
|
+
SMITH_MODE Default color mode (dark | light)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Credentials and local preferences are stored with `0600` file permissions at `$XDG_CONFIG_HOME/smith-tui/config.json` (default `~/.config/smith-tui/config.json`), scoped to the exact gateway server address.
|
|
76
|
+
|
|
77
|
+
## Terminal-First UX Design
|
|
78
|
+
|
|
79
|
+
Unlike a shrunken multi-pane desktop app, Smith TUI uses a **calm single-pane layout** inspired by Claude Code, OpenCode, Helix, and k9s:
|
|
80
|
+
|
|
81
|
+
- **Single-Agent Session Focus & Deferred New Chat:** Launching `smith-tui` opens a clean **Select Agent** screen first (filterable, `↑/↓` + `Enter`, or `1–9` jump). Pass `smith-tui <agent>` / `--agent <dir>` (or `SMITH_AGENT=<dir>`) to skip selection. Choosing an agent opens a fresh new chat immediately without saving anything to the database until you send your first message (atomic `session.start`).
|
|
82
|
+
- **1-line Top Context Bar:** Shows active agent (`● Smith › Conversation Title`), model & reasoning effort, context percentage, live working timer, and a Fleet needs-you badge when chats are waiting on you.
|
|
83
|
+
- **Full-Width Terminal Canvas (No Sidebar):** The chat transcript, code blocks, diffs, and prompt-rule composer (`› `) span the full terminal width cleanly, like a native coding agent TUI.
|
|
84
|
+
- **1-line Contextual Key-Hint Footer:** Mode pill (`INSERT`, `BROWSE`, `DECISION`, `GO TO`, `CHATS`, `INSPECT`, `BOARDS`, `MEMORY`, etc.) alongside clickable, context-accurate shortcuts.
|
|
85
|
+
- **Hybrid Modal + Chord Keyboard Flow (with full mouse support):**
|
|
86
|
+
- Starts in **`INSERT` mode** ready to type immediately; `Ctrl+` / `Alt+` chords work directly without leaving the composer.
|
|
87
|
+
- Press **`Esc`** to enter **`BROWSE` mode** for single-key scrolling, chat/inspector overlays, and a **Helix-style `g` Go-To which-key menu** to jump to any workspace view.
|
|
88
|
+
- Press **`c` or `Enter`** to return to `INSERT` mode; press **`Esc`** from any secondary section to return straight to Chats.
|
|
89
|
+
- **Fast On-Demand Overlays:** Conversations Picker (`Ctrl+T` / `s` — with `↑/↓`, `PgUp`/`PgDn`, `Home`/`End`, mouse wheel, fuzzy search, and `Tab` filters), Full-Focus Inspector (`Ctrl+\` / `i`), and Command Palette + Search (`Ctrl+K` / `Ctrl+P`) pop open cleanly on demand and dismiss back to your calm canvas.
|
|
90
|
+
|
|
91
|
+
## Feature Parity Overview
|
|
92
|
+
|
|
93
|
+
- **Auth & Roles (ADR 122):** Email/password login, gateway probe, 401 sign-out, 503/4503 identity-migration handling, and member-scoped visibility (owner-only sections and admin Users controls are hidden automatically for members).
|
|
94
|
+
- **Chats & Streaming Transcript:**
|
|
95
|
+
- Fuzzy Conversations Picker (`Ctrl+T` / `s`) with timeline groups, filters (`All`, `Needs you`, `Working`, `Pinned`, `Archived`), unread indicators (`accountReadState`), pin/archive/delete actions, and collapsible nested parent/child families (ADR 174 / 194).
|
|
96
|
+
- Real-time streaming with reasoning/thinking blocks, syntax-highlighted Markdown & fenced code blocks, per-tool rich cards (Bash, Read, Edit inline unified diff, Write, Grep, Glob, TodoWrite), context usage meter, session cost, and turn duration.
|
|
97
|
+
- Queued & steered mid-turn messaging, Stop (`Ctrl+X` / `X` / `/stop`), Rewind, Branch (`with-context` / `seed-only`), Redo, Wakes (one-shot & cron), Shared People management, Model/Thinking/Speed picker (`Ctrl+O`), and OSC-52 clipboard copy (`y` / `/copy`).
|
|
98
|
+
- Batched `ask_user` Decision Cards supporting `1..9` instant single-choice pick, multi-choice checkboxes, grouped questions, skip, and optional notes (`n`).
|
|
99
|
+
- **Full-Focus Inspector (`Ctrl+\` / `Alt+I` / `i`):** Numbered tabs (`1-9`, `0`, `b`) covering Overview (with keyboard quick actions), Tasks, Plan, Status, Background processes, Worktree Changes (with full-width unified diff viewer via `Enter`), Pull Requests & Tickets, Subagents (with transcript & Steer/Resume/Stop), Compute workloads, Private Notes (editable), and in-container Browser status.
|
|
100
|
+
- **Fleet Inbox & Overview (`g` → `f` / `Ctrl+0`):** Cross-agent needs-you question inbox (`Enter` jumps straight to the parked chat), fleet KPI summary cards, running jobs, agent roster with Start/Stop/+Chat/Create Agent, 30-day spend charts, and dismissible attention items.
|
|
101
|
+
- **Workspace Sections (via `g` Go-To menu or `Alt+1..8`):** Kanban Boards (ADR 143/146 with lane moves, card creation, and Card Chat), Agent Notebook (ADR 198 with revision-locked editing, pinning, search, and Trash), Files browser & mtime-locked text editor, Skills browser & `SKILL.md` editor, Memory (Files, Subjects, interactive Knowledge Graph Explorer with keyboard neighbor traversal via `Tab` + `Enter`, Upkeep/Moments + Nightly/Deep consolidation), Activity (Jobs, Live Logs, Stats), and Agent Settings.
|
|
102
|
+
- **Compute (ADR 126, `g` → `w` / `Alt+0`):** Pulse overview, Machines with admin power controls (`W` Wake, `D` Drain, `S` Sleep), Workloads & Problems with details, live logs, outputs, cancel (`x`), release (`L`), and origin-chat jump (`o`).
|
|
103
|
+
- **Preferences & Platform Settings (`Ctrl+,` / `g` → `,`):** Full keyboard focus switching (`Tab` between nav and body) across Account & signed-in device sessions, Account Time Zone, Server connection, all **24 Smith palettes** (dark + light = 48 themes) plus native `terminal` palette, Agent Visibility, Usage & provider quota windows, Storage Explorer, and Admin Users management.
|
|
104
|
+
- **Container Shell:** Both an embedded VT100 terminal drawer (`Ctrl+\``) and full-screen raw PTY passthrough (`Ctrl+G` or `g` → `t`, `Ctrl+]` to detach) over `/api/agent/<dir>/shell`.
|
|
105
|
+
|
|
106
|
+
## Key Shortcuts
|
|
107
|
+
|
|
108
|
+
### Global Chords (work anywhere, even in `INSERT` mode)
|
|
109
|
+
|
|
110
|
+
| Shortcut | Action |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `Ctrl+T` | Conversations Picker overlay (`↑/↓`, `PgUp`/`PgDn`, mouse wheel, fuzzy search, `Tab` filter, pin, archive) |
|
|
113
|
+
| `Ctrl+\` / `Alt+I` | Full-Focus Inspector overlay |
|
|
114
|
+
| `Ctrl+K` / `Ctrl+P` | Command Palette & Search |
|
|
115
|
+
| `Ctrl+O` | Model / Thinking Effort / Speed Picker |
|
|
116
|
+
| `Ctrl+N` | Start a new deferred conversation |
|
|
117
|
+
| `Ctrl+X` | Stop running agent turn (intentional — `Esc` safely enters `BROWSE`) |
|
|
118
|
+
| `Ctrl+\`` / `Alt+J` | Toggle embedded Logs / Shell / Background drawer |
|
|
119
|
+
| `Ctrl+G` | Attach full-screen raw Container PTY Shell (`Ctrl+]` detaches) |
|
|
120
|
+
| `Ctrl+,` | Preferences & Platform Settings |
|
|
121
|
+
| `Ctrl+0` / `Alt+F` | Fleet Inbox & Overview |
|
|
122
|
+
| `Alt+0` | Compute (Pulse, Machines, Workloads) |
|
|
123
|
+
| `Alt+1..8` | Jump directly to active agent's workspace section |
|
|
124
|
+
| `Alt+[` / `Alt+]` | Navigate back / forward in history |
|
|
125
|
+
| `PgUp` / `PgDn` | Scroll chat transcript without leaving `INSERT` mode |
|
|
126
|
+
| `Ctrl+C` | Quit cleanly (restores terminal state) |
|
|
127
|
+
|
|
128
|
+
### `BROWSE` Mode (press `Esc` in Chat) & `g` Go-To Menu
|
|
129
|
+
|
|
130
|
+
| Key | Action |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| `c` / `Enter` | Return to `INSERT` mode (compose message) |
|
|
133
|
+
| `j` / `k` or `↑` / `↓` | Scroll transcript (`u`/`d` half-page, `G`/`End` bottom, `Home` top) |
|
|
134
|
+
| `s` or `/` | Open Conversations Picker overlay |
|
|
135
|
+
| `i` | Open Full-Focus Inspector overlay |
|
|
136
|
+
| `g` | Open Helix-style Go-To menu (`c` Chats, `b` Boards, `n` Notes, `d` Files, `s` Skills, `m` Memory, `v` Activity, `.` Agent cfg, `f` Fleet, `i` Inspector, `w` Compute, `t` Shell, `,` Settings) |
|
|
137
|
+
| `m` / `o` / `r` | Model picker / Toggle tool details / Toggle reasoning blocks |
|
|
138
|
+
| `w` / `R` / `B` / `P` | Wake schedule / Rewind / Branch / Shared People |
|
|
139
|
+
| `n` / `y` / `L` / `X` | New chat / Copy last reply / Load older history / Stop turn |
|
|
140
|
+
| `t` / `?` | Theme palette picker / Shortcuts & slash commands help |
|
|
141
|
+
|
|
142
|
+
## Architecture
|
|
143
|
+
|
|
144
|
+
- `src/engine/` — Double-buffered 2D cell grid (`ScreenBuffer`), Unicode wide-char layout, minimal synchronized-output (`\x1b[?2026h`) ANSI diff renderer, Kitty CSI-u / SGR mouse / bracketed paste input parser, `TextEditor`, and crash-safe `TerminalController`.
|
|
145
|
+
- `src/theme/` — All 24 Smith palette families (dark + light) plus native `terminal` mode.
|
|
146
|
+
- `src/client/` — `0600` config store, byte-identical `sessionStartPayloadSha256`, gateway & worker passthrough `GatewayClient`, multi-agent `AgentConnectionPool`, pure `reduceServerEvent` state reducer, and `ContainerShellClient`.
|
|
147
|
+
- `src/format/` — Account-IANA-timezone formatters, Markdown + syntax highlighter, unified diff generator/parser, per-tool renderers, `ask_user` choice parser, conversation family merger, and lightweight VT100 emulator (`VtScreen`).
|
|
148
|
+
- `src/app/` & `src/views/` — Headless-testable `SmithTuiApp` controller, slash commands, calm shell chrome + Helix `g` menu, overlays, and composable view renderers for every Smith surface.
|
|
149
|
+
|
|
150
|
+
## Testing
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
cd clients/tui
|
|
154
|
+
npm run typecheck
|
|
155
|
+
npm test
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The test suite runs with zero external test frameworks (`node --test`) and includes:
|
|
159
|
+
- Unit tests across engine, color, input, editor, formatters, palettes, config, `session.start` payload hashing, wire memory normalization, and WS reducer.
|
|
160
|
+
- Full headless E2E keyboard-first test suite against a zero-dependency Node HTTP + RFC 6455 WebSocket Smith fixture server (`src/tests/fixture-server.ts`), covering auth, calm Chat `INSERT`/`BROWSE` modes, `g` Go-To menu, Chats/Agents/Inspector overlays (including keyboard diff drill-down), Boards, Notes, Files, Skills, Memory Graph keyboard traversal, Activity, Compute, Settings, embedded Shell, member role scoping, and responsive sizes (`80×24`, `120×36`, `160×48`).
|
|
161
|
+
- Real Linux PTY integration test (`src/tests/pty-e2e.test.ts`) running the compiled `dist/cli.js` inside a live PTY and verifying synchronized ANSI frames via VT100 replay and clean alt-screen restoration.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Complete slash-command definitions and Command Palette actions for Smith TUI.
|
|
2
|
+
export const SLASH_COMMANDS = [
|
|
3
|
+
{ name: '/chats', usage: '/chats', hint: 'Open conversations picker overlay (Ctrl+T)' },
|
|
4
|
+
{ name: '/new', usage: '/new [title]', hint: 'Start a new conversation' },
|
|
5
|
+
{ name: '/rename', usage: '/rename <title>', hint: 'Rename the current conversation' },
|
|
6
|
+
{ name: '/model', usage: '/model [id|auto|default] [effort] [fast|standard]', hint: 'Open model picker or set model/effort/speed' },
|
|
7
|
+
{ name: '/rewind', usage: '/rewind', hint: 'Rewind conversation to an earlier user message' },
|
|
8
|
+
{ name: '/branch', usage: '/branch', hint: 'Fork a new conversation from the latest message' },
|
|
9
|
+
{ name: '/redo', usage: '/redo [tier]', hint: 'Re-run the last reply on a higher Auto tier' },
|
|
10
|
+
{ name: '/stop', usage: '/stop', hint: 'Stop the currently running turn' },
|
|
11
|
+
{ name: '/steer', usage: '/steer <message>', hint: 'Steer the running turn with a mid-turn message' },
|
|
12
|
+
{ name: '/queue', usage: '/queue <message>', hint: 'Queue a message to run after the current turn' },
|
|
13
|
+
{ name: '/wake', usage: '/wake [now|cancel]', hint: 'View, fire now, or cancel this conversation wake' },
|
|
14
|
+
{ name: '/people', usage: '/people', hint: 'Manage participants in this shared conversation' },
|
|
15
|
+
{ name: '/pin', usage: '/pin', hint: 'Toggle pin on this conversation' },
|
|
16
|
+
{ name: '/archive', usage: '/archive', hint: 'Toggle archive on this conversation' },
|
|
17
|
+
{ name: '/kill', usage: '/kill [session] [--force]', hint: 'Delete current or named conversation' },
|
|
18
|
+
{ name: '/copy', usage: '/copy', hint: 'Copy the last assistant reply to clipboard (OSC-52)' },
|
|
19
|
+
{ name: '/tools', usage: '/tools', hint: 'Toggle expanded tool call inputs & outputs' },
|
|
20
|
+
{ name: '/thinking', usage: '/thinking', hint: 'Toggle reasoning/thinking blocks' },
|
|
21
|
+
{ name: '/inspect', usage: '/inspect [tab]', hint: 'Open full-focus Inspector (tasks/plan/changes/subagents/notes)' },
|
|
22
|
+
{ name: '/shell', usage: '/shell [full]', hint: 'Open container shell in bottom panel (or full-screen PTY)' },
|
|
23
|
+
{ name: '/fleet', usage: '/fleet', hint: 'Jump to Fleet Inbox & Overview' },
|
|
24
|
+
{ name: '/compute', usage: '/compute', hint: 'Jump to Compute (machines & workloads)' },
|
|
25
|
+
{ name: '/boards', usage: '/boards', hint: 'Jump to this agent’s Kanban Boards' },
|
|
26
|
+
{ name: '/notes', usage: '/notes', hint: 'Jump to this agent’s Notebook' },
|
|
27
|
+
{ name: '/files', usage: '/files', hint: 'Jump to this agent’s Files browser' },
|
|
28
|
+
{ name: '/skills', usage: '/skills', hint: 'Jump to this agent’s Skills' },
|
|
29
|
+
{ name: '/memory', usage: '/memory', hint: 'Jump to this agent’s Memory & Graph explorer' },
|
|
30
|
+
{ name: '/activity', usage: '/activity', hint: 'Jump to Jobs, Live Logs & Stats' },
|
|
31
|
+
{ name: '/settings', usage: '/settings [global]', hint: 'Open Agent or Global Settings' },
|
|
32
|
+
{ name: '/theme', usage: '/theme [palette] [dark|light]', hint: 'Switch Smith palette or open theme gallery' },
|
|
33
|
+
{ name: '/dark', usage: '/dark', hint: 'Switch to dark color mode' },
|
|
34
|
+
{ name: '/light', usage: '/light', hint: 'Switch to light color mode' },
|
|
35
|
+
{ name: '/search', usage: '/search [query]', hint: 'Open Command Palette & global search' },
|
|
36
|
+
{ name: '/help', usage: '/help', hint: 'Show keyboard shortcuts and slash commands' },
|
|
37
|
+
{ name: '/logout', usage: '/logout', hint: 'Sign out of this Smith server' },
|
|
38
|
+
{ name: '/quit', usage: '/quit', hint: 'Exit Smith TUI' },
|
|
39
|
+
];
|
|
40
|
+
export function filterSlashCommands(input) {
|
|
41
|
+
if (!input.startsWith('/'))
|
|
42
|
+
return [];
|
|
43
|
+
const head = input.split(/\s+/, 1)[0].toLowerCase();
|
|
44
|
+
return SLASH_COMMANDS.filter((c) => c.name.startsWith(head));
|
|
45
|
+
}
|
|
46
|
+
export function parseSlashCommand(input) {
|
|
47
|
+
const trimmed = input.trim();
|
|
48
|
+
if (!trimmed.startsWith('/'))
|
|
49
|
+
return null;
|
|
50
|
+
const idx = trimmed.indexOf(' ');
|
|
51
|
+
const head = (idx === -1 ? trimmed : trimmed.slice(0, idx)).toLowerCase();
|
|
52
|
+
const rest = idx === -1 ? '' : trimmed.slice(idx + 1).trim();
|
|
53
|
+
const matched = SLASH_COMMANDS.find((c) => c.name === head || (head === '/exit' && c.name === '/quit'));
|
|
54
|
+
if (!matched)
|
|
55
|
+
return null;
|
|
56
|
+
return { name: matched.name, rest };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/app/commands.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAQhF,MAAM,CAAC,MAAM,cAAc,GAA+B;IACxD,EAAE,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