Skip to main content

Prebuilt codeanalyzer-typescript backend binary for CLDK (codellm-devkit).

Project description

logo

A TypeScript Static Analysis Toolkit (and Library)

A comprehensive static analysis tool for TypeScript and JavaScript source code that produces the canonical CodeLLM-DevKit (CLDK) analysis.json — a symbol table plus a resolver-based call graph — using the TypeScript compiler via ts-morph. It is the TypeScript backend behind CLDK, mirroring its Python and Java siblings.

Usage

The analyzer provides a command-line interface for performing static analysis on TypeScript/JavaScript projects.

Basic Usage

codeanalyzer-typescript --input /path/to/typescript/project

Command Line Options

To view the available options, run codeanalyzer-typescript --help:

Usage: codeanalyzer-typescript [options]

CLDK TypeScript analyzer — emits the canonical analysis.json
(symbol table + resolver call graph).

Options:
  -i, --input <path>             project root to analyze
  -o, --output <dir>             output directory for analysis.json
                                 (omit ⇒ compact JSON to stdout)
  -f, --format <fmt>             output format: json | msgpack (default: "json")
  -a, --analysis-level <n>       1 = tsc resolver call graph + RTA (default);
                                 2 = + CodeQL enrichment (default: "1")
  -t, --target-files <paths...>  restrict analysis to specific files (incremental)
      --skip-tests               skip test trees (default)
      --include-tests            include test trees
      --eager                    force a clean rebuild instead of reusing the cache
      --lazy                     reuse the cache (default)
      --no-build                 skip dependency materialization
                                 (use a prepared node_modules)
      --no-phantoms              disable phantom (external) nodes for imported/
                                 required library calls
  -c, --cache-dir <dir>          cache/intermediate directory
  -v, --verbose                  increase verbosity (repeatable)
  -h, --help                     display help for command

Examples

  1. Basic analysis (symbol table + call graph):

    codeanalyzer-typescript --input ./my-ts-project
    

    This prints the analysis to stdout as compact JSON. To save it instead, use --output:

    codeanalyzer-typescript --input ./my-ts-project --output /path/to/analysis-results
    

    The results are written to analysis.json in the specified directory.

  2. Change output format to msgpack:

    codeanalyzer-typescript --input ./my-ts-project --output /path/to/analysis-results --format msgpack
    

    This saves the results to analysis.msgpack, a binary format that is more compact for storage and transmission.

  3. Deeper analysis with CodeQL enrichment (experimental):

    codeanalyzer-typescript --input ./my-ts-project --analysis-level 2
    

    Every run produces a symbol table and a call graph. At level 1, edges come from the TypeScript compiler's resolver plus Rapid Type Analysis (RTA), with phantom nodes for calls into imported libraries. Level 2 additionally merges in CodeQL-derived edges.

  4. Incremental analysis of specific files:

    codeanalyzer-typescript --input ./my-ts-project --target-files src/a.ts src/b.ts
    

    Restricts the analysis to the named files, reusing the cached analysis for the rest of the project.

  5. Force a clean rebuild with a custom cache directory:

    codeanalyzer-typescript --input ./my-ts-project --eager --cache-dir /path/to/custom-cache
    

    --eager rebuilds the analysis cache from scratch. If --cache-dir is omitted, the cache defaults to .codeanalyzer inside the project root.

Output

By default, analysis results are printed to stdout as compact JSON. When --output is given, results are saved to analysis.json (or analysis.msgpack with --format msgpack) in the specified directory.

The output document is a TSApplication with the following top-level shape:

{
  "symbol_table":     { /* file path → module (classes, interfaces, enums,
                           type aliases, functions, namespaces, variables, …) */ },
  "call_graph":       [ /* CALL_DEP edges: { source, target, weight,
                           provenance, tags } keyed by callable signature */ ],
  "external_symbols": { /* phantom stubs for call targets outside the project
                           (imported libraries / Node builtins) */ },
  "entrypoints":      { /* framework-detected entrypoints (empty at level 1) */ }
}

Caller- and callee-side identifiers are produced by a single signature canonicalizer, so call graph source/target values byte-match the corresponding symbol_table (or external_symbols) keys.

License

Apache 2.0 — see LICENSE.


About this package

This distributes the compiled codeanalyzer-typescript binary as a set of platform-specific Python wheels, published to PyPI as codeanalyzer-typescript. The CLDK Python SDK depends on this package and calls codeanalyzer_typescript.bin_path() to locate the analyzer binary. The binary is built from this repo's src/ with bun build --compile, so it is fully self-contained (no Node/Bun needed at runtime).

Why platform wheels?

A bun --compile binary is platform-specific and large (~70 MB) — there is no single cross-platform artifact (the way a JVM backend could ship one .jar). So we ship one wheel per OS/arch, tagged py3-none-<platform> (the binary is Python-agnostic — no per-Python-version matrix), and let pip resolve the correct one at install time. There is intentionally no usable sdist: the binary cannot be built without Bun.

Building & publishing

python -m pip install build wheel hatchling twine
./build_wheels.sh            # cross-compiles every target via Bun, emits ./dist/*.whl
twine upload dist/*.whl

build_wheels.sh loops over the Bun targets, compiles each binary into src/codeanalyzer_typescript/_bin/, builds a pure wheel, and retags it to the platform. Bun cross-compiles all targets from a single host, so this does not need a CI runner matrix.

Versioning

The released version comes from the git tag. A push of vX.Y.Z triggers the release workflow, which derives X.Y.Z from the tag, verifies it matches this repo's package.json version (failing fast on mismatch), and stamps it into __init__.py via $PKG_VERSION — hatch reads __version__ as the wheel version (pyproject.toml declares dynamic = ["version"]). So the GitHub Release tag, the PyPI wheel version, and the npm package.json version are always in lockstep.

To cut a release: bump package.json version, then push the matching tag, e.g.

npm version 0.2.0 --no-git-tag-version   # or edit package.json
git commit -am "Release v0.2.0" && git tag v0.2.0 && git push --tags

For a local wheel build, override the fallback version explicitly: PKG_VERSION=0.2.0 ./build_wheels.sh.

One thing still tracked by hand: the python-sdk pin — [tool.backend-versions] codeanalyzer-typescript and the dependencies entry codeanalyzer-typescript==<version> — must be bumped to consume a new release.

SDK integration

In the python-sdk, TSCodeanalyzer._get_codeanalyzer_exec() resolves the binary in this order: analysis_backend_path$CODEANALYZER_TS_BINthis package → in-tree bundled bin/. Adding codeanalyzer-typescript to the SDK's dependencies makes the binary available automatically on install.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

codeanalyzer_typescript-0.1.1-py3-none-win_amd64.whl (40.5 MB view details)

Uploaded Python 3Windows x86-64

codeanalyzer_typescript-0.1.1-py3-none-macosx_11_0_arm64.whl (26.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

codeanalyzer_typescript-0.1.1-py3-none-macosx_10_12_x86_64.whl (28.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file codeanalyzer_typescript-0.1.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for codeanalyzer_typescript-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 493573e255688c11c7cb47dde2a0d2cc0d1f33b008ecf8f0dd5c95dd35a80c18
MD5 998ff762eb6a546cedc11d4003b0130e
BLAKE2b-256 dcd780436bd07180ba37d28fd3f79cc3c5b5d25f09d4ff9a0e056f99c30240b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeanalyzer_typescript-0.1.1-py3-none-win_amd64.whl:

Publisher: release.yml on codellm-devkit/codeanalyzer-ts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codeanalyzer_typescript-0.1.1-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for codeanalyzer_typescript-0.1.1-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9745ed2edf71b0c0b8b3e648a8bbb3404102d6b7a7882b046582e943d770f5af
MD5 1d9199cf91df3c371d0ea6a710cee575
BLAKE2b-256 02e8336ae8053183a72d66a2df5f709977a228e7c9342b1b870dee532ca8ad62

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeanalyzer_typescript-0.1.1-py3-none-manylinux2014_x86_64.whl:

Publisher: release.yml on codellm-devkit/codeanalyzer-ts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codeanalyzer_typescript-0.1.1-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for codeanalyzer_typescript-0.1.1-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0d9ebbdbdc35df0b6e414fa9c64dbb7b3cc172432c994234c9b30fb934039c5d
MD5 c4659175fd3cfebc2a968f70d7e0dfb3
BLAKE2b-256 7300dcbf2ea754567817f17711a2464a64a2d5c9126a361d797e546e8a0a1a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeanalyzer_typescript-0.1.1-py3-none-manylinux2014_aarch64.whl:

Publisher: release.yml on codellm-devkit/codeanalyzer-ts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codeanalyzer_typescript-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for codeanalyzer_typescript-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21b2a23d648426dcf58012ae7302c1803ee15dd4f60a7d762db5c5523807c787
MD5 ab97825e8eeb245ffe9d7dfee56c35f3
BLAKE2b-256 0c0c96ef9541c49fa5214911091c71797bc4bd55aec10898db2adbcce84370c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeanalyzer_typescript-0.1.1-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on codellm-devkit/codeanalyzer-ts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codeanalyzer_typescript-0.1.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for codeanalyzer_typescript-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a0343dbc52021c0ecb628984ffd7678ed931bbe23f2f66fa6e7d1e50cdfb1d0c
MD5 dd7d08550841f56ee9c722c5ce9fe428
BLAKE2b-256 b139ce290e88003c5a63d7eb471201230c8abef930f6ad3d5d984c4166a0cf42

See more details on using hashes here.

Provenance

The following attestation bundles were made for codeanalyzer_typescript-0.1.1-py3-none-macosx_10_12_x86_64.whl:

Publisher: release.yml on codellm-devkit/codeanalyzer-ts

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page