-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathpackaging_policy.py
More file actions
38 lines (32 loc) · 1.11 KB
/
Copy pathpackaging_policy.py
File metadata and controls
38 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Shared inclusion policy for skill packaging and security attestation."""
from __future__ import annotations
import fnmatch
from pathlib import Path
# Runtime/development state is never part of a distributable Skill bundle.
EXCLUDE_DIRS = {
"__pycache__",
"node_modules",
".pytest_cache",
".ruff_cache",
".venv",
".in_use",
}
EXCLUDE_GLOBS = {"*.pyc"}
EXCLUDE_FILES = {
".DS_Store",
".security-scan-passed",
".skill-regression-reviewed",
".skill-regression-baseline.json",
}
ROOT_EXCLUDE_DIRS = {"evals", "dist", "tests", ".enrich"}
def should_exclude(rel_path: Path, include_evals: bool = False) -> bool:
"""Return whether a path relative to the skill's parent must not ship."""
parts = rel_path.parts
if any(part in EXCLUDE_DIRS for part in parts):
return True
root_excludes = ROOT_EXCLUDE_DIRS - {"evals"} if include_evals else ROOT_EXCLUDE_DIRS
if len(parts) > 1 and parts[1] in root_excludes:
return True
if rel_path.name in EXCLUDE_FILES:
return True
return any(fnmatch.fnmatch(rel_path.name, pattern) for pattern in EXCLUDE_GLOBS)