codrninja 0.2.1__tar.gz → 0.3.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 (26) hide show
  1. codrninja-0.3.2/.gitignore +46 -0
  2. {codrninja-0.2.1/src/codrninja.egg-info → codrninja-0.3.2}/PKG-INFO +6 -24
  3. codrninja-0.3.2/install.sh +268 -0
  4. codrninja-0.3.2/pyproject.toml +27 -0
  5. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/__init__.py +0 -1
  6. codrninja-0.3.2/src/codrninja/tui.py +335 -0
  7. {codrninja-0.2.1 → codrninja-0.3.2/src/codrninja.egg-info}/PKG-INFO +6 -24
  8. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja.egg-info/SOURCES.txt +2 -0
  9. codrninja-0.3.2/src/codrninja.egg-info/requires.txt +5 -0
  10. codrninja-0.2.1/pyproject.toml +0 -62
  11. codrninja-0.2.1/src/codrninja/tui.py +0 -742
  12. codrninja-0.2.1/src/codrninja.egg-info/requires.txt +0 -7
  13. {codrninja-0.2.1 → codrninja-0.3.2}/LICENSE +0 -0
  14. {codrninja-0.2.1 → codrninja-0.3.2}/README.md +0 -0
  15. {codrninja-0.2.1 → codrninja-0.3.2}/setup.cfg +0 -0
  16. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/agent.py +0 -0
  17. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/cli.py +0 -0
  18. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/config.py +0 -0
  19. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/core.py +0 -0
  20. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/interactive.py +0 -0
  21. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/providers.py +0 -0
  22. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja/tools.py +0 -0
  23. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja.egg-info/dependency_links.txt +0 -0
  24. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja.egg-info/entry_points.txt +0 -0
  25. {codrninja-0.2.1 → codrninja-0.3.2}/src/codrninja.egg-info/top_level.txt +0 -0
  26. {codrninja-0.2.1 → codrninja-0.3.2}/tests/test_core.py +0 -0
@@ -0,0 +1,46 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ venv/
25
+ env/
26
+ ENV/
27
+
28
+ # IDE
29
+ .vscode/
30
+ .idea/
31
+ *.swp
32
+ *.swo
33
+ *~
34
+
35
+ # Database
36
+ *.db
37
+ .sessions/
38
+
39
+ # Testing
40
+ .pytest_cache/
41
+ .coverage
42
+ htmlcov/
43
+
44
+ # OS
45
+ .DS_Store
46
+ Thumbs.db
@@ -1,36 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codrninja
3
- Version: 0.2.1
3
+ Version: 0.3.2
4
4
  Summary: AI-first coding assistant for automation
5
- Author-email: Milan <your-email@example.com>
5
+ Author: 20ZollCoder
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/20ZollCoder/codrninja
8
8
  Project-URL: Repository, https://github.com/20ZollCoder/codrninja
9
- Project-URL: Issues, https://github.com/20ZollCoder/codrninja/issues
10
- Keywords: ai,coding,automation,ollama,cli
11
- Classifier: Development Status :: 3 - Alpha
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Programming Language :: Python :: 3.13
20
- Classifier: Programming Language :: Python :: 3.14
21
- Classifier: Topic :: Software Development :: Code Generators
22
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
- Classifier: Environment :: Console
24
- Classifier: Operating System :: OS Independent
25
- Requires-Python: >=3.9
9
+ Requires-Python: >=3.8
26
10
  Description-Content-Type: text/markdown
27
11
  License-File: LICENSE
28
12
  Requires-Dist: requests>=2.25.0
29
- Provides-Extra: dev
30
- Requires-Dist: pytest>=7.0; extra == "dev"
31
- Requires-Dist: pytest-cov>=4.0; extra == "dev"
32
- Requires-Dist: black>=23.0; extra == "dev"
33
- Requires-Dist: flake8>=6.0; extra == "dev"
13
+ Requires-Dist: prompt_toolkit>=3.0.0
14
+ Provides-Extra: rich
15
+ Requires-Dist: rich>=10.0.0; extra == "rich"
34
16
  Dynamic: license-file
35
17
 
36
18
  # 🥷 codrninja
@@ -0,0 +1,268 @@
1
+ #!/bin/bash
2
+ # Codrninja Installer Script
3
+ # Works on macOS, Linux, and WSL
4
+ # Usage: curl -fsSL https://raw.githubusercontent.com/20ZollCoder/codrninja/main/install.sh | bash
5
+
6
+ set -e
7
+
8
+ CODRNINJA_VERSION="0.1.1"
9
+ CONFIG_DIR="${HOME}/.config/codrninja"
10
+ REPO_URL="https://github.com/20ZollCoder/codrninja"
11
+
12
+ echo "🥷 Installing codrninja v${CODRNINJA_VERSION}..."
13
+
14
+ # Check Python
15
+ if ! command -v python3 &> /dev/null; then
16
+ echo "❌ Python 3 is required but not installed."
17
+ echo " macOS: brew install python3"
18
+ echo " Ubuntu/Debian: sudo apt install python3"
19
+ echo " Fedora: sudo dnf install python3"
20
+ exit 1
21
+ fi
22
+
23
+ PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
24
+ echo "✅ Found Python ${PYTHON_VERSION}"
25
+
26
+ # Check pip
27
+ if ! command -v pip3 &> /dev/null && ! command -v pip &> /dev/null; then
28
+ echo "❌ pip is required but not installed."
29
+ echo " Install with: python3 -m ensurepip --upgrade"
30
+ exit 1
31
+ fi
32
+
33
+ PIP_CMD=$(command -v pip3 || command -v pip)
34
+ echo "✅ Found pip"
35
+
36
+ # Detect the actual pip user install bin directory
37
+ # This is platform-specific and Python-version-specific
38
+ echo "🔍 Detecting pip install directory..."
39
+
40
+ # Method 1: Ask Python where user scripts go
41
+ USER_BIN_DIR=$(python3 -c "
42
+ import site
43
+ import os
44
+ import sys
45
+
46
+ # Try multiple methods to find the correct user bin directory
47
+ paths = [
48
+ os.path.join(site.getuserbase(), 'bin'), # Linux standard
49
+ os.path.join(site.getuserbase(), 'Scripts'), # Windows
50
+ ]
51
+
52
+ # macOS framework Python uses a different location
53
+ if sys.platform == 'darwin':
54
+ # Check Library/Python/X.Y/bin
55
+ import sysconfig
56
+ py_version = f'{sys.version_info.major}.{sys.version_info.minor}'
57
+ paths.insert(0, os.path.expanduser(f'~/Library/Python/{py_version}/bin'))
58
+
59
+ # Also check the framework path
60
+ framework = os.path.join(os.path.expanduser('~'), 'Library', 'Python', py_version, 'bin')
61
+ if os.path.exists(framework):
62
+ paths.insert(0, framework)
63
+
64
+ # Find the first existing or create the most likely one
65
+ for p in paths:
66
+ if os.path.exists(p):
67
+ print(p)
68
+ break
69
+ else:
70
+ # Default to the first path
71
+ print(paths[0])
72
+ " 2>/dev/null || echo "")
73
+
74
+ if [ -z "$USER_BIN_DIR" ] || [ "$USER_BIN_DIR" = "" ]; then
75
+ # Fallback: try to infer from python location
76
+ PYTHON_BIN=$(python3 -c "import sys; print(sys.executable)" 2>/dev/null)
77
+ if [ -n "$PYTHON_BIN" ]; then
78
+ PYTHON_PREFIX=$(dirname "$PYTHON_BIN")
79
+ if [ -d "${PYTHON_PREFIX}/Scripts" ]; then
80
+ USER_BIN_DIR="${PYTHON_PREFIX}/Scripts"
81
+ else
82
+ USER_BIN_DIR="${PYTHON_PREFIX}"
83
+ fi
84
+ else
85
+ USER_BIN_DIR="${HOME}/.local/bin"
86
+ fi
87
+ fi
88
+
89
+ # Ensure the directory exists
90
+ mkdir -p "$USER_BIN_DIR"
91
+ mkdir -p "$CONFIG_DIR"
92
+
93
+ echo "✅ Install location: $USER_BIN_DIR"
94
+
95
+ # Install codrninja
96
+ echo "📦 Installing codrninja..."
97
+ "${PIP_CMD}" install --user "codrninja==${CODRNINJA_VERSION}" 2>/dev/null || {
98
+ echo "📦 PyPI install failed, installing from git..."
99
+ "${PIP_CMD}" install --user "git+${REPO_URL}.git"
100
+ }
101
+
102
+ # Install rich for TUI (optional but recommended)
103
+ echo "🎨 Installing Rich for TUI (optional)..."
104
+ "${PIP_CMD}" install --user rich 2>/dev/null || echo " (Rich installation skipped)"
105
+
106
+ # After installation, find where pip actually put the scripts
107
+ echo "🔍 Locating installed scripts..."
108
+
109
+ # Method 1: Ask pip where the scripts are
110
+ PIP_BIN_DIR=$(python3 -c "
111
+ import os
112
+ import sys
113
+ import site
114
+
115
+ # Try to find the scripts directory
116
+ paths = [
117
+ os.path.join(site.getuserbase(), 'bin'),
118
+ os.path.join(site.getuserbase(), 'Scripts'),
119
+ ]
120
+
121
+ # macOS framework Python
122
+ if sys.platform == 'darwin':
123
+ import sysconfig
124
+ py_version = f'{sys.version_info.major}.{sys.version_info.minor}'
125
+ paths.insert(0, os.path.expanduser(f'~/Library/Python/{py_version}/bin'))
126
+
127
+ for p in paths:
128
+ if os.path.exists(p) and os.path.isdir(p):
129
+ print(p)
130
+ break
131
+ " 2>/dev/null || echo "")
132
+
133
+ if [ -n "$PIP_BIN_DIR" ] && [ -d "$PIP_BIN_DIR" ]; then
134
+ USER_BIN_DIR="$PIP_BIN_DIR"
135
+ fi
136
+
137
+ # Method 2: Search for codrninja executable
138
+ if [ ! -f "$USER_BIN_DIR/codrninja" ]; then
139
+ # Try to find it
140
+ FOUND=$(find "$HOME" -name "codrninja" -type f 2>/dev/null | head -1)
141
+ if [ -n "$FOUND" ]; then
142
+ USER_BIN_DIR=$(dirname "$FOUND")
143
+ fi
144
+ fi
145
+
146
+ echo "✅ Scripts located in: $USER_BIN_DIR"
147
+
148
+ # Verify scripts exist
149
+ if [ -f "$USER_BIN_DIR/codrninja" ]; then
150
+ echo "✅ codrninja found"
151
+ else
152
+ echo "⚠️ codrninja not found in $USER_BIN_DIR"
153
+ echo " Searching..."
154
+ # Last resort: find anywhere in home
155
+ FOUND=$(find "$HOME" -name "codrninja" -type f 2>/dev/null | head -1)
156
+ if [ -n "$FOUND" ]; then
157
+ USER_BIN_DIR=$(dirname "$FOUND")
158
+ echo "✅ Found at: $USER_BIN_DIR"
159
+ fi
160
+ fi
161
+
162
+ # Detect shell config file
163
+ SHELL_CONFIG=""
164
+ if [ -n "$ZSH_VERSION" ] || [ -f "${HOME}/.zshrc" ]; then
165
+ SHELL_CONFIG="${HOME}/.zshrc"
166
+ CURRENT_SHELL="zsh"
167
+ elif [ -n "$BASH_VERSION" ] || [ -f "${HOME}/.bashrc" ]; then
168
+ SHELL_CONFIG="${HOME}/.bashrc"
169
+ CURRENT_SHELL="bash"
170
+ elif [ -f "${HOME}/.config/fish/config.fish" ]; then
171
+ SHELL_CONFIG="${HOME}/.config/fish/config.fish"
172
+ CURRENT_SHELL="fish"
173
+ fi
174
+
175
+ # Add to PATH if not already there
176
+ PATH_UPDATED=false
177
+ if [ -n "${SHELL_CONFIG}" ]; then
178
+ if ! grep -q "$USER_BIN_DIR" "${SHELL_CONFIG}" 2>/dev/null; then
179
+ echo ""
180
+ echo "🔧 Adding $USER_BIN_DIR to PATH in ${SHELL_CONFIG}..."
181
+ echo '' >> "${SHELL_CONFIG}"
182
+ echo '# Added by codrninja installer' >> "${SHELL_CONFIG}"
183
+ echo "export PATH=\"${USER_BIN_DIR}:\${PATH}\"" >> "${SHELL_CONFIG}"
184
+ PATH_UPDATED=true
185
+ fi
186
+ else
187
+ echo ""
188
+ echo "⚠️ Could not detect shell config file."
189
+ echo " Add this line to your shell config:"
190
+ echo " export PATH=\"${USER_BIN_DIR}:\${PATH}\""
191
+ fi
192
+
193
+ # Also add to current session so user can use it immediately
194
+ if [[ ":$PATH:" != *":$USER_BIN_DIR:"* ]]; then
195
+ export PATH="$USER_BIN_DIR:$PATH"
196
+ fi
197
+
198
+ # Create config file
199
+ if [ ! -f "${CONFIG_DIR}/config.json" ]; then
200
+ echo "📝 Creating default config..."
201
+ cat > "${CONFIG_DIR}/config.json" << 'EOF'
202
+ {
203
+ "ollama_url": "http://localhost:11434",
204
+ "default_model": "codellama",
205
+ "theme": "dark"
206
+ }
207
+ EOF
208
+ fi
209
+
210
+ # Create helper script
211
+ HELPER_SCRIPT="${USER_BIN_DIR}/codrninja-setup"
212
+ cat > "$HELPER_SCRIPT" << 'EOF'
213
+ #!/bin/bash
214
+ # Codrninja quick setup
215
+
216
+ echo "🥷 Codrninja Quick Setup"
217
+ echo ""
218
+
219
+ # Check if Ollama is configured
220
+ if [ -z "${OLLAMA_URL}" ]; then
221
+ echo "⚠️ OLLAMA_URL not set"
222
+ echo ""
223
+ read -p "Enter your Ollama URL [http://localhost:11434]: " ollama_url
224
+ OLLAMA_URL="${ollama_url:-http://localhost:11434}"
225
+ echo "export OLLAMA_URL=${OLLAMA_URL}" >> "${HOME}/.zshrc"
226
+ fi
227
+
228
+ if [ -z "${OLLAMA_MODEL}" ]; then
229
+ echo "⚠️ OLLAMA_MODEL not set"
230
+ echo ""
231
+ read -p "Enter your default model [codellama]: " model
232
+ OLLAMA_MODEL="${model:-codellama}"
233
+ echo "export OLLAMA_MODEL=${OLLAMA_MODEL}" >> "${HOME}/.zshrc"
234
+ fi
235
+
236
+ echo ""
237
+ echo "✅ Setup complete!"
238
+ echo ""
239
+ echo "Usage:"
240
+ echo " codrninja-tui my-session # Start TUI"
241
+ echo " codrninja agent my-session 'msg' # Run agent"
242
+ echo ""
243
+ echo "Run 'source ~/.zshrc' or restart your terminal to apply changes."
244
+ EOF
245
+
246
+ chmod +x "$HELPER_SCRIPT"
247
+
248
+ # Final instructions
249
+ echo ""
250
+ echo "✅ Installation complete!"
251
+ echo ""
252
+ echo "🥷 codrninja is now installed!"
253
+ echo ""
254
+
255
+ if [ "$PATH_UPDATED" = true ]; then
256
+ echo "Important: Restart your terminal or run:"
257
+ echo " source ${SHELL_CONFIG}"
258
+ echo ""
259
+ fi
260
+
261
+ echo "Then start using:"
262
+ echo " codrninja-tui my-session"
263
+ echo ""
264
+ echo "Or configure first:"
265
+ echo " codrninja-setup"
266
+ echo ""
267
+ echo "Documentation: https://github.com/20ZollCoder/codrninja"
268
+ echo ""
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "codrninja"
7
+ version = "0.3.2"
8
+ description = "AI-first coding assistant for automation"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "20ZollCoder"}]
12
+ requires-python = ">=3.8"
13
+ dependencies = [
14
+ "requests>=2.25.0",
15
+ "prompt_toolkit>=3.0.0",
16
+ ]
17
+
18
+ [project.optional-dependencies]
19
+ rich = ["rich>=10.0.0"]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/20ZollCoder/codrninja"
23
+ Repository = "https://github.com/20ZollCoder/codrninja"
24
+
25
+ [project.scripts]
26
+ codrninja = "codrninja.cli:main"
27
+ codrninja-tui = "codrninja.tui:main"
@@ -2,7 +2,6 @@
2
2
  codrninja: AI-first coding assistant for automation
3
3
  """
4
4
 
5
- __version__ = "0.1.0"
6
5
  __author__ = "Milan"
7
6
  __license__ = "MIT"
8
7