Commit Graph
203 Commits
Author SHA1 Message Date
metaphorics d61cfe92f1 perf(pi-shell): bound git log entry lines and mark omitted body lines
push_log_entry truncates over-long subject/body lines via
primitives::truncate_line, and bodies past the 3-line cap now end with
an explicit '[+N lines omitted]' marker instead of silently dropping
the remainder.
2026-06-12 02:34:03 +09:00
metaphorics d0976ad7b0 feat(pi-shell): surface rebase and merge-ready sub-states in git status
detect_status_state now distinguishes 'merge (ready to commit)' from an
unresolved merge conflict and recognizes interactive-rebase sub-states
(editing/splitting a commit, command progress) as rebasing. These
headers appear in git's default long-format status, so no flag
injection is needed.
2026-06-12 02:34:03 +09:00
metaphorics d63bacf93b feat(pi-shell): route mvn/gradle output through jvm filter module
Adds filters/jvm.rs porting rtk's Maven (Surefire/Failsafe state
machine, compile warning-dedup with continuation tracking, package
reactor-summary keeper, quiet mode) and Gradle (build/test/connected/
lint/dependencies, Spring Boot run) filters — cross-line state the TOML
DSL cannot express. Phase and task are decided by re-tokenizing the
command (last goal / last non-clean task), not the first-arg subcommand.

Deletes defs/maven.toml, defs/gradle.toml, defs/mvn-build.toml in the
same change: the engine re-applies builtin pipelines as overlays on
Rust output, so leaving them would strip the module banners and reactor
summaries jvm.rs preserves. mvn-build.toml was already dead config —
maven.toml sorts ahead of it and claimed every mvn invocation first.

The ported rtk Surefire/compile/reactor unit tests load their input via
include_str! from filters/fixtures/jvm/ (real paths scrubbed); those
fixtures ship with the module since they are compile-time inputs.

Op: compress
2026-06-12 02:34:03 +09:00
metaphorics 9aa3bfd502 test(pi-shell): pin skopeo inspect passthrough and empty sentinel
Ports rtk's inspect JSON passthrough test — guarding the def's
primary purpose against strip-pattern overreach — and the empty-input
sentinel test.

Op: correct
Restores: test:rtk skopeo "inspect keeps output"
2026-06-12 02:34:03 +09:00
metaphorics 24d81db246 fix(pi-shell): align liquibase banner and version handling with rtk
Two-hash ASCII-art body rows, bracket-INFO hash borders, the Open
Source edition banner, and the Java Home/Libraries/jar-list env dump
all survived the def, while the one meaningful line of --version
output — the version itself — was stripped. rtk keeps the version and
strips the rest; the def now matches.

Op: correct
Restores: spec:rtk/src/filters/liquibase.toml
2026-06-12 02:34:03 +09:00
metaphorics accdaa9c87 fix(pi-shell): stop ping overlay masking failures and Windows stats
Error terminations with no stats block collapsed to empty and the
ungated on_empty reported 'ping: ok' on nonzero exits. The overlay now
runs only on exit 0, keeps timeout/unreachable/error lines and the
Windows statistics block, and bounds lossy runs with a tail cap.

Op: correct
Restores: spec:rtk/src/filters/ping.toml
2026-06-12 02:34:03 +09:00
metaphorics 32889ecb19 fix(pi-shell): exempt ollama run responses from output caps
The capped def claimed every subcommand including run, where the
model response is the payload rtk deliberately left uncapped. The
general entry now gates to management subcommands; a separate run
entry strips braille spinner residue and applies no caps.

Op: correct
Restores: spec:rtk/src/filters/ollama.toml
2026-06-12 02:34:03 +09:00
metaphorics 19287f05f7 fix(pi-shell): short-circuit clean swift builds with widened guard
Clean swift build output collapses to 'ok (build complete)'. The
unless guard adds Test Suite/failed beyond rtk's warning/error terms
because this def also matches swift test, which prints Build complete!
before test results. Linking phase lines are stripped in both plain
and bracketed progress forms.

Op: correct
Restores: spec:rtk/src/filters/swift-build.toml
2026-06-12 02:34:03 +09:00
metaphorics 0d0fd51b4d fix(pi-shell): short-circuit clean rsync runs
A clean sync collapses to 'ok (synced)' via a guarded match_output on
'total size is'; the unless guard keeps error runs intact, where the
sent/received stats remain diagnostic. Blank separator lines are
stripped on the non-clean path.

Op: correct
Restores: spec:rtk/src/filters/rsync.toml
2026-06-12 02:34:03 +09:00
metaphorics 74ec47a35e fix(pi-shell): strip xcodebuild signing and packaging phase noise
CodeSign/Validate/ProcessProductPackaging/GenerateDSYMFile and the
other archive-build phase banners plus indented absolute-path tool
invocation lines appear in every device build and leaked through;
rtk strips all of them. Test runner output and diagnostics survive.

Op: correct
Restores: spec:rtk/src/filters/xcodebuild.toml
2026-06-12 02:34:03 +09:00
metaphorics dd19333d64 fix(pi-shell): strip ssh client-side connection noise
Permanently-added warnings, connection-closed notices, Authenticated
to, debug1:, OpenSSH_ version banners, and pseudo-terminal warnings
are client chatter, not remote payload; rtk strips all six. Remote
output stays untouched per the def's passthrough stance.

Op: correct
Restores: spec:rtk/src/filters/ssh.toml
2026-06-12 02:34:03 +09:00
metaphorics e22452a80a fix(pi-shell): strip nx separators and chrome, cover wrapped nx runs
Em-dash separator rows, the cache-replay notice, and the 'Nx (powered
by Nx Cloud)' footer survived the def. rtk also matched pnpm-wrapped
invocations; a companion entry on (pnpm|npx|yarn) + subcommand nx now
covers them — pkg's whitelist does not claim nx, so dispatch falls
through to the def.

Op: correct
Restores: spec:rtk/src/filters/nx.toml
2026-06-12 02:34:03 +09:00
metaphorics cc9b7e779c fix(pi-shell): strip mise download and checkmark progress
Download/extract progress and trust/install checkmark echo lines are
pure chrome; rtk strips all three. Install-result lines stay — the
'X installed' line is the meaningful summary of what changed.

Op: correct
Restores: spec:rtk/src/filters/mise.toml
2026-06-12 02:34:03 +09:00
metaphorics 84074a1fc3 fix(pi-shell): strip glog warnings and blanks in helm def
client-go emits W-prefixed glog warnings during repo/list operations
and helm separates sections with blank lines; rtk strips both.

Op: correct
Restores: spec:rtk/src/filters/helm.toml
2026-06-12 02:34:03 +09:00
metaphorics 6e411e3550 fix(pi-shell): strip in-flight shopify theme download progress
The def stripped past-tense Downloaded/Uploaded lines but not the
in-flight 'Downloading ...' progress printed during theme pull, and
Shopify CLI indents progress under spinners so the Uploading anchor
needed loosening.

Op: correct
Restores: spec:rtk/src/filters/shopify-theme.toml
2026-06-12 02:34:03 +09:00
metaphorics b569a02712 fix(pi-shell): strip turbo cache miss/bypass and bare scope lines
The def stripped only 'cache hit, replaying logs'; miss/bypass status
lines and the bullet-less 'N packages in scope' variant survived. The
Tasks:/Duration: summary stays — one line of high-signal counts.

Op: correct
Restores: spec:rtk/src/filters/turbo.toml
2026-06-12 02:34:03 +09:00
metaphorics e25d5d27c7 fix(pi-shell): strip ty version banner and progress lines
When diagnostics exist the clean-run short-circuit does not fire and
the 'ty 0.x.y' banner plus 'Checking N files' progress line leaked
through; rtk strips both.

Op: correct
Restores: spec:rtk/src/filters/ty.toml
2026-06-12 02:34:03 +09:00
metaphorics 76ea65f78d fix(pi-shell): strip jj hint lines
jj prints advice lines such as 'Hint: use jj log ...' after most
commands; rtk strips them. Working-copy summary lines stay — they
carry the operative change-id.

Op: correct
Restores: spec:rtk/src/filters/jj.toml
2026-06-12 02:34:03 +09:00
metaphorics 8fec8e121e fix(pi-shell): strip Docker chain headers and blanks in iptables def
On Docker hosts iptables -L is dominated by DOCKER/DOCKER-USER/BR-*
chain headers and blank chain separators; rtk strips both. Header-line
removal only — rule lines under those chains still pass through.

Op: correct
Restores: spec:rtk/src/filters/iptables.toml
2026-06-12 02:34:03 +09:00
metaphorics 0a255df9d8 fix(pi-shell): strip blank separator lines in gcloud def
rtk strips blank lines and gcloud routinely emits them between status
lines and tables; removing them composes with the on_empty sentinel.

Op: correct
Restores: spec:rtk/src/filters/gcloud.toml
2026-06-12 02:34:03 +09:00
metaphorics 0fb4b28d37 feat(pi-shell): detect gradlew/mvnw wrappers and glab subcommands
Exact-allowlist normalization maps gradlew.bat -> gradlew and
mvnw.cmd -> mvnw so wrapper invocations dispatch to the same filters;
generic extension stripping would over-match unrelated scripts. glab
gains gh-style global-flag skipping for subcommand detection.

Op: extend
2026-06-12 02:34:03 +09:00
metaphorics 3288d56ea6 feat(pi-shell): add replace_after post-filter substitution stage
Ordered regex substitutions applied after strip/keep line filtering and
before per-line truncation. snip donors apply path compaction and
similar rewrites post-filter (~31 placements); the pre-filter replace
list cannot express that without re-matching stripped lines.

Op: extend
2026-06-12 02:34:03 +09:00
metaphorics f58d6fabcb feat(pi-shell): allow strip and keep line filters to coexist
55 of 131 snip donor filters use remove_lines and keep_lines together;
the TOML DSL now applies both: a line survives iff it matches the keep
set (when present) and does not match the strip set (when present).
The CompiledLineFilter special-casing is gone — one general code path.

Op: extend
2026-06-12 02:34:03 +09:00
can1357 0d4fedeeb5 fix(natives): pass pyright --outputjson output through the lint minimizer untouched 2026-06-10 09:51:44 +02:00
can1357 96e66923ce fix(minimizer): treat any bare '-' token as aws stdin/stdout streaming
is_aws_stdout_pipe() used rfind over whitespace tokens, so a value-taking
option after the '-' destination (e.g. 'aws s3 cp s3://b/k - --request-payer
requester') made the check miss and the streamed object body was rewritten
by strip_transfer_progress/JSON compaction. Any bare '-' token now forces
passthrough; a false positive only skips minimization. Also moved the
changelog entries back under '## [Unreleased]' after they slid beneath
released headings during the rebase onto main.

Addresses review feedback on #2176.
2026-06-10 08:31:30 +02:00
David Andrews (LexGenius.ai)andcan1357 3a73107cce fix(minimizer): address PR 2176 review feedback 2026-06-10 08:31:30 +02:00
David Andrews (LexGenius.ai)andcan1357 ce7ec45d42 feat(minimizer): deterministic shell-output minimizer on 15.10.8 2026-06-10 08:31:30 +02:00
can1357 9d457f73d9 test: migrated test imports to package subpath exports
- Replaced relative `../src` imports with `@oh-my-pi/pi-ai` and `@oh-my-pi/pi-agent-core` subpaths.
2026-06-08 19:03:55 +02:00
can1357 5ba7180d48 feat(pi-shell): added nohup builtin that doesn't mask SIGHUP
- Ran the operand as an ordinary descendant so it is reaped with the host instead of leaking as an orphan.
- Propagated the command's exit status; reported missing operand and exit 125 with no operand.
- Updated the bash tool prompt's daemon guidance away from nohup/setsid/disown detachment.
- Switched shell renderer success icon/state to "done".
2026-06-08 18:28:08 +02:00
can1357 b5582278a0 feat(builtins): implemented wait for pids, -f, -n, and -p flags
- Added process ID resolution and selectors for waited jobs.
- Implemented terminate-only waits and next-job polling.
- Recorded completed job IDs into the variable named by -p.
- Added shell integration tests covering the new wait paths.
2026-06-08 18:28:07 +02:00
can1357 003f89b7c4 fix: fixed UTF-8 command slicing in shell fixups
- Converted brush-parser source positions to byte offsets before slicing commands in `try_strip_head_tail` and `try_strip_2to1`, preventing multibyte UTF-8 from misplacing fixup deletions.
- Added regression tests covering trailing `head`/`tail` and `2>&1` strips with Unicode content, and verified rewritten commands re-parse successfully.
2026-06-07 03:49:15 +02:00
can1357 cd9fc55572 fix: aborted internal background jobs during shell cancellation
- Added Job::abort_internal_tasks to abort internal async tasks and drop their join handles.
- Updated shell cancellation paths to call this abort logic and handle mutable shell job lists before signaling remaining process groups.
- Added Rust and TypeScript tests that verify cancellation prevents background shell jobs from completing after abort.
2026-06-02 19:30:40 +02:00
can1357 4ee35bec7a fix: corrected child-session behavior to DetachSession for non-term stdin
- Renamed non-terminal stdin pipeline tests and updated non-terminal expectations to DetachSession behavior.
- Updated child_session_action behavior so non-terminal, non-pipeline stdin now yields DetachSession instead of None.
- Updated execute_external_command to skip process_group for detached children and move take_foreground into its foreground arm.
- Added async regression coverage for detached pipeline stages and logged the fix in the natives CHANGELOG.
2026-05-30 20:55:55 +02:00
oldschoolaandcan1357 ae927b6f81 fix(pi-shell): unblock bash heredocs >4 KiB on Windows and >64 KiB on macOS
brush_core::interp::setup_open_file_with_contents wrote the entire heredoc/here-string body into an anonymous pipe synchronously before handing the reader to the downstream command. Bodies that exceed the OS pipe buffer (~4 KiB on Windows, 16-64 KiB on macOS) deadlocked the writer forever, and the bash tool tripped its 305 s hard timeout without ever launching the consumer. The Linux fast path still uses F_SETPIPE_SZ to grow the pipe inline; every other platform (and Linux bodies that overflow pipe-max-size) now decouples the write onto a fire-and-forget thread that terminates on drain or BrokenPipe.

Adds a 256 KiB regression test that exercises the worst-case shape (: builtin, which never drains stdin), guarded by tokio::time::timeout(10s) so a regression fails CI fast instead of hanging.
2026-05-26 20:12:39 +02:00
can1357 4a44bd1e52 fix(pi-shell): added Sync bound to descendant termination helper
- Updated `terminate_new_descendants` to require the `Sync` marker on its hash-set hasher.
- This tightened async helper bounds without changing its termination-wave logic.
2026-05-25 21:20:23 +02:00
roboomp 8e5c7c9bf1 fix(bash): kept persistent shells after cancel
Stopped marking persistent bash sessions as permanently broken when the JavaScript abort or timeout race wins.

Stopped the Rust descendant kill-wave helper once no cancellation targets remain so later commands are not swept into old cancels.

Fixes #1347
2026-05-25 18:40:22 +00:00
roboomp de5b0a51e2 fix(bash): forcefully terminated canceled shells
Added Rust-side descendant termination on shell cancellation paths so aborts and timeouts escalate to SIGKILL even if brush cleanup stalls.

Covered SIGTERM-ignoring shell workloads in native tests.

Fixes #1347
2026-05-25 18:13:49 +00:00
can1357 c7b2fec204 fix(run-rs-task): always ran fmt:rs regardless of Rust-affecting changes
- Exempted the `fmt:rs` task from the early-exit skip logic so formatting always runs.
- Reformatted `apply_command_env` signature in shell.rs to satisfy the formatter.
2026-05-15 07:10:41 +02:00
can1357 d4f9b5d497 Merge remote-tracking branch 'origin/farm/d3b4991c/fix-windows-env-colon-vars' 2026-05-15 07:05:42 +02:00
roboomp 737288676c fix(pi-shell): preserved $env:VAR refs through brush expansion
Brush-core applied POSIX parameter expansion to $env before dispatching a command, mangling PowerShell references like Write-Host $env:SystemRoot to :SystemRoot. Move the fix down to env-var application: every brush session now defines env=$env as an internal (non-exported) shell variable, so the bash expansion of $env yields the literal $env and PowerShell tokens reach the child intact. User assignments (env=prod; echo "$env:8080") still shadow the fallback in their command scope, so the POSIX bash contract is preserved.

Fixes #1079
2026-05-15 03:50:51 +00:00
can1357 db19fb565e style(pi-shell): formatted fixup shell cleanup code and tests for readability
- Converted several single-line guard-style `if let`/`let Some` exits in `fixup.rs` into multiline blocks for consistent style.
- Reformatted the safe-argument regex definition and normalized test case formatting in `fixup.rs` without altering assertions.
- Reordered `lib.rs` module exports by moving `fixup` ahead of `minimizer`.
2026-05-15 03:46:31 +02:00
can1357 92c42f44f7 fix(coding-agent/tools): resolved bash fixup parsing for head/tail chunks
- Added top-level parsing and segment splitting to apply bash fixups only on safe command chunks.
- Replaced `stripTrailingHeadTail` usage with `applyBashFixups` and array-based notice formatting.
- Fixed terminal `| head`/`| tail` and redundant `2>&1` stripping while preserving command semantics.
- Updated fixup tests for cross-command cases and removed superseded head-tail-only test coverage.
2026-05-15 02:12:28 +02:00
can1357 f24afe13f4 fix(read): added truncation tally markers and elision recovery footers
- Updated shell minimizer line truncation to append `...[+N]` with the count of dropped Unicode scalars when truncation occurs.
- Updated read summary rendering to track `elidedLines`, include them in tool details, and append a recovery footer for `:raw` or line-range access whenever elided spans are present.
- Updated read-tool prompts/docs/tests to cover the new elision-footers and recovery guidance.

Fixes #1046
2026-05-14 23:22:27 +02:00
can1357 ab4416f5bb fix(crates): address clippy lints surfaced on linux baseline 2026-05-12 14:55:39 +02:00
can1357 1cffb3473a fix: corrected worktree baseline capture with synthetic tree diff
- Added untracked worktree baseline capture via `untrackedPatch` and synthetic tree diffing.
- Added fallback-aware backend ordering by collecting host candidates and retrying alternates on unavailable PAL.
- Hardened overlay mount lifecycle by removing stale overlays and deleting upper/work dirs after unmount.
- Refined ZFS clone deletion to validate ownership and remove dataset+origin only when checks pass.
- Updated ProjFS integration to use extended-info callbacks and symlink metadata reads.
- Updated rcopy path handling to absolutize paths, and added `writeTree` plus combined shell timeout checks.
2026-05-12 14:36:31 +02:00
can1357 f81af06a2b feat(pi-shell): add execute_shell_streams with per-stream raw byte sinks 2026-05-12 14:11:55 +02:00
can1357 34aed93f8e fix: win deps 2026-05-12 06:35:41 +02:00
can1357 a4d86a075a feat(coding-agent): added verbatim unicode rule to hashline prompt 2026-05-12 05:25:55 +02:00
can1357 338ec7284f fix(pi-shell): fixed macOS descendant traversal on broken proc_listchildpids
- Replaced macOS `Process::children` and `descendants` traversal with a one-shot `proc_listallpids` scan grouped by `pbi_ppid`, avoiding the broken self-query path in `proc_listchildpids`.
- Built `snapshot_all_pids` and `build_process_tree` helpers and updated descendant collection to walk that tree once, de-duplicating by PID in post-order.
- Added a Unix regression test that verified a freshly spawned child appears in `live_descendants`, preventing silent no-op cleanup on affected darwin kernels.
2026-05-12 05:07:19 +02:00
can1357 40753e9c7c fix(pi-shell): prevented shell cancellation from killing the harness process
- Restricted pgid adoption in `select_termination_targets` to only descendants that are their own group leader, preventing inherited harness pgids from entering the kill set.
- Added `kill_process_group` guard to refuse signaling the harness's own process group as a last-line defense.
- Awaited the `bridge_chunks` drain handle after shell/execute completes to ensure all output chunks are flushed before the future resolves.
2026-05-12 04:44:31 +02:00