feat(shell-projection): centralize managed hook command policy (#3450)
* feat(shell-projection): route persistent PATH hints through projection seam * refactor(shell-projection): unify managed hook command policy * fix(install): guard malformed settings hooks during uninstall * chore(changeset): add fragment for pr 3450 * fix(install): guard malformed settings hook entries
This commit is contained in:
@@ -17,6 +17,14 @@ const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
const INSTALL_PATH = path.join(__dirname, '..', 'bin', 'install.js');
|
||||
const PROJECTION_PATH = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'get-shit-done',
|
||||
'bin',
|
||||
'lib',
|
||||
'shell-command-projection.cjs',
|
||||
);
|
||||
|
||||
function loadInstaller() {
|
||||
process.env.GSD_TEST_MODE = '1';
|
||||
@@ -34,8 +42,10 @@ function cleanup(dir) {
|
||||
|
||||
describe('installer HOME-relative PATH detection (#2620)', () => {
|
||||
let installer;
|
||||
let projection;
|
||||
before(() => {
|
||||
installer = loadInstaller();
|
||||
projection = require(PROJECTION_PATH);
|
||||
});
|
||||
|
||||
test('homePathCoveredByRc is exported', () => {
|
||||
@@ -257,10 +267,23 @@ describe('installer HOME-relative PATH detection (#2620)', () => {
|
||||
}
|
||||
|
||||
const joined = logs.join('\n');
|
||||
assert.ok(
|
||||
/echo 'export PATH=/.test(joined),
|
||||
`installer should emit absolute export suggestion when rc does not cover globalBin; got:\n${joined}`,
|
||||
assert.equal(
|
||||
typeof projection.projectPersistentPathExportActions,
|
||||
'function',
|
||||
'shell command projection module must export projectPersistentPathExportActions',
|
||||
);
|
||||
const projected = projection.projectPersistentPathExportActions({
|
||||
targetDir: globalBin,
|
||||
platform: process.platform,
|
||||
});
|
||||
assert.ok(Array.isArray(projected.shellActions), 'projected.shellActions must be an array');
|
||||
assert.ok(projected.shellActions.length >= 2, 'expected at least zsh/bash projected actions');
|
||||
for (const action of projected.shellActions) {
|
||||
assert.ok(
|
||||
joined.includes(action.command),
|
||||
`installer should render projected command "${action.command}". Output:\n${joined}`,
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
cleanup(home);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user