diff options
| author | Michael Moore <1198206+imichaelmoore@users.noreply.github.com> | 2026-08-17 12:57:41 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-17 14:57:41 -0500 |
| commit | 8aa2f06489538f7b4eb660f47731f84edacf006f (patch) | |
| tree | d980c6eab0940252ed2d96f66249760fc681cbd9 /plugins/claude-security/scripts/lib/plugin.py | |
| parent | f4eb5d70b353a3493655e1451ac7f501ef3d5c67 (diff) | |
Claude Security Plugin - v0.10.1-rc7 (#5403)
Diffstat (limited to 'plugins/claude-security/scripts/lib/plugin.py')
| -rw-r--r-- | plugins/claude-security/scripts/lib/plugin.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/claude-security/scripts/lib/plugin.py b/plugins/claude-security/scripts/lib/plugin.py new file mode 100644 index 00000000..c5daa153 --- /dev/null +++ b/plugins/claude-security/scripts/lib/plugin.py @@ -0,0 +1,31 @@ +"""The plugin's fixed names, and its own manifest.""" + +from __future__ import annotations + +import re +from pathlib import Path + +from . import strictjson +from .strictjson import is_map, is_str + +NAME = "claude-security" +ROOT = Path(__file__).resolve().parents[2] +RUN_DIR_NAME = ".claude-security-run" +MODES = ("scan", "changes", "commit") +REPORT_DIR_PREFIX = "CLAUDE-SECURITY-" +# \Z, not $: `$` also matches before a trailing newline, and this id names product files. +SHA_RE = re.compile(r"^[0-9a-fA-F]{7,64}\Z") + + +def version() -> str | None: + """The non-blank version string in the plugin's manifest, or None when there is not one.""" + try: + manifest = strictjson.load(ROOT / ".claude-plugin" / "plugin.json") + except (OSError, ValueError): + return None + if not is_map(manifest): + return None + declared = manifest.get("version") + if not is_str(declared): + return None + return declared.strip() or None |
