feat(init): re-run UX — refresh/reconfigure/cancel (hew-0wa)#55
Merged
Conversation
…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].
ccf06d7 to
26e1a00
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes
hew-0wa— init re-run UX.Problem
Today
hew initis only partially idempotent:bd initandgit initskip if already done, but every prompt re-asks andconfig::save()overwrites~/.config/hew/config.tomlfrom scratch. A user who runshew inita second time gets a full re-interrogation and a silently-overwritten config.Change
Detect the prior install on entry. Offer three explicit modes:
Non-interactive default is
refresh(the safe idempotent path).Detection
A directory counts as prior-inited if any of the following hold:
.claude/settings.jsoncontains ahew_managed: truediscriminator.~/.config/hew/config.tomlexists with at least one non-default field.bd listreturns at least one issue).Smoke (hew-diyp)
cargo buildclean.hew init --non-interactive --runtime=claudein a freshgit init'd tempdir succeeds.already / refresh / reconfigure / exists / detectin its output.Out of scope
hew doctorfollow-up).--runtime=claude→--runtime=codexon an existing install) — explicithew init --reconfigure --runtime=codexcovers the path; smarter migration is its own task.🤖 Generated with Claude Code