/super-gsd:sg-setup [--gemini] [--force] - --gemini: also copy .gemini/settings.json, --force: overwrite existing filesfrom super-gsd
Copy super-gsd hook and skill files to the current project — Claude Code in-session installer
Ships in super-gsd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
<execution_context> Self-contained. Determine the @gyuha/super-gsd package root via require.resolve, then copy files to the current project using the Bash tool. </execution_context>
0. **Argument parsing.**Split ARGUMENTS by whitespace and extract flags:
--force is present → FORCE=true (default false)--gemini is present → GEMINI=true (default false)Determine PKG_ROOT (per D-01~D-04).
Run the following command with the Bash tool (D-02: npm root -g fallback when require.resolve fails):
PKG_ROOT=$(node -e "
try {
const pkg = require.resolve('@gyuha/super-gsd/package.json');
const path = require('path');
process.stdout.write(path.dirname(pkg));
} catch(e) { process.exit(1); }
" 2>/dev/null)
if [ -z "$PKG_ROOT" ]; then
PKG_ROOT=$(npm root -g 2>/dev/null)/@gyuha/super-gsd
[ ! -d "$PKG_ROOT" ] && PKG_ROOT=""
fi
if [ -z "$PKG_ROOT" ]; then
echo "[sg-setup] Cannot locate @gyuha/super-gsd package. Install it first:"
echo " npx @gyuha/super-gsd install"
exit 1
fi
echo "[sg-setup] PKG_ROOT: $PKG_ROOT"
Platform detection (per D-05~D-08).
When --gemini argument is absent, auto-detect via environment variables + directory (D-06):
if [ "$GEMINI" != "true" ]; then
if [ -n "$GEMINI_PROJECT_DIR" ] || [ -n "$GEMINI_API_KEY" ]; then
GEMINI=true
echo "[sg-setup] Gemini environment detected. Also copying .gemini/settings.json."
elif [ -n "$CODEX_SHELL" ] || [ -n "$CODEX" ] || [ -d ".codex" ]; then
echo "[sg-setup] Platform detected: codex (use --gemini to include Gemini settings)"
else
echo "[sg-setup] Platform not detected — copying default file set (hooks, .agents, .codex) only."
fi
fi
Assemble copy target list.
Files always copied:
hooks/stop_hook.cjshooks/rule_runner.cjshooks/transcript_matcher.cjshooks/lessons_ranker.cjshooks/hooks.json.agents/skills/sg-execute/SKILL.md.agents/skills/sg-learn/SKILL.md.agents/skills/sg-next/SKILL.md.agents/skills/sg-plan/SKILL.md.agents/skills/sg-retro/SKILL.md.agents/skills/sg-review/SKILL.md.agents/skills/sg-ship/SKILL.md.agents/skills/sg-start/SKILL.md.agents/skills/sg-status/SKILL.md.agents/skills/sg-toggle-tdd/SKILL.md.agents/skills/sg-toggle-review/SKILL.md.agents/skills/sg-toggle-learn/SKILL.md.codex/hooks.jsonAdded when GEMINI=true:
.gemini/settings.jsonExecute file copy (per D-09~D-12, using Bash tool).
Run the following script with the Bash tool. Replace FORCE, GEMINI, and PKG_ROOT variables with the values determined in prior steps:
DEST_ROOT=$(pwd)
COPIED=0
SKIPPED=0
ERRORS=0
copy_file() {
local REL_PATH="$1"
local SRC="$PKG_ROOT/$REL_PATH"
local DEST="$DEST_ROOT/$REL_PATH"
if [ ! -f "$SRC" ]; then
echo "✗ $REL_PATH: source not found in $PKG_ROOT"
ERRORS=$((ERRORS + 1))
return
fi
if [ -f "$DEST" ] && [ "$FORCE" != "true" ]; then
echo "⚠ $REL_PATH already exists — skipping (use --force to overwrite)"
SKIPPED=$((SKIPPED + 1))
return
fi
mkdir -p "$(dirname "$DEST")"
if cp "$SRC" "$DEST"; then
if [ -f "$DEST" ] && [ "$FORCE" = "true" ]; then
echo "✓ $REL_PATH (overwritten)"
else
echo "✓ $REL_PATH"
fi
COPIED=$((COPIED + 1))
else
echo "✗ $REL_PATH: copy failed"
ERRORS=$((ERRORS + 1))
fi
}
copy_file "hooks/stop_hook.cjs"
copy_file "hooks/rule_runner.cjs"
copy_file "hooks/transcript_matcher.cjs"
copy_file "hooks/lessons_ranker.cjs"
copy_file "hooks/hooks.json"
copy_file ".agents/skills/sg-execute/SKILL.md"
copy_file ".agents/skills/sg-learn/SKILL.md"
copy_file ".agents/skills/sg-next/SKILL.md"
copy_file ".agents/skills/sg-plan/SKILL.md"
copy_file ".agents/skills/sg-retro/SKILL.md"
copy_file ".agents/skills/sg-review/SKILL.md"
copy_file ".agents/skills/sg-ship/SKILL.md"
copy_file ".agents/skills/sg-start/SKILL.md"
copy_file ".agents/skills/sg-status/SKILL.md"
copy_file ".codex/hooks.json"
if [ "$GEMINI" = "true" ]; then
copy_file ".gemini/settings.json"
fi
echo ""
echo "Installation complete."
echo " Copied: $COPIED files"
echo " Skipped: $SKIPPED files (already exist)"
if [ "$ERRORS" -gt 0 ]; then
echo " Errors: $ERRORS (see above)"
fi
Completion notice.
[sg-setup] Installation complete. Next step: run /super-gsd:sg-execute to proceed with the current phase.
<success_criteria>
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub gyuha/super-gsd --plugin super-gsd25 skills in this plugin
/sg-cleanupUse this to archive accumulated phase directories from completed milestones — delegates to gsd-cleanup, then displays a table of what was archived./sg-completeComplete a phase (bare number → delegates to sg-phase) or close a milestone (vX.Y, or the current milestone when no argument) via gsd-complete-milestone./sg-executeUse this when the phase plan is ready and implementation should begin — packages PLAN/REQ/SC and hands off to Superpowers via superpowers:executing-plans./sg-exploreUse this when you need a map of the current codebase structure — invokes gsd-map-codebase to analyse and document the project layout./sg-healthUse this when something feels broken or before onboarding — diagnoses GSD, Superpowers, hooks, HANDOFF.md, and STATE.md installation line by line./sg-learnUse this when a phase is complete and you want to extract patterns and lessons from the session — delegates to sg-retro for structured retrospective.