@codebolt/codeboltjs 2.0.5 → 2.0.7

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.
Files changed (67) hide show
  1. package/dist/core/websocket.js +2 -1
  2. package/dist/index.d.ts +65 -19
  3. package/dist/index.js +2 -2
  4. package/dist/modules/agent.js +1 -1
  5. package/dist/modules/codeparsers.d.ts +32 -3
  6. package/dist/modules/codeparsers.js +295 -3
  7. package/dist/modules/codeutils.d.ts +24 -7
  8. package/dist/modules/codeutils.js +93 -29
  9. package/dist/modules/fs.d.ts +46 -0
  10. package/dist/modules/fs.js +70 -1
  11. package/dist/modules/git.d.ts +7 -14
  12. package/dist/modules/git.js +16 -37
  13. package/dist/modules/outputparsers.d.ts +36 -4
  14. package/dist/modules/outputparsers.js +56 -5
  15. package/dist/modules/project.d.ts +3 -4
  16. package/dist/modules/project.js +7 -5
  17. package/dist/modules/terminal.js +1 -1
  18. package/dist/{modules → utils}/docutils.d.ts +3 -6
  19. package/dist/utils/docutils.js +69 -0
  20. package/dist/utils/parse-source-code/index.d.ts +9 -0
  21. package/dist/utils/parse-source-code/index.js +233 -0
  22. package/dist/utils/parse-source-code/languageParser.d.ts +8 -0
  23. package/dist/utils/parse-source-code/languageParser.js +137 -0
  24. package/dist/utils/parse-source-code/queries/c-sharp.d.ts +2 -0
  25. package/dist/utils/parse-source-code/queries/c-sharp.js +25 -0
  26. package/dist/utils/parse-source-code/queries/c.d.ts +2 -0
  27. package/dist/utils/parse-source-code/queries/c.js +17 -0
  28. package/dist/utils/parse-source-code/queries/cpp.d.ts +2 -0
  29. package/dist/utils/parse-source-code/queries/cpp.js +25 -0
  30. package/dist/utils/parse-source-code/queries/go.d.ts +2 -0
  31. package/dist/utils/parse-source-code/queries/go.js +29 -0
  32. package/dist/utils/parse-source-code/queries/index.d.ts +12 -0
  33. package/dist/utils/parse-source-code/queries/index.js +30 -0
  34. package/dist/utils/parse-source-code/queries/java.d.ts +2 -0
  35. package/dist/utils/parse-source-code/queries/java.js +17 -0
  36. package/dist/utils/parse-source-code/queries/javascript.d.ts +2 -0
  37. package/dist/utils/parse-source-code/queries/javascript.js +67 -0
  38. package/dist/utils/parse-source-code/queries/php.d.ts +2 -0
  39. package/dist/utils/parse-source-code/queries/php.js +17 -0
  40. package/dist/utils/parse-source-code/queries/python.d.ts +2 -0
  41. package/dist/utils/parse-source-code/queries/python.js +13 -0
  42. package/dist/utils/parse-source-code/queries/ruby.d.ts +2 -0
  43. package/dist/utils/parse-source-code/queries/ruby.js +54 -0
  44. package/dist/utils/parse-source-code/queries/rust.d.ts +2 -0
  45. package/dist/utils/parse-source-code/queries/rust.js +18 -0
  46. package/dist/utils/parse-source-code/queries/swift.d.ts +2 -0
  47. package/dist/utils/parse-source-code/queries/swift.js +47 -0
  48. package/dist/utils/parse-source-code/queries/typescript.d.ts +2 -0
  49. package/dist/utils/parse-source-code/queries/typescript.js +34 -0
  50. package/dist/utils/parse-source-code/tree-sitter-c.wasm +0 -0
  51. package/dist/utils/parse-source-code/tree-sitter-c_sharp.wasm +0 -0
  52. package/dist/utils/parse-source-code/tree-sitter-cpp.wasm +0 -0
  53. package/dist/utils/parse-source-code/tree-sitter-go.wasm +0 -0
  54. package/dist/utils/parse-source-code/tree-sitter-java.wasm +0 -0
  55. package/dist/utils/parse-source-code/tree-sitter-javascript.wasm +0 -0
  56. package/dist/utils/parse-source-code/tree-sitter-php.wasm +0 -0
  57. package/dist/utils/parse-source-code/tree-sitter-python.wasm +0 -0
  58. package/dist/utils/parse-source-code/tree-sitter-ruby.wasm +0 -0
  59. package/dist/utils/parse-source-code/tree-sitter-rust.wasm +0 -0
  60. package/dist/utils/parse-source-code/tree-sitter-swift.wasm +0 -0
  61. package/dist/utils/parse-source-code/tree-sitter-tsx.wasm +0 -0
  62. package/dist/utils/parse-source-code/tree-sitter-typescript.wasm +0 -0
  63. package/dist/utils/parse-source-code/tree-sitter.wasm +0 -0
  64. package/dist/utils.d.ts +1 -0
  65. package/dist/utils.js +6 -1
  66. package/package.json +6 -2
  67. package/dist/modules/docutils.js +0 -19
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - class declarations
5
+ - method declarations
6
+ - interface declarations
7
+ */
8
+ exports.default = `
9
+ (class_declaration
10
+ name: (identifier) @name.definition.class) @definition.class
11
+
12
+ (method_declaration
13
+ name: (identifier) @name.definition.method) @definition.method
14
+
15
+ (interface_declaration
16
+ name: (identifier) @name.definition.interface) @definition.interface
17
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(\n (comment)* @doc\n .\n (method_definition\n name: (property_identifier) @name) @definition.method\n (#not-eq? @name \"constructor\")\n (#strip! @doc \"^[\\s\\*/]+|^[\\s\\*/]$\")\n (#select-adjacent! @doc @definition.method)\n)\n\n(\n (comment)* @doc\n .\n [\n (class\n name: (_) @name)\n (class_declaration\n name: (_) @name)\n ] @definition.class\n (#strip! @doc \"^[\\s\\*/]+|^[\\s\\*/]$\")\n (#select-adjacent! @doc @definition.class)\n)\n\n(\n (comment)* @doc\n .\n [\n (function_declaration\n name: (identifier) @name)\n (generator_function_declaration\n name: (identifier) @name)\n ] @definition.function\n (#strip! @doc \"^[\\s\\*/]+|^[\\s\\*/]$\")\n (#select-adjacent! @doc @definition.function)\n)\n\n(\n (comment)* @doc\n .\n (lexical_declaration\n (variable_declarator\n name: (identifier) @name\n value: [(arrow_function) (function_expression)]) @definition.function)\n (#strip! @doc \"^[\\s\\*/]+|^[\\s\\*/]$\")\n (#select-adjacent! @doc @definition.function)\n)\n\n(\n (comment)* @doc\n .\n (variable_declaration\n (variable_declarator\n name: (identifier) @name\n value: [(arrow_function) (function_expression)]) @definition.function)\n (#strip! @doc \"^[\\s\\*/]+|^[\\s\\*/]$\")\n (#select-adjacent! @doc @definition.function)\n)\n";
2
+ export default _default;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - class definitions
5
+ - method definitions
6
+ - named function declarations
7
+ - arrow functions and function expressions assigned to variables
8
+ */
9
+ exports.default = `
10
+ (
11
+ (comment)* @doc
12
+ .
13
+ (method_definition
14
+ name: (property_identifier) @name) @definition.method
15
+ (#not-eq? @name "constructor")
16
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
17
+ (#select-adjacent! @doc @definition.method)
18
+ )
19
+
20
+ (
21
+ (comment)* @doc
22
+ .
23
+ [
24
+ (class
25
+ name: (_) @name)
26
+ (class_declaration
27
+ name: (_) @name)
28
+ ] @definition.class
29
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
30
+ (#select-adjacent! @doc @definition.class)
31
+ )
32
+
33
+ (
34
+ (comment)* @doc
35
+ .
36
+ [
37
+ (function_declaration
38
+ name: (identifier) @name)
39
+ (generator_function_declaration
40
+ name: (identifier) @name)
41
+ ] @definition.function
42
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
43
+ (#select-adjacent! @doc @definition.function)
44
+ )
45
+
46
+ (
47
+ (comment)* @doc
48
+ .
49
+ (lexical_declaration
50
+ (variable_declarator
51
+ name: (identifier) @name
52
+ value: [(arrow_function) (function_expression)]) @definition.function)
53
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
54
+ (#select-adjacent! @doc @definition.function)
55
+ )
56
+
57
+ (
58
+ (comment)* @doc
59
+ .
60
+ (variable_declaration
61
+ (variable_declarator
62
+ name: (identifier) @name
63
+ value: [(arrow_function) (function_expression)]) @definition.function)
64
+ (#strip! @doc "^[\\s\\*/]+|^[\\s\\*/]$")
65
+ (#select-adjacent! @doc @definition.function)
66
+ )
67
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(class_declaration\n name: (name) @name.definition.class) @definition.class\n\n(function_definition\n name: (name) @name.definition.function) @definition.function\n\n(method_declaration\n name: (name) @name.definition.function) @definition.function\n";
2
+ export default _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - class declarations
5
+ - function definitions
6
+ - method declarations
7
+ */
8
+ exports.default = `
9
+ (class_declaration
10
+ name: (name) @name.definition.class) @definition.class
11
+
12
+ (function_definition
13
+ name: (name) @name.definition.function) @definition.function
14
+
15
+ (method_declaration
16
+ name: (name) @name.definition.function) @definition.function
17
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(class_definition\n name: (identifier) @name.definition.class) @definition.class\n\n(function_definition\n name: (identifier) @name.definition.function) @definition.function\n";
2
+ export default _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - class definitions
5
+ - function definitions
6
+ */
7
+ exports.default = `
8
+ (class_definition
9
+ name: (identifier) @name.definition.class) @definition.class
10
+
11
+ (function_definition
12
+ name: (identifier) @name.definition.function) @definition.function
13
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(\n (comment)* @doc\n .\n [\n (method\n name: (_) @name.definition.method) @definition.method\n (singleton_method\n name: (_) @name.definition.method) @definition.method\n ]\n (#strip! @doc \"^#\\s*\")\n (#select-adjacent! @doc @definition.method)\n)\n\n(alias\n name: (_) @name.definition.method) @definition.method\n\n(\n (comment)* @doc\n .\n [\n (class\n name: [\n (constant) @name.definition.class\n (scope_resolution\n name: (_) @name.definition.class)\n ]) @definition.class\n (singleton_class\n value: [\n (constant) @name.definition.class\n (scope_resolution\n name: (_) @name.definition.class)\n ]) @definition.class\n ]\n (#strip! @doc \"^#\\s*\")\n (#select-adjacent! @doc @definition.class)\n)\n\n(\n (module\n name: [\n (constant) @name.definition.module\n (scope_resolution\n name: (_) @name.definition.module)\n ]) @definition.module\n)\n";
2
+ export default _default;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - method definitions (including singleton methods and aliases, with associated comments)
5
+ - class definitions (including singleton classes, with associated comments)
6
+ - module definitions
7
+ */
8
+ exports.default = `
9
+ (
10
+ (comment)* @doc
11
+ .
12
+ [
13
+ (method
14
+ name: (_) @name.definition.method) @definition.method
15
+ (singleton_method
16
+ name: (_) @name.definition.method) @definition.method
17
+ ]
18
+ (#strip! @doc "^#\\s*")
19
+ (#select-adjacent! @doc @definition.method)
20
+ )
21
+
22
+ (alias
23
+ name: (_) @name.definition.method) @definition.method
24
+
25
+ (
26
+ (comment)* @doc
27
+ .
28
+ [
29
+ (class
30
+ name: [
31
+ (constant) @name.definition.class
32
+ (scope_resolution
33
+ name: (_) @name.definition.class)
34
+ ]) @definition.class
35
+ (singleton_class
36
+ value: [
37
+ (constant) @name.definition.class
38
+ (scope_resolution
39
+ name: (_) @name.definition.class)
40
+ ]) @definition.class
41
+ ]
42
+ (#strip! @doc "^#\\s*")
43
+ (#select-adjacent! @doc @definition.class)
44
+ )
45
+
46
+ (
47
+ (module
48
+ name: [
49
+ (constant) @name.definition.module
50
+ (scope_resolution
51
+ name: (_) @name.definition.module)
52
+ ]) @definition.module
53
+ )
54
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(struct_item\n name: (type_identifier) @name.definition.class) @definition.class\n\n(declaration_list\n (function_item\n name: (identifier) @name.definition.method)) @definition.method\n\n(function_item\n name: (identifier) @name.definition.function) @definition.function\n";
2
+ export default _default;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - struct definitions
5
+ - method definitions
6
+ - function definitions
7
+ */
8
+ exports.default = `
9
+ (struct_item
10
+ name: (type_identifier) @name.definition.class) @definition.class
11
+
12
+ (declaration_list
13
+ (function_item
14
+ name: (identifier) @name.definition.method)) @definition.method
15
+
16
+ (function_item
17
+ name: (identifier) @name.definition.function) @definition.function
18
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(class_declaration\n name: (type_identifier) @name) @definition.class\n\n(protocol_declaration\n name: (type_identifier) @name) @definition.interface\n\n(class_declaration\n (class_body\n [\n (function_declaration\n name: (simple_identifier) @name\n )\n (subscript_declaration\n (parameter (simple_identifier) @name)\n )\n (init_declaration \"init\" @name)\n (deinit_declaration \"deinit\" @name)\n ]\n )\n) @definition.method\n\n(class_declaration\n (class_body\n [\n (property_declaration\n (pattern (simple_identifier) @name)\n )\n ]\n )\n) @definition.property\n\n(property_declaration\n (pattern (simple_identifier) @name)\n) @definition.property\n\n(function_declaration\n name: (simple_identifier) @name) @definition.function\n";
2
+ export default _default;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - class declarations
5
+ - method declarations (including initializers and deinitializers)
6
+ - property declarations
7
+ - function declarations
8
+ */
9
+ exports.default = `
10
+ (class_declaration
11
+ name: (type_identifier) @name) @definition.class
12
+
13
+ (protocol_declaration
14
+ name: (type_identifier) @name) @definition.interface
15
+
16
+ (class_declaration
17
+ (class_body
18
+ [
19
+ (function_declaration
20
+ name: (simple_identifier) @name
21
+ )
22
+ (subscript_declaration
23
+ (parameter (simple_identifier) @name)
24
+ )
25
+ (init_declaration "init" @name)
26
+ (deinit_declaration "deinit" @name)
27
+ ]
28
+ )
29
+ ) @definition.method
30
+
31
+ (class_declaration
32
+ (class_body
33
+ [
34
+ (property_declaration
35
+ (pattern (simple_identifier) @name)
36
+ )
37
+ ]
38
+ )
39
+ ) @definition.property
40
+
41
+ (property_declaration
42
+ (pattern (simple_identifier) @name)
43
+ ) @definition.property
44
+
45
+ (function_declaration
46
+ name: (simple_identifier) @name) @definition.function
47
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: "\n(function_signature\n name: (identifier) @name.definition.function) @definition.function\n\n(method_signature\n name: (property_identifier) @name.definition.method) @definition.method\n\n(abstract_method_signature\n name: (property_identifier) @name.definition.method) @definition.method\n\n(abstract_class_declaration\n name: (type_identifier) @name.definition.class) @definition.class\n\n(module\n name: (identifier) @name.definition.module) @definition.module\n\n(function_declaration\n name: (identifier) @name.definition.function) @definition.function\n\n(method_definition\n name: (property_identifier) @name.definition.method) @definition.method\n\n(class_declaration\n name: (type_identifier) @name.definition.class) @definition.class\n";
2
+ export default _default;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ - function signatures and declarations
5
+ - method signatures and definitions
6
+ - abstract method signatures
7
+ - class declarations (including abstract classes)
8
+ - module declarations
9
+ */
10
+ exports.default = `
11
+ (function_signature
12
+ name: (identifier) @name.definition.function) @definition.function
13
+
14
+ (method_signature
15
+ name: (property_identifier) @name.definition.method) @definition.method
16
+
17
+ (abstract_method_signature
18
+ name: (property_identifier) @name.definition.method) @definition.method
19
+
20
+ (abstract_class_declaration
21
+ name: (type_identifier) @name.definition.class) @definition.class
22
+
23
+ (module
24
+ name: (identifier) @name.definition.module) @definition.module
25
+
26
+ (function_declaration
27
+ name: (identifier) @name.definition.function) @definition.function
28
+
29
+ (method_definition
30
+ name: (property_identifier) @name.definition.method) @definition.method
31
+
32
+ (class_declaration
33
+ name: (type_identifier) @name.definition.class) @definition.class
34
+ `;
package/dist/utils.d.ts CHANGED
@@ -3,3 +3,4 @@ export { TaskInstruction } from './agentlib/taskInstruction';
3
3
  export { UserMessage } from './agentlib/usermessage';
4
4
  export { SystemPrompt } from './agentlib/systemprompt';
5
5
  export { Agent } from './agentlib/agent';
6
+ export { default as docutils } from './utils/docutils';
package/dist/utils.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Agent = exports.SystemPrompt = exports.UserMessage = exports.TaskInstruction = exports.ToolBox = void 0;
6
+ exports.docutils = exports.Agent = exports.SystemPrompt = exports.UserMessage = exports.TaskInstruction = exports.ToolBox = void 0;
4
7
  var toolBox_1 = require("./utils/toolBox");
5
8
  Object.defineProperty(exports, "ToolBox", { enumerable: true, get: function () { return toolBox_1.ToolBox; } });
6
9
  var taskInstruction_1 = require("./agentlib/taskInstruction");
@@ -11,3 +14,5 @@ var systemprompt_1 = require("./agentlib/systemprompt");
11
14
  Object.defineProperty(exports, "SystemPrompt", { enumerable: true, get: function () { return systemprompt_1.SystemPrompt; } });
12
15
  var agent_1 = require("./agentlib/agent");
13
16
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
17
+ var docutils_1 = require("./utils/docutils");
18
+ Object.defineProperty(exports, "docutils", { enumerable: true, get: function () { return __importDefault(docutils_1).default; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -12,7 +12,7 @@
12
12
  "LICENSE"
13
13
  ],
14
14
  "scripts": {
15
- "build": "tsc",
15
+ "build": "tsc && node script/copy-wasm.js",
16
16
  "build:webpack": "webpack",
17
17
  "build:all": "npm run build && npm run build:webpack",
18
18
  "build:docs": "typedoc --plugin typedoc-plugin-missing-exports",
@@ -28,18 +28,22 @@
28
28
  "license": "MIT",
29
29
  "homepage": "https://codeboltai.github.io",
30
30
  "dependencies": {
31
+ "@codebolt/globby": "^1.0.1",
31
32
  "@codebolt/types": "^1.0.10",
32
33
  "@modelcontextprotocol/sdk": "^1.4.1",
34
+ "@types/pdf-parse": "^1.1.5",
33
35
  "execa": "^9.5.2",
34
36
  "file-type": "^19.6.0",
35
37
  "fuse.js": "^7.0.0",
36
38
  "js-yaml": "^4.1.0",
37
39
  "load-esm": "^1.0.1",
38
40
  "mcp-proxy": "^2.4.0",
41
+ "pdf-parse": "^1.1.1",
39
42
  "strict-event-emitter-types": "^2.0.0",
40
43
  "timers": "^0.1.1",
41
44
  "undici": "^7.4.0",
42
45
  "uri-templates": "^0.2.0",
46
+ "web-tree-sitter": "^0.24.1",
43
47
  "ws": "^8.17.0",
44
48
  "yargs": "^17.7.2",
45
49
  "zod": "^3.24.1",
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * A module for document utility functions.
5
- */
6
- const cbdocutils = {
7
- /**
8
- * Converts a PDF document to text.
9
- * @param pdf_path - The file path to the PDF document to be converted.
10
- * @returns {Promise<string>} A promise that resolves with the converted text.
11
- */
12
- pdf_to_text: (pdf_path) => {
13
- // Implementation would go here
14
- return new Promise((resolve, reject) => {
15
- // PDF to text conversion logic
16
- });
17
- }
18
- };
19
- exports.default = cbdocutils;