tribunal-kit 4.2.0 → 4.3.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/.agent/ARCHITECTURE.md +21 -14
- package/.agent/agents/swarm-worker-contracts.md +5 -5
- package/.agent/agents/ui-ux-auditor.md +292 -0
- package/.agent/rules/GEMINI.md +8 -8
- package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/_colors.js +18 -0
- package/.agent/scripts/_utils.js +42 -0
- package/.agent/scripts/auto_preview.js +197 -0
- package/.agent/scripts/bundle_analyzer.js +290 -0
- package/.agent/scripts/case_law_manager.js +684 -0
- package/.agent/scripts/checklist.js +266 -0
- package/.agent/scripts/colors.js +17 -0
- package/.agent/scripts/compress_skills.js +141 -0
- package/.agent/scripts/consolidate_skills.js +149 -0
- package/.agent/scripts/context_broker.js +609 -0
- package/.agent/scripts/deep_compress.js +150 -0
- package/.agent/scripts/dependency_analyzer.js +272 -0
- package/.agent/scripts/inner_loop_validator.js +465 -0
- package/.agent/scripts/lint_runner.js +187 -0
- package/.agent/scripts/minify_context.js +100 -0
- package/.agent/scripts/patch_skills_meta.js +156 -0
- package/.agent/scripts/patch_skills_output.js +244 -0
- package/.agent/scripts/schema_validator.js +297 -0
- package/.agent/scripts/security_scan.js +303 -0
- package/.agent/scripts/session_manager.js +276 -0
- package/.agent/scripts/skill_evolution.js +644 -0
- package/.agent/scripts/skill_integrator.js +313 -0
- package/.agent/scripts/strengthen_skills.js +193 -0
- package/.agent/scripts/strip_tribunal.js +47 -0
- package/.agent/scripts/swarm_dispatcher.js +360 -0
- package/.agent/scripts/test_runner.js +193 -0
- package/.agent/scripts/utils.js +32 -0
- package/.agent/scripts/verify_all.js +256 -0
- package/.agent/skills/agent-organizer/SKILL.md +3 -3
- package/.agent/skills/agentic-patterns/SKILL.md +3 -3
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +3 -3
- package/.agent/skills/api-patterns/SKILL.md +3 -3
- package/.agent/skills/api-security-auditor/SKILL.md +3 -3
- package/.agent/skills/app-builder/SKILL.md +3 -3
- package/.agent/skills/app-builder/templates/SKILL.md +1 -1
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +3 -3
- package/.agent/skills/architecture/SKILL.md +3 -3
- package/.agent/skills/authentication-best-practices/SKILL.md +3 -3
- package/.agent/skills/bash-linux/SKILL.md +3 -3
- package/.agent/skills/behavioral-modes/SKILL.md +3 -3
- package/.agent/skills/brainstorming/SKILL.md +3 -3
- package/.agent/skills/building-native-ui/SKILL.md +3 -3
- package/.agent/skills/clean-code/SKILL.md +3 -3
- package/.agent/skills/code-review-checklist/SKILL.md +3 -3
- package/.agent/skills/config-validator/SKILL.md +3 -3
- package/.agent/skills/csharp-developer/SKILL.md +3 -3
- package/.agent/skills/data-validation-schemas/SKILL.md +3 -3
- package/.agent/skills/database-design/SKILL.md +3 -3
- package/.agent/skills/deployment-procedures/SKILL.md +3 -3
- package/.agent/skills/devops-engineer/SKILL.md +3 -3
- package/.agent/skills/devops-incident-responder/SKILL.md +3 -3
- package/.agent/skills/doc.md +1 -1
- package/.agent/skills/documentation-templates/SKILL.md +3 -3
- package/.agent/skills/edge-computing/SKILL.md +3 -3
- package/.agent/skills/error-resilience/SKILL.md +3 -3
- package/.agent/skills/extract-design-system/SKILL.md +3 -3
- package/.agent/skills/framer-motion-expert/SKILL.md +3 -4
- package/.agent/skills/frontend-design/SKILL.md +3 -3
- package/.agent/skills/game-design-expert/SKILL.md +3 -3
- package/.agent/skills/game-engineering-expert/SKILL.md +3 -3
- package/.agent/skills/geo-fundamentals/SKILL.md +3 -3
- package/.agent/skills/github-operations/SKILL.md +3 -3
- package/.agent/skills/gsap-core/SKILL.md +0 -2
- package/.agent/skills/gsap-frameworks/SKILL.md +0 -2
- package/.agent/skills/gsap-performance/SKILL.md +0 -2
- package/.agent/skills/gsap-plugins/SKILL.md +0 -2
- package/.agent/skills/gsap-react/SKILL.md +0 -2
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +0 -2
- package/.agent/skills/gsap-timeline/SKILL.md +0 -2
- package/.agent/skills/gsap-utils/SKILL.md +0 -2
- package/.agent/skills/i18n-localization/SKILL.md +3 -3
- package/.agent/skills/intelligent-routing/SKILL.md +3 -3
- package/.agent/skills/lint-and-validate/SKILL.md +3 -3
- package/.agent/skills/llm-engineering/SKILL.md +3 -3
- package/.agent/skills/local-first/SKILL.md +3 -3
- package/.agent/skills/mcp-builder/SKILL.md +3 -3
- package/.agent/skills/mobile-design/SKILL.md +3 -3
- package/.agent/skills/monorepo-management/SKILL.md +3 -3
- package/.agent/skills/motion-engineering/SKILL.md +4 -4
- package/.agent/skills/nextjs-react-expert/SKILL.md +3 -3
- package/.agent/skills/nodejs-best-practices/SKILL.md +3 -3
- package/.agent/skills/observability/SKILL.md +3 -3
- package/.agent/skills/parallel-agents/SKILL.md +3 -3
- package/.agent/skills/performance-profiling/SKILL.md +3 -3
- package/.agent/skills/plan-writing/SKILL.md +3 -3
- package/.agent/skills/platform-engineer/SKILL.md +3 -3
- package/.agent/skills/playwright-best-practices/SKILL.md +3 -3
- package/.agent/skills/powershell-windows/SKILL.md +3 -3
- package/.agent/skills/project-idioms/SKILL.md +3 -3
- package/.agent/skills/python-patterns/SKILL.md +3 -3
- package/.agent/skills/python-pro/SKILL.md +3 -3
- package/.agent/skills/react-specialist/SKILL.md +3 -3
- package/.agent/skills/readme-builder/SKILL.md +3 -3
- package/.agent/skills/realtime-patterns/SKILL.md +3 -3
- package/.agent/skills/red-team-tactics/SKILL.md +3 -3
- package/.agent/skills/rust-pro/SKILL.md +3 -3
- package/.agent/skills/seo-fundamentals/SKILL.md +3 -3
- package/.agent/skills/server-management/SKILL.md +3 -3
- package/.agent/skills/shadcn-ui-expert/SKILL.md +3 -3
- package/.agent/skills/skill-creator/SKILL.md +3 -3
- package/.agent/skills/sql-pro/SKILL.md +3 -3
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +3 -3
- package/.agent/skills/swiftui-expert/SKILL.md +3 -3
- package/.agent/skills/systematic-debugging/SKILL.md +3 -3
- package/.agent/skills/tailwind-patterns/SKILL.md +3 -3
- package/.agent/skills/tdd-workflow/SKILL.md +3 -3
- package/.agent/skills/test-result-analyzer/SKILL.md +3 -3
- package/.agent/skills/testing-patterns/SKILL.md +3 -3
- package/.agent/skills/trend-researcher/SKILL.md +3 -3
- package/.agent/skills/typescript-advanced/SKILL.md +3 -3
- package/.agent/skills/ui-ux-pro-max/SKILL.md +3 -3
- package/.agent/skills/ui-ux-researcher/SKILL.md +3 -3
- package/.agent/skills/vue-expert/SKILL.md +3 -3
- package/.agent/skills/vulnerability-scanner/SKILL.md +3 -3
- package/.agent/skills/web-accessibility-auditor/SKILL.md +3 -3
- package/.agent/skills/web-design-guidelines/SKILL.md +3 -3
- package/.agent/skills/webapp-testing/SKILL.md +3 -3
- package/.agent/skills/whimsy-injector/SKILL.md +3 -3
- package/.agent/skills/workflow-optimizer/SKILL.md +3 -3
- package/.agent/workflows/audit.md +6 -6
- package/.agent/workflows/deploy.md +1 -1
- package/.agent/workflows/generate.md +23 -6
- package/.agent/workflows/session.md +5 -5
- package/.agent/workflows/swarm.md +2 -2
- package/README.md +64 -8
- package/bin/tribunal-kit.js +277 -45
- package/package.json +9 -6
- package/scripts/changelog.js +167 -0
- package/scripts/sync-version.js +81 -0
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/auto_preview.py +0 -180
- package/.agent/scripts/bundle_analyzer.py +0 -259
- package/.agent/scripts/case_law_manager.py +0 -755
- package/.agent/scripts/checklist.py +0 -209
- package/.agent/scripts/compress_skills.py +0 -167
- package/.agent/scripts/consolidate_skills.py +0 -173
- package/.agent/scripts/deep_compress.py +0 -202
- package/.agent/scripts/dependency_analyzer.py +0 -247
- package/.agent/scripts/lint_runner.py +0 -188
- package/.agent/scripts/minify_context.py +0 -80
- package/.agent/scripts/patch_skills_meta.py +0 -177
- package/.agent/scripts/patch_skills_output.py +0 -285
- package/.agent/scripts/schema_validator.py +0 -279
- package/.agent/scripts/security_scan.py +0 -224
- package/.agent/scripts/session_manager.py +0 -261
- package/.agent/scripts/skill_evolution.py +0 -563
- package/.agent/scripts/skill_integrator.py +0 -234
- package/.agent/scripts/strengthen_skills.py +0 -220
- package/.agent/scripts/strip_tribunal.py +0 -41
- package/.agent/scripts/swarm_dispatcher.py +0 -350
- package/.agent/scripts/test_runner.py +0 -192
- package/.agent/scripts/test_swarm_dispatcher.py +0 -163
- package/.agent/scripts/verify_all.py +0 -195
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* skill_integrator.js — Automated Skill-Script Integration Analyzer
|
|
4
|
+
*
|
|
5
|
+
* This script scans active skills in `.agent/skills/` and maps them to their
|
|
6
|
+
* corresponding executable scripts in `.agent/scripts/`. It helps the Orchestrator
|
|
7
|
+
* and other agents know which skills have automated CLI actions available.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* node .agent/scripts/skill_integrator.js
|
|
11
|
+
* node .agent/scripts/skill_integrator.js --skill <skill-name>
|
|
12
|
+
* node .agent/scripts/skill_integrator.js --report
|
|
13
|
+
* node .agent/scripts/skill_integrator.js --verify
|
|
14
|
+
* node .agent/scripts/skill_integrator.js --report --verify
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const path = require('path');
|
|
21
|
+
const { execFileSync } = require('child_process');
|
|
22
|
+
|
|
23
|
+
// Colors for terminal output
|
|
24
|
+
const CYAN = '\x1b[96m';
|
|
25
|
+
const GREEN = '\x1b[92m';
|
|
26
|
+
const YELLOW = '\x1b[93m';
|
|
27
|
+
const RED = '\x1b[91m';
|
|
28
|
+
const BOLD = '\x1b[1m';
|
|
29
|
+
const RESET = '\x1b[0m';
|
|
30
|
+
|
|
31
|
+
const REPORT_FILE = 'skill-integration-report.md';
|
|
32
|
+
|
|
33
|
+
function findAgentDir(startPathStr) {
|
|
34
|
+
let current = path.resolve(startPathStr);
|
|
35
|
+
const root = path.parse(current).root;
|
|
36
|
+
while (current !== root) {
|
|
37
|
+
const agentDir = path.join(current, '.agent');
|
|
38
|
+
if (fs.existsSync(agentDir) && fs.statSync(agentDir).isDirectory()) {
|
|
39
|
+
return agentDir;
|
|
40
|
+
}
|
|
41
|
+
current = path.dirname(current);
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getAssociatedScript(skillDir, scriptsDir) {
|
|
47
|
+
/** Check if the skill has an explicit frontmatter script or an implicit script file. */
|
|
48
|
+
const skillName = path.basename(skillDir);
|
|
49
|
+
|
|
50
|
+
// 1. Implicit check: does a script with the same name exist? (Check for both .js and .py)
|
|
51
|
+
const implicitJsScript = path.join(scriptsDir, `${skillName}.js`);
|
|
52
|
+
if (fs.existsSync(implicitJsScript)) {
|
|
53
|
+
return `.agent/scripts/${skillName}.js`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const implicitPyScript = path.join(scriptsDir, `${skillName}.py`);
|
|
57
|
+
if (fs.existsSync(implicitPyScript)) {
|
|
58
|
+
return `.agent/scripts/${skillName}.py`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 2. Explicit check: does the SKILL.md define 'script:' in its frontmatter?
|
|
62
|
+
const skillMd = path.join(skillDir, 'SKILL.md');
|
|
63
|
+
if (fs.existsSync(skillMd)) {
|
|
64
|
+
try {
|
|
65
|
+
const content = fs.readFileSync(skillMd, 'utf8');
|
|
66
|
+
const match = content.match(/---([\s\S]*?)---/);
|
|
67
|
+
if (match) {
|
|
68
|
+
const frontmatter = match[1];
|
|
69
|
+
const scriptMatch = frontmatter.match(/(?:^|\n)script:\s*([^\n]+)/);
|
|
70
|
+
if (scriptMatch) {
|
|
71
|
+
return scriptMatch[1].trim();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} catch (err) {
|
|
75
|
+
// ignore
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function scanAllSkills(agentDir) {
|
|
83
|
+
const skillsDir = path.join(agentDir, 'skills');
|
|
84
|
+
const scriptsDir = path.join(agentDir, 'scripts');
|
|
85
|
+
|
|
86
|
+
if (!fs.existsSync(skillsDir) || !fs.existsSync(scriptsDir)) {
|
|
87
|
+
console.log(`${YELLOW}Warning: '.agent/skills' or '.agent/scripts' directory not found.${RESET}`);
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const integratedSkills = {};
|
|
92
|
+
const items = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
93
|
+
|
|
94
|
+
// sort items by name
|
|
95
|
+
items.sort((a, b) => a.name.localeCompare(b.name));
|
|
96
|
+
|
|
97
|
+
for (const item of items) {
|
|
98
|
+
if (item.isDirectory()) {
|
|
99
|
+
const skillDir = path.join(skillsDir, item.name);
|
|
100
|
+
const scriptPath = getAssociatedScript(skillDir, scriptsDir);
|
|
101
|
+
if (scriptPath) {
|
|
102
|
+
integratedSkills[item.name] = scriptPath;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return integratedSkills;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function verifyScript(scriptPathStr, workspaceRoot) {
|
|
111
|
+
/**
|
|
112
|
+
* Verify a mapped script exists on disk and has valid syntax.
|
|
113
|
+
* Returns { valid: boolean, message: string }.
|
|
114
|
+
*/
|
|
115
|
+
const fullPath = path.resolve(workspaceRoot, scriptPathStr);
|
|
116
|
+
|
|
117
|
+
if (!fs.existsSync(fullPath)) {
|
|
118
|
+
return { valid: false, message: `File not found: ${fullPath}` };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
if (fullPath.endsWith('.js')) {
|
|
123
|
+
// use node to syntax check
|
|
124
|
+
execFileSync('node', ['-c', fullPath], { stdio: 'pipe' });
|
|
125
|
+
} else if (fullPath.endsWith('.py')) {
|
|
126
|
+
// use python to syntax check
|
|
127
|
+
execFileSync('python', ['-m', 'py_compile', fullPath], { stdio: 'pipe' });
|
|
128
|
+
}
|
|
129
|
+
return { valid: true, message: 'Syntax OK' };
|
|
130
|
+
} catch (e) {
|
|
131
|
+
let msg = e.message;
|
|
132
|
+
if (e.stderr) {
|
|
133
|
+
msg = e.stderr.toString().trim();
|
|
134
|
+
}
|
|
135
|
+
return { valid: false, message: `Syntax error: ${msg.split('\n')[0]}` };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function checkSkill(skillName, agentDir) {
|
|
140
|
+
const skillDir = path.join(agentDir, 'skills', skillName);
|
|
141
|
+
const scriptsDir = path.join(agentDir, 'scripts');
|
|
142
|
+
|
|
143
|
+
if (!fs.existsSync(skillDir)) {
|
|
144
|
+
console.log(`${YELLOW}Skill '${skillName}' not found in .agent/skills/${RESET}`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const scriptPath = getAssociatedScript(skillDir, scriptsDir);
|
|
149
|
+
if (scriptPath) {
|
|
150
|
+
console.log(`${GREEN}✓ Associated script found:${RESET} ${scriptPath}`);
|
|
151
|
+
const runner = scriptPath.endsWith('.py') ? 'python' : 'node';
|
|
152
|
+
console.log(`\nTo execute:\n ${runner} ${scriptPath}`);
|
|
153
|
+
} else {
|
|
154
|
+
console.log(`No executable script mapped for '${skillName}'.`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function cmdReport(integratedSkills, workspaceRoot) {
|
|
159
|
+
/** Write a Markdown integration report to REPORT_FILE. */
|
|
160
|
+
const keys = Object.keys(integratedSkills).sort();
|
|
161
|
+
const generated = new Date().toISOString().slice(0, 16);
|
|
162
|
+
|
|
163
|
+
let content = `# Skill-Script Integration Report\n\n`;
|
|
164
|
+
content += `Generated: ${generated}\n`;
|
|
165
|
+
content += `Integrated skills: ${keys.length}\n\n`;
|
|
166
|
+
content += `---\n\n`;
|
|
167
|
+
content += `| Skill | Script | Exists |\n`;
|
|
168
|
+
content += `|---|---|---|\n`;
|
|
169
|
+
|
|
170
|
+
for (const skill of keys) {
|
|
171
|
+
const script = integratedSkills[skill];
|
|
172
|
+
const scriptPath = path.resolve(workspaceRoot, script);
|
|
173
|
+
const exists = fs.existsSync(scriptPath) ? '✅' : '❌ Missing';
|
|
174
|
+
content += `| \`${skill}\` | \`${script}\` | ${exists} |\n`;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
content += `\n---\n\n`;
|
|
178
|
+
content += `_Run \`node .agent/scripts/skill_integrator.js --verify\` to validate syntax of all mapped scripts._\n`;
|
|
179
|
+
|
|
180
|
+
const reportPath = path.join(workspaceRoot, REPORT_FILE);
|
|
181
|
+
fs.writeFileSync(reportPath, content, 'utf8');
|
|
182
|
+
|
|
183
|
+
console.log(`${GREEN}✅ Report written to:${RESET} ${reportPath}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function cmdVerify(integratedSkills, workspaceRoot) {
|
|
187
|
+
/**
|
|
188
|
+
* Validate each mapped script: check existence and syntax.
|
|
189
|
+
* Returns true if all pass, false if any fail.
|
|
190
|
+
*/
|
|
191
|
+
const keys = Object.keys(integratedSkills).sort();
|
|
192
|
+
if (keys.length === 0) {
|
|
193
|
+
console.log(`${YELLOW}No integrated scripts found to verify.${RESET}`);
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
console.log(`\n${BOLD}${CYAN}━━━ Skill-Script Verification (${keys.length} scripts) ━━━${RESET}\n`);
|
|
198
|
+
|
|
199
|
+
let allPassed = true;
|
|
200
|
+
const failures = [];
|
|
201
|
+
|
|
202
|
+
for (const skill of keys) {
|
|
203
|
+
const script = integratedSkills[skill];
|
|
204
|
+
const res = verifyScript(script, workspaceRoot);
|
|
205
|
+
if (res.valid) {
|
|
206
|
+
console.log(` ${GREEN}✅ PASS${RESET} ${BOLD}${skill}${RESET} → ${script}`);
|
|
207
|
+
} else {
|
|
208
|
+
console.log(` ${RED}❌ FAIL${RESET} ${BOLD}${skill}${RESET} → ${script}`);
|
|
209
|
+
console.log(` ${RED}${res.message}${RESET}`);
|
|
210
|
+
allPassed = false;
|
|
211
|
+
failures.push(skill);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
console.log(`\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}`);
|
|
216
|
+
if (allPassed) {
|
|
217
|
+
console.log(`${GREEN}All ${keys.length} mapped scripts passed verification.${RESET}\n`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(`${RED}${failures.length} script(s) failed verification. Fix before deploying.${RESET}\n`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return allPassed;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function main() {
|
|
226
|
+
const rawArgs = process.argv.slice(2);
|
|
227
|
+
|
|
228
|
+
if (rawArgs.length > 0 && ['-h', '--help', 'help'].includes(rawArgs[0])) {
|
|
229
|
+
console.log(`
|
|
230
|
+
${BOLD}skill_integrator.js${RESET} — Skill-Script Integrator
|
|
231
|
+
|
|
232
|
+
${BOLD}Usage:${RESET}
|
|
233
|
+
node .agent/scripts/skill_integrator.js
|
|
234
|
+
node .agent/scripts/skill_integrator.js --skill <skill-name>
|
|
235
|
+
node .agent/scripts/skill_integrator.js --report
|
|
236
|
+
node .agent/scripts/skill_integrator.js --verify
|
|
237
|
+
node .agent/scripts/skill_integrator.js --report --verify
|
|
238
|
+
|
|
239
|
+
${BOLD}Options:${RESET}
|
|
240
|
+
--skill <name> Validate a specific skill by name
|
|
241
|
+
--workspace <dir> Workspace root directory (default: current dir)
|
|
242
|
+
--report Generate a Markdown integration report (skill-integration-report.md)
|
|
243
|
+
--verify Validate syntax of all mapped scripts (exits 1 on any failure)
|
|
244
|
+
`);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Parse args
|
|
249
|
+
let skillArg = null;
|
|
250
|
+
let workspaceArg = '.';
|
|
251
|
+
let reportArg = false;
|
|
252
|
+
let verifyArg = false;
|
|
253
|
+
|
|
254
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
255
|
+
if (rawArgs[i] === '--skill' && i + 1 < rawArgs.length) {
|
|
256
|
+
skillArg = rawArgs[++i];
|
|
257
|
+
} else if (rawArgs[i] === '--workspace' && i + 1 < rawArgs.length) {
|
|
258
|
+
workspaceArg = rawArgs[++i];
|
|
259
|
+
} else if (rawArgs[i] === '--report') {
|
|
260
|
+
reportArg = true;
|
|
261
|
+
} else if (rawArgs[i] === '--verify') {
|
|
262
|
+
verifyArg = true;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const workspaceRoot = path.resolve(workspaceArg);
|
|
267
|
+
const agentDir = findAgentDir(workspaceRoot);
|
|
268
|
+
|
|
269
|
+
if (!agentDir) {
|
|
270
|
+
console.log(`${YELLOW}Error: Could not find .agent directory starting from ${workspaceRoot}${RESET}`);
|
|
271
|
+
process.exit(1);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (skillArg) {
|
|
275
|
+
checkSkill(skillArg, agentDir);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const integratedSkills = scanAllSkills(agentDir);
|
|
280
|
+
|
|
281
|
+
if (reportArg) {
|
|
282
|
+
cmdReport(integratedSkills, workspaceRoot);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (verifyArg) {
|
|
286
|
+
const passed = cmdVerify(integratedSkills, workspaceRoot);
|
|
287
|
+
if (!passed) {
|
|
288
|
+
process.exit(1);
|
|
289
|
+
}
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (!reportArg && !verifyArg) {
|
|
294
|
+
const keys = Object.keys(integratedSkills).sort();
|
|
295
|
+
if (keys.length === 0) {
|
|
296
|
+
console.log("No integrated scripts found for any active skills.");
|
|
297
|
+
} else {
|
|
298
|
+
console.log(`\n${BOLD}${CYAN}--- Skill-Script Integrations (${keys.length}) ---${RESET}\n`);
|
|
299
|
+
for (const skill of keys) {
|
|
300
|
+
const script = integratedSkills[skill];
|
|
301
|
+
console.log(` ${BOLD}${skill}${RESET}`);
|
|
302
|
+
console.log(` ↳ ${GREEN}${script}${RESET}\n`);
|
|
303
|
+
}
|
|
304
|
+
console.log(`${CYAN}To run a skill script, use: python <path> or node <path>${RESET}\n`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
module.exports = { getAssociatedScript, verifyScript };
|
|
310
|
+
|
|
311
|
+
if (require.main === module) {
|
|
312
|
+
main();
|
|
313
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* strengthen_skills.js — Appends Tribunal guardrails to SKILL.md files missing them.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node .agent/scripts/strengthen_skills.js .
|
|
7
|
+
* node .agent/scripts/strengthen_skills.js . --dry-run
|
|
8
|
+
* node .agent/scripts/strengthen_skills.js . --skill python-pro
|
|
9
|
+
* node .agent/scripts/strengthen_skills.js . --skills-path /custom/skills/dir
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const path = require('path');
|
|
16
|
+
|
|
17
|
+
const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
|
|
18
|
+
|
|
19
|
+
const GUARDRAILS_BLOCK = `
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🤖 LLM-Specific Traps
|
|
24
|
+
|
|
25
|
+
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
26
|
+
|
|
27
|
+
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
28
|
+
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always \`// VERIFY\` or check \`package.json\` / \`requirements.txt\`.
|
|
29
|
+
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
30
|
+
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
31
|
+
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
36
|
+
|
|
37
|
+
**Slash command: \`/review\` or \`/tribunal-full\`**
|
|
38
|
+
**Active reviewers: \`logic-reviewer\` · \`security-auditor\`**
|
|
39
|
+
|
|
40
|
+
### ❌ Forbidden AI Tropes
|
|
41
|
+
|
|
42
|
+
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with \`// VERIFY: [reason]\`.
|
|
43
|
+
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
44
|
+
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
45
|
+
|
|
46
|
+
### ✅ Pre-Flight Self-Audit
|
|
47
|
+
|
|
48
|
+
Review these questions before confirming output:
|
|
49
|
+
\`\`\`
|
|
50
|
+
✅ Did I rely ONLY on real, verified tools and methods?
|
|
51
|
+
✅ Is this solution appropriately scoped to the user's constraints?
|
|
52
|
+
✅ Did I handle potential failure modes and edge cases?
|
|
53
|
+
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
57
|
+
|
|
58
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
59
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
60
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const TRIBUNAL_MARKERS = [
|
|
64
|
+
"Tribunal Integration",
|
|
65
|
+
"Tribunal Integration (Anti-Hallucination)",
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const VBC_MARKERS = [
|
|
69
|
+
"Verification-Before-Completion",
|
|
70
|
+
"VBC Protocol",
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
function hasTribunalBlock(content) {
|
|
74
|
+
return TRIBUNAL_MARKERS.some(m => content.includes(m));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function hasVbcBlock(content) {
|
|
78
|
+
return VBC_MARKERS.some(m => content.includes(m));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function header(title) { console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`); }
|
|
82
|
+
function ok(msg) { console.log(` ${GREEN}✅ ${msg}${RESET}`); }
|
|
83
|
+
function skip(msg) { console.log(` ${YELLOW}⏭️ ${msg}${RESET}`); }
|
|
84
|
+
function warn(msg) { console.log(` ${YELLOW}⚠️ ${msg}${RESET}`); }
|
|
85
|
+
function fail(msg) { console.log(` ${RED}❌ ${msg}${RESET}`); }
|
|
86
|
+
|
|
87
|
+
function processSkill(skillMd, dryRun) {
|
|
88
|
+
const skillName = path.basename(path.dirname(skillMd));
|
|
89
|
+
try {
|
|
90
|
+
const content = fs.readFileSync(skillMd, 'utf8');
|
|
91
|
+
const hasTribunal = hasTribunalBlock(content);
|
|
92
|
+
const hasVbc = hasVbcBlock(content);
|
|
93
|
+
|
|
94
|
+
if (hasTribunal && hasVbc) {
|
|
95
|
+
skip(`${skillName} — already has Tribunal + VBC blocks`);
|
|
96
|
+
return "skipped";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const missing = [];
|
|
100
|
+
if (!hasTribunal) missing.push("Tribunal Integration");
|
|
101
|
+
if (!hasVbc) missing.push("VBC Protocol");
|
|
102
|
+
|
|
103
|
+
if (dryRun) {
|
|
104
|
+
warn(`[DRY RUN] ${skillName} — would add: ${missing.join(', ')}`);
|
|
105
|
+
return "updated";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
fs.appendFileSync(skillMd, GUARDRAILS_BLOCK, 'utf8');
|
|
109
|
+
ok(`${skillName} — strengthened (${missing.join(', ')} added)`);
|
|
110
|
+
return "updated";
|
|
111
|
+
} catch (e) {
|
|
112
|
+
fail(`${skillName} — ${e.message}`);
|
|
113
|
+
return "error";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function main() {
|
|
118
|
+
const args = process.argv.slice(2);
|
|
119
|
+
let targetPath = ".";
|
|
120
|
+
let dryRun = false;
|
|
121
|
+
let skillArg = null;
|
|
122
|
+
let skillsPathArg = null;
|
|
123
|
+
|
|
124
|
+
let i = 0;
|
|
125
|
+
while (i < args.length) {
|
|
126
|
+
if (args[i] === '--dry-run') {
|
|
127
|
+
dryRun = true;
|
|
128
|
+
} else if (args[i] === '--skill' && i + 1 < args.length) {
|
|
129
|
+
skillArg = args[++i];
|
|
130
|
+
} else if (args[i] === '--skills-path' && i + 1 < args.length) {
|
|
131
|
+
skillsPathArg = args[++i];
|
|
132
|
+
} else if (args[i] === '-h' || args[i] === '--help') {
|
|
133
|
+
console.log("Usage: node strengthen_skills.js <path> [--dry-run] [--skill <name>] [--skills-path <path>]");
|
|
134
|
+
process.exit(0);
|
|
135
|
+
} else if (!args[i].startsWith('-')) {
|
|
136
|
+
targetPath = args[i];
|
|
137
|
+
}
|
|
138
|
+
i++;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const projectRoot = path.resolve(targetPath);
|
|
142
|
+
let skillsDir;
|
|
143
|
+
if (skillsPathArg) {
|
|
144
|
+
skillsDir = path.resolve(skillsPathArg);
|
|
145
|
+
} else {
|
|
146
|
+
skillsDir = path.join(projectRoot, ".agent", "skills");
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
|
|
150
|
+
fail(`Skills directory not found: ${skillsDir}`);
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.log(`${BOLD}Tribunal — strengthen_skills.js${RESET}`);
|
|
155
|
+
if (dryRun) console.log(` ${YELLOW}DRY RUN — no files will be written${RESET}`);
|
|
156
|
+
console.log(`Skills dir: ${skillsDir}\n`);
|
|
157
|
+
|
|
158
|
+
const counts = { updated: 0, skipped: 0, error: 0 };
|
|
159
|
+
header("Strengthening Skills");
|
|
160
|
+
|
|
161
|
+
const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
162
|
+
dirs.sort((a, b) => a.name.localeCompare(b.name));
|
|
163
|
+
|
|
164
|
+
for (const dir of dirs) {
|
|
165
|
+
if (!dir.isDirectory()) continue;
|
|
166
|
+
if (skillArg && dir.name !== skillArg) continue;
|
|
167
|
+
|
|
168
|
+
const skillMd = path.join(skillsDir, dir.name, "SKILL.md");
|
|
169
|
+
if (!fs.existsSync(skillMd)) {
|
|
170
|
+
warn(`${dir.name} — no SKILL.md found`);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const result = processSkill(skillMd, dryRun);
|
|
175
|
+
counts[result]++;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
console.log(`\n${BOLD}━━━ Summary ━━━${RESET}`);
|
|
179
|
+
console.log(` ${GREEN}✅ Strengthened: ${counts.updated}${RESET}`);
|
|
180
|
+
console.log(` ${YELLOW}⏭️ Skipped: ${counts.skipped}${RESET}`);
|
|
181
|
+
if (counts.error > 0) {
|
|
182
|
+
console.log(` ${RED}❌ Errors: ${counts.error}${RESET}`);
|
|
183
|
+
}
|
|
184
|
+
if (dryRun) {
|
|
185
|
+
console.log(` ${YELLOW}(dry-run — nothing written)${RESET}`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
process.exit(counts.error > 0 ? 1 : 0);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (require.main === module) {
|
|
192
|
+
main();
|
|
193
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* strip_tribunal.js
|
|
4
|
+
*/
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
function stripBoilerplate(filePath) {
|
|
11
|
+
const original = fs.readFileSync(filePath, 'utf8');
|
|
12
|
+
const originalLen = Buffer.byteLength(original, 'utf8');
|
|
13
|
+
|
|
14
|
+
let content = original;
|
|
15
|
+
content = content.replace(/## 🏛️ Tribunal Integration[\s\S]*?(?=\n# |\Z)/g, '');
|
|
16
|
+
content = content.replace(/## Tribunal Integration[\s\S]*?(?=\n# |\Z)/g, '');
|
|
17
|
+
content = content.replace(/## Cross-Workflow Navigation[\s\S]*?(?=\n# |\Z)/g, '');
|
|
18
|
+
content = content.replace(/## What the Maker Is Not Allowed to Do[\s\S]*?(?=\n# |\Z)/g, '');
|
|
19
|
+
|
|
20
|
+
fs.writeFileSync(filePath, content.trim() + '\n', 'utf8');
|
|
21
|
+
const newLen = Buffer.byteLength(content.trim() + '\n', 'utf8');
|
|
22
|
+
|
|
23
|
+
return [originalLen, newLen];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function main() {
|
|
27
|
+
const dirsToCheck = ['.agent/agents', '.agent/workflows'];
|
|
28
|
+
let totalStripped = 0;
|
|
29
|
+
|
|
30
|
+
for (const d of dirsToCheck) {
|
|
31
|
+
if (!fs.existsSync(d)) continue;
|
|
32
|
+
const files = fs.readdirSync(d);
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
if (file.endsWith('.md')) {
|
|
35
|
+
const filePath = path.join(d, file);
|
|
36
|
+
const [orig, newL] = stripBoilerplate(filePath);
|
|
37
|
+
totalStripped += (orig - newL);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log(`Stripped ${totalStripped} bytes of repetitive boilerplate.`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (require.main === module) {
|
|
46
|
+
main();
|
|
47
|
+
}
|