/ utils / permissions / bashClassifier.ts
bashClassifier.ts
 1  // Stub for external builds - classifier permissions feature is ANT-ONLY
 2  
 3  export const PROMPT_PREFIX = 'prompt:'
 4  
 5  export type ClassifierResult = {
 6    matches: boolean
 7    matchedDescription?: string
 8    confidence: 'high' | 'medium' | 'low'
 9    reason: string
10  }
11  
12  export type ClassifierBehavior = 'deny' | 'ask' | 'allow'
13  
14  export function extractPromptDescription(
15    _ruleContent: string | undefined,
16  ): string | null {
17    return null
18  }
19  
20  export function createPromptRuleContent(description: string): string {
21    return `${PROMPT_PREFIX} ${description.trim()}`
22  }
23  
24  export function isClassifierPermissionsEnabled(): boolean {
25    return false
26  }
27  
28  export function getBashPromptDenyDescriptions(_context: unknown): string[] {
29    return []
30  }
31  
32  export function getBashPromptAskDescriptions(_context: unknown): string[] {
33    return []
34  }
35  
36  export function getBashPromptAllowDescriptions(_context: unknown): string[] {
37    return []
38  }
39  
40  export async function classifyBashCommand(
41    _command: string,
42    _cwd: string,
43    _descriptions: string[],
44    _behavior: ClassifierBehavior,
45    _signal: AbortSignal,
46    _isNonInteractiveSession: boolean,
47  ): Promise<ClassifierResult> {
48    return {
49      matches: false,
50      confidence: 'high',
51      reason: 'This feature is disabled',
52    }
53  }
54  
55  export async function generateGenericDescription(
56    _command: string,
57    specificDescription: string | undefined,
58    _signal: AbortSignal,
59  ): Promise<string | null> {
60    return specificDescription || null
61  }