ai-developer-skill-os 8.1.10 → 8.2.1
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/.agents/CHANGELOG.md +18 -0
- package/.agents/README.md +17 -13
- package/.agents/blueprints/coding/project.yaml.tpl +39 -0
- package/.agents/blueprints/rag/project.yaml.tpl +45 -0
- package/.agents/blueprints/workflow/project.yaml.tpl +38 -0
- package/.agents/knowledge/domain-patterns/construction/ddc-construction-ai-blueprint.md +103 -0
- package/.agents/registry/graph.json +526 -0
- package/.agents/registry/index.yaml +259 -0
- package/.agents/skills/_template/capability.yaml +20 -0
- package/.agents/skills/_template/evals/scorecard.yaml +19 -0
- package/.agents/skills/qk-agent-observability/SKILL.md +11 -0
- package/.agents/skills/qk-ai-builder/SKILL.md +13 -10
- package/.agents/skills/qk-code-review/SKILL.md +6 -9
- package/.agents/skills/qk-context-loader/SKILL.md +0 -36
- package/.agents/skills/qk-data-lifecycle/SKILL.md +1 -1
- package/.agents/skills/qk-design-system-engineering/SKILL.md +1 -1
- package/.agents/skills/qk-devops-platform/SKILL.md +1 -1
- package/.agents/skills/qk-feature-delivery/SKILL.md +21 -1
- package/.agents/skills/qk-frontend-architecture/SKILL.md +1 -1
- package/.agents/skills/qk-orchestrator/SKILL.md +0 -44
- package/.agents/skills/qk-product-specification/SKILL.md +1 -1
- package/.agents/skills/qk-production-release/SKILL.md +1 -1
- package/.agents/skills/qk-project-bootstrap/SKILL.md +56 -52
- package/.agents/skills/qk-security-audit/SKILL.md +1 -1
- package/.agents/skills/qk-system-evolution/SKILL.md +1 -1
- package/.agents/skills/qk-test-engineering/SKILL.md +1 -1
- package/.agents/skills/qk-ui-builder/SKILL.md +1 -1
- package/.agents/skills/qk-validation-gate/SKILL.md +15 -8
- package/.agents/skills/qk-web-quality-gate/SKILL.md +1 -1
- package/CHANGELOG.md +28 -0
- package/README.md +17 -13
- package/package.json +9 -4
- package/tooling/build-registry.js +186 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
# ── Identity ───────────────────────────────────────────────
|
|
3
3
|
name: qk-project-bootstrap
|
|
4
|
-
version: 8.
|
|
4
|
+
version: 8.2.0
|
|
5
5
|
status: stable
|
|
6
|
-
description: "Khởi tạo dự án mới
|
|
6
|
+
description: "Khởi tạo dự án mới theo chuẩn V8.2 Blueprint Plugin Generator (project.yaml, 4-folder AI RAG hoặc Coding) với cấu trúc kiên cường."
|
|
7
7
|
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
8
8
|
|
|
9
9
|
# ── V8: Classification ─────────────────────────────────────
|
|
@@ -77,7 +77,7 @@ token_budget:
|
|
|
77
77
|
max_files_read: 1
|
|
78
78
|
max_lines_per_read: 50
|
|
79
79
|
max_shell_commands: 2
|
|
80
|
-
stop_early:
|
|
80
|
+
stop_early: true
|
|
81
81
|
|
|
82
82
|
exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
|
|
83
83
|
---
|
|
@@ -100,77 +100,81 @@ On missing precondition:
|
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|
|
103
|
-
## Scope
|
|
104
|
-
- ✅
|
|
105
|
-
- ✅ Generate `
|
|
106
|
-
- ✅
|
|
107
|
-
- ✅
|
|
103
|
+
## Scope & V8.2 Blueprint Generator
|
|
104
|
+
- ✅ **One-Click Blueprint Selection:** Choose from Blueprint Plugins (`coding`, `rag`, `workflow`, `enterprise`).
|
|
105
|
+
- ✅ **Generate `project.yaml`:** Copy appropriate manifest from `.agents/blueprints/<type>/project.yaml.tpl` to workspace root.
|
|
106
|
+
- ✅ **Initialize Project Scaffolding:** Create standard directory structure (including the **4-Folder RAG Architecture** for AI projects).
|
|
107
|
+
- ✅ **Configure Tooling:** Linter, Prettier, TypeScript strict mode, or Python environment depending on stack.
|
|
108
|
+
- ✅ **Generate `DESIGN.md`:** Mandatory brand & token contract for any UI project.
|
|
108
109
|
|
|
109
110
|
## Non-Goals
|
|
111
|
+
- ❌ Skip `project.yaml` workspace manifest initialization
|
|
110
112
|
- ❌ Skip DESIGN.md for UI projects
|
|
111
113
|
- ❌ Hardcode outdated dependency versions
|
|
112
|
-
- ❌ Skip README
|
|
114
|
+
- ❌ Skip README or documentation
|
|
113
115
|
|
|
114
116
|
---
|
|
115
117
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
###
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
├──
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
## V8.2 Blueprint Plugins & Directory Structures
|
|
119
|
+
|
|
120
|
+
### 1. RAG & AI Agents (The 4-Folder Architecture Blueprint)
|
|
121
|
+
*Activated when building AI agents, RAG engines, or domain automation.*
|
|
122
|
+
```text
|
|
123
|
+
project.yaml # ⭐ V8.2 Workspace Manifest (Profiles & Capabilities)
|
|
124
|
+
prompts/ # Prompt instructions managed as code
|
|
125
|
+
├── system/
|
|
126
|
+
├── tasks/
|
|
127
|
+
└── tools/
|
|
128
|
+
data/ # Strict data discipline
|
|
129
|
+
├── raw/ # IMMUTABLE original files (PDFs, Excel, Revit/CAD)
|
|
130
|
+
└── processed/ # Cleaned, standardized chunks for AI ingestion
|
|
131
|
+
agents/ # Agent configurations and domain micro-skills
|
|
132
|
+
├── skills/
|
|
133
|
+
└── tools/
|
|
134
|
+
evals/ # Quantitative validation evidence
|
|
135
|
+
├── tests/
|
|
136
|
+
├── traces/ # Audit execution traces
|
|
137
|
+
└── scorecards/ # scorecard.yaml eval rubrics
|
|
131
138
|
```
|
|
132
139
|
|
|
133
|
-
###
|
|
134
|
-
|
|
140
|
+
### 2. Standard Coding Workspaces (Next.js / React / Node)
|
|
141
|
+
*Activated when developing software applications or UI components.*
|
|
142
|
+
```text
|
|
143
|
+
project.yaml # ⭐ V8.2 Workspace Manifest
|
|
135
144
|
src/
|
|
136
|
-
├──
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
└── main.ts
|
|
145
|
+
├── app/ # Pages or App Router
|
|
146
|
+
├── components/ # Shared UI components & Design system primitives
|
|
147
|
+
├── hooks/
|
|
148
|
+
├── lib/
|
|
149
|
+
├── services/ # API integration & State stores
|
|
150
|
+
├── types/
|
|
151
|
+
└── styles/
|
|
152
|
+
DESIGN.md # Brand & Design Contract
|
|
145
153
|
```
|
|
146
154
|
|
|
147
|
-
###
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
├── services/
|
|
155
|
-
├── stores/ # State management
|
|
156
|
-
└── types/
|
|
155
|
+
### 3. Automation Workflows (n8n & Data ETL)
|
|
156
|
+
```text
|
|
157
|
+
project.yaml # ⭐ V8.2 Workspace Manifest
|
|
158
|
+
workflows/ # Automation graphs & JSON blueprints
|
|
159
|
+
connectors/ # API & Database integrations
|
|
160
|
+
pipelines/ # Transformation scripts
|
|
161
|
+
evals/ # Traceability logs
|
|
157
162
|
```
|
|
158
163
|
|
|
159
164
|
---
|
|
160
165
|
|
|
161
166
|
## Required Files Checklist
|
|
162
167
|
```
|
|
163
|
-
[ ]
|
|
164
|
-
[ ]
|
|
165
|
-
[ ] .
|
|
166
|
-
[ ] .prettierrc — formatting
|
|
168
|
+
[ ] project.yaml — V8.2 Machine-readable Workspace Manifest
|
|
169
|
+
[ ] package.json / pyproject.toml — dependencies and scripts
|
|
170
|
+
[ ] tsconfig.json — strict mode enabled (if TypeScript)
|
|
171
|
+
[ ] .eslintrc / .prettierrc — project standard linting and formatting
|
|
167
172
|
[ ] .gitignore — standard entries
|
|
168
173
|
[ ] README.md — project description + setup instructions
|
|
169
174
|
[ ] DESIGN.md — (UI projects) brand contract with color/font/spacing tokens
|
|
170
|
-
[ ] .
|
|
175
|
+
[ ] evals/scorecard.yaml — (AI/RAG/Workflow projects) eval standard
|
|
171
176
|
```
|
|
172
|
-
|
|
173
|
-
---
|
|
177
|
+
-----
|
|
174
178
|
|
|
175
179
|
## DESIGN.md Minimum Template
|
|
176
180
|
```markdown
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
# ── Identity ───────────────────────────────────────────────
|
|
3
3
|
name: qk-validation-gate
|
|
4
|
-
version: 8.
|
|
4
|
+
version: 8.2.0
|
|
5
5
|
status: stable
|
|
6
|
-
description: "Cổng kiểm tra chất lượng bắt buộc
|
|
6
|
+
description: "Cổng kiểm tra chất lượng & Eval Pipeline bắt buộc — chạy linters, tests, và đánh giá scorecard.yaml định lượng cho AI Agent."
|
|
7
7
|
platforms: [antigravity, claude-code, cursor, windsurf, kilo-code]
|
|
8
8
|
|
|
9
9
|
# ── V8: Classification ─────────────────────────────────────
|
|
@@ -101,15 +101,17 @@ runtime_version: 1
|
|
|
101
101
|
schema_version: 2
|
|
102
102
|
---
|
|
103
103
|
|
|
104
|
-
## Scope
|
|
105
|
-
- ✅ Run lint, type-check, tests, security audit in sequence
|
|
106
|
-
- ✅
|
|
107
|
-
- ✅
|
|
104
|
+
## Scope & V8.2 Eval Pipeline
|
|
105
|
+
- ✅ Run lint, type-check, tests, and security audit in sequence
|
|
106
|
+
- ✅ **Execute V8.2 Eval Pipeline:** Read `scorecard.yaml` (or inherited schemas) and compute quantitative scores for AI/Agent outputs.
|
|
107
|
+
- ✅ Enforce pass/fail with concrete thresholds (Code coverage >= 80%, Eval scorecard >= passing threshold, typically 80/100).
|
|
108
|
+
- ✅ Validate Trace execution logs in `evals/traces/` to ensure zero hallucination and ground-truth compliance.
|
|
109
|
+
- ✅ Report results with structured Evidence Format.
|
|
108
110
|
|
|
109
111
|
## Non-Goals
|
|
110
112
|
- ❌ Fix failing tests or lint errors (fixes go to qk-bug-resolution)
|
|
111
|
-
- ❌ Skip any gate check unless user explicitly allows
|
|
112
|
-
- ❌ Override failing thresholds with "ignore" flags
|
|
113
|
+
- ❌ Skip any gate check or eval scorecard unless user explicitly allows
|
|
114
|
+
- ❌ Override failing thresholds with "ignore" flags or fabricated LLM scores without trace evidence
|
|
113
115
|
|
|
114
116
|
skill_version: 7.5.0
|
|
115
117
|
runtime_version: 1
|
|
@@ -140,6 +142,11 @@ build:
|
|
|
140
142
|
must_succeed: true
|
|
141
143
|
max_warnings: 5
|
|
142
144
|
bundle_size_limit: 500KB # Gzipped (if applicable)
|
|
145
|
+
|
|
146
|
+
eval_scorecard:
|
|
147
|
+
default_passing_threshold: 80 # minimum weighted evaluation score
|
|
148
|
+
trace_verification_required: true # must log tool executions in evals/traces
|
|
149
|
+
zero_tolerance_hallucination: true
|
|
143
150
|
```
|
|
144
151
|
|
|
145
152
|
skill_version: 7.5.0
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [8.2.1] — 2026-07 — Token Optimization Patch
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **`stop_early: false` → `true` in 13 skills**: `qk-code-review`, `qk-data-lifecycle`, `qk-design-system-engineering`, `qk-devops-platform`, `qk-feature-delivery`, `qk-frontend-architecture`, `qk-production-release`, `qk-product-specification`, `qk-project-bootstrap`, `qk-security-audit`, `qk-system-evolution`, `qk-test-engineering`, `qk-ui-builder`, `qk-web-quality-gate` — skills now self-terminate when token budget is exhausted instead of running indefinitely.
|
|
12
|
+
- **Removed 20 duplicate metadata blocks**: Stripped repeated `skill_version/runtime_version/schema_version` YAML blocks from `qk-orchestrator` (11×) and `qk-context-loader` (9×) — saves ~1320 chars per context load.
|
|
13
|
+
- **`qk-code-review` Dynamic Context Loading: mandatory → on-demand**: References are now only read when a specific issue is found, not before every review. Eliminates 2 forced `view_file` calls per review session.
|
|
14
|
+
- **`qk-feature-delivery` FAST PATH**: Simple tasks (≤1 file, no new API, no DB migration) now bypass `qk-context-loader` and Phase 1 clarification — saves 2–3 turns per simple fix.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## [8.2.0] — 2026-07 — EDAOS v8.2: Governed Capability Metadata & Eval Platform
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **Manifest-First Architecture & Registry Engine**: Created `tooling/build-registry.js` (`npm run build:registry`) generating lightweight lookup index `.agents/registry/index.yaml` and O(1) runtime adjacency graph `.agents/registry/graph.json` with cycle/orphan detection.
|
|
22
|
+
- **V8.2 Blueprint Plugins**: Introduced customizable project scaffolding templates under `.agents/blueprints/` (`rag`, `coding`, `workflow`) featuring multi-profile environments (`development`, `production`, `testing`) and feature flags.
|
|
23
|
+
- **Governed Capability Manifests**: Created minimalist `.agents/skills/_template/capability.yaml` (`schema_version: 1`) to decouple execution metadata from natural language instructions.
|
|
24
|
+
- **Eval Pipeline Platform**: Added quantitative verification frameworks via inheritance-ready `.agents/skills/_template/evals/scorecard.yaml` (`extends: default`), linking ground-truth execution traces with automated score rubrics.
|
|
25
|
+
- **Domain Patterns Reference Architecture**: Added reference blueprint for Enterprise Domain AI at `.agents/knowledge/domain-patterns/construction/ddc-construction-ai-blueprint.md` (Construction AI, DDC 192 domain skills, QTO IFC bóc tách, n8n automation workflows) showcasing zero interference with core developer capabilities.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- **`qk-project-bootstrap` Evolution (v8.2.0)**: Upgraded to support One-Click Blueprint selection, automated `project.yaml` generation, and the Universal 4-Folder RAG Architecture (`prompts/`, `data/`, `agents/`, `evals/`).
|
|
29
|
+
- **`qk-validation-gate` Evolution (v8.2.0)**: Integrated automated Eval Pipeline validation, reading `scorecard.yaml` rubrics, verifying trace logs in `evals/traces/`, and enforcing quantitative pass thresholds.
|
|
30
|
+
- **`qk-ai-builder` Evolution (v8.2.0)**: Upgraded to Manifest-first capability packaging and strict 4-folder data discipline (immutable `data/raw/` vs cleaned `data/processed/`).
|
|
31
|
+
- Updated system core description in `package.json` to reflect the EDAOS v8.2 paradigm shift.
|
|
32
|
+
- Synced `.agents/CHANGELOG.md` and `.agents/README.md` with root documentation.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
8
36
|
## [8.1.7] — 2026-07 — README Sync
|
|
9
37
|
|
|
10
38
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
# 🚀 AI Developer Skill OS (ai-developer-skill-os) v8.
|
|
1
|
+
# 🚀 AI Developer Skill OS (ai-developer-skill-os) v8.2.0
|
|
2
2
|
|
|
3
|
-
> **v8.
|
|
3
|
+
> **v8.2.0 "EDAOS v8.2 — Governed Capability Metadata & Eval Platform"**
|
|
4
4
|
|
|
5
|
-
Hệ sinh thái AI Developer Skill OS
|
|
5
|
+
Hệ sinh thái AI Developer Skill OS tiến hóa lên phiên bản **V8.2.0 (EDAOS v8.2)** với kiến trúc **Manifest-First & Eval Platform**, giúp giảm tối đa chi phí nhận thức (cognitive load) cho các AI Agent thế hệ mới (như Antigravity) nhờ chỉ định ranh giới định lượng, đồ thị phụ thuộc O(1), và các Blueprint Plugins quy chuẩn cho từng ngành nghề kỹ thuật.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
## 🏗️
|
|
9
|
+
## 🏗️ 4 Trụ Cột Kiến Trúc Cốt Lõi (EDAOS v8.2 Architecture)
|
|
10
10
|
|
|
11
|
-
### 1.
|
|
12
|
-
Không còn
|
|
11
|
+
### 1. Manifest-First & O(1) Registry Engine
|
|
12
|
+
Không còn phụ thuộc vào việc đọc/scan toàn bộ markdown mệt mỏi. AI Agent tra cứu siêu dữ liệu từ `.agents/registry/index.yaml` và kiểm duyệt chu trình không lặp (acyclic validation) thông qua O(1) graph JSON (`.agents/registry/graph.json`). Tốc độ hiểu và phân công năng lực đạt ngưỡng sub-second!
|
|
13
13
|
|
|
14
|
-
### 2.
|
|
15
|
-
|
|
14
|
+
### 2. V8.2 Blueprint Plugins & Universal 4-Folder Architecture
|
|
15
|
+
Khởi tạo dự án (chỉ đạo qua `qk-project-bootstrap`) hỗ trợ sinh file `project.yaml` gốc từ thư viện Blueprint Plugins:
|
|
16
|
+
- **RAG / AI Agents:** Cấu trúc 4 thư mục chuẩn thực chiến: `prompts/`, `data/` (bảo vệ `data/raw` bất biến), `agents/`, và `evals/`.
|
|
17
|
+
- **Standard Software Coding:** Kiến trúc module sạch vững chắc với `DESIGN.md` và rào cản kiểm duyệt tự động.
|
|
18
|
+
- **Automation Workflows:** Các luồng tích hợp n8n và dữ liệu lớn.
|
|
16
19
|
|
|
17
|
-
### 3.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
### 3. Eval Pipeline Platform (Khép Kín Kiểm Định)
|
|
21
|
+
Chấm dứt việc tin tưởng AI blindly. Mọi Capability đều có thẻ điểm định lượng (`scorecard.yaml`), kết nối log thực thi thực tế từ thư mục `evals/traces/` qua cổng thẩm định sắt đá `qk-validation-gate`. Trách nhiệm định lượng 0–100 với sai số 0% (zero tolerance for fabrication).
|
|
22
|
+
|
|
23
|
+
### 4. Domain Patterns Separation (Bảo Vệ Kernel)
|
|
24
|
+
Các hệ thống AI chuyên sâu (như **Xây dựng DDC 192 skills**, bóc tách BIM/IFC, ERP) được tải lập trình viên cấu hình dạng Module dưới `knowledge/domain-patterns/` thay vì phơi bày trực tiếp vào 30 Core Developer Skills, giữ cho đồ thị cốt lõi luôn nhanh bén mượt mà!
|
|
21
25
|
|
|
22
26
|
---
|
|
23
27
|
|
|
24
|
-
## 🧩 Danh sách 30 Master Skills
|
|
28
|
+
## 🧩 Danh sách 30 Master Skills (Core Developer Capabilities)
|
|
25
29
|
|
|
26
30
|
Các kỹ năng được quản lý bằng **Capability Graph** và được đánh giá liên tục thông qua Evaluation Suite. Bao gồm 7 lĩnh vực:
|
|
27
31
|
1. **Core & Orchestration:** `qk-orchestrator`, `qk-context-loader`, `qk-project-memory`, `qk-help`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-developer-skill-os",
|
|
3
|
-
"version": "8.1
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "8.2.1",
|
|
4
|
+
"description": "EDAOS v8.2 — Governed Capability Metadata & Eval Platform: Blueprints organize, manifests govern, registries accelerate.",
|
|
5
5
|
"main": "bin/install.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"bin",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"node": ">=18.0.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
+
"build:registry": "node tooling/build-registry.js",
|
|
23
24
|
"test": "vitest run",
|
|
24
25
|
"test:watch": "vitest",
|
|
25
|
-
"test:registry": "vitest run
|
|
26
|
+
"test:registry": "vitest run && node tooling/build-registry.js",
|
|
26
27
|
"test:graph": "node tooling/validate-graph.js",
|
|
27
28
|
"lint": "node bin/lint.js",
|
|
28
29
|
"test:agent": "node tests/agent-evaluation/runner/evaluate-routing.js",
|
|
@@ -49,7 +50,11 @@
|
|
|
49
50
|
"developer",
|
|
50
51
|
"agent",
|
|
51
52
|
"prompts",
|
|
52
|
-
"framework"
|
|
53
|
+
"framework",
|
|
54
|
+
"edaos",
|
|
55
|
+
"manifest",
|
|
56
|
+
"registry",
|
|
57
|
+
"eval"
|
|
53
58
|
],
|
|
54
59
|
"author": "Quang Khánh",
|
|
55
60
|
"license": "MIT",
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* build-registry.js
|
|
3
|
+
* V8.2 Governed Capability Metadata & Eval Platform
|
|
4
|
+
* Generates registry/index.yaml (lightweight lookup) and registry/graph.json (O(1) graph & cycle check)
|
|
5
|
+
*
|
|
6
|
+
* Usage: node tooling/build-registry.js
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import yaml from 'js-yaml';
|
|
13
|
+
|
|
14
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
|
|
16
|
+
const SKILLS_DIR = path.join(__dirname, '../.agents/skills');
|
|
17
|
+
const REGISTRY_DIR = path.join(__dirname, '../.agents/registry');
|
|
18
|
+
const INDEX_YAML = path.join(REGISTRY_DIR, 'index.yaml');
|
|
19
|
+
const GRAPH_JSON = path.join(REGISTRY_DIR, 'graph.json');
|
|
20
|
+
|
|
21
|
+
function parseYamlFile(filePath) {
|
|
22
|
+
try {
|
|
23
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
24
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
25
|
+
if (match) {
|
|
26
|
+
return yaml.load(match[1]);
|
|
27
|
+
}
|
|
28
|
+
return yaml.load(content);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.error(`[WARN] Failed to parse YAML from ${filePath}: ${e.message}`);
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function buildRegistry() {
|
|
36
|
+
console.log('🔄 Building V8.2 Governed Capability Registry & O(1) Runtime Graph...');
|
|
37
|
+
|
|
38
|
+
if (!fs.existsSync(SKILLS_DIR)) {
|
|
39
|
+
console.error('❌ Skills directory not found:', SKILLS_DIR);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fs.mkdirSync(REGISTRY_DIR, { recursive: true });
|
|
44
|
+
|
|
45
|
+
const dirs = fs.readdirSync(SKILLS_DIR).filter(d =>
|
|
46
|
+
!d.startsWith('_') && fs.statSync(path.join(SKILLS_DIR, d)).isDirectory()
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const capabilities = {};
|
|
50
|
+
const adjacency = {};
|
|
51
|
+
const reverseAdjacency = {};
|
|
52
|
+
|
|
53
|
+
for (const dir of dirs) {
|
|
54
|
+
const capYamlPath = path.join(SKILLS_DIR, dir, 'capability.yaml');
|
|
55
|
+
const skillMdPath = path.join(SKILLS_DIR, dir, 'SKILL.md');
|
|
56
|
+
|
|
57
|
+
let meta = null;
|
|
58
|
+
let fromCapabilityYaml = false;
|
|
59
|
+
|
|
60
|
+
if (fs.existsSync(capYamlPath)) {
|
|
61
|
+
meta = parseYamlFile(capYamlPath);
|
|
62
|
+
fromCapabilityYaml = true;
|
|
63
|
+
} else if (fs.existsSync(skillMdPath)) {
|
|
64
|
+
meta = parseYamlFile(skillMdPath);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!meta) continue;
|
|
68
|
+
|
|
69
|
+
const id = meta.id || meta.name || dir;
|
|
70
|
+
const version = meta.version || '8.2.0';
|
|
71
|
+
const description = meta.description || '';
|
|
72
|
+
|
|
73
|
+
// Normalize tags
|
|
74
|
+
let tags = meta.tags || meta.keywords || [];
|
|
75
|
+
if (!Array.isArray(tags) || tags.length === 0) {
|
|
76
|
+
// Derive simple tags from dir words
|
|
77
|
+
tags = dir.replace(/^qk-/, '').split('-');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Normalize dependencies
|
|
81
|
+
let dependencies = meta.dependencies || [];
|
|
82
|
+
if (!fromCapabilityYaml) {
|
|
83
|
+
// Derive from V8.1 skill frontmatter decision_boundary / workflow
|
|
84
|
+
const deps = new Set();
|
|
85
|
+
if (meta.workflow && typeof meta.workflow === 'string') deps.add(meta.workflow);
|
|
86
|
+
if (meta.decision_boundary?.delegates_to) {
|
|
87
|
+
meta.decision_boundary.delegates_to.forEach(d => deps.add(d));
|
|
88
|
+
}
|
|
89
|
+
dependencies = Array.from(deps);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
capabilities[id] = {
|
|
93
|
+
path: `.agents/skills/${dir}`,
|
|
94
|
+
version,
|
|
95
|
+
tags,
|
|
96
|
+
dependencies
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
adjacency[id] = dependencies;
|
|
100
|
+
if (!reverseAdjacency[id]) reverseAdjacency[id] = [];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Populate reverse adjacency for orphan detection
|
|
104
|
+
for (const [id, deps] of Object.entries(adjacency)) {
|
|
105
|
+
for (const dep of deps) {
|
|
106
|
+
if (!reverseAdjacency[dep]) reverseAdjacency[dep] = [];
|
|
107
|
+
reverseAdjacency[dep].push(id);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Detect cycles using DFS
|
|
112
|
+
let hasCycles = false;
|
|
113
|
+
const visited = {};
|
|
114
|
+
const recursionStack = {};
|
|
115
|
+
|
|
116
|
+
function detectCycle(node) {
|
|
117
|
+
visited[node] = true;
|
|
118
|
+
recursionStack[node] = true;
|
|
119
|
+
|
|
120
|
+
const deps = adjacency[node] || [];
|
|
121
|
+
for (const dep of deps) {
|
|
122
|
+
if (!visited[dep]) {
|
|
123
|
+
if (detectCycle(dep)) return true;
|
|
124
|
+
} else if (recursionStack[dep]) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
recursionStack[node] = false;
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
for (const node of Object.keys(adjacency)) {
|
|
134
|
+
if (!visited[node]) {
|
|
135
|
+
if (detectCycle(node)) {
|
|
136
|
+
hasCycles = true;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Build Graph JSON (O(1) Runtime lookups)
|
|
143
|
+
const graphNodes = {};
|
|
144
|
+
for (const [id, data] of Object.entries(capabilities)) {
|
|
145
|
+
const dependents = reverseAdjacency[id] || [];
|
|
146
|
+
const isOrphan = data.dependencies.length === 0 && dependents.length === 0 && id !== 'qk-orchestrator' && id !== 'qk-help';
|
|
147
|
+
|
|
148
|
+
graphNodes[id] = {
|
|
149
|
+
path: data.path,
|
|
150
|
+
version: data.version,
|
|
151
|
+
tags: data.tags,
|
|
152
|
+
dependencies: data.dependencies,
|
|
153
|
+
dependents,
|
|
154
|
+
is_orphan: isOrphan
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const graphJsonData = {
|
|
159
|
+
schema_version: 1,
|
|
160
|
+
manifest_version: '8.2',
|
|
161
|
+
generated_at: new Date().toISOString(),
|
|
162
|
+
nodes: graphNodes,
|
|
163
|
+
adjacency,
|
|
164
|
+
stats: {
|
|
165
|
+
total_capabilities: Object.keys(capabilities).length,
|
|
166
|
+
has_cycles: hasCycles
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// Build Registry Index YAML (Lightweight lookup)
|
|
171
|
+
const indexYamlContent = `# AUTO-GENERATED BY registry-builder (tooling/build-registry.js)\n# DO NOT EDIT MANUALLY. THIS IS A GENERATED RUNTIME ARTIFACT.\n` +
|
|
172
|
+
yaml.dump({
|
|
173
|
+
schema_version: 1,
|
|
174
|
+
manifest_version: '8.2',
|
|
175
|
+
generated_at: new Date().toISOString(),
|
|
176
|
+
capabilities
|
|
177
|
+
}, { indent: 2 });
|
|
178
|
+
|
|
179
|
+
fs.writeFileSync(INDEX_YAML, indexYamlContent, 'utf8');
|
|
180
|
+
fs.writeFileSync(GRAPH_JSON, JSON.stringify(graphJsonData, null, 2), 'utf8');
|
|
181
|
+
|
|
182
|
+
console.log(`✅ Generated lightweight registry index at .agents/registry/index.yaml (${Object.keys(capabilities).length} capabilities)`);
|
|
183
|
+
console.log(`✅ Generated O(1) adjacency graph at .agents/registry/graph.json (has_cycles: ${hasCycles})`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
buildRegistry();
|