@soyjuanpiece/jpcode 2.0.0 → 2.0.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.
- package/bin/jpcode.mjs +66 -17
- package/package.json +2 -2
package/bin/jpcode.mjs
CHANGED
|
@@ -25,22 +25,67 @@ const C = {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const BANNER = [
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"██ ██║██╔═══╝ ██║
|
|
32
|
-
"╚█████╔╝██║
|
|
33
|
-
" ╚════╝ ╚═╝ ╚═════╝
|
|
28
|
+
" ▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄ ▄▄▄▄▄▄▄",
|
|
29
|
+
" ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝",
|
|
30
|
+
" ██║██████╔╝██║ ██║ ██║██║ ██║█████╗",
|
|
31
|
+
"██ ██║██╔═══╝ ██║ ██║ ██║██║ ██║██╔══╝",
|
|
32
|
+
"╚█████╔╝██║ ╚██████╔╝██████╔╝██████╔╝███████╗",
|
|
33
|
+
" ╚════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝",
|
|
34
34
|
]
|
|
35
35
|
|
|
36
|
+
// Gradiente vertical por fila: arriba más claro, abajo más oscuro (como el
|
|
37
|
+
// Header del plugin jpcode: top = tint hacia blanco 0.35, bottom = hacia negro 0.4)
|
|
38
|
+
const GRADIENT = [
|
|
39
|
+
"\x1b[38;5;117m", // arriba: naranja claro
|
|
40
|
+
"\x1b[38;5;215m",
|
|
41
|
+
"\x1b[38;5;214m",
|
|
42
|
+
"\x1b[38;5;208m",
|
|
43
|
+
"\x1b[38;5;202m",
|
|
44
|
+
"\x1b[38;5;166m", // abajo: naranja profundo
|
|
45
|
+
]
|
|
46
|
+
const RESET = "\x1b[0m"
|
|
47
|
+
const DIM = "\x1b[2m"
|
|
48
|
+
const BOLD = "\x1b[1m"
|
|
49
|
+
|
|
36
50
|
function printBanner(sub) {
|
|
37
51
|
console.log("")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
const sideLabel = sub ? ` >_ ${sub}` : ""
|
|
53
|
+
BANNER.forEach((line, i) => {
|
|
54
|
+
console.log(`${GRADIENT[i]}${line}${RESET}`)
|
|
55
|
+
})
|
|
56
|
+
console.log("")
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// UI: panel de info estilo plugin (>_ JpCode (vX) | modelo | directorio)
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
let APP_VERSION = "2.0.1"
|
|
64
|
+
let MODEL_LABEL = ""
|
|
65
|
+
|
|
66
|
+
function printHeader() {
|
|
67
|
+
const border = C.dim("─".repeat(46))
|
|
68
|
+
console.log(border)
|
|
69
|
+
console.log(
|
|
70
|
+
` ${C.accent(C.bold(">_ JpCode"))} ${C.dim(`(v${APP_VERSION})`)}${MODEL_LABEL ? C.dim(" · " + MODEL_LABEL) : ""}`,
|
|
71
|
+
)
|
|
72
|
+
console.log(C.dim(` ${process.cwd()}`))
|
|
73
|
+
console.log(border)
|
|
41
74
|
console.log("")
|
|
42
75
|
}
|
|
43
76
|
|
|
77
|
+
async function fetchModelLabel(client) {
|
|
78
|
+
try {
|
|
79
|
+
const cfg = await client.config.get()
|
|
80
|
+
const m = cfg.data?.model
|
|
81
|
+
if (m) return String(m)
|
|
82
|
+
const providers = await client.config.providers()
|
|
83
|
+
const def = providers.data?.find?.((p) => p.id === "opencode")
|
|
84
|
+
if (def) return "JpCode Zen"
|
|
85
|
+
} catch {}
|
|
86
|
+
return ""
|
|
87
|
+
}
|
|
88
|
+
|
|
44
89
|
// ---------------------------------------------------------------------------
|
|
45
90
|
// Motor opencode como backend
|
|
46
91
|
// ---------------------------------------------------------------------------
|
|
@@ -139,8 +184,10 @@ function watchEvents(base, handlers) {
|
|
|
139
184
|
// ---------------------------------------------------------------------------
|
|
140
185
|
|
|
141
186
|
async function interactive(client, base) {
|
|
142
|
-
printBanner(
|
|
143
|
-
|
|
187
|
+
printBanner()
|
|
188
|
+
MODEL_LABEL = await fetchModelLabel(client)
|
|
189
|
+
printHeader()
|
|
190
|
+
console.log(C.dim(" ctrl+c salir · /help comandos"))
|
|
144
191
|
console.log("")
|
|
145
192
|
|
|
146
193
|
let sessionID = null
|
|
@@ -191,7 +238,8 @@ async function interactive(client, base) {
|
|
|
191
238
|
}
|
|
192
239
|
if (input === "/clear") {
|
|
193
240
|
console.clear()
|
|
194
|
-
printBanner(
|
|
241
|
+
printBanner()
|
|
242
|
+
printHeader()
|
|
195
243
|
rl.prompt(true)
|
|
196
244
|
return
|
|
197
245
|
}
|
|
@@ -273,14 +321,15 @@ async function oneShot(client, base, prompt) {
|
|
|
273
321
|
async function main() {
|
|
274
322
|
const args = process.argv.slice(2)
|
|
275
323
|
if (args.includes("--help") || args.includes("-h")) {
|
|
276
|
-
printBanner(
|
|
277
|
-
console.log("
|
|
278
|
-
console.log(
|
|
279
|
-
console.log("
|
|
324
|
+
printBanner()
|
|
325
|
+
console.log(` ${C.bold("jpcode")} REPL interactivo`)
|
|
326
|
+
console.log(` ${C.bold('jpcode "pregunta"')} respuesta one-shot`)
|
|
327
|
+
console.log(` ${C.bold("jpcode --version")} versión`)
|
|
328
|
+
console.log("")
|
|
280
329
|
process.exit(0)
|
|
281
330
|
}
|
|
282
331
|
if (args.includes("--version") || args.includes("-v")) {
|
|
283
|
-
console.log(
|
|
332
|
+
console.log(APP_VERSION)
|
|
284
333
|
process.exit(0)
|
|
285
334
|
}
|
|
286
335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soyjuanpiece/jpcode",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "JpCode — CLI propio con diseño estilo Claude Code, potenciado nativamente por el motor opencode. Tu interfaz, su inteligencia.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"opencode",
|
|
34
34
|
"terminal"
|
|
35
35
|
]
|
|
36
|
-
}
|
|
36
|
+
}
|