npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

systemd-unit-doctor-kit

v0.1.0

Published

Inspect systemd unit files with portable diagnostics.

Downloads

126

Readme

systemd-unit-doctor-kit

License: MPL-2.0 CI

Inspect .service, .timer and .socket systemd unit files with portable, structured diagnostics.

systemd-unit-doctor-kit is a clean-room TypeScript draft. The core has no runtime dependency and does not call Node APIs, so it can run in browsers, workers, CLIs and CI tooling. The bundled CLI is a thin Node wrapper around the same core.

Demo

Try the browser preview: packages.wasta-wocket.fr/systemd-unit-doctor-kit.

Package quality

  • TypeScript types are generated from the source.
  • ESM-only package with no runtime dependencies in the core.
  • Marked as side-effect free for bundlers.
  • CI runs npm ci, typecheck, build, and test.
  • Tested on Node.js 20 and 22 with GitHub Actions.
  • Browser-friendly implementation with Node-only code isolated in the CLI.

Install

npm install systemd-unit-doctor-kit

Quick Start

import { formatSystemdUnitDiagnostics, inspectSystemdUnit } from "systemd-unit-doctor-kit";

const source = `[Unit]
Description=Nightly sync

[Service]
Type=oneshot
ExecStart=/usr/local/bin/sync-data %q
Restart=always
`;

const result = inspectSystemdUnit(source, { kind: "service" });

console.log(result.ok);
console.log(formatSystemdUnitDiagnostics(result));

Output:

false
WARNING unescaped-percent-specifier 6:31 Service.ExecStart - Value contains a percent sequence outside the MVP specifier allowlist; use %% for a literal percent.
INFO missing-install-section 1:1 - No [Install] section found; the unit may not be enableable.
WARNING risky-restart-with-oneshot 7:1 Service.Restart - Type=oneshot with this Restart policy is often rejected or surprising; verify with systemd-analyze.

CLI

systemd-unit-doctor ./worker.service --format=markdown
systemd-unit-doctor ./backup.timer --json
systemd-unit-doctor ./listener.socket --no-install-check

The CLI exits with 1 when an error-level diagnostic is present.

API

inspectSystemdUnit(input, options?)

Returns:

  • ok: false when at least one error-level diagnostic exists;
  • kind: service, timer, socket or unknown;
  • sections: section names with source lines;
  • assignments: parsed key=value entries with section, value and line;
  • diagnostics: stable objects with code, severity, message, line, column, and optional section/directive.

Options:

| Option | Default | Description | | --- | --- | --- | | kind | inferred from sections | Unit kind to check against. | | requireInstall | true | Report an info diagnostic when [Install] is missing. | | allowUnknownDirectives | false | Disable MVP directive allowlist warnings. | | maxInputCharacters | 1000000 | Stop before parsing unexpectedly large inputs. |

createSystemdUnitInspector(defaultOptions?)

Creates a reusable inspector with default options.

formatSystemdUnitDiagnostics(result)

Formats diagnostics for terminal output, Markdown reports or tests.

MVP Diagnostics

  • invalid or empty input;
  • input that exceeds the configured size limit;
  • malformed sections and assignments;
  • assignments before any section;
  • unknown sections and directives for the MVP allowlist;
  • sections that do not match the selected unit kind;
  • duplicate non-repeatable directives;
  • suspicious percent specifiers and dangling continuations;
  • comments inside continued lines;
  • missing [Unit], kind section or [Install];
  • Type=oneshot with risky Restart values;
  • timer units without an OnCalendar/OnBootSec style trigger.

Limits

This package complements systemd-analyze verify; it does not replace it. The MVP rule table is intentionally small, versionless and focused on .service, .timer and .socket files. It does not evaluate drop-ins, dependency graph semantics, filesystem state, user/group existence or distro-specific systemd versions.

License

MPL-2.0