pi-arabic-rtl

Arabic/RTL rendering support patch for Pi TUI on terminals that do not handle BiDi text correctly.

Packages

Package details

extension

Install pi-arabic-rtl from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-arabic-rtl
Package
pi-arabic-rtl
Version
0.1.2
Published
Jun 13, 2026
Downloads
not available
Author
beingmomen
License
MIT
Types
extension
Size
12.1 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-arabic-rtl

Arabic / RTL rendering support for Pi TUI on terminals that do not fully handle BiDi text.

What it does

  • Arabic paragraphs are rendered right-to-left.
  • English words inside Arabic text keep their correct letter order.
  • Arabic words inside English text keep their correct letter order.
  • Mixed punctuation behaves correctly.

This is implemented as a small patch to the built-in @earendil-works/pi-tui output layer.

Install

pi install npm:pi-arabic-rtl

The extension runs at Pi startup and applies the patch automatically. After the first install, restart Pi once so the patched files are loaded.

Manual fix

If you want to re-apply the patch without restarting Pi, run:

npx pi-arabic-rtl

or, after a global install:

pi-arabic-rtl

Why this package exists

Some terminals render Arabic letters correctly but do not reorder RTL / LTR mixed sentences correctly inside terminal UIs. This package applies a small fallback to Pi's TUI output layer so the chat, editor, and chat history remain readable.

The long-term goal is to upstream this behavior to Pi / @earendil-works/pi-tui and stop needing this package.

When the patch needs to be re-applied

The patch is idempotent: re-running it on an already patched file is a no-op. If Pi is updated, the TUI files may be replaced, so the extension will re-apply the patch on the next startup.

Compatibility

  • Pi (current).
  • Any terminal that renders Arabic glyphs. Bidirectional shaping is not required.
  • Node >=20.

Files

.
├── LICENSE
├── README.md
├── package.json
├── extensions
│   └── arabic-rtl.ts
├── bin
│   └── pi-arabic-rtl.cjs
└── lib
    └── patch.cjs

License

MIT.