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 CHANGED
@@ -1,126 +1,80 @@
1
- # 🌌 Antigravity RTL Patcher
1
+ # Antigravity RTL Patcher
2
2
 
3
- <div align="center">
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
- ![Version](https://img.shields.io/npm/v/antigravity-rtl-patcher?color=%2300bcd4&style=for-the-badge&label=VERSION)
6
- ![Downloads](https://img.shields.io/npm/dt/antigravity-rtl-patcher?color=%23e040fb&style=for-the-badge)
7
- ![License](https://img.shields.io/badge/LICENSE-MIT-brightgreen?style=for-the-badge)
8
- ![Node](https://img.shields.io/badge/NODE-%3E%3D16-339933?style=for-the-badge&logo=node.js&logoColor=white)
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
+ [![npm version](https://img.shields.io/npm/v/antigravity-rtl-patcher)](https://www.npmjs.com/package/antigravity-rtl-patcher)
6
+ [![npm downloads](https://img.shields.io/npm/dt/antigravity-rtl-patcher)](https://www.npmjs.com/package/antigravity-rtl-patcher)
7
+ [![license](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
28
8
 
29
9
  ---
30
10
 
31
- ## ⚔ Quick Start
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
- # If installed in system directory (e.g., /opt/)
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
- # Windows (Run terminal as Administrator if needed)
43
- npx antigravity-rtl-patcher patch
28
+ npx antigravity-rtl-patcher restore
44
29
  ```
45
30
 
46
- That's it. Restart Antigravity and enjoy native RTL support. ✨
47
-
48
- ---
31
+ This restores the original `app.asar` from the backup created during patching.
49
32
 
50
- ## šŸŽ›ļø In-App Toggle
33
+ ## Commands
51
34
 
52
- After patching, a small **RTL icon** appears at the bottom of Antigravity's status bar. Click it to open the settings panel:
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
- - **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
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
- ## šŸ“– Commands
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
- | 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 |
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
- ## šŸ”„ After Updates
56
+ ## After Antigravity updates
72
57
 
73
- When Antigravity updates, the patch may be overwritten. Simply run the patch command again:
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
- - **User directory installs** (e.g., `~/Downloads/`): No special permissions needed
110
- - **System directory installs** (e.g., `/opt/`): Requires `sudo` on Linux/macOS
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
- ## šŸ¤ Contributing
72
+ Custom paths are supported via `--path`.
115
73
 
116
- Contributions, issues, and feature requests are welcome!
74
+ ## Contributing
117
75
 
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
76
+ Issues and pull requests are welcome at [github.com/VaFa1726/antigravity-rtl-patcher](https://github.com/VaFa1726/antigravity-rtl-patcher).
123
77
 
124
- ## šŸ“„ License
78
+ ## License
125
79
 
126
- [MIT](https://choosealicense.com/licenses/mit/)
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 & Typography patcher for Antigravity')
17
- .version('2.1.0');
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('\nāŒ Patch failed:'), err.message);
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('Restore Antigravity to its original state')
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('\nāŒ Restore failed:'), err.message);
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 if Antigravity is currently patched')
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('\nāŒ Status check failed:'), err.message);
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.1.1",
4
- "description": "🌌 Intelligent RTL & Persian/Arabic typography patcher for Antigravity",
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",