@integrity-labs/agt-cli 0.12.5 → 0.12.7
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
|
@@ -3717,7 +3717,7 @@ import { execFileSync, execSync } from "child_process";
|
|
|
3717
3717
|
import { existsSync as existsSync5, realpathSync } from "fs";
|
|
3718
3718
|
import chalk20 from "chalk";
|
|
3719
3719
|
import ora15 from "ora";
|
|
3720
|
-
var cliVersion = true ? "0.12.
|
|
3720
|
+
var cliVersion = true ? "0.12.7" : "dev";
|
|
3721
3721
|
async function fetchLatestVersion() {
|
|
3722
3722
|
const host2 = getHost();
|
|
3723
3723
|
if (!host2) return null;
|
|
@@ -4166,7 +4166,7 @@ function handleError(err) {
|
|
|
4166
4166
|
}
|
|
4167
4167
|
|
|
4168
4168
|
// src/bin/agt.ts
|
|
4169
|
-
var cliVersion2 = true ? "0.12.
|
|
4169
|
+
var cliVersion2 = true ? "0.12.7" : "dev";
|
|
4170
4170
|
var program = new Command();
|
|
4171
4171
|
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");
|
|
4172
4172
|
program.hook("preAction", (thisCommand) => {
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
// src/lib/manager-worker.ts
|
|
42
42
|
import { createHash } from "crypto";
|
|
43
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync, rmSync, readdirSync, statSync, unlinkSync, copyFileSync } from "fs";
|
|
43
|
+
import { readFileSync, writeFileSync, appendFileSync, mkdirSync, chmodSync, existsSync, rmSync, readdirSync, statSync, unlinkSync, copyFileSync } from "fs";
|
|
44
44
|
import https from "https";
|
|
45
45
|
import { join as join2, dirname } from "path";
|
|
46
46
|
import { homedir as homedir2 } from "os";
|
|
@@ -988,6 +988,11 @@ async function checkAndUpdateCli() {
|
|
|
988
988
|
} catch {
|
|
989
989
|
return;
|
|
990
990
|
}
|
|
991
|
+
try {
|
|
992
|
+
execFileSync(brewPath, ["update", "--quiet"], { timeout: 6e4, stdio: "pipe" });
|
|
993
|
+
} catch (err) {
|
|
994
|
+
log(`[self-update] brew update failed (continuing with stale cache): ${err.message}`);
|
|
995
|
+
}
|
|
991
996
|
try {
|
|
992
997
|
const outdated = execFileSync(brewPath, ["outdated", "--json=v2"], {
|
|
993
998
|
timeout: 3e4,
|
|
@@ -1008,8 +1013,11 @@ async function checkAndUpdateCli() {
|
|
|
1008
1013
|
} catch (err) {
|
|
1009
1014
|
log(`[self-update] Upgrade failed: ${err.message}`);
|
|
1010
1015
|
}
|
|
1016
|
+
} else {
|
|
1017
|
+
log(`[self-update] agt CLI is up to date`);
|
|
1011
1018
|
}
|
|
1012
|
-
} catch {
|
|
1019
|
+
} catch (err) {
|
|
1020
|
+
log(`[self-update] brew outdated failed: ${err.message}`);
|
|
1013
1021
|
}
|
|
1014
1022
|
try {
|
|
1015
1023
|
writeF(markerPath, String(Date.now()));
|
|
@@ -1111,10 +1119,35 @@ function send(msg) {
|
|
|
1111
1119
|
log(`Error: ${msg.message}`);
|
|
1112
1120
|
}
|
|
1113
1121
|
}
|
|
1122
|
+
var managerLogPath = null;
|
|
1123
|
+
function redactForDiskLog(value) {
|
|
1124
|
+
try {
|
|
1125
|
+
return value.replace(/\b(Bearer\s+)[A-Za-z0-9._-]+\b/gi, "$1[REDACTED]").replace(/\bxox[baprs]-[A-Za-z0-9-]+\b/g, "[REDACTED-SLACK]").replace(/\btlk_[A-Za-z0-9._-]+\b/g, "[REDACTED-HOST]").replace(/\bsk-ant-[A-Za-z0-9_-]+\b/g, "[REDACTED-ANTHROPIC]").replace(/\b\d{8,12}:[A-Za-z0-9_-]{30,}\b/g, "[REDACTED-TELEGRAM]").replace(/\b([A-Z0-9_]*(?:TOKEN|SECRET|API[_-]?KEY|PASSWORD)[A-Z0-9_]*)=\S+/gi, "$1=[REDACTED]");
|
|
1126
|
+
} catch {
|
|
1127
|
+
return "[REDACTED]";
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1114
1130
|
function log(msg) {
|
|
1115
1131
|
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
1116
|
-
|
|
1132
|
+
const safeMsg = redactForDiskLog(msg);
|
|
1133
|
+
const rawStderrOptIn = process.env["AGT_LOG_RAW_SECRETS"] === "1" && process.stderr.isTTY;
|
|
1134
|
+
const stderrMsg = rawStderrOptIn ? msg : safeMsg;
|
|
1135
|
+
process.stderr.write(`[manager-worker ${ts}] ${stderrMsg}
|
|
1136
|
+
`);
|
|
1137
|
+
try {
|
|
1138
|
+
if (!managerLogPath) {
|
|
1139
|
+
managerLogPath = join2(homedir2(), ".augmented", "manager.log");
|
|
1140
|
+
mkdirSync(dirname(managerLogPath), { recursive: true });
|
|
1141
|
+
if (!existsSync(managerLogPath)) {
|
|
1142
|
+
appendFileSync(managerLogPath, "", { mode: 384 });
|
|
1143
|
+
} else {
|
|
1144
|
+
chmodSync(managerLogPath, 384);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
appendFileSync(managerLogPath, `[manager-worker ${ts}] ${safeMsg}
|
|
1117
1148
|
`);
|
|
1149
|
+
} catch {
|
|
1150
|
+
}
|
|
1118
1151
|
}
|
|
1119
1152
|
function sha256(content) {
|
|
1120
1153
|
return createHash("sha256").update(content, "utf8").digest("hex");
|