@myrialabs/clopen 0.1.3 → 0.1.5

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 (49) hide show
  1. package/CONTRIBUTING.md +40 -355
  2. package/README.md +46 -113
  3. package/backend/lib/chat/stream-manager.ts +8 -0
  4. package/backend/lib/database/migrations/022_add_snapshot_changes_column.ts +35 -0
  5. package/backend/lib/database/migrations/index.ts +7 -0
  6. package/backend/lib/database/queries/snapshot-queries.ts +7 -4
  7. package/backend/lib/files/file-watcher.ts +34 -0
  8. package/backend/lib/mcp/config.ts +7 -3
  9. package/backend/lib/mcp/servers/helper.ts +25 -14
  10. package/backend/lib/mcp/servers/index.ts +7 -2
  11. package/backend/lib/project/status-manager.ts +6 -4
  12. package/backend/lib/snapshot/snapshot-service.ts +471 -316
  13. package/backend/lib/terminal/pty-session-manager.ts +1 -32
  14. package/backend/ws/chat/stream.ts +45 -2
  15. package/backend/ws/snapshot/restore.ts +77 -67
  16. package/frontend/lib/components/chat/ChatInterface.svelte +21 -14
  17. package/frontend/lib/components/chat/input/ChatInput.svelte +2 -2
  18. package/frontend/lib/components/chat/input/components/ChatInputActions.svelte +1 -1
  19. package/frontend/lib/components/chat/input/components/EngineModelPicker.svelte +24 -12
  20. package/frontend/lib/components/chat/input/composables/use-textarea-resize.svelte.ts +12 -2
  21. package/frontend/lib/components/chat/tools/AskUserQuestionTool.svelte +3 -8
  22. package/frontend/lib/components/checkpoint/TimelineModal.svelte +222 -30
  23. package/frontend/lib/components/common/MonacoEditor.svelte +14 -0
  24. package/frontend/lib/components/common/xterm/XTerm.svelte +9 -0
  25. package/frontend/lib/components/common/xterm/xterm-service.ts +9 -0
  26. package/frontend/lib/components/git/DiffViewer.svelte +16 -2
  27. package/frontend/lib/components/history/HistoryModal.svelte +3 -4
  28. package/frontend/lib/components/settings/appearance/AppearanceSettings.svelte +59 -0
  29. package/frontend/lib/components/settings/engines/AIEnginesSettings.svelte +1 -1
  30. package/frontend/lib/components/terminal/Terminal.svelte +1 -7
  31. package/frontend/lib/components/workspace/DesktopNavigator.svelte +11 -19
  32. package/frontend/lib/components/workspace/MobileNavigator.svelte +4 -15
  33. package/frontend/lib/components/workspace/PanelHeader.svelte +623 -616
  34. package/frontend/lib/components/workspace/panels/ChatPanel.svelte +3 -2
  35. package/frontend/lib/components/workspace/panels/FilesPanel.svelte +3 -2
  36. package/frontend/lib/components/workspace/panels/GitPanel.svelte +3 -2
  37. package/frontend/lib/services/notification/global-stream-monitor.ts +56 -16
  38. package/frontend/lib/services/snapshot/snapshot.service.ts +71 -32
  39. package/frontend/lib/stores/core/presence.svelte.ts +63 -1
  40. package/frontend/lib/stores/features/settings.svelte.ts +9 -1
  41. package/frontend/lib/stores/features/terminal.svelte.ts +6 -0
  42. package/frontend/lib/stores/ui/workspace.svelte.ts +4 -3
  43. package/package.json +1 -1
  44. package/shared/types/database/schema.ts +18 -0
  45. package/shared/types/stores/settings.ts +2 -0
  46. package/scripts/pre-publish-check.sh +0 -142
  47. package/scripts/setup-hooks.sh +0 -134
  48. package/scripts/validate-branch-name.sh +0 -47
  49. package/scripts/validate-commit-msg.sh +0 -42
package/CONTRIBUTING.md CHANGED
@@ -1,37 +1,25 @@
1
1
  # Contributing Guide
2
2
 
3
- Contributing guide for Clopen. For maintainer instructions, see [MAINTAINER.md](logs/MAINTAINER.md).
4
-
5
3
  ---
6
4
 
7
5
  ## Getting Started
8
6
 
9
7
  ### Prerequisites
10
8
 
11
- - [Bun](https://bun.sh/) v1.2.12+
12
9
  - [Git](https://git-scm.com/)
13
- - [Claude Code](https://github.com/anthropics/claude-code)
10
+ - [Bun](https://bun.sh/) v1.2.12+
11
+ - [Claude Code](https://github.com/anthropics/claude-code) and/or [OpenCode](https://github.com/anomalyco/opencode)
14
12
 
15
13
  ### Setup
16
14
 
15
+ Fork the repository via GitHub UI, then:
16
+
17
17
  ```bash
18
- # Fork via GitHub UI, then:
19
18
  git clone https://github.com/YOUR_USERNAME/clopen.git
20
19
  cd clopen
21
20
  git remote add upstream https://github.com/myrialabs/clopen.git
22
-
23
21
  bun install
24
- cp .env.example .env
25
-
26
- # Verify
27
22
  bun run check
28
- bun run lint
29
- bun run build
30
-
31
- # Test
32
- bun link
33
- clopen
34
- bun unlink
35
23
  ```
36
24
 
37
25
  ### Keep Updated
@@ -40,7 +28,6 @@ bun unlink
40
28
  git fetch upstream
41
29
  git checkout main
42
30
  git merge upstream/main
43
- git push origin main
44
31
  ```
45
32
 
46
33
  ---
@@ -56,17 +43,7 @@ Format: `<type>/<description>`
56
43
  | `docs/` | Documentation |
57
44
  | `chore/` | Other changes |
58
45
 
59
- Rules:
60
- - Lowercase only
61
- - Use hyphens
62
- - Short and descriptive
63
-
64
- Examples:
65
- ```bash
66
- feature/database-management
67
- fix/websocket-connection
68
- docs/update-readme
69
- ```
46
+ Examples: `feature/database-management`, `fix/websocket-connection`
70
47
 
71
48
  ---
72
49
 
@@ -74,189 +51,54 @@ docs/update-readme
74
51
 
75
52
  Format: `<type>(<scope>): <subject>`
76
53
 
77
- ### Types
78
-
79
54
  | Type | Use |
80
55
  |------|-----|
81
56
  | `feat` | New feature |
82
57
  | `fix` | Bug fix |
83
58
  | `docs` | Documentation |
84
- | `chore` | Other (refactor, test, build, perf) |
59
+ | `chore` | Refactor, build, perf |
85
60
  | `release` | Version release |
86
61
 
87
- ### Scopes
88
-
89
- Common: `chat`, `terminal`, `preview`, `files`, `db`, `api`, `ui`, `deps`
90
-
91
- ### Rules
92
-
93
- - Imperative mood ("add" not "added")
94
- - No capital first letter
95
- - No period at end
96
- - Max 72 characters
62
+ Rules: imperative mood, lowercase, no period, max 72 chars.
97
63
 
98
- ### Examples
99
-
100
- ```bash
101
- feat: add database management UI
64
+ Examples:
65
+ ```
102
66
  feat(chat): add message export
103
67
  fix(terminal): resolve memory leak
104
- docs: update installation guide
105
68
  chore: update dependencies
106
- chore(preview): optimize streaming
107
- release: v0.1.0
108
69
  ```
109
70
 
110
71
  ---
111
72
 
112
73
  ## Development Workflow
113
74
 
114
- ### Step 1: Sync
115
-
116
75
  ```bash
117
- git checkout main
118
- git pull upstream main
119
- git push origin main
120
- ```
76
+ # 1. Sync
77
+ git checkout main && git pull upstream main
121
78
 
122
- ### Step 2: Branch
123
-
124
- ```bash
79
+ # 2. Branch
125
80
  git checkout -b feature/your-feature
126
- ```
127
-
128
- ### Step 3: Develop
129
-
130
- ```bash
131
- # Make changes, then:
132
- bun run check
133
- bun run lint
134
- bun run build
135
- ```
136
81
 
137
- ### Step 4: Commit
82
+ # 3. Develop & verify
83
+ bun run check && bun run lint && bun run build
138
84
 
139
- ```bash
140
- git add .
85
+ # 4. Commit & push
141
86
  git commit -m "feat(scope): description"
142
- ```
143
-
144
- ### Step 5: Push
145
-
146
- ```bash
147
87
  git push origin feature/your-feature
148
88
  ```
149
89
 
150
- ### Step 6: PR
151
-
152
- Via GitHub UI:
153
- 1. Go to https://github.com/myrialabs/clopen/pulls
154
- 2. "New Pull Request" → "compare across forks"
155
- 3. base: `myrialabs/clopen` → `dev`
156
- 4. head: `YOUR_USERNAME/clopen` → `feature/your-feature`
157
- 5. Fill template & create
158
-
159
- Via CLI:
160
- ```bash
161
- gh pr create --base dev --title "feat: your feature"
162
- ```
163
-
164
- ### Step 7: Address Feedback
165
-
166
- ```bash
167
- # Make changes
168
- git add .
169
- git commit -m "fix: address feedback"
170
- git push
171
- ```
172
-
173
- ### Step 8: After Merge
174
-
175
- ```bash
176
- git checkout main
177
- git branch -D feature/your-feature
178
- git pull upstream main
179
- git push origin main
180
- ```
90
+ Open a PR targeting the `dev` branch on GitHub.
181
91
 
182
92
  ---
183
93
 
184
94
  ## Pre-commit Checklist
185
95
 
186
- ```bash
187
- bun run check
188
- bun run lint
189
- bun run build
190
- bun link && clopen
191
- ```
192
-
193
- Verify:
194
- - [ ] Code follows conventions
195
- - [ ] Commit message follows format
196
- - [ ] Branch name follows format
197
- - [ ] No sensitive data
198
- - [ ] No `console.*` (use `debug` module)
199
-
200
- ---
201
-
202
- ## Pull Request Guidelines
203
-
204
- ### Title Format
205
-
206
- ```
207
- feat(scope): description
208
- fix(scope): description
209
- docs(scope): description
210
- ```
211
-
212
- Examples:
213
- - `feat(chat): add message export`
214
- - `fix(terminal): resolve memory leak`
215
-
216
- ### PR Template
217
-
218
- ```markdown
219
- ## Summary
220
- Brief description
221
-
222
- ## Type
223
- - [ ] Bug fix
224
- - [ ] Feature
225
- - [ ] Breaking change
226
- - [ ] Docs
227
-
228
- ## Changes
229
- - Added/Fixed/Updated...
230
-
231
- ## Testing
232
96
  - [ ] `bun run check` passes
233
97
  - [ ] `bun run lint` passes
234
98
  - [ ] `bun run build` works
235
- - [ ] Tested locally
236
-
237
- ## Related
238
- Closes #123
239
-
240
- ## Checklist
241
- - [ ] Follows style
242
- - [ ] Self-reviewed
243
- - [ ] No `console.*`
244
- - [ ] Updated with `dev`
245
- ```
246
-
247
- ### Best Practices
248
-
249
- Do:
250
- - Keep PRs small (< 500 lines)
251
- - One feature per PR
252
- - Clear description
253
- - Respond to feedback quickly
254
-
255
- Don't:
256
- - Mix features in one PR
257
- - Force push after review
258
- - Ignore feedback
259
- - Commit to `main`/`dev` directly
99
+ - [ ] Commit message follows format
100
+ - [ ] No `console.*` (use `debug` module)
101
+ - [ ] No sensitive data
260
102
 
261
103
  ---
262
104
 
@@ -264,157 +106,38 @@ Don't:
264
106
 
265
107
  ### TypeScript
266
108
 
267
- - Proper type annotations where useful
268
- - `any` is allowed for Elysia/WS patterns (ESLint `no-explicit-any` is off)
269
- - Use `const` by default, `let` only when reassignment is needed
270
-
271
- ```typescript
272
- // const for values that don't change
273
- const userName = 'John';
274
- const config = { port: 9141 };
275
-
276
- // let only when the value will be reassigned
277
- let retryCount = 0;
278
- retryCount++;
279
- ```
109
+ - Use `const` by default; `let` only when reassignment is needed
110
+ - `any` is allowed for Elysia/WS patterns
280
111
 
281
112
  ### Svelte 5
282
113
 
283
- Use runes. In `.svelte` files, `let` is only needed for mutable state:
114
+ Use runes. `let` for `$state`/`$bindable`; `const` for everything else.
284
115
 
285
116
  ```svelte
286
117
  <script lang="ts">
287
- // let — required for $state (mutable) and $bindable (two-way binding)
288
118
  let count = $state(0);
289
- let { value = $bindable('') }: Props = $props();
290
-
291
- // const — for $derived (read-only), $props (no bindable), functions, static values
292
119
  const doubled = $derived(count * 2);
293
- const { label, disabled }: Props = $props();
294
- const MAX_ITEMS = 100;
295
120
  const handleClick = () => count++;
296
121
  </script>
297
122
  ```
298
123
 
299
124
  ### Naming
300
125
 
301
- ```typescript
302
- // camelCase: variables, functions
303
- const userName = 'John';
304
-
305
- // PascalCase: classes, types
306
- class UserManager {}
307
-
308
- // UPPER_SNAKE_CASE: constants
309
- const MAX_RETRIES = 3;
310
-
311
- // kebab-case: files
312
- // user-manager.ts
313
- ```
126
+ - `camelCase` — variables, functions
127
+ - `PascalCase` — classes, types
128
+ - `UPPER_SNAKE_CASE` constants
129
+ - `kebab-case` — file names
314
130
 
315
131
  ### Logging
316
132
 
317
- Use `debug` module:
318
-
319
133
  ```typescript
320
134
  import { debug } from './utils/debug';
321
- debug.log('User logged in', { userId });
322
- ```
323
-
324
- ### Comments
325
-
326
- Explain WHY, not WHAT:
327
-
328
- ```typescript
329
- // Good
330
- // Retry 3 times because API is unreliable
331
- const maxRetries = 3;
332
-
333
- // Bad
334
- // Set retries to 3
335
- const maxRetries = 3;
135
+ debug.log('message', { data });
336
136
  ```
337
137
 
338
138
  ### Formatting
339
139
 
340
- - Tabs for indentation
341
- - Single quotes
342
- - Semicolons
343
- - No prettier — formatting is not enforced by tooling
344
-
345
- ---
346
-
347
- ## Found a Bug?
348
-
349
- ### Report
350
-
351
- 1. Search existing issues
352
- 2. Create new issue with template:
353
-
354
- ```markdown
355
- ## Description
356
- What's wrong?
357
-
358
- ## Steps
359
- 1. Step 1
360
- 2. Step 2
361
- 3. Error
362
-
363
- ## Expected vs Actual
364
- Expected: ...
365
- Actual: ...
366
-
367
- ## Environment
368
- - Clopen: `clopen --version`
369
- - Bun: `bun --version`
370
- - OS: Windows/Mac/Linux
371
- ```
372
-
373
- ### Fix
374
-
375
- ```bash
376
- git checkout -b fix/descriptive-name
377
- # Fix & test
378
- bun run check && bun run lint && bun run build
379
- git commit -m "fix: resolve issue #123"
380
- git push origin fix/descriptive-name
381
- # Create PR with "Fixes #123"
382
- ```
383
-
384
- ---
385
-
386
- ## Suggest Feature?
387
-
388
- ### Request
389
-
390
- 1. Check existing issues & roadmap
391
- 2. Create issue:
392
-
393
- ```markdown
394
- ## Feature
395
- What do you want?
396
-
397
- ## Problem
398
- What problem does this solve?
399
-
400
- ## Solution
401
- How should it work?
402
-
403
- ## Alternatives
404
- Other approaches?
405
- ```
406
-
407
- ### Implement
408
-
409
- ```bash
410
- # Get approval first, then:
411
- git checkout -b feature/descriptive-name
412
- # Implement & test
413
- bun run check && bun run lint && bun run build
414
- git commit -m "feat(scope): add feature"
415
- git push origin feature/descriptive-name
416
- # Create PR with "Closes #123"
417
- ```
140
+ Tabs, single quotes, semicolons. No prettier enforcement.
418
141
 
419
142
  ---
420
143
 
@@ -422,78 +145,40 @@ git push origin feature/descriptive-name
422
145
 
423
146
  ```bash
424
147
  bun run dev # Dev server
425
- bun run check # Type check (svelte-check)
426
- bun run lint # Lint (ESLint)
427
- bun run lint:fix # Auto-fix lint issues
148
+ bun run check # Type check
149
+ bun run lint # Lint
150
+ bun run lint:fix # Auto-fix lint
428
151
  bun run build # Build
429
- bun run start # Production server
430
152
  ```
431
153
 
432
154
  ---
433
155
 
434
156
  ## Troubleshooting
435
157
 
436
- ### Type Errors
437
-
438
158
  ```bash
439
- rm -rf node_modules bun.lockb
440
- bun install
441
- ```
159
+ # Type errors
160
+ rm -rf node_modules && bun install
442
161
 
443
- ### Lint Errors
444
-
445
- ```bash
162
+ # Lint errors
446
163
  bun run lint:fix
447
- ```
448
-
449
- ### Git Conflicts
450
-
451
- ```bash
452
- git fetch upstream
453
- git rebase upstream/main
454
- # Resolve conflicts
455
- git add .
456
- git rebase --continue
457
- ```
458
-
459
- ### Port in Use
460
164
 
461
- ```bash
462
- # Unix/Mac
463
- lsof -ti:9141 | xargs kill -9
464
-
465
- # Windows
466
- netstat -ano | findstr :9141
467
- taskkill /PID <PID> /F
165
+ # Git conflicts
166
+ git fetch upstream && git rebase upstream/main
468
167
  ```
469
168
 
470
169
  ---
471
170
 
472
171
  ## Resources
473
172
 
474
- - [TypeScript](https://www.typescriptlang.org/docs/)
475
- - [Svelte 5](https://svelte.dev/docs/svelte/overview)
476
- - [Bun](https://bun.sh/docs)
477
- - [Elysia](https://elysiajs.com/)
173
+ - [TypeScript Docs](https://www.typescriptlang.org/docs/)
174
+ - [Svelte 5 Docs](https://svelte.dev/docs/svelte/overview)
175
+ - [Bun Docs](https://bun.sh/docs)
176
+ - [Elysia Docs](https://elysiajs.com/)
478
177
  - [Conventional Commits](https://www.conventionalcommits.org/)
479
178
 
480
179
  ---
481
180
 
482
- ## Code of Conduct
483
-
484
- - Be respectful
485
- - Welcome newcomers
486
- - Focus on code, not person
487
- - Assume good intentions
488
- - Help others learn
489
-
490
- ---
491
-
492
181
  ## Questions?
493
182
 
494
183
  - [Issues](https://github.com/myrialabs/clopen/issues)
495
184
  - [Discussions](https://github.com/myrialabs/clopen/discussions)
496
-
497
- ---
498
-
499
- **Thank you for contributing!**