π File detail
utils/permissions/bashClassifier.ts
π§© .tsπ 62 linesπΎ 1,444 bytesπ text
β Back to All Filesπ― Use case
This file lives under βutils/β, which covers cross-cutting helpers (shell, tempfiles, settings, messages, process input, β¦). On the API surface it exposes PROMPT_PREFIX, ClassifierResult, ClassifierBehavior, extractPromptDescription, and createPromptRuleContent (and more) β mainly functions, hooks, or classes.
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
// Stub for external builds - classifier permissions feature is ANT-ONLY export const PROMPT_PREFIX = 'prompt:' export type ClassifierResult = {
π€ Exports (heuristic)
PROMPT_PREFIXClassifierResultClassifierBehaviorextractPromptDescriptioncreatePromptRuleContentisClassifierPermissionsEnabledgetBashPromptDenyDescriptionsgetBashPromptAskDescriptionsgetBashPromptAllowDescriptionsclassifyBashCommandgenerateGenericDescription
π₯οΈ Source preview
// Stub for external builds - classifier permissions feature is ANT-ONLY
export const PROMPT_PREFIX = 'prompt:'
export type ClassifierResult = {
matches: boolean
matchedDescription?: string
confidence: 'high' | 'medium' | 'low'
reason: string
}
export type ClassifierBehavior = 'deny' | 'ask' | 'allow'
export function extractPromptDescription(
_ruleContent: string | undefined,
): string | null {
return null
}
export function createPromptRuleContent(description: string): string {
return `${PROMPT_PREFIX} ${description.trim()}`
}
export function isClassifierPermissionsEnabled(): boolean {
return false
}
export function getBashPromptDenyDescriptions(_context: unknown): string[] {
return []
}
export function getBashPromptAskDescriptions(_context: unknown): string[] {
return []
}
export function getBashPromptAllowDescriptions(_context: unknown): string[] {
return []
}
export async function classifyBashCommand(
_command: string,
_cwd: string,
_descriptions: string[],
_behavior: ClassifierBehavior,
_signal: AbortSignal,
_isNonInteractiveSession: boolean,
): Promise<ClassifierResult> {
return {
matches: false,
confidence: 'high',
reason: 'This feature is disabled',
}
}
export async function generateGenericDescription(
_command: string,
specificDescription: string | undefined,
_signal: AbortSignal,
): Promise<string | null> {
return specificDescription || null
}