# @lssm-tech/lib.source-extractors

Extract contract candidates from TypeScript source code across multiple frameworks (NestJS, Express, Fastify, Hono, Elysia, tRPC, Next.js)

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `4.0.4`
- Package path: `packages/tools/source-extractors`
- Manifest path: `packages/tools/source-extractors/package.json`
- Manifest Git blob: `0a757ab1677624bd74b72964a56cfe9c7d10a50d`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/lib.source-extractors](https://lssm.co/docs/packages/lib.source-extractors/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.source-extractors.txt)

## Package metadata

```json
{
  "layer": "tools",
  "physicalArea": null,
  "primaryArea": "tooling-and-agent-delivery",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "sharedLibs",
    "catalogKind": "library",
    "catalogStatus": "active",
    "adoptionMode": "adoptable",
    "stability": "stable"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [CLI, authoring and agent tooling](https://lssm.co/docs/areas/tooling-and-agent-delivery/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/tools/source-extractors/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/README.md",
  "blobSha": "04f0a82c58f97e7aae6c1a6a41dea23b05eff6ae",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/lib.source-extractors

This contributor/compiler package is owned at `packages/tools/source-extractors`.
Its published package name and documented import paths remain unchanged.

Website: https://contractspec.io

**Extract contract candidates from TypeScript source code across multiple frameworks (NestJS, Express, Fastify, Hono, Elysia, tRPC, Next.js).**

## What It Provides

- **Layer**: lib.
- **Consumers**: CLI, bundles.
- Related ContractSpec packages include `@lssm-tech/lib.contracts-spec`, `@lssm-tech/lib.schema`, `@lssm-tech/tool.bun`, `@lssm-tech/tool.typescript`.
- Related ContractSpec packages include `@lssm-tech/lib.contracts-spec`, `@lssm-tech/lib.schema`, `@lssm-tech/tool.bun`, `@lssm-tech/tool.typescript`.

## Installation

`npm install @lssm-tech/lib.source-extractors`

or

`bun add @lssm-tech/lib.source-extractors`

## Usage

Import the root entrypoint from `@lssm-tech/lib.source-extractors`, or choose a documented subpath when you only need one part of the package surface.

## Architecture

- `src/__fixtures__` is part of the package's public or composition surface.
- `src/__snapshots__` is part of the package's public or composition surface.
- `src/codegen` is part of the package's public or composition surface.
- `src/codegen.test.ts` is part of the package's public or composition surface.
- `src/detect.test.ts` is part of the package's public or composition surface.
- `src/detect.ts` is part of the package's public or composition surface.
- `src/edge-cases.test.ts` is part of the package's public or composition surface.
- `src/index.ts` is the root public barrel and package entrypoint.
- `src/types.ts` is shared public type definitions.

## Public Entry Points

- Export `.` resolves through `./src/index.ts`.
- Export `./codegen` resolves through `./src/codegen/index.ts`.
- Export `./extractors` resolves through `./src/extractors/index.ts`.
- Export `./types` resolves through `./src/types.ts`.

## Local Commands

- `bun run dev` — contractspec-bun-build dev
- `bun run build` — contractspec-bun-build build
- `bun run test` — bun test
- `bun run lint` — bun lint:fix
- `bun run lint:check` — biome check .
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
- `bun run typecheck` — tsgo --noEmit
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
- `bun run clean` — rimraf dist .turbo
- `bun run build:bundle` — contractspec-bun-build transpile
- `bun run build:types` — contractspec-bun-build types
- `bun run prebuild` — contractspec-bun-build prebuild

## Recent Updates

- Replace eslint+prettier by biomejs to optimize speed.

## Notes

- Extractor interface must support multiple frameworks — keep it generic.
- Codegen output must stay deterministic (same input → same output, always).

### Internal source ownership

Detection rules, input strategies and project discovery have private source owners.
IR metadata, candidate shapes and extraction results remain available through the
existing type barrel. No package identity, public entrypoint or output changes.
Original focused test paths aggregate the same suites after cohesive splitting.


## Declared capabilities

### Lib Source Extractors

Capability ID: `package.lssm.tech.lib.source.extractors`

Extract contract candidates from TypeScript source code across multiple frameworks (NestJS, Express, Fastify, Hono, Elysia, tRPC, Next.js)

Use cases:

- Adopt extract contract candidates from typescript source code across multiple frameworks (nestjs, express, fastify, hono, elysia, trpc, next.js)

Constraints:

```json
{
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "avoidWhen": [
    "The @lssm-tech/lib.source-extractors package constraints do not match the target runtime or platform."
  ],
  "requires": [
    "TypeScript"
  ]
}
```

Other capability declarations:

```json
{
  "status": "active",
  "aliases": [
    "contractspec",
    "source-extraction",
    "nestjs",
    "express",
    "fastify",
    "hono",
    "elysia",
    "trpc",
    "typescript",
    "lib",
    "source",
    "extractors"
  ],
  "pythonEquivalents": [],
  "alternatives": [],
  "relationships": [],
  "resolutionPriority": 50
}
```

Capability imports:

```json
[
  {
    "from": "@lssm-tech/lib.source-extractors",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.source-extractors/codegen",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.source-extractors/extractors",
    "symbols": []
  },
  {
    "from": "@lssm-tech/lib.source-extractors/types",
    "symbols": []
  }
]
```

## Catalogue metadata

```json
{
  "family": "sharedLibs",
  "kind": "library",
  "status": "active",
  "adoptionMode": "adoptable",
  "stability": "stable",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./codegen",
    "./extractors",
    "./types"
  ],
  "examples": [],
  "replacements": []
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[
  {
    "capabilityId": "package.lssm.tech.lib.source.extractors",
    "from": "@lssm-tech/lib.source-extractors",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.source.extractors",
    "from": "@lssm-tech/lib.source-extractors/codegen",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.source.extractors",
    "from": "@lssm-tech/lib.source-extractors/extractors",
    "symbols": []
  },
  {
    "capabilityId": "package.lssm.tech.lib.source.extractors",
    "from": "@lssm-tech/lib.source-extractors/types",
    "symbols": []
  }
]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/lib.source-extractors` — subpath `.`
  - `unconditional`: `./src/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/src/index.ts); verified source file.

- `@lssm-tech/lib.source-extractors/codegen` — subpath `./codegen`
  - `unconditional`: `./src/codegen/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/src/codegen/index.ts); verified source file.

- `@lssm-tech/lib.source-extractors/extractors` — subpath `./extractors`
  - `unconditional`: `./src/extractors/index.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/src/extractors/index.ts); verified source file.

- `@lssm-tech/lib.source-extractors/types` — subpath `./types`
  - `unconditional`: `./src/types.ts` — [pinned source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/tools/source-extractors/src/types.ts); verified source file.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.ts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": {
      "types": "./dist/index.d.ts",
      "browser": "./dist/browser/index.js",
      "bun": "./dist/index.js",
      "node": "./dist/node/index.js",
      "default": "./dist/index.js"
    },
    "./codegen": {
      "types": "./dist/codegen/index.d.ts",
      "browser": "./dist/browser/codegen/index.js",
      "bun": "./dist/codegen/index.js",
      "node": "./dist/node/codegen/index.js",
      "default": "./dist/codegen/index.js"
    },
    "./extractors": {
      "types": "./dist/extractors/index.d.ts",
      "browser": "./dist/browser/extractors/index.js",
      "bun": "./dist/extractors/index.js",
      "node": "./dist/node/extractors/index.js",
      "default": "./dist/extractors/index.js"
    },
    "./types": {
      "types": "./dist/types.d.ts",
      "browser": "./dist/browser/types.js",
      "bun": "./dist/types.js",
      "node": "./dist/node/types.js",
      "default": "./dist/types.js"
    }
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.contracts-spec-core](https://lssm.co/docs/packages/lib.contracts-spec-core/): `workspace:^`
- [@lssm-tech/lib.schema](https://lssm.co/docs/packages/lib.schema/): `workspace:^`
- `typescript`: `catalog:`
- `zod`: `catalog:`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.bun](https://lssm.co/docs/packages/tool.bun/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "publish:pkg:canary": "bun publish:pkg --tag canary",
  "build": "contractspec-bun-build build",
  "build:bundle": "contractspec-bun-build transpile",
  "build:types": "contractspec-bun-build types",
  "dev": "contractspec-bun-build dev",
  "clean": "rimraf dist .turbo",
  "lint": "bun lint:fix",
  "lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
  "lint:check": "node ../../../scripts/biome.cjs check .",
  "test": "bun test",
  "prebuild": "contractspec-bun-build prebuild",
  "typecheck": "tsgo --noEmit"
}
```

## Declared documentation links

- [Lib Source Extractors documentation](https://www.npmjs.com/package/%40lssm-tech%2Flib.source-extractors) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Flib.source-extractors",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/lib.source-extractors.txt",
  "route": "/llms/lib.source-extractors",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/lib.source-extractors.txt",
  "blobSha": "04f0a82c58f97e7aae6c1a6a41dea23b05eff6ae",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
