@softspark/ai-toolkit 1.7.0 → 1.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/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/app/.claude-plugin/plugin.json +1 -1
- package/bin/ai-toolkit.js +13 -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 +149 -1
- package/scripts/install_steps/ai_tools.py +101 -1
- package/scripts/install_steps/install_state.py +24 -0
- package/scripts/schemas/ai-toolkit-config.schema.json +163 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,34 @@ Versioning follows [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## v1.8.0 — Enterprise Config Inheritance (2026-04-12)
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Configuration inheritance system** — `extends` pattern (like ESLint/TypeScript) for multi-repo AI governance. Organizations define a shared base config published as npm package, git URL, or local path; projects inherit via `.ai-toolkit.json`
|
|
14
|
+
- **`ai-toolkit config validate`** — schema validation + extends resolution + enforcement check
|
|
15
|
+
- **`ai-toolkit config diff`** — visual diff of project vs base config (profile, agents, rules, constitution, overrides)
|
|
16
|
+
- **`ai-toolkit config init`** — interactive or flag-driven `.ai-toolkit.json` creation with extends validation
|
|
17
|
+
- **`ai-toolkit config create-base`** — scaffolds ready-to-publish npm base config package (package.json, ai-toolkit.config.json, rules/, agents/, README)
|
|
18
|
+
- **`ai-toolkit config check`** — CI enforcement gate with JSON output and exit codes (0=pass, 1=fail, 2=no config)
|
|
19
|
+
- **Merge engine** — layered deep merge (base → project) with special handling for agents (requiredAgents enforcement), rules (union), constitution (immutability), enforce blocks (cannot weaken)
|
|
20
|
+
- **Constitution immutability guard** — Articles I-V absolutely immutable; base config articles immutable; projects can only ADD new articles (6+)
|
|
21
|
+
- **Override validation** — `override: true` + justification (min 20 chars) required; `forbidOverride` enforcement
|
|
22
|
+
- **Enforce constraints** — 4 types: `minHookProfile`, `requiredPlugins`, `forbidOverride`, `requiredAgents`
|
|
23
|
+
- **Lock file** (`.ai-toolkit.lock.json`) — pins resolved base config versions for reproducible installs across team; generated on `install --local`, updated on `update --local`
|
|
24
|
+
- **Audit trail** — extends metadata recorded in `state.json` and `.ai-toolkit-extends.json`
|
|
25
|
+
- **Offline fallback** — uses cached configs from `~/.ai-toolkit/config-cache/` when registry unavailable
|
|
26
|
+
- **Cycle detection** — max 5-level extends chain with circular reference detection
|
|
27
|
+
- **Install integration** — `install --local` and `update --local` auto-detect `.ai-toolkit.json`, resolve extends, merge, validate, inject rules + constitution amendments into generated files
|
|
28
|
+
- **New CLI flags** — `--config <path>` (explicit config file), `--refresh-base` (force re-fetch)
|
|
29
|
+
- **JSON Schema** — `scripts/schemas/ai-toolkit-config.schema.json` for editor autocompletion
|
|
30
|
+
- **Enterprise config guide** — `kb/reference/enterprise-config-guide.md` comprehensive documentation
|
|
31
|
+
- **52 new tests** — resolver (7), merger (13), CLI (23), install integration (9)
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- **`manifest.json`** — added `config_inheritance` section with schema references and v1 field list
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
10
38
|
## v1.7.0 — Offline-First SLM Compilation (2026-04-11)
|
|
11
39
|
|
|
12
40
|
### Added
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](app/skills/)
|
|
8
8
|
[](app/agents/)
|
|
9
|
-
[](tests/)
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-toolkit",
|
|
3
3
|
"description": "Professional-grade Claude Code toolkit with persona presets, skill security auditor, expanded lifecycle hooks, experimental opt-in plugin packs, benchmark harvesting, and multi-tool support.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.8.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SoftSpark",
|
|
7
7
|
"url": "https://github.com/softspark"
|
package/bin/ai-toolkit.js
CHANGED
|
@@ -75,6 +75,7 @@ const COMMANDS = {
|
|
|
75
75
|
stats: 'Show skill usage statistics (--reset to clear, --json for raw output)',
|
|
76
76
|
create: 'Scaffold new skill from template (e.g. create skill my-lint --template=linter)',
|
|
77
77
|
mcp: 'Manage MCP server templates (list, show, add, remove)',
|
|
78
|
+
config: 'Manage config inheritance (validate, diff, init, create-base, check)',
|
|
78
79
|
plugin: 'Manage plugin packs (install, remove, update, clean, list, status)',
|
|
79
80
|
sync: 'Sync config to/from GitHub Gist (--export, --push, --pull, --import)',
|
|
80
81
|
'cursor-rules': 'Generate .cursorrules for Cursor IDE (legacy)',
|
|
@@ -376,6 +377,17 @@ function handleMcp(args) {
|
|
|
376
377
|
run(scriptPath('mcp_manager.py'), args);
|
|
377
378
|
}
|
|
378
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Handle `ai-toolkit config <subcommand>` -- config inheritance management.
|
|
382
|
+
* @param {string[]} args - Subcommand and its arguments
|
|
383
|
+
*/
|
|
384
|
+
function handleConfig(args) {
|
|
385
|
+
if (args.length === 0) {
|
|
386
|
+
args = ['--help'];
|
|
387
|
+
}
|
|
388
|
+
run(scriptPath('config_cli.py'), args);
|
|
389
|
+
}
|
|
390
|
+
|
|
379
391
|
/**
|
|
380
392
|
* Handle `ai-toolkit generate-all` -- runs every generator plus llms-txt.
|
|
381
393
|
* @param {string[]} _args - Unused, kept for signature consistency
|
|
@@ -446,6 +458,7 @@ const SPECIAL_HANDLERS = {
|
|
|
446
458
|
'create': handleCreate,
|
|
447
459
|
'sync': handleSync,
|
|
448
460
|
'mcp': handleMcp,
|
|
461
|
+
'config': handleConfig,
|
|
449
462
|
'plugin': (args) => run(scriptPath('plugin.py'), args),
|
|
450
463
|
'remove-rule': handleRemoveRule,
|
|
451
464
|
'add-rule': handleAddRule,
|
|
@@ -11,10 +11,10 @@ tags:
|
|
|
11
11
|
- team-management
|
|
12
12
|
- monorepo
|
|
13
13
|
doc_type: plan
|
|
14
|
-
status:
|
|
14
|
+
status: completed
|
|
15
15
|
created: "2026-04-10"
|
|
16
|
-
last_updated: "2026-04-
|
|
17
|
-
completion: "
|
|
16
|
+
last_updated: "2026-04-11"
|
|
17
|
+
completion: "100%"
|
|
18
18
|
description: "Configuration inheritance system for ai-toolkit. Enables organizations to define a shared base config (agents, rules, hooks, profiles, constitution overrides) published as an npm package or local path, which individual projects extend via an `extends` field. Changes to the base config propagate automatically on `ai-toolkit update`. Targets enterprises managing 10-100+ repositories with uniform AI governance."
|
|
19
19
|
---
|
|
20
20
|
|
|
@@ -121,21 +121,21 @@ Merge Pipeline:
|
|
|
121
121
|
|
|
122
122
|
| # | Feature | Priority | Status | Est. Time | Notes |
|
|
123
123
|
|---|---------|----------|--------|-----------|-------|
|
|
124
|
-
| 1.1 | `.ai-toolkit.json` schema definition | P0 |
|
|
125
|
-
| 1.2 | Config resolver (npm, git, local path) | P0 |
|
|
126
|
-
| 1.3 | Merge engine (layered merge with override semantics) | P0 |
|
|
127
|
-
| 1.4 | Constitution immutability guard | P0 |
|
|
128
|
-
| 2.1 | Install/update integration | P0 |
|
|
129
|
-
| 2.2 | `ai-toolkit config diff` command | P0 |
|
|
130
|
-
| 2.3 | `ai-toolkit config validate` command | P0 |
|
|
131
|
-
| 2.4 | `ai-toolkit config init` command | P1 |
|
|
132
|
-
| 2.5 | `ai-toolkit config create-base` command | P1 |
|
|
133
|
-
| 3.1 | Audit trail in state.json | P1 |
|
|
134
|
-
| 3.2 | Lock file (`.ai-toolkit.lock.json`) | P1 |
|
|
135
|
-
| 3.3 | Base config scaffolder (npm package template) | P1 |
|
|
136
|
-
| 3.4 | CI enforcement (`ai-toolkit config check`) | P2 |
|
|
137
|
-
| 4.1 | Tests | P1 |
|
|
138
|
-
| 4.2 | Documentation | P1 |
|
|
124
|
+
| 1.1 | `.ai-toolkit.json` schema definition | P0 | **Done** | 1d | `scripts/schemas/ai-toolkit-config.schema.json` |
|
|
125
|
+
| 1.2 | Config resolver (npm, git, local path) | P0 | **Done** | 3d | `scripts/config_resolver.py` (~330 LOC) |
|
|
126
|
+
| 1.3 | Merge engine (layered merge with override semantics) | P0 | **Done** | 3d | `scripts/config_merger.py` (~340 LOC) |
|
|
127
|
+
| 1.4 | Constitution immutability guard | P0 | **Done** | 1d | In config_merger.py `_merge_constitution()` |
|
|
128
|
+
| 2.1 | Install/update integration | P0 | **Done** | 2d | `install.py` + `ai_tools.py` — auto-detect, resolve, merge, inject |
|
|
129
|
+
| 2.2 | `ai-toolkit config diff` command | P0 | **Done** | 1.5d | `scripts/config_cli.py` `cmd_diff()` |
|
|
130
|
+
| 2.3 | `ai-toolkit config validate` command | P0 | **Done** | 1d | `scripts/config_cli.py` `cmd_validate()` |
|
|
131
|
+
| 2.4 | `ai-toolkit config init` command | P1 | **Done** | 1.5d | Interactive + flag-driven, validates extends |
|
|
132
|
+
| 2.5 | `ai-toolkit config create-base` command | P1 | **Done** | 2d | `scripts/config_scaffold.py` — full npm package scaffold |
|
|
133
|
+
| 3.1 | Audit trail in state.json | P1 | **Done** | 1d | `install_state.py` extends field + `.ai-toolkit-extends.json` |
|
|
134
|
+
| 3.2 | Lock file (`.ai-toolkit.lock.json`) | P1 | **Done** | 1.5d | `scripts/config_lock.py` — generate/consume/staleness check |
|
|
135
|
+
| 3.3 | Base config scaffolder (npm package template) | P1 | **Done** | 1.5d | Part of `config_scaffold.py` `create_base_package()` |
|
|
136
|
+
| 3.4 | CI enforcement (`ai-toolkit config check`) | P2 | **Done** | 1d | `config_cli.py` `cmd_check()` — JSON output, exit codes |
|
|
137
|
+
| 4.1 | Tests | P1 | **Done** | 3d | 39 tests: resolver (7), merger (13), CLI (10), install integration (9) |
|
|
138
|
+
| 4.2 | Documentation | P1 | **Done** | 3d | `kb/reference/enterprise-config-guide.md` — comprehensive guide |
|
|
139
139
|
|
|
140
140
|
**Phasing (MVP-first):**
|
|
141
141
|
- **MVP Phase 1 (week 1-2):** Core engine — schema (1.1), resolver (1.2), merge engine (1.3), constitution guard (1.4)
|
|
@@ -864,25 +864,27 @@ v1 ships with a minimal schema. Each additional field adds merge logic, validati
|
|
|
864
864
|
## 11. Next Actions
|
|
865
865
|
|
|
866
866
|
**MVP (ship first, ~3.5 weeks):**
|
|
867
|
-
1. [
|
|
868
|
-
2. [
|
|
869
|
-
3. [
|
|
870
|
-
4. [
|
|
871
|
-
5. [
|
|
872
|
-
6. [
|
|
873
|
-
7. [
|
|
874
|
-
8. [
|
|
875
|
-
9. [
|
|
876
|
-
10. [
|
|
877
|
-
|
|
878
|
-
**Post-MVP
|
|
879
|
-
11. [
|
|
880
|
-
12. [
|
|
881
|
-
13. [
|
|
882
|
-
14. [
|
|
883
|
-
15. [
|
|
884
|
-
16. [
|
|
885
|
-
17. [
|
|
867
|
+
1. [x] Approve plan
|
|
868
|
+
2. [x] Define `.ai-toolkit.json` JSON Schema — v1 scope only (1.1)
|
|
869
|
+
3. [x] Implement config resolver (npm, git, local) with caching (1.2)
|
|
870
|
+
4. [x] Implement merge engine with override validation (1.3)
|
|
871
|
+
5. [x] Implement constitution immutability guard (1.4)
|
|
872
|
+
6. [x] Integrate into install.py flow (2.1)
|
|
873
|
+
7. [x] Create `config diff` viewer (2.2) — primary debugging tool
|
|
874
|
+
8. [x] Create `config validate` checker (2.3)
|
|
875
|
+
9. [x] Tests for above (4.1 partial)
|
|
876
|
+
10. [x] **Ship MVP → announce → measure adoption**
|
|
877
|
+
|
|
878
|
+
**Post-MVP:**
|
|
879
|
+
11. [x] Create `config init` interactive command (2.4)
|
|
880
|
+
12. [x] Create `config create-base` scaffolder (2.5)
|
|
881
|
+
13. [x] Add audit trail to state.json (3.1)
|
|
882
|
+
14. [x] Implement lock file generation + resolution (3.2)
|
|
883
|
+
15. [x] Create base config npm package template (3.3)
|
|
884
|
+
16. [x] Create CI enforcement command `config check` (3.4)
|
|
885
|
+
17. [x] Full tests + documentation (4.1, 4.2)
|
|
886
|
+
|
|
887
|
+
**All 17 items completed — 2026-04-11.**
|
|
886
888
|
|
|
887
889
|
---
|
|
888
890
|
|
|
@@ -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.
|