adr-kit 0.7.0 → 0.8.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 +27 -21
- package/README.zh.md +27 -21
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +50 -27
- package/dist/cli.js.map +1 -1
- package/dist/commands/accept.d.ts +7 -1
- package/dist/commands/accept.d.ts.map +1 -1
- package/dist/commands/accept.js +7 -3
- package/dist/commands/accept.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +126 -3
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +1 -10
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/decide.d.ts +6 -1
- package/dist/commands/decide.d.ts.map +1 -1
- package/dist/commands/decide.js +6 -3
- package/dist/commands/decide.js.map +1 -1
- package/dist/commands/graph.d.ts +0 -1
- package/dist/commands/graph.d.ts.map +1 -1
- package/dist/commands/graph.js +2 -4
- package/dist/commands/graph.js.map +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/instructions.d.ts +1 -1
- package/dist/commands/instructions.d.ts.map +1 -1
- package/dist/commands/instructions.js +13 -25
- package/dist/commands/instructions.js.map +1 -1
- package/dist/commands/list.d.ts +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +2 -15
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/propose.d.ts.map +1 -1
- package/dist/commands/propose.js +2 -1
- package/dist/commands/propose.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -11
- package/dist/commands/status.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 +1 -17
- package/dist/commands/validate.js.map +1 -1
- package/dist/core/adr.d.ts +25 -9
- package/dist/core/adr.d.ts.map +1 -1
- package/dist/core/adr.js +13 -3
- package/dist/core/adr.js.map +1 -1
- package/dist/core/graph.d.ts +0 -1
- package/dist/core/graph.d.ts.map +1 -1
- package/dist/core/graph.js +0 -18
- package/dist/core/graph.js.map +1 -1
- package/dist/core/repository.d.ts.map +1 -1
- package/dist/core/repository.js +14 -4
- package/dist/core/repository.js.map +1 -1
- package/dist/core/templates.d.ts +12 -5
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +12 -7
- package/dist/core/templates.js.map +1 -1
- package/dist/core/tool-integrations.d.ts.map +1 -1
- package/dist/core/tool-integrations.js +54 -29
- package/dist/core/tool-integrations.js.map +1 -1
- package/dist/core/validate.js +5 -5
- package/dist/core/validate.js.map +1 -1
- package/package.json +2 -2
- package/dist/core/execution-env.d.ts +0 -19
- package/dist/core/execution-env.d.ts.map +0 -1
- package/dist/core/execution-env.js +0 -30
- package/dist/core/execution-env.js.map +0 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Requires Node.js 20.19 or later.
|
|
|
38
38
|
npm install -g adr-kit
|
|
39
39
|
cd your-project
|
|
40
40
|
adrkit init
|
|
41
|
-
adrkit decide "Use SQLite for session storage"
|
|
41
|
+
adrkit decide "Use SQLite for session storage" --decided-by human
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
`adrkit init` creates an `adr/` directory:
|
|
@@ -68,7 +68,7 @@ adrkit list
|
|
|
68
68
|
Paste this into any AI coding agent to record key decisions automatically:
|
|
69
69
|
|
|
70
70
|
```text
|
|
71
|
-
Use github.com/luochang212/adr-kit in this repository to automatically record key architecture decisions.
|
|
71
|
+
Use github.com/luochang212/adr-kit in this repository to automatically record key architecture decisions. Every record declares `decided-by`: use `human` when a person determined the direction, `agent` when the choice came from your own judgment, even if a person let it through.
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
To use decisions in later coding tasks, add the [reading rule](docs/workflow.md#read-decisions-before-coding)
|
|
@@ -86,20 +86,22 @@ rationale is not apparent from code alone; routine fixes need no ADR. See
|
|
|
86
86
|
```text
|
|
87
87
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
88
88
|
Initialize an ADR Kit repository
|
|
89
|
-
adrkit decide <title>
|
|
89
|
+
adrkit decide <title> --decided-by <human|agent>
|
|
90
|
+
Record an already-made decision (default path)
|
|
90
91
|
adrkit propose <title> Create an ephemeral proposal draft
|
|
91
|
-
adrkit accept <name>
|
|
92
|
+
adrkit accept <name> --decided-by <human|agent>
|
|
93
|
+
Promote a draft to a decision (assigns N)
|
|
92
94
|
adrkit reject <name> [--reason <text>] Discard a draft (leaves no record)
|
|
93
95
|
adrkit supersede <name> --by <name> Mark an accepted decision as superseded
|
|
94
|
-
adrkit list
|
|
96
|
+
adrkit list List decisions and pending drafts
|
|
95
97
|
adrkit show <name> Show a decision or draft
|
|
96
|
-
adrkit status
|
|
97
|
-
adrkit instructions
|
|
98
|
-
adrkit validate [name] [--all]
|
|
98
|
+
adrkit status Show lifecycle counts and validity
|
|
99
|
+
adrkit instructions Print the next step; flag pending drafts as ready or needing work
|
|
100
|
+
adrkit validate [name] [--all] Validate one record or the repository
|
|
99
101
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
100
102
|
Rewrite AI tool integrations
|
|
101
|
-
adrkit config
|
|
102
|
-
adrkit graph [--mermaid|--dot|--
|
|
103
|
+
adrkit config Print the current configuration
|
|
104
|
+
adrkit graph [--mermaid|--dot|--text] [--formal-only] [--tag <tag>]
|
|
103
105
|
Emit the decision relationship graph
|
|
104
106
|
adrkit completion <bash|zsh|fish> Print a shell completion script
|
|
105
107
|
adrkit version Print the version
|
|
@@ -127,7 +129,7 @@ adrkit version Print the version
|
|
|
127
129
|
|
|
128
130
|
| Document | Content |
|
|
129
131
|
| --- | --- |
|
|
130
|
-
| [CLI reference](https://github.com/luochang212/adr-kit/blob/main/docs/cli.md) | Command reference with arguments and
|
|
132
|
+
| [CLI reference](https://github.com/luochang212/adr-kit/blob/main/docs/cli.md) | Command reference with arguments and output shapes |
|
|
131
133
|
| [Record format](https://github.com/luochang212/adr-kit/blob/main/docs/record-format.md) | ADR file format and validation rules |
|
|
132
134
|
| [Workflow](https://github.com/luochang212/adr-kit/blob/main/docs/workflow.md) | Lifecycle from proposal to decision |
|
|
133
135
|
| [Agent skills](https://github.com/luochang212/adr-kit/blob/main/skills/README.md) | Agent skills that drive the `adrkit` CLI |
|
|
@@ -161,12 +163,16 @@ by theme. Decisions are immutable history; the current facts
|
|
|
161
163
|
live in code, not in the record.
|
|
162
164
|
|
|
163
165
|
`accepted` denotes a recorded decision, not proof of human review.
|
|
164
|
-
`decided-by` is `human` or `
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
`decided-by` is `human` or `agent`, declared when `decide` or `accept` runs:
|
|
167
|
+
`human` when a person determined the direction (they stated it, changed a
|
|
168
|
+
proposal into what shipped, or you are recording one they made earlier),
|
|
169
|
+
`agent` when it came from the agent's own judgment, including when a person only
|
|
170
|
+
let it through. The CLI records the declaration without inferring or verifying
|
|
171
|
+
it, so the field does not establish who chose or authorized the decision; when
|
|
172
|
+
who proposed and who approved matters, write it in the body. `supersede`
|
|
173
|
+
preserves the original value. See the
|
|
168
174
|
[record format reference](docs/record-format.md) for limitations. Identity
|
|
169
|
-
stays in git
|
|
175
|
+
stays in git.
|
|
170
176
|
|
|
171
177
|
- **Decisions** (`adr/decisions/N-slug.md`) are `accepted` or `superseded`
|
|
172
178
|
and require `Problem`, `Decision`, `Alternatives considered`, and
|
|
@@ -208,8 +214,8 @@ ADR Kit stands on two projects, in two different roles:
|
|
|
208
214
|
|
|
209
215
|
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** shaped *how* the
|
|
210
216
|
tool is built: an agent-first CLI whose instructions are installed as
|
|
211
|
-
agent skills, a deterministic `validate`,
|
|
212
|
-
|
|
217
|
+
agent skills, a deterministic `validate`, and a "fluid not rigid" workflow.
|
|
218
|
+
Like OpenSpec, ADR Kit
|
|
213
219
|
*steers* agents: session-visible skills rather than imposing hard phase
|
|
214
220
|
gates or mandating that every change be recorded.
|
|
215
221
|
- **[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
@@ -234,9 +240,9 @@ history, and current facts live in code, not in the record.
|
|
|
234
240
|
- **Lifecycle is mechanical, not editorial.** Promoting a draft and retiring
|
|
235
241
|
an accepted decision are commands (`accept`, `supersede`), and `validate`
|
|
236
242
|
enforces the resulting shape.
|
|
237
|
-
- **Agents are first-class users.** The
|
|
238
|
-
|
|
239
|
-
|
|
243
|
+
- **Agents are first-class users.** The record is the interface: plain
|
|
244
|
+
Markdown with YAML front matter an agent reads directly, at predictable
|
|
245
|
+
paths, with `validate` as the machine check.
|
|
240
246
|
|
|
241
247
|
## Development
|
|
242
248
|
|
package/README.zh.md
CHANGED
|
@@ -36,7 +36,7 @@ agent 原生代码库的决策记录纪律:每条记录都必须说明它解
|
|
|
36
36
|
npm install -g adr-kit
|
|
37
37
|
cd your-project
|
|
38
38
|
adrkit init
|
|
39
|
-
adrkit decide "使用 SQLite 存储会话"
|
|
39
|
+
adrkit decide "使用 SQLite 存储会话" --decided-by human
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
`adrkit init` 会创建 `adr/` 目录:
|
|
@@ -65,7 +65,7 @@ adrkit list
|
|
|
65
65
|
把下面这行贴给任意 AI 编码 Agent,它就会自动把关键决策记录成 ADR:
|
|
66
66
|
|
|
67
67
|
```text
|
|
68
|
-
在本仓库用 github.com/luochang212/adr-kit
|
|
68
|
+
在本仓库用 github.com/luochang212/adr-kit 自动记录关键架构决策。每条记录都要声明 `decided-by`:方向由人决定用 `human`,由你自己的判断得出用 `agent`,即使人只是放行。
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
让后续编码任务也用上决策:在项目 `AGENTS.md`(Claude Code 团队也包括
|
|
@@ -80,21 +80,23 @@ CLI 不会自动修改项目指令文件。只有持续约束后续开发、且
|
|
|
80
80
|
```text
|
|
81
81
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
82
82
|
初始化 ADR Kit 仓库
|
|
83
|
-
adrkit decide <title>
|
|
83
|
+
adrkit decide <title> --decided-by <human|agent>
|
|
84
|
+
直接记录已做的决策(默认路径)
|
|
84
85
|
adrkit propose <title> 创建临时提案草稿
|
|
85
|
-
adrkit accept <name>
|
|
86
|
+
adrkit accept <name> --decided-by <human|agent>
|
|
87
|
+
把草稿提升为决策(分配 N 编号)
|
|
86
88
|
adrkit reject <name> [--reason <text>] 丢弃草稿(不留记录)
|
|
87
89
|
adrkit supersede <name> --by <name> 标记已接受决策被新决策取代
|
|
88
|
-
adrkit list
|
|
89
|
-
adrkit show <name>
|
|
90
|
-
adrkit status
|
|
91
|
-
adrkit instructions
|
|
92
|
-
adrkit validate [name] [--all]
|
|
90
|
+
adrkit list 列出决策与待决草稿
|
|
91
|
+
adrkit show <name> 查看决策或草稿
|
|
92
|
+
adrkit status 查看生命周期计数与校验状态
|
|
93
|
+
adrkit instructions 查看下一步;标注待决草稿已就绪或需修改
|
|
94
|
+
adrkit validate [name] [--all] 校验单条记录或整个仓库
|
|
93
95
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
94
|
-
|
|
95
|
-
adrkit config
|
|
96
|
-
adrkit graph [--mermaid|--dot|--
|
|
97
|
-
|
|
96
|
+
重写 AI 工具集成文件
|
|
97
|
+
adrkit config 查看当前配置
|
|
98
|
+
adrkit graph [--mermaid|--dot|--text] [--formal-only] [--tag <tag>]
|
|
99
|
+
输出决策关系图
|
|
98
100
|
adrkit completion <bash|zsh|fish> 打印 shell 补全脚本
|
|
99
101
|
adrkit version 查看版本
|
|
100
102
|
```
|
|
@@ -118,7 +120,7 @@ adrkit version 查看版本
|
|
|
118
120
|
|
|
119
121
|
| 文档 | 内容 |
|
|
120
122
|
| --- | --- |
|
|
121
|
-
| [CLI 参考](https://github.com/luochang212/adr-kit/blob/main/docs/zh/cli.md) |
|
|
123
|
+
| [CLI 参考](https://github.com/luochang212/adr-kit/blob/main/docs/zh/cli.md) | 命令参考:参数与输出形态 |
|
|
122
124
|
| [记录格式](https://github.com/luochang212/adr-kit/blob/main/docs/zh/record-format.md) | ADR 文件格式与校验规则 |
|
|
123
125
|
| [工作流](https://github.com/luochang212/adr-kit/blob/main/docs/zh/workflow.md) | 从提案到决策的生命周期 |
|
|
124
126
|
| [Agent 技能](https://github.com/luochang212/adr-kit/blob/main/skills/README.md) | 驱动 `adrkit` CLI 的 agent 技能 |
|
|
@@ -150,10 +152,13 @@ tags: [frontend]
|
|
|
150
152
|
事实以代码为准,不在记录里。
|
|
151
153
|
|
|
152
154
|
`accepted` 表示正式记录的决定,不代表人已审阅批准。`decided-by` 取值为
|
|
153
|
-
`human` 或 `
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
`human` 或 `agent`,在 `decide` 或 `accept` 时声明:方向由人决定时写 `human`
|
|
156
|
+
(人说出的、人把 agent 的提案改成最终落地方案的、或人此前定过而现在只是补记的),
|
|
157
|
+
由 AI 自主判断得出时写 `agent`,包括人只是放行的情况。CLI 既不推断也不校验,
|
|
158
|
+
只记录声明,所以它不能证明是谁自主拍板或授权;这里的"谁"指选择的来源,不是谁执行了
|
|
159
|
+
命令,谁提出、谁批准写进正文。`supersede`
|
|
160
|
+
保留原值。局限见[记录格式参考](docs/zh/record-format.md)。
|
|
161
|
+
身份留在 git 里。
|
|
157
162
|
|
|
158
163
|
- **决策**(`adr/decisions/N-slug.md`)是 `accepted` 或 `superseded`,
|
|
159
164
|
需要 `Problem`、`Decision`、`Alternatives considered`、`Consequences`;
|
|
@@ -190,8 +195,8 @@ ADR Kit 只拥有 `adr/` 这一个目录,并且只读取和校验自己的文
|
|
|
190
195
|
ADR Kit 站在两个项目之上,两者角色不同:
|
|
191
196
|
|
|
192
197
|
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** 决定了这个工具*怎么建*:
|
|
193
|
-
agent 优先的 CLI、指令以 agent skills 安装、确定性的 `validate
|
|
194
|
-
|
|
198
|
+
agent 优先的 CLI、指令以 agent skills 安装、确定性的 `validate`,
|
|
199
|
+
以及"灵活而不僵化"的工作流。和 OpenSpec 一样,
|
|
195
200
|
ADR Kit 靠*引导* agent(会话开始可见的 skills),而不是硬性阶段门禁,
|
|
196
201
|
也不强制每次变更都记录。
|
|
197
202
|
- **[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
@@ -212,7 +217,8 @@ ADR Kit 站在两个项目之上,两者角色不同:
|
|
|
212
217
|
- **备选方案是强制项。** 没有记录被否决方案的决策,是在邀请未来的重复争论。
|
|
213
218
|
- **生命周期是机械操作,不是编辑操作。** 提升草稿、退役已接受决策都是命令
|
|
214
219
|
(`accept`、`supersede`),`validate` 强制检查结果形态。
|
|
215
|
-
- **Agent 是一等用户。**
|
|
220
|
+
- **Agent 是一等用户。** 记录本身就是接口:纯 Markdown 加 YAML front matter,
|
|
221
|
+
agent 直接读,路径可预测,`validate` 充当机器检查。
|
|
216
222
|
|
|
217
223
|
## 开发
|
|
218
224
|
|
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":"AAkEA,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAyJzC"}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { VERSION } from './version.js';
|
|
4
|
+
import { isDecidedBy } from './core/adr.js';
|
|
4
5
|
import { acceptCommand } from './commands/accept.js';
|
|
5
6
|
import { completionCommand } from './commands/completion.js';
|
|
6
7
|
import { configCommand } from './commands/config.js';
|
|
@@ -19,27 +20,32 @@ import { validateCommand } from './commands/validate.js';
|
|
|
19
20
|
const HELP = `adrkit ${VERSION} - A lightweight ADR workflow for humans and agents
|
|
20
21
|
|
|
21
22
|
Decisions are durable records in adr/decisions/. Proposals are ephemeral drafts
|
|
22
|
-
in adr/.drafts/ that are promoted by accept or discarded by reject.
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
in adr/.drafts/ that are promoted by accept or discarded by reject. decide and
|
|
24
|
+
accept require --decided-by, which records who made the choice: human when a
|
|
25
|
+
person determined the direction (they stated it, changed a proposal into what
|
|
26
|
+
shipped, or you are recording one they made earlier), agent when it came from
|
|
27
|
+
the agent's own judgment. It records where the choice came from, not who ran
|
|
28
|
+
the command, and the CLI neither infers nor verifies it.
|
|
25
29
|
|
|
26
30
|
Usage:
|
|
27
31
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
28
32
|
Initialize an ADR Kit repository
|
|
29
|
-
adrkit decide <title>
|
|
33
|
+
adrkit decide <title> --decided-by <human|agent>
|
|
34
|
+
Record a decision (default path)
|
|
30
35
|
adrkit propose <title> Create an ephemeral proposal draft
|
|
31
|
-
adrkit accept <name>
|
|
36
|
+
adrkit accept <name> --decided-by <human|agent>
|
|
37
|
+
Promote a draft to a decision (assigns the next number)
|
|
32
38
|
adrkit reject <name> [--reason <reason>] Discard a draft (leaves no record)
|
|
33
39
|
adrkit supersede <name> --by <name> Mark an accepted decision as superseded
|
|
34
|
-
adrkit list
|
|
40
|
+
adrkit list List decisions and pending drafts
|
|
35
41
|
adrkit show <name> Show a decision or draft
|
|
36
|
-
adrkit status
|
|
37
|
-
adrkit instructions
|
|
38
|
-
adrkit validate [name] [--all]
|
|
42
|
+
adrkit status Show lifecycle counts and validity
|
|
43
|
+
adrkit instructions Print the next workflow step
|
|
44
|
+
adrkit validate [name] [--all] Validate one record or the whole repo
|
|
39
45
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
40
46
|
Rewrite AI tool integrations
|
|
41
|
-
adrkit config
|
|
42
|
-
adrkit graph [--mermaid|--dot|--
|
|
47
|
+
adrkit config Print the current configuration
|
|
48
|
+
adrkit graph [--mermaid|--dot|--text] [--formal-only] [--tag <tag>]
|
|
43
49
|
Emit the decision relationship graph
|
|
44
50
|
adrkit completion <bash|zsh|fish> Print a shell completion script
|
|
45
51
|
adrkit version Print the version
|
|
@@ -50,13 +56,11 @@ adrkit graph visualizes the decision history: solid edges are formal
|
|
|
50
56
|
superseded-by links, dashed edges are ADR-N references mined from record
|
|
51
57
|
bodies, and nodes group by their created date. --mermaid pastes into any
|
|
52
58
|
Markdown and renders natively on GitHub (nodes are tinted by their tags),
|
|
53
|
-
--dot feeds Graphviz (dot -Tpng), --text prints a terminal-friendly tree
|
|
54
|
-
--
|
|
55
|
-
--formal-only drops the mined edges.
|
|
59
|
+
--dot feeds Graphviz (dot -Tpng), --text prints a terminal-friendly tree;
|
|
60
|
+
--tag <tag> filters to one theme, --formal-only drops the mined edges.
|
|
56
61
|
|
|
57
62
|
Run from anywhere inside the project; commands discover the nearest adr/ directory.
|
|
58
63
|
`;
|
|
59
|
-
const JSON_COMMANDS = new Set(['list', 'status', 'instructions', 'validate', 'config', 'graph']);
|
|
60
64
|
export function main(argv) {
|
|
61
65
|
const { values, positionals } = parseArgs({
|
|
62
66
|
args: argv,
|
|
@@ -64,9 +68,9 @@ export function main(argv) {
|
|
|
64
68
|
options: {
|
|
65
69
|
all: { type: 'boolean', default: false },
|
|
66
70
|
by: { type: 'string' },
|
|
71
|
+
'decided-by': { type: 'string' },
|
|
67
72
|
dot: { type: 'boolean', default: false },
|
|
68
73
|
'formal-only': { type: 'boolean', default: false },
|
|
69
|
-
json: { type: 'boolean', default: false },
|
|
70
74
|
mermaid: { type: 'boolean', default: false },
|
|
71
75
|
text: { type: 'boolean', default: false },
|
|
72
76
|
tag: { type: 'string' },
|
|
@@ -88,9 +92,13 @@ export function main(argv) {
|
|
|
88
92
|
const command = positionals[0] ?? '';
|
|
89
93
|
const rest = positionals.slice(1);
|
|
90
94
|
try {
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
// Only decide and accept record a decision. Anywhere else the flag is a
|
|
96
|
+
// mistake, not something to ignore, and this has to run before the switch
|
|
97
|
+
// so a non-recording command never reaches the required-declaration check.
|
|
98
|
+
if (values['decided-by'] !== undefined &&
|
|
99
|
+
command !== 'decide' &&
|
|
100
|
+
command !== 'accept') {
|
|
101
|
+
throw new Error(`adrkit ${command.length > 0 ? command : '(no command)'} does not take --decided-by`);
|
|
94
102
|
}
|
|
95
103
|
switch (command) {
|
|
96
104
|
case '': {
|
|
@@ -118,12 +126,12 @@ export function main(argv) {
|
|
|
118
126
|
}
|
|
119
127
|
case 'decide': {
|
|
120
128
|
requireTitle(rest, 'decide');
|
|
121
|
-
console.log(decideCommand(rest[0], process.cwd()));
|
|
129
|
+
console.log(decideCommand(rest[0], process.cwd(), requireDecidedBy(values['decided-by'])));
|
|
122
130
|
return;
|
|
123
131
|
}
|
|
124
132
|
case 'accept': {
|
|
125
133
|
requireTitle(rest, 'accept');
|
|
126
|
-
console.log(acceptCommand(rest[0], process.cwd()));
|
|
134
|
+
console.log(acceptCommand(rest[0], process.cwd(), requireDecidedBy(values['decided-by'])));
|
|
127
135
|
return;
|
|
128
136
|
}
|
|
129
137
|
case 'reject': {
|
|
@@ -141,7 +149,7 @@ export function main(argv) {
|
|
|
141
149
|
return;
|
|
142
150
|
}
|
|
143
151
|
case 'list': {
|
|
144
|
-
console.log(listCommand(process.cwd()
|
|
152
|
+
console.log(listCommand(process.cwd()));
|
|
145
153
|
return;
|
|
146
154
|
}
|
|
147
155
|
case 'show': {
|
|
@@ -150,14 +158,14 @@ export function main(argv) {
|
|
|
150
158
|
return;
|
|
151
159
|
}
|
|
152
160
|
case 'status': {
|
|
153
|
-
const result = statusCommand(process.cwd()
|
|
161
|
+
const result = statusCommand(process.cwd());
|
|
154
162
|
console.log(result.output);
|
|
155
163
|
if (result.valid === false)
|
|
156
164
|
process.exitCode = 1;
|
|
157
165
|
return;
|
|
158
166
|
}
|
|
159
167
|
case 'instructions': {
|
|
160
|
-
console.log(instructionsCommand(process.cwd()
|
|
168
|
+
console.log(instructionsCommand(process.cwd()));
|
|
161
169
|
return;
|
|
162
170
|
}
|
|
163
171
|
case 'update': {
|
|
@@ -165,14 +173,13 @@ export function main(argv) {
|
|
|
165
173
|
return;
|
|
166
174
|
}
|
|
167
175
|
case 'config': {
|
|
168
|
-
console.log(configCommand(process.cwd()
|
|
176
|
+
console.log(configCommand(process.cwd()));
|
|
169
177
|
return;
|
|
170
178
|
}
|
|
171
179
|
case 'graph': {
|
|
172
180
|
console.log(graphCommand(process.cwd(), {
|
|
173
181
|
mermaid: values.mermaid,
|
|
174
182
|
dot: values.dot,
|
|
175
|
-
json: values.json,
|
|
176
183
|
text: values.text,
|
|
177
184
|
formalOnly: values['formal-only'],
|
|
178
185
|
tag: values.tag,
|
|
@@ -185,7 +192,7 @@ export function main(argv) {
|
|
|
185
192
|
return;
|
|
186
193
|
}
|
|
187
194
|
case 'validate': {
|
|
188
|
-
const result = validateCommand(process.cwd(), values.all ? undefined : rest[0]
|
|
195
|
+
const result = validateCommand(process.cwd(), values.all ? undefined : rest[0]);
|
|
189
196
|
console.log(result.output);
|
|
190
197
|
if (result.valid === false)
|
|
191
198
|
process.exitCode = 1;
|
|
@@ -206,6 +213,22 @@ function requireTitle(rest, command) {
|
|
|
206
213
|
throw new Error(`${command} requires a title or name`);
|
|
207
214
|
}
|
|
208
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* `decided-by` is a declaration of where the choice came from, so the CLI asks
|
|
218
|
+
* for it instead of guessing: no environment, terminal, or agent marker can
|
|
219
|
+
* tell it who chose. The prompt states the same boundary the docs do, because
|
|
220
|
+
* whoever reads this message is about to record a decision.
|
|
221
|
+
*/
|
|
222
|
+
function requireDecidedBy(value) {
|
|
223
|
+
if (isDecidedBy(value))
|
|
224
|
+
return value;
|
|
225
|
+
const problem = value === undefined ? 'is required' : `must be "human" or "agent", got "${value}"`;
|
|
226
|
+
throw new Error(`--decided-by ${problem}:\n` +
|
|
227
|
+
' human a person determined the direction: they stated it, changed a proposal\n' +
|
|
228
|
+
' into what shipped, or you are recording one they made earlier\n' +
|
|
229
|
+
' agent the choice came from the agent\'s own judgment, not a person\'s;\n' +
|
|
230
|
+
' a person merely letting it through does not make it human');
|
|
231
|
+
}
|
|
209
232
|
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
210
233
|
main(process.argv.slice(2));
|
|
211
234
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACj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7F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DecidedBy } from '../core/adr.js';
|
|
2
|
+
/**
|
|
3
|
+
* `decidedBy` is the declaration the caller made for the promoted decision:
|
|
4
|
+
* the CLI cannot observe who chose, so the value travels in rather than being
|
|
5
|
+
* inferred. Promotion is also where the value enters the durable record.
|
|
6
|
+
*/
|
|
7
|
+
export declare function acceptCommand(query: string, cwd: string, decidedBy: DecidedBy): string;
|
|
2
8
|
//# sourceMappingURL=accept.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../src/commands/accept.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accept.d.ts","sourceRoot":"","sources":["../../src/commands/accept.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOhD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CA+BtF"}
|
package/dist/commands/accept.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { requireRoot } from '../core/config.js';
|
|
4
|
-
import { detectDecidedBy } from '../core/execution-env.js';
|
|
5
4
|
import { gitHead } from '../core/git.js';
|
|
6
5
|
import { folderPath, nextDecisionNumber, removeRecord, resolveDraft, writeRecord } from '../core/repository.js';
|
|
7
6
|
import { droppedSections, proposalToDecision } from '../core/templates.js';
|
|
8
7
|
import { formatIssues, validateDraft } from '../core/validate.js';
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* `decidedBy` is the declaration the caller made for the promoted decision:
|
|
10
|
+
* the CLI cannot observe who chose, so the value travels in rather than being
|
|
11
|
+
* inferred. Promotion is also where the value enters the durable record.
|
|
12
|
+
*/
|
|
13
|
+
export function acceptCommand(query, cwd, decidedBy) {
|
|
10
14
|
const root = requireRoot(cwd);
|
|
11
15
|
const draft = resolveDraft(root, query);
|
|
12
16
|
if (/^\d+\s+/.test(draft.title)) {
|
|
@@ -23,7 +27,7 @@ export function acceptCommand(query, cwd, env = process.env) {
|
|
|
23
27
|
if (existsSync(path)) {
|
|
24
28
|
throw new Error(`decision already exists: adr/decisions/${fileName}`);
|
|
25
29
|
}
|
|
26
|
-
const content = proposalToDecision(draft, number, gitHead(root),
|
|
30
|
+
const content = proposalToDecision(draft, number, gitHead(root), decidedBy);
|
|
27
31
|
writeRecord(root, 'decisions', fileName, content);
|
|
28
32
|
removeRecord(draft);
|
|
29
33
|
let output = `accepted adr/.drafts/${draft.fileName} as adr/decisions/${fileName}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../src/commands/accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"accept.js","sourceRoot":"","sources":["../../src/commands/accept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAChH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE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E,OAAO,CAAC,CAAC;IAClD,YAAY,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,MAAM,GAAG,wBAAwB,KAAK,CAAC,QAAQ,qBAAqB,QAAQ,EAAE,CAAC;IACnF,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,wEAAwE,OAAO;aACtF,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,OAAO,EAAE,CAAC;aACjC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAClB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAoFA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA+FvD"}
|