mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Fix: resolve --target once in the context CLI
Reuse the resolved path for loadContext so a bare name does not walk workspace candidates twice. AI assistance: Cursor Grok 4.6 implemented this change. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1166,13 +1166,19 @@ async function cli() {
|
||||
throw err;
|
||||
}
|
||||
const targetProvided = hasTargetOption(cliOptions);
|
||||
const targetExists = targetProvided ? pathExistsForTarget(process.cwd(), cliOptions.targetPath) : null;
|
||||
const resolvedTargetPath = targetProvided
|
||||
? resolveTargetPath(process.cwd(), cliOptions.targetPath)
|
||||
: null;
|
||||
const targetExists = targetProvided ? fs.existsSync(resolvedTargetPath) : null;
|
||||
const selection = resolveTargetSelection(process.cwd(), cliOptions);
|
||||
if (selection) {
|
||||
process.stdout.write(buildTargetSelectionDirective(selection) + '\n');
|
||||
process.exit(0);
|
||||
}
|
||||
const ctx = loadContext(process.cwd(), cliOptions);
|
||||
const ctx = loadContext(
|
||||
process.cwd(),
|
||||
resolvedTargetPath ? { targetPath: resolvedTargetPath } : cliOptions,
|
||||
);
|
||||
const updateDirective = await computeUpdateDirective();
|
||||
|
||||
if (!ctx.hasProduct) {
|
||||
@@ -1286,10 +1292,6 @@ function hasTargetOption(options) {
|
||||
return !!(options && typeof options.targetPath === 'string' && options.targetPath.trim());
|
||||
}
|
||||
|
||||
function pathExistsForTarget(cwd, targetPath) {
|
||||
return fs.existsSync(resolveTargetPath(cwd, targetPath));
|
||||
}
|
||||
|
||||
const HOOK_MANIFESTS_BY_PROVIDER = Object.freeze({
|
||||
'claude-code': ['.claude/settings.local.json', '.claude/settings.json'],
|
||||
codex: ['.codex/hooks.json'],
|
||||
|
||||
Reference in New Issue
Block a user