Commit Graph

878 Commits

Author SHA1 Message Date
aesoft 45f83c072d refacto(cicd): no dispatch possible (hosted git, cron pull) 2026-05-29 16:40:52 +02:00
aesoft 7ab4b4fc16 Merge branch 'refacto/pkg-from-event' of https://github.com/rtk-ai/rtk into refacto/pkg-from-event 2026-05-04 10:25:56 +02:00
aesoft c40e3260c3 fix(cicd): workflow dispatch for dispatch oss-pro 2026-05-04 10:25:45 +02:00
aesoft 6761374d20 refacto: semgrep bypass mainrs now dispatch 2026-05-03 18:49:55 +02:00
aesoft 5bc33a365b Update Cargo.toml 2026-05-03 18:37:03 +02:00
aesoft 1b3cd06f3d refacto(crate): split into lib + bin for downstream bundling 2026-05-03 18:26:19 +02:00
aesoft 95b066b33c refacto(crate): split into lib + bin for downstream bundling 2026-05-03 18:03:32 +02:00
aesoft 492aa76ed3 Merge pull request #1009 from KuSh/broken-pnpm-i
fix(pnpm): install don't take a list of packages
2026-05-03 16:46:49 +02:00
aesoft f75a10b1a2 Merge pull request #1371 from ousamabenyounes/fix/issue-1362
fix: head/tail multi-file rewrite falls back to native command (#1362)
2026-05-03 16:24:23 +02:00
aesoft bf6d4b2ea2 Merge pull request #1338 from lumincui/fix/ls-locale-fallback
fix(ls): LC_ALL=C + fallback to raw on unrecognized locale
2026-05-03 16:05:09 +02:00
patrick 2ed53c7fa2 fix(curl): gate force_tee_hint, extend JSON heuristic, avoid full-body alloc
Follow-up to the initial #1536 fix after a deeper review pass.

- force_tee_hint() is no longer called on the passthrough path. Previously
  every non-TTY pipe invocation (curl | jq, curl | python -m json.tool —
  the exact scenarios this PR fixes) was still writing a tee log file as a
  side effect, which is wasteful: the tee file's purpose is to give the
  LLM a recovery path when output is truncated, and we are no longer
  truncating in those cases.

- looks_like_json now also matches bare top-level JSON strings (e.g.
  /api/token endpoints returning a long quoted token). Previously a
  >500-byte bare JSON string on a TTY would still get truncated mid-stream
  and produce invalid output.

- FilterResult.content is now Cow<'_, str> so the passthrough path no
  longer copies the whole body. For multi-MB curl responses piped through
  rtk this eliminates a full-size allocation.

- Exit code from curl is propagated via Ok(result.exit_code) instead of
  the previously hardcoded Ok(0). On the success path the value is 0
  anyway, but the inconsistency with the early-exit branch above made the
  intent unclear.

Tests: 9 -> 11 (added bare-JSON-string passthrough and a Cow::Borrowed
assertion verifying the passthrough paths don't allocate). cargo test
--all: 1693 passed, 6 ignored.

Verified end-to-end against jsonplaceholder.typicode.com/posts (~27 KB,
100 entries, parseable) and a randomly-generated 100-entry / 52 KB / 1450-line
JSON served from a local http.server (rtk output byte-identical to source
modulo the trailing newline added by println!).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:12:38 +02:00
patrick 02da3d0702 fix(curl): JSON passthrough + IsTerminal gate to prevent invalid JSON output
`rtk curl` was unconditionally truncating any response >=500 bytes when a
tee hint was available, inserting the literal `... (N bytes total)` marker
mid-stream. For JSON bodies this produces invalid, unparseable output and
silently breaks every downstream `jq`, `python -m json.tool`, or agent
pipeline that consumes `rtk curl`.

Two changes in `filter_curl_output`:

1. JSON heuristic passthrough — if the trimmed body starts/ends with
   matching JSON brackets, return it unchanged. The body is already
   buffered in memory so the check is essentially free.

2. `is_terminal()` gate — only truncate non-JSON output when stdout is
   a TTY. Pipes and shell redirects (`> file`, `| jq`) now receive the
   full body, matching what `curl -o file` already does and closing
   the silent-data-loss path described in #1282.

The tee file is still written for inspection, but the hint line is
suppressed in the passthrough cases so it never leaks into pipes.

Tests: existing 5 cases updated to pass `is_tty=true` (preserve TTY-mode
assertions); 4 new cases cover JSON object/array passthrough at
>500 bytes and pipe-mode (non-TTY) full-body delivery.

Verified end-to-end against the public repro from the issue:
`rtk curl -s https://jsonplaceholder.typicode.com/posts | python3 -c
'import sys,json; print(len(json.load(sys.stdin)))'` now returns 100.

Closes #1536
Refs #1282

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 11:12:38 +02:00
Nicolas Le Cam 63da7dafd6 feat(cicd): target develop branch 2026-05-01 14:09:51 +02:00
swithek a017fbd2e6 test(json): assert truncated value byte length for multibyte strings 2026-05-01 13:56:47 +02:00
swithek 784003055e fix(json): expand char boundary truncation test 2026-05-01 13:56:47 +02:00
swithek 533894a77e fix(json): use char boundary when truncating long string values 2026-05-01 13:56:47 +02:00
dependabot[bot] 74c1b36f65 build(deps): bump rustls-webpki from 0.103.9 to 0.103.13
Bumps [rustls-webpki](https://github.com/rustls/webpki) from 0.103.9 to 0.103.13.
- [Release notes](https://github.com/rustls/webpki/releases)
- [Commits](https://github.com/rustls/webpki/compare/v/0.103.9...v/0.103.13)

---
updated-dependencies:
- dependency-name: rustls-webpki
  dependency-version: 0.103.13
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-01 13:52:46 +02:00
aesoft 09e1c0ad4b Merge pull request #1456 from JBF1991/fix-grep-passthrough
fix(grep): adjust the command to fall through if the output would already be as small as possible
2026-05-01 13:35:19 +02:00
Victor Sumner e91dee568b fix(git): drop state-hint extraction in compact status
KuSh: the in-progress state line ("rebase in progress", "merge in
progress. unresolved conflicts", etc.) is enough — LLMs know which git
commands resolve each state, so the per-state hint list was noise.

Removes STATE_HINTS and extract_state_hint, and reduces extract_state_header
to a short walk that returns the first detected state summary or None.
Existing per-state tests now assert the exact compact summary.
2026-05-01 05:54:24 +02:00
Victor Sumner 316e65ef5b fix(git): address review feedback on status state surfacing
- Drop redundant LANG=C env (LC_ALL=C is sufficient).
- Replace nested if/else chains in detect_status_state and
  extract_state_hint with const slices + iter for readability.
- Drop the 2-space indent prefix on hint lines — adds nothing for
  machine consumption.
2026-05-01 05:54:24 +02:00
Victor Sumner cff391e50b fix(git): compact in-progress status state 2026-05-01 05:54:24 +02:00
Victor Sumner 017d0f9ee6 fix(git): surface in-progress state in compact rtk git status
Default `rtk git status` runs `git status --porcelain -b` to build its
compact view, but porcelain v1 omits the state header git prints when a
rebase, merge, cherry-pick, revert, bisect, am, or sparse checkout is in
progress. That header is correctness-critical — hiding "You are currently
editing a commit while rebasing..." leaves the user thinking the repo is
clean when it isn't.

`run_status` already captures plain `git status` output as `raw_output`
for tracking, so this fix adds `extract_state_header` to pull the state
block out of it and prepends the block to the compact output. Returns
`None` when nothing is in progress so clean repos are unchanged.

Covered states: interactive / regular rebase, merge-with-unmerged-paths,
"still merging after conflicts fixed", cherry-pick, revert, bisect, am,
sparse checkout. Preserves the directive hints git prints alongside
(`git rebase --continue`, `git commit --amend`, `git bisect reset`,
etc.), while still filtering generic `(use "git add")` / `(use "git
restore")` noise.

Design principle: Correctness vs Token Savings — never hide information
that changes the user's understanding of repo state.
2026-05-01 05:54:24 +02:00
aesoft 282ebf8df7 Merge pull request #1630 from rtk-ai/hotfix/cicd/use-git-app
hotfix(cicd): use git app
2026-04-29 20:24:59 +02:00
aesoft 02cf39ee9e hotfix(cicd): git app token for artefact 2026-04-29 19:22:06 +02:00
aesoft bdfa559b41 Merge branch 'hotfix/cicd/use-git-app' of https://github.com/rtk-ai/rtk into hotfix/cicd/use-git-app 2026-04-29 19:10:24 +02:00
aesoft 9d18229b30 hotfix(cicd): authorize dispatch for release please + git app for bump 2026-04-29 19:10:22 +02:00
aesoft c906873787 Merge pull request #1628 from rtk-ai/hotfix/cicd/use-git-app
hotfix(cicd): add git app token for release please
2026-04-29 18:53:13 +02:00
aesoft edfd53c882 Update cd.yml 2026-04-29 18:51:57 +02:00
aesoft d1467e2e9b hotfix(cicd): add git app token for release please 2026-04-29 18:47:29 +02:00
aesoft 7cfcdbec86 Merge pull request #1611 from rtk-ai/fix/remove-sh-from-tests
fix(stream): add semgrep flag for sh tests
2026-04-29 14:26:36 +02:00
aesoft d327724f81 fix(stream): add semgrep flag for sh tests 2026-04-29 13:01:50 +02:00
aesoft 605e335f05 Merge pull request #1579 from rtk-ai/fix/stream-stderr-routing
fix(stream): route to respective fd
2026-04-29 09:25:49 +02:00
aesoft c590bd6932 fix(benchmark): benchmark capture all fd only stream 2026-04-28 20:25:44 +02:00
aesoft e6c2523be1 fix(benchmark): capture all fd for stream cmd benchmark 2026-04-28 20:12:43 +02:00
aesoft 81a1be6a74 fix(stream): route to respective fd 2026-04-28 18:58:56 +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
Joshua 021827c3c9 fix(grep): adjust the command to fall through if the output would already be as small as possible 2026-04-25 20:38:33 -05: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
Lumin b51a815451 fix(ls): LC_ALL=C + fallback to raw on unrecognized locale
- 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 #1276
2026-04-25 01:16:43 +08:00
aesoft 7681dafc76 fix(cicd):: no semgrep alert on sh call cicd 2026-04-24 19:04:51 +02:00