fix: install profile commands as slash commands during project install#335
fix: install profile commands as slash commands during project install#335digitall-it wants to merge 1 commit intobuildermethods:mainfrom
Conversation
install_commands() only copied the 5 base commands from commands/agent-os/. Profile commands (shape-spec, new-spec, create-spec, implement-spec, etc.) were never installed, so /agent-os:shape-spec and related slash commands were unavailable after running the installer. Fix: iterate over profiles/$PROFILE/commands/ in inheritance-chain order, resolve the multi-agent (preferred) or single-agent variant for each command, and copy it to .claude/commands/agent-os/$cmd_name.md alongside the base commands. Derived profiles override base-profile commands, consistent with how standards inheritance works.
There was a problem hiding this comment.
Pull request overview
Updates the project installer so that profile-specific Agent OS slash commands are installed into a project alongside the base built-in commands, using the configured profile inheritance chain so derived profiles can override base ones.
Changes:
- Extend
install_commands()to copy base command markdown files into.claude/commands/agent-os/. - Add installation of profile commands from
profiles/$PROFILE/commands/, processed in inheritance-chain order. - Resolve command variants by preferring
multi-agent/then falling back tosingle-agent/then root-level command files.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| local count=0 | ||
|
|
||
| # Install base commands (agent-os built-ins: discover-standards, inject-standards, etc.) | ||
| local base_commands_source="$BASE_DIR/commands/agent-os" | ||
| if [[ -d "$base_commands_source" ]]; then | ||
| for file in "$base_commands_source"/*.md; do | ||
| if [[ -f "$file" ]]; then | ||
| cp "$file" "$commands_dest/" | ||
| ((count++)) | ||
| fi | ||
| done | ||
| fi | ||
|
|
||
| ensure_dir "$commands_dest" | ||
| # Install profile commands (shape-spec, new-spec, create-spec, implement-spec, etc.) | ||
| # Process each profile in the inheritance chain so derived profiles override base ones | ||
| while IFS= read -r profile_name; do | ||
| [[ -z "$profile_name" ]] && continue | ||
|
|
||
| local count=0 | ||
| for file in "$commands_source"/*.md; do | ||
| if [[ -f "$file" ]]; then | ||
| cp "$file" "$commands_dest/" | ||
| ((count++)) | ||
| fi | ||
| done | ||
| local profile_commands="$BASE_DIR/profiles/$profile_name/commands" | ||
| [[ ! -d "$profile_commands" ]] && continue | ||
|
|
||
| # Each subdirectory is a command (e.g. shape-spec/, create-spec/) | ||
| for cmd_dir in "$profile_commands"/*/; do | ||
| [[ ! -d "$cmd_dir" ]] && continue | ||
|
|
||
| local cmd_name | ||
| cmd_name=$(basename "$cmd_dir") | ||
|
|
||
| # Prefer the multi-agent variant; fall back to single-agent | ||
| local cmd_file="" | ||
| if [[ -f "$cmd_dir/multi-agent/$cmd_name.md" ]]; then | ||
| cmd_file="$cmd_dir/multi-agent/$cmd_name.md" | ||
| elif [[ -f "$cmd_dir/single-agent/$cmd_name.md" ]]; then | ||
| cmd_file="$cmd_dir/single-agent/$cmd_name.md" | ||
| elif [[ -f "$cmd_dir/$cmd_name.md" ]]; then | ||
| cmd_file="$cmd_dir/$cmd_name.md" | ||
| fi | ||
|
|
||
| if [[ -n "$cmd_file" ]]; then | ||
| cp "$cmd_file" "$commands_dest/$cmd_name.md" | ||
| ((count++)) | ||
| fi |
There was a problem hiding this comment.
count is incremented on every cp, including when a later profile (or profile vs base) overwrites an earlier command of the same name. That can make the success message report more "installed" commands than actually exist in .claude/commands/agent-os/. Consider tracking unique command names (e.g., associative array keyed by dest filename) or computing the final file count in the destination directory before printing.
Problem
install_commands()inscripts/project-install.shonly copies the 5 base commands fromcommands/agent-os/(discover-standards, inject-standards, index-standards, plan-product, shape-spec) to.claude/commands/agent-os/.Profile commands —
shape-spec(full multi-phase),new-spec,create-spec,write-spec,create-tasks,implement-spec,implement-tasks,next-task,orchestrate-tasks,get-issue,get-pr-feedback,composer-ready,prepare-legacy-project,improve-skills— live inprofiles/$PROFILE/commands/and are never installed.After running the installer, slash commands like
/agent-os:shape-spec,/agent-os:create-spec,/agent-os:implement-specetc. are unavailable, even though the profile ships them.Solution
Extend
install_commands()to also iterate overprofiles/$PROFILE/commands/in inheritance-chain order (consistent with how standards are installed), resolve the multi-agent variant of each command (falling back to single-agent, then root-level), and copy it to.claude/commands/agent-os/$cmd_name.md.Derived profiles can override base-profile commands, matching the existing standards inheritance behaviour.
Verified
.claude/commands/agent-os/after install--commands-onlyflag works correctly (no standards touched)