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>
116 lines
3.3 KiB
JavaScript
116 lines
3.3 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* TFTSR CLI - Command-line interface for TFTSR IT Triage & RCA
|
|
*
|
|
* Note: The CLI provides basic operations. For full functionality,
|
|
* use the TFTSR desktop GUI application.
|
|
*/
|
|
|
|
const args = process.argv.slice(2);
|
|
const command = args[0];
|
|
|
|
function printHelp() {
|
|
console.log(`
|
|
TFTSR CLI v0.1.0 — IT Triage & RCA Tool
|
|
|
|
Usage: tftsr <command> [options]
|
|
|
|
Commands:
|
|
analyze <log-file> Analyze a log file for issues
|
|
--domain, -d <domain> IT domain (linux, windows, network, k8s, db, virt, hw, obs)
|
|
--provider, -p <name> AI provider to use
|
|
|
|
export <issue-id> <format> Export an issue document
|
|
format: md, pdf, docx
|
|
|
|
config set <key> <value> Set a configuration value
|
|
config get <key> Get a configuration value
|
|
config list List all configuration
|
|
|
|
version Show version information
|
|
help Show this help message
|
|
|
|
Examples:
|
|
tftsr analyze /var/log/syslog --domain linux
|
|
tftsr export abc-123 pdf
|
|
tftsr config set active_provider ollama
|
|
|
|
Note: For full AI-powered triage, launch the TFTSR desktop application.
|
|
`);
|
|
}
|
|
|
|
function printVersion() {
|
|
console.log("TFTSR CLI v0.1.0");
|
|
console.log("Part of the TFTSR IT Triage & RCA Desktop Application");
|
|
}
|
|
|
|
switch (command) {
|
|
case "analyze": {
|
|
const logFile = args[1];
|
|
if (!logFile) {
|
|
console.error("Error: log file path required");
|
|
console.error("Usage: tftsr analyze <log-file>");
|
|
process.exit(1);
|
|
}
|
|
const domainIdx = args.findIndex((a) => a === "--domain" || a === "-d");
|
|
const domain = domainIdx >= 0 ? args[domainIdx + 1] : "linux";
|
|
console.log(`Analyzing: ${logFile}`);
|
|
console.log(`Domain: ${domain}`);
|
|
console.log("\nFor AI-powered analysis, launch the TFTSR desktop application.");
|
|
console.log("The GUI provides: PII detection, 5-whys triage, RCA generation.");
|
|
break;
|
|
}
|
|
|
|
case "export": {
|
|
const issueId = args[1];
|
|
const format = args[2];
|
|
if (!issueId || !format) {
|
|
console.error("Usage: tftsr export <issue-id> <format>");
|
|
process.exit(1);
|
|
}
|
|
if (!["md", "pdf", "docx"].includes(format)) {
|
|
console.error("Error: format must be one of: md, pdf, docx");
|
|
process.exit(1);
|
|
}
|
|
console.log(`Export issue ${issueId} as ${format.toUpperCase()}`);
|
|
console.log("Launch the TFTSR app to access the export functionality.");
|
|
break;
|
|
}
|
|
|
|
case "config": {
|
|
const subcommand = args[1];
|
|
switch (subcommand) {
|
|
case "set":
|
|
console.log(`Configuration: ${args[2]} = ${args[3]}`);
|
|
console.log("Note: Configuration is managed by the TFTSR desktop application.");
|
|
break;
|
|
case "get":
|
|
console.log(`Getting config key: ${args[2]}`);
|
|
break;
|
|
case "list":
|
|
console.log("Configuration is stored in the TFTSR app data directory.");
|
|
console.log("Launch the app and go to Settings to view/edit configuration.");
|
|
break;
|
|
default:
|
|
console.error(`Unknown config subcommand: ${subcommand}`);
|
|
}
|
|
break;
|
|
}
|
|
|
|
case "version":
|
|
printVersion();
|
|
break;
|
|
|
|
case "help":
|
|
case "--help":
|
|
case "-h":
|
|
case undefined:
|
|
printHelp();
|
|
break;
|
|
|
|
default:
|
|
console.error(`Unknown command: ${command}`);
|
|
printHelp();
|
|
process.exit(1);
|
|
}
|