Skip to content

docs: add comprehensive code documentation and streamline README - #22

Merged
yanurag-dev merged 1 commit into
mainfrom
docs/improve-documentation
May 24, 2026
Merged

yanurag-dev merged 1 commit into
mainfrom
docs/improve-documentation

Conversation

@yanurag-dev

@yanurag-dev yanurag-dev commented May 24, 2026 •

Copy link
Copy Markdown
Owner

Add Go stdlib-style documentation across all packages:

  • internal/trigram: trigram packing, extraction, deduplication
  • internal/posting: inverted index structure, intersection algorithm
  • internal/index: on-disk format, builder phases, reader mmap strategy
  • internal/query: full search pipeline, regex decomposition
  • internal/sync: git baseline + dirty file overlay strategy
  • cmd/grepturbo: CLI entrypoint and subcommand documentation

Enhance docs/ARCHITECTURE.md with:

  • Build and query phase diagrams
  • Key invariant enforcement (no false negatives)
  • CLI integration documentation
  • Implementation phase workflow

Streamline README.md to focus on essentials:

  • Keep benchmark and install sections
  • Add flags and usage with shorthand syntax (grepturbo )
  • Remove "How It Works", process flow, testing, and architecture details
  • Point to ARCHITECTURE.md for deep dives

Summary by CodeRabbit

  • Documentation
    • Rewrote README with clearer installation instructions and step-by-step quick-start guide
    • Enhanced CLI help text with expanded subcommand descriptions and usage details
    • Expanded architecture documentation including system design, performance mechanisms, and correctness guarantees

Review Change Stack

Add Go stdlib-style documentation across all packages:
- internal/trigram: trigram packing, extraction, deduplication
- internal/posting: inverted index structure, intersection algorithm
- internal/index: on-disk format, builder phases, reader mmap strategy
- internal/query: full search pipeline, regex decomposition
- internal/sync: git baseline + dirty file overlay strategy
- cmd/grepturbo: CLI entrypoint and subcommand documentation

Enhance docs/ARCHITECTURE.md with:
- Build and query phase diagrams
- Key invariant enforcement (no false negatives)
- CLI integration documentation
- Implementation phase workflow

Streamline README.md to focus on essentials:
- Keep benchmark and install sections
- Add flags and usage with shorthand syntax (grepturbo <pattern>)
- Remove "How It Works", process flow, testing, and architecture details
- Point to ARCHITECTURE.md for deep dives

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@yanurag-dev
yanurag-dev merged commit decd3cb into main May 24, 2026
1 of 2 checks passed
@coderabbitai

coderabbitai Bot commented May 24, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 22b021b4-76b3-4547-ad6d-cc6cd0fbadff

📥 Commits

Reviewing files that changed from the base of the PR and between cb03004 and 1a4d495.

📒 Files selected for processing (12)
  • README.md
  • cmd/grepturbo/main.go
  • docs/ARCHITECTURE.md
  • internal/index/builder.go
  • internal/index/metadata.go
  • internal/index/reader.go
  • internal/index/sync.go
  • internal/index/writer.go
  • internal/posting/posting.go
  • internal/query/decompose.go
  • internal/query/search.go
  • internal/trigram/trigram.go

📝 Walkthrough

Walkthrough

This PR refreshes documentation and clarification comments throughout the GrepTurbo codebase. README installation and usage sections are rewritten with clear command examples and expected output. CLI help text for build, search, and init subcommands is expanded. Architecture documentation details the trigram-indexed inverted index, freshness checks, and correctness invariants. Internal package documentation (builder, reader, sync, writer, posting, trigram, query) is significantly enhanced with GoDoc comments explaining data formats, concurrency models, and algorithm invariants. No executable logic or API signatures are modified.

Changes

Documentation and Architecture Clarification

Layer / File(s) Summary
User-Facing Installation and CLI Help
README.md, cmd/grepturbo/main.go
Install and usage documentation migrate to fenced bash blocks with flags section and quick-start flow. CLI help text for build, search, init subcommands is expanded with format descriptions and pipeline step comments.
Architecture and Design Documentation
docs/ARCHITECTURE.md
Architecture doc now describes trigram-indexed inverted index, freshness checking (git HEAD vs metadata comparison), rebuild/incremental sync behavior, implementation phases, and formal "No False Negatives" correctness invariant with CLI integration details.
Index Building, Reading, and Metadata Documentation
internal/index/builder.go, internal/index/reader.go, internal/index/metadata.go, internal/index/sync.go, internal/index/writer.go
Index-layer packages gain detailed documentation: on-disk format descriptions, concurrent build/read semantics, mmap-backed lookup, linear-probing hash tables, git-based sync with commit drift detection, and three-phase serialization (postings → lookup table → files).
Search Pipeline, Posting Lists, and Trigram Documentation
internal/posting/posting.go, internal/trigram/trigram.go, internal/query/decompose.go, internal/query/search.go
Search-layer packages receive expanded GoDoc explaining trigram packing/extraction, two-phase posting-list building, regex decomposition rules, four-stage search pipeline, and no-false-negatives guarantee.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 The docs now gleam so bright and clear,
Trigrams and indices all near,
Each comment explains with care,
How posts and searches fare,
No changes to code, just wisdom shared here!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/improve-documentation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yanurag-dev
yanurag-dev deleted the docs/improve-documentation branch May 24, 2026 06:38
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