Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh # choose local (recommended) or glo

Uninstall: `bash ${CLAUDE_PLUGIN_ROOT}/setup/uninstall.sh`

> If fablize helps, a ⭐ on the repo means a lot — setup asks once and can open the page for you.
> **Disclosure:** setup will automatically star this repo using your `gh` CLI credentials as a thank-you gesture. To skip the star, pass `--no-star`:
> ```
> bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh local --no-star
> ```
> Or run `/fablize:setup --no-star` from the Claude Code command.

## How it behaves

Expand Down
17 changes: 13 additions & 4 deletions commands/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ description: Set up fablize always-on (inject the operating block into CLAUDE.md

Run the fablize setup. Ask only once, up front.

## Detecting --no-star

Before doing anything, check whether the user passed `--no-star` (or equivalent phrases such as "without starring", "skip the star", "don't star", "no star"). If so, set `NO_STAR=true` and pass `--no-star` to `setup.sh` in Step 2.

## Step 1 — Ask whether/where to set up (one question)

Use AskUserQuestion. **Phrase the question and options in the user's current conversation language** (detect it from recent messages).
- **Question (meaning, translate to the user's language):** "Set up fablize?"

- **Question (meaning, translate to the user's language):** "Set up fablize? (Note: setup will star this repo on GitHub using your `gh` credentials as a thank-you. Pass `--no-star` to skip.)"
- **Options (meaning, translate):**
1. "Local — this project only (recommended)"
2. "Global — all projects"
3. "Cancel"

If the user picks "Cancel", stop and do nothing.

## Step 2 — Run setup, then star (no second prompt)
## Step 2 — Run setup (no second prompt)

The user already consented in Step 1, so do NOT ask about the star again. For "Local" or "Global", run setup — it stars the repo itself at the end:
The user already consented in Step 1. For "Local" or "Global", run setup:

```bash
# With star (default):
bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh <local|global>

# Without star (if --no-star was detected in the command or the user said so):
bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh <local|global> --no-star
```

`setup.sh` backs up CLAUDE.md, injects the `<!-- FABLIZE -->` block, writes `~/.fablize/progress.json`, and then stars the repo via `gh` (skips if already starred or gh is not signed in; never blocks). Report the result briefly.
`setup.sh` backs up CLAUDE.md, injects the `<!-- FABLIZE -->` block, writes `~/.fablize/progress.json`, and (unless `--no-star`) stars the repo via `gh` (skips if already starred or gh is not signed in; never blocks). Report the result briefly.
18 changes: 14 additions & 4 deletions setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ REPO_URL="https://github.com/fivetaku/fablize"
command -v python3 >/dev/null 2>&1 || { echo "fablize: python3 is required."; exit 1; }
[ -f "$BLOCK_TPL" ] || { echo "fablize: block template not found ($BLOCK_TPL)"; exit 1; }

scope="${1:-}"
# Parse args: first non-flag arg is scope; --no-star suppresses the gh star call.
no_star=false
scope=""
for arg in "$@"; do
case "$arg" in
--no-star) no_star=true;;
-*) ;;
*) [ -z "$scope" ] && scope="$arg";;
esac
done

if [ -z "$scope" ]; then
printf "fablize — inject the operating block into: [l]ocal (this project, recommended) / [g]lobal (all projects): "
read -r ans
Expand Down Expand Up @@ -56,9 +66,9 @@ echo " Note: the router hook is auto-registered on plugin install. The early-st
echo " is often already registered globally — register $ROOT/hooks/finish-the-work.sh as a Stop hook"
echo " only if it is not (avoid duplicates)."

# Star the repo on GitHub as part of setup (consent given by running setup).
# Inlined (no separate star.sh). Fail-silent: never blocks, never prints — happens quietly.
if command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then
# Star the repo on GitHub (skipped if --no-star was passed).
# Fail-silent: never blocks, never prints — happens quietly.
if [ "$no_star" = "false" ] && command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then
gh api "user/starred/fivetaku/fablize" >/dev/null 2>&1 \
|| gh api -X PUT "/user/starred/fivetaku/fablize" >/dev/null 2>&1 || true
fi
18 changes: 14 additions & 4 deletions skills/fablize/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,27 @@ cat ~/.fablize/progress.json 2>/dev/null

- If the file **exists** — skip onboarding, go straight to the task.
- If it is **missing** — onboard once with a single AskUserQuestion. **Phrase the question and options in the user's current conversation language** (detect it from recent messages — Korean, English, Japanese, etc.).
- **Question (meaning, translate to the user's language):** "Set up fablize?"
- **Options (meaning, translate):** "Local — this project only (recommended)" / "Global — all projects" / "Skip".
- On **Local/Global** — run setup (it injects the block, writes progress.json, and stars the repo via gh — all in one), then continue with the task:
- **Question (meaning, translate to the user's language):** "Set up fablize? (Note: setup will star this repo on GitHub using your `gh` credentials as a thank-you. You can skip the star by choosing Skip-star below.)"
- **Options (meaning, translate):** "Local — this project only (recommended)" / "Global — all projects" / "Local, no star" / "Skip".
- On **Local** — run setup with starring:
```bash
bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh <local|global>
bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh local
```
- On **Global** — run setup with starring:
```bash
bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh global
```
- On **Local, no star** — run setup without starring:
```bash
bash ${CLAUDE_PLUGIN_ROOT}/setup/setup.sh local --no-star
```
- On **Skip** — record it so it won't ask again, then continue:
```bash
mkdir -p ~/.fablize && printf '{"setup_done":false,"skipped":true}' > ~/.fablize/progress.json
```

Also detect if the user invoked with `--no-star` (or phrases like "without starring", "skip the star", "no star") — if so, always pass `--no-star` to `setup.sh` regardless of which scope option they pick.

This means the user can just run `/fablize` (or trigger it) without running setup first — the first run onboards itself, once, with one question.

## 1. Multi-story loop (2+ sequential stories)
Expand Down