adr-kit 0.2.0 → 0.2.2
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/LICENSE +1 -1
- package/README.md +73 -56
- package/README.zh.md +73 -48
- package/dist/cli.js +19 -19
- package/dist/cli.js.map +1 -1
- package/dist/commands/accept.d.ts.map +1 -1
- package/dist/commands/accept.js +12 -5
- package/dist/commands/accept.js.map +1 -1
- package/dist/commands/completion.js +4 -4
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/decide.js +4 -4
- package/dist/commands/decide.js.map +1 -1
- package/dist/commands/init.js +3 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/instructions.d.ts.map +1 -1
- package/dist/commands/instructions.js +64 -17
- package/dist/commands/instructions.js.map +1 -1
- package/dist/commands/list.js +1 -1
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/propose.js +4 -4
- package/dist/commands/propose.js.map +1 -1
- package/dist/commands/reject.js +5 -5
- package/dist/commands/reject.js.map +1 -1
- package/dist/commands/supersede.d.ts.map +1 -1
- package/dist/commands/supersede.js +2 -3
- package/dist/commands/supersede.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +11 -6
- package/dist/commands/update.js.map +1 -1
- package/dist/core/adr.d.ts +0 -5
- package/dist/core/adr.d.ts.map +1 -1
- package/dist/core/adr.js +0 -13
- package/dist/core/adr.js.map +1 -1
- package/dist/core/config.d.ts +10 -3
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +36 -8
- package/dist/core/config.js.map +1 -1
- package/dist/core/repository.d.ts.map +1 -1
- package/dist/core/repository.js +7 -8
- package/dist/core/repository.js.map +1 -1
- package/dist/core/templates.d.ts +7 -1
- package/dist/core/templates.d.ts.map +1 -1
- package/dist/core/templates.js +21 -2
- package/dist/core/templates.js.map +1 -1
- package/dist/core/tool-integrations.d.ts +3 -2
- package/dist/core/tool-integrations.d.ts.map +1 -1
- package/dist/core/tool-integrations.js +103 -36
- package/dist/core/tool-integrations.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +11 -1
- package/dist/version.js.map +1 -1
- package/package.json +10 -2
- /package/bin/{openadr.js → adrkit.js} +0 -0
package/dist/core/templates.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AdrRecord } from './adr.js';
|
|
2
2
|
export declare function proposalTemplate(title: string, context?: string): string;
|
|
3
3
|
export declare function decisionTemplate(number: number, title: string, context?: string): string;
|
|
4
4
|
export declare function rejectedTemplate(title: string, reason: string): string;
|
|
@@ -8,4 +8,10 @@ export declare function rejectedTemplate(title: string, reason: string): string;
|
|
|
8
8
|
* acceptance criteria and risks are folded into Consequences.
|
|
9
9
|
*/
|
|
10
10
|
export declare function proposalToDecision(proposal: AdrRecord, number: number): string;
|
|
11
|
+
/**
|
|
12
|
+
* Proposal sections that have no place in an accepted decision and would be
|
|
13
|
+
* silently discarded by `proposalToDecision`. Callers should surface these so
|
|
14
|
+
* a mechanical lifecycle move never loses content without warning.
|
|
15
|
+
*/
|
|
16
|
+
export declare function droppedSections(proposal: AdrRecord): string[];
|
|
11
17
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AA0BnD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAyBxE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAsBxF;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAqC9E;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,SAAS,GAAG,MAAM,EAAE,CAI7D"}
|
package/dist/core/templates.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { section } from './adr.js';
|
|
2
|
+
/** Proposal sections that survive the mechanical accept rewrite. */
|
|
3
|
+
const PRESERVED_SECTIONS = [
|
|
4
|
+
'Problem',
|
|
5
|
+
'Proposal',
|
|
6
|
+
'Alternatives considered',
|
|
7
|
+
'Acceptance criteria',
|
|
8
|
+
'Risks',
|
|
9
|
+
];
|
|
1
10
|
/**
|
|
2
11
|
* 把 config.yaml 的 context 注入模板:放在标题块之后、第一个 section 之前。
|
|
3
12
|
* 解析器忽略游离文本(current 为 null 时不收集),accept 的机械改写也会
|
|
4
|
-
*
|
|
13
|
+
* 丢弃它。注释只在草案期可见,正是写作者需要项目上下文的时刻。
|
|
5
14
|
*/
|
|
6
15
|
function contextBlock(context) {
|
|
7
16
|
const text = context?.trim() ?? '';
|
|
@@ -121,6 +130,16 @@ ${alternatives.trim() || '_No alternatives recorded._'}
|
|
|
121
130
|
${consequences.join('\n')}\n`;
|
|
122
131
|
}
|
|
123
132
|
function sectionBody(record, heading) {
|
|
124
|
-
return record
|
|
133
|
+
return section(record, heading)?.trim() ?? '';
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Proposal sections that have no place in an accepted decision and would be
|
|
137
|
+
* silently discarded by `proposalToDecision`. Callers should surface these so
|
|
138
|
+
* a mechanical lifecycle move never loses content without warning.
|
|
139
|
+
*/
|
|
140
|
+
export function droppedSections(proposal) {
|
|
141
|
+
return proposal.sections
|
|
142
|
+
.map((candidate) => candidate.heading)
|
|
143
|
+
.filter((heading) => !PRESERVED_SECTIONS.includes(heading));
|
|
125
144
|
}
|
|
126
145
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/core/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AAEnD,oEAAoE;AACpE,MAAM,kBAAkB,GAAG;IACzB,SAAS;IACT,UAAU;IACV,yBAAyB;IACzB,qBAAqB;IACrB,OAAO;CACR,CAAC;AAEF;;;;GAIG;AACH,SAAS,YAAY,CAAC,OAAuB;IAC3C,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnC,oCAAoC;IACpC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IAC5D,OAAO;EACP,IAAI;;CAEL,CAAC;AACF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,OAAgB;IAC9D,OAAO,UAAU,KAAK;;;EAGtB,YAAY,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;CAoBtB,CAAC;AACF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,KAAa,EAAE,OAAgB;IAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/C,OAAO,UAAU,MAAM,IAAI,KAAK;;;EAGhC,YAAY,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;CAgBtB,CAAC;AACF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KA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BAAwB;;;;EAI1C,QAAQ,CAAC,IAAI,EAAE,IAAI,yBAAyB;;;;EAI5C,YAAY,CAAC,IAAI,EAAE,IAAI,6BAA6B;;;;EAIpD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,WAAW,CAAC,MAAiB,EAAE,OAAe;IACrD,OAAO,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,QAAmB;IACjD,OAAO,QAAQ,CAAC,QAAQ;SACrB,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;SACrC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -4,11 +4,12 @@ export interface ToolIntegration {
|
|
|
4
4
|
}
|
|
5
5
|
export declare const SUPPORTED_TOOLS: readonly ["claude", "codex", "cursor", "github-copilot", "agents"];
|
|
6
6
|
export type ToolId = (typeof SUPPORTED_TOOLS)[number];
|
|
7
|
-
export
|
|
7
|
+
export interface Workflow {
|
|
8
8
|
name: string;
|
|
9
9
|
description: string;
|
|
10
10
|
body: string;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
|
+
export declare const WORKFLOWS: Workflow[];
|
|
12
13
|
export declare function parseTools(value: string | undefined): ToolId[];
|
|
13
14
|
export declare function writeToolIntegrations(root: string, tools: ToolId[]): ToolIntegration[];
|
|
14
15
|
export declare function removeToolIntegrations(root: string, tools: ToolId[]): void;
|
|
@@ -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,eAAO,MAAM,eAAe,oEAAqE,CAAC;AAClG,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
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,eAAO,MAAM,eAAe,oEAAqE,CAAC;AAClG,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAsBtD,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,EAuM/B,CAAC;AAEF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAwB9D;AAaD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,eAAe,EAAE,CA8BtF;AAcD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAuB1E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAErF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join, relative } from 'node:path';
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, rmdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, relative } from 'node:path';
|
|
3
3
|
export const SUPPORTED_TOOLS = ['claude', 'codex', 'cursor', 'github-copilot', 'agents'];
|
|
4
4
|
const TOOL_COMMAND_DIR = {
|
|
5
5
|
claude: '.claude/commands',
|
|
@@ -8,13 +8,24 @@ const TOOL_COMMAND_DIR = {
|
|
|
8
8
|
'github-copilot': '.github/prompts',
|
|
9
9
|
agents: '.agents/commands',
|
|
10
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',
|
|
21
|
+
};
|
|
11
22
|
// The bodies mirror skills/<name>/SKILL.md one-to-one; the sync is
|
|
12
23
|
// machine-checked in test/integrations.test.ts.
|
|
13
24
|
export const WORKFLOWS = [
|
|
14
25
|
{
|
|
15
|
-
name: '
|
|
16
|
-
description: 'Use when initializing
|
|
17
|
-
body: `#
|
|
26
|
+
name: 'adrkit-init',
|
|
27
|
+
description: 'Use when initializing ADR Kit in a repository or when the agent cannot find an adr/ directory.',
|
|
28
|
+
body: `# ADR Kit Init
|
|
18
29
|
|
|
19
30
|
## Overview
|
|
20
31
|
|
|
@@ -26,7 +37,7 @@ Create an \`adr/\` repository in the target directory.
|
|
|
26
37
|
2. Run:
|
|
27
38
|
|
|
28
39
|
\`\`\`bash
|
|
29
|
-
|
|
40
|
+
adrkit init [path]
|
|
30
41
|
\`\`\`
|
|
31
42
|
|
|
32
43
|
3. Confirm the output lists \`adr/config.yaml\`, \`adr/decisions\`,
|
|
@@ -36,41 +47,45 @@ openadr init [path]
|
|
|
36
47
|
|
|
37
48
|
- Never create \`adr/\` directories by hand; use the CLI so the config and
|
|
38
49
|
README stay canonical.
|
|
39
|
-
- After init, the next action is usually \`
|
|
50
|
+
- After init, the next action is usually \`adrkit propose "<title>"\`.`,
|
|
40
51
|
},
|
|
41
52
|
{
|
|
42
|
-
name: '
|
|
53
|
+
name: 'adrkit-propose',
|
|
43
54
|
description: 'Use when starting a new architecture decision that still needs review before it is accepted.',
|
|
44
|
-
body: `#
|
|
55
|
+
body: `# ADR Kit Propose
|
|
45
56
|
|
|
46
57
|
## Overview
|
|
47
58
|
|
|
48
59
|
Create a proposed ADR in \`adr/proposed/\`. The proposal is a draft and is
|
|
49
|
-
expected to fail \`
|
|
60
|
+
expected to fail \`adrkit validate\` until every required section is filled.
|
|
50
61
|
|
|
51
62
|
## Steps
|
|
52
63
|
|
|
53
64
|
1. Run:
|
|
54
65
|
|
|
55
66
|
\`\`\`bash
|
|
56
|
-
|
|
67
|
+
adrkit propose "<title>"
|
|
57
68
|
\`\`\`
|
|
58
69
|
|
|
59
70
|
2. Edit the created file. Fill every section with real content:
|
|
60
71
|
\`## Problem\`, \`## Proposal\`, \`## Alternatives considered\`,
|
|
61
72
|
\`## Acceptance criteria\`, \`## Risks\`.
|
|
62
|
-
3. Run \`
|
|
73
|
+
3. Run \`adrkit validate\` until it returns OK.
|
|
63
74
|
|
|
64
75
|
## Rules
|
|
65
76
|
|
|
66
77
|
- Do not skip \`## Alternatives considered\`. A proposal without alternatives
|
|
67
78
|
is invalid by design.
|
|
68
|
-
- Keep the status line exactly \`Status: proposed
|
|
79
|
+
- Keep the status line exactly \`Status: proposed\`.
|
|
80
|
+
- Before proposing, run \`adrkit list\` and check whether this decision
|
|
81
|
+
supersedes or overlaps an existing one; mention that in the record. Re-run
|
|
82
|
+
it even if you ran it earlier in this conversation: session memory can be
|
|
83
|
+
stale, and the repo may have changed.`,
|
|
69
84
|
},
|
|
70
85
|
{
|
|
71
|
-
name: '
|
|
86
|
+
name: 'adrkit-decide',
|
|
72
87
|
description: 'Use when recording a decision that is already accepted and does not need a proposal phase.',
|
|
73
|
-
body: `#
|
|
88
|
+
body: `# ADR Kit Decide
|
|
74
89
|
|
|
75
90
|
## Overview
|
|
76
91
|
|
|
@@ -82,23 +97,23 @@ next \`NNNN\` number.
|
|
|
82
97
|
1. Run:
|
|
83
98
|
|
|
84
99
|
\`\`\`bash
|
|
85
|
-
|
|
100
|
+
adrkit decide "<title>"
|
|
86
101
|
\`\`\`
|
|
87
102
|
|
|
88
103
|
2. Edit the created file and fill \`## Problem\`, \`## Decision\`,
|
|
89
104
|
\`## Alternatives considered\`, and \`## Consequences\`.
|
|
90
|
-
3. Run \`
|
|
105
|
+
3. Run \`adrkit validate <NNNN>\` until it returns OK.
|
|
91
106
|
|
|
92
107
|
## Rules
|
|
93
108
|
|
|
94
109
|
- Accepted decisions must not contain \`## Proposal\`, \`## Acceptance
|
|
95
110
|
criteria\`, or \`## Risks\` sections.
|
|
96
|
-
- \`
|
|
111
|
+
- \`adrkit accept\` is the better path when a proposal already exists.`,
|
|
97
112
|
},
|
|
98
113
|
{
|
|
99
|
-
name: '
|
|
100
|
-
description: 'Use when checking whether ADR files follow the
|
|
101
|
-
body: `#
|
|
114
|
+
name: 'adrkit-validate',
|
|
115
|
+
description: 'Use when checking whether ADR files follow the ADR Kit format, especially before accepting a proposal or committing.',
|
|
116
|
+
body: `# ADR Kit Validate
|
|
102
117
|
|
|
103
118
|
## Overview
|
|
104
119
|
|
|
@@ -107,7 +122,7 @@ Run the machine checks for one record or the whole repository.
|
|
|
107
122
|
## Steps
|
|
108
123
|
|
|
109
124
|
\`\`\`bash
|
|
110
|
-
|
|
125
|
+
adrkit validate [name] [--all] [--json]
|
|
111
126
|
\`\`\`
|
|
112
127
|
|
|
113
128
|
- With no \`name\`, the whole repository is validated.
|
|
@@ -115,14 +130,14 @@ openadr validate [name] [--json]
|
|
|
115
130
|
|
|
116
131
|
## Rules
|
|
117
132
|
|
|
118
|
-
- Treat any non-OK output as a blocker for \`
|
|
133
|
+
- Treat any non-OK output as a blocker for \`adrkit accept\`.
|
|
119
134
|
- A fresh draft is expected to fail until the required sections are
|
|
120
135
|
filled in; fix the exact issue printed rather than deleting sections.`,
|
|
121
136
|
},
|
|
122
137
|
{
|
|
123
|
-
name: '
|
|
138
|
+
name: 'adrkit-accept',
|
|
124
139
|
description: 'Use when a proposed ADR is complete and validated, and the team has decided to accept it.',
|
|
125
|
-
body: `#
|
|
140
|
+
body: `# ADR Kit Accept
|
|
126
141
|
|
|
127
142
|
## Overview
|
|
128
143
|
|
|
@@ -133,11 +148,11 @@ file from \`adr/proposed/\` to \`adr/decisions/\`.
|
|
|
133
148
|
|
|
134
149
|
## Steps
|
|
135
150
|
|
|
136
|
-
1. Run \`
|
|
151
|
+
1. Run \`adrkit validate\` and confirm the proposal is OK.
|
|
137
152
|
2. Run:
|
|
138
153
|
|
|
139
154
|
\`\`\`bash
|
|
140
|
-
|
|
155
|
+
adrkit accept "<name>"
|
|
141
156
|
\`\`\`
|
|
142
157
|
|
|
143
158
|
3. Confirm the output names the new \`adr/decisions/NNNN-*.md\` file.
|
|
@@ -145,12 +160,17 @@ openadr accept "<name>"
|
|
|
145
160
|
## Rules
|
|
146
161
|
|
|
147
162
|
- Never accept an invalid proposal; the command refuses.
|
|
148
|
-
-
|
|
163
|
+
- Re-run \`adrkit validate\` immediately before accepting, even if you
|
|
164
|
+
validated earlier in this conversation; the repo may have changed since.
|
|
165
|
+
- Review the generated \`## Consequences\` after accepting.
|
|
166
|
+
- The command warns when a proposal contains sections that have no place in
|
|
167
|
+
an accepted decision (for example \`## Plan\`); save their content elsewhere
|
|
168
|
+
if it still matters.`,
|
|
149
169
|
},
|
|
150
170
|
{
|
|
151
|
-
name: '
|
|
171
|
+
name: 'adrkit-reject',
|
|
152
172
|
description: 'Use when a proposed ADR should be declined and frozen for future reference.',
|
|
153
|
-
body: `#
|
|
173
|
+
body: `# ADR Kit Reject
|
|
154
174
|
|
|
155
175
|
## Overview
|
|
156
176
|
|
|
@@ -160,7 +180,7 @@ Reject a proposal. The CLI moves the file from \`adr/proposed/\` to
|
|
|
160
180
|
## Steps
|
|
161
181
|
|
|
162
182
|
\`\`\`bash
|
|
163
|
-
|
|
183
|
+
adrkit reject "<name>" --reason "<why it was rejected>"
|
|
164
184
|
\`\`\`
|
|
165
185
|
|
|
166
186
|
## Rules
|
|
@@ -169,9 +189,9 @@ openadr reject "<name>" --reason "<why it was rejected>"
|
|
|
169
189
|
- A rejected record is frozen history. Do not edit it afterwards.`,
|
|
170
190
|
},
|
|
171
191
|
{
|
|
172
|
-
name: '
|
|
192
|
+
name: 'adrkit-supersede',
|
|
173
193
|
description: 'Use when an accepted decision is replaced by a newer accepted decision and must be retired without deleting history.',
|
|
174
|
-
body: `#
|
|
194
|
+
body: `# ADR Kit Supersede
|
|
175
195
|
|
|
176
196
|
## Overview
|
|
177
197
|
|
|
@@ -181,18 +201,21 @@ line to \`Status: superseded by NNNN\` and leaves the record in
|
|
|
181
201
|
|
|
182
202
|
## Steps
|
|
183
203
|
|
|
184
|
-
1. Record the replacement first (\`
|
|
185
|
-
\`
|
|
204
|
+
1. Record the replacement first (\`adrkit decide\` or \`adrkit propose\` +
|
|
205
|
+
\`adrkit accept\`), and make sure it validates.
|
|
186
206
|
2. Run:
|
|
187
207
|
|
|
188
208
|
\`\`\`bash
|
|
189
|
-
|
|
209
|
+
adrkit supersede "<old name or number>" --by "<new name or number>"
|
|
190
210
|
\`\`\`
|
|
191
211
|
|
|
192
212
|
## Rules
|
|
193
213
|
|
|
194
214
|
- \`--by\` must reference an existing accepted decision that is not itself
|
|
195
215
|
superseded; the command refuses dangling chains.
|
|
216
|
+
- Re-run \`adrkit list\` right before superseding to confirm the \`--by\` target
|
|
217
|
+
still exists and is not itself superseded, even if you checked earlier in
|
|
218
|
+
this conversation.
|
|
196
219
|
- Never hand-edit a superseded record afterwards; it is history.
|
|
197
220
|
- Mention what it supersedes in the new decision's \`## Problem\` section so
|
|
198
221
|
the causal link survives in prose.`,
|
|
@@ -220,6 +243,16 @@ export function parseTools(value) {
|
|
|
220
243
|
}
|
|
221
244
|
return [...new Set(tools)];
|
|
222
245
|
}
|
|
246
|
+
/** Installed skill content: canonical frontmatter plus the workflow body. */
|
|
247
|
+
function skillFrontmatter(workflow) {
|
|
248
|
+
return `---
|
|
249
|
+
name: ${workflow.name}
|
|
250
|
+
description: ${workflow.description}
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
${workflow.body}
|
|
254
|
+
`;
|
|
255
|
+
}
|
|
223
256
|
export function writeToolIntegrations(root, tools) {
|
|
224
257
|
const created = [];
|
|
225
258
|
for (const tool of tools) {
|
|
@@ -236,9 +269,30 @@ ${workflow.body}
|
|
|
236
269
|
`);
|
|
237
270
|
created.push({ tool, path });
|
|
238
271
|
}
|
|
272
|
+
const skillBase = TOOL_SKILL_DIR[tool];
|
|
273
|
+
if (skillBase !== undefined) {
|
|
274
|
+
for (const workflow of WORKFLOWS) {
|
|
275
|
+
const skillPath = join(root, skillBase, workflow.name, 'SKILL.md');
|
|
276
|
+
mkdirSync(dirname(skillPath), { recursive: true });
|
|
277
|
+
writeFileSync(skillPath, skillFrontmatter(workflow));
|
|
278
|
+
created.push({ tool, path: skillPath });
|
|
279
|
+
}
|
|
280
|
+
}
|
|
239
281
|
}
|
|
240
282
|
return created;
|
|
241
283
|
}
|
|
284
|
+
function removeEmptyDir(dir) {
|
|
285
|
+
try {
|
|
286
|
+
// rmdirSync only removes empty directories; rmSync throws EISDIR on
|
|
287
|
+
// directories (even empty) in current Node, so it cannot be used here.
|
|
288
|
+
if (readdirSync(dir).length === 0) {
|
|
289
|
+
rmdirSync(dir);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
// Directory does not exist or is not empty; nothing to clean.
|
|
294
|
+
}
|
|
295
|
+
}
|
|
242
296
|
export function removeToolIntegrations(root, tools) {
|
|
243
297
|
for (const tool of tools) {
|
|
244
298
|
const dir = join(root, TOOL_COMMAND_DIR[tool]);
|
|
@@ -248,6 +302,19 @@ export function removeToolIntegrations(root, tools) {
|
|
|
248
302
|
rmSync(path);
|
|
249
303
|
}
|
|
250
304
|
}
|
|
305
|
+
const skillBase = TOOL_SKILL_DIR[tool];
|
|
306
|
+
if (skillBase !== undefined) {
|
|
307
|
+
const baseDir = join(root, skillBase);
|
|
308
|
+
for (const workflow of WORKFLOWS) {
|
|
309
|
+
const skillDir = join(baseDir, workflow.name);
|
|
310
|
+
const skillPath = join(skillDir, 'SKILL.md');
|
|
311
|
+
if (existsSync(skillPath)) {
|
|
312
|
+
rmSync(skillPath);
|
|
313
|
+
}
|
|
314
|
+
removeEmptyDir(skillDir);
|
|
315
|
+
}
|
|
316
|
+
removeEmptyDir(baseDir);
|
|
317
|
+
}
|
|
251
318
|
}
|
|
252
319
|
}
|
|
253
320
|
export function integrationSummary(root, created) {
|
|
@@ -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,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,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;AAOpD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAU,CAAC;AAGlG,MAAM,gBAAgB,GAA2B;IAC/C,MAAM,EAAE,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB;IACxB,MAAM,EAAE,kBAAkB;IAC1B,gBAAgB,EAAE,iBAAiB;IACnC,MAAM,EAAE,kBAAkB;CAC3B,CAAC;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ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION
|
|
1
|
+
export declare const VERSION: string;
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,OAAO,QAAsB,CAAC"}
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
/**
|
|
5
|
+
* The version comes from package.json, which is the single source of truth
|
|
6
|
+
* (changesets bump it on every release). A hardcoded constant here would
|
|
7
|
+
* drift from the published version and make `adrkit --version` lie.
|
|
8
|
+
*/
|
|
9
|
+
const packageJsonPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
|
10
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
11
|
+
export const VERSION = packageJson.version;
|
|
2
12
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAC5F,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAwB,CAAC;AAE7F,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adr-kit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Open Architecture Decision Records \u2014 a lightweight ADR workflow for humans and agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/luochang212/adr-kit.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/luochang212/adr-kit#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/luochang212/adr-kit/issues"
|
|
14
|
+
},
|
|
7
15
|
"engines": {
|
|
8
16
|
"node": ">=20.19"
|
|
9
17
|
},
|
|
10
18
|
"bin": {
|
|
11
|
-
"
|
|
19
|
+
"adrkit": "bin/adrkit.js"
|
|
12
20
|
},
|
|
13
21
|
"files": [
|
|
14
22
|
"bin",
|
|
File without changes
|