Commit Graph

837 Commits

Author SHA1 Message Date
aesoft 2f27d2c353 fix(cicd): more integrations tests 2026-04-27 11:25:18 +02:00
niklasmarderx 323cc3d517 refactor(discover): extract SANITIZED_CHARS constant in encode_project_path 2026-04-26 13:21:37 +02:00
niklasmarderx 73a05c3262 fix(discover): also encode '_', '\', and non-ASCII chars in project path slug
Per claude-code#24067, underscore is replaced with '-'.
Per claude-code#40946, non-ASCII characters are each replaced with '-'.
Windows backslashes follow the same rule.

Refactored encode_project_path to use chars().map() instead of
chained replace() calls for clarity.

Closes #1457
2026-04-26 13:21:37 +02:00
niklasmarderx 2d031f32e9 fix(discover): encode '.' as '-' in project path slug
Claude Code replaces both '/' and '.' with '-' when deriving a
projects-directory name from the working-directory path. rtk only
replaced '/'. For users whose path contains a dot (e.g. /Users/first.last)
the computed slug didn't match Claude's directory name, so rtk discover
found zero sessions.

Fixes #1457
2026-04-26 13:21:37 +02:00
Trevin Chow 2ad1579329 refactor(runner): drop unused run_passthrough_cmd helper
Restores src/core/runner.rs to the develop state. After a5e6bf5 moved
npx execution into npm_cmd::exec (routing through runner::run_filtered),
nothing calls run_passthrough_cmd anymore.

Addresses review feedback on PR #1458.
2026-04-26 02:16:06 +02:00
Trevin Chow 614e5629de refactor(npx): consolidate npm/npx execution in npm_cmd
Add `npm_cmd::exec` for npx and an internal `run_filtered` helper that
both `run` (npm) and `exec` (npx) share. The helper resolves the
command, applies args, honors SKIP_ENV_VALIDATION, and routes through
runner::run_filtered with the npm output filter. The npx fallback in
main.rs collapses to `npm_cmd::exec(&args, cli.verbose, cli.skip_env)?`.

Per @KuSh review on #1458.
2026-04-26 02:16:06 +02:00
Trevin Chow 4d5c2fc8a8 refactor(npx): use shared runner::run_passthrough_cmd helper
Per @KuSh's review on #1458, the generic npx passthrough arm built
its own Command + tracking::TimedExecution inline, duplicating the
logic already covered by core::runner::run_passthrough. The sticking
point was `SKIP_ENV_VALIDATION`: the existing helper takes tool +
args and builds the Command itself, so there was no seam for a
caller-supplied env var.

Add a `run_passthrough_cmd` variant that accepts a pre-built Command
and refactor the existing `run_passthrough` to delegate to it. The
npx arm now builds a Command, sets SKIP_ENV_VALIDATION when
requested, and hands it to the shared helper. This also upgrades the
npx passthrough from a raw `cmd.status()` to the shared streaming +
tracking path that pnpm_cmd already uses, so verbose logging and
telemetry stay consistent across tools.
2026-04-26 02:16:06 +02:00
Trevin Chow 2c4569caa6 fix(npx): dispatch unknown tools to npx instead of npm
The generic fallback arm of `Commands::Npx` called `npm_cmd::run`, which
executes `npm` instead of `npx`. This broke every non-routed npx
invocation. `rtk npx cowsay hello` failed with `npm error Missing
script: "cowsay"` because the rewrite hook sends `npx ...` through as
`rtk npx ...`, and `rtk npx` was then running npm.

Mirror the existing prisma generic-subcommand passthrough pattern:
resolve npx, forward all args, record a tracked passthrough, and
propagate the exit status.

Fixes #815
2026-04-26 02:16:06 +02:00
aesoft 137af04931 Merge pull request #1501 from rtk-ai/benchmark-cicd-update
fix(filters): benchmark ci update + fix stream + filter quality
2026-04-25 20:47:38 +02:00
aesoft e7ae6bf018 fix(benchmark): extract format_diff_changes + remove wrong diff test 2026-04-25 10:32:22 +02:00
aesoft 7e3690a23a fix: remove wrong cicd benchmark + npm test regex 2026-04-25 09:31:46 +02:00
aesoft 5e84e94717 fix(npm): regex match end line 2026-04-24 20:41:13 +02:00
aesoft 70b36b4dbc fix(tracking): test env path 2026-04-24 19:37:18 +02:00
aesoft 7681dafc76 fix(cicd):: no semgrep alert on sh call cicd 2026-04-24 19:04:51 +02:00
aesoft 88d9f6a0d9 fix(filters): benchmark ci update + fix stream filter quality 2026-04-24 18:54:29 +02:00
patrick szymkowiak 5e1a64180f Merge pull request #1414 from xdm67x/fix-install-api-rate-limit-fallback
fix(install): resolve version via redirect to avoid GitHub API rate limits
2026-04-23 16:45:39 +02:00
aesoft de415335ea Merge pull request #791 from BadassBison/fix/grep-false-negatives-and-truncation-annotations
fix: grep false negatives, output mangling, and truncation annotations
2026-04-22 19:49:03 +02:00
patrick szymkowiak e0702260a9 Merge pull request #1437 from binsee/fix/git-diff-branch-slash
fix(git): fix empty output when branch name contains '/' in git diff
2026-04-22 17:34:10 +02:00
aesoft 048f2f980b Merge pull request #314 from tnucera/feat/glab-support
feat(glab): add GitLab CLI (glab) command support
2026-04-21 19:59:29 +02:00
aesoft e3149cb7fb Merge pull request #1056 from vzwjustin/develop
feat(gains): add --reset flag
2026-04-21 19:00:59 +02:00
aesoft 00c5a36728 Merge pull request #1384 from rtk-ai/coding-practices-v1
docs(contributing): coding practices v1
2026-04-21 18:57:48 +02:00
aesoft 3bbbb492f3 Merge pull request #1147 from rtk-ai/fix/cicd-security-checks
feat(cicd): enforce cicd sast & package check
2026-04-21 18:53:45 +02:00
binsee 13188a88b2 fix(git): fix empty output when branch name contains '/' in git diff
Branch names containing '/' (e.g. feature/user-auth, main...feature/auth)
were incorrectly treated as file paths by the string heuristic in
normalize_diff_args, causing '--' to be injected before them and making
git treat them as pathspecs — resulting in silent empty output (exit 0).

Replace looks_like_path() with a three-tier detection strategy:
- Explicit path prefixes (. ~) → always a path, no filesystem check needed
- Contains path separator (/ \) → use filesystem existence to distinguish
  branch names (feature/auth, not on disk) from real paths (src/main.rs)
- Bare word with no separator → never inject '--', regardless of filesystem
  state (avoids misfire when a file shares a name with a branch/ref)

Introduce normalize_diff_args_impl with injectable path-checker for
testability. Update all existing tests to use mock existence checks.
Add three regression tests: branch-with-slash, range-with-slash, and
bare-word-that-exists-on-disk.

Fixes: #1431

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 00:24:32 +08:00
tnucera bc31f3f0f3 feat(glab): add GitLab CLI (glab) command support
Add token-optimized filters for glab CLI commands:
- mr list/view/create/merge/approve/diff/note/update
- issue list/view
- ci list/status/trace (strip ANSI, section markers, runner boilerplate)
- release list/view (strip SOURCES block, markdown noise)
- api passthrough
- Markdown body filtering (HTML comments, badges, blank lines)
- Graceful JSON/plain-text fallback for empty results
- -R/--repo and -g/--group flag forwarding at clap level
- resolved_command() for Windows compat
- has_output_flag() / should_passthrough_view() guards
- Rewrite rules and classify/rewrite tests for rtk discover

Adapted to post-refactoring src/cmds/git/ module structure.

Token savings: mr 87%, ci 82%, issue 80% (avg 82%)

Closes #851
2026-04-21 11:38:58 +02:00
xdm67x f67ae3bcd2 fix(install): resolve version via redirect to avoid API rate limits
The installer failed with "Failed to get latest version" when the GitHub
REST API returned 403 due to the anonymous rate limit (60 req/hour, shared
across NAT/CI). Switch the primary lookup to the `/releases/latest` 302
redirect, which doesn't count against the API quota. Keep the API call as
a fallback, and add a RTK_VERSION escape hatch for pinning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 14:30:06 +02:00
aesoft da3c432201 Merge pull request #1399 from rtk-ai/fix/windows-go-binary-hook
fix(hooks): windows use 'rtk hook claude' no fallback
2026-04-19 20:50:02 +02:00
aesoft 13a73ddfd7 fix(tests): windows regression test fix path 2026-04-19 20:34:18 +02:00
aesoft 115e44853b fix(hooks): add regression test for windows native 2026-04-19 20:17:44 +02:00
aesoft ca4c59c230 Merge pull request #1398 from rtk-ai/fix/exclude-commands-bypass
fix(discover): exclude_commands bypass for env-prefix, sub cmd + regex
2026-04-19 20:15:37 +02:00
aesoft 0e29650e11 fix(hooks): windows use 'rtk hook claude' no fallback
Removing old guards, windows can now just use the binary hook engine from 0.37

Related issues:
- Fixes #502 : rtk init --global falls back to --claude-md on Windows
- Fixes #1353 : Feature request: hook-based mode on Windows
- Partially addresses #330 : Add hooks support for Windows
- Partially addresses #913 :  Persistent "No hook installed" warning on Windows
- Partially addresses #1373 : Suppress "No hook installed" warning on Windows
- Partially addresses #682 : Config to suppress hook warning
- Related to #1248 : Windows PowerShell compatibility gaps

Supersedes community PRs:
- #1123 fix(init): enable hook installation on Windows
- #1027 fix(init): enable hook-based mode on Windows
- #809 feat: enable hook-based mode on Windows
- #452 feat: add Windows hook support for rtk init --global
- #551 feat: native cross-platform hook for Windows support
- #150 feat(hook): native cross-platform hook-rewrite command
- #1063 Feat/windows hooks
2026-04-19 15:31:52 +02:00
aesoft 0ea115bca5 fix(discover): word boundary in exclude_commands
Replace \b with ($|\s) to only match end-of-string or whitespace.

Empty string and bare "^" patterns produce regexes that match all commands, silently disabling all rewrites on a config typo. Skip
  trivial patterns with an eprintln warning.
2026-04-19 14:35:04 +02:00
aesoft 2e401ac38f fix(docs): add missing docs for exclude commands patterns 2026-04-19 13:59:03 +02:00
aesoft 42d3161872 fix(discover): exclude_commands bypass for env-prefix, sub cmd + regex
Strip env prefix (sudo, VAR=val) before exclude check so PGPASSWORD=x psql matches ["psql"]. Match against full command instead of first token so ["git push"] matches "git push origin main".

Compile exclude entries as regex so ["^curl"] works as pattern.

Invalid regex falls back to prefix match with eprintln warning.
Non-regex patterns auto-anchor with ^ and \b to prevent substring matches (e.g. "go" won't exclude "golangci-lint").
2026-04-19 13:47:17 +02:00
aesoft 176ceb4a7d Merge pull request #1310 from JBF1991/feat/curl-cmd-no-filter
Simplified `rtk curl` Filter
2026-04-18 18:35:39 +02:00
aesoft a724375650 docs(contributing): coding practices v1 2026-04-18 17:26:12 +02:00
Joshua e8a3bca5fb adding edge case comments and a constant for max response size 2026-04-18 09:51:56 -05:00
Adrien Eppling 5cd375ec1c Reapply "fix(discover): weighted savings rate per bucket, decimal already_rtk percent"
This reverts commit ea56548009.
2026-04-18 15:50:40 +02:00
Adrien Eppling ea56548009 Revert "fix(discover): weighted savings rate per bucket, decimal already_rtk percent"
This reverts commit 82c62eb893.
2026-04-18 15:29:36 +02:00
aesoft 9673727333 Merge pull request #1304 from rtk-ai/docs/adrien-review
docs: Adrien review — hierarchy, counts, consistency, gaps
2026-04-18 15:07:43 +02:00
aesoft 22ef2871a8 Merge pull request #1359 from rtk-ai/fix-conflict-next-release
Fix conflict next release
2026-04-17 09:36:27 +02:00
aesoft 953bb11442 Merge master into develop to resolve conflicts 2026-04-17 09:35:21 +02:00
aesoft df8e03558d Merge pull request #1346 from rtk-ai/feat-hook-engine
fix: P0+P1 fixes from pre-merge review of hook engine
2026-04-16 21:29:35 +02:00
aesoft d8ddefe78e fix: isolate cursor hook tests from local settings (determinist) 2026-04-16 21:00:13 +02:00
aesoft a1d46f39c2 fix(stream): missing stderr fields 2026-04-16 20:39:01 +02:00
aesoft e92d0993c9 fix(runner): preserve fd separation on command failure 2026-04-16 20:27:13 +02:00
Shawn Scott 9bdf435e8d fix: grep false negatives, output mangling, and truncation annotations
- grep: use --no-ignore-vcs so .gitignore'd files aren't silently skipped
  (matches grep -r behavior, avoids false negatives in large monorepos)
- grep: passthrough raw output for <=50 matches so AI agents can parse
  standard file:line:content format without retry loops
- filter: replace smart_truncate heuristic with clean first-N-lines truncation
  and a single [X more lines] suffix (eliminates synthetic // ... markers
  that AI agents misread as code, causing parsing confusion and retries)
2026-04-16 06:44:15 -07:00
aesoft d34389c3d0 fix: P0+P1 fixes from pre-merge review of hook engine
- runner: print captured output on non-zero exit (P0.1)
- main: add hook/pipe to META_COMMANDS (P0.2)
- init: store integrity hash after Gemini script install (P0.3)
- hook_cmd: audit log + permission check for all agent paths (P1.1, P1.2)
- runner: include failure_lines in cargo test summary (P1.5)
- Cargo.toml: remove unconditional libc dep (P1.7)
- init: clean stale settings.json entries during migration (P1.8)
2026-04-16 15:41:20 +02:00
Joshua 80bc7fbd61 documentation 2026-04-15 14:45:30 -05:00
Joshua 92bbc8a345 fixing bad merge 2026-04-15 14:29:09 -05:00
Joshua 71baf2b82d making curl_cmd use force_tee_hint 2026-04-15 14:22:56 -05:00