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

@appling/codegen

v0.1.2

Published

Appling code generation core: plan, step runner, extension contract and task registry

Downloads

950

Readme

@appling/codegen

The core of Appling code generation. It turns the semantic graph of a model into a draft project for a target framework through an extension, and records in a task registry what was generated and what is still open.

Generation runs once per project. Work the generator cannot do (derived logic, complex preconditions, test bodies) becomes a registry task for the AI or a human. Generated test skeletons skip with a pointer to their registry entry, so open work shows in the test run as well.

Configuration

appling.config.json in the project root:

{
  "generate": [
    { "extension": "@appling/codegen-django", "out": "build/shop", "options": { "name": "shop" } }
  ]
}

appling generate --plan prints the steps, appling generate runs them into each out folder, which must be empty or missing.

Writing an extension

An extension is a map, not a generator: for every graph node it returns the steps that produce it. It depends only on the @appling/model graph types, never on the Langium AST.

import type { CodegenExtension } from '@appling/codegen';

const extension: CodegenExtension = {
  name: 'my-target',
  prerequisites: [{ name: 'python', command: ['python3', '--version'], expect: /Python 3\.1[2-9]/, hint: 'install Python 3.12 or later' }],
  steps(node, context) {
    switch (node.kind) {
      case 'Module': return [{ kind: 'command', run: ['tool', 'new', context.name] }];
      case 'Entity': return [{ kind: 'template', file: 'models.py', write: existing => (existing ?? '') + '...' }];
      case 'Field': return [];
      case 'Invariant': return [{ kind: 'task', what: 'translate the condition' }];
      default: return undefined;
    }
  }
};
export default extension;

| Step | Does | |---|---| | command | Runs the framework's own command line tool, cwd relative to the output folder | | template | Writes or patches a file; write gets the current content | | task | Records open work in the registry |

An extension may also implement migrate(change, context, files), which turns one Appling migration step (rename, retype, remove, with the element's qualified name before and now) into steps for an already generated project; files reads the project, for example to continue its migration history.

Returning undefined marks the node kind as not supported (a todo entry); an empty list means a parent's steps already cover the node. Nodes are planned in dependency order: modules, then domain, cross cutting, behavior, application, interfaces, experience.

Third party extensions are named appling-codegen-* or @scope/appling-codegen-*, have a peer dependency on @appling/codegen and export the extension as default.

Sync

appling generate --sync regenerates a project from the changed model and keeps the work done in it: generation stores its output in .appling/baseline/, and sync merges a fresh generation three ways (baseline, project, new generation) with git merge-file. Conflicting changes get conflict markers and a registry task. An extension lists the paths sync must not touch in syncExclude, such as migration history and dependencies.

Registry

.appling/tasks.json in the generated project holds one entry per qualified name:

| Field | Meaning | |---|---| | status | generated, partial (generated with open tasks), todo, or done once the open work is finished | | steps, files | What produced the element | | missing | Open tasks with their model context: the element's properties and related elements |

Every graph node has an entry, so the registry is also the coverage report and the AI work queue.

API

| Export | Purpose | |---|---| | plan(graph, extension, name, options) | The ordered steps and registry entries | | runPlan(plan, out, log) | Runs the steps and writes the registry | | checkPrerequisites(prerequisites) | Messages for missing tools | | readConfig(root), loadExtension(name, root) | Configuration and extension loading | | describe(step) | A one line description of a step | | saveBaseline(out, exclude), mergeGeneration(out, next, exclude) | The generation baseline, and the three way merge of a fresh generation into a project | | pendingChanges(graph, applied, stamp), planMigrations(...), runMigrations(...), readApplied(out) | Migration steps not yet applied to a generated project, and carrying them into it |

License

MIT