@grepai/cli 0.7.4 → 0.7.5
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 +151 -11
- package/index.js.map +11 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -89672,7 +89672,7 @@ class AgentFs extends Service()("@grepai/core/internal/services/agentfs", {
|
|
|
89672
89672
|
}
|
|
89673
89673
|
|
|
89674
89674
|
// ../core/src/domain/index.ts
|
|
89675
|
-
var SupportedLanguage = Literal2("typescript", "tsx");
|
|
89675
|
+
var SupportedLanguage = Literal2("typescript", "tsx", "json", "javascript");
|
|
89676
89676
|
|
|
89677
89677
|
// ../core/src/domain/embedding.ts
|
|
89678
89678
|
var Embedding2 = transformOrFail(Union2(NonEmptyArray(Number$), String$), String$, {
|
|
@@ -104218,7 +104218,9 @@ class AstParser extends Service()("@grepai/core/internal/services/chunker-ast/as
|
|
|
104218
104218
|
}
|
|
104219
104219
|
var languageMap2 = {
|
|
104220
104220
|
typescript: "./tree-sitter-typescript.wasm",
|
|
104221
|
-
tsx: "./tree-sitter-tsx.wasm"
|
|
104221
|
+
tsx: "./tree-sitter-tsx.wasm",
|
|
104222
|
+
json: "./tree-sitter-json.wasm",
|
|
104223
|
+
javascript: "./tree-sitter-javascript.wasm"
|
|
104222
104224
|
};
|
|
104223
104225
|
|
|
104224
104226
|
// ../core/src/internal/services/chunker-ast/context-header-builder.ts
|
|
@@ -104240,10 +104242,122 @@ class ContextHeaderBuilder extends Service()("@grepai/core/internal/services/chu
|
|
|
104240
104242
|
}) {
|
|
104241
104243
|
}
|
|
104242
104244
|
|
|
104245
|
+
// ../core/src/internal/services/chunker-ast/language-config/javascript.ts
|
|
104246
|
+
var javascript = {
|
|
104247
|
+
isClosingSyntax: (text13) => /^[\s)\]}>]+$/.test(text13),
|
|
104248
|
+
extractNodeName,
|
|
104249
|
+
wantedNodes: new Set([
|
|
104250
|
+
"function_declaration",
|
|
104251
|
+
"function_expression",
|
|
104252
|
+
"generator_function_declaration",
|
|
104253
|
+
"generator_function",
|
|
104254
|
+
"arrow_function",
|
|
104255
|
+
"method_definition",
|
|
104256
|
+
"class_declaration",
|
|
104257
|
+
"class",
|
|
104258
|
+
"field_definition",
|
|
104259
|
+
"class_static_block",
|
|
104260
|
+
"lexical_declaration",
|
|
104261
|
+
"variable_declaration",
|
|
104262
|
+
"export_statement",
|
|
104263
|
+
"import_statement"
|
|
104264
|
+
]),
|
|
104265
|
+
scopeNodes: new Set([
|
|
104266
|
+
"function_declaration",
|
|
104267
|
+
"generator_function_declaration",
|
|
104268
|
+
"method_definition",
|
|
104269
|
+
"class_declaration",
|
|
104270
|
+
"class",
|
|
104271
|
+
"lexical_declaration",
|
|
104272
|
+
"variable_declaration"
|
|
104273
|
+
]),
|
|
104274
|
+
importNodes: new Set(["import_statement", "export_statement"])
|
|
104275
|
+
};
|
|
104276
|
+
function extractNodeName(node) {
|
|
104277
|
+
const nameChild = node.childForFieldName("name");
|
|
104278
|
+
if (nameChild) {
|
|
104279
|
+
return nameChild.text;
|
|
104280
|
+
}
|
|
104281
|
+
if (node.type === "lexical_declaration" || node.type === "variable_declaration") {
|
|
104282
|
+
const declarator = node.namedChildren.find((child) => child.type === "variable_declarator");
|
|
104283
|
+
if (declarator) {
|
|
104284
|
+
const varName = declarator.childForFieldName("name");
|
|
104285
|
+
if (varName) {
|
|
104286
|
+
return varName.text;
|
|
104287
|
+
}
|
|
104288
|
+
}
|
|
104289
|
+
}
|
|
104290
|
+
const identifierChild = node.namedChildren.find((child) => child.type === "identifier" || child.type === "property_identifier");
|
|
104291
|
+
if (identifierChild) {
|
|
104292
|
+
return identifierChild.text;
|
|
104293
|
+
}
|
|
104294
|
+
if (node.type === "arrow_function" || node.type === "function_expression" || node.type === "generator_function") {
|
|
104295
|
+
let ancestor = node.parent;
|
|
104296
|
+
while (ancestor) {
|
|
104297
|
+
if (ancestor.type === "variable_declarator") {
|
|
104298
|
+
const varName = ancestor.childForFieldName("name");
|
|
104299
|
+
if (varName) {
|
|
104300
|
+
return varName.text;
|
|
104301
|
+
}
|
|
104302
|
+
}
|
|
104303
|
+
if (ancestor.type === "pair") {
|
|
104304
|
+
const key = ancestor.childForFieldName("key");
|
|
104305
|
+
if (key) {
|
|
104306
|
+
return key.text;
|
|
104307
|
+
}
|
|
104308
|
+
}
|
|
104309
|
+
if (ancestor.type === "lexical_declaration" || ancestor.type === "variable_declaration" || ancestor.type === "expression_statement") {
|
|
104310
|
+
break;
|
|
104311
|
+
}
|
|
104312
|
+
ancestor = ancestor.parent;
|
|
104313
|
+
}
|
|
104314
|
+
}
|
|
104315
|
+
return "<anonymous>";
|
|
104316
|
+
}
|
|
104317
|
+
|
|
104318
|
+
// ../core/src/internal/services/chunker-ast/language-config/json.ts
|
|
104319
|
+
var json4 = {
|
|
104320
|
+
isClosingSyntax: (text13) => /^[\s\]},]+$/.test(text13),
|
|
104321
|
+
extractNodeName: extractNodeName2,
|
|
104322
|
+
wantedNodes: new Set(["pair"]),
|
|
104323
|
+
scopeNodes: new Set(["pair"]),
|
|
104324
|
+
importNodes: new Set([])
|
|
104325
|
+
};
|
|
104326
|
+
function extractNodeName2(node) {
|
|
104327
|
+
if (node.type === "pair") {
|
|
104328
|
+
const key = node.childForFieldName("key");
|
|
104329
|
+
if (key) {
|
|
104330
|
+
return stripQuotes(key.text);
|
|
104331
|
+
}
|
|
104332
|
+
return "<pair>";
|
|
104333
|
+
}
|
|
104334
|
+
if (node.type === "object" || node.type === "array") {
|
|
104335
|
+
let ancestor = node.parent;
|
|
104336
|
+
while (ancestor) {
|
|
104337
|
+
if (ancestor.type === "pair") {
|
|
104338
|
+
const key = ancestor.childForFieldName("key");
|
|
104339
|
+
if (key) {
|
|
104340
|
+
return stripQuotes(key.text);
|
|
104341
|
+
}
|
|
104342
|
+
break;
|
|
104343
|
+
}
|
|
104344
|
+
ancestor = ancestor.parent;
|
|
104345
|
+
}
|
|
104346
|
+
return node.type === "object" ? "<object>" : "<array>";
|
|
104347
|
+
}
|
|
104348
|
+
return "<anonymous>";
|
|
104349
|
+
}
|
|
104350
|
+
function stripQuotes(text13) {
|
|
104351
|
+
if (text13.length >= 2 && text13[0] === '"' && text13[text13.length - 1] === '"') {
|
|
104352
|
+
return text13.slice(1, -1);
|
|
104353
|
+
}
|
|
104354
|
+
return text13;
|
|
104355
|
+
}
|
|
104356
|
+
|
|
104243
104357
|
// ../core/src/internal/services/chunker-ast/language-config/tsx.ts
|
|
104244
104358
|
var tsx = {
|
|
104245
104359
|
isClosingSyntax: (text13) => /^[\s)}\]>]+$/.test(text13) || /^\s*\/>/.test(text13) || /^\s*<\/[a-zA-Z_$][\w$.:-]*\s*>/.test(text13),
|
|
104246
|
-
extractNodeName,
|
|
104360
|
+
extractNodeName: extractNodeName3,
|
|
104247
104361
|
wantedNodes: new Set([
|
|
104248
104362
|
"function_declaration",
|
|
104249
104363
|
"function_expression",
|
|
@@ -104295,7 +104409,7 @@ var tsx = {
|
|
|
104295
104409
|
"import_alias"
|
|
104296
104410
|
])
|
|
104297
104411
|
};
|
|
104298
|
-
function
|
|
104412
|
+
function extractNodeName3(node) {
|
|
104299
104413
|
if (node.type === "jsx_element") {
|
|
104300
104414
|
const openTag = node.childForFieldName("open_tag");
|
|
104301
104415
|
if (openTag) {
|
|
@@ -104357,7 +104471,7 @@ function extractNodeName(node) {
|
|
|
104357
104471
|
// ../core/src/internal/services/chunker-ast/language-config/typescript.ts
|
|
104358
104472
|
var typescript = {
|
|
104359
104473
|
isClosingSyntax: (text13) => /^[\s)\]}>]+$/.test(text13),
|
|
104360
|
-
extractNodeName:
|
|
104474
|
+
extractNodeName: extractNodeName4,
|
|
104361
104475
|
wantedNodes: new Set([
|
|
104362
104476
|
"function_declaration",
|
|
104363
104477
|
"function_expression",
|
|
@@ -104407,7 +104521,7 @@ var typescript = {
|
|
|
104407
104521
|
"import_alias"
|
|
104408
104522
|
])
|
|
104409
104523
|
};
|
|
104410
|
-
function
|
|
104524
|
+
function extractNodeName4(node) {
|
|
104411
104525
|
const nameChild = node.childForFieldName("name");
|
|
104412
104526
|
if (nameChild) {
|
|
104413
104527
|
return nameChild.text;
|
|
@@ -104452,7 +104566,9 @@ function extractNodeName2(node) {
|
|
|
104452
104566
|
// ../core/src/internal/services/chunker-ast/language-config/index.ts
|
|
104453
104567
|
var languageConfig = {
|
|
104454
104568
|
typescript,
|
|
104455
|
-
tsx
|
|
104569
|
+
tsx,
|
|
104570
|
+
json: json4,
|
|
104571
|
+
javascript
|
|
104456
104572
|
};
|
|
104457
104573
|
|
|
104458
104574
|
// ../core/src/internal/services/chunker-ast/index.ts
|
|
@@ -104466,13 +104582,13 @@ var ChunkerAst = effect(Chunker, gen2(function* () {
|
|
|
104466
104582
|
wantedNodes,
|
|
104467
104583
|
scopeNodes,
|
|
104468
104584
|
importNodes,
|
|
104469
|
-
extractNodeName:
|
|
104585
|
+
extractNodeName: extractNodeName5
|
|
104470
104586
|
} = languageConfig[language];
|
|
104471
104587
|
const tokenCount = yield* tokenCounter.count(node.text);
|
|
104472
104588
|
const isWanted = wantedNodes.has(node.type);
|
|
104473
104589
|
const isScope = scopeNodes.has(node.type);
|
|
104474
104590
|
const isImport = importNodes.has(node.type);
|
|
104475
|
-
const nextScope = isScope && !isImport ? [...scopeStack,
|
|
104591
|
+
const nextScope = isScope && !isImport ? [...scopeStack, extractNodeName5(node)] : scopeStack;
|
|
104476
104592
|
if (isWanted) {
|
|
104477
104593
|
if (tokenCount <= config3.embedding.maxChunkSize || node.childCount === 0) {
|
|
104478
104594
|
return [
|
|
@@ -104647,6 +104763,18 @@ var CodebaseScannerAgentFs = scoped3(CodebaseScanner, gen2(function* () {
|
|
|
104647
104763
|
})), when5("tsx", () => ({
|
|
104648
104764
|
filePath,
|
|
104649
104765
|
language: "tsx"
|
|
104766
|
+
})), when5("json", () => ({
|
|
104767
|
+
filePath,
|
|
104768
|
+
language: "json"
|
|
104769
|
+
})), when5("js", () => ({
|
|
104770
|
+
filePath,
|
|
104771
|
+
language: "javascript"
|
|
104772
|
+
})), when5("mjs", () => ({
|
|
104773
|
+
filePath,
|
|
104774
|
+
language: "javascript"
|
|
104775
|
+
})), when5("cjs", () => ({
|
|
104776
|
+
filePath,
|
|
104777
|
+
language: "javascript"
|
|
104650
104778
|
})), option4);
|
|
104651
104779
|
}
|
|
104652
104780
|
const toScanResults = fnUntraced2(function* (files) {
|
|
@@ -104754,6 +104882,18 @@ var CodebaseScannerFs = effect(CodebaseScanner, gen2(function* () {
|
|
|
104754
104882
|
})), when5("tsx", () => ({
|
|
104755
104883
|
filePath,
|
|
104756
104884
|
language: "tsx"
|
|
104885
|
+
})), when5("json", () => ({
|
|
104886
|
+
filePath,
|
|
104887
|
+
language: "json"
|
|
104888
|
+
})), when5("js", () => ({
|
|
104889
|
+
filePath,
|
|
104890
|
+
language: "javascript"
|
|
104891
|
+
})), when5("mjs", () => ({
|
|
104892
|
+
filePath,
|
|
104893
|
+
language: "javascript"
|
|
104894
|
+
})), when5("cjs", () => ({
|
|
104895
|
+
filePath,
|
|
104896
|
+
language: "javascript"
|
|
104757
104897
|
})), option4))), flatMap10(forEach5(({ filePath, language }) => fs2.readFileString(filePath).pipe(map16((content) => ({
|
|
104758
104898
|
filePath,
|
|
104759
104899
|
language,
|
|
@@ -112709,11 +112849,11 @@ var program = gen2(function* () {
|
|
|
112709
112849
|
]));
|
|
112710
112850
|
const cli = exports_Command.run(command, {
|
|
112711
112851
|
name: "GREP AI",
|
|
112712
|
-
version: "v0.7.
|
|
112852
|
+
version: "v0.7.5"
|
|
112713
112853
|
});
|
|
112714
112854
|
yield* cli(process.argv);
|
|
112715
112855
|
});
|
|
112716
112856
|
program.pipe(provide2(mergeAll5(GrepAi.Default).pipe(provideMerge2(Clack.Default), provideMerge2(exports_BunContext.layer))), exports_BunRuntime.runMain);
|
|
112717
112857
|
|
|
112718
|
-
//# debugId=
|
|
112858
|
+
//# debugId=502498F845B3BA6F64756E2164756E21
|
|
112719
112859
|
//# sourceMappingURL=index.js.map
|