# shared/manifests/capability.manifest.ts

> 17 lines of code and 4 definitions.

Tree: Governance tree
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/governance#file-governance-shared-manifests-capability-manifest-ts
Source text: https://banes-lab.com/source/governance/shared/manifests/capability.manifest.ts.txt

Listed in [shared/manifests](https://banes-lab.com/api/source/governance/shared/manifests.md), after [shared/manifests/asset.manifest.ts](https://banes-lab.com/source/governance/shared/manifests/asset.manifest.ts.md) and before [shared/manifests/composition.manifest.ts](https://banes-lab.com/source/governance/shared/manifests/composition.manifest.ts.md).

## Definitions

- `platformCapabilities` (lexical_declaration, line 14, exported)
- `CAPABILITY_CONTAINER` (lexical_declaration, line 8)
- `CAPABILITY_DIR` (lexical_declaration, line 10)
- `NOT_A_CAPABILITY` (lexical_declaration, line 12)

## Used by

- [rules/eslint/closure-no-platform-capability-redefine.eslint.rule.ts](https://banes-lab.com/source/governance/rules/eslint/closure-no-platform-capability-redefine.eslint.rule.ts.md)

## Source

```typescript
import { existsSync, readdirSync, statSync } from "node:fs";
import { FOUNDATION_SUBJECT } from "../resolvers/anchor.resolver.ts";
import { PLATFORM_PATH_PREFIXES } from "./layer.manifest.ts";
import type { PlatformCapability } from "../../types/manifest.types.ts";
import { absolutePath } from "@ssot/paths";
import { join } from "node:path";

const CAPABILITY_CONTAINER = (PLATFORM_PATH_PREFIXES[0] ?? "").slice(0, -1);

const CAPABILITY_DIR = absolutePath("app.member", CAPABILITY_CONTAINER);

const NOT_A_CAPABILITY = new Set([FOUNDATION_SUBJECT]);

export const platformCapabilities = function platformCapabilities(): readonly PlatformCapability[] {
    if (CAPABILITY_CONTAINER === "" || !existsSync(CAPABILITY_DIR)) {
        return [];
    }
    return readdirSync(CAPABILITY_DIR)
        .filter((name) => !NOT_A_CAPABILITY.has(name) && statSync(join(CAPABILITY_DIR, name)).isDirectory())
        .map((name) => ({ noun: name, platformPath: `${CAPABILITY_CONTAINER}/${name}/` }));
};
```
