init: friendly summary + menu when re-running on a configured install#181
Merged
Conversation
Re-running hypaware with no args (or hyp init) on an install that already has a valid config no longer drops straight into the first-run picker. It prints a short friendly summary (what's collected, where it saves, daemon state, cache size and retention) and offers a small single-select menu: Reconfigure, See full status, or Quit. Quit is the default, so a bare enter leaves the setup untouched. Centrally-managed (fleet-joined) configs are locked locally, so the summary says so and the menu drops Reconfigure. A missing or invalid config still falls through to the walkthrough unchanged. Documents the decision in LLP 0011 and annotates the entry gate with a ref to it. Adds traditional tests for the summary text, the locked vs local menu, the readline fallback, and an end-to-end dispatch path.
- Declare the test-facing exports (buildConfiguredMenuOptions, legacyConfiguredActionPrompt, renderConfigSummary) in the hand-written core_commands.d.ts so tsc sees them; the missing decls were the typecheck failure. - Drop em dashes from new prose/comments and the user-facing summary string (now parenthesised) per house preference. - Use an @import for HypAwareStatusReport in the test instead of an inline import() type. - Round the bytes fallback branch in formatBytesShort. - Add an end-to-end test for the See full status menu branch, proving runStatus renders correctly under the init boot ctx.
Contributor
Author
Self-review (
|
| sev | angle | finding | status |
|---|---|---|---|
| blocker | typecheck | new test-facing exports missing from the hand-written core_commands.d.ts, so tsc failed |
fixed in e1e359e (declared buildConfiguredMenuOptions / legacyConfiguredActionPrompt / renderConfigSummary) |
| minor | correctness | runConfiguredEntry calls runStatus([], ctx); the "See full status" branch was untested, so a missing ctx.query/storage under the init boot profile would crash it |
verified safe + test added. The no-args path re-enters init reusing the booted kernel, so cmdCtx carries query/storage/sinks; new end-to-end test drives the status branch and asserts it renders and exits 0 |
| minor | conventions | em dashes in new prose/comments and the user-facing summary string | fixed (summary now reads set up (managed by your fleet).; @ref gloss keeps the house — gloss delimiter) |
| minor | conventions | test used an inline import('...') type in a JSDoc @param |
fixed (now an @import at the top of the file, per CLAUDE.md) |
| nit | robustness | formatBytesShort did not round its sub-KB branch |
fixed (Math.round) |
Considered, not blocking
- No try/catch around
runConfiguredEntry. A throw fromcollectHypAwareStatuswould now surface instead of silently falling into the walkthrough. Judged acceptable:collectHypAwareStatusalready backshyp statusand is robust, and a hard error on a broken status collection is more honest than masking it. Left as-is. - Non-TTY stdin with a TTY stdout (e.g.
echo | hypaware) prints the summary then takes the Quit default. This is intended: we cannot prompt without an interactive stdin, and Quit changes nothing.
Follow-ups (deferred, not in scope here)
- Friendly client/sink labels are a hardcoded map in core (
FRIENDLY_CLIENT_LABELS/FRIENDLY_SINK_LABELS); newer plugins fall back to raw names. Plugin-contributed labels would fit the LLP 0011 "plugins contribute picks" model better. promptConfiguredAction's "TUI select on a TTY, else readline" routing duplicates the shape ofwalkthrough.js's backfill-consent prompt; a shared single-select helper would dedupe both.- Pre-existing stderr "sink not materialized" noise that prints before this summary on fleet installs is tracked in Read-only CLI commands print noisy 'sink not materialized' warnings on fleet installs #180.
Checks: npx tsc --noEmit clean; npm run lint clean (423 files); npm test green (1473 pass / 0 fail / 1 pre-existing skip).
VERDICT: approve.
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.
What
Re-running
hypawarewith no args (orhyp init) on an install that already has a valid config used to drop straight into the first-run picker as if starting fresh. Now it prints a short, friendly summary of the current setup and offers a small single-select menu instead.hyp status.How
runConfiguredEntrygate inrunInitcollects the existing status report and, when the config is present and valid, renders the summary and prompts. The TUI uses the same arrow-navigableselectas the picker; a numbered readline menu is the fallback (HYP_NO_TUI / non-TTY stdin).Design
Documented in LLP 0011 ("Returning to a configured install"), with an
@refon the entry gate.Tests
New
test/core/init-configured-entry.test.jscovers the summary text (local + fleet), the locked-vs-local menu options, the readline fallback selection logic, and an end-to-end dispatch run proving the gate fronts the picker on quit. Full suite: 1472 pass.Follow-up
The stderr "sink not materialized" warnings that print before this summary on fleet installs are tracked separately in #180.