mini-code-cli 0.0.7__tar.gz → 0.0.7.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-code-cli
3
- Version: 0.0.7
3
+ Version: 0.0.7.1
4
4
  Summary: Minimal Coding CLI
5
5
  Author-email: Nikolai Rozanov <nikolai.rozanov@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -20,7 +20,9 @@ Dynamic: license-file
20
20
 
21
21
  # A minimal coding agent cli
22
22
 
23
- Purpose: no bloat, minimal coding cli, to enjoy experimenting and researching things...
23
+ > No bloat, no dependencies, no tracking...
24
+
25
+ Purpose: A no bloat, minimal coding cli, to enjoy experimenting and researching...
24
26
 
25
27
  ## Getting started:
26
28
  1. Installation (from pypi)
@@ -34,5 +36,10 @@ mini-code #run the agent loop
34
36
  mini-code --url "https://api.deepseek.com" --model "deepseek-v4-flash" --api-key "sk-dummy" --allowed-dir ./experiments/
35
37
  ```
36
38
 
39
+ 3. Get help:
40
+ ```bash
41
+ mini-code --help
42
+ ```
43
+
37
44
 
38
45
  ## (C) Nikolai Rozanov, 2026 - Present
@@ -1,6 +1,8 @@
1
1
  # A minimal coding agent cli
2
2
 
3
- Purpose: no bloat, minimal coding cli, to enjoy experimenting and researching things...
3
+ > No bloat, no dependencies, no tracking...
4
+
5
+ Purpose: A no bloat, minimal coding cli, to enjoy experimenting and researching...
4
6
 
5
7
  ## Getting started:
6
8
  1. Installation (from pypi)
@@ -14,5 +16,10 @@ mini-code #run the agent loop
14
16
  mini-code --url "https://api.deepseek.com" --model "deepseek-v4-flash" --api-key "sk-dummy" --allowed-dir ./experiments/
15
17
  ```
16
18
 
19
+ 3. Get help:
20
+ ```bash
21
+ mini-code --help
22
+ ```
23
+
17
24
 
18
25
  ## (C) Nikolai Rozanov, 2026 - Present
@@ -0,0 +1,2 @@
1
+ from importlib.metadata import version
2
+ __version__ = version("mini-code-cli")
@@ -1,3 +1,13 @@
1
+ """
2
+ Usage:
3
+ mini-code
4
+
5
+ Prompt:
6
+
7
+ write a similar model.py file but for a LSTM based language model. Make it minimal and call it model_lstm.py it should still be compatible with eval.py
8
+
9
+ """
10
+
1
11
  import os
2
12
  import json
3
13
 
@@ -33,16 +43,27 @@ def parse_args():
33
43
  parser.add_argument("--max-tokens", type=int, help="Maximum tokens for LLM response")
34
44
  parser.add_argument("--temperature", type=float, default=0.0, help="Temperature for LLM")
35
45
  parser.add_argument("--model", type=str, default="default", help="Model name")
46
+ parser.add_argument("--step_by_step", action="store_true", help="Whether to run the agent step by step. Default is to run in 'Permission' mode.")
47
+ parser.add_argument("--ask_permission", action="store_true", help="Ask for permission before any tool call.")
48
+
36
49
  args = parser.parse_args()
37
50
  return args
38
51
 
39
- def print_welcome(allowed_dir, server_url):
52
+ def print_welcome(allowed_dir, server_url, args):
40
53
  # Calculate the length of the longest line inside the box
54
+ version = __import__('mini_code_cli').__version__
55
+
56
+ permission_mode = "All tool calls require permission." if args.ask_permission else "Tool calls will execute without asking for permission."
57
+ agent_mode = "Agent is in manual-mode." if args.step_by_step else "Agent is in auto-mode."
58
+
41
59
  lines = [
42
- " Coding Agent Loop Started",
43
- " Type 'quit' or 'exit' to exit the loop.",
60
+ f" MiniCodeCLI (v{version})",
61
+ " Type 'quit' or 'exit' to exit the loop.",
44
62
  f" Allowed dir: {allowed_dir}",
45
- f" Server URL: {server_url}"
63
+ f" Server URL: {server_url}",
64
+ f" {permission_mode}",
65
+ f" {agent_mode}",
66
+ " Shell disabled."
46
67
  ]
47
68
  max_len = max(len(line) for line in lines)
48
69
  margin = 2 # Space on each side inside the box
@@ -57,6 +78,14 @@ def print_welcome(allowed_dir, server_url):
57
78
  bottom = "╚" + "═" * inner_width + "╝"
58
79
  print(bottom)
59
80
 
81
+ def print_help(allowed_dir, server_url, args):
82
+ print_welcome(allowed_dir, server_url, args)
83
+
84
+ help_message = ""
85
+ help_message += "Manual-mode means the agent will ask for user input after each LLM prediction." if args.step_by_step else "Auto-mode means the agent will keep calling the LLM until no further LLM calls are possible."
86
+
87
+ print(f"{BOLD}{GREEN}HELP:{RESET} {help_message}")
88
+
60
89
  def main():
61
90
  args = parse_args()
62
91
 
@@ -73,24 +102,43 @@ def main():
73
102
 
74
103
  messages = [{"role": "system", "content": system_prompt}]
75
104
 
76
- print_welcome(allowed_dir, server_url)
105
+ print_welcome(allowed_dir, server_url, args)
77
106
 
107
+ llm_response_flag = False
108
+ llm_tool_response_flag = False
109
+ llm_repeat_flag = False
110
+ tool_count = 0
111
+
78
112
  while True:
79
- llm_response_flag = False
80
- llm_tool_response_flag = False
81
- try:
82
- print("-"*30)
83
- user_input = input(f"{BOLD}{CYAN}You:{RESET} ")
84
- if user_input.lower() in ["quit", "exit"]:
113
+ if llm_tool_response_flag and not args.step_by_step: #skip user input and try to call the model again until there no more tool calls.
114
+ print(f"{BOLD}{YELLOW}System:{RESET} Skipping user input. Continuing with LLM calls until no more tool calls.")
115
+ llm_repeat_flag = True
116
+ else:
117
+ # get user input
118
+ if llm_repeat_flag:
119
+ print(f"{BOLD}{YELLOW}System:{RESET} Called {tool_count} tools in total. Exiting tool loop.")
120
+
121
+ tool_count = 0
122
+ try:
123
+ print("-"*30)
124
+ user_input = input(f"{BOLD}{CYAN}You:{RESET} ")
125
+ if user_input.lower() in ["quit", "exit", "/quit", "/exit"]:
126
+ print("\nThank you. Goodbye! Saving history...")
127
+ save_history(messages)
128
+ break
129
+ except KeyboardInterrupt:
85
130
  print("\nThank you. Goodbye! Saving history...")
86
131
  save_history(messages)
87
132
  break
88
- except KeyboardInterrupt:
89
- print("\nThank you. Goodbye! Saving history...")
90
- save_history(messages)
91
- break
133
+
134
+ if user_input == "/help":
135
+ print_help(allowed_dir, server_url, args)
136
+ continue
92
137
 
93
- messages.append({"role": "user", "content": user_input})
138
+ messages.append({"role": "user", "content": user_input})
139
+
140
+ llm_response_flag = False
141
+ llm_tool_response_flag = False
94
142
 
95
143
  response_text, tool_calls = utils.call_openai_server(
96
144
  messages,
@@ -102,16 +150,23 @@ def main():
102
150
  )
103
151
 
104
152
  if response_text:
105
- print(f"{BOLD}{GREEN}Assistant:{RESET} {response_text}")
106
- messages.append({"role": "assistant", "content": response_text})
107
- else:
108
153
  llm_response_flag = True
154
+ print(f"{BOLD}{GREEN}Assistant:{RESET} {response_text}")
109
155
 
110
156
  if tool_calls:
157
+ llm_tool_response_flag = True
158
+
159
+ messages.append({
160
+ "role": "assistant",
161
+ "content": response_text,
162
+ "tool_calls": tool_calls
163
+ })
111
164
  # Tool call parsing and execution
112
165
  print(f"{BOLD}{YELLOW}Tool Call:{RESET} LLM is trying to call {len(tool_calls)} tools.")
113
166
 
114
167
  for call in tool_calls:
168
+ tool_count += 1
169
+
115
170
  call_id = call.get("id", "")
116
171
  name = call.get("function", {}).get("name", "")
117
172
  params_str = call.get("function", {}).get("arguments", "{}")
@@ -132,6 +187,24 @@ def main():
132
187
  continue
133
188
 
134
189
  func = tools_dict[name]["function"]
190
+ # asking permissions
191
+ if args.ask_permission:
192
+ print(f"{BOLD}{YELLOW}Tool permission:{RESET} Are you sure you want to call the tool?")
193
+ print(f"name: {name}, parameters: {params_str}")
194
+ try:
195
+ permission_input = input("Type: 'y' or 'yes'\n")
196
+ except KeyboardInterrupt:
197
+ print("\nThank you. Goodbye! Saving history...")
198
+ save_history(messages)
199
+ sys.exit(0)
200
+
201
+ if not permission_input in ['y', 'yes']:
202
+ print(f"{BOLD}{YELLOW}Tool permission denied:{RESET}.")
203
+ messages.append({
204
+ "role": "user",
205
+ "content": f"User denied permission for tool {name} and params {params_str}."
206
+ })
207
+ continue
135
208
  result = func(**tool_params)
136
209
  # Limiting output to 300 characters for readability
137
210
  result_str = str(result)
@@ -145,11 +218,15 @@ def main():
145
218
  "content": str(result)
146
219
  })
147
220
  else:
148
- print(f"{BOLD}{RED}Warning:{RESET} Unknown tool: {name}")
221
+ print(f"{BOLD}{RED}Warning:{RESET} Unknown tool: {name}, params {params_str}")
149
222
  else:
150
- llm_tool_response_flag = True
223
+ messages.append({
224
+ "role": "assistant",
225
+ "content": response_text,
226
+ # "tool_calls": tool_calls
227
+ })
151
228
 
152
- if llm_response_flag and llm_tool_response_flag:
229
+ if not llm_response_flag and not llm_tool_response_flag:
153
230
  print(f"{BOLD}{RED}Warning:{RESET} No response was given by the LLM.")
154
231
 
155
232
  save_history(messages)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mini-code-cli
3
- Version: 0.0.7
3
+ Version: 0.0.7.1
4
4
  Summary: Minimal Coding CLI
5
5
  Author-email: Nikolai Rozanov <nikolai.rozanov@gmail.com>
6
6
  License: The MIT License (MIT)
@@ -20,7 +20,9 @@ Dynamic: license-file
20
20
 
21
21
  # A minimal coding agent cli
22
22
 
23
- Purpose: no bloat, minimal coding cli, to enjoy experimenting and researching things...
23
+ > No bloat, no dependencies, no tracking...
24
+
25
+ Purpose: A no bloat, minimal coding cli, to enjoy experimenting and researching...
24
26
 
25
27
  ## Getting started:
26
28
  1. Installation (from pypi)
@@ -34,5 +36,10 @@ mini-code #run the agent loop
34
36
  mini-code --url "https://api.deepseek.com" --model "deepseek-v4-flash" --api-key "sk-dummy" --allowed-dir ./experiments/
35
37
  ```
36
38
 
39
+ 3. Get help:
40
+ ```bash
41
+ mini-code --help
42
+ ```
43
+
37
44
 
38
45
  ## (C) Nikolai Rozanov, 2026 - Present
@@ -1,6 +1,7 @@
1
1
  [project]
2
2
  name = "mini-code-cli"
3
- version = "0.0.7"
3
+ # version = { file = "mini_code_cli/__init__.py", attr = "__version__" }
4
+ version = "0.0.7.1"
4
5
  description = "Minimal Coding CLI"
5
6
  readme = "README.md"
6
7
  requires-python = ">=3.10"
File without changes
File without changes
File without changes