Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ Type `@` anywhere in your input (after a space or at position 0) to trigger file

```
explain @src/MandoCode/Services/AIService.cs to me
what does the ProcessFileReferences method do in @src/MandoCode/Components/App.razor
what does the ProcessFileReferences method do in @src/MandoCode/Components/Shell/App.razor
refactor @src/MandoCode/Models/LoadingMessages.cs to use fewer spinners
```

Expand Down Expand Up @@ -892,7 +892,7 @@ This simulation replaces the package update command, verifies the helper waits f

```
src/MandoCode/
Components/ Razor UI (App, Banner, HelpDisplay, ConfigMenu, Prompt)
Components/ Razor UI grouped by feature (see Components/README.md)
Services/ Core logic (AI, markdown, syntax, tokens, music, diffs, input state machine)
Models/ Data models, config, system prompts, educational content
Plugins/ Tool classes bound as AIFunctions (FileSystem, WebSearch, Planning, Skills)
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to MandoCode will be documented in this file.

## [Unreleased]

### Changed

- Group CLI components into feature folders for shell, workspaces, conversations, input, project browsing, sessions, settings, onboarding, and activity. Keep component namespaces and behavior unchanged, and document where new components belong.

## [0.16.1] - 2026-10-21

**Startup and component stability.** The chat prompt now waits for model validation and MCP initialization to finish. Prompt state changes run together on the UI dispatcher, and agents closed during startup cannot start an input loop afterward. RazorConsole remains at 0.6.0.
Expand Down
4 changes: 2 additions & 2 deletions docs/cli-maintainability.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CLI maintenance boundaries

The CLI is composed from Razor components. `App.razor` retains layout and coordinating state; its partial class files group commands, planning, attachments, integrations, request processing, lifecycle, and terminal effects. Partial files share component state and are not independent services. Extract reusable operations into services rather than adding unrelated responsibilities to these files.
The CLI is composed from Razor components grouped by feature under `src/MandoCode/Components/`; see the [component folder guide](../src/MandoCode/Components/README.md). Explicit `@namespace MandoCode.Components` declarations preserve component type names after moving files. `Components/Shell/App.razor` retains layout and coordinating state; its partial class files group commands, planning, attachments, integrations, request processing, lifecycle, and terminal effects. Partial files share component state and are not independent services. Extract reusable operations into services rather than adding unrelated responsibilities to these files.

## State and input

Expand All @@ -10,7 +10,7 @@ The CLI is composed from Razor components. `App.razor` retains layout and coordi

## Agent lifetime

`App.Lifecycle.cs` resolves per-agent services from the pane scope, subscribes to events, and releases pending requests on shutdown. `CallbackRegistrations` releases a callback only if it is still owned by that registration. Event delegates must also be detached on disposal. Shared workspace services are resolved from the host; cross-agent operations resolve the target agent's scope.
`Components/Shell/App.Lifecycle.cs` resolves per-agent services from the pane scope, subscribes to events, and releases pending requests on shutdown. `CallbackRegistrations` releases a callback only if it is still owned by that registration. Event delegates must also be detached on disposal. Shared workspace services are resolved from the host; cross-agent operations resolve the target agent's scope.

## Shared engine

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using System.Text
@inject RazorConsole.Core.Rendering.ITerminalViewport Viewport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
<Panel Border="BoxBorder.Rounded" BorderColor="@(new Color(86, 182, 194))" Expand="true" Title="@Preview.Shell">
<Rows>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Services
@using MandoCode.Translators

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Models
@using MandoCode.Services
@using MandoCode.Translators
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Input
@using RazorConsole.Core.Focus
@using RazorConsole.Core.Rendering
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Services

@if (!string.IsNullOrEmpty(_display))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Models

@foreach (var opAnsi in Message.OperationAnsi)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Components
@using MandoCode.Services
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@* data-canvas opts into the widget pipeline's Spectre fallback; our middleware
supplies the cached rich renderable, including code blocks and tool results. *@
@if (Entry.Command is { } command)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@foreach (var entry in Entries)
{
<Rows @key="entry.Id">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Rendering
@inject ScrollableLayoutCoordinator LayoutCoordinator
@inject RazorConsole.Core.Focus.FocusManager Focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console.Rendering
@inject IServiceProvider Services
@implements IDisposable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Components
@using MandoCode.Services
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@* A submitted prompt is a stable transcript child, independent of the live composer. *@
<Rows>
<Box FillWidth="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Microsoft.AspNetCore.Components.Web
@using Spectre.Console
@using RazorConsole.Components
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@inject RazorConsole.Core.Rendering.ITerminalViewport Viewport

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables
@inject RazorConsole.Core.Rendering.ITerminalViewport Viewport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables
@inject RazorConsole.Core.Rendering.ITerminalViewport Viewport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@inject RazorConsole.Core.Rendering.ITerminalViewport Viewport

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console

@code {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@inject IServiceProvider Services
@using MandoCode.Models
@using MandoCode.Services
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using Spectre.Console
@using RazorConsole.Core.Input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Input
@inject RazorConsole.Core.Focus.FocusManager Focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using System.Diagnostics
@inject RazorConsole.Core.Focus.FocusManager Focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables
@inject RazorConsole.Core.Focus.FocusManager Focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@inject RazorConsole.Core.Focus.FocusManager Focus

Expand Down
21 changes: 21 additions & 0 deletions src/MandoCode/Components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# CLI components

Components are grouped by the feature they render:

| Folder | Responsibility |
| --- | --- |
| Shell | Application coordination, main chat shell, home screen, and help |
| Workspaces | Workspace tabs, picker, agent pane headers, and grid layout |
| Conversation | Transcript entries, messages, previews, and context meter |
| Input | Prompt input, autocomplete suggestions, model picker, and approval selection |
| Project | File explorer, Git changes, and directory browser |
| Sessions | Saved-agent history and context snapshots |
| Settings | Agent configuration, integrations, and MCP tools |
| Onboarding | Setup wizard and model downloads |
| Activity | Agent/command status, operation previews, music, and plan-step editing |

Each Razor component explicitly declares `@namespace MandoCode.Components`.
This matches the feature-folder convention used by Services: folders organize
source without changing public type names or component references. Keep all
`App` partial files together in Shell so their shared lifecycle state stays visible.
Shared Razor imports remain in `src/MandoCode/_Imports.razor`.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using Microsoft.Extensions.DependencyInjection
@using Microsoft.AspNetCore.Components.Web
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables
@using RazorConsole.Core.Rendering
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using RazorConsole.Core.Input
@using Spectre.Console
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Models
@using Spectre.Console
@using RazorConsole.Core.Renderables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Models
@using MandoCode.Services
@using Spectre.Console
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Models
@using Spectre.Console
@using RazorConsole.Core.Renderables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using Spectre.Console
@inject RazorConsole.Core.Focus.FocusManager Focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@inject IServiceProvider Services
@using Microsoft.Extensions.DependencyInjection
@using MandoCode.Models
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using MandoCode.Services

<RenderableContent Content="@PaneColors.Render(_art, Pane, constrainWidth: false)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console;

<AsciiArt Lines="@Artwork" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using Spectre.Console
@inject RazorConsole.Core.Rendering.ITerminalViewport Viewport
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console

@*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables

@if (Workspace.Panes.Any(p => AgentWorkspace.Column(p.Slot) == Row))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console

@if (Pane is not null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using Spectre.Console
@inject WorkspaceRegistry Registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables
@using Microsoft.Extensions.DependencyInjection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using Spectre.Console
@inject AgentWorkspace DefaultWorkspace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Renderables
@using Spectre.Console
@using Microsoft.Extensions.DependencyInjection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@using RazorConsole.Core.Renderables
@inject WorkspaceRegistry Registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using RazorConsole.Core.Input
@using Spectre.Console
@inject WorkspaceRegistry Registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@if (!Workspace.IsClosed)
{
@* grid selects the renderer's Spectre fallback, which emits zero cells when hidden. *@
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@namespace MandoCode.Components
@using Spectre.Console
@inject WorkspaceRegistry Registry

Expand Down
Loading