indexzero / indexzero/try.rs

install: offer to replace existing shell integration (interactive) + --force

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Problem

tryme install refuses when the # try shell integration marker already exists in the rc file:

try is already installed in /Users/x/.zshrc
To reinstall, remove the '# try shell integration' block first.

The installed block embeds the absolute path of the binary that ran install (resolve_self_path), so this bites on every channel switch — brew ↔ cargo ↔ dev build — and the remedy is hand-editing the rc file, which is exactly the surgery install exists to spare people. The eval "$(tryme init …)" form sidesteps it, but install should be able to maintain what it wrote.

This is upstream-inherited behavior (try.rb marker check), so shipping it is a deliberate divergence to be recorded per ADR-0003 — optionally proposed upstream first if we want the behaviors to converge, owner's call.

Proposal

Two additive changes, no change to any existing exit code or script-observable behavior (conformance suite unaffected — install has no upstream conformance test):

  1. tryme install --force — replace the marker-delimited block instead of refusing: strip from the # try shell integration line through the wrapper function it wrote, append the freshly generated block. Non-interactive-safe; second --force run is a no-op rewrite.

  2. Interactive default: prompt instead of refuse. Marker found + tty session → ask on stderr:

    try is already installed in ~/.zshrc — replace it? [y/N]
    

    N/default preserves today's behavior exactly (message + exit 0). Non-tty keeps the current refuse-with-hint unconditionally, so scripts/CI never block on a prompt. Read the answer from /dev/tty, consistent with the selector's stream discipline.

Safety

  • Replacement bounded strictly by the block install writes (marker + emitted function) — never pattern-match user-authored try functions.
  • Read-only rc files keep the existing warning + exit 1 path.
  • New --force flag joins the clap declaration + try.usage.kdl via the inventory-diff chain; hidden nothing.

Sequencing

Post-1.0 surface per ADR-0004 staging, or earlier if the owner rules the divergence in — it needs an ADR-0003 ruling-log entry either way.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the install command's marker check and resolve_self_path, then trace the clap declaration and try.usage.kdl inventory-diff chain. Read docs/adr/0003-divergence-authority.md and the ADR-0004 staging reference before deciding scope. Done means --force replaces only the generated block, interactive TTY sessions prompt, non-TTY sessions preserve refusal behavior, and existing exit codes and read-only handling remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.