From cf66b3f70be1a356eaf8602b3b031cf369f64e58 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 29 Jul 2026 11:52:21 +0800 Subject: [PATCH] chore: silence successful hook setup --- packages/rstack/src/setup/index.ts | 8 +------- packages/rstack/tests/cli/setup/index.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/rstack/src/setup/index.ts b/packages/rstack/src/setup/index.ts index c2a2ef1..6b61e0f 100644 --- a/packages/rstack/src/setup/index.ts +++ b/packages/rstack/src/setup/index.ts @@ -29,13 +29,7 @@ export const runSetupCLI = (args: string[]): void => { const result = installHooks(); - if (result.status === 'installed') { - console.log('Git hooks installed.'); - return; - } - - if (result.status === 'unchanged') { - console.log('Git hooks are already installed.'); + if (result.status === 'installed' || result.status === 'unchanged') { return; } diff --git a/packages/rstack/tests/cli/setup/index.test.ts b/packages/rstack/tests/cli/setup/index.test.ts index 02f8b35..109f810 100644 --- a/packages/rstack/tests/cli/setup/index.test.ts +++ b/packages/rstack/tests/cli/setup/index.test.ts @@ -51,16 +51,16 @@ test('rejects unknown setup options', ({ execCli, expect }) => { expect(() => execCli('setup --unknown', { cwd })).toThrow(); }); -test('installs hooks without loading Rstack config', ({ execCli, expect }) => { +test('installs hooks silently without loading Rstack config', ({ execCli, expect }) => { initRepository(); writeFileSync(path.join(cwd, 'rstack.config.ts'), 'throw new Error("must not load");\n'); - expect(execCli('setup', { cwd, env })).toContain('Git hooks installed.'); + expect(execCli('setup', { cwd, env })).toBe(''); expect(git(['config', '--local', '--get', 'core.hooksPath'])).toBe(hooksPath); expect(existsSync(path.join(cwd, hooksPath, 'runner'))).toBe(true); expect(existsSync(path.join(cwd, '.rstack', 'hooks', 'pre-commit'))).toBe(false); - expect(execCli('setup', { cwd, env })).toContain('Git hooks are already installed.'); + expect(execCli('setup', { cwd, env })).toBe(''); }); test('skips non-Git directories without creating files', ({ execCli, expect }) => {