flyshell 1.2.0__tar.gz → 1.2.2__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.
- {flyshell-1.2.0/src/flyshell.egg-info → flyshell-1.2.2}/PKG-INFO +1 -1
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/abstract/base_plugin.py +4 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/constants.py +2 -2
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/core/loader.py +23 -11
- {flyshell-1.2.0 → flyshell-1.2.2/src/flyshell.egg-info}/PKG-INFO +1 -1
- {flyshell-1.2.0 → flyshell-1.2.2}/LICENSE +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/README.md +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/pyproject.toml +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/setup.cfg +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/__init__.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/abstract/__init__.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/abstract/base_cmd.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/abstract/parent_cmd.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/builtin/__init__.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/builtin/diskops.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/builtin/fs.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/builtin/system.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/builtin/utils.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/core/__init__.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/core/auth.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/core/console.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/core/data.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/core/directory.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell/main.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell.egg-info/SOURCES.txt +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell.egg-info/dependency_links.txt +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell.egg-info/entry_points.txt +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell.egg-info/requires.txt +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/src/flyshell.egg-info/top_level.txt +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_auth.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_data.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_directory.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_diskops.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_fs.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_loader.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_security.py +0 -0
- {flyshell-1.2.0 → flyshell-1.2.2}/tests/test_utils.py +0 -0
|
@@ -9,8 +9,10 @@ class BasePlugin:
|
|
|
9
9
|
description: str = "No description provided."
|
|
10
10
|
version: str = "1.0.0"
|
|
11
11
|
author: str = "Unknown"
|
|
12
|
+
identifier: str = ""
|
|
12
13
|
usage: str = ""
|
|
13
14
|
extended_help: str = ""
|
|
15
|
+
requires_api = False
|
|
14
16
|
|
|
15
17
|
def __init__(self, context: dict):
|
|
16
18
|
self.context = context
|
|
@@ -38,6 +40,8 @@ class BasePlugin:
|
|
|
38
40
|
if self.extended_help:
|
|
39
41
|
lines.append("\nDetails:")
|
|
40
42
|
lines.append(self.extended_help)
|
|
43
|
+
if self.requires_api:
|
|
44
|
+
lines.append("\nThis plugin requires an API key.")
|
|
41
45
|
print("\n".join(lines))
|
|
42
46
|
|
|
43
47
|
def show_docs(self) -> bool:
|
|
@@ -24,36 +24,48 @@ def scan_plugins(plugin_folder=None):
|
|
|
24
24
|
candidates = {}
|
|
25
25
|
for item in folder.iterdir():
|
|
26
26
|
file_path = None
|
|
27
|
-
|
|
27
|
+
default_name = None
|
|
28
28
|
if item.is_file() and item.suffix == ".py" and not item.name.startswith("_"):
|
|
29
29
|
file_path = item
|
|
30
|
-
|
|
30
|
+
default_name = item.stem
|
|
31
31
|
elif item.is_dir() and not item.name.startswith((".", "_")):
|
|
32
32
|
entry = item / "plugin.py"
|
|
33
33
|
if entry.exists():
|
|
34
34
|
file_path = entry
|
|
35
|
-
|
|
36
|
-
if not file_path or not
|
|
35
|
+
default_name = item.name
|
|
36
|
+
if not file_path or not default_name:
|
|
37
37
|
continue
|
|
38
|
-
if
|
|
38
|
+
if default_name in RESERVED_NAMES:
|
|
39
39
|
print(
|
|
40
|
-
f"\n⚠️ Collision Error - Plugin '{
|
|
40
|
+
f"\n⚠️ Collision Error - Plugin '{default_name}' conflicts with a built-in Flyshell command and will not be loaded."
|
|
41
41
|
)
|
|
42
42
|
continue
|
|
43
43
|
try:
|
|
44
|
-
|
|
44
|
+
module_name = f"plugin_{default_name}"
|
|
45
|
+
spec = importlib.util.spec_from_file_location(module_name, file_path)
|
|
45
46
|
if spec is None or spec.loader is None:
|
|
46
47
|
continue
|
|
47
48
|
module = importlib.util.module_from_spec(spec)
|
|
48
49
|
spec.loader.exec_module(module)
|
|
49
50
|
for _, obj in inspect.getmembers(module, inspect.isclass):
|
|
50
51
|
if issubclass(obj, BasePlugin) and obj is not BasePlugin:
|
|
51
|
-
|
|
52
|
+
resolved_name = getattr(obj, "identifier", None) or default_name
|
|
53
|
+
|
|
54
|
+
# Also verify the resolved identifier doesn't conflict with a reserved name
|
|
55
|
+
if resolved_name in RESERVED_NAMES:
|
|
56
|
+
print(
|
|
57
|
+
f"\n⚠️ Collision Error - Plugin '{resolved_name}' conflicts with a built-in Flyshell command and will not be loaded."
|
|
58
|
+
)
|
|
59
|
+
break
|
|
60
|
+
|
|
61
|
+
ctx = build_context(resolved_name, file_path)
|
|
52
62
|
instance = obj(ctx)
|
|
53
|
-
candidates.setdefault(
|
|
63
|
+
candidates.setdefault(resolved_name, []).append(
|
|
64
|
+
(instance, file_path)
|
|
65
|
+
)
|
|
54
66
|
break
|
|
55
67
|
except Exception as e:
|
|
56
|
-
print(f"\n⚠️ Plugin Failure - Failed to inspect '{
|
|
68
|
+
print(f"\n⚠️ Plugin Failure - Failed to inspect '{default_name}'")
|
|
57
69
|
print(f"Exception code: {e}, Flyshell will still launch.")
|
|
58
70
|
loaded_count = 0
|
|
59
71
|
first_print = True
|
|
@@ -72,7 +84,7 @@ def scan_plugins(plugin_folder=None):
|
|
|
72
84
|
if first_print:
|
|
73
85
|
print("\nInstalled Plugins:")
|
|
74
86
|
first_print = False
|
|
75
|
-
print(f"✅ - {name}")
|
|
87
|
+
print(f"✅ - {instance.name} ({name})")
|
|
76
88
|
loaded_count += 1
|
|
77
89
|
if loaded_count > 0:
|
|
78
90
|
print(f"\nTotal of {loaded_count} plugin(s) found.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|