pub trait LanguagePlugin: Send + Sync {
Show 25 methods
// Required methods
fn name(&self) -> &str;
fn extensions(&self) -> &[&str];
fn key_files(&self) -> &[&str];
fn get_lsp_config(&self) -> LspConfig;
fn get_init_action(&self, opts: &InitOptions) -> ProjectAction;
fn check_tooling_action(&self, path: &Path) -> ProjectAction;
fn init_command(&self, opts: &InitOptions) -> String;
fn test_command(&self) -> String;
fn run_command(&self) -> String;
// Provided methods
fn detect(&self, path: &Path) -> bool { ... }
fn run_command_for_dir(&self, _path: &Path) -> String { ... }
fn syntax_check_command(&self) -> Option<String> { ... }
fn build_command(&self) -> Option<String> { ... }
fn lint_command(&self) -> Option<String> { ... }
fn file_ownership_patterns(&self) -> &[&str] { ... }
fn owns_file(&self, path: &str) -> bool { ... }
fn host_tool_available(&self) -> bool { ... }
fn required_binaries(&self) -> Vec<(&str, &str, &str)> { ... }
fn lsp_fallback(&self) -> Option<LspConfig> { ... }
fn verifier_profile(&self) -> VerifierProfile { ... }
fn legal_support_files(&self) -> &[&str] { ... }
fn manifest_mutation_policy(
&self,
_manifest_path: &str,
) -> ManifestMutationPolicy { ... }
fn dependency_command_policy(&self, _command: &str) -> CommandPolicyDecision { ... }
fn correction_prompt_fragment(&self) -> Option<&str> { ... }
fn test_file_patterns(&self) -> &[&str] { ... }
}Expand description
A plugin for a specific programming language
PSP-5 expands this trait beyond init/test/run to a full capability-based runtime contract that governs detection, verification, LSP, and ownership.
Required Methods§
Sourcefn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
File extensions this plugin handles
Sourcefn key_files(&self) -> &[&str]
fn key_files(&self) -> &[&str]
Key files that identify this language (e.g., Cargo.toml, pyproject.toml)
Sourcefn get_lsp_config(&self) -> LspConfig
fn get_lsp_config(&self) -> LspConfig
Get the LSP configuration for this language
Sourcefn get_init_action(&self, opts: &InitOptions) -> ProjectAction
fn get_init_action(&self, opts: &InitOptions) -> ProjectAction
Get the action to initialize a new project (greenfield)
Sourcefn check_tooling_action(&self, path: &Path) -> ProjectAction
fn check_tooling_action(&self, path: &Path) -> ProjectAction
Check if an existing project needs tooling sync (e.g., uv sync, cargo fetch)
Sourcefn init_command(&self, opts: &InitOptions) -> String
fn init_command(&self, opts: &InitOptions) -> String
Get the command to initialize a new project DEPRECATED: Use get_init_action instead
Sourcefn test_command(&self) -> String
fn test_command(&self) -> String
Get the command to run tests
Sourcefn run_command(&self) -> String
fn run_command(&self) -> String
Get the command to run the project (for verification)
Provided Methods§
Sourcefn detect(&self, path: &Path) -> bool
fn detect(&self, path: &Path) -> bool
Detect if this plugin should handle the given project directory
Sourcefn run_command_for_dir(&self, _path: &Path) -> String
fn run_command_for_dir(&self, _path: &Path) -> String
Get the command to run the project in a specific directory.
Override this to inspect pyproject.toml, Cargo.toml, etc. and return a more appropriate run command than the generic default.
Sourcefn syntax_check_command(&self) -> Option<String>
fn syntax_check_command(&self) -> Option<String>
Get the syntax/type check command (e.g., cargo check, uvx ty check .)
Returns None if the plugin has no syntax check command (uses LSP only).
Sourcefn build_command(&self) -> Option<String>
fn build_command(&self) -> Option<String>
Get the build command (e.g., cargo build, npm run build)
Returns None if the language doesn’t have a separate build step.
Sourcefn lint_command(&self) -> Option<String>
fn lint_command(&self) -> Option<String>
Get the lint command (e.g., cargo clippy -- -D warnings)
Used only in VerifierStrictness::Strict mode.
Sourcefn file_ownership_patterns(&self) -> &[&str]
fn file_ownership_patterns(&self) -> &[&str]
File glob patterns this plugin owns (e.g., ["*.rs", "Cargo.toml"])
Used for node ownership matching in multi-language repos.
Sourcefn owns_file(&self, path: &str) -> bool
fn owns_file(&self, path: &str) -> bool
PSP-5 Phase 2: Check if a file path belongs to this plugin’s ownership domain
Uses file_ownership_patterns() for suffix/extension matching.
Sourcefn host_tool_available(&self) -> bool
fn host_tool_available(&self) -> bool
Check if the host has the required build tools available
Returns true if the plugin’s primary toolchain is installed and callable. When false, the runtime enters degraded-validation mode.
Sourcefn required_binaries(&self) -> Vec<(&str, &str, &str)>
fn required_binaries(&self) -> Vec<(&str, &str, &str)>
Required host binaries for this plugin, grouped by role.
Each entry is (binary_name, role_description, install_hint).
The orchestrator checks these before init and emits install directions
for any that are missing.
Sourcefn lsp_fallback(&self) -> Option<LspConfig>
fn lsp_fallback(&self) -> Option<LspConfig>
Get fallback LSP config when primary is unavailable
Sourcefn verifier_profile(&self) -> VerifierProfile
fn verifier_profile(&self) -> VerifierProfile
Build a complete verifier profile by probing each capability.
The default implementation auto-assembles from the existing
syntax_check_command(), build_command(), test_command(),
lint_command(), and host_tool_available() methods.
Plugins override this method to provide per-sensor probing with distinct fallback commands and independent availability checks.
Sourcefn legal_support_files(&self) -> &[&str]
fn legal_support_files(&self) -> &[&str]
Legal support files that the LLM is allowed to create beyond declared
output_files (e.g., Cargo.toml for Rust, __init__.py for Python).
These are files that commonly accompany code generation but are not explicitly listed in the plan. The typed parse pipeline’s Layer E uses this to accept known auxiliary files without flagging them as ownership violations.
Sourcefn manifest_mutation_policy(
&self,
_manifest_path: &str,
) -> ManifestMutationPolicy
fn manifest_mutation_policy( &self, _manifest_path: &str, ) -> ManifestMutationPolicy
Policy for manifest file mutations produced by the LLM.
Returns whether a given manifest path may be modified. Plugins can
deny mutations to key files (e.g., root Cargo.toml in a workspace)
while allowing leaf-level manifest edits.
Sourcefn dependency_command_policy(&self, _command: &str) -> CommandPolicyDecision
fn dependency_command_policy(&self, _command: &str) -> CommandPolicyDecision
Policy for dependency-management commands emitted by the LLM.
Replaces the hardcoded command allowlist in the correction pipeline.
Each command string (e.g., "cargo add serde") is checked against
this policy before execution.
Sourcefn correction_prompt_fragment(&self) -> Option<&str>
fn correction_prompt_fragment(&self) -> Option<&str>
Plugin-specific correction prompt fragment.
Injected into correction retry prompts to give the LLM language-specific
guidance (e.g., “use cargo add instead of editing Cargo.toml directly”).
Returns None if the plugin has no special guidance.
Sourcefn test_file_patterns(&self) -> &[&str]
fn test_file_patterns(&self) -> &[&str]
Glob patterns that identify test files for this language.
Used by plan validation to infer that test-type tasks should depend on the code tasks whose output files match these patterns’ sibling sources.