tftsr-devops_investigation/node_modules/ts-interface-checker/dist/util.js
Shaun Arman 8839075805 feat: initial implementation of TFTSR IT Triage & RCA application
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>
2026-03-14 22:36:25 -05:00

131 lines
4.9 KiB
JavaScript

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.DetailContext = exports.NoopContext = exports.VError = void 0;
/**
* Error thrown by validation. Besides an informative message, it includes the path to the
* property which triggered the failure.
*/
var VError = /** @class */ (function (_super) {
__extends(VError, _super);
function VError(path, message) {
var _this = _super.call(this, message) || this;
_this.path = path;
// See https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work for info about this workaround.
Object.setPrototypeOf(_this, VError.prototype);
return _this;
}
return VError;
}(Error));
exports.VError = VError;
/**
* Fast implementation of IContext used for first-pass validation. If that fails, we can validate
* using DetailContext to collect error messages. That's faster for the common case when messages
* normally pass validation.
*/
var NoopContext = /** @class */ (function () {
function NoopContext() {
}
NoopContext.prototype.fail = function (relPath, message, score) {
return false;
};
NoopContext.prototype.unionResolver = function () { return this; };
NoopContext.prototype.createContext = function () { return this; };
NoopContext.prototype.resolveUnion = function (ur) { };
return NoopContext;
}());
exports.NoopContext = NoopContext;
/**
* Complete implementation of IContext that collects meaningfull errors.
*/
var DetailContext = /** @class */ (function () {
function DetailContext() {
// Stack of property names and associated messages for reporting helpful error messages.
this._propNames = [""];
this._messages = [null];
// Score is used to choose the best union member whose DetailContext to use for reporting.
// Higher score means better match (or rather less severe mismatch).
this._score = 0;
}
DetailContext.prototype.fail = function (relPath, message, score) {
this._propNames.push(relPath);
this._messages.push(message);
this._score += score;
return false;
};
DetailContext.prototype.unionResolver = function () {
return new DetailUnionResolver();
};
DetailContext.prototype.resolveUnion = function (unionResolver) {
var _a, _b;
var u = unionResolver;
var best = null;
for (var _i = 0, _c = u.contexts; _i < _c.length; _i++) {
var ctx = _c[_i];
if (!best || ctx._score >= best._score) {
best = ctx;
}
}
if (best && best._score > 0) {
(_a = this._propNames).push.apply(_a, best._propNames);
(_b = this._messages).push.apply(_b, best._messages);
}
};
DetailContext.prototype.getError = function (path) {
var msgParts = [];
for (var i = this._propNames.length - 1; i >= 0; i--) {
var p = this._propNames[i];
path += (typeof p === "number") ? "[" + p + "]" : (p ? "." + p : "");
var m = this._messages[i];
if (m) {
msgParts.push(path + " " + m);
}
}
return new VError(path, msgParts.join("; "));
};
DetailContext.prototype.getErrorDetail = function (path) {
var details = [];
for (var i = this._propNames.length - 1; i >= 0; i--) {
var p = this._propNames[i];
path += (typeof p === "number") ? "[" + p + "]" : (p ? "." + p : "");
var message = this._messages[i];
if (message) {
details.push({ path: path, message: message });
}
}
var detail = null;
for (var i = details.length - 1; i >= 0; i--) {
if (detail) {
details[i].nested = [detail];
}
detail = details[i];
}
return detail;
};
return DetailContext;
}());
exports.DetailContext = DetailContext;
var DetailUnionResolver = /** @class */ (function () {
function DetailUnionResolver() {
this.contexts = [];
}
DetailUnionResolver.prototype.createContext = function () {
var ctx = new DetailContext();
this.contexts.push(ctx);
return ctx;
};
return DetailUnionResolver;
}());