無用なexportを排除

This commit is contained in:
nrslib 2026-02-12 17:33:39 +09:00
parent cbed66a9ba
commit 7d20c016c7
14 changed files with 23 additions and 44 deletions

View File

@ -3,10 +3,8 @@
*/
import { describe, it, expect } from 'vitest';
import {
detectRuleIndex,
isRegexSafe,
} from '../infra/claude/client.js';
import { isRegexSafe } from '../infra/claude/utils.js';
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
describe('isRegexSafe', () => {
it('should accept simple patterns', () => {

View File

@ -14,7 +14,7 @@ import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
import { detectRuleIndex } from '../infra/claude/index.js';
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
import { makeRule } from './test-helpers.js';
import { callAiJudge } from '../agents/ai-judge.js';

View File

@ -15,7 +15,7 @@ import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
import { detectRuleIndex } from '../infra/claude/index.js';
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
import { makeRule } from './test-helpers.js';
import { callAiJudge } from '../agents/ai-judge.js';

View File

@ -13,7 +13,7 @@ import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import { detectRuleIndex } from '../infra/claude/index.js';
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
import { callAiJudge } from '../agents/ai-judge.js';
// --- Mocks ---

View File

@ -36,7 +36,7 @@ vi.mock('../infra/config/project/projectConfig.js', () => ({
import { evaluateAggregateConditions } from '../core/piece/index.js';
import { detectMatchedRule } from '../core/piece/evaluation/index.js';
import { detectRuleIndex } from '../infra/claude/index.js';
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
import type { RuleMatch, RuleEvaluatorContext } from '../core/piece/index.js';
// --- Test helpers ---

View File

@ -15,7 +15,7 @@ import { join } from 'node:path';
import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
import { detectRuleIndex } from '../infra/claude/index.js';
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
import { makeRule } from './test-helpers.js';
import { callAiJudge } from '../agents/ai-judge.js';

View File

@ -15,11 +15,6 @@ describe('public API exports', () => {
expect(typeof api.decomposeTask).toBe('function');
expect(typeof api.PieceEngine).toBe('function');
expect(typeof api.createInitialState).toBe('function');
expect(typeof api.addUserInput).toBe('function');
expect(typeof api.getPreviousOutput).toBe('function');
expect(api.COMPLETE_MOVEMENT).toBeDefined();
expect(api.ABORT_MOVEMENT).toBeDefined();
expect(typeof api.loadPiece).toBe('function');
expect(typeof api.loadPieceByIdentifier).toBe('function');
@ -43,6 +38,16 @@ describe('public API exports', () => {
expect('ParallelLogger' in api).toBe(false);
expect('InstructionBuilder' in api).toBe(false);
expect('ReportInstructionBuilder' in api).toBe(false);
expect('COMPLETE_MOVEMENT' in api).toBe(false);
expect('ABORT_MOVEMENT' in api).toBe(false);
expect('ERROR_MESSAGES' in api).toBe(false);
expect('determineNextMovementByRules' in api).toBe(false);
expect('extractBlockedPrompt' in api).toBe(false);
expect('LoopDetector' in api).toBe(false);
expect('createInitialState' in api).toBe(false);
expect('addUserInput' in api).toBe(false);
expect('getPreviousOutput' in api).toBe(false);
expect('handleBlocked' in api).toBe(false);
});
it('should not expose infrastructure implementations and internal shared utilities', async () => {

View File

@ -2,7 +2,7 @@
* Type definitions for agent execution
*/
import type { StreamCallback, PermissionHandler, AskUserQuestionHandler } from '../infra/claude/index.js';
import type { StreamCallback, PermissionHandler, AskUserQuestionHandler } from '../infra/claude/types.js';
import type { PermissionMode, Language, McpServerConfig } from '../core/models/index.js';
export type { StreamCallback };

View File

@ -6,7 +6,8 @@ import { readFileSync } from 'node:fs';
import { PieceEngine, type IterationLimitRequest, type UserInputRequest } from '../../../core/piece/index.js';
import type { PieceConfig } from '../../../core/models/index.js';
import type { PieceExecutionResult, PieceExecutionOptions } from './types.js';
import { detectRuleIndex, interruptAllQueries } from '../../../infra/claude/index.js';
import { detectRuleIndex } from '../../../shared/utils/ruleIndex.js';
import { interruptAllQueries } from '../../../infra/claude/query-manager.js';
import { callAiJudge } from '../../../agents/ai-judge.js';
export type { PieceExecutionResult, PieceExecutionOptions };

View File

@ -42,16 +42,6 @@ export {
// Piece engine
export {
PieceEngine,
COMPLETE_MOVEMENT,
ABORT_MOVEMENT,
ERROR_MESSAGES,
determineNextMovementByRules,
extractBlockedPrompt,
LoopDetector,
createInitialState,
addUserInput,
getPreviousOutput,
handleBlocked,
isOutputContractItem,
executeAgent,
generateReport,
@ -67,8 +57,6 @@ export type {
SessionUpdateCallback,
IterationLimitCallback,
PieceEngineOptions,
LoopCheckResult,
ProviderType,
JudgeStatusResult,
BlockedHandlerResult,
} from './core/piece/index.js';

View File

@ -11,7 +11,6 @@ import { createLogger } from '../../shared/utils/index.js';
import { loadTemplate } from '../../shared/prompts/index.js';
export type { ClaudeCallOptions } from './types.js';
export { detectRuleIndex, isRegexSafe } from './utils.js';
const log = createLogger('client');

View File

@ -61,13 +61,5 @@ export {
buildSdkOptions,
} from './options-builder.js';
// Client functions
export {
callClaude,
callClaudeCustom,
callClaudeAgent,
callClaudeSkill,
detectRuleIndex,
isRegexSafe,
} from './client.js';

View File

@ -1,11 +1,6 @@
/**
* Utility functions for Claude client operations.
*
* Stateless helpers for rule detection and regex safety validation.
*/
import { detectRuleIndex } from '../../shared/utils/ruleIndex.js';
export { detectRuleIndex };
/** Validate regex pattern for ReDoS safety */
export function isRegexSafe(pattern: string): boolean {

View File

@ -2,7 +2,8 @@
* Claude provider implementation
*/
import { callClaude, callClaudeCustom, callClaudeAgent, callClaudeSkill, type ClaudeCallOptions } from '../claude/index.js';
import { callClaude, callClaudeCustom, callClaudeAgent, callClaudeSkill } from '../claude/client.js';
import type { ClaudeCallOptions } from '../claude/types.js';
import { resolveAnthropicApiKey } from '../config/index.js';
import type { AgentResponse } from '../../core/models/index.js';
import type { AgentSetup, Provider, ProviderAgent, ProviderCallOptions } from './types.js';