# ComponentLibraryApp

Source: https://obsvra.com/docs/componentlibraryapp

> The library command: list the generators and filters registered in your installed build, and their parameters, live from the engine.

> © 2026 Obsvra. This document describes SpiceGrinder and is provided to help you evaluate and use it. It is not a license to reproduce, adapt, or use this material to build a competing product or service. Full terms: the SpiceGrinder EULA.

## NAME

ComponentLibraryApp — list registered generators/filters and their parameters, live from the running artifact's registry

## SYNOPSIS

```
java -cp spicegrinder.jar com.obsvra.spicegrinder.tools.ComponentLibraryApp [options]
```

On a jpackage install:

```
list [options]
```

## DESCRIPTION

`ComponentLibraryApp` answers "what components exist, and what are their parameters" directly from the live `ComponentRegistry` — a real-time alternative to [Component-Library-Reference.md](https://obsvra.com/docs/component-library-reference) (a hand-generated snapshot) or writing a one-off Java harness against the registry.

Unlike every other tool in this package, `ComponentLibraryApp` takes no model file — it's pure registry introspection, not a per-model tool.

Only components visible under the running artifact's edition are listed — a Free build simply has fewer entries; this tool applies no filtering of its own beyond what the registry already does. Hidden components (`ComponentDescriptor.hidden`) are never shown, whether by listing or by `--component` name.

The same discovery is also available from a running Service API process via `GET /v1/components` (see [Service-API-Reference.md](https://obsvra.com/docs/service-api-reference#get-v1components)) — both share the same underlying JSON-building code (`ComponentDescriptorJson`), so a given component's entry is byte-for-byte identical either way.

## OPTIONS

| Option | Meaning |
|---|---|
| `--category generator\|filter` | Restrict the listing to one category. |
| `--component NAME` | Show full detail (class, description, every parameter) for exactly one component, by short name. Cannot be combined with `--category`. |
| `--library-paths` | Print the effective model-library search roots (org root, then user paths, in search order) and exit. See LIBRARY PATHS below. |
| `--add-library-path PATH` | Add `PATH` (must already exist and be a directory) to the user's library search paths, then print them as `--library-paths` would. A no-op if `PATH` is already present. |
| `--remove-library-path PATH` | Remove `PATH` from the user's library search paths, then print them as `--library-paths` would. |
| `--settings` | Report the organization posture, its key rules, and every setting of `preferences`, `colors`, `weights` and `formats`: effective value, where it came from, and the rule that governs it. See SETTINGS below. |
| `--scope SCOPE` | With `--settings`: only one scope (`preferences`, `colors`, `weights` or `formats`). |
| `--key PREFIX` | With `--settings`: only settings whose key starts with `PREFIX`. |
| `--json` | Emit structured JSON instead of human-readable text. See OUTPUT (JSON) below. |
| `--markdown [FILE]` | Print [Component-Library-Reference.md](https://obsvra.com/docs/component-library-reference), generated from the components' annotations. With `FILE`, the opening section is taken from that file (the rest is generated), and any text under a component in `FILE` that isn't in its annotation is reported on stderr. Needs a Pro build, since the reference covers Pro components. |
| `--write` | With `--markdown FILE`, rewrite `FILE` in place instead of printing. The reference is maintained with `list --markdown docs/Component-Library-Reference.md --write`. |
| `-h`, `--help` | Print usage and exit. |
| `--version` | Print the version (e.g. `1.0.0 (Build 1)`) and exit. |

With no options, every visible component is listed, one line each: `Name (Tier, category): description`. `--component NAME` switches to full detail for that one component instead — a class name, description, what its input must supply (for a filter with one plain input), a parameter table in the same shape as [Component-Library-Reference.md](https://obsvra.com/docs/component-library-reference)'s own tables (`Parameter | Type | Required | Default | Aliases | Notes`), and its longer reference text.

Only one of `--library-paths`, `--add-library-path`, `--remove-library-path` may be given at a time, and none of the three may be combined with `--category` or `--component` — each of these combinations is rejected outright with exit code 2. On a Free build these three options still run and save, but library paths are only used by `<Import>`, a Pro feature, so they have no effect there.

## OUTPUT (JSON)

With `--json`, output is always full detail for every listed component — no reason to make JSON as terse as the default text listing, since a caller wanting one component can filter the array itself:

```json
{
  "edition": "PRO",
  "engineVersion": "1.0.0 (Build 1)",
  "codename": "Baharat",
  "schemaVersion": 1,
  "totalCount": 72,
  "components": [
    {
      "name": "Convert",
      "tier": "Pro",
      "category": "filter",
      "className": "com.obsvra.spicegrinder.pro.filters.Convert",
      "description": "Deserialize an upstream string into a typed ISerializable business object, wrapped in an ObjectDataPoint",
      "parameters": [
        {
          "name": "class", "type": "String", "required": true, "default": "",
          "aliases": [], "group": "Type", "multiple": false,
          "minOccurrences": 0, "maxOccurrences": 0, "attributes": [], "allowedValues": [],
          "description": "Fully-qualified class name of an ISerializable business object, reflectively constructed (via a no-arg constructor) and populated from the single upstream input's serialized string."
        }
      ]
    }
  ]
}
```

`edition` is the running artifact's actual license edition (`FREE` or `PRO`). `engineVersion` is the same display string `--version`/`Grind --version` print (via `VersionInfo.getDisplayString()`), so a client can detect a mismatched engine. `codename` is the major version's release codename (e.g. `Baharat` for 1.x, from `spicegrinder.codename` in `version.properties`): display only, never part of `engineVersion`, and present only when one is set, so a client must treat it as optional. `schemaVersion` is an integer that increments on any breaking change to this JSON shape (top-level or per-parameter) — additive fields like `allowedValues` itself don't require a bump; it's currently `1`. `totalCount` is `components.length`. Each parameter's `group` is that `@Parameter`'s own category (e.g. `Source`, `Connection`) — distinct from the component's own top-level `category` (`generator`/`filter`). `multiple`/`minOccurrences`/`maxOccurrences`/`attributes` describe multi-occurrence XML parameters (e.g. `Mix`'s `<input name="..." weight="..."/>` children) — `attributes` lists the XML attribute names a multi-occurrence parameter's own child element accepts. `tier` is `Free` for SpiceGrinder's core components, `Pro` for its Pro, business and example components, and `Custom` for any component from outside SpiceGrinder's own packages (a custom component, which needs Pro to load). A component can also carry `input` (for a filter with one plain input, what that input must supply) and `details` (longer reference text, in Markdown); each appears only when the component has it. `allowedValues` lists the canonical set of values a parameter accepts, when its description documents a fixed set (e.g. `Constant`'s `type`: `["int", "double", "string"]`) — always present, `[]` when no enumerated set is documented. It's **descriptive, not enforced**: a component's own configure/parse logic remains the sole source of truth, and may accept more than this list documents (aliases like `"integer"`/`"str"` for `Constant`'s `type`, for instance).

`--category`/`--component` still apply in `--json` mode, filtering before serializing. `-h`/`--help`/`--version` output and bad-argument errors (exit code 2) always stay plain text, unaffected by `--json`.

## LIBRARY PATHS

`--library-paths` answers "which folders can a user `<Import>` a model from" — the same question the desktop GUI's model-library sidebar needs answered, and the engine (not the GUI) decides it, so the GUI never re-derives this logic itself. The roots are exactly the ones `OrgConfig.resolveImportPath` searches, minus the model directory and project root (both depend on the specific model being imported, not on "library" configuration, so they have no place in a standalone listing): first the active organization bundle's libraries directory, if any (only present when an org is active via `SPICEGRINDER_ORG_HOME`/`spicegrinder.org.home` and running under Pro/Enterprise), then the user's own library directories from `UserPreferences.getLibraryPaths()` (the `library.paths` key in `~/.spicegrinder/preferences.properties`) — but only when organization policy permits local library overrides (`libraries.local_override` in the org bundle's `policy.properties`). Roots are deduplicated after normalizing every path to absolute. With no organization active and no user library paths configured, the list is simply empty.

Without `--json`, each root prints on its own line as `/abs/path (source)`, `source` being `org` or `user`; an empty list prints `(no library roots configured)`. If organization policy forbids local library overrides and the user has paths configured anyway, those paths are silently dropped from the listing and a `Note: ...` line explains why.

`--add-library-path PATH` and `--remove-library-path PATH` edit `library.paths` through `UserPreferences` (the same persistence `save()` every other preference uses, honoring any org-locked-key/audit behavior it already applies) and then print the resulting `--library-paths` output. `--add-library-path` normalizes `PATH` to an absolute path, rejects a target that doesn't exist or isn't a directory (exit 2), and is a no-op if the (normalized) path is already present. Both are refused outright with exit 2 and the organization's policy message when `libraries.local_override` forbids local library paths — no partial write occurs.

In Pro, the MCP server offers the same operations to agents as `list_library_paths` and `configure_library_path`; see [McpServerApp.md](https://obsvra.com/docs/mcpserverapp). Adding a folder over MCP is off by default and needs `mcp.libraryPaths.allowAdd=true` in the preferences file; removing is always allowed, and `--add-library-path` here is unaffected.

## OUTPUT (JSON, `--library-paths`)

```json
{
  "roots": [
    {"path": "/abs/path/to/org/libraries", "source": "org", "exists": true, "readable": true},
    {"path": "/abs/path/to/user/lib", "source": "user", "exists": true, "readable": true}
  ],
  "userPathsIgnored": false,
  "note": null
}
```

`roots` is the same search-order list the plain-text output prints, one entry per root: `path` is absolute and normalized, `source` is `"org"` or `"user"`, and `exists`/`readable` are a live filesystem check made at the moment the command runs (a configured root can exist in `library.paths` yet have been deleted or become unreadable since). `userPathsIgnored` is `true` only when the user had library paths configured but organization policy dropped them from `roots`; `note` is the policy message explaining why in that case, and `null` otherwise. `--add-library-path`/`--remove-library-path --json` emit this same shape, reflecting the state *after* the edit.

## SETTINGS

`--settings` answers "what is each setting set to, and who decided?", so a tool (the desktop app's Organization panel, for one) doesn't have to re-derive the layering or the organization's rules. It reports the edition, the posture (`SOLO`, `SOLO_WITH_NOTE`, `PRODUCTION` or `DEV`), the active organization's id, version and path, the `enforcementMode`, every `key.<pattern>.mode` rule (most specific first), and then one entry per setting of the four settings files: `preferences`, `colors`, `weights`, `formats`. A Free build reports `SOLO` or `SOLO_WITH_NOTE` (an organization bundle is present but ignored, with a `note`) and no organization parts; the user's own values are still listed.

```json
{
  "edition": "pro", "posture": "PRODUCTION", "active": true,
  "org": {"id": "acme", "version": "7", "home": "/etc/spicegrinder/acme"},
  "note": null, "enforcementMode": "WARN",
  "rules": [{"pattern": "formats.format.phone.*", "mode": "enforce"}],
  "settings": [
    {"scope": "formats", "key": "format.phone.en_US", "value": "{areaCode}.{exchange}.{subscriber}",
     "source": "org", "rule": "formats.format.phone.*", "mode": "enforce",
     "userValueIgnored": true, "ignoredUserValue": "({areaCode}){exchange}{subscriber}"}
  ]
}
```

`source` is `built-in`, `org` or `user`: where the **effective** value came from. `rule` and `mode` are the most specific organization rule for `<scope>.<key>` (both `null` if none applies); `mode` is `default`, `warn`, `enforce` or `audit_only`. `userValueIgnored` is `true` when the user's own file set the key but an `enforce` rule refused it, and `ignoredUserValue` then holds what they wrote. Weights also list each size-aware component's `<class>.sizeA` and `<class>.sizeB`, and the output-cost weight `output.perColumn`. Without `--json` the same information prints as a table. `--settings` cannot be combined with `--category`, `--component` or the library-path options, and `--scope`/`--key` need `--settings` (each violation is exit 2). See Organization-config.md for what the modes mean.

## EXIT STATUS

| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | `--component` named a component that doesn't exist, or is hidden; or `--add-library-path`/`--remove-library-path` failed to save preferences. |
| 2 | Bad arguments — both `--category` and `--component` given, an unrecognized option, an unrecognized `--category` value, conflicting library-path options (more than one of `--library-paths`/`--add-library-path`/`--remove-library-path`, or one of them combined with `--category`/`--component`), an `--add-library-path` target that doesn't exist or isn't a directory, or an `--add-library-path`/`--remove-library-path` attempt while organization policy forbids local library overrides. |

## EXAMPLES

List every visible component:

```
java -cp spicegrinder.jar com.obsvra.spicegrinder.tools.ComponentLibraryApp
```

List only filters:

```
list --category filter
```

Full detail on one component:

```
list --component Convert
```

Get a machine-readable listing for a script or agent to parse:

```
list --json
```

See every setting's value, source and organization rule (narrowed to the colors scope here):

```
list --settings --scope colors
```

List the effective model-library search roots:

```
list --library-paths
```

Add a directory to the user's library search paths:

```
list --add-library-path ~/spicegrinder-libraries
```

Remove it again, getting machine-readable output back:

```
list --remove-library-path ~/spicegrinder-libraries --json
```

## SEE ALSO

[Component-Library-Reference.md](https://obsvra.com/docs/component-library-reference), `ModelValidatorApp`(1), `ModelAnalyzerApp`(1), `Grind`(1), `McpServerApp`(1)
