@softspark/ai-toolkit 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +57 -5
- package/app/.claude-plugin/plugin.json +1 -1
- package/app/ARCHITECTURE.md +6 -0
- package/bin/ai-toolkit.js +37 -0
- package/kb/{planning/enterprise-config-inheritance-plan.md → history/completed/enterprise-config-inheritance-plan-20260412.md} +39 -37
- package/kb/reference/enterprise-config-guide.md +329 -0
- package/llms-full.txt +2518 -2181
- package/llms.txt +2 -1
- package/manifest.json +9 -1
- package/package.json +1 -1
- package/scripts/config_cli.py +537 -0
- package/scripts/config_lock.py +154 -0
- package/scripts/config_merger.py +455 -0
- package/scripts/config_resolver.py +507 -0
- package/scripts/config_scaffold.py +266 -0
- package/scripts/config_validator.py +389 -0
- package/scripts/install.py +163 -1
- package/scripts/install_steps/ai_tools.py +101 -1
- package/scripts/install_steps/install_state.py +24 -0
- package/scripts/install_steps/project_registry.py +142 -0
- package/scripts/projects_cli.py +110 -0
- package/scripts/schemas/ai-toolkit-config.schema.json +163 -0
- package/scripts/update_projects.py +141 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Enterprise Config Inheritance Guide"
|
|
3
|
+
category: reference
|
|
4
|
+
service: ai-toolkit
|
|
5
|
+
tags:
|
|
6
|
+
- enterprise
|
|
7
|
+
- config-inheritance
|
|
8
|
+
- extends
|
|
9
|
+
- governance
|
|
10
|
+
- multi-repo
|
|
11
|
+
doc_type: reference
|
|
12
|
+
created: "2026-04-11"
|
|
13
|
+
last_updated: "2026-04-11"
|
|
14
|
+
description: "Comprehensive guide for setting up and using ai-toolkit configuration inheritance. Covers base config creation, project setup, enforcement rules, CI integration, and troubleshooting."
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Enterprise Config Inheritance Guide
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
Configuration inheritance enables organizations to define a shared base config published as an npm package, Git URL, or local path. Individual projects extend this base via an `extends` field in `.ai-toolkit.json`. Changes to the base propagate automatically on `ai-toolkit update --local`.
|
|
22
|
+
|
|
23
|
+
**Pattern:** Mirrors ESLint's `extends`, TypeScript's `extends`, and Prettier's shared configs.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
### 1. Create a base config (team lead)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
ai-toolkit config create-base @mycompany/ai-toolkit-config
|
|
33
|
+
cd mycompany-ai-toolkit-config
|
|
34
|
+
|
|
35
|
+
# Edit ai-toolkit.config.json — add your org's rules, agents, enforcement
|
|
36
|
+
# Add rule files to rules/
|
|
37
|
+
# Add custom agent definitions to agents/
|
|
38
|
+
|
|
39
|
+
npm publish
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Set up a project (developer)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cd my-project
|
|
46
|
+
ai-toolkit config init --extends @mycompany/ai-toolkit-config
|
|
47
|
+
ai-toolkit install --local
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or manually create `.ai-toolkit.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"extends": "@mycompany/ai-toolkit-config",
|
|
55
|
+
"profile": "standard",
|
|
56
|
+
"agents": {
|
|
57
|
+
"enabled": ["frontend-specialist"]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Verify
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
ai-toolkit config validate # Schema + extends + enforcement
|
|
66
|
+
ai-toolkit config diff # Show differences from base
|
|
67
|
+
ai-toolkit config check # CI enforcement check
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Configuration Reference
|
|
73
|
+
|
|
74
|
+
### Project config (`.ai-toolkit.json`)
|
|
75
|
+
|
|
76
|
+
| Field | Type | Description |
|
|
77
|
+
|-------|------|-------------|
|
|
78
|
+
| `extends` | string | Base config source (npm, git URL, local path) |
|
|
79
|
+
| `profile` | enum | `minimal`, `standard`, `strict`, `full`, `offline-slm` |
|
|
80
|
+
| `agents` | object | `enabled`, `disabled`, `custom` arrays |
|
|
81
|
+
| `rules` | object | `inject`, `remove` arrays |
|
|
82
|
+
| `constitution` | object | `amendments` array (article 6+ only) |
|
|
83
|
+
| `enforce` | object | Non-overridable constraints (base configs only) |
|
|
84
|
+
| `overrides` | object | Explicit overrides with justification |
|
|
85
|
+
|
|
86
|
+
### Base config (`ai-toolkit.config.json`)
|
|
87
|
+
|
|
88
|
+
Same fields as project config, plus:
|
|
89
|
+
|
|
90
|
+
| Field | Type | Description |
|
|
91
|
+
|-------|------|-------------|
|
|
92
|
+
| `name` | string | Package identity (required) |
|
|
93
|
+
| `version` | string | Semver version (required) |
|
|
94
|
+
|
|
95
|
+
### Extends sources
|
|
96
|
+
|
|
97
|
+
| Source | Syntax | Example |
|
|
98
|
+
|--------|--------|---------|
|
|
99
|
+
| npm package | `"@scope/pkg"` | `"@mycompany/ai-toolkit-config"` |
|
|
100
|
+
| npm + version | `"@scope/pkg@version"` | `"@mycompany/ai-toolkit-config@^2.0.0"` |
|
|
101
|
+
| Git URL | `"git+https://..."` | `"git+https://github.com/myco/config.git"` |
|
|
102
|
+
| Local path | `"./path"` or `"../path"` | `"../shared-config"` |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Merge Semantics
|
|
107
|
+
|
|
108
|
+
When a project extends a base, configs are merged with these rules:
|
|
109
|
+
|
|
110
|
+
| Type | Rule |
|
|
111
|
+
|------|------|
|
|
112
|
+
| **Dicts** | Recursive deep merge |
|
|
113
|
+
| **Lists** | Union (base + project, deduplicated) |
|
|
114
|
+
| **Scalars** | Project wins |
|
|
115
|
+
| **Agents** | Union enabled, project can disable (unless required) |
|
|
116
|
+
| **Rules** | Union inject, project can remove |
|
|
117
|
+
| **Constitution** | Base articles immutable, project adds only (6+) |
|
|
118
|
+
| **Enforce** | Base wins (cannot weaken, only strengthen) |
|
|
119
|
+
| **Profile** | Project can change |
|
|
120
|
+
|
|
121
|
+
### Merge order (multi-level)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
grandparent → parent → project
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Deepest ancestor is resolved first. Max chain depth: 5 levels.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Enforcement
|
|
132
|
+
|
|
133
|
+
Base configs can define non-overridable constraints via the `enforce` block:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"enforce": {
|
|
138
|
+
"minHookProfile": "standard",
|
|
139
|
+
"requiredPlugins": ["security-pack"],
|
|
140
|
+
"forbidOverride": ["constitution", "guard-destructive"],
|
|
141
|
+
"requiredAgents": ["security-auditor"]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
| Constraint | Effect |
|
|
147
|
+
|------------|--------|
|
|
148
|
+
| `minHookProfile` | Projects cannot use a weaker hook profile |
|
|
149
|
+
| `requiredPlugins` | Must be installed in all projects |
|
|
150
|
+
| `forbidOverride` | These components cannot be overridden |
|
|
151
|
+
| `requiredAgents` | Must be enabled in all projects |
|
|
152
|
+
|
|
153
|
+
### Overrides
|
|
154
|
+
|
|
155
|
+
Projects can override base settings, but must declare intent:
|
|
156
|
+
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"overrides": {
|
|
160
|
+
"quality-check": {
|
|
161
|
+
"override": true,
|
|
162
|
+
"justification": "Company uses custom lint pipeline via Jenkins",
|
|
163
|
+
"replacement": "skip"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Requirements:
|
|
170
|
+
- `override: true` must be explicit
|
|
171
|
+
- `justification` must be at least 20 characters
|
|
172
|
+
- Component must not be in `enforce.forbidOverride`
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Constitution Immutability
|
|
177
|
+
|
|
178
|
+
- **Articles I-V** (toolkit core) are absolutely immutable
|
|
179
|
+
- **Base config articles** are immutable — projects cannot modify them
|
|
180
|
+
- Projects can **only ADD** new articles (article 6+)
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"constitution": {
|
|
185
|
+
"amendments": [
|
|
186
|
+
{"article": 8, "title": "API Standards", "text": "All APIs must be RESTful."}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## CLI Commands
|
|
195
|
+
|
|
196
|
+
### `ai-toolkit config validate [path]`
|
|
197
|
+
|
|
198
|
+
Validates `.ai-toolkit.json` schema, resolves extends, checks enforcement.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
ai-toolkit config validate
|
|
202
|
+
# ✓ schema valid
|
|
203
|
+
# ✓ extends resolved: 1 base config(s)
|
|
204
|
+
# ✓ no forbidden overrides
|
|
205
|
+
# ✓ constitution articles intact
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### `ai-toolkit config diff [path]`
|
|
209
|
+
|
|
210
|
+
Shows differences between project config and base.
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
ai-toolkit config diff
|
|
214
|
+
# Base: @mycompany/ai-toolkit-config@2.1.0
|
|
215
|
+
# Profile: strict (base) → standard (project) ⚠ OVERRIDE
|
|
216
|
+
# Agents:
|
|
217
|
+
# + frontend-specialist (project adds)
|
|
218
|
+
# = security-auditor (base requires, cannot disable)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### `ai-toolkit config init [flags]`
|
|
222
|
+
|
|
223
|
+
Create `.ai-toolkit.json` interactively or with flags.
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
ai-toolkit config init # interactive
|
|
227
|
+
ai-toolkit config init --extends @mycompany/config # with extends
|
|
228
|
+
ai-toolkit config init --no-extends --profile standard # without extends
|
|
229
|
+
ai-toolkit config init --force # overwrite existing
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### `ai-toolkit config create-base <name> [output-dir]`
|
|
233
|
+
|
|
234
|
+
Scaffold a base config npm package.
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
ai-toolkit config create-base @mycompany/ai-toolkit-config
|
|
238
|
+
# Creates: mycompany-ai-toolkit-config/
|
|
239
|
+
# package.json, ai-toolkit.config.json, rules/, agents/, README.md
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### `ai-toolkit config check [path] [--json]`
|
|
243
|
+
|
|
244
|
+
CI enforcement check. Exit codes: 0 (pass), 1 (fail), 2 (no config).
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
ai-toolkit config check --json
|
|
248
|
+
# {"status": "pass", "code": 0, "checks": [...]}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
GitHub Actions example:
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
- name: AI Toolkit Governance Check
|
|
255
|
+
run: |
|
|
256
|
+
npx @softspark/ai-toolkit config check --json
|
|
257
|
+
npx @softspark/ai-toolkit config validate --strict
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Lock File
|
|
263
|
+
|
|
264
|
+
`.ai-toolkit.lock.json` pins exact resolved versions for reproducible installs.
|
|
265
|
+
|
|
266
|
+
- `install --local` → creates/updates lock file
|
|
267
|
+
- `update --local` → re-resolves and updates lock file
|
|
268
|
+
- `update --local --refresh-base` → force re-fetch ignoring cache
|
|
269
|
+
- Commit `.ai-toolkit.lock.json` to git for team synchronization
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"lockfileVersion": 1,
|
|
274
|
+
"resolved": {
|
|
275
|
+
"@mycompany/ai-toolkit-config": {
|
|
276
|
+
"version": "2.1.0",
|
|
277
|
+
"integrity": "sha256:abc123...",
|
|
278
|
+
"cached": "~/.ai-toolkit/config-cache/@mycompany/ai-toolkit-config/2.1.0/"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Offline Support
|
|
287
|
+
|
|
288
|
+
When npm/git is unavailable:
|
|
289
|
+
|
|
290
|
+
1. Checks cache (`~/.ai-toolkit/config-cache/`)
|
|
291
|
+
2. If cached version found → uses with warning
|
|
292
|
+
3. If not cached → error with instructions
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Force refresh when back online:
|
|
296
|
+
ai-toolkit update --local --refresh-base
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Troubleshooting
|
|
302
|
+
|
|
303
|
+
### "Cannot resolve extends"
|
|
304
|
+
|
|
305
|
+
- Check network connectivity
|
|
306
|
+
- Verify npm package name is correct
|
|
307
|
+
- For private packages, ensure `.npmrc` has auth configured
|
|
308
|
+
- Try `--refresh-base` to clear cache
|
|
309
|
+
|
|
310
|
+
### "Cannot disable agent — required by base config"
|
|
311
|
+
|
|
312
|
+
The base config's `enforce.requiredAgents` prevents disabling this agent.
|
|
313
|
+
Contact your team lead to request an exemption.
|
|
314
|
+
|
|
315
|
+
### "Cannot modify Constitution Article X"
|
|
316
|
+
|
|
317
|
+
Base constitution articles are immutable. You can only ADD new articles with higher numbers.
|
|
318
|
+
|
|
319
|
+
### "Override requires justification"
|
|
320
|
+
|
|
321
|
+
All overrides need `"override": true` and a `"justification"` field (min 20 chars).
|
|
322
|
+
|
|
323
|
+
### "Circular extends detected"
|
|
324
|
+
|
|
325
|
+
Your extends chain has a loop. Check that base configs don't reference each other cyclically. Max depth is 5 levels.
|
|
326
|
+
|
|
327
|
+
### Lock file stale
|
|
328
|
+
|
|
329
|
+
Run `ai-toolkit update --local` to re-resolve and update the lock file.
|