@integrity-labs/agt-cli 0.10.13 → 0.10.15
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 +33 -17
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-KZ7Y55HJ.js → chunk-XTETZ2D5.js} +4 -1
- package/dist/{chunk-KZ7Y55HJ.js.map → chunk-XTETZ2D5.js.map} +1 -1
- package/dist/lib/manager-worker.js +56 -25
- package/dist/lib/manager-worker.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/agt.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
resolveChannels,
|
|
33
33
|
serializeManifestForSlackCli,
|
|
34
34
|
setActiveTeam
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-XTETZ2D5.js";
|
|
36
36
|
|
|
37
37
|
// src/bin/agt.ts
|
|
38
38
|
import { join as join11 } from "path";
|
|
@@ -2935,13 +2935,23 @@ function detectShellProfile() {
|
|
|
2935
2935
|
return join10(home, ".bash_profile");
|
|
2936
2936
|
}
|
|
2937
2937
|
function maybeWriteSystemWideEnv(apiUrl, apiKey) {
|
|
2938
|
-
|
|
2939
|
-
if (
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2938
|
+
const empty = { etcEnvironment: false, profileD: false, bashrc: false };
|
|
2939
|
+
if (process.platform === "win32") return empty;
|
|
2940
|
+
if (typeof process.getuid !== "function" || process.getuid() !== 0) return empty;
|
|
2941
|
+
return {
|
|
2942
|
+
etcEnvironment: writeEtcEnvironment(apiUrl, apiKey),
|
|
2943
|
+
profileD: writeProfileDScript(apiUrl, apiKey),
|
|
2944
|
+
// Run for its side-effect (wiring /etc/bashrc to source agt.sh) but
|
|
2945
|
+
// treat it as a supporting channel, not proof that env values were
|
|
2946
|
+
// persisted. Success reporting should reflect actual value writes.
|
|
2947
|
+
bashrc: ensureBashrcSourcesProfileD()
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
function quoteForEtcEnvironment(value) {
|
|
2951
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\r?\n/g, "\\n")}"`;
|
|
2952
|
+
}
|
|
2953
|
+
function quoteForPosixShell(value) {
|
|
2954
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
2945
2955
|
}
|
|
2946
2956
|
function writeEtcEnvironment(apiUrl, apiKey) {
|
|
2947
2957
|
const envPath = "/etc/environment";
|
|
@@ -2956,8 +2966,8 @@ function writeEtcEnvironment(apiUrl, apiKey) {
|
|
|
2956
2966
|
const stripped = current.split(/\r?\n/).filter((line) => !/^\s*(?:export\s+)?AGT_(?:HOST|API_KEY)=/.test(line)).join("\n");
|
|
2957
2967
|
const base = stripped.endsWith("\n") || stripped.length === 0 ? stripped : `${stripped}
|
|
2958
2968
|
`;
|
|
2959
|
-
const appended = `${base}AGT_HOST
|
|
2960
|
-
AGT_API_KEY
|
|
2969
|
+
const appended = `${base}AGT_HOST=${quoteForEtcEnvironment(apiUrl)}
|
|
2970
|
+
AGT_API_KEY=${quoteForEtcEnvironment(apiKey)}
|
|
2961
2971
|
`;
|
|
2962
2972
|
writeFileSync5(envPath, appended, { mode: 420 });
|
|
2963
2973
|
return true;
|
|
@@ -2977,8 +2987,8 @@ function writeProfileDScript(apiUrl, apiKey) {
|
|
|
2977
2987
|
const scriptPath = `${profileD}/agt.sh`;
|
|
2978
2988
|
const content = [
|
|
2979
2989
|
"# Augmented \u2014 auto-generated by `agt setup`. Do not edit.",
|
|
2980
|
-
`export AGT_HOST
|
|
2981
|
-
`export AGT_API_KEY
|
|
2990
|
+
`export AGT_HOST=${quoteForPosixShell(apiUrl)}`,
|
|
2991
|
+
`export AGT_API_KEY=${quoteForPosixShell(apiKey)}`,
|
|
2982
2992
|
""
|
|
2983
2993
|
].join("\n");
|
|
2984
2994
|
writeFileSync5(scriptPath, content, { mode: 420 });
|
|
@@ -3132,9 +3142,15 @@ async function setupCommand(token) {
|
|
|
3132
3142
|
if (!json) {
|
|
3133
3143
|
success(`Environment variables written to ${chalk18.bold(profilePath)}`);
|
|
3134
3144
|
}
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
|
|
3145
|
+
const sys = maybeWriteSystemWideEnv(finalApiUrl, setupResult.api_key);
|
|
3146
|
+
const valueChannelsWritten = sys.etcEnvironment || sys.profileD;
|
|
3147
|
+
if (!json && valueChannelsWritten) {
|
|
3148
|
+
const channels2 = [
|
|
3149
|
+
sys.etcEnvironment ? "/etc/environment" : null,
|
|
3150
|
+
sys.profileD ? "/etc/profile.d/agt.sh" : null,
|
|
3151
|
+
sys.bashrc ? "/etc/bashrc" : null
|
|
3152
|
+
].filter(Boolean).join(" + ");
|
|
3153
|
+
success(`System-wide env updated: ${channels2}`);
|
|
3138
3154
|
}
|
|
3139
3155
|
const managerSpinner = ora13({ text: "Starting manager daemon\u2026", isSilent: json });
|
|
3140
3156
|
managerSpinner.start();
|
|
@@ -3689,7 +3705,7 @@ async function acpxCloseCommand(agent2, _opts, cmd) {
|
|
|
3689
3705
|
import { execSync } from "child_process";
|
|
3690
3706
|
import chalk20 from "chalk";
|
|
3691
3707
|
import ora15 from "ora";
|
|
3692
|
-
var cliVersion = true ? "0.10.
|
|
3708
|
+
var cliVersion = true ? "0.10.15" : "dev";
|
|
3693
3709
|
async function fetchLatestVersion() {
|
|
3694
3710
|
const host2 = getHost();
|
|
3695
3711
|
if (!host2) return null;
|
|
@@ -4088,7 +4104,7 @@ function handleError(err) {
|
|
|
4088
4104
|
}
|
|
4089
4105
|
|
|
4090
4106
|
// src/bin/agt.ts
|
|
4091
|
-
var cliVersion2 = true ? "0.10.
|
|
4107
|
+
var cliVersion2 = true ? "0.10.15" : "dev";
|
|
4092
4108
|
var program = new Command();
|
|
4093
4109
|
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");
|
|
4094
4110
|
program.hook("preAction", (thisCommand) => {
|