mycode-aiagent 0.3.1__tar.gz → 0.4.0__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 (26) hide show
  1. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/PKG-INFO +36 -5
  2. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/README.md +35 -4
  3. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/cli.py +49 -0
  4. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/mycode_aiagent.egg-info/PKG-INFO +36 -5
  5. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/pyproject.toml +1 -1
  6. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/__init__.py +0 -0
  7. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/__main__.py +0 -0
  8. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/analyzer.py +0 -0
  9. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/backends/__init__.py +0 -0
  10. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/backends/base.py +0 -0
  11. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/backends/claude_backend.py +0 -0
  12. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/backends/mcp_backend.py +0 -0
  13. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/backends/openai_backend.py +0 -0
  14. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/backends/ricky_backend.py +0 -0
  15. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/generator.py +0 -0
  16. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/mcp_client.py +0 -0
  17. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/server.py +0 -0
  18. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/utils/__init__.py +0 -0
  19. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/my_code/utils/prompts.py +0 -0
  20. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/mycode_aiagent.egg-info/SOURCES.txt +0 -0
  21. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/mycode_aiagent.egg-info/dependency_links.txt +0 -0
  22. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/mycode_aiagent.egg-info/entry_points.txt +0 -0
  23. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/mycode_aiagent.egg-info/requires.txt +0 -0
  24. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/mycode_aiagent.egg-info/top_level.txt +0 -0
  25. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/setup.cfg +0 -0
  26. {mycode_aiagent-0.3.1 → mycode_aiagent-0.4.0}/tests/test_library.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mycode-aiagent
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: Style-aware code generation — analyze any codebase and generate new code that matches its style
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/RyanAbbottData/MyCode
@@ -243,9 +243,14 @@ Commands:
243
243
 
244
244
  generate TASK Generate code matching the saved style profile
245
245
 
246
- serve Start an MCP server (blocks until Ctrl-C)
247
- --host TEXT Host to bind (default: 127.0.0.1)
248
- --port INT Port to listen on (default: 8080)
246
+ serve Start an MCP server (blocks until Ctrl-C)
247
+ --host TEXT Host to bind (default: 127.0.0.1)
248
+ --port INT Port to listen on (default: 8080)
249
+ --daemon Run as a detached background process
250
+ --pid-file TEXT PID file path for daemon mode (default: mycode.pid)
251
+
252
+ stop Stop a running daemon server
253
+ --pid-file TEXT PID file written by 'serve --daemon' (default: mycode.pid)
249
254
  ```
250
255
 
251
256
  ---
@@ -313,7 +318,7 @@ MyCode can expose itself as an MCP server so any MCP-compatible agent or orchest
313
318
  ### Quick start
314
319
 
315
320
  ```bash
316
- # Local LLM backend (default)
321
+ # Local LLM backend (default) — foreground, blocks until Ctrl-C
317
322
  my-code serve
318
323
 
319
324
  # Claude backend
@@ -333,6 +338,32 @@ MyCode MCP server running at http://127.0.0.1:8080/mcp
333
338
  Add to your MCP config: {"mycode": {"url": "http://127.0.0.1:8080/mcp"}}
334
339
  ```
335
340
 
341
+ ### Running as a daemon
342
+
343
+ Add `--daemon` to run the server as a detached background process. The terminal returns immediately and the server keeps running.
344
+
345
+ ```bash
346
+ my-code --backend claude serve --daemon
347
+ # → MyCode MCP server started as daemon (PID 12345) at http://127.0.0.1:8080/mcp
348
+ # → Stop with: my-code stop
349
+ ```
350
+
351
+ The PID is written to `mycode.pid` by default. Stop the server with:
352
+
353
+ ```bash
354
+ my-code stop
355
+ ```
356
+
357
+ When running multiple instances on different ports, use `--pid-file` to keep them separate:
358
+
359
+ ```bash
360
+ my-code --backend claude serve --port 8080 --daemon --pid-file mycode-8080.pid
361
+ my-code --backend openai serve --port 8081 --daemon --pid-file mycode-8081.pid
362
+
363
+ my-code stop --pid-file mycode-8080.pid
364
+ my-code stop --pid-file mycode-8081.pid
365
+ ```
366
+
336
367
  ### Connecting from an MCP consumer
337
368
 
338
369
  Add the printed snippet to your consumer's MCP config file (e.g. `.mcp.json`):
@@ -214,9 +214,14 @@ Commands:
214
214
 
215
215
  generate TASK Generate code matching the saved style profile
216
216
 
217
- serve Start an MCP server (blocks until Ctrl-C)
218
- --host TEXT Host to bind (default: 127.0.0.1)
219
- --port INT Port to listen on (default: 8080)
217
+ serve Start an MCP server (blocks until Ctrl-C)
218
+ --host TEXT Host to bind (default: 127.0.0.1)
219
+ --port INT Port to listen on (default: 8080)
220
+ --daemon Run as a detached background process
221
+ --pid-file TEXT PID file path for daemon mode (default: mycode.pid)
222
+
223
+ stop Stop a running daemon server
224
+ --pid-file TEXT PID file written by 'serve --daemon' (default: mycode.pid)
220
225
  ```
221
226
 
222
227
  ---
@@ -284,7 +289,7 @@ MyCode can expose itself as an MCP server so any MCP-compatible agent or orchest
284
289
  ### Quick start
285
290
 
286
291
  ```bash
287
- # Local LLM backend (default)
292
+ # Local LLM backend (default) — foreground, blocks until Ctrl-C
288
293
  my-code serve
289
294
 
290
295
  # Claude backend
@@ -304,6 +309,32 @@ MyCode MCP server running at http://127.0.0.1:8080/mcp
304
309
  Add to your MCP config: {"mycode": {"url": "http://127.0.0.1:8080/mcp"}}
305
310
  ```
306
311
 
312
+ ### Running as a daemon
313
+
314
+ Add `--daemon` to run the server as a detached background process. The terminal returns immediately and the server keeps running.
315
+
316
+ ```bash
317
+ my-code --backend claude serve --daemon
318
+ # → MyCode MCP server started as daemon (PID 12345) at http://127.0.0.1:8080/mcp
319
+ # → Stop with: my-code stop
320
+ ```
321
+
322
+ The PID is written to `mycode.pid` by default. Stop the server with:
323
+
324
+ ```bash
325
+ my-code stop
326
+ ```
327
+
328
+ When running multiple instances on different ports, use `--pid-file` to keep them separate:
329
+
330
+ ```bash
331
+ my-code --backend claude serve --port 8080 --daemon --pid-file mycode-8080.pid
332
+ my-code --backend openai serve --port 8081 --daemon --pid-file mycode-8081.pid
333
+
334
+ my-code stop --pid-file mycode-8080.pid
335
+ my-code stop --pid-file mycode-8081.pid
336
+ ```
337
+
307
338
  ### Connecting from an MCP consumer
308
339
 
309
340
  Add the printed snippet to your consumer's MCP config file (e.g. `.mcp.json`):
@@ -8,6 +8,9 @@ Usage:
8
8
 
9
9
  import argparse
10
10
  import json
11
+ import os
12
+ import signal
13
+ import subprocess
11
14
  import sys
12
15
  from pathlib import Path
13
16
 
@@ -65,7 +68,47 @@ def cmd_generate(args):
65
68
  print(code)
66
69
 
67
70
 
71
+ def _spawn_daemon(args):
72
+ cmd = [
73
+ sys.executable, "-m", "my_code",
74
+ "--backend", args.backend,
75
+ "--ricky-url", args.ricky_url,
76
+ "--mcp-url", args.mcp_url,
77
+ "--timeout", str(args.timeout),
78
+ "--profile", args.profile,
79
+ "serve",
80
+ "--host", args.host,
81
+ "--port", str(args.port),
82
+ ]
83
+ if args.api_key:
84
+ cmd += ["--api-key", args.api_key]
85
+ if args.model:
86
+ cmd += ["--model", args.model]
87
+
88
+ kwargs = {"stdout": subprocess.DEVNULL, "stderr": subprocess.DEVNULL}
89
+ if sys.platform == "win32":
90
+ kwargs["creationflags"] = subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP
91
+ else:
92
+ kwargs["start_new_session"] = True
93
+
94
+ proc = subprocess.Popen(cmd, **kwargs)
95
+ Path(args.pid_file).write_text(str(proc.pid))
96
+ print(f"MyCode MCP server started as daemon (PID {proc.pid}) at http://{args.host}:{args.port}/mcp")
97
+ print(f"Stop with: my-code stop --pid-file {args.pid_file}")
98
+
99
+
100
+ def cmd_stop(args):
101
+ pid_file = Path(args.pid_file)
102
+ pid = int(pid_file.read_text().strip())
103
+ os.kill(pid, signal.SIGTERM)
104
+ pid_file.unlink()
105
+ print(f"MyCode MCP server (PID {pid}) stopped.")
106
+
107
+
68
108
  def cmd_serve(args):
109
+ if args.daemon:
110
+ _spawn_daemon(args)
111
+ return
69
112
  backend = make_backend(
70
113
  backend=args.backend,
71
114
  api_key=args.api_key,
@@ -104,8 +147,14 @@ def main():
104
147
  p_serve = sub.add_parser("serve", help="Start an MCP server exposing analyze and generate as tools")
105
148
  p_serve.add_argument("--host", default="127.0.0.1", help="Host to bind (default: 127.0.0.1)")
106
149
  p_serve.add_argument("--port", type=int, default=8080, help="Port to listen on (default: 8080)")
150
+ p_serve.add_argument("--daemon", action="store_true", help="Run server as a detached background process")
151
+ p_serve.add_argument("--pid-file", default="mycode.pid", help="PID file path when running as daemon (default: mycode.pid)")
107
152
  p_serve.set_defaults(func=cmd_serve)
108
153
 
154
+ p_stop = sub.add_parser("stop", help="Stop a running daemon server")
155
+ p_stop.add_argument("--pid-file", default="mycode.pid", help="PID file written by 'serve --daemon' (default: mycode.pid)")
156
+ p_stop.set_defaults(func=cmd_stop)
157
+
109
158
  args = parser.parse_args()
110
159
  args.func(args)
111
160
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mycode-aiagent
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: Style-aware code generation — analyze any codebase and generate new code that matches its style
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/RyanAbbottData/MyCode
@@ -243,9 +243,14 @@ Commands:
243
243
 
244
244
  generate TASK Generate code matching the saved style profile
245
245
 
246
- serve Start an MCP server (blocks until Ctrl-C)
247
- --host TEXT Host to bind (default: 127.0.0.1)
248
- --port INT Port to listen on (default: 8080)
246
+ serve Start an MCP server (blocks until Ctrl-C)
247
+ --host TEXT Host to bind (default: 127.0.0.1)
248
+ --port INT Port to listen on (default: 8080)
249
+ --daemon Run as a detached background process
250
+ --pid-file TEXT PID file path for daemon mode (default: mycode.pid)
251
+
252
+ stop Stop a running daemon server
253
+ --pid-file TEXT PID file written by 'serve --daemon' (default: mycode.pid)
249
254
  ```
250
255
 
251
256
  ---
@@ -313,7 +318,7 @@ MyCode can expose itself as an MCP server so any MCP-compatible agent or orchest
313
318
  ### Quick start
314
319
 
315
320
  ```bash
316
- # Local LLM backend (default)
321
+ # Local LLM backend (default) — foreground, blocks until Ctrl-C
317
322
  my-code serve
318
323
 
319
324
  # Claude backend
@@ -333,6 +338,32 @@ MyCode MCP server running at http://127.0.0.1:8080/mcp
333
338
  Add to your MCP config: {"mycode": {"url": "http://127.0.0.1:8080/mcp"}}
334
339
  ```
335
340
 
341
+ ### Running as a daemon
342
+
343
+ Add `--daemon` to run the server as a detached background process. The terminal returns immediately and the server keeps running.
344
+
345
+ ```bash
346
+ my-code --backend claude serve --daemon
347
+ # → MyCode MCP server started as daemon (PID 12345) at http://127.0.0.1:8080/mcp
348
+ # → Stop with: my-code stop
349
+ ```
350
+
351
+ The PID is written to `mycode.pid` by default. Stop the server with:
352
+
353
+ ```bash
354
+ my-code stop
355
+ ```
356
+
357
+ When running multiple instances on different ports, use `--pid-file` to keep them separate:
358
+
359
+ ```bash
360
+ my-code --backend claude serve --port 8080 --daemon --pid-file mycode-8080.pid
361
+ my-code --backend openai serve --port 8081 --daemon --pid-file mycode-8081.pid
362
+
363
+ my-code stop --pid-file mycode-8080.pid
364
+ my-code stop --pid-file mycode-8081.pid
365
+ ```
366
+
336
367
  ### Connecting from an MCP consumer
337
368
 
338
369
  Add the printed snippet to your consumer's MCP config file (e.g. `.mcp.json`):
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mycode-aiagent"
7
- version = "0.3.1"
7
+ version = "0.4.0"
8
8
  description = "Style-aware code generation — analyze any codebase and generate new code that matches its style"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes