@herdingchats/friday 0.1.522 → 0.1.525

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.
Files changed (2) hide show
  1. package/herd.mjs +108 -1
  2. package/package.json +2 -2
package/herd.mjs CHANGED
@@ -18,7 +18,7 @@ var __export = (target, all) => {
18
18
  var define_HERD_PACKAGE_default;
19
19
  var init_define_HERD_PACKAGE = __esm({
20
20
  "<define:HERD_PACKAGE>"() {
21
- define_HERD_PACKAGE_default = { version: "0.1.522", gitHead: "3dab37264f9426b4af9a912efcddadf9fb04cdcc" };
21
+ define_HERD_PACKAGE_default = { version: "0.1.525", gitHead: "cbd227dfdbed52c13e4cb3a2b388d6e7d4a6866e" };
22
22
  }
23
23
  });
24
24
 
@@ -3398,6 +3398,89 @@ async function apiFetch(path, init = {}) {
3398
3398
  return response;
3399
3399
  }
3400
3400
 
3401
+ // src/cli-flags.ts
3402
+ init_define_HERD_PACKAGE();
3403
+ var HERD_FLAGS = {
3404
+ login: [],
3405
+ logout: [],
3406
+ daemon: ["--repo"],
3407
+ attach: [],
3408
+ builds: [],
3409
+ inbox: [],
3410
+ send: ["--json"],
3411
+ automations: ["--json", "--wait"],
3412
+ channels: [],
3413
+ watch: [],
3414
+ unwatch: [],
3415
+ watching: [],
3416
+ conversations: ["--about", "--json"],
3417
+ github: ["--on", "--off", "--json"],
3418
+ setup: ["--json"],
3419
+ repo: [],
3420
+ repos: ["--json"],
3421
+ work: ["--kind", "--title", "--status", "--detail", "--phase", "--made", "--remove", "--json"],
3422
+ check: [],
3423
+ handoff: [],
3424
+ delegate: ["--repo"],
3425
+ tell: ["--json"],
3426
+ workers: ["--json", "--types"],
3427
+ status: ["--clear"],
3428
+ title: [],
3429
+ handled: [],
3430
+ pass: [],
3431
+ exit: [],
3432
+ persona: []
3433
+ };
3434
+ var FRIDAY_FLAGS = {
3435
+ start: ["--agents"],
3436
+ stop: [],
3437
+ status: [],
3438
+ logs: ["--follow", "-f", "-n"]
3439
+ };
3440
+ var HERD_OWN_HELP = /* @__PURE__ */ new Set([
3441
+ "builds",
3442
+ "send",
3443
+ "automations",
3444
+ "watch",
3445
+ "unwatch",
3446
+ "watching",
3447
+ "github",
3448
+ "repo",
3449
+ "repos",
3450
+ "work",
3451
+ "check",
3452
+ "handoff",
3453
+ "delegate",
3454
+ "tell",
3455
+ "workers",
3456
+ "status",
3457
+ "title"
3458
+ ]);
3459
+ var FLAG = /^--?[A-Za-z][\w-]*(=.*)?$/;
3460
+ function unknownFlag(program, command, args, known) {
3461
+ for (const arg of args) {
3462
+ if (arg === "--") break;
3463
+ if (!FLAG.test(arg)) continue;
3464
+ const name = arg.split("=")[0] ?? arg;
3465
+ if (name === "--help" || name === "-h" || known.includes(name)) continue;
3466
+ const takes = known.length ? `It takes ${known.join(", ")}.` : "It takes no options.";
3467
+ return `${program} ${command} doesn't have a "${name}" option, so nothing ran. ${takes} See ${program} ${command} --help.`;
3468
+ }
3469
+ return null;
3470
+ }
3471
+ var asksForHelp = (args) => args.some((arg) => arg === "--help" || arg === "-h");
3472
+ function commandHelp(overview, command) {
3473
+ const lines = overview.split("\n");
3474
+ const start = lines.findIndex((line2) => new RegExp(`^ ${command}(\\s|$)`).test(line2));
3475
+ if (start === -1) return null;
3476
+ const out = [lines[start] ?? ""];
3477
+ for (const line2 of lines.slice(start + 1)) {
3478
+ if (!/^ {4,}\S/.test(line2)) break;
3479
+ out.push(line2);
3480
+ }
3481
+ return out.join("\n");
3482
+ }
3483
+
3401
3484
  // src/commands/login.ts
3402
3485
  init_define_HERD_PACKAGE();
3403
3486
  import { spawn } from "node:child_process";
@@ -6133,6 +6216,18 @@ function passedEnv() {
6133
6216
  }
6134
6217
  async function friday(args, deps = defaults()) {
6135
6218
  const [command = "help", ...rest] = args;
6219
+ const known = FRIDAY_FLAGS[command];
6220
+ if (known) {
6221
+ if (asksForHelp(rest)) {
6222
+ deps.print(commandHelp(HELP, command) ?? HELP);
6223
+ return 0;
6224
+ }
6225
+ const wrong = unknownFlag("friday", command, rest, known);
6226
+ if (wrong) {
6227
+ deps.print(wrong);
6228
+ return 1;
6229
+ }
6230
+ }
6136
6231
  try {
6137
6232
  switch (command) {
6138
6233
  case "help":
@@ -13900,6 +13995,18 @@ Inside a terminal the daemon started:
13900
13995
  Set HERD_API_URL to use another API, such as http://localhost:5174 for the local dev server.`;
13901
13996
  async function main(args) {
13902
13997
  const [command = "help", ...rest] = args;
13998
+ const known = HERD_FLAGS[command];
13999
+ if (known) {
14000
+ if (asksForHelp(rest) && !HERD_OWN_HELP.has(command)) {
14001
+ console.log(commandHelp(HELP5, command) ?? HELP5);
14002
+ return 0;
14003
+ }
14004
+ const wrong = unknownFlag("herd", command, rest, known);
14005
+ if (wrong) {
14006
+ console.error(wrong);
14007
+ return 1;
14008
+ }
14009
+ }
13903
14010
  try {
13904
14011
  switch (command) {
13905
14012
  case "help":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herdingchats/friday",
3
- "version": "0.1.522",
3
+ "version": "0.1.525",
4
4
  "description": "Friday, HerdingChats' agent daemon, and the herd command it runs agents with.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,5 +22,5 @@
22
22
  "satori": "0.32.0",
23
23
  "zod": "4.6.7"
24
24
  },
25
- "gitHead": "3dab37264f9426b4af9a912efcddadf9fb04cdcc"
25
+ "gitHead": "cbd227dfdbed52c13e4cb3a2b388d6e7d4a6866e"
26
26
  }