@nikovirtala/adr 0.3.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 +62 -13
- package/dist/cli.js +208 -48
- package/dist/cli.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/init-CaKKCINh.js +651 -0
- 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-CJi9vZqJ.js +58 -0
- package/dist/list-CJi9vZqJ.js.map +1 -0
- package/dist/{scope-CLqH-q1y.js → search-CTspg2pd.js} +644 -550
- package/dist/search-CTspg2pd.js.map +1 -0
- package/dist/server-D3ySzyj6.js +950 -0
- package/dist/server-D3ySzyj6.js.map +1 -0
- package/dist/types/cli/init.d.ts +5 -2
- package/dist/types/cli/list.d.ts +4 -1
- package/dist/types/cli/mcp.d.ts +6 -0
- package/dist/types/cli/search.d.ts +6 -0
- package/dist/types/cli/text.d.ts +6 -0
- package/dist/types/commit-actions.d.ts +23 -1
- package/dist/types/hooks.d.ts +3 -2
- package/dist/types/index.d.ts +7 -3
- package/dist/types/init.d.ts +16 -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 +13 -0
- package/dist/types/mcp/policy.d.ts +33 -0
- package/dist/types/mcp/prompt.d.ts +7 -0
- package/dist/types/mcp/resources.d.ts +16 -0
- package/dist/types/mcp/server.d.ts +16 -0
- package/dist/types/mcp/text.d.ts +42 -0
- package/dist/types/mcp/tools.d.ts +27 -0
- package/dist/types/scope.d.ts +3 -1
- package/dist/types/search.d.ts +63 -0
- package/dist/types/skill.d.ts +5 -0
- package/dist/types/sources.d.ts +35 -0
- package/dist/types/templates/list.d.ts +31 -0
- package/dist/types/verify.d.ts +20 -4
- package/dist/types/views.d.ts +5 -1
- package/dist/types/write.d.ts +76 -5
- package/package.json +5 -2
- package/dist/kind-DjvA3dyA.js.map +0 -1
- package/dist/scope-CLqH-q1y.js.map +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Finding, type StateHeader } from "@nikovirtala/ledger";
|
|
2
|
+
import type { DecisionView } from "./kind.js";
|
|
3
|
+
import { type DecisionsRead } from "./log.js";
|
|
4
|
+
import { type NumberingJson } from "./views.js";
|
|
5
|
+
export type SearchField = "id" | "title" | "body" | "notes";
|
|
6
|
+
/** One decision `adr search` found. */
|
|
7
|
+
export interface DecisionSearchResultJson {
|
|
8
|
+
readonly decision: DecisionView;
|
|
9
|
+
/** `stateHeader(view, read)`: the CLI's wording. */
|
|
10
|
+
readonly header: StateHeader;
|
|
11
|
+
readonly score: number;
|
|
12
|
+
/** The fields with a hit, in the order id, title, body, notes (the display number is `id`). */
|
|
13
|
+
readonly matched: readonly SearchField[];
|
|
14
|
+
/** The best matching line of the body or a note, cut to about 160 characters; `null` if none. */
|
|
15
|
+
readonly excerpt: string | null;
|
|
16
|
+
}
|
|
17
|
+
/** `adr search <query>… --json` and `adr_search` (design §6.4). */
|
|
18
|
+
export interface DecisionSearchJson {
|
|
19
|
+
readonly format: "adr-search/v1";
|
|
20
|
+
/** The `[[sources]]` entry searched (`--source`), or `null` for the local log. */
|
|
21
|
+
readonly source: string | null;
|
|
22
|
+
readonly root: string;
|
|
23
|
+
readonly ref: string | null;
|
|
24
|
+
readonly commit: string | null;
|
|
25
|
+
readonly numbering: NumberingJson;
|
|
26
|
+
/** As given, trimmed. */
|
|
27
|
+
readonly query: string;
|
|
28
|
+
/** Folded, deduplicated, in query order. */
|
|
29
|
+
readonly terms: readonly string[];
|
|
30
|
+
readonly include_inactive: boolean;
|
|
31
|
+
/** Matching decisions before `limit`. */
|
|
32
|
+
readonly total: number;
|
|
33
|
+
/** Decisions that match but aren't active; `0` with `include_inactive`. */
|
|
34
|
+
readonly inactive_omitted: number;
|
|
35
|
+
readonly results: readonly DecisionSearchResultJson[];
|
|
36
|
+
/** The read's findings of the listed decisions and of the log as a whole. */
|
|
37
|
+
readonly findings: readonly Finding[];
|
|
38
|
+
/** `read.notes`, then the sources note. */
|
|
39
|
+
readonly notes: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
/** A folded string and, for every folded UTF-16 offset (and its end), the original offset. */
|
|
42
|
+
interface Folded {
|
|
43
|
+
readonly text: string;
|
|
44
|
+
readonly at: readonly number[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Case- and accent-insensitive form: per code point NFKD, combining marks dropped, lower-cased.
|
|
48
|
+
* `Café` → `cafe` and `fi` → `fi`; `ß` and `ø` have no decomposition and stay as they are.
|
|
49
|
+
*/
|
|
50
|
+
export declare function fold(s: string): Folded;
|
|
51
|
+
/**
|
|
52
|
+
* Full-text search of the log (design §8.1): a decision matches when every term of the folded
|
|
53
|
+
* query is a substring of its folded id, display number, title, body or note texts. Ranked by
|
|
54
|
+
* score (10 for a term equal to the id or number, 5 in the title, up to 3 for body hits and 2
|
|
55
|
+
* for note hits), then status as `adr for` orders them, then list order. Only proposed and
|
|
56
|
+
* accepted decisions unless `includeInactive`. Throws `UsageError` for an invalid query.
|
|
57
|
+
*/
|
|
58
|
+
export declare function searchDecisions(read: DecisionsRead, o: {
|
|
59
|
+
readonly query: string;
|
|
60
|
+
readonly includeInactive?: boolean;
|
|
61
|
+
readonly limit?: number;
|
|
62
|
+
}): DecisionSearchJson;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent skill `adr init --skill` writes (01, "Agent skill (SKILL.md)"): the judgment of when
|
|
3
|
+
* to use adr's MCP tools. `skill.test.ts` keeps it equal to the block in docs/01-adr-v1.md.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SKILL_MD = "---\nname: adr\ndescription: Use before changing architecture, data stores, integration patterns, dependencies or cross-cutting conventions, and whenever asked to record, propose or look up an architectural decision.\n---\n\n# Architectural decisions (adr)\n\nDecisions in this repo are managed by adr. Decision files do not\nshow their own status, so never judge from the raw files whether a\ndecision applies.\n\n## Before changing architecture\n\n1. Call adr_for_path for the files you will touch, and adr_search\n for the area you are about to change. adr_search returns active\n decisions only; adr_for_path also lists inactive ones, each with\n a warning.\n2. If your change conflicts with an accepted decision, stop and tell\n the user which ADR it conflicts with. Do not work around it silently.\n3. If the user still wants the change, propose a superseding ADR.\n\n## Reading decisions\n\n- Use adr_get or adr://decision/{id}, never docs/adr/decisions/*.md.\n- If a response says SUPERSEDED or DEPRECATED, follow it to the\n effective decision before acting.\n- If it says REJECTED or WITHDRAWN, the decision was never in force;\n do not apply it.\n\n## Proposing decisions\n\n1. Call adr_templates and fill every required section.\n2. Use only facts from the conversation and the code. Mark unknowns\n as open questions instead of inventing them.\n3. List at least two options considered when the template has that section.\n4. Set supersedes when the proposal replaces an existing decision.\n5. Do not accept your own proposal. Tell the user the ADR id and\n that they can review it and run: adr accept <id>\n6. If the user decides against your proposal, withdraw it with\n adr_withdraw and give their reason. Don't withdraw other\n people's proposals; tell the user instead.\n\n## Changing scope\n\n- When you move or rename code covered by a decision, let the\n pre-commit hook update its globs (adr hooks install). For your\n own proposals, you can use adr_scope. Rescoping an accepted\n decision needs mcp_can_decide; otherwise tell the user and\n suggest adr scope <id> \u2026.\n- Before any scope change, read the decision's Scope section. If it\n would no longer read true after the change, do not rescope: tell\n the user the decision itself is changing and propose a\n superseding ADR.\n\n## Never\n\n- Edit an accepted decision body, any file under docs/adr/events/,\n or index.md by hand.\n- Use adr_note to change the meaning of a decision. Notes clarify;\n changed decisions need a superseding ADR.\n\n## Without the MCP server\n\nUse the CLI with --json: adr search, adr for, adr show, adr new,\nadr note. Set ARK_AGENT=<your name> and ARK_ON_BEHALF_OF=<the user's\nemail> so your writes are attributed.\n";
|
|
@@ -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>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Finding } from "@nikovirtala/ledger";
|
|
2
|
+
import type { DecisionsRead } from "../log.js";
|
|
3
|
+
/** `adr_templates` (and phase 4's `adr template list --json`): the templates a proposal can use. */
|
|
4
|
+
export interface TemplatesJson {
|
|
5
|
+
readonly format: "adr-templates/v1";
|
|
6
|
+
readonly root: string;
|
|
7
|
+
/** `[log] default_template`. */
|
|
8
|
+
readonly default: string;
|
|
9
|
+
readonly templates: readonly {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly version: number;
|
|
12
|
+
readonly source: "repo" | "builtin";
|
|
13
|
+
/** `<root>/templates/<name>.md` for a repo template; `null` for a built-in one. */
|
|
14
|
+
readonly path: string | null;
|
|
15
|
+
readonly sections: readonly {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly heading: string;
|
|
18
|
+
readonly required: boolean;
|
|
19
|
+
readonly guidance: string | null;
|
|
20
|
+
}[];
|
|
21
|
+
}[];
|
|
22
|
+
/** Why a repo template is left out: it doesn't parse or fails the template lint. */
|
|
23
|
+
readonly findings: readonly Finding[];
|
|
24
|
+
readonly notes: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The templates of `<root>/templates` that parse and pass the template lint, and the built-in
|
|
28
|
+
* ones no repo template or file of the same name shadows (`adr new` copies those on first use),
|
|
29
|
+
* sorted by name.
|
|
30
|
+
*/
|
|
31
|
+
export declare function listTemplates(read: DecisionsRead): Promise<TemplatesJson>;
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EventEnvelope, type Finding, type StateHeader } from "@nikovirtala/ledger";
|
|
2
2
|
import type { DecisionStatus, DecisionView } from "./kind.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type ChangedSince, type DecisionsRead } from "./log.js";
|
|
4
4
|
/** The `numbering` key of the read documents. */
|
|
5
5
|
export interface NumberingJson {
|
|
6
6
|
readonly available: boolean;
|
|
@@ -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;
|
|
@@ -41,6 +43,8 @@ export interface DecisionShowJson {
|
|
|
41
43
|
}
|
|
42
44
|
/** The `numbering` key of `adr-list/v1`, `adr-show/v1` and `adr-for/v1`. */
|
|
43
45
|
export declare const numberingJson: (read: DecisionsRead) => NumberingJson;
|
|
46
|
+
/** Numbered decisions by number, then unnumbered ones by `proposed_at`, then id. */
|
|
47
|
+
export declare function compareViews(a: DecisionView, b: DecisionView): number;
|
|
44
48
|
/**
|
|
45
49
|
* The `adr-list/v1` document: decisions in list order, filtered by `status` and by `since` (only
|
|
46
50
|
* the decisions with event files added since its revision, from `changedSince`), and truncated to
|
package/dist/types/write.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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 {
|
|
6
6
|
readonly format: "adr-write/v1";
|
|
7
|
-
readonly command: "new" | "accept" | "supersede" | "reject" | "withdraw" | "deprecate" | "note" | "link" | "scope";
|
|
7
|
+
readonly command: "new" | "accept" | "supersede" | "reject" | "withdraw" | "deprecate" | "note" | "link" | "scope" | "update";
|
|
8
8
|
readonly ok: boolean;
|
|
9
9
|
/**
|
|
10
10
|
* The decision after the write; before it when `ok` is false (`null` for a refused `new`).
|
|
@@ -68,6 +68,14 @@ export interface WritePlan {
|
|
|
68
68
|
readonly subject: string;
|
|
69
69
|
/** New files, repo-relative path → bytes, in write order: body, materialized template, events. */
|
|
70
70
|
readonly files: Readonly<Record<string, Uint8Array>>;
|
|
71
|
+
/**
|
|
72
|
+
* Existing files to replace, path → the new bytes and the bytes the plan read; written only if
|
|
73
|
+
* the file still holds `expected` (a draft update).
|
|
74
|
+
*/
|
|
75
|
+
readonly replace?: Readonly<Record<string, {
|
|
76
|
+
readonly bytes: Uint8Array;
|
|
77
|
+
readonly expected: Uint8Array;
|
|
78
|
+
}>>;
|
|
71
79
|
readonly events: readonly EventEnvelope[];
|
|
72
80
|
/** Paths to stage: every new file, plus the existing body for accept. */
|
|
73
81
|
readonly stage: readonly string[];
|
|
@@ -126,12 +134,28 @@ export type PlanResult = {
|
|
|
126
134
|
export declare function planPropose(read: DecisionsRead, input: ProposeInput, c: PlanContext, o?: {
|
|
127
135
|
readonly refuseIncomplete?: boolean;
|
|
128
136
|
}): Promise<PlanResult>;
|
|
137
|
+
/** Input of a draft update: the decision and the sections to replace (section id → markdown). */
|
|
138
|
+
export interface UpdateDraftInput {
|
|
139
|
+
readonly id: string;
|
|
140
|
+
readonly sections: Readonly<Record<string, string>>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Plans a draft update (design §6.6): the given sections of a proposed decision's body replaced in
|
|
144
|
+
* place, every other line kept, written only if the body still holds the bytes read. Refused
|
|
145
|
+
* (`ok: false`) when the decision isn't proposed or its body or template version is missing or
|
|
146
|
+
* unreadable, and with `refuseIncomplete` when the new draft fails its template lint. An unknown
|
|
147
|
+
* section, a missing heading or a heading in the content is a `UsageError`.
|
|
148
|
+
*/
|
|
149
|
+
export declare function planUpdateDraft(read: DecisionsRead, input: UpdateDraftInput, c: PlanContext, o?: {
|
|
150
|
+
readonly refuseIncomplete?: boolean;
|
|
151
|
+
}): Promise<PlanResult>;
|
|
129
152
|
/** Plans `adr accept`: `accepted` with the body hash, and `superseded` on each declared target. */
|
|
130
153
|
export declare function planAccept(read: DecisionsRead, input: {
|
|
131
154
|
readonly id: string;
|
|
132
155
|
readonly actor: Actor;
|
|
133
156
|
}, c: PlanContext, o?: {
|
|
134
157
|
readonly copyGlobs?: readonly string[];
|
|
158
|
+
readonly tracked?: readonly string[];
|
|
135
159
|
}): Promise<PlanResult>;
|
|
136
160
|
/** The scope an `accept` can copy from the decisions it supersedes (design §6.10). */
|
|
137
161
|
export interface ScopeOffer {
|
|
@@ -200,11 +224,14 @@ export interface LinkInput {
|
|
|
200
224
|
}
|
|
201
225
|
/**
|
|
202
226
|
* Plans `adr link` (design §6.7): `linked` in every state. A qualified target must name one of
|
|
203
|
-
* `o.sources` (the log's `[[sources]]` names)
|
|
204
|
-
*
|
|
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.
|
|
205
230
|
*/
|
|
206
231
|
export declare function planLink(read: DecisionsRead, input: LinkInput, c: PlanContext, o?: {
|
|
207
232
|
readonly sources?: readonly string[];
|
|
233
|
+
readonly logs?: ReadonlyMap<string, AdrSource>;
|
|
234
|
+
readonly kinds?: ReadonlyMap<string, string>;
|
|
208
235
|
}): Promise<PlanResult>;
|
|
209
236
|
export interface ScopeInput {
|
|
210
237
|
readonly id: string;
|
|
@@ -244,18 +271,38 @@ export interface AppliedPlan {
|
|
|
244
271
|
readonly findings: readonly Finding[];
|
|
245
272
|
/** Notes about the index ("not updated", "may be stale"); `[]` when none. */
|
|
246
273
|
readonly notes: readonly string[];
|
|
274
|
+
/** The message `compose` rendered, or `null` without `compose` or a commit. */
|
|
275
|
+
readonly rendered: RenderedCommit | null;
|
|
247
276
|
}
|
|
248
277
|
/**
|
|
249
278
|
* What the recovery hint says about rerunning a write command after `git commit` failed (design
|
|
250
279
|
* 2b D5): the batch is already in the log, so a rerun is refused, writes nothing or duplicates it.
|
|
251
280
|
*/
|
|
252
281
|
export declare const WRITE_RERUN = "Don't run the command again: the log already holds the change, so a rerun would be refused, do nothing, or write it a second time.";
|
|
282
|
+
/**
|
|
283
|
+
* Applies a plan (§5.4): refuses a commit whose scope has unstaged or needed untracked paths,
|
|
284
|
+
* writes the files (removing them again if a write fails), stages them, runs `afterStage`, and
|
|
285
|
+
* commits `plan.stage` plus the involved subjects' already-staged files with exact trailers. A
|
|
286
|
+
* failed `git commit` throws `CommitFailedError` with the manual command (design 2b D5) and the
|
|
287
|
+
* notes made so far.
|
|
288
|
+
*/
|
|
253
289
|
export declare function applyPlan(log: DecisionLog, plan: WritePlan, o: {
|
|
254
290
|
readonly commit: boolean;
|
|
255
291
|
/** The commit message, without trailers; required when committing. */
|
|
256
292
|
readonly message?: string;
|
|
257
293
|
/** `message` is the user's own: append the trailers to its own trailer block, if it ends in one. */
|
|
258
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;
|
|
259
306
|
readonly afterStage?: () => Promise<AfterStage>;
|
|
260
307
|
/**
|
|
261
308
|
* Renders the log's index for `tree`, which builds on `history` (HEAD, the new commit, or
|
|
@@ -273,6 +320,22 @@ export interface WriteDeps {
|
|
|
273
320
|
readonly random?: (buf: Uint8Array) => void;
|
|
274
321
|
readonly apply: typeof applyPlan;
|
|
275
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
|
+
};
|
|
276
339
|
/**
|
|
277
340
|
* `adr new`: renders a draft, writes the body, any materialized template and the `proposed`
|
|
278
341
|
* event, stages them, and commits with `commit` (default `[policy] auto_commit`).
|
|
@@ -336,6 +399,14 @@ export declare function linkDecision(log: DecisionLog, input: LinkInput, o?: Wri
|
|
|
336
399
|
* and commits with `commit`. An unchanged set writes nothing.
|
|
337
400
|
*/
|
|
338
401
|
export declare function scopeDecision(log: DecisionLog, input: ScopeInput, o?: WriteOptions, deps?: WriteDeps): Promise<WriteResultJson>;
|
|
402
|
+
/**
|
|
403
|
+
* Replaces sections of a proposed decision's draft (design §6.6), stages the body, and commits
|
|
404
|
+
* with `commit` (default `[policy] auto_commit`). A body with unstaged changes is a `UsageError`,
|
|
405
|
+
* so nobody's unsaved edit is folded into this write; a body changed between plan and write is
|
|
406
|
+
* `FileChangedError`. A commit is never made of a draft that fails its template lint: it is
|
|
407
|
+
* refused (`ok: false`, nothing written), as for `proposeDecision` without an editor.
|
|
408
|
+
*/
|
|
409
|
+
export declare function updateDraft(log: DecisionLog, input: UpdateDraftInput, o?: WriteOptions, deps?: WriteDeps): Promise<WriteResultJson>;
|
|
339
410
|
/**
|
|
340
411
|
* `adr scope [<decision>] --follow-renames` (design §6.8): rewrites the scope globs of the given
|
|
341
412
|
* decision, or of every decision, after the renames staged against `HEAD`, and stages one
|
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,10 @@
|
|
|
45
45
|
"provenance": true
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@nikovirtala/ledger": "^0.
|
|
48
|
+
"@nikovirtala/ledger": "^0.7.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@modelcontextprotocol/sdk": "1.32.2"
|
|
49
52
|
},
|
|
50
53
|
"scripts": {
|
|
51
54
|
"build": "tsdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kind-DjvA3dyA.js","names":[],"sources":["../src/kind/project.ts","../src/kind/reduce.ts","../src/kind/rules.ts","../src/kind/schemas.ts","../src/kind.ts"],"sourcesContent":["import type { FoldedSubject, ProjectContext } from \"@nikovirtala/ledger\";\nimport type { DecisionState } from \"./reduce.js\";\nimport type { DecisionEvents, DecisionStatus } from \"./schemas.js\";\n\n/** One decision as the CLI, the library and MCP show it (01:173–192, plus the added fields). */\nexport interface DecisionView {\n readonly id: string;\n readonly number: number | null;\n /** `ADR-0007`, or the id when unnumbered. */\n readonly display: string;\n readonly title: string;\n readonly status: DecisionStatus;\n readonly superseded_by: string | null;\n /** Ids whose applied `superseded.by` is this id, sorted. */\n readonly supersedes: readonly string[];\n /** The proposal's intent (01:164). */\n readonly declared_supersedes: readonly string[];\n /** Head of the `superseded_by` chain; `null` only on a cycle. */\n readonly effective: string | null;\n /** `[id, …, effective]`, following `superseded_by` forward. */\n readonly chain: readonly string[];\n readonly template: { readonly name: string; readonly version: number };\n readonly body_path: string | null;\n /** Recorded at acceptance. */\n readonly body_sha256: string | null;\n /** `null` until accepted; whether the current body hash equals the recorded one. */\n readonly body_intact: boolean | null;\n readonly links: readonly { readonly to: string; readonly rel: string }[];\n readonly applies_to: readonly string[];\n readonly notes: number;\n readonly proposed_at: string;\n readonly decided_at: string | null;\n readonly status_at: string;\n /** `proposed 2026-03-12`: state-changing events, in fold order. */\n readonly history: readonly string[];\n}\n\ntype Subject = FoldedSubject<DecisionStatus, DecisionState, DecisionEvents>;\ntype Context = ProjectContext<DecisionStatus, DecisionState, DecisionEvents>;\n\nconst NUMBER = /^(?:adr-?)?0*([1-9][0-9]{0,8})$/i;\n\n/** `ADR-0007`: at least 4 digits, growing past 9999. */\nexport function formatDecisionNumber(n: number): string {\n return `ADR-${String(n).padStart(4, \"0\")}`;\n}\n\n/** `7`, `0007`, `ADR-7`, `adr-0007` → 7; `null` for anything else. */\nexport function parseDecisionNumber(s: string): number | null {\n const m = NUMBER.exec(s.trim());\n return m === null ? null : Number(m[1]);\n}\n\n/**\n * Follows `superseded_by` from `id`. A visited set stops on a cycle (`effective: null`); a\n * reference to a subject that isn't folded ends the chain there.\n */\nfunction chainOf(id: string, ctx: Context): { chain: string[]; effective: string | null } {\n const chain = [id];\n let cur = id;\n for (;;) {\n const next = ctx.log.subjects.get(cur)?.state?.supersededBy ?? null;\n if (next === null) return { chain, effective: cur };\n if (chain.includes(next)) return { chain, effective: null };\n chain.push(next);\n cur = next;\n }\n}\n\n/** Pure: the view of one folded decision. */\nexport function project(subject: Subject, ctx: Context): DecisionView {\n const { id } = subject;\n const s = subject.state;\n if (s === null || subject.status === null) {\n throw new Error(`decision ${id} is not folded`);\n }\n const supersedes = [...ctx.log.subjects.values()]\n .filter((o) => o.id !== id && o.state?.supersededBy === id)\n .map((o) => o.id)\n .sort();\n const { chain, effective } = chainOf(id, ctx);\n const current = ctx.bodySha256(id);\n return {\n id,\n number: ctx.number(id),\n display: ctx.display(id),\n title: s.title,\n status: subject.status,\n superseded_by: s.supersededBy,\n supersedes,\n declared_supersedes: s.declaredSupersedes,\n effective,\n chain,\n template: s.template,\n body_path: subject.loaded.body?.path ?? subject.loaded.bodyPaths[0] ?? null,\n body_sha256: s.bodySha256,\n body_intact: s.bodySha256 === null ? null : current === s.bodySha256,\n links: s.links,\n applies_to: s.appliesTo,\n notes: s.notes,\n proposed_at: s.proposedAt,\n decided_at: s.decidedAt,\n status_at: s.statusAt,\n history: s.history.map((h) => `${h.type} ${h.at.slice(0, 10)}`),\n };\n}\n","import type { Actor, FoldEvent } from \"@nikovirtala/ledger\";\nimport type { DecisionEvents } from \"./schemas.js\";\n\n/** A decision's own state, maintained by `reduce` over its applied events. */\nexport interface DecisionState {\n readonly title: string;\n readonly template: { readonly name: string; readonly version: number };\n readonly declaredSupersedes: readonly string[];\n /** From the applied `accepted` event. */\n readonly bodySha256: string | null;\n readonly acceptedBy: Actor | null;\n readonly supersededBy: string | null;\n /** In fold order, duplicates kept once. */\n readonly links: readonly { readonly to: string; readonly rel: string }[];\n /** The latest `scoped` set (latest wins). */\n readonly appliesTo: readonly string[];\n readonly notes: number;\n /** State-changing events only, in fold order. */\n readonly history: readonly { readonly type: string; readonly at: string }[];\n readonly proposedAt: string;\n /** `at` of `accepted`, `rejected` or `withdrawn`. */\n readonly decidedAt: string | null;\n /** `at` of the latest state-changing event. */\n readonly statusAt: string;\n}\n\nconst EMPTY: DecisionState = {\n title: \"\",\n template: { name: \"\", version: 0 },\n declaredSupersedes: [],\n bodySha256: null,\n acceptedBy: null,\n supersededBy: null,\n links: [],\n appliesTo: [],\n notes: 0,\n history: [],\n proposedAt: \"\",\n decidedAt: null,\n statusAt: \"\",\n};\n\n/** Pure: the state after one applied event. The fold only passes events the machine allows. */\nexport function reduce(state: DecisionState | null, e: FoldEvent<DecisionEvents>): DecisionState {\n const s = state ?? EMPTY;\n const changed = (extra: Partial<DecisionState> = {}): DecisionState => ({\n ...s,\n ...extra,\n history: [...s.history, { type: e.type, at: e.at }],\n statusAt: e.at,\n });\n switch (e.type) {\n case \"proposed\":\n return changed({\n title: e.data.title,\n template: { name: e.data.template, version: e.data.template_version },\n declaredSupersedes: [...(e.data.supersedes ?? [])],\n proposedAt: e.at,\n });\n case \"accepted\":\n return changed({ bodySha256: e.data.body_sha256, acceptedBy: e.actor, decidedAt: e.at });\n case \"rejected\":\n case \"withdrawn\":\n return changed({ decidedAt: e.at });\n case \"deprecated\":\n return changed();\n case \"superseded\":\n return changed({ supersededBy: e.data.by });\n case \"noted\":\n return { ...s, notes: s.notes + 1 };\n case \"linked\": {\n const { to, rel } = e.data;\n const known = s.links.some((l) => l.to === to && l.rel === rel);\n return known ? s : { ...s, links: [...s.links, { to, rel }] };\n }\n case \"scoped\":\n return { ...s, appliesTo: [...e.data.set] };\n }\n}\n","import type { FoldedLog, FoldedSubject, KindFinding } from \"@nikovirtala/ledger\";\nimport type { DecisionState } from \"./reduce.js\";\nimport type { DecisionEvents, DecisionStatus } from \"./schemas.js\";\n\n/** Options of the decision kind's `invariants` and `relate`. */\nexport interface AdrOptions {\n /** Default `true`: an agent may propose, but only a human may accept (01:98). */\n readonly acceptRequiresHuman: boolean;\n}\n\ntype Subject = FoldedSubject<DecisionStatus, DecisionState, DecisionEvents>;\ntype Log = FoldedLog<DecisionStatus, DecisionState, DecisionEvents>;\n\n/** `decision/agent-accepted`: an applied `accepted` event written by an agent under the human policy. */\nexport function invariants(subject: Subject, options: AdrOptions): readonly KindFinding[] {\n if (!options.acceptRequiresHuman) return [];\n return subject.applied.flatMap(({ event }) =>\n event.type === \"accepted\" && event.actor.kind === \"agent\"\n ? [\n {\n severity: \"error\" as const,\n rule: \"decision/agent-accepted\",\n message: `accepted by agent ${event.actor.name}; accept_requires_human needs a human`,\n subject: subject.id,\n event: event.id,\n },\n ]\n : [],\n );\n}\n\n/**\n * Qualified ids (`<source>:<id>`) name decisions in other logs. Phase 1 checks local references\n * only and skips qualified ones, which only hand-written events can hold; CI checks them at the\n * pinned ref in phase 2 (design §E).\n */\nconst isQualified = (ref: string) => ref.includes(\":\");\n\n/**\n * Cross-subject rules: `decision/reference-missing` for a local `supersedes`, `superseded.by` or\n * `linked.to` naming no subject in the log; `decision/superseded-by-unaccepted` when the target of\n * an applied `superseded.by` has no applied `accepted` event in this tree; and\n * `decision/supersession-cycle`, once per cycle on its smallest id.\n */\nexport function relate(log: Log): readonly KindFinding[] {\n const out: KindFinding[] = [];\n const isAccepted = (id: string) =>\n log.subjects.get(id)?.applied.some((a) => a.event.type === \"accepted\") ?? false;\n const missing = (subject: string, event: string, ref: string, what: string) => {\n if (isQualified(ref) || log.subjects.has(ref)) return false;\n out.push({\n severity: \"error\",\n rule: \"decision/reference-missing\",\n message: `${what} ${ref}, which is not in the log`,\n subject,\n event,\n related: [ref],\n });\n return true;\n };\n\n for (const [id, s] of log.subjects) {\n for (const { event } of s.applied) {\n switch (event.type) {\n case \"proposed\":\n for (const ref of event.data.supersedes ?? []) missing(id, event.id, ref, \"supersedes\");\n break;\n case \"superseded\": {\n const by = event.data.by;\n if (missing(id, event.id, by, \"superseded by\") || isQualified(by)) break;\n if (!isAccepted(by)) {\n out.push({\n severity: \"error\",\n rule: \"decision/superseded-by-unaccepted\",\n message: `superseded by ${by}, which is not accepted`,\n subject: id,\n event: event.id,\n related: [by],\n });\n }\n break;\n }\n case \"linked\":\n missing(id, event.id, event.data.to, \"links to\");\n break;\n default:\n break;\n }\n }\n }\n\n const next = (id: string) => log.subjects.get(id)?.state?.supersededBy ?? null;\n const reported = new Set<string>();\n for (const start of log.subjects.keys()) {\n const path: string[] = [];\n let cur: string | null = start;\n while (cur !== null && !path.includes(cur)) {\n path.push(cur);\n cur = next(cur);\n }\n if (cur === null) continue;\n const cycle = path.slice(path.indexOf(cur));\n const smallest = [...cycle].sort()[0];\n if (smallest === undefined || reported.has(smallest)) continue;\n reported.add(smallest);\n const from = cycle.indexOf(smallest);\n const ordered = [...cycle.slice(from), ...cycle.slice(0, from), smallest];\n const event = log.subjects.get(smallest)?.applied.find((a) => a.event.type === \"superseded\")\n ?.event.id;\n out.push({\n severity: \"error\",\n rule: \"decision/supersession-cycle\",\n message: `supersession cycle: ${ordered.join(\" → \")}`,\n subject: smallest,\n ...(event === undefined ? {} : { event }),\n related: [...cycle].sort(),\n });\n }\n return out;\n}\n","import { eventType, setEventType } from \"@nikovirtala/ledger\";\n\n/** A decision's computed status. */\nexport type DecisionStatus =\n | \"proposed\"\n | \"accepted\"\n | \"rejected\"\n | \"withdrawn\"\n | \"deprecated\"\n | \"superseded\";\n\n/** Every status, in lifecycle order. */\nexport const DECISION_STATUSES: readonly DecisionStatus[] = Object.freeze([\n \"proposed\",\n \"accepted\",\n \"rejected\",\n \"withdrawn\",\n \"deprecated\",\n \"superseded\",\n]);\n\n/** A local subject id, or a qualified `<source>:<id>` one. */\nexport const REF = \"^(?:[a-z][a-z0-9-]*:)?[0-9a-hjkmnp-tv-z]{8}$\";\n\nconst ref = { type: \"string\", pattern: REF } as const;\nconst SINGLE_LINE = \"^[^\\\\r\\\\n]*$\";\n\n/** How a `linked` decision relates to its target. */\nexport type LinkRel = \"relates-to\" | \"refines\" | \"depends-on\";\n\n/** The decision kind's event types (01:128–136): data schemas, allowed states and targets. */\nexport const decisionEvents = {\n proposed: eventType<{\n title: string;\n template: string;\n template_version: number;\n supersedes?: string[];\n }>()({\n data: {\n type: \"object\",\n required: [\"title\", \"template\", \"template_version\"],\n properties: {\n title: { type: \"string\", minLength: 1, maxLength: 200, pattern: SINGLE_LINE },\n template: { type: \"string\", pattern: \"^[a-z][a-z0-9-]*$\" },\n template_version: { type: \"integer\", minimum: 1 },\n supersedes: { type: \"array\", items: ref, uniqueItems: true, maxItems: 20 },\n },\n },\n allowedIn: [],\n to: \"proposed\",\n }),\n accepted: eventType<{ body_sha256: string }>()({\n data: {\n type: \"object\",\n required: [\"body_sha256\"],\n properties: { body_sha256: { type: \"string\", pattern: \"^[0-9a-f]{64}$\" } },\n },\n allowedIn: [\"proposed\"],\n to: \"accepted\",\n }),\n rejected: eventType()({\n data: { type: \"object\" },\n allowedIn: [\"proposed\"],\n to: \"rejected\",\n reason: \"required\",\n }),\n withdrawn: eventType()({ data: { type: \"object\" }, allowedIn: [\"proposed\"], to: \"withdrawn\" }),\n deprecated: eventType()({\n data: { type: \"object\" },\n allowedIn: [\"accepted\"],\n to: \"deprecated\",\n reason: \"required\",\n }),\n superseded: eventType<{ by: string }>()({\n data: { type: \"object\", required: [\"by\"], properties: { by: ref } },\n allowedIn: [\"accepted\", \"deprecated\"],\n to: \"superseded\",\n }),\n noted: eventType<{ text: string }>()({\n data: {\n type: \"object\",\n required: [\"text\"],\n properties: { text: { type: \"string\", minLength: 1 } },\n },\n allowedIn: \"any\",\n to: null,\n }),\n linked: eventType<{ to: string; rel: LinkRel }>()({\n data: {\n type: \"object\",\n required: [\"to\", \"rel\"],\n properties: { to: ref, rel: { enum: [\"relates-to\", \"refines\", \"depends-on\"] } },\n },\n allowedIn: \"any\",\n to: null,\n }),\n // ledger's whole-set event (G11): the same schema as before, so decision/v1 is unchanged.\n scoped: setEventType({\n item: { type: \"string\", minLength: 1, maxLength: 500 },\n maxItems: 200,\n allowedIn: [\"proposed\", \"accepted\", \"deprecated\"],\n }),\n} as const;\n\nexport type DecisionEvents = typeof decisionEvents;\n","import { defineKind, type Kind } from \"@nikovirtala/ledger\";\nimport {\n type DecisionView,\n formatDecisionNumber,\n parseDecisionNumber,\n project,\n} from \"./kind/project.js\";\nimport { type DecisionState, reduce } from \"./kind/reduce.js\";\nimport { type AdrOptions, invariants, relate } from \"./kind/rules.js\";\nimport { type DecisionEvents, type DecisionStatus, decisionEvents } from \"./kind/schemas.js\";\n\nexport type { DecisionView } from \"./kind/project.js\";\nexport { formatDecisionNumber, parseDecisionNumber } from \"./kind/project.js\";\nexport type { DecisionState } from \"./kind/reduce.js\";\nexport type { AdrOptions } from \"./kind/rules.js\";\nexport {\n DECISION_STATUSES,\n type DecisionEvents,\n type DecisionStatus,\n type LinkRel,\n REF,\n} from \"./kind/schemas.js\";\n\n/**\n * The decision kind (01:128–194), as imported by other tools through `@nikovirtala/adr/kind`.\n *\n * Decisions are proposed, then accepted (which freezes the body and earns a number on main),\n * rejected or withdrawn; accepted ones can be deprecated or superseded. This module imports only\n * `@nikovirtala/ledger` and `./kind/*`, so importing the kind never loads CLI or MCP code.\n */\nexport const adrKind: Kind<\n DecisionStatus,\n DecisionEvents,\n DecisionState,\n DecisionView,\n AdrOptions\n> = defineKind<DecisionStatus, DecisionEvents, DecisionState, DecisionView, AdrOptions>({\n name: \"decision\",\n schema: \"decision/v1\",\n states: [\"proposed\", \"accepted\", \"rejected\", \"withdrawn\", \"deprecated\", \"superseded\"],\n events: decisionEvents,\n initial: \"proposed\",\n reduce,\n invariants,\n relate,\n project,\n body: { freezeOn: \"accepted\" },\n layout: { bodies: \"decisions\", events: \"events\" },\n defaultRoot: \"docs/adr\",\n sourceName: \"adr\",\n numbering: { on: \"accepted\", format: formatDecisionNumber, parse: parseDecisionNumber },\n templates: {\n dir: \"templates\",\n nameField: \"template\",\n versionField: \"template_version\",\n lintIn: [\"proposed\"],\n lintOn: \"accepted\",\n requireSections: [\"scope\"],\n },\n // A deprecated decision's globs no longer have to match code (design 2b §4.8).\n scope: { event: \"scoped\", activeIn: [\"proposed\", \"accepted\"] },\n options: Object.freeze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