@mod-computer/cli 0.2.3 → 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.
Files changed (75) hide show
  1. package/dist/cli.bundle.js +216 -36371
  2. package/package.json +3 -3
  3. package/dist/app.js +0 -227
  4. package/dist/cli.bundle.js.map +0 -7
  5. package/dist/cli.js +0 -132
  6. package/dist/commands/add.js +0 -245
  7. package/dist/commands/agents-run.js +0 -71
  8. package/dist/commands/auth.js +0 -259
  9. package/dist/commands/branch.js +0 -1411
  10. package/dist/commands/claude-sync.js +0 -772
  11. package/dist/commands/comment.js +0 -568
  12. package/dist/commands/diff.js +0 -182
  13. package/dist/commands/index.js +0 -73
  14. package/dist/commands/init.js +0 -597
  15. package/dist/commands/ls.js +0 -135
  16. package/dist/commands/members.js +0 -687
  17. package/dist/commands/mv.js +0 -282
  18. package/dist/commands/recover.js +0 -207
  19. package/dist/commands/rm.js +0 -257
  20. package/dist/commands/spec.js +0 -386
  21. package/dist/commands/status.js +0 -296
  22. package/dist/commands/sync.js +0 -119
  23. package/dist/commands/trace.js +0 -1752
  24. package/dist/commands/workspace.js +0 -447
  25. package/dist/components/conflict-resolution-ui.js +0 -120
  26. package/dist/components/messages.js +0 -5
  27. package/dist/components/thread.js +0 -8
  28. package/dist/config/features.js +0 -83
  29. package/dist/containers/branches-container.js +0 -140
  30. package/dist/containers/directory-container.js +0 -92
  31. package/dist/containers/thread-container.js +0 -214
  32. package/dist/containers/threads-container.js +0 -27
  33. package/dist/containers/workspaces-container.js +0 -27
  34. package/dist/daemon/conflict-resolution.js +0 -172
  35. package/dist/daemon/content-hash.js +0 -31
  36. package/dist/daemon/file-sync.js +0 -985
  37. package/dist/daemon/index.js +0 -203
  38. package/dist/daemon/mime-types.js +0 -166
  39. package/dist/daemon/offline-queue.js +0 -211
  40. package/dist/daemon/path-utils.js +0 -64
  41. package/dist/daemon/share-policy.js +0 -83
  42. package/dist/daemon/wasm-errors.js +0 -189
  43. package/dist/daemon/worker.js +0 -557
  44. package/dist/daemon-worker.js +0 -258
  45. package/dist/errors/workspace-errors.js +0 -48
  46. package/dist/lib/auth-server.js +0 -216
  47. package/dist/lib/browser.js +0 -35
  48. package/dist/lib/diff.js +0 -284
  49. package/dist/lib/formatters.js +0 -204
  50. package/dist/lib/git.js +0 -137
  51. package/dist/lib/local-fs.js +0 -201
  52. package/dist/lib/prompts.js +0 -56
  53. package/dist/lib/storage.js +0 -213
  54. package/dist/lib/trace-formatters.js +0 -314
  55. package/dist/services/add-service.js +0 -554
  56. package/dist/services/add-validation.js +0 -124
  57. package/dist/services/automatic-file-tracker.js +0 -303
  58. package/dist/services/cli-orchestrator.js +0 -227
  59. package/dist/services/feature-flags.js +0 -187
  60. package/dist/services/file-import-service.js +0 -283
  61. package/dist/services/file-transformation-service.js +0 -218
  62. package/dist/services/logger.js +0 -44
  63. package/dist/services/mod-config.js +0 -67
  64. package/dist/services/modignore-service.js +0 -328
  65. package/dist/services/sync-daemon.js +0 -244
  66. package/dist/services/thread-notification-service.js +0 -50
  67. package/dist/services/thread-service.js +0 -147
  68. package/dist/stores/use-directory-store.js +0 -96
  69. package/dist/stores/use-threads-store.js +0 -46
  70. package/dist/stores/use-workspaces-store.js +0 -54
  71. package/dist/types/add-types.js +0 -99
  72. package/dist/types/config.js +0 -16
  73. package/dist/types/index.js +0 -2
  74. package/dist/types/workspace-connection.js +0 -53
  75. package/dist/types.js +0 -1
@@ -1,135 +0,0 @@
1
- // glassware[type="implementation", id="impl-cli-ls-cmd--05e6cad6", requirements="requirement-cli-ls-cmd--1dc1eaa1,requirement-cli-ls-requires-workspace--e869d236,requirement-cli-ls-filter-path--52fa1bda,requirement-cli-ls-filter-type--5c9fe146,requirement-cli-ls-filter-pattern--4cec491f"]
2
- // spec: packages/mod-cli/specs/file-directory.md
3
- import { createModWorkspace } from '@mod/mod-core';
4
- import { readWorkspaceConnection } from '../lib/storage.js';
5
- import { formatFileTable, formatFileTree, formatFileJson, formatFilePaths, formatFileLong, getMimeCategory, } from '../lib/formatters.js';
6
- import { matchGlob } from '../lib/local-fs.js';
7
- // glassware[type="implementation", id="impl-cli-ls-requires-workspace--0d390a0f", requirements="requirement-cli-ls-requires-workspace--e869d236,requirement-cli-fd-error-no-workspace--1919b4fb"]
8
- function requireWorkspaceConnection() {
9
- const currentDir = process.cwd();
10
- const connection = readWorkspaceConnection(currentDir);
11
- if (!connection) {
12
- console.error('Error: Not connected to a workspace.');
13
- console.error('Run `mod init` to connect this directory first.');
14
- process.exit(1);
15
- }
16
- return {
17
- workspaceId: connection.workspaceId,
18
- workspaceName: connection.workspaceName,
19
- };
20
- }
21
- function parseArgs(args) {
22
- const options = {
23
- tree: false,
24
- json: false,
25
- long: false,
26
- quiet: false,
27
- };
28
- let path;
29
- for (let i = 0; i < args.length; i++) {
30
- const arg = args[i];
31
- if (arg === '--tree' || arg === '-t') {
32
- options.tree = true;
33
- }
34
- else if (arg === '--json') {
35
- options.json = true;
36
- }
37
- else if (arg === '--long' || arg === '-l') {
38
- options.long = true;
39
- }
40
- else if (arg === '--quiet' || arg === '-q') {
41
- options.quiet = true;
42
- }
43
- else if (arg === '--type' && args[i + 1]) {
44
- const typeArg = args[i + 1];
45
- if (typeArg === 'code' || typeArg === 'text' || typeArg === 'data') {
46
- options.type = typeArg;
47
- }
48
- i++;
49
- }
50
- else if (arg.startsWith('--type=')) {
51
- const typeArg = arg.slice('--type='.length);
52
- if (typeArg === 'code' || typeArg === 'text' || typeArg === 'data') {
53
- options.type = typeArg;
54
- }
55
- }
56
- else if (arg === '--pattern' && args[i + 1]) {
57
- options.pattern = args[i + 1];
58
- i++;
59
- }
60
- else if (arg.startsWith('--pattern=')) {
61
- options.pattern = arg.slice('--pattern='.length);
62
- }
63
- else if (!arg.startsWith('-') && !path) {
64
- path = arg;
65
- }
66
- }
67
- return { path, options };
68
- }
69
- // glassware[type="implementation", id="impl-cli-ls-filter-path--39b6a8c6", requirements="requirement-cli-ls-filter-path--52fa1bda"]
70
- function filterByPath(files, pathFilter) {
71
- const normalizedFilter = pathFilter.replace(/\/$/, ''); // Remove trailing slash
72
- return files.filter(f => f.path.startsWith(normalizedFilter + '/') || f.path === normalizedFilter);
73
- }
74
- // glassware[type="implementation", id="impl-cli-ls-filter-type--45ec4f4a", requirements="requirement-cli-ls-filter-type--5c9fe146"]
75
- function filterByType(files, type) {
76
- return files.filter(f => getMimeCategory(f.mimeType) === type);
77
- }
78
- // glassware[type="implementation", id="impl-cli-ls-filter-pattern--d891ebe5", requirements="requirement-cli-ls-filter-pattern--4cec491f"]
79
- function filterByPattern(files, pattern) {
80
- return files.filter(f => matchGlob(f.path, pattern));
81
- }
82
- export async function lsCommand(args, repo) {
83
- const { workspaceId } = requireWorkspaceConnection();
84
- const { path: pathFilter, options } = parseArgs(args);
85
- try {
86
- const modWorkspace = createModWorkspace(repo);
87
- const workspaceHandle = await modWorkspace.openWorkspace(workspaceId);
88
- // Fetch all files
89
- const fileRefs = await workspaceHandle.file.list();
90
- // Convert to FileInfo
91
- let files = fileRefs.map(ref => ({
92
- id: ref.id,
93
- path: ref.metadata?.path || ref.name,
94
- name: ref.name,
95
- size: ref.size,
96
- mimeType: ref.mimeType,
97
- updatedAt: ref.updatedAt,
98
- folderId: ref.folderId,
99
- }));
100
- // Apply filters
101
- if (pathFilter) {
102
- files = filterByPath(files, pathFilter);
103
- }
104
- if (options.type) {
105
- files = filterByType(files, options.type);
106
- }
107
- if (options.pattern) {
108
- files = filterByPattern(files, options.pattern);
109
- }
110
- // Sort by path
111
- files.sort((a, b) => a.path.localeCompare(b.path));
112
- // Format output
113
- let output;
114
- if (options.json) {
115
- output = formatFileJson(files);
116
- }
117
- else if (options.tree) {
118
- output = formatFileTree(files);
119
- }
120
- else if (options.quiet) {
121
- output = formatFilePaths(files);
122
- }
123
- else if (options.long) {
124
- output = formatFileLong(files);
125
- }
126
- else {
127
- output = formatFileTable(files);
128
- }
129
- console.log(output);
130
- }
131
- catch (error) {
132
- console.error('Error listing files:', error.message);
133
- process.exit(1);
134
- }
135
- }