Skip to content

feat: improve bash compatibility for LLM-generated scripts#164

Merged
chaliy merged 6 commits intomainfrom
claude/improve-bash-compatibility-5E8pl
Feb 7, 2026
Merged

feat: improve bash compatibility for LLM-generated scripts#164
chaliy merged 6 commits intomainfrom
claude/improve-bash-compatibility-5E8pl

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Feb 7, 2026

Summary

  • Fix eval test data: Correct text_awk_report expected value (289 → 329, math error)
  • AWK major upgrade: Add for/while/do-while loops, increment/decrement ops, arrays (assign, in, for-in, delete), -v flag, ternary operator, field assignment, next statement. AWK tests: 55 → 74 passing (19 un-skipped)
  • date -d flag: Support relative dates ("30 days ago", "+2 weeks"), epoch (@n), ISO dates, keywords (yesterday/tomorrow/now)
  • SED hold space: Add h/H/g/G/x commands, c\text change command, regex range addressing (/start/,/end/). SED tests: 50 → 52 passing (2 un-skipped)
  • Compatibility docs: Update implementation status, add prioritized TODO list of remaining LLM compatibility gaps

Total spec tests passing: 710 → 731 (+21)

Test plan

  • cargo test -p bashkit --lib --tests — 71 unit tests pass
  • cargo test -p bashkit --test spec_tests — all spec test suites pass (bash, awk, sed, grep, jq, comparison)
  • cargo fmt --check — clean
  • cargo clippy -- -D warnings — clean
  • AWK: 22 new unit tests covering loops, arrays, increment, ternary, break/continue
  • date: 11 new unit tests covering -d flag with relative dates, epoch, ISO
  • SED: 6 new unit tests covering hold space, exchange, change, regex ranges

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

The sales.csv test data computes to 10*5 + 25*3 + 7*12 + 15*8 = 329,
not 289. All 3 eval models (Haiku, Opus, GPT-5.2) computed correctly
but failed the check due to wrong expected value.

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9
Major AWK compatibility improvement for LLM-generated scripts.

Parser additions:
- C-style for loops: for(i=1;i<=n;i++)
- for-in loops: for(key in arr)
- while and do-while loops
- break and continue statements
- delete statement for arrays
- Ternary operator: cond ? a : b
- Pre/post increment/decrement: i++, ++i, i--, --i
- Array assignment: arr[key] = value, arr[key] += value
- Field assignment: $2 = "new"
- -v flag for variable pre-assignment
- in operator: key in arr

Interpreter additions:
- AwkFlow enum replacing bool return for proper break/continue/next/exit
- Loop iteration limit (100K) preventing infinite loops
- Array operations via variable naming convention arr[key]
- Field assignment with $0 rebuild

Un-skipped 19 spec tests that now pass.

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9
Supports GNU date -d compatible expressions:
- Relative: "30 days ago", "+2 weeks", "-1 month"
- Keywords: "now", "yesterday", "tomorrow", "next week", "last month"
- Epoch: "@1234567890"
- ISO: "2024-01-15", "2024-01-15 14:30:00"
- Long form: --date=yesterday, --date="30 days ago"

This directly addresses the sysinfo_date_calc eval task where
Opus exhausted command limits trying workarounds for missing -d.

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9
- Add hold space commands: h (copy), H (append), g (get), G (get-append), x (exchange)
- Add change command (c\text) for line replacement
- Add regex range addressing (/start/,/end/) with stateful tracking
- Add numeric-regex range addressing (N,/pattern/)
- Un-skip sed_exchange_x and sed_change spec tests
- 6 new unit tests, all 52 non-skipped spec tests pass

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9
- Update AWK: 74/89 tests pass (was 55), document new features
- Update SED: 52/65 tests pass (was 50), document new features
- Update date: add -d/--date flag to compatibility table
- Add LLM Compatibility Gaps TODO section with prioritized items
- Update total: 731/847 passing (was 710)

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9
@chaliy chaliy force-pushed the claude/improve-bash-compatibility-5E8pl branch from 10317fb to 465bc82 Compare February 7, 2026 18:18
Upstream pydantic/monty bumped to 0.0.4, breaking --all-features builds.

https://claude.ai/code/session_016qdr23RD5qxcazYc8f4PX9
@chaliy chaliy merged commit 043d882 into main Feb 7, 2026
9 checks passed
@chaliy chaliy deleted the claude/improve-bash-compatibility-5E8pl branch March 12, 2026 03:42
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.

2 participants