@adaptic/maestro 1.5.1 → 1.5.2
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/bin/maestro.mjs +18 -16
- package/package.json +1 -1
package/bin/maestro.mjs
CHANGED
|
@@ -762,26 +762,28 @@ function loadMaestroignore(cwd) {
|
|
|
762
762
|
}
|
|
763
763
|
|
|
764
764
|
function patternToRegex(pat) {
|
|
765
|
-
//
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
// Step order matters: ** must be captured before single * to preserve
|
|
772
|
-
// recursive semantics. * is intentionally NOT in the regex-escape char
|
|
773
|
-
// class so we can rewrite it after escaping the other specials.
|
|
774
|
-
if (pat.includes("*")) {
|
|
775
|
-
const escaped = pat
|
|
776
|
-
.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
765
|
+
// Helper: convert a glob-aware pattern to its regex source.
|
|
766
|
+
// ** must be substituted before single * so we don't double-rewrite it.
|
|
767
|
+
// * is intentionally outside the regex-escape char class so the
|
|
768
|
+
// glob substitution can find unescaped `*` characters afterward.
|
|
769
|
+
const globToRe = (p) =>
|
|
770
|
+
p.replace(/[.+^${}()|[\]\\]/g, "\\$&")
|
|
777
771
|
.replace(/\*\*/g, "<DBL>")
|
|
778
772
|
.replace(/\*/g, "[^/]*")
|
|
779
773
|
.replace(/<DBL>/g, ".*");
|
|
780
|
-
|
|
774
|
+
|
|
775
|
+
// Directory prefix: `scripts/daemon/` or `agents/sophie-*/` match
|
|
776
|
+
// anything under that path (recursive).
|
|
777
|
+
if (pat.endsWith("/")) {
|
|
778
|
+
return new RegExp("^" + globToRe(pat));
|
|
779
|
+
}
|
|
780
|
+
// Single-line glob: must match in full (no trailing slash).
|
|
781
|
+
if (pat.includes("*")) {
|
|
782
|
+
return new RegExp("^" + globToRe(pat) + "$");
|
|
781
783
|
}
|
|
782
|
-
// Exact: also
|
|
783
|
-
// without trailing slash
|
|
784
|
-
//
|
|
784
|
+
// Exact: also matches anything underneath (gitignore semantics — a
|
|
785
|
+
// pattern without trailing slash still protects a directory if it
|
|
786
|
+
// resolves to one).
|
|
785
787
|
const escaped = pat.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
786
788
|
return new RegExp("^" + escaped + "(/|$)");
|
|
787
789
|
}
|