An experimental, Dockerized research pipeline for observing TypeScript compiler behavior across supplied npm package artifacts.
TyGen takes package tarballs as input, extracts them into a controlled workspace, runs tsc --noEmit with a fixed configuration, and writes a CSV summary plus per-package compiler output. It is intended for reproducible exploration—not as a production package-quality score or a general-purpose sandbox.
Status: experimental research prototype. The checked-in results are raw artifacts from a small run and should not be generalized into a formal claim about package type safety.
For each .tgz or .tar.gz artifact in tarballs/, the pipeline:
- extracts the archive using Python's data-only tar filter;
- finds the package and likely JavaScript code roots;
- copies the repository's
tsconfig.jsoninto that code root; - invokes
npx tsc --noEmitwith a 60-second per-package timeout; - counts TypeScript diagnostic codes and records the result in
results/results.csv; - saves combined compiler output to a per-package error log.
flowchart LR
A["npm package tarballs"] --> B["safe archive extraction"]
B --> C["package / code-root detection"]
C --> D["fixed tsconfig + tsc --noEmit"]
D --> E["CSV result row"]
D --> F["per-package compiler log"]
Docker is the most reproducible way to run the current experiment.
# Requires Docker. Create the input/output directories first.
mkdir -p tarballs results
# Place one or more .tgz / .tar.gz package artifacts in tarballs/ first.
docker build -t tygen .
docker run --rm -v "$PWD/results:/usr/src/app/results" tygenThe Dockerfile supplies Python 3.13, Node.js, npm, and TypeScript. Package artifacts are copied into the image at build time, so rebuild after changing tarballs/. Results are mounted back to results/ on the host. The Justfile contains equivalent just build and just run shortcuts for systems with just installed.
The local path requires Python 3.13+, Node.js/npm, and TypeScript.
uv sync
npm install --global typescript
mkdir -p tarballs
# Add package archives to tarballs/, then:
uv run python main.py| Artifact | Purpose |
|---|---|
results/results.csv |
One row per analyzed package: package, phase, status, message, compiler-help snapshot, and log path |
results/*-errors.txt |
Combined stdout/stderr from the TypeScript compiler |
packages/ |
Extracted package workspaces created during analysis |
The checked-in sample CSV is a legacy artifact from an earlier experiment and does not match the current six-column writer in main.py. Run the pipeline to generate results with the current schema.
- Compiler commands are invoked without a shell.
- Archive extraction uses Python's
filter="data"mode. - A TypeScript invocation that exceeds 60 seconds is recorded as a timeout rather than aborting the full run.
- Dependency installation and
@types/nodeinstallation are disabled by default. If enabled for an experiment, installation uses--ignore-scriptsand a bounded timeout.
TyGen is not a sandbox. npm package artifacts are executable code, and experiments involving untrusted packages should run in an isolation boundary appropriate to the threat model.
- The current runner analyzes at most five artifacts per execution.
- The compiler configuration is intentionally fixed and may not match a package's supported TypeScript versions, dependencies, or build layout.
- Error-counting is a lightweight diagnostic heuristic, not a formal measure of type safety.
- There is no automated test suite, benchmark corpus, or published evaluation protocol yet.
- The project is not packaged or released as an npm/PyPI tool.
This repository is a fork of dominictassio/tygen. The current branch contains Caleb Morse's experiment-specific pipeline work and results; preserve the upstream attribution when extending or presenting the project.
No license file is currently included. Do not assume permission to reuse the code until a license and any necessary upstream attribution are clarified.