Skip to content

v1.1.0: Much better call coverage, and --exclude-tests

Latest

Choose a tag to compare

@RuchiPurohit RuchiPurohit released this 23 Oct 01:51
685c161

Codeskope now finds far more of the calls in a typical TypeScript codebase. On a 176-file Express backend, call edges went from 94 to 1,462. A new --exclude-tests option keeps test helpers from crowding out results.

Highlights

Much better call coverage

  • Arrow functions are indexed. Functions written as const handler = async () => {}, const f = function () {} or class fields like handle = () => {} are now symbols. Previously, codebases written in this style were mostly missing from the graph.
  • Calls inside callbacks count. A call inside .map(...), a promise chain, or a test's it(...) is credited to the surrounding named function. Calls in constructors are credited to their class. Top-level code is credited to its file.
  • Type-annotated variables resolve. A call to const handler: Handler = ... now finds handler itself, not just its type.

--exclude-tests

Test code often calls shared helpers (fixtures, seeders, app factories) more than your application does, so those helpers can dominate dependents and impact results. To index application code only:

codeskope index . --exclude-tests

This leaves out *.test.ts(x) and *.spec.ts(x) files and anything under __tests__, __mocks__, test or tests. The setting is saved in the index, so codeskope update keeps it. Run index without the flag to bring tests back.

  • MCP: start the server with codeskope-mcp --root . --exclude-tests. refresh_index now reports excludeTests in its output.
  • Visualization: a new Exclude tests checkbox under Scope hides test files from the interactive graph without re-indexing.

Fixes

  • Global installs work. npm i -g codeskope no longer crashes on startup with "Cannot find package 'typescript'".
  • Indexing from another directory works. codeskope index /path/to/project run from a different directory now picks up the project's @types. Before, you got inflated compiler errors and missing calls.
  • No more duplicate-name crash. Files where the same name is declared twice (block-scoped helpers, overload signatures) no longer fail with "Node already exists".

Breaking changes

  • Diagnostic names changed.
    • external-call is now unindexed-target. It means the callee is in your project but isn't something Codeskope indexes. Calls to libraries were never reported, and still aren't.
    • unmodeled-caller is removed. Every call Codeskope resolves now has a caller.
    • If you filter diagnostics by kind, update those names.
  • A caller can be a file. dependents, impact and the MCP relationship tools can return a file as a caller. That means top-level code in that file calls the symbol, for example module setup or test bodies. If your code assumes every caller is a function or method, handle file nodes too.

Upgrading

npm install --save-dev codeskope@2   # or: pnpm add -D codeskope@2
codeskope index .                    # rebuild the index to get the new coverage

Indexes from 1.x still load, but they don't have the new call coverage until you rebuild them with index.