Skip to content

feat(bash): index shell scripts and cross-file flows - #1629

Open
tschallacka wants to merge 1 commit into
colbymchenry:mainfrom
tschallacka:bash-support
Open

feat(bash): index shell scripts and cross-file flows#1629
tschallacka wants to merge 1 commit into
colbymchenry:mainfrom
tschallacka:bash-support

Conversation

@tschallacka

Copy link
Copy Markdown

Summary

  • Add Bash and POSIX shell indexing for functions, variables, constants, calls, and shell script relations.
  • Detect extensionless shell scripts from bounded shebang inspection and keep them updated through scan, sync, and watch paths.
  • Resolve sourced and executed scripts, source-closure reachability, interpreter and wrapper invocations, and conservative refusal boundaries.
  • Add extraction, resolution, reachability, sync/watch, documentation, and benchmark-harness coverage.

Why

Shell-heavy repositories commonly keep their real behavior in small scripts connected by source, ., and wrapper commands. Those relationships were previously invisible to the graph, so agents had to fall back to file-by-file searching.

Verification

  • npx tsc --noEmit
  • npm run build
  • Full Vitest suite: 2,931 passed, 178 skipped
  • Real-repository extraction checks passed for shunit2, bash-completion, and nvm.
  • With/without agent A/B runs passed without contamination on shunit2 and nvm; the indexed nvm arm used 0 Reads and one CodeGraph explore call in both repetitions, while the blocked arm used 2–4 Reads.
  • A non-shell control run completed successfully.

Scope and limitations

  • Extensionless files are admitted only when their first line has a recognized shell shebang; arbitrary extensionless files without one remain excluded.
  • Static analysis intentionally refuses ambiguous or remote filesystem targets rather than creating potentially incorrect edges.
  • No honest large-tier shell-dominant corpus was available, so the benchmark records the largest measured tier instead of relabeling a medium repository as large.

This overlaps with the narrower Bash work in #1612. This PR is intended as the broader implementation and can supersede that effort if maintainers prefer.

Add Bash extraction, shell-path resolution, shebang detection for extensionless scripts, and source-closure reachability. Include wrapper/interpreter handling, sync and watcher coverage, documentation, and benchmark harness support.
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.

1 participant