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

@schlessera/brain-module-finance

v0.6.3

Published

brain-kit module: client finance — ledgers, accounts-receivable tracking

Downloads

1,524

Readme

@schlessera/brain-module-finance

Requires Bun ≥ 1.3 (via @schlessera/brain's bun:sqlite) — npm/npx will not warn you (npm ignores engines.bun); install from https://bun.sh.

Accounts-receivable tracking for freelance / agency client work: per-client ledger.md files are the source of truth, and the module derives every balance, status, aging bucket, and reconciliation warning from their frontmatter.

Enable it in brain.config.ts:

modules: {
  "@schlessera/brain-module-finance": { clientsDir: "clients", feeTolerance: 30 },
}

Contributed type

| Type | Directory | Notes | |-----------|-------------|-------| | finance | clients/ | one sub-directory per client, each holding a ledger.md |

Relocating the directory. The manifest declares the finance type's dir as the static literal clients (a module manifest is evaluated before user config, so it cannot read clientsDir). The clientsDir config option is what the CLI and hygiene check actually use. If you move clients elsewhere, set both:

modules: { "@schlessera/brain-module-finance": { clientsDir: "billing/clients" } },
taxonomy: { types: { finance: { dir: "billing/clients" } } },

Config schema

| Key | Type | Default | Meaning | |---------------|----------|------------|---------| | clientsDir | string | "clients"| Directory (relative to the brain root) holding client folders. | | feeTolerance| number | 30 | Max per-invoice shortfall (bank/processor fees) still treated as fully paid. | | currency | string | "USD" | Currency assumed when a ledger omits currency:. | | termsDays | number | 30 | Payment terms (days) assumed when a ledger omits terms_days:. |

Ledger frontmatter spec

Each clients/<slug>/ledger.md carries this frontmatter. templates/ledger.md is the annotated starter (used by brain finance new-client); this table is the authoritative field reference.

Top-level keys:

| Key | Required | Meaning | |----------------|----------|---------| | type | — | finance (so the doc classifies correctly). | | client | yes | Stable slug; defaults to the directory name. | | display_name | — | Name shown in reports (falls back to title, then client). | | legal_name | — | Full legal entity name. | | currency | — | ISO code; USD/EUR get a currency symbol, others are suffixed. | | status | — | Free-form label (active / inactive / archived); default active. | | terms_days | — | Payment terms in days; overdue = issued + terms_days. |

invoices: — array of issued/drafted invoices:

| Field | Meaning | |---------------|---------| | number | Invoice id. The YYYY-<series>-NN shape enables numbering-gap detection. | | period | Service month, YYYY-MM (optional). | | issued | Date first sent, YYYY-MM-DD. Omit to keep the invoice a draft. | | hours | Optional; hours billed. | | amount | Invoice total, in currency major units. | | state | Terminal exception only: written_off | credited. | | paid_via | Marks the invoice settled outside the tracked payment stream (e.g. an external payment processor). | | paid_date | Date of that external settlement. | | paid_amount | Amount settled externally; defaults to amount. | | note | Optional free text. |

payments: — array of cash receipts. Reconciliation expects received == (Σ allocations) − fee:

| Field | Meaning | |---------------|---------| | date | Payment date, YYYY-MM-DD. | | received | Net cash received (after processor/bank fees). | | fee | Optional; processor/bank fee withheld. | | method | Optional label (wire / card / …). | | account | Optional receiving-account label. | | allocations | [{ invoice, amount }] — how the payment is applied to invoices. | | note | Optional free text. |

Derived statuses

draft (not yet issued) · open (issued, unpaid) · partial (some paid) · paid (open balance ≤ 0, or within feeTolerance) · overdue (past issued + terms_days) · written_off · credited.

CLI

The module registers one top-level command, brain finance:

| Command | Effect | |--------------------------------|--------| | brain finance | AR report across every client ledger (--json for a { portfolio } envelope). | | brain finance sync | Regenerate the tables in each ledger body and the clients/_index.md dashboard from frontmatter (--json{ files }). | | brain finance new-client <slug> | Scaffold clients/<slug>/ledger.md from templates/ledger.md (errors if it already exists). |

Generated block

sync rewrites only the region between these markers in each ledger body, so hand-written prose around it is preserved:

<!-- BEGIN GENERATED — do not edit by hand; run `brain finance sync` -->
…tables…
<!-- END GENERATED -->

Index-sync rules

This module contributes no directory anchors of its own; ledgers are ordinary documents plus a generated clients/_index.md dashboard.

Hygiene check

ledger generated block out of date — a dry-run of sync. For every ledger (and clients/_index.md) whose generated block no longer matches its frontmatter, it emits a warning audit issue suggesting brain finance sync. Surfaced by brain audit.