@sebastienrousseau/dotfiles 0.2.519 → 0.2.521
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 +200 -0
- package/LICENSE-APACHE +190 -0
- package/{LICENSE → LICENSE-MIT} +1 -1
- package/README.md +1172 -166
- package/install.sh +77 -11
- package/package.json +8 -8
- 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/CNAME +0 -1
- package/docs/CONFIG_STRATEGY.md +0 -124
- package/docs/COPYRIGHT +0 -7
- package/docs/GOVERNANCE.md +0 -98
- package/docs/MAINTAINERS.md +0 -41
- 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 -117
- 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/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 -450
- 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 -155
- package/docs/manual/concept-index.md +0 -168
- package/docs/manual/index.md +0 -66
- 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/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 -43
- package/docs/operations/TRUSTED_AGENT_WORKSTATION.md +0 -65
- package/docs/operations/VERSION_SYNC.md +0 -393
- 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/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 -242
- 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 -114
- 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 -138
- package/scripts/diagnostics/aliases-cheatsheet.sh +0 -74
- package/scripts/diagnostics/aliases-manifest.sh +0 -77
- package/scripts/diagnostics/benchmark.sh +0 -408
- package/scripts/diagnostics/conflicts.sh +0 -73
- package/scripts/diagnostics/doctor-unified.sh +0 -39
- package/scripts/diagnostics/doctor.sh +0 -751
- package/scripts/diagnostics/drift-dashboard.sh +0 -202
- package/scripts/diagnostics/health.sh +0 -623
- 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 -119
- 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 -187
- package/scripts/dot/commands/agent.sh +0 -485
- package/scripts/dot/commands/agents.sh +0 -336
- package/scripts/dot/commands/ai.sh +0 -587
- package/scripts/dot/commands/aliases.sh +0 -277
- package/scripts/dot/commands/appearance.sh +0 -110
- package/scripts/dot/commands/completion.sh +0 -134
- 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 -688
- 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 -333
- package/scripts/dot/commands/patterns.sh +0 -55
- package/scripts/dot/commands/registry.sh +0 -419
- 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 -556
- 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 -185
- 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 -63
- 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 -604
- package/scripts/ops/setup.sh +0 -138
- package/scripts/ops/teleport.sh +0 -34
- package/scripts/qa/check-version-consistency.sh +0 -124
- package/scripts/qa/coverage-baseline.sh +0 -61
- package/scripts/qa/docs-coverage.sh +0 -112
- 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 -117
- package/scripts/qa/validate-examples.sh +0 -27
- 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 -335
- 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 -742
- 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 -544
- package/scripts/theme/switch.sh +0 -449
- 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/version-sync.sh +0 -654
- 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,217 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
## Dotfiles Core Commands — Core chezmoi operations for the dot CLI.
|
|
5
|
-
##
|
|
6
|
-
## Provides apply, sync, update, add, diff, status, remove, cd, and edit
|
|
7
|
-
## commands for managing dotfiles through the unified dot interface.
|
|
8
|
-
##
|
|
9
|
-
## # Requirements
|
|
10
|
-
## - chezmoi: Dotfiles manager
|
|
11
|
-
## - bash 4+: Shell interpreter
|
|
12
|
-
##
|
|
13
|
-
## # Usage
|
|
14
|
-
## dot apply # Apply dotfiles
|
|
15
|
-
## dot sync # Alias for apply
|
|
16
|
-
## dot update # Pull and apply updates
|
|
17
|
-
## dot add <file> # Add file to chezmoi
|
|
18
|
-
## dot diff # Show pending changes
|
|
19
|
-
## dot status # Show configuration drift
|
|
20
|
-
## dot remove <file> # Remove managed file
|
|
21
|
-
## dot cd # Print source directory
|
|
22
|
-
## dot edit # Open source in editor
|
|
23
|
-
##
|
|
24
|
-
## # Platform Notes
|
|
25
|
-
## - All platforms: Full chezmoi support
|
|
26
|
-
|
|
27
|
-
set -euo pipefail
|
|
28
|
-
|
|
29
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
30
|
-
# shellcheck source=../../../lib/dot/utils.sh
|
|
31
|
-
source "$SCRIPT_DIR/../../../lib/dot/utils.sh"
|
|
32
|
-
|
|
33
|
-
if [[ "${1:-}" != "cd" ]]; then
|
|
34
|
-
dot_ui_command_banner "Core" "${1:-}"
|
|
35
|
-
fi
|
|
36
|
-
|
|
37
|
-
usage() {
|
|
38
|
-
cat <<'EOF'
|
|
39
|
-
Usage: core.sh <command> [args...]
|
|
40
|
-
|
|
41
|
-
Commands:
|
|
42
|
-
apply, sync, update, add, diff, status, remove, cd, edit, commit,
|
|
43
|
-
clean-cache, uninstall
|
|
44
|
-
EOF
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
cmd_apply() {
|
|
48
|
-
local src_dir
|
|
49
|
-
src_dir="$(resolve_source_dir)"
|
|
50
|
-
if [ -n "$src_dir" ] && [ -f "$src_dir/scripts/ops/chezmoi-apply.sh" ]; then
|
|
51
|
-
exec bash "$src_dir/scripts/ops/chezmoi-apply.sh" "$@"
|
|
52
|
-
fi
|
|
53
|
-
exec chezmoi apply "$@"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
cmd_sync() {
|
|
57
|
-
cmd_apply "$@"
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
cmd_update() {
|
|
61
|
-
local src_dir
|
|
62
|
-
src_dir="$(resolve_source_dir)"
|
|
63
|
-
if [ -n "$src_dir" ] && [ -f "$src_dir/scripts/ops/chezmoi-update.sh" ]; then
|
|
64
|
-
exec bash "$src_dir/scripts/ops/chezmoi-update.sh" "$@"
|
|
65
|
-
fi
|
|
66
|
-
echo "Updating Dotfiles..."
|
|
67
|
-
exec chezmoi update "$@"
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
cmd_add() {
|
|
71
|
-
if [ -z "${1:-}" ]; then
|
|
72
|
-
echo "Usage: dot add <file>"
|
|
73
|
-
echo ""
|
|
74
|
-
echo "Add a file to the chezmoi source directory."
|
|
75
|
-
echo "The file will be managed by chezmoi from now on."
|
|
76
|
-
exit 1
|
|
77
|
-
fi
|
|
78
|
-
exec chezmoi add "$@"
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
cmd_diff() {
|
|
82
|
-
local src_dir
|
|
83
|
-
src_dir="$(resolve_source_dir)"
|
|
84
|
-
if [ -n "$src_dir" ] && [ -f "$src_dir/scripts/ops/chezmoi-diff.sh" ]; then
|
|
85
|
-
exec bash "$src_dir/scripts/ops/chezmoi-diff.sh" "$@"
|
|
86
|
-
fi
|
|
87
|
-
exec chezmoi diff "$@"
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
cmd_status() {
|
|
91
|
-
local out rc=0
|
|
92
|
-
# Capture chezmoi's stderr too so an actual tool failure surfaces
|
|
93
|
-
# to the user instead of being indistinguishable from a clean tree.
|
|
94
|
-
out="$(chezmoi status "$@" 2>&1)" || rc=$?
|
|
95
|
-
ui_header "Dotfiles Status"
|
|
96
|
-
if [[ "$rc" -ne 0 ]]; then
|
|
97
|
-
ui_err "chezmoi" "exited $rc"
|
|
98
|
-
[[ -n "$out" ]] && printf "%s\n" "$out"
|
|
99
|
-
return "$rc"
|
|
100
|
-
fi
|
|
101
|
-
if [[ -z "$out" ]]; then
|
|
102
|
-
ui_ok "Clean" "no local drift detected"
|
|
103
|
-
else
|
|
104
|
-
printf "%s\n" "$out"
|
|
105
|
-
fi
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
cmd_remove() {
|
|
109
|
-
run_script "scripts/ops/chezmoi-remove.sh" "Remove helper" "$@"
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
cmd_cd() {
|
|
113
|
-
local src_dir
|
|
114
|
-
src_dir="$(resolve_source_dir)"
|
|
115
|
-
if [ -n "$src_dir" ]; then
|
|
116
|
-
echo "$src_dir"
|
|
117
|
-
else
|
|
118
|
-
echo "Dotfiles source not found." >&2
|
|
119
|
-
exit 1
|
|
120
|
-
fi
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
cmd_edit() {
|
|
124
|
-
local src_dir
|
|
125
|
-
src_dir="$(require_source_dir)"
|
|
126
|
-
if [ -n "${EDITOR:-}" ]; then
|
|
127
|
-
exec "$EDITOR" "$src_dir"
|
|
128
|
-
elif has_command nvim; then
|
|
129
|
-
exec nvim "$src_dir"
|
|
130
|
-
elif has_command vim; then
|
|
131
|
-
exec vim "$src_dir"
|
|
132
|
-
else
|
|
133
|
-
echo "No editor found. Set \$EDITOR to open $src_dir."
|
|
134
|
-
exit 1
|
|
135
|
-
fi
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
cmd_commit() {
|
|
139
|
-
run_script "dot_local/bin/executable_git-ai-commit" "Git AI commit script" "$@"
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
cmd_uninstall() {
|
|
143
|
-
run_script "scripts/uninstall.sh" "Uninstall script" "$@"
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
cmd_clean_cache() {
|
|
147
|
-
ui_info "Cache" "Clearing shell initialization caches"
|
|
148
|
-
local cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}"
|
|
149
|
-
rm -rf "$cache_dir/zsh"/*-init.zsh "$cache_dir/zsh"/*.zwc 2>/dev/null || true
|
|
150
|
-
rm -rf "$cache_dir/bash"/*-init.bash 2>/dev/null || true
|
|
151
|
-
rm -rf "$cache_dir/fish"/*-init.fish 2>/dev/null || true
|
|
152
|
-
rm -rf "$cache_dir/nushell"/*.nu 2>/dev/null || true
|
|
153
|
-
ui_info "Cache" "Cleared. Restart shell to regenerate"
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
# Dispatch
|
|
157
|
-
case "${1:-}" in
|
|
158
|
-
--help | -h | help)
|
|
159
|
-
usage
|
|
160
|
-
;;
|
|
161
|
-
"")
|
|
162
|
-
usage
|
|
163
|
-
exit 1
|
|
164
|
-
;;
|
|
165
|
-
apply)
|
|
166
|
-
shift
|
|
167
|
-
cmd_apply "$@"
|
|
168
|
-
;;
|
|
169
|
-
sync)
|
|
170
|
-
shift
|
|
171
|
-
cmd_sync "$@"
|
|
172
|
-
;;
|
|
173
|
-
update)
|
|
174
|
-
shift
|
|
175
|
-
cmd_update "$@"
|
|
176
|
-
;;
|
|
177
|
-
add)
|
|
178
|
-
shift
|
|
179
|
-
cmd_add "$@"
|
|
180
|
-
;;
|
|
181
|
-
diff)
|
|
182
|
-
shift
|
|
183
|
-
cmd_diff "$@"
|
|
184
|
-
;;
|
|
185
|
-
status)
|
|
186
|
-
shift
|
|
187
|
-
cmd_status "$@"
|
|
188
|
-
;;
|
|
189
|
-
remove)
|
|
190
|
-
shift
|
|
191
|
-
cmd_remove "$@"
|
|
192
|
-
;;
|
|
193
|
-
cd)
|
|
194
|
-
shift
|
|
195
|
-
cmd_cd "$@"
|
|
196
|
-
;;
|
|
197
|
-
edit)
|
|
198
|
-
shift
|
|
199
|
-
cmd_edit "$@"
|
|
200
|
-
;;
|
|
201
|
-
commit)
|
|
202
|
-
shift
|
|
203
|
-
cmd_commit "$@"
|
|
204
|
-
;;
|
|
205
|
-
clean-cache)
|
|
206
|
-
shift
|
|
207
|
-
cmd_clean_cache "$@"
|
|
208
|
-
;;
|
|
209
|
-
uninstall)
|
|
210
|
-
shift
|
|
211
|
-
cmd_uninstall "$@"
|
|
212
|
-
;;
|
|
213
|
-
*)
|
|
214
|
-
echo "Unknown core command: ${1:-}" >&2
|
|
215
|
-
exit 1
|
|
216
|
-
;;
|
|
217
|
-
esac
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
# Dotfiles CLI - Diagnostics Commands
|
|
5
|
-
# doctor, heal, health, rollback, drift, history, benchmark, verify, perf,
|
|
6
|
-
# scorecard, conflicts, locks, snapshot, load-bench, chaos, bundle, attest
|
|
7
|
-
|
|
8
|
-
set -euo pipefail
|
|
9
|
-
|
|
10
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
-
# shellcheck source=../../../lib/dot/utils.sh
|
|
12
|
-
source "$SCRIPT_DIR/../../../lib/dot/utils.sh"
|
|
13
|
-
|
|
14
|
-
dot_ui_command_banner "Diagnostics" "${1:-}" "$@"
|
|
15
|
-
|
|
16
|
-
usage() {
|
|
17
|
-
cat <<'EOF'
|
|
18
|
-
Usage: diagnostics.sh <command> [args...]
|
|
19
|
-
|
|
20
|
-
Commands:
|
|
21
|
-
doctor, heal, health, security-score, scorecard, perf, conflicts, locks,
|
|
22
|
-
snapshot, attest, rollback, drift, history, benchmark, verify, restore,
|
|
23
|
-
load-bench, load-bench-pty, chaos, teleport, secret-audit, bundle, metrics,
|
|
24
|
-
smoke-test, intelligence
|
|
25
|
-
EOF
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
cmd_doctor() {
|
|
29
|
-
local src_dir
|
|
30
|
-
src_dir="$(resolve_source_dir)"
|
|
31
|
-
# Prefer the unified doctor script (doctor-unified.sh)
|
|
32
|
-
if [ -n "$src_dir" ] && [ -f "$src_dir/scripts/diagnostics/doctor-unified.sh" ]; then
|
|
33
|
-
exec bash "$src_dir/scripts/diagnostics/doctor-unified.sh" "$@"
|
|
34
|
-
elif [ -n "$src_dir" ] && [ -f "$src_dir/scripts/diagnostics/doctor.sh" ]; then
|
|
35
|
-
exec bash "$src_dir/scripts/diagnostics/doctor.sh" "$@"
|
|
36
|
-
fi
|
|
37
|
-
exec chezmoi doctor "$@"
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
cmd_smoke_test() {
|
|
41
|
-
run_script "scripts/diagnostics/smoke-test.sh" "Smoke test script" "$@"
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
cmd_intelligence() {
|
|
45
|
-
run_script "lib/dot/bento.sh" "Intelligence Surface" "$@"
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
cmd_heal() {
|
|
49
|
-
run_script "scripts/ops/heal.sh" "Heal script" "$@"
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
cmd_health() {
|
|
53
|
-
run_script "scripts/diagnostics/health.sh" "Health dashboard" "$@"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
cmd_security_score() {
|
|
57
|
-
run_script "scripts/diagnostics/security-score.sh" "Security score" "$@"
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
cmd_scorecard() {
|
|
61
|
-
run_script "scripts/diagnostics/scorecard.sh" "Scorecard" "$@"
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
cmd_perf() {
|
|
65
|
-
run_script "scripts/diagnostics/perf.sh" "Performance profiling" "$@"
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
cmd_conflicts() {
|
|
69
|
-
run_script "scripts/diagnostics/conflicts.sh" "Conflicts report" "$@"
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
cmd_locks() {
|
|
73
|
-
run_script "scripts/diagnostics/version-locks.sh" "Version locks" "$@"
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
cmd_snapshot() {
|
|
77
|
-
run_script "scripts/diagnostics/snapshot.sh" "Snapshot" "$@"
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
cmd_attest() {
|
|
81
|
-
run_script "scripts/diagnostics/workstation-attestation.sh" "Workstation attestation" "$@"
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
cmd_rollback() {
|
|
85
|
-
run_script "scripts/ops/rollback.sh" "Rollback script" "$@"
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
cmd_drift() {
|
|
89
|
-
local src_dir
|
|
90
|
-
src_dir="$(resolve_source_dir)"
|
|
91
|
-
if [ -n "$src_dir" ] && [ -f "$src_dir/scripts/diagnostics/drift-dashboard.sh" ]; then
|
|
92
|
-
exec bash "$src_dir/scripts/diagnostics/drift-dashboard.sh" "$@"
|
|
93
|
-
fi
|
|
94
|
-
exec chezmoi status "$@"
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
cmd_history() {
|
|
98
|
-
run_script "scripts/diagnostics/history-analysis.sh" "History analysis script" "$@"
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
cmd_benchmark() {
|
|
102
|
-
run_script "scripts/diagnostics/benchmark.sh" "Benchmark script" "$@"
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
cmd_verify() {
|
|
106
|
-
run_script "scripts/diagnostics/verify.sh" "Verify script" "$@"
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
cmd_restore() {
|
|
110
|
-
run_script "scripts/dot/commands/restore.sh" "Restore script" "$@"
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
cmd_load_bench() {
|
|
114
|
-
command dot-load-benchmark "$@"
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
cmd_load_bench_pty() {
|
|
118
|
-
command dot-load-benchmark-pty "$@"
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
cmd_chaos() {
|
|
122
|
-
run_script "scripts/ops/chaos.sh" "Chaos engineering script" "$@"
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
cmd_teleport() {
|
|
126
|
-
run_script "scripts/ops/teleport.sh" "Teleport script" "$@"
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
cmd_secret_audit() {
|
|
130
|
-
run_script "scripts/diagnostics/secret-governance.sh" "Secret governance script" "$@"
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
cmd_bundle() {
|
|
134
|
-
run_script "scripts/ops/bundle.sh" "Offline bundle script" "$@"
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
cmd_metrics() {
|
|
138
|
-
local src_dir
|
|
139
|
-
src_dir="$(resolve_source_dir)"
|
|
140
|
-
if [[ -z "$src_dir" ]]; then
|
|
141
|
-
echo "Dotfiles source not found." >&2
|
|
142
|
-
exit 1
|
|
143
|
-
fi
|
|
144
|
-
# shellcheck source=../../../lib/dot/log.sh
|
|
145
|
-
# shellcheck disable=SC1091
|
|
146
|
-
source "$src_dir/lib/dot/log.sh"
|
|
147
|
-
ui_header "Recent Metrics"
|
|
148
|
-
echo ""
|
|
149
|
-
dot_metrics_summary "${1:-20}"
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
# Dispatch
|
|
153
|
-
case "${1:-}" in
|
|
154
|
-
--help | -h | help)
|
|
155
|
-
usage
|
|
156
|
-
;;
|
|
157
|
-
"")
|
|
158
|
-
usage
|
|
159
|
-
exit 1
|
|
160
|
-
;;
|
|
161
|
-
doctor)
|
|
162
|
-
shift
|
|
163
|
-
cmd_doctor "$@"
|
|
164
|
-
;;
|
|
165
|
-
heal)
|
|
166
|
-
shift
|
|
167
|
-
cmd_heal "$@"
|
|
168
|
-
;;
|
|
169
|
-
health | health-check)
|
|
170
|
-
shift
|
|
171
|
-
cmd_health "$@"
|
|
172
|
-
;;
|
|
173
|
-
security-score)
|
|
174
|
-
shift
|
|
175
|
-
cmd_security_score "$@"
|
|
176
|
-
;;
|
|
177
|
-
scorecard | score)
|
|
178
|
-
shift
|
|
179
|
-
cmd_scorecard "$@"
|
|
180
|
-
;;
|
|
181
|
-
perf)
|
|
182
|
-
shift
|
|
183
|
-
cmd_perf "$@"
|
|
184
|
-
;;
|
|
185
|
-
conflicts)
|
|
186
|
-
shift
|
|
187
|
-
cmd_conflicts "$@"
|
|
188
|
-
;;
|
|
189
|
-
locks)
|
|
190
|
-
shift
|
|
191
|
-
cmd_locks "$@"
|
|
192
|
-
;;
|
|
193
|
-
snapshot)
|
|
194
|
-
shift
|
|
195
|
-
cmd_snapshot "$@"
|
|
196
|
-
;;
|
|
197
|
-
attest | attestation)
|
|
198
|
-
shift
|
|
199
|
-
cmd_attest "$@"
|
|
200
|
-
;;
|
|
201
|
-
rollback)
|
|
202
|
-
shift
|
|
203
|
-
cmd_rollback "$@"
|
|
204
|
-
;;
|
|
205
|
-
drift)
|
|
206
|
-
shift
|
|
207
|
-
cmd_drift "$@"
|
|
208
|
-
;;
|
|
209
|
-
history)
|
|
210
|
-
shift
|
|
211
|
-
cmd_history "$@"
|
|
212
|
-
;;
|
|
213
|
-
benchmark)
|
|
214
|
-
shift
|
|
215
|
-
cmd_benchmark "$@"
|
|
216
|
-
;;
|
|
217
|
-
verify)
|
|
218
|
-
shift
|
|
219
|
-
cmd_verify "$@"
|
|
220
|
-
;;
|
|
221
|
-
restore)
|
|
222
|
-
shift
|
|
223
|
-
cmd_restore "$@"
|
|
224
|
-
;;
|
|
225
|
-
load-bench)
|
|
226
|
-
shift
|
|
227
|
-
cmd_load_bench "$@"
|
|
228
|
-
;;
|
|
229
|
-
load-bench-pty)
|
|
230
|
-
shift
|
|
231
|
-
cmd_load_bench_pty "$@"
|
|
232
|
-
;;
|
|
233
|
-
chaos)
|
|
234
|
-
shift
|
|
235
|
-
cmd_chaos "$@"
|
|
236
|
-
;;
|
|
237
|
-
teleport)
|
|
238
|
-
shift
|
|
239
|
-
cmd_teleport "$@"
|
|
240
|
-
;;
|
|
241
|
-
secret-audit)
|
|
242
|
-
shift
|
|
243
|
-
cmd_secret_audit "$@"
|
|
244
|
-
;;
|
|
245
|
-
bundle)
|
|
246
|
-
shift
|
|
247
|
-
cmd_bundle "$@"
|
|
248
|
-
;;
|
|
249
|
-
metrics)
|
|
250
|
-
shift
|
|
251
|
-
cmd_metrics "$@"
|
|
252
|
-
;;
|
|
253
|
-
smoke-test)
|
|
254
|
-
shift
|
|
255
|
-
cmd_smoke_test "$@"
|
|
256
|
-
;;
|
|
257
|
-
intelligence)
|
|
258
|
-
shift
|
|
259
|
-
cmd_intelligence "$@"
|
|
260
|
-
;;
|
|
261
|
-
*)
|
|
262
|
-
echo "Unknown diagnostics command: ${1:-}" >&2
|
|
263
|
-
exit 1
|
|
264
|
-
;;
|
|
265
|
-
esac
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
# Copyright (c) 2015-2026 Sebastien Rousseau
|
|
4
|
-
#
|
|
5
|
-
# `dot env emit` — render a portable workstation-environment
|
|
6
|
-
# manifest. The output is the canonical "what is installed on this
|
|
7
|
-
# machine + at what version + from which source" record that
|
|
8
|
-
# downstream tooling (CycloneDX SBOM aggregators, AgentSpec /
|
|
9
|
-
# AAIF agents, EU CRA compliance reports) consumes.
|
|
10
|
-
#
|
|
11
|
-
# v1 schema at docs/schema/dot-env-v1.json. Conforming to a fixed
|
|
12
|
-
# schema lets us re-render this manifest into any downstream format
|
|
13
|
-
# (AGENTS.md, devcontainer-feature.json, Brewfile, mise.toml) from
|
|
14
|
-
# a single source of truth — see docs/operations/MANIFEST.md.
|
|
15
|
-
#
|
|
16
|
-
# Usage:
|
|
17
|
-
# dot env emit # default: json
|
|
18
|
-
# dot env emit --format json
|
|
19
|
-
# dot env emit --output env.json
|
|
20
|
-
# dot env emit --pretty # default; --compact for one-line
|
|
21
|
-
#
|
|
22
|
-
# Exit codes:
|
|
23
|
-
# 0 manifest written / printed
|
|
24
|
-
# 1 bad usage
|
|
25
|
-
# 2 jq or mise missing
|
|
26
|
-
# 3 mise call failed
|
|
27
|
-
|
|
28
|
-
set -euo pipefail
|
|
29
|
-
|
|
30
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
31
|
-
# shellcheck source=../../../lib/dot/utils.sh
|
|
32
|
-
source "$SCRIPT_DIR/../../../lib/dot/utils.sh"
|
|
33
|
-
|
|
34
|
-
dot_env_emit() {
|
|
35
|
-
local format="json"
|
|
36
|
-
local output=""
|
|
37
|
-
local pretty=1
|
|
38
|
-
|
|
39
|
-
while (($#)); do
|
|
40
|
-
case "$1" in
|
|
41
|
-
--format)
|
|
42
|
-
format="${2:-}"
|
|
43
|
-
shift 2 || {
|
|
44
|
-
ui_err "--format needs a value"
|
|
45
|
-
return 1
|
|
46
|
-
}
|
|
47
|
-
;;
|
|
48
|
-
--format=*)
|
|
49
|
-
format="${1#*=}"
|
|
50
|
-
shift
|
|
51
|
-
;;
|
|
52
|
-
--output | -o)
|
|
53
|
-
output="${2:-}"
|
|
54
|
-
shift 2 || {
|
|
55
|
-
ui_err "--output needs a value"
|
|
56
|
-
return 1
|
|
57
|
-
}
|
|
58
|
-
;;
|
|
59
|
-
--output=*)
|
|
60
|
-
output="${1#*=}"
|
|
61
|
-
shift
|
|
62
|
-
;;
|
|
63
|
-
--pretty)
|
|
64
|
-
pretty=1
|
|
65
|
-
shift
|
|
66
|
-
;;
|
|
67
|
-
--compact)
|
|
68
|
-
pretty=0
|
|
69
|
-
shift
|
|
70
|
-
;;
|
|
71
|
-
-h | --help)
|
|
72
|
-
cat <<-EOF
|
|
73
|
-
Usage: dot env emit [--format <fmt>] [--output <path>] [--pretty|--compact]
|
|
74
|
-
|
|
75
|
-
Render the workstation-environment manifest (v1 schema).
|
|
76
|
-
|
|
77
|
-
Formats:
|
|
78
|
-
json (default) v1 canonical form per docs/schema/dot-env-v1.json
|
|
79
|
-
ndjson one JSON object per tool — easier to grep / pipe
|
|
80
|
-
|
|
81
|
-
Output:
|
|
82
|
-
--output FILE write to FILE (atomic mktemp + mv)
|
|
83
|
-
default stdout
|
|
84
|
-
|
|
85
|
-
Examples:
|
|
86
|
-
dot env emit # print to stdout
|
|
87
|
-
dot env emit --output env.json # write atomically
|
|
88
|
-
dot env emit --format ndjson | grep '^{"name":"node"'
|
|
89
|
-
EOF
|
|
90
|
-
return 0
|
|
91
|
-
;;
|
|
92
|
-
*)
|
|
93
|
-
ui_err "unknown flag: $1"
|
|
94
|
-
return 1
|
|
95
|
-
;;
|
|
96
|
-
esac
|
|
97
|
-
done
|
|
98
|
-
|
|
99
|
-
case "$format" in
|
|
100
|
-
json | ndjson) ;;
|
|
101
|
-
*)
|
|
102
|
-
ui_err "unsupported format: $format (json, ndjson)"
|
|
103
|
-
return 1
|
|
104
|
-
;;
|
|
105
|
-
esac
|
|
106
|
-
|
|
107
|
-
has_command jq || {
|
|
108
|
-
ui_err "jq required (brew install jq / apt install jq)"
|
|
109
|
-
return 2
|
|
110
|
-
}
|
|
111
|
-
has_command mise || {
|
|
112
|
-
ui_err "mise required (the manifest's source of truth)"
|
|
113
|
-
return 2
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
local mise_raw
|
|
117
|
-
mise_raw="$(mise ls --json 2>/dev/null)" || {
|
|
118
|
-
ui_err "mise ls --json failed"
|
|
119
|
-
return 3
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
# Static fields we want in every manifest: schema version + emit
|
|
123
|
-
# timestamp + emitter version + repo URL + the host fingerprint
|
|
124
|
-
# bits chezmoi already records (os, machine).
|
|
125
|
-
local emitter_version
|
|
126
|
-
emitter_version="$(grep -E '^dotfiles_version[[:space:]]*=' \
|
|
127
|
-
"$(resolve_chezmoi_source_dir)/.chezmoidata.toml" 2>/dev/null |
|
|
128
|
-
head -1 | sed -E 's/.*"([^"]+)".*/\1/' || echo "unknown")"
|
|
129
|
-
local timestamp
|
|
130
|
-
timestamp="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
131
|
-
local os_type machine_arch
|
|
132
|
-
os_type="$(uname -s 2>/dev/null || echo unknown)"
|
|
133
|
-
machine_arch="$(uname -m 2>/dev/null || echo unknown)"
|
|
134
|
-
local hostname
|
|
135
|
-
hostname="$(uname -n 2>/dev/null || echo unknown)"
|
|
136
|
-
|
|
137
|
-
# Build the manifest. jq does the heavy lifting: take the raw
|
|
138
|
-
# `mise ls --json` shape (an object keyed by tool name → array of
|
|
139
|
-
# installed versions) and flatten to a normalised array of tool
|
|
140
|
-
# records. Each record carries: name, version, source (config
|
|
141
|
-
# file or "orphan"), requested (semver/range/latest spec), and
|
|
142
|
-
# install_path (auditable absolute path).
|
|
143
|
-
local body
|
|
144
|
-
body="$(printf '%s' "$mise_raw" | jq --arg ev "$emitter_version" \
|
|
145
|
-
--arg ts "$timestamp" \
|
|
146
|
-
--arg os "$os_type" \
|
|
147
|
-
--arg arch "$machine_arch" \
|
|
148
|
-
--arg host "$hostname" '
|
|
149
|
-
{
|
|
150
|
-
schema_version: "https://sebastienrousseau.github.io/dotfiles/schema/dot-env-v1.json",
|
|
151
|
-
manifest_version: "1.0.0",
|
|
152
|
-
emitted_at: $ts,
|
|
153
|
-
emitter: {
|
|
154
|
-
name: "dot env emit",
|
|
155
|
-
version: $ev,
|
|
156
|
-
repo: "github.com/sebastienrousseau/dotfiles"
|
|
157
|
-
},
|
|
158
|
-
host: {
|
|
159
|
-
hostname: $host,
|
|
160
|
-
os: $os,
|
|
161
|
-
arch: $arch
|
|
162
|
-
},
|
|
163
|
-
tools: [
|
|
164
|
-
to_entries[] as $t
|
|
165
|
-
| $t.value[]
|
|
166
|
-
| {
|
|
167
|
-
name: $t.key,
|
|
168
|
-
version: (.version // null),
|
|
169
|
-
source: (.source.path // "orphan"),
|
|
170
|
-
source_type: (.source.type // null),
|
|
171
|
-
requested_version: (.requested_version // null),
|
|
172
|
-
install_path: (.install_path // null),
|
|
173
|
-
active: (.active // false)
|
|
174
|
-
}
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
')"
|
|
178
|
-
|
|
179
|
-
local rendered
|
|
180
|
-
if [[ "$format" == "ndjson" ]]; then
|
|
181
|
-
# NDJSON: header object on line 1, one tool per subsequent line.
|
|
182
|
-
rendered="$(
|
|
183
|
-
printf '%s' "$body" |
|
|
184
|
-
jq -c '
|
|
185
|
-
({schema_version, manifest_version, emitted_at, emitter, host}),
|
|
186
|
-
(.tools[])'
|
|
187
|
-
)"
|
|
188
|
-
elif ((pretty)); then
|
|
189
|
-
rendered="$(printf '%s' "$body" | jq '.')"
|
|
190
|
-
else
|
|
191
|
-
rendered="$(printf '%s' "$body" | jq -c '.')"
|
|
192
|
-
fi
|
|
193
|
-
|
|
194
|
-
if [[ -n "$output" ]]; then
|
|
195
|
-
local tmp
|
|
196
|
-
tmp="$(mktemp "${output}.XXXXXX")"
|
|
197
|
-
printf '%s\n' "$rendered" >|"$tmp"
|
|
198
|
-
mv "$tmp" "$output"
|
|
199
|
-
ui_ok "manifest" "wrote $(printf '%s' "$rendered" | jq -r '.tools | length' 2>/dev/null || echo '?') tools → $output"
|
|
200
|
-
else
|
|
201
|
-
printf '%s\n' "$rendered"
|
|
202
|
-
fi
|
|
203
|
-
}
|