agentapprove 0.1.42 → 0.1.43
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/cli.js +45 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1822,6 +1822,38 @@ function ye() {
|
|
|
1822
1822
|
return new RegExp(s, "g");
|
|
1823
1823
|
}
|
|
1824
1824
|
|
|
1825
|
+
// src/env-preserve.ts
|
|
1826
|
+
var MANAGED_ENV_KEYS = new Set([
|
|
1827
|
+
"AGENTAPPROVE_API",
|
|
1828
|
+
"AGENTAPPROVE_TOKEN",
|
|
1829
|
+
"AGENTAPPROVE_PRIVACY",
|
|
1830
|
+
"AGENTAPPROVE_RETENTION_DAYS",
|
|
1831
|
+
"AGENTAPPROVE_CONFIG_SET_AT",
|
|
1832
|
+
"AGENTAPPROVE_DEBUG_LOG",
|
|
1833
|
+
"AGENTAPPROVE_E2E_MODE",
|
|
1834
|
+
"AGENTAPPROVE_E2E_ENABLED",
|
|
1835
|
+
"AGENTAPPROVE_FAIL_BEHAVIOR"
|
|
1836
|
+
]);
|
|
1837
|
+
var ENV_KEY_PATTERN = /^AGENTAPPROVE_[A-Z0-9_]+$/;
|
|
1838
|
+
function isPreservedEnvKey(key) {
|
|
1839
|
+
const k3 = key.trim();
|
|
1840
|
+
return ENV_KEY_PATTERN.test(k3) && !MANAGED_ENV_KEYS.has(k3);
|
|
1841
|
+
}
|
|
1842
|
+
function renderPreservedEnvSection(preserved) {
|
|
1843
|
+
if (!preserved)
|
|
1844
|
+
return "";
|
|
1845
|
+
const lines = Object.keys(preserved).filter((key) => isPreservedEnvKey(key) && !/[\r\n]/.test(preserved[key] ?? "")).sort().map((key) => `${key.trim()}=${preserved[key]}`);
|
|
1846
|
+
if (lines.length === 0)
|
|
1847
|
+
return "";
|
|
1848
|
+
return `
|
|
1849
|
+
# Settings synced from your Agent Approve account that the installer does not
|
|
1850
|
+
# manage (question input mode, timeout, agent display names, ...). Preserved
|
|
1851
|
+
# across reinstall so your hooks keep behaving the same.
|
|
1852
|
+
${lines.join(`
|
|
1853
|
+
`)}
|
|
1854
|
+
`;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1825
1857
|
// ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
1826
1858
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
1827
1859
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
@@ -3070,7 +3102,7 @@ function resolvePairingApiBaseUrl(options) {
|
|
|
3070
3102
|
}
|
|
3071
3103
|
|
|
3072
3104
|
// src/cli.ts
|
|
3073
|
-
var VERSION = "0.1.
|
|
3105
|
+
var VERSION = "0.1.43";
|
|
3074
3106
|
function getApiUrl() {
|
|
3075
3107
|
return process.env.AGENTAPPROVE_API || "https://api.agentapprove.com";
|
|
3076
3108
|
}
|
|
@@ -4041,6 +4073,11 @@ function readExistingConfig() {
|
|
|
4041
4073
|
case "AGENTAPPROVE_FAIL_BEHAVIOR":
|
|
4042
4074
|
config.failBehavior = value;
|
|
4043
4075
|
break;
|
|
4076
|
+
default:
|
|
4077
|
+
if (isPreservedEnvKey(key)) {
|
|
4078
|
+
config.preserved = { ...config.preserved ?? {}, [key.trim()]: value };
|
|
4079
|
+
}
|
|
4080
|
+
break;
|
|
4044
4081
|
}
|
|
4045
4082
|
}
|
|
4046
4083
|
return config;
|
|
@@ -4444,7 +4481,7 @@ AGENTAPPROVE_E2E_ENABLED=${e2eEnabled ? "true" : "false"}
|
|
|
4444
4481
|
|
|
4445
4482
|
# Hook behavior when API is unreachable: "allow" | "deny" | "ask"
|
|
4446
4483
|
AGENTAPPROVE_FAIL_BEHAVIOR=${config.failBehavior || "ask"}
|
|
4447
|
-
|
|
4484
|
+
${renderPreservedEnvSection(config.preserved)}
|
|
4448
4485
|
# Settings in this file sync from your Agent Approve account settings, so
|
|
4449
4486
|
# manual edits here are overwritten on the next config sync.
|
|
4450
4487
|
# To change settings, run: npx agentapprove install
|
|
@@ -6625,7 +6662,8 @@ Monitor activity, enforce policy, and approve with a tap.`, "About");
|
|
|
6625
6662
|
debugLog,
|
|
6626
6663
|
configSetAt,
|
|
6627
6664
|
e2eEnabled: useE2E,
|
|
6628
|
-
failBehavior
|
|
6665
|
+
failBehavior,
|
|
6666
|
+
preserved: existingConfig?.preserved
|
|
6629
6667
|
});
|
|
6630
6668
|
if (!silentlyReuseExistingToken) {
|
|
6631
6669
|
v2.success("Configuration saved to ~/.agentapprove/env");
|
|
@@ -7749,7 +7787,8 @@ but if unused for 30 days they expire. Get a new one below.`, "Token Expired");
|
|
|
7749
7787
|
e2eMode: existingConfig.e2eMode,
|
|
7750
7788
|
e2eEnabled,
|
|
7751
7789
|
failBehavior,
|
|
7752
|
-
configSetAt
|
|
7790
|
+
configSetAt,
|
|
7791
|
+
preserved: existingConfig.preserved
|
|
7753
7792
|
});
|
|
7754
7793
|
await storeTokenInKeychain(token);
|
|
7755
7794
|
if (e2eEnabled && result.e2eServerKey) {
|
|
@@ -7933,7 +7972,8 @@ async function pairCommand() {
|
|
|
7933
7972
|
e2eMode: existingConfig?.e2eMode,
|
|
7934
7973
|
e2eEnabled: !!e2eUserKey,
|
|
7935
7974
|
failBehavior: existingConfig?.failBehavior || "ask",
|
|
7936
|
-
configSetAt
|
|
7975
|
+
configSetAt,
|
|
7976
|
+
preserved: existingConfig?.preserved
|
|
7937
7977
|
});
|
|
7938
7978
|
await storeTokenInKeychain(result.token);
|
|
7939
7979
|
const hooksDir = join(getAgentApproveDir(), "hooks");
|