this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

morey

+280 -4
+8
.devcontainer/Dockerfile
··· 25 25 jq \ 26 26 nano \ 27 27 vim \ 28 + locales \ 28 29 && apt-get clean && rm -rf /var/lib/apt/lists/* 30 + 31 + # Configure locales 32 + RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \ 33 + locale-gen 34 + ENV LANG en_US.UTF-8 35 + ENV LANGUAGE en_US:en 36 + ENV LC_ALL en_US.UTF-8 29 37 30 38 # Ensure default node user has access to /usr/local/share 31 39 RUN mkdir -p /usr/local/share/npm-global && \
+4 -2
.devcontainer/devcontainer.json
··· 18 18 "extensions": [ 19 19 "dbaeumer.vscode-eslint", 20 20 "esbenp.prettier-vscode", 21 - "eamodio.gitlens" 21 + "eamodio.gitlens", 22 + "ocamllabs.ocaml-platform" 22 23 ], 23 24 "settings": { 24 25 "editor.formatOnSave": true, ··· 43 44 "mounts": [ 44 45 "source=claude-code-bashhistory-${devcontainerId},target=/commandhistory,type=volume", 45 46 "source=claude-code-config-${devcontainerId},target=/home/node/.claude,type=volume", 46 - "source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,type=bind,readonly" 47 + "source=${localEnv:HOME}/.ssh,target=/home/node/.ssh,type=bind,readonly", 48 + "source=${localWorkspaceFolder}/.slopper,target=/home/node/.slopper,type=bind" 47 49 ], 48 50 "containerEnv": { 49 51 "NODE_OPTIONS": "--max-old-space-size=4096",
+268 -2
slopper
··· 24 24 LOG_DIR="${HOME}/.slopper/logs" 25 25 LOG_FILE="${LOG_DIR}/slopper-$(date +%Y%m%d).log" 26 26 WORKSPACE="${SLOPPER_WORKSPACE:-$(pwd)}" 27 + # For OCaml mode, use workspace-local .slopper directory to work with container mount 28 + HISTORY_DIR="${WORKSPACE}/.slopper/history" 27 29 FORCE_REBUILD=false 28 30 QUIET=false 29 31 MODE="" 30 32 EXEC_PROMPT="" 31 33 32 - # Ensure log directory exists 34 + # Ensure log and history directories exist 33 35 mkdir -p "${LOG_DIR}" 36 + mkdir -p "${HISTORY_DIR}" 34 37 35 38 # Logging function 36 39 log() { ··· 261 264 exit $exit_code 262 265 } 263 266 267 + # OCaml mode - interactive shell with history logging and Claude integration 268 + mode_ocaml() { 269 + log INFO "Running OCaml development mode with history logging" 270 + 271 + check_devcontainer_cli 272 + ensure_devcontainer 273 + 274 + # Create session ID and file paths 275 + local session_id="ocaml-$(date +%Y%m%d-%H%M%S)" 276 + local typescript_file="${HISTORY_DIR}/${session_id}.typescript" 277 + local clean_log="${HISTORY_DIR}/${session_id}.log" 278 + 279 + log INFO "Starting OCaml development session: $session_id" 280 + log INFO "Session will be recorded to: $typescript_file" 281 + 282 + # Create session recording script 283 + local tracker_script=$(mktemp) 284 + cat > "$tracker_script" << 'EOF' 285 + #!/bin/bash 286 + 287 + # OCaml development session with complete recording using script 288 + SESSION_ID="$1" 289 + TYPESCRIPT_FILE="$2" 290 + CLEAN_LOG="$3" 291 + 292 + echo "=== OCaml Development Session Started ===" 293 + echo "Session ID: $SESSION_ID" 294 + echo "Timestamp: $(date)" 295 + echo "Workspace: $(pwd)" 296 + echo "" 297 + 298 + # Check OCaml installation 299 + if command -v ocaml >/dev/null 2>&1; then 300 + echo "OCaml version: $(ocaml -version)" 301 + else 302 + echo "Note: OCaml not found - you may need to install it" 303 + fi 304 + 305 + if command -v opam >/dev/null 2>&1; then 306 + echo "OPAM version: $(opam --version)" 307 + echo "Current switch: $(opam switch show 2>/dev/null || echo 'none')" 308 + else 309 + echo "Note: OPAM not found - you may need to install it" 310 + fi 311 + 312 + echo "" 313 + echo "OCaml Development Environment Ready!" 314 + echo "- Complete session recording enabled" 315 + echo "- Session ID: $SESSION_ID" 316 + echo "- Type 'exit' when done to process with Claude" 317 + echo "" 318 + 319 + # Record the entire interactive session using script 320 + # -f: flush output immediately 321 + # -q: quiet mode (don't show start/stop messages) 322 + script -f -q "$TYPESCRIPT_FILE" -c "bash --login -i" 323 + 324 + echo "" 325 + echo "=== OCaml Development Session Ended ===" 326 + echo "Timestamp: $(date)" 327 + 328 + # Clean the typescript file to remove colors and control sequences 329 + if command -v col >/dev/null 2>&1; then 330 + echo "Cleaning session log..." 331 + cat "$TYPESCRIPT_FILE" | col -b > "$CLEAN_LOG" 332 + echo "Clean session log saved to: $CLEAN_LOG" 333 + else 334 + echo "Warning: 'col' command not found, using raw typescript" 335 + cp "$TYPESCRIPT_FILE" "$CLEAN_LOG" 336 + fi 337 + EOF 338 + 339 + chmod +x "$tracker_script" 340 + 341 + # Ensure the history directory exists in the container first 342 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 343 + mkdir -p "/home/node/.slopper/history" 344 + 345 + # Copy tracker script to container and run the tracked session 346 + local container_script="/tmp/tracker_script.sh" 347 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 348 + bash -c "cat > '$container_script' << 'EOF' 349 + $(cat "$tracker_script") 350 + EOF" 351 + 352 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 353 + chmod +x "$container_script" 354 + 355 + # Run with container paths for the session files 356 + local container_typescript="/home/node/.slopper/history/${session_id}.typescript" 357 + local container_clean_log="/home/node/.slopper/history/${session_id}.log" 358 + 359 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 360 + bash "$container_script" "$session_id" "$container_typescript" "$container_clean_log" 361 + 362 + local exit_code=$? 363 + 364 + # Clean up tracker script 365 + rm -f "$tracker_script" 366 + 367 + log INFO "OCaml session ended. Processing with Claude..." 368 + 369 + # Check if we have session data to process (files are accessible via the mount) 370 + if [ -f "$clean_log" ] && [ -s "$clean_log" ]; then 371 + process_ocaml_session_with_claude "$session_id" "$typescript_file" "$clean_log" 372 + else 373 + log WARN "No session data captured, skipping Claude processing" 374 + fi 375 + 376 + stop_devcontainer 377 + 378 + if [ $exit_code -eq 0 ]; then 379 + log INFO "OCaml development session completed successfully" 380 + else 381 + log WARN "OCaml development session ended with exit code: $exit_code" 382 + fi 383 + 384 + exit $exit_code 385 + } 386 + 387 + # Function to process OCaml session with Claude 388 + process_ocaml_session_with_claude() { 389 + local session_id="$1" 390 + local typescript_file="$2" 391 + local clean_log="$3" 392 + 393 + log INFO "Processing OCaml session $session_id with Claude..." 394 + log DEBUG "Session files - typescript: $typescript_file, clean_log: $clean_log" 395 + 396 + # Check file sizes for debugging 397 + if [ -f "$clean_log" ]; then 398 + local log_size=$(wc -l < "$clean_log" 2>/dev/null || echo "0") 399 + log DEBUG "Clean log file exists with $log_size lines" 400 + log DEBUG "First few lines of clean log:" 401 + head -10 "$clean_log" 2>/dev/null | while read line; do 402 + log DEBUG " $line" 403 + done 404 + else 405 + log WARN "Clean log file does not exist: $clean_log" 406 + return 1 407 + fi 408 + 409 + # Check if Claude is available in the devcontainer 410 + log DEBUG "Checking for Claude CLI in devcontainer..." 411 + if ! npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- which claude &>/dev/null; then 412 + log WARN "Claude CLI not found in devcontainer, skipping setup-ocaml script refinement" 413 + return 0 414 + fi 415 + log DEBUG "Claude CLI found in devcontainer" 416 + 417 + # Create analysis prompt (inside container paths) 418 + local analysis_file="/home/node/.slopper/history/${session_id}.analysis" 419 + log DEBUG "Creating analysis file: $analysis_file" 420 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 421 + bash -c "cat > '$analysis_file' << 'EOF' 422 + Please analyze this OCaml development session and help refine the setup-ocaml script. 423 + 424 + SESSION DETAILS: 425 + - Session ID: $session_id 426 + - Workspace: /workspace 427 + 428 + COMPLETE SESSION RECORDING: 429 + \$(if [ -f \"/home/node/.slopper/history/${session_id}.log\" ]; then cat \"/home/node/.slopper/history/${session_id}.log\"; else echo \"No session recording available\"; fi) 430 + 431 + CURRENT setup-ocaml.sh SCRIPT: 432 + \$(cat \"/usr/local/bin/setup-ocaml.sh\") 433 + 434 + TASK: 435 + Based on the complete session recording above, please analyze my OCaml development workflow and suggest improvements to the setup-ocaml.sh script. Focus on: 436 + 437 + 1. Any missing dependencies or tools that were needed during the session 438 + 2. Additional opam packages that should be pre-installed 439 + 3. Environment setup that could be automated 440 + 4. Common development patterns that could be scripted 441 + 5. Any pins or specific package versions that were useful 442 + 6. Error patterns that suggest missing configurations 443 + 444 + The session recording shows everything I typed and all output, so you can see the complete workflow including any errors, installations, or manual setup steps. 445 + 446 + Please provide specific, actionable improvements that would make OCaml development setup more efficient. In particular, pay attention to the .devcontainer files. 447 + EOF'" 448 + 449 + log DEBUG "Analysis file created, verifying it exists..." 450 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 451 + bash -c "if [ -f '$analysis_file' ]; then echo 'Analysis file exists, size:' \$(wc -c < '$analysis_file'); else echo 'Analysis file missing!'; fi" || log WARN "Failed to verify analysis file" 452 + 453 + log INFO "Sending session analysis to Claude..." 454 + 455 + # Run Claude analysis inside the devcontainer 456 + # Since .slopper/history is bind-mounted, write directly to /workspace/.slopper/history 457 + local claude_output_container="/workspace/.slopper/history/${session_id}.claude-suggestions" 458 + local claude_output_host="${HISTORY_DIR}/${session_id}.claude-suggestions" 459 + 460 + log DEBUG "Running Claude with analysis file, output will go to: $claude_output_container (mounted path)" 461 + log DEBUG "Claude command: cd /workspace && claude -p '$analysis_file' > '$claude_output_container'" 462 + 463 + if npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 464 + bash -c "cd /workspace && claude --dangerously-skip-permissions -p '$analysis_file' > '$claude_output_container' 2>&1"; then 465 + log INFO "Claude analysis completed successfully" 466 + 467 + # Check if output file exists and has content (directly on host via mount) 468 + if [ -f "$claude_output_host" ]; then 469 + local output_size=$(wc -c < "$claude_output_host" 2>/dev/null || echo "0") 470 + log DEBUG "Claude output file size: $output_size bytes" 471 + else 472 + local output_size=0 473 + log DEBUG "Claude output file does not exist on host" 474 + fi 475 + 476 + if [ "$output_size" -gt 0 ]; then 477 + # Output is already on host via bind mount, just display it 478 + echo "" 479 + echo "=== Claude Analysis and Suggestions ===" 480 + cat "$claude_output_host" 481 + echo "" 482 + echo "Analysis saved to: $claude_output_host" 483 + else 484 + log WARN "Claude output file is empty or missing" 485 + log DEBUG "Attempting to show stderr from Claude command..." 486 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 487 + bash -c "if [ -f '$claude_output_container' ]; then cat '$claude_output_container'; else echo 'Output file does not exist'; fi" 488 + fi 489 + else 490 + local exit_code=$? 491 + log ERROR "Claude analysis failed with exit code: $exit_code" 492 + 493 + # Try to get error output 494 + if npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 495 + test -f "$claude_output_container"; then 496 + echo "Error output:" 497 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 498 + cat "$claude_output_container" 499 + else 500 + log DEBUG "No error output file found" 501 + fi 502 + 503 + # Additional debugging - check if Claude is actually available 504 + log DEBUG "Verifying Claude CLI accessibility:" 505 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 506 + bash -c "which claude; claude --version 2>&1 || echo 'Claude version check failed'" 507 + fi 508 + 509 + # Clean up analysis file (but keep it for debugging if Claude failed) 510 + if [ "$output_size" -gt 0 ] 2>/dev/null; then 511 + log DEBUG "Cleaning up analysis file (Claude succeeded)" 512 + npx @devcontainers/cli exec --workspace-folder "${WORKSPACE}" -- \ 513 + rm -f "$analysis_file" 514 + else 515 + log DEBUG "Keeping analysis file for debugging (Claude failed or produced no output)" 516 + log DEBUG "Analysis file preserved at: $analysis_file" 517 + fi 518 + } 519 + 264 520 # Help function 265 521 show_help() { 266 522 cat << EOF ··· 273 529 -e, --exec PROMPT Execute a single Claude prompt non-interactively 274 530 -s, --shell Open interactive shell in devcontainer (default) 275 531 -c, --claude Start interactive Claude session 532 + -o, --ocaml OCaml development mode with history logging 276 533 277 534 OPTIONS: 278 535 -f, --force Force rebuild devcontainer from scratch ··· 288 545 Development: 289 546 ./slopper # Quick shell into dev environment 290 547 ./slopper --claude # Interactive Claude coding session 548 + ./slopper --ocaml # OCaml dev mode with history logging 291 549 292 550 Automation: 293 551 ./slopper -e "fix the bug in main.ml" # CI/CD code fixes ··· 336 594 MODE="claude" 337 595 shift 338 596 ;; 597 + -o|--ocaml) 598 + [ -n "$MODE" ] && { log ERROR "Multiple modes specified"; exit 1; } 599 + MODE="ocaml" 600 + shift 601 + ;; 339 602 -f|--force) 340 603 FORCE_REBUILD=true 341 604 shift ··· 391 654 claude) 392 655 mode_claude 393 656 ;; 657 + ocaml) 658 + mode_ocaml 659 + ;; 394 660 *) 395 661 log ERROR "Invalid mode: $MODE" 396 662 exit 1 397 663 ;; 398 - esac 664 + esac