Skip to content

feat: revamp min init output - #773

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/init
Jul 15, 2026
Merged

feat: revamp min init output#773
twitchyliquid64 merged 1 commit into
mainfrom
tom/init

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jul 15, 2026

Copy link
Copy Markdown
Member
  • No longer yeet a shell stack if we couldnt match with a known stack.
  • No longer unconditionally make a shell task - that use case is covered by sessions
  • Create a default [session] section, with a few likely+recognizable CLI tools.

Summary by CodeRabbit

  • New Features

    • Project initialization now generates a session configuration with base tools and Vim.
    • Git is included automatically when initializing a project inside a Git repository.
    • Stack configuration is generated only when a matching stack is detected.
  • Bug Fixes

    • Removed unnecessary fallback stack and shell task configuration from generated project files.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Project initialization now passes the target repository to TOML generation. Generated files omit unmatched stack settings, always include base session packages, and add git when .git exists. Tests cover matched-stack and no-match output.

Changes

Project initialization generation

Layer / File(s) Summary
Repository-aware generation contract
crates/op/src/project/init.rs
InitProject::run passes repo_dir to generate_mfile, which now accepts the repository path.
Conditional stack and session rendering
crates/op/src/project/init.rs
TOML generation removes the shell fallback and task, emits [stack] only for matched stacks, and writes session packages based on .git; tests verify both rendering paths.

Estimated code review effort: 2 (Simple) | ~15 minutes

Suggested reviewers: msample

Poem

A rabbit watched the TOML grow,
With base and vim in tidy row.
A git leaf joins when repos bloom,
No shell stack haunts the empty room.
“Hop hooray!” the tests all sing.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly points to the main change: revamping the min init output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@twitchyliquid64
twitchyliquid64 enabled auto-merge (squash) July 15, 2026 21:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/op/src/project/init.rs (1)

329-346: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the complete session package behavior.

This test passes even if base or vim disappears, and no test covers adding git when .git exists. Assert the exact package list for both repository states, preferably by parsing the generated TOML.

Proposed coverage
     assert!(out.contains("[session]"));
+    assert!(out.contains(r#"packages = ["base", "vim"]"#));
 }
+
+#[test]
+fn generate_mfile_adds_git_to_session_for_git_repository() {
+    let origin = SpecOrigin::Repo(Repo::Git {
+        url: "u".to_string(),
+        rev: "r".to_string(),
+        tracking: None,
+    });
+    let cwd = TempDir::new().unwrap();
+    std::fs::create_dir(cwd.path().join(".git")).unwrap();
+
+    let out = generate_mfile(None, &origin, cwd.path());
+
+    assert!(out.contains(r#"packages = ["base", "vim", "git"]"#));
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/op/src/project/init.rs` around lines 329 - 346, Strengthen
generate_mfile_falls_back_to_upstream_with_session by parsing the generated TOML
and asserting the complete session package list, including base, vim, and git
when the temporary directory contains a .git directory. Add coverage for both
repository states: without .git, verify the expected packages excluding git;
with .git, verify git is included, while preserving the existing assertions for
absent stack, branch, and package sections.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/op/src/project/init.rs`:
- Around line 329-346: Strengthen
generate_mfile_falls_back_to_upstream_with_session by parsing the generated TOML
and asserting the complete session package list, including base, vim, and git
when the temporary directory contains a .git directory. Add coverage for both
repository states: without .git, verify the expected packages excluding git;
with .git, verify git is included, while preserving the existing assertions for
absent stack, branch, and package sections.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6606fb7e-77c6-4912-b4c2-4b1b5ee2b258

📥 Commits

Reviewing files that changed from the base of the PR and between cb3d9ce and 5d5c3ce.

📒 Files selected for processing (1)
  • crates/op/src/project/init.rs

@twitchyliquid64
twitchyliquid64 merged commit 9892df7 into main Jul 15, 2026
27 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/init branch July 15, 2026 22:04
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