UNPKG

claude-flow

Version:

Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration

45 lines 1.99 kB
/** * Deterministic Codemod Engine (ADR-143) * * Truly $0, no-LLM Tier-1 code transforms. Uses the TypeScript compiler API to * locate exact AST nodes, then applies formatting-preserving text-range edits to * the original source string (we never re-print the whole file, so comments and * formatting survive). * * Only intents that can be transformed *deterministically and safely* live here. * Intents that need inference or judgement (add-types, add-error-handling, * async-await) are intentionally NOT codemods — they route to a model. See * ADR-143 for the rationale. * * @module ruvector/codemods/engine */ export type CodemodIntent = 'var-to-const' | 'remove-console' | 'add-logging'; /** Intents this engine can apply deterministically with $0 cost. */ export declare const DETERMINISTIC_CODEMOD_INTENTS: readonly CodemodIntent[]; /** Intents recognised by the router but NOT safe as deterministic codemods. */ export declare const MODEL_ROUTED_INTENTS: readonly string[]; export type CodemodLanguage = 'javascript' | 'typescript' | 'jsx' | 'tsx'; export interface CodemodResult { intent: CodemodIntent; success: boolean; /** true if the output differs from the input. */ changed: boolean; output: string; /** number of discrete edit sites applied. */ edits: number; language: CodemodLanguage; reason?: string; } export declare function isDeterministicCodemod(intent: string): intent is CodemodIntent; export interface ApplyCodemodOptions { language?: CodemodLanguage; } /** * Apply a deterministic codemod to a source string. * * Returns the transformed source plus metadata. Never throws on malformed input * — it reports `success: false` with a reason instead. Guarantees the output * does not introduce new parse errors (otherwise it returns the input unchanged). */ export declare function applyCodemod(intent: string, code: string, opts?: ApplyCodemodOptions): CodemodResult; //# sourceMappingURL=engine.d.ts.map