OpenForm
CLI

Projects

Last updated on

Project structure, manifest, and artifact storage

A project is a directory managed by the CLI. It contains a manifest that describes the project, a state directory that tracks installed artifacts, and the artifact files themselves. Initialize one with ofm init.

Initializing a project

ofm init

In interactive mode, the CLI prompts for a project title, description, and visibility (public or private). Use --yes to skip prompts:

ofm init --yes --name "My Project" --visibility private

See the init command reference for all options.

The project manifest

The open-form.json file in the project root defines your project:

{
  "$schema": "https://schema.open-form.dev/manifest.json",
  "name": "@your-org/my-project",
  "title": "My Project",
  "description": "A description of your project",
  "visibility": "private",
  "artifacts": {
    "dir": "artifacts",
    "format": "yaml"
  },
  "registries": {
    "@acme": "https://registry.acme.com"
  },
  "security": {
    "allowedContentTypes": ["application/pdf", "text/markdown"]
  },
  "cache": {
    "ttl": 3600
  }
}

Fields

FieldTypeRequiredDescription
$schemastringNoJSON schema URL for editor validation
namestringYesProject identifier in @org/name format
titlestringYesHuman-readable project title
descriptionstringNoProject description
visibility"public" | "private"YesProject visibility
artifactsobjectNoArtifact storage configuration
registriesobjectNoRegistry configuration by namespace
securityobjectNoSecurity restrictions
cacheobjectNoCache configuration overrides

Artifacts

Controls where artifacts are stored and in what format.

FieldDefaultDescription
artifacts.dir"artifacts"Directory for downloaded artifacts (relative to project root)
artifacts.format"yaml"Default output format (see Output formats)

Registries

Maps namespaces to registry URLs. See Registries for details.

Security

FieldDescription
security.allowedContentTypesContent types permitted when downloading layers

Cache

FieldDefaultDescription
cache.ttl3600Time in seconds before cached registry data expires

Directory structure

After initialization and installing an artifact, your project looks like this:

my-project/
├── open-form.json          # Project manifest
├── .ofm/                   # CLI state directory
│   ├── HEAD
│   ├── index.json
│   ├── config.json
│   ├── lock.json
│   ├── commits/
│   └── objects/
└── artifacts/              # Downloaded artifacts
    └── @acme/
        └── residential-lease.yaml

The .ofm/ directory

The .ofm/ directory stores internal CLI state. You should not edit these files directly — the CLI manages them.

FilePurpose
HEADPoints to the current commit
index.jsonTracks installed artifacts and their versions
config.jsonLocal CLI configuration (written by ofm configure)
lock.jsonPinned versions and checksums for reproducible installs
commits/Commit history for artifact changes
objects/Content-addressable object store

The lock file

.ofm/lock.json pins the exact version and checksum of every installed artifact. This ensures that running ofm add on a different machine produces the same result.

Commit the lock file to version control. The CLI updates it automatically when you add, remove, or update artifacts.

Output formats

The CLI supports four output formats for artifact files. Set the default in artifacts.format in the manifest, or override per command with --format.

FormatExtensionDescription
json.jsonStandard JSON. Portable and widely supported.
yaml.yamlYAML. Easier to read and edit by hand.
typed.json + .d.tsJSON file with a companion TypeScript declaration file for type-safe imports.
ts.tsStandalone TypeScript module with the artifact embedded as as const.

The typed and ts formats are generated by ofm generate or by passing --format typed / --format ts to ofm add.

Use json or yaml if you don't need TypeScript integration. Use typed if you want type-safe imports without changing your JSON source files. Use ts for a single self-contained module.

On this page