feat(cli): --safe-eval first-run sandbox profile (#60)#208
Merged
Conversation
Adds the safe-evaluation profile requested in issue #60. A single flag (or env var) layers a conservative sandbox on top of any other flags so users can evaluate jcode before pointing it at their main machine, primary credentials, or sensitive repositories. Behavior: jcode --safe-eval run "say hello" JCODE_SAFE_EVAL=1 jcode run "..." Translated at startup into env overrides: JCODE_HOME=~/.jcode-safe-eval/ (only when not already set) JCODE_OFFLINE=1 JCODE_NO_TELEMETRY=1 JCODE_AMBIENT_DISABLED=1 JCODE_NO_SELFDEV=1 Each of those env vars is honored by existing code paths today — JCODE_HOME by storage::jcode_dir, JCODE_OFFLINE by issue #24's runtime gates, JCODE_NO_TELEMETRY by telemetry::is_enabled, JCODE_AMBIENT_DISABLED by the ambient runner, JCODE_NO_SELFDEV by the selfdev autodetect. So this PR is a thin coordination layer + a banner + documentation, not a parallel reimplementation. A short banner is printed at startup so users can confirm the profile took effect (suppressed by --quiet). docs/SAFE_EVALUATION.md walks through what's disabled, what isn't, the recommended first-run workflow, and how to compose with other flags. Cleanup is a single `rm -rf ~/.jcode-safe-eval`. Closes #60
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the safe-evaluation profile requested in issue #60. A single flag (or env var) layers a conservative sandbox on top of any other flags so users can evaluate jcode before pointing it at their main machine, primary credentials, or sensitive repositories.
Usage
What it does
Translated at startup into env overrides (each one already honored by existing code paths in master, so this PR is a thin coordination layer + banner + docs, not a parallel reimplementation):
JCODE_HOME=~/.jcode-safe-eval/(only if not already set)storage::jcode_dirJCODE_OFFLINE=1JCODE_NO_TELEMETRY=1telemetry::is_enabledJCODE_AMBIENT_DISABLED=1JCODE_NO_SELFDEV=1A short banner is printed at startup so users can confirm the profile took effect (suppressed by
--quiet):Changes
--safe-evalglobal flag.parse_and_prepare_argstranslates the flag (and pre-existingJCODE_SAFE_EVAL=1env) into the 5 coordinated env vars.rm -rf ~/.jcode-safe-eval), and how to compose with other flags.Tests
cargo check -p jcode --libclean. The behavior is purely env-var translation; the downstream effects each have their own existing tests (seeupdate::tests::check_for_update_blocking_returns_none_in_offline_modeetc.).Closes #60