flyshell 1.6.2__tar.gz → 1.6.4__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 (96) hide show
  1. {flyshell-1.6.2/src/flyshell.egg-info → flyshell-1.6.4}/PKG-INFO +1 -1
  2. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/__init__.py +4 -2
  3. flyshell-1.6.4/src/flyshell/abstract/__init__.py +11 -0
  4. flyshell-1.6.4/src/flyshell/accounts/__init__.py +17 -0
  5. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/accounts/auth.py +1 -2
  6. flyshell-1.6.4/src/flyshell/builtin/__init__.py +21 -0
  7. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/builtin/fs.py +3 -6
  8. flyshell-1.6.4/src/flyshell/builtin/lifecycle.py +76 -0
  9. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/builtin/pkg.py +5 -7
  10. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/builtin/system.py +1 -1
  11. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/builtin/utils.py +1 -73
  12. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/constants.py +18 -7
  13. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/core/console.py +3 -4
  14. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/core/directory.py +24 -30
  15. flyshell-1.6.4/src/flyshell/main.py +47 -0
  16. flyshell-1.6.4/src/flyshell/misc/__init__.py +7 -0
  17. {flyshell-1.6.2/src/flyshell/startup → flyshell-1.6.4/src/flyshell/misc}/seasonal.py +1 -1
  18. flyshell-1.6.4/src/flyshell/native/__init__.py +19 -0
  19. flyshell-1.6.4/src/flyshell/native/diskops_guard.py +71 -0
  20. flyshell-1.6.4/src/flyshell/native/diskops_read.py +138 -0
  21. flyshell-1.6.2/src/flyshell/native/diskops_handler.py → flyshell-1.6.4/src/flyshell/native/diskops_write.py +11 -219
  22. flyshell-1.6.4/src/flyshell/pkgm/__init__.py +35 -0
  23. flyshell-1.6.4/src/flyshell/pkgm/inspection.py +51 -0
  24. flyshell-1.6.2/src/flyshell/startup/deps.py → flyshell-1.6.4/src/flyshell/pkgm/keys.py +33 -24
  25. {flyshell-1.6.2/src/flyshell/startup → flyshell-1.6.4/src/flyshell/pkgm}/loader.py +6 -65
  26. flyshell-1.6.4/src/flyshell/startup/__init__.py +18 -0
  27. flyshell-1.6.4/src/flyshell/startup/boot.py +21 -0
  28. flyshell-1.6.4/src/flyshell/startup/checks.py +90 -0
  29. {flyshell-1.6.2 → flyshell-1.6.4/src/flyshell.egg-info}/PKG-INFO +1 -1
  30. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell.egg-info/SOURCES.txt +12 -4
  31. flyshell-1.6.4/tests/test_auth.py +30 -0
  32. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_deps.py +12 -12
  33. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_diskops_ext.py +35 -37
  34. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_diskops_lgc.py +25 -25
  35. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_env.py +15 -17
  36. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_fs.py +7 -7
  37. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_loader.py +15 -16
  38. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_pkg.py +5 -5
  39. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_utils.py +9 -10
  40. flyshell-1.6.2/src/flyshell/builtin/__init__.py +0 -0
  41. flyshell-1.6.2/src/flyshell/core/__init__.py +0 -0
  42. flyshell-1.6.2/src/flyshell/main.py +0 -145
  43. flyshell-1.6.2/src/flyshell/native/__init__.py +0 -0
  44. flyshell-1.6.2/src/flyshell/native/legacy/__init__.py +0 -0
  45. flyshell-1.6.2/src/flyshell/startup/__init__.py +0 -0
  46. flyshell-1.6.2/tests/test_auth.py +0 -30
  47. {flyshell-1.6.2 → flyshell-1.6.4}/LICENSE +0 -0
  48. {flyshell-1.6.2 → flyshell-1.6.4}/MANIFEST.in +0 -0
  49. {flyshell-1.6.2 → flyshell-1.6.4}/README.md +0 -0
  50. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/diskops.c +0 -0
  51. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/cat.c +0 -0
  52. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/cp.c +0 -0
  53. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/dir.c +0 -0
  54. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/mkdir.c +0 -0
  55. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/mv.c +0 -0
  56. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/rename.c +0 -0
  57. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/rm.c +0 -0
  58. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/rmdir.c +0 -0
  59. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/posix/touch.c +0 -0
  60. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/shared/dir_types.c +0 -0
  61. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/shared/dir_types.h +0 -0
  62. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/shared/native_errors.h +0 -0
  63. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/shared/win32_utf.h +0 -0
  64. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/cat.c +0 -0
  65. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/cp.c +0 -0
  66. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/dir.c +0 -0
  67. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/mkdir.c +0 -0
  68. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/mv.c +0 -0
  69. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/rename.c +0 -0
  70. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/rm.c +0 -0
  71. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/rmdir.c +0 -0
  72. {flyshell-1.6.2 → flyshell-1.6.4}/c_src/diskops/win32/touch.c +0 -0
  73. {flyshell-1.6.2 → flyshell-1.6.4}/pyproject.toml +0 -0
  74. {flyshell-1.6.2 → flyshell-1.6.4}/setup.cfg +0 -0
  75. {flyshell-1.6.2 → flyshell-1.6.4}/setup.py +0 -0
  76. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/abstract/base_cmd.py +0 -0
  77. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/abstract/base_plugin.py +0 -0
  78. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/abstract/parent_cmd.py +0 -0
  79. {flyshell-1.6.2/src/flyshell/abstract → flyshell-1.6.4/src/flyshell/bin}/__init__.py +0 -0
  80. {flyshell-1.6.2/src/flyshell/accounts → flyshell-1.6.4/src/flyshell/core}/__init__.py +0 -0
  81. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/__init__.py +0 -0
  82. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/auth.py +0 -0
  83. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/config.py +0 -0
  84. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/db_manager.py +0 -0
  85. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/env.py +0 -0
  86. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/history.py +0 -0
  87. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/data/plugins.py +0 -0
  88. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/native/diskops_bridge.py +0 -0
  89. {flyshell-1.6.2/src/flyshell/bin → flyshell-1.6.4/src/flyshell/native/legacy}/__init__.py +0 -0
  90. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell/native/legacy/diskops.py +0 -0
  91. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell.egg-info/dependency_links.txt +0 -0
  92. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell.egg-info/entry_points.txt +0 -0
  93. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell.egg-info/requires.txt +0 -0
  94. {flyshell-1.6.2 → flyshell-1.6.4}/src/flyshell.egg-info/top_level.txt +0 -0
  95. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_data.py +0 -0
  96. {flyshell-1.6.2 → flyshell-1.6.4}/tests/test_directory.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.6.2
3
+ Version: 1.6.4
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -1,11 +1,13 @@
1
1
  # src/flyshell/__init__.py
2
2
 
3
3
  try:
4
- from flyshell.abstract.base_plugin import BasePlugin
4
+ from flyshell.abstract import BaseCmd, BasePlugin, ParentCmd
5
5
 
6
- __all__ = ["BasePlugin"]
6
+ __all__ = ["BaseCmd", "BasePlugin", "ParentCmd"]
7
7
  except ImportError:
8
+ BaseCmd = None
8
9
  BasePlugin = None
10
+ ParentCmd = None
9
11
  __all__ = []
10
12
 
11
13
 
@@ -0,0 +1,11 @@
1
+ # src/flyshell/abstract/__init__.py
2
+
3
+ from flyshell.abstract.base_cmd import BaseCmd
4
+ from flyshell.abstract.base_plugin import BasePlugin
5
+ from flyshell.abstract.parent_cmd import ParentCmd
6
+
7
+ __all__ = [
8
+ "BaseCmd",
9
+ "BasePlugin",
10
+ "ParentCmd",
11
+ ]
@@ -0,0 +1,17 @@
1
+ # src/flyshell/accounts/__init__.py
2
+
3
+ from flyshell.accounts.auth import (
4
+ Lock,
5
+ hash_password,
6
+ login_flow,
7
+ setup_acc,
8
+ verify_password,
9
+ )
10
+
11
+ __all__ = [
12
+ "Lock",
13
+ "hash_password",
14
+ "login_flow",
15
+ "setup_acc",
16
+ "verify_password",
17
+ ]
@@ -1,7 +1,6 @@
1
1
  # src/flyshell/accounts/auth.py
2
2
 
3
- from flyshell import data
4
- from flyshell.abstract.base_cmd import BaseCmd
3
+ from flyshell import BaseCmd, data
5
4
 
6
5
  import getpass
7
6
  import hashlib
@@ -0,0 +1,21 @@
1
+ # src/flyshell/builtin/__init__.py
2
+
3
+ from flyshell.builtin.fs import Fs
4
+ from flyshell.builtin.lifecycle import Kill, Reboot, Sleep
5
+ from flyshell.builtin.pkg import Pkg
6
+ from flyshell.builtin.system import Cd, OpenFile, SysExe
7
+ from flyshell.builtin.utils import Clear, Echo, History
8
+
9
+ __all__ = [
10
+ "Cd",
11
+ "Clear",
12
+ "Echo",
13
+ "Fs",
14
+ "History",
15
+ "Kill",
16
+ "OpenFile",
17
+ "Pkg",
18
+ "Reboot",
19
+ "Sleep",
20
+ "SysExe",
21
+ ]
@@ -1,10 +1,7 @@
1
1
  # src/flyshell/builtin/fs.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
5
- from flyshell.abstract.base_cmd import BaseCmd
6
- from flyshell.abstract.parent_cmd import ParentCmd
7
- from flyshell.startup import seasonal
4
+ from flyshell import BaseCmd, ParentCmd, data, misc
8
5
 
9
6
  import os
10
7
  import sys
@@ -148,10 +145,10 @@ class FsSeason(BaseCmd):
148
145
  aliases = []
149
146
 
150
147
  def execute(self, args: list[str]) -> tuple[int, str]:
151
- season = seasonal.get_season(return_icons=False)
148
+ season = misc.get_season(return_icons=False)
152
149
  if not season:
153
150
  return (0, "\nNo seasonal modes are active at present.\n")
154
- icon = seasonal.get_season(return_icons=True)
151
+ icon = misc.get_season(return_icons=True)
155
152
  return (0, f"\nCurrent seasonal mode: {season} {icon}\n")
156
153
 
157
154
 
@@ -0,0 +1,76 @@
1
+ # src/flyshell/builtin/lifecycle.py
2
+
3
+ from flyshell import constants as c
4
+ from flyshell import BaseCmd
5
+
6
+ import os
7
+ import signal
8
+ import subprocess
9
+ import sys
10
+ import time
11
+
12
+
13
+ class Kill(BaseCmd):
14
+ name = "kill"
15
+ description = "Shut down the Flyshell system"
16
+ min_args = 0
17
+ options = None
18
+ aliases = []
19
+
20
+ def execute(self, args: list[str]) -> tuple[int, str]:
21
+ choice = input("\nAre you sure [y/n]?: ").strip().lower()
22
+ if choice == "y":
23
+ return (-1, "\nShutting down...\n")
24
+ return (1, "\nAction cancelled.\n")
25
+
26
+
27
+ class Reboot(BaseCmd):
28
+ name = "reboot"
29
+ description = "Reboot the Flyshell system"
30
+ min_args = 0
31
+ options = None
32
+ aliases = ["restart"]
33
+
34
+ def execute(self, args: list[str]) -> tuple[int, str]:
35
+ print("\nRestarting Flyshell...\n")
36
+ is_direct_script = (
37
+ sys.argv[0].lower().endswith(".exe")
38
+ or os.path.basename(sys.argv[0]) == "flyshell"
39
+ )
40
+ if is_direct_script:
41
+ cmd = sys.argv
42
+ else:
43
+ cmd = [sys.executable] + sys.argv
44
+ if c.HOST_OS == "Windows":
45
+ old_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
46
+ try:
47
+ p = subprocess.run(cmd)
48
+ sys.exit(p.returncode)
49
+ finally:
50
+ signal.signal(signal.SIGINT, old_handler)
51
+ else:
52
+ os.execv(cmd[0], cmd)
53
+ return (0, "")
54
+
55
+
56
+ class Sleep(BaseCmd):
57
+ name = "sleep"
58
+ description = "Sleep the system for a specified time"
59
+ min_args = 1
60
+ options = "Duration (secs)"
61
+ aliases = []
62
+
63
+ def execute(self, args: list[str]) -> tuple[int, str]:
64
+ if not args or not args[0].replace(".", "", 1).isdigit():
65
+ return (
66
+ 1,
67
+ f"\nCommand Error: Invalid argument '{args[0] if args else ''}'\n",
68
+ )
69
+ secs = float(args[0])
70
+ try:
71
+ print(f"\nPausing Flyshell for {secs} second(s).")
72
+ print("Press Ctrl+C to cancel.\n")
73
+ time.sleep(secs)
74
+ return (0, "\nReturning...\n")
75
+ except KeyboardInterrupt:
76
+ return (1, "\nSleep cancelled.\n")
@@ -1,9 +1,7 @@
1
1
  # src/flyshell/builtin/pkg.py
2
2
 
3
3
  from typing import List, Tuple
4
- from flyshell.abstract.base_cmd import BaseCmd
5
- from flyshell.abstract.parent_cmd import ParentCmd
6
- from flyshell.startup import deps
4
+ from flyshell import BaseCmd, ParentCmd, pkgm
7
5
 
8
6
 
9
7
  class PkgApi(BaseCmd):
@@ -26,7 +24,7 @@ class PkgApi(BaseCmd):
26
24
  plugin_name = remaining_args[0]
27
25
  key_name = remaining_args[1]
28
26
  val = " ".join(remaining_args[2:])
29
- code, output = deps.set_plugin_api_key(plugin_name, key_name, val)
27
+ code, output = pkgm.set_plugin_api_key(plugin_name, key_name, val)
30
28
  return (code, f"\n{output}\n")
31
29
  case "del" | "rm":
32
30
  if len(remaining_args) < 2:
@@ -36,14 +34,14 @@ class PkgApi(BaseCmd):
36
34
  )
37
35
  plugin_name = remaining_args[0]
38
36
  key_name = remaining_args[1]
39
- code, output = deps.remove_plugin_api_key(plugin_name, key_name)
37
+ code, output = pkgm.remove_plugin_api_key(plugin_name, key_name)
40
38
  return (code, f"\n{output}\n")
41
39
  case "view":
42
40
  if not remaining_args:
43
- code, output = deps.get_all_keys()
41
+ code, output = pkgm.get_all_keys()
44
42
  else:
45
43
  package_name = remaining_args[0]
46
- code, output = deps.get_plugin_keys_formatted(package_name)
44
+ code, output = pkgm.get_plugin_keys_formatted(package_name)
47
45
  return (code, f"\n{output}\n")
48
46
  case _:
49
47
  return (1, f"\nCommand Error: Unknown target '{arg}'\n")
@@ -1,7 +1,7 @@
1
1
  # src/flyshell/builtin/system.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell.abstract.base_cmd import BaseCmd
4
+ from flyshell import BaseCmd
5
5
 
6
6
  import os
7
7
  import shutil
@@ -1,16 +1,10 @@
1
1
  # src/flyshell/builtin/utils.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
5
- from flyshell.abstract.base_cmd import BaseCmd
4
+ from flyshell import BaseCmd, data
6
5
 
7
6
  import codecs
8
- import os
9
7
  import re
10
- import signal
11
- import subprocess
12
- import sys
13
- import time
14
8
 
15
9
 
16
10
  class Clear(BaseCmd):
@@ -81,69 +75,3 @@ class History(BaseCmd):
81
75
  lines.append(f"#{i}: {cmd} [at {date_part} @ {time_part} UTC]")
82
76
  lines.append("")
83
77
  return (0, "\n".join(lines))
84
-
85
-
86
- class Kill(BaseCmd):
87
- name = "kill"
88
- description = "Shut down the Flyshell system"
89
- min_args = 0
90
- options = None
91
- aliases = []
92
-
93
- def execute(self, args: list[str]) -> tuple[int, str]:
94
- choice = input("\nAre you sure [y/n]?: ").strip().lower()
95
- if choice == "y":
96
- return (-1, "\nShutting down...\n")
97
- return (1, "\nAction cancelled.\n")
98
-
99
-
100
- class Reboot(BaseCmd):
101
- name = "reboot"
102
- description = "Reboot the Flyshell system"
103
- min_args = 0
104
- options = None
105
- aliases = ["restart"]
106
-
107
- def execute(self, args: list[str]) -> tuple[int, str]:
108
- print("\nRestarting Flyshell...\n")
109
- is_direct_script = (
110
- sys.argv[0].lower().endswith(".exe")
111
- or os.path.basename(sys.argv[0]) == "flyshell"
112
- )
113
- if is_direct_script:
114
- cmd = sys.argv
115
- else:
116
- cmd = [sys.executable] + sys.argv
117
- if c.HOST_OS == "Windows":
118
- old_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
119
- try:
120
- p = subprocess.run(cmd)
121
- sys.exit(p.returncode)
122
- finally:
123
- signal.signal(signal.SIGINT, old_handler)
124
- else:
125
- os.execv(cmd[0], cmd)
126
- return (0, "")
127
-
128
-
129
- class Sleep(BaseCmd):
130
- name = "sleep"
131
- description = "Sleep the system for a specified time"
132
- min_args = 1
133
- options = "Duration (secs)"
134
- aliases = []
135
-
136
- def execute(self, args: list[str]) -> tuple[int, str]:
137
- if not args or not args[0].replace(".", "", 1).isdigit():
138
- return (
139
- 1,
140
- f"\nCommand Error: Invalid argument '{args[0] if args else ''}'\n",
141
- )
142
- secs = float(args[0])
143
- try:
144
- print(f"\nPausing Flyshell for {secs} second(s).")
145
- print("Press Ctrl+C to cancel.\n")
146
- time.sleep(secs)
147
- return (0, "\nReturning...\n")
148
- except KeyboardInterrupt:
149
- return (1, "\nSleep cancelled.\n")
@@ -5,9 +5,9 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 215
9
- VERFULL = "1.6.2d"
10
- VERSION = "1.6.2"
8
+ BUILD = 224
9
+ VERFULL = "1.6.4e"
10
+ VERSION = "1.6.4"
11
11
 
12
12
 
13
13
  def _resolve_app_dir() -> Path:
@@ -35,6 +35,7 @@ SESSION_START_TIME = time.time()
35
35
  SESSION_CMD_COUNT = 0
36
36
 
37
37
  PLUGINS = {}
38
+ RESERVED_NAMES: set[str] = set()
38
39
 
39
40
  SUPPORTED_OS = frozenset({"Windows", "Darwin", "Linux"})
40
41
  SUPPORTED_PYTHON = (3, 10)
@@ -57,6 +58,7 @@ REQUIRED_COMPONENTS = [
57
58
  "builtin",
58
59
  "builtin/__init__.py",
59
60
  "builtin/fs.py",
61
+ "builtin/lifecycle.py",
60
62
  "builtin/pkg.py",
61
63
  "builtin/system.py",
62
64
  "builtin/utils.py",
@@ -75,17 +77,26 @@ REQUIRED_COMPONENTS = [
75
77
  "data/plugins.py",
76
78
  "__init__.py",
77
79
  "main.py",
80
+ "misc",
81
+ "misc/__init__.py",
82
+ "misc/seasonal.py",
78
83
  "native",
79
84
  "native/__init__.py",
80
85
  "native/legacy/__init__.py",
81
86
  "native/legacy/diskops.py",
82
87
  "native/diskops_bridge.py",
83
- "native/diskops_handler.py",
88
+ "native/diskops_guard.py",
89
+ "native/diskops_read.py",
90
+ "native/diskops_write.py",
91
+ "pkgm",
92
+ "pkgm/__init__.py",
93
+ "pkgm/inspection.py",
94
+ "pkgm/keys.py",
95
+ "pkgm/loader.py",
84
96
  "startup",
85
97
  "startup/__init__.py",
86
- "startup/deps.py",
87
- "startup/loader.py",
88
- "startup/seasonal.py",
98
+ "startup/boot.py",
99
+ "startup/checks.py",
89
100
  ]
90
101
 
91
102
  GREETINGS = [
@@ -1,9 +1,8 @@
1
1
  # src/flyshell/core/console.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
4
+ from flyshell import data, misc
5
5
  from flyshell.core.directory import execute_line
6
- from flyshell.startup import seasonal
7
6
 
8
7
  import os
9
8
  import random
@@ -41,7 +40,7 @@ def boot() -> None:
41
40
  load_history()
42
41
  data.create_env()
43
42
  print(c.CLEAR_SCREEN, end="")
44
- icon = seasonal.get_season(return_icons=True)
43
+ icon = misc.get_season(return_icons=True)
45
44
  badge = f" {icon}" if icon else ""
46
45
  print(f"\nBoot successful, welcome to Flyshell! (Version {c.VERSION}){badge}")
47
46
  user_info = data.get_auth() or {}
@@ -51,7 +50,7 @@ def boot() -> None:
51
50
  while True:
52
51
  try:
53
52
  folder = os.path.basename(os.getcwd())
54
- icon = seasonal.get_season(return_icons=True)
53
+ icon = misc.get_season(return_icons=True)
55
54
  badge = f" {icon}" if icon else ""
56
55
  print(f"Flyshell [v{c.VERSION}]{badge} ({folder})>>", end="", flush=True)
57
56
  raw_cmd = input()
@@ -1,13 +1,7 @@
1
1
  # src/flyshell/core/directory.py
2
2
 
3
3
  from flyshell import constants as c
4
- from flyshell import data
5
- from flyshell.abstract.base_cmd import BaseCmd
6
- from flyshell.abstract.parent_cmd import ParentCmd
7
- from flyshell.accounts import auth
8
- from flyshell.builtin import fs, pkg, system, utils
9
- from flyshell.native import diskops_handler as diskops
10
- from flyshell.startup import deps
4
+ from flyshell import BaseCmd, ParentCmd, accounts, builtin, data, native, pkgm
11
5
 
12
6
  from datetime import datetime, timezone
13
7
  import copy
@@ -54,28 +48,28 @@ class Cmds(BaseCmd):
54
48
 
55
49
 
56
50
  INSTALLED_COMMANDS: list[BaseCmd] = [
57
- diskops.Cat(),
58
- system.Cd(),
51
+ native.Cat(),
52
+ builtin.Cd(),
59
53
  Cmds(),
60
- utils.Clear(),
61
- diskops.Copy(),
62
- diskops.Dir(),
63
- utils.Echo(),
64
- fs.Fs(),
65
- utils.History(),
66
- utils.Kill(),
67
- auth.Lock(),
68
- diskops.MkDir(),
69
- diskops.Move(),
70
- system.OpenFile(),
71
- pkg.Pkg(),
72
- utils.Reboot(),
73
- diskops.Rename(),
74
- diskops.Rm(),
75
- diskops.RmDir(),
76
- utils.Sleep(),
77
- system.SysExe(),
78
- diskops.Touch(),
54
+ builtin.Clear(),
55
+ native.Copy(),
56
+ native.Dir(),
57
+ builtin.Echo(),
58
+ builtin.Fs(),
59
+ builtin.History(),
60
+ builtin.Kill(),
61
+ accounts.Lock(),
62
+ native.MkDir(),
63
+ native.Move(),
64
+ builtin.OpenFile(),
65
+ builtin.Pkg(),
66
+ builtin.Reboot(),
67
+ native.Rename(),
68
+ native.Rm(),
69
+ native.RmDir(),
70
+ builtin.Sleep(),
71
+ builtin.SysExe(),
72
+ native.Touch(),
79
73
  ]
80
74
 
81
75
  COMMAND_REGISTRY: dict[str, BaseCmd] = {}
@@ -84,7 +78,7 @@ for cmd_obj in INSTALLED_COMMANDS:
84
78
  for alias_name in cmd_obj.aliases:
85
79
  COMMAND_REGISTRY[alias_name] = cmd_obj
86
80
 
87
- RESERVED_NAMES = set(COMMAND_REGISTRY.keys())
81
+ c.RESERVED_NAMES = set(COMMAND_REGISTRY.keys())
88
82
 
89
83
 
90
84
  def log(cmd: str) -> None:
@@ -176,7 +170,7 @@ def _execute_single(raw_cmd: str) -> int:
176
170
  )
177
171
  print(f"Define them in {env_path} and retry.\n")
178
172
  return 1
179
- _, missing_deps = deps.verify_plugin_dependencies(plugin)
173
+ _, missing_deps = pkgm.verify_plugin_dependencies(plugin)
180
174
  if missing_deps:
181
175
  print(
182
176
  f"\nPlugin Error: Cannot execute '{cmd_name}'. Missing dependency/dependencies: {', '.join(missing_deps)}"
@@ -0,0 +1,47 @@
1
+ # src/flyshell/main.py
2
+
3
+ import os
4
+ import sys
5
+
6
+
7
+ def main() -> None:
8
+ os.system("")
9
+ print("\033[H\033[2J", end="")
10
+ print("\nLaunch process initiated. Flyshell is checking it is able to launch...")
11
+ try:
12
+ from flyshell import startup
13
+
14
+ if startup.run_preflight():
15
+ startup.launch()
16
+ else:
17
+ sys.exit(1)
18
+ except KeyboardInterrupt:
19
+ print("\n\nFlyshell session terminated, shutting down...\n")
20
+ sys.exit(0)
21
+ except Exception as e:
22
+ print("\n❌❌❌ Oops! An unexpected error occurred.")
23
+ print(f"Error details: {e}")
24
+ print("We don't really know what happened there. Sorry about that.\n")
25
+ print("Print traceback message? Default is N.")
26
+ choice = input("[y/n]?: ")
27
+ if choice.lower() == "y":
28
+ import traceback
29
+
30
+ raw = traceback.extract_tb(e.__traceback__)
31
+ last_frame = raw[-1]
32
+ print("\nTraceback details:")
33
+ print(f"File: '{last_frame[0]}'")
34
+ print(f"Line: {last_frame[1]}")
35
+ print(f"Exception message: '{e}'")
36
+ sys.exit(1)
37
+ finally:
38
+ try:
39
+ from flyshell import startup
40
+
41
+ startup.shutdown()
42
+ except ImportError:
43
+ pass
44
+
45
+
46
+ if __name__ == "__main__":
47
+ main()
@@ -0,0 +1,7 @@
1
+ # src/flyshell/misc/__init__.py
2
+
3
+ from flyshell.misc.seasonal import get_season
4
+
5
+ __all__ = [
6
+ "get_season",
7
+ ]
@@ -1,4 +1,4 @@
1
- # src/flyshell/startup/seasonal.py
1
+ # src/flyshell/misc/seasonal.py
2
2
 
3
3
  from datetime import date, timedelta
4
4
  import random
@@ -0,0 +1,19 @@
1
+ # src/flyshell/native/__init__.py
2
+
3
+ from flyshell.native.diskops_bridge import has_native_support, translate_error
4
+ from flyshell.native.diskops_read import Cat, Dir, MkDir, Touch
5
+ from flyshell.native.diskops_write import Copy, Move, Rename, Rm, RmDir
6
+
7
+ __all__ = [
8
+ "Cat",
9
+ "Copy",
10
+ "Dir",
11
+ "MkDir",
12
+ "Move",
13
+ "Rename",
14
+ "Rm",
15
+ "RmDir",
16
+ "Touch",
17
+ "has_native_support",
18
+ "translate_error",
19
+ ]
@@ -0,0 +1,71 @@
1
+ # src/flyshell/native/diskops_guard.py
2
+
3
+ from flyshell import constants as c
4
+
5
+ from pathlib import Path
6
+ import os
7
+
8
+
9
+ def validate_flyshell_target(
10
+ target_path: Path, raw_target: str, label: str = "Target"
11
+ ) -> tuple[int, str] | None:
12
+ flyshell_dirs = [
13
+ c.APP_DIR.resolve(),
14
+ c.PACKAGE_ROOT.resolve(),
15
+ c.PROJECT_ROOT.resolve(),
16
+ ]
17
+ for protected in flyshell_dirs:
18
+ if target_path == protected or target_path.is_relative_to(protected):
19
+ return (
20
+ 1,
21
+ "\nSecurity Error: Flyshell has blocked this action.\n"
22
+ f"{label} '{raw_target}' contains or belongs to Flyshell system files.\n"
23
+ "If you wish to delete Flyshell, use the host.\n",
24
+ )
25
+ return None
26
+
27
+
28
+ def validate_delete_target(
29
+ target_path: Path, raw_target: str
30
+ ) -> tuple[int, str] | None:
31
+ if target_path == target_path.parent or str(target_path) == target_path.anchor:
32
+ return (
33
+ 1,
34
+ "\nSecurity Error: Flyshell has blocked this action.\n"
35
+ "You cannot delete the root filesystem directory.\n",
36
+ )
37
+ critical_system_dirs = [
38
+ Path.home().parent.resolve(),
39
+ Path.home().resolve(),
40
+ ]
41
+ if c.HOST_OS == "Windows":
42
+ system_drive = os.environ.get("SystemDrive", "C:")
43
+ critical_system_dirs.extend(
44
+ [
45
+ Path(f"{system_drive}\\Windows").resolve(),
46
+ Path(f"{system_drive}\\Program Files").resolve(),
47
+ Path(f"{system_drive}\\Program Files (x86)").resolve(),
48
+ ]
49
+ )
50
+ else:
51
+ critical_system_dirs.extend(
52
+ [
53
+ Path("/bin").resolve(),
54
+ Path("/etc").resolve(),
55
+ Path("/usr").resolve(),
56
+ Path("/var").resolve(),
57
+ ]
58
+ )
59
+ if target_path in critical_system_dirs:
60
+ return (
61
+ 1,
62
+ "\nSecurity Error: Flyshell has blocked this action.\n"
63
+ f"Target '{raw_target}' is a protected operating system directory.\n",
64
+ )
65
+ if target_path == Path(os.getcwd()).resolve():
66
+ return (
67
+ 1,
68
+ "\nSystem Error: Cannot remove current working directory.\n"
69
+ "Switch to a different directory using 'cd' first.\n",
70
+ )
71
+ return validate_flyshell_target(target_path, raw_target)