@integrity-labs/agt-cli 0.27.60 → 0.27.61

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/bin/agt.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  success,
28
28
  table,
29
29
  warn
30
- } from "../chunk-2YSXMB7P.js";
30
+ } from "../chunk-I4RL6YLR.js";
31
31
  import {
32
32
  CHANNEL_REGISTRY,
33
33
  DEPLOYMENT_TEMPLATES,
@@ -3095,6 +3095,97 @@ async function hostRotateKeyCommand(hostName) {
3095
3095
  process.exitCode = 1;
3096
3096
  }
3097
3097
  }
3098
+ async function hostMaintenanceWindowCommand(hostName, opts) {
3099
+ const teamSlug = requireTeam();
3100
+ if (!teamSlug) return;
3101
+ const json = isJsonMode();
3102
+ const path = `/hosts/${encodeURIComponent(hostName)}/maintenance-window`;
3103
+ const setting = opts.clear || opts.start !== void 0 || opts.end !== void 0 || opts.tz !== void 0;
3104
+ if (!setting) {
3105
+ const spinner2 = ora12({ text: "Fetching maintenance window\u2026", isSilent: json });
3106
+ spinner2.start();
3107
+ try {
3108
+ const data = await api.get(path);
3109
+ spinner2.stop();
3110
+ if (json) {
3111
+ jsonOutput({ ok: true, ...data });
3112
+ return;
3113
+ }
3114
+ const ov = data.override;
3115
+ const hasOverride = ov.maintenance_window_start !== null || ov.maintenance_window_end !== null || ov.maintenance_timezone !== null;
3116
+ info(`Host: ${chalk12.bold(hostName)}`);
3117
+ info(
3118
+ `Effective: ${chalk12.green(`${data.effective.start}\u2013${data.effective.end}`)} ${data.effective.timezone}`
3119
+ );
3120
+ info(
3121
+ `Override: ${hasOverride ? chalk12.cyan("set") : chalk12.dim("none (default 01:00\u201302:00)")}`
3122
+ );
3123
+ info("Set with --start/--end/--tz, or --clear to follow the default.");
3124
+ } catch (err) {
3125
+ spinner2.fail("Failed to fetch maintenance window.");
3126
+ if (json) jsonOutput({ ok: false, error: err.message });
3127
+ else error(err.message);
3128
+ process.exitCode = 1;
3129
+ }
3130
+ return;
3131
+ }
3132
+ if (opts.clear && (opts.start !== void 0 || opts.end !== void 0 || opts.tz !== void 0)) {
3133
+ const msg = "Use --clear on its own \u2014 it cannot be combined with --start/--end/--tz.";
3134
+ if (json) jsonOutput({ ok: false, error: msg });
3135
+ else error(msg);
3136
+ process.exitCode = 1;
3137
+ return;
3138
+ }
3139
+ if (!opts.clear && opts.start === void 0 !== (opts.end === void 0)) {
3140
+ const msg = "Provide both --start and --end (or use --clear).";
3141
+ if (json) jsonOutput({ ok: false, error: msg });
3142
+ else error(msg);
3143
+ process.exitCode = 1;
3144
+ return;
3145
+ }
3146
+ if (!opts.clear && opts.tz !== void 0 && opts.start === void 0) {
3147
+ const msg = "Provide --start and --end when setting --tz (or use --clear).";
3148
+ if (json) jsonOutput({ ok: false, error: msg });
3149
+ else error(msg);
3150
+ process.exitCode = 1;
3151
+ return;
3152
+ }
3153
+ let resolvedTz = opts.tz ?? null;
3154
+ if (!opts.clear && opts.tz === void 0) {
3155
+ try {
3156
+ const cur = await api.get(path);
3157
+ resolvedTz = cur.override.maintenance_timezone;
3158
+ } catch (err) {
3159
+ const spinner0 = ora12({ isSilent: json });
3160
+ spinner0.fail("Failed to read current maintenance window.");
3161
+ if (json) jsonOutput({ ok: false, error: err.message });
3162
+ else error(err.message);
3163
+ process.exitCode = 1;
3164
+ return;
3165
+ }
3166
+ }
3167
+ const payload = opts.clear ? { maintenance_window_start: null, maintenance_window_end: null, maintenance_timezone: null } : {
3168
+ maintenance_window_start: opts.start ?? null,
3169
+ maintenance_window_end: opts.end ?? null,
3170
+ maintenance_timezone: resolvedTz
3171
+ };
3172
+ const spinner = ora12({ text: "Updating maintenance window\u2026", isSilent: json });
3173
+ spinner.start();
3174
+ try {
3175
+ const data = await api.post(path, payload);
3176
+ spinner.succeed(`Maintenance window updated for ${chalk12.bold(hostName)}.`);
3177
+ if (json) {
3178
+ jsonOutput({ ok: true, ...data });
3179
+ return;
3180
+ }
3181
+ if (data.note) info(data.note);
3182
+ } catch (err) {
3183
+ spinner.fail("Failed to update maintenance window.");
3184
+ if (json) jsonOutput({ ok: false, error: err.message });
3185
+ else error(err.message);
3186
+ process.exitCode = 1;
3187
+ }
3188
+ }
3098
3189
  async function hostDecommissionCommand(hostName) {
3099
3190
  const teamSlug = requireTeam();
3100
3191
  if (!teamSlug) return;
@@ -4838,7 +4929,7 @@ import { execFileSync, execSync } from "child_process";
4838
4929
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4839
4930
  import chalk18 from "chalk";
4840
4931
  import ora16 from "ora";
4841
- var cliVersion = true ? "0.27.60" : "dev";
4932
+ var cliVersion = true ? "0.27.61" : "dev";
4842
4933
  async function fetchLatestVersion() {
4843
4934
  const host2 = getHost();
4844
4935
  if (!host2) return null;
@@ -5616,7 +5707,7 @@ function handleError(err) {
5616
5707
  }
5617
5708
 
5618
5709
  // src/bin/agt.ts
5619
- var cliVersion2 = true ? "0.27.60" : "dev";
5710
+ var cliVersion2 = true ? "0.27.61" : "dev";
5620
5711
  var program = new Command();
5621
5712
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
5622
5713
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -5701,6 +5792,7 @@ host.command("unassign <host-name> <agent-code-names...>").description("Unassign
5701
5792
  host.command("agents [host-name]").description("List agents assigned to a host (omit name to auto-resolve from AGT_API_KEY)").action(hostAgentsCommand);
5702
5793
  host.command("rotate-key <host-name>").description("Rotate the API key for a host (revokes the old key)").action(hostRotateKeyCommand);
5703
5794
  host.command("decommission <host-name>").description("Decommission a host (revokes key, marks inactive)").action(hostDecommissionCommand);
5795
+ host.command("maintenance-window <host-name>").description("View or set the host maintenance window for restart-causing updates").option("--start <HH:MM>", "Window start, 24h local time (e.g. 01:00)").option("--end <HH:MM>", "Window end, 24h local time (e.g. 02:00)").option("--tz <IANA>", "Window timezone (e.g. Australia/Sydney)").option("--clear", "Clear the override and follow the default 01:00\u201302:00").action(hostMaintenanceWindowCommand);
5704
5796
  host.command("pair <host-name>").description("Start an SSM port-forward + shell to re-authenticate Claude Code on an EC2 host").option("--port <port>", "Local port to forward for the OAuth callback", "54545").option("--no-shell", "Start the tunnel only; do not open an interactive shell").action(
5705
5797
  (hostName, opts) => hostPairCommand(hostName, {
5706
5798
  port: opts.port,