adr-kit 0.7.0 → 0.9.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 +41 -24
- package/README.zh.md +40 -27
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +71 -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 +131 -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 +2 -2
- 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 +14 -26
- 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/tree.d.ts +3 -0
- package/dist/commands/tree.d.ts.map +1 -0
- package/dist/commands/tree.js +15 -0
- package/dist/commands/tree.js.map +1 -0
- 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 +44 -10
- package/dist/core/adr.d.ts.map +1 -1
- package/dist/core/adr.js +29 -4
- package/dist/core/adr.js.map +1 -1
- package/dist/core/deliberation.d.ts +21 -0
- package/dist/core/deliberation.d.ts.map +1 -0
- package/dist/core/deliberation.js +82 -0
- package/dist/core/deliberation.js.map +1 -0
- 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 +28 -7
- package/dist/core/repository.js.map +1 -1
- package/dist/core/templates.d.ts +13 -6
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +16 -9
- package/dist/core/templates.js.map +1 -1
- package/dist/core/tool-integrations.d.ts.map +1 -1
- package/dist/core/tool-integrations.js +156 -31
- package/dist/core/tool-integrations.js.map +1 -1
- package/dist/core/validate.d.ts.map +1 -1
- package/dist/core/validate.js +11 -5
- package/dist/core/validate.js.map +1 -1
- package/package.json +4 -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" --raised-by human --decided-by human
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
`adrkit init` creates an `adr/` directory:
|
|
@@ -51,7 +51,9 @@ adr/
|
|
|
51
51
|
└── decisions/ # decisions, numbered N, immutable history
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
`adrkit decide` is the default path: it records an already-made decision
|
|
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
|
|
55
57
|
one, `adrkit accept` promotes it to a numbered decision, and `adrkit reject`
|
|
56
58
|
discards it without leaving a record. Rejection is recorded in a decision's
|
|
57
59
|
`Alternatives considered`, never as a standalone record.
|
|
@@ -68,7 +70,7 @@ adrkit list
|
|
|
68
70
|
Paste this into any AI coding agent to record key decisions automatically:
|
|
69
71
|
|
|
70
72
|
```text
|
|
71
|
-
Use github.com/luochang212/adr-kit in this repository to automatically record key architecture decisions.
|
|
73
|
+
Use github.com/luochang212/adr-kit in this repository to automatically record key architecture 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.
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
To use decisions in later coding tasks, add the [reading rule](docs/workflow.md#read-decisions-before-coding)
|
|
@@ -86,21 +88,24 @@ rationale is not apparent from code alone; routine fixes need no ADR. See
|
|
|
86
88
|
```text
|
|
87
89
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
88
90
|
Initialize an ADR Kit repository
|
|
89
|
-
adrkit decide <title>
|
|
90
|
-
|
|
91
|
-
adrkit
|
|
91
|
+
adrkit decide <title> --raised-by <human|agent> --decided-by <human|agent>
|
|
92
|
+
Record an already-made decision (default path)
|
|
93
|
+
adrkit propose <title> Create an ephemeral proposal draft (only when review is needed)
|
|
94
|
+
adrkit accept <name> --raised-by <human|agent> --decided-by <human|agent>
|
|
95
|
+
Promote a draft to a decision (assigns N)
|
|
92
96
|
adrkit reject <name> [--reason <text>] Discard a draft (leaves no record)
|
|
93
97
|
adrkit supersede <name> --by <name> Mark an accepted decision as superseded
|
|
94
|
-
adrkit list
|
|
98
|
+
adrkit list List decisions and pending drafts
|
|
95
99
|
adrkit show <name> Show a decision or draft
|
|
96
|
-
adrkit status
|
|
97
|
-
adrkit instructions
|
|
98
|
-
adrkit validate [name] [--all]
|
|
100
|
+
adrkit status Show lifecycle counts and validity
|
|
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
|
|
99
103
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
100
104
|
Rewrite AI tool integrations
|
|
101
|
-
adrkit config
|
|
102
|
-
adrkit graph [--mermaid|--dot|--
|
|
105
|
+
adrkit config Print the current configuration
|
|
106
|
+
adrkit graph [--mermaid|--dot|--text] [--formal-only] [--tag <tag>]
|
|
103
107
|
Emit the decision relationship graph
|
|
108
|
+
adrkit tree <name> [--mermaid|--text] Render a record's deliberation tree
|
|
104
109
|
adrkit completion <bash|zsh|fish> Print a shell completion script
|
|
105
110
|
adrkit version Print the version
|
|
106
111
|
```
|
|
@@ -115,7 +120,7 @@ adrkit version Print the version
|
|
|
115
120
|
> `.claude/` copies; an exception we carry until Anthropic adopts the standard.
|
|
116
121
|
|
|
117
122
|
> [!TIP]
|
|
118
|
-
> Every integration ships all
|
|
123
|
+
> Every integration ships all eight workflow skills by default. A small
|
|
119
124
|
> repository that only records decisions can pass
|
|
120
125
|
> `--workflows init,decide,validate` to install a lean subset; the choice is
|
|
121
126
|
> recorded in `adr/config.yaml`, `adrkit update` keeps it, and
|
|
@@ -127,7 +132,7 @@ adrkit version Print the version
|
|
|
127
132
|
|
|
128
133
|
| Document | Content |
|
|
129
134
|
| --- | --- |
|
|
130
|
-
| [CLI reference](https://github.com/luochang212/adr-kit/blob/main/docs/cli.md) | Command reference with arguments and
|
|
135
|
+
| [CLI reference](https://github.com/luochang212/adr-kit/blob/main/docs/cli.md) | Command reference with arguments and output shapes |
|
|
131
136
|
| [Record format](https://github.com/luochang212/adr-kit/blob/main/docs/record-format.md) | ADR file format and validation rules |
|
|
132
137
|
| [Workflow](https://github.com/luochang212/adr-kit/blob/main/docs/workflow.md) | Lifecycle from proposal to decision |
|
|
133
138
|
| [Agent skills](https://github.com/luochang212/adr-kit/blob/main/skills/README.md) | Agent skills that drive the `adrkit` CLI |
|
|
@@ -140,6 +145,7 @@ Every record is YAML front matter followed by a Markdown body:
|
|
|
140
145
|
---
|
|
141
146
|
status: accepted
|
|
142
147
|
date: 2026-08-19
|
|
148
|
+
raised-by: human
|
|
143
149
|
decided-by: human
|
|
144
150
|
created: 2026-08-17
|
|
145
151
|
commit: abc1234
|
|
@@ -161,12 +167,18 @@ by theme. Decisions are immutable history; the current facts
|
|
|
161
167
|
live in code, not in the record.
|
|
162
168
|
|
|
163
169
|
`accepted` denotes a recorded decision, not proof of human review.
|
|
164
|
-
`decided-by`
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
|
168
180
|
[record format reference](docs/record-format.md) for limitations. Identity
|
|
169
|
-
stays in git
|
|
181
|
+
stays in git.
|
|
170
182
|
|
|
171
183
|
- **Decisions** (`adr/decisions/N-slug.md`) are `accepted` or `superseded`
|
|
172
184
|
and require `Problem`, `Decision`, `Alternatives considered`, and
|
|
@@ -187,6 +199,11 @@ stays in git, and `validate` never back-fills the field for older records.
|
|
|
187
199
|
owed: `## Proposal` becomes `## Decision`, and `Acceptance criteria` plus
|
|
188
200
|
`Risks` are folded into `## Consequences`.
|
|
189
201
|
|
|
202
|
+
A decision may also carry an optional `## Deliberation` appendix: the design
|
|
203
|
+
tree behind the choice, stored as a nested Markdown list whose nodes may be
|
|
204
|
+
tagged `[settled]`, `[rejected]`, or `[open]`. Render it with
|
|
205
|
+
`adrkit tree <name>` (text by default, `--mermaid` for a graph).
|
|
206
|
+
|
|
190
207
|
## Compatibility with other tools
|
|
191
208
|
|
|
192
209
|
ADR Kit owns one directory, `adr/`, and reads and validates only its own
|
|
@@ -208,8 +225,8 @@ ADR Kit stands on two projects, in two different roles:
|
|
|
208
225
|
|
|
209
226
|
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** shaped *how* the
|
|
210
227
|
tool is built: an agent-first CLI whose instructions are installed as
|
|
211
|
-
agent skills, a deterministic `validate`,
|
|
212
|
-
|
|
228
|
+
agent skills, a deterministic `validate`, and a "fluid not rigid" workflow.
|
|
229
|
+
Like OpenSpec, ADR Kit
|
|
213
230
|
*steers* agents: session-visible skills rather than imposing hard phase
|
|
214
231
|
gates or mandating that every change be recorded.
|
|
215
232
|
- **[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
@@ -234,9 +251,9 @@ history, and current facts live in code, not in the record.
|
|
|
234
251
|
- **Lifecycle is mechanical, not editorial.** Promoting a draft and retiring
|
|
235
252
|
an accepted decision are commands (`accept`, `supersede`), and `validate`
|
|
236
253
|
enforces the resulting shape.
|
|
237
|
-
- **Agents are first-class users.** The
|
|
238
|
-
|
|
239
|
-
|
|
254
|
+
- **Agents are first-class users.** The record is the interface: plain
|
|
255
|
+
Markdown with YAML front matter an agent reads directly, at predictable
|
|
256
|
+
paths, with `validate` as the machine check.
|
|
240
257
|
|
|
241
258
|
## Development
|
|
242
259
|
|
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 存储会话" --raised-by human --decided-by human
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
`adrkit init` 会创建 `adr/` 目录:
|
|
@@ -49,9 +49,10 @@ adr/
|
|
|
49
49
|
└── decisions/ # 决策,按 N 编号,不可变历史
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
`adrkit
|
|
54
|
-
|
|
52
|
+
`adrkit decide` 是默认路径,直接记录已成定局的决策。需要评审时,提案是
|
|
53
|
+
`adr/.drafts/` 里的临时草稿:`adrkit propose` 创建一条,`adrkit accept` 把它
|
|
54
|
+
提升为编号决策,`adrkit reject` 直接丢弃、不留下任何记录。拒绝记录在决策的
|
|
55
|
+
`Alternatives considered` 里,从不是独立记录。
|
|
55
56
|
|
|
56
57
|
填写决策内容后:
|
|
57
58
|
|
|
@@ -65,7 +66,7 @@ adrkit list
|
|
|
65
66
|
把下面这行贴给任意 AI 编码 Agent,它就会自动把关键决策记录成 ADR:
|
|
66
67
|
|
|
67
68
|
```text
|
|
68
|
-
在本仓库用 github.com/luochang212/adr-kit
|
|
69
|
+
在本仓库用 github.com/luochang212/adr-kit 自动记录关键架构决策。优先用 `adrkit decide`,仅当决策还需评审时才用 `adrkit propose`。每条记录都要声明两个值:`raised-by`(谁把决策提上台面)与 `decided-by`(谁的判断定下它);方向由人决定用 `human`,由你自己的判断得出用 `agent`,即使人只是放行。
|
|
69
70
|
```
|
|
70
71
|
|
|
71
72
|
让后续编码任务也用上决策:在项目 `AGENTS.md`(Claude Code 团队也包括
|
|
@@ -80,21 +81,24 @@ CLI 不会自动修改项目指令文件。只有持续约束后续开发、且
|
|
|
80
81
|
```text
|
|
81
82
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
82
83
|
初始化 ADR Kit 仓库
|
|
83
|
-
adrkit decide <title>
|
|
84
|
-
|
|
85
|
-
adrkit
|
|
84
|
+
adrkit decide <title> --raised-by <human|agent> --decided-by <human|agent>
|
|
85
|
+
直接记录已做的决策(默认路径)
|
|
86
|
+
adrkit propose <title> 仅当决策还需评审时,创建临时提案草稿
|
|
87
|
+
adrkit accept <name> --raised-by <human|agent> --decided-by <human|agent>
|
|
88
|
+
把草稿提升为决策(分配 N 编号)
|
|
86
89
|
adrkit reject <name> [--reason <text>] 丢弃草稿(不留记录)
|
|
87
90
|
adrkit supersede <name> --by <name> 标记已接受决策被新决策取代
|
|
88
|
-
adrkit list
|
|
89
|
-
adrkit show <name>
|
|
90
|
-
adrkit status
|
|
91
|
-
adrkit instructions
|
|
92
|
-
adrkit validate [name] [--all]
|
|
91
|
+
adrkit list 列出决策与待决草稿
|
|
92
|
+
adrkit show <name> 查看决策或草稿
|
|
93
|
+
adrkit status 查看生命周期计数与校验状态
|
|
94
|
+
adrkit instructions 查看下一步;标注待决草稿已就绪或需修改
|
|
95
|
+
adrkit validate [name] [--all] 校验单条记录或整个仓库
|
|
93
96
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
94
|
-
|
|
95
|
-
adrkit config
|
|
96
|
-
adrkit graph [--mermaid|--dot|--
|
|
97
|
-
|
|
97
|
+
重写 AI 工具集成文件
|
|
98
|
+
adrkit config 查看当前配置
|
|
99
|
+
adrkit graph [--mermaid|--dot|--text] [--formal-only] [--tag <tag>]
|
|
100
|
+
输出决策关系图
|
|
101
|
+
adrkit tree <name> [--mermaid|--text] 渲染记录的 deliberation 树
|
|
98
102
|
adrkit completion <bash|zsh|fish> 打印 shell 补全脚本
|
|
99
103
|
adrkit version 查看版本
|
|
100
104
|
```
|
|
@@ -108,7 +112,7 @@ adrkit version 查看版本
|
|
|
108
112
|
> 副本;这个例外我们一直背到 Anthropic 采纳标准为止。
|
|
109
113
|
|
|
110
114
|
> [!TIP]
|
|
111
|
-
>
|
|
115
|
+
> 集成默认安装全部八个工作流技能。只记录决策的小仓库可传
|
|
112
116
|
> `--workflows init,decide,validate` 装精简子集;选择会写入
|
|
113
117
|
> `adr/config.yaml`,`adrkit update` 会保持,`--workflows all` 恢复全套。
|
|
114
118
|
|
|
@@ -118,7 +122,7 @@ adrkit version 查看版本
|
|
|
118
122
|
|
|
119
123
|
| 文档 | 内容 |
|
|
120
124
|
| --- | --- |
|
|
121
|
-
| [CLI 参考](https://github.com/luochang212/adr-kit/blob/main/docs/zh/cli.md) |
|
|
125
|
+
| [CLI 参考](https://github.com/luochang212/adr-kit/blob/main/docs/zh/cli.md) | 命令参考:参数与输出形态 |
|
|
122
126
|
| [记录格式](https://github.com/luochang212/adr-kit/blob/main/docs/zh/record-format.md) | ADR 文件格式与校验规则 |
|
|
123
127
|
| [工作流](https://github.com/luochang212/adr-kit/blob/main/docs/zh/workflow.md) | 从提案到决策的生命周期 |
|
|
124
128
|
| [Agent 技能](https://github.com/luochang212/adr-kit/blob/main/skills/README.md) | 驱动 `adrkit` CLI 的 agent 技能 |
|
|
@@ -131,6 +135,7 @@ adrkit version 查看版本
|
|
|
131
135
|
---
|
|
132
136
|
status: accepted
|
|
133
137
|
date: 2026-08-19
|
|
138
|
+
raised-by: human
|
|
134
139
|
decided-by: human
|
|
135
140
|
created: 2026-08-17
|
|
136
141
|
commit: abc1234
|
|
@@ -149,11 +154,14 @@ tags: [frontend]
|
|
|
149
154
|
关键词)让 `adrkit graph` 按主题分组和过滤决策。决策是不可变历史;当前
|
|
150
155
|
事实以代码为准,不在记录里。
|
|
151
156
|
|
|
152
|
-
`accepted` 表示正式记录的决定,不代表人已审阅批准。`decided-by`
|
|
153
|
-
`human` 或 `
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
+
`accepted` 表示正式记录的决定,不代表人已审阅批准。`raised-by` 与 `decided-by`
|
|
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 里。
|
|
157
165
|
|
|
158
166
|
- **决策**(`adr/decisions/N-slug.md`)是 `accepted` 或 `superseded`,
|
|
159
167
|
需要 `Problem`、`Decision`、`Alternatives considered`、`Consequences`;
|
|
@@ -172,6 +180,10 @@ tags: [frontend]
|
|
|
172
180
|
`adrkit accept` 会自动完成生命周期迁移所要求的改写:`## Proposal` 改为
|
|
173
181
|
`## Decision`,`Acceptance criteria` 与 `Risks` 合并进 `## Consequences`。
|
|
174
182
|
|
|
183
|
+
决策还可以携带可选的 `## Deliberation` 附录:记录选择背后的 design tree,
|
|
184
|
+
用嵌套 Markdown 列表存储,节点可标注 `[settled]`、`[rejected]`、`[open]`。
|
|
185
|
+
用 `adrkit tree <name>` 渲染(默认文本,加 `--mermaid` 输出图形)。
|
|
186
|
+
|
|
175
187
|
## 工具兼容性
|
|
176
188
|
|
|
177
189
|
ADR Kit 只拥有 `adr/` 这一个目录,并且只读取和校验自己的文件,因此可以
|
|
@@ -190,8 +202,8 @@ ADR Kit 只拥有 `adr/` 这一个目录,并且只读取和校验自己的文
|
|
|
190
202
|
ADR Kit 站在两个项目之上,两者角色不同:
|
|
191
203
|
|
|
192
204
|
- **[OpenSpec](https://github.com/Fission-AI/OpenSpec)** 决定了这个工具*怎么建*:
|
|
193
|
-
agent 优先的 CLI、指令以 agent skills 安装、确定性的 `validate
|
|
194
|
-
|
|
205
|
+
agent 优先的 CLI、指令以 agent skills 安装、确定性的 `validate`,
|
|
206
|
+
以及"灵活而不僵化"的工作流。和 OpenSpec 一样,
|
|
195
207
|
ADR Kit 靠*引导* agent(会话开始可见的 skills),而不是硬性阶段门禁,
|
|
196
208
|
也不强制每次变更都记录。
|
|
197
209
|
- **[deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)**
|
|
@@ -212,7 +224,8 @@ ADR Kit 站在两个项目之上,两者角色不同:
|
|
|
212
224
|
- **备选方案是强制项。** 没有记录被否决方案的决策,是在邀请未来的重复争论。
|
|
213
225
|
- **生命周期是机械操作,不是编辑操作。** 提升草稿、退役已接受决策都是命令
|
|
214
226
|
(`accept`、`supersede`),`validate` 强制检查结果形态。
|
|
215
|
-
- **Agent 是一等用户。**
|
|
227
|
+
- **Agent 是一等用户。** 记录本身就是接口:纯 Markdown 加 YAML front matter,
|
|
228
|
+
agent 直接读,路径可预测,`validate` 充当机器检查。
|
|
216
229
|
|
|
217
230
|
## 开发
|
|
218
231
|
|
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":"AAqEA,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA2KzC"}
|
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, isRaisedBy } 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';
|
|
@@ -14,33 +15,41 @@ import { rejectCommand } from './commands/reject.js';
|
|
|
14
15
|
import { showCommand } from './commands/show.js';
|
|
15
16
|
import { statusCommand } from './commands/status.js';
|
|
16
17
|
import { supersedeCommand } from './commands/supersede.js';
|
|
18
|
+
import { treeCommand } from './commands/tree.js';
|
|
17
19
|
import { updateCommand } from './commands/update.js';
|
|
18
20
|
import { validateCommand } from './commands/validate.js';
|
|
19
21
|
const HELP = `adrkit ${VERSION} - A lightweight ADR workflow for humans and agents
|
|
20
22
|
|
|
21
23
|
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
|
-
|
|
24
|
+
in adr/.drafts/ that are promoted by accept or discarded by reject. decide and
|
|
25
|
+
accept require two declarations. --raised-by records who put the decision on
|
|
26
|
+
the table; --decided-by records whose judgment settled it: human when a person
|
|
27
|
+
determined the direction (they stated it, changed a proposal into what shipped,
|
|
28
|
+
or you are recording one they made earlier), agent when it came from the
|
|
29
|
+
agent's own judgment. Either axis may be human or agent, and the CLI neither
|
|
30
|
+
infers nor verifies either.
|
|
25
31
|
|
|
26
32
|
Usage:
|
|
27
33
|
adrkit init [path] [--tools <list>] [--workflows <list>]
|
|
28
34
|
Initialize an ADR Kit repository
|
|
29
|
-
adrkit decide <title>
|
|
35
|
+
adrkit decide <title> --raised-by <human|agent> --decided-by <human|agent>
|
|
36
|
+
Record a decision (default path)
|
|
30
37
|
adrkit propose <title> Create an ephemeral proposal draft
|
|
31
|
-
adrkit accept <name>
|
|
38
|
+
adrkit accept <name> --raised-by <human|agent> --decided-by <human|agent>
|
|
39
|
+
Promote a draft to a decision (assigns the next number)
|
|
32
40
|
adrkit reject <name> [--reason <reason>] Discard a draft (leaves no record)
|
|
33
41
|
adrkit supersede <name> --by <name> Mark an accepted decision as superseded
|
|
34
|
-
adrkit list
|
|
42
|
+
adrkit list List decisions and pending drafts
|
|
35
43
|
adrkit show <name> Show a decision or draft
|
|
36
|
-
adrkit status
|
|
37
|
-
adrkit instructions
|
|
38
|
-
adrkit validate [name] [--all]
|
|
44
|
+
adrkit status Show lifecycle counts and validity
|
|
45
|
+
adrkit instructions Print the next workflow step
|
|
46
|
+
adrkit validate [name] [--all] Validate one record or the whole repo
|
|
39
47
|
adrkit update [--tools <list>] [--workflows <list>]
|
|
40
48
|
Rewrite AI tool integrations
|
|
41
|
-
adrkit config
|
|
42
|
-
adrkit graph [--mermaid|--dot|--
|
|
49
|
+
adrkit config Print the current configuration
|
|
50
|
+
adrkit graph [--mermaid|--dot|--text] [--formal-only] [--tag <tag>]
|
|
43
51
|
Emit the decision relationship graph
|
|
52
|
+
adrkit tree <name> [--mermaid|--text] Render the record's deliberation tree
|
|
44
53
|
adrkit completion <bash|zsh|fish> Print a shell completion script
|
|
45
54
|
adrkit version Print the version
|
|
46
55
|
adrkit -h, --help Print this help
|
|
@@ -50,13 +59,11 @@ adrkit graph visualizes the decision history: solid edges are formal
|
|
|
50
59
|
superseded-by links, dashed edges are ADR-N references mined from record
|
|
51
60
|
bodies, and nodes group by their created date. --mermaid pastes into any
|
|
52
61
|
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.
|
|
62
|
+
--dot feeds Graphviz (dot -Tpng), --text prints a terminal-friendly tree;
|
|
63
|
+
--tag <tag> filters to one theme, --formal-only drops the mined edges.
|
|
56
64
|
|
|
57
65
|
Run from anywhere inside the project; commands discover the nearest adr/ directory.
|
|
58
66
|
`;
|
|
59
|
-
const JSON_COMMANDS = new Set(['list', 'status', 'instructions', 'validate', 'config', 'graph']);
|
|
60
67
|
export function main(argv) {
|
|
61
68
|
const { values, positionals } = parseArgs({
|
|
62
69
|
args: argv,
|
|
@@ -64,9 +71,10 @@ export function main(argv) {
|
|
|
64
71
|
options: {
|
|
65
72
|
all: { type: 'boolean', default: false },
|
|
66
73
|
by: { type: 'string' },
|
|
74
|
+
'decided-by': { type: 'string' },
|
|
75
|
+
'raised-by': { type: 'string' },
|
|
67
76
|
dot: { type: 'boolean', default: false },
|
|
68
77
|
'formal-only': { type: 'boolean', default: false },
|
|
69
|
-
json: { type: 'boolean', default: false },
|
|
70
78
|
mermaid: { type: 'boolean', default: false },
|
|
71
79
|
text: { type: 'boolean', default: false },
|
|
72
80
|
tag: { type: 'string' },
|
|
@@ -88,9 +96,13 @@ export function main(argv) {
|
|
|
88
96
|
const command = positionals[0] ?? '';
|
|
89
97
|
const rest = positionals.slice(1);
|
|
90
98
|
try {
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
// Only decide and accept record a decision. Anywhere else the flags are a
|
|
100
|
+
// mistake, not something to ignore, and this has to run before the switch
|
|
101
|
+
// so a non-recording command never reaches the required-declaration check.
|
|
102
|
+
for (const flag of ['decided-by', 'raised-by']) {
|
|
103
|
+
if (values[flag] !== undefined && command !== 'decide' && command !== 'accept') {
|
|
104
|
+
throw new Error(`adrkit ${command.length > 0 ? command : '(no command)'} does not take --${flag}`);
|
|
105
|
+
}
|
|
94
106
|
}
|
|
95
107
|
switch (command) {
|
|
96
108
|
case '': {
|
|
@@ -118,12 +130,12 @@ export function main(argv) {
|
|
|
118
130
|
}
|
|
119
131
|
case 'decide': {
|
|
120
132
|
requireTitle(rest, 'decide');
|
|
121
|
-
console.log(decideCommand(rest[0], process.cwd()));
|
|
133
|
+
console.log(decideCommand(rest[0], process.cwd(), requireDecidedBy(values['decided-by']), requireRaisedBy(values['raised-by'])));
|
|
122
134
|
return;
|
|
123
135
|
}
|
|
124
136
|
case 'accept': {
|
|
125
137
|
requireTitle(rest, 'accept');
|
|
126
|
-
console.log(acceptCommand(rest[0], process.cwd()));
|
|
138
|
+
console.log(acceptCommand(rest[0], process.cwd(), requireDecidedBy(values['decided-by']), requireRaisedBy(values['raised-by'])));
|
|
127
139
|
return;
|
|
128
140
|
}
|
|
129
141
|
case 'reject': {
|
|
@@ -141,7 +153,7 @@ export function main(argv) {
|
|
|
141
153
|
return;
|
|
142
154
|
}
|
|
143
155
|
case 'list': {
|
|
144
|
-
console.log(listCommand(process.cwd()
|
|
156
|
+
console.log(listCommand(process.cwd()));
|
|
145
157
|
return;
|
|
146
158
|
}
|
|
147
159
|
case 'show': {
|
|
@@ -150,14 +162,14 @@ export function main(argv) {
|
|
|
150
162
|
return;
|
|
151
163
|
}
|
|
152
164
|
case 'status': {
|
|
153
|
-
const result = statusCommand(process.cwd()
|
|
165
|
+
const result = statusCommand(process.cwd());
|
|
154
166
|
console.log(result.output);
|
|
155
167
|
if (result.valid === false)
|
|
156
168
|
process.exitCode = 1;
|
|
157
169
|
return;
|
|
158
170
|
}
|
|
159
171
|
case 'instructions': {
|
|
160
|
-
console.log(instructionsCommand(process.cwd()
|
|
172
|
+
console.log(instructionsCommand(process.cwd()));
|
|
161
173
|
return;
|
|
162
174
|
}
|
|
163
175
|
case 'update': {
|
|
@@ -165,27 +177,31 @@ export function main(argv) {
|
|
|
165
177
|
return;
|
|
166
178
|
}
|
|
167
179
|
case 'config': {
|
|
168
|
-
console.log(configCommand(process.cwd()
|
|
180
|
+
console.log(configCommand(process.cwd()));
|
|
169
181
|
return;
|
|
170
182
|
}
|
|
171
183
|
case 'graph': {
|
|
172
184
|
console.log(graphCommand(process.cwd(), {
|
|
173
185
|
mermaid: values.mermaid,
|
|
174
186
|
dot: values.dot,
|
|
175
|
-
json: values.json,
|
|
176
187
|
text: values.text,
|
|
177
188
|
formalOnly: values['formal-only'],
|
|
178
189
|
tag: values.tag,
|
|
179
190
|
}));
|
|
180
191
|
return;
|
|
181
192
|
}
|
|
193
|
+
case 'tree': {
|
|
194
|
+
requireTitle(rest, 'tree');
|
|
195
|
+
console.log(treeCommand(rest[0], process.cwd(), values.mermaid ? 'mermaid' : 'text'));
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
182
198
|
case 'completion': {
|
|
183
199
|
const shell = rest[0] ?? '';
|
|
184
200
|
console.log(completionCommand(shell));
|
|
185
201
|
return;
|
|
186
202
|
}
|
|
187
203
|
case 'validate': {
|
|
188
|
-
const result = validateCommand(process.cwd(), values.all ? undefined : rest[0]
|
|
204
|
+
const result = validateCommand(process.cwd(), values.all ? undefined : rest[0]);
|
|
189
205
|
console.log(result.output);
|
|
190
206
|
if (result.valid === false)
|
|
191
207
|
process.exitCode = 1;
|
|
@@ -206,6 +222,34 @@ function requireTitle(rest, command) {
|
|
|
206
222
|
throw new Error(`${command} requires a title or name`);
|
|
207
223
|
}
|
|
208
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* `decided-by` is a declaration of where the choice came from, so the CLI asks
|
|
227
|
+
* for it instead of guessing: no environment, terminal, or agent marker can
|
|
228
|
+
* tell it who chose. The prompt states the same boundary the docs do, because
|
|
229
|
+
* whoever reads this message is about to record a decision.
|
|
230
|
+
*/
|
|
231
|
+
function requireDecidedBy(value) {
|
|
232
|
+
if (isDecidedBy(value))
|
|
233
|
+
return value;
|
|
234
|
+
const problem = value === undefined ? 'is required' : `must be "human" or "agent", got "${value}"`;
|
|
235
|
+
throw new Error(`--decided-by ${problem}:\n` +
|
|
236
|
+
' human a person determined the direction: they stated it, changed a proposal\n' +
|
|
237
|
+
' into what shipped, or you are recording one they made earlier\n' +
|
|
238
|
+
' agent the choice came from the agent\'s own judgment, not a person\'s;\n' +
|
|
239
|
+
' a person merely letting it through does not make it human');
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* `raised-by` is the other provenance axis: who put the decision on the table,
|
|
243
|
+
* which is not the same as whose judgment settled it. Declared, never inferred.
|
|
244
|
+
*/
|
|
245
|
+
function requireRaisedBy(value) {
|
|
246
|
+
if (isRaisedBy(value))
|
|
247
|
+
return value;
|
|
248
|
+
const problem = value === undefined ? 'is required' : `must be "human" or "agent", got "${value}"`;
|
|
249
|
+
throw new Error(`--raised-by ${problem}:\n` +
|
|
250
|
+
' human a person put the decision on the table\n' +
|
|
251
|
+
' agent the agent raised it, even if a person later settled the direction');
|
|
252
|
+
}
|
|
209
253
|
if (process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
210
254
|
main(process.argv.slice(2));
|
|
211
255
|
}
|
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,UAAU,EAAE,MAAM,eAAe,CAAC;AACxD,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;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,E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EAAqE,CACxE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,KAAyB;IAChD,IAAI,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,MAAM,OAAO,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,oCAAoC,KAAK,GAAG,CAAC;IACnG,MAAM,IAAI,KAAK,CACb,eAAe,OAAO,KAAK;QACzB,oDAAoD;QACpD,6EAA6E,CAChF,CAAC;AACJ,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7F,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DecidedBy, RaisedBy } 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, raisedBy: RaisedBy): 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,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAO1D;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,GACjB,MAAM,CA+BR"}
|
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, raisedBy) {
|
|
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, raisedBy);
|
|
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,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAa,EACb,GAAW,EACX,SAAoB,EACpB,QAAkB;IAElB,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;IACnG,CAAC;IAED,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,iDAAiD,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACpF,MAAM,QAAQ,GAAG,GAAG,MAAM,IAAI,IAAI,KAAK,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC3D,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACtF,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,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":"AAuFA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiGvD"}
|