Skip to content
Changelog

Report a bug

Project Files

A code automation project is a folder. You deploy it with type-cli automations deploy.

  • Directorymy-automation/
    • type.json the project settings
    • fixtures.json optional test cases
    • Directorysrc/
      • main.ts the entrypoint
      • format.ts other modules
    • Directory.type/ made by the CLI; never uploaded
      • project.json
      • deployment.json
type.json
{
"name": "Hourly check",
"description": "Record the scheduled time in run history",
"entrypoint": "src/main.ts"
}
FieldRequiredDefaultRules
nameYes—1 to 200 characters. Must be unique in the Space.
descriptionNo—At most 2,000 characters.
entrypointNosrc/main.tsThe file that default-exports automation({ deployment, output, stages }). Ends in .ts, .js, .mts, or .mjs. 1 to 255 characters.
expirationNoThe source valueAn expiration that replaces deployment.expiration in the source. null removes the expiration.
integrationAccountsNo—At most 50 { "organizationIntegrationId", "integrationAccountId" } pairs. Each pair picks the saved account that the automation uses for that connection.

type.json must be a regular file of at most 64 KiB. Type rejects unknown fields.

An expiration flag on type-cli automations deploy replaces both type.json and the source for that deploy. See CLI Reference.

The CLI reads the folder and uploads only source files.

RuleDetail
File typesOnly names that end in .ts, .js, .mts, .mjs, or .json. The CLI skips other files, for example .md, .tsx, and .yaml.
Hidden filesFiles and folders whose names start with . are skipped, for example .env and .type/.
Symbolic linksSkipped.
Ignore filesThe CLI follows .gitignore and .typeignore in each folder. Their rules apply to that folder and the folders inside it. A ! rule includes a file again.
Foldersnode_modules, dist, build, coverage, generated, and vendor are skipped at all levels.
Config and secretstype.json, package.json, tsconfig.json, credential.json, credentials.json, secret.json, secrets.json, and service-account.json are skipped. So are the same names with more text after a . or -, for example package-lock.json, tsconfig.build.json, or secrets-prod.json. The match is not case-sensitive.
TestsNames that end in .test.<ext>, .spec.<ext>, .generated.<ext>, or .d.ts are skipped, for example format.test.ts.
Root fixtures.jsonRead as test cases, not uploaded as code. A fixtures.json in a subfolder is uploaded as a normal module.
  • At most 256 files.
  • At most 1 MiB for all files together, including fixtures.json.
  • The source files, as JSON, must also fit in 1 MiB.
  • Each file path is 1 to 255 characters. Paths must be relative, with no . or .. parts, backslashes, or control characters.
  • These paths are reserved: node_modules, .type-installed, and .type-contract.
  • Each .gitignore and .typeignore is at most 64 KiB.

Type does not install packages. A package.json file is not uploaded. Your code can import only the allowed modules and relative files in the project.

An optional array of test cases. Type runs them during each deploy. If one fails, the deploy fails. See Test with Fixtures.

This fixture tests the entrypoint below:

fixtures.json
[
{
"name": "records the scheduled time",
"subscriptionId": "hourly",
"payload": { "scheduledAt": "2026-10-07T12:00:00.000Z" },
"toolResponses": [],
"expectedOutput": { "checkedAt": "2026-10-07T12:00:00.000Z" }
}
]
src/main.ts
import {
automation,
code,
complete,
recurringEventSchema,
} from "@type-dot-com/sdk/automations";
import { z } from "zod";
export default automation({
output: z.object({ checkedAt: z.string() }),
deployment: {
subscriptions: {
hourly: {
title: "Hourly check",
description: "Record the scheduled time in run history",
source: {
kind: "recurring",
schedule: { kind: "interval", everySeconds: 3600 },
},
entry: "record",
},
},
},
stages: {
record: code({
input: recurringEventSchema,
run: ({ input }) => complete({ checkedAt: input.scheduledAt }),
}),
},
});
FieldRequiredRules
nameYes1 to 120 characters. Unique in the file.
subscriptionIdYesThe subscription key to run.
payloadYesThe event, in the same shape as a live event. For debounce.delivery: "batch", an array of events.
checkpointNoThe value of ctx.checkpoint.value for this case. Without it, ctx.checkpoint is null.
environmentNoTest values for environment variables, as strings. Fixtures never read the Space’s saved values.
matcherNoSimulated matcher results: { decision?: "match" | "skip", ownSlackUserId?, jev?: { model, answers } }. See Test matchers.
toolResponsesNoAt most 128 { request, response } pairs for ctx.tools.call, ctx.read.call, and ctx.write.call.
integrationResponsesNoAt most 128 { request, response } pairs for ctx.read.request and ctx.write.request.
expectedOutputNoThe exact JSON value that the entry stage passes to complete() or blocked().
expectedErrorNoText that the error message must contain. 1 to 2,000 characters.
  • A file can have at most 20 cases.
  • Do not set both expectedOutput and expectedError in one case.
  • A case runs only the subscription’s entry stage. It does not follow next() to other stages, and it does not start agent stages.
  • Omit both expectedOutput and expectedError for an event that a matcher or a resource filter skips. Such a case must not have toolResponses or integrationResponses.
{ "projectId": "0b5a8f2e-7c1d-4e3f-9a6b-2c4d6e8f0a1b" }

The CLI makes this file at the first deploy, before it sends anything. Type uses the project ID and the Space to find the automation.

  • Keep this file, and commit it to version control.
  • If you delete it, the next deploy makes a new automation.
  • If you copy the folder, also make a new project ID, or the two folders update the same automation.

The CLI writes this file at each deploy. It records the last attempt:

{
"projectId": "0b5a8f2e-...",
"deploymentId": "3f6c2a4e-...",
"automationId": "atask_01k...",
"serverUrl": "https://api.type.com",
"space": "engineering"
}

The CLI saves deploymentId before it sends the project, and adds automationId, serverUrl, and space when Type answers. Use deploymentId with type-cli automations deployment to read the result of an interrupted deploy. The CLI does not read this file to continue a deploy.