juno-code 1.0.13 → 1.0.14

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.
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # juno-code.sh
4
+ #
5
+ # Purpose: Shell wrapper for juno-code CLI
6
+ #
7
+ # This script integrates bootstrap.sh with the main CLI entry point.
8
+ # When users run 'juno-code', this wrapper:
9
+ # 1. Checks if project is initialized (.juno_task exists)
10
+ # 2. If initialized: Runs bootstrap.sh to ensure Python environment is ready
11
+ # 3. Executes the actual TypeScript CLI with all arguments
12
+ #
13
+ # Architecture: juno-code = shell-shim + juno-code logic
14
+ #
15
+ # Created by: juno-code build system
16
+ # Auto-generated during npm build
17
+
18
+ set -euo pipefail
19
+
20
+ # Get the directory where this script is located
21
+ # IMPORTANT: Resolve symlinks first (npm creates symlinks in /usr/local/bin or /opt/homebrew/bin)
22
+ # We need the real path to find cli.mjs in the same directory
23
+ if [ -L "${BASH_SOURCE[0]}" ]; then
24
+ # Follow the symlink to get the real script location
25
+ REAL_SCRIPT="$(readlink "${BASH_SOURCE[0]}")"
26
+ # If it's a relative symlink, make it absolute relative to the symlink location
27
+ if [[ "$REAL_SCRIPT" != /* ]]; then
28
+ REAL_SCRIPT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd "$(dirname "$REAL_SCRIPT")" && pwd)/$(basename "$REAL_SCRIPT")"
29
+ fi
30
+ SCRIPT_DIR="$(cd "$(dirname "$REAL_SCRIPT")" && pwd)"
31
+ else
32
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
33
+ fi
34
+
35
+ # Path to the actual CLI entrypoint (Node.js)
36
+ CLI_ENTRYPOINT="${SCRIPT_DIR}/cli.mjs"
37
+
38
+ # Path to bootstrap.sh (should be in .juno_task/scripts after init)
39
+ BOOTSTRAP_SCRIPT=".juno_task/scripts/bootstrap.sh"
40
+
41
+ # Main execution flow
42
+ main() {
43
+ # Check if we're in an initialized juno-code project
44
+ if [ -d ".juno_task" ] && [ -f "$BOOTSTRAP_SCRIPT" ]; then
45
+ # Project is initialized - use bootstrap.sh to setup environment and run CLI
46
+ # Bootstrap.sh will:
47
+ # 1. Check if we're in a venv
48
+ # 2. Check if .venv_juno exists, create if needed
49
+ # 3. Activate venv if needed
50
+ # 4. Execute the command we pass to it
51
+
52
+ # Make sure bootstrap script is executable
53
+ chmod +x "$BOOTSTRAP_SCRIPT" 2>/dev/null || true
54
+
55
+ # Delegate to bootstrap.sh with node CLI as the command to execute
56
+ # Bootstrap will setup environment then exec our CLI
57
+ exec "$BOOTSTRAP_SCRIPT" node "$CLI_ENTRYPOINT" "$@"
58
+ else
59
+ # Not initialized or bootstrap missing - run CLI directly
60
+ # This allows 'juno-code init' to work without bootstrap
61
+ exec node "$CLI_ENTRYPOINT" "$@"
62
+ fi
63
+ }
64
+
65
+ # Run main with all arguments
66
+ main "$@"
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ var __export = (target, all) => {
75
75
  exports.version = void 0;
76
76
  var init_version = __esm({
77
77
  "src/version.ts"() {
78
- exports.version = "1.0.13";
78
+ exports.version = "1.0.14";
79
79
  }
80
80
  });
81
81
  function isHeadlessEnvironment() {
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ var __export = (target, all) => {
44
44
  var version;
45
45
  var init_version = __esm({
46
46
  "src/version.ts"() {
47
- version = "1.0.13";
47
+ version = "1.0.14";
48
48
  }
49
49
  });
50
50
  function isHeadlessEnvironment() {
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # bootstrap.sh
4
+ #
5
+ # Purpose: Pre-flight Python environment setup for juno-code
6
+ #
7
+ # This script runs before the main juno-code entrypoint and ensures:
8
+ # 1. Python virtual environment (.venv_juno) exists
9
+ # 2. Required Python packages are installed
10
+ # 3. Virtual environment is activated if needed
11
+ # 4. Main application can run with proper Python dependencies
12
+ #
13
+ # Usage: ./bootstrap.sh [main-entrypoint-command] [args...]
14
+ #
15
+ # Created by: juno-code init command
16
+ # Date: Auto-generated during project initialization
17
+
18
+ set -euo pipefail # Exit on error, undefined variable, or pipe failure
19
+
20
+ # DEBUG OUTPUT: Show that bootstrap.sh is being executed
21
+ # User feedback: "Add a one line printing from .sh file as well so we could debug it"
22
+ echo "[DEBUG] bootstrap.sh is being executed from: $(pwd)" >&2
23
+
24
+ # Color output for better readability
25
+ RED='\033[0;31m'
26
+ GREEN='\033[0;32m'
27
+ YELLOW='\033[1;33m'
28
+ BLUE='\033[0;34m'
29
+ NC='\033[0m' # No Color
30
+
31
+ # Configuration
32
+ VENV_DIR=".venv_juno"
33
+ SCRIPTS_DIR=".juno_task/scripts"
34
+ INSTALL_SCRIPT="${SCRIPTS_DIR}/install_requirements.sh"
35
+
36
+ # Logging functions
37
+ log_info() {
38
+ echo -e "${BLUE}[BOOTSTRAP]${NC} $1"
39
+ }
40
+
41
+ log_success() {
42
+ echo -e "${GREEN}[BOOTSTRAP]${NC} $1"
43
+ }
44
+
45
+ log_warning() {
46
+ echo -e "${YELLOW}[BOOTSTRAP]${NC} $1"
47
+ }
48
+
49
+ log_error() {
50
+ echo -e "${RED}[BOOTSTRAP]${NC} $1"
51
+ }
52
+
53
+ # Function to check if we're inside .venv_juno specifically
54
+ # CRITICAL FIX: Don't just check for ANY venv - check if we're in .venv_juno
55
+ # User feedback: "bootstrap.sh has the issues that install_requirements.sh used to have.
56
+ # the detection of virtual enviroment is not correct."
57
+ # Previous approach was too permissive - accepted ANY venv (conda, other venvs)
58
+ # NEW APPROACH: Only return success if we're in .venv_juno specifically
59
+ is_in_venv_juno() {
60
+ # Check if VIRTUAL_ENV is set and points to .venv_juno
61
+ if [ -n "${VIRTUAL_ENV:-}" ]; then
62
+ # Check if VIRTUAL_ENV path contains .venv_juno
63
+ if [[ "${VIRTUAL_ENV:-}" == *"/.venv_juno" ]] || [[ "${VIRTUAL_ENV:-}" == *".venv_juno"* ]]; then
64
+ return 0 # Inside .venv_juno
65
+ fi
66
+
67
+ # Check if the basename is .venv_juno
68
+ if [ "$(basename "${VIRTUAL_ENV:-}")" = ".venv_juno" ]; then
69
+ return 0 # Inside .venv_juno
70
+ fi
71
+ fi
72
+
73
+ return 1 # Not inside .venv_juno (or not in any venv)
74
+ }
75
+
76
+ # Function to activate virtual environment
77
+ activate_venv() {
78
+ local venv_path="$1"
79
+
80
+ if [ ! -d "$venv_path" ]; then
81
+ log_error "Virtual environment not found: $venv_path"
82
+ return 1
83
+ fi
84
+
85
+ # Activate the venv
86
+ # shellcheck disable=SC1091
87
+ if [ -f "$venv_path/bin/activate" ]; then
88
+ source "$venv_path/bin/activate"
89
+ log_success "Activated virtual environment: $venv_path"
90
+ return 0
91
+ else
92
+ log_error "Activation script not found: $venv_path/bin/activate"
93
+ return 1
94
+ fi
95
+ }
96
+
97
+ # Function to ensure Python environment is ready
98
+ ensure_python_environment() {
99
+ log_info "Checking Python environment..."
100
+
101
+ # CRITICAL FIX: Check if we're specifically in .venv_juno, not just ANY venv
102
+ # User feedback: "the detection of virtual enviroment is not correct"
103
+ # Previous logic accepted ANY venv (conda, other venvs) which was wrong
104
+ # NEW LOGIC: Only accept .venv_juno specifically
105
+
106
+ # Step 1: Check if we're already in .venv_juno specifically
107
+ if is_in_venv_juno; then
108
+ log_success "Already inside .venv_juno virtual environment"
109
+ return 0
110
+ fi
111
+
112
+ # Step 2: Not in .venv_juno - check if .venv_juno exists in project root
113
+ if [ -d "$VENV_DIR" ]; then
114
+ log_info "Found existing virtual environment: $VENV_DIR"
115
+
116
+ # Activate the venv
117
+ if activate_venv "$VENV_DIR"; then
118
+ return 0
119
+ else
120
+ log_error "Failed to activate virtual environment"
121
+ return 1
122
+ fi
123
+ fi
124
+
125
+ # Step 3: .venv_juno doesn't exist - need to create it
126
+ log_warning "Virtual environment not found: $VENV_DIR"
127
+ log_info "Running install_requirements.sh to create virtual environment..."
128
+
129
+ # Check if install_requirements.sh exists
130
+ if [ ! -f "$INSTALL_SCRIPT" ]; then
131
+ log_error "Install script not found: $INSTALL_SCRIPT"
132
+ log_error "Please run 'juno-code init' to initialize the project"
133
+ return 1
134
+ fi
135
+
136
+ # Make sure the script is executable
137
+ chmod +x "$INSTALL_SCRIPT"
138
+
139
+ # Run the install script
140
+ if bash "$INSTALL_SCRIPT"; then
141
+ log_success "Python environment setup completed successfully"
142
+
143
+ # After install, activate the venv if it was created
144
+ if [ -d "$VENV_DIR" ]; then
145
+ if activate_venv "$VENV_DIR"; then
146
+ return 0
147
+ fi
148
+ fi
149
+
150
+ return 0
151
+ else
152
+ log_error "Failed to run install_requirements.sh"
153
+ log_error "Please check the error messages above"
154
+ return 1
155
+ fi
156
+ }
157
+
158
+ # Main bootstrap logic
159
+ main() {
160
+ log_info "=== juno-code Bootstrap ==="
161
+ echo ""
162
+
163
+ # Ensure Python environment is ready
164
+ if ! ensure_python_environment; then
165
+ log_error "Failed to setup Python environment"
166
+ exit 1
167
+ fi
168
+
169
+ echo ""
170
+ log_success "Python environment ready!"
171
+
172
+ # If there are additional arguments, execute them as the main entrypoint
173
+ if [ $# -gt 0 ]; then
174
+ log_info "Executing main entrypoint: $*"
175
+ echo ""
176
+
177
+ # Execute the main entrypoint with all arguments
178
+ exec "$@"
179
+ else
180
+ log_info "No main entrypoint specified - environment is ready for use"
181
+ log_info "To activate the virtual environment manually, run:"
182
+ echo ""
183
+ echo " source $VENV_DIR/bin/activate"
184
+ echo ""
185
+ fi
186
+ }
187
+
188
+ # Run main function with all arguments
189
+ main "$@"
@@ -23,6 +23,11 @@
23
23
 
24
24
  set -euo pipefail # Exit on error, undefined variable, or pipe failure
25
25
 
26
+ # DEBUG OUTPUT: Show that install_requirements.sh is being executed
27
+ # User feedback: "Add a one line printing from .sh file as well so we could debug it"
28
+ echo "[DEBUG] install_requirements.sh is being executed from: $(pwd)" >&2
29
+ echo "[DEBUG] .venv_juno will be created in: $(pwd)/.venv_juno" >&2
30
+
26
31
  # Color output for better readability
27
32
  RED='\033[0;31m'
28
33
  GREEN='\033[0;32m'
@@ -102,6 +107,54 @@ is_in_virtualenv() {
102
107
  return 1 # Not inside venv
103
108
  }
104
109
 
110
+ # Function to find the best Python version (3.10-3.13, preferably 3.13)
111
+ find_best_python() {
112
+ # Try to find Python in order of preference: 3.13, 3.12, 3.11, 3.10
113
+ local python_versions=("python3.13" "python3.12" "python3.11" "python3.10")
114
+
115
+ for py_cmd in "${python_versions[@]}"; do
116
+ if command -v "$py_cmd" &> /dev/null; then
117
+ # Verify it's actually the right version
118
+ local version
119
+ version=$($py_cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
120
+ local major
121
+ major=$(echo "$version" | cut -d'.' -f1)
122
+ local minor
123
+ minor=$(echo "$version" | cut -d'.' -f2)
124
+
125
+ # Check if version is 3.10 or higher
126
+ if [ "$major" -eq 3 ] && [ "$minor" -ge 10 ]; then
127
+ echo "$py_cmd"
128
+ return 0
129
+ fi
130
+ fi
131
+ done
132
+
133
+ # Fall back to python3 if available and check its version
134
+ if command -v python3 &> /dev/null; then
135
+ local version
136
+ version=$(python3 --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
137
+ local major
138
+ major=$(echo "$version" | cut -d'.' -f1)
139
+ local minor
140
+ minor=$(echo "$version" | cut -d'.' -f2)
141
+
142
+ # Check if version is 3.10 or higher
143
+ if [ "$major" -eq 3 ] && [ "$minor" -ge 10 ]; then
144
+ echo "python3"
145
+ return 0
146
+ else
147
+ # Python3 exists but is too old
148
+ log_error "Found Python $version, but Python 3.10+ is required"
149
+ return 1
150
+ fi
151
+ fi
152
+
153
+ # No suitable Python found
154
+ log_error "No Python 3.10+ found. Please install Python 3.10, 3.11, 3.12, or 3.13 (preferably 3.13)"
155
+ return 1
156
+ }
157
+
105
158
  # Function to check if Python is externally managed (PEP 668)
106
159
  # This is common on Ubuntu 23.04+, Debian, and other modern Linux distros
107
160
  is_externally_managed_python() {
@@ -156,30 +209,66 @@ install_with_uv() {
156
209
 
157
210
  local uv_flags="--quiet"
158
211
 
159
- if is_in_virtualenv; then
160
- log_info "Detected virtual environment - installing into venv"
161
- elif is_externally_managed_python; then
162
- log_warning "Detected externally managed Python (PEP 668) - Ubuntu/Debian system"
163
- log_info "Creating temporary virtual environment for installation..."
212
+ # CRITICAL FIX: Properly detect if uv will work in the current environment
213
+ # User feedback: "Maybe the way you are verifying being inside venv by uv is not correct !!!"
214
+ # Previous approach failed because uv pip list doesn't reliably indicate venv compatibility
215
+ # NEW APPROACH: Always create .venv_juno unless we're already inside it
216
+
217
+ local venv_path=".venv_juno"
218
+ local need_venv=true
219
+
220
+ # Check if we're already inside .venv_juno
221
+ if [ -n "${VIRTUAL_ENV:-}" ] && ( [[ "${VIRTUAL_ENV:-}" == *"/.venv_juno" ]] || [[ "${VIRTUAL_ENV:-}" == *".venv_juno"* ]] ); then
222
+ log_info "Already inside .venv_juno virtual environment"
223
+ need_venv=false
224
+ # Check if we're in .venv_juno by checking the activate script path
225
+ elif [ -n "${VIRTUAL_ENV:-}" ] && [ "$(basename "${VIRTUAL_ENV:-}")" = ".venv_juno" ]; then
226
+ log_info "Already inside .venv_juno virtual environment"
227
+ need_venv=false
228
+ fi
229
+
230
+ # If we need a venv, create and activate .venv_juno
231
+ if [ "$need_venv" = true ]; then
232
+ log_info "Creating/using .venv_juno virtual environment for reliable uv installation..."
233
+
234
+ # Find best Python version (3.10-3.13, preferably 3.13)
235
+ local python_cmd
236
+ if ! python_cmd=$(find_best_python); then
237
+ log_error "Cannot create venv: No suitable Python version found"
238
+ log_info "Please install Python 3.10+ (preferably Python 3.13)"
239
+ log_info " Mac: brew install python@3.13"
240
+ log_info " Ubuntu/Debian: sudo apt install python3.13 python3.13-venv"
241
+ return 1
242
+ fi
243
+
244
+ local version
245
+ version=$($python_cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
246
+ log_info "Using Python $version for virtual environment"
164
247
 
165
248
  # Create a project-local venv if it doesn't exist
166
- local venv_path=".juno_venv"
167
249
  if [ ! -d "$venv_path" ]; then
168
- if ! python3 -m venv "$venv_path" 2>/dev/null; then
250
+ log_info "Creating virtual environment with $python_cmd..."
251
+ if ! $python_cmd -m venv "$venv_path" 2>/dev/null; then
169
252
  log_error "Failed to create virtual environment"
170
- log_info "Please install python3-venv: sudo apt install python3-venv python3-full"
253
+ log_info "Please ensure python venv module is installed:"
254
+ log_info " Mac: brew install python@3.13"
255
+ log_info " Ubuntu/Debian: sudo apt install python3.13-venv python3-full"
171
256
  return 1
172
257
  fi
173
- log_success "Created virtual environment at $venv_path"
258
+ log_success "Created virtual environment at $venv_path with Python $version"
259
+ else
260
+ log_info "Using existing virtual environment at $venv_path"
174
261
  fi
175
262
 
176
263
  # Activate the venv for this script
177
264
  # shellcheck disable=SC1091
178
- source "$venv_path/bin/activate"
179
- log_success "Activated virtual environment"
180
- else
181
- log_info "Not in a virtual environment - using --system flag for system-wide installation"
182
- uv_flags="--quiet --system"
265
+ if [ -f "$venv_path/bin/activate" ]; then
266
+ source "$venv_path/bin/activate"
267
+ log_success "Activated virtual environment - uv will now install into .venv_juno"
268
+ else
269
+ log_error "Virtual environment activation script not found"
270
+ return 1
271
+ fi
183
272
  fi
184
273
 
185
274
  local failed_packages=()
@@ -217,20 +306,32 @@ install_with_pip() {
217
306
  fi
218
307
  fi
219
308
 
220
- # Handle externally managed Python
309
+ # Handle externally managed Python or missing venv
221
310
  if ! is_in_virtualenv && is_externally_managed_python; then
222
311
  log_warning "Detected externally managed Python (PEP 668) - Ubuntu/Debian system"
223
- log_info "Creating temporary virtual environment for installation..."
312
+ log_info "Creating virtual environment for installation..."
313
+
314
+ # Find best Python version (3.10-3.13, preferably 3.13)
315
+ if ! python_cmd=$(find_best_python); then
316
+ log_error "Cannot create venv: No suitable Python version found"
317
+ log_info "Please install Python 3.10+ (preferably Python 3.13)"
318
+ log_info " Ubuntu/Debian: sudo apt install python3.13 python3.13-venv"
319
+ return 1
320
+ fi
321
+
322
+ local version
323
+ version=$($python_cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
324
+ log_info "Using Python $version for virtual environment"
224
325
 
225
326
  # Create a project-local venv if it doesn't exist
226
- local venv_path=".juno_venv"
327
+ local venv_path=".venv_juno"
227
328
  if [ ! -d "$venv_path" ]; then
228
329
  if ! $python_cmd -m venv "$venv_path" 2>/dev/null; then
229
330
  log_error "Failed to create virtual environment"
230
- log_info "Please install python3-venv: sudo apt install python3-venv python3-full"
331
+ log_info "Please install python3-venv (Linux: sudo apt install python3.13-venv python3-full)"
231
332
  return 1
232
333
  fi
233
- log_success "Created virtual environment at $venv_path"
334
+ log_success "Created virtual environment at $venv_path with Python $version"
234
335
  fi
235
336
 
236
337
  # Activate the venv for this script
@@ -353,9 +454,9 @@ main() {
353
454
  if install_with_uv; then
354
455
  echo ""
355
456
  log_success "All packages installed successfully using 'uv'!"
356
- if [ -d ".juno_venv" ]; then
357
- log_info "Packages installed in virtual environment: .juno_venv"
358
- log_info "To use them, activate the venv: source .juno_venv/bin/activate"
457
+ if [ -d ".venv_juno" ]; then
458
+ log_info "Packages installed in virtual environment: .venv_juno"
459
+ log_info "To use them, activate the venv: source .venv_juno/bin/activate"
359
460
  fi
360
461
  echo ""
361
462
  exit 0
@@ -367,9 +468,9 @@ main() {
367
468
  if install_with_pip; then
368
469
  echo ""
369
470
  log_success "All packages installed successfully using 'pip'!"
370
- if [ -d ".juno_venv" ]; then
371
- log_info "Packages installed in virtual environment: .juno_venv"
372
- log_info "To use them, activate the venv: source .juno_venv/bin/activate"
471
+ if [ -d ".venv_juno" ]; then
472
+ log_info "Packages installed in virtual environment: .venv_juno"
473
+ log_info "To use them, activate the venv: source .venv_juno/bin/activate"
373
474
  fi
374
475
  echo ""
375
476
  exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juno-code",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "AI Subagent Orchestration CLI - Professional TypeScript CLI for AI-powered code intelligence, MCP server orchestration, and subagent collaboration",
5
5
  "keywords": [
6
6
  "ai",
@@ -35,6 +35,9 @@
35
35
  "README.md",
36
36
  "CHANGELOG.md"
37
37
  ],
38
+ "scripts": {
39
+ "build:copy-wrapper": "node -e \"const fs = require('fs-extra'); fs.copySync('src/bin/juno-code.sh', 'dist/bin/juno-code.sh'); fs.chmodSync('dist/bin/juno-code.sh', 0o755);\""
40
+ },
38
41
  "dependencies": {
39
42
  "@modelcontextprotocol/sdk": "^1.20.0",
40
43
  "chalk": "^5.3.0",