1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! Canonical schema types for sqry.
//!
//! This module provides the **single source of truth** for all semantic types
//! used across sqry interfaces (CLI, LSP, MCP). Interface-specific wire types
//! should derive from or reference these canonical definitions.
//!
//! # Design Goals
//!
//! 1. **Centralized definitions** - All semantic enums defined once
//! 2. **Cross-interface consistency** - LSP and MCP use same underlying types
//! 3. **Documentation** - Each type is fully documented for API consumers
//! 4. **Serialization** - All types support JSON and postcard serialization
//!
//! # Type Categories
//!
//! ## Graph Types (re-exported from `graph::unified`)
//! - [`NodeKind`](crate::graph::unified::node::NodeKind) - Categories of code symbols (function, class, method, etc.)
//! - [`EdgeKind`](crate::graph::unified::edge::EdgeKind) - Relationship types between symbols (calls, imports, etc.)
//!
//! ## Query Types
//! - [`RelationKind`](crate::schema::RelationKind) - Relation query types (callers, callees, imports, exports, returns)
//! - [`Visibility`](crate::schema::Visibility) - Node visibility filter (public, private)
//!
//! ## Output Types
//! - [`OutputFormat`](crate::schema::OutputFormat) - Graph/result output formats (json, dot, d2, mermaid)
//!
//! ## Analysis Types
//! - [`ChangeKind`](crate::schema::ChangeKind) - Semantic diff change types (added, removed, modified, etc.)
//! - [`CycleKind`](crate::schema::CycleKind) - Cycle detection types (calls, imports, modules)
//! - [`DuplicateKind`](crate::schema::DuplicateKind) - Duplicate detection types (body, signature, struct)
//! - [`UnusedScope`](crate::schema::UnusedScope) - Unused symbol scope (public, private, function, etc.)
//!
//! # Usage
//!
//! Interface packages should import these types and optionally create thin wrappers
//! for JSON Schema generation (MCP) or protocol-specific serialization (LSP):
//!
//! ```rust,ignore
//! use sqry_core::schema::{RelationKind, Visibility, OutputFormat};
//!
//! // MCP can derive schemars::JsonSchema on a wrapper if needed
//! #[derive(schemars::JsonSchema)]
//! #[serde(transparent)]
//! pub struct RelationTypeParam(RelationKind);
//! ```
// Re-export all canonical types
pub use ChangeKind;
pub use CycleKind;
pub use DuplicateKind;
pub use OutputFormat;
pub use RelationKind;
pub use UnusedScope;
pub use Visibility;
// Re-export graph types as canonical schema types
pub use crateEdgeKind;
pub use crateNodeKind;