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

@suluk/cockpit

v0.4.1

Published

The pure cockpit core (cycle model · builder model · codegen · deploy planning · validate/audit/preview) shared by the vscode extension and the /superadmin web admin panel. CANDIDATE tooling.

Readme


CANDIDATE tooling — not official OpenAPI. Suluk is a single-contributor candidate for OpenAPI Specification v4.0 ("Moonwalk"), unaffiliated with the OpenAPI Initiative and unable to ratify anything on the SIG's behalf.

Install

bun add @suluk/cockpit

What it does

Given one v4 "Suluk" document, the cockpit computes every view a developer tool needs over it — as pure functions, no host API. The VS Code extension (suluk-vscode) and the web admin panel (@suluk/admin) both consume this exact core, so a projection is never reimplemented in a shell.

  • The cycle modelbuildCycle projects the document into a layered view (data · contract · auth · cost · docs · state · UI · providers · tests). Each layer is a projection of the same source, so you can read the lineage at a glance. The model is also a function of the requesting principal — pass scopes and gated operations drop out.
  • Validate / audit / previewvalidateSource (meta-schema), auditSource (doc-coverage findings), and previewHtml (a self-contained Scalar or Swagger page) over raw source text.
  • The builder model + codegenbuildBuilderModel walks the tiered composition (pages → sections → blocks → components); generateForm / generateTable / generateAppFiles land real TSX + a shadcn registry.
  • Lifecycle & coherencecontractGates + shipSummary (the "are you ready to ship?" checklist), convergeContract (cross-cutting contradictions a clean merge leaves behind), diffContracts (local-vs-deployed drift), crossCut (one contract refracted through every viewer), contractToD2 (ERD / cycle / operation diagrams).
  • Deploy planningdeployPlan / deployMarkdown turn the contract into a Cloudflare plan + a DEPLOY.md. The cockpit plans; it never runs wrangler and holds no credentials.

When to reach for it

  • You are building another shell over the Suluk contract (an editor integration, a CI gate, a dashboard) and want the same brain the VS Code extension and /superadmin panel use — not a re-derivation.
  • You need a single, principal-aware projection of a v4 document: what entities, operations, costs, providers and gated surfaces it implies, plus its ship-readiness and coherence.

When not to: if you only need one projection in isolation, depend on it directly — @suluk/scalar / @suluk/swagger for docs HTML, @suluk/shadcn for forms/tables, @suluk/builder for the app graph, @suluk/deploy for the plan. The cockpit's value is composing them into the tool views above; reach past it when you don't need that.

Usage

The cycle model (the spine)

import { parseDocument } from "@suluk/core";
import { buildCycle, cycleSummary } from "@suluk/cockpit";

const doc = parseDocument(source); // a v4 "Suluk" document
const model = buildCycle(doc);

model.valid;     // passes the v4 meta-schema?
model.coverage;  // documentation coverage 0..1
cycleSummary(model);
// → [{ layer: "Data (entities)", summary: "3 entities", status: "ok" }, … ]

// Project for a principal — scope-gated operations they can't reach drop out of every layer:
const asViewer = buildCycle(doc, { principal: { scopes: ["read:pets"] } });

Validate · audit · preview (over raw source text)

import { validateSource, auditSource, previewHtml } from "@suluk/cockpit";

const { ok, diagnostics } = validateSource(yamlOrJsonText);
const { findings } = auditSource(yamlOrJsonText);     // under-documented routes
const { html } = previewHtml(yamlOrJsonText, "scalar"); // or "swagger" — a self-contained page

Ship-readiness + coherence

import { contractGates, shipSummary, convergeContract } from "@suluk/cockpit";
import type { Baseline } from "@suluk/visual";

const baseline: Baseline = {}; // the pixel-confidence baseline (empty ⇒ not yet verified)
const gates = contractGates(doc, baseline);
const { ready, line } = shipSummary(gates);
// → { ready: false, line: "1 blocker · 1 to do · 3/5 pass" }

const report = convergeContract(doc); // cross-cutting contradictions
report.clean; // true ⇒ no dangling refs / undeclared schemes / orphan scopes / empty paths

Drift, cross-cut, diagrams

import { diffContracts, crossCut, defaultViewers, contractToD2 } from "@suluk/cockpit";

// "what's drifted in prod" — your LOCAL contract vs the DEPLOYED /openapi.json
diffContracts(local, deployed).summary; // "1+ 0- 2~ ops · 1+ 0- 0~ schemas" | "in sync — local matches deployed"

// one contract refracted through every viewer — the scope-gated surface
crossCut(doc, defaultViewers(doc)).gated; // operations not visible to every viewer

// another projection: D2 diagram source ("erd" | "cycle" | "operations")
const d2 = contractToD2(doc, "erd"); // render with the d2 CLI / playground / kroki.io

Codegen + deploy planning (the actions that land artifacts)

import { generateForm, generateAppFiles, deployPlan, deployMarkdown } from "@suluk/cockpit";

const formTsx = generateForm(doc, "Pet");        // a shadcn form component (TSX) for an entity
const files = generateAppFiles(doc);             // [{ path, content }] — openapi.json, components, pages, registry, diagrams

const plan = deployPlan(doc);                    // a Cloudflare DeployPlan
const md = deployMarkdown(plan);                 // a DEPLOY.md the user follows (Suluk never runs wrangler)

Modules — install a contract fragment, re-project for free

import { installModule, ECOMMERCE, buildCycle } from "@suluk/cockpit";

const { doc: merged } = installModule(host, ECOMMERCE); // ECOMMERCE | CRM | BILLING are first-party fragments
buildCycle(merged); // every layer now includes the module's entities, operations, cost and provider slots

Agents (OBSERVE-only)

import { agentsView, agentsSummary } from "@suluk/cockpit";

const view = agentsView(doc); // the x-suluk-agents tier tree, effective scope, gate findings, reachable surface
agentsSummary(view);          // a one-line digest — read-only; agent execution + secrets live OUTSIDE the cockpit

API

The package exposes a single entry point (@suluk/cockpit). The core groups:

| Export | What it does | | --- | --- | | buildCycle, cycleSummary, docChecks | the layered cycle model (principal-aware) + doc-level contract checks | | validateSource, auditSource, previewHtml, looksLikeV4 | validate / audit / preview over raw source text | | buildBuilderModel, builderTree, entitiesFromDoc, generateAppFiles, generateRegistryJson | the tiered builder model + the app/registry generators | | entityNames, generateForm, generateTable, generateStoresModule, exportV4Json | per-entity codegen + the canonical JSON export | | contractGates, shipSummary | the contract-level ship-readiness gates + a one-line summary | | convergeContract | a coherence audit (dangling refs / undeclared schemes / orphan scopes / preview backdoors) | | diffContracts, canonical | local-vs-deployed contract drift | | crossCut, documentScopes, defaultViewers, previewRoles, previewAllowedRoles, previewLaunchUrl | the per-viewer / role-preview security surface | | contractToD2, diagramViews | D2 diagram source (ERD / cycle / operations) | | componentReport, approveComponents, primitiveCss | UI-primitive decomposition + pixel-confidence (surfaces @suluk/visual) | | deployPlan, deployMarkdown, previewDeployPlan, previewDeployMarkdown | Cloudflare deploy planning + the rendered DEPLOY.md | | agentsView, agentsSummary | the x-suluk-agents OBSERVE view (tier tree · scope · context · model selection) | | installModule, namespaceModule, previewInstall, gradeModule, composeModules, planComposition | install / compose contract-fragment modules into the hub doc | | ECOMMERCE, CRM, BILLING, FIRST_PARTY_REGISTRY, PROVIDER_CATALOG, STACK_TEMPLATES | the first-party module + provider + stack-template catalogs | | providerFacets, readProviders, swapProvider, parseRegistry, validateModule, resolveTemplate | provider-slot + registry + template helpers (re-exported from @suluk/builder) | | formatMicroUsd, summarize | cost formatting (re-exported from @suluk/cost) for a live ledger |

Every function is pure and typed against OpenAPIv4Document from @suluk/core; the type exports (CycleModel, Gate, ConvergeReport, ContractDiff, CrossCut, AgentsView, …) ride alongside each group.

Boundary

The cockpit is L3 — it renders and generates, never hosts (the C023 line). It is pure logic with no host API: it returns models, strings and file lists; the shell writes files, fetches the deployed /openapi.json, opens terminals and renders webviews. Two consequences:

  • No credentials seam. Deploy planning emits a DEPLOY.md and the plan; it never runs wrangler or touches a token — wrangler login's OAuth happens in your terminal so credentials never reach Suluk (C020). Role-preview links are computed (previewLaunchUrl) but the cockpit never mints or holds a session.
  • Agents are OBSERVE-only. agentsView derives the static tier tree, effective scope, gate findings and a projection preview (file/tool names). It never executes an agent, fetches a preprompt, or reads a secret.

Inject the host concerns (the bytes to fetch, the deployed document to diff against, the baseline to approve at); keep the projections here. To contribute a new view, add a pure function over OpenAPIv4Document and let both shells render it.

License

Apache-2.0