Codex Permissions
brainless/codex-permissionsFreeComponent
The /permissions chooser — numbered Default / Auto-review / Full Access options as a real radiogroup.
Install it
npx shadcn@latest add https://brainless.swerdlow.dev/r/codex-permissions.jsonSource
1"use client";23import * as React from "react";4import { cn } from "@/lib/utils";56/**7 * CodexPermissions — Codex CLI's `/permissions` chooser.8 *9 * Captured grammar (v0.132): a title, then a numbered list with a `›` on the10 * active row and wrapped descriptions. Footer: "Press enter to confirm or esc11 * to go back".12 */13const FG = "#ededed";14const DIM = "#7a7a7a";15const ACCENT = "#f6e2b7";1617export type CodexPermissionOption = {18 label: string;19 description: string;20 current?: boolean;21};2223const DEFAULT_OPTIONS: CodexPermissionOption[] = [24 {25 label: "Default",26 current: true,27 description:28 "Codex can read and edit files in the current workspace, and run commands. Approval is required to access the internet or edit other files.",29 },30 {31 label: "Auto-review",32 description:33 "Same workspace-write permissions as Default, but eligible `on-request` approvals are routed through the auto-reviewer subagent.",34 },35 {36 label: "Full Access",37 description:38 "Codex can edit files outside this workspace and access the internet without asking for approval. Exercise caution when using.",39 },40];4142export function CodexPermissions({43 title = "Update Model Permissions",44 options = DEFAULT_OPTIONS,45 defaultSelected = 0,46 onChoose,47 className,48}: {49 title?: string;50 options?: CodexPermissionOption[];51 defaultSelected?: number;52 onChoose?: (index: number) => void;53 className?: string;54}) {55 const [sel, setSel] = React.useState(defaultSelected);5657 function onKey(e: React.KeyboardEvent, i: number) {58 if (e.key === "ArrowDown" || e.key === "ArrowUp") {59 e.preventDefault();60 const next =61 e.key === "ArrowDown"62 ? (i + 1) % options.length63 : (i - 1 + options.length) % options.length;64 setSel(next);65 (e.currentTarget.parentElement?.children[next] as HTMLElement)?.focus();66 } else if (e.key === "Enter" || e.key === " ") {67 e.preventDefault();68 setSel(i);69 onChoose?.(i);70 }71 }7273 return (74 <div className={cn("font-mono text-[13px] leading-[1.55]", className)}>75 <div className="mb-2 font-semibold" style={{ color: FG }}>76 {title}77 </div>7879 <div role="radiogroup" aria-label={title} className="space-y-2">80 {options.map((opt, i) => {81 const active = sel === i;82 return (83 <div84 key={opt.label}85 role="radio"86 aria-checked={active}87// … truncated
Files it writes
More from brainless
All 40 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Claude Diffclaude-diff | brainless | Components | Free | no deps | |
| Claude Headerclaude-header | brainless | Components | Free | no deps | |
| Claude Messageclaude-message | brainless | Components | Free | no deps | |
| Claude Permissionclaude-permission | brainless | Components | Free | no deps | |
| Claude Promptclaude-prompt | brainless | Components | Free | no deps | |
| Claude Slash Menuclaude-slash-menu | brainless | Components | Free | no deps | |
| Claude Thinkingclaude-thinking | brainless | Components | Free | no deps | |
| Claude Todo Listclaude-todo-list | brainless | Components | Free | no deps |
