* feat(docs): mirror every docs/ page in all 65 locales Extends the documentation mirrors from the 22-page core set (#13940) to every Markdown page under docs/: 152 sources x 65 locales = 9,880 mirrors (6,208 new), language bars rewritten for the full locale list, state adopted so the blocking drift gate now covers all 152 pages. run-translation.mjs: an oversized block made only of table rows or list items (PROVIDER_REFERENCE.md 244-row table, FREE_TIERS.md 71-item list) is cut at item boundaries and rejoined without a blank line — the single 16-40 KB request outlived the backend socket for verbose scripts. 48 older mirrors whose tables had lost rows were retranslated with --force. * docs(i18n): refresh mirrors for the sources the base changed since the branch cut Section-level retranslation of the 29 docs (and README.md) whose source or mirrors moved on release/v3.8.51 during the run, then state adoption; the drift gate is green again on the merged tree.
7.8 KiB
OmniRoute CLI Plugin System (Italiano)
🌐 Languages: 🇺🇸 English · 🇪🇹 am · 🇸🇦 ar · 🇦🇿 az · 🇧🇬 bg · 🇧🇩 bn · 🇨🇿 cs · 🇩🇰 da · 🇩🇪 de · 🇬🇷 el · 🇪🇸 es · 🇪🇪 et · 🇮🇷 fa · 🇫🇮 fi · 🇫🇷 fr · 🇮🇪 ga · 🇮🇳 gu · 🇳🇬 ha · 🇮🇱 he · 🇮🇳 hi · 🇭🇷 hr · 🇭🇺 hu · 🇦🇲 hy · 🇮🇩 id · 🇳🇬 ig · 🇯🇵 ja · 🇬🇪 ka · 🇰🇭 km · 🇮🇳 kn · 🇰🇷 ko · 🇱🇹 lt · 🇱🇻 lv · 🇮🇳 ml · 🇮🇳 mr · 🇲🇾 ms · 🇲🇹 mt · 🇲🇲 my · 🇳🇵 ne · 🇳🇱 nl · 🇳🇴 no · 🇮🇳 or · 🇮🇳 pa · 🇵🇭 phi · 🇵🇱 pl · 🇵🇹 pt · 🇧🇷 pt-BR · 🇷🇴 ro · 🇷🇺 ru · 🇱🇰 si · 🇸🇰 sk · 🇸🇮 sl · 🇷🇸 sr · 🇸🇪 sv · 🇰🇪 sw · 🇮🇳 ta · 🇮🇳 te · 🇹🇭 th · 🇹🇷 tr · 🇺🇦 uk-UA · 🇵🇰 ur · 🇺🇿 uz · 🇻🇳 vi · 🇳🇬 yo · 🇨🇳 zh-CN · 🇹🇼 zh-TW
Estendi la CLI omniroute senza modificarne il core. I plugin seguono la convenzione di denominazione omniroute-cmd-*, analogamente a gh extension o kubectl plugin.
Avvio rapido
# Installa un plugin da npm
omniroute plugin install stripe
# Installa un plugin locale in fase di sviluppo
omniroute plugin install ./my-plugin
# Elenca i plugin installati
omniroute plugin list
# Genera la struttura di un nuovo plugin
omniroute plugin scaffold myplugin
cd omniroute-cmd-myplugin
omniroute plugin install .
Struttura di un plugin
Un plugin è un pacchetto npm denominato omniroute-cmd-<name> (oppure @scope/omniroute-cmd-<name>).
omniroute-cmd-myplugin/
├── package.json # deve contenere "type": "module" e "main": "index.mjs"
├── index.mjs # esporta register(program, ctx) + meta opzionale
└── README.md
package.json
{
"name": "omniroute-cmd-myplugin",
"version": "0.1.0",
"type": "module",
"main": "index.mjs",
"engines": { "omniroute": ">=4.0.0" },
"keywords": ["omniroute-plugin", "omniroute-cmd"]
}
index.mjs
export const meta = {
name: "myplugin",
version: "0.1.0",
description: "Il mio plugin per OmniRoute",
omnirouteApi: ">=4.0.0",
};
export function register(program, ctx) {
program
.command("myplugin")
.description(meta.description)
.option("-n, --name <name>")
.action(async (opts, cmd) => {
const gOpts = cmd.optsWithGlobals();
const res = await ctx.apiFetch("/api/combos", {
baseUrl: gOpts.baseUrl,
apiKey: gOpts.apiKey,
});
const data = await res.json();
ctx.emit(data, gOpts);
});
}
API del contesto del plugin
L'oggetto ctx passato a register(program, ctx):
| Proprietà | Tipo | Descrizione |
|---|---|---|
ctx.apiFetch(path, opts) |
async function |
Fetch autenticata verso il server OmniRoute |
ctx.emit(data, opts) |
function |
Output in table/json/jsonl/csv in base al flag --output |
ctx.t(key) |
async function |
Ricerca della traduzione i18n |
ctx.withSpinner(label, fn) |
async function |
Esegue una funzione asincrona con uno spinner ora |
ctx.baseUrl |
string |
URL di base risolto |
ctx.apiKey |
string | null |
Chiave API, se fornita |
Individuazione
I plugin vengono individuati nelle seguenti posizioni:
~/.omniroute/plugins/<name>/— installazioni locali dell'utente- Variabile d'ambiente
OMNIROUTE_PLUGIN_PATH— directory personalizzata
Entrambe sono esclusive della CLI. Il runtime dei plugin lato server (i plugin del marketplace/plugin.json
eseguiti all'interno del proxy) dispone di un proprio scanner con una propria impostazione di sostituzione,
OMNIROUTE_PLUGINS_DIR — consulta
PLUGIN_MARKETPLACE.md → Directory dei plugin.
L'impostazione di una non influisce sull'altra.
Gli errori di caricamento vengono intercettati e visualizzati come avvisi: un plugin non funzionante non causa mai l'arresto anomalo della CLI.
Sicurezza
I plugin vengono eseguiti con gli stessi privilegi di processo Node.js di omniroute. Installa esclusivamente plugin provenienti da fonti attendibili. omniroute plugin install mostra un avviso esplicito e richiede --yes oppure una conferma interattiva.
Pubblicazione
- Assicurati che
package.jsoncontenga"keywords": ["omniroute-plugin"] - Esegui normalmente
npm publish - Gli utenti possono effettuare la ricerca tramite
omniroute plugin search <query>(esegue la ricerca nel registro npm)
Plugin di esempio
Consulta examples/omniroute-cmd-hello/ per un esempio minimo funzionante con meta + register().