@icoretech/warden-mcp 0.1.9 → 0.1.10

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/bw/bwCli.js CHANGED
@@ -16,9 +16,10 @@ export async function runBw(args, opts = {}) {
16
16
  const bwBin = process.env.BW_BIN ?? 'bw';
17
17
  // Ensure the CLI never blocks waiting for a prompt (e.g. master password).
18
18
  // This is critical for running as an MCP server / in test automation.
19
- const finalArgs = args.includes('--nointeraction')
20
- ? args
21
- : ['--nointeraction', ...args];
19
+ const injectNoInteraction = opts.noInteraction ?? true;
20
+ const finalArgs = injectNoInteraction && !args.includes('--nointeraction')
21
+ ? ['--nointeraction', ...args]
22
+ : args;
22
23
  const env = { ...process.env, ...(opts.env ?? {}) };
23
24
  const debug = (process.env.KEYCHAIN_DEBUG_BW ?? 'false').toLowerCase() === 'true';
24
25
  const startedAt = Date.now();
@@ -169,7 +169,7 @@ export class BwSessionManager {
169
169
  });
170
170
  const tryUnlock = async () => {
171
171
  try {
172
- const { stdout } = await runBw(['unlock', '--passwordenv', 'BW_PASSWORD', '--raw'], { env: unlockEnv, timeoutMs: 60_000 });
172
+ const { stdout } = await runBw(['unlock', '--passwordenv', 'BW_PASSWORD', '--raw'], { env: unlockEnv, timeoutMs: 60_000, noInteraction: false });
173
173
  return stdout.trim();
174
174
  }
175
175
  catch {
@@ -186,6 +186,7 @@ export class BwSessionManager {
186
186
  BW_HOST: this.env.host,
187
187
  }),
188
188
  timeoutMs: 60_000,
189
+ noInteraction: false,
189
190
  });
190
191
  return stdout.trim();
191
192
  }
@@ -195,7 +196,7 @@ export class BwSessionManager {
195
196
  '--passwordenv',
196
197
  'BW_PASSWORD',
197
198
  '--raw',
198
- ], { env: unlockEnv, timeoutMs: 60_000 });
199
+ ], { env: unlockEnv, timeoutMs: 60_000, noInteraction: false });
199
200
  return stdout.trim();
200
201
  }
201
202
  catch {
@@ -63,35 +63,34 @@ const CODAS = [
63
63
  'ng',
64
64
  ];
65
65
  function titleCase(s) {
66
- if (!s)
67
- return s;
68
- const first = s.charAt(0);
69
- return first.toUpperCase() + s.slice(1);
66
+ return s.charAt(0).toUpperCase() + s.slice(1);
70
67
  }
71
68
  function randomWord(opts, deps) {
72
69
  // "Word-like" usernames without pulling a large word list dependency.
73
70
  // Produces a pronounceable-ish token such as "cravon" or "Plenast7".
74
- for (let i = 0; i < 12; i++) {
75
- const syllables = 2 + deps.randInt(2); // 2-3
76
- let s = '';
77
- for (let j = 0; j < syllables; j++) {
78
- s += ONSETS[deps.randInt(ONSETS.length)] ?? 'k';
79
- s += VOWELS[deps.randInt(VOWELS.length)] ?? 'a';
80
- const coda = CODAS[deps.randInt(CODAS.length)] ?? '';
81
- // Avoid overly long tokens by preferring empty coda on earlier syllables.
82
- s += j === syllables - 1 ? coda : coda.length > 1 ? '' : coda;
71
+ // With the current arrays, minimum output is 4 chars ("baba") and maximum
72
+ // is ~14 chars, so the length check always passes on the first iteration.
73
+ const syllables = 2 + deps.randInt(2); // 2-3
74
+ let s = '';
75
+ for (let j = 0; j < syllables; j++) {
76
+ const onset = ONSETS[deps.randInt(ONSETS.length)];
77
+ const vowel = VOWELS[deps.randInt(VOWELS.length)];
78
+ const coda = CODAS[deps.randInt(CODAS.length)];
79
+ s += onset;
80
+ s += vowel;
81
+ // Avoid overly long tokens by preferring empty coda on earlier syllables.
82
+ if (j === syllables - 1) {
83
+ s += coda;
84
+ }
85
+ else if (coda.length <= 1) {
86
+ s += coda;
83
87
  }
84
- if (s.length < 4 || s.length > 18)
85
- continue;
86
- if (opts.capitalize)
87
- s = titleCase(s);
88
- if (opts.includeNumber)
89
- s += String(deps.randInt(10));
90
- return s;
91
88
  }
92
- // Fallback: still deterministic with deps.randInt in tests.
93
- const fallback = `user${deps.randInt(1_000_000)}`;
94
- return opts.capitalize ? titleCase(fallback) : fallback;
89
+ if (opts.capitalize)
90
+ s = titleCase(s);
91
+ if (opts.includeNumber)
92
+ s += String(deps.randInt(10));
93
+ return s;
95
94
  }
96
95
  function parseEmail(email) {
97
96
  const trimmed = email.trim();
@@ -126,7 +125,7 @@ export function generateUsername(input = {}, deps) {
126
125
  throw new Error('email is required for plus_addressed_email');
127
126
  }
128
127
  const { local, domain } = parseEmail(input.email);
129
- const baseLocal = local.split('+')[0] ?? local;
128
+ const baseLocal = local.split('+')[0];
130
129
  return `${baseLocal}+${word}@${domain}`;
131
130
  }
132
131
  if (type === 'catch_all_email') {
@@ -136,7 +135,6 @@ export function generateUsername(input = {}, deps) {
136
135
  const domain = normalizeDomain(input.domain);
137
136
  return `${word}@${domain}`;
138
137
  }
139
- // Exhaustive check.
140
- const _never = type;
141
- return _never;
138
+ // Exhaustive check — TypeScript errors here if a new type is added without a handler.
139
+ throw new Error(`Unsupported username generator type: ${type}`);
142
140
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@icoretech/warden-mcp",
4
- "version": "0.1.9",
4
+ "version": "0.1.10",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "Vaultwarden/Bitwarden MCP server backed by Bitwarden CLI (bw).",
@@ -37,6 +37,7 @@
37
37
  "build": "tsc -p .",
38
38
  "start": "node dist/server.js",
39
39
  "test": "npm run build && node --test \"dist/**/*.test.js\"",
40
+ "test:coverage": "npm run build && node --test --experimental-test-coverage \"dist/**/*.test.js\"",
40
41
  "test:integration": "npm run build && node --test --test-timeout=45000 \"dist/integration/**/*.test.js\"",
41
42
  "test:session-regression": "node scripts/session-flood-regression.mjs",
42
43
  "lint": "biome check --write --assist-enabled=true . && tsc --noEmit"