envpkt 0.6.6 → 0.6.8
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 +26 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -14
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
|
7
7
|
import { Cond, Left, List, Option, Right, Try } from "functype";
|
|
8
|
-
import { Env, Fs, Path } from "functype-os";
|
|
8
|
+
import { Env, Fs, Path, Platform } from "functype-os";
|
|
9
9
|
import { TomlDate, parse, stringify } from "smol-toml";
|
|
10
10
|
import { FormatRegistry, Type } from "@sinclair/typebox";
|
|
11
11
|
import { execFileSync } from "node:child_process";
|
|
@@ -145,28 +145,26 @@ const expandGlobPath = (expanded) => {
|
|
|
145
145
|
const prefix = globSegment.replace(/\*.*$/, "");
|
|
146
146
|
return Fs.readdirSync(parentDir).fold(() => [], (entries) => entries.filter((entry) => entry.startsWith(prefix)).map((entry) => join(parentDir, entry, suffix)).filter((p) => Fs.existsSync(p)).toArray());
|
|
147
147
|
};
|
|
148
|
-
/**
|
|
149
|
-
const
|
|
150
|
-
"~/.envpkt/envpkt.toml",
|
|
151
|
-
"~/OneDrive/.envpkt/envpkt.toml",
|
|
152
|
-
"~/Library/CloudStorage/OneDrive-Personal/.envpkt/envpkt.toml",
|
|
153
|
-
"~/Library/CloudStorage/OneDrive-SharedLibraries-*/.envpkt/envpkt.toml",
|
|
148
|
+
/** Env-var fallback paths for cases where Platform detection misses */
|
|
149
|
+
const ENV_FALLBACK_PATHS = [
|
|
154
150
|
"$WINHOME/OneDrive/.envpkt/envpkt.toml",
|
|
155
151
|
"$USERPROFILE/OneDrive/.envpkt/envpkt.toml",
|
|
156
152
|
"$OneDrive/.envpkt/envpkt.toml",
|
|
157
153
|
"$OneDriveConsumer/.envpkt/envpkt.toml",
|
|
158
154
|
"$OneDriveCommercial/.envpkt/envpkt.toml",
|
|
159
|
-
"/mnt/c/Users/$USER/OneDrive/.envpkt/envpkt.toml",
|
|
160
|
-
"~/Library/Mobile Documents/com~apple~CloudDocs/.envpkt/envpkt.toml",
|
|
161
|
-
"~/Dropbox/.envpkt/envpkt.toml",
|
|
162
155
|
"$DROPBOX_PATH/.envpkt/envpkt.toml",
|
|
163
|
-
"~/Google Drive/My Drive/.envpkt/envpkt.toml",
|
|
164
|
-
"~/Library/CloudStorage/GoogleDrive-*/.envpkt/envpkt.toml",
|
|
165
156
|
"$GOOGLE_DRIVE/.envpkt/envpkt.toml",
|
|
166
157
|
"$WINHOME/.envpkt/envpkt.toml",
|
|
167
158
|
"$USERPROFILE/.envpkt/envpkt.toml"
|
|
168
159
|
];
|
|
169
|
-
/**
|
|
160
|
+
/** Build discovery paths dynamically from Platform home and cloud storage detection */
|
|
161
|
+
const buildSearchPaths = () => {
|
|
162
|
+
const paths = [];
|
|
163
|
+
for (const home of Platform.homeDirs().toArray()) paths.push(join(home, ".envpkt", CONFIG_FILENAME$2));
|
|
164
|
+
for (const cloud of Platform.cloudStorageDirs().toArray()) paths.push(join(cloud.path, ".envpkt", CONFIG_FILENAME$2));
|
|
165
|
+
return paths;
|
|
166
|
+
};
|
|
167
|
+
/** Discover config by checking CWD, then ENVPKT_SEARCH_PATH, then dynamic Platform paths */
|
|
170
168
|
const discoverConfig = (cwd) => {
|
|
171
169
|
const cwdCandidate = join(cwd ?? process.cwd(), CONFIG_FILENAME$2);
|
|
172
170
|
if (Fs.existsSync(cwdCandidate)) return Option({
|
|
@@ -174,7 +172,7 @@ const discoverConfig = (cwd) => {
|
|
|
174
172
|
source: "cwd"
|
|
175
173
|
});
|
|
176
174
|
const customPaths = Env.get("ENVPKT_SEARCH_PATH").fold(() => [], (v) => v.split(":").filter(Boolean));
|
|
177
|
-
for (const template of
|
|
175
|
+
for (const template of customPaths) {
|
|
178
176
|
const expanded = expandPath(template);
|
|
179
177
|
if (!expanded || expanded.startsWith("/.envpkt")) continue;
|
|
180
178
|
const matches = expandGlobPath(expanded);
|
|
@@ -183,6 +181,18 @@ const discoverConfig = (cwd) => {
|
|
|
183
181
|
source: "search"
|
|
184
182
|
});
|
|
185
183
|
}
|
|
184
|
+
for (const p of buildSearchPaths()) if (Fs.existsSync(p)) return Option({
|
|
185
|
+
path: p,
|
|
186
|
+
source: "search"
|
|
187
|
+
});
|
|
188
|
+
for (const template of ENV_FALLBACK_PATHS) {
|
|
189
|
+
const expanded = expandPath(template);
|
|
190
|
+
if (!expanded || expanded.startsWith("/.envpkt")) continue;
|
|
191
|
+
if (Fs.existsSync(expanded)) return Option({
|
|
192
|
+
path: expanded,
|
|
193
|
+
source: "search"
|
|
194
|
+
});
|
|
195
|
+
}
|
|
186
196
|
return Option(void 0);
|
|
187
197
|
};
|
|
188
198
|
/** Read a config file, returning Either<ConfigError, string> */
|
|
@@ -1215,6 +1225,7 @@ const bootSafe = (options) => {
|
|
|
1215
1225
|
sealedKeys.add(key);
|
|
1216
1226
|
}
|
|
1217
1227
|
});
|
|
1228
|
+
else if (hasSealedValues && !identityFilePath) warnings.push("Sealed values found but no identity file available for decryption");
|
|
1218
1229
|
const remainingKeys = metaKeys.filter((k) => !sealedKeys.has(k));
|
|
1219
1230
|
if (remainingKeys.length > 0) if (fnoxAvailable()) fnoxExport(opts.profile, identityKey).fold((err) => {
|
|
1220
1231
|
warnings.push(`fnox export failed: ${err.message}`);
|
|
@@ -1227,6 +1238,7 @@ const bootSafe = (options) => {
|
|
|
1227
1238
|
});
|
|
1228
1239
|
else {
|
|
1229
1240
|
if (!hasSealedValues) warnings.push("fnox not available — no secrets injected");
|
|
1241
|
+
else warnings.push("fnox not available — unsealed secrets could not be resolved");
|
|
1230
1242
|
for (const key of remainingKeys) skipped.push(key);
|
|
1231
1243
|
}
|
|
1232
1244
|
if (inject) for (const [key, value] of Object.entries(secrets)) process.env[key] = value;
|
package/dist/index.d.ts
CHANGED
|
@@ -315,7 +315,7 @@ type DiscoveredConfig = {
|
|
|
315
315
|
readonly path: string;
|
|
316
316
|
readonly source: "cwd" | "search";
|
|
317
317
|
};
|
|
318
|
-
/** Discover config by checking CWD, then ENVPKT_SEARCH_PATH, then
|
|
318
|
+
/** Discover config by checking CWD, then ENVPKT_SEARCH_PATH, then dynamic Platform paths */
|
|
319
319
|
declare const discoverConfig: (cwd?: string) => Option<DiscoveredConfig>;
|
|
320
320
|
/** Read a config file, returning Either<ConfigError, string> */
|
|
321
321
|
declare const readConfigFile: (path: string) => Either<ConfigError, string>;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { FormatRegistry, Type } from "@sinclair/typebox";
|
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { TypeCompiler } from "@sinclair/typebox/compiler";
|
|
4
4
|
import { Cond, Left, List, None, Option, Right, Some, Try } from "functype";
|
|
5
|
-
import { Env, Fs, Path } from "functype-os";
|
|
5
|
+
import { Env, Fs, Path, Platform } from "functype-os";
|
|
6
6
|
import { TomlDate, parse } from "smol-toml";
|
|
7
7
|
import { chmodSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { execFileSync } from "node:child_process";
|
|
@@ -149,28 +149,26 @@ const expandGlobPath = (expanded) => {
|
|
|
149
149
|
const prefix = globSegment.replace(/\*.*$/, "");
|
|
150
150
|
return Fs.readdirSync(parentDir).fold(() => [], (entries) => entries.filter((entry) => entry.startsWith(prefix)).map((entry) => join(parentDir, entry, suffix)).filter((p) => Fs.existsSync(p)).toArray());
|
|
151
151
|
};
|
|
152
|
-
/**
|
|
153
|
-
const
|
|
154
|
-
"~/.envpkt/envpkt.toml",
|
|
155
|
-
"~/OneDrive/.envpkt/envpkt.toml",
|
|
156
|
-
"~/Library/CloudStorage/OneDrive-Personal/.envpkt/envpkt.toml",
|
|
157
|
-
"~/Library/CloudStorage/OneDrive-SharedLibraries-*/.envpkt/envpkt.toml",
|
|
152
|
+
/** Env-var fallback paths for cases where Platform detection misses */
|
|
153
|
+
const ENV_FALLBACK_PATHS = [
|
|
158
154
|
"$WINHOME/OneDrive/.envpkt/envpkt.toml",
|
|
159
155
|
"$USERPROFILE/OneDrive/.envpkt/envpkt.toml",
|
|
160
156
|
"$OneDrive/.envpkt/envpkt.toml",
|
|
161
157
|
"$OneDriveConsumer/.envpkt/envpkt.toml",
|
|
162
158
|
"$OneDriveCommercial/.envpkt/envpkt.toml",
|
|
163
|
-
"/mnt/c/Users/$USER/OneDrive/.envpkt/envpkt.toml",
|
|
164
|
-
"~/Library/Mobile Documents/com~apple~CloudDocs/.envpkt/envpkt.toml",
|
|
165
|
-
"~/Dropbox/.envpkt/envpkt.toml",
|
|
166
159
|
"$DROPBOX_PATH/.envpkt/envpkt.toml",
|
|
167
|
-
"~/Google Drive/My Drive/.envpkt/envpkt.toml",
|
|
168
|
-
"~/Library/CloudStorage/GoogleDrive-*/.envpkt/envpkt.toml",
|
|
169
160
|
"$GOOGLE_DRIVE/.envpkt/envpkt.toml",
|
|
170
161
|
"$WINHOME/.envpkt/envpkt.toml",
|
|
171
162
|
"$USERPROFILE/.envpkt/envpkt.toml"
|
|
172
163
|
];
|
|
173
|
-
/**
|
|
164
|
+
/** Build discovery paths dynamically from Platform home and cloud storage detection */
|
|
165
|
+
const buildSearchPaths = () => {
|
|
166
|
+
const paths = [];
|
|
167
|
+
for (const home of Platform.homeDirs().toArray()) paths.push(join(home, ".envpkt", CONFIG_FILENAME$1));
|
|
168
|
+
for (const cloud of Platform.cloudStorageDirs().toArray()) paths.push(join(cloud.path, ".envpkt", CONFIG_FILENAME$1));
|
|
169
|
+
return paths;
|
|
170
|
+
};
|
|
171
|
+
/** Discover config by checking CWD, then ENVPKT_SEARCH_PATH, then dynamic Platform paths */
|
|
174
172
|
const discoverConfig = (cwd) => {
|
|
175
173
|
const cwdCandidate = join(cwd ?? process.cwd(), CONFIG_FILENAME$1);
|
|
176
174
|
if (Fs.existsSync(cwdCandidate)) return Option({
|
|
@@ -178,7 +176,7 @@ const discoverConfig = (cwd) => {
|
|
|
178
176
|
source: "cwd"
|
|
179
177
|
});
|
|
180
178
|
const customPaths = Env.get("ENVPKT_SEARCH_PATH").fold(() => [], (v) => v.split(":").filter(Boolean));
|
|
181
|
-
for (const template of
|
|
179
|
+
for (const template of customPaths) {
|
|
182
180
|
const expanded = expandPath(template);
|
|
183
181
|
if (!expanded || expanded.startsWith("/.envpkt")) continue;
|
|
184
182
|
const matches = expandGlobPath(expanded);
|
|
@@ -187,6 +185,18 @@ const discoverConfig = (cwd) => {
|
|
|
187
185
|
source: "search"
|
|
188
186
|
});
|
|
189
187
|
}
|
|
188
|
+
for (const p of buildSearchPaths()) if (Fs.existsSync(p)) return Option({
|
|
189
|
+
path: p,
|
|
190
|
+
source: "search"
|
|
191
|
+
});
|
|
192
|
+
for (const template of ENV_FALLBACK_PATHS) {
|
|
193
|
+
const expanded = expandPath(template);
|
|
194
|
+
if (!expanded || expanded.startsWith("/.envpkt")) continue;
|
|
195
|
+
if (Fs.existsSync(expanded)) return Option({
|
|
196
|
+
path: expanded,
|
|
197
|
+
source: "search"
|
|
198
|
+
});
|
|
199
|
+
}
|
|
190
200
|
return Option(void 0);
|
|
191
201
|
};
|
|
192
202
|
/** Read a config file, returning Either<ConfigError, string> */
|
|
@@ -1720,6 +1730,7 @@ const bootSafe = (options) => {
|
|
|
1720
1730
|
sealedKeys.add(key);
|
|
1721
1731
|
}
|
|
1722
1732
|
});
|
|
1733
|
+
else if (hasSealedValues && !identityFilePath) warnings.push("Sealed values found but no identity file available for decryption");
|
|
1723
1734
|
const remainingKeys = metaKeys.filter((k) => !sealedKeys.has(k));
|
|
1724
1735
|
if (remainingKeys.length > 0) if (fnoxAvailable()) fnoxExport(opts.profile, identityKey).fold((err) => {
|
|
1725
1736
|
warnings.push(`fnox export failed: ${err.message}`);
|
|
@@ -1732,6 +1743,7 @@ const bootSafe = (options) => {
|
|
|
1732
1743
|
});
|
|
1733
1744
|
else {
|
|
1734
1745
|
if (!hasSealedValues) warnings.push("fnox not available — no secrets injected");
|
|
1746
|
+
else warnings.push("fnox not available — unsealed secrets could not be resolved");
|
|
1735
1747
|
for (const key of remainingKeys) skipped.push(key);
|
|
1736
1748
|
}
|
|
1737
1749
|
if (inject) for (const [key, value] of Object.entries(secrets)) process.env[key] = value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "envpkt",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "Credential lifecycle and fleet management for AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"credentials",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@sinclair/typebox": "^0.34.48",
|
|
44
44
|
"commander": "^14.0.3",
|
|
45
45
|
"functype": "^0.49.0",
|
|
46
|
-
"functype-os": "^0.
|
|
46
|
+
"functype-os": "^0.3.0",
|
|
47
47
|
"smol-toml": "^1.6.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/node": "^24.
|
|
50
|
+
"@types/node": "^24.12.0",
|
|
51
51
|
"ts-builds": "^2.5.0",
|
|
52
52
|
"tsdown": "^0.20.3",
|
|
53
53
|
"tsx": "^4.21.0"
|