Skip to content

Commit 27027e5

Browse files
committed
refactor: address all the issues identified during Copilot review
1 parent bd5627b commit 27027e5

File tree

4 files changed

+49
-16
lines changed

4 files changed

+49
-16
lines changed

.claude/skills/AUTO_UPDATE.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The QSV MCP Server includes a comprehensive auto-update system that keeps your s
1414
2. **Skill Definitions Updates**
1515
- Auto-detected when qsv version changes
1616
- Can be auto-regenerated (if configured)
17-
- Manual regeneration: `cargo run --bin qsv-skill-gen --features all_features`
17+
- Manual regeneration: `qsv --update-mcp-skills`
1818

1919
3. **MCP Server Code Updates**
2020
- Checked against GitHub releases
@@ -135,13 +135,8 @@ jobs:
135135
unzip qsv-linux-x86_64.zip
136136
sudo mv qsv /usr/local/bin/
137137
138-
- name: Install Rust
139-
uses: actions-rs/toolchain@v1
140-
with:
141-
toolchain: stable
142-
143138
- name: Regenerate skills
144-
run: cargo run --bin qsv-skill-gen --features all_features
139+
run: qsv --update-mcp-skills
145140

146141
- name: Build MCP server
147142
run: |
@@ -229,11 +224,34 @@ This file is automatically managed and helps track update history.
229224

230225
**Solution**:
231226
- Verify qsv binary location: `which qsv`
232-
- Test manual regeneration: `qsv --update-mcp-skills`
227+
- Ensure you're in the qsv repository: `pwd` (should show path ending in `/qsv`)
228+
- Test manual regeneration: `cd /path/to/qsv && qsv --update-mcp-skills`
233229
- Check if binary has mcp feature: `qsv --version` (shows installed features)
234230
- Check MCP server logs: `~/Library/Logs/Claude/mcp*.log`
235231
- If flag not available, rebuild qsv: `cargo build --release --features all_features`
236232

233+
### "Could not find qsv repository root" error
234+
235+
**Problem**: Running `qsv --update-mcp-skills` fails with "Could not find qsv repository root"
236+
237+
**Cause**: The command must be run from within the qsv repository directory structure (where `Cargo.toml` and `src/cmd` exist). This is because the skill generation writes to `.claude/skills/qsv/` relative to the repository root.
238+
239+
**Solution**:
240+
1. **If you installed qsv via package manager** (Homebrew, cargo install, etc.):
241+
- Clone the qsv repository: `git clone https://github.com/dathere/qsv.git`
242+
- Navigate into it: `cd qsv`
243+
- Run: `qsv --update-mcp-skills`
244+
245+
2. **If you built qsv from source**:
246+
- Navigate to your qsv repository directory: `cd /path/to/qsv`
247+
- Verify you're in the right place: `ls Cargo.toml src/cmd` (both should exist)
248+
- Run: `qsv --update-mcp-skills`
249+
250+
3. **For auto-regeneration**:
251+
- The MCP server must have access to the repository directory
252+
- Auto-regeneration will fail if the qsv binary can't find the repository
253+
- Consider using manual regeneration workflow if binary is installed system-wide
254+
237255
### Version check fails
238256

239257
**Problem**: Update checker reports errors
@@ -271,6 +289,10 @@ The update check runs asynchronously and doesn't block MCP server startup.
271289
- **qsv binary** with "mcp" feature enabled
272290
- Included in prebuilt binaries from GitHub releases
273291
- When building from source: Use `cargo build --release --features all_features`
292+
- **qsv repository** cloned locally
293+
- The `--update-mcp-skills` command must be run from within the repository
294+
- Outputs to `.claude/skills/qsv/` relative to repository root
295+
- Clone with: `git clone https://github.com/dathere/qsv.git`
274296
- **Node.js** >= 18.0.0 (for MCP server)
275297

276298
## Best Practices

.claude/skills/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ Each skill JSON file follows this structure:
222222
Skills are auto-generated from qsv command USAGE text using the `--update-mcp-skills` flag:
223223

224224
```bash
225-
# Generate all 66 skills
225+
# Must be run from within the qsv repository directory
226+
cd /path/to/qsv
226227
qsv --update-mcp-skills
227228

228229
# Output: .claude/skills/qsv/*.json
@@ -364,7 +365,8 @@ npm test # Basic skill usage
364365
npm run test-pipeline # Pipeline composition
365366
npm run mcp:install # Install MCP server for Claude Desktop
366367

367-
# Regenerate skills
368+
# Regenerate skills (from qsv repository root)
369+
cd /path/to/qsv
368370
qsv --update-mcp-skills
369371
```
370372

.claude/skills/UPDATE_SYSTEM_SUMMARY.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Implemented a comprehensive auto-update system for the QSV MCP Server that keeps
2121
- `getSkillsVersion()` - Get version skills were generated with
2222
- `quickCheck()` - Fast local version comparison (no network)
2323
- `checkForUpdates()` - Full check including GitHub API
24-
- `autoRegenerateSkills()` - Auto-run qsv-skill-gen if configured
24+
- `autoRegenerateSkills()` - Auto-run `qsv --update-mcp-skills` if configured
2525

2626
### 2. Integration with MCP Server (`src/mcp-server.ts`)
2727

@@ -79,7 +79,7 @@ Created comprehensive documentation:
7979
1. User updates qsv: `qsv --update`
8080
2. MCP server detects mismatch on next startup
8181
3. Logs show clear instructions to regenerate
82-
4. User runs: `cargo run --bin qsv-skill-gen --features all_features`
82+
4. User runs: `qsv --update-mcp-skills`
8383
5. Restart Claude Desktop
8484

8585
**Output example**:
@@ -89,7 +89,7 @@ Created comprehensive documentation:
8989
Skills generated with: 0.132.0
9090
9191
ℹ️ To update skills manually, run:
92-
cargo run --bin qsv-skill-gen --features all_features
92+
qsv --update-mcp-skills
9393
Then restart the MCP server
9494
```
9595

@@ -100,7 +100,7 @@ Created comprehensive documentation:
100100
**What happens**:
101101
1. User updates qsv: `qsv --update`
102102
2. MCP server detects mismatch on next startup
103-
3. **Automatically** runs qsv-skill-gen (takes ~5-10 seconds)
103+
3. **Automatically** runs `qsv --update-mcp-skills` (takes ~5-10 seconds)
104104
4. Logs show success message
105105
5. User restarts Claude Desktop
106106

src/mcp_skills_gen.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,15 +598,24 @@ pub fn generate_mcp_skills() -> CliResult<()> {
598598
"validate",
599599
];
600600

601-
// Determine repository root - look for Cargo.toml
601+
// Determine repository root - look for Cargo.toml with src/cmd
602+
// This command must be run from within the qsv repository directory
602603
let mut repo_root = std::env::current_dir()?;
603604
loop {
604605
if repo_root.join("Cargo.toml").exists() && repo_root.join("src/cmd").exists() {
605606
break;
606607
}
607608
if !repo_root.pop() {
608609
return fail_clierror!(
609-
"Could not find qsv repository root (no Cargo.toml with src/cmd)"
610+
"Could not find qsv repository root. This command must be run from within \
611+
the qsv repository directory (where Cargo.toml and src/cmd exist).\n\
612+
Current directory: {}\n\
613+
\n\
614+
If you're using a package-installed qsv binary, you need to:\n\
615+
1. Clone the qsv repository: git clone https://github.com/dathere/qsv.git\n\
616+
2. cd into the repository: cd qsv\n\
617+
3. Run: qsv --update-mcp-skills",
618+
std::env::current_dir()?.display()
610619
);
611620
}
612621
}

0 commit comments

Comments
 (0)