adr-kit 0.2.7 → 0.3.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 +19 -0
- package/README.zh.md +18 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +23 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +1 -0
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/graph.d.ts +8 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +17 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +8 -6
- package/dist/commands/update.js.map +1 -1
- package/dist/core/graph.d.ts +38 -0
- package/dist/core/graph.d.ts.map +1 -0
- package/dist/core/graph.js +161 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/tool-integrations.d.ts +18 -5
- package/dist/core/tool-integrations.d.ts.map +1 -1
- package/dist/core/tool-integrations.js +64 -53
- package/dist/core/tool-integrations.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,6 +63,14 @@ adrkit validate
|
|
|
63
63
|
adrkit list
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
## Tell your agent
|
|
67
|
+
|
|
68
|
+
Paste this into any AI coding agent to record key decisions automatically:
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
Use github.com/luochang212/adr-kit in this repository to automatically record key architecture decisions.
|
|
72
|
+
```
|
|
73
|
+
|
|
66
74
|
## Commands
|
|
67
75
|
|
|
68
76
|
```text
|
|
@@ -79,10 +87,21 @@ adrkit instructions [--json] Print the next step; flag pending drafts
|
|
|
79
87
|
adrkit validate [name] [--all] [--json] Validate one record or the repository
|
|
80
88
|
adrkit update [--tools <list>] Rewrite AI tool integrations
|
|
81
89
|
adrkit config [--json] Print the current configuration
|
|
90
|
+
adrkit graph [--mermaid|--dot|--json] [--formal-only]
|
|
91
|
+
Emit the decision relationship graph
|
|
82
92
|
adrkit completion <bash|zsh|fish> Print a shell completion script
|
|
83
93
|
adrkit version Print the version
|
|
84
94
|
```
|
|
85
95
|
|
|
96
|
+
> [!IMPORTANT]
|
|
97
|
+
> Integrations install into the open [`.agents/`](https://agents.md/) standard
|
|
98
|
+
> by default - one set of skills and slash commands every mainstream agent
|
|
99
|
+
> reads. Claude Code is the one holdout: it even [closed the AGENTS.md support
|
|
100
|
+
> request](https://github.com/anthropics/claude-code/issues/6235), and Shopify's
|
|
101
|
+
> CEO [publicly threatened to ban it over this](https://thenewstack.io/shopify-claude-code-agentsmd/).
|
|
102
|
+
> If your team uses Claude Code, pass `--tools claude` to also install
|
|
103
|
+
> `.claude/` copies - an exception we carry until Anthropic adopts the standard.
|
|
104
|
+
|
|
86
105
|
`<name>` resolves by title, file name, or decision number (`1`).
|
|
87
106
|
|
|
88
107
|
## Docs
|
package/README.zh.md
CHANGED
|
@@ -60,6 +60,14 @@ adrkit validate
|
|
|
60
60
|
adrkit list
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
## 接入你的 Agent
|
|
64
|
+
|
|
65
|
+
把下面这行贴给任意 AI 编码 Agent,它就会自动把关键决策记录成 ADR:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
在本仓库用 github.com/luochang212/adr-kit 自动记录关键架构决策
|
|
69
|
+
```
|
|
70
|
+
|
|
63
71
|
## 命令
|
|
64
72
|
|
|
65
73
|
```text
|
|
@@ -76,10 +84,20 @@ adrkit instructions [--json] 查看下一步;标注待决草稿已
|
|
|
76
84
|
adrkit validate [name] [--all] [--json] 校验单条记录或整个仓库
|
|
77
85
|
adrkit update [--tools <list>] 重写 AI 工具集成文件
|
|
78
86
|
adrkit config [--json] 查看当前配置
|
|
87
|
+
adrkit graph [--mermaid|--dot|--json] [--formal-only]
|
|
88
|
+
输出决策关系图
|
|
79
89
|
adrkit completion <bash|zsh|fish> 打印 shell 补全脚本
|
|
80
90
|
adrkit version 查看版本
|
|
81
91
|
```
|
|
82
92
|
|
|
93
|
+
> [!IMPORTANT]
|
|
94
|
+
> 集成默认写入开放的 [`.agents/`](https://agents.md/) 标准——一套技能和斜杠
|
|
95
|
+
> 命令,所有主流 Agent 通用。Claude Code 是唯一的例外:它不仅[关闭了
|
|
96
|
+
> AGENTS.md 支持请求](https://github.com/anthropics/claude-code/issues/6235),
|
|
97
|
+
> 还让 [Shopify CEO 公开放话要因此禁用它](https://thenewstack.io/shopify-claude-code-agentsmd/)。
|
|
98
|
+
> 如果你的团队用 Claude Code,加 `--tools claude` 会同时安装 `.claude/`
|
|
99
|
+
> 副本——这个例外我们一直背到 Anthropic 采纳标准为止。
|
|
100
|
+
|
|
83
101
|
`<name>` 支持按标题、文件名或决策编号(`1`)查找。
|
|
84
102
|
|
|
85
103
|
## 文档
|
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":"AAyDA,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA4IzC"}
|
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import { acceptCommand } from './commands/accept.js';
|
|
|
5
5
|
import { completionCommand } from './commands/completion.js';
|
|
6
6
|
import { configCommand } from './commands/config.js';
|
|
7
7
|
import { decideCommand } from './commands/decide.js';
|
|
8
|
+
import { graphCommand } from './commands/graph.js';
|
|
8
9
|
import { initCommand } from './commands/init.js';
|
|
9
10
|
import { instructionsCommand } from './commands/instructions.js';
|
|
10
11
|
import { listCommand } from './commands/list.js';
|
|
@@ -34,14 +35,23 @@ Usage:
|
|
|
34
35
|
adrkit validate [name] [--all] [--json] Validate one record or the whole repo
|
|
35
36
|
adrkit update [--tools <list>] Rewrite AI tool integrations
|
|
36
37
|
adrkit config [--json] Print the current configuration
|
|
38
|
+
adrkit graph [--mermaid|--dot|--json] [--formal-only]
|
|
39
|
+
Emit the decision relationship graph
|
|
37
40
|
adrkit completion <bash|zsh|fish> Print a shell completion script
|
|
38
41
|
adrkit version Print the version
|
|
39
42
|
adrkit -h, --help Print this help
|
|
40
43
|
adrkit -V, --version Print the version
|
|
41
44
|
|
|
45
|
+
adrkit graph visualizes the decision history: solid edges are formal
|
|
46
|
+
superseded-by links, dashed edges are ADR-N references mined from record
|
|
47
|
+
bodies, and nodes group by date. The default --mermaid output pastes into
|
|
48
|
+
any Markdown and renders natively on GitHub; --dot feeds Graphviz
|
|
49
|
+
(dot -Tpng), --json exposes the graph to other tools, --formal-only drops
|
|
50
|
+
the mined edges.
|
|
51
|
+
|
|
42
52
|
Run from anywhere inside the project; commands discover the nearest adr/ directory.
|
|
43
53
|
`;
|
|
44
|
-
const JSON_COMMANDS = new Set(['list', 'status', 'instructions', 'validate', 'config']);
|
|
54
|
+
const JSON_COMMANDS = new Set(['list', 'status', 'instructions', 'validate', 'config', 'graph']);
|
|
45
55
|
export function main(argv) {
|
|
46
56
|
const { values, positionals } = parseArgs({
|
|
47
57
|
args: argv,
|
|
@@ -49,7 +59,10 @@ export function main(argv) {
|
|
|
49
59
|
options: {
|
|
50
60
|
all: { type: 'boolean', default: false },
|
|
51
61
|
by: { type: 'string' },
|
|
62
|
+
dot: { type: 'boolean', default: false },
|
|
63
|
+
'formal-only': { type: 'boolean', default: false },
|
|
52
64
|
json: { type: 'boolean', default: false },
|
|
65
|
+
mermaid: { type: 'boolean', default: false },
|
|
53
66
|
reason: { type: 'string' },
|
|
54
67
|
tools: { type: 'string' },
|
|
55
68
|
help: { type: 'boolean', short: 'h', default: false },
|
|
@@ -147,6 +160,15 @@ export function main(argv) {
|
|
|
147
160
|
console.log(configCommand(process.cwd(), values.json));
|
|
148
161
|
return;
|
|
149
162
|
}
|
|
163
|
+
case 'graph': {
|
|
164
|
+
console.log(graphCommand(process.cwd(), {
|
|
165
|
+
mermaid: values.mermaid,
|
|
166
|
+
dot: values.dot,
|
|
167
|
+
json: values.json,
|
|
168
|
+
formalOnly: values['formal-only'],
|
|
169
|
+
}));
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
150
172
|
case 'completion': {
|
|
151
173
|
const shell = rest[0] ?? '';
|
|
152
174
|
console.log(completionCommand(shell));
|
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;AACvC,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,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,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,IAAI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;AACH,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,MAAM,CAAC,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 +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":"AAoBA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAoBvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;IACf,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,MAAM;IACN,MAAM;IACN,QAAQ;IACR,cAAc;IACd,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,MAAM;CACP,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO;;;8BAGiB,KAAK;;;CAGlC,CAAC;QACE,KAAK,KAAK;YACR,OAAO;yBACY,KAAK;CAC7B,CAAC;QACE,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,6BAA6B,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC9F;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,+BAA+B,CAAC,CAAC;IAChF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;IACf,MAAM;IACN,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,MAAM;IACN,MAAM;IACN,QAAQ;IACR,cAAc;IACd,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,SAAS;IACT,MAAM;CACP,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO;;;8BAGiB,KAAK;;;CAGlC,CAAC;QACE,KAAK,KAAK;YACR,OAAO;yBACY,KAAK;CAC7B,CAAC;QACE,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,6BAA6B,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAC9F;YACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,+BAA+B,CAAC,CAAC;IAChF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAYzE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { requireRoot } from '../core/config.js';
|
|
2
|
+
import { listRecords } from '../core/repository.js';
|
|
3
|
+
import { buildDecisionGraph, dotGraph, jsonGraph, mermaidGraph } from '../core/graph.js';
|
|
4
|
+
export function graphCommand(cwd, flags) {
|
|
5
|
+
const formats = ['mermaid', 'dot', 'json'].filter((format) => flags[format]);
|
|
6
|
+
if (formats.length > 1) {
|
|
7
|
+
throw new Error(`--${formats.join(' and --')} are mutually exclusive; pick one output format`);
|
|
8
|
+
}
|
|
9
|
+
const root = requireRoot(cwd);
|
|
10
|
+
const graph = buildDecisionGraph(listRecords(root), { formalOnly: flags.formalOnly });
|
|
11
|
+
if (formats[0] === 'dot')
|
|
12
|
+
return dotGraph(graph);
|
|
13
|
+
if (formats[0] === 'json')
|
|
14
|
+
return jsonGraph(graph);
|
|
15
|
+
return mermaidGraph(graph);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/commands/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASzF,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,KAAuB;IAC/D,MAAM,OAAO,GAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAW,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,KAAK,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,iDAAiD,CAC9E,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IACtF,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK;QAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACjD,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;IACnD,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AASA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AASA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBtE"}
|
package/dist/commands/update.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { readConfig, requireRoot, writeToolsConfig } from '../core/config.js';
|
|
2
|
-
import {
|
|
2
|
+
import { integrationSummary, parseTools, removeToolIntegrations, staleIntegrationKeys, writeToolIntegrations, } from '../core/tool-integrations.js';
|
|
3
3
|
export function updateCommand(cwd, toolsValue) {
|
|
4
4
|
const root = requireRoot(cwd);
|
|
5
5
|
const config = readConfig(root);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// A missing `tools` key means "never chose" (the standard default applies);
|
|
7
|
+
// an empty recorded sequence is an explicit opt-out that must survive a
|
|
8
|
+
// bare update.
|
|
9
|
+
const tools = parseTools(toolsValue ?? (config.tools === undefined ? undefined : config.tools.join(',')));
|
|
10
|
+
const removed = removeToolIntegrations(root, staleIntegrationKeys(tools));
|
|
9
11
|
writeToolsConfig(root, tools);
|
|
10
12
|
const integrations = writeToolIntegrations(root, tools);
|
|
11
13
|
const lines = [`updated AI tool integrations at ${root}`];
|
|
12
|
-
if (
|
|
13
|
-
lines.push(` removed integrations for: ${
|
|
14
|
+
if (removed.length > 0) {
|
|
15
|
+
lines.push(` removed integrations for: ${removed.join(', ')}`);
|
|
14
16
|
}
|
|
15
17
|
lines.push(...integrationSummary(root, integrations));
|
|
16
18
|
return lines.join('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,UAAmB;IAC5D,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAChC,4EAA4E;IAC5E,wEAAwE;IACxE,eAAe;IACf,MAAM,KAAK,GAAG,UAAU,CACtB,UAAU,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAChF,CAAC;IACF,MAAM,OAAO,GAAG,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1E,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9B,MAAM,YAAY,GAAG,qBAAqB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,CAAC,mCAAmC,IAAI,EAAE,CAAC,CAAC;IAC1D,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CAAC,+BAA+B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,kBAAkB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IACtD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AdrRecord } from './adr.js';
|
|
2
|
+
/** One decision in the graph; `title` keeps its "N " prefix. */
|
|
3
|
+
export interface GraphNode {
|
|
4
|
+
number: number;
|
|
5
|
+
title: string;
|
|
6
|
+
status: AdrRecord['status'];
|
|
7
|
+
date: string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
/** Repository-relative POSIX path; the `click` target in Mermaid output. */
|
|
10
|
+
path: string;
|
|
11
|
+
supersededBy?: number;
|
|
12
|
+
/** Mined `ADR-N` reference targets, filtered and sorted. */
|
|
13
|
+
references: number[];
|
|
14
|
+
}
|
|
15
|
+
export interface GraphEdge {
|
|
16
|
+
from: number;
|
|
17
|
+
to: number;
|
|
18
|
+
}
|
|
19
|
+
export interface DecisionGraph {
|
|
20
|
+
nodes: GraphNode[];
|
|
21
|
+
/** One edge per `superseded-by` front matter field. */
|
|
22
|
+
supersedeEdges: GraphEdge[];
|
|
23
|
+
/** Mined `ADR-N` mentions, deduplicated against formal edges. */
|
|
24
|
+
referenceEdges: GraphEdge[];
|
|
25
|
+
}
|
|
26
|
+
export declare function buildDecisionGraph(records: AdrRecord[], options?: {
|
|
27
|
+
formalOnly?: boolean;
|
|
28
|
+
}): DecisionGraph;
|
|
29
|
+
/**
|
|
30
|
+
* Mermaid flowchart. Same-date decisions share a subgraph so decision
|
|
31
|
+
* bursts are visible without implying a continuous timeline; edges are
|
|
32
|
+
* solid for formal supersession, dashed for mined references.
|
|
33
|
+
*/
|
|
34
|
+
export declare function mermaidGraph(graph: DecisionGraph): string;
|
|
35
|
+
/** Graphviz digraph with one cluster (and rank) per record date. */
|
|
36
|
+
export declare function dotGraph(graph: DecisionGraph): string;
|
|
37
|
+
export declare function jsonGraph(graph: DecisionGraph): string;
|
|
38
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/core/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,gEAAgE;AAChE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,uDAAuD;IACvD,cAAc,EAAE,SAAS,EAAE,CAAC;IAC5B,iEAAiE;IACjE,cAAc,EAAE,SAAS,EAAE,CAAC;CAC7B;AAKD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,EAAE,EACpB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,aAAa,CAwDf;AAoBD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAiCzD;AAMD,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CA2BrD;AAMD,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAmBtD"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { relativePath } from './repository.js';
|
|
2
|
+
/** The prose cross-reference vocabulary: `ADR-12`, `ADR 4`. */
|
|
3
|
+
const REFERENCE_PATTERN = /ADR-?\s*([1-9]\d*)/g;
|
|
4
|
+
export function buildDecisionGraph(records, options = {}) {
|
|
5
|
+
const nodes = [];
|
|
6
|
+
const recordByNumber = new Map();
|
|
7
|
+
for (const record of records) {
|
|
8
|
+
if (record.number === undefined)
|
|
9
|
+
continue;
|
|
10
|
+
recordByNumber.set(record.number, record);
|
|
11
|
+
const node = {
|
|
12
|
+
number: record.number,
|
|
13
|
+
title: record.title,
|
|
14
|
+
status: record.status,
|
|
15
|
+
date: record.date,
|
|
16
|
+
fileName: record.fileName,
|
|
17
|
+
path: relativePath(record),
|
|
18
|
+
references: [],
|
|
19
|
+
};
|
|
20
|
+
if (record.supersededBy !== undefined)
|
|
21
|
+
node.supersededBy = record.supersededBy;
|
|
22
|
+
nodes.push(node);
|
|
23
|
+
}
|
|
24
|
+
const supersedeEdges = nodes
|
|
25
|
+
.filter((node) => node.supersededBy !== undefined)
|
|
26
|
+
.map((node) => ({ from: node.number, to: node.supersededBy }))
|
|
27
|
+
.sort(byPair);
|
|
28
|
+
// A mined edge between two records already joined by a formal supersede
|
|
29
|
+
// edge is dropped in either direction: the formal edge already says it.
|
|
30
|
+
const formalPairs = new Set();
|
|
31
|
+
for (const edge of supersedeEdges) {
|
|
32
|
+
formalPairs.add(`${edge.from}-${edge.to}`);
|
|
33
|
+
formalPairs.add(`${edge.to}-${edge.from}`);
|
|
34
|
+
}
|
|
35
|
+
const referenceEdges = [];
|
|
36
|
+
if (!options.formalOnly) {
|
|
37
|
+
for (const node of nodes) {
|
|
38
|
+
const record = recordByNumber.get(node.number);
|
|
39
|
+
const body = record.sections.map((section) => section.body).join('\n');
|
|
40
|
+
const targets = new Set();
|
|
41
|
+
for (const match of body.matchAll(REFERENCE_PATTERN)) {
|
|
42
|
+
const target = Number(match[1]);
|
|
43
|
+
if (target === node.number)
|
|
44
|
+
continue;
|
|
45
|
+
// Prose may mention proposals or numbers that are not decisions;
|
|
46
|
+
// only references that resolve to a node become edges.
|
|
47
|
+
if (!recordByNumber.has(target))
|
|
48
|
+
continue;
|
|
49
|
+
if (formalPairs.has(`${node.number}-${target}`))
|
|
50
|
+
continue;
|
|
51
|
+
targets.add(target);
|
|
52
|
+
}
|
|
53
|
+
node.references = [...targets].sort((a, b) => a - b);
|
|
54
|
+
for (const target of node.references) {
|
|
55
|
+
referenceEdges.push({ from: node.number, to: target });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
referenceEdges.sort(byPair);
|
|
60
|
+
return { nodes, supersedeEdges, referenceEdges };
|
|
61
|
+
}
|
|
62
|
+
function byPair(a, b) {
|
|
63
|
+
return a.from - b.from || a.to - b.to;
|
|
64
|
+
}
|
|
65
|
+
/** Distinct record dates, chronological; YYYY-MM-DD sorts lexically. */
|
|
66
|
+
function dateGroups(nodes) {
|
|
67
|
+
const groups = new Map();
|
|
68
|
+
for (const node of nodes) {
|
|
69
|
+
const group = groups.get(node.date);
|
|
70
|
+
if (group === undefined) {
|
|
71
|
+
groups.set(node.date, [node]);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
group.push(node);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return new Map([...groups.entries()].sort(([a], [b]) => a.localeCompare(b)));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Mermaid flowchart. Same-date decisions share a subgraph so decision
|
|
81
|
+
* bursts are visible without implying a continuous timeline; edges are
|
|
82
|
+
* solid for formal supersession, dashed for mined references.
|
|
83
|
+
*/
|
|
84
|
+
export function mermaidGraph(graph) {
|
|
85
|
+
const header = ['flowchart LR'];
|
|
86
|
+
for (const [date, nodes] of dateGroups(graph.nodes)) {
|
|
87
|
+
header.push(` subgraph D${date.replaceAll('-', '')}["${date} (${nodes.length})"]`);
|
|
88
|
+
header.push(' direction TB');
|
|
89
|
+
for (const node of nodes) {
|
|
90
|
+
header.push(` n${node.number}["${mermaidLabel(node.title)}"]`);
|
|
91
|
+
}
|
|
92
|
+
header.push(' end');
|
|
93
|
+
}
|
|
94
|
+
const formal = graph.supersedeEdges.map((edge) => ` n${edge.from} ==>|superseded by| n${edge.to}`);
|
|
95
|
+
const references = graph.referenceEdges.map((edge) => ` n${edge.from} -.-> n${edge.to}`);
|
|
96
|
+
const retired = graph.nodes
|
|
97
|
+
.filter((node) => node.status === 'superseded')
|
|
98
|
+
.map((node) => `n${node.number}`);
|
|
99
|
+
const style = [];
|
|
100
|
+
if (retired.length > 0) {
|
|
101
|
+
// No fill: retired nodes stay transparent like every other node, so the
|
|
102
|
+
// gray dashed border and gray text are the whole distinction.
|
|
103
|
+
style.push(' classDef retired stroke:#999,stroke-dasharray:4 3,color:#777');
|
|
104
|
+
style.push(` class ${retired.join(',')} retired`);
|
|
105
|
+
}
|
|
106
|
+
const clicks = graph.nodes.map((node) => ` click n${node.number} "${node.path}"`);
|
|
107
|
+
const blocks = [header, formal, references, style, clicks].filter((block) => block.length > 0);
|
|
108
|
+
return blocks.map((block) => block.join('\n')).join('\n\n');
|
|
109
|
+
}
|
|
110
|
+
function mermaidLabel(title) {
|
|
111
|
+
return title.replaceAll('"', '#quot;');
|
|
112
|
+
}
|
|
113
|
+
/** Graphviz digraph with one cluster (and rank) per record date. */
|
|
114
|
+
export function dotGraph(graph) {
|
|
115
|
+
const lines = ['digraph decisions {', ' rankdir=LR;', ' node [shape=box];'];
|
|
116
|
+
for (const [date, nodes] of dateGroups(graph.nodes)) {
|
|
117
|
+
lines.push(` subgraph cluster_${date.replaceAll('-', '')} {`);
|
|
118
|
+
lines.push(` label="${date} (${nodes.length})";`);
|
|
119
|
+
lines.push(' {');
|
|
120
|
+
lines.push(' rank=same;');
|
|
121
|
+
for (const node of nodes) {
|
|
122
|
+
const attrs = [`label="${dotLabel(node.title)}"`];
|
|
123
|
+
if (node.status === 'superseded') {
|
|
124
|
+
// Transparent fill like every node; dashed gray border + gray text
|
|
125
|
+
// mark retirement without making it a colored block among empties.
|
|
126
|
+
attrs.push('style=dashed', 'color="#999999"');
|
|
127
|
+
}
|
|
128
|
+
lines.push(` n${node.number} [${attrs.join(', ')}];`);
|
|
129
|
+
}
|
|
130
|
+
lines.push(' }');
|
|
131
|
+
lines.push(' }');
|
|
132
|
+
}
|
|
133
|
+
for (const edge of graph.supersedeEdges) {
|
|
134
|
+
lines.push(` n${edge.from} -> n${edge.to} [label="superseded by"];`);
|
|
135
|
+
}
|
|
136
|
+
for (const edge of graph.referenceEdges) {
|
|
137
|
+
lines.push(` n${edge.from} -> n${edge.to} [style=dashed];`);
|
|
138
|
+
}
|
|
139
|
+
lines.push('}');
|
|
140
|
+
return lines.join('\n');
|
|
141
|
+
}
|
|
142
|
+
function dotLabel(title) {
|
|
143
|
+
return title.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
|
|
144
|
+
}
|
|
145
|
+
export function jsonGraph(graph) {
|
|
146
|
+
return JSON.stringify({
|
|
147
|
+
decisions: graph.nodes.map((node) => ({
|
|
148
|
+
number: node.number,
|
|
149
|
+
title: node.title,
|
|
150
|
+
status: node.status,
|
|
151
|
+
date: node.date,
|
|
152
|
+
fileName: node.fileName,
|
|
153
|
+
path: node.path,
|
|
154
|
+
supersededBy: node.supersededBy,
|
|
155
|
+
references: node.references,
|
|
156
|
+
})),
|
|
157
|
+
supersedeEdges: graph.supersedeEdges,
|
|
158
|
+
referenceEdges: graph.referenceEdges,
|
|
159
|
+
}, null, 2);
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/core/graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA6B/C,+DAA+D;AAC/D,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAEhD,MAAM,UAAU,kBAAkB,CAChC,OAAoB,EACpB,UAAoC,EAAE;IAEtC,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,MAAM,cAAc,GAAG,IAAI,GAAG,EAAqB,CAAC;IACpD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,SAAS;QAC1C,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,IAAI,GAAc;YACtB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC;YAC1B,UAAU,EAAE,EAAE;SACf,CAAC;QACF,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS;YAAE,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QAC/E,KAAK,CAAC,IAAI,C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CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC/D,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAoB;IAC5C,OAAO,IAAI,CAAC,SAAS,CACnB;QACE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CAAC;QACH,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,cAAc,EAAE,KAAK,CAAC,cAAc;KACrC,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,16 +2,29 @@ export interface ToolIntegration {
|
|
|
2
2
|
tool: string;
|
|
3
3
|
path: string;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Integration targets. The default is the vendor-neutral `.agents/`
|
|
7
|
+
* convention: every mainstream agent (Codex, Cursor, GitHub Copilot / VS
|
|
8
|
+
* Code, Junie, OpenCode, ...) discovers skills and commands there. Claude
|
|
9
|
+
* Code is the one holdout - it scans only `.claude/` - so it stays an
|
|
10
|
+
* explicit exception (`--tools claude`) until Anthropic ships AGENTS.md
|
|
11
|
+
* support.
|
|
12
|
+
*/
|
|
13
|
+
export type IntegrationTarget = 'agents' | 'claude';
|
|
7
14
|
export interface Workflow {
|
|
8
15
|
name: string;
|
|
9
16
|
description: string;
|
|
10
17
|
body: string;
|
|
11
18
|
}
|
|
12
19
|
export declare const WORKFLOWS: Workflow[];
|
|
13
|
-
export declare function parseTools(value: string | undefined):
|
|
14
|
-
export declare function writeToolIntegrations(root: string, tools:
|
|
15
|
-
|
|
20
|
+
export declare function parseTools(value: string | undefined): IntegrationTarget[];
|
|
21
|
+
export declare function writeToolIntegrations(root: string, tools: IntegrationTarget[]): ToolIntegration[];
|
|
22
|
+
/** Targets whose integration files no longer belong to the selection. */
|
|
23
|
+
export declare function staleIntegrationKeys(selected: string[]): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Remove our integration files for every stale key. Returns the keys that
|
|
26
|
+
* actually had files so the caller only reports real removals.
|
|
27
|
+
*/
|
|
28
|
+
export declare function removeToolIntegrations(root: string, keys: string[]): string[];
|
|
16
29
|
export declare function integrationSummary(root: string, created: ToolIntegration[]): string[];
|
|
17
30
|
//# sourceMappingURL=tool-integrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-integrations.d.ts","sourceRoot":"","sources":["../../src/core/tool-integrations.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED
|
|
1
|
+
{"version":3,"file":"tool-integrations.d.ts","sourceRoot":"","sources":["../../src/core/tool-integrations.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAapD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAID,eAAO,MAAM,SAAS,EAAE,QAAQ,EA+M/B,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,iBAAiB,EAAE,CAqBzE;AAaD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,eAAe,EAAE,CA6BjG;AAwBD,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAEjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAyB7E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAErF"}
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, readdirSync, rmdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { dirname, join, relative } from 'node:path';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
claude: '.claude/commands',
|
|
6
|
-
codex: '.codex/commands',
|
|
7
|
-
cursor: '.cursor/commands',
|
|
8
|
-
'github-copilot': '.github/prompts',
|
|
9
|
-
agents: '.agents/commands',
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Agent skills directories per tool (github-copilot is absent: it supports
|
|
13
|
-
* prompts only, not a skills tree). Skills are surfaced at session start,
|
|
14
|
-
* unlike slash-command files which load only when invoked.
|
|
15
|
-
*/
|
|
16
|
-
const TOOL_SKILL_DIR = {
|
|
17
|
-
claude: '.claude/skills',
|
|
18
|
-
codex: '.codex/skills',
|
|
19
|
-
cursor: '.cursor/skills',
|
|
20
|
-
agents: '.agents/skills',
|
|
3
|
+
const TARGET_DIRS = {
|
|
4
|
+
agents: { commands: '.agents/commands', skills: '.agents/skills' },
|
|
5
|
+
claude: { commands: '.claude/commands', skills: '.claude/skills' },
|
|
21
6
|
};
|
|
22
7
|
// The bodies mirror skills/<name>/SKILL.md one-to-one; the sync is
|
|
23
8
|
// machine-checked in test/integrations.test.ts.
|
|
@@ -230,26 +215,27 @@ adrkit supersede "<old name or number>" --by "<new name or number>"
|
|
|
230
215
|
},
|
|
231
216
|
];
|
|
232
217
|
export function parseTools(value) {
|
|
233
|
-
|
|
218
|
+
// Flag absent: the standard integration is the default. An explicit empty
|
|
219
|
+
// string (a config that recorded `tools: []`) keeps meaning "opt out".
|
|
220
|
+
if (value === undefined)
|
|
221
|
+
return ['agents'];
|
|
222
|
+
const text = value.trim();
|
|
223
|
+
if (text.length === 0 || text === 'none')
|
|
234
224
|
return [];
|
|
235
|
-
|
|
236
|
-
const requested = value
|
|
225
|
+
const requested = text
|
|
237
226
|
.split(',')
|
|
238
227
|
.map((entry) => entry.trim())
|
|
239
228
|
.filter((entry) => entry.length > 0);
|
|
240
|
-
|
|
241
|
-
return [...SUPPORTED_TOOLS];
|
|
242
|
-
}
|
|
243
|
-
const tools = [];
|
|
229
|
+
const targets = [];
|
|
244
230
|
for (const entry of requested) {
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
throw new Error(`unknown tool "${entry}". Supported tools: ${SUPPORTED_TOOLS.join(', ')}, all, none`);
|
|
231
|
+
if (entry !== 'agents' && entry !== 'claude') {
|
|
232
|
+
throw new Error(`unknown tool "${entry}". Supported: agents (default), claude, none`);
|
|
250
233
|
}
|
|
234
|
+
targets.push(entry);
|
|
251
235
|
}
|
|
252
|
-
|
|
236
|
+
// The standard target always ships; claude is an addition for mixed teams,
|
|
237
|
+
// never a replacement for the files every other agent reads.
|
|
238
|
+
return [...new Set(['agents', ...targets])];
|
|
253
239
|
}
|
|
254
240
|
/** Installed skill content: canonical frontmatter plus the workflow body. */
|
|
255
241
|
function skillFrontmatter(workflow) {
|
|
@@ -264,11 +250,11 @@ ${workflow.body}
|
|
|
264
250
|
export function writeToolIntegrations(root, tools) {
|
|
265
251
|
const created = [];
|
|
266
252
|
for (const tool of tools) {
|
|
267
|
-
const
|
|
268
|
-
mkdirSync(
|
|
253
|
+
const dirs = TARGET_DIRS[tool];
|
|
254
|
+
mkdirSync(join(root, dirs.commands), { recursive: true });
|
|
269
255
|
for (const workflow of WORKFLOWS) {
|
|
270
256
|
const fileName = `${workflow.name}.md`;
|
|
271
|
-
const path = join(
|
|
257
|
+
const path = join(root, dirs.commands, fileName);
|
|
272
258
|
writeFileSync(path, `---
|
|
273
259
|
description: ${workflow.description}
|
|
274
260
|
---
|
|
@@ -277,10 +263,9 @@ ${workflow.body}
|
|
|
277
263
|
`);
|
|
278
264
|
created.push({ tool, path });
|
|
279
265
|
}
|
|
280
|
-
|
|
281
|
-
if (skillBase !== undefined) {
|
|
266
|
+
if (dirs.skills !== undefined) {
|
|
282
267
|
for (const workflow of WORKFLOWS) {
|
|
283
|
-
const skillPath = join(root,
|
|
268
|
+
const skillPath = join(root, dirs.skills, workflow.name, 'SKILL.md');
|
|
284
269
|
mkdirSync(dirname(skillPath), { recursive: true });
|
|
285
270
|
writeFileSync(skillPath, skillFrontmatter(workflow));
|
|
286
271
|
created.push({ tool, path: skillPath });
|
|
@@ -301,29 +286,55 @@ function removeEmptyDir(dir) {
|
|
|
301
286
|
// Directory does not exist or is not empty; nothing to clean.
|
|
302
287
|
}
|
|
303
288
|
}
|
|
304
|
-
|
|
305
|
-
for (const
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
rmSync(path);
|
|
311
|
-
}
|
|
289
|
+
function targetHasIntegrations(root, dirs) {
|
|
290
|
+
for (const workflow of WORKFLOWS) {
|
|
291
|
+
if (existsSync(join(root, dirs.commands, `${workflow.name}.md`)))
|
|
292
|
+
return true;
|
|
293
|
+
if (dirs.skills !== undefined && existsSync(join(root, dirs.skills, workflow.name, 'SKILL.md'))) {
|
|
294
|
+
return true;
|
|
312
295
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
296
|
+
}
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
/** Targets whose integration files no longer belong to the selection. */
|
|
300
|
+
export function staleIntegrationKeys(selected) {
|
|
301
|
+
return Object.keys(TARGET_DIRS).filter((key) => !selected.includes(key));
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Remove our integration files for every stale key. Returns the keys that
|
|
305
|
+
* actually had files so the caller only reports real removals.
|
|
306
|
+
*/
|
|
307
|
+
export function removeToolIntegrations(root, keys) {
|
|
308
|
+
const removed = [];
|
|
309
|
+
for (const key of keys) {
|
|
310
|
+
const dirs = TARGET_DIRS[key];
|
|
311
|
+
if (dirs === undefined)
|
|
312
|
+
continue;
|
|
313
|
+
const hadFiles = targetHasIntegrations(root, dirs);
|
|
314
|
+
for (const workflow of WORKFLOWS) {
|
|
315
|
+
const commandPath = join(root, dirs.commands, `${workflow.name}.md`);
|
|
316
|
+
if (existsSync(commandPath))
|
|
317
|
+
rmSync(commandPath);
|
|
318
|
+
if (dirs.skills !== undefined) {
|
|
319
|
+
const skillDir = join(root, dirs.skills, workflow.name);
|
|
318
320
|
const skillPath = join(skillDir, 'SKILL.md');
|
|
319
|
-
if (existsSync(skillPath))
|
|
321
|
+
if (existsSync(skillPath))
|
|
320
322
|
rmSync(skillPath);
|
|
321
|
-
}
|
|
322
323
|
removeEmptyDir(skillDir);
|
|
323
324
|
}
|
|
324
|
-
removeEmptyDir(baseDir);
|
|
325
325
|
}
|
|
326
|
+
removeEmptyDir(join(root, dirs.commands));
|
|
327
|
+
if (dirs.skills !== undefined)
|
|
328
|
+
removeEmptyDir(join(root, dirs.skills));
|
|
329
|
+
// The vendor root itself goes too, but only when empty: removeEmptyDir
|
|
330
|
+
// never deletes a directory that still holds the user's own files.
|
|
331
|
+
removeEmptyDir(dirname(join(root, dirs.commands)));
|
|
332
|
+
if (dirs.skills !== undefined)
|
|
333
|
+
removeEmptyDir(dirname(join(root, dirs.skills)));
|
|
334
|
+
if (hadFiles)
|
|
335
|
+
removed.push(key);
|
|
326
336
|
}
|
|
337
|
+
return removed;
|
|
327
338
|
}
|
|
328
339
|
export function integrationSummary(root, created) {
|
|
329
340
|
return created.map((item) => ` created ${relative(root, item.path)} (${item.tool})`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-integrations.js","sourceRoot":"","sources":["../../src/core/tool-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-integrations.js","sourceRoot":"","sources":["../../src/core/tool-integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAuBpD,MAAM,WAAW,GAA0C;IACzD,MAAM,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,gBAAgB,EAAE;IAClE,MAAM,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,gBAAgB,EAAE;CACnE,CAAC;AAQF,mEAAmE;AACnE,gDAAgD;AAChD,MAAM,CAAC,MAAM,SAAS,GAAe;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