juno-code 1.0.14 → 1.0.17

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,13 +1,147 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
+
3
+ # kanban.sh
2
4
  #
3
- # Kanban Wrapper Script
5
+ # Purpose: Kanban wrapper with Python environment setup
4
6
  #
5
- # This script ensures juno-kanban always executes from the project root directory,
6
- # maintaining a single consistent database location regardless of where this script is called from.
7
+ # This script ensures juno-kanban always executes from the project root directory
8
+ # with the proper Python virtual environment activated.
7
9
  #
8
10
  # Usage: ./.juno_task/scripts/kanban.sh [juno-kanban arguments]
9
11
  # Example: ./.juno_task/scripts/kanban.sh list --limit 5
10
12
  #
13
+ # Created by: juno-code init command
14
+ # Date: Auto-generated during project initialization
15
+
16
+ set -euo pipefail # Exit on error, undefined variable, or pipe failure
17
+
18
+ # DEBUG OUTPUT: Show that kanban.sh is being executed
19
+ echo "[DEBUG] kanban.sh is being executed from: $(pwd)" >&2
20
+
21
+ # Color output for better readability
22
+ RED='\033[0;31m'
23
+ GREEN='\033[0;32m'
24
+ YELLOW='\033[1;33m'
25
+ BLUE='\033[0;34m'
26
+ NC='\033[0m' # No Color
27
+
28
+ # Configuration
29
+ VENV_DIR=".venv_juno"
30
+ SCRIPTS_DIR=".juno_task/scripts"
31
+ INSTALL_SCRIPT="${SCRIPTS_DIR}/install_requirements.sh"
32
+
33
+ # Logging functions
34
+ log_info() {
35
+ echo -e "${BLUE}[KANBAN]${NC} $1"
36
+ }
37
+
38
+ log_success() {
39
+ echo -e "${GREEN}[KANBAN]${NC} $1"
40
+ }
41
+
42
+ log_warning() {
43
+ echo -e "${YELLOW}[KANBAN]${NC} $1"
44
+ }
45
+
46
+ log_error() {
47
+ echo -e "${RED}[KANBAN]${NC} $1"
48
+ }
49
+
50
+ # Function to check if we're inside .venv_juno specifically
51
+ # CRITICAL: Don't just check for ANY venv - check if we're in .venv_juno
52
+ is_in_venv_juno() {
53
+ # Check if VIRTUAL_ENV is set and points to .venv_juno
54
+ if [ -n "${VIRTUAL_ENV:-}" ]; then
55
+ # Check if VIRTUAL_ENV path contains .venv_juno
56
+ if [[ "${VIRTUAL_ENV:-}" == *"/.venv_juno" ]] || [[ "${VIRTUAL_ENV:-}" == *".venv_juno"* ]]; then
57
+ return 0 # Inside .venv_juno
58
+ fi
59
+
60
+ # Check if the basename is .venv_juno
61
+ if [ "$(basename "${VIRTUAL_ENV:-}")" = ".venv_juno" ]; then
62
+ return 0 # Inside .venv_juno
63
+ fi
64
+ fi
65
+
66
+ return 1 # Not inside .venv_juno (or not in any venv)
67
+ }
68
+
69
+ # Function to activate virtual environment
70
+ activate_venv() {
71
+ local venv_path="$1"
72
+
73
+ if [ ! -d "$venv_path" ]; then
74
+ log_error "Virtual environment not found: $venv_path"
75
+ return 1
76
+ fi
77
+
78
+ # Activate the venv
79
+ # shellcheck disable=SC1091
80
+ if [ -f "$venv_path/bin/activate" ]; then
81
+ source "$venv_path/bin/activate"
82
+ log_success "Activated virtual environment: $venv_path"
83
+ return 0
84
+ else
85
+ log_error "Activation script not found: $venv_path/bin/activate"
86
+ return 1
87
+ fi
88
+ }
89
+
90
+ # Function to ensure Python environment is ready
91
+ ensure_python_environment() {
92
+ log_info "Checking Python environment..."
93
+
94
+ # Step 1: Check if we're already in .venv_juno specifically
95
+ if is_in_venv_juno; then
96
+ log_success "Already inside .venv_juno virtual environment"
97
+ return 0
98
+ fi
99
+
100
+ # Step 2: Not in .venv_juno - check if .venv_juno exists in project root
101
+ if [ -d "$VENV_DIR" ]; then
102
+ log_info "Found existing virtual environment: $VENV_DIR"
103
+
104
+ # Activate the venv
105
+ if activate_venv "$VENV_DIR"; then
106
+ return 0
107
+ else
108
+ log_error "Failed to activate virtual environment"
109
+ return 1
110
+ fi
111
+ fi
112
+
113
+ # Step 3: .venv_juno doesn't exist - need to create it
114
+ log_warning "Virtual environment not found: $VENV_DIR"
115
+ log_info "Running install_requirements.sh to create virtual environment..."
116
+
117
+ # Check if install_requirements.sh exists
118
+ if [ ! -f "$INSTALL_SCRIPT" ]; then
119
+ log_error "Install script not found: $INSTALL_SCRIPT"
120
+ log_error "Please run 'juno-code init' to initialize the project"
121
+ return 1
122
+ fi
123
+
124
+ # Make sure the script is executable
125
+ chmod +x "$INSTALL_SCRIPT"
126
+
127
+ # Run the install script
128
+ if bash "$INSTALL_SCRIPT"; then
129
+ log_success "Python environment setup completed successfully"
130
+
131
+ # After install, activate the venv if it was created
132
+ if [ -d "$VENV_DIR" ]; then
133
+ if activate_venv "$VENV_DIR"; then
134
+ return 0
135
+ fi
136
+ fi
137
+
138
+ return 0
139
+ else
140
+ log_error "Failed to run install_requirements.sh"
141
+ log_error "Please check the error messages above"
142
+ return 1
143
+ fi
144
+ }
11
145
 
12
146
  # Get the directory where this script is located
13
147
  SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -15,5 +149,25 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
15
149
  # Navigate to project root (parent of scripts directory)
16
150
  PROJECT_ROOT="$( cd "$SCRIPT_DIR/../.." && pwd )"
17
151
 
18
- # Change to project root and execute juno-kanban with all passed arguments
19
- cd "$PROJECT_ROOT" && juno-kanban "$@"
152
+ # Change to project root
153
+ cd "$PROJECT_ROOT"
154
+
155
+ # Main kanban logic
156
+ main() {
157
+ log_info "=== juno-kanban Wrapper ==="
158
+
159
+ # Ensure Python environment is ready
160
+ if ! ensure_python_environment; then
161
+ log_error "Failed to setup Python environment"
162
+ exit 1
163
+ fi
164
+
165
+ log_success "Python environment ready!"
166
+
167
+ # Execute juno-kanban with all passed arguments from project root
168
+ log_info "Executing juno-kanban: $*"
169
+ exec juno-kanban "$@"
170
+ }
171
+
172
+ # Run main function with all arguments
173
+ main "$@"
@@ -0,0 +1,271 @@
1
+ # Juno-Code Service Scripts
2
+
3
+ This directory contains service scripts that extend juno-code functionality. These scripts are Python-based utilities that can be customized by users.
4
+
5
+ ## Installation
6
+
7
+ Service scripts are automatically installed to `~/.juno_code/services/` when you run:
8
+
9
+ ```bash
10
+ juno-code init
11
+ ```
12
+
13
+ Or you can manually install/manage them:
14
+
15
+ ```bash
16
+ # Install services
17
+ juno-code services install
18
+
19
+ # List installed services
20
+ juno-code services list
21
+
22
+ # Check installation status
23
+ juno-code services status
24
+
25
+ # Show services directory path
26
+ juno-code services path
27
+
28
+ # Uninstall services
29
+ juno-code services uninstall --yes
30
+ ```
31
+
32
+ ## Available Services
33
+
34
+ ### codex.py
35
+
36
+ A wrapper for OpenAI Codex CLI with configurable options.
37
+
38
+ #### Features
39
+
40
+ - Automatic codex installation check
41
+ - Support for inline prompts or prompt files
42
+ - Configurable model selection
43
+ - Auto-instruction prepending
44
+ - Full argument passthrough and override support
45
+ - JSON output support
46
+ - Verbose mode for debugging
47
+
48
+ #### Usage
49
+
50
+ ```bash
51
+ # Basic usage with inline prompt
52
+ ~/.juno_code/services/codex.py -p "Write a hello world function"
53
+
54
+ # Using a prompt file
55
+ ~/.juno_code/services/codex.py -pp /path/to/prompt.txt
56
+
57
+ # Specify project directory
58
+ ~/.juno_code/services/codex.py -p "Add tests" --cd /path/to/project
59
+
60
+ # Override default model
61
+ ~/.juno_code/services/codex.py -p "Refactor code" -m gpt-4-turbo
62
+
63
+ # Custom auto-instruction
64
+ ~/.juno_code/services/codex.py -p "Fix bugs" --auto-instruction "You are a debugging expert"
65
+
66
+ # Add custom codex config
67
+ ~/.juno_code/services/codex.py -p "Write code" -c custom_option=value
68
+
69
+ # Enable verbose output
70
+ ~/.juno_code/services/codex.py -p "Analyze code" --verbose
71
+
72
+ # JSON output
73
+ ~/.juno_code/services/codex.py -p "Generate function" --json
74
+ ```
75
+
76
+ #### Arguments
77
+
78
+ - `-p, --prompt <text>`: Prompt text to send to codex (required, mutually exclusive with --prompt-file)
79
+ - `-pp, --prompt-file <path>`: Path to file containing the prompt (required, mutually exclusive with --prompt)
80
+ - `--cd <path>`: Project path (absolute path). Default: current directory
81
+ - `-m, --model <name>`: Model name. Default: gpt-4
82
+ - `--auto-instruction <text>`: Auto instruction to prepend to prompt
83
+ - `-c, --config <arg>`: Additional codex config arguments (can be used multiple times)
84
+ - `--json`: Output in JSON format
85
+ - `--verbose`: Enable verbose output
86
+
87
+ #### Default Configuration
88
+
89
+ The script comes with these default codex configurations:
90
+ - `include_apply_patch_tool=true`
91
+ - `use_experimental_streamable_shell_tool=true`
92
+ - `sandbox_mode=danger-full-access`
93
+
94
+ You can override these by providing the same config key with `-c`:
95
+
96
+ ```bash
97
+ # Override sandbox mode
98
+ ~/.juno_code/services/codex.py -p "Safe operation" -c sandbox_mode=safe
99
+ ```
100
+
101
+ ### claude.py
102
+
103
+ A wrapper for Anthropic Claude CLI with configurable options.
104
+
105
+ #### Features
106
+
107
+ - Automatic claude installation check
108
+ - Support for inline prompts or prompt files
109
+ - Configurable model selection (sonnet, opus, or full model names)
110
+ - Auto-instruction prepending
111
+ - Tool access control
112
+ - Permission mode configuration
113
+ - JSON output support
114
+ - Verbose mode for debugging
115
+ - Conversation continuation support
116
+
117
+ #### Usage
118
+
119
+ ```bash
120
+ # Basic usage with inline prompt
121
+ ~/.juno_code/services/claude.py -p "Write a hello world function"
122
+
123
+ # Using a prompt file
124
+ ~/.juno_code/services/claude.py -pp /path/to/prompt.txt
125
+
126
+ # Specify project directory
127
+ ~/.juno_code/services/claude.py -p "Add tests" --cd /path/to/project
128
+
129
+ # Override default model
130
+ ~/.juno_code/services/claude.py -p "Refactor code" -m claude-opus-4-20250514
131
+
132
+ # Use model aliases
133
+ ~/.juno_code/services/claude.py -p "Fix bugs" -m sonnet
134
+
135
+ # Custom auto-instruction
136
+ ~/.juno_code/services/claude.py -p "Fix bugs" --auto-instruction "You are a debugging expert"
137
+
138
+ # Specify allowed tools
139
+ ~/.juno_code/services/claude.py -p "Write code" --tool Bash --tool Edit --tool Write
140
+
141
+ # Change permission mode
142
+ ~/.juno_code/services/claude.py -p "Review code" --permission-mode plan
143
+
144
+ # Continue previous conversation
145
+ ~/.juno_code/services/claude.py -p "Continue working" --continue
146
+
147
+ # Enable verbose output
148
+ ~/.juno_code/services/claude.py -p "Analyze code" --verbose
149
+
150
+ # JSON output
151
+ ~/.juno_code/services/claude.py -p "Generate function" --json
152
+ ```
153
+
154
+ #### Arguments
155
+
156
+ - `-p, --prompt <text>`: Prompt text to send to claude (required, mutually exclusive with --prompt-file)
157
+ - `-pp, --prompt-file <path>`: Path to file containing the prompt (required, mutually exclusive with --prompt)
158
+ - `--cd <path>`: Project path (absolute path). Default: current directory
159
+ - `-m, --model <name>`: Model name (e.g. 'sonnet', 'opus', or full name). Default: claude-sonnet-4-20250514
160
+ - `--auto-instruction <text>`: Auto instruction to prepend to prompt
161
+ - `--tool <name>`: Allowed tools (can be used multiple times, e.g. 'Bash' 'Edit')
162
+ - `--permission-mode <mode>`: Permission mode: acceptEdits, bypassPermissions, default, or plan. Default: bypassPermissions
163
+ - `--json`: Output in JSON format
164
+ - `--verbose`: Enable verbose output
165
+ - `-c, --continue`: Continue the most recent conversation
166
+ - `--additional-args <args>`: Additional claude arguments as a space-separated string
167
+
168
+ #### Default Configuration
169
+
170
+ The script comes with these default allowed tools:
171
+ - Read, Write, Edit, MultiEdit
172
+ - Bash, Glob, Grep
173
+ - WebFetch, WebSearch
174
+ - TodoWrite
175
+
176
+ You can override these by providing the `--tool` argument:
177
+
178
+ ```bash
179
+ # Use only specific tools
180
+ ~/.juno_code/services/claude.py -p "Safe operation" --tool Read --tool Write
181
+ ```
182
+
183
+ ## Customization
184
+
185
+ All service scripts installed in `~/.juno_code/services/` can be modified to suit your needs. This directory is designed for user customization.
186
+
187
+ ### Adding Custom Services
188
+
189
+ You can add your own service scripts to `~/.juno_code/services/`:
190
+
191
+ 1. Create a new Python script (e.g., `my-service.py`)
192
+ 2. Make it executable: `chmod +x ~/.juno_code/services/my-service.py`
193
+ 3. Use it from anywhere: `~/.juno_code/services/my-service.py`
194
+
195
+ ### Service Script Template
196
+
197
+ Here's a basic template for creating your own service:
198
+
199
+ ```python
200
+ #!/usr/bin/env python3
201
+ """
202
+ My Custom Service
203
+ Description of what this service does
204
+ """
205
+
206
+ import argparse
207
+ import subprocess
208
+ import sys
209
+
210
+ def main():
211
+ parser = argparse.ArgumentParser(description="My Custom Service")
212
+ parser.add_argument('-p', '--prompt', required=True, help='Prompt text')
213
+ parser.add_argument('--cd', default='.', help='Working directory')
214
+
215
+ args = parser.parse_args()
216
+
217
+ # Your service logic here
218
+ print(f"Processing: {args.prompt}")
219
+
220
+ return 0
221
+
222
+ if __name__ == "__main__":
223
+ sys.exit(main())
224
+ ```
225
+
226
+ ## Future Extensions
227
+
228
+ These service scripts are part of juno-code's extensibility model. In future versions, you'll be able to:
229
+
230
+ - Use these scripts as alternative backends for juno-code subagents
231
+ - Create custom subagent implementations without MCP server dependency
232
+ - Share and install community-created service scripts
233
+ - Integrate with other AI coding tools and CLIs
234
+
235
+ ## Requirements
236
+
237
+ Service scripts require Python 3.6+ to be installed on your system. Individual services may have additional requirements:
238
+
239
+ - **codex.py**: Requires OpenAI Codex CLI to be installed
240
+ - **claude.py**: Requires Anthropic Claude CLI to be installed (see https://docs.anthropic.com/en/docs/agents-and-tools/claude-code)
241
+
242
+ ## Troubleshooting
243
+
244
+ ### Services not found
245
+
246
+ If services are not installed, run:
247
+
248
+ ```bash
249
+ juno-code services install
250
+ ```
251
+
252
+ ### Permission denied
253
+
254
+ Make sure scripts are executable:
255
+
256
+ ```bash
257
+ chmod +x ~/.juno_code/services/*.py
258
+ ```
259
+
260
+ ### Python not found
261
+
262
+ Ensure Python 3 is installed and available in your PATH:
263
+
264
+ ```bash
265
+ python3 --version
266
+ ```
267
+
268
+ ## Support
269
+
270
+ For issues or feature requests related to service scripts, please visit:
271
+ https://github.com/owner/juno-code/issues