MCPcopy Index your code
hub / github.com/desbma/stfed

github.com/desbma/stfed @1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.0 ↗ · + Follow
61 symbols 67 edges 5 files 12 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Syncthing Folder Event Daemon (stfed)

Build status AUR version License

Syncthing Folder Event Daemon, aka stfed, is a small companion daemon to run alongside Syncthing, which allows running custom commands when certain folder events happen.

I wrote this to replace a bunch of inefficient and unreliable scripts that were using inotifywait to watch specific files/folders. Instead of watching at the file level, stfed uses the Syncthing API to be notified when files are synchronized.

It is very light on ressource usage and is therefore suitable for use in all contexts: desktop PC, headless servers, home automation setups, etc.

Features

  • can react to custom events
  • folder synchronisation finished
  • file synchronisation finished
  • synchronisation conflict
  • light on system ressources
  • no runtime dependency outside of Syncthing

Installation

From source

You need a Rust build environment for example from rustup.

cargo build --release
install -Dm 755 -t /usr/local/bin target/release/stfed

A systemd service is provided for convenience, to use it:

install -D -t ~/.config/systemd/user ./systemd/stfed.service
systemctl --user daemon-reload
systemctl --user enable --now stfed.service

From the AUR

Arch Linux users can install the stfed AUR package.

Configuration

Configuration file are stored in a directory following the XDG specification, so typically ~/.config/stfed.

Main configuration

config.toml

This file is optional, if absent, stfed will read Syncthing configuration and build its own configuration from it. You typically only need to use this file if using a non local Syncthing instance.

Sample content:

url = "http://127.0.0.1:8384/"  # Syncthing URL
api_key = "xyz"  # Syncthing API key

Hooks

hooks.toml

This file defines hooks, ie. events you want to react to, and what commands to run when they occur.

Sample section for a single hook:

[[hooks]]

# Syncthing folder path
folder = "/absolute/path/of/the/folder"

# Event type, one of:
# file_down_sync_done: triggers when a file has been fully synchronized locally (see filter to match for a specific file)
# folder_down_sync_done: triggers when a folder has been fully synchronized locally
# file_conflict: triggers when Syncthing creates a conflict file due to a local synchronization conflict
# remote_file_conflict: triggers when Syncthing creates a conflict file due to a remote synchronization conflict
event = "file_down_sync_done"

# glob rule for specific file matching for file_down_sync_done events
filter = "shopping-list.txt"

# command to run when event triggers
command = "notify-send 'stfef event triggered!'"

# Whether to allow several commands for the same hook to run simultaneously
# if false, and a burst of events comes, the commands will be skipped while the previous one is still running
# optional, defaults to false
allow_concurrent = false

License

GPLv3

Core symbols most depended-on inside this repo

run
called by 4
src/hook.rs
parse
called by 2
src/config.rs
iter_events
called by 1
src/syncthing.rs
event
called by 1
src/syncthing.rs
reaper
called by 1
src/hook.rs
default_from_syncthing_config
called by 0
src/config.rs
default
called by 0
src/config.rs
deserialize_glob
called by 0
src/config.rs

Shape

Class 40
Method 8
Enum 7
Function 6

Languages

Rust100%

Modules by API surface

src/syncthing_rest.rs36 symbols
src/config.rs11 symbols
src/syncthing.rs9 symbols
src/hook.rs4 symbols
src/main.rs1 symbols

For agents

$ claude mcp add stfed \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact