@atomist/sdm-pack-aspect
Version:
an Atomist SDM Extension Pack for visualizing drift across an organization
105 lines • 3.58 kB
TypeScript
import { RemoteRepoRef, Severity } from "@atomist/automation-client";
import { FP } from "@atomist/sdm-pack-fingerprints";
import { Aspect } from "@atomist/sdm-pack-fingerprints/lib/machine/Aspect";
import { ProjectAnalysisResult } from "../analysis/ProjectAnalysisResult";
import { TagContext } from "../routes/api";
import { Score, WeightedScore } from "../scorer/Score";
import { IdealStore } from "./IdealStore";
import { ProblemStore, UndesirableUsageChecker } from "./ProblemStore";
/**
* Implemented by ProjectAnalysis or any other structure
* representing a repo exposing fingerprint data
*/
export interface HasFingerprints {
fingerprints: FP[];
}
/**
* Result of an analysis. We must always have at least fingerprints and repo identification
*/
export declare type Analyzed = HasFingerprints & {
id: RemoteRepoRef;
};
/**
* Tag based on fingerprint data.
*/
export interface Tag {
name: string;
description?: string;
/**
* Severity if this tag is associated with an action
*/
severity?: Severity;
}
/**
* Determine zero or one tag in this fingerprint
*/
export interface Tagger extends Tag {
/**
* Test for the relevance of this tag
* @param {FP} fp fingerprint to test
* @param {RemoteRepoRef} id id of repo to text
* @param {TagContext} tagContext context of this cohort of repos
* @return {boolean}
*/
test(fp: FP, id: RemoteRepoRef, tagContext: TagContext): boolean;
}
export interface WorkspaceSpecificTagger {
readonly name: string;
create(workspaceId: string, ar: AspectRegistry): Promise<Tagger>;
}
/**
* Tagger that can apply to all workspaces or workspace-specific tagger
*/
export declare type TaggerDefinition = Tagger | WorkspaceSpecificTagger;
export declare function isTagger(t: TaggerDefinition): t is Tagger;
/**
* Determine zero or one tag from this set of fingerprints
*/
export interface CombinationTagger extends Tag {
/**
* Test for the relevance of this tag given all fingerprints on this repository
* @param {FP} fp fingerprint to test
* @param {RemoteRepoRef} id id of repo to text
* @param {TagContext} tagContext context of this cohort of repos
* @return {boolean}
*/
test(fp: FP[], id: RemoteRepoRef, tagContext: TagContext): boolean;
}
export declare type TaggedRepo = ProjectAnalysisResult & {
tags: Tag[];
};
export declare type ScoredRepo = TaggedRepo & {
weightedScore: WeightedScore;
};
/**
* Function that knows how to score a repository.
* @param repo repo we are scoring
* @param allRepos context of this scoring activity
* @return undefined if this scorer doesn't know how to score this repository.
*/
export declare type RepositoryScorer = (repo: TaggedRepo, allRepos: TaggedRepo[]) => Promise<Score | undefined>;
/**
* Manage a number of aspects.
*/
export interface AspectRegistry {
tagAndScoreRepos(workspaceId: string, repos: ProjectAnalysisResult[]): Promise<ScoredRepo[]>;
availableTags: Tag[];
/**
* All the aspects we are managing
*/
readonly aspects: Aspect[];
/**
* Find the aspect that manages fingerprints of this type
*/
aspectOf(type: string): Aspect | undefined;
/**
* Function that can resolve ideal status for this aspect
*/
readonly idealStore: IdealStore;
readonly problemStore: ProblemStore;
/**
* Return an UndesirableUsageChecker for this workspace
*/
undesirableUsageCheckerFor(workspaceId: string): Promise<UndesirableUsageChecker>;
}
//# sourceMappingURL=AspectRegistry.d.ts.map