tribunal-kit 4.3.1 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/agents/api-architect.md +66 -66
- package/.agent/agents/db-latency-auditor.md +216 -216
- package/.agent/agents/precedence-reviewer.md +250 -250
- package/.agent/agents/resilience-reviewer.md +88 -88
- package/.agent/agents/schema-reviewer.md +67 -67
- package/.agent/agents/throughput-optimizer.md +299 -299
- package/.agent/agents/ui-ux-auditor.md +292 -292
- package/.agent/agents/vitals-reviewer.md +223 -223
- package/.agent/scripts/_colors.js +18 -18
- package/.agent/scripts/_utils.js +42 -42
- package/.agent/scripts/append_flow.js +72 -72
- package/.agent/scripts/auto_preview.js +197 -197
- package/.agent/scripts/bundle_analyzer.js +290 -290
- package/.agent/scripts/case_law_manager.js +17 -6
- package/.agent/scripts/checklist.js +266 -266
- package/.agent/scripts/colors.js +17 -17
- package/.agent/scripts/compress_skills.js +141 -141
- package/.agent/scripts/consolidate_skills.js +149 -149
- package/.agent/scripts/context_broker.js +611 -609
- package/.agent/scripts/deep_compress.js +150 -150
- package/.agent/scripts/dependency_analyzer.js +272 -272
- package/.agent/scripts/graph_builder.js +151 -37
- package/.agent/scripts/graph_visualizer.js +384 -0
- package/.agent/scripts/inner_loop_validator.js +451 -465
- package/.agent/scripts/lint_runner.js +187 -187
- package/.agent/scripts/minify_context.js +100 -100
- package/.agent/scripts/mutation_runner.js +280 -0
- package/.agent/scripts/patch_skills_meta.js +156 -156
- package/.agent/scripts/patch_skills_output.js +244 -244
- package/.agent/scripts/schema_validator.js +297 -297
- package/.agent/scripts/security_scan.js +303 -303
- package/.agent/scripts/session_manager.js +276 -276
- package/.agent/scripts/skill_evolution.js +644 -644
- package/.agent/scripts/skill_integrator.js +313 -313
- package/.agent/scripts/strengthen_skills.js +193 -193
- package/.agent/scripts/strip_tribunal.js +47 -47
- package/.agent/scripts/swarm_dispatcher.js +360 -360
- package/.agent/scripts/test_runner.js +193 -193
- package/.agent/scripts/utils.js +32 -32
- package/.agent/scripts/verify_all.js +257 -256
- 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/doc.md +1 -1
- package/.agent/skills/knowledge-graph/SKILL.md +32 -16
- package/.agent/skills/testing-patterns/SKILL.md +19 -2
- package/.agent/skills/ui-ux-pro-max/SKILL.md +480 -43
- package/.agent/workflows/generate.md +183 -183
- package/.agent/workflows/tribunal-speed.md +183 -183
- package/README.md +1 -1
- package/bin/tribunal-kit.js +134 -17
- package/package.json +6 -3
- package/scripts/changelog.js +167 -167
- package/scripts/sync-version.js +81 -81
- 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/scripts/changelog.js
CHANGED
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* changelog.js — Auto-generate CHANGELOG from git history
|
|
4
|
-
*
|
|
5
|
-
* Categorizes commits by conventional commit type:
|
|
6
|
-
* feat: → ✨ Features
|
|
7
|
-
* fix: → 🐛 Bug Fixes
|
|
8
|
-
* perf: → ⚡ Performance
|
|
9
|
-
* docs: → 📝 Documentation
|
|
10
|
-
* test: → ✅ Tests
|
|
11
|
-
* refactor: → ♻️ Refactors
|
|
12
|
-
* chore: → 🔧 Chores
|
|
13
|
-
* BREAKING: → 💥 Breaking Changes
|
|
14
|
-
*
|
|
15
|
-
* Usage:
|
|
16
|
-
* node scripts/changelog.js → Generate full changelog
|
|
17
|
-
* node scripts/changelog.js --preview → Preview unreleased changes
|
|
18
|
-
* node scripts/changelog.js --since v4.1.0 → Changes since a specific tag
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
'use strict';
|
|
22
|
-
|
|
23
|
-
const { execSync } = require('child_process');
|
|
24
|
-
const fs = require('fs');
|
|
25
|
-
const path = require('path');
|
|
26
|
-
|
|
27
|
-
const PKG = require(path.resolve(__dirname, '..', 'package.json'));
|
|
28
|
-
const CHANGELOG_PATH = path.resolve(__dirname, '..', 'CHANGELOG.md');
|
|
29
|
-
|
|
30
|
-
// ── Commit Categories ────────────────────────────────────
|
|
31
|
-
const CATEGORIES = {
|
|
32
|
-
feat: { emoji: '✨', title: 'Features' },
|
|
33
|
-
fix: { emoji: '🐛', title: 'Bug Fixes' },
|
|
34
|
-
perf: { emoji: '⚡', title: 'Performance' },
|
|
35
|
-
docs: { emoji: '📝', title: 'Documentation' },
|
|
36
|
-
test: { emoji: '✅', title: 'Tests' },
|
|
37
|
-
refactor: { emoji: '♻️', title: 'Refactors' },
|
|
38
|
-
chore: { emoji: '🔧', title: 'Chores' },
|
|
39
|
-
ci: { emoji: '🏗️', title: 'CI/CD' },
|
|
40
|
-
style: { emoji: '🎨', title: 'Style' },
|
|
41
|
-
breaking: { emoji: '💥', title: 'Breaking Changes' },
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// ── Git Helpers ──────────────────────────────────────────
|
|
45
|
-
function git(cmd) {
|
|
46
|
-
try {
|
|
47
|
-
return execSync(`git ${cmd}`, { encoding: 'utf8', timeout: 10000 }).trim();
|
|
48
|
-
} catch {
|
|
49
|
-
return '';
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function getLatestTag() {
|
|
54
|
-
return git('describe --tags --abbrev=0 2>nul') || git('describe --tags --abbrev=0 2>/dev/null') || '';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function getCommits(since) {
|
|
58
|
-
const range = since ? `${since}..HEAD` : 'HEAD';
|
|
59
|
-
const format = '--format="%H||%s||%an||%ai"';
|
|
60
|
-
const raw = git(`log ${range} ${format} --no-merges`);
|
|
61
|
-
if (!raw) return [];
|
|
62
|
-
|
|
63
|
-
return raw.split('\n').filter(Boolean).map(line => {
|
|
64
|
-
const [hash, subject, author, date] = line.split('||');
|
|
65
|
-
return { hash: hash?.slice(0, 7), subject, author, date: date?.slice(0, 10) };
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function categorize(subject) {
|
|
70
|
-
const lower = subject.toLowerCase();
|
|
71
|
-
|
|
72
|
-
// Check for BREAKING CHANGE
|
|
73
|
-
if (lower.includes('breaking') || lower.includes('!:')) {
|
|
74
|
-
return 'breaking';
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Match conventional commit prefix
|
|
78
|
-
const match = subject.match(/^(\w+)(?:\(.+?\))?:\s*/);
|
|
79
|
-
if (match) {
|
|
80
|
-
const type = match[1].toLowerCase();
|
|
81
|
-
if (CATEGORIES[type]) return type;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Heuristic fallback
|
|
85
|
-
if (lower.includes('fix') || lower.includes('bug')) return 'fix';
|
|
86
|
-
if (lower.includes('add') || lower.includes('new') || lower.includes('feat')) return 'feat';
|
|
87
|
-
if (lower.includes('doc') || lower.includes('readme')) return 'docs';
|
|
88
|
-
if (lower.includes('test')) return 'test';
|
|
89
|
-
if (lower.includes('refactor') || lower.includes('clean')) return 'refactor';
|
|
90
|
-
if (lower.includes('perf') || lower.includes('optim')) return 'perf';
|
|
91
|
-
if (lower.includes('ci') || lower.includes('workflow')) return 'ci';
|
|
92
|
-
|
|
93
|
-
return 'chore';
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// ── Changelog Generation ─────────────────────────────────
|
|
97
|
-
function generateChangelog(commits, version, date) {
|
|
98
|
-
const grouped = {};
|
|
99
|
-
for (const commit of commits) {
|
|
100
|
-
const cat = categorize(commit.subject);
|
|
101
|
-
if (!grouped[cat]) grouped[cat] = [];
|
|
102
|
-
// Strip conventional prefix for cleaner display
|
|
103
|
-
const clean = commit.subject.replace(/^\w+(\(.+?\))?:\s*/, '');
|
|
104
|
-
grouped[cat].push({ ...commit, clean });
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
let md = `## [${version}] — ${date}\n\n`;
|
|
108
|
-
|
|
109
|
-
// Breaking changes first
|
|
110
|
-
const order = ['breaking', 'feat', 'fix', 'perf', 'refactor', 'docs', 'test', 'ci', 'style', 'chore'];
|
|
111
|
-
for (const cat of order) {
|
|
112
|
-
if (!grouped[cat] || grouped[cat].length === 0) continue;
|
|
113
|
-
const { emoji, title } = CATEGORIES[cat];
|
|
114
|
-
md += `### ${emoji} ${title}\n\n`;
|
|
115
|
-
for (const c of grouped[cat]) {
|
|
116
|
-
md += `- ${c.clean} (\`${c.hash}\`)\n`;
|
|
117
|
-
}
|
|
118
|
-
md += '\n';
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return md;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// ── Main ─────────────────────────────────────────────────
|
|
125
|
-
function main() {
|
|
126
|
-
const args = process.argv.slice(2);
|
|
127
|
-
const isPreview = args.includes('--preview');
|
|
128
|
-
const sinceIdx = args.indexOf('--since');
|
|
129
|
-
const sinceTag = sinceIdx !== -1 ? args[sinceIdx + 1] : null;
|
|
130
|
-
|
|
131
|
-
const since = sinceTag || getLatestTag();
|
|
132
|
-
const commits = getCommits(since);
|
|
133
|
-
|
|
134
|
-
if (commits.length === 0) {
|
|
135
|
-
console.log(' ℹ️ No new commits found since', since || 'beginning');
|
|
136
|
-
process.exit(0);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
140
|
-
const version = isPreview ? 'Unreleased' : PKG.version;
|
|
141
|
-
|
|
142
|
-
const changelog = generateChangelog(commits, version, today);
|
|
143
|
-
|
|
144
|
-
if (isPreview) {
|
|
145
|
-
console.log('\n 📋 Changelog Preview\n ' + '─'.repeat(40) + '\n');
|
|
146
|
-
console.log(changelog);
|
|
147
|
-
console.log(` 📊 ${commits.length} commits since ${since || 'initial commit'}`);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Write or prepend to CHANGELOG.md
|
|
152
|
-
const header = `# Changelog\n\nAll notable changes to Tribunal Kit are documented here.\nFormat follows [Keep a Changelog](https://keepachangelog.com/).\n\n`;
|
|
153
|
-
|
|
154
|
-
let existing = '';
|
|
155
|
-
if (fs.existsSync(CHANGELOG_PATH)) {
|
|
156
|
-
existing = fs.readFileSync(CHANGELOG_PATH, 'utf8');
|
|
157
|
-
// Remove existing header
|
|
158
|
-
existing = existing.replace(/^# Changelog[\s\S]*?(?=## )/, '');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const full = header + changelog + existing;
|
|
162
|
-
fs.writeFileSync(CHANGELOG_PATH, full, 'utf8');
|
|
163
|
-
|
|
164
|
-
console.log(` ✔ CHANGELOG.md updated — v${version} (${commits.length} commits)`);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* changelog.js — Auto-generate CHANGELOG from git history
|
|
4
|
+
*
|
|
5
|
+
* Categorizes commits by conventional commit type:
|
|
6
|
+
* feat: → ✨ Features
|
|
7
|
+
* fix: → 🐛 Bug Fixes
|
|
8
|
+
* perf: → ⚡ Performance
|
|
9
|
+
* docs: → 📝 Documentation
|
|
10
|
+
* test: → ✅ Tests
|
|
11
|
+
* refactor: → ♻️ Refactors
|
|
12
|
+
* chore: → 🔧 Chores
|
|
13
|
+
* BREAKING: → 💥 Breaking Changes
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* node scripts/changelog.js → Generate full changelog
|
|
17
|
+
* node scripts/changelog.js --preview → Preview unreleased changes
|
|
18
|
+
* node scripts/changelog.js --since v4.1.0 → Changes since a specific tag
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
'use strict';
|
|
22
|
+
|
|
23
|
+
const { execSync } = require('child_process');
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
|
|
27
|
+
const PKG = require(path.resolve(__dirname, '..', 'package.json'));
|
|
28
|
+
const CHANGELOG_PATH = path.resolve(__dirname, '..', 'CHANGELOG.md');
|
|
29
|
+
|
|
30
|
+
// ── Commit Categories ────────────────────────────────────
|
|
31
|
+
const CATEGORIES = {
|
|
32
|
+
feat: { emoji: '✨', title: 'Features' },
|
|
33
|
+
fix: { emoji: '🐛', title: 'Bug Fixes' },
|
|
34
|
+
perf: { emoji: '⚡', title: 'Performance' },
|
|
35
|
+
docs: { emoji: '📝', title: 'Documentation' },
|
|
36
|
+
test: { emoji: '✅', title: 'Tests' },
|
|
37
|
+
refactor: { emoji: '♻️', title: 'Refactors' },
|
|
38
|
+
chore: { emoji: '🔧', title: 'Chores' },
|
|
39
|
+
ci: { emoji: '🏗️', title: 'CI/CD' },
|
|
40
|
+
style: { emoji: '🎨', title: 'Style' },
|
|
41
|
+
breaking: { emoji: '💥', title: 'Breaking Changes' },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// ── Git Helpers ──────────────────────────────────────────
|
|
45
|
+
function git(cmd) {
|
|
46
|
+
try {
|
|
47
|
+
return execSync(`git ${cmd}`, { encoding: 'utf8', timeout: 10000 }).trim();
|
|
48
|
+
} catch {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function getLatestTag() {
|
|
54
|
+
return git('describe --tags --abbrev=0 2>nul') || git('describe --tags --abbrev=0 2>/dev/null') || '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function getCommits(since) {
|
|
58
|
+
const range = since ? `${since}..HEAD` : 'HEAD';
|
|
59
|
+
const format = '--format="%H||%s||%an||%ai"';
|
|
60
|
+
const raw = git(`log ${range} ${format} --no-merges`);
|
|
61
|
+
if (!raw) return [];
|
|
62
|
+
|
|
63
|
+
return raw.split('\n').filter(Boolean).map(line => {
|
|
64
|
+
const [hash, subject, author, date] = line.split('||');
|
|
65
|
+
return { hash: hash?.slice(0, 7), subject, author, date: date?.slice(0, 10) };
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function categorize(subject) {
|
|
70
|
+
const lower = subject.toLowerCase();
|
|
71
|
+
|
|
72
|
+
// Check for BREAKING CHANGE
|
|
73
|
+
if (lower.includes('breaking') || lower.includes('!:')) {
|
|
74
|
+
return 'breaking';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Match conventional commit prefix
|
|
78
|
+
const match = subject.match(/^(\w+)(?:\(.+?\))?:\s*/);
|
|
79
|
+
if (match) {
|
|
80
|
+
const type = match[1].toLowerCase();
|
|
81
|
+
if (CATEGORIES[type]) return type;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Heuristic fallback
|
|
85
|
+
if (lower.includes('fix') || lower.includes('bug')) return 'fix';
|
|
86
|
+
if (lower.includes('add') || lower.includes('new') || lower.includes('feat')) return 'feat';
|
|
87
|
+
if (lower.includes('doc') || lower.includes('readme')) return 'docs';
|
|
88
|
+
if (lower.includes('test')) return 'test';
|
|
89
|
+
if (lower.includes('refactor') || lower.includes('clean')) return 'refactor';
|
|
90
|
+
if (lower.includes('perf') || lower.includes('optim')) return 'perf';
|
|
91
|
+
if (lower.includes('ci') || lower.includes('workflow')) return 'ci';
|
|
92
|
+
|
|
93
|
+
return 'chore';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ── Changelog Generation ─────────────────────────────────
|
|
97
|
+
function generateChangelog(commits, version, date) {
|
|
98
|
+
const grouped = {};
|
|
99
|
+
for (const commit of commits) {
|
|
100
|
+
const cat = categorize(commit.subject);
|
|
101
|
+
if (!grouped[cat]) grouped[cat] = [];
|
|
102
|
+
// Strip conventional prefix for cleaner display
|
|
103
|
+
const clean = commit.subject.replace(/^\w+(\(.+?\))?:\s*/, '');
|
|
104
|
+
grouped[cat].push({ ...commit, clean });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let md = `## [${version}] — ${date}\n\n`;
|
|
108
|
+
|
|
109
|
+
// Breaking changes first
|
|
110
|
+
const order = ['breaking', 'feat', 'fix', 'perf', 'refactor', 'docs', 'test', 'ci', 'style', 'chore'];
|
|
111
|
+
for (const cat of order) {
|
|
112
|
+
if (!grouped[cat] || grouped[cat].length === 0) continue;
|
|
113
|
+
const { emoji, title } = CATEGORIES[cat];
|
|
114
|
+
md += `### ${emoji} ${title}\n\n`;
|
|
115
|
+
for (const c of grouped[cat]) {
|
|
116
|
+
md += `- ${c.clean} (\`${c.hash}\`)\n`;
|
|
117
|
+
}
|
|
118
|
+
md += '\n';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return md;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ── Main ─────────────────────────────────────────────────
|
|
125
|
+
function main() {
|
|
126
|
+
const args = process.argv.slice(2);
|
|
127
|
+
const isPreview = args.includes('--preview');
|
|
128
|
+
const sinceIdx = args.indexOf('--since');
|
|
129
|
+
const sinceTag = sinceIdx !== -1 ? args[sinceIdx + 1] : null;
|
|
130
|
+
|
|
131
|
+
const since = sinceTag || getLatestTag();
|
|
132
|
+
const commits = getCommits(since);
|
|
133
|
+
|
|
134
|
+
if (commits.length === 0) {
|
|
135
|
+
console.log(' ℹ️ No new commits found since', since || 'beginning');
|
|
136
|
+
process.exit(0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
140
|
+
const version = isPreview ? 'Unreleased' : PKG.version;
|
|
141
|
+
|
|
142
|
+
const changelog = generateChangelog(commits, version, today);
|
|
143
|
+
|
|
144
|
+
if (isPreview) {
|
|
145
|
+
console.log('\n 📋 Changelog Preview\n ' + '─'.repeat(40) + '\n');
|
|
146
|
+
console.log(changelog);
|
|
147
|
+
console.log(` 📊 ${commits.length} commits since ${since || 'initial commit'}`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Write or prepend to CHANGELOG.md
|
|
152
|
+
const header = `# Changelog\n\nAll notable changes to Tribunal Kit are documented here.\nFormat follows [Keep a Changelog](https://keepachangelog.com/).\n\n`;
|
|
153
|
+
|
|
154
|
+
let existing = '';
|
|
155
|
+
if (fs.existsSync(CHANGELOG_PATH)) {
|
|
156
|
+
existing = fs.readFileSync(CHANGELOG_PATH, 'utf8');
|
|
157
|
+
// Remove existing header
|
|
158
|
+
existing = existing.replace(/^# Changelog[\s\S]*?(?=## )/, '');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const full = header + changelog + existing;
|
|
162
|
+
fs.writeFileSync(CHANGELOG_PATH, full, 'utf8');
|
|
163
|
+
|
|
164
|
+
console.log(` ✔ CHANGELOG.md updated — v${version} (${commits.length} commits)`);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
main();
|
package/scripts/sync-version.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* sync-version.js — Version Sync for Tribunal Kit
|
|
4
|
-
*
|
|
5
|
-
* Reads the version and counts from package.json and the .agent/ directory,
|
|
6
|
-
* then updates all stale references across documentation files.
|
|
7
|
-
*
|
|
8
|
-
* Run manually or as a preversion npm script:
|
|
9
|
-
* node scripts/sync-version.js
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const fs = require('fs');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
|
|
15
|
-
const ROOT = path.resolve(__dirname, '..');
|
|
16
|
-
const PKG = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
17
|
-
|
|
18
|
-
// Count actual installed items
|
|
19
|
-
function countItems(dir) {
|
|
20
|
-
const fullPath = path.join(ROOT, '.agent', dir);
|
|
21
|
-
if (!fs.existsSync(fullPath)) return '?';
|
|
22
|
-
return fs.readdirSync(fullPath).filter(f => !f.startsWith('.')).length;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const version = PKG.version;
|
|
26
|
-
const agents = countItems('agents');
|
|
27
|
-
const skills = countItems('skills');
|
|
28
|
-
const workflows = countItems('workflows');
|
|
29
|
-
const scripts = countItems('scripts');
|
|
30
|
-
|
|
31
|
-
console.log(`\n 📊 Tribunal Kit v${version} — Actual Counts`);
|
|
32
|
-
console.log(` ──────────────────────────────────────`);
|
|
33
|
-
console.log(` Agents: ${agents}`);
|
|
34
|
-
console.log(` Skills: ${skills}`);
|
|
35
|
-
console.log(` Workflows: ${workflows}`);
|
|
36
|
-
console.log(` Scripts: ${scripts}`);
|
|
37
|
-
console.log();
|
|
38
|
-
|
|
39
|
-
// Files to check for stale numbers
|
|
40
|
-
const FILES_TO_CHECK = [
|
|
41
|
-
'README.md',
|
|
42
|
-
'AGENT_FLOW.md',
|
|
43
|
-
'.agent/ARCHITECTURE.md',
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
let staleFound = 0;
|
|
47
|
-
|
|
48
|
-
for (const relPath of FILES_TO_CHECK) {
|
|
49
|
-
const filePath = path.join(ROOT, relPath);
|
|
50
|
-
if (!fs.existsSync(filePath)) continue;
|
|
51
|
-
|
|
52
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
53
|
-
|
|
54
|
-
// Check for common stale patterns
|
|
55
|
-
const checks = [
|
|
56
|
-
{ regex: /(\d+)\s*(specialist\s+)?agents/gi, expected: agents, label: 'agents' },
|
|
57
|
-
{ regex: /(\d+)\s*skill\s*modules/gi, expected: skills, label: 'skills' },
|
|
58
|
-
{ regex: /(\d+)\s*slash\s*command/gi, expected: workflows, label: 'workflows' },
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
for (const check of checks) {
|
|
62
|
-
let match;
|
|
63
|
-
while ((match = check.regex.exec(content)) !== null) {
|
|
64
|
-
const found = parseInt(match[1]);
|
|
65
|
-
if (found !== check.expected && found > 5) { // ignore tiny numbers
|
|
66
|
-
staleFound++;
|
|
67
|
-
const line = content.substring(0, match.index).split('\n').length;
|
|
68
|
-
console.log(` ⚠️ ${relPath}:${line} — says ${found} ${check.label}, actual is ${check.expected}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (staleFound === 0) {
|
|
75
|
-
console.log(` ✅ All counts are in sync across ${FILES_TO_CHECK.length} files.`);
|
|
76
|
-
} else {
|
|
77
|
-
console.log(`\n ❌ Found ${staleFound} stale reference(s). Update manually or run the sync tool.`);
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
console.log();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* sync-version.js — Version Sync for Tribunal Kit
|
|
4
|
+
*
|
|
5
|
+
* Reads the version and counts from package.json and the .agent/ directory,
|
|
6
|
+
* then updates all stale references across documentation files.
|
|
7
|
+
*
|
|
8
|
+
* Run manually or as a preversion npm script:
|
|
9
|
+
* node scripts/sync-version.js
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
16
|
+
const PKG = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
|
|
17
|
+
|
|
18
|
+
// Count actual installed items
|
|
19
|
+
function countItems(dir) {
|
|
20
|
+
const fullPath = path.join(ROOT, '.agent', dir);
|
|
21
|
+
if (!fs.existsSync(fullPath)) return '?';
|
|
22
|
+
return fs.readdirSync(fullPath).filter(f => !f.startsWith('.')).length;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const version = PKG.version;
|
|
26
|
+
const agents = countItems('agents');
|
|
27
|
+
const skills = countItems('skills');
|
|
28
|
+
const workflows = countItems('workflows');
|
|
29
|
+
const scripts = countItems('scripts');
|
|
30
|
+
|
|
31
|
+
console.log(`\n 📊 Tribunal Kit v${version} — Actual Counts`);
|
|
32
|
+
console.log(` ──────────────────────────────────────`);
|
|
33
|
+
console.log(` Agents: ${agents}`);
|
|
34
|
+
console.log(` Skills: ${skills}`);
|
|
35
|
+
console.log(` Workflows: ${workflows}`);
|
|
36
|
+
console.log(` Scripts: ${scripts}`);
|
|
37
|
+
console.log();
|
|
38
|
+
|
|
39
|
+
// Files to check for stale numbers
|
|
40
|
+
const FILES_TO_CHECK = [
|
|
41
|
+
'README.md',
|
|
42
|
+
'AGENT_FLOW.md',
|
|
43
|
+
'.agent/ARCHITECTURE.md',
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
let staleFound = 0;
|
|
47
|
+
|
|
48
|
+
for (const relPath of FILES_TO_CHECK) {
|
|
49
|
+
const filePath = path.join(ROOT, relPath);
|
|
50
|
+
if (!fs.existsSync(filePath)) continue;
|
|
51
|
+
|
|
52
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
53
|
+
|
|
54
|
+
// Check for common stale patterns
|
|
55
|
+
const checks = [
|
|
56
|
+
{ regex: /(\d+)\s*(specialist\s+)?agents/gi, expected: agents, label: 'agents' },
|
|
57
|
+
{ regex: /(\d+)\s*skill\s*modules/gi, expected: skills, label: 'skills' },
|
|
58
|
+
{ regex: /(\d+)\s*slash\s*command/gi, expected: workflows, label: 'workflows' },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
for (const check of checks) {
|
|
62
|
+
let match;
|
|
63
|
+
while ((match = check.regex.exec(content)) !== null) {
|
|
64
|
+
const found = parseInt(match[1]);
|
|
65
|
+
if (found !== check.expected && found > 5) { // ignore tiny numbers
|
|
66
|
+
staleFound++;
|
|
67
|
+
const line = content.substring(0, match.index).split('\n').length;
|
|
68
|
+
console.log(` ⚠️ ${relPath}:${line} — says ${found} ${check.label}, actual is ${check.expected}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (staleFound === 0) {
|
|
75
|
+
console.log(` ✅ All counts are in sync across ${FILES_TO_CHECK.length} files.`);
|
|
76
|
+
} else {
|
|
77
|
+
console.log(`\n ❌ Found ${staleFound} stale reference(s). Update manually or run the sync tool.`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
console.log();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|