Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a74a932

Browse files
docs(readme): update command reference and UI styling
- Document newly integrated CLI commands: `web`, `diff`, and `release-context`. - Remove references to the deprecated `ast` command and its `ast-grep` dependency. - Update architecture documentation to reflect the inclusion of DOM parsing libraries (`beautifulsoup4`, `markdownify`) instead of `nbformat`. - Refactor header badges and contact sections using centered shields.io SVGs for a cleaner layout.
1 parent 4811653 commit a74a932

1 file changed

Lines changed: 69 additions & 46 deletions

File tree

README.md

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
# Focal (v0.1.0)
1+
<!-- markdownlint-disable-file MD041 -->
2+
<div align="center">
23

3-
[![CI](https://github.com/jacksonfergusondev/focal/actions/workflows/ci.yml/badge.svg)](https://github.com/jacksonfergusondev/focal/actions/workflows/ci.yml)
4-
[![Release](https://github.com/jacksonfergusondev/focal/actions/workflows/release.yml/badge.svg)](https://github.com/jacksonfergusondev/focal/actions/workflows/release.yml)
5-
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
6-
[![Code style: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
7-
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
8-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4+
# Focal (v0.1.0)
95

106
**CLI utilities for AI-assisted development context and workflow automation.**
117

12-
Gathering context for an LLM (whether ChatGPT, Claude, or Gemini) usually means copying and pasting multiple files, scraping git diffs, and manually formatting terminal outputs. Focal automates this boilerplate repository extraction so you can stay in flow and feed your AI assistant exactly what it needs to understand your codebase.
8+
[![CI](https://img.shields.io/github/actions/workflow/status/JacksonFergusonDev/focal/ci.yml?style=flat-square&color=white&labelColor=black&label=CI)](https://github.com/JacksonFergusonDev/focal/actions/workflows/ci.yml)
9+
[![Release](https://img.shields.io/github/actions/workflow/status/JacksonFergusonDev/focal/release.yml?style=flat-square&color=white&labelColor=black&label=release)](https://github.com/JacksonFergusonDev/focal/actions/workflows/release.yml)
10+
[![Python](https://img.shields.io/badge/python-3.10+-white?style=flat-square&color=white&labelColor=black)](https://www.python.org/downloads/)
11+
[![Ruff](https://img.shields.io/badge/style-ruff-white?style=flat-square&color=white&labelColor=black)](https://github.com/astral-sh/ruff)
12+
[![Mypy](https://img.shields.io/badge/mypy-checked-white?style=flat-square&color=white&labelColor=black)](https://mypy-lang.org/)
13+
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-white?style=flat-square&color=white&labelColor=black)](https://github.com/pre-commit/pre-commit)
14+
[![License](https://img.shields.io/badge/license-MIT-white?style=flat-square&color=white&labelColor=black)](LICENSE)
15+
16+
</div>
17+
18+
Gathering context for an LLM (whether ChatGPT, Claude, or Gemini) usually means copying and pasting multiple files, scraping git diffs, and manually formatting terminal outputs. Focal automates this boilerplate repository extraction so you can stay in flow and feed your AI assistant exactly what it needs to understand your codebase or external documentation.
1319

1420
## 🚀 Quick Start
1521

@@ -21,35 +27,35 @@ brew install jacksonfergusondev/tap/focal
2127

2228
*See [Detailed Installation & Autocompletion](#-detailed-installation--autocompletion) below for building from source and configuring Zsh/Bash.*
2329

24-
-----
30+
---
2531

2632
## 💡 Design Philosophy
2733

2834
Focal is built to maximize LLM attention window efficiency and stay out of your way. It adheres to a strict pipeline-native architecture to avoid generating bloated, noisy context blocks:
2935

30-
1. **High Signal, Low Noise:** When generating branch topologies or diffs, Focal aggressively filters out binary blobs, lockfiles, and minified assets using strict heuristic sets. It reserves token bandwidth for the source code that actually matters.
36+
1. **High Signal, Low Noise:** When generating branch topologies or diffs, Focal aggressively filters out binary blobs, lockfiles, minified assets, and DOM noise using strict heuristic sets. It reserves token bandwidth for the source code and semantic text that actually matters.
3137

3238
1. **Clipboard-First Execution:** Outputs are automatically calculated for token length and piped directly to your system's native clipboard manager (`pbcopy`, `wl-copy`, `xclip`, or `xsel`). No intermediate files; just run the command and paste.
3339

34-
1. **Pipeline Native:** Core routing and file manipulation are handled by ultra-fast UNIX utilities (`rg`, `fd`, `fzf`, `bat`). Python is strictly reserved as an asynchronous backend to handle complex data transformations, like parsing Jupyter Notebook ASTs or resolving Git commit topologies.
40+
1. **Pipeline Native:** Core routing and file manipulation are handled by ultra-fast UNIX utilities (`rg`, `fd`, `fzf`, `bat`). Python is strictly reserved as an asynchronous backend to handle complex data transformations, like parsing Jupyter Notebook ASTs, resolving Git commit topologies, or stripping HTML structure.
3541

36-
1. **Clear Formatting:** LLMs need structural boundaries. Files, diffs, GitHub API responses, and CI logs are automatically wrapped in LLM-optimized Markdown blocks, ensuring the model understands file paths, language semantics, and context hierarchies.
42+
1. **Clear Formatting:** LLMs need structural boundaries. Files, diffs, GitHub API responses, web pages, and CI logs are automatically wrapped in LLM-optimized Markdown blocks, ensuring the model understands file paths, language semantics, and context hierarchies.
3743

38-
1. **Fail Loud, Fail Early:** Pre-flight checks (`require_cmd`) ensure all system dependencies are present before any context generation is attempted. If a required binary is missing, Focal aborts cleanly.
44+
1. **Fail Loud, Fail Early:** Pre-flight checks ensure all system dependencies are present before any context generation is attempted. If a required binary is missing, Focal aborts cleanly.
3945

40-
-----
46+
---
4147

4248
## ⚡️ Performance & Latency Isolation
4349

4450
Focal is built to be lightweight, utilizing bash wrappers to defer Python's startup overhead until strictly necessary.
4551

4652
1. **Fast-Path Execution:** Commands like `focal search`, `focal file`, or `focal tree` execute entirely via compiled binaries like `ripgrep` or `tree`/`fd`, meaning time-to-clipboard is measured in milliseconds.
4753

48-
1. **Heavy-Path Execution:** For complex extractions like `focal wip-context` or `focal ci-fail`, the bash layer dynamically resolves a localized `uv` virtual environment to execute the Python backend, ensuring global namespace isolation without sacrificing execution speed.
54+
1. **Heavy-Path Execution:** For complex extractions like `focal wip-context`, `focal web`, or `focal ci-fail`, the bash layer dynamically resolves a localized `uv` virtual environment to execute the Python backend, ensuring global namespace isolation without sacrificing execution speed.
4955

5056
Our CI pipeline enforces strict linting and type-checking across both the Python (`ruff`, `mypy`, `pytest`) and Shell (`shellcheck`, `shfmt`, `bats`) stacks to guarantee architectural stability.
5157

52-
-----
58+
---
5359

5460
## 📦 Detailed Installation & Autocompletion
5561

@@ -65,7 +71,7 @@ just install
6571

6672
*Note: The `just install` pipeline resolves a localized Python environment and symlinks the entrypoint binary into `~/.local/bin`. Ensure this directory is prioritized in your system `$PATH`.*
6773

68-
-----
74+
---
6975

7076
### Shell Autocompletion
7177

@@ -96,25 +102,17 @@ compinit
96102

97103
#### 2. Bash
98104

99-
To enable Bash completions, you need to source the included `focal.bash` script.
100-
101-
**If installed via Homebrew:**
102-
103-
Homebrew routes the completion file automatically. Ensure you have `bash-completion` installed and configured in your profile.
104-
105-
**If installed from source:**
106-
107-
Point directly to the completion file in your `~/.bashrc` or `~/.bash_profile`:
105+
To enable Bash completions, you need to source the included `focal.bash` script. Point directly to the completion file in your `~/.bashrc` or `~/.bash_profile`:
108106

109107
```bash
110108
source ~/.local/share/focal/completions/focal.bash # Adjust path if cloned elsewhere
111109
```
112110

113-
-----
111+
---
114112

115113
## 🚀 Usage
116114

117-
Focal is designed to be run from anywhere inside a valid Git workspace.
115+
Focal is designed to be run from anywhere inside a valid Git workspace, but also handles external URLs and clipboard streams.
118116

119117
### Basic Context Gathering
120118

@@ -128,49 +126,75 @@ focal file
128126
focal files
129127
```
130128

131-
### Advanced Git & GitHub Context
129+
### Git & Working Tree
132130

133131
To grab the exact state of your current feature branch (uncommitted changes, commit topology, microscopic diffs) compared to `main`:
134132

135133
```bash
136134
focal wip-context
137135
```
138136

137+
To quickly grab the diff of your currently staged or uncommitted files:
138+
139+
```bash
140+
focal diff --staged
141+
```
142+
143+
### Web & Documentation Context
144+
145+
You can pipe a library's documentation page directly to your clipboard, stripped of all DOM noise (navbars, scripts, footers):
146+
147+
```bash
148+
# Fetch from a public URL
149+
focal web https://docs.python.org/3/
150+
151+
# Parse an authenticated dashboard copied to your clipboard
152+
pbpaste | focal web
153+
```
154+
155+
### GitHub API Context
156+
139157
Need to debug why your GitHub Actions pipeline crashed? Grab the error logs and metadata instantly:
140158

141159
```bash
142160
focal ci-fail
143161
```
144162

145-
*Result: Focal fetches the failed run via `gh`, formats the raw logs into an LLM-friendly markdown block, calculates the token estimate, and copies it to your clipboard.*
163+
To aggregate a release context by compiling all pull request intents merged since the last Git tag:
164+
165+
```bash
166+
focal release-context
167+
```
146168

147-
-----
169+
---
148170

149171
## 🛠 Command Reference
150172

151-
### Local Context Gathering
173+
### Local & Web Context Gathering
152174

153175
| Command | Description |
154-
| :--- | :--- |
176+
| --- | --- |
155177
| `focal file` | Interactively selects a single file and copies its formatted contents. |
156178
| `focal files` | Interactively (or via glob) selects multiple files and copies contents + metadata. |
157179
| `focal context` | Generates a high-level project summary (tree, git status, dependency manifests). |
158180
| `focal tree` | Generates and copies the repository directory tree, ignoring `.git` and build caches. |
159181
| `focal api` | Extracts an overview of Python classes and functions using `ripgrep`. |
160182
| `focal search` | Searches the codebase for a regex pattern and copies the results with surrounding context. |
161183
| `focal symbol` | Locates files containing a specific symbol and copies their full contents. |
162-
| `focal ast` | Searches the codebase using an abstract syntax tree pattern (requires `ast-grep`). |
184+
| `focal web` | Extracts semantic markdown from public URLs or piped HTML, stripping DOM noise. |
163185

164186
### Git & GitHub Extraction
165187

166188
| Command | Description |
167-
| :--- | :--- |
189+
| --- | --- |
168190
| `focal wip-context` | Extracts a comprehensive diff, uncommitted status, and topological context for your active branch. |
191+
| `focal diff` | Copies a formatted git diff of uncommitted or staged (`--staged`) changes. |
169192
| `focal pr-diff` | Fetches metadata, description intent, and the full code diff for a GitHub Pull Request. |
170193
| `focal issue-graph` | Copies a GitHub issue description alongside its sequential comment thread. |
194+
| `focal release-context` | Copies metadata and intent for all PRs merged since the last release tag. |
171195
| `focal ci-fail` | Fetches and formats GitHub Actions CI failure logs for debugging. |
172196

173-
-----
197+
---
174198

175199
## ⚙️ Dependencies & Toolchain
176200

@@ -180,16 +204,15 @@ Focal orchestrates several industry-standard CLI tools to achieve low-latency ex
180204
- **`fd`**: Required for high-speed file traversal (respects `.gitignore`).
181205
- **`bat`**: Required for syntax-highlighted TUI previews.
182206
- **`rg` (ripgrep)**: Required for the `search`, `api`, and `symbol` regex extractors.
183-
- **`gh` (GitHub CLI)**: Required for `pr-diff`, `issue-graph`, and `ci-fail`.
184-
- **`ast-grep`**: Required for semantic AST searching (`focal ast`).
207+
- **`gh` (GitHub CLI)**: Required for `pr-diff`, `issue-graph`, `ci-fail`, and `release-context`.
185208

186-
-----
209+
---
187210

188211
## 🤝 Collaboration
189212

190213
This repository utilizes a dual-language testing and linting architecture.
191214

192-
- **Python:** 100% type-hinted via `mypy`, formatted with `ruff`, and tested with `pytest`. Notebook parsing uses `nbformat` to safely construct ASTs.
215+
- **Python:** 100% type-hinted via `mypy`, formatted with `ruff`, and tested with `pytest`. Parsing pipelines utilize `beautifulsoup4` and `markdownify` for AST and DOM manipulation.
193216
- **Bash:** Strictly linted via `shellcheck`, formatted with `shfmt`, and behaviorally tested using the `bats` framework.
194217

195218
To run the complete local CI pipeline before submitting a pull request:
@@ -200,15 +223,15 @@ just ci
200223

201224
Please feel free to open an issue or PR if you'd like to see a specific context extractor added to the suite.
202225

203-
## 📧 Contact
226+
---
204227

205-
### Jackson Ferguson
228+
## 📧 Contact
206229

207-
- **GitHub:** [@JacksonFergusonDev](https://github.com/JacksonFergusonDev)
208-
- **LinkedIn:** [Jackson Ferguson](https://www.linkedin.com/in/jackson--ferguson/)
209-
- **Email:** [[email protected]](mailto:[email protected])
230+
[![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/JacksonFergusonDev)
231+
[![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jackson--ferguson/)
232+
[![Email](https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:[email protected])
210233

211-
-----
234+
---
212235

213236
## 📄 License
214237

0 commit comments

Comments
 (0)