Skip to content

fix: clearer MOSTRO_PUBKEY setup error for first-time users - #189

Open
VedantMadane wants to merge 1 commit into
MostroP2P:mainfrom
VedantMadane:fix/issue-184
Open

fix: clearer MOSTRO_PUBKEY setup error for first-time users#189
VedantMadane wants to merge 1 commit into
MostroP2P:mainfrom
VedantMadane:fix/issue-184

Conversation

@VedantMadane

@VedantMadane VedantMadane commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Clearer MOSTRO_PUBKEY setup error

Changes

  • Expand MOSTRO_PUBKEY missing error with ~/.config/mostro setup hint
  • Clarify that the config directory is not auto-created

Fixes #184

Summary by CodeRabbit

  • Bug Fixes
    • Improved configuration error guidance when MOSTRO_PUBKEY is missing.
    • Added instructions for creating and sourcing ~/.config/mostro/env.sh.
    • Clarified that the ~/.config/mostro directory is not created automatically and must be created manually before adding the environment file.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: e73d2e18-2370-4773-89e6-b6c299034cda

📥 Commits

Reviewing files that changed from the base of the PR and between ff7f4a2 and 99f3a50.

📒 Files selected for processing (1)
  • src/cli.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/cli.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The MOSTRO_PUBKEY configuration error now documents ~/.config/mostro/env.sh and states that the configuration directory must be created manually.

Changes

Configuration guidance

Layer / File(s) Summary
Expand MOSTRO_PUBKEY setup guidance
src/cli.rs
The error message now includes environment-file setup instructions and the manual directory-creation requirement.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 99f3a

The CLI now provides clearer guidance when MOSTRO_PUBKEY is missing, including the manual configuration-directory setup requirement. No current merge-readiness risk is identified.

Poem

A rabbit checks the shell today,
And finds a clearer setup way.
The env file waits in its new place,
The folder needs a paw-made space.
MOSTRO_PUBKEY now shows the way.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: improving the MOSTRO_PUBKEY setup error for first-time users.
Linked Issues check ✅ Passed The change addresses issue [#184] by clarifying MOSTRO_PUBKEY setup, adding guidance for ~/.config/mostro/env.sh, and stating that the directory is not created automatically. The existing command-line…
Out of Scope Changes check ✅ Passed The change is limited to the MOSTRO_PUBKEY configuration error message and directly supports issue [#184]. No unrelated changes are indicated.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

- Expand MOSTRO_PUBKEY missing error with ~/.config/mostro setup hint
- Clarify that the config directory is not auto-created

Fixes MostroP2P#184

Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>

@grunch grunch left a comment

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.

Thanks for taking this on — #184 is a real, recurring papercut and the error message is the right place to fix it.

Mechanical checks pass: cargo build --release, cargo fmt --check and cargo clippy --release --all-targets are all clean, the branch is up to date with main, and I verified the rendered output (Rust's \-newline continuation strips the leading indentation, so the message aligns correctly).

That said, I'd like a rewording before merging.

1. Option "3)" is not a method the CLI supports

resolve_mostro_pubkey only reads the flag and std::env::var("MOSTRO_PUBKEY"). There is no dotenv support anywhere in the binary — the README says so explicitly in About .env files. Listing ~/.config/mostro/env.sh as a peer of --mostropubkey and export implies mostro-cli reads that file.

That is exactly the misconception behind #184: the reporter went looking for ~/.config/mostro because they believed the tool used it. As written, the fix risks reinforcing the confusion it's meant to remove.

Suggestion — keep two methods and add a note instead of a third item:

MOSTRO_PUBKEY not set.
Provide it using one of the following methods:
1) --mostropubkey <npub>
2) export MOSTRO_PUBKEY=<npub>

mostro-cli does not read any config file. To avoid re-exporting every
time, put the exports in a file (e.g. ~/.config/mostro/env.sh) and
`source` it before running the CLI.
See https://github.com/MostroP2P/mostro-cli#configuration

2. The parenthetical is confusing out of context, and the pointer isn't actionable

"the config dir is not auto-created" answers a question the user hasn't asked yet, and implies some config dir might otherwise have been created. And "see README Configuration" doesn't help the #184 case: someone who ran cargo install mostro-cli has no checkout. Please use the URL.

3. Inconsistent with resolve_relays

The MOSTRO_PUBKEY error now mentions RELAYS, but resolve_relays still lists only two methods. A user who follows the new step 3 halfway then hits RELAYS not set, which contradicts what they just read. Either update both messages or keep each error scoped to its own variable (I'd prefer the latter, plus the shared note above).

4. No test coverage

tests/cli_functions.rs exists but nothing pins this message, which is the entire point of the PR. resolve_mostro_pubkey is private, so a test that runs the binary with the env cleared and asserts the guidance appears would do it. Not blocking for a string change, but right now there's zero regression protection.

Happy to merge once 1–3 are addressed — they're all in the same string literal.

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.

Initial setup: MOSTRO_PUBKEY not set.

2 participants