diff --git a/README.md b/README.md index 3b9e8f0..d6c9025 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Inside Claude Code: /clify-scaffold https://docs.example.com/api ``` -The skill walks the 13-step pipeline (fetch → parse → consult → init → substitute → validate → simplify → report) and produces `-cli/` next to the current directory. +The skill walks the 13-step pipeline (fetch → parse → consult → **ask where to put it** → init → substitute → validate → simplify → report). The generated CLI is **its own project**, in its own directory, with its own `git init` — by default a sibling of your current directory, but the skill asks before creating files. Output is `/-cli/`, never nested inside the calling repo unless you explicitly ask for that. You can also call the binary verbs directly: diff --git a/bin/clify.mjs b/bin/clify.mjs index d5ea62d..0c66237 100755 --- a/bin/clify.mjs +++ b/bin/clify.mjs @@ -107,7 +107,7 @@ function runScaffoldInit(args) { try { const result = scaffoldInit({ apiName, target }); if (json) process.stdout.write(JSON.stringify(result, null, 2) + "\n"); - else process.stdout.write(`scaffolded ${result.apiName} → ${result.dir}\n`); + else process.stdout.write(`scaffolded ${result.apiName} → ${result.dir}\n (next: cd into the dir, git init if you want history, then run /clify-scaffold's substitution phase)\n`); } catch (err) { process.stderr.write(`error: ${err.message}\n`); process.exit(1); diff --git a/skills/clify-scaffold/SKILL.md b/skills/clify-scaffold/SKILL.md index 7425d82..abd551f 100644 --- a/skills/clify-scaffold/SKILL.md +++ b/skills/clify-scaffold/SKILL.md @@ -62,13 +62,34 @@ Second prose pass for non-endpoint rules (units, formats, defaults, sequencing, Present findings to the user with opinionated recommendations. Use `AskUserQuestion` for unresolved tradeoffs (resource grouping, ambiguous verbs, what to drop). Record dropped endpoints with one of the allowed reasons (`user-excluded-step-7`, `deprecated-in-docs`, etc.) — never silently drop. -### 8. Init repo from exemplar (binary verb) +### 8. Decide where the new repo lives, then init from exemplar + +The generated CLI is its own project — a separate directory, not nested inside whatever repo the user happened to invoke `/clify-scaffold` from. Before running the binary verb, **ask the user with `AskUserQuestion`**: + +> "Where should I put `-cli/`? Default is `` (sibling of your current directory). I'll also `git init` the new repo unless you say otherwise." + +Options to offer: +- **Default** — parent of cwd (`..`), so the layout is `parent//` next to `parent/-cli/`. Right answer for almost every case, including when the user runs the skill from inside the clify repo itself. +- **Custom path** — user supplies an absolute or relative directory. +- **Here (nested)** — only when the user is explicit; warn that this couples the new CLI's git history to the parent. + +Then run the binary verb with the chosen target: + +``` +clify scaffold-init --target +``` + +This is the **deterministic copy + rename phase** — never do it by hand. Copies `examples/jsonplaceholder-cli/` to `/-cli/` and rewrites `jsonplaceholder` → ``, `JSONPLACEHOLDER` → ``, `JSONPlaceholder` → `` everywhere. + +Print the resolved absolute path to the user so they can confirm before substantive content lands. + +After the copy, `git init` the new repo (skip if the user opted out): ``` -clify scaffold-init --target +cd /-cli && git init -q && git add -A && git commit -q -m "Initial scaffold from clify exemplar" ``` -This is the **deterministic copy + rename phase** — never do it by hand. Copies `examples/jsonplaceholder-cli/` to `/-cli/` and rewrites `jsonplaceholder` → ``, `JSONPLACEHOLDER` → ``, `JSONPlaceholder` → `` everywhere. +The initial commit makes step 9's substitutions a clean diff the user can review. ### 9. Substitute API-specific content