librelad e5273a482d feat(cli): route app install through the task processor + live follower
Spike — closes the gap where the CLI install bypassed the very task system
the WebUI uses. Now both surfaces hit the same path:

  user types `libreportal app install dashy`
    → CLI enqueues a task file in $TASK_DIR (identical shape to the
      WebUI's createTaskFile)
    → pokes $TASK_DIR/.queue.fifo so the processor dispatches in <100ms
      instead of waiting up to IDLE_POLL_SECS
    → CLI tails the task log + polls .status, exits with the task's
      exit_code on terminal state
    → Ctrl-C detaches the follower without killing the task — the
      WebUI's tasks panel keeps showing it

Bypass: the recursive command in the task file is prefixed
`LIBREPORTAL_TASK_EXEC=1 libreportal app install <name>`. The install
branch in cli_app_commands.sh honours that env var by running inline,
which is what the processor's eval invocation hits. No processor
changes — the bypass travels with the task.

Wins:
  - one log file per install, shared by CLI + WebUI (audit trail + replay)
  - locking serialises CLI + WebUI installs (no more two-frontend race)
  - WebUI's "current task" indicator now reflects CLI work too
  - free `--detach` for fire-and-forget queueing

New: scripts/cli/task/cli_task_run.sh
  cliTaskRun <cmd> [type] [app] [--detach]
    Enqueues + follows; --detach prints the task id and exits 0.
  cliTaskFollow <task_id>
    `tail -F` the log + jq-poll the status; returns the task's exit_code.
    Designed to be reused for `libreportal task log <id>` reattach later.

Trade-off: ~200-500ms latency before the first byte (write task file,
processor wakes, opens log, follower starts tailing). Negligible for
install/update/backup — fast commands (list/status/config get) still
run inline. The current branch only changes `app install`; uninstall +
update + backup can be moved on the same pattern once this lands clean.

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-27 14:29:30 +01:00

52 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# This file is auto-generated by generate_arrays.sh
# Do not edit manually - run './scripts/source/files/generate_arrays.sh run' to regenerate
cli_scripts=(
"cli/cli_initialize.sh"
"cli/cli_update.sh"
"cli/commands/app/cli_app_commands.sh"
"cli/commands/app/cli_app_header.sh"
"cli/commands/app/cli_app_restore.sh"
"cli/commands/app/cli_app_tool_list.sh"
"cli/commands/backup/cli_backup_commands.sh"
"cli/commands/backup/cli_backup_header.sh"
"cli/commands/config/cli_config_commands.sh"
"cli/commands/config/cli_config_header.sh"
"cli/commands/debug/cli_debug_commands.sh"
"cli/commands/debug/cli_debug_header.sh"
"cli/commands/dockertype/cli_dockertype_commands.sh"
"cli/commands/dockertype/cli_dockertype_header.sh"
"cli/commands/firewall/cli_firewall_commands.sh"
"cli/commands/firewall/cli_firewall_header.sh"
"cli/commands/help/cli_help_commands.sh"
"cli/commands/help/cli_help_header.sh"
"cli/commands/install/cli_install_commands.sh"
"cli/commands/install/cli_install_header.sh"
"cli/commands/ip/cli_ip_commands.sh"
"cli/commands/ip/cli_ip_header.sh"
"cli/commands/peer/cli_peer_commands.sh"
"cli/commands/peer/cli_peer_header.sh"
"cli/commands/regen/cli_regen_commands.sh"
"cli/commands/regen/cli_regen_header.sh"
"cli/commands/reset/cli_reset_commands.sh"
"cli/commands/reset/cli_reset_header.sh"
"cli/commands/restore/cli_restore_commands.sh"
"cli/commands/restore/cli_restore_header.sh"
"cli/commands/setup/cli_setup_commands.sh"
"cli/commands/setup/cli_setup_header.sh"
"cli/commands/ssh/cli_ssh_commands.sh"
"cli/commands/ssh/cli_ssh_header.sh"
"cli/commands/system/cli_system_commands.sh"
"cli/commands/system/cli_system_header.sh"
"cli/commands/update/cli_update_commands.sh"
"cli/commands/update/cli_update_header.sh"
"cli/commands/validation/cli_validation_commands.sh"
"cli/commands/validation/cli_validation_header.sh"
"cli/commands/webui/cli_webui_commands.sh"
"cli/commands/webui/cli_webui_header.sh"
"cli/task/cli_task_run.sh"
)