squads-cli 0.4.4 → 0.4.5

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/README.md CHANGED
@@ -511,6 +511,84 @@ squads stack logs bridge # View container logs
511
511
  squads stack logs postgres -n 100 # Last 100 lines
512
512
  ```
513
513
 
514
+ ### Tonight Mode (Autonomous Execution)
515
+
516
+ Run agents autonomously overnight with safety guardrails:
517
+
518
+ ```bash
519
+ # Run intelligence squad overnight
520
+ squads tonight intelligence
521
+
522
+ # Multiple targets with cost cap
523
+ squads tonight intelligence customer/outreach --cost-cap 25
524
+
525
+ # Preview what would run
526
+ squads tonight engineering --dry-run
527
+
528
+ # Check status while running
529
+ squads tonight status
530
+
531
+ # Stop all overnight agents
532
+ squads tonight stop
533
+
534
+ # View the morning report
535
+ squads tonight report
536
+ ```
537
+
538
+ **Example output:**
539
+
540
+ ```
541
+ $ squads tonight intelligence customer/outreach
542
+
543
+ squads tonight
544
+
545
+ Config:
546
+ Cost cap: $50
547
+ Stop at: 07:00
548
+ Max retries: 3
549
+ Targets: intelligence, customer/outreach
550
+
551
+ ✓ Launched 2 agent(s)
552
+
553
+ ✓ Tonight mode active
554
+
555
+ Monitor:
556
+ squads tonight status - Check progress
557
+ squads tonight stop - Kill all agents
558
+ tmux ls | grep tonight - List sessions
559
+
560
+ Logs: .agents/outputs/tonight/
561
+ ```
562
+
563
+ **Safety features:**
564
+ - **Cost cap** — Automatically stops when spending limit reached (default: $50)
565
+ - **Time limit** — Stops at specified time (default: 7:00 AM)
566
+ - **Max retries** — Limits restart attempts for crashed agents (default: 3)
567
+ - **Session isolation** — Each agent runs in isolated tmux session
568
+ - **Logging** — All output captured to `.agents/outputs/tonight/`
569
+ - **Morning report** — Summary generated on completion
570
+
571
+ **Monitoring commands:**
572
+
573
+ ```bash
574
+ # Check current status
575
+ squads tonight status
576
+
577
+ # Attach to a running session
578
+ tmux attach -t squads-tonight-intelligence-...
579
+
580
+ # View live logs
581
+ tail -f .agents/outputs/tonight/*.log
582
+
583
+ # Stop everything immediately
584
+ squads tonight stop
585
+ ```
586
+
587
+ > **Warning**: Tonight mode uses `--dangerously-skip-permissions` which bypasses
588
+ > Claude's safety confirmations. Only use with trusted agent definitions. Review
589
+ > your agent prompts and ensure they have appropriate scope limits before running
590
+ > autonomously.
591
+
514
592
  ### Smart Triggers
515
593
 
516
594
  Triggers execute agents based on conditions in PostgreSQL:
@@ -694,6 +772,16 @@ squads trigger enable <name> Enable trigger
694
772
  squads trigger disable <name> Disable trigger
695
773
  squads trigger status Scheduler stats
696
774
 
775
+ squads tonight <targets...> Autonomous overnight execution
776
+ --cost-cap <usd> Max spend (default: $50)
777
+ --stop-at <time> Stop time HH:MM (default: 07:00)
778
+ --max-retries <n> Restart limit (default: 3)
779
+ -d, --dry-run Preview only
780
+ -v, --verbose Verbose output
781
+ squads tonight status Check progress
782
+ squads tonight stop Kill all agents
783
+ squads tonight report View morning report
784
+
697
785
  squads update Interactive update
698
786
  -y, --yes Auto-confirm
699
787
  -c, --check Check only
package/dist/cli.js CHANGED
@@ -800,6 +800,10 @@ async function initCommand(options) {
800
800
  if (hasMissingRequired) {
801
801
  console.log(chalk.yellow(" Install missing tools to continue, then run squads init again."));
802
802
  console.log();
803
+ track(Events.CLI_INIT, {
804
+ success: false,
805
+ reason: "missing_requirements"
806
+ });
803
807
  return;
804
808
  }
805
809
  console.log(chalk.dim(" Checking project setup..."));
@@ -1055,6 +1059,7 @@ squads goal list # View goals
1055
1059
  }
1056
1060
  spinner.succeed("Squad structure created");
1057
1061
  await track(Events.CLI_INIT, {
1062
+ success: true,
1058
1063
  hasGit: gitStatus.isGitRepo,
1059
1064
  hasRemote: gitStatus.hasRemote,
1060
1065
  template: options.template,
@@ -1063,6 +1068,11 @@ squads goal list # View goals
1063
1068
  } catch (error) {
1064
1069
  spinner.fail("Failed to create structure");
1065
1070
  console.error(chalk.red(` ${error}`));
1071
+ track(Events.CLI_INIT, {
1072
+ success: false,
1073
+ reason: "structure_creation_failed",
1074
+ error: String(error)
1075
+ });
1066
1076
  process.exit(1);
1067
1077
  }
1068
1078
  if (!options.skipInfra && hasDocker) {
@@ -1084,19 +1094,21 @@ squads goal list # View goals
1084
1094
  }
1085
1095
  }
1086
1096
  console.log();
1087
- console.log(chalk.green(" \u2713 Ready!"));
1097
+ console.log(chalk.green.bold(" \u2713 Squads initialized!"));
1088
1098
  console.log();
1089
- console.log(` ${chalk.cyan(".agents/")}
1090
- ${chalk.dim("\u251C\u2500\u2500")} ${chalk.cyan("squads/demo/")} Demo squad (try it!)
1091
- ${chalk.dim("\u251C\u2500\u2500")} ${chalk.cyan("memory/")} Persistent context
1092
- ${chalk.dim("\u2514\u2500\u2500")} ${chalk.cyan("outputs/")} Agent outputs`);
1099
+ console.log(chalk.dim(" Created:"));
1100
+ console.log(chalk.dim(" \u2022 .agents/squads/demo/ - Demo squad with 2 agents"));
1101
+ console.log(chalk.dim(" \u2022 .claude/settings.json - Claude Code hooks"));
1102
+ console.log(chalk.dim(" \u2022 CLAUDE.md - Agent instructions"));
1093
1103
  console.log();
1094
- console.log(chalk.dim(" Next steps:"));
1095
- console.log(` ${chalk.cyan("1.")} Try the demo: ${chalk.yellow("squads run demo")}`);
1096
- console.log(` ${chalk.cyan("2.")} Check status: ${chalk.yellow("squads dash")}`);
1097
- console.log(` ${chalk.cyan("3.")} Create your own squad in ${chalk.cyan(".agents/squads/")}`);
1104
+ console.log(chalk.bold(" \u{1F449} Try it now:"));
1098
1105
  console.log();
1099
- console.log(chalk.dim(" Need help? jorge@agents-squads.com"));
1106
+ console.log(` ${chalk.yellow.bold("squads status")}`);
1107
+ console.log();
1108
+ console.log(chalk.dim(" Then explore:"));
1109
+ console.log(chalk.dim(` \u2022 ${chalk.cyan("squads dash")} Full dashboard`));
1110
+ console.log(chalk.dim(` \u2022 ${chalk.cyan("squads run demo")} Try demo agents`));
1111
+ console.log(chalk.dim(` \u2022 ${chalk.cyan("squads --help")} All commands`));
1100
1112
  console.log();
1101
1113
  }
1102
1114
 
@@ -8238,6 +8250,18 @@ async function tonightReportCommand() {
8238
8250
  if (!process.stdout.isTTY) {
8239
8251
  chalk4.level = 0;
8240
8252
  }
8253
+ process.stdout.on("error", (err) => {
8254
+ if (err.code === "EPIPE") {
8255
+ process.exit(0);
8256
+ }
8257
+ throw err;
8258
+ });
8259
+ process.stderr.on("error", (err) => {
8260
+ if (err.code === "EPIPE") {
8261
+ process.exit(0);
8262
+ }
8263
+ throw err;
8264
+ });
8241
8265
  var envPaths = [
8242
8266
  join17(process.cwd(), ".env"),
8243
8267
  join17(process.cwd(), "..", "hq", ".env"),