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

@lacspace/postplan

v1.0.0

Published

Choose a post format (video / single image / carousel / text) per story and platform, so a feed like Facebook gets a natural mix instead of all videos. Rule-based and deterministic — platform fit, what the story can actually produce, a breaking-news nudge

Readme

@lacspace/postplan

Pick the right post format for each story and platform — so Facebook gets a natural mix, not all videos. Rule-based and deterministic: it weighs platform fit, what the story can actually produce, a breaking-news nudge, and a "don't repeat the last few" penalty. An optional cheap AI tie-break runs only when two formats are nearly tied.

npm i @lacspace/postplan
import { planPosts } from "@lacspace/postplan";

const plan = await planPosts(
  { hasVideo: true, imageCount: 3, hasStat: true, isBreaking: false },
  {
    platforms: ["facebook", "instagram", "tiktok", "x"],
    recent: { facebook: ["video", "video", "video"] }, // last 3 FB posts were videos
  },
);
// → [
//   { platform: "facebook",  format: "image",    reasons: [...], alternatives: [...] }, // mix penalty pushed it off video
//   { platform: "instagram", format: "carousel", ... },
//   { platform: "tiktok",    format: "video",    ... },
//   { platform: "x",         format: "image",    ... },
// ]

Why

Deciding format-per-platform by hand (or by LLM for every story) is repetitive and burns tokens — and left to a naive rule it floods Facebook with videos. postplan makes the call deterministically and only spends a token or two on genuinely close decisions.

API

planPosts(features, context, options?) → Promise<PlatformPlan[]>

  • features — { hasVideo?, imageCount?, hasStat?, hasQuote?, isBreaking?, textLength?, category? }. Impossible formats are excluded (no video without an asset; a carousel needs ≥ 2 images, or a stat + quote).
  • context — { platforms, recent? }. recent[platform] is the last few formats posted there; repeats get a mix penalty so the feed stays varied.
  • options — tieThreshold (default 0.1), mixWindow (default 5), and llm — an injected (prompt) => Promise<string> tie-break that is called only when the top two scores are within tieThreshold. Without it, selection is fully deterministic; if it throws, planPosts falls back to the deterministic pick.

Each PlatformPlan: { platform, format, score, alternatives, reasons, aiTieBreak? } — reasons explains the decision, alternatives are the runners-up with scores.

Platform affinities

Baked-in format affinities per platform (TikTok/YouTube lean video, X/Threads lean text/image, Instagram leans carousel/video, Facebook is deliberately balanced so it receives a healthy mix). Breaking news nudges toward fast formats (image, or video if ready) and away from carousels.

tieBreakPrompt(platform, features, candidates) → string

The compact prompt used for the AI tie-break, exported so you can inspect or reuse it. It asks for a one-word answer to keep the call cheap.

Licence

Lacspace Free Licence v1.0 — free for personal and commercial use.