Skip to content

squishydal/kenshi-mod-loader

Repository files navigation

Kenshi Mod Loader

A terminal-based mod manager for Kenshi that uses SteamCMD to download mods directly from Steam Workshop.

Features

  • 🔍 Browse Steam Workshop mods with a beautiful TUI
  • ⬇️ Download mods using SteamCMD with anonymous login
  • 📦 View installed mods
  • ⚙️ Configure mod and download paths
  • 🎨 Modern terminal UI with Bubble Tea

Installation

Prerequisites

  1. Go 1.21+ - Install Go
  2. SteamCMD - Required for downloading mods

Install SteamCMD

Windows:

# Download from: https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip
# Extract to C:\steamcmd\
# Run steamcmd.exe once to complete installation

Linux (Ubuntu/Debian):

sudo apt install steamcmd

macOS:

brew install steamcmd

Install the Mod Loader

# Clone or download the project
git clone <repository-url>
cd kenshi-mod-loader

# Install dependencies
go mod init kenshi-mod-loader
go get github.com/charmbracelet/bubbletea
go get github.com/charmbracelet/bubbles/spinner
go get github.com/charmbracelet/bubbles/textinput
go get github.com/charmbracelet/lipgloss

# Run
go run .

Usage

First Run - Configuration

On first run, you'll be asked to configure:

  1. Mods Path: Where your Kenshi mods are installed

    • Windows: C:\Steam\steamapps\workshop\content\233860
    • Linux: ~/.steam/steam/steamapps/workshop/content/233860
  2. Download Path: Where to download new mods (default: ./kenshi_workshop_downloads)

Keyboard Controls

Global

  • TAB - Switch between tabs
  • Ctrl+C or Q - Quit

Browse Workshop Tab

  • ↑/↓ or K/J - Navigate list
  • PgUp/PgDn - Fast scroll
  • SPACE - Toggle mod selection
  • A - Select all mods
  • D - Deselect all mods
  • L - Load more pages
  • ENTER - Download selected mods

Installed Mods Tab

  • ↑/↓ or K/J - Navigate list
  • PgUp/PgDn - Fast scroll
  • R - Refresh mod list

Settings Tab

  • R - Reset configuration

Project Structure

The project is organized into modular files for easy maintenance:

kenshi-mod-loader/
├── main.go          # Entry point
├── types.go         # Data structures and constants
├── styles.go        # UI styling (colors, formatting)
├── config.go        # Configuration management
├── scraper.go       # Steam Workshop scraping
├── steamcmd.go      # SteamCMD integration
├── installed.go     # Installed mods management
├── model.go         # Application state and logic
├── keys.go          # Keyboard input handlers
└── view.go          # UI rendering

Module Descriptions

types.go

  • Defines all data structures (WorkshopMod, InstalledMod, Config, etc.)
  • Contains constants (app ID, config file name)
  • Message types for the Bubble Tea framework

styles.go

  • Lipgloss styles for UI elements
  • Color schemes and formatting
  • Tab styles and selection highlights

config.go

  • Load and save user configuration
  • Handles JSON serialization
  • Manages config file operations

scraper.go

  • Scrapes Steam Workshop pages
  • Extracts mod IDs and titles
  • Fetches individual mod details
  • Handles HTML parsing with regex

steamcmd.go

  • Detects SteamCMD installation
  • Platform-specific path handling
  • Executes mod downloads
  • Provides installation instructions

installed.go

  • Scans mods directory
  • Identifies Steam Workshop mods
  • Parses mod folder names
  • Returns default paths per platform

model.go

  • Main application model
  • Initializes the app state
  • Handles messages and updates
  • Coordinates between modules

keys.go

  • Keyboard input handlers for each tab
  • Navigation controls
  • Selection and action handling

view.go

  • Renders all UI screens
  • Tab rendering
  • Progress indicators
  • Error messages

How It Works

  1. Startup: Loads configuration or prompts for setup
  2. Browse: Scrapes first page of Steam Workshop (30 mods)
  3. Select: User selects mods to download
  4. Check: Verifies SteamCMD is installed
  5. Download: Uses SteamCMD with anonymous login
  6. Complete: Shows results and any failures

Technical Details

  • Async Loading: Mod details are fetched in parallel without blocking UI
  • Pagination: Loads mods on-demand to improve performance
  • Robust Scraping: Multiple regex patterns with fallbacks
  • Error Handling: Graceful failure with helpful error messages
  • Cross-Platform: Works on Windows, Linux, and macOS

Troubleshooting

SteamCMD Not Found

Make sure SteamCMD is installed and in one of these locations:

  • Windows: C:\steamcmd\steamcmd.exe
  • Linux: /usr/bin/steamcmd or /usr/games/steamcmd
  • macOS: /usr/local/bin/steamcmd

No Mods Loading

  • Check your internet connection
  • Steam Workshop might be temporarily unavailable
  • Try loading more pages with the L key

Mods Not Appearing in Kenshi

Mods are downloaded to the configured download path. You may need to:

  1. Move them to your Kenshi mods folder
  2. Enable them in the Kenshi launcher

Contributing

Contributions are welcome! Areas for improvement:

  • Add search functionality
  • Filter by mod category
  • Sort options
  • Mod descriptions in detail view
  • Direct integration with Kenshi launcher

License

MIT License - See LICENSE file for details

Credits

Built with:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages