@valkyrianlabs/payload-markdown-docs 0.1.0-canary.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Valkyrian Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,41 +1,44 @@
1
1
  # @valkyrianlabs/payload-markdown-docs
2
2
 
3
- Git-backed Markdown documentation sync for Payload CMS, powered by `@valkyrianlabs/payload-markdown`.
3
+ Git-backed Markdown documentation sync for Payload CMS, powered by
4
+ `@valkyrianlabs/payload-markdown`.
4
5
 
5
- `payload-markdown-docs` lets developers and agents maintain Markdown in a repo-local `docs/` folder, validate it in CI, sign a manifest, and publish it into server-owned Payload docs sets.
6
+ This package has two sides:
6
7
 
7
- The client sends docs content. The Payload plugin decides where it may go.
8
+ - The docs repo keeps Markdown files in source control and uses the CLI to
9
+ validate, plan, and push them.
10
+ - The Payload server installs the plugin, verifies signed or GitHub OIDC
11
+ requests, and writes generated docs records into Payload-owned collections.
8
12
 
9
- ## Current Status
13
+ The sync endpoint is not the human docs route. If your Payload site is deployed
14
+ at `https://docs.valkyrianlabs.com`, the default sync endpoint is:
10
15
 
11
- Implemented:
12
-
13
- - docs groups and docs sets as the user-facing model
14
- - generated/internal docs records linked to docs sets
15
- - route reservations and optional docs-side Pages collision checks
16
- - signed sync endpoint with nonce replay protection
17
- - CLI commands for `validate`, `manifest`, `plan`, `keygen`, and signed `push`
18
- - dedicated docs create/update/archive/draft/delete lifecycle behind server gates
19
- - publishing controls for draft-enabled dedicated docs collections
20
- - read-only `/next` route adapter, sidebar helper, metadata helper, and page component
21
- - read-only Docs Set Admin Manager
22
- - local agent skill installer
23
- - GitHub Actions OIDC auth mode
24
- - real `/docs` dogfood documentation set
16
+ ```text
17
+ https://docs.valkyrianlabs.com/api/payload-markdown-docs/sync
18
+ ```
25
19
 
26
- Not implemented yet:
20
+ The human docs route is whatever docs set route base you configure, for example:
27
21
 
28
- - existing collection targets
29
- - block targets
30
- - inline override editing from the docs set manager
22
+ ```text
23
+ https://docs.valkyrianlabs.com/plugins/payload-markdown-docs
24
+ ```
31
25
 
32
26
  ## Install
33
27
 
28
+ Install this package in the Payload app that will receive and render docs:
29
+
34
30
  ```bash
35
31
  pnpm add @valkyrianlabs/payload-markdown-docs @valkyrianlabs/payload-markdown
36
32
  ```
37
33
 
38
- ## Minimal Config
34
+ Install the same package in any repo whose CI will run the
35
+ `payload-markdown-docs` CLI.
36
+
37
+ ## 1. Configure The Payload Server
38
+
39
+ Add the plugin to `payload.config.ts`. Keep source authorization in Payload
40
+ Admin docs sets; the plugin config should define the endpoint, collections, and
41
+ sync lifecycle behavior.
39
42
 
40
43
  ```ts
41
44
  import { payloadMarkdownDocs } from '@valkyrianlabs/payload-markdown-docs'
@@ -45,151 +48,235 @@ export default buildConfig({
45
48
  plugins: [
46
49
  payloadMarkdownDocs({
47
50
  enabled: true,
51
+
52
+ // Optional default OIDC audience. Repository/workflow/environment
53
+ // allowlists belong on the docs set in Payload Admin.
54
+ auth: {
55
+ githubOidc: {
56
+ audience: 'payload-markdown-docs',
57
+ },
58
+ },
59
+
60
+ target: {
61
+ type: 'docsCollection',
62
+ enableDrafts: true,
63
+ },
64
+
65
+ sync: {
66
+ allowWrites: true,
67
+ allowPublish: true,
68
+ allowHardDelete: false,
69
+ defaultPublishMode: 'draft',
70
+ deleteBehavior: 'archive',
71
+ },
48
72
  }),
49
73
  ],
50
74
  })
51
75
  ```
52
76
 
53
- ## Dedicated Docs Config
77
+ What this does:
78
+
79
+ - Adds docs groups, docs sets, generated docs, sync run, and nonce collections.
80
+ - Registers the default Payload custom endpoint at
81
+ `/api/payload-markdown-docs/sync`.
82
+ - Accepts Ed25519 signed requests or GitHub OIDC bearer requests on the same
83
+ endpoint when the matched docs set has those auth policies.
84
+ - Uses docs sets in Payload Admin as the source allow-list. `sources` still
85
+ exists as a legacy fallback, but it is not the recommended path.
86
+ - Allows sync writes and publish requests, while archiving removed docs instead
87
+ of hard-deleting them.
88
+
89
+ If you configure `allowedRefs` on a docs set, remember release workflows run on
90
+ tag refs like `refs/tags/v0.1.0-canary.1`. The first pass uses exact string
91
+ matches, not glob patterns. For release publishing, constrain by repository and
92
+ workflow unless you want to list exact tag refs.
93
+
94
+ ## 2. Create The Docs Set
95
+
96
+ In Payload Admin, create a docs set with values that match the CLI and server
97
+ config:
98
+
99
+ - `sourceId`: `payload-markdown-docs`
100
+ - `sourceRoot`: `docs`
101
+ - `routeBase`: `/plugins/payload-markdown-docs`
102
+ - `title`: Payload Markdown Docs
103
+ - `auth.githubOidc.enabled`: checked
104
+ - `auth.githubOidc.allowedRepositories`: `valkyrianlabs/payload-markdown-docs`
105
+ - optionally restrict `auth.githubOidc.allowedWorkflows`,
106
+ `auth.githubOidc.allowedEnvironments`, or exact `auth.githubOidc.allowedRefs`
107
+ - optionally add `auth.ed25519.keys` with `keyId` and `publicKey` for local
108
+ machines or non-GitHub CI
109
+
110
+ The CLI sends `source.id`. The server uses that id to find the docs set and
111
+ decide where generated routes live and which credentials may update it. You can
112
+ add a new docs source by creating a new docs set in Payload Admin; you should
113
+ not need to redeploy the Payload app just to add another docs package.
114
+
115
+ ## 3. Render Docs In Next
116
+
117
+ The plugin writes docs records. Your Next route renders them.
118
+
119
+ ```tsx
120
+ import config from '@payload-config'
121
+ import {
122
+ PayloadMarkdownDocsPage,
123
+ resolvePayloadMarkdownDocsRoute,
124
+ } from '@valkyrianlabs/payload-markdown-docs/next'
125
+ import { notFound } from 'next/navigation'
126
+ import { getPayload } from 'payload'
127
+
128
+ export default async function Page({
129
+ params,
130
+ }: {
131
+ params: Promise<{ slug?: string[] }>
132
+ }) {
133
+ const { slug } = await params
134
+ const payload = await getPayload({ config })
135
+ const resolved = await resolvePayloadMarkdownDocsRoute({ payload, slug })
136
+
137
+ if (resolved) {
138
+ return <PayloadMarkdownDocsPage resolved={resolved} />
139
+ }
140
+
141
+ notFound()
142
+ }
143
+ ```
54
144
 
55
- ```ts
56
- payloadMarkdownDocs({
57
- enabled: true,
58
-
59
- auth: {
60
- mode: 'ed25519',
61
- keys: [
62
- {
63
- id: 'github-actions-main',
64
- publicKey: process.env.DOCS_SYNC_PUBLIC_KEY!,
65
- },
66
- ],
67
- },
68
-
69
- target: {
70
- type: 'docsCollection',
71
- enableDrafts: true,
72
- },
73
-
74
- sources: [
75
- {
76
- id: 'main-docs',
77
- root: 'docs',
78
- routeBase: '/docs',
79
- },
80
- ],
145
+ In a real app, fall back to your normal Pages lookup instead of calling
146
+ `notFound()` immediately.
81
147
 
82
- sync: {
83
- allowWrites: true,
84
- allowPublish: true,
85
- allowHardDelete: false,
86
- defaultPublishMode: 'draft',
87
- deleteBehavior: 'archive',
88
- },
89
- })
148
+ ## 4. Add Docs Source Files
149
+
150
+ Keep docs in `docs/` and commit the AI Markdown Export manifest next to them.
151
+ The manifest controls the generated raw Markdown export; it is not a human docs
152
+ page and should not appear in human navigation.
153
+
154
+ ```text
155
+ docs/
156
+ index.md
157
+ install.md
158
+ usage.md
159
+ index.ai.yml
90
160
  ```
91
161
 
92
- GitHub Actions can use OIDC instead of a long-lived private key:
162
+ Example `docs/index.ai.yml`:
93
163
 
94
- ```ts
95
- payloadMarkdownDocs({
96
- enabled: true,
97
-
98
- auth: {
99
- mode: 'github-oidc',
100
- audience: 'payload-markdown-docs',
101
- allowedRepositories: ['valkyrianlabs/payload-markdown-docs'],
102
- allowedRefs: ['refs/heads/main'],
103
- },
104
-
105
- target: {
106
- type: 'docsCollection',
107
- enableDrafts: true,
108
- },
109
-
110
- sync: {
111
- allowWrites: true,
112
- allowPublish: true,
113
- },
114
- })
164
+ ```yaml
165
+ version: 1
166
+
167
+ title: Payload Markdown Docs
168
+ canonical: /plugins/payload-markdown-docs
169
+ output: /plugins/payload-markdown-docs.md
170
+
171
+ description: >
172
+ Consolidated AI-facing documentation export for Payload Markdown Docs.
173
+
174
+ preamble: |
175
+ This file is intended for AI agents, editor tooling, Codex, ChatGPT,
176
+ and offline reference.
177
+
178
+ order:
179
+ - ./index.md
180
+ - ./install.md
181
+ - ./usage.md
182
+
183
+ exclude:
184
+ - ./drafts/**
185
+
186
+ orphans: append
187
+ headingMode: normalize
115
188
  ```
116
189
 
117
- ## Quick Commands
190
+ ## 5. Validate Locally
191
+
192
+ Validation does not contact the server:
118
193
 
119
194
  ```bash
120
- pnpm exec payload-markdown-docs keygen --out .docs-sync
121
- pnpm exec payload-markdown-docs validate ./docs --source main-docs
122
- pnpm exec payload-markdown-docs manifest ./docs --source main-docs --pretty
123
- pnpm exec payload-markdown-docs plan ./docs --source main-docs
124
- pnpm exec payload-markdown-docs install skill --codex
195
+ pnpm exec payload-markdown-docs validate ./docs \
196
+ --source payload-markdown-docs \
197
+ --route-base /plugins/payload-markdown-docs
125
198
  ```
126
199
 
127
- Signed dry-run:
200
+ Preview the manifest or plan:
128
201
 
129
202
  ```bash
130
- pnpm exec payload-markdown-docs push ./docs \
131
- --endpoint "$DOCS_SYNC_ENDPOINT" \
132
- --source main-docs \
133
- --key-id github-actions-main \
134
- --private-key-file .docs-sync/docs-sync-private.pem \
135
- --dry-run
203
+ pnpm exec payload-markdown-docs manifest ./docs \
204
+ --source payload-markdown-docs \
205
+ --route-base /plugins/payload-markdown-docs \
206
+ --pretty
207
+ ```
208
+
209
+ ```bash
210
+ pnpm exec payload-markdown-docs plan ./docs \
211
+ --source payload-markdown-docs \
212
+ --route-base /plugins/payload-markdown-docs
213
+ ```
214
+
215
+ ## 6. Publish From GitHub Actions
216
+
217
+ GitHub OIDC only works inside GitHub Actions. The workflow needs:
218
+
219
+ ```yaml
220
+ permissions:
221
+ contents: read
222
+ id-token: write
136
223
  ```
137
224
 
138
- Signed sync and publish:
225
+ Then push docs to the Payload sync endpoint:
139
226
 
140
227
  ```bash
141
228
  pnpm exec payload-markdown-docs push ./docs \
142
- --endpoint "$DOCS_SYNC_ENDPOINT" \
143
- --source main-docs \
144
- --key-id github-actions-main \
145
- --private-key-env DOCS_SYNC_PRIVATE_KEY \
229
+ --endpoint "https://docs.valkyrianlabs.com/api/payload-markdown-docs/sync" \
230
+ --source payload-markdown-docs \
231
+ --route-base /plugins/payload-markdown-docs \
232
+ --repository "$GITHUB_REPOSITORY" \
233
+ --branch "$GITHUB_REF_NAME" \
234
+ --commit "$GITHUB_SHA" \
235
+ --github-oidc \
236
+ --oidc-audience payload-markdown-docs \
146
237
  --sync \
147
238
  --publish
148
239
  ```
149
240
 
150
- GitHub OIDC sync from Actions:
241
+ `--sync` only works when the server has `sync.allowWrites: true`.
242
+ `--publish` also requires `sync.allowPublish: true` and
243
+ `target.enableDrafts: true`.
244
+
245
+ For non-GitHub CI, use Ed25519 keys instead of OIDC:
151
246
 
152
247
  ```bash
248
+ pnpm exec payload-markdown-docs keygen --out .docs-sync
153
249
  pnpm exec payload-markdown-docs push ./docs \
154
250
  --endpoint "$DOCS_SYNC_ENDPOINT" \
155
- --source main-docs \
156
- --github-oidc \
157
- --oidc-audience payload-markdown-docs \
251
+ --source payload-markdown-docs \
252
+ --key-id github-actions-main \
253
+ --private-key-env DOCS_SYNC_PRIVATE_KEY \
158
254
  --sync \
159
255
  --publish
160
256
  ```
161
257
 
162
- `--sync` requires `sync.allowWrites: true`. `--publish` requires `sync.allowPublish: true` and `target.enableDrafts: true`. Hard delete requires `sync.allowHardDelete: true`.
258
+ ## This Repo
259
+
260
+ This repo's release workflow publishes the npm package first, then pushes
261
+ `./docs` to:
262
+
263
+ ```text
264
+ https://docs.valkyrianlabs.com/api/payload-markdown-docs/sync
265
+ ```
266
+
267
+ using:
163
268
 
164
- ## Documentation
269
+ - source id: `payload-markdown-docs`
270
+ - route base: `/plugins/payload-markdown-docs`
271
+ - auth: GitHub OIDC configured on the matching docs set
272
+ - mode: sync and publish
165
273
 
166
- The real plugin docs now live in [`docs/`](docs/index.md). Start with:
274
+ ## More Docs
167
275
 
168
- - [Overview](docs/index.md)
169
276
  - [Installation](docs/getting-started/installation.md)
170
277
  - [Quick Start](docs/getting-started/quick-start.md)
171
- - [Architecture](docs/concepts/architecture.md)
278
+ - [Plugin Config](docs/configuration/plugin-config.md)
172
279
  - [GitHub OIDC](docs/configuration/github-oidc.md)
173
280
  - [GitHub Actions](docs/workflow/ci-github-actions.md)
174
- - [Agent Skill Installer](docs/workflow/agent-skill-installer.md)
175
281
  - [Route Adapter](docs/frontend/route-adapter.md)
176
- - [Docs Set Admin Manager](docs/admin/docs-set-manager.md)
177
282
  - [Troubleshooting](docs/reference/troubleshooting.md)
178
-
179
- The `/docs` tree is also dogfood material for the plugin: it uses supported frontmatter, root-relative internal links, and `payload-markdown` directives.
180
-
181
- ## Examples
182
-
183
- - `examples/docs/` is a small fixture docs tree.
184
- - `examples/github-actions/publish-docs.yml` shows PR dry-run and main-branch sync/publish.
185
- - `examples/next/app-docs-route.md` shows the native route adapter pattern.
186
- - `dev/README.md` documents the local end-to-end dev harness for fixtures, seed scripts, signed push, and route adapter checks.
187
-
188
- ## Roadmap
189
-
190
- Next major work:
191
-
192
- - existing collection or block bridges only if still needed
193
- - skill update/verify and drift-check workflow polish
194
-
195
- See [`.codex/scratch/roadmap.md`](.codex/scratch/roadmap.md) for the working implementation roadmap.
@@ -60,6 +60,155 @@ export const createDocsSetsCollection = ({ slug, docsCollectionSlug, docsGroupsC
60
60
  type: 'number',
61
61
  defaultValue: 0
62
62
  },
63
+ {
64
+ name: 'auth',
65
+ type: 'group',
66
+ admin: {
67
+ description: 'Source-specific sync authentication policy. Use this instead of hardcoding docs sources in payload.config.ts.'
68
+ },
69
+ fields: [
70
+ {
71
+ name: 'ed25519',
72
+ type: 'group',
73
+ fields: [
74
+ {
75
+ name: 'keys',
76
+ type: 'array',
77
+ admin: {
78
+ description: 'Public keys allowed to sync this docs set from local machines or non-GitHub CI.'
79
+ },
80
+ fields: [
81
+ {
82
+ name: 'keyId',
83
+ type: 'text',
84
+ required: true
85
+ },
86
+ {
87
+ name: 'publicKey',
88
+ type: 'textarea',
89
+ required: true
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ name: 'maxSkewSeconds',
95
+ type: 'number'
96
+ },
97
+ {
98
+ name: 'nonceTtlSeconds',
99
+ type: 'number'
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ name: 'githubOidc',
105
+ type: 'group',
106
+ fields: [
107
+ {
108
+ name: 'enabled',
109
+ type: 'checkbox',
110
+ defaultValue: false
111
+ },
112
+ {
113
+ name: 'audience',
114
+ type: 'text',
115
+ admin: {
116
+ description: 'Optional override. Defaults to the plugin-level GitHub OIDC audience.'
117
+ }
118
+ },
119
+ {
120
+ name: 'allowedRepositories',
121
+ type: 'array',
122
+ admin: {
123
+ description: 'GitHub repositories allowed to sync this docs set, for example valkyrianlabs/payload-markdown-docs.'
124
+ },
125
+ fields: [
126
+ {
127
+ name: 'value',
128
+ type: 'text',
129
+ required: true
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ name: 'allowedRepositoryOwners',
135
+ type: 'array',
136
+ fields: [
137
+ {
138
+ name: 'value',
139
+ type: 'text',
140
+ required: true
141
+ }
142
+ ]
143
+ },
144
+ {
145
+ name: 'allowedRefs',
146
+ type: 'array',
147
+ admin: {
148
+ description: 'Exact Git refs such as refs/heads/main or refs/tags/v0.2.1.'
149
+ },
150
+ fields: [
151
+ {
152
+ name: 'value',
153
+ type: 'text',
154
+ required: true
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ name: 'allowedWorkflows',
160
+ type: 'array',
161
+ fields: [
162
+ {
163
+ name: 'value',
164
+ type: 'text',
165
+ required: true
166
+ }
167
+ ]
168
+ },
169
+ {
170
+ name: 'allowedWorkflowRefs',
171
+ type: 'array',
172
+ fields: [
173
+ {
174
+ name: 'value',
175
+ type: 'text',
176
+ required: true
177
+ }
178
+ ]
179
+ },
180
+ {
181
+ name: 'allowedEnvironments',
182
+ type: 'array',
183
+ fields: [
184
+ {
185
+ name: 'value',
186
+ type: 'text',
187
+ required: true
188
+ }
189
+ ]
190
+ },
191
+ {
192
+ name: 'allowPullRequests',
193
+ type: 'checkbox',
194
+ defaultValue: false
195
+ },
196
+ {
197
+ name: 'issuer',
198
+ type: 'text'
199
+ },
200
+ {
201
+ name: 'jwksUrl',
202
+ type: 'text'
203
+ },
204
+ {
205
+ name: 'maxSkewSeconds',
206
+ type: 'number'
207
+ }
208
+ ]
209
+ }
210
+ ]
211
+ },
63
212
  {
64
213
  name: 'defaults',
65
214
  type: 'group',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/docsSets.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nimport { DOCS_SET_MANAGER_COMPONENT } from '../constants.js'\n\nexport type CreateDocsSetsCollectionOptions = {\n docsCollectionSlug?: string\n docsGroupsCollectionSlug: string\n slug: string\n syncRunsCollectionSlug?: string\n}\n\nexport const createDocsSetsCollection = ({\n slug,\n docsCollectionSlug,\n docsGroupsCollectionSlug,\n syncRunsCollectionSlug,\n}: CreateDocsSetsCollectionOptions): CollectionConfig => ({\n slug,\n admin: {\n defaultColumns: ['title', 'sourceId', 'routeBase', 'updatedAt'],\n group: 'Docs',\n useAsTitle: 'title',\n },\n fields: [\n {\n name: 'title',\n type: 'text',\n required: true,\n },\n {\n name: 'slug',\n type: 'text',\n index: true,\n required: true,\n },\n {\n name: 'sourceId',\n type: 'text',\n index: true,\n required: true,\n unique: true,\n },\n {\n name: 'sourceRoot',\n type: 'text',\n defaultValue: 'docs',\n },\n {\n name: 'group',\n type: 'relationship',\n relationTo: docsGroupsCollectionSlug,\n },\n {\n name: 'routeBase',\n type: 'text',\n index: true,\n required: true,\n unique: true,\n },\n {\n name: 'description',\n type: 'textarea',\n },\n {\n name: 'navTitle',\n type: 'text',\n },\n {\n name: 'order',\n type: 'number',\n defaultValue: 0,\n },\n {\n name: 'defaults',\n type: 'group',\n fields: [\n {\n name: 'theme',\n type: 'text',\n },\n {\n name: 'heroEyebrow',\n type: 'text',\n },\n {\n name: 'heroTitle',\n type: 'text',\n },\n {\n name: 'heroDescription',\n type: 'textarea',\n },\n {\n name: 'seoTitle',\n type: 'text',\n },\n {\n name: 'seoDescription',\n type: 'textarea',\n },\n {\n name: 'sidebarMode',\n type: 'select',\n options: ['auto', 'manual', 'hidden'],\n },\n ],\n },\n {\n name: 'aiExport',\n type: 'json',\n admin: {\n description:\n 'Parsed index.ai.yml control data for the raw Markdown AI export route.',\n },\n },\n {\n name: 'sync',\n type: 'group',\n fields: [\n {\n name: 'lastSyncedAt',\n type: 'date',\n },\n ...(syncRunsCollectionSlug\n ? [\n {\n name: 'lastSyncRunId',\n type: 'relationship' as const,\n relationTo: syncRunsCollectionSlug,\n },\n ]\n : []),\n {\n name: 'lastStatus',\n type: 'select',\n options: ['failed', 'pending', 'success'],\n },\n {\n name: 'docsCount',\n type: 'number',\n defaultValue: 0,\n },\n ],\n },\n ...(docsCollectionSlug\n ? [\n {\n name: 'docsSetManager',\n type: 'ui' as const,\n admin: {\n components: {\n Field: DOCS_SET_MANAGER_COMPONENT,\n },\n custom: {\n docsCollectionSlug,\n docsSetsCollectionSlug: slug,\n },\n },\n },\n ]\n : []),\n ],\n})\n"],"names":["DOCS_SET_MANAGER_COMPONENT","createDocsSetsCollection","slug","docsCollectionSlug","docsGroupsCollectionSlug","syncRunsCollectionSlug","admin","defaultColumns","group","useAsTitle","fields","name","type","required","index","unique","defaultValue","relationTo","options","description","components","Field","custom","docsSetsCollectionSlug"],"mappings":"AAEA,SAASA,0BAA0B,QAAQ,kBAAiB;AAS5D,OAAO,MAAMC,2BAA2B,CAAC,EACvCC,IAAI,EACJC,kBAAkB,EAClBC,wBAAwB,EACxBC,sBAAsB,EACU,GAAwB,CAAA;QACxDH;QACAI,OAAO;YACLC,gBAAgB;gBAAC;gBAAS;gBAAY;gBAAa;aAAY;YAC/DC,OAAO;YACPC,YAAY;QACd;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;gBACNC,UAAU;YACZ;YACA;gBACEF,MAAM;gBACNC,MAAM;gBACNE,OAAO;gBACPD,UAAU;YACZ;YACA;gBACEF,MAAM;gBACNC,MAAM;gBACNE,OAAO;gBACPD,UAAU;gBACVE,QAAQ;YACV;YACA;gBACEJ,MAAM;gBACNC,MAAM;gBACNI,cAAc;YAChB;YACA;gBACEL,MAAM;gBACNC,MAAM;gBACNK,YAAYb;YACd;YACA;gBACEO,MAAM;gBACNC,MAAM;gBACNE,OAAO;gBACPD,UAAU;gBACVE,QAAQ;YACV;YACA;gBACEJ,MAAM;gBACNC,MAAM;YACR;YACA;gBACED,MAAM;gBACNC,MAAM;YACR;YACA;gBACED,MAAM;gBACNC,MAAM;gBACNI,cAAc;YAChB;YACA;gBACEL,MAAM;gBACNC,MAAM;gBACNF,QAAQ;oBACN;wBACEC,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;wBACNM,SAAS;4BAAC;4BAAQ;4BAAU;yBAAS;oBACvC;iBACD;YACH;YACA;gBACEP,MAAM;gBACNC,MAAM;gBACNN,OAAO;oBACLa,aACE;gBACJ;YACF;YACA;gBACER,MAAM;gBACNC,MAAM;gBACNF,QAAQ;oBACN;wBACEC,MAAM;wBACNC,MAAM;oBACR;uBACIP,yBACA;wBACE;4BACEM,MAAM;4BACNC,MAAM;4BACNK,YAAYZ;wBACd;qBACD,GACD,EAAE;oBACN;wBACEM,MAAM;wBACNC,MAAM;wBACNM,SAAS;4BAAC;4BAAU;4BAAW;yBAAU;oBAC3C;oBACA;wBACEP,MAAM;wBACNC,MAAM;wBACNI,cAAc;oBAChB;iBACD;YACH;eACIb,qBACA;gBACE;oBACEQ,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLc,YAAY;4BACVC,OAAOrB;wBACT;wBACAsB,QAAQ;4BACNnB;4BACAoB,wBAAwBrB;wBAC1B;oBACF;gBACF;aACD,GACD,EAAE;SACP;IACH,CAAA,EAAE"}
1
+ {"version":3,"sources":["../../src/collections/docsSets.ts"],"sourcesContent":["import type { CollectionConfig } from 'payload'\n\nimport { DOCS_SET_MANAGER_COMPONENT } from '../constants.js'\n\nexport type CreateDocsSetsCollectionOptions = {\n docsCollectionSlug?: string\n docsGroupsCollectionSlug: string\n slug: string\n syncRunsCollectionSlug?: string\n}\n\nexport const createDocsSetsCollection = ({\n slug,\n docsCollectionSlug,\n docsGroupsCollectionSlug,\n syncRunsCollectionSlug,\n}: CreateDocsSetsCollectionOptions): CollectionConfig => ({\n slug,\n admin: {\n defaultColumns: ['title', 'sourceId', 'routeBase', 'updatedAt'],\n group: 'Docs',\n useAsTitle: 'title',\n },\n fields: [\n {\n name: 'title',\n type: 'text',\n required: true,\n },\n {\n name: 'slug',\n type: 'text',\n index: true,\n required: true,\n },\n {\n name: 'sourceId',\n type: 'text',\n index: true,\n required: true,\n unique: true,\n },\n {\n name: 'sourceRoot',\n type: 'text',\n defaultValue: 'docs',\n },\n {\n name: 'group',\n type: 'relationship',\n relationTo: docsGroupsCollectionSlug,\n },\n {\n name: 'routeBase',\n type: 'text',\n index: true,\n required: true,\n unique: true,\n },\n {\n name: 'description',\n type: 'textarea',\n },\n {\n name: 'navTitle',\n type: 'text',\n },\n {\n name: 'order',\n type: 'number',\n defaultValue: 0,\n },\n {\n name: 'auth',\n type: 'group',\n admin: {\n description:\n 'Source-specific sync authentication policy. Use this instead of hardcoding docs sources in payload.config.ts.',\n },\n fields: [\n {\n name: 'ed25519',\n type: 'group',\n fields: [\n {\n name: 'keys',\n type: 'array',\n admin: {\n description:\n 'Public keys allowed to sync this docs set from local machines or non-GitHub CI.',\n },\n fields: [\n {\n name: 'keyId',\n type: 'text',\n required: true,\n },\n {\n name: 'publicKey',\n type: 'textarea',\n required: true,\n },\n ],\n },\n {\n name: 'maxSkewSeconds',\n type: 'number',\n },\n {\n name: 'nonceTtlSeconds',\n type: 'number',\n },\n ],\n },\n {\n name: 'githubOidc',\n type: 'group',\n fields: [\n {\n name: 'enabled',\n type: 'checkbox',\n defaultValue: false,\n },\n {\n name: 'audience',\n type: 'text',\n admin: {\n description:\n 'Optional override. Defaults to the plugin-level GitHub OIDC audience.',\n },\n },\n {\n name: 'allowedRepositories',\n type: 'array',\n admin: {\n description:\n 'GitHub repositories allowed to sync this docs set, for example valkyrianlabs/payload-markdown-docs.',\n },\n fields: [\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'allowedRepositoryOwners',\n type: 'array',\n fields: [\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'allowedRefs',\n type: 'array',\n admin: {\n description:\n 'Exact Git refs such as refs/heads/main or refs/tags/v0.2.1.',\n },\n fields: [\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'allowedWorkflows',\n type: 'array',\n fields: [\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'allowedWorkflowRefs',\n type: 'array',\n fields: [\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'allowedEnvironments',\n type: 'array',\n fields: [\n {\n name: 'value',\n type: 'text',\n required: true,\n },\n ],\n },\n {\n name: 'allowPullRequests',\n type: 'checkbox',\n defaultValue: false,\n },\n {\n name: 'issuer',\n type: 'text',\n },\n {\n name: 'jwksUrl',\n type: 'text',\n },\n {\n name: 'maxSkewSeconds',\n type: 'number',\n },\n ],\n },\n ],\n },\n {\n name: 'defaults',\n type: 'group',\n fields: [\n {\n name: 'theme',\n type: 'text',\n },\n {\n name: 'heroEyebrow',\n type: 'text',\n },\n {\n name: 'heroTitle',\n type: 'text',\n },\n {\n name: 'heroDescription',\n type: 'textarea',\n },\n {\n name: 'seoTitle',\n type: 'text',\n },\n {\n name: 'seoDescription',\n type: 'textarea',\n },\n {\n name: 'sidebarMode',\n type: 'select',\n options: ['auto', 'manual', 'hidden'],\n },\n ],\n },\n {\n name: 'aiExport',\n type: 'json',\n admin: {\n description:\n 'Parsed index.ai.yml control data for the raw Markdown AI export route.',\n },\n },\n {\n name: 'sync',\n type: 'group',\n fields: [\n {\n name: 'lastSyncedAt',\n type: 'date',\n },\n ...(syncRunsCollectionSlug\n ? [\n {\n name: 'lastSyncRunId',\n type: 'relationship' as const,\n relationTo: syncRunsCollectionSlug,\n },\n ]\n : []),\n {\n name: 'lastStatus',\n type: 'select',\n options: ['failed', 'pending', 'success'],\n },\n {\n name: 'docsCount',\n type: 'number',\n defaultValue: 0,\n },\n ],\n },\n ...(docsCollectionSlug\n ? [\n {\n name: 'docsSetManager',\n type: 'ui' as const,\n admin: {\n components: {\n Field: DOCS_SET_MANAGER_COMPONENT,\n },\n custom: {\n docsCollectionSlug,\n docsSetsCollectionSlug: slug,\n },\n },\n },\n ]\n : []),\n ],\n})\n"],"names":["DOCS_SET_MANAGER_COMPONENT","createDocsSetsCollection","slug","docsCollectionSlug","docsGroupsCollectionSlug","syncRunsCollectionSlug","admin","defaultColumns","group","useAsTitle","fields","name","type","required","index","unique","defaultValue","relationTo","description","options","components","Field","custom","docsSetsCollectionSlug"],"mappings":"AAEA,SAASA,0BAA0B,QAAQ,kBAAiB;AAS5D,OAAO,MAAMC,2BAA2B,CAAC,EACvCC,IAAI,EACJC,kBAAkB,EAClBC,wBAAwB,EACxBC,sBAAsB,EACU,GAAwB,CAAA;QACxDH;QACAI,OAAO;YACLC,gBAAgB;gBAAC;gBAAS;gBAAY;gBAAa;aAAY;YAC/DC,OAAO;YACPC,YAAY;QACd;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;gBACNC,UAAU;YACZ;YACA;gBACEF,MAAM;gBACNC,MAAM;gBACNE,OAAO;gBACPD,UAAU;YACZ;YACA;gBACEF,MAAM;gBACNC,MAAM;gBACNE,OAAO;gBACPD,UAAU;gBACVE,QAAQ;YACV;YACA;gBACEJ,MAAM;gBACNC,MAAM;gBACNI,cAAc;YAChB;YACA;gBACEL,MAAM;gBACNC,MAAM;gBACNK,YAAYb;YACd;YACA;gBACEO,MAAM;gBACNC,MAAM;gBACNE,OAAO;gBACPD,UAAU;gBACVE,QAAQ;YACV;YACA;gBACEJ,MAAM;gBACNC,MAAM;YACR;YACA;gBACED,MAAM;gBACNC,MAAM;YACR;YACA;gBACED,MAAM;gBACNC,MAAM;gBACNI,cAAc;YAChB;YACA;gBACEL,MAAM;gBACNC,MAAM;gBACNN,OAAO;oBACLY,aACE;gBACJ;gBACAR,QAAQ;oBACN;wBACEC,MAAM;wBACNC,MAAM;wBACNF,QAAQ;4BACN;gCACEC,MAAM;gCACNC,MAAM;gCACNN,OAAO;oCACLY,aACE;gCACJ;gCACAR,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;oCACA;wCACEF,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;4BACR;4BACA;gCACED,MAAM;gCACNC,MAAM;4BACR;yBACD;oBACH;oBACA;wBACED,MAAM;wBACNC,MAAM;wBACNF,QAAQ;4BACN;gCACEC,MAAM;gCACNC,MAAM;gCACNI,cAAc;4BAChB;4BACA;gCACEL,MAAM;gCACNC,MAAM;gCACNN,OAAO;oCACLY,aACE;gCACJ;4BACF;4BACA;gCACEP,MAAM;gCACNC,MAAM;gCACNN,OAAO;oCACLY,aACE;gCACJ;gCACAR,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;gCACNF,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;gCACNN,OAAO;oCACLY,aACE;gCACJ;gCACAR,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;gCACNF,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;gCACNF,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;gCACNF,QAAQ;oCACN;wCACEC,MAAM;wCACNC,MAAM;wCACNC,UAAU;oCACZ;iCACD;4BACH;4BACA;gCACEF,MAAM;gCACNC,MAAM;gCACNI,cAAc;4BAChB;4BACA;gCACEL,MAAM;gCACNC,MAAM;4BACR;4BACA;gCACED,MAAM;gCACNC,MAAM;4BACR;4BACA;gCACED,MAAM;gCACNC,MAAM;4BACR;yBACD;oBACH;iBACD;YACH;YACA;gBACED,MAAM;gBACNC,MAAM;gBACNF,QAAQ;oBACN;wBACEC,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;oBACR;oBACA;wBACED,MAAM;wBACNC,MAAM;wBACNO,SAAS;4BAAC;4BAAQ;4BAAU;yBAAS;oBACvC;iBACD;YACH;YACA;gBACER,MAAM;gBACNC,MAAM;gBACNN,OAAO;oBACLY,aACE;gBACJ;YACF;YACA;gBACEP,MAAM;gBACNC,MAAM;gBACNF,QAAQ;oBACN;wBACEC,MAAM;wBACNC,MAAM;oBACR;uBACIP,yBACA;wBACE;4BACEM,MAAM;4BACNC,MAAM;4BACNK,YAAYZ;wBACd;qBACD,GACD,EAAE;oBACN;wBACEM,MAAM;wBACNC,MAAM;wBACNO,SAAS;4BAAC;4BAAU;4BAAW;yBAAU;oBAC3C;oBACA;wBACER,MAAM;wBACNC,MAAM;wBACNI,cAAc;oBAChB;iBACD;YACH;eACIb,qBACA;gBACE;oBACEQ,MAAM;oBACNC,MAAM;oBACNN,OAAO;wBACLc,YAAY;4BACVC,OAAOrB;wBACT;wBACAsB,QAAQ;4BACNnB;4BACAoB,wBAAwBrB;wBAC1B;oBACF;gBACF;aACD,GACD,EAAE;SACP;IACH,CAAA,EAAE"}