@grepai/cli 0.7.3 → 0.7.4
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/index.js +30 -8
- package/index.js.map +7 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -100710,17 +100710,27 @@ var LanceDbLive = Migrations.Default.pipe(provideMerge2(LanceDb.Default));
|
|
|
100710
100710
|
var ChunkStorageLanceDb = effect(ChunkStorage, gen2(function* () {
|
|
100711
100711
|
const db = yield* LanceDb;
|
|
100712
100712
|
const embedder = yield* Embedder;
|
|
100713
|
+
const config3 = yield* Config;
|
|
100714
|
+
function withNormalizedFilePath(input) {
|
|
100715
|
+
if (config3.experimental__agentFs) {
|
|
100716
|
+
return {
|
|
100717
|
+
...input,
|
|
100718
|
+
filePath: `/${input.filePath}`
|
|
100719
|
+
};
|
|
100720
|
+
}
|
|
100721
|
+
return input;
|
|
100722
|
+
}
|
|
100713
100723
|
const search = fnUntraced2(function* (input) {
|
|
100714
100724
|
const { query, topK = 10 } = input;
|
|
100715
100725
|
const queryEmbedding = yield* embedder.embedQuery(query).pipe(flatMap10(decode3(EmbeddingA)));
|
|
100716
|
-
return yield* db.useTable((t) => t.vectorSearch(fromIterable(queryEmbedding)).distanceType("cosine").limit(topK).select(["filePath", "startLine", "endLine", "_distance"]).toArray()).pipe(flatMap10(decodeUnknown2(Array$(ChunkSearchResult))));
|
|
100726
|
+
return yield* db.useTable((t) => t.vectorSearch(fromIterable(queryEmbedding)).distanceType("cosine").limit(topK).select(["filePath", "startLine", "endLine", "_distance"]).toArray()).pipe(flatMap10(decodeUnknown2(Array$(ChunkSearchResult))), map16(map4(withNormalizedFilePath)));
|
|
100717
100727
|
}, catchTags2({
|
|
100718
100728
|
ParseError: (cause2) => new SchemaValidationFailed({ cause: cause2 }),
|
|
100719
100729
|
LanceDbError: (cause2) => new ChunkStorageError({ cause: cause2 })
|
|
100720
100730
|
}));
|
|
100721
100731
|
const grep = fnUntraced2(function* (input) {
|
|
100722
100732
|
const { pattern: pattern2, limit = 100 } = input;
|
|
100723
|
-
return yield* db.useTable((t) => t.query().where(`content LIKE '%${pattern2}%'`).select(["filePath", "startLine", "endLine", "content"]).limit(limit).toArray()).pipe(flatMap10(decodeUnknown2(Array$(GrepResult))));
|
|
100733
|
+
return yield* db.useTable((t) => t.query().where(`content LIKE '%${pattern2}%'`).select(["filePath", "startLine", "endLine", "content"]).limit(limit).toArray()).pipe(flatMap10(decodeUnknown2(Array$(GrepResult))), map16(map4(withNormalizedFilePath)));
|
|
100724
100734
|
}, catchTags2({
|
|
100725
100735
|
ParseError: (cause2) => new SchemaValidationFailed({ cause: cause2 }),
|
|
100726
100736
|
LanceDbError: (cause2) => new ChunkStorageError({ cause: cause2 })
|
|
@@ -100758,6 +100768,16 @@ class SqlError extends (/* @__PURE__ */ TypeIdError(SqlErrorTypeId, "SqlError"))
|
|
|
100758
100768
|
var ChunkStorageSql = effect(ChunkStorage, gen2(function* () {
|
|
100759
100769
|
const db = yield* exports_SqlClient.SqlClient;
|
|
100760
100770
|
const embedder = yield* Embedder;
|
|
100771
|
+
const config3 = yield* Config;
|
|
100772
|
+
function withNormalizedFilePath(input) {
|
|
100773
|
+
if (config3.experimental__agentFs) {
|
|
100774
|
+
return {
|
|
100775
|
+
...input,
|
|
100776
|
+
filePath: `/${input.filePath}`
|
|
100777
|
+
};
|
|
100778
|
+
}
|
|
100779
|
+
return input;
|
|
100780
|
+
}
|
|
100761
100781
|
const search = fnUntraced2(function* (input) {
|
|
100762
100782
|
const { query, topK = 10 } = input;
|
|
100763
100783
|
const queryEmbedding = yield* embedder.embedQuery(query);
|
|
@@ -100790,7 +100810,7 @@ var ChunkStorageSql = effect(ChunkStorage, gen2(function* () {
|
|
|
100790
100810
|
INNER JOIN
|
|
100791
100811
|
chunks c ON c.id = ce.chunk_id
|
|
100792
100812
|
`
|
|
100793
|
-
}).pipe(flatMap10(decodeUnknown2(Array$(ChunkSearchResult))));
|
|
100813
|
+
}).pipe(flatMap10(decodeUnknown2(Array$(ChunkSearchResult))), map16(map4(withNormalizedFilePath)));
|
|
100794
100814
|
}, catchTags2({
|
|
100795
100815
|
ParseError: (cause2) => new SchemaValidationFailed({ cause: cause2 }),
|
|
100796
100816
|
SqlError: (cause2) => new ChunkStorageError({ cause: cause2 })
|
|
@@ -100822,7 +100842,7 @@ var ChunkStorageSql = effect(ChunkStorage, gen2(function* () {
|
|
|
100822
100842
|
INSTR(c.content, ${pattern2}) > 0
|
|
100823
100843
|
LIMIT ${limit}
|
|
100824
100844
|
`
|
|
100825
|
-
}).pipe(flatMap10(decodeUnknown2(Array$(GrepResult))));
|
|
100845
|
+
}).pipe(flatMap10(decodeUnknown2(Array$(GrepResult))), map16(map4(withNormalizedFilePath)));
|
|
100826
100846
|
}, catchTags2({
|
|
100827
100847
|
ParseError: (cause2) => new SchemaValidationFailed({ cause: cause2 }),
|
|
100828
100848
|
SqlError: (cause2) => new ChunkStorageError({ cause: cause2 })
|
|
@@ -104776,6 +104796,7 @@ var Document2 = Struct({
|
|
|
104776
104796
|
// ../core/src/internal/services/document-storage-lancedb.ts
|
|
104777
104797
|
var DocumentStorageLanceDb = effect(DocumentStorage, gen2(function* () {
|
|
104778
104798
|
const db = yield* LanceDb;
|
|
104799
|
+
const config3 = yield* Config;
|
|
104779
104800
|
const getByFilePath = fnUntraced2(function* (filePath) {
|
|
104780
104801
|
return yield* db.useTable((t) => t.query().where(`filePath = "${filePath}"`).select(["id", "filePath", "fileHash", "createdAt", "updatedAt"]).limit(1).toArray()).pipe(map16(map4((doc2) => ({
|
|
104781
104802
|
...doc2,
|
|
@@ -104800,7 +104821,7 @@ var DocumentStorageLanceDb = effect(DocumentStorage, gen2(function* () {
|
|
|
104800
104821
|
const matcher = new Glob(pattern2);
|
|
104801
104822
|
return yield* db.useTable((t) => t.query().select(["filePath"]).toArray()).pipe(flatMap10(decodeUnknown2(Array$(Struct({
|
|
104802
104823
|
filePath: String$
|
|
104803
|
-
})))), map16(
|
|
104824
|
+
})))), map16(filterMap2(({ filePath }) => matcher.match(filePath) ? some2(filePath) : none2())), map16(dedupe), map16(map4((filePath) => config3.experimental__agentFs ? `/${filePath}` : filePath)));
|
|
104804
104825
|
}, catchTags2({
|
|
104805
104826
|
ParseError: (cause2) => new SchemaValidationFailed({ cause: cause2 }),
|
|
104806
104827
|
LanceDbError: (cause2) => new DocumentStorageError({ cause: cause2 })
|
|
@@ -104824,6 +104845,7 @@ var DocumentStorageLanceDb = effect(DocumentStorage, gen2(function* () {
|
|
|
104824
104845
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
104825
104846
|
var DocumentStorageSql = effect(DocumentStorage, gen2(function* () {
|
|
104826
104847
|
const db = yield* exports_SqlClient.SqlClient;
|
|
104848
|
+
const config3 = yield* Config;
|
|
104827
104849
|
const getByFilePath = fnUntraced2(function* (filePath) {
|
|
104828
104850
|
return yield* db.onDialectOrElse({
|
|
104829
104851
|
orElse: () => db`
|
|
@@ -104872,7 +104894,7 @@ var DocumentStorageSql = effect(DocumentStorage, gen2(function* () {
|
|
|
104872
104894
|
FROM
|
|
104873
104895
|
documents d
|
|
104874
104896
|
`
|
|
104875
|
-
}).pipe(flatMap10(decodeUnknown2(Array$(Struct({ filePath: String$ })))), map16(filterMap2(({ filePath }) => matcher.match(filePath) ? some2(filePath) : none2())));
|
|
104897
|
+
}).pipe(flatMap10(decodeUnknown2(Array$(Struct({ filePath: String$ })))), map16(filterMap2(({ filePath }) => matcher.match(filePath) ? some2(filePath) : none2())), map16(map4((filePath) => config3.experimental__agentFs ? `/${filePath}` : filePath)));
|
|
104876
104898
|
}, catchTags2({
|
|
104877
104899
|
ParseError: (cause2) => new SchemaValidationFailed({ cause: cause2 }),
|
|
104878
104900
|
SqlError: (cause2) => new DocumentStorageError({ cause: cause2 })
|
|
@@ -112687,11 +112709,11 @@ var program = gen2(function* () {
|
|
|
112687
112709
|
]));
|
|
112688
112710
|
const cli = exports_Command.run(command, {
|
|
112689
112711
|
name: "GREP AI",
|
|
112690
|
-
version: "v0.7.
|
|
112712
|
+
version: "v0.7.4"
|
|
112691
112713
|
});
|
|
112692
112714
|
yield* cli(process.argv);
|
|
112693
112715
|
});
|
|
112694
112716
|
program.pipe(provide2(mergeAll5(GrepAi.Default).pipe(provideMerge2(Clack.Default), provideMerge2(exports_BunContext.layer))), exports_BunRuntime.runMain);
|
|
112695
112717
|
|
|
112696
|
-
//# debugId=
|
|
112718
|
+
//# debugId=63E674BC23B4A13364756E2164756E21
|
|
112697
112719
|
//# sourceMappingURL=index.js.map
|