diff --git a/client/src/components/config/EditorModal.tsx b/client/src/components/config/EditorModal.tsx index 8f5ac1f5..75066ae0 100644 --- a/client/src/components/config/EditorModal.tsx +++ b/client/src/components/config/EditorModal.tsx @@ -30,6 +30,10 @@ export type EditorState = } | null; +/** Types that are a single fixed file per scope (e.g. Claude's CLAUDE.md, Codex's + * AGENTS.md / config.toml) - no `name` field, and no artifact name is ever sent. */ +const DEFAULT_NAMELESS_TYPES = ["memory"]; + interface EditorModalProps { state: NonNullable>; fetchContent: (filePath: string) => Promise; @@ -41,6 +45,9 @@ interface EditorModalProps { content: string; project?: string; }) => Promise; + /** Which `state.type` values are nameless singleton files. Defaults to + * Claude Code's own `["memory"]` so existing callers are unaffected. */ + namelessTypes?: readonly string[]; } export function EditorModal({ @@ -48,9 +55,11 @@ export function EditorModal({ fetchContent, onClose, onSave, + namelessTypes = DEFAULT_NAMELESS_TYPES, }: EditorModalProps) { const { t } = useTranslation("ccConfig"); const isCreate = state.mode === "create"; + const isNameless = namelessTypes.includes(state.type); const isAutoMemory = state.type === "auto-memory"; const [content, setContent] = useState(isCreate ? state.template : ""); const [name, setName] = useState(""); @@ -91,7 +100,7 @@ export function EditorModal({ setSaving(true); setError(null); try { - if (state.type !== "memory" && state.mode === "create" && !name) { + if (!isNameless && state.mode === "create" && !name) { setError(t("edit.nameLabel")); setSaving(false); return; @@ -99,7 +108,7 @@ export function EditorModal({ // For auto-memory creates, append a .md extension when the user omits it. const createName = isAutoMemory && !/\.md$/i.test(name) ? `${name}.md` : name; const effectiveName = - state.mode === "edit" ? state.name : state.type === "memory" ? undefined : createName; + state.mode === "edit" ? state.name : isNameless ? undefined : createName; await onSave({ type: state.type, targetScope: isAutoMemory ? "auto-memory" : targetScope, @@ -143,7 +152,7 @@ export function EditorModal({
- {isCreate && state.type !== "memory" && ( + {isCreate && !isNameless && (