mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-18 18:48:48 +08:00
feat: enhance search, ranking, reranker and CLI tooling across ccw and codex-lens
Major improvements to smart-search, chain-search cascade, ranking pipeline, reranker factory, CLI history store, codex-lens integration, and uv-manager. Simplify command-generator skill by inlining phases. Add comprehensive tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,13 +3,16 @@ import assert from 'node:assert/strict';
|
||||
import { execSync } from 'node:child_process';
|
||||
|
||||
const uvManagerPath = new URL('../dist/utils/uv-manager.js', import.meta.url).href;
|
||||
const pythonUtilsPath = new URL('../dist/utils/python-utils.js', import.meta.url).href;
|
||||
|
||||
describe('CodexLens UV python preference', async () => {
|
||||
let mod;
|
||||
let pythonUtils;
|
||||
const originalPython = process.env.CCW_PYTHON;
|
||||
|
||||
before(async () => {
|
||||
mod = await import(uvManagerPath);
|
||||
pythonUtils = await import(pythonUtilsPath);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -25,6 +28,73 @@ describe('CodexLens UV python preference', async () => {
|
||||
assert.equal(mod.getPreferredCodexLensPythonSpec(), 'C:/Custom/Python/python.exe');
|
||||
});
|
||||
|
||||
it('parses py launcher commands into spawn-safe command specs', () => {
|
||||
const spec = pythonUtils.parsePythonCommandSpec('py -3.11');
|
||||
|
||||
assert.equal(spec.command, 'py');
|
||||
assert.deepEqual(spec.args, ['-3.11']);
|
||||
assert.equal(spec.display, 'py -3.11');
|
||||
});
|
||||
|
||||
it('treats unquoted Windows-style executable paths as a single command', () => {
|
||||
const spec = pythonUtils.parsePythonCommandSpec('C:/Program Files/Python311/python.exe');
|
||||
|
||||
assert.equal(spec.command, 'C:/Program Files/Python311/python.exe');
|
||||
assert.deepEqual(spec.args, []);
|
||||
assert.equal(spec.display, '"C:/Program Files/Python311/python.exe"');
|
||||
});
|
||||
|
||||
it('probes Python launcher versions without opening a shell window', () => {
|
||||
const probeCalls = [];
|
||||
const version = pythonUtils.probePythonCommandVersion(
|
||||
{ command: 'py', args: ['-3.11'], display: 'py -3.11' },
|
||||
(command, args, options) => {
|
||||
probeCalls.push({ command, args, options });
|
||||
return { status: 0, stdout: '', stderr: 'Python 3.11.9\n' };
|
||||
},
|
||||
);
|
||||
|
||||
assert.equal(version, 'Python 3.11.9');
|
||||
assert.equal(probeCalls.length, 1);
|
||||
assert.equal(probeCalls[0].command, 'py');
|
||||
assert.deepEqual(probeCalls[0].args, ['-3.11', '--version']);
|
||||
assert.equal(probeCalls[0].options.shell, false);
|
||||
assert.equal(probeCalls[0].options.windowsHide, true);
|
||||
assert.equal(probeCalls[0].options.env.PYTHONIOENCODING, 'utf-8');
|
||||
});
|
||||
|
||||
it('looks up uv on PATH without spawning a visible shell window', () => {
|
||||
const lookupCalls = [];
|
||||
const found = mod.__testables.findExecutableOnPath('uv', (command, args, options) => {
|
||||
lookupCalls.push({ command, args, options });
|
||||
return { status: 0, stdout: 'C:/Tools/uv.exe\n', stderr: '' };
|
||||
});
|
||||
|
||||
assert.equal(found, 'C:/Tools/uv.exe');
|
||||
assert.equal(lookupCalls.length, 1);
|
||||
assert.equal(lookupCalls[0].command, process.platform === 'win32' ? 'where' : 'which');
|
||||
assert.deepEqual(lookupCalls[0].args, ['uv']);
|
||||
assert.equal(lookupCalls[0].options.shell, false);
|
||||
assert.equal(lookupCalls[0].options.windowsHide, true);
|
||||
assert.equal(lookupCalls[0].options.env.PYTHONIOENCODING, 'utf-8');
|
||||
});
|
||||
|
||||
it('checks Windows launcher preferences with hidden subprocess options', () => {
|
||||
const probeCalls = [];
|
||||
const available = mod.__testables.hasWindowsPythonLauncherVersion('3.11', (command, args, options) => {
|
||||
probeCalls.push({ command, args, options });
|
||||
return { status: 0, stdout: '', stderr: 'Python 3.11.9\n' };
|
||||
});
|
||||
|
||||
assert.equal(available, true);
|
||||
assert.equal(probeCalls.length, 1);
|
||||
assert.equal(probeCalls[0].command, 'py');
|
||||
assert.deepEqual(probeCalls[0].args, ['-3.11', '--version']);
|
||||
assert.equal(probeCalls[0].options.shell, false);
|
||||
assert.equal(probeCalls[0].options.windowsHide, true);
|
||||
assert.equal(probeCalls[0].options.env.PYTHONIOENCODING, 'utf-8');
|
||||
});
|
||||
|
||||
it('prefers Python 3.11 or 3.10 on Windows when available', () => {
|
||||
if (process.platform !== 'win32') return;
|
||||
delete process.env.CCW_PYTHON;
|
||||
|
||||
Reference in New Issue
Block a user