CHEST System Reference
Complete reference guide covering cross-platform installation, sorting grammar, high-speed fuzzy search, transaction rollbacks, and out-of-process RPC plugins.
Installation
Option 1: Go Install (Recommended)
Compiles directly from the official Go module proxy into your local toolchain:
$ go install github.com/Aswanidev-vs/chest/cmd/chest@latest
Ensure your GOBIN directory (typically ~/go/bin on Unix or %USERPROFILE%\go\bin on Windows) is present in your system PATH.
Option 2: Automated Linux & macOS One-Liner
Downloads and runs the automated bash installation script:
$ curl -sSL https://raw.githubusercontent.com/Aswanidev-vs/chest/main/install.sh | bash
Checks your local Go environment, builds from source, executes a self-test sanity check, and reports your PATH configuration.
Option 3: Automated Windows PowerShell
Downloads and executes the native PowerShell script (PowerShell 5.1+ or PowerShell 7+):
> irm https://raw.githubusercontent.com/Aswanidev-vs/chest/main/install.ps1 | iex
Option 4: Build from Source
Clone the repository and compile using Make or Go:
$ git clone https://github.com/Aswanidev-vs/chest.git
$ cd chest
$ make build
Quick Start
Test sorting your Downloads directory with a safe dry-run (no files are touched):
$ chest sort ~/Downloads -p downloads --dry-run
Apply the plan once satisfied:
$ chest sort ~/Downloads -p downloads
Accidentally sorted the wrong folder? Instantly revert all moved files to their exact previous paths:
$ chest undo
Architecture & Guarantees
CHEST is architected as four decoupled subsystems:
| Subsystem | Underlying Engine | Responsibility |
|---|---|---|
| Scanner | fastwalk concurrency |
Multi-threaded recursive directory traversal with exclusion filters and OS-agnostic hidden file logic. |
| Scorer | fzf/src/algo FuzzyMatchV2 |
Microsecond scoring of filenames, extensions, and content grep matching. |
| Planner | Directed Move Graph | Collision detection and transactional history logging to ~/.chest/history.db. |
| Storage Index | Embedded Pure-Go SQLite | Metadata caching, duplicate hashing, and storage intelligence at ~/.chest/index.db. |
Command Reference
chest sort
Organizes target directory according to preset rules or custom conditions.
| Flag | Type | Description |
|---|---|---|
| -p, --preset | string | Built-in rule bundle: downloads, media, developer, documents, photos. |
| -n, --dry-run | boolean | Simulate organization without moving any files. |
| --rule | string | Custom predicate rule: "type=image && size>10MB -> HighRes/". |
| -y, --yes | boolean | Skip interactive confirmation prompt and execute immediately. |
| -i, --into | string | Override destination root directory. |
| --allow-system | boolean | Bypass system path protection guard. Required when targeting OS-level directories (e.g. C:\Windows, /usr). Use with extreme caution. |
chest search
Ultra-fast filesystem search using fastwalk for parallel multi-core directory traversal and the fzf algorithm for scoring. Patterns match fuzzily by default (switch to exact substring with -x or regular expressions with -r), and filters can be freely combined: file category, extension, size, modification date, and streaming content grep that reports line numbers and snippets. Results are color-coded by category, or emitted as JSON for scripting.
$ chest search "movie" # Fuzzy filename search (default mode)
$ chest search --type video --size ">1GB" # Combine category + size filters
$ chest search -e pdf,docx -m "<30d" ~/Documents
$ chest search -c "TODO" internal/ # Grep inside files, with line numbers
$ chest search -e go,md -i chest -j # JSON output for scripting
| Flag | Type | Description |
|---|---|---|
| [pattern] [path] | arguments | Filename/path pattern to match, and the root directory to traverse (default .). |
| -t, --type | string | Filter by category: image, video, document, audio, code, archive, etc. Plugin-registered categories are included too. |
| -e, --ext | string | Filter by comma-separated extensions: pdf,docx,xlsx. |
| -s, --size | string | Size condition: >100MB, <10KB, >=1GB, =5MB. |
| -m, --modified | string | Modification time condition: >30d (newer than), <7d (older than), or a calendar date like 2026-01-01. |
| -c, --content | string | Grep inside file contents for matching string; returns line number and snippet. |
| -i, --ignore-case | boolean | Case-insensitive matching. Enabled by default. |
| -r, --regex | boolean | Treat the pattern as a regular expression instead of fuzzy text. |
| -x, --exact | boolean | Exact substring matching instead of fuzzy ranking. |
| -H, --hidden | boolean | Include hidden files and folders in the traversal. |
| -l, --limit | int | Stop after returning n matches. |
| -j, --json | boolean | Output matches in structured JSON format for scripting. |
chest watch
Background daemon monitoring real-time filesystem changes using fsnotify. New files are sorted as they arrive, folder creations and removals are reported instantly, and --initial sorts files that are already present before watching begins.
$ chest watch ~/Downloads --preset media --debounce 500ms
$ chest watch ~/Desktop --initial # Sort existing files first, then watch
| Flag | Type | Description |
|---|---|---|
| -p, --preset | string | Rule bundle: downloads, media, developer, documents, photos. |
| --debounce | duration | Wait interval before sorting a newly created file. Default 500ms. |
| -i, --initial | boolean | Sort files already present in the folder first, then keep watching for new ones. |
| --allow-system | boolean | Bypass system path protection when watching OS-level directories. |
chest undo & history
Inspect previous operations or rollback a batch of moves:
$ chest history # Display recorded operation history
$ chest undo # Undo the most recent run
$ chest undo 4 # Undo specific transaction by ID
| Flag | Type | Description |
|---|---|---|
| --allow-system | boolean | Bypass system path guard when undoing into protected OS directories. |
chest index & clean
Index file paths and hashes into SQLite for fast duplicate discovery. Indexing is incremental (unchanged files are skipped), runs in parallel across CPU cores, and shows a live progress bar:
$ chest index ~/Documents --hash # Incremental parallel SHA-256 with progress bar
$ chest clean # Prune deleted files from local index
$ chest clean --all # Reset index database completely
$ chest clean --history # Also wipe undo history (~/.chest/history.json)
stats, duplicates & analyze
Storage intelligence commands — duplicate detection re-verifies hashes and supports --except to prune noisy directories:
$ chest stats ~/Projects # Category and size breakdown
$ chest duplicates ~/Downloads # Locate byte-for-byte duplicates
$ chest duplicates ~/Projects --except node_modules,venv # Skip noisy dirs
$ chest analyze ~/Documents # Find zero-byte files and stale items (>180 days); footer shows total run time
man, preset & version
$ chest man sort # View built-in Unix man page for command
$ chest preset # List all built-in rulesets
$ chest version # Print binary version, commit, and platform
chest completion
Installs shell tab-completion so your shell autocompletes chest subcommands and flags — type chest s and press Tab to complete to sort. The recommended setup is a single command; it detects your shell from $SHELL, writes the script to the standard location for that shell, and wires it into your shell's startup file so completion loads in every new terminal.
$ chest completion --install # Detect your shell, install, and wire it up (recommended)
$ chest completion zsh --install # Install zsh completion permanently
$ chest completion fish --install # Install fish completion permanently
$ chest completion bash > _chest # Print the raw script to stdout instead
| Flag | Type | Description |
|---|---|---|
| [shell] | argument | Target shell: bash, zsh, or fish. Optional with --install (auto-detected from $SHELL). |
| -i, --install | boolean | Detect your shell (or use the shell argument) and install completion permanently, wiring it into your shell profile. |
| -o, --output <file> | string | Write the completion script to this file instead of stdout. |
| -s, --shell <name> | string | Shell to generate for: bash, zsh, fish. |
Plugin Architecture & Guide
go-plugin over RPC. Plugins execute in independent operating system processes. A bug or panic in a plugin will not affect CHEST core.
Plugin Structure
A plugin consists of an executable binary and a manifest file (manifest.json or manifest.toml) placed in ~/.chest/plugins/<name>/.
sort, watch, undo) targeting system directories like C:\Windows, /usr, /etc, or drive roots. Use --allow-system to override with an interactive confirmation.
Building a Sample Plugin
1. Initialize project
$ mkdir chest-custom-plugin
$ cd chest-custom-plugin
$ go mod init chest-custom-plugin
2. Implement plugin logic (main.go)
package main
import (
"strings"
hplugin "github.com/hashicorp/go-plugin"
"github.com/Aswanidev-vs/chest/internal/plugin"
)
type CustomClassifier struct{}
func (c *CustomClassifier) GetInfo() (plugin.Manifest, error) {
return plugin.Manifest{
Name: "custom-filter",
Version: "1.0.0",
Description: "Classifies custom test files",
Capabilities: []string{"classifier"},
Binary: "custom-filter",
}, nil
}
func (c *CustomClassifier) Classify(name string, ext string) (string, error) {
if strings.HasSuffix(name, ".spec.ts") {
return "UnitTests", nil
}
return "Other", nil
}
func main() {
hplugin.Serve(&hplugin.ServeConfig{
HandshakeConfig: plugin.HandshakeConfig,
Plugins: map[string]hplugin.Plugin{
"classifier": &plugin.ClassifierPluginRPC{Impl: &CustomClassifier{}},
},
})
}
3. Define manifest (JSON or TOML)
CHEST discovers either manifest.json or manifest.toml. Use whichever you prefer:
manifest.json
{
"name": "custom-filter",
"version": "1.0.0",
"description": "Classifies custom test files",
"author": "Developer",
"capabilities": ["classifier"],
"binary": "custom-filter"
}
manifest.toml
name = "custom-filter"
version = "1.0.0"
description = "Classifies custom test files"
author = "Developer"
capabilities = ["classifier"]
binary = "custom-filter"
4. Build and install
$ go build -o custom-filter .
$ chest plugin install .
Plugin CLI Management
$ chest plugin install . # Install plugin from local folder
$ chest plugin list # List installed plugins
$ chest plugin info <name> # View plugin metadata
$ chest plugin remove <name> # Uninstall a plugin