@runhalo/engine 0.3.0 → 0.4.0
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/index.d.ts +54 -0
- package/dist/index.js +442 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/rules/rules.json +1005 -0
package/dist/index.d.ts
CHANGED
|
@@ -51,6 +51,43 @@ export interface SuppressionConfig {
|
|
|
51
51
|
commentPattern: string;
|
|
52
52
|
}
|
|
53
53
|
export declare function loadRulesFromYAML(yamlPath: string): Rule[];
|
|
54
|
+
export interface JSONRuleConfig {
|
|
55
|
+
version: string;
|
|
56
|
+
generated_at: string;
|
|
57
|
+
packs: Record<string, {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
jurisdiction: string;
|
|
62
|
+
jurisdiction_level: string;
|
|
63
|
+
is_free: boolean;
|
|
64
|
+
effective_date: string | null;
|
|
65
|
+
source_url: string;
|
|
66
|
+
}>;
|
|
67
|
+
rules: JSONRule[];
|
|
68
|
+
}
|
|
69
|
+
export interface JSONRule {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
severity: Severity;
|
|
73
|
+
category: string;
|
|
74
|
+
description: string;
|
|
75
|
+
patterns: Array<{
|
|
76
|
+
pattern: string;
|
|
77
|
+
flags: string;
|
|
78
|
+
}>;
|
|
79
|
+
fix_suggestion: string;
|
|
80
|
+
penalty: string;
|
|
81
|
+
languages: string[];
|
|
82
|
+
packs: string[];
|
|
83
|
+
fixability: string;
|
|
84
|
+
transform_type: string | null;
|
|
85
|
+
scaffold_id: string | null;
|
|
86
|
+
guidance_url: string | null;
|
|
87
|
+
}
|
|
88
|
+
export declare function loadRulesFromJSON(jsonPath: string): Rule[];
|
|
89
|
+
export declare function loadRulesFromJSONByPack(jsonPath: string, packIds: string[]): Rule[];
|
|
90
|
+
export declare function compileRawRules(rawRules: JSONRule[]): Rule[];
|
|
54
91
|
export declare class TreeSitterParser {
|
|
55
92
|
private parser;
|
|
56
93
|
constructor();
|
|
@@ -79,6 +116,8 @@ declare const REMEDIATION_MAP: Record<string, RemediationSpec>;
|
|
|
79
116
|
declare function getRemediation(ruleId: string): RemediationSpec;
|
|
80
117
|
export declare const COPPA_RULES: Rule[];
|
|
81
118
|
export declare const ETHICAL_RULES: Rule[];
|
|
119
|
+
export declare const AI_AUDIT_RULES: Rule[];
|
|
120
|
+
export declare const AU_SBD_RULES: Rule[];
|
|
82
121
|
export interface IgnoreConfig {
|
|
83
122
|
/** File glob patterns to ignore entirely */
|
|
84
123
|
ignoredFiles: string[];
|
|
@@ -120,6 +159,10 @@ export interface EngineConfig {
|
|
|
120
159
|
ignoreConfig?: IgnoreConfig;
|
|
121
160
|
projectDomains?: string[];
|
|
122
161
|
ethical?: boolean;
|
|
162
|
+
aiAudit?: boolean;
|
|
163
|
+
sectorAuSbd?: boolean;
|
|
164
|
+
packs?: string[];
|
|
165
|
+
loadedRules?: Rule[];
|
|
123
166
|
}
|
|
124
167
|
export interface ScanResult {
|
|
125
168
|
filePath: string;
|
|
@@ -134,6 +177,17 @@ export declare class HaloEngine {
|
|
|
134
177
|
private rules;
|
|
135
178
|
private treeSitter;
|
|
136
179
|
constructor(config?: EngineConfig);
|
|
180
|
+
/**
|
|
181
|
+
* Load rules from the bundled rules.json file, filtered by pack IDs.
|
|
182
|
+
* Falls back to empty array if rules.json not found.
|
|
183
|
+
*/
|
|
184
|
+
private loadBundledRulesByPack;
|
|
185
|
+
/**
|
|
186
|
+
* Resolve legacy boolean flags to pack IDs.
|
|
187
|
+
* Maps ethical/aiAudit/sectorAuSbd booleans to their pack ID equivalents.
|
|
188
|
+
* Always includes 'coppa' as the base pack.
|
|
189
|
+
*/
|
|
190
|
+
static resolvePacks(config: EngineConfig): string[];
|
|
137
191
|
/**
|
|
138
192
|
* Get the tree-sitter parser for advanced AST analysis
|
|
139
193
|
*/
|