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>
127 lines
3.3 KiB
JavaScript
127 lines
3.3 KiB
JavaScript
let fs = require('fs');
|
|
let Task = require('./task').Task;
|
|
|
|
function isFileOrDirectory(t) {
|
|
return (t instanceof FileTask ||
|
|
t instanceof DirectoryTask);
|
|
}
|
|
|
|
function isFile(t) {
|
|
return (t instanceof FileTask && !(t instanceof DirectoryTask));
|
|
}
|
|
|
|
/**
|
|
@name jake
|
|
@namespace jake
|
|
*/
|
|
/**
|
|
@name jake.FileTask
|
|
@class`
|
|
@extentds Task
|
|
@description A Jake FileTask
|
|
|
|
@param {String} name The name of the Task
|
|
@param {Array} [prereqs] Prerequisites to be run before this task
|
|
@param {Function} [action] The action to perform to create this file
|
|
@param {Object} [opts]
|
|
@param {Array} [opts.asyc=false] Perform this task asynchronously.
|
|
If you flag a task with this option, you must call the global
|
|
`complete` method inside the task's action, for execution to proceed
|
|
to the next task.
|
|
*/
|
|
class FileTask extends Task {
|
|
constructor(...args) {
|
|
super(...args);
|
|
this.dummy = false;
|
|
if (fs.existsSync(this.name)) {
|
|
this.updateModTime();
|
|
}
|
|
else {
|
|
this.modTime = null;
|
|
}
|
|
}
|
|
|
|
isNeeded() {
|
|
let prereqs = this.prereqs;
|
|
let prereqName;
|
|
let prereqTask;
|
|
|
|
// No repeatsies
|
|
if (this.taskStatus == Task.runStatuses.DONE) {
|
|
return false;
|
|
}
|
|
// The always-make override
|
|
else if (jake.program.opts['always-make']) {
|
|
return true;
|
|
}
|
|
// Default case
|
|
else {
|
|
|
|
// We need either an existing file, or an action to create one.
|
|
// First try grabbing the actual mod-time of the file
|
|
try {
|
|
this.updateModTime();
|
|
}
|
|
// Then fall back to looking for an action
|
|
catch(e) {
|
|
if (typeof this.action == 'function') {
|
|
return true;
|
|
}
|
|
else {
|
|
throw new Error('File-task ' + this.fullName + ' has no ' +
|
|
'existing file, and no action to create one.');
|
|
}
|
|
}
|
|
|
|
// Compare mod-time of all the prereqs with its mod-time
|
|
// If any prereqs are newer, need to run the action to update
|
|
if (prereqs && prereqs.length) {
|
|
for (let i = 0, ii = prereqs.length; i < ii; i++) {
|
|
prereqName = prereqs[i];
|
|
prereqTask = this.namespace.resolveTask(prereqName) ||
|
|
jake.createPlaceholderFileTask(prereqName, this.namespace);
|
|
// Run the action if:
|
|
// 1. The prereq is a normal task (not file/dir)
|
|
// 2. The prereq is a file-task with a mod-date more recent than
|
|
// the one for this file/dir
|
|
if (prereqTask) {
|
|
if (!isFileOrDirectory(prereqTask) ||
|
|
(isFile(prereqTask) && prereqTask.modTime > this.modTime)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
this.taskStatus = Task.runStatuses.DONE;
|
|
return false;
|
|
}
|
|
// File/dir has no prereqs, and exists -- no need to run
|
|
else {
|
|
// Effectively done
|
|
this.taskStatus = Task.runStatuses.DONE;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
updateModTime() {
|
|
let stats = fs.statSync(this.name);
|
|
this.modTime = stats.mtime;
|
|
}
|
|
|
|
complete() {
|
|
if (!this.dummy) {
|
|
this.updateModTime();
|
|
}
|
|
// Hackity hack
|
|
Task.prototype.complete.apply(this, arguments);
|
|
}
|
|
|
|
}
|
|
|
|
exports.FileTask = FileTask;
|
|
|
|
// DirectoryTask is a subclass of FileTask, depends on it
|
|
// being defined
|
|
let DirectoryTask = require('./directory_task').DirectoryTask;
|
|
|