Skip to content

feat(refacto-p3): quoted env prefix + inline regex cleanup + routing docs#916

Open
aeppling wants to merge 1 commit intorefacto-files-and-constantsfrom
refacto-rewrite-flow
Open

feat(refacto-p3): quoted env prefix + inline regex cleanup + routing docs#916
aeppling wants to merge 1 commit intorefacto-files-and-constantsfrom
refacto-rewrite-flow

Conversation

@aeppling
Copy link
Copy Markdown
Contributor

Summary

  • ENV_PREFIX now handles FOO="bar baz", FOO='val', escaped quotes
  • Move 6 inline lazy_static regex to module level
  • Merge rewrite_head_numeric + rewrite_tail_lines → rewrite_line_range
  • Consolidate head/tail call sites in rewrite_segment
  • Add rewrite pipeline documentation to TECHNICAL.md
  • Rewrite discover README as concept/flow documentation
  • Add lexer-based tokenizer for shell command parsing

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test — 1219 passed, 1 pre-existing dotnet skip (WSL2 timestamp granularity)
  • Release binary build: cargo build --release
  • 30 real-world rewrite tests: basic commands (git status, cargo test, gh pr view, pnpm list, docker ps, kubectl get, curl, ls, grep, find)
  • 25 complex compound commands: chained &&/||/;, pipes with grep/head/tail, redirects 2>&1/>/dev/null, quoted operators inside strings (git commit -m "fix
    && update")
  • 10 ENV_PREFIX edge cases: FOO="bar baz" git status, FOO='val' git status, A="x y" B=1 sudo git status, FOO="he said "hello"" git status,
    RTK_DISABLED=1 git status, POSIX 'it'''s' (correctly rejected as 3 tokens)
  • Head/tail rewrites: head -20 file, head --lines=10 file, tail -5 file, tail -n 10 file, tail --lines=20 file, tail --lines 15 file — all produce correct
    rtk read output
  • Guard checks: cat file > out (skip — write op), gh pr list --json (skip — structured output), find . -name "*.rs" | xargs grep (skip — pipe consumer)
  • All 12 existing head/tail/cat snapshot tests unchanged

- ENV_PREFIX now handles FOO="bar baz", FOO='val', escaped quotes
- Move 6 inline lazy_static regex to module level
- Merge rewrite_head_numeric + rewrite_tail_lines → rewrite_line_range
- Consolidate head/tail call sites in rewrite_segment
- Add rewrite pipeline documentation to TECHNICAL.md
- Rewrite discover README as concept/flow documentation
- Add lexer-based tokenizer for shell command parsing

Co-Authored-By: Andrew Hundt <ATHundt@gmail.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