journal/scripts/WORKFLOWS.md

141 lines
3.1 KiB
Markdown

# Script Workflows
Practical command recipes for common tasks.
## 1) Start a Clean Dev Shell
```powershell
cd E:\stansshit\csharp\journal-master\journal
. .\scripts\dev-shell.ps1
```
Use this when you want the current shell configured with repo-local cache paths.
## 2) Build .NET Projects With Safe Defaults
```powershell
.\scripts\dotnet-min.ps1 build Journal.Sidecar/Journal.Sidecar.csproj
.\scripts\dotnet-min.ps1 build Journal.WebGateway/Journal.WebGateway.csproj
```
## 3) Build Frontend or Desktop App
Web build:
```powershell
.\scripts\publish-app.ps1 -Target web
```
Tauri raw exe (no installer):
```powershell
.\scripts\publish-app.ps1 -Target tauri -TauriBundles none
```
Tauri installer bundles:
```powershell
.\scripts\publish-app.ps1 -Target tauri -TauriBundles nsis
.\scripts\publish-app.ps1 -Target tauri -TauriBundles msi
```
## 4) Publish Sidecar
```powershell
.\scripts\publish-sidecar.ps1 -Configuration Release -Runtime win-x64
```
Expected output under `output/`.
## 5) Publish WebGateway Package
```powershell
.\scripts\publish-app.ps1 -Target web
.\scripts\publish-webgateway.ps1 -Configuration Release -Runtime win-x64
```
If you only want gateway binary refresh:
```powershell
.\scripts\publish-webgateway.ps1 -SkipWebAssets
```
## 6) Run WebGateway Against Explicit Root
When multiple clones exist, always pin project root:
```powershell
.\scripts\run-webgateway.ps1 -ProjectRoot E:\stansshit\csharp\journal-master\journal -Urls http://0.0.0.0:5180
```
Quick health check:
```powershell
Invoke-RestMethod http://127.0.0.1:5180/api/health
```
Inspect active backend config:
```powershell
$body = @{ action = 'config.get' } | ConvertTo-Json
Invoke-RestMethod -Uri http://127.0.0.1:5180/api/command -Method Post -ContentType 'application/json' -Body $body
```
## 7) Python Package Installs in Repo-Local Target
```powershell
.\scripts\pip-min.ps1 install requests
```
Packages go to `.pydeps\py314` unless you pass your own `--target`/`--prefix`.
## 8) Migration Gate (When Full Test Assets Exist)
```powershell
.\scripts\migration-gate.ps1
```
Partial run:
```powershell
.\scripts\migration-gate.ps1 -SkipSmoke -SkipApi
```
If `tests/` is absent, Python parity and API contract steps are skipped with a clear message.
## 9) NuGet Cache Export/Import (Offline-ish Restore)
Export:
```powershell
.\scripts\nuget-export-cache.ps1 -OutputZip .\nuget-cache-export.zip
```
Import:
```powershell
.\scripts\nuget-import-cache.ps1 -InputZip .\nuget-cache-export.zip
```
Validates restore for `Journal.Sidecar`, `Journal.WebGateway`, and `Journal.SmokeTests`.
## 10) Quick Troubleshooting
Script blocked by execution policy:
```powershell
pwsh -NoProfile -ExecutionPolicy Bypass -File .\scripts\publish-app.ps1 -Target web
```
Unexpected data/vault mismatch in WebGateway:
1. Run with explicit `-ProjectRoot`.
2. Verify with `config.get` via `/api/command`.
3. Verify sidecar root via `/api/sidecar/root`.
NuGet restore flakiness:
1. Use `dotnet-min.ps1` wrappers.
2. Confirm proxy vars are cleared (`HTTP_PROXY`, `HTTPS_PROXY`, etc.).
3. Ensure `.nuget` directories are writable.