Skip to content

Commit f64fa8f

Browse files
Copilottikazyq
andcommitted
Implement project discovery, directory listing, and context API endpoints
- Add ProjectDiscovery to leanspec_core for filesystem scanning - Implement ignore patterns for common directories - Add POST /api/local-projects/discover endpoint - Add POST /api/local-projects/list-directory endpoint - Add GET /api/context and GET /api/context/:file endpoints - Include comprehensive tests for project discovery - Wire up all new routes in router Co-authored-by: tikazyq <[email protected]>
1 parent 643aaff commit f64fa8f

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

rust/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/leanspec-core/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ pub use types::{
4141
ValidationIssue, ValidationResult,
4242
};
4343
pub use utils::{
44-
CompleteDependencyGraph, DependencyGraph, ImpactRadius, Insights, LoadError, MetadataUpdate,
45-
SpecLoader, SpecStats, SpecWriter, TemplateError, TemplateLoader, TokenCount, TokenCounter,
46-
TokenStatus, WriteError,
44+
CompleteDependencyGraph, DependencyGraph, DiscoveredProject, DiscoveryError, ImpactRadius,
45+
Insights, LoadError, MetadataUpdate, ProjectDiscovery, SpecLoader, SpecStats, SpecWriter,
46+
TemplateError, TemplateLoader, TokenCount, TokenCounter, TokenStatus, WriteError,
4747
};
4848
pub use validators::{
4949
CompletionVerifier, FrontmatterValidator, LineCountValidator, StructureValidator,

rust/leanspec-core/src/utils/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
mod dependency_graph;
44
mod insights;
5+
mod project_discovery;
56
mod spec_loader;
67
mod spec_writer;
78
mod stats;
@@ -10,6 +11,7 @@ mod token_counter;
1011

1112
pub use dependency_graph::{CompleteDependencyGraph, DependencyGraph, ImpactRadius};
1213
pub use insights::Insights;
14+
pub use project_discovery::{DiscoveredProject, DiscoveryError, ProjectDiscovery};
1315
pub use spec_loader::{LoadError, SpecLoader};
1416
pub use spec_writer::{MetadataUpdate, SpecWriter, WriteError};
1517
pub use stats::SpecStats;

rust/leanspec-http/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ chrono.workspace = true
3838

3939
# Utilities
4040
thiserror.workspace = true
41+
walkdir.workspace = true
4142

4243
# Directories
4344
dirs = "5.0"

rust/leanspec-http/src/handlers/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
//!
33
//! Route handlers for the HTTP API.
44
5+
mod context;
56
mod health;
7+
mod local_projects;
68
mod projects;
79
mod specs;
810

11+
pub use context::*;
912
pub use health::*;
13+
pub use local_projects::*;
1014
pub use projects::*;
1115
pub use specs::*;

rust/leanspec-http/src/routes.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ pub fn create_router(state: AppState) -> Router {
7272
"/api/projects/{id}/validate",
7373
post(handlers::validate_project),
7474
)
75+
// Local project routes
76+
.route(
77+
"/api/local-projects/discover",
78+
post(handlers::discover_projects),
79+
)
80+
.route(
81+
"/api/local-projects/list-directory",
82+
post(handlers::list_directory),
83+
)
84+
// Context routes
85+
.route("/api/context", get(handlers::list_context_files))
86+
.route("/api/context/{*file}", get(handlers::get_context_file))
7587
// Spec routes
7688
.route("/api/specs", get(handlers::list_specs))
7789
.route("/api/specs/{spec}", get(handlers::get_spec))

0 commit comments

Comments
 (0)