Commit Graph

1035 Commits

Author SHA1 Message Date
aesoft 5a149a7fdb Merge pull request #2092 from rtk-ai/fix/cicd/mit-to-apache
fix(cicd): MIT to Apache 2.0
dev-0.43.0-rc.245
2026-05-25 21:47:15 +02:00
aesoft e132896d3f fix(cicd): MIT to Apache 2.0 2026-05-25 21:42:07 +02:00
Nicolas Le Cam 39f044efd8 fix(hook): collapse bash line continuations before matching (#1572)
Fixes #1564
dev-0.43.0-rc.244
2026-05-25 15:33:51 +02:00
Nicolas Le Cam 3c356b3241 fix: remove remaining noise and rework comments 2026-05-25 15:24:19 +02:00
Nicolas Le Cam 6e76f911d6 fix(ls): preserve permission info as octal when -l/-la is passed (#1675) dev-0.43.0-rc.243 2026-05-25 15:17:15 +02:00
Sai Asish Y 0ec99de8f4 fix(tests): use rewrite_command_no_prefixes in line-continuation tests
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
2026-05-25 06:16:18 -07:00
Sai Asish Y 42ac86ce2f fix(hook): use maintainer regex suggestion for line continuation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
2026-05-25 06:14:28 -07:00
Nicolas Le Cam 8fcc0dc56c fix: handle GNU --format=long and --format=verbose long args 2026-05-25 14:55:32 +02:00
Nicolas Le Cam 8e04ac4212 fix(grep): parse single-file output containing colons (#1554) dev-0.43.0-rc.242 2026-05-25 14:37:35 +02:00
Nicolas Le Cam 53b5e79561 feat: prefer short args and cleanup comments 2026-05-25 14:12:16 +02:00
Ryan A 6c4dfc727a fix(ls): preserve permission info as octal when -l/-la is passed
Closes #1672

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 12:46:23 +01:00
aesoft 4c099e4b5f Merge pull request #2084 from rtk-ai/fix/docs/mit-to-apache-remaining
fix(docs): replace remaining MIT license references with Apache 2.0
dev-0.42.1-rc.241
2026-05-25 13:38:11 +02:00
Adrien Eppling 9bbc7bb79e fix(docs): replace remaining MIT license references with Apache 2.0 2026-05-25 12:13:43 +02:00
aesoft fa11c6c3eb Merge pull request #2082 from rtk-ai/fix/pkg/MIT-to-apache-2
fix(pkg): rtk is Apache 2.0 and no MIT
dev-0.42.1-rc.240
2026-05-25 10:15:22 +02:00
aesoft 1875945bf3 fix(pkg): rtk is Apache 2.0 and no MIT 2026-05-25 09:42:06 +02:00
SAY-5 2543be5912 fix(hook): collapse bash line continuations before matching (#1564)
Closes #1564.

`rtk hook check` rejected commands that began with a bash line
continuation (`\<NL>`) because the matcher saw the literal `\`
as the first token and bailed out:

    $ rtk hook check $'\\\ngit diff HEAD~1'
    No rewrite for: \\ngit diff HEAD~1

Bash collapses `\<NL>` (and `\<CRLF>`) plus surrounding horizontal
whitespace to a single space before dispatching the command, so
the matcher should do the same. Internal continuations (e.g.
`git diff \<NL>HEAD~1`) are equally common when Claude Code
formats long invocations.

Add a small `collapse_line_continuations` helper that runs a
single regex over the input before `cmd.trim()`. The regex eats
the trailing whitespace on the previous line and the leading
indentation on the next line so the no-double-space invariant
holds. The fast path returns `Cow::Borrowed` when no continuation
is present, so commands without `\<NL>` allocate nothing.

Six regression tests pin: leading \\<NL\>, leading \\<CRLF\>, internal
\\<NL\> between subcommand and args, \\<NL\> followed by indentation,
the no-op fast path, and the helper-level Cow::Borrowed contract.
2026-05-24 20:17:31 -07:00
F0rty-Tw0 0e3a6f4830 fix(grep): NUL-separate file from line:content per review
- rg: switch to `-nH --null` for robust file/content separation
- grep fallback: switch to `-rnHZ` to match rg's --null contract
- Parser regex: `^([^\x00]+)\x00(\d+):(.*)$` so filenames or content
  containing `:digits:` (e.g. `badly_named:52:file.txt`,
  `debug: counter is :42: now`) can no longer fool the parser
- Use `Captures::extract` for cleaner destructuring

Adds tests for the badly-named-filename and digit-colons-in-content
cases; updates existing tests to use NUL-separated fixtures.

Addresses review on #1554.

Signed-off-by: Artiom Tofan <arto@queue-it.com>
2026-05-23 22:57:35 +02:00
F0rty-Tw0 be226d4f1d fix(grep): parse single-file output containing colons
Single-file `rtk grep` returned synthetic `[file] N` buckets when a
matching line contained `:`. ripgrep emits `<line>:<content>` for
single-file searches; the parser used `splitn(3, ':')` length to
disambiguate, which fails when content has `:` (e.g. `Foo::bar(...)`).

Force `--with-filename` on rg (`-H` on the grep fallback) so output is
always `file:line:content`, and replace the inline parser with a
regex-based `parse_match_line` that also handles paths with embedded
`:` (Windows drive letters).

Fixes the parser/rendering portion of #1436. The BRE-translation
portion is addressed in a follow-up PR.

Signed-off-by: Artiom Tofan <arto@queue-it.com>
2026-05-23 22:30:31 +02:00
aesoft 805caf7d06 Merge pull request #1741 from gitbluf/develop
feat(hook): add pi support
dev-0.42.0-rc.237
2026-05-23 10:46:03 +02:00
aesoft 26c88907d9 Merge pull request #2015 from okwn/contrib/rtk/git-log-merge-fix
fix: honor explicit -n N limit for git log on merge commits
dev-0.41.1-rc.236
2026-05-23 10:11:11 +02:00
gitbluf f6a54518bd chore: minor cleanup 2026-05-23 01:58:47 +02:00
gitbluf 8bc8b46384 chore: sync with pi api 2026-05-23 01:57:37 +02:00
gitbluf 9bd6e6f392 feat: address pr suggestions 2026-05-23 01:36:07 +02:00
aesoft 8564ddc79a Merge pull request #2040 from rtk-ai/fix/review-1879-git-status-doc-test
docs(git): sync status README with --porcelain -b
dev-0.41.0-rc.233
2026-05-22 17:56:37 +02:00
Adrien Eppling 6e6efd4dd1 docs(git): sync status README with --porcelain -b (drop -uall) 2026-05-22 17:55:56 +02:00
aesoft f431fb9521 Update git.rs 2026-05-22 15:30:14 +02:00
aesoft 06476d17cb Merge pull request #2035 from rtk-ai/fix/git-status-uall
fix(git): drop -uall from compact status so output never exceeds raw
dev-0.41.0-rc.232
2026-05-22 11:51:53 +02:00
Adrien Eppling 7753e487b3 fix(git): drop -uall from compact status so output never exceeds raw
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
#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 (#991 case): unchanged at +58%, all 17 shown, 0 overflow markers

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 10:13:00 +02:00
aesoft 7d31049c88 Merge pull request #2020 from rtk-ai/master
sync
dev-0.41.0-rc.231
2026-05-21 17:29:21 +02:00
aesoft 1e5623573d Merge pull request #1998 from rtk-ai/fix/tee-hint-trunc-quality
refacto(truncations): Set global CAPS for truncation
dev-0.41.0-rc.230
2026-05-21 13:47:36 +02:00
gitbluf a6844dc7ef chore: regroup agent init tests by agent section 2026-05-21 13:15:51 +02:00
Marko Petrovic 4b905c5c2d Merge branch 'develop' into develop 2026-05-21 12:59:24 +02:00
okwn b3adcb18ef fix: honor explicit -n N limit for git log on merge commits
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/rtk#2009.
2026-05-21 10:16:09 +00:00
aesoft d5a17315c5 fix(truncate): global caps reduce (avoid underflow and 0 results)
- 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.
2026-05-21 11:24:16 +02:00
aesoft 9c80934dab Merge branch 'develop' into fix/tee-hint-trunc-quality 2026-05-21 10:27:00 +02:00
aesoft a04aa7e848 Merge pull request #1976 from YOMXXX/fix/copilot-instructions-preserve
fix(hooks/init): preserve user content in copilot-instructions.md
dev-0.41.0-rc.229
2026-05-20 22:49:34 +02:00
李冠辰 35a540c34b refactor(hooks/init): share write_rtk_block, unify malformed handling
Address review feedback on #1976:

- Extract write_rtk_block() shared dispatcher: eliminates the duplicated
  4-arm RtkBlockUpsert match between run_claude_md_mode and the former
  upsert_copilot_instructions (now inlined). Both callers stay under the
  ~60-line guideline.
- Unify malformed handling: both paths now bail!() with a diagnostic and
  the exact recovery command. CLAUDE.md previously warned and exited 0,
  silently skipping the OpenCode plugin step; behaviour is now consistent.
- Reorder run_copilot_at: upsert copilot-instructions.md BEFORE writing
  the hook config so a malformed file aborts the install without leaving
  a stale .github/hooks/rtk-rewrite.json on disk.

Regression coverage:
- test_claude_md_mode_refuses_malformed_block mirrors the existing
  copilot malformed test against the shared dispatcher contract.
- test_copilot_init_malformed_leaves_no_hook_on_disk pins the new write
  order so a future re-order regression is caught.

cargo fmt / clippy --all-targets / test --bin rtk: clean (1909 passed).
2026-05-21 00:46:58 +08:00
aesoft 6a578214bd Merge pull request #1997 from tylerezimmerman/fix/readme-license-apache-2.0
docs(readme): fix license references to match LICENSE (Apache-2.0)
dev-0.41.0-rc.228
2026-05-20 17:32:29 +02:00
aesoft b6054a5fef refacto(truncations): Set global CAPS for truncation
Following tee and hint refacto
Add global CAP constant to be inherited , to enable easier global configuration later
2026-05-20 17:29:14 +02:00
Tylere Zimmerman f2864eb8a9 docs(readme): fix license references to match LICENSE (Apache-2.0)
The README badge and footer claimed MIT, but the LICENSE file is
Apache License 2.0. Updates both references so the README matches
the authoritative LICENSE file.

Closes #1996

Co-Authored-By: Claude <noreply@anthropic.com>
2026-05-20 08:34:17 -05:00
李冠辰 194a1b4215 refactor(hooks/init): extract run_copilot_at for parallel-safe tests
run_copilot(ctx) is now a thin wrapper around run_copilot_at(base, ctx);
tests pass a TempDir path so they no longer mutate process-global cwd.
This eliminates flakes when cargo test runs in parallel (the default).

The public API is unchanged; only the internal seam moves.

Refs #1964
2026-05-20 12:18:52 +08:00
李冠辰 544a5f446b test(hooks/init): cover idempotency, stale-block, dry-run, fresh, malformed paths
Adds five additional tests around copilot-instructions.md upsert:
- idempotent re-init (no duplicated blocks, identical content)
- stale RTK block in-place update with surrounding user content preserved
- dry-run never creates or modifies the file
- fresh install creates file with RTK marker block when no file exists
- malformed pre-existing block (opening marker without closing) is
  refused with a clear error rather than silently rewritten

Refs #1964
2026-05-20 12:15:51 +08:00
李冠辰 d10816516b fix(hooks/init): preserve user content in copilot-instructions.md
run_copilot() previously called write_if_changed() which truncated any
pre-existing .github/copilot-instructions.md, destroying user-authored
Copilot rules.

This routes copilot-instructions.md through upsert_rtk_block() (the
same idempotent marker-block helper already used for CLAUDE.md and
AGENTS.md). The COPILOT_INSTRUCTIONS constant is wrapped in
<!-- rtk-instructions v2 --> ... <!-- /rtk-instructions --> markers
so subsequent inits replace only RTK-owned content; the rest of the
file is preserved verbatim. Malformed pre-existing blocks (opening
marker without closing) are refused with a remediation message
rather than silently rewritten.

Fixes #1964, #1891
2026-05-20 12:15:05 +08:00
李冠辰 2241428673 test(hooks/init): add red test for copilot-instructions preservation
Adds a TDD red test that asserts pre-existing user content in
.github/copilot-instructions.md must survive 'rtk init --copilot'.
Currently fails because run_copilot() uses write_if_changed() which
truncates the file.

Refs #1964
2026-05-20 12:13:45 +08:00
aesoft 15a0d2e7d6 Merge pull request #1928 from rtk-ai/fix/tee-hint-trunc-quality
fix(tee): safe truncation caps and tee/hint coverage
dev-0.41.0-rc.227
2026-05-19 11:37:48 +02:00
aesoft 4acdcf29f7 docs(cmds): truncations hints and recovery guidelines 2026-05-19 10:23:04 +02:00
aesoft 49606303d6 fix(rust): multi-line blocks used with tail hint 2026-05-19 10:23:03 +02:00
Adrien Eppling 548e4dd995 fix(tee): safe truncation caps and compose-ps tee content fix
Replace all bare magic offset literals (e.g. 21 for cap=20) with named
constants (MAX_XXX + 1) so offsets stay in sync if caps change.
Fix compose_ps to tee pre-formatted lines instead of raw tab-separated
input, so tail -n +N gives the agent readable content.
All 13 affected modules updated: container, dotnet, gh, glab, go, lint,
pnpm, pytest, rubocop, cargo, aws. 1884 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 10:23:01 +02:00
aesoft 90c285c380 Merge pull request #1895 from rtk-ai/fix/aggressive-filters-batch
fix(filters): aggresivity batch fix
dev-0.41.0-rc.226
2026-05-19 09:15:39 +02:00
gitbluf 64ed4f8550 fix(init): honor dry-run for Pi install and uninstall paths 2026-05-18 21:10:48 +02:00