flyshell 1.6.0__tar.gz → 1.6.1__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 (81) hide show
  1. {flyshell-1.6.0/src/flyshell.egg-info → flyshell-1.6.1}/PKG-INFO +1 -1
  2. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/constants.py +3 -5
  3. {flyshell-1.6.0 → flyshell-1.6.1/src/flyshell.egg-info}/PKG-INFO +1 -1
  4. flyshell-1.6.1/tests/test_data.py +95 -0
  5. {flyshell-1.6.0 → flyshell-1.6.1}/tests/test_deps.py +22 -22
  6. flyshell-1.6.1/tests/test_directory.py +106 -0
  7. {flyshell-1.6.0 → flyshell-1.6.1}/tests/test_diskops_ext.py +219 -85
  8. {flyshell-1.6.0 → flyshell-1.6.1}/tests/test_diskops_lgc.py +135 -51
  9. flyshell-1.6.1/tests/test_env.py +255 -0
  10. {flyshell-1.6.0 → flyshell-1.6.1}/tests/test_fs.py +12 -9
  11. {flyshell-1.6.0 → flyshell-1.6.1}/tests/test_loader.py +41 -11
  12. flyshell-1.6.1/tests/test_pkg.py +33 -0
  13. flyshell-1.6.1/tests/test_utils.py +57 -0
  14. flyshell-1.6.0/tests/test_data.py +0 -76
  15. flyshell-1.6.0/tests/test_directory.py +0 -75
  16. flyshell-1.6.0/tests/test_env.py +0 -202
  17. flyshell-1.6.0/tests/test_pkg.py +0 -50
  18. flyshell-1.6.0/tests/test_utils.py +0 -87
  19. {flyshell-1.6.0 → flyshell-1.6.1}/LICENSE +0 -0
  20. {flyshell-1.6.0 → flyshell-1.6.1}/MANIFEST.in +0 -0
  21. {flyshell-1.6.0 → flyshell-1.6.1}/README.md +0 -0
  22. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/diskops.c +0 -0
  23. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/cat.c +0 -0
  24. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/cp.c +0 -0
  25. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/dir.c +0 -0
  26. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/mkdir.c +0 -0
  27. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/mv.c +0 -0
  28. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/rename.c +0 -0
  29. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/rm.c +0 -0
  30. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/rmdir.c +0 -0
  31. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/posix/touch.c +0 -0
  32. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/shared/dir_types.c +0 -0
  33. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/shared/dir_types.h +0 -0
  34. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/shared/native_errors.h +0 -0
  35. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/shared/win32_utf.h +0 -0
  36. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/cat.c +0 -0
  37. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/cp.c +0 -0
  38. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/dir.c +0 -0
  39. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/mkdir.c +0 -0
  40. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/mv.c +0 -0
  41. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/rename.c +0 -0
  42. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/rm.c +0 -0
  43. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/rmdir.c +0 -0
  44. {flyshell-1.6.0 → flyshell-1.6.1}/c_src/diskops/win32/touch.c +0 -0
  45. {flyshell-1.6.0 → flyshell-1.6.1}/pyproject.toml +0 -0
  46. {flyshell-1.6.0 → flyshell-1.6.1}/setup.cfg +0 -0
  47. {flyshell-1.6.0 → flyshell-1.6.1}/setup.py +0 -0
  48. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/__init__.py +0 -0
  49. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/abstract/__init__.py +0 -0
  50. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/abstract/base_cmd.py +0 -0
  51. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/abstract/base_plugin.py +0 -0
  52. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/abstract/parent_cmd.py +0 -0
  53. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/accounts/__init__.py +0 -0
  54. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/accounts/auth.py +0 -0
  55. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/bin/__init__.py +0 -0
  56. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/builtin/__init__.py +0 -0
  57. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/builtin/fs.py +0 -0
  58. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/builtin/pkg.py +0 -0
  59. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/builtin/system.py +0 -0
  60. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/builtin/utils.py +0 -0
  61. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/core/__init__.py +0 -0
  62. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/core/console.py +0 -0
  63. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/core/data.py +0 -0
  64. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/core/directory.py +0 -0
  65. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/main.py +0 -0
  66. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/native/__init__.py +0 -0
  67. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/native/diskops_bridge.py +0 -0
  68. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/native/diskops_handler.py +0 -0
  69. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/native/legacy/__init__.py +0 -0
  70. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/native/legacy/diskops.py +0 -0
  71. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/startup/__init__.py +0 -0
  72. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/startup/deps.py +0 -0
  73. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/startup/env.py +0 -0
  74. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/startup/loader.py +0 -0
  75. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell/startup/seasonal.py +0 -0
  76. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell.egg-info/SOURCES.txt +0 -0
  77. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell.egg-info/dependency_links.txt +0 -0
  78. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell.egg-info/entry_points.txt +0 -0
  79. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell.egg-info/requires.txt +0 -0
  80. {flyshell-1.6.0 → flyshell-1.6.1}/src/flyshell.egg-info/top_level.txt +0 -0
  81. {flyshell-1.6.0 → flyshell-1.6.1}/tests/test_auth.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.6.0
3
+ Version: 1.6.1
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -5,9 +5,9 @@ import os
5
5
  import platform
6
6
  import time
7
7
 
8
- BUILD = 206
9
- VERFULL = "1.6.0c"
10
- VERSION = "1.6.0"
8
+ BUILD = 211
9
+ VERFULL = "1.6.1e"
10
+ VERSION = "1.6.1"
11
11
 
12
12
 
13
13
  def _resolve_app_dir() -> Path:
@@ -36,8 +36,6 @@ SESSION_CMD_COUNT = 0
36
36
 
37
37
  PLUGINS = {}
38
38
 
39
- BLOCKED_COMMANDS = frozenset({"format", "diskpart", "dd"})
40
- DANGER_COMMANDS = frozenset({"del", "rmdir", "rd", "rm", "taskkill", "killall"})
41
39
  SUPPORTED_OS = frozenset({"Windows", "Darwin", "Linux"})
42
40
  SUPPORTED_PYTHON = (3, 10)
43
41
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyshell
3
- Version: 1.6.0
3
+ Version: 1.6.1
4
4
  Summary: A modular, zero-dependency command-line environment in Python.
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -0,0 +1,95 @@
1
+ # tests/test_data.py
2
+
3
+ from flyshell import constants as c
4
+ from flyshell.core import data
5
+ import sqlite3
6
+
7
+
8
+ def test_database_initialises_with_user_version():
9
+ data.initialise()
10
+ with sqlite3.connect(c.FILE_PATH) as conn:
11
+ version = conn.execute("PRAGMA user_version;").fetchone()[0]
12
+ assert version == 1
13
+
14
+
15
+ def test_get_auth_returns_none_when_unset():
16
+ assert data.get_auth() is None
17
+
18
+
19
+ def test_set_and_get_auth():
20
+ data.set_auth("alice", "hashed_secret", "random_salt")
21
+ record = data.get_auth()
22
+ assert record is not None
23
+ assert record["username"] == "alice"
24
+ assert record["hash"] == "hashed_secret"
25
+ assert record["salt"] == "random_salt"
26
+ assert "created_at" in record
27
+
28
+
29
+ def test_clear_auth_removes_record():
30
+ data.set_auth("alice", "hashed_secret", "random_salt")
31
+ assert data.clear_auth() is True
32
+ assert data.get_auth() is None
33
+
34
+
35
+ def test_get_history_returns_all_in_chronological_order():
36
+ data.append_history("cd /", "2026-10-10T10:00:00Z")
37
+ data.append_history("dir", "2026-10-10T10:01:00Z")
38
+ data.append_history("clear", "2026-10-10T10:02:00Z")
39
+ all_history = data.get_history()
40
+ assert [entry["command"] for entry in all_history] == ["cd /", "dir", "clear"]
41
+
42
+
43
+ def test_get_history_with_limit():
44
+ data.append_history("cd /", "2026-10-10T10:00:00Z")
45
+ data.append_history("dir", "2026-10-10T10:01:00Z")
46
+ data.append_history("clear", "2026-10-10T10:02:00Z")
47
+ limited = data.get_history(limit=2)
48
+ assert [entry["command"] for entry in limited] == ["dir", "clear"]
49
+
50
+
51
+ def test_clear_history_empties_table():
52
+ data.append_history("cd /", "2026-10-10T10:00:00Z")
53
+ assert data.clear_history() is True
54
+ assert data.get_history() == []
55
+
56
+
57
+ def test_get_config_returns_default_when_missing():
58
+ assert data.get_config("theme", default="light") == "light"
59
+
60
+
61
+ def test_set_and_get_config_string():
62
+ data.set_config("theme", "dark")
63
+ assert data.get_config("theme") == "dark"
64
+
65
+
66
+ def test_set_and_get_config_json_object():
67
+ data.set_config("settings", {"bell": False, "font_size": 12})
68
+ assert data.get_config("settings") == {"bell": False, "font_size": 12}
69
+
70
+
71
+ def test_delete_config_removes_key():
72
+ data.set_config("theme", "dark")
73
+ assert data.delete_config("theme") is True
74
+ assert data.get_config("theme") is None
75
+
76
+
77
+ def test_set_and_get_plugin_data():
78
+ data.set_plugin_data("notes", "font", "monospace")
79
+ data.set_plugin_data("notes", "count", 42)
80
+ assert data.get_plugin_data("notes", "font") == "monospace"
81
+ assert data.get_plugin_data("notes", "count") == 42
82
+
83
+
84
+ def test_get_all_plugin_data():
85
+ data.set_plugin_data("notes", "font", "monospace")
86
+ data.set_plugin_data("notes", "count", 42)
87
+ assert data.get_all_plugin_data("notes") == {"font": "monospace", "count": 42}
88
+
89
+
90
+ def test_purge_plugin_cascades_and_isolates_other_plugins():
91
+ data.set_plugin_data("notes", "font", "monospace")
92
+ data.set_plugin_data("scratchpad", "draft", "hello world")
93
+ assert data.purge_plugin("notes") is True
94
+ assert data.get_all_plugin_data("notes") == {}
95
+ assert data.get_plugin_data("scratchpad", "draft") == "hello world"
@@ -14,18 +14,20 @@ class DummyPlugin:
14
14
 
15
15
  def test_check_module_installed_existing_builtin():
16
16
  assert deps.check_module_installed("sys") is True
17
- assert deps.check_module_installed("os") is True
18
17
 
19
18
 
20
19
  def test_check_module_installed_nonexistent():
21
20
  assert deps.check_module_installed("non_existent_fake_package_xyz123") is False
22
21
 
23
22
 
24
- def test_check_module_installed_handles_exceptions():
23
+ def test_check_module_installed_handles_value_error():
25
24
  with patch(
26
25
  "importlib.util.find_spec", side_effect=ValueError("Invalid module name")
27
26
  ):
28
27
  assert deps.check_module_installed("bad.name...") is False
28
+
29
+
30
+ def test_check_module_installed_handles_module_not_found_error():
29
31
  with patch(
30
32
  "importlib.util.find_spec", side_effect=ModuleNotFoundError("Not found")
31
33
  ):
@@ -61,8 +63,7 @@ def test_check_all_plugin_dependencies_empty(capsys):
61
63
  with patch.dict(c.PLUGINS, {}, clear=True):
62
64
  result = loader.check_all_plugin_dependencies()
63
65
  assert result == {}
64
- captured = capsys.readouterr()
65
- assert captured.out == ""
66
+ assert capsys.readouterr().out == ""
66
67
 
67
68
 
68
69
  def test_check_all_plugin_dependencies_no_deps_declared(capsys):
@@ -70,32 +71,31 @@ def test_check_all_plugin_dependencies_no_deps_declared(capsys):
70
71
  with patch.dict(c.PLUGINS, {"clean": plugin}, clear=True):
71
72
  result = loader.check_all_plugin_dependencies()
72
73
  assert result == {}
73
- captured = capsys.readouterr()
74
74
  assert (
75
75
  "✅ No third-party dependencies required for any loaded plugins."
76
- in captured.out
76
+ in capsys.readouterr().out
77
77
  )
78
78
 
79
79
 
80
- def test_check_all_plugin_dependencies_with_missing(capsys, monkeypatch):
80
+ def test_check_all_plugin_dependencies_returns_missing_map(monkeypatch):
81
81
  def fake_find_spec(name):
82
82
  return MagicMock() if name == "numpy" else None
83
83
 
84
84
  monkeypatch.setattr("importlib.util.find_spec", fake_find_spec)
85
85
  plugin = DummyPlugin(name="DataPlugin", libs=["numpy", "aura", "yis"])
86
86
  with patch.dict(c.PLUGINS, {"data_plug": plugin}, clear=True):
87
- missing_dict = loader.check_all_plugin_dependencies()
88
- assert missing_dict == {"data_plug": ["aura", "yis"]}
89
- captured = capsys.readouterr()
90
- assert "Plugin: DataPlugin (data_plug)" in captured.out
91
- assert "✅ numpy - Dependency found" in captured.out
92
- assert "⚠️ aura - DEPENDENCY NOT FOUND" in captured.out
93
- assert "⚠️ yis - DEPENDENCY NOT FOUND" in captured.out
94
- assert (
95
- "Install using: 'sys pip install aura' once system has booted."
96
- in captured.out
97
- )
98
- assert (
99
- "Install using: 'sys pip install yis' once system has booted."
100
- in captured.out
101
- )
87
+ assert loader.check_all_plugin_dependencies() == {"data_plug": ["aura", "yis"]}
88
+
89
+
90
+ def test_check_all_plugin_dependencies_prints_install_instructions(capsys, monkeypatch):
91
+ def fake_find_spec(name):
92
+ return MagicMock() if name == "numpy" else None
93
+
94
+ monkeypatch.setattr("importlib.util.find_spec", fake_find_spec)
95
+ plugin = DummyPlugin(name="DataPlugin", libs=["numpy", "aura"])
96
+ with patch.dict(c.PLUGINS, {"data_plug": plugin}, clear=True):
97
+ loader.check_all_plugin_dependencies()
98
+ out = capsys.readouterr().out
99
+ assert "✅ numpy - Dependency found" in out
100
+ assert "⚠️ aura - DEPENDENCY NOT FOUND" in out
101
+ assert "Install using: 'sys pip install aura' once system has booted." in out
@@ -0,0 +1,106 @@
1
+ # tests/test_directory.py
2
+
3
+ from flyshell.core import directory
4
+
5
+
6
+ def test_parse_simple_command():
7
+ assert directory._parse_commands("clear") == [(None, "clear")]
8
+
9
+
10
+ def test_parse_semicolon_chain():
11
+ assert directory._parse_commands("clear ; history") == [
12
+ (None, "clear"),
13
+ (";", "history"),
14
+ ]
15
+
16
+
17
+ def test_parse_and_chain():
18
+ assert directory._parse_commands("cd mydir && dir") == [
19
+ (None, "cd mydir"),
20
+ ("&&", "dir"),
21
+ ]
22
+
23
+
24
+ def test_parse_or_chain():
25
+ assert directory._parse_commands("open missing.txt || echo fallback") == [
26
+ (None, "open missing.txt"),
27
+ ("||", "echo fallback"),
28
+ ]
29
+
30
+
31
+ def test_parse_preserves_operators_inside_quotes():
32
+ assert directory._parse_commands('echo "hello ; world && test"') == [
33
+ (None, 'echo "hello ; world && test"')
34
+ ]
35
+
36
+
37
+ def test_parse_unclosed_quote_returns_empty():
38
+ assert directory._parse_commands('echo "unterminated quote') == []
39
+
40
+
41
+ def test_parse_empty_string():
42
+ assert directory._parse_commands("") == []
43
+
44
+
45
+ def test_parse_whitespace_only():
46
+ assert directory._parse_commands(" ") == []
47
+
48
+
49
+ def test_execute_line_runs_both_on_semicolon(monkeypatch):
50
+ executed = []
51
+
52
+ def mock_execute_single(raw_cmd):
53
+ executed.append(raw_cmd)
54
+ return 1
55
+
56
+ monkeypatch.setattr(directory, "_execute_single", mock_execute_single)
57
+ directory.execute_line("fail ; second")
58
+ assert executed == ["fail", "second"]
59
+
60
+
61
+ def test_execute_line_runs_second_when_and_succeeds(monkeypatch):
62
+ executed = []
63
+
64
+ def mock_execute_single(raw_cmd):
65
+ executed.append(raw_cmd)
66
+ return 0
67
+
68
+ monkeypatch.setattr(directory, "_execute_single", mock_execute_single)
69
+ directory.execute_line("ok && second")
70
+ assert executed == ["ok", "second"]
71
+
72
+
73
+ def test_execute_line_short_circuits_on_and_failure(monkeypatch):
74
+ executed = []
75
+
76
+ def mock_execute_single(raw_cmd):
77
+ executed.append(raw_cmd)
78
+ return 1
79
+
80
+ monkeypatch.setattr(directory, "_execute_single", mock_execute_single)
81
+ directory.execute_line("fail && success")
82
+ assert executed == ["fail"]
83
+
84
+
85
+ def test_execute_line_short_circuits_on_or_success(monkeypatch):
86
+ executed = []
87
+
88
+ def mock_execute_single(raw_cmd):
89
+ executed.append(raw_cmd)
90
+ return 0
91
+
92
+ monkeypatch.setattr(directory, "_execute_single", mock_execute_single)
93
+ directory.execute_line("first || second")
94
+ assert executed == ["first"]
95
+
96
+
97
+ def test_execute_line_chaining_cascades(monkeypatch):
98
+ executed = []
99
+
100
+ def mock_execute_single(raw_cmd):
101
+ executed.append(raw_cmd)
102
+ return 0 if raw_cmd == "ok" else 1
103
+
104
+ monkeypatch.setattr(directory, "_execute_single", mock_execute_single)
105
+ directory.execute_line("ok || fallback && never_run")
106
+ assert executed == ["ok"]