tribunal-kit 4.4.0 → 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.
Files changed (85) hide show
  1. package/.agent/agents/api-architect.md +66 -66
  2. package/.agent/agents/db-latency-auditor.md +216 -216
  3. package/.agent/agents/precedence-reviewer.md +250 -250
  4. package/.agent/agents/resilience-reviewer.md +88 -88
  5. package/.agent/agents/schema-reviewer.md +67 -67
  6. package/.agent/agents/throughput-optimizer.md +299 -299
  7. package/.agent/agents/ui-ux-auditor.md +292 -292
  8. package/.agent/agents/vitals-reviewer.md +223 -223
  9. package/.agent/scripts/_colors.js +18 -18
  10. package/.agent/scripts/_utils.js +42 -42
  11. package/.agent/scripts/append_flow.js +72 -72
  12. package/.agent/scripts/auto_preview.js +197 -197
  13. package/.agent/scripts/bundle_analyzer.js +290 -290
  14. package/.agent/scripts/case_law_manager.js +17 -6
  15. package/.agent/scripts/checklist.js +266 -266
  16. package/.agent/scripts/colors.js +17 -17
  17. package/.agent/scripts/compress_skills.js +141 -141
  18. package/.agent/scripts/consolidate_skills.js +149 -149
  19. package/.agent/scripts/context_broker.js +611 -609
  20. package/.agent/scripts/deep_compress.js +150 -150
  21. package/.agent/scripts/dependency_analyzer.js +272 -272
  22. package/.agent/scripts/graph_builder.js +313 -311
  23. package/.agent/scripts/graph_visualizer.js +384 -384
  24. package/.agent/scripts/inner_loop_validator.js +451 -465
  25. package/.agent/scripts/lint_runner.js +187 -187
  26. package/.agent/scripts/minify_context.js +100 -100
  27. package/.agent/scripts/mutation_runner.js +280 -280
  28. package/.agent/scripts/patch_skills_meta.js +156 -156
  29. package/.agent/scripts/patch_skills_output.js +244 -244
  30. package/.agent/scripts/schema_validator.js +297 -297
  31. package/.agent/scripts/security_scan.js +303 -303
  32. package/.agent/scripts/session_manager.js +276 -276
  33. package/.agent/scripts/skill_evolution.js +644 -644
  34. package/.agent/scripts/skill_integrator.js +313 -313
  35. package/.agent/scripts/strengthen_skills.js +193 -193
  36. package/.agent/scripts/strip_tribunal.js +47 -47
  37. package/.agent/scripts/swarm_dispatcher.js +360 -360
  38. package/.agent/scripts/test_runner.js +193 -193
  39. package/.agent/scripts/utils.js +32 -32
  40. package/.agent/scripts/verify_all.js +257 -256
  41. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
  42. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
  43. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
  44. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
  45. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
  46. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
  47. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
  48. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
  49. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
  50. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
  51. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
  52. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
  53. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
  54. package/.agent/skills/doc.md +1 -1
  55. package/.agent/skills/knowledge-graph/SKILL.md +52 -52
  56. package/.agent/skills/ui-ux-pro-max/SKILL.md +562 -562
  57. package/.agent/workflows/generate.md +183 -183
  58. package/.agent/workflows/tribunal-speed.md +183 -183
  59. package/README.md +1 -1
  60. package/bin/tribunal-kit.js +76 -87
  61. package/package.json +6 -3
  62. package/scripts/changelog.js +167 -167
  63. package/scripts/sync-version.js +81 -81
  64. package/.agent/history/architecture-explorer.html +0 -352
  65. package/.agent/history/architecture-graph.yaml +0 -109
  66. package/.agent/history/graph-cache.json +0 -215
  67. package/.agent/history/snapshots/migrate_refs.js.json +0 -11
  68. package/.agent/history/snapshots/scripts__changelog.js.json +0 -12
  69. package/.agent/history/snapshots/scripts__sync-version.js.json +0 -11
  70. package/.agent/history/snapshots/scripts__validate-payload.js.json +0 -11
  71. package/.agent/history/snapshots/test__integration__bridges.test.js.json +0 -13
  72. package/.agent/history/snapshots/test__integration__init.test.js.json +0 -13
  73. package/.agent/history/snapshots/test__integration__routing.test.js.json +0 -11
  74. package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +0 -13
  75. package/.agent/history/snapshots/test__integration__wave2.test.js.json +0 -13
  76. package/.agent/history/snapshots/test__unit__args.test.js.json +0 -10
  77. package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +0 -10
  78. package/.agent/history/snapshots/test__unit__copyDir.test.js.json +0 -13
  79. package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +0 -11
  80. package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +0 -13
  81. package/.agent/history/snapshots/test__unit__semver.test.js.json +0 -10
  82. package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +0 -11
  83. package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
  84. package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
  85. package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
@@ -1,193 +1,193 @@
1
- #!/usr/bin/env node
2
- /**
3
- * test_runner.js — Standalone test runner for the Tribunal Agent Kit.
4
- *
5
- * Usage:
6
- * node .agent/scripts/test_runner.js .
7
- * node .agent/scripts/test_runner.js . --coverage
8
- * node .agent/scripts/test_runner.js . --watch
9
- * node .agent/scripts/test_runner.js . --file src/utils.test.ts
10
- */
11
-
12
- 'use strict';
13
-
14
- const fs = require('fs');
15
- const path = require('path');
16
- const { spawnSync } = require('child_process');
17
-
18
- const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
19
-
20
- function header(title) {
21
- console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`);
22
- }
23
-
24
- function ok(msg) {
25
- console.log(` ${GREEN}✅ ${msg}${RESET}`);
26
- }
27
-
28
- function fail(msg) {
29
- console.log(` ${RED}❌ ${msg}${RESET}`);
30
- }
31
-
32
- function skip(msg) {
33
- console.log(` ${YELLOW}⏭️ ${msg}${RESET}`);
34
- }
35
-
36
- function runTests(label, cmd, cwd) {
37
- try {
38
- const executable = process.platform === 'win32' && (cmd[0] === 'npx' || cmd[0] === 'npm') ? `${cmd[0]}.cmd` : cmd[0];
39
- const result = spawnSync(executable, cmd.slice(1), {
40
- cwd,
41
- encoding: 'utf8',
42
- timeout: 300000, // 5m
43
- shell: process.platform === 'win32'
44
- });
45
-
46
- if (result.error && !result.stdout && !result.stderr) {
47
- console.log(` Error: ${result.error.message}`);
48
- }
49
- const out = result.stdout ? result.stdout.toString() : '';
50
- const err = result.stderr ? result.stderr.toString() : '';
51
- const output = (out + "\n" + err).trim();
52
- if (output) {
53
- for (const line of output.split("\n")) {
54
- console.log(` ${line}`);
55
- }
56
- }
57
-
58
- if (result.status === 0) {
59
- ok(`${label} — all tests passed`);
60
- return true;
61
- }
62
-
63
- fail(`${label} — test failures detected`);
64
- return false;
65
- } catch {
66
- skip(`${label} — tool not installed`);
67
- return true;
68
- }
69
- }
70
-
71
- function detectTestFramework(projectRoot) {
72
- const pkgJson = path.join(projectRoot, "package.json");
73
- if (fs.existsSync(pkgJson)) {
74
- try {
75
- const pkg = JSON.parse(fs.readFileSync(pkgJson, 'utf8'));
76
- const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
77
- const scripts = pkg.scripts || {};
78
-
79
- if (deps.vitest) return "vitest";
80
- if (deps.jest) return "jest";
81
- if (deps.mocha) return "mocha";
82
- if (scripts.test) return "npm-test";
83
- } catch {
84
- if (fs.readFileSync(pkgJson, 'utf8').includes('"test"')) return "npm-test";
85
- }
86
- }
87
-
88
- if (fs.existsSync(path.join(projectRoot, "pytest.ini")) ||
89
- fs.existsSync(path.join(projectRoot, "pyproject.toml")) ||
90
- fs.existsSync(path.join(projectRoot, "conftest.py"))) {
91
- return "pytest";
92
- }
93
-
94
- // Go
95
- function hasGoTests(dir) {
96
- let items;
97
- try { items = fs.readdirSync(dir, { withFileTypes: true }); } catch { return false; }
98
- for (const item of items) {
99
- if (item.isDirectory() && !["node_modules", ".git"].includes(item.name)) {
100
- if (hasGoTests(path.join(dir, item.name))) return true;
101
- } else if (item.name.endsWith("_test.go")) {
102
- return true;
103
- }
104
- }
105
- return false;
106
- }
107
-
108
- if (hasGoTests(projectRoot)) return "go";
109
-
110
- return null;
111
- }
112
-
113
- function main() {
114
- const args = process.argv.slice(2);
115
- let targetPath = null;
116
- let coverageFlag = false;
117
- let watchFlag = false;
118
- let fileArg = null;
119
-
120
- let i = 0;
121
- while (i < args.length) {
122
- if (args[i] === '--coverage') coverageFlag = true;
123
- else if (args[i] === '--watch') watchFlag = true;
124
- else if (args[i] === '--file' && i + 1 < args.length) fileArg = args[++i];
125
- else if (!targetPath && !args[i].startsWith('-')) targetPath = args[i];
126
- i++;
127
- }
128
-
129
- if (!targetPath) {
130
- console.log("Usage: node test_runner.js <path> [--coverage] [--watch] [--file <filepath>]");
131
- process.exit(1);
132
- }
133
-
134
- const projectRoot = path.resolve(targetPath);
135
- if (!fs.existsSync(projectRoot) || !fs.statSync(projectRoot).isDirectory()) {
136
- fail(`Directory not found: ${projectRoot}`);
137
- process.exit(1);
138
- }
139
-
140
- console.log(`${BOLD}Tribunal — test_runner.js${RESET}`);
141
- console.log(`Project: ${projectRoot}`);
142
-
143
- const framework = detectTestFramework(projectRoot);
144
- if (!framework) {
145
- skip("No test framework detected in this project");
146
- process.exit(0);
147
- }
148
-
149
- header(`Running tests (${framework})`);
150
-
151
- let cmd = [];
152
- let passed = true;
153
-
154
- if (["vitest", "jest", "mocha", "npm-test"].includes(framework)) {
155
- if (framework === "vitest") {
156
- cmd = ["npx", "vitest", "run"];
157
- if (coverageFlag) cmd.push("--coverage");
158
- if (watchFlag) cmd = ["npx", "vitest"];
159
- if (fileArg) cmd.push(fileArg);
160
- } else if (framework === "jest") {
161
- cmd = ["npx", "jest"];
162
- if (coverageFlag) cmd.push("--coverage");
163
- if (watchFlag) cmd.push("--watch");
164
- if (fileArg) cmd.push(fileArg);
165
- } else {
166
- cmd = ["npm", "test", "--", "--passWithNoTests"];
167
- if (coverageFlag) cmd.push("--coverage");
168
- if (fileArg) cmd.push(fileArg);
169
- }
170
- passed = runTests(framework, cmd, projectRoot);
171
- } else if (framework === "pytest") {
172
- cmd = ["python", "-m", "pytest", "-v"];
173
- if (coverageFlag) cmd.push("--cov", "--cov-report=term-missing");
174
- if (watchFlag) cmd = ["python", "-m", "pytest-watch", "--", "-v"];
175
- if (fileArg) cmd.push(fileArg);
176
- passed = runTests("pytest", cmd, projectRoot);
177
- } else if (framework === "go") {
178
- cmd = ["go", "test", "./...", "-v"];
179
- if (coverageFlag) cmd.push("-cover");
180
- if (fileArg) cmd = ["go", "test", "-v", "-run", fileArg];
181
- passed = runTests("go test", cmd, projectRoot);
182
- }
183
-
184
- console.log(`\n${BOLD}━━━ Test Summary ━━━${RESET}`);
185
- if (passed) ok(`Tests passed (${framework})`);
186
- else fail(`Tests failed (${framework})`);
187
-
188
- process.exit(passed ? 0 : 1);
189
- }
190
-
191
- if (require.main === module) {
192
- main();
193
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * test_runner.js — Standalone test runner for the Tribunal Agent Kit.
4
+ *
5
+ * Usage:
6
+ * node .agent/scripts/test_runner.js .
7
+ * node .agent/scripts/test_runner.js . --coverage
8
+ * node .agent/scripts/test_runner.js . --watch
9
+ * node .agent/scripts/test_runner.js . --file src/utils.test.ts
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+ const { spawnSync } = require('child_process');
17
+
18
+ const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
19
+
20
+ function header(title) {
21
+ console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`);
22
+ }
23
+
24
+ function ok(msg) {
25
+ console.log(` ${GREEN}✅ ${msg}${RESET}`);
26
+ }
27
+
28
+ function fail(msg) {
29
+ console.log(` ${RED}❌ ${msg}${RESET}`);
30
+ }
31
+
32
+ function skip(msg) {
33
+ console.log(` ${YELLOW}⏭️ ${msg}${RESET}`);
34
+ }
35
+
36
+ function runTests(label, cmd, cwd) {
37
+ try {
38
+ const executable = process.platform === 'win32' && (cmd[0] === 'npx' || cmd[0] === 'npm') ? `${cmd[0]}.cmd` : cmd[0];
39
+ const result = spawnSync(executable, cmd.slice(1), {
40
+ cwd,
41
+ encoding: 'utf8',
42
+ timeout: 300000, // 5m
43
+ shell: process.platform === 'win32'
44
+ });
45
+
46
+ if (result.error && !result.stdout && !result.stderr) {
47
+ console.log(` Error: ${result.error.message}`);
48
+ }
49
+ const out = result.stdout ? result.stdout.toString() : '';
50
+ const err = result.stderr ? result.stderr.toString() : '';
51
+ const output = (out + "\n" + err).trim();
52
+ if (output) {
53
+ for (const line of output.split("\n")) {
54
+ console.log(` ${line}`);
55
+ }
56
+ }
57
+
58
+ if (result.status === 0) {
59
+ ok(`${label} — all tests passed`);
60
+ return true;
61
+ }
62
+
63
+ fail(`${label} — test failures detected`);
64
+ return false;
65
+ } catch {
66
+ skip(`${label} — tool not installed`);
67
+ return true;
68
+ }
69
+ }
70
+
71
+ function detectTestFramework(projectRoot) {
72
+ const pkgJson = path.join(projectRoot, "package.json");
73
+ if (fs.existsSync(pkgJson)) {
74
+ try {
75
+ const pkg = JSON.parse(fs.readFileSync(pkgJson, 'utf8'));
76
+ const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
77
+ const scripts = pkg.scripts || {};
78
+
79
+ if (deps.vitest) return "vitest";
80
+ if (deps.jest) return "jest";
81
+ if (deps.mocha) return "mocha";
82
+ if (scripts.test) return "npm-test";
83
+ } catch {
84
+ if (fs.readFileSync(pkgJson, 'utf8').includes('"test"')) return "npm-test";
85
+ }
86
+ }
87
+
88
+ if (fs.existsSync(path.join(projectRoot, "pytest.ini")) ||
89
+ fs.existsSync(path.join(projectRoot, "pyproject.toml")) ||
90
+ fs.existsSync(path.join(projectRoot, "conftest.py"))) {
91
+ return "pytest";
92
+ }
93
+
94
+ // Go
95
+ function hasGoTests(dir) {
96
+ let items;
97
+ try { items = fs.readdirSync(dir, { withFileTypes: true }); } catch { return false; }
98
+ for (const item of items) {
99
+ if (item.isDirectory() && !["node_modules", ".git"].includes(item.name)) {
100
+ if (hasGoTests(path.join(dir, item.name))) return true;
101
+ } else if (item.name.endsWith("_test.go")) {
102
+ return true;
103
+ }
104
+ }
105
+ return false;
106
+ }
107
+
108
+ if (hasGoTests(projectRoot)) return "go";
109
+
110
+ return null;
111
+ }
112
+
113
+ function main() {
114
+ const args = process.argv.slice(2);
115
+ let targetPath = null;
116
+ let coverageFlag = false;
117
+ let watchFlag = false;
118
+ let fileArg = null;
119
+
120
+ let i = 0;
121
+ while (i < args.length) {
122
+ if (args[i] === '--coverage') coverageFlag = true;
123
+ else if (args[i] === '--watch') watchFlag = true;
124
+ else if (args[i] === '--file' && i + 1 < args.length) fileArg = args[++i];
125
+ else if (!targetPath && !args[i].startsWith('-')) targetPath = args[i];
126
+ i++;
127
+ }
128
+
129
+ if (!targetPath) {
130
+ console.log("Usage: node test_runner.js <path> [--coverage] [--watch] [--file <filepath>]");
131
+ process.exit(1);
132
+ }
133
+
134
+ const projectRoot = path.resolve(targetPath);
135
+ if (!fs.existsSync(projectRoot) || !fs.statSync(projectRoot).isDirectory()) {
136
+ fail(`Directory not found: ${projectRoot}`);
137
+ process.exit(1);
138
+ }
139
+
140
+ console.log(`${BOLD}Tribunal — test_runner.js${RESET}`);
141
+ console.log(`Project: ${projectRoot}`);
142
+
143
+ const framework = detectTestFramework(projectRoot);
144
+ if (!framework) {
145
+ skip("No test framework detected in this project");
146
+ process.exit(0);
147
+ }
148
+
149
+ header(`Running tests (${framework})`);
150
+
151
+ let cmd = [];
152
+ let passed = true;
153
+
154
+ if (["vitest", "jest", "mocha", "npm-test"].includes(framework)) {
155
+ if (framework === "vitest") {
156
+ cmd = ["npx", "vitest", "run"];
157
+ if (coverageFlag) cmd.push("--coverage");
158
+ if (watchFlag) cmd = ["npx", "vitest"];
159
+ if (fileArg) cmd.push(fileArg);
160
+ } else if (framework === "jest") {
161
+ cmd = ["npx", "jest"];
162
+ if (coverageFlag) cmd.push("--coverage");
163
+ if (watchFlag) cmd.push("--watch");
164
+ if (fileArg) cmd.push(fileArg);
165
+ } else {
166
+ cmd = ["npm", "test", "--", "--passWithNoTests"];
167
+ if (coverageFlag) cmd.push("--coverage");
168
+ if (fileArg) cmd.push(fileArg);
169
+ }
170
+ passed = runTests(framework, cmd, projectRoot);
171
+ } else if (framework === "pytest") {
172
+ cmd = ["python", "-m", "pytest", "-v"];
173
+ if (coverageFlag) cmd.push("--cov", "--cov-report=term-missing");
174
+ if (watchFlag) cmd = ["python", "-m", "pytest-watch", "--", "-v"];
175
+ if (fileArg) cmd.push(fileArg);
176
+ passed = runTests("pytest", cmd, projectRoot);
177
+ } else if (framework === "go") {
178
+ cmd = ["go", "test", "./...", "-v"];
179
+ if (coverageFlag) cmd.push("-cover");
180
+ if (fileArg) cmd = ["go", "test", "-v", "-run", fileArg];
181
+ passed = runTests("go test", cmd, projectRoot);
182
+ }
183
+
184
+ console.log(`\n${BOLD}━━━ Test Summary ━━━${RESET}`);
185
+ if (passed) ok(`Tests passed (${framework})`);
186
+ else fail(`Tests failed (${framework})`);
187
+
188
+ process.exit(passed ? 0 : 1);
189
+ }
190
+
191
+ if (require.main === module) {
192
+ main();
193
+ }
@@ -1,32 +1,32 @@
1
- /**
2
- * utils.js
3
- * Shared utilities for Tribunal Kit Node scripts.
4
- */
5
- 'use strict';
6
-
7
- const path = require('path');
8
- const fs = require('fs');
9
-
10
- function findAgentDir() {
11
- let current = path.resolve(process.cwd());
12
- const root = path.parse(current).root;
13
- while (current !== root) {
14
- const candidate = path.join(current, '.agent');
15
- if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
16
- return candidate;
17
- }
18
- current = path.dirname(current);
19
- }
20
- console.error("\x1b[91m✖ Error: '.agent' directory not found. Please run 'npx tribunal-kit init' first.\x1b[0m");
21
- process.exit(1);
22
- }
23
-
24
- function ensureUtf8Stdout() {
25
- // In Node.js, process.stdout is typically already UTF-8 capable,
26
- // but this exists for compatibility with legacy python workflows.
27
- }
28
-
29
- module.exports = {
30
- findAgentDir,
31
- ensureUtf8Stdout
32
- };
1
+ /**
2
+ * utils.js
3
+ * Shared utilities for Tribunal Kit Node scripts.
4
+ */
5
+ 'use strict';
6
+
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+
10
+ function findAgentDir() {
11
+ let current = path.resolve(process.cwd());
12
+ const root = path.parse(current).root;
13
+ while (current !== root) {
14
+ const candidate = path.join(current, '.agent');
15
+ if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
16
+ return candidate;
17
+ }
18
+ current = path.dirname(current);
19
+ }
20
+ console.error("\x1b[91m✖ Error: '.agent' directory not found. Please run 'npx tribunal-kit init' first.\x1b[0m");
21
+ process.exit(1);
22
+ }
23
+
24
+ function ensureUtf8Stdout() {
25
+ // In Node.js, process.stdout is typically already UTF-8 capable,
26
+ // but this exists for compatibility with legacy python workflows.
27
+ }
28
+
29
+ module.exports = {
30
+ findAgentDir,
31
+ ensureUtf8Stdout
32
+ };