@integrity-labs/agt-cli 0.10.11 → 0.10.12
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 +31 -3
- package/dist/bin/agt.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/agt.js
CHANGED
|
@@ -2915,7 +2915,7 @@ async function kanbanRecurringDisableCommand(titleOrId, opts) {
|
|
|
2915
2915
|
}
|
|
2916
2916
|
|
|
2917
2917
|
// src/commands/setup.ts
|
|
2918
|
-
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "fs";
|
|
2918
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, accessSync, constants as fsConstants } from "fs";
|
|
2919
2919
|
import { join as join10, dirname } from "path";
|
|
2920
2920
|
import { homedir as homedir2 } from "os";
|
|
2921
2921
|
import chalk18 from "chalk";
|
|
@@ -2934,6 +2934,30 @@ function detectShellProfile() {
|
|
|
2934
2934
|
if (existsSync4(bashrc)) return bashrc;
|
|
2935
2935
|
return join10(home, ".bash_profile");
|
|
2936
2936
|
}
|
|
2937
|
+
function maybeWriteEtcEnvironment(apiUrl, apiKey) {
|
|
2938
|
+
if (process.platform === "win32") return false;
|
|
2939
|
+
if (typeof process.getuid !== "function" || process.getuid() !== 0) return false;
|
|
2940
|
+
const envPath = "/etc/environment";
|
|
2941
|
+
if (!existsSync4(envPath)) return false;
|
|
2942
|
+
try {
|
|
2943
|
+
accessSync(envPath, fsConstants.W_OK);
|
|
2944
|
+
} catch {
|
|
2945
|
+
return false;
|
|
2946
|
+
}
|
|
2947
|
+
try {
|
|
2948
|
+
const current = readFileSync4(envPath, "utf-8");
|
|
2949
|
+
const stripped = current.split(/\r?\n/).filter((line) => !/^\s*(?:export\s+)?AGT_(?:HOST|API_KEY)=/.test(line)).join("\n");
|
|
2950
|
+
const base = stripped.endsWith("\n") || stripped.length === 0 ? stripped : `${stripped}
|
|
2951
|
+
`;
|
|
2952
|
+
const appended = `${base}AGT_HOST="${apiUrl}"
|
|
2953
|
+
AGT_API_KEY="${apiKey}"
|
|
2954
|
+
`;
|
|
2955
|
+
writeFileSync5(envPath, appended, { mode: 420 });
|
|
2956
|
+
return true;
|
|
2957
|
+
} catch {
|
|
2958
|
+
return false;
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2937
2961
|
function buildExportLines(shell, apiUrl, apiKey) {
|
|
2938
2962
|
if (shell.includes("fish")) {
|
|
2939
2963
|
return [
|
|
@@ -3053,6 +3077,10 @@ async function setupCommand(token) {
|
|
|
3053
3077
|
if (!json) {
|
|
3054
3078
|
success(`Environment variables written to ${chalk18.bold(profilePath)}`);
|
|
3055
3079
|
}
|
|
3080
|
+
const envWritten = maybeWriteEtcEnvironment(finalApiUrl, setupResult.api_key);
|
|
3081
|
+
if (!json && envWritten) {
|
|
3082
|
+
success(`System-wide env written to ${chalk18.bold("/etc/environment")}`);
|
|
3083
|
+
}
|
|
3056
3084
|
const managerSpinner = ora13({ text: "Starting manager daemon\u2026", isSilent: json });
|
|
3057
3085
|
managerSpinner.start();
|
|
3058
3086
|
try {
|
|
@@ -3606,7 +3634,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
|
|
|
3606
3634
|
import { execSync } from "child_process";
|
|
3607
3635
|
import chalk20 from "chalk";
|
|
3608
3636
|
import ora15 from "ora";
|
|
3609
|
-
var cliVersion = true ? "0.10.
|
|
3637
|
+
var cliVersion = true ? "0.10.12" : "dev";
|
|
3610
3638
|
async function fetchLatestVersion() {
|
|
3611
3639
|
const host2 = getHost();
|
|
3612
3640
|
if (!host2) return null;
|
|
@@ -4005,7 +4033,7 @@ function handleError(err) {
|
|
|
4005
4033
|
}
|
|
4006
4034
|
|
|
4007
4035
|
// src/bin/agt.ts
|
|
4008
|
-
var cliVersion2 = true ? "0.10.
|
|
4036
|
+
var cliVersion2 = true ? "0.10.12" : "dev";
|
|
4009
4037
|
var program = new Command();
|
|
4010
4038
|
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");
|
|
4011
4039
|
program.hook("preAction", (thisCommand) => {
|