@dyrected/knowledge 0.2.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.md +50 -0
- package/README.md +17 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +2776 -0
- package/generated/SKILL.md +276 -0
- package/generated/ai-rules.md +152 -0
- package/generated/endpoints.json +891 -0
- package/generated/examples-inventory.json +3558 -0
- package/generated/intent-index.json +46 -0
- package/generated/llms-index.json +812 -0
- package/generated/openapi.json +1643 -0
- package/generated/recipes.json +224 -0
- package/generated/references.json +1573 -0
- package/package.json +56 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: Dyrected
|
|
6
|
+
Licensed Work: Dyrected
|
|
7
|
+
Additional Use Grant: Commercial use is permitted as long as it is not used to provide a hosted or managed service that competes with Dyrected.
|
|
8
|
+
Change Date: 2030-05-18
|
|
9
|
+
Change License: Apache License 2.0
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Business Source License 1.1
|
|
14
|
+
|
|
15
|
+
License text copyright © 2024 MariaDB plc, All Rights Reserved.
|
|
16
|
+
“Business Source License” is a trademark of MariaDB plc.
|
|
17
|
+
|
|
18
|
+
### Terms
|
|
19
|
+
|
|
20
|
+
The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
21
|
+
|
|
22
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
|
|
23
|
+
|
|
24
|
+
If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
|
|
25
|
+
|
|
26
|
+
All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
|
|
27
|
+
|
|
28
|
+
You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
|
|
29
|
+
|
|
30
|
+
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
|
31
|
+
|
|
32
|
+
This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License).
|
|
33
|
+
|
|
34
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
|
|
35
|
+
|
|
36
|
+
MariaDB hereby grants you permission to use this License’s text to license your works, and to refer to it using the trademark “Business Source License”, as long as you comply with the Covenants of Licensor below.
|
|
37
|
+
|
|
38
|
+
### Covenants of Licensor
|
|
39
|
+
|
|
40
|
+
In consideration of the right to use this License’s text and the “Business Source License” name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
|
|
41
|
+
|
|
42
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where “compatible” means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
|
|
43
|
+
|
|
44
|
+
2. To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text “None”.
|
|
45
|
+
|
|
46
|
+
3. Not to modify this License in any other way.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
The Business Source License (this document, or the “License”) is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @dyrected/knowledge
|
|
2
|
+
|
|
3
|
+
The canonical, machine-readable Dyrected knowledge catalogue. It contains compiled recipes, plain-language intent metadata, search helpers, and portable JSON artifacts used by the documentation site and future AI integrations.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { findRecipesByIntent, recipes } from "@dyrected/knowledge";
|
|
7
|
+
|
|
8
|
+
const matches = findRecipesByIntent("make the URL follow the title");
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Portable artifacts include recipes, intent mappings, TypeScript/JSDoc references, endpoint manifests, a representative OpenAPI document, AI rules, `SKILL.md`, and an LLM index. They are exported from package subpaths such as `@dyrected/knowledge/recipes.json`, `@dyrected/knowledge/references.json`, and `@dyrected/knowledge/openapi.json`.
|
|
12
|
+
|
|
13
|
+
The package is presentation-neutral: Fumadocs, MCP servers, skills, websites, and CLIs decide how to render or expose its content.
|
|
14
|
+
|
|
15
|
+
Every named field in a canonical recipe must define an explicit `label`. The generator validates this rule and fails before producing documentation when a label is missing.
|
|
16
|
+
|
|
17
|
+
Run `pnpm generate` to update committed artifacts and Fumadocs MDX. Run `pnpm generate:check` in CI to fail when generated output is stale.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
type RecipeCategory = "content-modeling" | "data-lifecycle" | "admin-experience" | "access-control" | "workflows" | "integrations";
|
|
2
|
+
interface Recipe {
|
|
3
|
+
/** Stable identifier used by JSON consumers and generated page paths. */
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
category: RecipeCategory;
|
|
8
|
+
/** Plain-language requests that should resolve to this recipe. */
|
|
9
|
+
intents: string[];
|
|
10
|
+
/** Dyrected APIs and concepts demonstrated by the recipe. */
|
|
11
|
+
concepts: string[];
|
|
12
|
+
/** Package names required in addition to @dyrected/core. */
|
|
13
|
+
requires: string[];
|
|
14
|
+
/** Canonical TypeScript source, compiled and tested in this package. */
|
|
15
|
+
source: string;
|
|
16
|
+
docsPath: string;
|
|
17
|
+
}
|
|
18
|
+
interface RecipeMatch {
|
|
19
|
+
recipe: Recipe;
|
|
20
|
+
score: number;
|
|
21
|
+
}
|
|
22
|
+
type ReferenceKind = "interface" | "type" | "class" | "function" | "constant";
|
|
23
|
+
interface ReferenceMember {
|
|
24
|
+
name: string;
|
|
25
|
+
signature: string;
|
|
26
|
+
description: string;
|
|
27
|
+
}
|
|
28
|
+
interface ReferenceEntry {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
kind: ReferenceKind;
|
|
32
|
+
category: "configuration" | "fields" | "hooks" | "adapters" | "sdk" | "workflows";
|
|
33
|
+
sourcePackage: string;
|
|
34
|
+
description: string;
|
|
35
|
+
signature: string;
|
|
36
|
+
members: ReferenceMember[];
|
|
37
|
+
}
|
|
38
|
+
interface EndpointReference {
|
|
39
|
+
id: string;
|
|
40
|
+
method: string;
|
|
41
|
+
path: string;
|
|
42
|
+
summary: string;
|
|
43
|
+
tags: string[];
|
|
44
|
+
authenticated: boolean;
|
|
45
|
+
parameters: Array<{
|
|
46
|
+
name: string;
|
|
47
|
+
in: string;
|
|
48
|
+
required: boolean;
|
|
49
|
+
description?: string;
|
|
50
|
+
}>;
|
|
51
|
+
responses: string[];
|
|
52
|
+
}
|
|
53
|
+
interface ExampleInventoryEntry {
|
|
54
|
+
id: string;
|
|
55
|
+
page: string;
|
|
56
|
+
language: string;
|
|
57
|
+
classification: "compiled-recipe" | "syntax-checked" | "parsed" | "command" | "illustrative";
|
|
58
|
+
validation: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare const recipes: readonly Recipe[];
|
|
62
|
+
|
|
63
|
+
declare const references: readonly ReferenceEntry[];
|
|
64
|
+
declare const endpoints: readonly EndpointReference[];
|
|
65
|
+
|
|
66
|
+
declare const AI_RULES = "# Dyrected AI Rules\n\nThis file combines authored operating rules with facts generated by `@dyrected/knowledge`.\n\n## Before writing code\n\n1. Check `package.json` and the workspace root to confirm `@dyrected/core` is installed.\n2. If it is not installed, use `npx @dyrected/cli init` and verify lint, types, and build before adding collections.\n3. If it is installed, inspect its installed version, public exports, and the existing `dyrected.config.ts`.\n4. When documentation and installed types disagree, follow the installed package.\n5. Detect the project's framework, database adapter, storage adapter, package manager, and deployment target before changing setup.\n\n## Hard constraints\n\n- Every named field must have an explicit human-readable `label`.\n- Never invent fields, hooks, configuration properties, SDK methods, adapter methods, or routes.\n- Never use `client.collections`; use `client.collection('slug')`.\n- Never define `email` or `password` on an `auth: true` collection.\n- Never add custom authentication middleware around Dyrected Admin routes.\n- Never remove or directly rename a persisted field. Use `renameTo`, and give new fields on existing schemas a safe `defaultValue`.\n- Use server hooks for correctness. Browser Admin hooks are an optional feedback layer, not the only implementation.\n- Use Jexl strings for `admin.condition` when the schema must synchronize with Dyrected Cloud.\n- Prefer the smallest required access permissions and enforce them in server configuration.\n\n## Setup and verification\n\n- New project: initialize, configure environment variables, database, storage and Admin route, then run lint, type checking and build.\n- Existing project: read the UI and current content model before proposing collections or globals. Preserve existing content and routes.\n- Existing Dyrected project: read the config first and make schema changes in small, verifiable batches.\n- Self-hosted and Cloud projects can have different schema synchronization and serialization constraints. Confirm the target before advising commands.\n\n## Modeling and migration guidance\n\n- Use `defineGlobal` for one shared settings document and `defineCollection` for repeatable entries.\n- Use `relationship` for the stored owning reference and `join` for a virtual reverse lookup.\n- Use `depth: 0` on lightweight lists; increase depth only when the view needs hydrated relations.\n- Use field hooks for one value and collection hooks for cross-field validation or derived data.\n- Use `workflow: publishingWorkflow()` for capability-controlled draft, review, and publication.\n- Treat collection slugs, field names, block slugs, and public URL patterns as persisted contracts.\n\n### Rename a field safely\n\n```ts\n{\n name: \"fullName\",\n type: \"text\",\n label: \"Full name\",\n renameTo: \"name\",\n defaultValue: \"\",\n}\n```\n\nKeep `renameTo` until production documents have been migrated and verified.\n\n## Security boundaries\n\n- Admin visibility and conditions are presentation, not authorization or validation.\n- Set ownership and other trusted fields in server hooks; do not trust client-submitted owner or role values.\n- Keep API keys and storage credentials out of browser bundles.\n- Grant destructive operations and workflow capabilities independently.\n- Use `expectedRevision` when workflow transitions can race with another editor.\n\n## Uploads and dynamic options\n\nUse `allowedMimeTypes` and `maxFileSize` for upload collections, consume returned URLs, and validate untrusted file contents. Use server option resolvers for database/secret-backed choices and Admin option hooks only for browser-safe dependent choices.\n\n## Supported field types\n\n<!-- GENERATED:FIELD_TYPES:START -->\n`text`, `textarea`, `richText`, `number`, `boolean`, `date`, `datetime`, `time`, `select`, `multiSelect`, `radio`, `relationship`, `array`, `object`, `json`, `blocks`, `image`, `email`, `url`, `icon`, `join`, `row`\n<!-- GENERATED:FIELD_TYPES:END -->\n\n## Compiled recipes\n\n<!-- GENERATED:RECIPES:START -->\n- [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug) \u2014 Generate stable URL slugs on the server while showing editors the value live in the Admin UI.\n- [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field) \u2014 Use a serializable Admin condition to reveal a field from the editor's current form values.\n- [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation) \u2014 Reject invalid combinations of field values before they reach the database.\n- [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown) \u2014 Change available Admin UI options immediately when an editor changes a related field.\n- [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow) \u2014 Attach Dyrected's standard editorial workflow and its capability-aware transitions to a collection.\n- [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access) \u2014 Return a where constraint from access control so authenticated users only read their own records.\n- [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks) \u2014 Define labeled hero, rich-text, and call-to-action blocks for an editor-controlled page layout.\n- [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join) \u2014 Store an author relationship on posts and expose the author's posts through a virtual join field.\n- [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access) \u2014 Allow public reads, editor writes, and administrator deletion with collection access rules.\n- [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename) \u2014 Use renameTo and a safe default while documents migrate lazily to a new field name.\n- [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection) \u2014 Enable file uploads and capture accessible metadata in a dedicated media collection.\n<!-- GENERATED:RECIPES:END -->\n\n## Intent-to-pattern index\n\n<!-- GENERATED:INTENTS:START -->\n- \u201Cmake the URL follow the title\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Cautomatically generate a slug\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Ccreate friendly URLs from titles\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Ckeep a slug synchronized with a title\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Cshow a field conditionally\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Chide irrelevant form fields\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Cshow discount only with a coupon\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Cmake the admin form react to another field\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Cvalidate fields before saving\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Cmake sure an end date is after the start date\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Creject invalid form submissions\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Cvalidate multiple fields together\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Cmake one dropdown depend on another\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Cshow states based on the selected country\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Ccreate a cascading dropdown\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Cupdate select options while editing\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Cadd draft and publish states\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Crequire review before publishing\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Ccreate an editorial workflow\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Clet editors submit content for approval\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Cusers should only see their own records\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cadd row level access\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cscope documents by owner\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cprevent users reading another user's data\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cbuild a page builder\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Clet editors arrange page sections\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Ccreate reusable content blocks\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Cmodel flexible landing pages\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Cconnect posts to authors\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Cshow every post written by a user\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Ccreate a reverse relationship\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Cmodel one-to-many content\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Conly editors can update content\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Crestrict deletion to admins\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Cmake content publicly readable\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Cadd role based access\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Crename a field safely\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Cchange a field name without losing data\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Cmigrate an existing schema\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Ckeep old documents working after a rename\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Clet editors upload images\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n- \u201Ccreate a media library\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n- \u201Cstore uploaded files\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n- \u201Cadd image uploads to my project\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n<!-- GENERATED:INTENTS:END -->\n\n## Canonical references\n\n<!-- GENERATED:REFERENCES:START -->\n- [Configuration](https://docs.dyrected.com/docs/reference/configuration)\n- [Fields and hooks](https://docs.dyrected.com/docs/reference/fields)\n- [Database adapters](https://docs.dyrected.com/docs/adapters/databases)\n- [Storage adapters](https://docs.dyrected.com/docs/adapters/storage)\n- [SDK](https://docs.dyrected.com/docs/reference/sdk)\n- [Workflows](https://docs.dyrected.com/docs/reference/generated-workflows)\n- [REST and OpenAPI](https://docs.dyrected.com/docs/reference/rest-api)\n<!-- GENERATED:REFERENCES:END -->\n\n## Completion checks\n\nRun the repository's lint, type-check, tests and build. Confirm generated files are current, configuration fields remain labeled, schema migrations preserve stored data, and authentication/access behavior is enforced server-side.\n";
|
|
67
|
+
declare const SKILL = "---\nname: dyrected\ndescription: Work correctly with Dyrected in new and existing projects using installation checks, schema safety rules, and compiled implementation recipes.\n---\n\n# Dyrected\n\nDyrected is a declarative, schema-driven headless CMS configured primarily through `dyrected.config.ts`.\n\n## Step 0 \u2014 determine the project state\n\nBefore changing code, inspect the nearest `package.json` and the workspace root.\n\n### Dyrected is not installed\n\nUse the CLI:\n\n```bash\nnpx @dyrected/cli init\n```\n\nDetect the framework, package manager, database requirements, storage requirements and deployment target. Let the CLI scaffold configuration, environment variables, Admin integration and AI rules. Verify lint, types and build before modeling content.\n\nFor an existing website, first inventory editable content and distinguish repeatable entries from singleton settings. Preserve the existing interface, content, URLs and behavior. Do not invent a new content model merely because it is convenient.\n\n### Dyrected is installed\n\nRead `dyrected.config.ts`, the installed `@dyrected/core` version and its public exports. Inspect the configured database, storage, email, collections, globals, authentication and workflows before proposing changes. Installed types take precedence over remembered APIs or newer documentation.\n\n## Operational rules\n\n1. Use public package imports such as `@dyrected/core` and `@dyrected/sdk`; do not reach into another workspace package's source directory.\n2. Every named field must define an explicit `label`.\n3. Never invent field types, hook names, configuration keys, adapter methods, SDK methods or REST routes.\n4. Use `client.collection('slug')`, never `client.collections`.\n5. Do not wrap Dyrected Admin routes in custom auth/session middleware.\n6. Do not define `email` or `password` fields on `auth: true` collections; Dyrected injects them.\n7. Do not delete or directly rename persisted fields. Use `renameTo`; add a safe `defaultValue` when introducing fields to existing schemas.\n8. Use server hooks for data correctness. Admin hooks improve live editor feedback but API writes bypass them.\n9. Use serializable Jexl conditions for Cloud-compatible schemas.\n10. Enforce permissions in server access configuration, not only by hiding Admin controls.\n\n## Core imports\n\nImport public APIs from package entry points:\n\n```ts\nimport { defineCollection, defineConfig, defineGlobal } from \"@dyrected/core\";\nimport { createClient, type InferSchema } from \"@dyrected/sdk\";\n```\n\nNever import from a monorepo source path such as `packages/core/src`. Verify the installed package exports when documentation and local types disagree.\n\n## Schema and deployment safety\n\n- Read the existing schema before editing it.\n- Make related changes in small batches and verify each batch.\n- Confirm whether the project is Cloud or self-hosted before giving schema synchronization instructions.\n- MongoDB is schema-less; relational adapters may require synchronization for promoted fields.\n- Use `relationship` for the owning stored reference and `join` for a virtual reverse lookup.\n- Use `depth: 0` for lightweight lists and increase depth only when related documents are required.\n- Use hooks for derived values, validation, side effects and revalidation.\n- Use `workflow: publishingWorkflow()` when the requirement is draft, review and publication rather than inventing status logic.\n- Use `defineGlobal` for singleton settings and `defineCollection` for repeatable entries.\n\n### Rename a field safely\n\nThe current `name` is the new key and `renameTo` is the previous stored key:\n\n```ts\n{\n name: \"fullName\",\n type: \"text\",\n label: \"Full name\",\n renameTo: \"name\",\n defaultValue: \"\",\n}\n```\n\nKeep the fallback until production documents are migrated and verified. For relational adapters, test promoted or unique changes in staging before synchronization.\n\n### Zero-state behavior\n\nUse `initialData` only when deliberate seed/fallback behavior is desired:\n\n```ts\nconst { docs } = await client.collection(\"posts\").find({ initialData: [] });\nconst settings = await client\n .global(\"site-settings\")\n .get({ initialData: { siteName: \"My site\" } });\n```\n\nDo not convert authentication, validation, or network failures into empty successful states.\n\n## Relationships and depth\n\n`relationship` is the stored owning reference. `join` is a virtual reverse lookup.\n\n```ts\n{ name: \"author\", type: \"relationship\", label: \"Author\", relationTo: \"users\" }\n{\n name: \"posts\",\n type: \"join\",\n label: \"Posts\",\n collection: \"posts\",\n on: \"author\",\n limit: 20,\n}\n```\n\nUse `depth: 0` for lightweight lists and increase depth only when related values are needed. Bound joins and account for their query cost.\n\n## Auth and access\n\n`auth: true` injects authentication fields and endpoints. Do not redefine `email` or `password`. Treat roles as trusted only when clients cannot assign them to themselves.\n\n```ts\nexport const Users = defineCollection({\n slug: \"users\",\n auth: true,\n fields: [\n { name: \"name\", type: \"text\", label: \"Name\" },\n {\n name: \"role\",\n type: \"select\",\n label: \"Role\",\n options: [\"member\", \"editor\", \"admin\"],\n },\n ],\n});\n```\n\nGrant read, create, update, delete, and workflow capabilities independently. UI visibility is not authorization.\n\n## Uploads\n\n```ts\nexport const Media = defineCollection({\n slug: \"media\",\n upload: {\n allowedMimeTypes: [\"image/jpeg\", \"image/png\", \"image/webp\"],\n maxFileSize: 5_000_000,\n },\n fields: [\n { name: \"alt\", type: \"text\", label: \"Alternative text\", required: true },\n ],\n});\n```\n\nConsume the returned URL, keep provider credentials server-side, and validate untrusted file contents in addition to MIME metadata.\n\n## Dynamic and conditional fields\n\n- Static `options`: fixed choices.\n- Server `options` resolver: database access, secrets, user filtering, or caching.\n- `admin.hooks.options`: instant browser-only dependent choices.\n- `admin.condition`: presentation only; use Jexl strings for Cloud synchronization.\n\nServer validation is still required when a dependent choice or condition is part of the data contract.\n\n## Custom Admin components\n\nReference custom inputs and slots with registered string keys in serializable configuration. Register the actual framework component in the Admin integration. Keep validation and access in the server field definition.\n\n## Supported field types\n\n<!-- GENERATED:FIELD_TYPES:START -->\n`text`, `textarea`, `richText`, `number`, `boolean`, `date`, `datetime`, `time`, `select`, `multiSelect`, `radio`, `relationship`, `array`, `object`, `json`, `blocks`, `image`, `email`, `url`, `icon`, `join`, `row`\n<!-- GENERATED:FIELD_TYPES:END -->\n\n## Compiled recipes\n\nThese recipes are compiled and behavior-tested. Select them from the user's desired outcome; do not require the user to know Dyrected terminology.\n\n<!-- GENERATED:RECIPES:START -->\n- [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug) \u2014 Generate stable URL slugs on the server while showing editors the value live in the Admin UI.\n- [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field) \u2014 Use a serializable Admin condition to reveal a field from the editor's current form values.\n- [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation) \u2014 Reject invalid combinations of field values before they reach the database.\n- [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown) \u2014 Change available Admin UI options immediately when an editor changes a related field.\n- [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow) \u2014 Attach Dyrected's standard editorial workflow and its capability-aware transitions to a collection.\n- [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access) \u2014 Return a where constraint from access control so authenticated users only read their own records.\n- [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks) \u2014 Define labeled hero, rich-text, and call-to-action blocks for an editor-controlled page layout.\n- [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join) \u2014 Store an author relationship on posts and expose the author's posts through a virtual join field.\n- [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access) \u2014 Allow public reads, editor writes, and administrator deletion with collection access rules.\n- [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename) \u2014 Use renameTo and a safe default while documents migrate lazily to a new field name.\n- [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection) \u2014 Enable file uploads and capture accessible metadata in a dedicated media collection.\n<!-- GENERATED:RECIPES:END -->\n\n## Intent-to-pattern index\n\n<!-- GENERATED:INTENTS:START -->\n- \u201Cmake the URL follow the title\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Cautomatically generate a slug\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Ccreate friendly URLs from titles\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Ckeep a slug synchronized with a title\u201D \u2192 [Generate a slug from a title](https://docs.dyrected.com/docs/recipes/auto-slug)\n- \u201Cshow a field conditionally\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Chide irrelevant form fields\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Cshow discount only with a coupon\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Cmake the admin form react to another field\u201D \u2192 [Show an Admin field only when it is relevant](https://docs.dyrected.com/docs/recipes/conditional-admin-field)\n- \u201Cvalidate fields before saving\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Cmake sure an end date is after the start date\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Creject invalid form submissions\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Cvalidate multiple fields together\u201D \u2192 [Validate related fields before saving](https://docs.dyrected.com/docs/recipes/cross-field-validation)\n- \u201Cmake one dropdown depend on another\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Cshow states based on the selected country\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Ccreate a cascading dropdown\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Cupdate select options while editing\u201D \u2192 [Update a dropdown from another field](https://docs.dyrected.com/docs/recipes/dependent-dropdown)\n- \u201Cadd draft and publish states\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Crequire review before publishing\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Ccreate an editorial workflow\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Clet editors submit content for approval\u201D \u2192 [Add draft, review, and publishing states](https://docs.dyrected.com/docs/recipes/editorial-publishing-workflow)\n- \u201Cusers should only see their own records\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cadd row level access\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cscope documents by owner\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cprevent users reading another user's data\u201D \u2192 [Limit documents to their owner](https://docs.dyrected.com/docs/recipes/owner-scoped-access)\n- \u201Cbuild a page builder\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Clet editors arrange page sections\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Ccreate reusable content blocks\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Cmodel flexible landing pages\u201D \u2192 [Build flexible pages from reusable blocks](https://docs.dyrected.com/docs/recipes/page-builder-blocks)\n- \u201Cconnect posts to authors\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Cshow every post written by a user\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Ccreate a reverse relationship\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Cmodel one-to-many content\u201D \u2192 [Model a relationship and its reverse lookup](https://docs.dyrected.com/docs/recipes/relationship-and-reverse-join)\n- \u201Conly editors can update content\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Crestrict deletion to admins\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Cmake content publicly readable\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Cadd role based access\u201D \u2192 [Restrict content operations by user role](https://docs.dyrected.com/docs/recipes/role-based-access)\n- \u201Crename a field safely\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Cchange a field name without losing data\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Cmigrate an existing schema\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Ckeep old documents working after a rename\u201D \u2192 [Rename a field without orphaning existing data](https://docs.dyrected.com/docs/recipes/safe-field-rename)\n- \u201Clet editors upload images\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n- \u201Ccreate a media library\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n- \u201Cstore uploaded files\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n- \u201Cadd image uploads to my project\u201D \u2192 [Create a media upload collection](https://docs.dyrected.com/docs/recipes/upload-collection)\n<!-- GENERATED:INTENTS:END -->\n\n## Generated contract map\n\n<!-- GENERATED:REFERENCES:START -->\n- [Configuration](https://docs.dyrected.com/docs/reference/configuration)\n- [Fields and hooks](https://docs.dyrected.com/docs/reference/fields)\n- [Database adapters](https://docs.dyrected.com/docs/adapters/databases)\n- [Storage adapters](https://docs.dyrected.com/docs/adapters/storage)\n- [SDK](https://docs.dyrected.com/docs/reference/sdk)\n- [Workflows](https://docs.dyrected.com/docs/reference/generated-workflows)\n- [REST and OpenAPI](https://docs.dyrected.com/docs/reference/rest-api)\n<!-- GENERATED:REFERENCES:END -->\n\n## Work sequence\n\n1. Inspect installation, versions, framework and existing configuration.\n2. Translate the plain-language outcome into the matching recipe or documented contract.\n3. Implement no more than three related collections or globals in one batch.\n4. Keep every field labeled and preserve stored data during schema evolution.\n5. Run lint, types, focused tests and build; fix failures before expanding scope.\n6. Explain decisions in the user's language. Do not ask them to choose between technical CMS concepts when the intent determines the correct pattern.\n\n## Troubleshooting\n\n- Missing export: inspect the installed package version; do not substitute an internal source import.\n- Admin route failure: remove custom auth wrappers and verify the framework integration generated by the CLI.\n- Empty frontend: provide an intentional zero-state or SDK `initialData` fallback.\n- Relationship payload too large: lower query depth.\n- Cloud condition missing: replace callback conditions with Jexl strings.\n- Existing records fail after a schema change: restore the old key through `renameTo` and add a compatible default.\n\n## Completion checklist\n\n- Installed package APIs were verified.\n- Existing configuration and content were inspected.\n- Named fields have labels.\n- Access and auth are server-enforced.\n- Migrations preserve existing data.\n- Generated knowledge is current.\n- Lint, type checking, tests and build pass.\n";
|
|
68
|
+
declare function buildAiRules(): string;
|
|
69
|
+
|
|
70
|
+
declare function findRecipesByIntent(query: string, options?: {
|
|
71
|
+
limit?: number;
|
|
72
|
+
minimumScore?: number;
|
|
73
|
+
}): RecipeMatch[];
|
|
74
|
+
declare function getRecipe(id: string): Recipe | undefined;
|
|
75
|
+
declare function getReference(id: string): ReferenceEntry | undefined;
|
|
76
|
+
declare function getEndpoint(method: string, path: string): EndpointReference | undefined;
|
|
77
|
+
|
|
78
|
+
export { AI_RULES, type EndpointReference, type ExampleInventoryEntry, type Recipe, type RecipeCategory, type RecipeMatch, type ReferenceEntry, type ReferenceKind, type ReferenceMember, SKILL, buildAiRules, endpoints, findRecipesByIntent, getEndpoint, getRecipe, getReference, recipes, references };
|