How a file spells what its definitions refer to, learned from the definitions already in it: `ts.parse` through a namespace import, `parse` through a named one, `fs` for a default import. A target nothing there refers to yet is spelled like a sibling from the same module (`ts.` again), or gets an import.
The files under a mirrored directory that aren't code (Markdown, CSS, images, configuration, scripts): files of the codebase. In a git repository, only what git keeps (not what it ignores).
A file's format as a file of the codebase: its extension (any, in a directory marked as holding files; none for `Dockerfile`), after a dot for a hidden file (`.gitignore` is ".", `.mcp.json` ".json").
What doesn't match between the mirror's files and the codebase, re-analyzing the files as `import` does. With `keepText`, when they match, the codebase keeps each definition's code as the files spell it, so the next write spells references the way the files do (not as the scratch file it was edited in did).
Where a new namespace's file goes in a mirror: next to a sibling namespace's file, in a parent's directory (or an index.ts for a namespace with children), or by the namespace's path from the root. Only a path the mirror reads back as that namespace, and that doesn't exist yet.
Imports and re-exports of the file `from`, renamed `to` (`site.ts` to `site.tsx`), pointed at its new name. Returns the text of the files outside `mirrored` it changed, as they were.
Imports and re-exports of moved definitions, pointed at the files they're in now: `{ x }` from the old file becomes an import from the new one (`{ y as x }` if renamed too, so the code using it reads the same), the new file stops importing it, and the old file imports it if its other code still uses it. A namespace import (`a.x`) can't follow: that's a problem. Returns the text of the files outside `mirrored` it changed, as they were.
Record that `into` mirrors `dir`: each file's namespace, content and definitions as they are now. Following the files, it records what they hold (`held`, by path) as of the log they were last written at, so what the codebase changed meanwhile is written to them at the next sync.
Let code taken from git (into `root`, a copy of the mirror `dir`) resolve its packages as it did: a workspace package (a directory with a package.json naming it) to its copy here, anything else to what's installed now. Each package gets a node_modules like its counterpart's in `dir` (pnpm installs dependencies per package), with the workspace's own packages pointing at the copies.
TypeScript files near a mirror that aren't in it and mention any of `names`: the rest of its git repository (or its parent directory), leaving out installed packages, build output, hidden directories and codebases.
Drop the imports an edit stopped using: names `after` binds and doesn't mention that `before` did. Imports that were already unused are left as they are (the file's author's business); an import with nothing left goes.
The commit a release of a mirrored codebase is made from: the mirror's files must all be committed, so the release can be made again from git. Undefined when the mirror isn't in a git repository.
Make a mirror's recorded releases again, in a codebase that doesn't have them: for each, in order, its commit's files are imported (`importAt`) and the release is put at the history entry that makes. The files are taken from git into a directory inside the repository, so packages resolve as they did, and workspace packages (`@tcm/core`, say) are linked to their copies there rather than to today's.
specifierFor(from: string, to: string, leaf: string) => string
How a file imports `leaf` from the project's file `to`: by path, or from another package (the nearest package.json isn't the same, and it's a dependency) by that package's name, when an entry of its `exports` exports it (re-exporting it through barrels counts).
`text` with its type-only imports of `names` made value imports, for code that now uses them as values: `import type { Placement }` becomes `import { Placement }`, and one of several names moves to an import of its own.
Files and directories that are never the codebase's: version control, codebases, Finder's, and the mirror's record of releases (a copy of what the codebase has, for git).