UNPKG

@plastichub/osr-ai-tools

Version:

CLI and library for LLM tools

65 lines (64 loc) 4.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToolListingOptionsSchema = exports.ListCommandSchema = exports.InvokeToolSchema = exports.TerminalCommandSchema = exports.NpmRunSchema = exports.GitRawFileSchema = exports.GitSwitchVersionSchema = exports.GitRevertSchema = exports.GitCommitSchema = exports.FileRemovalOptionsSchema = exports.FileListingOptionsSchema = void 0; const zod_1 = require("zod"); /** Schema for listing files in a directory */ exports.FileListingOptionsSchema = zod_1.z.object({ directory: zod_1.z.string().describe('Directory path to list files from'), pattern: zod_1.z.string().optional().describe('Glob pattern for filtering files') }).describe('IFileListingOptions'); /** Schema for file removal operations */ exports.FileRemovalOptionsSchema = zod_1.z.object({ path: zod_1.z.string().describe('Path of the file to remove') }).describe('IFileRemovalOptions'); /** Schema for git commit operations */ exports.GitCommitSchema = zod_1.z.object({ files: zod_1.z.array(zod_1.z.string()).describe('Files to commit'), message: zod_1.z.string().describe('Commit message') }).describe('IGitCommitOptions'); /** Schema for git revert operations */ exports.GitRevertSchema = zod_1.z.object({ files: zod_1.z.array(zod_1.z.string()).describe('Files to revert') }).describe('IGitRevertOptions'); /** Schema for git version switch operations */ exports.GitSwitchVersionSchema = zod_1.z.object({ branch: zod_1.z.string().describe('Branch name to switch to'), remote: zod_1.z.string().default('origin').describe('Remote name') }).describe('IGitSwitchVersionOptions'); /** Schema for git raw file retrieval */ exports.GitRawFileSchema = zod_1.z.object({ url: zod_1.z.string().optional().describe('Full GitHub raw URL'), repo: zod_1.z.string().optional().describe('Repository in format owner/repo'), path: zod_1.z.string().optional().describe('File path within repository') }).refine(data => (data.url) || (data.repo && data.path), 'Either url or both repo and path must be provided').describe('IGitRawFileOptions'); /** Schema for npm run command */ exports.NpmRunSchema = zod_1.z.object({ command: zod_1.z.string().describe('Command to run (e.g. install, test, etc)'), args: zod_1.z.array(zod_1.z.string()).optional().describe('Additional arguments for the command') }).describe('INpmRunOptions'); /** Schema for terminal command execution */ exports.TerminalCommandSchema = zod_1.z.object({ command: zod_1.z.string().describe('Command to execute'), args: zod_1.z.array(zod_1.z.string()).optional().describe('Command arguments'), cwd: zod_1.z.string().optional().describe('Working directory for command execution'), background: zod_1.z.boolean().optional().describe('Run command in background (non-blocking)'), window: zod_1.z.boolean().optional().describe('Open command in new terminal window'), detached: zod_1.z.boolean().optional().describe('Run process detached from parent') }).describe('ITerminalCommandOptions'); /** Schema for tool invocation parameters */ exports.InvokeToolSchema = zod_1.z.object({ tools: zod_1.z.string().describe('Tool category to use (fs, npm, git, terminal)'), function: zod_1.z.string().describe('Function name to invoke'), target: zod_1.z.string().default(process.cwd()).describe('Target directory'), params: zod_1.z.string().optional().describe('JSON string of parameters'), output: zod_1.z.string().optional().describe('Path to write the output to'), env_key: zod_1.z.string().optional().describe('Environment configuration key') }).describe('IInvokeToolOptions'); /** Schema for list command options */ exports.ListCommandSchema = zod_1.z.object({ output: zod_1.z.string().default("./llm-tools.json").describe('Output file path for tools list') }).describe('IListCommandOptions'); /** Schema for tool listing options */ exports.ToolListingOptionsSchema = zod_1.z.object({ output: zod_1.z.string().default('./llm-tools.json').describe('Path to write the output to') }).describe('IToolListingOptions');