@deepseekcode/cli 1.0.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 (31) hide show
  1. package/README.md +134 -0
  2. package/dist/cli.js +1398 -0
  3. package/dist/stdin-worker.js +22 -0
  4. package/package.json +65 -0
  5. package/web/dist/assets/AgentFlowView-Cq5rwwHO.js +1 -0
  6. package/web/dist/assets/AgentsView-DvSlePx6.js +1 -0
  7. package/web/dist/assets/AskQuestionModal-bOMD8fv0.js +1 -0
  8. package/web/dist/assets/ChannelConfigView-ByhL7_5W.js +8 -0
  9. package/web/dist/assets/FileTreeView-DtYvBKee.js +11 -0
  10. package/web/dist/assets/HookApprovalModal-BOSEvhFh.js +1 -0
  11. package/web/dist/assets/HookConfigView-DIytJ_Pb.js +3 -0
  12. package/web/dist/assets/ModelsView-DOUNg5rX.js +1 -0
  13. package/web/dist/assets/SessionGrid-DS1RanMd.js +17 -0
  14. package/web/dist/assets/SettingsPanel-N5qcaI8b.js +3 -0
  15. package/web/dist/assets/SkillsView-H0sCdR5e.js +1 -0
  16. package/web/dist/assets/TerminalView-BFjl4bGT.js +3 -0
  17. package/web/dist/assets/TerminalView-C1Mzzh8g.css +32 -0
  18. package/web/dist/assets/Toast-DowV4l0w.js +1 -0
  19. package/web/dist/assets/ToolsView-DSl95dvA.js +1 -0
  20. package/web/dist/assets/hookRisk-DECuVQpA.js +1 -0
  21. package/web/dist/assets/icons-B_rAQLge.js +464 -0
  22. package/web/dist/assets/index-BhVUD1px.css +1 -0
  23. package/web/dist/assets/index-BtIzCXfW.js +20 -0
  24. package/web/dist/assets/markdown-BAhUvdx-.js +30 -0
  25. package/web/dist/assets/panels-p9MZH4aX.js +1 -0
  26. package/web/dist/assets/react-vendor-meeTdQCf.js +24 -0
  27. package/web/dist/assets/state-Cke1lss7.js +17 -0
  28. package/web/dist/assets/terminal-Ck_l6svU.js +9 -0
  29. package/web/dist/favicon.svg +12 -0
  30. package/web/dist/index.html +25 -0
  31. package/web/dist/logo.svg +12 -0
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # @deepseekcode/cli
2
+
3
+ Terminal UI (TUI) for the DeepSeekCode TypeScript runtime. Built on [Ink](https://github.com/vadimdemedes/ink) (React-for-terminal).
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ bun --filter @deepseekcode/cli build
9
+ node packages/cli/dist/cli.js run # Connect to remote server
10
+ node packages/cli/dist/cli.js start # Start local in-process runtime
11
+ node packages/cli/dist/cli.js exec <cmd> # Non-interactive execution
12
+ node packages/cli/dist/cli.js codeview # AI code review
13
+ node packages/cli/dist/cli.js --resume # Resume last session
14
+ ```
15
+
16
+ ## Architecture
17
+
18
+ ```
19
+ packages/cli/src/
20
+ main.ts # Entry point — CLI arg parser, startup lifecycle
21
+ App.tsx # Root React component (connected gating, animation clock control)
22
+ client.ts # WebSocket client (DeepSeekCodeClient)
23
+ localClient.ts # In-process runtime client (LocalRuntimeClient)
24
+ store.ts # Microtask-batched state store
25
+ ink/ # Forked Ink renderer (frame budget, Yoga caching)
26
+ hooks/ # React hooks for state, animation, WebSocket, mouse, keyboard
27
+ components/ # UI components (ChatArea, StatusLine, TextInput, etc.)
28
+ tui/ # Interaction primitives (selection, navigation, search)
29
+ commands/ # Slash command registry and handlers
30
+ utils/ # Utilities (session persistence, logging, config)
31
+ ```
32
+
33
+ ## Performance: OOM Prevention
34
+
35
+ The Ink renderer + React reconciler creates significant memory pressure per rendered frame. The following measures prevent OOM in large/heavy sessions:
36
+
37
+ ### Animation Clock Governance
38
+ - **Global gate**: `setAnimationsEnabled(false)` pauses ALL animation subscribers during startup. Animations only activate after WebSocket `connected`.
39
+ - **Dynamic tick rate**: idle (2fps) → active (5fps) → streaming (10fps). Default changed from 50ms/20fps to 200ms/5fps.
40
+ - **Auto-stop**: Clock stops entirely when last subscriber unsubscribes.
41
+
42
+ ### Frame Budget Control
43
+ - Ink's `onRender` measures frame generation time; if a frame completes faster than 100ms since the last, it's skipped (up to 3 consecutive skips before force-render).
44
+ - Combined with `FRAME_INTERVAL_MS=500` throttle on the render scheduler.
45
+
46
+ ### Yoga Layout Versioning
47
+ - `onComputeLayout` tracks a `layoutVersion` counter; if no DOM mutations happened since last computation, `calculateLayout()` (the most expensive per-frame operation) is skipped entirely.
48
+
49
+ ### Lazy Hook Mounting
50
+ - Interaction hooks (mouse wheel, text selection, keyboard selection, message navigation) only mount after `connected === true`.
51
+ - Startup state updates are batched into a single `updateAppState()` call (from 3-5 sequential calls).
52
+
53
+ ## Theme System
54
+
55
+ The CLI supports **multi-theme** with dynamic switching, a `t` Proxy for live access, and JSON file loading compatible with MiMo-Code / opencode format.
56
+
57
+ ### Built-in Themes
58
+
59
+ | Theme | Env Value | Style |
60
+ |-------|-----------|-------|
61
+ | Dark (default) | `dark` | ANSI named colors, broad compat |
62
+ | Light | `light` | Light terminal variant |
63
+ | Nord | `nord` | ❄️ Arctic blue-grey palette |
64
+ | Dracula | `dracula` | 🧛 Dark purple-vibrant |
65
+ | Monokai | `monokai` | 🎨 Classic code editor |
66
+ | One Dark | `one-dark` | 🌙 Atom's iconic dark |
67
+ | Tokyo Night | `tokyo-night` | 🌃 Deep navy + vibrant accents |
68
+
69
+ ### Usage
70
+
71
+ ```bash
72
+ # Via environment variable
73
+ DEEPSEEKCODE_THEME=nord node packages/cli/dist/cli.js run
74
+ DEEPSEEKCODE_THEME=dracula node packages/cli/dist/cli.js start
75
+ DEEPSEEKCODE_THEME=/path/to/my-theme.json node packages/cli/dist/cli.js run
76
+
77
+ # Custom color overrides (partial merge on current theme)
78
+ DEEPSEEKCODE_THEME_COLORS='{"primary":"#ff0000"}' node packages/cli/dist/cli.js run
79
+ ```
80
+
81
+ ### Programmatic API
82
+
83
+ ```typescript
84
+ import { t, setTheme, getTheme, registerTheme, listThemes } from './theme.js'
85
+
86
+ // Components always use the live theme via Proxy
87
+ <Text color={t.primary}>Brand</Text>
88
+ <Text color={t.error}>Error</Text>
89
+ <Text backgroundColor={t.success}>Success</Text>
90
+
91
+ // Switch at runtime
92
+ setTheme('nord')
93
+
94
+ // Register a custom theme
95
+ registerTheme('my-theme', { primary: '#ff6600', bg: '#1a1a2e', ... })
96
+ setTheme('my-theme')
97
+
98
+ // Enumerate all registered themes
99
+ listThemes() // ['dark', 'dracula', 'light', 'monokai', ...]
100
+ ```
101
+
102
+ ### Architecture
103
+
104
+ ```
105
+ src/theme/
106
+ ├── types.ts # ThemeColors interface (60+ color keys)
107
+ ├── registry.ts # Theme registry + t Proxy
108
+ ├── detect.ts # Terminal background detection (OSC 11)
109
+ ├── loader.ts # JSON theme file loader
110
+ └── builtins/ # Built-in theme factories
111
+ ├── index.ts, dark.ts, light.ts,
112
+ ├── nord.ts, dracula.ts, monokai.ts,
113
+ ├── one-dark.ts, tokyo-night.ts
114
+ ```
115
+
116
+ The `t` Proxy (`src/theme/registry.ts`) forwards every property access to the active theme via `getTheme()`, so `t.primary` always returns the current theme's primary color even after `setTheme()` — no re-import needed.
117
+
118
+ ## Config
119
+
120
+ The CLI reads `~/.agent/config.yaml`.
121
+
122
+ ```yaml
123
+ backend_url: http://localhost:8080
124
+ ws_url: ws://localhost:8081/ws
125
+ workspace_dir: /path/to/workspace
126
+ ```
127
+
128
+ ## Development
129
+
130
+ ```bash
131
+ bun --filter @deepseekcode/cli typecheck
132
+ bun --filter @deepseekcode/cli build
133
+ bun --filter @deepseekcode/cli test
134
+ ```