fix(lint): resolve unused variables and unexpected console logs

This commit is contained in:
Taylor Mullen
2026-02-14 12:14:40 -08:00
parent 2a7f936a7c
commit 533ea600c0
3 changed files with 44 additions and 55 deletions
+38 -42
View File
@@ -43,10 +43,10 @@ describe('Hooks System Integration', () => {
'should block tool execution when hook returns block decision',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
BeforeTool: [
{
matcher: 'write_file',
@@ -99,10 +99,6 @@ describe('Hooks System Integration', () => {
);
const blockMsg = 'File writing blocked by security policy';
const blockJson = JSON.stringify({
decision: 'deny',
reason: blockMsg,
});
const scriptPath = rig.createScript(
'stderr_block_hook.cjs',
@@ -114,8 +110,8 @@ describe('Hooks System Integration', () => {
{
settings: {
hooksConfig: {
enabled: true,
},
enabled: true,
},
hooks: {
BeforeTool: [
{
@@ -161,9 +157,9 @@ describe('Hooks System Integration', () => {
log.hookCall.stderr.includes('"decision":"deny"')),
);
expect(blockHook).toBeDefined();
expect(
blockHook?.hookCall.stdout + blockHook?.hookCall.stderr,
).toContain(blockMsg);
expect(blockHook?.hookCall.stdout + blockHook?.hookCall.stderr).toContain(
blockMsg,
);
});
it('should allow tool execution when hook returns allow decision', async () => {
@@ -186,10 +182,10 @@ describe('Hooks System Integration', () => {
'should allow tool execution when hook returns allow decision',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
BeforeTool: [
{
matcher: 'write_file',
@@ -384,10 +380,10 @@ console.log(JSON.stringify({
'should block model execution when BeforeModel hook returns deny decision',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
BeforeModel: [
{
sequential: true,
@@ -432,10 +428,10 @@ console.log(JSON.stringify({
'should block model execution when BeforeModel hook returns block decision',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
BeforeModel: [
{
sequential: true,
@@ -499,10 +495,10 @@ console.log(JSON.stringify({
rig.setup('should modify LLM responses with AfterModel hooks', {
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
AfterModel: [
{
hooks: [
@@ -924,10 +920,10 @@ try {
'should treat mixed stdout (text + JSON) as system message and allow execution when exit code is 0',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
BeforeTool: [
{
matcher: 'write_file',
@@ -1388,10 +1384,10 @@ console.log(JSON.stringify({
'should fire SessionStart hook and display systemMessage in interactive mode',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
SessionStart: [
{
matcher: 'startup',
@@ -1472,10 +1468,10 @@ console.log(JSON.stringify({
'should fire SessionEnd and SessionStart hooks on /clear command',
{
settings: {
hooksConfig: {
enabled: true,
},
hooks: {
hooksConfig: {
enabled: true,
},
hooks: {
SessionEnd: [
{
matcher: '*',
@@ -1676,7 +1672,7 @@ console.log(JSON.stringify({
// Configure automatic compression with a very low threshold
// This will trigger auto-compression after the first response
contextCompression: {
// enabled: true,
// enabled: true,
targetTokenCount: 10, // Very low threshold to trigger compression
},
},
-3
View File
@@ -332,9 +332,6 @@ export class HookRunner {
stderr += data.toString();
});
child.on('exit', (code, signal) => {
});
// Handle process exit
child.on('close', (exitCode) => {
clearTimeout(timeoutHandle);
+6 -10
View File
@@ -360,11 +360,9 @@ export class PolicyEngine {
);
if (match) {
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
console.log(
`[PolicyEngine.check] MATCHED rule: toolName=${rule.toolName}, decision=${rule.decision}, priority=${rule.priority}, source=${rule.source}`,
);
}
debugLogger.log(
`[PolicyEngine.check] MATCHED rule: toolName=${rule.toolName}, decision=${rule.decision}, priority=${rule.priority}, source=${rule.source}`,
);
if (isShellCommand && toolName) {
const shellResult = await this.checkShellCommand(
@@ -391,11 +389,9 @@ export class PolicyEngine {
// Default if no rule matched
if (decision === undefined) {
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
console.log(
`[PolicyEngine.check] NO MATCH - using default decision: ${this.defaultDecision}`,
);
}
debugLogger.log(
`[PolicyEngine.check] NO MATCH - using default decision: ${this.defaultDecision}`,
);
if (toolName && SHELL_TOOL_NAMES.includes(toolName)) {
const shellResult = await this.checkShellCommand(
toolName,