@avodado/core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Avodado contributors
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 ADDED
@@ -0,0 +1,41 @@
1
+ # @avodado/core
2
+
3
+ Pure library: parse Avodado Markdown into a typed model, validate it, and resolve references across documents. No I/O.
4
+
5
+ ## Install
6
+
7
+ ```
8
+ pnpm add @avodado/core
9
+ ```
10
+
11
+ ## Primary API
12
+
13
+ ```ts
14
+ import {
15
+ parseDocument,
16
+ validateDocument,
17
+ resolveRefs,
18
+ blockRegistry,
19
+ type Document,
20
+ type Diagnostic,
21
+ } from '@avodado/core';
22
+
23
+ const doc: Document = parseDocument(markdown, 'orders');
24
+ const diags: Diagnostic[] = validateDocument(doc, 'docs/orders.md');
25
+ const { graph, diagnostics } = resolveRefs([{ doc, file: 'docs/orders.md' }]);
26
+ ```
27
+
28
+ - **`parseDocument(md, slug)`** — splits Markdown into prose / typed-block segments, parses YAML bodies, extracts top-level `id` slugs and `meta`. Errors are deferred to `validateDocument`.
29
+ - **`validateDocument(doc, file)`** — runs each block against its zod schema and returns `Diagnostic[]`.
30
+ - **`resolveRefs(inputs)`** — resolves `doc#id` / `#id` references across many documents. Returns the reference graph plus diagnostics for duplicate ids and dangling refs.
31
+ - **`blockRegistry`** — `Record<BlockType, BlockDef>`. The single source of truth for each block's schema and reference extractor.
32
+
33
+ ## Diagnostic codes
34
+
35
+ `E_PARSE_YAML`, `E_SCHEMA`, `E_DUP_ID`, `E_DANGLING_REF`, `E_BAD_REF_FORMAT`, `E_UNKNOWN_BLOCK`, `W_EMPTY_BLOCK`. Uniform shape: `{ file, line?, level, code, message, value? }`.
36
+
37
+ ## Block types
38
+
39
+ `meta · callout · table · sequence · erd · userstory · timeline · kanban · tracker`.
40
+
41
+ Field shapes are zod schemas exported individually (e.g. `userstorySchema`). Per-block data types are exposed as `BlockDataMap[K]`.