rtk-ai / rtk-ai/rtk

feat(init): interactive config wizard for rtk init

Open
#331 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli effort-large enhancement help wanted priority:low
Dominant language
Rust
Stars
81k
Forks
5.1k
Avg merge
4d 21h
Merged PRs (30d)
35

Description

Contexte

rtk init expose aujourd'hui des flags booléens qui composent mal pour un nouvel utilisateur :

rtk init -g                   # hook + RTK.md (recommended)
rtk init -g --hook-only        # hook only
rtk init -g --claude-md        # legacy 137-line injection
rtk init -g --auto-patch       # no prompt for settings.json
rtk init -g --no-patch         # print manual instructions
rtk init --show                # status only
rtk init -g --uninstall        # remove everything

Le problème : les flags sont découvrables uniquement via --help. Un nouvel utilisateur ne sait pas quoi choisir entre --hook-only, --claude-md, --auto-patch. Ce n'est pas un vrai wizard — c'est une API interne exposée comme CLI.

Proposition

Transformer rtk init en wizard interactif optionnel, avec des paramètres nommés pour les cas d'usage programmatiques.

Mode 1 — Wizard interactif (défaut sans flags)
$ rtk init --global

  RTK Setup Wizard
  ────────────────

  Where do you want RTK active?
  > [1] All Claude Code projects (recommended)
    [2] This project only

  What to install?
  > [1] Hook + RTK.md context (recommended, ~10 tokens)
    [2] Hook only (zero tokens in context)
    [3] Legacy: full instructions in CLAUDE.md (~2000 tokens)

  Patch ~/.claude/settings.json automatically?
  > [y/N]

  Summary:
    Hook    → ~/.claude/hooks/rtk-rewrite.sh ✓
    RTK.md  → ~/.claude/RTK.md ✓
    CLAUDE.md → @RTK.md added ✓
    settings.json → RTK hook registered ✓
Mode 2 — Paramètres nommés (non-interactif, CI/scripts)
# Flags explicites (comportement actuel préservé)
rtk init --global --auto-patch

# Nouveaux paramètres nommés
rtk init --global --mode=hook-only
rtk init --global --mode=full         # hook + RTK.md (défaut)
rtk init --global --mode=claude-md    # legacy

rtk init --global --patch=auto        # équivalent --auto-patch
rtk init --global --patch=manual      # équivalent --no-patch
rtk init --global --patch=ask         # défaut (prompt)

# Shorthand complet pour CI/CD
rtk init --global --yes               # accepte tout sans prompt (= --auto-patch + wizard auto)
Mode 3 — Dev hooks (nouveau)
# Pour les contributeurs du projet RTK lui-même
rtk init --dev-hooks
# → Installe .git/hooks/pre-push qui lance scripts/validate-docs.sh
# → Détecte auto qu'on est dans le repo rtk-ai/rtk via Cargo.toml name

Comportement de détection

rtk init sans flags et sans --global :

  • Si dans un repo avec CLAUDE.md local → propose local setup
  • Si hors repo → propose --global automatiquement

Non-breaking

Les flags actuels (--hook-only, --claude-md, --auto-patch, --no-patch) restent fonctionnels. Le wizard s'active uniquement quand stdin est un TTY (interactif). En non-TTY (pipe, CI), comportement actuel préservé.

Implémentation suggérée

  • Librairie pour les prompts interactifs : dialoguer (Rust, 1M+ downloads, MIT)
  • Détection TTY : atty ou std::io::IsTerminal (Rust 1.70+)
  • Non-interactif : inchangé

Critères d'acceptance

  • rtk init -g sans autres flags → lance le wizard si TTY
  • rtk init -g --yes → setup complet sans prompt
  • rtk init -g --mode=hook-only → hook uniquement
  • rtk init -g --dev-hooks → install git pre-push hook depuis scripts/validate-docs.sh
  • Tous les anciens flags continuent de fonctionner
  • rtk init --show inchangé
  • Tests : pas de régression sur run() et show_config()

Priorité

Medium — améliore significativement le DX des nouveaux utilisateurs, mais l'existant fonctionne.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the rtk init entry point and the existing run() and show_config() paths, then inspect how the current flags are parsed. Review scripts/validate-docs.sh and the repository's Cargo.toml before designing dev-hook detection. Done means the wizard, named non-interactive modes, TTY behavior, legacy flags, --show, and the listed regression tests all work without breaking existing usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.