use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct SymbolsRequest {
#[schemars(description = "File path relative to the root, e.g. 'src/main.rs'")]
pub file: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct ReferencesRequest {
#[schemars(
description = "Symbol name to locate, e.g. 'authenticate'. Give this OR at_file+at_line."
)]
pub symbol: Option<String>,
#[schemars(
description = "Directory to search, relative to the root. Omit to search everything."
)]
pub path: Option<String>,
#[schemars(
description = "With at_line: resolve the symbol AT this file/line instead of by name. \
Use when a name is ambiguous ('build', 'new') and you know where you are. \
Answers with the one symbol enclosing that line, not every symbol sharing \
its name."
)]
pub at_file: Option<String>,
#[schemars(description = "1-based line for a position-based lookup. Requires at_file.")]
pub at_line: Option<usize>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct AnalyzeRequest {
#[schemars(
description = "Directory to analyze, relative to the root. Omit for the whole root."
)]
pub path: Option<String>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct SymbolItem {
pub name: String,
pub kind: String,
pub start_line: usize,
pub end_line: usize,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct SymbolsResponse {
pub file: String,
pub count: usize,
pub symbols: Vec<SymbolItem>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct RefItem {
pub file: String,
pub name: String,
pub kind: String,
pub start_line: usize,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ReferencesResponse {
pub symbol: String,
pub count: usize,
pub definitions: Vec<RefItem>,
#[serde(skip_serializing_if = "Option::is_none")]
pub searched_symbols: Option<usize>,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct AnalyzeResponse {
pub files: usize,
pub symbols: usize,
pub tier: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct NeighborsRequest {
#[schemars(description = "Symbol name, e.g. 'authenticate'")]
pub symbol: String,
#[schemars(description = "Directory relative to the root. Omit for the whole root.")]
pub path: Option<String>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct ImpactRequest {
#[schemars(description = "Seed symbol name")]
pub symbol: String,
#[schemars(description = "Directory relative to the root. Omit for the whole root.")]
pub path: Option<String>,
#[schemars(description = "Maximum hops to follow (default 5)")]
pub hops: Option<u32>,
#[schemars(
description = "Co-changed file paths (from Bobbin) to reconcile against the structural impact"
)]
pub cochange: Option<Vec<String>>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ReachItem {
pub name: String,
pub file: String,
pub start_line: usize,
pub distance: u32,
pub via: String,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct NeighborsResponse {
pub symbol: String,
pub found: bool,
pub count: usize,
pub neighbors: Vec<ReachItem>,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ReconciliationItem {
pub corroborated: Vec<String>,
pub structural_only: Vec<String>,
pub cochange_only: Vec<String>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ImpactResponse {
pub symbol: String,
pub found: bool,
pub hops: u32,
pub count: usize,
pub reachable: Vec<ReachItem>,
pub structural_files: Vec<String>,
pub reconciliation: Option<ReconciliationItem>,
pub tier: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct CommunitiesRequest {
#[schemars(description = "Directory relative to the root. Omit for the whole root.")]
pub path: Option<String>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct CommunityMemberItem {
pub name: String,
pub kind: String,
pub file: String,
pub start_line: usize,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct CommunityItem {
pub id: usize,
pub size: usize,
pub members: Vec<CommunityMemberItem>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct CommunitiesResponse {
pub count: usize,
pub communities: Vec<CommunityItem>,
pub tier: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct DataflowRequest {
#[schemars(description = "Function name to analyze")]
pub function: String,
#[schemars(description = "Directory relative to the root. Omit for the whole root.")]
pub path: Option<String>,
#[schemars(description = "Variable to trace; omit to return all dependence edges")]
pub var: Option<String>,
#[schemars(
description = "If true, trace what the variable flows into (default: what it depends on)"
)]
pub forward: Option<bool>,
#[schemars(description = "Maximum hops to follow (default 5)")]
pub hops: Option<u32>,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct FlowStepItem {
pub name: String,
pub distance: u32,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct DepEdgeItem {
pub dependent: String,
pub depends_on: String,
pub line: usize,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct DataflowResponse {
pub function: String,
pub found: bool,
pub direction: Option<String>,
pub var: Option<String>,
pub flow: Vec<FlowStepItem>,
pub edges: Vec<DepEdgeItem>,
pub tier: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct StatusResponse {
pub base_ref: String,
pub tenant: String,
pub tiers: Vec<String>,
pub quipu_enabled: bool,
pub branch_model: String,
pub tenant_layer: Option<serde_json::Value>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct VerifyRequest {
#[schemars(description = "File path relative to the root, e.g. 'src/auth.rs'")]
pub file: String,
#[schemars(description = "The complete proposed contents of the file, as text")]
pub buffer: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct ViolationItem {
pub kind: String,
pub symbol: String,
pub line: usize,
pub message: String,
}
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct VerifyResponse {
pub file: String,
pub ok: bool,
pub violations: Vec<ViolationItem>,
pub unchecked: Vec<String>,
pub tier: String,
}
#[cfg_attr(not(feature = "quipu"), allow(dead_code))]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
pub struct PromoteRequest {
#[schemars(
description = "Directory relative to the root, e.g. 'crates/core'. Omit for the whole root."
)]
pub path: Option<String>,
#[schemars(description = "Quipu base URL override; omit to use the configured endpoint")]
pub endpoint: Option<String>,
#[schemars(
description = "Repository name for promoted IRIs; omit to derive from the origin remote"
)]
pub repo: Option<String>,
}
#[cfg_attr(not(feature = "quipu"), allow(dead_code))]
#[derive(Debug, Serialize, schemars::JsonSchema)]
pub struct PromoteResponse {
pub wrote: bool,
pub count: Option<u64>,
pub tx_id: Option<u64>,
pub chunks: Option<usize>,
pub violations: Vec<String>,
}