Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions scripts/install-phlow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ set -e

REPO="phlowdotdev/phlow"
BIN_NAME="phlow"
INSPECT_BIN_NAME="phlow-cli-inspect"
INSTALL_DIR="$HOME/.phlow"
BIN_PATH="$INSTALL_DIR/phlow"
INSPECT_BIN_PATH="$INSTALL_DIR/phlow-cli-inspect"
ADD_PATH_CMD='export PATH="$HOME/.phlow:$PATH"'

echo "🔍 Detecting platform..."
Expand All @@ -16,13 +18,16 @@ ARCH=$(uname -m)
# Identificando o asset correto
if [[ "$OS" == "Darwin" ]]; then
ASSET_NAME="${BIN_NAME}-macos"
INSPECT_ASSET_NAME="${INSPECT_BIN_NAME}-macos"
elif [[ "$OS" == "Linux" ]]; then
case "$ARCH" in
x86_64)
ASSET_NAME="${BIN_NAME}-amd64"
INSPECT_ASSET_NAME="${INSPECT_BIN_NAME}-amd64"
;;
aarch64 | arm64)
ASSET_NAME="${BIN_NAME}-arm64"
INSPECT_ASSET_NAME="${INSPECT_BIN_NAME}-arm64"
;;
*)
echo "❌ Unsupported Linux architecture: $ARCH"
Expand All @@ -41,13 +46,18 @@ LATEST=$(curl -s https://api.github.com/repos/$REPO/releases/latest | grep tag_n
echo "📦 Latest version is $LATEST"

URL="https://github.com/$REPO/releases/download/$LATEST/$ASSET_NAME"
INSPECT_URL="https://github.com/$REPO/releases/download/$LATEST/$INSPECT_ASSET_NAME"

echo "🚚 Downloading $BIN_NAME from $URL..."
mkdir -p "$INSTALL_DIR"
curl -L "$URL" -o "$BIN_PATH"

echo "🚚 Downloading $INSPECT_BIN_NAME from $INSPECT_URL..."
curl -L "$INSPECT_URL" -o "$INSPECT_BIN_PATH"

echo "⚙️ Making binary executable..."
chmod +x "$BIN_PATH"
chmod +x "$INSPECT_BIN_PATH"

echo "🔧 Updating shell configuration files..."
for shell_rc in "$HOME/.bashrc" "$HOME/.zshrc"; do
Expand Down
48 changes: 24 additions & 24 deletions site/docs/advanced/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,56 @@ sidebar_position: 2
title: Debug
---

# Debug do Phlow
# Phlow Debugging

O modo debug pausa a execucao antes de cada step e permite inspecionar o contexto (main/payload), o step atual e o historico de execucao via um servidor TCP e o TUI inspector.
Debug mode pauses execution before each step and lets you inspect the context (main/payload), the current step, and the execution history through a TCP server and the TUI inspector.

## Ativando o debug
## Enabling debug

O debug eh habilitado por variavel de ambiente. Use `PHLOW_DEBUG=true`:
Debug is enabled via an environment variable. Use `PHLOW_DEBUG=true`:

```bash
PHLOW_DEBUG=true cargo run -p phlow-runtime -- ./examples/qualquer.phlow
PHLOW_DEBUG=true phlow ./examples/any.phlow
```

Por padrao o servidor debug escuta em `0.0.0.0:31400`. Para mudar a porta, use `PHLOW_DEBUG_PORT`:
By default the debug server listens on `0.0.0.0:31400`. To change the port, use `PHLOW_DEBUG_PORT`:

```bash
PHLOW_DEBUG=true PHLOW_DEBUG_PORT=31400 cargo run -p phlow-runtime -- ./examples/qualquer.phlow
PHLOW_DEBUG=true PHLOW_DEBUG_PORT=31400 phlow ./examples/any.phlow
```

## Inspecao com o phlow-tui-inspect
## Inspecting with phlow-tui-inspect

Em outro terminal, conecte o inspector na mesma porta:
In another terminal, connect the inspector to the same port:

```bash
PHLOW_DEBUG_PORT=31400 cargo run -p phlow-tui-inspect
PHLOW_DEBUG_PORT=31400 phlow-cli-inspect
```

O inspector se conecta em `127.0.0.1`, entao para depurar remotamente use tunel/port-forward.
The inspector connects to `127.0.0.1`, so use a tunnel/port-forward if you need remote debugging.

## Comandos principais
## Main commands

Voce pode digitar os comandos diretamente na barra do inspector:
You can type commands directly in the inspector bar:

- `STEP` - mostra o step aguardando execucao
- `SHOW` - mostra o script compilado
- `NEXT` - libera um step
- `RELEASE` - libera o pipeline atual
- `ALL` - mostra historico de steps
- `PAUSE` - pausa qualquer liberacao em andamento
- `STEP` - shows the step waiting for execution
- `SHOW` - shows the compiled script
- `NEXT` - releases one step
- `RELEASE` - releases the current pipeline
- `ALL` - shows step history
- `PAUSE` - pauses any ongoing release

Atalhos do inspector (equivalentes aos comandos acima):
Inspector shortcuts (equivalent to the commands above):

- `/n` (Ctrl+n) - NEXT + STEP
- `/a` (Ctrl+a) - NEXT + ALL
- `/r` (Ctrl+r) - RELEASE + ALL
- `/w` (Ctrl+w) - SHOW
- `/g` (Ctrl+g) - STEP

Use `/m` para abrir o resumo de comandos e `ESC` para fechar.
Use `/m` to open the command summary and `ESC` to close it.

## Observacoes e seguranca
## Notes and safety

- Quando o debug esta ativo, a execucao pausa a cada step ate receber `NEXT` ou `RELEASE`.
- O servidor debug eh uma porta TCP simples. Use apenas em ambiente confiavel e evite expor para a internet.
- When debug is active, execution pauses at each step until it receives `NEXT` or `RELEASE`.
- The debug server is a simple TCP port. Use it only in trusted environments and avoid exposing it to the internet.