@mod-computer/cli 0.2.4 → 0.2.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.
- package/package.json +3 -3
- package/dist/app.js +0 -227
- package/dist/cli.bundle.js.map +0 -7
- package/dist/cli.js +0 -132
- package/dist/commands/add.js +0 -245
- package/dist/commands/agents-run.js +0 -71
- package/dist/commands/auth.js +0 -259
- package/dist/commands/branch.js +0 -1411
- package/dist/commands/claude-sync.js +0 -772
- package/dist/commands/comment.js +0 -568
- package/dist/commands/diff.js +0 -182
- package/dist/commands/index.js +0 -73
- package/dist/commands/init.js +0 -597
- package/dist/commands/ls.js +0 -135
- package/dist/commands/members.js +0 -687
- package/dist/commands/mv.js +0 -282
- package/dist/commands/recover.js +0 -207
- package/dist/commands/rm.js +0 -257
- package/dist/commands/spec.js +0 -386
- package/dist/commands/status.js +0 -296
- package/dist/commands/sync.js +0 -119
- package/dist/commands/trace.js +0 -1752
- package/dist/commands/workspace.js +0 -447
- package/dist/components/conflict-resolution-ui.js +0 -120
- package/dist/components/messages.js +0 -5
- package/dist/components/thread.js +0 -8
- package/dist/config/features.js +0 -83
- package/dist/containers/branches-container.js +0 -140
- package/dist/containers/directory-container.js +0 -92
- package/dist/containers/thread-container.js +0 -214
- package/dist/containers/threads-container.js +0 -27
- package/dist/containers/workspaces-container.js +0 -27
- package/dist/daemon/conflict-resolution.js +0 -172
- package/dist/daemon/content-hash.js +0 -31
- package/dist/daemon/file-sync.js +0 -985
- package/dist/daemon/index.js +0 -203
- package/dist/daemon/mime-types.js +0 -166
- package/dist/daemon/offline-queue.js +0 -211
- package/dist/daemon/path-utils.js +0 -64
- package/dist/daemon/share-policy.js +0 -83
- package/dist/daemon/wasm-errors.js +0 -189
- package/dist/daemon/worker.js +0 -557
- package/dist/daemon-worker.js +0 -258
- package/dist/errors/workspace-errors.js +0 -48
- package/dist/lib/auth-server.js +0 -216
- package/dist/lib/browser.js +0 -35
- package/dist/lib/diff.js +0 -284
- package/dist/lib/formatters.js +0 -204
- package/dist/lib/git.js +0 -137
- package/dist/lib/local-fs.js +0 -201
- package/dist/lib/prompts.js +0 -56
- package/dist/lib/storage.js +0 -213
- package/dist/lib/trace-formatters.js +0 -314
- package/dist/services/add-service.js +0 -554
- package/dist/services/add-validation.js +0 -124
- package/dist/services/automatic-file-tracker.js +0 -303
- package/dist/services/cli-orchestrator.js +0 -227
- package/dist/services/feature-flags.js +0 -187
- package/dist/services/file-import-service.js +0 -283
- package/dist/services/file-transformation-service.js +0 -218
- package/dist/services/logger.js +0 -44
- package/dist/services/mod-config.js +0 -67
- package/dist/services/modignore-service.js +0 -328
- package/dist/services/sync-daemon.js +0 -244
- package/dist/services/thread-notification-service.js +0 -50
- package/dist/services/thread-service.js +0 -147
- package/dist/stores/use-directory-store.js +0 -96
- package/dist/stores/use-threads-store.js +0 -46
- package/dist/stores/use-workspaces-store.js +0 -54
- package/dist/types/add-types.js +0 -99
- package/dist/types/config.js +0 -16
- package/dist/types/index.js +0 -2
- package/dist/types/workspace-connection.js +0 -53
- package/dist/types.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mod-computer/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mod": "dist/cli.bundle.js"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"package": "node build-for-docs.js"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"
|
|
21
|
+
"dist/cli.bundle.js",
|
|
22
|
+
"dist/config/release-profiles"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ai-sdk/anthropic": "2.0.0-beta.3",
|
package/dist/app.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Box, Text } from 'ink';
|
|
4
|
-
import TextInput from 'ink-text-input';
|
|
5
|
-
import WorkspacesContainer from './containers/workspaces-container.js';
|
|
6
|
-
import ThreadContainer from './containers/thread-container.js';
|
|
7
|
-
import DirectoryContainer from './containers/directory-container.js';
|
|
8
|
-
import BranchesContainer from './containers/branches-container.js';
|
|
9
|
-
import { useInput } from 'ink';
|
|
10
|
-
import { readModConfig, writeModConfig } from './services/mod-config.js';
|
|
11
|
-
// Removed legacy sync commands and services
|
|
12
|
-
import { BranchService } from '@mod/mod-core/services/branch-service';
|
|
13
|
-
import { getFeatureFlags, shouldEnableBackgroundWatch } from './services/feature-flags.js';
|
|
14
|
-
export default function App({ repo, featureFlags: providedFeatureFlags, }) {
|
|
15
|
-
const featureFlags = useMemo(() => providedFeatureFlags ?? getFeatureFlags(), [providedFeatureFlags]);
|
|
16
|
-
const tasksEnabled = featureFlags['tasks-panel'];
|
|
17
|
-
const directoryEnabled = featureFlags['directory-view'];
|
|
18
|
-
// Routing: 'workspaces' | 'thread' | 'directory' | 'branches' | 'tasks'
|
|
19
|
-
const [route, setRoute] = useState('workspaces');
|
|
20
|
-
const [selectedWorkspace, setSelectedWorkspace] = useState(null);
|
|
21
|
-
const [selectedThread, setSelectedThread] = useState(null);
|
|
22
|
-
const [inputValue, setInputValue] = useState('');
|
|
23
|
-
const [pendingChatInput, setPendingChatInput] = useState('');
|
|
24
|
-
// const watcherRef = useRef<FileWatcherService | null>(null); // Removed
|
|
25
|
-
const initialUploadDoneRef = useRef(false); // reserved (disabled)
|
|
26
|
-
// Keyboard shortcuts for navigation (only Esc to reset)
|
|
27
|
-
useInput((input, key) => {
|
|
28
|
-
if (key.escape) {
|
|
29
|
-
setRoute('workspaces');
|
|
30
|
-
setSelectedWorkspace(null);
|
|
31
|
-
setSelectedThread(null);
|
|
32
|
-
setInputValue('');
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
// Command prompt handler
|
|
36
|
-
const handleInputSubmit = (value) => {
|
|
37
|
-
const trimmed = value.trim();
|
|
38
|
-
if (trimmed === '/workspaces') {
|
|
39
|
-
setRoute('workspaces');
|
|
40
|
-
setSelectedWorkspace(null);
|
|
41
|
-
setSelectedThread(null);
|
|
42
|
-
}
|
|
43
|
-
else if ((trimmed === '/threads' || trimmed === '/branches') && selectedWorkspace) {
|
|
44
|
-
setRoute('branches');
|
|
45
|
-
setSelectedThread(null);
|
|
46
|
-
}
|
|
47
|
-
else if (trimmed === '/files' && directoryEnabled) {
|
|
48
|
-
setRoute('directory');
|
|
49
|
-
}
|
|
50
|
-
else if (trimmed === '/tasks' && tasksEnabled && selectedWorkspace) {
|
|
51
|
-
setRoute('tasks');
|
|
52
|
-
}
|
|
53
|
-
else if (trimmed === '/thread' && selectedWorkspace && selectedThread) {
|
|
54
|
-
setRoute('thread');
|
|
55
|
-
}
|
|
56
|
-
else if (trimmed === '/exit') {
|
|
57
|
-
process.exit(0);
|
|
58
|
-
}
|
|
59
|
-
else if (trimmed === '/upload') {
|
|
60
|
-
// Upload all files in current working directory to active workspace/thread
|
|
61
|
-
// uploadWorkspaceCommand([], repo).catch(err => console.error('[upload] Failed:', err)); // Removed
|
|
62
|
-
}
|
|
63
|
-
else if (trimmed === '/download') {
|
|
64
|
-
// Download all workspace files to current working directory
|
|
65
|
-
// downloadWorkspaceCommand([], repo).catch(err => console.error('[download] Failed:', err)); // Removed
|
|
66
|
-
}
|
|
67
|
-
else if (route === 'thread' && selectedThread) {
|
|
68
|
-
// Send message to thread
|
|
69
|
-
setPendingChatInput(value);
|
|
70
|
-
}
|
|
71
|
-
setInputValue('');
|
|
72
|
-
};
|
|
73
|
-
// Bootstrap: if .mod/config.json has workspace/branch, jump to thread view (branch-first)
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
let cancelled = false;
|
|
76
|
-
(async () => {
|
|
77
|
-
try {
|
|
78
|
-
const cfg = readModConfig();
|
|
79
|
-
if (!cfg?.workspaceId)
|
|
80
|
-
return;
|
|
81
|
-
const wsHandle = await repo.find(cfg.workspaceId);
|
|
82
|
-
const wsDoc = await wsHandle.doc();
|
|
83
|
-
// Branch-first: read branch.threadId
|
|
84
|
-
const activeBranchId = (cfg.activeBranchId || wsDoc?.activeBranchId);
|
|
85
|
-
let thread = null;
|
|
86
|
-
const branchesDocId = wsDoc?.branchesDocId;
|
|
87
|
-
if (activeBranchId && branchesDocId) {
|
|
88
|
-
try {
|
|
89
|
-
const branchService = new BranchService(repo);
|
|
90
|
-
const branch = await branchService.getBranch(activeBranchId, branchesDocId);
|
|
91
|
-
const tid = branch?.threadId;
|
|
92
|
-
if (tid) {
|
|
93
|
-
try {
|
|
94
|
-
const tHandle = await repo.find(tid);
|
|
95
|
-
const tDoc = await tHandle.doc();
|
|
96
|
-
thread = { id: tDoc?.id || tid, name: tDoc?.name || 'Thread' };
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
thread = { id: tid, name: 'Thread' };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch { }
|
|
104
|
-
}
|
|
105
|
-
// No implicit thread creation on startup; prefer fast load and let user pick
|
|
106
|
-
if (!cancelled) {
|
|
107
|
-
setSelectedWorkspace({ id: wsDoc.id, name: wsDoc.name });
|
|
108
|
-
if (thread) {
|
|
109
|
-
setSelectedThread(thread);
|
|
110
|
-
setRoute('thread');
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
setRoute('branches');
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch {
|
|
118
|
-
// ignore
|
|
119
|
-
}
|
|
120
|
-
})();
|
|
121
|
-
return () => { cancelled = true; };
|
|
122
|
-
}, [repo]);
|
|
123
|
-
// Background sync: start file watcher when workspace/thread are active (initial bulk upload disabled)
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
let cancelled = false;
|
|
126
|
-
(async () => {
|
|
127
|
-
try {
|
|
128
|
-
const workspaceId = selectedWorkspace?.id || readModConfig()?.workspaceId;
|
|
129
|
-
const threadId = selectedThread?.id;
|
|
130
|
-
if (!repo || !workspaceId || !threadId)
|
|
131
|
-
return;
|
|
132
|
-
const autoWatch = shouldEnableBackgroundWatch();
|
|
133
|
-
if (!autoWatch)
|
|
134
|
-
return;
|
|
135
|
-
// Initial bulk upload is intentionally disabled to avoid heavy concurrent writes
|
|
136
|
-
// File watching removed - using AutomaticFileTracker instead
|
|
137
|
-
/*
|
|
138
|
-
if (!watcherRef.current) {
|
|
139
|
-
try {
|
|
140
|
-
const watcher = new FileWatcherService(repo);
|
|
141
|
-
await watcher.startWatching({
|
|
142
|
-
workspaceId: workspaceId as any,
|
|
143
|
-
threadId: threadId as any,
|
|
144
|
-
watchDirectory: process.cwd(),
|
|
145
|
-
debounceMs: 300,
|
|
146
|
-
verbose: false,
|
|
147
|
-
});
|
|
148
|
-
if (!cancelled) watcherRef.current = watcher;
|
|
149
|
-
} catch (err) {
|
|
150
|
-
// Non-blocking
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
*/
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
// ignore
|
|
157
|
-
}
|
|
158
|
-
})();
|
|
159
|
-
return () => {
|
|
160
|
-
cancelled = true;
|
|
161
|
-
};
|
|
162
|
-
}, [repo, selectedWorkspace, selectedThread]);
|
|
163
|
-
let content = null;
|
|
164
|
-
if (route === 'workspaces') {
|
|
165
|
-
content = (_jsx(WorkspacesContainer, { repo: repo, onSelect: ws => {
|
|
166
|
-
setSelectedWorkspace(ws);
|
|
167
|
-
try {
|
|
168
|
-
writeModConfig({ workspaceId: ws.id });
|
|
169
|
-
}
|
|
170
|
-
catch { }
|
|
171
|
-
setRoute('branches');
|
|
172
|
-
} }));
|
|
173
|
-
}
|
|
174
|
-
else if (route === 'thread' && selectedWorkspace && selectedThread) {
|
|
175
|
-
content = (_jsx(ThreadContainer, { repo: repo, activeThread: selectedThread, workspace: selectedWorkspace, pendingChatInput: pendingChatInput, onChatInputHandled: () => setPendingChatInput(''), handleInputSubmit: handleInputSubmit }));
|
|
176
|
-
}
|
|
177
|
-
else if (route === 'branches' && selectedWorkspace) {
|
|
178
|
-
content = (_jsx(BranchesContainer, { repo: repo, workspace: selectedWorkspace, onSelect: async (thread) => {
|
|
179
|
-
setSelectedThread(thread);
|
|
180
|
-
setRoute('thread');
|
|
181
|
-
// Persist activeBranchId is handled inside BranchesContainer on select
|
|
182
|
-
// Legacy sync and watcher removed - using AutomaticFileTracker instead
|
|
183
|
-
/*
|
|
184
|
-
// Stop watcher while syncing
|
|
185
|
-
try { watcherRef.current?.stopWatching(); } catch {}
|
|
186
|
-
// Perform web -> local sync for the selected branch/thread
|
|
187
|
-
try {
|
|
188
|
-
const wsId = (selectedWorkspace as any).id;
|
|
189
|
-
const syncSvc = new WorkspaceSyncService(repo as any);
|
|
190
|
-
await syncSvc.syncWorkspaceFiles(wsId as any, (thread as any).id as any, { force: true, verbose: true });
|
|
191
|
-
} catch (err) {
|
|
192
|
-
console.error('[branches] Sync after selection failed:', err);
|
|
193
|
-
}
|
|
194
|
-
// Restart watcher on the selected thread
|
|
195
|
-
try {
|
|
196
|
-
const watcher = watcherRef.current || new FileWatcherService(repo);
|
|
197
|
-
await watcher.startWatching({
|
|
198
|
-
workspaceId: (selectedWorkspace as any).id as any,
|
|
199
|
-
threadId: (thread as any).id as any,
|
|
200
|
-
watchDirectory: process.cwd(),
|
|
201
|
-
debounceMs: 300,
|
|
202
|
-
verbose: false,
|
|
203
|
-
});
|
|
204
|
-
watcherRef.current = watcher;
|
|
205
|
-
} catch {}
|
|
206
|
-
*/
|
|
207
|
-
} }));
|
|
208
|
-
}
|
|
209
|
-
else if (route === 'tasks' && tasksEnabled && selectedWorkspace) {
|
|
210
|
-
content = ({ /* TasksContainer removed - legacy task management */});
|
|
211
|
-
}
|
|
212
|
-
else if (route === 'directory' && directoryEnabled) {
|
|
213
|
-
content = (_jsx(DirectoryContainer, { repo: repo, selectedWorkspace: selectedWorkspace, selectedThread: selectedThread }));
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
content = _jsx(Text, { children: "Unknown route." });
|
|
217
|
-
}
|
|
218
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { flexDirection: "column", flexGrow: 1, children: content }), _jsxs(Box, { borderStyle: "single", paddingX: 1, borderColor: "gray", children: [_jsxs(Text, { color: "gray", children: ['>', " "] }), _jsx(TextInput, { value: inputValue, onChange: setInputValue, onSubmit: handleInputSubmit, focus: true, showCursor: true, placeholder: `Type ${[
|
|
219
|
-
'/workspaces',
|
|
220
|
-
'/branches',
|
|
221
|
-
directoryEnabled ? '/files' : null,
|
|
222
|
-
tasksEnabled ? '/tasks' : null,
|
|
223
|
-
'/upload',
|
|
224
|
-
'/download',
|
|
225
|
-
'/exit',
|
|
226
|
-
].filter(Boolean).join(', ')}` })] })] }));
|
|
227
|
-
}
|