← All procedures

snapshot.create

Create environment snapshot and upload to S3

CLI
Package
@procedures/snapshot · README
Path
["snapshot","create"]
CLI
mark snapshot create --name <string> --bucket <string>
As data
{"$proc":["snapshot","create"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/snapshot"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["snapshot","create"], { name: "<name>", bucket: "<bucket>" });
console.log(JSON.stringify(result));

From the command line

$ mark snapshot create --name <string> --bucket <string>

As data, in a program

{
  "$proc": ["snapshot", "create"],
  "input": { "name": "<name>", "bucket": "<bucket>" }
}

Input

FieldTypeRequiredDefaultDescription
namestringyesSnapshot name (used in S3 key and metadata)
preset"light" | "medium" | "heavy"no"medium"Capture preset (default: medium)
bucketstringyesS3 bucket for storage
pathsstring[]noSpecific paths to include (default: all repos in ecosystem)
descriptionstringnoOptional description

Output

FieldTypeRequiredDefaultDescription
idstringyesThe snapshot id
locationstringyesThe S3 location of the archive
metadataobjectyesThe metadata of the snapshot
uploadDurationnumberyesThe time of the upload, in milliseconds
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "description": "Snapshot name (used in S3 key and metadata)"
      },
      "preset": {
        "default": "medium",
        "description": "Capture preset (default: medium)",
        "type": "string",
        "enum": [
          "light",
          "medium",
          "heavy"
        ]
      },
      "bucket": {
        "type": "string",
        "description": "S3 bucket for storage"
      },
      "paths": {
        "description": "Specific paths to include (default: all repos in ecosystem)",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "description": {
        "description": "Optional description",
        "type": "string"
      }
    },
    "required": [
      "name",
      "bucket"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "The snapshot id"
      },
      "location": {
        "type": "string",
        "description": "The S3 location of the archive"
      },
      "metadata": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The snapshot id"
          },
          "name": {
            "description": "The name of the snapshot",
            "type": "string"
          },
          "preset": {
            "description": "The preset: light, medium or heavy",
            "type": "string"
          },
          "createdAt": {
            "description": "The time of the snapshot (ISO 8601)",
            "type": "string"
          },
          "environment": {
            "description": "The environment of the snapshot",
            "type": "object",
            "properties": {
              "os": {
                "description": "The operating system",
                "type": "string"
              },
              "nodeVersion": {
                "description": "The Node.js version",
                "type": "string"
              },
              "pnpmVersion": {
                "description": "The pnpm version",
                "type": "string"
              },
              "username": {
                "description": "The user who made the snapshot",
                "type": "string"
              },
              "hostname": {
                "description": "The host name",
                "type": "string"
              }
            },
            "additionalProperties": {}
          },
          "repositories": {
            "description": "The repositories in the snapshot",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "description": "The repository folder, relative to the snapshot root",
                  "type": "string"
                },
                "name": {
                  "description": "The package name",
                  "type": "string"
                },
                "branch": {
                  "description": "The branch at the time of the snapshot",
                  "type": "string"
                },
                "commit": {
                  "description": "The HEAD commit at the time of the snapshot",
                  "type": "string"
                },
                "dirty": {
                  "description": "True when the working tree had changes",
                  "type": "boolean"
                },
                "stashCount": {
                  "description": "The number of stashes",
                  "type": "number"
                },
                "remoteUrl": {
                  "description": "The remote URL",
                  "type": "string"
                },
                "ahead": {
                  "description": "The commits that the remote did not have",
                  "type": "number"
                },
                "behind": {
                  "description": "The commits of the remote that the branch did not have",
                  "type": "number"
                }
              },
              "additionalProperties": {}
            }
          },
          "checksum": {
            "description": "The SHA-256 checksum of the archive",
            "type": "string"
          },
          "archiveSize": {
            "description": "The size of the compressed archive, in bytes",
            "type": "number"
          },
          "description": {
            "description": "The description",
            "type": "string"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": {},
        "description": "The metadata of the snapshot"
      },
      "uploadDuration": {
        "type": "number",
        "description": "The time of the upload, in milliseconds"
      }
    },
    "required": [
      "id",
      "location",
      "metadata",
      "uploadDuration"
    ],
    "additionalProperties": {}
  }
}