Skip to content

Libraries section

The Libraries section lets you develop a shared library locally and see it in the micros that consume it, without publishing it to a registry. MicroLab builds its artifact and links it over each consumer’s node_modules. Today it supports npm libraries.

It’s a section with a list + detail pattern (like Micros): on the side, the library catalog; in the center, the editable detail of the selected one.

From the add button (top bar) —also offered in the section’s empty background when there are none yet—:

  • Add library — you choose the library repo’s folder.
  • Import from Git — clones the repo and adds it, deriving the package name from its package.json.

Identity and build recipe. It saves on its own (autosave with a small delay, like in Micros; it can be disabled in Settings):

  • Name and Package (the name of the npm package it produces).
  • Build — the command that builds the artifact (dist) and the artifact path. If you don’t declare them, the npm profile’s are used: npm run build, with dist under the package’s last segment.
  • Consumers — the micros that use the library. By default they are detected on their own by scanning who declares that package; you can fix them by hand (comma- separated micro ids).
  • Watch changes — automatically rebuilds and relinks when the code changes.

Per library:

ActionWhat it does
BuildGenerates the artifact (dist).
LinkCopies the artifact over each consumer’s node_modules/<package> (overrides the registry version).
UnlinkRestores each consumer’s original version.
WatchDoes build + link hot on every change. Needs the live engine.

Each library’s status (built / not built, linked in N consumers, watching) is shown in the list and in the detail.

Like in Micros, a library’s detail includes its Git: switch branches, do fetch and pull (--ff-only). Access is read-only (never does push), and if there are uncommitted changes, MicroLab warns before switching branches or updating.

If a library’s folder moved, the detail marks it and offers to relocate: you choose the new folder and the path is saved.

The link only touches node_modules (which is outside Git) and is reverted on unlink or with an npm ci: MicroLab does not modify the consumer’s repo or the library’s.

Deleting a library from the catalog does not unlink it: if it was linked, unlink it first from the detail.

microlab library list/status/build/link/unlink/watch. The read-only ones (library_list, library_status) are also available as MCP tools.