Write Project File
openl_write_project_fileCreate or replace a file in an OpenL project by its relative path. Supports text and binary content, optional Git commit, and configurable conflict handling.
Instructions
Create or replace a file in a project by its project-relative path. Provide 'content' as UTF-8 text (default) or base64 (set encoding='base64' for binary files such as xlsx/images). COMMIT: pass 'message' to commit the write to Git (a new revision is created); omit 'message' and the write stays in the project WORKING COPY (commit it later with openl_save_project). Committing saves ALL pending project changes and works only for design repositories (not 'local'). By default missing parent folders are created (createFolders=true). If the target file already EXISTS, behavior follows conflictPolicy: FAIL (default) returns an error; OVERWRITE replaces the file in place; SKIP leaves the existing file unchanged (reported skipped). Use 'branch' to pin the project's branch (omit for local/non-branch repositories). Use this to add or update docs, schemas, or manifests. (For a NEW file the tool POSTs/creates; OVERWRITE is performed via PUT/update — overwriting a module .xlsx replaces its bytes but to change a module's TABLES use openl_update_table / openl_append_table / openl_create_project_table.)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Project-relative path to the resource (e.g. 'rules/Model.xlsx'). Do NOT include the project name itself; paths are relative to the project root. A trailing slash denotes a folder. | |
| branch | No | Branch the project must be on for this operation. Ignored when blank. Fails if the repository has no branches or the project is on another branch. Omit for repository 'local' and non-branch repositories. | |
| content | Yes | File content, interpreted according to 'encoding'. Use base64 for binary files (xlsx, images, zip). | |
| message | No | Optional commit message. PRESENT → the write is committed to Git after saving the project (a new revision is created). ABSENT → the write stays in the project WORKING COPY (commit it later with openl_save_project). NOTE: committing saves ALL pending project changes (OpenL has no per-file commit), and only works for design (Git) repositories — not 'local'. | |
| encoding | Yes | How 'content' is encoded: 'utf-8' (default) for text, 'base64' for binary. | utf-8 |
| projectId | Yes | Project ID returned by backend. Use the exact 'projectId' value from openl_list_projects() response without modification or reformatting. | |
| createFolders | Yes | If true (default), missing intermediate folders are created automatically; otherwise the parent folder must already exist. | |
| conflictPolicy | No | How to handle a target file that already exists: FAIL (default) returns an error; OVERWRITE replaces its content in place; SKIP leaves the existing file unchanged and reports it skipped. Has no effect when creating a new file. | |
| response_format | No | Response format: 'json' for structured data, 'markdown' for human-readable (default), 'markdown_concise' for brief summary (1-2 paragraphs), 'markdown_detailed' for full details with context | markdown |