Skip to content

feat(init): re-run UX — refresh/reconfigure/cancel (hew-0wa)#55

Merged
droidnoob merged 1 commit into
mainfrom
feat/init-rerun-ux
May 29, 2026
Merged

feat(init): re-run UX — refresh/reconfigure/cancel (hew-0wa)#55
droidnoob merged 1 commit into
mainfrom
feat/init-rerun-ux

Conversation

@droidnoob
Copy link
Copy Markdown
Owner

Closes hew-0wa — init re-run UX.

Problem

Today hew init is only partially idempotent: bd init and git init skip if already done, but every prompt re-asks and config::save() overwrites ~/.config/hew/config.toml from scratch. A user who runs hew init a second time gets a full re-interrogation and a silently-overwritten config.

Change

Detect the prior install on entry. Offer three explicit modes:

  • refresh — re-run write steps, keep config + runtime choices.
  • reconfigure — re-prompt the relevant questions, then write.
  • cancel — exit 0, no writes.

Non-interactive default is refresh (the safe idempotent path).

Detection

A directory counts as prior-inited if any of the following hold:

  • .claude/settings.json contains a hew_managed: true discriminator.
  • ~/.config/hew/config.toml exists with at least one non-default field.
  • The bd graph is initialised (bd list returns at least one issue).

Smoke (hew-diyp)

  • cargo build clean.
  • hew init --non-interactive --runtime=claude in a fresh git init'd tempdir succeeds.
  • Re-running the same command detects the prior install and mentions one of already / refresh / reconfigure / exists / detect in its output.

Out of scope

  • Partial-install repair (a separate hew doctor follow-up).
  • Migration between runtimes (--runtime=claude--runtime=codex on an existing install) — explicit hew init --reconfigure --runtime=codex covers the path; smarter migration is its own task.

🤖 Generated with Claude Code

…hew-0wa)

`hew init` re-runs were partially idempotent: skill install was safe, but
the prompt chain re-asked every question and config::save() overwrote
`~/.config/hew/config.toml` from scratch (silently erasing tri-state
SkillMode choices on ESC).

- hew_core::install: new `detect_existing(runtime, root)` checking the
  hew-specific artifact per runtime (claude SKILL.md, codex hew-execute
  SKILL.md, cursor/windsurf HEW:BEGIN marker, generic CLAUDE.md).
  Stricter than detect_runtimes — empty `.claude/` no longer counts as
  a hew install.
- hew/init: `--reconfigure` flag, `InitMode {Fresh,Refresh,Reconfigure,
  Cancel}`, `detect_init_mode()` resolver + interactive 3-option picker.
  Refresh skips the prompt block + persist_config; Cancel short-circuits
  before bd init and install. Summary panel header reflects the mode
  (Setup complete / Refreshed / Reconfigured).
- 5 unit tests for detect_existing per runtime + 3 e2e tests covering
  refresh-keeps-config, reconfigure-overwrites, and fresh-dir paths.
- CHANGELOG entry under [Unreleased].
@droidnoob droidnoob force-pushed the feat/init-rerun-ux branch from ccf06d7 to 26e1a00 Compare May 29, 2026 21:15
@droidnoob droidnoob merged commit 0e2d597 into main May 29, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant