Skip to content

Commit 8746dad

Browse files
committed
docs(ts): document pip/Homebrew install and the cants command
- codeanalyzer-ts backend page: lead with an Install section (pip install codeanalyzer-typescript / brew) that yields the `cants` CLI; rename binary references from codeanalyzer-typescript to cants; note the package-vs-command naming; correct the -a row (level 2 = call graph, not CodeQL). - installing.mdx: add a TypeScript Analysis dependency tab covering the same pip/brew install and the cants command.
1 parent 1a95f3a commit 8746dad

2 files changed

Lines changed: 54 additions & 9 deletions

File tree

src/content/docs/backends/codeanalyzer-ts.mdx

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,38 +34,60 @@ Walks the ts-morph AST and indexes all declarations (classes, methods, interface
3434

3535
Both maintain the no-dangling-edges invariant: every call-graph edge endpoint is a real `Callable.signature`.
3636

37-
## Building and running
37+
## Installing
3838

39-
### Prerequisites
40-
- **bun** ≥ 1.3, or **Node** ≥ 20
41-
- **npm** on PATH (to materialize dependencies)
39+
The fastest way to get the `cants` CLI is from **PyPI** or **Homebrew**. Both ship a prebuilt, self-contained binary for your platform — no Bun or Node is needed to *run* it:
40+
41+
<Tabs>
42+
<TabItem label="pip">
43+
```bash
44+
pip install codeanalyzer-typescript
45+
cants --help
46+
```
47+
</TabItem>
48+
<TabItem label="Homebrew">
49+
```bash
50+
brew install codellm-devkit/homebrew-tap/codeanalyzer-typescript
51+
cants --help
52+
```
53+
</TabItem>
54+
</Tabs>
55+
56+
The PyPI package `codeanalyzer-typescript` is also what the CLDK Python SDK depends on to locate this backend — it exposes `bin_path()` to point at the bundled binary.
57+
58+
<Aside type="note">
59+
The distributable is named **`codeanalyzer-typescript`** (the PyPI package and the Homebrew formula), but the command it installs on your `PATH` is **`cants`** — the analyzer's short binary name. Run `cants`, not `codeanalyzer-typescript`.
60+
</Aside>
61+
62+
### Building from source
63+
64+
To hack on the analyzer, build it with **bun** ≥ 1.3 (Node ≥ 20 also works to run from source). **npm** must be on PATH to materialize dependencies:
4265

43-
### Install and build
4466
```bash
4567
cd codeanalyzer-ts
4668
bun install
47-
bun run build # → dist/codeanalyzer-typescript (standalone binary)
69+
bun run build # → dist/cants (standalone binary)
4870
```
4971

5072
Or run from source without compilation:
5173
```bash
52-
bun run src/index.ts -i <project> -a 2
74+
bun run src/index.ts -i <project>
5375
```
5476

5577
## CLI
5678

5779
The analyzer accepts these command-line options:
5880

5981
```bash
60-
codeanalyzer-typescript -i <path> [options]
82+
cants -i <path> [options]
6183
```
6284

6385
| Option | Description |
6486
|--------|-------------|
6587
| `-i, --input <path>` | Project root to analyze **(required)** |
6688
| `-o, --output <dir>` | Write `analysis.json` to this directory; omit to emit compact JSON to stdout (used by the SDK) |
6789
| `-f, --format <fmt>` | Output format: `json` or `msgpack` (default: `json`) |
68-
| `-a, --analysis-level <n>` | `1` = tsc resolver call graph + RTA (default); `2` = + CodeQL enrichment |
90+
| `-a, --analysis-level <n>` | `1` = symbol table + tsc resolver call graph + RTA (default); `2` = call graph |
6991
| `-t, --target-files <paths...>` | Restrict analysis to specific files (for incremental builds) |
7092
| `--skip-tests` / `--include-tests` | Skip or include test files (default: skip) |
7193
| `--eager` / `--lazy` | Force clean rebuild vs. reuse cache (default: reuse) |

src/content/docs/installing.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,29 @@ The Python SDK can be installed directly from
128128
```
129129
This should output the version of the installed Maven.
130130
</TabItem>
131+
<TabItem label="TypeScript Analysis">
132+
For TypeScript and JavaScript analysis, CLDK relies on a companion backend, [`codeanalyzer-ts`](/backends/codeanalyzer-ts/). It ships as a prebuilt, self-contained binary, so you do **not** need Bun or Node installed to run it — just install the `codeanalyzer-typescript` package, which puts a `cants` command on your `PATH`.
133+
134+
Install it from PyPI:
135+
136+
```bash
137+
pip install codeanalyzer-typescript
138+
```
139+
140+
Or with Homebrew:
141+
142+
```bash
143+
brew install codellm-devkit/homebrew-tap/codeanalyzer-typescript
144+
```
145+
146+
Verify the installation:
147+
148+
```bash
149+
cants --help
150+
```
151+
152+
The package is named `codeanalyzer-typescript`, but the installed command is **`cants`**. To analyze a project's *dependencies* (so library call targets resolve), keep `npm` on your `PATH`; the analyzer materializes `node_modules` automatically (skip with `--no-build`). See the [codeanalyzer-ts backend reference](/backends/codeanalyzer-ts/) for full CLI options.
153+
</TabItem>
131154
<TabItem label="Rust Installation">
132155
Rustup is the recommended tool for installing Rust and managing its toolchains. It simplifies the process of keeping Rust up to date and allows switching between different Rust versions and toolchains seamlessly.
133156

0 commit comments

Comments
 (0)