adr-kit 0.12.0 → 0.14.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 -209
- package/README.zh.md +54 -174
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +40 -25
- package/dist/cli.js.map +1 -1
- package/dist/commands/archive.d.ts +2 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +62 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +5 -4
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/{accept.d.ts → implement.d.ts} +2 -2
- package/dist/commands/implement.d.ts.map +1 -0
- package/dist/commands/implement.js +42 -0
- package/dist/commands/implement.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/instructions.d.ts.map +1 -1
- package/dist/commands/instructions.js +24 -81
- package/dist/commands/instructions.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +9 -14
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/propose.d.ts.map +1 -1
- package/dist/commands/propose.js +9 -10
- package/dist/commands/propose.js.map +1 -1
- package/dist/commands/{decide.d.ts → record.d.ts} +2 -2
- package/dist/commands/record.d.ts.map +1 -0
- package/dist/commands/{decide.js → record.js} +6 -6
- package/dist/commands/{decide.js.map → record.js.map} +1 -1
- package/dist/commands/reject.d.ts +1 -1
- package/dist/commands/reject.d.ts.map +1 -1
- package/dist/commands/reject.js +24 -8
- package/dist/commands/reject.js.map +1 -1
- package/dist/commands/show.d.ts.map +1 -1
- package/dist/commands/show.js +2 -16
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +6 -17
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/supersede.d.ts.map +1 -1
- package/dist/commands/supersede.js +44 -10
- package/dist/commands/supersede.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +4 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +11 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/core/adr.d.ts +22 -20
- package/dist/core/adr.d.ts.map +1 -1
- package/dist/core/adr.js +97 -14
- package/dist/core/adr.js.map +1 -1
- package/dist/core/archive-seal.d.ts +48 -0
- package/dist/core/archive-seal.d.ts.map +1 -0
- package/dist/core/archive-seal.js +122 -0
- package/dist/core/archive-seal.js.map +1 -0
- package/dist/core/cli-options.d.ts +2 -2
- package/dist/core/cli-options.d.ts.map +1 -1
- package/dist/core/cli-options.js +8 -6
- package/dist/core/cli-options.js.map +1 -1
- package/dist/core/config.d.ts +1 -1
- package/dist/core/git.d.ts +17 -0
- package/dist/core/git.d.ts.map +1 -1
- package/dist/core/git.js +50 -0
- package/dist/core/git.js.map +1 -1
- package/dist/core/graph-html.js +5 -5
- package/dist/core/graph-html.js.map +1 -1
- package/dist/core/graph.d.ts +2 -1
- package/dist/core/graph.d.ts.map +1 -1
- package/dist/core/graph.js +9 -4
- package/dist/core/graph.js.map +1 -1
- package/dist/core/repository.d.ts +3 -11
- package/dist/core/repository.d.ts.map +1 -1
- package/dist/core/repository.js +52 -136
- package/dist/core/repository.js.map +1 -1
- package/dist/core/templates.d.ts +6 -7
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +11 -12
- package/dist/core/templates.js.map +1 -1
- package/dist/core/tool-integrations.d.ts +24 -0
- package/dist/core/tool-integrations.d.ts.map +1 -1
- package/dist/core/tool-integrations.js +129 -423
- package/dist/core/tool-integrations.js.map +1 -1
- package/dist/core/validate.d.ts +20 -6
- package/dist/core/validate.d.ts.map +1 -1
- package/dist/core/validate.js +302 -90
- package/dist/core/validate.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/accept.d.ts.map +0 -1
- package/dist/commands/accept.js +0 -42
- package/dist/commands/accept.js.map +0 -1
- package/dist/commands/decide.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -17,18 +17,12 @@
|
|
|
17
17
|
<img src="./assets/readme-banner.png" alt="ADR Kit" width="100%" />
|
|
18
18
|
</p>
|
|
19
19
|
|
|
20
|
-
ADR Kit
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
must say what problem it solves, what it chose, and what it gave up.
|
|
27
|
-
|
|
28
|
-
- fluid not rigid
|
|
29
|
-
- plain Markdown
|
|
30
|
-
- one decision, one file
|
|
31
|
-
- built for agents and humans alike
|
|
20
|
+
ADR Kit stores architecture decisions as plain Markdown across four lifecycle directories. It is an independent, agent-friendly decision-record tool: proposals are unshipped, implemented records describe shipped choices, rejections retain their rationale, and archives preserve frozen history.
|
|
21
|
+
|
|
22
|
+
- Plain Markdown and YAML front matter
|
|
23
|
+
- One choice per file, with explicit alternatives
|
|
24
|
+
- Stable ADR numbers assigned only when work ships
|
|
25
|
+
- Built for agents and humans
|
|
32
26
|
|
|
33
27
|
## Quick start
|
|
34
28
|
|
|
@@ -38,238 +32,97 @@ Requires Node.js 20.19 or later.
|
|
|
38
32
|
npm install -g adr-kit
|
|
39
33
|
cd your-project
|
|
40
34
|
adrkit init
|
|
41
|
-
adrkit
|
|
35
|
+
adrkit propose "Use SQLite for session storage"
|
|
36
|
+
# Fill the proposal; after the work ships:
|
|
37
|
+
adrkit implement "Use SQLite for session storage" --raised-by human --decided-by human
|
|
38
|
+
adrkit validate
|
|
42
39
|
```
|
|
43
40
|
|
|
44
|
-
`adrkit
|
|
41
|
+
For an architectural choice already shipped, use `adrkit record "<title>" --raised-by human --decided-by human` instead.
|
|
45
42
|
|
|
46
43
|
```text
|
|
47
44
|
adr/
|
|
48
|
-
├── config.yaml
|
|
49
|
-
├── README.md
|
|
50
|
-
├──
|
|
51
|
-
|
|
45
|
+
├── config.yaml
|
|
46
|
+
├── README.md
|
|
47
|
+
├── proposed/ # dated, unnumbered, unshipped
|
|
48
|
+
├── implemented/ # numbered, shipped, active guidance
|
|
49
|
+
├── rejected/ # dated, unnumbered, declined with reason
|
|
50
|
+
└── archived/ # numbered, frozen history
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
`adrkit
|
|
55
|
-
directly. Proposals are the exception, used only when a decision still needs
|
|
56
|
-
review. They are ephemeral drafts in `adr/.drafts/`: `adrkit propose` creates
|
|
57
|
-
one, `adrkit accept` promotes it to a numbered decision, and `adrkit reject`
|
|
58
|
-
discards it without leaving a record. Rejection is recorded in a decision's
|
|
59
|
-
`Alternatives considered`, never as a standalone record.
|
|
60
|
-
|
|
61
|
-
Fill in the decision, then:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
adrkit validate
|
|
65
|
-
adrkit list
|
|
66
|
-
```
|
|
53
|
+
An uncommitted proposal is a local working-tree draft; committing it shares it. There is no separate `.drafts/`. A choice settled by discussion remains proposed until shipped. `adrkit reject --reason` retains every formal rejection. `adrkit supersede --by` archives a fully replaced implemented decision; `adrkit archive --reason` retires one whose current behavior has another authoritative owner. Never archive by age or quota. Partial replacement leaves still-relevant guidance active. Both moves seal the archived file in `adr/archived/MANIFEST.json`; `adrkit validate` checks the seal and `adrkit validate --base <git-ref>` proves the archive only grows.
|
|
67
54
|
|
|
68
55
|
## Tell your agent
|
|
69
56
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```text
|
|
73
|
-
Use github.com/luochang212/adr-kit in this repository to automatically record key decisions. Prefer `adrkit decide`; use `adrkit propose` only when a decision still needs review. Every record declares two flags: `--raised-by` (who put the decision on the table) and `--decided-by` (whose judgment settled it). Use `human` when a person determined it, `agent` when it came from your own judgment, even if a person let it through.
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
To use decisions in later coding tasks, add the [reading rule](docs/workflow.md#read-decisions-before-coding)
|
|
77
|
-
to the project's `AGENTS.md` (and `CLAUDE.md` for Claude Code teams). Start tasks
|
|
78
|
-
with `adrkit list` and `adrkit show <N>` to read the existing decisions, then
|
|
79
|
-
check them against current code and requirements. The init skill guides this
|
|
80
|
-
setup; existing projects should run `adrkit update` and add the rule too.
|
|
81
|
-
The CLI does not edit project instruction files automatically.
|
|
82
|
-
Record only architectural choices that constrain future development and whose
|
|
83
|
-
rationale is not apparent from code alone; routine fixes need no ADR. See
|
|
84
|
-
[when to record](docs/workflow.md#when-to-record).
|
|
57
|
+
Add the [reading rule](docs/workflow.md#read-decisions-before-coding) to `AGENTS.md` or `CLAUDE.md`. At task start, run `adrkit list`, read relevant implemented records in full, check relevant proposed and rejected records, and use archives for history. Do not filter by title alone. The `adrkit-init` skill guides setup; `adrkit update` refreshes installed skills. Before creating a record, compare it with active records covering the same choice and resolve a full replacement with `adrkit supersede --by` in the same change; when shipping or reviewing, use the `adrkit-implement` and `adrkit-review` skills to keep realization facts aligned with shipped code.
|
|
85
58
|
|
|
86
59
|
## Commands
|
|
87
60
|
|
|
88
61
|
```text
|
|
89
62
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
90
|
-
|
|
91
|
-
adrkit
|
|
92
|
-
|
|
93
|
-
adrkit
|
|
94
|
-
adrkit
|
|
95
|
-
|
|
96
|
-
adrkit
|
|
97
|
-
adrkit
|
|
98
|
-
adrkit
|
|
99
|
-
adrkit
|
|
100
|
-
adrkit
|
|
101
|
-
adrkit instructions Print the next step; flag pending drafts as ready or needing work
|
|
102
|
-
adrkit validate [name] [--all] Validate one record or the repository
|
|
63
|
+
adrkit propose <title>
|
|
64
|
+
adrkit implement <name> --raised-by <human|agent> --decided-by <human|agent>
|
|
65
|
+
adrkit record <title> --raised-by <human|agent> --decided-by <human|agent>
|
|
66
|
+
adrkit reject <name> --reason <text>
|
|
67
|
+
adrkit archive <name> --reason <text>
|
|
68
|
+
adrkit supersede <old> --by <new>
|
|
69
|
+
adrkit list
|
|
70
|
+
adrkit show <name>
|
|
71
|
+
adrkit status
|
|
72
|
+
adrkit instructions
|
|
73
|
+
adrkit validate [name] [--all] [--base <git-ref>]
|
|
103
74
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
104
|
-
|
|
105
|
-
adrkit config Print the current configuration
|
|
75
|
+
adrkit config
|
|
106
76
|
adrkit graph [--mermaid|--dot|--text|--html] [--formal-only] [--tag <tag>] [--out <path>]
|
|
107
|
-
|
|
108
|
-
adrkit
|
|
109
|
-
adrkit
|
|
110
|
-
adrkit version Print the version
|
|
77
|
+
adrkit tree <name> [--mermaid|--text|--html]
|
|
78
|
+
adrkit completion <bash|zsh|fish>
|
|
79
|
+
adrkit version
|
|
111
80
|
```
|
|
112
81
|
|
|
113
|
-
|
|
114
|
-
> Integrations install into the open [`.agents/`](https://agents.md/) standard
|
|
115
|
-
> by default: one set of skills and slash commands every mainstream agent
|
|
116
|
-
> reads. Claude Code is the one holdout: it even [closed the AGENTS.md support
|
|
117
|
-
> request](https://github.com/anthropics/claude-code/issues/6235), and Shopify's
|
|
118
|
-
> CEO [publicly threatened to ban it over this](https://thenewstack.io/shopify-claude-code-agentsmd/).
|
|
119
|
-
> If your team uses Claude Code, pass `--tools claude` to also install
|
|
120
|
-
> `.claude/` copies; an exception we carry until Anthropic adopts the standard.
|
|
121
|
-
|
|
122
|
-
> [!TIP]
|
|
123
|
-
> Every integration ships all nine workflow skills by default. A small
|
|
124
|
-
> repository that only records decisions can pass
|
|
125
|
-
> `--workflows init,decide,validate` to install a lean subset; the choice is
|
|
126
|
-
> recorded in `adr/config.yaml`, `adrkit update` keeps it, and
|
|
127
|
-
> `--workflows all` restores the full set.
|
|
128
|
-
|
|
129
|
-
`<name>` resolves by title, file name, or decision number (`1`).
|
|
130
|
-
|
|
131
|
-
## Docs
|
|
132
|
-
|
|
133
|
-
| Document | Content |
|
|
134
|
-
| --- | --- |
|
|
135
|
-
| [CLI reference](https://github.com/luochang212/adr-kit/blob/main/docs/cli.md) | Command reference with arguments and output shapes |
|
|
136
|
-
| [Record format](https://github.com/luochang212/adr-kit/blob/main/docs/record-format.md) | ADR file format and validation rules |
|
|
137
|
-
| [Workflow](https://github.com/luochang212/adr-kit/blob/main/docs/workflow.md) | Lifecycle from proposal to decision |
|
|
138
|
-
| [Agent skills](https://github.com/luochang212/adr-kit/blob/main/skills/README.md) | Agent skills that drive the `adrkit` CLI |
|
|
82
|
+
By default, integrations install into `.agents/`. Pass `--tools claude` for additional `.claude/` copies, or `--tools none` to install none. `--workflows` selects a subset such as `init,propose,implement,validate`.
|
|
139
83
|
|
|
140
84
|
## Record format
|
|
141
85
|
|
|
142
|
-
|
|
86
|
+
A shipped decision is `adr/implemented/N-slug.md`:
|
|
143
87
|
|
|
144
88
|
```markdown
|
|
145
89
|
---
|
|
146
|
-
status:
|
|
147
|
-
date: 2026-
|
|
90
|
+
status: implemented
|
|
91
|
+
date: 2026-09-25
|
|
148
92
|
raised-by: human
|
|
149
93
|
decided-by: human
|
|
150
|
-
created: 2026-
|
|
151
|
-
|
|
152
|
-
tags: [frontend]
|
|
94
|
+
created: 2026-09-24
|
|
95
|
+
tags: [storage]
|
|
153
96
|
---
|
|
154
97
|
|
|
155
98
|
# ADR: 1 Use SQLite for session storage
|
|
156
99
|
|
|
157
100
|
## Problem
|
|
101
|
+
|
|
102
|
+
...
|
|
103
|
+
|
|
104
|
+
## Decision
|
|
105
|
+
|
|
106
|
+
...
|
|
107
|
+
|
|
108
|
+
## Alternatives considered
|
|
109
|
+
|
|
158
110
|
...
|
|
159
|
-
```
|
|
160
111
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
re-stamped, so the time axis survives later lifecycle moves. Optional
|
|
165
|
-
`tags` (kebab-case keywords) let `adrkit graph` group and filter decisions
|
|
166
|
-
by theme. Decisions are immutable history; the current facts
|
|
167
|
-
live in code, not in the record.
|
|
168
|
-
|
|
169
|
-
`accepted` denotes a recorded decision, not proof of human review.
|
|
170
|
-
`raised-by` and `decided-by` are each `human` or `agent`, declared when
|
|
171
|
-
`decide` or `accept` runs: `raised-by` is who put the decision on the table,
|
|
172
|
-
and `decided-by` is whose judgment settled it. For `decided-by`, `human`
|
|
173
|
-
means a person determined the direction (they stated it, changed a proposal into
|
|
174
|
-
what shipped, or you are recording one they made earlier), `agent` when it came
|
|
175
|
-
from the agent's own judgment, including when a person only let it through. The
|
|
176
|
-
CLI records the declarations without inferring or verifying them, so the fields
|
|
177
|
-
do not establish who chose or authorized the decision; when who proposed and who
|
|
178
|
-
approved matters, write it in the body. `supersede` preserves both original
|
|
179
|
-
values. See the
|
|
180
|
-
[record format reference](docs/record-format.md) for limitations. Identity
|
|
181
|
-
stays in git.
|
|
182
|
-
|
|
183
|
-
- **Decisions** (`adr/decisions/N-slug.md`) are `accepted` or `superseded`
|
|
184
|
-
and require `Problem`, `Decision`, `Alternatives considered`, and
|
|
185
|
-
`Consequences`; proposal-era headings are rejected by `validate`.
|
|
186
|
-
- **Drafts** (`adr/.drafts/YYYY-MM-DD-slug.md`) are ephemeral proposals with
|
|
187
|
-
`status: proposed`, require `Problem`, `Proposal`, `Alternatives
|
|
188
|
-
considered`, `Acceptance criteria`, and `Risks`, and are never checked by
|
|
189
|
-
`validate`: `adrkit accept` validates a draft right before promoting it.
|
|
190
|
-
- **Rejected** ideas are not standalone records: a decision's
|
|
191
|
-
`Alternatives considered` documents what was considered and why it lost.
|
|
192
|
-
- **Superseded** decisions stay in `adr/decisions/` as history, with the
|
|
193
|
-
replacing decision in the front matter: `status: superseded` plus
|
|
194
|
-
`superseded-by: N`.
|
|
195
|
-
`adrkit supersede <old> --by <new>` performs the rewrite; `validate`
|
|
196
|
-
checks that the complete replacement chain exists, has no cycles, and
|
|
197
|
-
ends at an accepted decision. Historical links are preserved.
|
|
198
|
-
|
|
199
|
-
`adrkit accept` performs the mechanical rewrite a lifecycle move always
|
|
200
|
-
owed: `## Proposal` becomes `## Decision`, and `Acceptance criteria` plus
|
|
201
|
-
`Risks` are folded into `## Consequences`.
|
|
202
|
-
|
|
203
|
-
A decision may also carry an optional `## Deliberation` appendix: the design
|
|
204
|
-
tree behind the choice, stored as a nested Markdown list whose nodes may be
|
|
205
|
-
tagged `[settled]`, `[rejected]`, or `[open]`. A follow-up question is
|
|
206
|
-
nested under the node that raised it, so related questions run deeper and
|
|
207
|
-
unrelated ones stay flat. Render it with `adrkit tree <name>` (text by default,
|
|
208
|
-
`--mermaid` for a graph, `--html` for an offline interactive card tree). The
|
|
209
|
-
`adrkit-grill` workflow produces that tree and records every decision the
|
|
210
|
-
session settles. The whole set renders as an interactive offline decision map with
|
|
211
|
-
`adrkit graph --html`, which marks the decisions that carry a tree. Ask your
|
|
212
|
-
agent to visualize a recorded decision or the whole set with `adrkit-visualize`;
|
|
213
|
-
it uses the built-in renderer, opens the result in your default browser, and
|
|
214
|
-
returns an HTML file link. Ask for a file only to skip opening the browser. If
|
|
215
|
-
opening is unavailable or fails, the agent explains and keeps the link. HTML is
|
|
216
|
-
not a default grilling deliverable.
|
|
217
|
-
Run `adrkit update` to refresh installed skills.
|
|
218
|
-
|
|
219
|
-
```sh
|
|
220
|
-
adrkit tree 7 --html > "adr-7.html"
|
|
112
|
+
## Consequences
|
|
113
|
+
|
|
114
|
+
...
|
|
221
115
|
```
|
|
222
116
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
| [OpenSpec](https://github.com/Fission-AI/OpenSpec) | Forward-looking: specifies what to build | Complementary: specs vs records |
|
|
233
|
-
| [Changesets](https://changesets.dev) | Release tooling: versions and changelog | Orthogonal: cite the ADR number in the changeset body |
|
|
234
|
-
|
|
235
|
-
When a change makes an architectural decision that should outlive the
|
|
236
|
-
change, record it as an ADR.
|
|
237
|
-
|
|
238
|
-
## Sources of Inspiration
|
|
239
|
-
|
|
240
|
-
ADR Kit stands on two projects, in two different roles:
|
|
241
|
-
|
|
242
|
-
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** shaped *how* the
|
|
243
|
-
tool is built: an agent-first CLI whose instructions are installed as
|
|
244
|
-
agent skills, a deterministic `validate`, and a "fluid not rigid" workflow.
|
|
245
|
-
Like OpenSpec, ADR Kit
|
|
246
|
-
*steers* agents: session-visible skills rather than imposing hard phase
|
|
247
|
-
gates or mandating that every change be recorded.
|
|
248
|
-
- **[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
249
|
-
gave ADR Kit *what a record is*. Its **Agent Notes**: plain Markdown
|
|
250
|
-
with a `Status:` line, lifecycle folders
|
|
251
|
-
(`proposed` → `implemented` → `rejected`, plus a frozen archive), and a
|
|
252
|
-
`Problem` / `Proposal`·`Decision` / `Alternatives considered` /
|
|
253
|
-
`Consequences` skeleton: that is the direct ancestor of the ADR Kit record
|
|
254
|
-
format.
|
|
255
|
-
|
|
256
|
-
Adapted, not copied. Accepted records carry a `N` number, `supersede`
|
|
257
|
-
retires a decision in place, and `accept` mechanically rewrites a proposal
|
|
258
|
-
into a decision. Records are immutable once accepted: a decision record is
|
|
259
|
-
history, and current facts live in code, not in the record.
|
|
260
|
-
|
|
261
|
-
## Philosophy
|
|
262
|
-
|
|
263
|
-
- **The record is the source of truth.** Code comments rot, docs drift; an
|
|
264
|
-
ADR that says what was decided and what was given up stays useful.
|
|
265
|
-
- **Alternatives are mandatory.** A decision recorded without what it beat
|
|
266
|
-
invites re-litigation.
|
|
267
|
-
- **Lifecycle is mechanical, not editorial.** Promoting a draft and retiring
|
|
268
|
-
an accepted decision are commands (`accept`, `supersede`), and `validate`
|
|
269
|
-
enforces the resulting shape.
|
|
270
|
-
- **Agents are first-class users.** The record is the interface: plain
|
|
271
|
-
Markdown with YAML front matter an agent reads directly, at predictable
|
|
272
|
-
paths, with `validate` as the machine check.
|
|
117
|
+
Proposals use dated filenames and `Problem`, `Proposal`, `Alternatives considered`, `Acceptance criteria`, and `Risks`. The CLI stamps `date` on lifecycle moves; `created` preserves the birth date. `raised-by` and `decided-by` declare who introduced and settled a shipped choice, not who ran the command or authorized deployment. The CLI cannot verify shipping or provenance. `tags` remain the thematic classification; no class directory is needed. `adrkit validate` checks all four folders; fresh templates intentionally fail until filled.
|
|
118
|
+
|
|
119
|
+
An implemented record may refresh factual paths, symbols, or defaults, but not rewrite the choice or rationale into another decision. A changed choice needs a new record and relationship. Full supersession stamps `superseded-by: N` and moves the old record to `archived/`. Archived records keep their numbers and are historical, not current authority. The graph includes numbered history; `## Deliberation` optionally preserves the design tree.
|
|
120
|
+
|
|
121
|
+
See [record format](docs/record-format.md), [workflow](docs/workflow.md), and [CLI reference](docs/cli.md).
|
|
122
|
+
|
|
123
|
+
## Sources of inspiration
|
|
124
|
+
|
|
125
|
+
[DeepSeek Harness Agent Notes](https://github.com/deepseek-ai/deepseek-harness) inspired the lifecycle directories and the distinction between proposed, implemented, rejected, and archived. ADR Kit keeps its own provenance fields, numbered decisions, validation, deliberation tree, and graph. OpenSpec is not part of ADR Kit's runtime or governance model.
|
|
273
126
|
|
|
274
127
|
## Development
|
|
275
128
|
|
|
@@ -282,4 +135,4 @@ npm run build
|
|
|
282
135
|
|
|
283
136
|
## License
|
|
284
137
|
|
|
285
|
-
|
|
138
|
+
MIT.
|
package/README.zh.md
CHANGED
|
@@ -17,227 +17,107 @@
|
|
|
17
17
|
<img src="./assets/readme-banner.png" alt="ADR Kit" width="100%" />
|
|
18
18
|
</p>
|
|
19
19
|
|
|
20
|
-
ADR Kit
|
|
21
|
-
(**accepted / superseded**);提案是临时草稿,要么变成决策、要么消失。它借鉴了
|
|
22
|
-
[OpenSpec](https://github.com/Fission-AI/OpenSpec) 的 spec-driven 思路,以及
|
|
23
|
-
agent 原生代码库的决策记录纪律:每条记录都必须说明它解决什么问题、选择了什么、
|
|
24
|
-
放弃了什么。
|
|
25
|
-
|
|
26
|
-
- 灵活而不僵化
|
|
27
|
-
- 纯 Markdown
|
|
28
|
-
- 一个决策一个文件
|
|
29
|
-
- 同时服务人类和 agent
|
|
20
|
+
ADR Kit 用纯 Markdown 记录架构决策,并以四个目录表示完整生命周期:`proposed/` 是未交付提案,`implemented/` 是已交付且仍有指导意义的决策,`rejected/` 保存正式否决及理由,`archived/` 保存冻结历史。它是独立的、面向人与 agent 的决策记录工具。
|
|
30
21
|
|
|
31
22
|
## 快速开始
|
|
32
23
|
|
|
33
|
-
需要 Node.js 20.19
|
|
24
|
+
需要 Node.js 20.19 或更新版本。
|
|
34
25
|
|
|
35
26
|
```bash
|
|
36
27
|
npm install -g adr-kit
|
|
37
28
|
cd your-project
|
|
38
29
|
adrkit init
|
|
39
|
-
adrkit
|
|
30
|
+
adrkit propose "使用 SQLite 存储会话"
|
|
31
|
+
# 填写提案,实际交付后:
|
|
32
|
+
adrkit implement "使用 SQLite 存储会话" --raised-by human --decided-by human
|
|
33
|
+
adrkit validate
|
|
40
34
|
```
|
|
41
35
|
|
|
42
|
-
`adrkit
|
|
36
|
+
已交付但尚未记录的选择可直接用 `adrkit record "<标题>" --raised-by human --decided-by human`。
|
|
43
37
|
|
|
44
38
|
```text
|
|
45
39
|
adr/
|
|
46
|
-
├── config.yaml
|
|
47
|
-
├── README.md
|
|
48
|
-
├──
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`adrkit decide` 是默认路径,直接记录已成定局的决策。需要评审时,提案是
|
|
53
|
-
`adr/.drafts/` 里的临时草稿:`adrkit propose` 创建一条,`adrkit accept` 把它
|
|
54
|
-
提升为编号决策,`adrkit reject` 直接丢弃、不留下任何记录。拒绝记录在决策的
|
|
55
|
-
`Alternatives considered` 里,从不是独立记录。
|
|
56
|
-
|
|
57
|
-
填写决策内容后:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
adrkit validate
|
|
61
|
-
adrkit list
|
|
40
|
+
├── config.yaml
|
|
41
|
+
├── README.md
|
|
42
|
+
├── proposed/ # 按日期命名,未编号,尚未交付
|
|
43
|
+
├── implemented/ # 已编号、已交付,当前指导
|
|
44
|
+
├── rejected/ # 按日期命名,保留否决理由
|
|
45
|
+
└── archived/ # 保留编号,冻结历史
|
|
62
46
|
```
|
|
63
47
|
|
|
64
|
-
|
|
48
|
+
未提交的提案只是本地工作树草稿;Git 提交后成为共享提案,不另设 `.drafts/`。讨论已定方向但尚未交付时仍在 `proposed/`。正式否决必须用 `adrkit reject --reason` 留痕。完整替代用 `adrkit supersede --by` 并自动归档旧记录;当现状已有其他权威来源、原决策不再指导未来时,可用 `adrkit archive --reason` 归档。不要按年龄或配额归档;部分替代仍保留有效的现行记录。两次转移都会把归档文件封存进 `adr/archived/MANIFEST.json`;`adrkit validate` 检查封存,`adrkit validate --base <git-ref>` 证明归档只增不改。
|
|
65
49
|
|
|
66
|
-
|
|
50
|
+
## 告诉 Agent
|
|
67
51
|
|
|
68
|
-
|
|
69
|
-
在本仓库用 github.com/luochang212/adr-kit 自动记录关键决策。优先用 `adrkit decide`,仅当决策还需评审时才用 `adrkit propose`。每条记录都要声明两个值:`raised-by`(谁把决策提上台面)与 `decided-by`(谁的判断定下它);方向由人决定用 `human`,由你自己的判断得出用 `agent`,即使人只是放行。
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
让后续编码任务也用上决策:在项目 `AGENTS.md`(Claude Code 团队也包括
|
|
73
|
-
`CLAUDE.md`)加入[查阅规则](docs/zh/workflow.md#编码前查阅决策)。任务开始时用
|
|
74
|
-
`adrkit list`、`adrkit show <N>` 读完现有决策,结合代码和新需求判断是否仍适用。
|
|
75
|
-
初始化技能会引导补入规则;已有项目运行 `adrkit update` 后也需补入。
|
|
76
|
-
CLI 不会自动修改项目指令文件。只有持续约束后续开发、且理由难以从代码直接
|
|
77
|
-
看出的架构选择才值得记录;普通修复无需 ADR,详见[记录门槛](docs/zh/workflow.md#何时值得记录)。
|
|
52
|
+
将[任务开始阅读规则](docs/zh/workflow.md#任务开始前阅读决策)加入 `AGENTS.md` 或 `CLAUDE.md`。任务开始时先运行 `adrkit list`,完整阅读相关的 implemented 记录,检查相关 proposed/rejected 记录,仅在需要历史上下文时读 archived。不能只看标题判断相关性。`adrkit-init` 指导配置,`adrkit update` 刷新已安装技能。创建记录前,先与涉及同一选择的现行记录比较,完整替代在同一次变更中用 `adrkit supersede --by` 解析;交付或审查时用 `adrkit-implement` 和 `adrkit-review` 技能保持实现事实与已交付代码一致。
|
|
78
53
|
|
|
79
54
|
## 命令
|
|
80
55
|
|
|
81
56
|
```text
|
|
82
57
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
83
|
-
|
|
84
|
-
adrkit
|
|
85
|
-
|
|
86
|
-
adrkit
|
|
87
|
-
adrkit
|
|
88
|
-
|
|
89
|
-
adrkit
|
|
90
|
-
adrkit
|
|
91
|
-
adrkit
|
|
92
|
-
adrkit
|
|
93
|
-
adrkit
|
|
94
|
-
adrkit instructions 查看下一步;标注待决草稿已就绪或需修改
|
|
95
|
-
adrkit validate [name] [--all] 校验单条记录或整个仓库
|
|
58
|
+
adrkit propose <title>
|
|
59
|
+
adrkit implement <name> --raised-by <human|agent> --decided-by <human|agent>
|
|
60
|
+
adrkit record <title> --raised-by <human|agent> --decided-by <human|agent>
|
|
61
|
+
adrkit reject <name> --reason <text>
|
|
62
|
+
adrkit archive <name> --reason <text>
|
|
63
|
+
adrkit supersede <old> --by <new>
|
|
64
|
+
adrkit list
|
|
65
|
+
adrkit show <name>
|
|
66
|
+
adrkit status
|
|
67
|
+
adrkit instructions
|
|
68
|
+
adrkit validate [name] [--all] [--base <git-ref>]
|
|
96
69
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
97
|
-
|
|
98
|
-
adrkit config 查看当前配置
|
|
70
|
+
adrkit config
|
|
99
71
|
adrkit graph [--mermaid|--dot|--text|--html] [--formal-only] [--tag <tag>] [--out <path>]
|
|
100
|
-
|
|
101
|
-
adrkit
|
|
102
|
-
adrkit
|
|
103
|
-
adrkit version 查看版本
|
|
72
|
+
adrkit tree <name> [--mermaid|--text|--html]
|
|
73
|
+
adrkit completion <bash|zsh|fish>
|
|
74
|
+
adrkit version
|
|
104
75
|
```
|
|
105
76
|
|
|
106
|
-
|
|
107
|
-
> 集成默认写入开放的 [`.agents/`](https://agents.md/) 标准:一套技能和斜杠
|
|
108
|
-
> 命令,所有主流 Agent 通用。Claude Code 是唯一的例外:它不仅[关闭了
|
|
109
|
-
> AGENTS.md 支持请求](https://github.com/anthropics/claude-code/issues/6235),
|
|
110
|
-
> 还让 [Shopify CEO 公开放话要因此禁用它](https://thenewstack.io/shopify-claude-code-agentsmd/)。
|
|
111
|
-
> 如果你的团队用 Claude Code,加 `--tools claude` 会同时安装 `.claude/`
|
|
112
|
-
> 副本;这个例外我们一直背到 Anthropic 采纳标准为止。
|
|
113
|
-
|
|
114
|
-
> [!TIP]
|
|
115
|
-
> 集成默认安装全部九个工作流技能。只记录决策的小仓库可传
|
|
116
|
-
> `--workflows init,decide,validate` 装精简子集;选择会写入
|
|
117
|
-
> `adr/config.yaml`,`adrkit update` 会保持,`--workflows all` 恢复全套。
|
|
118
|
-
|
|
119
|
-
`<name>` 支持按标题、文件名或决策编号(`1`)查找。
|
|
120
|
-
|
|
121
|
-
## 文档
|
|
122
|
-
|
|
123
|
-
| 文档 | 内容 |
|
|
124
|
-
| --- | --- |
|
|
125
|
-
| [CLI 参考](https://github.com/luochang212/adr-kit/blob/main/docs/zh/cli.md) | 命令参考:参数与输出形态 |
|
|
126
|
-
| [记录格式](https://github.com/luochang212/adr-kit/blob/main/docs/zh/record-format.md) | ADR 文件格式与校验规则 |
|
|
127
|
-
| [工作流](https://github.com/luochang212/adr-kit/blob/main/docs/zh/workflow.md) | 从提案到决策的生命周期 |
|
|
128
|
-
| [Agent 技能](https://github.com/luochang212/adr-kit/blob/main/skills/README.md) | 驱动 `adrkit` CLI 的 agent 技能 |
|
|
77
|
+
默认把集成安装到 `.agents/`;`--tools claude` 另装 `.claude/`,`--tools none` 不安装。可用 `--workflows init,propose,implement,validate` 选子集。
|
|
129
78
|
|
|
130
79
|
## 记录格式
|
|
131
80
|
|
|
132
|
-
|
|
81
|
+
已交付决策在 `adr/implemented/N-slug.md`:
|
|
133
82
|
|
|
134
83
|
```markdown
|
|
135
84
|
---
|
|
136
|
-
status:
|
|
137
|
-
date: 2026-
|
|
85
|
+
status: implemented
|
|
86
|
+
date: 2026-09-25
|
|
138
87
|
raised-by: human
|
|
139
88
|
decided-by: human
|
|
140
|
-
created: 2026-
|
|
141
|
-
|
|
142
|
-
tags: [frontend]
|
|
89
|
+
created: 2026-09-24
|
|
90
|
+
tags: [storage]
|
|
143
91
|
---
|
|
144
92
|
|
|
145
93
|
# ADR: 1 使用 SQLite 存储会话
|
|
146
94
|
|
|
147
95
|
## Problem
|
|
96
|
+
|
|
148
97
|
...
|
|
149
|
-
```
|
|
150
98
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
取值都是 `human` 或 `agent`,在 `decide` 或 `accept` 时声明:`raised-by` 是
|
|
159
|
-
谁把决策提上台面,`decided-by` 是谁的判断定下了它。`decided-by` 取 `human`
|
|
160
|
-
表示方向由人决定(人说出的、人把 agent 的提案改成最终落地方案的、或人此前定过
|
|
161
|
-
而现在只是补记的),取 `agent` 表示由 AI 自主判断得出,包括人只是放行的情况。
|
|
162
|
-
CLI 既不推断也不校验,只记录声明,所以它不能证明是谁自主拍板或授权;谁改写、
|
|
163
|
-
谁批准写进正文。`supersede` 保留两个原值。局限见
|
|
164
|
-
[记录格式参考](docs/zh/record-format.md)。身份留在 git 里。
|
|
165
|
-
|
|
166
|
-
- **决策**(`adr/decisions/N-slug.md`)是 `accepted` 或 `superseded`,
|
|
167
|
-
需要 `Problem`、`Decision`、`Alternatives considered`、`Consequences`;
|
|
168
|
-
`validate` 会拒绝提案时代的标题出现在已接受决策中。
|
|
169
|
-
- **草稿**(`adr/.drafts/YYYY-MM-DD-slug.md`)是 `status: proposed` 的临时
|
|
170
|
-
提案,需要 `Problem`、`Proposal`、`Alternatives considered`、
|
|
171
|
-
`Acceptance criteria`、`Risks`,`validate` 不检查它们:`adrkit accept`
|
|
172
|
-
在提升前才校验草稿。
|
|
173
|
-
- **被否决**的想法不是独立记录:决策的 `Alternatives considered` 记录了
|
|
174
|
-
考虑过什么、为什么落选。
|
|
175
|
-
- **Superseded** 决策保留在 `adr/decisions/` 作为历史,front matter 指向
|
|
176
|
-
取代它的决策:`status: superseded` 加 `superseded-by: N`。
|
|
177
|
-
`adrkit supersede <旧> --by <新>` 完成改写;
|
|
178
|
-
`validate` 沿完整替代链检查引用均存在、没有循环,且最终到达 accepted 决策;
|
|
179
|
-
保留各次替代的历史链接。
|
|
180
|
-
|
|
181
|
-
`adrkit accept` 会自动完成生命周期迁移所要求的改写:`## Proposal` 改为
|
|
182
|
-
`## Decision`,`Acceptance criteria` 与 `Risks` 合并进 `## Consequences`。
|
|
183
|
-
|
|
184
|
-
决策还可以携带可选的 `## Deliberation` 附录:记录选择背后的 design tree,
|
|
185
|
-
用嵌套 Markdown 列表存储,节点可标注 `[settled]`、`[rejected]`、`[open]`。
|
|
186
|
-
后续问题嵌在提出它的节点之下,因此相关问题更深、无关问题平铺。用 `adrkit tree
|
|
187
|
-
<name>` 渲染(默认文本,加 `--mermaid` 输出图形,加 `--html` 输出离线交互卡片树)。这
|
|
188
|
-
棵树通常来自 `adrkit-grill` 工作流,它记录会话定下的每个决策。
|
|
189
|
-
需要时让 AI 用 `adrkit-visualize` 可视化指定决策或整套决策。它会调用内置渲染器,主动用默认浏览器打开,
|
|
190
|
-
并提供 HTML 文件链接。明确要求“只生成文件”或“不要打开”时不打开浏览器;
|
|
191
|
-
无法打开时会说明原因并保留链接。HTML 不是 grilling 的默认交付。
|
|
192
|
-
整套决策可用 `adrkit graph --html` 渲染为可交互的离线决策地图,并标出带 deliberation 树的决策。
|
|
193
|
-
用 `adrkit update` 更新已安装的技能。
|
|
194
|
-
|
|
195
|
-
```sh
|
|
196
|
-
adrkit tree 7 --html > "adr-7.html"
|
|
197
|
-
```
|
|
99
|
+
## Decision
|
|
100
|
+
|
|
101
|
+
...
|
|
102
|
+
|
|
103
|
+
## Alternatives considered
|
|
104
|
+
|
|
105
|
+
...
|
|
198
106
|
|
|
199
|
-
##
|
|
107
|
+
## Consequences
|
|
108
|
+
|
|
109
|
+
...
|
|
110
|
+
```
|
|
200
111
|
|
|
201
|
-
|
|
202
|
-
与任何不占用该布局的工具共处于一个仓库。它的 agent skills 按工具命名空间
|
|
203
|
-
隔离(`adrkit-*`),`adrkit update` 只重写自己的集成文件。
|
|
112
|
+
提案按日期命名,使用 `Problem`、`Proposal`、`Alternatives considered`、`Acceptance criteria`、`Risks`。`date` 在每次生命周期转移时由 CLI 写入;`created` 保留创建日期。`raised-by` 与 `decided-by` 分别声明谁提出、谁定下已交付选择,不表示谁运行命令或批准部署。CLI 不能验证交付或来源。`tags` 提供主题分类,不额外引入类别目录。`adrkit validate` 检查全部四个目录;新模板未填完时按预期失败。
|
|
204
113
|
|
|
205
|
-
|
|
206
|
-
|---|---|---|
|
|
207
|
-
| [OpenSpec](https://github.com/Fission-AI/OpenSpec) | 前瞻:规定要构建什么 | 互补:规格与记录各司其职 |
|
|
208
|
-
| [Changesets](https://changesets.dev) | 发布:版本号与 changelog | 正交:changeset 正文引用 ADR 编号 |
|
|
114
|
+
implemented 记录可以更新路径、符号、默认值等已交付事实,但不可悄悄重写选择或理由。选择改变应新建记录并建立关系。完整替代写入 `superseded-by: N`,旧记录移入 `archived/`;归档记录保持编号,只作历史参考。图谱包含编号历史,可选 `## Deliberation` 附录保留思辨树。
|
|
209
115
|
|
|
210
|
-
|
|
116
|
+
详见[记录格式](docs/zh/record-format.md)、[工作流](docs/zh/workflow.md)与[CLI 参考](docs/zh/cli.md)。
|
|
211
117
|
|
|
212
118
|
## 灵感来源
|
|
213
119
|
|
|
214
|
-
ADR Kit
|
|
215
|
-
|
|
216
|
-
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** 决定了这个工具*怎么建*:
|
|
217
|
-
agent 优先的 CLI、指令以 agent skills 安装、确定性的 `validate`,
|
|
218
|
-
以及"灵活而不僵化"的工作流。和 OpenSpec 一样,
|
|
219
|
-
ADR Kit 靠*引导* agent(会话开始可见的 skills),而不是硬性阶段门禁,
|
|
220
|
-
也不强制每次变更都记录。
|
|
221
|
-
- **[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
222
|
-
决定了 ADR Kit 里*记录是什么*。它的 **Agent Notes**:带 `Status:` 行的
|
|
223
|
-
纯 Markdown、生命周期文件夹(`proposed` → `implemented` → `rejected`,
|
|
224
|
-
外加冻结归档)、以及 `Problem` / `Proposal`·`Decision` /
|
|
225
|
-
`Alternatives considered` / `Consequences` 骨架,是 ADR Kit 记录格式的
|
|
226
|
-
直接祖先。
|
|
227
|
-
|
|
228
|
-
是改编,不是照抄。已接受记录带 `N` 编号,`supersede` 原地退役一条决策,
|
|
229
|
-
`accept` 机械地把提案改写成决策。记录一旦接受就不可变:决策记录是历史,
|
|
230
|
-
当前事实以代码为准,不在记录里。
|
|
231
|
-
|
|
232
|
-
## 理念
|
|
233
|
-
|
|
234
|
-
- **记录是事实来源。** 代码注释会腐化,文档会漂移;一条写明了决定与代价的
|
|
235
|
-
ADR 会持续有用。
|
|
236
|
-
- **备选方案是强制项。** 没有记录被否决方案的决策,是在邀请未来的重复争论。
|
|
237
|
-
- **生命周期是机械操作,不是编辑操作。** 提升草稿、退役已接受决策都是命令
|
|
238
|
-
(`accept`、`supersede`),`validate` 强制检查结果形态。
|
|
239
|
-
- **Agent 是一等用户。** 记录本身就是接口:纯 Markdown 加 YAML front matter,
|
|
240
|
-
agent 直接读,路径可预测,`validate` 充当机器检查。
|
|
120
|
+
[DeepSeek Harness Agent Notes](https://github.com/deepseek-ai/deepseek-harness) 启发了生命周期目录及 proposed、implemented、rejected、archived 的语义。ADR Kit 保留自身的来源声明、稳定编号、校验、思辨树和关系图。OpenSpec 不是运行时或治理依赖。
|
|
241
121
|
|
|
242
122
|
## 开发
|
|
243
123
|
|
|
@@ -250,4 +130,4 @@ npm run build
|
|
|
250
130
|
|
|
251
131
|
## 许可证
|
|
252
132
|
|
|
253
|
-
|
|
133
|
+
MIT。
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AA4EA,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAuMzC"}
|