benignswarm 0.12.24 → 0.12.25
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/admin-index.js +7 -0
- package/dist/commands/admin.js +3 -1
- package/dist/commands/operator.js +68 -1
- package/dist/config.js +3 -0
- package/dist/help.js +4 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/admin-index.js
CHANGED
|
@@ -3,10 +3,17 @@ import { bool, parse } from "./args.js";
|
|
|
3
3
|
import { admin } from "./commands/admin.js";
|
|
4
4
|
import { CliError } from "./errors.js";
|
|
5
5
|
import { ADMIN_HELP } from "./help.js";
|
|
6
|
+
import { AGENT_ORIENTATION } from "./commands/operator.js";
|
|
6
7
|
import { makeOut } from "./output.js";
|
|
7
8
|
import { CLI_VERSION } from "./version.js";
|
|
8
9
|
/** bschat-admin: the operator binary. Agents use bschat, whose help never lists these. */
|
|
9
10
|
async function main(argv) {
|
|
11
|
+
// For an AI agent driving this tool: what it is, and how to load the operator skill. Checked
|
|
12
|
+
// before parsing because --agent also takes a value elsewhere (notifier --agent <name>).
|
|
13
|
+
if (argv[0] === "--agent") {
|
|
14
|
+
process.stdout.write(AGENT_ORIENTATION);
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
10
17
|
const p = parse(argv);
|
|
11
18
|
const out = makeOut(bool(p.flags, "json"));
|
|
12
19
|
if (bool(p.flags, "version")) {
|
package/dist/commands/admin.js
CHANGED
|
@@ -6,7 +6,7 @@ import { hostname } from "node:os";
|
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
import { CliError } from "../errors.js";
|
|
8
8
|
import { table } from "../output.js";
|
|
9
|
-
import { accountAdmin, answerAdmin, keysAdmin, needsAdmin, notifierAdmin, processAdmin, tagList, worktreeAdmin } from "./operator.js";
|
|
9
|
+
import { accountAdmin, answerAdmin, keysAdmin, needsAdmin, notifierAdmin, processAdmin, skillAdmin, tagList, worktreeAdmin } from "./operator.js";
|
|
10
10
|
function adminClient(p) {
|
|
11
11
|
return Client.forAdmin(loadAdmin(resolveAdminName(str(p.flags, "admin"))));
|
|
12
12
|
}
|
|
@@ -76,6 +76,8 @@ export async function admin(p, out) {
|
|
|
76
76
|
return accountAdmin(p, out);
|
|
77
77
|
case "worktree":
|
|
78
78
|
return worktreeAdmin(action, rest, p, out);
|
|
79
|
+
case "skill":
|
|
80
|
+
return skillAdmin(action, p, out);
|
|
79
81
|
case "delete-account": {
|
|
80
82
|
const confirm = str(p.flags, "confirm");
|
|
81
83
|
if (confirm !== "delete everything")
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { DEFAULT_URL, listSaved } from "../config.js";
|
|
2
5
|
import { str } from "../args.js";
|
|
3
6
|
import { Client } from "../client.js";
|
|
4
7
|
import { loadAdmin, resolveAdminName } from "../config.js";
|
|
@@ -295,3 +298,67 @@ export async function worktreeAdmin(action, rest, p, out) {
|
|
|
295
298
|
throw new CliError("usage", "admin worktree forget <project> <record id from bschat worktrees --json> (deletes the record only, never the directory)");
|
|
296
299
|
out.print(`forgot worktree record ${id}`, await adminClient(p).call("DELETE", `/projects/${proj}/worktrees/${id}`));
|
|
297
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* For an AI agent asked to drive bschat-admin: what this is and how to load the full operator
|
|
303
|
+
* skill. Printed offline, so it works before sign-in.
|
|
304
|
+
*/
|
|
305
|
+
export const AGENT_ORIENTATION = `bschat-admin, for an AI agent helping a person run BenignSwarm
|
|
306
|
+
|
|
307
|
+
You are acting for the account's operator (a person), not as an agent in a project. BenignSwarm
|
|
308
|
+
coordinates their AI coding agents (Claude Code, Codex, Antigravity, DeepSeek, Gemini; any
|
|
309
|
+
machine) through work units, reviews by qualified roles, milestones and evidence. The agents use
|
|
310
|
+
\`bschat\`; you use \`bschat-admin\` to set projects up and keep them running.
|
|
311
|
+
|
|
312
|
+
Before acting, load the operator skill. It explains the philosophy, the setup interview, how to
|
|
313
|
+
design the process (tags, roles, merge policy, milestones), how each harness joins and is woken,
|
|
314
|
+
several machines, and how to recognise and fix stalls:
|
|
315
|
+
|
|
316
|
+
bschat-admin skill install # writes ~/.claude/skills/benignswarm-operator (Claude Code)
|
|
317
|
+
bschat-admin skill install --dir <path> # any other harness: a directory you will read from
|
|
318
|
+
bschat-admin skill print # or print SKILL.md and read it now
|
|
319
|
+
|
|
320
|
+
Then read references/setup.md and interview the operator before running anything. Rules that
|
|
321
|
+
matter from the start:
|
|
322
|
+
- Sign in with \`bschat-admin login\` (the operator approves it in their browser). Never ask for,
|
|
323
|
+
print or store admin or agent keys in chat or in committed files.
|
|
324
|
+
- Propose a process and get a yes before publishing it: a publish wakes every agent to re-read it.
|
|
325
|
+
- Ask before anything destructive (deleting a project, agent, key or account).
|
|
326
|
+
- You are not an agent in the project: never post as one, take units or approve work.
|
|
327
|
+
|
|
328
|
+
Commands: bschat-admin --help
|
|
329
|
+
`;
|
|
330
|
+
export async function skillAdmin(action, p, out) {
|
|
331
|
+
const saved = listSaved("admins");
|
|
332
|
+
const url = (process.env.BSCHAT_URL ?? (saved.length ? loadAdmin(resolveAdminName(str(p.flags, "admin"))).url : DEFAULT_URL)).replace(/\/$/, "");
|
|
333
|
+
const fetchText = async (path) => {
|
|
334
|
+
let res;
|
|
335
|
+
try {
|
|
336
|
+
res = await fetch(url + path);
|
|
337
|
+
}
|
|
338
|
+
catch (e) {
|
|
339
|
+
throw new CliError("network", `could not reach ${url}: ${e.message}`);
|
|
340
|
+
}
|
|
341
|
+
if (!res.ok)
|
|
342
|
+
throw new CliError("fetch_failed", `${url}${path} returned ${res.status}`);
|
|
343
|
+
return res.text();
|
|
344
|
+
};
|
|
345
|
+
if (action === "print") {
|
|
346
|
+
process.stdout.write(await fetchText("/skill/admin/SKILL.md"));
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (action === "install") {
|
|
350
|
+
const dir = str(p.flags, "dir") ?? join(homedir(), ".claude", "skills", "benignswarm-operator");
|
|
351
|
+
const main = await fetchText("/skill/admin/SKILL.md");
|
|
352
|
+
const refs = JSON.parse(await fetchText("/skill/admin/references")).references;
|
|
353
|
+
mkdirSync(join(dir, "references"), { recursive: true });
|
|
354
|
+
writeFileSync(join(dir, "SKILL.md"), main);
|
|
355
|
+
for (const f of refs) {
|
|
356
|
+
if (!/^[a-z0-9-]+\.md$/.test(f))
|
|
357
|
+
throw new CliError("bad_reference", `the server listed an unexpected reference name ${JSON.stringify(f)}`);
|
|
358
|
+
writeFileSync(join(dir, "references", f), await fetchText(`/skill/admin/references/${f}`));
|
|
359
|
+
}
|
|
360
|
+
out.print(`Installed the operator skill to ${dir} (SKILL.md and ${refs.length} references). Claude Code loads ~/.claude/skills automatically; for another harness, point it at that directory or paste SKILL.md into its instructions.`, { dir, references: refs });
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
throw new CliError("usage", "bschat-admin skill install [--dir <path>] | skill print");
|
|
364
|
+
}
|
package/dist/config.js
CHANGED
|
@@ -171,6 +171,9 @@ export function resolveAdminName(flag, env = process.env) {
|
|
|
171
171
|
const saved = listSaved("admins", env);
|
|
172
172
|
if (saved.length === 1)
|
|
173
173
|
return saved[0];
|
|
174
|
+
// bschat-admin login without --as saves under "default": that is the one meant when none is named.
|
|
175
|
+
if (saved.includes("default"))
|
|
176
|
+
return "default";
|
|
174
177
|
throw new CliError("no_admin", "BSCHAT_ADMIN is not set and --admin was not given", saved.length ? `Saved admin logins: ${saved.join(", ")}` : "Run: bschat-admin login --email <you@example.com>");
|
|
175
178
|
}
|
|
176
179
|
export function loadAdmin(name, env = process.env) {
|
package/dist/help.js
CHANGED
|
@@ -127,7 +127,8 @@ Agent commands
|
|
|
127
127
|
export const ADMIN_HELP = `bschat-admin: the operator's tools for BenignSwarm (benignswarm.org)
|
|
128
128
|
|
|
129
129
|
These act for the account's owner: projects, agents, invites, roles, the process, decisions
|
|
130
|
-
waiting on you. Agents use bschat and never need this.
|
|
130
|
+
waiting on you. Agents in projects use bschat and never need this. An AI agent driving this
|
|
131
|
+
tool should run bschat-admin --agent first, then install the operator skill. Sign in once per machine with
|
|
131
132
|
bschat-admin login (approve it in your signed-in browser); the session lasts 30 days, like the console's.
|
|
132
133
|
|
|
133
134
|
bschat-admin login [--as <nickname>] [--url <api>]
|
|
@@ -135,6 +136,8 @@ bschat-admin login (approve it in your signed-in browser); the session lasts 30
|
|
|
135
136
|
bschat-admin login --email <you@example.com> no signed-in browser at hand: approve by an emailed link instead
|
|
136
137
|
bschat-admin login --as <nickname> --key <bs_admin_...> for scripts and CI only (an admin key in a secret store)
|
|
137
138
|
bschat-admin logout [--as <nickname>] end the terminal session and forget it here
|
|
139
|
+
bschat-admin --agent for an AI agent driving this tool: what it is and how to load the operator skill
|
|
140
|
+
bschat-admin skill install [--dir <path>] | skill print the operator skill (default ~/.claude/skills/benignswarm-operator)
|
|
138
141
|
bschat-admin signup --url <api> --key <signup-code> <account-name> <email>
|
|
139
142
|
bschat-admin project create|list|delete <name>
|
|
140
143
|
bschat-admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.12.
|
|
1
|
+
export const CLI_VERSION = "0.12.25";
|