tribunal-kit 4.3.1 → 4.4.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/history/architecture-explorer.html +352 -0
- package/.agent/history/architecture-graph.yaml +109 -0
- package/.agent/history/graph-cache.json +215 -0
- package/.agent/history/snapshots/migrate_refs.js.json +11 -0
- package/.agent/history/snapshots/scripts__changelog.js.json +12 -0
- package/.agent/history/snapshots/scripts__sync-version.js.json +11 -0
- package/.agent/history/snapshots/scripts__validate-payload.js.json +11 -0
- package/.agent/history/snapshots/test__integration__bridges.test.js.json +13 -0
- package/.agent/history/snapshots/test__integration__init.test.js.json +13 -0
- package/.agent/history/snapshots/test__integration__routing.test.js.json +11 -0
- package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +13 -0
- package/.agent/history/snapshots/test__integration__wave2.test.js.json +13 -0
- package/.agent/history/snapshots/test__unit__args.test.js.json +10 -0
- package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +10 -0
- package/.agent/history/snapshots/test__unit__copyDir.test.js.json +13 -0
- package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +11 -0
- package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +13 -0
- package/.agent/history/snapshots/test__unit__semver.test.js.json +10 -0
- package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +11 -0
- package/.agent/scripts/dependency_analyzer.js +1 -1
- package/.agent/scripts/graph_builder.js +311 -199
- package/.agent/scripts/graph_visualizer.js +384 -0
- package/.agent/scripts/mutation_runner.js +280 -0
- package/.agent/skills/knowledge-graph/SKILL.md +52 -36
- package/.agent/skills/testing-patterns/SKILL.md +19 -2
- package/.agent/skills/ui-ux-pro-max/SKILL.md +562 -125
- package/bin/tribunal-kit.js +129 -1
- package/package.json +1 -1
package/bin/tribunal-kit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* tribunal-kit CLI (alias: tk)
|
|
4
4
|
*
|
|
@@ -745,6 +745,15 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
745
745
|
case 'hook':
|
|
746
746
|
cmdHook(flags);
|
|
747
747
|
break;
|
|
748
|
+
case 'graph':
|
|
749
|
+
cmdGraph(flags);
|
|
750
|
+
break;
|
|
751
|
+
case 'mutate':
|
|
752
|
+
cmdMutate(flags);
|
|
753
|
+
break;
|
|
754
|
+
case 'context':
|
|
755
|
+
cmdContext(flags);
|
|
756
|
+
break;
|
|
748
757
|
case 'uninstall':
|
|
749
758
|
cmdUninstall(flags);
|
|
750
759
|
break;
|
|
@@ -804,6 +813,34 @@ function cmdCase(flags) {
|
|
|
804
813
|
}
|
|
805
814
|
}
|
|
806
815
|
|
|
816
|
+
function cmdGraph(flags) {
|
|
817
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
818
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
819
|
+
|
|
820
|
+
if (!fs.existsSync(agentDest)) {
|
|
821
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
822
|
+
process.exit(1);
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
banner();
|
|
826
|
+
const { execSync } = require('child_process');
|
|
827
|
+
const builderScript = path.join(agentDest, 'scripts', 'graph_builder.js');
|
|
828
|
+
const visualizerScript = path.join(agentDest, 'scripts', 'graph_visualizer.js');
|
|
829
|
+
const htmlFile = path.join(agentDest, 'history', 'architecture-explorer.html');
|
|
830
|
+
|
|
831
|
+
try {
|
|
832
|
+
execSync(`node "${builderScript}"`, { stdio: 'inherit', cwd: targetDir });
|
|
833
|
+
execSync(`node "${visualizerScript}"`, { stdio: 'inherit', cwd: targetDir });
|
|
834
|
+
|
|
835
|
+
log(` ${c('cyan', '▸')} Opening visualizer in browser...`);
|
|
836
|
+
const opener = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
837
|
+
execSync(`${opener} "${htmlFile}"`);
|
|
838
|
+
} catch (e) {
|
|
839
|
+
err(`Graph generation failed: ${e.message}`);
|
|
840
|
+
process.exit(1);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
807
844
|
function cmdHook(flags) {
|
|
808
845
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
809
846
|
const gitDir = path.join(targetDir, '.git');
|
|
@@ -829,6 +866,30 @@ function cmdHook(flags) {
|
|
|
829
866
|
console.log();
|
|
830
867
|
}
|
|
831
868
|
|
|
869
|
+
function cmdMutate(flags) {
|
|
870
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
871
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
872
|
+
|
|
873
|
+
if (!fs.existsSync(agentDest)) {
|
|
874
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
875
|
+
process.exit(1);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
const args = process.argv.slice(3);
|
|
879
|
+
if (args.length < 2) {
|
|
880
|
+
err('Usage: npx tribunal-kit mutate <target_file> <test_command>');
|
|
881
|
+
process.exit(1);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
const mutateScript = path.join(agentDest, 'scripts', 'mutation_runner.js');
|
|
885
|
+
const { execSync } = require('child_process');
|
|
886
|
+
try {
|
|
887
|
+
execSync(`node "${mutateScript}" ${args.join(' ')}`, { stdio: 'inherit', cwd: targetDir });
|
|
888
|
+
} catch (e) {
|
|
889
|
+
process.exit(1);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
832
893
|
function cmdUninstall(flags) {
|
|
833
894
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
834
895
|
const agentDest = path.join(targetDir, '.agent');
|
|
@@ -903,6 +964,9 @@ function cmdHelp() {
|
|
|
903
964
|
log(cmd('status', 'Check if .agent/ is installed'));
|
|
904
965
|
log(cmd('learn', 'Evolve project idioms based on git diffs'));
|
|
905
966
|
log(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
|
|
967
|
+
log(cmd('graph', 'Build and visualize the architecture graph'));
|
|
968
|
+
log(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
|
|
969
|
+
log(cmd('context', 'Retrieve a highly-optimized Context Snapshot for a file'));
|
|
906
970
|
log(cmd('hook', 'Install pre-push git hook for auto-learning'));
|
|
907
971
|
log(cmd('uninstall','Remove .agent/ folder from project'));
|
|
908
972
|
console.log();
|
|
@@ -939,11 +1003,75 @@ function cmdHelp() {
|
|
|
939
1003
|
log(ex('tk case stats'));
|
|
940
1004
|
log(ex('tk case export'));
|
|
941
1005
|
log(ex('tk case overrule --id 1'));
|
|
1006
|
+
log(ex('tk graph'));
|
|
1007
|
+
log(ex('tk mutate src/utils.js "npm test"'));
|
|
942
1008
|
log(ex('tk hook'));
|
|
943
1009
|
log(ex('tk uninstall'));
|
|
944
1010
|
console.log();
|
|
945
1011
|
}
|
|
946
1012
|
|
|
1013
|
+
|
|
1014
|
+
function cmdContext(flags) {
|
|
1015
|
+
const targetDir = flags.path ? require('path').resolve(flags.path) : process.cwd();
|
|
1016
|
+
const agentDest = require('path').join(targetDir, '.agent');
|
|
1017
|
+
|
|
1018
|
+
if (!require('fs').existsSync(agentDest)) {
|
|
1019
|
+
console.error(' \x1b[91m✖\x1b[0m .agent/ not found. Run: npx tribunal-kit init');
|
|
1020
|
+
process.exit(1);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
const args = process.argv.slice(3);
|
|
1024
|
+
if (args.length === 0 || args[0] === 'help' || args[0] === '--help') {
|
|
1025
|
+
console.error('Usage: npx tribunal-kit context <target_file>');
|
|
1026
|
+
process.exit(1);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
const targetFile = args[0].replace(/\\/g, '/');
|
|
1030
|
+
const snapshotName = targetFile.replace(/[\\\/]/g, '__') + '.json';
|
|
1031
|
+
const snapshotPath = require('path').join(agentDest, 'history', 'snapshots', snapshotName);
|
|
1032
|
+
|
|
1033
|
+
if (!require('fs').existsSync(snapshotPath)) {
|
|
1034
|
+
console.error(' \x1b[91m✖\x1b[0m Context Snapshot not found for: ' + targetFile);
|
|
1035
|
+
console.log(' Run: npx tribunal-kit graph (to generate snapshots)');
|
|
1036
|
+
process.exit(1);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
try {
|
|
1040
|
+
const snapshot = JSON.parse(require('fs').readFileSync(snapshotPath, 'utf8'));
|
|
1041
|
+
|
|
1042
|
+
console.log('\n# Context Snapshot: ' + snapshot.file);
|
|
1043
|
+
process.stdout.write('> Size Estimate: ' + (snapshot['estimatedTokens'] || 'Unknown') + '\n');
|
|
1044
|
+
console.log('> Risk Score: ' + snapshot.riskScore + ' (Blast Radius: ' + snapshot.blastRadius + ')\n');
|
|
1045
|
+
|
|
1046
|
+
if (Object.keys(snapshot.imports).length > 0) {
|
|
1047
|
+
console.log('## Imports');
|
|
1048
|
+
for (const [imp, exports] of Object.entries(snapshot.imports)) {
|
|
1049
|
+
if (exports && exports.length > 0) {
|
|
1050
|
+
console.log('- `' + imp + '` (exports: ' + exports.join(', ') + ')');
|
|
1051
|
+
} else {
|
|
1052
|
+
console.log('- `' + imp + '`');
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
console.log();
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
if (snapshot.dependents && snapshot.dependents.length > 0) {
|
|
1059
|
+
console.log('## Dependents');
|
|
1060
|
+
for (const dep of snapshot.dependents) {
|
|
1061
|
+
console.log('- `' + dep + '`');
|
|
1062
|
+
}
|
|
1063
|
+
console.log();
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
console.log('## Source Code');
|
|
1067
|
+
console.log('```javascript\n' + snapshot.content + '\n```\n');
|
|
1068
|
+
|
|
1069
|
+
} catch (e) {
|
|
1070
|
+
console.error('Failed to read snapshot: ' + e.message);
|
|
1071
|
+
process.exit(1);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
|
|
947
1075
|
// ── Main ──────────────────────────────────────────────────
|
|
948
1076
|
const { command, flags } = parseArgs(process.argv);
|
|
949
1077
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tribunal-kit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Anti-Hallucination AI Agent Kit — 40 specialist agents, 31 slash commands, 16 parallel Tribunal reviewers, Performance Swarm engine, and Supreme Court case law pipeline.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|