# tools/core/entrypoints/source.entrypoint.ts

> 30 lines of code and 7 definitions.

Tree: Coordination tree
Language: typescript
Layer: runtime
Canonical: https://banes-lab.com/anatomy/coordination#file-coordination-tools-core-entrypoints-source-entrypoint-ts
Source text: https://banes-lab.com/assets/sources/source.cb30e368dfb019b4d85878363b1e02dc60ecaa37588710e5ee73aee01d94c5e0.generated.txt

## Definitions

- `REPO_ROOT` (lexical_declaration, line 8)
- `REPORT` (lexical_declaration, line 9)
- `RESTATES` (lexical_declaration, line 11, exported)
- `main` (lexical_declaration, line 13)
- `apply` (lexical_declaration, line 14)
- `result` (lexical_declaration, line 15)
- `report` (lexical_declaration, line 17)

## Source

```typescript
import { GENERATED_DIR, NO_FIX_FLAG } from "../constants/path.constants.ts";
import { mkdirSync, writeFileSync } from "node:fs";

import { cleanSources } from "../steps/source.step.ts";
import { projectRoot } from "../../../config/surface.config.ts";
import { resolve } from "node:path";

const REPO_ROOT = projectRoot();
const REPORT = `${GENERATED_DIR}/clean.report.generated.json`;

export const RESTATES: readonly string[] = ["mutation_preview_first", "healing_is_default_in_every_entrypoint"];

const main = function main(): void {
    const apply = !process.argv.includes(NO_FIX_FLAG);
    const result = cleanSources(REPO_ROOT, apply);

    const report = {
        applied: apply,
        files: result.files,
        keptAsAttribution: result.kept,
        removed: result.removed,
        scanned: result.scanned,
        tool: "clean",
        verdict: "pass",
    };

    mkdirSync(resolve(REPO_ROOT, GENERATED_DIR), { recursive: true });
    writeFileSync(resolve(REPO_ROOT, REPORT), `${JSON.stringify(report, null, 4)}\n`, "utf8");

    process.stdout.write(
        `${apply ? "CLEANED" : "PREVIEW"}  scanned=${String(result.scanned)} ` +
            `files=${String(result.files.length)} removed=${String(result.removed)} ` +
            `attributionKept=${String(result.kept)}\n` +
            `report: ${REPORT}\n`,
    );
};

main();
```
