Skip to content

feat(skills): populate every detected runtime's skills dir#65

Merged
chubes4 merged 1 commit intomainfrom
multi-runtime-skills
Apr 24, 2026
Merged

feat(skills): populate every detected runtime's skills dir#65
chubes4 merged 1 commit intomainfrom
multi-runtime-skills

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Apr 24, 2026

Summary

Closes #63.

Runtime auto-detection in setup.sh (and upgrade.sh) was single-pick, first-match-wins:

if   command -v studio &>/dev/null && [ "${IS_STUDIO:-false}" = true ]; then RUNTIME=studio-code
elif command -v claude &>/dev/null;                                          then RUNTIME=claude-code
elif command -v opencode &>/dev/null;                                        then RUNTIME=opencode
fi

On a machine with both claude and opencode installed, cascade picked claude-code silently. SKILLS_DIR="$(runtime_skills_dir)" resolved to a single runtime's dir (.claude/skills/ vs .opencode/skills/), so ./setup.sh --skills-only only ever populated one runtime. To get skills into the other runtime users had to re-run with explicit --runtime opencode.

Fix

Track all detected runtimes in a new DETECTED_RUNTIMES[] array alongside the existing primary RUNTIME. In install_skills and print_skills_summary, iterate every detected runtime, resolve its skills dir, and install into each unique dir.

setup.sh / upgrade.sh

  • New DETECTED_RUNTIMES=() array populated during auto-detect (studio-code → claude-code → opencode, keeps existing cascade order).
  • RUNTIME="\${DETECTED_RUNTIMES[0]}" — primary stays first-match.
  • Explicit --runtime <name> narrows both lists to the single runtime (preserves single-runtime-mode for users who want it).

lib/skills.sh

  • New _resolve_skills_dir_for_runtime() helper sources a runtime file in a subshell and echoes its runtime_skills_dir. Avoids polluting the primary runtime's functions.
  • install_skills builds a unique list of skills dirs across DETECTED_RUNTIMES (de-duped — claude-code and studio-code both resolve to \$SITE_PATH/.claude/skills) and installs into each.
  • Primary SKILLS_DIR is restored at the end so the kimaki mirror source, persistent-source mirror, and summary output keep working against the primary runtime's dir.
  • print_skills_summary now lists every populated dir.

The primary RUNTIME still drives runtime_install, runtime_generate_config, runtime_install_hooks, and the chat-bridge default — nothing else changes in the single-runtime path.

Testing

  • bash -n setup.sh upgrade.sh lib/skills.sh — passes.
  • tests/bridge-render.sh — all 8 snapshots byte-identical.
  • Dry run with both claude and opencode on PATH:
    Phase 8.5: Installing agent skills...
      Detected 2 runtime(s): claude-code opencode
      Populating 2 unique skills dir(s)
    → Installing skills into /Users/chubes/Studio/intelligence-chubes4/.claude/skills
    → Installing skills into /Users/chubes/Studio/intelligence-chubes4/.opencode/skills
    
  • Real run on `intelligence-chubes4`: both .claude/skills/ and .opencode/skills/ populated with all 5 skills. Kimaki mirror (\$(npm root -g)/kimaki/skills/) and persistent source (~/.kimaki/kimaki-config/skills/) still single-sourced from the primary runtime's dir as before.
  • Single-runtime override: --runtime claude-code reduces back to just .claude/skills/ with no multi-runtime banner.

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Opus 4.7)
  • Used for: drafted the DETECTED_RUNTIMES model, subshell-based skills-dir resolver, and the de-dup logic. Chris reviewed and validated multi-runtime population end-to-end on his Studio install (both .claude/skills/ and .opencode/skills/ populated in a single run).

Runtime auto-detection was single-pick, first-match-wins. On a machine
with both claude and opencode installed, `./setup.sh --skills-only`
silently populated only one runtime's skills dir (.claude/skills/ won
via cascade). Users had to re-run with explicit `--runtime opencode`
to get skills into the other dir.

Track all detected runtimes in DETECTED_RUNTIMES[] alongside the
primary RUNTIME. In install_skills and print_skills_summary, iterate
every detected runtime, resolve its skills dir via
_resolve_skills_dir_for_runtime() (sources the runtime file in a
subshell so the primary runtime's functions stay intact), and install
into each unique dir. claude-code + studio-code both resolve to
$SITE_PATH/.claude/skills, so paths are de-duped.

Explicit `--runtime <name>` still narrows to a single runtime
(single-runtime-mode preserved for users who want that). The primary
RUNTIME keeps driving runtime_install, runtime_generate_config,
runtime_install_hooks, and the chat-bridge default — nothing else
changes in the single-runtime path.

Closes #63.
@chubes4 chubes4 merged commit 09b3cf4 into main Apr 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-runtime skill population in a single setup/upgrade run

1 participant