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

@cloudburn/rules

v0.35.2

Published

Cloudburn cost optimization rules

Readme

@cloudburn/rules

Pure rule packs, helpers, and types for CloudBurn.

This package has no I/O, no AWS SDK calls, and no engine logic. It gives you the built-in rule sets, the rule authoring helpers, and the type contracts you need if you want to extend CloudBurn with your own rules.

If you just want to run scans, use cloudburn or @cloudburn/sdk. Reach for @cloudburn/rules when you want to inspect built-in rule packs or author your own.

Installation

npm install @cloudburn/rules

What's In The Box

  • Complete built-in rule packs like awsRules
  • Default subsets like awsCorePreset
  • Rule authoring helpers like createRule, createFinding, and createFindingMatch
  • Recommendation provenance and identity helpers like createRecommendationMatch, getRecommendationIdentity, and deduplicateRecommendationMatches for findings that carry native or external recommendation evidence Use createRecommendationComparator() for repeated comparisons within one operation; create a new comparator after changing match evidence.
  • Financial impact helpers like createFinancialEvidence for attaching source-tagged impact (currentCost and potentialSavings) to findings without inventing amounts — a missing or unusable figure becomes confidence: 'unknown', never zero
  • Shared rule types plus LiveResourceBag and StaticResourceBag for evaluation and tests (LiveEvaluationContext.scratch is an optional SDK-owned per-rule memo; custom callers can omit it); static dataset fields are null when an IaC value is unresolved (a Terraform ${...} or CloudFormation intrinsic), so check for null before treating a value as false

Getting Started

You can import the built-in rules directly:

import { awsCorePreset, awsRules } from '@cloudburn/rules';

console.log(awsCorePreset.id);
console.log(awsRules.length);

awsRules contains every public AWS rule. awsCorePreset is the default subset used by CloudBurn and excludes rules that need explicit AWS setup, including CLDBRN-AWS-TAGGING-1, CLDBRN-AWS-LAMBDA-4, and CLDBRN-AWS-COSTOPTIMIZATIONHUB-1 through CLDBRN-AWS-COSTOPTIMIZATIONHUB-6.

Rule 3 evaluates AWS-classified idle capacity. AwsCostOptimizationHubIdleRecommendation preserves the exact action and typed current/recommended configuration. EBS unattached-volume findings include actionType: 'Delete' and resourceType: 'ec2:volume' so precedence requires the same resource and action.

Or write your own rule pack on top of the same contracts:

import { createFinding, createFindingMatch, createRule } from '@cloudburn/rules';

const RULE_ID = 'CLDBRN-AWS-EBS-1';
const RULE_SERVICE = 'ebs';
const RULE_MESSAGE = 'EBS volumes should use current-generation storage.';

export const ebsVolumeTypeCurrentGenRule = createRule({
  severity: 'medium',
  id: RULE_ID,
  name: 'EBS Volume Type Not Current Generation',
  description: 'Flag EBS volumes using previous-generation gp2 type instead of gp3.',
  message: RULE_MESSAGE,
  provider: 'aws',
  service: RULE_SERVICE,
  supports: ['discovery'],
  discoveryDependencies: ['aws-ebs-volumes'],
  evaluateLive: ({ resources }) => {
    const findings = resources
      .get('aws-ebs-volumes')
      .filter((volume) => volume.volumeType === 'gp2')
      .map((volume) => createFindingMatch(volume.volumeId, volume.region, volume.accountId));

    return createFinding(
      { id: RULE_ID, service: RULE_SERVICE, severity: 'medium', message: RULE_MESSAGE },
      'discovery',
      findings,
    );
  },
});

Capability metadata

AWS_CAPABILITIES is the closed catalog of AWS evidence capabilities that live discovery datasets require:

  • cost-optimization-hub-enrollment — Cost Optimization Hub enrollment for Hub recommendation datasets.
  • compute-optimizer-enrollment — Compute Optimizer opt-in for machine-learning recommendations such as Lambda memory sizing.
  • resource-explorer-aggregator — an accessible Resource Explorer aggregator view for account-wide queries.
  • cost-explorer-access — Cost Explorer API access for usage, anomaly, and coverage datasets.
  • budgets-access — Budgets API access for budget guardrail datasets.

AwsCapability is the union of those values. getAwsDatasetCapability(datasetKey) maps a discovery dataset to its required capability, or returns undefined for datasets with no capability requirement. getAwsRuleCapabilities(rule) returns a fresh sorted, de-duplicated list of the capabilities a rule's required discoveryDependencies need; optionalDiscoveryDependencies and rules that do not support discovery contribute nothing. Access-only capabilities such as cost-explorer-access and budgets-access are listed like any other requirement but do not make a rule opt-in.

This is pure, read-only metadata: it describes declared dataset requirements, not live enrollment state. Runtime readiness comes from capabilities on SDK discovery results.

import {
  AWS_CAPABILITIES,
  type Rule,
  getAwsDatasetCapability,
  getAwsRuleCapabilities,
} from '@cloudburn/rules';

const capability = getAwsDatasetCapability('aws-lambda-memory-recommendations');
const rule = {
  supports: ['discovery'],
  discoveryDependencies: ['aws-cost-usage'],
  optionalDiscoveryDependencies: ['aws-cost-optimization-hub-savings-plans-recommendations'],
} satisfies Pick<Rule, 'supports' | 'discoveryDependencies' | 'optionalDiscoveryDependencies'>;
const required = getAwsRuleCapabilities(rule);

console.log(AWS_CAPABILITIES, capability, required);

Here capability is 'compute-optimizer-enrollment' and required is ['cost-explorer-access']. Optional Hub evidence is not a required capability, even when another active rule causes that dataset to be loaded.

Docs

License

Apache-2.0

Hub rightsizing

CLDBRN-AWS-COSTOPTIMIZATIONHUB-4 is an opt-in discovery rule. Its aws-cost-optimization-hub-rightsizing-recommendations dataset contains AwsCostOptimizationHubRightsizingRecommendation, a union discriminated by resourceType with typed currentConfiguration and recommendedConfiguration fields for each of the 8 supported AWS resource types. The evaluator accepts only Rightsize actions. See the SDK discovery guidance for enrollment, IAM permissions, evidence projection, and native-rule precedence.

Rule ID stability

From the coordinated optimization-contract release for #269 onward, assigned rule IDs are immutable: never renumber or reuse them, including after removal. Gaps are valid; this release preserves all existing IDs. Consumers should keep the package version with their selected rule IDs. See the allocation policy and the SDK upgrade notes for the coordinated consumer contract.