Skip to content

feat(cli): flag-first moose init and template recovery (514-1408) - #4063

Merged
okane16 merged 4 commits into
mainfrom
feature/514-1408-moose-init-template-failures
May 1, 2026
Merged

feat(cli): flag-first moose init and template recovery (514-1408)#4063
okane16 merged 4 commits into
mainfrom
feature/514-1408-moose-init-template-failures

Conversation

@okane16

@okane16 okane16 commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Improves moose init so agents and scripts can use --name and --template (including --template=value) without Clap rejecting the flag form. Legacy positionals remain supported but are hidden from primary help; docs and examples use the flag syntax. Unknown-template errors now point to moose template list and moose template list --json.

Linear

Testing

  • cargo test -p moose-cli --test cli_init
  • cargo clippy -p moose-cli --all-targets -- -D warnings

Made with Cursor


Note

Medium Risk
Moderate risk because it changes moose init argument parsing/validation (clap groups, conflicts, required args), which could break existing scripts or edge-case invocations despite keeping legacy positionals.

Overview
Updates moose init to be flag-first, adding --name and --template (including --template=...) as the preferred interface while keeping the legacy positional name/template inputs as hidden, backward-compatible arguments.

Improves init --help to promote flag-based examples and adds new CLI tests covering flag usage, conflict cases (positional+flag), and unknown-template recovery messaging.

Enhances unknown-template errors to point users/agents to moose template list and moose template list --json, and updates E2E setup code, docs, and template READMEs to use the new flag-based init syntax throughout.

Reviewed by Cursor Bugbot for commit bd4ef55. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add --name and --template to moose init; keep hidden positionals for compatibility
- Improve unknown-template message with moose template list --json
- Update docs, E2E helpers, and template READMEs to use flag syntax
- Add cli_init tests for flag forms and invalid template recovery

Made-with: Cursor
@linear

linear Bot commented Apr 29, 2026

Copy link
Copy Markdown

@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs-v2 Ready Ready Preview, Comment Apr 30, 2026 5:00pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c39c3d6b-0dcd-46b7-ba84-452fcb9b7a34

📥 Commits

Reviewing files that changed from the base of the PR and between 2f6666a and bd4ef55.

📒 Files selected for processing (1)
  • apps/framework-cli/tests/cli_init.rs
📜 Recent review details
⏰ 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). (41)
  • GitHub Check: Test E2E Prod Docker Mode
  • GitHub Check: Test E2E TS Tests: s3 (Node 22)
  • GitHub Check: Test E2E TS Tests: s3 (Node 24)
  • GitHub Check: Test E2E TS Tests: db-pull (Node 20)
  • GitHub Check: Test E2E TypeScript Default Template (Node 20, npm)
  • GitHub Check: Test E2E TS Tests: s3 (Node 20)
  • GitHub Check: Test E2E TS Tests: core (Node 20)
  • GitHub Check: Test E2E Init From Remote & Seed
  • GitHub Check: Test E2E TS Tests: core (Node 24)
  • GitHub Check: Test E2E TS Tests: db-pull (Node 22)
  • GitHub Check: Test E2E TS Tests: core (Node 22)
  • GitHub Check: Test E2E TS Tests: db-pull (Node 24)
  • GitHub Check: Test E2E TypeScript Default Template (Node 20, pnpm-10)
  • GitHub Check: Test E2E TypeScript Default Template (Node 22, npm)
  • GitHub Check: Test E2E TypeScript Default Template (Node 22, pnpm-10)
  • GitHub Check: Test E2E PY Tests: core (Python 3.12)
  • GitHub Check: Test E2E TypeScript Default Template (Node 24, pnpm-9)
  • GitHub Check: Test E2E TypeScript Default Template (Node 24, npm)
  • GitHub Check: Test E2E TypeScript Default Template (Node 22, pnpm-9)
  • GitHub Check: Test E2E TypeScript Default Template (Node 20, pnpm-9)
  • GitHub Check: Test E2E TypeScript Default Template (Node 24, pnpm-10)
  • GitHub Check: Test E2E Python Default Template (Python 3.13)
  • GitHub Check: Test E2E PY Tests: core (Python 3.13)
  • GitHub Check: Test E2E PY Tests: s3 (Python 3.13)
  • GitHub Check: Test E2E PY Tests: s3 (Python 3.12)
  • GitHub Check: Test E2E Row-Level Security (TypeScript)
  • GitHub Check: Test E2E PY Tests: db-pull (Python 3.12)
  • GitHub Check: Test E2E PY Tests: db-pull (Python 3.13)
  • GitHub Check: Test E2E Backward Compatibility - Python (Python 3.13)
  • GitHub Check: Test E2E Cluster Support - TypeScript (Node 20)
  • GitHub Check: Test E2E OTLP Log Export (TypeScript)
  • GitHub Check: Test E2E Cluster Support - Python (Python 3.13)
  • GitHub Check: Test E2E Backward Compatibility - TypeScript (Node 20)
  • GitHub Check: Test E2E Module Compilation (ESM/CJS)
  • GitHub Check: Test E2E Python Default Template (Python 3.12)
  • GitHub Check: Build CLI Binaries (linux-arm64-glibc, ubuntu-22-8-core, aarch64-unknown-linux-gnu)
  • GitHub Check: Build CLI Binaries (linux-x64-glibc, ubuntu-22-8-core, x86_64-unknown-linux-gnu)
  • GitHub Check: Package and Publish Independant TS Package
  • GitHub Check: Build CLI Binaries (darwin-arm64, macos-14-large, aarch64-apple-darwin)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: Analyze (rust)
🧰 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

Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit (NO global Error type); NEVER use anyhow::Result

Use snake_case for functions/variables, PascalCase for types/traits, and SCREAMING_SNAKE_CASE for constants in Rust

Use tuple structs with validation constructors for newtypes in Rust (e.g., struct UserId(String))

Write Rust tests inline with #[cfg(test)] modules

Document all public APIs in Rust

Run Rust linting with cargo clippy --all-targets -- -D warnings pre-commit (no warnings allowed)

Files:

  • apps/framework-cli/tests/cli_init.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
Prefer top-of-file use statements over inline ones in function bodies; add use imports for fully-qualified paths; local use for disambiguation (e.g., name collisions) is fine
Write meaningful names for functions, variables, and types
Keep functions focused and modular
Document all public APIs and breaking changes
Use thiserror crate for error handling instead of anyhow::Result
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error structs
Structure error types as: context struct + error enum + #[source] chaining
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 crates to reduce boilerplate in newtype definitions
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases in unit and integration tests

Files:

  • apps/framework-cli/tests/cli_init.rs
apps/framework-cli/**/tests/**/*.rs

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

Use integration tests for CLI commands

Files:

  • apps/framework-cli/tests/cli_init.rs
🧠 Learnings (25)
📓 Common learnings
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4041
File: apps/framework-cli/src/cli/logger.rs:490-494
Timestamp: 2026-04-23T01:59:31.717Z
Learning: In 514-labs/moosestack `apps/framework-cli/src/cli/logger.rs`, recursive `sweep_logs` for nested `log_file_date_format` paths (containing `/`) was explicitly considered and rejected as scope creep in PR `#4041`. The PR's intended fix is only `create_dir_all(parent)` in `open_log_writer` to prevent panics when `~/.moose/` vanishes mid-run. If nested date-format paths are ever supported, the correct approach is config-load validation (reject `/` in `log_file_date_format`), not recursive log cleanup. Do not flag absence of recursive cleanup as a bug in this or similar PRs.
Learnt from: LucioFranco
Repo: 514-labs/moosestack PR: 3932
File: apps/framework-cli/src/cli.rs:0-0
Timestamp: 2026-04-10T14:30:34.800Z
Learning: In 514-labs/moosestack, `moose clean` calling `shutdown_embedded_servers()` in `apps/framework-cli/src/cli.rs` only closes in-memory handles in the current process. It cannot stop embedded servers (devredis, devkafka, ClickHouse/Temporal) owned by a separate `moose dev --alpha` process. Cross-process cleanup via PID files or a control socket is a known architectural gap shared across all embedded servers, intentionally deferred and out of scope for individual feature PRs. Do not flag this as a bug requiring immediate fix.
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:596-598
Timestamp: 2026-03-24T19:10:26.494Z
Learning: Repo 514-labs/moosestack — Moose CLI: Row policies always reference existing tables. apps/framework-cli/src/framework/core/plan_validator.rs::validate_row_policy_columns rejects policies whose tables are missing or columns don’t exist. Therefore, InfrastructureMap::uses_olap() not checking select_row_policies is acceptable because any map with policies will also have non-empty tables.
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.
Learnt from: okane16
Repo: 514-labs/moosestack PR: 0
File: :0-0
Timestamp: 2026-04-21T22:20:46.234Z
Learning: In 514-labs/moosestack PR `#4032`, the cutover that removes legacy migrate/olap pages, moves `olap/schema-versioning` to top-level, rewrites cross-refs, and adds redirects is intentionally deferred to a separate follow-up PR. This will land only after `features.migrate_with_deltas` flips to default post-beta. Do not raise concerns about missing redirects, legacy page removal, schema-versioning relocation, or cross-ref rewrites in PR `#4032` or similar additive-only delta-migration PRs.
Learnt from: phiSgr
Repo: 514-labs/moosestack PR: 3930
File: apps/framework-cli/src/cli/local_webserver.rs:3524-3535
Timestamp: 2026-04-08T00:08:36.251Z
Learning: In 514-labs/moosestack, the `/admin/inframap` and related `/admin/*` endpoints (e.g., `/admin/plan`, `/admin/integrate-changes`, `/admin/reality-check`) in `apps/framework-cli/src/cli/local_webserver.rs` are internal CLI-to-server communication endpoints. They are consumed programmatically by CLI routines (e.g., migration, remote-plan), not by end users. Do not flag missing framework-docs-v2 documentation for changes to these admin endpoints — the coding guideline requiring docs updates applies only to user-facing APIs, commands, flags, and configs.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-08T22:31:22.237Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): When implementing raw output mode (--raw flag), public entry points (show_toc, fetch_page, search_toc, browse_docs) must return an empty Message (Message::new("".to_string(), "".to_string())) to prevent success messages from polluting piped output. Additionally, wrap show_message! calls in `if !raw` guards to keep intermediate messages from appearing in piped output.
Learnt from: cjus
Repo: 514-labs/moosestack PR: 3684
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:0-0
Timestamp: 2026-03-04T22:31:33.997Z
Learning: Repo 514-labs/moosestack — In apps/framework-cli/src/framework/core/infrastructure_map.rs, InfrastructureMap::to_proto serializes select_row_policies and InfrastructureMap::from_proto deserializes them back into the map. Proto/Redis round-trips now preserve row policies; do not flag select_row_policies as being dropped on load in future reviews.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-empty/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:39.081Z
Learning: Prefer MooseDev MCP tools over CLI commands — they return structured, token-optimized output
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/python-webapp/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:07.879Z
Learning: Use `moose --help`, `moose docs`, `moose query`, `moose ls`, `moose peek`, and `moose logs` CLI commands for context and debugging
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:50.188Z
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: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-09T21:19:28.424Z
Learning: When changing MooseStack functionality, ALWAYS run end-to-end tests
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript/AGENTS.md:0-0
Timestamp: 2026-03-31T03:47:23.245Z
Learning: Prefer MooseDev MCP tools (`get_infra_map`, `query_olap`, `get_logs`, `get_issues`, `get_stream_sample`) over CLI commands for project inspection and debugging
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T16:57:49.870Z
Learning: Run end-to-end tests when changing MooseStack functionality, and add E2E tests to `python-tests` and `typescript-tests` templates when changing user-facing features; audit documentation
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T16:57:49.870Z
Learning: Always format the code using appropriate language formatters (Prettier for TypeScript/JavaScript, cargo fmt for Rust, Black for Python)
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T16:57:49.870Z
Learning: Promote flag-first `moose init` invocation style in docs and examples: `moose init --name <name> --template <template>`; treat legacy positional form as backward-compatible only
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T16:57:49.870Z
Learning: For `moose init --help`, show flag-based examples in main promoted text; do not present positional forms as recommended invocations
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T16:57:49.870Z
Learning: For `moose dev` failures, show `moose dev --dockerless` only when the runtime is actually unavailable; do not suggest dockerless for unrelated infrastructure failures
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T16:57:49.870Z
Learning: Keep CLI flags, help text, and documentation aligned on flag syntax and valid template slugs to prevent agent copying errors (e.g., `--template=...` patterns)
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases in unit and integration tests

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-01T07:34:38.401Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-agent/AGENTS.md:0-0
Timestamp: 2026-04-01T07:34:38.401Z
Learning: Applies to templates/typescript-agent/packages/*/test/**/*.unit.test.ts : Place pure helper tests in `packages/*/test/**/*.unit.test.ts` and do not put package-crossing integration coverage there

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-01T07:34:38.401Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-agent/AGENTS.md:0-0
Timestamp: 2026-04-01T07:34:38.401Z
Learning: Applies to templates/typescript-agent/packages/*/test/**/*.integration.test.ts : Place runtime wiring tests in `packages/*/test/**/*.integration.test.ts` and do not require a prebuilt `dist/` tree

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-09T21:19:28.424Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-09T21:19:28.424Z
Learning: When changing user-facing features, add E2E tests to `python-tests`/`typescript-tests` templates AND audit documentation

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-08T22:20:08.757Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:1590-1838
Timestamp: 2026-02-08T22:20:08.757Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): For HTTP-dependent functionality like `fetch_docs`, prefer E2E or integration tests over unit tests. Unit testing HTTP fetching adds little value compared to integration testing and can be flaky due to network dependencies.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-06T01:42:40.104Z
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:40.104Z
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/tests/cli_init.rs
📚 Learning: 2026-02-08T22:31:22.237Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-08T22:31:22.237Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): When implementing raw output mode (--raw flag), public entry points (show_toc, fetch_page, search_toc, browse_docs) must return an empty Message (Message::new("".to_string(), "".to_string())) to prevent success messages from polluting piped output. Additionally, wrap show_message! calls in `if !raw` guards to keep intermediate messages from appearing in piped output.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-23T01:59:31.717Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4041
File: apps/framework-cli/src/cli/logger.rs:490-494
Timestamp: 2026-04-23T01:59:31.717Z
Learning: In 514-labs/moosestack `apps/framework-cli/src/cli/logger.rs`, recursive `sweep_logs` for nested `log_file_date_format` paths (containing `/`) was explicitly considered and rejected as scope creep in PR `#4041`. The PR's intended fix is only `create_dir_all(parent)` in `open_log_writer` to prevent panics when `~/.moose/` vanishes mid-run. If nested date-format paths are ever supported, the correct approach is config-load validation (reject `/` in `log_file_date_format`), not recursive log cleanup. Do not flag absence of recursive cleanup as a bug in this or similar PRs.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-18T22:43:44.130Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4024
File: apps/framework-cli/src/utilities/native_infra/preflight.rs:53-95
Timestamp: 2026-04-18T22:43:44.130Z
Learning: In `apps/framework-cli/src/utilities/native_infra/preflight.rs` (`PortConflictError::fmt`), `same_project_instance` uses `.any(|c| c.owner_pid.is_some())` intentionally. Only ClickHouse and Temporal write PID files; devredis, devkafka, http, management, and proxy_port ports are never attributed. Switching to `.all()` makes the check structurally unachievable for any realistic conflict set, causing the "another moose project" footer to always render even when attributed PIDs are present — a self-contradictory message. Do not suggest changing `.any()` to `.all()` here.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Prefer top-of-file `use` statements over inline ones in function bodies; add `use` imports for fully-qualified paths; local `use` for disambiguation (e.g., name collisions) is fine

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `UPPER_SNAKE_CASE` naming for constants

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-04T22:29:17.086Z
Learnt from: cjus
Repo: 514-labs/moosestack PR: 3684
File: apps/framework-cli/src/framework/core/execute.rs:130-136
Timestamp: 2026-03-04T22:29:17.086Z
Learning: In apps/framework-cli/src/framework/core/plan_validator.rs, `validate_row_policy_columns` enforces at build time that no two SelectRowPolicy instances on the same column have conflicting JWT claim mappings. This means the `row_policies_config` HashMap construction in `execute_initial_infra_change` (execute.rs) cannot silently overwrite conflicting claims — the plan would have already been rejected. Do not flag the collect() as a silent-duplicate risk.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-24T19:13:18.829Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/cli/routines/migrate.rs:363-366
Timestamp: 2026-03-24T19:13:18.829Z
Learning: In `apps/framework-cli/src/cli/routines/migrate.rs`, the `CreateRowPolicy`/`DropRowPolicy` branches in `validate_table_databases_and_clusters` (which skip cluster validation) are intentionally covered by E2E tests in `apps/framework-cli-e2e/test/row-level-security.test.ts` rather than by dedicated unit tests in `migrate.rs`. Do not request additional unit tests for these branches.

Applied to files:

  • apps/framework-cli/tests/cli_init.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: Ensure all tests pass: `cargo test` for Rust components and appropriate test commands for TS/JS

Applied to files:

  • apps/framework-cli/tests/cli_init.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/tests/cli_init.rs
📚 Learning: 2026-03-24T19:14:21.620Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/framework/core/plan.rs:876-884
Timestamp: 2026-03-24T19:14:21.620Z
Learning: In `apps/framework-cli/src/framework/core/plan.rs`, the `MockOlapClient::list_row_policies` stub in the `#[cfg(test)]` module intentionally returns `Ok(vec![])`. The row-policy reconciliation branches inside `reconcile_with_reality()` are covered by E2E tests in `apps/framework-cli-e2e/test/row-level-security.test.ts` rather than by additional unit tests in `plan.rs`. Do not request extra unit tests for these branches in this file.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-24T19:15:00.795Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs:1638-1644
Timestamp: 2026-03-24T19:15:00.795Z
Learning: In `apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs`, `rls_bootstrap` (public) and `parse_row_policy_filter` (private) are intentionally covered by E2E tests in `apps/framework-cli-e2e/test/row-level-security.test.ts` (the "Row-Level Security" suite) rather than by inline `#[cfg(test)]` unit tests. Do not request additional unit tests for these functions in this file.

Applied to files:

  • apps/framework-cli/tests/cli_init.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 templates/** : For template modifications in the `templates/` directory, verify they can still run in isolation

Applied to files:

  • apps/framework-cli/tests/cli_init.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/tests/cli_init.rs
🔇 Additional comments (4)
apps/framework-cli/tests/cli_init.rs (4)

103-107: Help-output assertions now correctly enforce flag-first guidance.

Good update: this locks in “Examples (preferred)” and prevents legacy [TEMPLATE] from resurfacing in primary help.


114-167: Flag-path success coverage is solid.

Both --template value and --template=value flows are exercised with --name, and scaffold artifact checks are present.


171-204: Argument-conflict regression coverage is complete.

Nice addition of symmetric conflict tests for template and name positional/flag mixing.


208-234: Unknown-template recovery test is well hardened.

Message recovery guidance is asserted, and failure-path file side effects are checked.


Summary by CodeRabbit

  • New Features

    • moose init now prefers flag-based syntax (--name, --template) while retaining legacy positional support.
  • Improvements

    • CLI help, examples and troubleshooting clarified to be flag-first and consistent.
    • Error/help messages now recommend moose template list --json and give more precise troubleshooting (including when to use --dockerless).
    • Workspace vs. fuller agent setup expectations clarified.
  • Tests

    • E2E and integration tests updated to exercise flag-based init flows.
  • Documentation

    • Extensive docs, guides, examples and templates updated to the new init syntax.

Walkthrough

Migrates moose init from positional args to a flag-first interface (--name, --template), updates CLI parsing/help to prefer flags (keeps positional compatibility), adapts tests/E2E and template metadata, refines template-not-found messaging, and updates docs/examples across the repo.

Changes

Cohort / File(s) Summary
CLI Command Model
apps/framework-cli/src/cli/commands.rs, apps/framework-cli/src/cli.rs
Add public --name/--template options, keep hidden positional compatibility, add arg groups/conflicts, resolve values in handler, and error when neither provided.
CLI Template Messaging
apps/framework-cli/src/cli/routines/templates.rs
Refine missing-template error to show "Template '' not found" and point to moose template list (including --json) for discovery.
CLI Tests & E2E
apps/framework-cli/tests/cli_init.rs, apps/framework-cli-e2e/test/seed-filter.test.ts, apps/framework-cli-e2e/test/utils/project-setup.ts
Switch tests/E2E to flag-based init usage; add success and failure tests covering --name/--template forms and invalid combinations.
Docs — Guides & Reference
apps/framework-docs-v2/content/... (multiple files)
Replace positional moose init examples with --name/--template across guides, tutorials, deployment docs, quickstarts, and release notes; add deprecation/compatibility note in CLI reference.
Docs — Components & Templates
apps/framework-docs-v2/src/components/mdx/command-snippet.tsx, apps/framework-docs-v2/src/lib/templates.ts, templates/*/README.md
Default initCommand strings and generated template metadata now use flag-based syntax; update template README examples.
Agent Docs
AGENTS.md
Document flag-first preference for moose init, refine moose dev --dockerless troubleshooting guidance, and clarify workspace-level expectations.

Sequence Diagram(s)

sequenceDiagram
  participant User as User (CLI)
  participant CLI as moose CLI
  participant Templates as Template Registry
  participant FS as Filesystem/Project Creator

  User->>CLI: run `moose init --name X --template Y`
  CLI->>CLI: parse flags, resolve name/template (fallback to positional)
  CLI->>Templates: lookup template Y
  alt template found
    Templates-->>CLI: template metadata
    CLI->>FS: create project files using metadata
    FS-->>CLI: creation success
    CLI-->>User: success message
  else template missing
    Templates-->>CLI: not found
    CLI-->>User: "Template 'Y' not found" + hint `moose template list --json`
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • callicles
  • LucioFranco
  • onelesd

Poem

Flags unfurl where positionals stood, 🚩
Tests aligned and docs made good,
--name calls out, --template replies,
Back-compat hums while old syntax lies,
New-init dawns and builders sigh with pride. 🌅

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: introducing flag-based --name and --template options for moose init and improving template recovery error messages.
Description check ✅ Passed The description clearly explains the PR's purpose: flag-first moose init with backward-compatible positionals, improved help, and better template error recovery messaging.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/514-1408-moose-init-template-failures

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/framework-cli/tests/cli_init.rs`:
- Around line 103-107: The test currently asserts that the help output contains
the legacy positional marker "[TEMPLATE]" (see the assertion using
predicate::str::contains("[TEMPLATE]") in apps/framework-cli/tests/cli_init.rs);
update the test to stop codifying the old positional form by removing that
positive assertion (or replace it with a negative assertion like
predicate::str::contains("[TEMPLATE]").not()) and instead ensure the flag-first
form is present (keep or strengthen the existing check for "--template" in the
examples such as the ".stdout(predicate::str::contains(\"--name my-app
--template typescript\"))" assertion) so the test validates the new flag-first +
hidden-legacy behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: db818550-e3ec-48d8-9fbc-c47ef90e1367

📥 Commits

Reviewing files that changed from the base of the PR and between 5f3bc2b and 076041f.

📒 Files selected for processing (36)
  • AGENTS.md
  • apps/framework-cli-e2e/test/seed-filter.test.ts
  • apps/framework-cli-e2e/test/utils/project-setup.ts
  • apps/framework-cli/src/cli.rs
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/src/cli/routines/templates.rs
  • apps/framework-cli/tests/cli_init.rs
  • apps/framework-docs-v2/content/guides/chat-in-your-app/tutorial.mdx
  • apps/framework-docs-v2/content/guides/data-warehouses.mdx
  • apps/framework-docs-v2/content/guides/static-report-generation.mdx
  • apps/framework-docs-v2/content/guides/test-guides/code-blocks.mdx
  • apps/framework-docs-v2/content/moosestack/configuration/docker.mdx
  • apps/framework-docs-v2/content/moosestack/contribution/documentation.mdx
  • apps/framework-docs-v2/content/moosestack/deploying/deploying-on-an-offline-server.mdx
  • apps/framework-docs-v2/content/moosestack/deploying/deploying-with-docker-compose.mdx
  • apps/framework-docs-v2/content/moosestack/dev/cdc-managed-tables.mdx
  • apps/framework-docs-v2/content/moosestack/getting-started/from-clickhouse.mdx
  • apps/framework-docs-v2/content/moosestack/getting-started/quickstart.mdx
  • apps/framework-docs-v2/content/moosestack/moose-cli.mdx
  • apps/framework-docs-v2/content/moosestack/olap/alias-columns.mdx
  • apps/framework-docs-v2/content/moosestack/olap/db-pull.mdx
  • apps/framework-docs-v2/content/moosestack/olap/external-tables.mdx
  • apps/framework-docs-v2/content/moosestack/olap/materialized-columns.mdx
  • apps/framework-docs-v2/content/moosestack/release-notes/2025-12-05.mdx
  • apps/framework-docs-v2/content/moosestack/release-notes/2026-04-09.mdx
  • apps/framework-docs-v2/content/shared/examples/setup-example.mdx
  • apps/framework-docs-v2/content/shared/existing-app/moose-init-workspace-ts-pnpm.mdx
  • apps/framework-docs-v2/content/shared/guides/performant-dashboards/add-moosestack-and-set-up-fiveonefour.mdx
  • apps/framework-docs-v2/content/templates/index.mdx
  • apps/framework-docs-v2/src/components/mdx/command-snippet.tsx
  • apps/framework-docs-v2/src/lib/templates.ts
  • templates/python-empty/README.md
  • templates/python-tests/README.md
  • templates/python/README.md
  • templates/typescript-agent/README.md
  • templates/typescript-mcp/README.md

Comment thread apps/framework-cli/tests/cli_init.rs Outdated
@graphite-app
graphite-app Bot requested a review from a team April 29, 2026 17:26
@graphite-app

graphite-app Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Graphite Automations

"engineering review - commercial [copy]" took an action on this PR • (04/29/26)

1 reviewer was added to this PR based on Mitchell Suzuki's automation.

- Assert init --help does not advertise [TEMPLATE] positional marker
- Reword compatibility paragraph so long-help stays consistent without literal [TEMPLATE]

Addresses CodeRabbit feedback on PR #4063.

Made-with: Cursor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/framework-cli/tests/cli_init.rs`:
- Around line 165-182: The repository lacks a symmetric regression test for the
name conflict; add a new test function (e.g.,
init_rejects_positional_and_flag_name_together) modeled on
init_rejects_positional_and_flag_template_together that invokes the CLI with
cmd.arg("init").arg("my-app").arg("typescript").arg("--name").arg("other-name")
(or similar positional+--name combination), asserts failure, and checks stderr
contains the conflict message (predicate::str::contains("cannot be used with"))
and the flag name predicate::str::contains("--name") to ensure the same
validation is covered for name conflicts.
- Around line 152-156: Update the test invocations that build the CLI args chain
(the cmd.arg("init") call sequences) to supply the app name via the named flag
instead of a positional argument: replace the .arg("equals-app") positional with
a named flag (e.g., .arg("--name=equals-app") or
.arg("--name").arg("equals-app")) in the cmd.arg("init") chains so the tests
exercise the flag-first parsing path (apply the same change to the second
occurrence around the other cmd.arg("init") usage).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e625df39-c684-44d6-b3e6-9276687f9173

📥 Commits

Reviewing files that changed from the base of the PR and between 076041f and ab1d658.

📒 Files selected for processing (2)
  • apps/framework-cli/src/cli/commands.rs
  • apps/framework-cli/tests/cli_init.rs
📜 Review details
⏰ 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). (7)
  • GitHub Check: Build CLI Binaries (darwin-arm64, macos-14-large, aarch64-apple-darwin)
  • GitHub Check: Build CLI Binaries (linux-x64-glibc, ubuntu-22-8-core, x86_64-unknown-linux-gnu)
  • GitHub Check: Build CLI Binaries (linux-arm64-glibc, ubuntu-22-8-core, aarch64-unknown-linux-gnu)
  • GitHub Check: Package and Publish Independant TS Package
  • GitHub Check: Test CLI (macos-latest-large)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: Analyze (rust)
🧰 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

For Rust: Use thiserror with #[derive(thiserror::Error)] for error handling; define errors near fallibility unit; NEVER use anyhow::Result

For Rust: Use snake_case for functions/vars, PascalCase for types/traits, SCREAMING_SNAKE_CASE for constants

For Rust: Place constants in constants.rs at appropriate module level

For Rust: Use tuple structs with validation constructors for newtypes (e.g., struct UserId(String))

For Rust: Place tests inline with #[cfg(test)] modules

For Rust: Documentation required for all public APIs

For Rust: Run cargo clippy --all-targets -- -D warnings pre-commit; no warnings allowed

Files:

  • apps/framework-cli/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.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
Prefer top-of-file use statements over inline ones in function bodies; add use imports for fully-qualified paths; local use for disambiguation (e.g., name collisions) is fine
Write meaningful names for functions, variables, and types
Keep functions focused and modular
Document all public APIs and breaking changes
Use thiserror crate for error handling instead of anyhow::Result
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error structs
Structure error types as: context struct + error enum + #[source] chaining
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 crates to reduce boilerplate in newtype definitions
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases in unit and integration tests

Files:

  • apps/framework-cli/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.rs
apps/framework-cli/**/tests/**/*.rs

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

Use integration tests for CLI commands

Files:

  • apps/framework-cli/tests/cli_init.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.

Files:

  • apps/framework-cli/src/cli/commands.rs
🧠 Learnings (22)
📓 Common learnings
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4041
File: apps/framework-cli/src/cli/logger.rs:490-494
Timestamp: 2026-04-23T01:59:31.717Z
Learning: In 514-labs/moosestack `apps/framework-cli/src/cli/logger.rs`, recursive `sweep_logs` for nested `log_file_date_format` paths (containing `/`) was explicitly considered and rejected as scope creep in PR `#4041`. The PR's intended fix is only `create_dir_all(parent)` in `open_log_writer` to prevent panics when `~/.moose/` vanishes mid-run. If nested date-format paths are ever supported, the correct approach is config-load validation (reject `/` in `log_file_date_format`), not recursive log cleanup. Do not flag absence of recursive cleanup as a bug in this or similar PRs.
Learnt from: okane16
Repo: 514-labs/moosestack PR: 0
File: :0-0
Timestamp: 2026-04-21T22:20:46.234Z
Learning: In 514-labs/moosestack PR `#4032`, the cutover that removes legacy migrate/olap pages, moves `olap/schema-versioning` to top-level, rewrites cross-refs, and adds redirects is intentionally deferred to a separate follow-up PR. This will land only after `features.migrate_with_deltas` flips to default post-beta. Do not raise concerns about missing redirects, legacy page removal, schema-versioning relocation, or cross-ref rewrites in PR `#4032` or similar additive-only delta-migration PRs.
Learnt from: LucioFranco
Repo: 514-labs/moosestack PR: 3932
File: apps/framework-cli/src/cli.rs:0-0
Timestamp: 2026-04-10T14:30:34.800Z
Learning: In 514-labs/moosestack, `moose clean` calling `shutdown_embedded_servers()` in `apps/framework-cli/src/cli.rs` only closes in-memory handles in the current process. It cannot stop embedded servers (devredis, devkafka, ClickHouse/Temporal) owned by a separate `moose dev --alpha` process. Cross-process cleanup via PID files or a control socket is a known architectural gap shared across all embedded servers, intentionally deferred and out of scope for individual feature PRs. Do not flag this as a bug requiring immediate fix.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-08T22:31:22.237Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): When implementing raw output mode (--raw flag), public entry points (show_toc, fetch_page, search_toc, browse_docs) must return an empty Message (Message::new("".to_string(), "".to_string())) to prevent success messages from polluting piped output. Additionally, wrap show_message! calls in `if !raw` guards to keep intermediate messages from appearing in piped output.
Learnt from: phiSgr
Repo: 514-labs/moosestack PR: 3930
File: apps/framework-cli/src/cli/local_webserver.rs:3524-3535
Timestamp: 2026-04-08T00:08:36.251Z
Learning: In 514-labs/moosestack, the `/admin/inframap` and related `/admin/*` endpoints (e.g., `/admin/plan`, `/admin/integrate-changes`, `/admin/reality-check`) in `apps/framework-cli/src/cli/local_webserver.rs` are internal CLI-to-server communication endpoints. They are consumed programmatically by CLI routines (e.g., migration, remote-plan), not by end users. Do not flag missing framework-docs-v2 documentation for changes to these admin endpoints — the coding guideline requiring docs updates applies only to user-facing APIs, commands, flags, and configs.
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:50.188Z
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: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:596-598
Timestamp: 2026-03-24T19:10:26.494Z
Learning: Repo 514-labs/moosestack — Moose CLI: Row policies always reference existing tables. apps/framework-cli/src/framework/core/plan_validator.rs::validate_row_policy_columns rejects policies whose tables are missing or columns don’t exist. Therefore, InfrastructureMap::uses_olap() not checking select_row_policies is acceptable because any map with policies will also have non-empty tables.
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.
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:40.104Z
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:896-942
Timestamp: 2026-02-07T06:10:41.712Z
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.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-empty/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:39.081Z
Learning: Prefer MooseDev MCP tools over CLI commands — they return structured, token-optimized output
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/python-webapp/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:07.879Z
Learning: Use `moose --help`, `moose docs`, `moose query`, `moose ls`, `moose peek`, and `moose logs` CLI commands for context and debugging
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:04:19.625Z
Learning: Always run end-to-end tests when changing MooseStack functionality
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:04:19.625Z
Learning: When changing user-facing features, add E2E tests to `python-tests` and `typescript-tests` templates AND audit documentation
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:04:19.625Z
Learning: Always format the code
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases in unit and integration tests

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-08T22:20:08.757Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:1590-1838
Timestamp: 2026-02-08T22:20:08.757Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): For HTTP-dependent functionality like `fetch_docs`, prefer E2E or integration tests over unit tests. Unit testing HTTP fetching adds little value compared to integration testing and can be flaky due to network dependencies.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-06T01:42:40.104Z
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:40.104Z
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/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-04-01T07:34:51.710Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-agent/packages/moosestack-service/AGENTS.md:0-0
Timestamp: 2026-04-01T07:34:51.710Z
Learning: Applies to templates/typescript-agent/packages/moosestack-service/app/**/*.{ts,tsx} : Search for `EXAMPLE_APP_ONLY:` markers to identify which service files are safe to delete or rewrite first when replacing the seeded demo model

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-03-31T03:47:23.245Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript/AGENTS.md:0-0
Timestamp: 2026-03-31T03:47:23.245Z
Learning: Applies to templates/typescript/app/index.ts : Export new primitives from the app's entry file (`app/index.ts`) to ensure MooseStack discovers them

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-31T03:46:50.753Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-express/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:50.753Z
Learning: Applies to templates/typescript-express/app/index.ts : Export all new primitives (data models, pipelines, APIs, workflows) from `app/index.ts` to ensure MooseStack discovery

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-08T22:31:22.237Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-08T22:31:22.237Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): When implementing raw output mode (--raw flag), public entry points (show_toc, fetch_page, search_toc, browse_docs) must return an empty Message (Message::new("".to_string(), "".to_string())) to prevent success messages from polluting piped output. Additionally, wrap show_message! calls in `if !raw` guards to keep intermediate messages from appearing in piped output.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-04-23T01:59:31.717Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4041
File: apps/framework-cli/src/cli/logger.rs:490-494
Timestamp: 2026-04-23T01:59:31.717Z
Learning: In 514-labs/moosestack `apps/framework-cli/src/cli/logger.rs`, recursive `sweep_logs` for nested `log_file_date_format` paths (containing `/`) was explicitly considered and rejected as scope creep in PR `#4041`. The PR's intended fix is only `create_dir_all(parent)` in `open_log_writer` to prevent panics when `~/.moose/` vanishes mid-run. If nested date-format paths are ever supported, the correct approach is config-load validation (reject `/` in `log_file_date_format`), not recursive log cleanup. Do not flag absence of recursive cleanup as a bug in this or similar PRs.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-18T22:43:44.130Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4024
File: apps/framework-cli/src/utilities/native_infra/preflight.rs:53-95
Timestamp: 2026-04-18T22:43:44.130Z
Learning: In `apps/framework-cli/src/utilities/native_infra/preflight.rs` (`PortConflictError::fmt`), `same_project_instance` uses `.any(|c| c.owner_pid.is_some())` intentionally. Only ClickHouse and Temporal write PID files; devredis, devkafka, http, management, and proxy_port ports are never attributed. Switching to `.all()` makes the check structurally unachievable for any realistic conflict set, causing the "another moose project" footer to always render even when attributed PIDs are present — a self-contradictory message. Do not suggest changing `.any()` to `.all()` here.

Applied to files:

  • apps/framework-cli/tests/cli_init.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/tests/cli_init.rs
  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-02-07T04:42:50.188Z
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:50.188Z
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
📚 Learning: 2026-02-07T06:10:41.712Z
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:41.712Z
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
📚 Learning: 2026-04-08T00:08:36.251Z
Learnt from: phiSgr
Repo: 514-labs/moosestack PR: 3930
File: apps/framework-cli/src/cli/local_webserver.rs:3524-3535
Timestamp: 2026-04-08T00:08:36.251Z
Learning: In 514-labs/moosestack, the `/admin/inframap` and related `/admin/*` endpoints (e.g., `/admin/plan`, `/admin/integrate-changes`, `/admin/reality-check`) in `apps/framework-cli/src/cli/local_webserver.rs` are internal CLI-to-server communication endpoints. They are consumed programmatically by CLI routines (e.g., migration, remote-plan), not by end users. Do not flag missing framework-docs-v2 documentation for changes to these admin endpoints — the coding guideline requiring docs updates applies only to user-facing APIs, commands, flags, and configs.

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-02-07T04:42:43.495Z
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:43.495Z
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
📚 Learning: 2026-03-31T03:46:07.879Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/python-webapp/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:07.879Z
Learning: Use `moose --help`, `moose docs`, `moose query`, `moose ls`, `moose peek`, and `moose logs` CLI commands for context and debugging

Applied to files:

  • apps/framework-cli/src/cli/commands.rs
📚 Learning: 2026-03-31T03:46:39.081Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-empty/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:39.081Z
Learning: Prefer MooseDev MCP tools over CLI commands — they return structured, token-optimized output

Applied to files:

  • apps/framework-cli/src/cli/commands.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
🔇 Additional comments (1)
apps/framework-cli/src/cli/commands.rs (1)

30-64: Flag-first init contract looks solid.

The ArgGroup + hidden positional compatibility + explicit conflicts cleanly enforce the new --name/--template primary path without breaking legacy calls.

Comment thread apps/framework-cli/tests/cli_init.rs
Comment thread apps/framework-cli/tests/cli_init.rs
- Use --name in equals-style and unknown-template flag tests
- Add init_rejects_positional_and_flag_name_together (symmetric to template)

Addresses CodeRabbit feedback on PR #4063.

Made-with: Cursor

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/framework-cli/tests/cli_init.rs`:
- Around line 143-163: The test function
can_run_cli_init_with_equals_style_template_flag currently only asserts
package.json; strengthen it by also asserting the scaffolded app directory and
config file exist: after running the Command in
can_run_cli_init_with_equals_style_template_flag, add assertions similar to
other success-path tests to check
temp.child("app").assert(predicate::path::exists()) and
temp.child("moose.config.toml").assert(predicate::path::exists()), ensuring the
equals-style template flag produces the full scaffold.
- Around line 222-225: After asserting failure on unknown template via
cmd.assert().failure().stdout(...), add assertions that the target directory
used for init in this test (the tempdir variable used when constructing the cmd)
contains no scaffold files and/or is empty; specifically check that expected
scaffold artifacts (e.g., known filenames your init normally creates) do not
exist and/or that the directory read_dir().next() is None, so the init failure
is side-effect free. Use the same tempdir variable from this test and standard
fs checks (Path::exists / read_dir) to verify no files were created.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b9ac675c-45af-4602-a2cb-4155d669c12f

📥 Commits

Reviewing files that changed from the base of the PR and between ab1d658 and 2f6666a.

📒 Files selected for processing (1)
  • apps/framework-cli/tests/cli_init.rs
📜 Review details
⏰ 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). (7)
  • GitHub Check: Build CLI Binaries (linux-x64-glibc, ubuntu-22-8-core, x86_64-unknown-linux-gnu)
  • GitHub Check: Build CLI Binaries (linux-arm64-glibc, ubuntu-22-8-core, aarch64-unknown-linux-gnu)
  • GitHub Check: Build CLI Binaries (darwin-arm64, macos-14-large, aarch64-apple-darwin)
  • GitHub Check: Package and Publish Independant TS Package
  • GitHub Check: Check
  • GitHub Check: Cursor Bugbot
  • GitHub Check: Analyze (rust)
🧰 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

Rust: Use thiserror with #[derive(thiserror::Error)] for error handling; define errors near the fallibility unit; never use anyhow::Result

Rust: Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants

Rust: Place constants in constants.rs at the appropriate module level

Rust: Use tuple structs with validation constructors for newtypes (e.g., struct UserId(String))

Rust: Include tests inline with #[cfg(test)] modules

Rust: Documentation is required for all public APIs

Rust: Run cargo clippy --all-targets -- -D warnings pre-commit; no warnings allowed

Files:

  • apps/framework-cli/tests/cli_init.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
Prefer top-of-file use statements over inline ones in function bodies; add use imports for fully-qualified paths; local use for disambiguation (e.g., name collisions) is fine
Write meaningful names for functions, variables, and types
Keep functions focused and modular
Document all public APIs and breaking changes
Use thiserror crate for error handling instead of anyhow::Result
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error structs
Structure error types as: context struct + error enum + #[source] chaining
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 crates to reduce boilerplate in newtype definitions
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases in unit and integration tests

Files:

  • apps/framework-cli/tests/cli_init.rs
apps/framework-cli/**/tests/**/*.rs

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

Use integration tests for CLI commands

Files:

  • apps/framework-cli/tests/cli_init.rs
🧠 Learnings (16)
📓 Common learnings
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4041
File: apps/framework-cli/src/cli/logger.rs:490-494
Timestamp: 2026-04-23T01:59:31.717Z
Learning: In 514-labs/moosestack `apps/framework-cli/src/cli/logger.rs`, recursive `sweep_logs` for nested `log_file_date_format` paths (containing `/`) was explicitly considered and rejected as scope creep in PR `#4041`. The PR's intended fix is only `create_dir_all(parent)` in `open_log_writer` to prevent panics when `~/.moose/` vanishes mid-run. If nested date-format paths are ever supported, the correct approach is config-load validation (reject `/` in `log_file_date_format`), not recursive log cleanup. Do not flag absence of recursive cleanup as a bug in this or similar PRs.
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:596-598
Timestamp: 2026-03-24T19:10:26.494Z
Learning: Repo 514-labs/moosestack — Moose CLI: Row policies always reference existing tables. apps/framework-cli/src/framework/core/plan_validator.rs::validate_row_policy_columns rejects policies whose tables are missing or columns don’t exist. Therefore, InfrastructureMap::uses_olap() not checking select_row_policies is acceptable because any map with policies will also have non-empty tables.
Learnt from: LucioFranco
Repo: 514-labs/moosestack PR: 3932
File: apps/framework-cli/src/cli.rs:0-0
Timestamp: 2026-04-10T14:30:34.800Z
Learning: In 514-labs/moosestack, `moose clean` calling `shutdown_embedded_servers()` in `apps/framework-cli/src/cli.rs` only closes in-memory handles in the current process. It cannot stop embedded servers (devredis, devkafka, ClickHouse/Temporal) owned by a separate `moose dev --alpha` process. Cross-process cleanup via PID files or a control socket is a known architectural gap shared across all embedded servers, intentionally deferred and out of scope for individual feature PRs. Do not flag this as a bug requiring immediate fix.
Learnt from: okane16
Repo: 514-labs/moosestack PR: 0
File: :0-0
Timestamp: 2026-04-21T22:20:46.234Z
Learning: In 514-labs/moosestack PR `#4032`, the cutover that removes legacy migrate/olap pages, moves `olap/schema-versioning` to top-level, rewrites cross-refs, and adds redirects is intentionally deferred to a separate follow-up PR. This will land only after `features.migrate_with_deltas` flips to default post-beta. Do not raise concerns about missing redirects, legacy page removal, schema-versioning relocation, or cross-ref rewrites in PR `#4032` or similar additive-only delta-migration PRs.
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.
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:50.188Z
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: cjus
Repo: 514-labs/moosestack PR: 3684
File: apps/framework-cli/src/framework/core/infrastructure_map.rs:0-0
Timestamp: 2026-03-04T22:31:33.997Z
Learning: Repo 514-labs/moosestack — In apps/framework-cli/src/framework/core/infrastructure_map.rs, InfrastructureMap::to_proto serializes select_row_policies and InfrastructureMap::from_proto deserializes them back into the map. Proto/Redis round-trips now preserve row policies; do not flag select_row_policies as being dropped on load in future reviews.
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-08T22:31:22.237Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): When implementing raw output mode (--raw flag), public entry points (show_toc, fetch_page, search_toc, browse_docs) must return an empty Message (Message::new("".to_string(), "".to_string())) to prevent success messages from polluting piped output. Additionally, wrap show_message! calls in `if !raw` guards to keep intermediate messages from appearing in piped output.
Learnt from: phiSgr
Repo: 514-labs/moosestack PR: 3930
File: apps/framework-cli/src/cli/local_webserver.rs:3524-3535
Timestamp: 2026-04-08T00:08:36.251Z
Learning: In 514-labs/moosestack, the `/admin/inframap` and related `/admin/*` endpoints (e.g., `/admin/plan`, `/admin/integrate-changes`, `/admin/reality-check`) in `apps/framework-cli/src/cli/local_webserver.rs` are internal CLI-to-server communication endpoints. They are consumed programmatically by CLI routines (e.g., migration, remote-plan), not by end users. Do not flag missing framework-docs-v2 documentation for changes to these admin endpoints — the coding guideline requiring docs updates applies only to user-facing APIs, commands, flags, and configs.
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/typescript-empty/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:39.081Z
Learning: Prefer MooseDev MCP tools over CLI commands — they return structured, token-optimized output
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: templates/python-webapp/AGENTS.md:0-0
Timestamp: 2026-03-31T03:46:07.879Z
Learning: Use `moose --help`, `moose docs`, `moose query`, `moose ls`, `moose peek`, and `moose logs` CLI commands for context and debugging
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-09T21:19:28.424Z
Learning: When changing MooseStack functionality, ALWAYS run end-to-end tests
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:24:02.413Z
Learning: Always run end-to-end tests when changing MooseStack functionality
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:24:02.413Z
Learning: When changing user-facing features, add E2E tests to `python-tests` and `typescript-tests` templates and audit documentation
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:24:02.413Z
Learning: Always format the code
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:24:02.413Z
Learning: When working with MooseStack ClickHouse schemas, queries, or configurations, reference the `moosestack-clickhouse-best-practices` skill for rules on schema design, query optimization, and insert strategy
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:24:02.413Z
Learning: Promote flag-first `moose init` style in documentation and examples: `moose init --name <name> --template <template>`; treat legacy positional form as backward-compatible only
Learnt from: CR
Repo: 514-labs/moosestack

Timestamp: 2026-04-30T14:24:02.413Z
Learning: For `moose dev --dockerless`, show this option when the Docker runtime is unavailable; do not suggest it for unrelated infrastructure failures
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases in unit and integration tests

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/tests/**/*.rs : Use integration tests for CLI commands

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-06T01:42:40.104Z
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:40.104Z
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/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-02-08T22:31:22.237Z
Learnt from: oatsandsugar
Repo: 514-labs/moosestack PR: 3468
File: apps/framework-cli/src/cli/routines/docs.rs:0-0
Timestamp: 2026-02-08T22:31:22.237Z
Learning: In apps/framework-cli/src/cli/routines/**/*.rs (Moose CLI): When implementing raw output mode (--raw flag), public entry points (show_toc, fetch_page, search_toc, browse_docs) must return an empty Message (Message::new("".to_string(), "".to_string())) to prevent success messages from polluting piped output. Additionally, wrap show_message! calls in `if !raw` guards to keep intermediate messages from appearing in piped output.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-23T01:59:31.717Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4041
File: apps/framework-cli/src/cli/logger.rs:490-494
Timestamp: 2026-04-23T01:59:31.717Z
Learning: In 514-labs/moosestack `apps/framework-cli/src/cli/logger.rs`, recursive `sweep_logs` for nested `log_file_date_format` paths (containing `/`) was explicitly considered and rejected as scope creep in PR `#4041`. The PR's intended fix is only `create_dir_all(parent)` in `open_log_writer` to prevent panics when `~/.moose/` vanishes mid-run. If nested date-format paths are ever supported, the correct approach is config-load validation (reject `/` in `log_file_date_format`), not recursive log cleanup. Do not flag absence of recursive cleanup as a bug in this or similar PRs.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-18T22:43:44.130Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 4024
File: apps/framework-cli/src/utilities/native_infra/preflight.rs:53-95
Timestamp: 2026-04-18T22:43:44.130Z
Learning: In `apps/framework-cli/src/utilities/native_infra/preflight.rs` (`PortConflictError::fmt`), `same_project_instance` uses `.any(|c| c.owner_pid.is_some())` intentionally. Only ClickHouse and Temporal write PID files; devredis, devkafka, http, management, and proxy_port ports are never attributed. Switching to `.all()` makes the check structurally unachievable for any realistic conflict set, causing the "another moose project" footer to always render even when attributed PIDs are present — a self-contradictory message. Do not suggest changing `.any()` to `.all()` here.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Write meaningful names for functions, variables, and types

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Prefer top-of-file `use` statements over inline ones in function bodies; add `use` imports for fully-qualified paths; local `use` for disambiguation (e.g., name collisions) is fine

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `rustfmt --edition 2021` for consistent formatting

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-04-22T18:10:52.989Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2026-04-22T18:10:52.989Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `UPPER_SNAKE_CASE` naming for constants

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-04T22:29:17.086Z
Learnt from: cjus
Repo: 514-labs/moosestack PR: 3684
File: apps/framework-cli/src/framework/core/execute.rs:130-136
Timestamp: 2026-03-04T22:29:17.086Z
Learning: In apps/framework-cli/src/framework/core/plan_validator.rs, `validate_row_policy_columns` enforces at build time that no two SelectRowPolicy instances on the same column have conflicting JWT claim mappings. This means the `row_policies_config` HashMap construction in `execute_initial_infra_change` (execute.rs) cannot silently overwrite conflicting claims — the plan would have already been rejected. Do not flag the collect() as a silent-duplicate risk.

Applied to files:

  • apps/framework-cli/tests/cli_init.rs
📚 Learning: 2026-03-24T19:13:18.829Z
Learnt from: DatGuyJonathan
Repo: 514-labs/moosestack PR: 3830
File: apps/framework-cli/src/cli/routines/migrate.rs:363-366
Timestamp: 2026-03-24T19:13:18.829Z
Learning: In `apps/framework-cli/src/cli/routines/migrate.rs`, the `CreateRowPolicy`/`DropRowPolicy` branches in `validate_table_databases_and_clusters` (which skip cluster validation) are intentionally covered by E2E tests in `apps/framework-cli-e2e/test/row-level-security.test.ts` rather than by dedicated unit tests in `migrate.rs`. Do not request additional unit tests for these branches.

Applied to files:

  • apps/framework-cli/tests/cli_init.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/tests/cli_init.rs
🔇 Additional comments (3)
apps/framework-cli/tests/cli_init.rs (3)

103-107: Help output assertions match the flag-first direction.

Good checks for hiding legacy positional template markers and surfacing preferred flag-based examples.


114-139: Flag-based init happy-path coverage looks solid.

This directly exercises --name + --template and verifies generated artifacts.


168-201: Conflict regression coverage for --template and --name is well scoped.

These tests pin the mutual-exclusion behavior and assert the relevant flag appears in the error.

Comment thread apps/framework-cli/tests/cli_init.rs
Comment thread apps/framework-cli/tests/cli_init.rs
@blacksmith-sh

This comment has been minimized.

- Assert app/ and moose.config.toml on equals-template success path
- Assert no scaffold artifacts after unknown-template failure

Addresses CodeRabbit feedback on PR #4063.

Made-with: Cursor
@okane16
okane16 added this pull request to the merge queue May 1, 2026
Merged via the queue into main with commit ea2c68e May 1, 2026
78 checks passed
@okane16
okane16 deleted the feature/514-1408-moose-init-template-failures branch May 1, 2026 03:28
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