Migrate to Poetry packaging and restructure codebase #21

Merged
Sudo-Ivan merged 23 commits from codebase-improvements into master 2025-12-01 18:24:25 +00:00
Showing only changes of commit c98131f76b - Show all commits

View File

@@ -1,10 +1,14 @@
#!/usr/bin/env python3
from pathlib import Path
coderabbitai[bot] commented 2025-12-01 06:13:58 +00:00 (Migrated from github.com)
Review

⚠️ Potential issue | 🟡 Minor

Make the file executable or remove the shebang.

The shebang is present but the file is not executable.

Based on static analysis hints, run:

chmod +x scripts/prepare_frontend_dir.py

Or remove the shebang if the script is only intended to be invoked via python scripts/prepare_frontend_dir.py.

🧰 Tools
🪛 Ruff (0.14.6)

1-1: Shebang is present but file is not executable

(EXE001)

🤖 Prompt for AI Agents
In scripts/prepare_frontend_dir.py around line 1, the file contains a shebang
but is not executable; either make the file executable by running chmod +x
scripts/prepare_frontend_dir.py so it can be run directly, or remove the shebang
line if you intend to always invoke it via the python interpreter (e.g., python
scripts/prepare_frontend_dir.py); apply one of these two changes and update any
relevant documentation/CI that assumes direct execution.

Addressed in commits ac839df to c98131f

_⚠️ Potential issue_ | _🟡 Minor_ **Make the file executable or remove the shebang.** The shebang is present but the file is not executable. Based on static analysis hints, run: ```shell chmod +x scripts/prepare_frontend_dir.py ``` Or remove the shebang if the script is only intended to be invoked via `python scripts/prepare_frontend_dir.py`. <details> <summary>🧰 Tools</summary> <details> <summary>🪛 Ruff (0.14.6)</summary> 1-1: Shebang is present but file is not executable (EXE001) </details> </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` In scripts/prepare_frontend_dir.py around line 1, the file contains a shebang but is not executable; either make the file executable by running chmod +x scripts/prepare_frontend_dir.py so it can be run directly, or remove the shebang line if you intend to always invoke it via the python interpreter (e.g., python scripts/prepare_frontend_dir.py); apply one of these two changes and update any relevant documentation/CI that assumes direct execution. ``` </details> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits ac839df to c98131f
coderabbitai[bot] commented 2025-12-01 06:13:58 +00:00 (Migrated from github.com)
Review

🛠️ Refactor suggestion | 🟠 Major

Add safety checks before removing the directory.

The script unconditionally removes the target directory without validation. If the TARGET path is misconfigured or if there's a symlink, this could lead to unintended data loss.

Consider adding basic safety checks:

+# Sanity check: ensure we're in the project root
+if not Path("pyproject.toml").exists():
+    raise RuntimeError("Must run from project root")
+
 if TARGET.exists():
+    # Additional safety: verify it's a directory, not a symlink
+    if TARGET.is_symlink():
+        raise RuntimeError(f"{TARGET} is a symlink, refusing to remove")
     shutil.rmtree(TARGET)

Addressed in commits ac839df to c98131f

_🛠️ Refactor suggestion_ | _🟠 Major_ **Add safety checks before removing the directory.** The script unconditionally removes the target directory without validation. If the `TARGET` path is misconfigured or if there's a symlink, this could lead to unintended data loss. Consider adding basic safety checks: ```diff +# Sanity check: ensure we're in the project root +if not Path("pyproject.toml").exists(): + raise RuntimeError("Must run from project root") + if TARGET.exists(): + # Additional safety: verify it's a directory, not a symlink + if TARGET.is_symlink(): + raise RuntimeError(f"{TARGET} is a symlink, refusing to remove") shutil.rmtree(TARGET) ``` <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits ac839df to c98131f
import shutil
TARGET = Path("meshchatx") / "public"
if not Path("pyproject.toml").exists():
raise RuntimeError("Must run from project root")
if TARGET.exists():
if TARGET.is_symlink():
raise RuntimeError(f"{TARGET} is a symlink, refusing to remove")
shutil.rmtree(TARGET)
TARGET.mkdir(parents=True, exist_ok=True)