feat(codex-skills): surface built-in .system skills as read-only

Scan ~/.codex/skills/.system so Codex CLI's bundled skills (imagegen,
skill-creator, etc.) appear in the $ autocomplete and Skills settings.
Mark them read_only on the API; the save/delete handlers refuse writes
to that path, and the UI shows a system badge with a tooltip and
disables edit/delete/save for those entries.
This commit is contained in:
xintaofei
2026-04-24 14:18:36 +08:00
parent e9c3076197
commit 0e09711e56
14 changed files with 101 additions and 5 deletions

View File

@@ -990,6 +990,15 @@ export function SkillsSettings() {
>
{skill.scope}
</Badge>
{skill.read_only && (
<Badge
variant="outline"
title={t("systemHint")}
className="h-6 px-2 inline-flex items-center gap-1 text-xs leading-none shrink-0 border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-400"
>
{t("systemBadge")}
</Badge>
)}
</div>
<div className="text-[11px] text-muted-foreground truncate mt-1">
{skill.path}
@@ -1010,6 +1019,7 @@ export function SkillsSettings() {
{t("actions.preview")}
</ContextMenuItem>
<ContextMenuItem
disabled={skill.read_only}
onSelect={() => {
handleEditSkill(skill).catch((err) => {
console.error(
@@ -1034,7 +1044,12 @@ export function SkillsSettings() {
{t("actions.openInWindow")}
</ContextMenuItem>
<ContextMenuItem
disabled={skillSaving || skillReading || deleting}
disabled={
skillSaving ||
skillReading ||
deleting ||
skill.read_only
}
onSelect={() => {
handleRequestDeleteSkill(skill)
}}
@@ -1097,10 +1112,19 @@ export function SkillsSettings() {
selectedSkillId || isDrafting ? (
<div className="h-full flex flex-col">
<div className="border-b px-4 py-3 flex items-center justify-between gap-3">
<div className="min-w-0">
<div className="min-w-0 flex items-center gap-2">
<h3 className="text-sm font-semibold truncate">
{skillDraftId.trim() || t("newSkillTitle")}
</h3>
{selectedSkill?.read_only && (
<Badge
variant="outline"
title={t("systemHint")}
className="h-5 px-1.5 text-[10px] leading-none shrink-0 border-amber-500/40 bg-amber-500/10 text-amber-600 dark:text-amber-400"
>
{t("systemBadge")}
</Badge>
)}
</div>
<div className="flex items-center gap-1.5 shrink-0">
@@ -1123,7 +1147,11 @@ export function SkillsSettings() {
)
})
}}
disabled={skillSaving || skillReading}
disabled={
skillSaving ||
skillReading ||
Boolean(selectedSkill?.read_only)
}
>
{skillSaving ? (
<>
@@ -1189,7 +1217,10 @@ export function SkillsSettings() {
onClick={() => {
setIsContentEditing((prev) => !prev)
}}
disabled={skillReading}
disabled={
skillReading ||
Boolean(selectedSkill?.read_only)
}
>
{isContentEditing ? (
<>

View File

@@ -302,6 +302,8 @@
"loadingSkill": "جارٍ تحميل Skill...",
"emptyNoAgents": "لا يوجد وكيل متاح.",
"noSelectionHint": "اختر Skill من اليسار، أو انقر على \"Skill جديد\" لإنشاء واحد.",
"systemBadge": "نظام",
"systemHint": "Skill مدمج في CLI · للقراءة فقط",
"scope": {
"global": "عام",
"folder": "مجلد",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Skill wird geladen...",
"emptyNoAgents": "Kein verfügbarer Agent.",
"noSelectionHint": "Wählen Sie links einen Skill oder klicken Sie auf „Neuer Skill“, um einen zu erstellen.",
"systemBadge": "System",
"systemHint": "Integrierter CLI-Skill · schreibgeschützt",
"scope": {
"global": "Global",
"folder": "Ordner",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Loading skill...",
"emptyNoAgents": "No available agent.",
"noSelectionHint": "Select a skill on the left, or click \"New Skill\" to create one.",
"systemBadge": "System",
"systemHint": "Built-in CLI skill · read-only",
"scope": {
"global": "Global",
"folder": "Folder",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Cargando Skill...",
"emptyNoAgents": "No hay agentes disponibles.",
"noSelectionHint": "Selecciona un Skill a la izquierda o haz clic en \"Nuevo Skill\" para crear uno.",
"systemBadge": "Sistema",
"systemHint": "Skill integrado del CLI · solo lectura",
"scope": {
"global": "Global",
"folder": "Carpeta",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Chargement de la Skill...",
"emptyNoAgents": "Aucun agent disponible.",
"noSelectionHint": "Sélectionnez un Skill à gauche ou cliquez sur « Nouveau Skill » pour en créer un.",
"systemBadge": "Système",
"systemHint": "Skill intégré du CLI · lecture seule",
"scope": {
"global": "Global",
"folder": "Dossier",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Skillを読み込み中...",
"emptyNoAgents": "利用可能なエージェントがありません。",
"noSelectionHint": "左側から Skill を選択するか、「新規 Skill」をクリックして作成してください。",
"systemBadge": "システム",
"systemHint": "CLI 組み込み Skill・読み取り専用",
"scope": {
"global": "グローバル",
"folder": "フォルダ",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Skill 불러오는 중...",
"emptyNoAgents": "사용 가능한 에이전트가 없습니다.",
"noSelectionHint": "왼쪽에서 Skill을 선택하거나 \"새 Skill\"을 클릭하여 만드세요.",
"systemBadge": "시스템",
"systemHint": "CLI 내장 Skill · 읽기 전용",
"scope": {
"global": "전역",
"folder": "폴더",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "Carregando Skill...",
"emptyNoAgents": "Nenhum agente disponível.",
"noSelectionHint": "Selecione um Skill à esquerda ou clique em \"Novo Skill\" para criar um.",
"systemBadge": "Sistema",
"systemHint": "Skill integrado do CLI · somente leitura",
"scope": {
"global": "Global",
"folder": "Pasta",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "正在加载 Skill...",
"emptyNoAgents": "暂无可用 Agent。",
"noSelectionHint": "从左侧选择一个 Skill或点击“新建 Skill”创建。",
"systemBadge": "系统",
"systemHint": "CLI 内置 Skill · 只读",
"scope": {
"global": "全局",
"folder": "文件夹",

View File

@@ -302,6 +302,8 @@
"loadingSkill": "正在載入 Skill...",
"emptyNoAgents": "暫無可用 Agent。",
"noSelectionHint": "從左側選擇一個 Skill或點擊「新建 Skill」建立。",
"systemBadge": "系統",
"systemHint": "CLI 內建 Skill · 唯讀",
"scope": {
"global": "全域",
"folder": "資料夾",

View File

@@ -557,6 +557,7 @@ export interface AgentSkillItem {
scope: AgentSkillScope
layout: AgentSkillLayout
path: string
read_only: boolean
}
export interface AgentSkillsListResult {