بنقرة واحدة
sg-setup
Copy super-gsd hook and skill files to the current project — Codex/Gemini in-session installer
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Copy super-gsd hook and skill files to the current project — Codex/Gemini 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 — Codex/Gemini in-session installer |
| argument-hint | [--gemini] [--force] - --gemini: also copy .gemini/settings.json, --force: overwrite existing files |
<execution_context> Self-contained. Determines the @gyuha/super-gsd package root via require.resolve, then copies files to the current project using AI Read/Write tools. </execution_context>
0. **Argument parsing.**Split ARGUMENTS by whitespace to extract flags:
--force present → FORCE=true (default false)--gemini present → GEMINI=true (default false)Determine PKG_ROOT (per D-01~D-04).
Run the following Node.js code via Bash to determine PKG_ROOT (D-02: npm root -g fallback if 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 is not present, auto-detect from env vars + directories (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
Build copy target list.
Always-copied files (Codex default set):
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.codex/hooks.jsonAdditional when GEMINI=true:
.gemini/settings.jsonExecute file copy (per D-09~D-16, using AI Read/Write tools).
For each copy target:
a. Source path: $PKG_ROOT/<relative-path>
b. Destination path: <cwd>/<relative-path>
Conflict handling (per D-09~D-12):
Copy files with AI tools (per D-13~D-16):
$PKG_ROOT/<relative-path><cwd>/<relative-path>Output result after processing each file:
✓ <relative-path>⚠ <relative-path> already exists — skipping (use --force to overwrite)✗ <relative-path>: <error message>Output summary (per D-13~D-16).
After all files are processed:
Installation complete.
Copied: <copied> files
Skipped: <skipped> files (already exist)
If errors > 0, additionally:
Errors: <errors> (see above)
Completion message:
[sg-setup] Installation complete. Next step: run $sg-execute to proceed with the current phase.
<success_criteria>