# runtime/entrypoints/coordination.entrypoint.ts

> 59 lines of code and 6 definitions.

Tree: Bane's Lab Content
Language: typescript
Layer: runtime
Canonical: https://banes-lab.com/anatomy/content#file-content-runtime-entrypoints-coordination-entrypoint-ts
Source text: https://banes-lab.com/source/content/runtime/entrypoints/coordination.entrypoint.ts.txt

Listed in [runtime/entrypoints](https://banes-lab.com/api/source/content/runtime/entrypoints.md), after [runtime/entrypoints/chapter.entrypoint.ts](https://banes-lab.com/source/content/runtime/entrypoints/chapter.entrypoint.ts.md) and before [runtime/entrypoints/coverage.entrypoint.ts](https://banes-lab.com/source/content/runtime/entrypoints/coverage.entrypoint.ts.md).

## Definitions

- `readAt` (lexical_declaration, line 37)
- `read` (lexical_declaration, line 41)
- `root` (lexical_declaration, line 32)
- `agendaConfig` (lexical_declaration, line 45)
- `findings` (lexical_declaration, line 47)
- `terms` (lexical_declaration, line 49)

## Contained in

- [runtime/entrypoints](https://banes-lab.com/anatomy/content/folder-content-runtime-entrypoints.md)

## Enforces

- [Platform Independence](https://banes-lab.com/records/architecture/platform-independence.md)

## Linked from

- [runtime/entrypoints](https://banes-lab.com/anatomy/content/folder-content-runtime-entrypoints.md)

## Source

```typescript
import {
    ACCUMULATOR_FILE,
    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 { defineCheck } from "@govlab/context/check";
import { join } from "node:path";
import { resolveArgv } from "@govlab/argv";

defineCheck({ detects: [], enforces: ["architecture:platform-independence"] });

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

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

const readAt = function readAt(path: string): string {
    return existsSync(path) ? readFileSync(path, "utf8") : "";
};

const read = function read(file: string): string {
    return readAt(join(root, file));
};

const agendaConfig = absolutePath("app.coordination", "config/agenda.config.ts");

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(readAt(agendaConfig))) {
    findings.push({ file: packagePath(root, agendaConfig), message: SCHEDULED_AGENDA });
}

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