Skip to content

feat(bashkit): Phase 11 - Text processing commands (jq, grep, sed, awk)#12

Merged
chaliy merged 1 commit intomainfrom
claude/bash-filesystem-library-cYGoo
Jan 31, 2026
Merged

feat(bashkit): Phase 11 - Text processing commands (jq, grep, sed, awk)#12
chaliy merged 1 commit intomainfrom
claude/bash-filesystem-library-cYGoo

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Jan 31, 2026

Summary

  • Implements four major text processing commands: jq, grep, sed, and awk
  • Fixes single-quoted string handling to prevent incorrect variable expansion
  • All formatting and linting checks pass

Changes

New Commands

  • jq: JSON processor using jaq library with full filter syntax support
  • grep: Pattern matching with flags -i, -v, -n, -c, -l, -F, -E
  • sed: Stream editor with s///, d, p commands and address ranges
  • awk: Full AWK implementation with BEGIN/END, pattern matching, functions

Parser Fix

  • Added LiteralWord token type for single-quoted strings
  • Single-quoted strings no longer undergo variable expansion
  • Fixes awk/sed programs containing $1, $2, etc.

Test plan

  • All 177 tests passing
  • cargo fmt --check passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • Manual testing of all four commands via CLI

@chatgpt-codex-connector
Copy link

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.

Implements four major text processing commands:

- jq: JSON processor using the jaq library
  - Field access, array indexing, keys, length
  - Full jq filter syntax support

- grep: Pattern matching using regex crate
  - Flags: -i (case insensitive), -v (invert), -n (line numbers)
  - Flags: -c (count), -l (files), -F (fixed string), -E (extended)

- sed: Stream editor with substitution support
  - s/pattern/replacement/[g] substitution
  - Address ranges (line numbers, $, regex)
  - Delete (d) and print (p) commands
  - In-place editing with -i flag

- awk: Pattern scanning and processing
  - Field splitting with -F option
  - BEGIN/END blocks
  - Pattern matching (regex and expressions)
  - Built-in variables: NR, NF, FNR, FS, OFS, ORS
  - Functions: length, substr, index, split, gsub, sub, toupper, tolower
  - Arithmetic and string operations
  - Compound assignment operators (+=, -=, etc.)

Also fixes single-quoted string handling:
- Added LiteralWord token type for single-quoted strings
- Single-quoted strings no longer undergo variable expansion
- This fixes $1, $2 etc. being incorrectly expanded in awk/sed programs

Test coverage: 177 tests passing

https://claude.ai/code/session_01A16cD8ztbTJs2PB2iHe1Ua
@chaliy chaliy force-pushed the claude/bash-filesystem-library-cYGoo branch from 24045a3 to 0c851e2 Compare January 31, 2026 21:41
@chaliy chaliy merged commit ff20112 into main Jan 31, 2026
1 check passed
@chaliy chaliy deleted the claude/bash-filesystem-library-cYGoo branch January 31, 2026 21:49
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