<%- include("../../../src/web/views/partials/layout-top", { title }) %>
<%- include("../../../src/web/views/partials/page-header", { eyebrow: "Administration", pageTitle: "OKF Management", description: "Manage role-gated knowledge entries, review state, version history, and OKF-specific editing permissions." }) %> <% if (activeTab === "general") { %>
Reset
<% } else if (activeTab === "community") { %>

Community files are locally maintained OKF Markdown under knowledge/community.

<% } else { %>

System-generated files are read-only OKF Markdown from core and plugin metadata.

<% } %> <% categories.forEach((category) => { %> <% }) %> <% tags.forEach((tag) => { %> <% }) %>
<% if (activeTab === "general") { %>

Entries

<%= entries.length %> entr<%= entries.length === 1 ? "y" : "ies" %> shown.

Open OKF
<% if (!entries.length) { %>
No OKF entries match this filter.
<% } else { %>
<% entries.forEach((entry) => { %> <% }) %>
Entry Status Visibility Review Updated
<%= entry.title %>

<%= entry.slug %> · <%= entry.category || "General" %>

<%= entry.status %> <%= entry.visibility %> <%= entry.review_state %> <%= new Date(entry.updated_at).toLocaleString() %>
<% } %>
<% } %> <% if (activeTab === "community") { %>

Community OKF files

Edit community-specific Markdown knowledge stored under knowledge/community. Generated core and plugin files stay separate.

<%= communityFiles.length %> file<%= communityFiles.length === 1 ? "" : "s" %> shown.

<% if (!communityFiles.length) { %>
No community OKF files yet.
<% } else { %>
<% communityFiles.forEach((file) => { %> <% }) %>
FileCategoryStatusVisibilityUpdated
<%= file.title %>

<%= file.id %> · <%= file.slug %>.md

<%= file.category || "Community" %> <%= file.status %> <%= file.visibility %> <%= file.updated_at ? new Date(file.updated_at).toLocaleString() : "Unknown" %>
<% } %>
<%= selectedCommunity ? "Edit file" : "Create file" %>
Used as the Markdown filename.
Existing categories appear as suggestions.
Use comma-separated tags. Existing tags appear as suggestions while typing.
You can reference visible frontmatter values with placeholders such as {{community.currency.primary_name}}.
<% if (selectedCommunity && (selectedCommunity.generated || !selectedCommunity.editable)) { %>

This file is marked generated or non-editable and cannot be saved from this editor.

<% } %>
<% if (selectedCommunity) { %> Create new file <% } %>
<% if (selectedCommunity) { %>
Preview

<%= selectedCommunity.path %> · <%= selectedCommunity.id %>

<% } %>
<% } %> <% if (activeTab === "system") { %>

System-generated OKF

Read-only generated knowledge used by AI support and scoped by user permission level.

<%= systemFiles.length %> file<%= systemFiles.length === 1 ? "" : "s" %> shown. Generated files are rebuilt from repository metadata and are read-only here.

<% if (!systemFiles.length) { %>
No generated OKF files were found.
<% } else { %>
<% systemFiles.forEach((file) => { %> <% }) %>
FileScopeCategoryStatusVisibility
<%= file.title %>

<%= file.id %> · <%= file.path %>

<%= file.scope %> <%= file.category || "General" %> <%= file.status %> <%= file.visibility %>
<% } %>
Role-scoped support context

User, moderator, and admin visibility still applies during retrieval. Casual requests receive support-level facts; development-focused admin requests may use deeper technical details.

<% if (selectedSystemFile) { %>
<%= selectedSystemFile.title %>

<%= selectedSystemFile.path %> · <%= selectedSystemFile.id %> · <%= selectedSystemFile.status %> · <%= selectedSystemFile.visibility %>

<% } else if (systemFiles.length) { %>
Select a generated OKF file to preview its current Markdown.
<% } %>
<% } %> <% if (selected) { %> <% } %> <% if (activeTab === "general" && okfAccess.canManagePermissions) { %>

OKF permission grants

These grants are independent from normal Lumi admin/mod roles.

<% if (!permissions.length) { %>

No OKF-specific permissions have been granted.

<% } else { %>
<% permissions.forEach((grant) => { %> <% }) %>
User Level Granted Status
<%= grant.user_name || grant.user_id %> <%= grant.level %> <%= new Date(grant.created_at).toLocaleString() %>
by <%= grant.granted_by_name || grant.granted_by || "unknown" %>
<%= grant.revoked_at ? `Revoked ${new Date(grant.revoked_at).toLocaleString()}` : "Active" %> <% if (!grant.revoked_at) { %>
<% } %>
<% } %>
<% } %> <%- include("../../../src/web/views/partials/layout-bottom") %>