nucleus-core-ts 0.9.500 → 0.9.600

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/cli.ts CHANGED
@@ -9,9 +9,9 @@
9
9
  * npx nucleus-core-ts help — Show available commands
10
10
  */
11
11
 
12
- import { spawn } from 'child_process'
13
- import { dirname, join } from 'path'
14
- import { fileURLToPath } from 'url'
12
+ import { spawn } from 'node:child_process'
13
+ import { dirname, join } from 'node:path'
14
+ import { fileURLToPath } from 'node:url'
15
15
 
16
16
  const BOLD = '\x1b[1m'
17
17
  const CYAN = '\x1b[36m'
@@ -36,18 +36,33 @@ ${BOLD}Usage:${RESET}
36
36
  npx nucleus-core-ts ${CYAN}<command>${RESET}
37
37
 
38
38
  ${BOLD}Commands:${RESET}
39
- ${CYAN}scaffold${RESET} Interactive project scaffolding (API + frontend + k8s + pipelines)
40
- ${CYAN}generate${RESET} Generate Drizzle schema from config.json
41
- ${CYAN}help${RESET} Show this help message
39
+ ${CYAN}scaffold${RESET} Interactive project scaffolding (API + frontend + k8s + pipelines)
40
+ ${CYAN}generate${RESET} Generate Drizzle schema from config.json
41
+ ${CYAN}audit:purge-noise${RESET} Delete historical low-signal audit_logs rows (dry-run by default)
42
+ ${CYAN}help${RESET} Show this help message
42
43
 
43
44
  ${BOLD}Examples:${RESET}
44
45
  ${DIM}npx nucleus-core-ts scaffold${RESET}
45
46
  ${DIM}npx nucleus-core-ts generate src/config.json src/drizzle${RESET}
47
+ ${DIM}npx nucleus-core-ts audit:purge-noise # dry run, all schemas${RESET}
48
+ ${DIM}npx nucleus-core-ts audit:purge-noise --execute # actually delete${RESET}
46
49
  `)
47
50
  }
48
51
 
52
+ async function runScript(scriptRelPath: string, args: string[]) {
53
+ return new Promise<void>(() => {
54
+ const proc = spawn('bun', ['run', join(rootDir, scriptRelPath), ...args], {
55
+ cwd: process.cwd(),
56
+ stdio: 'inherit',
57
+ })
58
+ proc.on('close', (code) => {
59
+ process.exit(code ?? 1)
60
+ })
61
+ })
62
+ }
63
+
49
64
  async function runGenerate(args: string[]) {
50
- return new Promise<void>((res) => {
65
+ return new Promise<void>(() => {
51
66
  const proc = spawn('bun', ['run', join(rootDir, 'scripts', 'generate-schema.ts'), ...args], {
52
67
  cwd: process.cwd(),
53
68
  stdio: 'inherit',
@@ -75,6 +90,12 @@ switch (command) {
75
90
  break
76
91
  }
77
92
 
93
+ case 'audit:purge-noise':
94
+ case 'audit-purge-noise': {
95
+ await runScript(join('scripts', 'audit-purge-noise.ts'), process.argv.slice(3))
96
+ break
97
+ }
98
+
78
99
  case 'help':
79
100
  case '--help':
80
101
  case '-h':