indexer-cli 0.2.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/README.md +156 -0
- package/bin/indexer-cli.js +97 -0
- package/dist/_temp_test.d.ts +1 -0
- package/dist/_temp_test.js +4 -0
- package/dist/_temp_test.js.map +1 -0
- package/dist/chunking/adaptive.d.ts +15 -0
- package/dist/chunking/adaptive.js +43 -0
- package/dist/chunking/adaptive.js.map +1 -0
- package/dist/chunking/function.d.ts +6 -0
- package/dist/chunking/function.js +96 -0
- package/dist/chunking/function.js.map +1 -0
- package/dist/chunking/index.d.ts +5 -0
- package/dist/chunking/index.js +22 -0
- package/dist/chunking/index.js.map +1 -0
- package/dist/chunking/module.d.ts +6 -0
- package/dist/chunking/module.js +33 -0
- package/dist/chunking/module.js.map +1 -0
- package/dist/chunking/single.d.ts +4 -0
- package/dist/chunking/single.js +19 -0
- package/dist/chunking/single.js.map +1 -0
- package/dist/chunking/types.d.ts +17 -0
- package/dist/chunking/types.js +3 -0
- package/dist/chunking/types.js.map +1 -0
- package/dist/cli/commands/architecture.d.ts +2 -0
- package/dist/cli/commands/architecture.js +162 -0
- package/dist/cli/commands/architecture.js.map +1 -0
- package/dist/cli/commands/context.d.ts +2 -0
- package/dist/cli/commands/context.js +241 -0
- package/dist/cli/commands/context.js.map +1 -0
- package/dist/cli/commands/deps.d.ts +2 -0
- package/dist/cli/commands/deps.js +129 -0
- package/dist/cli/commands/deps.js.map +1 -0
- package/dist/cli/commands/enrich.d.ts +2 -0
- package/dist/cli/commands/ensure-indexed.d.ts +4 -0
- package/dist/cli/commands/ensure-indexed.js +168 -0
- package/dist/cli/commands/ensure-indexed.js.map +1 -0
- package/dist/cli/commands/explain.d.ts +2 -0
- package/dist/cli/commands/explain.js +165 -0
- package/dist/cli/commands/explain.js.map +1 -0
- package/dist/cli/commands/index.d.ts +2 -0
- package/dist/cli/commands/index.js +271 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +132 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/search.d.ts +2 -0
- package/dist/cli/commands/search.js +206 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +2 -0
- package/dist/cli/commands/setup.js +425 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/skill-template.d.ts +6 -0
- package/dist/cli/commands/skill-template.js +72 -0
- package/dist/cli/commands/skill-template.js.map +1 -0
- package/dist/cli/commands/structure.d.ts +2 -0
- package/dist/cli/commands/structure.js +243 -0
- package/dist/cli/commands/structure.js.map +1 -0
- package/dist/cli/commands/uninstall.d.ts +2 -0
- package/dist/cli/commands/uninstall.js +138 -0
- package/dist/cli/commands/uninstall.js.map +1 -0
- package/dist/cli/entry.d.ts +1 -0
- package/dist/cli/entry.js +55 -0
- package/dist/cli/entry.js.map +1 -0
- package/dist/cli/help-text.d.ts +2 -0
- package/dist/cli/help-text.js +9 -0
- package/dist/cli/help-text.js.map +1 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +9 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/core/config.d.ts +21 -0
- package/dist/core/config.js +77 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/logger.d.ts +19 -0
- package/dist/core/logger.js +116 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/types.d.ts +194 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/update-check.d.ts +1 -0
- package/dist/core/update-check.js +61 -0
- package/dist/core/update-check.js.map +1 -0
- package/dist/embedding/ollama.d.ts +29 -0
- package/dist/embedding/ollama.js +264 -0
- package/dist/embedding/ollama.js.map +1 -0
- package/dist/engine/architecture.d.ts +55 -0
- package/dist/engine/architecture.js +359 -0
- package/dist/engine/architecture.js.map +1 -0
- package/dist/engine/dependency-resolver.d.ts +4 -0
- package/dist/engine/dependency-resolver.js +69 -0
- package/dist/engine/dependency-resolver.js.map +1 -0
- package/dist/engine/git.d.ts +11 -0
- package/dist/engine/git.js +246 -0
- package/dist/engine/git.js.map +1 -0
- package/dist/engine/indexer.d.ts +86 -0
- package/dist/engine/indexer.js +933 -0
- package/dist/engine/indexer.js.map +1 -0
- package/dist/engine/scanner.d.ts +1 -0
- package/dist/engine/scanner.js +42 -0
- package/dist/engine/scanner.js.map +1 -0
- package/dist/engine/searcher.d.ts +26 -0
- package/dist/engine/searcher.js +70 -0
- package/dist/engine/searcher.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/languages/csharp.d.ts +25 -0
- package/dist/languages/csharp.js +311 -0
- package/dist/languages/csharp.js.map +1 -0
- package/dist/languages/gdscript.d.ts +25 -0
- package/dist/languages/gdscript.js +382 -0
- package/dist/languages/gdscript.js.map +1 -0
- package/dist/languages/plugin.d.ts +73 -0
- package/dist/languages/plugin.js +35 -0
- package/dist/languages/plugin.js.map +1 -0
- package/dist/languages/python.d.ts +24 -0
- package/dist/languages/python.js +292 -0
- package/dist/languages/python.js.map +1 -0
- package/dist/languages/ruby.d.ts +25 -0
- package/dist/languages/ruby.js +328 -0
- package/dist/languages/ruby.js.map +1 -0
- package/dist/languages/typescript.d.ts +21 -0
- package/dist/languages/typescript.js +439 -0
- package/dist/languages/typescript.js.map +1 -0
- package/dist/storage/sqlite.d.ts +51 -0
- package/dist/storage/sqlite.js +726 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/storage/vectors.d.ts +39 -0
- package/dist/storage/vectors.js +450 -0
- package/dist/storage/vectors.js.map +1 -0
- package/dist/utils/gitignore.d.ts +4 -0
- package/dist/utils/gitignore.js +85 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +12 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/token-estimator.d.ts +3 -0
- package/dist/utils/token-estimator.js +13 -0
- package/dist/utils/token-estimator.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# indexer-cli
|
|
2
|
+
|
|
3
|
+
Project indexer that installs a repo-discovery skill for coding agents and helps them spend fewer tokens finding the right code.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The main feature of `indexer-cli` is not just search on its own: it turns your repository into something coding agents
|
|
8
|
+
can navigate efficiently. Running `indexer-cli init` installs a project-local `repo-discovery` skill that nudges Claude,
|
|
9
|
+
OpenCode, and similar tools to use indexed repository discovery first instead of wasting tokens on blind `grep`,
|
|
10
|
+
`find`, and repeated file reads.
|
|
11
|
+
|
|
12
|
+
Under the hood, `indexer-cli` indexes source code, generates vector embeddings through a local Ollama instance, and
|
|
13
|
+
stores everything in a per-project `.indexer-cli/` directory. That gives both humans and agents fast natural-language
|
|
14
|
+
search, repo structure snapshots, and low-friction incremental reindexing without any daemon or background service.
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Code-agent repo skill**: `init` installs a project-local `repo-discovery` skill for Claude and OpenCode workflows
|
|
19
|
+
- **Token savings for agents**: Pushes agents toward indexed discovery instead of expensive blind search and repeated context loading
|
|
20
|
+
- **Multi-language support**: TypeScript/JavaScript, Python, C#, GDScript, Ruby
|
|
21
|
+
- **Semantic code search**: Natural language queries over your entire codebase
|
|
22
|
+
- **Incremental indexing**: Uses `git diff` to re-index only changed files, bulk-copies unchanged vectors
|
|
23
|
+
- **Local-first**: All data stored in `.indexer-cli/` inside the project (SQLite + LanceDB)
|
|
24
|
+
- **Ollama-powered embeddings**: Uses `jina-8k` model (768-dim vectors) via a local Ollama instance
|
|
25
|
+
- **Architecture snapshot**: Generates dependency graphs, entry points, and file stats
|
|
26
|
+
- **Symbol extraction**: Functions, classes, interfaces, and imports are all indexed
|
|
27
|
+
- **Adaptive chunking**: Smart code splitting at function, module, or single-file granularity
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
- [Ollama](https://ollama.ai) installed manually. `indexer-cli setup` will verify it, start the daemon if needed, and prepare the `jina-8k` model.
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g indexer-cli
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Requires Node.js 18+ and build tools (python3, make, C++ compiler) for native dependencies.
|
|
40
|
+
|
|
41
|
+
After installing, run `indexer-cli setup` once to verify local prerequisites and prepare the `jina-8k` model. `setup` does not auto-install Ollama; install Ollama yourself from https://ollama.com/download first.
|
|
42
|
+
|
|
43
|
+
### Uninstall
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm uninstall -g indexer-cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 1. Initialize indexing and install the repo-discovery skill
|
|
53
|
+
cd /path/to/your/project
|
|
54
|
+
indexer-cli init
|
|
55
|
+
|
|
56
|
+
# 2. Index the codebase
|
|
57
|
+
indexer-cli index
|
|
58
|
+
|
|
59
|
+
# 3. Search semantically yourself
|
|
60
|
+
indexer-cli search "authentication middleware"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
After `init`, the repo also contains `.claude/skills/repo-discovery/SKILL.md`, so coding agents can be steered toward
|
|
64
|
+
`indexer-cli search`, `indexer-cli structure`, and `indexer-cli architecture` before they start burning tokens on broad
|
|
65
|
+
filesystem scans.
|
|
66
|
+
|
|
67
|
+
## Why agents save tokens with this
|
|
68
|
+
|
|
69
|
+
Without a repo-local skill, agents often spend tokens on repetitive repository discovery: broad `grep`, repeated file
|
|
70
|
+
reads, and trial-and-error navigation. With `indexer-cli`, the skill tells them to start from indexed search and
|
|
71
|
+
structured repo views instead.
|
|
72
|
+
|
|
73
|
+
In practice, that means:
|
|
74
|
+
|
|
75
|
+
- less irrelevant context pulled into the prompt
|
|
76
|
+
- fewer repeated search passes over the same files
|
|
77
|
+
- faster navigation to the right symbol, module, or entry point
|
|
78
|
+
- better reuse of a local repo index instead of raw token-heavy exploration
|
|
79
|
+
|
|
80
|
+
## Agent Integration
|
|
81
|
+
|
|
82
|
+
When you run `indexer-cli init`, the CLI creates a project-local repo-discovery skill at
|
|
83
|
+
`.claude/skills/repo-discovery/SKILL.md` and adds `.claude/` to `.gitignore`.
|
|
84
|
+
|
|
85
|
+
That skill tells coding agents to start repository discovery with commands like:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
indexer-cli search "<query>" --json
|
|
89
|
+
indexer-cli structure --json --path-prefix src/<area>
|
|
90
|
+
indexer-cli architecture --json
|
|
91
|
+
indexer-cli index --status --json
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This is especially useful in Claude and OpenCode setups, where project-local skills can guide the agent away from
|
|
95
|
+
blind `grep`/`find` usage and toward indexed search first, which usually means less wasted context and lower token
|
|
96
|
+
usage during repo discovery.
|
|
97
|
+
|
|
98
|
+
## CLI Commands
|
|
99
|
+
|
|
100
|
+
### `indexer-cli setup`
|
|
101
|
+
|
|
102
|
+
Check system prerequisites and prepare the Ollama embedding model. `setup` can install some system tools where appropriate, but Ollama itself must be installed manually first. Works on macOS and Linux.
|
|
103
|
+
|
|
104
|
+
### `indexer-cli init`
|
|
105
|
+
|
|
106
|
+
Create the `.indexer-cli/` directory, initialize the SQLite database and LanceDB vector store, and add `.indexer-cli/`
|
|
107
|
+
to `.gitignore` in the current working directory. Also writes the project-local repo-discovery skill to
|
|
108
|
+
`.claude/skills/repo-discovery/SKILL.md` and adds `.claude/` to `.gitignore`.
|
|
109
|
+
|
|
110
|
+
### `indexer-cli index`
|
|
111
|
+
|
|
112
|
+
Index all supported source files in the current working directory.
|
|
113
|
+
|
|
114
|
+
| Option | Description |
|
|
115
|
+
|-------------|--------------------------------------------------------|
|
|
116
|
+
| `--full` | Force a full reindex instead of incremental |
|
|
117
|
+
| `--dry-run` | Preview what would be indexed without writing anything |
|
|
118
|
+
| `--status` | Show indexing status for the current project |
|
|
119
|
+
| `--tree` | Show indexed file tree (use with `--status`) |
|
|
120
|
+
| `--json` | Output status as JSON (use with `--status`) |
|
|
121
|
+
|
|
122
|
+
### `indexer-cli search <query>`
|
|
123
|
+
|
|
124
|
+
Run a semantic search against the indexed codebase. Automatically re-indexes changed files if needed.
|
|
125
|
+
|
|
126
|
+
| Option | Default | Description |
|
|
127
|
+
|--------------------------|---------|--------------------------------------------------------------------------------------------------------------|
|
|
128
|
+
| `--top-k <number>` | 10 | Number of results to return |
|
|
129
|
+
| `--path-prefix <string>` | — | Limit results to files under this path |
|
|
130
|
+
| `--chunk-types <string>` | — | Comma-separated filter: `full_file`, `imports`, `preamble`, `declaration`, `module_section`, `impl`, `types` |
|
|
131
|
+
| `--json` | — | Output results as JSON |
|
|
132
|
+
|
|
133
|
+
### `indexer-cli structure`
|
|
134
|
+
|
|
135
|
+
Print a file tree annotated with extracted symbols for the current working directory. Automatically re-indexes changed
|
|
136
|
+
files if needed.
|
|
137
|
+
|
|
138
|
+
| Option | Description |
|
|
139
|
+
|--------------------------|-----------------------------------------------------------------------------------------------------------|
|
|
140
|
+
| `--path-prefix <string>` | Limit output to files under this path |
|
|
141
|
+
| `--kind <string>` | Filter by symbol kind: `function`, `class`, `method`, `interface`, `type`, `variable`, `module`, `signal` |
|
|
142
|
+
| `--json` | Output structure as JSON |
|
|
143
|
+
|
|
144
|
+
### `indexer-cli architecture`
|
|
145
|
+
|
|
146
|
+
Print an architecture snapshot for the current working directory: file statistics, detected entry points, and a
|
|
147
|
+
dependency graph.
|
|
148
|
+
|
|
149
|
+
### `indexer-cli uninstall`
|
|
150
|
+
|
|
151
|
+
Remove the `.indexer-cli/` directory from the current working directory. Also removes the generated
|
|
152
|
+
`.claude/skills/repo-discovery/` skill directory when present, then prompts for confirmation before deleting.
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const { existsSync } = require("node:fs");
|
|
4
|
+
const { dirname, resolve } = require("node:path");
|
|
5
|
+
|
|
6
|
+
function resolveTsxCliPath({ existsSyncFn = existsSync } = {}) {
|
|
7
|
+
const fallbackPath = resolve(
|
|
8
|
+
__dirname,
|
|
9
|
+
"..",
|
|
10
|
+
"node_modules",
|
|
11
|
+
"tsx",
|
|
12
|
+
"dist",
|
|
13
|
+
"cli.mjs",
|
|
14
|
+
);
|
|
15
|
+
if (existsSyncFn(fallbackPath)) {
|
|
16
|
+
return fallbackPath;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const tsxPackageJson = require.resolve("tsx/package.json", {
|
|
21
|
+
paths: [resolve(__dirname, "..")],
|
|
22
|
+
});
|
|
23
|
+
const tsxCliPath = resolve(dirname(tsxPackageJson), "dist", "cli.mjs");
|
|
24
|
+
if (existsSyncFn(tsxCliPath)) {
|
|
25
|
+
return tsxCliPath;
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function buildLaunchSpec({
|
|
35
|
+
argv = process.argv.slice(2),
|
|
36
|
+
existsSyncFn = existsSync,
|
|
37
|
+
} = {}) {
|
|
38
|
+
const distEntry = resolve(__dirname, "..", "dist", "cli", "entry.js");
|
|
39
|
+
if (existsSyncFn(distEntry)) {
|
|
40
|
+
return { command: process.execPath, args: [distEntry, ...argv] };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const tsxCliPath = resolveTsxCliPath({ existsSyncFn });
|
|
44
|
+
if (tsxCliPath) {
|
|
45
|
+
const srcEntry = resolve(__dirname, "..", "src", "cli", "entry.ts");
|
|
46
|
+
return { command: process.execPath, args: [tsxCliPath, srcEntry, ...argv] };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
throw new Error(
|
|
50
|
+
"Unable to start indexer-cli: neither dist/cli/entry.js nor a local tsx runtime was found. Run `npm ci` and `npm run build` in the repository before invoking the CLI.",
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function main() {
|
|
55
|
+
try {
|
|
56
|
+
require("better-sqlite3");
|
|
57
|
+
} catch {
|
|
58
|
+
console.error(
|
|
59
|
+
[
|
|
60
|
+
"",
|
|
61
|
+
"\u26A0 indexer-cli: native modules could not be loaded.",
|
|
62
|
+
" This usually means build tools (python3, make, C++ compiler) are missing.",
|
|
63
|
+
"",
|
|
64
|
+
" Install build tools, then run:",
|
|
65
|
+
" npm install -g indexer-cli",
|
|
66
|
+
"",
|
|
67
|
+
].join("\n"),
|
|
68
|
+
);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const { command, args } = buildLaunchSpec();
|
|
73
|
+
const result = spawnSync(command, args, {
|
|
74
|
+
stdio: "inherit",
|
|
75
|
+
env: process.env,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (result.error) {
|
|
79
|
+
throw result.error;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (result.status !== null) {
|
|
83
|
+
process.exit(result.status);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = {
|
|
90
|
+
buildLaunchSpec,
|
|
91
|
+
main,
|
|
92
|
+
resolveTsxCliPath,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
if (require.main === module) {
|
|
96
|
+
main();
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_temp_test.js","sourceRoot":"","sources":["../src/_temp_test.ts"],"names":[],"mappings":";;AAAA,OAAO"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface AdaptiveChunk {
|
|
2
|
+
content: string;
|
|
3
|
+
startLine: number;
|
|
4
|
+
endLine: number;
|
|
5
|
+
type?: string;
|
|
6
|
+
primarySymbol?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AdaptiveChunkContext {
|
|
9
|
+
filePath: string;
|
|
10
|
+
content: string;
|
|
11
|
+
language: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class AdaptiveChunker {
|
|
14
|
+
chunk(context: AdaptiveChunkContext): AdaptiveChunk[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdaptiveChunker = void 0;
|
|
4
|
+
class AdaptiveChunker {
|
|
5
|
+
chunk(context) {
|
|
6
|
+
const lines = context.content.split(/\r?\n/);
|
|
7
|
+
if (lines.length === 0 || context.content.trim().length === 0) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
if (lines.length <= 220) {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
content: context.content.trim(),
|
|
14
|
+
startLine: 1,
|
|
15
|
+
endLine: lines.length,
|
|
16
|
+
type: 'full_file',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
const chunks = [];
|
|
21
|
+
const chunkSize = context.language === 'typescript' ? 180 : 220;
|
|
22
|
+
const overlap = 20;
|
|
23
|
+
for (let start = 0; start < lines.length; start += chunkSize - overlap) {
|
|
24
|
+
const endExclusive = Math.min(lines.length, start + chunkSize);
|
|
25
|
+
const content = lines.slice(start, endExclusive).join('\n').trim();
|
|
26
|
+
if (!content) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
chunks.push({
|
|
30
|
+
content,
|
|
31
|
+
startLine: start + 1,
|
|
32
|
+
endLine: endExclusive,
|
|
33
|
+
type: chunks.length === 0 ? 'module_section' : 'impl',
|
|
34
|
+
});
|
|
35
|
+
if (endExclusive >= lines.length) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return chunks;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AdaptiveChunker = AdaptiveChunker;
|
|
43
|
+
//# sourceMappingURL=adaptive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adaptive.js","sourceRoot":"","sources":["../../src/chunking/adaptive.ts"],"names":[],"mappings":";;;AAcA,MAAa,eAAe;IAC1B,KAAK,CAAC,OAA6B;QACjC,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9D,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;YACxB,OAAO;gBACL;oBACE,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE;oBAC/B,SAAS,EAAE,CAAC;oBACZ,OAAO,EAAE,KAAK,CAAC,MAAM;oBACrB,IAAI,EAAE,WAAW;iBAClB;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAoB,EAAE,CAAC;QACnC,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;QAChE,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,SAAS,GAAG,OAAO,EAAE,CAAC;YACvE,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;YAC/D,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;YACnE,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,SAAS;YACX,CAAC;YAED,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO;gBACP,SAAS,EAAE,KAAK,GAAG,CAAC;gBACpB,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM;aACtD,CAAC,CAAC;YAEH,IAAI,YAAY,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA3CD,0CA2CC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FunctionLevelChunker = void 0;
|
|
7
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
class FunctionLevelChunker {
|
|
9
|
+
chunk(context) {
|
|
10
|
+
const { filePath, content } = context;
|
|
11
|
+
const sourceFile = typescript_1.default.createSourceFile(filePath, content, typescript_1.default.ScriptTarget.Latest, true);
|
|
12
|
+
const chunks = [];
|
|
13
|
+
let importsEndPos = 0;
|
|
14
|
+
let preambleEndPos = 0;
|
|
15
|
+
for (const statement of sourceFile.statements) {
|
|
16
|
+
if (typescript_1.default.isImportDeclaration(statement) || typescript_1.default.isImportEqualsDeclaration(statement)) {
|
|
17
|
+
importsEndPos = statement.getEnd();
|
|
18
|
+
preambleEndPos = statement.getEnd();
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (typescript_1.default.isTypeAliasDeclaration(statement) || typescript_1.default.isInterfaceDeclaration(statement)) {
|
|
22
|
+
preambleEndPos = statement.getEnd();
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
if (importsEndPos > 0) {
|
|
28
|
+
const importsContent = content.slice(0, importsEndPos);
|
|
29
|
+
const endLine = sourceFile.getLineAndCharacterOfPosition(importsEndPos).line + 1;
|
|
30
|
+
chunks.push({
|
|
31
|
+
content: importsContent,
|
|
32
|
+
startLine: 0,
|
|
33
|
+
endLine,
|
|
34
|
+
type: 'imports',
|
|
35
|
+
symbols: [],
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (preambleEndPos > importsEndPos) {
|
|
39
|
+
const preambleStartPos = importsEndPos;
|
|
40
|
+
const preambleContent = content.slice(preambleStartPos, preambleEndPos);
|
|
41
|
+
const startLine = sourceFile.getLineAndCharacterOfPosition(preambleStartPos).line;
|
|
42
|
+
const endLine = sourceFile.getLineAndCharacterOfPosition(preambleEndPos).line + 1;
|
|
43
|
+
chunks.push({
|
|
44
|
+
content: preambleContent,
|
|
45
|
+
startLine,
|
|
46
|
+
endLine,
|
|
47
|
+
type: 'preamble',
|
|
48
|
+
symbols: [],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
sourceFile.forEachChild((node) => {
|
|
52
|
+
if (node.getEnd() <= preambleEndPos)
|
|
53
|
+
return;
|
|
54
|
+
if (this.isTopLevelDeclaration(node)) {
|
|
55
|
+
const start = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
|
56
|
+
const end = sourceFile.getLineAndCharacterOfPosition(node.getEnd());
|
|
57
|
+
const symbol = this.extractSymbol(node);
|
|
58
|
+
chunks.push({
|
|
59
|
+
content: node.getText(),
|
|
60
|
+
startLine: start.line,
|
|
61
|
+
endLine: end.line + 1,
|
|
62
|
+
type: 'declaration',
|
|
63
|
+
primarySymbol: symbol?.name,
|
|
64
|
+
symbols: symbol ? [symbol.name] : [],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return chunks;
|
|
69
|
+
}
|
|
70
|
+
isTopLevelDeclaration(node) {
|
|
71
|
+
return (typescript_1.default.isFunctionDeclaration(node) ||
|
|
72
|
+
typescript_1.default.isClassDeclaration(node) ||
|
|
73
|
+
typescript_1.default.isVariableStatement(node) ||
|
|
74
|
+
typescript_1.default.isModuleDeclaration(node));
|
|
75
|
+
}
|
|
76
|
+
extractSymbol(node) {
|
|
77
|
+
if (typescript_1.default.isFunctionDeclaration(node) && node.name) {
|
|
78
|
+
return { name: node.name.getText(), kind: 'function' };
|
|
79
|
+
}
|
|
80
|
+
if (typescript_1.default.isClassDeclaration(node) && node.name) {
|
|
81
|
+
return { name: node.name.getText(), kind: 'class' };
|
|
82
|
+
}
|
|
83
|
+
if (typescript_1.default.isVariableStatement(node)) {
|
|
84
|
+
const declaration = node.declarationList.declarations[0];
|
|
85
|
+
if (declaration && typescript_1.default.isIdentifier(declaration.name)) {
|
|
86
|
+
return { name: declaration.name.getText(), kind: 'variable' };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (typescript_1.default.isModuleDeclaration(node) && node.name) {
|
|
90
|
+
return { name: node.name.getText(), kind: 'module' };
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.FunctionLevelChunker = FunctionLevelChunker;
|
|
96
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/chunking/function.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAG5B,MAAa,oBAAoB;IAC/B,KAAK,CAAC,OAAwB;QAC5B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QACt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,CAAC;IACd,CAAC;CACF;AA1GD,oDA0GC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
__exportStar(require("./types.js"), exports);
|
|
18
|
+
__exportStar(require("./single.js"), exports);
|
|
19
|
+
__exportStar(require("./function.js"), exports);
|
|
20
|
+
__exportStar(require("./module.js"), exports);
|
|
21
|
+
__exportStar(require("./adaptive.js"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chunking/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,8CAA4B;AAC5B,gDAA8B;AAC9B,8CAA4B;AAC5B,gDAA8B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModuleLevelChunker = void 0;
|
|
4
|
+
class ModuleLevelChunker {
|
|
5
|
+
MAX_CHUNK_LINES = 200;
|
|
6
|
+
OVERLAP_LINES = 20;
|
|
7
|
+
chunk(context) {
|
|
8
|
+
const lines = context.content.split('\n');
|
|
9
|
+
const chunks = [];
|
|
10
|
+
let currentLine = 0;
|
|
11
|
+
while (currentLine < lines.length) {
|
|
12
|
+
const endLine = Math.min(currentLine + this.MAX_CHUNK_LINES, lines.length);
|
|
13
|
+
const chunkLines = lines.slice(currentLine, endLine);
|
|
14
|
+
let content = chunkLines.join('\n');
|
|
15
|
+
if (currentLine > 0) {
|
|
16
|
+
content = `// ...\n${content}`;
|
|
17
|
+
}
|
|
18
|
+
chunks.push({
|
|
19
|
+
content,
|
|
20
|
+
startLine: currentLine,
|
|
21
|
+
endLine,
|
|
22
|
+
type: 'module_section',
|
|
23
|
+
symbols: [],
|
|
24
|
+
});
|
|
25
|
+
if (endLine >= lines.length)
|
|
26
|
+
break;
|
|
27
|
+
currentLine = endLine - this.OVERLAP_LINES;
|
|
28
|
+
}
|
|
29
|
+
return chunks;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ModuleLevelChunker = ModuleLevelChunker;
|
|
33
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/chunking/module.ts"],"names":[],"mappings":";;;AAEA,MAAa,kBAAkB;IACZ,eAAe,GAAG,GAAG,CAAC;IACtB,aAAa,GAAG,EAAE,CAAC;IAEpC,KAAK,CAAC,OAAwB;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAY,EAAE,CAAC;QAC3B,IAAI,WAAW,GAAG,CAAC,CAAC;QAEpB,OAAO,WAAW,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAClC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAC3E,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAErD,IAAI,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEpC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;gBACpB,OAAO,GAAG,WAAW,OAAO,EAAE,CAAC;YACjC,CAAC;YAED,MAAM,CAAC,IAAI,CAAC;gBACV,OAAO;gBACP,SAAS,EAAE,WAAW;gBACtB,OAAO;gBACP,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,EAAE;aACZ,CAAC,CAAC;YAEH,IAAI,OAAO,IAAI,KAAK,CAAC,MAAM;gBAAE,MAAM;YAEnC,WAAW,GAAG,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAlCD,gDAkCC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SingleFileChunker = void 0;
|
|
4
|
+
class SingleFileChunker {
|
|
5
|
+
chunk(context) {
|
|
6
|
+
const lines = context.content.split('\n');
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
content: context.content,
|
|
10
|
+
startLine: 0,
|
|
11
|
+
endLine: lines.length,
|
|
12
|
+
type: 'full_file',
|
|
13
|
+
symbols: [],
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.SingleFileChunker = SingleFileChunker;
|
|
19
|
+
//# sourceMappingURL=single.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single.js","sourceRoot":"","sources":["../../src/chunking/single.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAC5B,KAAK,CAAC,OAAwB;QAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO;YACL;gBACE,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,SAAS,EAAE,CAAC;gBACZ,OAAO,EAAE,KAAK,CAAC,MAAM;gBACrB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,EAAE;aACZ;SACF,CAAC;IACJ,CAAC;CACF;AAbD,8CAaC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ChunkType = 'full_file' | 'imports' | 'preamble' | 'declaration' | 'module_section' | 'impl' | 'types';
|
|
2
|
+
export interface Chunk {
|
|
3
|
+
content: string;
|
|
4
|
+
startLine: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
type: ChunkType;
|
|
7
|
+
primarySymbol?: string;
|
|
8
|
+
symbols?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface ChunkingContext {
|
|
11
|
+
filePath: string;
|
|
12
|
+
content: string;
|
|
13
|
+
language: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ChunkingStrategy {
|
|
16
|
+
chunk(context: ChunkingContext): Chunk[];
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/chunking/types.ts"],"names":[],"mappings":""}
|