Skip to content

Conversation

@bhauman
Copy link
Owner

@bhauman bhauman commented Jan 2, 2026

Summary

  • Default --dir to current working directory, eliminating the need to specify it
  • Make --port optional - only needed when REPL eval features are required
  • Initialize nREPL environment lazily, only when a port is provided
  • Aligns prompt-cli initialization with how main.clj and core.clj handle startup

This allows running prompt-cli without a running nREPL server, which is useful for tasks that do not require code evaluation (file analysis, code review, etc.).

Test plan

  • Run clojure -M:prompt-cli -h to verify updated help text
  • Run clojure -M:prompt-cli -p "What is 2+2?" -m :google/gemini-2-5-flash without nREPL
  • Verify linter passes
  • Verify all tests pass

Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Improvements
    • Made the directory parameter optional, now defaults to current directory for easier startup
    • Made the port parameter optional to enable flexible REPL features
    • Reworked CLI initialization flow to support both directory-based and port-based usage modes
    • Updated help text and usage examples

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

Previously prompt-cli required an nREPL connection at startup. Now it
defaults to using the current directory as the project directory,
making nREPL optional. This aligns with how main.clj and core.clj
handle initialization.

- Default --dir to current working directory
- Make --port optional (only needed for REPL eval features)
- Initialize environment lazily only when port is provided

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 2, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes update CLI option defaults and descriptions in the Clojure MCP prompt CLI, making the directory option default to the current directory and the port option optional. The main control flow is refactored to support lazy nREPL initialization: if a directory is provided, it's used directly with local environment detection; otherwise, nREPL connection handles remote environment discovery.

Changes

Cohort / File(s) Summary
CLI Options & Lazy nREPL Initialization
src/clojure_mcp/prompt_cli.clj
Updated -d/--dir to default to current directory; changed -P/--port to optional (no default). Reworked run-prompt and -main to defer nREPL initialization when directory is provided, enabling conditional environment detection and REPL helper loading. Adjusted logging, startup messages, and help text to reflect directory-based vs. port-based execution paths.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI Parser
    participant App as Main App
    participant FS as Local FS
    participant REPL as nREPL Connection
    participant Env as Environment Detection

    rect rgb(200, 220, 255)
    Note over CLI,Env: New Flow: Directory-based (Lazy nREPL)
    CLI->>App: Parse args (dir provided, no port)
    App->>FS: Load project from local dir
    FS-->>App: Project config
    App->>Env: Detect env locally
    Env-->>App: Environment info
    App->>App: Skip nREPL init
    end

    rect rgb(220, 200, 255)
    Note over CLI,Env: New Flow: Port-based (nREPL initialization)
    CLI->>App: Parse args (no dir, port provided)
    App->>REPL: Establish nREPL connection
    REPL->>REPL: Initialize nREPL server
    REPL-->>App: Connected
    App->>REPL: Fetch project directory
    REPL-->>App: Project location
    App->>REPL: Detect environment type
    REPL-->>App: Environment info
    App->>REPL: Load REPL helpers
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐇 Hop, skip, and bound through the CLI,
No nREPL needed when dirs are nigh,
Lazy init blooms where ports reside,
Local or remote, we choose our stride!


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c30320 and 6a89141.

📒 Files selected for processing (1)
  • src/clojure_mcp/prompt_cli.clj

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.

@bhauman bhauman merged commit c2f4954 into main Jan 2, 2026
1 of 2 checks passed
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