@fractary/codex 0.3.0 → 0.3.1
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/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path3 from 'path';
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
|
-
import
|
|
3
|
+
import micromatch3 from 'micromatch';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import yaml from 'js-yaml';
|
|
6
6
|
import fs2 from 'fs/promises';
|
|
@@ -490,7 +490,7 @@ var TypeRegistry = class {
|
|
|
490
490
|
for (const type of sortedTypes) {
|
|
491
491
|
if (type.name === "default") continue;
|
|
492
492
|
for (const pattern of type.patterns) {
|
|
493
|
-
if (
|
|
493
|
+
if (micromatch3.isMatch(normalizedPath, pattern)) {
|
|
494
494
|
this.patternCache.set(filePath, type.name);
|
|
495
495
|
return type.name;
|
|
496
496
|
}
|
|
@@ -545,7 +545,7 @@ var TypeRegistry = class {
|
|
|
545
545
|
}
|
|
546
546
|
return files.filter((file) => {
|
|
547
547
|
const normalized = file.replace(/\\/g, "/");
|
|
548
|
-
return type.patterns.some((pattern) =>
|
|
548
|
+
return type.patterns.some((pattern) => micromatch3.isMatch(normalized, pattern));
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
551
|
/**
|
|
@@ -799,7 +799,7 @@ function extractRawFrontmatter(content) {
|
|
|
799
799
|
}
|
|
800
800
|
function matchPattern(pattern, value) {
|
|
801
801
|
if (pattern === value) return true;
|
|
802
|
-
return isMatch(value, pattern);
|
|
802
|
+
return micromatch3.isMatch(value, pattern);
|
|
803
803
|
}
|
|
804
804
|
function matchAnyPattern(patterns, value) {
|
|
805
805
|
if (patterns.length === 1 && patterns[0] === "*") {
|
|
@@ -2430,7 +2430,7 @@ var DEFAULT_SYNC_CONFIG = {
|
|
|
2430
2430
|
};
|
|
2431
2431
|
function evaluatePath(path6, rules, direction, defaultExcludes = []) {
|
|
2432
2432
|
for (const pattern of defaultExcludes) {
|
|
2433
|
-
if (
|
|
2433
|
+
if (micromatch3.isMatch(path6, pattern)) {
|
|
2434
2434
|
return {
|
|
2435
2435
|
path: path6,
|
|
2436
2436
|
shouldSync: false,
|
|
@@ -2443,7 +2443,7 @@ function evaluatePath(path6, rules, direction, defaultExcludes = []) {
|
|
|
2443
2443
|
if (rule.direction && rule.direction !== direction) {
|
|
2444
2444
|
continue;
|
|
2445
2445
|
}
|
|
2446
|
-
if (
|
|
2446
|
+
if (micromatch3.isMatch(path6, rule.pattern)) {
|
|
2447
2447
|
return {
|
|
2448
2448
|
path: path6,
|
|
2449
2449
|
shouldSync: rule.include,
|
|
@@ -2518,7 +2518,7 @@ function validateRules(rules) {
|
|
|
2518
2518
|
continue;
|
|
2519
2519
|
}
|
|
2520
2520
|
try {
|
|
2521
|
-
|
|
2521
|
+
micromatch3.isMatch("test", rule.pattern);
|
|
2522
2522
|
} catch {
|
|
2523
2523
|
errors.push(`Rule ${i}: invalid pattern "${rule.pattern}"`);
|
|
2524
2524
|
}
|
|
@@ -3131,7 +3131,7 @@ function ruleMatchesContext(rule, context) {
|
|
|
3131
3131
|
return true;
|
|
3132
3132
|
}
|
|
3133
3133
|
function ruleMatchesPath(rule, path6) {
|
|
3134
|
-
return
|
|
3134
|
+
return micromatch3.isMatch(path6, rule.pattern);
|
|
3135
3135
|
}
|
|
3136
3136
|
function ruleMatchesAction(rule, action) {
|
|
3137
3137
|
return rule.actions.includes(action);
|
|
@@ -3192,7 +3192,7 @@ function validateRules2(rules) {
|
|
|
3192
3192
|
continue;
|
|
3193
3193
|
}
|
|
3194
3194
|
try {
|
|
3195
|
-
|
|
3195
|
+
micromatch3.isMatch("test", rule.pattern);
|
|
3196
3196
|
} catch {
|
|
3197
3197
|
errors.push(`Rule ${i}: invalid pattern "${rule.pattern}"`);
|
|
3198
3198
|
}
|