@nookplot/cli 0.7.33 → 0.7.35
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/dist/commands/init.js +9 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/listen.js +24 -2
- package/dist/commands/listen.js.map +1 -1
- package/dist/commands/mine.js +11 -1
- package/dist/commands/mine.js.map +1 -1
- package/dist/commands/online.js +7 -1
- package/dist/commands/online.js.map +1 -1
- package/dist/config.d.ts +32 -0
- package/dist/config.js +78 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +0 -38
- package/dist/index.js.map +1 -1
- package/dist/skillGenerator.d.ts +1 -1
- package/dist/skillGenerator.js +1 -1
- package/dist/skillGenerator.js.map +1 -1
- package/dist/tool-manifest.json +75 -177
- package/dist/utils/agentLoop.d.ts +10 -0
- package/dist/utils/agentLoop.js +16 -46
- package/dist/utils/agentLoop.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/forge.d.ts +0 -15
- package/dist/commands/forge.js +0 -187
- package/dist/commands/forge.js.map +0 -1
- package/dist/commands/profile.d.ts +0 -33
- package/dist/commands/profile.js +0 -472
- package/dist/commands/profile.js.map +0 -1
- package/dist/commands/swarms.d.ts +0 -14
- package/dist/commands/swarms.js +0 -203
- package/dist/commands/swarms.js.map +0 -1
package/dist/commands/profile.js
DELETED
|
@@ -1,472 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nookplot profile` — per-forged-agent profile management.
|
|
3
|
-
*
|
|
4
|
-
* Each forged agent gets its own profile at
|
|
5
|
-
* `~/.nookplot/profiles/<name>/profile.json`. The shared API key lives
|
|
6
|
-
* at `~/.nookplot/credentials.json` (stable, unchanged by profiles).
|
|
7
|
-
* Switching profiles is just setting `NOOKPLOT_PROFILE` env — or using
|
|
8
|
-
* `nookplot profile use <name>` to set a sticky default.
|
|
9
|
-
*
|
|
10
|
-
* Subcommands (mirror Hermes's `hermes profile` UX):
|
|
11
|
-
* nookplot profile list — show all profiles with scope + default
|
|
12
|
-
* nookplot profile current — which profile is active right now?
|
|
13
|
-
* nookplot profile use <name> — set sticky default (writes ~/.nookplot/active-profile)
|
|
14
|
-
* nookplot profile use --clear — back to unscoped (creator-direct) mode
|
|
15
|
-
* nookplot profile create <name> <addr> — register a new profile manually
|
|
16
|
-
* nookplot profile delete <name> — remove a profile (creds untouched)
|
|
17
|
-
* nookplot profile show <name> — inspect one profile's details
|
|
18
|
-
*
|
|
19
|
-
* @module commands/profile
|
|
20
|
-
*/
|
|
21
|
-
import chalk from "chalk";
|
|
22
|
-
import { existsSync, readFileSync, writeFileSync, rmSync, mkdirSync, renameSync, unlinkSync, chmodSync } from "node:fs";
|
|
23
|
-
import { homedir } from "node:os";
|
|
24
|
-
import { join } from "node:path";
|
|
25
|
-
/**
|
|
26
|
-
* Atomic write — mirrors the pattern in mcp-server/src/auth.ts. Write to
|
|
27
|
-
* `${path}.tmp`, chmod, then rename. Rename is atomic on POSIX + NTFS, so
|
|
28
|
-
* a concurrent reader (e.g. a parallel MCP server) can never see a truncated
|
|
29
|
-
* file. If the process dies between writeFileSync and renameSync, the
|
|
30
|
-
* ORIGINAL file is untouched — no data loss.
|
|
31
|
-
*
|
|
32
|
-
* Critical for `active-profile` (sticky default) and `profile.json`:
|
|
33
|
-
* without this, a crash mid-write silently clears the user's profile
|
|
34
|
-
* scope on the next `loadProfile` call.
|
|
35
|
-
*/
|
|
36
|
-
function writeFileAtomic(path, content, mode = 0o600) {
|
|
37
|
-
const tmp = `${path}.tmp`;
|
|
38
|
-
writeFileSync(tmp, content, { encoding: "utf-8", mode });
|
|
39
|
-
try {
|
|
40
|
-
chmodSync(tmp, mode);
|
|
41
|
-
}
|
|
42
|
-
catch { /* Windows */ }
|
|
43
|
-
try {
|
|
44
|
-
renameSync(tmp, path);
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
try {
|
|
48
|
-
unlinkSync(tmp);
|
|
49
|
-
}
|
|
50
|
-
catch { /* best effort */ }
|
|
51
|
-
throw err;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// Match Hermes's profile-name rule so the two systems can share slugs
|
|
55
|
-
// (a user whose Hermes profile is "jeff-researcher" also gets
|
|
56
|
-
// `~/.nookplot/profiles/jeff-researcher/`).
|
|
57
|
-
const PROFILE_NAME_RE = /^[a-z][a-z0-9-]{0,30}[a-z0-9]$/;
|
|
58
|
-
const ADDRESS_RE = /^0x[a-fA-F0-9]{40}$/;
|
|
59
|
-
function nookplotDir() {
|
|
60
|
-
return join(homedir(), ".nookplot");
|
|
61
|
-
}
|
|
62
|
-
function activeProfilePath() {
|
|
63
|
-
return join(nookplotDir(), "active-profile");
|
|
64
|
-
}
|
|
65
|
-
function profilesDir() {
|
|
66
|
-
return join(nookplotDir(), "profiles");
|
|
67
|
-
}
|
|
68
|
-
function profileFile(name) {
|
|
69
|
-
return join(profilesDir(), name, "profile.json");
|
|
70
|
-
}
|
|
71
|
-
function loadProfileSync(name) {
|
|
72
|
-
const path = profileFile(name);
|
|
73
|
-
if (!existsSync(path))
|
|
74
|
-
return null;
|
|
75
|
-
try {
|
|
76
|
-
const raw = JSON.parse(readFileSync(path, "utf-8"));
|
|
77
|
-
if (typeof raw.scopedAgentAddress !== "string")
|
|
78
|
-
return null;
|
|
79
|
-
return raw;
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function saveProfileSync(name, profile) {
|
|
86
|
-
const dir = join(profilesDir(), name);
|
|
87
|
-
if (!existsSync(dir))
|
|
88
|
-
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
89
|
-
writeFileAtomic(profileFile(name), JSON.stringify({ ...profile, createdAt: profile.createdAt ?? new Date().toISOString() }, null, 2) + "\n");
|
|
90
|
-
}
|
|
91
|
-
function listProfilesSync() {
|
|
92
|
-
if (!existsSync(profilesDir()))
|
|
93
|
-
return [];
|
|
94
|
-
const out = [];
|
|
95
|
-
try {
|
|
96
|
-
const entries = require("node:fs").readdirSync(profilesDir());
|
|
97
|
-
for (const name of entries.sort()) {
|
|
98
|
-
const p = loadProfileSync(name);
|
|
99
|
-
if (p)
|
|
100
|
-
out.push({ name, profile: p });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch {
|
|
104
|
-
/* ignore */
|
|
105
|
-
}
|
|
106
|
-
return out;
|
|
107
|
-
}
|
|
108
|
-
function getActiveProfile() {
|
|
109
|
-
// Priority: NOOKPLOT_PROFILE env var > sticky default > null
|
|
110
|
-
const env = process.env.NOOKPLOT_PROFILE;
|
|
111
|
-
if (env)
|
|
112
|
-
return env;
|
|
113
|
-
if (existsSync(activeProfilePath())) {
|
|
114
|
-
try {
|
|
115
|
-
const content = readFileSync(activeProfilePath(), "utf-8").trim();
|
|
116
|
-
if (content)
|
|
117
|
-
return content;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
/* ignore */
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
function setActiveProfile(name) {
|
|
126
|
-
if (name === null) {
|
|
127
|
-
if (existsSync(activeProfilePath()))
|
|
128
|
-
rmSync(activeProfilePath());
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
if (!existsSync(nookplotDir()))
|
|
132
|
-
mkdirSync(nookplotDir(), { recursive: true, mode: 0o700 });
|
|
133
|
-
// Atomic: tmp+rename so a crash mid-write never leaves an empty
|
|
134
|
-
// active-profile file (which would silently clear the sticky default
|
|
135
|
-
// without the user realizing they'd lost their scope).
|
|
136
|
-
writeFileAtomic(activeProfilePath(), name + "\n");
|
|
137
|
-
}
|
|
138
|
-
// ── Registrations ───────────────────────────────────────────
|
|
139
|
-
export function registerProfileCommand(program) {
|
|
140
|
-
const profile = program
|
|
141
|
-
.command("profile")
|
|
142
|
-
.description("Manage per-agent profiles (multi-agent support)")
|
|
143
|
-
.addHelpText("after", `
|
|
144
|
-
${chalk.bold("Examples:")}
|
|
145
|
-
${chalk.cyan("nookplot profile list")} Show all forged agents on this machine
|
|
146
|
-
${chalk.cyan("nookplot profile use researcher")} Set sticky default to the researcher profile
|
|
147
|
-
${chalk.cyan("NOOKPLOT_PROFILE=writer nookplot sync")} One-off scope override
|
|
148
|
-
|
|
149
|
-
${chalk.bold("How profiles work:")}
|
|
150
|
-
Your creator API key at ~/.nookplot/credentials.json stays the same —
|
|
151
|
-
one key, one account. Profiles only record which forged agent this
|
|
152
|
-
command should act AS (via scopedAgentAddress). Creating/deleting
|
|
153
|
-
profiles never touches your API key.
|
|
154
|
-
|
|
155
|
-
${chalk.bold("How to make a profile:")}
|
|
156
|
-
The easiest way is through the web installer when you forge an agent —
|
|
157
|
-
it writes the profile automatically. To register an existing agent as
|
|
158
|
-
a profile manually:
|
|
159
|
-
${chalk.cyan("nookplot profile create <name> <agent-address>")}
|
|
160
|
-
`);
|
|
161
|
-
// ── list ──
|
|
162
|
-
profile
|
|
163
|
-
.command("list")
|
|
164
|
-
.alias("ls")
|
|
165
|
-
.description("List all profiles on this machine")
|
|
166
|
-
.action(() => {
|
|
167
|
-
const profiles = listProfilesSync();
|
|
168
|
-
const active = getActiveProfile();
|
|
169
|
-
if (profiles.length === 0) {
|
|
170
|
-
console.log(chalk.dim("\n No profiles yet.\n"));
|
|
171
|
-
console.log(` Forge an agent at ${chalk.cyan("https://nookplot.com/forge")} and run the install command.`);
|
|
172
|
-
console.log(` Or manually register an existing agent: ${chalk.cyan("nookplot profile create <name> <addr>")}\n`);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
console.log("");
|
|
176
|
-
console.log(chalk.bold(" Profiles"));
|
|
177
|
-
console.log(chalk.dim(" ────────"));
|
|
178
|
-
for (const { name, profile: p } of profiles) {
|
|
179
|
-
const isActive = name === active;
|
|
180
|
-
const marker = isActive ? chalk.green("◆") : " ";
|
|
181
|
-
const nameCol = isActive ? chalk.bold(name) : name;
|
|
182
|
-
const display = p.displayName ? chalk.dim(` (${p.displayName})`) : "";
|
|
183
|
-
const addr = chalk.dim(` ${p.scopedAgentAddress.slice(0, 10)}...${p.scopedAgentAddress.slice(-4)}`);
|
|
184
|
-
const hermes = p.hermesProfile ? chalk.dim(` [hermes: ${p.hermesProfile}]`) : "";
|
|
185
|
-
console.log(` ${marker} ${nameCol}${display}${addr}${hermes}`);
|
|
186
|
-
}
|
|
187
|
-
console.log("");
|
|
188
|
-
if (active) {
|
|
189
|
-
console.log(` ${chalk.green("◆")} Active profile: ${chalk.bold(active)}`);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
console.log(` ${chalk.dim("(No active profile — running as creator directly)")}`);
|
|
193
|
-
}
|
|
194
|
-
console.log("");
|
|
195
|
-
console.log(chalk.dim(" nookplot profile use <name> — switch"));
|
|
196
|
-
console.log(chalk.dim(" nookplot profile use --clear — back to creator"));
|
|
197
|
-
console.log("");
|
|
198
|
-
});
|
|
199
|
-
// ── current ──
|
|
200
|
-
profile
|
|
201
|
-
.command("current")
|
|
202
|
-
.description("Show which profile is active")
|
|
203
|
-
.action(() => {
|
|
204
|
-
const active = getActiveProfile();
|
|
205
|
-
if (!active) {
|
|
206
|
-
console.log(chalk.dim("\n No active profile — running as creator directly.\n"));
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
const p = loadProfileSync(active);
|
|
210
|
-
if (!p) {
|
|
211
|
-
console.log(chalk.yellow(`\n Active profile '${active}' is set but profile.json is missing.`));
|
|
212
|
-
console.log(chalk.dim(` Falling back to creator-direct mode on next command.\n`));
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
console.log(`\n Active: ${chalk.bold(active)}`);
|
|
216
|
-
if (p.displayName)
|
|
217
|
-
console.log(` Agent: ${p.displayName}`);
|
|
218
|
-
console.log(` Scope: ${p.scopedAgentAddress}`);
|
|
219
|
-
if (p.hermesProfile)
|
|
220
|
-
console.log(` Hermes: ${chalk.cyan(p.hermesProfile + " chat")}`);
|
|
221
|
-
console.log("");
|
|
222
|
-
});
|
|
223
|
-
// ── use <name> ──
|
|
224
|
-
// Sets the sticky default for BOTH:
|
|
225
|
-
// 1. Nookplot scope (~/.nookplot/active-profile) — picked up by every
|
|
226
|
-
// MCP-based editor (Cursor, Claude Code, Windsurf, VS Code, Codex)
|
|
227
|
-
// that shares a single MCP server entry without per-agent env vars.
|
|
228
|
-
// 2. Hermes default (`hermes profile use <name>`) — so plain
|
|
229
|
-
// `hermes chat` (no --profile flag) routes to this agent too.
|
|
230
|
-
// This is the "switch which forged agent is my main" command. Both
|
|
231
|
-
// surfaces stay in sync — one toggle, two side effects.
|
|
232
|
-
profile
|
|
233
|
-
.command("use [name]")
|
|
234
|
-
.description("Set sticky default profile (pass --clear to reset). Updates both editor scope AND `hermes chat` default.")
|
|
235
|
-
.option("--clear", "Clear the active profile — back to creator-direct mode")
|
|
236
|
-
.action((name, opts) => {
|
|
237
|
-
if (opts.clear) {
|
|
238
|
-
setActiveProfile(null);
|
|
239
|
-
// We deliberately DON'T clear Hermes default here — the user might
|
|
240
|
-
// have a non-Nookplot Hermes profile they want to keep as default.
|
|
241
|
-
// If they need to reset Hermes too, they can run `hermes profile use`
|
|
242
|
-
// manually. (Verified hermes profile use exists via `hermes profile --help`.)
|
|
243
|
-
console.log(chalk.green("\n ✓") + " Active profile cleared. Commands run as creator.");
|
|
244
|
-
console.log(chalk.dim(" (Hermes default left untouched — run `hermes profile use` manually if needed.)\n"));
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
if (!name) {
|
|
248
|
-
console.log(chalk.red("\n Error:") + " profile name required (or pass --clear)\n");
|
|
249
|
-
process.exit(1);
|
|
250
|
-
}
|
|
251
|
-
if (!PROFILE_NAME_RE.test(name)) {
|
|
252
|
-
console.log(chalk.red(`\n Invalid profile name '${name}'.`));
|
|
253
|
-
console.log(chalk.dim(" Must match /^[a-z][a-z0-9-]{0,30}[a-z0-9]$/ — lowercase alnum + hyphens.\n"));
|
|
254
|
-
process.exit(1);
|
|
255
|
-
}
|
|
256
|
-
if (!loadProfileSync(name)) {
|
|
257
|
-
console.log(chalk.red(`\n Profile '${name}' doesn't exist.`));
|
|
258
|
-
console.log(chalk.dim(` Create it with: ${chalk.cyan("nookplot profile create " + name + " <addr>")}\n`));
|
|
259
|
-
process.exit(1);
|
|
260
|
-
}
|
|
261
|
-
setActiveProfile(name);
|
|
262
|
-
// Also update Hermes default if Hermes is installed. Best-effort —
|
|
263
|
-
// failure here doesn't undo the Nookplot side. Users without Hermes
|
|
264
|
-
// (CLI-only setup) get a clean message saying we only updated editor
|
|
265
|
-
// scope.
|
|
266
|
-
//
|
|
267
|
-
// SECURITY: use execFileSync (NOT execSync with a template string) so
|
|
268
|
-
// the `name` arg goes directly to the hermes binary as argv[2] without
|
|
269
|
-
// ever touching a shell. Even though PROFILE_NAME_RE above forbids
|
|
270
|
-
// shell metacharacters, this is defense-in-depth: if the regex ever
|
|
271
|
-
// weakens, no execSync injection vector opens up. argv-array form
|
|
272
|
-
// also doesn't depend on which shell is on PATH (sh/bash/zsh/dash).
|
|
273
|
-
let hermesUpdated = false;
|
|
274
|
-
try {
|
|
275
|
-
const { execFileSync } = require("node:child_process");
|
|
276
|
-
try {
|
|
277
|
-
execFileSync("hermes", ["profile", "use", name], {
|
|
278
|
-
stdio: ["ignore", "ignore", "ignore"],
|
|
279
|
-
});
|
|
280
|
-
hermesUpdated = true;
|
|
281
|
-
}
|
|
282
|
-
catch {
|
|
283
|
-
// Hermes not installed (ENOENT) OR `profile use` not supported on
|
|
284
|
-
// this version (non-zero exit). Either way, silently degrade.
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
catch {
|
|
288
|
-
// require() itself failed — extremely unlikely in Node 18+.
|
|
289
|
-
}
|
|
290
|
-
console.log(chalk.green("\n ✓") + ` Active profile set to ${chalk.bold(name)}.`);
|
|
291
|
-
console.log(chalk.dim(` Editor scope: ${chalk.cyan("Cursor / Claude Code / Windsurf / VS Code / Codex")} now scope to this agent (restart to pick up).`));
|
|
292
|
-
if (hermesUpdated) {
|
|
293
|
-
console.log(chalk.dim(` Hermes default: ${chalk.cyan("hermes chat")} will now run this agent.`));
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
console.log(chalk.dim(` Hermes default: not updated (Hermes not detected). Use ${chalk.cyan(`hermes --profile ${name} chat`)} to scope manually.`));
|
|
297
|
-
}
|
|
298
|
-
console.log("");
|
|
299
|
-
});
|
|
300
|
-
// ── create <name> <address> ──
|
|
301
|
-
profile
|
|
302
|
-
.command("create <name> <address>")
|
|
303
|
-
.description("Register a new profile — writes ~/.nookplot/profiles/<name>/profile.json")
|
|
304
|
-
.option("--display-name <text>", "Human-readable name for the profile")
|
|
305
|
-
.option("--hermes-profile <name>", "Link to an existing Hermes profile")
|
|
306
|
-
.action((name, address, opts) => {
|
|
307
|
-
if (!PROFILE_NAME_RE.test(name)) {
|
|
308
|
-
console.log(chalk.red(`\n Invalid profile name '${name}'.`));
|
|
309
|
-
console.log(chalk.dim(" Must match /^[a-z][a-z0-9-]{0,30}[a-z0-9]$/.\n"));
|
|
310
|
-
process.exit(1);
|
|
311
|
-
}
|
|
312
|
-
if (!ADDRESS_RE.test(address)) {
|
|
313
|
-
console.log(chalk.red(`\n Invalid address '${address}' — must be 0x + 40 hex chars.\n`));
|
|
314
|
-
process.exit(1);
|
|
315
|
-
}
|
|
316
|
-
if (loadProfileSync(name)) {
|
|
317
|
-
console.log(chalk.yellow(`\n Profile '${name}' already exists. Use 'profile show ${name}' to inspect.`));
|
|
318
|
-
console.log(chalk.dim(" To overwrite, delete first with 'profile delete'.\n"));
|
|
319
|
-
process.exit(1);
|
|
320
|
-
}
|
|
321
|
-
saveProfileSync(name, {
|
|
322
|
-
scopedAgentAddress: address.toLowerCase(),
|
|
323
|
-
displayName: opts.displayName,
|
|
324
|
-
hermesProfile: opts.hermesProfile,
|
|
325
|
-
});
|
|
326
|
-
console.log(chalk.green("\n ✓") + ` Profile ${chalk.bold(name)} created.`);
|
|
327
|
-
console.log(chalk.dim(` Scope: ${address.slice(0, 10)}...`));
|
|
328
|
-
console.log(chalk.dim(` Activate: ${chalk.cyan("nookplot profile use " + name)}\n`));
|
|
329
|
-
});
|
|
330
|
-
// ── delete <name> ──
|
|
331
|
-
profile
|
|
332
|
-
.command("delete <name>")
|
|
333
|
-
.alias("rm")
|
|
334
|
-
.description("Delete a profile (credentials.json untouched)")
|
|
335
|
-
.action((name) => {
|
|
336
|
-
if (!loadProfileSync(name)) {
|
|
337
|
-
console.log(chalk.yellow(`\n Profile '${name}' doesn't exist.\n`));
|
|
338
|
-
process.exit(1);
|
|
339
|
-
}
|
|
340
|
-
const dir = join(profilesDir(), name);
|
|
341
|
-
rmSync(dir, { recursive: true, force: true });
|
|
342
|
-
// If this was the active profile, clear the sticky default.
|
|
343
|
-
if (getActiveProfile() === name)
|
|
344
|
-
setActiveProfile(null);
|
|
345
|
-
console.log(chalk.green("\n ✓") + ` Profile ${chalk.bold(name)} deleted.`);
|
|
346
|
-
console.log(chalk.dim(` Your API key (~/.nookplot/credentials.json) was not touched.\n`));
|
|
347
|
-
});
|
|
348
|
-
// ── show <name> ──
|
|
349
|
-
profile
|
|
350
|
-
.command("show <name>")
|
|
351
|
-
.description("Inspect a profile's details")
|
|
352
|
-
.action((name) => {
|
|
353
|
-
const p = loadProfileSync(name);
|
|
354
|
-
if (!p) {
|
|
355
|
-
console.log(chalk.red(`\n Profile '${name}' doesn't exist.\n`));
|
|
356
|
-
process.exit(1);
|
|
357
|
-
}
|
|
358
|
-
console.log(`\n ${chalk.bold("Profile:")} ${name}`);
|
|
359
|
-
if (p.displayName)
|
|
360
|
-
console.log(` ${chalk.bold("Display name:")} ${p.displayName}`);
|
|
361
|
-
console.log(` ${chalk.bold("Agent address:")} ${p.scopedAgentAddress}`);
|
|
362
|
-
if (p.hermesProfile)
|
|
363
|
-
console.log(` ${chalk.bold("Hermes profile:")} ${chalk.cyan(p.hermesProfile)}`);
|
|
364
|
-
if (p.createdAt)
|
|
365
|
-
console.log(` ${chalk.bold("Created:")} ${p.createdAt}`);
|
|
366
|
-
console.log(` ${chalk.bold("File:")} ${profileFile(name)}`);
|
|
367
|
-
console.log("");
|
|
368
|
-
});
|
|
369
|
-
// ── prune ──
|
|
370
|
-
// Walk every local profile, ask the gateway whether the agent is still
|
|
371
|
-
// active on-chain, and report (or remove) the orphans.
|
|
372
|
-
//
|
|
373
|
-
// Use case: a user deactivates an agent on the website, but the local
|
|
374
|
-
// profile + Hermes alias persist. `<slug> chat` still launches but every
|
|
375
|
-
// MCP call 403s with "agent not found" — confusing failure mode. This
|
|
376
|
-
// command surfaces those orphans + lets the user clean up in one go.
|
|
377
|
-
profile
|
|
378
|
-
.command("prune")
|
|
379
|
-
.description("Find and remove local profiles whose on-chain agent is no longer active")
|
|
380
|
-
.option("--yes", "Don't prompt — remove orphans automatically")
|
|
381
|
-
.option("--gateway <url>", "Override gateway URL (default: from credentials.json)")
|
|
382
|
-
.action(async (opts) => {
|
|
383
|
-
const profiles = listProfilesSync();
|
|
384
|
-
if (profiles.length === 0) {
|
|
385
|
-
console.log(chalk.dim("\n No profiles registered. Nothing to prune.\n"));
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
// Resolve gateway URL — try CLI flag, env, then credentials.json.
|
|
389
|
-
let gatewayUrl = opts.gateway ?? process.env.NOOKPLOT_GATEWAY_URL;
|
|
390
|
-
if (!gatewayUrl) {
|
|
391
|
-
try {
|
|
392
|
-
const credsPath = join(nookplotDir(), "credentials.json");
|
|
393
|
-
if (existsSync(credsPath)) {
|
|
394
|
-
const creds = JSON.parse(readFileSync(credsPath, "utf-8"));
|
|
395
|
-
gatewayUrl = creds.gatewayUrl;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
catch { /* fall through */ }
|
|
399
|
-
}
|
|
400
|
-
gatewayUrl = (gatewayUrl ?? "https://gateway.nookplot.com").replace(/\/+$/, "");
|
|
401
|
-
console.log(chalk.bold(`\n Checking ${profiles.length} profile(s) against ${gatewayUrl}...\n`));
|
|
402
|
-
const orphans = [];
|
|
403
|
-
for (const { name, profile: p } of profiles) {
|
|
404
|
-
try {
|
|
405
|
-
const res = await fetch(`${gatewayUrl}/v1/agents/${p.scopedAgentAddress}/profile`);
|
|
406
|
-
if (res.status === 404) {
|
|
407
|
-
orphans.push({ name, address: p.scopedAgentAddress, reason: "not found on gateway" });
|
|
408
|
-
}
|
|
409
|
-
else if (res.ok) {
|
|
410
|
-
const body = await res.json();
|
|
411
|
-
const active = body.isActive ?? body.is_active ?? true;
|
|
412
|
-
if (!active) {
|
|
413
|
-
orphans.push({ name, address: p.scopedAgentAddress, reason: "marked inactive" });
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
console.log(chalk.green(" ✓") + ` ${name} → ${p.scopedAgentAddress.slice(0, 10)}... active`);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
// 5xx or other transient — don't claim orphan, just skip.
|
|
421
|
-
console.log(chalk.yellow(" ?") + ` ${name} → check failed (HTTP ${res.status}), skipped`);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
catch (err) {
|
|
425
|
-
// Network error — skip rather than mistakenly prune.
|
|
426
|
-
console.log(chalk.yellow(" ?") + ` ${name} → network error, skipped (${err instanceof Error ? err.message : String(err)})`);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
if (orphans.length === 0) {
|
|
430
|
-
console.log(chalk.green("\n All profiles are active. Nothing to prune.\n"));
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
console.log(chalk.yellow(`\n Found ${orphans.length} orphan profile(s):`));
|
|
434
|
-
for (const o of orphans) {
|
|
435
|
-
console.log(chalk.yellow(" ⚠ ") + `${o.name} → ${o.address.slice(0, 10)}... (${o.reason})`);
|
|
436
|
-
}
|
|
437
|
-
if (!opts.yes) {
|
|
438
|
-
console.log(chalk.dim(`\n Re-run with ${chalk.cyan("nookplot profile prune --yes")} to remove these orphans.\n`));
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
// --yes given: remove each orphan + clear sticky default if it pointed at one.
|
|
442
|
-
const activeProfile = getActiveProfile();
|
|
443
|
-
let removed = 0;
|
|
444
|
-
for (const o of orphans) {
|
|
445
|
-
try {
|
|
446
|
-
rmSync(join(profilesDir(), o.name), { recursive: true, force: true });
|
|
447
|
-
if (activeProfile === o.name)
|
|
448
|
-
setActiveProfile(null);
|
|
449
|
-
removed++;
|
|
450
|
-
}
|
|
451
|
-
catch (err) {
|
|
452
|
-
console.log(chalk.red(" ✗") + ` Failed to remove ${o.name}: ${err instanceof Error ? err.message : String(err)}`);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
console.log(chalk.green(`\n ✓ Removed ${removed} orphan profile(s). Your API key was not touched.\n`));
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Helper exposed to other commands — returns the active profile's scope
|
|
460
|
-
* (or null if no profile is active). Used by commands that want to honor
|
|
461
|
-
* `--profile <name>` / NOOKPLOT_PROFILE / sticky default.
|
|
462
|
-
*/
|
|
463
|
-
export function getActiveProfileScope(opts) {
|
|
464
|
-
const name = opts?.explicitProfile ?? getActiveProfile();
|
|
465
|
-
if (!name)
|
|
466
|
-
return null;
|
|
467
|
-
const p = loadProfileSync(name);
|
|
468
|
-
if (!p)
|
|
469
|
-
return null;
|
|
470
|
-
return { profileName: name, scopedAgentAddress: p.scopedAgentAddress };
|
|
471
|
-
}
|
|
472
|
-
//# sourceMappingURL=profile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAA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BAAiB,OAAO,qDAAqD,CAAC,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAErC;IACC,MAAM,IAAI,GAAG,IAAI,EAAE,eAAe,IAAI,gBAAgB,EAAE,CAAC;IACzD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `nookplot swarm` — Multi-agent swarm coordination from the CLI.
|
|
3
|
-
*
|
|
4
|
-
* Subcommands:
|
|
5
|
-
* create — Create a new swarm with subtasks
|
|
6
|
-
* list — List swarms (filterable)
|
|
7
|
-
* show — Show swarm detail + subtask status
|
|
8
|
-
* claim — Claim an open subtask
|
|
9
|
-
* submit — Submit work for a claimed subtask
|
|
10
|
-
*
|
|
11
|
-
* @module commands/swarms
|
|
12
|
-
*/
|
|
13
|
-
import { Command } from "commander";
|
|
14
|
-
export declare function registerSwarmsCommand(program: Command): void;
|