Master file operations in ScryCLI using natural language commands to create, read, update, and delete files
ScryCLI provides powerful file management capabilities through natural language. The AI engine interprets your commands and executes file operations automatically.
While the AI’s system prompt mentions an update_file action, it is processed the same as write_file by the tool executor - both overwrite the entire file content.
All operations use absolute paths resolved from your current working directory.
# Read a specific file> Read src/config/configManage.ts# Read configuration> Show me the package.json file# Read multiple files (requires multiple commands)> Read src/tools/readFile.ts> Read src/tools/writeFile.ts
The readFile tool uses Node.js fs.readFileSync() to read files synchronously. File paths are resolved using path.resolve() to ensure absolute paths.
# Create a new component> Create src/components/Button.tsx with a basic React button component# Create a config file> Create .env with default environment variables for development# Create documentation> Create docs/API.md with API documentation structure# Create with specific content> Create public/index.html with a basic HTML5 template
The createFile tool automatically creates parent directories if they don’t exist using fs.mkdirSync() with the recursive: true option.
The AI may respond with update_file in the action field, but ScryCLI processes it the same as write_file - the entire file is overwritten with the new content.
# Add functionality> Update src/hooks/useChat.ts to add streaming support# Fix bugs> Update src/tools/getFileTree.ts to ignore .env files# Improve code> Update src/config/configManage.ts to add config validation# Add error handling> Update src/hooks/useToolExecutor.ts to handle file operation errors
The update_file action returns the complete new file content, not just a diff. The AI reads the existing file, makes changes, and returns the full updated version.
The AI engine intelligently determines file names and paths when you don’t specify:
# HTML files → public/index.html or public/game.html> Create a landing page# AI suggests: public/index.html# React components → src/App.jsx> Create a main React component# AI suggests: src/App.jsx# Styles → styles.css in same directory> Create styles for the landing page# AI suggests: public/styles.css# JavaScript entry → main.js> Create a JavaScript entry point# AI suggests: src/main.js
From the system prompt:
4. If the user does not specify a file name, decide an appropriate file name and directory based on: - HTML files → "public/index.html" - JavaScript entry → "src/App.jsx" if React, else "main.js" - CSS files → "styles.css" in the same directory as HTML
# Create multiple related files> Create src/types/user.ts with User interface> Create src/services/userService.ts with user CRUD operations> Create src/hooks/useUser.ts with a custom hook for user data
Each command is executed independently. If you need atomic operations (all succeed or all fail), handle it manually or use version control.
# Create a feature module structure> Create src/features/auth/index.ts with exports> Create src/features/auth/types.ts with TypeScript interfaces> Create src/features/auth/hooks.ts with custom hooks> Create src/features/auth/utils.ts with helper functions
# Update old API calls> Update all files in src/api/ to use the new fetch wrapper# Rename patterns> Update src/hooks/useChat.ts to rename 'answer' to 'response'