octocms 0.4.16 → 0.4.17

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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/chatSetup.d.ts +1 -1
  3. package/dist/agent/chatSetup.d.ts.map +1 -1
  4. package/dist/agent/chatSetup.js +1 -1
  5. package/dist/agent/chatSetup.js.map +1 -1
  6. package/dist/agentDocs-6LQD3JUN.js +54 -0
  7. package/dist/agentDocs-6LQD3JUN.js.map +1 -0
  8. package/dist/chunk-CIKOAIJP.js +7 -0
  9. package/dist/{chunk-TOUAHFDW.js.map → chunk-CIKOAIJP.js.map} +1 -1
  10. package/dist/{chunk-I7VNI2IG.js → chunk-FZROCUU3.js} +14 -7
  11. package/dist/{chunk-I7VNI2IG.js.map → chunk-FZROCUU3.js.map} +1 -1
  12. package/dist/cli/index.js +5 -5
  13. package/dist/cli/lib/agentDocs.d.ts +5 -4
  14. package/dist/cli/lib/agentDocs.d.ts.map +1 -1
  15. package/dist/cli/lib/agentDocs.js +40 -105
  16. package/dist/cli/lib/agentDocs.js.map +1 -1
  17. package/dist/cli/lib/codegen.d.ts.map +1 -1
  18. package/dist/cli/lib/codegen.js +9 -5
  19. package/dist/cli/lib/codegen.js.map +1 -1
  20. package/dist/cli/lib/templates.js +13 -6
  21. package/dist/cli/lib/templates.js.map +1 -1
  22. package/dist/components/MediaManager/MediaSelectDialog.d.ts.map +1 -1
  23. package/dist/components/MediaManager/MediaSelectDialog.js +2 -2
  24. package/dist/components/MediaManager/MediaSelectDialog.js.map +1 -1
  25. package/dist/globals.css +61 -1
  26. package/dist/{init-KNIWQGJL.js → init-TZFZEP4O.js} +3 -3
  27. package/dist/{typesGen-MFAL3B4V.js → typesGen-QWWTC4SZ.js} +6 -2
  28. package/dist/typesGen-QWWTC4SZ.js.map +1 -0
  29. package/dist/{update-QALIQG76.js → update-7KYYD57J.js} +2 -2
  30. package/docs/editing-schema.md +10 -9
  31. package/docs/index.md +23 -16
  32. package/docs/overview.md +14 -35
  33. package/globals.css +61 -1
  34. package/package.json +1 -1
  35. package/dist/agentDocs-QZ4NOQVH.js +0 -38
  36. package/dist/agentDocs-QZ4NOQVH.js.map +0 -1
  37. package/dist/chunk-TOUAHFDW.js +0 -7
  38. package/dist/typesGen-MFAL3B4V.js.map +0 -1
  39. package/docs/schema.md +0 -311
  40. /package/dist/{init-KNIWQGJL.js.map → init-TZFZEP4O.js.map} +0 -0
  41. /package/dist/{update-QALIQG76.js.map → update-7KYYD57J.js.map} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A file-based CMS for Next.js. Schema defined in TypeScript, content stored as JSON files, Git-backed, no database.
4
4
 
5
- **[octocms.com](https://octocms.com)** · [Docs](https://octocms.com/docs)
5
+ **[octocms.gunkin.dev](https://octocms.gunkin.dev)** · [Docs](https://octocms.gunkin.dev/docs)
6
6
 
7
7
  ## Requirements
8
8
 
@@ -1,6 +1,6 @@
1
1
  import type { AgentConfig } from './types';
2
2
  /** OctoCMS product documentation — linked from the in-admin setup screen. */
3
- export declare const CHAT_AGENT_DOCS_HREF = "https://octocms.com/docs/chat-agent";
3
+ export declare const CHAT_AGENT_DOCS_HREF = "https://octocms.gunkin.dev/docs/chat-agent";
4
4
  export type ChatSetupReason = 'no-config' | 'no-key' | 'budget-exceeded';
5
5
  export type ChatSetupStep = {
6
6
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"chatSetup.d.ts","sourceRoot":"","sources":["../../agent/chatSetup.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AAE1D,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAE1E,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,E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 -1,6 +1,6 @@
1
1
  import "../chunk-B5LE2OEC.js";
2
2
  import { getAgentStatus } from "./featureFlag";
3
- const CHAT_AGENT_DOCS_HREF = "https://octocms.com/docs/chat-agent";
3
+ const CHAT_AGENT_DOCS_HREF = "https://octocms.gunkin.dev/docs/chat-agent";
4
4
  function isChatAgentReady(agentConfig) {
5
5
  if (!agentConfig) return false;
6
6
  return getAgentStatus(agentConfig).enabled;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../agent/chatSetup.ts"],"sourcesContent":["import { getAgentStatus } from './featureFlag';\nimport type { AgentConfig, AgentProvider } from './types';\n\n/** OctoCMS product documentation — linked from the in-admin setup screen. */\nexport const CHAT_AGENT_DOCS_HREF = 'https://octocms.com/docs/chat-agent';\n\nexport type ChatSetupReason = 'no-config' | 'no-key' | 'budget-exceeded';\n\nexport type ChatSetupStep = {\n title: string;\n detail: string;\n code?: string;\n};\n\nexport type ChatSetupInfo = {\n reason: ChatSetupReason;\n docsHref: string;\n headline: string;\n summary: string;\n steps: ChatSetupStep[];\n};\n\nexport function isChatAgentReady(agentConfig: AgentConfig | null | undefined): boolean {\n if (!agentConfig) return false;\n return getAgentStatus(agentConfig).enabled;\n}\n\nexport function buildChatSetupInfo(agentConfig: AgentConfig | null | undefined): ChatSetupInfo {\n if (!agentConfig) {\n return {\n reason: 'no-config',\n docsHref: CHAT_AGENT_DOCS_HREF,\n headline: 'Chat agent is not configured',\n summary:\n 'The chat agent is optional. Follow the OctoCMS documentation to install dependencies, add agent settings to your project config, and connect a model provider.',\n steps: noConfigSteps(),\n };\n }\n\n const status = getAgentStatus(agentConfig);\n if (status.enabled) {\n throw new Error('buildChatSetupInfo called while agent is enabled');\n }\n\n if (status.reason === 'budget-exceeded') {\n return {\n reason: 'budget-exceeded',\n docsHref: CHAT_AGENT_DOCS_HREF,\n headline: 'Chat agent budget reached',\n summary: `This deploy has reached the configured spend cap ($${status.budgetUSD.toFixed(2)}). Raise the limit in your agent config or restart the server to reset the in-memory counter.`,\n steps: budgetExceededSteps(),\n };\n }\n\n return {\n reason: 'no-key',\n docsHref: CHAT_AGENT_DOCS_HREF,\n headline: 'Chat agent is not ready',\n summary: providerCredentialSummary(agentConfig.provider),\n steps: noKeySteps(agentConfig.provider),\n };\n}\n\nfunction noConfigSteps(): ChatSetupStep[] {\n return [\n {\n title: 'Read the setup guide',\n detail:\n 'The documentation covers supported providers, required packages, and a full checklist for your environment.',\n },\n {\n title: 'Add agent settings to your project',\n detail:\n 'Export `agentConfig` from `cms/octocms.config.ts` using `defineAgentConfig`, alongside your main CMS config.',\n },\n {\n title: 'Connect your model provider',\n detail:\n 'Configure the provider block (hosted API or local endpoint) and add the credentials or URL your deployment expects. Restart the app after changing secrets.',\n },\n {\n title: 'Index content for search (recommended)',\n detail: 'Run the embeddings command from the docs so the agent can retrieve entries from your repository.',\n },\n ];\n}\n\nfunction noKeySteps(provider: AgentProvider): ChatSetupStep[] {\n if (provider.type === 'local') {\n return [\n {\n title: 'Confirm the local endpoint',\n detail:\n 'Ensure your OpenAI-compatible server is running and that `agentConfig` points at the correct base URL for this deployment.',\n },\n {\n title: 'Check optional auth',\n detail: 'If your server requires an API key, set the env var named in `provider.apiKeyEnv` and restart.',\n },\n {\n title: 'Restart after changes',\n detail: 'Restart the dev server or redeploy so new environment variables are loaded.',\n },\n ];\n }\n\n return [\n {\n title: 'Add provider credentials',\n detail:\n 'Set the API key (or custom env var) described in the setup guide for your chosen hosted provider, in local env files and production secrets.',\n },\n {\n title: 'Restart or redeploy',\n detail: 'Restart the dev server locally. On hosted platforms, redeploy after updating secrets.',\n },\n {\n title: 'Install required packages',\n detail: 'Install the chat and embedding dependencies listed in the documentation before sending a message.',\n },\n ];\n}\n\nfunction budgetExceededSteps(): ChatSetupStep[] {\n return [\n {\n title: 'Raise the deploy cap',\n detail:\n 'Increase `totalBudgetUSD` in `cms/octocms.config.ts`, or set it to `0` to disable the cap for this deploy.',\n },\n {\n title: 'Or reset the in-memory counter',\n detail: 'The spend tracker resets on cold start — redeploy or restart the dev server during testing.',\n },\n {\n title: 'Use provider-side alerts',\n detail: 'For production, also configure spend alerts in your model provider’s dashboard.',\n },\n ];\n}\n\nfunction providerCredentialSummary(provider: AgentProvider): string {\n if (provider.type === 'local') {\n return provider.baseURL\n ? 'A local provider is configured, but the server could not reach the endpoint. Confirm the model server is running and accessible from this app.'\n : 'A local provider needs an endpoint URL in `agentConfig`. See the setup guide for examples.';\n }\n const label = provider.type === 'anthropic' ? 'Anthropic' : 'OpenAI';\n return `${label} is selected in config, but the required credentials are missing or empty. Follow the setup guide to add them and restart.`;\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAIxB,MAAM,uBAAuB;AAkB7B,SAAS,iBAAiB,aAAsD;AACrF,MAAI,CAAC,YAAa,QAAO;AACzB,SAAO,eAAe,WAAW,EAAE;AACrC;AAEO,SAAS,mBAAmB,aAA4D;AAC7F,MAAI,CAAC,aAAa;AAChB,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,UAAU;AAAA,MACV,SACE;AAAA,MACF,OAAO,cAAc;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,SAAS,eAAe,WAAW;AACzC,MAAI,OAAO,SAAS;AAClB,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AAEA,MAAI,OAAO,WAAW,mBAAmB;AACvC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,UAAU;AAAA,MACV,SAAS,sDAAsD,OAAO,UAAU,QAAQ,CAAC,CAAC;AAAA,MAC1F,OAAO,oBAAoB;AAAA,IAC7B;AAAA,EACF;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,UAAU;AAAA,IACV,SAAS,0BAA0B,YAAY,QAAQ;AAAA,IACvD,OAAO,WAAW,YAAY,QAAQ;AAAA,EACxC;AACF;AAEA,SAAS,gBAAiC;AACxC,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,WAAW,UAA0C;AAC5D,MAAI,SAAS,SAAS,SAAS;AAC7B,WAAO;AAAA,MACL;AAAA,QACE,OAAO;AAAA,QACP,QACE;AAAA,MACJ;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,sBAAuC;AAC9C,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,0BAA0B,UAAiC;AAClE,MAAI,SAAS,SAAS,SAAS;AAC7B,WAAO,SAAS,UACZ,mJACA;AAAA,EACN;AACA,QAAM,QAAQ,SAAS,SAAS,cAAc,cAAc;AAC5D,SAAO,GAAG,KAAK;AACjB;","names":[]}
1
+ {"version":3,"sources":["../../agent/chatSetup.ts"],"sourcesContent":["import { getAgentStatus } from './featureFlag';\nimport type { AgentConfig, AgentProvider } from './types';\n\n/** OctoCMS product documentation — linked from the in-admin setup screen. */\nexport const CHAT_AGENT_DOCS_HREF = 'https://octocms.gunkin.dev/docs/chat-agent';\n\nexport type ChatSetupReason = 'no-config' | 'no-key' | 'budget-exceeded';\n\nexport type ChatSetupStep = {\n title: string;\n detail: string;\n code?: string;\n};\n\nexport type ChatSetupInfo = {\n reason: ChatSetupReason;\n docsHref: string;\n headline: string;\n summary: string;\n steps: ChatSetupStep[];\n};\n\nexport function isChatAgentReady(agentConfig: AgentConfig | null | undefined): boolean {\n if (!agentConfig) return false;\n return getAgentStatus(agentConfig).enabled;\n}\n\nexport function buildChatSetupInfo(agentConfig: AgentConfig | null | undefined): ChatSetupInfo {\n if (!agentConfig) {\n return {\n reason: 'no-config',\n docsHref: CHAT_AGENT_DOCS_HREF,\n headline: 'Chat agent is not configured',\n summary:\n 'The chat agent is optional. Follow the OctoCMS documentation to install dependencies, add agent settings to your project config, and connect a model provider.',\n steps: noConfigSteps(),\n };\n }\n\n const status = getAgentStatus(agentConfig);\n if (status.enabled) {\n throw new Error('buildChatSetupInfo called while agent is enabled');\n }\n\n if (status.reason === 'budget-exceeded') {\n return {\n reason: 'budget-exceeded',\n docsHref: CHAT_AGENT_DOCS_HREF,\n headline: 'Chat agent budget reached',\n summary: `This deploy has reached the configured spend cap ($${status.budgetUSD.toFixed(2)}). Raise the limit in your agent config or restart the server to reset the in-memory counter.`,\n steps: budgetExceededSteps(),\n };\n }\n\n return {\n reason: 'no-key',\n docsHref: CHAT_AGENT_DOCS_HREF,\n headline: 'Chat agent is not ready',\n summary: providerCredentialSummary(agentConfig.provider),\n steps: noKeySteps(agentConfig.provider),\n };\n}\n\nfunction noConfigSteps(): ChatSetupStep[] {\n return [\n {\n title: 'Read the setup guide',\n detail:\n 'The documentation covers supported providers, required packages, and a full checklist for your environment.',\n },\n {\n title: 'Add agent settings to your project',\n detail:\n 'Export `agentConfig` from `cms/octocms.config.ts` using `defineAgentConfig`, alongside your main CMS config.',\n },\n {\n title: 'Connect your model provider',\n detail:\n 'Configure the provider block (hosted API or local endpoint) and add the credentials or URL your deployment expects. Restart the app after changing secrets.',\n },\n {\n title: 'Index content for search (recommended)',\n detail: 'Run the embeddings command from the docs so the agent can retrieve entries from your repository.',\n },\n ];\n}\n\nfunction noKeySteps(provider: AgentProvider): ChatSetupStep[] {\n if (provider.type === 'local') {\n return [\n {\n title: 'Confirm the local endpoint',\n detail:\n 'Ensure your OpenAI-compatible server is running and that `agentConfig` points at the correct base URL for this deployment.',\n },\n {\n title: 'Check optional auth',\n detail: 'If your server requires an API key, set the env var named in `provider.apiKeyEnv` and restart.',\n },\n {\n title: 'Restart after changes',\n detail: 'Restart the dev server or redeploy so new environment variables are loaded.',\n },\n ];\n }\n\n return [\n {\n title: 'Add provider credentials',\n detail:\n 'Set the API key (or custom env var) described in the setup guide for your chosen hosted provider, in local env files and production secrets.',\n },\n {\n title: 'Restart or redeploy',\n detail: 'Restart the dev server locally. On hosted platforms, redeploy after updating secrets.',\n },\n {\n title: 'Install required packages',\n detail: 'Install the chat and embedding dependencies listed in the documentation before sending a message.',\n },\n ];\n}\n\nfunction budgetExceededSteps(): ChatSetupStep[] {\n return [\n {\n title: 'Raise the deploy cap',\n detail:\n 'Increase `totalBudgetUSD` in `cms/octocms.config.ts`, or set it to `0` to disable the cap for this deploy.',\n },\n {\n title: 'Or reset the in-memory counter',\n detail: 'The spend tracker resets on cold start — redeploy or restart the dev server during testing.',\n },\n {\n title: 'Use provider-side alerts',\n detail: 'For production, also configure spend alerts in your model provider’s dashboard.',\n },\n ];\n}\n\nfunction providerCredentialSummary(provider: AgentProvider): string {\n if (provider.type === 'local') {\n return provider.baseURL\n ? 'A local provider is configured, but the server could not reach the endpoint. Confirm the model server is running and accessible from this app.'\n : 'A local provider needs an endpoint URL in `agentConfig`. See the setup guide for examples.';\n }\n const label = provider.type === 'anthropic' ? 'Anthropic' : 'OpenAI';\n return `${label} is selected in config, but the required credentials are missing or empty. Follow the setup guide to add them and restart.`;\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAIxB,MAAM,uBAAuB;AAkB7B,SAAS,iBAAiB,aAAs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EACF;AAEA,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,sBAAuC;AAC9C,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QACE;AAAA,IACJ;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,SAAS,0BAA0B,UAAiC;AAClE,MAAI,SAAS,SAAS,SAAS;AAC7B,WAAO,SAAS,UACZ,mJACA;AAAA,EACN;AACA,QAAM,QAAQ,SAAS,SAAS,cAAc,cAAc;AAC5D,SAAO,GAAG,KAAK;AACjB;","names":[]}
@@ -0,0 +1,54 @@
1
+ import {
2
+ agentsMdSection,
3
+ agentsMdTemplate
4
+ } from "./chunk-FZROCUU3.js";
5
+ import {
6
+ log
7
+ } from "./chunk-6PHFHGTZ.js";
8
+ import "./chunk-DDAAVRWG.js";
9
+
10
+ // cli/commands/agentDocs.ts
11
+ import { existsSync, readFileSync, writeFileSync } from "fs";
12
+ import { join } from "path";
13
+ var AGENT_DOCS_MARKER = "<!-- octocms:agent-docs -->";
14
+ function upsertAgentsMdSection(content, section) {
15
+ const markerIndex = content.indexOf(AGENT_DOCS_MARKER);
16
+ if (markerIndex === -1) {
17
+ return content.trimEnd() + "\n\n" + section + "\n";
18
+ }
19
+ const before = content.slice(0, markerIndex).trimEnd();
20
+ const afterMarker = content.slice(markerIndex + AGENT_DOCS_MARKER.length);
21
+ const nextSectionIndex = afterMarker.indexOf("\n\n## ", 1);
22
+ const tail = nextSectionIndex === -1 ? "" : afterMarker.slice(nextSectionIndex + 2).trimStart();
23
+ const parts = [before, section.trimEnd()];
24
+ if (tail) parts.push(tail);
25
+ return parts.join("\n\n") + "\n";
26
+ }
27
+ async function agentDocsCommand(projectRoot) {
28
+ log.header("Agent documentation");
29
+ const agentsMdPath = join(projectRoot, "AGENTS.md");
30
+ const section = agentsMdSection();
31
+ if (!existsSync(agentsMdPath)) {
32
+ writeFileSync(agentsMdPath, agentsMdTemplate(), "utf8");
33
+ log.success("AGENTS.md \u2014 created with OctoCMS agent docs section");
34
+ } else {
35
+ const current = readFileSync(agentsMdPath, "utf8");
36
+ if (current.includes(AGENT_DOCS_MARKER)) {
37
+ writeFileSync(agentsMdPath, upsertAgentsMdSection(current, section), "utf8");
38
+ log.step("AGENTS.md \u2014 updated OctoCMS agent docs section");
39
+ } else {
40
+ writeFileSync(agentsMdPath, upsertAgentsMdSection(current, section), "utf8");
41
+ log.step("AGENTS.md \u2014 appended OctoCMS agent docs section");
42
+ }
43
+ }
44
+ log.blank();
45
+ log.info("Package docs: octocms/docs/overview.md, octocms/docs/editing-schema.md");
46
+ log.info("Project docs: cms/__generated__/agent-docs/ (regenerate with npm run agent-docs:gen)");
47
+ log.blank();
48
+ }
49
+ export {
50
+ AGENT_DOCS_MARKER,
51
+ agentDocsCommand,
52
+ upsertAgentsMdSection
53
+ };
54
+ //# sourceMappingURL=agentDocs-6LQD3JUN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../cli/commands/agentDocs.ts"],"sourcesContent":["/**\n * `octocms agent-docs` — Inject AI agent documentation links into AGENTS.md.\n *\n * Creates AGENTS.md if it doesn't exist, or appends/replaces the OctoCMS section.\n */\n\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\nimport { log } from '../lib/logger';\nimport { agentsMdSection, agentsMdTemplate } from '../lib/templates';\n\nexport const AGENT_DOCS_MARKER = '<!-- octocms:agent-docs -->';\n\n/** Replace an existing OctoCMS section or append a new one. */\nexport function upsertAgentsMdSection(content: string, section: string): string {\n const markerIndex = content.indexOf(AGENT_DOCS_MARKER);\n if (markerIndex === -1) {\n return content.trimEnd() + '\\n\\n' + section + '\\n';\n }\n\n const before = content.slice(0, markerIndex).trimEnd();\n const afterMarker = content.slice(markerIndex + AGENT_DOCS_MARKER.length);\n const nextSectionIndex = afterMarker.indexOf('\\n\\n## ', 1);\n const tail = nextSectionIndex === -1 ? '' : afterMarker.slice(nextSectionIndex + 2).trimStart();\n const parts = [before, section.trimEnd()];\n if (tail) parts.push(tail);\n return parts.join('\\n\\n') + '\\n';\n}\n\nexport async function agentDocsCommand(projectRoot: string): Promise<void> {\n log.header('Agent documentation');\n\n const agentsMdPath = join(projectRoot, 'AGENTS.md');\n const section = agentsMdSection();\n\n if (!existsSync(agentsMdPath)) {\n writeFileSync(agentsMdPath, agentsMdTemplate(), 'utf8');\n log.success('AGENTS.md — created with OctoCMS agent docs section');\n } else {\n const current = readFileSync(agentsMdPath, 'utf8');\n if (current.includes(AGENT_DOCS_MARKER)) {\n writeFileSync(agentsMdPath, upsertAgentsMdSection(current, section), 'utf8');\n log.step('AGENTS.md — updated OctoCMS agent docs section');\n } else {\n writeFileSync(agentsMdPath, upsertAgentsMdSection(current, section), 'utf8');\n log.step('AGENTS.md — appended OctoCMS agent docs section');\n }\n }\n\n log.blank();\n log.info('Package docs: octocms/docs/overview.md, octocms/docs/editing-schema.md');\n log.info('Project docs: cms/__generated__/agent-docs/ (regenerate with npm run agent-docs:gen)');\n log.blank();\n}\n"],"mappings":";;;;;;;;;;AAMA,SAAS,YAAY,cAAc,qBAAqB;AACxD,SAAS,YAAY;AAKd,IAAM,oBAAoB;AAG1B,SAAS,sBAAsB,SAAiB,SAAyB;AAC9E,QAAM,cAAc,QAAQ,QAAQ,iBAAiB;AACrD,MAAI,gBAAgB,IAAI;AACtB,WAAO,QAAQ,QAAQ,IAAI,SAAS,UAAU;AAAA,EAChD;AAEA,QAAM,SAAS,QAAQ,MAAM,GAAG,WAAW,EAAE,QAAQ;AACrD,QAAM,cAAc,QAAQ,MAAM,cAAc,kBAAkB,MAAM;AACxE,QAAM,mBAAmB,YAAY,QAAQ,WAAW,CAAC;AACzD,QAAM,OAAO,qBAAqB,KAAK,KAAK,YAAY,MAAM,mBAAmB,CAAC,EAAE,UAAU;AAC9F,QAAM,QAAQ,CAAC,QAAQ,QAAQ,QAAQ,CAAC;AACxC,MAAI,KAAM,OAAM,KAAK,IAAI;AACzB,SAAO,MAAM,KAAK,MAAM,IAAI;AAC9B;AAEA,eAAsB,iBAAiB,aAAoC;AACzE,MAAI,OAAO,qBAAqB;AAEhC,QAAM,eAAe,KAAK,aAAa,WAAW;AAClD,QAAM,UAAU,gBAAgB;AAEhC,MAAI,CAAC,WAAW,YAAY,GAAG;AAC7B,kBAAc,cAAc,iBAAiB,GAAG,MAAM;AACtD,QAAI,QAAQ,0DAAqD;AAAA,EACnE,OAAO;AACL,UAAM,UAAU,aAAa,cAAc,MAAM;AACjD,QAAI,QAAQ,SAAS,iBAAiB,GAAG;AACvC,oBAAc,cAAc,sBAAsB,SAAS,OAAO,GAAG,MAAM;AAC3E,UAAI,KAAK,qDAAgD;AAAA,IAC3D,OAAO;AACL,oBAAc,cAAc,sBAAsB,SAAS,OAAO,GAAG,MAAM;AAC3E,UAAI,KAAK,sDAAiD;AAAA,IAC5D;AAAA,EACF;AAEA,MAAI,MAAM;AACV,MAAI,KAAK,wEAAwE;AACjF,MAAI,KAAK,sFAAsF;AAC/F,MAAI,MAAM;AACZ;","names":[]}
@@ -0,0 +1,7 @@
1
+ // package.json
2
+ var version = "0.4.17";
3
+
4
+ export {
5
+ version
6
+ };
7
+ //# sourceMappingURL=chunk-CIKOAIJP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"octocms\",\n \"version\": \"0.4.16\",\n \"description\": \"A file-based CMS for Next.js — schema-driven, Git-backed, no database\",\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"keywords\": [\n \"cms\",\n \"nextjs\",\n \"headless-cms\",\n \"git-cms\",\n \"content-management\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/octocms/octocms.git\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.js\"\n },\n \"./query\": {\n \"types\": \"./dist/query.d.ts\",\n \"require\": \"./dist/query.cjs\",\n \"import\": \"./dist/query.js\"\n },\n \"./config\": {\n \"types\": \"./dist/config.d.ts\",\n \"require\": \"./dist/config.cjs\",\n \"import\": \"./dist/config.js\"\n },\n \"./defineConfig\": {\n \"types\": \"./dist/defineConfig.d.ts\",\n \"require\": \"./dist/defineConfig.cjs\",\n \"import\": \"./dist/defineConfig.js\"\n },\n \"./types\": {\n \"types\": \"./dist/types.d.ts\",\n \"require\": \"./dist/types.cjs\",\n \"import\": \"./dist/types.js\"\n },\n \"./withOctoCMS\": {\n \"types\": \"./dist/withOctoCMS.d.ts\",\n \"require\": \"./dist/withOctoCMS.cjs\",\n \"import\": \"./dist/withOctoCMS.js\"\n },\n \"./agent\": {\n \"types\": \"./dist/agent/index.d.ts\",\n \"require\": \"./dist/agent/index.cjs\",\n \"import\": \"./dist/agent/index.js\"\n },\n \"./schema\": {\n \"types\": \"./dist/schema/index.d.ts\",\n \"import\": \"./dist/schema/index.js\"\n },\n \"./components/public\": {\n \"types\": \"./dist/components/public/index.d.ts\",\n \"require\": \"./dist/components/public/index.cjs\",\n \"import\": \"./dist/components/public/index.js\"\n },\n \"./lib/configStore\": {\n \"types\": \"./dist/lib/configStore.d.ts\",\n \"require\": \"./dist/lib/configStore.cjs\",\n \"import\": \"./dist/lib/configStore.js\"\n },\n \"./admin\": {\n \"types\": \"./dist/admin/index.d.ts\",\n \"import\": \"./dist/admin/index.js\"\n },\n \"./admin/*\": {\n \"types\": \"./dist/admin/*.d.ts\",\n \"import\": \"./dist/admin/*.js\"\n },\n \"./components/*\": {\n \"types\": \"./dist/components/*.d.ts\",\n \"import\": \"./dist/components/*.js\"\n },\n \"./hooks/*\": {\n \"types\": \"./dist/hooks/*.d.ts\",\n \"import\": \"./dist/hooks/*.js\"\n },\n \"./lib/*\": {\n \"types\": \"./dist/lib/*.d.ts\",\n \"import\": \"./dist/lib/*.js\"\n },\n \"./schema/*\": {\n \"types\": \"./dist/schema/*.d.ts\",\n \"import\": \"./dist/schema/*.js\"\n },\n \"./utils/*\": {\n \"types\": \"./dist/utils/*.d.ts\",\n \"import\": \"./dist/utils/*.js\"\n },\n \"./globals.css\": \"./globals.css\",\n \"./docs/*\": \"./docs/*\"\n },\n \"bin\": {\n \"octocms\": \"dist/cli/index.js\"\n },\n \"files\": [\n \"dist\",\n \"docs\",\n \"globals.css\"\n ],\n \"scripts\": {\n \"build\": \"tsup && tsc -p tsconfig.build.json && cp globals.css dist/globals.css\",\n \"prepublishOnly\": \"npm run checks && npm run build\",\n \"lint\": \"oxlint .\",\n \"lint:fix\": \"oxlint --fix .\",\n \"fmt\": \"oxfmt .\",\n \"fmt:check\": \"oxfmt --check .\",\n \"test\": \"vitest\",\n \"test:run\": \"vitest run\",\n \"ts-check\": \"tsc --noEmit --incremental false\",\n \"checks\": \"npm run lint && npm run ts-check && npm run fmt:check && npm run test:run\",\n \"checks:fix\": \"npm run lint:fix && npm run fmt && npm run test:run\"\n },\n \"peerDependencies\": {\n \"@anthropic-ai/sdk\": \">=0.91\",\n \"@huggingface/transformers\": \">=4\",\n \"@mdxeditor/editor\": \">=3\",\n \"@tanstack/react-query\": \">=5\",\n \"mammoth\": \">=1.12\",\n \"minisearch\": \">=7\",\n \"next\": \">=15\",\n \"next-auth\": \">=4\",\n \"octokit\": \">=4\",\n \"openai\": \">=4\",\n \"pdfjs-dist\": \">=4\",\n \"react\": \">=18\",\n \"react-dom\": \">=18\",\n \"react-markdown\": \">=10\",\n \"rehype-sanitize\": \">=6\",\n \"remark-gfm\": \">=4\",\n \"remark-mdx\": \">=3\",\n \"sharp\": \">=0.34\",\n \"zod\": \">=4\"\n },\n \"peerDependenciesMeta\": {\n \"@anthropic-ai/sdk\": {\n \"optional\": true\n },\n \"@huggingface/transformers\": {\n \"optional\": true\n },\n \"mammoth\": {\n \"optional\": true\n },\n \"openai\": {\n \"optional\": true\n },\n \"pdfjs-dist\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@tanstack/react-query\": \"^5.100.9\",\n \"@testing-library/dom\": \"^10.4.1\",\n \"@testing-library/react\": \"^16.3.2\",\n \"@types/node\": \"^20\",\n \"@types/react\": \"^19.2.14\",\n \"@types/react-dom\": \"^19.2.3\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"jsdom\": \"^29.0.1\",\n \"oxfmt\": \"^0.11.0\",\n \"oxlint\": \"^0.17.0\",\n \"tsup\": \"^8.0.0\",\n \"typescript\": \"^5.9.3\",\n \"vite-tsconfig-paths\": \"^6.1.1\",\n \"vitest\": \"^4.1.2\"\n }\n}\n"],"mappings":";AAEE,cAAW;","names":[]}
1
+ {"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"octocms\",\n \"version\": \"0.4.17\",\n \"description\": \"A file-based CMS for Next.js — schema-driven, Git-backed, no database\",\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"keywords\": [\n \"cms\",\n \"nextjs\",\n \"headless-cms\",\n \"git-cms\",\n \"content-management\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/octocms/octocms.git\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.js\"\n },\n \"./query\": {\n \"types\": \"./dist/query.d.ts\",\n \"require\": \"./dist/query.cjs\",\n \"import\": \"./dist/query.js\"\n },\n \"./config\": {\n \"types\": \"./dist/config.d.ts\",\n \"require\": \"./dist/config.cjs\",\n \"import\": \"./dist/config.js\"\n },\n \"./defineConfig\": {\n \"types\": \"./dist/defineConfig.d.ts\",\n \"require\": \"./dist/defineConfig.cjs\",\n \"import\": \"./dist/defineConfig.js\"\n },\n \"./types\": {\n \"types\": \"./dist/types.d.ts\",\n \"require\": \"./dist/types.cjs\",\n \"import\": \"./dist/types.js\"\n },\n \"./withOctoCMS\": {\n \"types\": \"./dist/withOctoCMS.d.ts\",\n \"require\": \"./dist/withOctoCMS.cjs\",\n \"import\": \"./dist/withOctoCMS.js\"\n },\n \"./agent\": {\n \"types\": \"./dist/agent/index.d.ts\",\n \"require\": \"./dist/agent/index.cjs\",\n \"import\": \"./dist/agent/index.js\"\n },\n \"./schema\": {\n \"types\": \"./dist/schema/index.d.ts\",\n \"import\": \"./dist/schema/index.js\"\n },\n \"./components/public\": {\n \"types\": \"./dist/components/public/index.d.ts\",\n \"require\": \"./dist/components/public/index.cjs\",\n \"import\": \"./dist/components/public/index.js\"\n },\n \"./lib/configStore\": {\n \"types\": \"./dist/lib/configStore.d.ts\",\n \"require\": \"./dist/lib/configStore.cjs\",\n \"import\": \"./dist/lib/configStore.js\"\n },\n \"./admin\": {\n \"types\": \"./dist/admin/index.d.ts\",\n \"import\": \"./dist/admin/index.js\"\n },\n \"./admin/*\": {\n \"types\": \"./dist/admin/*.d.ts\",\n \"import\": \"./dist/admin/*.js\"\n },\n \"./components/*\": {\n \"types\": \"./dist/components/*.d.ts\",\n \"import\": \"./dist/components/*.js\"\n },\n \"./hooks/*\": {\n \"types\": \"./dist/hooks/*.d.ts\",\n \"import\": \"./dist/hooks/*.js\"\n },\n \"./lib/*\": {\n \"types\": \"./dist/lib/*.d.ts\",\n \"import\": \"./dist/lib/*.js\"\n },\n \"./schema/*\": {\n \"types\": \"./dist/schema/*.d.ts\",\n \"import\": \"./dist/schema/*.js\"\n },\n \"./utils/*\": {\n \"types\": \"./dist/utils/*.d.ts\",\n \"import\": \"./dist/utils/*.js\"\n },\n \"./globals.css\": \"./globals.css\",\n \"./docs/*\": \"./docs/*\"\n },\n \"bin\": {\n \"octocms\": \"dist/cli/index.js\"\n },\n \"files\": [\n \"dist\",\n \"docs\",\n \"globals.css\"\n ],\n \"scripts\": {\n \"build\": \"tsup && tsc -p tsconfig.build.json && cp globals.css dist/globals.css\",\n \"prepublishOnly\": \"npm run checks && npm run build\",\n \"lint\": \"oxlint .\",\n \"lint:fix\": \"oxlint --fix .\",\n \"fmt\": \"oxfmt .\",\n \"fmt:check\": \"oxfmt --check .\",\n \"test\": \"vitest\",\n \"test:run\": \"vitest run\",\n \"ts-check\": \"tsc --noEmit --incremental false\",\n \"checks\": \"npm run lint && npm run ts-check && npm run fmt:check && npm run test:run\",\n \"checks:fix\": \"npm run lint:fix && npm run fmt && npm run test:run\"\n },\n \"peerDependencies\": {\n \"@anthropic-ai/sdk\": \">=0.91\",\n \"@huggingface/transformers\": \">=4\",\n \"@mdxeditor/editor\": \">=3\",\n \"@tanstack/react-query\": \">=5\",\n \"mammoth\": \">=1.12\",\n \"minisearch\": \">=7\",\n \"next\": \">=15\",\n \"next-auth\": \">=4\",\n \"octokit\": \">=4\",\n \"openai\": \">=4\",\n \"pdfjs-dist\": \">=4\",\n \"react\": \">=18\",\n \"react-dom\": \">=18\",\n \"react-markdown\": \">=10\",\n \"rehype-sanitize\": \">=6\",\n \"remark-gfm\": \">=4\",\n \"remark-mdx\": \">=3\",\n \"sharp\": \">=0.34\",\n \"zod\": \">=4\"\n },\n \"peerDependenciesMeta\": {\n \"@anthropic-ai/sdk\": {\n \"optional\": true\n },\n \"@huggingface/transformers\": {\n \"optional\": true\n },\n \"mammoth\": {\n \"optional\": true\n },\n \"openai\": {\n \"optional\": true\n },\n \"pdfjs-dist\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@tanstack/react-query\": \"^5.100.9\",\n \"@testing-library/dom\": \"^10.4.1\",\n \"@testing-library/react\": \"^16.3.2\",\n \"@types/node\": \"^20\",\n \"@types/react\": \"^19.2.14\",\n \"@types/react-dom\": \"^19.2.3\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"jsdom\": \"^29.0.1\",\n \"oxfmt\": \"^0.11.0\",\n \"oxlint\": \"^0.17.0\",\n \"tsup\": \"^8.0.0\",\n \"typescript\": \"^5.9.3\",\n \"vite-tsconfig-paths\": \"^6.1.1\",\n \"vitest\": \"^4.1.2\"\n }\n}\n"],"mappings":";AAEE,cAAW;","names":[]}
@@ -295,7 +295,7 @@ export default async function HelloPage() {
295
295
  function readmeTemplate(projectName) {
296
296
  return `# ${projectName}
297
297
 
298
- Built with [OctoCMS](https://octocms.com) \u2014 a file-based CMS on Next.js.
298
+ Built with [OctoCMS](https://octocms.gunkin.dev) \u2014 a file-based CMS on Next.js.
299
299
 
300
300
  ## Setup
301
301
 
@@ -312,7 +312,7 @@ npm install octocms next-auth @tanstack/react-query @mdxeditor/editor \\
312
312
 
313
313
  ### 2. Create a GitHub App
314
314
 
315
- Follow the [OctoCMS GitHub App setup guide](https://octocms.com/docs/github-app) to create a GitHub App for authentication.
315
+ Follow the [OctoCMS GitHub App setup guide](https://octocms.gunkin.dev/docs/github-app) to create a GitHub App for authentication.
316
316
 
317
317
  ### 3. Configure environment variables
318
318
 
@@ -367,12 +367,19 @@ function agentsMdSection() {
367
367
  return `${AGENT_DOCS_MARKER}
368
368
  ## OctoCMS \u2014 AI Content Management
369
369
 
370
- For tasks that involve creating, editing, or deleting CMS content directly (without the admin UI), read the auto-generated agent docs:
370
+ For tasks that involve creating, editing, or deleting CMS content directly (without the admin UI), read these docs:
371
371
 
372
- - **\`octocms/docs/overview.md\`** \u2014 How to find, create, update, and delete content entries via file operations
373
- - **\`octocms/docs/schema.md\`** \u2014 Per-collection field definitions, example JSON, and file path conventions
372
+ **Package docs (content-agnostic, stable):**
374
373
 
375
- These docs are generated from \`cms/octocms.config.ts\`. Regenerate after schema changes: \`npm run agent-docs:gen\`.`;
374
+ - **\`octocms/docs/overview.md\`** \u2014 Generic content management (CRUD, entry shape, status values)
375
+ - **\`octocms/docs/editing-schema.md\`** \u2014 How to edit \`cms/schema.json\` safely
376
+
377
+ **Project docs (auto-generated from \`cms/schema.json\`):**
378
+
379
+ - **\`cms/__generated__/agent-docs/schema.md\`** \u2014 Per-collection field definitions and example JSON
380
+ - **\`cms/__generated__/agent-docs/collections.md\`** \u2014 Collection list and URL mapping
381
+
382
+ Regenerate project docs after schema changes: \`npm run agent-docs:gen\` (or \`npm run types:gen\`).`;
376
383
  }
377
384
  function agentsMdTemplate() {
378
385
  return `# Project Guidelines
@@ -417,4 +424,4 @@ export {
417
424
  agentsMdTemplate,
418
425
  tsconfigPaths
419
426
  };
420
- //# sourceMappingURL=chunk-I7VNI2IG.js.map
427
+ //# sourceMappingURL=chunk-FZROCUU3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../cli/lib/templates.ts"],"sourcesContent":["/**\n * File templates used by `octocms init` and `octocms update`.\n */\n\nconst CODEGEN_BANNER = `/*\n * AUTO-GENERATED — DO NOT EDIT.\n * Generated from cms/octocms.config.ts.\n * Run \\`npx octocms types:gen\\` to regenerate.\n */\n\n`;\n\n/** Static cms/__generated__/types.ts for the helloPage demo schema. */\nexport const generatedTypesTemplate =\n CODEGEN_BANNER +\n `import type { EntryStatus } from 'octocms/types';\n\nexport interface HelloPageFields {\n title: string;\n description: string;\n}\n\nexport interface HelloPageEntry {\n sys: { id: string; type: 'helloPage'; status: EntryStatus };\n fields: HelloPageFields;\n}\n\nexport type AnyEntry = HelloPageEntry;\n\nexport type EntryMap = {\n helloPage: HelloPageEntry;\n};\n`;\n\n/** Static cms/__generated__/enums.ts for the helloPage demo schema. */\nexport const generatedEnumsTemplate =\n CODEGEN_BANNER +\n `export const CollectionName = {\n HelloPage: 'helloPage',\n} as const;\nexport type CollectionName = (typeof CollectionName)[keyof typeof CollectionName];\n\nexport const COLLECTION_NAMES = ['helloPage'] as const;\n\nexport const FieldFormat = {\n String: 'string',\n Text: 'text',\n Markdown: 'markdown',\n Boolean: 'boolean',\n Reference: 'reference',\n Image: 'image',\n Number: 'number',\n Datetime: 'datetime',\n Json: 'json',\n Slug: 'slug',\n Select: 'select',\n Url: 'url',\n Color: 'color',\n Conditional: 'conditional',\n Richtext: 'richtext',\n} as const;\nexport type FieldFormat = (typeof FieldFormat)[keyof typeof FieldFormat];\n`;\n\n/** Static cms/__generated__/content.d.ts for the helloPage demo schema. */\nexport const generatedContentDeclsTemplate =\n CODEGEN_BANNER +\n `import type { EntryStatus } from 'octocms/types';\n\n// Raw on-disk types (before query() processing).\nexport interface RawHelloPageFields {\n title: string;\n description: string;\n}\n\nexport interface RawHelloPageEntry {\n sys: { id: string; type: 'helloPage'; status: EntryStatus };\n fields: RawHelloPageFields;\n}\n`;\n\n/** Static cms/__generated__/index.ts — always the same shape. */\nexport const generatedIndexTemplate =\n CODEGEN_BANNER +\n `export * from './types';\nexport * from './enums';\nexport * from './query';\n`;\n\n/** Static cms/__generated__/query.ts — always the same shape (schema-independent). */\nexport const generatedQueryTemplate =\n CODEGEN_BANNER +\n `import { createQuery } from 'octocms/query';\nimport { configOctoCMS, type OctoConfig } from '../octocms.config';\nimport type { EntryMap } from './types';\n\n// configOctoCMS is widened to Config for admin internals; cast back to OctoConfig so\n// createQuery preserves literal collection/field names for type-safe queries.\nexport const query = createQuery<EntryMap, OctoConfig>(configOctoCMS as unknown as OctoConfig);\n`;\n\n/** Static cms/__generated__/configInit.ts — always the same shape (schema-independent). */\nexport const generatedConfigInitTemplate =\n CODEGEN_BANNER +\n `import { configOctoCMS } from '../octocms.config';\nimport { setConfig } from 'octocms/lib/configStore';\n\nsetConfig(configOctoCMS);\n`;\n\n/**\n * All scaffolded files import the generated config initialiser via the bare\n * specifier `cms/__generated__/configInit`. Resolution works in two layers:\n *\n * - TypeScript IntelliSense: the consumer's `tsconfig.json` `paths` (added\n * by `octocms init`).\n * - Bundler: an alias registered by `withOctoCMS()` so Webpack and Turbopack\n * resolve the bare specifier from anywhere — including `app/layout.tsx`,\n * route handlers at any depth, and files inside `node_modules/octocms/`.\n *\n * This eliminates the previous depth-counting (`'../../../cms/...'`) that was\n * a recurring source of off-by-one bugs across templates and routes.\n */\nconst CONFIG_INIT_IMPORT = \"import 'cms/__generated__/configInit';\";\n\n/**\n * Minimal root layout written when `app/layout.tsx` does not already exist.\n * The configInit import is the critical side-effect; the rest is a Next.js\n * boilerplate shell.\n */\nexport const rootLayoutTemplate = `${CONFIG_INIT_IMPORT}\nimport type { Metadata } from 'next';\n\nexport const metadata: Metadata = {\n title: 'My App',\n};\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n );\n}\n`;\n\n/** The one-liner prepended to an existing root layout to register the config. */\nexport const rootLayoutConfigInitImport = `${CONFIG_INIT_IMPORT}\\n`;\n\nexport function buildAdminLayoutTemplate(): string {\n return `${CONFIG_INIT_IMPORT}\nimport '@mdxeditor/editor/style.css';\nimport 'octocms/globals.css';\n\nexport { AdminLayout as default, metadata } from 'octocms/admin';\n`;\n}\n\n/**\n * Catch-all admin route — every \\`/cms/*\\` URL renders the package's\n * \\`AdminApp\\` async server component (awaits \\`params\\`, no outer Suspense).\n * Side-effect-imports \\`configInit\\` so server-action bundles register\n * \\`setConfig()\\` even when Next.js does not load \\`layout.tsx\\` for the POST.\n */\nexport function buildAdminPageTemplate(): string {\n return `// Registers setConfig() for server actions — some POST bundles skip layout.tsx.\n${CONFIG_INIT_IMPORT}\n\nexport { AdminApp as default } from 'octocms/admin';\n`;\n}\n\n/**\n * Admin error boundary — rendered by Next.js when anything in the catch-all\n * tree throws during render. Re-uses the shared \\`AdminErrorView\\` so GitHub\n * config / auth / availability / rate-limit copy stays consistent with the\n * public-page error boundary.\n */\nexport const adminErrorTemplate = `'use client';\n\nexport { AdminError as default } from 'octocms/admin';\n`;\n\n/**\n * Historical template values used by \\`octocms update\\` to recognise an\n * unmodified install when migrating between routing models. Each entry is\n * the literal file content shipped by a previous OctoCMS version. If a\n * user-app file matches one of these byte-for-byte, \\`update\\` will replace\n * it with the current template; otherwise it leaves it alone.\n */\nexport const LEGACY_ADMIN_LAYOUT_TEMPLATES: ReadonlyArray<string> = [\n // 0.4.x — re-exported from the deep path.\n `import '../../cms/__generated__/configInit';\nimport 'octocms/globals.css';\nimport '@mdxeditor/editor/style.css';\n\nexport { AdminLayout as default, metadata } from 'octocms/admin/pages/AdminLayout';\n`,\n // 0.5.x — barrel re-export with depth-counted relative configInit import.\n `import '../../cms/__generated__/configInit';\nimport 'octocms/globals.css';\nimport '@mdxeditor/editor/style.css';\n\nexport { AdminLayout as default, metadata } from 'octocms/admin';\n`,\n];\n\nexport const LEGACY_ADMIN_CATCH_ALL_TEMPLATES: ReadonlyArray<string> = [\n // 0.4.x — re-exported from the deep path.\n `export { AdminApp as default } from 'octocms/admin/AdminApp';\n`,\n // 0.5.x — barrel re-export without configInit on the page (server actions could miss setConfig).\n `export { AdminApp as default } from 'octocms/admin';\n`,\n // 0.5.x with depth-counted configInit (replaced by bare-specifier alias).\n `// Registers setConfig() for server actions — some POST bundles skip layout.tsx.\nimport '../../../cms/__generated__/configInit';\n\nexport { AdminApp as default } from 'octocms/admin';\n`,\n];\n\nexport const nextAuthRouteTemplate = `import NextAuth from 'next-auth';\nimport { authOptions } from 'octocms/admin/auth';\n\nconst handler = NextAuth(authOptions);\n\nexport { handler as GET, handler as POST };\n`;\n\n/**\n * Build a thin re-export Route Handler for the chat-agent SSE endpoint.\n *\n * The actual handler lives in `octocms/agent/chatApi.ts`\n * (`chatRoute` / `chatStatusRoute`). The user-app file just:\n * 1. side-effect-imports `cms/__generated__/configInit` so\n * `getAgentConfig()` resolves on cold start (Route Handlers don't run\n * `app/layout.tsx`); and\n * 2. re-exports `chatRoute` as `POST` and `chatStatusRoute` as `GET`.\n *\n * The configInit import uses the bare specifier (resolved by the bundler\n * alias from `withOctoCMS()`), so the route file is depth-agnostic and can be\n * placed under `app/` or `src/app/` without code changes.\n */\nexport function agentChatRouteTemplate(): string {\n return `// Side-effect import: registers \\`configOctoCMS\\` + \\`agentConfig\\` into the\n// runtime stores so \\`getAgentConfig()\\` resolves on cold start. Route Handlers\n// don't run \\`app/layout.tsx\\`, so this import has to live here.\n${CONFIG_INIT_IMPORT}\n\nexport { chatRoute as POST, chatStatusRoute as GET } from 'octocms/agent';\n`;\n}\n\n/**\n * Build a thin re-export Route Handler for the `/media/[...slug]` proxy.\n *\n * The actual handler lives in `octocms/admin/mediaRoute.ts`\n * (`mediaRoute`). The user-app file just:\n * 1. side-effect-imports `cms/__generated__/configInit` so `getConfig()`\n * resolves on cold start (Route Handlers don't run `app/layout.tsx`); and\n * 2. re-exports `mediaRoute` as `GET`.\n *\n * The configInit import uses the bare specifier (resolved by the bundler\n * alias from `withOctoCMS()`), so the route file is depth-agnostic.\n */\nexport function mediaRouteTemplate(): string {\n return `// Side-effect import: registers \\`configOctoCMS\\` into the runtime store so\n// \\`getConfig()\\` resolves on cold start. Route Handlers don't run\n// \\`app/layout.tsx\\`, so this import has to live here.\n${CONFIG_INIT_IMPORT}\n\nexport { mediaRoute as GET } from 'octocms/admin/mediaRoute';\n`;\n}\n\n/**\n * Build a thin re-export Route Handler for the public-site `/api/search`\n * endpoint consumed by the `SearchBox` component shipped at\n * `octocms/components/public`.\n *\n * The actual handler lives in `octocms/admin/searchRoute.ts`\n * (`searchRoute`). The user-app file just:\n * 1. side-effect-imports `cms/__generated__/configInit` so `getConfig()`\n * resolves on cold start (Route Handlers don't run `app/layout.tsx`); and\n * 2. re-exports `searchRoute` as `GET`.\n *\n * The configInit import uses the bare specifier (resolved by the bundler\n * alias from `withOctoCMS()`), so the route file is depth-agnostic.\n */\nexport function searchRouteTemplate(): string {\n return `// Side-effect import: registers \\`configOctoCMS\\` into the runtime store so\n// \\`getConfig()\\` resolves on cold start. Route Handlers don't run\n// \\`app/layout.tsx\\`, so this import has to live here.\n${CONFIG_INIT_IMPORT}\n\nexport { searchRoute as GET } from 'octocms/admin/searchRoute';\n`;\n}\n\ntype SchemaInitOpts = { projectName: string; baseBranch: string; pointerBranch?: string };\n\n/**\n * The starter schema used by `octocms init`. The data lives in `cms/schema.json`\n * (source of truth — hand-editable + edited by the Content Model UI). The other\n * two scaffolded files (`cms/__generated__/schema.ts` and `cms/octocms.config.ts`)\n * mirror this same shape — keep them aligned by editing here only and letting\n * `npx octocms types:gen` regenerate the rest in the user's project.\n */\nfunction buildStarterSchema(opts: SchemaInitOpts): Record<string, unknown> {\n const git: Record<string, string> = { baseBranch: opts.baseBranch };\n if (opts.pointerBranch) git.publishedPointerBranch = opts.pointerBranch;\n return {\n projectName: opts.projectName,\n git,\n contentFolder: 'cms/content',\n mediaContentFolder: 'cms/media',\n mediaFolder: 'public/media',\n mediaAllowedFormats: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'avif'],\n collections: {\n helloPage: {\n label: 'Hello Page',\n fields: {\n title: { label: 'Title', format: 'string', entryTitle: true, required: true },\n description: { label: 'Description', format: 'text' },\n },\n },\n },\n };\n}\n\n/**\n * `cms/schema.json` — the source of truth. The Content Model UI (`/cms/model`)\n * reads and writes this file via `getSchema()` / `saveSchema()` server actions.\n */\nexport function schemaJsonTemplate(opts: SchemaInitOpts): string {\n return JSON.stringify(buildStarterSchema(opts), null, 2) + '\\n';\n}\n\n/**\n * `cms/__generated__/schema.ts` — auto-generated literal-typed mirror of\n * `cms/schema.json`. Required because `query()` infers narrow collection /\n * field / format types from the literal `defineConfig()` call — a plain JSON\n * import cannot preserve those literals.\n *\n * `npx octocms types:gen` regenerates this from `cms/schema.json` after every\n * schema edit (and `npm run types:check` fails on drift).\n */\nexport function generatedSchemaShimTemplate(opts: SchemaInitOpts): string {\n const gitBlock = opts.pointerBranch\n ? ` git: {\\n baseBranch: '${opts.baseBranch}',\\n publishedPointerBranch: '${opts.pointerBranch}',\\n },`\n : ` git: { baseBranch: '${opts.baseBranch}' },`;\n return `/*\n * AUTO-GENERATED — DO NOT EDIT.\n * Generated from cms/schema.json.\n * Run \\`npx octocms types:gen\\` to regenerate.\n */\n\nimport { defineConfig } from 'octocms/defineConfig';\n\nexport const schema = defineConfig({\n projectName: '${opts.projectName}',\n${gitBlock}\n contentFolder: 'cms/content',\n mediaContentFolder: 'cms/media',\n mediaFolder: 'public/media',\n mediaAllowedFormats: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'avif'],\n collections: {\n helloPage: {\n label: 'Hello Page',\n fields: {\n title: { label: 'Title', format: 'string', entryTitle: true, required: true },\n description: { label: 'Description', format: 'text' },\n },\n },\n },\n});\n`;\n}\n\n/**\n * `cms/octocms.config.ts` — thin TS binding. Imports the literal-typed\n * `schema` from the generated shim and re-exports it as `configOctoCMS` (the\n * runtime `Config`) and `OctoConfig` (the literal type used by `query()`).\n *\n * Hand-edits should go to `cms/schema.json`. After editing the JSON, run\n * `npx octocms types:gen` to refresh `cms/__generated__/schema.ts`.\n */\nexport function octoConfigTemplate(_opts: SchemaInitOpts): string {\n return `import type { Config } from 'octocms/types';\nimport { schema } from './__generated__/schema';\n\n/**\n * The schema is defined in \\`cms/schema.json\\` (source of truth — hand-editable\n * and editable through the Content Model UI). \\`npx octocms types:gen\\` mirrors\n * it into \\`cms/__generated__/schema.ts\\` as a literal-typed \\`defineConfig()\\`\n * call so the downstream \\`query()\\` API can infer narrow collection / field /\n * format types (which a plain JSON import cannot preserve).\n *\n * \\`npm run types:check\\` fails if the JSON and the generated shim drift.\n */\nconst _typedConfigOctoCMS = schema;\n\n/** Runtime config — widened to \\`Config\\` for dynamic indexing in CMS internals. */\nexport const configOctoCMS: Config = _typedConfigOctoCMS as Config;\n\n/**\n * Exact literal type of the config — use this for type-level inference only\n * (e.g. the \\`query()\\` API derives collection/field names from it).\n */\nexport type OctoConfig = typeof _typedConfigOctoCMS;\n`;\n}\n\nexport function nextConfigTemplate(): string {\n return `import type { NextConfig } from 'next';\nimport { withOctoCMS } from 'octocms/config';\nimport { configOctoCMS } from './cms/octocms.config';\n\nexport { configOctoCMS } from './cms/octocms.config';\nexport type { OctoConfig } from './cms/octocms.config';\n\nconst nextConfig: NextConfig = {};\n\nexport default withOctoCMS(nextConfig, configOctoCMS);\n`;\n}\n\nexport function demoHelloPageJson(): string {\n return JSON.stringify(\n {\n sys: { id: '0000', type: 'helloPage', status: 'merged' },\n fields: {\n title: 'Hello World',\n description: 'Welcome to your new OctoCMS site! Edit this content in the CMS admin panel.',\n },\n },\n null,\n 2,\n );\n}\n\nexport const helloPageTemplate = `import { query } from 'cms/__generated__/query';\n\nexport default async function HelloPage() {\n const page = await query('helloPage').first();\n if (!page) return null;\n return (\n <main>\n <h1>{page.fields.title}</h1>\n <p>{page.fields.description}</p>\n </main>\n );\n}\n`;\n\nexport function readmeTemplate(projectName: string): string {\n return `# ${projectName}\n\nBuilt with [OctoCMS](https://octocms.com) — a file-based CMS on Next.js.\n\n## Setup\n\n### 1. Install dependencies\n\n\\`\\`\\`bash\nnpm install octocms next-auth @tanstack/react-query @mdxeditor/editor \\\\\n minisearch octokit \\\\\n react-markdown rehype-sanitize remark-gfm remark-mdx \\\\\n sharp zod\n\\`\\`\\`\n\n> The exact list (with the right \\`octocms\\` version pin) is also printed by \\`npx octocms init\\` — copy it from there.\n\n### 2. Create a GitHub App\n\nFollow the [OctoCMS GitHub App setup guide](https://octocms.com/docs/github-app) to create a GitHub App for authentication.\n\n### 3. Configure environment variables\n\nCopy the values from your GitHub App into \\`.env.local\\`:\n\n\\`\\`\\`bash\n# GitHub App credentials (required for CMS auth)\nGITHUB_ID=your_github_app_client_id\nGITHUB_SECRET=your_github_app_client_secret\n\n# NextAuth (generate secret: openssl rand -base64 32)\nNEXTAUTH_SECRET=your_nextauth_secret\nNEXTAUTH_URL=http://localhost:3000\n\n# GitHub repo for content storage (required in production)\nGITHUB_REPO_OWNER=your_github_username_or_org\nGITHUB_REPO_NAME=your_repo_name\n\n# Optional: static GitHub token for private repos / higher API rate limits\n# CMS_GITHUB_TOKEN=your_github_pat\n\\`\\`\\`\n\n### 4. Run the dev server\n\n\\`\\`\\`bash\nnpm run dev\n\\`\\`\\`\n\nOpen [http://localhost:3000/cms](http://localhost:3000/cms) to access the CMS admin.\n`;\n}\n\nexport function envLocalTemplate(): string {\n return `# GitHub App credentials (required for CMS auth)\n# Create a GitHub App at: https://github.com/settings/apps/new\nGITHUB_ID=\nGITHUB_SECRET=\n\n# NextAuth secret — generate with: openssl rand -base64 32\nNEXTAUTH_SECRET=\nNEXTAUTH_URL=http://localhost:3000\n\n# GitHub repo for content storage (required in production)\nGITHUB_REPO_OWNER=\nGITHUB_REPO_NAME=\n\n# Optional: static GitHub token for private repos or higher API rate limits\n# CMS_GITHUB_TOKEN=\n`;\n}\n\nconst AGENT_DOCS_MARKER = '<!-- octocms:agent-docs -->';\n\nexport function agentsMdSection(): string {\n return `${AGENT_DOCS_MARKER}\n## OctoCMS — AI Content Management\n\nFor tasks that involve creating, editing, or deleting CMS content directly (without the admin UI), read the auto-generated agent docs:\n\n- **\\`octocms/docs/overview.md\\`** — How to find, create, update, and delete content entries via file operations\n- **\\`octocms/docs/schema.md\\`** — Per-collection field definitions, example JSON, and file path conventions\n\nThese docs are generated from \\`cms/octocms.config.ts\\`. Regenerate after schema changes: \\`npm run agent-docs:gen\\`.`;\n}\n\nexport function agentsMdTemplate(): string {\n return `# Project Guidelines\n\n${agentsMdSection()}\n`;\n}\n\nexport function tsconfigPaths(): Record<string, string[]> {\n return {\n 'cms/__generated__': ['./cms/__generated__/index.ts'],\n 'cms/__generated__/*': ['./cms/__generated__/*'],\n '@/*': ['./src/*'],\n };\n}\n"],"mappings":";AAIA,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB,IAAM,yBACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBK,IAAM,yBACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BK,IAAM,gCACX,iBACA;AAAA;AAAA;AAAA;AAA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AA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAc1B,SAAS,eAAe,aAA6B;AAC1D,SAAO,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkDzB;AAEO,SAAS,mBAA2B;AACzC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBT;AAEA,IAAM,oBAAoB;AAEnB,SAAS,kBAA0B;AACxC,SAAO,GAAG,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS7B;AAEO,SAAS,mBAA2B;AACzC,SAAO;AAAA;AAAA,EAEP,gBAAgB,CAAC;AAAA;AAEnB;AAEO,SAAS,gBAA0C;AACxD,SAAO;AAAA,IACL,qBAAqB,CAAC,8BAA8B;AAAA,IACpD,uBAAuB,CAAC,uBAAuB;AAAA,IAC/C,OAAO,CAAC,SAAS;AAAA,EACnB;AACF;","names":[]}
1
+ {"version":3,"sources":["../cli/lib/templates.ts"],"sourcesContent":["/**\n * File templates used by `octocms init` and `octocms update`.\n */\n\nconst CODEGEN_BANNER = `/*\n * AUTO-GENERATED — DO NOT EDIT.\n * Generated from cms/octocms.config.ts.\n * Run \\`npx octocms types:gen\\` to regenerate.\n */\n\n`;\n\n/** Static cms/__generated__/types.ts for the helloPage demo schema. */\nexport const generatedTypesTemplate =\n CODEGEN_BANNER +\n `import type { EntryStatus } from 'octocms/types';\n\nexport interface HelloPageFields {\n title: string;\n description: string;\n}\n\nexport interface HelloPageEntry {\n sys: { id: string; type: 'helloPage'; status: EntryStatus };\n fields: HelloPageFields;\n}\n\nexport type AnyEntry = HelloPageEntry;\n\nexport type EntryMap = {\n helloPage: HelloPageEntry;\n};\n`;\n\n/** Static cms/__generated__/enums.ts for the helloPage demo schema. */\nexport const generatedEnumsTemplate =\n CODEGEN_BANNER +\n `export const CollectionName = {\n HelloPage: 'helloPage',\n} as const;\nexport type CollectionName = (typeof CollectionName)[keyof typeof CollectionName];\n\nexport const COLLECTION_NAMES = ['helloPage'] as const;\n\nexport const FieldFormat = {\n String: 'string',\n Text: 'text',\n Markdown: 'markdown',\n Boolean: 'boolean',\n Reference: 'reference',\n Image: 'image',\n Number: 'number',\n Datetime: 'datetime',\n Json: 'json',\n Slug: 'slug',\n Select: 'select',\n Url: 'url',\n Color: 'color',\n Conditional: 'conditional',\n Richtext: 'richtext',\n} as const;\nexport type FieldFormat = (typeof FieldFormat)[keyof typeof FieldFormat];\n`;\n\n/** Static cms/__generated__/content.d.ts for the helloPage demo schema. */\nexport const generatedContentDeclsTemplate =\n CODEGEN_BANNER +\n `import type { EntryStatus } from 'octocms/types';\n\n// Raw on-disk types (before query() processing).\nexport interface RawHelloPageFields {\n title: string;\n description: string;\n}\n\nexport interface RawHelloPageEntry {\n sys: { id: string; type: 'helloPage'; status: EntryStatus };\n fields: RawHelloPageFields;\n}\n`;\n\n/** Static cms/__generated__/index.ts — always the same shape. */\nexport const generatedIndexTemplate =\n CODEGEN_BANNER +\n `export * from './types';\nexport * from './enums';\nexport * from './query';\n`;\n\n/** Static cms/__generated__/query.ts — always the same shape (schema-independent). */\nexport const generatedQueryTemplate =\n CODEGEN_BANNER +\n `import { createQuery } from 'octocms/query';\nimport { configOctoCMS, type OctoConfig } from '../octocms.config';\nimport type { EntryMap } from './types';\n\n// configOctoCMS is widened to Config for admin internals; cast back to OctoConfig so\n// createQuery preserves literal collection/field names for type-safe queries.\nexport const query = createQuery<EntryMap, OctoConfig>(configOctoCMS as unknown as OctoConfig);\n`;\n\n/** Static cms/__generated__/configInit.ts — always the same shape (schema-independent). */\nexport const generatedConfigInitTemplate =\n CODEGEN_BANNER +\n `import { configOctoCMS } from '../octocms.config';\nimport { setConfig } from 'octocms/lib/configStore';\n\nsetConfig(configOctoCMS);\n`;\n\n/**\n * All scaffolded files import the generated config initialiser via the bare\n * specifier `cms/__generated__/configInit`. Resolution works in two layers:\n *\n * - TypeScript IntelliSense: the consumer's `tsconfig.json` `paths` (added\n * by `octocms init`).\n * - Bundler: an alias registered by `withOctoCMS()` so Webpack and Turbopack\n * resolve the bare specifier from anywhere — including `app/layout.tsx`,\n * route handlers at any depth, and files inside `node_modules/octocms/`.\n *\n * This eliminates the previous depth-counting (`'../../../cms/...'`) that was\n * a recurring source of off-by-one bugs across templates and routes.\n */\nconst CONFIG_INIT_IMPORT = \"import 'cms/__generated__/configInit';\";\n\n/**\n * Minimal root layout written when `app/layout.tsx` does not already exist.\n * The configInit import is the critical side-effect; the rest is a Next.js\n * boilerplate shell.\n */\nexport const rootLayoutTemplate = `${CONFIG_INIT_IMPORT}\nimport type { Metadata } from 'next';\n\nexport const metadata: Metadata = {\n title: 'My App',\n};\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\">\n <body>{children}</body>\n </html>\n );\n}\n`;\n\n/** The one-liner prepended to an existing root layout to register the config. */\nexport const rootLayoutConfigInitImport = `${CONFIG_INIT_IMPORT}\\n`;\n\nexport function buildAdminLayoutTemplate(): string {\n return `${CONFIG_INIT_IMPORT}\nimport '@mdxeditor/editor/style.css';\nimport 'octocms/globals.css';\n\nexport { AdminLayout as default, metadata } from 'octocms/admin';\n`;\n}\n\n/**\n * Catch-all admin route — every \\`/cms/*\\` URL renders the package's\n * \\`AdminApp\\` async server component (awaits \\`params\\`, no outer Suspense).\n * Side-effect-imports \\`configInit\\` so server-action bundles register\n * \\`setConfig()\\` even when Next.js does not load \\`layout.tsx\\` for the POST.\n */\nexport function buildAdminPageTemplate(): string {\n return `// Registers setConfig() for server actions — some POST bundles skip layout.tsx.\n${CONFIG_INIT_IMPORT}\n\nexport { AdminApp as default } from 'octocms/admin';\n`;\n}\n\n/**\n * Admin error boundary — rendered by Next.js when anything in the catch-all\n * tree throws during render. Re-uses the shared \\`AdminErrorView\\` so GitHub\n * config / auth / availability / rate-limit copy stays consistent with the\n * public-page error boundary.\n */\nexport const adminErrorTemplate = `'use client';\n\nexport { AdminError as default } from 'octocms/admin';\n`;\n\n/**\n * Historical template values used by \\`octocms update\\` to recognise an\n * unmodified install when migrating between routing models. Each entry is\n * the literal file content shipped by a previous OctoCMS version. If a\n * user-app file matches one of these byte-for-byte, \\`update\\` will replace\n * it with the current template; otherwise it leaves it alone.\n */\nexport const LEGACY_ADMIN_LAYOUT_TEMPLATES: ReadonlyArray<string> = [\n // 0.4.x — re-exported from the deep path.\n `import '../../cms/__generated__/configInit';\nimport 'octocms/globals.css';\nimport '@mdxeditor/editor/style.css';\n\nexport { AdminLayout as default, metadata } from 'octocms/admin/pages/AdminLayout';\n`,\n // 0.5.x — barrel re-export with depth-counted relative configInit import.\n `import '../../cms/__generated__/configInit';\nimport 'octocms/globals.css';\nimport '@mdxeditor/editor/style.css';\n\nexport { AdminLayout as default, metadata } from 'octocms/admin';\n`,\n];\n\nexport const LEGACY_ADMIN_CATCH_ALL_TEMPLATES: ReadonlyArray<string> = [\n // 0.4.x — re-exported from the deep path.\n `export { AdminApp as default } from 'octocms/admin/AdminApp';\n`,\n // 0.5.x — barrel re-export without configInit on the page (server actions could miss setConfig).\n `export { AdminApp as default } from 'octocms/admin';\n`,\n // 0.5.x with depth-counted configInit (replaced by bare-specifier alias).\n `// Registers setConfig() for server actions — some POST bundles skip layout.tsx.\nimport '../../../cms/__generated__/configInit';\n\nexport { AdminApp as default } from 'octocms/admin';\n`,\n];\n\nexport const nextAuthRouteTemplate = `import NextAuth from 'next-auth';\nimport { authOptions } from 'octocms/admin/auth';\n\nconst handler = NextAuth(authOptions);\n\nexport { handler as GET, handler as POST };\n`;\n\n/**\n * Build a thin re-export Route Handler for the chat-agent SSE endpoint.\n *\n * The actual handler lives in `octocms/agent/chatApi.ts`\n * (`chatRoute` / `chatStatusRoute`). The user-app file just:\n * 1. side-effect-imports `cms/__generated__/configInit` so\n * `getAgentConfig()` resolves on cold start (Route Handlers don't run\n * `app/layout.tsx`); and\n * 2. re-exports `chatRoute` as `POST` and `chatStatusRoute` as `GET`.\n *\n * The configInit import uses the bare specifier (resolved by the bundler\n * alias from `withOctoCMS()`), so the route file is depth-agnostic and can be\n * placed under `app/` or `src/app/` without code changes.\n */\nexport function agentChatRouteTemplate(): string {\n return `// Side-effect import: registers \\`configOctoCMS\\` + \\`agentConfig\\` into the\n// runtime stores so \\`getAgentConfig()\\` resolves on cold start. Route Handlers\n// don't run \\`app/layout.tsx\\`, so this import has to live here.\n${CONFIG_INIT_IMPORT}\n\nexport { chatRoute as POST, chatStatusRoute as GET } from 'octocms/agent';\n`;\n}\n\n/**\n * Build a thin re-export Route Handler for the `/media/[...slug]` proxy.\n *\n * The actual handler lives in `octocms/admin/mediaRoute.ts`\n * (`mediaRoute`). The user-app file just:\n * 1. side-effect-imports `cms/__generated__/configInit` so `getConfig()`\n * resolves on cold start (Route Handlers don't run `app/layout.tsx`); and\n * 2. re-exports `mediaRoute` as `GET`.\n *\n * The configInit import uses the bare specifier (resolved by the bundler\n * alias from `withOctoCMS()`), so the route file is depth-agnostic.\n */\nexport function mediaRouteTemplate(): string {\n return `// Side-effect import: registers \\`configOctoCMS\\` into the runtime store so\n// \\`getConfig()\\` resolves on cold start. Route Handlers don't run\n// \\`app/layout.tsx\\`, so this import has to live here.\n${CONFIG_INIT_IMPORT}\n\nexport { mediaRoute as GET } from 'octocms/admin/mediaRoute';\n`;\n}\n\n/**\n * Build a thin re-export Route Handler for the public-site `/api/search`\n * endpoint consumed by the `SearchBox` component shipped at\n * `octocms/components/public`.\n *\n * The actual handler lives in `octocms/admin/searchRoute.ts`\n * (`searchRoute`). The user-app file just:\n * 1. side-effect-imports `cms/__generated__/configInit` so `getConfig()`\n * resolves on cold start (Route Handlers don't run `app/layout.tsx`); and\n * 2. re-exports `searchRoute` as `GET`.\n *\n * The configInit import uses the bare specifier (resolved by the bundler\n * alias from `withOctoCMS()`), so the route file is depth-agnostic.\n */\nexport function searchRouteTemplate(): string {\n return `// Side-effect import: registers \\`configOctoCMS\\` into the runtime store so\n// \\`getConfig()\\` resolves on cold start. Route Handlers don't run\n// \\`app/layout.tsx\\`, so this import has to live here.\n${CONFIG_INIT_IMPORT}\n\nexport { searchRoute as GET } from 'octocms/admin/searchRoute';\n`;\n}\n\ntype SchemaInitOpts = { projectName: string; baseBranch: string; pointerBranch?: string };\n\n/**\n * The starter schema used by `octocms init`. The data lives in `cms/schema.json`\n * (source of truth — hand-editable + edited by the Content Model UI). The other\n * two scaffolded files (`cms/__generated__/schema.ts` and `cms/octocms.config.ts`)\n * mirror this same shape — keep them aligned by editing here only and letting\n * `npx octocms types:gen` regenerate the rest in the user's project.\n */\nfunction buildStarterSchema(opts: SchemaInitOpts): Record<string, unknown> {\n const git: Record<string, string> = { baseBranch: opts.baseBranch };\n if (opts.pointerBranch) git.publishedPointerBranch = opts.pointerBranch;\n return {\n projectName: opts.projectName,\n git,\n contentFolder: 'cms/content',\n mediaContentFolder: 'cms/media',\n mediaFolder: 'public/media',\n mediaAllowedFormats: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'avif'],\n collections: {\n helloPage: {\n label: 'Hello Page',\n fields: {\n title: { label: 'Title', format: 'string', entryTitle: true, required: true },\n description: { label: 'Description', format: 'text' },\n },\n },\n },\n };\n}\n\n/**\n * `cms/schema.json` — the source of truth. The Content Model UI (`/cms/model`)\n * reads and writes this file via `getSchema()` / `saveSchema()` server actions.\n */\nexport function schemaJsonTemplate(opts: SchemaInitOpts): string {\n return JSON.stringify(buildStarterSchema(opts), null, 2) + '\\n';\n}\n\n/**\n * `cms/__generated__/schema.ts` — auto-generated literal-typed mirror of\n * `cms/schema.json`. Required because `query()` infers narrow collection /\n * field / format types from the literal `defineConfig()` call — a plain JSON\n * import cannot preserve those literals.\n *\n * `npx octocms types:gen` regenerates this from `cms/schema.json` after every\n * schema edit (and `npm run types:check` fails on drift).\n */\nexport function generatedSchemaShimTemplate(opts: SchemaInitOpts): string {\n const gitBlock = opts.pointerBranch\n ? ` git: {\\n baseBranch: '${opts.baseBranch}',\\n publishedPointerBranch: '${opts.pointerBranch}',\\n },`\n : ` git: { baseBranch: '${opts.baseBranch}' },`;\n return `/*\n * AUTO-GENERATED — DO NOT EDIT.\n * Generated from cms/schema.json.\n * Run \\`npx octocms types:gen\\` to regenerate.\n */\n\nimport { defineConfig } from 'octocms/defineConfig';\n\nexport const schema = defineConfig({\n projectName: '${opts.projectName}',\n${gitBlock}\n contentFolder: 'cms/content',\n mediaContentFolder: 'cms/media',\n mediaFolder: 'public/media',\n mediaAllowedFormats: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'avif'],\n collections: {\n helloPage: {\n label: 'Hello Page',\n fields: {\n title: { label: 'Title', format: 'string', entryTitle: true, required: true },\n description: { label: 'Description', format: 'text' },\n },\n },\n },\n});\n`;\n}\n\n/**\n * `cms/octocms.config.ts` — thin TS binding. Imports the literal-typed\n * `schema` from the generated shim and re-exports it as `configOctoCMS` (the\n * runtime `Config`) and `OctoConfig` (the literal type used by `query()`).\n *\n * Hand-edits should go to `cms/schema.json`. After editing the JSON, run\n * `npx octocms types:gen` to refresh `cms/__generated__/schema.ts`.\n */\nexport function octoConfigTemplate(_opts: SchemaInitOpts): string {\n return `import type { Config } from 'octocms/types';\nimport { schema } from './__generated__/schema';\n\n/**\n * The schema is defined in \\`cms/schema.json\\` (source of truth — hand-editable\n * and editable through the Content Model UI). \\`npx octocms types:gen\\` mirrors\n * it into \\`cms/__generated__/schema.ts\\` as a literal-typed \\`defineConfig()\\`\n * call so the downstream \\`query()\\` API can infer narrow collection / field /\n * format types (which a plain JSON import cannot preserve).\n *\n * \\`npm run types:check\\` fails if the JSON and the generated shim drift.\n */\nconst _typedConfigOctoCMS = schema;\n\n/** Runtime config — widened to \\`Config\\` for dynamic indexing in CMS internals. */\nexport const configOctoCMS: Config = _typedConfigOctoCMS as Config;\n\n/**\n * Exact literal type of the config — use this for type-level inference only\n * (e.g. the \\`query()\\` API derives collection/field names from it).\n */\nexport type OctoConfig = typeof _typedConfigOctoCMS;\n`;\n}\n\nexport function nextConfigTemplate(): string {\n return `import type { NextConfig } from 'next';\nimport { withOctoCMS } from 'octocms/config';\nimport { configOctoCMS } from './cms/octocms.config';\n\nexport { configOctoCMS } from './cms/octocms.config';\nexport type { OctoConfig } from './cms/octocms.config';\n\nconst nextConfig: NextConfig = {};\n\nexport default withOctoCMS(nextConfig, configOctoCMS);\n`;\n}\n\nexport function demoHelloPageJson(): string {\n return JSON.stringify(\n {\n sys: { id: '0000', type: 'helloPage', status: 'merged' },\n fields: {\n title: 'Hello World',\n description: 'Welcome to your new OctoCMS site! Edit this content in the CMS admin panel.',\n },\n },\n null,\n 2,\n );\n}\n\nexport const helloPageTemplate = `import { query } from 'cms/__generated__/query';\n\nexport default async function HelloPage() {\n const page = await query('helloPage').first();\n if (!page) return null;\n return (\n <main>\n <h1>{page.fields.title}</h1>\n <p>{page.fields.description}</p>\n </main>\n );\n}\n`;\n\nexport function readmeTemplate(projectName: string): string {\n return `# ${projectName}\n\nBuilt with [OctoCMS](https://octocms.gunkin.dev) — a file-based CMS on Next.js.\n\n## Setup\n\n### 1. Install dependencies\n\n\\`\\`\\`bash\nnpm install octocms next-auth @tanstack/react-query @mdxeditor/editor \\\\\n minisearch octokit \\\\\n react-markdown rehype-sanitize remark-gfm remark-mdx \\\\\n sharp zod\n\\`\\`\\`\n\n> The exact list (with the right \\`octocms\\` version pin) is also printed by \\`npx octocms init\\` — copy it from there.\n\n### 2. Create a GitHub App\n\nFollow the [OctoCMS GitHub App setup guide](https://octocms.gunkin.dev/docs/github-app) to create a GitHub App for authentication.\n\n### 3. Configure environment variables\n\nCopy the values from your GitHub App into \\`.env.local\\`:\n\n\\`\\`\\`bash\n# GitHub App credentials (required for CMS auth)\nGITHUB_ID=your_github_app_client_id\nGITHUB_SECRET=your_github_app_client_secret\n\n# NextAuth (generate secret: openssl rand -base64 32)\nNEXTAUTH_SECRET=your_nextauth_secret\nNEXTAUTH_URL=http://localhost:3000\n\n# GitHub repo for content storage (required in production)\nGITHUB_REPO_OWNER=your_github_username_or_org\nGITHUB_REPO_NAME=your_repo_name\n\n# Optional: static GitHub token for private repos / higher API rate limits\n# CMS_GITHUB_TOKEN=your_github_pat\n\\`\\`\\`\n\n### 4. Run the dev server\n\n\\`\\`\\`bash\nnpm run dev\n\\`\\`\\`\n\nOpen [http://localhost:3000/cms](http://localhost:3000/cms) to access the CMS admin.\n`;\n}\n\nexport function envLocalTemplate(): string {\n return `# GitHub App credentials (required for CMS auth)\n# Create a GitHub App at: https://github.com/settings/apps/new\nGITHUB_ID=\nGITHUB_SECRET=\n\n# NextAuth secret — generate with: openssl rand -base64 32\nNEXTAUTH_SECRET=\nNEXTAUTH_URL=http://localhost:3000\n\n# GitHub repo for content storage (required in production)\nGITHUB_REPO_OWNER=\nGITHUB_REPO_NAME=\n\n# Optional: static GitHub token for private repos or higher API rate limits\n# CMS_GITHUB_TOKEN=\n`;\n}\n\nconst AGENT_DOCS_MARKER = '<!-- octocms:agent-docs -->';\n\nexport function agentsMdSection(): string {\n return `${AGENT_DOCS_MARKER}\n## OctoCMS — AI Content Management\n\nFor tasks that involve creating, editing, or deleting CMS content directly (without the admin UI), read these docs:\n\n**Package docs (content-agnostic, stable):**\n\n- **\\`octocms/docs/overview.md\\`** — Generic content management (CRUD, entry shape, status values)\n- **\\`octocms/docs/editing-schema.md\\`** — How to edit \\`cms/schema.json\\` safely\n\n**Project docs (auto-generated from \\`cms/schema.json\\`):**\n\n- **\\`cms/__generated__/agent-docs/schema.md\\`** — Per-collection field definitions and example JSON\n- **\\`cms/__generated__/agent-docs/collections.md\\`** — Collection list and URL mapping\n\nRegenerate project docs after schema changes: \\`npm run agent-docs:gen\\` (or \\`npm run types:gen\\`).`;\n}\n\nexport function agentsMdTemplate(): string {\n return `# Project Guidelines\n\n${agentsMdSection()}\n`;\n}\n\nexport function tsconfigPaths(): Record<string, string[]> {\n return {\n 'cms/__generated__': ['./cms/__generated__/index.ts'],\n 'cms/__generated__/*': ['./cms/__generated__/*'],\n '@/*': ['./src/*'],\n };\n}\n"],"mappings":";AAIA,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB,IAAM,yBACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBK,IAAM,yBACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BK,IAAM,gCACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeK,IAAM,yBACX,iBACA;AAAA;AAAA;AAAA;AAMK,IAAM,yBACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUK,IAAM,8BACX,iBACA;AAAA;AAAA;AAAA;AAAA;AAmBF,IAAM,qBAAqB;AAOpB,IAAM,qBAAqB,GAAG,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBhD,IAAM,6BAA6B,GAAG,kBAAkB;AAAA;AAEx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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkDzB;AAEO,SAAS,mBAA2B;AACzC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBT;AAEA,IAAM,oBAAoB;AAEnB,SAAS,kBAA0B;AACxC,SAAO,GAAG,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgB7B;AAEO,SAAS,mBAA2B;AACzC,SAAO;AAAA;AAAA,EAEP,gBAAgB,CAAC;AAAA;AAEnB;AAEO,SAAS,gBAA0C;AACxD,SAAO;AAAA,IACL,qBAAqB,CAAC,8BAA8B;AAAA,IACpD,uBAAuB,CAAC,uBAAuB;AAAA,IAC/C,OAAO,CAAC,SAAS;AAAA,EACnB;AACF;","names":[]}
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  version
4
- } from "../chunk-TOUAHFDW.js";
4
+ } from "../chunk-CIKOAIJP.js";
5
5
  import {
6
6
  resolveProjectRoot
7
7
  } from "../chunk-ZYUK2J5L.js";
@@ -164,7 +164,7 @@ async function main() {
164
164
  try {
165
165
  switch (command) {
166
166
  case "init": {
167
- const { initCommand } = await import("../init-KNIWQGJL.js");
167
+ const { initCommand } = await import("../init-TZFZEP4O.js");
168
168
  await initCommand(process.cwd(), { yes: flags.yes === true });
169
169
  break;
170
170
  }
@@ -177,7 +177,7 @@ async function main() {
177
177
  }
178
178
  case "types:gen": {
179
179
  const projectRoot = resolveProjectRoot();
180
- const { typesGenCommand } = await import("../typesGen-MFAL3B4V.js");
180
+ const { typesGenCommand } = await import("../typesGen-QWWTC4SZ.js");
181
181
  await typesGenCommand(projectRoot);
182
182
  break;
183
183
  }
@@ -195,13 +195,13 @@ async function main() {
195
195
  }
196
196
  case "update": {
197
197
  const projectRoot = resolveProjectRoot();
198
- const { updateCommand } = await import("../update-QALIQG76.js");
198
+ const { updateCommand } = await import("../update-7KYYD57J.js");
199
199
  await updateCommand(projectRoot);
200
200
  break;
201
201
  }
202
202
  case "agent-docs": {
203
203
  const projectRoot = resolveProjectRoot();
204
- const { agentDocsCommand } = await import("../agentDocs-QZ4NOQVH.js");
204
+ const { agentDocsCommand } = await import("../agentDocs-6LQD3JUN.js");
205
205
  await agentDocsCommand(projectRoot);
206
206
  break;
207
207
  }
@@ -2,14 +2,15 @@
2
2
  * Agent documentation generators — pure functions that produce Markdown strings
3
3
  * describing how AI agents should manage OctoCMS content.
4
4
  *
5
- * Output is written to `octocms/docs/` by `scripts/generate-agent-docs.ts`
6
- * so it ships with the npm package.
5
+ * Project-specific output is written to `cms/__generated__/agent-docs/` by
6
+ * `npm run agent-docs:gen` (or `npm run types:gen`, which regenerates the
7
+ * same files along with TypeScript artifacts).
7
8
  */
8
9
  import type { CollectionField, Config } from 'octocms/types';
9
- export declare const AGENT_DOCS_BANNER = "<!--\n AUTO-GENERATED FILE \u2014 DO NOT EDIT.\n Generated by scripts/generate-agent-docs.ts from cms/schema.json.\n Run `npm run agent-docs:gen` to regenerate.\n-->\n\n";
10
+ export declare const AGENT_DOCS_BANNER = "<!--\n AUTO-GENERATED FILE \u2014 DO NOT EDIT.\n Generated from cms/schema.json via npm run agent-docs:gen.\n Run `npm run agent-docs:gen` (or `npm run types:gen`) to regenerate.\n-->\n\n";
10
11
  /** Return a JSON-safe placeholder value string for a field (for example entries). */
11
12
  export declare function placeholderValue(field: CollectionField, collectionNames: readonly string[]): string;
12
- export declare function generateAgentOverview(cfg: Config, collectionNames: readonly string[]): string;
13
+ export declare function generateAgentCollections(cfg: Config, collectionNames: readonly string[]): string;
13
14
  export declare function generateAgentSchema(cfg: Config, collectionNames: readonly string[]): string;
14
15
  export declare function generateAgentIndex(): string;
15
16
  //# sourceMappingURL=agentDocs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentDocs.d.ts","sourceRoot":"","sources":["../../../cli/lib/agentDocs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE7D,eAAO,MAAM,iBAAiB,iLAM7B,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CA2CnG;AAgDD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CA+J7F;AAMD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAiI3F;AAMD,wBAAgB,kBAAkB,IAAI,MAAM,CA6B3C"}
1
+ {"version":3,"file":"agentDocs.d.ts","sourceRoot":"","sources":["../../../cli/lib/agentDocs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE7D,eAAO,MAAM,iBAAiB,mMAM7B,CAAC;AAEF,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CA2CnG;AAgDD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAqEhG;AAMD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAiI3F;AAMD,wBAAgB,kBAAkB,IAAI,MAAM,CAoC3C"}