antigravity-rtl-patcher 2.1.1 ā 2.2.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/README.md +45 -91
- package/bin/cli.js +8 -11
- package/package.json +2 -2
- package/payload/preload-inject.js +506 -0
- package/src/patcher.js +85 -175
- package/src/paths.js +18 -54
- package/payload/rtl-engine.js +0 -461
- package/payload/styles.css +0 -234
package/README.md
CHANGED
|
@@ -1,126 +1,80 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Antigravity RTL Patcher
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Smart RTL and Persian/Arabic typography support for the [Antigravity](https://antigravity.dev) desktop app. Patches the Electron runtime to detect right-to-left text and apply proper styling automatically.
|
|
4
4
|
|
|
5
|
-

|
|
9
|
-
|
|
10
|
-
**Intelligent RTL & Persian Typography Engine for Antigravity**
|
|
11
|
-
|
|
12
|
-
*One command. Full right-to-left support. Toggle on/off anytime.*
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
## 𧬠How It Works
|
|
19
|
-
|
|
20
|
-
Antigravity is built on Electron. This CLI tool directly patches the app's core workbench files to inject a smart **MutationObserver** engine that:
|
|
21
|
-
|
|
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
|
|
5
|
+
[](https://www.npmjs.com/package/antigravity-rtl-patcher)
|
|
6
|
+
[](https://www.npmjs.com/package/antigravity-rtl-patcher)
|
|
7
|
+
[](LICENSE)
|
|
28
8
|
|
|
29
9
|
---
|
|
30
10
|
|
|
31
|
-
##
|
|
11
|
+
## Install
|
|
32
12
|
|
|
33
13
|
```bash
|
|
34
|
-
# Linux / macOS
|
|
35
14
|
npx antigravity-rtl-patcher patch
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If Antigravity is installed in a system directory, use `sudo`:
|
|
36
18
|
|
|
37
|
-
|
|
19
|
+
```bash
|
|
38
20
|
sudo npx antigravity-rtl-patcher patch
|
|
39
21
|
```
|
|
40
22
|
|
|
23
|
+
Restart Antigravity after patching.
|
|
24
|
+
|
|
25
|
+
## Uninstall
|
|
26
|
+
|
|
41
27
|
```bash
|
|
42
|
-
|
|
43
|
-
npx antigravity-rtl-patcher patch
|
|
28
|
+
npx antigravity-rtl-patcher restore
|
|
44
29
|
```
|
|
45
30
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
---
|
|
31
|
+
This restores the original `app.asar` from the backup created during patching.
|
|
49
32
|
|
|
50
|
-
##
|
|
33
|
+
## Commands
|
|
51
34
|
|
|
52
|
-
|
|
35
|
+
| Command | Description |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `agy-rtl patch` | Apply RTL patch |
|
|
38
|
+
| `agy-rtl restore` | Remove patch, restore original |
|
|
39
|
+
| `agy-rtl status` | Show current patch status |
|
|
40
|
+
| `agy-rtl patch --path /custom/path` | Patch a custom installation |
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
- Settings are saved automatically and persist across restarts
|
|
56
|
-
- Works on every page ā enable/disable applies everywhere
|
|
42
|
+
## How it works
|
|
57
43
|
|
|
58
|
-
|
|
44
|
+
Antigravity is an Electron app. The patcher extracts `app.asar`, appends an RTL engine to the preload script, and repacks the archive. The engine uses a `MutationObserver` to detect Persian, Arabic, and Hebrew text in real-time and applies `direction: rtl` where needed.
|
|
59
45
|
|
|
60
|
-
|
|
46
|
+
After patching, an RTL icon appears at the bottom of the Antigravity window. Click it to open a settings panel where you can enable or disable RTL support. The setting persists across restarts via `localStorage`.
|
|
61
47
|
|
|
62
|
-
|
|
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 |
|
|
48
|
+
### What the engine does
|
|
68
49
|
|
|
69
|
-
|
|
50
|
+
- Detects RTL text using Unicode range analysis with ratio-based scoring
|
|
51
|
+
- Applies directional styling only to elements that contain RTL text
|
|
52
|
+
- Injects the Vazirmatn font for improved Persian/Arabic readability
|
|
53
|
+
- Preserves LTR direction for code blocks inside RTL text
|
|
54
|
+
- Provides a toggle UI to enable/disable at any time
|
|
70
55
|
|
|
71
|
-
##
|
|
56
|
+
## After Antigravity updates
|
|
72
57
|
|
|
73
|
-
|
|
58
|
+
Updates may overwrite the patch. Run the patch command again:
|
|
74
59
|
|
|
75
60
|
```bash
|
|
76
61
|
npx antigravity-rtl-patcher patch
|
|
77
62
|
```
|
|
78
63
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## šļø Architecture
|
|
82
|
-
|
|
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
|
|
99
|
-
|
|
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 |
|
|
104
|
-
|
|
105
|
-
---
|
|
106
|
-
|
|
107
|
-
## š Permissions
|
|
64
|
+
## Supported platforms
|
|
108
65
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
66
|
+
| Platform | Typical install locations |
|
|
67
|
+
|---|---|
|
|
68
|
+
| Linux | `/opt/antigravity`, `~/Downloads/Antigravity-x64` |
|
|
69
|
+
| macOS | `/Applications/Antigravity.app` |
|
|
70
|
+
| Windows | `%LOCALAPPDATA%\Programs\Antigravity` |
|
|
113
71
|
|
|
114
|
-
|
|
72
|
+
Custom paths are supported via `--path`.
|
|
115
73
|
|
|
116
|
-
|
|
74
|
+
## Contributing
|
|
117
75
|
|
|
118
|
-
|
|
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
|
|
76
|
+
Issues and pull requests are welcome at [github.com/VaFa1726/antigravity-rtl-patcher](https://github.com/VaFa1726/antigravity-rtl-patcher).
|
|
123
77
|
|
|
124
|
-
##
|
|
78
|
+
## License
|
|
125
79
|
|
|
126
|
-
|
|
80
|
+
MIT
|
package/bin/cli.js
CHANGED
|
@@ -5,16 +5,13 @@ const chalk = require('chalk');
|
|
|
5
5
|
const { patch, restore, status } = require('../src/patcher');
|
|
6
6
|
|
|
7
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('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā')}
|
|
8
|
+
${chalk.cyan('Antigravity Smart RTL Patcher')} ${chalk.gray('v2.2.0')}
|
|
12
9
|
`;
|
|
13
10
|
|
|
14
11
|
program
|
|
15
12
|
.name('agy-rtl')
|
|
16
|
-
.description('RTL
|
|
17
|
-
.version('2.
|
|
13
|
+
.description('RTL patcher for Antigravity')
|
|
14
|
+
.version('2.2.0');
|
|
18
15
|
|
|
19
16
|
program
|
|
20
17
|
.command('patch')
|
|
@@ -25,35 +22,35 @@ program
|
|
|
25
22
|
try {
|
|
26
23
|
await patch(options.path);
|
|
27
24
|
} catch (err) {
|
|
28
|
-
console.error(chalk.red('\
|
|
25
|
+
console.error(chalk.red('\nPatch failed:'), err.message);
|
|
29
26
|
process.exit(1);
|
|
30
27
|
}
|
|
31
28
|
});
|
|
32
29
|
|
|
33
30
|
program
|
|
34
31
|
.command('restore')
|
|
35
|
-
.description('
|
|
32
|
+
.description('Remove RTL patch and restore Antigravity')
|
|
36
33
|
.option('-p, --path <path>', 'Custom path to Antigravity installation')
|
|
37
34
|
.action(async (options) => {
|
|
38
35
|
console.log(BANNER);
|
|
39
36
|
try {
|
|
40
37
|
await restore(options.path);
|
|
41
38
|
} catch (err) {
|
|
42
|
-
console.error(chalk.red('\
|
|
39
|
+
console.error(chalk.red('\nRestore failed:'), err.message);
|
|
43
40
|
process.exit(1);
|
|
44
41
|
}
|
|
45
42
|
});
|
|
46
43
|
|
|
47
44
|
program
|
|
48
45
|
.command('status')
|
|
49
|
-
.description('Check
|
|
46
|
+
.description('Check current patch status')
|
|
50
47
|
.option('-p, --path <path>', 'Custom path to Antigravity installation')
|
|
51
48
|
.action(async (options) => {
|
|
52
49
|
console.log(BANNER);
|
|
53
50
|
try {
|
|
54
51
|
await status(options.path);
|
|
55
52
|
} catch (err) {
|
|
56
|
-
console.error(chalk.red('\
|
|
53
|
+
console.error(chalk.red('\nStatus check failed:'), err.message);
|
|
57
54
|
process.exit(1);
|
|
58
55
|
}
|
|
59
56
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antigravity-rtl-patcher",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.2.1",
|
|
4
|
+
"description": "Smart RTL and Persian/Arabic typography patcher for Antigravity",
|
|
5
5
|
"main": "src/patcher.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"antigravity-rtl-patcher": "./bin/cli.js",
|