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.
Files changed (33) hide show
  1. package/.agents/CHANGELOG.md +18 -0
  2. package/.agents/README.md +17 -13
  3. package/.agents/blueprints/coding/project.yaml.tpl +39 -0
  4. package/.agents/blueprints/rag/project.yaml.tpl +45 -0
  5. package/.agents/blueprints/workflow/project.yaml.tpl +38 -0
  6. package/.agents/knowledge/domain-patterns/construction/ddc-construction-ai-blueprint.md +103 -0
  7. package/.agents/registry/graph.json +526 -0
  8. package/.agents/registry/index.yaml +259 -0
  9. package/.agents/skills/_template/capability.yaml +20 -0
  10. package/.agents/skills/_template/evals/scorecard.yaml +19 -0
  11. package/.agents/skills/qk-agent-observability/SKILL.md +11 -0
  12. package/.agents/skills/qk-ai-builder/SKILL.md +13 -10
  13. package/.agents/skills/qk-code-review/SKILL.md +6 -9
  14. package/.agents/skills/qk-context-loader/SKILL.md +0 -36
  15. package/.agents/skills/qk-data-lifecycle/SKILL.md +1 -1
  16. package/.agents/skills/qk-design-system-engineering/SKILL.md +1 -1
  17. package/.agents/skills/qk-devops-platform/SKILL.md +1 -1
  18. package/.agents/skills/qk-feature-delivery/SKILL.md +21 -1
  19. package/.agents/skills/qk-frontend-architecture/SKILL.md +1 -1
  20. package/.agents/skills/qk-orchestrator/SKILL.md +0 -44
  21. package/.agents/skills/qk-product-specification/SKILL.md +1 -1
  22. package/.agents/skills/qk-production-release/SKILL.md +1 -1
  23. package/.agents/skills/qk-project-bootstrap/SKILL.md +56 -52
  24. package/.agents/skills/qk-security-audit/SKILL.md +1 -1
  25. package/.agents/skills/qk-system-evolution/SKILL.md +1 -1
  26. package/.agents/skills/qk-test-engineering/SKILL.md +1 -1
  27. package/.agents/skills/qk-ui-builder/SKILL.md +1 -1
  28. package/.agents/skills/qk-validation-gate/SKILL.md +15 -8
  29. package/.agents/skills/qk-web-quality-gate/SKILL.md +1 -1
  30. package/CHANGELOG.md +28 -0
  31. package/README.md +17 -13
  32. package/package.json +9 -4
  33. 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.0.0
4
+ version: 8.2.0
5
5
  status: stable
6
- description: "Khởi tạo dự án mới với cấu trúc chuẩn, linters, DESIGN.md không bao giờ thiếu foundation."
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: false
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
- - ✅ Initialize project with standard tooling
105
- - ✅ Generate `DESIGN.md` (mandatory for any UI project)
106
- - ✅ Configure: ESLint, Prettier, TypeScript strict mode
107
- - ✅ Create standard directory structure
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
- ## Standard Directory Structures
117
-
118
- ### Next.js / React
119
- ```
120
- src/
121
- ├── app/ # Pages (App Router) or pages/
122
- ├── components/ # Shared UI components
123
- ├── ui/ # Design system primitives
124
- │ └── [feature]/ # Feature-specific components
125
- ├── hooks/ # Custom React hooks
126
- ├── lib/ # Utilities, helpers
127
- ├── services/ # API service functions
128
- ├── types/ # TypeScript type definitions
129
- └── styles/ # Global CSS + DESIGN.md tokens
130
- DESIGN.md # Brand & Design Contract
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
- ### NestJS / Express API
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
- ├── modules/
137
- │ └── [feature]/
138
- ├── [feature].controller.ts
139
- ├── [feature].service.ts
140
- ├── [feature].repository.ts
141
- │ └── dto/
142
- ├── common/ # Shared utilities, guards, interceptors
143
- ├── config/ # Environment configuration
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
- ### Vite + React
148
- ```
149
- src/
150
- ├── assets/
151
- ├── components/
152
- ├── pages/
153
- ├── router/
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
- [ ] package.jsonwith lint + test + build scripts
164
- [ ] tsconfig.json — strict: true enabled
165
- [ ] .eslintrc / eslint.config.js project standard
166
- [ ] .prettierrc — formatting config
168
+ [ ] project.yamlV8.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
- [ ] .env.exampleall env vars listed (no actual values)
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
@@ -114,7 +114,7 @@ token_budget:
114
114
  max_files_read: 10
115
115
  max_lines_per_read: 150
116
116
  max_shell_commands: 2
117
- stop_early: false
117
+ stop_early: true
118
118
 
119
119
  exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
120
120
  ---
@@ -76,7 +76,7 @@ token_budget:
76
76
  max_files_read: 4
77
77
  max_lines_per_read: 100
78
78
  max_shell_commands: 2
79
- stop_early: false
79
+ stop_early: true
80
80
 
81
81
  exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
82
82
  ---
@@ -119,7 +119,7 @@ token_budget:
119
119
  max_files_read: 5
120
120
  max_lines_per_read: 150
121
121
  max_shell_commands: 0
122
- stop_early: false
122
+ stop_early: true
123
123
 
124
124
  exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
125
125
  ---
@@ -83,7 +83,7 @@ token_budget:
83
83
  max_files_read: 5
84
84
  max_lines_per_read: 150
85
85
  max_shell_commands: 0
86
- stop_early: false
86
+ stop_early: true
87
87
 
88
88
  exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
89
89
  ---
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  # ── Identity ───────────────────────────────────────────────
3
3
  name: qk-validation-gate
4
- version: 8.0.0
4
+ version: 8.2.0
5
5
  status: stable
6
- description: "Cổng kiểm tra chất lượng bắt buộc với ngưỡng pass/fail cụ thể chặn đứng mọi nguồn lỗi."
6
+ description: "Cổng kiểm tra chất lượng & Eval Pipeline bắt buộc chạy linters, tests, đá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
- - ✅ Enforce pass/fail with concrete thresholds
107
- - ✅ Report results with structured Evidence Format
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
@@ -94,7 +94,7 @@ token_budget:
94
94
  max_files_read: 5
95
95
  max_lines_per_read: 150
96
96
  max_shell_commands: 2
97
- stop_early: false
97
+ stop_early: true
98
98
 
99
99
  exit_codes: [SUCCESS, BLOCKED, FAILED, PARTIAL]
100
100
  ---
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.7
1
+ # 🚀 AI Developer Skill OS (ai-developer-skill-os) v8.2.0
2
2
 
3
- > **v8.1.7 "Agent Engineering OS + Design Intelligence"**
3
+ > **v8.2.0 "EDAOS v8.2 Governed Capability Metadata & Eval Platform"**
4
4
 
5
- Hệ sinh thái AI Developer Skill OS đã lột xác hoàn toàn. Từ một bộ "công cụ phân tán" (Toolbox) V7, phiên bản V8.1.7 được thiết kế như một **Hệ điều hành khép kín (Agent Engineering OS)**, sở hữu năng lực giám sát, bảo vệ ranh giới quyết định (Decision Boundaries) và được trang bị thêm tầng **Design Intelligence**.
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),các Blueprint Plugins quy chuẩn cho từng ngành nghề kỹ thuật.
6
6
 
7
7
  ---
8
8
 
9
- ## 🏗️ Triết Hoạt Động Cốt Lõi (V8 Kernel)
9
+ ## 🏗️ 4 Trụ Cột Kiến Trúc Cốt Lõi (EDAOS v8.2 Architecture)
10
10
 
11
- ### 1. Decision Boundary (Ranh giới Thẩm quyền)
12
- Không còn tình trạng một Skill ôm đồm mọi việc. Mọi Skill (Kỹ năng) hiện tại bị quản bởi các trường `owns`, `does_not_own`, `conflicts_with`, `delegates_to`. Thợ code UI (`qk-ui-builder`) không được phép tự ra quyết định kiến trúc, ngược lại.
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` 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 phân công năng lực đạt ngưỡng sub-second!
13
13
 
14
- ### 2. Design Intelligence Layer
15
- Khắc phục điểm yếu "mù thẩm mỹ" của AI. Agent giờ đây không chỉ biết code còn Gu Thẩm Mỹ (Design Taste). Dựa trên yêu cầu của bạn, hệ thống tự động tra cứu **Knowledge Graph** để chọn đúng Theme (Fintech, Healthcare, SaaS...), Typography và Visual Patterns trước khi giao việc cho UI Builder.
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. Khế Ước Đi Đầu (Contract-First & Zero-Trust)
18
- - **Frontend / UI**: Mọi sửa đổi phải tuân thủ Design System (được `qk-design-system-engineering` kiểm duyệt).
19
- - **Backend / API**: Phải viết OpenAPI/Swagger contract trước (`qk-api-lifecycle`).
20
- - **Data**: Cấm AI tự đoán cấu trúc DB, mọi truy vấn phải có Schema (`qk-data-lifecycle`).
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 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.10",
4
- "description": "Agent Engineering OS: A deterministic capability graph, governance rules, and dynamic knowledge base for AI coding agents.",
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 --config vitest.config.js",
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();