log-llm-config-staging 1.3.97 → 1.3.98

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.
@@ -54,24 +54,18 @@ function expandRecursiveGlobPathPattern(pathPattern, fileType, home, contentForm
54
54
  }
55
55
  function expandGlobPathPattern(pathPattern, fileType, home, projectRoot, contentFormat, dirGlob, absolutePathPrefixes = []) {
56
56
  const norm = pathPattern.replace(/\\/g, '/');
57
- const targets = [];
58
- const asteriskIndex = norm.indexOf('*');
59
- if (asteriskIndex === -1)
60
- return targets;
57
+ if (!norm.includes('*'))
58
+ return [];
59
+ // `**` is the recursive-glob sigil handled by expandRecursiveGlobPathPattern.
60
+ if (norm.includes('**'))
61
+ return [];
61
62
  const isDir = norm.endsWith('/');
62
- const [before, after] = norm.split('*');
63
- const afterNorm = after.replace(/^\/+/, '');
64
- // If `before` doesn't end with '/', the * is mid-segment (e.g. "extensions/saoudrizwan.claude-dev*/" →
65
- // parent="extensions/", namePrefix="saoudrizwan.claude-dev"). Split on last '/' to get the real base dir.
66
- let parentPart = before.replace(/\/+$/, '');
67
- let namePrefix = '';
68
- if (!before.endsWith('/')) {
69
- const lastSlash = parentPart.lastIndexOf('/');
70
- if (lastSlash !== -1) {
71
- namePrefix = parentPart.slice(lastSlash + 1);
72
- parentPart = parentPart.slice(0, lastSlash);
73
- }
74
- }
63
+ // Resolve the literal prefix that ends before the first wildcard segment.
64
+ const firstStarIndex = norm.indexOf('*');
65
+ const lastSlashBeforeStar = norm.lastIndexOf('/', firstStarIndex);
66
+ if (lastSlashBeforeStar === -1)
67
+ return [];
68
+ const parentPart = norm.slice(0, lastSlashBeforeStar);
75
69
  let basePath;
76
70
  if (parentPart.startsWith('~/')) {
77
71
  basePath = join(home, parentPart.slice(2));
@@ -83,20 +77,61 @@ function expandGlobPathPattern(pathPattern, fileType, home, projectRoot, content
83
77
  basePath = join(projectRoot, parentPart.startsWith('/') ? parentPart.slice(1) : parentPart);
84
78
  }
85
79
  if (!existsSync(basePath))
86
- return targets;
87
- try {
88
- for (const entry of readdirSync(basePath, { withFileTypes: true })) {
89
- if (!entry.isDirectory())
90
- continue;
91
- if (namePrefix && !entry.name.startsWith(namePrefix))
92
- continue;
93
- const resolvedPath = join(basePath, entry.name, afterNorm);
94
- if (!existsSync(resolvedPath))
95
- continue;
96
- targets.push({ path: resolvedPath, file_type: fileType, isDirectory: isDir, dir_glob: dirGlob, content_format: contentFormat });
80
+ return [];
81
+ // Walk remaining segments. Each segment may be a bare wildcard '*' (matches
82
+ // any single directory), a prefix/suffix wildcard like 'foo*' or 'foo*bar',
83
+ // or a literal name. Recursion correctly handles multi-wildcard patterns
84
+ // such as ``*/*/cowork_plugins/marketplaces/*/.claude-plugin/marketplace.json``
85
+ // the prior single-split implementation only expanded the first wildcard
86
+ // and silently pushed a partial directory path as the target, which then
87
+ // surfaced as EISDIR when downstream collectors tried to read it as a file.
88
+ const remaining = norm.slice(lastSlashBeforeStar + 1);
89
+ const segments = remaining.split('/').filter((s) => s !== '');
90
+ const targets = [];
91
+ function recurse(currentPath, segIdx) {
92
+ if (segIdx === segments.length) {
93
+ if (!existsSync(currentPath))
94
+ return;
95
+ targets.push({ path: currentPath, file_type: fileType, isDirectory: isDir, dir_glob: dirGlob, content_format: contentFormat });
96
+ return;
97
+ }
98
+ const seg = segments[segIdx];
99
+ if (seg === '*') {
100
+ if (!existsSync(currentPath))
101
+ return;
102
+ try {
103
+ for (const entry of readdirSync(currentPath, { withFileTypes: true })) {
104
+ if (!entry.isDirectory())
105
+ continue;
106
+ recurse(join(currentPath, entry.name), segIdx + 1);
107
+ }
108
+ }
109
+ catch { /* ignore read errors */ }
110
+ }
111
+ else if (seg.includes('*')) {
112
+ const wildcardIdx = seg.indexOf('*');
113
+ const prefix = seg.slice(0, wildcardIdx);
114
+ const suffix = seg.slice(wildcardIdx + 1);
115
+ if (!existsSync(currentPath))
116
+ return;
117
+ try {
118
+ for (const entry of readdirSync(currentPath, { withFileTypes: true })) {
119
+ if (!entry.isDirectory())
120
+ continue;
121
+ if (prefix && !entry.name.startsWith(prefix))
122
+ continue;
123
+ if (suffix && !entry.name.endsWith(suffix))
124
+ continue;
125
+ recurse(join(currentPath, entry.name), segIdx + 1);
126
+ }
127
+ }
128
+ catch { /* ignore read errors */ }
129
+ }
130
+ else {
131
+ recurse(join(currentPath, seg), segIdx + 1);
97
132
  }
98
133
  }
99
- catch { /* ignore read errors */ }
134
+ recurse(basePath, 0);
100
135
  return targets;
101
136
  }
102
137
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "log-llm-config-staging",
3
- "version": "1.3.97",
3
+ "version": "1.3.98",
4
4
  "description": "CLI helpers for logging hardware UUIDs and posting startup payloads to Optimus Security.",
5
5
  "type": "module",
6
6
  "bin": {