New:Socket for Asana Is Now Available.Learn more
Get Started

greenly

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

greenly

Config-driven project check runner. Define your lint/format/typecheck/test steps in greenly.config.ts and run them with one command.

Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
400
175.86%
Maintainers
1
Weekly downloads
 
Created
Source

greenly

npm version npm downloads unpacked size Socket Badge PR Checks license

Config-driven project check runner. Define your lint / format / typecheck / test steps once in greenly.config.ts and run them with a single command.

Stop copy-pasting a pr-checks script into every repo. Describe your checks in a typed config, and greenly runs them in order, streams their output, and offers to auto-fix the ones that can be fixed.

Quick start

The fastest way to get going is the interactive scaffolder. It asks for a project name, config format, script name, and which checks to include, then writes the config, adds a "check": "greenly" script, and installs greenly. It adapts to your project: it reuses matching package.json scripts (e.g. fmt:check, lint) when they exist, only offers the lint/format tools you already use, and detects Next.js:

pnpx greenly init
# or: npx greenly init

Install

Or set it up manually:

pnpm add -D greenly

Create a greenly.config.ts at your project root:

import { defineConfig } from "greenly";

export default defineConfig({
  name: "MyProject",
  checks: [
    { name: "TypeScript", command: "pnpm tsc --noEmit" },
    { name: "Format", command: "pnpm oxfmt --check", onFail: "pnpm oxfmt" },
    { name: "Lint", command: "pnpm oxlint" },
    { name: "Build", command: "pnpm build", optional: true },
  ],
});

Run it:

pnpm greenly

Or wire it into your scripts so pnpm check works too:

{
  "scripts": {
    "check": "greenly"
  }
}

How it works

  • Checks run in order. Each command runs in your shell with its output streamed live, so failures show up immediately.
  • If a check fails and declares an onFail, greenly asks Yes/No whether to run the fixer, then continues.
  • Checks marked optional: true warn on failure but never fail the overall run.
  • greenly exits with code 1 if any non-optional check is still failing, otherwise 0.

Config reference

FieldTypeDescription
namestring?Project name shown in the banner.
checksCheck[]Ordered list of checks.
checks[].namestringLabel shown while running and in the summary.
checks[].commandstring | () => void | Promise<void>Shell command (e.g. "pnpm tsc --noEmit"), or a function run in-process.
checks[].onFailstring | (ctx) => void | Promise<void>Fixer run (after a Yes/No prompt) when the check fails.
checks[].optionalboolean?When true, a failure warns instead of failing the run.

command can be a function instead of a shell string. It may be async, and it must throw (or reject) to mark the check as failed. When it throws, greenly prints only the error's message (and its cause if present) - not a stack trace - so make the message descriptive:

export default defineConfig({
  checks: [
    {
      name: "Env vars",
      command: () => {
        if (!process.env.API_KEY) throw new Error("API_KEY is not set");
      },
    },
  ],
});

onFail can also be a function, useful for custom fix logic:

export default defineConfig({
  checks: [
    {
      name: "Generated files",
      command: "pnpm verify:generated",
      onFail: async ({ check }) => {
        await regenerate();
        console.log(`Regenerated files for ${check.name}`);
      },
    },
  ],
});

Config file formats

Any of these are auto-discovered (first match wins, in this order):

greenly.config.ts   greenly.config.mts   greenly.config.cts
greenly.config.js   greenly.config.mjs   greenly.config.cjs
greenly.config.json

CLI

Command / FlagDescription
greenlyRun the checks from greenly.config.*.
greenly initScaffold a config interactively (format, script name, checks) and install greenly.
-y, --yes, --fixAuto-run every onFail fixer without prompting (great for CI / agents).
--no-fixRun all checks, never prompt or fix, just report.
-v, --versionPrint the version.
-h, --helpShow help.

When stdout is not a TTY (CI, piped output), greenly is non-interactive by default, so it never prompts and nothing hangs. Use --yes there to auto-apply fixes.

License

MIT © Yusif Aliyev

Keywords

check

FAQs

Package last updated on 31 Jul 2026

Related posts