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>
66 lines
2.0 KiB
JavaScript
66 lines
2.0 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright (c) 2016, Contributors
|
|
* SPDX-License-Identifier: ISC
|
|
*/
|
|
export function camelCase(str) {
|
|
// Handle the case where an argument is provided as camel case, e.g., fooBar.
|
|
// by ensuring that the string isn't already mixed case:
|
|
const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
|
|
if (!isCamelCase) {
|
|
str = str.toLowerCase();
|
|
}
|
|
if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
|
|
return str;
|
|
}
|
|
else {
|
|
let camelcase = '';
|
|
let nextChrUpper = false;
|
|
const leadingHyphens = str.match(/^-+/);
|
|
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
|
|
let chr = str.charAt(i);
|
|
if (nextChrUpper) {
|
|
nextChrUpper = false;
|
|
chr = chr.toUpperCase();
|
|
}
|
|
if (i !== 0 && (chr === '-' || chr === '_')) {
|
|
nextChrUpper = true;
|
|
}
|
|
else if (chr !== '-' && chr !== '_') {
|
|
camelcase += chr;
|
|
}
|
|
}
|
|
return camelcase;
|
|
}
|
|
}
|
|
export function decamelize(str, joinString) {
|
|
const lowercase = str.toLowerCase();
|
|
joinString = joinString || '-';
|
|
let notCamelcase = '';
|
|
for (let i = 0; i < str.length; i++) {
|
|
const chrLower = lowercase.charAt(i);
|
|
const chrString = str.charAt(i);
|
|
if (chrLower !== chrString && i > 0) {
|
|
notCamelcase += `${joinString}${lowercase.charAt(i)}`;
|
|
}
|
|
else {
|
|
notCamelcase += chrString;
|
|
}
|
|
}
|
|
return notCamelcase;
|
|
}
|
|
export function looksLikeNumber(x) {
|
|
if (x === null || x === undefined)
|
|
return false;
|
|
// if loaded from config, may already be a number.
|
|
if (typeof x === 'number')
|
|
return true;
|
|
// hexadecimal.
|
|
if (/^0x[0-9a-f]+$/i.test(x))
|
|
return true;
|
|
// don't treat 0123 as a number; as it drops the leading '0'.
|
|
if (/^0[^.]/.test(x))
|
|
return false;
|
|
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
}
|