agentlang
Version:
The easiest way to build the most reliable AI agents - enterprise-grade teams of AI agents that collaborate with each other and humans
19 lines (15 loc) • 435 B
text/typescript
import { path } from '../utils/runtime.js';
interface FilePathData {
destination: string;
name: string;
}
export function extractDestinationAndName(
filePath: string,
destination: string | undefined
): FilePathData {
const fileName = path.basename(filePath, path.extname(filePath)).replace(/[.-]/g, '');
return {
destination: destination ?? path.join(path.dirname(filePath), 'generated'),
name: fileName,
};
}