codeanalyzer-typescript 0.1.0__py3-none-win_amd64.whl → 0.2.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codeanalyzer_typescript/__init__.py +6 -6
- codeanalyzer_typescript/_bin/{codeanalyzer-typescript.exe → cants.exe} +0 -0
- codeanalyzer_typescript-0.2.0.dist-info/METADATA +209 -0
- codeanalyzer_typescript-0.2.0.dist-info/RECORD +6 -0
- codeanalyzer_typescript-0.1.0.dist-info/METADATA +0 -76
- codeanalyzer_typescript-0.1.0.dist-info/RECORD +0 -6
- {codeanalyzer_typescript-0.1.0.dist-info → codeanalyzer_typescript-0.2.0.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""Prebuilt ``codeanalyzer-typescript
|
|
1
|
+
"""Prebuilt ``cants`` (codeanalyzer-typescript) backend binary for CLDK.
|
|
2
2
|
|
|
3
|
-
This package carries the platform-specific, self-contained ``
|
|
3
|
+
This package carries the platform-specific, self-contained ``cants``
|
|
4
4
|
executable (built from this repo with ``bun build --compile``) and exposes its
|
|
5
5
|
filesystem path. CLDK's Python SDK depends on this package and calls
|
|
6
6
|
:func:`bin_path` to locate the analyzer, exactly as it imports ``codeanalyzer-python``
|
|
@@ -18,15 +18,15 @@ import sys
|
|
|
18
18
|
from importlib import resources
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
|
|
21
|
-
__version__ = "0.
|
|
21
|
+
__version__ = "0.2.0"
|
|
22
22
|
|
|
23
23
|
__all__ = ["bin_path", "__version__"]
|
|
24
24
|
|
|
25
|
-
_BINARY_NAME = "
|
|
25
|
+
_BINARY_NAME = "cants" + (".exe" if sys.platform == "win32" else "")
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def bin_path() -> Path:
|
|
29
|
-
"""Return the absolute path to the bundled ``
|
|
29
|
+
"""Return the absolute path to the bundled ``cants`` binary.
|
|
30
30
|
|
|
31
31
|
Raises:
|
|
32
32
|
FileNotFoundError: if the wheel for this platform did not include a binary
|
|
@@ -38,7 +38,7 @@ def bin_path() -> Path:
|
|
|
38
38
|
|
|
39
39
|
if not path.exists():
|
|
40
40
|
raise FileNotFoundError(
|
|
41
|
-
f"Bundled
|
|
41
|
+
f"Bundled cants binary not found at {path}. "
|
|
42
42
|
"This usually means there is no prebuilt wheel for your platform; "
|
|
43
43
|
"build the binary with `bun build --compile` and point CLDK at it via "
|
|
44
44
|
"analysis_backend_path or $CODEANALYZER_TS_BIN."
|
|
Binary file
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codeanalyzer-typescript
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Prebuilt codeanalyzer-typescript backend binary for CLDK (codellm-devkit).
|
|
5
|
+
Project-URL: Homepage, https://codellm-devkit.info
|
|
6
|
+
Project-URL: Repository, https://github.com/codellm-devkit/codeanalyzer-ts
|
|
7
|
+
Author-email: Rahul Krishna <i.m.ralk@gmail.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Keywords: cldk,code analysis,codellm-devkit,typescript
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+

|
|
18
|
+
|
|
19
|
+
# A TypeScript Static Analysis Toolkit (and Library)
|
|
20
|
+
|
|
21
|
+
A comprehensive static analysis tool for TypeScript and JavaScript source code that
|
|
22
|
+
produces the canonical CodeLLM-DevKit (CLDK) `analysis.json` — a symbol table plus a
|
|
23
|
+
resolver-based call graph — using the TypeScript compiler via [ts-morph](https://ts-morph.com/).
|
|
24
|
+
It is the TypeScript backend behind [CLDK](https://github.com/codellm-devkit/python-sdk),
|
|
25
|
+
mirroring its [Python](https://github.com/codellm-devkit/codeanalyzer-python) and
|
|
26
|
+
[Java](https://github.com/codellm-devkit/codeanalyzer-java) siblings.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
The analyzer provides a command-line interface for performing static analysis on
|
|
31
|
+
TypeScript/JavaScript projects.
|
|
32
|
+
|
|
33
|
+
### Basic Usage
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cants --input /path/to/typescript/project
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Command Line Options
|
|
40
|
+
|
|
41
|
+
To view the available options, run `cants --help`:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Usage: cants [options]
|
|
45
|
+
|
|
46
|
+
CLDK TypeScript analyzer — emits the canonical analysis.json
|
|
47
|
+
(symbol table + resolver call graph).
|
|
48
|
+
|
|
49
|
+
Options:
|
|
50
|
+
-i, --input <path> project root to analyze
|
|
51
|
+
-o, --output <dir> output directory for analysis.json
|
|
52
|
+
(omit ⇒ compact JSON to stdout)
|
|
53
|
+
-f, --format <fmt> output format: json | msgpack (default: "json")
|
|
54
|
+
-a, --analysis-level <n> 1 = tsc resolver call graph + RTA (default);
|
|
55
|
+
2 = + CodeQL enrichment (default: "1")
|
|
56
|
+
-t, --target-files <paths...> restrict analysis to specific files (incremental)
|
|
57
|
+
--skip-tests skip test trees (default)
|
|
58
|
+
--include-tests include test trees
|
|
59
|
+
--eager force a clean rebuild instead of reusing the cache
|
|
60
|
+
--lazy reuse the cache (default)
|
|
61
|
+
--no-build skip dependency materialization
|
|
62
|
+
(use a prepared node_modules)
|
|
63
|
+
--no-phantoms disable phantom (external) nodes for imported/
|
|
64
|
+
required library calls
|
|
65
|
+
-c, --cache-dir <dir> cache/intermediate directory
|
|
66
|
+
-v, --verbose increase verbosity (repeatable)
|
|
67
|
+
-h, --help display help for command
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Examples
|
|
71
|
+
|
|
72
|
+
1. **Basic analysis (symbol table + call graph):**
|
|
73
|
+
```bash
|
|
74
|
+
cants --input ./my-ts-project
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This prints the analysis to stdout as compact JSON. To save it instead, use `--output`:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cants --input ./my-ts-project --output /path/to/analysis-results
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The results are written to `analysis.json` in the specified directory.
|
|
84
|
+
|
|
85
|
+
2. **Change output format to msgpack:**
|
|
86
|
+
```bash
|
|
87
|
+
cants --input ./my-ts-project --output /path/to/analysis-results --format msgpack
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This saves the results to `analysis.msgpack`, a binary format that is more compact for
|
|
91
|
+
storage and transmission.
|
|
92
|
+
|
|
93
|
+
3. **Deeper analysis with CodeQL enrichment (experimental):**
|
|
94
|
+
```bash
|
|
95
|
+
cants --input ./my-ts-project --analysis-level 2
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Every run produces a symbol table **and** a call graph. At level 1, edges come from the
|
|
99
|
+
TypeScript compiler's resolver plus Rapid Type Analysis (RTA), with phantom nodes for
|
|
100
|
+
calls into imported libraries. Level 2 additionally merges in CodeQL-derived edges.
|
|
101
|
+
|
|
102
|
+
4. **Incremental analysis of specific files:**
|
|
103
|
+
```bash
|
|
104
|
+
cants --input ./my-ts-project --target-files src/a.ts src/b.ts
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Restricts the analysis to the named files, reusing the cached analysis for the rest of
|
|
108
|
+
the project.
|
|
109
|
+
|
|
110
|
+
5. **Force a clean rebuild with a custom cache directory:**
|
|
111
|
+
```bash
|
|
112
|
+
cants --input ./my-ts-project --eager --cache-dir /path/to/custom-cache
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`--eager` rebuilds the analysis cache from scratch. If `--cache-dir` is omitted, the cache
|
|
116
|
+
defaults to `.codeanalyzer` inside the project root.
|
|
117
|
+
|
|
118
|
+
## Output
|
|
119
|
+
|
|
120
|
+
By default, analysis results are printed to stdout as compact JSON. When `--output` is given,
|
|
121
|
+
results are saved to `analysis.json` (or `analysis.msgpack` with `--format msgpack`) in the
|
|
122
|
+
specified directory.
|
|
123
|
+
|
|
124
|
+
The output document is a `TSApplication` with the following top-level shape:
|
|
125
|
+
|
|
126
|
+
```jsonc
|
|
127
|
+
{
|
|
128
|
+
"symbol_table": { /* file path → module (classes, interfaces, enums,
|
|
129
|
+
type aliases, functions, namespaces, variables, …) */ },
|
|
130
|
+
"call_graph": [ /* CALL_DEP edges: { source, target, weight,
|
|
131
|
+
provenance, tags } keyed by callable signature */ ],
|
|
132
|
+
"external_symbols": { /* phantom stubs for call targets outside the project
|
|
133
|
+
(imported libraries / Node builtins) */ },
|
|
134
|
+
"entrypoints": { /* framework-detected entrypoints (empty at level 1) */ }
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Caller- and callee-side identifiers are produced by a single signature canonicalizer, so call
|
|
139
|
+
graph `source`/`target` values byte-match the corresponding `symbol_table` (or
|
|
140
|
+
`external_symbols`) keys.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
Apache 2.0 — see [LICENSE](./LICENSE).
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
<!-- The sections below document this Python distribution itself; they have no
|
|
149
|
+
equivalent in the main repository README. -->
|
|
150
|
+
|
|
151
|
+
## About this package
|
|
152
|
+
|
|
153
|
+
This distributes the compiled `cants` binary as a set of
|
|
154
|
+
platform-specific Python wheels, published to PyPI as **`codeanalyzer-typescript`**.
|
|
155
|
+
The CLDK Python SDK depends on this package and calls
|
|
156
|
+
`codeanalyzer_typescript.bin_path()` to locate the analyzer binary. The binary is
|
|
157
|
+
built from this repo's `src/` with `bun build --compile`, so it is fully
|
|
158
|
+
self-contained (no Node/Bun needed at runtime).
|
|
159
|
+
|
|
160
|
+
### Why platform wheels?
|
|
161
|
+
|
|
162
|
+
A `bun --compile` binary is platform-specific and large (~70 MB) — there is no single
|
|
163
|
+
cross-platform artifact (the way a JVM backend could ship one `.jar`). So we ship **one
|
|
164
|
+
wheel per OS/arch**, tagged `py3-none-<platform>` (the binary is Python-agnostic — no
|
|
165
|
+
per-Python-version matrix), and let pip resolve the correct one at install time. There
|
|
166
|
+
is intentionally no usable sdist: the binary cannot be built without Bun.
|
|
167
|
+
|
|
168
|
+
### Building & publishing
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python -m pip install build wheel hatchling twine
|
|
172
|
+
./build_wheels.sh # cross-compiles every target via Bun, emits ./dist/*.whl
|
|
173
|
+
twine upload dist/*.whl
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
`build_wheels.sh` loops over the Bun targets, compiles each binary into
|
|
177
|
+
`src/codeanalyzer_typescript/_bin/`, builds a pure wheel, and retags it to the platform.
|
|
178
|
+
Bun cross-compiles all targets from a single host, so this does not need a CI runner
|
|
179
|
+
matrix.
|
|
180
|
+
|
|
181
|
+
### Versioning
|
|
182
|
+
|
|
183
|
+
The released version comes from the **git tag**. A push of `vX.Y.Z` triggers the
|
|
184
|
+
release workflow, which derives `X.Y.Z` from the tag, verifies it matches this
|
|
185
|
+
repo's `package.json` `version` (failing fast on mismatch), and stamps it into
|
|
186
|
+
`__init__.py` via `$PKG_VERSION` — hatch reads `__version__` as the wheel version
|
|
187
|
+
(`pyproject.toml` declares `dynamic = ["version"]`). So the GitHub Release tag, the
|
|
188
|
+
PyPI wheel version, and the npm `package.json` version are always in lockstep.
|
|
189
|
+
|
|
190
|
+
To cut a release: bump `package.json` `version`, then push the matching tag, e.g.
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
npm version 0.2.0 --no-git-tag-version # or edit package.json
|
|
194
|
+
git commit -am "Release v0.2.0" && git tag v0.2.0 && git push --tags
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
For a **local** wheel build, override the fallback version explicitly:
|
|
198
|
+
`PKG_VERSION=0.2.0 ./build_wheels.sh`.
|
|
199
|
+
|
|
200
|
+
One thing still tracked by hand: the python-sdk pin — `[tool.backend-versions]
|
|
201
|
+
codeanalyzer-typescript` and the `dependencies` entry
|
|
202
|
+
`codeanalyzer-typescript==<version>` — must be bumped to consume a new release.
|
|
203
|
+
|
|
204
|
+
### SDK integration
|
|
205
|
+
|
|
206
|
+
In the python-sdk, `TSCodeanalyzer._get_codeanalyzer_exec()` resolves the binary in
|
|
207
|
+
this order: `analysis_backend_path` → `$CODEANALYZER_TS_BIN` → **this package** →
|
|
208
|
+
in-tree bundled `bin/`. Adding `codeanalyzer-typescript` to the SDK's `dependencies`
|
|
209
|
+
makes the binary available automatically on install.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
codeanalyzer_typescript/__init__.py,sha256=w_G2b2FETBJH7KqvG-e-kOMewShb69rc5--_B53A2ug,1836
|
|
2
|
+
codeanalyzer_typescript/_bin/.gitignore,sha256=_mZ_61eDWQ65V05VrmLP33rSeppQmwCwV8_qsgHUOHM,251
|
|
3
|
+
codeanalyzer_typescript/_bin/cants.exe,sha256=KTRR1UtbgwZmbhPWKga38qCfRjYxKlhT9835Mwnqf8c,111492608
|
|
4
|
+
codeanalyzer_typescript-0.2.0.dist-info/METADATA,sha256=iiupqvPre6UG3Fz74gRdtPbUQtF-4soER-XX8cv2x5k,8518
|
|
5
|
+
codeanalyzer_typescript-0.2.0.dist-info/WHEEL,sha256=pp_iTzO0EBcCvlZZV2dJYp6L2tdDWBsn1ceo50wEt8Q,94
|
|
6
|
+
codeanalyzer_typescript-0.2.0.dist-info/RECORD,,
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: codeanalyzer-typescript
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Prebuilt codeanalyzer-typescript backend binary for CLDK (codellm-devkit).
|
|
5
|
-
Project-URL: Homepage, https://codellm-devkit.info
|
|
6
|
-
Project-URL: Repository, https://github.com/codellm-devkit/codeanalyzer-ts
|
|
7
|
-
Author-email: Rahul Krishna <i.m.ralk@gmail.com>
|
|
8
|
-
License: Apache-2.0
|
|
9
|
-
Keywords: cldk,code analysis,codellm-devkit,typescript
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Requires-Python: >=3.8
|
|
15
|
-
Description-Content-Type: text/markdown
|
|
16
|
-
|
|
17
|
-
# codeanalyzer-typescript (Python distribution)
|
|
18
|
-
|
|
19
|
-
This directory packages the compiled `codeanalyzer-typescript` binary as a set of
|
|
20
|
-
platform-specific Python wheels, published to PyPI as **`codeanalyzer-typescript`**.
|
|
21
|
-
|
|
22
|
-
The CLDK Python SDK depends on this package and calls `codeanalyzer_typescript.bin_path()`
|
|
23
|
-
to locate the analyzer binary — the same way it imports `codeanalyzer-python` for the
|
|
24
|
-
Python backend. The binary itself is built from this repo's `src/` with
|
|
25
|
-
`bun build --compile`, so it is fully self-contained (no Node/Bun needed at runtime).
|
|
26
|
-
|
|
27
|
-
## Why platform wheels?
|
|
28
|
-
|
|
29
|
-
Unlike the Java backend (one cross-platform `.jar`), a `bun --compile` binary is
|
|
30
|
-
platform-specific and large (~70 MB). So we ship **one wheel per OS/arch**, tagged
|
|
31
|
-
`py3-none-<platform>` (the binary is Python-agnostic — no per-Python-version matrix),
|
|
32
|
-
and let pip resolve the correct one at install time. There is intentionally no usable
|
|
33
|
-
sdist: the binary cannot be built without Bun.
|
|
34
|
-
|
|
35
|
-
## Building & publishing
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
python -m pip install build wheel hatchling twine
|
|
39
|
-
./build_wheels.sh # cross-compiles every target via Bun, emits ./dist/*.whl
|
|
40
|
-
twine upload dist/*.whl
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
`build_wheels.sh` loops over the Bun targets, compiles each binary into
|
|
44
|
-
`src/codeanalyzer_typescript/_bin/`, builds a pure wheel, and retags it to the platform.
|
|
45
|
-
Bun cross-compiles all targets from a single host, so this does not need a CI runner
|
|
46
|
-
matrix.
|
|
47
|
-
|
|
48
|
-
## Versioning
|
|
49
|
-
|
|
50
|
-
The released version comes from the **git tag**. A push of `vX.Y.Z` triggers the
|
|
51
|
-
release workflow, which derives `X.Y.Z` from the tag, verifies it matches this
|
|
52
|
-
repo's `package.json` `version` (failing fast on mismatch), and stamps it into
|
|
53
|
-
`__init__.py` via `$PKG_VERSION` — hatch reads `__version__` as the wheel version
|
|
54
|
-
(`pyproject.toml` declares `dynamic = ["version"]`). So the GitHub Release tag, the
|
|
55
|
-
PyPI wheel version, and the npm `package.json` version are always in lockstep.
|
|
56
|
-
|
|
57
|
-
To cut a release: bump `package.json` `version`, then push the matching tag, e.g.
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
npm version 0.2.0 --no-git-tag-version # or edit package.json
|
|
61
|
-
git commit -am "Release v0.2.0" && git tag v0.2.0 && git push --tags
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
For a **local** wheel build, override the fallback version explicitly:
|
|
65
|
-
`PKG_VERSION=0.2.0 ./build_wheels.sh`.
|
|
66
|
-
|
|
67
|
-
One thing still tracked by hand: the python-sdk pin — `[tool.backend-versions]
|
|
68
|
-
codeanalyzer-typescript` and the `dependencies` entry
|
|
69
|
-
`codeanalyzer-typescript==<version>` — must be bumped to consume a new release.
|
|
70
|
-
|
|
71
|
-
## SDK integration
|
|
72
|
-
|
|
73
|
-
In the python-sdk, `TSCodeanalyzer._get_codeanalyzer_exec()` resolves the binary in
|
|
74
|
-
this order: `analysis_backend_path` → `$CODEANALYZER_TS_BIN` → **this package** →
|
|
75
|
-
in-tree bundled `bin/`. Adding `codeanalyzer-typescript` to the SDK's `dependencies`
|
|
76
|
-
makes the binary available automatically on install.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
codeanalyzer_typescript/__init__.py,sha256=f2JzA_PPc4SU59_EDbYC1YktWFtEWnEwGuj_8ovQypY,1900
|
|
2
|
-
codeanalyzer_typescript/_bin/.gitignore,sha256=_mZ_61eDWQ65V05VrmLP33rSeppQmwCwV8_qsgHUOHM,251
|
|
3
|
-
codeanalyzer_typescript/_bin/codeanalyzer-typescript.exe,sha256=ri0chkdaCeanYd5HqYRIvoij4-9_11bTPFKbhBodIeE,111492608
|
|
4
|
-
codeanalyzer_typescript-0.1.0.dist-info/METADATA,sha256=MzNfbhKNfb4KV85v8PGqbqauwA81aP5Emd4J_FUKL2w,3477
|
|
5
|
-
codeanalyzer_typescript-0.1.0.dist-info/WHEEL,sha256=pp_iTzO0EBcCvlZZV2dJYp6L2tdDWBsn1ceo50wEt8Q,94
|
|
6
|
-
codeanalyzer_typescript-0.1.0.dist-info/RECORD,,
|
|
File without changes
|