Repository navigation
feat: /setup-new-repo に Codespaces 対応をデフォルトで追加 #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| --- | ||
| description: Setup new repository with DevContainer, CI/CD, and development tools from config template | ||
| allowed-tools: Read, Write, Edit, Bash(git:*), Bash(gh:*), Bash(npm:*), Bash(mkdir:*), Bash(cp:*), Bash(ls:*), Bash(cat:*), Bash(test:*), Task, Glob, Grep | ||
| argument-hint: '<TARGET_DIR> [--minimal] [--no-devcontainer] [--license MIT|Apache-2.0] [--no-install]' | ||
| argument-hint: '<TARGET_DIR> [--minimal] [--no-devcontainer] [--no-codespaces] [--license MIT|Apache-2.0] [--no-install]' | ||
| --- | ||
|
|
||
| # New Repository Setup Command | ||
|
|
@@ -13,11 +13,12 @@ argument-hint: '<TARGET_DIR> [--minimal] [--no-devcontainer] [--license MIT|Apac | |
| 以下をセットアップします: | ||
|
|
||
| 1. **Git初期化** - リポジトリの初期化 | ||
| 2. **DevContainer** - `.devcontainer/` と `.vscode/` 設定 | ||
| 2. **DevContainer** - `.devcontainer/` と `.vscode/` 設定(Codespaces 対応含む) | ||
| 3. **Git設定** - commitlint, `.gitignore` | ||
| 4. **GitHub Actions** - CI workflow, Issue/PRテンプレート | ||
| 5. **開発ツール** - ESLint, Prettier, Jest, Husky | ||
| 6. **ドキュメント** - README.md, CLAUDE.md, SECURITY.md | ||
| 7. **Codespaces シークレット** - リポジトリへのシークレット紐付け | ||
|
|
||
| ## Step 1: Parse Arguments | ||
|
|
||
|
|
@@ -26,6 +27,7 @@ argument-hint: '<TARGET_DIR> [--minimal] [--no-devcontainer] [--license MIT|Apac | |
| - `TARGET_DIR`: 新規リポジトリのパス(必須) | ||
| - `--minimal`: GitHub Actionsをスキップ | ||
| - `--no-devcontainer`: DevContainer設定をスキップ | ||
| - `--no-codespaces`: Codespacesシークレット紐付けをスキップ | ||
| - `--license TYPE`: ライセンス種別(デフォルト: MIT) | ||
| - `--no-install`: npm install をスキップ | ||
|
|
||
|
|
@@ -56,21 +58,75 @@ cd TARGET_DIR | |
| git init | ||
| ``` | ||
|
|
||
| ## Step 5: Copy DevContainer Configuration (unless --no-devcontainer) | ||
| ## Step 5: Create DevContainer Configuration (unless --no-devcontainer) | ||
|
|
||
| ```bash | ||
| # .devcontainer をコピー | ||
| cp -r CONFIG_REPO/.devcontainer TARGET_DIR/ | ||
| DevContainer設定をプロジェクトに合わせて新規作成する。configリポジトリからコピーせず、プロジェクト固有の設定を生成する。 | ||
|
|
||
| ### 5.1 `.devcontainer/devcontainer.json` を作成 | ||
|
|
||
| 以下をすべて含める(Codespaces 対応がデフォルト): | ||
|
|
||
| # .vscode をコピー | ||
| cp -r CONFIG_REPO/.vscode TARGET_DIR/ | ||
| ```json | ||
| { | ||
| "name": "{project-name}", | ||
| "image": "ghcr.io/keito4/config-base:latest", | ||
| "features": { | ||
| // プロジェクトに必要な追加 features をここに記載 | ||
| }, | ||
| "remoteEnv": { | ||
| "TMPDIR": "/home/vscode/.claude/tmp" | ||
| }, | ||
| "postCreateCommand": "npm install", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Docs say ✅ Suggested doc fix: make postCreateCommand conditional- "postCreateCommand": "npm install",
+ "postCreateCommand": "{if not --no-install}npm install{else}echo \"skip npm install\"{end}",Also applies to: 119-119, 316-322 🤖 Prompt for AI Agents |
||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "esbenp.prettier-vscode", | ||
| "dbaeumer.vscode-eslint", | ||
| "ms-vscode.vscode-typescript-next" | ||
| // プロジェクトに応じた拡張機能を追加 | ||
| ], | ||
| "settings": { | ||
| "editor.formatOnSave": true, | ||
| "editor.codeActionsOnSave": { | ||
| "source.fixAll.eslint": "explicit" | ||
| }, | ||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||
| "files.eol": "\n", | ||
| "files.trimTrailingWhitespace": true, | ||
| "files.insertFinalNewline": true | ||
| } | ||
| }, | ||
| "codespaces": { | ||
| "openFiles": ["README.md"] | ||
| } | ||
| }, | ||
| "secrets": { | ||
| "ANTHROPIC_API_KEY": { | ||
| "description": "Anthropic API key for Claude Code" | ||
| } | ||
| // プロジェクト固有のシークレットを追加 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **重要**: `codespaces` カスタマイゼーションと `secrets` セクションは常にデフォルトで含める。 | ||
|
|
||
| ### 5.2 `.vscode/` 設定を作成 | ||
|
|
||
| ```bash | ||
| mkdir -p TARGET_DIR/.vscode | ||
| ``` | ||
|
|
||
| - `extensions.json`: 推奨拡張機能 | ||
| - `settings.json`: エディタ設定(formatOnSave, ESLint, Prettier) | ||
|
|
||
| ### DevContainer 設定内容 | ||
|
|
||
| - `ghcr.io/keito4/config-base:latest` ベースイメージ | ||
| - Node.js 22+ | ||
| - 推奨VS Code拡張機能 | ||
| - Codespaces 対応(シークレット定義、openFiles) | ||
| - `postCreateCommand` による自動依存関係インストール | ||
|
|
||
| ## Step 6: Setup Git Configuration | ||
|
|
||
|
|
@@ -239,9 +295,10 @@ npm install | |
| npx husky init | ||
| ``` | ||
|
|
||
| ## Step 11: Add to Codespaces Secrets (Optional) | ||
| ## Step 11: Add to Codespaces Secrets (Default) | ||
|
|
||
| GitHub Codespacesでリポジトリを使用する場合、シークレットの紐付けが必要です。 | ||
| Codespaces でリポジトリを使用できるように、シークレットの紐付けをデフォルトで実行する。 | ||
| `--no-codespaces` オプションが指定された場合のみスキップ。 | ||
|
|
||
| ### 11.1: Check if codespaces-secrets.sh is available | ||
|
|
||
|
|
@@ -251,8 +308,6 @@ test -f CONFIG_REPO/script/codespaces-secrets.sh && echo "available" || echo "no | |
|
|
||
| ### 11.2: Add repository to Codespaces secrets | ||
|
|
||
| If available and user chooses to enable Codespaces: | ||
|
|
||
| ```bash | ||
| # リポジトリをシークレット管理対象に追加 | ||
| CONFIG_REPO/script/codespaces-secrets.sh repos add {owner}/{repo-name} | ||
|
|
@@ -261,16 +316,14 @@ CONFIG_REPO/script/codespaces-secrets.sh repos add {owner}/{repo-name} | |
| CONFIG_REPO/script/codespaces-secrets.sh sync | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Step 11 now executes Useful? React with 👍 / 👎. |
||
| ``` | ||
|
|
||
| ### 11.3: Display Codespaces reminder | ||
| ### 11.3: Verify setup | ||
|
|
||
| ```bash | ||
| # 紐付け状態を確認 | ||
| CONFIG_REPO/script/codespaces-secrets.sh list | ||
| ``` | ||
| 📦 Codespaces 設定のリマインダー | ||
|
|
||
| GitHub Codespacesでこのリポジトリを使用する場合: | ||
| 1. シークレットを紐付け: ./script/codespaces-secrets.sh repos add {owner}/{repo-name} | ||
| 2. 同期実行: ./script/codespaces-secrets.sh sync | ||
| 3. 確認: ./script/codespaces-secrets.sh list | ||
| ``` | ||
| シークレットスクリプトが利用できない場合は、手動設定のガイドを表示する。 | ||
|
|
||
| ## Step 12: Generate Summary | ||
|
|
||
|
|
@@ -313,12 +366,13 @@ Next Steps: | |
|
|
||
| ## Options Summary | ||
|
|
||
| | オプション | 説明 | デフォルト | | ||
| | ------------------- | -------------------------- | ---------- | | ||
| | `--minimal` | GitHub Actionsをスキップ | false | | ||
| | `--no-devcontainer` | DevContainer設定をスキップ | false | | ||
| | `--license TYPE` | ライセンス種別 | MIT | | ||
| | `--no-install` | npm installをスキップ | false | | ||
| | オプション | 説明 | デフォルト | | ||
| | ------------------- | -------------------------------------- | ---------- | | ||
| | `--minimal` | GitHub Actionsをスキップ | false | | ||
| | `--no-devcontainer` | DevContainer設定をスキップ | false | | ||
| | `--no-codespaces` | Codespacesシークレット紐付けをスキップ | false | | ||
| | `--license TYPE` | ライセンス種別 | MIT | | ||
| | `--no-install` | npm installをスキップ | false | | ||
|
|
||
| ## Related Commands | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--no-codespacesmeaning is inconsistent.Line 30 says it only skips secret binding, Step 5 says both devcontainers are always created, and the PR objectives say Codespaces settings/secrets are skipped. Please align the flag behavior and docs (either skip Codespaces devcontainer + secrets, or only skip secrets).
✅ Suggested wording fix (if skipping Codespaces devcontainer + secrets)
Also applies to: 61-67, 103-138, 324-328, 395-401
🤖 Prompt for AI Agents