codex-rtl 1.0.0 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +24 -10
  2. package/bin/index.js +18 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,12 +17,19 @@ This CLI tool automatically injects a sophisticated RTL engine into Codex, addin
17
17
 
18
18
  You don't need to download any files. Just run the following command in your terminal:
19
19
 
20
- ### macOS / Linux
21
- Because the tool needs to modify the Codex application files, you must run it with `sudo`:
20
+ ### macOS
21
+ Simply run:
22
+ ```bash
23
+ npx codex-rtl
24
+ ```
25
+ > **First time?** If you get a "Permission Denied" error, the tool will **automatically open** the App Management settings page for you. Just enable the toggle for your terminal app, then run the command again. No `sudo` needed!
26
+ >
27
+ > You can also grant permission manually: `System Settings > Privacy & Security > App Management`.
28
+
29
+ ### Linux
22
30
  ```bash
23
31
  sudo npx codex-rtl
24
32
  ```
25
- > **macOS Users:** If you get a "Permission Denied" error even with sudo, ensure your terminal (e.g. Terminal, iTerm2, VS Code) has **App Management** permissions enabled in `System Settings > Privacy & Security > App Management`.
26
33
 
27
34
  ### Windows
28
35
  Open **PowerShell** or **Command Prompt** as **Administrator** (Right-click -> Run as Administrator), then run:
@@ -40,9 +47,9 @@ npx codex-rtl
40
47
  If you ever want to revert Codex back to its original state (before the patch), simply run the command with the `--restore` flag:
41
48
 
42
49
  ```bash
43
- sudo npx codex-rtl --restore
50
+ npx codex-rtl --restore
44
51
  ```
45
- *(On Windows, run without `sudo` in an Administrator terminal)*
52
+ *(On Linux, run with `sudo`. On Windows, run in an Administrator terminal)*
46
53
 
47
54
  ## How it works
48
55
 
@@ -81,12 +88,19 @@ Feel free to open issues or submit pull requests. Let's make Codex accessible an
81
88
 
82
89
  بدون نیاز به دانلود هیچ فایلی، فقط کافیست دستور زیر را در ترمینال سیستم خود اجرا کنید:
83
90
 
84
- ### در مک (macOS) و لینوکس
85
- از آنجایی که این ابزار قرار است فایل‌های سیستمی Codex را ویرایش کند، باید حتماً دسترسی `sudo` داشته باشد:
91
+ ### در مک (macOS)
92
+ کافیست دستور زیر را اجرا کنید:
93
+ ```bash
94
+ npx codex-rtl
95
+ ```
96
+ > **اولین بار؟** اگر خطای Permission Denied دریافت کردید، ابزار به صورت **خودکار** صفحهٔ تنظیمات App Management را برای شما باز می‌کند. فقط سوئیچ ترمینال خود (مثلاً Terminal، iTerm2 یا VS Code) را فعال کنید و دوباره دستور را اجرا کنید. نیازی به `sudo` نیست!
97
+ >
98
+ > همچنین می‌توانید به صورت دستی به مسیر `System Settings > Privacy & Security > App Management` بروید.
99
+
100
+ ### در لینوکس
86
101
  ```bash
87
102
  sudo npx codex-rtl
88
103
  ```
89
- > **کاربران مک (macOS):** اگر با وجود استفاده از sudo باز هم خطای Permission Denied دریافت کردید، باید به ترمینال خود (مثل Terminal، iTerm2 یا VS Code) دسترسی **App Management** بدهید. برای این کار به مسیر `System Settings > Privacy & Security > App Management` بروید و دسترسی ترمینال خود را فعال کنید.
90
104
 
91
105
  ### در ویندوز
92
106
  برنامهٔ **PowerShell** یا **Command Prompt** را در حالت **Administrator** (راست‌کلیک -> Run as Administrator) باز کنید و دستور زیر را بنویسید:
@@ -104,9 +118,9 @@ npx codex-rtl
104
118
  اگر زمانی خواستید Codex را به حالتِ اولیه (قبل از نصب این پچ) برگردانید، فقط کافیست دستور بالا را با فلگ `--restore` اجرا کنید:
105
119
 
106
120
  ```bash
107
- sudo npx codex-rtl --restore
121
+ npx codex-rtl --restore
108
122
  ```
109
- *(کاربران ویندوز این دستور را بدون `sudo` و در یک ترمینال ادمین اجرا کنند)*
123
+ *(در لینوکس با `sudo` اجرا کنید. کاربران ویندوز این دستور را در یک ترمینال ادمین اجرا کنند)*
110
124
 
111
125
  ## این ابزار چگونه کار می‌کند؟
112
126
 
package/bin/index.js CHANGED
@@ -7,6 +7,7 @@ import picocolors from 'picocolors';
7
7
  import ora from 'ora';
8
8
  import prompts from 'prompts';
9
9
  import * as asar from '@electron/asar';
10
+ import { execSync } from 'child_process';
10
11
 
11
12
  const __filename = fileURLToPath(import.meta.url);
12
13
  const __dirname = path.dirname(__filename);
@@ -16,6 +17,21 @@ const pkgPath = path.join(__dirname, '..', 'package.json');
16
17
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
17
18
  console.log(bold(cyan(`\n✨ Codex Smart RTL Patcher v${pkg.version}\n`)));
18
19
 
20
+ function handleMacPermissionError(err) {
21
+ if (os.platform() === 'darwin') {
22
+ console.error(yellow('\nOn macOS, you can either:'));
23
+ console.error(yellow(' 1. Grant your terminal "App Management" permission to run without sudo.'));
24
+ console.error(yellow(' 2. Or, run this command with sudo (e.g. sudo npx codex-rtl)'));
25
+ console.log(blue('\nOpening System Settings directly to App Management for you...'));
26
+ try {
27
+ execSync('open "x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_AppBundles"');
28
+ console.log(green('✔ Settings opened! Please enable the toggle for your terminal, then try again.\n'));
29
+ } catch (e) {
30
+ console.error(yellow('To open manually, go to: System Settings > Privacy & Security > App Management\n'));
31
+ }
32
+ }
33
+ }
34
+
19
35
  function getDefaultPath() {
20
36
  if (os.platform() === 'darwin') {
21
37
  return '/Applications/Codex.app/Contents/Resources/app.asar';
@@ -68,6 +84,7 @@ async function main() {
68
84
  } catch (e) {
69
85
  spinner.fail('Failed to restore.');
70
86
  console.error(red(e.message));
87
+ handleMacPermissionError(e);
71
88
  process.exit(1);
72
89
  }
73
90
  }
@@ -84,10 +101,7 @@ async function main() {
84
101
  if (os.platform() === 'win32') {
85
102
  console.error(yellow('\nPlease run your terminal (PowerShell/CMD) as Administrator and try again.\n'));
86
103
  } else if (os.platform() === 'darwin') {
87
- console.error(yellow('\nPlease ensure you run this command with sudo (if required).'));
88
- console.error(yellow('On macOS, you might also need to give your terminal "App Management" permission.'));
89
- console.error(yellow('Go to: System Settings > Privacy & Security > App Management'));
90
- console.error(yellow('And enable the toggle for your terminal, then try again.\n'));
104
+ handleMacPermissionError(e);
91
105
  } else {
92
106
  console.error(yellow('\nPlease run this command with sudo.\n'));
93
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-rtl",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A smart RTL (Right-to-Left) patcher with UI settings for the Codex application.",
5
5
  "main": "./bin/index.js",
6
6
  "bin": {