-
-
Notifications
You must be signed in to change notification settings - Fork 3
Omnysh #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omnysh #4
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "🔹 [1] Установка зависимостей для Python..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "requirements.txt" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pip install -r requirements.txt || pip3 install -r requirements.txt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo -e "requests\nwebsocket-client" > requirements.txt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| printf '%s\n' "requests" "websocket-client" > requirements.txt |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] To avoid ambiguity, explicitly call pip3 first for Python 3 environments and fall back to pip only if needed.
| pip install -r requirements.txt || pip3 install -r requirements.txt | |
| else | |
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | |
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| pip install -r requirements.txt || pip3 install -r requirements.txt | |
| pip3 install -r requirements.txt || pip install -r requirements.txt | |
| else | |
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | |
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| pip3 install -r requirements.txt || pip install -r requirements.txt |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Falling back to pip3 after pip may mask which interpreter is being used. It might be clearer to detect the Python version first or consistently use one installer.
| if [ -f "requirements.txt" ]; then | |
| pip install -r requirements.txt || pip3 install -r requirements.txt | |
| else | |
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | |
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| pip install -r requirements.txt || pip3 install -r requirements.txt | |
| # Detect Python version and set the appropriate pip command | |
| if command -v python3 &>/dev/null; then | |
| PYTHON_CMD="python3" | |
| PIP_CMD="pip3" | |
| elif command -v python &>/dev/null; then | |
| PYTHON_CMD="python" | |
| PIP_CMD="pip" | |
| else | |
| echo "❌ Python не установлен. Установите Python и повторите попытку." | |
| exit 1 | |
| fi | |
| if [ -f "requirements.txt" ]; then | |
| $PIP_CMD install -r requirements.txt | |
| else | |
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | |
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| $PIP_CMD install -r requirements.txt |
Copilot
AI
May 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider exiting the script if neither pip nor pip3 succeeds to avoid continuing with missing dependencies.
| pip install -r requirements.txt || pip3 install -r requirements.txt | |
| else | |
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | |
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| pip install -r requirements.txt || pip3 install -r requirements.txt | |
| pip install -r requirements.txt || pip3 install -r requirements.txt || { echo "❌ Ошибка: Не удалось установить зависимости. Убедитесь, что pip или pip3 установлены и настроены."; exit 1; } | |
| else | |
| echo "⚠️ Файл requirements.txt не найден. Создаю..." | |
| echo -e "requests\nwebsocket-client" > requirements.txt | |
| pip install -r requirements.txt || pip3 install -r requirements.txt || { echo "❌ Ошибка: Не удалось установить зависимости. Убедитесь, что pip или pip3 установлены и настроены."; exit 1; } |
Copilot
AI
May 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Extract the hardcoded port 8080 into a variable or parameter to make the script more configurable.
| npx live-server --port=8080 & | |
| npx live-server --port=$LIVE_SERVER_PORT & |
Copilot
AI
May 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a fixed sleep introduces potential race conditions; consider polling the service or checking the port readiness instead of a static delay.
Copilot
AI
May 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider capturing the process ID of this background process to facilitate error handling and proper cleanup later.
| python3 TreeOM_AppServer.py & | |
| echo "🌐 [4] Запуск WebSocket-сервера..." | |
| node websocket_server.js & | |
| echo "💎 [5] Запуск Discord-интеграции..." | |
| node discord_bot.js & | |
| echo "🧠 [6] Запуск Live Web-интерфейса..." | |
| npx live-server --port=8080 & | |
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| python3 TreeOM_AppServer.py & TREEOM_PID=$! | |
| echo "🌐 [4] Запуск WebSocket-сервера..." | |
| node websocket_server.js & WEBSOCKET_PID=$! | |
| echo "💎 [5] Запуск Discord-интеграции..." | |
| node discord_bot.js & DISCORD_PID=$! | |
| echo "🧠 [6] Запуск Live Web-интерфейса..." | |
| npx live-server --port=8080 & LIVE_SERVER_PID=$! | |
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & MONITOR_PID=$! |
Copilot
AI
May 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple background processes are launched without any error handling or status monitoring. Consider adding checks or a monitoring mechanism to ensure these processes start successfully.
| python3 TreeOM_AppServer.py & | |
| echo "🌐 [4] Запуск WebSocket-сервера..." | |
| node websocket_server.js & | |
| echo "💎 [5] Запуск Discord-интеграции..." | |
| node discord_bot.js & | |
| echo "🧠 [6] Запуск Live Web-интерфейса..." | |
| npx live-server --port=8080 & | |
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| python3 TreeOM_AppServer.py & | |
| APP_SERVER_PID=$! | |
| if ! kill -0 $APP_SERVER_PID 2>/dev/null; then | |
| echo "❌ Ошибка: TreeOM AppServer не удалось запустить." | |
| exit 1 | |
| fi | |
| echo "🌐 [4] Запуск WebSocket-сервера..." | |
| node websocket_server.js & | |
| WEBSOCKET_SERVER_PID=$! | |
| if ! kill -0 $WEBSOCKET_SERVER_PID 2>/dev/null; then | |
| echo "❌ Ошибка: WebSocket-сервер не удалось запустить." | |
| exit 1 | |
| fi | |
| echo "💎 [5] Запуск Discord-интеграции..." | |
| node discord_bot.js & | |
| DISCORD_BOT_PID=$! | |
| if ! kill -0 $DISCORD_BOT_PID 2>/dev/null; then | |
| echo "❌ Ошибка: Discord-интеграцию не удалось запустить." | |
| exit 1 | |
| fi | |
| echo "🧠 [6] Запуск Live Web-интерфейса..." | |
| npx live-server --port=8080 & | |
| LIVE_SERVER_PID=$! | |
| if ! kill -0 $LIVE_SERVER_PID 2>/dev/null; then | |
| echo "❌ Ошибка: Live Web-интерфейс не удалось запустить." | |
| exit 1 | |
| fi | |
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| MONITOR_PID=$! | |
| if ! kill -0 $MONITOR_PID 2>/dev/null; then | |
| echo "❌ Ошибка: Мониторинг структуры не удалось запустить." | |
| exit 1 | |
| fi |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Multiple background processes are started without tracking or cleanup. Consider capturing PIDs and using a trap to ensure processes are terminated cleanly on script exit.
| python3 TreeOM_AppServer.py & | |
| echo "🌐 [4] Запуск WebSocket-сервера..." | |
| node websocket_server.js & | |
| echo "💎 [5] Запуск Discord-интеграции..." | |
| node discord_bot.js & | |
| echo "🧠 [6] Запуск Live Web-интерфейса..." | |
| npx live-server --port=8080 & | |
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| python3 TreeOM_AppServer.py & PIDS="$PIDS $!" | |
| echo "🌐 [4] Запуск WebSocket-сервера..." | |
| node websocket_server.js & PIDS="$PIDS $!" | |
| echo "💎 [5] Запуск Discord-интеграции..." | |
| node discord_bot.js & PIDS="$PIDS $!" | |
| echo "🧠 [6] Запуск Live Web-интерфейса..." | |
| npx live-server --port=8080 & PIDS="$PIDS $!" | |
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & PIDS="$PIDS $!" |
Copilot
AI
May 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a fixed sleep duration to wait for background processes to start may lead to unpredictable behavior. Consider using a polling mechanism or checking for service readiness instead of a fixed delay.
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| sleep 2 | |
| echo "⏳ Ожидание запуска TreeOM AppServer..." | |
| for i in {1..10}; do | |
| if pgrep -f "TreeOM_AppServer.py" > /dev/null; then | |
| echo "✔️ TreeOM AppServer запущен." | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| echo "⏳ Ожидание запуска WebSocket-сервера..." | |
| for i in {1..10}; do | |
| if pgrep -f "websocket_server.js" > /dev/null; then | |
| echo "✔️ WebSocket-сервер запущен." | |
| break | |
| fi | |
| sleep 1 | |
| done |
Copilot
AI
May 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fixed sleep durations to wait for background processes may be brittle. Consider implementing a loop to check for process readiness or using 'wait' to ensure proper synchronization.
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| sleep 2 | |
| echo "⏳ Ожидание запуска TreeOM AppServer..." | |
| timeout 10 bash -c 'until pgrep -f "TreeOM_AppServer.py" > /dev/null; do sleep 1; done' || { echo "❌ TreeOM AppServer не запустился!"; exit 1; } | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| echo "⏳ Ожидание запуска treeom_monitor.py..." | |
| timeout 10 bash -c 'until pgrep -f "treeom_monitor.py" > /dev/null; do sleep 1; done' || { echo "❌ treeom_monitor.py не запустился!"; exit 1; } |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fixed sleeps can lead to race conditions; consider checking service health or logs instead of a fixed delay.
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| sleep 2 | |
| echo "⏳ Ожидание запуска TreeOM AppServer..." | |
| while ! netstat -tuln | grep -q ':5000'; do | |
| sleep 0.5 | |
| done | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| echo "⏳ Ожидание запуска TreeOM Monitor..." | |
| while ! pgrep -f treeom_monitor.py > /dev/null; do | |
| sleep 0.5 | |
| done |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This second fixed delay duplicates the earlier one; consider consolidating waits or replacing with readiness checks.
| sleep 2 | |
| while ! pgrep -f "treeom_monitor.py" > /dev/null; do | |
| sleep 1 | |
| done |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fixed sleep intervals to wait for background processes may be unreliable. Consider using process checks or the 'wait' command to ensure background tasks are properly started before proceeding.
| sleep 2 | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| sleep 2 | |
| while ! nc -z localhost 8080; do | |
| sleep 1 | |
| done | |
| echo "🛠️ [7] Запуск мониторинга структуры..." | |
| python3 treeom_monitor.py & | |
| while ! pgrep -f "treeom_monitor.py" > /dev/null; do | |
| sleep 1 | |
| done |
Copilot
AI
May 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the static delay with an active readiness check (e.g., nc or curl) to confirm the monitor process is accepting connections.
| sleep 2 | |
| echo "⏳ Ожидание готовности treeom_monitor.py..." | |
| for i in {1..10}; do | |
| if nc -z localhost 5000; then | |
| echo "✔️ treeom_monitor.py готов." | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| if ! nc -z localhost 5000; then | |
| echo "❌ Ошибка: treeom_monitor.py не готов после 10 секунд ожидания." | |
| exit 1 | |
| fi |
Copilot
AI
May 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script attempts to copy a CI template without verifying that './templates/ci_template.yml' exists. Consider adding a check to ensure the template file is present before copying.
| cp ./templates/ci_template.yml .github/workflows/main.yml | |
| if [ -f "./templates/ci_template.yml" ]; then | |
| cp ./templates/ci_template.yml .github/workflows/main.yml | |
| else | |
| echo "❌ Шаблон CI/CD pipeline (./templates/ci_template.yml) не найден. Проверьте наличие файла." | |
| fi |
Copilot
AI
May 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify the existence of templates/ci_template.yml before copying to prevent errors when the source file is missing.
| cp ./templates/ci_template.yml .github/workflows/main.yml | |
| if [ -f "./templates/ci_template.yml" ]; then | |
| cp ./templates/ci_template.yml .github/workflows/main.yml | |
| else | |
| echo "❌ Шаблон CI/CD pipeline (ci_template.yml) не найден. Проверьте наличие файла в папке templates." | |
| fi |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If README.md does not exist, grep will fail; you may want to ensure the file exists or create it before grepping.
| echo "📘 [9] Обновление README.md..." | |
| echo "📘 [9] Обновление README.md..." | |
| if [ ! -f "README.md" ]; then | |
| echo "⚠️ Файл README.md не найден. Создаю пустой файл..." | |
| touch README.md | |
| fi |
Copilot
AI
May 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running grep on README.md will error out if the file doesn't exist. Add a check to create README.md first or guard the grep with a file-existence test.
| echo "📘 [9] Обновление README.md..." | |
| echo "📘 [9] Обновление README.md..." | |
| if [ ! -f "README.md" ]; then | |
| echo "⚠️ Файл README.md не найден. Создаю..." | |
| touch README.md | |
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch to a more portable shebang (e.g.,
#!/usr/bin/env bash) to ensure the script works across different environments.