From 5ac0a990c33c2d72c0f07afcb330cde593fdf284 Mon Sep 17 00:00:00 2001 From: Andre482 Date: Fri, 12 Jun 2026 15:06:33 +0300 Subject: [PATCH] Audit: remove personal deploy paths and clarify plugin purpose in README. Co-authored-by: Cursor --- .gitignore | 2 ++ README.md | 21 ++++++++++++++++++++- deploy.mjs | 30 +++++++++++++++++------------- deploy.ps1 | 25 ++++++++++++------------- 4 files changed, 51 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 193abb3..a28ac69 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ main.js main.js.map .DS_Store *.log +deploy.local.mjs +deploy.local.ps1 diff --git a/README.md b/README.md index 27a1372..03d7200 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # O-Tie -Build and edit **risk bowtie diagrams** in Obsidian with an interactive visual editor. O-Tie stores diagrams as `.bowtie` JSON files in your vault and auto-saves as you work. +Build and edit **risk bowtie diagrams** in Obsidian with an interactive visual editor. + +## What is O-Tie? + +O-Tie is an Obsidian plugin for **bowtie risk analysis** — a visual method used in process safety, operations, and HSE work to show how a hazard can lead to a top event (loss of control), which threats can cause it, which consequences may follow, and which barriers prevent or reduce harm. + +Instead of drawing bowties in a separate tool, you create and maintain them as `.bowtie` files inside your vault. O-Tie provides a dedicated editor with pan/zoom, barrier stacks, escalation factors, undo/redo, and PNG export. Changes auto-save as you edit. ## Features @@ -91,6 +97,19 @@ npm run dev # watch mode npm run build # production build ``` +To deploy a local build into a vault: + +```bash +# Unix / macOS / Git Bash +OBSIDIAN_PLUGIN_DIR="/path/to/vault/.obsidian/plugins/o-tie" npm run deploy +``` + +```powershell +# Windows PowerShell +$env:OBSIDIAN_VAULT_PATH = "C:\path\to\vault" +.\deploy.ps1 +``` + ## Third-party licenses This plugin bundles [html-to-image](https://github.com/bubkoo/html-to-image) (MIT) for PNG export. diff --git a/deploy.mjs b/deploy.mjs index 7663137..823accb 100644 --- a/deploy.mjs +++ b/deploy.mjs @@ -2,18 +2,22 @@ import { copyFileSync, existsSync, mkdirSync } from "fs"; import { join } from "path"; const files = ["main.js", "styles.css", "manifest.json"]; -const vaults = [ - "C:/Users/User/OneDrive/Obsidian/Andre482/.obsidian/plugins/o-tie", - "C:/Users/User/OneDrive/Obsidian/.obsidian/plugins/o-tie", - "C:/Users/User/OneDrive/Obsidian/Bowties/.obsidian/plugins/o-tie", -]; +const target = process.env.OBSIDIAN_PLUGIN_DIR; -for (const vault of vaults) { - if (!existsSync(vault)) { - mkdirSync(vault, { recursive: true }); - } - for (const file of files) { - copyFileSync(join(process.cwd(), file), join(vault, file)); - } - console.log(`Deployed to ${vault}`); +if (!target) { + console.error( + "Set OBSIDIAN_PLUGIN_DIR to your plugin folder, e.g.\n" + + ' OBSIDIAN_PLUGIN_DIR="C:/path/to/vault/.obsidian/plugins/o-tie" npm run deploy' + ); + process.exit(1); } + +if (!existsSync(target)) { + mkdirSync(target, { recursive: true }); +} + +for (const file of files) { + copyFileSync(join(process.cwd(), file), join(target, file)); +} + +console.log(`Deployed to ${target}`); diff --git a/deploy.ps1 b/deploy.ps1 index 13c4222..3f7aba6 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -1,6 +1,15 @@ -# Deploy O-Tie plugin to the active Obsidian vault -$vaultPath = "C:\Users\User\OneDrive\Obsidian" -$pluginDir = Join-Path $vaultPath ".obsidian\plugins\o-tie" +# Deploy O-Tie to a local Obsidian vault (developer use only). +# Set OBSIDIAN_VAULT_PATH to your vault root, or pass -VaultPath. +param( + [string]$VaultPath = $env:OBSIDIAN_VAULT_PATH +) + +if (-not $VaultPath) { + Write-Error "Set OBSIDIAN_VAULT_PATH or pass -VaultPath to your Obsidian vault root." + exit 1 +} + +$pluginDir = Join-Path $VaultPath ".obsidian\plugins\o-tie" $sourceDir = $PSScriptRoot Write-Host "Building plugin..." @@ -15,14 +24,4 @@ Copy-Item (Join-Path $sourceDir "main.js") -Destination $pluginDir -Force Copy-Item (Join-Path $sourceDir "manifest.json") -Destination $pluginDir -Force Copy-Item (Join-Path $sourceDir "styles.css") -Destination $pluginDir -Force -$communityPlugins = Join-Path $vaultPath ".obsidian\community-plugins.json" -$enabled = @("o-tie") -if (Test-Path $communityPlugins) { - $existing = Get-Content $communityPlugins -Raw | ConvertFrom-Json - foreach ($id in $existing) { - if ($id -ne "o-tie") { $enabled = @($id) + $enabled } - } -} -$enabled | ConvertTo-Json | Set-Content $communityPlugins -Encoding UTF8 - Write-Host "Done. Reload Obsidian (Ctrl+R) to activate O-Tie."