@nikovirtala/adr 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -9
- package/dist/cli.js +47 -16
- package/dist/cli.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/{init-YgW7g9Fx.js → init-CaKKCINh.js} +79 -16
- package/dist/init-CaKKCINh.js.map +1 -0
- package/dist/{kind-DjvA3dyA.js → kind-C3DiBuUp.js} +44 -11
- package/dist/kind-C3DiBuUp.js.map +1 -0
- package/dist/kind.js +1 -1
- package/dist/{list-Dt4KGxvj.js → list-CJi9vZqJ.js} +3 -3
- package/dist/{list-Dt4KGxvj.js.map → list-CJi9vZqJ.js.map} +1 -1
- package/dist/{search-CwIPlNGd.js → search-CTspg2pd.js} +290 -88
- package/dist/search-CTspg2pd.js.map +1 -0
- package/dist/{server-CXCO5zfp.js → server-D3ySzyj6.js} +20 -8
- package/dist/server-D3ySzyj6.js.map +1 -0
- package/dist/types/cli/list.d.ts +4 -1
- package/dist/types/cli/search.d.ts +4 -1
- package/dist/types/commit-actions.d.ts +21 -1
- package/dist/types/hooks.d.ts +3 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/kind/rules.d.ts +23 -2
- package/dist/types/kind.d.ts +1 -1
- package/dist/types/log-index.d.ts +0 -18
- package/dist/types/log.d.ts +6 -3
- package/dist/types/search.d.ts +2 -0
- package/dist/types/sources.d.ts +35 -0
- package/dist/types/verify.d.ts +20 -4
- package/dist/types/views.d.ts +2 -0
- package/dist/types/write.d.ts +37 -4
- package/package.json +2 -2
- package/dist/init-YgW7g9Fx.js.map +0 -1
- package/dist/kind-DjvA3dyA.js.map +0 -1
- package/dist/search-CwIPlNGd.js.map +0 -1
- package/dist/server-CXCO5zfp.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as DECISION_STATUSES, t as adrKind } from "./kind-
|
|
3
|
-
import { t as listTemplates } from "./list-
|
|
1
|
+
import { F as resolveDecision, M as openDecisionLog, N as readDecisions, S as DECISION_INDEX, _ as withdrawDecision, a as stateHeader, d as proposeDecision, f as rejectDecision, g as updateDraft, h as supersedeDecision, i as showDecision, l as linkDecision, n as decisionsFor, o as acceptDecision, p as scopeDecision, r as listDecisions, s as deprecateDecision, t as searchDecisions, u as noteDecision, x as readSourceDecisions } from "./search-CTspg2pd.js";
|
|
2
|
+
import { n as DECISION_STATUSES, t as adrKind } from "./kind-C3DiBuUp.js";
|
|
3
|
+
import { t as listTemplates } from "./list-CJi9vZqJ.js";
|
|
4
4
|
import { MAX_GLOB_LENGTH, UsageError, eventDir, parseOnBehalfOf, renderIndex, renderStateHeader, resolveSubjectInput } from "@nikovirtala/ledger";
|
|
5
5
|
import { mcpAttribution, serveMcp } from "@nikovirtala/ledger/mcp";
|
|
6
6
|
// src/mcp/policy.ts
|
|
@@ -423,6 +423,16 @@ function policyRefusal(log, read, tool, id, attribution) {
|
|
|
423
423
|
notes: [...log.notes, ...attribution.notes]
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
|
+
/** The `source` input of `adr_list` and `adr_search`: a `[[sources]]` name, read from the cache. */
|
|
427
|
+
const SOURCE = {
|
|
428
|
+
type: "string",
|
|
429
|
+
pattern: "^[a-z][a-z0-9-]{0,31}$"
|
|
430
|
+
};
|
|
431
|
+
/** The local log, or with `source` that `[[sources]]` entry's cached log. */
|
|
432
|
+
async function readFor(e, source) {
|
|
433
|
+
const log = await openLog(e);
|
|
434
|
+
return source === null ? readDecisions(log) : readSourceDecisions(log, source);
|
|
435
|
+
}
|
|
426
436
|
/** The eleven tools `adr mcp` always lists (design §7.4). */
|
|
427
437
|
function alwaysOnTools(e) {
|
|
428
438
|
return [
|
|
@@ -441,11 +451,12 @@ function alwaysOnTools(e) {
|
|
|
441
451
|
type: "integer",
|
|
442
452
|
minimum: 1,
|
|
443
453
|
maximum: 100
|
|
444
|
-
}
|
|
454
|
+
},
|
|
455
|
+
source: SOURCE
|
|
445
456
|
}, ["query"]),
|
|
446
457
|
annotations: READ,
|
|
447
458
|
async run(input) {
|
|
448
|
-
const read = await
|
|
459
|
+
const read = await readFor(e, str(input.source) ?? null);
|
|
449
460
|
const d = searchDecisions(read, {
|
|
450
461
|
query: str(input.query) ?? "",
|
|
451
462
|
includeInactive: input.include_inactive === true,
|
|
@@ -500,11 +511,12 @@ function alwaysOnTools(e) {
|
|
|
500
511
|
type: "integer",
|
|
501
512
|
minimum: 1,
|
|
502
513
|
maximum: 1e3
|
|
503
|
-
}
|
|
514
|
+
},
|
|
515
|
+
source: SOURCE
|
|
504
516
|
}),
|
|
505
517
|
annotations: READ,
|
|
506
518
|
async run(input) {
|
|
507
|
-
const read = await
|
|
519
|
+
const read = await readFor(e, str(input.source) ?? null);
|
|
508
520
|
const status = strings(input.status);
|
|
509
521
|
const d = listDecisions(read, {
|
|
510
522
|
...status === void 0 ? {} : { status },
|
|
@@ -935,4 +947,4 @@ async function serveAdrMcp(o) {
|
|
|
935
947
|
}
|
|
936
948
|
export { serveAdrMcp };
|
|
937
949
|
|
|
938
|
-
//# sourceMappingURL=server-
|
|
950
|
+
//# sourceMappingURL=server-D3ySzyj6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-D3ySzyj6.js","names":[],"sources":["../src/mcp/policy.ts","../src/mcp/resources.ts","../src/mcp/text.ts","../src/mcp/tools.ts","../src/mcp/prompt.ts","../src/mcp/server.ts"],"sourcesContent":["import type { Actor, Finding } from \"@nikovirtala/ledger\";\nimport type { AdrConfig } from \"../config.js\";\nimport { adrKind, type DecisionView } from \"../kind.js\";\nimport type { DecisionsRead } from \"../log.js\";\n\n/** The tools that decide; listed only with `[policy] mcp_can_decide = true`. */\nexport const DECISION_TOOLS = [\n \"adr_accept\",\n \"adr_reject\",\n \"adr_deprecate\",\n \"adr_supersede\",\n] as const;\n\n/** Whether `adr mcp` offers the decision tools (design §7.5, Table A). */\nexport function decisionToolsAvailable(adr: AdrConfig): boolean {\n return adr.mcpCanDecide;\n}\n\n/**\n * Who a proposal is for (design D5): its `proposed` event's actor, `on_behalf_of` for an agent\n * and `email` for a human, lower-cased; `null` when the event or the address is missing.\n */\nexport function proposalOwner(read: DecisionsRead, id: string): string | null {\n const proposed = read.folded.subjects\n .get(id)\n ?.applied.find((a) => a.event.type === adrKind.machine.initial.type);\n const actor = proposed?.event.actor;\n if (actor === undefined) return null;\n const owner = actor.kind === \"agent\" ? actor.on_behalf_of : actor.email;\n return typeof owner === \"string\" && owner.trim() !== \"\" ? owner.trim().toLowerCase() : null;\n}\n\n/** The writes `mcpWriteRefusal` judges: the ones whose ownership matters. */\nexport type PolicyTool = \"adr_scope\" | \"adr_update_draft\" | \"adr_withdraw\";\n\n/**\n * The MCP policy (design §7.5, Table B): `null` when the write may go ahead, else the\n * `decision/mcp-cannot-decide` finding. Without `mcp_can_decide` an agent may scope, edit and\n * withdraw only the proposals made for the person it acts for, and rescope no accepted or\n * deprecated decision.\n * Writes the state machine forbids anyway get `null`, so the library refuses them with the real\n * reason.\n */\nexport function mcpWriteRefusal(o: {\n readonly tool: PolicyTool;\n readonly view: DecisionView;\n readonly owner: string | null;\n readonly actor: Actor;\n readonly mcpCanDecide: boolean;\n readonly display: (id: string) => string;\n /** The finding's file when the decision has no body: its events directory. */\n readonly eventsDir: string;\n}): Finding | null {\n const { view } = o;\n if (o.tool === \"adr_scope\" && !adrKind.machine.allowed(view.status, \"scoped\")) return null;\n if (o.tool === \"adr_update_draft\" && view.status !== \"proposed\") return null;\n if (o.tool === \"adr_withdraw\" && !adrKind.machine.allowed(view.status, \"withdrawn\")) return null;\n if (o.mcpCanDecide) return null;\n const me = o.actor.on_behalf_of?.trim().toLowerCase() ?? null;\n if (view.status === \"proposed\" && o.owner !== null && o.owner === me) return null;\n const shown = o.display(view.id);\n const named = shown === view.id ? view.id : `${shown} (${view.id})`;\n const verb = o.tool === \"adr_withdraw\" ? \"withdrawing\" : \"changing\";\n const message =\n view.status === \"proposed\"\n ? `${named} was proposed for ${o.owner ?? \"someone else\"}, and you act for ${o.actor.on_behalf_of ?? \"nobody\"}; ${verb} another person's proposal needs [policy] mcp_can_decide = true. Add a note with adr_note instead.`\n : `${named} is ${view.status}; rescoping it needs [policy] mcp_can_decide = true, because narrowing a scope can switch a decision off. Ask a human to run adr scope ${shown} …, or propose a superseding decision.`;\n return {\n severity: \"error\",\n rule: \"decision/mcp-cannot-decide\",\n message,\n file: view.body_path ?? o.eventsDir,\n line: null,\n subject: view.id,\n kind: adrKind.name,\n };\n}\n","import { renderIndex, resolveSubjectInput, UsageError } from \"@nikovirtala/ledger\";\nimport type { McpResource, McpResourceTemplate } from \"@nikovirtala/ledger/mcp\";\nimport { adrKind } from \"../kind.js\";\nimport { type DecisionsRead, readDecisions, resolveDecision } from \"../log.js\";\nimport { DECISION_INDEX } from \"../log-index.js\";\nimport { showDecision } from \"../views.js\";\nimport { mcpHeader } from \"./text.js\";\nimport { type AdrMcpEnv, openLog } from \"./tools.js\";\n\nconst MAX_ID = 64;\n\n/**\n * Where an MCP client reads a decision: `adr://decision/ADR-0012` when numbered, else\n * `adr://decision/<id>`. The `refer` of every header the MCP texts show.\n */\nexport function decisionUri(read: DecisionsRead): (id: string) => string {\n return (id) => `adr://decision/${read.projection.views.get(id)?.display ?? id}`;\n}\n\n/** `adr://index`: the index table, numbered like every other read (design §7.7). */\nexport function indexResource(e: AdrMcpEnv): McpResource {\n return {\n uri: \"adr://index\",\n name: \"index\",\n title: \"Decision index\",\n description: \"All decisions, grouped by status, with numbers and dates\",\n mimeType: \"text/markdown\",\n async read() {\n const read = await readDecisions(await openLog(e));\n const views = read.projection.views;\n return {\n header: null,\n text: renderIndex(DECISION_INDEX(read.root, views), [...views.values()], read.numbering),\n };\n },\n };\n}\n\n/**\n * `adr://decision/{id}`: the decision's state header, then its body. `{id}` is the id, the number\n * (`12`, `0012`) or `ADR-0012`; an unknown one is not found, a malformed or qualified one is the\n * caller's error.\n */\nexport function decisionResource(e: AdrMcpEnv): McpResourceTemplate {\n return {\n uriTemplate: \"adr://decision/{id}\",\n name: \"decision\",\n title: \"Decision\",\n description:\n \"One decision: its state header, then its body. {id} is the id (k3f9q8a1), the number (12) or ADR-0012\",\n mimeType: \"text/markdown\",\n async read({ id = \"\" }) {\n if (id.length > MAX_ID) {\n throw new UsageError(\n `invalid decision ${JSON.stringify(`${id.slice(0, MAX_ID)}…`)}: an id or number is at most ${MAX_ID} characters`,\n );\n }\n const read = await readDecisions(await openLog(e));\n const r = resolveSubjectInput(id, {\n subjects: new Set(read.folded.subjects.keys()),\n kind: adrKind,\n numbering: read.numbering,\n });\n if (!r.ok && r.reason === \"not-found\") return null;\n const doc = await showDecision(read, resolveDecision(read, id));\n return {\n header: mcpHeader(doc.decision, read),\n text: doc.body === null ? \"(no body file)\\n\" : doc.body,\n };\n },\n };\n}\n","/**\n * The readable text of each MCP tool result (design §7.4, last column). The documents are the\n * CLI's; these texts are MCP's own, and their state headers point at `adr://decision/…`.\n */\nimport {\n type EventEnvelope,\n type Finding,\n renderStateHeader,\n type StateHeader,\n} from \"@nikovirtala/ledger\";\nimport type { McpToolResult } from \"@nikovirtala/ledger/mcp\";\nimport type { DecisionView } from \"../kind.js\";\nimport type { DecisionsRead } from \"../log.js\";\nimport type { DecisionsForJson } from \"../scope.js\";\nimport type { DecisionSearchJson } from \"../search.js\";\nimport type { TemplatesJson } from \"../templates/list.js\";\nimport { type DecisionListJson, type DecisionShowJson, stateHeader } from \"../views.js\";\nimport type { WriteResultJson } from \"../write.js\";\nimport { decisionUri } from \"./resources.js\";\n\ntype Text = Omit<McpToolResult, \"document\">;\n\nconst display = (read: DecisionsRead) => (id: string) =>\n read.projection.views.get(id)?.display ?? id;\n\nfunction named(read: DecisionsRead, id: string): string {\n const shown = display(read)(id);\n return shown === id ? id : `${shown} (${id})`;\n}\n\n/** The decision's state header with MCP's `adr://` references. */\nexport function mcpHeader(view: DecisionView, read: DecisionsRead): StateHeader {\n return stateHeader(view, read, { refer: decisionUri(read) });\n}\n\n/** `adr_search`: each result's header, title and excerpt, then the counts. */\nexport function searchText(doc: DecisionSearchJson, read: DecisionsRead): Text {\n if (doc.results.length === 0) {\n const more =\n doc.inactive_omitted > 0\n ? [`${inactiveLine(doc.inactive_omitted)}; pass include_inactive`]\n : [];\n return { headers: [], text: [\"No decisions match.\", ...more].join(\"\\n\") };\n }\n const lines: string[] = [];\n for (const r of doc.results) {\n lines.push(renderStateHeader(mcpHeader(r.decision, read)).trimEnd());\n lines.push(` ${r.decision.title}`);\n const where = r.matched.filter((f) => f === \"id\" || f === \"title\").join(\" and \");\n lines.push(r.excerpt === null ? ` (${where} match)` : ` ${r.excerpt}`);\n }\n lines.push(`${doc.results.length} of ${doc.total} shown`);\n if (doc.inactive_omitted > 0) {\n lines.push(`${inactiveLine(doc.inactive_omitted)}; pass include_inactive`);\n }\n return { headers: [], text: lines.join(\"\\n\") };\n}\n\nconst inactiveLine = (k: number) =>\n k === 1 ? \"1 inactive decision also matches\" : `${k} inactive decisions also match`;\n\nfunction listOf(read: DecisionsRead, ids: readonly string[]): string {\n return ids.length === 0 ? \"none\" : ids.map((id) => named(read, id)).join(\", \");\n}\n\nfunction historyLines(events: readonly EventEnvelope[]): string[] {\n return events.map((e) => {\n const a = e.actor;\n const who = a.kind === \"agent\" ? `${a.name} (agent for ${a.on_behalf_of})` : a.name;\n const why = typeof e.reason === \"string\" ? ` — ${e.reason}` : \"\";\n return ` ${e.at} ${e.type} ${who}${why}`;\n });\n}\n\n/** `adr_get`: the header, the decision's fields as `adr show` lists them, then the body. */\nexport function getText(doc: DecisionShowJson, read: DecisionsRead): Text {\n const v = doc.decision;\n const lines = [\n `Title: ${v.title}`,\n `Status: ${v.status} (${v.status_at.slice(0, 10)})`,\n `Effective: ${v.effective === null ? \"none (supersession cycle)\" : named(read, v.effective)}`,\n `Chain: ${v.chain.map(display(read)).join(\" → \")}`,\n `Supersedes: ${listOf(read, v.supersedes)}`,\n `Applies to: ${v.applies_to.length === 0 ? \"no globs recorded\" : v.applies_to.join(\", \")}`,\n ];\n if (doc.events !== null) lines.push(\"History:\", ...historyLines(doc.events));\n lines.push(\"\", doc.body === null ? \"(no body file)\" : doc.body.trimEnd());\n return { headers: [mcpHeader(v, read)], text: lines.join(\"\\n\") };\n}\n\n/** `adr_list`: one line per decision. */\nexport function listText(doc: DecisionListJson, read: DecisionsRead): Text {\n if (doc.decisions.length === 0) return { headers: [], text: \"No decisions.\" };\n const lines = doc.decisions.map((v) => {\n const head = v.number === null ? v.id : `${v.display} (${v.id})`;\n const to =\n v.effective !== null && v.effective !== v.id ? ` → ${display(read)(v.effective)}` : \"\";\n return `${head} · ${v.status} · ${v.title}${to}`;\n });\n return { headers: [], text: lines.join(\"\\n\") };\n}\n\n/** `adr_templates`: each template, then its sections. */\nexport function templatesText(doc: TemplatesJson): Text {\n const lines = doc.templates.flatMap((t) => [\n `${t.name} v${t.version} (${t.source})${t.name === doc.default ? \" default\" : \"\"}`,\n ...t.sections.map(\n (s) =>\n ` ${s.id}: ${s.heading} (${s.required ? \"required\" : \"optional\"})${s.guidance === null ? \"\" : ` — ${s.guidance}`}`,\n ),\n ]);\n return { headers: [], text: lines.length === 0 ? \"No templates.\" : lines.join(\"\\n\") };\n}\n\n/** `adr_for_path`: per path, each decision's header and how it matched. */\nexport function forText(doc: DecisionsForJson, read: DecisionsRead): Text {\n const lines: string[] = [];\n for (const p of doc.paths) {\n lines.push(p.tracked ? p.path : `${p.path} (not tracked)`);\n if (p.decisions.length === 0 && p.unresolved.length === 0) lines.push(\" no decisions\");\n for (const d of p.decisions) {\n const view = read.projection.views.get(d.id);\n const h =\n view === undefined\n ? { line: `${named(read, d.id)} · ${d.status}`, warning: d.warning }\n : mcpHeader(view, read);\n lines.push(` ${h.line}`);\n if (h.warning !== null) lines.push(` ${h.warning}`);\n for (const via of d.via) {\n lines.push(\n via.type === \"glob\" ? ` via glob ${via.glob}` : ` via anchor line ${via.line}`,\n );\n }\n }\n for (const u of p.unresolved) {\n const why = u.reason === \"other-log\" ? \"in another log\" : \"not in this log\";\n lines.push(` unresolved: ${u.ref} (line ${u.line}, ${why})`);\n }\n }\n return { headers: [], text: lines.join(\"\\n\") };\n}\n\nconst SECTION_FINDING =\n /^(?:required )?section (.+?) (is missing|is empty|still contains its guidance text)$/;\nconst REASONS: Readonly<Record<string, string>> = {\n \"is missing\": \"missing\",\n \"is empty\": \"empty\",\n \"still contains its guidance text\": \"guidance\",\n};\n\n/** Lint findings as `Fill in: <heading> (<reason>)`, others as `Draft: <message> [<rule>]`. */\nfunction lintLines(findings: readonly Finding[]): string[] {\n return findings.map((f) => {\n const m = SECTION_FINDING.exec(f.message);\n if (m === null) return `Draft: ${f.message} [${f.rule}]`;\n const [, heading = \"\", what = \"\"] = m;\n return `Fill in: ${heading} (${REASONS[what] ?? what})`;\n });\n}\n\nconst noteLines = (doc: WriteResultJson) => doc.notes.map((n) => `Note: ${n}`);\n\n/** What a write's text needs besides the document. */\nexport interface WriteTextOptions {\n /** The log read after the write, for the headers and how decisions display. */\n readonly read: DecisionsRead;\n /** For `adr_propose`: whether a human must accept. */\n readonly acceptRequiresHuman?: boolean;\n /** For `adr_scope`: the globs before the write. */\n readonly scopeBefore?: readonly string[];\n /** For `adr_update_draft`: the section ids sent. */\n readonly sections?: readonly string[];\n /** The tool, for the refusal's last line. */\n readonly tool: string;\n}\n\n/** A write's text: `Refused:` and the findings, or what was written; then the notes. */\nexport function writeText(doc: WriteResultJson, o: WriteTextOptions): Text {\n const { read } = o;\n const view =\n doc.decision === null ? null : (read.projection.views.get(doc.decision.id) ?? doc.decision);\n const headers = view === null ? [] : [mcpHeader(view, read), ...affectedHeaders(doc, read)];\n if (!doc.ok) {\n const lint =\n doc.findings.length > 0 && doc.findings.every((f) => f.rule.startsWith(\"template/\"));\n const again =\n lint && (o.tool === \"adr_propose\" || o.tool === \"adr_update_draft\")\n ? [`Fill in every required section and call ${o.tool} again.`]\n : [];\n const lines = [\n \"Refused:\",\n ...doc.findings.map(\n (f) => ` ${f.file === null ? \"\" : `${f.file}: `}${f.message} [${f.rule}]`,\n ),\n ...again,\n ...noteLines(doc),\n ];\n return { headers, text: lines.join(\"\\n\") };\n }\n if (view === null) return { headers, text: noteLines(doc).join(\"\\n\") };\n const lines = bodyLines(doc, view, o);\n return { headers, text: [...lines, ...noteLines(doc)].join(\"\\n\") };\n}\n\nfunction bodyLines(doc: WriteResultJson, v: DecisionView, o: WriteTextOptions): string[] {\n const { read } = o;\n const who = named(read, v.id);\n const recorded = doc.commit === null ? [] : [`Committed ${doc.commit.slice(0, 7)}.`];\n switch (doc.command) {\n case \"new\":\n return [\n `Proposed ${v.id}: ${v.title}`,\n ...(v.body_path === null ? [] : [` ${v.body_path}`]),\n ...lintLines(doc.findings),\n ...recorded,\n o.acceptRequiresHuman === true\n ? `Next: ask a human to review and accept it (adr accept ${v.id})`\n : `Next: adr_accept or adr accept ${v.id}`,\n ];\n case \"update\":\n return doc.written.length === 0\n ? [\"Unchanged\"]\n : [\n `Updated the draft of ${who}: ${(o.sections ?? []).join(\", \")}`,\n ...lintLines(doc.findings),\n ...recorded,\n ];\n case \"note\":\n return [`Noted on ${who}`, ...recorded];\n case \"link\": {\n const link = doc.written.length === 0 ? undefined : v.links.at(-1);\n if (link === undefined) return [`Links of ${who} unchanged`];\n return [`Linked ${who} ${link.rel} ${named(read, link.to)}`, ...recorded];\n }\n case \"scope\": {\n const before = new Set(o.scopeBefore ?? []);\n const after = new Set(v.applies_to);\n if (doc.written.length === 0) return [\"unchanged\"];\n return [\n ...v.applies_to.filter((g) => !before.has(g)).map((g) => `+ ${g}`),\n ...[...before].filter((g) => !after.has(g)).map((g) => `- ${g}`),\n `= ${v.applies_to.length === 0 ? \"no globs\" : v.applies_to.join(\", \")}`,\n ...recorded,\n ];\n }\n case \"accept\":\n return [\n `Accepted ${who}: ${v.title}`,\n ...doc.affected.map((a) => `Superseded ${named(read, a.id)}: ${a.title}`),\n ...recorded,\n ];\n case \"reject\":\n return [`Rejected ${who}`, ...recorded];\n case \"withdraw\":\n return [`Withdrawn ${who}`, ...recorded];\n case \"deprecate\":\n return [`Deprecated ${who}`, ...recorded];\n case \"supersede\":\n return [`Superseded ${who} by ${named(read, v.superseded_by ?? \"\")}`, ...recorded];\n default:\n return [`${doc.command} ${who}`, ...recorded];\n }\n}\n\n/** The headers of the decisions a write affected (superseded), other than its own. */\nfunction affectedHeaders(doc: WriteResultJson, read: DecisionsRead): StateHeader[] {\n return doc.affected\n .filter((a) => a.id !== doc.decision?.id)\n .map((a) => mcpHeader(read.projection.views.get(a.id) ?? a, read));\n}\n","import {\n type Attribution,\n eventDir,\n type JsonValue,\n MAX_GLOB_LENGTH,\n UsageError,\n} from \"@nikovirtala/ledger\";\nimport { type McpTool, type McpToolResult, mcpAttribution } from \"@nikovirtala/ledger/mcp\";\nimport { DECISION_STATUSES, type DecisionStatus } from \"../kind.js\";\nimport {\n type DecisionLog,\n type DecisionsRead,\n openDecisionLog,\n readDecisions,\n resolveDecision,\n} from \"../log.js\";\nimport { decisionsFor } from \"../scope.js\";\nimport { searchDecisions } from \"../search.js\";\nimport { readSourceDecisions } from \"../sources.js\";\nimport { listTemplates } from \"../templates/list.js\";\nimport { listDecisions, showDecision } from \"../views.js\";\nimport {\n acceptDecision,\n deprecateDecision,\n linkDecision,\n noteDecision,\n proposeDecision,\n rejectDecision,\n scopeDecision,\n supersedeDecision,\n updateDraft,\n type WriteResultJson,\n withdrawDecision,\n} from \"../write.js\";\nimport { mcpWriteRefusal, type PolicyTool, proposalOwner } from \"./policy.js\";\nimport {\n forText,\n getText,\n listText,\n searchText,\n templatesText,\n type WriteTextOptions,\n writeText,\n} from \"./text.js\";\n\n/** Where `adr mcp` runs: every call opens the log afresh from here (design D2). */\nexport interface AdrMcpEnv {\n readonly cwd: string;\n readonly root: string | null;\n readonly env: NodeJS.ProcessEnv;\n}\n\ntype Schema = Readonly<Record<string, JsonValue>>;\n\nexport const ID: Schema = { type: \"string\", minLength: 1, maxLength: 64 };\nconst TEXT: Schema = { type: \"string\", minLength: 1, maxLength: 65_536 };\nconst SECTIONS: Schema = {\n type: \"object\",\n propertyNames: { type: \"string\", pattern: \"^[a-z][a-z0-9-]*$\", maxLength: 64 },\n additionalProperties: { type: \"string\", maxLength: 65_536 },\n maxProperties: 50,\n};\nconst GLOBS: Schema = {\n type: \"array\",\n items: { type: \"string\", minLength: 1, maxLength: MAX_GLOB_LENGTH },\n maxItems: 200,\n};\n\nconst object = (properties: Record<string, Schema>, required: string[] = []): Schema => ({\n type: \"object\",\n properties,\n ...(required.length === 0 ? {} : { required }),\n additionalProperties: false,\n});\n\nexport const READ = { readOnlyHint: true, openWorldHint: false } as const;\nexport const WRITE = { readOnlyHint: false, destructiveHint: false, openWorldHint: false } as const;\n\n/** The log for one call, opened again so outside edits and `[policy]` changes are seen. */\nexport const openLog = (e: AdrMcpEnv, ref: string | null = null): Promise<DecisionLog> =>\n openDecisionLog({ cwd: e.cwd, root: e.root, ref, gitOptions: { env: e.env } });\n\nconst str = (v: JsonValue | undefined): string | undefined =>\n typeof v === \"string\" ? v : undefined;\nconst strings = (v: JsonValue | undefined): string[] | undefined =>\n Array.isArray(v) ? v.filter((x): x is string => typeof x === \"string\") : undefined;\nconst sectionsOf = (v: JsonValue | undefined): Record<string, string> =>\n typeof v === \"object\" && v !== null && !Array.isArray(v)\n ? Object.fromEntries(\n Object.entries(v).flatMap(([k, x]) => (typeof x === \"string\" ? [[k, x]] : [])),\n )\n : {};\n\nconst doc = (d: unknown): JsonValue => d as JsonValue;\n\n/**\n * A write tool's result: the library's document, and its text rendered from a read of the log\n * after the write.\n */\nasync function writeResult(\n log: DecisionLog,\n d: WriteResultJson,\n o: Omit<WriteTextOptions, \"read\">,\n): Promise<McpToolResult> {\n const read = await readDecisions(log);\n return { document: doc(d), ...writeText(d, { ...o, read }) };\n}\n\n/** The `adr-write/v1` command of each policy tool, as the CLI names it. */\nconst COMMAND: Record<PolicyTool, WriteResultJson[\"command\"]> = {\n adr_scope: \"scope\",\n adr_update_draft: \"update\",\n adr_withdraw: \"withdraw\",\n};\n\n/**\n * The MCP policy step of `adr_scope`, `adr_update_draft` and `adr_withdraw` (design §7.5): the refusal document\n * when the agent may not make this write, else `null`.\n */\nfunction policyRefusal(\n log: DecisionLog,\n read: DecisionsRead,\n tool: PolicyTool,\n id: string,\n attribution: Attribution,\n): WriteResultJson | null {\n const view = read.projection.views.get(id);\n if (view === undefined) return null;\n const finding = mcpWriteRefusal({\n tool,\n view,\n owner: proposalOwner(read, id),\n actor: attribution.actor,\n mcpCanDecide: log.adr.mcpCanDecide,\n display: (x) => read.projection.views.get(x)?.display ?? x,\n eventsDir: eventDir(read.layout, id),\n });\n if (finding === null) return null;\n return {\n format: \"adr-write/v1\",\n command: COMMAND[tool],\n ok: false,\n decision: view,\n affected: [],\n written: [],\n commit: null,\n findings: [finding],\n notes: [...log.notes, ...attribution.notes],\n };\n}\n\n/** The `source` input of `adr_list` and `adr_search`: a `[[sources]]` name, read from the cache. */\nconst SOURCE = { type: \"string\", pattern: \"^[a-z][a-z0-9-]{0,31}$\" } as const;\n\n/** The local log, or with `source` that `[[sources]]` entry's cached log. */\nasync function readFor(e: AdrMcpEnv, source: string | null) {\n const log = await openLog(e);\n return source === null ? readDecisions(log) : readSourceDecisions(log, source);\n}\n\n/** The eleven tools `adr mcp` always lists (design §7.4). */\nexport function alwaysOnTools(e: AdrMcpEnv): McpTool[] {\n return [\n {\n name: \"adr_search\",\n title: \"Search decisions\",\n description:\n \"Full-text search of the decision log: every word must appear in a decision's id, title, body or notes. Returns active (proposed or accepted) decisions unless include_inactive is true, each with its state header and an excerpt.\",\n inputSchema: object(\n {\n query: { type: \"string\", minLength: 1, maxLength: 200 },\n include_inactive: { type: \"boolean\" },\n limit: { type: \"integer\", minimum: 1, maximum: 100 },\n source: SOURCE,\n },\n [\"query\"],\n ),\n annotations: READ,\n async run(input) {\n const read = await readFor(e, str(input.source) ?? null);\n const d = searchDecisions(read, {\n query: str(input.query) ?? \"\",\n includeInactive: input.include_inactive === true,\n limit: typeof input.limit === \"number\" ? input.limit : 10,\n });\n return { document: doc(d), ...searchText(d, read) };\n },\n },\n {\n name: \"adr_get\",\n title: \"Get a decision\",\n description:\n \"One decision with its state header, computed status, supersession chain, effective decision and body. Use this or adr://decision/{id} instead of reading files under docs/adr. A SUPERSEDED or DEPRECATED header means: don't apply it, follow the warning.\",\n inputSchema: object(\n {\n id: ID,\n include_history: { type: \"boolean\" },\n ref: { type: \"string\", minLength: 1, maxLength: 256 },\n },\n [\"id\"],\n ),\n annotations: READ,\n async run(input) {\n const read = await readDecisions(await openLog(e, str(input.ref) ?? null));\n const id = resolveDecision(read, str(input.id) ?? \"\");\n const d = await showDecision(read, id, { history: input.include_history === true });\n return { document: doc(d), ...getText(d, read) };\n },\n },\n {\n name: \"adr_list\",\n title: \"List decisions\",\n description:\n \"All decisions with their computed status, for orientation. Filter by status; limit truncates.\",\n inputSchema: object({\n status: {\n type: \"array\",\n items: { type: \"string\", enum: [...DECISION_STATUSES] },\n uniqueItems: true,\n minItems: 1,\n maxItems: DECISION_STATUSES.length,\n },\n limit: { type: \"integer\", minimum: 1, maximum: 1000 },\n source: SOURCE,\n }),\n annotations: READ,\n async run(input) {\n const read = await readFor(e, str(input.source) ?? null);\n const status = strings(input.status) as DecisionStatus[] | undefined;\n const d = listDecisions(read, {\n ...(status === undefined ? {} : { status }),\n ...(typeof input.limit === \"number\" ? { limit: input.limit } : {}),\n });\n return { document: doc(d), ...listText(d, read) };\n },\n },\n {\n name: \"adr_templates\",\n title: \"List templates\",\n description:\n \"The templates adr_propose can use, with each section's id, heading, whether it is required, and guidance for filling it in.\",\n inputSchema: object({}),\n annotations: READ,\n async run() {\n const d = await listTemplates(await readDecisions(await openLog(e)));\n return { document: doc(d), ...templatesText(d) };\n },\n },\n {\n name: \"adr_propose\",\n title: \"Propose a decision\",\n description:\n \"Propose a decision: give the title and a sections map (section id → markdown) for the template; the tool renders and stages the draft. Lint findings come back in findings: fix them with adr_update_draft. With auto_commit on, an incomplete draft is refused; send every required section. You can't accept your own proposal; tell the user its id.\",\n inputSchema: object(\n {\n title: { type: \"string\", minLength: 1, maxLength: 200 },\n template: { type: \"string\", pattern: \"^[a-z][a-z0-9-]*$\", maxLength: 64 },\n sections: SECTIONS,\n supersedes: { type: \"array\", items: ID, maxItems: 20 },\n },\n [\"title\"],\n ),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await openLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const template = str(input.template);\n const supersedes = strings(input.supersedes);\n const d = await proposeDecision(\n log,\n {\n title: str(input.title) ?? \"\",\n sections: sectionsOf(input.sections),\n actor,\n ...(template === undefined ? {} : { template }),\n ...(supersedes === undefined ? {} : { supersedes }),\n },\n { notes },\n );\n return writeResult(log, d, {\n tool: \"adr_propose\",\n acceptRequiresHuman: log.adr.acceptRequiresHuman,\n });\n },\n },\n {\n name: \"adr_update_draft\",\n title: \"Update a draft\",\n description:\n \"Replace sections of a proposed decision's draft (section id → markdown). Only your own proposals unless mcp_can_decide is on. Returns the lint result. With auto_commit on, an incomplete draft is refused; send every required section.\",\n inputSchema: object({ id: ID, sections: { ...SECTIONS, minProperties: 1 } }, [\n \"id\",\n \"sections\",\n ]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await openLog(e);\n const read = await readDecisions(log);\n const id = resolveDecision(read, str(input.id) ?? \"\");\n const attribution = await mcpAttribution(log.git, ctx);\n const sections = sectionsOf(input.sections);\n const o = { tool: \"adr_update_draft\", sections: Object.keys(sections) };\n const refused = policyRefusal(log, read, \"adr_update_draft\", id, attribution);\n if (refused !== null) return writeResult(log, refused, o);\n const d = await updateDraft(log, { id, sections }, { notes: attribution.notes });\n return writeResult(log, d, o);\n },\n },\n {\n name: \"adr_note\",\n title: \"Note on a decision\",\n description:\n \"Add a note to a decision in any state. Notes clarify; a changed decision needs a superseding proposal.\",\n inputSchema: object({ id: ID, text: TEXT }, [\"id\", \"text\"]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await openLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const d = await noteDecision(\n log,\n { id: str(input.id) ?? \"\", text: str(input.text) ?? \"\", actor },\n { notes },\n );\n return writeResult(log, d, { tool: \"adr_note\" });\n },\n },\n {\n name: \"adr_link\",\n title: \"Link decisions\",\n description:\n \"Record a relation (relates-to, refines, depends-on) from one decision to another.\",\n inputSchema: object(\n {\n id: ID,\n to: { type: \"string\", minLength: 1, maxLength: 100 },\n rel: { type: \"string\", enum: [\"relates-to\", \"refines\", \"depends-on\"] },\n },\n [\"id\", \"to\"],\n ),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await openLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const rel = str(input.rel);\n const d = await linkDecision(\n log,\n {\n id: str(input.id) ?? \"\",\n to: str(input.to) ?? \"\",\n actor,\n ...(rel === undefined ? {} : { rel }),\n },\n { notes },\n );\n return writeResult(log, d, { tool: \"adr_link\" });\n },\n },\n {\n name: \"adr_for_path\",\n title: \"Decisions for paths\",\n description:\n \"The decisions that govern each file, from scope globs and code anchors. Inactive ones carry a warning.\",\n inputSchema: object(\n {\n paths: {\n type: \"array\",\n items: { type: \"string\", minLength: 1, maxLength: 4096 },\n minItems: 1,\n maxItems: 100,\n },\n },\n [\"paths\"],\n ),\n annotations: READ,\n async run(input) {\n const log = await openLog(e);\n const read = await readDecisions(log);\n const d = await decisionsFor(read, log, { paths: strings(input.paths) ?? [] });\n return { document: doc(d), ...forText(d, read) };\n },\n },\n {\n name: \"adr_scope\",\n title: \"Scope a decision\",\n description:\n \"Set, add or remove the globs that map a decision to code. Allowed on your own proposals; rescoping someone else's proposal or an accepted or deprecated decision needs mcp_can_decide. If the decision's Scope section would no longer read true, propose a superseding decision instead.\",\n inputSchema: {\n ...object({ id: ID, set: GLOBS, add: GLOBS, remove: GLOBS }, [\"id\"]),\n minProperties: 2,\n },\n inputHint: \"adr_scope needs id and at least one of set, add or remove\",\n annotations: WRITE,\n async run(input, ctx) {\n const log = await openLog(e);\n const read = await readDecisions(log);\n const id = resolveDecision(read, str(input.id) ?? \"\");\n const attribution = await mcpAttribution(log.git, ctx);\n const scopeBefore = read.projection.views.get(id)?.applies_to ?? [];\n const o = { tool: \"adr_scope\", scopeBefore };\n const refused = policyRefusal(log, read, \"adr_scope\", id, attribution);\n if (refused !== null) return writeResult(log, refused, o);\n const set = strings(input.set);\n const op = {\n ...(set === undefined ? {} : { set }),\n add: strings(input.add) ?? [],\n remove: strings(input.remove) ?? [],\n };\n const d = await scopeDecision(\n log,\n { id, op, actor: attribution.actor },\n { notes: attribution.notes },\n );\n return writeResult(log, d, o);\n },\n },\n {\n name: \"adr_withdraw\",\n title: \"Withdraw a proposal\",\n description:\n \"Withdraw a proposed decision, with an optional reason, for example your own proposal when the user decides against it. Withdrawing someone else's proposal needs mcp_can_decide. Only proposals can be withdrawn; an accepted decision needs a superseding proposal.\",\n inputSchema: object({ id: ID, reason: TEXT }, [\"id\"]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await openLog(e);\n const read = await readDecisions(log);\n const id = resolveDecision(read, str(input.id) ?? \"\");\n const attribution = await mcpAttribution(log.git, ctx);\n const o = { tool: \"adr_withdraw\" };\n const refused = policyRefusal(log, read, \"adr_withdraw\", id, attribution);\n if (refused !== null) return writeResult(log, refused, o);\n const d = await withdrawDecision(\n log,\n { id, reason: str(input.reason) ?? null, actor: attribution.actor },\n { notes: attribution.notes },\n );\n return writeResult(log, d, o);\n },\n },\n ];\n}\n\n/**\n * The log for a decision tool's call. The tool list was fixed at startup, so a call after\n * `mcp_can_decide` was turned off is a usage error telling the user to restart (design §7.3).\n */\nasync function decidingLog(e: AdrMcpEnv): Promise<DecisionLog> {\n const log = await openLog(e);\n if (!log.adr.mcpCanDecide) {\n throw new UsageError(\n `[policy] mcp_can_decide is now false in ${log.configPath ?? \"adr.toml (not present)\"}; restart adr mcp to update its tool list`,\n );\n }\n return log;\n}\n\n/** The four tools `adr mcp` lists only with `[policy] mcp_can_decide = true` (design §7.4). */\nexport function decisionTools(e: AdrMcpEnv): McpTool[] {\n return [\n {\n name: \"adr_accept\",\n title: \"Accept a decision\",\n description:\n \"Accept a proposed decision (lints it, freezes the body, supersedes what it declares). Refused for agents while accept_requires_human is on.\",\n inputSchema: object({ id: ID, copy_scope: { type: \"boolean\" } }, [\"id\"]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await decidingLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const copyScope =\n input.copy_scope === true ? \"copy\" : input.copy_scope === false ? \"skip\" : \"suggest\";\n const d = await acceptDecision(\n log,\n { id: str(input.id) ?? \"\", actor },\n { notes, copyScope },\n );\n return writeResult(log, d, { tool: \"adr_accept\" });\n },\n },\n {\n name: \"adr_reject\",\n title: \"Reject a decision\",\n description: \"Reject a proposed decision, with a reason.\",\n inputSchema: object({ id: ID, reason: TEXT }, [\"id\", \"reason\"]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await decidingLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const d = await rejectDecision(\n log,\n { id: str(input.id) ?? \"\", reason: str(input.reason) ?? \"\", actor },\n { notes },\n );\n return writeResult(log, d, { tool: \"adr_reject\" });\n },\n },\n {\n name: \"adr_deprecate\",\n title: \"Deprecate a decision\",\n description: \"Deprecate an accepted decision that nothing replaces, with a reason.\",\n inputSchema: object({ id: ID, reason: TEXT }, [\"id\", \"reason\"]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await decidingLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const d = await deprecateDecision(\n log,\n { id: str(input.id) ?? \"\", reason: str(input.reason) ?? \"\", actor },\n { notes },\n );\n return writeResult(log, d, { tool: \"adr_deprecate\" });\n },\n },\n {\n name: \"adr_supersede\",\n title: \"Supersede a decision\",\n description: \"Mark an accepted or deprecated decision superseded by an accepted one.\",\n inputSchema: object({ id: ID, by: ID, reason: TEXT }, [\"id\", \"by\"]),\n annotations: WRITE,\n async run(input, ctx) {\n const log = await decidingLog(e);\n const { actor, notes } = await mcpAttribution(log.git, ctx);\n const reason = str(input.reason);\n const d = await supersedeDecision(\n log,\n {\n id: str(input.id) ?? \"\",\n by: str(input.by) ?? \"\",\n actor,\n ...(reason === undefined ? {} : { reason }),\n },\n { notes },\n );\n return writeResult(log, d, { tool: \"adr_supersede\" });\n },\n },\n ];\n}\n","import { UsageError } from \"@nikovirtala/ledger\";\nimport type { McpPrompt } from \"@nikovirtala/ledger/mcp\";\nimport { readDecisions, resolveDecision } from \"../log.js\";\nimport { listTemplates } from \"../templates/list.js\";\nimport { type AdrMcpEnv, openLog } from \"./tools.js\";\n\n/**\n * `adr_draft_from_discussion` (design §7.8): the steps from a discussion to a proposal, with the\n * template's sections spelled out, ending with a human's `adr accept`.\n */\nexport function draftPrompt(e: AdrMcpEnv): McpPrompt {\n return {\n name: \"adr_draft_from_discussion\",\n title: \"Draft a decision from the discussion\",\n description:\n \"Turn the current discussion into a proposed architecture decision, checking the existing ones first.\",\n arguments: [\n { name: \"title\", description: \"Working title of the decision\", required: false },\n {\n name: \"template\",\n description: \"Template name; default [log] default_template\",\n required: false,\n },\n {\n name: \"supersedes\",\n description: \"A decision this proposal replaces: id or number\",\n required: false,\n },\n ],\n async get(args) {\n const read = await readDecisions(await openLog(e));\n const templates = await listTemplates(read);\n const name = args.template ?? templates.default;\n const t = templates.templates.find((x) => x.name === name);\n if (t === undefined)\n throw new UsageError(`unknown template ${name}; adr_templates lists them`);\n const replaced =\n args.supersedes === undefined ? null : resolveDecision(read, args.supersedes);\n const shown = (id: string) => {\n const display = read.projection.views.get(id)?.display ?? id;\n return display === id ? id : `${display} (${id})`;\n };\n const title =\n args.title === undefined\n ? 'a short title that states the decision, such as \"Use PostgreSQL for orders\"'\n : JSON.stringify(args.title);\n return [\n \"Turn the current discussion into an architecture decision proposal with adr.\",\n \"\",\n \"1. Call adr_search with the main subject of the discussion, and adr_for_path for the files it concerns. If an accepted decision already covers this, tell the user which one, and ask whether the proposal should supersede it.\",\n ...(replaced === null\n ? []\n : [\n `1a. The user named ${shown(replaced)} as the decision this replaces; read it with adr_get first.`,\n ]),\n `2. Use the template ${t.name} (version ${t.version}). Its sections:`,\n ...t.sections.map(\n (s) =>\n ` - ${s.id}: ${s.heading}, ${s.required ? \"required\" : \"optional\"}.${s.guidance === null ? \"\" : ` ${s.guidance}`}`,\n ),\n \"3. Fill every required section with facts from the discussion and the code only. Where something wasn't settled, write it as an open question in that section instead of inventing an answer. If the template has an options section, list at least two options with their trade-offs, including those the discussion rejected.\",\n `4. Call adr_propose with the title ${title}, template \"${t.name}\", the sections map${replaced === null ? \"\" : `, and supersedes [\"${replaced}\"]`}.`,\n \"5. If the result has ok: true with findings, fix those sections with adr_update_draft and the new decision's id. If it was refused (ok: false), fill in every section the findings name and call adr_propose again.\",\n \"6. Don't accept the proposal. Tell the user its id, and that they can review it and run: adr accept <id>\",\n ].join(\"\\n\");\n },\n };\n}\n","import { parseOnBehalfOf } from \"@nikovirtala/ledger\";\nimport { type McpServeOptions, serveMcp } from \"@nikovirtala/ledger/mcp\";\nimport { openDecisionLog } from \"../log.js\";\nimport { DECISION_TOOLS, decisionToolsAvailable } from \"./policy.js\";\nimport { draftPrompt } from \"./prompt.js\";\nimport { decisionResource, indexResource } from \"./resources.js\";\nimport { type AdrMcpEnv, alwaysOnTools, decisionTools } from \"./tools.js\";\n\nexport const INSTRUCTIONS =\n \"Architecture decisions in this repository are managed by adr. Decision files don't show their status: read decisions with adr_get or adr://decision/{id}, check adr_for_path and adr_search before changing architecture, and propose changes with adr_propose; a human accepts them.\";\n\n/**\n * `adr mcp` (design §7.2): checks `ARK_ON_BEHALF_OF` and opens the log first, so a bad\n * environment exits 2 before serving, then serves adr's tools over stdio until the client goes.\n */\nexport async function serveAdrMcp(o: {\n readonly cwd: string;\n readonly root: string | null;\n readonly env: NodeJS.ProcessEnv;\n readonly version: string;\n readonly stderr: { write(s: string): void };\n readonly transport?: McpServeOptions[\"transport\"];\n}): Promise<void> {\n parseOnBehalfOf(o.env.ARK_ON_BEHALF_OF);\n const log = await openDecisionLog({ cwd: o.cwd, root: o.root, gitOptions: { env: o.env } });\n const e: AdrMcpEnv = { cwd: o.cwd, root: o.root, env: o.env };\n const decide = decisionToolsAvailable(log.adr);\n const tools = [...alwaysOnTools(e), ...(decide ? decisionTools(e) : [])];\n const unavailable: Record<string, string> = {};\n if (decide && log.adr.acceptRequiresHuman) {\n o.stderr.write(\n \"adr: warning: adr_accept refuses agents while [policy] accept_requires_human is true\\n\",\n );\n }\n if (!decide) {\n const where = log.configPath ?? \"adr.toml (not present)\";\n for (const name of DECISION_TOOLS) {\n unavailable[name] =\n `[policy] mcp_can_decide is false in ${where}; a human decides with the adr CLI, or set it to true and restart adr mcp`;\n }\n }\n await serveMcp(\n {\n name: \"adr\",\n version: o.version,\n instructions: INSTRUCTIONS,\n tools,\n unavailable,\n resources: [indexResource(e)],\n resourceTemplates: [decisionResource(e)],\n prompts: [draftPrompt(e)],\n },\n {\n env: o.env,\n stderr: o.stderr,\n ...(o.transport === undefined ? {} : { transport: o.transport }),\n },\n );\n}\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAiB;CAC5B;CACA;CACA;CACA;AACF;;AAGA,SAAgB,uBAAuB,KAAyB;CAC9D,OAAO,IAAI;AACb;;;;;AAMA,SAAgB,cAAc,MAAqB,IAA2B;CAI5E,MAAM,SAHW,KAAK,OAAO,SAC1B,IAAI,EAAE,CAAC,EACN,QAAQ,MAAM,MAAM,EAAE,MAAM,SAAS,QAAQ,QAAQ,QAAQ,IAAI,EAAA,EAC7C,MAAM;CAC9B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,QAAQ,MAAM,SAAS,UAAU,MAAM,eAAe,MAAM;CAClE,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,CAAC,CAAC,YAAY,IAAI;AACzF;;;;;;;;;AA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BAAgB,EAAE,IAAI,gBAAgB;CACtC,MAAM,MAAM,MAAM,gBAAgB;EAAE,KAAK,EAAE;EAAK,MAAM,EAAE;EAAM,YAAY,EAAE,KAAK,EAAE,IAAI;CAAE,CAAC;CAC1F,MAAM,IAAe;EAAE,KAAK,EAAE;EAAK,MAAM,EAAE;EAAM,KAAK,EAAE;CAAI;CAC5D,MAAM,SAAS,uBAAuB,IAAI,GAAG;CAC7C,MAAM,QAAQ,CAAC,GAAG,cAAc,CAAC,GAAG,GAAI,SAAS,cAAc,CAAC,IAAI,CAAC,CAAE;CACvE,MAAM,cAAsC,CAAC;CAC7C,IAAI,UAAU,IAAI,IAAI,qBACpB,EAAE,OAAO,MACP,wFACF;CAEF,IAAI,CAAC,QAAQ;EACX,MAAM,QAAQ,IAAI,cAAc;EAChC,KAAK,MAAM,QAAQ,gBACjB,YAAY,QACV,uCAAuC,MAAM;CAEnD;CACA,MAAM,SACJ;EACE,MAAM;EACN,SAAS,EAAE;EACX,cAAc;EACd;EACA;EACA,WAAW,CAAC,cAAc,CAAC,CAAC;EAC5B,mBAAmB,CAAC,iBAAiB,CAAC,CAAC;EACvC,SAAS,CAAC,YAAY,CAAC,CAAC;CAC1B,GACA;EACE,KAAK,EAAE;EACP,QAAQ,EAAE;EACV,GAAI,EAAE,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU;CAChE,CACF;AACF"}
|
package/dist/types/cli/list.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { CommandSpec } from "@nikovirtala/ledger/cli";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* `adr list [--status <status>]… [--since <rev>] [--source <name>]` (design §5.6, 2b D7):
|
|
4
|
+
* `--source` lists a `[[sources]]` entry's cached log instead of the local one.
|
|
5
|
+
*/
|
|
3
6
|
export declare const listCommand: CommandSpec;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { CommandSpec } from "@nikovirtala/ledger/cli";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* `adr search <query>… [--all] [--source <name>]` (design §8.2): words are joined, and every one
|
|
4
|
+
* must match. `--source` searches a `[[sources]]` entry's cached log instead of the local one.
|
|
5
|
+
*/
|
|
3
6
|
export declare const searchCommand: CommandSpec;
|
|
@@ -40,13 +40,33 @@ export declare const ACTIONS: {
|
|
|
40
40
|
readonly names: "display";
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* The verb of each display-named event type in a batch subject (?6, design §4.4), and the order
|
|
45
|
+
* they are joined in: `link and scope ADR-0003`, `add a note to` last so it reads before the name.
|
|
46
|
+
*/
|
|
47
|
+
export declare const BATCH_ACTIONS: {
|
|
48
|
+
readonly deprecated: "deprecate";
|
|
49
|
+
readonly superseded: "supersede";
|
|
50
|
+
readonly linked: "link";
|
|
51
|
+
readonly scoped: "scope";
|
|
52
|
+
readonly noted: "add a note to";
|
|
53
|
+
};
|
|
54
|
+
export declare const BATCH_ORDER: readonly string[];
|
|
55
|
+
/** `{action}` of a batch of more than three verbs. */
|
|
56
|
+
export declare const UPDATE_ACTION = "update";
|
|
57
|
+
/** The longest batch action, `deprecate, supersede and add a note to`. */
|
|
58
|
+
export declare const LONGEST_BATCH: number;
|
|
43
59
|
/** `{action}` of `adr index --commit`, whose title slot holds `the decision index`. */
|
|
44
60
|
export declare const INDEX_ACTION = "regenerate";
|
|
45
61
|
/** What `adr index --commit`'s title slot holds. */
|
|
46
62
|
export declare const INDEX_TITLE = "the decision index";
|
|
47
63
|
/** `{action}` of a draft update (`adr_update_draft`), whose title slot holds the display. */
|
|
48
64
|
export declare const DRAFT_ACTION = "update the draft of";
|
|
49
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* The longest `{action}` that goes with a title, which `[commit] subject` must leave a title room
|
|
67
|
+
* for. A batch action (up to `LONGEST_BATCH`) only ever goes with a display, so `COMMIT_NAMES`
|
|
68
|
+
* covers it instead.
|
|
69
|
+
*/
|
|
50
70
|
export declare const LONGEST_ACTION: number;
|
|
51
71
|
/** The longest display: `ADR-` and up to 9 digits (`formatDecisionNumber`, kind/project.ts). */
|
|
52
72
|
export declare const DISPLAY_LENGTH = 13;
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -33,8 +33,9 @@ export declare function uninstallDecisionHooks(log: DecisionLog): Promise<HooksR
|
|
|
33
33
|
/** The config to paste into a hook manager instead of installing shims. */
|
|
34
34
|
export declare function printDecisionHooks(log: DecisionLog, manager: HookManager): HooksResultJson;
|
|
35
35
|
/**
|
|
36
|
-
* The `commit-msg` step (P1 §7.1): appends one `ADR`/`ADR-Event` pair per
|
|
37
|
-
*
|
|
36
|
+
* The `commit-msg` step (P1 §7.1): appends one `ADR`/`ADR-Event` pair per decision and event type
|
|
37
|
+
* among the staged added event files of the log (`eventTrailers`, ?6), in path order, keeping
|
|
38
|
+
* pairs another tool already added (`ifExists: "add"`). It does nothing for a message that
|
|
38
39
|
* already has an `ADR-Event:` trailer (an `adr … --commit` message), or during a merge, whose
|
|
39
40
|
* events came with their own commits' trailers. Throws `UsageError` when the file is missing.
|
|
40
41
|
*/
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export { type IndexResultJson, indexDecisionLog, renderDecisionIndex } from "./l
|
|
|
7
7
|
export { type DecisionForJson, type DecisionsForJson, decisionsFor, type UnresolvedAnchorJson, } from "./scope.js";
|
|
8
8
|
export { type DecisionSearchJson, type DecisionSearchResultJson, searchDecisions, } from "./search.js";
|
|
9
9
|
export { SKILL_MD } from "./skill.js";
|
|
10
|
+
export { type AdrSource, type DecisionSources, decisionSourceConfigs, type ForeignDecision, readDecisionSources, readSourceDecisions, } from "./sources.js";
|
|
10
11
|
export { listTemplates, type TemplatesJson } from "./templates/list.js";
|
|
11
|
-
export { adrChecks, verifyDecisions } from "./verify.js";
|
|
12
|
+
export { adrChecks, decisionVerifyInputs, verifyDecisions } from "./verify.js";
|
|
12
13
|
export { type DecisionListJson, type DecisionShowJson, listDecisions, type NumberingJson, showDecision, stateHeader, } from "./views.js";
|
|
13
14
|
export { acceptDecision, type CopyScope, deprecateDecision, followScopeRenames, type LinkInput, linkDecision, noteDecision, type ProposeInput, proposeDecision, type ReasonInput, rejectDecision, type ScopeInput, type ScopeOffer, scopeDecision, scopeToCopy, supersedeDecision, type UpdateDraftInput, updateDraft, type WriteOptions, type WriteResultJson, withdrawDecision, } from "./write.js";
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import type { FoldedLog, FoldedSubject, KindFinding } from "@nikovirtala/ledger";
|
|
2
2
|
import type { DecisionState } from "./reduce.js";
|
|
3
3
|
import type { DecisionEvents, DecisionStatus } from "./schemas.js";
|
|
4
|
+
/** A decision in another repository's log, as the reference rules and `--source` listings see it. */
|
|
5
|
+
export interface ForeignDecision {
|
|
6
|
+
readonly status: DecisionStatus;
|
|
7
|
+
readonly display: string;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
}
|
|
10
|
+
/** One `[[sources]]` entry of kind `adr`, as `AdrOptions.sources` holds it. */
|
|
11
|
+
export interface AdrSource {
|
|
12
|
+
/** The decisions at the cached commit; `null` when the source isn't cached (not checked). */
|
|
13
|
+
readonly subjects: ReadonlyMap<string, ForeignDecision> | null;
|
|
14
|
+
/** The cached commit, or `null`. */
|
|
15
|
+
readonly commit: string | null;
|
|
16
|
+
}
|
|
4
17
|
/** Options of the decision kind's `invariants` and `relate`. */
|
|
5
18
|
export interface AdrOptions {
|
|
6
19
|
/** Default `true`: an agent may propose, but only a human may accept (01:98). */
|
|
7
20
|
readonly acceptRequiresHuman: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The `kind = "adr"` `[[sources]]` by name, for checking qualified references; `null` (the
|
|
23
|
+
* default) skips qualified references, as reads that don't load sources do.
|
|
24
|
+
*/
|
|
25
|
+
readonly sources: ReadonlyMap<string, AdrSource> | null;
|
|
8
26
|
}
|
|
9
27
|
type Subject = FoldedSubject<DecisionStatus, DecisionState, DecisionEvents>;
|
|
10
28
|
type Log = FoldedLog<DecisionStatus, DecisionState, DecisionEvents>;
|
|
@@ -14,7 +32,10 @@ export declare function invariants(subject: Subject, options: AdrOptions): reado
|
|
|
14
32
|
* Cross-subject rules: `decision/reference-missing` for a local `supersedes`, `superseded.by` or
|
|
15
33
|
* `linked.to` naming no subject in the log; `decision/superseded-by-unaccepted` when the target of
|
|
16
34
|
* an applied `superseded.by` has no applied `accepted` event in this tree; and
|
|
17
|
-
* `decision/supersession-cycle`, once per cycle on its smallest id.
|
|
35
|
+
* `decision/supersession-cycle`, once per cycle on its smallest id. With `options.sources`, a
|
|
36
|
+
* qualified reference naming a source that isn't configured is `decision/unknown-source`, and one
|
|
37
|
+
* into a cached source that doesn't hold the id is `decision/reference-missing`; references into
|
|
38
|
+
* an uncached source aren't checked.
|
|
18
39
|
*/
|
|
19
|
-
export declare function relate(log: Log): readonly KindFinding[];
|
|
40
|
+
export declare function relate(log: Log, options?: AdrOptions): readonly KindFinding[];
|
|
20
41
|
export {};
|
package/dist/types/kind.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type DecisionEvents, type DecisionStatus } from "./kind/schemas.js";
|
|
|
6
6
|
export type { DecisionView } from "./kind/project.js";
|
|
7
7
|
export { formatDecisionNumber, parseDecisionNumber } from "./kind/project.js";
|
|
8
8
|
export type { DecisionState } from "./kind/reduce.js";
|
|
9
|
-
export type { AdrOptions } from "./kind/rules.js";
|
|
9
|
+
export type { AdrOptions, AdrSource, ForeignDecision } from "./kind/rules.js";
|
|
10
10
|
export { DECISION_STATUSES, type DecisionEvents, type DecisionStatus, type LinkRel, REF, } from "./kind/schemas.js";
|
|
11
11
|
/**
|
|
12
12
|
* The decision kind (01:128–194), as imported by other tools through `@nikovirtala/adr/kind`.
|
|
@@ -74,24 +74,6 @@ export declare function unstagedLogFiles(git: Git, layout: LogLayout): Promise<s
|
|
|
74
74
|
* `adr index` would change nothing. The finding then names those files and says to stage them.
|
|
75
75
|
*/
|
|
76
76
|
export declare function decisionIndexCheck(log: DecisionLog): Check;
|
|
77
|
-
/** Whether `bytes` (null: absent) hold exactly `text`. */
|
|
78
|
-
export declare function holdsText(bytes: Uint8Array | null, text: string): boolean;
|
|
79
|
-
/** HEAD's copy of `path`; `null` when it is absent or HEAD is unborn. */
|
|
80
|
-
export declare function headBytes(git: Git, path: string): Promise<Uint8Array | null>;
|
|
81
|
-
/** HEAD's tree, or an empty tree on an unborn HEAD. */
|
|
82
|
-
export declare function headTree(git: Git, head: string | null): Promise<TreeReader>;
|
|
83
|
-
/**
|
|
84
|
-
* Brings the work-tree copy of `path` to `text` (atomically, when it differs) and reports whether
|
|
85
|
-
* the staged copy differs, so the caller stages it. `old` is the work-tree copy before the write
|
|
86
|
-
* (`null` when absent), for rollback.
|
|
87
|
-
*/
|
|
88
|
-
export declare function writeIndexCopy(git: Git, path: string, text: string): Promise<{
|
|
89
|
-
readonly wrote: boolean;
|
|
90
|
-
readonly old: Uint8Array | null;
|
|
91
|
-
readonly stage: boolean;
|
|
92
|
-
}>;
|
|
93
|
-
/** The first line of an error's message, for notes and headlines. */
|
|
94
|
-
export declare const firstLine: (err: unknown) => string;
|
|
95
77
|
/** `adr index`'s result and whether the work-tree refresh after a commit changed a copy. */
|
|
96
78
|
export interface IndexRun {
|
|
97
79
|
readonly doc: IndexResultJson;
|
package/dist/types/log.d.ts
CHANGED
|
@@ -32,8 +32,10 @@ export interface DecisionsRead {
|
|
|
32
32
|
readonly findings: readonly Finding[];
|
|
33
33
|
/** How the log was located (`ToolLog.notes`); `[]` for a MemoryTree read. */
|
|
34
34
|
readonly notes: readonly string[];
|
|
35
|
-
/** The `[[sources]]` names in the config;
|
|
35
|
+
/** The `[[sources]]` names in the config; listings read them only with `--source`. */
|
|
36
36
|
readonly sources: readonly string[];
|
|
37
|
+
/** The `[[sources]]` entry this read is of (`--source`), or `null` for the local log. */
|
|
38
|
+
readonly source: string | null;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* `numberLog` on the repository, then `readDecisionsFrom(log.tree, …)`. In a shallow clone of a
|
|
@@ -53,10 +55,11 @@ export declare function readDecisionsFrom(tree: TreeReader, o: {
|
|
|
53
55
|
readonly commit?: string | null;
|
|
54
56
|
readonly notes?: readonly string[];
|
|
55
57
|
readonly sources?: readonly string[];
|
|
58
|
+
readonly source?: string | null;
|
|
56
59
|
}): Promise<DecisionsRead>;
|
|
57
60
|
/**
|
|
58
|
-
* The note listing reads add
|
|
59
|
-
*
|
|
61
|
+
* The note listing reads add for a log with `[[sources]]`: the other logs are listed with
|
|
62
|
+
* `--source`, from cached copies. `null` without sources, and for a `--source` read.
|
|
60
63
|
*/
|
|
61
64
|
export declare function sourcesNote(read: DecisionsRead): string | null;
|
|
62
65
|
/** `read.notes`, then the sources note when there is one. */
|
package/dist/types/search.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface DecisionSearchResultJson {
|
|
|
17
17
|
/** `adr search <query>… --json` and `adr_search` (design §6.4). */
|
|
18
18
|
export interface DecisionSearchJson {
|
|
19
19
|
readonly format: "adr-search/v1";
|
|
20
|
+
/** The `[[sources]]` entry searched (`--source`), or `null` for the local log. */
|
|
21
|
+
readonly source: string | null;
|
|
20
22
|
readonly root: string;
|
|
21
23
|
readonly ref: string | null;
|
|
22
24
|
readonly commit: string | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type SourceConfig, type SourceStatus } from "@nikovirtala/ledger";
|
|
2
|
+
import { type AdrSource, type ForeignDecision } from "./kind.js";
|
|
3
|
+
import { type DecisionLog, type DecisionsRead } from "./log.js";
|
|
4
|
+
export type { AdrSource, ForeignDecision };
|
|
5
|
+
export interface DecisionSources {
|
|
6
|
+
/** Every `kind = "adr"` entry by name, for `AdrOptions.sources`. */
|
|
7
|
+
readonly logs: ReadonlyMap<string, AdrSource>;
|
|
8
|
+
/** What each `kind = "adr"` entry resolved to, for the report's `sources` field. */
|
|
9
|
+
readonly statuses: readonly SourceStatus[];
|
|
10
|
+
readonly notes: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/** The kinds adr reads from `[[sources]]`: only decision logs. */
|
|
13
|
+
export declare const DECISION_SOURCE_KINDS: readonly string[];
|
|
14
|
+
/** The `[[sources]]` entries adr reads and the ones it skips, in config order. */
|
|
15
|
+
export declare function decisionSourceConfigs(log: DecisionLog): {
|
|
16
|
+
readonly sources: readonly SourceConfig[];
|
|
17
|
+
readonly skipped: readonly SourceConfig[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Reads the decision logs of the `kind = "adr"` `[[sources]]` entries (other kinds are never
|
|
21
|
+
* fetched): from the local cache only with `fetch: "cache"` (the default), else fetched first
|
|
22
|
+
* (`readSources`; a failed fetch throws `SourceFetchError`). A cached source's decisions are folded
|
|
23
|
+
* with adr's kind and numbered from its committed `index.md` (the cache is a depth-1 clone, so
|
|
24
|
+
* history numbering can't work), else shown by id.
|
|
25
|
+
*/
|
|
26
|
+
export declare function readDecisionSources(log: DecisionLog, o?: {
|
|
27
|
+
readonly fetch?: "cache" | "network";
|
|
28
|
+
}): Promise<DecisionSources>;
|
|
29
|
+
/**
|
|
30
|
+
* The cached decision log of the `[[sources]]` entry `name`, as a `DecisionsRead` for `adr list
|
|
31
|
+
* --source` and `adr search --source` (cache only, never the network). An uncached source reads as
|
|
32
|
+
* an empty log with the note `<name> not fetched; run adr sources fetch`. Throws `UsageError` for a
|
|
33
|
+
* name that isn't configured or whose kind adr doesn't read.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readSourceDecisions(log: DecisionLog, name: string): Promise<DecisionsRead>;
|
package/dist/types/verify.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
|
-
import { type Check, type Finding, type VerifyMode } from "@nikovirtala/ledger";
|
|
1
|
+
import { type Check, type Finding, type FoldedLogOf, type VerifyMode } from "@nikovirtala/ledger";
|
|
2
|
+
import { adrKind } from "./kind.js";
|
|
2
3
|
import { type DecisionLog } from "./log.js";
|
|
4
|
+
import { type DecisionSources } from "./sources.js";
|
|
3
5
|
/**
|
|
4
6
|
* Every check for the log: ledger's mechanical and fold checks with adr's actor policy, template
|
|
5
7
|
* lint against the templates in the head tree and, for older versions, the history of
|
|
6
8
|
* `historyRef`, the scope-glob and anchor checks, and the decision checks over code
|
|
7
9
|
* (`decision/governed-by-inactive`, `decision/scope-narrowed`). With `[log] index = "committed"`,
|
|
8
|
-
* also the freshness of `<root>/index.md`.
|
|
10
|
+
* also the freshness of `<root>/index.md`. With `sources` (`readDecisionSources`), qualified
|
|
11
|
+
* references are checked against the cached source logs, and each referenced source that isn't
|
|
12
|
+
* cached gets one `sources/not-fetched` warning.
|
|
13
|
+
*/
|
|
14
|
+
export declare function adrChecks(log: DecisionLog, historyRef: string | null, sources?: DecisionSources): readonly Check[];
|
|
15
|
+
/** The source names that qualified references in a folded decision log name. */
|
|
16
|
+
export declare function referencedSources(head: FoldedLogOf<typeof adrKind>): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* The inputs outside the decision events that adr's checks read: both candidate config paths (so
|
|
19
|
+
* adding a config counts) and the log's templates. A staged change to one widens `verify --staged`
|
|
20
|
+
* to every decision, because a policy, scope, severity, index or template change can make an
|
|
21
|
+
* unchanged decision fail.
|
|
22
|
+
*/
|
|
23
|
+
export declare function decisionVerifyInputs(log: DecisionLog): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Verifies the decision log in `mode` (staged, range or full) with `adrChecks`, reading the
|
|
26
|
+
* sources from the local cache only.
|
|
9
27
|
*/
|
|
10
|
-
export declare function adrChecks(log: DecisionLog, historyRef: string | null): readonly Check[];
|
|
11
|
-
/** Verifies the decision log in `mode` (staged, range or full) with `adrChecks`. */
|
|
12
28
|
export declare function verifyDecisions(log: DecisionLog, mode: VerifyMode): Promise<Finding[]>;
|
package/dist/types/views.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface NumberingJson {
|
|
|
10
10
|
/** `adr list --json` (design §5.5). */
|
|
11
11
|
export interface DecisionListJson {
|
|
12
12
|
readonly format: "adr-list/v1";
|
|
13
|
+
/** The `[[sources]]` entry listed (`--source`), or `null` for the local log. */
|
|
14
|
+
readonly source: string | null;
|
|
13
15
|
readonly root: string;
|
|
14
16
|
readonly ref: string | null;
|
|
15
17
|
readonly commit: string | null;
|
package/dist/types/write.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Actor, type EventEnvelope, type Finding, type SetOp, type Template, type TemplateSource, type Trailer, type TreeReader } from "@nikovirtala/ledger";
|
|
2
|
-
import { type DecisionView } from "./kind.js";
|
|
1
|
+
import { type Actor, type EventEnvelope, type EventRef, type Finding, type RenderedCommit, type SetOp, type Template, type TemplateSource, type Trailer, type TreeReader } from "@nikovirtala/ledger";
|
|
2
|
+
import { type AdrSource, type DecisionView } from "./kind.js";
|
|
3
3
|
import { type DecisionLog, type DecisionsRead } from "./log.js";
|
|
4
4
|
/** `adr <write command> --json` (design §5.5, §6.1). */
|
|
5
5
|
export interface WriteResultJson {
|
|
@@ -155,6 +155,7 @@ export declare function planAccept(read: DecisionsRead, input: {
|
|
|
155
155
|
readonly actor: Actor;
|
|
156
156
|
}, c: PlanContext, o?: {
|
|
157
157
|
readonly copyGlobs?: readonly string[];
|
|
158
|
+
readonly tracked?: readonly string[];
|
|
158
159
|
}): Promise<PlanResult>;
|
|
159
160
|
/** The scope an `accept` can copy from the decisions it supersedes (design §6.10). */
|
|
160
161
|
export interface ScopeOffer {
|
|
@@ -223,11 +224,14 @@ export interface LinkInput {
|
|
|
223
224
|
}
|
|
224
225
|
/**
|
|
225
226
|
* Plans `adr link` (design §6.7): `linked` in every state. A qualified target must name one of
|
|
226
|
-
* `o.sources` (the log's `[[sources]]` names)
|
|
227
|
-
*
|
|
227
|
+
* `o.sources` (the log's `[[sources]]` names) of kind `adr` (`o.logs`, from the local cache): a
|
|
228
|
+
* cached source must hold the id, else `UsageError`; into an uncached one the link is written with
|
|
229
|
+
* a note that it isn't checked. A link that already exists plans nothing, with a note.
|
|
228
230
|
*/
|
|
229
231
|
export declare function planLink(read: DecisionsRead, input: LinkInput, c: PlanContext, o?: {
|
|
230
232
|
readonly sources?: readonly string[];
|
|
233
|
+
readonly logs?: ReadonlyMap<string, AdrSource>;
|
|
234
|
+
readonly kinds?: ReadonlyMap<string, string>;
|
|
231
235
|
}): Promise<PlanResult>;
|
|
232
236
|
export interface ScopeInput {
|
|
233
237
|
readonly id: string;
|
|
@@ -267,6 +271,8 @@ export interface AppliedPlan {
|
|
|
267
271
|
readonly findings: readonly Finding[];
|
|
268
272
|
/** Notes about the index ("not updated", "may be stale"); `[]` when none. */
|
|
269
273
|
readonly notes: readonly string[];
|
|
274
|
+
/** The message `compose` rendered, or `null` without `compose` or a commit. */
|
|
275
|
+
readonly rendered: RenderedCommit | null;
|
|
270
276
|
}
|
|
271
277
|
/**
|
|
272
278
|
* What the recovery hint says about rerunning a write command after `git commit` failed (design
|
|
@@ -286,6 +292,17 @@ export declare function applyPlan(log: DecisionLog, plan: WritePlan, o: {
|
|
|
286
292
|
readonly message?: string;
|
|
287
293
|
/** `message` is the user's own: append the trailers to its own trailer block, if it ends in one. */
|
|
288
294
|
readonly mergeTrailers?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Renders the commit message once the extra staged events are known (?6), instead of
|
|
297
|
+
* `message`: `plan` holds the plan's own events, `extra` the other staged event files the
|
|
298
|
+
* commit sweeps in (by file name, deduplicated by subject and type), and `tree` is the
|
|
299
|
+
* commit's tree. Exclusive with `message`.
|
|
300
|
+
*/
|
|
301
|
+
readonly compose?: (c: {
|
|
302
|
+
readonly plan: readonly EventRef[];
|
|
303
|
+
readonly extra: readonly EventRef[];
|
|
304
|
+
readonly tree: TreeReader;
|
|
305
|
+
}) => RenderedCommit;
|
|
289
306
|
readonly afterStage?: () => Promise<AfterStage>;
|
|
290
307
|
/**
|
|
291
308
|
* Renders the log's index for `tree`, which builds on `history` (HEAD, the new commit, or
|
|
@@ -303,6 +320,22 @@ export interface WriteDeps {
|
|
|
303
320
|
readonly random?: (buf: Uint8Array) => void;
|
|
304
321
|
readonly apply: typeof applyPlan;
|
|
305
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* The commit's action and title slot (ADR-0008, ?6), chosen once the staged events the commit
|
|
325
|
+
* sweeps in are known: when `plan` or `extra` holds a status event (proposed, accepted, rejected,
|
|
326
|
+
* withdrawn), the title form of the last one, since that is what the commit decides. Otherwise
|
|
327
|
+
* the plan's own subject when the extra events add no other verb; with two or three verbs those
|
|
328
|
+
* joined (`link and scope ADR-0003`), and beyond three (or where the joined verbs don't fit a
|
|
329
|
+
* custom template) `update ADR-0003`. Every single-action subject stays the plan's own, byte for
|
|
330
|
+
* byte.
|
|
331
|
+
*/
|
|
332
|
+
export declare function composeSubject(read: DecisionsRead, parts: CommitParts, c: {
|
|
333
|
+
readonly plan: readonly EventRef[];
|
|
334
|
+
readonly extra: readonly EventRef[];
|
|
335
|
+
}): {
|
|
336
|
+
readonly action: string;
|
|
337
|
+
readonly title: string;
|
|
338
|
+
};
|
|
306
339
|
/**
|
|
307
340
|
* `adr new`: renders a draft, writes the body, any materialized template and the `proposed`
|
|
308
341
|
* event, stages them, and commits with `commit` (default `[policy] auto_commit`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nikovirtala/adr",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Architecture decision records kept as event logs in git: frozen bodies, computed status and supersession chains. CLI and library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adr",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"provenance": true
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@nikovirtala/ledger": "^0.
|
|
48
|
+
"@nikovirtala/ledger": "^0.7.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@modelcontextprotocol/sdk": "1.32.2"
|