pub struct Scanner<F: FileSystemProvider = StdFileSystemProvider, P: MarkdownParser = PulldownMarkdownParser> { /* private fields */ }Expand description
Scanner for analyzing skills and related agent-extension packages.
Implementations§
Source§impl Scanner<StdFileSystemProvider, PulldownMarkdownParser>
impl Scanner<StdFileSystemProvider, PulldownMarkdownParser>
pub fn new() -> Result<Self, ScanError>
pub fn with_std_adapters(options: ScanOptions) -> Result<Self, ScanError>
Source§impl<F: FileSystemProvider, P: MarkdownParser> Scanner<F, P>
impl<F: FileSystemProvider, P: MarkdownParser> Scanner<F, P>
pub fn with_custom_adapters( options: ScanOptions, fs_provider: F, parser: P, ) -> Result<Self, ScanError>
Sourcepub fn scan_file(&self, path: impl AsRef<Path>) -> Result<ScanResult, ScanError>
pub fn scan_file(&self, path: impl AsRef<Path>) -> Result<ScanResult, ScanError>
Scan a single document file and return its ScanResult.
Accepts any path that resolves to a readable file through the
scanner’s FileSystemProvider. The file does not need to be a
canonical skill entrypoint — use scan_skill_file when callers
want that stricter precondition. Use scan_package or scan
to scan a whole package and aggregate results.
§Errors
ScanError::PathNotFoundifpathdoes not exist throughfs.- Errors propagated from the analyzer / rule engine pipeline
(parse failures, rule evaluation errors, …) surface as
ScanErrorvariants.
Sourcepub fn scan_skill_file(
&self,
path: impl AsRef<Path>,
) -> Result<ScanResult, ScanError>
pub fn scan_skill_file( &self, path: impl AsRef<Path>, ) -> Result<ScanResult, ScanError>
Scan a path that MUST be a canonical skill entrypoint
(SKILL.md, agent.md, manifest, etc.). Use this when the
caller already enforces “this is the skill” semantics — scan /
scan_package discover entrypoints automatically and should be
preferred for general use.
§Errors
ScanError::PathNotFoundifpathdoes not exist.ScanError::InvalidSkillEntrypointifpathexists but is not recognised as a skill entrypoint byFileDiscoveryService::is_explicit_skill_file.- Errors propagated from the analyzer / rule pipeline.
Sourcepub fn scan_package(
&self,
path: impl AsRef<Path>,
) -> Result<PackageScanResult, ScanError>
pub fn scan_package( &self, path: impl AsRef<Path>, ) -> Result<PackageScanResult, ScanError>
Scan an entire package directory (or a single file treated as a
degenerate one-target package). Discovers every target via
discover_package_targets and aggregates per-target results
into a PackageScanResult. Per-target failures are recorded in
pkg_result.errors instead of aborting the whole scan, so a
partially malformed package still produces verdicts for the
readable subset.
§Errors
ScanError::PathNotFoundifpathdoes not exist.- Errors from package discovery (only the initial discovery
step bubbles up; per-file errors are captured into
PackageScanResult::errors).
Sourcepub fn scan(
&self,
path: impl AsRef<Path>,
) -> Result<PackageScanResult, ScanError>
pub fn scan( &self, path: impl AsRef<Path>, ) -> Result<PackageScanResult, ScanError>
Top-level entry point. Honours the configured ScanTargetMode:
Auto(default) — file paths route toscan_file, directory paths toscan_package.File— always treated as a single document; directories producePathNotFound-equivalent errors via the analyzer.Package— always treated as a package, even when the path is a single file. Useful when callers want package-level aggregation over a synthetic one-file package.
§Errors
ScanError::PathNotFoundifpathis missing inAutomode.- Errors from the underlying
scan_file/scan_packagepaths.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Number of compiled rules currently loaded into the underlying
RuleEngine. Combines built-in rules with any external packs
loaded via --rules-dir. Useful for diagnostics and CLI
rules count summaries.