Skip to content

chore: sync upstream rtk-ai/rtk v0.42.0 + keep local filter fixes - #11

Merged
ryanmurf merged 190 commits into
masterfrom
sync/upstream-v0.42
May 30, 2026
Merged

ryanmurf merged 190 commits into
masterfrom
sync/upstream-v0.42

Conversation

@ryanmurf

Copy link
Copy Markdown

Summary

Sync murphytek/rtk fork up to upstream rtk-ai/rtk v0.42.0 (was 187 commits behind), preserving murphytek's local filter bug-fixes and JVM (Gradle/Maven/Ant) command support.

Conflicts resolved (6)

Mechanical

  • Cargo.toml / .release-please-manifest.json → upstream version 0.42.0
  • CHANGELOG.md → union (release-please regenerates on next release)
  • Cargo.lock → regenerated via cargo build

Code

  • src/cmds/system/grep_cmd.rs — keep BOTH translate_bre_pipes (murphytek bare-| literal fix fix(grep): treat bare | as literal pipe (BRE), not rg alternation #6) and upstream has_format_flag; distinct functions, both referenced.
  • src/main.rs — keep ALL JVM imports: murphytek gradle_cmd/ant_cmd/mvn_cmd + upstream gradlew_cmd. All four command families have enum variants + routing in the merged body.
  • src/discover/rules.rs — semantic collision (surfaced by upstream's tests): upstream's gradle/gradlew → rtk gradlew rewrite rule supersedes murphytek's earlier → rtk gradle rule. Upstream's gradlew command (1400 LOC: Android tasks, lint/ktlint/detekt, Windows shims) is the richer, maintained path. The explicit rtk gradle subcommand is retained for direct use; only the auto-rewrite is upstream's now (the classifier is last-match-wins, so the duplicate rule had to be dropped).
  • src/cmds/jvm/stack_trim.rs — removed pre-existing dead test helper lines_of (workspace denies warnings).

Preserved murphytek fixes

(PR #10 — find UTF-8 char-boundary — remains separately open and is not part of this sync.)

Validation

  • cargo build --release ✅ → rtk 0.42.0
  • cargo test ✅ 1986 unit + 12 integration, 0 failures

🤖 Generated with Claude Code

aeppling and others added 30 commits March 7, 2026 11:23
  Core fix (src/init.rs — uninstall()):
  - Added step 3b after existing @RTK.md removal: checks for <!-- rtk-instructions marker in CLAUDE.md and removes the block
  using the existing remove_rtk_block() helper
  - Handles both artifacts in a single pass (covers edge case where both @RTK.md and the instructions block exist, e.g. after
  running both rtk init -g and rtk init -g --claude-md)
  - If CLAUDE.md becomes empty after cleanup, deletes the file

  Hardening:
  - Extracted RTK_BLOCK_START and RTK_BLOCK_END constants — all marker matching across uninstall(), upsert_rtk_block(),
  remove_rtk_block(), patch_claude_md(), and show_config() now uses these instead of duplicated string literals
  - When uninstall finds nothing to remove, prints which paths were checked to help users diagnose path issues
  - resolve_claude_dir() error message now shows %USERPROFILE% on Windows instead of $HOME

Signed-off-by: Adrien Eppling <adrien.eppling@supinfo.com>
Signed-off-by: aesoft <43991222+aeppling@users.noreply.github.com>
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
- Force LC_ALL=C so ls always outputs English month names regardless of system locale
- When no lines are parsed (e.g., non-English locale where regex fails to match),
  fall back to raw output instead of returning '(empty)'
- This prevents silent data loss for users in zh_CN/ja/ko/etc. locales
- Fixes rtk-ai#1276
…master--components--rtk

chore(master): release 0.37.0
…tk-ai#1250)

The installer previously ran `tar -xzf` on the downloaded archive with no
pre-extraction verification. A malicious mirror could ship a tarball with
`../` components or absolute paths and write files anywhere on the user's
filesystem (CWE-22).

Add a pre-extraction check that lists archive contents with `tar -tzf`
and rejects any entry whose name starts with `/` or contains a `..` path
component. The check is POSIX-compliant and adds negligible overhead for
the single-binary RTK release tarball.

Covered by scripts/test-install.sh, which exercises one safe archive
and four crafted malicious archives (leading `..`, absolute path,
mid-path `..`, trailing `..`) plus a regression guard that ensures the
check remains in install.sh.

Co-Authored-By: Claude <noreply@anthropic.com>
…tk-ai#1362)

`head -N file1 file2 ...` was rewritten to
`rtk read file1 file2 ... --max-lines N`. The capture regex was greedy
(`(.+)$`), so every file argument was folded into a single string. `rtk
read` then silently mis-handled the shape and fell through to the system
`read` builtin (`/usr/bin/read`) which rejects paths starting with `/` as
"not a valid identifier".

Tighten each head/tail regex to a single non-whitespace file argument
(`\S+$`). When >1 file is provided the regex misses, `rewrite_line_range`
returns `None`, and the command falls through to the native `head` / `tail`
binary — which already handles multi-file input with the expected
`==> name <==` banners. Same class as the cat multi-file fix in rtk-ai#989.

Added six regression tests covering the `-N`, `--lines=N`, `-n N`, and
`--lines N` variants for both `head` and `tail`.
- Move . and .. detection before date parsing (is_dotdir) for non-English locale compatibility
- Add dotdirs counter to distinguish empty dir (only . and ..) from real content that failed to parse
- Fix test_compact_empty to use real ls -la output (includes . and ..)
- Add test_compact_empty_chinese_locale for Chinese locale empty dir case
- Closes regression where fallback falsely triggered on empty directories
…master--components--rtk

chore(master): release 0.37.1
Rebased onto current develop (binary-command era). Threads dry_run
through patch_settings_json_command, migrate_old_hook_script,
install_cursor_hooks, run_kilocode_mode, run_antigravity_mode,
run_gemini, run_copilot, and uninstall.

Fixes from PR rtk-ai#1032 review:
- --uninstall --dry-run no longer deletes files (uninstall() now takes
  dry_run, every fs::remove_file / fs::write / atomic_write guarded)
- Success messages ("installed", "configured", "Restart ...") gated on
  !dry_run in run_default_mode, run_hook_only_mode, run_codex_mode,
  run_copilot, install_cursor_hooks, run_gemini
- prompt_telemetry_consent() skipped in dry-run
- integrity::store_hash() in run_gemini guarded
- KiloCode and Antigravity modes now accept dry_run
- PatchResult::WouldPatch variant added for patch_settings_json_command
- [dry-run] Nothing written. footer printed by every sub-mode
- write_if_changed uses atomic_write (not fs::write)

Added integrity::hash_path_for() public wrapper so dry-run can check
sidecar existence without the destructive remove_hash.

Tests: write_if_changed(dry_run=true) creates nothing;
run_codex_mode_with_paths(dry_run=true) creates neither RTK.md nor
AGENTS.md. 1596 tests pass, clippy clean.
…master--components--rtk

chore(master): release 0.37.2
Create Next Release PR and set up the description with fix / feat PRs and issues to be closed
- Force LC_ALL=C so ls always outputs English month names
- When zero lines parsed but directory has content, fallback to raw output
- Add is_dotdir() to distinguish empty dirs (only . and ..) from unparseable content
- Fix empty directory regression for both English and non-English locales
- Closes rtk-ai#1276
…removals

The two remove_file calls flagged by semgrep already existed pre-PR.
Wrapping them in if dry_run { print } else { remove_file } shifted
their context enough that --baseline-commit re-attributed them as new.
The rule's own message says deletion is expected in hooks/init cleanup.
Fix seems counter intuitive but it helps a lot on my machine.
Before, I had 234 errors (23%) out of 1,000 tests run; now, I only have one (0.1%)

It's not totaly fixed but it reduce error a lot and avoids having one almost every time I test a PR.

Another way to completly fix it would be to use std::fs::set_times on old.trx to set each time in the past, but it requires unstable fs_set_times feature, so I'm not sure you'll agree with that

Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
Addresses three review items from PR rtk-ai#1032:

- Bundle verbose+dry_run into a Clone+Copy InitContext struct (mirrors
  RunOptions in src/core/runner.rs). Collapses 25+ function signatures
  that already carried both fields and makes future flags one struct
  field instead of N signature changes.
- Emit "[dry-run] Nothing written." exactly once from the top-level
  run() and uninstall() exit points instead of from every sub-mode.
  Fixes the double footer when --agent cursor combined with default
  mode.
- Reject --show with --dry-run via clap conflicts_with rather than
  silently ignoring --dry-run.
- Add regression tests for run_default_mode and uninstall dry-run paths
  using the existing with_claude_dir_override scaffolding.
Adds a "Preview without writing" subsection under Step 1 covering the
--dry-run flag, -v interaction for content preview, that telemetry
consent is skipped, and the --show conflict. Required by CONTRIBUTING.md
section 4 (new features need documentation).
aeppling and others added 23 commits May 21, 2026 11:24
- Avoid underflow + 0 results caused by overwrite of global constant CAPS
- Soon user will be able to apply global configuration, this will change global CAPS and should not cause any underflow or 0 results, if overwrite sub >= CAPS -> use CAPS.
When user runs 'git log -1 --format='%H' HEAD' where HEAD is a merge
commit, rtk was adding --no-merges which filtered out the merge commit
itself and returned the second parent instead. This made 'git log -1'
return wrong SHAs for merge commits.

Fix: don't add --no-merges when user explicitly passes -n N or
--max-count=N. When a user specifies an exact count they expect exactly
that many commits, not filtered results. Also skip --no-merges if user
already passed --merges or --no-merges explicitly.

Fixes rtk-ai#2009.
refacto(truncations): Set global CAPS for truncation
The compact `git status` path ran `git status --porcelain -b -uall`. The
`-uall` flag expands fully-untracked directories into every file, while raw
`git status` collapses them (e.g. `node_modules/`). This made rtk output
larger than raw — measured ~29x on a 200-file untracked dir (5500B vs 191B) —
violating RTK's compress-or-match-raw invariant and inflating tokens.

Remove `-uall` so untracked directories collapse exactly like raw. This keeps
rtk-ai#991's actual fix intact: all modified/staged/renamed/conflict paths are still
shown with no grouped summaries or `... +N more` overflow markers (`-uall`
never affected those lines). Untracked files in partially-tracked dirs and any
paths git itself expands are still preserved by the formatter.

Measured (rtk vs raw git status):
- node_modules/ (200 files): 5500B (-2780%) -> 25B (+87% savings)
- normal (8 mod + 2 untracked): +71% -> +76%
- 17 modified (rtk-ai#991 case): unchanged at +58%, all 17 shown, 0 overflow markers

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fix(git): drop -uall from compact status so output never exceeds raw
…-doc-test

docs(git): sync status README with --porcelain -b
…master--components--rtk

chore(master): release 0.41.0
fix: honor explicit -n N limit for git log on merge commits
…master--components--rtk

chore(master): release 0.42.0
Merge upstream/master (v0.42.0, 187 commits ahead) into master, resolving:

Mechanical:
- Cargo.toml / .release-please-manifest.json: take upstream version 0.42.0
- CHANGELOG.md: union of both histories (release-please regenerates)
- Cargo.lock: regenerated via cargo build against merged Cargo.toml

Code conflicts:
- grep_cmd.rs: KEEP both murphytek translate_bre_pipes (bare-| literal fix #6)
  AND upstream has_format_flag — distinct functions, both still referenced.
- main.rs: KEEP all JVM imports — murphytek gradle_cmd/ant_cmd/mvn_cmd AND
  upstream gradlew_cmd. All four command families have enum variants + routing.
- rules.rs (semantic collision surfaced by upstream tests): upstream's
  `gradle`/`gradlew` -> `rtk gradlew` rewrite rule SUPERSEDES murphytek's earlier
  `-> rtk gradle` rule. Upstream's gradlew command (1400 LOC: Android tasks,
  lint/ktlint/detekt, Windows shims) is the richer, maintained path. The explicit
  `rtk gradle` subcommand remains for direct use; only the auto-rewrite is
  upstream's now (RegexSet is last-match-wins, so the duplicate had to go).
- stack_trim.rs: removed pre-existing dead test helper lines_of (deny-warnings).

Preserved murphytek filter fixes: grep bare-| (#6), wc filenames-with-spaces
(#8), tree director+file overmatch (#9). cargo build --release + cargo test
(1986 unit + 12 integration) both green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

👋 Thanks for the PR! It looks like this targets master, but all PRs should target the develop branch.

Please update the base branch:

  1. Click Edit at the top right of this PR
  2. Change the base branch from master to develop

See CONTRIBUTING.md for details.

tron-coord and others added 2 commits May 29, 2026 19:52
Pre-existing clippy::type_complexity on the probe_mvn_version CACHE static
(deny-warnings in CI's `cargo clippy --all-targets` gate). Extract the
(u32,u32,u32) into a VersionTriple alias per clippy's own suggestion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ryanmurf
ryanmurf merged commit 152f4e3 into master May 30, 2026
16 checks passed
@ryanmurf
ryanmurf deleted the sync/upstream-v0.42 branch May 30, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.