Timothy Pomeroy b63ce13163 Update READMEs, add data README, remove legacy code, move dev notes to docs пре 1 месец
..
apps 7b7c4f0ac9 Initial commit пре 1 месец
src b63ce13163 Update READMEs, add data README, remove legacy code, move dev notes to docs пре 1 месец
README.md b63ce13163 Update READMEs, add data README, remove legacy code, move dev notes to docs пре 1 месец
package.json b63ce13163 Update READMEs, add data README, remove legacy code, move dev notes to docs пре 1 месец
tsconfig.json 7b7c4f0ac9 Initial commit пре 1 месец

README.md

Watch Finished CLI

A Node.js CLI for interacting with the Watch Finished system. Provides commands for managing files, settings, tasks, and maintenance from the terminal.

Usage

pnpm run cli <command> [...args]

Note: The CLI defaults to connecting to http://localhost:3001. If your service runs on a different port, set the WATCH_FINISHED_API environment variable:

WATCH_FINISHED_API=http://localhost:3000 pnpm run cli <command>

Interactive Mode

The CLI launches in interactive mode by default for a guided, menu-driven experience. Use specific commands for automation or pass --help for command-line usage.

# Interactive mode (default)
pnpm run cli

# Command-line mode for automation
pnpm run cli task:list

# Show help
pnpm run cli --help

The interactive mode provides:

  • Menu-driven navigation through all available commands
  • Guided parameter input with prompts and validation
  • Contextual help and error handling
  • Colored output for better readability

Main Commands

Main Commands

File Management

  • list --dataset <dataset> — List files in a dataset
  • file:get --dataset <dataset> --file <file> — Get a file record
  • file:set --dataset <dataset> --file <file> [options] — Set (create/update) a file record
  • file:remove --dataset <dataset> --file <file> [options] — Remove a file record
  • files:deleted-older-than --dataset <dataset> --isoDate <date> — Get deleted files older than a date

Configuration

  • config:list — List available config files
  • config:settings [key] — Get settings (optionally by key)
  • config:file --name <name> — Get a config file by name

Task Management

  • task:list — List all tasks
  • task:get --id <id> — Get a task by ID
  • task:delete --id <id> — Delete a task by ID
  • task:queue:status — Get queue status
  • task:queue:settings — Get queue settings
  • task:queue:settings:update [options] — Update queue settings

Watcher Control

  • watcher:start [options] — Start the watcher
  • watcher:stop — Stop the watcher
  • watcher:status — Get watcher status

Maintenance

  • maintenance:cleanup [options] — Cleanup a file from DB if missing
  • maintenance:purge [options] — Purge deleted records older than a threshold
  • maintenance:prune [options] — Prune processed files that no longer exist

HandBrake

  • handbrake:presets — List HandBrake presets
  • handbrake:process [options] — Process a video file with HandBrake

Task Queue Settings Options

When updating queue settings with task:queue:settings:update, you can specify:

  • --batch-size <number> — Number of tasks to process in each batch
  • --concurrency <number> — Maximum number of concurrent tasks
  • --retry-enabled <true|false> — Enable/disable retry logic
  • --max-retries <number> — Maximum number of retry attempts
  • --retry-delay <milliseconds> — Delay between retry attempts
  • --processing-interval <milliseconds> — Interval between processing cycles

Examples

# List all tasks (uses default localhost:3001)
pnpm run cli task:list

# Get current queue settings
pnpm run cli task:queue:settings

# Update queue settings (increase batch size and concurrency)
pnpm run cli task:queue:settings:update --batch-size 5 --concurrency 3

# Start the file watcher
pnpm run cli watcher:start --watches "/data/movies,/data/tvshows"

# Process a video file
pnpm run cli handbrake:process --input input.mp4 --output output.m4v --preset "Fast 1080p30"

# Get settings
pnpm run cli config:settings

# Add a file record
pnpm run cli file:set --dataset movies --file mymovie.mkv --output mymovie.mp4 --status completed

# Launch interactive mode (also the default when no command is specified)
pnpm run cli

# If your service runs on a different port, set the environment variable
WATCH_FINISHED_API=http://localhost:3000 pnpm run cli task:list

Running in Docker

When running the CLI from within a Docker container:

docker-compose exec service pnpm run cli task:list