raggiecode 0.2.1__py3-none-any.whl

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 (93) hide show
  1. Agent/__init__.py +0 -0
  2. Agent/agent.py +891 -0
  3. Agent/chat_history_db.py +1500 -0
  4. Agent/command.py +49 -0
  5. Agent/config.py +46 -0
  6. Agent/effort_levels.py +33 -0
  7. Agent/git_manager.py +727 -0
  8. Agent/tools.py +35 -0
  9. Commands/__init__.py +18 -0
  10. Commands/effort.py +42 -0
  11. Commands/global_todo.py +23 -0
  12. Commands/help.py +22 -0
  13. Commands/reasoning.py +24 -0
  14. Commands/redo.py +11 -0
  15. Commands/reindex.py +27 -0
  16. Commands/shell.py +28 -0
  17. Commands/stream.py +24 -0
  18. Commands/undo.py +13 -0
  19. Commands/unlimited_effort.py +8 -0
  20. Commands/window_size.py +29 -0
  21. RAG/__init__.py +0 -0
  22. RAG/document.py +119 -0
  23. RAG/find.py +408 -0
  24. RAG/graph.py +231 -0
  25. Tools/GetFileCodeStructure.py +43 -0
  26. Tools/GetSymbolSourceCode.py +27 -0
  27. Tools/__init__.py +39 -0
  28. Tools/ask_user.py +102 -0
  29. Tools/dispatch_subagent.py +215 -0
  30. Tools/document.py +35 -0
  31. Tools/edit_symbol.py +250 -0
  32. Tools/fuzzy_search.py +119 -0
  33. Tools/list_dir.py +51 -0
  34. Tools/read.py +49 -0
  35. Tools/read_image.py +75 -0
  36. Tools/remove.py +75 -0
  37. Tools/replace.py +305 -0
  38. Tools/search.py +41 -0
  39. Tools/shell.py +149 -0
  40. Tools/shell_kill.py +87 -0
  41. Tools/temp_background_service.py +113 -0
  42. Tools/todo_list.py +481 -0
  43. Tools/utils.py +116 -0
  44. Tools/view_changes.py +179 -0
  45. Tools/walk_call_tree.py +30 -0
  46. Tools/web_fetch.py +175 -0
  47. Tools/web_search.py +69 -0
  48. Tools/write.py +48 -0
  49. cli.py +111 -0
  50. config/__init__.py +0 -0
  51. config/coder_system_prompt.md +119 -0
  52. config/roles.json +43 -0
  53. config/tools.json +709 -0
  54. indexing/__init__.py +0 -0
  55. indexing/cli.py +128 -0
  56. indexing/code_index_sdk.py +832 -0
  57. indexing/code_indexer.py +1763 -0
  58. indexing/db_schema.py +396 -0
  59. indexing/export_to_json.py +346 -0
  60. indexing/extractors.py +189 -0
  61. indexing/file_utils.py +97 -0
  62. indexing/frontend/__init__.py +0 -0
  63. indexing/frontend/css_extractor.py +195 -0
  64. indexing/frontend/css_parser.py +387 -0
  65. indexing/frontend/css_selector_utils.py +226 -0
  66. indexing/frontend/edit_safety.py +573 -0
  67. indexing/frontend/graph.py +838 -0
  68. indexing/frontend/html_extractor.py +496 -0
  69. indexing/frontend/html_parser.py +314 -0
  70. indexing/frontend/jsx_extractor.py +1204 -0
  71. indexing/frontend/location_lookup.py +247 -0
  72. indexing/frontend/resolver.py +485 -0
  73. indexing/frontend/runtime_resolver.py +862 -0
  74. indexing/frontend/semantic_output.py +705 -0
  75. indexing/frontend/source_location.py +69 -0
  76. indexing/frontend_config.py +72 -0
  77. indexing/frontend_models.py +347 -0
  78. indexing/language_config.py +360 -0
  79. indexing/models.py +284 -0
  80. indexing/node_utils.py +1112 -0
  81. indexing/parse_worker.py +1082 -0
  82. indexing/queries.py +1542 -0
  83. indexing/sdk_examples.py +426 -0
  84. interactive.py +248 -0
  85. raggie.py +673 -0
  86. raggiecode-0.2.1.dist-info/METADATA +944 -0
  87. raggiecode-0.2.1.dist-info/RECORD +93 -0
  88. raggiecode-0.2.1.dist-info/WHEEL +5 -0
  89. raggiecode-0.2.1.dist-info/entry_points.txt +2 -0
  90. raggiecode-0.2.1.dist-info/top_level.txt +10 -0
  91. skills/__init__.py +3 -0
  92. skills/manager.py +114 -0
  93. skills/tool.py +121 -0
Agent/command.py ADDED
@@ -0,0 +1,49 @@
1
+ class CommandRegistry:
2
+ """Registry for slash commands and other user-facing commands.
3
+
4
+ Commands are registered with a prefix (e.g. ``/undo``, ``!``) and a
5
+ handler function. When the user's prompt starts with a registered
6
+ prefix, the matching handler is invoked with the remaining argument
7
+ string and the agent instance.
8
+
9
+ Handler signature::
10
+
11
+ def handle(args: str, agent: Agent) -> str | None
12
+
13
+ *args* is everything after the prefix (stripped). Returning ``None``
14
+ signals that the command was a no-op (e.g. empty ``!`` with no command).
15
+ """
16
+
17
+ def __init__(self):
18
+ self.commands = {}
19
+
20
+ def register(self, prefix, handler):
21
+ """Register a command handler for a given prefix."""
22
+ self.commands[prefix] = handler
23
+
24
+
25
+ # returns <bool>, <str>
26
+ # if bool is true the agent need to use <str> as prompt
27
+ # no action is needed form the agent and it will ignore the string
28
+ def try_handle(self, prompt, agent):
29
+ command = ""
30
+ args = ""
31
+ if len(prompt) >= 1 and prompt[0] == "!":
32
+ command = "!"
33
+ args = prompt[1:].strip()
34
+ elif not " " in prompt:
35
+ command = prompt
36
+ else:
37
+ command = prompt[:prompt.index(" ")]
38
+ args = prompt[prompt.index(" ") + 1:].strip()
39
+
40
+ handler = self.commands.get(command)
41
+
42
+ if handler == None:
43
+ return True, prompt # process normal prompts that does not match the rules must be processed by the agent
44
+
45
+ result = handler(args, agent)
46
+ if result == "":
47
+ return False, "" #do not serve the agent any prompt. what string you return do not matter here
48
+ else:
49
+ return True, result
Agent/config.py ADDED
@@ -0,0 +1,46 @@
1
+ import json
2
+ import shutil
3
+ from pathlib import Path
4
+
5
+ # The user's config directory (~/.config/raggie)
6
+ USER_CONFIG_DIR = Path.home() / ".config" / "raggie"
7
+
8
+ # The default config directory in the source code
9
+ DEFAULT_CONFIG_DIR = Path(__file__).parent.parent / "config"
10
+
11
+ def ensure_config_exists(filename):
12
+ USER_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
13
+ user_file = USER_CONFIG_DIR / filename
14
+
15
+ # If the user doesn't have the config file yet, copy it from the defaults
16
+ if not user_file.exists():
17
+ default_file = DEFAULT_CONFIG_DIR / filename
18
+ if default_file.exists():
19
+ shutil.copy2(default_file, user_file)
20
+ else:
21
+ # Fallback if somehow the default doesn't exist
22
+ user_file.write_text("{}")
23
+
24
+ return user_file
25
+
26
+ def load_roles():
27
+ config_file = ensure_config_exists("roles.json")
28
+ with open(config_file, "r") as f:
29
+ return json.load(f)
30
+
31
+
32
+ def save_roles(roles: dict):
33
+ """Save roles dict to the user's roles.json file."""
34
+ config_file = ensure_config_exists("roles.json")
35
+ with open(config_file, "w") as f:
36
+ json.dump(roles, f, indent=4)
37
+
38
+ def load_tools():
39
+ config_file = ensure_config_exists("tools.json")
40
+ with open(config_file, "r") as f:
41
+ return json.load(f)
42
+
43
+ def load_keys():
44
+ config_file = ensure_config_exists("keys.json")
45
+ with open(config_file, "r") as f:
46
+ return json.load(f)
Agent/effort_levels.py ADDED
@@ -0,0 +1,33 @@
1
+ EFFORT_LEVELS = {
2
+ 1: {"name": "Zen", "max_depth": 1},
3
+ 2: {"name": "Serious", "max_depth": 2},
4
+ 3: {"name": "Extreme", "max_depth": 4},
5
+ 4: {"name": "Feral", "max_depth": 8},
6
+ 5: {"name": "Insane", "max_depth": 16},
7
+ }
8
+
9
+ DEFAULT_EFFORT = 1
10
+ UNLIMITED_EFFORT = 99
11
+
12
+
13
+ def effort_name(effort_num):
14
+ if effort_num == UNLIMITED_EFFORT:
15
+ return "Unlimited"
16
+ entry = EFFORT_LEVELS.get(effort_num)
17
+ if entry is None:
18
+ return "Unknown"
19
+ return entry["name"]
20
+
21
+
22
+ def effort_max_depth(effort_num):
23
+ entry = EFFORT_LEVELS.get(effort_num)
24
+ if entry is None:
25
+ return None
26
+ return entry["max_depth"]
27
+
28
+
29
+ def is_depth_allowed(effort_num, depth):
30
+ max_depth = effort_max_depth(effort_num)
31
+ if max_depth is None:
32
+ return True
33
+ return depth < max_depth