libraryPackage manifestv2.0.4

lib.cli-runtime

Deterministic command-pack discovery and registration for ContractSpec CLI hosts

@lssm-tech/lib.cli-runtime
Source, release and verification context

Source snapshot bcc79fcc · Declared package version 2.0.4. This page combines the checked-in package guide and manifest; commands and runtime behavior were not executed in this review.

Package source ↗ Manifest ↗
servernode
EXPLORE THE PACKAGE

See where this package fits.

Follow a declared connection, inspect an import, then open the source guide when you need the detail.

THIS PACKAGElib.cli-runtimeplatform

Arrows point from a package to its direct dependency. Each count is derived from the captured manifests.

23 declarations · first 6 shownSELECT TO INSPECT

@lssm-tech/lib.cli-runtime

Deterministic command-pack discovery and registration for ContractSpec CLI hosts.

./workspace/analysis, ./workspace/types, and ./workspace/formatters provide the canonical source scanner, authoring path conventions, structure validator, spec data types, and Markdown/DocBlock rendering used by CLI packs. The analysis leaf also owns the existing semantic diff, snapshot, impact classification, and static DocBlock manifest extraction closure. These implementations retain the original workspace behavior; the TypeScript AST supplier reaches them through the typescript runtime port (see below). @lssm-tech/module.workspace forwards its existing exports to the same files. Use the explicit leaf exports when a consumer needs only parsing or rendering.

The runtime inspects only the consumer's direct dependencies and optionalDependencies. A package participates by declaring contractspec.commandPack metadata in its published package.json.

JSON
{
  "contractspec": {
    "commandPack": {
      "entry": "./dist/command-pack.js",
      "spec": {
        "schemaVersion": 1,
        "id": "contractspec-ai",
        "version": "1.0.0",
        "commands": ["agent", "chat", "llm", "mcp", "vibe"],
        "extends": ["build", "create", "validate"]
      }
    }
  }
}

discoverCommandPacks() applies .contractsrc include and exclude controls; exclusion wins. loadCommandPacks() loads every selected pack before registration, and registerCommandPacks() rejects command conflicts before any pack mutates the Commander program. Package-name ordering makes discovery and registration deterministic.

Use createMissingCommandPackDiagnostic() to render an actionable install hint for known optional commands.

./host-program owns neutral Commander assembly. createCoreHostProgram() accepts explicit identity, core/inline registration, optional hints, and help bindings. createHostProgram() preserves that order, then discovers and loads direct dependency packs, rejects conflicts through the existing registration runtime, and reapplies host help after registration. Concrete command handlers, providers, version lookup, and parsing remain host/composition responsibilities. The existing CLI createCoreProgram() and createProgram(options) signatures remain compatible wrappers over this shared implementation.

./host-command-packs binds concrete registrations to one Commander program. Higher composers call bindHostCommandPackRegistrations() once; optional packs call registerHostCommandPack() with their exact pack ID. Missing/inherited bindings and rebinding are rejected when no portable declaration callback is supplied. Portable packs retain complete registration and help without a composer. Their action callbacks resolve explicitly bound, per-program actions only when selected; missing actions fail with missingHostBinding. The per-program binding store is process-shared, so a self-contained host bundle and separately installed packs observe the same bindings. Concrete registrations belong to higher composers, never to this generic runtime.

./inline-ai-dependencies owns the shared per-program mutable AI dependency object. Higher hosts retain complete structural dependency types and forward configuration synchronously. Existing command callbacks keep the same object and observe later bindings; lookup neither discovers nor invokes a supplier. Its state is process-shared across bundled and installed runtime copies.

Generic host ports

./ports/fs and ./ports/logger expose the canonical filesystem and logger interface closure previously owned by the workspace bundle. These type-only entries preserve the complete existing method and optional-property shapes without loading Commander. The generic concrete adapters and complete adapter aggregate now live in the ./workspace entries; product composition remains higher.

./ports/runtime holds the three runtime ports through which this package reaches suppliers it does not depend on:

Port Used by Supplier the CLI composer binds
typescript DocBlock analysis (extractModuleDocData, analyzePackageDocBlocks, buildPackageDocManifest, evaluateExpression, collectLocalValues), and through it analyzeWorkspaceDocBlocks and the docs-service loaders (loadAuthoredDocBlocksFromSourceFiles, loadPackageAuthoredDocBlocks) behind the doctor and CI docs checks; the Node fallback of loadAuthoredModule @lssm-tech/lib.typescript-runtime (its module namespace satisfies the port)
environment generateWorkspaceEnvExample, generateTargetEnvExample resolveEnvironmentForTarget and buildEnvExample from @lssm-tech/integration.runtime/environment
connectChannel createConnectControlPlaneRuntime when no channel is passed @lssm-tech/integration.runtime/channel

@lssm-tech/bundle.workspace binds all three when its root entry is imported and whenever it creates a program, so every ContractSpec CLI host (contractspec, sdd, the app CLI) and every library host of that bundle (the VS Code extension, the JetBrains bridge) is covered. Other programmatic callers, including direct callers of the @lssm-tech/module.workspace DocBlock analysis forwards, bind them first:

ts
import { bindCliRuntimePorts } from '@lssm-tech/lib.cli-runtime/ports/runtime';
import * as typescript from '@lssm-tech/lib.typescript-runtime';

bindCliRuntimePorts({ typescript });

An unbound port throws CliRuntimePortError (code: 'missingHostBinding') naming the port and its consumer. Bindings are process-shared, so a bundled host copy and separately installed command packs see the same suppliers. Any code in the process can rebind a port, so governance-critical callers such as the Connect hook pass the channel to createConnectControlPlaneRuntime explicitly.

Shared command helper compatibility

The additive ./connect/io and ./utils/errors entries own the existing CLI stdin, actor-reference, argument-validation, verdict-exit-code and error-message helpers. Their signatures, explicit environment keys and error behavior are unchanged. The workspace CLI's previous paths forward to these same functions. Moving these helpers does not authorize Connect decisions or runtime effects.

The narrow ./workspace/detection, ./utils/config, ./logging/application and ./connect/catalog-fetch entries retain the existing concrete workspace detection, config precedence, logger identities and explicit catalog fetch behavior. ./example-catalog/registry supplies metadata-only discovery through the original Foundation ExampleRegistry class, and ./example-catalog/stub (createExampleStubPlan) plans the lightweight .contractspec/examples/<key> manifest/README stub that hosts write. Runnable examples and preview imports stay in examples/registry; production command discovery loads only the generated literals. scripts/generate-example-registry.ts owns those literals and writes them to this canonical owner, while retaining the preview outputs in the example registry. No catalog entries have changed in this relocation.

./workspace/templates/defaults (generateDefaultSpecContent) owns the default scaffold for every file-posture authoring target. The CLI create command, the IDE wizards and the MCP contracts.create tool share it; bundle.workspace re-exports it. Each scaffold parses as TypeScript and passes validateSpecStructure (the presentation scaffold still uses the legacy content block). ./workspace/templates/visual-scenario.template owns generateVisualScenarioSpec; module.workspace forwards to it.

Workspace authoring runtime ownership

Compatibility: generic concrete Node filesystem/git/watcher/logger adapters, authored-module loading, discovery and deterministic authoring services move into ./workspace lower entries. Existing bundle entries forward to those same implementations and preserve defaults and signatures. No provider or product command composition moves into this closure. Scanner and render dependencies must use the canonical lower source owner; no module or bundle back-edge is admitted. Source migration requires source-bound adoption and affected-consumer qualification before acceptance.

The generic setup managed-Markdown helpers, AGENTS/usage targets and config generators also use the lower ./workspace/services/setup owner. Compatibility forwards preserve markers, user-owned content, package/workspace scope and emitted guidance byte-for-byte. The schema reference remains relative to explicitly supplied configRoot/workspaceRoot and names the existing contractspec package artifact; relocation adds no source or generated-schema fallback.

./workspace/services/connect (also ./workspace/services/connect/index) owns Connect host-hook run modes: run-mode resolution from the host permission mode, connect.runModes and operator grants (run-mode), action criticality grading with operator-only path and shell-command detection (run-mode-criticality), and the worktree-bound grant store (run-mode-grant). Generated AGENTS/usage guidance tells agents that connect mode set|clear and hook settings are operator-only.

./workspace-services/llm/index and ./workspace-services/vibe/index own the original reusable LLM authoring and workflow services. ./authoring-mcp/* owns the original contracts, CLI, documentation, and internal MCP builders and transport helpers. Existing workspace and library bundle imports forward to these same functions and registries. Concrete AI providers, command actions, and environment-bound operation clients remain in their integration owners.

Portable filesystem and logging contracts now have one canonical owner in @lssm-tech/lib.utils-typescript/ports/fs and /ports/logger. Their complete interfaces are unchanged. Existing CLI /ports/fs and /ports/logger imports remain compatible type exports; Builder delivery uses the portable contracts directly and no longer depends on the CLI host.

Adoption catalog selection ignores version build metadata when comparing release precedence. For the same release, registry, installed, local mirror, and embedded candidates retain their existing source priority. Inventory digests, hash validation, split-brain detection, and stale diagnostics remain unchanged.

The Node filesystem adapter schedules overlapping glob traversals in FIFO order when running under Bun on Windows. Each adapter owns its queue; patterns, options, sorted discovery results and rejection values remain unchanged. Node and other platforms retain concurrent traversal. This bounds overlapping native filesystem traversal without narrowing workspace discovery.

Declared capabilities.

Lib Cli Runtime

Deterministic command-pack discovery and registration for ContractSpec CLI hosts

Use it to

  • Adopt deterministic command-pack discovery and registration for contractspec cli hosts

Requires

  • TypeScript

Choose another boundary when

  • The @lssm-tech/lib.cli-runtime package constraints do not match the target runtime or platform.

@lssm-tech/lib.cli-runtime

@lssm-tech/lib.cli-runtime/command-pack

@lssm-tech/lib.cli-runtime/command-pack-discovery

@lssm-tech/lib.cli-runtime/command-pack-registration

@lssm-tech/lib.cli-runtime/command-pack-types

@lssm-tech/lib.cli-runtime/host-programcreateCoreHostProgram, createHostProgram

@lssm-tech/lib.cli-runtime/inline-ai-dependenciesconfigureInlineAiDependencies, configureInlineSnapshotClient, getInlineAiDependencies

@lssm-tech/lib.cli-runtime/ports/fs

@lssm-tech/lib.cli-runtime/ports/logger

@lssm-tech/lib.cli-runtime/connect/io

@lssm-tech/lib.cli-runtime/utils/errors

@lssm-tech/lib.cli-runtime/workspace/detection

@lssm-tech/lib.cli-runtime/utils/config

@lssm-tech/lib.cli-runtime/logging/application

@lssm-tech/lib.cli-runtime/connect/catalog-fetch

@lssm-tech/lib.cli-runtime/example-catalog/registry

@lssm-tech/lib.cli-runtime/example-catalog/builtins

@lssm-tech/lib.cli-runtime/example-catalog/stub

@lssm-tech/lib.cli-runtime/workspace/analysis

@lssm-tech/lib.cli-runtime/workspace/types

@lssm-tech/lib.cli-runtime/workspace/formatters

@lssm-tech/lib.cli-runtime/workspace/adapters

@lssm-tech/lib.cli-runtime/workspace/adapters/factory

@lssm-tech/lib.cli-runtime/workspace/adapters/fs

@lssm-tech/lib.cli-runtime/workspace/adapters/fs.bun

@lssm-tech/lib.cli-runtime/workspace/adapters/fs.node

@lssm-tech/lib.cli-runtime/workspace/adapters/git

@lssm-tech/lib.cli-runtime/workspace/adapters/logger

@lssm-tech/lib.cli-runtime/workspace/adapters/watcher

@lssm-tech/lib.cli-runtime/workspace/authoring-types

@lssm-tech/lib.cli-runtime/workspace/ports/ai

@lssm-tech/lib.cli-runtime/workspace/ports/git

@lssm-tech/lib.cli-runtime/workspace/ports/logger

@lssm-tech/lib.cli-runtime/workspace/ports/watcher

@lssm-tech/lib.cli-runtime/workspace/services/adoption

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-core

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-entry

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-loader

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-mirror

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-runtime

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-shared

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-solutions

@lssm-tech/lib.cli-runtime/workspace/services/adoption/catalog-ui

@lssm-tech/lib.cli-runtime/workspace/services/adoption/pending-upgrades

@lssm-tech/lib.cli-runtime/workspace/services/adoption/resolve

@lssm-tech/lib.cli-runtime/workspace/services/adoption/tokens

@lssm-tech/lib.cli-runtime/workspace/services/adoption/types

@lssm-tech/lib.cli-runtime/workspace/services/adoption/workspace

@lssm-tech/lib.cli-runtime/workspace/services/adoption/workspace-scan

@lssm-tech/lib.cli-runtime/workspace/services/build

@lssm-tech/lib.cli-runtime/workspace/services/can-help

@lssm-tech/lib.cli-runtime/workspace/services/can-help/corpus

@lssm-tech/lib.cli-runtime/workspace/services/can-help/injection

@lssm-tech/lib.cli-runtime/workspace/services/can-help/leverage

@lssm-tech/lib.cli-runtime/workspace/services/can-help/metrics

@lssm-tech/lib.cli-runtime/workspace/services/can-help/query

@lssm-tech/lib.cli-runtime/workspace/services/can-help/report

@lssm-tech/lib.cli-runtime/workspace/services/can-help/types

@lssm-tech/lib.cli-runtime/workspace/services/can-help/vectorize

@lssm-tech/lib.cli-runtime/workspace/services/contractsrc-schema-ref

@lssm-tech/lib.cli-runtime/workspace/services/delete

@lssm-tech/lib.cli-runtime/workspace/services/discover

@lssm-tech/lib.cli-runtime/workspace/services/discovery-path

@lssm-tech/lib.cli-runtime/workspace/services/docs

@lssm-tech/lib.cli-runtime/workspace/services/docs/docblock-audit

@lssm-tech/lib.cli-runtime/workspace/services/docs/docs-service

@lssm-tech/lib.cli-runtime/workspace/services/drift

@lssm-tech/lib.cli-runtime/workspace/services/generate-artifacts

@lssm-tech/lib.cli-runtime/workspace/services/impact

@lssm-tech/lib.cli-runtime/workspace/services/impact/formatters

@lssm-tech/lib.cli-runtime/workspace/services/impact/impact-detection-service

@lssm-tech/lib.cli-runtime/workspace/services/impact/types

@lssm-tech/lib.cli-runtime/workspace/services/implementation/discovery

@lssm-tech/lib.cli-runtime/workspace/services/implementation/types

@lssm-tech/lib.cli-runtime/workspace/services/list

@lssm-tech/lib.cli-runtime/workspace/services/module-loader

@lssm-tech/lib.cli-runtime/workspace/services/modules/module-resolver

@lssm-tech/lib.cli-runtime/workspace/services/onboarding

@lssm-tech/lib.cli-runtime/workspace/services/onboarding/catalog

@lssm-tech/lib.cli-runtime/workspace/services/onboarding/journey

@lssm-tech/lib.cli-runtime/workspace/services/onboarding/render

@lssm-tech/lib.cli-runtime/workspace/services/onboarding/service

@lssm-tech/lib.cli-runtime/workspace/services/onboarding/types

@lssm-tech/lib.cli-runtime/workspace/services/package-scaffold

@lssm-tech/lib.cli-runtime/workspace/services/setup/config-generators

@lssm-tech/lib.cli-runtime/workspace/services/setup/file-merger

@lssm-tech/lib.cli-runtime/workspace/services/setup/gitignore

@lssm-tech/lib.cli-runtime/workspace/services/setup/managed-markdown

@lssm-tech/lib.cli-runtime/workspace/services/setup/presets

@lssm-tech/lib.cli-runtime/workspace/services/setup/targets/agents-md

@lssm-tech/lib.cli-runtime/workspace/services/setup/targets/usage-md

@lssm-tech/lib.cli-runtime/workspace/services/setup/types

@lssm-tech/lib.cli-runtime/workspace/services/update

@lssm-tech/lib.cli-runtime/workspace/services/validate/spec-validator

@lssm-tech/lib.cli-runtime/workspace/templates

@lssm-tech/lib.cli-runtime/workspace/templates/additional-contracts.template

@lssm-tech/lib.cli-runtime/workspace/templates/advanced-contracts.template

@lssm-tech/lib.cli-runtime/workspace/templates/app-config.template

@lssm-tech/lib.cli-runtime/workspace/templates/data-view.template

@lssm-tech/lib.cli-runtime/workspace/templates/data-view-renderer.template

@lssm-tech/lib.cli-runtime/workspace/templates/environment.template

@lssm-tech/lib.cli-runtime/workspace/templates/event.template

@lssm-tech/lib.cli-runtime/workspace/templates/experiment.template

@lssm-tech/lib.cli-runtime/workspace/templates/feature.template

@lssm-tech/lib.cli-runtime/workspace/templates/form.template

@lssm-tech/lib.cli-runtime/workspace/templates/handler.template

@lssm-tech/lib.cli-runtime/workspace/templates/integration.template

@lssm-tech/lib.cli-runtime/workspace/templates/knowledge.template

@lssm-tech/lib.cli-runtime/workspace/templates/migration.template

@lssm-tech/lib.cli-runtime/workspace/templates/operation.template

@lssm-tech/lib.cli-runtime/workspace/templates/presentation.template

@lssm-tech/lib.cli-runtime/workspace/templates/telemetry.template

@lssm-tech/lib.cli-runtime/workspace/templates/theme.template

@lssm-tech/lib.cli-runtime/workspace/templates/workflow.template

@lssm-tech/lib.cli-runtime/workspace/templates/workflow-devkit.template

@lssm-tech/lib.cli-runtime/workspace/templates/workflow-runner.template

@lssm-tech/lib.cli-runtime/workspace/templates/visual-scenario.template

@lssm-tech/lib.cli-runtime/workspace/templates/defaults

@lssm-tech/lib.cli-runtime/workspace/utils/filter

@lssm-tech/lib.cli-runtime/workspace/utils/workspace-manifests

Imports and export paths.

218 entries

These are package-manifest entry points. Named symbols listed above come from the capability catalogue; this is not an exhaustive TypeScript symbol reference.

218 imports · showing 35

@lssm-tech/lib.cli-runtime/optional-command-declarations/builder/*
./src/optional-command-declarations/builder/*.ts · source target not verified

Dependencies and related packages.

Runtime dependencies 23
@modelcontextprotocol/sdk
^1.30.0
chokidar
^5.0.0
compare-versions
catalog:data
elysia
catalog:server
glob
catalog:build
js-yaml
^5.4.0
micromatch
^4.0.8
ts-morph
^28.0.0
zod
catalog:
Peer dependencies 1
commander
catalog:server
Development dependencies 6
@types/micromatch
^4.0.10
commander
catalog:server
typescript
catalog:

Package scripts.

Commands declared by this package. Review its setup requirements before running them; no command here was executed by this review.

publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose
publish:pkg:canarybun publish:pkg --tag canary
buildcontractspec-bun-build build
build:bundlecontractspec-bun-build transpile
build:typescontractspec-bun-build types
devcontractspec-bun-build dev
cleanrimraf dist .turbo
lintbun run lint:fix
lint:fixnode ../../../../scripts/biome.cjs check --write .
lint:checknode ../../../../scripts/biome.cjs check .
testbun test
prebuildcontractspec-bun-build prebuild
typechecktsgo --noEmit
Your view

Make room for your context.

Shape the presentation around this moment. You can change it whenever you need.

Your context

The different parts of you

Choose a starting point

A useful mix of context, visuals and gentle guidance.

Tune each dimension
Each dimension can change independently. Product permissions and available actions stay unchanged.

Support the way you begin and return

Tune your support

Reading comfort

Choose your language

Interface language changes text only. Markets, prices and workflows keep their own settings.

Translation coverage

Original source

Navigation151
Graph616
Categories378
Portfolio833
Examples2,035
Source preview1,542

More translations will be added as content is reviewed.

This preference is saved on this browser.

Search the website

Useful starting points

No results. Try a shorter phrase, an operation name or another search area.

A LITTLE ROOM TO EXPLORE

Find something to explore.

Open a closer look on this page, try a different perspective, or follow the detail into its own page.

How previews and controls work
01

Look before you leave

Hover a link or focus it with Tab to see a preview. Clicking the original link or pressing Enter always opens its destination.

02

Stay with the context

Move into the preview to explore its sections. Use Alt + ↓ from a focused link to enter it with the keyboard. Escape closes it.

03

Open the possibilities

Disclosure rows, perspective choices and highlighted controls reveal more. Your view changes reading comfort and the context you explore.

A separate button for a closer look

Show small preview buttons beside links where there is room. Tap the eye to inspect, or tap the link to go straight there. This choice stays in this tab.

No browsing history is collected. Reduced motion follows your device and Your view.