feat(minimal): prompt to init when activate has no minimal.toml - #682
Conversation
|
Warning Review limit reached
Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a workspace dependency on mfile, checks for minimal.toml before activation, prompts or runs the shared Linux initialization flow when it is missing, provides non-Linux guidance, and updates the activation test fixture. ChangesMissing minimal.toml prompt and init refactor
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant cmd_activate
participant ensure_mfile_or_prompt
participant run_init_flow
User->>cmd_activate: activate(path)
cmd_activate->>ensure_mfile_or_prompt: check minimal.toml
alt minimal.toml missing
ensure_mfile_or_prompt->>User: prompt to create file
alt Linux
ensure_mfile_or_prompt->>run_init_flow: initialize project
run_init_flow-->>ensure_mfile_or_prompt: write minimal.toml
else non-Linux
ensure_mfile_or_prompt-->>cmd_activate: abort with guidance
end
end
ensure_mfile_or_prompt-->>cmd_activate: continue activation
Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above. Comment |
| #[cfg(target_os = "linux")] | ||
| { | ||
| let config = if global.repo_dir.is_some() { | ||
| build_config(global).map_err(|e| anyhow::anyhow!("{e}"))? |
There was a problem hiding this comment.
99% of mctx, graph etc we should be able to get working on non-linux, we just need to flag out the hakoniwa stuff and have stubs for the execution / run / process types.
Optional if you want to do that here (otherwise maybe leave a comment), but using that machinery here would be the ideal case.
There was a problem hiding this comment.
Agreed — the dep chain is accidental. ProjectSetup::for_init never touches the sandbox; it only needs VCS + graph + mfile parsing. I looked into the trait-extraction approach (split sandbox2 into a lightweight sandbox2-api crate with the trait/err types, make mctx depend on the API unconditionally and on full sandbox2 behind a feature). That avoids ~200 lines of #[cfg] and keeps the boundary clean.
Discussed with @norrietaylor / @msample — tracking as a follow-up rather than expanding this PR. Left a note on gominimal/inbox#159 with the direction.
| } | ||
|
|
||
| eprintln!("\nNo {} found at {}.", mfile::MFILE_NAME, project_path); | ||
| eprint!("Would you like to create one? [Y/n] "); |
There was a problem hiding this comment.
This wont be the last time we need to prompt. Might be time to bring in a crate like dialoguer, or at least have a common codepath for confirmation prompts?
There was a problem hiding this comment.
Good call — extracted a shared confirm helper in the latest push. It deduplicates both prompt sites (activate missing-mfile and init confirmation). Skipped dialoguer for now since it's a new dep for a 2-call-site pattern, but easy to swap in later if prompts grow.
When `minimal activate` is run in a project without a `minimal.toml`, the client now prompts the user to create one instead of silently scaffolding on the daemon side. On Linux, accepting the prompt runs the same init flow as `minimal init`; on macOS, it bails with a clear message. Refactored the init logic into a shared `run_init_flow` helper used by both `cmd_init` and the activate prompt.
Deduplicates the confirmation prompt pattern between the activate missing-mfile prompt and the init flow. Extracts a common codepath as suggested in PR review.
3c0f4d6 to
3edd3fc
Compare
Missing closing brace after removing the #[cfg] blocks caused an unclosed delimiter compile error.
Summary
When
minimal activateis run in a project without aminimal.toml, the client now prompts the user to create one instead of the daemon silently scaffolding a default (the temporarymctx::scaffold_default_mfilepath, which does a blocking network git clone). This is the last remaining P0 item from gominimal/inbox#159.Changes
cmd_activatenow callsensure_mfile_or_promptafter canonicalizing the project path. If nominimal.tomlexists, it promptsWould you like to create one? [Y/n]:minimal init(detect stack, generateminimal.toml, confirm, write)minimal initis Linux-only due tomctx/oppulling inhakoniwa/procfsNo minimal.toml found. Run 'minimal init' to create one.run_init_flowextracted fromcmd_initso bothcmd_initand the activate prompt share the same init logic (plan display, confirmation prompt, file write)activate_creates_sessiontest updated to use a tempdir with aminimal.tomlso the prompt doesn't fireCloses the last P0 item on gominimal/inbox#159.
Summary by CodeRabbit