@mod-computer/cli 0.1.0 → 0.2.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.
Files changed (55) hide show
  1. package/README.md +72 -0
  2. package/dist/cli.bundle.js +24633 -13744
  3. package/dist/cli.bundle.js.map +4 -4
  4. package/dist/cli.js +23 -12
  5. package/dist/commands/add.js +245 -0
  6. package/dist/commands/auth.js +129 -21
  7. package/dist/commands/comment.js +568 -0
  8. package/dist/commands/diff.js +182 -0
  9. package/dist/commands/index.js +33 -3
  10. package/dist/commands/init.js +545 -326
  11. package/dist/commands/ls.js +135 -0
  12. package/dist/commands/members.js +687 -0
  13. package/dist/commands/mv.js +282 -0
  14. package/dist/commands/rm.js +257 -0
  15. package/dist/commands/status.js +273 -306
  16. package/dist/commands/sync.js +99 -75
  17. package/dist/commands/trace.js +1752 -0
  18. package/dist/commands/workspace.js +354 -330
  19. package/dist/config/features.js +8 -3
  20. package/dist/config/release-profiles/development.json +4 -1
  21. package/dist/config/release-profiles/mvp.json +4 -2
  22. package/dist/daemon/conflict-resolution.js +172 -0
  23. package/dist/daemon/content-hash.js +31 -0
  24. package/dist/daemon/file-sync.js +985 -0
  25. package/dist/daemon/index.js +203 -0
  26. package/dist/daemon/mime-types.js +166 -0
  27. package/dist/daemon/offline-queue.js +211 -0
  28. package/dist/daemon/path-utils.js +64 -0
  29. package/dist/daemon/share-policy.js +83 -0
  30. package/dist/daemon/wasm-errors.js +189 -0
  31. package/dist/daemon/worker.js +557 -0
  32. package/dist/daemon-worker.js +3 -2
  33. package/dist/errors/workspace-errors.js +48 -0
  34. package/dist/lib/auth-server.js +89 -26
  35. package/dist/lib/browser.js +1 -1
  36. package/dist/lib/diff.js +284 -0
  37. package/dist/lib/formatters.js +204 -0
  38. package/dist/lib/git.js +137 -0
  39. package/dist/lib/local-fs.js +201 -0
  40. package/dist/lib/prompts.js +56 -0
  41. package/dist/lib/storage.js +11 -1
  42. package/dist/lib/trace-formatters.js +314 -0
  43. package/dist/services/add-service.js +554 -0
  44. package/dist/services/add-validation.js +124 -0
  45. package/dist/services/mod-config.js +8 -2
  46. package/dist/services/modignore-service.js +2 -0
  47. package/dist/stores/use-workspaces-store.js +36 -14
  48. package/dist/types/add-types.js +99 -0
  49. package/dist/types/config.js +1 -1
  50. package/dist/types/workspace-connection.js +53 -2
  51. package/package.json +7 -5
  52. package/commands/execute.md +0 -156
  53. package/commands/overview.md +0 -233
  54. package/commands/review.md +0 -151
  55. package/commands/spec.md +0 -169
package/README.md CHANGED
@@ -22,6 +22,8 @@ mod-cli bridges local and collaborative workflows. It syncs the local filesystem
22
22
 
23
23
  **Merge**: Combine branches by merging their changes. Mod detects conflicts at the file level and surfaces them for resolution. Metadata (comments, traces) merges automatically. After merge, the target branch contains changes from both branches with full history preserved.
24
24
 
25
+ **Deployment**: Automatic change tracking doesn't mean automatic deployment. Changes sync continuously, but deployment is an explicit action. When ready to deploy, push to git to trigger CI/CD pipelines. Mod handles real-time sync and versioning; git remains the deployment coordination point. This separation lets teams collaborate freely without worrying that every edit triggers a deploy. Work continuously, deploy intentionally.
26
+
25
27
  **Git Integration**: In git repositories, sync respects git branch scope. Changes on a git branch sync to the corresponding Mod branch. Switching git branches switches sync context automatically. For non-git directories, Mod branches work independently. The CLI integrates with git workflows but doesn't require git.
26
28
 
27
29
  **Metadata Layer**: Workspaces and files carry metadata: comments, notes, and traces. The CLI provides commands to read and write metadata locally. Agents can query file context before making changes and write traces linking code to requirements. Teams see the same metadata in the web app. This shared context layer makes agent reasoning visible and lets teams annotate code without changing source files.
@@ -110,6 +112,76 @@ pnpm dev # Watch mode
110
112
  pnpm test # Run tests
111
113
  ```
112
114
 
115
+ ## Local Testing with Dev Mode
116
+
117
+ For testing cross-client workspace syncing on localhost without OAuth, use dev mode authentication:
118
+
119
+ ### Prerequisites
120
+
121
+ 1. **Start the sync server**:
122
+ ```bash
123
+ cd packages/mod-sync-server
124
+ node src/server.js
125
+ # Server runs on ws://localhost:3030
126
+ ```
127
+
128
+ 2. **Start the web app** (in another terminal):
129
+ ```bash
130
+ cd packages/mod-app-new
131
+ pnpm dev
132
+ # App runs on http://localhost:3000
133
+ # Dev mode automatically enabled (no VITE_MOD_AUTH_URL needed)
134
+ ```
135
+
136
+ ### Testing Workflow
137
+
138
+ 1. **Login with dev mode**:
139
+ ```bash
140
+ AUTOMERGE_WS_URL=ws://localhost:3030 mod auth login --dev
141
+ ```
142
+ This creates a local `dev@localhost` user shared between CLI and web app.
143
+
144
+ 2. **Connect a workspace**:
145
+ ```bash
146
+ cd /path/to/your/project
147
+ AUTOMERGE_WS_URL=ws://localhost:3030 mod init
148
+ ```
149
+ Select or create a workspace. The workspace connects to your local directory.
150
+
151
+ 3. **Register workspaces to your user**:
152
+ ```bash
153
+ AUTOMERGE_WS_URL=ws://localhost:3030 mod workspace register
154
+ ```
155
+ This adds all connected workspaces to your user's workspace list, making them visible in the web app.
156
+
157
+ 4. **View in web app**:
158
+ - Open `http://localhost:3000` in your browser
159
+ - Refresh the page to see your workspaces
160
+ - Both CLI and web app share the same `dev@localhost` user document
161
+ - Changes sync via `ws://localhost:3030`
162
+
163
+ ### Verification
164
+
165
+ Check authentication status:
166
+ ```bash
167
+ AUTOMERGE_WS_URL=ws://localhost:3030 mod auth status
168
+ ```
169
+
170
+ List connected workspaces:
171
+ ```bash
172
+ AUTOMERGE_WS_URL=ws://localhost:3030 mod workspace list
173
+ ```
174
+
175
+ View sync diagnostics at `http://localhost:3000/debug/sync` to see tracked documents and sync state.
176
+
177
+ ### Notes
178
+
179
+ - Dev mode uses a shared `dev@localhost` user across CLI and web app
180
+ - No OAuth required - authentication happens locally
181
+ - User document ID is stored in `~/.mod/config`
182
+ - Both clients must connect to the same sync server (`ws://localhost:3030`)
183
+ - Run `mod workspace register` after creating new workspaces to sync them to the web app
184
+
113
185
  ## Thoughts
114
186
 
115
187
  **Daemon architecture**: The sync daemon runs as a background process rather than requiring an active terminal. This lets developers work normally while sync happens invisibly. The daemon writes logs to `~/.mod/logs/sync.log` for debugging.