無用な後方互換削除

This commit is contained in:
nrslib 2026-02-04 04:04:56 +09:00
parent 6378ee6174
commit 887365c4eb
51 changed files with 72 additions and 178 deletions

View File

@ -14,20 +14,20 @@ import {
type InstructionContext, type InstructionContext,
} from '../core/workflow/index.js'; } from '../core/workflow/index.js';
// Backward-compatible function wrappers for test readability // Function wrappers for test readability
function buildInstruction(step: WorkflowStep, ctx: InstructionContext): string { function buildInstruction(step: WorkflowMovement, ctx: InstructionContext): string {
return new InstructionBuilder(step, ctx).build(); return new InstructionBuilder(step, ctx).build();
} }
function buildReportInstruction(step: WorkflowStep, ctx: ReportInstructionContext): string { function buildReportInstruction(step: WorkflowMovement, ctx: ReportInstructionContext): string {
return new ReportInstructionBuilder(step, ctx).build(); return new ReportInstructionBuilder(step, ctx).build();
} }
function buildStatusJudgmentInstruction(step: WorkflowStep, ctx: StatusJudgmentContext): string { function buildStatusJudgmentInstruction(step: WorkflowMovement, ctx: StatusJudgmentContext): string {
return new StatusJudgmentBuilder(step, ctx).build(); return new StatusJudgmentBuilder(step, ctx).build();
} }
import type { WorkflowStep, WorkflowRule } from '../core/models/index.js'; import type { WorkflowMovement, WorkflowRule } from '../core/models/index.js';
function createMinimalStep(template: string): WorkflowStep { function createMinimalStep(template: string): WorkflowMovement {
return { return {
name: 'test-step', name: 'test-step',
agent: 'test-agent', agent: 'test-agent',

View File

@ -13,7 +13,7 @@ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { tmpdir } from 'node:os'; import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js'; import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import type { WorkflowConfig, WorkflowStep, WorkflowRule } from '../core/models/index.js'; import type { WorkflowConfig, WorkflowMovement, WorkflowRule } from '../core/models/index.js';
import { callAiJudge, detectRuleIndex } from '../infra/claude/index.js'; import { callAiJudge, detectRuleIndex } from '../infra/claude/index.js';
// --- Mocks --- // --- Mocks ---
@ -59,7 +59,7 @@ function makeRule(condition: string, next: string): WorkflowRule {
return { condition, next }; return { condition, next };
} }
function makeMovement(name: string, agentPath: string, rules: WorkflowRule[]): WorkflowStep { function makeMovement(name: string, agentPath: string, rules: WorkflowRule[]): WorkflowMovement {
return { return {
name, name,
agent: `./agents/${name}.md`, agent: `./agents/${name}.md`,

View File

@ -14,7 +14,7 @@ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { tmpdir } from 'node:os'; import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js'; import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import type { WorkflowConfig, WorkflowStep, WorkflowRule } from '../core/models/index.js'; import type { WorkflowConfig, WorkflowMovement, WorkflowRule } from '../core/models/index.js';
import { callAiJudge, detectRuleIndex } from '../infra/claude/index.js'; import { callAiJudge, detectRuleIndex } from '../infra/claude/index.js';
// --- Mocks --- // --- Mocks ---
@ -89,7 +89,7 @@ function makeMovement(
agentPath: string, agentPath: string,
rules: WorkflowRule[], rules: WorkflowRule[],
options: { report?: string | { label: string; path: string }[]; edit?: boolean } = {}, options: { report?: string | { label: string; path: string }[]; edit?: boolean } = {},
): WorkflowStep { ): WorkflowMovement {
return { return {
name, name,
agent: './agents/agent.md', agent: './agents/agent.md',

View File

@ -14,7 +14,7 @@ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { tmpdir } from 'node:os'; import { tmpdir } from 'node:os';
import { setMockScenario, resetScenario } from '../infra/mock/index.js'; import { setMockScenario, resetScenario } from '../infra/mock/index.js';
import type { WorkflowConfig, WorkflowStep, WorkflowRule } from '../core/models/index.js'; import type { WorkflowConfig, WorkflowMovement, WorkflowRule } from '../core/models/index.js';
import { callAiJudge, detectRuleIndex } from '../infra/claude/index.js'; import { callAiJudge, detectRuleIndex } from '../infra/claude/index.js';
// --- Mocks (minimal — only infrastructure, not core logic) --- // --- Mocks (minimal — only infrastructure, not core logic) ---
@ -62,7 +62,7 @@ function makeRule(condition: string, next: string): WorkflowRule {
return { condition, next }; return { condition, next };
} }
function makeMovement(name: string, agentPath: string, rules: WorkflowRule[]): WorkflowStep { function makeMovement(name: string, agentPath: string, rules: WorkflowRule[]): WorkflowMovement {
return { return {
name, name,
agent: `./agents/${name}.md`, agent: `./agents/${name}.md`,

View File

@ -8,9 +8,9 @@
*/ */
import { describe, it, expect } from 'vitest'; import { describe, it, expect } from 'vitest';
import { WorkflowConfigRawSchema, ParallelSubStepRawSchema, WorkflowStepRawSchema } from '../core/models/index.js'; import { WorkflowConfigRawSchema, ParallelSubMovementRawSchema, WorkflowMovementRawSchema } from '../core/models/index.js';
describe('ParallelSubStepRawSchema', () => { describe('ParallelSubMovementRawSchema', () => {
it('should validate a valid parallel sub-movement', () => { it('should validate a valid parallel sub-movement', () => {
const raw = { const raw = {
name: 'arch-review', name: 'arch-review',
@ -18,7 +18,7 @@ describe('ParallelSubStepRawSchema', () => {
instruction_template: 'Review architecture', instruction_template: 'Review architecture',
}; };
const result = ParallelSubStepRawSchema.safeParse(raw); const result = ParallelSubMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
@ -28,7 +28,7 @@ describe('ParallelSubStepRawSchema', () => {
instruction_template: 'Do something', instruction_template: 'Do something',
}; };
const result = ParallelSubStepRawSchema.safeParse(raw); const result = ParallelSubMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
@ -45,7 +45,7 @@ describe('ParallelSubStepRawSchema', () => {
pass_previous_response: false, pass_previous_response: false,
}; };
const result = ParallelSubStepRawSchema.safeParse(raw); const result = ParallelSubMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
if (result.success) { if (result.success) {
expect(result.data.agent_name).toBe('Coder'); expect(result.data.agent_name).toBe('Coder');
@ -65,7 +65,7 @@ describe('ParallelSubStepRawSchema', () => {
], ],
}; };
const result = ParallelSubStepRawSchema.safeParse(raw); const result = ParallelSubMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
if (result.success) { if (result.success) {
expect(result.data.rules).toHaveLength(2); expect(result.data.rules).toHaveLength(2);
@ -73,7 +73,7 @@ describe('ParallelSubStepRawSchema', () => {
}); });
}); });
describe('WorkflowStepRawSchema with parallel', () => { describe('WorkflowMovementRawSchema with parallel', () => {
it('should accept a movement with parallel sub-movements (no agent)', () => { it('should accept a movement with parallel sub-movements (no agent)', () => {
const raw = { const raw = {
name: 'parallel-review', name: 'parallel-review',
@ -86,7 +86,7 @@ describe('WorkflowStepRawSchema with parallel', () => {
], ],
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
@ -96,7 +96,7 @@ describe('WorkflowStepRawSchema with parallel', () => {
instruction_template: 'Do something', instruction_template: 'Do something',
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
@ -107,7 +107,7 @@ describe('WorkflowStepRawSchema with parallel', () => {
instruction_template: 'Code something', instruction_template: 'Code something',
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
@ -117,7 +117,7 @@ describe('WorkflowStepRawSchema with parallel', () => {
parallel: [], parallel: [],
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
}); });
@ -194,7 +194,7 @@ describe('ai() condition in WorkflowRuleSchema', () => {
], ],
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
if (result.success) { if (result.success) {
expect(result.data.rules?.[0].condition).toBe('ai("All reviews approved")'); expect(result.data.rules?.[0].condition).toBe('ai("All reviews approved")');
@ -212,7 +212,7 @@ describe('ai() condition in WorkflowRuleSchema', () => {
], ],
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
}); });
@ -299,7 +299,7 @@ describe('all()/any() aggregate condition regex parsing', () => {
}); });
}); });
describe('all()/any() condition in WorkflowStepRawSchema', () => { describe('all()/any() condition in WorkflowMovementRawSchema', () => {
it('should accept all() condition as a string', () => { it('should accept all() condition as a string', () => {
const raw = { const raw = {
name: 'parallel-review', name: 'parallel-review',
@ -312,7 +312,7 @@ describe('all()/any() condition in WorkflowStepRawSchema', () => {
], ],
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
if (result.success) { if (result.success) {
expect(result.data.rules?.[0].condition).toBe('all("approved")'); expect(result.data.rules?.[0].condition).toBe('all("approved")');
@ -333,7 +333,7 @@ describe('all()/any() condition in WorkflowStepRawSchema', () => {
], ],
}; };
const result = WorkflowStepRawSchema.safeParse(raw); const result = WorkflowMovementRawSchema.safeParse(raw);
expect(result.success).toBe(true); expect(result.success).toBe(true);
}); });
}); });

View File

@ -32,7 +32,7 @@ describe('isWorkflowPath', () => {
it('should return true for home directory paths', () => { it('should return true for home directory paths', () => {
expect(isWorkflowPath('~/workflow.yaml')).toBe(true); expect(isWorkflowPath('~/workflow.yaml')).toBe(true);
expect(isWorkflowPath('~/.takt/workflows/custom.yaml')).toBe(true); expect(isWorkflowPath('~/.takt/pieces/custom.yaml')).toBe(true);
}); });
it('should return true for relative paths starting with ./', () => { it('should return true for relative paths starting with ./', () => {

View File

@ -2,5 +2,5 @@
* Agents module - exports agent execution utilities * Agents module - exports agent execution utilities
*/ */
export { AgentRunner, runAgent, runCustomAgent } from './runner.js'; export { AgentRunner, runAgent } from './runner.js';
export type { RunAgentOptions, StreamCallback } from './types.js'; export type { RunAgentOptions, StreamCallback } from './types.js';

View File

@ -16,7 +16,6 @@ import { createLogger } from '../shared/utils/index.js';
import { loadTemplate } from '../shared/prompts/index.js'; import { loadTemplate } from '../shared/prompts/index.js';
import type { RunAgentOptions } from './types.js'; import type { RunAgentOptions } from './types.js';
// Re-export for backward compatibility
export type { RunAgentOptions, StreamCallback } from './types.js'; export type { RunAgentOptions, StreamCallback } from './types.js';
const log = createLogger('runner'); const log = createLogger('runner');
@ -225,7 +224,7 @@ export class AgentRunner {
} }
} }
// ---- Backward-compatible module-level functions ---- // ---- Module-level function facade ----
const defaultRunner = new AgentRunner(); const defaultRunner = new AgentRunner();
@ -236,11 +235,3 @@ export async function runAgent(
): Promise<AgentResponse> { ): Promise<AgentResponse> {
return defaultRunner.run(agentSpec, task, options); return defaultRunner.run(agentSpec, task, options);
} }
export async function runCustomAgent(
agentConfig: CustomAgentConfig,
task: string,
options: RunAgentOptions,
): Promise<AgentResponse> {
return defaultRunner.runCustom(agentConfig, task, options);
}

View File

@ -10,7 +10,6 @@ export type {
SessionState, SessionState,
WorkflowRule, WorkflowRule,
WorkflowMovement, WorkflowMovement,
WorkflowStep,
LoopDetectionConfig, LoopDetectionConfig,
WorkflowConfig, WorkflowConfig,
WorkflowState, WorkflowState,

View File

@ -158,30 +158,15 @@ export const WorkflowMovementRawSchema = z.object({
parallel: z.array(ParallelSubMovementRawSchema).optional(), parallel: z.array(ParallelSubMovementRawSchema).optional(),
}); });
/** @deprecated Use WorkflowMovementRawSchema instead */ /** Workflow configuration schema - raw YAML format */
export const WorkflowStepRawSchema = WorkflowMovementRawSchema;
/** @deprecated Use ParallelSubMovementRawSchema instead */
export const ParallelSubStepRawSchema = ParallelSubMovementRawSchema;
/** Workflow configuration schema - raw YAML format (accepts both `movements` and legacy `steps`) */
export const WorkflowConfigRawSchema = z.object({ export const WorkflowConfigRawSchema = z.object({
name: z.string().min(1), name: z.string().min(1),
description: z.string().optional(), description: z.string().optional(),
/** Preferred key: movements */ movements: z.array(WorkflowMovementRawSchema).min(1),
movements: z.array(WorkflowMovementRawSchema).min(1).optional(),
/** @deprecated Use `movements` instead */
steps: z.array(WorkflowMovementRawSchema).min(1).optional(),
/** Preferred key: initial_movement */
initial_movement: z.string().optional(), initial_movement: z.string().optional(),
/** @deprecated Use `initial_movement` instead */
initial_step: z.string().optional(),
max_iterations: z.number().int().positive().optional().default(10), max_iterations: z.number().int().positive().optional().default(10),
answer_agent: z.string().optional(), answer_agent: z.string().optional(),
}).refine( });
(data) => (data.movements && data.movements.length > 0) || (data.steps && data.steps.length > 0),
{ message: 'Workflow must have at least one movement (use `movements` or legacy `steps` key)' }
);
/** Custom agent configuration schema */ /** Custom agent configuration schema */
export const CustomAgentConfigSchema = z.object({ export const CustomAgentConfigSchema = z.object({

View File

@ -29,7 +29,6 @@ export type {
ReportConfig, ReportConfig,
ReportObjectConfig, ReportObjectConfig,
WorkflowMovement, WorkflowMovement,
WorkflowStep,
LoopDetectionConfig, LoopDetectionConfig,
WorkflowConfig, WorkflowConfig,
WorkflowState, WorkflowState,

View File

@ -83,9 +83,6 @@ export interface WorkflowMovement {
parallel?: WorkflowMovement[]; parallel?: WorkflowMovement[];
} }
/** @deprecated Use WorkflowMovement instead */
export type WorkflowStep = WorkflowMovement;
/** Loop detection configuration */ /** Loop detection configuration */
export interface LoopDetectionConfig { export interface LoopDetectionConfig {
/** Maximum consecutive runs of the same step before triggering (default: 10) */ /** Maximum consecutive runs of the same step before triggering (default: 10) */

View File

@ -9,11 +9,6 @@
export const COMPLETE_MOVEMENT = 'COMPLETE'; export const COMPLETE_MOVEMENT = 'COMPLETE';
export const ABORT_MOVEMENT = 'ABORT'; export const ABORT_MOVEMENT = 'ABORT';
/** @deprecated Use COMPLETE_MOVEMENT instead */
export const COMPLETE_STEP = COMPLETE_MOVEMENT;
/** @deprecated Use ABORT_MOVEMENT instead */
export const ABORT_STEP = ABORT_MOVEMENT;
/** Maximum user inputs to store */ /** Maximum user inputs to store */
export const MAX_USER_INPUTS = 100; export const MAX_USER_INPUTS = 100;
export const MAX_INPUT_LENGTH = 10000; export const MAX_INPUT_LENGTH = 10000;

View File

@ -32,7 +32,6 @@ import { ParallelRunner } from './ParallelRunner.js';
const log = createLogger('engine'); const log = createLogger('engine');
// Re-export types for backward compatibility
export type { export type {
WorkflowEvents, WorkflowEvents,
UserInputRequest, UserInputRequest,
@ -41,7 +40,7 @@ export type {
IterationLimitCallback, IterationLimitCallback,
WorkflowEngineOptions, WorkflowEngineOptions,
} from '../types.js'; } from '../types.js';
export { COMPLETE_MOVEMENT, ABORT_MOVEMENT, COMPLETE_STEP, ABORT_STEP } from '../constants.js'; export { COMPLETE_MOVEMENT, ABORT_MOVEMENT } from '../constants.js';
/** Workflow engine for orchestrating agent execution */ /** Workflow engine for orchestrating agent execution */
export class WorkflowEngine extends EventEmitter { export class WorkflowEngine extends EventEmitter {

View File

@ -76,8 +76,6 @@ export class StateManager {
} }
} }
// --- Backward-compatible function facades ---
/** /**
* Create initial workflow state from config and options. * Create initial workflow state from config and options.
*/ */

View File

@ -9,7 +9,7 @@
export { WorkflowEngine } from './engine/index.js'; export { WorkflowEngine } from './engine/index.js';
// Constants // Constants
export { COMPLETE_MOVEMENT, ABORT_MOVEMENT, COMPLETE_STEP, ABORT_STEP, ERROR_MESSAGES } from './constants.js'; export { COMPLETE_MOVEMENT, ABORT_MOVEMENT, ERROR_MESSAGES } from './constants.js';
// Types // Types
export type { export type {

View File

@ -19,7 +19,7 @@ export interface ReportInstructionContext {
cwd: string; cwd: string;
/** Report directory path */ /** Report directory path */
reportDir: string; reportDir: string;
/** Movement iteration (for {step_iteration} replacement) */ /** Movement iteration (for {movement_iteration} replacement) */
movementIteration: number; movementIteration: number;
/** Language */ /** Language */
language?: Language; language?: Language;

View File

@ -18,7 +18,7 @@ export function escapeTemplateChars(str: string): string {
* Replace template placeholders in the instruction_template body. * Replace template placeholders in the instruction_template body.
* *
* These placeholders may still be used in instruction_template for * These placeholders may still be used in instruction_template for
* backward compatibility or special cases. * special cases or legacy templates.
*/ */
export function replaceTemplatePlaceholders( export function replaceTemplatePlaceholders(
template: string, template: string,
@ -34,8 +34,6 @@ export function replaceTemplatePlaceholders(
result = result.replace(/\{iteration\}/g, String(context.iteration)); result = result.replace(/\{iteration\}/g, String(context.iteration));
result = result.replace(/\{max_iterations\}/g, String(context.maxIterations)); result = result.replace(/\{max_iterations\}/g, String(context.maxIterations));
result = result.replace(/\{movement_iteration\}/g, String(context.movementIteration)); result = result.replace(/\{movement_iteration\}/g, String(context.movementIteration));
// @deprecated Use {movement_iteration} instead
result = result.replace(/\{step_iteration\}/g, String(context.movementIteration));
// Replace {previous_response} // Replace {previous_response}
if (step.passPreviousResponse) { if (step.passPreviousResponse) {

View File

@ -6,7 +6,7 @@
*/ */
import type { PermissionResult, PermissionUpdate } from '@anthropic-ai/claude-agent-sdk'; import type { PermissionResult, PermissionUpdate } from '@anthropic-ai/claude-agent-sdk';
import type { WorkflowMovement, WorkflowStep, AgentResponse, WorkflowState, Language } from '../models/types.js'; import type { WorkflowMovement, AgentResponse, WorkflowState, Language } from '../models/types.js';
export type ProviderType = 'claude' | 'codex' | 'mock'; export type ProviderType = 'claude' | 'codex' | 'mock';

View File

@ -33,7 +33,7 @@ export async function executeTask(options: ExecuteTaskOptions): Promise<boolean>
error(`Workflow file not found: ${workflowIdentifier}`); error(`Workflow file not found: ${workflowIdentifier}`);
} else { } else {
error(`Workflow "${workflowIdentifier}" not found.`); error(`Workflow "${workflowIdentifier}" not found.`);
info('Available workflows are in ~/.takt/workflows/ or .takt/workflows/'); info('Available workflows are in ~/.takt/pieces/ or .takt/workflows/');
info('Use "takt switch" to select a workflow.'); info('Use "takt switch" to select a workflow.');
} }
return false; return false;

View File

@ -24,7 +24,6 @@ import {
instructBranch, instructBranch,
} from './taskActions.js'; } from './taskActions.js';
// Re-export for backward compatibility (tests import from this module)
export { export {
type ListAction, type ListAction,
isBranchMerged, isBranchMerged,

View File

@ -18,7 +18,6 @@ export {
getCurrentWorkflow, getCurrentWorkflow,
setCurrentWorkflow, setCurrentWorkflow,
isVerboseMode, isVerboseMode,
type ProjectPermissionMode,
type ProjectLocalConfig, type ProjectLocalConfig,
writeFileAtomic, writeFileAtomic,
getInputHistoryPath, getInputHistoryPath,
@ -102,8 +101,8 @@ export * from './agents/index.js';
// Workflow engine // Workflow engine
export { export {
WorkflowEngine, WorkflowEngine,
COMPLETE_STEP, COMPLETE_MOVEMENT,
ABORT_STEP, ABORT_MOVEMENT,
ERROR_MESSAGES, ERROR_MESSAGES,
determineNextMovementByRules, determineNextMovementByRules,
extractBlockedPrompt, extractBlockedPrompt,

View File

@ -10,7 +10,6 @@ import type { AgentResponse, Status } from '../../core/models/index.js';
import { createLogger } from '../../shared/utils/index.js'; import { createLogger } from '../../shared/utils/index.js';
import { loadTemplate } from '../../shared/prompts/index.js'; import { loadTemplate } from '../../shared/prompts/index.js';
// Re-export for backward compatibility
export type { ClaudeCallOptions } from './types.js'; export type { ClaudeCallOptions } from './types.js';
const log = createLogger('client'); const log = createLogger('client');
@ -250,7 +249,7 @@ export class ClaudeClient {
} }
} }
// ---- Backward-compatible module-level functions ---- // ---- Module-level functions ----
const defaultClient = new ClaudeClient(); const defaultClient = new ClaudeClient();

View File

@ -174,9 +174,6 @@ export class QueryExecutor {
} }
} }
// ---- Backward-compatible module-level function ----
/** @deprecated Use QueryExecutor.execute() instead */
export async function executeClaudeQuery( export async function executeClaudeQuery(
prompt: string, prompt: string,
options: ClaudeSpawnOptions, options: ClaudeSpawnOptions,

View File

@ -54,14 +54,14 @@ export type {
// Stream conversion // Stream conversion
export { sdkMessageToStreamEvent } from './stream-converter.js'; export { sdkMessageToStreamEvent } from './stream-converter.js';
// Options building (backward-compatible functions) // Options building
export { export {
createCanUseToolCallback, createCanUseToolCallback,
createAskUserQuestionHooks, createAskUserQuestionHooks,
buildSdkOptions, buildSdkOptions,
} from './options-builder.js'; } from './options-builder.js';
// Client functions (backward-compatible) // Client functions
export { export {
callClaude, callClaude,
callClaudeCustom, callClaudeCustom,

View File

@ -177,7 +177,7 @@ export class SdkOptionsBuilder {
} }
} }
// ---- Backward-compatible module-level functions ---- // ---- Module-level functions ----
export function createCanUseToolCallback( export function createCanUseToolCallback(
handler: PermissionHandler handler: PermissionHandler

View File

@ -15,7 +15,6 @@ import type {
ClaudeResult, ClaudeResult,
} from './types.js'; } from './types.js';
// Re-export types for backward compatibility
export type { export type {
StreamEvent, StreamEvent,
StreamCallback, StreamCallback,
@ -59,7 +58,7 @@ export async function executeClaudeCli(
} }
/** /**
* ClaudeProcess class for backward compatibility. * ClaudeProcess class wrapping the SDK query function.
* Wraps the SDK query function. * Wraps the SDK query function.
*/ */
export class ClaudeProcess { export class ClaudeProcess {

View File

@ -84,7 +84,7 @@ export class QueryRegistry {
} }
/** /**
* Interrupt the most recently started Claude query (backward compatibility). * Interrupt the most recently started Claude query.
* @returns true if a query was interrupted, false if no query was running * @returns true if a query was interrupted, false if no query was running
*/ */
interruptCurrentProcess(): boolean { interruptCurrentProcess(): boolean {
@ -96,8 +96,6 @@ export class QueryRegistry {
} }
} }
// ---- Backward-compatible module-level functions ----
/** Generate a unique query ID */ /** Generate a unique query ID */
export function generateQueryId(): string { export function generateQueryId(): string {
return `q-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`; return `q-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;

View File

@ -2,7 +2,7 @@
* SDK message to stream event converter * SDK message to stream event converter
* *
* Converts Claude Agent SDK messages to the internal stream event format * Converts Claude Agent SDK messages to the internal stream event format
* for backward compatibility with the streaming display system. * for use with the streaming display system.
*/ */
import type { import type {
@ -85,7 +85,7 @@ function extractToolResultContent(toolResult: unknown): { content: string; isErr
} }
/** /**
* Convert SDK message to stream event for backward compatibility. * Convert SDK message to stream event.
* *
* @param message - The SDK message to convert * @param message - The SDK message to convert
* @param callback - The callback to invoke with stream events * @param callback - The callback to invoke with stream events

View File

@ -12,7 +12,7 @@ import type { PermissionResult } from '../../core/workflow/index.js';
// Re-export PermissionResult for convenience // Re-export PermissionResult for convenience
export type { PermissionResult, PermissionUpdate }; export type { PermissionResult, PermissionUpdate };
/** Stream event data types (for backward compatibility) */ /** Stream event data types */
export interface InitEventData { export interface InitEventData {
model: string; model: string;
sessionId: string; sessionId: string;

View File

@ -20,7 +20,6 @@ import {
emitCodexItemUpdate, emitCodexItemUpdate,
} from './CodexStreamHandler.js'; } from './CodexStreamHandler.js';
// Re-export for backward compatibility
export type { CodexCallOptions } from './types.js'; export type { CodexCallOptions } from './types.js';
const log = createLogger('codex-sdk'); const log = createLogger('codex-sdk');
@ -199,8 +198,6 @@ export class CodexClient {
} }
} }
// ---- Backward-compatible module-level functions ----
const defaultClient = new CodexClient(); const defaultClient = new CodexClient();
export async function callCodex( export async function callCodex(

View File

@ -152,8 +152,6 @@ export class GlobalConfigManager {
} }
} }
// ---- Backward-compatible module-level functions ----
export function invalidateGlobalConfigCache(): void { export function invalidateGlobalConfigCache(): void {
GlobalConfigManager.getInstance().invalidateCache(); GlobalConfigManager.getInstance().invalidateCache();
} }

View File

@ -69,7 +69,7 @@ export function listCustomAgents(): string[] {
* Load agent prompt content. * Load agent prompt content.
* Agents can be loaded from: * Agents can be loaded from:
* - ~/.takt/agents/*.md (global agents) * - ~/.takt/agents/*.md (global agents)
* - ~/.takt/workflows/{workflow}/*.md (workflow-specific agents) * - ~/.takt/pieces/{workflow}/*.md (workflow-specific agents)
*/ */
export function loadAgentPrompt(agent: CustomAgentConfig): string { export function loadAgentPrompt(agent: CustomAgentConfig): string {
if (agent.prompt) { if (agent.prompt) {

View File

@ -1,7 +1,7 @@
/** /**
* Configuration loader for takt * Configuration loader for takt
* *
* Re-exports from specialized loaders for backward compatibility. * Re-exports from specialized loaders.
*/ */
// Workflow loading // Workflow loading

View File

@ -215,14 +215,11 @@ function normalizeStepFromRaw(step: RawStep, workflowDir: string): WorkflowMovem
export function normalizeWorkflowConfig(raw: unknown, workflowDir: string): WorkflowConfig { export function normalizeWorkflowConfig(raw: unknown, workflowDir: string): WorkflowConfig {
const parsed = WorkflowConfigRawSchema.parse(raw); const parsed = WorkflowConfigRawSchema.parse(raw);
// Prefer `movements` over legacy `steps` const movements: WorkflowMovement[] = parsed.movements.map((step) =>
const rawMovements = parsed.movements ?? parsed.steps ?? [];
const movements: WorkflowMovement[] = rawMovements.map((step) =>
normalizeStepFromRaw(step, workflowDir), normalizeStepFromRaw(step, workflowDir),
); );
// Prefer `initial_movement` over legacy `initial_step` const initialMovement = parsed.initial_movement ?? movements[0]?.name ?? '';
const initialMovement = parsed.initial_movement ?? parsed.initial_step ?? movements[0]?.name ?? '';
return { return {
name: parsed.name, name: parsed.name,

View File

@ -96,8 +96,8 @@ function resolveWorkflowFile(workflowsDir: string, name: string): string | null
* *
* Priority: * Priority:
* 1. Project-local workflows .takt/workflows/{name}.yaml * 1. Project-local workflows .takt/workflows/{name}.yaml
* 2. User workflows ~/.takt/workflows/{name}.yaml * 2. User workflows ~/.takt/pieces/{name}.yaml
* 3. Builtin workflows resources/global/{lang}/workflows/{name}.yaml * 3. Builtin workflows resources/global/{lang}/pieces/{name}.yaml
*/ */
export function loadWorkflow( export function loadWorkflow(
name: string, name: string,
@ -115,14 +115,6 @@ export function loadWorkflow(
return loadWorkflowFromFile(globalMatch); return loadWorkflowFromFile(globalMatch);
} }
// Fallback: legacy ~/.takt/workflows/ directory (deprecated)
const legacyGlobalDir = join(homedir(), '.takt', 'workflows');
const legacyMatch = resolveWorkflowFile(legacyGlobalDir, name);
if (legacyMatch) {
log.info(`Loading workflow from deprecated path ~/.takt/workflows/. Please move to ~/.takt/pieces/.`);
return loadWorkflowFromFile(legacyMatch);
}
return getBuiltinWorkflow(name); return getBuiltinWorkflow(name);
} }
@ -229,12 +221,6 @@ function getWorkflowDirs(cwd: string): { dir: string; source: WorkflowSource; di
if (getBuiltinWorkflowsEnabled()) { if (getBuiltinWorkflowsEnabled()) {
dirs.push({ dir: getBuiltinPiecesDir(lang), disabled, source: 'builtin' }); dirs.push({ dir: getBuiltinPiecesDir(lang), disabled, source: 'builtin' });
} }
// Legacy fallback: ~/.takt/workflows/ (deprecated, lowest user priority)
const legacyGlobalDir = join(homedir(), '.takt', 'workflows');
if (existsSync(legacyGlobalDir)) {
log.info(`Scanning deprecated path ~/.takt/workflows/. Please move to ~/.takt/pieces/.`);
dirs.push({ dir: legacyGlobalDir, source: 'user' });
}
dirs.push({ dir: getGlobalPiecesDir(), source: 'user' }); dirs.push({ dir: getGlobalPiecesDir(), source: 'user' });
dirs.push({ dir: join(getProjectConfigDir(cwd), 'workflows'), source: 'project' }); dirs.push({ dir: join(getProjectConfigDir(cwd), 'workflows'), source: 'project' });
return dirs; return dirs;
@ -245,7 +231,7 @@ function getWorkflowDirs(cwd: string): { dir: string; source: WorkflowSource; di
* *
* Priority (later entries override earlier): * Priority (later entries override earlier):
* 1. Builtin workflows * 1. Builtin workflows
* 2. User workflows (~/.takt/workflows/) * 2. User workflows (~/.takt/pieces/)
* 3. Project-local workflows (.takt/workflows/) * 3. Project-local workflows (.takt/workflows/)
*/ */
export function loadAllWorkflowsWithSources(cwd: string): Map<string, WorkflowWithSource> { export function loadAllWorkflowsWithSources(cwd: string): Map<string, WorkflowWithSource> {
@ -269,7 +255,7 @@ export function loadAllWorkflowsWithSources(cwd: string): Map<string, WorkflowWi
* *
* Priority (later entries override earlier): * Priority (later entries override earlier):
* 1. Builtin workflows * 1. Builtin workflows
* 2. User workflows (~/.takt/workflows/) * 2. User workflows (~/.takt/pieces/)
* 3. Project-local workflows (.takt/workflows/) * 3. Project-local workflows (.takt/workflows/)
*/ */
export function loadAllWorkflows(cwd: string): Map<string, WorkflowConfig> { export function loadAllWorkflows(cwd: string): Map<string, WorkflowConfig> {

View File

@ -26,9 +26,6 @@ export function getGlobalPiecesDir(): string {
return join(getGlobalConfigDir(), 'pieces'); return join(getGlobalConfigDir(), 'pieces');
} }
/** @deprecated Use getGlobalPiecesDir() instead */
export const getGlobalWorkflowsDir = getGlobalPiecesDir;
/** Get takt global logs directory */ /** Get takt global logs directory */
export function getGlobalLogsDir(): string { export function getGlobalLogsDir(): string {
return join(getGlobalConfigDir(), 'logs'); return join(getGlobalConfigDir(), 'logs');
@ -44,9 +41,6 @@ export function getBuiltinPiecesDir(lang: Language): string {
return join(getLanguageResourcesDir(lang), 'pieces'); return join(getLanguageResourcesDir(lang), 'pieces');
} }
/** @deprecated Use getBuiltinPiecesDir() instead */
export const getBuiltinWorkflowsDir = getBuiltinPiecesDir;
/** Get builtin agents directory (resources/global/{lang}/agents) */ /** Get builtin agents directory (resources/global/{lang}/agents) */
export function getBuiltinAgentsDir(lang: Language): string { export function getBuiltinAgentsDir(lang: Language): string {
return join(getLanguageResourcesDir(lang), 'agents'); return join(getLanguageResourcesDir(lang), 'agents');
@ -102,7 +96,7 @@ export {
type ProjectLocalConfig, type ProjectLocalConfig,
} from './project/projectConfig.js'; } from './project/projectConfig.js';
// Re-export session storage functions for backward compatibility // Re-export session storage functions
export { export {
writeFileAtomic, writeFileAtomic,
getInputHistoryPath, getInputHistoryPath,

View File

@ -10,7 +10,6 @@ export {
setCurrentWorkflow, setCurrentWorkflow,
isVerboseMode, isVerboseMode,
type PermissionMode, type PermissionMode,
type ProjectPermissionMode,
type ProjectLocalConfig, type ProjectLocalConfig,
} from './projectConfig.js'; } from './projectConfig.js';

View File

@ -8,9 +8,9 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
import { join, resolve } from 'node:path'; import { join, resolve } from 'node:path';
import { parse, stringify } from 'yaml'; import { parse, stringify } from 'yaml';
import { copyProjectResourcesToDir } from '../../resources/index.js'; import { copyProjectResourcesToDir } from '../../resources/index.js';
import type { PermissionMode, ProjectPermissionMode, ProjectLocalConfig } from '../types.js'; import type { PermissionMode, ProjectLocalConfig } from '../types.js';
export type { PermissionMode, ProjectPermissionMode, ProjectLocalConfig }; export type { PermissionMode, ProjectLocalConfig };
/** Default project configuration */ /** Default project configuration */
const DEFAULT_PROJECT_CONFIG: ProjectLocalConfig = { const DEFAULT_PROJECT_CONFIG: ProjectLocalConfig = {

View File

@ -12,9 +12,6 @@ import type { WorkflowCategoryConfigNode } from '../../core/models/schemas.js';
*/ */
export type PermissionMode = 'default' | 'sacrifice-my-pc'; export type PermissionMode = 'default' | 'sacrifice-my-pc';
/** @deprecated Use PermissionMode instead */
export type ProjectPermissionMode = PermissionMode;
/** Project configuration stored in .takt/config.yaml */ /** Project configuration stored in .takt/config.yaml */
export interface ProjectLocalConfig { export interface ProjectLocalConfig {
/** Current workflow name */ /** Current workflow name */

View File

@ -13,7 +13,6 @@ import type {
LatestLogPointer, LatestLogPointer,
} from '../../shared/utils/index.js'; } from '../../shared/utils/index.js';
// Re-export types for backward compatibility
export type { export type {
SessionLog, SessionLog,
NdjsonWorkflowStart, NdjsonWorkflowStart,
@ -239,8 +238,6 @@ export class SessionManager {
} }
} }
// ---- Backward-compatible module-level functions ----
const defaultManager = new SessionManager(); const defaultManager = new SessionManager();
export function appendNdjsonLine(filepath: string, record: NdjsonRecord): void { export function appendNdjsonLine(filepath: string, record: NdjsonRecord): void {

View File

@ -10,7 +10,6 @@ import { CodexProvider } from './codex.js';
import { MockProvider } from './mock.js'; import { MockProvider } from './mock.js';
import type { Provider, ProviderType } from './types.js'; import type { Provider, ProviderType } from './types.js';
// Re-export types for backward compatibility
export type { ProviderCallOptions, Provider, ProviderType } from './types.js'; export type { ProviderCallOptions, Provider, ProviderType } from './types.js';
/** /**
@ -52,8 +51,6 @@ export class ProviderRegistry {
} }
// ---- Backward-compatible module-level functions ----
export function getProvider(type: ProviderType): Provider { export function getProvider(type: ProviderType): Provider {
return ProviderRegistry.getInstance().get(type); return ProviderRegistry.getInstance().get(type);
} }

View File

@ -73,7 +73,7 @@ export class AutoCommitter {
} }
} }
// ---- Backward-compatible module-level function ---- // ---- Module-level function ----
const defaultCommitter = new AutoCommitter(); const defaultCommitter = new AutoCommitter();

View File

@ -248,7 +248,7 @@ export class BranchManager {
} }
} }
// ---- Backward-compatible module-level functions ---- // ---- Module-level functions ----
const defaultManager = new BranchManager(); const defaultManager = new BranchManager();

View File

@ -249,7 +249,7 @@ export class CloneManager {
} }
} }
// ---- Backward-compatible module-level functions ---- // ---- Module-level functions ----
const defaultManager = new CloneManager(); const defaultManager = new CloneManager();

View File

@ -3,7 +3,7 @@
* *
* Supports both YAML (.yaml/.yml) and Markdown (.md) task files. * Supports both YAML (.yaml/.yml) and Markdown (.md) task files.
* YAML files are validated against TaskFileSchema. * YAML files are validated against TaskFileSchema.
* Markdown files are treated as plain text (backward compatible). * Markdown files are treated as plain text.
*/ */
import * as fs from 'node:fs'; import * as fs from 'node:fs';

View File

@ -81,7 +81,7 @@ export class TaskSummarizer {
} }
} }
// ---- Backward-compatible module-level function ---- // ---- Module-level function ----
const defaultSummarizer = new TaskSummarizer(); const defaultSummarizer = new TaskSummarizer();

View File

@ -36,8 +36,6 @@ export class AppContext {
} }
} }
// ---- Backward-compatible module-level functions ----
/** Get whether quiet mode is active (CLI flag or config, resolved in preAction) */ /** Get whether quiet mode is active (CLI flag or config, resolved in preAction) */
export function isQuietMode(): boolean { export function isQuietMode(): boolean {
return AppContext.getInstance().getQuietMode(); return AppContext.getInstance().getQuietMode();

View File

@ -175,8 +175,6 @@ export interface InteractiveSelectCallbacks<T extends string> {
* Return null to delegate to default handler. * Return null to delegate to default handler.
*/ */
onKeyPress?: (key: string, value: T, index: number) => SelectOptionItem<T>[] | null; onKeyPress?: (key: string, value: T, index: number) => SelectOptionItem<T>[] | null;
/** Called when 'b' key is pressed. Returns updated options for re-render. @deprecated Use onKeyPress instead */
onBookmark?: (value: T, index: number) => SelectOptionItem<T>[];
/** Custom label for cancel option (default: "Cancel") */ /** Custom label for cancel option (default: "Cancel") */
cancelLabel?: string; cancelLabel?: string;
} }
@ -201,7 +199,7 @@ function interactiveSelect<T extends string>(
let selectedIndex = initialIndex; let selectedIndex = initialIndex;
const cancelLabel = callbacks?.cancelLabel ?? 'Cancel'; const cancelLabel = callbacks?.cancelLabel ?? 'Cancel';
printHeader(message, !!callbacks?.onKeyPress || !!callbacks?.onBookmark); printHeader(message, !!callbacks?.onKeyPress);
process.stdout.write('\x1B[?7l'); process.stdout.write('\x1B[?7l');
@ -265,22 +263,9 @@ function interactiveSelect<T extends string>(
cleanup(onKeypress); cleanup(onKeypress);
resolve({ selectedIndex: result.cancelIndex, finalOptions: currentOptions }); resolve({ selectedIndex: result.cancelIndex, finalOptions: currentOptions });
break; break;
case 'bookmark': { case 'bookmark':
if (!callbacks?.onBookmark) break; // Handled by custom onKeyPress
// Only bookmark actual options, not the cancel row
if (result.selectedIndex >= currentOptions.length) break;
const item = currentOptions[result.selectedIndex];
if (!item) break;
const newOptions = callbacks.onBookmark(item.value, result.selectedIndex);
// Find the same value in the new options to preserve cursor position
const currentValue = item.value;
currentOptions = newOptions;
totalItems = hasCancelOption ? currentOptions.length + 1 : currentOptions.length;
const newIdx = currentOptions.findIndex((o) => o.value === currentValue);
selectedIndex = newIdx >= 0 ? newIdx : Math.min(selectedIndex, currentOptions.length - 1);
totalLines = redrawMenu(currentOptions, selectedIndex, hasCancelOption, totalLines, cancelLabel);
break; break;
}
case 'remove_bookmark': case 'remove_bookmark':
// Ignore - should be handled by custom onKeyPress // Ignore - should be handled by custom onKeyPress
break; break;
@ -299,7 +284,6 @@ function interactiveSelect<T extends string>(
/** /**
* Prompt user to select from a list of options using cursor navigation. * Prompt user to select from a list of options using cursor navigation.
* @param callbacks.onBookmark - Called when 'b' key is pressed. Returns updated options for re-render.
* @returns Selected option or null if cancelled * @returns Selected option or null if cancelled
*/ */
export async function selectOption<T extends string>( export async function selectOption<T extends string>(

View File

@ -2,7 +2,7 @@
* Log level management and formatted console output. * Log level management and formatted console output.
* *
* LogManager is a singleton that encapsulates the current log level state. * LogManager is a singleton that encapsulates the current log level state.
* Module-level functions are provided for backward compatibility. * Module-level functions are provided as convenient facades.
*/ */
import chalk from 'chalk'; import chalk from 'chalk';
@ -84,8 +84,6 @@ export class LogManager {
} }
} }
// ---- Backward-compatible module-level functions ----
export function setLogLevel(level: LogLevel): void { export function setLogLevel(level: LogLevel): void {
LogManager.getInstance().setLogLevel(level); LogManager.getInstance().setLogLevel(level);
} }

View File

@ -165,7 +165,7 @@ export class DebugLogger {
} }
} }
// ---- Backward-compatible module-level functions ---- // ---- Module-level functions ----
export function initDebugLogger(config?: DebugConfig, projectDir?: string): void { export function initDebugLogger(config?: DebugConfig, projectDir?: string): void {
DebugLogger.getInstance().init(config, projectDir); DebugLogger.getInstance().init(config, projectDir);