use super::*;
use serde::Deserialize;
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct ReplaceParams {
pub path: String,
pub old: String,
#[serde(rename = "new")]
pub new_text: Option<String>,
pub insert_before: Option<String>,
pub insert_after: Option<String>,
#[serde(default)]
pub regex: bool,
pub nth: Option<usize>,
#[serde(default)]
pub case_insensitive: bool,
#[serde(default)]
pub multiline: bool,
#[serde(default)]
pub if_exists: bool,
#[serde(default)]
pub whole_line: bool,
pub range: Option<String>,
#[serde(default)]
pub word_boundary: bool,
pub before_context: Option<String>,
pub after_context: Option<String>,
#[serde(default)]
pub unique: bool,
#[serde(default = "default_strict_true")]
pub strict: bool,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct DocGetParams {
pub path: String,
pub key: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct MdLintAgentsParams {
pub path: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct MdMoveSectionParams {
pub path: String,
pub heading: String,
#[serde(default)]
pub to: Option<String>,
#[serde(default)]
pub before: Option<String>,
#[serde(default)]
pub after: Option<String>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct TidyParams {
pub path: String,
#[serde(default)]
pub dedent: Option<String>,
#[serde(default)]
pub indent: Option<String>,
#[serde(default)]
pub lines: Option<String>,
#[serde(default)]
pub collapse_blanks: Option<bool>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct PatchParams {
pub diff: String,
#[serde(default)]
pub on_stale: crate::ops::patch::OnStale,
#[serde(default)]
pub allow_conflicts: bool,
#[serde(default = "default_strict_true")]
pub strict: bool,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct SearchParams {
pub pattern: String,
#[serde(default)]
pub paths: Vec<String>,
#[serde(default)]
pub literal: bool,
#[serde(default)]
pub case_insensitive: bool,
pub context: Option<usize>,
pub before_context: Option<usize>,
pub after_context: Option<usize>,
#[serde(default)]
pub files_with_matches: bool,
#[serde(default)]
pub count: bool,
#[serde(default)]
pub multiline: bool,
#[serde(default)]
pub invert_match: bool,
pub assert_count: Option<usize>,
#[serde(default)]
pub globs: Vec<String>,
#[serde(default)]
pub exclude_patterns: Vec<String>,
#[serde(default)]
pub custom_ignore_filenames: Vec<String>,
#[serde(default)]
pub max_results: usize,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct DocQueryParams {
pub action: String,
pub path: String,
pub key: Option<String>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct DocDiffParams {
pub file_a: String,
pub file_b: String,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct BatchReplaceParams {
pub files: Vec<String>,
pub old: String,
#[serde(rename = "new")]
pub new_text: String,
#[serde(default)]
pub regex: bool,
#[serde(default)]
pub case_insensitive: bool,
#[serde(default)]
pub multiline: bool,
#[serde(default)]
pub word_boundary: bool,
#[serde(default)]
pub if_exists: bool,
#[serde(default = "default_strict_true")]
pub strict: bool,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct BatchTidyParams {
pub files: Vec<String>,
#[serde(default = "default_strict_true")]
pub strict: bool,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstListParams {
pub path: String,
pub kind: Option<String>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstReadParams {
pub path: String,
pub symbol: String,
#[serde(default)]
pub context: usize,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstRenameParams {
pub old_name: String,
pub new_name: String,
pub path: String,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstValidateParams {
pub path: String,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstSearchParams {
pub query: String,
pub path: String,
#[serde(default)]
pub pattern: bool,
pub lang: Option<String>,
pub max_results: Option<usize>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstRefsParams {
pub symbol: String,
pub path: String,
#[serde(default)]
pub include_def: bool,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstDepsParams {
pub path: String,
#[serde(default)]
pub reverse: bool,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstMapParams {
pub path: String,
#[serde(default = "default_map_max_tokens")]
pub max_tokens: usize,
#[serde(default)]
pub focus: Vec<String>,
#[serde(default)]
pub boost: Vec<String>,
}
#[cfg(feature = "ast")]
fn default_map_max_tokens() -> usize {
1024
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstDiffParams {
pub path: String,
#[serde(default = "default_head")]
pub from: String,
pub to: Option<String>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
fn default_head() -> String {
"HEAD".to_string()
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstImpactParams {
pub symbol: String,
pub path: String,
#[serde(default = "default_impact_depth")]
pub depth: usize,
}
#[cfg(feature = "ast")]
fn default_impact_depth() -> usize {
3
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstReplaceParams {
pub path: String,
pub symbol: String,
pub old: String,
#[serde(rename = "new")]
pub new_text: String,
#[serde(default)]
pub regex: bool,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstInsertParams {
pub path: String,
pub content: String,
#[serde(default)]
pub inside: Option<String>,
#[serde(default)]
pub after: Option<String>,
#[serde(default)]
pub before: Option<String>,
#[serde(default)]
pub position: Option<String>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstWrapParams {
pub path: String,
#[serde(default)]
pub symbols: Option<Vec<String>>,
#[serde(default)]
pub lines: Option<String>,
pub wrapper: String,
#[serde(default)]
pub preamble: Option<String>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstImportsParams {
pub path: String,
#[serde(default)]
pub add: Option<Vec<String>>,
#[serde(default)]
pub remove: Option<Vec<String>>,
#[serde(default)]
pub dedupe: bool,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstReorderParams {
pub path: String,
#[serde(default)]
pub inside: Option<String>,
pub order: serde_json::Value,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstGroupParams {
pub path: String,
pub module: String,
pub symbols: Vec<String>,
#[serde(default)]
pub preamble: Option<String>,
#[serde(default)]
pub position: Option<String>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstMoveParams {
pub path: String,
pub target: String,
pub symbols: Vec<String>,
#[serde(default)]
pub position: Option<String>,
#[serde(default)]
pub target_prepend: Option<String>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstExtractToFileParams {
pub source: String,
pub symbol: String,
pub target: String,
#[serde(default)]
pub replacement: Option<String>,
#[serde(default)]
pub unwrap: Option<bool>,
#[serde(default)]
pub prepend: Option<String>,
#[serde(default)]
pub force: bool,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct AstSplitParams {
pub source: String,
pub targets: Vec<AstSplitTargetParam>,
#[serde(default)]
pub keep_in_source: Vec<String>,
#[serde(default)]
pub source_suffix: Option<String>,
#[serde(default)]
pub source_prefix: Option<String>,
#[serde(default)]
pub require_exhaustive: Option<bool>,
pub lang: Option<String>,
}
#[cfg(feature = "ast")]
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
pub(crate) struct AstSplitTargetParam {
pub path: String,
pub symbols: Vec<String>,
#[serde(default)]
pub prepend: Option<String>,
}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct EmptyParams {}
#[derive(Debug, Deserialize, schemars::JsonSchema)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub(crate) struct ExecutePlanParams {
pub plan: Option<Plan>,
pub plan_path: Option<String>,
#[serde(default = "default_strict_true")]
pub strict: bool,
}