revert-ai 1.1.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.
- package/LICENSE +25 -0
- package/README.md +103 -0
- package/bin/revert-ai.js +589 -0
- package/index.js +4 -0
- package/package.json +74 -0
- package/src/core/AgentDetector.js +27 -0
- package/src/core/AgentParser.js +34 -0
- package/src/core/AiderSessionParser.js +143 -0
- package/src/core/ClaudeSessionParser.js +243 -0
- package/src/core/DependencyCascading.js +74 -0
- package/src/core/DependencyResolver.js +206 -0
- package/src/core/Operation.js +39 -0
- package/src/core/OperationPreview.js +176 -0
- package/src/core/RedoManager.js +270 -0
- package/src/core/SessionTracker.js +98 -0
- package/src/core/UndoManager.js +207 -0
- package/src/core/UndoTracker.js +72 -0
- package/src/hooks/claude-tracker.js +92 -0
- package/src/i18n/i18n.js +72 -0
- package/src/i18n/languages.js +471 -0
- package/src/utils/diffRenderer.js +112 -0
- package/src/utils/formatting.js +15 -0
- package/src/utils/gitHelper.js +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Harsha Rajkumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice, this permission notice, and the following attribution
|
|
13
|
+
requirement shall be included in all copies or substantial portions of the Software:
|
|
14
|
+
|
|
15
|
+
**Attribution:** You must give appropriate credit, provide a link to the license,
|
|
16
|
+
and indicate if changes were made. You must give credit to Harsha Rajkumar
|
|
17
|
+
as the original creator of this Software and its ideas.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# revert-ai
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
> **Intelligent undo/redo for AI coding assistants** — Revert individual file operations with AST-based cascading safety, visual side-by-side diffs, and Git stashing.
|
|
6
|
+
|
|
7
|
+
`revert-ai` seamlessly integrates with popular AI command-line coders to provide granular undo and redo functionality. It parses active session logs (or git history) to track file operations, letting you selectively revert or restore changes without losing unrelated work.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- **🤖 Multi-Agent Support** — Reads directly from **Claude Code** session logs and parses **Aider** git commits.
|
|
14
|
+
- **✨ AST-based Cascading** — Analyzes imports and file dependencies in JS/TS and Python. Reverting a change only undoes subsequent steps that *actually* depend on it, rather than wiping out all unrelated edits.
|
|
15
|
+
- **📋 Visual Side-by-Side Diff** — Displays clear column-based terminal diffs comparing your current file state with the proposed reverted state before you confirm.
|
|
16
|
+
- **💾 Git Workspace Safety** — Automatically detects uncommitted changes and prompts to save your work to a Git stash before performing an undo.
|
|
17
|
+
- **Complete Redo System** — Reverse any undo operation with full cascading support.
|
|
18
|
+
- **🌍 Multi-language** — Supports English, Japanese (日本語), French, Spanish, and German out of the box.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g revert-ai
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
1. Navigate to any project directory where you have run Claude Code or Aider.
|
|
33
|
+
2. **List recent operations**:
|
|
34
|
+
```bash
|
|
35
|
+
revert-ai list
|
|
36
|
+
```
|
|
37
|
+
3. **Interactive preview** with side-by-side terminal diffs:
|
|
38
|
+
```bash
|
|
39
|
+
revert-ai preview
|
|
40
|
+
```
|
|
41
|
+
4. **Revert changes** safely:
|
|
42
|
+
```bash
|
|
43
|
+
revert-ai undo
|
|
44
|
+
```
|
|
45
|
+
5. **Redo** previously undone operations:
|
|
46
|
+
```bash
|
|
47
|
+
revert-ai redo
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Commands
|
|
53
|
+
|
|
54
|
+
### List Operations
|
|
55
|
+
Show recent tool-use edits or commits:
|
|
56
|
+
```bash
|
|
57
|
+
revert-ai list
|
|
58
|
+
revert-ai list --all # Include already undone operations
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Preview Changes
|
|
62
|
+
Compare files side-by-side in your terminal:
|
|
63
|
+
```bash
|
|
64
|
+
revert-ai preview # Interactive selection
|
|
65
|
+
revert-ai preview <operation-id> # Preview specific operation
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Undo Operations
|
|
69
|
+
Revert files safely with dependency tracing and Git stashing:
|
|
70
|
+
```bash
|
|
71
|
+
revert-ai undo # Interactive selection with preview
|
|
72
|
+
revert-ai undo <operation-id> # Revert specific operation
|
|
73
|
+
revert-ai undo --yes # Skip confirmation prompts
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Session Management
|
|
77
|
+
Switch between active AI coding sessions:
|
|
78
|
+
```bash
|
|
79
|
+
revert-ai sessions # List all sessions
|
|
80
|
+
revert-ai session <session-id> # Switch to a specific session
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Language Settings
|
|
84
|
+
Configure your CLI language:
|
|
85
|
+
```bash
|
|
86
|
+
revert-ai language # Show current language and options
|
|
87
|
+
revert-ai language ja # Switch to Japanese
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## How It Works
|
|
93
|
+
|
|
94
|
+
1. **Auto-Detection** — `revert-ai` inspects your directory for `.aider.chat.history.md` or Claude Code session logs to load the appropriate parser.
|
|
95
|
+
2. **Import Resolution** — It resolves imports/requires for Javascript, TypeScript, and Python.
|
|
96
|
+
3. **Dependency Cascading** — When you choose to undo a file edit, the dependency resolver walks the import graph to see if later edits depend on it. If so, they are cascaded; if not, they are untouched.
|
|
97
|
+
4. **Git Stashing** — If your git index is dirty, `revert-ai` stashes your uncommitted work so you never lose manual edits.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT © Harsha Rajkumar
|