Implements Phases 1-8 of the TFTSR implementation plan. Rust backend (Tauri 2.x, src-tauri/): - Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama - PII detection engine: 11 regex patterns with overlap resolution - SQLCipher AES-256 encrypted database with 10 versioned migrations - 28 Tauri IPC commands for triage, analysis, document, and system ops - Ollama: hardware probe, model recommendations, pull/delete with events - RCA and blameless post-mortem Markdown document generators - PDF export via printpdf - Audit log: SHA-256 hash of every external data send - Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2) Frontend (React 18 + TypeScript + Vite, src/): - 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings - 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives - 3 Zustand stores: session, settings (persisted), history - Type-safe tauriCommands.ts matching Rust backend types exactly - 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs) DevOps: - .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push - .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload Verified: - cargo check: zero errors - tsc --noEmit: zero errors - vitest run: 13/13 unit tests passing Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
80 lines
2.5 KiB
JavaScript
Executable File
80 lines
2.5 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
import { performance } from 'node:perf_hooks'
|
|
import module from 'node:module'
|
|
|
|
if (!import.meta.url.includes('node_modules')) {
|
|
try {
|
|
// only available as dev dependency
|
|
await import('source-map-support').then((r) => r.default.install())
|
|
} catch {}
|
|
|
|
process.on('unhandledRejection', (err) => {
|
|
throw new Error('UNHANDLED PROMISE REJECTION', { cause: err })
|
|
})
|
|
}
|
|
|
|
global.__vite_start_time = performance.now()
|
|
|
|
// check debug mode first before requiring the CLI.
|
|
const debugIndex = process.argv.findIndex((arg) => /^(?:-d|--debug)$/.test(arg))
|
|
const filterIndex = process.argv.findIndex((arg) =>
|
|
/^(?:-f|--filter)$/.test(arg),
|
|
)
|
|
const profileIndex = process.argv.indexOf('--profile')
|
|
|
|
if (debugIndex > 0) {
|
|
let value = process.argv[debugIndex + 1]
|
|
if (!value || value.startsWith('-')) {
|
|
value = 'vite:*'
|
|
} else {
|
|
// support debugging multiple flags with comma-separated list
|
|
value = value
|
|
.split(',')
|
|
.map((v) => `vite:${v}`)
|
|
.join(',')
|
|
}
|
|
process.env.DEBUG = `${
|
|
process.env.DEBUG ? process.env.DEBUG + ',' : ''
|
|
}${value}`
|
|
|
|
if (filterIndex > 0) {
|
|
const filter = process.argv[filterIndex + 1]
|
|
if (filter && !filter.startsWith('-')) {
|
|
process.env.VITE_DEBUG_FILTER = filter
|
|
}
|
|
}
|
|
}
|
|
|
|
function start() {
|
|
try {
|
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- it is supported in Node 22.8.0+ and only called if it exists
|
|
module.enableCompileCache?.()
|
|
// flush the cache after 10s because the cache is not flushed until process end
|
|
// for dev server, the cache is never flushed unless manually flushed because the process.exit is called
|
|
// also flushing the cache in SIGINT handler seems to cause the process to hang
|
|
setTimeout(() => {
|
|
try {
|
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins -- it is supported in Node 22.12.0+ and only called if it exists
|
|
module.flushCompileCache?.()
|
|
} catch {}
|
|
}, 10 * 1000).unref()
|
|
} catch {}
|
|
return import('../dist/node/cli.js')
|
|
}
|
|
|
|
if (profileIndex > 0) {
|
|
process.argv.splice(profileIndex, 1)
|
|
const next = process.argv[profileIndex]
|
|
if (next && !next.startsWith('-')) {
|
|
process.argv.splice(profileIndex, 1)
|
|
}
|
|
const inspector = await import('node:inspector').then((r) => r.default)
|
|
const session = (global.__vite_profile_session = new inspector.Session())
|
|
session.connect()
|
|
session.post('Profiler.enable', () => {
|
|
session.post('Profiler.start', start)
|
|
})
|
|
} else {
|
|
start()
|
|
}
|