tribunal-kit 4.4.1 โ†’ 4.4.3

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 (141) hide show
  1. package/.agent/history/architecture-graph.yaml +140 -0
  2. package/.agent/history/graph-cache.json +262 -0
  3. package/.agent/history/snapshots/bin__tribunal-kit.js.json +19 -0
  4. package/.agent/history/snapshots/eslint.config.js.json +9 -0
  5. package/.agent/history/snapshots/migrate_refs.js.json +11 -0
  6. package/.agent/history/snapshots/scripts__changelog.js.json +13 -0
  7. package/.agent/history/snapshots/scripts__sync-version.js.json +12 -0
  8. package/.agent/history/snapshots/scripts__validate-payload.js.json +12 -0
  9. package/.agent/history/snapshots/test__integration__bridges.test.js.json +14 -0
  10. package/.agent/history/snapshots/test__integration__init.test.js.json +14 -0
  11. package/.agent/history/snapshots/test__integration__routing.test.js.json +12 -0
  12. package/.agent/history/snapshots/test__integration__swarm_dispatcher.test.js.json +14 -0
  13. package/.agent/history/snapshots/test__integration__wave2.test.js.json +14 -0
  14. package/.agent/history/snapshots/test__unit__args.test.js.json +20 -0
  15. package/.agent/history/snapshots/test__unit__case_law_manager.test.js.json +11 -0
  16. package/.agent/history/snapshots/test__unit__context_broker.test.js.json +11 -0
  17. package/.agent/history/snapshots/test__unit__copyDir.test.js.json +23 -0
  18. package/.agent/history/snapshots/test__unit__graph_tools.test.js.json +12 -0
  19. package/.agent/history/snapshots/test__unit__inner_loop_validator.test.js.json +11 -0
  20. package/.agent/history/snapshots/test__unit__selfInstall.test.js.json +23 -0
  21. package/.agent/history/snapshots/test__unit__semver.test.js.json +20 -0
  22. package/.agent/history/snapshots/test__unit__swarm_dispatcher.test.js.json +12 -0
  23. package/.agent/scripts/_colors.js +170 -18
  24. package/.agent/scripts/_utils.js +244 -42
  25. package/.agent/scripts/bundle_analyzer.js +261 -290
  26. package/.agent/scripts/case_law_manager.js +1 -7
  27. package/.agent/scripts/checklist.js +278 -266
  28. package/.agent/scripts/colors.js +11 -17
  29. package/.agent/scripts/context_broker.js +1 -7
  30. package/.agent/scripts/dependency_analyzer.js +234 -272
  31. package/.agent/scripts/graph_builder.js +46 -18
  32. package/.agent/scripts/graph_visualizer.js +10 -4
  33. package/.agent/scripts/graph_zoom.js +6 -4
  34. package/.agent/scripts/inner_loop_validator.js +2 -8
  35. package/.agent/scripts/lint_runner.js +186 -187
  36. package/.agent/scripts/marathon_harness.js +799 -0
  37. package/.agent/scripts/prompt_compiler.js +56 -0
  38. package/.agent/scripts/schema_validator.js +8 -25
  39. package/.agent/scripts/security_scan.js +276 -303
  40. package/.agent/scripts/session_manager.js +1 -7
  41. package/.agent/scripts/skill_evolution.js +1 -8
  42. package/.agent/scripts/skill_integrator.js +1 -7
  43. package/.agent/scripts/test_runner.js +186 -193
  44. package/.agent/scripts/utils.js +17 -32
  45. package/.agent/scripts/verify_all.js +248 -257
  46. package/.agent/skills/agent-organizer/SKILL.md +42 -0
  47. package/.agent/skills/agentic-patterns/SKILL.md +42 -0
  48. package/.agent/skills/ai-prompt-injection-defense/SKILL.md +42 -0
  49. package/.agent/skills/api-patterns/SKILL.md +42 -0
  50. package/.agent/skills/api-security-auditor/SKILL.md +42 -0
  51. package/.agent/skills/app-builder/SKILL.md +42 -0
  52. package/.agent/skills/appflow-wireframe/SKILL.md +42 -0
  53. package/.agent/skills/architecture/SKILL.md +42 -0
  54. package/.agent/skills/authentication-best-practices/SKILL.md +42 -0
  55. package/.agent/skills/backend-security-expert/SKILL.md +122 -0
  56. package/.agent/skills/bash-linux/SKILL.md +42 -0
  57. package/.agent/skills/behavioral-modes/SKILL.md +42 -0
  58. package/.agent/skills/brainstorming/SKILL.md +42 -0
  59. package/.agent/skills/building-native-ui/SKILL.md +42 -0
  60. package/.agent/skills/clean-code/SKILL.md +42 -0
  61. package/.agent/skills/code-review-checklist/SKILL.md +42 -0
  62. package/.agent/skills/config-validator/SKILL.md +42 -0
  63. package/.agent/skills/csharp-developer/SKILL.md +42 -0
  64. package/.agent/skills/data-validation-schemas/SKILL.md +42 -0
  65. package/.agent/skills/database-design/SKILL.md +42 -0
  66. package/.agent/skills/deployment-procedures/SKILL.md +42 -0
  67. package/.agent/skills/devops-engineer/SKILL.md +42 -0
  68. package/.agent/skills/devops-incident-responder/SKILL.md +42 -0
  69. package/.agent/skills/documentation-templates/SKILL.md +42 -0
  70. package/.agent/skills/edge-computing/SKILL.md +42 -0
  71. package/.agent/skills/error-resilience/SKILL.md +42 -0
  72. package/.agent/skills/extract-design-system/SKILL.md +42 -0
  73. package/.agent/skills/framer-motion-expert/SKILL.md +42 -0
  74. package/.agent/skills/frontend-design/SKILL.md +42 -0
  75. package/.agent/skills/frontend-security-expert/SKILL.md +123 -0
  76. package/.agent/skills/game-design-expert/SKILL.md +42 -0
  77. package/.agent/skills/game-engineering-expert/SKILL.md +42 -0
  78. package/.agent/skills/geo-fundamentals/SKILL.md +42 -0
  79. package/.agent/skills/github-operations/SKILL.md +42 -0
  80. package/.agent/skills/gsap-core/SKILL.md +42 -0
  81. package/.agent/skills/gsap-frameworks/SKILL.md +42 -0
  82. package/.agent/skills/gsap-performance/SKILL.md +42 -0
  83. package/.agent/skills/gsap-plugins/SKILL.md +42 -0
  84. package/.agent/skills/gsap-react/SKILL.md +42 -0
  85. package/.agent/skills/gsap-scrolltrigger/SKILL.md +42 -0
  86. package/.agent/skills/gsap-timeline/SKILL.md +42 -0
  87. package/.agent/skills/gsap-utils/SKILL.md +42 -0
  88. package/.agent/skills/i18n-localization/SKILL.md +42 -0
  89. package/.agent/skills/intelligent-routing/SKILL.md +42 -0
  90. package/.agent/skills/knowledge-graph/SKILL.md +42 -0
  91. package/.agent/skills/lint-and-validate/SKILL.md +42 -0
  92. package/.agent/skills/llm-engineering/SKILL.md +42 -0
  93. package/.agent/skills/local-first/SKILL.md +42 -0
  94. package/.agent/skills/mcp-builder/SKILL.md +42 -0
  95. package/.agent/skills/mobile-design/SKILL.md +42 -0
  96. package/.agent/skills/monorepo-management/SKILL.md +42 -0
  97. package/.agent/skills/motion-engineering/SKILL.md +42 -0
  98. package/.agent/skills/nextjs-react-expert/SKILL.md +42 -0
  99. package/.agent/skills/nodejs-best-practices/SKILL.md +42 -0
  100. package/.agent/skills/observability/SKILL.md +42 -0
  101. package/.agent/skills/parallel-agents/SKILL.md +42 -0
  102. package/.agent/skills/performance-profiling/SKILL.md +42 -0
  103. package/.agent/skills/plan-writing/SKILL.md +42 -0
  104. package/.agent/skills/platform-engineer/SKILL.md +42 -0
  105. package/.agent/skills/playwright-best-practices/SKILL.md +42 -0
  106. package/.agent/skills/powershell-windows/SKILL.md +42 -0
  107. package/.agent/skills/project-idioms/SKILL.md +42 -0
  108. package/.agent/skills/python-patterns/SKILL.md +42 -0
  109. package/.agent/skills/python-pro/SKILL.md +42 -0
  110. package/.agent/skills/react-specialist/SKILL.md +42 -0
  111. package/.agent/skills/readme-builder/SKILL.md +42 -0
  112. package/.agent/skills/realtime-patterns/SKILL.md +42 -0
  113. package/.agent/skills/red-team-tactics/SKILL.md +42 -0
  114. package/.agent/skills/rust-pro/SKILL.md +42 -0
  115. package/.agent/skills/seo-fundamentals/SKILL.md +42 -0
  116. package/.agent/skills/server-management/SKILL.md +42 -0
  117. package/.agent/skills/shadcn-ui-expert/SKILL.md +42 -0
  118. package/.agent/skills/skill-creator/SKILL.md +42 -0
  119. package/.agent/skills/sql-pro/SKILL.md +42 -0
  120. package/.agent/skills/supabase-postgres-best-practices/SKILL.md +42 -0
  121. package/.agent/skills/swiftui-expert/SKILL.md +42 -0
  122. package/.agent/skills/systematic-debugging/SKILL.md +42 -0
  123. package/.agent/skills/tailwind-patterns/SKILL.md +42 -0
  124. package/.agent/skills/tdd-workflow/SKILL.md +42 -0
  125. package/.agent/skills/test-result-analyzer/SKILL.md +42 -0
  126. package/.agent/skills/testing-patterns/SKILL.md +42 -0
  127. package/.agent/skills/trend-researcher/SKILL.md +42 -0
  128. package/.agent/skills/typescript-advanced/SKILL.md +42 -0
  129. package/.agent/skills/ui-ux-pro-max/SKILL.md +42 -0
  130. package/.agent/skills/ui-ux-researcher/SKILL.md +42 -0
  131. package/.agent/skills/vue-expert/SKILL.md +42 -0
  132. package/.agent/skills/vulnerability-scanner/SKILL.md +42 -0
  133. package/.agent/skills/web-accessibility-auditor/SKILL.md +42 -0
  134. package/.agent/skills/web-design-guidelines/SKILL.md +42 -0
  135. package/.agent/skills/webapp-testing/SKILL.md +42 -0
  136. package/.agent/skills/whimsy-injector/SKILL.md +42 -0
  137. package/.agent/skills/workflow-optimizer/SKILL.md +42 -0
  138. package/.agent/workflows/marathon.md +247 -0
  139. package/.agent/workflows/super-prompt.md +27 -0
  140. package/bin/tribunal-kit.js +47 -1
  141. package/package.json +3 -2
@@ -1,257 +1,248 @@
1
- #!/usr/bin/env node
2
- /**
3
- * verify_all.js โ€” Full pre-deploy validation suite for the Tribunal Agent Kit.
4
- *
5
- * Runs comprehensive checks before any production deployment.
6
- *
7
- * Usage:
8
- * node .agent/scripts/verify_all.js
9
- * node .agent/scripts/verify_all.js --skip build,deps
10
- */
11
-
12
- 'use strict';
13
-
14
- const fs = require('fs');
15
- const path = require('path');
16
- const { execFileSync } = require('child_process');
17
-
18
- // โ”โ”โ” ANSI colors โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
19
- const RED = '\x1b[91m';
20
- const GREEN = '\x1b[92m';
21
- const YELLOW = '\x1b[93m';
22
- const BLUE = '\x1b[94m';
23
- const BOLD = '\x1b[1m';
24
- const RESET = '\x1b[0m';
25
-
26
- const RESULTS = [];
27
-
28
- function section(title) {
29
- console.log(`\n${BOLD}${BLUE}โ”โ”โ” ${title} โ”โ”โ”${RESET}`);
30
- }
31
-
32
- function ok(label, note) {
33
- const msg = `${GREEN}โœ… ${label}${RESET}` + (note ? ` ${YELLOW}(${note})${RESET}` : '');
34
- console.log(` ${msg}`);
35
- RESULTS.push({ label, passed: true, note: note || '' });
36
- }
37
-
38
- function fail(label, note) {
39
- const noteStr = note ? `\n ${note}` : '';
40
- console.log(` ${RED}โŒ ${label}${RESET}${noteStr}`);
41
- RESULTS.push({ label, passed: false, note: note || '' });
42
- }
43
-
44
- function skip(label, reason) {
45
- console.log(` ${YELLOW}โญ๏ธ ${label} โ€” ${reason}${RESET}`);
46
- RESULTS.push({ label, passed: true, note: `skipped: ${reason}` });
47
- }
48
-
49
- /**
50
- * Run a shell command and return true if it exits with code 0.
51
- */
52
- function run(label, cmd, cwd) {
53
- try {
54
- const isWindows = process.platform === 'win32';
55
- const bin = cmd[0];
56
-
57
- execFileSync(bin, cmd.slice(1), {
58
- cwd,
59
- stdio: 'pipe',
60
- timeout: 120000,
61
- encoding: 'utf8',
62
- shell: isWindows
63
- });
64
- ok(label);
65
- return true;
66
- } catch (err) {
67
- if (err.code === 'ENOENT') {
68
- skip(label, 'tool not installed โ€” skipping');
69
- return true;
70
- }
71
- if (err.killed) {
72
- fail(label, 'timed out after 120s');
73
- return false;
74
- }
75
- const output = ((err.stdout || '') + (err.stderr || '')).trim();
76
- fail(label, output ? output.slice(0, 500) : 'non-zero exit code');
77
- return false;
78
- }
79
- }
80
-
81
-
82
- /**
83
- * Scan source files for obviously hardcoded credentials.
84
- */
85
- function scanSecrets(cwd) {
86
- const patterns = ['password=', 'secret=', 'api_key=', 'private_key=', 'auth_token='];
87
- const found = [];
88
- const skipDirs = new Set(['node_modules', '.git', 'dist', '__pycache__', '.agent']);
89
-
90
- function walk(dir) {
91
- let entries;
92
- try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
93
-
94
- for (const entry of entries) {
95
- const fullPath = path.join(dir, entry.name);
96
- if (entry.isDirectory()) {
97
- if (!skipDirs.has(entry.name)) walk(fullPath);
98
- } else if (entry.isFile()) {
99
- if (!/\.(ts|js|tsx|jsx|py)$/.test(entry.name)) continue;
100
-
101
- let content;
102
- try { content = fs.readFileSync(fullPath, 'utf8'); } catch { continue; }
103
-
104
- const lines = content.split('\n');
105
- for (let i = 0; i < lines.length; i++) {
106
- const low = lines[i].toLowerCase().trim();
107
- const hasPattern = patterns.some(p => low.includes(p));
108
- if (hasPattern && !low.startsWith('#') && low.includes('=')) {
109
- const rel = path.relative(cwd, fullPath);
110
- found.push(`${rel}:${i + 1}`);
111
- }
112
- }
113
- }
114
- }
115
- }
116
-
117
- walk(cwd);
118
-
119
- if (found.length > 0) {
120
- fail('Secret scan', found.slice(0, 5).join('\n '));
121
- return false;
122
- }
123
- ok('Secret scan โ€” no hardcoded credentials found');
124
- return true;
125
- }
126
-
127
-
128
- /**
129
- * Check if there's a package.json to run npm commands against.
130
- */
131
- function hasNpm(cwd) {
132
- return fs.existsSync(path.join(cwd, 'package.json'));
133
- }
134
-
135
-
136
- /**
137
- * Run all verification checks. Returns number of failures.
138
- */
139
- function verifyAll(cwd, skipped) {
140
- let failures = 0;
141
- RESULTS.length = 0; // Reset for clean runs (prevents accumulation in tests)
142
-
143
- section('1 โ€” Secret Scan');
144
- if (!skipped.includes('secrets')) {
145
- if (!scanSecrets(cwd)) failures++;
146
- } else {
147
- skip('Secret scan', 'skipped by flag');
148
- }
149
-
150
- section('2 โ€” TypeScript');
151
- if (!skipped.includes('typescript')) {
152
- if (hasNpm(cwd)) {
153
- if (!run('tsc --noEmit', ['npx', 'tsc', '--noEmit'], cwd)) failures++;
154
- } else {
155
- skip('TypeScript', 'no package.json found in project');
156
- }
157
- } else {
158
- skip('TypeScript', 'skipped by flag');
159
- }
160
-
161
- section('3 โ€” ESLint');
162
- if (!skipped.includes('lint')) {
163
- if (hasNpm(cwd)) {
164
- if (!run('ESLint', ['npx', 'eslint', '.', '--max-warnings=0'], cwd)) failures++;
165
- } else {
166
- skip('ESLint', 'no package.json found in project');
167
- }
168
- } else {
169
- skip('ESLint', 'skipped by flag');
170
- }
171
-
172
- section('4 โ€” Unit Tests');
173
- if (!skipped.includes('tests')) {
174
- if (hasNpm(cwd)) {
175
- if (!run('Test suite', ['npm', 'test', '--', '--passWithNoTests'], cwd)) failures++;
176
- } else {
177
- skip('Tests', 'no package.json found in project');
178
- }
179
- } else {
180
- skip('Tests', 'skipped by flag');
181
- }
182
-
183
- section('5 โ€” Build');
184
- if (!skipped.includes('build')) {
185
- if (hasNpm(cwd)) {
186
- if (!run('npm run build', ['npm', 'run', 'build'], cwd)) failures++;
187
- } else {
188
- skip('Build', 'no package.json found in project');
189
- }
190
- } else {
191
- skip('Build', 'skipped by flag');
192
- }
193
-
194
- section('6 โ€” Dependency Audit');
195
- if (!skipped.includes('deps')) {
196
- if (hasNpm(cwd)) {
197
- if (!run('npm audit', ['npm', 'audit', '--audit-level=high'], cwd)) failures++;
198
- } else {
199
- skip('Dependency audit', 'no package.json found in project');
200
- }
201
- } else {
202
- skip('Dependency audit', 'skipped by flag');
203
- }
204
-
205
- // โ”โ”โ” Summary โ”โ”โ”
206
- console.log(`\n${BOLD}โ”โ”โ” Summary โ”โ”โ”${RESET}`);
207
- for (const { label, passed, note } of RESULTS) {
208
- const status = passed ? `${GREEN}โœ…${RESET}` : `${RED}โŒ${RESET}`;
209
- const noteStr = (!passed && note) ? ` ${YELLOW}(${note})${RESET}` : '';
210
- console.log(` ${status} ${label}${noteStr}`);
211
- }
212
-
213
- console.log();
214
- if (failures === 0) {
215
- console.log(`${GREEN}${BOLD}All checks passed โ€” safe to deploy.${RESET}`);
216
- } else {
217
- console.log(`${RED}${BOLD}${failures} check(s) failed โ€” fix before deploying.${RESET}`);
218
- }
219
-
220
- return failures;
221
- }
222
-
223
-
224
- /**
225
- * Parse CLI arguments manually (no external dependencies).
226
- */
227
- function parseArgs(argv) {
228
- const args = { skip: [] };
229
- const raw = argv.slice(2);
230
-
231
- for (let i = 0; i < raw.length; i++) {
232
- if (raw[i] === '--skip' && raw[i + 1]) {
233
- args.skip = raw[++i].split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
234
- }
235
- }
236
- return args;
237
- }
238
-
239
-
240
- function main() {
241
- const args = parseArgs(process.argv);
242
- const cwd = process.cwd();
243
-
244
- console.log(`${BOLD}Tribunal โ€” verify_all.js${RESET}`);
245
- console.log(`Project: ${cwd}\n`);
246
-
247
- const failures = verifyAll(cwd, args.skip);
248
- process.exit(failures > 0 ? 1 : 0);
249
- }
250
-
251
-
252
- // โ”โ”โ” Exports for testing & programmatic use โ”โ”โ”
253
- module.exports = { verifyAll, scanSecrets, hasNpm };
254
-
255
- if (require.main === module) {
256
- main();
257
- }
1
+ #!/usr/bin/env node
2
+ /**
3
+ * verify_all.js โ€” Full pre-deploy validation suite for the Tribunal Agent Kit.
4
+ *
5
+ * Runs comprehensive checks before any production deployment.
6
+ *
7
+ * Usage:
8
+ * node .agent/scripts/verify_all.js
9
+ * node .agent/scripts/verify_all.js --skip build,deps
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+ const { execFileSync } = require('child_process');
17
+
18
+ const {
19
+ RED, GREEN, YELLOW, BLUE, BOLD, DIM, CYAN, RESET,
20
+ banner, sectionHeader, summaryTable, timer, formatMs,
21
+ ok, fail, skip,
22
+ } = require('./_colors');
23
+
24
+ const { walkDir, hasNpm, SOURCE_EXTENSIONS } = require('./_utils');
25
+
26
+ // โ”€โ”€ Results Tracking โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
27
+
28
+ const RESULTS = [];
29
+
30
+ function trackOk(label, ms, note) {
31
+ const timing = ms != null ? `${DIM}(${formatMs(ms)})${RESET}` : '';
32
+ const noteStr = note ? ` ${DIM}${note}${RESET}` : '';
33
+ console.log(` ${GREEN}โœ… ${label}${RESET} ${timing}${noteStr}`);
34
+ RESULTS.push({ name: label, status: 'pass', ms, note: note || '' });
35
+ }
36
+
37
+ function trackFail(label, ms, note) {
38
+ const timing = ms != null ? `${DIM}(${formatMs(ms)})${RESET}` : '';
39
+ const noteStr = note ? `\n ${note}` : '';
40
+ console.log(` ${RED}โŒ ${label}${RESET} ${timing}${noteStr}`);
41
+ RESULTS.push({ name: label, status: 'fail', ms, note: note || '' });
42
+ }
43
+
44
+ function trackSkip(label, reason) {
45
+ console.log(` ${YELLOW}โญ๏ธ ${label} โ€” ${reason}${RESET}`);
46
+ RESULTS.push({ name: label, status: 'skip', note: `skipped: ${reason}` });
47
+ }
48
+
49
+ // โ”€โ”€ Command Runner โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
50
+
51
+ /**
52
+ * Run a shell command and return true if it exits with code 0.
53
+ */
54
+ function run(label, cmd, cwd) {
55
+ const elapsed = timer();
56
+ try {
57
+ const isWindows = process.platform === 'win32';
58
+
59
+ execFileSync(cmd[0], cmd.slice(1), {
60
+ cwd,
61
+ stdio: 'pipe',
62
+ timeout: 120000,
63
+ encoding: 'utf8',
64
+ shell: isWindows
65
+ });
66
+ trackOk(label, elapsed());
67
+ return true;
68
+ } catch (err) {
69
+ const ms = elapsed();
70
+ if (err.code === 'ENOENT') {
71
+ trackSkip(label, 'tool not installed โ€” skipping');
72
+ return true;
73
+ }
74
+ if (err.killed) {
75
+ trackFail(label, ms, 'timed out after 120s');
76
+ return false;
77
+ }
78
+ const output = ((err.stdout || '') + (err.stderr || '')).trim();
79
+ trackFail(label, ms, output ? output.slice(0, 500) : 'non-zero exit code');
80
+ return false;
81
+ }
82
+ }
83
+
84
+
85
+ /**
86
+ * Scan source files for obviously hardcoded credentials.
87
+ * Uses shared walkDir from _utils.js to eliminate duplicated walker code.
88
+ */
89
+ function scanSecrets(cwd) {
90
+ const elapsed = timer();
91
+ const patterns = ['password=', 'secret=', 'api_key=', 'private_key=', 'auth_token='];
92
+ const found = [];
93
+
94
+ const sourceExtensions = new Set(['.ts', '.tsx', '.js', '.jsx', '.py']);
95
+ const files = walkDir(cwd, { extensions: sourceExtensions });
96
+
97
+ for (const fullPath of files) {
98
+ let content;
99
+ try { content = fs.readFileSync(fullPath, 'utf8'); } catch { continue; }
100
+
101
+ const lines = content.split('\n');
102
+ for (let i = 0; i < lines.length; i++) {
103
+ const low = lines[i].toLowerCase().trim();
104
+ const hasPattern = patterns.some(p => low.includes(p));
105
+ if (hasPattern && !low.startsWith('#') && low.includes('=')) {
106
+ const rel = path.relative(cwd, fullPath);
107
+ found.push(`${rel}:${i + 1}`);
108
+ }
109
+ }
110
+ }
111
+
112
+ const ms = elapsed();
113
+ if (found.length > 0) {
114
+ trackFail('Secret scan', ms, found.slice(0, 5).join('\n '));
115
+ return false;
116
+ }
117
+ trackOk('Secret scan โ€” no hardcoded credentials found', ms, `${files.length} files scanned`);
118
+ return true;
119
+ }
120
+
121
+
122
+ /**
123
+ * Run all verification checks. Returns number of failures.
124
+ */
125
+ function verifyAll(cwd, skipped) {
126
+ let failures = 0;
127
+ RESULTS.length = 0; // Reset for clean runs (prevents accumulation in tests)
128
+ const totalTimer = timer();
129
+
130
+ console.log(sectionHeader('Secret Scan', 1));
131
+ if (!skipped.includes('secrets')) {
132
+ if (!scanSecrets(cwd)) failures++;
133
+ } else {
134
+ trackSkip('Secret scan', 'skipped by flag');
135
+ }
136
+
137
+ console.log(sectionHeader('TypeScript', 2));
138
+ if (!skipped.includes('typescript')) {
139
+ if (hasNpm(cwd)) {
140
+ if (!run('tsc --noEmit', ['npx', 'tsc', '--noEmit'], cwd)) failures++;
141
+ } else {
142
+ trackSkip('TypeScript', 'no package.json found in project');
143
+ }
144
+ } else {
145
+ trackSkip('TypeScript', 'skipped by flag');
146
+ }
147
+
148
+ console.log(sectionHeader('ESLint', 3));
149
+ if (!skipped.includes('lint')) {
150
+ if (hasNpm(cwd)) {
151
+ if (!run('ESLint', ['npx', 'eslint', '.', '--max-warnings=0'], cwd)) failures++;
152
+ } else {
153
+ trackSkip('ESLint', 'no package.json found in project');
154
+ }
155
+ } else {
156
+ trackSkip('ESLint', 'skipped by flag');
157
+ }
158
+
159
+ console.log(sectionHeader('Unit Tests', 4));
160
+ if (!skipped.includes('tests')) {
161
+ if (hasNpm(cwd)) {
162
+ if (!run('Test suite', ['npm', 'test', '--', '--passWithNoTests'], cwd)) failures++;
163
+ } else {
164
+ trackSkip('Tests', 'no package.json found in project');
165
+ }
166
+ } else {
167
+ trackSkip('Tests', 'skipped by flag');
168
+ }
169
+
170
+ console.log(sectionHeader('Build', 5));
171
+ if (!skipped.includes('build')) {
172
+ if (hasNpm(cwd)) {
173
+ if (!run('npm run build', ['npm', 'run', 'build'], cwd)) failures++;
174
+ } else {
175
+ trackSkip('Build', 'no package.json found in project');
176
+ }
177
+ } else {
178
+ trackSkip('Build', 'skipped by flag');
179
+ }
180
+
181
+ console.log(sectionHeader('Dependency Audit', 6));
182
+ if (!skipped.includes('deps')) {
183
+ if (hasNpm(cwd)) {
184
+ if (!run('npm audit', ['npm', 'audit', '--audit-level=high'], cwd)) failures++;
185
+ } else {
186
+ trackSkip('Dependency audit', 'no package.json found in project');
187
+ }
188
+ } else {
189
+ trackSkip('Dependency audit', 'skipped by flag');
190
+ }
191
+
192
+ // โ”โ”โ” Summary Table โ”โ”โ”
193
+ const totalMs = totalTimer();
194
+ console.log(`\n${BOLD}${CYAN}โ”โ”โ” Verification Summary โ”โ”โ”${RESET}`);
195
+ summaryTable(RESULTS);
196
+
197
+ const passCount = RESULTS.filter(r => r.status === 'pass').length;
198
+ const failCount = RESULTS.filter(r => r.status === 'fail').length;
199
+ const skipCount = RESULTS.filter(r => r.status === 'skip').length;
200
+
201
+ console.log(`\n ${DIM}Total: ${RESULTS.length} checks in ${formatMs(totalMs)}${RESET}`);
202
+ console.log(` ${GREEN}${passCount} passed${RESET} ${failCount > 0 ? `${RED}${failCount} failed${RESET} ` : ''}${skipCount > 0 ? `${YELLOW}${skipCount} skipped${RESET}` : ''}`);
203
+
204
+ console.log();
205
+ if (failures === 0) {
206
+ console.log(`${GREEN}${BOLD} โœ” All checks passed โ€” safe to deploy.${RESET}`);
207
+ } else {
208
+ console.log(`${RED}${BOLD} โœ– ${failures} check(s) failed โ€” fix before deploying.${RESET}`);
209
+ }
210
+ console.log();
211
+
212
+ return failures;
213
+ }
214
+
215
+
216
+ /**
217
+ * Parse CLI arguments manually (no external dependencies).
218
+ */
219
+ function parseArgs(argv) {
220
+ const args = { skip: [] };
221
+ const raw = argv.slice(2);
222
+
223
+ for (let i = 0; i < raw.length; i++) {
224
+ if (raw[i] === '--skip' && raw[i + 1]) {
225
+ args.skip = raw[++i].split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
226
+ }
227
+ }
228
+ return args;
229
+ }
230
+
231
+
232
+ function main() {
233
+ const args = parseArgs(process.argv);
234
+ const cwd = process.cwd();
235
+
236
+ console.log(banner('verify_all.js', { Project: cwd }));
237
+
238
+ const failures = verifyAll(cwd, args.skip);
239
+ process.exit(failures > 0 ? 1 : 0);
240
+ }
241
+
242
+
243
+ // โ”โ”โ” Exports for testing & programmatic use โ”โ”โ”
244
+ module.exports = { verifyAll, scanSecrets, hasNpm };
245
+
246
+ if (require.main === module) {
247
+ main();
248
+ }
@@ -148,3 +148,45 @@ Review these questions before confirming output:
148
148
 
149
149
  ## VBC Protocol (Verification-Before-Completion)
150
150
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
151
+
152
+
153
+ ---
154
+
155
+ ## ๐Ÿค– LLM-Specific Traps
156
+
157
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
158
+
159
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
160
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
161
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
162
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
163
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
164
+
165
+ ---
166
+
167
+ ## ๐Ÿ›๏ธ Tribunal Integration (Anti-Hallucination)
168
+
169
+ **Slash command: `/review` or `/tribunal-full`**
170
+ **Active reviewers: `logic-reviewer` ยท `security-auditor`**
171
+
172
+ ### โŒ Forbidden AI Tropes
173
+
174
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
175
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
176
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
177
+
178
+ ### โœ… Pre-Flight Self-Audit
179
+
180
+ Review these questions before confirming output:
181
+ ```
182
+ โœ… Did I rely ONLY on real, verified tools and methods?
183
+ โœ… Is this solution appropriately scoped to the user's constraints?
184
+ โœ… Did I handle potential failure modes and edge cases?
185
+ โœ… Have I avoided generic boilerplate that doesn't add value?
186
+ ```
187
+
188
+ ### ๐Ÿ›‘ Verification-Before-Completion (VBC) Protocol
189
+
190
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
191
+ - โŒ **Forbidden:** Declaring a task complete because the output "looks correct."
192
+ - โœ… **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.
@@ -313,3 +313,45 @@ Review these questions before confirming output:
313
313
 
314
314
  ## VBC Protocol (Verification-Before-Completion)
315
315
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
316
+
317
+
318
+ ---
319
+
320
+ ## ๐Ÿค– LLM-Specific Traps
321
+
322
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
323
+
324
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
325
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
326
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
327
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
328
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
329
+
330
+ ---
331
+
332
+ ## ๐Ÿ›๏ธ Tribunal Integration (Anti-Hallucination)
333
+
334
+ **Slash command: `/review` or `/tribunal-full`**
335
+ **Active reviewers: `logic-reviewer` ยท `security-auditor`**
336
+
337
+ ### โŒ Forbidden AI Tropes
338
+
339
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
340
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
341
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
342
+
343
+ ### โœ… Pre-Flight Self-Audit
344
+
345
+ Review these questions before confirming output:
346
+ ```
347
+ โœ… Did I rely ONLY on real, verified tools and methods?
348
+ โœ… Is this solution appropriately scoped to the user's constraints?
349
+ โœ… Did I handle potential failure modes and edge cases?
350
+ โœ… Have I avoided generic boilerplate that doesn't add value?
351
+ ```
352
+
353
+ ### ๐Ÿ›‘ Verification-Before-Completion (VBC) Protocol
354
+
355
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
356
+ - โŒ **Forbidden:** Declaring a task complete because the output "looks correct."
357
+ - โœ… **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.
@@ -182,3 +182,45 @@ Review these questions before confirming output:
182
182
 
183
183
  ## VBC Protocol (Verification-Before-Completion)
184
184
  You MUST verify existing code signatures and variables before attempting to modify or call them. No hallucination is permitted.
185
+
186
+
187
+ ---
188
+
189
+ ## ๐Ÿค– LLM-Specific Traps
190
+
191
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
192
+
193
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
194
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
195
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
196
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
197
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
198
+
199
+ ---
200
+
201
+ ## ๐Ÿ›๏ธ Tribunal Integration (Anti-Hallucination)
202
+
203
+ **Slash command: `/review` or `/tribunal-full`**
204
+ **Active reviewers: `logic-reviewer` ยท `security-auditor`**
205
+
206
+ ### โŒ Forbidden AI Tropes
207
+
208
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
209
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
210
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
211
+
212
+ ### โœ… Pre-Flight Self-Audit
213
+
214
+ Review these questions before confirming output:
215
+ ```
216
+ โœ… Did I rely ONLY on real, verified tools and methods?
217
+ โœ… Is this solution appropriately scoped to the user's constraints?
218
+ โœ… Did I handle potential failure modes and edge cases?
219
+ โœ… Have I avoided generic boilerplate that doesn't add value?
220
+ ```
221
+
222
+ ### ๐Ÿ›‘ Verification-Before-Completion (VBC) Protocol
223
+
224
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
225
+ - โŒ **Forbidden:** Declaring a task complete because the output "looks correct."
226
+ - โœ… **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.