feat(v3.2.50): slash commands runtime 有効化 (E-2) - #206
Conversation
## 背景 v3.2.44 で .claude/claudeos/commands/ に 39 ファイル配置、v3.2.49 で agents を .claude/agents/ に runtime 有効化したが、commands は Start-ClaudeCode が個別に 6 ファイル (cron-* / work-time-* / session-info) のみ .claude/commands/ に deploy していた。残 33 ファイル (build-fix / code-review / refactor-clean / verify / plan / tdd / sessions / 等) は reference のみだった。 本 PR で 39 ファイル全体を .claude/commands/ にも配置し、slash command として runtime 有効化する。 ## 変更 Local / SSH 両モードで agents (E-1) と同パターンで commands 追加。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughウォークスルーこのPRは、スラッシュコマンド用の新しいテンプレートサブディレクトリを同期するために2つのPowerShellスクリプトを修正します。 変更内容
推定コードレビュー労力🎯 2 (Simple) | ⏱️ ~10 分 関連の可能性があるPR
推奨レビュアー
ポエム
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@scripts/main/Start-ClaudeCode.ps1`:
- Around line 459-464: The SSH copy/mkdir block suppresses stderr and has no
failure branch, so failures enabling .claude/commands are silent; modify the
block that calls $sshExeForMkdir (the command that runs "mkdir -p
'$linuxProject/.claude/commands' && cp -rf ...") to stop swallowing stderr
(remove or capture the redirections to 2>/dev/null and 2>$null) and add an else
branch that logs the failure using Write-Error or similar (include $LASTEXITCODE
and the captured stderr/output) instead of only calling Write-Ok on success;
ensure the new failure log mirrors the Agent Teams pattern so command-enable
failures are observable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cb40e95d-2a51-492e-95f2-674d08f4be2f
📒 Files selected for processing (2)
scripts/lib/TemplateSyncManager.ps1scripts/main/Start-ClaudeCode.ps1
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Agent
- GitHub Check: PSScriptAnalyzer
- GitHub Check: test-and-validate
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: Kensan196948G/ClaudeCode-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-19T01:11:42.497Z
Learning: Applies to Claude/templates/claude/**/*.{js,ts,tsx,jsx,py,java,go,rb,php,cs,cpp,c,h,hpp,sh,sql} : All code comments must be in English; documentation and explanations should be in Japanese
📚 Learning: 2026-04-19T01:11:42.497Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCode-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-19T01:11:42.497Z
Learning: Applies to Claude/templates/claude/.claude/claudeos/**/* : Store project-specific configurations and scripts in .claude/claudeos directory following structure: agents, skills, commands, rules, hooks, scripts, contexts, examples, mcp-configs, and kernel documentation
Applied to files:
scripts/lib/TemplateSyncManager.ps1
🔇 Additional comments (1)
scripts/lib/TemplateSyncManager.ps1 (1)
187-191: 実装方針は問題ありません。
.claude/commandsへの同期追加により、Local 側の slash commands runtime 有効化が既存の Agent Teams パターンと揃っており、意図が明確です。
| # v3.2.50 (E-2): slash commands を runtime 有効化 (39 ファイル) | ||
| & $sshExeForMkdir -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o ControlMaster=no ` | ||
| $linuxHost "mkdir -p '$linuxProject/.claude/commands' && cp -rf '$linuxProject/.claude/claudeos/commands/.' '$linuxProject/.claude/commands/' 2>/dev/null" 2>$null | ||
| if ($LASTEXITCODE -eq 0) { | ||
| Write-Ok ".claude/commands/ activated (39 slash commands runtime)" | ||
| } |
There was a problem hiding this comment.
SSH 側の commands 有効化失敗がサイレントになります。
このブロックは失敗時の else が無く、stderr も抑制しているため、39 commands の runtime 有効化失敗を検知できません。Agent Teams と同様に失敗ログを出してください。
🔧 修正案(失敗時の可観測性を追加)
& $sshExeForMkdir -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o ControlMaster=no `
$linuxHost "mkdir -p '$linuxProject/.claude/commands' && cp -rf '$linuxProject/.claude/claudeos/commands/.' '$linuxProject/.claude/commands/' 2>/dev/null" 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Ok ".claude/commands/ activated (39 slash commands runtime)"
+ } else {
+ Write-Warn ".claude/commands/ activation exit=$LASTEXITCODE — slash commands は reference のみ"
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # v3.2.50 (E-2): slash commands を runtime 有効化 (39 ファイル) | |
| & $sshExeForMkdir -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o ControlMaster=no ` | |
| $linuxHost "mkdir -p '$linuxProject/.claude/commands' && cp -rf '$linuxProject/.claude/claudeos/commands/.' '$linuxProject/.claude/commands/' 2>/dev/null" 2>$null | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Ok ".claude/commands/ activated (39 slash commands runtime)" | |
| } | |
| # v3.2.50 (E-2): slash commands を runtime 有効化 (39 ファイル) | |
| & $sshExeForMkdir -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o ControlMaster=no ` | |
| $linuxHost "mkdir -p '$linuxProject/.claude/commands' && cp -rf '$linuxProject/.claude/claudeos/commands/.' '$linuxProject/.claude/commands/' 2>/dev/null" 2>$null | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Ok ".claude/commands/ activated (39 slash commands runtime)" | |
| } else { | |
| Write-Warn ".claude/commands/ activation exit=$LASTEXITCODE — slash commands は reference のみ" | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@scripts/main/Start-ClaudeCode.ps1` around lines 459 - 464, The SSH copy/mkdir
block suppresses stderr and has no failure branch, so failures enabling
.claude/commands are silent; modify the block that calls $sshExeForMkdir (the
command that runs "mkdir -p '$linuxProject/.claude/commands' && cp -rf ...") to
stop swallowing stderr (remove or capture the redirections to 2>/dev/null and
2>$null) and add an else branch that logs the failure using Write-Error or
similar (include $LASTEXITCODE and the captured stderr/output) instead of only
calling Write-Ok on success; ensure the new failure log mirrors the Agent Teams
pattern so command-enable failures are observable.
There was a problem hiding this comment.
Pull request overview
This PR enables Claude Code slash commands at runtime by ensuring the full Claude/templates/claudeos/commands/ set is also present under the runtime-discovery path .claude/commands/ for both local and SSH workflows (following the v3.2.49 E-1 pattern).
Changes:
- (SSH) Copy
.claude/claudeos/commandsinto.claude/commandson the remote host during startup. - (Local) Sync
Claude/templates/claudeos/commandsinto<project>/.claude/commandsduring global config sync.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/main/Start-ClaudeCode.ps1 | Adds remote runtime activation step to mirror commands from .claude/claudeos/commands to .claude/commands. |
| scripts/lib/TemplateSyncManager.ps1 | Adds local template sync so .claude/commands is populated from Claude/templates/claudeos/commands. |
| & $sshExeForMkdir -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o ControlMaster=no ` | ||
| $linuxHost "mkdir -p '$linuxProject/.claude/commands' && cp -rf '$linuxProject/.claude/claudeos/commands/.' '$linuxProject/.claude/commands/' 2>/dev/null" 2>$null | ||
| if ($LASTEXITCODE -eq 0) { | ||
| Write-Ok ".claude/commands/ activated (39 slash commands runtime)" |
| # v3.2.50 (E-2): slash commands を runtime 有効化 (39 ファイル) | ||
| & $sshExeForMkdir -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new -o ControlMaster=no ` | ||
| $linuxHost "mkdir -p '$linuxProject/.claude/commands' && cp -rf '$linuxProject/.claude/claudeos/commands/.' '$linuxProject/.claude/commands/' 2>/dev/null" 2>$null | ||
| if ($LASTEXITCODE -eq 0) { | ||
| Write-Ok ".claude/commands/ activated (39 slash commands runtime)" |
| # v3.2.50 (E-2): slash commands を runtime 有効化 (39 ファイル) | ||
| Sync-ProjectTemplateDirectory ` | ||
| -TemplateDir (Join-Path $StartupRoot 'Claude\templates\claudeos\commands') ` | ||
| -TargetDir (Join-Path $ProjectDir '.claude\commands') ` | ||
| -Label '.claude/commands' |
v3.2.49 (E-1) と同パターン。Claude/templates/claudeos/commands/ の 39 ファイル全体を .claude/commands/ にも配置し、slash command として runtime 有効化。Local / SSH 両対応。
Summary by CodeRabbit