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>
77 lines
2.3 KiB
JavaScript
77 lines
2.3 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getParse = getParse;
|
|
exports.update = update;
|
|
const domutils_1 = require("domutils");
|
|
const domhandler_1 = require("domhandler");
|
|
/**
|
|
* Get the parse function with options.
|
|
*
|
|
* @param parser - The parser function.
|
|
* @returns The parse function with options.
|
|
*/
|
|
function getParse(parser) {
|
|
/**
|
|
* Parse a HTML string or a node.
|
|
*
|
|
* @param content - The HTML string or node.
|
|
* @param options - The parser options.
|
|
* @param isDocument - If `content` is a document.
|
|
* @param context - The context node in the DOM tree.
|
|
* @returns The parsed document node.
|
|
*/
|
|
return function parse(content, options, isDocument, context) {
|
|
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(content)) {
|
|
content = content.toString();
|
|
}
|
|
if (typeof content === 'string') {
|
|
return parser(content, options, isDocument, context);
|
|
}
|
|
const doc = content;
|
|
if (!Array.isArray(doc) && (0, domhandler_1.isDocument)(doc)) {
|
|
// If `doc` is already a root, just return it
|
|
return doc;
|
|
}
|
|
// Add content to new root element
|
|
const root = new domhandler_1.Document([]);
|
|
// Update the DOM using the root
|
|
update(doc, root);
|
|
return root;
|
|
};
|
|
}
|
|
/**
|
|
* Update the dom structure, for one changed layer.
|
|
*
|
|
* @param newChilds - The new children.
|
|
* @param parent - The new parent.
|
|
* @returns The parent node.
|
|
*/
|
|
function update(newChilds, parent) {
|
|
// Normalize
|
|
const arr = Array.isArray(newChilds) ? newChilds : [newChilds];
|
|
// Update parent
|
|
if (parent) {
|
|
parent.children = arr;
|
|
}
|
|
else {
|
|
parent = null;
|
|
}
|
|
// Update neighbors
|
|
for (let i = 0; i < arr.length; i++) {
|
|
const node = arr[i];
|
|
// Cleanly remove existing nodes from their previous structures.
|
|
if (node.parent && node.parent.children !== arr) {
|
|
(0, domutils_1.removeElement)(node);
|
|
}
|
|
if (parent) {
|
|
node.prev = arr[i - 1] || null;
|
|
node.next = arr[i + 1] || null;
|
|
}
|
|
else {
|
|
node.prev = node.next = null;
|
|
}
|
|
node.parent = parent;
|
|
}
|
|
return parent;
|
|
}
|
|
//# sourceMappingURL=parse.js.map
|