M0.1: Cargo workspace with layered crates

Edition 2024 workspace with the crates from docs/architecture.md, each
declaring its layer in package.metadata.lutra. Records the M0 architecture
decisions (highlighting, Git library, terminal, text buffer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-13 20:24:06 +02:00
parent 1fc46daa8e
commit b10a2a72f9
31 changed files with 421 additions and 9 deletions

17
crates/control/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-control"
description = "JSON-lines control channel"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 5
[dependencies]
[lints]
workspace = true

View file

@ -0,0 +1,4 @@
//! Control channel of Lutra (layer L5).
//!
//! Serves JSON lines on a local TCP port so that scripts and agents can run
//! engine commands and inspect the user interface.

17
crates/engine/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-engine"
description = "Command registry, workspace state, guard and recovery journal"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 4
[dependencies]
[lints]
workspace = true

4
crates/engine/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
//! Engine of Lutra (layer L4).
//!
//! Owns the command registry, the workspace state, the panic guard around every
//! entry point and the crash-recovery journal.

17
crates/index/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-index"
description = "Symbol index and usages"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 2
[dependencies]
[lints]
workspace = true

4
crates/index/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
//! Symbol index for Lutra (layer L2).
//!
//! Stores declarations and usages for go-to and find-usages, starting with
//! symbols extracted from tree-sitter trees.

17
crates/lsp/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-lsp"
description = "Language server client (Phpactor first), later a DAP client"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 3
[dependencies]
[lints]
workspace = true

4
crates/lsp/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
//! Language server client for Lutra (layer L3).
//!
//! Speaks the Language Server Protocol to external servers (Phpactor first)
//! and, later, the Debug Adapter Protocol. Server messages are untrusted input.

17
crates/mcp/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-mcp"
description = "MCP server over stdio"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 5
[dependencies]
[lints]
workspace = true

3
crates/mcp/src/lib.rs Normal file
View file

@ -0,0 +1,3 @@
//! MCP server of Lutra (layer L5).
//!
//! Exposes the engine commands as Model Context Protocol tools over stdio.

17
crates/search/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-search"
description = "Find in files"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 2
[dependencies]
[lints]
workspace = true

4
crates/search/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
//! Find in files for Lutra (layer L2).
//!
//! Streams matches from the project files off the UI thread, honouring the
//! ignore rules of the project model.

17
crates/syntax/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-syntax"
description = "tree-sitter parsing, outlines and highlight tokens"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 1
[dependencies]
[lints]
workspace = true

4
crates/syntax/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
//! Syntax layer for Lutra (layer L1).
//!
//! Parses source files with tree-sitter (PHP first) and derives outlines,
//! folding ranges and highlight tokens from the syntax tree.

View file

@ -0,0 +1,17 @@
[package]
name = "lutra-terminal"
description = "Pseudo-terminal sessions for the integrated terminal"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 3
[dependencies]
[lints]
workspace = true

View file

@ -0,0 +1,4 @@
//! Integrated terminal sessions for Lutra (layer L3).
//!
//! Spawns shells in pseudo-terminals and streams their output to the frontend,
//! where xterm.js renders it.

17
crates/testkit/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-testkit"
description = "Test helpers and fixtures, used by tests only"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = "tool"
[dependencies]
[lints]
workspace = true

View file

@ -0,0 +1,3 @@
//! Test helpers and fixtures for Lutra crates.
//!
//! Used only as a dev-dependency; never part of a shipped binary.

17
crates/text/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-text"
description = "Rope text buffer, positions, UTF-8/UTF-16 conversion and edits"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 0
[dependencies]
[lints]
workspace = true

5
crates/text/src/lib.rs Normal file
View file

@ -0,0 +1,5 @@
//! Text model for Lutra (layer L0).
//!
//! Holds the rope buffer, line and column positions, UTF-8/UTF-16 offset
//! conversion and edit application. Every other crate converts text offsets
//! through this crate instead of slicing strings by hand.

17
crates/vfs/Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "lutra-vfs"
description = "Project model, file watching, ignore rules and encodings"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
publish.workspace = true
[package.metadata.lutra]
layer = 2
[dependencies]
[lints]
workspace = true

4
crates/vfs/src/lib.rs Normal file
View file

@ -0,0 +1,4 @@
//! Virtual file system for Lutra (layer L2).
//!
//! Models an open project: its roots, ignore rules, file watching and text
//! encodings. File contents read here are untrusted input.