ocat run, or working inside a managed project with ocm. Projects add structure, configuration, and logging persistence on top of the single-file workflow.
Single file vs. managed project
ocat run | ocm run | |
|---|---|---|
| Entry point | Any .ocat file | main field in .ocat/config.json |
| Configuration | None | .ocat/config.json |
| Log persistence | No | Yes — .ocat/logs.txt on process exit |
| Project metadata | No | Name, version, description, ID |
ocat run for quick scripts and one-off programs. Use ocm when you need repeatable builds, project metadata, or persistent logs.
Project types
When you runocm initialize, you choose between two project types:
App — An application with a main entry file. The project scaffolds src/main.ocat with a Hello World program and sets the main field in config.json to point to it. Running ocm run executes this file.
Lib — A library intended to be imported by other files. No src/main.ocat file is created and no main field is written to config.json. Lib projects are not directly runnable via ocm run.
The project type is stored as lowercase
"app" or "lib" in config.json, but you select it as App or Lib during ocm initialize.Directory structure
Runningocm initialize creates the following structure:
src/ — Source files for your project. For App projects, main.ocat is the entry point. You can add more .ocat files here and import them.
connection/ — Directory for connection-related files. Created for all project types.
.ocat/ — OCat’s project directory. Contains config.json for project configuration and, after a run, logs.txt with log output. You can also place a logcfg.json file here to configure the logging service.
Project lifecycle
Initialize the project
Run This creates the directory structure and writes the initial
ocm initialize in your terminal. You will be prompted for a project name, directory, ID, and type.config.json.Write your code
Open
src/main.ocat (App projects) and replace or extend the generated Hello World program. Add more .ocat files to src/ and import them as needed.Related pages
Project configuration
Full reference for the
.ocat/config.json schema and all supported fields.Logging
Configure log levels, interceptors, and understand how logs are persisted.