luckyd-code 1.2.2__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 (167) hide show
  1. luckyd_code-1.2.2/.gitignore +77 -0
  2. luckyd_code-1.2.2/CHANGELOG.md +142 -0
  3. luckyd_code-1.2.2/CONTRIBUTING.md +89 -0
  4. luckyd_code-1.2.2/LICENSE +21 -0
  5. luckyd_code-1.2.2/MANIFEST.in +12 -0
  6. luckyd_code-1.2.2/PKG-INFO +297 -0
  7. luckyd_code-1.2.2/README.md +244 -0
  8. luckyd_code-1.2.2/luckyd_code/__init__.py +54 -0
  9. luckyd_code-1.2.2/luckyd_code/__main__.py +5 -0
  10. luckyd_code-1.2.2/luckyd_code/_agent_loop.py +551 -0
  11. luckyd_code-1.2.2/luckyd_code/_data_dir.py +73 -0
  12. luckyd_code-1.2.2/luckyd_code/agent.py +38 -0
  13. luckyd_code-1.2.2/luckyd_code/analytics/__init__.py +18 -0
  14. luckyd_code-1.2.2/luckyd_code/analytics/reporter.py +195 -0
  15. luckyd_code-1.2.2/luckyd_code/analytics/scanner.py +443 -0
  16. luckyd_code-1.2.2/luckyd_code/analytics/smells.py +316 -0
  17. luckyd_code-1.2.2/luckyd_code/analytics/trends.py +303 -0
  18. luckyd_code-1.2.2/luckyd_code/api.py +473 -0
  19. luckyd_code-1.2.2/luckyd_code/audit_daemon.py +845 -0
  20. luckyd_code-1.2.2/luckyd_code/autonomous_fixer.py +473 -0
  21. luckyd_code-1.2.2/luckyd_code/background.py +159 -0
  22. luckyd_code-1.2.2/luckyd_code/backup.py +237 -0
  23. luckyd_code-1.2.2/luckyd_code/brain/__init__.py +84 -0
  24. luckyd_code-1.2.2/luckyd_code/brain/assembler.py +100 -0
  25. luckyd_code-1.2.2/luckyd_code/brain/chunker.py +345 -0
  26. luckyd_code-1.2.2/luckyd_code/brain/constants.py +73 -0
  27. luckyd_code-1.2.2/luckyd_code/brain/embedder.py +163 -0
  28. luckyd_code-1.2.2/luckyd_code/brain/graph.py +311 -0
  29. luckyd_code-1.2.2/luckyd_code/brain/indexer.py +316 -0
  30. luckyd_code-1.2.2/luckyd_code/brain/parser.py +140 -0
  31. luckyd_code-1.2.2/luckyd_code/brain/retriever.py +234 -0
  32. luckyd_code-1.2.2/luckyd_code/cli.py +894 -0
  33. luckyd_code-1.2.2/luckyd_code/cli_commands/__init__.py +1 -0
  34. luckyd_code-1.2.2/luckyd_code/cli_commands/audit.py +120 -0
  35. luckyd_code-1.2.2/luckyd_code/cli_commands/background.py +83 -0
  36. luckyd_code-1.2.2/luckyd_code/cli_commands/brain.py +87 -0
  37. luckyd_code-1.2.2/luckyd_code/cli_commands/config.py +75 -0
  38. luckyd_code-1.2.2/luckyd_code/cli_commands/dispatcher.py +695 -0
  39. luckyd_code-1.2.2/luckyd_code/cli_commands/sessions.py +41 -0
  40. luckyd_code-1.2.2/luckyd_code/cli_entry.py +147 -0
  41. luckyd_code-1.2.2/luckyd_code/cli_utils.py +112 -0
  42. luckyd_code-1.2.2/luckyd_code/config.py +205 -0
  43. luckyd_code-1.2.2/luckyd_code/context.py +214 -0
  44. luckyd_code-1.2.2/luckyd_code/cost_tracker.py +209 -0
  45. luckyd_code-1.2.2/luckyd_code/error_reporter.py +508 -0
  46. luckyd_code-1.2.2/luckyd_code/exceptions.py +39 -0
  47. luckyd_code-1.2.2/luckyd_code/export.py +126 -0
  48. luckyd_code-1.2.2/luckyd_code/feedback_analyzer.py +290 -0
  49. luckyd_code-1.2.2/luckyd_code/file_watcher.py +258 -0
  50. luckyd_code-1.2.2/luckyd_code/git/__init__.py +11 -0
  51. luckyd_code-1.2.2/luckyd_code/git/auto_commit.py +157 -0
  52. luckyd_code-1.2.2/luckyd_code/git/tools.py +85 -0
  53. luckyd_code-1.2.2/luckyd_code/hooks.py +236 -0
  54. luckyd_code-1.2.2/luckyd_code/indexer.py +280 -0
  55. luckyd_code-1.2.2/luckyd_code/init.py +39 -0
  56. luckyd_code-1.2.2/luckyd_code/keybindings.py +77 -0
  57. luckyd_code-1.2.2/luckyd_code/log.py +55 -0
  58. luckyd_code-1.2.2/luckyd_code/mcp/__init__.py +6 -0
  59. luckyd_code-1.2.2/luckyd_code/mcp/client.py +184 -0
  60. luckyd_code-1.2.2/luckyd_code/memory/__init__.py +19 -0
  61. luckyd_code-1.2.2/luckyd_code/memory/manager.py +339 -0
  62. luckyd_code-1.2.2/luckyd_code/metrics/__init__.py +5 -0
  63. luckyd_code-1.2.2/luckyd_code/model_registry.py +131 -0
  64. luckyd_code-1.2.2/luckyd_code/orchestrator.py +204 -0
  65. luckyd_code-1.2.2/luckyd_code/permissions/__init__.py +1 -0
  66. luckyd_code-1.2.2/luckyd_code/permissions/manager.py +103 -0
  67. luckyd_code-1.2.2/luckyd_code/planner.py +361 -0
  68. luckyd_code-1.2.2/luckyd_code/plugins.py +91 -0
  69. luckyd_code-1.2.2/luckyd_code/py.typed +0 -0
  70. luckyd_code-1.2.2/luckyd_code/retry.py +57 -0
  71. luckyd_code-1.2.2/luckyd_code/router.py +417 -0
  72. luckyd_code-1.2.2/luckyd_code/sandbox.py +156 -0
  73. luckyd_code-1.2.2/luckyd_code/self_critique.py +2 -0
  74. luckyd_code-1.2.2/luckyd_code/self_improve.py +274 -0
  75. luckyd_code-1.2.2/luckyd_code/sessions.py +114 -0
  76. luckyd_code-1.2.2/luckyd_code/settings.py +72 -0
  77. luckyd_code-1.2.2/luckyd_code/skills/__init__.py +8 -0
  78. luckyd_code-1.2.2/luckyd_code/skills/review.py +22 -0
  79. luckyd_code-1.2.2/luckyd_code/skills/security.py +17 -0
  80. luckyd_code-1.2.2/luckyd_code/tasks/__init__.py +1 -0
  81. luckyd_code-1.2.2/luckyd_code/tasks/manager.py +102 -0
  82. luckyd_code-1.2.2/luckyd_code/templates/icon-192.png +0 -0
  83. luckyd_code-1.2.2/luckyd_code/templates/icon-512.png +0 -0
  84. luckyd_code-1.2.2/luckyd_code/templates/index.html +1965 -0
  85. luckyd_code-1.2.2/luckyd_code/templates/manifest.json +14 -0
  86. luckyd_code-1.2.2/luckyd_code/templates/src/app.js +694 -0
  87. luckyd_code-1.2.2/luckyd_code/templates/src/body.html +767 -0
  88. luckyd_code-1.2.2/luckyd_code/templates/src/cdn.txt +2 -0
  89. luckyd_code-1.2.2/luckyd_code/templates/src/style.css +474 -0
  90. luckyd_code-1.2.2/luckyd_code/templates/sw.js +31 -0
  91. luckyd_code-1.2.2/luckyd_code/templates/test.html +6 -0
  92. luckyd_code-1.2.2/luckyd_code/themes.py +48 -0
  93. luckyd_code-1.2.2/luckyd_code/tools/__init__.py +97 -0
  94. luckyd_code-1.2.2/luckyd_code/tools/agent_tools.py +65 -0
  95. luckyd_code-1.2.2/luckyd_code/tools/bash.py +360 -0
  96. luckyd_code-1.2.2/luckyd_code/tools/brain_tools.py +137 -0
  97. luckyd_code-1.2.2/luckyd_code/tools/browser.py +369 -0
  98. luckyd_code-1.2.2/luckyd_code/tools/datetime_tool.py +34 -0
  99. luckyd_code-1.2.2/luckyd_code/tools/dockerfile_gen.py +212 -0
  100. luckyd_code-1.2.2/luckyd_code/tools/file_ops.py +381 -0
  101. luckyd_code-1.2.2/luckyd_code/tools/game_gen.py +360 -0
  102. luckyd_code-1.2.2/luckyd_code/tools/git_tools.py +130 -0
  103. luckyd_code-1.2.2/luckyd_code/tools/git_worktree.py +63 -0
  104. luckyd_code-1.2.2/luckyd_code/tools/path_validate.py +64 -0
  105. luckyd_code-1.2.2/luckyd_code/tools/project_gen.py +187 -0
  106. luckyd_code-1.2.2/luckyd_code/tools/readme_gen.py +227 -0
  107. luckyd_code-1.2.2/luckyd_code/tools/registry.py +157 -0
  108. luckyd_code-1.2.2/luckyd_code/tools/shell_detect.py +109 -0
  109. luckyd_code-1.2.2/luckyd_code/tools/web.py +89 -0
  110. luckyd_code-1.2.2/luckyd_code/tools/youtube.py +187 -0
  111. luckyd_code-1.2.2/luckyd_code/tools_bridge.py +144 -0
  112. luckyd_code-1.2.2/luckyd_code/undo.py +126 -0
  113. luckyd_code-1.2.2/luckyd_code/update.py +60 -0
  114. luckyd_code-1.2.2/luckyd_code/verify.py +360 -0
  115. luckyd_code-1.2.2/luckyd_code/web_app.py +176 -0
  116. luckyd_code-1.2.2/luckyd_code/web_routes/__init__.py +23 -0
  117. luckyd_code-1.2.2/luckyd_code/web_routes/background.py +73 -0
  118. luckyd_code-1.2.2/luckyd_code/web_routes/brain.py +109 -0
  119. luckyd_code-1.2.2/luckyd_code/web_routes/cost.py +12 -0
  120. luckyd_code-1.2.2/luckyd_code/web_routes/files.py +133 -0
  121. luckyd_code-1.2.2/luckyd_code/web_routes/memories.py +94 -0
  122. luckyd_code-1.2.2/luckyd_code/web_routes/misc.py +67 -0
  123. luckyd_code-1.2.2/luckyd_code/web_routes/project.py +48 -0
  124. luckyd_code-1.2.2/luckyd_code/web_routes/review.py +20 -0
  125. luckyd_code-1.2.2/luckyd_code/web_routes/sessions.py +44 -0
  126. luckyd_code-1.2.2/luckyd_code/web_routes/settings.py +43 -0
  127. luckyd_code-1.2.2/luckyd_code/web_routes/static.py +70 -0
  128. luckyd_code-1.2.2/luckyd_code/web_routes/update.py +19 -0
  129. luckyd_code-1.2.2/luckyd_code/web_routes/ws.py +237 -0
  130. luckyd_code-1.2.2/pyproject.toml +127 -0
  131. luckyd_code-1.2.2/scripts/build_html.py +161 -0
  132. luckyd_code-1.2.2/scripts/install_scheduled_task.ps1 +88 -0
  133. luckyd_code-1.2.2/scripts/playlist_gen.py +336 -0
  134. luckyd_code-1.2.2/scripts/run_audit_once.py +55 -0
  135. luckyd_code-1.2.2/tests/__init__.py +1 -0
  136. luckyd_code-1.2.2/tests/conftest.py +151 -0
  137. luckyd_code-1.2.2/tests/test_analytics.py +443 -0
  138. luckyd_code-1.2.2/tests/test_api.py +271 -0
  139. luckyd_code-1.2.2/tests/test_audit_daemon.py +155 -0
  140. luckyd_code-1.2.2/tests/test_auto_commit.py +129 -0
  141. luckyd_code-1.2.2/tests/test_autonomous_fixer.py +371 -0
  142. luckyd_code-1.2.2/tests/test_background.py +251 -0
  143. luckyd_code-1.2.2/tests/test_brain.py +948 -0
  144. luckyd_code-1.2.2/tests/test_config.py +150 -0
  145. luckyd_code-1.2.2/tests/test_context.py +456 -0
  146. luckyd_code-1.2.2/tests/test_cost_tracker.py +165 -0
  147. luckyd_code-1.2.2/tests/test_data_dir.py +126 -0
  148. luckyd_code-1.2.2/tests/test_error_reporter.py +380 -0
  149. luckyd_code-1.2.2/tests/test_feedback_analyzer.py +324 -0
  150. luckyd_code-1.2.2/tests/test_hooks.py +268 -0
  151. luckyd_code-1.2.2/tests/test_integration.py +481 -0
  152. luckyd_code-1.2.2/tests/test_model_registry.py +126 -0
  153. luckyd_code-1.2.2/tests/test_orchestrator.py +397 -0
  154. luckyd_code-1.2.2/tests/test_path_validate.py +105 -0
  155. luckyd_code-1.2.2/tests/test_planner.py +260 -0
  156. luckyd_code-1.2.2/tests/test_plugins.py +174 -0
  157. luckyd_code-1.2.2/tests/test_retry.py +190 -0
  158. luckyd_code-1.2.2/tests/test_router.py +173 -0
  159. luckyd_code-1.2.2/tests/test_sandbox.py +273 -0
  160. luckyd_code-1.2.2/tests/test_self_critique.py +1 -0
  161. luckyd_code-1.2.2/tests/test_sessions.py +96 -0
  162. luckyd_code-1.2.2/tests/test_themes.py +73 -0
  163. luckyd_code-1.2.2/tests/test_tool_registry.py +106 -0
  164. luckyd_code-1.2.2/tests/test_undo.py +78 -0
  165. luckyd_code-1.2.2/tests/test_verify.py +297 -0
  166. luckyd_code-1.2.2/tests/test_web_app.py +376 -0
  167. luckyd_code-1.2.2/tests/test_youtube.py +515 -0
@@ -0,0 +1,77 @@
1
+ # Debug output files
2
+ test_results.txt
3
+ test_v.txt
4
+
5
+ # Python
6
+ __pycache__/
7
+ *.py[cod]
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+ *.egg
12
+ .pytest_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Environment / secrets
17
+ .env
18
+ *.env
19
+ venv/
20
+ .venv/
21
+
22
+ # Personal / runtime history (may contain sensitive data)
23
+ .deepseek_history
24
+ *.deepseek_history
25
+ .luckyd_history
26
+ *.luckyd_history
27
+
28
+ # Coverage reports
29
+ .coverage
30
+ coverage.xml
31
+ htmlcov/
32
+
33
+ # IDE
34
+ .vscode/
35
+ .idea/
36
+ *.swp
37
+ *.swo
38
+
39
+ # OS
40
+ Thumbs.db
41
+ .DS_Store
42
+
43
+ # Project runtime files
44
+ *.deepseek_history
45
+ .claude/
46
+ CLAUDE.md
47
+ .audit_lock
48
+ .audit_daemon_paused
49
+ .deepseek-code/
50
+ .luckyd-code/
51
+ _build/
52
+
53
+ # Temp / debug / output files
54
+ out.txt
55
+ fail_output.txt
56
+ full_test_output.txt
57
+ test_output.txt
58
+ hs_test.txt
59
+ test_debug.txt
60
+ test_out.txt
61
+ *.log
62
+ debug_*
63
+ _debug_*.py
64
+ _cleanup_*.py
65
+
66
+ # Stale root scripts
67
+ fetch_models.py
68
+ test_models.py
69
+ run.bat
70
+ DeepSeek Code Web.bat
71
+ PUSH_TO_GITHUB.md
72
+
73
+ # Scripts temp
74
+ scripts/_*
75
+ test_results.txt
76
+ test_v.txt
77
+ deepseek_code/metrics/time_series.jsonl
@@ -0,0 +1,142 @@
1
+ # Changelog
2
+
3
+ ## [1.2.2] — 2026-05-06
4
+
5
+ ### Changed
6
+ - **.gitignore** — added `.luckyd_history` and `.luckyd-code/` for project rename parity
7
+ - **Docstring fix** (`_agent_loop.py`) — removed stale `/critique` reference in `run_config`
8
+
9
+ ## [1.2.1] — 2026-05-02
10
+
11
+ **Change:** Fix high_complexity: Cyclomatic complexity is 78 in `C:\Users\dylan\OneDrive\Desktop\deepseek-code\luckyd_code\_agent_loop.py`
12
+
13
+ **Files:** `luckyd_code/_agent_loop.py`
14
+
15
+
16
+ All notable changes to DeepSeek Code will be documented in this file.
17
+
18
+ The format is based on [Keep a Changelog](https://keepachangelog.com/),
19
+ and this project adheres to [Semantic Versioning](https://semver.org/).
20
+
21
+ ## [1.0.1] — 2026-05-05
22
+
23
+ ### Changed
24
+ - **Agent loop** (`_agent_loop.py`) — complete harness overhaul targeting top-1% quality:
25
+ - **Self-critique gate** — `self_critique.py` is now wired and fires before every final response. If the critique scores FAIL or WARN with multiple issues, a corrective turn runs automatically.
26
+ - **Stuck-loop detection** — tracks hashes of recent tool-call batches; if the same batch repeats `_STUCK_WINDOW` times the loop breaks and asks the model to explain what's blocking it instead of burning all turns.
27
+ - **Turn budget injection** — when ≤ 2 turns remain, a system message is injected so the model can wrap up gracefully instead of being cut off mid-task.
28
+ - **Mid-loop model escalation** — on repeated verify failures the loop automatically promotes to the next tier in `_ESCALATION_LADDER` (`deepseek-v4-flash` → `deepseek-v4-pro`) for recovery turns.
29
+ - **Tool result truncation** — all tool results are capped at 8,000 characters before context injection, protecting the token budget on large file reads.
30
+ - **Re-read-after-write** — after every `Write` or `Edit` tool call, the file's existence and size are checked; if the write silently failed a warning is injected immediately.
31
+ - **Context-overflow protection** — `estimate_tokens()` is checked before every turn; if usage exceeds 85% of the compact threshold, `compact()` runs automatically.
32
+ - `LoopResult` gains `escalated_model` field to report any mid-loop model promotion.
33
+ - `RunConfig` gains `enable_self_critique` flag (default `True`) to opt out per-call.
34
+
35
+ ## [1.2.1] — 2026-05-02
36
+
37
+ ### Security
38
+ - **Removed `.env` from git tracking** — the `.env` file containing the
39
+ `DEEPSEEK_API_KEY` was previously committed to the repository. It is now
40
+ untracked (`git rm --cached .env`). The `.gitignore` rule for `.env` already
41
+ existed but had no effect while the file was being tracked. **If you cloned
42
+ this repo before this release, rotate your API key at
43
+ [platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys).**
44
+
45
+ ### Fixed
46
+ - **`SECURITY.md`** — updated supported versions table to reflect v1.2.x as the
47
+ current supported release.
48
+
49
+ ## [1.2.0] — 2026-05-02
50
+
51
+ ### Changed
52
+ - **Shared agent loop** (`_agent_loop.py`) — extracted a single `run_agent_loop()`
53
+ function used by both `SubAgent` and `AgentHandoff`. Bug fixes now propagate
54
+ to all agentic paths automatically; `agent.py` and `orchestrator.py` are ~60%
55
+ shorter as a result.
56
+ - **Retry in `stream_chat`** (`api.py`) — `_call_with_retry()` now wraps
57
+ `_stream_chat_raw` with up to 3 attempts using exponential backoff and jitter
58
+ (1 s base, 30 s cap). Rate-limit (429) and server errors (5xx) are retried;
59
+ auth and bad-request errors are not.
60
+ - **Cost tracking** (`cost_tracker.py`) — switched from full-rewrite JSON to
61
+ append-only JSONL (`costs.jsonl`). Each API call is now O(1) instead of
62
+ O(session length). Existing `costs.json` files are migrated automatically on
63
+ first write.
64
+ - **Memory search** (`memory/manager.py`) — `search_memories()` now uses
65
+ semantic cosine-similarity via `sentence-transformers` (all-MiniLM-L6-v2)
66
+ when the `rag` extra is installed, with keyword-frequency as an automatic
67
+ fallback. Thread-safe singleton (`_DEFAULT_MANAGER`) fixed with
68
+ double-checked locking.
69
+ - **Orchestrator** (`orchestrator.py`) — reviewer handoff now uses
70
+ `_truncate_to_tokens()` instead of a hardcoded `[:3000]` char slice.
71
+ `parallel_orchestrate` thread pool capped at `min(len(sub_tasks), 4)` to
72
+ prevent unbounded concurrent API calls.
73
+ - **`__all__` exports** — added to `memory/__init__.py`, `tools/__init__.py`,
74
+ `_agent_loop.py`, `agent.py`, and `orchestrator.py`.
75
+
76
+ ## [1.1.0] — 2026-05-01
77
+
78
+ ### Fixed
79
+ - **Critical bug**: `orchestrator.py` — `stream_chat` was called but never imported,
80
+ causing a `NameError` crash on any `/orchestrate` command. Fixed by adding
81
+ `from .api import stream_chat` to the import block.
82
+ - Removed unused `import time` from `orchestrator.py`.
83
+
84
+ ### Changed
85
+ - **Model registry** (`model_registry.py`) — eliminated duplicate `ModelDef` entries.
86
+ `deepseek-v4-flash` and `deepseek-v4-pro` now each appear exactly once.
87
+ A `TIER_MODEL_MAP` dict handles the tier→model mapping; `get_unique_model_count()`
88
+ now correctly returns 2 instead of 4. `format_model_list()` updated to show
89
+ tier assignments alongside each model.
90
+ - **Router** (`router.py`) — `classify_tier_llm()` no longer blocks the main thread.
91
+ The LLM API call now runs in a background `ThreadPoolExecutor`; the heuristic
92
+ result is returned immediately if the call doesn't finish within 4 seconds.
93
+ The LLM result is still cached once it arrives, so future identical prompts
94
+ are instant. Router now imports `TIER_MODEL_MAP` directly from `model_registry`
95
+ instead of maintaining a separate copy.
96
+ - **Planner** (`planner.py`) — completely rebuilt from a plain file-manager into
97
+ a real AI-powered task decomposer. `ai_create_plan(name, goal, config)` calls
98
+ `deepseek-v4-flash` to break a goal into structured `PlanStep` objects with
99
+ agent assignments, dependency tracking, and time estimates. Plans are persisted
100
+ as both human-readable Markdown and machine-readable JSON. Added `load_plan`,
101
+ `save_plan`, `update_step_status`, and `delete_plan` helpers.
102
+
103
+ ### Added
104
+ - **Tool result caching** (`tools/registry.py`) — `ToolRegistry` now caches results
105
+ from read-only tools (`Read`, `Glob`, `Grep`, `WebFetch`, `WebSearch`, `DateTime`)
106
+ for 5 minutes (configurable via `cache_ttl`). Identical calls within the TTL
107
+ window skip the underlying I/O entirely. Cache keys are derived from tool name +
108
+ sorted arguments. Write/Bash/Git tools are explicitly excluded. Added
109
+ `ToolRegistry.invalidate()` to clear entries by tool name or globally.
110
+ - **Diff preview for Write and Edit tools** (`tools/file_ops.py`) — both `WriteTool`
111
+ and `EditTool` now accept a `dry_run=true` parameter. When set, the tool returns
112
+ a unified diff of the proposed change without modifying the file. `WriteTool`
113
+ also reports how many lines changed after every successful write.
114
+
115
+ ## [1.0.0] — 2025-04-28
116
+
117
+ ### Added
118
+ - **AI Chat** — Conversational coding assistant with streaming responses and thinking/reasoning mode
119
+ - **Smart Model Routing** — Auto-classifies prompt complexity into 4 tiers
120
+ - **Knowledge Graph** — Automatic codebase indexing with vector search and dependency tracking
121
+ - **Memory System** — Persistent `CLAUDE.md` memory across sessions with relevance search
122
+ - **Cost Tracking** — Per-session and cumulative cost tracking across models
123
+ - **Web UI** — Browser-based interface with cost panel, memory management, and model routing
124
+ - **35+ Built-in Tools** — Read, Write, Edit, Glob, Grep, Bash, WebFetch, WebSearch, Git, Browser automation
125
+ - **MCP Support** — Model Context Protocol for extending with custom tools
126
+ - **DeepSeek API** — Native integration with `deepseek-v4-flash` and `deepseek-v4-pro`
127
+ - **Context Management** — Auto-compaction with summarization to stay within context windows
128
+ - **Background Agents** — Run tasks asynchronously while continuing to chat
129
+ - **Orchestrator** — Researcher → Coder → Reviewer pipeline for complex tasks
130
+ - **Hooks System** — Pre/post tool use, pre/post chat, lifecycle hooks
131
+ - **Sandboxing** — Docker-based secure command execution
132
+ - **Session Management** — Save, load, and auto-recover conversations
133
+ - **Undo** — Revert file writes and edits
134
+ - **Export** — Conversations to Markdown or HTML
135
+ - **Shell Detection** — Auto-detects Git Bash → WSL → cmd.exe on Windows
136
+ - **Playwright Browser** — Full browser automation for testing and web interaction
137
+ - **Self-Improvement** — Automated audit and improvement system
138
+ - **File Watching** — Watch files and auto-reindex knowledge graph
139
+ - **Rate Limiting** — Per-IP rate limiting for Web UI
140
+ - **Auth Support** — Bearer token authentication for Web UI
141
+ - **First-run Wizard** — Interactive API key setup on first launch
142
+ - **CLI Commands** — `/help`, `/clear`, `/compact`, `/undo`, `/model`, `/cost`, `/memory`, `/brain`, `/export`, `/sessions`, `/review`, `/orchestrate`
@@ -0,0 +1,89 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in DeepSeek Code!
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ # Clone the repo
9
+ git clone https://github.com/Dylanchess0320/DeepSeek-Code
10
+ cd deepseek-code
11
+
12
+ # Create virtual environment
13
+ python -m venv .venv
14
+
15
+ # Activate it
16
+ # Windows: .venv\Scripts\activate
17
+ # Linux/Mac: source .venv/bin/activate
18
+
19
+ # Install in editable mode with dev dependencies
20
+ pip install -e ".[dev]"
21
+
22
+ # Install optional RAG dependencies
23
+ pip install -e ".[rag-full]"
24
+ ```
25
+
26
+ ## Running Tests
27
+
28
+ ```bash
29
+ # Run all tests
30
+ pytest
31
+
32
+ # With coverage
33
+ pytest --cov=luckyd_code
34
+
35
+ # Specific test file
36
+ pytest tests/test_router.py -v
37
+ ```
38
+
39
+ ## Type Checking
40
+
41
+ ```bash
42
+ mypy luckyd_code
43
+ ```
44
+
45
+ ## Code Style
46
+
47
+ - Target Python 3.10+
48
+ - Follow PEP 8
49
+ - Use type hints for all function signatures
50
+ - Write docstrings for public APIs
51
+ - Keep functions focused and small
52
+
53
+ ## Pull Request Process
54
+
55
+ 1. Create a feature branch from `main`
56
+ 2. Write tests for new functionality
57
+ 3. Ensure all existing tests pass
58
+ 4. Update documentation (README, CHANGELOG) as needed
59
+ 5. Submit the PR with a clear description
60
+
61
+ ## Project Structure
62
+
63
+ ```
64
+ luckyd_code/
65
+ ├── cli.py # Terminal UI and REPL
66
+ ├── cli_commands/ # Slash-command handlers
67
+ ├── web_app.py # Web UI server (FastAPI)
68
+ ├── web_routes/ # Web UI route handlers
69
+ ├── api.py # API streaming client
70
+ ├── router.py # Model routing
71
+ ├── config.py # Configuration
72
+ ├── context.py # Conversation context
73
+ ├── cost_tracker.py # Cost tracking
74
+ ├── hooks.py # Lifecycle hooks
75
+ ├── model_registry.py # Model definitions
76
+ ├── memory/ # Persistent memory
77
+ ├── brain/ # Knowledge graph & RAG
78
+ ├── tools/ # Tool registry (35+ tools)
79
+ ├── mcp/ # MCP client
80
+ ├── permissions/ # Permission system
81
+ ├── skills/ # Review & security
82
+ ├── analytics/ # Usage analytics
83
+ ├── templates/ # Web UI assets
84
+ └── background/ # Background agents
85
+ ```
86
+
87
+ ## License
88
+
89
+ By contributing, you agree that your contributions will be licensed under the MIT License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dylan Kaye (Dylanchess0320)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,12 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include CONTRIBUTING.md
5
+ include pyproject.toml
6
+ recursive-include deepseek_code/templates *
7
+ recursive-include deepseek_code/templates/src *
8
+ graft deepseek_code/templates
9
+ global-exclude __pycache__
10
+ global-exclude *.pyc
11
+ global-exclude *.pyo
12
+ global-exclude .DS_Store
@@ -0,0 +1,297 @@
1
+ Metadata-Version: 2.4
2
+ Name: luckyd-code
3
+ Version: 1.2.2
4
+ Summary: LuckyD Code — AI coding assistant powered by DeepSeek
5
+ Project-URL: Homepage, https://github.com/Dylanchess0320/LuckyD-Code
6
+ Project-URL: BugTracker, https://github.com/Dylanchess0320/LuckyD-Code/issues
7
+ Author-email: Dylan Kaye <dylanchess0320@users.noreply.github.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,assistant,cli,coding,luckyd
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Software Development :: Code Generators
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: aiofiles>=23.0
23
+ Requires-Dist: beautifulsoup4>=4.12.0
24
+ Requires-Dist: fastapi>=0.100.0
25
+ Requires-Dist: httpx>=0.25.0
26
+ Requires-Dist: nest-asyncio>=1.5.0
27
+ Requires-Dist: openai>=1.0.0
28
+ Requires-Dist: prompt-toolkit>=3.0.0
29
+ Requires-Dist: pyyaml>=6.0
30
+ Requires-Dist: rich>=13.0.0
31
+ Requires-Dist: tiktoken>=0.5.0
32
+ Requires-Dist: uvicorn>=0.23.0
33
+ Requires-Dist: websockets>=11.0
34
+ Provides-Extra: browser
35
+ Requires-Dist: playwright>=1.40.0; extra == 'browser'
36
+ Provides-Extra: dev
37
+ Requires-Dist: mypy>=1.0; extra == 'dev'
38
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
39
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
40
+ Requires-Dist: pytest>=7.0; extra == 'dev'
41
+ Requires-Dist: types-aiofiles; extra == 'dev'
42
+ Requires-Dist: types-beautifulsoup4; extra == 'dev'
43
+ Requires-Dist: types-pyyaml; extra == 'dev'
44
+ Provides-Extra: rag
45
+ Requires-Dist: numpy>=1.24.0; extra == 'rag'
46
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'rag'
47
+ Provides-Extra: rag-full
48
+ Requires-Dist: faiss-cpu>=1.7.0; extra == 'rag-full'
49
+ Requires-Dist: numpy>=1.24.0; extra == 'rag-full'
50
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'rag-full'
51
+ Requires-Dist: watchdog>=3.0.0; extra == 'rag-full'
52
+ Description-Content-Type: text/markdown
53
+
54
+ # LuckyD Code
55
+
56
+ [![CI](https://github.com/Dylanchess0320/LuckyD-Code/actions/workflows/ci.yml/badge.svg)](https://github.com/Dylanchess0320/LuckyD-Code/actions/workflows/ci.yml)
57
+ [![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
58
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
59
+ [![PyPI](https://img.shields.io/pypi/v/luckyd-code)](https://pypi.org/project/luckyd-code/)
60
+
61
+ A full-featured AI coding assistant for your terminal and browser, powered by the DeepSeek API. Features 35+ built-in tools, a semantic knowledge graph, Playwright browser automation, multi-agent orchestration, Docker sandboxing, and a live Web UI.
62
+
63
+ ---
64
+
65
+ ## Features
66
+
67
+ - **AI Chat** — Conversational coding assistant with streaming responses and thinking/reasoning mode
68
+ - **Smart Model Routing** — Auto-classifies prompt complexity into 4 tiers, escalating from cheap/fast to powerful/reasoning models
69
+ - **Knowledge Graph** — Automatically indexes your codebase into a searchable vector graph; falls back to a keyword graph if vector dependencies aren't installed
70
+ - **Memory System** — Persistent memory across sessions with auto-save and relevance search
71
+ - **Cost Tracking** — Per-session and cumulative cost tracking across models
72
+ - **Web UI** — Browser-based interface with cost panel, memory management, and model routing info
73
+ - **35+ Built-in Tools** — File operations, search, code analysis, shell commands, and more
74
+ - **MCP Support** — Model Context Protocol for extending with custom tools
75
+ - **Plugin System** — Drop Python files into `~/.claude/plugins/` to register additional tools at runtime
76
+ - **Context Management** — Auto-compaction with summarization to stay within context windows
77
+ - **Background Agents** — Run tasks asynchronously while continuing to chat
78
+ - **Orchestrator** — Researcher → Coder → Reviewer pipeline for complex tasks
79
+ - **Hooks System** — Pre/post tool use, pre/post chat, and session lifecycle hooks
80
+ - **Sandboxing** — Docker-based secure command execution
81
+ - **Session Management** — Save and load conversations
82
+ - **Undo** — Revert file writes and edits
83
+ - **Export** — Export conversations to Markdown or HTML
84
+ - **Shell Detection** — Auto-detects Git Bash → WSL → cmd.exe on Windows; rewrites interactive commands so the correct shell is always used
85
+ - **Analytics** — Code health scoring, code smell detection, and trend tracking
86
+
87
+ ---
88
+
89
+ ## Prerequisites
90
+
91
+ - **Python 3.10+**
92
+ - **DeepSeek API key** — Get one free at [platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys)
93
+
94
+ ---
95
+
96
+ ## Quick Start — No setup required
97
+
98
+ **Windows** — double-click one of these:
99
+ - `Install and Run - Windows.bat` — CLI mode
100
+ - `Install and Run Web UI - Windows.bat` — browser UI
101
+
102
+ **Mac** — double-click `Install and Run - Mac.command`
103
+ *(first time: right-click → Open to bypass Gatekeeper)*
104
+
105
+ **Linux** — run in terminal:
106
+ ```bash
107
+ chmod +x "Install and Run - Linux.sh"
108
+ "./Install and Run - Linux.sh"
109
+ ```
110
+
111
+ The launcher automatically creates a virtual environment, installs dependencies, and prompts for your API key on first run.
112
+
113
+ ---
114
+
115
+ ## Installation
116
+
117
+ ### From PyPI
118
+
119
+ ```bash
120
+ pip install luckyd-code
121
+ ```
122
+
123
+ ### From source
124
+
125
+ ```bash
126
+ git clone https://github.com/Dylanchess0320/LuckyD-Code
127
+ cd luckyd-code
128
+ python -m venv .venv
129
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
130
+ pip install -e .
131
+ ```
132
+
133
+ ### Optional dependencies
134
+
135
+ ```bash
136
+ # RAG support (semantic memory search)
137
+ pip install -e ".[rag]"
138
+
139
+ # Full RAG with FAISS vector search and file watching
140
+ pip install -e ".[rag-full]"
141
+
142
+ # Browser automation (Playwright)
143
+ pip install -e ".[browser]"
144
+
145
+ # Development dependencies
146
+ pip install -e ".[dev]"
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Usage
152
+
153
+ ### CLI mode
154
+
155
+ ```bash
156
+ luckyd-code
157
+ # or
158
+ ldc
159
+ # or
160
+ python main.py
161
+ ```
162
+
163
+ ### Web UI mode
164
+
165
+ ```bash
166
+ luckyd-code --web
167
+ # or
168
+ python main.py --web
169
+ ```
170
+
171
+ Then open `http://localhost:8000` in your browser.
172
+
173
+ ### Commands
174
+
175
+ Once in the CLI, use slash commands:
176
+
177
+ | Command | Description |
178
+ |---------|-------------|
179
+ | `/help` | Show available commands |
180
+ | `/model` | Switch model or view current model |
181
+ | `/cost` | Show session cost |
182
+ | `/memory` | View or search memory |
183
+ | `/session` | Save, load, or list sessions |
184
+ | `/export` | Export conversation |
185
+ | `/undo` | Undo last file write/edit |
186
+ | `/orchestrate` | Run multi-agent pipeline |
187
+ | `/analytics` | Run code health analysis |
188
+ | `/clear` | Clear conversation |
189
+ | `/quit` | Exit |
190
+
191
+ ### Environment variables
192
+
193
+ Copy `.env.example` to `.env` and set your API key:
194
+
195
+ ```bash
196
+ cp .env.example .env
197
+ ```
198
+
199
+ Then edit `.env`:
200
+
201
+ ```
202
+ DEEPSEEK_API_KEY=sk-your-deepseek-key-here
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Built-in Tools
208
+
209
+ LuckyD Code includes 35+ tools for interacting with your codebase:
210
+
211
+ - **File operations**: Read, Write, Edit, Glob, Grep, Delete, Move, Copy
212
+ - **Code analysis**: Lint, TypeCheck, Complexity, Coverage
213
+ - **Search**: Semantic search, keyword search, file search
214
+ - **Shell**: Bash execution, PowerShell, Git operations
215
+ - **Web**: Playwright browser automation, HTTP requests
216
+ - **Knowledge**: Knowledge graph query, memory search
217
+ - **Project**: Project scan, dependency analysis, code smell detection
218
+ - **Utility**: Undo, Export, Session management
219
+
220
+ ---
221
+
222
+ ## Project Structure
223
+
224
+ ```
225
+ luckyd_code/
226
+ ├── cli.py # Terminal UI and REPL
227
+ ├── cli_commands/ # Slash-command handlers
228
+ ├── web_app.py # Web UI server (FastAPI)
229
+ ├── web_routes/ # Web UI route handlers
230
+ ├── api.py # API streaming client
231
+ ├── router.py # Model routing
232
+ ├── config.py # Configuration
233
+ ├── context.py # Conversation context
234
+ ├── cost_tracker.py # Cost tracking
235
+ ├── hooks.py # Lifecycle hooks
236
+ ├── model_registry.py # Model definitions
237
+ ├── memory/ # Persistent memory
238
+ ├── brain/ # Knowledge graph & RAG
239
+ ├── tools/ # Tool registry (35+ tools)
240
+ ├── mcp/ # MCP client
241
+ ├── permissions/ # Permission system
242
+ ├── skills/ # Review & security
243
+ ├── analytics/ # Usage analytics
244
+ ├── templates/ # Web UI assets
245
+ └── background/ # Background agents
246
+ ```
247
+
248
+ ---
249
+
250
+ ## Development
251
+
252
+ ```bash
253
+ # Install in editable mode with dev dependencies
254
+ pip install -e ".[dev]"
255
+
256
+ # Run tests
257
+ pytest
258
+
259
+ # With coverage
260
+ pytest --cov=luckyd_code --cov-report=term
261
+
262
+ # Type checking
263
+ mypy luckyd_code
264
+
265
+ # Build distribution
266
+ make build
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Contributing
272
+
273
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
274
+
275
+ 1. Fork the repository
276
+ 2. Create a feature branch from `main`
277
+ 3. Write tests for new functionality
278
+ 4. Ensure all existing tests pass
279
+ 5. Submit a pull request
280
+
281
+ ---
282
+
283
+ ## License
284
+
285
+ MIT License — see [LICENSE](LICENSE) for details.
286
+
287
+ ---
288
+
289
+ ## Security
290
+
291
+ See [SECURITY.md](SECURITY.md) for supported versions and how to report vulnerabilities.
292
+
293
+ ---
294
+
295
+ ## Changelog
296
+
297
+ See [CHANGELOG.md](CHANGELOG.md) for a history of changes.