Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/windows/AutoOS.ClaudeAutostart.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Get-AutoOSClaudeDefaults {
foreach ($p in $block.PSObject.Properties) { $table[$p.Name] = $p.Value }
if ($table.Count -gt 0) { return $table }
}
} catch { }
} catch { $_ | Out-Null }
}
@{
enabled = $true; snapshot_interval_mins = 5; liveness_window_mins = 240
Expand Down Expand Up @@ -272,7 +272,7 @@ function Get-AutoOSClaudeState {
sessions = @($doc.sessions)
}
}
} catch { }
} catch { $_ | Out-Null }
}
[pscustomobject]@{ version = $script:StateVersion; captured_at = 0; captured_at_iso = $null; sessions = @() }
}
Expand Down
4 changes: 2 additions & 2 deletions lib/windows/AutoOS.Detect.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function Get-AutoOSWingetPackageProcess {
$process = [Diagnostics.Process]::Start($psi)
# Close stdin so a prompt that slipped past --disable-interactivity reads
# EOF and gives up, instead of sitting there until the timeout.
try { $process.StandardInput.Close() } catch { }
try { $process.StandardInput.Close() } catch { $_ | Out-Null }
$process
} catch { $null }
}
Expand All @@ -144,7 +144,7 @@ function Get-AutoOSWingetPackageResult {
$Process.Kill()
}
} catch { $packages = @() }
finally { try { $Process.Dispose() } catch { } }
finally { try { $Process.Dispose() } catch { $_ | Out-Null } }
$packages
}

Expand Down
4 changes: 2 additions & 2 deletions lib/windows/AutoOS.Serve.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function Get-AutoOSExampleBlock {
try {
$block = (Get-Content -LiteralPath $path -Raw -Encoding UTF8 | ConvertFrom-Json).$Name
if ($block) { return $block }
} catch { }
} catch { $_ | Out-Null }
@{}
}

Expand All @@ -286,7 +286,7 @@ function Get-AutoOSDetectedAnswers {
try {
$value = (& git config --global $pair.Setting 2>$null | Select-Object -First 1)
if ($value) { $answers[$pair.Key] = [string]$value }
} catch { }
} catch { $_ | Out-Null }
}
$answers
}
Expand Down
46 changes: 46 additions & 0 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,52 @@ fi
# ─── Documentation ──────────────────────────────────────────────────────────
describe "documentation"

if it "check-links.py broken_links identifies only bad relative links"; then
failures="$(python3 - 2>&1 <<'PY'
import os
import sys
import tempfile
import importlib.util

sys.argv = ["tests/check-links.py"]
spec = importlib.util.spec_from_file_location("check_links", "tests/check-links.py")
check_links = importlib.util.module_from_spec(spec)
spec.loader.exec_module(check_links)

with tempfile.TemporaryDirectory() as d:
os.makedirs(os.path.join(d, "subdir"))
with open(os.path.join(d, "test1.md"), "w", encoding="utf-8") as f:
f.write("[Valid link](test2.md)\n")
f.write("[Broken link](missing.md)\n")
f.write("[External link](https://example.com)\n")
f.write("[Mailto link](mailto:test@example.com)\n")
f.write("[Anchor link](#some-header)\n")
f.write("[Fragment link](test2.md#header)\n")
f.write("[Empty link]()\n")
with open(os.path.join(d, "test2.md"), "w", encoding="utf-8") as f:
f.write("[Dir link](subdir/test3.md)\n")
with open(os.path.join(d, "subdir", "test3.md"), "w", encoding="utf-8") as f:
f.write("[Up link](../test1.md)\n")
f.write("[Broken up link](../missing.md)\n")
f.write("[Broken dir link](missing/file.md)\n")
f.write("[Self link](test3.md)\n")

files = ["test1.md", "test2.md", "subdir/test3.md"]
problems = check_links.broken_links(d, files)

expected = [
"test1.md: [Broken link] -> missing.md",
"subdir/test3.md: [Broken up link] -> ../missing.md",
"subdir/test3.md: [Broken dir link] -> missing/file.md"
]

if problems != expected:
print(f"Expected {expected}, got {problems}")
PY
)"
assert_eq "$failures" ""
fi

if it "every relative link in the docs resolves"; then
out="$(python3 tests/check-links.py . 2>&1)"; rc=$?
if [[ $rc -eq 0 ]]; then pass; else fail "$out"; fi
Expand Down