|
| 1 | +# Contributing |
| 2 | + |
| 3 | +This project follows a zero-dependency, config-driven approach. All domain-specific settings live in `project.yml`, and all scripts use only Node.js built-ins. |
| 4 | + |
| 5 | +## Adding Entities |
| 6 | + |
| 7 | +### 1. Create the Markdown File |
| 8 | + |
| 9 | +Create a `.md` file in the appropriate `data/examples/` subdirectory: |
| 10 | + |
| 11 | +| Entity Role | Directory | Example | |
| 12 | +|-------------|-----------|---------| |
| 13 | +| Primary | `data/examples/requirements/` | `data-encryption.md` | |
| 14 | +| Container | `data/examples/frameworks/` | `iso-27001.md` | |
| 15 | +| Authority | `data/examples/organizations/` | `iso.md` | |
| 16 | + |
| 17 | +Directory names are configured in `project.yml` under `entities.<role>.directory`. |
| 18 | + |
| 19 | +### 2. Add YAML Frontmatter |
| 20 | + |
| 21 | +Every entity file starts with YAML frontmatter between `---` delimiters. See existing files for the required fields. At minimum: |
| 22 | + |
| 23 | +**Primary entities:** |
| 24 | +```yaml |
| 25 | +--- |
| 26 | +title: Data Encryption |
| 27 | +group: technical |
| 28 | +last_verified: 2025-01-15 |
| 29 | +--- |
| 30 | +``` |
| 31 | + |
| 32 | +**Container entities:** |
| 33 | +```yaml |
| 34 | +--- |
| 35 | +title: ISO 27001 |
| 36 | +status: active |
| 37 | +authority: iso |
| 38 | +last_verified: 2025-01-15 |
| 39 | +--- |
| 40 | +``` |
| 41 | + |
| 42 | +**Authority entities:** |
| 43 | +```yaml |
| 44 | +--- |
| 45 | +title: International Organization for Standardization |
| 46 | +type: standards-body |
| 47 | +last_verified: 2025-01-15 |
| 48 | +--- |
| 49 | +``` |
| 50 | + |
| 51 | +### 3. Add Mapping Entries |
| 52 | + |
| 53 | +For containers that reference primary entities, add entries to `data/examples/mapping/index.yml` (or the path configured in `project.yml` under `mapping.file`): |
| 54 | + |
| 55 | +```yaml |
| 56 | +- id: provision-id |
| 57 | + regulation: framework-id |
| 58 | + obligations: |
| 59 | + - primary-id-1 |
| 60 | + - primary-id-2 |
| 61 | +``` |
| 62 | +
|
| 63 | +### 4. Validate and Build |
| 64 | +
|
| 65 | +```bash |
| 66 | +# Check cross-references |
| 67 | +node scripts/validate.js |
| 68 | + |
| 69 | +# Check staleness and completeness |
| 70 | +node scripts/verify.js |
| 71 | + |
| 72 | +# Build the site and JSON API |
| 73 | +node scripts/build.js |
| 74 | +``` |
| 75 | + |
| 76 | +Fix any errors reported by `validate.js` before submitting. |
| 77 | + |
| 78 | +## Modifying the Ontology |
| 79 | + |
| 80 | +The entity model is defined in `project.yml` under `entities:`. Each role has: |
| 81 | + |
| 82 | +- `name` — singular display name |
| 83 | +- `plural` — plural display name |
| 84 | +- `directory` — subdirectory under `data/examples/` |
| 85 | +- Role-specific fields (groups, statuses, etc.) |
| 86 | + |
| 87 | +When changing entity names or directories: |
| 88 | +1. Update `project.yml` |
| 89 | +2. Rename the corresponding data directory |
| 90 | +3. Run `validate.js` to confirm references still resolve |
| 91 | +4. Run `build.js` to regenerate the site |
| 92 | + |
| 93 | +## Code Style |
| 94 | + |
| 95 | +- **Zero dependencies.** All scripts use only Node.js built-ins. Do not add npm packages. |
| 96 | +- Use the existing YAML parser (`parseYaml`) rather than importing a YAML library. |
| 97 | +- Keep functions pure where possible. |
| 98 | +- Use `'use strict'` at the top of every script. |
| 99 | + |
| 100 | +## Testing Changes Locally |
| 101 | + |
| 102 | +```bash |
| 103 | +# 1. Validate cross-references |
| 104 | +node scripts/validate.js |
| 105 | + |
| 106 | +# 2. Check entity freshness |
| 107 | +node scripts/verify.js |
| 108 | + |
| 109 | +# 3. Build the site |
| 110 | +node scripts/build.js |
| 111 | + |
| 112 | +# 4. Preview locally (any static file server works) |
| 113 | +npx serve docs |
| 114 | +# or |
| 115 | +python3 -m http.server -d docs 8000 |
| 116 | +``` |
| 117 | + |
| 118 | +Check the generated `docs/` directory for the HTML site and `docs/api/v1/` for the JSON API. |
| 119 | + |
| 120 | +## Pull Request Process |
| 121 | + |
| 122 | +1. Create a feature branch from `main` |
| 123 | +2. Make your changes (add entities, update config, fix bugs) |
| 124 | +3. Run `validate.js` and `verify.js` — ensure no errors |
| 125 | +4. Run `build.js` — ensure it completes without errors |
| 126 | +5. Commit the source files (`data/`, `project.yml`, `scripts/`). Generated output in `docs/` may or may not be committed depending on your deployment strategy. |
| 127 | +6. Open a PR against `main` with a clear description of what changed and why |
| 128 | + |
| 129 | +## Container File Format |
| 130 | + |
| 131 | +Container entity files have a specific structure with a timeline table and provision sections separated by `---`: |
| 132 | + |
| 133 | +```markdown |
| 134 | +--- |
| 135 | +title: Example Framework |
| 136 | +status: active |
| 137 | +authority: org-id |
| 138 | +--- |
| 139 | + |
| 140 | +## Timeline |
| 141 | + |
| 142 | +| Date | Event | |
| 143 | +|------|-------| |
| 144 | +| 2024-01-01 | Published | |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## Provision Name |
| 149 | + |
| 150 | +| Property | Value | |
| 151 | +|----------|-------| |
| 152 | +| Category | example | |
| 153 | + |
| 154 | +### Requirements |
| 155 | + |
| 156 | +| Requirement | Description | |
| 157 | +|-------------|-------------| |
| 158 | +| req-id | Details here | |
| 159 | +``` |
| 160 | + |
| 161 | +See existing container files for complete examples. |
0 commit comments