OCD Dev Log #001

Organize current dotfiles

OCD Dev Log #001

21 April 2025

by Jason Pena

Future Codebase Design

Need to implement format preserving cluster definition parser. I will need to use the toml_edit crate to do this. Right now for the initial setup of the project I am following the advice of Rain’s Rust CLI Recommendations for the initial design of the project’s codebase.

I will be putting all core logic inside the src/lib.rs file such that only the CLI and error handling code will be exposed to main. The model module will contain the logic for cluster definition parsing.

Cluster Definition Format

The following represents the basic layout for the cluster definition, i.e., the file that resides in $XDG_CONFIG_HOME/ocd/cluster.toml:

dir_alias = "$HOME/some/path"               # Optional field
excluded = ["rule1", "rule2", "rule3", ...] # Optional field

[nodes.node1]
deployment = "normal"                        # Mandatory field
url = "https://some/url"                     # Mandatory field
excluded = ["rule1", "rule2", "rule3", ...]  # Optional field
dependencies = ["dep1", "dep2", "dep3", ...] # Optional field

[nodes.node2]
deployment = { kind = "bare_alias", dir_alias = "$HOME/some/path" }
url = "https://some/url"

[nodes.node_n]
deployment = "bare_alias"

If cluster definition does not define dir_alias field for root table, then it will default to $XDG_CONFIG_HOME/ocd as its path. If a given node simply uses deployment = "bare_alias" then the directory alias will be set to $HOME as the default.

Format preservation in this case refers to the preservation of whitespace and comments for any addition or removal of node entries in the cluster definition. For now, replacement of existing node entries do not need to preserve formatting.