Skip to content

refactor(builtins): port tee/mktemp/realpath/stat/od to codegen args#1594

Merged
chaliy merged 1 commit into
mainfrom
claude/modernize-coreutils-builtins-f64Kp
May 7, 2026
Merged

refactor(builtins): port tee/mktemp/realpath/stat/od to codegen args#1594
chaliy merged 1 commit into
mainfrom
claude/modernize-coreutils-builtins-f64Kp

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 7, 2026

Summary

  • Generates <util>_args.rs from uutils' uu_app() for the five remaining gap-fill utilities (tee, mktemp, realpath, stat, od), replacing handwritten flag parsers with the codegen-produced clap surface. Each builtin still implements the body locally against the bashkit VFS.
  • Extends bashkit-coreutils-port to (a) resolve fn uu_app from sibling .rs files (needed for tee, which splits into cli.rs) and (b) inline newtype value-parser structs along with their impl blocks (mktemp's OptionalPathBufParser, realpath's NonEmptyOsStringParser).
  • Adds spec coverage with ### bash_diff annotations for the clap-vs-GNU exit-code differences: new mktemp.test.sh and od.test.sh; tee/stat/path tests gain unknown-flag and missing-value cases; bogus-flag sweep adds tee/mktemp/readlink; specs/implementation-status.md records the new test counts.

Why

Closes the codegen-modernization ask in #1532. All eight gap-fill utilities (tee, mktemp, realpath, readlink, truncate, stat, od, shuf) are now driven by the uutils-derived clap surface, so flag-signature drift is auto-detected by coreutils-args-drift.yml rather than rotting in handwritten parsers.

Test plan

  • cargo build -p bashkit
  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test -p bashkit --lib — 2230 passed
  • Spec tests (bash_spec_tests) — 2052+ pass; new ### bash_diff cases cover unknown-flag rejection and -c missing-value
  • every_builtin_handles_bogus_flag_cleanly includes the new ports
  • generated_args_headers_match_pinned_uutils_revision clean (all generated files at uutils@39364b6)
  • every_generated_parser_emits_env_defaults_table clean (regenerated against TM-INF-024 surface)

The pre-existing threat_jq_moderate_nesting_works failure on origin/main is unrelated to this change.

Closes #1532


Generated by Claude Code

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 7, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 8a2348e Commit Preview URL

Branch Preview URL
May 07 2026, 08:41 PM

…1532)

Generates *_args.rs from uutils/coreutils' uu_app() definitions for the
five remaining gap-fill utilities, replacing handwritten flag parsers
with the generated clap surface. Each builtin still implements the body
locally against the bashkit VFS.

Codegen extensions: bashkit-coreutils-port now resolves `fn uu_app` from
sibling .rs files (tee splits it into cli.rs) and inlines newtype
value-parser structs together with their impl blocks (mktemp's
OptionalPathBufParser, realpath's NonEmptyOsStringParser).

Spec coverage: new mktemp.test.sh and od.test.sh; tee/stat/path tests
gain unknown-flag and `### bash_diff` clap-vs-GNU exit-code cases.
The bogus-flag sweep adds tee/mktemp/readlink, and
specs/implementation-status.md records the new test counts.
@chaliy chaliy force-pushed the claude/modernize-coreutils-builtins-f64Kp branch from b143af9 to 8a2348e Compare May 7, 2026 20:40
@chaliy chaliy merged commit 02221c1 into main May 7, 2026
34 checks passed
@chaliy chaliy deleted the claude/modernize-coreutils-builtins-f64Kp branch May 7, 2026 20:52
chaliy added a commit that referenced this pull request May 17, 2026
## Release v0.6.0

Bumps workspace version `0.5.0 → 0.6.0`, regenerates `Cargo.lock`, syncs
`bashkit-cli` path-dep pin, `crates/bashkit-js/package.json` +
`package-lock.json`, and adds the v0.6.0 entry to `CHANGELOG.md`.

### Highlights

- **Continue coreutils adoption experiment** — Extends codegen beyond
`uu_app()` args to vendor whole upstream uutils modules with a manifest
and drift-detection CI. `tee`, `mktemp`, `realpath`, `stat`, and `od`
now flow through codegen; `printf` runs on a vendored copy of uucore's
format implementation; and `env` is ported through a virtual-env shim
(TM-INF-024) (#1592, #1593, #1594).
- **MCP server mode removed from CLI** — `bashkit mcp` and its CLI
transport are gone; embed bashkit via the library bindings instead
(breaking — see below).
- **Security hardening across the sandbox** — Fail-closed fixes across
realfs, snapshot/restore, sqlite (`VACUUM` rejected, row caps, engine
cache invalidation), network (SSRF precheck fails closed, IPv4-mapped
IPv6 normalization), jq (`halt` replaced; fancy-regex + file-binding
caps), and ssh (sftp `ls` escaping, try `none`-auth first). The final 6
OPEN threat-model entries are now mitigated (#1568).

### Breaking Changes

- **CLI MCP server mode removed**: the `bashkit mcp` subcommand and
bundled MCP server transport are gone. Migrate by embedding bashkit via
the library bindings (`bashkit` crate, `@everruns/bashkit` on npm,
`bashkit` on PyPI) and exposing tools through your own MCP server.

### Publish-readiness report

- **Manifest version sync** — `Cargo.toml`,
`crates/bashkit-cli/Cargo.toml` (path-dep pin),
`crates/bashkit-js/package.json`, `crates/bashkit-js/package-lock.json`
(top-level + `packages.""`), and `Cargo.lock` all read `0.6.0`.
- **Registry freshness** — `cargo search bashkit` / `cargo search
bashkit-cli` / `npm view @everruns/bashkit version` / `pip index
versions bashkit` all return `0.5.0`; `0.6.0` is the next version on
every registry.
- **`cargo fmt --check`** — clean.
- **`cargo clippy --all-targets --all-features -- -D warnings`** —
clean.
- **`cargo test --workspace`** — passes (workspace + doctests;
`CARGO_PROFILE_*_DEBUG=0` set locally so test binaries fit in the
runner's disk).
- **`cargo publish --dry-run -p bashkit --allow-dirty`** — passes after
the same `monty`/python-feature strip that
`.github/workflows/publish.yml` performs at publish time (matches the
existing CI flow).
- **`cargo publish --dry-run -p bashkit-cli --allow-dirty`** — fails
locally with `failed to select a version for the requirement bashkit =
"^0.6.0"` because `bashkit 0.6.0` isn't on crates.io yet. This is the
expected order — `publish-bashkit` runs first in `publish.yml`, then
`publish-bashkit-cli` resolves the new version. No action needed.
- **PyPI / npm packaging** — no packaging-touching changes in this
release, so the `maturin build` / `napi build` smoke tests were skipped
per `specs/release-process.md` step 5.

### Post-merge

Once merged, `release.yml` will tag `v0.6.0`, publish a GitHub Release
from the changelog entry, and dispatch `publish.yml`,
`publish-python.yml`, `publish-js.yml`, and `cli-binaries.yml`. I'll
watch the workflows and verify all four targets (crates.io, PyPI, npm,
Homebrew) report `0.6.0` before declaring the release shipped.

**Full Changelog**:
v0.5.0...v0.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fill missing coreutils gap: tee, mktemp, realpath, readlink, truncate, stat, od, shuf

1 participant