pub trait LanguagePlugin: Send + Sync {
Show 30 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 test_command_with_filter(&self, _filter: Option<&str>) -> String { ... }
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 format_command(&self) -> Option<String> { ... }
fn format_check_command(&self) -> Option<String> { ... }
fn file_ownership_patterns(&self) -> &[&str] { ... }
fn owns_file(&self, path: &str) -> bool { ... }
fn is_test_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_commands(
&self,
_action: DependencyAction,
_packages: &[String],
_dev: bool,
) -> Vec<String> { ... }
fn dependency_files(&self) -> Vec<String> { ... }
fn dependency_command_policy(&self, _command: &str) -> CommandPolicyDecision { ... }
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 test_command_with_filter(&self, _filter: Option<&str>) -> String
fn test_command_with_filter(&self, _filter: Option<&str>) -> String
The test command narrowed to an already-sanitized name filter. The
default ignores the filter; plugins with a native filter form
override it. Acceptance gates always use the unfiltered
test_command — only interactive run_test
calls narrow.
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 format_command(&self) -> Option<String>
fn format_command(&self) -> Option<String>
The governed formatter command (run_formatter; e.g. cargo fmt).
Sourcefn format_check_command(&self) -> Option<String>
fn format_check_command(&self) -> Option<String>
The formatter’s non-mutating check form (e.g. cargo fmt --check),
declared as the format verifier stage when present.
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 is_test_file(&self, _path: &str) -> bool
fn is_test_file(&self, _path: &str) -> bool
Whether an existing file contributes executable test-oracle semantics. The governed candidate runs a second verifier pass with source pre-images restored whenever one of these files is modified.
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_commands(
&self,
_action: DependencyAction,
_packages: &[String],
_dev: bool,
) -> Vec<String>
fn dependency_commands( &self, _action: DependencyAction, _packages: &[String], _dev: bool, ) -> Vec<String>
The command sequence realizing a governed dependency action, or
empty when this plugin does not support dependency mutation. Every
returned command must itself satisfy dependency_command_policy,
and the handler re-checks it (fail closed).
Sourcefn dependency_files(&self) -> Vec<String>
fn dependency_files(&self) -> Vec<String>
Workspace-relative manifest and lockfile paths a dependency command
may mutate — the promotable footprint of mutate_dependencies.
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 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.