opencode-wyvern 0.2.1 → 0.2.2

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 +34 -0
  2. package/package.json +1 -1
  3. package/src/prompts.js +23 -13
package/README.md CHANGED
@@ -8,8 +8,42 @@ API key vengono **richiesti/creati durante il setup**, mai salvati in locale
8
8
 
9
9
  ## Installazione
10
10
 
11
+ Prerequisiti: **Node.js 18+** e **npm** (su Ubuntu/WSL si consiglia `nvm`).
12
+
11
13
  ```bash
12
14
  npm install -g opencode-wyvern
15
+ ```
16
+
17
+ > Attenzione: `npm rm -g opencode-wyvern` **disinstalla**. Per installare
18
+ > si usa solo `npm install -g opencode-wyvern`.
19
+
20
+ Il comando si chiama **`oc-setup`** (non `oc-help`, non `oc`). Verifica:
21
+
22
+ ```bash
23
+ oc-setup --version # → 0.2.1
24
+ ```
25
+
26
+ Se compare `oc-setup: command not found` subito dopo l'installazione, il
27
+ binario è appena fuori dal PATH della shell corrente. Ricaricalo:
28
+
29
+ ```bash
30
+ hash -r # svuota la cache dei comandi (immediato) e riprova
31
+ source ~/.bashrc # oppure ricarica il profilo
32
+ # oppure: chiudi e riapri il terminale WSL
33
+ ```
34
+
35
+ Con **nvm** (Linux/WSL) il binario finisce in
36
+ `~/.nvm/versions/node/<versione>/bin`; quell'alias deve essere attivo
37
+ (`nvm use default`). Controlla che il file ci sia:
38
+
39
+ ```bash
40
+ nvm use default
41
+ ls -l ~/.nvm/versions/node/$(nvm current)/bin/oc-setup
42
+ ```
43
+
44
+ Poi avvia la procedura guidata:
45
+
46
+ ```bash
13
47
  oc-setup
14
48
  ```
15
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-wyvern",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Setup modulare per OpenCode: SSH, client PowerShell/bash (comandi oc-*), configurazione server opencode, provider, plugin e comandi custom. Installi tutto, attivi quello che vuoi.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/prompts.js CHANGED
@@ -153,24 +153,34 @@ function enableRaw() {
153
153
  * piping/test e ambiente completamente non interattivo).
154
154
  */
155
155
  const fallbackQueue = []
156
+ let fallbackEof = false
157
+ let fallbackBound = false
158
+ const fallbackWaiters = []
159
+
160
+ function pumpFallback() {
161
+ while (fallbackWaiters.length && (fallbackQueue.length || fallbackEof)) {
162
+ const done = fallbackWaiters.shift()
163
+ done(fallbackEof ? "q" : fallbackQueue.shift())
164
+ }
165
+ }
156
166
 
157
167
  function readLineFallback(done) {
158
- const next = () => {
159
- if (fallbackQueue.length) {
160
- const v = fallbackQueue.shift()
161
- return done(v)
162
- }
163
- const onData = (chunk) => {
164
- const text = chunk.toString()
165
- const parts = text.split(/\r\n|\r|\n/)
166
- fallbackQueue.push(...parts)
167
- input.removeListener("data", onData)
168
- next()
168
+ if (!fallbackBound) {
169
+ fallbackBound = true
170
+ input.on("data", (chunk) => {
171
+ fallbackQueue.push(...chunk.toString().split(/\r\n|\r|\n/))
172
+ pumpFallback()
173
+ })
174
+ const onEof = () => {
175
+ fallbackEof = true
176
+ pumpFallback()
169
177
  }
170
- input.on("data", onData)
178
+ input.on("end", onEof)
179
+ input.on("close", onEof)
171
180
  input.resume()
172
181
  }
173
- next()
182
+ fallbackWaiters.push(done)
183
+ pumpFallback()
174
184
  }
175
185
 
176
186
  /** Legge una riga da tastiera. `masked` oscura la digitazione (per segreti); */