Remove unused root Claude guide

This commit is contained in:
ejclaw
2026-04-08 06:46:52 +09:00
parent 9f5533e940
commit 9640d51ff9
8 changed files with 158 additions and 393 deletions

View File

@@ -9,11 +9,6 @@ import {
runHostEvidenceRequest,
writeHostEvidenceResponse,
} from './host-evidence.js';
import {
isVerificationProfile,
runVerificationRequest,
writeVerificationResponse,
} from './verification.js';
import { readJsonFile } from './utils.js';
import { AvailableGroup } from './agent-runner.js';
import {
@@ -642,65 +637,6 @@ export async function processTaskIpc(
}
break;
case 'verification_request':
if (!data.requestId) {
logger.warn(
{ sourceGroup },
'Ignoring verification_request without requestId',
);
break;
}
if (!isVerificationProfile(data.profile)) {
writeVerificationResponse(sourceGroup, {
requestId: data.requestId,
ok: false,
profile: 'test',
command: '',
stdout: '',
stderr: '',
exitCode: 1,
snapshotId: 'unknown',
runtimeVersion: '',
workdir: process.cwd(),
error: `Unsupported verification profile: ${String(data.profile)}`,
});
logger.warn(
{ sourceGroup, requestId: data.requestId, profile: data.profile },
'Rejected unsupported verification profile',
);
break;
}
{
const result = await runVerificationRequest({
requestId: data.requestId,
profile: data.profile,
expectedSnapshotId:
typeof data.expected_snapshot_id === 'string'
? data.expected_snapshot_id
: undefined,
});
writeVerificationResponse(sourceGroup, {
requestId: data.requestId,
...result,
});
logger.info(
{
sourceGroup,
requestId: data.requestId,
profile: data.profile,
ok: result.ok,
exitCode: result.exitCode,
snapshotId: result.snapshotId,
},
'Processed verification request via IPC',
);
}
break;
case 'update_task':
if (data.taskId) {
const task = getTaskById(data.taskId);

View File

@@ -1,127 +0,0 @@
import fs from 'fs';
import path from 'path';
import { beforeEach, describe, expect, it, vi } from 'vitest';
const { runVerificationRequestMock } = vi.hoisted(() => ({
runVerificationRequestMock: vi.fn(),
}));
vi.mock('./verification.js', async () => {
const actual =
await vi.importActual<typeof import('./verification.js')>(
'./verification.js',
);
return {
...actual,
runVerificationRequest: runVerificationRequestMock,
};
});
import { _initTestDatabase, _setRegisteredGroupForTests } from './db.js';
import { resolveGroupIpcPath } from './group-folder.js';
import { processTaskIpc, type IpcDeps } from './ipc.js';
import type { RegisteredGroup } from './types.js';
const VERIFICATION_GROUP: RegisteredGroup = {
name: 'Verification',
folder: 'verification-group',
trigger: '@Andy',
added_at: '2024-01-01T00:00:00.000Z',
};
describe('verification IPC', () => {
let deps: IpcDeps;
beforeEach(() => {
_initTestDatabase();
_setRegisteredGroupForTests('verification@g.us', VERIFICATION_GROUP);
runVerificationRequestMock.mockReset();
deps = {
sendMessage: async () => {},
registeredGroups: () => ({ 'verification@g.us': VERIFICATION_GROUP }),
assignRoom: () => {},
syncGroups: async () => {},
getAvailableGroups: () => [],
writeGroupsSnapshot: () => {},
};
fs.rmSync(resolveGroupIpcPath('verification-group'), {
recursive: true,
force: true,
});
});
it('writes verification responses into the source group namespace', async () => {
runVerificationRequestMock.mockResolvedValue({
ok: true,
profile: 'typecheck',
command: 'npm run typecheck',
stdout: '',
stderr: '',
exitCode: 0,
snapshotId: 'fs:abc123',
runtimeVersion: 'host:bun@test',
});
await processTaskIpc(
{
type: 'verification_request',
requestId: 'req-1',
profile: 'typecheck',
expected_snapshot_id: 'fs:abc123',
},
'verification-group',
false,
deps,
);
const responsePath = path.join(
resolveGroupIpcPath('verification-group'),
'verification-responses',
'req-1.json',
);
const response = JSON.parse(fs.readFileSync(responsePath, 'utf-8')) as {
ok: boolean;
requestId: string;
snapshotId: string;
};
expect(runVerificationRequestMock).toHaveBeenCalledWith({
requestId: 'req-1',
profile: 'typecheck',
expectedSnapshotId: 'fs:abc123',
});
expect(response.requestId).toBe('req-1');
expect(response.ok).toBe(true);
expect(response.snapshotId).toBe('fs:abc123');
});
it('returns an error response for unsupported profiles without executing', async () => {
await processTaskIpc(
{
type: 'verification_request',
requestId: 'req-2',
profile: 'rm -rf /',
},
'verification-group',
false,
deps,
);
const responsePath = path.join(
resolveGroupIpcPath('verification-group'),
'verification-responses',
'req-2.json',
);
const response = JSON.parse(fs.readFileSync(responsePath, 'utf-8')) as {
ok: boolean;
error?: string;
};
expect(runVerificationRequestMock).not.toHaveBeenCalled();
expect(response.ok).toBe(false);
expect(response.error).toContain('Unsupported verification profile');
});
});

View File

@@ -4,16 +4,12 @@ import os from 'os';
import path from 'path';
import { TIMEZONE } from './config.js';
import { resolveGroupIpcPath } from './group-folder.js';
import {
buildWorkspaceScriptCommand,
ensureWorkspaceDependenciesInstalled,
hasInstalledNodeModules,
} from './workspace-package-manager.js';
import {
computeVerificationSnapshotId,
resolveVerificationResponsesDir,
} from '../shared/verification-snapshot.js';
import { computeVerificationSnapshotId } from '../shared/verification-snapshot.js';
export const VERIFICATION_PROFILES = ['test', 'typecheck', 'build'] as const;
@@ -38,10 +34,6 @@ export interface VerificationResult {
error?: string;
}
export interface VerificationResponse extends VerificationResult {
requestId: string;
}
export interface VerificationSnapshot {
snapshotId: string;
}
@@ -393,21 +385,3 @@ export async function runVerificationRequest(
fs.rmSync(directExecution.tempRoot, { recursive: true, force: true });
}
}
export function resolveVerificationResponseDir(groupFolder: string): string {
return resolveVerificationResponsesDir(resolveGroupIpcPath(groupFolder));
}
export function writeVerificationResponse(
groupFolder: string,
response: VerificationResponse,
): string {
const responseDir = resolveVerificationResponseDir(groupFolder);
fs.mkdirSync(responseDir, { recursive: true });
const outputPath = path.join(responseDir, `${response.requestId}.json`);
const tempPath = `${outputPath}.tmp`;
fs.writeFileSync(tempPath, JSON.stringify(response, null, 2));
fs.renameSync(tempPath, outputPath);
return outputPath;
}