@omnitron-dev/lumen 0.0.0-stage → 0.4.6
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 +21 -0
- package/README.md +277 -2
- package/bin/lumen.js +7 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/llms-full.d.ts +5 -0
- package/dist/ai/llms-full.d.ts.map +1 -0
- package/dist/ai/llms-full.js +25 -0
- package/dist/ai/llms-full.js.map +1 -0
- package/dist/ai/llms-txt.d.ts +5 -0
- package/dist/ai/llms-txt.d.ts.map +1 -0
- package/dist/ai/llms-txt.js +38 -0
- package/dist/ai/llms-txt.js.map +1 -0
- package/dist/ai/mcp-server.d.ts +6 -0
- package/dist/ai/mcp-server.d.ts.map +1 -0
- package/dist/ai/mcp-server.js +47 -0
- package/dist/ai/mcp-server.js.map +1 -0
- package/dist/ai/route-mirrors.d.ts +5 -0
- package/dist/ai/route-mirrors.d.ts.map +1 -0
- package/dist/ai/route-mirrors.js +20 -0
- package/dist/ai/route-mirrors.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +591 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/define.d.ts +3 -0
- package/dist/config/define.d.ts.map +1 -0
- package/dist/config/define.js +59 -0
- package/dist/config/define.js.map +1 -0
- package/dist/config/env.d.ts +2 -0
- package/dist/config/env.d.ts.map +1 -0
- package/dist/config/env.js +17 -0
- package/dist/config/env.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +5 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +4 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +52 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +115 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +61 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/corpus/graph.d.ts +26 -0
- package/dist/corpus/graph.d.ts.map +1 -0
- package/dist/corpus/graph.js +409 -0
- package/dist/corpus/graph.js.map +1 -0
- package/dist/corpus/index.d.ts +4 -0
- package/dist/corpus/index.d.ts.map +1 -0
- package/dist/corpus/index.js +4 -0
- package/dist/corpus/index.js.map +1 -0
- package/dist/corpus/projection.d.ts +16 -0
- package/dist/corpus/projection.d.ts.map +1 -0
- package/dist/corpus/projection.js +126 -0
- package/dist/corpus/projection.js.map +1 -0
- package/dist/corpus/routes.d.ts +3 -0
- package/dist/corpus/routes.d.ts.map +1 -0
- package/dist/corpus/routes.js +25 -0
- package/dist/corpus/routes.js.map +1 -0
- package/dist/corpus/types.d.ts +52 -0
- package/dist/corpus/types.d.ts.map +1 -0
- package/dist/corpus/types.js +2 -0
- package/dist/corpus/types.js.map +1 -0
- package/dist/gates/builtins/anchors.d.ts +3 -0
- package/dist/gates/builtins/anchors.d.ts.map +1 -0
- package/dist/gates/builtins/anchors.js +86 -0
- package/dist/gates/builtins/anchors.js.map +1 -0
- package/dist/gates/builtins/defaults.d.ts +3 -0
- package/dist/gates/builtins/defaults.d.ts.map +1 -0
- package/dist/gates/builtins/defaults.js +438 -0
- package/dist/gates/builtins/defaults.js.map +1 -0
- package/dist/gates/builtins/examples.d.ts +3 -0
- package/dist/gates/builtins/examples.d.ts.map +1 -0
- package/dist/gates/builtins/examples.js +27 -0
- package/dist/gates/builtins/examples.js.map +1 -0
- package/dist/gates/builtins/exports.d.ts +3 -0
- package/dist/gates/builtins/exports.d.ts.map +1 -0
- package/dist/gates/builtins/exports.js +282 -0
- package/dist/gates/builtins/exports.js.map +1 -0
- package/dist/gates/builtins/index.d.ts +7 -0
- package/dist/gates/builtins/index.d.ts.map +1 -0
- package/dist/gates/builtins/index.js +7 -0
- package/dist/gates/builtins/index.js.map +1 -0
- package/dist/gates/builtins/links.d.ts +3 -0
- package/dist/gates/builtins/links.d.ts.map +1 -0
- package/dist/gates/builtins/links.js +128 -0
- package/dist/gates/builtins/links.js.map +1 -0
- package/dist/gates/builtins/math.d.ts +3 -0
- package/dist/gates/builtins/math.d.ts.map +1 -0
- package/dist/gates/builtins/math.js +48 -0
- package/dist/gates/builtins/math.js.map +1 -0
- package/dist/gates/define.d.ts +3 -0
- package/dist/gates/define.d.ts.map +1 -0
- package/dist/gates/define.js +4 -0
- package/dist/gates/define.js.map +1 -0
- package/dist/gates/index.d.ts +5 -0
- package/dist/gates/index.d.ts.map +1 -0
- package/dist/gates/index.js +5 -0
- package/dist/gates/index.js.map +1 -0
- package/dist/gates/runner.d.ts +12 -0
- package/dist/gates/runner.d.ts.map +1 -0
- package/dist/gates/runner.js +55 -0
- package/dist/gates/runner.js.map +1 -0
- package/dist/gates/types.d.ts +29 -0
- package/dist/gates/types.d.ts.map +1 -0
- package/dist/gates/types.js +2 -0
- package/dist/gates/types.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest/generator.d.ts +4 -0
- package/dist/manifest/generator.d.ts.map +1 -0
- package/dist/manifest/generator.js +27 -0
- package/dist/manifest/generator.js.map +1 -0
- package/dist/manifest/hashing.d.ts +3 -0
- package/dist/manifest/hashing.d.ts.map +1 -0
- package/dist/manifest/hashing.js +10 -0
- package/dist/manifest/hashing.js.map +1 -0
- package/dist/manifest/index.d.ts +5 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +5 -0
- package/dist/manifest/index.js.map +1 -0
- package/dist/manifest/schema.d.ts +14 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +9 -0
- package/dist/manifest/schema.js.map +1 -0
- package/dist/manifest/types.d.ts +12 -0
- package/dist/manifest/types.d.ts.map +1 -0
- package/dist/manifest/types.js +2 -0
- package/dist/manifest/types.js.map +1 -0
- package/dist/search/index-builder.d.ts +19 -0
- package/dist/search/index-builder.d.ts.map +1 -0
- package/dist/search/index-builder.js +105 -0
- package/dist/search/index-builder.js.map +1 -0
- package/dist/search/index.d.ts +3 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +3 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/tokenizer.d.ts +2 -0
- package/dist/search/tokenizer.d.ts.map +1 -0
- package/dist/search/tokenizer.js +12 -0
- package/dist/search/tokenizer.js.map +1 -0
- package/dist/ssg/assemble-html.d.ts +16 -0
- package/dist/ssg/assemble-html.d.ts.map +1 -0
- package/dist/ssg/assemble-html.js +38 -0
- package/dist/ssg/assemble-html.js.map +1 -0
- package/dist/ssg/client-build.d.ts +7 -0
- package/dist/ssg/client-build.d.ts.map +1 -0
- package/dist/ssg/client-build.js +48 -0
- package/dist/ssg/client-build.js.map +1 -0
- package/dist/ssg/default-client.d.ts +2 -0
- package/dist/ssg/default-client.d.ts.map +1 -0
- package/dist/ssg/default-client.js +12 -0
- package/dist/ssg/default-client.js.map +1 -0
- package/dist/ssg/emotion-extractor.d.ts +10 -0
- package/dist/ssg/emotion-extractor.d.ts.map +1 -0
- package/dist/ssg/emotion-extractor.js +101 -0
- package/dist/ssg/emotion-extractor.js.map +1 -0
- package/dist/ssg/index.d.ts +5 -0
- package/dist/ssg/index.d.ts.map +1 -0
- package/dist/ssg/index.js +5 -0
- package/dist/ssg/index.js.map +1 -0
- package/dist/ssg/publish-generation.d.ts +17 -0
- package/dist/ssg/publish-generation.d.ts.map +1 -0
- package/dist/ssg/publish-generation.js +271 -0
- package/dist/ssg/publish-generation.js.map +1 -0
- package/dist/ssg/render-html.d.ts +15 -0
- package/dist/ssg/render-html.d.ts.map +1 -0
- package/dist/ssg/render-html.js +45 -0
- package/dist/ssg/render-html.js.map +1 -0
- package/dist/ssg/server-build.d.ts +4 -0
- package/dist/ssg/server-build.d.ts.map +1 -0
- package/dist/ssg/server-build.js +144 -0
- package/dist/ssg/server-build.js.map +1 -0
- package/dist/ssg/ssg-engine.d.ts +27 -0
- package/dist/ssg/ssg-engine.d.ts.map +1 -0
- package/dist/ssg/ssg-engine.js +227 -0
- package/dist/ssg/ssg-engine.js.map +1 -0
- package/package.json +71 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LuxQuant
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,278 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @omnitron-dev/lumen
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lumen builds documentation from Markdown and PDX into HTML, Pagefind search,
|
|
4
|
+
Markdown mirrors and AI-readable corpus files. It uses `lumen-ast` for document
|
|
5
|
+
semantics, Vite for browser assets, and `lumen-ui` with Prism for React islands.
|
|
6
|
+
The CLI also checks corpus references, exports PDF through Typst, and exposes a
|
|
7
|
+
local read-only MCP server. A static site does not require a Titan server.
|
|
8
|
+
|
|
9
|
+
## Start a project
|
|
10
|
+
|
|
11
|
+
Use Node 24 for the qualified development workflow; the package requires Node
|
|
12
|
+
22.12 or newer. Keep the Omnitron packages on the same release. For published
|
|
13
|
+
packages, install Lumen and its React peers in an ESM project:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @omnitron-dev/lumen react react-dom
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The source tree currently contains an unpublished 0.4 candidate with staging
|
|
20
|
+
package versions. Installing a prior registry version does not provide these
|
|
21
|
+
changes. For source development, declare the required packages in the consumer's
|
|
22
|
+
`package.json`, install a full Omnitron workspace at a reviewed commit, and use
|
|
23
|
+
the canonical SDK bridge from that checkout:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
node ../omni/apps/omnitron/bin/sdk.js init --project-dir .
|
|
27
|
+
node ../omni/apps/omnitron/bin/sdk.js dev ../omni --project-dir . --no-watch
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`sdk init` installs the canonical pnpm hook. `sdk dev` uses the workspace Turbo
|
|
31
|
+
graph and a private development lock; it does not fabricate a registry
|
|
32
|
+
application lock. A pnpm-generated package-manager metadata document is not a
|
|
33
|
+
registry baseline. Qualify registry installation separately after publication.
|
|
34
|
+
Use a full workspace checkout with its normal frozen install, not a collection
|
|
35
|
+
of copied package directories. SDK selection changes dependencies, not a running
|
|
36
|
+
application's release.
|
|
37
|
+
|
|
38
|
+
Create `lumen.config.ts` at the project root:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { defineLumenConfig } from '@omnitron-dev/lumen';
|
|
42
|
+
|
|
43
|
+
export default defineLumenConfig({
|
|
44
|
+
title: 'Project manual',
|
|
45
|
+
url: 'https://docs.example.com',
|
|
46
|
+
srcDir: 'docs',
|
|
47
|
+
outDir: 'dist',
|
|
48
|
+
onBrokenLinks: 'throw',
|
|
49
|
+
onBrokenAnchors: 'throw',
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Create `docs/index.md`:
|
|
54
|
+
|
|
55
|
+
```md
|
|
56
|
+
---
|
|
57
|
+
title: Project manual
|
|
58
|
+
slug: /
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
# Project manual
|
|
62
|
+
|
|
63
|
+
## First steps {#first-steps}
|
|
64
|
+
|
|
65
|
+
Write the prerequisites and a complete example here.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Project initialization is file-based; there is no `lumen init` subcommand. Add
|
|
69
|
+
`"start": "lumen dev"`, `"build": "lumen build"`, and `"serve": "lumen serve"`
|
|
70
|
+
to the project's scripts, then run:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pnpm exec lumen check --gates linksGate,anchorsGate --strict
|
|
74
|
+
pnpm run build
|
|
75
|
+
pnpm run serve --host 127.0.0.1 --port 4173
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Open `http://127.0.0.1:4173/`. Configuration modules, custom layouts, client
|
|
79
|
+
entries and gates are trusted project code. Document widgets accept literal
|
|
80
|
+
data; documents do not import and execute arbitrary MDX modules.
|
|
81
|
+
|
|
82
|
+
## Commands and generated files
|
|
83
|
+
|
|
84
|
+
Commands resolve the project from the current directory or `--root <directory>`.
|
|
85
|
+
`--outDir <directory>` overrides the configured output for that invocation.
|
|
86
|
+
Both development and preview servers bind to `127.0.0.1:4173` by default and
|
|
87
|
+
reject an occupied port.
|
|
88
|
+
|
|
89
|
+
Development compiler caches live in a private temporary directory outside the
|
|
90
|
+
published generation and are removed when Vite closes. A failed content build
|
|
91
|
+
keeps serving the previous verified output; correcting the source rebuilds it.
|
|
92
|
+
Restarting `lumen dev` verifies and replaces the same output without a manual
|
|
93
|
+
cleanup step.
|
|
94
|
+
|
|
95
|
+
| Command | Behavior |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `lumen dev` | Builds the site, starts Vite, and rebuilds on changes in existing content, public and `src` directories. Restart after configuration changes. |
|
|
98
|
+
| `lumen build` | Checks parse errors and configured gates, builds client assets and Pagefind, and publishes a complete static generation. |
|
|
99
|
+
| `lumen serve` | Verifies an existing generation and previews a captured snapshot. Run build first; restart serve to inspect a later build. |
|
|
100
|
+
| `lumen check` | Runs all six built-in gates plus configured custom gates. Errors set exit code 1. |
|
|
101
|
+
| `lumen pdf --outDir pdf` | Compiles each selected anonymous document with the bundled Typst engine and fonts into `<document-id>.pdf`. |
|
|
102
|
+
| `lumen types --outDir generated` | Writes `lumen-corpus.d.ts` with document ID, route and mathematical object ID unions from the anonymous projection. |
|
|
103
|
+
| `lumen mcp --stdio` | Serves the local anonymous corpus over stdio until the connection closes. |
|
|
104
|
+
|
|
105
|
+
Keep `srcDir` present: normal builds materialize output when that directory
|
|
106
|
+
exists. `--write` explicitly requests materialization. PDF and type exports need
|
|
107
|
+
an explicit `--outDir`; use a separate directory from the static generation.
|
|
108
|
+
|
|
109
|
+
The static output includes HTML routes, hashed CSS and browser chunks when
|
|
110
|
+
needed, public assets, `pagefind/`, Markdown route mirrors, `llms.txt`,
|
|
111
|
+
`llms-full.txt`, `asset-manifest.json` and the publisher's generation inventory.
|
|
112
|
+
These are deployable files; `lumen serve` is a local preview, not a hosting or
|
|
113
|
+
deployment manager.
|
|
114
|
+
|
|
115
|
+
## Configuration and routes
|
|
116
|
+
|
|
117
|
+
The loader searches for `lumen.config.ts`, `lumen.config.mjs`, then
|
|
118
|
+
`lumen.config.js`. Prefer `.ts` or `.js` in ESM projects. With no configuration it
|
|
119
|
+
uses the title `Documentation` and the defaults below. String values support
|
|
120
|
+
`${VARIABLE}` expansion from the environment; an unset variable becomes empty.
|
|
121
|
+
|
|
122
|
+
| Field | Default and effect |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `title`, `tagline` | Project metadata; `title` is required by the public config type. Individual page titles come from document frontmatter. |
|
|
125
|
+
| `url` | `http://localhost:3000`; site origin used for canonical URLs. Set it for production. |
|
|
126
|
+
| `baseUrl` | `/`; public URL prefix for routes and assets. |
|
|
127
|
+
| `srcDir`, `outDir` | `docs`, `dist`; paths relative to the project root. |
|
|
128
|
+
| `pagesDir` | Optional additional document directory. Its file paths become routes without the directory prefix. |
|
|
129
|
+
| `publicDir` | Optional asset directory copied into the output root; it must exist and contain no symlinks. |
|
|
130
|
+
| `trailingSlash` | `false`; chooses `route.html` or `route/index.html`. The root route uses `index.html`. |
|
|
131
|
+
| `clientEntry` | Optional trusted browser entry, compiled through Vite. Without it, documents containing islands use Lumen's default entry. |
|
|
132
|
+
| `stylesheets` | `[]`; additional stylesheet URLs. Relative URLs refer to public output assets. |
|
|
133
|
+
| `theme.defaultMode` | `dark`; initial document theme, also accepts `light`. |
|
|
134
|
+
| `theme.layout` | Optional React renderer receiving `{ children, document, documents, config }`. Both document values have already been audience-projected. |
|
|
135
|
+
| `sidebars` | `{}`; named arrays of `doc`, `link` and nested `category` items for a custom layout to consume. |
|
|
136
|
+
| `locales`, `defaultLocale` | `['en']`, `en`; document locale defaults and corpus metadata. Locales do not automatically create translated pages or URL prefixes. |
|
|
137
|
+
| `onBrokenLinks`, `onBrokenAnchors` | `throw`; rejects broken references during build. `warn` checks and reports to stderr, `log` checks and reports to stdout, and `ignore` skips the corresponding build gate. `check` still treats broken references as errors. |
|
|
138
|
+
| `gates` | `[]`; additional `CorpusGate` objects run during check and build. |
|
|
139
|
+
| `katexMacros` | `{}`; KaTeX string macros used by HTML rendering and Pagefind. Macro dictionaries are scoped to each document render. |
|
|
140
|
+
| `pdf.paperSections` | `[]`; `lumen pdf` selects all projected documents, or only matching document IDs/source paths when this list is nonempty. |
|
|
141
|
+
|
|
142
|
+
`locales` also accepts `{ defaultLocale, locales }`. Category sidebar items use
|
|
143
|
+
`{ type: 'category', label, items, collapsed?, href? }`; document items use
|
|
144
|
+
`{ type: 'doc', id, label? }`, and links use `{ type: 'link', label, href }`.
|
|
145
|
+
|
|
146
|
+
Unknown fields and invalid nested values fail configuration loading with the
|
|
147
|
+
affected field path. There is no `titan` configuration or `pdf.enabled` switch:
|
|
148
|
+
invoke PDF explicitly and integrate live capabilities through the typed
|
|
149
|
+
Titan-Lumen/Netron APIs. HTML KaTeX macros do not define PDF macros; the strict
|
|
150
|
+
TeX-to-Typst converter rejects unsupported TeX rather than silently dropping it.
|
|
151
|
+
|
|
152
|
+
Files under `docs` normally retain that prefix: `docs/guide.md` becomes
|
|
153
|
+
`/docs/guide`, and `docs/index.md` becomes `/docs`. An absolute frontmatter
|
|
154
|
+
`slug` sets an explicit route; a relative slug is resolved beside the source
|
|
155
|
+
file. `.md`, `.mdx` and `.pdx` are scanned. Frontmatter `id` overrides the corpus
|
|
156
|
+
ID, independently of the route. Duplicate IDs/routes and unsafe routes fail the
|
|
157
|
+
build. Heading `{#id}` annotations provide stable fragment targets. Resolved
|
|
158
|
+
source links are rewritten consistently in HTML and Markdown mirrors.
|
|
159
|
+
|
|
160
|
+
## Layouts, islands and live capabilities
|
|
161
|
+
|
|
162
|
+
The default shell renders document content. A custom navigation layout belongs
|
|
163
|
+
in `theme.layout`; a custom browser entry registers its React components with
|
|
164
|
+
`LumenShell`. Use `@omnitron-dev/lumen-ui` and the shared Prism provider rather
|
|
165
|
+
than a second rendering or theme system. See the
|
|
166
|
+
[UI guide](https://github.com/omnitron-dev/omni/blob/main/packages/lumen-ui/README.md)
|
|
167
|
+
for the registry, hydration triggers, search adapter and component props.
|
|
168
|
+
|
|
169
|
+
The CLI compiles the project configuration, layout and existing renderer in one
|
|
170
|
+
Vite SSR graph. Ordinary imported components, including React-dependent packages,
|
|
171
|
+
share the project's React peers. Layouts are rendered as React components and
|
|
172
|
+
can use state and context hooks during SSR. Each build closes its module runner
|
|
173
|
+
and removes its temporary compilation files, including after a failure. Temporary
|
|
174
|
+
files follow `TMPDIR` on systems that provide it.
|
|
175
|
+
Source `import.meta` file paths and ESM resolution stay anchored to the original
|
|
176
|
+
module, including when its `resolve` function is extracted into a variable.
|
|
177
|
+
|
|
178
|
+
Put stylesheet, image and font files in `publicDir`, reference stylesheets with
|
|
179
|
+
`stylesheets`, or import browser resources from `clientEntry`. The SSR compiler
|
|
180
|
+
rejects imports that emit separate resource files instead of silently omitting
|
|
181
|
+
them from the published site. Self-contained inline asset values need no files.
|
|
182
|
+
|
|
183
|
+
SSR emits readable content and island descriptors. The browser runtime mounts
|
|
184
|
+
registered components using the real compiled client bundle. Island props must
|
|
185
|
+
be plain JSON data, validated by the shared `lumen-ast/islands` codec. Missing
|
|
186
|
+
components and invalid props are errors, not successful hydration. Mermaid
|
|
187
|
+
diagrams render with the actual browser engine after hydration; static HTML and
|
|
188
|
+
PDF retain readable diagram source. Playground execution uses the isolated
|
|
189
|
+
QuickJS worker; static builds do not execute examples.
|
|
190
|
+
|
|
191
|
+
Pagefind provides local static full-text search. Semantic search, authenticated
|
|
192
|
+
reads, authoring and server playground execution require an explicitly supplied
|
|
193
|
+
typed service client and a configured Titan-Lumen application. Static output
|
|
194
|
+
does not supply these services or enforce per-request authorization.
|
|
195
|
+
|
|
196
|
+
## Verification and failures
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
pnpm exec lumen check --json
|
|
200
|
+
pnpm exec lumen check --gates linksGate,anchorsGate --strict
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`--json` writes only the diagnostics array to stdout. `--gates` filters built-in
|
|
204
|
+
gates by their exact names; configured custom gates still run. The built-ins
|
|
205
|
+
are `linksGate`, `anchorsGate`, `codeDefaultsGate`, `codeExamplesGate`,
|
|
206
|
+
`undocumentedExportsGate` and `mathKernelGate`. They check references, documented
|
|
207
|
+
defaults, declared exports, empty code blocks and mathematical dependency
|
|
208
|
+
integrity. They do not prove a theorem or execute all documentation examples.
|
|
209
|
+
Typecheck and run executable examples in their actual application environment.
|
|
210
|
+
|
|
211
|
+
Add a gate with `defineCorpusGate({ name, run(context) })`; return
|
|
212
|
+
`{ name, passed, diagnostics }`. An error diagnostic includes `code`, `message`
|
|
213
|
+
and `severity: 'error'`, with optional source location and suggested fix. Gate
|
|
214
|
+
exceptions become `GATE_INTERNAL_ERROR` diagnostics. Build rejects parser and
|
|
215
|
+
gate error diagnostics before publication. Vite, Pagefind, asset collision and
|
|
216
|
+
filesystem failures also reject the build rather than producing a partial site.
|
|
217
|
+
|
|
218
|
+
When migrating, compare generated routes and fragment IDs against the previous
|
|
219
|
+
site and follow its internal links. A passing corpus check alone does not prove
|
|
220
|
+
visual, browser interaction or URL migration parity.
|
|
221
|
+
|
|
222
|
+
## Audience-specific static builds
|
|
223
|
+
|
|
224
|
+
`buildStaticSite(corpus, config, { roles, accessFilter })` uses the same
|
|
225
|
+
`DocumentAccessOptions` policy as Titan-Lumen. By default the audience is
|
|
226
|
+
anonymous. Custom grants propagate to page rendering, search, Markdown mirrors,
|
|
227
|
+
`llms.txt` and `llms-full.txt`; these targets never parse access rules separately.
|
|
228
|
+
Documents with invalid metadata are omitted rather than partially published.
|
|
229
|
+
Static artifacts are public to everyone who can download them, so privileged
|
|
230
|
+
builds must be hosted behind the corresponding access boundary.
|
|
231
|
+
|
|
232
|
+
The [0.4 qualification ledger](https://github.com/omnitron-dev/omni/blob/main/audit/LUMEN-0.4.0.md)
|
|
233
|
+
records acceptance evidence and remaining release limits. A successful local
|
|
234
|
+
build is not proof of published package or deployment qualification.
|
|
235
|
+
|
|
236
|
+
## Build output and recovery
|
|
237
|
+
|
|
238
|
+
`lumen build` stages a complete generation with a byte-count and SHA-256 inventory.
|
|
239
|
+
It replaces only output owned by this publisher. For a first build after another
|
|
240
|
+
generator, select a new output directory rather than deleting the old result.
|
|
241
|
+
On a local filesystem, macOS and Linux publications persist and sync a small
|
|
242
|
+
journal before moving the prior output. A later build or serve verifies the
|
|
243
|
+
journal, native process birth and boot identity, and every generation file before
|
|
244
|
+
recovering an interrupted replacement. It refuses a live publisher, unknown
|
|
245
|
+
ownership and symlinks. Publication currently requires these native platform
|
|
246
|
+
probes; it does not infer a dead writer from an unverifiable PID.
|
|
247
|
+
Windows publication is unsupported until its native process identity probe is
|
|
248
|
+
implemented and qualified.
|
|
249
|
+
|
|
250
|
+
This is recoverable directory replacement, not a zero-gap atomic exchange.
|
|
251
|
+
Do not serve the mutable output directory directly while publishing to it.
|
|
252
|
+
`lumen serve` verifies and captures one generation with hardlinks, then previews
|
|
253
|
+
that snapshot through Vite until shutdown. Restart the preview to inspect a new
|
|
254
|
+
build. The publisher always writes fresh files in a new stage and never mutates
|
|
255
|
+
a captured generation in place; do not edit generated files manually. This
|
|
256
|
+
protocol coordinates one host, not writers
|
|
257
|
+
sharing a network filesystem.
|
|
258
|
+
|
|
259
|
+
## Local MCP access
|
|
260
|
+
|
|
261
|
+
`lumen mcp --stdio --root <project>` serves the anonymous corpus projection over
|
|
262
|
+
the official MCP SDK. The process that launches it owns the local trust boundary;
|
|
263
|
+
stdio does not authenticate a remote user and accepts no caller-supplied roles.
|
|
264
|
+
Use Titan-Lumen's native Netron-backed adapter for authenticated live access.
|
|
265
|
+
|
|
266
|
+
Both adapters register the same `search_corpus`, `get_document` and
|
|
267
|
+
`lumen_inspect_ast` tools through the isolated `lumen-ast/mcp` entry. Document
|
|
268
|
+
arguments and resource URIs use corpus-relative paths, for example
|
|
269
|
+
`lumen://corpus/docs/guide.md`. Restricted documents and sections are absent from
|
|
270
|
+
static search, resource discovery, reads and AST results. Invalid or missing
|
|
271
|
+
corpora fail startup. Configure an MCP client to launch the command with the
|
|
272
|
+
project as its working directory. Restart the process after source changes.
|
|
273
|
+
|
|
274
|
+
Only protocol messages go to stdout; diagnostics go to stderr. The official
|
|
275
|
+
stdio transport checks its 1 MiB input buffer limit before appending a chunk,
|
|
276
|
+
including an unfinished line, and an over-limit connection releases its input
|
|
277
|
+
pipe. Protocol negotiation belongs to the SDK; implementation metadata comes
|
|
278
|
+
from the package manifest.
|
package/bin/lumen.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
package/dist/ai/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CorpusGraph } from '../corpus/graph.js';
|
|
2
|
+
import { type CorpusProjectionOptions } from '../corpus/projection.js';
|
|
3
|
+
import type { LumenConfig } from '../config/schema.js';
|
|
4
|
+
export declare function generateLlmsFullTxt(corpus: CorpusGraph, _config: LumenConfig, options?: CorpusProjectionOptions): string;
|
|
5
|
+
//# sourceMappingURL=llms-full.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms-full.d.ts","sourceRoot":"","sources":["../../src/ai/llms-full.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAiB,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,uBAAuB,GAChC,MAAM,CAsBR"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { toCleanMarkdown } from '@omnitron-dev/lumen-ast';
|
|
2
|
+
import { projectCorpus } from '../corpus/projection.js';
|
|
3
|
+
export function generateLlmsFullTxt(corpus, _config, options) {
|
|
4
|
+
const projectedCorpus = projectCorpus(corpus, options);
|
|
5
|
+
const topoOrder = projectedCorpus.getTopologicalOrder();
|
|
6
|
+
const documentSections = [];
|
|
7
|
+
for (const docId of topoOrder) {
|
|
8
|
+
const doc = projectedCorpus.getDocument(docId);
|
|
9
|
+
if (!doc)
|
|
10
|
+
continue;
|
|
11
|
+
if (doc.ast) {
|
|
12
|
+
const clean = toCleanMarkdown(doc.ast, { includeFrontmatter: true });
|
|
13
|
+
if (clean.trim()) {
|
|
14
|
+
documentSections.push(clean.trim());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const title = doc.title || docId;
|
|
19
|
+
documentSections.push(`# ${title}`.trim());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const body = documentSections.join('\n\n---\n\n');
|
|
23
|
+
return `# Complete Knowledge Graph Corpus\n\n${body}`.trim();
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=llms-full.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms-full.js","sourceRoot":"","sources":["../../src/ai/llms-full.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAgC,MAAM,yBAAyB,CAAC;AAGtF,MAAM,UAAU,mBAAmB,CACjC,MAAmB,EACnB,OAAoB,EACpB,OAAiC;IAEjC,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,eAAe,CAAC,mBAAmB,EAAE,CAAC;IACxD,MAAM,gBAAgB,GAAa,EAAE,CAAC;IAEtC,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG;YAAE,SAAS;QAEnB,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;YACrE,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;gBACjB,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC;YACjC,gBAAgB,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClD,OAAO,wCAAwC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CorpusGraph } from '../corpus/graph.js';
|
|
2
|
+
import { type CorpusProjectionOptions } from '../corpus/projection.js';
|
|
3
|
+
import type { LumenConfig } from '../config/schema.js';
|
|
4
|
+
export declare function generateLlmsTxt(corpus: CorpusGraph, config: LumenConfig, options?: CorpusProjectionOptions): string;
|
|
5
|
+
//# sourceMappingURL=llms-txt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms-txt.d.ts","sourceRoot":"","sources":["../../src/ai/llms-txt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAA+C,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACpH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAyCnH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { extractFirstParagraphSummary, projectCorpus } from '../corpus/projection.js';
|
|
2
|
+
export function generateLlmsTxt(corpus, config, options) {
|
|
3
|
+
const title = config.title || 'Lumen Documentation';
|
|
4
|
+
const tagline = config.tagline || 'High performance documentation system for modern scientific and engineering projects.';
|
|
5
|
+
const url = (config.url ?? 'http://localhost:3000').replace(/\/+$/, '');
|
|
6
|
+
let baseUrl = config.baseUrl ?? '/';
|
|
7
|
+
if (!baseUrl.startsWith('/'))
|
|
8
|
+
baseUrl = `/${baseUrl}`;
|
|
9
|
+
if (!baseUrl.endsWith('/'))
|
|
10
|
+
baseUrl = `${baseUrl}/`;
|
|
11
|
+
const lines = [`# ${title}`, '', `> ${tagline}`, '', '## Documentation Index'];
|
|
12
|
+
const projectedCorpus = projectCorpus(corpus, options);
|
|
13
|
+
const docs = projectedCorpus.getAllDocuments();
|
|
14
|
+
if (docs.length === 0) {
|
|
15
|
+
lines.push('- No documents currently registered.');
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
for (const doc of docs) {
|
|
19
|
+
let route = doc.routePath ?? doc.path.replace(/\.(pdx|md)$/, '');
|
|
20
|
+
const srcDirPrefix = `${(config.srcDir || 'docs').replace(/\/+$/, '')}/`;
|
|
21
|
+
if (route.startsWith(srcDirPrefix)) {
|
|
22
|
+
route = route.slice(srcDirPrefix.length);
|
|
23
|
+
}
|
|
24
|
+
route = route.replace(/^\/+/, '');
|
|
25
|
+
let summary = typeof doc.frontmatter?.['description'] === 'string' ? doc.frontmatter['description'] : undefined;
|
|
26
|
+
if (!summary && doc.ast?.children) {
|
|
27
|
+
summary = extractFirstParagraphSummary(doc.ast.children);
|
|
28
|
+
}
|
|
29
|
+
if (!summary) {
|
|
30
|
+
summary = doc.title || 'Documentation module';
|
|
31
|
+
}
|
|
32
|
+
const cleanSummary = summary.replace(/[\r\n]+/g, ' ').trim();
|
|
33
|
+
lines.push(`- [${doc.title || doc.id}](${url}${baseUrl}${route}.md): ${cleanSummary}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return lines.join('\n').trim();
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=llms-txt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llms-txt.js","sourceRoot":"","sources":["../../src/ai/llms-txt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,aAAa,EAAgC,MAAM,yBAAyB,CAAC;AAGpH,MAAM,UAAU,eAAe,CAAC,MAAmB,EAAE,MAAmB,EAAE,OAAiC;IACzG,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,qBAAqB,CAAC;IACpD,MAAM,OAAO,GACX,MAAM,CAAC,OAAO,IAAI,uFAAuF,CAAC;IAE5G,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,uBAAuB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxE,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IACtD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,GAAG,OAAO,GAAG,CAAC;IAEpD,MAAM,KAAK,GAAa,CAAC,KAAK,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAC;IAEzF,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,eAAe,CAAC,eAAe,EAAE,CA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,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,OAAO,GAAG,KAAK,SAAS,YAAY,EAAE,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CorpusGraph } from '../corpus/graph.js';
|
|
2
|
+
export interface LumenMcpServerOptions {
|
|
3
|
+
maxBufferSize?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function runLumenMcpServer(corpus: CorpusGraph, options?: LumenMcpServerOptions): Promise<void>;
|
|
6
|
+
//# sourceMappingURL=mcp-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/ai/mcp-server.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,MAAM,WAAW,qBAAqB;IAEpC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAGD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC3G"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
3
|
+
import { toCleanMarkdown } from '@omnitron-dev/lumen-ast';
|
|
4
|
+
import { createLumenMcpServer } from '@omnitron-dev/lumen-ast/mcp';
|
|
5
|
+
import { extractAstPlainText, projectCorpus } from '../corpus/projection.js';
|
|
6
|
+
const { version } = createRequire(import.meta.url)('../../package.json');
|
|
7
|
+
export async function runLumenMcpServer(corpus, options) {
|
|
8
|
+
const maxBufferSize = options?.maxBufferSize ?? 1_048_576;
|
|
9
|
+
if (!Number.isSafeInteger(maxBufferSize) || maxBufferSize < 1)
|
|
10
|
+
throw new RangeError('Invalid MCP buffer limit');
|
|
11
|
+
const projected = projectCorpus(corpus, { roles: ['anonymous'] });
|
|
12
|
+
const documents = projected.getAllDocuments().map(doc => ({
|
|
13
|
+
...doc,
|
|
14
|
+
content: doc.ast ? toCleanMarkdown(doc.ast, { includeFrontmatter: true }) : `# ${doc.title}\n`,
|
|
15
|
+
text: extractAstPlainText(doc.ast?.children),
|
|
16
|
+
}));
|
|
17
|
+
const byPath = new Map(documents.map(doc => [doc.path, doc]));
|
|
18
|
+
const server = createLumenMcpServer({
|
|
19
|
+
resourcePaths: [...byPath.keys()],
|
|
20
|
+
getDocument: async (path) => byPath.get(path)?.content ?? null,
|
|
21
|
+
search: async (query, { limit = 20 }) => {
|
|
22
|
+
const lower = query.toLowerCase();
|
|
23
|
+
return documents.filter(doc => [doc.title, doc.path, doc.text].some(text => text.toLowerCase().includes(lower)))
|
|
24
|
+
.slice(0, limit).map(doc => ({ documentId: doc.id, title: doc.title, path: doc.path,
|
|
25
|
+
snippet: doc.text.slice(0, 160), score: doc.title.toLowerCase().includes(lower) ? 1 : 0.85 }));
|
|
26
|
+
},
|
|
27
|
+
}, { name: '@omnitron-dev/lumen', version });
|
|
28
|
+
const transport = new StdioServerTransport(process.stdin, process.stdout, { maxBufferSize });
|
|
29
|
+
const stop = () => { void server.close(); };
|
|
30
|
+
process.once('SIGINT', stop);
|
|
31
|
+
process.once('SIGTERM', stop);
|
|
32
|
+
try {
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
let failure;
|
|
35
|
+
server.server.onerror = error => { failure = error; console.error('Lumen MCP:', error.message); };
|
|
36
|
+
server.server.onclose = () => failure ? reject(failure) : resolve();
|
|
37
|
+
server.connect(transport).catch(reject);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
process.removeListener('SIGINT', stop);
|
|
42
|
+
process.removeListener('SIGTERM', stop);
|
|
43
|
+
await server.close();
|
|
44
|
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E,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CorpusGraph } from '../corpus/graph.js';
|
|
2
|
+
import { type CorpusProjectionOptions } from '../corpus/projection.js';
|
|
3
|
+
import type { LumenConfig } from '../config/schema.js';
|
|
4
|
+
export declare function generateRouteMirrors(corpus: CorpusGraph, _config?: LumenConfig, options?: CorpusProjectionOptions): Map<string, string>;
|
|
5
|
+
//# sourceMappingURL=route-mirrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-mirrors.d.ts","sourceRoot":"","sources":["../../src/ai/route-mirrors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAiB,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,uBAAuB,GAChC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBrB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { toCleanMarkdown } from '@omnitron-dev/lumen-ast';
|
|
2
|
+
import { projectCorpus } from '../corpus/projection.js';
|
|
3
|
+
export function generateRouteMirrors(corpus, _config, options) {
|
|
4
|
+
const mirrors = new Map();
|
|
5
|
+
const projectedCorpus = projectCorpus(corpus, options);
|
|
6
|
+
const docs = projectedCorpus.getAllDocuments();
|
|
7
|
+
for (const doc of docs) {
|
|
8
|
+
const cleanMd = doc.ast
|
|
9
|
+
? toCleanMarkdown(doc.ast, {
|
|
10
|
+
includeFrontmatter: true,
|
|
11
|
+
})
|
|
12
|
+
: `# ${doc.title}\n\n${doc.path}`;
|
|
13
|
+
const baseRoute = doc.routePath ?? `/${doc.path.replace(/\.(pdx|md)$/, '')}`;
|
|
14
|
+
const normalizedRoute = baseRoute.startsWith('/') ? baseRoute : `/${baseRoute}`;
|
|
15
|
+
mirrors.set(normalizedRoute, cleanMd);
|
|
16
|
+
mirrors.set(`${normalizedRoute === '/' ? '/index' : normalizedRoute}.md`, cleanMd);
|
|
17
|
+
}
|
|
18
|
+
return mirrors;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=route-mirrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-mirrors.js","sourceRoot":"","sources":["../../src/ai/route-mirrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAgC,MAAM,yBAAyB,CAAC;AAGtF,MAAM,UAAU,oBAAoB,CAClC,MAAmB,EACnB,OAAqB,EACrB,OAAiC;IAEjC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,MAAM,IAAI,GAAG,eAAe,CAAC,eAAe,EAAE,CAAC;IAE/C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG;YACrB,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE;gBACvB,kBAAkB,EAAE,IAAI;aACzB,CAAC;YACJ,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;QAEpC,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,CAAC;QAC7E,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC;QAEhF,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,eAAe,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,KAAK,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import type { LumenConfig } from '../config/schema.js';
|
|
3
|
+
import { CorpusGraph } from '../corpus/graph.js';
|
|
4
|
+
import type { LumenGateDiagnostic } from '../gates/types.js';
|
|
5
|
+
export declare function loadCorpusFromDirectory(rootDir?: string, explicitConfig?: LumenConfig): Promise<{
|
|
6
|
+
config: LumenConfig;
|
|
7
|
+
graph: CorpusGraph;
|
|
8
|
+
docsDir: string;
|
|
9
|
+
docsDirExists: boolean;
|
|
10
|
+
astDiagnostics: LumenGateDiagnostic[];
|
|
11
|
+
}>;
|
|
12
|
+
export declare function runLumenCli(argv?: string[]): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjD,OAAO,KAAK,EAAc,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AA4IzE,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,MAAsB,EAC/B,cAAc,CAAC,EAAE,WAAW,GAC3B,OAAO,CAAC;IACT,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,mBAAmB,EAAE,CAAC;CACvC,CAAC,CA8JD;AAmDD,wBAAsB,WAAW,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA4RvF"}
|