undoai 0.1.0-beta.1 โ†’ 1.0.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.
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ # Test 2: Selective Restore (Manual Test)
3
+
4
+ echo "๐Ÿงช Test 2: Selective Restore"
5
+ echo "============================"
6
+ echo ""
7
+
8
+ echo "Step 1: Delete some test files..."
9
+ rm -f test-burst-1.ts test-burst-2.ts 2>/dev/null
10
+ echo "โœ… Deleted test-burst-1.ts and test-burst-2.ts"
11
+ echo ""
12
+
13
+ echo "Step 2: Now run selective restore:"
14
+ echo ""
15
+ echo " node dist/cli/index.js restore -i"
16
+ echo ""
17
+ echo "Expected behavior:"
18
+ echo " 1. Shows list of snapshots"
19
+ echo " 2. Select latest snapshot"
20
+ echo " 3. Shows checkbox list of files"
21
+ echo " 4. Use SPACE to select files"
22
+ echo " 5. Use ENTER to confirm"
23
+ echo " 6. Shows preview before restore"
24
+ echo " 7. Confirm to restore"
25
+ echo ""
26
+ echo "Try it now! ๐Ÿ‘†"
27
+ echo ""
@@ -0,0 +1,95 @@
1
+ #!/bin/bash
2
+ # Test 3: Compression Verification
3
+
4
+ echo "๐Ÿงช Test 3: Compression Verification"
5
+ echo "===================================="
6
+ echo ""
7
+
8
+ echo "Checking snapshot files..."
9
+ echo ""
10
+
11
+ SNAPSHOTS=$(ls -1 ~/.undoai/snapshots/ 2>/dev/null)
12
+
13
+ if [ -z "$SNAPSHOTS" ]; then
14
+ echo "โŒ No snapshots found!"
15
+ echo " Run test-1-burst.sh first"
16
+ exit 1
17
+ fi
18
+
19
+ # Get latest snapshot
20
+ LATEST=$(ls -1t ~/.undoai/snapshots/ | head -n 1)
21
+ FILES_DIR="$HOME/.undoai/snapshots/$LATEST/files"
22
+
23
+ echo "๐Ÿ“ Latest snapshot: $LATEST"
24
+ echo ""
25
+
26
+ if [ ! -d "$FILES_DIR" ]; then
27
+ echo "โŒ No files directory found!"
28
+ exit 1
29
+ fi
30
+
31
+ echo "๐Ÿ“‹ Files in snapshot:"
32
+ echo ""
33
+ ls -lh "$FILES_DIR/"
34
+ echo ""
35
+
36
+ echo "๐Ÿ” Checking compression..."
37
+ echo ""
38
+
39
+ GZ_COUNT=$(ls -1 "$FILES_DIR"/*.gz 2>/dev/null | wc -l)
40
+ ALL_COUNT=$(ls -1 "$FILES_DIR"/ 2>/dev/null | wc -l)
41
+
42
+ echo "Total files: $ALL_COUNT"
43
+ echo "Compressed (.gz): $GZ_COUNT"
44
+ echo ""
45
+
46
+ if [ "$GZ_COUNT" -gt 0 ]; then
47
+ echo "โœ… Compression is working!"
48
+ echo ""
49
+ echo "Verifying gzip format:"
50
+ for f in "$FILES_DIR"/*.gz; do
51
+ if [ -f "$f" ]; then
52
+ FILE_TYPE=$(file "$f" | grep -o "gzip compressed")
53
+ if [ -n "$FILE_TYPE" ]; then
54
+ echo " โœ… $(basename $f): $FILE_TYPE"
55
+ else
56
+ echo " โŒ $(basename $f): NOT gzip!"
57
+ fi
58
+ fi
59
+ done
60
+
61
+ echo ""
62
+ echo "๐Ÿ“Š Storage savings calculation:"
63
+
64
+ # Try to calculate savings
65
+ TOTAL_COMPRESSED=0
66
+ TOTAL_ORIGINAL=0
67
+
68
+ for f in "$FILES_DIR"/*.gz; do
69
+ if [ -f "$f" ]; then
70
+ COMPRESSED_SIZE=$(stat -f%z "$f" 2>/dev/null || stat -c%s "$f" 2>/dev/null)
71
+ TOTAL_COMPRESSED=$((TOTAL_COMPRESSED + COMPRESSED_SIZE))
72
+
73
+ # Decompress to temp and measure
74
+ TEMP_FILE=$(mktemp)
75
+ gunzip -c "$f" > "$TEMP_FILE" 2>/dev/null
76
+ ORIGINAL_SIZE=$(stat -f%z "$TEMP_FILE" 2>/dev/null || stat -c%s "$TEMP_FILE" 2>/dev/null)
77
+ TOTAL_ORIGINAL=$((TOTAL_ORIGINAL + ORIGINAL_SIZE))
78
+ rm "$TEMP_FILE"
79
+ fi
80
+ done
81
+
82
+ if [ $TOTAL_ORIGINAL -gt 0 ]; then
83
+ SAVINGS=$((100 - (TOTAL_COMPRESSED * 100 / TOTAL_ORIGINAL)))
84
+ echo " Original size: $TOTAL_ORIGINAL bytes"
85
+ echo " Compressed size: $TOTAL_COMPRESSED bytes"
86
+ echo " Savings: $SAVINGS%"
87
+ fi
88
+ else
89
+ echo "โŒ No compressed files found!"
90
+ echo " Expected files ending with .gz"
91
+ fi
92
+
93
+ echo ""
94
+ echo "โœ… Test 3 completed!"
95
+ echo ""
@@ -0,0 +1 @@
1
+ export const test1 = 'hello';
@@ -0,0 +1 @@
1
+ export const test2 = 'world';
@@ -0,0 +1 @@
1
+ export const test3 = 'foo';
@@ -0,0 +1,2 @@
1
+ Test content here
2
+ change
@@ -0,0 +1,2 @@
1
+ Another file
2
+ change
@@ -0,0 +1 @@
1
+ change
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+
3
+ echo "๐Ÿงช Testing File Watcher - Creating test files..."
4
+ echo ""
5
+
6
+ # Create test directory
7
+ mkdir -p test-files
8
+
9
+ # Create 5 files quickly (to trigger burst)
10
+ echo "Creating 5 files..."
11
+ for i in {1..5}; do
12
+ echo "Test content $i" > test-files/test-file-$i.txt
13
+ echo " โœ“ Created test-file-$i.txt"
14
+ done
15
+
16
+ echo ""
17
+ echo "โœ… Done! Wait 2 seconds for burst detection..."
18
+ echo " The watcher should trigger the callback now!"
19
+
20
+
21
+
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ES2020",
5
+ "lib": [
6
+ "ES2020"
7
+ ],
8
+ "moduleResolution": "node",
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "declaration": true,
17
+ "declarationMap": true,
18
+ "sourceMap": true
19
+ },
20
+ "include": [
21
+ "src/**/*"
22
+ ],
23
+ "exclude": [
24
+ "node_modules",
25
+ "dist",
26
+ "build"
27
+ ]
28
+ }