@markdy/core 1.2.0 → 1.3.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/README.md +42 -38
- package/dist/index.d.ts +353 -5
- package/dist/index.js +2526 -101
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# @markdy/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://markdy.com/playground/"><img src="https://img.shields.io/badge/⚡_Live_Studio-markdy.com%2Fplayground-3b82f6?style=for-the-badge" alt="Live Studio" /></a>
|
|
5
|
+
<a href="https://markdy.com/docs/"><img src="https://img.shields.io/badge/📖_Docs-Documentation-10b981?style=for-the-badge" alt="Documentation" /></a>
|
|
6
|
+
<a href="https://marketplace.visualstudio.com/items?itemName=hoangyell.markdy-vscode"><img src="https://img.shields.io/badge/🔌_VS_Code-Extension-8b5cf6?style=for-the-badge" alt="VS Code Extension" /></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
The zero-dependency parser, dynamic port multiplexer, and AST routing engine for [MarkdyScript](https://markdy.com/docs/) — a diagram-native DSL for animated architecture diagrams that AI agents generate reliably.
|
|
10
|
+
|
|
11
|
+
> 🚀 **Try it live**: Test MarkdyScript in the browser at **[markdy.com/playground](https://markdy.com/playground/)**
|
|
12
|
+
> 📚 **Documentation**: Complete syntax guide and examples at **[markdy.com/docs](https://markdy.com/docs/)**
|
|
13
|
+
> 🌟 **Architecture Blueprints**: 30+ canonical production diagrams at **[markdy.com/examples](https://markdy.com/examples/)**
|
|
4
14
|
|
|
5
15
|
## Features
|
|
6
16
|
|
|
7
17
|
- **Zero runtime dependencies** — pure TypeScript, no DOM or platform APIs (~14 KB minzipped)
|
|
8
18
|
- **Single-pass parser** — line-by-line state machine with strict `ParseError` line-number diagnostics
|
|
19
|
+
- **Dynamic Port Multiplexer & Smooth Router** — obstacle-aware orthogonal Manhattan routing with balanced multi-lane fan-in/fan-out and smooth fillet curves
|
|
20
|
+
- **Code Provenance & Git In-Tree Grounding** — anchor architecture nodes directly to source files (`@src="path/file.ts#L10-L40"`) with automated path traversal security and bounds validation
|
|
21
|
+
- **Architectural Evolution & Git-Diff Matrix** — deep structural and visual comparison of architecture states with auto-generated animated migration storyboards
|
|
22
|
+
- **Native Vector Symbol Registry** — zero-dependency vector SVG icons for 20+ top cloud, database, runtime, and messaging technologies
|
|
9
23
|
- **17 Specialized Layout Engines** — `architecture`, `flowchart`, `tree`, `sequence`, `state`, `layers`, `nested`, `swimlane`, `timeline`, `gantt`, `medallion`, `flywheel`, `constellation`, `quadrant`, `pyramid`, `radar`, `venn`
|
|
10
24
|
- **10 Semantic Themes** — `paper`, `editorial`, `midnight`, `blueprint`, `graphite`, `nebula`, `terminal`, `sketchy`, `ink`, `doodle`
|
|
11
25
|
- **Content-Adaptive Canvas Sizing** — automatically calculates optimal aspect ratio and bounds based on diagram items and topology
|
|
@@ -18,31 +32,22 @@ The parser and AST types for [MarkdyScript](../../docs/SYNTAX.md) — a diagram-
|
|
|
18
32
|
pnpm add @markdy/core
|
|
19
33
|
```
|
|
20
34
|
|
|
21
|
-
## Package
|
|
35
|
+
## Package Position
|
|
22
36
|
|
|
23
37
|
```text
|
|
24
38
|
@markdy/core
|
|
25
39
|
-> parser + AST types (no DOM, no runtime deps)
|
|
40
|
+
-> dynamic port multiplexer & orthogonal router
|
|
41
|
+
-> code provenance & git verification
|
|
42
|
+
-> architectural evolution & diff matrix
|
|
43
|
+
-> native vector symbol registry
|
|
26
44
|
-> foundation for renderer, CLI, language server, and integrations
|
|
27
45
|
```
|
|
28
46
|
|
|
29
|
-
## Output preview
|
|
30
|
-
|
|
31
|
-
<p align="center">
|
|
32
|
-
<a href="https://markdy.com/playground/">
|
|
33
|
-
<img src="https://raw.githubusercontent.com/HoangYell/markdy-com/main/website/public/images/scene-url-shortener.webp" alt="Markdy Core Parser Architecture Preview" width="900" />
|
|
34
|
-
</a>
|
|
35
|
-
</p>
|
|
36
|
-
<p align="center">
|
|
37
|
-
<a href="https://markdy.com/playground/">
|
|
38
|
-
<img src="https://raw.githubusercontent.com/HoangYell/markdy-com/main/website/public/images/scene-concurrency-decision-flowchart.webp" alt="Markdy Concurrency Flowchart Preview" width="900" />
|
|
39
|
-
</a>
|
|
40
|
-
</p>
|
|
41
|
-
|
|
42
47
|
## Usage
|
|
43
48
|
|
|
44
49
|
```typescript
|
|
45
|
-
import { parse, ParseError } from "@markdy/core";
|
|
50
|
+
import { parse, ParseError, diffDiagramASTs, resolveVectorSymbol } from "@markdy/core";
|
|
46
51
|
import type { DiagramAST } from "@markdy/core";
|
|
47
52
|
|
|
48
53
|
const source = `
|
|
@@ -51,8 +56,9 @@ layout LR
|
|
|
51
56
|
|
|
52
57
|
browser Client "Web Client"
|
|
53
58
|
gateway Gateway "API Gateway"
|
|
54
|
-
service Shortener "URL Service"
|
|
55
|
-
cache Redis "Redis Cluster"
|
|
59
|
+
service Shortener "URL Service" @src="src/url/service.ts#L15-L80"
|
|
60
|
+
cache Redis "Redis Cluster" icon=redis
|
|
61
|
+
database Postgres "PostgreSQL 16" icon=postgresql
|
|
56
62
|
|
|
57
63
|
beat hit:
|
|
58
64
|
show $nodes stagger=60ms
|
|
@@ -66,7 +72,7 @@ try {
|
|
|
66
72
|
const ast: DiagramAST = parse(source);
|
|
67
73
|
|
|
68
74
|
console.log(ast.meta); // { width: 1280, height: 720, fps: 60, theme: "paper", direction: "LR", title: "Cache-Aside Architecture" }
|
|
69
|
-
console.log(ast.nodes); // { Client: { kind: "browser", ... },
|
|
75
|
+
console.log(ast.nodes); // { Client: { kind: "browser", ... }, Shortener: { ... } }
|
|
70
76
|
console.log(ast.beats); // [{ name: "hit", cues: [...] }]
|
|
71
77
|
} catch (e) {
|
|
72
78
|
if (e instanceof ParseError) {
|
|
@@ -75,33 +81,31 @@ try {
|
|
|
75
81
|
}
|
|
76
82
|
```
|
|
77
83
|
|
|
78
|
-
## Exports
|
|
84
|
+
## Key API Exports
|
|
79
85
|
|
|
80
86
|
| Export | Type | Description |
|
|
81
87
|
|---|---|---|
|
|
82
88
|
| `parse` | `(source, opts?) => DiagramAST` | Parse MarkdyScript source into a diagram AST |
|
|
83
89
|
| `compile` | `(ast) => RenderPlan` | Lay out nodes, route edges, and schedule cues |
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `SceneMeta` | type | Scene configuration; `meta.player` is authoritative, with deprecated flat mirrors retained for compatibility |
|
|
91
|
-
| `PlayerConfig` / `resolvePlayer` | type / function | Grouped playback, controls, interaction, and chrome configuration with host resolution |
|
|
90
|
+
| `routeOrthogonalEdge` | `(src, tgt, opts?) => RoutedPath` | Compute collision-aware orthogonal waypoints with smooth fillet curves |
|
|
91
|
+
| `allocatePortLanes` | `(edges, boxes) => Map` | Dynamic port multiplexer distributing multi-edge lanes along node perimeters |
|
|
92
|
+
| `parseCodeAnchor` / `extractDiagramCodeAnchors` | `functions` | Parse and extract `@src` code provenance anchors from diagram nodes |
|
|
93
|
+
| `verifyCodeAnchorsWithReader` | `(anchors, reader) => Report` | Verify code anchors against local repository files and line counts |
|
|
94
|
+
| `diffDiagramASTs` | `(astA, astB) => DiffResult` | Compare architecture versions and generate executable migration storyboards |
|
|
95
|
+
| `resolveVectorSymbol` / `renderSymbolSvg` | `functions` | Zero-dependency vector SVG icon registry (AWS, K8s, Redis, Postgres, Kafka...) |
|
|
92
96
|
| `generateThemeFromBrand` | `(hexColor, name?) => { light, dark }` | Generate WCAG-compliant light and dark theme palettes from any brand hex color |
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `compressUrlState` / `decompressUrlState` | `(code, opts?) => string` | Zero-dependency URL hash state encoder for shareable playground links |
|
|
96
|
-
| `THEMES` / `resolveTheme` | tokens / function | 10 Semantic theme palettes (`paper`, `editorial`, `nebula`, `midnight`, `blueprint`, `graphite`, `terminal`, `sketchy`, `ink`, `doodle`) |
|
|
97
|
+
| `compressMarkdyToUrlHash` / `decompress` | `functions` | Lossless URL hash state encoder for shareable playground links |
|
|
98
|
+
| `THEMES` / `resolveTheme` | tokens / function | 10 Semantic theme palettes |
|
|
97
99
|
|
|
98
|
-
## Documentation
|
|
100
|
+
## Ecosystem & Documentation
|
|
99
101
|
|
|
100
|
-
- **[
|
|
101
|
-
- **[
|
|
102
|
-
- **[
|
|
103
|
-
- **[
|
|
102
|
+
- ⚡ **[Interactive Studio / Playground](https://markdy.com/playground/)** — edit MarkdyScript with instant live preview in your browser
|
|
103
|
+
- 📖 **[Syntax Guide & Reference](https://markdy.com/docs/)** — complete language specification and keywords
|
|
104
|
+
- 🌟 **[Canonical Blueprints](https://markdy.com/examples/)** — production-grade distributed system and cloud architectures
|
|
105
|
+
- 🤖 **[Agent Engineering Guide](https://markdy.com/agent/)** — instructions for LLMs (Claude, GPT, Gemini) to generate valid Markdy
|
|
106
|
+
- 🔌 **[VS Code Marketplace Extension](https://marketplace.visualstudio.com/items?itemName=hoangyell.markdy-vscode)** — syntax highlighting and live preview in editor
|
|
107
|
+
- 📦 **[GitHub Repository](https://github.com/HoangYell/markdy-com)** — source code, benchmarks, and issue tracker
|
|
104
108
|
|
|
105
109
|
## License
|
|
106
110
|
|
|
107
|
-
[MIT](
|
|
111
|
+
[MIT](https://github.com/HoangYell/markdy-com/blob/main/LICENSE)
|
package/dist/index.d.ts
CHANGED
|
@@ -547,7 +547,8 @@ declare function classifyTechnology(id: string, label?: string): SemanticProfile
|
|
|
547
547
|
|
|
548
548
|
/**
|
|
549
549
|
* packages/core/src/diff.ts
|
|
550
|
-
*
|
|
550
|
+
* Architectural Evolution and Git-Diff Engine for Markdy.
|
|
551
|
+
* Calculates structural deltas between two architectural states and generates animated migration storyboards.
|
|
551
552
|
* Zero external dependencies.
|
|
552
553
|
*/
|
|
553
554
|
|
|
@@ -564,16 +565,30 @@ interface EdgeDiff {
|
|
|
564
565
|
status: DiffChangeType;
|
|
565
566
|
before?: EdgeDecl;
|
|
566
567
|
after?: EdgeDecl;
|
|
568
|
+
changes: string[];
|
|
569
|
+
}
|
|
570
|
+
interface GroupDiff {
|
|
571
|
+
id: string;
|
|
572
|
+
status: DiffChangeType;
|
|
573
|
+
before?: GroupDecl;
|
|
574
|
+
after?: GroupDecl;
|
|
575
|
+
changes: string[];
|
|
567
576
|
}
|
|
568
577
|
interface DiagramDiffResult {
|
|
569
578
|
nodes: NodeDiff[];
|
|
570
579
|
edges: EdgeDiff[];
|
|
580
|
+
groups: GroupDiff[];
|
|
571
581
|
addedNodesCount: number;
|
|
572
582
|
removedNodesCount: number;
|
|
573
583
|
modifiedNodesCount: number;
|
|
584
|
+
addedEdgesCount: number;
|
|
585
|
+
removedEdgesCount: number;
|
|
574
586
|
summaryMarkdown: string;
|
|
575
587
|
evolutionMarkdyScript: string;
|
|
576
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* Compares two Diagram ASTs to produce a comprehensive architectural evolution report.
|
|
591
|
+
*/
|
|
577
592
|
declare function diffDiagramASTs(beforeAST: DiagramAST, afterAST: DiagramAST): DiagramDiffResult;
|
|
578
593
|
|
|
579
594
|
/**
|
|
@@ -586,7 +601,8 @@ declare function decompressMarkdyFromUrlHash(hash: string): Promise<string>;
|
|
|
586
601
|
|
|
587
602
|
/**
|
|
588
603
|
* packages/core/src/router.ts
|
|
589
|
-
* Collision-aware Orthogonal Manhattan Router
|
|
604
|
+
* Collision-aware Orthogonal Manhattan Router with Dynamic Port Multiplexing.
|
|
605
|
+
* Clean-room re-engineered for Markdy.
|
|
590
606
|
* Zero external dependencies.
|
|
591
607
|
*/
|
|
592
608
|
interface Point {
|
|
@@ -600,6 +616,19 @@ interface Box {
|
|
|
600
616
|
height: number;
|
|
601
617
|
}
|
|
602
618
|
type CardinalPort = "left" | "right" | "top" | "bottom";
|
|
619
|
+
interface PortLane {
|
|
620
|
+
index: number;
|
|
621
|
+
total: number;
|
|
622
|
+
}
|
|
623
|
+
interface RouteOptions {
|
|
624
|
+
sourceLane?: PortLane;
|
|
625
|
+
targetLane?: PortLane;
|
|
626
|
+
sourcePort?: CardinalPort;
|
|
627
|
+
targetPort?: CardinalPort;
|
|
628
|
+
cornerRadius?: number;
|
|
629
|
+
margin?: number;
|
|
630
|
+
obstacles?: Box[];
|
|
631
|
+
}
|
|
603
632
|
interface RoutedPath {
|
|
604
633
|
sourcePort: CardinalPort;
|
|
605
634
|
targetPort: CardinalPort;
|
|
@@ -608,12 +637,116 @@ interface RoutedPath {
|
|
|
608
637
|
waypoints: Point[];
|
|
609
638
|
svgPathData: string;
|
|
610
639
|
}
|
|
611
|
-
|
|
640
|
+
/**
|
|
641
|
+
* Calculates the exact point of connection on a bounding box for a given cardinal port and dynamic lane.
|
|
642
|
+
*/
|
|
643
|
+
declare function getBoxPortPosition(box: Box, port: CardinalPort, lane?: PortLane): Point;
|
|
644
|
+
/**
|
|
645
|
+
* Automatically chooses the optimal cardinal ports connecting two bounding boxes.
|
|
646
|
+
*/
|
|
612
647
|
declare function selectOptimalPorts(sourceBox: Box, targetBox: Box): {
|
|
613
648
|
sourcePort: CardinalPort;
|
|
614
649
|
targetPort: CardinalPort;
|
|
615
650
|
};
|
|
616
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Builds an SVG path string with optional smooth fillet rounded corners.
|
|
653
|
+
*/
|
|
654
|
+
declare function buildSmoothSvgPath(start: Point, waypoints: Point[], end: Point, cornerRadius?: number): string;
|
|
655
|
+
/**
|
|
656
|
+
* Routes an orthogonal edge between two boxes with collision awareness and dynamic port multiplexing.
|
|
657
|
+
*/
|
|
658
|
+
declare function routeOrthogonalEdge(sourceBox: Box, targetBox: Box, options?: RouteOptions): RoutedPath;
|
|
659
|
+
/**
|
|
660
|
+
* Dynamic Port Multiplexer:
|
|
661
|
+
* Allocates balanced, collision-free port lanes for multiple edges attaching to the same node boundary.
|
|
662
|
+
* Seamlessly handles multi-edge fan-in/fan-out and bidirectional request/response pairs without overlapping.
|
|
663
|
+
*/
|
|
664
|
+
declare function allocatePortLanes<T extends {
|
|
665
|
+
from: string;
|
|
666
|
+
to: string;
|
|
667
|
+
id?: string;
|
|
668
|
+
}>(edges: T[], boxes: Record<string, Box>): Map<T, {
|
|
669
|
+
sourceLane?: PortLane;
|
|
670
|
+
targetLane?: PortLane;
|
|
671
|
+
}>;
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* packages/core/src/symbols.ts
|
|
675
|
+
* Native Zero-Dependency Vector Symbol Registry for Markdy.
|
|
676
|
+
* High-performance inline SVG paths for modern system architecture stacks.
|
|
677
|
+
*/
|
|
678
|
+
interface VectorSymbol {
|
|
679
|
+
name: string;
|
|
680
|
+
category: "cloud" | "database" | "compute" | "messaging" | "runtime" | "gateway" | "client" | "security" | "observability" | "data";
|
|
681
|
+
viewBox: string;
|
|
682
|
+
svgPaths: string;
|
|
683
|
+
brandColor?: string;
|
|
684
|
+
}
|
|
685
|
+
declare const VECTOR_SYMBOLS: Record<string, VectorSymbol>;
|
|
686
|
+
/**
|
|
687
|
+
* Resolves a vector symbol definition by key or normalized alias.
|
|
688
|
+
*/
|
|
689
|
+
declare function resolveVectorSymbol(nameOrAlias: string): VectorSymbol | null;
|
|
690
|
+
/**
|
|
691
|
+
* Returns a standalone SVG snippet string for a vector symbol.
|
|
692
|
+
*/
|
|
693
|
+
declare function renderSymbolSvg(symbol: VectorSymbol | string, options?: {
|
|
694
|
+
size?: number;
|
|
695
|
+
className?: string;
|
|
696
|
+
color?: string;
|
|
697
|
+
}): string | null;
|
|
698
|
+
/**
|
|
699
|
+
* Lists all available vector symbol names registered in Markdy.
|
|
700
|
+
*/
|
|
701
|
+
declare function listAvailableSymbols(): string[];
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* packages/core/src/provenance.ts
|
|
705
|
+
* Code Provenance and Git Verification Engine for Markdy.
|
|
706
|
+
* Anchors architecture diagram components to physical source code references with deterministic proof.
|
|
707
|
+
* Zero runtime dependencies (Node fs/path utilized conditionally in verification CLI).
|
|
708
|
+
*/
|
|
709
|
+
|
|
710
|
+
interface CodeProvenanceAnchor {
|
|
711
|
+
raw: string;
|
|
712
|
+
filePath: string;
|
|
713
|
+
startLine?: number;
|
|
714
|
+
endLine?: number;
|
|
715
|
+
revision?: string;
|
|
716
|
+
resolvedHref?: string;
|
|
717
|
+
}
|
|
718
|
+
interface CodeProvenanceDiagnostic {
|
|
719
|
+
nodeId: string;
|
|
720
|
+
severity: "error" | "warning";
|
|
721
|
+
code: "provenance/path-invalid" | "provenance/path-escape" | "provenance/file-not-found" | "provenance/line-out-of-bounds" | "provenance/git-mismatch";
|
|
722
|
+
message: string;
|
|
723
|
+
filePath: string;
|
|
724
|
+
line?: number;
|
|
725
|
+
fixSuggestion?: string;
|
|
726
|
+
}
|
|
727
|
+
interface CodeProvenanceVerificationReport {
|
|
728
|
+
isValid: boolean;
|
|
729
|
+
totalAnchors: number;
|
|
730
|
+
verifiedCount: number;
|
|
731
|
+
anchors: Map<string, CodeProvenanceAnchor>;
|
|
732
|
+
diagnostics: CodeProvenanceDiagnostic[];
|
|
733
|
+
summaryMarkdown: string;
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Parses a code anchor string (e.g. "src/auth/jwt.ts#L20-L85" or "prisma/schema.prisma#L110").
|
|
737
|
+
*/
|
|
738
|
+
declare function parseCodeAnchor(raw: unknown, repositoryUrl?: string, revision?: string): CodeProvenanceAnchor | null;
|
|
739
|
+
/**
|
|
740
|
+
* Extracts all code provenance anchors declared on nodes across a DiagramAST.
|
|
741
|
+
*/
|
|
742
|
+
declare function extractDiagramCodeAnchors(ast: DiagramAST, repositoryUrl?: string, revision?: string): Map<string, CodeProvenanceAnchor>;
|
|
743
|
+
/**
|
|
744
|
+
* Verifies code provenance anchors against a filesystem reader interface.
|
|
745
|
+
*/
|
|
746
|
+
declare function verifyCodeAnchorsWithReader(anchors: Map<string, CodeProvenanceAnchor>, fileReader: {
|
|
747
|
+
fileExists: (relPath: string) => boolean;
|
|
748
|
+
getLineCount: (relPath: string) => number;
|
|
749
|
+
}): CodeProvenanceVerificationReport;
|
|
617
750
|
|
|
618
751
|
/**
|
|
619
752
|
* packages/core/src/syntax-diagnostics.ts
|
|
@@ -783,4 +916,219 @@ declare function getArchitectureSuggestions(docText: string): ArchitectureRecomm
|
|
|
783
916
|
|
|
784
917
|
declare function formatScene(ast: DiagramAST): string;
|
|
785
918
|
|
|
786
|
-
|
|
919
|
+
/**
|
|
920
|
+
* packages/core/src/recipes.ts
|
|
921
|
+
* Architectural Scenario Recipes & Recommendation Engine for Markdy.
|
|
922
|
+
* Clean-room re-engineered architectural pattern catalog and AI prompt matching.
|
|
923
|
+
* Zero external dependencies.
|
|
924
|
+
*/
|
|
925
|
+
interface ArchitectureRecipe {
|
|
926
|
+
id: string;
|
|
927
|
+
name: string;
|
|
928
|
+
category: "caching" | "streaming" | "microservices" | "security" | "data" | "ai" | "resilience" | "consensus" | "observability";
|
|
929
|
+
description: string;
|
|
930
|
+
keywords: string[];
|
|
931
|
+
recommendedLayout: "LR" | "TD" | "TB" | "RL";
|
|
932
|
+
primaryNodes: string[];
|
|
933
|
+
code: string;
|
|
934
|
+
highlights: string[];
|
|
935
|
+
}
|
|
936
|
+
declare const ARCHITECTURE_RECIPES: ArchitectureRecipe[];
|
|
937
|
+
interface PatternRecommendationResult {
|
|
938
|
+
recipe: ArchitectureRecipe;
|
|
939
|
+
score: number;
|
|
940
|
+
matchedKeywords: string[];
|
|
941
|
+
rationale: string;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Recommends best architecture recipes for a user prompt or requirement query.
|
|
945
|
+
*/
|
|
946
|
+
declare function recommendArchitecturePattern(query: string): PatternRecommendationResult[];
|
|
947
|
+
interface SynthesizedRecipeResult {
|
|
948
|
+
markdyScript: string;
|
|
949
|
+
detectedComponents: Array<{
|
|
950
|
+
id: string;
|
|
951
|
+
label: string;
|
|
952
|
+
kind: string;
|
|
953
|
+
icon?: string;
|
|
954
|
+
}>;
|
|
955
|
+
inferredPattern: string;
|
|
956
|
+
rationale: string;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Zero-token deterministic dynamic architecture synthesis engine.
|
|
960
|
+
* Parses user requirements and synthesizes custom tailor-made MarkdyScript diagrams.
|
|
961
|
+
*/
|
|
962
|
+
declare function synthesizeCustomRecipe(query: string): SynthesizedRecipeResult;
|
|
963
|
+
/**
|
|
964
|
+
* Retrieves an architecture recipe by its exact ID or alias.
|
|
965
|
+
*/
|
|
966
|
+
declare function getArchitectureRecipe(id: string): ArchitectureRecipe | undefined;
|
|
967
|
+
/**
|
|
968
|
+
* Lists all available architecture recipes.
|
|
969
|
+
*/
|
|
970
|
+
declare function listArchitectureRecipes(): ArchitectureRecipe[];
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
* packages/core/src/verifier.ts
|
|
974
|
+
* 9-Point Quality Gate & Responsive Viewport Verifier for Markdy.
|
|
975
|
+
* Clean-room re-engineered deterministic artifact validation and integrity reporting.
|
|
976
|
+
* Zero external dependencies.
|
|
977
|
+
*/
|
|
978
|
+
|
|
979
|
+
type QualityProfile = "standard" | "showcase";
|
|
980
|
+
interface QualityCheckItem {
|
|
981
|
+
id: string;
|
|
982
|
+
name: string;
|
|
983
|
+
category: "syntax" | "geometry" | "governance" | "provenance" | "visual";
|
|
984
|
+
status: "pass" | "warn" | "fail";
|
|
985
|
+
message: string;
|
|
986
|
+
details?: Record<string, unknown>;
|
|
987
|
+
}
|
|
988
|
+
interface DiagramQualityMetrics {
|
|
989
|
+
nodeCount: number;
|
|
990
|
+
edgeCount: number;
|
|
991
|
+
beatCount: number;
|
|
992
|
+
hasCodeProvenance: boolean;
|
|
993
|
+
provenanceAnchorCount: number;
|
|
994
|
+
symbolCount: number;
|
|
995
|
+
estimatedWidth: number;
|
|
996
|
+
estimatedHeight: number;
|
|
997
|
+
aspectRatio: number;
|
|
998
|
+
}
|
|
999
|
+
interface QualityGateReport {
|
|
1000
|
+
passed: boolean;
|
|
1001
|
+
qualityProfile: QualityProfile;
|
|
1002
|
+
errorCount: number;
|
|
1003
|
+
warningCount: number;
|
|
1004
|
+
sha256Receipt: string;
|
|
1005
|
+
checks: QualityCheckItem[];
|
|
1006
|
+
metrics: DiagramQualityMetrics;
|
|
1007
|
+
viewportCompliance: {
|
|
1008
|
+
"1440x900": boolean;
|
|
1009
|
+
"1600x1000": boolean;
|
|
1010
|
+
"1920x1080": boolean;
|
|
1011
|
+
"2048x1320": boolean;
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
interface QualityGateOptions {
|
|
1015
|
+
profile?: QualityProfile;
|
|
1016
|
+
strictCycles?: boolean;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Runs the complete 12-Point Quality Gate & Viewport Verification on a DiagramAST.
|
|
1020
|
+
*/
|
|
1021
|
+
declare function verifyDiagramQuality(astOrCode: DiagramAST | string, options?: QualityGateOptions): QualityGateReport;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* packages/core/src/c4.ts
|
|
1025
|
+
* C4 Hierarchical Architecture Engine for Markdy.
|
|
1026
|
+
* Supports L1 System Context, L2 Containers, L3 Components, and L4 Code Provenance views.
|
|
1027
|
+
* Zero external dependencies.
|
|
1028
|
+
*/
|
|
1029
|
+
|
|
1030
|
+
type C4Level = "context" | "container" | "component" | "code";
|
|
1031
|
+
interface C4NodeMeta {
|
|
1032
|
+
id: string;
|
|
1033
|
+
level: C4Level;
|
|
1034
|
+
levelNumber: 1 | 2 | 3 | 4;
|
|
1035
|
+
isExternal: boolean;
|
|
1036
|
+
containerParent?: string;
|
|
1037
|
+
hasCodeProvenance: boolean;
|
|
1038
|
+
}
|
|
1039
|
+
interface C4ModelReport {
|
|
1040
|
+
ast: DiagramAST;
|
|
1041
|
+
levelsPresent: Record<C4Level, number>;
|
|
1042
|
+
nodesByLevel: Record<C4Level, string[]>;
|
|
1043
|
+
summaryMarkdown: string;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Infers the C4 abstraction level of a node based on explicit @c4 prop or node characteristics.
|
|
1047
|
+
*/
|
|
1048
|
+
declare function inferNodeC4Level(node: NodeDecl): {
|
|
1049
|
+
level: C4Level;
|
|
1050
|
+
levelNumber: 1 | 2 | 3 | 4;
|
|
1051
|
+
};
|
|
1052
|
+
/**
|
|
1053
|
+
* Analyzes the C4 model distribution of a Diagram AST.
|
|
1054
|
+
*/
|
|
1055
|
+
declare function analyzeC4Model(ast: DiagramAST): C4ModelReport;
|
|
1056
|
+
/**
|
|
1057
|
+
* Filters a Diagram AST to a specific C4 abstraction ceiling (e.g. show all nodes up to L2 Container level).
|
|
1058
|
+
*/
|
|
1059
|
+
declare function filterC4Hierarchy(ast: DiagramAST, maxLevel?: C4Level | 1 | 2 | 3 | 4): {
|
|
1060
|
+
filteredAst: DiagramAST;
|
|
1061
|
+
visibleNodeIds: string[];
|
|
1062
|
+
};
|
|
1063
|
+
/**
|
|
1064
|
+
* Automatically synthesizes a 4-beat interactive narrative storyboard zooming through C4 levels.
|
|
1065
|
+
*/
|
|
1066
|
+
declare function generateC4Storyboard(ast: DiagramAST): string;
|
|
1067
|
+
interface C4LevelViewExport {
|
|
1068
|
+
level: C4Level;
|
|
1069
|
+
levelNumber: 1 | 2 | 3 | 4;
|
|
1070
|
+
title: string;
|
|
1071
|
+
markdyScript: string;
|
|
1072
|
+
nodeCount: number;
|
|
1073
|
+
edgeCount: number;
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Exports isolated, production-ready MarkdyScript blueprints for each of the 4 C4 levels.
|
|
1077
|
+
*/
|
|
1078
|
+
declare function exportC4LevelViews(ast: DiagramAST): Record<C4Level, C4LevelViewExport>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Validates cross-level containment and flags orphaned lower-level components.
|
|
1081
|
+
*/
|
|
1082
|
+
declare function validateC4Containment(ast: DiagramAST): {
|
|
1083
|
+
isValid: boolean;
|
|
1084
|
+
issues: string[];
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* packages/core/src/drift.ts
|
|
1089
|
+
* Architecture Drift Detection and In-Tree Code Synchronization Engine for Markdy.
|
|
1090
|
+
* Identifies drift between architecture models and real physical repository codebases.
|
|
1091
|
+
* Zero external dependencies.
|
|
1092
|
+
*/
|
|
1093
|
+
|
|
1094
|
+
interface BrokenAnchorDrift {
|
|
1095
|
+
nodeId: string;
|
|
1096
|
+
nodeLabel: string;
|
|
1097
|
+
declaredPath: string;
|
|
1098
|
+
reason: "file_not_found" | "path_escaped";
|
|
1099
|
+
}
|
|
1100
|
+
interface OrphanCodeServiceDrift {
|
|
1101
|
+
suggestedId: string;
|
|
1102
|
+
suggestedKind: string;
|
|
1103
|
+
discoveredPath: string;
|
|
1104
|
+
}
|
|
1105
|
+
interface ArchitectureDriftReport {
|
|
1106
|
+
isSynchronized: boolean;
|
|
1107
|
+
totalAnchorsChecked: number;
|
|
1108
|
+
validAnchorCount: number;
|
|
1109
|
+
brokenAnchors: BrokenAnchorDrift[];
|
|
1110
|
+
orphanCodeServices: OrphanCodeServiceDrift[];
|
|
1111
|
+
summaryMarkdown: string;
|
|
1112
|
+
healingMarkdySnippet?: string;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Detects architectural drift between a Diagram AST and a list of physical repository files.
|
|
1116
|
+
*/
|
|
1117
|
+
declare function detectArchitectureDrift(ast: DiagramAST, existingFiles?: string[]): ArchitectureDriftReport;
|
|
1118
|
+
interface AutoHealResult {
|
|
1119
|
+
healedAst: DiagramAST;
|
|
1120
|
+
healedMarkdyScript: string;
|
|
1121
|
+
healedAnchorCount: number;
|
|
1122
|
+
addedServiceCount: number;
|
|
1123
|
+
healedMappings: Array<{
|
|
1124
|
+
nodeId: string;
|
|
1125
|
+
oldPath: string;
|
|
1126
|
+
newPath: string;
|
|
1127
|
+
}>;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Automatically heals broken architecture anchors and incorporates orphan code services.
|
|
1131
|
+
*/
|
|
1132
|
+
declare function autoHealArchitectureDrift(ast: DiagramAST, report: ArchitectureDriftReport, existingFiles?: string[]): AutoHealResult;
|
|
1133
|
+
|
|
1134
|
+
export { ARCHITECTURE_RECIPES, ARCH_RULE_PRESETS, type AnnotationDecl, type ArchRuleType, type ArchitectureDriftReport, type ArchitecturePreset, type ArchitectureRecipe, type ArchitectureRecommendation, type ArchitectureRule, type ArchitectureViolation, type AutoHealResult, type AutoRepairResult, BEAT_CUE_KEYWORDS, type BeatDecl, type BeatRange, type Box, type BrokenAnchorDrift, type C4Level, type C4LevelViewExport, type C4ModelReport, type C4NodeMeta, CUE_ALIASES, type CardinalPort, type CodeProvenanceAnchor, type CodeProvenanceDiagnostic, type CodeProvenanceVerificationReport, type Cue, DIAGRAM_TYPES, type Diagnostic, type DiagnosticIssue, type DiagramAST, type DiagramContext, type DiagramDiffResult, type DiagramQualityMetrics, type DiagramType, type DiffChangeType, EDGE_OPERATORS, type EdgeDecl, type EdgeDiff, type EdgeKind, type EdgeSelector, type ExtractedBeat, type ExtractedGroup, type ExtractedNode, type FlowSegment, type GhostTextSuggestion, type GroupBoundary, type GroupDecl, type GroupDiff, type IntelliCodeItem, type IntelliCodeItemKind, type LayoutDirection, type MarkdyConfig, NODE_ALIASES, NODE_KINDS, type NodeDecl, type NodeDiff, type NodeSelector, type NodeShape, OUTPUT_PRESETS, type OrphanCodeServiceDrift, type OutputPreset, PLAYER_FLAT_KEYS, PLAYER_GROUPS, POPULAR_TECHS, ParseError, type ParseOptions, type ParseResult, type PatternDecl, type PatternRecommendationResult, type PlayerChromeConfig, type PlayerConfig, type PlayerControlsConfig, type PlayerInteractionConfig, type PlayerOverrides, type PlayerPlaybackConfig, type PlayerProgress, type PlayerScope, type Point, type PortLane, type PositionedNode, type QualityCheckItem, type QualityGateOptions, type QualityGateReport, type QualityProfile, type RenderPlan, type RepairPromptBundle, type ResolvedPlayer, type RouteOptions, type RoutedEdge, type RoutedPath, type RuleSeverity, SCENE_KEYS, type SceneMeta, type SemanticProfile, type SequenceActivation, type SequenceMessage, type StyleDecl, type SyntaxDiagnosticReport, type SynthesizedRecipeResult, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, THEMES, type TechPreset, type ThemeGeneratorOptions, type ThemeTokens, type TimedCue, type TreeBus, VECTOR_SYMBOLS, VISUAL_PRIMITIVE_TYPES, type VectorSymbol, allocatePortLanes, analyzeAndBuildRepairPrompt, analyzeC4Model, applyPlayerSetting, autoHealArchitectureDrift, buildSmoothSvgPath, canonicalNodeKind, classifyTechnology, compile, compilePlan, compressMarkdyToUrlHash, computeAdaptiveDimensions, damerauLevenshteinDistance, decompressMarkdyFromUrlHash, detectArchitectureDrift, diagnoseMarkdyCode, diffDiagramASTs, exportC4LevelViews, extractDiagramCodeAnchors, extractDiagramContext, filterC4Hierarchy, findClosestMatch, formatScene, generateC4Storyboard, generateThemeFromBrand, getArchitectureRecipe, getArchitectureSuggestions, getBoxPortPosition, getIntelliCodeCompletions, humanizeId, inferNodeC4Level, listArchitectureRecipes, listAvailableSymbols, listOutputPresets, nodeRole, parse, parseAndCompile, parseCodeAnchor, predictNextLineSuggestion, recommendArchitecturePattern, renderSymbolSvg, repairMarkdyCode, resolveArchitectureConfig, resolveOutputPreset, resolvePlayer, resolveTheme, resolveVectorSymbol, routeOrthogonalEdge, selectOptimalPorts, synthesizeCustomRecipe, validateArchitecture, validateC4Containment, verifyCodeAnchorsWithReader, verifyDiagramQuality };
|