diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..a064b78 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "semi": false, + "singleQuote": false, + "trailingComma": "none", + "printWidth": 100, + "tabWidth": 2, + "proseWrap": "preserve" +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..249173c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["esbenp.prettier-vscode", "foxundermoon.shell-format", "timonwong.shellcheck"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..846867d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[yaml]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[shellscript]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + }, + "shellformat.flag": "-i 2" +} diff --git a/AGENTS.md b/AGENTS.md index 5c2f3f6..8135741 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,6 +5,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Repository Overview This is a dotfiles repository managed by **chezmoi**. Chezmoi uses special file naming conventions: + - `dot_` prefix → `.` (e.g., `dot_zshrc` → `~/.zshrc`) - `.tmpl` suffix → Template files processed with variables (e.g., `dot_gitconfig.tmpl`) diff --git a/README.md b/README.md index 9f33cb0..001cfef 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,48 @@ ## 📝 About This is nyatinte's private dotfiles repository, managed with [chezmoi](https://www.chezmoi.io/) for consistent configuration across multiple machines. + +## 🚀 Setup + +### Prerequisites + +Install the following tools: + +```bash +# Install npm dependencies (Prettier, concurrently, lefthook) +npm install + +# Install shfmt (shell script formatter) +go install mvdan.cc/sh/v3/cmd/shfmt@latest + +# Install shellcheck (shell script linter) +# macOS +brew install shellcheck + +# Ubuntu/Debian +apt-get install shellcheck + +# Other: https://github.com/koalaman/shellcheck#installing +``` + +### VSCode Extensions + +Install recommended extensions for automatic formatting: + +- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) +- [shell-format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format) +- [ShellCheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck) + +## 🔧 Usage + +```bash +# Format all files +npm run format + +# Check formatting (CI) +npm run format:check + +# Format specific types +npm run format:prettier # JSON, YAML, Markdown +npm run format:shell # Shell scripts +``` diff --git a/home/dot_claude/commands/create-pr.md b/home/dot_claude/commands/create-pr.md index cb6fa64..04b6e3b 100644 --- a/home/dot_claude/commands/create-pr.md +++ b/home/dot_claude/commands/create-pr.md @@ -68,7 +68,7 @@ argument-hint: "[オプション: PR作成時の追加指示]" - ベースブランチをもとにPRを作成: ```bash - gh pr create --base <ベースブランチ> --title "$(head -n1 PR.md)" --body "$(tail -n+2 PR.md)" + gh pr create --base "$(head -n1 PR.md)" --body "$(tail -n+2 PR.md)" < ベースブランチ > --title ``` - PR URLを表示 diff --git a/home/dot_claude/commands/draft-pr.md b/home/dot_claude/commands/draft-pr.md index b83fa48..cbb74c6 100644 --- a/home/dot_claude/commands/draft-pr.md +++ b/home/dot_claude/commands/draft-pr.md @@ -30,9 +30,9 @@ PRに含めるコミットがあるか確認 ### 2. **既存のPR.mdの確認** `PR.md`が既に存在する場合: - その内容を読み取る - ユーザーに上書きするか編集するか尋ねる(AskUserQuestionを使用) - 既存のものを保持したい場合は終了 +その内容を読み取る +ユーザーに上書きするか編集するか尋ねる(AskUserQuestionを使用) +既存のものを保持したい場合は終了 - `PR.md`が存在しない場合: - 生成を進める @@ -41,7 +41,7 @@ PRに含めるコミットがあるか確認 - ユーザーの過去のPRを検索: `gh pr list --author @me --state merged --limit 10` - ユーザーに過去のPRがある場合: - 最近の2-3件のPRの詳細を取得 + 最近の2-3件のPRの詳細を取得 - 分析: タイトル形式、説明構造、使用言語 - PR説明の書き方のパターンを記録 @@ -55,7 +55,7 @@ PRテンプレートを確認: `.github/pull_request_template.md`または類似 - `git log <ベースブランチ>..HEAD --pretty=format:"%s"` - ファイル変更を取得: - `git diff <ベースブランチ>..HEAD --stat` +`git diff <ベースブランチ>..HEAD --stat` - `git diff <ベースブランチ>..HEAD`(詳細な変更用) diff --git a/home/dot_zsh.d/dev-tools.zsh b/home/dot_zsh.d/dev-tools.zsh index 20fa86b..448b4a4 100644 --- a/home/dot_zsh.d/dev-tools.zsh +++ b/home/dot_zsh.d/dev-tools.zsh @@ -15,4 +15,4 @@ export NI_DEFAULT_AGENT="pnpm" export NI_GLOBAL_AGENT="pnpm" # Code editor -export VISUAL="code" \ No newline at end of file +export VISUAL="code" diff --git a/home/dot_zsh.d/fzf.zsh b/home/dot_zsh.d/fzf.zsh index bb33279..5e827ae 100644 --- a/home/dot_zsh.d/fzf.zsh +++ b/home/dot_zsh.d/fzf.zsh @@ -16,9 +16,9 @@ export FZF_CTRL_T_OPTS=" # Ctrl+R - History Search function fzf-select-history() { - BUFFER=$(history -n -r 1 | fzf --query "$LBUFFER") - CURSOR=$#BUFFER - zle reset-prompt + BUFFER=$(history -n -r 1 | fzf --query "$LBUFFER") + CURSOR=$#BUFFER + zle reset-prompt } zle -N fzf-select-history -bindkey '^r' fzf-select-history \ No newline at end of file +bindkey '^r' fzf-select-history diff --git a/lefthook.yml b/lefthook.yml index b832d44..a7a64e3 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -15,8 +15,15 @@ pre-push: exit 1 fi -# pre-commit: -# TODO: formatting checks -# parallel: true -# jobs: -# - run: +pre-commit: + parallel: true + commands: + prettier-check: + glob: "*.{json,yml,yaml,md}" + run: npm run lint:prettier -- {staged_files} + shfmt-check: + glob: "*.{sh,zsh,bash}" + run: npm run lint:shfmt -- {staged_files} + shellcheck: + glob: "*.{sh,zsh,bash}" + run: npm run lint:shellcheck -- {staged_files} || echo "⚠️ shellcheck not found, skipping lint check" diff --git a/package-lock.json b/package-lock.json index c318eca..b000af3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,177 @@ { - "name": "dotfiles_chezmoi", + "name": "dotfiles", "lockfileVersion": 3, "requires": true, "packages": { "": { + "name": "dotfiles", "devDependencies": { - "lefthook": "^2.0.3" + "concurrently": "^9.1.1", + "lefthook": "2.0.3", + "prettier": "^3.4.2" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concurrently": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz", + "integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "4.1.2", + "rxjs": "7.8.2", + "shell-quote": "1.8.3", + "supports-color": "8.1.1", + "tree-kill": "1.2.2", + "yargs": "17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" } }, "node_modules/lefthook": { @@ -170,6 +336,173 @@ "os": [ "win32" ] + }, + "node_modules/prettier": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", + "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } } } } diff --git a/package.json b/package.json index d006f3f..37a18bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,20 @@ { "name": "dotfiles", + "scripts": { + "format": "concurrently --group \"prettier --write '**/*.{json,yml,yaml,md}'\" \"shfmt -w -i 2 home/**/*.zsh\"", + "format:check": "concurrently --group \"prettier --check '**/*.{json,yml,yaml,md}'\" \"shfmt -d -i 2 home/**/*.zsh\" \"shellcheck home/**/*.zsh || exit 0\"", + "format:prettier": "prettier --write '**/*.{json,yml,yaml,md}'", + "format:shell": "shfmt -w -i 2 home/**/*.zsh", + "check:prettier": "prettier --check '**/*.{json,yml,yaml,md}'", + "check:shfmt": "shfmt -d -i 2 home/**/*.zsh", + "check:shellcheck": "shellcheck home/**/*.zsh || exit 0", + "lint:prettier": "prettier --check", + "lint:shfmt": "shfmt -d -i 2", + "lint:shellcheck": "shellcheck" + }, "devDependencies": { - "lefthook": "2.0.3" + "concurrently": "^9.1.1", + "lefthook": "2.0.3", + "prettier": "^3.4.2" } -} \ No newline at end of file +}