@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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration: typed semantic document edges.
|
|
3
|
+
*
|
|
4
|
+
* @module src/store/migrations/010-typed-edges
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Database } from "bun:sqlite";
|
|
8
|
+
|
|
9
|
+
import type { Migration } from "./runner";
|
|
10
|
+
|
|
11
|
+
const TABLE_INFO_DOCUMENTS = "PRAGMA table_info(documents)";
|
|
12
|
+
|
|
13
|
+
interface TableInfoRow {
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getDocumentColumns(db: Database): Set<string> {
|
|
18
|
+
const rows = db.query<TableInfoRow, []>(TABLE_INFO_DOCUMENTS).all();
|
|
19
|
+
return new Set(rows.map((row) => row.name));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const migration: Migration = {
|
|
23
|
+
version: 10,
|
|
24
|
+
name: "typed_edges",
|
|
25
|
+
|
|
26
|
+
up(db: Database): void {
|
|
27
|
+
const columns = getDocumentColumns(db);
|
|
28
|
+
if (!columns.has("content_type_source")) {
|
|
29
|
+
db.exec("ALTER TABLE documents ADD COLUMN content_type_source TEXT");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
db.exec(`
|
|
33
|
+
CREATE TABLE IF NOT EXISTS doc_edges (
|
|
34
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
35
|
+
src_doc_id INTEGER NOT NULL,
|
|
36
|
+
dst_doc_id INTEGER NOT NULL,
|
|
37
|
+
edge_type TEXT NOT NULL,
|
|
38
|
+
confidence TEXT NOT NULL CHECK (confidence IN ('parsed', 'configured', 'manual', 'inferred')),
|
|
39
|
+
source TEXT NOT NULL CHECK (source IN ('wikilink', 'markdown-link', 'frontmatter-relation')),
|
|
40
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
41
|
+
UNIQUE(src_doc_id, dst_doc_id, edge_type, source),
|
|
42
|
+
FOREIGN KEY (src_doc_id) REFERENCES documents(id) ON DELETE CASCADE,
|
|
43
|
+
FOREIGN KEY (dst_doc_id) REFERENCES documents(id) ON DELETE CASCADE
|
|
44
|
+
)
|
|
45
|
+
`);
|
|
46
|
+
|
|
47
|
+
db.exec(`
|
|
48
|
+
CREATE INDEX IF NOT EXISTS idx_doc_edges_src_type
|
|
49
|
+
ON doc_edges(src_doc_id, edge_type)
|
|
50
|
+
`);
|
|
51
|
+
db.exec(`
|
|
52
|
+
CREATE INDEX IF NOT EXISTS idx_doc_edges_dst_type
|
|
53
|
+
ON doc_edges(dst_doc_id, edge_type)
|
|
54
|
+
`);
|
|
55
|
+
db.exec(`
|
|
56
|
+
CREATE INDEX IF NOT EXISTS idx_documents_content_type_source
|
|
57
|
+
ON documents(content_type_source)
|
|
58
|
+
`);
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
down(db: Database): void {
|
|
62
|
+
db.exec("DROP INDEX IF EXISTS idx_documents_content_type_source");
|
|
63
|
+
db.exec("DROP INDEX IF EXISTS idx_doc_edges_dst_type");
|
|
64
|
+
db.exec("DROP INDEX IF EXISTS idx_doc_edges_src_type");
|
|
65
|
+
// Keep table/column on rollback; SQLite column drop requires rebuild.
|
|
66
|
+
},
|
|
67
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration: covering indexes for bounded typed-edge traversal.
|
|
3
|
+
*
|
|
4
|
+
* @module src/store/migrations/011-doc-edge-traversal-indexes
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Database } from "bun:sqlite";
|
|
8
|
+
|
|
9
|
+
import type { Migration } from "./runner";
|
|
10
|
+
|
|
11
|
+
export const migration: Migration = {
|
|
12
|
+
version: 11,
|
|
13
|
+
name: "doc_edge_traversal_indexes",
|
|
14
|
+
|
|
15
|
+
up(db: Database): void {
|
|
16
|
+
db.exec(`
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_doc_edges_src_type_dst_id
|
|
18
|
+
ON doc_edges(src_doc_id, edge_type, dst_doc_id, id)
|
|
19
|
+
`);
|
|
20
|
+
db.exec(`
|
|
21
|
+
CREATE INDEX IF NOT EXISTS idx_doc_edges_dst_type_src_id
|
|
22
|
+
ON doc_edges(dst_doc_id, edge_type, src_doc_id, id)
|
|
23
|
+
`);
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
down(db: Database): void {
|
|
27
|
+
db.exec("DROP INDEX IF EXISTS idx_doc_edges_dst_type_src_id");
|
|
28
|
+
db.exec("DROP INDEX IF EXISTS idx_doc_edges_src_type_dst_id");
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -22,6 +22,21 @@ import { migration as m005 } from "./005-graph-indexes";
|
|
|
22
22
|
import { migration as m006 } from "./006-document-metadata";
|
|
23
23
|
import { migration as m007 } from "./007-document-date-fields";
|
|
24
24
|
import { migration as m008 } from "./008-vector-fingerprints";
|
|
25
|
+
import { migration as m009 } from "./009-content-type-rule-fingerprint";
|
|
26
|
+
import { migration as m010 } from "./010-typed-edges";
|
|
27
|
+
import { migration as m011 } from "./011-doc-edge-traversal-indexes";
|
|
25
28
|
|
|
26
29
|
/** All migrations in order */
|
|
27
|
-
export const migrations = [
|
|
30
|
+
export const migrations = [
|
|
31
|
+
m001,
|
|
32
|
+
m002,
|
|
33
|
+
m003,
|
|
34
|
+
m004,
|
|
35
|
+
m005,
|
|
36
|
+
m006,
|
|
37
|
+
m007,
|
|
38
|
+
m008,
|
|
39
|
+
m009,
|
|
40
|
+
m010,
|
|
41
|
+
m011,
|
|
42
|
+
];
|