بنقرة واحدة
sg-setup
Copy super-gsd hook and skill files to the current project — Claude Code in-session installer
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Copy super-gsd hook and skill files to the current project — Claude Code in-session installer
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Detect the current workflow stage from HANDOFF.md and STATE.md and report the next sg-* skill to activate.
Detect existing session or start new project — super-gsd workflow entry point
Display current workflow stage, last handoff timestamp, and next recommended command
Toggle the sg-learn stage on or off in the super-gsd workflow by flipping super_gsd.skip_learn in .planning/config.json. Accepts on|off, or no argument to flip.
Toggle the sg-review stage on or off in the super-gsd workflow by flipping super_gsd.skip_review in .planning/config.json. Accepts on|off, or no argument to flip.
Toggle the sg-tdd stage on or off in the super-gsd workflow by flipping super_gsd.tdd_mode in .planning/config.json. Accepts on|off, or no argument to flip.
| name | sg-setup |
| description | Copy super-gsd hook and skill files to the current project — Claude Code in-session installer |
| argument-hint | [--gemini] [--force] - --gemini: also copy .gemini/settings.json, --force: overwrite existing files |
<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>