Skip to content

Foundation Reset - Unified Core Infrastructure - #36

Merged
luishrosello merged 22 commits into
m1-core-filesystem-logicfrom
main
Feb 18, 2026
Merged

luishrosello merged 22 commits into
m1-core-filesystem-logicfrom
main

Conversation

@luishrosello

Copy link
Copy Markdown
Member

Este Pull Request consolida la infraestructura base de Mod0, integrando los núcleos de Filesystem, AI Bridge y UI Shell. Aunque la rama original era core-filesystem-logic, se ha extendido para implementar los cimientos de los módulos M1, M3, M5 y M6, permitiendo una transición limpia hacia la nueva arquitectura de Micro-Kernel y Dynamic Shell.

Este commit sirve como "checkpoint" final antes de la reorganización total del espacio de trabajo hacia el paradigma agéntico y agnóstico.

Key Accomplishments

  • Kernel (Rust): Implementación de spawners para procesos LSP/MCP y lector de directorios asíncrono.
  • AI Bridge: Estructura inicial del cliente agnóstico con soporte para SSE (Server-Sent Events) y protocolo de host MCP.
  • Editor & UI: Gestión de buffers de estado, sistema de búsqueda Fuzzy para el Command Palette y base del File Tree en Svelte 5.
  • System: Integración de Custom TitleBar y controles nativos en Tauri v2.

🛠️ Linked Issues (Closing 12 Tasks)

M1: Code Editor & FS
Fixes #5, Fixes #6, Fixes #8, Fixes #9, Fixes #10, Fixes #13

M3: AI Bridge & MCP
Fixes #19, Fixes #20, Fixes #21, Fixes #22

M5 & M6: Refining & Styling
Fixes #30, Fixes #35


📂 Summary of Changes

Component Scope Status
Rust Kernel LSP Spawner, FS Reader, MCP Host Ready
AI Bridge SSE Parser, Agnostic Client Ready
Svelte UI Runes-based File Tree, Command Palette Ready
Storage SQLite Vector Indexing base Ready
Desktop Native Controls Overlay Ready

Developer Note

Se ha decidido cerrar estos issues de forma masiva para resetear el backlog. El código incluido aquí establece los protocolos de comunicación básicos que serán refactorizados bajo la nueva arquitectura de Slots y Registry planteada.

…holders

Moved core runes, constants, and types into `src/lib/core/` to improve project
organization and separation of concerns. Feature-specific runes and components
(e.g., settings, ModeSelector) have been relocated to `src/lib/features/`.

All affected import paths in layout components (`ActivityBar`, `Footer`,
`Header`, `Sidebar`, `TitleBar`, etc.) have been updated to reflect the new
directory structure.

Additionally, an initial set of empty common UI components (e.g., Badge, Card,
Dialog, Dropdown, Menu, Popover, Tooltip, FloatingPanel, Modal, Overlay, Portal)
has been added under `src/lib/components/common/`. This prepares the foundation
for a consistent and reusable UI component library.
Introduces a suite of core common UI components including Badge, Card, Dialog,
Dropdown, FloatingPanel, Fieldset, Input, Modal, Sidebar, Tab, Tabs, and Toggle.

These components provide reusable building blocks for the application's user
interface, promoting consistency, reusability, and accelerating future UI
development.
This commit introduces a suite of GitHub Actions to establish robust CI/CD practices for the project.

Key workflows added:
- dependabot.yml: Configures Dependabot for automated weekly dependency updates for npm and Cargo, enhancing project security and maintainability.
- check.yml: Implements code quality checks on pull requests, including frontend linting/checking and Rust formatting (`fmt`) and linting (`clippy`) to maintain code standards.
- codeql.yml: Sets up comprehensive security analysis via CodeQL for JavaScript/TypeScript and Rust, running on pushes, pull requests, and a weekly schedule to identify vulnerabilities early.
- release.yml: Automates multi-platform build and release process for Tauri, generating macOS, Ubuntu, and Windows artifacts upon new tags or pushes to 'main', streamlining release management and distribution.
This commit introduces custom window controls (minimize, maximize, close) to the
application header, enhancing the native look and feel. The window is now
draggable via the header element.

Key changes include:
*   **Window Management:**
    *   Integrated `@tauri-apps/plugin-window-state` to persist and restore
        window size and position across sessions, improving user experience.
    *   Added minimize, maximize, and close buttons that interact with the
        Tauri window API.
    *   Enabled window dragging by setting `-webkit-app-region: drag` on the
        header, with `-webkit-app-region: no-drag` for interactive elements.
    *   Integrated `@tauri-apps/plugin-os` for potential future OS-specific
        functionalities.
*   **Project Configuration:**
    *   Updated the project license from MIT to Apache-2.0.
    *   Added a `lint` script to `package.json` for code quality checks
        using Prettier and ESLint.
*   **Dependencies:**
    *   Updated `package.json`, `package-lock.json`, `Cargo.toml`, and
        `Cargo.lock` to include new Tauri plugins.
*   **Refactoring:**
    *   Adjusted `Sidebar.svelte` to use dynamic imports for sidebar
        components, enabling potential lazy loading.
Refactor the Omnibar component to transform it into a full-featured command palette.
This change introduces a dynamic trigger button that opens an animated floating
panel, consolidating various workbench interactions into a single interface.

The new command palette provides:
- A centralized hub for executing commands, selecting themes, and switching modes.
- Integrated search functionality for efficient filtering of options.
- Multi-step opening animations and glint effects for an enhanced user experience.
- Integration of new `FloatingPanel` and `ThemeSelector` components.

Header layout was also adjusted, reducing spacing between elements and removing
the previous explicit width wrapper for the Omnibar to accommodate its new trigger
button form.
Adds empty 'en.json' and 'es.json' files to the 'src/lib/core/i18n/locales/'
directory. This change establishes the foundational structure for future
internationalization (i18n) support, preparing the application to handle
multiple languages, specifically English and Spanish.
Introduce the `tauri-plugin-dialog` to enable native file system dialogs. This commit adds core functionality for interacting with the file system from the frontend.

- **Backend (Rust):**
    - Integrated `tauri-plugin-dialog` and enabled necessary features.
    - Exposed new commands (`read_folder`, `read_file_content`, `save_file`) for file system operations.
- **Frontend (Svelte/TypeScript):**
    - Added `@tauri-apps/plugin-dialog` dependency.
    - Created `filesystem-service.ts` to wrap Tauri file system commands.
    - Developed `filesystem.svelte.ts` rune for managing file system state, allowing folder browsing, opening files into tabs, and saving content, file open works, folder open doesnt and save file still untested.
    - Updated `tabs.svelte.ts` to support associating icons with tabs for better visual context.
- **Refactor:**
    - Renamed `work-runes.svelte` to `work-modes.svelte` for improved naming consistency.
This commit introduces a comprehensive file explorer with tab management for code and assets, alongside significant build optimizations for the Tauri application.

- build: Configured `Cargo.toml` with an optimized release profile (`opt-level=3`, `lto=true`, `strip=true`, `panic=abort`) to reduce binary size and improve application performance.
- refactor(core):
    - Renamed `read_folder_logic` to `read_folder` in `filesystem.rs` for improved clarity and consistency.
    - Moved folder filtering logic (e.g., `node_modules`, `.git`, `target`) from the backend Rust command to the frontend `FileExplorerService`, allowing for more flexible client-side control.
- feat(core): Added new placeholder modules for `ia-model`, `lsp`, `mcp`, and `sandbox` commands, preparing the backend for future feature integrations.
- feat(ui):
    - Implemented a robust client-side `FileExplorerService` for recursive directory reading, dynamic node processing, and sorting.
    - Developed a new `tabsStack` store to manage multiple open files (code and assets) in an intuitive tabbed interface.
    - Created `FSService` to streamline interactions between the frontend and Tauri's filesystem commands (`readDir`, `readFile`, `saveFile`).
    - Integrated the new file explorer and tab system into the main application UI (`FileExplorer.svelte`, `+page.svelte`), enabling users to browse project structures and open files seamlessly.
    - Introduced new type definitions (`file.ts`) for file nodes, code tabs, and asset tabs to enhance type safety and code structure.
- ci: Renamed the GitHub Actions workflow from "MOD0 Build System" to "Build & Release" in `release.yml` for clearer intent.
This commit introduces the foundational database schema and the corresponding data persistence layer using `sqlx`.

Key changes include:
*   **Database Schema**: Defined the initial set of tables (`projects`, `agent_sessions`, `thought_nodes`, `execution_tasks`, `chat_history`) in a new migration file (`src-tauri/migrations/20240726154030_initial_schema.sql`). These tables are crucial for storing application state, agent workflow data, and user interactions.
*   **Database Manager**: Implemented `DbManager` in `src-tauri/src/database/mod.rs` to handle database connection pooling and setup using `sqlx::SqlitePool`.
*   **ORM Layer**: Began developing `repository` and `models` modules for structured data access patterns.
*   **Dependencies**: Added `sqlx` and related crates (e.g., `allocator-api2`, `atoi`, `base64ct`, `chrono`, `const-oid`, `crc`, `crc-catalog`) to `Cargo.lock` to support asynchronous database operations.

This establishes the necessary infrastructure for persistent storage, enabling future features that require saving and retrieving application data and managing complex agent workflows.
This commit significantly refactors the filesystem command handling by introducing a new `services/filesystem` module. It centralizes file operations, tree scanning, and implements robust search capabilities.

Key changes include:
-   **Refactor filesystem commands:** Moved core logic (file tree scanning, read/write) from `src-tauri/src/commands/filesystem.rs` to dedicated service modules (`scanner.rs`, `operations.rs`).
-   **Background Indexing Worker:** Implemented an asynchronous worker (`worker.rs`) using `tokio::mpsc` for efficient, non-blocking indexing of file content. This ensures UI responsiveness during heavy I/O.
-   **New File Operations:** Added commands for creating, deleting, and renaming files and directories, delegating to `operations.rs`.
-   **Global Search:** Introduced `global_search` and `quick_open` commands powered by a new `SearchService` (`search.rs`), enabling full-text search (FTS5) and rapid filename lookup.
-   **Improved Modularity:** The `FileNode` struct is now defined in `nodes.rs`, improving code organization.
-   `main.rs` was updated to register the new commands, initialize the database manager and indexing sender as Tauri states, and start the indexing worker.

This refactoring aims to improve modularity, enable scalable background processing for file system events, and provide powerful search functionalities to the application.
This commit introduces the initial implementation of the Language Server Protocol (LSP) manager and registry.

The `LspManager` is responsible for:
- Spawning and managing LSP server processes for different languages.
- Handling `ProtocolTransport` instances for communication with LSP servers.
- Ensuring only one LSP server is spawned per language.

The `LspDefinition` registry:
- Provides a centralized way to define LSP server configurations (command, arguments, transport type) for various languages.
- Currently supports `rust-analyzer` for Rust and `taplo` for TOML.

This lays the foundation for integrating advanced language features like autocompletion, diagnostics, and code navigation into Mod0.

Changes include:
- Added `src-tauri/src/services/bridge/capabilities/lsp/manager.rs` for `LspManager`.
- Added `src-tauri/src/services/bridge/capabilities/lsp/registry.rs` for `LspDefinition`.
- Updated `src-tauri/Cargo.lock` and `src-tauri/Cargo.toml` to include new dependencies like `ignore`, `globset`, `crossbeam-deque`, `crossbeam-epoch`, and `bstr` required for LSP integration.
- Integrated `LspManager` into `src-tauri/src/services/bridge/capabilities/lsp/mod.rs` for easier access.
This commit introduces the foundational file system (FS) kernel module, now located at `src-tauri/src/kernel/fs`.

Key components include:
*   **Kernel Module (`src-tauri/src/kernel/fs`)**: Defines `FileNode` and `FileCategory` for file representation, provides essential CRUD operations (read, save, create, delete, rename) with integrated indexing task notifications, and implements a recursive directory scanner supporting `.gitignore` and `.scanignore`. The module path was refactored from `src-tauri/src/kernel/filesystem` to `src-tauri/src/kernel/fs` for conciseness.
*   **Tauri Commands (`src-tauri/src/commands/fs.rs`)**: Exposes the kernel's FS operations and search functionalities (e.g., `get_file_tree`, `read_file`, `global_search`, `quick_open`) as asynchronous Tauri commands for frontend consumption.
*   **Frontend Service (`src/lib/core/services/fs-service.ts`)**: Provides a high-level TypeScript API to interact with the new Tauri FS commands, simplifying file and directory management from the UI.

This module establishes the core logic for interacting with, managing, and categorizing project files, which is crucial for subsequent features like file browsing, search, and content indexing.
This commit introduces a major reorganization of the project's file structure and lays the groundwork for Language Server Protocol (LSP) integration.

**Changes:**
- **Core Services:** Introduced `src/lib/core` to house foundational services such as `ai-service`, `lsp-service`, `mcp-service`, `vcs-service`, along with internationalization utilities (`i18n`) and theme registry.
- **System Atoms:** Consolidated various UI components and atomic features into `src/lib/features/system-atoms` for better organization and reuse.
- **Tauri Commands:** Renamed `src-tauri/src/commands/ia_model.rs` to `src-tauri/src/commands/ai.rs` for clearer semantic meaning. Associated Svelte components were also moved to be part of the core commands in Tauri.
- **LSP Integration:** Added `src/lib/features/editor/editor-lsp.ts` to implement the Language Server Protocol client, facilitating communication with backend language servers via the Tauri bridge.

**Why these changes:**
This refactor aims to improve modularity, maintainability, and extensibility by providing a clearer separation of concerns. It sets a robust foundation for future development, including enhanced editor capabilities through LSP and a more organized project layout for core functionalities, UI components, and backend commands.
…sions

Refactor `Extensions` to `Plugins` across constants, sidebar components, and UI labels to align with the evolving plugin architecture and clarify the scope to include MCP servers.

Introduce a dedicated `SettingsService` to encapsulate configuration management and improve modularity.

This commit also introduces new features:
-   Added an `auto_save` setting to automatically persist changes.
-   Implemented logic to automatically restore the last opened workspace path on application startup, enhancing user convenience.
-   Updated the default application theme from 'light' to 'dark'.
-   Removed the generic `TAURI_COMMANDS` constant by integrating command definitions directly into their respective service files.
This commit establishes the foundational database schema and initial persistence layer for the application using `sqlx`.

A new migration (`init.sql`) defines core tables:
- `file_index` for full-text search capabilities
- `file_metadata` to store properties of tracked files
- `editor_state` to persist user workspace layouts and open tabs
- `project` for managing project-specific settings
- `skill` to store AI agent capabilities
- `session` to track user and agent interactions
- `chat_history` and `terminal_history` for recording conversational and command-line actions
- `thought_node` to represent AI agent reasoning structures.

The `src-tauri/src/database` module is introduced to manage SQLite connections, run migrations on startup, and provide a repository pattern for data access. Initial repositories for `Skill` and `History` entities are implemented, demonstrating basic CRUD and querying.

Additionally, the `.sqlx` directory is added to `.gitignore` to prevent generated artifacts from being committed.
This commit introduces comprehensive multi-project support for file indexing and refactors the file watching mechanism.

The indexing system now differentiates files by `project_id`, enabling separate management of indexed content for multiple projects. `FileIndex` entries in the database include a `project_id`, and indexing/removal tasks (`IndexingTask`) now explicitly pass `project_path` to ensure operations are project-scoped.

File system watching has been significantly improved by introducing a `WatchDebouncer` and `Watches` manager. This debounces file system events per project, enhancing performance and preventing excessive re-indexing or processing of rapid file changes.

New Tauri commands have been added to facilitate project-specific file management:
- `watch_project_files`: Starts watching a specified project's files.
- `unwatch_project_files`: Stops watching a specified project's files.
- `get_file_indexed_paths`: Retrieves paths of files indexed for a given project.
- `clear_index_for_project`: Clears all indexed files for a given project.

`Cargo.lock` has been updated to reflect new dependencies required for these enhanced features.
Introduces a new `registry` module within the `bridge` services to manage and define runtime environments for various tools.

This commit adds:
- A new `registry` module in `src-tauri/src/services/bridge/mod.rs`.
- `catalog.rs` for `ToolCatalog` to load, store, and validate tool definitions from an internal TOML file.
- `defs.rs` to define the structure for `RuntimeDefinition`, `ToolDefinition`, `EnvironmentDefinition`, and `CommandDefinition`.
- `init.rs` to provide initialization logic for the registry.
- `mod.rs` to expose the registry components.
- `catalog.toml` which will contain the actual tool definitions.

The `ToolCatalog` is designed to map file extensions and signatures to specific runtime definitions, enabling automatic detection and execution of tools. This lays the groundwork for dynamic tool management and execution within the application.

A significant number of dependencies have been updated or added in `Cargo.lock` to support the new `tomllib` crate and other potential transitive requirements.
This commit introduces support for various programming languages in the editor by adding new CodeMirror language packages.

The `package-lock.json` has been updated to include:
- `@codemirror/language-data`
- `@codemirror/lang-angular`
- `@codemirror/lang-cpp`
- `@codemirror/lang-css`
- `@codemirror/lang-go`
- `@codemirror/lang-html`
- `@codemirror/lang-java`

Additionally, the `src/lib/features/system-atoms/pulse/core/languages.ts` file has been modified to:
- Extend the `EditorLanguage` type to include new languages such as `ruby`, `c++`, `java`, `html`, `css`, `yaml`, `txt`, and `toml`.
- Update the `LANGUAGE_MAP` to associate file extensions (`rb`, `cpp`, `hpp`, `java`, `html`, `css`, `yaml`, `txt`, `toml`, `other`) with their corresponding `EditorLanguage` values.

This enhancement significantly improves the editor's functionality by allowing it to provide syntax highlighting and other language-specific features for a broader range of file types.
@luishrosello luishrosello added this to the M1 Code Editor milestone Feb 18, 2026
@luishrosello luishrosello self-assigned this Feb 18, 2026
@github-advanced-security

Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@luishrosello
luishrosello merged commit ed7dfa9 into m1-core-filesystem-logic Feb 18, 2026
5 of 13 checks passed
luishrosello added a commit that referenced this pull request Feb 18, 2026
refactor: Core Architecture Reset & Unified Foundation

This commit represents a complete re-architecture of the project, establishing 
the "DevOS" foundational layer. It consolidates multiple development 
milestones into a clean, unified codebase, transitioning from a static 
prototype to a capability-driven shell.

Key Pillars Integrated:

1. [KERNEL & FS]
- Implemented a robust Rust-based Filesystem API with recursive scanning.
- Introduced background indexing with SQLite (FTS5) and multi-project support.
- Added file system debounced watching and global search capabilities.
- Integrated tauri-plugin-dialog for native OS interactions.

2. [BRIDGE & CAPABILITIES]
- Introduced the Runtime Definition Registry for agnostic tool management.
- Implemented LspManager for server process orchestration (Rust-analyzer/Taplo).
- Established the AI Bridge with SSE Stream parsing and MCP host protocol support.
- Unified command routing through a centralized Bridge Service.

3. [SHELL & UI SYSTEM]
- Rearchitected frontend using Svelte 5 (Runes) for ultra-low latency.
- Implemented a comprehensive Common UI library (Badge, Card, Dialog, Tabs, etc.).
- Introduced the "Omnibar" Command Palette with fuzzy search and theme support.
- Added custom window controls, draggable regions, and state persistence.
- Implemented the core File Explorer with tab management for code and assets.

4. [DATA & PERSISTENCE]
- Initialized core database schema using SQLX (Projects, Sessions, Skills, History).
- Established the repository pattern for structured data access.
- Implemented state persistence for editor buffers and workspace layouts.

5. [CI/CD & STANDARDS]
- Added GitHub Actions for multi-platform releases, linting, and security (CodeQL).
- Updated project licensing to Apache-2.0.
- Standardized i18n structure for English and Spanish support.

Fixes #5, Fixes #6, Fixes #8, Fixes #9, Fixes #10, Fixes #13, 
Fixes #19, Fixes #20, Fixes #21, Fixes #22, Fixes #30, Fixes #35
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