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>
283 lines
7.4 KiB
TypeScript
283 lines
7.4 KiB
TypeScript
import EventEmitter, { EventMap } from 'bare-events'
|
|
import Buffer, { BufferEncoding } from 'bare-buffer'
|
|
import {
|
|
constants,
|
|
AppendFileOptions,
|
|
CpOptions,
|
|
Dir,
|
|
MkdirOptions,
|
|
OpendirOptions,
|
|
Path,
|
|
ReadFileOptions,
|
|
ReadStream,
|
|
ReadStreamOptions,
|
|
ReaddirOptions,
|
|
ReadlinkOptions,
|
|
RealpathOptions,
|
|
RmOptions,
|
|
Stats,
|
|
Watcher,
|
|
WatcherOptions,
|
|
WriteFileOptions,
|
|
WriteStream,
|
|
WriteStreamOptions
|
|
} from '.'
|
|
|
|
export { constants }
|
|
|
|
interface FileHandleEvents extends EventMap {
|
|
close: []
|
|
}
|
|
|
|
interface FileHandle extends EventEmitter<FileHandleEvents>, AsyncDisposable {
|
|
close(): Promise<void>
|
|
|
|
read(
|
|
buffer: Buffer | ArrayBufferView,
|
|
offset?: number,
|
|
len?: number,
|
|
pos?: number
|
|
): Promise<number>
|
|
|
|
readv(buffers: ArrayBufferView[], position?: number): Promise<number>
|
|
|
|
write(
|
|
data: Buffer | ArrayBufferView,
|
|
offset?: number,
|
|
len?: number,
|
|
pos?: number
|
|
): Promise<number>
|
|
|
|
write(data: string, pos?: number, encoding?: BufferEncoding): Promise<number>
|
|
|
|
stat(): Promise<Stats>
|
|
|
|
chmod(mode: string | number): Promise<void>
|
|
|
|
createReadStream(opts?: ReadStreamOptions): ReadStream
|
|
|
|
createWriteStream(opts?: WriteStreamOptions): WriteStream
|
|
}
|
|
|
|
declare class FileHandle {
|
|
private constructor(fd: number)
|
|
}
|
|
|
|
export function open(
|
|
filepath: Path,
|
|
flags?: Flag | number,
|
|
mode?: string | number
|
|
): Promise<FileHandle>
|
|
|
|
export function access(filepath: Path, mode?: number): Promise<void>
|
|
|
|
export function appendFile(
|
|
filepath: Path,
|
|
data: string | Buffer | ArrayBufferView,
|
|
opts?: AppendFileOptions
|
|
): Promise<void>
|
|
|
|
export function appendFile(
|
|
filepath: Path,
|
|
data: string | Buffer | ArrayBufferView,
|
|
encoding: BufferEncoding
|
|
): Promise<void>
|
|
|
|
export function chmod(filepath: Path, mode: string | number): Promise<void>
|
|
|
|
export function copyFile(src: Path, dst: Path, mode?: number): Promise<void>
|
|
|
|
export function cp(src: Path, dst: Path, opts?: CpOptions): Promise<void>
|
|
|
|
export function lstat(filepath: Path): Promise<Stats>
|
|
|
|
export function mkdir(filepath: Path, opts?: MkdirOptions): Promise<void>
|
|
|
|
export function mkdir(filepath: Path, mode: number): Promise<void>
|
|
|
|
export function opendir(
|
|
filepath: Path,
|
|
opts: OpendirOptions & { encoding?: BufferEncoding }
|
|
): Promise<Dir<string>>
|
|
|
|
export function opendir(
|
|
filepath: Path,
|
|
opts: OpendirOptions & { encoding: 'buffer' }
|
|
): Promise<Dir<Buffer>>
|
|
|
|
export function opendir(filepath: Path, opts: OpendirOptions): Promise<Dir>
|
|
|
|
export function opendir(filepath: Path, encoding: BufferEncoding): Promise<Dir<string>>
|
|
|
|
export function opendir(filepath: Path, encoding: 'buffer'): Promise<Dir<Buffer>>
|
|
|
|
export function opendir(filepath: Path, encoding: BufferEncoding | 'buffer'): Promise<Dir>
|
|
|
|
export function opendir(filepath: Path): Promise<Dir<string>>
|
|
|
|
export function readFile(
|
|
filepath: Path,
|
|
opts: ReadFileOptions & { encoding: BufferEncoding }
|
|
): Promise<string>
|
|
|
|
export function readFile(
|
|
filepath: Path,
|
|
opts: ReadFileOptions & { encoding?: 'buffer' }
|
|
): Promise<Buffer>
|
|
|
|
export function readFile(filepath: Path, opts: ReadFileOptions): Promise<string | Buffer>
|
|
|
|
export function readFile(filepath: Path, encoding: BufferEncoding): Promise<string>
|
|
|
|
export function readFile(filepath: Path, encoding: 'buffer'): Promise<Buffer>
|
|
|
|
export function readFile(
|
|
filepath: Path,
|
|
encoding?: BufferEncoding | 'buffer'
|
|
): Promise<string | Buffer>
|
|
|
|
export function readFile(filepath: Path): Promise<Buffer>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { encoding?: BufferEncoding }
|
|
): Promise<Dir<string>[] | string[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes: true }
|
|
): Promise<Dir<string>[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { encoding?: BufferEncoding; withFileTypes?: false }
|
|
): Promise<string[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { encoding: 'buffer' }
|
|
): Promise<Dir<Buffer>[] | Buffer[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes: true }
|
|
): Promise<Dir<Buffer>[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { encoding: 'buffer'; withFileTypes?: false }
|
|
): Promise<Buffer[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { withFileTypes: true }
|
|
): Promise<Dir<string | Buffer>[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
opts: ReaddirOptions & { withFileTypes?: false }
|
|
): Promise<string[] | Buffer[]>
|
|
|
|
export function readdir(filepath: Path, opts: ReaddirOptions): Promise<Dir[] | string[] | Buffer[]>
|
|
|
|
export function readdir(filepath: Path, encoding: BufferEncoding): Promise<string[]>
|
|
|
|
export function readdir(filepath: Path, encoding: 'buffer'): Promise<Buffer[]>
|
|
|
|
export function readdir(
|
|
filepath: Path,
|
|
encoding: BufferEncoding | 'buffer'
|
|
): Promise<string[] | Buffer[]>
|
|
|
|
export function readdir(filepath: Path): Promise<string[]>
|
|
|
|
export function readlink(
|
|
filepath: Path,
|
|
opts: ReadlinkOptions & { encoding?: BufferEncoding }
|
|
): Promise<string>
|
|
|
|
export function readlink(
|
|
filepath: Path,
|
|
opts: ReadlinkOptions & { encoding: 'buffer' }
|
|
): Promise<Buffer>
|
|
|
|
export function readlink(filepath: Path, opts: ReadlinkOptions): Promise<string | Buffer>
|
|
|
|
export function readlink(filepath: Path, encoding: BufferEncoding): Promise<string>
|
|
|
|
export function readlink(filepath: Path, encoding: 'buffer'): Promise<Buffer>
|
|
|
|
export function readlink(
|
|
filepath: Path,
|
|
encoding: BufferEncoding | 'buffer'
|
|
): Promise<string | Buffer>
|
|
|
|
export function readlink(filepath: Path): Promise<string>
|
|
|
|
export function realpath(
|
|
filepath: Path,
|
|
opts: RealpathOptions & { encoding?: BufferEncoding }
|
|
): Promise<string>
|
|
|
|
export function realpath(
|
|
filepath: Path,
|
|
opts: RealpathOptions & { encoding: 'buffer' }
|
|
): Promise<Buffer>
|
|
|
|
export function realpath(filepath: Path, opts: RealpathOptions): Promise<string | Buffer>
|
|
|
|
export function realpath(filepath: Path, encoding: BufferEncoding): Promise<string>
|
|
|
|
export function realpath(filepath: Path, encoding: 'buffer'): Promise<Buffer>
|
|
|
|
export function realpath(
|
|
filepath: Path,
|
|
encoding: BufferEncoding | 'buffer'
|
|
): Promise<string | Buffer>
|
|
|
|
export function realpath(filepath: Path): Promise<string>
|
|
|
|
export function rename(src: Path, dst: Path): Promise<void>
|
|
|
|
export function rm(filepath: Path, opts?: RmOptions): Promise<void>
|
|
|
|
export function rmdir(filepath: Path): Promise<void>
|
|
|
|
export function stat(filepath: Path): Promise<Stats>
|
|
|
|
export function symlink(target: Path, filepath: Path, type?: string | number): Promise<void>
|
|
|
|
export function unlink(filepath: Path): Promise<void>
|
|
|
|
export function watch(
|
|
filepath: Path,
|
|
opts: WatcherOptions & { encoding?: BufferEncoding }
|
|
): Watcher<string>
|
|
|
|
export function watch(
|
|
filepath: Path,
|
|
opts: WatcherOptions & { encoding: 'buffer' }
|
|
): Watcher<Buffer>
|
|
|
|
export function watch(filepath: Path, opts: WatcherOptions): Watcher
|
|
|
|
export function watch(filepath: Path, encoding: BufferEncoding): Watcher<string>
|
|
|
|
export function watch(filepath: Path, encoding: 'buffer'): Watcher<Buffer>
|
|
|
|
export function watch(filepath: Path, encoding: BufferEncoding | 'buffer'): Watcher
|
|
|
|
export function watch(filepath: Path): Watcher<string>
|
|
|
|
export function writeFile(
|
|
filepath: Path,
|
|
data: string | Buffer | ArrayBufferView,
|
|
opts?: WriteFileOptions
|
|
): Promise<void>
|
|
|
|
export function writeFile(
|
|
filepath: Path,
|
|
data: string | Buffer | ArrayBufferView,
|
|
encoding: BufferEncoding
|
|
): Promise<void>
|