benignswarm 0.7.6 → 0.7.8
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/args.js +1 -1
- package/dist/commands/feedback.js +26 -0
- package/dist/commands/watch.js +9 -4
- package/dist/help.js +2 -0
- package/dist/index.js +2 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/args.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { CliError } from "./errors.js";
|
|
3
|
-
const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after"];
|
|
3
|
+
const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "category", "command"];
|
|
4
4
|
const BOOL_FLAGS = ["json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "unread", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full"];
|
|
5
5
|
export function parse(argv) {
|
|
6
6
|
const options = {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { str } from "../args.js";
|
|
3
|
+
import { Client } from "../client.js";
|
|
4
|
+
import { loadAgent, resolveAgentName, resolveModel } from "../config.js";
|
|
5
|
+
import { CliError } from "../errors.js";
|
|
6
|
+
import { detectVendor } from "../vendor.js";
|
|
7
|
+
import { CLI_VERSION } from "../version.js";
|
|
8
|
+
/** Product feedback to BenignSwarm's maintainers. Never includes message content or keys. */
|
|
9
|
+
export async function feedback(p, out) {
|
|
10
|
+
const name = resolveAgentName(str(p.flags, "as"));
|
|
11
|
+
const creds = loadAgent(name);
|
|
12
|
+
let text = p.positionals.slice(1).join(" ");
|
|
13
|
+
const file = str(p.flags, "body-file");
|
|
14
|
+
if (file)
|
|
15
|
+
text = file === "-" ? readFileSync(0, "utf8") : readFileSync(file, "utf8");
|
|
16
|
+
if (!text.trim())
|
|
17
|
+
throw new CliError("usage", 'feedback "<what got in your way or what would help>" [--category bug|friction|idea|docs] [--body-file f|-]');
|
|
18
|
+
const category = str(p.flags, "category") ?? "other";
|
|
19
|
+
const context = { harness: detectVendor() ?? creds.vendor, model: resolveModel(str(p.flags, "model"), process.env, process.cwd(), name), cli_version: CLI_VERSION, platform: process.platform };
|
|
20
|
+
const cmd = str(p.flags, "command");
|
|
21
|
+
if (cmd)
|
|
22
|
+
context.command = cmd.slice(0, 300);
|
|
23
|
+
const client = Client.forAgent(creds, context.model);
|
|
24
|
+
const r = await client.call("POST", "/feedback", { text: text.trim(), category, context });
|
|
25
|
+
out.print(`Feedback sent (${r.title}). ${r.note}`, r);
|
|
26
|
+
}
|
package/dist/commands/watch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -134,14 +134,19 @@ function installLaunchd(name, exec, interval, out) {
|
|
|
134
134
|
const logDir = join(homedir(), ".bschat", "logs");
|
|
135
135
|
mkdirSync(dir, { recursive: true });
|
|
136
136
|
mkdirSync(logDir, { recursive: true });
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
// Never bake in the path of the copy that is running: it may be an npx cache that is frozen at
|
|
138
|
+
// this version. Prefer a global install on PATH; fall back to this copy only if none exists.
|
|
139
|
+
const which = spawnSync("sh", ["-c", "command -v bschat"], { encoding: "utf8" });
|
|
140
|
+
const globalCli = which.status === 0 ? which.stdout.trim() : "";
|
|
141
|
+
const program = globalCli && !globalCli.includes("/_npx/") ? [globalCli] : [process.execPath, process.argv[1]];
|
|
142
|
+
if (program.length > 1)
|
|
143
|
+
process.stderr.write(`bschat: no global install found; the LaunchAgent will run ${process.argv[1]} and will not pick up upgrades. Install with: npm i -g benignswarm\n`);
|
|
139
144
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
140
145
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
141
146
|
<plist version="1.0"><dict>
|
|
142
147
|
<key>Label</key><string>${label}</string>
|
|
143
148
|
<key>ProgramArguments</key><array>
|
|
144
|
-
|
|
149
|
+
${program.map((x) => `<string>${escapeXml(x)}</string>`).join("")}<string>watch</string>
|
|
145
150
|
<string>--as</string><string>${name}</string>
|
|
146
151
|
<string>--exec</string><string>${escapeXml(exec)}</string>
|
|
147
152
|
<string>--interval</string><string>${interval}</string>
|
package/dist/help.js
CHANGED
|
@@ -53,6 +53,8 @@ Agent commands
|
|
|
53
53
|
bschat list edit <list> [--description d] [--name n] [--statuses open,in_progress,done:closed]
|
|
54
54
|
bschat list rm <list> --yes
|
|
55
55
|
bschat item show|set|done|view|rm <id> item set: --status s [--if-status prev] --title --body --assign --evidence
|
|
56
|
+
bschat feedback "<text>" [--category bug|friction|idea|docs] [--command "<what you ran>"] [--body-file f|-]
|
|
57
|
+
tell BenignSwarm's maintainers what got in your way or what would help
|
|
56
58
|
bschat skill install [--dir <path>] write the agent skill (default .claude/skills/bschat)
|
|
57
59
|
bschat skill print
|
|
58
60
|
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { hook } from "./commands/hook.js";
|
|
|
8
8
|
import { handoffs, retire } from "./commands/retire.js";
|
|
9
9
|
import { item, list, lists } from "./commands/lists.js";
|
|
10
10
|
import { watch } from "./commands/watch.js";
|
|
11
|
+
import { feedback } from "./commands/feedback.js";
|
|
11
12
|
import { CliError } from "./errors.js";
|
|
12
13
|
import { HELP } from "./help.js";
|
|
13
14
|
import { CLI_VERSION } from "./version.js";
|
|
@@ -39,6 +40,7 @@ const COMMANDS = {
|
|
|
39
40
|
list,
|
|
40
41
|
item,
|
|
41
42
|
watch,
|
|
43
|
+
feedback,
|
|
42
44
|
follow: a.followCmd,
|
|
43
45
|
unfollow: a.followCmd,
|
|
44
46
|
following: a.followCmd,
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.7.
|
|
1
|
+
export const CLI_VERSION = "0.7.8";
|