@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.
Files changed (47) hide show
  1. package/.beads/issues.jsonl +37 -0
  2. package/.beads/last-touched +1 -1
  3. package/.kiro/agents/ade.json +10 -2
  4. package/.kiro/settings/mcp.json +6 -1
  5. package/.opencode/agents/ade.md +7 -2
  6. package/.vibe/beads-state-ade-extension-override-skills-d44z9p.json +29 -0
  7. package/.vibe/beads-state-ade-fix-docset-writing-37fuoj.json +29 -0
  8. package/.vibe/development-plan-extension-override-skills.md +110 -0
  9. package/.vibe/development-plan-fix-docset-writing.md +77 -0
  10. package/.vibe/docs/architecture.md +201 -0
  11. package/.vibe/docs/design.md +179 -0
  12. package/.vibe/docs/requirements.md +17 -0
  13. package/ade.extensions.mjs +13 -15
  14. package/config.lock.yaml +6 -1
  15. package/docs/CLI-PRD.md +38 -40
  16. package/docs/CLI-design.md +47 -57
  17. package/docs/guide/extensions.md +6 -14
  18. package/package.json +1 -1
  19. package/packages/cli/dist/index.js +15213 -5579
  20. package/packages/cli/package.json +1 -1
  21. package/packages/cli/src/commands/conventions.integration.spec.ts +29 -4
  22. package/packages/cli/src/commands/extensions.integration.spec.ts +26 -4
  23. package/packages/cli/src/commands/install.ts +2 -0
  24. package/packages/cli/src/commands/knowledge-docset.integration.spec.ts +179 -0
  25. package/packages/cli/src/commands/knowledge.integration.spec.ts +24 -36
  26. package/packages/cli/src/commands/setup.spec.ts +1 -101
  27. package/packages/cli/src/commands/setup.ts +23 -36
  28. package/packages/cli/src/knowledge-installer.spec.ts +43 -3
  29. package/packages/cli/src/knowledge-installer.ts +12 -9
  30. package/packages/core/package.json +1 -1
  31. package/packages/core/src/catalog/catalog.spec.ts +75 -43
  32. package/packages/core/src/catalog/facets/architecture.ts +89 -58
  33. package/packages/core/src/catalog/facets/practices.ts +9 -8
  34. package/packages/core/src/index.ts +4 -4
  35. package/packages/core/src/registry.spec.ts +1 -1
  36. package/packages/core/src/registry.ts +2 -2
  37. package/packages/core/src/resolver.spec.ts +391 -154
  38. package/packages/core/src/resolver.ts +16 -54
  39. package/packages/core/src/types.ts +19 -10
  40. package/packages/core/src/writers/docset.spec.ts +40 -0
  41. package/packages/core/src/writers/docset.ts +24 -0
  42. package/packages/core/src/writers/skills.spec.ts +46 -0
  43. package/packages/harnesses/package.json +1 -1
  44. package/packages/harnesses/src/writers/opencode.spec.ts +3 -5
  45. package/packages/harnesses/src/writers/opencode.ts +3 -4
  46. package/packages/core/src/writers/knowledge.spec.ts +0 -26
  47. package/packages/core/src/writers/knowledge.ts +0 -15
@@ -0,0 +1,201 @@
1
+ # ADE — System Architecture (C4 Model)
2
+
3
+ ## 1. System Context (C4 Level 1)
4
+
5
+ ### System Overview
6
+
7
+ ADE (Agentic Development Environment) is a CLI tool that lets engineering teams declare _what_ their project needs for agentic development — workflow conventions, skills, knowledge sources, tools — and generates the correct agent-specific configuration files for whichever coding agent they use. It bridges the gap between a team's abstract preferences and the per-agent config formats each AI coding assistant requires.
8
+
9
+ ### Users and Personas
10
+
11
+ - **Individual developer**: Runs `ade setup` once to configure a project, then `ade install` on subsequent machines or CI environments to reproduce the setup.
12
+ - **Tech lead / platform team**: Authors a shared `ade.extensions.mjs` that encodes org-specific conventions (custom skills, internal docsets, proprietary harnesses) and distributes it via a template repository.
13
+ - **CI/CD pipeline**: Calls `ade install` to ensure a reproducible agent environment before agentic tasks run.
14
+
15
+ ### External Systems
16
+
17
+ - **`@codemcp/skills`**: Manages SKILL.md files and the skills lock file. ADE calls its programmatic API (`runAdd`) to install skills into the project.
18
+ - **`@codemcp/knowledge`**: Manages `.knowledge/config.yaml` and docset artifacts. ADE calls `createDocset` + `initDocset` to register and download knowledge sources.
19
+ - **`@codemcp/workflows-server`** (and other MCP servers): Runtime servers registered as MCP server entries in the generated agent config. ADE writes the config; it does not start or manage these servers.
20
+ - **Coding agents** (Claude Code, OpenCode, Copilot, Cursor, Kiro, etc.): Consumers of ADE's generated config files. Each has its own format; ADE's harness writers know the details.
21
+ - **Skills server** (e.g. `mrsimpson/skills-coding`): External source for skill definitions referenced in catalog options.
22
+
23
+ ### System Boundaries
24
+
25
+ - **Inside ADE**: Catalog, resolver, provision writers, harness writers, CLI TUI, lock file management, skills installer, knowledge installer.
26
+ - **Outside ADE**: Runtime MCP servers, agent execution, skill content authoring, docset content management, the agents themselves.
27
+
28
+ ### Context Diagram
29
+
30
+ ```
31
+ ┌─────────────────────────────────────────────────────────┐
32
+ │ Developer │
33
+ └─────────────────────────┬───────────────────────────────┘
34
+ │ ade setup / ade install
35
+ ┌─────────────────────────▼───────────────────────────────┐
36
+ │ ADE CLI (@codemcp/ade) │
37
+ │ Interactive TUI + resolver + file generators │
38
+ └──────┬──────────────────┬──────────────────┬────────────┘
39
+ │ programmatic API │ │ writes config files
40
+ ▼ ▼ ▼
41
+ @codemcp/skills @codemcp/knowledge Agent config files
42
+ (skills lock, (.knowledge/ (AGENTS.md,
43
+ SKILL.md files) config.yaml, .mcp.json,
44
+ docset artifacts) opencode.json, …)
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 2. Container Architecture (C4 Level 2)
50
+
51
+ ### Containers
52
+
53
+ #### `@codemcp/ade-core` (`packages/core`)
54
+
55
+ - **Technology**: TypeScript, pure functions, no I/O except config file reads/writes
56
+ - **Responsibilities**: All types, catalog definitions, resolution logic, provision writers, writer registry
57
+ - **Interfaces**: Public TypeScript API (`index.ts`) — exported types, `resolve()`, `createDefaultRegistry()`, `mergeExtensions()`, catalog accessors, config read/write utilities
58
+ - **Data storage**: None at runtime; reads/writes `config.yaml` and `config.lock.yaml` via helper functions
59
+
60
+ #### `@codemcp/ade-cli` (`packages/cli`)
61
+
62
+ - **Technology**: TypeScript, `@clack/prompts` for TUI, `tsup` bundle
63
+ - **Responsibilities**: Argument parsing, interactive TUI, extensions loading, skills installation, knowledge installation, command routing
64
+ - **Interfaces**: CLI binary (`ade setup [dir]`, `ade install [dir]`); programmatic entry points `runSetup()` and `runInstall()` (used in tests)
65
+ - **Data storage**: None; delegates to core for file I/O
66
+
67
+ #### `@codemcp/ade-harnesses` (`packages/harnesses`)
68
+
69
+ - **Technology**: TypeScript
70
+ - **Responsibilities**: Per-agent config file writers (AGENTS.md, .mcp.json, opencode.json, .kiro/, etc.)
71
+ - **Interfaces**: `allHarnessWriters`, `getHarnessWriter()`, `buildHarnessWriters()`, `installSkills()`, `writeInlineSkills()`
72
+ - **Data storage**: Writes agent-specific config files to the project root
73
+
74
+ ### Container Interactions
75
+
76
+ ```
77
+ ade setup/install
78
+
79
+ ├─► loadExtensions() [cli → disk: ade.extensions.mjs]
80
+ ├─► mergeExtensions() [cli → core]
81
+ ├─► resolve() [cli → core: UserConfig + Catalog → LogicalConfig]
82
+ ├─► writeLockFile() [cli → core → disk: config.lock.yaml]
83
+ ├─► harness.install() [cli → harnesses → disk: agent config files]
84
+ ├─► installSkills() [cli → harnesses → @codemcp/skills]
85
+ └─► installKnowledge() [cli → @codemcp/knowledge API]
86
+ ```
87
+
88
+ ### Deployment
89
+
90
+ ADE is a developer tool — it runs locally (`npx @codemcp/ade`) or in CI. There is no persistent service. The generated output files are checked into the project repository.
91
+
92
+ ---
93
+
94
+ ## 3. Component Architecture (C4 Level 3)
95
+
96
+ ### `@codemcp/ade-core` Components
97
+
98
+ #### Catalog
99
+
100
+ - **Responsibilities**: Declares all built-in facets and options as TypeScript objects; provides `getDefaultCatalog()`, `mergeExtensions()`, `sortFacets()`, `getVisibleOptions()`
101
+ - **Key files**: `catalog/index.ts`, `catalog/facets/{process,architecture,practices,backpressure,autonomy}.ts`
102
+ - **Design pattern**: Static data objects; no runtime state
103
+
104
+ #### Resolver
105
+
106
+ - **Responsibilities**: Expands `UserConfig` choices against the `Catalog` using the `WriterRegistry`; produces `LogicalConfig`; deduplicates MCP servers and skills by key; auto-adds `@codemcp/knowledge-server` when `knowledge_sources` are non-empty
107
+ - **Key files**: `resolver.ts`
108
+ - **Design pattern**: Pure function `resolve(userConfig, catalog, registry): Promise<LogicalConfig>`
109
+
110
+ #### Writer Registry
111
+
112
+ - **Responsibilities**: Maps writer IDs to `ProvisionWriterDef` instances; `createDefaultRegistry()` pre-registers all built-in writers; open for runtime extension
113
+ - **Key files**: `registry.ts`
114
+ - **Design pattern**: `Map`-based registry; open/closed principle — new writers added without modifying core
115
+
116
+ #### Provision Writers (built-in)
117
+
118
+ | Writer | File | Output |
119
+ |---|---|---|
120
+ | `workflows` | `writers/workflows.ts` | `mcp_servers[]` entry |
121
+ | `skills` | `writers/skills.ts` | `skills[]` entries |
122
+ | `docset` | `writers/docset.ts` | `knowledge_sources[]` entry |
123
+ | `instruction` | `writers/instruction.ts` | `instructions[]` entry |
124
+ | `git-hooks` | `writers/git-hooks.ts` | `git_hooks[]` entries |
125
+ | `permission-policy` | `writers/permission-policy.ts` | `permission_policy` |
126
+ | `setup-note` | `writers/setup-note.ts` | `setup_notes[]` entry |
127
+ | `mcp-server` | `writers/mcp-server.ts` | `mcp_servers[]` entry |
128
+
129
+ Each writer receives `Record<string, unknown>` config and narrows internally; the registry contract stays generic.
130
+
131
+ #### Types
132
+
133
+ - **Responsibilities**: Single source of truth for all shared interfaces — `Catalog`, `Facet`, `Option`, `Provision`, `LogicalConfig`, `KnowledgeSource`, `DocsetPreset`, `SkillDefinition`, `UserConfig`, `LockFile`, `WriterRegistry`, `AdeExtensions`, and their Zod validation schemas
134
+ - **Key file**: `types.ts`
135
+
136
+ ### `@codemcp/ade-cli` Components
137
+
138
+ #### Entry Point / Router (`index.ts`)
139
+
140
+ Parses `process.argv`, loads extensions, builds catalog and harness writers, delegates to `runSetup` or `runInstall`.
141
+
142
+ #### `runSetup` (`commands/setup.ts`)
143
+
144
+ Walks the user through the TUI facet-by-facet, resolves choices, writes `config.yaml` + `config.lock.yaml`, runs harness writers, installs skills and offers knowledge initialization.
145
+
146
+ #### `runInstall` (`commands/install.ts`)
147
+
148
+ Reads `config.lock.yaml`, runs harness writers, installs skills, and calls `installKnowledge` — no re-resolution.
149
+
150
+ #### Extensions Loader (`extensions.ts`)
151
+
152
+ Finds and loads `ade.extensions.{ts,mjs,js}` from the project root. Uses `jiti` for TypeScript files. Validates with `AdeExtensionsSchema`.
153
+
154
+ #### Knowledge Installer (`knowledge-installer.ts`)
155
+
156
+ Wraps `createDocset` + `initDocset` from `@codemcp/knowledge`. Handles "already exists" gracefully (proceeds to `initDocset`). Passes `preset` from `KnowledgeSource` (default: `"git-repo"`).
157
+
158
+ ---
159
+
160
+ ## 4. Architecture Decisions
161
+
162
+ ### Docsets as `docset` provision writer (not `Option.docsets[]`)
163
+
164
+ **Decision**: Documentation sources are declared as `{ writer: "docset", config: { id, label, origin, description, preset? } }` recipe entries, identical in structure to skills provisions.
165
+
166
+ **Rationale**: The old `Option.docsets[]` sibling field was a parallel mechanism that bypassed the writer registry, required a separate opt-out multiselect prompt, and introduced `excluded_docsets` in `UserConfig`. The writer model is already the right abstraction — using it for docsets makes the catalog uniform, removes per-item opt-out UX, and lets extensions contribute docsets with the same syntax as everything else.
167
+
168
+ **Consequences**: `DocsetDef`, `collectDocsets()`, and `excluded_docsets` removed. Setup prompt simplified to a single opt-in confirm.
169
+
170
+ ### Two-package split: `core` + `cli`
171
+
172
+ **Decision**: All types, logic, and writers live in `@codemcp/ade-core`. The CLI is a thin shell.
173
+
174
+ **Rationale**: Core can be imported programmatically (CI scripts, tests, extensions) without pulling in TUI dependencies. It also enables the harnesses package to depend on core without depending on the CLI.
175
+
176
+ ### `LogicalConfig` as the stable contract
177
+
178
+ **Decision**: Provision writers produce `Partial<LogicalConfig>`; harness writers consume `LogicalConfig`. Neither knows about the other.
179
+
180
+ **Rationale**: Decouples the catalog / resolution side from the file-generation side. Adding a new harness requires no changes to writers; adding a new writer requires no changes to harnesses.
181
+
182
+ ### Lock file is the install source of truth
183
+
184
+ **Decision**: `ade install` reads `config.lock.yaml` directly; it never re-resolves from `config.yaml`.
185
+
186
+ **Rationale**: Mirrors `npm ci` / `package-lock.json`. Makes installs deterministic and reviewable. `config.lock.yaml` is checked in, so CI produces exactly what was reviewed.
187
+
188
+ ### Open registry for extensibility
189
+
190
+ **Decision**: `WriterRegistry` is a `Map`-based runtime registry, not a discriminated union.
191
+
192
+ **Rationale**: A discriminated union is a closed set — adding a writer from an extension package would require modifying core. The registry is open: any package can register a writer before `resolve()` runs.
193
+
194
+ ---
195
+
196
+ ## 5. References
197
+
198
+ - Existing CLI design doc: `docs/CLI-design.md`
199
+ - Existing CLI PRD: `docs/CLI-PRD.md`
200
+ - Extensions guide: `docs/guide/extensions.md`
201
+ - Example extension: `ade.extensions.mjs`
@@ -0,0 +1,179 @@
1
+ <!--
2
+ DESIGN DOCUMENT TEMPLATE - TIERED BY PROJECT COMPLEXITY
3
+
4
+ PURPOSE: Document design principles, patterns, and standards that guide implementation.
5
+ NOTE: Technology stack decisions belong in the Architecture Document, not here.
6
+
7
+ PROJECT COMPLEXITY GUIDE:
8
+ 🚀 ESSENTIAL (Startup/MVP, 1-3 developers, <6 months): Sections 1-2 only
9
+ 🏢 CORE (Small team, 2-5 developers, 6-18 months): Sections 1-4
10
+ 🏗️ ADVANCED (Enterprise, 5+ developers, 18+ months): Sections 1-5
11
+ ⚡ SPECIALIZED (Mission-critical, high reliability): All sections + custom
12
+
13
+ WHAT TO INCLUDE:
14
+ ✅ Design principles and patterns
15
+ ✅ Naming conventions and standards
16
+ ✅ Component design approaches
17
+ ✅ Data modeling principles
18
+ ✅ Quality attribute design strategies
19
+ ❌ Technology stack choices (goes in Architecture doc)
20
+ ❌ Concrete class names or implementations
21
+ ❌ Code snippets or method signatures
22
+
23
+ START SMALL: Begin with Essential sections, add more as project matures.
24
+
25
+ IMPORTANT: DO NOT REMOVE THIS COMMENT HOW TO USE THE TEMPLATE!
26
+ -->
27
+
28
+ # ADE — Design Document
29
+
30
+ ## 1. Naming Conventions
31
+
32
+ ### Types and Interfaces
33
+
34
+ - **PascalCase** for all TypeScript interfaces, type aliases, and enums: `LogicalConfig`, `KnowledgeSource`, `DocsetPreset`, `ProvisionWriterDef`.
35
+ - Suffix `Def` for writer definition interfaces: `ProvisionWriterDef`, `AgentWriterDef`.
36
+ - Suffix `Schema` for Zod validation schemas: `AdeExtensionsSchema`, `OptionSchema`.
37
+ - Suffix `Writer` for instances of writers registered in the registry: `docsetWriter`, `skillsWriter`, `workflowsWriter`.
38
+ - Suffix `Facet` for exported catalog facet objects: `architectureFacet`, `practicesFacet`.
39
+
40
+ ### Functions
41
+
42
+ - **camelCase** throughout. Factory functions prefixed `create`: `createDefaultRegistry()`, `createRegistry()`. Reader/writer pairs prefixed `read`/`write`: `readLockFile()`, `writeLockFile()`. Accessor functions prefixed `get`: `getFacet()`, `getOption()`, `getProvisionWriter()`.
43
+ - CLI entry points prefixed `run`: `runSetup()`, `runInstall()`.
44
+
45
+ ### Files
46
+
47
+ - One primary export per file; file name matches the export name in kebab-case: `docset.ts` exports `docsetWriter`, `knowledge-installer.ts` exports `installKnowledge`.
48
+ - Test files co-located: `docset.ts` → `docset.spec.ts`. Integration tests suffixed `.integration.spec.ts`.
49
+
50
+ ### Writer IDs
51
+
52
+ - Kebab-case string IDs matching the file name: `"docset"`, `"git-hooks"`, `"permission-policy"`, `"setup-note"`.
53
+
54
+ ---
55
+
56
+ ## 2. Error Handling Design
57
+
58
+ ### Provision Writers
59
+
60
+ Writers throw on invalid config. The resolver does not catch writer errors — a bad catalog entry or extension config fails loudly at setup time, not silently at runtime.
61
+
62
+ ### Knowledge Installer
63
+
64
+ `createDocset` "already exists" errors are swallowed and execution falls through to `initDocset` (idempotency). All other `createDocset` errors and all `initDocset` errors are logged as warnings and skipped — one failing source does not block the rest.
65
+
66
+ ### Extensions Loading
67
+
68
+ `AdeExtensionsSchema.safeParse()` on loaded extension data. On failure, a descriptive error is thrown before any resolution runs: _"Invalid ade.extensions file at …"_.
69
+
70
+ ### Unknown Writer IDs
71
+
72
+ `resolve()` throws if a recipe provision references a writer ID not present in the registry. This is a catalog authoring error and should fail loudly.
73
+
74
+ ### TUI Cancellation
75
+
76
+ `clack.isCancel()` is checked after every prompt. On cancel, `clack.cancel()` is called and the function returns early (no partial writes).
77
+
78
+ ---
79
+
80
+ ## 3. Architecture Patterns & Principles
81
+
82
+ ### Registry Pattern for Open Extensibility
83
+
84
+ The `WriterRegistry` is a `Map`-based runtime dispatch table. New provision writers are registered with `registerProvisionWriter(registry, writerDef)` before `resolve()` runs. This keeps the system open for extension without modifying core — any package contributing via `ade.extensions.mjs` can register custom writers.
85
+
86
+ ### Pure Function Resolution
87
+
88
+ `resolve()` is a pure async function: `(UserConfig, Catalog, WriterRegistry) → LogicalConfig`. It has no side effects and no I/O. This makes it trivially testable and usable in non-CLI contexts.
89
+
90
+ ### Stable Interface Seam: `LogicalConfig`
91
+
92
+ All provision writers produce `Partial<LogicalConfig>`. All harness writers consume `LogicalConfig`. This seam is the only contract between the two sides — writers don't know about agents, agents don't know about writers.
93
+
94
+ ### Data-Driven Catalog
95
+
96
+ The catalog is plain TypeScript data (no classes, no inheritance). Facets and options are literal objects conforming to the `Facet` and `Option` interfaces. This makes the catalog easily serializable, diffable, and extensible via `mergeExtensions()`.
97
+
98
+ ### Opt-In Confirmation for Side Effects
99
+
100
+ Long-running or network-bound operations (skills installation, knowledge init) are never performed silently. The TUI asks the user with a `confirm` prompt (default: `false` for knowledge, `true` for skills). `ade install` performs these unconditionally since it is non-interactive and the lock file represents the user's prior decision.
101
+
102
+ ---
103
+
104
+ ## 4. Component Design Strategy
105
+
106
+ ### Component Boundary Principles
107
+
108
+ - **`core`** has zero runtime I/O except config file reads/writes. No TUI, no network, no process spawning.
109
+ - **`cli`** is the I/O layer: TUI prompts, extension file loading, subprocess/API calls to `@codemcp/skills` and `@codemcp/knowledge`.
110
+ - **`harnesses`** knows all agent config formats but nothing about how selections were made.
111
+
112
+ ### Responsibility Assignment
113
+
114
+ Each provision writer is responsible for exactly one `LogicalConfig` field group. It receives an untyped `config` record and narrows internally — the registry contract stays generic while the implementation is specific.
115
+
116
+ ### Interface Design
117
+
118
+ Writers are `interface`-typed (open contracts), not `class`-based. This allows any object literal conforming to the interface to be registered — no inheritance required, no framework needed.
119
+
120
+ ### Dependency Direction
121
+
122
+ ```
123
+ cli → core ← harnesses
124
+ cli → harnesses
125
+ ```
126
+
127
+ `core` has no upward dependencies. `harnesses` depends on `core` for types. `cli` depends on both.
128
+
129
+ ---
130
+
131
+ ## 5. Data Design Approach
132
+
133
+ ### Two-File Config Model
134
+
135
+ - **`config.yaml`** (user-facing): stores `choices` and optional `custom` overrides. CLI-managed except the `custom` block. Checked into the repo as a team-shared declaration.
136
+ - **`config.lock.yaml`** (generated): stores the fully resolved `LogicalConfig` snapshot. Never hand-edited. The install source of truth — `ade install` reads this, never re-resolves.
137
+
138
+ ### LogicalConfig as Intermediate Representation
139
+
140
+ `LogicalConfig` is agent-agnostic. It is the normalised representation of what the project needs, before it is translated into any agent's format. Fields are append-only lists (MCP servers, skills, knowledge sources, instructions) deduplicated by a stable key.
141
+
142
+ ### Deduplication Keys
143
+
144
+ - MCP servers: deduplicated by `ref`
145
+ - Skills: deduplicated by `name`
146
+ - Knowledge sources: deduplicated by `name`
147
+
148
+ ### `DocsetPreset` Typing
149
+
150
+ `KnowledgeSource.preset` uses the same literal union as `@codemcp/knowledge`'s `DocsetPreset` (`"git-repo" | "local-folder" | "archive"`), keeping the types aligned without re-exporting the dependency's internal types directly.
151
+
152
+ ---
153
+
154
+ ## 9. Extension and Evolution Strategy
155
+
156
+ ### Extension Points
157
+
158
+ 1. **`facetContributions`** — append options to existing facets (most common)
159
+ 2. **`facets`** — add entirely new facets
160
+ 3. **`provisionWriters`** — register custom writers for custom `config` shapes
161
+ 4. **`harnessWriters`** — add support for new coding agents
162
+
163
+ All four are declared in `ade.extensions.{mjs,ts}` in the project root. The CLI loads and validates this file before every `setup` or `install` run.
164
+
165
+ ### Versioning Strategy
166
+
167
+ The `config.lock.yaml` carries a `version: 1` field. Breaking changes to the lock file format increment this version. `ade install` can detect a stale lock file and prompt the user to re-run `ade setup`.
168
+
169
+ ### Catalog Evolution
170
+
171
+ Built-in catalog options can be updated in place. Extension options that `replaces` a built-in skill name override it at resolution time without modifying the upstream catalog.
172
+
173
+ ---
174
+
175
+ # Implementation Notes
176
+
177
+ - Tests import `runSetup` / `runInstall` directly; the CLI binary entry point is thin enough to not need its own tests.
178
+ - Integration tests mock `@clack/prompts` (TUI) and `@codemcp/knowledge` (network I/O) via `vi.mock`. All `confirm` mock return values must be set explicitly per test — `vi.clearAllMocks()` resets them to `undefined` (falsy).
179
+ - The `ProvisionWriter` union in `types.ts` is a type-level hint; the real runtime guard is the registry. Adding a new writer requires registering it in `createDefaultRegistry()` and the union.
@@ -0,0 +1,17 @@
1
+ # Requirements Placeholder
2
+
3
+ This is a placeholder document. The user has chosen not to maintain separate requirements documentation for this project.
4
+
5
+ ## INSTRUCTIONS FOR LLM
6
+
7
+ **DO NOT EDIT THIS FILE**
8
+
9
+ - Use the current development plan file to specify requirements for ongoing development
10
+ - Reference requirements from the plan file context when needed
11
+ - Focus requirements discussion in the plan file's "Goal" and relevant task sections
12
+ - When requirements clarification is needed, document them in the plan file rather than here
13
+ - This placeholder ensures the workflow variables work correctly while respecting the user's choice
14
+
15
+ ## User's Choice
16
+
17
+ The user has explicitly chosen not to use dedicated requirements documentation for this project. Please respect this decision and work with the plan file for requirements-related information.
@@ -40,24 +40,22 @@ export default {
40
40
  }
41
41
  },
42
42
  {
43
- writer: "knowledge",
43
+ writer: "docset",
44
44
  config: {
45
- sources: [
46
- {
47
- name: "sap-abap-docs",
48
- origin: "https://your-serialized-version-of-abap-docs.git",
49
- description: "Official SAP ABAP Cloud development guide"
50
- }
51
- ]
45
+ id: "sap-btp-docs",
46
+ label: "SAP BTP",
47
+ origin: "https://your-serialized-version-of-btp-docs.git",
48
+ description: "SAP Business Technology Platform documentation"
52
49
  }
53
- }
54
- ],
55
- docsets: [
50
+ },
56
51
  {
57
- id: "sap-btp-docs",
58
- label: "SAP BTP",
59
- origin: "https://your-serialized-version-of-btp-docs.git",
60
- description: "SAP Business Technology Platform documentation"
52
+ writer: "docset",
53
+ config: {
54
+ id: "sap-abap-docs",
55
+ label: "SAP ABAP Cloud",
56
+ origin: "https://your-serialized-version-of-abap-docs.git",
57
+ description: "Official SAP ABAP Cloud development guide"
58
+ }
61
59
  }
62
60
  ]
63
61
  }
package/config.lock.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  version: 1
2
- generated_at: 2026-03-19T09:28:46.177Z
2
+ generated_at: 2026-03-20T08:32:04.912Z
3
3
  choices:
4
4
  process: codemcp-workflows
5
5
  practices:
@@ -18,6 +18,11 @@ logical_config:
18
18
  args:
19
19
  - "@codemcp/workflows-server@latest"
20
20
  env: {}
21
+ allowedTools:
22
+ - whats_next
23
+ - conduct_review
24
+ - list_workflows
25
+ - get_tool_info
21
26
  - ref: agentskills
22
27
  command: npx
23
28
  args:
package/docs/CLI-PRD.md CHANGED
@@ -40,8 +40,9 @@ from that facet).
40
40
 
41
41
  ### Option
42
42
 
43
- One possible answer to a facet. Each option carries a recipe and optionally
44
- a list of recommended docsets.
43
+ One possible answer to a facet. Each option carries a recipe list of
44
+ provisions. Documentation sources (docsets) are declared as `docset`
45
+ provisions in the recipe alongside skills and other provisions.
45
46
 
46
47
  ### Recipe
47
48
 
@@ -57,15 +58,13 @@ runtime config and agent instructions.
57
58
 
58
59
  ### Docset
59
60
 
60
- Documentation sources recommended by an option. Docsets are a **weak entity
61
- on Option** — they are always implied by an upstream selection (e.g. picking
62
- "TanStack" implies TanStack Router/Query/Form/Table docs). The TUI presents
63
- all implied docsets as pre-selected defaults and allows the user to deselect
64
- (opt-out, not opt-in). The resolver collects docsets from all selected
65
- options, deduplicates by id, filters by `excluded_docsets`, and maps them to
66
- `knowledge_sources` in LogicalConfig. When any knowledge sources are present,
67
- the resolver automatically adds a `@codemcp/knowledge-server` MCP server
68
- entry.
61
+ Documentation sources declared as a `docset` provision in an option's
62
+ recipe. Docsets are always implied by an upstream selection (e.g. picking
63
+ "TanStack" implies TanStack Router/Query/Form/Table docs declared as
64
+ `docset` provisions in the `tanstack` option's recipe). The `docsetWriter`
65
+ maps each provision to a `KnowledgeSource` in LogicalConfig. When any
66
+ knowledge sources are present, the resolver automatically adds a
67
+ `@codemcp/knowledge-server` MCP server entry.
69
68
 
70
69
  ### Provision
71
70
 
@@ -76,15 +75,17 @@ carries writer-specific config. Provision types:
76
75
  | ------------- | ------------------------------------------------------------ |
77
76
  | `workflows` | MCP server entry for `@codemcp/workflows-server` |
78
77
  | `skills` | Skill definitions (inline or external) for `@codemcp/skills` |
79
- | `knowledge` | Knowledge source entry for `@codemcp/knowledge` |
78
+ | `docset` | Knowledge source entry for `@codemcp/knowledge` |
80
79
  | `instruction` | Raw instruction text for the agent |
81
80
 
82
81
  ### KnowledgeSource
83
82
 
84
- Describes the origin of documentation content (a git repository URL ending
85
- in `.git`). The `@codemcp/knowledge` package manages the physical docset
86
- artifacts via its programmatic API (`createDocset` + `initDocset`); ADE
87
- tracks the sources in LogicalConfig.
83
+ Describes the origin of documentation content. The `preset` field controls
84
+ how the source is fetched: `"git-repo"` (default) for git repositories,
85
+ `"archive"` for remote `.tar.gz` archives, `"local-folder"` for local paths.
86
+ The `@codemcp/knowledge` package manages the physical docset artifacts via
87
+ its programmatic API (`createDocset` + `initDocset`); ADE tracks the sources
88
+ in LogicalConfig.
88
89
 
89
90
  ### LogicalConfig (intermediate representation)
90
91
 
@@ -95,7 +96,7 @@ resolution step and the agent writers:
95
96
  mcp_servers: [{ref, command, args, env}]
96
97
  instructions: [string]
97
98
  skills: [SkillDefinition]
98
- knowledge_sources: [{name, origin, description}]
99
+ knowledge_sources: [{name, origin, description, preset?}]
99
100
  ```
100
101
 
101
102
  ### Agent Writer
@@ -124,8 +125,6 @@ choices:
124
125
  practices: # multi-select facet
125
126
  - conventional-commits
126
127
  - tdd-london
127
- excluded_docsets: # docsets the user opted out of
128
- - tanstack-table-docs
129
128
  custom: # user-managed section (not touched by CLI)
130
129
  mcp_servers:
131
130
  - ref: custom-server
@@ -148,16 +147,12 @@ when a facet selection or catalog version is updated.
148
147
  ## CLI Commands
149
148
 
150
149
  ```
151
- ade setup Interactive TUI: walk through facets, confirm docsets,
152
- write config.yaml + config.lock.yaml + agent files,
153
- install skills and knowledge sources.
150
+ ade setup Interactive TUI: walk through facets, write
151
+ config.yaml + config.lock.yaml + agent files,
152
+ install skills, prompt to initialize knowledge sources.
154
153
  Re-running setup on an existing project pre-selects
155
154
  previous choices as defaults. Warns if a previous
156
155
  selection references an option no longer in the catalog.
157
-
158
- ade install Apply config.lock.yaml → agent files + skills + knowledge.
159
- Non-interactive. Idempotent. Does not re-resolve — uses
160
- the lock file as-is.
161
156
  ```
162
157
 
163
158
  ## Catalog
@@ -190,8 +185,8 @@ Stack and framework conventions that shape the project structure.
190
185
  | `tanstack` | Full-stack conventions for TanStack (Router, Query, Form, Table) |
191
186
 
192
187
  Each architecture option carries inline skills (conventions, design patterns,
193
- code style, testing) and recommended docsets (git repos for each library's
194
- documentation).
188
+ code style, testing) and docset provisions (one `docset` recipe entry per
189
+ documentation source).
195
190
 
196
191
  ### 3. Practices (`practices`) — multi-select
197
192
 
@@ -204,18 +199,20 @@ Composable development practices. Multiple selections allowed.
204
199
  | `adr-nygard` | Architecture Decision Records following Nygard's template |
205
200
 
206
201
  Practices with associated documentation (e.g. Conventional Commits) carry
207
- docsets that are collected alongside architecture docsets.
202
+ `docset` provisions that resolve to knowledge sources alongside architecture
203
+ docsets.
208
204
 
209
205
  ### Documentation Layer (derived)
210
206
 
211
207
  Documentation is **not** a standalone facet. Instead, each option in
212
- architecture and practices declares recommended `docsets[]`. The setup TUI
213
- collects all implied docsets and presents them as an opt-out confirmation
214
- step. Accepted docsets become `knowledge_sources` in LogicalConfig, which
215
- triggers:
208
+ architecture and practices declares documentation sources as `docset`
209
+ provisions in its recipe the same mechanism used for skills. The resolver
210
+ processes these like any other provision: `docsetWriter` maps each to a
211
+ `KnowledgeSource`. Accepted docsets become `knowledge_sources` in
212
+ LogicalConfig, which triggers:
216
213
 
217
214
  1. Automatic addition of the `@codemcp/knowledge-server` MCP server entry
218
- 2. Installation via `@codemcp/knowledge` API (`createDocset` + `initDocset`)
215
+ 2. A confirmation prompt in `ade setup` default is to defer initialization
219
216
 
220
217
  ## Non-Goals (initial release)
221
218
 
@@ -243,9 +240,10 @@ triggers:
243
240
  5. **User edits are confined to `custom`.** The rest of `config.yaml` is
244
241
  CLI-managed, eliminating merge conflicts in the structured sections.
245
242
 
246
- 6. **Docsets are a weak entity on Option, not a separate facet.** Documentation
247
- sources are always implied by an upstream selection. Making documentation a
248
- standalone facet would create a hollow indirection whose options just mirror
249
- upstream choices 1:1. Config stores `excluded_docsets` (what the user opted
250
- out of) rather than selected docsets, keeping the common case (accept all
251
- recommendations) zero-config.
243
+ 6. **Docsets are `docset` provisions in the recipe, not a separate field.**
244
+ Documentation sources are always implied by an upstream selection. They are
245
+ declared as `{ writer: "docset", config: {...} }` recipe entries
246
+ consistent with how skills are declared. This eliminates the separate
247
+ `Option.docsets[]` field, the `excluded_docsets` opt-out mechanism, and the
248
+ per-item confirmation multiselect. Users can still defer or skip
249
+ initialization via the single confirm prompt in `ade setup`.