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>
70 lines
1.6 KiB
Markdown
70 lines
1.6 KiB
Markdown
# find-root
|
|
recursively find the closest package.json
|
|
|
|
[](https://travis-ci.org/js-n/find-root)
|
|
|
|
## usage
|
|
Say you want to check if the directory name of a project matches its
|
|
module name in package.json:
|
|
|
|
```js
|
|
const path = require('path')
|
|
const findRoot = require('find-root')
|
|
|
|
// from a starting directory, recursively search for the nearest
|
|
// directory containing package.json
|
|
const root = findRoot('/Users/jsdnxx/Code/find-root/tests')
|
|
// => '/Users/jsdnxx/Code/find-root'
|
|
|
|
const dirname = path.basename(root)
|
|
console.log('is it the same?')
|
|
console.log(dirname === require(path.join(root, 'package.json')).name)
|
|
```
|
|
|
|
You can also pass in a custom check function (by default, it checks for the
|
|
existence of `package.json` in a directory). In this example, we traverse up
|
|
to find the root of a git repo:
|
|
```js
|
|
const fs = require('fs')
|
|
|
|
const gitRoot = findRoot('/Users/jsdnxx/Code/find-root/tests', function (dir) {
|
|
return fs.existsSync(path.resolve(dir, '.git'))
|
|
})
|
|
```
|
|
|
|
|
|
## api
|
|
|
|
### `findRoot: (startingPath : string, check?: (dir: string) => boolean) => string`
|
|
|
|
Returns the path for the nearest directory to `startingPath` containing
|
|
a `package.json` file, eg `/foo/module`.
|
|
|
|
If `check` is provided, returns the path for the closest parent directory
|
|
where `check` returns true.
|
|
|
|
Throws an error if no `package.json` is found at any level in the
|
|
`startingPath`.
|
|
|
|
|
|
## installation
|
|
```sh
|
|
> npm install find-root
|
|
```
|
|
|
|
## running the tests
|
|
|
|
From package root:
|
|
```sh
|
|
> npm install
|
|
> npm test
|
|
```
|
|
|
|
## contributors
|
|
|
|
- jsdnxx
|
|
|
|
|
|
## license
|
|
MIT. (c) 2017 jsdnxx
|