mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-18 17:16:46 +03:00
Tighten hook and proxy discovery
AI assistance disclosure: Codex implemented and verified these fixes under maintainer direction.
This commit is contained in:
@@ -1221,6 +1221,39 @@ describe('context.mjs CLI', () => {
|
||||
assert.doesNotMatch(res.stdout, /MANUAL_DETECTOR_REQUIRED:/);
|
||||
});
|
||||
|
||||
it('does not borrow a hook manifest from the invoking workspace when targeting a sibling', () => {
|
||||
const scripts = path.join(scratch, 'bundle', 'skills', 'impeccable', 'scripts');
|
||||
stageContextBundle(scripts, { providerId: 'claude-code' });
|
||||
|
||||
const repo = path.join(scratch, 'repo');
|
||||
const caller = path.join(repo, 'apps', 'marketing');
|
||||
const target = path.join(repo, 'apps', 'dashboard');
|
||||
fs.mkdirSync(path.join(repo, '.git'), { recursive: true });
|
||||
fs.mkdirSync(path.join(caller, '.claude'), { recursive: true });
|
||||
fs.mkdirSync(path.join(target, 'src'), { recursive: true });
|
||||
fs.writeFileSync(path.join(repo, 'package.json'), JSON.stringify({ private: true, workspaces: ['apps/*'] }));
|
||||
fs.writeFileSync(path.join(repo, 'turbo.json'), JSON.stringify({ tasks: {} }));
|
||||
fs.writeFileSync(path.join(caller, 'package.json'), JSON.stringify({ name: 'marketing' }));
|
||||
fs.writeFileSync(path.join(target, 'package.json'), JSON.stringify({ name: 'dashboard' }));
|
||||
fs.writeFileSync(path.join(target, 'PRODUCT.md'), '# Dashboard\n');
|
||||
fs.writeFileSync(path.join(target, 'src', 'App.jsx'), 'export default function App() { return "dashboard"; }\n');
|
||||
fs.writeFileSync(path.join(caller, '.claude', 'settings.local.json'), JSON.stringify({
|
||||
hooks: { Stop: [{ hooks: [{ command: 'node .claude/skills/impeccable/scripts/hook.mjs' }] }] },
|
||||
}));
|
||||
|
||||
const res = spawnSync(process.execPath, [
|
||||
path.join(scripts, 'context.mjs'),
|
||||
'--target',
|
||||
path.join(target, 'src', 'App.jsx'),
|
||||
], {
|
||||
cwd: caller,
|
||||
encoding: 'utf8',
|
||||
env: { ...process.env, IMPECCABLE_NO_UPDATE_CHECK: '1', IMPECCABLE_NO_STALENESS_CHECK: '1' },
|
||||
});
|
||||
assert.equal(res.status, 0, res.stderr);
|
||||
assert.match(res.stdout, /MANUAL_DETECTOR_REQUIRED:/);
|
||||
});
|
||||
|
||||
it('adds no detector directive when a per-edit-only hook is active', () => {
|
||||
const scripts = path.join(scratch, 'bundle', 'skills', 'impeccable', 'scripts');
|
||||
stageContextBundle(scripts, { providerId: 'cursor' });
|
||||
|
||||
Reference in New Issue
Block a user