rcf-cli 0.1.0__tar.gz

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.
rcf_cli-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: rcf-cli
3
+ Version: 0.1.0
4
+ Summary: A command-line tool for RCF protocol compliance verification.
5
+ Author-email: Aladdin Aliyev <aladdin@aliyev.site>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: Other/Proprietary License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "rcf-cli"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Aladdin Aliyev", email="aladdin@aliyev.site" },
10
+ ]
11
+ description = "A command-line tool for RCF protocol compliance verification."
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: Other/Proprietary License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = []
20
+
21
+ [project.scripts]
22
+ rcf-cli = "rcf_cli.cli:main"
23
+
24
+ [tool.setuptools.packages.find]
25
+ where = ["."]
26
+ include = ["rcf_cli*"]
@@ -0,0 +1 @@
1
+ # RCF CLI package marker
@@ -0,0 +1,53 @@
1
+ import argparse
2
+ import sys
3
+ import json
4
+ from rcf_cli.scanner import RCFScanner
5
+
6
+ def main():
7
+ parser = argparse.ArgumentParser(description="RCF Protocol Compliance Checker")
8
+ parser.add_argument("path", nargs="?", default=".", help="Path to scan (default: current directory)")
9
+ parser.add_argument("--format", choices=["text", "json"], default="text", help="Output format")
10
+ parser.add_argument("--summary", action="store_true", help="Show summary only")
11
+
12
+ args = parser.parse_args()
13
+
14
+ scanner = RCFScanner(args.path)
15
+ results = scanner.scan_directory()
16
+
17
+ if args.format == "json":
18
+ print(json.dumps(results, indent=2))
19
+ return
20
+
21
+ # Text Output
22
+ print(f"--- RCF Compliance Report ---")
23
+ print(f"Scanning: {args.path}")
24
+ print("-" * 30)
25
+
26
+ protected_count = 0
27
+ issue_count = 0
28
+
29
+ for res in results:
30
+ protected_count += 1
31
+ markers_str = ", ".join(res['markers']) if res['markers'] else "None"
32
+ header_status = "✅ Header Present" if res['has_header'] else "⚠️ Missing Header"
33
+
34
+ if not res['has_header']:
35
+ issue_count += 1
36
+
37
+ if not args.summary:
38
+ print(f"File: {res['path']}")
39
+ print(f" Markers: {markers_str}")
40
+ print(f" Status: {header_status}")
41
+ print()
42
+
43
+ print("-" * 30)
44
+ print(f"Total Protected Files: {protected_count}")
45
+ print(f"Total Compliance Issues: {issue_count}")
46
+
47
+ if issue_count > 0:
48
+ sys.exit(1)
49
+ else:
50
+ sys.exit(0)
51
+
52
+ if __name__ == "__main__":
53
+ main()
@@ -0,0 +1,61 @@
1
+ import os
2
+ import re
3
+ from pathlib import Path
4
+
5
+ class RCFScanner:
6
+ """Scans files and directories for RCF protocol markers."""
7
+
8
+ MARKER_PATTERN = re.compile(r'\[RCF:(PUBLIC|PROTECTED|RESTRICTED|NOTICE)\]')
9
+ HEADER_PATTERN = re.compile(r'NOTICE: This file is protected under RCF-PL v1.1')
10
+
11
+ def __init__(self, root_path, ignore_list=None):
12
+ self.root_path = Path(root_path)
13
+ self.ignore_list = ignore_list or ['.git', '__pycache__', '.venv', 'node_modules']
14
+ self._load_rcfignore()
15
+ self.results = []
16
+
17
+ def _load_rcfignore(self):
18
+ """Loads ignore patterns from .rcfignore if it exists."""
19
+ ignore_file = self.root_path / '.rcfignore'
20
+ if ignore_file.exists():
21
+ for line in ignore_file.read_text().splitlines():
22
+ line = line.strip()
23
+ if line and not line.startswith('#'):
24
+ self.ignore_list.append(line)
25
+
26
+ def should_ignore(self, path):
27
+ """Checks if a path should be ignored based on the ignore list."""
28
+ path_str = str(path.relative_to(self.root_path))
29
+ for ignore_item in self.ignore_list:
30
+ if ignore_item in path.parts or ignore_item in path_str:
31
+ return True
32
+ return False
33
+
34
+ def scan_file(self, file_path):
35
+ """Analyzes a single file for RCF compliance."""
36
+ try:
37
+ content = file_path.read_text(errors='ignore')
38
+ markers = self.MARKER_PATTERN.findall(content)
39
+ has_header = bool(self.HEADER_PATTERN.search(content))
40
+
41
+ return {
42
+ 'path': str(file_path.relative_to(self.root_path)),
43
+ 'markers': list(set(markers)),
44
+ 'has_header': has_header,
45
+ 'is_protected': len(markers) > 0 or has_header
46
+ }
47
+ except Exception as e:
48
+ return {'path': str(file_path), 'error': str(e)}
49
+
50
+ def scan_directory(self):
51
+ """Walks through the directory and scans relevant files."""
52
+ self.results = []
53
+ for root, dirs, files in os.walk(self.root_path):
54
+ dirs[:] = [d for d in dirs if d not in self.ignore_list]
55
+ for file in files:
56
+ file_path = Path(root) / file
57
+ if not self.should_ignore(file_path):
58
+ result = self.scan_file(file_path)
59
+ if result.get('is_protected'):
60
+ self.results.append(result)
61
+ return self.results
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: rcf-cli
3
+ Version: 0.1.0
4
+ Summary: A command-line tool for RCF protocol compliance verification.
5
+ Author-email: Aladdin Aliyev <aladdin@aliyev.site>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: Other/Proprietary License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
@@ -0,0 +1,9 @@
1
+ pyproject.toml
2
+ rcf_cli/__init__.py
3
+ rcf_cli/cli.py
4
+ rcf_cli/scanner.py
5
+ rcf_cli.egg-info/PKG-INFO
6
+ rcf_cli.egg-info/SOURCES.txt
7
+ rcf_cli.egg-info/dependency_links.txt
8
+ rcf_cli.egg-info/entry_points.txt
9
+ rcf_cli.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ rcf-cli = rcf_cli.cli:main
@@ -0,0 +1 @@
1
+ rcf_cli
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+