@chappibunny/repolens 0.9.0 → 1.2.0

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.
@@ -103,13 +103,13 @@ function validateScanConfig(scan) {
103
103
  }
104
104
  }
105
105
 
106
- if (scan.exclude) {
107
- if (!Array.isArray(scan.exclude)) {
108
- errors.push("scan.exclude must be an array of glob patterns");
106
+ if (scan.ignore) {
107
+ if (!Array.isArray(scan.ignore)) {
108
+ errors.push("scan.ignore must be an array of glob patterns");
109
109
  } else {
110
- for (const pattern of scan.exclude) {
110
+ for (const pattern of scan.ignore) {
111
111
  if (typeof pattern !== "string") {
112
- errors.push(`Invalid pattern in scan.exclude: ${pattern} (must be string)`);
112
+ errors.push(`Invalid pattern in scan.ignore: ${pattern} (must be string)`);
113
113
  continue; // Skip further checks if not a string
114
114
  }
115
115
  }
@@ -135,7 +135,7 @@ function validatePublishers(publishers) {
135
135
  return errors;
136
136
  }
137
137
 
138
- const validPublishers = ["notion", "markdown", "confluence"];
138
+ const validPublishers = ["notion", "markdown", "confluence", "github_wiki"];
139
139
 
140
140
  if (Array.isArray(publishers)) {
141
141
  for (const pub of publishers) {
@@ -207,33 +207,34 @@ function checkNotionWarnings(notion) {
207
207
  }
208
208
 
209
209
  /**
210
- * Validate domains configuration
210
+ * Validate domains configuration (object format: { key: { match: [], description? } })
211
211
  */
212
212
  function validateDomains(domains) {
213
213
  const errors = [];
214
214
 
215
- if (!Array.isArray(domains)) {
216
- errors.push("domains must be an array");
215
+ if (typeof domains !== "object" || Array.isArray(domains)) {
216
+ errors.push("domains must be an object");
217
217
  return errors;
218
218
  }
219
219
 
220
- for (const domain of domains) {
221
- if (!domain.name || typeof domain.name !== "string") {
222
- errors.push("Each domain must have a 'name' field (string)");
220
+ for (const [key, domain] of Object.entries(domains)) {
221
+ if (typeof domain !== "object" || Array.isArray(domain)) {
222
+ errors.push(`domains.${key} must be an object`);
223
+ continue;
223
224
  }
224
225
 
225
- if (!domain.patterns || !Array.isArray(domain.patterns)) {
226
- errors.push(`Domain '${domain.name}' must have 'patterns' array`);
226
+ if (!domain.match || !Array.isArray(domain.match)) {
227
+ errors.push(`domains.${key} must have a 'match' array`);
227
228
  } else {
228
- for (const pattern of domain.patterns) {
229
+ for (const pattern of domain.match) {
229
230
  if (typeof pattern !== "string") {
230
- errors.push(`Invalid pattern in domain '${domain.name}': ${pattern}`);
231
+ errors.push(`Invalid pattern in domains.${key}.match: ${pattern}`);
231
232
  }
232
233
  }
233
234
  }
234
235
 
235
236
  if (domain.description && typeof domain.description !== "string") {
236
- errors.push(`Domain '${domain.name}' description must be a string`);
237
+ errors.push(`domains.${key}.description must be a string`);
237
238
  }
238
239
  }
239
240
 
@@ -319,17 +320,25 @@ function checkForInjection(config) {
319
320
  });
320
321
  }
321
322
 
322
- // Check domain patterns
323
- if (config.domains && Array.isArray(config.domains)) {
324
- config.domains.forEach((domain, i) => {
325
- if (domain.patterns && Array.isArray(domain.patterns)) {
326
- domain.patterns.forEach((pattern, j) => {
323
+ if (config.scan?.ignore && Array.isArray(config.scan.ignore)) {
324
+ config.scan.ignore.forEach((pattern, i) => {
325
+ if (typeof pattern === "string") {
326
+ checkString(pattern, `scan.ignore[${i}]`);
327
+ }
328
+ });
329
+ }
330
+
331
+ // Check domain patterns (object format: { key: { match: [] } })
332
+ if (config.domains && typeof config.domains === "object" && !Array.isArray(config.domains)) {
333
+ for (const [domainKey, domain] of Object.entries(config.domains)) {
334
+ if (domain.match && Array.isArray(domain.match)) {
335
+ domain.match.forEach((pattern, j) => {
327
336
  if (typeof pattern === "string") {
328
- checkString(pattern, `domains[${i}].patterns[${j}]`);
337
+ checkString(pattern, `domains.${domainKey}.match[${j}]`);
329
338
  }
330
339
  });
331
340
  }
332
- });
341
+ }
333
342
  }
334
343
 
335
344
  return errors;