@codemcp/ade 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.beads/issues.jsonl +37 -0
- package/.beads/last-touched +1 -1
- package/.kiro/agents/ade.json +10 -2
- package/.kiro/settings/mcp.json +6 -1
- package/.opencode/agents/ade.md +7 -2
- package/.vibe/beads-state-ade-extension-override-skills-d44z9p.json +29 -0
- package/.vibe/beads-state-ade-fix-docset-writing-37fuoj.json +29 -0
- package/.vibe/development-plan-extension-override-skills.md +110 -0
- package/.vibe/development-plan-fix-docset-writing.md +77 -0
- package/.vibe/docs/architecture.md +201 -0
- package/.vibe/docs/design.md +179 -0
- package/.vibe/docs/requirements.md +17 -0
- package/ade.extensions.mjs +13 -15
- package/config.lock.yaml +6 -1
- package/docs/CLI-PRD.md +38 -40
- package/docs/CLI-design.md +47 -57
- package/docs/guide/extensions.md +6 -14
- package/package.json +1 -1
- package/packages/cli/dist/index.js +15213 -5579
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/commands/conventions.integration.spec.ts +29 -4
- package/packages/cli/src/commands/extensions.integration.spec.ts +26 -4
- package/packages/cli/src/commands/install.ts +2 -0
- package/packages/cli/src/commands/knowledge-docset.integration.spec.ts +179 -0
- package/packages/cli/src/commands/knowledge.integration.spec.ts +24 -36
- package/packages/cli/src/commands/setup.spec.ts +1 -101
- package/packages/cli/src/commands/setup.ts +23 -36
- package/packages/cli/src/knowledge-installer.spec.ts +43 -3
- package/packages/cli/src/knowledge-installer.ts +12 -9
- package/packages/core/package.json +1 -1
- package/packages/core/src/catalog/catalog.spec.ts +75 -43
- package/packages/core/src/catalog/facets/architecture.ts +89 -58
- package/packages/core/src/catalog/facets/practices.ts +9 -8
- package/packages/core/src/index.ts +4 -4
- package/packages/core/src/registry.spec.ts +1 -1
- package/packages/core/src/registry.ts +2 -2
- package/packages/core/src/resolver.spec.ts +391 -154
- package/packages/core/src/resolver.ts +16 -54
- package/packages/core/src/types.ts +19 -10
- package/packages/core/src/writers/docset.spec.ts +40 -0
- package/packages/core/src/writers/docset.ts +24 -0
- package/packages/core/src/writers/skills.spec.ts +46 -0
- package/packages/harnesses/package.json +1 -1
- package/packages/harnesses/src/writers/opencode.spec.ts +3 -5
- package/packages/harnesses/src/writers/opencode.ts +3 -4
- package/packages/core/src/writers/knowledge.spec.ts +0 -26
- package/packages/core/src/writers/knowledge.ts +0 -15
|
@@ -5,7 +5,6 @@ import type {
|
|
|
5
5
|
LogicalConfig,
|
|
6
6
|
McpServerEntry,
|
|
7
7
|
ResolutionContext,
|
|
8
|
-
DocsetDef,
|
|
9
8
|
Provision,
|
|
10
9
|
PermissionPolicy
|
|
11
10
|
} from "./types.js";
|
|
@@ -61,33 +60,6 @@ export async function resolve(
|
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
// Collect docsets from all selected options, dedup by id, filter exclusions
|
|
65
|
-
const seenDocsets = new Map<string, DocsetDef>();
|
|
66
|
-
for (const [facetId, optionId] of Object.entries(userConfig.choices)) {
|
|
67
|
-
const facet = getFacet(catalog, facetId);
|
|
68
|
-
if (!facet) continue;
|
|
69
|
-
const selectedIds = Array.isArray(optionId) ? optionId : [optionId];
|
|
70
|
-
for (const selectedId of selectedIds) {
|
|
71
|
-
const option = getOption(facet, selectedId);
|
|
72
|
-
if (!option?.docsets) continue;
|
|
73
|
-
for (const docset of option.docsets) {
|
|
74
|
-
if (!seenDocsets.has(docset.id)) {
|
|
75
|
-
seenDocsets.set(docset.id, docset);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const excludedSet = new Set(userConfig.excluded_docsets ?? []);
|
|
82
|
-
for (const [id, docset] of seenDocsets) {
|
|
83
|
-
if (excludedSet.has(id)) continue;
|
|
84
|
-
result.knowledge_sources.push({
|
|
85
|
-
name: docset.id,
|
|
86
|
-
origin: docset.origin,
|
|
87
|
-
description: docset.description
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
63
|
// Add knowledge-server MCP entry if any knowledge_sources were collected
|
|
92
64
|
if (result.knowledge_sources.length > 0) {
|
|
93
65
|
result.mcp_servers.push({
|
|
@@ -125,6 +97,22 @@ export async function resolve(
|
|
|
125
97
|
}
|
|
126
98
|
result.mcp_servers = Array.from(serversByRef.values());
|
|
127
99
|
|
|
100
|
+
// Dedup skills: collect all names declared as replaced, dedup by name
|
|
101
|
+
// (last-writer-wins), then filter out replaced ones.
|
|
102
|
+
const replacedNames = new Set<string>();
|
|
103
|
+
for (const skill of result.skills) {
|
|
104
|
+
for (const r of skill.replaces ?? []) {
|
|
105
|
+
replacedNames.add(r);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const skillsByName = new Map<string, (typeof result.skills)[number]>();
|
|
109
|
+
for (const skill of result.skills) {
|
|
110
|
+
skillsByName.set(skill.name, skill);
|
|
111
|
+
}
|
|
112
|
+
result.skills = Array.from(skillsByName.values()).filter(
|
|
113
|
+
(skill) => !replacedNames.has(skill.name)
|
|
114
|
+
);
|
|
115
|
+
|
|
128
116
|
return result;
|
|
129
117
|
}
|
|
130
118
|
|
|
@@ -182,29 +170,3 @@ function mergePermissionPolicy(
|
|
|
182
170
|
...incoming
|
|
183
171
|
};
|
|
184
172
|
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Collect all unique docsets implied by the given choices.
|
|
188
|
-
* Used by the TUI to present docsets for confirmation before resolution.
|
|
189
|
-
*/
|
|
190
|
-
export function collectDocsets(
|
|
191
|
-
choices: Record<string, string | string[]>,
|
|
192
|
-
catalog: Catalog
|
|
193
|
-
): DocsetDef[] {
|
|
194
|
-
const seen = new Map<string, DocsetDef>();
|
|
195
|
-
for (const [facetId, optionId] of Object.entries(choices)) {
|
|
196
|
-
const facet = getFacet(catalog, facetId);
|
|
197
|
-
if (!facet) continue;
|
|
198
|
-
const selectedIds = Array.isArray(optionId) ? optionId : [optionId];
|
|
199
|
-
for (const selectedId of selectedIds) {
|
|
200
|
-
const option = getOption(facet, selectedId);
|
|
201
|
-
if (!option?.docsets) continue;
|
|
202
|
-
for (const docset of option.docsets) {
|
|
203
|
-
if (!seen.has(docset.id)) {
|
|
204
|
-
seen.set(docset.id, docset);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return Array.from(seen.values());
|
|
210
|
-
}
|
|
@@ -21,17 +21,9 @@ export interface Option {
|
|
|
21
21
|
label: string;
|
|
22
22
|
description: string;
|
|
23
23
|
recipe: Provision[];
|
|
24
|
-
docsets?: DocsetDef[];
|
|
25
24
|
available?: (deps: Record<string, Option | undefined>) => boolean;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
export interface DocsetDef {
|
|
29
|
-
id: string;
|
|
30
|
-
label: string;
|
|
31
|
-
origin: string;
|
|
32
|
-
description: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
27
|
export interface Provision {
|
|
36
28
|
writer: ProvisionWriter;
|
|
37
29
|
config: Record<string, unknown>;
|
|
@@ -40,7 +32,7 @@ export interface Provision {
|
|
|
40
32
|
export type ProvisionWriter =
|
|
41
33
|
| "workflows"
|
|
42
34
|
| "skills"
|
|
43
|
-
| "
|
|
35
|
+
| "docset"
|
|
44
36
|
| "mcp-server"
|
|
45
37
|
| "instruction"
|
|
46
38
|
| "installable"
|
|
@@ -54,11 +46,25 @@ export interface InlineSkill {
|
|
|
54
46
|
name: string;
|
|
55
47
|
description: string;
|
|
56
48
|
body: string;
|
|
49
|
+
/**
|
|
50
|
+
* Names of other skills that this skill supersedes.
|
|
51
|
+
* Any skill whose `name` appears here will be removed from the final
|
|
52
|
+
* resolved skills list. Used by extension-contributed skills to suppress
|
|
53
|
+
* the generic baseline skills registered by the process option.
|
|
54
|
+
*/
|
|
55
|
+
replaces?: string[];
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
export interface ExternalSkill {
|
|
60
59
|
name: string;
|
|
61
60
|
source: string;
|
|
61
|
+
/**
|
|
62
|
+
* Names of other skills that this skill supersedes.
|
|
63
|
+
* Any skill whose `name` appears here will be removed from the final
|
|
64
|
+
* resolved skills list. Used by extension-contributed skills to suppress
|
|
65
|
+
* the generic baseline skills registered by the process option.
|
|
66
|
+
*/
|
|
67
|
+
replaces?: string[];
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
export type SkillDefinition = InlineSkill | ExternalSkill;
|
|
@@ -103,10 +109,14 @@ export interface CliAction {
|
|
|
103
109
|
phase: "setup" | "install";
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
export type DocsetPreset = "git-repo" | "local-folder" | "archive";
|
|
113
|
+
|
|
106
114
|
export interface KnowledgeSource {
|
|
107
115
|
name: string;
|
|
108
116
|
origin: string;
|
|
109
117
|
description: string;
|
|
118
|
+
/** Preset type controlling how the source is fetched. Defaults to "git-repo". */
|
|
119
|
+
preset?: DocsetPreset;
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
// --- Resolution context ---
|
|
@@ -124,7 +134,6 @@ export interface ResolvedFacet {
|
|
|
124
134
|
|
|
125
135
|
export interface UserConfig {
|
|
126
136
|
choices: Record<string, string | string[]>;
|
|
127
|
-
excluded_docsets?: string[];
|
|
128
137
|
harnesses?: string[];
|
|
129
138
|
custom?: {
|
|
130
139
|
mcp_servers?: McpServerEntry[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { docsetWriter } from "./docset.js";
|
|
3
|
+
|
|
4
|
+
describe("docsetWriter", () => {
|
|
5
|
+
it("has id 'docset'", () => {
|
|
6
|
+
expect(docsetWriter.id).toBe("docset");
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it("produces a knowledge_sources entry from config", async () => {
|
|
10
|
+
const result = await docsetWriter.write(
|
|
11
|
+
{
|
|
12
|
+
id: "tanstack-router-docs",
|
|
13
|
+
label: "TanStack Router",
|
|
14
|
+
origin: "https://github.com/TanStack/router.git",
|
|
15
|
+
description: "File-based routing, loaders, and search params"
|
|
16
|
+
},
|
|
17
|
+
{ resolved: {} }
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
expect(result.knowledge_sources).toHaveLength(1);
|
|
21
|
+
expect(result.knowledge_sources![0]).toEqual({
|
|
22
|
+
name: "tanstack-router-docs",
|
|
23
|
+
origin: "https://github.com/TanStack/router.git",
|
|
24
|
+
description: "File-based routing, loaders, and search params"
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("uses label as fallback when description is absent", async () => {
|
|
29
|
+
const result = await docsetWriter.write(
|
|
30
|
+
{
|
|
31
|
+
id: "some-docs",
|
|
32
|
+
label: "Some Docs",
|
|
33
|
+
origin: "https://github.com/example/some-docs.git"
|
|
34
|
+
},
|
|
35
|
+
{ resolved: {} }
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
expect(result.knowledge_sources![0].description).toBe("Some Docs");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DocsetPreset, ProvisionWriterDef } from "../types.js";
|
|
2
|
+
|
|
3
|
+
export const docsetWriter: ProvisionWriterDef = {
|
|
4
|
+
id: "docset",
|
|
5
|
+
async write(config) {
|
|
6
|
+
const { id, label, origin, description, preset } = config as {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
origin: string;
|
|
10
|
+
description: string;
|
|
11
|
+
preset?: DocsetPreset;
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
knowledge_sources: [
|
|
15
|
+
{
|
|
16
|
+
name: id,
|
|
17
|
+
origin,
|
|
18
|
+
description: description ?? label,
|
|
19
|
+
...(preset && { preset })
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -85,6 +85,52 @@ describe("skillsWriter", () => {
|
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
it("passes through replaces field on inline skills", async () => {
|
|
89
|
+
const result = await skillsWriter.write(
|
|
90
|
+
{
|
|
91
|
+
skills: [
|
|
92
|
+
{
|
|
93
|
+
name: "ext-architecture",
|
|
94
|
+
description: "Extension architecture",
|
|
95
|
+
body: "Extension body.",
|
|
96
|
+
replaces: ["architecture"]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
emptyContext
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
expect(result.skills).toHaveLength(1);
|
|
104
|
+
expect(result.skills![0]).toEqual({
|
|
105
|
+
name: "ext-architecture",
|
|
106
|
+
description: "Extension architecture",
|
|
107
|
+
body: "Extension body.",
|
|
108
|
+
replaces: ["architecture"]
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("passes through replaces field on external skills", async () => {
|
|
113
|
+
const result = await skillsWriter.write(
|
|
114
|
+
{
|
|
115
|
+
skills: [
|
|
116
|
+
{
|
|
117
|
+
name: "ext-tdd",
|
|
118
|
+
source: "org/repo/skills/ext-tdd",
|
|
119
|
+
replaces: ["tdd"]
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
emptyContext
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
expect(result.skills).toHaveLength(1);
|
|
127
|
+
expect(result.skills![0]).toEqual({
|
|
128
|
+
name: "ext-tdd",
|
|
129
|
+
source: "org/repo/skills/ext-tdd",
|
|
130
|
+
replaces: ["tdd"]
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
88
134
|
it("handles mixed inline and external skills", async () => {
|
|
89
135
|
const result = await skillsWriter.write(
|
|
90
136
|
{
|
|
@@ -102,7 +102,7 @@ describe("opencodeWriter", () => {
|
|
|
102
102
|
expect(defaultsAgent).toContain('grep: "allow"');
|
|
103
103
|
expect(defaultsAgent).toContain('list: "allow"');
|
|
104
104
|
expect(defaultsAgent).toContain('lsp: "allow"');
|
|
105
|
-
expect(defaultsAgent).toContain('task: "
|
|
105
|
+
expect(defaultsAgent).toContain('task: "allow"');
|
|
106
106
|
expect(defaultsAgent).toContain('skill: "deny"');
|
|
107
107
|
expect(defaultsAgent).toContain('todoread: "deny"');
|
|
108
108
|
expect(defaultsAgent).toContain('todowrite: "deny"');
|
|
@@ -110,7 +110,6 @@ describe("opencodeWriter", () => {
|
|
|
110
110
|
expect(defaultsAgent).toContain('websearch: "ask"');
|
|
111
111
|
expect(defaultsAgent).toContain('codesearch: "ask"');
|
|
112
112
|
expect(defaultsAgent).toContain('external_directory: "ask"');
|
|
113
|
-
expect(defaultsAgent).toContain('doom_loop: "deny"');
|
|
114
113
|
expect(defaultsAgent).toContain('"grep *": "allow"');
|
|
115
114
|
expect(defaultsAgent).toContain('"rm *": "deny"');
|
|
116
115
|
expect(defaultsFrontmatter.permission).toMatchObject({
|
|
@@ -119,15 +118,14 @@ describe("opencodeWriter", () => {
|
|
|
119
118
|
grep: "allow",
|
|
120
119
|
list: "allow",
|
|
121
120
|
lsp: "allow",
|
|
122
|
-
task: "
|
|
121
|
+
task: "allow",
|
|
123
122
|
skill: "deny",
|
|
124
123
|
todoread: "deny",
|
|
125
124
|
todowrite: "deny",
|
|
126
125
|
webfetch: "ask",
|
|
127
126
|
websearch: "ask",
|
|
128
127
|
codesearch: "ask",
|
|
129
|
-
external_directory: "ask"
|
|
130
|
-
doom_loop: "deny"
|
|
128
|
+
external_directory: "ask"
|
|
131
129
|
});
|
|
132
130
|
const defaultsPermission = defaultsFrontmatter.permission as {
|
|
133
131
|
bash: Record<string, string>;
|
|
@@ -24,9 +24,9 @@ const APPLICABLE_TO_ALL: Record<string, PermissionRule> = {
|
|
|
24
24
|
"*.env.example": "allow"
|
|
25
25
|
},
|
|
26
26
|
skill: "deny", //we're using an own skills-mcp
|
|
27
|
-
todoread: "deny", //no agent-
|
|
27
|
+
todoread: "deny", //no agent-proprietary todo tools
|
|
28
28
|
todowrite: "deny",
|
|
29
|
-
task: "
|
|
29
|
+
task: "allow", //starts subagents
|
|
30
30
|
lsp: "allow",
|
|
31
31
|
glob: "allow",
|
|
32
32
|
grep: "allow",
|
|
@@ -129,8 +129,7 @@ const SENSIBLE_DEFAULTS_RULES: Record<string, PermissionRule> = {
|
|
|
129
129
|
"useradd *": "deny",
|
|
130
130
|
"userdel *": "deny",
|
|
131
131
|
"iptables *": "deny"
|
|
132
|
-
}
|
|
133
|
-
doom_loop: "deny"
|
|
132
|
+
}
|
|
134
133
|
};
|
|
135
134
|
|
|
136
135
|
const MAX_AUTONOMY_RULES: Record<string, PermissionRule> = {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { knowledgeWriter } from "./knowledge.js";
|
|
3
|
-
|
|
4
|
-
describe("knowledgeWriter", () => {
|
|
5
|
-
it("has id 'knowledge'", () => {
|
|
6
|
-
expect(knowledgeWriter.id).toBe("knowledge");
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it("produces a knowledge_sources entry from config", async () => {
|
|
10
|
-
const result = await knowledgeWriter.write(
|
|
11
|
-
{
|
|
12
|
-
name: "react-docs",
|
|
13
|
-
origin: "https://github.com/facebook/react.git",
|
|
14
|
-
description: "Official React documentation"
|
|
15
|
-
},
|
|
16
|
-
{ resolved: {} }
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
expect(result.knowledge_sources).toHaveLength(1);
|
|
20
|
-
expect(result.knowledge_sources![0]).toEqual({
|
|
21
|
-
name: "react-docs",
|
|
22
|
-
origin: "https://github.com/facebook/react.git",
|
|
23
|
-
description: "Official React documentation"
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ProvisionWriterDef } from "../types.js";
|
|
2
|
-
|
|
3
|
-
export const knowledgeWriter: ProvisionWriterDef = {
|
|
4
|
-
id: "knowledge",
|
|
5
|
-
async write(config) {
|
|
6
|
-
const { name, origin, description } = config as {
|
|
7
|
-
name: string;
|
|
8
|
-
origin: string;
|
|
9
|
-
description: string;
|
|
10
|
-
};
|
|
11
|
-
return {
|
|
12
|
-
knowledge_sources: [{ name, origin, description }]
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
};
|