@colbymchenry/codegraph 0.7.10 → 0.9.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 +70 -54
- package/npm-shim.js +43 -0
- package/package.json +13 -51
- package/LICENSE +0 -21
- package/dist/bin/codegraph.d.ts +0 -21
- package/dist/bin/codegraph.d.ts.map +0 -1
- package/dist/bin/codegraph.js +0 -1232
- package/dist/bin/codegraph.js.map +0 -1
- package/dist/bin/node-version-check.d.ts +0 -20
- package/dist/bin/node-version-check.d.ts.map +0 -1
- package/dist/bin/node-version-check.js +0 -42
- package/dist/bin/node-version-check.js.map +0 -1
- package/dist/bin/uninstall.d.ts +0 -14
- package/dist/bin/uninstall.d.ts.map +0 -1
- package/dist/bin/uninstall.js +0 -36
- package/dist/bin/uninstall.js.map +0 -1
- package/dist/config.d.ts +0 -51
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -321
- package/dist/config.js.map +0 -1
- package/dist/context/formatter.d.ts +0 -30
- package/dist/context/formatter.d.ts.map +0 -1
- package/dist/context/formatter.js +0 -244
- package/dist/context/formatter.js.map +0 -1
- package/dist/context/index.d.ts +0 -97
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -1048
- package/dist/context/index.js.map +0 -1
- package/dist/db/index.d.ts +0 -72
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js +0 -200
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations.d.ts +0 -44
- package/dist/db/migrations.d.ts.map +0 -1
- package/dist/db/migrations.js +0 -131
- package/dist/db/migrations.js.map +0 -1
- package/dist/db/queries.d.ts +0 -253
- package/dist/db/queries.d.ts.map +0 -1
- package/dist/db/queries.js +0 -1207
- package/dist/db/queries.js.map +0 -1
- package/dist/db/schema.sql +0 -151
- package/dist/db/sqlite-adapter.d.ts +0 -52
- package/dist/db/sqlite-adapter.d.ts.map +0 -1
- package/dist/db/sqlite-adapter.js +0 -237
- package/dist/db/sqlite-adapter.js.map +0 -1
- package/dist/directory.d.ts +0 -57
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -264
- package/dist/directory.js.map +0 -1
- package/dist/errors.d.ts +0 -136
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -219
- package/dist/errors.js.map +0 -1
- package/dist/extraction/dfm-extractor.d.ts +0 -31
- package/dist/extraction/dfm-extractor.d.ts.map +0 -1
- package/dist/extraction/dfm-extractor.js +0 -151
- package/dist/extraction/dfm-extractor.js.map +0 -1
- package/dist/extraction/grammars.d.ts +0 -78
- package/dist/extraction/grammars.d.ts.map +0 -1
- package/dist/extraction/grammars.js +0 -322
- package/dist/extraction/grammars.js.map +0 -1
- package/dist/extraction/index.d.ts +0 -130
- package/dist/extraction/index.d.ts.map +0 -1
- package/dist/extraction/index.js +0 -1279
- package/dist/extraction/index.js.map +0 -1
- package/dist/extraction/languages/c-cpp.d.ts +0 -4
- package/dist/extraction/languages/c-cpp.d.ts.map +0 -1
- package/dist/extraction/languages/c-cpp.js +0 -126
- package/dist/extraction/languages/c-cpp.js.map +0 -1
- package/dist/extraction/languages/csharp.d.ts +0 -3
- package/dist/extraction/languages/csharp.d.ts.map +0 -1
- package/dist/extraction/languages/csharp.js +0 -72
- package/dist/extraction/languages/csharp.js.map +0 -1
- package/dist/extraction/languages/dart.d.ts +0 -3
- package/dist/extraction/languages/dart.d.ts.map +0 -1
- package/dist/extraction/languages/dart.js +0 -192
- package/dist/extraction/languages/dart.js.map +0 -1
- package/dist/extraction/languages/go.d.ts +0 -3
- package/dist/extraction/languages/go.d.ts.map +0 -1
- package/dist/extraction/languages/go.js +0 -58
- package/dist/extraction/languages/go.js.map +0 -1
- package/dist/extraction/languages/index.d.ts +0 -10
- package/dist/extraction/languages/index.d.ts.map +0 -1
- package/dist/extraction/languages/index.js +0 -45
- package/dist/extraction/languages/index.js.map +0 -1
- package/dist/extraction/languages/java.d.ts +0 -3
- package/dist/extraction/languages/java.d.ts.map +0 -1
- package/dist/extraction/languages/java.js +0 -64
- package/dist/extraction/languages/java.js.map +0 -1
- package/dist/extraction/languages/javascript.d.ts +0 -3
- package/dist/extraction/languages/javascript.d.ts.map +0 -1
- package/dist/extraction/languages/javascript.js +0 -90
- package/dist/extraction/languages/javascript.js.map +0 -1
- package/dist/extraction/languages/kotlin.d.ts +0 -3
- package/dist/extraction/languages/kotlin.d.ts.map +0 -1
- package/dist/extraction/languages/kotlin.js +0 -253
- package/dist/extraction/languages/kotlin.js.map +0 -1
- package/dist/extraction/languages/pascal.d.ts +0 -3
- package/dist/extraction/languages/pascal.d.ts.map +0 -1
- package/dist/extraction/languages/pascal.js +0 -66
- package/dist/extraction/languages/pascal.js.map +0 -1
- package/dist/extraction/languages/php.d.ts +0 -3
- package/dist/extraction/languages/php.d.ts.map +0 -1
- package/dist/extraction/languages/php.js +0 -107
- package/dist/extraction/languages/php.js.map +0 -1
- package/dist/extraction/languages/python.d.ts +0 -3
- package/dist/extraction/languages/python.d.ts.map +0 -1
- package/dist/extraction/languages/python.js +0 -56
- package/dist/extraction/languages/python.js.map +0 -1
- package/dist/extraction/languages/ruby.d.ts +0 -3
- package/dist/extraction/languages/ruby.d.ts.map +0 -1
- package/dist/extraction/languages/ruby.js +0 -114
- package/dist/extraction/languages/ruby.js.map +0 -1
- package/dist/extraction/languages/rust.d.ts +0 -3
- package/dist/extraction/languages/rust.d.ts.map +0 -1
- package/dist/extraction/languages/rust.js +0 -109
- package/dist/extraction/languages/rust.js.map +0 -1
- package/dist/extraction/languages/scala.d.ts +0 -3
- package/dist/extraction/languages/scala.d.ts.map +0 -1
- package/dist/extraction/languages/scala.js +0 -139
- package/dist/extraction/languages/scala.js.map +0 -1
- package/dist/extraction/languages/swift.d.ts +0 -3
- package/dist/extraction/languages/swift.d.ts.map +0 -1
- package/dist/extraction/languages/swift.js +0 -91
- package/dist/extraction/languages/swift.js.map +0 -1
- package/dist/extraction/languages/typescript.d.ts +0 -3
- package/dist/extraction/languages/typescript.d.ts.map +0 -1
- package/dist/extraction/languages/typescript.js +0 -129
- package/dist/extraction/languages/typescript.js.map +0 -1
- package/dist/extraction/liquid-extractor.d.ts +0 -52
- package/dist/extraction/liquid-extractor.d.ts.map +0 -1
- package/dist/extraction/liquid-extractor.js +0 -313
- package/dist/extraction/liquid-extractor.js.map +0 -1
- package/dist/extraction/parse-worker.d.ts +0 -8
- package/dist/extraction/parse-worker.d.ts.map +0 -1
- package/dist/extraction/parse-worker.js +0 -94
- package/dist/extraction/parse-worker.js.map +0 -1
- package/dist/extraction/svelte-extractor.d.ts +0 -56
- package/dist/extraction/svelte-extractor.d.ts.map +0 -1
- package/dist/extraction/svelte-extractor.js +0 -272
- package/dist/extraction/svelte-extractor.js.map +0 -1
- package/dist/extraction/tree-sitter-helpers.d.ts +0 -28
- package/dist/extraction/tree-sitter-helpers.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-helpers.js +0 -103
- package/dist/extraction/tree-sitter-helpers.js.map +0 -1
- package/dist/extraction/tree-sitter-types.d.ts +0 -179
- package/dist/extraction/tree-sitter-types.d.ts.map +0 -1
- package/dist/extraction/tree-sitter-types.js +0 -10
- package/dist/extraction/tree-sitter-types.js.map +0 -1
- package/dist/extraction/tree-sitter.d.ts +0 -233
- package/dist/extraction/tree-sitter.d.ts.map +0 -1
- package/dist/extraction/tree-sitter.js +0 -2393
- package/dist/extraction/tree-sitter.js.map +0 -1
- package/dist/extraction/vue-extractor.d.ts +0 -36
- package/dist/extraction/vue-extractor.d.ts.map +0 -1
- package/dist/extraction/vue-extractor.js +0 -163
- package/dist/extraction/vue-extractor.js.map +0 -1
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/graph/index.d.ts +0 -8
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js +0 -13
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/queries.d.ts +0 -106
- package/dist/graph/queries.d.ts.map +0 -1
- package/dist/graph/queries.js +0 -366
- package/dist/graph/queries.js.map +0 -1
- package/dist/graph/traversal.d.ts +0 -127
- package/dist/graph/traversal.d.ts.map +0 -1
- package/dist/graph/traversal.js +0 -493
- package/dist/graph/traversal.js.map +0 -1
- package/dist/index.d.ts +0 -447
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -825
- package/dist/index.js.map +0 -1
- package/dist/installer/claude-md-template.d.ts +0 -14
- package/dist/installer/claude-md-template.d.ts.map +0 -1
- package/dist/installer/claude-md-template.js +0 -21
- package/dist/installer/claude-md-template.js.map +0 -1
- package/dist/installer/config-writer.d.ts +0 -29
- package/dist/installer/config-writer.d.ts.map +0 -1
- package/dist/installer/config-writer.js +0 -109
- package/dist/installer/config-writer.js.map +0 -1
- package/dist/installer/index.d.ts +0 -53
- package/dist/installer/index.d.ts.map +0 -1
- package/dist/installer/index.js +0 -338
- package/dist/installer/index.js.map +0 -1
- package/dist/installer/instructions-template.d.ts +0 -28
- package/dist/installer/instructions-template.d.ts.map +0 -1
- package/dist/installer/instructions-template.js +0 -63
- package/dist/installer/instructions-template.js.map +0 -1
- package/dist/installer/targets/claude.d.ts +0 -27
- package/dist/installer/targets/claude.d.ts.map +0 -1
- package/dist/installer/targets/claude.js +0 -246
- package/dist/installer/targets/claude.js.map +0 -1
- package/dist/installer/targets/codex.d.ts +0 -18
- package/dist/installer/targets/codex.d.ts.map +0 -1
- package/dist/installer/targets/codex.js +0 -185
- package/dist/installer/targets/codex.js.map +0 -1
- package/dist/installer/targets/cursor.d.ts +0 -35
- package/dist/installer/targets/cursor.d.ts.map +0 -1
- package/dist/installer/targets/cursor.js +0 -229
- package/dist/installer/targets/cursor.js.map +0 -1
- package/dist/installer/targets/opencode.d.ts +0 -30
- package/dist/installer/targets/opencode.d.ts.map +0 -1
- package/dist/installer/targets/opencode.js +0 -235
- package/dist/installer/targets/opencode.js.map +0 -1
- package/dist/installer/targets/registry.d.ts +0 -35
- package/dist/installer/targets/registry.d.ts.map +0 -1
- package/dist/installer/targets/registry.js +0 -83
- package/dist/installer/targets/registry.js.map +0 -1
- package/dist/installer/targets/shared.d.ts +0 -77
- package/dist/installer/targets/shared.d.ts.map +0 -1
- package/dist/installer/targets/shared.js +0 -246
- package/dist/installer/targets/shared.js.map +0 -1
- package/dist/installer/targets/toml.d.ts +0 -52
- package/dist/installer/targets/toml.d.ts.map +0 -1
- package/dist/installer/targets/toml.js +0 -147
- package/dist/installer/targets/toml.js.map +0 -1
- package/dist/installer/targets/types.d.ts +0 -116
- package/dist/installer/targets/types.d.ts.map +0 -1
- package/dist/installer/targets/types.js +0 -16
- package/dist/installer/targets/types.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -86
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -355
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/server-instructions.d.ts +0 -19
- package/dist/mcp/server-instructions.d.ts.map +0 -1
- package/dist/mcp/server-instructions.js +0 -59
- package/dist/mcp/server-instructions.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -200
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1319
- package/dist/mcp/tools.js.map +0 -1
- package/dist/mcp/transport.d.ts +0 -89
- package/dist/mcp/transport.d.ts.map +0 -1
- package/dist/mcp/transport.js +0 -170
- package/dist/mcp/transport.js.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.d.ts +0 -18
- package/dist/resolution/frameworks/cargo-workspace.d.ts.map +0 -1
- package/dist/resolution/frameworks/cargo-workspace.js +0 -225
- package/dist/resolution/frameworks/cargo-workspace.js.map +0 -1
- package/dist/resolution/frameworks/csharp.d.ts +0 -8
- package/dist/resolution/frameworks/csharp.d.ts.map +0 -1
- package/dist/resolution/frameworks/csharp.js +0 -213
- package/dist/resolution/frameworks/csharp.js.map +0 -1
- package/dist/resolution/frameworks/express.d.ts +0 -8
- package/dist/resolution/frameworks/express.d.ts.map +0 -1
- package/dist/resolution/frameworks/express.js +0 -225
- package/dist/resolution/frameworks/express.js.map +0 -1
- package/dist/resolution/frameworks/go.d.ts +0 -8
- package/dist/resolution/frameworks/go.d.ts.map +0 -1
- package/dist/resolution/frameworks/go.js +0 -158
- package/dist/resolution/frameworks/go.js.map +0 -1
- package/dist/resolution/frameworks/index.d.ts +0 -41
- package/dist/resolution/frameworks/index.d.ts.map +0 -1
- package/dist/resolution/frameworks/index.js +0 -129
- package/dist/resolution/frameworks/index.js.map +0 -1
- package/dist/resolution/frameworks/java.d.ts +0 -8
- package/dist/resolution/frameworks/java.d.ts.map +0 -1
- package/dist/resolution/frameworks/java.js +0 -177
- package/dist/resolution/frameworks/java.js.map +0 -1
- package/dist/resolution/frameworks/laravel.d.ts +0 -13
- package/dist/resolution/frameworks/laravel.d.ts.map +0 -1
- package/dist/resolution/frameworks/laravel.js +0 -248
- package/dist/resolution/frameworks/laravel.js.map +0 -1
- package/dist/resolution/frameworks/python.d.ts +0 -10
- package/dist/resolution/frameworks/python.d.ts.map +0 -1
- package/dist/resolution/frameworks/python.js +0 -278
- package/dist/resolution/frameworks/python.js.map +0 -1
- package/dist/resolution/frameworks/react.d.ts +0 -8
- package/dist/resolution/frameworks/react.d.ts.map +0 -1
- package/dist/resolution/frameworks/react.js +0 -272
- package/dist/resolution/frameworks/react.js.map +0 -1
- package/dist/resolution/frameworks/ruby.d.ts +0 -8
- package/dist/resolution/frameworks/ruby.d.ts.map +0 -1
- package/dist/resolution/frameworks/ruby.js +0 -198
- package/dist/resolution/frameworks/ruby.js.map +0 -1
- package/dist/resolution/frameworks/rust.d.ts +0 -8
- package/dist/resolution/frameworks/rust.d.ts.map +0 -1
- package/dist/resolution/frameworks/rust.js +0 -207
- package/dist/resolution/frameworks/rust.js.map +0 -1
- package/dist/resolution/frameworks/svelte.d.ts +0 -9
- package/dist/resolution/frameworks/svelte.d.ts.map +0 -1
- package/dist/resolution/frameworks/svelte.js +0 -249
- package/dist/resolution/frameworks/svelte.js.map +0 -1
- package/dist/resolution/frameworks/swift.d.ts +0 -10
- package/dist/resolution/frameworks/swift.d.ts.map +0 -1
- package/dist/resolution/frameworks/swift.js +0 -376
- package/dist/resolution/frameworks/swift.js.map +0 -1
- package/dist/resolution/frameworks/vue.d.ts +0 -9
- package/dist/resolution/frameworks/vue.d.ts.map +0 -1
- package/dist/resolution/frameworks/vue.js +0 -306
- package/dist/resolution/frameworks/vue.js.map +0 -1
- package/dist/resolution/import-resolver.d.ts +0 -40
- package/dist/resolution/import-resolver.d.ts.map +0 -1
- package/dist/resolution/import-resolver.js +0 -663
- package/dist/resolution/import-resolver.js.map +0 -1
- package/dist/resolution/index.d.ts +0 -106
- package/dist/resolution/index.d.ts.map +0 -1
- package/dist/resolution/index.js +0 -709
- package/dist/resolution/index.js.map +0 -1
- package/dist/resolution/name-matcher.d.ts +0 -32
- package/dist/resolution/name-matcher.d.ts.map +0 -1
- package/dist/resolution/name-matcher.js +0 -384
- package/dist/resolution/name-matcher.js.map +0 -1
- package/dist/resolution/path-aliases.d.ts +0 -68
- package/dist/resolution/path-aliases.d.ts.map +0 -1
- package/dist/resolution/path-aliases.js +0 -238
- package/dist/resolution/path-aliases.js.map +0 -1
- package/dist/resolution/strip-comments.d.ts +0 -27
- package/dist/resolution/strip-comments.d.ts.map +0 -1
- package/dist/resolution/strip-comments.js +0 -441
- package/dist/resolution/strip-comments.js.map +0 -1
- package/dist/resolution/types.d.ts +0 -172
- package/dist/resolution/types.d.ts.map +0 -1
- package/dist/resolution/types.js +0 -8
- package/dist/resolution/types.js.map +0 -1
- package/dist/search/query-parser.d.ts +0 -57
- package/dist/search/query-parser.d.ts.map +0 -1
- package/dist/search/query-parser.js +0 -177
- package/dist/search/query-parser.js.map +0 -1
- package/dist/search/query-utils.d.ts +0 -53
- package/dist/search/query-utils.d.ts.map +0 -1
- package/dist/search/query-utils.js +0 -347
- package/dist/search/query-utils.js.map +0 -1
- package/dist/sync/index.d.ts +0 -13
- package/dist/sync/index.d.ts.map +0 -1
- package/dist/sync/index.js +0 -17
- package/dist/sync/index.js.map +0 -1
- package/dist/sync/watcher.d.ts +0 -81
- package/dist/sync/watcher.d.ts.map +0 -1
- package/dist/sync/watcher.js +0 -184
- package/dist/sync/watcher.js.map +0 -1
- package/dist/types.d.ts +0 -423
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -256
- package/dist/types.js.map +0 -1
- package/dist/ui/glyphs.d.ts +0 -42
- package/dist/ui/glyphs.d.ts.map +0 -1
- package/dist/ui/glyphs.js +0 -78
- package/dist/ui/glyphs.js.map +0 -1
- package/dist/ui/shimmer-progress.d.ts +0 -11
- package/dist/ui/shimmer-progress.d.ts.map +0 -1
- package/dist/ui/shimmer-progress.js +0 -90
- package/dist/ui/shimmer-progress.js.map +0 -1
- package/dist/ui/shimmer-worker.d.ts +0 -2
- package/dist/ui/shimmer-worker.d.ts.map +0 -1
- package/dist/ui/shimmer-worker.js +0 -118
- package/dist/ui/shimmer-worker.js.map +0 -1
- package/dist/ui/types.d.ts +0 -17
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/ui/types.js +0 -3
- package/dist/ui/types.js.map +0 -1
- package/dist/utils.d.ts +0 -205
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -549
- package/dist/utils.js.map +0 -1
- package/scripts/local-install.sh +0 -41
- package/scripts/patch-tree-sitter-dart.js +0 -112
- package/scripts/release.sh +0 -70
package/dist/directory.js
DELETED
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Directory Management
|
|
4
|
-
*
|
|
5
|
-
* Manages the .codegraph/ directory structure for CodeGraph data.
|
|
6
|
-
*/
|
|
7
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
-
if (k2 === undefined) k2 = k;
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
-
var ownKeys = function(o) {
|
|
25
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
-
var ar = [];
|
|
27
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
-
return ar;
|
|
29
|
-
};
|
|
30
|
-
return ownKeys(o);
|
|
31
|
-
};
|
|
32
|
-
return function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
-
exports.CODEGRAPH_DIR = void 0;
|
|
42
|
-
exports.getCodeGraphDir = getCodeGraphDir;
|
|
43
|
-
exports.isInitialized = isInitialized;
|
|
44
|
-
exports.findNearestCodeGraphRoot = findNearestCodeGraphRoot;
|
|
45
|
-
exports.createDirectory = createDirectory;
|
|
46
|
-
exports.removeDirectory = removeDirectory;
|
|
47
|
-
exports.listDirectoryContents = listDirectoryContents;
|
|
48
|
-
exports.getDirectorySize = getDirectorySize;
|
|
49
|
-
exports.ensureSubdirectory = ensureSubdirectory;
|
|
50
|
-
exports.validateDirectory = validateDirectory;
|
|
51
|
-
const fs = __importStar(require("fs"));
|
|
52
|
-
const path = __importStar(require("path"));
|
|
53
|
-
/**
|
|
54
|
-
* CodeGraph directory name
|
|
55
|
-
*/
|
|
56
|
-
exports.CODEGRAPH_DIR = '.codegraph';
|
|
57
|
-
/**
|
|
58
|
-
* Get the .codegraph directory path for a project
|
|
59
|
-
*/
|
|
60
|
-
function getCodeGraphDir(projectRoot) {
|
|
61
|
-
return path.join(projectRoot, exports.CODEGRAPH_DIR);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Check if a project has been initialized with CodeGraph
|
|
65
|
-
* Requires both .codegraph/ directory AND codegraph.db to exist
|
|
66
|
-
*/
|
|
67
|
-
function isInitialized(projectRoot) {
|
|
68
|
-
const codegraphDir = getCodeGraphDir(projectRoot);
|
|
69
|
-
if (!fs.existsSync(codegraphDir) || !fs.statSync(codegraphDir).isDirectory()) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
// Must have codegraph.db, not just .codegraph folder
|
|
73
|
-
const dbPath = path.join(codegraphDir, 'codegraph.db');
|
|
74
|
-
return fs.existsSync(dbPath);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Find the nearest parent directory containing .codegraph/
|
|
78
|
-
*
|
|
79
|
-
* Walks up from the given path to find a CodeGraph-initialized project,
|
|
80
|
-
* similar to how git finds .git/ directories.
|
|
81
|
-
*
|
|
82
|
-
* @param startPath - Directory to start searching from
|
|
83
|
-
* @returns The project root containing .codegraph/, or null if not found
|
|
84
|
-
*/
|
|
85
|
-
function findNearestCodeGraphRoot(startPath) {
|
|
86
|
-
let current = path.resolve(startPath);
|
|
87
|
-
const root = path.parse(current).root;
|
|
88
|
-
while (current !== root) {
|
|
89
|
-
if (isInitialized(current)) {
|
|
90
|
-
return current;
|
|
91
|
-
}
|
|
92
|
-
const parent = path.dirname(current);
|
|
93
|
-
if (parent === current)
|
|
94
|
-
break; // Reached filesystem root
|
|
95
|
-
current = parent;
|
|
96
|
-
}
|
|
97
|
-
// Check root as well
|
|
98
|
-
if (isInitialized(current)) {
|
|
99
|
-
return current;
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Create the .codegraph directory structure
|
|
105
|
-
* Note: Only throws if codegraph.db already exists, not just if .codegraph/ exists.
|
|
106
|
-
*/
|
|
107
|
-
function createDirectory(projectRoot) {
|
|
108
|
-
const codegraphDir = getCodeGraphDir(projectRoot);
|
|
109
|
-
const dbPath = path.join(codegraphDir, 'codegraph.db');
|
|
110
|
-
// Only throw if CodeGraph is actually initialized (db exists)
|
|
111
|
-
// .codegraph/ folder alone is fine
|
|
112
|
-
if (fs.existsSync(dbPath)) {
|
|
113
|
-
throw new Error(`CodeGraph already initialized in ${projectRoot}`);
|
|
114
|
-
}
|
|
115
|
-
// Create main directory (if it doesn't exist)
|
|
116
|
-
fs.mkdirSync(codegraphDir, { recursive: true });
|
|
117
|
-
// Create .gitignore inside .codegraph (if it doesn't exist)
|
|
118
|
-
const gitignorePath = path.join(codegraphDir, '.gitignore');
|
|
119
|
-
if (!fs.existsSync(gitignorePath)) {
|
|
120
|
-
const gitignoreContent = `# CodeGraph data files
|
|
121
|
-
# These are local to each machine and should not be committed
|
|
122
|
-
|
|
123
|
-
# Database
|
|
124
|
-
*.db
|
|
125
|
-
*.db-wal
|
|
126
|
-
*.db-shm
|
|
127
|
-
|
|
128
|
-
# Cache
|
|
129
|
-
cache/
|
|
130
|
-
|
|
131
|
-
# Logs
|
|
132
|
-
*.log
|
|
133
|
-
|
|
134
|
-
# Hook markers
|
|
135
|
-
.dirty
|
|
136
|
-
`;
|
|
137
|
-
fs.writeFileSync(gitignorePath, gitignoreContent, 'utf-8');
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Remove the .codegraph directory
|
|
142
|
-
*/
|
|
143
|
-
function removeDirectory(projectRoot) {
|
|
144
|
-
const codegraphDir = getCodeGraphDir(projectRoot);
|
|
145
|
-
if (!fs.existsSync(codegraphDir)) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
// Verify .codegraph is a real directory, not a symlink pointing elsewhere
|
|
149
|
-
const lstat = fs.lstatSync(codegraphDir);
|
|
150
|
-
if (lstat.isSymbolicLink()) {
|
|
151
|
-
// Only remove the symlink itself, never follow it for recursive delete
|
|
152
|
-
fs.unlinkSync(codegraphDir);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (!lstat.isDirectory()) {
|
|
156
|
-
// Not a directory - remove the single file
|
|
157
|
-
fs.unlinkSync(codegraphDir);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
// Recursively remove directory
|
|
161
|
-
fs.rmSync(codegraphDir, { recursive: true, force: true });
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Get all files in the .codegraph directory
|
|
165
|
-
*/
|
|
166
|
-
function listDirectoryContents(projectRoot) {
|
|
167
|
-
const codegraphDir = getCodeGraphDir(projectRoot);
|
|
168
|
-
if (!fs.existsSync(codegraphDir)) {
|
|
169
|
-
return [];
|
|
170
|
-
}
|
|
171
|
-
const files = [];
|
|
172
|
-
function walkDir(dir, prefix = '') {
|
|
173
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
174
|
-
for (const entry of entries) {
|
|
175
|
-
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
176
|
-
// Skip symlinks to prevent following links outside .codegraph
|
|
177
|
-
if (entry.isSymbolicLink()) {
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
if (entry.isDirectory()) {
|
|
181
|
-
walkDir(path.join(dir, entry.name), relativePath);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
files.push(relativePath);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
walkDir(codegraphDir);
|
|
189
|
-
return files;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Get the total size of the .codegraph directory in bytes
|
|
193
|
-
*/
|
|
194
|
-
function getDirectorySize(projectRoot) {
|
|
195
|
-
const codegraphDir = getCodeGraphDir(projectRoot);
|
|
196
|
-
if (!fs.existsSync(codegraphDir)) {
|
|
197
|
-
return 0;
|
|
198
|
-
}
|
|
199
|
-
let totalSize = 0;
|
|
200
|
-
function walkDir(dir) {
|
|
201
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
202
|
-
for (const entry of entries) {
|
|
203
|
-
// Skip symlinks to prevent following links outside .codegraph
|
|
204
|
-
if (entry.isSymbolicLink()) {
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
const fullPath = path.join(dir, entry.name);
|
|
208
|
-
if (entry.isDirectory()) {
|
|
209
|
-
walkDir(fullPath);
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
const stats = fs.statSync(fullPath);
|
|
213
|
-
totalSize += stats.size;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
walkDir(codegraphDir);
|
|
218
|
-
return totalSize;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Ensure a subdirectory exists within .codegraph
|
|
222
|
-
*/
|
|
223
|
-
function ensureSubdirectory(projectRoot, subdirName) {
|
|
224
|
-
if (subdirName.includes('..') || subdirName.includes(path.sep) || subdirName.includes('/')) {
|
|
225
|
-
throw new Error(`Invalid subdirectory name: ${subdirName}`);
|
|
226
|
-
}
|
|
227
|
-
const subdirPath = path.join(getCodeGraphDir(projectRoot), subdirName);
|
|
228
|
-
if (!fs.existsSync(subdirPath)) {
|
|
229
|
-
fs.mkdirSync(subdirPath, { recursive: true });
|
|
230
|
-
}
|
|
231
|
-
return subdirPath;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Check if the .codegraph directory has valid structure
|
|
235
|
-
*/
|
|
236
|
-
function validateDirectory(projectRoot) {
|
|
237
|
-
const errors = [];
|
|
238
|
-
const codegraphDir = getCodeGraphDir(projectRoot);
|
|
239
|
-
if (!fs.existsSync(codegraphDir)) {
|
|
240
|
-
errors.push('CodeGraph directory does not exist');
|
|
241
|
-
return { valid: false, errors };
|
|
242
|
-
}
|
|
243
|
-
if (!fs.statSync(codegraphDir).isDirectory()) {
|
|
244
|
-
errors.push('.codegraph exists but is not a directory');
|
|
245
|
-
return { valid: false, errors };
|
|
246
|
-
}
|
|
247
|
-
// Auto-repair missing .gitignore (non-critical file)
|
|
248
|
-
const gitignorePath = path.join(codegraphDir, '.gitignore');
|
|
249
|
-
if (!fs.existsSync(gitignorePath)) {
|
|
250
|
-
try {
|
|
251
|
-
const gitignoreContent = `# CodeGraph data files\n# These are local to each machine and should not be committed\n\n# Database\n*.db\n*.db-wal\n*.db-shm\n\n# Cache\ncache/\n\n# Logs\n*.log\n\n# Hook markers\n.dirty\n`;
|
|
252
|
-
fs.writeFileSync(gitignorePath, gitignoreContent, 'utf-8');
|
|
253
|
-
}
|
|
254
|
-
catch {
|
|
255
|
-
// Non-fatal: warn but don't block
|
|
256
|
-
errors.push('.gitignore missing in .codegraph directory and could not be created');
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
valid: errors.length === 0,
|
|
261
|
-
errors,
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
//# sourceMappingURL=directory.js.map
|
package/dist/directory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaH,0CAEC;AAMD,sCAQC;AAWD,4DAmBC;AAMD,0CAoCC;AAKD,0CAuBC;AAKD,sDA8BC;AAKD,4CA+BC;AAKD,gDAYC;AAKD,8CAiCC;AA7PD,uCAAyB;AACzB,2CAA6B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AAC,MAAM,KAAK,CAAC;QAC1B,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CodeGraph Error Classes
|
|
3
|
-
*
|
|
4
|
-
* Custom error types for better error handling and debugging.
|
|
5
|
-
*
|
|
6
|
-
* @module errors
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import { FileError, ParseError, setLogger, silentLogger } from 'codegraph';
|
|
11
|
-
*
|
|
12
|
-
* // Catch specific error types
|
|
13
|
-
* try {
|
|
14
|
-
* await cg.indexAll();
|
|
15
|
-
* } catch (error) {
|
|
16
|
-
* if (error instanceof FileError) {
|
|
17
|
-
* console.log(`File error at ${error.filePath}: ${error.message}`);
|
|
18
|
-
* } else if (error instanceof ParseError) {
|
|
19
|
-
* console.log(`Parse error at ${error.filePath}:${error.line}`);
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* // Disable logging for tests
|
|
24
|
-
* setLogger(silentLogger);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Base error class for all CodeGraph errors.
|
|
29
|
-
*
|
|
30
|
-
* All CodeGraph-specific errors extend this class, allowing you to catch
|
|
31
|
-
* all CodeGraph errors with a single catch block.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* try {
|
|
36
|
-
* await cg.indexAll();
|
|
37
|
-
* } catch (error) {
|
|
38
|
-
* if (error instanceof CodeGraphError) {
|
|
39
|
-
* console.log(`CodeGraph error [${error.code}]: ${error.message}`);
|
|
40
|
-
* }
|
|
41
|
-
* }
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export declare class CodeGraphError extends Error {
|
|
45
|
-
/** Error code for categorization (e.g., 'FILE_ERROR', 'PARSE_ERROR') */
|
|
46
|
-
readonly code: string;
|
|
47
|
-
/** Additional context about the error */
|
|
48
|
-
readonly context?: Record<string, unknown>;
|
|
49
|
-
constructor(message: string, code: string, context?: Record<string, unknown>);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Error reading or accessing files
|
|
53
|
-
*/
|
|
54
|
-
export declare class FileError extends CodeGraphError {
|
|
55
|
-
readonly filePath: string;
|
|
56
|
-
constructor(message: string, filePath: string, cause?: Error);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Error parsing source code
|
|
60
|
-
*/
|
|
61
|
-
export declare class ParseError extends CodeGraphError {
|
|
62
|
-
readonly filePath: string;
|
|
63
|
-
readonly line?: number;
|
|
64
|
-
readonly column?: number;
|
|
65
|
-
constructor(message: string, filePath: string, options?: {
|
|
66
|
-
line?: number;
|
|
67
|
-
column?: number;
|
|
68
|
-
cause?: Error;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Error with database operations
|
|
73
|
-
*/
|
|
74
|
-
export declare class DatabaseError extends CodeGraphError {
|
|
75
|
-
readonly operation: string;
|
|
76
|
-
constructor(message: string, operation: string, cause?: Error);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Error with search operations
|
|
80
|
-
*/
|
|
81
|
-
export declare class SearchError extends CodeGraphError {
|
|
82
|
-
readonly query: string;
|
|
83
|
-
constructor(message: string, query: string, cause?: Error);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Error with vector/embedding operations
|
|
87
|
-
*/
|
|
88
|
-
export declare class VectorError extends CodeGraphError {
|
|
89
|
-
constructor(message: string, operation: string, cause?: Error);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Error with configuration
|
|
93
|
-
*/
|
|
94
|
-
export declare class ConfigError extends CodeGraphError {
|
|
95
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Simple logger for CodeGraph operations
|
|
99
|
-
*
|
|
100
|
-
* By default, logs to console.warn for warnings and console.error for errors.
|
|
101
|
-
* Can be configured to use custom logging.
|
|
102
|
-
*/
|
|
103
|
-
export interface Logger {
|
|
104
|
-
debug(message: string, context?: Record<string, unknown>): void;
|
|
105
|
-
warn(message: string, context?: Record<string, unknown>): void;
|
|
106
|
-
error(message: string, context?: Record<string, unknown>): void;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Default console-based logger
|
|
110
|
-
*/
|
|
111
|
-
export declare const defaultLogger: Logger;
|
|
112
|
-
/**
|
|
113
|
-
* Silent logger (no output) - useful for tests
|
|
114
|
-
*/
|
|
115
|
-
export declare const silentLogger: Logger;
|
|
116
|
-
/**
|
|
117
|
-
* Set the global logger
|
|
118
|
-
*/
|
|
119
|
-
export declare function setLogger(logger: Logger): void;
|
|
120
|
-
/**
|
|
121
|
-
* Get the current logger
|
|
122
|
-
*/
|
|
123
|
-
export declare function getLogger(): Logger;
|
|
124
|
-
/**
|
|
125
|
-
* Log a debug message
|
|
126
|
-
*/
|
|
127
|
-
export declare function logDebug(message: string, context?: Record<string, unknown>): void;
|
|
128
|
-
/**
|
|
129
|
-
* Log a warning message
|
|
130
|
-
*/
|
|
131
|
-
export declare function logWarn(message: string, context?: Record<string, unknown>): void;
|
|
132
|
-
/**
|
|
133
|
-
* Log an error message
|
|
134
|
-
*/
|
|
135
|
-
export declare function logError(message: string, context?: Record<string, unknown>): void;
|
|
136
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAy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
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* CodeGraph Error Classes
|
|
4
|
-
*
|
|
5
|
-
* Custom error types for better error handling and debugging.
|
|
6
|
-
*
|
|
7
|
-
* @module errors
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { FileError, ParseError, setLogger, silentLogger } from 'codegraph';
|
|
12
|
-
*
|
|
13
|
-
* // Catch specific error types
|
|
14
|
-
* try {
|
|
15
|
-
* await cg.indexAll();
|
|
16
|
-
* } catch (error) {
|
|
17
|
-
* if (error instanceof FileError) {
|
|
18
|
-
* console.log(`File error at ${error.filePath}: ${error.message}`);
|
|
19
|
-
* } else if (error instanceof ParseError) {
|
|
20
|
-
* console.log(`Parse error at ${error.filePath}:${error.line}`);
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
*
|
|
24
|
-
* // Disable logging for tests
|
|
25
|
-
* setLogger(silentLogger);
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.silentLogger = exports.defaultLogger = exports.ConfigError = exports.VectorError = exports.SearchError = exports.DatabaseError = exports.ParseError = exports.FileError = exports.CodeGraphError = void 0;
|
|
30
|
-
exports.setLogger = setLogger;
|
|
31
|
-
exports.getLogger = getLogger;
|
|
32
|
-
exports.logDebug = logDebug;
|
|
33
|
-
exports.logWarn = logWarn;
|
|
34
|
-
exports.logError = logError;
|
|
35
|
-
/**
|
|
36
|
-
* Base error class for all CodeGraph errors.
|
|
37
|
-
*
|
|
38
|
-
* All CodeGraph-specific errors extend this class, allowing you to catch
|
|
39
|
-
* all CodeGraph errors with a single catch block.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* try {
|
|
44
|
-
* await cg.indexAll();
|
|
45
|
-
* } catch (error) {
|
|
46
|
-
* if (error instanceof CodeGraphError) {
|
|
47
|
-
* console.log(`CodeGraph error [${error.code}]: ${error.message}`);
|
|
48
|
-
* }
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
class CodeGraphError extends Error {
|
|
53
|
-
/** Error code for categorization (e.g., 'FILE_ERROR', 'PARSE_ERROR') */
|
|
54
|
-
code;
|
|
55
|
-
/** Additional context about the error */
|
|
56
|
-
context;
|
|
57
|
-
constructor(message, code, context) {
|
|
58
|
-
super(message);
|
|
59
|
-
this.name = 'CodeGraphError';
|
|
60
|
-
this.code = code;
|
|
61
|
-
this.context = context;
|
|
62
|
-
// Maintain proper stack trace for V8
|
|
63
|
-
if (Error.captureStackTrace) {
|
|
64
|
-
Error.captureStackTrace(this, this.constructor);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.CodeGraphError = CodeGraphError;
|
|
69
|
-
/**
|
|
70
|
-
* Error reading or accessing files
|
|
71
|
-
*/
|
|
72
|
-
class FileError extends CodeGraphError {
|
|
73
|
-
filePath;
|
|
74
|
-
constructor(message, filePath, cause) {
|
|
75
|
-
super(message, 'FILE_ERROR', { filePath, cause: cause?.message });
|
|
76
|
-
this.name = 'FileError';
|
|
77
|
-
this.filePath = filePath;
|
|
78
|
-
if (cause) {
|
|
79
|
-
this.cause = cause;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.FileError = FileError;
|
|
84
|
-
/**
|
|
85
|
-
* Error parsing source code
|
|
86
|
-
*/
|
|
87
|
-
class ParseError extends CodeGraphError {
|
|
88
|
-
filePath;
|
|
89
|
-
line;
|
|
90
|
-
column;
|
|
91
|
-
constructor(message, filePath, options) {
|
|
92
|
-
super(message, 'PARSE_ERROR', {
|
|
93
|
-
filePath,
|
|
94
|
-
line: options?.line,
|
|
95
|
-
column: options?.column,
|
|
96
|
-
cause: options?.cause?.message,
|
|
97
|
-
});
|
|
98
|
-
this.name = 'ParseError';
|
|
99
|
-
this.filePath = filePath;
|
|
100
|
-
this.line = options?.line;
|
|
101
|
-
this.column = options?.column;
|
|
102
|
-
if (options?.cause) {
|
|
103
|
-
this.cause = options.cause;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.ParseError = ParseError;
|
|
108
|
-
/**
|
|
109
|
-
* Error with database operations
|
|
110
|
-
*/
|
|
111
|
-
class DatabaseError extends CodeGraphError {
|
|
112
|
-
operation;
|
|
113
|
-
constructor(message, operation, cause) {
|
|
114
|
-
super(message, 'DATABASE_ERROR', { operation, cause: cause?.message });
|
|
115
|
-
this.name = 'DatabaseError';
|
|
116
|
-
this.operation = operation;
|
|
117
|
-
if (cause) {
|
|
118
|
-
this.cause = cause;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
exports.DatabaseError = DatabaseError;
|
|
123
|
-
/**
|
|
124
|
-
* Error with search operations
|
|
125
|
-
*/
|
|
126
|
-
class SearchError extends CodeGraphError {
|
|
127
|
-
query;
|
|
128
|
-
constructor(message, query, cause) {
|
|
129
|
-
super(message, 'SEARCH_ERROR', { query, cause: cause?.message });
|
|
130
|
-
this.name = 'SearchError';
|
|
131
|
-
this.query = query;
|
|
132
|
-
if (cause) {
|
|
133
|
-
this.cause = cause;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.SearchError = SearchError;
|
|
138
|
-
/**
|
|
139
|
-
* Error with vector/embedding operations
|
|
140
|
-
*/
|
|
141
|
-
class VectorError extends CodeGraphError {
|
|
142
|
-
constructor(message, operation, cause) {
|
|
143
|
-
super(message, 'VECTOR_ERROR', { operation, cause: cause?.message });
|
|
144
|
-
this.name = 'VectorError';
|
|
145
|
-
if (cause) {
|
|
146
|
-
this.cause = cause;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.VectorError = VectorError;
|
|
151
|
-
/**
|
|
152
|
-
* Error with configuration
|
|
153
|
-
*/
|
|
154
|
-
class ConfigError extends CodeGraphError {
|
|
155
|
-
constructor(message, details) {
|
|
156
|
-
super(message, 'CONFIG_ERROR', details);
|
|
157
|
-
this.name = 'ConfigError';
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.ConfigError = ConfigError;
|
|
161
|
-
/**
|
|
162
|
-
* Default console-based logger
|
|
163
|
-
*/
|
|
164
|
-
exports.defaultLogger = {
|
|
165
|
-
debug(message, context) {
|
|
166
|
-
if (process.env.CODEGRAPH_DEBUG) {
|
|
167
|
-
console.debug(`[CodeGraph] ${message}`, context ?? '');
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
warn(message, context) {
|
|
171
|
-
console.warn(`[CodeGraph] ${message}`, context ?? '');
|
|
172
|
-
},
|
|
173
|
-
error(message, context) {
|
|
174
|
-
console.error(`[CodeGraph] ${message}`, context ?? '');
|
|
175
|
-
},
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* Silent logger (no output) - useful for tests
|
|
179
|
-
*/
|
|
180
|
-
exports.silentLogger = {
|
|
181
|
-
debug() { },
|
|
182
|
-
warn() { },
|
|
183
|
-
error() { },
|
|
184
|
-
};
|
|
185
|
-
/**
|
|
186
|
-
* Current logger instance (can be replaced)
|
|
187
|
-
*/
|
|
188
|
-
let currentLogger = exports.defaultLogger;
|
|
189
|
-
/**
|
|
190
|
-
* Set the global logger
|
|
191
|
-
*/
|
|
192
|
-
function setLogger(logger) {
|
|
193
|
-
currentLogger = logger;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Get the current logger
|
|
197
|
-
*/
|
|
198
|
-
function getLogger() {
|
|
199
|
-
return currentLogger;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Log a debug message
|
|
203
|
-
*/
|
|
204
|
-
function logDebug(message, context) {
|
|
205
|
-
currentLogger.debug(message, context);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Log a warning message
|
|
209
|
-
*/
|
|
210
|
-
function logWarn(message, context) {
|
|
211
|
-
currentLogger.warn(message, context);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Log an error message
|
|
215
|
-
*/
|
|
216
|
-
function logError(message, context) {
|
|
217
|
-
currentLogger.error(message, context);
|
|
218
|
-
}
|
|
219
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAwLH,8BAEC;AAKD,8BAEC;AAKD,4BAEC;AAKD,0BAEC;AAKD,4BAEC;AApND;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,cAAe,SAAQ,KAAK;IACvC,wEAAwE;IAC/D,IAAI,CAAS;IACtB,yCAAyC;IAChC,OAAO,CAA2B;IAE3C,YAAY,OAAe,EAAE,IAAY,EAAE,OAAiC;QAC1E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,qCAAqC;QACrC,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;CACF;AAjBD,wCAiBC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,cAAc;IAClC,QAAQ,CAAS;IAE1B,YAAY,OAAe,EAAE,QAAgB,EAAE,KAAa;QAC1D,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,QAAQ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,OAAO,CAAC,IAAI,CAAC,eAAe,OAAO,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,KAAK,CAAC,OAAe,EAAE,OAAiC;QACtD,OAAO,CAAC,KAAK,CAAC,eAAe,OAAO,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IACzD,CAAC;CACF,CAAC;AAEF;;GAEG;AACU,QAAA,YAAY,GAAW;IAClC,KAAK,KAAU,CAAC;IAChB,IAAI,KAAU,CAAC;IACf,KAAK,KAAU,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,IAAI,aAAa,GAAW,qBAAa,CAAC;AAE1C;;GAEG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,aAAa,GAAG,MAAM,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS;IACvB,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAe,EAAE,OAAiC;IACzE,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,SAAgB,OAAO,CAAC,OAAe,EAAE,OAAiC;IACxE,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAgB,QAAQ,CAAC,OAAe,EAAE,OAAiC;IACzE,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ExtractionResult } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Custom extractor for Delphi DFM/FMX form files.
|
|
4
|
-
*
|
|
5
|
-
* DFM/FMX files describe the visual component hierarchy and event handler
|
|
6
|
-
* bindings. They use a simple text format (object/end blocks) that we parse
|
|
7
|
-
* with regex — no tree-sitter grammar exists for this format.
|
|
8
|
-
*
|
|
9
|
-
* Extracted information:
|
|
10
|
-
* - Components as NodeKind `component`
|
|
11
|
-
* - Nesting as EdgeKind `contains`
|
|
12
|
-
* - Event handlers (OnClick = MethodName) as UnresolvedReference → EdgeKind `references`
|
|
13
|
-
*/
|
|
14
|
-
export declare class DfmExtractor {
|
|
15
|
-
private filePath;
|
|
16
|
-
private source;
|
|
17
|
-
private nodes;
|
|
18
|
-
private edges;
|
|
19
|
-
private unresolvedReferences;
|
|
20
|
-
private errors;
|
|
21
|
-
constructor(filePath: string, source: string);
|
|
22
|
-
/**
|
|
23
|
-
* Extract components and event handler references from DFM/FMX source
|
|
24
|
-
*/
|
|
25
|
-
extract(): ExtractionResult;
|
|
26
|
-
/** Create a file node for the DFM form file */
|
|
27
|
-
private createFileNode;
|
|
28
|
-
/** Parse object/end blocks and extract components + event handlers */
|
|
29
|
-
private parseComponents;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=dfm-extractor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dfm-extractor.d.ts","sourceRoot":"","sources":["../../src/extraction/dfm-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAwC,MAAM,UAAU,CAAC;AAG9F;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,MAAM,CAAyB;gBAE3B,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAK5C;;OAEG;IACH,OAAO,IAAI,gBAAgB;IAuB3B,+CAA+C;IAC/C,OAAO,CAAC,cAAc;IAsBtB,sEAAsE;IACtE,OAAO,CAAC,eAAe;CAgFxB"}
|