Skip to main content

WorkspaceScanner

Struct WorkspaceScanner 

Source
pub struct WorkspaceScanner {
    pub concurrency: usize,
}
Expand description

Scans downstream workspaces for installed catalog assets.

Construct with WorkspaceScanner::new. The scanner is Clone + Send and safe to share across tokio tasks via Arc.

Fields§

§concurrency: usize

Maximum number of workspaces scanned concurrently.

Implementations§

Source§

impl WorkspaceScanner

Source

pub fn new(concurrency: usize) -> Self

Create a scanner with the given concurrency limit.

concurrency controls how many workspace scans run simultaneously via tokio tasks. The default recommended value is 8 (Req 23.1).

Source

pub fn parse_export_metadata(content: &str) -> Option<ExportMeta>

Parse the # VFA-EXPORT: {json} metadata comment format (Req 7.7).

Searches content line-by-line (up to 20 lines) for a line whose trimmed form starts with # VFA-EXPORT: (case-sensitive). The JSON payload after the colon is parsed with serde_json.

Returns None for any malformed or missing line without panicking.

Source

pub fn match_content_signature( first_50_lines: &str, canonical_first_50: &str, ) -> bool

Conservative content-similarity heuristic for the first 50 lines.

Heuristic: normalise both sides (trim whitespace, lowercase), split into a set of non-empty lines, and compute the Jaccard-like overlap:

overlap = |file_lines ∩ template_lines| / |template_lines|

Returns true when overlap >= 0.40 AND both sides have at least 3 non-empty lines. This threshold is deliberately conservative to avoid false positives on short boilerplate. Callers should treat this as a supporting signal only; confirmation requires a second agreeing strategy.

Source

pub fn scan_harness_dir( &self, _workspace_path: &Path, harness: &HarnessDir, dir: &Path, index: &CatalogIndex, ) -> Vec<InstalledAsset>

Scan a single harness directory and return detected assets.

Per-harness file-extension filters (Req 7.8):

HarnessExtensions scanned
Claude*.md
Cursor*.json
Kiro*.md
Codexplugin.json only
Opencode*.toml, *.yaml, *.yml

Validates the layout before walking (Req 7.6); returns empty vec with a warn! if the layout does not match any known pattern.

Source

pub fn scan_workspace( &self, ws: &ResolvedWorkspace, index: &CatalogIndex, ) -> Vec<InstalledAsset>

Scan a single resolved workspace, returning all detected assets sorted by asset_id (Req 27.2).

Harness directories that do not match any known layout are warned and skipped (Req 7.6).

Bug #2: Recursively checks for agents/ and skills/ subdirectories within each harness root (e.g., .claude/agents/, .cursor/agents/, etc.).

Source

pub async fn scan_all( &self, workspaces: &[ResolvedWorkspace], index: &CatalogIndex, ) -> HashMap<PathBuf, Vec<InstalledAsset>>

Scan all workspaces in parallel (up to self.concurrency simultaneous tasks) and return a map from workspace canonical path → installed assets.

Uses a Semaphore to bound concurrency (Req 23.1). Each workspace scan runs in its own tokio::spawn task so I/O does not block the executor.

Offline/unavailable workspaces are skipped silently here; callers should pre-filter or mark them based on ResolvedWorkspace::status.

Trait Implementations§

Source§

impl Clone for WorkspaceScanner

Source§

fn clone(&self) -> WorkspaceScanner

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for WorkspaceScanner

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more