undoai 0.1.0-beta.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 (46) hide show
  1. package/README.md +243 -0
  2. package/dist/cli/commands/restore.d.ts +11 -0
  3. package/dist/cli/commands/restore.d.ts.map +1 -0
  4. package/dist/cli/commands/restore.js +188 -0
  5. package/dist/cli/commands/restore.js.map +1 -0
  6. package/dist/cli/commands/status.d.ts +5 -0
  7. package/dist/cli/commands/status.d.ts.map +1 -0
  8. package/dist/cli/commands/status.js +46 -0
  9. package/dist/cli/commands/status.js.map +1 -0
  10. package/dist/cli/commands/stop.d.ts +5 -0
  11. package/dist/cli/commands/stop.d.ts.map +1 -0
  12. package/dist/cli/commands/stop.js +21 -0
  13. package/dist/cli/commands/stop.js.map +1 -0
  14. package/dist/cli/commands/watch.d.ts +5 -0
  15. package/dist/cli/commands/watch.d.ts.map +1 -0
  16. package/dist/cli/commands/watch.js +138 -0
  17. package/dist/cli/commands/watch.js.map +1 -0
  18. package/dist/cli/index.d.ts +3 -0
  19. package/dist/cli/index.d.ts.map +1 -0
  20. package/dist/cli/index.js +45 -0
  21. package/dist/cli/index.js.map +1 -0
  22. package/dist/core/daemon.d.ts +35 -0
  23. package/dist/core/daemon.d.ts.map +1 -0
  24. package/dist/core/daemon.js +94 -0
  25. package/dist/core/daemon.js.map +1 -0
  26. package/dist/core/snapshot.d.ts +39 -0
  27. package/dist/core/snapshot.d.ts.map +1 -0
  28. package/dist/core/snapshot.js +119 -0
  29. package/dist/core/snapshot.js.map +1 -0
  30. package/dist/core/storage.d.ts +92 -0
  31. package/dist/core/storage.d.ts.map +1 -0
  32. package/dist/core/storage.js +198 -0
  33. package/dist/core/storage.js.map +1 -0
  34. package/dist/example.d.ts +2 -0
  35. package/dist/example.d.ts.map +1 -0
  36. package/dist/example.js +30 -0
  37. package/dist/example.js.map +1 -0
  38. package/dist/utils/logger.d.ts +42 -0
  39. package/dist/utils/logger.d.ts.map +1 -0
  40. package/dist/utils/logger.js +61 -0
  41. package/dist/utils/logger.js.map +1 -0
  42. package/dist/watcher.d.ts +55 -0
  43. package/dist/watcher.d.ts.map +1 -0
  44. package/dist/watcher.js +122 -0
  45. package/dist/watcher.js.map +1 -0
  46. package/package.json +59 -0
package/README.md ADDED
@@ -0,0 +1,243 @@
1
+ # undoai
2
+
3
+ **Free, local undo button for AI coding**
4
+
5
+ A zero-friction CLI tool that automatically creates snapshots when AI tools modify your code, allowing instant rollback when things break. Like [mrq](https://getmrq.com), but 100% free, open-source, and local.
6
+
7
+ ## 🎯 Why undoai?
8
+
9
+ AI coding assistants (Cursor, Claude, Copilot) are powerful but can break working code. When AI modifies 5+ files at once and something breaks, you need an instant undo button.
10
+
11
+ **undoai** solves this by:
12
+ - 🔒 **100% Local & Private** - Your code never leaves your machine
13
+ - 📸 **Auto-Snapshots** - Detects AI burst changes (≥5 files) automatically
14
+ - ⚡ **Instant Restore** - One command to rollback all changes
15
+ - 💰 **Free Forever** - No accounts, no cloud, no subscriptions
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ```bash
20
+ # Install dependencies
21
+ pnpm install
22
+
23
+ # Build the project
24
+ pnpm build
25
+
26
+ # Start watching for changes
27
+ node dist/cli/index.js watch
28
+
29
+ # (In another terminal) Trigger AI changes...
30
+ # When AI breaks something:
31
+ node dist/cli/index.js restore
32
+ ```
33
+
34
+ ## 📦 Installation
35
+
36
+ ### From Source
37
+
38
+ ```bash
39
+ git clone <your-repo-url>
40
+ cd undoai
41
+ pnpm install
42
+ pnpm build
43
+ ```
44
+
45
+ ### Install Globally (Optional)
46
+
47
+ ```bash
48
+ pnpm link --global
49
+
50
+ # Now you can use 'undoai' anywhere
51
+ undoai watch
52
+ ```
53
+
54
+ ## 💻 Commands
55
+
56
+ ### `undoai watch`
57
+ Start watching for file changes in current directory.
58
+
59
+ ```bash
60
+ undoai watch
61
+ ```
62
+
63
+ **What it does:**
64
+ - Monitors all files in current directory
65
+ - Ignores `node_modules`, `.git`, `dist`, `build`
66
+ - Auto-creates snapshot when ≥5 files change within 2 seconds
67
+ - Runs in foreground (Press Ctrl+C to stop)
68
+
69
+ **Example output:**
70
+ ```
71
+ ✅ undoai is now watching
72
+ 📁 Project: /home/user/my-project
73
+ 💾 Storage: /home/user/.undoai
74
+ 🔒 100% local - your code never leaves this machine
75
+
76
+ ℹ️ Watching for file changes... (Press Ctrl+C to stop)
77
+
78
+ 📝 [change] src/auth.ts
79
+ 📝 [change] src/db.ts
80
+ 📝 [add] src/new-feature.ts
81
+ 📝 [change] package.json
82
+ 📝 [change] README.md
83
+ 📸 Snapshot saved (5 files changed)
84
+ ```
85
+
86
+ ---
87
+
88
+ ### `undoai restore`
89
+ Restore files from a snapshot (interactive).
90
+
91
+ ```bash
92
+ undoai restore
93
+ ```
94
+
95
+ **What it does:**
96
+ - Shows list of available snapshots
97
+ - Displays relative time and file count
98
+ - Confirms before restoring
99
+ - Overwrites current files with snapshot contents
100
+
101
+ **Example output:**
102
+ ```
103
+ ℹ️ Available snapshots:
104
+
105
+ ? Which snapshot do you want to restore? (Use arrow keys)
106
+ ❯ 1. [2 mins ago] 5 files 🤖 AI
107
+ 2. [15 mins ago] 8 files 🤖 AI
108
+ 3. [1 hour ago] 3 files 🤖 AI
109
+ ❌ Cancel
110
+
111
+ ✅ Restored 5 files
112
+ From: 2 mins ago
113
+ ```
114
+
115
+ ---
116
+
117
+ ### `undoai status`
118
+ Show current status and info.
119
+
120
+ ```bash
121
+ undoai status
122
+ ```
123
+
124
+ **Example output:**
125
+ ```
126
+ undoai Status
127
+
128
+ 🟢 Running (PID: 12345)
129
+
130
+ 💾 Storage:
131
+ Location: /home/user/.undoai
132
+ Snapshots: 3
133
+ Size: 24.5 KB
134
+
135
+ 📝 Commands:
136
+ undoai watch - Start watching
137
+ undoai restore - Restore snapshot
138
+ undoai stop - Stop watching
139
+ undoai status - Show this status
140
+ ```
141
+
142
+ ---
143
+
144
+ ### `undoai stop`
145
+ Stop the watching daemon.
146
+
147
+ ```bash
148
+ undoai stop
149
+ ```
150
+
151
+ ## 🏗️ How It Works
152
+
153
+ ### Architecture
154
+
155
+ ```
156
+ undoai/
157
+ ├── src/
158
+ │ ├── watcher.ts # File watching with chokidar
159
+ │ ├── core/
160
+ │ │ ├── storage.ts # Local file storage (~/.undoai)
161
+ │ │ ├── snapshot.ts # Snapshot creation & restore
162
+ │ │ └── daemon.ts # Process management
163
+ │ ├── cli/
164
+ │ │ ├── index.ts # CLI entry point
165
+ │ │ └── commands/ # watch, restore, stop, status
166
+ │ └── utils/
167
+ │ └── logger.ts # Pretty console output
168
+ ```
169
+
170
+ ### Storage Structure
171
+
172
+ ```
173
+ ~/.undoai/
174
+ ├── daemon.pid # PID of running watcher
175
+ └── snapshots/
176
+ ├── 1703265420000/ # Timestamp-based ID
177
+ │ ├── metadata.json # Snapshot info
178
+ │ └── files/ # Copied files
179
+ │ ├── src__auth.ts
180
+ │ ├── src__db.ts
181
+ │ └── ...
182
+ └── 1703265480000/
183
+ └── ...
184
+ ```
185
+
186
+ **metadata.json:**
187
+ ```json
188
+ {
189
+ "timestamp": 1703265420000,
190
+ "date": "2024-12-22T14:30:20.000Z",
191
+ "projectRoot": "/home/user/my-project",
192
+ "changedFiles": [
193
+ "/home/user/my-project/src/auth.ts",
194
+ "/home/user/my-project/src/db.ts"
195
+ ],
196
+ "fileCount": 5,
197
+ "label": "AI_BURST"
198
+ }
199
+ ```
200
+
201
+ ### Burst Detection
202
+
203
+ 1. File watcher detects changes
204
+ 2. Buffers changes in a Set (prevents duplicates)
205
+ 3. Debounces for 2 seconds
206
+ 4. If ≥5 files changed → create snapshot
207
+ 5. Snapshot contains: metadata + file copies
208
+
209
+ ## 🆚 undoai vs Alternatives
210
+
211
+ | Feature | Git Stash | mrq | **undoai** |
212
+ |---------|-----------|-----|------------|
213
+ | **Cost** | Free | $15-50/mo | ✅ **Free** |
214
+ | **Privacy** | Local | Cloud (encrypted) | ✅ **100% Local** |
215
+ | **Automatic** | ❌ Manual | ✅ Auto | ✅ **Auto** |
216
+ | **Offline** | ✅ Yes | ❌ No | ✅ **Yes** |
217
+ | **Setup** | Complex | Account required | ✅ **Zero config** |
218
+ | **Open Source** | Yes | ❌ No | ✅ **MIT** |
219
+
220
+
221
+ ## ❓ FAQ
222
+
223
+ **Q: How is this different from git?**
224
+ A: Git requires manual commits and is polluted by intermediate snapshots. undoai is automatic and keeps snapshots separate from your git history.
225
+
226
+ **Q: Does this replace git?**
227
+ A: No! undoai complements git. Use git for version control, undoai for instant AI change rollback.
228
+
229
+ **Q: Where are snapshots stored?**
230
+ A: In `~/.undoai/snapshots/` on your local machine. Never sent to cloud.
231
+
232
+ **Q: How much disk space does it use?**
233
+ A: Each snapshot contains only changed files. Typical snapshot: 10-100KB. Use `undoai status` to check.
234
+
235
+ **Q: Can I use this with Cursor/Claude/Copilot?**
236
+ A: Yes! Works with any AI coding tool that modifies files.
237
+
238
+ **Q: What if I want to clean up old snapshots?**
239
+ A: Currently manual: `rm -rf ~/.undoai/snapshots/<snapshot-id>`. Auto-cleanup coming in Phase 2.
240
+
241
+ ---
242
+
243
+ **Made with ❤️ for developers who love AI coding but hate breaking changes**
@@ -0,0 +1,11 @@
1
+ interface RestoreOptions {
2
+ interactive?: boolean;
3
+ files?: string;
4
+ pattern?: string;
5
+ }
6
+ /**
7
+ * Restore command - restore files from a snapshot
8
+ */
9
+ export declare function restoreCommand(options?: RestoreOptions): Promise<void>;
10
+ export {};
11
+ //# sourceMappingURL=restore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/restore.ts"],"names":[],"mappings":"AAyBA,UAAU,cAAc;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2LhF"}
@@ -0,0 +1,188 @@
1
+ import inquirer from 'inquirer';
2
+ import { SnapshotManager } from '../../core/snapshot.js';
3
+ import { Storage } from '../../core/storage.js';
4
+ import { Logger } from '../../utils/logger.js';
5
+ import path from 'path';
6
+ import { minimatch } from 'minimatch';
7
+ /**
8
+ * Format relative time
9
+ */
10
+ function formatRelativeTime(timestamp) {
11
+ const now = Date.now();
12
+ const diff = now - timestamp;
13
+ const seconds = Math.floor(diff / 1000);
14
+ const minutes = Math.floor(seconds / 60);
15
+ const hours = Math.floor(minutes / 60);
16
+ const days = Math.floor(hours / 24);
17
+ if (days > 0)
18
+ return `${days} day${days > 1 ? 's' : ''} ago`;
19
+ if (hours > 0)
20
+ return `${hours} hour${hours > 1 ? 's' : ''} ago`;
21
+ if (minutes > 0)
22
+ return `${minutes} min${minutes > 1 ? 's' : ''} ago`;
23
+ return 'just now';
24
+ }
25
+ /**
26
+ * Restore command - restore files from a snapshot
27
+ */
28
+ export async function restoreCommand(options = {}) {
29
+ // Initialize storage if needed
30
+ if (!Storage.isInitialized()) {
31
+ Logger.error('No snapshots found. Start watching with "undoai watch" first.');
32
+ process.exit(1);
33
+ }
34
+ // Get current directory
35
+ const projectRoot = process.cwd();
36
+ const snapshotManager = new SnapshotManager(projectRoot);
37
+ // List available snapshots
38
+ const snapshots = snapshotManager.listSnapshots();
39
+ // Filter out empty snapshots (snapshots with 0 files)
40
+ const validSnapshots = snapshots.filter(s => s.metadata.fileCount > 0);
41
+ if (validSnapshots.length === 0) {
42
+ Logger.error('No snapshots available');
43
+ Logger.info('Start watching with "undoai watch" to create snapshots');
44
+ process.exit(1);
45
+ }
46
+ console.log('');
47
+ Logger.info('Available snapshots:');
48
+ console.log('');
49
+ // Create choices for inquirer
50
+ const choices = validSnapshots.map((snapshot, index) => {
51
+ const { id, metadata } = snapshot;
52
+ const relativeTime = formatRelativeTime(metadata.timestamp);
53
+ const label = metadata.label === 'AI_BURST' ? '🤖 AI' : '📝 Auto';
54
+ return {
55
+ name: `${index + 1}. [${relativeTime}] ${metadata.fileCount} file${metadata.fileCount > 1 ? 's' : ''} ${label}`,
56
+ value: id,
57
+ short: `Snapshot ${index + 1}`,
58
+ };
59
+ });
60
+ // Add cancel option
61
+ choices.push({
62
+ name: '❌ Cancel',
63
+ value: 'CANCEL',
64
+ short: 'Cancel',
65
+ });
66
+ // Prompt user to select snapshot
67
+ const { snapshotId } = await inquirer.prompt([
68
+ {
69
+ type: 'list',
70
+ name: 'snapshotId',
71
+ message: 'Which snapshot do you want to restore?',
72
+ choices,
73
+ pageSize: 10,
74
+ },
75
+ ]);
76
+ if (snapshotId === 'CANCEL') {
77
+ Logger.info('Restore cancelled');
78
+ process.exit(0);
79
+ }
80
+ // Get snapshot details
81
+ const snapshot = snapshotManager.getSnapshot(snapshotId);
82
+ if (!snapshot) {
83
+ Logger.error('Snapshot not found');
84
+ process.exit(1);
85
+ }
86
+ // Determine which files to restore
87
+ let filesToRestore = snapshot.metadata.changedFiles;
88
+ // FEATURE: Pattern-based filtering
89
+ if (options.files) {
90
+ const fileList = options.files.split(',').map(f => f.trim());
91
+ filesToRestore = filesToRestore.filter((file) => fileList.some(pattern => minimatch(file, pattern)));
92
+ if (filesToRestore.length === 0) {
93
+ Logger.error('No files match the specified pattern');
94
+ process.exit(1);
95
+ }
96
+ console.log('');
97
+ Logger.info(`Matched ${filesToRestore.length} files from pattern`);
98
+ }
99
+ // FEATURE: Interactive file selection
100
+ if (options.interactive) {
101
+ console.log('');
102
+ Logger.info('Select files to restore:');
103
+ console.log('');
104
+ const fileChoices = filesToRestore.map((file) => {
105
+ const relativePath = path.relative(projectRoot, file);
106
+ return {
107
+ name: relativePath,
108
+ value: file,
109
+ checked: false, // Default unchecked
110
+ };
111
+ });
112
+ const { selectedFiles } = await inquirer.prompt([
113
+ {
114
+ type: 'checkbox',
115
+ name: 'selectedFiles',
116
+ message: 'Select files (Space to select, Enter to confirm):',
117
+ choices: fileChoices,
118
+ pageSize: 15,
119
+ validate: (answer) => {
120
+ if (answer.length === 0) {
121
+ return 'You must select at least one file';
122
+ }
123
+ return true;
124
+ },
125
+ },
126
+ ]);
127
+ filesToRestore = selectedFiles;
128
+ if (filesToRestore.length === 0) {
129
+ Logger.info('No files selected');
130
+ process.exit(0);
131
+ }
132
+ }
133
+ // Show preview of what will be restored
134
+ console.log('');
135
+ Logger.info(`📋 Preview: ${filesToRestore.length} file${filesToRestore.length > 1 ? 's' : ''} will be restored`);
136
+ console.log('');
137
+ filesToRestore.slice(0, 10).forEach((file) => {
138
+ const relativePath = path.relative(projectRoot, file);
139
+ console.log(` ✏️ ${relativePath}`);
140
+ });
141
+ if (filesToRestore.length > 10) {
142
+ console.log(` ... and ${filesToRestore.length - 10} more`);
143
+ }
144
+ console.log('');
145
+ Logger.warn('⚠️ Current changes to these files will be overwritten');
146
+ // Confirm
147
+ const { confirm } = await inquirer.prompt([
148
+ {
149
+ type: 'confirm',
150
+ name: 'confirm',
151
+ message: 'Continue with restore?',
152
+ default: true,
153
+ },
154
+ ]);
155
+ if (!confirm) {
156
+ Logger.info('Restore cancelled');
157
+ process.exit(0);
158
+ }
159
+ // Restore snapshot (selective or full)
160
+ try {
161
+ let restoredCount = 0;
162
+ if (options.interactive || options.files) {
163
+ // Selective restore
164
+ for (const file of filesToRestore) {
165
+ try {
166
+ Storage.restoreFileFromSnapshot(file, snapshotId, projectRoot);
167
+ restoredCount++;
168
+ }
169
+ catch (error) {
170
+ Logger.warn(`Failed to restore ${file}: ${error}`);
171
+ }
172
+ }
173
+ }
174
+ else {
175
+ // Full restore
176
+ restoredCount = snapshotManager.restoreSnapshot(snapshotId);
177
+ }
178
+ console.log('');
179
+ Logger.success(`✅ Restored ${restoredCount} file${restoredCount > 1 ? 's' : ''}`);
180
+ Logger.dim(`From: ${formatRelativeTime(snapshot.metadata.timestamp)}`);
181
+ }
182
+ catch (error) {
183
+ console.log('');
184
+ Logger.error(`Failed to restore: ${error}`);
185
+ process.exit(1);
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AE,CAAC,CAAC;QAClF,MAAM,CAAC,GAAG,CAAC,SAAS,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,MAAM,CAAC,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Status command - show daemon status and info
3
+ */
4
+ export declare function statusCommand(): Promise<void>;
5
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA0CnD"}
@@ -0,0 +1,46 @@
1
+ import { DaemonManager } from '../../core/daemon.js';
2
+ import { Storage, STORAGE_PATHS } from '../../core/storage.js';
3
+ import { Logger } from '../../utils/logger.js';
4
+ import chalk from 'chalk';
5
+ /**
6
+ * Status command - show daemon status and info
7
+ */
8
+ export async function statusCommand() {
9
+ const isRunning = DaemonManager.isRunning();
10
+ const isInitialized = Storage.isInitialized();
11
+ console.log('');
12
+ Logger.bold('undoai Status');
13
+ console.log('');
14
+ // Daemon status
15
+ if (isRunning) {
16
+ const pid = DaemonManager.getPid();
17
+ console.log(chalk.green('🟢 Running') + chalk.dim(` (PID: ${pid})`));
18
+ }
19
+ else {
20
+ console.log(chalk.red('🔴 Not running'));
21
+ }
22
+ console.log('');
23
+ // Storage info
24
+ if (isInitialized) {
25
+ const snapshotIds = Storage.getSnapshotIds();
26
+ const snapshotCount = snapshotIds.length;
27
+ const storageSize = Storage.getStorageSize();
28
+ Logger.dim('💾 Storage:');
29
+ console.log(chalk.dim(` Location: ${STORAGE_PATHS.root}`));
30
+ console.log(chalk.dim(` Snapshots: ${snapshotCount}`));
31
+ console.log(chalk.dim(` Size: ${Storage.formatBytes(storageSize)}`));
32
+ }
33
+ else {
34
+ Logger.dim('💾 Storage: Not initialized');
35
+ Logger.dim(' Run "undoai watch" to initialize');
36
+ }
37
+ console.log('');
38
+ // Show commands
39
+ Logger.dim('📝 Commands:');
40
+ console.log(chalk.dim(' undoai watch - Start watching'));
41
+ console.log(chalk.dim(' undoai restore - Restore snapshot'));
42
+ console.log(chalk.dim(' undoai stop - Stop watching'));
43
+ console.log(chalk.dim(' undoai status - Show this status'));
44
+ console.log('');
45
+ }
46
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IAC/B,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC;IAC5C,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAE9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEhB,gBAAgB;IAChB,IAAI,SAAS,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,GAAG,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GAAG,CAAC,oCAAoC,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Stop command - stop watching daemon
3
+ */
4
+ export declare function stopCommand(): Promise<void>;
5
+ //# sourceMappingURL=stop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/stop.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAejD"}
@@ -0,0 +1,21 @@
1
+ import { DaemonManager } from '../../core/daemon.js';
2
+ import { Logger } from '../../utils/logger.js';
3
+ /**
4
+ * Stop command - stop watching daemon
5
+ */
6
+ export async function stopCommand() {
7
+ if (!DaemonManager.isRunning()) {
8
+ Logger.error('undoai is not running');
9
+ Logger.info('Use "undoai watch" to start watching');
10
+ process.exit(1);
11
+ }
12
+ const stopped = DaemonManager.stop();
13
+ if (stopped) {
14
+ Logger.success('undoai stopped');
15
+ }
16
+ else {
17
+ Logger.error('Failed to stop undoai');
18
+ process.exit(1);
19
+ }
20
+ }
21
+ //# sourceMappingURL=stop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stop.js","sourceRoot":"","sources":["../../../src/cli/commands/stop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC7B,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;IAErC,IAAI,OAAO,EAAE,CAAC;QACV,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrC,CAAC;SAAM,CAAC;QACJ,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Watch command - start watching for file changes
3
+ */
4
+ export declare function watchCommand(): Promise<void>;
5
+ //# sourceMappingURL=watch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/watch.ts"],"names":[],"mappings":"AAuEA;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAuFlD"}