@gmickel/gno 1.9.0 → 1.10.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 (36) hide show
  1. package/assets/skill/SKILL.md +28 -16
  2. package/assets/skill/cli-reference.md +30 -0
  3. package/assets/skill/examples.md +20 -0
  4. package/assets/skill/mcp-reference.md +7 -1
  5. package/package.json +1 -1
  6. package/src/cli/commands/graph.ts +89 -2
  7. package/src/cli/commands/links.ts +237 -54
  8. package/src/cli/commands/query.ts +212 -0
  9. package/src/cli/commands/ref-parser.ts +8 -103
  10. package/src/cli/options.ts +4 -0
  11. package/src/cli/program.ts +176 -9
  12. package/src/config/content-types.ts +14 -0
  13. package/src/core/graph-query.ts +137 -0
  14. package/src/core/graph-resolver.ts +117 -0
  15. package/src/core/ref-parser.ts +145 -0
  16. package/src/ingestion/frontmatter.ts +95 -2
  17. package/src/ingestion/sync.ts +281 -1
  18. package/src/mcp/tools/get.ts +1 -1
  19. package/src/mcp/tools/index.ts +89 -1
  20. package/src/mcp/tools/links.ts +83 -1
  21. package/src/mcp/tools/multi-get.ts +1 -1
  22. package/src/mcp/tools/query.ts +207 -0
  23. package/src/pipeline/diagnose.ts +302 -0
  24. package/src/pipeline/filters.ts +119 -0
  25. package/src/pipeline/hybrid.ts +90 -17
  26. package/src/pipeline/types.ts +32 -0
  27. package/src/publish/export-service.ts +1 -1
  28. package/src/sdk/documents.ts +2 -2
  29. package/src/serve/routes/api.ts +194 -0
  30. package/src/serve/routes/graph.ts +173 -1
  31. package/src/serve/server.ts +24 -1
  32. package/src/store/migrations/010-typed-edges.ts +67 -0
  33. package/src/store/migrations/011-doc-edge-traversal-indexes.ts +30 -0
  34. package/src/store/migrations/index.ts +4 -0
  35. package/src/store/sqlite/adapter.ts +826 -102
  36. package/src/store/types.ts +141 -0
@@ -108,6 +108,7 @@ export interface DocumentRow {
108
108
  converterVersion: string | null;
109
109
  languageHint: string | null;
110
110
  contentType?: string | null;
111
+ contentTypeSource?: string | null;
111
112
  categories?: string[] | null;
112
113
  author?: string | null;
113
114
  frontmatterDate?: string | null;
@@ -180,6 +181,19 @@ export type DocLinkSource = "parsed" | "user" | "suggested";
180
181
  /** Link type */
181
182
  export type DocLinkType = "wiki" | "markdown";
182
183
 
184
+ /** Semantic edge type / relationship name. Lowercase snake_case after validation. */
185
+ export type DocEdgeType = string;
186
+ export type RelationType = DocEdgeType;
187
+
188
+ /** Semantic edge confidence. Distinct from GraphEdgeConfidence. */
189
+ export type DocEdgeConfidence = "parsed" | "configured" | "manual" | "inferred";
190
+
191
+ /** Semantic edge source / provenance. */
192
+ export type DocEdgeSource =
193
+ | "wikilink"
194
+ | "markdown-link"
195
+ | "frontmatter-relation";
196
+
183
197
  /** Document link row from DB */
184
198
  export interface DocLinkRow {
185
199
  /** Raw path or wiki name (no anchor) */
@@ -206,6 +220,22 @@ export interface DocLinkRow {
206
220
  source: DocLinkSource;
207
221
  }
208
222
 
223
+ /** Semantic document edge row from DB. */
224
+ export interface DocEdgeRow {
225
+ sourceDocId: number;
226
+ sourceDocid: string;
227
+ sourceUri: string;
228
+ sourceTitle: string | null;
229
+ targetDocId: number;
230
+ targetDocid: string;
231
+ targetUri: string;
232
+ targetTitle: string | null;
233
+ edgeType: DocEdgeType;
234
+ relationType: RelationType;
235
+ confidence: DocEdgeConfidence;
236
+ edgeSource: DocEdgeSource;
237
+ }
238
+
209
239
  /** Backlink row from DB (document linking TO target) */
210
240
  export interface BacklinkRow {
211
241
  /** Source document internal ID */
@@ -238,6 +268,13 @@ export interface DocLinkInput {
238
268
  endCol: number;
239
269
  }
240
270
 
271
+ /** Input for setting semantic document edges for one source document. */
272
+ export interface DocEdgeInput {
273
+ targetDocId: number;
274
+ edgeType: DocEdgeType;
275
+ confidence: DocEdgeConfidence;
276
+ }
277
+
241
278
  // ─────────────────────────────────────────────────────────────────────────────
242
279
  // Input Types (for upsert operations)
243
280
  // ─────────────────────────────────────────────────────────────────────────────
@@ -258,6 +295,7 @@ export interface DocumentInput {
258
295
  converterVersion?: string;
259
296
  languageHint?: string;
260
297
  contentType?: string;
298
+ contentTypeSource?: string;
261
299
  categories?: string[];
262
300
  author?: string;
263
301
  frontmatterDate?: string;
@@ -462,6 +500,8 @@ export interface GraphNode {
462
500
  degree: number;
463
501
  /** Optional deterministic community id from graph analysis */
464
502
  communityId?: string;
503
+ /** Typed graph hints from the node's configured content type */
504
+ graphHints?: string[];
465
505
  }
466
506
 
467
507
  /** Compact graph report node summary */
@@ -619,6 +659,68 @@ export interface GetGraphOptions {
619
659
  similarTopK?: number;
620
660
  }
621
661
 
662
+ /** Direction for bounded typed-edge graph traversal. */
663
+ export type GraphQueryDirection = "out" | "in" | "both";
664
+
665
+ /** Node returned by graph query traversal. */
666
+ export interface GraphQueryNode {
667
+ id: string;
668
+ uri: string;
669
+ title: string | null;
670
+ collection: string;
671
+ relPath: string;
672
+ depth: number;
673
+ graphHints: string[];
674
+ }
675
+
676
+ /** Edge returned by graph query traversal. */
677
+ export interface GraphQueryEdge {
678
+ source: string;
679
+ target: string;
680
+ edgeType: DocEdgeType;
681
+ relationType: RelationType;
682
+ confidence: DocEdgeConfidence;
683
+ edgeSource: DocEdgeSource;
684
+ depth: number;
685
+ }
686
+
687
+ /** Options for bounded graph query traversal. */
688
+ export interface GraphQueryOptions {
689
+ direction?: GraphQueryDirection;
690
+ edgeType?: DocEdgeType;
691
+ maxDepth?: number;
692
+ maxNodes?: number;
693
+ frontierLimit?: number;
694
+ visitedLimit?: number;
695
+ }
696
+
697
+ /** Bounded graph query traversal result. */
698
+ export interface GraphQueryResult {
699
+ schemaVersion: "1.0";
700
+ root: GraphQueryNode;
701
+ nodes: GraphQueryNode[];
702
+ edges: GraphQueryEdge[];
703
+ meta: {
704
+ direction: GraphQueryDirection;
705
+ edgeType: DocEdgeType | null;
706
+ maxDepth: number;
707
+ maxNodes: number;
708
+ frontierLimit: number;
709
+ visitedLimit: number;
710
+ returnedNodes: number;
711
+ returnedEdges: number;
712
+ truncated: boolean;
713
+ warnings: string[];
714
+ };
715
+ }
716
+
717
+ export interface GraphQueryTraversalRows {
718
+ nodes: Array<{ doc: DocumentRow; depth: number }>;
719
+ edges: Array<{ edge: DocEdgeRow; depth: number }>;
720
+ truncated: boolean;
721
+ warnings: string[];
722
+ }
723
+
622
724
  // ─────────────────────────────────────────────────────────────────────────────
623
725
  // Migration Types
624
726
  // ─────────────────────────────────────────────────────────────────────────────
@@ -971,6 +1073,45 @@ export interface StorePort {
971
1073
  >
972
1074
  >;
973
1075
 
1076
+ /**
1077
+ * Set semantic edges for a document.
1078
+ * Replaces edges from the given source.
1079
+ */
1080
+ setDocEdges(
1081
+ documentId: number,
1082
+ edges: DocEdgeInput[],
1083
+ source: DocEdgeSource
1084
+ ): Promise<StoreResult<void>>;
1085
+
1086
+ /**
1087
+ * Get outgoing semantic edges for a document.
1088
+ */
1089
+ getEdgesForDoc(
1090
+ documentId: number,
1091
+ options?: { edgeType?: DocEdgeType }
1092
+ ): Promise<StoreResult<DocEdgeRow[]>>;
1093
+
1094
+ /**
1095
+ * Get semantic backlinks pointing to a document.
1096
+ */
1097
+ getEdgeBacklinksForDoc(
1098
+ documentId: number,
1099
+ options?: { collection?: string; edgeType?: DocEdgeType }
1100
+ ): Promise<StoreResult<DocEdgeRow[]>>;
1101
+
1102
+ /**
1103
+ * Bounded recursive traversal over typed document edges.
1104
+ */
1105
+ queryGraphTraversal(
1106
+ rootDocumentId: number,
1107
+ options?: GraphQueryOptions
1108
+ ): Promise<StoreResult<GraphQueryTraversalRows>>;
1109
+
1110
+ /**
1111
+ * Rebuild derived semantic edges from currently indexed links.
1112
+ */
1113
+ backfillDocEdges(): Promise<StoreResult<{ inserted: number }>>;
1114
+
974
1115
  // ─────────────────────────────────────────────────────────────────────────
975
1116
  // Graph
976
1117
  // ─────────────────────────────────────────────────────────────────────────