auto-mode 2.0.0 → 2.0.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.
@@ -17740,7 +17740,7 @@ function classifyEdit(action, scope) {
17740
17740
  kind: "jev",
17741
17741
  reason: "target in a checkout outside the scope"
17742
17742
  };
17743
- const exclusion = [action.target, action.requested].some((each) => scope.protectedDirs.some((dir) => isWithin(each, dir))) ? "auto-mode configuration or state" : findExclusion(path) ?? findExclusion(toWorktreePath(action.requested, scope.worktrees));
17743
+ const exclusion = [action.target, action.requested].some((each) => scope.protectedDirs.some((directory) => isWithin(each, directory))) ? "auto-mode configuration or state" : findExclusion(path) ?? findExclusion(toWorktreePath(action.requested, scope.worktrees));
17744
17744
  if (exclusion !== null) return {
17745
17745
  kind: "jev",
17746
17746
  reason: `target is ${exclusion}`
@@ -17809,10 +17809,10 @@ function toWorktreePath(path, worktrees) {
17809
17809
  return worktree === null ? path : relative(worktree, path).split(sep).join("/");
17810
17810
  }
17811
17811
  function findWorktree(target, worktrees) {
17812
- return worktrees.filter((worktree) => isWithin(target, worktree)).toSorted((a, b) => b.length - a.length)[0] ?? null;
17812
+ return worktrees.filter((worktree) => isWithin(target, worktree)).toSorted((left, right) => right.length - left.length)[0] ?? null;
17813
17813
  }
17814
- function isWithin(path, dir) {
17815
- const offset = relative(dir, path);
17814
+ function isWithin(path, directory) {
17815
+ const offset = relative(directory, path);
17816
17816
  return offset !== "" && !offset.startsWith("..") && !offset.startsWith(sep);
17817
17817
  }
17818
17818
  const EXCLUDED_PATHS = [
@@ -17832,16 +17832,16 @@ const EXCLUDED_PATHS = [
17832
17832
  [".gnupg", "a credential file"]
17833
17833
  ];
17834
17834
  const EXCLUDED_NAMES = [
17835
- [/^(?:agents|claude)(?:\.[\w-]+)?\.md$/i, "agent configuration"],
17836
- [/^\.mcp\.json$/i, "agent configuration"],
17837
- [/^settings(?:\.[\w-]+)?\.json$/i, "a settings file"],
17838
- [/^(?:hooks\.json|\.?lefthook(?:-local)?\.ya?ml|\.pre-commit-config\.ya?ml)$/i, "a hook file"],
17839
- [/^(?:package\.json|\.?bunfig\.toml|\.gitattributes)$/i, "a hook file"],
17840
- [/^\.gitlab-ci\.ya?ml$/i, "a CI workflow"],
17841
- [/^\.env(?:\..*)?$|^\.envrc$/i, "an env file"],
17842
- [/^(?:\.netrc|\.npmrc|\.pypirc|\.git-credentials|\.dockercfg|kubeconfig)$/i, "a credential file"],
17843
- [/^credentials(?:\.\w+)?$|^secrets?\.(?:json|ya?ml|toml|env)$/i, "a credential file"],
17844
- [/^id_(?:rsa|dsa|ecdsa|ed25519)|\.(?:pem|key|p12|pfx|jks|keystore|tfvars)$/i, "a credential file"]
17835
+ [/^(?:agents|claude)(?:\.[\w-]+)?\.md$/iu, "agent configuration"],
17836
+ [/^\.mcp\.json$/iu, "agent configuration"],
17837
+ [/^settings(?:\.[\w-]+)?\.json$/iu, "a settings file"],
17838
+ [/^(?:hooks\.json|\.?lefthook(?:-local)?\.ya?ml|\.pre-commit-config\.ya?ml)$/iu, "a hook file"],
17839
+ [/^(?:package\.json|\.?bunfig\.toml|\.gitattributes)$/iu, "a hook file"],
17840
+ [/^\.gitlab-ci\.ya?ml$/iu, "a CI workflow"],
17841
+ [/^\.env(?:\..*)?$|^\.envrc$/iu, "an env file"],
17842
+ [/^(?:\.netrc|\.npmrc|\.pypirc|\.git-credentials|\.dockercfg|kubeconfig)$/iu, "a credential file"],
17843
+ [/^credentials(?:\.\w+)?$|^secrets?\.(?:json|ya?ml|toml|env)$/iu, "a credential file"],
17844
+ [/^id_(?:rsa|dsa|ecdsa|ed25519)|\.(?:pem|key|p12|pfx|jks|keystore|tfvars)$/iu, "a credential file"]
17845
17845
  ];
17846
17846
  function findExclusion(path) {
17847
17847
  const lower = path.toLowerCase();