11. Importing existing projects

ucm import <dir> --into ns [--exclude a,b] [--update] [--verbose]

Each file becomes a namespace: core/src/analyze.ts → ns.core.analyze (src path segments and index file names are dropped). Imports between files, barrels and workspace packages resolve to hashes.

Compiler options for imports are described in compiler options.

11.1 Verified projects

These have been imported, verified (ucm verify: every definition renders and re-hashes to itself) and run from a scratch file:

projectdefinitionsnotes
neverthrow51strict: false, kept as its check profile
ts-pattern247namespace imports (P.infer<…>), declare const
valibot (library/src, --exclude vitest)941573 files in 4s; module state, @ts-expect-error above overloads
ucm-ts itselfpackages/see self-hosting

11.2 What import mode accepts beyond scratch files

Still refused: declare module/declare global, import x = require(), decorators, and top-level statements. A top-level statement can't be skipped quietly, because that could leave a definition half-initialized; wrap it in an immediately-invoked function.

built from 5890e54f