antigravity-rtl-patcher 1.0.1 ā 2.1.0
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/README.md +90 -41
- package/bin/cli.js +34 -11
- package/package.json +21 -6
- package/payload/rtl-engine.js +439 -51
- package/payload/styles.css +224 -10
- package/src/patcher.js +239 -86
- package/src/paths.js +114 -19
- package/src/utils.js +17 -8
package/README.md
CHANGED
|
@@ -1,77 +1,126 @@
|
|
|
1
1
|
# š Antigravity RTL Patcher
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
|
-
<img src="https://img.shields.io/npm/v/antigravity-rtl-patcher?color=cyan&label=Version&style=for-the-badge" alt="Version">
|
|
5
|
-
<img src="https://img.shields.io/npm/dt/antigravity-rtl-patcher?color=magenta&style=for-the-badge" alt="Downloads">
|
|
6
|
-
<img src="https://img.shields.io/badge/License-MIT-green.svg?style=for-the-badge" alt="License">
|
|
7
|
-
</div>
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
**Intelligent RTL & Persian Typography Engine for Antigravity**
|
|
11
|
+
|
|
12
|
+
*One command. Full right-to-left support. Toggle on/off anytime.*
|
|
10
13
|
|
|
11
|
-
<div align="center">
|
|
12
|
-
<h3>An elegant, intelligent, and seamless RTL & Typography patcher for Antigravity IDE.</h3>
|
|
13
|
-
<p>Bring native support for Persian, Arabic, and Hebrew to your favorite AI IDE.</p>
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
##
|
|
19
|
-
Antigravity IDE (like many modern AI editors) is built on Electron. Out of the box, it lacks proper Right-to-Left (RTL) support. When AI generates Persian or Arabic text, the alignment breaks, fonts look terrible, and mixed English/RTL sentences become unreadable.
|
|
18
|
+
## 𧬠How It Works
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
Antigravity is built on Electron. This CLI tool directly patches the app's core workbench files to inject a smart **MutationObserver** engine that:
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
1. š **Watches** the DOM for new chat messages and AI responses in real-time
|
|
23
|
+
2. š§ **Detects** Persian/Arabic/Hebrew text using Unicode analysis with ratio-based scoring
|
|
24
|
+
3. šØ **Applies** `direction: rtl` and `unicode-bidi: plaintext` only where needed
|
|
25
|
+
4. āļø **Injects** the beautiful **Vazirmatn** font for perfect Persian/Arabic readability
|
|
26
|
+
5. š **Isolates** English code blocks inside RTL text so they don't break
|
|
27
|
+
6. šļø **Toggle Panel** ā Enable/disable RTL support anytime via the in-app panel
|
|
29
28
|
|
|
30
29
|
---
|
|
31
30
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
You don't even need to download the repository. Just run it directly via `npx`!
|
|
35
|
-
|
|
36
|
-
### 1. Patch the IDE
|
|
37
|
-
To inject RTL support, run the following command in your terminal:
|
|
31
|
+
## ā” Quick Start
|
|
38
32
|
|
|
39
33
|
```bash
|
|
40
|
-
#
|
|
34
|
+
# Linux / macOS
|
|
35
|
+
npx antigravity-rtl-patcher patch
|
|
36
|
+
|
|
37
|
+
# If installed in system directory (e.g., /opt/)
|
|
41
38
|
sudo npx antigravity-rtl-patcher patch
|
|
39
|
+
```
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
```bash
|
|
42
|
+
# Windows (Run terminal as Administrator if needed)
|
|
44
43
|
npx antigravity-rtl-patcher patch
|
|
45
44
|
```
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
That's it. Restart Antigravity and enjoy native RTL support. āØ
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## šļø In-App Toggle
|
|
51
|
+
|
|
52
|
+
After patching, a small **RTL icon** appears at the bottom of Antigravity's status bar. Click it to open the settings panel:
|
|
53
|
+
|
|
54
|
+
- **Enabled** ā Toggle RTL support on/off instantly
|
|
55
|
+
- Settings are saved automatically and persist across restarts
|
|
56
|
+
- Works on every page ā enable/disable applies everywhere
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## š Commands
|
|
61
|
+
|
|
62
|
+
| Command | Description |
|
|
63
|
+
|---------|-------------|
|
|
64
|
+
| `agy-rtl patch` | Inject RTL support into Antigravity |
|
|
65
|
+
| `agy-rtl restore` | Remove patch and restore original files |
|
|
66
|
+
| `agy-rtl status` | Check if Antigravity is currently patched |
|
|
67
|
+
| `agy-rtl patch --path /custom/path` | Patch a custom installation directory |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## š After Updates
|
|
72
|
+
|
|
73
|
+
When Antigravity updates, the patch may be overwritten. Simply run the patch command again:
|
|
49
74
|
|
|
50
75
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
npx antigravity-rtl-patcher patch
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## šļø Architecture
|
|
53
82
|
|
|
54
|
-
# Windows
|
|
55
|
-
npx antigravity-rtl-patcher restore
|
|
56
83
|
```
|
|
84
|
+
antigravity-rtl-patcher/
|
|
85
|
+
āāā bin/
|
|
86
|
+
ā āāā cli.js # CLI entry point (commander-based)
|
|
87
|
+
āāā src/
|
|
88
|
+
ā āāā patcher.js # Core logic: backup, inject, repack
|
|
89
|
+
ā āāā paths.js # OS-aware installation path detection
|
|
90
|
+
ā āāā utils.js # Permission checks & helpers
|
|
91
|
+
āāā payload/
|
|
92
|
+
ā āāā rtl-engine.js # MutationObserver RTL engine + Toggle UI
|
|
93
|
+
ā āāā styles.css # Vazirmatn font + RTL + Panel styles
|
|
94
|
+
āāā package.json
|
|
95
|
+
āāā README.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Supported Installation Types
|
|
57
99
|
|
|
58
|
-
|
|
100
|
+
| Type | Description | Method |
|
|
101
|
+
|------|-------------|--------|
|
|
102
|
+
| **Unpacked** | App with `resources/app/` directory | Direct file modification |
|
|
103
|
+
| **ASAR** | App bundled as `app.asar` | Extract ā Patch ā Repack |
|
|
59
104
|
|
|
60
105
|
---
|
|
61
106
|
|
|
62
|
-
##
|
|
107
|
+
## š Permissions
|
|
63
108
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
109
|
+
- **User directory installs** (e.g., `~/Downloads/`): No special permissions needed
|
|
110
|
+
- **System directory installs** (e.g., `/opt/`): Requires `sudo` on Linux/macOS
|
|
111
|
+
|
|
112
|
+
---
|
|
67
113
|
|
|
68
114
|
## š¤ Contributing
|
|
115
|
+
|
|
69
116
|
Contributions, issues, and feature requests are welcome!
|
|
70
|
-
|
|
117
|
+
|
|
118
|
+
1. Fork the repo
|
|
119
|
+
2. Create your feature branch (`git checkout -b feature/amazing`)
|
|
120
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
121
|
+
4. Push to the branch (`git push origin feature/amazing`)
|
|
122
|
+
5. Open a Pull Request
|
|
71
123
|
|
|
72
124
|
## š License
|
|
73
|
-
This project is [MIT](https://choosealicense.com/licenses/mit/) licensed.
|
|
74
125
|
|
|
75
|
-
|
|
76
|
-
<div align="center">
|
|
77
|
-
</div>
|
|
126
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/bin/cli.js
CHANGED
|
@@ -2,20 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
const { program } = require('commander');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
const { patch, restore } = require('../src/patcher');
|
|
5
|
+
const { patch, restore, status } = require('../src/patcher');
|
|
6
|
+
|
|
7
|
+
const BANNER = `
|
|
8
|
+
${chalk.cyan('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā')}
|
|
9
|
+
${chalk.cyan('ā')} ${chalk.bold.white('š Antigravity RTL Patcher')} ${chalk.gray('v2.1.0')} ${chalk.cyan('ā')}
|
|
10
|
+
${chalk.cyan('ā')} ${chalk.gray('Intelligent RTL support for Antigravity')} ${chalk.cyan('ā')}
|
|
11
|
+
${chalk.cyan('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā')}
|
|
12
|
+
`;
|
|
6
13
|
|
|
7
14
|
program
|
|
8
15
|
.name('agy-rtl')
|
|
9
|
-
.description('RTL & Typography patcher for Antigravity
|
|
10
|
-
.version('1.0
|
|
16
|
+
.description('RTL & Typography patcher for Antigravity')
|
|
17
|
+
.version('2.1.0');
|
|
11
18
|
|
|
12
19
|
program
|
|
13
20
|
.command('patch')
|
|
14
|
-
.description('Inject RTL support into Antigravity
|
|
15
|
-
.
|
|
21
|
+
.description('Inject RTL support into Antigravity')
|
|
22
|
+
.option('-p, --path <path>', 'Custom path to Antigravity installation')
|
|
23
|
+
.action(async (options) => {
|
|
24
|
+
console.log(BANNER);
|
|
16
25
|
try {
|
|
17
|
-
|
|
18
|
-
await patch();
|
|
26
|
+
await patch(options.path);
|
|
19
27
|
} catch (err) {
|
|
20
28
|
console.error(chalk.red('\nā Patch failed:'), err.message);
|
|
21
29
|
process.exit(1);
|
|
@@ -24,15 +32,30 @@ program
|
|
|
24
32
|
|
|
25
33
|
program
|
|
26
34
|
.command('restore')
|
|
27
|
-
.description('Restore Antigravity
|
|
28
|
-
.
|
|
35
|
+
.description('Restore Antigravity to its original state')
|
|
36
|
+
.option('-p, --path <path>', 'Custom path to Antigravity installation')
|
|
37
|
+
.action(async (options) => {
|
|
38
|
+
console.log(BANNER);
|
|
29
39
|
try {
|
|
30
|
-
|
|
31
|
-
await restore();
|
|
40
|
+
await restore(options.path);
|
|
32
41
|
} catch (err) {
|
|
33
42
|
console.error(chalk.red('\nā Restore failed:'), err.message);
|
|
34
43
|
process.exit(1);
|
|
35
44
|
}
|
|
36
45
|
});
|
|
37
46
|
|
|
47
|
+
program
|
|
48
|
+
.command('status')
|
|
49
|
+
.description('Check if Antigravity is currently patched')
|
|
50
|
+
.option('-p, --path <path>', 'Custom path to Antigravity installation')
|
|
51
|
+
.action(async (options) => {
|
|
52
|
+
console.log(BANNER);
|
|
53
|
+
try {
|
|
54
|
+
await status(options.path);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error(chalk.red('\nā Status check failed:'), err.message);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
38
61
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antigravity-rtl-patcher",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "š Intelligent RTL & Persian/Arabic typography patcher for Antigravity",
|
|
5
5
|
"main": "src/patcher.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"antigravity-rtl-patcher": "./bin/cli.js",
|
|
8
8
|
"agy-rtl": "./bin/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"start": "node ./bin/cli.js"
|
|
11
|
+
"start": "node ./bin/cli.js",
|
|
12
|
+
"patch": "node ./bin/cli.js patch",
|
|
13
|
+
"restore": "node ./bin/cli.js restore"
|
|
12
14
|
},
|
|
13
15
|
"keywords": [
|
|
14
16
|
"antigravity",
|
|
15
17
|
"rtl",
|
|
16
18
|
"farsi",
|
|
19
|
+
"persian",
|
|
17
20
|
"arabic",
|
|
18
21
|
"hebrew",
|
|
19
22
|
"patcher",
|
|
20
23
|
"electron",
|
|
21
|
-
"asar"
|
|
24
|
+
"asar",
|
|
25
|
+
"right-to-left",
|
|
26
|
+
"bidirectional"
|
|
22
27
|
],
|
|
23
28
|
"author": "VaFa1726",
|
|
24
29
|
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/VaFa1726/antigravity-rtl-patcher.git"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/VaFa1726/antigravity-rtl-patcher/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/VaFa1726/antigravity-rtl-patcher#readme",
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=16.0.0"
|
|
40
|
+
},
|
|
25
41
|
"dependencies": {
|
|
26
42
|
"@electron/asar": "^3.2.14",
|
|
27
43
|
"chalk": "^4.1.2",
|
|
28
44
|
"commander": "^11.1.0",
|
|
29
45
|
"fs-extra": "^11.2.0",
|
|
30
|
-
"ora": "^5.4.1"
|
|
31
|
-
"sudo-prompt": "^9.2.1"
|
|
46
|
+
"ora": "^5.4.1"
|
|
32
47
|
}
|
|
33
48
|
}
|