makima-cli 0.2.1__tar.gz → 1.2.1__tar.gz

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 (31) hide show
  1. {makima_cli-0.2.1 → makima_cli-1.2.1}/LICENSE +0 -0
  2. {makima_cli-0.2.1 → makima_cli-1.2.1}/PKG-INFO +2 -2
  3. {makima_cli-0.2.1 → makima_cli-1.2.1}/README.md +1 -1
  4. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/__init__.py +0 -0
  5. makima_cli-1.2.1/makima/config.py +38 -0
  6. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/core/__init__.py +0 -0
  7. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/core/agent.py +0 -0
  8. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/core/config_manager.py +0 -0
  9. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/core/context.py +0 -0
  10. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/core/memory.py +0 -0
  11. makima_cli-1.2.1/makima/main.py +14 -0
  12. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/providers/base.py +0 -0
  13. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/providers/groq_provider.py +17 -2
  14. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/setup.py +2 -1
  15. makima_cli-1.2.1/makima/test.py +49 -0
  16. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/tools/__init__.py +0 -0
  17. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/tools/file_tools.py +0 -0
  18. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/tools/registry.py +0 -0
  19. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima/tools/shell_tools.py +0 -0
  20. makima_cli-1.2.1/makima/ui/__init__.py +0 -0
  21. makima_cli-1.2.1/makima/ui/app.py +138 -0
  22. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima_cli.egg-info/PKG-INFO +2 -2
  23. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima_cli.egg-info/SOURCES.txt +3 -0
  24. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima_cli.egg-info/dependency_links.txt +0 -0
  25. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima_cli.egg-info/entry_points.txt +0 -0
  26. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima_cli.egg-info/requires.txt +0 -0
  27. {makima_cli-0.2.1 → makima_cli-1.2.1}/makima_cli.egg-info/top_level.txt +0 -0
  28. {makima_cli-0.2.1 → makima_cli-1.2.1}/pyproject.toml +1 -1
  29. {makima_cli-0.2.1 → makima_cli-1.2.1}/setup.cfg +0 -0
  30. makima_cli-0.2.1/makima/config.py +0 -20
  31. makima_cli-0.2.1/makima/main.py +0 -8
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makima-cli
3
- Version: 0.2.1
3
+ Version: 1.2.1
4
4
  Summary: AI coding assistant for your terminal
5
5
  Author: Kanhaiya
6
6
  License: MIT License
@@ -52,7 +52,7 @@ An AI-powered coding assistant that runs in your terminal. Point it at any codeb
52
52
 
53
53
  ## Install
54
54
 
55
- git clone https://github.com/yourusername/makima-cli.git
55
+ git clone https://github.com/kanhaiya-ML/makima-cli.git
56
56
  cd makima-cli
57
57
  pip install -r requirements.txt
58
58
 
@@ -14,7 +14,7 @@ An AI-powered coding assistant that runs in your terminal. Point it at any codeb
14
14
 
15
15
  ## Install
16
16
 
17
- git clone https://github.com/yourusername/makima-cli.git
17
+ git clone https://github.com/kanhaiya-ML/makima-cli.git
18
18
  cd makima-cli
19
19
  pip install -r requirements.txt
20
20
 
@@ -0,0 +1,38 @@
1
+ # import os
2
+ # import sys
3
+ # from makima.setup import setup_api_key,setup_model
4
+ # from dotenv import load_dotenv
5
+ # load_dotenv()
6
+
7
+ # GROQ_API_KEY = setup_api_key()
8
+ # # GROQ_API_KEY = os.getenv("GROQ_API_KEY")
9
+ # MODEL_NAME = setup_model()
10
+ # TOKEN_LIMIT = 10000
11
+ # # PROJECT_ROOT = os.getcwd()
12
+ # PROJECT_ROOT = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
13
+
14
+ # if not GROQ_API_KEY:
15
+ # print("Error: GROQ_API_KEY not set.")
16
+ # print("Run this command first:")
17
+ # print(' Windows: setx GROQ_API_KEY "your-key-here"')
18
+ # print(' Linux/Mac: export GROQ_API_KEY="your-key-here"')
19
+ # print("Get a free key at: https://console.groq.com")
20
+ # sys.exit(1)
21
+
22
+ import os
23
+ import sys
24
+ import json
25
+ from pathlib import Path
26
+ from dotenv import load_dotenv
27
+ load_dotenv()
28
+
29
+ config_file = Path.home() / ".makima" / "config.json"
30
+ config = {}
31
+ if config_file.exists():
32
+ with open(config_file, "r") as f:
33
+ config = json.load(f)
34
+
35
+ GROQ_API_KEY = config.get("groq_api_key") or os.getenv("GROQ_API_KEY")
36
+ MODEL_NAME = config.get("model") or "qwen/qwen3.6-27b"
37
+ TOKEN_LIMIT = 6000
38
+ PROJECT_ROOT = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
@@ -0,0 +1,14 @@
1
+ from makima.core.agent import run_agent
2
+ import sys
3
+ from makima.ui.app import run_ui
4
+ from makima.setup import setup_api_key, setup_model
5
+
6
+
7
+ def main():
8
+ # run_agent()
9
+ setup_model()
10
+ setup_api_key()
11
+ run_ui()
12
+
13
+ if __name__ == "__main__":
14
+ main()
@@ -1,11 +1,26 @@
1
1
  from groq import Groq
2
2
  from makima.providers.base import LLMProvider
3
- from makima.config import GROQ_API_KEY, MODEL_NAME
3
+ from makima.config import MODEL_NAME
4
+ import os
5
+ import json
6
+ from pathlib import Path
4
7
 
5
8
  class GroqProvider(LLMProvider):
6
9
 
7
10
  def __init__(self):
8
- self.client = Groq(api_key=GROQ_API_KEY)
11
+ # read fresh from config file
12
+ key = self._load_key()
13
+ self.client = Groq(api_key=key)
14
+
15
+ def _load_key(self):
16
+ config_file = Path.home() / ".makima" / "config.json"
17
+ if config_file.exists():
18
+ with open(config_file, "r") as f:
19
+ data = json.load(f)
20
+ key = data.get("groq_api_key")
21
+ if key:
22
+ return key
23
+ return os.getenv("GROQ_API_KEY")
9
24
 
10
25
  def chat(self, messages: list, tools: list) -> object:
11
26
  return self.client.chat.completions.create(
@@ -28,7 +28,7 @@ def setup_api_key():
28
28
  with open(config_file, "r") as f:
29
29
  data = json.load(f)
30
30
  key = data.get("groq_api_key")
31
- if key:
31
+ if key and validate_key(key):
32
32
  return key
33
33
 
34
34
  import os
@@ -83,6 +83,7 @@ def setup_model():
83
83
 
84
84
  existing["model"] = model
85
85
 
86
+ config_dir.mkdir(exist_ok=True)
86
87
  with open(config_file,"w") as f:
87
88
  json.dump(existing,f)
88
89
 
@@ -0,0 +1,49 @@
1
+ from textual.app import App
2
+ from textual.widgets import Header, Footer, Input, RichLog
3
+ from rich.text import Text
4
+
5
+ from makima.providers.groq_provider import GroqProvider
6
+ from makima.core.memory import Memory
7
+
8
+ SYSTEM_PROMPT = "..."
9
+ class Makima(App):
10
+
11
+ def on_mount(self):
12
+ self.provider = GroqProvider()
13
+ self.memory = Memory(system_prompt=SYSTEM_PROMPT)
14
+
15
+ def compose(self):
16
+ yield Header()
17
+
18
+ yield RichLog(id="chat")
19
+
20
+ yield Input(
21
+ placeholder="Ask Makima...",
22
+ id="input"
23
+ )
24
+
25
+ yield Footer()
26
+
27
+ def on_input_submitted(self, event: Input.Submitted):
28
+ chat = self.query_one("#chat", RichLog)
29
+
30
+ user_input = event.value.strip()
31
+
32
+ if not user_input:
33
+ return
34
+
35
+ chat.write(
36
+ Text(f"You: {user_input}",style="bold cyan")
37
+ )
38
+
39
+
40
+ event.input.value = ""
41
+
42
+ chat.write(
43
+ Text("Makima: Hello! I'm alive", style="bold green")
44
+ )
45
+ # chat.write("[bold green]Makima:[/] Hello! I'm alive")
46
+
47
+ if __name__ == "__main__":
48
+ app = Makima()
49
+ app.run()
File without changes
@@ -0,0 +1,138 @@
1
+ from textual.app import App, ComposeResult
2
+ from textual.widgets import Header, Footer, Input, RichLog
3
+ from makima.config import PROJECT_ROOT
4
+ from makima.tools import TOOL_REGISTRY
5
+ from makima.tools.registry import TOOL_SCHEMAS
6
+ from makima.core.config_manager import handle_config
7
+
8
+ import asyncio
9
+ import json
10
+
11
+ from makima.providers.groq_provider import GroqProvider
12
+ from makima.core.memory import Memory
13
+
14
+
15
+ SYSTEM_PROMPT = f"""
16
+ You are a coding assistant. The project is at: {PROJECT_ROOT}
17
+
18
+ Rules:
19
+ - Always use list_files first to find exact paths
20
+ - Always use read_file before editing any file
21
+ - Use full absolute paths always
22
+ - Be concise and direct
23
+ - old_str must be an exact match of multiple lines from the file
24
+ - Never explain what you are about to do. Never say "Let me..." or "I'll first...".
25
+ - Just call the tool immediately and silently.
26
+ - Only speak in plain text when you have a FINAL answer for the user.
27
+ - Call only ONE tool per response. Wait for the tool result before calling the next tool.
28
+ - Never output multiple tool calls in one response.
29
+ """
30
+
31
+
32
+ class MakimaApp(App):
33
+ CSS_PATH = "app.tcss"
34
+
35
+ def __init__(self):
36
+ super().__init__()
37
+ self.memory = Memory(system_prompt=SYSTEM_PROMPT)
38
+ self.provider = GroqProvider()
39
+
40
+ def compose(self) -> ComposeResult:
41
+ yield Header()
42
+ yield RichLog(id="chat",markup=True, highlight=True)
43
+ yield Input(placeholder="Ask anything... (type 'exit' to quit)")
44
+ yield Footer()
45
+
46
+ def on_mount(self):
47
+ # focus the input so user can type immediately
48
+ self.query_one(Input).focus()
49
+
50
+
51
+ async def on_input_submitted(self, event: Input.Submitted) -> None:
52
+ user_input = event.value.strip()
53
+
54
+ if not user_input:
55
+ return
56
+
57
+ chat = self.query_one(RichLog)
58
+ input_box = self.query_one(Input)
59
+
60
+ chat.write(f"[bold blue]You:[/] {user_input}")
61
+ input_box.clear()
62
+
63
+ if user_input == "exit":
64
+ self.exit()
65
+ return
66
+
67
+ if user_input == "/config":
68
+ # config runs in background thread
69
+ await asyncio.to_thread(handle_config)
70
+ return
71
+
72
+
73
+ # show thinking indicator
74
+ chat.write("[dim]thinking...[/]")
75
+
76
+ # run agent in background thread
77
+ response = await asyncio.to_thread(self.process_message, user_input)
78
+
79
+ # remove "thinking..." and show response
80
+ from rich.markdown import Markdown
81
+ chat.write(Markdown(f"[bold green]Agent:[/] {response}"))
82
+
83
+
84
+ def process_message(self, user_input):
85
+ self.memory.add_user(user_input)
86
+
87
+ while True:
88
+ stream = self.provider.stream_chat(
89
+ messages=self.memory.get(),
90
+ tools=TOOL_SCHEMAS
91
+ )
92
+ chunks = list(stream)
93
+
94
+ # collect chunks
95
+ text_buffer = ""
96
+ tool_name = ""
97
+ tool_args = ""
98
+ tool_call_id = ""
99
+ is_tool_call = False
100
+
101
+ for chunk in chunks:
102
+ delta = chunk.choices[0].delta
103
+ if delta.content:
104
+ text_buffer += delta.content
105
+ if delta.tool_calls:
106
+ is_tool_call = True
107
+ tc = delta.tool_calls[0]
108
+ if tc.id:
109
+ tool_call_id = tc.id
110
+ if tc.function.name:
111
+ tool_name += tc.function.name
112
+ if tc.function.arguments:
113
+ tool_args += tc.function.arguments
114
+
115
+ if is_tool_call:
116
+ args = json.loads(tool_args)
117
+ tool_fn = TOOL_REGISTRY.get(tool_name)
118
+ result = tool_fn(**args) if tool_fn else "Unknown tool"
119
+
120
+ self.memory.add_raw({
121
+ "role": "assistant",
122
+ "tool_calls": [{
123
+ "id": tool_call_id,
124
+ "type": "function",
125
+ "function": {
126
+ "name": tool_name,
127
+ "arguments": tool_args
128
+ }
129
+ }]
130
+ })
131
+ self.memory.add_tool_result(tool_call_id, str(result))
132
+
133
+ else:
134
+ self.memory.add_assistant(text_buffer)
135
+ return text_buffer
136
+ def run_ui():
137
+ app = MakimaApp()
138
+ app.run()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makima-cli
3
- Version: 0.2.1
3
+ Version: 1.2.1
4
4
  Summary: AI coding assistant for your terminal
5
5
  Author: Kanhaiya
6
6
  License: MIT License
@@ -52,7 +52,7 @@ An AI-powered coding assistant that runs in your terminal. Point it at any codeb
52
52
 
53
53
  ## Install
54
54
 
55
- git clone https://github.com/yourusername/makima-cli.git
55
+ git clone https://github.com/kanhaiya-ML/makima-cli.git
56
56
  cd makima-cli
57
57
  pip install -r requirements.txt
58
58
 
@@ -5,6 +5,7 @@ makima/__init__.py
5
5
  makima/config.py
6
6
  makima/main.py
7
7
  makima/setup.py
8
+ makima/test.py
8
9
  makima/core/__init__.py
9
10
  makima/core/agent.py
10
11
  makima/core/config_manager.py
@@ -16,6 +17,8 @@ makima/tools/__init__.py
16
17
  makima/tools/file_tools.py
17
18
  makima/tools/registry.py
18
19
  makima/tools/shell_tools.py
20
+ makima/ui/__init__.py
21
+ makima/ui/app.py
19
22
  makima_cli.egg-info/PKG-INFO
20
23
  makima_cli.egg-info/SOURCES.txt
21
24
  makima_cli.egg-info/dependency_links.txt
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "makima-cli"
7
- version = "0.2.1"
7
+ version = "1.2.1"
8
8
  description = "AI coding assistant for your terminal"
9
9
  readme = "README.md"
10
10
  license = {file = "LICENSE"}
File without changes
@@ -1,20 +0,0 @@
1
- import os
2
- import sys
3
- from makima.setup import setup_api_key,setup_model
4
- from dotenv import load_dotenv
5
- load_dotenv()
6
-
7
- GROQ_API_KEY = setup_api_key()
8
- # GROQ_API_KEY = os.getenv("GROQ_API_KEY")
9
- MODEL_NAME = setup_model()
10
- TOKEN_LIMIT = 10000
11
- # PROJECT_ROOT = os.getcwd()
12
- PROJECT_ROOT = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()
13
-
14
- if not GROQ_API_KEY:
15
- print("Error: GROQ_API_KEY not set.")
16
- print("Run this command first:")
17
- print(' Windows: setx GROQ_API_KEY "your-key-here"')
18
- print(' Linux/Mac: export GROQ_API_KEY="your-key-here"')
19
- print("Get a free key at: https://console.groq.com")
20
- sys.exit(1)
@@ -1,8 +0,0 @@
1
- from makima.core.agent import run_agent
2
- import sys
3
-
4
- def main():
5
- run_agent()
6
-
7
- if __name__ == "__main__":
8
- main()