Skip to main content

Saving a version

PUT /api/cli/methods/:id/versions/:versionId saves a version by its content. The client computes the version ID before any request: v_ and the first 32 hex characters of sha256(METHOD_ID:package digest). The same content is always the same version, so a retry after a timeout or an uncertain response returns the version that was saved. Going back to earlier content finds its existing version. The first save of a new Method ID creates the Method. The CLI makes the ID (wf_ and 32 random hex characters) and writes it as the id: line of the Method file. A renamed or moved file keeps its Method; method new-id FILE makes a copy a new Method. Saves of different content from two computers both succeed, and each version records its parent. The CLI saves in the background: a run starts at once, and the outbox on the computer (~/.cache/method/outbox) uploads the files, the version, and the run records. It retries with backoff and stops only when no bytes move for 60 seconds. Any later method command sends what is left. A failed save never stops a run.

Run uploads

Run uploads use the same run ID and an increasing sequence. method sync RUN_DIRECTORY repairs an upload from existing records without executing steps again.