Skip to content

Conversation

@ericphanson
Copy link

@ericphanson ericphanson commented Oct 13, 2025

Motivation and Context

Julia is a numerical programming language in which claude and agents struggle to correctly run tests and manage environments. This adds a bash script julia-env-info and a skill for agents to understand what environments exist and use them effectively.

How Has This Been Tested?

I developed this when struggling to get agents to run tests correctly in JuliaRegistries/RegistryCI.jl#629, and I had claude develop some test scenarios (checked in here) as part of this repo's TDD methodology.

Breaking Changes

No

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

I didn't see any existing language-specific skills so I'm not sure if this is out-of-scope for the repo but figured I'd make a PR.

Summary by CodeRabbit

  • New Features

    • Added a CLI tool that collects Julia environment details (installation presence, versions, defaults) and lists detected projects and manifests, producing ENV, PROJECTS, and MANIFESTS summaries (pretty tables when supported).
  • Documentation

    • Added a quick-start guide for activating Julia environments, running tests, managing dependencies, and troubleshooting.
    • Added detailed test-scenario docs covering workflows, example prompts, and success criteria for varied Julia testing setups.

Applied writing-skills TDD process (RED-GREEN-REFACTOR):

RED Phase - Baseline testing WITHOUT skill:
- Created 8 test scenarios (retrieval, application, gap testing)
- Documented failures: TestEnv.jl unknown, test/Project.toml missing,
  no Quick Reference, julia-env-info script unknown

GREEN Phase - Initial improvements:
- Added Overview with core principle
- Added Quick Reference table with all common commands
- Enriched when_to_use with error messages (LoadError, Manifest warnings)
- Added TestEnv.jl section for running specific tests
- Added Test-Only Dependencies with both patterns:
  * Pattern 1: test/Project.toml (modern)
  * Pattern 2: [extras] in main Project.toml
- Added Common Issues section with cause→fix format
- Added Common Mistakes table

REFACTOR Phase - Concise rewrite:
- Rewrote in concise style matching other skills
- Reduced from 1043 to 626 words (40% reduction)
- Added bold emphasis, clear numbered sections, tables
- Maintained all essential information

Verification - Re-ran all test scenarios:
✅ Scenario 1 (running tests): Found immediately, excellent scannability
✅ Scenario 4 (specific files): Correctly suggests TestEnv.jl
✅ Scenario 7 (test deps): Correctly identifies Pattern 1 vs Pattern 2

All scenarios PASS. Skill verified and ready for use.

Version: 1.0.0 → 2.0.0
@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

Walkthrough

Adds a new Bash script to collect Julia and juliaup environment details and list Project/Manifest files, plus two new documentation pages describing Julia testing workflows and structured test scenarios.

Changes

Cohort / File(s) Summary
Env inspection script
scripts/julia-env-info
New Bash script that detects julia and juliaup, parses Manifest.toml for julia_version (via awk), queries juliaup defaults without jq, generates ENV/PROJECTS/MANIFESTS TSVs, formats output with column when available, and manages temp files with cleanup.
Julia testing docs
skills/testing/julia-tests/SKILL.md, skills/testing/julia-tests/test-scenarios.md
New documentation: SKILL.md explains Julia environments, Project/Manifest handling, test dependency patterns, common troubleshooting and commands; test-scenarios.md provides 10 structured test scenarios with agent prompts and success criteria.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant S as scripts/julia-env-info
  participant FS as Filesystem
  participant JU as juliaup
  participant COL as column (optional)

  U->>S: run script
  activate S
  S->>FS: locate Project.toml / Manifest.toml files
  FS-->>S: return file paths
  S->>S: parse Manifest.toml (extract julia_version via awk)
  S->>FS: check for `julia` and `juliaup` executables
  alt juliaup present
    S->>JU: query default channel/version/file (no jq)
    JU-->>S: default info
  else juliaup absent
    S-->>S: record juliaup fields as unknown
  end
  S->>S: assemble ENV / PROJECTS / MANIFESTS TSVs (temp files)
  alt column available
    S->>COL: format TSV to aligned tables
    COL-->>S: formatted output
  else
    S-->>S: output raw TSVs
  end
  S-->>U: print ENV / PROJECTS / MANIFESTS
  deactivate S
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibble at manifests and hop through TOML trails,
I sniff juliaup channels and chase version tails.
TSV carrots stacked, temp burrows tidy and neat,
Docs for testing ready — a rabbit's small feat.
Hops, bytes, and breadcrumbs: a cozy little treat. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the main change—adding a Julia testing skill—using clear and concise language without extraneous details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f799fb0 and 64a5d17.

📒 Files selected for processing (1)
  • scripts/julia-env-info (1 hunks)
🔇 Additional comments (8)
scripts/julia-env-info (8)

1-5: Excellent strict error handling and the past critical issue is fixed!

The set -euo pipefail ensures the script fails fast on errors. The export LC_ALL=C now correctly exports the locale so child processes (awk, grep, sed) inherit it—this addresses the critical issue from the previous review.


8-18: LGTM! Clean TOML parsing with awk.

The function correctly extracts julia_version from Manifest.toml, handles whitespace and quotes, and fails gracefully if the file is missing.


21-34: Clever JSON parsing without jq, with acceptable trade-offs.

The awk pattern on line 27 uses [^}]* which will match up to the first }, potentially breaking if DefaultChannel contains nested objects. However, this is unlikely for typical juliaup output, and avoiding a jq dependency is valuable. The grep/sed extraction on lines 30-32 similarly assumes no escaped quotes in values.

If juliaup's output format evolves to include nested objects or escaped quotes, consider verifying the parsing still works correctly.


37-38: LGTM! Proper temp file management.

Using mktemp for secure temp file creation and a trap for cleanup is best practice.


40-70: Well-structured environment detection, and the past IFS issue is fixed!

The Julia and juliaup detection logic is robust with proper error handling. Line 59 now correctly sets IFS=$'\t' for the read command, ensuring file paths with spaces are handled correctly—this addresses the minor issue from the previous review.


73-77: LGTM! Robust filename handling.

Using -print0 with read -d '' correctly handles Project.toml paths containing spaces or special characters.


80-87: LGTM! Clean manifest enumeration with version extraction.

The loop correctly finds all Manifest.toml files, extracts their julia_version, and provides a sensible fallback.


90-94: LGTM! User-friendly output formatting.

The conditional use of column for table formatting with a plain TSV fallback provides a good user experience across different environments.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
skills/testing/julia-tests/test-scenarios.md (1)

1-120: Consider adding language identifiers to code blocks.

The test scenarios are well-structured with clear prompts and success criteria. However, the markdownlint tool flags multiple fenced code blocks without language identifiers (lines 7, 23, 38, 56, 76, 89, 100, 114).

While these blocks contain agent prompts rather than executable code, adding a language identifier (e.g., text or markdown) improves consistency and satisfies linting rules.

Example fix for line 7:

 ### Scenario 1: First time running Julia tests
 **Agent prompt:**
-```
+```text
 I need to run tests for this Julia project. I see there's a test/ directory with test files. How do I run them?

Apply similar changes to the other code blocks flagged by markdownlint.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08d6901 and 81fa45a.

📒 Files selected for processing (3)
  • scripts/julia-env-info (1 hunks)
  • skills/testing/julia-tests/SKILL.md (1 hunks)
  • skills/testing/julia-tests/test-scenarios.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
skills/testing/julia-tests/test-scenarios.md

7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


23-23: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


38-38: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


76-76: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


89-89: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


100-100: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


114-114: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (3)
skills/testing/julia-tests/SKILL.md (1)

1-167: Excellent comprehensive documentation!

The documentation is well-structured, clear, and actionable. It covers all essential aspects of Julia environment management and testing:

  • Clear core principles and quick reference
  • Multiple testing approaches with trade-offs
  • Test-only dependency patterns
  • Common issues with solutions
  • Environment types explained

The command examples are accurate and the troubleshooting guidance is practical.

scripts/julia-env-info (2)

5-94: Good defensive programming practices.

The script demonstrates several good practices:

  • Robust error handling with set -euo pipefail
  • Cleanup trap for temporary files
  • Graceful fallbacks when commands fail (|| true patterns)
  • Portable awk patterns for parsing
  • Conditional use of column for pretty output

21-34: Verify Juliaup JSON parsing robustness. Manual parsing with awk|grep|sed can break on reordered fields, extra whitespace/newlines, escaped quotes or nested objects. Since juliaup isn’t available here, manually run scripts/julia-env-info against diverse juliaup api getconfig1 outputs (missing or reordered fields, nested structures) and ensure it handles edge cases; consider using jq for more reliable JSON parsing.

ericphanson and others added 2 commits October 13, 2025 15:49
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
scripts/julia-env-info (1)

3-3: Resolved: LC_ALL now exported

Previous review’s locale export issue is fixed. Subprocesses will inherit the C locale.

🧹 Nitpick comments (7)
skills/testing/julia-tests/SKILL.md (4)

21-27: Augment quick reference: add --project=@. and verify Pkg.add target semantics

  • Recommend including --project=@. as a robust default that activates the nearest Project.toml up the tree.
  • Please verify whether Pkg.add("Dep"; target=:extras) is the intended guidance vs target=:test. Many users expect target=:test to both add to [extras] and include in [targets]. If sticking with :extras, add a note clarifying the follow‑up [targets] update requirement.

Would you like me to propose a small doc patch showing both patterns explicitly (test/Project.toml and extras/targets with target=:test)?


66-71: Clarify TestEnv installation scope

You advise installing TestEnv globally. Consider clarifying “install in the default (@v#.#) environment” and note the alternative of using --project=@. when invoking TestEnv to avoid accidental use of a different global env.


130-142: Add juliaup guidance for version mismatches

Along with resolve/delete, suggest documenting juliaup actions:

  • juliaup add to install the needed Julia version from the Manifest
  • juliaup override set (or juliaup default ) to match the project
    This helps align toolchains without editing the manifest.

163-167: Tighten “Stacked” explanation with LOAD_PATH note

Clarify that stacking uses LOAD_PATH = (active project, @v#.#, @StdLib). While stacking allows imports from the default env, packages should not rely on undeclared deps; recommend always declaring deps in the active project to avoid Heisenbugs.

scripts/julia-env-info (3)

75-77: Deterministic output: optionally sort paths

For stable, reproducible output across runs/CI, consider sorting results. If GNU sort -z isn’t available, fall back to unsorted to preserve portability.

Example:

-  find . -type f -name 'Project.toml' -print0 2>/dev/null \
-| while IFS= read -r -d '' p; do printf '%s\n' "$p"; done
+  if command -v sort >/dev/null 2>&1; then
+    find . -type f -name 'Project.toml' -print0 2>/dev/null \
+    | sort -z \
+    | while IFS= read -r -d '' p; do printf '%s\n' "$p"; done
+  else
+    find . -type f -name 'Project.toml' -print0 2>/dev/null \
+    | while IFS= read -r -d '' p; do printf '%s\n' "$p"; done
+  fi

Apply similarly for Manifest.toml.

Also applies to: 82-87


21-34: More robust juliaup JSON parsing when jq is available

The awk/grep approach is pragmatic; if jq is present, prefer it to reduce fragility against JSON shape changes. Keep current fallback when jq is absent.

Sketch:

if have jq; then
  juliaup api getconfig1 2>/dev/null \
  | jq -r '.DefaultChannel | select(.) | "\(.Name)\t\(.Version // "")\t\(.File // "")"'
else
  # current awk/grep/sed fallback
fi

75-77: Performance: optionally prune heavy/vendor dirs

Consider pruning common heavy dirs to speed up scans in large repos (when safe):

  • .git, .venv, node_modules, dist, build, .julia, .cache

Example:

find . -type d \( -name .git -o -name node_modules -o -name dist -o -name build -o -name .venv -o -name .julia -o -name .cache \) -prune -o -type f -name 'Project.toml' -print0

Also applies to: 82-87

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81fa45a and bd09ef0.

📒 Files selected for processing (2)
  • scripts/julia-env-info (1 hunks)
  • skills/testing/julia-tests/SKILL.md (1 hunks)
🔇 Additional comments (1)
scripts/julia-env-info (1)

36-70: Approve changes

Solid, portable baseline; ran shellcheck -S style scripts/julia-env-info with zero warnings.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
skills/testing/julia-tests/test-scenarios.md (1)

6-158: Add language labels to fenced code blocks.

Several of the fenced examples (e.g., the prompts around Line 6 and onward) are missing language identifiers, which breaks our markdownlint checks and loses syntax highlighting. Please tag each fence with the appropriate language (text, sh, etc.) so the linter passes.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd09ef0 and f799fb0.

📒 Files selected for processing (2)
  • skills/testing/julia-tests/SKILL.md (1 hunks)
  • skills/testing/julia-tests/test-scenarios.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
skills/testing/julia-tests/test-scenarios.md

7-7: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


23-23: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


38-38: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


76-76: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


89-89: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


100-100: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


114-114: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


125-125: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


143-143: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant