@markdy/core 1.0.28 → 1.0.30

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 (3) hide show
  1. package/dist/index.d.ts +135 -2
  2. package/dist/index.js +1465 -40
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -427,7 +427,9 @@ type PlayerOverrides = {
427
427
  loop?: boolean;
428
428
  playbackRate?: number;
429
429
  copyright?: boolean;
430
- controls?: boolean;
430
+ controls?: boolean | (PlayerControlsConfig & {
431
+ playback?: boolean;
432
+ });
431
433
  interactiveViewport?: boolean;
432
434
  progress?: PlayerProgress;
433
435
  progressColor?: string;
@@ -610,6 +612,57 @@ declare function selectOptimalPorts(sourceBox: Box, targetBox: Box): {
610
612
  };
611
613
  declare function routeOrthogonalEdge(sourceBox: Box, targetBox: Box): RoutedPath;
612
614
 
615
+ /**
616
+ * packages/core/src/syntax-diagnostics.ts
617
+ * Deep Syntax Diagnostics, Fuzzy Typo Matching, Grammar Inspection & Auto-Healing for Markdy.
618
+ * Zero external dependencies.
619
+ */
620
+ interface DiagnosticIssue {
621
+ line: number;
622
+ column?: number;
623
+ severity: "error" | "warning" | "info";
624
+ code: "TYPO_KEYWORD" | "TYPO_NODE_KIND" | "UNDEFINED_NODE_REFERENCE" | "UNQUOTED_STRING_LABEL" | "UNTERMINATED_STRING" | "MISSING_COLON" | "CUE_OUTSIDE_BEAT" | "INVALID_FLOW_OPERATOR" | "FLOW_CYCLE_RETURN_EDGE" | "UNKNOWN_THEME_OR_PROPERTY" | "FOREIGN_DIAGRAM_SYNTAX" | "SYNTAX_ERROR" | "ARCH_RULE_VIOLATION";
625
+ message: string;
626
+ snippet?: string;
627
+ suggestion?: string;
628
+ didYouMean?: string;
629
+ ruleExplanation?: string;
630
+ fix?: {
631
+ original: string;
632
+ replacement: string;
633
+ };
634
+ }
635
+ interface SyntaxDiagnosticReport {
636
+ isValid: boolean;
637
+ errorCount: number;
638
+ warningCount: number;
639
+ issues: DiagnosticIssue[];
640
+ repairedCode?: string;
641
+ repairPrompt: string;
642
+ summary: string;
643
+ declaredNodes: string[];
644
+ referencedNodes: string[];
645
+ }
646
+ interface AutoRepairResult {
647
+ repairedCode: string;
648
+ changes: string[];
649
+ isFixed: boolean;
650
+ }
651
+ interface DiagnosticOptions {
652
+ checkArchitecture?: boolean;
653
+ transpileMermaid?: (source: string) => string;
654
+ }
655
+ declare function damerauLevenshteinDistance(a: string, b: string): number;
656
+ declare function findClosestMatch(word: string, candidates: Iterable<string>, maxDistance?: number): {
657
+ match: string;
658
+ distance: number;
659
+ } | null;
660
+ declare function diagnoseMarkdyCode(code: string, options?: DiagnosticOptions): SyntaxDiagnosticReport;
661
+ declare function repairMarkdyCode(code: string, options?: {
662
+ transpileMermaid?: (source: string) => string;
663
+ precomputedIssues?: DiagnosticIssue[];
664
+ }): AutoRepairResult;
665
+
613
666
  /**
614
667
  * packages/core/src/ai-healing.ts
615
668
  * Self-healing AI Prompt Generation & Diagnostic Repair Loop for Markdy.
@@ -621,6 +674,9 @@ interface RepairPromptBundle {
621
674
  repairPrompt?: string;
622
675
  syntaxErrors: string[];
623
676
  archViolations: ArchitectureViolation[];
677
+ issues?: DiagnosticIssue[];
678
+ repairedCode?: string;
679
+ report?: SyntaxDiagnosticReport;
624
680
  }
625
681
  declare function analyzeAndBuildRepairPrompt(sourceCode: string): RepairPromptBundle;
626
682
 
@@ -645,4 +701,81 @@ declare function resolveOutputPreset(name: string): OutputPreset;
645
701
  /** List all available preset names. */
646
702
  declare function listOutputPresets(): string[];
647
703
 
648
- export { ARCH_RULE_PRESETS, type AnnotationDecl, type ArchRuleType, type ArchitecturePreset, type ArchitectureRule, type ArchitectureViolation, BEAT_CUE_KEYWORDS, type BeatDecl, type BeatRange, type Box, CUE_ALIASES, type CardinalPort, type Cue, DIAGRAM_TYPES, type Diagnostic, type DiagramAST, type DiagramDiffResult, type DiagramType, type DiffChangeType, EDGE_OPERATORS, type EdgeDecl, type EdgeDiff, type EdgeKind, type EdgeSelector, type FlowSegment, type GroupBoundary, type GroupDecl, type LayoutDirection, type MarkdyConfig, NODE_ALIASES, NODE_KINDS, type NodeDecl, type NodeDiff, type NodeSelector, type NodeShape, OUTPUT_PRESETS, type OutputPreset, PLAYER_FLAT_KEYS, PLAYER_GROUPS, ParseError, type ParseOptions, type ParseResult, type PatternDecl, type PlayerChromeConfig, type PlayerConfig, type PlayerControlsConfig, type PlayerInteractionConfig, type PlayerOverrides, type PlayerPlaybackConfig, type PlayerProgress, type PlayerScope, type Point, type PositionedNode, type RenderPlan, type RepairPromptBundle, type ResolvedPlayer, type RoutedEdge, type RoutedPath, type RuleSeverity, SCENE_KEYS, type SceneMeta, type SemanticProfile, type SequenceActivation, type SequenceMessage, type StyleDecl, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, THEMES, type ThemeGeneratorOptions, type ThemeTokens, type TimedCue, type TreeBus, VISUAL_PRIMITIVE_TYPES, analyzeAndBuildRepairPrompt, applyPlayerSetting, canonicalNodeKind, classifyTechnology, compile, compilePlan, compressMarkdyToUrlHash, computeAdaptiveDimensions, decompressMarkdyFromUrlHash, diffDiagramASTs, generateThemeFromBrand, getBoxPortPosition, humanizeId, listOutputPresets, nodeRole, parse, parseAndCompile, resolveArchitectureConfig, resolveOutputPreset, resolvePlayer, resolveTheme, routeOrthogonalEdge, selectOptimalPorts, validateArchitecture };
704
+ /**
705
+ * packages/core/src/intellicode.ts
706
+ * Markdy IntelliCode, Context-Aware Autocompletion, Predictive Flow & Architecture Suggestion Engine.
707
+ * Zero external dependencies.
708
+ */
709
+ type IntelliCodeItemKind = "keyword" | "directive" | "nodeKind" | "node" | "group" | "tech" | "flowOp" | "cue" | "selector" | "theme" | "layout" | "diagramType" | "attribute" | "snippet" | "value";
710
+ interface IntelliCodeItem {
711
+ label: string;
712
+ insertText: string;
713
+ kind: IntelliCodeItemKind;
714
+ detail?: string;
715
+ documentation?: string;
716
+ isSnippet?: boolean;
717
+ boost?: number;
718
+ filterText?: string;
719
+ }
720
+ interface ExtractedNode {
721
+ id: string;
722
+ kind: string;
723
+ label: string;
724
+ line: number;
725
+ }
726
+ interface ExtractedGroup {
727
+ id: string;
728
+ label: string;
729
+ members: string[];
730
+ line: number;
731
+ }
732
+ interface ExtractedBeat {
733
+ id: string;
734
+ label: string;
735
+ line: number;
736
+ }
737
+ interface DiagramContext {
738
+ declaredNodes: ExtractedNode[];
739
+ declaredGroups: ExtractedGroup[];
740
+ declaredBeats: ExtractedBeat[];
741
+ theme?: string;
742
+ layout?: string;
743
+ diagramType?: string;
744
+ insideBeat: boolean;
745
+ currentBeatName?: string;
746
+ insideGroup: boolean;
747
+ lineNo: number;
748
+ lineText: string;
749
+ linePrefix: string;
750
+ tokenPrefix: string;
751
+ }
752
+ interface GhostTextSuggestion {
753
+ text: string;
754
+ insertText: string;
755
+ description: string;
756
+ type: "next-flow" | "beat-cue" | "init-beat" | "next-node" | "group";
757
+ }
758
+ interface ArchitectureRecommendation {
759
+ id: string;
760
+ title: string;
761
+ desc: string;
762
+ snippet: string;
763
+ category: "performance" | "security" | "reliability" | "choreography" | "structure";
764
+ actionLabel: string;
765
+ }
766
+ interface TechPreset {
767
+ name: string;
768
+ aliases: string[];
769
+ kind: string;
770
+ defaultId: string;
771
+ label: string;
772
+ desc: string;
773
+ category: "database" | "cache" | "queue" | "gateway" | "client" | "compute" | "storage" | "security" | "ai";
774
+ }
775
+ declare const POPULAR_TECHS: TechPreset[];
776
+ declare function extractDiagramContext(text: string, cursorLine?: number, cursorCol?: number): DiagramContext;
777
+ declare function getIntelliCodeCompletions(docText: string, cursorLine: number, cursorCol: number): IntelliCodeItem[];
778
+ declare function predictNextLineSuggestion(docText: string, cursorLine: number): GhostTextSuggestion | null;
779
+ declare function getArchitectureSuggestions(docText: string): ArchitectureRecommendation[];
780
+
781
+ export { ARCH_RULE_PRESETS, type AnnotationDecl, type ArchRuleType, type ArchitecturePreset, type ArchitectureRecommendation, type ArchitectureRule, type ArchitectureViolation, type AutoRepairResult, BEAT_CUE_KEYWORDS, type BeatDecl, type BeatRange, type Box, CUE_ALIASES, type CardinalPort, type Cue, DIAGRAM_TYPES, type Diagnostic, type DiagnosticIssue, type DiagramAST, type DiagramContext, type DiagramDiffResult, 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 IntelliCodeItem, type IntelliCodeItemKind, type LayoutDirection, type MarkdyConfig, NODE_ALIASES, NODE_KINDS, type NodeDecl, type NodeDiff, type NodeSelector, type NodeShape, OUTPUT_PRESETS, type OutputPreset, PLAYER_FLAT_KEYS, PLAYER_GROUPS, POPULAR_TECHS, ParseError, type ParseOptions, type ParseResult, type PatternDecl, type PlayerChromeConfig, type PlayerConfig, type PlayerControlsConfig, type PlayerInteractionConfig, type PlayerOverrides, type PlayerPlaybackConfig, type PlayerProgress, type PlayerScope, type Point, type PositionedNode, type RenderPlan, type RepairPromptBundle, type ResolvedPlayer, type RoutedEdge, type RoutedPath, type RuleSeverity, SCENE_KEYS, type SceneMeta, type SemanticProfile, type SequenceActivation, type SequenceMessage, type StyleDecl, type SyntaxDiagnosticReport, TECHNICAL_NODE_KINDS, TECHNICAL_NODE_TYPES, THEMES, type TechPreset, type ThemeGeneratorOptions, type ThemeTokens, type TimedCue, type TreeBus, VISUAL_PRIMITIVE_TYPES, analyzeAndBuildRepairPrompt, applyPlayerSetting, canonicalNodeKind, classifyTechnology, compile, compilePlan, compressMarkdyToUrlHash, computeAdaptiveDimensions, damerauLevenshteinDistance, decompressMarkdyFromUrlHash, diagnoseMarkdyCode, diffDiagramASTs, extractDiagramContext, findClosestMatch, generateThemeFromBrand, getArchitectureSuggestions, getBoxPortPosition, getIntelliCodeCompletions, humanizeId, listOutputPresets, nodeRole, parse, parseAndCompile, predictNextLineSuggestion, repairMarkdyCode, resolveArchitectureConfig, resolveOutputPreset, resolvePlayer, resolveTheme, routeOrthogonalEdge, selectOptimalPorts, validateArchitecture };