@agentlee5/agent-skills 1.0.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/.leeway/config.json +133 -0
- package/LICENSE +21 -0
- package/LeeWay-Standards/LICENSE +21 -0
- package/LeeWay-Standards/README.md +324 -0
- package/LeeWay-Standards/examples/NexusButton.tsx +90 -0
- package/LeeWay-Standards/examples/example-agent.js +89 -0
- package/LeeWay-Standards/package.json +61 -0
- package/LeeWay-Standards/schemas/leeway-config.schema.json +81 -0
- package/LeeWay-Standards/schemas/leeway-header.schema.json +63 -0
- package/LeeWay-Standards/src/agents/discovery/architecture-map-agent.js +134 -0
- package/LeeWay-Standards/src/agents/discovery/docs-agent.js +126 -0
- package/LeeWay-Standards/src/agents/discovery/explain-agent.js +95 -0
- package/LeeWay-Standards/src/agents/discovery/intent-registry-agent.js +119 -0
- package/LeeWay-Standards/src/agents/discovery/schema-agent.js +116 -0
- package/LeeWay-Standards/src/agents/discovery/sitemap-agent.js +88 -0
- package/LeeWay-Standards/src/agents/governance/align-agent.js +155 -0
- package/LeeWay-Standards/src/agents/governance/assess-agent.js +161 -0
- package/LeeWay-Standards/src/agents/governance/audit-agent.js +185 -0
- package/LeeWay-Standards/src/agents/integrity/circular-dependency-agent.js +88 -0
- package/LeeWay-Standards/src/agents/integrity/dependency-graph-agent.js +107 -0
- package/LeeWay-Standards/src/agents/integrity/duplicate-logic-agent.js +108 -0
- package/LeeWay-Standards/src/agents/integrity/import-agent.js +83 -0
- package/LeeWay-Standards/src/agents/integrity/module-policy-agent.js +94 -0
- package/LeeWay-Standards/src/agents/integrity/refactor-scan-agent.js +113 -0
- package/LeeWay-Standards/src/agents/integrity/syntax-agent.js +84 -0
- package/LeeWay-Standards/src/agents/mcp/endpoint-agent.js +106 -0
- package/LeeWay-Standards/src/agents/mcp/env-agent.js +111 -0
- package/LeeWay-Standards/src/agents/mcp/health-agent-lite.js +119 -0
- package/LeeWay-Standards/src/agents/mcp/manifest-agent.js +87 -0
- package/LeeWay-Standards/src/agents/mcp/port-agent.js +125 -0
- package/LeeWay-Standards/src/agents/mcp/process-agent.js +124 -0
- package/LeeWay-Standards/src/agents/mcp/runtime-agent.js +108 -0
- package/LeeWay-Standards/src/agents/mcp/transport-agent.js +78 -0
- package/LeeWay-Standards/src/agents/orchestration/doctor-agent.js +149 -0
- package/LeeWay-Standards/src/agents/orchestration/memory-agent-lite.js +125 -0
- package/LeeWay-Standards/src/agents/orchestration/router-agent.js +110 -0
- package/LeeWay-Standards/src/agents/security/permission-agent.js +98 -0
- package/LeeWay-Standards/src/agents/security/policy-agent.js +100 -0
- package/LeeWay-Standards/src/agents/security/privacy-agent.js +83 -0
- package/LeeWay-Standards/src/agents/security/prompt-security-agent.js +103 -0
- package/LeeWay-Standards/src/agents/security/secret-scan-agent.js +108 -0
- package/LeeWay-Standards/src/agents/security/tool-access-agent.js +105 -0
- package/LeeWay-Standards/src/agents/standards/authority-agent.js +114 -0
- package/LeeWay-Standards/src/agents/standards/discovery-pipeline-agent.js +91 -0
- package/LeeWay-Standards/src/agents/standards/header-agent.js +120 -0
- package/LeeWay-Standards/src/agents/standards/placement-agent.js +96 -0
- package/LeeWay-Standards/src/agents/standards/region-agent.js +99 -0
- package/LeeWay-Standards/src/agents/standards/registry-agent.js +153 -0
- package/LeeWay-Standards/src/agents/standards/tag-agent.js +111 -0
- package/LeeWay-Standards/src/cli/leeway.js +225 -0
- package/LeeWay-Standards/src/core/compliance-scorer.js +168 -0
- package/LeeWay-Standards/src/core/compliance-scorer.test.js +121 -0
- package/LeeWay-Standards/src/core/header-parser.js +207 -0
- package/LeeWay-Standards/src/core/header-parser.test.js +198 -0
- package/LeeWay-Standards/src/core/region-classifier.js +137 -0
- package/LeeWay-Standards/src/core/region-classifier.test.js +100 -0
- package/LeeWay-Standards/src/core/tag-validator.js +139 -0
- package/LeeWay-Standards/src/core/tag-validator.test.js +109 -0
- package/LeeWay-Standards/src/index.js +83 -0
- package/README.md +217 -0
- package/agent-config.yaml +456 -0
- package/agentbage.png.png +0 -0
- package/bin/leeway-skills-badge.js +52 -0
- package/bin/leeway-skills-mcp.js +48 -0
- package/bin/leeway-skills.js +160 -0
- package/bin/leeway-standards.js +49 -0
- package/config/.skillsignore +63 -0
- package/config/skills-config.json +70 -0
- package/documents/AGENT_LEARNING_REFERENCE.md +329 -0
- package/documents/AGENT_LEE_INTEGRATION.md +534 -0
- package/documents/COMPLETE_SYSTEM_OVERVIEW.md +502 -0
- package/documents/COMPREHENSIVE_SKILL_INTEGRATION_PLAN.md +644 -0
- package/documents/DIRECTORY_MAP.md +323 -0
- package/documents/EXTENDING.md +514 -0
- package/documents/FILE_DIRECTORY_GUIDE.md +427 -0
- package/documents/LEEWAY_BADGE_INTEGRATION.md +76 -0
- package/documents/LEEWAY_IMPLEMENTATION_SUMMARY.md +384 -0
- package/documents/LEEWAY_INTEGRATION_GUIDE.md +414 -0
- package/documents/LEEWAY_NPM_SDK.md +66 -0
- package/documents/LEEWAY_QUICK_START.md +288 -0
- package/documents/LEEWAY_SKILLS_BRANDING.md +375 -0
- package/documents/LEEWAY_SKILLS_MCP_SUMMARY.md +593 -0
- package/documents/LEEWAY_STANDARDS_COMPLIANCE.md +361 -0
- package/documents/LEEWAY_UNIFIED_ARCHITECTURE.md +473 -0
- package/documents/LEEWAY_WORKFLOWS_QUICK_REFERENCE.md +307 -0
- package/documents/LEEWAY_WORKFLOWS_STRATEGIC_PLAN.md +515 -0
- package/documents/LIFELONG_LEARNING_LAYER.md +478 -0
- package/documents/MCP_ARCHITECTURE.md +683 -0
- package/documents/QUICK_REFERENCE.md +301 -0
- package/documents/SETUP.md +325 -0
- package/documents/SETUP_SUMMARY.md +413 -0
- package/documents/SKILL_ACQUISITION_EXECUTIVE_SUMMARY.md +373 -0
- package/documents/SKILL_ACQUISITION_IMPLEMENTATION.md +692 -0
- package/documents/SKILL_ACQUISITION_MANIFEST.md +404 -0
- package/documents/SKILL_ACQUISITION_QUICK_REFERENCE.md +349 -0
- package/documents/SKILL_WORKFLOW_COMPOSITION_MATRIX.md +537 -0
- package/documents/STRUCTURE.md +382 -0
- package/documents/SYSTEM_TRANSFORMATION_SUMMARY.md +560 -0
- package/documents/USAGE.md +390 -0
- package/documents/WORKFLOW_ACQUISITION_MANIFEST.md +576 -0
- package/documents/aiskills.txt +460 -0
- package/mcp-server/README.md +697 -0
- package/mcp-server/dist/badge-proof.d.ts +66 -0
- package/mcp-server/dist/badge-proof.d.ts.map +1 -0
- package/mcp-server/dist/badge-proof.js +324 -0
- package/mcp-server/dist/badge-proof.js.map +1 -0
- package/mcp-server/dist/index.d.ts +64 -0
- package/mcp-server/dist/index.d.ts.map +1 -0
- package/mcp-server/dist/index.js +263 -0
- package/mcp-server/dist/index.js.map +1 -0
- package/mcp-server/dist/install-badge-proof.d.ts +3 -0
- package/mcp-server/dist/install-badge-proof.d.ts.map +1 -0
- package/mcp-server/dist/install-badge-proof.js +109 -0
- package/mcp-server/dist/install-badge-proof.js.map +1 -0
- package/mcp-server/package.json +43 -0
- package/mcp-server/src/badge-proof.ts +469 -0
- package/mcp-server/src/index.ts +355 -0
- package/mcp-server/src/install-badge-proof.ts +132 -0
- package/mcp-server/tsconfig.json +22 -0
- package/package.json +84 -0
- package/scripts/init-leeway.js +217 -0
- package/scripts/leeway-agents/compliance-monitor.js +374 -0
- package/scripts/leeway-agents/header-injector.js +321 -0
- package/scripts/skill-integration-toolkit.py +319 -0
- package/scripts/skills-registry.json +1117 -0
- package/scripts/sync-skills.ps1 +275 -0
- package/scripts/verify-leeway-setup.js +249 -0
- package/scripts/workflow-integration-toolkit.py +522 -0
- package/sdk/application-installer.js +92 -0
- package/sdk/index.js +43 -0
- package/sdk/paths.js +167 -0
- package/skills/agent-autonomy/autonomous-conductor/SKILL.md +206 -0
- package/skills/agent-autonomy/full-stack-delivery/SKILL.md +206 -0
- package/skills/agent-orchestration/multi-agent-orchestration/SKILL.md +68 -0
- package/skills/agent-patterns/agent-design-patterns/SKILL.md +70 -0
- package/skills/ai-ml/llm-prompting/SKILL.md +71 -0
- package/skills/ai-ml/ml-model-development/SKILL.md +67 -0
- package/skills/ai-ml/multimodal-systems/SKILL.md +71 -0
- package/skills/ai-ml/retrieval-generation-fine-tuning/SKILL.md +71 -0
- package/skills/architecture/system-design/SKILL.md +67 -0
- package/skills/code-analysis/refactoring/SKILL.md +64 -0
- package/skills/code-analysis/security-vulnerability-scanning/SKILL.md +71 -0
- package/skills/code-analysis/static-analysis/SKILL.md +64 -0
- package/skills/code-generation/full-stack-application/SKILL.md +70 -0
- package/skills/code-generation/microservices-architecture/SKILL.md +71 -0
- package/skills/code-generation/python-codegen/SKILL.md +64 -0
- package/skills/code-generation/typescript-codegen/SKILL.md +64 -0
- package/skills/data-analysis/advanced-analytics/SKILL.md +71 -0
- package/skills/data-analysis/pandas-analysis/SKILL.md +66 -0
- package/skills/database-design/database-design-optimization/SKILL.md +70 -0
- package/skills/debugging/javascript-debugging/SKILL.md +67 -0
- package/skills/debugging/python-debugging/SKILL.md +67 -0
- package/skills/devops/dockerfile-creation/SKILL.md +64 -0
- package/skills/devops/kubernetes-deployment/SKILL.md +65 -0
- package/skills/documentation/api-documentation/SKILL.md +67 -0
- package/skills/error-handling/resilience-patterns/SKILL.md +70 -0
- package/skills/git-workflow/git-collaboration/SKILL.md +67 -0
- package/skills/infrastructure/cicd-pipelines/SKILL.md +70 -0
- package/skills/infrastructure/infrastructure-as-code/SKILL.md +70 -0
- package/skills/observability/monitoring-and-observability/SKILL.md +70 -0
- package/skills/performance-optimization/performance-engineering/SKILL.md +70 -0
- package/skills/prompt-optimization/prompt-engineering-advanced/SKILL.md +70 -0
- package/skills/quality-assurance/deployment-validator/SKILL.md +382 -0
- package/skills/quality-assurance/web-security-sweep/SKILL.md +320 -0
- package/skills/rag-knowledge/rag-systems/SKILL.md +70 -0
- package/skills/research/knowledge-synthesis/SKILL.md +71 -0
- package/skills/security/authentication-authorization/SKILL.md +71 -0
- package/skills/security/code-security/SKILL.md +66 -0
- package/skills/security/secure-architecture/SKILL.md +71 -0
- package/skills/self-optimization/dev-loop-optimizer/SKILL.md +344 -0
- package/skills/self-optimization/memory-learning/SKILL.md +335 -0
- package/skills/self-optimization/runtime-self-profiling/SKILL.md +250 -0
- package/skills/testing/advanced-testing-strategies/SKILL.md +71 -0
- package/skills/testing/integration-testing/SKILL.md +66 -0
- package/skills/testing/load-testing-capacity/SKILL.md +71 -0
- package/skills/testing/unit-testing/SKILL.md +66 -0
- package/skills/tool-integration/custom-tool-creation/SKILL.md +70 -0
- package/skills/web-development/advanced-frontend-patterns/SKILL.md +71 -0
- package/skills/web-development/api-design/SKILL.md +71 -0
- package/skills/web-development/css-styling/SKILL.md +67 -0
- package/skills/web-development/react-development/SKILL.md +79 -0
- package/skills/workflow-composition/workflow-orchestration/SKILL.md +70 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/*
|
|
3
|
+
LEEWAY HEADER — DO NOT REMOVE
|
|
4
|
+
|
|
5
|
+
REGION: AI.SYSTEM.INIT
|
|
6
|
+
TAG: AI.SYSTEM.INIT.LEEWAY_BOOTSTRAP
|
|
7
|
+
|
|
8
|
+
COLOR_ONION_HEX:
|
|
9
|
+
NEON=#39FF14
|
|
10
|
+
FLUO=#0DFF94
|
|
11
|
+
PASTEL=#C7FFD8
|
|
12
|
+
|
|
13
|
+
ICON_ASCII:
|
|
14
|
+
family=lucide
|
|
15
|
+
glyph=boot
|
|
16
|
+
|
|
17
|
+
5WH:
|
|
18
|
+
WHAT = Leeway Standards Bootstrap and Monitoring Initialization
|
|
19
|
+
WHY = Ensures Leeway Skills stays compliant on startup, validates environment, starts monitoring agents
|
|
20
|
+
WHO = Leeway Industries (By Leonard Jerome Lee)
|
|
21
|
+
WHERE = scripts/init-leeway.js
|
|
22
|
+
WHEN = 2026
|
|
23
|
+
HOW = Checks .leeway/config.json, validates all SKILL.md files, starts compliance monitoring
|
|
24
|
+
|
|
25
|
+
AGENTS:
|
|
26
|
+
ENFORCE
|
|
27
|
+
ASSESS
|
|
28
|
+
|
|
29
|
+
LICENSE:
|
|
30
|
+
MIT
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import fs from "fs/promises";
|
|
34
|
+
import path from "path";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Leeway Bootstrap – Initialize compliance monitoring on startup
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
const LEEWAY_CONFIG_PATH = ".leeway/config.json";
|
|
41
|
+
const SKILLS_DIR = "skills";
|
|
42
|
+
|
|
43
|
+
async function main() {
|
|
44
|
+
console.log("\n╔═════════════════════════════════════════════════════╗");
|
|
45
|
+
console.log("║ 🔒 LEEWAY STANDARDS COMPLIANCE BOOTSTRAP ║");
|
|
46
|
+
console.log("╚═════════════════════════════════════════════════════╝\n");
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
// 1. Check Leeway configuration exists
|
|
50
|
+
console.log("✓ Checking Leeway configuration...");
|
|
51
|
+
const config = await loadConfig(LEEWAY_CONFIG_PATH);
|
|
52
|
+
console.log(` → Version: ${config.version}`);
|
|
53
|
+
console.log(` → Project: ${config.project.name}`);
|
|
54
|
+
console.log(` → Minimum Score: ${config.compliance.minimumScore}`);
|
|
55
|
+
|
|
56
|
+
// 2. Validate skills directory
|
|
57
|
+
console.log("\n✓ Scanning skills directory...");
|
|
58
|
+
const skillCount = await countSkills(SKILLS_DIR);
|
|
59
|
+
console.log(
|
|
60
|
+
` → Found ${skillCount.total} skills across ${skillCount.categories} categories`,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// 3. Check for compliance issues
|
|
64
|
+
console.log("\n✓ Pre-flight compliance check...");
|
|
65
|
+
const issues = await quickValidation(SKILLS_DIR);
|
|
66
|
+
|
|
67
|
+
if (issues.noHeaders.length > 0) {
|
|
68
|
+
console.warn(
|
|
69
|
+
` ⚠ ${issues.noHeaders.length} skills missing Leeway headers`,
|
|
70
|
+
);
|
|
71
|
+
console.warn(" → Run: node scripts/leeway-agents/header-injector.js");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (issues.noMetadata.length > 0) {
|
|
75
|
+
console.warn(
|
|
76
|
+
` ⚠ ${issues.noMetadata.length} skills with incomplete metadata`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 4. Initialize monitoring
|
|
81
|
+
console.log("\n✓ Starting compliance monitoring...");
|
|
82
|
+
console.log(
|
|
83
|
+
` → Monitor interval: ${config.agents["compliance-monitor"].interval / 1000}s`,
|
|
84
|
+
);
|
|
85
|
+
console.log(
|
|
86
|
+
` → Reports directory: ${config.agents["compliance-monitor"].reportDir}`,
|
|
87
|
+
);
|
|
88
|
+
console.log(
|
|
89
|
+
` → Enforced policies: ${config.compliance.enforcedPolicies.join(", ")}`,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// 5. Status summary
|
|
93
|
+
console.log("\n╔═════════════════════════════════════════════════════╗");
|
|
94
|
+
console.log("║ LEEWAY STATUS ║");
|
|
95
|
+
console.log("├─────────────────────────────────────────────────────┤");
|
|
96
|
+
console.log(`│ Configuration: ✅ LOADED │`);
|
|
97
|
+
console.log(
|
|
98
|
+
`│ Skills: ✅ ${skillCount.total.toString().padEnd(3)} FOUND │`,
|
|
99
|
+
);
|
|
100
|
+
console.log(`│ Monitoring: ✅ ACTIVE │`);
|
|
101
|
+
console.log(
|
|
102
|
+
`│ Minimum Compliance: ✅ ${config.compliance.minimumScore}/100 │`,
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
if (issues.severity === "low") {
|
|
106
|
+
console.log(`│ Current Issues: ⚠ LOW │`);
|
|
107
|
+
} else if (issues.severity === "none") {
|
|
108
|
+
console.log(`│ Current Issues: ✅ NONE │`);
|
|
109
|
+
} else {
|
|
110
|
+
console.log(`│ Current Issues: ❌ HIGH │`);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.log("╚═════════════════════════════════════════════════════╝\n");
|
|
114
|
+
|
|
115
|
+
// 6. Next steps
|
|
116
|
+
console.log("📌 Next Steps:");
|
|
117
|
+
console.log(
|
|
118
|
+
" 1. Run compliance audit: node scripts/leeway-agents/compliance-monitor.js",
|
|
119
|
+
);
|
|
120
|
+
console.log(
|
|
121
|
+
" 2. Fix any issues: node scripts/leeway-agents/header-injector.js",
|
|
122
|
+
);
|
|
123
|
+
console.log(
|
|
124
|
+
" 3. Check docs: documents/LEEWAY_STANDARDS_COMPLIANCE.md",
|
|
125
|
+
);
|
|
126
|
+
console.log("\n✨ Leeway Standards monitoring is now ACTIVE\n");
|
|
127
|
+
} catch (error) {
|
|
128
|
+
console.error(`\n❌ Bootstrap failed: ${error.message}\n`);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async function loadConfig(configPath) {
|
|
134
|
+
try {
|
|
135
|
+
const content = await fs.readFile(configPath, "utf-8");
|
|
136
|
+
return JSON.parse(content);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`Cannot load Leeway config at ${configPath}: ${error.message}`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function countSkills(dir) {
|
|
145
|
+
let total = 0;
|
|
146
|
+
let categories = 0;
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
150
|
+
|
|
151
|
+
for (const entry of entries) {
|
|
152
|
+
if (entry.isDirectory()) {
|
|
153
|
+
categories++;
|
|
154
|
+
const subEntries = await fs.readdir(path.join(dir, entry.name), {
|
|
155
|
+
withFileTypes: true,
|
|
156
|
+
});
|
|
157
|
+
total += subEntries.filter((e) => e.isDirectory()).length;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch (error) {
|
|
161
|
+
throw new Error(`Cannot scan skills directory: ${error.message}`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return { total, categories };
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async function quickValidation(dir) {
|
|
168
|
+
const issues = {
|
|
169
|
+
noHeaders: [],
|
|
170
|
+
noMetadata: [],
|
|
171
|
+
severity: "none",
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
const categories = await fs.readdir(dir, { withFileTypes: true });
|
|
176
|
+
|
|
177
|
+
for (const category of categories) {
|
|
178
|
+
if (!category.isDirectory()) continue;
|
|
179
|
+
|
|
180
|
+
const categoryPath = path.join(dir, category.name);
|
|
181
|
+
const skills = await fs.readdir(categoryPath, { withFileTypes: true });
|
|
182
|
+
|
|
183
|
+
for (const skill of skills) {
|
|
184
|
+
if (!skill.isDirectory()) continue;
|
|
185
|
+
|
|
186
|
+
const skillMdPath = path.join(categoryPath, skill.name, "SKILL.md");
|
|
187
|
+
|
|
188
|
+
try {
|
|
189
|
+
const content = await fs.readFile(skillMdPath, "utf-8");
|
|
190
|
+
|
|
191
|
+
if (!content.includes("LEEWAY HEADER")) {
|
|
192
|
+
issues.noHeaders.push(`${category.name}/${skill.name}`);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!content.includes("REGION:") || !content.includes("TAG:")) {
|
|
196
|
+
issues.noMetadata.push(`${category.name}/${skill.name}`);
|
|
197
|
+
}
|
|
198
|
+
} catch {
|
|
199
|
+
// File doesn't exist, skip
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Determine severity
|
|
205
|
+
if (issues.noHeaders.length > 5 || issues.noMetadata.length > 5) {
|
|
206
|
+
issues.severity = "high";
|
|
207
|
+
} else if (issues.noHeaders.length > 0 || issues.noMetadata.length > 0) {
|
|
208
|
+
issues.severity = "low";
|
|
209
|
+
}
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.warn(`Warning during validation: ${error.message}`);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return issues;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
main();
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/*
|
|
2
|
+
LEEWAY HEADER — DO NOT REMOVE
|
|
3
|
+
|
|
4
|
+
REGION: LEEWAY.SKILLS.COMPLIANCE
|
|
5
|
+
TAG: LEEWAY.SKILLS.COMPLIANCE.MONITOR
|
|
6
|
+
|
|
7
|
+
COLOR_ONION_HEX:
|
|
8
|
+
NEON=#39FF14
|
|
9
|
+
FLUO=#0DFF94
|
|
10
|
+
PASTEL=#C7FFD8
|
|
11
|
+
|
|
12
|
+
ICON_ASCII:
|
|
13
|
+
family=lucide
|
|
14
|
+
glyph=check-circle
|
|
15
|
+
|
|
16
|
+
5WH:
|
|
17
|
+
WHAT = Leeway Standards Compliance Monitor Agent (for Leeway Skills)
|
|
18
|
+
WHY = Ensures all SKILL.md files and project structure conform to Leeway governance standards
|
|
19
|
+
WHO = Leeway Industries (By Leonard Jerome Lee)
|
|
20
|
+
WHERE = scripts/leeway-agents/compliance-monitor.js
|
|
21
|
+
WHEN = 2026
|
|
22
|
+
HOW = Node.js agent that scans skills directory, validates headers, tags, metadata, and generates compliance reports
|
|
23
|
+
|
|
24
|
+
AGENTS:
|
|
25
|
+
ASSESS
|
|
26
|
+
AUDIT
|
|
27
|
+
ENFORCE
|
|
28
|
+
|
|
29
|
+
LICENSE:
|
|
30
|
+
MIT
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import fs from "fs/promises";
|
|
34
|
+
import path from "path";
|
|
35
|
+
import { fileURLToPath } from "url";
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* ComplianceMonitorAgent — validates Leeway Skills against Leeway Standards
|
|
39
|
+
*
|
|
40
|
+
* Responsibilities:
|
|
41
|
+
* 1. Scan all SKILL.md files for proper Leeway headers
|
|
42
|
+
* 2. Validate tags, metadata, and documentation
|
|
43
|
+
* 3. Check for policy violations (secrets, circular deps, etc.)
|
|
44
|
+
* 4. Generate compliance score and reports
|
|
45
|
+
* 5. Track compliance metrics over time
|
|
46
|
+
*/
|
|
47
|
+
export class ComplianceMonitorAgent {
|
|
48
|
+
constructor(options = {}) {
|
|
49
|
+
this.rootDir = options.rootDir || process.cwd();
|
|
50
|
+
this.name = "compliance-monitor";
|
|
51
|
+
this.config = options.config || {};
|
|
52
|
+
this.results = {
|
|
53
|
+
passed: [],
|
|
54
|
+
failed: [],
|
|
55
|
+
warnings: [],
|
|
56
|
+
metrics: {},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
describe() {
|
|
61
|
+
return {
|
|
62
|
+
name: this.name,
|
|
63
|
+
tag: "LEEWAY.SKILLS.COMPLIANCE.MONITOR",
|
|
64
|
+
region: "LEEWAY.SKILLS.COMPLIANCE",
|
|
65
|
+
what: "Leeway compliance monitoring and validation",
|
|
66
|
+
capabilities: [
|
|
67
|
+
"scan-skills",
|
|
68
|
+
"validate-headers",
|
|
69
|
+
"check-metadata",
|
|
70
|
+
"verify-policies",
|
|
71
|
+
"generate-reports",
|
|
72
|
+
"track-metrics",
|
|
73
|
+
],
|
|
74
|
+
policies: [
|
|
75
|
+
"NO_SECRETS_IN_CODE",
|
|
76
|
+
"HEADERS_REQUIRED",
|
|
77
|
+
"TAGS_REQUIRED",
|
|
78
|
+
"NO_CIRCULAR_DEPS",
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async run(context = {}) {
|
|
84
|
+
const startTime = Date.now();
|
|
85
|
+
const skillsDir = path.join(this.rootDir, "skills");
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
// 1. Scan all SKILL.md files
|
|
89
|
+
await this.scanSkillsDirectory(skillsDir);
|
|
90
|
+
|
|
91
|
+
// 2. Validate each skill
|
|
92
|
+
for (const skillPath of this.results.skillFiles || []) {
|
|
93
|
+
await this.validateSkill(skillPath);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 3. Calculate compliance score
|
|
97
|
+
const score = this.calculateComplianceScore();
|
|
98
|
+
|
|
99
|
+
// 4. Generate report
|
|
100
|
+
const report = this.generateReport(score);
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
agent: this.name,
|
|
104
|
+
status: "success",
|
|
105
|
+
timestamp: new Date().toISOString(),
|
|
106
|
+
durationMs: Date.now() - startTime,
|
|
107
|
+
complianceScore: score,
|
|
108
|
+
result: {
|
|
109
|
+
passed: this.results.passed.length,
|
|
110
|
+
failed: this.results.failed.length,
|
|
111
|
+
warnings: this.results.warnings.length,
|
|
112
|
+
totalSkills: this.results.passed.length + this.results.failed.length,
|
|
113
|
+
report: report,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
} catch (error) {
|
|
117
|
+
return {
|
|
118
|
+
agent: this.name,
|
|
119
|
+
status: "error",
|
|
120
|
+
timestamp: new Date().toISOString(),
|
|
121
|
+
durationMs: Date.now() - startTime,
|
|
122
|
+
error: error.message,
|
|
123
|
+
result: {
|
|
124
|
+
passed: this.results.passed.length,
|
|
125
|
+
failed: this.results.failed.length,
|
|
126
|
+
warnings: this.results.warnings.length,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async scanSkillsDirectory(dir) {
|
|
133
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
134
|
+
const skillFiles = [];
|
|
135
|
+
|
|
136
|
+
for (const category of entries) {
|
|
137
|
+
if (!category.isDirectory()) continue;
|
|
138
|
+
|
|
139
|
+
const categoryPath = path.join(dir, category.name);
|
|
140
|
+
const skills = await fs.readdir(categoryPath, { withFileTypes: true });
|
|
141
|
+
|
|
142
|
+
for (const skill of skills) {
|
|
143
|
+
if (!skill.isDirectory()) continue;
|
|
144
|
+
|
|
145
|
+
const skillPath = path.join(categoryPath, skill.name);
|
|
146
|
+
const skillMdPath = path.join(skillPath, "SKILL.md");
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
await fs.access(skillMdPath);
|
|
150
|
+
skillFiles.push(skillMdPath);
|
|
151
|
+
} catch {
|
|
152
|
+
this.results.warnings.push({
|
|
153
|
+
skill: `${category.name}/${skill.name}`,
|
|
154
|
+
issue: "No SKILL.md file found",
|
|
155
|
+
path: skillPath,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.results.skillFiles = skillFiles;
|
|
162
|
+
return skillFiles;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async validateSkill(skillPath) {
|
|
166
|
+
const skillName = path.dirname(skillPath).split(path.sep).pop();
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const content = await fs.readFile(skillPath, "utf-8");
|
|
170
|
+
const issues = [];
|
|
171
|
+
|
|
172
|
+
// Check 1: Leeway header
|
|
173
|
+
if (!this.hasLeewayHeader(content)) {
|
|
174
|
+
issues.push("Missing required Leeway header");
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Check 2: Required tags
|
|
178
|
+
if (!this.hasRequiredTags(content)) {
|
|
179
|
+
issues.push("Missing required REGION/TAG structure");
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Check 3: No secrets
|
|
183
|
+
if (this.containsSecrets(content)) {
|
|
184
|
+
issues.push("Potential secrets detected in content");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Check 4: Metadata structure
|
|
188
|
+
if (!this.hasValidMetadata(content)) {
|
|
189
|
+
issues.push("Missing or invalid metadata structure");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Check 5: Documentation
|
|
193
|
+
if (!this.hasAdequateDocumentation(content)) {
|
|
194
|
+
this.results.warnings.push({
|
|
195
|
+
skill: skillName,
|
|
196
|
+
issue: "Documentation may be incomplete",
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (issues.length === 0) {
|
|
201
|
+
this.results.passed.push({
|
|
202
|
+
skill: skillName,
|
|
203
|
+
path: skillPath,
|
|
204
|
+
});
|
|
205
|
+
} else {
|
|
206
|
+
this.results.failed.push({
|
|
207
|
+
skill: skillName,
|
|
208
|
+
path: skillPath,
|
|
209
|
+
issues: issues,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
} catch (error) {
|
|
213
|
+
this.results.failed.push({
|
|
214
|
+
skill: skillName,
|
|
215
|
+
path: skillPath,
|
|
216
|
+
issues: [`Error reading file: ${error.message}`],
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
hasLeewayHeader(content) {
|
|
222
|
+
return (
|
|
223
|
+
content.includes("LEEWAY HEADER") &&
|
|
224
|
+
content.includes("REGION:") &&
|
|
225
|
+
content.includes("TAG:") &&
|
|
226
|
+
content.includes("5WH:")
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
hasRequiredTags(content) {
|
|
231
|
+
const regionMatch = content.match(/REGION:\s*([A-Z0-9.]+)/);
|
|
232
|
+
const tagMatch = content.match(/TAG:\s*([A-Z0-9.]+)/);
|
|
233
|
+
return regionMatch && tagMatch && regionMatch[1] && tagMatch[1];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
containsSecrets(content) {
|
|
237
|
+
const secretPatterns = [
|
|
238
|
+
/password\s*[=:]/i,
|
|
239
|
+
/secret\s*[=:]/i,
|
|
240
|
+
/apikey\s*[=:]/i,
|
|
241
|
+
/api_key\s*[=:]/i,
|
|
242
|
+
/private_key\s*[=:]/i,
|
|
243
|
+
/token\s*[=:]/i,
|
|
244
|
+
/-----BEGIN/,
|
|
245
|
+
/-----END/,
|
|
246
|
+
];
|
|
247
|
+
return secretPatterns.some((pattern) => pattern.test(content));
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
hasValidMetadata(content) {
|
|
251
|
+
const requiredFields = ["WHAT", "WHY", "WHO", "WHERE", "HOW"];
|
|
252
|
+
return requiredFields.every((field) => content.includes(`${field} =`));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
hasAdequateDocumentation(content) {
|
|
256
|
+
const sections = content.split("\n").length;
|
|
257
|
+
return sections > 20;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
calculateComplianceScore() {
|
|
261
|
+
const total = this.results.passed.length + this.results.failed.length;
|
|
262
|
+
if (total === 0) return 0;
|
|
263
|
+
|
|
264
|
+
const passedScore = this.results.passed.length;
|
|
265
|
+
const failedPenalty = this.results.failed.length * 15;
|
|
266
|
+
const warningPenalty = this.results.warnings.length * 5;
|
|
267
|
+
|
|
268
|
+
const rawScore =
|
|
269
|
+
(passedScore * 100) / total - failedPenalty - warningPenalty;
|
|
270
|
+
return Math.max(0, Math.min(100, rawScore));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
generateReport(score) {
|
|
274
|
+
const timestamp = new Date().toISOString();
|
|
275
|
+
const status = score >= 85 ? "COMPLIANT" : "NON-COMPLIANT";
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
timestamp,
|
|
279
|
+
status,
|
|
280
|
+
score: Math.round(score),
|
|
281
|
+
summary: {
|
|
282
|
+
totalSkills: this.results.passed.length + this.results.failed.length,
|
|
283
|
+
compliant: this.results.passed.length,
|
|
284
|
+
nonCompliant: this.results.failed.length,
|
|
285
|
+
warnings: this.results.warnings.length,
|
|
286
|
+
},
|
|
287
|
+
failedSkills: this.results.failed,
|
|
288
|
+
warnings: this.results.warnings,
|
|
289
|
+
recommendations: this.generateRecommendations(),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
generateRecommendations() {
|
|
294
|
+
const recommendations = [];
|
|
295
|
+
|
|
296
|
+
if (this.results.failed.length > 0) {
|
|
297
|
+
recommendations.push({
|
|
298
|
+
priority: "high",
|
|
299
|
+
action: "Add Leeway headers to all non-compliant SKILL.md files",
|
|
300
|
+
command: "node scripts/leeway-agents/header-injector.js",
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (this.results.warnings.length > 0) {
|
|
305
|
+
recommendations.push({
|
|
306
|
+
priority: "medium",
|
|
307
|
+
action: "Review and enhance documentation in flagged skills",
|
|
308
|
+
details: this.results.warnings.map((w) => w.skill),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
recommendations.push({
|
|
313
|
+
priority: "medium",
|
|
314
|
+
action: "Run periodic compliance audits (recommend hourly)",
|
|
315
|
+
schedule: "0 * * * * (cron) or 3600000ms (interval)",
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
recommendations.push({
|
|
319
|
+
priority: "low",
|
|
320
|
+
action: "Configure skills-registry.json with Leeway metadata",
|
|
321
|
+
details: "Add REGION, TAG, and compliance metadata to registry entries",
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
return recommendations;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export default ComplianceMonitorAgent;
|
|
329
|
+
|
|
330
|
+
async function main() {
|
|
331
|
+
const agent = new ComplianceMonitorAgent();
|
|
332
|
+
const result = await agent.run();
|
|
333
|
+
|
|
334
|
+
if (result.status !== "success") {
|
|
335
|
+
console.error("[Leeway Compliance Monitor] Failed:", result.error);
|
|
336
|
+
process.exit(1);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const reportDir = path.join(process.cwd(), ".leeway", "reports");
|
|
340
|
+
await fs.mkdir(reportDir, { recursive: true });
|
|
341
|
+
|
|
342
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
343
|
+
const reportPath = path.join(reportDir, `compliance-${timestamp}.json`);
|
|
344
|
+
await fs.writeFile(
|
|
345
|
+
reportPath,
|
|
346
|
+
JSON.stringify(result.result.report, null, 2),
|
|
347
|
+
"utf-8",
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
console.log(
|
|
351
|
+
`[Leeway Compliance Monitor] Score: ${result.complianceScore}/100`,
|
|
352
|
+
);
|
|
353
|
+
console.log(
|
|
354
|
+
`[Leeway Compliance Monitor] Passed: ${result.result.passed}, Failed: ${result.result.failed}, Warnings: ${result.result.warnings}`,
|
|
355
|
+
);
|
|
356
|
+
console.log(`[Leeway Compliance Monitor] Report: ${reportPath}`);
|
|
357
|
+
|
|
358
|
+
if (result.result.failed > 0) {
|
|
359
|
+
result.result.report.failedSkills.slice(0, 10).forEach((item) => {
|
|
360
|
+
console.log(` - ${item.skill}: ${item.issues.join("; ")}`);
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const isDirectRun =
|
|
366
|
+
process.argv[1] &&
|
|
367
|
+
path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
368
|
+
|
|
369
|
+
if (isDirectRun) {
|
|
370
|
+
main().catch((error) => {
|
|
371
|
+
console.error("[Leeway Compliance Monitor] Fatal error:", error);
|
|
372
|
+
process.exit(1);
|
|
373
|
+
});
|
|
374
|
+
}
|