Skip to content

Extension and Packaging Internals

Toprak Ahmet Aydoğmuş edited this page Nov 30, 2026 · 1 revision

T-Zero Algorithm Extension and Packaging Internals

A code-grounded map of the VS Code extension, npm installer, Python entry points, and release metadata.

VS Code extension files

File Role established by the tracked source
extensions/vscode/package.json Extension identity, activation events, contributed commands/views, settings, and packaged files.
extensions/vscode/src/extension.js VS Code lifecycle, command registration, process invocation, status UI, and output channel.
extensions/vscode/src/core.js VS Code-independent formatting, quoting, scan JSON parsing, and declaration-pattern helpers.
extensions/vscode/test/extension.test.js Tests for the extension helper and command behavior.

Source: extension folder.

Activation and CLI process boundary

The extension manifest activates after startup and when its cockpit view is opened. Its main entry points to src/extension.js. The extension obtains the executable from tzero.executablePath, defaulting to tzero.

runTZeroCli invokes the configured executable with execFile(executable, args, options), uses the selected workspace (or a temporary directory if none is supplied), and sets a bounded output buffer. This avoids assembling a shell command for that path. The extension separately uses a terminal command builder for interactive terminal commands, with platform-specific quoting helpers.

This is not a guarantee that all commands are harmless: the CLI command determines whether files or settings are changed. Inspect the command arguments and the invoked CLI branch.

Workspace telemetry and editor display

The extension refreshes workspace metrics by asking the CLI for scan output in JSON format, then calling parseScanJson. It stores parsed metrics in extension state and presents compact values in the status bar and sidebar.

For the active editor, computeCodeLensMetrics searches source lines using a declaration regular expression and an approximate end-of-symbol scanner. It estimates tokens as approximately one quarter of source characters. It is a display helper, not a language-complete parser and not an exact tokenizer measurement.

The extension's status-bar numbers are therefore best treated as UI summaries. For exact measurements, inspect the CLI's source and identify the specific token-count or character-count method used.

Contributed settings and commands

The manifest declares:

Setting Default Effect
tzero.executablePath tzero Chooses the CLI executable or path used by the extension.
tzero.autoInitOnOpen false Controls the optional auto-initialization setting.

The manifest contributes commands for setup, context generation, compression, auditing, explanation, review, watching, diagnostics, architecture checks, budget reports, contracts, mutation, bridges, merge healing, hooks, federation, armor, and other features. These names are UI integration points; the implementation is distributed across extension.js and the CLI.

Python and native package metadata

pyproject.toml is the Python source for the package version, Python requirement, base dependencies, optional extras, console entry points, and package selection. The project declares Python >=3.11; space, test, tokenizer, and build are optional dependency groups.

The tzero-core Rust crate declares cdylib and rlib outputs and depends on PyO3, tree-sitter grammars, tokenization, serde, and regular expressions. The Cargo manifest describes build inputs; it does not prove that the compiled extension exists in a particular wheel.

npm distribution and source copies

The repository tracks installers/npm/ as a separate distribution layout and includes a Python source tree under its src directory. Packaging and version metadata should be checked against the exact published npm release. Do not assume that a source-file copy and the canonical tzero/ package are synchronized merely because the package version matches.

tests/test_packaging_sync.py verifies selected package declarations and version values across Python, MCP, npm, VS Code, Homebrew, Scoop, and WinGet metadata. It also checks selected package inclusion rules. It does not compare the complete contents of every mirrored source tree.

Release consistency checklist

For a release-specific technical explanation, verify all of the following against the same tag:

  1. Python version in pyproject.toml.
  2. MCP version in server.json, Smithery, and Glama metadata.
  3. npm version and the published package files.
  4. VS Code extension version and packaged files.
  5. Rust crate versions and compiled artifacts.
  6. Installer manifests and download URLs.
  7. Release notes and the actual GitHub release assets.
  8. The runtime tools/list result for the installed MCP package.

These are separate release surfaces. A passing metadata test does not prove that every remote registry or editor marketplace has finished publishing the same bits.

Sources

Clone this wiki locally