@soulbatical/tetra-dev-toolkit 1.1.0 → 1.2.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/bin/{vca-audit.js → tetra-audit.js} +11 -11
- package/bin/{vca-dev-token.js → tetra-dev-token.js} +7 -7
- package/bin/{vca-setup.js → tetra-setup.js} +19 -19
- package/lib/checks/health/quality-toolkit.js +12 -8
- package/lib/checks/health/repo-visibility.js +1 -1
- package/lib/checks/stability/ci-pipeline.js +1 -1
- package/lib/checks/stability/husky-hooks.js +1 -1
- package/lib/commands/dev-token.js +4 -4
- package/lib/config.js +14 -11
- package/lib/index.js +3 -3
- package/lib/reporters/terminal.js +1 -1
- package/lib/runner.js +1 -1
- package/package.json +6 -9
- package/README.md +0 -312
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Tetra Dev Toolkit - Main CLI
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* tetra-audit # Run all checks
|
|
8
|
+
* tetra-audit security # Run security checks only
|
|
9
|
+
* tetra-audit stability # Run stability checks only
|
|
10
|
+
* tetra-audit quick # Run quick critical checks
|
|
11
|
+
* tetra-audit --ci # CI mode (GitHub Actions annotations)
|
|
12
|
+
* tetra-audit --json # JSON output
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { program } from 'commander'
|
|
@@ -17,9 +17,9 @@ import { runAllChecks, runSecurityChecks, runStabilityChecks, runCodeQualityChec
|
|
|
17
17
|
import { formatResults, formatGitHubActions } from '../lib/reporters/terminal.js'
|
|
18
18
|
|
|
19
19
|
program
|
|
20
|
-
.name('
|
|
21
|
-
.description('
|
|
22
|
-
.version('1.
|
|
20
|
+
.name('tetra-audit')
|
|
21
|
+
.description('Tetra Dev Toolkit - Unified quality checks for all projects')
|
|
22
|
+
.version('1.2.0')
|
|
23
23
|
.argument('[suite]', 'Check suite to run: security, stability, quick, or all (default)')
|
|
24
24
|
.option('--ci', 'CI mode - output GitHub Actions annotations')
|
|
25
25
|
.option('--json', 'Output results as JSON')
|
|
@@ -56,7 +56,7 @@ program
|
|
|
56
56
|
|
|
57
57
|
// Also print summary
|
|
58
58
|
console.log('')
|
|
59
|
-
console.log('##
|
|
59
|
+
console.log('## Tetra Quality Audit Results')
|
|
60
60
|
console.log('')
|
|
61
61
|
console.log(`- **Status**: ${results.passed ? '✅ PASSED' : '❌ FAILED'}`)
|
|
62
62
|
console.log(`- **Checks**: ${results.summary.passed} passed, ${results.summary.failed} failed`)
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Tetra Dev Toolkit - Dev Token CLI
|
|
5
5
|
*
|
|
6
6
|
* Manage Supabase dev tokens for API testing.
|
|
7
7
|
* Auto-detects project from package.json, finds Supabase config from .env files.
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* tetra-dev-token # Auto-refresh or show status
|
|
11
|
+
* tetra-dev-token --login # Interactive login (prompts for password)
|
|
12
|
+
* tetra-dev-token --status # Show current token status
|
|
13
|
+
* tetra-dev-token --project myapp # Override project detection
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { program } from 'commander'
|
|
17
17
|
import { runDevToken } from '../lib/commands/dev-token.js'
|
|
18
18
|
|
|
19
19
|
program
|
|
20
|
-
.name('
|
|
20
|
+
.name('tetra-dev-token')
|
|
21
21
|
.description('Manage Supabase dev tokens for API testing')
|
|
22
|
-
.version('1.
|
|
22
|
+
.version('1.2.0')
|
|
23
23
|
.option('--login', 'Interactive login (prompts for email/password)')
|
|
24
24
|
.option('--status', 'Show current token status')
|
|
25
25
|
.option('--project <name>', 'Override auto-detected project slug')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Tetra Dev Toolkit - Setup CLI
|
|
5
5
|
*
|
|
6
6
|
* Sets up quality infrastructure in a project:
|
|
7
7
|
* - Husky pre-commit hooks
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* - Configuration file
|
|
10
10
|
*
|
|
11
11
|
* Usage:
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* tetra-setup # Interactive setup
|
|
13
|
+
* tetra-setup hooks # Setup Husky hooks only
|
|
14
|
+
* tetra-setup ci # Setup GitHub Actions only
|
|
15
|
+
* tetra-setup config # Create .tetra-quality.json
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { program } from 'commander'
|
|
@@ -23,14 +23,14 @@ import { join } from 'path'
|
|
|
23
23
|
const projectRoot = process.cwd()
|
|
24
24
|
|
|
25
25
|
program
|
|
26
|
-
.name('
|
|
27
|
-
.description('Setup
|
|
28
|
-
.version('1.
|
|
26
|
+
.name('tetra-setup')
|
|
27
|
+
.description('Setup Tetra Dev Toolkit in your project')
|
|
28
|
+
.version('1.2.0')
|
|
29
29
|
.argument('[component]', 'Component to setup: hooks, ci, config, or all (default)')
|
|
30
30
|
.option('-f, --force', 'Overwrite existing files')
|
|
31
31
|
.action(async (component, options) => {
|
|
32
32
|
console.log('')
|
|
33
|
-
console.log('🔧
|
|
33
|
+
console.log('🔧 Tetra Dev Toolkit - Setup')
|
|
34
34
|
console.log('═'.repeat(50))
|
|
35
35
|
console.log('')
|
|
36
36
|
|
|
@@ -58,7 +58,7 @@ program
|
|
|
58
58
|
console.log('✅ Setup complete!')
|
|
59
59
|
console.log('')
|
|
60
60
|
console.log('Next steps:')
|
|
61
|
-
console.log(' 1. Run `
|
|
61
|
+
console.log(' 1. Run `tetra-audit` to check your project')
|
|
62
62
|
console.log(' 2. Commit the generated files')
|
|
63
63
|
console.log(' 3. Push to trigger CI checks')
|
|
64
64
|
console.log('')
|
|
@@ -95,14 +95,14 @@ async function setupHooks(options) {
|
|
|
95
95
|
const preCommitContent = `#!/bin/sh
|
|
96
96
|
. "$(dirname "$0")/_/husky.sh"
|
|
97
97
|
|
|
98
|
-
echo "🔍 Running
|
|
98
|
+
echo "🔍 Running Tetra quality checks..."
|
|
99
99
|
|
|
100
100
|
# Run quick security checks (fast, blocks commit on critical issues)
|
|
101
|
-
npx
|
|
101
|
+
npx tetra-audit quick
|
|
102
102
|
if [ $? -ne 0 ]; then
|
|
103
103
|
echo ""
|
|
104
104
|
echo "❌ Security issues found! Fix before committing."
|
|
105
|
-
echo " Run '
|
|
105
|
+
echo " Run 'tetra-audit' for detailed report."
|
|
106
106
|
exit 1
|
|
107
107
|
fi
|
|
108
108
|
|
|
@@ -149,7 +149,7 @@ on:
|
|
|
149
149
|
|
|
150
150
|
jobs:
|
|
151
151
|
quality:
|
|
152
|
-
name: 🔍
|
|
152
|
+
name: 🔍 Tetra Quality Audit
|
|
153
153
|
runs-on: ubuntu-latest
|
|
154
154
|
|
|
155
155
|
steps:
|
|
@@ -165,8 +165,8 @@ jobs:
|
|
|
165
165
|
- name: Install dependencies
|
|
166
166
|
run: npm ci
|
|
167
167
|
|
|
168
|
-
- name: Run
|
|
169
|
-
run: npx
|
|
168
|
+
- name: Run Tetra Quality Audit
|
|
169
|
+
run: npx tetra-audit --ci
|
|
170
170
|
|
|
171
171
|
- name: Upload results
|
|
172
172
|
if: always()
|
|
@@ -186,10 +186,10 @@ jobs:
|
|
|
186
186
|
async function setupConfig(options) {
|
|
187
187
|
console.log('📝 Setting up configuration...')
|
|
188
188
|
|
|
189
|
-
const configPath = join(projectRoot, '.
|
|
189
|
+
const configPath = join(projectRoot, '.tetra-quality.json')
|
|
190
190
|
if (!existsSync(configPath) || options.force) {
|
|
191
191
|
const config = {
|
|
192
|
-
"$schema": "https://
|
|
192
|
+
"$schema": "https://tetra-tools.dev/schemas/quality-toolkit.json",
|
|
193
193
|
"suites": {
|
|
194
194
|
"security": true,
|
|
195
195
|
"stability": true,
|
|
@@ -218,7 +218,7 @@ async function setupConfig(options) {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n')
|
|
221
|
-
console.log(' ✅ Created .
|
|
221
|
+
console.log(' ✅ Created .tetra-quality.json')
|
|
222
222
|
} else {
|
|
223
223
|
console.log(' ⏭️ Config already exists (use --force to overwrite)')
|
|
224
224
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Health Check: @
|
|
2
|
+
* Health Check: @soulbatical/tetra-dev-toolkit Installation
|
|
3
3
|
*
|
|
4
4
|
* Checks if the quality toolkit is installed and CLI commands available.
|
|
5
5
|
* Score: 0 = not installed, 1 = installed, 2 = all commands available
|
|
@@ -15,7 +15,7 @@ export async function check(projectPath, { getCachedCodeQuality } = {}) {
|
|
|
15
15
|
const result = createCheck('quality-toolkit', 2, {
|
|
16
16
|
installed: false,
|
|
17
17
|
version: null,
|
|
18
|
-
commands: { '
|
|
18
|
+
commands: { 'tetra-audit': false, 'tetra-setup': false, 'tetra-dev-token': false }
|
|
19
19
|
})
|
|
20
20
|
|
|
21
21
|
const packageJsonPath = join(projectPath, 'package.json')
|
|
@@ -28,12 +28,12 @@ export async function check(projectPath, { getCachedCodeQuality } = {}) {
|
|
|
28
28
|
try {
|
|
29
29
|
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))
|
|
30
30
|
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies }
|
|
31
|
-
const toolkitDep = allDeps['@vca/dev-toolkit'] || allDeps['@vca/quality-toolkit']
|
|
31
|
+
const toolkitDep = allDeps['@soulbatical/tetra-dev-toolkit'] || allDeps['@vca/dev-toolkit'] || allDeps['@vca/quality-toolkit']
|
|
32
32
|
|
|
33
33
|
if (!toolkitDep) {
|
|
34
34
|
result.status = 'warning'
|
|
35
35
|
result.details.message = 'Not installed'
|
|
36
|
-
result.details.installCommand = 'npm install --save-dev /
|
|
36
|
+
result.details.installCommand = 'npm install --save-dev @soulbatical/tetra-dev-toolkit'
|
|
37
37
|
return result
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -42,8 +42,12 @@ export async function check(projectPath, { getCachedCodeQuality } = {}) {
|
|
|
42
42
|
result.score = 1
|
|
43
43
|
|
|
44
44
|
// Get installed version from node_modules
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const lookupPaths = [
|
|
46
|
+
join(projectPath, 'node_modules', '@soulbatical', 'tetra-dev-toolkit', 'package.json'),
|
|
47
|
+
join(projectPath, 'node_modules', '@vca', 'dev-toolkit', 'package.json'),
|
|
48
|
+
join(projectPath, 'node_modules', '@vca', 'quality-toolkit', 'package.json'),
|
|
49
|
+
]
|
|
50
|
+
for (const toolkitPackagePath of lookupPaths) {
|
|
47
51
|
if (existsSync(toolkitPackagePath)) {
|
|
48
52
|
try {
|
|
49
53
|
result.details.version = JSON.parse(readFileSync(toolkitPackagePath, 'utf-8')).version
|
|
@@ -54,9 +58,9 @@ export async function check(projectPath, { getCachedCodeQuality } = {}) {
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
// Check CLI commands
|
|
61
|
+
// Check CLI commands (check new tetra-* names, fall back to legacy vca-*)
|
|
58
62
|
const binPath = join(projectPath, 'node_modules', '.bin')
|
|
59
|
-
const commands = ['
|
|
63
|
+
const commands = ['tetra-audit', 'tetra-setup', 'tetra-dev-token']
|
|
60
64
|
for (const cmd of commands) {
|
|
61
65
|
result.details.commands[cmd] = existsSync(join(binPath, cmd))
|
|
62
66
|
}
|
|
@@ -43,7 +43,7 @@ export async function check(projectPath) {
|
|
|
43
43
|
|
|
44
44
|
try {
|
|
45
45
|
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
|
|
46
|
-
headers: { 'User-Agent': '
|
|
46
|
+
headers: { 'User-Agent': 'tetra-health-check' },
|
|
47
47
|
signal: AbortSignal.timeout(5000)
|
|
48
48
|
})
|
|
49
49
|
|
|
@@ -91,7 +91,7 @@ export async function run(config, projectRoot) {
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
name: 'security-audit',
|
|
94
|
-
patterns: ['npm audit', 'vca-audit', 'security-check', 'snyk', 'CodeQL'],
|
|
94
|
+
patterns: ['npm audit', 'tetra-audit', 'vca-audit', 'security-check', 'snyk', 'CodeQL'],
|
|
95
95
|
severity: 'medium'
|
|
96
96
|
}
|
|
97
97
|
]
|
|
@@ -56,7 +56,7 @@ export async function run(config, projectRoot) {
|
|
|
56
56
|
{ name: 'lint', patterns: ['lint', 'eslint'] },
|
|
57
57
|
{ name: 'type-check', patterns: ['tsc', 'typecheck', 'type-check'] },
|
|
58
58
|
{ name: 'test', patterns: ['test', 'jest', 'vitest'] },
|
|
59
|
-
{ name: 'security', patterns: ['security', 'audit', 'vca-'] }
|
|
59
|
+
{ name: 'security', patterns: ['security', 'audit', 'tetra-', 'vca-'] }
|
|
60
60
|
]
|
|
61
61
|
|
|
62
62
|
const missingChecks = []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Tetra Dev Toolkit - Dev Token Manager
|
|
3
3
|
*
|
|
4
|
-
* Centralized dev token management for all
|
|
4
|
+
* Centralized dev token management for all Tetra/Supabase projects.
|
|
5
5
|
* Auto-detects project name, finds Supabase config, manages token lifecycle.
|
|
6
6
|
*
|
|
7
7
|
* Replaces per-project generate-dev-token.js scripts.
|
|
@@ -279,7 +279,7 @@ export async function runDevToken({ forceLogin = false, showStatus = false, proj
|
|
|
279
279
|
if (showStatus) {
|
|
280
280
|
if (!cache) {
|
|
281
281
|
console.log(chalk.red('No cached token.'))
|
|
282
|
-
console.log(chalk.dim(`Run:
|
|
282
|
+
console.log(chalk.dim(`Run: tetra-dev-token --login`))
|
|
283
283
|
process.exit(1)
|
|
284
284
|
}
|
|
285
285
|
const payload = decodeJWT(cache.access_token)
|
|
@@ -337,6 +337,6 @@ export async function runDevToken({ forceLogin = false, showStatus = false, proj
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
console.log(chalk.red('No valid token.'))
|
|
340
|
-
console.log(chalk.dim(`Run:
|
|
340
|
+
console.log(chalk.dim(`Run: tetra-dev-token --login`))
|
|
341
341
|
process.exit(1)
|
|
342
342
|
}
|
package/lib/config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Tetra Dev Toolkit - Configuration
|
|
3
3
|
*
|
|
4
4
|
* Default configuration that can be overridden per project via:
|
|
5
|
-
* - .
|
|
6
|
-
* -
|
|
5
|
+
* - .tetra-quality.json in project root (also checks legacy .vca-quality.json)
|
|
6
|
+
* - tetra-quality key in package.json (also checks legacy vca-quality key)
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { readFileSync, existsSync } from 'fs'
|
|
@@ -135,23 +135,26 @@ export const DEFAULT_CONFIG = {
|
|
|
135
135
|
export function loadConfig(projectRoot = process.cwd()) {
|
|
136
136
|
let projectConfig = {}
|
|
137
137
|
|
|
138
|
-
// Check for .vca-quality.json
|
|
139
|
-
const configFile = join(projectRoot, '.
|
|
140
|
-
|
|
138
|
+
// Check for .tetra-quality.json (with legacy .vca-quality.json fallback)
|
|
139
|
+
const configFile = join(projectRoot, '.tetra-quality.json')
|
|
140
|
+
const legacyConfigFile = join(projectRoot, '.vca-quality.json')
|
|
141
|
+
const activeConfigFile = existsSync(configFile) ? configFile : (existsSync(legacyConfigFile) ? legacyConfigFile : null)
|
|
142
|
+
if (activeConfigFile) {
|
|
141
143
|
try {
|
|
142
|
-
projectConfig = JSON.parse(readFileSync(
|
|
144
|
+
projectConfig = JSON.parse(readFileSync(activeConfigFile, 'utf-8'))
|
|
143
145
|
} catch (e) {
|
|
144
|
-
console.warn(`Warning: Could not parse ${
|
|
146
|
+
console.warn(`Warning: Could not parse ${activeConfigFile}`)
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
|
|
148
|
-
// Check for
|
|
150
|
+
// Check for tetra-quality in package.json (with legacy vca-quality fallback)
|
|
149
151
|
const packageFile = join(projectRoot, 'package.json')
|
|
150
152
|
if (existsSync(packageFile)) {
|
|
151
153
|
try {
|
|
152
154
|
const pkg = JSON.parse(readFileSync(packageFile, 'utf-8'))
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
const pkgConfig = pkg['tetra-quality'] || pkg['vca-quality']
|
|
156
|
+
if (pkgConfig) {
|
|
157
|
+
projectConfig = { ...projectConfig, ...pkgConfig }
|
|
155
158
|
}
|
|
156
159
|
} catch (e) {
|
|
157
160
|
// Ignore
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Tetra Dev Toolkit
|
|
3
3
|
*
|
|
4
|
-
* Unified quality checks for all
|
|
4
|
+
* Unified quality checks for all Tetra projects.
|
|
5
5
|
* Consolidates security, stability, and code quality checks
|
|
6
|
-
*
|
|
6
|
+
* into a single npm package.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { loadConfig, detectSupabase, DEFAULT_CONFIG } from './config.js'
|
|
@@ -24,7 +24,7 @@ export function formatResults(results, options = {}) {
|
|
|
24
24
|
// Header
|
|
25
25
|
lines.push('')
|
|
26
26
|
lines.push(chalk.bold('═══════════════════════════════════════════════════════════════'))
|
|
27
|
-
lines.push(chalk.bold.cyan(' 🔍
|
|
27
|
+
lines.push(chalk.bold.cyan(' 🔍 Tetra Dev Toolkit - Audit Results'))
|
|
28
28
|
lines.push(chalk.bold('═══════════════════════════════════════════════════════════════'))
|
|
29
29
|
lines.push('')
|
|
30
30
|
|
package/lib/runner.js
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulbatical/tetra-dev-toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "restricted"
|
|
6
6
|
},
|
|
7
|
-
"description": "Developer toolkit for
|
|
7
|
+
"description": "Developer toolkit for Tetra projects - audit, dev-token, quality checks",
|
|
8
8
|
"author": "Albert Barth <albertbarth@gmail.com>",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
@@ -25,11 +25,9 @@
|
|
|
25
25
|
"type": "module",
|
|
26
26
|
"main": "lib/index.js",
|
|
27
27
|
"bin": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"vca-setup": "./bin/vca-setup.js",
|
|
32
|
-
"vca-dev-token": "./bin/vca-dev-token.js"
|
|
28
|
+
"tetra-audit": "./bin/tetra-audit.js",
|
|
29
|
+
"tetra-setup": "./bin/tetra-setup.js",
|
|
30
|
+
"tetra-dev-token": "./bin/tetra-dev-token.js"
|
|
33
31
|
},
|
|
34
32
|
"files": [
|
|
35
33
|
"bin/",
|
|
@@ -39,8 +37,7 @@
|
|
|
39
37
|
"scripts": {
|
|
40
38
|
"test": "node --test src/**/*.test.js",
|
|
41
39
|
"lint": "eslint src/ lib/ bin/",
|
|
42
|
-
"build": "echo 'No build step needed'"
|
|
43
|
-
"prepublishOnly": "npm test && npm run lint"
|
|
40
|
+
"build": "echo 'No build step needed'"
|
|
44
41
|
},
|
|
45
42
|
"engines": {
|
|
46
43
|
"node": ">=18.0.0"
|
package/README.md
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
# @vca/quality-toolkit
|
|
2
|
-
|
|
3
|
-
Unified quality checks for all VCA projects. Consolidates security, stability, and code quality checks from sparkbuddy-live and vca-tools into a single npm package.
|
|
4
|
-
|
|
5
|
-
**Status:** Installed in 13 projects | Version 1.0.0
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Local installation (recommended for VCA projects)
|
|
11
|
-
npm install --save-dev /Users/albertbarth/projecten/vca-quality-toolkit
|
|
12
|
-
|
|
13
|
-
# Or via file reference in package.json
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@vca/quality-toolkit": "file:../vca-quality-toolkit"
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Quick Start
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Run all checks
|
|
23
|
-
npx vca-audit
|
|
24
|
-
|
|
25
|
-
# Run only security checks
|
|
26
|
-
npx vca-audit security
|
|
27
|
-
|
|
28
|
-
# Run only stability checks
|
|
29
|
-
npx vca-audit stability
|
|
30
|
-
|
|
31
|
-
# Quick check (critical issues only - fast, for pre-commit)
|
|
32
|
-
npx vca-audit quick
|
|
33
|
-
|
|
34
|
-
# Setup Husky hooks and CI
|
|
35
|
-
npx vca-setup
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Example Output
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
═══════════════════════════════════════════════════════════════
|
|
42
|
-
🔍 VCA Quality Toolkit - Audit Results
|
|
43
|
-
═══════════════════════════════════════════════════════════════
|
|
44
|
-
|
|
45
|
-
Project: /Users/albertbarth/projecten/ralph-manager
|
|
46
|
-
Time: 2026-02-03T15:04:03.478Z
|
|
47
|
-
|
|
48
|
-
✅ Overall Status: PASSED
|
|
49
|
-
|
|
50
|
-
✅ SECURITY
|
|
51
|
-
──────────────────────────────────────────────────
|
|
52
|
-
✅ Hardcoded Secrets Detection PASS
|
|
53
|
-
✅ Service Role Key Exposure PASS
|
|
54
|
-
✅ Deprecated supabaseAdmin Usage PASS
|
|
55
|
-
✅ systemDB Context Whitelist PASS
|
|
56
|
-
|
|
57
|
-
✅ STABILITY
|
|
58
|
-
──────────────────────────────────────────────────
|
|
59
|
-
✅ Pre-commit Hooks (Husky) PASS
|
|
60
|
-
✅ CI/CD Pipeline PASS
|
|
61
|
-
✅ NPM Vulnerability Audit PASS
|
|
62
|
-
|
|
63
|
-
═══════════════════════════════════════════════════════════════
|
|
64
|
-
Checks: 7 passed, 0 failed, 0 skipped
|
|
65
|
-
═══════════════════════════════════════════════════════════════
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## What It Checks
|
|
69
|
-
|
|
70
|
-
### Security (4 checks implemented)
|
|
71
|
-
| Check | Severity | Description |
|
|
72
|
-
|-------|----------|-------------|
|
|
73
|
-
| Hardcoded Secrets | Critical | API keys, tokens, JWTs in source code |
|
|
74
|
-
| Service Key Exposure | Critical | Supabase service role key in frontend |
|
|
75
|
-
| Deprecated supabaseAdmin | High | Direct supabaseAdmin usage (use systemDB/userDB) |
|
|
76
|
-
| systemDB Whitelist | High | Unwhitelisted systemDB contexts |
|
|
77
|
-
|
|
78
|
-
### Stability (3 checks implemented)
|
|
79
|
-
| Check | Severity | Description |
|
|
80
|
-
|-------|----------|-------------|
|
|
81
|
-
| Husky Hooks | High | Pre-commit hooks configured with useful checks |
|
|
82
|
-
| CI Pipeline | High | GitHub Actions/GitLab CI with lint, test, build |
|
|
83
|
-
| npm audit | High | No critical/high vulnerabilities |
|
|
84
|
-
|
|
85
|
-
### Health (15 ecosystem checks) — NEW
|
|
86
|
-
|
|
87
|
-
Project-level health scanner shared by ralph-manager and development-mcp.
|
|
88
|
-
|
|
89
|
-
| Check | Max Score | Description |
|
|
90
|
-
|-------|-----------|-------------|
|
|
91
|
-
| `plugins` | 2 | Claude Code plugins installed |
|
|
92
|
-
| `mcps` | 1 | MCP servers configured |
|
|
93
|
-
| `git` | 3 | Branch, uncommitted, unpushed |
|
|
94
|
-
| `tests` | 5 | Test pyramid (unit/integration/e2e) |
|
|
95
|
-
| `secrets` | 2 | Exposed secrets in MD files |
|
|
96
|
-
| `quality-toolkit` | 2 | @vca/dev-toolkit installed |
|
|
97
|
-
| `naming-conventions` | 3 | DB + code naming compliance |
|
|
98
|
-
| `rls-audit` | 3 | RLS policies in SQL migrations |
|
|
99
|
-
| `gitignore` | 2 | Critical .gitignore entries |
|
|
100
|
-
| `repo-visibility` | 2 | Public vs private repo |
|
|
101
|
-
| `vincifox-widget` | 2 | VinciFox feedback widget |
|
|
102
|
-
| `stella-integration` | 2 | @ralph/stella integration level |
|
|
103
|
-
| `claude-md` | 3 | CLAUDE.md protocol sections |
|
|
104
|
-
| `doppler-compliance` | 3 | Doppler secret management |
|
|
105
|
-
| `infrastructure-yml` | 3 | .ralph/INFRASTRUCTURE.yml |
|
|
106
|
-
|
|
107
|
-
**Total: 38 points.** Score thresholds: Healthy >= 70%, Warning 40-70%, Unhealthy < 40%.
|
|
108
|
-
|
|
109
|
-
```javascript
|
|
110
|
-
import { scanProjectHealth } from '@vca/dev-toolkit'
|
|
111
|
-
|
|
112
|
-
const report = await scanProjectHealth('/path/to/project', 'my-project')
|
|
113
|
-
console.log(report.healthPercent + '%') // e.g. "58%"
|
|
114
|
-
console.log(report.status) // "healthy" | "warning" | "unhealthy"
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Planned Checks
|
|
118
|
-
- [ ] Dead code detection (Knip integration)
|
|
119
|
-
- [ ] Circular dependency detection
|
|
120
|
-
- [ ] TypeScript strict mode
|
|
121
|
-
- [ ] Test coverage thresholds
|
|
122
|
-
|
|
123
|
-
## Integration with Ralph Manager
|
|
124
|
-
|
|
125
|
-
The toolkit integrates with ralph-manager's Health dashboard:
|
|
126
|
-
|
|
127
|
-
- **Health Scanner**: Shared 15-check scanner (ralph-manager imports from this package)
|
|
128
|
-
- **Toolkit Check**: Shows toolkit installation status per project
|
|
129
|
-
- **API Endpoint**: `/api/admin/health/quality-toolkit` returns status for all projects
|
|
130
|
-
|
|
131
|
-
## Usage in package.json
|
|
132
|
-
|
|
133
|
-
```json
|
|
134
|
-
{
|
|
135
|
-
"scripts": {
|
|
136
|
-
"audit": "vca-audit",
|
|
137
|
-
"audit:security": "vca-audit security",
|
|
138
|
-
"audit:quick": "vca-audit quick",
|
|
139
|
-
"prepare": "husky"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Configuration
|
|
145
|
-
|
|
146
|
-
Create `.vca-quality.json` in your project root:
|
|
147
|
-
|
|
148
|
-
```json
|
|
149
|
-
{
|
|
150
|
-
"suites": {
|
|
151
|
-
"security": true,
|
|
152
|
-
"stability": true,
|
|
153
|
-
"codeQuality": true,
|
|
154
|
-
"supabase": "auto"
|
|
155
|
-
},
|
|
156
|
-
"security": {
|
|
157
|
-
"checkHardcodedSecrets": true,
|
|
158
|
-
"checkServiceKeyExposure": true
|
|
159
|
-
},
|
|
160
|
-
"stability": {
|
|
161
|
-
"requireHusky": true,
|
|
162
|
-
"requireCiConfig": true,
|
|
163
|
-
"allowedVulnerabilities": {
|
|
164
|
-
"critical": 0,
|
|
165
|
-
"high": 0,
|
|
166
|
-
"moderate": 10
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
"supabase": {
|
|
170
|
-
"publicRpcFunctions": ["get_public_stats"],
|
|
171
|
-
"publicTables": ["lookup_countries"]
|
|
172
|
-
},
|
|
173
|
-
"ignore": [
|
|
174
|
-
"node_modules/**",
|
|
175
|
-
"dist/**"
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## CI Integration
|
|
181
|
-
|
|
182
|
-
### GitHub Actions
|
|
183
|
-
|
|
184
|
-
```yaml
|
|
185
|
-
name: Quality Checks
|
|
186
|
-
|
|
187
|
-
on: [push, pull_request]
|
|
188
|
-
|
|
189
|
-
jobs:
|
|
190
|
-
quality:
|
|
191
|
-
runs-on: ubuntu-latest
|
|
192
|
-
steps:
|
|
193
|
-
- uses: actions/checkout@v4
|
|
194
|
-
- uses: actions/setup-node@v4
|
|
195
|
-
with:
|
|
196
|
-
node-version: '20'
|
|
197
|
-
- run: npm ci
|
|
198
|
-
- run: npx vca-audit --ci
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
The `--ci` flag outputs GitHub Actions annotations for inline PR feedback.
|
|
202
|
-
|
|
203
|
-
### Pre-commit Hook
|
|
204
|
-
|
|
205
|
-
Run `npx vca-setup hooks` or manually create `.husky/pre-commit`:
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
#!/bin/sh
|
|
209
|
-
npx vca-audit quick
|
|
210
|
-
if [ $? -ne 0 ]; then
|
|
211
|
-
echo "❌ Security issues found! Fix before committing."
|
|
212
|
-
exit 1
|
|
213
|
-
fi
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Programmatic Usage
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
import { runAllChecks, runSecurityChecks } from '@vca/quality-toolkit'
|
|
220
|
-
|
|
221
|
-
const results = await runAllChecks()
|
|
222
|
-
|
|
223
|
-
if (!results.passed) {
|
|
224
|
-
console.log('Quality checks failed!')
|
|
225
|
-
console.log(`Critical: ${results.summary.findings.critical}`)
|
|
226
|
-
console.log(`High: ${results.summary.findings.high}`)
|
|
227
|
-
}
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## Projects Using This Toolkit
|
|
231
|
-
|
|
232
|
-
| Project | Status | Version |
|
|
233
|
-
|---------|--------|---------|
|
|
234
|
-
| ralph-manager | ✅ | 1.0.0 |
|
|
235
|
-
| sparkbuddy-live | ✅ | 1.0.0 |
|
|
236
|
-
| snelstart-mcp | ✅ | 1.0.0 |
|
|
237
|
-
| snelstart-portal | ✅ | 1.0.0 |
|
|
238
|
-
| vibecodingacademy | ✅ | 1.0.0 |
|
|
239
|
-
| Plokko | ✅ | 1.0.0 |
|
|
240
|
-
| ad-agent | ✅ | 1.0.0 |
|
|
241
|
-
| ai-finder | ✅ | 1.0.0 |
|
|
242
|
-
| airbnb | ✅ | 1.0.0 |
|
|
243
|
-
| github-ai-research | ✅ | 1.0.0 |
|
|
244
|
-
| groei-boom | ✅ | 1.0.0 |
|
|
245
|
-
| sparkgrowth | ✅ | 1.0.0 |
|
|
246
|
-
| vca-security | ✅ | 1.0.0 |
|
|
247
|
-
|
|
248
|
-
## Relationship to vca-tools
|
|
249
|
-
|
|
250
|
-
This package complements [vca-tools](https://github.com/mralbertzwolle/vibe-coding-academy-tools) (Claude Code plugins):
|
|
251
|
-
|
|
252
|
-
| Tool | Purpose | Usage |
|
|
253
|
-
|------|---------|-------|
|
|
254
|
-
| **vca-tools** | Interactive Claude Code plugins | `/security-audit:run`, `/codebase-stability-audit:run` |
|
|
255
|
-
| **@vca/quality-toolkit** | Automated CI/pre-commit checks | `npx vca-audit`, GitHub Actions |
|
|
256
|
-
|
|
257
|
-
Both share the same check logic, but:
|
|
258
|
-
- **vca-tools** = human-in-the-loop, detailed reports, fix suggestions
|
|
259
|
-
- **@vca/quality-toolkit** = automated, CI-friendly, pass/fail
|
|
260
|
-
|
|
261
|
-
## Architecture
|
|
262
|
-
|
|
263
|
-
```
|
|
264
|
-
@vca/quality-toolkit/
|
|
265
|
-
├── bin/
|
|
266
|
-
│ ├── vca-audit.js # Main CLI
|
|
267
|
-
│ └── vca-setup.js # Setup hooks/CI
|
|
268
|
-
├── lib/
|
|
269
|
-
│ ├── index.js # Main exports
|
|
270
|
-
│ ├── config.js # Configuration loader
|
|
271
|
-
│ ├── runner.js # Check orchestrator
|
|
272
|
-
│ ├── checks/
|
|
273
|
-
│ │ ├── health/ # 15 ecosystem health checks (shared with ralph-manager)
|
|
274
|
-
│ │ │ ├── scanner.js # Orchestrator — scanProjectHealth()
|
|
275
|
-
│ │ │ ├── types.js # Shared types & helpers
|
|
276
|
-
│ │ │ ├── plugins.js # Claude Code plugins
|
|
277
|
-
│ │ │ ├── mcps.js # MCP server config
|
|
278
|
-
│ │ │ ├── git.js # Git status
|
|
279
|
-
│ │ │ ├── tests.js # Test pyramid
|
|
280
|
-
│ │ │ ├── secrets.js # Exposed secrets
|
|
281
|
-
│ │ │ └── ... # 10 more checks
|
|
282
|
-
│ │ ├── security/ # Security checks
|
|
283
|
-
│ │ ├── stability/ # Stability checks
|
|
284
|
-
│ │ ├── codeQuality/ # Code quality checks
|
|
285
|
-
│ │ └── supabase/ # Supabase checks
|
|
286
|
-
│ └── reporters/
|
|
287
|
-
│ └── terminal.js # Pretty output + GitHub Actions
|
|
288
|
-
└── package.json
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Consumers
|
|
292
|
-
|
|
293
|
-
| Package | Import | Usage |
|
|
294
|
-
|---------|--------|-------|
|
|
295
|
-
| **ralph-manager** | `scanProjectHealth` | Dashboard health scanner (background job, every 2 min) |
|
|
296
|
-
| **development-mcp** | `scanProjectHealth` | `health_check` MCP tool (on-demand via Claude Code) |
|
|
297
|
-
| **13 VCA projects** | `vca-audit` CLI | CI/pre-commit quality checks |
|
|
298
|
-
|
|
299
|
-
## Contributing
|
|
300
|
-
|
|
301
|
-
1. Add new check in `lib/checks/<category>/<name>.js`
|
|
302
|
-
2. Register in `lib/runner.js`
|
|
303
|
-
3. Update README
|
|
304
|
-
4. Test with `npx vca-audit` in a project
|
|
305
|
-
|
|
306
|
-
## License
|
|
307
|
-
|
|
308
|
-
MIT
|
|
309
|
-
|
|
310
|
-
---
|
|
311
|
-
|
|
312
|
-
Built by [Vibe Coding Academy](https://vibecodingacademy.nl) • [Albert Barth](https://linkedin.com/in/albertbarth/)
|