Skip to content

Usage

Codify is designed around two main commands (plan and apply) and a codify.json configuration file. codify plan first reads the file to determine what the final state should be. The plan command then does a query of what is currently installed/configured on the system in order to generate a plan of how to reach the desired state. codify apply then applies the changes listed in the plan onto the system.

Commands

  • plan: Generates a list of changes to meet the desired config. Dy default, plan does not store state and cannot destroy resources. This allows plan to be used without maintaining a state file or requiring resources to be imported. Use codify destroy to uninstall resources. Plan can only be called in a directory with a codify.json file.
  • apply: Run a codify plan and offer the option to apply the generated plan.
  • destroy: Similar to apply but this command will attempt to destroy the listed resources. A confirmation and a plan of the list of changes will be shown.
  • import: Generates Codify configs based on what is currently on the system. This command basically does the opposite of apply.

Codify.json

The codify.json file contains the desired state that the system should be in. Users can declare which resources (a program, tool or setting) need to be installed and how. The codify.json file is made up of a top level array and then resources are declared as objects within the array. Each resource must contain the required type keyword which specifies the type (or id) of the resource. Yaml is also supported for the configuration file. In most popular IDEs (that support schemastore), auto-complete should be automatically loaded for codify.json files.

See codify.json for more information.

[
{
"type": "homebrew",
"formulae": ["jq"]
},
{
"type": "vscode"
}
]

Modes

Stateless Mode

Stateless mode is the default mode for Codify. In stateless mode, packages can only be installed and modified but not uninstalled. Existing packages do not need to be imported into Codify in stateless mode and no state files are generated. When running codify apply in stateless mode, Codify will only modify existing packages to match the desired config or install new ones. If a package already exists and matches the desired config, it will be excluded from the plan.

Stateful Mode

Not released yet.

Stateful mode will allow users to manage every dependency on their system. Using stateful mode, Codify will attempt to delete packages that are removed from codify.json. Stateful mode is meant to be used as an application manager.