Skip to content

Astromech

@theholocron/astromech is the task runner behind holocron run. A repo declares one task manifest, and every surface is derived from it:

  • holocron run <task> (local)
  • holocron run ci (the CI suite, run locally)
  • the generated GitHub Actions workflows
  • the package.json scripts
  • the branch-protection required-checks list

It is a plain library, not a capability plugin. @theholocron/cli depends on it and instantiates it once.

Terminal window
pnpm add @theholocron/astromech

Most repos never import it directly: they use it through the CLI. Import it to build tooling on the same manifest.

import { createAstromech } from "@theholocron/astromech";
const astromech = createAstromech({ cwd });
const report = astromech.run("test:unit", { passthrough: ["--watch"] });
// { status: "ok" | "fail" | "skip" | "dry-run" | "unknown", command?, message? }
  • Tasks are named by intent, not tool. A repo declares test:unit, not vitest. The registry maps each task name to what it runs (vitest, tsc, eslint, prettier, knip, gitleaks, semantic-release, an Astro build, and so on), and tool names never appear in holocron.config.ts.
  • Resolution. holocron run <task> (a flat id such as test:unit or build, or a suite such as test that runs the leaves the repo lists; the old dotted names still work and print a deprecation notice) uses turbo.json if it defines the task, then a package.json script, then the registry’s local runner. A task made of jobs runs each job in order. A known task with nothing to run exits 0 (1 with --required), and an unknown task is an error.
  • Task entries. Each manifest entry can set ci, local, required and with (per-repo overrides on the reusable workflow). local: false makes a task CI-only.
  • Config. defineConfig comes from the zero-runtime-dependency @theholocron/astromech/config subpath. The manifest is the tasks key of holocron.config.*, with an optional dedicated astromech.config.* merged on top, loaded through @theholocron/datapad.
  • Generated surfaces. thinCallers() returns the workflow files, packageScripts() the package.json scripts, requiredChecks() the branch-protection contexts (ci and DCO where the ci aggregate check is hosted), aggregateCaller() the caller of that aggregate. The codecov.yml comes from the coverage provider, not from astromech. holocron sync and holocron setup write them.
  • Running CI locally. ci() runs every required task in CI order and sets the exit code of holocron run ci.
  • Release-time deploys. A package can declare a deploy task with on: "release", and holocron deploy on-release deploys it when a release changes it or one of its workspace:* dependencies.
  • Lint subpath. @theholocron/astromech/lint holds the commit-message linter and the ignore lists, shared with Sentinel so its central checks skip exactly what each repo’s own CI skips.
  • Repo-validation subpath. @theholocron/astromech/repo-validation holds the rules of the validate:specs and validate:docs checks as pure functions, run by the CLI (holocron probe docs presence) from git and by Sentinel from the GitHub API, so the two cannot disagree.
  • Upgrade subpath. @theholocron/astromech/upgrade holds the repo-agnostic upgrade machinery behind holocron upgrade: runUpgradeNode() rewrites every Node.js version pin (engines.node, @types/node, .nvmrc, .node-version, workflow node-version:, Dockerfile FROM node:, .tool-versions) from one major to another, and fetchLatestFromNpm() resolves a package’s latest version. The Holocron-specific parts, which are the @theholocron/* pin filter and the holocron.config.ts migration, stay in the CLI.

The full API reference is generated from the package’s TSDoc comments.