Skip to content

Commit 24a7c1e

Browse files
committed
fix(code-evidence): skip uv when code-finder is already installed
uv run --with code-finder creates an ephemeral environment every time, ignoring locally pip-installed packages. This triggers ~1GB of downloads (torch, scipy, scikit-learn, etc.) on first run per Python version. Now both code-evidence skills check if code-finder is importable first and only fall back to uv when it's not installed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
1 parent 65b1de8 commit 24a7c1e

3 files changed

Lines changed: 35 additions & 9 deletions

File tree

plugins/docs-tools/.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "docs-tools",
3-
"version": "0.0.40",
3+
"version": "0.0.41",
44
"description": "Documentation review, writing, and workflow tools for Red Hat AsciiDoc and Markdown documentation.",
55
"author": {
66
"name": "Red Hat Documentation Team",

plugins/docs-tools/skills/code-evidence/SKILL.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Uses hybrid search: BM25 for exact keyword matches + vector embeddings for seman
1616

1717
## Prerequisites
1818

19-
- **uv** must be installed: `brew install uv` (macOS) or see https://docs.astral.sh/uv/getting-started/installation/
20-
- **code-finder** is installed automatically at runtime via `uv run --with code-finder`. No manual pip install required.
19+
- **code-finder** Python package. Install once with `python3 -m pip install code-finder`, or let the skill auto-install via `uv run --with code-finder` (requires **uv**: `brew install uv` on macOS, or see https://docs.astral.sh/uv/getting-started/installation/)
2120
- The wrapper script at `${CLAUDE_PLUGIN_ROOT}/skills/docs-workflow-code-evidence/scripts/find_evidence.py` calls the code-finder Python API directly (no CLI entry point required)
2221

2322
## Arguments
@@ -41,23 +40,34 @@ Validate:
4140

4241
### 2. Run evidence retrieval
4342

43+
First, check if code-finder is already installed:
44+
4445
```bash
45-
uv run --with code-finder python3 ${CLAUDE_PLUGIN_ROOT}/skills/docs-workflow-code-evidence/scripts/find_evidence.py \
46+
python3 -c "import claude_context" 2>/dev/null && echo "INSTALLED" || echo "NOT_INSTALLED"
47+
```
48+
49+
Use the appropriate command based on the result. If **INSTALLED**, run directly (avoids re-downloading ~1GB of ML dependencies). If **NOT_INSTALLED**, prefix with `uv run --with code-finder`.
50+
51+
**Direct (code-finder installed):**
52+
53+
```bash
54+
python3 ${CLAUDE_PLUGIN_ROOT}/skills/docs-workflow-code-evidence/scripts/find_evidence.py \
4655
--repo "<REPO_PATH>" \
4756
--query "<QUERY>" \
4857
--limit <LIMIT>
4958
```
5059

51-
If `--filter-paths` was provided:
60+
**Fallback (via uv):**
5261

5362
```bash
5463
uv run --with code-finder python3 ${CLAUDE_PLUGIN_ROOT}/skills/docs-workflow-code-evidence/scripts/find_evidence.py \
5564
--repo "<REPO_PATH>" \
5665
--query "<QUERY>" \
57-
--limit <LIMIT> \
58-
--filter-paths <FILTER_PATHS>
66+
--limit <LIMIT>
5967
```
6068

69+
If `--filter-paths` was provided, add `--filter-paths <FILTER_PATHS>` to the command.
70+
6171
If `--reindex` was provided, add `--reindex` to the command.
6272

6373
### 3. Present results

plugins/docs-tools/skills/docs-workflow-code-evidence/SKILL.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ The writer typically works from the **documentation repository**, not the code r
1818

1919
## Prerequisites
2020

21-
- **uv** must be installed: `brew install uv` (macOS) or see https://docs.astral.sh/uv/getting-started/installation/
22-
- **code-finder** is installed automatically at runtime via `uv run --with code-finder`. No manual pip install required.
21+
- **code-finder** Python package. Install once with `python3 -m pip install code-finder`, or let the skill auto-install via `uv run --with code-finder` (requires **uv**: `brew install uv` on macOS, or see https://docs.astral.sh/uv/getting-started/installation/)
2322
- The wrapper script `scripts/find_evidence.py` calls the code-finder Python API directly (no CLI entry point required)
2423

2524
## Arguments
@@ -129,6 +128,23 @@ For each search query derived from the plan, add **two entries**:
129128

130129
#### 5b. Run batch retrieval
131130

131+
First, check if code-finder is already installed:
132+
133+
```bash
134+
python3 -c "import claude_context" 2>/dev/null && echo "INSTALLED" || echo "NOT_INSTALLED"
135+
```
136+
137+
If **INSTALLED**, run directly (avoids re-downloading ~1GB of ML dependencies):
138+
139+
```bash
140+
python3 scripts/find_evidence.py \
141+
--repo "$REPO_PATH" \
142+
--queries-file "${OUTPUT_DIR}/queries.json" \
143+
--limit <LIMIT>
144+
```
145+
146+
If **NOT_INSTALLED**, fall back to uv:
147+
132148
```bash
133149
uv run --with code-finder python3 scripts/find_evidence.py \
134150
--repo "$REPO_PATH" \

0 commit comments

Comments
 (0)