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 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
- <br>
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.*
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
- ## ⚔ What is this?
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
- This tool is a **CLI Patcher**. It deeply hooks into the core of Antigravity IDE (`app.asar`), injects a smart JavaScript `MutationObserver` engine, and automatically formats text direction dynamically.
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
- ## šŸš€ Features
24
- - **🧠 Smart Direction:** Detects RTL languages using Regex and applies alignment only where necessary.
25
- - **šŸŽØ Beautiful Typography:** Automatically injects the modern **Vazirmatn** font for perfect legibility.
26
- - **🧩 Mixed Text Support:** Uses `unicode-bidi: plaintext` to ensure English code blocks inside Persian text don't break.
27
- - **šŸ›”ļø Safe & Reversible:** Automatically creates a backup. You can restore the IDE to its original state with a single command.
28
- - **āš™ļø OS Agnostic:** Works on Windows, macOS, and Linux out of the box.
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
- ## šŸ“¦ Installation & Usage
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
- # macOS & Linux (Requires sudo to modify application files)
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
- # Windows (Run PowerShell as Administrator)
41
+ ```bash
42
+ # Windows (Run terminal as Administrator if needed)
44
43
  npx antigravity-rtl-patcher patch
45
44
  ```
46
45
 
47
- ### 2. Restore (Unpatch)
48
- If you want to remove the patch or an update breaks something, you can easily restore from the backup:
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
- # macOS & Linux
52
- sudo npx antigravity-rtl-patcher restore
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
- *(Note: Whenever Antigravity IDE updates, the patch will be overwritten. Just run the `patch` command again!)*
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
- ## šŸ› ļø Architecture
107
+ ## šŸ” Permissions
63
108
 
64
- This project is divided into two main parts:
65
- 1. **The Patcher (`src/patcher.js`)**: A Node.js CLI that locates the `app.asar` file, extracts it to a temporary directory, injects our payload into the main `index.html`, and repacks it.
66
- 2. **The Payload (`payload/`)**: A combination of smart CSS and Vanilla JavaScript that runs inside the Electron UI. It uses a `MutationObserver` to watch for new chat messages dynamically generated by the AI and styles them on the fly.
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
- Feel free to check [issues page](https://github.com/VaFa1726/antigravity-rtl-patcher/issues).
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 IDE')
10
- .version('1.0.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 IDE')
15
- .action(async () => {
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
- console.log(chalk.cyan.bold('\nšŸš€ Starting Antigravity RTL Patcher...'));
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 IDE to its original state')
28
- .action(async () => {
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
- console.log(chalk.yellow.bold('\nšŸ”„ Restoring Antigravity...'));
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.1",
4
- "description": "An elegant RTL and typography patcher for Antigravity IDE based on Electron",
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
  }