Tegami

Programmatic API

Use Tegami from scripts and custom tooling.

Introduction

tegami() returns a handle with four methods that cover the full release cycle.

import { tegami } from "tegami";

const paper = tegami({
  cwd: process.cwd(),
});

generateChangelog()

Create pending changelog files from git commit history since the latest tag:

const created = await paper.generateChangelog();

You can also author changelog files manually — see Changelogs.

draft()

Build a draft from pending changelog files:

const draft = await paper.draft();

for (const [id, packageDraft] of draft.getPackageDrafts()) {
  console.log(id, packageDraft.type);
}

await draft.apply();

The draft supports await using for automatic apply:

await using draft = await paper.draft();
// apply() runs when the block exits

publish()

Publish packages from the committed publish lock:

const result = await paper.publish();

if (result === "skipped") return;

for (const [id, packagePlan] of result.packages) {
  console.log(id, packagePlan.publishResult);
}

Pass { dryRun: true } to validate without touching registries.

Publish Strategy

Tegami will not publish any packages unless they are listed in the publish lock with updated: true.

This ensures for new public packages created between version and publish, they will only be published in the next versioning cycle.

cleanup()

Optionally remove a finished publish lock file:

const result = await paper.cleanup();
// { state: "removed" } or { state: "skipped", reason: "missing" | "pending" }

Only succeeds when every package in the lock has already published. Pending locks are left in place. This is housekeeping only — Tegami does not use a finished lock for publishing or versioning.

Configurations

Prop

Type

See Plugins and Package Groups for option details.

On this page