Skip to content

feat(minimal): prompt to init when activate has no minimal.toml - #682

Merged
0chroma merged 3 commits into
mainfrom
0chroma/feat-activate-prompt-init
Jul 14, 2026
Merged

feat(minimal): prompt to init when activate has no minimal.toml#682
0chroma merged 3 commits into
mainfrom
0chroma/feat-activate-prompt-init

Conversation

@0chroma

@0chroma 0chroma commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

When minimal activate is run in a project without a minimal.toml, the client now prompts the user to create one instead of the daemon silently scaffolding a default (the temporary mctx::scaffold_default_mfile path, which does a blocking network git clone). This is the last remaining P0 item from gominimal/inbox#159.

Changes

  • cmd_activate now calls ensure_mfile_or_prompt after canonicalizing the project path. If no minimal.toml exists, it prompts Would you like to create one? [Y/n]:
    • Yes (Linux): runs the same init flow as minimal init (detect stack, generate minimal.toml, confirm, write)
    • Yes (macOS): bails with a clear message — minimal init is Linux-only due to mctx/op pulling in hakoniwa/procfs
    • No: bails with No minimal.toml found. Run 'minimal init' to create one.
  • run_init_flow extracted from cmd_init so both cmd_init and the activate prompt share the same init logic (plan display, confirmation prompt, file write)
  • activate_creates_session test updated to use a tempdir with a minimal.toml so the prompt doesn't fire

Closes the last P0 item on gominimal/inbox#159.

Summary by CodeRabbit

  • New Features
    • Activation now verifies the required project config file exists before starting a session.
    • If the file is missing on Linux, activation can guide you through creating it automatically.
  • Bug Fixes
    • Activation no longer proceeds when the required project config file is absent.
    • Non-Linux systems now provide clearer instructions for creating the config file.
  • Tests
    • Updated CLI integration test setup to include the required config file, preventing prompt-related flakiness.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@0chroma, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: 7f93f8e0-9c73-4034-9281-ef483651373d

📥 Commits

Reviewing files that changed from the base of the PR and between 3c0f4d6 and 714c1b8.

📒 Files selected for processing (2)
  • crates/minimal/src/lib.rs
  • crates/minimal/tests/cli.rs
📝 Walkthrough

Walkthrough

Adds 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.

Changes

Missing minimal.toml prompt and init refactor

Layer / File(s) Summary
Refactor init flow into shared helper
crates/minimal/Cargo.toml, crates/minimal/src/lib.rs
Adds the mfile workspace dependency, extracts initialization into run_init_flow, updates cmd_init to delegate to it, and adds contextual stdin and file-write errors.
Check for minimal.toml before activation
crates/minimal/src/lib.rs
Activation checks for minimal.toml, prompts to create it when absent, runs initialization on Linux, and aborts with guidance on other platforms.
Update activation test fixture
crates/minimal/tests/cli.rs
The test creates a temporary project, writes minimal.toml, and passes its path to activation.

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
Loading

Poem

A rabbit checks the project floor,
For minimal.toml by the door.
If missing, prompts begin,
Then init writes the file within. 🐇


Note

🎁 Summarized by CodeRabbit Free

Your 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 @coderabbitai help to get the list of available commands.

Comment thread crates/minimal/src/lib.rs Outdated
#[cfg(target_os = "linux")]
{
let config = if global.repo_dir.is_some() {
build_config(global).map_err(|e| anyhow::anyhow!("{e}"))?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread crates/minimal/src/lib.rs Outdated
}

eprintln!("\nNo {} found at {}.", mfile::MFILE_NAME, project_path);
eprint!("Would you like to create one? [Y/n] ");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

0chroma added 2 commits July 14, 2026 01:17
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.
@0chroma
0chroma force-pushed the 0chroma/feat-activate-prompt-init branch from 3c0f4d6 to 3edd3fc Compare July 14, 2026 08:28
Missing closing brace after removing the #[cfg] blocks caused
an unclosed delimiter compile error.
@0chroma
0chroma requested a review from twitchyliquid64 July 14, 2026 09:01
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.

2 participants