# runtime/entrypoints/coordination.entrypoint.ts

> 55 lines of code and 5 definitions.

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

## Definitions

- `root` (lexical_declaration, line 30)
- `read` (lexical_declaration, line 35)
- `path` (lexical_declaration, line 36)
- `findings` (lexical_declaration, line 40)
- `terms` (lexical_declaration, line 42)

## Source

```typescript
import {
    ACCUMULATOR_FILE,
    AGENDA_CONFIG,
    HOST_LOCATION_KEYS,
    HOST_TERMS,
    INDEX_FILE,
} from "#configuration/constants/coordination.constants";
import {
    BOUND_SEAT_LEAD,
    CLEAN_COORDINATION,
    FILED_ENTRY_LEAD,
    HOST_TERM_LEAD,
    NO_PACKAGE,
    POPULATED_FOLDER_LEAD,
    SCHEDULED_AGENDA,
} from "#configuration/strings/coordination.strings";
import { ROOT, absolutePath, relativePath } from "@ssot/paths";
import { boundSeats, filedEntries, hostTermsIn, schedulesRows } from "#core/validators/coordination.validator";
import { conclude, refuse } from "#core/reporters/derivation.reporter";
import { existsSync, readFileSync } from "node:fs";
import { packageFiles, packagePath, populatedFolders } from "#core/loaders/coordination.loader";
import { COORDINATION_COMMAND } from "#configuration/constants/contract.constants";
import { COORDINATION_SUMMARY } from "#configuration/strings/contract.strings";
import type { Finding } from "#types/derivation.types";
import { join } from "node:path";
import { resolveArgv } from "@govlab/argv";

resolveArgv({ command: COORDINATION_COMMAND, flags: [], summary: COORDINATION_SUMMARY });

const root = absolutePath("app.coordination");
if (!existsSync(root)) {
    refuse(`${NO_PACKAGE}${root}`);
}

const read = function read(file: string): string {
    const path = join(root, file);
    return existsSync(path) ? readFileSync(path, "utf8") : "";
};

const findings: Finding[] = [];

const terms = [...HOST_TERMS, ...HOST_LOCATION_KEYS.map((key) => relativePath(key)), ROOT];

for (const file of packageFiles(root)) {
    for (const term of hostTermsIn(readFileSync(file, "utf8"), terms)) {
        findings.push({ file: packagePath(root, file), message: `${HOST_TERM_LEAD}${term}` });
    }
}

for (const file of populatedFolders(root)) {
    findings.push({ file, message: `${POPULATED_FOLDER_LEAD}${file}` });
}

for (const letter of boundSeats(read(INDEX_FILE))) {
    findings.push({ file: INDEX_FILE, message: `${BOUND_SEAT_LEAD}${letter}` });
}

for (const heading of filedEntries(read(ACCUMULATOR_FILE))) {
    findings.push({ file: ACCUMULATOR_FILE, message: `${FILED_ENTRY_LEAD}${heading}` });
}

if (schedulesRows(read(AGENDA_CONFIG))) {
    findings.push({ file: AGENDA_CONFIG, message: SCHEDULED_AGENDA });
}

conclude(COORDINATION_COMMAND, findings, CLEAN_COORDINATION);
```
