@ouro.bot/cli 0.1.0-alpha.710 → 0.1.0-alpha.711

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/changelog.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.711",
6
+ "changes": [
7
+ "Allow structured Bitwarden slash-name lookup to ignore malformed unrelated vault items while still failing malformed exact matches."
8
+ ]
9
+ },
4
10
  {
5
11
  "version": "0.1.0-alpha.710",
6
12
  "changes": [
@@ -417,25 +417,44 @@ function isBwLoginItem(value) {
417
417
  return false;
418
418
  return true;
419
419
  }
420
- function parseBwItems(stdout, context) {
420
+ function parseBwItemArray(stdout, context) {
421
421
  let parsed;
422
422
  try {
423
423
  parsed = JSON.parse(stdout);
424
424
  if (!Array.isArray(parsed)) {
425
425
  throw new Error("expected item array");
426
426
  }
427
- const items = parsed;
428
- if (!items.every(isBwLoginItem)) {
429
- throw new Error("expected login items");
430
- }
431
- return items;
432
427
  }
433
428
  catch {
434
- if (Array.isArray(parsed)) {
435
- throw new Error(`bw CLI error: invalid item from ${context}`);
436
- }
437
429
  throw new Error(`bw CLI error: invalid JSON from ${context}`);
438
430
  }
431
+ return parsed;
432
+ }
433
+ function parseBwItems(stdout, context) {
434
+ const items = parseBwItemArray(stdout, context);
435
+ if (!items.every(isBwLoginItem)) {
436
+ throw new Error(`bw CLI error: invalid item from ${context}`);
437
+ }
438
+ return items;
439
+ }
440
+ function parseStructuredBwItems(stdout, context) {
441
+ const rawItems = parseBwItemArray(stdout, context);
442
+ const items = new Map();
443
+ const malformedNames = new Set();
444
+ for (const rawItem of rawItems) {
445
+ if (!rawItem || typeof rawItem !== "object" || Array.isArray(rawItem))
446
+ continue;
447
+ const name = rawItem.name;
448
+ if (typeof name !== "string" || name.trim().length === 0)
449
+ continue;
450
+ if (isBwLoginItem(rawItem)) {
451
+ items.set(name, rawItem);
452
+ }
453
+ else {
454
+ malformedNames.add(name);
455
+ }
456
+ }
457
+ return { items, malformedNames };
439
458
  }
440
459
  function parseBwItem(stdout, context) {
441
460
  let parsed;
@@ -944,8 +963,14 @@ class BitwardenCredentialStore {
944
963
  // --- Private ---
945
964
  async findItemByDomain(domain, session) {
946
965
  if (shouldUseStructuredItemLookup(domain)) {
947
- const items = await this.readStructuredItemCache(session);
948
- return items.get(domain) ?? null;
966
+ const cache = await this.readStructuredItemCache(session);
967
+ if (cache.malformedNames.has(domain)) {
968
+ throw new Error("bw CLI error: invalid item from bw list items");
969
+ }
970
+ const item = cache.items.get(domain);
971
+ if (item)
972
+ return item;
973
+ return null;
949
974
  }
950
975
  const stdout = await this.execBw(["list", "items", "--search", domain], session);
951
976
  const items = parseBwItems(stdout, "bw list items --search");
@@ -995,8 +1020,7 @@ class BitwardenCredentialStore {
995
1020
  if (this.structuredItemCache)
996
1021
  return this.structuredItemCache;
997
1022
  const stdout = await this.execBw(["list", "items"], session);
998
- const items = parseBwItems(stdout, "bw list items");
999
- this.structuredItemCache = new Map(items.map((item) => [item.name, item]));
1023
+ this.structuredItemCache = parseStructuredBwItems(stdout, "bw list items");
1000
1024
  return this.structuredItemCache;
1001
1025
  }
1002
1026
  assertStoredCredentialMatches(domain, data, item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.710",
3
+ "version": "0.1.0-alpha.711",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",