mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 18:55:22 +00:00
feat: vendor permission system source
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import type {
|
||||
ExtensionCommandContext,
|
||||
ExtensionContext,
|
||||
} from "@earendil-works/pi-coding-agent";
|
||||
|
||||
import {
|
||||
EXTENSION_ID,
|
||||
isYoloModeEnabled,
|
||||
type PermissionSystemExtensionConfig,
|
||||
} from "./extension-config";
|
||||
|
||||
export const PERMISSION_SYSTEM_STATUS_KEY = EXTENSION_ID;
|
||||
export const PERMISSION_SYSTEM_YOLO_STATUS_VALUE = "yolo";
|
||||
|
||||
type PermissionStatusContext =
|
||||
| Pick<ExtensionContext, "hasUI" | "ui">
|
||||
| Pick<ExtensionCommandContext, "ui">;
|
||||
|
||||
export function getPermissionSystemStatus(
|
||||
config: PermissionSystemExtensionConfig,
|
||||
): string | undefined {
|
||||
return isYoloModeEnabled(config)
|
||||
? PERMISSION_SYSTEM_YOLO_STATUS_VALUE
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function syncPermissionSystemStatus(
|
||||
ctx: PermissionStatusContext,
|
||||
config: PermissionSystemExtensionConfig,
|
||||
): void {
|
||||
ctx.ui.setStatus(
|
||||
PERMISSION_SYSTEM_STATUS_KEY,
|
||||
getPermissionSystemStatus(config),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user