pi-lingual0.9.3
Translate and rewrite prompts in Pi Coding Agent — live bilingual companion HUD (spoken/written/vocab), code-safe technical translation, and spec/commit presets.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-lingual
A bilingual companion, prompt rewriter, and declarative mode engine for the Pi Coding Agent.
- Live companion — shows spoken and written registers plus collocations in a local card above the editor. Your prompt reaches the agent untouched, and the card stays out of conversation history.
- Prompt rewriting — translates or restructures your draft before dispatch while grafting code fences, shell commands, paths, and stack traces back verbatim.
- Writing modes — turns a short draft into a spec, Conventional Commit, peer PR reply, or tight post, sent to the agent or copied to the clipboard.
English | 简体中文
Install
pi install npm:pi-lingual
Fresh installs detect OS locale in memory with zero disk writes until you change a setting in ~/.pi/agent/lingual.json.
Language Pairs & Core Modes
sourceLang (detected or set), targetLang (for the agent/card), and explainLang (for glosses, defaulting to source) stay independent across any ISO code (zh, tw, ja, ko, es, fr, de, ru, en, or custom).
| Mode | What the agent receives | Above the editor |
|---|---|---|
companion |
original text, unchanged | tree card: spoken, written, vocab |
direct |
draft rewritten into targetLang |
two-line preview card |
Presets & Commands
Apply presets with /lingual loadout <id>:
| Preset | Output | Target |
|---|---|---|
spec |
Objective, Constraints, Edge Cases, Do Not Touch | agent |
commit |
Conventional Commit (<= 72 chars subject) |
clipboard |
oss |
peer-level issue/PR feedback without fluff | clipboard |
yap |
concise tech post (< 280 chars, no emoji) |
clipboard |
/lingual # hub picker (0 off, 1 companion, 2 direct, languages, loadouts, model, settings)
/lingual lang # 2-step language pair picker or Swap (/lingual lang ja en, swap, list)
/lingual loadout # preset picker or /lingual loadout spec|commit|oss|yap
/lingual model # pick fast (cheapest sibling), session, or explicit model
/lingual reasoning # picker or off (default) | minimal | low | medium | high
/lingual reply # picker or on | off | toggle
/lingual mode # mode manager (switch, new, edit, clone, toggle, rm, reset)
/lingual default | status | lock | unlock
Tip: Bare commands open interactive pickers, Tab completes inline arguments, or simply ask the agent in chat — lingual_config updates settings and custom modes live.
Keys: alt+c copies the current/last card; alt+r rewrites the editor draft in place without sending (skips / or !, keeps draft if you kept typing, copies when targeting clipboard).
Declarative Modes & Constraints
Every mode in ~/.pi/agent/lingual.json is declarative JSON:
{
"id": "review",
"name": "Review",
"description": "Short reviewer comment.",
"prompt": "Rewrite as a short reviewer comment: risk first, then suggestion.",
"delivery": "clipboard",
"includeGitDiff": true,
"avoid": ["nitpick"],
"vocab": false
}
- Core fields:
delivery(hud|editor|clipboard),promptorslots,systemPrompt+rules(forflow: "custom"),inputLang/outputLang/explainLang,includeGitDiff/contextAware,avoid/killList,reasoning,vocab. directbypasses models automatically on non-Latin sources whose draft already begins with an English imperative verb.- Card layout uses UAX #11 display widths and borderless wrapping (
<= 9tree lines,<= 2preview lines). - External edits to
lingual.jsonhot-reload on the next input;/lingual 0clears card and badge.
MIT © Jason Song