---
title: "Use it as a library"
description: "Call a run from your own script and format its summary."
canonical_url: "https://diglot.sh/workflow/action/library"
---
# Use it as a library

> Call a run from your own script and format its summary.

The package exports the function the Action itself uses, so you can run a translation pass locally or in a different CI system. The Action ships as `@diglot/action` and needs Node.js 22.18 or later.

```bash
pnpm add @diglot/action
```

```ts
import { run, summary } from '@diglot/action'

const result = await run({ cwd: '.', locales: ['fr'], limit: 200, commit: false })
console.log(summary(result))
```

With `commit: false`, the run writes records, manifests and bundles to the working tree and leaves committing to you. The result tells you whether anything changed (`changed`), and carries the totals, one report per source and per locale, the commit message it would have used and the new commit `sha` when it made one.

## Options

`run` accepts the same settings as the Action's inputs, with camel-case names: `cwd`, `locales`, `sources`, `model`, `limit`, `retryRejected`, `commit`, `buildDist` and `author` (`{ name, email }`). `model` can be a model id or any AI SDK language model instance. Two options exist only for the library: `log`, a function that receives progress messages, and `cloneUrl`, which maps `owner/repo` to a clone URL for sources that aren't on GitHub.

## The summary

`summary(result)` returns the markdown that the Action writes to the job page. `outputs(result)` is used internally to produce the step outputs.


## Sitemap

See the full [sitemap](https://diglot.sh/sitemap.md) for all pages.
