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

starsync

v2.5.14

Published

Maintain a local archive of your starred GitHub or Codeberg repositories, bound to one host and account.

Readme

starsync

SAVE YOUR STARRED REPOS BEFORE THEY DISAPPEAR!

StarSync preserves repositories starred by one GitHub or Codeberg account in a managed local archive. It matches checkouts by stable repository ID within that host, refreshes available history, and adds new stars under canonical repository--owner folders.

StarSync 2 requires Git, an initialized archive using format 2, and either Bun 1.4.2 or Node 24 or newer. Windows, macOS, and Linux are supported.

Install

Nothing to install — run the published CLI directly under either runtime. For a new archive, create an empty directory, supply the selected host's API token as described under Authentication, then initialize before the first sync. Choose one runtime:

npx starsync init D:/archives/stars
npx starsync sync D:/archives/stars

Or with Bun:

bunx starsync init D:/archives/stars
bunx starsync sync D:/archives/stars

Both resolve bin to dist/cli.js, a node-target bundle, so Bun isn't required to use StarSync. For an existing format-2 archive, run only sync with the same path.

To install it as a command instead:

npm install -g starsync
bun add -g starsync

Working on StarSync

Development requires Bun. Consuming StarSync doesn't.

bun install

The dependency-free prepare guard rejects npm, yarn, and pnpm for a working copy. It runs on prepare rather than preinstall because the guard needs Bun to execute, and a preinstall guard also fires for anyone consuming the published package — which broke npx starsync before it ever reached the CLI. prepare never runs for an install from the registry.

prepare then builds. bin, main, and types all resolve into the gitignored dist/, so without that step a clone has no entry points. Building here covers the two installs that read them from a checkout rather than a tarball — a working copy, and a Git dependency such as bun add git+https://github.com/NomadicDaddy/starsync — and costs about a second on top of bun install. Registry consumers get the built files from the published tarball instead.

Publish with bun publish. The same guard rejects npm publish.

Authentication

StarSync keeps API and Git transport authentication separate:

  • GITHUB_TOKEN is used through Octokit to authenticate the archive owner and list or resolve GitHub repositories. It is required by init, sync, rename, and verify --force.
  • CODEBERG_TOKEN serves those commands for Codeberg archives through its Forgejo API. Use a token with read access to the user and repositories. API requests stay on Codeberg; redirects are refused and failed response bodies are not printed.
  • Clone and fetch operations use credentials already configured for Git, such as Git Credential Manager or SSH keys. The API token is never passed to Git.

Tokens and embedded Git credentials are excluded from command arguments and archive metadata. Remote URLs and errors are sanitized before reporting. Managed origins must match the archive's recorded host; other hosts and credential-bearing URLs are rejected.

Supply the selected token through the current process environment or a credential manager:

GITHUB_TOKEN=ghp_your_token_here npx starsync sync D:/archives/stars

When StarSync runs under Bun, for example bunx --bun starsync or bun run start in a checkout, Bun also loads a .env file from the working directory, so a GITHUB_TOKEN= or CODEBERG_TOKEN= line there is enough. Keep that file out of version control. npx starsync runs under Node, which doesn't load .env automatically, so there the token must be in the shell or process environment.

Set TARGET_PATH_GITHUB and TARGET_PATH_CODEBERG to keep separate default archive paths:

TARGET_PATH_GITHUB=D:/github
TARGET_PATH_CODEBERG=D:/codeberg

Every archive command accepts --host github.com|codeberg.org (or --host=HOST) to select the corresponding default path. Without --host, default-path selection uses GitHub. An existing TARGET_PATH remains a GitHub-only fallback when TARGET_PATH_GITHUB is absent; Codeberg never falls back to either GitHub variable. A defined but empty or quoted-empty host-specific value is an error, even when TARGET_PATH is set.

A positional path always takes priority. Without --host, its archive's recorded host is used. An explicit --host or an environment-selected default must match an initialized archive's recorded host or the command refuses before operating. These options select archives; they never move or merge their contents.

Archive contract

Every usable archive has .starsync/config.json containing format 2 and one valid owner on one host:

{
	"archiveFormat": 2,
	"host": "github.com",
	"owner": {
		"id": 123456,
		"login": "archive-owner"
	}
}

host accepts only github.com or codeberg.org; its absence means GitHub. New archives always record it explicitly. Existing GitHub archives need no rewrite. All other extra fields are rejected. Never change an archive's host to move its contents: IDs can collide across hosts. Initialize a separate empty archive for the other host. A configless directory is uninitialized, whether it is empty or populated. Any other format is unsupported, and malformed format-2 configuration is invalid. StarSync does not inspect such directories for checkouts or offer conversion.

Each managed checkout must store both of these local Git configuration values:

  • starsync.repository-id: the positive stable repository ID assigned by the archive's host;
  • starsync.repository-slug: the last known owner/name slug.

Missing, incomplete, invalid, or duplicated identity is a current-format error. There is no identity backfill path.

A managed checkout must also be a real directory inside the archive that holds its own Git data. StarSync reports an entry as blocked with checkout-outside-archive when it is a link or junction, resolves outside the archive root, or has a .git file or link or a commondir redirect. The same applies when it may borrow Git objects from another store: a git clone --shared checkout or any other objects/info/alternates file, a .git/objects or .git/objects/info that is a file or link, or a link among the entries of .git/objects or one level inside them (such as pack or a loose-object folder). Its history would not be held in the archive. Sync, verify and rename run no Git command in such a checkout, and verify --force never replaces it.

Use init on an existing empty directory. It authenticates the selected host account and writes the format-2 host and owner binding. Operations that authenticate compare the stable account ID, so a login rename is accepted while a different account is rejected.

For Codeberg, provide CODEBERG_TOKEN, then run:

bunx starsync init --host codeberg.org D:/archives/codeberg-stars
bunx starsync sync D:/archives/codeberg-stars

Later commands read the host from the archive. With TARGET_PATH_CODEBERG set, the same archive can be selected by bunx starsync sync --host codeberg.org without a positional path.

Moving from StarSync 1.x

There is no in-place upgrade or conversion. Preserve the existing archive as a backup, create a different empty directory, run init there, and then run sync to build a format-2 archive from the account's current stars. To reuse the old path, move the existing directory aside before creating and initializing a new empty directory at that path.

Commands

StarSync accepts only explicit commands. Bare invocation and unknown commands are usage errors with exit code 2. Root --help and command-specific help remain available.

npx starsync init [--host github.com|codeberg.org] [--json] [target-path]
npx starsync sync [--dry-run] [--json] [--concurrency=N] [--min-free-space=SIZE] [target-path]
npx starsync verify [--force] [--json] [--min-free-space=SIZE] [target-path]
npx starsync rename [--apply] [--json] [target-path]
npx starsync dates [--dry-run] [--json] [target-path]
npx starsync unlock [--force] [--json] [target-path]

All commands above accept --host github.com|codeberg.org. Every command requires either [target-path] or the selected host's default path. Missing, empty, or quoted-empty input is a usage error and never falls back to the package directory.

sync

sync lists the archive owner's current stars, adds missing repositories, refreshes recognized checkouts, and retains repositories that are no longer starred. It identifies existing checkouts by repository ID, not by slug or folder label. A repository rename or ownership transfer is reported as pending while refresh continues against the existing checkout. Use rename to update the label.

New repositories are cloned into a unique StarSync-owned sibling staging directory. StarSync validates the archive host origin, Git objects, archive owner, cleanliness, and identity before atomically publishing the canonical folder. Occupied destinations are never overwritten.

Refresh fetches available remote branches and tags without pruning preserved references, then fast-forwards to the host's current default branch. Divergent commits and real local changes are blocked. Moved upstream tags retain their archived target and produce a warning. If an unavailable Git LFS object breaks a clone or refresh, StarSync retries once with GIT_LFS_SKIP_SMUDGE=1 and keeps the pointer file without persisting that setting.

StarSync won't run Git in a checkout whose own config sets a command Git would act on. That covers .git/config, anything it includes, and the worktree config. The settings are a filter driver's clean, smudge or process, core.attributesFile, core.sshCommand, a credential helper, core.askPass, a url.<base>.insteadOf rewrite, remote.origin.uploadpack and a protocol policy. Sync, verify and rename report such a checkout as blocked with checkout-config-runs-commands, and verify --force doesn't replace it. Set those in your user Git config instead, where they keep working, Git LFS included. Refresh checks again before each step that could run one, so a setting that takes effect after its branch switch stops the merge. StarSync's Git commands never go into submodules: fetch, switch and merge don't recurse, and status reports a submodule whose recorded commit changed but doesn't read the submodule's files.

On platforms that cannot represent a repository path, StarSync preserves the path in Git history and the index while excluding its working-tree copy through sparse checkout. Such paths do not count as local work; genuine staged, unstaged, untracked, or conflicted changes still block.

sync takes the archive lock and removes abandoned StarSync-owned staging directories. It also removes a damaged-checkout backup, but only when that backup's replacement record shows the replacement was published; any other backup may be the only copy, so it stays and is reported. Then sync measures the free space on the filesystem holding the target. Below the minimum it refuses before querying stars or processing any repository. The default minimum is 1GB. --min-free-space=SIZE sets another one, as a byte count or with a B, KB, MB, GB, or TB suffix, each a binary multiple (KiB, MiB, GiB, TiB are accepted as the same multiples); --min-free-space=0 turns the check off. A dry run reports a shortfall as a warning and still previews the work.

This is one measurement at startup, not a running budget. StarSync does not estimate how large the repositories it is about to clone are, does not reserve capacity for them, and does not measure again while they are processed, so a run that starts above the minimum can still exhaust the disk and fail per repository. The reserve keeps a run from starting on a disk that is already too full to finish anything useful.

Use --dry-run for a read-only preview and --concurrency=N for 1-8 concurrent repository jobs.

verify

Without --force, verify is local and read-only. It checks Git object integrity, origins, identity metadata, duplicate IDs, local state, canonical names, pending renames, and archive owner binding. It requires neither a token nor network access.

verify --force is owner-authenticated recovery. A checkout with corrupt Git data, local changes, or missing identity metadata is resolved and freshly cloned into a staging directory. A checkout without identity can be resolved only when its folder already has the canonical repository--owner name. The replacement must pass origin, object, owner, cleanliness, and identity validation before publication. Before the original checkout is moved aside to a .starsync-damaged-<uuid> backup, StarSync writes a replacement record in .starsync/replacements/, and marks it published once the fresh checkout is in place. If publication fails, StarSync moves the original back to its folder. If that move fails too, the original stays at its backup name, the error names that name, and the record stays pending. The backup is deleted only when its record shows publication; after an interruption or a failed rollback it stays and is reported, because it may be the only copy. The same mode removes abandoned .starsync-checkout-* staging directories while holding the archive lock.

Because forced recovery clones, it takes the same startup reserve as sync: after that cleanup and before any checkout is replaced, StarSync measures the free space on the filesystem holding the target and refuses below the minimum. The default is 1GB, --min-free-space=SIZE sets another one with the same size grammar sync accepts, and --min-free-space=0 turns the check off. Read-only verify preserves checkout content and never measures free space. It still uses the operation lock.

rename

rename is a read-only preview unless --apply is present. It resolves each checkout's current repository identity by numeric ID on the archive's host and reports one of blocked, current, failed, or pending.

Every checkout must already contain a stable repository ID matching the host's resolved ID. Preview reports missing or mismatched identity, dirty or unverifiable state, duplicate identities, credential-bearing or invalid origins, and destination collisions without changing checkout content. Preview still creates and removes the transient operation lock described below.

rename --apply additionally authenticates the configured archive owner. For each safe pending checkout it updates the stored slug, normalizes origin, and moves the folder to repository--owner. Already-current checkouts remain unchanged. Successful updates remain in place if a later checkout is blocked, fails, collides, or the operation is interrupted. The operation writes no temporary rename state and does not rewrite archive configuration.

dates

dates is local and requires no token. It calculates each checkout's Archive Date from the newest committer time reachable across all local Git references and aligns the folder timestamp. Use --dry-run to preview.

unlock

Every archive operation except lock recovery uses .starsync/operation-lock.json, including read-only verification and previews. They create and remove transient coordination metadata; read-only describes preservation of checkout content, not an absence of filesystem writes. StarSync reclaims a same-host lock only after confirming its process is dead. Remote or uncertain ownership requires unlock --force, which still refuses to remove a lock owned by a confirmed live local process.

The lock must stay inside the selected archive. Just before each step that creates, reads or removes it, StarSync checks that .starsync is a real directory directly in the archive, not a file, link or junction, and that the lock, when one exists, is a regular file and not a link. If either is wrong, the command stops with archive-lock-not-contained and touches no lock, unlock --force included. If .starsync can't be inspected, it stops with archive-lock-read-failed instead.

Reporting and exit codes

Every command accepts --json. JSON mode writes exactly one schema-version-2 CommandReport to stdout and sends progress and diagnostics to stderr. Schema 2 separates:

  • checkout lifecycle: active, retained, or blocked;
  • pending rename as a boolean state;
  • current outcome: added, updated, current, skipped, or failed;
  • optional rename preview with blocked, current, failed, or pending classification;
  • findings with info, warning, or error severity.

Exit codes are 0 for success, 1 for an operational failure or blocked request, 2 for invalid usage, and 130 after interruption. On first interrupt, StarSync stops scheduling new work, lets in-flight Git operations finish, and emits a partial result.

Programmatic API

The package exports command-level operations that take explicit options and return the same CommandReport shape. They do not read CLI arguments, write process output, or exit. Progress uses an optional callback and cancellation uses AbortSignal.

main resolves to dist/index.js, a node-target ESM bundle, and types to declarations emitted from the same sources, so the API is available under Bun and under Node 24 or newer. Node can also reach it through require, which loads ESM natively on the supported versions.

import { renameArchive, syncArchive } from 'starsync';

const sync = await syncArchive({
	dryRun: true,
	targetPath: 'D:/archives/stars',
	token: process.env.GITHUB_TOKEN ?? '',
});

const renames = await renameArchive({
	targetPath: 'D:/archives/stars',
	token: process.env.GITHUB_TOKEN ?? '',
});

Supported operations are initArchive, syncArchive, verifyArchive, renameArchive, normalizeArchiveDates, and unlockArchive.

syncArchive and verifyArchive take the free-space reserve as minFreeSpace, in bytes. It defaults to 1 GiB (1,073,741,824 bytes, the CLI's 1GB), 0 turns it off, and a negative or fractional value returns an invalid-min-free-space usage report. verifyArchive applies it only when repair is requested and never measures on the read-only path.

initArchive accepts host: 'codeberg.org' (default 'github.com'). Pass the corresponding token explicitly to each authenticated operation; the API never selects tokens from the environment.

Release validation

A release candidate requires all of the following:

  1. The Windows, macOS, and Linux release matrix installs from bun.lock, runs smoke:qc, and builds the bundle with archive credentials unset.
  2. The reviewed live archive passes read-only verify --json and a complete rename --json preview. Evidence is stored outside the archive and refreshed if the archive changes.
  3. The offline copied-format-2 journey runs rename, verification, synchronization, and Archive Date normalization. The opt-in live smoke runs only against a caller-created temporary copy.

The live smoke requires STARSYNC_LIVE_SMOKE=1, GITHUB_TOKEN, and an explicit target below the system temporary directory. Its supported workflow is a temporary copy of a GitHub archive: it reads only GITHUB_TOKEN, while the operations it runs take the host from the copied archive's metadata, and it doesn't reject other hosts itself. It refuses a target equal to the legacy TARGET_PATH; it doesn't check TARGET_PATH_GITHUB or TARGET_PATH_CODEBERG.

bun run smoke:live -- <temporary-managed-archive>

Scripts

| Script | Purpose | | ---------------------------- | -------------------------------------------------------------------------------------------- | | bun run sync | Run the explicit sync command | | bun run start | Run any subcommand from source | | bun run build | Run build:bundle, then build:types | | bun run build:bundle | Bundle src/cli.ts and src/index.ts into dist/ for Node, deps external | | bun run build:types | Emit declarations into dist/types through tsconfig.types.json | | bun run smoke:qc | Run static, dead-code, leak, license, advisory, shared-core, and test gates | | bun run smoke:qc:fast | Static gate only: source shape, types, lint, format. No tests | | bun run smoke:live | Run the opt-in read-only smoke against an explicit archive copy | | bun run check:max-lines | Enforce production file size and extracted-function shape limits | | bun run check-deps | Advisory scan (bun audit) of every locked package, dev ones included, in smoke:qc | | bun run check:dead-code | Knip file and export reachability gate wired into smoke:qc | | bun run check:leak-guard | Self-test scripts/smokestack/hooks/leak-guard.sh against synthetic fixtures | | bun run check:licenses | Run both license checks: the shared core, then the attribution documents | | bun run check:license-core | Verify the shared license core against the installed dependency graph | | bun run check:shared-core | Verify shared hooks, helpers, manifests, and gates against their owners | | bun run licenses:generate | Rewrite THIRD_PARTY_LICENSES.md and THIRD_PARTY_NOTICES.md | | bun run typecheck | tsc --noEmit | | bun run lint | ESLint on source, scripts, tests and config, with unused-disable reporting and zero warnings | | bun run lint:fix | The same scope with --fix | | bun run test | Run the unit suite | | bun run format | prettier --write "src/**/*.ts" "scripts/**/*.ts" "test/**/*.ts" knip.json | | bun run format:check | The same files with --check |

check-deps fails on any advisory of any severity, and also when the scan can't complete, for example when the registry can't be reached, so the full gate needs network access. Here the name means the advisory scan, not the exact-version check it names in Spernakit and aidd. An advisory that can't be fixed at once may be skipped only with bun audit --ignore=<GHSA id> in the script, together with a recorded decision for that advisory.

prepare and prepublishOnly are lifecycle hooks rather than commands to run by hand. prepare runs the install guard, points core.hooksPath at scripts/smokestack/hooks/, seeds the leak-guard pattern file, and then builds; prepublishOnly runs smoke:qc.

Schedule the explicit sync command with Task Scheduler, cron, launchd, or another periodic runner. A non-zero exit lets the scheduler surface failures.

License

StarSync is MIT; see LICENSE.

The published package carries first-party source only — build:bundle passes --packages=external, so dependencies are installed by the consumer rather than redistributed inside the tarball. THIRD_PARTY_LICENSES.md records the license inventory of that dependency closure, and THIRD_PARTY_NOTICES.md reproduces each package's own copyright line and terms. Both are generated from bun.lock by bun run licenses:generate; bun run check:licenses fails when they drift from it, and a license family with no reviewed notice text fails the generator rather than being summarized as if its obligations were known.

Neither document ships in the tarball: a consumer's own resolver decides which versions it installs, so a copy pinned to this repository's lockfile would describe versions they may not have. They are retained as this project's own record of the dependency closure an install resolves, for compliance review — see the Scope section in THIRD_PARTY_LICENSES.md.