Skip to content

feat: add interactive browse, section navigation, and --web to moose docs#3468

Open
oatsandsugar wants to merge 11 commits intomainfrom
claude/slack-add-moose-docs-cli-PPlTT
Open

feat: add interactive browse, section navigation, and --web to moose docs#3468
oatsandsugar wants to merge 11 commits intomainfrom
claude/slack-add-moose-docs-cli-PPlTT

Conversation

@oatsandsugar
Copy link
Contributor

@oatsandsugar oatsandsugar commented Feb 6, 2026

Summary

  • moose docs browse — interactive hierarchical picker that mirrors the docs site navigation (sections → groups → pages), with a secondary section picker for large guide pages. Auto-drills into sections with only one group (e.g., Guides skips straight to the page list).
  • --web flag — open any doc page in your default browser instead of printing; supports #anchor fragments
  • Section navigationmoose docs guides/chat-in-your-app#overview extracts just that H2/H3 section from large guide pages (which can be 65K–300K chars)
  • --expand shows guide sections — guide entries in the TOC tree display their H2 headings, fetched in parallel
  • Strip base64 images — removes embedded image data from guide markdown output
  • Fix TOC parser — titles with parentheses like TTL (Time-to-Live) and moose migrate (CLI) now parse correctly (previously the slug was extracted from inside the title parens)
  • Case-insensitive slugs and section anchors
  • Updated --help with comprehensive examples including guide section syntax

Files changed

  • `apps/framework-cli/src/cli/commands.rs` — `Browse {}` subcommand, `--web` flag, updated `after_help`
  • `apps/framework-cli/src/cli/routines/docs.rs` — interactive picker, section extraction, image stripping, guide heading parsing, browser opening, 16 unit tests
  • `apps/framework-cli/src/cli.rs` — routing for browse, `--web`, and `slug#section` splitting

How to test

Build first:
```bash
cargo build --package moose-cli
```

Then run these commands (using the debug binary directly, or `moose` if installed):
```bash

Browse: interactive hierarchical picker

./target/debug/moose-cli docs browse

Browse with --web: opens selected page in browser

./target/debug/moose-cli docs browse --web

TOC: collapsed and expanded

./target/debug/moose-cli docs
./target/debug/moose-cli docs --expand

Fetch a page

./target/debug/moose-cli docs moosestack/olap

Case-insensitive slugs

./target/debug/moose-cli docs MOOSESTACK/OLAP

Open in browser

./target/debug/moose-cli docs moosestack/olap --web

Guide section navigation

./target/debug/moose-cli docs guides/chat-in-your-app#overview
./target/debug/moose-cli docs guides/chat-in-your-app#setup

Bad section shows available sections

./target/debug/moose-cli docs guides/chat-in-your-app#nonexistent

Search

./target/debug/moose-cli docs search "materialized"

Python docs

./target/debug/moose-cli docs --lang py moosestack/olap

Help

./target/debug/moose-cli docs --help
```

Automated checks

  • `cargo clippy --package moose-cli --all-targets -- -D warnings` — zero warnings
  • `cargo test --package moose-cli` — 1030 tests pass (16 docs-specific)

Note

Medium Risk
Introduces a sizeable new networked CLI feature (HTTP fetch + terminal raw-mode UI + spawning OS browser commands) and persists new config state, which can impact runtime behavior across platforms.

Overview
Adds a new moose docs command to the CLI with TOC display, search, and an interactive browse picker, plus support for opening docs via --web.

Docs fetching is implemented via a new routines::docs module that pulls the remote TOC/pages, fixes TOC parsing for titles containing parentheses, supports slug#section extraction for large guides (and strips embedded base64 images), and optionally expands the TOC by fetching guide headings in parallel. The PR also persists a default docs language in global settings (docs.default_language), adds usage capture for the docs command, and updates the docs site’s CLI reference to document the new functionality.

Written by Cursor Bugbot for commit 389c7d2. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-v2 Ready Ready Preview, Comment Feb 7, 2026 6:30am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Caution

Review failed

The head commit changed during the review from bb55970 to 389c7d2.

Walkthrough

Adds a top-level Docs CLI command, new docs routines module (TOC/page fetch, search, browse, language resolution, browser open), persists docs settings, and records DocsCommand in usage capture.

Changes

Cohort / File(s) Summary
CLI entry & wiring
apps/framework-cli/src/cli.rs, apps/framework-cli/src/cli/commands.rs
Adds Docs variant to Commands, new DocsArgs/DocsCommands, and top-level dispatch that starts/awaits usage capture and resolves language context.
Docs routines module
apps/framework-cli/src/cli/routines/docs.rs, apps/framework-cli/src/cli/routines/mod.rs
New comprehensive docs routine: DocsLanguage, language resolution, TOC parsing/grouping, page fetch/parse/section extraction, search, interactive browsing, browser open, rendering helpers, picker UI, and unit tests. Exposes public routines (show_toc, fetch_page, search_toc, browse_docs, open_in_browser).
Settings
apps/framework-cli/src/cli/settings.rs
Adds DocsSettings, new docs field on Settings, and set_docs_default_language to persist default docs language in user config.
Activity capture
apps/framework-cli/src/utilities/capture.rs
Adds DocsCommand variant (serde rename "docsCommand") to ActivityType to record docs usage.
Documentation content
apps/framework-docs-v2/content/moosestack/moose-cli.mdx
Inserts a "Documentation & Feedback" section (appears duplicated in file).

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as "CLI Handler"
    participant Capture as "Activity Capture"
    participant Docs as "Docs Routine"
    participant HTTP as "HTTP Client"
    participant Browser as "System Browser"

    User->>CLI: run `framework-cli docs ...`
    CLI->>Capture: start usage capture (DocsCommand)
    CLI->>Docs: resolve language & dispatch subcommand (Browse / Search / Show)
    Docs->>HTTP: fetch TOC / page / search
    HTTP-->>Docs: return data (TOC/page/results)
    Docs->>Docs: parse, extract section, format output
    alt open in browser
        Docs->>Browser: open URL
    end
    Docs-->>CLI: return RoutineSuccess / RoutineFailure
    CLI->>Capture: await and finalize capture
    CLI-->>User: render output or indicate browser opened
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • callicles
  • okane16

Poem

📚 A docs command wakes within the light,
TOCs unfold and slugs step into sight.
Languages picked, sections trimmed with care,
Pages open, or snippets fetched to share.
Cheers — the CLI brings docs to air.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes the main changes: interactive browse, section navigation, and --web support for moose docs command.
Description check ✅ Passed Description provides comprehensive details on new features, files changed, testing instructions, and implementation notes directly related to the PR changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/slack-add-moose-docs-cli-PPlTT

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
Contributor

@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: 6

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli.rs`:
- Around line 1554-1558: The new CLI variant Commands::Docs (with parameters
language, path, raw) is user-facing but lacks docs; add a new CLI reference
entry under apps/framework-docs-v2/content documenting the moose docs command:
describe purpose, flags/positional args (language, path, raw), examples, and
expected behavior/outputs and link it from the main CLI index so the new command
is discoverable; ensure the file name and frontmatter follow existing docs-v2
conventions and reference the Commands::Docs usage shown in
apps/framework-cli/src/cli.rs.

In `@apps/framework-cli/src/cli/routines/docs.rs`:
- Around line 151-183: Add unit tests for the public function fetch_docs (in the
same #[cfg(test)] mod tests) to cover the missing branches: at minimum add a
test that calls fetch_docs with an invalid language string and asserts it
returns an Err(RoutineFailure) (use DocsLanguage::from_str to derive the invalid
parse or pass the invalid input through the same code path your CLI uses), and
add additional tests to cover raw vs formatted output and path filtering by
invoking fetch_docs with representative inputs and asserting the expected Ok
results or error variants; reference fetch_docs, DocsLanguage::from_str, and
RoutineFailure to locate the code to test.
- Around line 19-27: Replace the inherent method DocsLanguage::from_str with an
implementation of the std::str::FromStr trait for DocsLanguage: implement
FromStr for DocsLanguage (implementing fn from_str(&str) -> Result<Self,
Self::Err>) and move the existing matching logic there (return
Ok(Self::TypeScript) / Ok(Self::Python) or Err(()) as appropriate), remove or
keep the old inherent from_str if unused, and then callers can use
"ts".parse::<DocsLanguage>() and clap integrations will work automatically;
reference the DocsLanguage type and the current from_str logic to relocate code
into the FromStr impl.
- Around line 73-75: The code appends path to the URL without encoding (variable
url built in docs.rs), which breaks for spaces and reserved chars; update the
branch that handles path (the if let Some(p) = path block) to build the URL via
a proper URL builder that percent-encodes query values (e.g., use
reqwest::Url::parse_with_params or url::Url::parse and
.query_pairs_mut().append_pair("path", p)), or at minimum percent-encode p with
an appropriate encoder before formatting, so the final url variable contains a
valid encoded query parameter.
- Around line 125-148: The success return currently always includes a non-empty
Message, so when raw is true the piped docs are followed by the status line;
update the end of fetch_docs to return an empty Message when raw is true (e.g.,
if raw { return Ok(RoutineSuccess::success(Message::new("".to_string(),
"".to_string()))); } ), otherwise keep the existing
RoutineSuccess::success(Message::new("Docs".to_string(), "Documentation fetched
successfully".to_string())). Ensure you reference the raw variable,
RoutineSuccess::success and Message::new in the change.

In `@apps/framework-cli/src/cli/routines/mod.rs`:
- Line 165: The module declaration `pub mod docs;` in `mod.rs` is exported
publicly but only used within the crate; change its visibility to `pub(crate)
mod docs;` to limit the symbol to crate scope and follow the visibility
guideline—locate the `pub mod docs;` line and replace `pub` with `pub(crate)` so
the docs module is not exposed outside the crate.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7d51066 and e738de8.

📒 Files selected for processing (5)
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/utilities/capture.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
🧠 Learnings (14)
📓 Common learnings
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Define newtypes as tuple structs: `struct UserId(u64);`

Applied to files:

  • apps/framework-cli/src/utilities/capture.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Derive standard traits for newtypes: `#[derive(Debug, Clone, PartialEq)]`

Applied to files:

  • apps/framework-cli/src/utilities/capture.rs
📚 Learning: 2026-02-06T01:43:06.078Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:40-72
Timestamp: 2026-02-06T01:43:06.078Z
Learning: In the Moose framework-cli (Rust), the telemetry functions capture_usage and wait_for_usage_capture use a fire-and-forget pattern: errors are logged internally and not surfaced to users. This behavior is intentional across all commands. Do not change error propagation for individual commands; any modification requires a broad refactor across the CLI telemetry layer. During reviews, treat changes to telemetry error reporting as high risk and scope changes to capture_usage/wait_for_usage_capture to the entire framework-cli, not single commands.

Applied to files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Documentation is required for all public APIs in Rust

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/constants.rs : Place constants in `constants.rs` at deepest common module level

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Scope constant visibility with preference: `pub(crate)` > `pub(super)` > `pub`

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Group related constants together

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In modules under apps/framework-cli/src/cli/routines (any Rust file under subdirectories) use raw println! for multi-line help text and formatted usage examples. Do not rely on display::show_message_wrapper for help output; reserve it for status messages and user-visible progress updates. Ensure help text remains readable and properly formatted.

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/docs.rs
🧬 Code graph analysis (1)
apps/framework-cli/src/cli/routines/docs.rs (1)
apps/framework-cli/src/cli/routines/mod.rs (3)
  • error (242-248)
  • new (233-239)
  • success (207-212)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Test E2E Backward Compatibility - Python (Python 3.13)
  • GitHub Check: Test E2E Python Tests Template (Python 3.12)
  • GitHub Check: Test E2E TypeScript Tests Template (Node 20, npm)
  • GitHub Check: Test E2E TypeScript Tests Template (Node 22, npm)
  • GitHub Check: Test E2E Python Tests Template (Python 3.13)
  • GitHub Check: Test E2E TypeScript Tests Template (Node 24, npm)
🔇 Additional comments (3)
apps/framework-cli/src/utilities/capture.rs (1)

41-42: LGTM!

New variant follows the existing naming and serde-rename convention, and is correctly ordered alphabetically.

apps/framework-cli/src/cli/commands.rs (1)

237-250: LGTM!

The Docs variant is clean and consistent with existing command definitions.

apps/framework-cli/src/cli.rs (1)

1554-1575: Handler follows the established pattern. LGTM.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@oatsandsugar oatsandsugar marked this pull request as draft February 6, 2026 22:36
@oatsandsugar oatsandsugar changed the title Add docs command to fetch LLM-optimized documentation feat: add interactive browse, section navigation, and --web to moose docs Feb 7, 2026
@oatsandsugar oatsandsugar marked this pull request as ready for review February 7, 2026 01:02
Copy link
Contributor

@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: 8

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli/commands.rs`:
- Around line 445-498: The --web flag is currently ignored when used with the
Search subcommand; either document this or enforce it. Fix by adding a conflict
between the Search subcommand and the web flag (or by updating the after_help
text to call this out). Concretely, update the DocsCommands::Search variant to
declare a conflict with "web" (e.g., add an attribute on the Search variant such
as #[arg(conflicts_with = "web")] so Clap will error when --web is combined with
Search), or alternatively add a short note to the DocsArgs after_help text
explaining that --web is ignored for search.

In `@apps/framework-cli/src/cli/routines/docs.rs`:
- Around line 83-138: The resolve_language function currently calls
crate::cli::load_project_dev() unconditionally which triggers costly I/O and
config parsing even when not in a project; change it to first perform a cheap
existence check for the project config (e.g., check if "moose.config.toml" or
the project config filename exists using std::path::Path::exists or
fs::metadata) and only call crate::cli::load_project_dev() if that file is
present, otherwise skip to saved preference / interactive prompt; update
references in the function (resolve_language, load_project_dev, and the
subsequent match on project.language) so behavior is unchanged when the config
exists but you avoid the unnecessary load when it does not.
- Around line 1251-1273: The code repeatedly calls group_entries_by_parent for
the same section across page_items_for_group, slug_for_group_page, and
group_items; compute groups once and reuse them: in the browsing routine (the
loop that calls page_items_for_group/slug_for_group_page/group_items) call
group_entries_by_parent(&section.entries) once and pass the resulting Vec<Group>
(or &Vec<Group>) into new helper variants (e.g.,
page_items_for_group_with_groups, slug_for_group_page_with_groups,
group_items_with_groups) or change the existing functions to accept the
precomputed groups instead of recomputing; update all call sites in the browse
loop to use the precomputed groups to avoid repeated computation.
- Around line 878-887: The Windows branch using
std::process::Command::new("cmd").args(["/c", "start", &url]).status() can
misinterpret URL characters like & or ^; fix it by passing an explicit empty
title argument to start so the URL isn't parsed as a window title — i.e., change
the args to include "" before the URL (e.g., .args(["/c", "start", "", &url])).
Ensure you update the cmd-start call in
apps/framework-cli/src/cli/routines/docs.rs accordingly.
- Around line 484-503: parse_page_headings (and extract_section) currently
treats lines inside fenced code blocks as content and will parse headings found
in triple-backtick blocks; update parse_page_headings to track a boolean (e.g.,
in_code_block) that toggles whenever a line begins with the fenced-code
delimiter (```), skip processing (continue) while in_code_block, and only parse
headings when not in a code block; apply the identical guard and in_code_block
toggling logic inside extract_section so fenced blocks do not produce phantom
headings or incorrect section boundaries.
- Around line 509-537: In extract_section, add a code-fence guard like in
parse_page_headings: introduce a boolean (e.g., in_code_block) toggled whenever
a line starts with "```" (or strip_prefix check to handle language info) and
skip heading detection while in_code_block is true; ensure the toggle happens
before any heading logic and that you continue the loop when entering/exiting a
fenced block so heading_to_anchor/title matching and the start/matched_level
logic only runs for non-code lines.
- Around line 646-681: The current use of futures::future::join_all on the
futures built from guide_slugs will spawn an unbounded number of concurrent
fetch_page_content calls; change the logic to use
futures::stream::iter(guide_slugs).map(|slug| { let slug = slug.clone(); async
move { let res = fetch_page_content(&slug, lang).await; (slug, res) }
}).buffer_unordered(N).for_each_concurrent or collect to cap concurrency (pick a
reasonable N like 8 or 16), then for each (slug, result) call
parse_page_headings and insert into the guide_headings HashMap as before; this
keeps the same use of guide_slugs, fetch_page_content, parse_page_headings, and
guide_headings but prevents unbounded parallel HTTP fetches.
- Around line 1144-1213: Wrap the raw-mode lifetime in an RAII guard so
terminal::disable_raw_mode() runs even if code panics: after
terminal::enable_raw_mode() create a small guard type (e.g., RawModeGuard) that
calls terminal::disable_raw_mode() in its Drop impl and keep the guard in scope
for the entire interactive loop and subsequent clear_picker call; replace the
direct call to terminal::disable_raw_mode() at the end with relying on the guard
dropping when it goes out of scope. Ensure the guard is created immediately
after enable_raw_mode() and named/placed so it lives until after
clear_picker(&mut stdout, prev_lines).
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e738de8 and 437fdbf.

📒 Files selected for processing (4)
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
  • apps/framework-cli/src/cli/settings.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
🧠 Learnings (16)
📓 Common learnings
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Documentation is required for all public APIs in Rust

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Group related constants together

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Derive standard traits for newtypes: `#[derive(Debug, Clone, PartialEq)]`

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Define newtypes as tuple structs: `struct UserId(u64);`

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-02-06T01:43:06.078Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:40-72
Timestamp: 2026-02-06T01:43:06.078Z
Learning: In the Moose framework-cli (Rust), the telemetry functions capture_usage and wait_for_usage_capture use a fire-and-forget pattern: errors are logged internally and not surfaced to users. This behavior is intentional across all commands. Do not change error propagation for individual commands; any modification requires a broad refactor across the CLI telemetry layer. During reviews, treat changes to telemetry error reporting as high risk and scope changes to capture_usage/wait_for_usage_capture to the entire framework-cli, not single commands.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In modules under apps/framework-cli/src/cli/routines (any Rust file under subdirectories) use raw println! for multi-line help text and formatted usage examples. Do not rely on display::show_message_wrapper for help output; reserve it for status messages and user-visible progress updates. Ensure help text remains readable and properly formatted.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Implement `From`/`TryFrom` for newtype conversions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Respect language-specific best practices and idioms for Rust, TypeScript/JavaScript, and Python

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
🔇 Additional comments (4)
apps/framework-cli/src/cli.rs (1)

1554-1603: Docs command wiring looks correct.

The routing logic, language resolution, slug/anchor parsing, and web vs terminal branching are well-structured and consistent with the rest of the command handler.

apps/framework-cli/src/cli/settings.rs (2)

127-184: Clean addition, consistent with existing patterns.

DocsSettings and the docs field follow the same conventions as DevSettings/dev.


432-461: Follows the established config-update pattern.

Mirrors set_suppress_dev_setup_prompt exactly. No issues.

apps/framework-cli/src/cli/routines/docs.rs (1)

1516-1745: Good unit test coverage for parsing logic.

Tests cover edge cases well: parentheses in titles, missing descriptions, case-insensitive anchors, EOF sections, image stripping. The parsing functions are the riskiest parts and they're well-exercised.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

claude and others added 4 commits February 6, 2026 20:17
Adds a new CLI command that fetches LLM-optimized documentation from
docs.fiveonefour.com for use by AI agents. This allows agents to quickly
access Moose documentation that's specifically formatted for LLM consumption.

Usage:
  moose docs                    # Fetch TypeScript docs (default)
  moose docs python             # Fetch Python docs
  moose docs ts --raw           # Raw output for piping
  moose docs --path <section>   # Filter by section

Slack thread: https://fiveonefour-workspace.slack.com/archives/C08BYKG5P7C/p1770414833528409?thread_ts=1770414757.185779&cid=C08BYKG5P7C

https://claude.ai/code/session_01CSEzEbitVUYYEYRYKJVPHx
… language detection

Rewrites the docs command from a flat fetch into a subcommand group:
- `moose docs` shows a collapsed TOC tree with box-drawing characters
- `moose docs <slug>` fetches and displays a single documentation page
- `moose docs search <query>` searches TOC titles/descriptions/slugs
- `--lang` flag with 5-level resolution: flag > project > saved pref > prompt > default
- `--expand` to show all pages, `--raw` for piping
- Language preference persisted to ~/.moose/config.toml
- Fixed API URLs to use correct endpoints (/{slug}.md?lang=)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…moose docs`

- `moose docs browse`: hierarchical drill-down picker (sections → groups → pages)
  with guide section sub-picker for large guide pages
- `--web` flag: open any doc page in the browser, supports #anchor fragments
- Section navigation: `moose docs guides/chat-in-your-app#overview` extracts
  just that section from large guide pages
- `--expand` now shows H2 section headings under guide entries (fetched in parallel)
- Strip base64-encoded images from guide content to reduce output size
- Fix TOC parser for titles with parentheses (e.g. `TTL (Time-to-Live)`)
- Case-insensitive slug and anchor matching
- Updated --help with comprehensive examples

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a section has only one group (e.g., Guides), skip the intermediate
picker that just showed "Guides (2 pages)" and go straight to the pages.

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

@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: 6

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli/routines/docs.rs`:
- Around line 206-227: parse_toc_entry currently finds the first ')' after
slug_start which breaks if the link contains literal ')' characters; instead
locate the closing ')' by searching the slice that begins at link_marker (the
"](...)" segment) for the last ')' (e.g., use rfind on the substring between
link_marker+2 and the next delimiter) so slug_end correctly bounds the URL;
update the logic around title_start, link_marker, slug_start and slug_end to
derive slug from that robust end index and keep description extraction
unchanged.
- Around line 863-909: open_in_browser currently forwards a constructed url
(from slug, path, anchor) directly to cmd /c start on Windows which can
interpret shell metacharacters; validate and sanitize the URL before invoking
the shell: parse the constructed url with Url::parse (or equivalent) and
percent-encode/validate the path and fragment extracted from slug (variables:
slug, path, anchor, url, stripped) and return a RoutineFailure if
parsing/validation fails; for Windows invocation avoid letting cmd interpret
meta-characters by either invoking Start-Process via PowerShell with a
safely-quoted argument or using cmd /c start "" "<validated_url>" (explicit
empty title and properly-quoted/escaped url) so unsafe characters cannot be
injected, and ensure the result handling (result variable) remains unchanged.
- Around line 1295-1306: The browse_docs function currently emits status
messages via show_message! unconditionally, which pollutes piped output when
raw=true; update browse_docs to mirror the pattern used in
show_toc/fetch_page/search_toc by wrapping all show_message! invocations in a
conditional check (if !raw) so messages are only shown when not in raw mode,
ensuring no extraneous output when raw=true.
- Around line 429-434: The code uses reqwest::get(&url).await (producing
response) which creates a one-shot client with no timeout and can hang; replace
these calls (including the one that maps errors into RoutineFailure::new) to use
a shared reqwest::Client configured with a reasonable timeout (e.g.,
Client::builder().timeout(Duration::from_secs(10)).build()) that is created once
and passed into the routine instead of calling reqwest::get per request; update
all occurrences (the response fetch at the response binding and the similar
block at lines ~577-585) to call client.get(&url).send().await and map errors
into RoutineFailure::new as before.
- Around line 1318-1344: The non-TTY branch builds a flattened all vector from
sections but doesn't guard against all being empty or against parse defaulting
to an out-of-range index; update the block in docs.rs to first check if
all.is_empty() and return a RoutineFailure::error(Message::new("Docs", "No
entries available")) if so, then parse the prompt with
input.trim().parse::<usize>().ok() (avoid unwrap_or(1)), validate that the
parsed index exists in 1..=all.len() and return a RoutineFailure on invalid
selection, and only then use let selected = all[idx - 1] and call
open_in_browser / fetch_page; reference symbols: sections, all,
crate::cli::prompt_user, fetch_page, open_in_browser, RoutineFailure::error,
Message::new.
- Around line 1-9: The CLI reference is missing documentation for the new "moose
docs" features: add a new subsection documenting the "moose docs browse"
command, the --web flag, the --expand flag, and the section navigation syntax
using "<slug>#<section>" so users know how to open specific sections; update the
CLI reference entry (the docs.rs module for the docs command) to include brief
usage examples for "moose docs browse", examples showing "--web" and "--expand"
behavior, and a note/example of how to target a specific section via
"<slug>#<section>" so the new features are discoverable.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 437fdbf and 80d3dee.

📒 Files selected for processing (1)
  • apps/framework-cli/src/cli/routines/docs.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/cli/routines/docs.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/cli/routines/docs.rs
🧠 Learnings (12)
📓 Common learnings
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Documentation is required for all public APIs in Rust

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In modules under apps/framework-cli/src/cli/routines (any Rust file under subdirectories) use raw println! for multi-line help text and formatted usage examples. Do not rely on display::show_message_wrapper for help output; reserve it for status messages and user-visible progress updates. Ensure help text remains readable and properly formatted.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Implement `From`/`TryFrom` for newtype conversions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Respect language-specific best practices and idioms for Rust, TypeScript/JavaScript, and Python

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-01-26T00:56:27.011Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3400
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:1238-1298
Timestamp: 2026-01-26T00:56:27.011Z
Learning: Repo 514-labs/moosestack — Workflows: The CLI’s workflow diff is intended to detect only Temporal schedule–affecting changes. In apps/framework-cli/src/framework/core/infrastructure_map.rs, workflows_config_equal should compare schedule, retries, and timeout only; it must not include tasks. Task code/config changes are picked up automatically when the orchestration worker restarts and should not trigger a WorkflowChange.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:43:06.078Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:40-72
Timestamp: 2026-02-06T01:43:06.078Z
Learning: In the Moose framework-cli (Rust), the telemetry functions capture_usage and wait_for_usage_capture use a fire-and-forget pattern: errors are logged internally and not surfaced to users. This behavior is intentional across all commands. Do not change error propagation for individual commands; any modification requires a broad refactor across the CLI telemetry layer. During reviews, treat changes to telemetry error reporting as high risk and scope changes to capture_usage/wait_for_usage_capture to the entire framework-cli, not single commands.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build CLI Binaries (darwin-arm64, macos-14-large, aarch64-apple-darwin)
🔇 Additional comments (1)
apps/framework-cli/src/cli/routines/docs.rs (1)

1534-1763: Good test coverage for parsing and utility functions.

16 tests covering language parsing, TOC entry parsing (including tricky parens-in-title cases), section extraction (H2/H3/case-insensitive/EOF), anchor generation, and image stripping. Solid foundation.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Copy link
Contributor

@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: 5

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli/routines/docs.rs`:
- Around line 34-38: The DocsLanguage enum (DocsLanguage) needs to derive
PartialEq (and optionally Eq) so tests can use direct equality comparisons;
update the enum's derive list to include PartialEq (and Eq if desired) alongside
Debug, Clone to match project guidelines and enable straightforward ==
comparisons in tests.
- Around line 663-674: The local variable name `futures` shadows the `futures`
crate and causes confusion when calling futures::future::join_all; rename the
local Vec from `futures` to a non-conflicting name like `fetch_futures` or
`tasks` where it's declared (the block that maps over `guide_slugs` and calls
`fetch_page_content(&slug, lang).await`) and update the subsequent call to use
that new identifier with `futures::future::join_all(fetch_futures).await` (or
`tasks`) so the crate path `futures::future::join_all` remains unshadowed.
- Line 647: The variable guide_headings is instantiated with a fully-qualified
std::collections::HashMap::new() while the file already imports BTreeMap; make
the collection usage consistent by either (A) replacing
std::collections::HashMap::new() with BTreeMap::new() to use the imported
BTreeMap, or (B) add use std::collections::HashMap to the top imports and keep
guide_headings as HashMap::new(); update the guide_headings declaration
accordingly (refer to the guide_headings symbol).
- Around line 863-909: The public function open_in_browser should validate the
incoming slug to reject empty or whitespace-only values before
building/launching the URL; trim the incoming slug (currently assigned to
stripped) and if the trimmed value is empty return a RoutineFailure (e.g.,
Message::new("Docs", "Empty slug provided") wrapped in RoutineFailure::error or
RoutineFailure::new) instead of proceeding, so callers won't silently open the
docs homepage; apply this check at the start of open_in_browser (before
split_once and path/anchor logic) and reference the existing RoutineFailure and
RoutineSuccess return types when returning the error.
- Around line 1464-1498: After fetching content via fetch_page_content and
parsing headings with parse_page_headings, call strip_images(&content) once and
store the result in a variable (e.g., cleaned) immediately after fetch; then
reuse that cleaned variable in all branches (the stdout non-terminal branch, the
PickerResult::Selected(0) branch when web is false, and the
PickerResult::Selected(idx) branch when web is false) instead of calling
strip_images repeatedly. Update usages in the run_picker/PickerResult handling
so branches reference the precomputed cleaned value and remove the duplicate
strip_images calls.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 80d3dee and 57c97a8.

📒 Files selected for processing (7)
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-docs-v2/content/**/*.mdx

📄 CodeRabbit inference engine (apps/framework-docs-v2/CLAUDE.md)

apps/framework-docs-v2/content/**/*.mdx: Use {{ include "shared/path.mdx" }} directives to reuse content fragments, which are processed via processIncludes() during build
Validate code snippets in documentation with the @test directive for TypeScript and Python code blocks
TypeScript code snippets in documentation should be validated for syntax with brace matching; Python snippets should be validated for indentation

Files:

  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
🧠 Learnings (26)
📓 Common learnings
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Documentation is required for all public APIs in Rust

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Group related constants together

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-02-06T01:43:06.078Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:40-72
Timestamp: 2026-02-06T01:43:06.078Z
Learning: In the Moose framework-cli (Rust), the telemetry functions capture_usage and wait_for_usage_capture use a fire-and-forget pattern: errors are logged internally and not surfaced to users. This behavior is intentional across all commands. Do not change error propagation for individual commands; any modification requires a broad refactor across the CLI telemetry layer. During reviews, treat changes to telemetry error reporting as high risk and scope changes to capture_usage/wait_for_usage_capture to the entire framework-cli, not single commands.

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:43.608Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:878-887
Timestamp: 2026-02-07T04:42:43.608Z
Learning: For the Moose CLI under apps/framework-cli, document and implement that Windows support is best-effort only, while macOS (open) and Linux (xdg-open) are the primary targets. Treat Windows-specific code paths (e.g., using cmd /c start) as fallback implementations and ensure they are not required to be as robust as the primary platforms. When adding Windows fallbacks, include clear caveats, avoid blocking on Windows-specific behavior, and add appropriate runtime checks, logs, and TODOs. This guidance applies to Rust source files under apps/framework-cli/src (and adjacent Rust files in the same module) to keep Windows handling clearly scoped and maintainable.

Applied to files:

  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/settings.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/constants.rs : Place constants in `constants.rs` at deepest common module level

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Scope constant visibility with preference: `pub(crate)` > `pub(super)` > `pub`

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Applies to **/*.rs : Run `cargo clippy` to ensure Rust code passes Clippy's linting standards before each commit

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2026-02-07T04:42:46.739Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:40-48
Timestamp: 2026-02-07T04:42:46.739Z
Learning: In Rust files under apps/framework-cli/src/cli/routines/, prefer using inherent from_str methods for conversions when the conversion is only used in a single place and you are not using .parse() elsewhere. Avoid implementing std::str::FromStr purely for stylistic reasons if the conversion isn’t reused with .parse()."

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Always run `cargo clippy --all-targets -- -D warnings` before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In modules under apps/framework-cli/src/cli/routines (any Rust file under subdirectories) use raw println! for multi-line help text and formatted usage examples. Do not rely on display::show_message_wrapper for help output; reserve it for status messages and user-visible progress updates. Ensure help text remains readable and properly formatted.

Applied to files:

  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:40.620Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:863-909
Timestamp: 2026-02-07T04:42:40.620Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: macOS and Linux are primary target platforms; Windows is a best-effort fallback and not a primary target for the Moose CLI.

Applied to files:

  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
  • apps/framework-cli/src/cli/settings.rs
📚 Learning: 2026-02-07T04:42:43.608Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:878-887
Timestamp: 2026-02-07T04:42:43.608Z
Learning: In apps/framework-cli (Moose CLI): Windows support is best-effort only; macOS (open) and Linux (xdg-open) are the primary target platforms. Windows-specific code paths like cmd /c start are fallback implementations and do not require the same level of robustness as the primary platforms.

Applied to files:

  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
📚 Learning: 2026-01-28T14:50:00.978Z
Learnt from: cjus
Repo: 514-labs/moosestack PR: 3407
File: apps/framework-docs-v2/content/guides/static-report-generation.mdx:1402-1406
Timestamp: 2026-01-28T14:50:00.978Z
Learning: When reviewing WebApp implementations that run in a Node.js backend, prefer Node.js-specific types (e.g., Buffer) and avoid browser-focused cross-platform compatibility considerations. This guideline applies to MDX documentation and code examples across the repository where backend/runtime code is discussed; ensure reviewers distinguish server-side context from frontend/browser constraints and validate type usage accordingly.

Applied to files:

  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Define newtypes as tuple structs: `struct UserId(u64);`

Applied to files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Derive standard traits for newtypes: `#[derive(Debug, Clone, PartialEq)]`

Applied to files:

  • apps/framework-cli/src/utilities/capture.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Implement `From`/`TryFrom` for newtype conversions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Respect language-specific best practices and idioms for Rust, TypeScript/JavaScript, and Python

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-01-26T00:56:27.011Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3400
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:1238-1298
Timestamp: 2026-01-26T00:56:27.011Z
Learning: Repo 514-labs/moosestack — Workflows: The CLI’s workflow diff is intended to detect only Temporal schedule–affecting changes. In apps/framework-cli/src/framework/core/infrastructure_map.rs, workflows_config_equal should compare schedule, retries, and timeout only; it must not include tasks. Task code/config changes are picked up automatically when the orchestration worker restarts and should not trigger a WorkflowChange.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
🧬 Code graph analysis (2)
apps/framework-cli/src/cli.rs (2)
apps/framework-cli/src/utilities/capture.rs (2)
  • capture_usage (101-166)
  • wait_for_usage_capture (168-172)
apps/framework-cli/src/cli/routines/docs.rs (6)
  • resolve_language (83-138)
  • show_toc (621-699)
  • browse_docs (1295-1445)
  • search_toc (777-856)
  • open_in_browser (863-909)
  • fetch_page (705-771)
apps/framework-cli/src/cli/routines/docs.rs (3)
apps/framework-cli/src/cli/routines/mod.rs (3)
  • error (243-249)
  • new (234-240)
  • success (208-213)
apps/framework-cli/src/cli.rs (2)
  • load_project_dev (285-297)
  • prompt_user (78-126)
apps/framework-cli/src/cli/settings.rs (1)
  • set_docs_default_language (435-461)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Test E2E TypeScript Tests Template (Node 22, npm)
  • GitHub Check: Test E2E TypeScript Tests Template (Node 24, npm)
  • GitHub Check: Test E2E TypeScript Tests Template (Node 20, npm)
  • GitHub Check: Test E2E Python Tests Template (Python 3.13)
  • GitHub Check: Test E2E Python Tests Template (Python 3.12)
🔇 Additional comments (13)
apps/framework-docs-v2/content/moosestack/moose-cli.mdx (1)

401-436: Documentation for the new moose docs command looks good.

Addresses the prior review comment requesting docs for the new CLI feature. The documented flags (--raw, --expand, --web, -l), subcommands (browse, search), and guide section navigation syntax all align with the implementation in commands.rs and cli.rs.

One note from the AI summary: there may be a duplicate copy of this "Documentation & Feedback" block further down in the full file. If so, remove the duplicate.

apps/framework-cli/src/utilities/capture.rs (1)

41-42: Clean addition. Follows existing pattern and alphabetical ordering.

apps/framework-cli/src/cli.rs (1)

1569-1618: Docs command handler is clean and well-structured.

Telemetry, language resolution, subcommand routing, and anchor splitting all look correct. The open_in_browser call correctly avoids .await (it's sync). The browse_docs properly receives the web flag.

apps/framework-cli/src/cli/settings.rs (2)

127-130: LGTM. DocsSettings with optional default_language is clean. Properly defaulted via #[serde(default)].

Also applies to: 178-184


432-461: Consistent with existing set_suppress_dev_setup_prompt pattern. No issues.

apps/framework-cli/src/cli/commands.rs (1)

459-512: Well-designed command surface. The external_subcommand pattern for slug access, flag placement on DocsArgs, and the comprehensive after_help examples are solid.

Minor observation: --expand is silently ignored for Browse, Search, and Show subcommands. This is harmless but could confuse users. Consider adding a note in the help text or a conflicts_with if you want strictness. Low priority.

apps/framework-cli/src/cli/routines/docs.rs (7)

1-29: Module header and imports look good.

Clean imports, well-scoped constants, and a solid module-level doc comment.


83-138: resolve_language — clear priority chain, well-documented.

The 5-level resolution cascade (flag → project → saved pref → prompt → default) is easy to follow and correctly handles each fallback.


167-227: TOC parsing logic is sound.

parse_toc and parse_toc_entry correctly handle the ]( boundary to avoid misparses on titles with parentheses. Good tests back this up.


1350-1444: Browse loop structure is clean with proper level navigation.

The three-level drill-down (section → group → page) with Back navigation and auto-drill for single-group sections is well-implemented. Each level properly handles all PickerResult variants.


946-1056: render_picker scroll math is correct.

The scroll offset, visible window capping, and index arithmetic handle edge cases properly (empty filtered list, cursor at boundaries, terminal height fallback).


1538-1763: Good test coverage for parsing and extraction logic.

16 tests thoroughly cover language parsing, TOC parsing with parentheses, heading anchors, section extraction (including case-insensitive, H3, EOF), and image stripping. Edge cases are well-represented.


314-391: display_toc_tree — well-structured tree rendering with ANSI awareness.

Collapsed/expanded modes, box-drawing, and guide heading integration are all correctly handled. The NO_ANSI flag is respected throughout.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

- Skip headings inside fenced code blocks in parse_page_headings and
  extract_section to avoid false section boundaries from code examples
- Suppress show_message! status output when --raw is set in browse_docs
  and browse_guide_page so piped output stays clean
- Add RawModeGuard RAII type to ensure terminal raw mode is disabled
  even on panic during interactive picker

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a section has only one group (e.g., Guides), auto-drill skips
the group picker. Previously, pressing Back from the page picker
would return to the group level, which would auto-drill again,
creating an inescapable loop. Now tracks an `auto_drilled` flag
so Back skips all the way to section selection.

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

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Contributor

@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: 2

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli/routines/docs.rs`:
- Around line 586-594: In fetch_page_content, avoid cloning the already-owned
String `stripped`—replace the `if` branch that does `stripped.to_string()` with
just `stripped` so the owned String is moved into `with_ext`; update the
`with_ext` assignment to use `stripped` in the true branch and keep
`format!("{}.md", stripped)` in the false branch (ensuring `stripped` is not
used after the move).
- Around line 882-928: The function open_in_browser currently shadows the
initial variable stripped (from slug.trim_start_matches('/')) by reassigning a
new let stripped for the display value; rename the second binding to a clear,
non-shadowing name (e.g., display_path or display_target) and use that new
identifier in the success message and any other places where the human-friendly
path+anchor is needed; keep the original stripped (or rename it to raw_path) for
building the URL so the URL construction logic remains unchanged and no
shadowing occurs.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 57c97a8 and fa3ad96.

📒 Files selected for processing (1)
  • apps/framework-cli/src/cli/routines/docs.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/cli/routines/docs.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/cli/routines/docs.rs
🧠 Learnings (29)
📓 Common learnings
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:863-909
Timestamp: 2026-02-07T04:42:40.620Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: macOS and Linux are primary target platforms; Windows is a best-effort fallback and not a primary target for the Moose CLI.
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Documentation is required for all public APIs in Rust

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In modules under apps/framework-cli/src/cli/routines (any Rust file under subdirectories) use raw println! for multi-line help text and formatted usage examples. Do not rely on display::show_message_wrapper for help output; reserve it for status messages and user-visible progress updates. Ensure help text remains readable and properly formatted.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Group related constants together

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:46.739Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:40-48
Timestamp: 2026-02-07T04:42:46.739Z
Learning: In Rust files under apps/framework-cli/src/cli/routines/, prefer using inherent from_str methods for conversions when the conversion is only used in a single place and you are not using .parse() elsewhere. Avoid implementing std::str::FromStr purely for stylistic reasons if the conversion isn’t reused with .parse()."

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Implement `From`/`TryFrom` for newtype conversions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Respect language-specific best practices and idioms for Rust, TypeScript/JavaScript, and Python

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `derive_more` or `nutype` to reduce newtype boilerplate

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-01-19T22:37:05.393Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3282
File: apps/framework-cli-e2e/test/utils/llm-agent-utils.ts:613-742
Timestamp: 2026-01-19T22:37:05.393Z
Learning: In the LLM Documentation Automation test (`apps/framework-cli-e2e/test/llm-docs-automation.test.ts` and `apps/framework-cli-e2e/test/utils/llm-agent-utils.ts`), token limit failures are intentional. The test should fail if the agent exceeds Claude's context window, as this signals that documentation or task complexity needs improvement and represents what a real user would experience.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-01-26T00:56:27.011Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3400
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:1238-1298
Timestamp: 2026-01-26T00:56:27.011Z
Learning: Repo 514-labs/moosestack — Workflows: The CLI’s workflow diff is intended to detect only Temporal schedule–affecting changes. In apps/framework-cli/src/framework/core/infrastructure_map.rs, workflows_config_equal should compare schedule, retries, and timeout only; it must not include tasks. Task code/config changes are picked up automatically when the orchestration worker restarts and should not trigger a WorkflowChange.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:43.608Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:878-887
Timestamp: 2026-02-07T04:42:43.608Z
Learning: For the Moose CLI under apps/framework-cli, document and implement that Windows support is best-effort only, while macOS (open) and Linux (xdg-open) are the primary targets. Treat Windows-specific code paths (e.g., using cmd /c start) as fallback implementations and ensure they are not required to be as robust as the primary platforms. When adding Windows fallbacks, include clear caveats, avoid blocking on Windows-specific behavior, and add appropriate runtime checks, logs, and TODOs. This guidance applies to Rust source files under apps/framework-cli/src (and adjacent Rust files in the same module) to keep Windows handling clearly scoped and maintainable.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Audit documentation when changing user-facing features

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:40.620Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:863-909
Timestamp: 2026-02-07T04:42:40.620Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: macOS and Linux are primary target platforms; Windows is a best-effort fallback and not a primary target for the Moose CLI.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Always run `cargo clippy --all-targets -- -D warnings` before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Define errors near their unit of fallibility (no global Error types)

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:43:06.078Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:40-72
Timestamp: 2026-02-06T01:43:06.078Z
Learning: In the Moose framework-cli (Rust), the telemetry functions capture_usage and wait_for_usage_capture use a fire-and-forget pattern: errors are logged internally and not surfaced to users. This behavior is intentional across all commands. Do not change error propagation for individual commands; any modification requires a broad refactor across the CLI telemetry layer. During reviews, treat changes to telemetry error reporting as high risk and scope changes to capture_usage/wait_for_usage_capture to the entire framework-cli, not single commands.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:46.806Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: packages/protobuf/CLAUDE.md:0-0
Timestamp: 2025-12-16T23:08:46.806Z
Learning: Applies to packages/protobuf/**/AGENTS.md : Review AGENTS.md for coding standards and guidelines

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `const` for static values (prefer over `static`)

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Derive standard traits for newtypes: `#[derive(Debug, Clone, PartialEq)]`

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Write inline tests with `#[cfg(test)]` modules in Rust

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T19:56:08.946Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 3459
File: apps/framework-cli/src/cli/routines/seed_data.rs:792-894
Timestamp: 2026-02-06T19:56:08.946Z
Learning: In apps/framework-cli/src/cli/routines/seed_data.rs, the duplication between create_single_mirror (early return pattern) and create_external_tables_from_local_schema (batch processing with continue) for existence-check/drop logic is intentional due to different error handling patterns, and should not be refactored into a shared helper.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Applies to **/*.rs : Run `cargo clippy` to ensure Rust code passes Clippy's linting standards before each commit

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `thiserror` crate instead of `anyhow::Result` for error handling

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
🔇 Additional comments (8)
apps/framework-cli/src/cli/routines/docs.rs (8)

1-28: Module structure and constants look good.

Doc comment accurately describes the module purpose, constants are const and UPPER_SNAKE_CASE, imports are clean.


83-138: resolve_language — clean priority chain, well documented.

The five-level fallback (flag → project → saved pref → prompt → default) is clear and well-commented. Persisting the interactive choice is a nice UX touch.


487-514: Code-fence guard in parse_page_headings — correctly implemented.

The in_code_block toggle prevents false headings inside fenced blocks.


520-556: extract_section: code-fence lines are continued but still included in the output slice — verify this is intended.

When a ``` fence line is hit, continue skips heading detection, but the line remains in the `lines` vec and is captured in the final `lines[s..i]` slice. This means raw fence markers and their contents appear in the extracted section output. This is almost certainly the correct behavior (preserving code blocks in section output), but worth confirming since the fences themselves are never evaluated for section boundaries.


1096-1103: RawModeGuard RAII pattern — good addition for panic safety.


1172-1178: Explicit drop(_raw_guard) before clear_picker is correct.

Ensures raw mode is disabled before clearing the picker UI. The RAII guard provides panic safety as a bonus.

Also applies to: 1241-1243


1395-1418: Auto-drill logic is correct and well-guarded.

The auto_drilled flag properly prevents the back-navigation infinite loop when a section has only one multi-entry group. The single-entry-group case returns directly, avoiding the flag altogether.


1576-1824: Good test coverage for parsing and section extraction helpers.

16 tests covering language parsing, TOC parsing, grouping, heading extraction, section extraction (including code-block skipping, case-insensitivity, EOF), and image stripping. Edge cases are well represented.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

…sing

Flags like --web, --raw, --lang placed after the slug were being
swallowed by clap's external_subcommand and joined into the slug
(e.g. moosestack/olap/--web → 404). Now uses a simple Option<String>
positional arg and global = true on shared flags so they work in any
position and with subcommands like `browse --web`.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…utput

When --raw is used, return an empty RoutineSuccess message so the
caller in main.rs skips the show_message! call that would otherwise
append ANSI-styled text to stdout.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Contributor

@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: 3

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli/routines/docs.rs`:
- Around line 28-30: The two module constants DOCS_BASE_URL and TOC_PATH should
be moved into the module-level constants file and imported here: remove
DOCS_BASE_URL and TOC_PATH from apps/framework-cli/src/cli/routines/docs.rs, add
them to the appropriate constants.rs (e.g., pub const DOCS_BASE_URL: &str =
"..."; pub const TOC_PATH: &str = "...";) so they are centralized, make them
public if needed, and update docs.rs to use the imported symbols (e.g.,
crate::constants::DOCS_BASE_URL and crate::constants::TOC_PATH or the correct
module path) instead of the local definitions.
- Around line 1501-1586: The function browse_guide_page currently always returns
RoutineSuccess messages (via RoutineSuccess::success(Message::new(...))) even in
raw mode, which pollutes piped output; update all return points in
browse_guide_page (including the "Full page" branch, section display branch,
fallback branch, and the Cancel/Back branch) to return a non-message/empty
success when raw is true (e.g., return RoutineSuccess::empty() or the equivalent
"no-message" variant) and only call RoutineSuccess::success(Message::new(...))
when raw is false, using the existing raw boolean and the RoutineSuccess/Message
symbols to locate each spot to change.
- Around line 896-909: open_in_browser currently preserves the input casing for
slug, path and anchor which can break on case-sensitive hosts/fragments; change
the logic in open_in_browser so that after computing path and anchor you
normalize them to a canonical case (e.g., to_lowercase()) before constructing
url and stripped, i.e. apply to_lowercase() to path and to the anchor (if Some)
and then use those lowercased values when building url, the stripped value, and
any further uses; ensure you still trim leading '/' and the ".md" suffix before
lowercasing.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fa3ad96 and 9b03502.

📒 Files selected for processing (3)
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
🧠 Learnings (36)
📓 Common learnings
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:206-227
Timestamp: 2026-02-07T06:10:25.445Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: The TOC at `/llm.md` is generated by the Moose docs site. Slugs are simple path segments that never contain literal parentheses or special characters. The `parse_toc_entry` function correctly handles parentheses in titles (e.g., "TTL (Time-to-Live)") by using the `](` boundary to separate title from URL.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-07T06:10:28.447Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: Doc slugs/paths are sourced from the TOC (Table of Contents) and contain only alphanumeric characters, hyphens, and slashes — they don't require URL encoding as they're controlled inputs, not arbitrary user data.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:863-909
Timestamp: 2026-02-07T04:42:40.620Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: macOS and Linux are primary target platforms; Windows is a best-effort fallback and not a primary target for the Moose CLI.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:40-48
Timestamp: 2026-02-07T04:42:46.739Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI Rust code): Prefer inherent `from_str` methods over implementing `std::str::FromStr` trait when the conversion is only used in one place and not used with `.parse()` syntax—stylistic preference.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:878-887
Timestamp: 2026-02-07T04:42:43.608Z
Learning: In apps/framework-cli (Moose CLI): Windows support is best-effort only; macOS (open) and Linux (xdg-open) are the primary target platforms. Windows-specific code paths like cmd /c start are fallback implementations and do not require the same level of robustness as the primary platforms.
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T06:10:28.447Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-07T06:10:28.447Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: Doc slugs/paths are sourced from the TOC (Table of Contents) and contain only alphanumeric characters, hyphens, and slashes — they don't require URL encoding as they're controlled inputs, not arbitrary user data.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Documentation is required for all public APIs in Rust

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T06:10:25.445Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:206-227
Timestamp: 2026-02-07T06:10:25.445Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: The TOC at `/llm.md` is generated by the Moose docs site. Slugs are simple path segments that never contain literal parentheses or special characters. The `parse_toc_entry` function correctly handles parentheses in titles (e.g., "TTL (Time-to-Live)") by using the `](` boundary to separate title from URL.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Group related constants together

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Derive standard traits for newtypes: `#[derive(Debug, Clone, PartialEq)]`

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): Raw `println!` is acceptable for multi-line help text and formatted usage examples. The display wrapper (display::show_message_wrapper) is intended for status messages, not help text output.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Define newtypes as tuple structs: `struct UserId(u64);`

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-02-07T06:10:34.807Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:896-942
Timestamp: 2026-02-07T06:10:34.807Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI Rust code): Variable shadowing is acceptable and idiomatic when progressively refining a value through transformations (e.g., from `&str` to `String` or from raw input to processed output). This is a preferred pattern in the codebase.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2026-02-07T04:42:40.620Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:863-909
Timestamp: 2026-02-07T04:42:40.620Z
Learning: In apps/framework-cli/src/cli/routines/docs.rs: macOS and Linux are primary target platforms; Windows is a best-effort fallback and not a primary target for the Moose CLI.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:46.739Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:40-48
Timestamp: 2026-02-07T04:42:46.739Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI Rust code): Prefer inherent `from_str` methods over implementing `std::str::FromStr` trait when the conversion is only used in one place and not used with `.parse()` syntax—stylistic preference.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
📚 Learning: 2026-01-26T00:56:27.011Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3400
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:1238-1298
Timestamp: 2026-01-26T00:56:27.011Z
Learning: Repo 514-labs/moosestack — Workflows: The CLI’s workflow diff is intended to detect only Temporal schedule–affecting changes. In apps/framework-cli/src/framework/core/infrastructure_map.rs, workflows_config_equal should compare schedule, retries, and timeout only; it must not include tasks. Task code/config changes are picked up automatically when the orchestration worker restarts and should not trigger a WorkflowChange.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:43:06.078Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:40-72
Timestamp: 2026-02-06T01:43:06.078Z
Learning: In the Moose framework-cli (Rust), the telemetry functions capture_usage and wait_for_usage_capture use a fire-and-forget pattern: errors are logged internally and not surfaced to users. This behavior is intentional across all commands. Do not change error propagation for individual commands; any modification requires a broad refactor across the CLI telemetry layer. During reviews, treat changes to telemetry error reporting as high risk and scope changes to capture_usage/wait_for_usage_capture to the entire framework-cli, not single commands.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:43.608Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:878-887
Timestamp: 2026-02-07T04:42:43.608Z
Learning: For the Moose CLI under apps/framework-cli, document and implement that Windows support is best-effort only, while macOS (open) and Linux (xdg-open) are the primary targets. Treat Windows-specific code paths (e.g., using cmd /c start) as fallback implementations and ensure they are not required to be as robust as the primary platforms. When adding Windows fallbacks, include clear caveats, avoid blocking on Windows-specific behavior, and add appropriate runtime checks, logs, and TODOs. This guidance applies to Rust source files under apps/framework-cli/src (and adjacent Rust files in the same module) to keep Windows handling clearly scoped and maintainable.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T01:42:35.875Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3462
File: apps/framework-cli/src/cli/routines/feedback.rs:107-119
Timestamp: 2026-02-06T01:42:35.875Z
Learning: In modules under apps/framework-cli/src/cli/routines (any Rust file under subdirectories) use raw println! for multi-line help text and formatted usage examples. Do not rely on display::show_message_wrapper for help output; reserve it for status messages and user-visible progress updates. Ensure help text remains readable and properly formatted.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T04:42:46.739Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:40-48
Timestamp: 2026-02-07T04:42:46.739Z
Learning: In Rust files under apps/framework-cli/src/cli/routines/, prefer using inherent from_str methods for conversions when the conversion is only used in a single place and you are not using .parse() elsewhere. Avoid implementing std::str::FromStr purely for stylistic reasons if the conversion isn’t reused with .parse()."

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-07T06:10:34.807Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:896-942
Timestamp: 2026-02-07T06:10:34.807Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Rust code for Moose CLI), variable shadowing is acceptable and idiomatic when progressively refining a value (e.g., from &str to String or from raw input to processed output). Consider this a preferred pattern in this codebase, but ensure shadowing is intentional and improves readability rather than obscuring the data flow.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Implement `From`/`TryFrom` for newtype conversions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Respect language-specific best practices and idioms for Rust, TypeScript/JavaScript, and Python

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-01-19T22:37:05.393Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3282
File: apps/framework-cli-e2e/test/utils/llm-agent-utils.ts:613-742
Timestamp: 2026-01-19T22:37:05.393Z
Learning: In the LLM Documentation Automation test (`apps/framework-cli-e2e/test/llm-docs-automation.test.ts` and `apps/framework-cli-e2e/test/utils/llm-agent-utils.ts`), token limit failures are intentional. The test should fail if the agent exceeds Claude's context window, as this signals that documentation or task complexity needs improvement and represents what a real user would experience.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Audit documentation when changing user-facing features

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Always run `cargo clippy --all-targets -- -D warnings` before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Define errors near their unit of fallibility (no global Error types)

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:46.806Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: packages/protobuf/CLAUDE.md:0-0
Timestamp: 2025-12-16T23:08:46.806Z
Learning: Applies to packages/protobuf/**/AGENTS.md : Review AGENTS.md for coding standards and guidelines

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `derive_more` or `nutype` to reduce newtype boilerplate

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `const` for static values (prefer over `static`)

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-01T23:07:12.361Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-01T23:07:12.361Z
Learning: Applies to **/*.rs : Write inline tests with `#[cfg(test)]` modules in Rust

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2026-02-06T19:56:08.946Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 3459
File: apps/framework-cli/src/cli/routines/seed_data.rs:792-894
Timestamp: 2026-02-06T19:56:08.946Z
Learning: In apps/framework-cli/src/cli/routines/seed_data.rs, the duplication between create_single_mirror (early return pattern) and create_external_tables_from_local_schema (batch processing with continue) for existence-check/drop logic is intentional due to different error handling patterns, and should not be refactored into a shared helper.

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:08:31.521Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-16T23:08:31.521Z
Learning: Applies to **/*.rs : Run `cargo clippy` to ensure Rust code passes Clippy's linting standards before each commit

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `thiserror` crate instead of `anyhow::Result` for error handling

Applied to files:

  • apps/framework-cli/src/cli/routines/docs.rs
🔇 Additional comments (11)
apps/framework-cli/src/cli.rs (2)

15-18: No review needed for this import tweak.


1569-1620: Docs command routing looks solid.

apps/framework-cli/src/cli/commands.rs (1)

251-252: Docs command surface and help examples read cleanly.

Also applies to: 459-512

apps/framework-cli/src/cli/routines/docs.rs (8)

33-138: Language resolution flow is clear and well-ordered.


166-267: TOC parsing and grouping logic looks solid.


271-421: ANSI/no-ANSI rendering is consistent.


425-632: Fetch helpers and slug normalization are clean.


456-583: Heading extraction and code-fence guards are solid.


640-889: TOC display, page fetch, and search flows look good.


963-1258: Picker rendering and raw-mode guard look robust.


1260-1499: Item builders and browse flow read cleanly.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +28 to +30
const DOCS_BASE_URL: &str = "https://docs.fiveonefour.com";
const TOC_PATH: &str = "/llm.md";

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Move docs constants to constants.rs.
Keep module constants centralized and imported here.

As per coding guidelines: "Place constants in constants.rs at the appropriate module level in Rust."

🤖 Prompt for AI Agents
In `@apps/framework-cli/src/cli/routines/docs.rs` around lines 28 - 30, The two
module constants DOCS_BASE_URL and TOC_PATH should be moved into the
module-level constants file and imported here: remove DOCS_BASE_URL and TOC_PATH
from apps/framework-cli/src/cli/routines/docs.rs, add them to the appropriate
constants.rs (e.g., pub const DOCS_BASE_URL: &str = "..."; pub const TOC_PATH:
&str = "...";) so they are centralized, make them public if needed, and update
docs.rs to use the imported symbols (e.g., crate::constants::DOCS_BASE_URL and
crate::constants::TOC_PATH or the correct module path) instead of the local
definitions.

Comment on lines +896 to +909
pub fn open_in_browser(slug: &str) -> Result<RoutineSuccess, RoutineFailure> {
let stripped = slug.trim_start_matches('/');
// Split off #anchor before stripping .md extension
let (path, anchor) = match stripped.split_once('#') {
Some((p, a)) => (p.trim_end_matches(".md"), Some(a)),
None => (stripped.trim_end_matches(".md"), None),
};
let url = match anchor {
Some(a) => format!("{}/{}#{}", DOCS_BASE_URL, path, a),
None => format!("{}/{}", DOCS_BASE_URL, path),
};
let stripped = anchor
.map(|a| format!("{}#{}", path, a))
.unwrap_or_else(|| path.to_string());
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Normalize slug/anchor casing in open_in_browser.
The CLI advertises case-insensitive slugs/sections, but open_in_browser preserves input casing, which can break on case-sensitive hosts/fragments.

Proposed fix
 pub fn open_in_browser(slug: &str) -> Result<RoutineSuccess, RoutineFailure> {
     let stripped = slug.trim_start_matches('/');
     // Split off `#anchor` before stripping .md extension
     let (path, anchor) = match stripped.split_once('#') {
         Some((p, a)) => (p.trim_end_matches(".md"), Some(a)),
         None => (stripped.trim_end_matches(".md"), None),
     };
-    let url = match anchor {
-        Some(a) => format!("{}/{}#{}", DOCS_BASE_URL, path, a),
-        None => format!("{}/{}", DOCS_BASE_URL, path),
-    };
-    let stripped = anchor
-        .map(|a| format!("{}#{}", path, a))
-        .unwrap_or_else(|| path.to_string());
+    let path = path.to_lowercase();
+    let anchor = anchor.map(|a| a.to_lowercase());
+    let url = match anchor.as_deref() {
+        Some(a) => format!("{}/{}#{}", DOCS_BASE_URL, path, a),
+        None => format!("{}/{}", DOCS_BASE_URL, path),
+    };
+    let display_path = anchor
+        .as_deref()
+        .map(|a| format!("{}#{}", path, a))
+        .unwrap_or_else(|| path.clone());
 
     ...
-            format!("Opened {} in browser", stripped),
+            format!("Opened {} in browser", display_path),
🤖 Prompt for AI Agents
In `@apps/framework-cli/src/cli/routines/docs.rs` around lines 896 - 909,
open_in_browser currently preserves the input casing for slug, path and anchor
which can break on case-sensitive hosts/fragments; change the logic in
open_in_browser so that after computing path and anchor you normalize them to a
canonical case (e.g., to_lowercase()) before constructing url and stripped, i.e.
apply to_lowercase() to path and to the anchor (if Some) and then use those
lowercased values when building url, the stripped value, and any further uses;
ensure you still trim leading '/' and the ".md" suffix before lowercasing.

Comment on lines +1501 to +1586
/// Browse into a guide page, showing a section picker (H2/H3 headings).
async fn browse_guide_page(
slug: &str,
lang: DocsLanguage,
raw: bool,
web: bool,
) -> Result<RoutineSuccess, RoutineFailure> {
let slug_display = slug.trim_start_matches('/').trim_end_matches(".md");

if !raw {
show_message!(
MessageType::Info,
Message::new(
"Docs".to_string(),
format!("Fetching sections for {}...", slug_display)
)
);
}

let content = fetch_page_content(slug, lang).await?;
let headings = parse_page_headings(&content);

if headings.is_empty() || !std::io::stdout().is_terminal() {
let cleaned = strip_images(&content);
println!("{}", cleaned);
return Ok(RoutineSuccess::success(Message::new(
"Docs".to_string(),
format!("Fetched {}", slug_display),
)));
}

let items = guide_section_items(&headings);
match run_picker(&items, slug_display)? {
PickerResult::Selected(0) => {
// "Full page"
if web {
open_in_browser(slug)
} else {
let cleaned = strip_images(&content);
println!("{}", cleaned);
Ok(RoutineSuccess::success(Message::new(
"Docs".to_string(),
format!("Fetched {}", slug_display),
)))
}
}
PickerResult::Selected(idx) => {
// Section selected (idx-1 because idx 0 is "Full page")
let heading = &headings[idx - 1];
if web {
let with_anchor = format!("{}#{}", slug_display, heading.anchor);
open_in_browser(&with_anchor)
} else {
let cleaned = strip_images(&content);
match extract_section(&cleaned, &heading.anchor) {
Some(section_content) => {
println!("{}", section_content);
Ok(RoutineSuccess::success(Message::new(
"Docs".to_string(),
format!("Fetched {}#{}", slug_display, heading.anchor),
)))
}
None => {
// Fallback: print full page
println!("{}", cleaned);
Ok(RoutineSuccess::success(Message::new(
"Docs".to_string(),
format!("Fetched {}", slug_display),
)))
}
}
}
}
PickerResult::Back | PickerResult::Cancelled => {
// For guide section back, just print full page as graceful fallback
if raw {
let cleaned = strip_images(&content);
println!("{}", cleaned);
}
Ok(RoutineSuccess::success(Message::new(
"Docs".to_string(),
"Browse cancelled".to_string(),
)))
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Suppress success messages when --raw in guide browsing.
browse_guide_page returns non-empty RoutineSuccess messages in raw mode, which will pollute piped output.

Proposed fix
 async fn browse_guide_page(
     slug: &str,
     lang: DocsLanguage,
     raw: bool,
     web: bool,
 ) -> Result<RoutineSuccess, RoutineFailure> {
     let slug_display = slug.trim_start_matches('/').trim_end_matches(".md");
+    let success = |details: String| {
+        if raw {
+            RoutineSuccess::success(Message::new(String::new(), String::new()))
+        } else {
+            RoutineSuccess::success(Message::new("Docs".to_string(), details))
+        }
+    };

     ...
     if headings.is_empty() || !std::io::stdout().is_terminal() {
         let cleaned = strip_images(&content);
         println!("{}", cleaned);
-        return Ok(RoutineSuccess::success(Message::new(
-            "Docs".to_string(),
-            format!("Fetched {}", slug_display),
-        )));
+        return Ok(success(format!("Fetched {}", slug_display)));
     }

     ...
         PickerResult::Selected(0) => {
             if web {
                 open_in_browser(slug)
             } else {
                 let cleaned = strip_images(&content);
                 println!("{}", cleaned);
-                Ok(RoutineSuccess::success(Message::new(
-                    "Docs".to_string(),
-                    format!("Fetched {}", slug_display),
-                )))
+                Ok(success(format!("Fetched {}", slug_display)))
             }
         }
         PickerResult::Selected(idx) => {
             let heading = &headings[idx - 1];
             if web {
                 let with_anchor = format!("{}#{}", slug_display, heading.anchor);
                 open_in_browser(&with_anchor)
             } else {
                 let cleaned = strip_images(&content);
                 match extract_section(&cleaned, &heading.anchor) {
                     Some(section_content) => {
                         println!("{}", section_content);
-                        Ok(RoutineSuccess::success(Message::new(
-                            "Docs".to_string(),
-                            format!("Fetched {}#{}", slug_display, heading.anchor),
-                        )))
+                        Ok(success(format!("Fetched {}#{}", slug_display, heading.anchor)))
                     }
                     None => {
                         println!("{}", cleaned);
-                        Ok(RoutineSuccess::success(Message::new(
-                            "Docs".to_string(),
-                            format!("Fetched {}", slug_display),
-                        )))
+                        Ok(success(format!("Fetched {}", slug_display)))
                     }
                 }
             }
         }
         PickerResult::Back | PickerResult::Cancelled => {
             if raw {
                 let cleaned = strip_images(&content);
                 println!("{}", cleaned);
             }
-            Ok(RoutineSuccess::success(Message::new(
-                "Docs".to_string(),
-                "Browse cancelled".to_string(),
-            )))
+            Ok(success("Browse cancelled".to_string()))
         }
     }
 }
🤖 Prompt for AI Agents
In `@apps/framework-cli/src/cli/routines/docs.rs` around lines 1501 - 1586, The
function browse_guide_page currently always returns RoutineSuccess messages (via
RoutineSuccess::success(Message::new(...))) even in raw mode, which pollutes
piped output; update all return points in browse_guide_page (including the "Full
page" branch, section display branch, fallback branch, and the Cancel/Back
branch) to return a non-message/empty success when raw is true (e.g., return
RoutineSuccess::empty() or the equivalent "no-message" variant) and only call
RoutineSuccess::success(Message::new(...)) when raw is false, using the existing
raw boolean and the RoutineSuccess/Message symbols to locate each spot to
change.

Replaces remaining vitesse-light/vitesse-dark theme references with
github-light/github-dark across all 8 files. Adds dark mode CSS variable
selectors to shell-snippet.tsx so shiki dual-theme output switches correctly.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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