@agentprojectcontext/apx 1.2.0 → 1.3.0
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/package.json +1 -1
- package/src/cli/commands/setup.js +5 -9
- package/src/cli/index.js +4 -1
- package/src/core/mascot.js +124 -0
package/package.json
CHANGED
|
@@ -6,8 +6,9 @@ import fs from "node:fs";
|
|
|
6
6
|
import https from "node:https";
|
|
7
7
|
import http from "node:http";
|
|
8
8
|
import readline from "node:readline";
|
|
9
|
-
import { spawnSync
|
|
10
|
-
import { readConfig, writeConfig
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
10
|
+
import { readConfig, writeConfig } from "../../core/config.js";
|
|
11
|
+
import { mascot } from "../../core/mascot.js";
|
|
11
12
|
|
|
12
13
|
// ── ANSI helpers ──────────────────────────────────────────────────────────────
|
|
13
14
|
const c = {
|
|
@@ -93,13 +94,8 @@ const PROVIDERS = [
|
|
|
93
94
|
export async function cmdSetup() {
|
|
94
95
|
initRl();
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
console.log(
|
|
98
|
-
console.log(b(cy(" ║ APX Setup Wizard ║")));
|
|
99
|
-
console.log(b(cy(" ╚═══════════════════════════════════╝")));
|
|
100
|
-
console.log();
|
|
101
|
-
console.log(di(" This will configure the APX daemon and super-agent."));
|
|
102
|
-
console.log(di(" You can re-run `apx setup` at any time to change settings."));
|
|
97
|
+
mascot("wave", "Setup Wizard — configure daemon, model, and channels");
|
|
98
|
+
console.log(di(" Re-run `apx setup` anytime to change settings."));
|
|
103
99
|
console.log();
|
|
104
100
|
|
|
105
101
|
// ── Super-agent? ────────────────────────────────────────────────────────────
|
package/src/cli/index.js
CHANGED
|
@@ -74,6 +74,7 @@ import { cmdCommandList, cmdCommandShow } from "./commands/command.js";
|
|
|
74
74
|
import { cmdUpdate } from "./commands/update.js";
|
|
75
75
|
import { cmdSetup } from "./commands/setup.js";
|
|
76
76
|
import { checkForUpdate } from "../core/update-check.js";
|
|
77
|
+
import { mascot } from "../core/mascot.js";
|
|
77
78
|
import {
|
|
78
79
|
cmdRoutineList,
|
|
79
80
|
cmdRoutineGet,
|
|
@@ -246,7 +247,9 @@ function parseArgs(argv) {
|
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
function die(msg, code = 1) {
|
|
249
|
-
|
|
250
|
+
// Show panda mascot for user-facing errors
|
|
251
|
+
const isUnknown = msg.startsWith("unknown command") || msg.startsWith("unknown");
|
|
252
|
+
mascot(isUnknown ? "confused" : "sad", `apx: ${msg}`);
|
|
250
253
|
process.exit(code);
|
|
251
254
|
}
|
|
252
255
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// APX mascot — a panda that appears in different moods across the CLI.
|
|
2
|
+
// Usage: import { mascot } from '../core/mascot.js'; mascot('happy');
|
|
3
|
+
|
|
4
|
+
const R = "\x1b[0m";
|
|
5
|
+
const B = "\x1b[1m";
|
|
6
|
+
const W = "\x1b[97m"; // bright white
|
|
7
|
+
const K = "\x1b[30m"; // black
|
|
8
|
+
const BK = "\x1b[40m"; // bg black
|
|
9
|
+
const BW = "\x1b[47m"; // bg white
|
|
10
|
+
const CY = "\x1b[36m";
|
|
11
|
+
const YE = "\x1b[33m";
|
|
12
|
+
const GR = "\x1b[32m";
|
|
13
|
+
const RE = "\x1b[31m";
|
|
14
|
+
const DI = "\x1b[2m";
|
|
15
|
+
const BL = "\x1b[34m";
|
|
16
|
+
|
|
17
|
+
// Each mood: [panda lines, caption]
|
|
18
|
+
const MOODS = {
|
|
19
|
+
// ─── happy: default greeting / daemon started ────────────────────────────
|
|
20
|
+
happy: {
|
|
21
|
+
color: GR,
|
|
22
|
+
lines: [
|
|
23
|
+
` ${BK}${W} ▄███████▄ ${R}`,
|
|
24
|
+
` ${BK}${W} █ ${R}${B}██${R}${W} ${B}██${R}${BK}${W} █ ${R}`,
|
|
25
|
+
` ${BK}${W} █ ◕ ◕ █ ${R}`,
|
|
26
|
+
` ${BK}${W} █ ╰ω╯ █ ${R}`,
|
|
27
|
+
` ${BK}${W} ▀███████▀ ${R}`,
|
|
28
|
+
` ${DI} ╱ ╲ ╱ ╲ ${R}`,
|
|
29
|
+
],
|
|
30
|
+
caption: `${GR}${B}ready to go!${R}`,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// ─── wave: first run / setup ─────────────────────────────────────────────
|
|
34
|
+
wave: {
|
|
35
|
+
color: CY,
|
|
36
|
+
lines: [
|
|
37
|
+
` ${BK}${W} ▄███████▄ ${R} 👋`,
|
|
38
|
+
` ${BK}${W} █ ${R}${B}██${R}${W} ${B}██${R}${BK}${W} █ ${R}`,
|
|
39
|
+
` ${BK}${W} █ ◕ ◕ █ ${R}`,
|
|
40
|
+
` ${BK}${W} █ ╰▽╯ █ ${R}`,
|
|
41
|
+
` ${BK}${W} ▀███████▀ ${R}`,
|
|
42
|
+
` ${DI} ╱ ╲ ╱ ╲ ${R}`,
|
|
43
|
+
],
|
|
44
|
+
caption: `${CY}${B}APX — Agent Project Context${R}`,
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// ─── confused: unknown command / not found ────────────────────────────────
|
|
48
|
+
confused: {
|
|
49
|
+
color: YE,
|
|
50
|
+
lines: [
|
|
51
|
+
` ${BK}${W} ▄███████▄ ${R} ${YE}?${R}`,
|
|
52
|
+
` ${BK}${W} █ ${R}${B}██${R}${W} ${B}██${R}${BK}${W} █ ${R}`,
|
|
53
|
+
` ${BK}${W} █ ◔ ◔ █ ${R}`,
|
|
54
|
+
` ${BK}${W} █ ╰~╯ █ ${R}`,
|
|
55
|
+
` ${BK}${W} ▀███████▀ ${R}`,
|
|
56
|
+
` ${DI} ╱ ╲ ╱ ╲ ${R}`,
|
|
57
|
+
],
|
|
58
|
+
caption: `${YE}${B}hmm, I don't know that one${R}`,
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// ─── sad: error ───────────────────────────────────────────────────────────
|
|
62
|
+
sad: {
|
|
63
|
+
color: RE,
|
|
64
|
+
lines: [
|
|
65
|
+
` ${BK}${W} ▄███████▄ ${R}`,
|
|
66
|
+
` ${BK}${W} █ ${R}${B}██${R}${W} ${B}██${R}${BK}${W} █ ${R}`,
|
|
67
|
+
` ${BK}${W} █ ╥ ╥ █ ${R}`,
|
|
68
|
+
` ${BK}${W} █ ╰︵╯ █ ${R}`,
|
|
69
|
+
` ${BK}${W} ▀███████▀ ${R}`,
|
|
70
|
+
` ${DI} ╱ ╲ ╱ ╲ ${R}`,
|
|
71
|
+
],
|
|
72
|
+
caption: `${RE}${B}something went wrong${R}`,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
// ─── excited: update available ────────────────────────────────────────────
|
|
76
|
+
excited: {
|
|
77
|
+
color: BL,
|
|
78
|
+
lines: [
|
|
79
|
+
` ${BK}${W} ▄███████▄ ${R} ${BL}⬆${R}`,
|
|
80
|
+
` ${BK}${W} █ ${R}${B}██${R}${W} ${B}██${R}${BK}${W} █ ${R}`,
|
|
81
|
+
` ${BK}${W} █ ★ ★ █ ${R}`,
|
|
82
|
+
` ${BK}${W} █ ╰◡╯ █ ${R}`,
|
|
83
|
+
` ${BK}${W} ▀███████▀ ${R}`,
|
|
84
|
+
` ${DI} ╱ ╲ ╱ ╲ ${R}`,
|
|
85
|
+
],
|
|
86
|
+
caption: `${BL}${B}new version available!${R}`,
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// ─── sleeping: daemon not running ────────────────────────────────────────
|
|
90
|
+
sleeping: {
|
|
91
|
+
color: DI,
|
|
92
|
+
lines: [
|
|
93
|
+
` ${BK}${W} ▄███████▄ ${R} ${DI}z z z${R}`,
|
|
94
|
+
` ${BK}${W} █ ${R}${B}██${R}${W} ${B}██${R}${BK}${W} █ ${R}`,
|
|
95
|
+
` ${BK}${W} █ − − █ ${R}`,
|
|
96
|
+
` ${BK}${W} █ ╰_╯ █ ${R}`,
|
|
97
|
+
` ${BK}${W} ▀███████▀ ${R}`,
|
|
98
|
+
` ${DI} ╱ ╲ ╱ ╲ ${R}`,
|
|
99
|
+
],
|
|
100
|
+
caption: `${DI}${B}daemon is not running${R}`,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Print the mascot to stderr (doesn't interfere with piped output).
|
|
105
|
+
// mood: 'happy' | 'wave' | 'confused' | 'sad' | 'excited' | 'sleeping'
|
|
106
|
+
export function mascot(mood = "happy", message = "") {
|
|
107
|
+
const def = MOODS[mood] || MOODS.happy;
|
|
108
|
+
const out = [
|
|
109
|
+
"",
|
|
110
|
+
...def.lines,
|
|
111
|
+
` ${def.caption}`,
|
|
112
|
+
message ? ` ${def.color}${message}${R}` : "",
|
|
113
|
+
"",
|
|
114
|
+
].join("\n");
|
|
115
|
+
process.stderr.write(out + "\n");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// One-liner for inline use: mascot.confused("apx: unknown command: foo")
|
|
119
|
+
mascot.confused = (msg) => mascot("confused", msg);
|
|
120
|
+
mascot.sad = (msg) => mascot("sad", msg);
|
|
121
|
+
mascot.happy = (msg) => mascot("happy", msg);
|
|
122
|
+
mascot.wave = (msg) => mascot("wave", msg);
|
|
123
|
+
mascot.excited = (msg) => mascot("excited", msg);
|
|
124
|
+
mascot.sleeping = (msg) => mascot("sleeping", msg);
|