@sebastienrousseau/dotfiles 0.2.520 โ 0.2.522
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/LICENSE-APACHE +190 -0
- package/LICENSE-MIT +21 -0
- package/README.md +43 -37
- package/install.sh +76 -10
- package/package.json +7 -7
- package/tools/README.md +49 -0
- package/tools/ci/install-chezmoi-verified.sh +68 -0
- package/docs/.vitepress/reports/localization-readability-audit.md +0 -73
- package/docs/AI.md +0 -179
- package/docs/ARCHITECTURE.md +0 -117
- package/docs/CNAME +0 -1
- package/docs/CONFIG_STRATEGY.md +0 -124
- package/docs/COPYRIGHT +0 -7
- package/docs/ECOSYSTEM.md +0 -220
- package/docs/GOLD-STANDARD-AUDIT.md +0 -352
- package/docs/GOVERNANCE.md +0 -98
- package/docs/MAINTAINERS.md +0 -41
- package/docs/MINIMUM-TOOLCHAIN.md +0 -100
- package/docs/NAMING_CONVENTIONS.md +0 -102
- package/docs/OPENCODE.md +0 -127
- package/docs/README.md +0 -84
- package/docs/STRUCTURE.md +0 -102
- package/docs/adr/ADR-001-ci-cd-pipeline.md +0 -118
- package/docs/adr/ADR-002-shell-performance.md +0 -130
- package/docs/adr/ADR-003-security-first.md +0 -158
- package/docs/adr/ADR-004-cli-architecture.md +0 -171
- package/docs/adr/ADR-005-chezmoi-choice.md +0 -99
- package/docs/adr/ADR-006-shell-selection.md +0 -124
- package/docs/adr/ADR-007-multi-shell-parity.md +0 -62
- package/docs/adr/ADR-008-alias-system-architecture.md +0 -95
- package/docs/adr/ADR-009-wallpaper-driven-theming.md +0 -131
- package/docs/adr/ADR-010-starship-transient-prompt.md +0 -144
- package/docs/adr/ADR-011-nushell-tier3-keep.md +0 -144
- package/docs/adr/ADR-012-ai-fleet-local-proxy.md +0 -79
- package/docs/adr/README.md +0 -40
- package/docs/architecture/AI_COST_OPTIMIZATION.md +0 -144
- package/docs/architecture/ARCHITECTURE.md +0 -20
- package/docs/architecture/INTEROP.md +0 -44
- package/docs/architecture/REPO_LAYOUT.md +0 -241
- package/docs/architecture/WALKTHROUGH.md +0 -86
- package/docs/architecture/fleet-deployment.md +0 -77
- package/docs/archive/EUXIS_2026_REVIEW.md +0 -127
- package/docs/archive/LEGACY_ROADMAP.md +0 -6
- package/docs/archive/MILESTONE_v0.2.493.md +0 -47
- package/docs/archive/PLAN.md +0 -199
- package/docs/archive/REPO_AUDIT.md +0 -31
- package/docs/articles/.pages +0 -6
- package/docs/articles/2026-07-05-custom-mkdocs-material-dark-theme.md +0 -216
- package/docs/articles/2026-07-05-fish-startup-abbr.md +0 -153
- package/docs/articles/2026-07-05-master-to-main-rename-runbook.md +0 -128
- package/docs/articles/index.md +0 -36
- package/docs/guides/INSTALL.md +0 -144
- package/docs/guides/MACOS_ICLOUD_SYMLINKS.md +0 -121
- package/docs/guides/NEOVIM_IDE_GUIDE.md +0 -61
- package/docs/guides/THEMING.md +0 -230
- package/docs/guides/TROUBLESHOOTING.md +0 -176
- package/docs/guides/WSL2_NIX_TROUBLESHOOTING.md +0 -792
- package/docs/index.md +0 -132
- package/docs/interop/A2A.md +0 -39
- package/docs/interop/POWERSHELL.md +0 -102
- package/docs/manual/00-introduction.md +0 -89
- package/docs/manual/01-concepts/01-architecture.md +0 -138
- package/docs/manual/01-concepts/02-trust-model.md +0 -183
- package/docs/manual/01-concepts/03-theme-engine.md +0 -186
- package/docs/manual/01-concepts/04-fleet.md +0 -148
- package/docs/manual/01-concepts/05-self-healing.md +0 -204
- package/docs/manual/02-tutorials/01-first-install.md +0 -197
- package/docs/manual/02-tutorials/02-add-wallpaper.md +0 -216
- package/docs/manual/02-tutorials/03-create-profile.md +0 -244
- package/docs/manual/02-tutorials/04-encrypt-secret.md +0 -281
- package/docs/manual/02-tutorials/05-deploy-fleet.md +0 -283
- package/docs/manual/03-reference/01-dot-cli.md +0 -475
- package/docs/manual/03-reference/02-config-files.md +0 -265
- package/docs/manual/03-reference/03-environment.md +0 -124
- package/docs/manual/03-reference/04-templates.md +0 -190
- package/docs/manual/03-reference/05-feature-flags.md +0 -187
- package/docs/manual/04-cookbook/01-recipes.md +0 -285
- package/docs/manual/04-cookbook/02-troubleshooting.md +0 -351
- package/docs/manual/04-cookbook/03-faq.md +0 -175
- package/docs/manual/05-appendices/A-platform-matrix.md +0 -101
- package/docs/manual/05-appendices/B-security-checklist.md +0 -85
- package/docs/manual/05-appendices/C-glossary.md +0 -40
- package/docs/manual/05-appendices/D-bibliography.md +0 -58
- package/docs/manual/05-appendices/E-license.md +0 -38
- package/docs/manual/_toc.yml +0 -58
- package/docs/manual/command-index.md +0 -175
- package/docs/manual/concept-index.md +0 -170
- package/docs/manual/index.md +0 -66
- package/docs/migration/README.md +0 -81
- package/docs/migration/from-bare-git-repo.md +0 -156
- package/docs/migration/from-gnu-stow.md +0 -165
- package/docs/migration/from-plain-chezmoi.md +0 -148
- package/docs/migration/from-yadm.md +0 -187
- package/docs/operations/ARCHITECTURE_ROADMAP.md +0 -7
- package/docs/operations/ATTESTATION.md +0 -44
- package/docs/operations/CI_CADENCE.md +0 -107
- package/docs/operations/CI_COMPOSITES.md +0 -156
- package/docs/operations/COMPLETIONS.md +0 -123
- package/docs/operations/COVERAGE.md +0 -204
- package/docs/operations/DRIFT.md +0 -107
- package/docs/operations/HARD_AUDIT_2026.md +0 -631
- package/docs/operations/MAINTENANCE.md +0 -63
- package/docs/operations/MANIFEST.md +0 -127
- package/docs/operations/MIGRATION.md +0 -109
- package/docs/operations/OPERATIONS.md +0 -188
- package/docs/operations/PERFORMANCE.md +0 -133
- package/docs/operations/PERFORMANCE_BUDGETS.md +0 -196
- package/docs/operations/REGISTRY.md +0 -90
- package/docs/operations/RELEASE_PIPELINE.md +0 -128
- package/docs/operations/RELIABILITY.md +0 -122
- package/docs/operations/RFC_v0_2_503_reorganization.md +0 -280
- package/docs/operations/ROADMAP.md +0 -10
- package/docs/operations/ROADMAP_2026.md +0 -7
- package/docs/operations/ROADMAP_V0_2_503.md +0 -10
- package/docs/operations/TESTING.md +0 -216
- package/docs/operations/TRACEABILITY.md +0 -44
- package/docs/operations/TRUSTED_AGENT_WORKSTATION.md +0 -65
- package/docs/operations/VERSION_SYNC.md +0 -393
- package/docs/packaging.md +0 -222
- package/docs/reference/ALIASES.md +0 -131
- package/docs/reference/ALIASES_CHEATSHEET.md +0 -32
- package/docs/reference/ALIASES_DEPRECATIONS.md +0 -13
- package/docs/reference/FEATURE-MATRIX.md +0 -646
- package/docs/reference/FEATURES.md +0 -66
- package/docs/reference/FONTS.md +0 -112
- package/docs/reference/POWERSHELL_PARITY.md +0 -82
- package/docs/reference/PROFILES.md +0 -69
- package/docs/reference/SCREENSHOTS.md +0 -121
- package/docs/reference/SCRIPTS.md +0 -71
- package/docs/reference/SUPPORT_MATRIX.md +0 -80
- package/docs/reference/THEMES.md +0 -117
- package/docs/reference/TOOLS.md +0 -110
- package/docs/reference/UTILS.md +0 -243
- package/docs/registry.json +0 -6
- package/docs/schema/dot-env-v1.json +0 -110
- package/docs/schema/dot-registry-v1.json +0 -33
- package/docs/security/AI_ACT_COMPLIANCE.md +0 -94
- package/docs/security/AUDIT_BYPASS.md +0 -103
- package/docs/security/AUTOMATION_SECRETS.md +0 -26
- package/docs/security/CI_EGRESS_ALLOWLIST.md +0 -127
- package/docs/security/CI_PINNING.md +0 -129
- package/docs/security/COMMIT_SIGNING.md +0 -138
- package/docs/security/COMPLIANCE.md +0 -458
- package/docs/security/DEPS_DEV_EXCEPTIONS.md +0 -86
- package/docs/security/DISCLOSURE.md +0 -130
- package/docs/security/ENCRYPTION.md +0 -57
- package/docs/security/FMEA.md +0 -159
- package/docs/security/FUZZING.md +0 -209
- package/docs/security/HISTORY_FILTERING.md +0 -132
- package/docs/security/INCIDENT_RESPONSE.md +0 -579
- package/docs/security/INSTALL_VERIFICATION.md +0 -122
- package/docs/security/KEYS.md +0 -49
- package/docs/security/KEY_ROTATION.md +0 -303
- package/docs/security/MCP_POLICY.md +0 -78
- package/docs/security/POLICY_RELEASES.md +0 -37
- package/docs/security/README.md +0 -28
- package/docs/security/SCORECARD.md +0 -195
- package/docs/security/SECRETS.md +0 -158
- package/docs/security/SECURITY.md +0 -45
- package/docs/security/SECURITY_CHECKLIST.md +0 -55
- package/docs/security/SHELL_EXEMPTIONS.md +0 -145
- package/docs/security/SOUP_REGISTER.md +0 -36
- package/docs/security/THREAT_MODEL.md +0 -130
- package/docs/security/VERIFICATION_VALIDATION.md +0 -228
- package/docs/security/VERIFY_RELEASE.md +0 -201
- package/docs/security/security-pubkey.asc +0 -15
- package/docs/stylesheets/extra.css +0 -444
- package/docs/themes/README.md +0 -10
- package/docs/themes/VISUAL_INTEGRITY_REPORT.md +0 -30
- package/docs/themes/hero-shot.svg +0 -78
- package/scripts/README.md +0 -123
- package/scripts/ci/check-copyright-headers.sh +0 -8
- package/scripts/ci/check-shell-preamble.sh +0 -8
- package/scripts/ci/guard-gitleaks-checkout.sh +0 -8
- package/scripts/demo/record.sh +0 -43
- package/scripts/diagnostics/a2a-conformance.sh +0 -163
- package/scripts/diagnostics/alias-governance.sh +0 -165
- package/scripts/diagnostics/aliases-cheatsheet.sh +0 -74
- package/scripts/diagnostics/aliases-manifest.sh +0 -77
- package/scripts/diagnostics/attest-verify.sh +0 -147
- package/scripts/diagnostics/benchmark.sh +0 -408
- package/scripts/diagnostics/conflicts.sh +0 -73
- package/scripts/diagnostics/doctor-unified.sh +0 -43
- package/scripts/diagnostics/doctor.sh +0 -797
- package/scripts/diagnostics/drift-dashboard.sh +0 -203
- package/scripts/diagnostics/health.sh +0 -656
- package/scripts/diagnostics/history-analysis.sh +0 -86
- package/scripts/diagnostics/mcp-doctor.sh +0 -582
- package/scripts/diagnostics/perf.sh +0 -453
- package/scripts/diagnostics/scorecard.sh +0 -120
- package/scripts/diagnostics/secret-governance.sh +0 -65
- package/scripts/diagnostics/security-score.sh +0 -467
- package/scripts/diagnostics/smoke-test.sh +0 -88
- package/scripts/diagnostics/snapshot.sh +0 -90
- package/scripts/diagnostics/verify.sh +0 -108
- package/scripts/diagnostics/verify_state.sh +0 -73
- package/scripts/diagnostics/version-locks.sh +0 -94
- package/scripts/diagnostics/workstation-attestation.sh +0 -212
- package/scripts/dot/commands/agent.sh +0 -535
- package/scripts/dot/commands/agents.sh +0 -352
- package/scripts/dot/commands/ai.sh +0 -600
- package/scripts/dot/commands/aliases.sh +0 -277
- package/scripts/dot/commands/appearance.sh +0 -110
- package/scripts/dot/commands/completion.sh +0 -171
- package/scripts/dot/commands/core.sh +0 -217
- package/scripts/dot/commands/diagnostics.sh +0 -265
- package/scripts/dot/commands/env-emit.sh +0 -203
- package/scripts/dot/commands/fleet.sh +0 -711
- package/scripts/dot/commands/init.sh +0 -185
- package/scripts/dot/commands/lint.sh +0 -208
- package/scripts/dot/commands/manual.sh +0 -169
- package/scripts/dot/commands/meta.sh +0 -438
- package/scripts/dot/commands/patterns.sh +0 -55
- package/scripts/dot/commands/registry.sh +0 -455
- package/scripts/dot/commands/restore.sh +0 -232
- package/scripts/dot/commands/secrets.sh +0 -296
- package/scripts/dot/commands/security.sh +0 -102
- package/scripts/dot/commands/tools.sh +0 -570
- package/scripts/dot/data/alias-deprecations.tsv +0 -2
- package/scripts/dot/powershell/Dot.psm1 +0 -319
- package/scripts/fonts/install-nerd-fonts.sh +0 -75
- package/scripts/fonts/patch-fonts.sh +0 -36
- package/scripts/git-hooks/install.sh +0 -12
- package/scripts/git-hooks/pre-commit +0 -12
- package/scripts/git-hooks/pre-commit-audit.sh +0 -146
- package/scripts/git-hooks/pre-push +0 -105
- package/scripts/git-hooks/prepare-commit-msg +0 -29
- package/scripts/lib/secrets_provider.sh +0 -200
- package/scripts/nvim/headless-upgrade.lua +0 -81
- package/scripts/ops/ai-setup.sh +0 -71
- package/scripts/ops/bundle.sh +0 -104
- package/scripts/ops/chaos.sh +0 -50
- package/scripts/ops/chezmoi-apply.sh +0 -333
- package/scripts/ops/chezmoi-diff.sh +0 -16
- package/scripts/ops/chezmoi-remove.sh +0 -46
- package/scripts/ops/chezmoi-update.sh +0 -67
- package/scripts/ops/heal-chezmoi.sh +0 -87
- package/scripts/ops/heal-system.sh +0 -129
- package/scripts/ops/heal-tools.sh +0 -297
- package/scripts/ops/heal.sh +0 -223
- package/scripts/ops/post-apply-repair.sh +0 -107
- package/scripts/ops/prewarm.sh +0 -128
- package/scripts/ops/release.sh +0 -262
- package/scripts/ops/rollback.sh +0 -613
- package/scripts/ops/setup.sh +0 -138
- package/scripts/ops/teleport.sh +0 -34
- package/scripts/qa/check-feature-matrix.sh +0 -296
- package/scripts/qa/check-version-consistency.sh +0 -12
- package/scripts/qa/coverage-baseline.sh +0 -61
- package/scripts/qa/docs-coverage.sh +0 -118
- package/scripts/qa/examples-coverage.sh +0 -94
- package/scripts/qa/powershell-contract.ps1 +0 -95
- package/scripts/qa/reliability-audit.sh +0 -139
- package/scripts/qa/scorecard-snapshot.sh +0 -128
- package/scripts/qa/traceability-coverage.sh +0 -124
- package/scripts/qa/validate-examples.sh +0 -90
- package/scripts/qa/wsl-contract.sh +0 -12
- package/scripts/secrets/age-init.sh +0 -82
- package/scripts/secrets/create-secrets-file.sh +0 -46
- package/scripts/secrets/encrypt-ssh-key.sh +0 -44
- package/scripts/security/backup.sh +0 -58
- package/scripts/security/check-disclosure-key-expiry.sh +0 -111
- package/scripts/security/dns-doh.sh +0 -52
- package/scripts/security/encryption-check.sh +0 -55
- package/scripts/security/enforce-policies.sh +0 -552
- package/scripts/security/firewall.sh +0 -91
- package/scripts/security/lock-configs.sh +0 -67
- package/scripts/security/lock-screen.sh +0 -56
- package/scripts/security/manage-secrets.sh +0 -429
- package/scripts/security/ssh-cert.sh +0 -204
- package/scripts/security/telemetry-kill.sh +0 -51
- package/scripts/security/usb-safety.sh +0 -52
- package/scripts/theme/apply-gnome-theme.sh +0 -333
- package/scripts/theme/extract-heic-frames.sh +0 -115
- package/scripts/theme/extract-theme.py +0 -1020
- package/scripts/theme/install-boot-logo.sh +0 -63
- package/scripts/theme/install-catppuccin-themes.sh +0 -371
- package/scripts/theme/install-cursors.sh +0 -26
- package/scripts/theme/install-file-icons.sh +0 -27
- package/scripts/theme/install-grub-theme.sh +0 -62
- package/scripts/theme/install-lock-icon.sh +0 -31
- package/scripts/theme/merge-wallpaper.sh +0 -146
- package/scripts/theme/rebuild-themes.sh +0 -603
- package/scripts/theme/switch.sh +0 -476
- package/scripts/theme/wallpaper-rotate.sh +0 -137
- package/scripts/theme/wallpaper-sync.sh +0 -690
- package/scripts/tools/cmatrix.sh +0 -22
- package/scripts/tools/detect-collisions.py +0 -103
- package/scripts/tools/emoji-picker.sh +0 -49
- package/scripts/tools/figlet-banner.sh +0 -19
- package/scripts/tools/log-rotate.sh +0 -31
- package/scripts/tools/lolcat-wrap.sh +0 -20
- package/scripts/tools/pipes.sh +0 -49
- package/scripts/tuning/linux.sh +0 -186
- package/scripts/tuning/macos.sh +0 -56
- package/scripts/uninstall.sh +0 -86
- package/scripts/verify-release-versions +0 -156
- package/scripts/version-sync.sh +0 -714
- package/templates/chezmoi-data/geekom-a9.toml.example +0 -21
- package/templates/chezmoi-data/mac-m1.toml.example +0 -16
- package/templates/chezmoi-data/mac-t2-linux.toml.example +0 -21
- package/templates/chezmoi-data/surface-pro-7p.toml.example +0 -21
- package/templates/projects/go/.github/workflows/ci.yml +0 -31
- package/templates/projects/go/README.md +0 -7
- package/templates/projects/go/cmd/__PROJECT_NAME__/main.go +0 -8
- package/templates/projects/go/go.mod +0 -3
- package/templates/projects/go/go.sum +0 -0
- package/templates/projects/molecule/README.md +0 -7
- package/templates/projects/molecule/converge.yml +0 -7
- package/templates/projects/molecule/molecule.yml +0 -16
- package/templates/projects/node/.github/workflows/ci.yml +0 -30
- package/templates/projects/node/README.md +0 -7
- package/templates/projects/node/package-lock.json +0 -12
- package/templates/projects/node/package.json +0 -10
- package/templates/projects/node/src/index.js +0 -3
- package/templates/projects/packer/README.md +0 -15
- package/templates/projects/packer/main.pkr.hcl +0 -15
- package/templates/projects/python/.github/workflows/ci.yml +0 -34
- package/templates/projects/python/README.md +0 -7
- package/templates/projects/python/pyproject.toml +0 -25
- package/templates/projects/python/src/__PROJECT_NAME__/__init__.py +0 -2
- package/templates/projects/python/tests/test_basic.py +0 -3
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
# Dot โ native PowerShell module for the dotfiles framework.
|
|
2
|
-
#
|
|
3
|
-
# This module provides native PowerShell cmdlets for the daily `dot`
|
|
4
|
-
# workflow. Commands with Unix-specific orchestration remain available
|
|
5
|
-
# through the dispatcher's explicit bash bridge.
|
|
6
|
-
#
|
|
7
|
-
# Loaded by bin/dot.ps1 dispatcher; cmdlets are also callable
|
|
8
|
-
# directly:
|
|
9
|
-
# Import-Module ./scripts/dot/powershell/Dot.psm1
|
|
10
|
-
# Get-DotVersion
|
|
11
|
-
# Invoke-DotHelp
|
|
12
|
-
# Test-DotAgentsSync -Verbose
|
|
13
|
-
#
|
|
14
|
-
# Tested via tools/ci/windows-smoke-test.ps1.
|
|
15
|
-
|
|
16
|
-
#requires -Version 7.0
|
|
17
|
-
|
|
18
|
-
Set-StrictMode -Version Latest
|
|
19
|
-
$ErrorActionPreference = 'Stop'
|
|
20
|
-
|
|
21
|
-
# Module-level constants -------------------------------------------------------
|
|
22
|
-
|
|
23
|
-
$script:RepoRoot = if ($env:DOT_REPO_ROOT) {
|
|
24
|
-
$env:DOT_REPO_ROOT
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
# When called from bin/dot.ps1 the dispatcher sets DOT_REPO_ROOT.
|
|
28
|
-
# When imported directly, infer it from this file's path:
|
|
29
|
-
# scripts/dot/powershell/Dot.psm1 โ ../../..
|
|
30
|
-
(Resolve-Path (Join-Path $PSScriptRoot '..\..\..')).Path
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
# Post-Phase-4b (v0.2.503) .chezmoidata.toml ships under defaults/.
|
|
34
|
-
# Probe defaults/ first; fall back to legacy root location for older
|
|
35
|
-
# deployments that pre-date the .chezmoiroot activation.
|
|
36
|
-
$script:DataFile = Join-Path $script:RepoRoot 'defaults/.chezmoidata.toml'
|
|
37
|
-
if (-not (Test-Path $script:DataFile)) {
|
|
38
|
-
$script:DataFile = Join-Path $script:RepoRoot '.chezmoidata.toml'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
# Helpers ---------------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
function script:Get-DotfilesVersionFromData {
|
|
44
|
-
if (-not (Test-Path $script:DataFile)) {
|
|
45
|
-
throw "Cannot read $script:DataFile (set DOT_REPO_ROOT to override)"
|
|
46
|
-
}
|
|
47
|
-
$line = Get-Content $script:DataFile |
|
|
48
|
-
Where-Object { $_ -match '^dotfiles_version\s*=\s*"([^"]+)"' } |
|
|
49
|
-
Select-Object -First 1
|
|
50
|
-
if (-not $line) {
|
|
51
|
-
throw "dotfiles_version not found in $script:DataFile"
|
|
52
|
-
}
|
|
53
|
-
if ($line -notmatch '"([^"]+)"') {
|
|
54
|
-
throw "Could not parse dotfiles_version from line: $line"
|
|
55
|
-
}
|
|
56
|
-
return $Matches[1]
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function script:Write-DotBanner {
|
|
60
|
-
param([string]$Section)
|
|
61
|
-
if ($env:NO_COLOR) {
|
|
62
|
-
Write-Host "Dot ยท $Section"
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
$esc = [char]27
|
|
66
|
-
Write-Host "$esc[1;38;5;212mDot ยท $Section$esc[0m"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function script:Assert-DotCommand {
|
|
70
|
-
param([Parameter(Mandatory)][string]$Name)
|
|
71
|
-
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
|
|
72
|
-
throw "$Name is required but was not found on PATH"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function script:Invoke-DotNativeCommand {
|
|
77
|
-
param(
|
|
78
|
-
[Parameter(Mandatory)][string]$Name,
|
|
79
|
-
[Parameter(Mandatory)][string[]]$Arguments
|
|
80
|
-
)
|
|
81
|
-
Assert-DotCommand -Name $Name
|
|
82
|
-
& $Name @Arguments
|
|
83
|
-
if ($LASTEXITCODE -ne 0) {
|
|
84
|
-
throw "$Name exited with status $LASTEXITCODE"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
# Public cmdlets --------------------------------------------------------------
|
|
89
|
-
|
|
90
|
-
<#
|
|
91
|
-
.SYNOPSIS
|
|
92
|
-
Print the dotfiles framework version.
|
|
93
|
-
|
|
94
|
-
.DESCRIPTION
|
|
95
|
-
Native PowerShell implementation of `dot version`. Reads the
|
|
96
|
-
canonical version from .chezmoidata.toml (the single source of
|
|
97
|
-
truth) โ does NOT shell out to bash.
|
|
98
|
-
|
|
99
|
-
.EXAMPLE
|
|
100
|
-
Get-DotVersion
|
|
101
|
-
0.2.503
|
|
102
|
-
|
|
103
|
-
.EXAMPLE
|
|
104
|
-
Get-DotVersion -AsObject | ConvertTo-Json
|
|
105
|
-
{
|
|
106
|
-
"Version": "0.2.503",
|
|
107
|
-
"Source": "...\\.chezmoidata.toml",
|
|
108
|
-
"Native": true
|
|
109
|
-
}
|
|
110
|
-
#>
|
|
111
|
-
function Get-DotVersion {
|
|
112
|
-
[CmdletBinding()]
|
|
113
|
-
param(
|
|
114
|
-
[switch]$AsObject
|
|
115
|
-
)
|
|
116
|
-
$version = Get-DotfilesVersionFromData
|
|
117
|
-
if ($AsObject) {
|
|
118
|
-
return [pscustomobject]@{
|
|
119
|
-
Version = $version
|
|
120
|
-
Source = $script:DataFile
|
|
121
|
-
Native = $true
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return $version
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
<#
|
|
128
|
-
.SYNOPSIS
|
|
129
|
-
Print the dot CLI help overview.
|
|
130
|
-
|
|
131
|
-
.DESCRIPTION
|
|
132
|
-
Native PowerShell implementation of `dot help`. Presents the
|
|
133
|
-
native command surface without shelling out to bash.
|
|
134
|
-
|
|
135
|
-
The full Linux-style help (every subcommand grouped by category)
|
|
136
|
-
requires the bash dispatcher; this cmdlet shows the Windows-
|
|
137
|
-
native subset.
|
|
138
|
-
#>
|
|
139
|
-
function Invoke-DotHelp {
|
|
140
|
-
[CmdletBinding()]
|
|
141
|
-
param()
|
|
142
|
-
$version = Get-DotfilesVersionFromData
|
|
143
|
-
Write-DotBanner -Section 'Help'
|
|
144
|
-
Write-Host ''
|
|
145
|
-
Write-Host " Version v$version"
|
|
146
|
-
Write-Host " Repo https://github.com/sebastienrousseau/dotfiles"
|
|
147
|
-
Write-Host " Docs https://github.com/sebastienrousseau/dotfiles/blob/main/docs/manual/"
|
|
148
|
-
Write-Host ''
|
|
149
|
-
Write-Host 'Native PowerShell commands (no bash required):'
|
|
150
|
-
Write-Host ''
|
|
151
|
-
Write-Host ' Get-DotVersion Print framework version'
|
|
152
|
-
Write-Host ' Invoke-DotHelp This screen'
|
|
153
|
-
Write-Host ' Test-DotAgentsSync Check AGENTS.md against CLAUDE.md'
|
|
154
|
-
Write-Host ' Get-DotStatus Show chezmoi drift'
|
|
155
|
-
Write-Host ' Invoke-DotChezmoi Run a core chezmoi operation'
|
|
156
|
-
Write-Host ' Invoke-DotDoctor Audit the native Windows setup'
|
|
157
|
-
Write-Host ' Get-DotEnvironment List mise-managed tools'
|
|
158
|
-
Write-Host ' Get-DotAgents List agent harness targets'
|
|
159
|
-
Write-Host ' Get-DotFleetStatus Show local fleet node status'
|
|
160
|
-
Write-Host ''
|
|
161
|
-
Write-Host 'Bash-bridged subcommands (require bash on PATH):'
|
|
162
|
-
Write-Host ''
|
|
163
|
-
Write-Host ' dot env emit Emit v1 environment manifest'
|
|
164
|
-
Write-Host ' dot agents render Re-render every AGENTS.md harness'
|
|
165
|
-
Write-Host ' dot registry ... Verified module registry operations'
|
|
166
|
-
Write-Host ''
|
|
167
|
-
Write-Host 'See: dot help all (via bash) โ full command index'
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
<#
|
|
171
|
-
.SYNOPSIS
|
|
172
|
-
Verify that AGENTS.md is in sync with CLAUDE.md.
|
|
173
|
-
|
|
174
|
-
.DESCRIPTION
|
|
175
|
-
Native PowerShell implementation of `dot agents check`. Both
|
|
176
|
-
files share a "Project Overview" paragraph that is the canonical
|
|
177
|
-
sync surface. If they diverge, AGENTS.md needs re-rendering
|
|
178
|
-
(run `dot agents render` via bash; native PowerShell render is
|
|
179
|
-
a separate ticket).
|
|
180
|
-
|
|
181
|
-
.OUTPUTS
|
|
182
|
-
[bool] โ $true when in sync, $false otherwise.
|
|
183
|
-
|
|
184
|
-
.EXAMPLE
|
|
185
|
-
if (-not (Test-DotAgentsSync)) {
|
|
186
|
-
Write-Warning 'AGENTS.md is stale; run: bash dot_local/bin/executable_dot agents render'
|
|
187
|
-
}
|
|
188
|
-
#>
|
|
189
|
-
function Test-DotAgentsSync {
|
|
190
|
-
[CmdletBinding()]
|
|
191
|
-
[OutputType([bool])]
|
|
192
|
-
param()
|
|
193
|
-
$claude = Join-Path $script:RepoRoot 'CLAUDE.md'
|
|
194
|
-
$agents = Join-Path $script:RepoRoot 'AGENTS.md'
|
|
195
|
-
foreach ($f in @($claude, $agents)) {
|
|
196
|
-
if (-not (Test-Path $f)) {
|
|
197
|
-
Write-Error "missing: $f"
|
|
198
|
-
return $false
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
$claudeBody = Get-Content -Raw $claude
|
|
202
|
-
$agentsBody = Get-Content -Raw $agents
|
|
203
|
-
foreach ($name in @('claudeBody', 'agentsBody')) {
|
|
204
|
-
$value = Get-Variable -Name $name -ValueOnly
|
|
205
|
-
$value = $value -replace '(?s)^\s*<!--.*?-->\s*', ''
|
|
206
|
-
$value = $value -replace '(?m)^# (CLAUDE|AGENTS)\.md.*\r?\n', ''
|
|
207
|
-
$value = $value -replace '(?s)\r?\n---\r?\n\r?\n\*\*Need richer context\?.*$', ''
|
|
208
|
-
$value = ($value -replace "`r`n", "`n").Trim()
|
|
209
|
-
Set-Variable -Name $name -Value $value
|
|
210
|
-
}
|
|
211
|
-
if ($claudeBody -cne $agentsBody) {
|
|
212
|
-
Write-Verbose 'AGENTS.md content differs from the canonical CLAUDE.md body'
|
|
213
|
-
return $false
|
|
214
|
-
}
|
|
215
|
-
Write-Verbose 'AGENTS.md content matches the canonical CLAUDE.md body'
|
|
216
|
-
return $true
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function Invoke-DotChezmoi {
|
|
220
|
-
[CmdletBinding()]
|
|
221
|
-
param(
|
|
222
|
-
[Parameter(Mandatory)]
|
|
223
|
-
[ValidateSet('apply', 'diff', 'update', 'add', 'remove', 'init')]
|
|
224
|
-
[string]$Operation,
|
|
225
|
-
[Parameter(ValueFromRemainingArguments = $true)]
|
|
226
|
-
[string[]]$Arguments = @()
|
|
227
|
-
)
|
|
228
|
-
Invoke-DotNativeCommand -Name 'chezmoi' -Arguments (@($Operation) + $Arguments)
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function Get-DotStatus {
|
|
232
|
-
[CmdletBinding()]
|
|
233
|
-
param([switch]$AsObject)
|
|
234
|
-
Assert-DotCommand -Name 'chezmoi'
|
|
235
|
-
$output = @(& chezmoi status 2>&1)
|
|
236
|
-
if ($LASTEXITCODE -ne 0) {
|
|
237
|
-
throw "chezmoi status exited with status $LASTEXITCODE`: $($output -join [Environment]::NewLine)"
|
|
238
|
-
}
|
|
239
|
-
$state = if ($output.Count -eq 0) { 'clean' } else { 'drifted' }
|
|
240
|
-
if ($AsObject) {
|
|
241
|
-
return [pscustomobject]@{ State = $state; Changes = $output; Native = $true }
|
|
242
|
-
}
|
|
243
|
-
Write-DotBanner -Section 'Status'
|
|
244
|
-
if ($state -eq 'clean') { Write-Host '[OK] Clean - no local drift detected' }
|
|
245
|
-
else { $output | Write-Output }
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function Get-DotSourcePath {
|
|
249
|
-
[CmdletBinding()]
|
|
250
|
-
param()
|
|
251
|
-
Assert-DotCommand -Name 'chezmoi'
|
|
252
|
-
$path = (& chezmoi source-path 2>&1 | Out-String).Trim()
|
|
253
|
-
if ($LASTEXITCODE -ne 0 -or -not $path) { throw 'chezmoi source-path failed' }
|
|
254
|
-
return $path
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function Invoke-DotDoctor {
|
|
258
|
-
[CmdletBinding()]
|
|
259
|
-
param([switch]$AsObject)
|
|
260
|
-
$checks = @(
|
|
261
|
-
[pscustomobject]@{ Name = 'PowerShell 7.4+'; Ok = ($PSVersionTable.PSVersion -ge [version]'7.4') }
|
|
262
|
-
[pscustomobject]@{ Name = 'chezmoi'; Ok = [bool](Get-Command chezmoi -ErrorAction SilentlyContinue) }
|
|
263
|
-
[pscustomobject]@{ Name = 'git'; Ok = [bool](Get-Command git -ErrorAction SilentlyContinue) }
|
|
264
|
-
[pscustomobject]@{ Name = 'repository data'; Ok = (Test-Path $script:DataFile) }
|
|
265
|
-
[pscustomobject]@{ Name = 'PowerShell module'; Ok = (Test-Path (Join-Path $PSScriptRoot 'Dot.psm1')) }
|
|
266
|
-
)
|
|
267
|
-
if ($AsObject) { return $checks }
|
|
268
|
-
Write-DotBanner -Section 'Doctor'
|
|
269
|
-
foreach ($check in $checks) {
|
|
270
|
-
$prefix = if ($check.Ok) { '[OK]' } else { '[FAIL]' }
|
|
271
|
-
Write-Host "$prefix $($check.Name)"
|
|
272
|
-
}
|
|
273
|
-
return -not ($checks.Ok -contains $false)
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function Get-DotEnvironment {
|
|
277
|
-
[CmdletBinding()]
|
|
278
|
-
param([switch]$AsJson)
|
|
279
|
-
Assert-DotCommand -Name 'mise'
|
|
280
|
-
$arguments = if ($AsJson) { @('ls', '--json') } else { @('ls') }
|
|
281
|
-
Invoke-DotNativeCommand -Name 'mise' -Arguments $arguments
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function Get-DotAgents {
|
|
285
|
-
[CmdletBinding()]
|
|
286
|
-
param()
|
|
287
|
-
$targets = [ordered]@{
|
|
288
|
-
'agents-md' = 'AGENTS.md'; 'cursor' = '.cursor/rules/dotfiles.mdc'
|
|
289
|
-
'codex' = '.codex/config.toml'; 'windsurf' = '.windsurf/rules.md'
|
|
290
|
-
'zed' = '.zed/agent-config.toml'; 'roo' = '.roo/rules.md'
|
|
291
|
-
'cline' = '.clinerules'; 'aider' = '.aider.conf.yml'
|
|
292
|
-
'continue' = '.continuerc.json'; 'jules' = '.jules/system.md'
|
|
293
|
-
'agy' = '.agy/AGY.md'
|
|
294
|
-
}
|
|
295
|
-
foreach ($entry in $targets.GetEnumerator()) {
|
|
296
|
-
$path = Join-Path $script:RepoRoot $entry.Value
|
|
297
|
-
[pscustomobject]@{ Harness = $entry.Key; Path = $path; Rendered = (Test-Path $path) }
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function Get-DotFleetStatus {
|
|
302
|
-
[CmdletBinding()]
|
|
303
|
-
param([switch]$AsJson)
|
|
304
|
-
$status = Get-DotStatus -AsObject
|
|
305
|
-
$record = [pscustomobject]@{
|
|
306
|
-
NodeId = [Environment]::MachineName
|
|
307
|
-
Namespace = 'default'
|
|
308
|
-
Version = Get-DotfilesVersionFromData
|
|
309
|
-
OS = [System.Runtime.InteropServices.RuntimeInformation]::OSDescription
|
|
310
|
-
Architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()
|
|
311
|
-
Drift = $status.State
|
|
312
|
-
}
|
|
313
|
-
if ($AsJson) { return $record | ConvertTo-Json -Compress }
|
|
314
|
-
return $record
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
Export-ModuleMember -Function Get-DotVersion, Invoke-DotHelp, Test-DotAgentsSync, `
|
|
318
|
-
Invoke-DotChezmoi, Get-DotStatus, Get-DotSourcePath, Invoke-DotDoctor, `
|
|
319
|
-
Get-DotEnvironment, Get-DotAgents, Get-DotFleetStatus
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
# shellcheck source=../../lib/dot/ui.sh
|
|
8
|
-
# shellcheck disable=SC1091
|
|
9
|
-
source "$SCRIPT_DIR/../../lib/dot/ui.sh"
|
|
10
|
-
# shellcheck source=../../lib/dot/verified-download.sh disable=SC1091
|
|
11
|
-
source "$SCRIPT_DIR/../../lib/dot/verified-download.sh"
|
|
12
|
-
|
|
13
|
-
ui_init
|
|
14
|
-
ui_header "Nerd Fonts"
|
|
15
|
-
|
|
16
|
-
DEFAULT_FONTS="JetBrainsMono FiraCode Iosevka"
|
|
17
|
-
FONT_LIST="${*:-$DEFAULT_FONTS}"
|
|
18
|
-
FONT_VERSION="v3.4.0"
|
|
19
|
-
FONT_BASE_URL="https://github.com/ryanoasis/nerd-fonts/releases/download/${FONT_VERSION}"
|
|
20
|
-
FONT_CHECKSUM_URL="${FONT_BASE_URL}/SHA-256.txt"
|
|
21
|
-
|
|
22
|
-
install_linux() (
|
|
23
|
-
local font_name="$1"
|
|
24
|
-
local target_dir="$HOME/.local/share/fonts/${font_name}NerdFont"
|
|
25
|
-
mkdir -p "$target_dir"
|
|
26
|
-
local tmp_dir
|
|
27
|
-
tmp_dir="$(umask 077 && mktemp -d)"
|
|
28
|
-
trap 'rm -rf "$tmp_dir"' EXIT
|
|
29
|
-
local asset="${font_name}.zip"
|
|
30
|
-
local url="${FONT_BASE_URL}/${asset}"
|
|
31
|
-
ui_info "Downloading" "$font_name Nerd Font"
|
|
32
|
-
download_verified_asset "$url" "$FONT_CHECKSUM_URL" "$asset" "$tmp_dir/$asset" 104857600
|
|
33
|
-
if ! unzip -o "$tmp_dir/$asset" -d "$target_dir" >/dev/null; then
|
|
34
|
-
ui_err "Unzip failed" "$asset" >&2
|
|
35
|
-
return 1
|
|
36
|
-
fi
|
|
37
|
-
if command -v fc-cache >/dev/null; then
|
|
38
|
-
fc-cache -f "$target_dir"
|
|
39
|
-
fi
|
|
40
|
-
ui_ok "Installed" "$target_dir"
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
install_macos() {
|
|
44
|
-
font_name="$1"
|
|
45
|
-
if command -v brew >/dev/null; then
|
|
46
|
-
brew tap homebrew/cask-fonts >/dev/null 2>&1 || true
|
|
47
|
-
cask_name="$(printf "%s" "$font_name" | tr '[:upper:]' '[:lower:]')"
|
|
48
|
-
case "$cask_name" in
|
|
49
|
-
jetbrainsmono) cask_name="jetbrains-mono" ;;
|
|
50
|
-
firacode) cask_name="fira-code" ;;
|
|
51
|
-
iosevka) cask_name="iosevka" ;;
|
|
52
|
-
esac
|
|
53
|
-
brew install --cask "font-${cask_name}-nerd-font" || true
|
|
54
|
-
else
|
|
55
|
-
ui_err "Homebrew" "not found. Install font manually."
|
|
56
|
-
exit 1
|
|
57
|
-
fi
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
case "$(uname -s)" in
|
|
61
|
-
Linux)
|
|
62
|
-
for font in $FONT_LIST; do
|
|
63
|
-
install_linux "$font"
|
|
64
|
-
done
|
|
65
|
-
;;
|
|
66
|
-
Darwin)
|
|
67
|
-
for font in $FONT_LIST; do
|
|
68
|
-
install_macos "$font"
|
|
69
|
-
done
|
|
70
|
-
;;
|
|
71
|
-
*)
|
|
72
|
-
ui_err "Unsupported OS" "font install"
|
|
73
|
-
exit 1
|
|
74
|
-
;;
|
|
75
|
-
esac
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
if [[ $# -lt 1 ]]; then
|
|
7
|
-
echo "Usage: patch-fonts.sh <font-file> [output-dir]" >&2
|
|
8
|
-
exit 1
|
|
9
|
-
fi
|
|
10
|
-
|
|
11
|
-
font_file="$1"
|
|
12
|
-
out_dir="${2:-$PWD/patched-fonts}"
|
|
13
|
-
|
|
14
|
-
if [[ ! -f "$font_file" ]]; then
|
|
15
|
-
echo "Font not found: $font_file" >&2
|
|
16
|
-
exit 1
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
if ! command -v fontforge >/dev/null; then
|
|
20
|
-
echo "fontforge not found. Install it first (brew install fontforge / apt install fontforge)." >&2
|
|
21
|
-
exit 1
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
patcher="${NERD_FONTS_PATCHER:-$HOME/.local/share/nerd-fonts/font-patcher}"
|
|
25
|
-
|
|
26
|
-
if [[ ! -x "$patcher" ]]; then
|
|
27
|
-
echo "Nerd Fonts patcher not found: $patcher" >&2
|
|
28
|
-
echo "Set NERD_FONTS_PATCHER to the font-patcher path or clone nerd-fonts." >&2
|
|
29
|
-
exit 1
|
|
30
|
-
fi
|
|
31
|
-
|
|
32
|
-
mkdir -p "$out_dir"
|
|
33
|
-
|
|
34
|
-
fontforge -script "$patcher" --complete --outputdir "$out_dir" "$font_file"
|
|
35
|
-
|
|
36
|
-
echo "Patched font written to: $out_dir"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
7
|
-
install -m 0755 "${repo_root}/scripts/git-hooks/pre-commit" "${repo_root}/.git/hooks/pre-commit"
|
|
8
|
-
install -m 0755 "${repo_root}/scripts/git-hooks/pre-push" "${repo_root}/.git/hooks/pre-push"
|
|
9
|
-
install -m 0755 "${repo_root}/scripts/git-hooks/prepare-commit-msg" "${repo_root}/.git/hooks/prepare-commit-msg"
|
|
10
|
-
echo "Installed pre-commit hook at ${repo_root}/.git/hooks/pre-commit"
|
|
11
|
-
echo "Installed pre-push hook at ${repo_root}/.git/hooks/pre-push"
|
|
12
|
-
echo "Installed prepare-commit-msg hook at ${repo_root}/.git/hooks/prepare-commit-msg"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
5
|
-
|
|
6
|
-
if [[ -x "${repo_root}/scripts/diagnostics/secret-governance.sh" ]]; then
|
|
7
|
-
"${repo_root}/scripts/diagnostics/secret-governance.sh"
|
|
8
|
-
fi
|
|
9
|
-
|
|
10
|
-
if [[ -x "${repo_root}/scripts/git-hooks/pre-commit-audit.sh" ]]; then
|
|
11
|
-
"${repo_root}/scripts/git-hooks/pre-commit-audit.sh"
|
|
12
|
-
fi
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
# Dotfiles Pre-Commit Sentinel (Audit Hook)
|
|
5
|
-
# Prevents secrets, hardcoded paths, and shell hygiene violations.
|
|
6
|
-
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
_cleanup_files=()
|
|
10
|
-
trap 'set +u; rm -f "${_cleanup_files[@]}" 2>/dev/null; set -u' EXIT
|
|
11
|
-
|
|
12
|
-
# ANSI Colors
|
|
13
|
-
RED='\033[0;31m'
|
|
14
|
-
GREEN='\033[0;32m'
|
|
15
|
-
YELLOW='\033[0;33m'
|
|
16
|
-
BOLD='\033[1m'
|
|
17
|
-
NC='\033[0m'
|
|
18
|
-
|
|
19
|
-
printf '%b\\n' "${BOLD}๐ต๏ธ Running Pre-Commit Audit...${NC}"
|
|
20
|
-
|
|
21
|
-
# Get list of staged files
|
|
22
|
-
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM)
|
|
23
|
-
|
|
24
|
-
if [[ -z "$STAGED_FILES" ]]; then
|
|
25
|
-
printf '%b\\n' "${GREEN}โ No files staged. Skipping.${NC}"
|
|
26
|
-
exit 0
|
|
27
|
-
fi
|
|
28
|
-
|
|
29
|
-
FAILED=0
|
|
30
|
-
|
|
31
|
-
# --- ๐ 1. Secret Scanning ---
|
|
32
|
-
echo -n " ๐ Scanning for secrets... "
|
|
33
|
-
# Refined patterns: require assignment-like syntax to reduce false positives on documentation
|
|
34
|
-
# Exclude assignments to values containing common placeholder strings or within template expressions
|
|
35
|
-
SENSITIVE_PATTERNS="(GITHUB_TOKEN|API_KEY|SECRET|password|private_key|AKIA[0-9A-Z]{16})[[:space:]]*[:=]"
|
|
36
|
-
# Exclusions list for legitimate variable checks or documentation
|
|
37
|
-
SECRET_EXCLUDES="test_|assertions.sh|.pre-commit|README|CHANGELOG|FEATURES.md|docs/|install/lib/|.chezmoitemplates/|mcp-doctor.sh|\.github/workflows/"
|
|
38
|
-
# Also exclude .tmpl files from secret scanning as they contain many false positive markers
|
|
39
|
-
if echo "$STAGED_FILES" | grep -v "\.tmpl" | xargs grep -EiE "$SENSITIVE_PATTERNS" /dev/null | grep -vE "$SECRET_EXCLUDES" | grep -viE "dummy|placeholder|example|test|sk-placeholder|\\{\\{" >/dev/null 2>&1; then
|
|
40
|
-
printf '%b\\n' "${RED}FAILED${NC}"
|
|
41
|
-
printf '%b\\n' " ${YELLOW}โ Potential secret detected in staged files:${NC}"
|
|
42
|
-
echo "$STAGED_FILES" | grep -v "\.tmpl" | xargs grep -EiE "$SENSITIVE_PATTERNS" /dev/null | grep -vE "$SECRET_EXCLUDES" | grep -viE "dummy|placeholder|example|test|sk-placeholder|\\{\\{" | sed 's/^/ /'
|
|
43
|
-
FAILED=1
|
|
44
|
-
else
|
|
45
|
-
printf '%b\\n' "${GREEN}PASSED${NC}"
|
|
46
|
-
fi
|
|
47
|
-
|
|
48
|
-
# --- ๐ป 2. Ghost Path Linter ---
|
|
49
|
-
echo -n " ๐ป Checking for hardcoded paths... "
|
|
50
|
-
# Exclude test files, documentation, the hook itself, Nix files, and template backups
|
|
51
|
-
GHOST_EXCLUDES="test_|assertions.sh|pre-commit|INTEROP.md|WSL2_NIX_TROUBLESHOOTING.md|\.nix|\.backup|\.github/workflows/"
|
|
52
|
-
if echo "$STAGED_FILES" | xargs grep -rIE '"/home/(linuxbrew)?[^$]|/Users/[^$]' /dev/null | grep -v "linuxbrew" | grep -vE "$GHOST_EXCLUDES" >/dev/null 2>&1; then
|
|
53
|
-
printf '%b\\n' "${RED}FAILED${NC}"
|
|
54
|
-
printf '%b\\n' " ${YELLOW}โ Literal home paths detected (use \$HOME or ~ instead):${NC}"
|
|
55
|
-
echo "$STAGED_FILES" | xargs grep -rIE '"/home/(linuxbrew)?[^$]|/Users/[^$]' /dev/null | grep -v "linuxbrew" | grep -vE "$GHOST_EXCLUDES" | sed 's/^/ /'
|
|
56
|
-
FAILED=1
|
|
57
|
-
else
|
|
58
|
-
printf '%b\\n' "${GREEN}PASSED${NC}"
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
# --- ๐ 3. ShellCheck Hygiene ---
|
|
62
|
-
if command -v shellcheck >/dev/null 2>&1; then
|
|
63
|
-
echo -n " ๐ Running ShellCheck... "
|
|
64
|
-
# ONLY run on actual .sh files, NOT .tmpl files (Go templates break shellcheck)
|
|
65
|
-
# Also exclude files that contain Zsh-specific syntax that might trigger false positives in sh mode
|
|
66
|
-
SHELL_FILES=$(echo "$STAGED_FILES" | grep -E '\.sh$' | grep -v "\.tmpl" || true)
|
|
67
|
-
if [[ -n "$SHELL_FILES" ]]; then
|
|
68
|
-
if ! echo "$SHELL_FILES" | xargs shellcheck -x --severity=error -e SC1091,SC2296,SC2142 >/dev/null 2>&1; then
|
|
69
|
-
printf '%b\\n' "${RED}FAILED${NC}"
|
|
70
|
-
printf '%b\\n' " ${YELLOW}โ Shell syntax errors detected:${NC}"
|
|
71
|
-
echo "$SHELL_FILES" | xargs shellcheck -x --severity=error -e SC1091,SC2296,SC2142 | sed 's/^/ /'
|
|
72
|
-
FAILED=1
|
|
73
|
-
else
|
|
74
|
-
printf '%b\\n' "${GREEN}PASSED${NC}"
|
|
75
|
-
fi
|
|
76
|
-
else
|
|
77
|
-
printf '%b\\n' "${YELLOW}SKIPPED${NC} (no .sh files)"
|
|
78
|
-
fi
|
|
79
|
-
fi
|
|
80
|
-
# --- ๐งน 4. Formatting Audit ---
|
|
81
|
-
echo -n " ๐งน Checking formatting... "
|
|
82
|
-
# Find files with trailing whitespace, excluding SVGs and other formats where it might be intentional or harmless
|
|
83
|
-
OFFENDING_WHITESPACE=$(echo "$STAGED_FILES" | grep -vE '\.(svg|md)$' | xargs grep -l '[[:space:]]$' /dev/null || true)
|
|
84
|
-
# Use defused patterns to avoid self-detection
|
|
85
|
-
MERGE_START="^<<<<<<< "
|
|
86
|
-
MERGE_END="^>>>>>>> "
|
|
87
|
-
MERGE_DIV="^=======$"
|
|
88
|
-
if [[ -n "$OFFENDING_WHITESPACE" ]]; then
|
|
89
|
-
printf '%b\\n' "${RED}FAILED${NC}"
|
|
90
|
-
printf '%b\\n' " ${YELLOW}โ Trailing whitespace found in staged files:${NC}"
|
|
91
|
-
echo " ${OFFENDING_WHITESPACE//$'\n'/$'\n' }"
|
|
92
|
-
FAILED=1
|
|
93
|
-
elif echo "$STAGED_FILES" | xargs grep -lE "$MERGE_START|$MERGE_END|$MERGE_DIV" /dev/null >/dev/null 2>&1; then
|
|
94
|
-
printf '%b\\n' "${RED}FAILED${NC}"
|
|
95
|
-
printf '%b\\n' " ${YELLOW}โ Unresolved merge markers found in staged files:${NC}"
|
|
96
|
-
echo "$STAGED_FILES" | xargs grep -lE "$MERGE_START|$MERGE_END|$MERGE_DIV" /dev/null | sed 's/^/ /'
|
|
97
|
-
FAILED=1
|
|
98
|
-
else
|
|
99
|
-
printf '%b\\n' "${GREEN}PASSED${NC}"
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
# --- ๐๏ธ 5. Signature Guard ---
|
|
103
|
-
if echo "$STAGED_FILES" | grep -q "^README.md$"; then
|
|
104
|
-
echo -n " ๐๏ธ Checking README signature... "
|
|
105
|
-
EXPECTED_ARCHITECT='**THE ARCHITECT** แซ [Sebastien Rousseau](https://sebastienrousseau.com)'
|
|
106
|
-
EXPECTED_ENGINE='**THE ENGINE** แ [EUXIS](https://euxis.co) แซ Enterprise Unified Execution Intelligence System'
|
|
107
|
-
README_CONTENT=$(git show :README.md 2>/dev/null || cat README.md)
|
|
108
|
-
if echo "$README_CONTENT" | grep -qF "$EXPECTED_ARCHITECT" && echo "$README_CONTENT" | grep -qF "$EXPECTED_ENGINE"; then
|
|
109
|
-
printf '%b\\n' "${GREEN}PASSED${NC}"
|
|
110
|
-
else
|
|
111
|
-
# Auto-add the signature footer before ## License (or at EOF)
|
|
112
|
-
tmp_footer=$(mktemp)
|
|
113
|
-
_cleanup_files+=("$tmp_footer")
|
|
114
|
-
if grep -qF '## License' README.md; then
|
|
115
|
-
awk -v arch="$EXPECTED_ARCHITECT" -v eng="$EXPECTED_ENGINE" '
|
|
116
|
-
/^## License/ {
|
|
117
|
-
print "---"
|
|
118
|
-
print ""
|
|
119
|
-
print arch
|
|
120
|
-
print eng
|
|
121
|
-
print ""
|
|
122
|
-
print "---"
|
|
123
|
-
print ""
|
|
124
|
-
}
|
|
125
|
-
{ print }
|
|
126
|
-
' README.md >"$tmp_footer" && mv "$tmp_footer" README.md
|
|
127
|
-
else
|
|
128
|
-
{
|
|
129
|
-
printf '\n---\n\n%s\n%s\n\n---\n' "$EXPECTED_ARCHITECT" "$EXPECTED_ENGINE"
|
|
130
|
-
} >>README.md
|
|
131
|
-
fi
|
|
132
|
-
rm -f "$tmp_footer"
|
|
133
|
-
git add README.md
|
|
134
|
-
printf '%b\\n' "${GREEN}FIXED${NC} (auto-added)"
|
|
135
|
-
fi
|
|
136
|
-
fi
|
|
137
|
-
|
|
138
|
-
echo ""
|
|
139
|
-
if [[ $FAILED -eq 1 ]]; then
|
|
140
|
-
printf '%b\\n' "${RED}${BOLD}โ Audit failed.${NC} Please fix the issues above before committing."
|
|
141
|
-
printf '%b\\n' " (Use --no-verify to bypass if absolutely necessary)"
|
|
142
|
-
exit 1
|
|
143
|
-
else
|
|
144
|
-
printf '%b\n' "${GREEN}${BOLD}โ
Audit passed.${NC} v0.2.520 standards maintained."
|
|
145
|
-
exit 0
|
|
146
|
-
fi
|