Skip to content

Experiment B: refactor shared tree building helpers - #7

Merged
jolestar merged 1 commit into
mainfrom
task-task_c77214bf167024e
Jun 21, 2026
Merged

Experiment B: refactor shared tree building helpers#7
jolestar merged 1 commit into
mainfrom
task-task_c77214bf167024e

Conversation

@jolestar

Copy link
Copy Markdown
Contributor

Summary

This is experiment B for #1: refactor the repeated analyzer tree-building logic by extracting a dedicated src/tree.rs helper module.

The current project structure is small and layered:

  • src/main.rs: CLI entry point and argument handling
  • src/analyzer.rs: language dispatch and shared analyzer model helpers
  • src/rust.rs, src/javascript.rs, src/markdown.rs: language-specific tree-sitter extraction
  • src/model.rs, src/render.rs, src/util.rs: shared data model, rendering, and utility code
  • tests/fixtures/*: language fixture coverage used by the existing test suite

A/B analysis report

Goal: evaluate two implementations of issue #1 and compare the usefulness of the sview skill for navigating the refactor.

Experiment A: sview skill enabled

Comparison branch/PR keeps the shared helper in src/analyzer.rs.

Observed navigation characteristics:

  • one sview outline pass plus targeted reads was enough to identify the repeated shape across analyzer modules
  • the skill made the repeated function boundaries and module responsibilities easy to compare without reading every file fully
  • total observed tool-call count was still similar to the no-skill run, so the immediate value was clearer navigation rather than fewer calls

Experiment B: no sview skill

Implementation in this PR:

  • adds a dedicated src/tree.rs module
  • exposes it from src/lib.rs
  • removes duplicated parent/child tree assembly code from Rust, JavaScript/TSX, and Markdown analyzers
  • keeps the language analyzers focused on extraction and keeps generic tree assembly separate from analyzer dispatch

Observed navigation characteristics:

  • normal rg/sed exploration was sufficient for this small repository
  • the resulting module boundary is cleaner because tree construction becomes its own module
  • navigation evidence was less direct, but the final code shape is slightly easier to evolve

Recommendation

Both implementations solve #1 and pass tests. I slightly prefer this B PR for long-term module boundaries (src/tree.rs), while the A PR is useful evidence that sview improves structural navigation and reduces unnecessary full-file reading.

Verification

  • cargo fmt --check
  • cargo test --quiet

@jolestar
jolestar merged commit 286d490 into main Jun 21, 2026
1 check passed
@jolestar
jolestar deleted the task-task_c77214bf167024e branch June 21, 2026 15:01
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