From 6b273740dd1de73345fa5eefc1210cfca6869eed Mon Sep 17 00:00:00 2001 From: woozu-shin Date: Sat, 28 Mar 2026 14:46:11 +0900 Subject: [PATCH] style: apply prettier formatting from pre-commit hook Co-Authored-By: Claude Opus 4.6 (1M context) --- src/claw-skill.test.ts | 62 +++++++++++++++++++---------------- src/container-runtime.test.ts | 19 ++++++----- src/ipc.ts | 6 ++-- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/claw-skill.test.ts b/src/claw-skill.test.ts index 2d86c8e..d0b2669 100644 --- a/src/claw-skill.test.ts +++ b/src/claw-skill.test.ts @@ -6,40 +6,46 @@ import { spawnSync } from 'child_process'; import { describe, expect, it } from 'vitest'; describe('claw skill script', () => { - it('exits zero after successful structured output even if the runtime is terminated', { timeout: 20000 }, () => { - const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'claw-skill-test-')); - const binDir = path.join(tempDir, 'bin'); - fs.mkdirSync(binDir, { recursive: true }); + it( + 'exits zero after successful structured output even if the runtime is terminated', + { timeout: 20000 }, + () => { + const tempDir = fs.mkdtempSync( + path.join(os.tmpdir(), 'claw-skill-test-'), + ); + const binDir = path.join(tempDir, 'bin'); + fs.mkdirSync(binDir, { recursive: true }); - const runtimePath = path.join(binDir, 'container'); - fs.writeFileSync( - runtimePath, - `#!/bin/sh + const runtimePath = path.join(binDir, 'container'); + fs.writeFileSync( + runtimePath, + `#!/bin/sh cat >/dev/null printf '%s\n' '---NANOCLAW_OUTPUT_START---' '{"status":"success","result":"4","newSessionId":"sess-1"}' '---NANOCLAW_OUTPUT_END---' sleep 30 `, - ); - fs.chmodSync(runtimePath, 0o755); + ); + fs.chmodSync(runtimePath, 0o755); - const result = spawnSync( - 'python3', - ['.claude/skills/claw/scripts/claw', '-j', 'tg:123', 'What is 2+2?'], - { - cwd: process.cwd(), - encoding: 'utf8', - env: { - ...process.env, - NANOCLAW_DIR: tempDir, - PATH: `${binDir}:${process.env.PATH || ''}`, + const result = spawnSync( + 'python3', + ['.claude/skills/claw/scripts/claw', '-j', 'tg:123', 'What is 2+2?'], + { + cwd: process.cwd(), + encoding: 'utf8', + env: { + ...process.env, + NANOCLAW_DIR: tempDir, + PATH: `${binDir}:${process.env.PATH || ''}`, + }, + timeout: 15000, }, - timeout: 15000, - }, - ); + ); - expect(result.status).toBe(0); - expect(result.signal).toBeNull(); - expect(result.stdout).toContain('4'); - expect(result.stderr).toContain('[session: sess-1]'); - }); + expect(result.status).toBe(0); + expect(result.signal).toBeNull(); + expect(result.stdout).toContain('4'); + expect(result.stderr).toContain('[session: sess-1]'); + }, + ); }); diff --git a/src/container-runtime.test.ts b/src/container-runtime.test.ts index 0905b50..cebf0e6 100644 --- a/src/container-runtime.test.ts +++ b/src/container-runtime.test.ts @@ -51,8 +51,12 @@ describe('stopContainer', () => { }); it('rejects names with shell metacharacters', () => { - expect(() => stopContainer('foo; rm -rf /')).toThrow('Invalid container name'); - expect(() => stopContainer('foo$(whoami)')).toThrow('Invalid container name'); + expect(() => stopContainer('foo; rm -rf /')).toThrow( + 'Invalid container name', + ); + expect(() => stopContainer('foo$(whoami)')).toThrow( + 'Invalid container name', + ); expect(() => stopContainer('foo`id`')).toThrow('Invalid container name'); expect(mockExecSync).not.toHaveBeenCalled(); }); @@ -67,13 +71,10 @@ describe('ensureContainerRuntimeRunning', () => { ensureContainerRuntimeRunning(); expect(mockExecSync).toHaveBeenCalledTimes(1); - expect(mockExecSync).toHaveBeenCalledWith( - `${CONTAINER_RUNTIME_BIN} info`, - { stdio: 'pipe' }, - ); - expect(logger.debug).toHaveBeenCalledWith( - 'Docker runtime already running', - ); + expect(mockExecSync).toHaveBeenCalledWith(`${CONTAINER_RUNTIME_BIN} info`, { + stdio: 'pipe', + }); + expect(logger.debug).toHaveBeenCalledWith('Docker runtime already running'); }); it('throws when docker info fails', () => { diff --git a/src/ipc.ts b/src/ipc.ts index 984f850..2045539 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -442,9 +442,9 @@ export async function processTaskIpc( ); break; } - // Defense in depth: agent cannot set isMain via IPC. - // Preserve isMain from the existing registration so IPC config - // updates (e.g. adding additionalMounts) don't strip the flag. + // Defense in depth: agent cannot set isMain via IPC. + // Preserve isMain from the existing registration so IPC config + // updates (e.g. adding additionalMounts) don't strip the flag. const existingGroup = registeredGroups[data.jid]; deps.registerGroup(data.jid, { name: data.name,