bashClassifier.ts
utils/permissions/bashClassifier.ts
62
Lines
1444
Bytes
11
Exports
0
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with shell-safety, permissions. It contains 62 lines, 0 detected imports, and 11 detected exports.
Important relationships
- utils/permissions/PermissionMode.ts
- utils/permissions/PermissionPromptToolResultSchema.ts
- utils/permissions/PermissionResult.ts
- utils/permissions/PermissionRule.ts
- utils/permissions/PermissionUpdate.ts
- utils/permissions/PermissionUpdateSchema.ts
- utils/permissions/autoModeState.ts
- utils/permissions/bypassPermissionsKillswitch.ts
Detected exports
PROMPT_PREFIXClassifierResultClassifierBehaviorextractPromptDescriptioncreatePromptRuleContentisClassifierPermissionsEnabledgetBashPromptDenyDescriptionsgetBashPromptAskDescriptionsgetBashPromptAllowDescriptionsclassifyBashCommandgenerateGenericDescription
Keywords
contextunknownfeatureprompt_prefixclassifierresultmatchesconfidencehighreasonclassifierbehavior
Detected imports
- No import paths detected.
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
// 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
}