@wispbit/local 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.ts +3 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/cli.js +3668 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.js +3868 -0
- package/dist/index.js.map +7 -0
- package/dist/package.json +72 -0
- package/dist/src/cli.d.ts +16 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/config.d.ts +6 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/environment/Config.d.ts +69 -0
- package/dist/src/environment/Config.d.ts.map +1 -0
- package/dist/src/environment/Environment.d.ts +23 -0
- package/dist/src/environment/Environment.d.ts.map +1 -0
- package/dist/src/environment/Sandbox.d.ts +48 -0
- package/dist/src/environment/Sandbox.d.ts.map +1 -0
- package/dist/src/environment/Storage.d.ts +84 -0
- package/dist/src/environment/Storage.d.ts.map +1 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/languages.d.ts +36 -0
- package/dist/src/languages.d.ts.map +1 -0
- package/dist/src/providers/AstGrepAstProvider.d.ts +44 -0
- package/dist/src/providers/AstGrepAstProvider.d.ts.map +1 -0
- package/dist/src/providers/LanguageBackend.d.ts +74 -0
- package/dist/src/providers/LanguageBackend.d.ts.map +1 -0
- package/dist/src/providers/RuleProvider.d.ts +46 -0
- package/dist/src/providers/RuleProvider.d.ts.map +1 -0
- package/dist/src/providers/ScipIntelligenceProvider.d.ts +84 -0
- package/dist/src/providers/ScipIntelligenceProvider.d.ts.map +1 -0
- package/dist/src/providers/ViolationValidationProvider.d.ts +42 -0
- package/dist/src/providers/ViolationValidationProvider.d.ts.map +1 -0
- package/dist/src/providers/WispbitRuleProvider.d.ts +45 -0
- package/dist/src/providers/WispbitRuleProvider.d.ts.map +1 -0
- package/dist/src/providers/WispbitViolationValidationProvider.d.ts +15 -0
- package/dist/src/providers/WispbitViolationValidationProvider.d.ts.map +1 -0
- package/dist/src/schemas.d.ts +1771 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/steps/ExecutionEventEmitter.d.ts +156 -0
- package/dist/src/steps/ExecutionEventEmitter.d.ts.map +1 -0
- package/dist/src/steps/FileExecutionContext.d.ts +85 -0
- package/dist/src/steps/FileExecutionContext.d.ts.map +1 -0
- package/dist/src/steps/FileFilterStep.d.ts +35 -0
- package/dist/src/steps/FileFilterStep.d.ts.map +1 -0
- package/dist/src/steps/FileFilterStep.test.d.ts +2 -0
- package/dist/src/steps/FileFilterStep.test.d.ts.map +1 -0
- package/dist/src/steps/FindMatchesStep.d.ts +41 -0
- package/dist/src/steps/FindMatchesStep.d.ts.map +1 -0
- package/dist/src/steps/FindMatchesStep.test.d.ts +2 -0
- package/dist/src/steps/FindMatchesStep.test.d.ts.map +1 -0
- package/dist/src/steps/GotoDefinitionStep.d.ts +86 -0
- package/dist/src/steps/GotoDefinitionStep.d.ts.map +1 -0
- package/dist/src/steps/LLMStep.d.ts +50 -0
- package/dist/src/steps/LLMStep.d.ts.map +1 -0
- package/dist/src/steps/RuleExecutor.d.ts +35 -0
- package/dist/src/steps/RuleExecutor.d.ts.map +1 -0
- package/dist/src/steps/RuleExecutor.test.d.ts +2 -0
- package/dist/src/steps/RuleExecutor.test.d.ts.map +1 -0
- package/dist/src/test/TestExecutor.d.ts +33 -0
- package/dist/src/test/TestExecutor.d.ts.map +1 -0
- package/dist/src/test/rules.test.d.ts +2 -0
- package/dist/src/test/rules.test.d.ts.map +1 -0
- package/dist/src/types.d.ts +200 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/asciiFrames.d.ts +5 -0
- package/dist/src/utils/asciiFrames.d.ts.map +1 -0
- package/dist/src/utils/formatters.d.ts +55 -0
- package/dist/src/utils/formatters.d.ts.map +1 -0
- package/dist/src/utils/generateTreeDump.d.ts +19 -0
- package/dist/src/utils/generateTreeDump.d.ts.map +1 -0
- package/dist/src/utils/git.d.ts +39 -0
- package/dist/src/utils/git.d.ts.map +1 -0
- package/dist/src/utils/hashString.d.ts +2 -0
- package/dist/src/utils/hashString.d.ts.map +1 -0
- package/dist/src/utils/readTextAtRange.d.ts +10 -0
- package/dist/src/utils/readTextAtRange.d.ts.map +1 -0
- package/dist/src/utils/snapshotComparison.d.ts +16 -0
- package/dist/src/utils/snapshotComparison.d.ts.map +1 -0
- package/dist/src/utils/startupScreen.d.ts +5 -0
- package/dist/src/utils/startupScreen.d.ts.map +1 -0
- package/dist/src/utils/validateRule.d.ts +16 -0
- package/dist/src/utils/validateRule.d.ts.map +1 -0
- package/dist/src/version.d.ts +3 -0
- package/dist/src/version.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vitest.config.d.mts +3 -0
- package/dist/vitest.config.d.mts.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wispbit/local",
|
|
3
|
+
"version": "1.0.25",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"bin": {
|
|
7
|
+
"powerlint": "./dist/index.js",
|
|
8
|
+
"wispbit": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./src/index.d.ts",
|
|
13
|
+
"import": "./index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@ast-grep/lang-angular": "^0.0.6",
|
|
18
|
+
"@ast-grep/lang-bash": "^0.0.4",
|
|
19
|
+
"@ast-grep/lang-c": "^0.0.3",
|
|
20
|
+
"@ast-grep/lang-cpp": "^0.0.3",
|
|
21
|
+
"@ast-grep/lang-csharp": "^0.0.3",
|
|
22
|
+
"@ast-grep/lang-css": "^0.0.4",
|
|
23
|
+
"@ast-grep/lang-dart": "^0.0.4",
|
|
24
|
+
"@ast-grep/lang-elixir": "^0.0.4",
|
|
25
|
+
"@ast-grep/lang-go": "^0.0.3",
|
|
26
|
+
"@ast-grep/lang-haskell": "^0.0.4",
|
|
27
|
+
"@ast-grep/lang-html": "^0.0.4",
|
|
28
|
+
"@ast-grep/lang-java": "^0.0.4",
|
|
29
|
+
"@ast-grep/lang-javascript": "^0.0.4",
|
|
30
|
+
"@ast-grep/lang-json": "^0.0.4",
|
|
31
|
+
"@ast-grep/lang-kotlin": "^0.0.4",
|
|
32
|
+
"@ast-grep/lang-lua": "^0.0.4",
|
|
33
|
+
"@ast-grep/lang-markdown": "^0.0.3",
|
|
34
|
+
"@ast-grep/lang-php": "^0.0.4",
|
|
35
|
+
"@ast-grep/lang-python": "^0.0.3",
|
|
36
|
+
"@ast-grep/lang-ruby": "^0.0.4",
|
|
37
|
+
"@ast-grep/lang-rust": "^0.0.4",
|
|
38
|
+
"@ast-grep/lang-scala": "^0.0.4",
|
|
39
|
+
"@ast-grep/lang-sql": "^0.0.5",
|
|
40
|
+
"@ast-grep/lang-swift": "^0.0.5",
|
|
41
|
+
"@ast-grep/lang-toml": "^0.0.6",
|
|
42
|
+
"@ast-grep/lang-tsx": "^0.0.4",
|
|
43
|
+
"@ast-grep/lang-typescript": "^0.0.4",
|
|
44
|
+
"@ast-grep/lang-yaml": "^0.0.3",
|
|
45
|
+
"@ast-grep/napi": "^0.39.5",
|
|
46
|
+
"@sourcegraph/scip-python": "^0.6.6",
|
|
47
|
+
"@sourcegraph/scip-root": "github:sourcegraph/scip#fc864ca283f65cdd15229f0fdae59a14e3da9a64",
|
|
48
|
+
"@sourcegraph/scip-typescript": "^0.3.16",
|
|
49
|
+
"@types/semver": "^7.7.1",
|
|
50
|
+
"big.js": "^7.0.1",
|
|
51
|
+
"chalk": "^5.4.1",
|
|
52
|
+
"dotenv": "^16.3.1",
|
|
53
|
+
"glob": "^10.4.5",
|
|
54
|
+
"google-protobuf": "^3.20.1",
|
|
55
|
+
"jest-diff": "^30.2.0",
|
|
56
|
+
"js-yaml": "^4.1.0",
|
|
57
|
+
"keyv": "^5.5.3",
|
|
58
|
+
"keyv-file": "^5.2.0",
|
|
59
|
+
"latest-version": "^9.0.0",
|
|
60
|
+
"meow": "^14.0.0",
|
|
61
|
+
"minimatch": "^9.0.3",
|
|
62
|
+
"openai": "4.91.0",
|
|
63
|
+
"ora": "^9.0.0",
|
|
64
|
+
"p-limit": "^6.1.0",
|
|
65
|
+
"pretty-format": "^30.2.0",
|
|
66
|
+
"semver": "^7.7.3",
|
|
67
|
+
"tree-sitter-graphql": "github:joowani/tree-sitter-graphql#c3898a14e872a72726a3e981e647e5456812bd78",
|
|
68
|
+
"zod": "^3.24.3"
|
|
69
|
+
},
|
|
70
|
+
"main": "./index.js",
|
|
71
|
+
"types": "./src/index.d.ts"
|
|
72
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Match } from "powerlint/types";
|
|
3
|
+
/**
|
|
4
|
+
* Check for available updates
|
|
5
|
+
*/
|
|
6
|
+
export declare function checkForUpdates(): Promise<void>;
|
|
7
|
+
export interface ScanResult {
|
|
8
|
+
ruleId: string;
|
|
9
|
+
internalId?: string;
|
|
10
|
+
message: string;
|
|
11
|
+
severity: "violation" | "suggestion";
|
|
12
|
+
matches: Match[];
|
|
13
|
+
llmCost?: string;
|
|
14
|
+
llmTokens?: number;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAkBA,OAAO,EAAE,KAAK,EAAgC,MAAM,iBAAiB,CAAA;AAsHrE;;GAEG;AACH,wBAAsB,eAAe,kBAcpC;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,WAAW,GAAG,YAAY,CAAA;IACpC,OAAO,EAAE,KAAK,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { PowerLintConfig } from "powerlint/config";
|
|
2
|
+
import { Environment } from "powerlint/environment/Environment";
|
|
3
|
+
export interface InitializeResult {
|
|
4
|
+
configured: boolean;
|
|
5
|
+
invalid_api_key?: boolean;
|
|
6
|
+
is_valid_repository?: boolean;
|
|
7
|
+
config?: {
|
|
8
|
+
ignored_globs: string[];
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare class Config {
|
|
12
|
+
private config;
|
|
13
|
+
private apiKey;
|
|
14
|
+
private baseUrl;
|
|
15
|
+
constructor(config: Partial<PowerLintConfig>);
|
|
16
|
+
getIgnoredGlobs(): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Get the Wispbit API key
|
|
19
|
+
* @returns The API key or null if not set
|
|
20
|
+
*/
|
|
21
|
+
getApiKey(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the Wispbit API base URL
|
|
24
|
+
* @returns The base URL
|
|
25
|
+
*/
|
|
26
|
+
getBaseUrl(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Get the local PowerLint version
|
|
29
|
+
* @returns The current PowerLint version
|
|
30
|
+
*/
|
|
31
|
+
getLocalVersion(): string;
|
|
32
|
+
/**
|
|
33
|
+
* Get the schema version
|
|
34
|
+
* @returns The schema version
|
|
35
|
+
*/
|
|
36
|
+
getSchemaVersion(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Validate API key with Wispbit API
|
|
39
|
+
*/
|
|
40
|
+
private static validateApiKey;
|
|
41
|
+
/**
|
|
42
|
+
* Initialize configuration without network validation (for testing)
|
|
43
|
+
* @param options Optional configuration options
|
|
44
|
+
* @returns Config instance
|
|
45
|
+
*/
|
|
46
|
+
static initializeWithoutNetwork(options?: {
|
|
47
|
+
ignoredGlobs?: string[];
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
baseUrl?: string;
|
|
50
|
+
}): Config;
|
|
51
|
+
/**
|
|
52
|
+
* Initialize configuration by validating API key and repository URL with Wispbit
|
|
53
|
+
* @param environment Environment instance to get repository URL
|
|
54
|
+
* @param apiKey Optional API key to use for initialization. If not provided, will use environment variable
|
|
55
|
+
* @returns Promise<Config | null> - Config if valid, null if API key missing/invalid
|
|
56
|
+
*/
|
|
57
|
+
static initialize(environment: Environment, { apiKey, baseUrl, }: {
|
|
58
|
+
apiKey?: string;
|
|
59
|
+
baseUrl?: string;
|
|
60
|
+
}): Promise<Config | {
|
|
61
|
+
failed: true;
|
|
62
|
+
error: "INVALID_API_KEY" | "INVALID_REPOSITORY";
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Check if PowerLint is configured (has valid API key)
|
|
66
|
+
*/
|
|
67
|
+
isConfigured(): boolean;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=Config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../../src/environment/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAG/D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAA;IACnB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,MAAM,CAAC,EAAE;QACP,aAAa,EAAE,MAAM,EAAE,CAAA;KACxB,CAAA;CACF;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,OAAO,CAAsB;gBAEzB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC;IAS5C,eAAe,IAAI,MAAM,EAAE;IAI3B;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;;OAGG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;mBACkB,cAAc;IAqBnC;;;;OAIG;WACW,wBAAwB,CACpC,OAAO,GAAE;QACP,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;QACvB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;KACZ,GACL,MAAM;IAaT;;;;;OAKG;WACiB,UAAU,CAC5B,WAAW,EAAE,WAAW,EACxB,EACE,MAAM,EACN,OAAO,GACR,EAAE;QACD,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,GACA,OAAO,CAAC,MAAM,GAAG;QAAE,MAAM,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,iBAAiB,GAAG,oBAAoB,CAAA;KAAE,CAAC;IAkDtF;;OAEG;IACH,YAAY,IAAI,OAAO;CAGxB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment contains workspace configuration
|
|
3
|
+
* Used by providers and steps to access common configuration
|
|
4
|
+
*/
|
|
5
|
+
export declare class Environment {
|
|
6
|
+
private readonly workspaceRoot;
|
|
7
|
+
private readonly repositoryUrl;
|
|
8
|
+
constructor(config?: {
|
|
9
|
+
workspaceRoot?: string;
|
|
10
|
+
repositoryUrl?: string;
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Get the workspace root directory
|
|
14
|
+
*/
|
|
15
|
+
getWorkspaceRoot(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the remote repository URL from Git config
|
|
18
|
+
* @param remoteName Name of the remote (default: origin)
|
|
19
|
+
* @returns The remote repository URL or null if not found
|
|
20
|
+
*/
|
|
21
|
+
getRepositoryUrl(remoteName?: string): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=Environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Environment.d.ts","sourceRoot":"","sources":["../../../src/environment/Environment.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAQ;IACtC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;gBAEjC,MAAM,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;IAKvE;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;;;OAIG;IACG,gBAAgB,CAAC,UAAU,GAAE,MAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CAYvE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Environment } from "powerlint/environment/Environment";
|
|
2
|
+
import { type Rule } from "powerlint/types";
|
|
3
|
+
export interface VirtualFile {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
export interface SandboxOptions {
|
|
8
|
+
rule: Rule;
|
|
9
|
+
virtualFiles?: VirtualFile[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Sandbox class for creating isolated test environments with rules and virtual files
|
|
13
|
+
* Uses Environment class under the hood for rule management
|
|
14
|
+
*/
|
|
15
|
+
export declare class Sandbox {
|
|
16
|
+
private environment;
|
|
17
|
+
private cleanupFn;
|
|
18
|
+
constructor({ environment, cleanupFn }: {
|
|
19
|
+
environment: Environment;
|
|
20
|
+
cleanupFn: () => void;
|
|
21
|
+
});
|
|
22
|
+
static create(options: SandboxOptions): Promise<Sandbox>;
|
|
23
|
+
/**
|
|
24
|
+
* Get the Environment instance
|
|
25
|
+
*/
|
|
26
|
+
getEnvironment(): Environment;
|
|
27
|
+
/**
|
|
28
|
+
* Clean up the sandbox
|
|
29
|
+
*/
|
|
30
|
+
cleanup(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Create a hash of the rule config and virtual files for directory naming
|
|
33
|
+
*/
|
|
34
|
+
private static createContentHash;
|
|
35
|
+
/**
|
|
36
|
+
* Setup the sandbox with rule and virtual files
|
|
37
|
+
*/
|
|
38
|
+
private setupSandbox;
|
|
39
|
+
/**
|
|
40
|
+
* Create language-specific configuration files
|
|
41
|
+
*/
|
|
42
|
+
private createLanguageConfigs;
|
|
43
|
+
/**
|
|
44
|
+
* Create virtual files in the temp directory
|
|
45
|
+
*/
|
|
46
|
+
private createVirtualFiles;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=Sandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sandbox.d.ts","sourceRoot":"","sources":["../../../src/environment/Sandbox.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAE/D,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAG3C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,IAAI,CAAA;IACV,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;CAC7B;AAED;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,SAAS,CAAY;gBAEjB,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;QAAE,WAAW,EAAE,WAAW,CAAC;QAAC,SAAS,EAAE,MAAM,IAAI,CAAA;KAAE;WAKvE,MAAM,CAAC,OAAO,EAAE,cAAc;IA6BlD;;OAEG;IACH,cAAc,IAAI,WAAW;IAI7B;;OAEG;IACH,OAAO,IAAI,IAAI;IAIf;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAwBhC;;OAEG;YACW,YAAY;IAQ1B;;OAEG;YACW,qBAAqB;IAuDnC;;OAEG;YACW,kBAAkB;CAQjC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Environment } from "powerlint/environment/Environment";
|
|
2
|
+
import type { Language } from "powerlint/languages";
|
|
3
|
+
/**
|
|
4
|
+
* Storage class manages cache and index storage directories
|
|
5
|
+
* Provides centralized storage management for the powerlint environment
|
|
6
|
+
*/
|
|
7
|
+
export declare class Storage {
|
|
8
|
+
private environment;
|
|
9
|
+
private cacheStore?;
|
|
10
|
+
constructor(environment: Environment);
|
|
11
|
+
/**
|
|
12
|
+
* Get the base storage directory for powerlint
|
|
13
|
+
* This replaces the getConfigDirectory functionality
|
|
14
|
+
*/
|
|
15
|
+
getStorageDirectory(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Get the base directory for indexes
|
|
18
|
+
*/
|
|
19
|
+
getIndexDirectory(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Get the base directory for caches
|
|
22
|
+
*/
|
|
23
|
+
getCacheDirectory(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Ensure a directory exists, creating it if necessary
|
|
26
|
+
*/
|
|
27
|
+
ensureDirectory(dirPath: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Get the file path for a specific index
|
|
30
|
+
* Ensures the index directory exists
|
|
31
|
+
*/
|
|
32
|
+
getIndexFilePath(language: Language, fileName?: string): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if an index exists for a language
|
|
35
|
+
*/
|
|
36
|
+
indexExists(language: Language, fileName?: string): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Read an index file for a language
|
|
39
|
+
*/
|
|
40
|
+
readIndex(language: Language, fileName?: string): Promise<Buffer | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Save an index file for a language
|
|
43
|
+
*/
|
|
44
|
+
saveIndex(language: Language, data: Buffer, fileName?: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Get the cache file path
|
|
47
|
+
*/
|
|
48
|
+
getCacheFilePath(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Purge all storage (cache and indexes)
|
|
51
|
+
* @returns Object with success status and details about what was purged
|
|
52
|
+
*/
|
|
53
|
+
purgeStorage(): Promise<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
deletedCount: number;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Purge only cache data
|
|
59
|
+
*/
|
|
60
|
+
purgeCache(): Promise<{
|
|
61
|
+
success: boolean;
|
|
62
|
+
deletedCount: number;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Get or initialize the cache store
|
|
66
|
+
*/
|
|
67
|
+
private getCacheStore;
|
|
68
|
+
/**
|
|
69
|
+
* Save data to cache
|
|
70
|
+
*/
|
|
71
|
+
saveCache(ruleId: string, cacheKey: string, data: any): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Read data from cache
|
|
74
|
+
*/
|
|
75
|
+
readCache<T = any>(ruleId: string, cacheKey: string): Promise<T | null>;
|
|
76
|
+
/**
|
|
77
|
+
* Purge only index data
|
|
78
|
+
*/
|
|
79
|
+
purgeIndexes(): Promise<{
|
|
80
|
+
success: boolean;
|
|
81
|
+
deletedCount: number;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=Storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../../src/environment/Storage.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGnD;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,UAAU,CAAC,CAAM;gBAEb,WAAW,EAAE,WAAW;IAIpC;;;OAGG;IACH,mBAAmB,IAAI,MAAM;IAI7B;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAQ3B;;OAEG;IACH,iBAAiB,IAAI,MAAM;IAQ3B;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD;;;OAGG;IACG,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ9E;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU1E;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAU9E;;OAEG;IACG,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKnF;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC;QAC5B,OAAO,EAAE,OAAO,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAC;IAkBF;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC;QAC1B,OAAO,EAAE,OAAO,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAC;IAkBF;;OAEG;IACH,OAAO,CAAC,aAAa;IAYrB;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3E;;OAEG;IACG,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAO7E;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC;QAC5B,OAAO,EAAE,OAAO,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAC;CAiBH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare const originalEmit: {
|
|
3
|
+
(event: "beforeExit", code: number): boolean;
|
|
4
|
+
(event: "disconnect"): boolean;
|
|
5
|
+
(event: "exit", code: number): boolean;
|
|
6
|
+
(event: "rejectionHandled", promise: Promise<unknown>): boolean;
|
|
7
|
+
(event: "uncaughtException", error: Error): boolean;
|
|
8
|
+
(event: "uncaughtExceptionMonitor", error: Error): boolean;
|
|
9
|
+
(event: "unhandledRejection", reason: unknown, promise: Promise<unknown>): boolean;
|
|
10
|
+
(event: "warning", warning: Error): boolean;
|
|
11
|
+
(event: "message", message: unknown, sendHandle: unknown): NodeJS.Process;
|
|
12
|
+
(event: NodeJS.Signals, signal?: NodeJS.Signals): boolean;
|
|
13
|
+
(event: "multipleResolves", type: NodeJS.MultipleResolveType, promise: Promise<unknown>, value: unknown): NodeJS.Process;
|
|
14
|
+
(event: "worker", listener: NodeJS.WorkerListener): NodeJS.Process;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AASA,QAAA,MAAM,YAAY;;;;;;;;;;;;;CAAe,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare enum Language {
|
|
2
|
+
Angular = "Angular",
|
|
3
|
+
Bash = "Bash",
|
|
4
|
+
C = "C",
|
|
5
|
+
Cpp = "Cpp",
|
|
6
|
+
Csharp = "Csharp",
|
|
7
|
+
Css = "Css",
|
|
8
|
+
Dart = "Dart",
|
|
9
|
+
Elixir = "Elixir",
|
|
10
|
+
Go = "Go",
|
|
11
|
+
Haskell = "Haskell",
|
|
12
|
+
Html = "Html",
|
|
13
|
+
Java = "Java",
|
|
14
|
+
JavaScript = "JavaScript",
|
|
15
|
+
Json = "Json",
|
|
16
|
+
Kotlin = "Kotlin",
|
|
17
|
+
Lua = "Lua",
|
|
18
|
+
Markdown = "Markdown",
|
|
19
|
+
Php = "Php",
|
|
20
|
+
Python = "Python",
|
|
21
|
+
Ruby = "Ruby",
|
|
22
|
+
Rust = "Rust",
|
|
23
|
+
Scala = "Scala",
|
|
24
|
+
Sql = "Sql",
|
|
25
|
+
Swift = "Swift",
|
|
26
|
+
Toml = "Toml",
|
|
27
|
+
Tsx = "Tsx",
|
|
28
|
+
TypeScript = "TypeScript",
|
|
29
|
+
Yaml = "Yaml",
|
|
30
|
+
GraphQL = "GraphQL",
|
|
31
|
+
Unknown = "Unknown"
|
|
32
|
+
}
|
|
33
|
+
export declare const REGISTERED_LANGUAGE_EXTENSIONS: Record<Language, string[]>;
|
|
34
|
+
export declare function getLanguageFromFilePath(filePath: string): Language;
|
|
35
|
+
export declare function getLanguageGlobsForLanguage(language: Language): string[];
|
|
36
|
+
//# sourceMappingURL=languages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/languages.ts"],"names":[],"mappings":"AAsCA,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,CAAC,MAAM;IACP,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,EAAE,OAAO;IACT,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAkFD,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAQrE,CAAA;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAIlE;AAQD,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,CAExE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { NapiConfig } from "@ast-grep/napi/types/config";
|
|
2
|
+
import type { Environment } from "powerlint/environment/Environment";
|
|
3
|
+
import { Language } from "powerlint/languages";
|
|
4
|
+
import type { AstProvider } from "powerlint/providers/LanguageBackend";
|
|
5
|
+
import { Match } from "powerlint/types";
|
|
6
|
+
/**
|
|
7
|
+
* Ast-grep implementation of AstProvider
|
|
8
|
+
* Provides pattern-based code matching using ast-grep
|
|
9
|
+
*/
|
|
10
|
+
export declare class AstGrepAstProvider implements AstProvider {
|
|
11
|
+
private environment;
|
|
12
|
+
private language;
|
|
13
|
+
constructor(environment: Environment, language: Language);
|
|
14
|
+
/**
|
|
15
|
+
* Find all matches based on ast-grep pattern
|
|
16
|
+
* @param filePaths File paths to search in (relative to workspace root)
|
|
17
|
+
* @param schema The ast-grep schema (rule, constraints, etc.)
|
|
18
|
+
* @returns Array of matches found
|
|
19
|
+
*/
|
|
20
|
+
findMatches(filePaths: string[], schema: NapiConfig): Promise<Match[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get optimal batch size based on available CPU cores and thread pool size
|
|
23
|
+
*/
|
|
24
|
+
private getBatchSize;
|
|
25
|
+
/**
|
|
26
|
+
* Process a batch of files with memory-efficient approach
|
|
27
|
+
*/
|
|
28
|
+
private processBatch;
|
|
29
|
+
/**
|
|
30
|
+
* Extract symbol name from ast-grep node if possible
|
|
31
|
+
*/
|
|
32
|
+
private extractSymbol;
|
|
33
|
+
/**
|
|
34
|
+
* Expand a match to its enclosing function, method, or class definition
|
|
35
|
+
* @param match The match to expand (typically a small range like a method name)
|
|
36
|
+
* @returns Expanded match with the full function/method/class body, or null if not found
|
|
37
|
+
*/
|
|
38
|
+
expandMatch(match: Match): Promise<Match | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Find the deepest node at a given position
|
|
41
|
+
*/
|
|
42
|
+
private findNodeAtPosition;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=AstGrepAstProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AstGrepAstProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/AstGrepAstProvider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,QAAQ,CAAU;gBAEd,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ;IAKxD;;;;;OAKG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAqB5E;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;YACW,YAAY;IAmD1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;;OAIG;IACG,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAyDtD;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAyB3B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Environment } from "powerlint/environment/Environment";
|
|
2
|
+
import type { Language } from "powerlint/languages";
|
|
3
|
+
import { ExecutionEventEmitter } from "powerlint/steps/ExecutionEventEmitter";
|
|
4
|
+
import { Match } from "powerlint/types";
|
|
5
|
+
/**
|
|
6
|
+
* Provider interface for AST-based code operations
|
|
7
|
+
*/
|
|
8
|
+
export interface AstProvider {
|
|
9
|
+
/**
|
|
10
|
+
* Find all matches based on the provider's matching strategy
|
|
11
|
+
* @param filePaths File paths to search in
|
|
12
|
+
* @param schema The provider-specific schema (RuleStep config without the "type" field)
|
|
13
|
+
* @returns Array of matches found
|
|
14
|
+
*/
|
|
15
|
+
findMatches(filePaths: string[], schema: Record<string, any>): Promise<Match[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Expand a match to its enclosing function, method, or class definition
|
|
18
|
+
* @param match The match to expand
|
|
19
|
+
* @returns The expanded match with full function/class body, or null if not found
|
|
20
|
+
*/
|
|
21
|
+
expandMatch(match: Match): Promise<Match | null>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Provider interface for code intelligence features (definitions, references)
|
|
25
|
+
* Providers should filter out external symbols internally by default
|
|
26
|
+
*/
|
|
27
|
+
export interface IntelligenceProvider {
|
|
28
|
+
/**
|
|
29
|
+
* Find all definitions for a given match
|
|
30
|
+
* @param match The match to find definitions for
|
|
31
|
+
* @returns Array of matches representing definition locations
|
|
32
|
+
*/
|
|
33
|
+
findDefinitions(match: Match): Promise<Match[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Find all references for a given match
|
|
36
|
+
* @param match The match to find references for
|
|
37
|
+
* @returns Array of matches representing reference locations
|
|
38
|
+
*/
|
|
39
|
+
findReferences(match: Match): Promise<Match[]>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Error thrown when a language backend method is not supported
|
|
43
|
+
*/
|
|
44
|
+
export declare class LanguageBackendNotSupportedError extends Error {
|
|
45
|
+
constructor(methodName: string, reason: string);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Language backend that delegates to various providers
|
|
49
|
+
* Manages providers for pattern matching, definitions, references, etc.
|
|
50
|
+
*/
|
|
51
|
+
export declare class LanguageBackend {
|
|
52
|
+
private astProvider?;
|
|
53
|
+
private intelligenceProvider?;
|
|
54
|
+
private language;
|
|
55
|
+
constructor(environment: Environment, language: Language, eventEmitter?: ExecutionEventEmitter);
|
|
56
|
+
/**
|
|
57
|
+
* Find all matches based on the AST provider
|
|
58
|
+
*/
|
|
59
|
+
findMatches(filePaths: string[], schema: Record<string, any>): Promise<Match[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Find all definitions for a given match
|
|
62
|
+
*/
|
|
63
|
+
findDefinitions(match: Match): Promise<Match[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Find all references for a given match
|
|
66
|
+
*/
|
|
67
|
+
findReferences(match: Match): Promise<Match[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Expand a match to its enclosing function, method, or class definition
|
|
70
|
+
* Useful for expanding a definition point (e.g., method name) to the full body
|
|
71
|
+
*/
|
|
72
|
+
expandMatch(match: Match): Promise<Match | null>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=LanguageBackend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguageBackend.d.ts","sourceRoot":"","sources":["../../../src/providers/LanguageBackend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAE/E;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAA;CACjD;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAE/C;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;CAC/C;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,KAAK;gBAC7C,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI/C;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,oBAAoB,CAAC,CAAsB;IACnD,OAAO,CAAC,QAAQ,CAAU;gBAEd,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,qBAAqB;IAO9F;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAUrF;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAUrD;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAUpD;;;OAGG;IACG,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CASvD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Rule } from "powerlint/types";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for rule providers that can load rules from different sources
|
|
4
|
+
*/
|
|
5
|
+
export interface RuleProvider {
|
|
6
|
+
/**
|
|
7
|
+
* Load a specific rule by its ID
|
|
8
|
+
* @param ruleId The unique identifier of the rule
|
|
9
|
+
* @returns Promise that resolves to the rule
|
|
10
|
+
* @throws Error if rule is not found
|
|
11
|
+
*/
|
|
12
|
+
loadRuleById(ruleId: string): Promise<Rule>;
|
|
13
|
+
/**
|
|
14
|
+
* Load all available rules from this provider
|
|
15
|
+
* @returns Promise that resolves to an array of all rules
|
|
16
|
+
*/
|
|
17
|
+
loadAllRules(): Promise<Rule[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new rule (optional - not all providers support this)
|
|
20
|
+
* @param rule The rule to create
|
|
21
|
+
* @returns Promise that resolves to the created rule ID
|
|
22
|
+
* @throws Error if creation is not supported or fails
|
|
23
|
+
*/
|
|
24
|
+
createRule?(rule: Rule): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Update an existing rule (optional - not all providers support this)
|
|
27
|
+
* @param ruleId The ID of the rule to update
|
|
28
|
+
* @param rule The updated rule data
|
|
29
|
+
* @throws Error if update is not supported or fails
|
|
30
|
+
*/
|
|
31
|
+
updateRule?(ruleId: string, rule: Rule): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete a rule (optional - not all providers support this)
|
|
34
|
+
* @param ruleId The ID of the rule to delete
|
|
35
|
+
* @throws Error if deletion is not supported or fails
|
|
36
|
+
*/
|
|
37
|
+
deleteRule?(ruleId: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration interface for rule providers
|
|
41
|
+
*/
|
|
42
|
+
export interface RuleProviderConfig {
|
|
43
|
+
type: string;
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=RuleProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/RuleProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAE3C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE3C;;;OAGG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;IAE/B;;;;;OAKG;IACH,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAExC;;;;;OAKG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEtD;;;;OAIG;IACH,UAAU,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB"}
|