MCPcopy Index your code
hub / github.com/Shemnei/punktf

github.com/Shemnei/punktf @v3.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.1.2 ↗ · + Follow
384 symbols 879 edges 29 files 233 documented · 61%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

punktf - A multi-target dotfiles manager

MIT License Continuous Integration rust docs Crates.io Homebrew AUR Chocolatey

Yet another dotfile manager?!

Well, yes, but hear me out: This project was driven by the personal need of having to manage several dotfiles for different machines/targets. You want the same experience everywhere: On your Windows workstation along with an Ubuntu WSL instance, your Debian server and your private Arch installation. This tool fixes that problem while being cross-platform and blazingly fast. You won't need multiple sets of dotfile configurations ever again!

Features:

  • Compile and deploy your dotfiles with one command across different platforms
  • Use handlebar-like instructions to insert variables and compile sections conditionally
  • Define pre- and post-hooks to customize the behavior with your own commands
  • Create multiple profiles for different targets
  • Works on Windows and Linux

Installation

Packaging status

Homebrew

Install punktf using Homebrew on Linux:

brew install michidk/tools/punktf

AUR

Install punktf from AUR on Arch Linux.

To install it use your favorite AUR capable package manager (e.g. yay, pikaur):

NOTE: As this builds punktf from source an up-to-date rust installation is needed.

yay punktf

or

pikaur -S punktf

Scoop

Install punktf using Scoop on Windows:

scoop bucket add shemnei https://github.com/Shemnei/scoop-bucket

scoop install punktf

Chocolatey

Install punktf using Chocolatey on Windows:

choco install punktf

Cargo & Crates.io

Install punktf using cargo and crates.io on Windows and Linux:

cargo install punktf

Building from source

To install punktf from source the following is needed:

  • An up-to-date rust installation
  • An installed nightly toolchain
# Clone
git clone https://github.com/Shemnei/punktf
cd punktf

# Build (cargo)
cargo build --release

Usage

Commands

To deploy a profile, use the deploy subcommand:

# deploy 'windows' profile
punktf deploy --profile windows

# deploy (custom source folder)
punktf deploy --source /home/demo/mydotfiles --profile windows

Adding the -h/--help flag to a given subcommand, will print usage instructions.

Source Folder

The punktf source folder is the folder containing the dotfiles and punktf profiles. We recommend setting the PUNKTF_SOURCE environment variable so that the dotfiles can be compiled using punktf deploy <profile>.

punktf searches for the source folder in the following order:

  1. Paths specified with -s/--source
  2. Paths specified by an environment variable PUNKTF_SOURCE
  3. The current working directory of the shell

The source folder should contain two sub-folders:

  • profiles\: Contains the punktf profile definitions (.yaml or .json)
  • dotfiles\: Contains folders and the actual dotfiles

Example punktf source folder structure:

+ profiles
  + windows.yaml
  + base.yaml
  + arch.json
+ dotfiles
  + .gitconfig
  + init.vim.win
  + base
    + demo.txt
  + linux
    + .bashrc
  + windows
    + alacritty.yml

Target

Determines where punktf will deploy files too. It can be set with:

  1. Variable target in the punktf profile file
  2. Environment variable PUNKTF_TARGET

Profiles

Profiles define which dotfiles should be used. They can be a .json or .yaml file.

Example punktf profile:

variables:
  OS: "windows"

target: "C:\\Users\\Demo"

dotfiles:
  - path: "base"
  - path: "windows/alacritty.yml"
    target:
      path: "C:\\Users\\Demo\\AppData\\Local\\alacritty.yml"
    merge: Ask

links:
  - source_path: "C:\\Users\\Demo\\Dotfiles\\test.txt"
    target_path: "C:\\Users\\Demo\\test.txt"

All properties are explained in the wiki.

Templates

Please refer to the wiki for the templating syntax.

License

Licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

Visitor (Interface)
Trait accepts [`Item`]s for further processing. This is a kind of an iterator over all items which are included in a [` [3 …
crates/punktf-lib/src/visit/mod.rs
Transform (Interface)
A transform takes the contents of a dotfile, processes it and returns a new version of the content. The dotfile is eith [2 …
crates/punktf-lib/src/profile/transform.rs
Vars (Interface)
Variables that replace values in templates [2 implementers]
crates/punktf-lib/src/profile/variables.rs
TemplateVisitor (Interface)
An extension trait to [`Visitor`] which adds a new function to accept template items. [2 implementers]
crates/punktf-lib/src/visit/mod.rs
ExitOk (Interface)
TODO: Replace once `exit_ok` becomes stable Maps a value to an Result. This is mainly used as a replacement for [`std::p [1 …
crates/punktf-lib/src/profile/hook.rs

Core symbols most depended-on inside this repo

setup_test_env
called by 33
crates/punktf-lib/src/lib.rs
len
called by 27
crates/punktf-lib/src/template/block.rs
span
called by 26
crates/punktf-lib/src/template/span.rs
as_ref
called by 24
crates/punktf-lib/src/visit/deploy/deployment.rs
next_top_level_block
called by 23
crates/punktf-lib/src/template/parse.rs
clone
called by 18
crates/punktf-lib/src/template/span.rs
primary_span
called by 17
crates/punktf-lib/src/template/diagnostic.rs
label_span
called by 17
crates/punktf-lib/src/template/diagnostic.rs

Shape

Method 219
Function 79
Class 59
Enum 21
Interface 6

Languages

Rust100%

Modules by API surface

crates/punktf-lib/src/visit/mod.rs44 symbols
crates/punktf-lib/src/visit/deploy/deployment.rs38 symbols
crates/punktf-lib/src/profile/mod.rs32 symbols
crates/punktf-lib/src/template/diagnostic.rs28 symbols
crates/punktf-lib/src/template/source.rs25 symbols
crates/punktf-lib/src/template/parse/tests.rs25 symbols
crates/punktf-lib/src/template/parse.rs25 symbols
crates/punktf-lib/src/template/span.rs22 symbols
crates/punktf-lib/src/template/block.rs22 symbols
crates/punktf-lib/src/visit/deploy/mod.rs17 symbols
crates/punktf-lib/src/visit/diff/mod.rs13 symbols
crates/punktf-cli/src/main.rs13 symbols

For agents

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

⬇ download graph artifact

Ask about this repo answers extend the page