### Chezmoi Ignore Example Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md An example of how to configure exclusion rules in .chezmoiignore, demonstrating OS-specific exclusions using template syntax. ```txt # template構文を使用できます {{ if ne .chezmoi.os "linux" }} .config/fcitx5 .config/fusuma .local/share/fonts .local/share/icons .local/share/themes .chezmoiscripts/linux/** {{ end }} .chezmoiexternal.* key.txt.age shhh.txt ``` -------------------------------- ### Example Table Source: https://github.com/budybye/dotfiles/blob/main/_autodocs/INDEX.md Demonstrates markdown table syntax. ```markdown | Column 1 | Column 2 | Column 3 | |----------|----------|----------| | Info | Details | Purpose | ``` -------------------------------- ### External File Management Configuration Example Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md Examples of configuring external resources like files, archives, and Git repositories using .chezmoiexternal.toml.tmpl, including fetching binaries from GitHub releases. ```toml [.vim/autoload/plug.vim] type = "file" url = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" refreshPeriod = "168h" [.oh-my-zsh] type = "archive" url = "https://github.com/ohmyzsh/ohmyzsh/archive/master.tar.gz" exact = true stripComponents = 1 refreshPeriod = "168h" # GitHub releaseから最新のバイナリを取得 [.local/bin/age] type = "archive-file" url = {{ gitHubLatestReleaseAssetURL "FiloSottile/age" (printf "age-*-%s-%s.tar.gz" .chezmoi.os .chezmoi.arch) | quote }} executable = true path = "age/age" refreshPeriod = "168h" ``` -------------------------------- ### vm-start Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Starts a Multipass VM. ```sh make vm-start ``` -------------------------------- ### Directly execute install.sh Source: https://github.com/budybye/dotfiles/blob/main/README.md Executes the install.sh script directly for independent installation. ```shell # install.shを直接実行 ./install.sh ``` -------------------------------- ### Error Handling Example Source: https://github.com/budybye/dotfiles/blob/main/home/dot_claude/rules/golang.md Example of wrapping errors with context in Go. ```go if err != nil { return fmt.Errorf("failed to create user: %w", err) } ``` -------------------------------- ### up Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Starts Docker Compose services from the .devcontainer/ directory. ```sh make up ``` -------------------------------- ### init command Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Initializes dotfiles with chezmoi by running the installation script. ```sh make init ``` -------------------------------- ### Multi-Environment Support Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md Example TOML configuration for multi-environment support using Go templates and password manager integration. ```toml # .chezmoi.toml.tmpl [data] {{- if eq .chezmoi.hostname "work-laptop" }} profile = "work" git_email = {{ onepassword "Work" "git" "email" | quote }} {{- else }} profile = "personal" git_email = {{ bitwarden "personal" "git-email" | quote }} {{- end }} ``` -------------------------------- ### Conditional Configuration Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md Examples of conditional configuration based on hostname and feature flags using Go templates. ```go # 環境ベースの設定 {{ if eq .chezmoi.hostname "work-laptop" }} # 仕事固有設定 {{ else if eq .chezmoi.hostname "personal-desktop" }} # 個人設定 {{ end }} # 機能フラグ {{ if .features.development }} # 開発ツールとエイリアス {{ end }} ``` -------------------------------- ### Multipass Manual Execution Source: https://github.com/budybye/dotfiles/blob/main/README.md Manual commands to create, start, and SSH into Multipass virtual machines. ```sh # Run via Makefile (recommended) make vm-create make vm-start make ssh # Manual execution multipass launch -n ubuntu -c 4 -m 8G -d 42G \ --cloud-init cloud-init/multipass.yaml ``` -------------------------------- ### Mise Basic Usage Source: https://github.com/budybye/dotfiles/blob/main/README.md Basic commands for installing, managing, and trusting tools with Mise. ```sh # Install a tool mise use # Install globally mise use -g # Check installed tools mise ls # Trust the directory (load environment variables) ``` ```sh mise trust ``` -------------------------------- ### 調査の標準フロー(そのまま使える) - Step 3: 論点別に局所検索 Source: https://github.com/budybye/dotfiles/blob/main/home/dot_local/ghq/README.md Bash script to search for specific keywords within the source, docs, and examples directories of a repository. ```bash #!/usr/bin/env bash set -eu REPO="$(ghq root)/github.com/honojs/hono" rg "bearerAuth|jwt|middleware" "${REPO}/src" "${REPO}/docs" "${REPO}/examples" ``` -------------------------------- ### Password Manager Integration Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md Examples of integrating with password managers like Bitwarden, 1Password, and KeePassXC using Go templates. ```go {{ bitwarden "item" "name" }} {{ onepassword "vault" "item" "field" }} {{ keepassxc "database" "entry" "attribute" }} ``` -------------------------------- ### Initialize locally Source: https://github.com/budybye/dotfiles/blob/main/README.md Initializes chezmoi by cloning the repository locally and running the make init command. ```shell cd ~ git clone git@github.com:budybye/dotfiles.git cd dotfiles make init ``` -------------------------------- ### Initialize with chezmoi from remote repository Source: https://github.com/budybye/dotfiles/blob/main/README.md Initializes chezmoi by cloning the remote repository and applying the configuration. ```shell # chezmoi経由でリモートリポジトリから初期化 curl -fsLS https://chezmoi.io/get | sh -s -- -b ${HOME}/.local/bin init --apply budybye # or sh -c "$(curl -fsLS https://chezmoi.io/get)" -- -b ${HOME}/.local/bin init --apply budybye ``` -------------------------------- ### Output Format Source: https://github.com/budybye/dotfiles/blob/main/home/private_dot_config/opencode/agents/tdd-guide.md The expected output format after each TDD cycle. ```markdown ### Cycle N: [Test Name] - RED: [Reason for failure] - GREEN: [Implementation content] - REFACTOR: [Improvement content] - Coverage: [Current coverage] ``` -------------------------------- ### Cycle Output Format Source: https://github.com/budybye/dotfiles/blob/main/home/dot_claude/agents/tdd-guide.md Format for reporting each TDD cycle completion. ```markdown ### Cycle N: [テスト名] - RED: [失敗理由] - GREEN: [実装内容] - REFACTOR: [改善内容] - Coverage: [現在のカバレッジ] ``` -------------------------------- ### chezmoi execute-template コマンド例 Source: https://github.com/budybye/dotfiles/blob/main/docs/go-template.md chezmoi execute-template を使用してテンプレートのレンダリング結果を確認する方法。 ```bash # 単一ファイルのレンダリング結果を確認 chezmoi execute-template < home/.chezmoi.toml.tmpl # 変数付きで実行(dry-run 相当) chezmoi execute-template --promptString name=test --promptString email=test@example.com < home/private_dot_config/git/user.conf.tmpl ``` -------------------------------- ### Analysis Output Template Source: https://github.com/budybye/dotfiles/blob/main/home/dot_pi/agent/agents/analyst.md An example of how analysis findings should be structured, including conclusion, evidence, and risks. ```markdown ## Conclusion - Recommended option: ... ## Evidence - Fact: ... - Observation: ... ## Risks - Risk: ... / Mitigation: ... ``` -------------------------------- ### 9. コマンドスニペット集 - 9.4 調査開始用テンプレ(コピペ用) Source: https://github.com/budybye/dotfiles/blob/main/home/dot_local/ghq/README.md Bash script to initialize a new repository for investigation, including fetching and a basic search. ```bash #!/usr/bin/env bash set -eu command -v ghq >/dev/null command -v rg >/dev/null TARGET="github.com//" REPO="$(ghq root)/${TARGET}" if [ -d "${REPO}/.git" ]; then git -C "${REPO}" fetch --all --prune else ghq get "${TARGET}" fi rg "TODO: replace-this-pattern" "${REPO}/docs" "${REPO}/src" "${REPO}/test" ``` -------------------------------- ### vm-create Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Creates a Multipass VM with cloud-init configuration. ```sh make vm-create ``` -------------------------------- ### Bitwarden Integration Command Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md Command to unlock the Bitwarden vault via Makefile for secret management, and an example of chezmoi integration. ```sh # シークレット管理のためのvaultをアンロック(Makefile経由) make bw-unlock # 詳細: [設計書 - Makefile 設計 - セキュリティコマンド](./design.md#セキュリティコマンド) # chezmoi統合でセキュアなシークレット注入 {{ bitwarden "item" "name" }} ``` -------------------------------- ### chezmoi verify コマンド例 Source: https://github.com/budybye/dotfiles/blob/main/docs/go-template.md chezmoi verify を使用して設定、テンプレート、スクリプトの整合性を検証する方法。 ```bash # 設定・テンプレート・スクリプトの整合性を検証 chezmoi verify ``` -------------------------------- ### 調査の標準フロー(そのまま使える) - Step 2: 全体把握(1-3分) Source: https://github.com/budybye/dotfiles/blob/main/home/dot_local/ghq/README.md Bash script to list files in a repository and search for common documentation, source, and test files. ```bash #!/usr/bin/env bash set -eu REPO="$(ghq root)/github.com/honojs/hono" ls "${REPO}" rg --files "${REPO}" | rg "README|docs|examples|src|test" ``` -------------------------------- ### docker-run command Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Builds and runs the Docker container with full configuration. ```sh make docker-run ``` -------------------------------- ### docker-build command Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Builds the Docker image from the .devcontainer/ directory. ```sh make docker-build ``` -------------------------------- ### chezmoi diff コマンド例 Source: https://github.com/budybye/dotfiles/blob/main/docs/go-template.md chezmoi diff を使用して適用後の差分を確認する方法。 ```bash # 適用後の差分を確認(テンプレートの出力が正しいか) chezmoi diff ``` -------------------------------- ### apply command Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Applies changes to dotfiles using `chezmoi apply`. ```sh make apply ``` -------------------------------- ### Docker Manual Execution Source: https://github.com/budybye/dotfiles/blob/main/README.md Manual commands to run and manage the Docker development environment. ```sh # Run via Makefile (recommended) make docker-run # Manual execution cd .devcontainer docker compose up -d docker compose exec ubuntu /bin/bash ``` -------------------------------- ### File Management Commands Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md chezmoi commands for adding new configuration files, including options for templating, encryption, and executability. ```sh # 新しい設定ファイルを追加 chezmoi add ~/.gitconfig # テンプレートとして追加 chezmoi add --template ~/.ssh/config # 暗号化ファイルとして追加 chezmoi add --encrypt ~/.ssh/private_key # 実行可能ファイルとして追加 chezmoi add --executable ~/.local/bin/script ``` -------------------------------- ### check command Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Checks dotfiles configuration by running `chezmoi diff` to preview changes. ```sh make check ``` -------------------------------- ### help command Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Displays this help message with all available commands organized by category. ```sh make help ``` -------------------------------- ### exec Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Executes bash in a running Docker container. ```sh make exec ``` -------------------------------- ### Local Testing Commands Source: https://github.com/budybye/dotfiles/blob/main/docs/directory.md Commands for testing chezmoi configurations locally, including configuration checks, Docker environment testing, and verification commands. ```sh # 設定チェックを実行(Makefile経由) make check # 詳細: [設計書 - Makefile 設計 - 開発](./design.md#開発) # 分離されたDocker環境でテスト(Makefile経由) make docker-run # 詳細: [設計書 - Makefile 設計 - Docker コマンド](./design.md#docker-コマンド) # chezmoi設定を検証 chezmoi diff chezmoi doctor chezmoi verify ``` -------------------------------- ### Error Handling with anyhow and context Source: https://github.com/budybye/dotfiles/blob/main/home/dot_claude/rules/rust.md Shows how to use `anyhow` for application-level errors and add context. ```rust use anyhow::Context; fn load_config() -> anyhow::Result { let config_path = "config.toml"; let content = std::fs::read_to_string(config_path) .context(format!("failed to read config file: {}", config_path)?); // ... parse content ... Ok(config) } ``` -------------------------------- ### Shell スクリプトでの range トリミング例 Source: https://github.com/budybye/dotfiles/blob/main/docs/go-template.md Shell スクリプト(.sh.tmpl)で range を使用する際のトリム例。 ```go-template {{- range .packages.extensions -}} ``` -------------------------------- ### logs Source: https://github.com/budybye/dotfiles/blob/main/docs/design.md Displays logs of Docker containers in follow mode. ```sh make logs ``` -------------------------------- ### Aqua 設定ファイル Source: https://github.com/budybye/dotfiles/blob/main/docs/tech.md Aqua 設定ファイルは、宣言的な追加 CLI 配布管理に使用されます。現在は `b3nj5m1n/xdg-ninja@v0.2.0.2` が定義されており、checksum 検証が有効です。 ```yaml b3nj5m1n/xdg-ninja@v0.2.0.2 ``` -------------------------------- ### TOML ファイルでの制御構造トリム例 Source: https://github.com/budybye/dotfiles/blob/main/docs/go-template.md TOML ファイル(.chezmoi.toml.tmpl など)における制御構造のトリム例。 ```go-template {{- if eq .chezmoi.os "darwin" }} ```