flyshell 1.5.0__tar.gz → 1.5.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.
Files changed (76) hide show
  1. {flyshell-1.5.0/src/flyshell.egg-info → flyshell-1.5.2}/PKG-INFO +3 -3
  2. {flyshell-1.5.0 → flyshell-1.5.2}/README.md +2 -2
  3. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/abstract/base_plugin.py +7 -1
  4. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/builtin/fs.py +9 -1
  5. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/constants.py +3 -2
  6. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/core/directory.py +2 -1
  7. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/startup/env.py +20 -6
  8. {flyshell-1.5.0 → flyshell-1.5.2/src/flyshell.egg-info}/PKG-INFO +3 -3
  9. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_env.py +70 -0
  10. {flyshell-1.5.0 → flyshell-1.5.2}/LICENSE +0 -0
  11. {flyshell-1.5.0 → flyshell-1.5.2}/MANIFEST.in +0 -0
  12. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/diskops.c +0 -0
  13. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/cat.c +0 -0
  14. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/cp.c +0 -0
  15. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/dir.c +0 -0
  16. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/mkdir.c +0 -0
  17. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/mv.c +0 -0
  18. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/rename.c +0 -0
  19. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/rm.c +0 -0
  20. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/rmdir.c +0 -0
  21. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/posix/touch.c +0 -0
  22. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/shared/dir_types.c +0 -0
  23. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/shared/dir_types.h +0 -0
  24. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/shared/native_errors.h +0 -0
  25. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/shared/win32_utf.h +0 -0
  26. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/cat.c +0 -0
  27. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/cp.c +0 -0
  28. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/dir.c +0 -0
  29. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/mkdir.c +0 -0
  30. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/mv.c +0 -0
  31. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/rename.c +0 -0
  32. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/rm.c +0 -0
  33. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/rmdir.c +0 -0
  34. {flyshell-1.5.0 → flyshell-1.5.2}/c_src/diskops/win32/touch.c +0 -0
  35. {flyshell-1.5.0 → flyshell-1.5.2}/pyproject.toml +0 -0
  36. {flyshell-1.5.0 → flyshell-1.5.2}/setup.cfg +0 -0
  37. {flyshell-1.5.0 → flyshell-1.5.2}/setup.py +0 -0
  38. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/__init__.py +0 -0
  39. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/abstract/__init__.py +0 -0
  40. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/abstract/base_cmd.py +0 -0
  41. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/abstract/parent_cmd.py +0 -0
  42. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/accounts/__init__.py +0 -0
  43. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/accounts/auth.py +0 -0
  44. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/bin/__init__.py +0 -0
  45. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/builtin/__init__.py +0 -0
  46. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/builtin/pkg.py +0 -0
  47. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/builtin/system.py +0 -0
  48. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/builtin/utils.py +0 -0
  49. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/core/__init__.py +0 -0
  50. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/core/console.py +0 -0
  51. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/core/data.py +0 -0
  52. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/main.py +0 -0
  53. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/native/__init__.py +0 -0
  54. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/native/diskops_bridge.py +0 -0
  55. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/native/diskops_handler.py +0 -0
  56. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/native/legacy/__init__.py +0 -0
  57. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/native/legacy/diskops.py +0 -0
  58. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/startup/__init__.py +0 -0
  59. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/startup/deps.py +0 -0
  60. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell/startup/loader.py +0 -0
  61. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell.egg-info/SOURCES.txt +0 -0
  62. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell.egg-info/dependency_links.txt +0 -0
  63. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell.egg-info/entry_points.txt +0 -0
  64. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell.egg-info/requires.txt +0 -0
  65. {flyshell-1.5.0 → flyshell-1.5.2}/src/flyshell.egg-info/top_level.txt +0 -0
  66. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_auth.py +0 -0
  67. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_data.py +0 -0
  68. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_deps.py +0 -0
  69. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_directory.py +0 -0
  70. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_diskops_ext.py +0 -0
  71. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_diskops_lgc.py +0 -0
  72. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_fs.py +0 -0
  73. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_loader.py +0 -0
  74. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_pkg.py +0 -0
  75. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_security.py +0 -0
  76. {flyshell-1.5.0 → flyshell-1.5.2}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -21,9 +21,9 @@ Dynamic: license-file
21
21
  ![Licence](https://img.shields.io/badge/license-MIT-green.svg)
22
22
  ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20(macOS%20source)-lightgrey.svg)
23
23
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
24
- ![Tests](https://github.com/kianodev/flyshell/actions/workflows/publish.yml/badge.svg)
24
+ ![Tests](https://github.com/kianodev/flyshell/actions/workflows/ci.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.5.0
26
+ > Documentation last updated: v1.5.1
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
29
29
 
@@ -4,9 +4,9 @@
4
4
  ![Licence](https://img.shields.io/badge/license-MIT-green.svg)
5
5
  ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20(macOS%20source)-lightgrey.svg)
6
6
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
7
- ![Tests](https://github.com/kianodev/flyshell/actions/workflows/publish.yml/badge.svg)
7
+ ![Tests](https://github.com/kianodev/flyshell/actions/workflows/ci.yml/badge.svg)
8
8
 
9
- > Documentation last updated: v1.5.0
9
+ > Documentation last updated: v1.5.1
10
10
 
11
11
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
12
12
 
@@ -25,7 +25,13 @@ class BasePlugin:
25
25
  self.on_load()
26
26
 
27
27
  def get_api_key(self, key_name: str, default=None):
28
- return self.api_keys_data.get(key_name, default)
28
+ if key_name in self.api_keys_data:
29
+ return self.api_keys_data[key_name]
30
+ target = key_name.lower()
31
+ for k, v in self.api_keys_data.items():
32
+ if k.lower() == target:
33
+ return v
34
+ return default
29
35
 
30
36
  def on_load(self):
31
37
  pass
@@ -190,7 +190,15 @@ class FsVersion(BaseCmd):
190
190
  aliases = []
191
191
 
192
192
  def execute(self, args):
193
- return (0, f"\nYou are on Flyshell Version {c.VERSION} (Build {c.BUILD})\n")
193
+ return (
194
+ 0,
195
+ (
196
+ f"\nYou are on Flyshell Version {c.VERSION}\n"
197
+ f"Increment Identifier: {c.VERFULL}\n"
198
+ f"Build: {c.BUILD}\n"
199
+ f"\nFull Version Name: {c.VERFULL}-b{c.BUILD}\n"
200
+ ),
201
+ )
194
202
 
195
203
 
196
204
  class Fs(ParentCmd):
@@ -5,8 +5,9 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 166
9
- VERSION = "1.5.0"
8
+ BUILD = 173
9
+ VERFULL = "1.5.2d"
10
+ VERSION = "1.5.2"
10
11
 
11
12
 
12
13
  def _resolve_app_dir() -> Path:
@@ -166,7 +166,8 @@ def _execute_single(raw_cmd: str) -> int:
166
166
  plugin = c.PLUGINS[cmd_name]
167
167
  required_keys = getattr(plugin, "api_keys", [])
168
168
  available_keys = getattr(plugin, "api_keys_data", {})
169
- missing = [k for k in required_keys if k not in available_keys]
169
+ available_lower = {k.lower() for k in available_keys}
170
+ missing = [k for k in required_keys if k.lower() not in available_lower]
170
171
  if missing:
171
172
  env_path = getattr(plugin, "env_file_path", "flyshell_keys.env")
172
173
  print(
@@ -31,8 +31,8 @@ def read_env_file() -> dict[str, str]:
31
31
  if not line or line.startswith("#") or "=" not in line:
32
32
  continue
33
33
  raw_k, raw_v = line.split("=", 1)
34
- clean_k = raw_k.strip().replace("[", "").replace("]", "")
35
- clean_v = raw_v.strip().strip("\"'").replace("[", "").replace("]", "")
34
+ clean_k = raw_k.strip()
35
+ clean_v = raw_v.strip().strip("\"'")
36
36
  if clean_k:
37
37
  entries[clean_k] = clean_v
38
38
  return entries
@@ -72,11 +72,23 @@ def get_plugin_api_keys(plugin_name_or_dir: str) -> dict[str, str]:
72
72
  f"{dir_name.lower()}_",
73
73
  f"{plugin_name_or_dir.strip().lower()}_",
74
74
  }
75
+ other_prefixes = set()
76
+ if hasattr(c, "PLUGINS"):
77
+ for cmd_name, plugin in c.PLUGINS.items():
78
+ other_dir = str(plugin.context.get("plugin_dir_name") or cmd_name).lower()
79
+ for candidate in (f"{other_dir}_", f"{cmd_name.lower()}_"):
80
+ if candidate not in prefixes:
81
+ other_prefixes.add(candidate)
75
82
  plugin_keys = {}
76
83
  for raw_k, val in all_env.items():
77
84
  k_lower = raw_k.lower()
78
85
  for prefix in prefixes:
79
86
  if k_lower.startswith(prefix):
87
+ if any(
88
+ len(other) > len(prefix) and k_lower.startswith(other)
89
+ for other in other_prefixes
90
+ ):
91
+ break
80
92
  key_name = raw_k[len(prefix) :]
81
93
  plugin_keys[key_name] = val
82
94
  break
@@ -130,7 +142,8 @@ def get_plugin_keys_formatted(target_name: str) -> tuple[int, str]:
130
142
  def set_plugin_api_key(plugin_name: str, key_name: str, value: str) -> tuple[int, str]:
131
143
  if not plugin_name or not key_name:
132
144
  return (1, "Command Error: Both plugin name and key name are required.")
133
- target_key = f"{plugin_name.strip().lower()}_{key_name.strip().upper()}"
145
+ dir_name, _ = _resolve_plugin_dir_name(plugin_name)
146
+ target_key = f"{dir_name.strip().lower()}_{key_name.strip().upper()}"
134
147
  clean_val = value.strip().strip("\"'")
135
148
  env_path = get_env_path()
136
149
  try:
@@ -163,7 +176,8 @@ def set_plugin_api_key(plugin_name: str, key_name: str, value: str) -> tuple[int
163
176
  def remove_plugin_api_key(plugin_name: str, key_name: str) -> tuple[int, str]:
164
177
  if not plugin_name or not key_name:
165
178
  return (1, "Command Error: Both plugin name and key name are required.")
166
- target_key = f"{plugin_name.strip().lower()}_{key_name.strip().lower()}"
179
+ dir_name, _ = _resolve_plugin_dir_name(plugin_name)
180
+ target_key = f"{dir_name.strip().lower()}_{key_name.strip().upper()}"
167
181
  env_path = get_env_path()
168
182
  if not env_path.exists():
169
183
  return (
@@ -178,8 +192,8 @@ def remove_plugin_api_key(plugin_name: str, key_name: str) -> tuple[int, str]:
178
192
  stripped = line.strip()
179
193
  if stripped and not stripped.startswith("#") and "=" in stripped:
180
194
  k, _ = stripped.split("=", 1)
181
- clean_k = k.strip().replace("[", "").replace("]", "").lower()
182
- if clean_k == target_key:
195
+ clean_k = k.strip().lower()
196
+ if clean_k == target_key.lower():
183
197
  found = True
184
198
  continue
185
199
  new_lines.append(line)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -21,9 +21,9 @@ Dynamic: license-file
21
21
  ![Licence](https://img.shields.io/badge/license-MIT-green.svg)
22
22
  ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20(macOS%20source)-lightgrey.svg)
23
23
  ![Dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg)
24
- ![Tests](https://github.com/kianodev/flyshell/actions/workflows/publish.yml/badge.svg)
24
+ ![Tests](https://github.com/kianodev/flyshell/actions/workflows/ci.yml/badge.svg)
25
25
 
26
- > Documentation last updated: v1.5.0
26
+ > Documentation last updated: v1.5.1
27
27
 
28
28
  A modular, zero-dependency command-line environment and extensible runtime interface built in Python with compiled C-extensions.
29
29
 
@@ -148,3 +148,73 @@ def test_get_plugin_keys_formatted_invalid_input():
148
148
  code, output = env.get_plugin_keys_formatted("")
149
149
  assert code == 1
150
150
  assert "valid plugin name" in output
151
+
152
+
153
+ def test_env_preserves_square_brackets_in_values(mock_env_file):
154
+ mock_env_file.write_text('sample_token="abc[123]xyz"\n')
155
+ keys = env.get_plugin_api_keys("sample")
156
+ assert keys == {"token": "abc[123]xyz"}
157
+
158
+
159
+ def test_set_and_remove_key_resolves_plugin_identifier(mock_env_file, monkeypatch):
160
+ class AliasedPlugin(BasePlugin):
161
+ name = "Weather Tool"
162
+ identifier = "weather"
163
+
164
+ def execute(self, args):
165
+ return 0
166
+
167
+ ctx = {
168
+ "plugin_name": "weather",
169
+ "plugin_dir_name": "weather_folder",
170
+ "file_path": None,
171
+ "env_path": str(mock_env_file),
172
+ "api_keys": {},
173
+ }
174
+ monkeypatch.setitem(c.PLUGINS, "weather", AliasedPlugin(ctx))
175
+ code, _ = env.set_plugin_api_key("weather", "api_key", "secret123")
176
+ assert code == 0
177
+ assert "weather_folder_API_KEY=secret123" in mock_env_file.read_text(
178
+ encoding="utf-8"
179
+ )
180
+ code, _ = env.remove_plugin_api_key("weather", "api_key")
181
+ assert code == 0
182
+ assert "weather_folder_API_KEY" not in mock_env_file.read_text(encoding="utf-8")
183
+
184
+
185
+ def test_case_insensitive_api_key_lookup_and_execution(mock_env_file, monkeypatch):
186
+ class CasePlugin(BasePlugin):
187
+ api_keys = ["API_TOKEN"]
188
+
189
+ def execute(self, args):
190
+ assert self.get_api_key("API_TOKEN") == "secret_123"
191
+ assert self.get_api_key("api_token") == "secret_123"
192
+ return 0
193
+
194
+ ctx = {
195
+ "plugin_name": "caseplug",
196
+ "plugin_dir_name": "caseplug",
197
+ "file_path": None,
198
+ "env_path": str(mock_env_file),
199
+ "api_keys": {"api_token": "secret_123"},
200
+ }
201
+ instance = CasePlugin(ctx)
202
+ monkeypatch.setitem(c.PLUGINS, "caseplug", instance)
203
+ assert directory._execute_single("caseplug") == 0
204
+
205
+
206
+ def test_get_plugin_api_keys_avoids_prefix_collision(mock_env_file, monkeypatch):
207
+ mock_env_file.write_text(
208
+ "weather_api_key=base_secret\n" "weather_pro_api_key=pro_secret\n"
209
+ )
210
+
211
+ class DummyPlugin(BasePlugin):
212
+ def execute(self, args):
213
+ return 0
214
+
215
+ p1 = DummyPlugin({"plugin_name": "weather", "plugin_dir_name": "weather"})
216
+ p2 = DummyPlugin({"plugin_name": "weather_pro", "plugin_dir_name": "weather_pro"})
217
+ monkeypatch.setitem(c.PLUGINS, "weather", p1)
218
+ monkeypatch.setitem(c.PLUGINS, "weather_pro", p2)
219
+ assert env.get_plugin_api_keys("weather") == {"api_key": "base_secret"}
220
+ assert env.get_plugin_api_keys("weather_pro") == {"api_key": "pro_secret"}
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