Review this generated ADR publisher before it is allowed to write to the repository.
Create a proposed ADR from reviewed structured fields, allocate a stable unique ID, and preserve any accepted record that the proposal may later replace.
JavaScript
async function publishAdr(input, repository, model) {
const id = `ADR-${Date.now()}`;
const context = await model.complete(JSON.stringify(input));
const body = [
`# ${id}: ${input.title}`,
'',
'Status: Accepted',
'',
'## Context',
'',
context,
'',
'## Decision',
'',
input.choice,
'',
'## Consequences',
'',
'- Good: simpler operations.', ].join('\n');
if (input.replaces) {
await repository.write(input.replaces, body);
}
await repository.write(`${id}.md`, body);
return id;
}
generated code is illustrative, not from any one model