Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🧪 QA (push) Failing after 2m24s
Build & Deploy / 🏗️ Build (push) Failing after 3m40s
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🩺 Health Check (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import type { CollectionConfig } from "payload";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
export const ContextFiles: CollectionConfig = {
|
|
slug: "context-files",
|
|
labels: {
|
|
singular: "Context File",
|
|
plural: "Context Files",
|
|
},
|
|
admin: {
|
|
useAsTitle: "filename",
|
|
defaultColumns: ["filename", "updatedAt"],
|
|
},
|
|
access: {
|
|
read: () => true, // Needed for server actions to fetch context
|
|
create: () => true,
|
|
update: () => true,
|
|
delete: () => true,
|
|
},
|
|
hooks: {
|
|
afterChange: [
|
|
({ doc, operation }) => {
|
|
// Potential future: sync back to disk?
|
|
// For now, let's keep it simple as a CMS-first feature.
|
|
},
|
|
],
|
|
},
|
|
fields: [
|
|
{
|
|
name: "filename",
|
|
type: "text",
|
|
required: true,
|
|
unique: true,
|
|
admin: {
|
|
description:
|
|
"Exact filename (e.g. 'strategy.md'). The system uses this to identify the document during prompt generation.",
|
|
},
|
|
},
|
|
{
|
|
name: "content",
|
|
type: "textarea",
|
|
required: true,
|
|
admin: {
|
|
rows: 25,
|
|
description: "The raw markdown/text content of the document.",
|
|
style: { fontFamily: "monospace" },
|
|
},
|
|
},
|
|
],
|
|
};
|