@gmickel/gno 1.8.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.
- package/README.md +6 -2
- package/assets/skill/SKILL.md +41 -16
- package/assets/skill/cli-reference.md +39 -0
- package/assets/skill/examples.md +41 -0
- package/assets/skill/mcp-reference.md +13 -1
- package/package.json +1 -1
- package/src/cli/commands/capture.ts +9 -6
- package/src/cli/commands/graph.ts +89 -2
- package/src/cli/commands/index-cmd.ts +17 -6
- package/src/cli/commands/links.ts +237 -54
- package/src/cli/commands/query.ts +212 -0
- package/src/cli/commands/ref-parser.ts +8 -103
- package/src/cli/commands/shared.ts +17 -1
- package/src/cli/commands/update.ts +17 -6
- package/src/cli/options.ts +4 -0
- package/src/cli/program.ts +176 -9
- package/src/config/content-types.ts +154 -0
- package/src/config/defaults.ts +1 -0
- package/src/config/index.ts +14 -0
- package/src/config/loader.ts +11 -2
- package/src/config/types.ts +37 -1
- package/src/core/config-mutation.ts +14 -2
- package/src/core/graph-query.ts +137 -0
- package/src/core/graph-resolver.ts +117 -0
- package/src/core/note-presets.ts +61 -5
- package/src/core/ref-parser.ts +145 -0
- package/src/ingestion/frontmatter.ts +170 -2
- package/src/ingestion/index.ts +2 -0
- package/src/ingestion/sync-options.ts +29 -0
- package/src/ingestion/sync.ts +385 -17
- package/src/ingestion/types.ts +14 -0
- package/src/mcp/tools/add-collection.ts +8 -5
- package/src/mcp/tools/capture.ts +5 -2
- package/src/mcp/tools/get.ts +1 -1
- package/src/mcp/tools/index-cmd.ts +13 -7
- package/src/mcp/tools/index.ts +97 -10
- package/src/mcp/tools/links.ts +83 -1
- package/src/mcp/tools/multi-get.ts +1 -1
- package/src/mcp/tools/query.ts +207 -0
- package/src/mcp/tools/sync.ts +12 -6
- package/src/mcp/tools/workspace-write.ts +16 -10
- package/src/pipeline/diagnose.ts +302 -0
- package/src/pipeline/filters.ts +119 -0
- package/src/pipeline/hybrid.ts +92 -17
- package/src/pipeline/search.ts +2 -0
- package/src/pipeline/types.ts +34 -0
- package/src/pipeline/vsearch.ts +4 -0
- package/src/publish/export-service.ts +1 -1
- package/src/sdk/client.ts +51 -24
- package/src/sdk/documents.ts +2 -2
- package/src/serve/background-runtime.ts +18 -4
- package/src/serve/config-sync.ts +9 -2
- package/src/serve/routes/api.ts +244 -24
- package/src/serve/routes/graph.ts +173 -1
- package/src/serve/server.ts +24 -1
- package/src/serve/watch-service.ts +12 -2
- package/src/store/migrations/009-content-type-rule-fingerprint.ts +36 -0
- package/src/store/migrations/010-typed-edges.ts +67 -0
- package/src/store/migrations/011-doc-edge-traversal-indexes.ts +30 -0
- package/src/store/migrations/index.ts +16 -1
- package/src/store/sqlite/adapter.ts +853 -114
- package/src/store/types.ts +147 -0
package/src/store/types.ts
CHANGED
|
@@ -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;
|
|
@@ -118,6 +119,8 @@ export interface DocumentRow {
|
|
|
118
119
|
active: boolean;
|
|
119
120
|
/** Ingest schema version for backfill detection */
|
|
120
121
|
ingestVersion: number | null;
|
|
122
|
+
/** Fingerprint of normalized content type rules used for derived metadata */
|
|
123
|
+
contentTypeRulesFingerprint?: string | null;
|
|
121
124
|
|
|
122
125
|
// Error tracking
|
|
123
126
|
lastErrorCode: string | null;
|
|
@@ -178,6 +181,19 @@ export type DocLinkSource = "parsed" | "user" | "suggested";
|
|
|
178
181
|
/** Link type */
|
|
179
182
|
export type DocLinkType = "wiki" | "markdown";
|
|
180
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
|
+
|
|
181
197
|
/** Document link row from DB */
|
|
182
198
|
export interface DocLinkRow {
|
|
183
199
|
/** Raw path or wiki name (no anchor) */
|
|
@@ -204,6 +220,22 @@ export interface DocLinkRow {
|
|
|
204
220
|
source: DocLinkSource;
|
|
205
221
|
}
|
|
206
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
|
+
|
|
207
239
|
/** Backlink row from DB (document linking TO target) */
|
|
208
240
|
export interface BacklinkRow {
|
|
209
241
|
/** Source document internal ID */
|
|
@@ -236,6 +268,13 @@ export interface DocLinkInput {
|
|
|
236
268
|
endCol: number;
|
|
237
269
|
}
|
|
238
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
|
+
|
|
239
278
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
240
279
|
// Input Types (for upsert operations)
|
|
241
280
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -256,6 +295,7 @@ export interface DocumentInput {
|
|
|
256
295
|
converterVersion?: string;
|
|
257
296
|
languageHint?: string;
|
|
258
297
|
contentType?: string;
|
|
298
|
+
contentTypeSource?: string;
|
|
259
299
|
categories?: string[];
|
|
260
300
|
author?: string;
|
|
261
301
|
frontmatterDate?: string;
|
|
@@ -264,6 +304,8 @@ export interface DocumentInput {
|
|
|
264
304
|
lastErrorMessage?: string;
|
|
265
305
|
/** Ingest schema version for backfill detection */
|
|
266
306
|
ingestVersion?: number;
|
|
307
|
+
/** Fingerprint of normalized content type rules used for derived metadata */
|
|
308
|
+
contentTypeRulesFingerprint?: string;
|
|
267
309
|
}
|
|
268
310
|
|
|
269
311
|
/** Result of upserting a document */
|
|
@@ -345,6 +387,8 @@ export interface FtsResult {
|
|
|
345
387
|
frontmatterDate?: string;
|
|
346
388
|
sourceSize?: number;
|
|
347
389
|
sourceHash?: string;
|
|
390
|
+
contentType?: string;
|
|
391
|
+
categories?: string[];
|
|
348
392
|
}
|
|
349
393
|
|
|
350
394
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -456,6 +500,8 @@ export interface GraphNode {
|
|
|
456
500
|
degree: number;
|
|
457
501
|
/** Optional deterministic community id from graph analysis */
|
|
458
502
|
communityId?: string;
|
|
503
|
+
/** Typed graph hints from the node's configured content type */
|
|
504
|
+
graphHints?: string[];
|
|
459
505
|
}
|
|
460
506
|
|
|
461
507
|
/** Compact graph report node summary */
|
|
@@ -613,6 +659,68 @@ export interface GetGraphOptions {
|
|
|
613
659
|
similarTopK?: number;
|
|
614
660
|
}
|
|
615
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
|
+
|
|
616
724
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
617
725
|
// Migration Types
|
|
618
726
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -965,6 +1073,45 @@ export interface StorePort {
|
|
|
965
1073
|
>
|
|
966
1074
|
>;
|
|
967
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
|
+
|
|
968
1115
|
// ─────────────────────────────────────────────────────────────────────────
|
|
969
1116
|
// Graph
|
|
970
1117
|
// ─────────────────────────────────────────────────────────────────────────
|