Skip to content

CLI options

codeanalyzer-typescript [OPTIONS]

CLDK TypeScript analyzer — emits the canonical analysis.json (symbol table + resolver call graph) using the TypeScript compiler via ts-morph. The only required option is --input. With no --output, the artifact is printed to stdout as compact JSON.

OptionAliasTypeDefaultDescription
--input-iPATHrequiredProject root to analyze.
--output-oDIR(stdout)Output directory for analysis.json. If omitted, compact JSON is printed to stdout.
--format-fjson | msgpackjsonOutput serialization format.
--analysis-level-a1 | 211 = tsc resolver call graph + RTA; 2 = + CodeQL enrichment (experimental).
--target-files-tPATHS…(whole project)Restrict analysis to specific files (incremental); the rest is served from cache.
--skip-testsflag--skip-testsSkip test trees (the default).
--include-testsflagInclude test trees in the analysis.
--eagerflagForce a clean rebuild — reinstall dependencies, rebuild the analysis.
--lazyflag--lazyReuse the cache (the default).
--no-buildflagSkip dependency materialization; reuse a prepared node_modules.
--no-phantomsflagDisable phantom (external) nodes for imported/required library calls.
--cache-dir-cDIR<input>/.codeanalyzerCache/intermediate directory.
--verbose-vcount0Increase verbosity (repeatable): -v (info), -vv (debug).
--help-hShow the help message and exit.
  • Level 1 by default. The TypeScript checker plus RTA resolve the call graph; pass --analysis-level 2 for (experimental) CodeQL enrichment.
  • Lazy by default. Analysis reuses the cached symbol table and call graph for unchanged files. Use --eager to force a full rebuild.
  • Builds by default. Dependencies are materialized into node_modules so types resolve. Use --no-build to reuse a prepared tree.
  • Phantoms on by default. Calls into imported libraries become external_symbols. Use --no-phantoms to restrict the graph to in-project targets.
  • Tests excluded by default. Test trees are skipped unless you pass --include-tests.
  • Cache kept by default. The cache under .codeanalyzer/ survives between runs; --eager rebuilds it.
FormatFileNotes
jsonanalysis.jsonCompact JSON. Also the stdout format when --output is omitted.
msgpackanalysis.msgpackMessagePack; more compact for storage and transmission.

Both encode the same TSApplication schema — see Output schema.

Terminal window
# Symbol table + call graph to stdout
codeanalyzer-typescript --input ./proj
# Write JSON to a directory
codeanalyzer-typescript --input ./proj --output ./out
# msgpack, eager rebuild
codeanalyzer-typescript --input ./proj --output ./out --format msgpack --eager
# Incremental: only two files, rest from cache
codeanalyzer-typescript --input ./proj --target-files src/a.ts src/b.ts
# Reuse a prepared node_modules, custom cache, debug logging
codeanalyzer-typescript --input ./proj --no-build --cache-dir /tmp/ca -vv