Commit Graph

149 Commits

Author SHA1 Message Date
can1357 60e02d2e6d fix(pi-shell): satisfied clippy trivially-copy and or-fun-call lints
- pass fs::FileType by value in matches_unix_file_type (Copy type)
- swap unwrap_or for unwrap_or_else in parse_utc_datetime to defer fallback
2026-06-26 18:28:36 +02:00
can1357 70a439ace3 feat(pi-shell): implemented fd filesystem search builtin
- Added an `fd` command-line utility for searching the filesystem.
- Implemented file filtering capabilities for type, size, modification time, and ownership.
- Integrated directory traversal and ignore-pattern support for search optimization.
- Registered the builtin in the shell and added comprehensive integration tests for filtering and globbing.
2026-06-26 17:35:59 +02:00
can1357 39a055a1e5 feat: implemented ripgrep-based rg shell builtin
- Implemented `rg` shell builtin using ripgrep libraries to enable file and directory searching.
- Added `RgSink` to handle output formatting, context, and vimgrep compatibility.
- Updated shell context and IO flags to support stdin as search input.
- Added integration tests for directory recursion, ignore filtering, and stdin handling.
2026-06-26 16:33:05 +02:00
can1357 c39b655ae7 feat: implemented -q and -x flags for in-process grep
- Added support for `--quiet` (`-q`) and `--line-regexp` (`-x`) to the `grep` builtin.
- Enabled short-circuiting behavior for `-q` to suppress output and return early on the first match.
- Configured exit status logic to prioritize successful matches over error states when using `-q`.
- Added integration tests to verify correct exit status codes and line anchoring behavior.
2026-06-26 15:47:24 +02:00
can1357 68d7593244 chore: reorg 2026-06-26 12:24:42 +02:00
can1357 7bd326e6f4 fix(pi-shell): resolved find -exec paths against shell working directory
- Ensure `-exec` commands run in the shell current working directory rather than the host process CWD.
- Update operand path resolution in `find` matchers to use the display path, matching behavior expected by shell-integrated utilities.
- Add an integration test to verify path substitution and execution context for shell-integrated `find`.
2026-06-26 12:04:12 +02:00
can1357 b5dac65b31 feat: implemented coreutils shell builtins via in-process execution
- Introduced `pi-uutils-ctx` to manage thread-local I/O redirection, environment context, and path resolution for in-process utilities.
- Integrated a suite of vendored coreutils (cat, find, grep, head, ls, mkdir, mv, rm, sort, tail, uniq, wc) as shell builtins.
- Added infrastructure for command cancellation, streaming I/O, and locale-aware error reporting within the shell environment.
- Configured shell-side dispatch logic to route commands through the new utility context, enhancing performance and binary integration.
2026-06-26 12:00:34 +02:00
can1357 00dcd54597 feat: implemented reparenting for backgrounded wrappers
- Introduce `detach_reparent` parameter to command execution to support process reparenting.
- Add `detach_session_reparent` to Unix command extensions using a double-fork technique to orphan processes from the shell descendant tree.
- Update background pipeline logic to automatically apply reparenting when unwrapping transparent wrappers like `nohup`.
- Remove unused `command_is_resolvable` helper.
2026-06-23 08:06:54 +02:00
can1357 c6fcc155a2 fix: nohup 2026-06-23 06:51:11 +02:00
can1357 0fbcb63539 fix: preserved shells with running background jobs
- Added `Shell.liveBackgroundJobCount` to query active background processes.
- Retained per-call `:async:` shells if background jobs are still running upon turn completion.
- Reaped shells automatically once their last background process exits to prevent lingering processes.
2026-06-22 17:25:19 +02:00
can1357 1df1349b99 ux: standardized elision markers
- Updated various truncation and overflow messages across `pi-shell` and `coding-agent` to use the consistent `[...N units elided...]` format.
- Improved clarity of elided output by explicitly stating the count and type of omitted information.
2026-06-19 04:42:06 +02:00
can1357 c224ef4df5 feat: standardized elision markers and improve transcript viewer robustness
- Standardized elision markers across all tool outputs and filters to use cohesive `[...N [type] elided...]`, `[...Nln elided...]`, and `[...xB elided...]` syntax.
- Updated documentation, prompts, and test expectations to reflect the unified elision format.
- Improved transcript viewer robustness by preventing content aliasing through path-inclusive signature hashing.
- Added logic to clear stale transcript content when associated session files are deleted, accompanied by verifying test cases.
2026-06-19 04:35:18 +02:00
can1357 8d671a71a7 refactor(pi-shell): improved test readability and formatting
- Updated line wrapping in module documentation and test blocks for consistent style.
- Adjusted variable assignment formatting in the segmented chain test to improve readability.
2026-06-19 03:35:53 +02:00
can1357 2e6e56711f fix: prevented shell command corruption in sequential chains
- Validated every stage of a pipeline against `simple_command_is_safe` instead of only the first stage to prevent improper segmentation of compound shell constructs.
- Guarded segment re-execution by verifying that each `Display`-reconstructed command parses back to the expected pipeline shape.
- Configured segmented-chain execution to fall back to an unsegmented, whole-command path whenever a reconstructed segment diverges from the original AST.
- Resolved a syntax error during command execution by preventing `Display` from stripping terminators from compound commands like `while` and `for` loops.
2026-06-19 02:39:44 +02:00
can1357 f5ebab2b83 feat(utils): vendor mermaid rendering 2026-06-18 18:52:38 +02:00
can1357 880983c0d8 style(pi-shell): apply rustfmt to children fallback 2026-06-14 23:31:19 +02:00
can1357 f41b1e35f3 fix(pi-shell): scan /proc for children when CONFIG_PROC_CHILDREN is absent
Some Kata/microVM guest kernels (e.g. the CI runner's 6.18.x) are built
without CONFIG_PROC_CHILDREN, so /proc/<pid>/task/<tid>/children does not
exist. The Linux children() relied on it with no fallback, making
children()/live_descendants() return empty and silently turning shell
cancellation cleanup into a no-op inside such containers.

Fall back to scanning /proc and grouping by parent pid (the same primitive
the macOS path already uses) when no children file is readable; kernels
with the file keep the cheap per-task fast path. Also fixes
process::tests::descendants_includes_freshly_spawned_child under Kata CI.
2026-06-14 23:24:03 +02:00
can1357 72f76280c9 test(pi-shell): tolerate PID-namespaced getsid(0) in session tests
Same containerized-CI issue as the pi-natives wrapper test: in a PID
namespace the host process's session leader lives outside the namespace,
so getsid(0) returns 0 (not -1). Relax the host_sid > 0 sanity asserts in
embedded_external_command_runs_in_its_own_session and
embedded_pipeline_stage_runs_in_its_own_session to host_sid >= 0; the
child-session invariants (own session, distinct from host) are unchanged.
2026-06-14 23:24:03 +02:00
can1357 b0a00fdb5d chore: reformat 2026-06-14 18:13:48 +02:00
can1357 ce6ac9a9d2 Merge PR #2384: fix(pi-shell): satisfy clippy in process.rs 2026-06-14 17:29:38 +02:00
oldschoola e60498f1f3 fix(pi-shell): satisfy clippy in process.rs on Windows 2026-06-14 17:23:40 +02:00
oldschoola 8ac68b731f test(pi-shell): gate Unix job-control tests and fix nohup on Windows 2026-06-14 17:22:49 +02:00
can1357 4a2417c92f fix(pi-shell): fixed here-document chains to avoid segmented minimizer re-run failures
- Marked heredoc redirects as unsafe for chain segmentation so commands with here-docs run via the single execution path instead of being replayed.
- Added regression tests in minimizer and shell modules covering quoted, escaped, and chained here-doc pipelines.
- Recorded the fix in the natives changelog for multi-command quoted/escaped heredoc handling.
2026-06-14 08:55:35 +02:00
can1357 e14f7effa7 fix: remove flakey test 2026-06-13 22:14:34 +02:00
can1357 b921b67db7 fix(pi-shell): fixed quoted heredoc execution without trailing newline
- Added `ensure_trailing_newline_for_heredoc` to normalize commands by appending a newline for heredoc inputs missing one.
- Applied the helper in both one-shot and streaming shell execution paths before invoking `run_string`.
- Added a regression test for quoted heredocs at EOF in Unix and documented the fix in the natives changelog.
2026-06-13 14:38:36 +02:00
can1357 2e5b0b5757 fix(brush-core-vendored): fixed async background PID targeting for nohup wrapper
- Added a transparent_background_wrapper flag to builtin registrations and a helper constructor.
- Updated async background job creation to classify transparent wrapper builtins and launch the unwrapped command as the tracked job.
- Marked nohup as a transparent background wrapper and added a test asserting `nohup cmd &` exposes a child PID in `$!`.
2026-06-12 22:37:01 +02:00
can1357 961e7c10d3 feat(utils): added isMacosMallocStackLoggingEnvName() function
- Added isMacosMallocStackLoggingEnvName() function to identify MallocStackLogging and MallocStackLoggingNoCompact variables. Updated filterProcessEnv() and Bun.env initialization to skip these variables during environment filtering. Added test case to verify malloc stack logging toggles are dropped instead of forwarded.
2026-06-12 15:46:52 +02:00
can1357 a8e1f636f6 refactor(minimizer): applied #[must_use] annotations and simplified minimizer parsing internals
- Applied #[must_use] annotations across minimizer and process APIs to flag ignored return values.
- Replaced direct serde_json field reads with typed Value helper calls in several filters.
- Simplified filter parsing with chained if-let guards, rfind checks, and related cleanup.
- Updated minimizer tests and fixtures to build outputs via write! and fmt::Write.
2026-06-12 12:16:18 +02:00
can1357 ab40078473 refactor(pi-shell/minimizer): removed redundant wrapper_invokes helper
- Removed the wrapper_invokes helper function from the minimizer filters module.
2026-06-12 12:06:38 +02:00
metaphorics 2c7c7d7b4d style(pi-shell): cargo fmt sweep over review fix commits 2026-06-12 18:48:56 +09:00
metaphorics 376f612ac1 fix(pi-shell): pass glab mr diff through raw
Op: correct
Restores: spec:glab mr diff output passes through unmodified like gh pr diff
2026-06-12 18:48:56 +09:00
metaphorics 64fe4ce0ae fix(pi-shell): mark omitted glab releases past the cap
Op: correct
Restores: spec:truncated glab release list signals the omission count
2026-06-12 18:48:56 +09:00
metaphorics 69cc4648dd test(pi-shell): lift max_capture_bytes in the fixtures harness
Prevent oversized fixtures from silently triggering the size passthrough path
and causing a misleading savings-gate failure instead of a real filter failure.

Op: correct
2026-06-12 18:48:56 +09:00
metaphorics 84df078fc4 fix(pi-shell): pass pip list --format=json through unmodified
The --format=json / --format json flag forms were not recognised by the
machine-readable opt-out; the output was parsed and rewritten as a text summary.
Extend the opt-out to cover both flag forms.

Op: correct
Restores: spec:any pip list --format=<machine-readable> output passes through unchanged
2026-06-12 18:48:56 +09:00
metaphorics 0ff2311c98 fix(pi-shell): require a non-space rule char in is_horizontal_rule
Whitespace-only lines are not markdown horizontal rules. Current callers trim
first so no live bug, but the invariant should be enforced in the function.

Op: correct
2026-06-12 18:48:56 +09:00
metaphorics a8096aadb1 test(pi-shell): cover command_has_ordered_tokens and command_has_any_token
Reversed-order negative, first==second edge case, --flag=value match and
non-match, and substring-of-value non-match.

Op: extend
2026-06-12 18:48:56 +09:00
metaphorics b211824227 fix(pi-shell): rebuild routed ctx for eslint/tsc/biome JS wrappers
Op: correct
Restores: spec:npx eslint -f json and similar formatter flags preserved through JS wrapper
2026-06-12 18:48:56 +09:00
metaphorics 0cce82cfef fix(pi-shell): route attached docker-compose up through the log filter
Op: correct
Restores: spec:docker-compose up attached output is preserved as log output, not stripped as build progress
2026-06-12 18:48:56 +09:00
metaphorics 50fec8a0f9 fix(pi-shell): bypass the worktree condenser for porcelain/null output
Op: correct
Restores: spec:git worktree list --porcelain output passes through unmodified
2026-06-12 18:48:55 +09:00
metaphorics 41789c84b9 fix(pi-shell): keep go -json benchmark rows out of the pass aggregator
Op: correct
Restores: spec:go test -json -bench runs are not collapsed to a package-count summary
2026-06-12 18:48:55 +09:00
metaphorics 3771d285d1 fix(pi-shell): skip option values when classifying jvm build goals/tasks
Op: correct
Restores: spec:detect_phase and detect_task return last recognised lifecycle
goal/task, not the value of a value-taking option like -pl or -p
2026-06-12 18:48:55 +09:00
metaphorics 42d7f1e40c style(pi-shell): cargo fmt sweep over workflow-committed files
Workflow worktree agents committed without running cargo fmt; main
working tree carried the correctly-formatted versions. No functional
change.
2026-06-12 04:59:56 +09:00
metaphorics c81e6d8a42 fix(pi-shell): gate rsync success shortcut on exit 0
The match_output 'ok (synced)' shortcut was not exit-gated: a rsync run
that exits non-zero but happens to emit 'total size is' without the
(?i) unless keywords would silently succeed. Add only_on_exit = [0] at
the filter level so the entire rsync def is bypassed on failure exits,
passing the raw diagnostic output through.

Op: correct
2026-06-12 04:53:51 +09:00
metaphorics 2219269eb4 refactor(pi-shell): hoist shared gh/glab helpers to primitives
Five byte-identical private helpers across gh.rs and glab.rs
(command_has_ordered_tokens, command_has_any_token, head_tail_dedup,
is_markdown_badge_or_image, is_horizontal_rule) are now pub fn in
primitives.rs. Both callers updated to use primitives::.

Op: compress
2026-06-12 04:26:48 +09:00
metaphorics c5e96e24d3 fix(pi-shell): keep JUnit5 assertion messages in gradle failure output
The failure-block parser in the Gradle test filter only kept exception lines
starting with 'java.' or 'kotlin.', silently dropping JUnit5 assertion messages
(org.opentest4j.AssertionFailedError: expected...). Now any non-stack non-blank
line inside a failure block is treated as exception/message and kept.

Op: correct
2026-06-12 04:22:47 +09:00
metaphorics 5404fa3b1e fix(pi-shell): classify jvm build tasks by last recognized goal/task
detect_phase (Maven): was picking the LAST non-flag token, so 'mvn test -pl
module-a' resolved to Passthrough. Now picks the last RECOGNIZED lifecycle goal,
ignoring option-value tokens.

detect_task (Gradle): was picking the LAST non-flag non-clean token, so 'gradle
test --tests FooSpec' resolved to Other (Foo not recognized). Now picks the FIRST
recognized task token, since tasks precede option-values in gradle command lines.

Op: correct
2026-06-12 04:20:59 +09:00
metaphorics 5b4a92b83e merge: P2 fix from worktree-wf_f9215fe7-fca-6 2026-06-12 04:15:58 +09:00
metaphorics 1be477eafa merge: P2 fix from worktree-wf_f9215fe7-fca-5 2026-06-12 04:15:52 +09:00
metaphorics 8452ff2322 merge: P2 fix from worktree-wf_f9215fe7-fca-4 2026-06-12 04:15:47 +09:00
metaphorics 5edc053a34 merge: P2 fix from worktree-wf_f9215fe7-fca-3 2026-06-12 04:15:42 +09:00