name: add-package description: Add a package to chezmoi packages.yaml. Asks which package, install method, and profile tier before making the change.
Add Package to packages.yaml
You are adding a package to the chezmoi package manifest at .chezmoidata/packages.yaml.
Process
If the user provided a package name, use it. Otherwise, ask the user what package they want to add.
Read
.chezmoidata/packages.yamlto understand the current structure and existing packages.Ask the user the following:
Question 1 - Tier: Which tier should this package go in?
shared— installed on all machines regardless of profilepersonal— only on personal machineswork— only on work machines
Question 2 - Install method: How should the package be installed?
brew formula— Homebrew formula (CLI tool)brew cask— Homebrew cask (GUI app or large binary)brew tap + formula— Needs a custom tap first (ask for tap name as follow-up)npm— npm global package
If the user picks "brew tap + formula", ask a follow-up for the tap name (e.g.
redis/redis).Edit
.chezmoidata/packages.yamlto add the package in the correct location:- shared + brew formula → under
packages.shared.brews.formulae - shared + brew cask → under
packages.shared.brews.casks - shared + npm → under
packages.shared.npm - profile + brew formula → under
packages.profiles.<profile>.brews.formulae - profile + brew cask → under
packages.profiles.<profile>.brews.casks - profile + brew tap → add tap under
packages.profiles.<profile>.brews.tapsAND formula underpackages.profiles.<profile>.brews.formulae - profile + npm → under
packages.profiles.<profile>.npm
- shared + brew formula → under
Add the package in alphabetical order within its list. Do not reorder existing entries.
After editing, show the user the diff of what changed.