@riebeckite/ai 0.0.0-stage → 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.
Files changed (38) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +8 -2
  3. package/README_ja.md +9 -0
  4. package/assets/skills/assets/riebeckite-component.md +16 -0
  5. package/assets/skills/assets/riebeckite-configuration.md +13 -0
  6. package/assets/skills/assets/riebeckite-content-migration.md +15 -0
  7. package/assets/skills/assets/riebeckite-deployment.md +15 -0
  8. package/assets/skills/assets/riebeckite-plugin-catalog.md +14 -0
  9. package/assets/skills/assets/riebeckite-plugin.md +16 -0
  10. package/assets/skills/assets/riebeckite-site.md +14 -0
  11. package/assets/skills/assets/riebeckite-theme.md +15 -0
  12. package/assets/skills/assets/riebeckite-troubleshooting.md +15 -0
  13. package/assets/skills/assets/riebeckite-upgrade.md +16 -0
  14. package/assets/skills/references/riebeckite-component.md +124 -0
  15. package/assets/skills/references/riebeckite-configuration.md +96 -0
  16. package/assets/skills/references/riebeckite-content-migration.md +89 -0
  17. package/assets/skills/references/riebeckite-deployment.md +101 -0
  18. package/assets/skills/references/riebeckite-plugin-catalog.md +77 -0
  19. package/assets/skills/references/riebeckite-plugin.md +132 -0
  20. package/assets/skills/references/riebeckite-site.md +111 -0
  21. package/assets/skills/references/riebeckite-theme.md +145 -0
  22. package/assets/skills/references/riebeckite-troubleshooting.md +53 -0
  23. package/assets/skills/references/riebeckite-upgrade.md +71 -0
  24. package/assets/skills/riebeckite-component.md +20 -0
  25. package/assets/skills/riebeckite-configuration.md +19 -0
  26. package/assets/skills/riebeckite-content-migration.md +20 -0
  27. package/assets/skills/riebeckite-deployment.md +20 -0
  28. package/assets/skills/riebeckite-plugin-catalog.md +20 -0
  29. package/assets/skills/riebeckite-plugin.md +21 -0
  30. package/assets/skills/riebeckite-site-external.md +23 -0
  31. package/assets/skills/riebeckite-site.md +22 -0
  32. package/assets/skills/riebeckite-theme.md +19 -0
  33. package/assets/skills/riebeckite-troubleshooting.md +20 -0
  34. package/assets/skills/riebeckite-upgrade.md +20 -0
  35. package/dist/clients.d.ts +17 -0
  36. package/dist/index.d.ts +48 -0
  37. package/dist/index.js +260 -0
  38. package/package.json +52 -3
@@ -0,0 +1,89 @@
1
+ # Content migration guide
2
+
3
+ Use this guide when a change spans more than a few content files or can alter public URLs.
4
+
5
+ ## Define the plan
6
+
7
+ Record these before editing:
8
+
9
+ - Source set: exact directory, glob, or file list.
10
+ - Transformation: fields added, removed, or renamed; path moves; link rewrites.
11
+ - Expected route changes: old URL, new URL, and redirect decision.
12
+ - Exclusions: files intentionally untouched and why.
13
+ - Rollback: version-control revision, branch, or backup location.
14
+ - Success criteria: commands and pages to inspect.
15
+
16
+ A migration without an explicit source set and rollback path is not ready to run.
17
+
18
+ ## Frontmatter safety
19
+
20
+ - Preserve unknown keys. They may be consumed by Plugins or the site's content format.
21
+ - Preserve quoting, ordering where practical, and the file's line endings.
22
+ - Do not normalize dates, booleans, or arrays unless the transformation requires it.
23
+ - Do not remove `private`, `draft`, `visibility`, or `aliases` to make a page appear.
24
+ - Remember that `published` is a publication or feed date, not the publish switch.
25
+ - Check `filters.publishStrategy`: under `explicit`, public pages need `publish: true`; under `selective`, `private` and `draft` control exclusion and `publish` is ignored.
26
+
27
+ ## Route impact
28
+
29
+ | Change | Check |
30
+ | --- | --- |
31
+ | Move or rename a file | Old URL, new URL, inbound links, embeds, aliases, redirects. |
32
+ | Change a permalink or slug setting | Duplicate routes, old URL, canonical URL, sitemap. |
33
+ | Change `aliases` | Collisions, redirects, external references. |
34
+ | Change `locale` | Translation links, language switcher, canonical and alternate URLs. |
35
+ | Change visibility or publication | Listings, feeds, search, sitemap, redirects, private preview. |
36
+ | Delete a page | Inbound links, redirect, related content, assets. |
37
+
38
+ Use the resolved Public Location rather than guessing from the filename.
39
+
40
+ ## Bulk frontmatter changes
41
+
42
+ Prefer `@riebeckite/plugin-frontmatter-transformer` when it supports the transformation. Configure it from its current documentation and keep the transformation declarative and reviewable.
43
+
44
+ If a one-off script is unavoidable:
45
+
46
+ - Read files through the project's content APIs or a reviewed parser, not ad hoc string replacement.
47
+ - Print a dry-run list of changes and totals before writing.
48
+ - Write only files in the declared source set.
49
+ - Keep a backup or work on a branch.
50
+ - Never rewrite unrelated frontmatter or body text.
51
+
52
+ ## Batches
53
+
54
+ Use small batches that can be validated independently:
55
+
56
+ 1. Structural move or rename.
57
+ 2. Frontmatter transformation.
58
+ 3. Link and embed rewrite.
59
+ 4. Redirects and aliases.
60
+ 5. Cleanup of intentionally removed files.
61
+
62
+ Run `npm run check` after each batch. Run `npm run build` before declaring the migration complete.
63
+
64
+ ## Verification
65
+
66
+ ```sh
67
+ npm run check
68
+ npm run build
69
+ npm exec riebeckite inspect content --list
70
+ npm exec riebeckite inspect graph
71
+ npm run doctor
72
+ ```
73
+
74
+ Inspect:
75
+
76
+ - Old and new routes.
77
+ - Redirects and canonical URLs.
78
+ - Publication state and listings.
79
+ - Unresolved links and embeds.
80
+ - Feeds, sitemap, and search output when affected.
81
+ - The external content repository status when content lives outside the site repository.
82
+
83
+ ## Rollback
84
+
85
+ Stop at the first unexpected route or publication change. Restore from version control or the backup, then revise the plan. Do not layer a second transformation over an unverified migration.
86
+
87
+ ## Report
88
+
89
+ State the source set, transformation, exclusions, route changes, redirects, commands run, inspection results, and rollback path.
@@ -0,0 +1,101 @@
1
+ # Deployment guide
2
+
3
+ Use this guide for static hosting, CI publishing, and external content repositories.
4
+
5
+ ## Identify the deployment contract
6
+
7
+ Record:
8
+
9
+ - Provider and project/account.
10
+ - Build command and output directory.
11
+ - Public origin and base path.
12
+ - Content source: site repository, external repository, or both.
13
+ - Environment variables and secret names.
14
+ - Preview and production URLs.
15
+ - Rollback target.
16
+
17
+ The generated project usually builds to `dist/` and deploys that directory. Do not invent a different output path without checking the provider configuration.
18
+
19
+ ## Cloudflare Workers
20
+
21
+ Typical setup:
22
+
23
+ ```jsonc
24
+ {
25
+ "name": "my-site",
26
+ "compatibility_date": "2026-01-01",
27
+ "assets": { "directory": "./dist" }
28
+ }
29
+ ```
30
+
31
+ Commands:
32
+
33
+ ```sh
34
+ npx wrangler login
35
+ npm run build
36
+ npm exec -- riebeckite publish run --execute
37
+ ```
38
+
39
+ Set `site.baseUrl` to the deployed origin after the first deployment. Build-time `.riebeckite/` state is not published.
40
+
41
+ ## GitHub Actions
42
+
43
+ The generated workflow builds the site and deploys the static output. `npm exec riebeckite deploy setup` can detect the GitHub remote and create the workflow when it is absent. It requires `gh` and a GitHub repository.
44
+
45
+ It registers:
46
+
47
+ - `CLOUDFLARE_API_TOKEN` as a repository secret.
48
+ - `CLOUDFLARE_ACCOUNT_ID` as a repository variable.
49
+
50
+ The workflow expects a lockfile for `npm ci` and falls back to `npm install` when needed. Commit the lockfile. Push to the configured branch to deploy.
51
+
52
+ ## External content repository
53
+
54
+ When content lives in a separate repository:
55
+
56
+ - The workflow checks out the content repository into the configured `content.directory` before building.
57
+ - A private content repository needs a read token available to CI.
58
+ - The content repository can dispatch a content-updated event; the site workflow rebuilds.
59
+ - `content.directory` must match the checkout path.
60
+ - `exclude` should omit editor state and private folders, for example `.obsidian/**` and templates.
61
+ - Keep content commits in the content repository and site commits in the site repository.
62
+
63
+ ## URLs and caching
64
+
65
+ Preserve:
66
+
67
+ - Base path and trailing-slash behaviour.
68
+ - Locale and default-language routes.
69
+ - Redirects and aliases.
70
+ - Canonical and alternate URLs.
71
+ - Asset fingerprints and public paths.
72
+ - Feed, sitemap, and search output.
73
+ - Cache headers and invalidation behaviour.
74
+
75
+ A deployment is not verified until a deep link, an asset, and a redirect work from the public origin.
76
+
77
+ ## Verification
78
+
79
+ ```sh
80
+ npm run check
81
+ npm run build
82
+ npm exec riebeckite inspect content --list
83
+ npm exec riebeckite inspect graph
84
+ ```
85
+
86
+ After deployment, check:
87
+
88
+ - The home page and one deep content route.
89
+ - A renamed or redirected URL.
90
+ - CSS, JavaScript, images, and fonts.
91
+ - Feed and sitemap.
92
+ - A locale route when the site is multilingual.
93
+ - The private-content boundary: unpublished pages must not be reachable.
94
+
95
+ ## Rollback
96
+
97
+ Keep the previous provider deployment, artifact, or revision. If the public site is wrong, restore that target first, then diagnose locally. Do not debug production by repeatedly deploying unrelated changes.
98
+
99
+ ## Report
100
+
101
+ State the provider, build/output, public origin, content source, secret names, commands run, verification URLs, and rollback target.
@@ -0,0 +1,77 @@
1
+ # Official Plugin catalog guide
2
+
3
+ Use the catalog to avoid reimplementing a capability that Riebeckite already packages and documents.
4
+
5
+ ## Sources
6
+
7
+ - Official catalog: <https://riebeckite.dev/docs/plugins/>
8
+ - Showcase: <https://riebeckite.dev/docs/plugins/showcase>
9
+ - Published packages: `@riebeckite/plugin-*` on npm
10
+ - MCP tool: `riebeckite_plugin_catalog` with an optional capability query
11
+
12
+ The MCP result lists published packages; it does not prove that a package fits the current project. Read the package documentation before installing.
13
+
14
+ ## Capability map
15
+
16
+ Use this as a starting point, not a fixed package list:
17
+
18
+ | Need | Look for |
19
+ | --- | --- |
20
+ | Obsidian-style links, embeds, callouts | WikiLink, embed, callout, or Obsidian compatibility Plugins |
21
+ | Search | Client-side search, index, or command-palette Plugins |
22
+ | Taxonomies and listings | Tag, folder, series, or query Plugins |
23
+ | Diagrams and math | Mermaid, math, or diagram Plugins |
24
+ | Media and embeds | Image, video, audio, or external embed Plugins |
25
+ | SEO and feeds | Sitemap, RSS, metadata, or social-card Plugins |
26
+ | Localization and docs | i18n, versioned docs, or documentation Plugins |
27
+ | Content quality | Link checking, frontmatter validation, or lint Plugins |
28
+
29
+ ## Selection rules
30
+
31
+ 1. Prefer an official Plugin over local code for a reusable feature.
32
+ 2. Prefer the narrowest Plugin over a bundle that adds unrelated routes or runtime code.
33
+ 3. Check whether a Plugin requires a companion Theme, content format, or peer package.
34
+ 4. Check the supported input format and output stage: Markdown AST, HTML AST, rendered content, build output, client runtime, or server endpoint.
35
+ 5. Check route, asset, cache, and locale impact before enabling it.
36
+ 6. Check the package's supported Riebeckite version and release date.
37
+ 7. Do not add a runtime dependency for a build-time-only feature.
38
+ 8. Do not copy a Plugin's internal CSS or bypass its public configuration.
39
+
40
+ ## Install and register
41
+
42
+ Use the project's package manager and existing configuration style. A typical registration is:
43
+
44
+ ```ts
45
+ import { defineConfig } from "@riebeckite/core";
46
+ import { example } from "@riebeckite/plugin-example";
47
+
48
+ export default defineConfig({
49
+ plugins: [example({ enabled: true })],
50
+ });
51
+ ```
52
+
53
+ Keep the actual option names and defaults from the package documentation. Do not invent options.
54
+
55
+ ## Verification
56
+
57
+ ```sh
58
+ npm run check
59
+ npm run build
60
+ npm exec riebeckite inspect content --list
61
+ ```
62
+
63
+ Inspect the affected page, route, feed, or asset. For a development issue, run `npm exec riebeckite plugin dev <path>` only when working on a local Plugin.
64
+
65
+ ## When nothing fits
66
+
67
+ Report:
68
+
69
+ - The capability and why the catalog candidates do not match.
70
+ - Whether the need is presentation, content semantics, application behavior, or build tooling.
71
+ - The recommended next boundary: Theme, local Plugin, application component, or configuration change.
72
+
73
+ Do not install an unrelated Plugin as a placeholder.
74
+
75
+ ## Report
76
+
77
+ State the capability, candidates considered, chosen package and version, configuration changes, commands run, and any remaining route, cache, or compatibility risk.
@@ -0,0 +1,132 @@
1
+ # Local Plugin guide
2
+
3
+ Use a local Plugin when the behaviour is reusable, content-processing related, or needs a stable extension contract. Use application code for one-off page behaviour.
4
+
5
+ ## Minimal Plugin
6
+
7
+ ```ts
8
+ import { definePlugin } from "@riebeckite/core";
9
+
10
+ export function example() {
11
+ return definePlugin({ name: "example" });
12
+ }
13
+ ```
14
+
15
+ With typed options:
16
+
17
+ ```ts
18
+ type ExampleOptions = { enabled?: boolean; className?: string };
19
+
20
+ export function example(options: ExampleOptions = {}) {
21
+ return definePlugin({
22
+ name: "example",
23
+ options,
24
+ validateOptions(value) {
25
+ if (value.className !== undefined && !/^[a-z][a-z0-9-]*$/.test(value.className)) {
26
+ throw new Error("className must be a lowercase CSS identifier");
27
+ }
28
+ },
29
+ });
30
+ }
31
+ ```
32
+
33
+ Keep the package name, exported factory, and Plugin `name` stable once other projects depend on them.
34
+
35
+ ## Choose the extension point
36
+
37
+ | Need | Use |
38
+ | --- | --- |
39
+ | Add a Remark or Rehype transform | `remarkPlugins` or `rehypePlugins` |
40
+ | Configure a transform with pipeline context | `extendMarkdownPipeline` or `extendHtmlPipeline` |
41
+ | Validate configuration | `validateOptions` |
42
+ | Prepare or clean up process state | `setup`, `buildStart`, `buildEnd`, `dispose` |
43
+ | Add a content-derived output | `outputDependencies` plus `context.output.emit` |
44
+ | Provide a page type or renderer | `pageTypes`, `renderers` |
45
+ | Add a site endpoint | `endpoints` |
46
+ | Add a client entry or asset | `clientEntries`, `assets` |
47
+ | Add a development route or cache rule | `developmentRouteManifest`, `developmentRouteCache` |
48
+ | Add a diagnostic | `addDiagnostics` |
49
+
50
+ Prefer direct transforms for simple, context-free work. Use pipeline extensions when the transform needs `context.contentSource` or other pipeline services.
51
+
52
+ ## Processed-content cache
53
+
54
+ Set `processedContentCache.version` whenever the transform output changes. Bump it when the algorithm or its interpretation changes.
55
+
56
+ | `dependencyMode` | Use when the transform reads | Behaviour and rule |
57
+ | --- | --- | --- |
58
+ | `none` | Only the current source, frontmatter, options, and version | Default. No extra dependency tracking. |
59
+ | `tracked` | Other content or files through `context.contentSource`, `readContentSourceEntry`, `renderContent`, or `renderNoteEmbed` | Core records the dependencies. Do not read the filesystem directly. |
60
+ | `global` | Resolved locations across the vault, such as a link target set | Core fingerprints the location set and reprocesses all entries when any location changes. |
61
+ | `unsafe` | Git, network, time, process state, or another untrackable input | Bypasses persistent processed-content reuse. Use only when the input truly cannot be tracked. |
62
+
63
+ Do not implement Plugin-local incremental invalidation. The framework owns cache reuse; an incorrect declaration produces stale output.
64
+
65
+ Tracked example:
66
+
67
+ ```ts
68
+ definePlugin({
69
+ name: "citations",
70
+ processedContentCache: { version: "citations-v1", dependencyMode: "tracked" },
71
+ extendMarkdownPipeline(pipeline, context) {
72
+ pipeline.use(remarkCitations, { contentSource: context.contentSource });
73
+ },
74
+ });
75
+ ```
76
+
77
+ Output dependencies are separate from processed-content cache. When a transform emits a tag page, folder index, or global artifact, declare the matching output dependency so the emitter is rerun.
78
+
79
+ ## Styles and assets
80
+
81
+ - `rb-*` classes and `--rb-*` tokens belong to the framework. Do not redefine them.
82
+ - Extension-owned hooks use `rr-*` and `--rr-*`.
83
+ - Register CSS through `assets`:
84
+
85
+ ```ts
86
+ assets: [
87
+ {
88
+ pluginName: "example",
89
+ kind: "style",
90
+ moduleSpecifier: "@riebeckite/plugin-example/style.css",
91
+ },
92
+ ],
93
+ ```
94
+
95
+ An in-site asset can use a module specifier such as `/extensions/plugin.css`. Keep selectors scoped to the extension's hooks.
96
+
97
+ ## Tests
98
+
99
+ Cover:
100
+
101
+ - The transform output for a representative fixture.
102
+ - Options and invalid input.
103
+ - The declared `dependencyMode` and any output dependency.
104
+ - A missing or ambiguous content source, when relevant.
105
+ - The public factory's exported type surface.
106
+
107
+ Do not test private framework internals.
108
+
109
+ ## Commands
110
+
111
+ ```sh
112
+ npm exec riebeckite create plugin reading-time --features transform
113
+ npm exec riebeckite plugin verify <path> --level full
114
+ npm exec riebeckite plugin dev <path>
115
+ npm exec riebeckite plugin dev <path> --port 4321 --no-open
116
+ ```
117
+
118
+ `plugin verify` checks the package contract. It does not replace a site-level `npm run check` or `npm run build`.
119
+
120
+ ## Common failures
121
+
122
+ | Symptom | Likely cause |
123
+ | --- | --- |
124
+ | Output is stale after a content edit | Wrong `dependencyMode`, missing dependency tracking, or an unchanged cache `version`. |
125
+ | Build is slower after enabling | `unsafe` used for trackable input, or a `global` declaration when `tracked` would suffice. |
126
+ | Plugin works alone but not in the site | Missing registration, wrong option shape, or a companion requirement. |
127
+ | Styles leak into framework UI | Unscoped selectors or an attempt to override `rb-*`. |
128
+ | Verification passes but the site fails | Contract is valid, but the Plugin is incompatible with the project's content formats or configuration. |
129
+
130
+ ## Report
131
+
132
+ State the extension points used, cache mode, output dependencies, tests, commands run, and any remaining contract or compatibility risk.
@@ -0,0 +1,111 @@
1
+ # Site content guide
2
+
3
+ Use this guide for pages under `{{content-directory}}/`. The project configuration and resolved content graph are the source of truth; filenames are not.
4
+
5
+ ## Before editing
6
+
7
+ Collect these facts first:
8
+
9
+ - The configured content directory and any `exclude` filters.
10
+ - `filters.publishStrategy` and whether the affected page is currently public.
11
+ - The page's resolved Public Location, aliases, locale, and current inbound links.
12
+ - The project's frontmatter shape, link style, heading style, and line endings.
13
+
14
+ Useful commands:
15
+
16
+ ```sh
17
+ npm run check
18
+ npm exec riebeckite inspect config
19
+ npm exec riebeckite inspect content --list
20
+ npm exec riebeckite inspect graph
21
+ ```
22
+
23
+ With MCP connected, use `riebeckite_context`, `riebeckite_diagnostics`, and `riebeckite_links` before editing.
24
+
25
+ ## Frontmatter
26
+
27
+ Common fields include:
28
+
29
+ | Field | Meaning |
30
+ | --- | --- |
31
+ | `title` | Display title; keep it even when the filename is descriptive. |
32
+ | `date` | Content date used by listings and feeds. |
33
+ | `tags`, `series` | Taxonomy values; preserve the project's existing casing and nesting. |
34
+ | `published` | Publication or feed date. It is not the publish switch. |
35
+ | `publish` | Explicit publishing flag. Its effect depends on the publish strategy. |
36
+ | `private`, `draft`, `visibility` | Visibility controls. Do not remove them to make a page appear. |
37
+ | `aliases` | Alternate URLs or names. Treat them as public contracts. |
38
+ | `id` | Stable identity. Do not change it without checking references. |
39
+
40
+ Unknown keys are preserved and may be consumed by Plugins. Do not delete or normalize them.
41
+
42
+ ## Publishing strategy
43
+
44
+ Check `filters.publishStrategy` in `riebeckite.config.ts`.
45
+
46
+ - `explicit`: only pages with `publish: true` are public. A new public page needs the flag.
47
+ - `selective`: `private: true` and `draft: true` are excluded; `publish` is ignored. Do not add `publish: true` as a substitute for checking the existing visibility fields.
48
+ - Frontmatter can override the project default for a page. Follow the behaviour the project already uses.
49
+
50
+ Use `npm exec riebeckite inspect content --list` to confirm whether a page is included before and after a change.
51
+
52
+ ## Route impact
53
+
54
+ Treat these changes as public URL changes:
55
+
56
+ | Change | Required check |
57
+ | --- | --- |
58
+ | Rename or move a file | Find inbound links, embeds, aliases, and redirects; update or add a redirect. |
59
+ | Change `permalink` or slug settings | Compare the old and new Public Location and verify no duplicate route appears. |
60
+ | Change `aliases` | Check for collisions and decide whether the old URL should redirect. |
61
+ | Change `locale` | Verify translations, language switchers, and canonical URLs. |
62
+ | Change `publish`, `private`, `draft`, or `visibility` | Verify listings, feeds, sitemap, search, and redirects. |
63
+ | Delete a page | Remove or redirect inbound references; do not leave broken links. |
64
+
65
+ Do not guess the resulting URL from the filename. Use the resolved Public Location and the built route output.
66
+
67
+ ## Links and embeds
68
+
69
+ - Prefer root-relative Markdown links that match the project's existing style.
70
+ - Resolve a WikiLink or embed target through the content graph before rewriting it.
71
+ - When a target is ambiguous, stop and inspect `inspect content --list` or the MCP link result.
72
+ - Preserve external URLs and fragments unless the task explicitly changes them.
73
+ - Do not "fix" unrelated links in the same edit.
74
+
75
+ ## External content
76
+
77
+ When `content.directory` points at a git-ignored external repository:
78
+
79
+ - Edit and commit content in that repository.
80
+ - Keep the site repository's content directory out of commits.
81
+ - Do not rewrite the content repository's history.
82
+ - Verify the CI checkout path still matches `content.directory`.
83
+
84
+ ## Verification
85
+
86
+ 1. `npm run check` for configuration, links, and content validation.
87
+ 2. `npm run build` when routes, configuration, assets, or publication changed.
88
+ 3. Inspect `dist/` or the preview for the affected route, redirect, and asset.
89
+ 4. Run `npm run doctor` when content is missing, unreadable, or unexpectedly excluded.
90
+
91
+ `npm run build -- --full` bypasses incremental reuse when a stale result is suspected.
92
+
93
+ ## Common failures
94
+
95
+ | Symptom | Likely cause |
96
+ | --- | --- |
97
+ | New page is missing from the build | Wrong directory, `exclude` match, or publish strategy. |
98
+ | Old link now returns 404 | Rename or deletion without a redirect. |
99
+ | Duplicate route | Colliding slug, permalink, alias, or locale. |
100
+ | Frontmatter value disappears | Invalid key/value rejected by a Plugin or schema. |
101
+ | Local build differs from CI | External content not checked out, or `content.directory` mismatched. |
102
+
103
+ ## Report
104
+
105
+ State:
106
+
107
+ - Files changed and the intended public route.
108
+ - Publishing decision and why.
109
+ - Link/redirect/alias impact.
110
+ - Commands run and their results.
111
+ - Unresolved diagnostics and any risk to existing URLs.
@@ -0,0 +1,145 @@
1
+ # Theme guide
2
+
3
+ A Theme owns shared presentation: layout, typography, colour, spacing, and component styling. It does not own content semantics or runtime behaviour.
4
+
5
+ ## Define a Theme
6
+
7
+ ```ts
8
+ import { defineTheme, defineThemeSettings } from "@riebeckite/core";
9
+
10
+ export const localTheme = defineTheme({
11
+ name: "local",
12
+ styles: [{ moduleSpecifier: "@acme/theme-local/style.css" }],
13
+ settings: defineThemeSettings({
14
+ accent: { type: "color", label: "Accent", default: "#b3472f" },
15
+ density: {
16
+ type: "slider",
17
+ label: "Density",
18
+ default: 1,
19
+ min: 0.8,
20
+ max: 1.2,
21
+ step: 0.1,
22
+ },
23
+ serif: { type: "boolean", label: "Use serif", default: false },
24
+ }),
25
+ presets: {
26
+ reading: { label: "Reading", settings: { serif: true } },
27
+ },
28
+ });
29
+ ```
30
+
31
+ Register it with the site:
32
+
33
+ ```ts
34
+ export default defineConfig({
35
+ site: { title: "My site" },
36
+ theme: localTheme({
37
+ colorMode: "system",
38
+ layout: "article",
39
+ preset: "reading",
40
+ settings: { accent: "#cc5500" },
41
+ stylesheets: ["/site.css"],
42
+ }),
43
+ });
44
+ ```
45
+
46
+ Use the project's actual factory import and option names.
47
+
48
+ ## Settings
49
+
50
+ Supported setting types:
51
+
52
+ | Type | Required | Notes |
53
+ | --- | --- | --- |
54
+ | `color` | `label`, `default` | Exposed as a safe CSS value. |
55
+ | `boolean` | `label`, `default` | Reflected as `data-rb-setting-*`. |
56
+ | `number` | `label`, `default` | Supports bounds. |
57
+ | `slider` | `label`, `default`, `min`, `max`, `step` | Numeric range. |
58
+ | `select` | `label`, `default`, `options` | Keep option values stable. |
59
+ | `text` | `label`, `default` | Free-form text; escape or validate where used. |
60
+
61
+ Settings may also declare a description, section, group, light/dark values, or bounds. Resolution order is defaults, then preset, then explicit settings. Unknown keys or values are rejected, so keep configuration in sync with the definition.
62
+
63
+ Colour, number, and slider settings are reflected as safe `--rb-setting-*` custom properties. Every setting is reflected as `data-rb-setting-*`.
64
+
65
+ ## CSS contract
66
+
67
+ - Theme roots expose `data-rb-theme` and `data-rb-layout`.
68
+ - `data-rb-mode` is present only for explicit light or dark mode; it is omitted in system mode.
69
+ - Scope selectors to the Theme root.
70
+ - Use semantic `--rb-*` tokens as the public design contract.
71
+ - `rb-*` classes and `--rb-*` tokens are framework-owned. Do not rename or redefine them.
72
+ - Extension-owned hooks use `rr-*` and `--rr-*`.
73
+
74
+ Scoped example:
75
+
76
+ ```css
77
+ :is(:root, .rb-theme-root)[data-rb-theme="local"] {
78
+ --rb-color-accent: var(--rb-setting-accent);
79
+ }
80
+
81
+ :is(:root, .rb-theme-root)[data-rb-theme="local"][data-rb-setting-serif="true"] {
82
+ --rb-font-body: Georgia, serif;
83
+ }
84
+ ```
85
+
86
+ Explicit dark mode:
87
+
88
+ ```css
89
+ :is(:root, .rb-theme-root)[data-rb-theme="local"][data-rb-mode="dark"] {
90
+ color-scheme: dark;
91
+ }
92
+ ```
93
+
94
+ System dark mode:
95
+
96
+ ```css
97
+ @media (prefers-color-scheme: dark) {
98
+ :is(:root, .rb-theme-root)[data-rb-theme="local"]:not([data-rb-mode]) {
99
+ color-scheme: dark;
100
+ }
101
+ }
102
+ ```
103
+
104
+ Theme CSS loads after framework and Plugin CSS. Configured `stylesheets` load last. Use that order deliberately; avoid `!important` as a substitute for a scoped token.
105
+
106
+ ## Boundaries
107
+
108
+ - No content parsing, routing, build hooks, or client-side application logic.
109
+ - No direct edits to generated output or dependency packages.
110
+ - Do not duplicate a Plugin's component CSS; style the documented hooks instead.
111
+ - Site-specific overrides belong in site CSS, not in a reusable Theme.
112
+
113
+ ## Preview and verification
114
+
115
+ ```sh
116
+ npm exec riebeckite create theme <name> --register
117
+ npm exec riebeckite theme preview <name>
118
+ npm exec riebeckite theme preview <name> --port 4321 --no-open
119
+ npm run check
120
+ npm run build
121
+ ```
122
+
123
+ Inspect:
124
+
125
+ - Light, dark, and system mode.
126
+ - Mobile and desktop widths.
127
+ - Keyboard focus and skip links.
128
+ - Contrast of text, controls, and states.
129
+ - Long titles, long words, tables, code blocks, and images.
130
+ - Reduced-motion behaviour.
131
+ - Every component state affected by a changed token.
132
+
133
+ ## Common failures
134
+
135
+ | Symptom | Likely cause |
136
+ | --- | --- |
137
+ | Theme styles do not apply | Selector is not scoped to `data-rb-theme`, or the Theme is not registered. |
138
+ | Dark mode is wrong | Explicit and system-mode selectors were conflated. |
139
+ | Setting has no effect | Unknown setting key, wrong type, or the CSS consumes the wrong token. |
140
+ | Styles leak into other Themes | Unscoped selector or a global class override. |
141
+ | Build is fine but contrast is poor | Token values were not tested against real foreground/background pairs. |
142
+
143
+ ## Report
144
+
145
+ State changed tokens/hooks/settings, modes and viewports tested, preview and build results, and remaining accessibility or visual risk.