Skip to content

Conversation

@pepicrft
Copy link

@pepicrft pepicrft commented Dec 29, 2025

Fixes #492

Adds a mise config with a postinstall task that installs Ruby/Node deps and prepares the DB, plus quick-start docs for using mise.

  • add .mise install task
  • run it via postinstall hook
  • update README getting started

Summary by CodeRabbit

  • New Features

    • Streamlined project setup: automated environment creation, dependency installation, and optional database preparation for faster onboarding.
  • Documentation

    • Updated Getting Started to use the new install workflow and added a descriptive explanation.
    • Expanded demo login credentials to include password.
  • Chores

    • Added tool version configuration and a post-install hook.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2025

📝 Walkthrough

Walkthrough

Adds mise integration: a new mise.toml declaring tool versions and a post-install hook, a .mise/tasks/install.sh script that bootstraps dependencies and optionally prepares the DB, and README updates replacing bin/setup with mise install plus demo credential details.

Changes

Cohort / File(s) Summary
Mise config
mise.toml
Adds tool version pins (Ruby 3.4.7, Node 20, Postgres 16, Redis 7) and a hooks.postinstall entry to run mise run install.
Install task script
.mise/tasks/install.sh
New strict Bash script: verifies bundle and npm on PATH, initializes .env.local from example if missing, runs bundle check/bundle install as needed, runs npm install, and conditionally runs bin/rails db:prepare unless SKIP_DB_SETUP=1.
Docs / Help
README.md
Replaces bin/setup with mise install in Getting Started, adds a short description of what mise install does, and expands demo login credentials to include Password.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Mise as mise (runner)
  participant Script as .mise/tasks/install.sh
  participant Bundler as bundle
  participant NPM as npm
  participant Rails as bin/rails

  rect rgb(230, 248, 255)
    Dev->>Mise: run "mise install"
    Mise->>Script: execute install.sh
  end

  rect rgb(240,255,230)
    Script->>Bundler: check `bundle` in PATH
    alt bundle missing
      Script-->>Dev: exit with install guidance
    else bundle present
      Script->>Bundler: run `bundle check`
      alt gems missing
        Script->>Bundler: run `bundle install`
      end
    end
  end

  rect rgb(255,245,230)
    Script->>NPM: check `npm` in PATH
    alt npm missing
      Script-->>Dev: exit with install guidance
    else
      Script->>NPM: run `npm install`
    end
  end

  rect rgb(245,230,255)
    alt SKIP_DB_SETUP != 1
      Script->>Rails: run `bin/rails db:prepare`
      Rails-->>Script: db prepared
    else SKIP_DB_SETUP = 1
      Script-->>Dev: skip DB setup
    end
  end

  Script-->>Mise: exit status
  Mise-->>Dev: completion result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hopped in a script with a clap and a wink,
I stitch gems and packages in just one blink,
Env copied, Node fed, DB nearly set,
One mise install — the quickest duet!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding a mise configuration with a postinstall hook and updating documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 528597c and e501a72.

📒 Files selected for processing (3)
  • .mise/tasks/install.sh
  • README.md
  • mise.toml
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-24T16:54:59.198Z
Learnt from: CR
Repo: we-promise/sure PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:54:59.198Z
Learning: Start development server using `bin/dev` for Rails, Sidekiq, and Tailwind CSS watcher

Applied to files:

  • .mise/tasks/install.sh
  • README.md
🔇 Additional comments (3)
README.md (1)

69-78: LGTM!

The documentation clearly explains the new mise install workflow while preserving the legacy bin/setup option for users who prefer it. Good balance of brevity and informativeness.

.mise/tasks/install.sh (1)

14-19: LGTM!

Good implementation:

  • The bundle check || bundle install pattern avoids unnecessary reinstalls.
  • The SKIP_DB_SETUP environment variable provides useful flexibility for CI or containerized environments.
  • Using bin/rails ensures the correct Rails binstub is invoked.
mise.toml (1)

1-8: No issues identified. Ruby 3.4.7 is a valid released version and all tool versions in the configuration are current and appropriate.

Comment on lines +4 to +12
if ! command -v bundle >/dev/null 2>&1; then
echo "bundle not found in PATH; run 'mise install' first."
exit 1
fi

if ! command -v npm >/dev/null 2>&1; then
echo "npm not found in PATH; run 'mise install' first."
exit 1
fi
Copy link

@coderabbitai coderabbitai bot Dec 29, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Error messages are misleading.

These error messages tell the user to run mise install, but this script is the install task triggered by mise install. If bundle or npm aren't available, it means mise hasn't activated the Ruby/Node tools yet—not that the user forgot to run mise install.

Consider rewording to clarify the actual issue:

🔎 Proposed fix
 if ! command -v bundle >/dev/null 2>&1; then
-  echo "bundle not found in PATH; run 'mise install' first."
+  echo "Error: bundle not found. Ensure mise has activated Ruby (mise trust && mise install)."
   exit 1
 fi
 
 if ! command -v npm >/dev/null 2>&1; then
-  echo "npm not found in PATH; run 'mise install' first."
+  echo "Error: npm not found. Ensure mise has activated Node (mise trust && mise install)."
   exit 1
 fi
🤖 Prompt for AI Agents
.mise/tasks/install.sh lines 4-12: the current error messages incorrectly tell
the user to "run 'mise install' first" even though this script is the install
task; update the messages to clearly state that the required executables
("bundle" and "npm") were not found and instruct the user to either install the
appropriate runtime/toolchain or ensure the tools are available on PATH (for
example by activating the environment or reloading their shell), so replace the
misleading lines with concise guidance to install the missing tool or make it
accessible in PATH.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This does feel a little recursive, no @pepicrft?

Copy link

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thoughts, @pepicrft?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.mise/tasks/install.sh (1)

18-19: Consider checking npm dependencies before installing.

The bundle check pattern efficiently skips installation when dependencies are satisfied. For consistency, you could apply a similar check for npm:

🔎 Proposed refactor
 bundle check >/dev/null 2>&1 || bundle install
-npm install
+npm list --depth=0 >/dev/null 2>&1 || npm install
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e501a72 and ecfdc37.

📒 Files selected for processing (2)
  • .mise/tasks/install.sh
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-24T16:54:59.198Z
Learnt from: CR
Repo: we-promise/sure PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:54:59.198Z
Learning: Start development server using `bin/dev` for Rails, Sidekiq, and Tailwind CSS watcher

Applied to files:

  • .mise/tasks/install.sh
📚 Learning: 2025-11-24T16:54:59.198Z
Learnt from: CR
Repo: we-promise/sure PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:54:59.198Z
Learning: Use `bin/rubocop -f github -a` for Ruby linting and `bundle exec erb_lint ./app/**/*.erb -a` for ERB templates before opening PR

Applied to files:

  • .mise/tasks/install.sh
🔇 Additional comments (2)
.mise/tasks/install.sh (2)

1-2: LGTM!

The strict error handling flags ensure the script fails fast on errors, undefined variables, or pipe failures.


21-23: LGTM!

The conditional DB setup with SKIP_DB_SETUP provides a clean escape hatch for environments where database preparation isn't needed or desired.

cd sure
cp .env.local.example .env.local
bin/setup
mise install
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if we make mise install the first (and only?) line in bin/setup?

Is is equivalent to all the steps bin/setup used to carry out?

#!/usr/bin/env ruby
require "fileutils"

# path to your application root.
APP_ROOT = File.expand_path("..", __dir__)

def system!(*args)
  system(*args, exception: true)
end

FileUtils.chdir APP_ROOT do
  # This script is a way to set up or update your development environment automatically.
  # This script is idempotent, so that you can run it at any time and get an expectable outcome.
  # Add necessary setup steps to this file.

  puts "== Installing dependencies =="
  system! "gem install bundler --conservative"
  system("bundle check") || system!("bundle install")

  # puts "\n== Copying sample files =="
  # unless File.exist?("config/database.yml")
  #   FileUtils.cp "config/database.yml.sample", "config/database.yml"
  # end

  puts "\n== Preparing database =="
  system! "bin/rails db:prepare"

  puts "\n== Removing old logs and tempfiles =="
  system! "bin/rails log:clear tmp:clear"

  puts "\n== Restarting application server =="
  system! "bin/rails restart"
end

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thoughts, @pepicrft?

Copy link
Collaborator

Choose a reason for hiding this comment

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

For instance: keeping the bin/rails restart sounds like a nice thing, right?

Comment on lines +4 to +12
if ! command -v bundle >/dev/null 2>&1; then
echo "bundle not found in PATH; run 'mise install' first."
exit 1
fi

if ! command -v npm >/dev/null 2>&1; then
echo "npm not found in PATH; run 'mise install' first."
exit 1
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does feel a little recursive, no @pepicrft?

@@ -0,0 +1,8 @@
[tools]
ruby = "3.4.7"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this be read from .ruby-version?

@jjmata jjmata added this to the v0.6.7 milestone Jan 8, 2026
@jjmata
Copy link
Collaborator

jjmata commented Jan 14, 2026

Look who's using mise already (Codex Cloud):

Screenshot 2026-01-14 at 3 23 12 PM

So we'd be running mise inside of a mise task? Inception!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Ease project dependency installation for contributors

2 participants