@huanlin/dsh-plugin-codegraph-sqlite 0.1.8
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/LICENSE +21 -0
- package/README.md +17 -0
- package/lib/database.d.ts +75 -0
- package/lib/database.js +180 -0
- package/lib/index.d.ts +66 -0
- package/lib/index.js +119 -0
- package/lib/invariant.d.ts +16 -0
- package/lib/invariant.js +23 -0
- package/lib/queries.d.ts +66 -0
- package/lib/queries.js +302 -0
- package/lib/rows.d.ts +31 -0
- package/lib/rows.js +174 -0
- package/lib/sql.d.ts +37 -0
- package/lib/sql.js +116 -0
- package/lib/traverse.d.ts +73 -0
- package/lib/traverse.js +0 -0
- package/package.json +57 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph walks over the `edges` table: the reverse reachability that answers `impact` and the
|
|
3
|
+
* shortest-path enumeration that answers `trace`.
|
|
4
|
+
*
|
|
5
|
+
* Both walks are breadth-first and bounded by a visit budget, because a request's `depth`, `limit`,
|
|
6
|
+
* and `maxPaths` bound the ANSWER while the graph decides the WORK — an unbounded walk on a large
|
|
7
|
+
* monorepo would run long before it had anything to truncate.
|
|
8
|
+
* @module dsh-plugin-codegraph-sqlite/traverse
|
|
9
|
+
*/
|
|
10
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
11
|
+
import type { CodegraphNodeId } from '@huanlin/dsh-plugin-codegraph-service';
|
|
12
|
+
/** One traversal step: the node reached and the edge that reached it. */
|
|
13
|
+
export interface Step {
|
|
14
|
+
/** The node this step reaches. */
|
|
15
|
+
readonly node: CodegraphNodeId;
|
|
16
|
+
/** The edge traversed, as its endpoint ids, kind, and site. */
|
|
17
|
+
readonly edge: {
|
|
18
|
+
readonly source: CodegraphNodeId;
|
|
19
|
+
readonly target: CodegraphNodeId;
|
|
20
|
+
readonly kind: string;
|
|
21
|
+
readonly line?: number;
|
|
22
|
+
readonly column?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** One node reached by {@link walkImpact}, with how far and by what relationship. */
|
|
26
|
+
export interface ImpactHit {
|
|
27
|
+
/** The affected node. */
|
|
28
|
+
readonly node: CodegraphNodeId;
|
|
29
|
+
/** Hops from the origin; `1` is a direct dependent. */
|
|
30
|
+
readonly distance: number;
|
|
31
|
+
/** The relationship kind on the shortest walk that reached it. */
|
|
32
|
+
readonly via: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The reverse-reachability walk as `impact` receives it. Injected rather than called directly so the
|
|
36
|
+
* traversal budget stays with the plugin that configures it.
|
|
37
|
+
*/
|
|
38
|
+
export type ImpactWalk = (origin: CodegraphNodeId, depth: number) => {
|
|
39
|
+
hits: ImpactHit[];
|
|
40
|
+
exhausted: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** The shortest-path sweep as `trace` receives it, injected for the same reason. */
|
|
43
|
+
export type TraceWalk = (from: CodegraphNodeId, to: CodegraphNodeId, maxDepth: number, maxPaths: number) => Step[][];
|
|
44
|
+
/**
|
|
45
|
+
* Everything that transitively depends on one node, nearest first.
|
|
46
|
+
* @param db - the open graph connection.
|
|
47
|
+
* @param origin - the node being changed.
|
|
48
|
+
* @param depth - largest number of hops to walk.
|
|
49
|
+
* @param budget - largest number of distinct nodes to visit before stopping the walk.
|
|
50
|
+
* @returns the affected nodes in nondecreasing distance order, and whether the budget stopped the
|
|
51
|
+
* walk before it ran out of graph.
|
|
52
|
+
*/
|
|
53
|
+
export declare function walkImpact(db: DatabaseSync, origin: CodegraphNodeId, depth: number, budget: number): {
|
|
54
|
+
hits: ImpactHit[];
|
|
55
|
+
exhausted: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Shortest directed paths between two nodes.
|
|
59
|
+
*
|
|
60
|
+
* Only shortest paths are returned: the breadth-first sweep records, for each node, the edges that
|
|
61
|
+
* first reached it, so backtracking from the destination enumerates every route of that minimum
|
|
62
|
+
* length and no longer detour. A longer path that avoids a shared intermediate hop is not reported.
|
|
63
|
+
* @param db - the open graph connection.
|
|
64
|
+
* @param from - the origin node.
|
|
65
|
+
* @param to - the destination node.
|
|
66
|
+
* @param maxDepth - largest number of hops a returned path may contain.
|
|
67
|
+
* @param maxPaths - largest number of paths to enumerate.
|
|
68
|
+
* @param budget - largest number of distinct nodes to visit before stopping the sweep.
|
|
69
|
+
* @returns each path as its ordered steps, shortest first; empty when no path exists within the
|
|
70
|
+
* depth and budget.
|
|
71
|
+
*/
|
|
72
|
+
export declare function walkTrace(db: DatabaseSync, from: CodegraphNodeId, to: CodegraphNodeId, maxDepth: number, maxPaths: number, budget: number): Step[][];
|
|
73
|
+
//# sourceMappingURL=traverse.d.ts.map
|
package/lib/traverse.js
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@huanlin/dsh-plugin-codegraph-sqlite",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "Read-only SQLite store for the DeepSeek Harness code-graph seam — serves structural queries from the schema-v4 graph at .codegraph/codegraph.db, the same on-disk format the codegraph CLI writes",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dsh",
|
|
7
|
+
"dsh-plugin",
|
|
8
|
+
"deepseek-harness",
|
|
9
|
+
"cordis",
|
|
10
|
+
"cordis-plugin",
|
|
11
|
+
"codegraph",
|
|
12
|
+
"code-graph",
|
|
13
|
+
"sqlite",
|
|
14
|
+
"code-intelligence",
|
|
15
|
+
"ai-agent"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "CC ZHAO",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/HuanLinOTO/dsh-plugin-codegraph.git",
|
|
22
|
+
"directory": "packages/sqlite"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/HuanLinOTO/dsh-plugin-codegraph#readme",
|
|
25
|
+
"bugs": "https://github.com/HuanLinOTO/dsh-plugin-codegraph/issues",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "lib/index.js",
|
|
28
|
+
"types": "lib/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./lib/index.d.ts",
|
|
32
|
+
"default": "./lib/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"lib/**/*.js",
|
|
38
|
+
"lib/**/*.d.ts"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
45
|
+
"@huanlin/dsh-plugin-codegraph-service": "^0.1.8"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@deepseek-ai/cordis": ">=4.0.1",
|
|
49
|
+
"@deepseek-ai/dsh-llm": ">=0.1.2-rc.1",
|
|
50
|
+
"@deepseek-ai/dsh-util-values": ">=0.1.2-rc.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
54
|
+
"@deepseek-ai/dsh-llm": "0.1.2-rc.1",
|
|
55
|
+
"@deepseek-ai/dsh-util-values": "0.1.2-rc.1"
|
|
56
|
+
}
|
|
57
|
+
}
|