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>
105 lines
2.2 KiB
JavaScript
105 lines
2.2 KiB
JavaScript
let postcss = require('postcss')
|
|
|
|
let IMPORTANT = /\s*!important\s*$/i
|
|
|
|
let UNITLESS = {
|
|
'box-flex': true,
|
|
'box-flex-group': true,
|
|
'column-count': true,
|
|
'flex': true,
|
|
'flex-grow': true,
|
|
'flex-positive': true,
|
|
'flex-shrink': true,
|
|
'flex-negative': true,
|
|
'font-weight': true,
|
|
'line-clamp': true,
|
|
'line-height': true,
|
|
'opacity': true,
|
|
'order': true,
|
|
'orphans': true,
|
|
'tab-size': true,
|
|
'widows': true,
|
|
'z-index': true,
|
|
'zoom': true,
|
|
'fill-opacity': true,
|
|
'stroke-dashoffset': true,
|
|
'stroke-opacity': true,
|
|
'stroke-width': true
|
|
}
|
|
|
|
function dashify(str) {
|
|
return str
|
|
.replace(/([A-Z])/g, '-$1')
|
|
.replace(/^ms-/, '-ms-')
|
|
.toLowerCase()
|
|
}
|
|
|
|
function decl(parent, name, value) {
|
|
if (value === false || value === null) return
|
|
|
|
if (!name.startsWith('--')) {
|
|
name = dashify(name)
|
|
}
|
|
|
|
if (typeof value === 'number') {
|
|
if (value === 0 || UNITLESS[name]) {
|
|
value = value.toString()
|
|
} else {
|
|
value += 'px'
|
|
}
|
|
}
|
|
|
|
if (name === 'css-float') name = 'float'
|
|
|
|
if (IMPORTANT.test(value)) {
|
|
value = value.replace(IMPORTANT, '')
|
|
parent.push(postcss.decl({ prop: name, value, important: true }))
|
|
} else {
|
|
parent.push(postcss.decl({ prop: name, value }))
|
|
}
|
|
}
|
|
|
|
function atRule(parent, parts, value) {
|
|
let node = postcss.atRule({ name: parts[1], params: parts[3] || '' })
|
|
if (typeof value === 'object') {
|
|
node.nodes = []
|
|
parse(value, node)
|
|
}
|
|
parent.push(node)
|
|
}
|
|
|
|
function parse(obj, parent) {
|
|
let name, node, value
|
|
for (name in obj) {
|
|
value = obj[name]
|
|
if (value === null || typeof value === 'undefined') {
|
|
continue
|
|
} else if (name[0] === '@') {
|
|
let parts = name.match(/@(\S+)(\s+([\W\w]*)\s*)?/)
|
|
if (Array.isArray(value)) {
|
|
for (let i of value) {
|
|
atRule(parent, parts, i)
|
|
}
|
|
} else {
|
|
atRule(parent, parts, value)
|
|
}
|
|
} else if (Array.isArray(value)) {
|
|
for (let i of value) {
|
|
decl(parent, name, i)
|
|
}
|
|
} else if (typeof value === 'object') {
|
|
node = postcss.rule({ selector: name })
|
|
parse(value, node)
|
|
parent.push(node)
|
|
} else {
|
|
decl(parent, name, value)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = function (obj) {
|
|
let root = postcss.root()
|
|
parse(obj, root)
|
|
return root
|
|
}
|