formalconf 2.0.17 → 2.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +159 -37
  2. package/dist/formalconf.js +6807 -6347
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ⚙️ FormalConf
4
4
 
5
- ### A macOS dotfiles management TUI built with React & Ink
5
+ ### A macOS and Linux dotfiles management TUI built with React & Ink
6
6
 
7
7
  [![Ink](https://img.shields.io/badge/Ink-5.0.1-00C7B7?style=for-the-badge&logo=react&logoColor=white)](https://github.com/vadimdemedes/ink)
8
8
  [![React](https://img.shields.io/badge/React-18.3.1-61DAFB?style=for-the-badge&logo=react&logoColor=black)](https://reactjs.org/)
@@ -11,6 +11,8 @@
11
11
 
12
12
  [Features](#features) • [Installation](#installation) • [Usage](#usage) • [Development](#development) • [Tech Stack](#tech-stack) • [Contributing](#contributing)
13
13
 
14
+ **Reference:** [My dotfiles](https://github.com/FormalSnake/dotfiles) - A complete working setup with configs, themes, and templates
15
+
14
16
  </div>
15
17
 
16
18
  ---
@@ -24,17 +26,23 @@
24
26
  - Maintains clean home directory structure
25
27
 
26
28
  ### **Package Synchronization**
27
- - **Homebrew formulas & casks** sync from a single JSON config
28
- - **Mac App Store apps** via `mas` CLI integration
29
+ - **Homebrew formulas & casks** sync from a single JSON config (macOS)
30
+ - **Mac App Store apps** via `mas` CLI integration (macOS)
31
+ - **Pacman/AUR** support for Arch Linux
32
+ - **APT** support for Debian/Ubuntu
33
+ - **DNF** support for Fedora
34
+ - **Flatpak** for Linux (cross-distro)
35
+ - **Cargo** for Rust packages (cross-platform)
29
36
  - **Purge mode** to remove unlisted packages
30
37
  - **Lockfile support** for reproducible package installations
31
38
  - Smart dependency detection prevents removal of system-critical apps
32
39
 
33
40
  ### **Theme System**
34
- - **Omarchy-compatible themes** with symlink-based switching
35
- - Application-specific theme configs (Ghostty, Btop, Neovim, etc.)
41
+ - **JSON-based themes** with template engine for config generation
42
+ - Application-specific theme configs (Ghostty, Btop, Neovim, Waybar, Hyprland, etc.)
36
43
  - Theme discovery with metadata parsing (author, colors, light/dark mode)
37
44
  - Background support as part of themes
45
+ - **15 bundled themes**: catppuccin, ethereal, everforest, flexoki, gruvbox, hackerman, kanagawa, matte-black, nord, orng, osaka-jade, ristretto, rose-pine, tokyo-night, vesper
38
46
  - **Hook support** for custom scripts on theme change (wallpaper, notifications, etc.)
39
47
 
40
48
  ### **Interactive TUI**
@@ -82,15 +90,18 @@ FormalConf expects your configuration files in `~/.config/formalconf/`:
82
90
 
83
91
  ```
84
92
  ~/.config/formalconf/
85
- ├── configs/ # Your dotfile packages (stow directories)
86
- ├── nvim/ # Example: Neovim config
87
- ├── tmux/ # Example: tmux config
88
- │ └── ...
89
- ├── themes/ # Omarchy-compatible themes
93
+ ├── configs/ # Stow packages (aerospace, btop, fish, ghostty, git, hypr, neovim, tmux, waybar...)
94
+ ├── themes/ # JSON theme files
95
+ ├── templates/ # Template files for app configs
96
+ ├── generated/ # Auto-generated theme configs
97
+ ├── current/ # Symlinked current theme
98
+ │ ├── theme/ # Generated theme files
99
+ │ └── backgrounds/ # Theme wallpapers
90
100
  ├── hooks/ # Event hook scripts
91
101
  │ └── theme-change/ # Scripts run after theme changes
92
102
  ├── pkg-config.json # Package sync configuration
93
- └── pkg-lock.json # Package version lockfile
103
+ ├── pkg-lock.json # Package version lockfile
104
+ └── theme-config.json # Device/default theme mapping
94
105
  ```
95
106
 
96
107
  ### Dotfile Configs
@@ -109,26 +120,129 @@ When stowed, this creates: `~/.config/nvim/init.lua`
109
120
 
110
121
  ### Package Config
111
122
 
112
- Define your packages in `pkg-config.json`:
123
+ Define your packages in `pkg-config.json` (version 2 format with cross-platform support):
113
124
 
114
125
  ```json
115
126
  {
127
+ "version": 2,
116
128
  "config": {
117
129
  "purge": false,
130
+ "purgeInteractive": true,
118
131
  "autoUpdate": true
119
132
  },
120
- "taps": ["oven-sh/bun"],
121
- "packages": ["neovim", "tmux", "ripgrep"],
122
- "casks": ["ghostty", "raycast"],
123
- "mas": {
124
- "Xcode": 497799835
133
+ "global": {
134
+ "packages": ["bat", "btop", "neovim", "ripgrep", "tmux", "yazi"],
135
+ "cargo": ["lumen"]
136
+ },
137
+ "macos": {
138
+ "taps": ["oven-sh/bun"],
139
+ "formulas": ["gh", "node", "rust"],
140
+ "casks": ["ghostty", "raycast"],
141
+ "mas": { "Xcode": 497799835 }
142
+ },
143
+ "archlinux": {
144
+ "pacman": ["hyprland", "waybar", "ghostty"],
145
+ "aur": ["hyprlauncher"]
146
+ }
147
+ }
148
+ ```
149
+
150
+ ### Theme Format
151
+
152
+ FormalConf uses JSON-based themes with a template engine for generating application configs. Place theme files in `~/.config/formalconf/themes/`:
153
+
154
+ ```json
155
+ {
156
+ "title": "Catppuccin",
157
+ "description": "Soothing pastel theme for the high-spirited",
158
+ "author": "Catppuccin Org",
159
+ "version": "1.0.0",
160
+ "source": "https://github.com/catppuccin/catppuccin",
161
+ "dark": {
162
+ "color0": "#45475a",
163
+ "color1": "#f38ba8",
164
+ "background": "#1e1e2e",
165
+ "foreground": "#cdd6f4",
166
+ "cursor": "#f5e0dc",
167
+ "selection_background": "#45475a",
168
+ "accent": "#cba6f7",
169
+ "border": "#313244"
170
+ },
171
+ "light": { /* same structure with light colors */ },
172
+ "neovim": {
173
+ "repo": "catppuccin/nvim",
174
+ "colorscheme": "catppuccin-mocha",
175
+ "light_colorscheme": "catppuccin-latte"
125
176
  }
126
177
  }
127
178
  ```
128
179
 
129
- ### Theme Compatibility
180
+ ### Templates
181
+
182
+ FormalConf ships with default templates for popular applications, but you can create your own or customize existing ones. Templates live in `~/.config/formalconf/templates/` and use a simple variable syntax:
183
+
184
+ ```toml
185
+ # Example: ~/.config/formalconf/templates/alacritty.toml.template
186
+ [colors.primary]
187
+ background = "{{background}}"
188
+ foreground = "{{foreground}}"
189
+
190
+ [colors.cursor]
191
+ cursor = "{{cursor}}"
192
+
193
+ [colors.normal]
194
+ black = "{{color0}}"
195
+ red = "{{color1}}"
196
+ green = "{{color2}}"
197
+ # ... etc
198
+ ```
199
+
200
+ **Template variables** are replaced with colors from the active theme's JSON. Available variables include:
201
+ - `{{background}}`, `{{foreground}}`, `{{cursor}}`, `{{accent}}`, `{{border}}`
202
+ - `{{color0}}` through `{{color15}}` (terminal palette)
203
+ - `{{selection_background}}`, `{{selection_foreground}}`
204
+
205
+ **Color modifiers** can transform colors: `{{background|lighten:10}}`, `{{accent|darken:20}}`, `{{color1|alpha:0.8}}`
206
+
207
+ **Conditionals** allow optional sections based on theme properties:
208
+
209
+ ```lua
210
+ -- Example: ~/.config/formalconf/templates/neovim.lua.template
211
+ return {
212
+ {
213
+ "{{dark.neovim.repo}}",
214
+ name = "formalconf-colorscheme",
215
+ priority = 1000,
216
+ },
217
+ {
218
+ "LazyVim/LazyVim",
219
+ opts = {
220
+ colorscheme = "{{dark.neovim.colorscheme}}",
221
+ },
222
+ },
223
+ {{#if dark.neovim.light_colorscheme}}
224
+ {
225
+ "f-person/auto-dark-mode.nvim",
226
+ opts = {
227
+ set_dark_mode = function()
228
+ vim.cmd("colorscheme {{dark.neovim.colorscheme}}")
229
+ end,
230
+ set_light_mode = function()
231
+ vim.cmd("colorscheme {{dark.neovim.light_colorscheme}}")
232
+ end,
233
+ },
234
+ },
235
+ {{/if}}
236
+ }
237
+ ```
238
+
239
+ The `{{#if property}}...{{/if}}` block is only included when the property exists in the theme JSON.
240
+
241
+ **Template modes:**
242
+ - **Single-mode** (`app.conf.template`) - One template for both variants
243
+ - **Partial-mode** (`app-dark.conf.template` + `app-light.conf.template`) - Separate templates per variant
130
244
 
131
- FormalConf supports [Omarchy themes](https://learn.omacom.io/2/the-omarchy-manual/52/themes). Place themes in `~/.config/formalconf/themes/` following the Omarchy theme structure.
245
+ Run `bun run theme --install-templates` to install the default templates, then modify them as needed. Your customizations are preserved across updates.
132
246
 
133
247
  ### Theme Hooks
134
248
 
@@ -139,14 +253,19 @@ Run custom scripts when a theme is applied. Useful for setting wallpapers, sendi
139
253
  mkdir -p ~/.config/formalconf/hooks/theme-change
140
254
  ```
141
255
 
142
- **Example hook** (`~/.config/formalconf/hooks/theme-change/set-wallpaper.sh`):
256
+ **Example hook** (`~/.config/formalconf/hooks/theme-change/wallpaper.sh`):
143
257
  ```bash
144
- #!/bin/bash
145
- echo "Theme changed to: $FORMALCONF_THEME"
146
- # Set wallpaper from theme's backgrounds directory
147
- if [ -d "$FORMALCONF_THEME_DIR/backgrounds" ]; then
148
- osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"$FORMALCONF_THEME_DIR/backgrounds/wallpaper.jpg\""
149
- fi
258
+ #!/usr/bin/env bash
259
+ BACKGROUNDS_DIR="$HOME/.config/formalconf/current/backgrounds"
260
+ mapfile -t FILES < <(find -L "$BACKGROUNDS_DIR" -maxdepth 1 -type f 2>/dev/null)
261
+ [[ ${#FILES[@]} -eq 0 ]] && exit 0
262
+ RANDOM_IDX=$((RANDOM % ${#FILES[@]}))
263
+ WALLPAPER="${FILES[$RANDOM_IDX]}"
264
+
265
+ case "$(uname -s)" in
266
+ Darwin) osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"$WALLPAPER\"" ;;
267
+ Linux) swww img "$WALLPAPER" --transition-type center --transition-duration 0.8 ;;
268
+ esac
150
269
  ```
151
270
 
152
271
  Make executable: `chmod +x ~/.config/formalconf/hooks/theme-change/set-wallpaper.sh`
@@ -167,12 +286,16 @@ Scripts run in alphabetical order. Failed hooks don't prevent theme application.
167
286
  ### Commands
168
287
 
169
288
  ```bash
170
- bun run formalconf # Launch interactive TUI
171
- bun run config <cmd> # Config management (stow, unstow, status, list, stow-all, unstow-all)
172
- bun run pkg-sync # Sync packages from pkg-config.json
173
- bun run pkg-sync --purge # Sync and remove unlisted packages
174
- bun run theme <name> # Apply a theme
175
- bun run typecheck # Run TypeScript type checking
289
+ bun run formalconf # Launch interactive TUI
290
+ bun run config <cmd> # Config management (stow, unstow, status, list, stow-all, unstow-all)
291
+ bun run pkg-sync # Sync packages from pkg-config.json
292
+ bun run pkg-sync --purge # Sync and remove unlisted packages
293
+ bun run pkg-lock # Generate/update package lockfile
294
+ bun run theme <name>:<variant> # Apply a theme (e.g., catppuccin:dark, tokyo-night:light)
295
+ bun run theme --install-templates # Install/update default templates
296
+ bun run theme --template-status # Check template versions
297
+ bun run theme --migrate <name> # Migrate legacy theme to JSON format
298
+ bun run typecheck # Run TypeScript type checking
176
299
  ```
177
300
 
178
301
  ### Project Structure
@@ -203,8 +326,8 @@ src/
203
326
  FormalConf combines three systems into a unified TUI:
204
327
 
205
328
  1. **Configuration Manager** - Wraps GNU Stow for symlink-based dotfile management
206
- 2. **Package Sync** - Orchestrates Homebrew and Mac App Store package synchronization
207
- 3. **Theme Switcher** - Manages Omarchy-compatible themes via symlinks
329
+ 2. **Package Sync** - Orchestrates cross-platform package synchronization (Homebrew, Pacman, APT, DNF, Flatpak, Cargo)
330
+ 3. **Theme Switcher** - Manages JSON themes via template engine
208
331
 
209
332
  ### Key Concepts
210
333
 
@@ -225,8 +348,8 @@ FormalConf combines three systems into a unified TUI:
225
348
  | **UI Framework** | Ink, React |
226
349
  | **Language** | TypeScript |
227
350
  | **Config Management** | GNU Stow |
228
- | **Package Management** | Homebrew, mas |
229
- | **Theme Format** | Omarchy-compatible |
351
+ | **Package Management** | Homebrew, mas, Pacman, AUR, APT, DNF, Flatpak, Cargo |
352
+ | **Theme Format** | JSON + Templates |
230
353
 
231
354
  </div>
232
355
 
@@ -260,7 +383,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
260
383
 
261
384
  - Symlink management powered by [GNU Stow](https://www.gnu.org/software/stow/)
262
385
  - Terminal UI built with [Ink](https://github.com/vadimdemedes/ink)
263
- - Theme format compatible with [Omarchy](https://learn.omacom.io/2/the-omarchy-manual/52/themes)
264
386
 
265
387
  ---
266
388