.cursor/skills/xfi-consistency-testing/SKILL.md
Guide for ensuring CLI and VSCode extension produce identical analysis results. Use when verifying CLI-Extension parity, debugging output differences, or setting up consistency checks.
npx skillsauth add zotoio/x-fidelity xfi-consistency-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill guides you through ensuring X-Fidelity CLI and VSCode extension produce identical results.
The CLI and VSCode extension should always produce identical analysis results:
Inconsistency indicates a bug that must be fixed before release.
Consistency Verification:
- [ ] Build all packages
- [ ] Run CLI analysis
- [ ] Run VSCode extension analysis
- [ ] Compare issue counts
- [ ] Compare issue locations
- [ ] Verify severity levels match
# Build everything from workspace root
yarn build
# Or clean build
yarn build:clean
# Navigate to test workspace
cd packages/x-fidelity-fixtures/node-fullstack
# Run CLI with vscode mode (clean JSON output)
npx xfi --mode vscode --archetype node-fullstack > cli-results.json
# Or with human-readable output
npx xfi --mode cli --archetype node-fullstack
packages/x-fidelity-fixtures/node-fullstack in VSCodeWhat to Compare:
| Aspect | CLI | VSCode | |--------|-----|--------| | Total issues | Count from JSON/output | Tree view count | | Issue files | File paths in results | Files in tree view | | Issue locations | Line:column in results | Diagnostic ranges | | Severity | warning/fatality | warning/error icons |
Expected Outcome:
Integration tests for consistency live in:
packages/x-fidelity-vscode/src/test/integration/
├── analysis-completion.test.ts # Verifies analysis runs
├── diagnostics.test.ts # Verifies diagnostics match
└── rule-validation.test.ts # Verifies rules evaluate correctly
# Run VSCode extension integration tests
yarn workspace x-fidelity-vscode test:integration
# Run all VSCode tests
yarn workspace x-fidelity-vscode test:all
import * as vscode from 'vscode';
import { execSync } from 'child_process';
test('CLI and extension should produce matching results', async function() {
// Run CLI analysis
const cliOutput = execSync(
'npx xfi --mode vscode --archetype node-fullstack',
{ cwd: workspacePath, encoding: 'utf8' }
);
const cliResults = JSON.parse(cliOutput);
// Get extension results
await vscode.commands.executeCommand('xfidelity.runAnalysis');
const extensionResults = await vscode.commands.executeCommand(
'xfidelity.getTestResults'
);
// Compare
expect(extensionResults.summary.totalIssues)
.toBe(cliResults.summary.totalIssues);
});
Symptoms: CLI finds more/fewer issues than extension
Causes:
Debug:
# Check CLI working directory
pwd
# Verify archetype in both
xfi --debug 2>&1 | grep archetype
# Check VSCode Output panel for archetype detection
Symptoms: Same issues but different paths
Causes:
Solution: Normalize paths before comparison:
const normalize = (p: string) => path.resolve(p).toLowerCase();
Symptoms: Issues on different lines
Causes:
Debug:
# Ensure both use same file content
git status # No uncommitted changes
yarn build # Fresh build
Symptoms: CLI finds issues, VSCode shows none
Causes:
Check:
// Verify diagnostics collection
const diagnostics = vscode.languages.getDiagnostics();
for (const [uri, diags] of diagnostics) {
console.log(`${uri.path}: ${diags.length} issues`);
}
The standard test workspace is:
packages/x-fidelity-fixtures/node-fullstack/
This workspace contains:
Consistency is checked in CI:
.github/workflows/vscode-extension-ci.ymlConsistency test reports are saved as artifacts:
# CLI with full debug
xfi --debug --mode vscode 2>&1 | tee cli-debug.log
# VSCode: Enable debug logging
# Output panel > X-Fidelity Debug
# Save both outputs
xfi --mode vscode > cli.json
# Export extension results via command
# Diff the outputs
diff cli.json extension.json
# Find issue in CLI output
grep "specificRule" cli.json
# Find in VSCode
# Tree view > expand issue > check details
| Purpose | Location |
|---------|----------|
| Test workspace | packages/x-fidelity-fixtures/node-fullstack/ |
| Integration tests | packages/x-fidelity-vscode/src/test/integration/ |
| Test helpers | packages/x-fidelity-vscode/src/test/helpers/testHelpers.ts |
| CI workflow | .github/workflows/vscode-extension-ci.yml |
| Extension tests | packages/x-fidelity-vscode/src/test/ |
documentation
Guide for managing X-Fidelity releases using the unified release system. Use when releasing, versioning, troubleshooting release issues, or writing commit messages.
documentation
Guide for executing engineering plans through coordinated subagent work. Use when executing existing plans from knowledge/plans/ directory.
development
Guide for updating X-Fidelity documentation including README and website. Use when updating docs, adding new features to documentation, or ensuring docs stay in sync with code.
tools
Guide for debugging X-Fidelity analysis issues. Use when troubleshooting analysis failures, rule evaluation problems, VSCode extension issues, or unexpected results.