@thoughtflow/codebase 0.2.0 → 0.3.1
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/package.json +4 -3
- package/tsconfig.json +13 -2
- package/dist/contexts/context-decomposer.d.ts +0 -13
- package/dist/contexts/context-decomposer.d.ts.map +0 -1
- package/dist/contexts/context-decomposer.js +0 -97
- package/dist/contexts/context-decomposer.js.map +0 -1
- package/dist/contexts/context-document-manager.d.ts +0 -21
- package/dist/contexts/context-document-manager.d.ts.map +0 -1
- package/dist/contexts/context-document-manager.js +0 -69
- package/dist/contexts/context-document-manager.js.map +0 -1
- package/dist/contexts/context-router.d.ts +0 -13
- package/dist/contexts/context-router.d.ts.map +0 -1
- package/dist/contexts/context-router.js +0 -94
- package/dist/contexts/context-router.js.map +0 -1
- package/dist/index.d.ts +0 -53
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -76
- package/dist/index.js.map +0 -1
- package/dist/libs/codebase/deep-analyzer.d.ts +0 -58
- package/dist/libs/codebase/deep-analyzer.d.ts.map +0 -1
- package/dist/libs/codebase/deep-analyzer.js +0 -239
- package/dist/libs/codebase/deep-analyzer.js.map +0 -1
- package/dist/libs/codebase/graph/dependency-extractor.d.ts +0 -20
- package/dist/libs/codebase/graph/dependency-extractor.d.ts.map +0 -1
- package/dist/libs/codebase/graph/dependency-extractor.js +0 -174
- package/dist/libs/codebase/graph/dependency-extractor.js.map +0 -1
- package/dist/libs/codebase/graph/graph-analysis.d.ts +0 -42
- package/dist/libs/codebase/graph/graph-analysis.d.ts.map +0 -1
- package/dist/libs/codebase/graph/graph-analysis.js +0 -222
- package/dist/libs/codebase/graph/graph-analysis.js.map +0 -1
- package/dist/libs/codebase/graph/graph-visualizer.d.ts +0 -12
- package/dist/libs/codebase/graph/graph-visualizer.d.ts.map +0 -1
- package/dist/libs/codebase/graph/graph-visualizer.js +0 -99
- package/dist/libs/codebase/graph/graph-visualizer.js.map +0 -1
- package/dist/libs/codebase/indexer/batch-processor.d.ts +0 -18
- package/dist/libs/codebase/indexer/batch-processor.d.ts.map +0 -1
- package/dist/libs/codebase/indexer/batch-processor.js +0 -39
- package/dist/libs/codebase/indexer/batch-processor.js.map +0 -1
- package/dist/libs/codebase/indexer/chunker-markdown.d.ts +0 -19
- package/dist/libs/codebase/indexer/chunker-markdown.d.ts.map +0 -1
- package/dist/libs/codebase/indexer/chunker-markdown.js +0 -138
- package/dist/libs/codebase/indexer/chunker-markdown.js.map +0 -1
- package/dist/libs/codebase/indexer/chunker.d.ts +0 -21
- package/dist/libs/codebase/indexer/chunker.d.ts.map +0 -1
- package/dist/libs/codebase/indexer/chunker.js +0 -133
- package/dist/libs/codebase/indexer/chunker.js.map +0 -1
- package/dist/libs/codebase/indexer/explorer.d.ts +0 -29
- package/dist/libs/codebase/indexer/explorer.d.ts.map +0 -1
- package/dist/libs/codebase/indexer/explorer.js +0 -278
- package/dist/libs/codebase/indexer/explorer.js.map +0 -1
- package/dist/libs/codebase/indexer/indexer.d.ts +0 -35
- package/dist/libs/codebase/indexer/indexer.d.ts.map +0 -1
- package/dist/libs/codebase/indexer/indexer.js +0 -172
- package/dist/libs/codebase/indexer/indexer.js.map +0 -1
- package/dist/libs/codebase/knowledge/cross-referencer.d.ts +0 -32
- package/dist/libs/codebase/knowledge/cross-referencer.d.ts.map +0 -1
- package/dist/libs/codebase/knowledge/cross-referencer.js +0 -132
- package/dist/libs/codebase/knowledge/cross-referencer.js.map +0 -1
- package/dist/libs/codebase/knowledge/markdown-extractor.d.ts +0 -34
- package/dist/libs/codebase/knowledge/markdown-extractor.d.ts.map +0 -1
- package/dist/libs/codebase/knowledge/markdown-extractor.js +0 -273
- package/dist/libs/codebase/knowledge/markdown-extractor.js.map +0 -1
- package/dist/libs/codebase/knowledge/summarizer.d.ts +0 -25
- package/dist/libs/codebase/knowledge/summarizer.d.ts.map +0 -1
- package/dist/libs/codebase/knowledge/summarizer.js +0 -61
- package/dist/libs/codebase/knowledge/summarizer.js.map +0 -1
- package/dist/libs/codebase/search/bm25.d.ts +0 -23
- package/dist/libs/codebase/search/bm25.d.ts.map +0 -1
- package/dist/libs/codebase/search/bm25.js +0 -93
- package/dist/libs/codebase/search/bm25.js.map +0 -1
- package/dist/libs/codebase/search/hybrid-search.d.ts +0 -22
- package/dist/libs/codebase/search/hybrid-search.d.ts.map +0 -1
- package/dist/libs/codebase/search/hybrid-search.js +0 -80
- package/dist/libs/codebase/search/hybrid-search.js.map +0 -1
- package/dist/libs/codebase-index.class.d.ts +0 -66
- package/dist/libs/codebase-index.class.d.ts.map +0 -1
- package/dist/libs/codebase-index.class.js +0 -595
- package/dist/libs/codebase-index.class.js.map +0 -1
- package/dist/tools/codebase/codebase-analyze.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-analyze.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-analyze.tool.js +0 -20
- package/dist/tools/codebase/codebase-analyze.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-crossref.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-crossref.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-crossref.tool.js +0 -20
- package/dist/tools/codebase/codebase-crossref.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-flow.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-flow.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-flow.tool.js +0 -20
- package/dist/tools/codebase/codebase-flow.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-graph-circular.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-graph-circular.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-graph-circular.tool.js +0 -17
- package/dist/tools/codebase/codebase-graph-circular.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-graph-query.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-graph-query.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-graph-query.tool.js +0 -21
- package/dist/tools/codebase/codebase-graph-query.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-graph-stats.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-graph-stats.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-graph-stats.tool.js +0 -17
- package/dist/tools/codebase/codebase-graph-stats.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-graph-visualize.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-graph-visualize.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-graph-visualize.tool.js +0 -21
- package/dist/tools/codebase/codebase-graph-visualize.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-impact.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-impact.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-impact.tool.js +0 -21
- package/dist/tools/codebase/codebase-impact.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-index.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-index.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-index.tool.js +0 -21
- package/dist/tools/codebase/codebase-index.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-knowledge.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-knowledge.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-knowledge.tool.js +0 -22
- package/dist/tools/codebase/codebase-knowledge.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-search.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-search.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-search.tool.js +0 -24
- package/dist/tools/codebase/codebase-search.tool.js.map +0 -1
- package/dist/tools/codebase/codebase-status.tool.d.ts +0 -8
- package/dist/tools/codebase/codebase-status.tool.d.ts.map +0 -1
- package/dist/tools/codebase/codebase-status.tool.js +0 -19
- package/dist/tools/codebase/codebase-status.tool.js.map +0 -1
- package/dist/tools/neural/comparative-analysis.tool.d.ts +0 -37
- package/dist/tools/neural/comparative-analysis.tool.d.ts.map +0 -1
- package/dist/tools/neural/comparative-analysis.tool.js +0 -241
- package/dist/tools/neural/comparative-analysis.tool.js.map +0 -1
- package/dist/tools/neural/index.d.ts +0 -12
- package/dist/tools/neural/index.d.ts.map +0 -1
- package/dist/tools/neural/index.js +0 -28
- package/dist/tools/neural/index.js.map +0 -1
- package/dist/tools/neural/neural-deadcode.tool.d.ts +0 -10
- package/dist/tools/neural/neural-deadcode.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-deadcode.tool.js +0 -133
- package/dist/tools/neural/neural-deadcode.tool.js.map +0 -1
- package/dist/tools/neural/neural-debug.tool.d.ts +0 -11
- package/dist/tools/neural/neural-debug.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-debug.tool.js +0 -205
- package/dist/tools/neural/neural-debug.tool.js.map +0 -1
- package/dist/tools/neural/neural-explain.tool.d.ts +0 -9
- package/dist/tools/neural/neural-explain.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-explain.tool.js +0 -100
- package/dist/tools/neural/neural-explain.tool.js.map +0 -1
- package/dist/tools/neural/neural-optimize.tool.d.ts +0 -9
- package/dist/tools/neural/neural-optimize.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-optimize.tool.js +0 -117
- package/dist/tools/neural/neural-optimize.tool.js.map +0 -1
- package/dist/tools/neural/neural-pattern.tool.d.ts +0 -10
- package/dist/tools/neural/neural-pattern.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-pattern.tool.js +0 -169
- package/dist/tools/neural/neural-pattern.tool.js.map +0 -1
- package/dist/tools/neural/neural-review.tool.d.ts +0 -11
- package/dist/tools/neural/neural-review.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-review.tool.js +0 -152
- package/dist/tools/neural/neural-review.tool.js.map +0 -1
- package/dist/tools/neural/neural-security.tool.d.ts +0 -16
- package/dist/tools/neural/neural-security.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-security.tool.js +0 -256
- package/dist/tools/neural/neural-security.tool.js.map +0 -1
- package/dist/tools/neural/neural-similar.tool.d.ts +0 -9
- package/dist/tools/neural/neural-similar.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-similar.tool.js +0 -139
- package/dist/tools/neural/neural-similar.tool.js.map +0 -1
- package/dist/tools/neural/neural-smells.tool.d.ts +0 -9
- package/dist/tools/neural/neural-smells.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-smells.tool.js +0 -123
- package/dist/tools/neural/neural-smells.tool.js.map +0 -1
- package/dist/tools/neural/neural-suggest.tool.d.ts +0 -9
- package/dist/tools/neural/neural-suggest.tool.d.ts.map +0 -1
- package/dist/tools/neural/neural-suggest.tool.js +0 -64
- package/dist/tools/neural/neural-suggest.tool.js.map +0 -1
- package/dist/tools/quality/index.d.ts +0 -8
- package/dist/tools/quality/index.d.ts.map +0 -1
- package/dist/tools/quality/index.js +0 -24
- package/dist/tools/quality/index.js.map +0 -1
- package/dist/tools/quality/quality-complexity.tool.d.ts +0 -11
- package/dist/tools/quality/quality-complexity.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-complexity.tool.js +0 -152
- package/dist/tools/quality/quality-complexity.tool.js.map +0 -1
- package/dist/tools/quality/quality-coupling.tool.d.ts +0 -9
- package/dist/tools/quality/quality-coupling.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-coupling.tool.js +0 -51
- package/dist/tools/quality/quality-coupling.tool.js.map +0 -1
- package/dist/tools/quality/quality-coverage.tool.d.ts +0 -9
- package/dist/tools/quality/quality-coverage.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-coverage.tool.js +0 -104
- package/dist/tools/quality/quality-coverage.tool.js.map +0 -1
- package/dist/tools/quality/quality-deps.tool.d.ts +0 -11
- package/dist/tools/quality/quality-deps.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-deps.tool.js +0 -119
- package/dist/tools/quality/quality-deps.tool.js.map +0 -1
- package/dist/tools/quality/quality-duplication.tool.d.ts +0 -9
- package/dist/tools/quality/quality-duplication.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-duplication.tool.js +0 -100
- package/dist/tools/quality/quality-duplication.tool.js.map +0 -1
- package/dist/tools/quality/quality-size.tool.d.ts +0 -9
- package/dist/tools/quality/quality-size.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-size.tool.js +0 -94
- package/dist/tools/quality/quality-size.tool.js.map +0 -1
- package/dist/tools/quality/quality-types.tool.d.ts +0 -9
- package/dist/tools/quality/quality-types.tool.d.ts.map +0 -1
- package/dist/tools/quality/quality-types.tool.js +0 -95
- package/dist/tools/quality/quality-types.tool.js.map +0 -1
- package/dist/tools/workspace/analyze-project.tool.d.ts +0 -36
- package/dist/tools/workspace/analyze-project.tool.d.ts.map +0 -1
- package/dist/tools/workspace/analyze-project.tool.js +0 -454
- package/dist/tools/workspace/analyze-project.tool.js.map +0 -1
- package/dist/tools/workspace/codebase-research.tool.d.ts +0 -10
- package/dist/tools/workspace/codebase-research.tool.d.ts.map +0 -1
- package/dist/tools/workspace/codebase-research.tool.js +0 -89
- package/dist/tools/workspace/codebase-research.tool.js.map +0 -1
- package/dist/tools/workspace/project-scanner.tool.d.ts +0 -55
- package/dist/tools/workspace/project-scanner.tool.d.ts.map +0 -1
- package/dist/tools/workspace/project-scanner.tool.js +0 -978
- package/dist/tools/workspace/project-scanner.tool.js.map +0 -1
- package/dist/tools/workspace/search-code.tool.d.ts +0 -14
- package/dist/tools/workspace/search-code.tool.d.ts.map +0 -1
- package/dist/tools/workspace/search-code.tool.js +0 -286
- package/dist/tools/workspace/search-code.tool.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thoughtflow/codebase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc -p tsconfig.build.json"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@thoughtflow/core": "
|
|
10
|
+
"@thoughtflow/core": "*",
|
|
11
11
|
"@ast-grep/napi": "^0.42.1",
|
|
12
|
-
"better-sqlite3": "^11.10.0"
|
|
12
|
+
"better-sqlite3": "^11.10.0",
|
|
13
|
+
"zod": "^3.24.3"
|
|
13
14
|
},
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"@types/better-sqlite3": "^7.6.13"
|
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../core/tsconfig.json",
|
|
3
2
|
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
4
11
|
"outDir": "dist",
|
|
5
|
-
"
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"paths": {
|
|
14
|
+
"@thoughtflow/core": ["../core/src"]
|
|
15
|
+
},
|
|
16
|
+
"types": ["node"]
|
|
6
17
|
},
|
|
7
18
|
"include": ["src/**/*.ts"],
|
|
8
19
|
"exclude": ["dist", "node_modules"]
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { LlmAdapter, ContextDocument, DecompositionResult, ConversationTool } from "@thoughtflow/core";
|
|
2
|
-
export declare class ContextDecomposer {
|
|
3
|
-
private readonly adapter;
|
|
4
|
-
private readonly model;
|
|
5
|
-
constructor(adapter: LlmAdapter, model: string);
|
|
6
|
-
/**
|
|
7
|
-
* Decompose documents and tools using an LLM.
|
|
8
|
-
* Only decomposes the given docs (typically only changed ones).
|
|
9
|
-
* Tool analysis happens on every call for freshness.
|
|
10
|
-
*/
|
|
11
|
-
decompose(docs: ContextDocument[], tools: ConversationTool[]): Promise<DecompositionResult>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=context-decomposer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-decomposer.d.ts","sourceRoot":"","sources":["../../src/contexts/context-decomposer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAwC,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAoDjJ,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,MAAM;IAGhC;;;;OAIG;IACG,SAAS,CACb,IAAI,EAAE,eAAe,EAAE,EACvB,KAAK,EAAE,gBAAgB,EAAE,GACxB,OAAO,CAAC,mBAAmB,CAAC;CA4ChC"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextDecomposer = void 0;
|
|
4
|
-
const crypto_1 = require("crypto");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const core_1 = require("@thoughtflow/core");
|
|
7
|
-
const DecompositionSchema = zod_1.z.object({
|
|
8
|
-
documents: zod_1.z.array(zod_1.z.object({
|
|
9
|
-
name: zod_1.z.string(),
|
|
10
|
-
summary: zod_1.z.string(),
|
|
11
|
-
keywords: zod_1.z.array(zod_1.z.string()),
|
|
12
|
-
category: zod_1.z.enum(["architecture", "security", "domain", "conventions", "data", "other"])
|
|
13
|
-
})),
|
|
14
|
-
tools: zod_1.z.array(zod_1.z.object({
|
|
15
|
-
name: zod_1.z.string(),
|
|
16
|
-
description: zod_1.z.string(),
|
|
17
|
-
category: zod_1.z.string(),
|
|
18
|
-
keywords: zod_1.z.array(zod_1.z.string())
|
|
19
|
-
}))
|
|
20
|
-
});
|
|
21
|
-
const SYSTEM_PROMPT = "You are a document and tool analyzer. Your job is to produce concise structured metadata about documents and tools.";
|
|
22
|
-
function buildUserPrompt(docs, tools) {
|
|
23
|
-
const parts = [];
|
|
24
|
-
if (docs.length > 0) {
|
|
25
|
-
parts.push("Documents:");
|
|
26
|
-
for (const doc of docs) {
|
|
27
|
-
parts.push(`- Name: ${doc.name}`);
|
|
28
|
-
parts.push(` Content: ${doc.content}`);
|
|
29
|
-
parts.push('');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
parts.push("No documents to analyze.");
|
|
34
|
-
parts.push('');
|
|
35
|
-
}
|
|
36
|
-
if (tools.length > 0) {
|
|
37
|
-
parts.push("Tools:");
|
|
38
|
-
for (const tool of tools) {
|
|
39
|
-
parts.push(`- Name: ${tool.name}`);
|
|
40
|
-
parts.push(` Description: ${tool.description}`);
|
|
41
|
-
parts.push('');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
parts.push("No tools to analyze.");
|
|
46
|
-
parts.push('');
|
|
47
|
-
}
|
|
48
|
-
return parts.join('\n');
|
|
49
|
-
}
|
|
50
|
-
class ContextDecomposer {
|
|
51
|
-
adapter;
|
|
52
|
-
model;
|
|
53
|
-
constructor(adapter, model) {
|
|
54
|
-
this.adapter = adapter;
|
|
55
|
-
this.model = model;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Decompose documents and tools using an LLM.
|
|
59
|
-
* Only decomposes the given docs (typically only changed ones).
|
|
60
|
-
* Tool analysis happens on every call for freshness.
|
|
61
|
-
*/
|
|
62
|
-
async decompose(docs, tools) {
|
|
63
|
-
try {
|
|
64
|
-
const userPrompt = buildUserPrompt(docs, tools);
|
|
65
|
-
const { result } = await (0, core_1.callStructured)(this.adapter, this.model, SYSTEM_PROMPT, userPrompt, DecompositionSchema);
|
|
66
|
-
const documents = result.documents.map(d => ({
|
|
67
|
-
name: d.name,
|
|
68
|
-
checksum: (0, crypto_1.createHash)('md5').update(docs.find(doc => doc.name === d.name)?.content ?? '').digest('hex'),
|
|
69
|
-
summary: d.summary,
|
|
70
|
-
keywords: d.keywords,
|
|
71
|
-
category: d.category,
|
|
72
|
-
decomposedAt: Date.now()
|
|
73
|
-
}));
|
|
74
|
-
const toolCapabilities = result.tools.map(t => ({
|
|
75
|
-
name: t.name,
|
|
76
|
-
description: t.description,
|
|
77
|
-
category: t.category,
|
|
78
|
-
keywords: t.keywords
|
|
79
|
-
}));
|
|
80
|
-
return {
|
|
81
|
-
documents,
|
|
82
|
-
tools: toolCapabilities,
|
|
83
|
-
generatedAt: Date.now()
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
console.warn('ContextDecomposer.decompose failed:', err);
|
|
88
|
-
return {
|
|
89
|
-
documents: [],
|
|
90
|
-
tools: [],
|
|
91
|
-
generatedAt: Date.now()
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.ContextDecomposer = ContextDecomposer;
|
|
97
|
-
//# sourceMappingURL=context-decomposer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-decomposer.js","sourceRoot":"","sources":["../../src/contexts/context-decomposer.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,6BAAuB;AAEvB,4CAAkD;AAElD,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC;QAC1B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;QACnB,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;QAC7B,QAAQ,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;KACzF,CAAC,CAA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AqB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAChE,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;aACrB,CAAC,CAAC,CAAA;YAEH,OAAO;gBACL,SAAS;gBACT,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;aACxB,CAAA;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAA;YACxD,OAAO;gBACL,SAAS,EAAE,EAAE;gBACb,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;aACxB,CAAA;QACH,CAAC;IACH,CAAC;CACF;AA1DD,8CA0DC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ContextDocument, ContextDocumentCache } from "@thoughtflow/core";
|
|
2
|
-
export declare class ContextDocumentManager {
|
|
3
|
-
private readonly docs;
|
|
4
|
-
private readonly cacheDir;
|
|
5
|
-
/**
|
|
6
|
-
* @param docs Map of document name → content (user-provided)
|
|
7
|
-
* @param cacheDir Path to cache file (e.g. ".thoughtflow/context-cache.json")
|
|
8
|
-
*/
|
|
9
|
-
constructor(docs: Record<string, string>, cacheDir: string);
|
|
10
|
-
/** Load cached decomposition results from disk. Returns empty array if no cache exists. */
|
|
11
|
-
loadCache(): ContextDocumentCache[];
|
|
12
|
-
/** Compute MD5 checksum for each document. Returns Map<docName, checksumHex>. */
|
|
13
|
-
computeChecksums(): Map<string, string>;
|
|
14
|
-
/** Return documents whose checksum differs from the cache (or are new). */
|
|
15
|
-
getChangedDocs(): ContextDocument[];
|
|
16
|
-
/** Persist the given cache entries to disk as JSON. */
|
|
17
|
-
saveCache(caches: ContextDocumentCache[]): void;
|
|
18
|
-
/** Return all documents as ContextDocument[] (the raw input map). */
|
|
19
|
-
getAllDocs(): ContextDocument[];
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=context-document-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-document-manager.d.ts","sourceRoot":"","sources":["../../src/contexts/context-document-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE9E,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IAEjC;;;OAGG;gBACS,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM;IAK1D,2FAA2F;IAC3F,SAAS,IAAI,oBAAoB,EAAE;IAYnC,iFAAiF;IACjF,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IASvC,2EAA2E;IAC3E,cAAc,IAAI,eAAe,EAAE;IAgBnC,uDAAuD;IACvD,SAAS,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,IAAI;IAM/C,qEAAqE;IACrE,UAAU,IAAI,eAAe,EAAE;CAGhC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextDocumentManager = void 0;
|
|
4
|
-
const crypto_1 = require("crypto");
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
class ContextDocumentManager {
|
|
8
|
-
docs;
|
|
9
|
-
cacheDir;
|
|
10
|
-
/**
|
|
11
|
-
* @param docs Map of document name → content (user-provided)
|
|
12
|
-
* @param cacheDir Path to cache file (e.g. ".thoughtflow/context-cache.json")
|
|
13
|
-
*/
|
|
14
|
-
constructor(docs, cacheDir) {
|
|
15
|
-
this.docs = docs;
|
|
16
|
-
this.cacheDir = cacheDir;
|
|
17
|
-
}
|
|
18
|
-
/** Load cached decomposition results from disk. Returns empty array if no cache exists. */
|
|
19
|
-
loadCache() {
|
|
20
|
-
try {
|
|
21
|
-
if (!(0, fs_1.existsSync)(this.cacheDir))
|
|
22
|
-
return [];
|
|
23
|
-
const raw = (0, fs_1.readFileSync)(this.cacheDir, 'utf-8');
|
|
24
|
-
const parsed = JSON.parse(raw);
|
|
25
|
-
if (!Array.isArray(parsed))
|
|
26
|
-
return [];
|
|
27
|
-
return parsed;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/** Compute MD5 checksum for each document. Returns Map<docName, checksumHex>. */
|
|
34
|
-
computeChecksums() {
|
|
35
|
-
const checksums = new Map();
|
|
36
|
-
for (const [name, content] of Object.entries(this.docs)) {
|
|
37
|
-
const hash = (0, crypto_1.createHash)('md5').update(content).digest('hex');
|
|
38
|
-
checksums.set(name, hash);
|
|
39
|
-
}
|
|
40
|
-
return checksums;
|
|
41
|
-
}
|
|
42
|
-
/** Return documents whose checksum differs from the cache (or are new). */
|
|
43
|
-
getChangedDocs() {
|
|
44
|
-
const caches = this.loadCache();
|
|
45
|
-
const checksums = this.computeChecksums();
|
|
46
|
-
const cacheByDoc = new Map(caches.map(c => [c.name, c]));
|
|
47
|
-
const changed = [];
|
|
48
|
-
for (const [name, content] of Object.entries(this.docs)) {
|
|
49
|
-
const checksum = checksums.get(name);
|
|
50
|
-
const cached = cacheByDoc.get(name);
|
|
51
|
-
if (!cached || cached.checksum !== checksum) {
|
|
52
|
-
changed.push({ name, content });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return changed;
|
|
56
|
-
}
|
|
57
|
-
/** Persist the given cache entries to disk as JSON. */
|
|
58
|
-
saveCache(caches) {
|
|
59
|
-
const dir = (0, path_1.dirname)(this.cacheDir);
|
|
60
|
-
(0, fs_1.mkdirSync)(dir, { recursive: true });
|
|
61
|
-
(0, fs_1.writeFileSync)(this.cacheDir, JSON.stringify(caches, null, 2), 'utf-8');
|
|
62
|
-
}
|
|
63
|
-
/** Return all documents as ContextDocument[] (the raw input map). */
|
|
64
|
-
getAllDocs() {
|
|
65
|
-
return Object.entries(this.docs).map(([name, content]) => ({ name, content }));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.ContextDocumentManager = ContextDocumentManager;
|
|
69
|
-
//# sourceMappingURL=context-document-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-document-manager.js","sourceRoot":"","sources":["../../src/contexts/context-document-manager.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,2BAAuE;AACvE,+BAA8B;AAG9B,MAAa,sBAAsB;IAChB,IAAI,CAAwB;IAC5B,QAAQ,CAAQ;IAEjC;;;OAGG;IACH,YAAY,IAA4B,EAAE,QAAgB;QACxD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,2FAA2F;IAC3F,SAAS;QACP,IAAI,CAAC;YACH,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,QAAQ,CAAC;gBAAE,OAAO,EAAE,CAAA;YACzC,MAAM,GAAG,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,OAAO,EAAE,CAAA;YACrC,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;IAED,iFAAiF;IACjF,gBAAgB;QACd,MAAM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A,cAAO,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAClC,IAAA,cAAS,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACnC,IAAA,kBAAa,EAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;IACxE,CAAC;IAED,qEAAqE;IACrE,UAAU;QACR,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;IAChF,CAAC;CACF;AAhED,wDAgEC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ContextRoutingConfig, ContextDocumentCache, LlmAdapter } from "@thoughtflow/core";
|
|
2
|
-
export declare class ContextRouter {
|
|
3
|
-
private readonly config;
|
|
4
|
-
private readonly adapter;
|
|
5
|
-
private readonly model;
|
|
6
|
-
constructor(config: ContextRoutingConfig, adapter: LlmAdapter, model: string);
|
|
7
|
-
/**
|
|
8
|
-
* Route the given prompt against cached document metadata.
|
|
9
|
-
* Returns the list of document names that are relevant.
|
|
10
|
-
*/
|
|
11
|
-
route(prompt: string, documents: ContextDocumentCache[]): Promise<string[]>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=context-router.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-router.d.ts","sourceRoot":"","sources":["../../src/contexts/context-router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAoD/F,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAFL,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,MAAM;IAGhC;;;OAGG;IACG,KAAK,CACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,oBAAoB,EAAE,GAChC,OAAO,CAAC,MAAM,EAAE,CAAC;CAsDrB"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextRouter = void 0;
|
|
4
|
-
const core_1 = require("@thoughtflow/core");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const STOP_WORDS = new Set([
|
|
7
|
-
'a', 'an', 'the', 'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
8
|
-
'have', 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'shall',
|
|
9
|
-
'should', 'may', 'might', 'must', 'can', 'could', 'i', 'me', 'my',
|
|
10
|
-
'we', 'our', 'you', 'your', 'he', 'she', 'it', 'they', 'them', 'this',
|
|
11
|
-
'that', 'these', 'those', 'in', 'on', 'at', 'to', 'for', 'of', 'with',
|
|
12
|
-
'by', 'from', 'and', 'or', 'not', 'but', 'if', 'so', 'no', 'yes',
|
|
13
|
-
'what', 'which', 'who', 'whom', 'when', 'where', 'why', 'how'
|
|
14
|
-
]);
|
|
15
|
-
function tokenize(text) {
|
|
16
|
-
return new Set(text.toLowerCase()
|
|
17
|
-
.split(/[^a-zA-Z0-9]+/)
|
|
18
|
-
.filter(w => w.length > 0 && !STOP_WORDS.has(w)));
|
|
19
|
-
}
|
|
20
|
-
function computeScore(promptTokens, doc) {
|
|
21
|
-
if (doc.keywords.length === 0)
|
|
22
|
-
return 0;
|
|
23
|
-
let matches = 0;
|
|
24
|
-
for (const kw of doc.keywords) {
|
|
25
|
-
let hasMatch = false;
|
|
26
|
-
for (const t of tokenize(kw)) {
|
|
27
|
-
if (promptTokens.has(t)) {
|
|
28
|
-
hasMatch = true;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (hasMatch)
|
|
33
|
-
matches++;
|
|
34
|
-
}
|
|
35
|
-
let categoryBonus = 0;
|
|
36
|
-
if (doc.category && promptTokens.has(doc.category)) {
|
|
37
|
-
categoryBonus = 0.3;
|
|
38
|
-
}
|
|
39
|
-
return (matches / doc.keywords.length) + categoryBonus;
|
|
40
|
-
}
|
|
41
|
-
const routingSchema = zod_1.z.object({
|
|
42
|
-
relevant: zod_1.z.array(zod_1.z.string())
|
|
43
|
-
});
|
|
44
|
-
class ContextRouter {
|
|
45
|
-
config;
|
|
46
|
-
adapter;
|
|
47
|
-
model;
|
|
48
|
-
constructor(config, adapter, model) {
|
|
49
|
-
this.config = config;
|
|
50
|
-
this.adapter = adapter;
|
|
51
|
-
this.model = model;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Route the given prompt against cached document metadata.
|
|
55
|
-
* Returns the list of document names that are relevant.
|
|
56
|
-
*/
|
|
57
|
-
async route(prompt, documents) {
|
|
58
|
-
const promptTokens = tokenize(prompt);
|
|
59
|
-
const strategy = this.config.strategy ?? 'hybrid';
|
|
60
|
-
const threshold = this.config.relevanceThreshold ?? 0.5;
|
|
61
|
-
// ── Step 1: keyword matching ────────────────────────────────────
|
|
62
|
-
const scored = documents.map(doc => ({
|
|
63
|
-
name: doc.name,
|
|
64
|
-
score: computeScore(promptTokens, doc)
|
|
65
|
-
}));
|
|
66
|
-
const maxScore = Math.max(...scored.map(s => s.score), 0);
|
|
67
|
-
const normalized = scored.map(s => ({
|
|
68
|
-
...s,
|
|
69
|
-
score: maxScore > 0 ? s.score / maxScore : 0
|
|
70
|
-
}));
|
|
71
|
-
const keywordHits = normalized
|
|
72
|
-
.filter(s => s.score >= threshold)
|
|
73
|
-
.map(s => s.name);
|
|
74
|
-
if (strategy === 'keyword') {
|
|
75
|
-
return keywordHits;
|
|
76
|
-
}
|
|
77
|
-
if (strategy === 'hybrid' && keywordHits.length > 0) {
|
|
78
|
-
return keywordHits;
|
|
79
|
-
}
|
|
80
|
-
// ── Step 2: LLM routing ────────────────────────────────────────
|
|
81
|
-
if (documents.length === 0) {
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
const routingModel = this.config.model?.model ?? this.model;
|
|
85
|
-
const docLines = documents
|
|
86
|
-
.map(d => `- ${d.name}: ${d.summary}`)
|
|
87
|
-
.join('\n');
|
|
88
|
-
const userPrompt = `Given the user query: "${prompt}"\n\nSelect which of the following documents are relevant:\n${docLines}`;
|
|
89
|
-
const result = await (0, core_1.callStructured)(this.adapter, routingModel, 'You are a document routing assistant. Select relevant documents based on the user query.', userPrompt, routingSchema);
|
|
90
|
-
return result.result.relevant;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.ContextRouter = ContextRouter;
|
|
94
|
-
//# sourceMappingURL=context-router.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context-router.js","sourceRoot":"","sources":["../../src/contexts/context-router.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,6BAAuB;AAEvB,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO;IACnE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IACnE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI;IACjE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MA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class";
|
|
2
|
-
export * from "./libs/codebase/deep-analyzer";
|
|
3
|
-
export * from "./libs/codebase/graph/dependency-extractor";
|
|
4
|
-
export * from "./libs/codebase/graph/graph-analysis";
|
|
5
|
-
export * from "./libs/codebase/graph/graph-visualizer";
|
|
6
|
-
export * from "./libs/codebase/indexer/batch-processor";
|
|
7
|
-
export * from "./libs/codebase/indexer/chunker-markdown";
|
|
8
|
-
export * from "./libs/codebase/indexer/chunker";
|
|
9
|
-
export * from "./libs/codebase/indexer/explorer";
|
|
10
|
-
export * from "./libs/codebase/indexer/indexer";
|
|
11
|
-
export * from "./libs/codebase/knowledge/cross-referencer";
|
|
12
|
-
export * from "./libs/codebase/knowledge/markdown-extractor";
|
|
13
|
-
export * from "./libs/codebase/knowledge/summarizer";
|
|
14
|
-
export * from "./libs/codebase/search/bm25";
|
|
15
|
-
export * from "./libs/codebase/search/hybrid-search";
|
|
16
|
-
export * from "./tools/codebase/codebase-analyze.tool";
|
|
17
|
-
export * from "./tools/codebase/codebase-crossref.tool";
|
|
18
|
-
export * from "./tools/codebase/codebase-flow.tool";
|
|
19
|
-
export * from "./tools/codebase/codebase-graph-circular.tool";
|
|
20
|
-
export * from "./tools/codebase/codebase-graph-query.tool";
|
|
21
|
-
export * from "./tools/codebase/codebase-graph-stats.tool";
|
|
22
|
-
export * from "./tools/codebase/codebase-graph-visualize.tool";
|
|
23
|
-
export * from "./tools/codebase/codebase-impact.tool";
|
|
24
|
-
export * from "./tools/codebase/codebase-index.tool";
|
|
25
|
-
export * from "./tools/codebase/codebase-knowledge.tool";
|
|
26
|
-
export * from "./tools/codebase/codebase-search.tool";
|
|
27
|
-
export * from "./tools/codebase/codebase-status.tool";
|
|
28
|
-
export * from "./tools/quality/quality-complexity.tool";
|
|
29
|
-
export * from "./tools/quality/quality-coupling.tool";
|
|
30
|
-
export * from "./tools/quality/quality-coverage.tool";
|
|
31
|
-
export * from "./tools/quality/quality-deps.tool";
|
|
32
|
-
export * from "./tools/quality/quality-duplication.tool";
|
|
33
|
-
export * from "./tools/quality/quality-size.tool";
|
|
34
|
-
export * from "./tools/quality/quality-types.tool";
|
|
35
|
-
export * from "./tools/neural/comparative-analysis.tool";
|
|
36
|
-
export * from "./tools/neural/neural-deadcode.tool";
|
|
37
|
-
export * from "./tools/neural/neural-debug.tool";
|
|
38
|
-
export * from "./tools/neural/neural-explain.tool";
|
|
39
|
-
export * from "./tools/neural/neural-optimize.tool";
|
|
40
|
-
export * from "./tools/neural/neural-pattern.tool";
|
|
41
|
-
export * from "./tools/neural/neural-review.tool";
|
|
42
|
-
export * from "./tools/neural/neural-security.tool";
|
|
43
|
-
export * from "./tools/neural/neural-similar.tool";
|
|
44
|
-
export * from "./tools/neural/neural-smells.tool";
|
|
45
|
-
export * from "./tools/neural/neural-suggest.tool";
|
|
46
|
-
export * from "./tools/workspace/search-code.tool";
|
|
47
|
-
export * from "./tools/workspace/codebase-research.tool";
|
|
48
|
-
export * from "./tools/workspace/project-scanner.tool";
|
|
49
|
-
export * from "./tools/workspace/analyze-project.tool";
|
|
50
|
-
export * from "./contexts/context-decomposer";
|
|
51
|
-
export * from "./contexts/context-document-manager";
|
|
52
|
-
export * from "./contexts/context-router";
|
|
53
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,6BAA6B,CAAC;AAG5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sCAAsC,CAAC;AAGrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,2BAA2B,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// Codebase index
|
|
18
|
-
__exportStar(require("./libs/codebase-index.class"), exports);
|
|
19
|
-
// Codebase libs — deep analyzer, graph, indexer, knowledge, search
|
|
20
|
-
__exportStar(require("./libs/codebase/deep-analyzer"), exports);
|
|
21
|
-
__exportStar(require("./libs/codebase/graph/dependency-extractor"), exports);
|
|
22
|
-
__exportStar(require("./libs/codebase/graph/graph-analysis"), exports);
|
|
23
|
-
__exportStar(require("./libs/codebase/graph/graph-visualizer"), exports);
|
|
24
|
-
__exportStar(require("./libs/codebase/indexer/batch-processor"), exports);
|
|
25
|
-
__exportStar(require("./libs/codebase/indexer/chunker-markdown"), exports);
|
|
26
|
-
__exportStar(require("./libs/codebase/indexer/chunker"), exports);
|
|
27
|
-
__exportStar(require("./libs/codebase/indexer/explorer"), exports);
|
|
28
|
-
__exportStar(require("./libs/codebase/indexer/indexer"), exports);
|
|
29
|
-
__exportStar(require("./libs/codebase/knowledge/cross-referencer"), exports);
|
|
30
|
-
__exportStar(require("./libs/codebase/knowledge/markdown-extractor"), exports);
|
|
31
|
-
__exportStar(require("./libs/codebase/knowledge/summarizer"), exports);
|
|
32
|
-
__exportStar(require("./libs/codebase/search/bm25"), exports);
|
|
33
|
-
__exportStar(require("./libs/codebase/search/hybrid-search"), exports);
|
|
34
|
-
// Tools — codebase
|
|
35
|
-
__exportStar(require("./tools/codebase/codebase-analyze.tool"), exports);
|
|
36
|
-
__exportStar(require("./tools/codebase/codebase-crossref.tool"), exports);
|
|
37
|
-
__exportStar(require("./tools/codebase/codebase-flow.tool"), exports);
|
|
38
|
-
__exportStar(require("./tools/codebase/codebase-graph-circular.tool"), exports);
|
|
39
|
-
__exportStar(require("./tools/codebase/codebase-graph-query.tool"), exports);
|
|
40
|
-
__exportStar(require("./tools/codebase/codebase-graph-stats.tool"), exports);
|
|
41
|
-
__exportStar(require("./tools/codebase/codebase-graph-visualize.tool"), exports);
|
|
42
|
-
__exportStar(require("./tools/codebase/codebase-impact.tool"), exports);
|
|
43
|
-
__exportStar(require("./tools/codebase/codebase-index.tool"), exports);
|
|
44
|
-
__exportStar(require("./tools/codebase/codebase-knowledge.tool"), exports);
|
|
45
|
-
__exportStar(require("./tools/codebase/codebase-search.tool"), exports);
|
|
46
|
-
__exportStar(require("./tools/codebase/codebase-status.tool"), exports);
|
|
47
|
-
// Tools — quality
|
|
48
|
-
__exportStar(require("./tools/quality/quality-complexity.tool"), exports);
|
|
49
|
-
__exportStar(require("./tools/quality/quality-coupling.tool"), exports);
|
|
50
|
-
__exportStar(require("./tools/quality/quality-coverage.tool"), exports);
|
|
51
|
-
__exportStar(require("./tools/quality/quality-deps.tool"), exports);
|
|
52
|
-
__exportStar(require("./tools/quality/quality-duplication.tool"), exports);
|
|
53
|
-
__exportStar(require("./tools/quality/quality-size.tool"), exports);
|
|
54
|
-
__exportStar(require("./tools/quality/quality-types.tool"), exports);
|
|
55
|
-
// Tools — neural
|
|
56
|
-
__exportStar(require("./tools/neural/comparative-analysis.tool"), exports);
|
|
57
|
-
__exportStar(require("./tools/neural/neural-deadcode.tool"), exports);
|
|
58
|
-
__exportStar(require("./tools/neural/neural-debug.tool"), exports);
|
|
59
|
-
__exportStar(require("./tools/neural/neural-explain.tool"), exports);
|
|
60
|
-
__exportStar(require("./tools/neural/neural-optimize.tool"), exports);
|
|
61
|
-
__exportStar(require("./tools/neural/neural-pattern.tool"), exports);
|
|
62
|
-
__exportStar(require("./tools/neural/neural-review.tool"), exports);
|
|
63
|
-
__exportStar(require("./tools/neural/neural-security.tool"), exports);
|
|
64
|
-
__exportStar(require("./tools/neural/neural-similar.tool"), exports);
|
|
65
|
-
__exportStar(require("./tools/neural/neural-smells.tool"), exports);
|
|
66
|
-
__exportStar(require("./tools/neural/neural-suggest.tool"), exports);
|
|
67
|
-
// Tools — workspace (codebase-related)
|
|
68
|
-
__exportStar(require("./tools/workspace/search-code.tool"), exports);
|
|
69
|
-
__exportStar(require("./tools/workspace/codebase-research.tool"), exports);
|
|
70
|
-
__exportStar(require("./tools/workspace/project-scanner.tool"), exports);
|
|
71
|
-
__exportStar(require("./tools/workspace/analyze-project.tool"), exports);
|
|
72
|
-
// Contexts
|
|
73
|
-
__exportStar(require("./contexts/context-decomposer"), exports);
|
|
74
|
-
__exportStar(require("./contexts/context-document-manager"), exports);
|
|
75
|
-
__exportStar(require("./contexts/context-router"), exports);
|
|
76
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iBAAiB;AACjB,8DAA4C;AAE5C,mEAAmE;AACnE,gEAA8C;AAC9C,6EAA2D;AAC3D,uEAAqD;AACrD,yEAAuD;AACvD,0EAAwD;AACxD,2EAAyD;AACzD,kEAAgD;AAChD,mEAAiD;AACjD,kEAAgD;AAChD,6EAA2D;AAC3D,+EAA6D;AAC7D,uEAAqD;AACrD,8DAA4C;AAC5C,uEAAqD;AAErD,mBAAmB;AACnB,yEAAuD;AACvD,0EAAwD;AACxD,sEAAoD;AACpD,gFAA8D;AAC9D,6EAA2D;AAC3D,6EAA2D;AAC3D,iFAA+D;AAC/D,wEAAsD;AACtD,uEAAqD;AACrD,2EAAyD;AACzD,wEAAsD;AACtD,wEAAsD;AAEtD,kBAAkB;AAClB,0EAAwD;AACxD,wEAAsD;AACtD,wEAAsD;AACtD,oEAAkD;AAClD,2EAAyD;AACzD,oEAAkD;AAClD,qEAAmD;AAEnD,iBAAiB;AACjB,2EAAyD;AACzD,sEAAoD;AACpD,mEAAiD;AACjD,qEAAmD;AACnD,sEAAoD;AACpD,qEAAmD;AACnD,oEAAkD;AAClD,sEAAoD;AACpD,qEAAmD;AACnD,oEAAkD;AAClD,qEAAmD;AAEnD,uCAAuC;AACvC,qEAAmD;AACnD,2EAAyD;AACzD,yEAAuD;AACvD,yEAAuD;AAEvD,WAAW;AACX,gEAA8C;AAC9C,sEAAoD;AACpD,4DAA0C"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { IVectorStore, IEmbeddingProvider } from "@thoughtflow/core";
|
|
2
|
-
export type AnalysisPhase = 'discover' | 'index' | 'graph' | 'extract-knowledge' | 'summarize' | 'cross-reference' | 'complete';
|
|
3
|
-
export interface DeepAnalysisConfig {
|
|
4
|
-
repoPath: string;
|
|
5
|
-
vectorStore: IVectorStore;
|
|
6
|
-
embeddingProvider: IEmbeddingProvider;
|
|
7
|
-
phases?: AnalysisPhase[];
|
|
8
|
-
onProgress?: (phase: AnalysisPhase, message: string, percent: number) => void;
|
|
9
|
-
}
|
|
10
|
-
export interface DeepAnalysisReport {
|
|
11
|
-
repoName: string;
|
|
12
|
-
repoPath: string;
|
|
13
|
-
analyzedAt: string;
|
|
14
|
-
durationMs: number;
|
|
15
|
-
stats: {
|
|
16
|
-
totalFiles: number;
|
|
17
|
-
codeFiles: number;
|
|
18
|
-
docFiles: number;
|
|
19
|
-
configFiles: number;
|
|
20
|
-
testFiles: number;
|
|
21
|
-
totalChunks: number;
|
|
22
|
-
};
|
|
23
|
-
architecture: {
|
|
24
|
-
techStack: string[];
|
|
25
|
-
topModules: string[];
|
|
26
|
-
entryPoints: string[];
|
|
27
|
-
circularDependencies: string[][];
|
|
28
|
-
};
|
|
29
|
-
knowledge: {
|
|
30
|
-
documentsExtracted: number;
|
|
31
|
-
usefulDocuments: number;
|
|
32
|
-
noiseDocuments: number;
|
|
33
|
-
decisions: number;
|
|
34
|
-
qualityScore: number;
|
|
35
|
-
};
|
|
36
|
-
traceability: {
|
|
37
|
-
totalReferences: number;
|
|
38
|
-
featuresWithCode: number;
|
|
39
|
-
featuresWithoutCode: number;
|
|
40
|
-
orphanDocuments: string[];
|
|
41
|
-
undocumentedModules: string[];
|
|
42
|
-
};
|
|
43
|
-
summary: string;
|
|
44
|
-
recommendations: string[];
|
|
45
|
-
mermaidDiagram: string;
|
|
46
|
-
}
|
|
47
|
-
export declare class DeepAnalyzer {
|
|
48
|
-
private config;
|
|
49
|
-
private startTime;
|
|
50
|
-
constructor(config: DeepAnalysisConfig);
|
|
51
|
-
analyze(): Promise<DeepAnalysisReport>;
|
|
52
|
-
private emit;
|
|
53
|
-
private detectTechStack;
|
|
54
|
-
private findTopModules;
|
|
55
|
-
private findEntryPoints;
|
|
56
|
-
private generateRecommendations;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=deep-analyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deep-analyzer.d.ts","sourceRoot":"","sources":["../../../src/libs/codebase/deep-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAU1E,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,OAAO,GACP,OAAO,GACP,mBAAmB,GACnB,WAAW,GACX,iBAAiB,GACjB,UAAU,CAAC;AAEf,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,YAAY,CAAC;IAC1B,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,UAAU,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