mauvehed's dotfiles for personal and work environments
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: enhance README and usage documentation for various tools, including 1Password, AWS, Docker, Git, GitHub, Go, Kubernetes, Python, Terraform, and VS Code; remove outdated files and improve terminal setup instructions

mauvehed 6d21a9a4 425a73ad

+1748 -536
+28 -15
README.md
··· 4 4 5 5 My collection of my dotfiles used across multiple systems and managed by [chezmoi](https://www.github.com/twpayne/chezmoi). 6 6 7 + ## Core Prerequisite 8 + 9 + To get started, you primarily need a shell environment with `curl` or `wget` to download and execute the `chezmoi` installation script. 10 + 7 11 ## Quick Start 12 + 13 + The following command will download and install `chezmoi` (if not already present), initialize it with this dotfiles repository, and apply the configuration. This process will also install and configure other necessary tools such as Homebrew, Zsh, oh-my-zsh, oh-my-posh, and the 1Password CLI. 8 14 9 15 ```sh 10 16 sh -c "$(curl -fsSL get.chezmoi.io)" -- init --apply mauvehed 11 17 ``` 12 18 13 - Personal secrets are stored in [1Password](https://1password.com) and you'll 14 - need the [1Password CLI](https://developer.1password.com/docs/cli/) installed. 19 + ### 1Password Integration 15 20 16 - After installation or major changes you may need to relogin to 1Password with: 21 + Personal secrets are stored in [1Password](https://1password.com). The `chezmoi` setup will install the [1Password CLI](https://developer.1password.com/docs/cli/). 17 22 18 - ```sh 19 - eval $(op signin) 20 - ``` 23 + 1. **After the initial `chezmoi apply` completes**, you must sign in to the 1Password CLI: 24 + ```sh 25 + eval $(op signin) 26 + ``` 27 + 2. **Re-apply `chezmoi` (if needed)**: If the initial `chezmoi apply` could not fully provision all configurations due to 1Password not being authenticated, run the apply command again after signing in: 28 + ```sh 29 + chezmoi apply 30 + ``` 31 + 32 + ## Tools Managed by These Dotfiles 21 33 22 - ## Tools Used 34 + These dotfiles, through `chezmoi`, will install and manage the following tools and configurations on your system: 23 35 24 - | Name | Description | Required | 25 - | ---- | ----------- | -------- | 26 - | Terminal | [iTerm2](https://iterm2.com) | No | 27 - | Package manager | [homebrew](https://brew.sh/) | Yes | 28 - | Shell | [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH) | Yes | 29 - | oh-my-posh | [oh-my-posh](https://ohmyposh.dev) | Yes | 30 - | Dotfiles manager | [chezmoi](https://chezmoi.io/) | Yes | 31 - | Password Manager | [1password](https://www.1password.com/) | Yes | 36 + | Name | Description | Managed | 37 + | ------------------- | ------------------------------------------------- | -------- | 38 + | Terminal | [iTerm2](https://iterm2.com) (macOS) | Optional | 39 + | Package manager | [Homebrew](https://brew.sh/) | Yes | 40 + | Shell | [Zsh](https://www.zsh.org/) | Yes | 41 + | Shell Framework | [oh-my-zsh](https://ohmyzsh.org/) | Yes | 42 + | Shell Prompt Customizer | [oh-my-posh](https://ohmyposh.dev) | Yes | 43 + | Dotfiles manager | [chezmoi](https://chezmoi.io/) | Yes | 44 + | Password Manager CLI| [1Password CLI](https://www.1password.com/) | Yes | 32 45 33 46 ## Command Reference 34 47
+73
docs/1password-usage.md
··· 1 + # 1Password Usage 2 + 3 + This document outlines how the [1Password CLI](https://developer.1password.com/docs/cli/) is integrated with `chezmoi` for managing secrets and sensitive configuration data in this dotfiles setup. 4 + 5 + ## Overview 6 + 7 + 1Password is the primary secrets manager for this dotfiles configuration. `chezmoi` is configured to use the 1Password CLI (`op`) to fetch secrets, which are then injected into configuration files via templates. 8 + 9 + ## Prerequisites 10 + 11 + 1. **1Password Account**: You need an active 1Password account. 12 + 2. **1Password CLI Installed**: The `chezmoi` quick start process (see main `README.md`) handles the installation of the `op` CLI tool. 13 + 3. **Initial Sign-in**: As detailed in the main `README.md`, after the initial `chezmoi apply`, you must sign in to the 1Password CLI: 14 + ```sh 15 + eval $(op signin) 16 + ``` 17 + You may need to run `chezmoi apply` again after this initial sign-in if some secrets were not provisioned. 18 + 19 + ## Storing and Referencing Secrets with Chezmoi 20 + 21 + `chezmoi` utilizes its template functions to interact with the `op` CLI. Secrets are stored in your 1Password vaults, and `chezmoi` templates reference them, typically using the `onepassword` template function or by directly calling `op`. 22 + 23 + ### General Approach 24 + 25 + 1. **Store Secret in 1Password**: Add your secret (e.g., API key, token, password) to your 1Password vault. 26 + * Use clear, consistent item names. 27 + * For multi-field items, note the field names you want to retrieve. 28 + 2. **Reference in Chezmoi Template**: In your `chezmoi` template file (e.g., `private_dot_config/some_app/config.toml.tmpl`), use a `chezmoi` template function to fetch the secret. 29 + 30 + ### Example: Storing an API Key 31 + 32 + * **In 1Password**: 33 + * Create a "Login" or "API Credential" item named, for example, `My App API Key`. 34 + * Store the API key in the `password` field or a custom field. 35 + * **In `chezmoi` template**: 36 + ```toml 37 + # Example: .config/my_app/credentials.tmpl 38 + # api_key = "{{ (onepasswordRead "op://Personal/My App API Key/password").stdout }}" 39 + ``` 40 + *(Note: The exact `onepasswordRead` syntax or alternative `op` calls might vary based on your specific `chezmoi` helper functions or direct CLI usage in templates.)* 41 + 42 + ### Storing GPG Git Signing Key ID 43 + 44 + To securely store and retrieve your GPG key ID for Git commit signing: 45 + 46 + 1. **In 1Password**: 47 + * Create a "Secure Note" or "Login" item, perhaps named `Git Configuration` or `My GPG Key`. 48 + * Add a custom field (e.g., named `git_signingkey_id`) and paste your GPG key ID into its value. 49 + 2. **In `chezmoi` template (e.g., `dot_gitconfig.tmpl`):** 50 + ```gitconfig 51 + # Example for .gitconfig.tmpl 52 + [user] 53 + name = {{ .name | quote }} 54 + email = {{ .email | quote }} 55 + # signingkey = "{{ (onepasswordRead "op://Personal/Git Configuration/git_signingkey_id").stdout }}" 56 + ``` 57 + *(Adjust the item name and path as per your 1Password setup.)* 58 + 59 + ## Common `chezmoi` Template Functions for 1Password 60 + 61 + *(This section can be expanded with specific examples of `onepassword` functions or custom `op` CLI wrappers you use in your templates.)* 62 + 63 + * `onepassword "item_name"` 64 + * `onepasswordDetails "item_name"` 65 + * `onepasswordRead "op_item_path"` (e.g., `op://Vault/ItemName/fieldname`) 66 + 67 + Refer to your `chezmoi` configuration and the official `chezmoi` documentation for the exact functions and syntax available and preferred in your setup. 68 + 69 + ## Troubleshooting 70 + 71 + * **Authentication Issues**: Ensure `eval $(op signin)` has been run and your session is active. 72 + * **Item Paths**: Double-check the 1Password item names, vault names, and field names used in your templates. The `op item get "Item Name" --fields label="Field Name"` command can be useful for verifying. 73 + * **Chezmoi Apply**: Remember to run `chezmoi apply` to propagate changes after updating templates or 1Password items.
-112
docs/DEPLOY.md
··· 1 - # dotfiles 2 - 3 - >This document is out of date/old and was a manual install process. Please follow the directions in [Chezmoi README](../README.md) instead of using this document. 4 - > 5 - >I am keeping this for historical reference in case I need any steps from here. 6 - 7 - ## Linux 8 - 9 - Follow [Chezmoi README](../README.md) 10 - 11 - ## MacOS 12 - 13 - Mostly follows [this guide](https://blog.larsbehrenberg.com/the-definitive-iterm2-and-oh-my-zsh-setup-on-macos) 14 - 15 - ### Homebrew 16 - 17 - ```sh 18 - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 19 - ``` 20 - 21 - ### iTerm2 or Warp.dev 22 - 23 - `https://app.warp.dev/download` 24 - 25 - `brew cask install iterm2` or [download](https://iterm2.com/downloads.html) 26 - 27 - ### oh-my-zsh 28 - 29 - ```sh 30 - brew install zsh && sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 31 - ``` 32 - 33 - #### ohmyzsh theme 34 - 35 - ```sh 36 - git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k 37 - ``` 38 - 39 - ##### Install fonts/fix things 40 - 41 - ```sh 42 - p10k configure 43 - ``` 44 - 45 - ### YouTube Music Desktop App 46 - 47 - ```sh 48 - brew install --cask ytmdesktop-youtube-music 49 - ``` 50 - 51 - ### Setup TMUX 52 - 53 - Install TMUX PLugin Manager 54 - 55 - ```sh 56 - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 57 - ``` 58 - 59 - #### Fetch updated tpm module (fixes error) 60 - 61 - `` 62 - 63 - #### Install plugins from tmux.conf 64 - 65 - ```sh 66 - run ^b-I inside tmux session 67 - ``` 68 - 69 - ### Enable fingerprint auth for sudo on macOS 70 - 71 - ```bash 72 - #!/bin/bash 73 - # 74 - # credit to machupicchubeta/dotfiles/bin/enable_to_sudo_authenticate_with_touch_id.sh 75 - set -eu 76 - set -o pipefail 77 - 78 - sudo chmod +w /etc/pam.d/sudo 79 - if ! grep -Eq '^auth\s.*\spam_tid\.so$' /etc/pam.d/sudo; then 80 - ( set -e; set -o pipefail 81 - # Add "pam_tid.so" to a first authentication 82 - pam_sudo=$(awk 'fixed||!/^auth /{print} !fixed&&/^auth/{print "auth sufficient pam_tid.so";print;fixed=1}' /etc/pam.d/sudo) 83 - sudo tee /etc/pam.d/sudo <<<"$pam_sudo" 84 - ) 85 - fi 86 - ``` 87 - 88 - ## pyenv (& friends) 89 - 90 - Adopted from <https://realpython.com/intro-to-pyenv/> 91 - 92 - ### macOS 93 - 94 - ```sh 95 - brew install openssl readline sqlite3 xz zlib exa asdf fzf zoxide 96 - ``` 97 - 98 - ```sh 99 - npm install -g opencommit 100 - ``` 101 - 102 - ```sh 103 - curl https://pyenv.run | bash 104 - ``` 105 - 106 - ```sh 107 - source ~/.zshrc 108 - ``` 109 - 110 - ```sh 111 - python install <go find the latest from python.org> 112 - ```
+23 -54
docs/README.md
··· 1 - # dotfiles & config management 1 + # Dotfiles Documentation 2 2 3 - mauveFILES for personal and work systems running macOS or Linux 3 + Welcome to the documentation for this `dotfiles` collection. This section provides detailed information on various tools, configurations, and processes used. 4 4 5 - ## quick start 5 + ## Table of Contents 6 6 7 - ```sh 8 - sh -c "$(curl -fsSL get.chezmoi.io)" -- init --apply mauvehed 9 - ``` 7 + Below is a list of available documents. Please refer to them for specific usage instructions and notes. 10 8 11 - ## quick commands 9 + * **[1Password Usage](./1password-usage.md)**: How 1Password CLI is used with `chezmoi` for secret management. 10 + * **[AWS Usage](./aws-usage.md)**: Notes and common commands for interacting with AWS. 11 + * **[Chezmoi Usage](./chezmoi-usage.md)**: In-depth details about `chezmoi` setup, template functions, and advanced usage. 12 + * **[CLI Usage](./cli-usage.md)**: Information about various command-line interface tools and utilities. 13 + * **[Corporate Apps Usage](./corporate-apps-usage.md)**: Notes on configuring and using corporate-specific applications. 14 + * **[DEPLOY](./DEPLOY.md)**: Historical manual deployment instructions. **Note: This document is outdated. For current deployment, follow the `chezmoi` instructions in the main [project README](../README.md).** 15 + * **[Docker Usage](./docker-usage.md)**: Tips and configurations related to Docker. 16 + * **[Git Usage](./git-usage.md)**: Detailed Git workflows, aliases, and configurations. 17 + * **[GitHub Usage](./github-usage.md)**: Notes on GitHub-specific configurations or workflows. 18 + * **[Go Usage](./go-usage.md)**: Go programming language setup and environment. 19 + * **[Kubernetes Usage](./kubernetes-usage.md)**: Kubernetes (k8s) setup, aliases, and common commands. 20 + * **[Python Usage](./python-usage.md)**: Python environment setup and project notes. 21 + * **[System Usage](./system-usage.md)**: General system-level configurations and macOS/Linux specific notes. 22 + * **[Terminal Usage](./terminal-usage.md)**: Details about terminal setup (iTerm2, Zsh, Oh My Posh), keybindings, and plugins. 23 + * **[Terraform Usage](./terraform-usage.md)**: Terraform setup, common commands, and state management notes. 24 + * **[TODO](./TODO.md)**: A list of pending tasks and improvements for the dotfiles or documentation. 25 + * **[User Apps Usage](./user-apps-usage.md)**: Configuration notes for various user applications. 26 + * **[VSCode Usage](./vscode-usage.md)**: Visual Studio Code setup, extensions, and settings synchronization. 12 27 13 - To add new files to chezmoi control: 14 - 15 - ```sh 16 - chezmoi add <file> 17 - ``` 18 - 19 - To edit a file under chezmoi control: 20 - 21 - ```sh 22 - chezmoi edit <file> 23 - ``` 24 - 25 - To preview changes before applying: 26 - 27 - ```sh 28 - chezmoi diff 29 - ``` 30 - 31 - To apply changes from `.local/share/chezmoi/` to ~/ use: 32 - 33 - ```sh 34 - chezmoi apply 35 - ``` 36 - 37 - To both `git pull` and `chezmoi apply` use `update` 38 - 39 - ```sh 40 - chezmoi update 41 - ``` 42 - 43 - To force a refresh the downloaded archives (from .`chezmoiexternal.toml`), use the --refresh-externals flag to chezmoi apply: 44 - 45 - ```sh 46 - chezmoi --refresh-externals apply 47 - ``` 48 - 49 - Or `--refresh-externals` can be shortened to -R: 50 - 51 - ```sh 52 - chezmoi -R apply 53 - ``` 54 - 55 - ## resources 56 - 57 - * [Install](https://www.chezmoi.io/install/) 58 - * [Quick Start](https://www.chezmoi.io/quick-start/#using-chezmoi-across-multiple-machines) 59 - * [Setup](https://www.chezmoi.io/user-guide/setup/) 28 + Please explore the linked documents for more information on each topic.
+101 -5
docs/aws-usage.md
··· 1 1 # AWS Usage 2 2 3 - - [AWS Usage](#aws-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document provides an overview of using Amazon Web Services (AWS) tools, primarily the AWS Command Line Interface (CLI), within this dotfiles setup. 4 + 5 + ## Overview 6 + 7 + The AWS CLI is a unified tool to manage your AWS services. This guide covers basic configuration and common commands. 8 + 9 + ## Prerequisites 10 + 11 + * **AWS Account**: An active AWS account. 12 + * **AWS CLI Installed**: The AWS CLI is typically installed via Homebrew as part of the `chezmoi` setup if specified in your configurations. 13 + ```sh 14 + brew install awscli 15 + ``` 16 + * **Configured Credentials**: AWS CLI needs credentials to interact with your AWS account. These are typically stored in `~/.aws/credentials` and `~/.aws/config`. 17 + * **Security Note**: It is highly recommended to manage AWS credentials securely, for example, by storing them in 1Password and having `chezmoi` templates populate the AWS configuration files, or by using a tool like `aws-vault`. 18 + 19 + ## Configuration 20 + 21 + AWS CLI configuration can be managed via `aws configure` or by directly editing the files: 22 + 23 + * `~/.aws/config`: Stores default region, output format, and named profiles. 24 + * `~/.aws/credentials`: Stores AWS access keys for different profiles. 25 + 26 + ### Example `~/.aws/config`: 27 + ```ini 28 + [default] 29 + region = us-east-1 30 + output = json 5 31 6 - ## TODO: Create documentation 32 + [profile my-other-profile] 33 + region = us-west-2 34 + output = text 35 + ``` 7 36 8 - - Package aws-vault 9 - - Package awscli 37 + ### Example `~/.aws/credentials` (managed via 1Password/`chezmoi` or `aws-vault`): 38 + ```ini 39 + [default] 40 + aws_access_key_id = YOUR_ACCESS_KEY_ID_DEFAULT 41 + aws_secret_access_key = YOUR_SECRET_ACCESS_KEY_DEFAULT 42 + 43 + [profile my-other-profile] 44 + aws_access_key_id = YOUR_ACCESS_KEY_ID_OTHER 45 + aws_secret_access_key = YOUR_SECRET_ACCESS_KEY_OTHER 46 + ``` 47 + 48 + Refer to `docs/1password-usage.md` for guidance on storing these credentials in 1Password and using `chezmoi` templates. 49 + 50 + ## `aws-vault` (Recommended for Enhanced Security) 51 + 52 + [aws-vault](https://github.com/99designs/aws-vault) is a tool to securely store and access AWS credentials in your operating system's keystore. It helps in avoiding storing AWS credentials in plaintext files. 53 + 54 + ### Installation (if not managed by `chezmoi`): 55 + ```sh 56 + brew install aws-vault 57 + ``` 58 + 59 + ### Basic Usage: 60 + 61 + 1. **Add credentials to `aws-vault`**: 62 + ```sh 63 + aws-vault add my-profile 64 + ``` 65 + (This will prompt for your access key ID and secret access key) 66 + 67 + 2. **Execute commands using a profile**: 68 + ```sh 69 + aws-vault exec my-profile -- aws s3 ls 70 + ``` 71 + 72 + ## Common AWS CLI Commands 73 + 74 + Replace `my-profile` with your desired AWS profile if not using `default`. 75 + 76 + * **List S3 Buckets**: 77 + ```sh 78 + aws s3 ls --profile my-profile 79 + # Using aws-vault: 80 + # aws-vault exec my-profile -- aws s3 ls 81 + ``` 82 + 83 + * **List EC2 Instances**: 84 + ```sh 85 + aws ec2 describe-instances --profile my-profile 86 + # Using aws-vault: 87 + # aws-vault exec my-profile -- aws ec2 describe-instances 88 + ``` 89 + 90 + * **Get Caller Identity (useful for verifying current credentials)**: 91 + ```sh 92 + aws sts get-caller-identity --profile my-profile 93 + # Using aws-vault: 94 + # aws-vault exec my-profile -- aws sts get-caller-identity 95 + ``` 96 + 97 + ## Resources 98 + 99 + * **Official AWS CLI Documentation**: 100 + * [AWS CLI User Guide](https://docs.aws.amazon.com/cli/latest/userguide/) 101 + * [AWS CLI Command Reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/index.html) 102 + * **`aws-vault` GitHub Repository**: [https://github.com/99designs/aws-vault](https://github.com/99designs/aws-vault) 103 + * **1Password Documentation**: Refer to `docs/1password-usage.md` for managing secrets. 104 + 105 + This document is a starting point. Please refer to the official documentation for comprehensive information.
-67
docs/bitwarden-usage.md
··· 1 - # Bitwarden Usage 2 - 3 - - [Bitwarden Usage](#bitwarden-usage) 4 - - [Overview](#overview) 5 - - [Configuration](#configuration) 6 - - [Prerequisites](#prerequisites) 7 - - [Test](#test) 8 - 9 - ## Overview 10 - 11 - This project uses [Bitwarden CLI](https://bitwarden.com/help/cli/) as a default password manager to store its non-sensitive configuration data. It is installed the first time the dotfiles run. 12 - 13 - ## Configuration 14 - 15 - ### Prerequisites 16 - 17 - - [Create your Bitwarden account](https://bitwarden.com/help/create-bitwarden-account/) 18 - - [Login to the Bitwarden web vault](https://vault.bitwarden.com/#/login) 19 - - [Create a new Identity item](https://bitwarden.com/help/custom-fields/) with the `Name` filed set to `dotfiles` 20 - - Fill in the following fields 21 - - `First name` 22 - - `Last name` 23 - - `Username` - this can be your shortcode 24 - - `Email` 25 - - `git_signingkey` - this is a custom field to store your gpg Git commit signing key ID 26 - 27 - ### Test 28 - 29 - Log in using the Bitwarden CLI and fetch the `dotfiles` Identity item 30 - 31 - ```shell 32 - bw login 33 - bw unlock # if your session has expired 34 - export BW_SESSION="[session]" 35 - bw get item dotfiles | jq 36 - ``` 37 - Tou should be presented with a similar output 38 - 39 - ```json 40 - [ 41 - { 42 - "object": "item", 43 - "id": "00000000-0000-0000-0000-000000000000", 44 - "name": "dotfiles", 45 - ... 46 - "fields": [ 47 - { 48 - "name": "git_signingkey", 49 - "value": "1234567890ABCDEF1234567890ABCDEF12345678" 50 - } 51 - ], 52 - "identity": { 53 - "firstName": "[your first name]", 54 - "lastName": "[your last name]", 55 - "email": "[your email]", 56 - "username": "[your username]" 57 - }, 58 - ... 59 - } 60 - ] 61 - ``` 62 - 63 - To fetch any changes made using the online service, run the following command: 64 - 65 - ```shell 66 - bw sync 67 - ```
+168 -71
docs/chezmoi-usage.md
··· 1 - # Chezmoi Usage 1 + # Chezmoi Usage: In-Depth Guide 2 2 3 - - [Chezmoi Usage](#chezmoi-usage) 4 - - [Overview](#overview) 5 - - [Installation](#installation) 6 - - [Flow diagram](#flow-diagram) 7 - - [Usage](#usage) 8 - - [Flow diagram](#flow-diagram-1) 9 - - [Useful commands](#useful-commands) 10 - - [Apply changes from the local repository](#apply-changes-from-the-local-repository) 11 - - [Show cached configuration data](#show-cached-configuration-data) 12 - - [Test a template code snippet](#test-a-template-code-snippet) 3 + This document provides a comprehensive guide to using `chezmoi` for managing your dotfiles, expanding on the information in the main `README.md`. 13 4 14 5 ## Overview 15 6 16 - This dotfiles repository is configured and managed by the `chezmoi` project. [chezmoi](https://www.chezmoi.io/), pronounced _/ʃeɪ mwa/ (shay-moi)_ is currently the [most complete and most hackable](https://www.chezmoi.io/comparison-table/) dotfiles manager out there. 7 + [Chezmoi](https://www.chezmoi.io/) (pronounced _/ʃeɪ mwa/ - shay moi) is a powerful, flexible, and secure dotfiles manager. It helps you manage your configuration files (dotfiles) across multiple machines with ease. 17 8 18 - ## Installation 9 + Key features leveraged in this setup include: 10 + * **Templating**: Using Go templates (with Sprig functions and custom data) to make dotfiles dynamic. 11 + * **Secret Management**: Integration with 1Password CLI to securely handle sensitive data. 12 + * **OS-Specific Configuration**: Applying different configurations based on the operating system. 13 + * **Script Execution**: Running scripts at various points in `chezmoi`'s lifecycle (`run_once_`, `run_onchange_`, etc.). 14 + * **External File Management**: Managing files and archives from external sources. 15 + 16 + ## Core Concepts 19 17 20 - The following instruction clones [dotfiles](https://github.com/make-ops-tools/dotfiles) repository into the `~/.local/share/chezmoi/` directory and next applies changes accordingly, to your home directory `~/`. During the setup it prompts you to provide configuration options like Git committer name and email address, etc. 18 + * **Source Directory**: Where `chezmoi` stores your dotfiles and configurations (typically `~/.local/share/chezmoi`). This directory is a Git repository. 19 + * **Target Directory**: Your home directory (`~`) where `chezmoi` applies the configurations. 20 + * **Configuration File**: `~/.config/chezmoi/chezmoi.toml` (or `.yaml`/`.json`) stores `chezmoi`'s own configuration, including data accessible in templates. 21 21 22 - ```shell 23 - bash -c "$(curl -fsLS get.chezmoi.io)" -- init --apply "make-ops-tools" 22 + ## Installation and Initialization 23 + 24 + As covered in the main `README.md`, initialization typically involves: 25 + 26 + ```sh 27 + sh -c "$(curl -fsSL get.chezmoi.io)" -- init --apply mauvehed 24 28 ``` 29 + This command: 30 + 1. Downloads and installs `chezmoi` if not present. 31 + 2. Clones your dotfiles repository (github.com/mauvehed/dotfiles) into `~/.local/share/chezmoi`. 32 + 3. Prompts for any initial configuration data defined in `.chezmoi.toml.tmpl`. 33 + 4. Applies the dotfiles to your home directory. 25 34 26 - ### Flow diagram 35 + ### Initial Setup Flow (Conceptual) 27 36 28 37 ```mermaid 29 38 sequenceDiagram 30 39 autonumber 31 - participant home directory 32 - participant working copy 33 - participant local repo 34 - participant remote repo 35 - Note over home directory: archive current files 36 - remote repo->>local repo: chezmoi init --apply <repo> 37 - Note left of local repo: prompt for configuration 38 - local repo->>home directory: chezmoi init --apply <repo> 40 + participant User 41 + participant Shell 42 + participant Chezmoi 43 + participant Git 44 + participant GitHub (mauvehed/dotfiles) 45 + participant "1Password CLI (op)" 46 + 47 + User->>Shell: Runs install/init command 48 + Shell->>Chezmoi: Installs/Updates chezmoi binary 49 + Chezmoi->>GitHub (mauvehed/dotfiles): Clones/Pulls repository into source dir 50 + Chezmoi->>User: Prompts for template data (if .chezmoi.toml.tmpl exists) 51 + Note over Chezmoi: Reads .chezmoi.toml, .chezmoidata.*, etc. 52 + Chezmoi->>"1Password CLI (op)": (Potentially) Fetches data via template functions 53 + Chezmoi->>Shell: Executes run_once_ scripts, creates symlinks, applies templates to target dir (Home) 39 54 ``` 55 + *(This diagram is a simplification of the actual process)* 56 + 57 + ## Common `chezmoi` Commands 40 58 41 - ## Usage 59 + * **`chezmoi add <path_to_file_in_home>`**: Adds a file from your home directory to `chezmoi`'s source directory. 60 + * Example: `chezmoi add ~/.gitconfig` 61 + * Use the `-T` or `--template` flag to add it as a template: `chezmoi add ~/.gitconfig --template` 62 + * Use the `-e` or `--encrypt` flag to add it as an encrypted file (less common now with 1Password integration for secrets). 63 + 64 + * **`chezmoi edit <path_to_file_in_home>`**: Opens a file managed by `chezmoi` in your `$EDITOR` by operating on the source file. 65 + * Example: `chezmoi edit ~/.gitconfig` 66 + 67 + * **`chezmoi apply [-v --dry-run]`**: Applies changes from the source directory to the target directory. 68 + * `-v` / `--verbose`: Shows what changes are being made. 69 + * `--dry-run`: Shows what would be changed without actually making changes. 70 + * `--init`: Re-runs initialization steps (useful if `.chezmoi.toml.tmpl` changes). 71 + * `-R` / `--refresh-externals`: Forces a refresh of externally managed files. 72 + 73 + * **`chezmoi update`**: Pulls changes from your Git remote, then applies changes. 74 + * Equivalent to `chezmoi git pull && chezmoi apply` (simplified). 75 + 76 + * **`chezmoi diff`**: Shows the differences between the target state in your home directory and the state defined by your source directory and templates. 77 + 78 + * **`chezmoi forget <path_to_file_in_home>`**: Removes a file from `chezmoi` management (it will no longer be updated by `chezmoi apply`). The file in your home directory is not deleted by this command. 79 + 80 + * **`chezmoi remove <path_to_file_in_home>`**: Removes a file from `chezmoi` management AND deletes it from the source directory. The file in your home directory is not deleted by this command. 81 + 82 + * **`chezmoi chattr <attributes> <target>`**: Changes attributes of a target in the source directory (e.g., `private`, `readonly`, `template`, `executable`, `empty`). 83 + * Example: `chezmoi chattr template ~/.gitconfig` (makes it a template) 84 + * Example: `chezmoi chattr private ~/.ssh/config` (marks it as private) 85 + 86 + * **`chezmoi doctor`**: Checks for common problems with your setup. 87 + 88 + * **`chezmoi cd`**: Opens a new shell in the source directory (`~/.local/share/chezmoi`). 89 + 90 + * **`chezmoi data`**: Prints the data available to templates (merges data from various sources). Useful for debugging templates. 91 + * Example: `chezmoi data | jq` (if `jq` is installed) 92 + 93 + * **`chezmoi execute-template <template_string_or_file>`**: Executes a Go template. Useful for testing template snippets. 94 + * Example (1Password): `chezmoi execute-template '{{ (onepasswordRead "op://Personal/API_KEY_MYAPP/password").stdout | trim }}'` 95 + * Example (OS specific): `chezmoi execute-template '{{ if eq .chezmoi.os "darwin" }}macOS Specific Value{{ else }}Other OS Value{{ end }}'` 96 + 97 + * **`chezmoi git <git_args...>`**: Runs Git commands in the source directory. 98 + * Example: `chezmoi git status`, `chezmoi git push` 99 + 100 + ## Templating 101 + 102 + `chezmoi` uses Go's [text/template](https://pkg.go.dev/text/template) package. This allows for dynamic configuration files. 103 + 104 + * **Syntax**: Templates are enclosed in `{{ }}`. 105 + * **Sprig Functions**: Over 100 helpful [Sprig functions](http://masterminds.github.io/sprig/) are available (e.g., string manipulation, math, data structures). 106 + * **`chezmoi` Specific Data**: `chezmoi` provides variables like `.chezmoi.os`, `.chezmoi.hostname`, etc. See `chezmoi data`. 107 + * **Custom Data**: Data from `.chezmoi.toml` or data files (e.g., `.chezmoidata.yaml`) is available. 108 + * **1Password Integration**: Use functions like `onepassword`, `onepasswordRead`, `onepasswordDocument` to fetch secrets from 1Password. See `docs/1password-usage.md` for details. 109 + ```toml 110 + # Example in a .gitconfig.tmpl 111 + [user] 112 + email = {{ .email | quote }} 113 + signingkey = {{ (onepasswordRead "op://Personal/Git Keys/signingkey_id").stdout | trim | quote }} 114 + ``` 42 115 43 - If you decide to extend the configuration of your dotfiles and include an additional file to be managed, here is an example on how to do that 116 + ## Scripts 44 117 45 - ```shell 46 - chezmoi add ~/.bashrc 47 - chezmoi edit ~/.bashrc 48 - chezmoi diff 49 - chezmoi apply -v 50 - chezmoi cd 51 - git add . 52 - git commit -S -m "Add .bashrc" 53 - git push 54 - exit 118 + `chezmoi` can execute scripts at different points: 119 + 120 + * **`run_once_*.sh`** (or other extensions): Executed only once per machine. Useful for initial setup tasks (e.g., installing Homebrew). 121 + * **`run_onchange_*.sh`**: Executed if their content (or the content of files they depend on via comments) changes. Useful for tasks that need to re-run if a related config file changes. 122 + * **`run_before_*.sh`**: Run before `chezmoi apply` applies changes for that script's directory. 123 + * **`run_after_*.sh`**: Run after `chezmoi apply` applies changes for that script's directory. 124 + 125 + Scripts must be executable. `chezmoi` adds template functions to the script's environment as environment variables. 126 + 127 + ## Managing External Files (`.chezmoiexternal.toml`) 128 + 129 + `chezmoi` can manage files and archives from external sources (URLs) using a `.chezmoiexternal.toml` file in the source directory. 130 + 131 + * **Use Cases**: Downloading a specific version of a tool, fetching a `Brewfile` from a gist, managing `oh-my-zsh` installation/updates. 132 + * **Format**: TOML file defining targets and sources. 133 + * **Refresh**: Use `chezmoi apply -R` or `chezmoi apply --refresh-externals` to force download/update. 134 + 135 + Example `.chezmoiexternal.toml` entry: 136 + ```toml 137 + # ["{{ .chezmoi.sourceDir }}/path/to/oh-my-zsh.sh"] 138 + # type = "file" 139 + # url = "https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh" 140 + # refreshPeriod = "168h" # Refresh once a week 55 141 ``` 56 142 57 - ### Flow diagram 143 + ## Managing Dotfile Attributes 58 144 59 - ```mermaid 60 - sequenceDiagram 61 - participant home directory 62 - participant working copy 63 - participant local repo 64 - participant your remote repo 65 - home directory->>local repo: chezmoi init 66 - home directory->>working copy: chezmoi add <file> 67 - working copy->>working copy: chezmoi edit <file> 68 - working copy-->>home directory: chezmoi diff 69 - working copy->>home directory: chezmoi apply 70 - home directory-->>working copy: chezmoi cd 71 - working copy->>local repo: git add 72 - working copy->>local repo: git commit 73 - local repo->>local repo: git remote add origin<br/>git branch 74 - local repo->>your remote repo: git push 75 - working copy-->>home directory: exit 76 - ``` 145 + `chezmoi` allows setting attributes for files and directories in the source directory, influencing how they are treated: 146 + 147 + * **`private_` prefix**: The target file will have permissions `0600` (or `0700` for directories). 148 + * **`readonly_` prefix**: The target file will be read-only. 149 + * **`executable_` prefix**: The target file will be executable. 150 + * **`empty_` prefix**: The target file will be created empty if it does not exist. 151 + * **`.tmpl` suffix**: The file is treated as a Go template. 152 + * **`.encrypted` suffix**: The file is encrypted using GPG (less common with 1Password integration). 153 + 154 + These can also be managed with `chezmoi chattr`. 77 155 78 - ## Useful commands 156 + ## Troubleshooting 79 157 80 - ### Apply changes from the local repository 158 + * **`chezmoi doctor`**: Run this first to check for common issues. 159 + * **`chezmoi -v apply --dry-run`**: Verbose dry run to see what `chezmoi` *thinks* it should do. 160 + * **`chezmoi data`**: Inspect the data available to your templates. 161 + * **Check Permissions**: Ensure scripts are executable, and `chezmoi` has rights to write to target locations. 162 + * **Template Errors**: `chezmoi execute-template` is invaluable for debugging specific template snippets. 81 163 82 - ```shell 83 - chezmoi cd 84 - pwd # should be ~/.local/share/chezmoi 85 - chezmoi apply --init 86 - ``` 164 + ## Advanced Usage Flow (Adding a new templated file with a secret) 87 165 88 - ### Show cached configuration data 166 + ```mermaid 167 + sequenceDiagram 168 + participant User 169 + participant "1Password" 170 + participant Shell (Terminal) 171 + participant "Chezmoi Source Dir (~/.local/share/chezmoi)" 172 + participant "Home Directory (~/)" 89 173 90 - ```shell 91 - chezmoi data | jq 92 - cat ~/.config/chezmoi/chezmoi.toml 174 + User->>"1Password": Add new secret (e.g., API key for myapp) 175 + User->>Shell (Terminal): `touch ~/.config/myapp/config.toml` (create target file initially) 176 + User->>Shell (Terminal): `chezmoi add ~/.config/myapp/config.toml -T` (add as template) 177 + User->>Shell (Terminal): `chezmoi edit ~/.config/myapp/config.toml` 178 + Note over Shell (Terminal): Editor opens `.../dot_config/myapp/config.toml.tmpl` 179 + User->>Shell (Terminal): Edit template to include `{{ onepasswordRead "op://..." }}` 180 + User->>Shell (Terminal): `chezmoi diff` (review changes) 181 + User->>Shell (Terminal): `chezmoi apply -v` 182 + Chezmoi Source Dir (~/.local/share/chezmoi)-->>Home Directory (~/): Applies templated file, fetching secret 183 + User->>Shell (Terminal): `chezmoi cd` 184 + User->>Shell (Terminal): `git add .` 185 + User->>Shell (Terminal): `git commit -m "Add config for myapp with secret"` 186 + User->>Shell (Terminal): `git push` 93 187 ``` 94 188 95 - ### Test a template code snippet 189 + ## Resources 96 190 97 - ```shell 98 - chezmoi execute-template '{{ (bitwarden "item" "dotfiles").identity.firstName }} {{ (bitwarden "item" "dotfiles").identity.lastName }}' 99 - ``` 191 + * **Official `chezmoi` Website**: [https://www.chezmoi.io/](https://www.chezmoi.io/) 192 + * **`chezmoi` User Guide**: [https://www.chezmoi.io/user-guide/](https://www.chezmoi.io/user-guide/) 193 + * **`chezmoi` Reference**: [https://www.chezmoi.io/reference/](https://www.chezmoi.io/reference/) 194 + * **`docs/1password-usage.md`**: For details on 1Password integration. 195 + 196 + This guide should provide a solid foundation for working with `chezmoi` in this dotfiles setup. Refer to the official `chezmoi` documentation for the most detailed and up-to-date information.
+99 -10
docs/cli-usage.md
··· 1 - # Command-line Interface Usage 1 + # Enhanced Command-Line Interface (CLI) Usage 2 + 3 + This document details configurations and tools aimed at creating a powerful, consistent, and user-friendly command-line interface (CLI) experience, primarily within a Zsh environment managed by `chezmoi`. 4 + 5 + ## Overview 6 + 7 + A productive CLI environment goes beyond just the shell and prompt. It involves using enhanced versions of standard utilities, organizing shell configurations logically, and leveraging tools that streamline common tasks. 8 + 9 + ## Striving for Consistency (GNU Coreutils on macOS) 10 + 11 + To achieve a more GNU/Linux-like CLI experience on macOS, GNU core utilities are often installed. These provide versions of common commands (`ls`, `cp`, `mv`, `date`, `cat`, etc.) with features and options consistent with their Linux counterparts. 12 + 13 + * **Installation (macOS with Homebrew)**: 14 + ```sh 15 + brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep 16 + ``` 17 + (You might have a more specific list in your `Brewfile`.) 18 + * **Usage**: These GNU versions are typically prefixed with `g` (e.g., `gls`, `gcat`, `gdate`) to avoid conflicts with the native macOS utilities. 19 + * **PATH Configuration**: To use these GNU versions by their standard names (e.g., `ls` instead of `gls`), you would add their directory (e.g., `$(brew --prefix coreutils)/libexec/gnubin`) to the beginning of your `$PATH`. 20 + * This is often handled in a dedicated `.path` file or directly in your `.zshrc` / `.zshenv`, managed by `chezmoi`. 21 + 22 + ## Shell Configuration Files 23 + 24 + To keep the main shell configuration file (e.g., `~/.zshrc`) clean and organized, specific aspects of the shell setup are often broken out into separate files, sourced by the main config. These are managed by `chezmoi`. 25 + 26 + * **`~/.path` (or similar)**: Manages the `$PATH` environment variable. It defines the order in which directories are searched for executables. Example content: 27 + ```sh 28 + # Example .path structure 29 + export PATH="$HOME/.local/bin:$PATH" 30 + export PATH="$(brew --prefix)/bin:$(brew --prefix)/sbin:$PATH" # Homebrew 31 + # Add GNU coreutils if preferred 32 + # export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH" 33 + ``` 34 + 35 + * **`~/.exports` (or similar)**: Sets other essential environment variables (e.g., `EDITOR`, `LANG`, `PAGER`, custom variables for tools). 36 + ```sh 37 + # Example .exports 38 + export EDITOR='vim' 39 + export LANG='en_US.UTF-8' 40 + export PAGER='less' 41 + ``` 42 + 43 + * **`~/.functions` (or similar)**: Defines custom shell functions to automate common tasks or create complex commands. 44 + ```sh 45 + # Example function in .functions 46 + # mkcd() { 47 + # mkdir -p "$1" && cd "$1" 48 + # } 49 + ``` 50 + 51 + * **`~/.aliases` (or similar)**: Contains command aliases for frequently used commands or commands with common options. 52 + ```sh 53 + # Example .aliases 54 + # alias ll='ls -alhF' 55 + # alias update='sudo apt update && sudo apt upgrade -y' # Linux example 56 + # alias brewup='brew update && brew upgrade && brew cleanup' # macOS example 57 + ``` 2 58 3 - - [Command-line Interface Usage](#command-line-interface-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 59 + These files are typically sourced from `~/.zshrc` in a specific order. 5 60 6 - ## TODO: Create documentation 61 + ## Essential CLI Enhancement Tools 7 62 8 - - Consistent GNU/Linux-like CLI experience 9 - - Shell files 10 - - .path 11 - - .exports 12 - - .functions 13 - - .aliases 63 + These tools replace or augment standard CLI utilities for a better experience. They are usually installed via package managers (Homebrew, apt, etc.) and managed by `chezmoi`. 64 + 65 + * **`exa`** or **`lsd`**: Modern replacements for `ls` with more colors, icons, and features. 66 + * [exa](https://the.exa.website/), [lsd](https://github.com/Peltoche/lsd) 67 + * **`bat`**: A `cat` clone with syntax highlighting and Git integration. 68 + * [bat](https://github.com/sharkdp/bat) 69 + * **`fd`**: A simple, fast, and user-friendly alternative to `find`. 70 + * [fd](https://github.com/sharkdp/fd) 71 + * **`ripgrep` (`rg`)**: A line-oriented search tool that recursively searches the current directory for a regex pattern (very fast alternative to `grep`). 72 + * [ripgrep](https://github.com/BurntSushi/ripgrep) 73 + * **`fzf`**: A command-line fuzzy finder for history, files, processes, etc. Often integrated with shell keybindings (`Ctrl+R`, `Ctrl+T`). 74 + * [fzf](https://github.com/junegunn/fzf) 75 + * **`zoxide`**: A smarter `cd` command that learns your habits. 76 + * [zoxide](https://github.com/ajeetdsouza/zoxide) 77 + * **`jq`**: A lightweight and flexible command-line JSON processor. 78 + * [jq](https://stedolan.github.io/jq/) 79 + * **`yq`**: A command-line YAML, JSON, and XML processor (similar to `jq` but for more formats). 80 + * [yq (Python version)](https://github.com/kislyuk/yq) or [yq (Go version)](https://github.com/mikefarah/yq) 81 + * **`tldr`**: Collaborative cheatsheets for console commands. Provides simplified man pages. 82 + * [tldr-pages](https://tldr.sh/) 83 + * **`navi`** or **`cheat`**: Interactive command-line cheatsheet tools. 84 + * [navi](https://github.com/denisidoro/navi), [cheat](https://github.com/cheat/cheat) 85 + * **`procs`**: A modern replacement for `ps` written in Rust. 86 + * [procs](https://github.com/dalance/procs) 87 + * **`httpie`** or **`curlie`**: User-friendly CLI HTTP clients, alternatives to `curl`. 88 + * [HTTPie](https://httpie.io/), [curlie](https://github.com/rs/curlie) 89 + 90 + ## General Tips 91 + 92 + * **Keybindings**: Customize Zsh keybindings (often in `.zshrc` or a dedicated file) for frequently used actions or fzf integrations. 93 + * **Dotfiles Management**: Use `chezmoi edit <filename>` to easily edit any of these configuration files. 94 + 95 + ## Resources 96 + 97 + * **GNU Coreutils**: [https://www.gnu.org/software/coreutils/](https://www.gnu.org/software/coreutils/) 98 + * Links to individual tools are provided in the list above. 99 + * **Awesome Shell**: [https://github.com/alebcay/awesome-shell](https://github.com/alebcay/awesome-shell) (A curated list of awesome command-line frameworks, toolkits, guides, and gizmos) 100 + * **Awesome CLI Apps**: [https://github.com/agarrharr/awesome-cli-apps](https://github.com/agarrharr/awesome-cli-apps) 101 + 102 + This setup aims to make your command-line interactions more efficient and enjoyable. Explore the tools and customize them to fit your workflow.
-6
docs/corporate-apps-usage.md
··· 1 - # Corporate Apps Usage 2 - 3 - - [Corporate Apps Usage](#corporate-apps-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 5 - 6 - ## TODO: Create documentation
+137 -4
docs/docker-usage.md
··· 1 1 # Docker Usage 2 2 3 - - [Docker Usage](#docker-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document provides a basic guide to using Docker, including common commands and concepts relevant to a development workflow. 4 + 5 + ## Overview 6 + 7 + [Docker](https://www.docker.com/) is a platform for developing, shipping, and running applications in containers. Containers allow you to package an application with all of its dependencies into a standardized unit for software development. 8 + 9 + ## Installation 10 + 11 + * **Docker Desktop**: For macOS and Windows, [Docker Desktop](https://www.docker.com/products/docker-desktop/) is the easiest way to install Docker. It includes the Docker Engine, Docker CLI client, Docker Compose, Kubernetes, and more. 12 + * **Linux**: On Linux, you can install the Docker Engine and CLI separately. Follow the official installation guides for your distribution (e.g., [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/)). 13 + 14 + Installation might be managed by `chezmoi` if Docker is part of your standard toolset defined in your dotfiles. 15 + 16 + ## Common Docker CLI Commands 17 + 18 + Here are some of the most frequently used Docker commands: 19 + 20 + * **Pull an image from a registry (e.g., Docker Hub)**: 21 + ```sh 22 + docker pull <image_name>:<tag> 23 + # Example: docker pull ubuntu:latest 24 + ``` 25 + 26 + * **Run a container from an image**: 27 + ```sh 28 + docker run [options] <image_name>:<tag> [command] 29 + # Example (interactive shell in an Ubuntu container): 30 + # docker run -it ubuntu:latest /bin/bash 31 + # Example (run a web server, map port 8080 to container's port 80): 32 + # docker run -d -p 8080:80 nginx:latest 33 + ``` 34 + * `-d`: Detached mode (run in background) 35 + * `-it`: Interactive TTY 36 + * `-p <host_port>:<container_port>`: Port mapping 37 + * `--name <container_name>`: Assign a name to the container 38 + * `-v <host_path>:<container_path>`: Mount a volume 39 + 40 + * **List running containers**: 41 + ```sh 42 + docker ps 43 + ``` 44 + 45 + * **List all containers (running and stopped)**: 46 + ```sh 47 + docker ps -a 48 + ``` 49 + 50 + * **View logs of a container**: 51 + ```sh 52 + docker logs <container_name_or_id> 53 + # Follow logs: docker logs -f <container_name_or_id> 54 + ``` 55 + 56 + * **Stop a running container**: 57 + ```sh 58 + docker stop <container_name_or_id> 59 + ``` 60 + 61 + * **Remove a stopped container**: 62 + ```sh 63 + docker rm <container_name_or_id> 64 + ``` 65 + 66 + * **List images**: 67 + ```sh 68 + docker images 69 + ``` 70 + 71 + * **Remove an image**: 72 + ```sh 73 + docker rmi <image_name_or_id> 74 + ``` 75 + 76 + * **Clean up unused resources (containers, networks, images)**: 77 + ```sh 78 + docker system prune 79 + # To remove all unused images, not just dangling ones: 80 + # docker system prune -a 81 + ``` 82 + 83 + ## Docker Compose 84 + 85 + [Docker Compose](https://docs.docker.com/compose/) is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file (`docker-compose.yml`) to configure your application's services. 86 + 87 + ### Example `docker-compose.yml` snippet: 88 + ```yaml 89 + version: '3.8' 90 + services: 91 + web: 92 + image: nginx:latest 93 + ports: 94 + - "8080:80" 95 + app: 96 + image: my-custom-app 97 + build: . 98 + ports: 99 + - "3000:3000" 100 + ``` 5 101 6 - ## TODO: Create documentation 102 + ### Common Docker Compose Commands: 7 103 8 - - [Development Containers](https://containers.dev/) 104 + * **Start services defined in `docker-compose.yml`**: 105 + ```sh 106 + docker-compose up 107 + # Start in detached mode: docker-compose up -d 108 + ``` 109 + 110 + * **Stop services**: 111 + ```sh 112 + docker-compose down 113 + ``` 114 + 115 + * **List services**: 116 + ```sh 117 + docker-compose ps 118 + ``` 119 + 120 + ## Development Containers (Dev Containers) 121 + 122 + [Development Containers](https://containers.dev/) (Dev Containers) allow you to use a Docker container as a full-featured development environment. This is particularly useful with editors like VS Code. 123 + 124 + A `devcontainer.json` file in your project tells VS Code (and other tools) how to access (or create) a development container with a well-defined tool and runtime stack. 125 + 126 + ### Key Benefits: 127 + * **Consistent Environment**: Ensures everyone on the team uses the same development environment. 128 + * **Tool Isolation**: Keeps tools and dependencies for different projects separate. 129 + * **Pre-configured Setups**: Quickly onboard new developers with ready-to-use environments. 130 + 131 + Refer to the [official Dev Containers documentation](https://containers.dev/docs) and the [VS Code Remote - Containers documentation](https://code.visualstudio.com/docs/remote/containers) for setup and usage details. 132 + 133 + ## Resources 134 + 135 + * **Official Docker Documentation**: [https://docs.docker.com/](https://docs.docker.com/) 136 + * **Docker Hub (Image Registry)**: [https://hub.docker.com/](https://hub.docker.com/) 137 + * **Docker Compose Documentation**: [https://docs.docker.com/compose/](https://docs.docker.com/compose/) 138 + * **Development Containers**: [https://containers.dev/](https://containers.dev/) 139 + * **VS Code Remote - Containers**: [https://code.visualstudio.com/docs/devcontainers/containers](https://code.visualstudio.com/docs/devcontainers/containers) (Note: VS Code documentation now prefers /devcontainers/ over /remote/) 140 + 141 + This guide provides a starting point. Docker is a vast ecosystem, so refer to the official documentation for in-depth information.
+208 -134
docs/git-usage.md
··· 1 - # Git Usage 1 + # Git Usage and Best Practices 2 2 3 - ## Table of contents 3 + This document outlines Git configuration, best practices for commit signing with GPG and 1Password, and useful Git commands relevant to this dotfiles setup. 4 4 5 - - [Git Usage](#git-usage) 6 - - [Table of contents](#table-of-contents) 7 - - [Configuration](#configuration) 8 - - [Signing commits](#signing-commits) 9 - - [Troubleshooting](#troubleshooting) 10 - - [Additional settings](#additional-settings) 11 - - [Useful commands](#useful-commands) 5 + ## Table of Contents 12 6 13 - ## Configuration 7 + - [Git Usage and Best Practices](#git-usage-and-best-practices) 8 + - [Table of Contents](#table-of-contents) 9 + - [Core Git Configuration](#core-git-configuration) 10 + - [Commit Signing with GPG and 1Password](#commit-signing-with-gpg-and-1password) 11 + - [1. Generating or Importing Your GPG Key](#1-generating-or-importing-your-gpg-key) 12 + - [2. Adding Your GPG Key ID to 1Password](#2-adding-your-gpg-key-id-to-1password) 13 + - [3. Configuring Git to Use the GPG Key (via `chezmoi` and 1Password)](#3-configuring-git-to-use-the-gpg-key-via-chezmoi-and-1password) 14 + - [4. Adding GPG Public Key to GitHub](#4-adding-gpg-public-key-to-github) 15 + - [5. GPG Agent Configuration](#5-gpg-agent-configuration) 16 + - [6. Troubleshooting GPG Signing](#6-troubleshooting-gpg-signing) 17 + - [GitHub CLI Authentication (`gh auth login`)](#github-cli-authentication-gh-auth-login) 18 + - [Common Git Workflows and Useful Commands](#common-git-workflows-and-useful-commands) 19 + - [Basic Workflow](#basic-workflow) 20 + - [Branching](#branching) 21 + - [Stashing Changes](#stashing-changes) 22 + - [Viewing History](#viewing-history) 23 + - [Squashing Commits](#squashing-commits) 24 + - [Tags](#tags) 25 + - [Resources](#resources) 14 26 15 - <!-- markdownlint-disable-next-line no-inline-html --> 16 - The commands below will configure your Git command-line client globally. Please, update your username (<span style="color:red">Your Name</span>) and email address (<span style="color:red">youremail@domain</span>) in the code snippet below prior to executing it. 27 + ## Core Git Configuration 17 28 18 - This configuration is to support trunk-based development and git linear history. 29 + Key Git settings are managed by `chezmoi` via the `dot_gitconfig.tmpl` template file, which generates `~/.gitconfig`. 30 + This configuration generally promotes trunk-based development and a linear Git history. 19 31 20 - ```shell 21 - git config user.name "Your Name" # Use your full name here 22 - git config user.email "youremail@domain" # Use your email address here 23 - git config branch.autosetupmerge false 24 - git config branch.autosetuprebase always 25 - git config commit.gpgsign true 26 - git config core.autocrlf input 27 - git config core.filemode true 28 - git config core.hidedotfiles false 29 - git config core.ignorecase false 30 - git config credential.helper cache 31 - git config pull.rebase true 32 - git config push.default current 33 - git config push.followTags true 34 - git config rebase.autoStash true 35 - git config remote.origin.prune true 32 + Common global settings include: 33 + 34 + ```ini 35 + # Example from dot_gitconfig.tmpl (values are templated) 36 + [user] 37 + name = {{ .name | quote }} 38 + email = {{ .email | quote }} 39 + signingkey = {{ (onepasswordRead "op://Personal/Git GPG Key/key_id").stdout | trim | quote }} # Fetched from 1Password 40 + [commit] 41 + gpgsign = true # Sign all commits by default 42 + [pull] 43 + rebase = true # Prefer rebase over merge on pull 44 + [rebase] 45 + autoStash = true # Automatically stash changes before rebase 46 + [push] 47 + default = current # Push the current branch to a branch of the same name 48 + followTags = true # Push tags that point to commits being pushed 49 + [branch] 50 + autosetupmerge = false # Do not automatically set up merge configurations 51 + autosetuprebase = always # Always rebase when pulling on new branches 52 + [core] 53 + autocrlf = input # Handle line endings correctly 54 + # ... other settings ... 55 + [remote "origin"] 56 + prune = true # Remove remote-tracking branches that no longer exist on the remote 36 57 ``` 37 58 38 - This is already set in the [`dot_gitconfig.tmpl`](https://github.com/make-ops-tools/dotfiles/blob/main/dot_gitconfig.tmpl) file, that is used as a template to create `~/.gitconfig`. 59 + * The specific template is located at: `{{ .chezmoi.sourceDir }}/dot_gitconfig.tmpl`. 60 + * Refer to the [Git Reference documentation](https://git-scm.com/docs) for details on these settings. 39 61 40 - More information on the git settings can be found in the [Git Reference documentation](https://git-scm.com/docs). 62 + ## Commit Signing with GPG and 1Password 41 63 42 - ## Signing commits 64 + Signing Git commits cryptographically verifies the committer's identity. This setup uses GPG for signing, with the GPG key ID managed via 1Password. 43 65 44 - Signing Git commits is a good practice and ensures the correct web of trust has been established for the distributed version control management. 66 + ### 1. Generating or Importing Your GPG Key 45 67 46 - <!-- markdownlint-disable-next-line no-inline-html --> 47 - If you do not have it already generate a new pair of GPG keys. Please, change the passphrase (<span style="color:red">pleaseChooseYourKeyPassphrase</span>) below and save it in your password manager. 68 + If you don't have a GPG key, generate one: 48 69 49 - ```shell 50 - USER_NAME="Your Name" 51 - USER_EMAIL="your.name@email" 52 - file=$(echo $USER_EMAIL | sed "s/[^[:alpha:]]/-/g") 53 - 54 - mkdir -p "$HOME/.gnupg" 55 - chmod 0700 "$HOME/.gnupg" 56 - cd "$HOME/.gnupg" 57 - cat > "$file.gpg-key.script" <<EOF 58 - %echo Generating a GPG key 59 - Key-Type: ECDSA 60 - Key-Curve: nistp256 61 - Subkey-Type: ECDH 62 - Subkey-Curve: nistp256 63 - Name-Real: $USER_NAME 64 - Name-Email: $USER_EMAIL 65 - Expire-Date: 0 66 - Passphrase: pleaseChooseYourKeyPassphrase 67 - %commit 68 - %echo done 69 - EOF 70 - gpg --batch --generate-key "$file.gpg-key.script" 71 - rm "$file.gpg-key.script" 72 - # or do it manually by running `gpg --full-gen-key` 70 + ```sh 71 + gpg --full-gen-key 73 72 ``` 73 + Follow the prompts. An `ECDSA` key with `nistp256` curve is a good modern choice. Ensure you use a strong passphrase and store it securely (e.g., in 1Password). 74 74 75 - Make note of the ID and save the keys. 75 + If you have an existing GPG key, ensure it's in your GPG keyring. 76 76 77 - ```shell 78 - gpg --list-secret-keys --keyid-format LONG $USER_EMAIL 79 - ``` 77 + ### 2. Adding Your GPG Key ID to 1Password 80 78 81 - You should see a similar output to this 79 + Once you have a GPG key, get its Key ID: 82 80 83 - ```shell 84 - sec nistp256/AAAAAAAAAAAAAAAA 2023-01-01 [SCA] 81 + ```sh 82 + gpg --list-secret-keys --keyid-format LONG "Your Name" # Or your email 83 + ``` 84 + Output will look like: 85 + ``` 86 + sec nistp256/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX YYYY-MM-DD [SCA] 85 87 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 86 - uid [ultimate] Your Name <your.name@email> 87 - ssb nistp256/BBBBBBBBBBBBBBBB 2023-01-01 [E] 88 + uid [ultimate] Your Name <your.email@example.com> 89 + ssb nistp256/YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYY-MM-DD [E] 88 90 ``` 91 + The long Key ID is `XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX` (the 40-character string). 89 92 90 - Export your keys. 93 + Store this Key ID in 1Password. For example, create a "Secure Note" or "Login" item named "Git GPG Key" and add a field/label (e.g., `key_id`) with your GPG Key ID as the value. 91 94 92 - ```shell 93 - ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 94 - gpg --armor --export $ID > $file.gpg-key.pub 95 - gpg --armor --export-secret-keys $ID > $file.gpg-key 96 - ``` 95 + See `docs/1password-usage.md` for more on storing items in 1Password. 97 96 98 - Import already existing private key. 97 + ### 3. Configuring Git to Use the GPG Key (via `chezmoi` and 1Password) 99 98 100 - ```shell 101 - gpg --import $file.gpg-key 99 + As shown in the "Core Git Configuration" section, `dot_gitconfig.tmpl` is set up to fetch the `user.signingkey` from 1Password: 100 + 101 + ```ini 102 + [user] 103 + signingkey = {{ (onepasswordRead "op://Personal/Git GPG Key/key_id").stdout | trim | quote }} 102 104 ``` 105 + Ensure the 1Password item path (`op://Personal/Git GPG Key/key_id`) in your `dot_gitconfig.tmpl` matches where you stored the key ID in 1Password. 106 + `chezmoi apply` will populate your `~/.gitconfig` with this signing key. 103 107 104 - Remove keys from the GPG agent if no longer needed. 108 + ### 4. Adding GPG Public Key to GitHub 105 109 106 - ```shell 107 - gpg --delete-secret-keys $ID 108 - gpg --delete-keys $ID 109 - ``` 110 + To have GitHub show your commits as "Verified": 110 111 111 - Configure Git to use the new key. 112 + 1. Export your GPG public key: 113 + ```sh 114 + gpg --armor --export XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX # Use your Key ID 115 + ``` 116 + 2. Copy the entire output (starting with `-----BEGIN PGP PUBLIC KEY BLOCK-----`). 117 + 3. Go to [GitHub GPG keys settings](https://github.com/settings/keys) and add the new GPG key. 112 118 113 - ```shell 114 - git config user.signingkey $ID 119 + ### 5. GPG Agent Configuration 120 + 121 + To avoid entering your GPG passphrase for every commit, configure the `gpg-agent` to cache it. `chezmoi` manages `~/.gnupg/gpg-agent.conf`: 122 + 115 123 ``` 124 + # Example content for gpg-agent.conf.tmpl 125 + # Managed by chezmoi 116 126 117 - Upload the public key to your GitHub profile into the [GPG keys](https://github.com/settings/keys) section. After doing so, please make sure your email address appears as verified against the commits pushed to the remote. 127 + pinentry-program {{ .pinentryProgram | quote }} # Path to pinentry, templated by chezmoi 128 + default-cache-ttl 10800 # Cache passphrase for 3 hours 129 + max-cache-ttl 10800 # Max cache time 130 + ``` 131 + `chezmoi` templates can determine the correct `pinentry-program` path based on your OS. 132 + After changes, you might need to restart the agent: `gpgconf --kill gpg-agent`. 133 + 134 + ### 6. Troubleshooting GPG Signing 135 + 136 + * **Error: `gpg failed to sign the data` or `Inappropriate ioctl for device`**: 137 + Ensure `export GPG_TTY=$(tty)` is in your shell configuration (e.g., `~/.exports` or `~/.zshrc`, managed by `chezmoi`). This allows GPG to prompt for a passphrase in the current terminal. 138 + ```sh 139 + # Ensure this line is in a chezmoi-managed shell startup file: 140 + # export GPG_TTY=$(tty) 141 + ``` 142 + Restart your shell or source the updated file. 143 + * **No Pinentry Program Found**: Ensure `pinentry` is installed (e.g., `brew install pinentry-mac` on macOS) and `gpg-agent.conf` points to the correct program. 144 + * **Secret Key Not Available**: Verify the key ID in `~/.gitconfig` matches a private key in your `gpg --list-secret-keys` output. 145 + 146 + ## GitHub CLI Authentication (`gh auth login`) 147 + 148 + While Git uses SSH or HTTPS (often with a credential helper) for repository access, the GitHub CLI (`gh`) requires its own authentication. 118 149 119 - ```shell 120 - cat $file.gpg-key.pub 150 + ```sh 151 + gh auth login 121 152 ``` 153 + Follow the prompts. Authenticating with a web browser (HTTPS) is often simplest. 154 + Refer to `docs/github-usage.md` for more on using `gh`. 122 155 123 - ### Troubleshooting 156 + ## Common Git Workflows and Useful Commands 124 157 125 - If you receive the error message "error: gpg failed to sign the data", make sure you added `export GPG_TTY=$TTY` to your `~/.zshrc` or other file that is sourced by it, like `~/.exports` and restarted your terminal. 158 + ### Basic Workflow 126 159 127 - ```shell 128 - sed -i '/^export GPG_TTY/d' ~/.exports 129 - echo "export GPG_TTY=\$TTY" >> ~/.exports 160 + ```sh 161 + git pull # Fetch and integrate changes from remote 162 + git add . # Stage all changes in the current directory 163 + # Or git add <file1> <file2> ... to stage specific files 164 + git commit -S -m "Your descriptive commit message" # Create a signed commit 165 + git push # Push changes to the remote repository 130 166 ``` 131 167 132 - ## Additional settings 168 + ### Branching 169 + 170 + * Create a new branch and switch to it: 171 + ```sh 172 + git checkout -b new-feature-branch 173 + ``` 174 + * Switch to an existing branch: 175 + ```sh 176 + git checkout main 177 + ``` 178 + * Delete a local branch (after merging): 179 + ```sh 180 + git branch -d feature-branch # Safe delete (only if merged) 181 + git branch -D feature-branch # Force delete 182 + ``` 183 + * Push a new local branch to remote and set up tracking: 184 + ```sh 185 + git push -u origin new-feature-branch 186 + ``` 187 + 188 + ### Stashing Changes 133 189 134 - Configure caching git commit signature passphrase for 3 hours 190 + Temporarily save uncommitted changes: 135 191 136 - ```shell 137 - source ~/.zshrc 138 - mkdir -p ~/.gnupg 139 - sed -i '/^pinentry-program/d' ~/.gnupg/gpg-agent.conf 2>/dev/null ||: 140 - echo "pinentry-program $(whereis -q pinentry)" >> ~/.gnupg/gpg-agent.conf 141 - sed -i '/^default-cache-ttl/d' ~/.gnupg/gpg-agent.conf 142 - echo "default-cache-ttl 10800" >> ~/.gnupg/gpg-agent.conf 143 - sed -i '/^max-cache-ttl/d' ~/.gnupg/gpg-agent.conf 144 - echo "max-cache-ttl 10800" >> ~/.gnupg/gpg-agent.conf 145 - gpgconf --kill gpg-agent 192 + ```sh 193 + git stash push -m "WIP: some changes for later" 194 + git stash list 195 + git stash apply stash@{0} # Apply a specific stash 196 + git stash pop # Apply the latest stash and remove it from the list 197 + git stash drop stash@{0} # Remove a specific stash 146 198 ``` 147 199 148 - Please, see the [`assets/03-install-developer-tools.macos.sh`](https://github.com/make-ops-tools/dotfiles/blob/main/assets/03-install-developer-tools.macos.sh) file, as this section is part of the automated configuration. 200 + ### Viewing History 201 + 202 + * Compact log view: 203 + ```sh 204 + git log --oneline --graph --decorate --all 205 + ``` 206 + (Consider creating a Git alias like `git la` for this.) 207 + * View changes for a specific commit: 208 + ```sh 209 + git show <commit_hash> 210 + ``` 211 + * View changes for a specific file: 212 + ```sh 213 + git log -p -- <file_path> 214 + ``` 215 + 216 + ### Squashing Commits 217 + 218 + Combine multiple commits into a single one, often done before merging a feature branch. 149 219 150 - Authenticate to GitHub and set up your authorisation token 220 + * Interactively rebase onto `main` (or your target branch), squashing commits from your current feature branch: 221 + ```sh 222 + # Assuming you are on your feature branch that branched off main 223 + git rebase -i main 224 + ``` 225 + In the interactive editor, change `pick` to `s` (squash) or `f` (fixup) for commits you want to merge into the preceding one. Edit commit messages as needed. 226 + * Force push (with lease) if you've rewritten history on a shared branch (use with caution): 227 + ```sh 228 + git push --force-with-lease 229 + ``` 151 230 152 - ```shell 153 - $ gh auth login 154 - ? What account do you want to log into? GitHub.com 155 - ? What is your preferred protocol for Git operations? HTTPS 156 - ? Authenticate Git with your GitHub credentials? No 157 - ? How would you like to authenticate GitHub CLI? Paste an authentication token 158 - Tip: you can generate a Personal Access Token here https://github.com/settings/tokens 159 - The minimum required scopes are 'repo', 'read:org'. 160 - ? Paste your authentication token: github_pat_********************************************************************************** 161 - - gh config set -h github.com git_protocol https 162 - ✓ Configured git protocol 163 - ✓ Logged in as your-github-handle 231 + Alternatively, the example from the previous version for squashing all commits on a branch into one based on `main`: 232 + ```sh 233 + # git checkout your-feature-branch 234 + # git reset $(git merge-base main $(git branch --show-current)) 235 + # git add . 236 + # git commit -S -m "New single commit message for the feature" 237 + # git push --force-with-lease origin your-feature-branch 164 238 ``` 165 239 166 - ## Useful commands 240 + ### Tags 167 241 168 - Add your changes, create a signed commit, update from and push to remote 242 + Create lightweight or annotated tags for releases: 169 243 170 - ```shell 171 - git add . 172 - git commit -S -m "Create a signed commit" 173 - git pull 174 - git push 244 + ```sh 245 + git tag v1.0.0 # Lightweight tag 246 + git tag -a v1.0.1 -m "Version 1.0.1 release" # Annotated tag (signed if gpgsign=true) 247 + git push origin v1.0.1 # Push a specific tag 248 + git push --tags # Push all tags 175 249 ``` 176 250 177 - Squash all commits on branch as one 251 + ## Resources 252 + 253 + * **Pro Git Book**: [https://git-scm.com/book/en/v2](https://git-scm.com/book/en/v2) (Excellent, comprehensive guide) 254 + * **Git Reference Documentation**: [https://git-scm.com/docs](https://git-scm.com/docs) 255 + * **GitHub GPG Signing Documentation**: [https://docs.github.com/en/authentication/managing-commit-signature-verification](https://docs.github.com/en/authentication/managing-commit-signature-verification) 256 + * **1Password Documentation**: See `docs/1password-usage.md` 257 + * **GitHub CLI Documentation**: See `docs/github-usage.md` 178 258 179 - ```shell 180 - git checkout your-branch-name 181 - git reset $(git merge-base main $(git branch --show-current)) 182 - git add . 183 - git commit -S -m "Create just one commit instead" 184 - git push --force-with-lease 185 - ``` 259 + This guide covers key Git practices for this dotfiles setup. Consistent use of signed commits and a clean history are encouraged.
+106 -3
docs/github-usage.md
··· 1 1 # GitHub Usage 2 2 3 - - [GitHub Usage](#github-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document provides guidance on interacting with GitHub, primarily focusing on the GitHub CLI tool (`gh`) and general best practices. 4 + 5 + ## Overview 6 + 7 + GitHub is a platform for version control and collaboration using Git. The GitHub CLI (`gh`) brings GitHub to your terminal, allowing you to manage repositories, pull requests, issues, and more without leaving the command line. 8 + 9 + ## GitHub CLI (`gh`) 10 + 11 + The GitHub CLI is the preferred way to interact with GitHub programmatically and from the terminal for many tasks. 12 + 13 + ### Installation 14 + 15 + The GitHub CLI is typically installed via Homebrew if specified in your `chezmoi` configurations: 16 + ```sh 17 + brew install gh 18 + ``` 19 + Refer to the [official installation guide](https://github.com/cli/cli#installation) for other methods. 20 + 21 + ### Authentication 22 + 23 + After installation, you need to authenticate `gh` with your GitHub account: 24 + ```sh 25 + gh auth login 26 + ``` 27 + Follow the prompts. Using `HTTPS` and authenticating with web browser is often the easiest method. 28 + 29 + ### Common `gh` Commands 30 + 31 + * **Repository Commands (`gh repo ...`)** 32 + * Clone a repository: 33 + ```sh 34 + gh repo clone <owner>/<repository_name> 35 + # Example: gh repo clone cli/cli 36 + ``` 37 + * Create a new repository: 38 + ```sh 39 + gh repo create <repository_name> [options] 40 + # Example: gh repo create my-new-project --public --source=. 41 + ``` 42 + * View a repository in the browser: 43 + ```sh 44 + gh repo view --web 45 + ``` 46 + 47 + * **Pull Request Commands (`gh pr ...`)** 48 + * List pull requests: 49 + ```sh 50 + gh pr list 51 + ``` 52 + * View a specific pull request: 53 + ```sh 54 + gh pr view <pr_number_or_branch_name> 55 + # View in browser: gh pr view <pr_number_or_branch_name> --web 56 + ``` 57 + * Checkout a pull request locally: 58 + ```sh 59 + gh pr checkout <pr_number_or_branch_name> 60 + ``` 61 + * Create a pull request: 62 + ```sh 63 + gh pr create [options] 64 + # Example (prompts for title, body, base branch, etc.): 65 + # gh pr create 66 + # Example (with details): 67 + # gh pr create --title "My Awesome Feature" --body "Details about the feature." --base main 68 + ``` 69 + * Diff a pull request: 70 + ```sh 71 + gh pr diff <pr_number_or_branch_name> 72 + ``` 5 73 6 - ## TODO: Create documentation 74 + * **Issue Commands (`gh issue ...`)** 75 + * List issues: 76 + ```sh 77 + gh issue list 78 + ``` 79 + * View an issue: 80 + ```sh 81 + gh issue view <issue_number> 82 + # View in browser: gh issue view <issue_number> --web 83 + ``` 84 + * Create an issue: 85 + ```sh 86 + gh issue create --title "My Issue Title" --body "Issue details." 87 + ``` 88 + 89 + * **Alias Management (`gh alias ...`)** 90 + * `gh` supports creating aliases for complex commands. Example: 91 + ```sh 92 + gh alias set myprs "pr list --author @me" 93 + gh myprs # Runs the aliased command 94 + ``` 95 + 96 + ## Git Configuration for GitHub 97 + 98 + Ensure your local Git configuration (see `docs/git-usage.md`) is set up correctly with your GitHub username and email, especially if you contribute to multiple repositories or use different identities. 99 + 100 + SSH keys are recommended for `git push/pull` operations with GitHub for better security and convenience. Refer to GitHub's documentation on [generating a new SSH key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and [adding it to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account). 101 + 102 + ## Resources 103 + 104 + * **GitHub CLI Official Documentation**: [https://cli.github.com/manual/](https://cli.github.com/manual/) 105 + * **GitHub CLI GitHub Repository**: [https://github.com/cli/cli](https://github.com/cli/cli) 106 + * **GitHub Help Documentation**: [https://docs.github.com/](https://docs.github.com/) 107 + * **GitHub SSH Key Setup**: [Connecting to GitHub with SSH](https://docs.github.com/en/authentication/connecting-to-github-with-ssh) 108 + 109 + This document provides a basic overview. The GitHub CLI is very powerful; explore its manual for more commands and options.
+135 -4
docs/go-usage.md
··· 1 - # Go Usage 1 + # Go (Golang) Usage 2 + 3 + This document provides a guide to setting up and using the Go programming language, including managing versions and common commands. 4 + 5 + ## Overview 6 + 7 + [Go](https://go.dev/) (often referred to as Golang) is an open-source programming language designed by Google. It is known for its simplicity, efficiency, strong support for concurrency, and robust standard library. 8 + 9 + ## Installation 10 + 11 + There are several ways to install Go: 12 + 13 + * **Official Installers**: Download from [go.dev/dl/](https://go.dev/dl/). 14 + * **Homebrew (macOS)**: 15 + ```sh 16 + brew install go 17 + ``` 18 + This usually installs the latest stable version. 19 + * **Go Version Manager (`goenv`)** (Recommended for managing multiple Go versions): 20 + [goenv](https://github.com/syndbg/goenv) lets you easily switch between multiple versions of Go. It's similar to `pyenv` for Python or `tfenv` for Terraform. 21 + 22 + **Installation of `goenv` (macOS with Homebrew):** 23 + ```sh 24 + brew install goenv 25 + ``` 26 + For other systems or manual install, see the [goenv installation guide](https://github.com/syndbg/goenv#installation). 27 + 28 + **Using `goenv`:** 29 + 1. Initialize `goenv` in your shell (add to `.zshrc` or `.bashrc`, managed by `chezmoi`): 30 + ```sh 31 + # Example for .zshrc 32 + # if command -v goenv 1>/dev/null 2>&1; then 33 + # eval "$(goenv init -)" 34 + # fi 35 + ``` 36 + 2. List available Go versions to install: 37 + ```sh 38 + goenv install -l 39 + ``` 40 + 3. Install a specific Go version: 41 + ```sh 42 + goenv install <version> 43 + # Example: goenv install 1.18.3 44 + ``` 45 + 4. Set global or local (per-project) Go version: 46 + ```sh 47 + goenv global <version> # Sets the default Go version 48 + goenv local <version> # Creates a .go-version file in the current directory 49 + ``` 50 + 51 + If `chezmoi` manages your Go installation, it will handle the chosen installation method. 52 + 53 + ## Environment Variables 54 + 55 + Go uses several environment variables to configure its behavior: 56 + 57 + * **`GOROOT`**: The root of your Go installation (e.g., `/usr/local/go` or a path managed by `goenv`). Usually set automatically. 58 + * **`GOPATH`**: Defines the root of your workspace. Before Go Modules, it was crucial for organizing Go code and compiled binaries. With Go Modules, its role has diminished but it still defines a default location for `go install` outside a module (`$HOME/go` by default). 59 + * **`GOBIN`**: The directory where `go install` will place compiled binaries (if set). If not set, binaries are placed in `$GOPATH/bin` (or `$HOME/go/bin`). 60 + * **`GO111MODULE`**: Controls Go Modules behavior. 61 + * `on`: Forces module-aware mode (default in Go 1.16+). 62 + * `auto`: Enables module mode if a `go.mod` file is present in the current or any parent directory. 63 + * `off`: Disables module mode, uses `GOPATH` mode. 64 + 65 + These are typically set in your shell profile (`.zshrc`, `.bash_profile`), managed by `chezmoi`. 66 + 67 + ## Basic Go Commands 68 + 69 + * **`go version`**: Displays the current Go version. 70 + ```sh 71 + go version 72 + ``` 73 + 74 + * **`go run <filename.go>`**: Compiles and runs a Go program. 75 + ```sh 76 + go run main.go 77 + ``` 78 + 79 + * **`go build [packages]`**: Compiles packages and their dependencies. Creates an executable in the current directory (for `main` packages). 80 + ```sh 81 + go build 82 + go build ./cmd/myprogram 83 + ``` 84 + 85 + * **`go install [packages]`**: Compiles and installs packages. Executables are placed in `$GOBIN` or `$GOPATH/bin`. 86 + ```sh 87 + go install github.com/user/project/cmd/mytool@latest 88 + ``` 89 + 90 + * **`go test [packages]`**: Runs tests for the specified packages. 91 + ```sh 92 + go test ./... 93 + go test -v ./mypackage 94 + ``` 95 + 96 + * **`go get [packages]`**: (Legacy behavior with Go Modules) Adds dependencies to `go.mod` and installs them. For installing tools, prefer `go install tool@version`. 97 + 98 + ## Go Modules 99 + 100 + Go Modules are used for dependency management. 101 + 102 + * **`go mod init <module_path>`**: Initializes a new module in the current directory, creating a `go.mod` file. 103 + ```sh 104 + go mod init github.com/myuser/myproject 105 + ``` 106 + 107 + * **`go mod tidy`**: Adds missing and removes unused modules from `go.mod` and `go.sum`. 108 + ```sh 109 + go mod tidy 110 + ``` 111 + 112 + * **`go mod download`**: Downloads modules to the local cache. 113 + ```sh 114 + go mod download 115 + ``` 2 116 3 - - [Go Usage](#go-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 117 + * **`go list -m all`**: Lists all modules used in the current project. 5 118 6 - ## TODO: Create documentation 119 + ## Common Go Tools 120 + 121 + * **`gofmt`**: Formats Go programs. 122 + ```sh 123 + gofmt -w main.go # Formats and writes back to file 124 + ``` 125 + * **`goimports`**: Updates your Go import lines, adding missing and removing unreferenced ones (superset of `gofmt`). Install with `go install golang.org/x/tools/cmd/goimports@latest`. 126 + * **`golint` / `staticcheck` / `golangci-lint`**: Linters for Go code. `golangci-lint` is a popular meta-linter. 127 + 128 + ## Resources 129 + 130 + * **Official Go Website**: [https://go.dev/](https://go.dev/) 131 + * **Go Documentation**: [https://go.dev/doc/](https://go.dev/doc/) 132 + * **Effective Go (Best Practices)**: [https://go.dev/doc/effective_go](https://go.dev/doc/effective_go) 133 + * **Go Modules Reference**: [https://go.dev/ref/mod](https://go.dev/ref/mod) 134 + * **`goenv` GitHub Repository**: [https://github.com/syndbg/goenv](https://github.com/syndbg/goenv) 135 + * **Go Playground**: [https://go.dev/play/](https://go.dev/play/) 136 + 137 + This document provides a starting point for working with Go. Refer to the official documentation for more in-depth information.
+90 -4
docs/kubernetes-usage.md
··· 1 - # Kubernetes Usage 1 + # Kubernetes (k8s) Usage 2 + 3 + This document provides a guide to interacting with Kubernetes clusters, focusing on `kubectl` (the Kubernetes command-line tool) and common helper utilities. 4 + 5 + ## Overview 6 + 7 + [Kubernetes](https://kubernetes.io/) (commonly stylized as k8s) is an open-source system for automating deployment, scaling, and management of containerized applications. 8 + 9 + ## `kubectl`: The Kubernetes CLI 10 + 11 + `kubectl` is the primary command-line tool for running commands against Kubernetes clusters. It allows you to deploy applications, inspect and manage cluster resources, and view logs. 12 + 13 + ### Installation 14 + 15 + * **Homebrew (macOS)**: 16 + ```sh 17 + brew install kubectl 18 + ``` 19 + * **Official Guides**: For other operating systems or specific versions, refer to the [official Kubernetes documentation on installing `kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/). 20 + 21 + Installation might be managed by `chezmoi` if `kubectl` is part of your standard toolset. 22 + 23 + ### Configuration (`kubeconfig`) 24 + 25 + `kubectl` uses a configuration file, typically located at `~/.kube/config`, to store cluster access information (server endpoints, user credentials, namespaces, contexts). 26 + 27 + * **Multiple Clusters**: The `kubeconfig` file can define multiple clusters and contexts. 28 + * **Context Switching**: Use `kubectl config use-context <context_name>` to switch between defined contexts. 29 + * **Environment Variable**: You can specify a different kubeconfig file by setting the `KUBECONFIG` environment variable: 30 + ```sh 31 + export KUBECONFIG=~/.kube/custom-config:~/.kube/another-config 32 + ``` 33 + * **Security**: Kubeconfig files can contain sensitive credentials. 34 + * Avoid committing them directly to public repositories. 35 + * Consider using tools that dynamically generate or fetch credentials (e.g., `aws eks update-kubeconfig` for Amazon EKS, `gcloud container clusters get-credentials` for GKE). 36 + * If you must store parts of a kubeconfig managed by `chezmoi`, ensure sensitive fields are templated and sourced from a secrets manager like 1Password (see `docs/1password-usage.md`). 37 + 38 + ## Common `kubectl` Commands 2 39 3 - - [Kubernetes Usage](#kubernetes-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 40 + * **Cluster Information & Contexts**: 41 + * `kubectl cluster-info`: Display endpoint information about the master and services. 42 + * `kubectl config get-contexts`: List available contexts. 43 + * `kubectl config current-context`: Display the current context. 44 + * `kubectl config use-context <context_name>`: Switch to a different context. 5 45 6 - ## TODO: Create documentation 46 + * **Viewing Resources**: 47 + * `kubectl get nodes`: List all nodes in the cluster. 48 + * `kubectl get pods [-n <namespace>] [-o wide]`: List pods in a namespace (add `-A` or `--all-namespaces` for all). 49 + * `kubectl get services [-n <namespace>]`: List services. 50 + * `kubectl get deployments [-n <namespace>]`: List deployments. 51 + * `kubectl get namespaces`: List all namespaces. 52 + * `kubectl describe pod <pod_name> [-n <namespace>]`: Show detailed information about a pod. 53 + * `kubectl describe node <node_name>`: Show detailed information about a node. 54 + 55 + * **Interacting with Pods**: 56 + * `kubectl logs <pod_name> [-n <namespace>] [-c <container_name>]`: Print the logs for a container in a pod. 57 + * `kubectl logs -f <pod_name>`: Follow log output. 58 + * `kubectl exec -it <pod_name> [-n <namespace>] [-c <container_name>] -- <command>`: Execute a command in a container. 59 + * Example (get a shell): `kubectl exec -it my-pod -- /bin/sh` 60 + * `kubectl cp <file_path> <pod_name>:<path_in_pod>`: Copy files and directories to and from containers. 61 + 62 + * **Managing Applications**: 63 + * `kubectl apply -f <filename.yaml_or_directory>`: Apply a configuration to a resource by filename or stdin. 64 + * `kubectl delete -f <filename.yaml>`: Delete resources defined in a file. 65 + * `kubectl delete pod <pod_name> [-n <namespace>]`: Delete a pod. 66 + * `kubectl scale deployment <deployment_name> --replicas=<count>`: Scale a deployment. 67 + 68 + * **Port Forwarding**: 69 + * `kubectl port-forward <pod_name_or_service/service_name> <local_port>:<remote_port>`: Forward one or more local ports to a pod or service. 70 + * Example: `kubectl port-forward svc/my-service 8080:80` 71 + 72 + ## Helper Tools & Ecosystem 73 + 74 + * **[k9s](https://k9scli.io/)**: A terminal-based UI to interact with your Kubernetes clusters. Highly recommended for easier navigation and management. 75 + * Installation (Homebrew): `brew install k9s` 76 + * **[kubectx + kubens](https://github.com/ahmetb/kubectx)**: Tools to switch between Kubernetes contexts (`kubectx`) and namespaces (`kubens`) more easily. 77 + * Installation (Homebrew): `brew install kubectx` 78 + * **[Helm](https://helm.sh/)**: The package manager for Kubernetes. Helps you manage Kubernetes applications through Helm Charts. 79 + * Installation (Homebrew): `brew install helm` 80 + * **[Lens](https://k8slens.dev/)**: A popular open-source Kubernetes IDE for managing clusters. 81 + * **[Stern](https://github.com/stern/stern)**: Multi-pod and container log tailing for Kubernetes. 82 + 83 + ## Resources 84 + 85 + * **Official Kubernetes Documentation**: [https://kubernetes.io/docs/](https://kubernetes.io/docs/) 86 + * **`kubectl` Cheat Sheet**: [https://kubernetes.io/docs/reference/kubectl/cheatsheet/](https://kubernetes.io/docs/reference/kubectl/cheatsheet/) 87 + * **`kubectl` Command Reference**: [https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands) 88 + * **k9s**: [https://k9scli.io/](https://k9scli.io/) 89 + * **kubectx + kubens**: [https://github.com/ahmetb/kubectx](https://github.com/ahmetb/kubectx) 90 + * **Helm**: [https://helm.sh/docs/](https://helm.sh/docs/) 91 + 92 + This document provides a starting point. Kubernetes is a complex system; refer to the official documentation and tool-specific guides for detailed information.
+129 -3
docs/python-usage.md
··· 1 1 # Python Usage 2 2 3 - - [Python Usage](#python-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document provides a guide to setting up and using Python for development, focusing on version management with `pyenv`, and modern project/dependency management with tools like Poetry and `venv`. 4 + 5 + ## Overview 6 + 7 + [Python](https://www.python.org/) is a versatile, high-level programming language. Effective Python development involves managing Python versions and project dependencies robustly. 8 + 9 + ## Python Version Management with `pyenv` 10 + 11 + It is highly recommended to use [pyenv](https://github.com/pyenv/pyenv) to manage multiple Python versions. 12 + 13 + ### Installation of `pyenv` 14 + 15 + * **Homebrew (macOS)**: 16 + ```sh 17 + brew install pyenv 18 + ``` 19 + * **Other Systems/Manual Install**: Follow the [official `pyenv` installation guide](https://github.com/pyenv/pyenv#installation). 5 20 6 - ## TODO: Create documentation 21 + ### `pyenv` Initialization 22 + 23 + Add `pyenv` init to your shell configuration file (e.g., `.zshrc`), managed by `chezmoi`: 24 + ```sh 25 + # Example for .zshrc 26 + # if command -v pyenv 1>/dev/null 2>&1; then 27 + # eval "$(pyenv init -)" 28 + # eval "$(pyenv virtualenv-init -)" # If using pyenv-virtualenv (optional) 29 + # fi 30 + ``` 31 + 32 + ### Installing Python Versions with `pyenv` 33 + 34 + 1. **List available Python versions**: `pyenv install --list` 35 + 2. **Install a Python version**: `pyenv install <version>` (e.g., `pyenv install 3.10.4`) 36 + 3. **Set Python version**: 37 + * **Globally**: `pyenv global <version>` 38 + * **Locally (per-project)**: `pyenv local <version>` (creates `.python-version`) 39 + * **Shell specific**: `pyenv shell <version>` 40 + 41 + ## Project & Dependency Management 42 + 43 + Isolating project dependencies is crucial. 44 + 45 + ### Option 1: Poetry (Recommended for New Projects) 46 + 47 + [Poetry](https://python-poetry.org/) is a modern tool for Python dependency management and packaging. It helps you declare, manage, and install dependencies of Python projects, ensuring you have the right stack everywhere. 48 + 49 + **Key Benefits of Poetry:** 50 + * **Dependency Resolution**: Advanced resolver for compatible dependencies. 51 + * **Unified Tool**: Manages project metadata, dependencies, virtual environments, building, and publishing. 52 + * **`pyproject.toml`**: Uses the standard `pyproject.toml` file to manage project information. 53 + * **Lock File**: Creates a `poetry.lock` file for deterministic builds. 54 + * **Virtual Environment Management**: Automatically creates and manages virtual environments for your projects. 55 + 56 + **Installation of Poetry:** 57 + 58 + Refer to the [official Poetry installation guide](https://python-poetry.org/docs/#installation). A common method is using their custom installer or `pipx`: 59 + ```sh 60 + # Using pipx (recommended for CLI tools) 61 + brew install pipx # If not already installed 62 + pipx ensurepath 63 + pipx install poetry 64 + 65 + # Or using the official installer 66 + # curl -sSL https://install.python-poetry.org | python3 - 67 + ``` 68 + 69 + **Common Poetry Commands:** 70 + 71 + * **`poetry new <project_name>`**: Creates a new Python project with a standard structure. 72 + * **`poetry init`**: Interactively creates a `pyproject.toml` in an existing project. 73 + * **`poetry install`**: Installs dependencies defined in `pyproject.toml` (and `poetry.lock`). If a virtual environment doesn't exist, Poetry creates one. 74 + * **`poetry add <package_name>`**: Adds a new dependency to `pyproject.toml` and installs it. 75 + * `poetry add requests` 76 + * `poetry add pytest --group dev` (for development dependencies) 77 + * **`poetry remove <package_name>`**: Removes a dependency. 78 + * **`poetry show`**: Lists all installed packages. 79 + * **`poetry update`**: Updates dependencies to their latest allowed versions according to `pyproject.toml` and updates `poetry.lock`. 80 + * **`poetry run <command>`**: Runs a command within the project's virtual environment. 81 + * `poetry run python my_script.py` 82 + * `poetry run pytest` 83 + * **`poetry shell`**: Activates the project's virtual environment in your current shell. 84 + * **`poetry build`**: Builds your project into a source archive (sdist) and a wheel (bdist_wheel). 85 + * **`poetry publish`**: Publishes your package to a repository like PyPI. 86 + 87 + Poetry can be configured to use Python versions installed by `pyenv`: 88 + ```sh 89 + poetry env use $(pyenv which python) # Or specify a path/version 90 + ``` 91 + 92 + ### Option 2: `venv` and `pip` (Traditional) 93 + 94 + Python 3.3+ includes the `venv` module for creating virtual environments. 95 + 96 + 1. **Create a virtual environment**: `python -m venv .venv` 97 + 2. **Activate**: 98 + * Unix/macOS: `source .venv/bin/activate` 99 + * Windows: `.\.venv\Scripts\activate.bat` or `.\.venv\Scripts\Activate.ps1` 100 + 3. **Deactivate**: `deactivate` 101 + 102 + **Package Management with `pip` (within an active `venv`)**: 103 + 104 + * Install: `pip install <package_name>`, `pip install -r requirements.txt` 105 + * List: `pip list` 106 + * Generate `requirements.txt`: `pip freeze > requirements.txt` 107 + 108 + ### `pyenv-virtualenv` (Plugin for `pyenv`) 109 + 110 + The [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv) plugin integrates `venv` management with `pyenv` if you prefer this workflow over Poetry's built-in virtual environment handling. 111 + 112 + ## Common Python Development Tools 113 + 114 + Install these within your project's virtual environment (via `poetry add --group dev tool_name` or `pip install tool_name`) or globally via `pipx`. 115 + 116 + * **Linters**: `flake8`, `pylint` 117 + * **Formatters**: `black`, `autopep8`, `isort` 118 + * **Test Runners**: `pytest`, `unittest` (built-in) 119 + * **`pipx`**: For installing and running Python CLI applications in isolated environments (`brew install pipx`). 120 + * Example: `pipx install black` 121 + 122 + ## Resources 123 + 124 + * **Official Python Documentation**: [https://docs.python.org/3/](https://docs.python.org/3/) 125 + * **`pyenv` GitHub Repository**: [https://github.com/pyenv/pyenv](https://github.com/pyenv/pyenv) 126 + * **Poetry Documentation**: [https://python-poetry.org/docs/](https://python-poetry.org/docs/) 127 + * **Python `venv` Documentation**: [https://docs.python.org/3/library/venv.html](https://docs.python.org/3/library/venv.html) 128 + * **`pip` Documentation**: [https://pip.pypa.io/](https://pip.pypa.io/) 129 + * **Python Packaging User Guide**: [https://packaging.python.org/](https://packaging.python.org/) 130 + * **`pipx`**: [https://pipx.pypa.io/](https://pipx.pypa.io/) 131 + 132 + This document covers essentials for a modern Python development setup. Choose the tools that best fit your project needs.
+78 -8
docs/system-usage.md
··· 1 - # System Usage 1 + # System Usage & OS-Specific Notes 2 + 3 + This document outlines system-level configurations, OS-specific notes, and common utilities relevant to this dotfiles setup across different operating systems. 4 + 5 + ## Overview 6 + 7 + These dotfiles aim to provide a consistent experience across macOS, Linux (primarily Ubuntu), and Windows (via WSL). `chezmoi` plays a crucial role in managing OS-specific configurations by using templates and conditional logic based on the operating system. 2 8 3 - - [System Usage](#system-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 9 + ## General Principles 10 + 11 + * **`chezmoi` for OS Detection**: `chezmoi` templates often use variables like `.chezmoi.os` (e.g., "darwin", "linux", "windows") to apply OS-specific settings or install different packages. 12 + * **Homebrew/Linuxbrew**: Homebrew (on macOS) and Linuxbrew (on Linux) are heavily utilized for package management. See `Brewfile` or `chezmoi` scripts for lists of managed packages. 13 + * **Common Utilities**: Many command-line utilities are installed for enhanced productivity. Some common examples that might be included (and configured by these dotfiles) are: 14 + * `exa` or `lsd` (modern `ls` replacements) 15 + * `bat` (a `cat` clone with syntax highlighting) 16 + * `fd` (a simple, fast, and user-friendly alternative to `find`) 17 + * `ripgrep` (`rg`) (a line-oriented search tool that recursively searches your current directory for a regex pattern) 18 + * `fzf` (a command-line fuzzy finder) 19 + * `zoxide` (a smarter `cd` command) 20 + * `htop` or `btop` (interactive process viewers) 5 21 6 - ## TODO: Create documentation 22 + ## macOS Specifics 7 23 8 - - macOS 9 - - Ubutnu 10 - - Windows (Ubuntu WSL) 11 - - GitHub Codespaces 24 + * **Package Manager**: [Homebrew](https://brew.sh/) is the primary package manager. 25 + * **Shell**: Zsh, configured via `oh-my-zsh` and `oh-my-posh` (see `docs/terminal-usage.md`). 26 + * **Finder Tweaks**: Your `chezmoi` setup might include scripts to apply common Finder settings (e.g., show hidden files, show path bar). 27 + * Example commands (often found in `run_once_` scripts): 28 + ```sh 29 + # Show hidden files 30 + # defaults write com.apple.finder AppleShowAllFiles -bool true 31 + # Show path bar 32 + # defaults write com.apple.finder ShowPathbar -bool true 33 + # Restart Finder to apply changes 34 + # killall Finder 35 + ``` 36 + * **Keyboard Shortcuts/Remapping**: Tools like Karabiner-Elements might be used for advanced keyboard customization (if included in your setup). 37 + * **Spotlight**: Useful for launching applications and finding files (`Cmd+Space`). 38 + * **System Updates**: `sudo softwareupdate -i -a` 39 + 40 + ## Linux (Ubuntu Focus) 41 + 42 + * **Package Manager**: `apt` is the system package manager. [Linuxbrew](https://docs.brew.sh/Homebrew-on-Linux) might also be used for user-space packages. 43 + * **Shell**: Zsh, configured via `oh-my-zsh` and `oh-my-posh` (see `docs/terminal-usage.md`). 44 + * **System Updates**: 45 + ```sh 46 + sudo apt update && sudo apt upgrade -y 47 + sudo apt autoremove -y # To remove unused packages 48 + ``` 49 + * **Firewall**: `ufw` (Uncomplicated Firewall) is commonly used. 50 + ```sh 51 + # sudo ufw status 52 + # sudo ufw enable 53 + # sudo ufw allow ssh 54 + ``` 55 + 56 + ## Windows (via WSL - Windows Subsystem for Linux) 57 + 58 + * **WSL Version**: It's recommended to use WSL 2 for better performance and system call compatibility. 59 + * **Distribution**: Typically Ubuntu is used within WSL, so many Linux notes apply. 60 + * **Accessing Windows Files**: Windows drives are typically mounted under `/mnt/` (e.g., `/mnt/c`). 61 + * **Windows Terminal**: Recommended for a better WSL experience. 62 + * **Interoperability**: You can run Windows executables from WSL and Linux executables from Windows (PowerShell/CMD). 63 + * **Docker Desktop with WSL Backend**: Often used for Docker development on Windows. 64 + 65 + ## GitHub Codespaces 66 + 67 + GitHub Codespaces typically run a Linux environment (often Ubuntu-based). 68 + * **Dotfiles Integration**: Your dotfiles can be automatically installed into Codespaces if configured in your GitHub settings. 69 + * **`devcontainer.json`**: Projects can define specific configurations for Codespaces using a `devcontainer.json` file, which can include features, extensions, and post-create commands. 70 + * The environment is largely Linux-based, so Linux configurations from your dotfiles will apply. 71 + 72 + ## Resources 73 + 74 + * **macOS User Guide**: [https://support.apple.com/guide/mac-help/welcome/mac](https://support.apple.com/guide/mac-help/welcome/mac) 75 + * **Ubuntu Server Guide / Desktop Guide**: [https://ubuntu.com/server/docs](https://ubuntu.com/server/docs), [https://ubuntu.com/desktop/docs](https://ubuntu.com/desktop/docs) 76 + * **Windows Subsystem for Linux (WSL) Documentation**: [https://docs.microsoft.com/en-us/windows/wsl/](https://docs.microsoft.com/en-us/windows/wsl/) 77 + * **Chezmoi Documentation (OS specific logic)**: [https://www.chezmoi.io/user-guide/templating/#variables](https://www.chezmoi.io/user-guide/templating/#variables) 78 + * **Homebrew**: [https://brew.sh/](https://brew.sh/) 79 + * **Linuxbrew**: [https://docs.brew.sh/Homebrew-on-Linux](https://docs.brew.sh/Homebrew-on-Linux) 80 + 81 + This document provides a high-level overview. Specific configurations and scripts are managed by `chezmoi` and can be found within the repository.
+97 -15
docs/terminal-usage.md
··· 1 - # Terminal Usage 1 + # Terminal Setup and Usage 2 2 3 - - [Terminal Usage](#terminal-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document describes the terminal environment setup, including the shell, prompt, terminal emulators, and related tools used in this dotfiles configuration. 5 4 6 - ## TODO: Create documentation 5 + ## Overview 7 6 8 - - iTerm 7 + A customized and efficient terminal setup is crucial for productivity. This setup primarily revolves around Zsh, Oh My Zsh, Powerlevel10k/Oh My Posh for the prompt, and iTerm2 on macOS. 9 8 10 - Back up and restore iTerm configuration settings. 9 + ## Terminal Emulator 11 10 12 - ```shell 13 - defaults export com.googlecode.iterm2 assets/iterm2/com.googlecode.iterm2.plist 14 - plutil -convert xml1 -o assets/iterm2/com.googlecode.iterm2.xml assets/iterm2/com.googlecode.iterm2.plist 15 - cp assets/iterm2/com.googlecode.iterm2.xml assets/iterm2/settings.xml 16 - # Format `assets/iterm2/settings.xml` in vscode 17 - defaults import com.googlecode.iterm2 assets/iterm2/settings.xml 18 - ``` 11 + ### iTerm2 (macOS) 19 12 20 - - Oh-My-Zsh 21 - - Powerlevel10k 13 + [iTerm2](https://iterm2.com/) is a popular replacement for Apple's Terminal on macOS. It offers a wide range of features, including split panes, profiles, triggers, and extensive customization options. 14 + 15 + **Configuration Management with `chezmoi`**: 16 + 17 + iTerm2 settings are stored in a `.plist` file, typically `~/Library/Preferences/com.googlecode.iterm2.plist`. 18 + Your `chezmoi` setup might manage this file or a human-readable version (e.g., XML) of it. 19 + 20 + The commands previously noted for backup/restore can be adapted for `chezmoi`: 21 + 1. **Exporting current iTerm2 settings to XML (for `chezmoi` source directory)**: 22 + ```sh 23 + # Ensure the target directory in your chezmoi source exists, e.g., private_dot_config/iterm2/ 24 + TARGET_XML="$HOME/.local/share/chezmoi/private_dot_config/iterm2/com.googlecode.iterm2.plist.xml" # Adjust path as needed 25 + TEMP_PLIST=$(mktemp) 26 + defaults export com.googlecode.iterm2 "$TEMP_PLIST" 27 + plutil -convert xml1 -o "$TARGET_XML" "$TEMP_PLIST" 28 + rm "$TEMP_PLIST" 29 + echo "iTerm2 config exported to $TARGET_XML. Run 'chezmoi add private_dot_config/iterm2/com.googlecode.iterm2.plist.xml' if new." 30 + ``` 31 + Then, format `$TARGET_XML` if desired and `chezmoi add` / `chezmoi apply`. 32 + 33 + 2. **Importing settings from `chezmoi` (managed by `chezmoi apply`)**: 34 + If `chezmoi` manages an XML version, it might use a `run_script_` or template to convert it back to binary plist and import using `defaults import com.googlecode.iterm2 /path/to/your/plist/from/chezmoi` or directly manage the binary plist if `chezmoi`'s templating/symlinking handles it. 35 + 36 + * **Official Website**: [https://iterm2.com/](https://iterm2.com/) 37 + 38 + ### Other Terminal Emulators (Windows Terminal, Alacritty, etc.) 39 + For Linux and Windows (WSL), other terminal emulators like Windows Terminal, Alacritty, Kitty, etc., can be used. Configuration for these would be managed by `chezmoi` as well, typically by templating their respective configuration files. 40 + 41 + ## Shell: Zsh (Z Shell) 42 + 43 + [Zsh](https://www.zsh.org/) is a powerful shell with numerous features, including improved tab completion, command history, and customization options. 44 + 45 + ## Zsh Framework: Oh My Zsh 46 + 47 + [Oh My Zsh](https://ohmyz.sh/) is an open-source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, and themes. 48 + 49 + * **Installation**: Typically managed by `chezmoi` as part of the initial setup. 50 + * **Plugins**: Enhance functionality (e.g., `git`, `zsh-autosuggestions`, `zsh-syntax-highlighting`). Your `.zshrc` (managed by `chezmoi`) will list enabled plugins. 51 + * **Themes**: Oh My Zsh offers many themes, but this setup often uses a more specialized prompt theme engine like Powerlevel10k or Oh My Posh. 52 + * **Official Website**: [https://ohmyz.sh/](https://ohmyz.sh/) 53 + * **GitHub**: [https://github.com/ohmyzsh/ohmyzsh](https://github.com/ohmyzsh/ohmyzsh) 54 + 55 + ## Shell Prompt 56 + 57 + A highly customized and informative prompt is key for an efficient workflow. 58 + 59 + ### Powerlevel10k (p10k) 60 + 61 + [Powerlevel10k](https://github.com/romkatv/powerlevel10k) is a theme for Zsh. It emphasizes speed, flexibility, and an out-of-the-box awesome experience. It's known for its configuration wizard that helps you tailor the prompt to your liking. 62 + 63 + * **Installation**: Often installed as a theme for Oh My Zsh. 64 + * **Configuration**: Run `p10k configure` to go through the setup wizard. The resulting configuration (`~/.p10k.zsh`) is typically managed by `chezmoi`. 65 + * **Requires**: A Nerd Font or a font patched with Powerline symbols for icons to display correctly. 66 + * **GitHub**: [https://github.com/romkatv/powerlevel10k](https://github.com/romkatv/powerlevel10k) 67 + 68 + ### Oh My Posh 69 + 70 + [Oh My Posh](https://ohmyposh.dev/) is a custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable. It allows for finely tuned, themeable prompts. 71 + 72 + * **Installation**: Typically installed via Homebrew or other package managers. 73 + * **Configuration**: Defined by a JSON, TOML, or YAML theme file (e.g., `~/.config/omp.json` or similar, path defined in `.zshrc`). This theme file is managed by `chezmoi`. 74 + * **Requires**: A Nerd Font for icons. 75 + * **Official Website**: [https://ohmyposh.dev/](https://ohmyposh.dev/) 76 + 77 + *(Note: Your setup might use Powerlevel10k directly or use Oh My Posh with a p10k-like theme or another custom theme. Clarify which is primary if necessary in your `.zshrc` or this doc.)* 78 + 79 + ## Terminal Multiplexer: `tmux` (If Used) 80 + 81 + If [tmux](https://github.com/tmux/tmux/wiki) is part of your setup for managing multiple terminal sessions: 82 + * **Configuration**: `~/.tmux.conf` (managed by `chezmoi`). 83 + * **Plugin Manager**: [TPM (Tmux Plugin Manager)](https://github.com/tmux-plugins/tpm) might be used. 84 + * **Keybindings**: Custom keybindings would be defined in `.tmux.conf`. 85 + 86 + ## Key Fonts (Nerd Fonts) 87 + 88 + For icons and special symbols in prompts (Powerlevel10k, Oh My Posh) and other terminal applications (e.g., `lsd`, `bat`), [Nerd Fonts](https://www.nerdfonts.com/) are commonly used. These are popular programming fonts patched with a high number of glyphs (icons). 89 + 90 + * **Installation**: Download from Nerd Fonts website or install via Homebrew Cask (e.g., `brew tap homebrew/cask-fonts && brew install --cask font-hack-nerd-font`). 91 + * Ensure your terminal emulator (iTerm2, etc.) is configured to use a Nerd Font. 92 + 93 + ## Resources 94 + 95 + * **iTerm2**: [https://iterm2.com/](https://iterm2.com/) 96 + * **Zsh**: [https://www.zsh.org/](https://www.zsh.org/) 97 + * **Oh My Zsh**: [https://ohmyz.sh/](https://ohmyz.sh/) 98 + * **Powerlevel10k**: [https://github.com/romkatv/powerlevel10k](https://github.com/romkatv/powerlevel10k) 99 + * **Oh My Posh**: [https://ohmyposh.dev/](https://ohmyposh.dev/) 100 + * **Nerd Fonts**: [https://www.nerdfonts.com/](https://www.nerdfonts.com/) 101 + * **tmux**: [https://github.com/tmux/tmux/wiki](https://github.com/tmux/tmux/wiki) 102 + 103 + This document outlines the core components of the terminal setup. Specific configurations are managed by `chezmoi`.
+121 -9
docs/terraform-usage.md
··· 1 1 # Terraform Usage 2 2 3 - - [Terraform Usage](#terraform-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document provides a guide to using Terraform for managing infrastructure as code, including version management with `tfenv`. 4 + 5 + ## Overview 6 + 7 + [Terraform](https://www.terraform.io/) is an open-source infrastructure as code (IaC) software tool that enables you to safely and predictably create, change, and improve infrastructure. It codifies APIs into declarative configuration files. 8 + 9 + [tfenv](https://github.com/tfutils/tfenv) is a Terraform version manager, allowing you to easily switch between different versions of Terraform on a per-project basis. 10 + 11 + ## Installation 5 12 6 - ## TODO: Create documentation 13 + ### `tfenv` (Terraform Version Manager) 7 14 8 - - Package tfswitch 15 + It's recommended to install `tfenv` first to manage your Terraform versions. 9 16 10 - ```shell 11 - tfswitch -l 12 - tfswitch 1.0.0 13 - terraform --version 14 - which terraform 17 + **Installation (macOS with Homebrew):** 18 + ```sh 19 + brew install tfenv 15 20 ``` 21 + For other installation methods (e.g., Git clone), refer to the [tfenv installation guide](https://github.com/tfutils/tfenv#installation). 22 + 23 + **Post-installation:** 24 + Ensure `tfenv` is added to your shell's PATH. If installed via Homebrew, this is usually handled automatically. Otherwise, you might need to add `$(brew --prefix tfenv)/bin` (or the equivalent for your installation method) to your PATH. 25 + 26 + ### Terraform (via `tfenv`) 27 + 28 + Once `tfenv` is installed, you can install specific Terraform versions: 29 + 30 + 1. **List available Terraform versions**: 31 + ```sh 32 + tfenv list-remote 33 + ``` 34 + 35 + 2. **Install a specific version**: 36 + ```sh 37 + tfenv install <version> 38 + # Example: tfenv install 1.0.0 39 + ``` 40 + To install the latest stable version: 41 + ```sh 42 + tfenv install latest 43 + ``` 44 + 45 + 3. **Select a Terraform version to use**: 46 + * **Globally**: 47 + ```sh 48 + tfenv use <version> 49 + # Example: tfenv use 1.0.0 50 + ``` 51 + * **Per project (recommended)**: Create a `.terraform-version` file in your project's root directory containing the desired version number: 52 + ``` 53 + # .terraform-version 54 + 1.0.0 55 + ``` 56 + `tfenv` will automatically pick up this version when you `cd` into the directory. 57 + 58 + 4. **Verify installation**: 59 + ```sh 60 + terraform --version 61 + which terraform # Should point to a tfenv shim 62 + ``` 63 + 64 + ## Basic Terraform Workflow 65 + 66 + Terraform commands are typically run within a directory containing your `.tf` configuration files. 67 + 68 + 1. **`terraform init`**: Initializes a working directory containing Terraform configuration files. This is the first command that should be run after writing a new Terraform configuration or cloning an existing one. 69 + ```sh 70 + terraform init 71 + ``` 72 + This command also initializes backend configuration (for state storage) and downloads provider plugins. 73 + 74 + 2. **`terraform plan`**: Creates an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files. 75 + ```sh 76 + terraform plan 77 + # Save the plan to a file: 78 + # terraform plan -out=tfplan 79 + ``` 80 + This is a good way to check whether the proposed changes match your expectations before applying them. 81 + 82 + 3. **`terraform apply`**: Applies the changes required to reach the desired state of the configuration, or the pre-determined changes if a plan file is provided. 83 + ```sh 84 + terraform apply 85 + # Apply a saved plan (prompts for confirmation): 86 + # terraform apply tfplan 87 + # Auto-approve (use with caution): 88 + # terraform apply -auto-approve 89 + # Or apply a saved plan without prompting: 90 + # terraform apply -auto-approve tfplan 91 + ``` 92 + 93 + 4. **`terraform destroy`**: Destroys all remote objects managed by a particular Terraform configuration. 94 + ```sh 95 + terraform destroy 96 + ``` 97 + Use with extreme caution, as this will remove your managed infrastructure. 98 + 99 + ## Common Terraform Commands 100 + 101 + * **`terraform fmt`**: Rewrites Terraform configuration files to a canonical format and style. 102 + ```sh 103 + terraform fmt 104 + # Check for formatting issues: terraform fmt -check 105 + ``` 106 + * **`terraform validate`**: Validates the syntax and arguments of configuration files. 107 + ```sh 108 + terraform validate 109 + ``` 110 + * **`terraform output`**: Reads an output variable from a Terraform state file. 111 + ```sh 112 + terraform output <output_variable_name> 113 + ``` 114 + * **`terraform state list`**: Lists resources within a Terraform state file. 115 + ```sh 116 + terraform state list 117 + ``` 118 + * **`terraform workspace list/select/new/delete`**: Manages Terraform workspaces for different environments (e.g., dev, staging, prod). 119 + 120 + ## Resources 121 + 122 + * **Official Terraform Documentation**: [https://developer.hashicorp.com/terraform/docs](https://developer.hashicorp.com/terraform/docs) 123 + * **Terraform CLI Commands**: [https://developer.hashicorp.com/terraform/cli/commands](https://developer.hashicorp.com/terraform/cli/commands) 124 + * **`tfenv` GitHub Repository**: [https://github.com/tfutils/tfenv](https://github.com/tfutils/tfenv) 125 + * **Terraform Registry (Providers & Modules)**: [https://registry.terraform.io/](https://registry.terraform.io/) 126 + 127 + This document provides fundamental guidance. Terraform is a comprehensive tool; always refer to the official documentation for detailed information and best practices.
+83 -4
docs/user-apps-usage.md
··· 1 - # User Apps Usage 1 + # User Applications Usage 2 + 3 + This document lists common user (GUI) applications that are part of this development and productivity setup. It also notes if and how their configurations might be managed by `chezmoi`. 4 + 5 + ## Overview 6 + 7 + While `chezmoi` excels at managing command-line tool configurations (dotfiles), it can also help manage settings for some GUI applications, typically by symlinking or templating their preference files (e.g., `.plist` files on macOS, JSON/XML configs). 8 + 9 + Many applications are installed via Homebrew Cask on macOS. Check your `Brewfile` (if used with `chezmoi`) or `chezmoi` installation scripts for a list of managed applications. 10 + 11 + ## Common Application Categories & Examples 12 + 13 + Below are categories and examples of applications that might be part of your setup. Add your specific applications to these lists. 14 + 15 + ### Web Browsers 16 + 17 + * **[Google Chrome](https://www.google.com/chrome/)** 18 + * **Installation**: Homebrew Cask (`brew install --cask google-chrome`) or manual download. 19 + * **Configuration**: User profile settings are complex to manage directly with dotfiles. Consider using Chrome's built-in sync feature. 20 + * **[Mozilla Firefox](https://www.mozilla.org/firefox/)** 21 + * **Installation**: Homebrew Cask (`brew install --cask firefox`) or manual download. 22 + * **Configuration**: Profile-based. Some `user.js` customizations can be managed. 23 + * **[Safari](https://www.apple.com/safari/) (macOS)** 24 + * **Installation**: Comes with macOS. 25 + * **Configuration**: Some `.plist` files in `~/Library/Preferences/` or `~/Library/Containers/com.apple.Safari/Data/Library/Preferences/` might be manageable, but can be complex. 26 + 27 + ### Productivity Tools 28 + 29 + * **[Rectangle](https://rectangleapp.com/) (macOS Window Manager)** 30 + * **Installation**: Homebrew Cask (`brew install --cask rectangle`) or manual download. 31 + * **Configuration**: Preferences (`~/Library/Preferences/com.knollsoft.Rectangle.plist`) can often be managed by `chezmoi`. 32 + * **[Alfred](https://www.alfredapp.com/) (macOS Launcher & Productivity)** 33 + * **Installation**: Homebrew Cask (`brew install --cask alfred`) or manual download. 34 + * **Configuration**: Alfred preferences can be synced to a folder (e.g., Dropbox, iCloud Drive), and `chezmoi` could potentially manage a symlink to this sync folder or specific non-sensitive parts of its config if exported. 35 + * **[Obsidian](https://obsidian.md/) (Knowledge Base/Notes)** 36 + * **Installation**: Homebrew Cask (`brew install --cask obsidian`) or manual download. 37 + * **Configuration**: Vaults are user-managed. Some global configuration files might be linkable. 38 + * **Password Manager (GUI)** 39 + * **1Password**: (Covered in `docs/1password-usage.md` for CLI, GUI is complementary) 40 + * **Installation**: Download from [1Password website](https://1password.com/downloads/). 41 + 42 + ### Development Tools (GUI) 43 + 44 + * **[Visual Studio Code](https://code.visualstudio.com/)**: (Covered in detail in `docs/vscode-usage.md`) 45 + * **[Docker Desktop](https://www.docker.com/products/docker-desktop/)**: (Covered in `docs/docker-usage.md`) 46 + * **Database GUI Clients** (e.g., TablePlus, DBeaver, pgAdmin) 47 + * **Example: [TablePlus](https://tableplus.com/)** 48 + * **Installation**: Homebrew Cask (`brew install --cask tableplus`) or manual download. 49 + * **Configuration**: Connection details are typically managed within the app; general preferences might be in a `.plist` file. 50 + * **API Clients** (e.g., Postman, Insomnia) 51 + * **Example: [Postman](https://www.postman.com/)** 52 + * **Installation**: Homebrew Cask (`brew install --cask postman`) or manual download. 53 + * **Configuration**: Typically uses cloud sync for collections and environments. 54 + 55 + ### Communication 56 + 57 + * **[Slack](https://slack.com/)** 58 + * **Installation**: Homebrew Cask (`brew install --cask slack`) or manual download. 59 + * **[Zoom](https://zoom.us/)** 60 + * **Installation**: Homebrew Cask (`brew install --cask zoom`) or manual download. 61 + 62 + ### Other Utilities 63 + 64 + * **[Spotify](https://www.spotify.com/)** 65 + * **Installation**: Homebrew Cask (`brew install --cask spotify`) or manual download. 66 + * **[VLC Media Player](https://www.videolan.org/vlc/)** 67 + * **Installation**: Homebrew Cask (`brew install --cask vlc`) or manual download. 68 + 69 + ## Managing Application Settings with `chezmoi` 70 + 71 + If an application stores its settings in a known file path (e.g., a `.plist` file in `~/Library/Preferences/` on macOS, or a JSON/INI/XML file in `~/.config/AppName/` on Linux), `chezmoi` can manage it: 72 + 73 + 1. **Identify the configuration file**. 74 + 2. **Copy it to your `chezmoi` source directory** (e.g., as `private_Library/Preferences/com.example.app.plist` for macOS, or `dot_config/AppName/settings.json`). 75 + 3. **Add it to `chezmoi`**: `chezmoi add ~/Library/Preferences/com.example.app.plist` (using the original path). 76 + 4. `chezmoi` will then create a symlink from the target path to your source directory version, or apply it as a template. 77 + 78 + **Caution**: Some applications do not like their preference files being symlinked or modified externally while they are running. Test thoroughly. 2 79 3 - - [User Apps Usage](#user-apps-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 80 + ## Resources 5 81 6 - ## TODO: Create documentation 82 + * **Homebrew Casks**: [https://formulae.brew.sh/cask/](https://formulae.brew.sh/cask/) (Find package names for Homebrew Cask installations) 83 + * **`chezmoi` Documentation**: [https://www.chezmoi.io/](https://www.chezmoi.io/) 84 + 85 + This document is a template. Please populate it with the specific applications you use and how you manage their installation and configuration.
+72 -8
docs/vscode-usage.md
··· 1 1 # Visual Studio Code Usage 2 2 3 - - [Visual Studio Code Usage](#visual-studio-code-usage) 4 - - [TODO: Create documentation](#todo-create-documentation) 3 + This document provides an overview of using Visual Studio Code (VS Code), including setup, key features, and customization relevant to this dotfiles environment. 5 4 6 - ## TODO: Create documentation 5 + ## Overview 7 6 8 - - Configuration 9 - - Extensions 10 - - Settings 11 - - Key bindings 12 - - GitHub Codespaces 7 + [Visual Studio Code](https://code.visualstudio.com/) is a lightweight but powerful source code editor that runs on your desktop and is available for Windows, macOS, and Linux. It comes with built-in support for JavaScript, TypeScript, and Node.js and has a rich ecosystem of extensions for other languages and runtimes (such as C++, C#, Java, Python, PHP, Go) and tools (like Docker, Git, and various linters). 8 + 9 + ## Installation 10 + 11 + * **Download**: Download VS Code from the [official website](https://code.visualstudio.com/download). 12 + * **Package Managers**: 13 + * **macOS (Homebrew)**: `brew install --cask visual-studio-code` 14 + * **Linux**: Refer to [VS Code Linux documentation](https://code.visualstudio.com/docs/setup/linux) for instructions for your distribution. 15 + 16 + Installation might be managed by `chezmoi` if VS Code is part of your standard toolset defined in your dotfiles. 17 + 18 + Launch VS Code and open a terminal within it (`View > Terminal` or ``Ctrl+` ``) to use the `code` command-line interface for opening files and folders. 19 + 20 + ## Key Features & Customization 21 + 22 + ### Command Palette 23 + Access all available commands based on your current context by pressing `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS). 24 + 25 + ### Extensions 26 + VS Code extensions let you add languages, debuggers, and tools to your installation to support your development workflow. 27 + * **Browse and Install**: Access the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or `Ctrl+Shift+X` / `Cmd+Shift+X`. 28 + * **Recommended Extensions**: VS Code often suggests extensions based on the files you open. You can also find popular extensions for your languages and frameworks in the Marketplace. 29 + * **Managing Extensions**: You can list your installed extensions from the command line: 30 + ```sh 31 + code --list-extensions 32 + ``` 33 + To install an extension from the command line: 34 + ```sh 35 + code --install-extension <extension-id> 36 + ``` 37 + Your `chezmoi` setup might manage a list of extensions to be installed automatically. 38 + 39 + ### Settings 40 + Customize VS Code to your liking through its settings. 41 + * **UI**: Open settings via `File > Preferences > Settings` (`Code > Preferences > Settings` on macOS) or `Ctrl+,` / `Cmd+,`. 42 + * **JSON**: For more advanced configuration and to manage settings as code, you can edit the `settings.json` file directly. Access it via the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`) by typing "Preferences: Open User Settings (JSON)". 43 + * **Workspace Settings**: You can also define settings specific to a project/workspace by creating a `.vscode/settings.json` file in your project root. 44 + * Your `chezmoi` setup likely manages your global `settings.json` file. 45 + 46 + ### Settings Sync 47 + VS Code has built-in Settings Sync, which allows you to share your VS Code configurations—such as settings, keybindings, and installed extensions—across your different machines using a GitHub or Microsoft account. 48 + * **Enable/Disable**: Turn on Settings Sync from the Manage gear icon at the bottom of the Activity Bar, then "Turn on Settings Sync...". 49 + 50 + ### Keybindings 51 + Customize keyboard shortcuts in VS Code. 52 + * **UI**: `File > Preferences > Keyboard Shortcuts` (`Code > Preferences > Keyboard Shortcuts` on macOS) or `Ctrl+K Ctrl+S` / `Cmd+K Cmd+S`. 53 + * **JSON**: For advanced customization, edit `keybindings.json`. Access it via the Command Palette with "Preferences: Open Keyboard Shortcuts (JSON)". 54 + * Your `chezmoi` setup might manage your `keybindings.json`. 55 + 56 + ### Integrated Terminal 57 + VS Code has an integrated terminal (`View > Terminal` or `` Ctrl+` ``) so you can run shell commands directly within the editor. 58 + 59 + ## GitHub Codespaces 60 + 61 + [GitHub Codespaces](https://github.com/features/codespaces) provides cloud-powered development environments. You can use VS Code (desktop or web) to connect to a Codespace, giving you a fully configured development environment in the cloud, often based on a `devcontainer.json` configuration in your repository (see `docs/docker-usage.md` for more on Dev Containers). 62 + 63 + ### Benefits: 64 + * **Pre-configured environments**: Start coding immediately with environments tailored for your project. 65 + * **Access from anywhere**: Develop from any machine with a browser or VS Code. 66 + * **Consistent setup**: Ensures consistency across team members. 67 + 68 + ## Resources 69 + 70 + * **Official VS Code Documentation**: [https://code.visualstudio.com/docs](https://code.visualstudio.com/docs) 71 + * **Introductory Videos**: [https://code.visualstudio.com/docs/getstarted/introvideos](https://code.visualstudio.com/docs/getstarted/introvideos) 72 + * **VS Code Extension Marketplace**: [https://marketplace.visualstudio.com/vscode](https://marketplace.visualstudio.com/vscode) 73 + * **Settings Sync Guide**: [https://code.visualstudio.com/docs/editor/settings-sync](https://code.visualstudio.com/docs/editor/settings-sync) 74 + * **GitHub Codespaces Documentation**: [https://docs.github.com/en/codespaces](https://docs.github.com/en/codespaces) 75 + 76 + This document covers the basics. VS Code is highly extensible and configurable; explore the official documentation to tailor it to your workflow.