Skip to content

Add repo aliases, tab completion, and fix sanitize#2

Merged
ianhi merged 8 commits into
mainfrom
alias-and-sanitize
Apr 10, 2026
Merged

Add repo aliases, tab completion, and fix sanitize#2
ianhi merged 8 commits into
mainfrom
alias-and-sanitize

Conversation

@ianhi
Copy link
Copy Markdown
Collaborator

@ianhi ianhi commented Apr 10, 2026

Summary

  • Repo aliases: core-drill alias add/list/rm — save frequently-used repos as short names. Stored in config TOML. Aliases expand transparently in TUI, CLI, REPL, and MCP open tool. All CLI flags (region, anonymous, endpoint_url, arraylake_api) saved with the alias.
  • Tab completion: core-drill install-completions appends setup to your shell config. Completions include subcommands, flags, and alias names (dynamically loaded from config). Powered by clap_complete with CompleteEnv.
  • --arraylake-api shorthands: accepts dev (dev.api.earthmover.io) or prod (api.earthmover.io) in addition to full URLs.
  • Sanitize fix: strip-ansi-escapes v0.2's VTE parser eats \t and \n. Uses Unicode PUA sentinels to protect whitespace. Fixes failing nix build.
  • TUI dedup: all modes now route through single open_repo() entry point (was duplicated inline).
  • Adversarial test script: scripts/create_adversarial_repo.py generates a repo with ANSI codes, OSC sequences, null bytes, RTL overrides, 500-char names in group/array/branch/tag names and commit messages.
  • Simplify pass: fix TOCTOU in config load, reduce sanitize allocations, use dirs crate consistently.

Usage

# Aliases
core-drill alias add era5 s3://icechunk-public-data/v1/era5_weatherbench2 --anonymous
core-drill alias add dev al:myorg/myrepo --arraylake-api dev
core-drill era5

# Tab completion (one-time setup)
core-drill install-completions

Test plan

  • cargo test — all 27 tests pass (including previously-failing preserves_newlines_and_tabs)
  • cargo build — clean, zero warnings
  • Manual test: alias add/list/rm/resolve all work
  • Manual test: tab completion shows aliases, subcommands, flags
  • Manual test: adversarial repo opens without panics or terminal corruption
  • Simplify pass: TOCTOU, allocation, and consistency fixes

🤖 Generated with Claude Code

ianhi added 7 commits April 10, 2026 16:54
Store frequently-used repos as short names in
~/.config/core-drill/config.toml (XDG on Linux,
~/Library/Application Support/ on macOS). Aliases
expand transparently everywhere a repo arg is accepted
(TUI, CLI output, REPL, MCP open tool). Saved storage
overrides (region, anonymous, endpoint_url) merge with
CLI flags, with CLI taking precedence.
Python script using icechunk + zarr to create a repo with ANSI
escape codes, terminal control sequences, null bytes, RTL
overrides, and other payloads in group names, array names,
commit messages, branch names, and tag names.
The VTE parser inside strip_ansi_escapes treats \t and \n as
control actions and removes them. Use Unicode Private Use Area
sentinels to protect whitespace across the strip pass.
The TUI path had its own inline repo-opening code that bypassed
open_repo(), which meant alias resolution (and any future open
logic) didn't apply. Now all modes use the single open_repo()
entry point.
Aliases now store all CLI flags including arraylake_api, so
dev Arraylake repos can be aliased with their custom endpoint.
--arraylake-api now accepts "dev" (dev.api.earthmover.io) and
"prod" (api.earthmover.io) as shorthands. Full README section
covers alias add/list/rm with examples.
- clap_complete with unstable-dynamic for runtime completions
- CompleteEnv handles COMPLETE=<shell> env var automatically
- install-completions subcommand appends setup to shell config
- Alias names complete dynamically from config file
- dev/prod shorthands for --arraylake-api
- README docs for aliases, completions, arraylake-api shorthands
@ianhi ianhi changed the title Add repo aliases + fix sanitize tab stripping Add repo aliases, tab completion, and fix sanitize Apr 10, 2026
- config::load(): replace exists() + read_to_string() with single
  read_to_string() matching on NotFound (eliminates TOCTOU race)
- sanitize(): use &str constants for PUA sentinels instead of
  char::to_string() per call (eliminates 2 temp allocations)
- install_completions(): use dirs::home_dir() instead of
  std::env::var("HOME") for consistency with config.rs
- Remove unused PathBuf import
@ianhi ianhi merged commit 06c4c02 into main Apr 10, 2026
5 checks passed
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