@envsave/cli 1.0.39 → 1.0.40

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.
Files changed (2) hide show
  1. package/dist/cli.js +35 -14
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -259,6 +259,7 @@ __export(exports_vault, {
259
259
  showSecret: () => showSecret,
260
260
  setSecret: () => setSecret,
261
261
  searchKeys: () => searchKeys,
262
+ revealKeysByPattern: () => revealKeysByPattern,
262
263
  revealKey: () => revealKey,
263
264
  listKeys: () => listKeys,
264
265
  initVault: () => initVault,
@@ -573,6 +574,22 @@ function revealKey(cleanName, password) {
573
574
  const opaque = computeOpaqueName(vault.hmacSeed, cleanName, sshKeyContent);
574
575
  return opaque in vault.secrets ? opaque : undefined;
575
576
  }
577
+ function revealKeysByPattern(patterns, password) {
578
+ const vault = readMainVault(password);
579
+ const sshKeyContent = loadSshKey(vault);
580
+ writeSessionCache(vault.secrets, vault.registry);
581
+ return patterns.map((pattern) => {
582
+ const lower = pattern.toLowerCase();
583
+ const matchingNames = vault.registry.filter((k) => k.toLowerCase().includes(lower));
584
+ return {
585
+ pattern,
586
+ matches: matchingNames.map((name) => ({
587
+ name,
588
+ opaque: computeOpaqueName(vault.hmacSeed, name, sshKeyContent)
589
+ }))
590
+ };
591
+ });
592
+ }
576
593
  function getSecretFromCache(opaqueKey) {
577
594
  checkRateLimit();
578
595
  const cache = readSessionCache();
@@ -893,7 +910,7 @@ Usage:
893
910
  envsave set <key> <value> Add/update a secret (outputs opaque key)
894
911
  envsave get <opaque_key> Retrieve a value (no password needed)
895
912
  envsave show <key> Show real value by key name (password required)
896
- envsave reveal <key> [key2] [key3]... Show opaque key name(s) (password required)
913
+ envsave reveal <keyword> [keyword2]... Show opaque key(s) for any name matching keyword (password required)
897
914
  envsave delete <key> Remove a secret (password required)
898
915
  envsave search <keyword> Search keys matching keyword (no password)
899
916
  envsave scan [dir] Scan project for env variable usage
@@ -1052,27 +1069,31 @@ Use 'envsave reveal <KEY>' to get the opaque key for each secret.`);
1052
1069
  break;
1053
1070
  }
1054
1071
  case "reveal": {
1055
- const keys = args.slice(1);
1056
- if (keys.length === 0) {
1057
- console.error("Usage: envsave reveal <key> [key2] [key3]...");
1072
+ const patterns = args.slice(1);
1073
+ if (patterns.length === 0) {
1074
+ console.error("Usage: envsave reveal <keyword> [keyword2]...");
1058
1075
  process.exit(1);
1059
1076
  }
1060
1077
  const password = await requirePassword();
1061
- let notFound = 0;
1062
- for (const key of keys) {
1063
- const opaque = revealKey(key, password);
1064
- if (opaque) {
1078
+ const results = revealKeysByPattern(patterns, password);
1079
+ let totalMatches = 0;
1080
+ let notFoundPatterns = 0;
1081
+ for (const { pattern, matches } of results) {
1082
+ if (matches.length === 0) {
1083
+ console.error(`No keys matching '${pattern}'.`);
1084
+ notFoundPatterns++;
1085
+ continue;
1086
+ }
1087
+ for (const { name, opaque } of matches) {
1065
1088
  console.log(`
1066
- ${key} → ${opaque}`);
1089
+ ${name} → ${opaque}`);
1067
1090
  console.log(` envsave.get("${opaque}")`);
1068
- } else {
1069
- console.error(`Secret '${key}' not found.`);
1070
- notFound++;
1091
+ totalMatches++;
1071
1092
  }
1072
1093
  }
1073
- if (keys.length > 1 && notFound === 0)
1094
+ if (totalMatches > 0)
1074
1095
  console.log();
1075
- if (notFound > 0 && notFound === keys.length)
1096
+ if (notFoundPatterns === patterns.length)
1076
1097
  process.exit(1);
1077
1098
  break;
1078
1099
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envsave/cli",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Local secret vault for LLM-safe environments — encrypted secrets that agents can't bulk-discover",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",